@xylabs/ts-scripts-yarn3 7.0.0-rc.21 → 7.0.0-rc.23
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/index.mjs +69 -44
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +9 -3
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +55 -30
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +55 -30
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +8 -2
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +15 -4
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +39 -20
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +55 -30
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +61 -36
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +55 -30
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +55 -30
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +55 -30
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +55 -30
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +55 -30
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +55 -30
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +55 -30
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +69 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { glob } from "glob";
|
|
4
4
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
5
|
-
return glob.sync(`${srcDir}
|
|
5
|
+
return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
6
6
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
7
7
|
if (verbose) {
|
|
8
8
|
console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
9
9
|
}
|
|
10
10
|
return result;
|
|
11
|
-
})
|
|
11
|
+
}), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
12
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
13
|
+
if (verbose) {
|
|
14
|
+
console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
})];
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
// src/actions/package/compile/buildEntries.ts
|
|
@@ -20,7 +26,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
22
28
|
case "all": {
|
|
23
|
-
entries = excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir);
|
|
29
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
24
30
|
break;
|
|
25
31
|
}
|
|
26
32
|
case "custom": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { glob } from 'glob'\n\nexport const getAllInputs = (srcDir: string, verbose = false) => {\n /* tsup wants posix paths */\n return glob.sync(`${srcDir}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { glob } from 'glob'\n\nexport const getAllInputs = (srcDir: string, verbose = false) => {\n /* tsup wants posix paths */\n return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {\n const result = file.slice(Math.max(0, srcDir.length + 1)) // Remove the folder prefix\n if (verbose) {\n console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`))\n }\n return result\n }), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {\n const result = file.slice(Math.max(0, srcDir.length + 1)) // Remove the folder prefix\n if (verbose) {\n console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`))\n }\n return result\n })]\n}\n","import type { Options } from 'tsup'\n\nimport { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (srcDir: string, entryMode: EntryMode = 'single', options?: Options | boolean, excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = ['index-node.ts', 'index-browser.ts']\n break\n }\n case 'all': {\n entries = (excludeSpecAndStories\n ? getAllInputs(srcDir).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.'))\n : getAllInputs(srcDir)).filter(entry => !entry.endsWith('.d.ts'))\n break\n }\n case 'custom': {\n entries = []\n break\n }\n default: {\n entries = ['index.ts']\n break\n }\n }\n\n if (typeof options !== 'boolean' && Array.isArray(options?.entry)) {\n entries.push(...options.entry)\n }\n\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,YAAY;AAEd,IAAM,eAAe,CAAC,QAAgB,UAAU,UAAU;AAE/D,SAAO,CAAC,GAAG,KAAK,KAAK,GAA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G,QAAQ,KAAK;AAAA,EAC/B;AAEA,MAAI,QAAS,SAAQ,IAAI,iBAAiB,SAAS,KAAK,QAAQ,MAAM,EAAE;AACxE,SAAO;AACT;","names":[]}
|
|
@@ -74,13 +74,19 @@ import { build, defineConfig } from "tsup";
|
|
|
74
74
|
import chalk3 from "chalk";
|
|
75
75
|
import { glob } from "glob";
|
|
76
76
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
77
|
-
return glob.sync(`${srcDir}
|
|
77
|
+
return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
78
78
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
79
79
|
if (verbose) {
|
|
80
80
|
console.log(chalk3.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
81
81
|
}
|
|
82
82
|
return result;
|
|
83
|
-
})
|
|
83
|
+
}), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
84
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
85
|
+
if (verbose) {
|
|
86
|
+
console.log(chalk3.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
})];
|
|
84
90
|
};
|
|
85
91
|
|
|
86
92
|
// src/actions/package/compile/buildEntries.ts
|
|
@@ -92,7 +98,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
92
98
|
break;
|
|
93
99
|
}
|
|
94
100
|
case "all": {
|
|
95
|
-
entries = excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir);
|
|
101
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
96
102
|
break;
|
|
97
103
|
}
|
|
98
104
|
case "custom": {
|
|
@@ -138,7 +144,7 @@ function deepMergeObjects(objects) {
|
|
|
138
144
|
import { cwd as cwd2 } from "process";
|
|
139
145
|
import chalk4 from "chalk";
|
|
140
146
|
import { createProgramFromConfig } from "tsc-prog";
|
|
141
|
-
import {
|
|
147
|
+
import ts, {
|
|
142
148
|
DiagnosticCategory,
|
|
143
149
|
formatDiagnosticsWithColorAndContext,
|
|
144
150
|
getPreEmitDiagnostics,
|
|
@@ -155,11 +161,20 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
155
161
|
};
|
|
156
162
|
|
|
157
163
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
158
|
-
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "
|
|
164
|
+
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
159
165
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
160
166
|
if (verbose) {
|
|
161
167
|
console.log(chalk4.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
162
168
|
}
|
|
169
|
+
const configFilePath = ts.findConfigFile(
|
|
170
|
+
"./",
|
|
171
|
+
// search path
|
|
172
|
+
ts.sys.fileExists,
|
|
173
|
+
"tsconfig.json"
|
|
174
|
+
);
|
|
175
|
+
if (configFilePath === void 0) {
|
|
176
|
+
throw new Error("Could not find tsconfig.json");
|
|
177
|
+
}
|
|
163
178
|
const compilerOptions = {
|
|
164
179
|
...getCompilerOptions({
|
|
165
180
|
removeComments: false,
|
|
@@ -181,9 +196,11 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "build", co
|
|
|
181
196
|
try {
|
|
182
197
|
if (entries.length > 0) {
|
|
183
198
|
const program = createProgramFromConfig({
|
|
199
|
+
configFilePath,
|
|
184
200
|
basePath: pkg ?? cwd2(),
|
|
185
201
|
compilerOptions,
|
|
186
|
-
files: entries.map((entry) => `${srcDir}/${entry}`)
|
|
202
|
+
files: entries.map((entry) => `${srcDir}/${entry}`),
|
|
203
|
+
include: [`${srcDir}/**/*.*`]
|
|
187
204
|
});
|
|
188
205
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
189
206
|
if (diagnostics.length > 0) {
|
|
@@ -203,33 +220,42 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "build", co
|
|
|
203
220
|
return 0;
|
|
204
221
|
} finally {
|
|
205
222
|
if (verbose) {
|
|
206
|
-
console.log(chalk4.cyan(`
|
|
223
|
+
console.log(chalk4.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
207
224
|
}
|
|
208
225
|
}
|
|
209
226
|
};
|
|
210
227
|
|
|
211
228
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
229
|
+
import path from "path";
|
|
212
230
|
import { cwd as cwd3 } from "process";
|
|
213
231
|
import chalk5 from "chalk";
|
|
214
232
|
import { rollup } from "rollup";
|
|
215
233
|
import dts from "rollup-plugin-dts";
|
|
216
|
-
import inlineSvg from "rollup-plugin-inline-svg";
|
|
217
234
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
218
235
|
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
236
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
237
|
+
const tsconfigPath = path.resolve(pkg, "tsconfig.json");
|
|
219
238
|
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
239
|
+
try {
|
|
240
|
+
const bundle = await rollup({
|
|
241
|
+
input: inputPath,
|
|
242
|
+
plugins: [dts({
|
|
243
|
+
...options,
|
|
244
|
+
tsconfig: tsconfigPath,
|
|
245
|
+
compilerOptions: { emitDeclarationOnly: true, noEmit: false }
|
|
246
|
+
}), ...nodePlugIns],
|
|
247
|
+
onwarn(warning, warn) {
|
|
248
|
+
if (warning.code === "UNUSED_EXTERNAL_IMPORT") return;
|
|
249
|
+
warn(warning);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
await bundle.write({
|
|
253
|
+
file: outputPath,
|
|
254
|
+
format: "es"
|
|
255
|
+
});
|
|
256
|
+
} catch (ex) {
|
|
257
|
+
console.error(ex);
|
|
258
|
+
}
|
|
233
259
|
if (verbose) {
|
|
234
260
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
235
261
|
}
|
|
@@ -246,19 +272,18 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
246
272
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
247
273
|
return [...splitEntryName.slice(0, -1), newEntryExtension].join(".");
|
|
248
274
|
};
|
|
249
|
-
const compilerOptions = {
|
|
275
|
+
const compilerOptions = getCompilerOptions({
|
|
250
276
|
removeComments: false,
|
|
251
277
|
skipDefaultLibCheck: true,
|
|
252
278
|
skipLibCheck: true,
|
|
253
279
|
sourceMap: false,
|
|
254
280
|
emitDeclarationOnly: false,
|
|
255
281
|
noEmit: true
|
|
256
|
-
};
|
|
282
|
+
});
|
|
257
283
|
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
258
284
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
259
285
|
const entryTypeName = entryNameToTypeName(entryName);
|
|
260
|
-
|
|
261
|
-
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions, tsconfig: "tsconfig.json" }, verbose);
|
|
286
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
262
287
|
}));
|
|
263
288
|
if (verbose) {
|
|
264
289
|
console.log(chalk5.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
@@ -276,7 +301,7 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
276
301
|
console.warn(chalk6.yellow(`No entries found in ${srcDir} to compile`));
|
|
277
302
|
return 0;
|
|
278
303
|
}
|
|
279
|
-
const tscOutDir = "
|
|
304
|
+
const tscOutDir = "dist";
|
|
280
305
|
if (verbose) {
|
|
281
306
|
console.log(chalk6.gray(`tscOutDir [${tscOutDir}]`));
|
|
282
307
|
}
|
|
@@ -285,10 +310,10 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
285
310
|
console.error(chalk6.red(`Compile:Validation had ${validationResult} errors`));
|
|
286
311
|
return validationResult;
|
|
287
312
|
}
|
|
288
|
-
const optionsParams = {
|
|
313
|
+
const optionsParams = tsupOptions([{
|
|
289
314
|
bundle: true,
|
|
290
315
|
cjsInterop: true,
|
|
291
|
-
clean:
|
|
316
|
+
clean: false,
|
|
292
317
|
dts: false,
|
|
293
318
|
format: ["esm"],
|
|
294
319
|
outDir,
|
|
@@ -298,7 +323,7 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
298
323
|
tsconfig: "tsconfig.json",
|
|
299
324
|
...options,
|
|
300
325
|
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
301
|
-
};
|
|
326
|
+
}]);
|
|
302
327
|
const optionsResult = defineConfig(optionsParams);
|
|
303
328
|
const optionsList = (await Promise.all(
|
|
304
329
|
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
@@ -324,7 +349,7 @@ var tsupOptions = (options = []) => {
|
|
|
324
349
|
".jpg": "copy",
|
|
325
350
|
".json": "json",
|
|
326
351
|
".png": "copy",
|
|
327
|
-
".svg": "
|
|
352
|
+
".svg": "text",
|
|
328
353
|
".webp": "copy"
|
|
329
354
|
};
|
|
330
355
|
const standardOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import chalk from 'chalk'\nimport type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n srcDir: string,\n entries: string[],\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${srcDir}, ${options?.outDir}]`)\n }\n\n if (entries.length === 0) {\n console.warn(chalk.yellow(`No entries found in ${srcDir} to compile`))\n return 0\n }\n\n const tscOutDir = 'build'\n\n if (verbose) {\n console.log(chalk.gray(`tscOutDir [${tscOutDir}]`))\n }\n\n const validationResult = packageCompileTsc(options?.platform ?? 'neutral', entries, srcDir, tscOutDir, undefined, verbose)\n if (validationResult !== 0) {\n console.error(chalk.red(`Compile:Validation had ${validationResult} errors`))\n return validationResult\n }\n\n const optionsParams: Options = {\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n entry: entries.map(entry => `${srcDir}/${entry}`),\n }\n\n const optionsResult = defineConfig(optionsParams)\n\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(chalk.cyan(`TSUP:build:start [${srcDir}]`))\n console.log(chalk.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`))\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(chalk.cyan(`TSUP:build:stop [${srcDir}]`))\n }\n\n await packageCompileTscTypes(entries, outDir, options?.platform ?? 'neutral', tscOutDir, verbose)\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log('Compiling with TSUP')\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: optionsObject.outDir ?? 'dist/node' }]),\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 ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: optionsObject.outDir ?? 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n + (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: optionsObject.outDir ?? 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n + 0\n )\n}\n","import chalk from 'chalk'\nimport { glob } from 'glob'\n\nexport const getAllInputs = (srcDir: string, verbose = false) => {\n /* tsup wants posix paths */\n return glob.sync(`${srcDir}/**/*.*`, { posix: true }).map((file) => {\n const result = file.slice(Math.max(0, srcDir.length + 1)) // Remove the folder prefix\n if (verbose) {\n console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`))\n }\n return result\n })\n}\n","import type { Options } from 'tsup'\n\nimport { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (srcDir: string, entryMode: EntryMode = 'single', options?: Options | boolean, excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = ['index-node.ts', 'index-browser.ts']\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(srcDir).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(srcDir)\n break\n }\n case 'custom': {\n entries = []\n break\n }\n default: {\n entries = ['index.ts']\n break\n }\n }\n\n if (typeof options !== 'boolean' && Array.isArray(options?.entry)) {\n entries.push(...options.entry)\n }\n\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { rmSync } from 'node:fs'\nimport { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { getCompilerOptions } from './getCompilerOptions.ts'\n\nexport const packageCompileTsc = (\n platform: 'browser' | 'neutral' | 'node',\n entries: string[],\n srcDir: string = 'src',\n outDir: string = 'build',\n compilerOptionsParam?: CompilerOptions,\n verbose: boolean = false,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(chalk.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n outDir: `${outDir}/${platform}`,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n console.log(chalk.cyan(`Validating Files: ${entries.length}`))\n if (verbose) {\n for (const entry of entries) {\n console.log(chalk.grey(`Validating: ${entry}`))\n }\n }\n\n try {\n if (entries.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n files: entries.map(entry => `${srcDir}/${entry}`),\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => srcDir,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n } finally {\n if (verbose) {\n console.log(chalk.cyan(`Verifying code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n }\n}\n","import { cwd } from 'node:process'\n\nimport deepmerge from 'deepmerge'\nimport { getTsconfig } from 'get-tsconfig'\nimport type { CompilerOptions } from 'typescript'\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, fileName: string = 'tsconfig.json'): CompilerOptions => {\n const resolvedTsConfigCompilerOptions = getTsconfig(cwd(), fileName)?.config?.compilerOptions ?? {}\n\n return deepmerge(resolvedTsConfigCompilerOptions, options)\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { rollup } from 'rollup'\nimport type { Options } from 'rollup-plugin-dts'\nimport dts from 'rollup-plugin-dts'\nimport inlineSvg from 'rollup-plugin-inline-svg'\nimport nodeExternals from 'rollup-plugin-node-externals'\nimport type ts from 'typescript'\n\nexport async function bundleDts(inputPath: string, outputPath: string, platform: 'node' | 'browser' | 'neutral', options?: Options, verbose = false) {\n const nodePlugIns = platform === 'node' ? [nodeExternals()] : []\n const bundle = await rollup({\n input: inputPath,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plugins: [dts(options), (inlineSvg as any)(), ...nodePlugIns],\n onwarn(warning, warn) {\n // Ignore certain warnings if needed\n if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return\n warn(warning)\n },\n })\n\n await bundle.write({\n file: outputPath,\n format: 'es',\n })\n if (verbose) {\n console.log(`Bundled declarations written to ${outputPath}`)\n }\n}\n\nexport const packageCompileTscTypes = async (\n entries: string[],\n outDir: string,\n platform: 'node' | 'browser' | 'neutral',\n srcDir: string = 'build',\n verbose = false,\n): Promise<number> => {\n if (verbose) {\n console.log(chalk.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`))\n console.log(`Entries: ${entries.join(', ')}`)\n }\n const pkg = process.env.INIT_CWD ?? cwd()\n const srcRoot = `${pkg}/${srcDir}/${platform}`\n\n const entryNameToTypeName = (entry: string): string => {\n const splitEntryName = entry.split('.')\n const newEntryExtension = 'd.' + splitEntryName.at(-1)\n return [...splitEntryName.slice(0, -1), newEntryExtension].join('.')\n }\n\n const compilerOptions = {\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n emitDeclarationOnly: false,\n noEmit: true,\n } as ts.CompilerOptions\n\n const entryNames = entries.map(entry => entry.split(`${srcDir}/`).at(-1) ?? entry)\n\n await Promise.all(entryNames.map(async (entryName) => {\n const entryTypeName = entryNameToTypeName(entryName)\n console.log(`Compiling Types: ${srcRoot}/${entryTypeName} to ${outDir}/${entryTypeName}`)\n await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions, tsconfig: 'tsconfig.json' }, verbose)\n }))\n\n if (verbose) {\n console.log(chalk.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n\n return 0\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,OAAO,eAAe;AAEtB,IAAI;AAEG,IAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,WAAW,QAAW;AACxB,UAAM,qBAAqB,MAAM,YAAY,MAAM,EAAE,OAAO,MAAM,SAAS,EAAE,OAAO,iBAAiB,EAAE,EAAE,CAAC,EAAE,OAAO;AACnH,aAAS,oBAAoB;AAC7B,UAAM,iBAAiB,oBAAoB;AAC3C,QAAI,mBAAmB,QAAW;AAChC,cAAQ,IA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AM,QAAQ,aAAa,QAAQ,SAAS,WAAW,SAAS,MAAM,OAAO;AAC7E,aAAO,OAAO,WAAW,WACrB,MAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA,YAAY;AAAA,UAAC;AAAA,UACX,SAAS,MAAM,WAAW,CAAC;AAAA,UAC1B,OAAO,YAAY,WAAW,UAAU,CAAC;AAAA,UAC1C,EAAE,UAAU,WAAW,QAAQ,cAAc,UAAU,eAAe;AAAA,QAAC,CAAC;AAAA,QAC1E;AAAA,MACF,IACA;AAAA,IACN,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,IACvC;AAEN;;;AHvKO,IAAM,iBAAiB,OAAO,WAAqB,CAAC,MAAuB;AAChF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAIC,OAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAMC,UAAS,MAAM,WAAW,QAAQ;AACxC,QAAM,UAAUA,QAAO;AAEvB,QAAM,cAAc,MAAM,mBAAmBA,OAAM;AAEnD,MAAI,cAAc,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,SAAQ,UAAU,MAAM,eAAeA,OAAM,IAAI;AACnD;","names":["chalk","chalk","chalk","chalk","cwd","chalk","deepmerge","cwd","chalk","cwd","chalk","chalk","options","config","chalk","config"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts","../../../../src/lib/loadConfig.ts","../../../../src/actions/package/publint.ts","../../../../src/actions/package/compile/packageCompileTsup.ts","../../../../src/actions/package/compile/inputs.ts","../../../../src/actions/package/compile/buildEntries.ts","../../../../src/actions/package/compile/deepMerge.ts","../../../../src/actions/package/compile/packageCompileTsc.ts","../../../../src/actions/package/compile/getCompilerOptions.ts","../../../../src/actions/package/compile/packageCompileTscTypes.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(inConfig)\n const publint = config.publint\n\n const tsupResults = await packageCompileTsup(config)\n\n if (tsupResults > 0) {\n return tsupResults\n }\n\n return (publint ? await packagePublint(config) : 0)\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport type { Message } from 'publint'\nimport sortPackageJson from 'sort-package-json'\n\nexport interface PackagePublintParams { verbose?: boolean }\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const sortedPkg = sortPackageJson(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n await fs.writeFile(`${pkgDir}/package.json`, sortedPkg)\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n console.log(chalk.green(`Publint: ${pkg.name}`))\n console.log(chalk.gray(pkgDir))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import-x/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n const validMessage = (_message: Message): boolean => {\n return true\n /* try {\n const value = getValueFromPath(pkg, message.path)\n switch (message.code) {\n case 'FILE_INVALID_FORMAT':\n return !message.args?.actualFilePath?.includes('dist/browser') && !value?.includes('dist/browser')\n case 'EXPORT_TYPES_INVALID_FORMAT':\n return !`${value}`.includes('dist/browser')\n default:\n return true\n }\n } catch (ex) {\n const error = ex as Error\n console.error(chalk.red(`validMessage Excepted: ${error.message}`))\n console.error(chalk.gray(JSON.stringify(error.stack)))\n return true\n } */\n }\n\n // we filter out invalid file formats for the esm folder since it is intentionally done\n const validMessages = messages.filter(validMessage)\n for (const message of validMessages) {\n switch (message.type) {\n case 'error': {\n console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n case 'warning': {\n console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n default: {\n console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))\n break\n }\n }\n }\n\n if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))\n }\n\n return validMessages.filter(message => message.type === 'error').length\n}\n","import chalk from 'chalk'\nimport type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n srcDir: string,\n entries: string[],\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${srcDir}, ${options?.outDir}]`)\n }\n\n if (entries.length === 0) {\n console.warn(chalk.yellow(`No entries found in ${srcDir} to compile`))\n return 0\n }\n\n const tscOutDir = 'dist'\n\n if (verbose) {\n console.log(chalk.gray(`tscOutDir [${tscOutDir}]`))\n }\n\n const validationResult = packageCompileTsc(options?.platform ?? 'neutral', entries, srcDir, tscOutDir, undefined, verbose)\n if (validationResult !== 0) {\n console.error(chalk.red(`Compile:Validation had ${validationResult} errors`))\n return validationResult\n }\n\n const optionsParams: Options = tsupOptions([{\n bundle: true,\n cjsInterop: true,\n clean: false,\n dts: false,\n format: ['esm'],\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n entry: entries.map(entry => `${srcDir}/${entry}`),\n }])\n\n const optionsResult = defineConfig(optionsParams)\n\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n }),\n )\n ).flat()\n\n if (verbose) {\n console.log(chalk.cyan(`TSUP:build:start [${srcDir}]`))\n console.log(chalk.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`))\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(chalk.cyan(`TSUP:build:stop [${srcDir}]`))\n }\n\n await packageCompileTscTypes(entries, outDir, options?.platform ?? 'neutral', tscOutDir, verbose)\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'text', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log('Compiling with TSUP')\n }\n\n const compileForNode = compile?.node ?? { src: {} }\n const compileForBrowser = compile?.browser ?? { src: {} }\n const compileForNeutral = compile?.neutral ?? { src: {} }\n\n return (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: optionsObject.outDir ?? 'dist/node' }]),\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 ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: optionsObject.outDir ?? 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n + (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([srcDir, options]) => {\n const optionsObject: Options = typeof options === 'object' ? options : {}\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n const entry = buildEntries(srcDir, compile?.entryMode, options, true, verbose)\n return typeof srcDir === 'string'\n ? await compileFolder(\n srcDir,\n entry,\n tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: optionsObject.outDir ?? 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n + 0\n )\n}\n","import chalk from 'chalk'\nimport { glob } from 'glob'\n\nexport const getAllInputs = (srcDir: string, verbose = false) => {\n /* tsup wants posix paths */\n return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {\n const result = file.slice(Math.max(0, srcDir.length + 1)) // Remove the folder prefix\n if (verbose) {\n console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`))\n }\n return result\n }), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {\n const result = file.slice(Math.max(0, srcDir.length + 1)) // Remove the folder prefix\n if (verbose) {\n console.log(chalk.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`))\n }\n return result\n })]\n}\n","import type { Options } from 'tsup'\n\nimport { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (srcDir: string, entryMode: EntryMode = 'single', options?: Options | boolean, excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = ['index-node.ts', 'index-browser.ts']\n break\n }\n case 'all': {\n entries = (excludeSpecAndStories\n ? getAllInputs(srcDir).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.'))\n : getAllInputs(srcDir)).filter(entry => !entry.endsWith('.d.ts'))\n break\n }\n case 'custom': {\n entries = []\n break\n }\n default: {\n entries = ['index.ts']\n break\n }\n }\n\n if (typeof options !== 'boolean' && Array.isArray(options?.entry)) {\n entries.push(...options.entry)\n }\n\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import path from 'node:path'\nimport { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport ts, {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { getCompilerOptions } from './getCompilerOptions.ts'\n\nexport const packageCompileTsc = (\n platform: 'browser' | 'neutral' | 'node',\n entries: string[],\n srcDir: string = 'src',\n outDir: string = 'dist',\n compilerOptionsParam?: CompilerOptions,\n verbose: boolean = false,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(chalk.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n\n const configFilePath = ts.findConfigFile(\n './', // search path\n ts.sys.fileExists,\n 'tsconfig.json',\n )\n\n if (configFilePath === undefined) {\n throw new Error('Could not find tsconfig.json')\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n outDir: `${outDir}/${platform}`,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n console.log(chalk.cyan(`Validating Files: ${entries.length}`))\n if (verbose) {\n for (const entry of entries) {\n console.log(chalk.grey(`Validating: ${entry}`))\n }\n }\n\n try {\n if (entries.length > 0) {\n const program = createProgramFromConfig({\n configFilePath,\n basePath: pkg ?? cwd(),\n compilerOptions,\n files: entries.map(entry => `${srcDir}/${entry}`),\n include: [`${srcDir}/**/*.*`],\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => srcDir,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n } finally {\n if (verbose) {\n console.log(chalk.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n }\n}\n","import { cwd } from 'node:process'\n\nimport deepmerge from 'deepmerge'\nimport { getTsconfig } from 'get-tsconfig'\nimport type { CompilerOptions } from 'typescript'\n\nexport const getCompilerOptions = (options: CompilerOptions = {}, fileName: string = 'tsconfig.json'): CompilerOptions => {\n const resolvedTsConfigCompilerOptions = getTsconfig(cwd(), fileName)?.config?.compilerOptions ?? {}\n\n return deepmerge(resolvedTsConfigCompilerOptions, options)\n}\n","import path from 'node:path'\nimport { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { rollup } from 'rollup'\nimport type { Options } from 'rollup-plugin-dts'\nimport dts from 'rollup-plugin-dts'\nimport nodeExternals from 'rollup-plugin-node-externals'\n\nimport { getCompilerOptions } from './getCompilerOptions.ts'\n\nexport async function bundleDts(inputPath: string, outputPath: string, platform: 'node' | 'browser' | 'neutral', options?: Options, verbose = false) {\n // Find the tsconfig.json path\n const pkg = process.env.INIT_CWD ?? cwd()\n const tsconfigPath = path.resolve(pkg, 'tsconfig.json')\n\n const nodePlugIns = platform === 'node' ? [nodeExternals()] : []\n try {\n const bundle = await rollup({\n input: inputPath,\n\n plugins: [dts({\n ...options, tsconfig: tsconfigPath, compilerOptions: { emitDeclarationOnly: true, noEmit: false },\n\n }), ...nodePlugIns],\n onwarn(warning, warn) {\n // Ignore certain warnings if needed\n if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return\n warn(warning)\n },\n })\n await bundle.write({\n file: outputPath,\n format: 'es',\n })\n } catch (ex) {\n console.error(ex)\n }\n\n if (verbose) {\n console.log(`Bundled declarations written to ${outputPath}`)\n }\n}\n\nexport const packageCompileTscTypes = async (\n entries: string[],\n outDir: string,\n platform: 'node' | 'browser' | 'neutral',\n srcDir: string = 'build',\n verbose = false,\n): Promise<number> => {\n if (verbose) {\n console.log(chalk.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`))\n console.log(`Entries: ${entries.join(', ')}`)\n }\n const pkg = process.env.INIT_CWD ?? cwd()\n const srcRoot = `${pkg}/${srcDir}/${platform}`\n\n const entryNameToTypeName = (entry: string): string => {\n const splitEntryName = entry.split('.')\n const newEntryExtension = 'd.' + splitEntryName.at(-1)\n return [...splitEntryName.slice(0, -1), newEntryExtension].join('.')\n }\n\n const compilerOptions = getCompilerOptions({\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n emitDeclarationOnly: false,\n noEmit: true,\n })\n\n const entryNames = entries.map(entry => entry.split(`${srcDir}/`).at(-1) ?? entry)\n\n await Promise.all(entryNames.map(async (entryName) => {\n const entryTypeName = entryNameToTypeName(entryName)\n await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose)\n }))\n\n if (verbose) {\n console.log(chalk.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`))\n }\n\n return 0\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,OAAO,eAAe;AAEtB,IAAI;AAEG,IAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,WAAW,QAAW;AACxB,UAAM,qBAAqB,MAAM,YAAY,MAAM,EAAE,OAAO,MAAM,SAAS,EAAE,OAAO,iBAAiB,E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AAAA,IACN,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAM,UAAU,OAAO,OAAO,CAAC,IACvC;AAEN;;;AHvKO,IAAM,iBAAiB,OAAO,WAAqB,CAAC,MAAuB;AAChF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAIC,OAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAMC,UAAS,MAAM,WAAW,QAAQ;AACxC,QAAM,UAAUA,QAAO;AAEvB,QAAM,cAAc,MAAM,mBAAmBA,OAAM;AAEnD,MAAI,cAAc,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,SAAQ,UAAU,MAAM,eAAeA,OAAM,IAAI;AACnD;","names":["chalk","chalk","chalk","chalk","cwd","chalk","deepmerge","cwd","chalk","cwd","chalk","cwd","chalk","chalk","options","config","chalk","config"]}
|
|
@@ -74,13 +74,19 @@ import { build, defineConfig } from "tsup";
|
|
|
74
74
|
import chalk3 from "chalk";
|
|
75
75
|
import { glob } from "glob";
|
|
76
76
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
77
|
-
return glob.sync(`${srcDir}
|
|
77
|
+
return [...glob.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
78
78
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
79
79
|
if (verbose) {
|
|
80
80
|
console.log(chalk3.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
81
81
|
}
|
|
82
82
|
return result;
|
|
83
|
-
})
|
|
83
|
+
}), ...glob.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
84
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
85
|
+
if (verbose) {
|
|
86
|
+
console.log(chalk3.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
})];
|
|
84
90
|
};
|
|
85
91
|
|
|
86
92
|
// src/actions/package/compile/buildEntries.ts
|
|
@@ -92,7 +98,7 @@ var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories
|
|
|
92
98
|
break;
|
|
93
99
|
}
|
|
94
100
|
case "all": {
|
|
95
|
-
entries = excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir);
|
|
101
|
+
entries = (excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir)).filter((entry) => !entry.endsWith(".d.ts"));
|
|
96
102
|
break;
|
|
97
103
|
}
|
|
98
104
|
case "custom": {
|
|
@@ -138,7 +144,7 @@ function deepMergeObjects(objects) {
|
|
|
138
144
|
import { cwd as cwd2 } from "process";
|
|
139
145
|
import chalk4 from "chalk";
|
|
140
146
|
import { createProgramFromConfig } from "tsc-prog";
|
|
141
|
-
import {
|
|
147
|
+
import ts, {
|
|
142
148
|
DiagnosticCategory,
|
|
143
149
|
formatDiagnosticsWithColorAndContext,
|
|
144
150
|
getPreEmitDiagnostics,
|
|
@@ -155,11 +161,20 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
155
161
|
};
|
|
156
162
|
|
|
157
163
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
158
|
-
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "
|
|
164
|
+
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
159
165
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
160
166
|
if (verbose) {
|
|
161
167
|
console.log(chalk4.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
162
168
|
}
|
|
169
|
+
const configFilePath = ts.findConfigFile(
|
|
170
|
+
"./",
|
|
171
|
+
// search path
|
|
172
|
+
ts.sys.fileExists,
|
|
173
|
+
"tsconfig.json"
|
|
174
|
+
);
|
|
175
|
+
if (configFilePath === void 0) {
|
|
176
|
+
throw new Error("Could not find tsconfig.json");
|
|
177
|
+
}
|
|
163
178
|
const compilerOptions = {
|
|
164
179
|
...getCompilerOptions({
|
|
165
180
|
removeComments: false,
|
|
@@ -181,9 +196,11 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "build", co
|
|
|
181
196
|
try {
|
|
182
197
|
if (entries.length > 0) {
|
|
183
198
|
const program = createProgramFromConfig({
|
|
199
|
+
configFilePath,
|
|
184
200
|
basePath: pkg ?? cwd2(),
|
|
185
201
|
compilerOptions,
|
|
186
|
-
files: entries.map((entry) => `${srcDir}/${entry}`)
|
|
202
|
+
files: entries.map((entry) => `${srcDir}/${entry}`),
|
|
203
|
+
include: [`${srcDir}/**/*.*`]
|
|
187
204
|
});
|
|
188
205
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
189
206
|
if (diagnostics.length > 0) {
|
|
@@ -203,33 +220,42 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "build", co
|
|
|
203
220
|
return 0;
|
|
204
221
|
} finally {
|
|
205
222
|
if (verbose) {
|
|
206
|
-
console.log(chalk4.cyan(`
|
|
223
|
+
console.log(chalk4.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
207
224
|
}
|
|
208
225
|
}
|
|
209
226
|
};
|
|
210
227
|
|
|
211
228
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
229
|
+
import path from "path";
|
|
212
230
|
import { cwd as cwd3 } from "process";
|
|
213
231
|
import chalk5 from "chalk";
|
|
214
232
|
import { rollup } from "rollup";
|
|
215
233
|
import dts from "rollup-plugin-dts";
|
|
216
|
-
import inlineSvg from "rollup-plugin-inline-svg";
|
|
217
234
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
218
235
|
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
236
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
237
|
+
const tsconfigPath = path.resolve(pkg, "tsconfig.json");
|
|
219
238
|
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
239
|
+
try {
|
|
240
|
+
const bundle = await rollup({
|
|
241
|
+
input: inputPath,
|
|
242
|
+
plugins: [dts({
|
|
243
|
+
...options,
|
|
244
|
+
tsconfig: tsconfigPath,
|
|
245
|
+
compilerOptions: { emitDeclarationOnly: true, noEmit: false }
|
|
246
|
+
}), ...nodePlugIns],
|
|
247
|
+
onwarn(warning, warn) {
|
|
248
|
+
if (warning.code === "UNUSED_EXTERNAL_IMPORT") return;
|
|
249
|
+
warn(warning);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
await bundle.write({
|
|
253
|
+
file: outputPath,
|
|
254
|
+
format: "es"
|
|
255
|
+
});
|
|
256
|
+
} catch (ex) {
|
|
257
|
+
console.error(ex);
|
|
258
|
+
}
|
|
233
259
|
if (verbose) {
|
|
234
260
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
235
261
|
}
|
|
@@ -246,19 +272,18 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
246
272
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
247
273
|
return [...splitEntryName.slice(0, -1), newEntryExtension].join(".");
|
|
248
274
|
};
|
|
249
|
-
const compilerOptions = {
|
|
275
|
+
const compilerOptions = getCompilerOptions({
|
|
250
276
|
removeComments: false,
|
|
251
277
|
skipDefaultLibCheck: true,
|
|
252
278
|
skipLibCheck: true,
|
|
253
279
|
sourceMap: false,
|
|
254
280
|
emitDeclarationOnly: false,
|
|
255
281
|
noEmit: true
|
|
256
|
-
};
|
|
282
|
+
});
|
|
257
283
|
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
258
284
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
259
285
|
const entryTypeName = entryNameToTypeName(entryName);
|
|
260
|
-
|
|
261
|
-
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions, tsconfig: "tsconfig.json" }, verbose);
|
|
286
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
262
287
|
}));
|
|
263
288
|
if (verbose) {
|
|
264
289
|
console.log(chalk5.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
@@ -276,7 +301,7 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
276
301
|
console.warn(chalk6.yellow(`No entries found in ${srcDir} to compile`));
|
|
277
302
|
return 0;
|
|
278
303
|
}
|
|
279
|
-
const tscOutDir = "
|
|
304
|
+
const tscOutDir = "dist";
|
|
280
305
|
if (verbose) {
|
|
281
306
|
console.log(chalk6.gray(`tscOutDir [${tscOutDir}]`));
|
|
282
307
|
}
|
|
@@ -285,10 +310,10 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
285
310
|
console.error(chalk6.red(`Compile:Validation had ${validationResult} errors`));
|
|
286
311
|
return validationResult;
|
|
287
312
|
}
|
|
288
|
-
const optionsParams = {
|
|
313
|
+
const optionsParams = tsupOptions([{
|
|
289
314
|
bundle: true,
|
|
290
315
|
cjsInterop: true,
|
|
291
|
-
clean:
|
|
316
|
+
clean: false,
|
|
292
317
|
dts: false,
|
|
293
318
|
format: ["esm"],
|
|
294
319
|
outDir,
|
|
@@ -298,7 +323,7 @@ var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
|
298
323
|
tsconfig: "tsconfig.json",
|
|
299
324
|
...options,
|
|
300
325
|
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
301
|
-
};
|
|
326
|
+
}]);
|
|
302
327
|
const optionsResult = defineConfig(optionsParams);
|
|
303
328
|
const optionsList = (await Promise.all(
|
|
304
329
|
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
@@ -324,7 +349,7 @@ var tsupOptions = (options = []) => {
|
|
|
324
349
|
".jpg": "copy",
|
|
325
350
|
".json": "json",
|
|
326
351
|
".png": "copy",
|
|
327
|
-
".svg": "
|
|
352
|
+
".svg": "text",
|
|
328
353
|
".webp": "copy"
|
|
329
354
|
};
|
|
330
355
|
const standardOptions = {
|