Open History to see the last commit
1// @ts-check
2β
3/**
4 * @param {Object} opts - Options for building configurations.
5 * @param {string[]} opts.entry - The entry array.
6 * @returns {import('tsdown').UserConfig}
7 */
8export function modernConfig(opts) {
9 return {
10 entry: opts.entry,
11 format: ['cjs', 'esm'],
12 target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
13 outDir: 'build/modern',
14 dts: true,
15 fixedExtension: false,
16 sourcemap: true,
17 clean: true,
18 deps: { neverBundle: ['typescript'] },
19 footer: ({ format, fileName }) =>
20 format === 'cjs' && fileName.endsWith('index.cjs')
21 ? 'module.exports = module.exports.default'
22 : undefined,
23 outputOptions: {
24 exports: 'named',
25 },
26 }
27}
28β
29/**
30 * @param {Object} opts - Options for building configurations.
31 * @param {string[]} opts.entry - The entry array.
32 * @returns {import('tsdown').UserConfig}
33 */
34export function legacyConfig(opts) {
35 return {
36 entry: opts.entry,
37 format: ['cjs', 'esm'],
38 target: ['es2020', 'node16'],
39 outDir: 'build/legacy',
40 dts: true,
41 fixedExtension: false,
42 sourcemap: true,
43 clean: true,
44 deps: { neverBundle: ['typescript'] },
45 outputOptions: {
46 exports: 'named',
47 },
48 }
49}