@xylabs/ts-scripts-yarn3 4.0.0-rc.4 → 4.0.0-rc.6
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 +26 -97
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +5 -76
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +5 -76
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +3 -157
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +19 -90
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +5 -76
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +7 -78
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +5 -159
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +7 -78
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +7 -78
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +36 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/packageCompileTsup.ts +4 -10
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
5
|
// src/bin/package/compile.ts
|
|
6
|
-
import
|
|
6
|
+
import chalk5 from "chalk";
|
|
7
7
|
|
|
8
8
|
// src/lib/loadConfig.ts
|
|
9
9
|
import chalk from "chalk";
|
|
@@ -26,7 +26,7 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
|
26
26
|
}, "loadConfig");
|
|
27
27
|
|
|
28
28
|
// src/actions/package/compile/compile.ts
|
|
29
|
-
import
|
|
29
|
+
import chalk4 from "chalk";
|
|
30
30
|
|
|
31
31
|
// src/actions/package/publint.ts
|
|
32
32
|
import { promises as fs } from "node:fs";
|
|
@@ -191,86 +191,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
191
191
|
}
|
|
192
192
|
}, "buildEntries");
|
|
193
193
|
|
|
194
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
195
|
-
import { cwd as cwd2 } from "node:process";
|
|
196
|
-
import chalk4 from "chalk";
|
|
197
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
198
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
199
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
200
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
201
|
-
if (verbose) {
|
|
202
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
203
|
-
}
|
|
204
|
-
const compilerOptions = {
|
|
205
|
-
...getCompilerOptions({
|
|
206
|
-
declaration: true,
|
|
207
|
-
emitDeclarationOnly: true,
|
|
208
|
-
outDir: "dist",
|
|
209
|
-
removeComments: true,
|
|
210
|
-
skipDefaultLibCheck: true,
|
|
211
|
-
skipLibCheck: true,
|
|
212
|
-
sourceMap: true
|
|
213
|
-
}),
|
|
214
|
-
...compilerOptionsParam
|
|
215
|
-
};
|
|
216
|
-
const files = buildEntries(folder, "all");
|
|
217
|
-
const result = createProgramFromConfig2({
|
|
218
|
-
basePath: pkg ?? cwd2(),
|
|
219
|
-
compilerOptions,
|
|
220
|
-
exclude: [
|
|
221
|
-
"dist",
|
|
222
|
-
"docs",
|
|
223
|
-
"**/*.spec.*",
|
|
224
|
-
"**/*.stories.*",
|
|
225
|
-
"src/**/spec/**/*"
|
|
226
|
-
],
|
|
227
|
-
files
|
|
228
|
-
}).emit();
|
|
229
|
-
const diagResults = result.diagnostics.length;
|
|
230
|
-
for (const diag of result.diagnostics) {
|
|
231
|
-
switch (diag.category) {
|
|
232
|
-
case DiagnosticCategory2.Error: {
|
|
233
|
-
console.error(chalk4.red(diag.messageText));
|
|
234
|
-
console.error(chalk4.grey(pkg));
|
|
235
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
case DiagnosticCategory2.Warning: {
|
|
239
|
-
console.error(chalk4.yellow(diag.messageText));
|
|
240
|
-
console.error(chalk4.grey(pkg));
|
|
241
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
case DiagnosticCategory2.Suggestion: {
|
|
245
|
-
console.error(chalk4.white(diag.messageText));
|
|
246
|
-
console.error(chalk4.grey(pkg));
|
|
247
|
-
console.error(chalk4.blue(diag.file?.fileName));
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return diagResults;
|
|
253
|
-
}, "packageCompileTscTypes");
|
|
254
|
-
|
|
255
194
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
256
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
195
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
257
196
|
const outDir = options?.outDir ?? "dist";
|
|
258
197
|
const entry = buildEntries(folder, entryMode);
|
|
259
198
|
const optionsResult = defineConfig({
|
|
260
199
|
bundle: true,
|
|
261
200
|
cjsInterop: true,
|
|
262
201
|
clean: true,
|
|
263
|
-
dts:
|
|
202
|
+
dts: true,
|
|
264
203
|
entry,
|
|
265
204
|
format: [
|
|
266
205
|
"esm"
|
|
267
206
|
],
|
|
268
|
-
// minify: true,
|
|
269
207
|
outDir,
|
|
270
208
|
silent: true,
|
|
271
209
|
sourcemap: true,
|
|
272
210
|
splitting: false,
|
|
273
|
-
// terserOptions: { format: { comments: false } },
|
|
274
211
|
tsconfig: "tsconfig.json",
|
|
275
212
|
...options
|
|
276
213
|
});
|
|
@@ -285,11 +222,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
285
222
|
];
|
|
286
223
|
}))).flat();
|
|
287
224
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
288
|
-
packageCompileTscTypes(folder, {
|
|
289
|
-
verbose
|
|
290
|
-
}, {
|
|
291
|
-
outDir
|
|
292
|
-
});
|
|
293
225
|
return 0;
|
|
294
226
|
}, "compileFolder");
|
|
295
227
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
@@ -332,10 +264,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
332
264
|
sourcemap: true,
|
|
333
265
|
target: "esnext"
|
|
334
266
|
};
|
|
335
|
-
return await
|
|
336
|
-
publint: false,
|
|
337
|
-
verbose
|
|
338
|
-
}) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
267
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
339
268
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
340
269
|
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
341
270
|
...standardOptions,
|
|
@@ -380,7 +309,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
380
309
|
// src/actions/package/compile/compile.ts
|
|
381
310
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
382
311
|
const pkg = process.env.INIT_CWD;
|
|
383
|
-
console.log(
|
|
312
|
+
console.log(chalk4.green(`Compiling ${pkg}`));
|
|
384
313
|
const config2 = await loadConfig(inConfig);
|
|
385
314
|
const publint = config2.publint;
|
|
386
315
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -406,7 +335,7 @@ packageCompile({
|
|
|
406
335
|
process.exit(value);
|
|
407
336
|
}
|
|
408
337
|
}).catch((reason) => {
|
|
409
|
-
console.error(
|
|
338
|
+
console.error(chalk5.red(reason));
|
|
410
339
|
process.exit(-1);
|
|
411
340
|
});
|
|
412
341
|
//# sourceMappingURL=compile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/package/compile.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/compile/compile.ts","../../../src/actions/package/publint.ts","../../../src/actions/package/compile/packageCompileTsc.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/packageCompileTsup.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts","../../../src/actions/package/compile/packageCompileTscTypes.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompile } from '../../actions/index.ts'\n\npackageCompile({ verbose: false })\n .then((value) => {\n if (value) {\n process.exit(value)\n }\n })\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n })\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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 mode = config.compile?.mode ?? 'tsup'\n let result: number = 0\n switch (mode) {\n case 'tsc': {\n result += await packageCompileTsc(undefined, config as XyTscConfig)\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(config as XyTsupConfig)\n break\n }\n }\n return result + (publint ? await packagePublint(config) : 0)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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/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 { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 0)\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n // minify: true,\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n // terserOptions: { format: { comments: false } },\n tsconfig: 'tsconfig.json',\n ...options,\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 await Promise.all(optionsList.map(options => build(options)))\n packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\n// eslint-disable-next-line complexity\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\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 const compileForNeutral = compile?.neutral ?? { src: {} }\n\n const standardLoaders: Record<string, Loader> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (\n (await packageCompileTsc(true, { publint: false, verbose }))\n || (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\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 const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\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(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\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 || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,MAAM,CAAC,GAAGH,QAAQE,MAAAA;AAC3B,GAZ0B;;;ACP1B,OAAOY,YAAW;;;ACAlB,SAASC,YAAYC,UAAU;AAE/B,OAAOC,YAAW;AAOX,IAAMC,iBAAiB,8BAAOC,WAAAA;AACnC,QAAMC,SAASC,QAAQC,IAAIC;AAC3B,QAAMC,MAAMC,KAAKC,MAAM,MAAMC,GAAGC,SAAS,GAAGR,MAAAA,iBAAuB,MAAA,CAAA;AAEnES,UAAQC,IAAIC,OAAMC,MAAM,YAAYR,IAAIS,IAAI,EAAE,CAAA;AAC9CJ,UAAQC,IAAIC,OAAMG,KAAKd,MAAAA,CAAAA;AAEvB,QAAM,EAAEe,QAAO,IAAK,MAAM,OAAO,SAAA;AAEjC,QAAM,EAAEC,SAAQ,IAAK,MAAMD,QAAQ;IACjC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AA;IACN,KAAK,OAAO;AACVE,gBAAU,MAAMC,kBAAkBC,QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;;;AFF9BU,eAAe;EAAEC,SAAS;AAAM,CAAA,EAC7BC,KAAK,CAACC,UAAAA;AACL,MAAIA,OAAO;AACTC,YAAQC,KAAKF,KAAAA;EACf;AACF,CAAA,EACCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,KAAK,EAAC;AAChB,CAAA;","names":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","chalk","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint","build","defineConfig","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","cwd","chalk","createProgramFromConfig","DiagnosticCategory","packageCompileTscTypes","folder","verbose","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","compileFolder","folder","entryMode","options","verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTscTypes","packageCompileTsup","config","compile","publint","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","packageCompileTsc","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint","packageCompile","verbose","then","value","process","exit","catch","reason","console","error","chalk","red"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/package/compile.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/compile/compile.ts","../../../src/actions/package/publint.ts","../../../src/actions/package/compile/packageCompileTsc.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/packageCompileTsup.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompile } from '../../actions/index.ts'\n\npackageCompile({ verbose: false })\n .then((value) => {\n if (value) {\n process.exit(value)\n }\n })\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n })\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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 mode = config.compile?.mode ?? 'tsup'\n let result: number = 0\n switch (mode) {\n case 'tsc': {\n result += await packageCompileTsc(undefined, config as XyTscConfig)\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(config as XyTsupConfig)\n break\n }\n }\n return result + (publint ? await packagePublint(config) : 0)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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/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 { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 0)\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: true,\n entry,\n format: ['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]).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 await Promise.all(optionsList.map(options => build(options)))\n // packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\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 const compileForNeutral = compile?.neutral ?? { src: {} }\n\n const standardLoaders: Record<string, Loader> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\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 const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\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(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\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 || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO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AAmB;AAE3C,GArGkC;;;AJ/B3B,IAAMC,iBAAiB,8BAAOC,WAAqB,CAAC,MAAC;AAC1D,QAAMC,MAAMC,QAAQC,IAAIC;AACxBC,UAAQC,IAAIC,OAAMC,MAAM,aAAaP,GAAAA,EAAK,CAAA;AAC1C,QAAMQ,UAAS,MAAMC,WAAWV,QAAAA;AAChC,QAAMW,UAAUF,QAAOE;AAEvB,QAAMC,OAAOH,QAAOI,SAASD,QAAQ;AACrC,MAAIE,SAAiB;AACrB,UAAQF,MAAAA;IACN,KAAK,OAAO;AACVE,gBAAU,MAAMC,kBAAkBC,QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;;;AFF9BU,eAAe;EAAEC,SAAS;AAAM,CAAA,EAC7BC,KAAK,CAACC,UAAAA;AACL,MAAIA,OAAO;AACTC,YAAQC,KAAKF,KAAAA;EACf;AACF,CAAA,EACCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,KAAK,EAAC;AAChB,CAAA;","names":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","chalk","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint","build","defineConfig","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","compileFolder","folder","entryMode","options","_verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTsup","config","compile","publint","verbose","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint","packageCompile","verbose","then","value","process","exit","catch","reason","console","error","chalk","red"]}
|
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
5
|
// src/bin/package/recompile.ts
|
|
6
|
-
import
|
|
6
|
+
import chalk7 from "chalk";
|
|
7
7
|
|
|
8
8
|
// src/lib/loadConfig.ts
|
|
9
9
|
import chalk from "chalk";
|
|
@@ -68,7 +68,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
68
68
|
}, "packageClean");
|
|
69
69
|
|
|
70
70
|
// src/actions/package/compile/compile.ts
|
|
71
|
-
import
|
|
71
|
+
import chalk6 from "chalk";
|
|
72
72
|
|
|
73
73
|
// src/actions/package/publint.ts
|
|
74
74
|
import { promises as fs } from "node:fs";
|
|
@@ -233,86 +233,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
233
233
|
}
|
|
234
234
|
}, "buildEntries");
|
|
235
235
|
|
|
236
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
237
|
-
import { cwd as cwd2 } from "node:process";
|
|
238
|
-
import chalk6 from "chalk";
|
|
239
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
240
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
241
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
242
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
243
|
-
if (verbose) {
|
|
244
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
245
|
-
}
|
|
246
|
-
const compilerOptions = {
|
|
247
|
-
...getCompilerOptions({
|
|
248
|
-
declaration: true,
|
|
249
|
-
emitDeclarationOnly: true,
|
|
250
|
-
outDir: "dist",
|
|
251
|
-
removeComments: true,
|
|
252
|
-
skipDefaultLibCheck: true,
|
|
253
|
-
skipLibCheck: true,
|
|
254
|
-
sourceMap: true
|
|
255
|
-
}),
|
|
256
|
-
...compilerOptionsParam
|
|
257
|
-
};
|
|
258
|
-
const files = buildEntries(folder, "all");
|
|
259
|
-
const result = createProgramFromConfig2({
|
|
260
|
-
basePath: pkg ?? cwd2(),
|
|
261
|
-
compilerOptions,
|
|
262
|
-
exclude: [
|
|
263
|
-
"dist",
|
|
264
|
-
"docs",
|
|
265
|
-
"**/*.spec.*",
|
|
266
|
-
"**/*.stories.*",
|
|
267
|
-
"src/**/spec/**/*"
|
|
268
|
-
],
|
|
269
|
-
files
|
|
270
|
-
}).emit();
|
|
271
|
-
const diagResults = result.diagnostics.length;
|
|
272
|
-
for (const diag of result.diagnostics) {
|
|
273
|
-
switch (diag.category) {
|
|
274
|
-
case DiagnosticCategory2.Error: {
|
|
275
|
-
console.error(chalk6.red(diag.messageText));
|
|
276
|
-
console.error(chalk6.grey(pkg));
|
|
277
|
-
console.error(chalk6.blue(diag.file?.fileName));
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
case DiagnosticCategory2.Warning: {
|
|
281
|
-
console.error(chalk6.yellow(diag.messageText));
|
|
282
|
-
console.error(chalk6.grey(pkg));
|
|
283
|
-
console.error(chalk6.blue(diag.file?.fileName));
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
case DiagnosticCategory2.Suggestion: {
|
|
287
|
-
console.error(chalk6.white(diag.messageText));
|
|
288
|
-
console.error(chalk6.grey(pkg));
|
|
289
|
-
console.error(chalk6.blue(diag.file?.fileName));
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return diagResults;
|
|
295
|
-
}, "packageCompileTscTypes");
|
|
296
|
-
|
|
297
236
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
298
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
237
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
299
238
|
const outDir = options?.outDir ?? "dist";
|
|
300
239
|
const entry = buildEntries(folder, entryMode);
|
|
301
240
|
const optionsResult = defineConfig({
|
|
302
241
|
bundle: true,
|
|
303
242
|
cjsInterop: true,
|
|
304
243
|
clean: true,
|
|
305
|
-
dts:
|
|
244
|
+
dts: true,
|
|
306
245
|
entry,
|
|
307
246
|
format: [
|
|
308
247
|
"esm"
|
|
309
248
|
],
|
|
310
|
-
// minify: true,
|
|
311
249
|
outDir,
|
|
312
250
|
silent: true,
|
|
313
251
|
sourcemap: true,
|
|
314
252
|
splitting: false,
|
|
315
|
-
// terserOptions: { format: { comments: false } },
|
|
316
253
|
tsconfig: "tsconfig.json",
|
|
317
254
|
...options
|
|
318
255
|
});
|
|
@@ -327,11 +264,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
327
264
|
];
|
|
328
265
|
}))).flat();
|
|
329
266
|
await Promise.all(optionsList.map((options2) => build(options2)));
|
|
330
|
-
packageCompileTscTypes(folder, {
|
|
331
|
-
verbose
|
|
332
|
-
}, {
|
|
333
|
-
outDir
|
|
334
|
-
});
|
|
335
267
|
return 0;
|
|
336
268
|
}, "compileFolder");
|
|
337
269
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
@@ -374,10 +306,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
374
306
|
sourcemap: true,
|
|
375
307
|
target: "esnext"
|
|
376
308
|
};
|
|
377
|
-
return await
|
|
378
|
-
publint: false,
|
|
379
|
-
verbose
|
|
380
|
-
}) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
309
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
381
310
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === "object" ? compile?.node?.esbuildOptions : {};
|
|
382
311
|
return folder ? await compileFolder(folder, compile?.entryMode, {
|
|
383
312
|
...standardOptions,
|
|
@@ -422,7 +351,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
422
351
|
// src/actions/package/compile/compile.ts
|
|
423
352
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
424
353
|
const pkg = process.env.INIT_CWD;
|
|
425
|
-
console.log(
|
|
354
|
+
console.log(chalk6.green(`Compiling ${pkg}`));
|
|
426
355
|
const config2 = await loadConfig(inConfig);
|
|
427
356
|
const publint = config2.publint;
|
|
428
357
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -450,7 +379,7 @@ var packageRecompile = /* @__PURE__ */ __name(async () => {
|
|
|
450
379
|
|
|
451
380
|
// src/bin/package/recompile.ts
|
|
452
381
|
packageRecompile().then((value) => process.exitCode = value).catch((reason) => {
|
|
453
|
-
console.error(
|
|
382
|
+
console.error(chalk7.red(reason));
|
|
454
383
|
process.exitCode = 1;
|
|
455
384
|
});
|
|
456
385
|
//# sourceMappingURL=recompile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/bin/package/recompile.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/clean-outputs.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts","../../../src/actions/package/compile/compile.ts","../../../src/actions/package/publint.ts","../../../src/actions/package/compile/packageCompileTsc.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/packageCompileTsup.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts","../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../src/actions/package/recompile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageRecompile } from '../../actions/index.ts'\n\npackageRecompile()\n .then(value => (process.exitCode = value))\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exitCode = 1\n })\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport { rimraf } from 'rimraf'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => rimraf(folder)))\n\n return 0\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport { rimraf } from 'rimraf'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => rimraf(file)))\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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 mode = config.compile?.mode ?? 'tsup'\n let result: number = 0\n switch (mode) {\n case 'tsc': {\n result += await packageCompileTsc(undefined, config as XyTscConfig)\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(config as XyTsupConfig)\n break\n }\n }\n return result + (publint ? await packagePublint(config) : 0)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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/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 { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 0)\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: false,\n entry,\n format: ['esm'],\n // minify: true,\n outDir,\n silent: true,\n sourcemap: true,\n splitting: false,\n // terserOptions: { format: { comments: false } },\n tsconfig: 'tsconfig.json',\n ...options,\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 await Promise.all(optionsList.map(options => build(options)))\n packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\n// eslint-disable-next-line complexity\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\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 const compileForNeutral = compile?.neutral ?? { src: {} }\n\n const standardLoaders: Record<string, Loader> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (\n (await packageCompileTsc(true, { publint: false, verbose }))\n || (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\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 const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\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(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\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 || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport { CompilerOptions, DiagnosticCategory } from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n { verbose }: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n if (verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n declaration: true,\n emitDeclarationOnly: true,\n outDir: 'dist',\n removeComments: true,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: true,\n })),\n ...compilerOptionsParam,\n } as TsConfigCompilerOptions\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all')\n\n const result = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n }).emit()\n\n const diagResults = result.diagnostics.length\n for (const diag of result.diagnostics) {\n switch (diag.category) {\n case DiagnosticCategory.Error: {\n console.error(chalk.red(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Warning: {\n console.error(chalk.yellow(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n case DiagnosticCategory.Suggestion: {\n console.error(chalk.white(diag.messageText))\n console.error(chalk.grey(pkg))\n console.error(chalk.blue(diag.file?.fileName))\n break\n }\n }\n }\n return diagResults\n}\n","import { packageClean } from './clean.ts'\nimport { packageCompile } from './compile/index.ts'\n\nexport const packageRecompile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B,GAAGC,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA;AACvG,GAFgC;;;AbGhCC,iBAAAA,EACGC,KAAKC,CAAAA,UAAUC,QAAQC,WAAWF,KAAAA,EAClCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,WAAW;AACrB,CAAA;","names":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","path","chalk","rimraf","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","rimraf","path","chalk","rimraf","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","rimraf","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value","chalk","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint","build","defineConfig","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","cwd","chalk","createProgramFromConfig","DiagnosticCategory","packageCompileTscTypes","folder","verbose","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","console","log","compilerOptions","getCompilerOptions","declaration","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","files","buildEntries","result","createProgramFromConfig","basePath","exclude","emit","diagResults","diagnostics","length","diag","category","DiagnosticCategory","Error","error","chalk","red","messageText","grey","blue","file","fileName","Warning","yellow","Suggestion","white","compileFolder","folder","entryMode","options","verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTscTypes","packageCompileTsup","config","compile","publint","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","packageCompileTsc","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint","packageRecompile","Promise","all","packageClean","packageCompile","reduce","prev","value","packageRecompile","then","value","process","exitCode","catch","reason","console","error","chalk","red"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/bin/package/recompile.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/clean-outputs.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts","../../../src/actions/package/compile/compile.ts","../../../src/actions/package/publint.ts","../../../src/actions/package/compile/packageCompileTsc.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/packageCompileTsup.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts","../../../src/actions/package/recompile.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageRecompile } from '../../actions/index.ts'\n\npackageRecompile()\n .then(value => (process.exitCode = value))\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exitCode = 1\n })\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport { rimraf } from 'rimraf'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => rimraf(folder)))\n\n return 0\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport { rimraf } from 'rimraf'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => rimraf(file)))\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packagePublint } from '../publint.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport { packageCompileTsup } from './packageCompileTsup.ts'\nimport { XyConfig, XyTscConfig, XyTsupConfig } 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 mode = config.compile?.mode ?? 'tsup'\n let result: number = 0\n switch (mode) {\n case 'tsc': {\n result += await packageCompileTsc(undefined, config as XyTscConfig)\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(config as XyTsupConfig)\n break\n }\n }\n return result + (publint ? await packagePublint(config) : 0)\n}\n","import { promises as fs } from 'node:fs'\n\nimport chalk from 'chalk'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\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/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 { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport { createProgramFromConfig, TsConfigCompilerOptions } from 'tsc-prog'\nimport {\n CompilerOptions,\n DiagnosticCategory,\n FormatDiagnosticsHost,\n formatDiagnosticsWithColorAndContext,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n LineAndCharacter,\n} from 'typescript'\n\nimport { packagePublint } from '../publint.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport { XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions): Promise<number> => {\n const pkg = process.env.INIT_CWD ?? cwd()\n\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\n\n const formatHost: FormatDiagnosticsHost = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => pkg,\n getNewLine: () => '\\n',\n }\n\n if (verbose) {\n console.log(`Compiling with NoEmit TSC [${pkg}]`)\n }\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist',\n removeComments: true,\n rootDir: 'src',\n })),\n ...compilerOptionsParam,\n ...(noEmit === undefined ? {} : { noEmit }),\n } as TsConfigCompilerOptions\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n include: ['src'],\n })\n\n const results = getPreEmitDiagnostics(program)\n\n for (const diag of results) {\n const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }\n console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))\n console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))\n }\n\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, diag) => (prev + diag.category === DiagnosticCategory.Error ? 1 : 0), 0) || (publint ? await packagePublint() : 0)\n}\n","import { createRequire } from 'node:module'\n\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge.js'\nimport { TsConfig } from 'tsc-prog'\nimport { CompilerOptions, findConfigFile, readConfigFile, sys } from 'typescript'\n\nconst getNested = (config: TsConfig): CompilerOptions => {\n if (config.extends) {\n const require = createRequire(import.meta.url)\n const opts = require(config.extends)\n return { ...getNested(opts), ...config.compilerOptions } as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nexport const getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n const config = readConfigFile(filename, sys.readFile).config\n return getNested(config)\n}\n\nexport const getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n","import type { Loader } from 'esbuild'\nimport { build, defineConfig, Options } from 'tsup'\n\nimport { packagePublint } from '../publint.ts'\nimport { buildEntries } from './buildEntries.ts'\nimport { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {\n const outDir = options?.outDir ?? 'dist'\n const entry = buildEntries(folder, entryMode)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: true,\n entry,\n format: ['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]).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 await Promise.all(optionsList.map(options => build(options)))\n // packageCompileTscTypes(folder, { verbose }, { outDir })\n\n return 0\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const publint = config?.publint ?? true\n const verbose = config?.verbose ?? false\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 const compileForNeutral = compile?.neutral ?? { src: {} }\n\n const standardLoaders: Record<string, Loader> = { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }\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 (\n (\n await Promise.all(\n Object.entries(compileForNode).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/node',\n platform: 'node',\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 const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/browser',\n platform: 'browser',\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(compileForNeutral).map(async ([folder, options]) => {\n const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}\n return folder\n ? await compileFolder(\n folder,\n compile?.entryMode,\n {\n ...standardOptions,\n loader: {\n ...standardOptions.loader,\n ...inEsBuildOptions?.loader,\n },\n outDir: 'dist/neutral',\n platform: 'neutral',\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 || (publint ? await packagePublint() : 0)\n )\n}\n","import { readdir } from 'node:fs/promises'\n\nimport { glob } from 'glob'\n\nexport const getInputs = async (subDir?: string) => {\n return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))\n .filter(\n file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),\n )\n .map(file => (subDir ? `${subDir}/${file}` : file))\n}\n\nexport const getInputDirs = async (depth: number = 0) => {\n if (depth === 0) {\n return []\n }\n return [\n '.',\n ...(await readdir('src', { recursive: true, withFileTypes: true }))\n .filter(file => file.isDirectory())\n .map((file) => {\n const pathParts = file.path?.split('/') ?? []\n pathParts.shift()\n if (pathParts.length > 0) {\n const root = pathParts.join('/')\n return `${root}/${file.name}`\n } else {\n return file.name\n }\n }),\n ]\n}\n\nexport const getAllInputs = async (depth = 100) => {\n const dirs = await getInputDirs(depth)\n return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()\n}\n\nexport const getAllInputs2 = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })\n}\n","import { getAllInputs2 } from './inputs.ts'\nimport { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode?: EntryMode, verbose = false) => {\n switch (entryMode) {\n case 'platform': {\n if (verbose) console.log('buildEntries [platform]')\n return [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n }\n case 'all': {\n if (verbose) console.log('buildEntries [all]')\n return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))\n }\n default: {\n if (verbose) console.log('buildEntries [single]')\n return [`${folder}/index.ts`]\n }\n }\n}\n","import { packageClean } from './clean.ts'\nimport { packageCompile } from './compile/index.ts'\n\nexport const packageRecompile = async () => {\n return (await Promise.all([packageClean(), packageCompile()])).reduce((prev, value) => prev + value, 0)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAE5B,OAAOC,WAAW;AAElB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,MAAM,CAAC,GAAGH,QAAQE,MAAAA;EAC3B;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,IAAIC,MAAMC,KAAK,uBAAuBL,cAAAA,EAAgB,CAAA;EAChE;AACA,SAAOL,MAAM,CAAC,GAAGH,QAAQE,MAAAA;AAC3B,GAZ0B;;;ACP1B,OA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QAAWP,OAAAA;AAC7C;IACF;IACA,KAAK,QAAQ;AACXK,gBAAU,MAAMG,mBAAmBR,OAAAA;AACnC;IACF;EACF;AACA,SAAOK,UAAUH,UAAU,MAAMO,eAAeT,OAAAA,IAAU;AAC5D,GAnB8B;;;AOLvB,IAAMU,mBAAmB,mCAAA;AAC9B,UAAQ,MAAMC,QAAQC,IAAI;IAACC,aAAAA;IAAgBC,eAAAA;GAAiB,GAAGC,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA;AACvG,GAFgC;;;AZGhCC,iBAAAA,EACGC,KAAKC,CAAAA,UAAUC,QAAQC,WAAWF,KAAAA,EAClCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,WAAW;AACrB,CAAA;","names":["chalk","chalk","cosmiconfig","merge","config","loadConfig","params","merge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","path","chalk","rimraf","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","rimraf","path","chalk","rimraf","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","rimraf","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value","chalk","promises","fs","chalk","packagePublint","params","pkgDir","process","env","INIT_CWD","pkg","JSON","parse","fs","readFile","console","log","chalk","green","name","gray","publint","messages","level","strict","formatMessage","validMessage","_message","validMessages","filter","message","type","error","red","code","warn","yellow","white","verbose","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getLineAndCharacterOfPosition","getPreEmitDiagnostics","createRequire","merge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","merge","packageCompileTsc","noEmit","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","publint","verbose","formatHost","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","console","log","compilerOptions","getCompilerOptions","outDir","removeComments","rootDir","undefined","program","createProgramFromConfig","basePath","exclude","include","results","getPreEmitDiagnostics","diag","lineAndChar","file","getLineAndCharacterOfPosition","start","character","line","chalk","cyan","formatDiagnosticsWithColorAndContext","reduce","prev","category","DiagnosticCategory","Error","packagePublint","build","defineConfig","glob","getAllInputs2","folder","glob","sync","ignore","posix","buildEntries","folder","entryMode","verbose","console","log","getAllInputs2","filter","entry","includes","compileFolder","folder","entryMode","options","_verbose","outDir","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","packageCompileTsup","config","compile","publint","verbose","console","log","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","Object","entries","inEsBuildOptions","esbuildOptions","platform","tsup","reduce","prev","value","packagePublint","packageCompile","inConfig","pkg","process","env","INIT_CWD","console","log","chalk","green","config","loadConfig","publint","mode","compile","result","packageCompileTsc","undefined","packageCompileTsup","packagePublint","packageRecompile","Promise","all","packageClean","packageCompile","reduce","prev","value","packageRecompile","then","value","process","exitCode","catch","reason","console","error","chalk","red"]}
|