(options: BuildOptions)
| 38 | * @param options the original build options |
| 39 | */ |
| 40 | const 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: |
no test coverage detected