MCPcopy
hub / github.com/prisma/prisma / applyDefaults

Function applyDefaults

helpers/compile/build.ts:40–61  ·  view source on GitHub ↗
(options: BuildOptions)

Source from the content-addressed store, hash-verified

38 * @param options the original build options
39 */
40const applyDefaults = (options: BuildOptions): BuildOptions => ({
41 ...DEFAULT_BUILD_OPTIONS,
42 format: 'cjs',
43 outExtension: { '.js': '.js' },
44 resolveExtensions: ['.ts', '.js', '.node'],
45 entryPoints: glob.sync('./src/**/*.{j,t}s', {
46 ignore: ['./src/__tests__/**/*'],
47 }),
48 mainFields: ['module', 'main'],
49 ...options,
50 // outfile has precedence over outdir, hence these ternaries
51 outfile: options.outfile ? getOutFile(options) : undefined,
52 outdir: options.outfile ? undefined : getOutDir(options),
53 plugins: [
54 ...(options.plugins ?? []),
55 resolvePathsPlugin,
56 fixImportsPlugin,
57 tscPlugin(options.emitTypes),
58 onErrorPlugin,
59 ],
60 external: [...(options.external ?? []), ...getProjectExternals(options)],
61})
62
63/**
64 * Create two deferred builds for esm and cjs. The one follows the other:

Callers 1

createBuildOptionsFunction · 0.85

Calls 4

tscPluginFunction · 0.90
getOutFileFunction · 0.85
getOutDirFunction · 0.85
getProjectExternalsFunction · 0.85

Tested by

no test coverage detected