@xylabs/ts-scripts-yarn3 3.0.73 → 3.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/package/compile/copyTypeFiles.js +2 -0
- package/dist/actions/package/compile/copyTypeFiles.js.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +2 -0
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/tsup2.js +6 -4
- package/dist/actions/package/compile/tsup2.js.map +1 -1
- package/dist/actions/package/compile/tsup2.mjs +6 -4
- package/dist/actions/package/compile/tsup2.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/copyTypeFiles.ts +2 -0
- package/src/actions/package/compile/tsup2.ts +6 -4
|
@@ -35,12 +35,14 @@ const copyTypeFiles = async (compilerOptions) => {
|
|
|
35
35
|
await Promise.all(
|
|
36
36
|
distTypeFiles.map(async (file) => {
|
|
37
37
|
await (0, import_promises.copyFile)(file, file.replace("d.ts", "d.mts"));
|
|
38
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts", "d.cts"));
|
|
38
39
|
})
|
|
39
40
|
);
|
|
40
41
|
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
41
42
|
await Promise.all(
|
|
42
43
|
distTypeMapFiles.map(async (file) => {
|
|
43
44
|
await (0, import_promises.copyFile)(file, file.replace("d.ts.map", "d.mts.map"));
|
|
45
|
+
await (0, import_promises.copyFile)(file, file.replace("d.ts.map", "d.cts.map"));
|
|
44
46
|
})
|
|
45
47
|
);
|
|
46
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n }),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkC;AAGlC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,QAAM,QAAQ;AAAA,IACZ,cAAc,IAAI,OAAO,SAAS;AAChC,gBAAM,0BAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,IACpD,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,QAAM,QAAQ;AAAA,IACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,gBAAM,0BAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkC;AAGlC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,UAAM,yBAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,QAAM,QAAQ;AAAA,IACZ,cAAc,IAAI,OAAO,SAAS;AAChC,gBAAM,0BAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAClD,gBAAM,0BAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,IACpD,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,QAAM,QAAQ;AAAA,IACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,gBAAM,0BAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAC1D,gBAAM,0BAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -12,12 +12,14 @@ const copyTypeFiles = async (compilerOptions) => {
|
|
|
12
12
|
await Promise.all(
|
|
13
13
|
distTypeFiles.map(async (file) => {
|
|
14
14
|
await copyFile(file, file.replace("d.ts", "d.mts"));
|
|
15
|
+
await copyFile(file, file.replace("d.ts", "d.cts"));
|
|
15
16
|
})
|
|
16
17
|
);
|
|
17
18
|
const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions);
|
|
18
19
|
await Promise.all(
|
|
19
20
|
distTypeMapFiles.map(async (file) => {
|
|
20
21
|
await copyFile(file, file.replace("d.ts.map", "d.mts.map"));
|
|
22
|
+
await copyFile(file, file.replace("d.ts.map", "d.cts.map"));
|
|
21
23
|
})
|
|
22
24
|
);
|
|
23
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n }),\n )\n}\n"],"mappings":"AAAA,SAAS,UAAU,eAAe;AAGlC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,QAAM,QAAQ;AAAA,IACZ,cAAc,IAAI,OAAO,SAAS;AAChC,YAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,IACpD,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,QAAM,QAAQ;AAAA,IACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,YAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/copyTypeFiles.ts"],"sourcesContent":["import { copyFile, readdir } from 'fs/promises'\nimport { TsConfigCompilerOptions } from 'tsc-prog'\n\nconst getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)\n}\n\nconst getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n const outDir = compilerOptions.outDir ?? 'dist'\n return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)\n}\n\nexport const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {\n //hybrid packages want two copies of the types\n const distTypeFiles = await getDistTypeFiles(compilerOptions)\n await Promise.all(\n distTypeFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts', 'd.mts'))\n await copyFile(file, file.replace('d.ts', 'd.cts'))\n }),\n )\n\n const distTypeMapFiles = await getDistTypeMapFiles(compilerOptions)\n await Promise.all(\n distTypeMapFiles.map(async (file) => {\n await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))\n await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))\n }),\n )\n}\n"],"mappings":"AAAA,SAAS,UAAU,eAAe;AAGlC,MAAM,mBAAmB,OAAO,oBAA6C;AAC3E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AAC/H;AAEA,MAAM,sBAAsB,OAAO,oBAA6C;AAC9E,QAAM,SAAS,gBAAgB,UAAU;AACzC,UAAQ,MAAM,QAAQ,QAAQ,EAAE,WAAW,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,EAAE;AACnI;AAEO,MAAM,gBAAgB,OAAO,oBAA6C;AAE/E,QAAM,gBAAgB,MAAM,iBAAiB,eAAe;AAC5D,QAAM,QAAQ;AAAA,IACZ,cAAc,IAAI,OAAO,SAAS;AAChC,YAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAClD,YAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AAAA,IACpD,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,MAAM,oBAAoB,eAAe;AAClE,QAAM,QAAQ;AAAA,IACZ,iBAAiB,IAAI,OAAO,SAAS;AACnC,YAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAC1D,YAAM,SAAS,MAAM,KAAK,QAAQ,YAAY,WAAW,CAAC;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -37,7 +37,6 @@ const compileFolder = async (folder, options, _verbose) => {
|
|
|
37
37
|
dts: false,
|
|
38
38
|
entry,
|
|
39
39
|
format: ["cjs", "esm"],
|
|
40
|
-
loader: { ".gif": "copy", ".jpg": "copy", ".json": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
41
40
|
outDir,
|
|
42
41
|
silent: true,
|
|
43
42
|
sourcemap: true,
|
|
@@ -68,10 +67,11 @@ const packageCompileTsup2 = async (params) => {
|
|
|
68
67
|
return folder ? await compileFolder(
|
|
69
68
|
folder,
|
|
70
69
|
{
|
|
71
|
-
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
72
70
|
outDir: "dist/node",
|
|
73
71
|
platform: "node",
|
|
74
|
-
|
|
72
|
+
skipNodeModulesBundle: true,
|
|
73
|
+
target: "node16",
|
|
74
|
+
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
75
75
|
...typeof options === "object" ? options : {}
|
|
76
76
|
},
|
|
77
77
|
verbose
|
|
@@ -83,13 +83,15 @@ const packageCompileTsup2 = async (params) => {
|
|
|
83
83
|
return folder ? await compileFolder(
|
|
84
84
|
folder,
|
|
85
85
|
{
|
|
86
|
-
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
87
86
|
bundle: false,
|
|
88
87
|
format: ["esm", "cjs"],
|
|
88
|
+
loader: { ".gif": "copy", ".jpg": "copy", ".json": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
89
89
|
outDir: "dist/browser",
|
|
90
90
|
outExtension: ({ format }) => format === "esm" ? { js: ".js" } : { js: ".cjs" },
|
|
91
91
|
platform: "browser",
|
|
92
|
+
skipNodeModulesBundle: true,
|
|
92
93
|
target: "esnext",
|
|
94
|
+
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
93
95
|
...typeof options === "object" ? options : {}
|
|
94
96
|
},
|
|
95
97
|
verbose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs2 } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n browser?: Record<string, Options | boolean>\n node?: Record<string, Options | boolean>\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (folder: string, options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2(folder).filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs2 } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n browser?: Record<string, Options | boolean>\n node?: Record<string, Options | boolean>\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (folder: string, options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2(folder).filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n return folder\n ? await compileFolder(\n folder,\n {\n outDir: 'dist/node',\n platform: 'node',\n skipNodeModulesBundle: true,\n target: 'node16',\n ...(compile?.tsup?.options ?? {}),\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0) ||\n (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n return folder\n ? await compileFolder(\n folder,\n {\n bundle: false,\n format: ['esm', 'cjs'],\n loader: { '.gif': 'copy', '.jpg': 'copy', '.json': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },\n outDir: 'dist/browser',\n outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),\n platform: 'browser',\n skipNodeModulesBundle: true,\n target: 'esnext',\n ...(compile?.tsup?.options ?? {}),\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0) ||\n (compileForNode ? await packageCompileTscTypes({ verbose }, { outDir: 'dist/node' }) : 0) ||\n (compileForBrowser ? await packageCompileTscTypes({ verbose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A,QACA;AAAA,MACF,IACA;AAAA,IACN,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,MACxC,iBAAiB,UAAM,wCAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,IAAI,OACtF,oBAAoB,UAAM,wCAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,eAAe,CAAC,IAAI,OAC5F,UAAU,UAAM,+BAAe,IAAI;AAExC;","names":["entry","options"]}
|
|
@@ -14,7 +14,6 @@ const compileFolder = async (folder, options, _verbose) => {
|
|
|
14
14
|
dts: false,
|
|
15
15
|
entry,
|
|
16
16
|
format: ["cjs", "esm"],
|
|
17
|
-
loader: { ".gif": "copy", ".jpg": "copy", ".json": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
18
17
|
outDir,
|
|
19
18
|
silent: true,
|
|
20
19
|
sourcemap: true,
|
|
@@ -45,10 +44,11 @@ const packageCompileTsup2 = async (params) => {
|
|
|
45
44
|
return folder ? await compileFolder(
|
|
46
45
|
folder,
|
|
47
46
|
{
|
|
48
|
-
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
49
47
|
outDir: "dist/node",
|
|
50
48
|
platform: "node",
|
|
51
|
-
|
|
49
|
+
skipNodeModulesBundle: true,
|
|
50
|
+
target: "node16",
|
|
51
|
+
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
52
52
|
...typeof options === "object" ? options : {}
|
|
53
53
|
},
|
|
54
54
|
verbose
|
|
@@ -60,13 +60,15 @@ const packageCompileTsup2 = async (params) => {
|
|
|
60
60
|
return folder ? await compileFolder(
|
|
61
61
|
folder,
|
|
62
62
|
{
|
|
63
|
-
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
64
63
|
bundle: false,
|
|
65
64
|
format: ["esm", "cjs"],
|
|
65
|
+
loader: { ".gif": "copy", ".jpg": "copy", ".json": "copy", ".png": "copy", ".svg": "copy", ".webp": "copy" },
|
|
66
66
|
outDir: "dist/browser",
|
|
67
67
|
outExtension: ({ format }) => format === "esm" ? { js: ".js" } : { js: ".cjs" },
|
|
68
68
|
platform: "browser",
|
|
69
|
+
skipNodeModulesBundle: true,
|
|
69
70
|
target: "esnext",
|
|
71
|
+
...((_a = compile == null ? void 0 : compile.tsup) == null ? void 0 : _a.options) ?? {},
|
|
70
72
|
...typeof options === "object" ? options : {}
|
|
71
73
|
},
|
|
72
74
|
verbose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs2 } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n browser?: Record<string, Options | boolean>\n node?: Record<string, Options | boolean>\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (folder: string, options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2(folder).filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup2.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs2 } from './inputs'\nimport { packageCompileTscNoEmit } from './tscNoEmit'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsup2Params = Partial<\n CompileParams & {\n compile?: {\n browser?: Record<string, Options | boolean>\n node?: Record<string, Options | boolean>\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileFolder = async (folder: string, options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = getAllInputs2(folder).filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['cjs', 'esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return 0\n}\n\nexport const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) => {\n const { verbose, compile } = await loadConfig(params)\n const publint = compile?.publint ?? true\n if (verbose) {\n console.log(`Compiling with TSUP [Depth: ${compile?.depth}]`)\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n\n return (\n packageCompileTscNoEmit({ verbose }) ||\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n return folder\n ? await compileFolder(\n folder,\n {\n outDir: 'dist/node',\n platform: 'node',\n skipNodeModulesBundle: true,\n target: 'node16',\n ...(compile?.tsup?.options ?? {}),\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0) ||\n (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([folder, options]) => {\n return folder\n ? await compileFolder(\n folder,\n {\n bundle: false,\n format: ['esm', 'cjs'],\n loader: { '.gif': 'copy', '.jpg': 'copy', '.json': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },\n outDir: 'dist/browser',\n outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),\n platform: 'browser',\n skipNodeModulesBundle: true,\n target: 'esnext',\n ...(compile?.tsup?.options ?? {}),\n ...(typeof options === 'object' ? options : {}),\n },\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0) ||\n (compileForNode ? await packageCompileTscTypes({ verbose }, { outDir: 'dist/node' }) : 0) ||\n (compileForBrowser ? await packageCompileTscTypes({ verbose }, { outDir: 'dist/browser' }) : 0) ||\n (publint ? await packagePublint() : 0)\n )\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAcvC,MAAM,gBAAgB,OAAO,QAAgB,SAAmB,aAAuB;AACrF,QAAM,UAAS,mCAAS,WAAU;AAClC,QAAM,QAAQ,cAAc,MAAM,EAAE,OAAO,CAACA,WAAU,CAACA,OAAM,SAAS,QAAQ,KAAK,CAACA,OAAM,SAAS,SAAS,CAAC;AAC7G,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB;AAAA,IACA,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOC,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,C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;AAAA,UAC3G,QAAQ;AAAA,UACR,cAAc,CAAC,EAAE,OAAO,MAAO,WAAW,QAAQ,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,OAAO;AAAA,UAC/E,UAAU;AAAA,UACV,uBAAuB;AAAA,UACvB,QAAQ;AAAA,UACR,KAAI,wCAAS,SAAT,mBAAe,YAAW,CAAC;AAAA,UAC/B,GAAI,OAAO,YAAY,WAAW,UAAU,CAAC;AAAA,QAC/C;AAAA,QACA;AAAA,MACF,IACA;AAAA,IACN,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,MACxC,iBAAiB,MAAM,uBAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,IAAI,OACtF,oBAAoB,MAAM,uBAAuB,EAAE,QAAQ,GAAG,EAAE,QAAQ,eAAe,CAAC,IAAI,OAC5F,UAAU,MAAM,eAAe,IAAI;AAExC;","names":["entry","options"]}
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/yargs": "^17.0.25",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
68
68
|
"@typescript-eslint/parser": "^6.7.3",
|
|
69
|
-
"@xylabs/tsconfig": "~3.0.
|
|
69
|
+
"@xylabs/tsconfig": "~3.0.75",
|
|
70
70
|
"chalk": "^4.1.2",
|
|
71
71
|
"cosmiconfig": "^8.3.6",
|
|
72
72
|
"cpy": "^8.1.2",
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"@types/license-checker": "^25.0.4",
|
|
111
111
|
"@types/lodash": "^4.14.199",
|
|
112
112
|
"@types/parse-git-config": "^3.0.2",
|
|
113
|
-
"@xylabs/eslint-config": "^3.0.
|
|
114
|
-
"@xylabs/tsconfig": "^3.0.
|
|
113
|
+
"@xylabs/eslint-config": "^3.0.75",
|
|
114
|
+
"@xylabs/tsconfig": "^3.0.75",
|
|
115
115
|
"publint": "^0.2.2",
|
|
116
116
|
"typescript": "^5.2.2"
|
|
117
117
|
},
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"package-clean": "echo Not cleaning..."
|
|
170
170
|
},
|
|
171
171
|
"sideEffects": false,
|
|
172
|
-
"version": "3.0.
|
|
172
|
+
"version": "3.0.75"
|
|
173
173
|
}
|
|
@@ -17,6 +17,7 @@ export const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) =>
|
|
|
17
17
|
await Promise.all(
|
|
18
18
|
distTypeFiles.map(async (file) => {
|
|
19
19
|
await copyFile(file, file.replace('d.ts', 'd.mts'))
|
|
20
|
+
await copyFile(file, file.replace('d.ts', 'd.cts'))
|
|
20
21
|
}),
|
|
21
22
|
)
|
|
22
23
|
|
|
@@ -24,6 +25,7 @@ export const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) =>
|
|
|
24
25
|
await Promise.all(
|
|
25
26
|
distTypeMapFiles.map(async (file) => {
|
|
26
27
|
await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))
|
|
28
|
+
await copyFile(file, file.replace('d.ts.map', 'd.cts.map'))
|
|
27
29
|
}),
|
|
28
30
|
)
|
|
29
31
|
}
|
|
@@ -29,7 +29,6 @@ const compileFolder = async (folder: string, options?: Options, _verbose?: boole
|
|
|
29
29
|
dts: false,
|
|
30
30
|
entry,
|
|
31
31
|
format: ['cjs', 'esm'],
|
|
32
|
-
loader: { '.gif': 'copy', '.jpg': 'copy', '.json': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
|
|
33
32
|
outDir,
|
|
34
33
|
silent: true,
|
|
35
34
|
sourcemap: true,
|
|
@@ -71,10 +70,11 @@ export const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) =>
|
|
|
71
70
|
? await compileFolder(
|
|
72
71
|
folder,
|
|
73
72
|
{
|
|
74
|
-
...(compile?.tsup?.options ?? {}),
|
|
75
73
|
outDir: 'dist/node',
|
|
76
74
|
platform: 'node',
|
|
77
|
-
|
|
75
|
+
skipNodeModulesBundle: true,
|
|
76
|
+
target: 'node16',
|
|
77
|
+
...(compile?.tsup?.options ?? {}),
|
|
78
78
|
...(typeof options === 'object' ? options : {}),
|
|
79
79
|
},
|
|
80
80
|
verbose,
|
|
@@ -90,13 +90,15 @@ export const packageCompileTsup2 = async (params?: PackageCompileTsup2Params) =>
|
|
|
90
90
|
? await compileFolder(
|
|
91
91
|
folder,
|
|
92
92
|
{
|
|
93
|
-
...(compile?.tsup?.options ?? {}),
|
|
94
93
|
bundle: false,
|
|
95
94
|
format: ['esm', 'cjs'],
|
|
95
|
+
loader: { '.gif': 'copy', '.jpg': 'copy', '.json': 'copy', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
|
|
96
96
|
outDir: 'dist/browser',
|
|
97
97
|
outExtension: ({ format }) => (format === 'esm' ? { js: '.js' } : { js: '.cjs' }),
|
|
98
98
|
platform: 'browser',
|
|
99
|
+
skipNodeModulesBundle: true,
|
|
99
100
|
target: 'esnext',
|
|
101
|
+
...(compile?.tsup?.options ?? {}),
|
|
100
102
|
...(typeof options === 'object' ? options : {}),
|
|
101
103
|
},
|
|
102
104
|
verbose,
|