@xylabs/ts-scripts-yarn3 6.1.9 → 6.1.11

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.
Files changed (35) hide show
  1. package/dist/actions/index.mjs +50 -40
  2. package/dist/actions/index.mjs.map +1 -1
  3. package/dist/actions/package/compile/compile.mjs +50 -40
  4. package/dist/actions/package/compile/compile.mjs.map +1 -1
  5. package/dist/actions/package/compile/compileTypes.mjs +24 -21
  6. package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
  7. package/dist/actions/package/compile/index.mjs +50 -40
  8. package/dist/actions/package/compile/index.mjs.map +1 -1
  9. package/dist/actions/package/compile/packageCompileTsc.mjs +26 -19
  10. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  11. package/dist/actions/package/compile/packageCompileTscTypes.mjs +24 -21
  12. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  13. package/dist/actions/package/compile/packageCompileTsup.mjs +50 -40
  14. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  15. package/dist/actions/package/index.mjs +50 -40
  16. package/dist/actions/package/index.mjs.map +1 -1
  17. package/dist/actions/package/recompile.mjs +50 -40
  18. package/dist/actions/package/recompile.mjs.map +1 -1
  19. package/dist/bin/package/build-only.mjs +50 -40
  20. package/dist/bin/package/build-only.mjs.map +1 -1
  21. package/dist/bin/package/build.mjs +50 -40
  22. package/dist/bin/package/build.mjs.map +1 -1
  23. package/dist/bin/package/compile-only.mjs +50 -40
  24. package/dist/bin/package/compile-only.mjs.map +1 -1
  25. package/dist/bin/package/compile-tsup.mjs +50 -40
  26. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  27. package/dist/bin/package/compile-types.mjs +24 -21
  28. package/dist/bin/package/compile-types.mjs.map +1 -1
  29. package/dist/bin/package/compile.mjs +50 -40
  30. package/dist/bin/package/compile.mjs.map +1 -1
  31. package/dist/bin/package/recompile.mjs +50 -40
  32. package/dist/bin/package/recompile.mjs.map +1 -1
  33. package/dist/index.mjs +50 -40
  34. package/dist/index.mjs.map +1 -1
  35. package/package.json +4 -4
@@ -122,29 +122,32 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
122
122
  ];
123
123
  const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
124
124
  console.log(chalk2.green(`Compiling Types ${pkg}: ${files.length}`));
125
- const program = createProgramFromConfig({
126
- basePath: pkg ?? cwd(),
127
- compilerOptions,
128
- exclude: [
129
- "dist",
130
- "docs",
131
- "**/*.spec.*",
132
- "**/*.stories.*",
133
- "src/**/spec/**/*"
134
- ],
135
- files
136
- });
137
- const diagnostics = getPreEmitDiagnostics(program);
138
- if (diagnostics.length > 0) {
139
- const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
140
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
141
- getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
142
- getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
125
+ if (files.length > 0) {
126
+ const program = createProgramFromConfig({
127
+ basePath: pkg ?? cwd(),
128
+ compilerOptions,
129
+ exclude: [
130
+ "dist",
131
+ "docs",
132
+ "**/*.spec.*",
133
+ "**/*.stories.*",
134
+ "src/**/spec/**/*"
135
+ ],
136
+ files
143
137
  });
144
- console.error(formattedDiagnostics);
138
+ const diagnostics = getPreEmitDiagnostics(program);
139
+ if (diagnostics.length > 0) {
140
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
141
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
142
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
143
+ getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
144
+ });
145
+ console.error(formattedDiagnostics);
146
+ }
147
+ program.emit();
148
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
145
149
  }
146
- program.emit();
147
- return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
150
+ return 0;
148
151
  }, "packageCompileTscTypes");
149
152
 
150
153
  // src/actions/package/compile/compileTypes.ts
@@ -208,28 +211,35 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
208
211
  ".mts",
209
212
  ".d.mts"
210
213
  ];
211
- const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
214
+ const includes = [
215
+ ".stories.",
216
+ ".spec."
217
+ ];
218
+ const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
212
219
  console.log(chalk3.green(`Compiling Files ${pkg}: ${files.length}`));
213
- const program = createProgramFromConfig2({
214
- basePath: pkg ?? cwd2(),
215
- compilerOptions,
216
- exclude: [
217
- "dist",
218
- "docs"
219
- ],
220
- files
221
- });
222
- const diagnostics = getPreEmitDiagnostics2(program);
223
- if (diagnostics.length > 0) {
224
- const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
225
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
226
- getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
227
- getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
220
+ if (files.length > 0) {
221
+ const program = createProgramFromConfig2({
222
+ basePath: pkg ?? cwd2(),
223
+ compilerOptions,
224
+ exclude: [
225
+ "dist",
226
+ "docs"
227
+ ],
228
+ files
228
229
  });
229
- console.error(formattedDiagnostics);
230
+ const diagnostics = getPreEmitDiagnostics2(program);
231
+ if (diagnostics.length > 0) {
232
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
233
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
234
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
235
+ getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
236
+ });
237
+ console.error(formattedDiagnostics);
238
+ }
239
+ program.emit();
240
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
230
241
  }
231
- program.emit();
232
- return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
242
+ return 0;
233
243
  }, "packageCompileTsc");
234
244
 
235
245
  // src/actions/package/compile/packageCompileTsup.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/bin/package/compile-tsup.ts","../../../src/lib/loadConfig.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/compile/getCompilerOptions.ts","../../../src/actions/package/compile/compileTypes.ts","../../../src/actions/package/compile/deepMerge.ts","../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompileTsup } from '../../actions/index.ts'\n\npackageCompileTsup({ verbose: true })\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'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\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 deepmerge(config, params ?? {}) as T\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\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 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 if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [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 if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} 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 deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst 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 deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose).filter(file => validTsExt.find(ext => file.endsWith(ext)))\n\n console.log(chalk.green(`Compiling Files ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;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,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACJ1B,SAASY,OAAOC,oBAAoB;;;ACFpC,SAASC,YAAY;AAEd,IAAMC,eAAe,wBAACC,WAAAA;AAE3B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,OAAO;EAAK,CAAA;AACrD,GAH4B;;;ACCrB,IAAMC,eAAe,wBAACC,QAAgBC,YAAuB,UAAUC,wBA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ACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MAEtC,MAAMzC,QAAQC,IACZgC,OAAOC,QAAQP,iBAAAA,EAAmBpB,IAAI,OAAO,CAAC5B,QAAQE,OAAAA,MAAQ;AAC5D,UAAMsD,mBAAmB,OAAOf,SAASQ,SAASQ,mBAAmB,WAAWhB,SAASQ,SAASQ,iBAAiB,CAAC;AACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA9EkC;;;AFvElCC,mBAAmB;EAAEC,SAAS;AAAK,CAAA,EAChCC,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","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","build","defineConfig","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","files","buildEntries","filter","file","find","ext","endsWith","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompileTsup","verbose","then","value","process","exitCode","catch","reason","console","error","chalk","red"]}
1
+ {"version":3,"sources":["../../../src/bin/package/compile-tsup.ts","../../../src/lib/loadConfig.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/compile/getCompilerOptions.ts","../../../src/actions/package/compile/compileTypes.ts","../../../src/actions/package/compile/deepMerge.ts","../../../src/actions/package/compile/packageCompileTsc.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompileTsup } from '../../actions/index.ts'\n\npackageCompileTsup({ verbose: true })\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'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\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 deepmerge(config, params ?? {}) as T\n}\n","import type { Loader } from 'esbuild'\nimport type { Options } from 'tsup'\nimport { build, defineConfig } from 'tsup'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { packageCompileTypes } from './compileTypes.ts'\nimport { deepMergeObjects } from './deepMerge.ts'\nimport { packageCompileTsc } from './packageCompileTsc.ts'\nimport type { EntryMode, XyTsupConfig } from './XyConfig.ts'\n\nconst compileFolder = async (\n folder: string,\n entryMode: EntryMode = 'single',\n options?: Options,\n verbose?: boolean,\n): Promise<number> => {\n const outDir = options?.outDir ?? 'dist'\n\n if (verbose) {\n console.log(`compileFolder [${folder}]`)\n }\n\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 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 if (verbose) {\n console.log(`TSUP:build:start [${folder}]`)\n }\n\n await Promise.all(optionsList.map(options => build(options)))\n\n if (verbose) {\n console.log(`TSUP:build:stop [${folder}]`)\n }\n\n return 0\n}\n\nexport const tsupOptions = (options: Options[] = []): Options => {\n const standardLoaders: Record<string, Loader> = {\n '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',\n }\n\n const standardOptions: Options = {\n bundle: true,\n format: ['esm'],\n loader: standardLoaders,\n outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),\n skipNodeModulesBundle: true,\n sourcemap: true,\n target: 'esnext',\n }\n\n return deepMergeObjects([standardOptions, ...options])\n}\n\nexport const packageCompileTsup = async (config?: XyTsupConfig) => {\n const compile = config?.compile\n const verbose = config?.verbose ?? false\n if (verbose) {\n console.log(`Compiling with TSUP [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 if (verbose) {\n console.log('Calling packageCompileTscTypes')\n }\n\n let errors = await packageCompileTypes(config)\n errors = errors + packageCompileTsc(undefined, config)\n if (errors > 0) {\n return errors\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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'node', outDir: 'dist/node' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForBrowser).map(async ([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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'browser', outDir: 'dist/browser' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || (\n await Promise.all(\n Object.entries(compileForNeutral).map(async ([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 tsupOptions([inEsBuildOptions,\n compile?.tsup?.options ?? {},\n (typeof options === 'object' ? options : {}),\n { platform: 'neutral', outDir: 'dist/neutral' }]),\n verbose,\n )\n : 0\n }),\n )\n ).reduce((prev, value) => prev + value, 0)\n || 0\n )\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} 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 deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst 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 deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyObject = Record<any, any>\n\nfunction deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {\n if (!source || typeof source !== 'object') return target\n\n for (const key of Object.keys(source)) {\n if (\n typeof source[key] === 'object'\n && source[key] !== null\n && !Array.isArray(source[key])\n ) {\n // Recursively merge nested objects\n if (!target[key] || typeof target[key] !== 'object') {\n target[key] = {} as T[typeof key]\n }\n deepMerge(target[key], source[key])\n } else {\n // Overwrite with non-object values\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nexport function deepMergeObjects<T extends AnyObject>(objects: T[]): T {\n const result = {} as T\n for (const obj of objects) {\n deepMerge(result, obj)\n }\n return result\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTsc = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: false,\n noEmit: true,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const includes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && (includes.find(include => file.includes(include))))\n\n console.log(chalk.green(`Compiling Files ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;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,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACJ1B,SAASY,OAAOC,oBAAoB;;;ACFpC,SAASC,YAAY;AAEd,IAAMC,eAAe,wBAACC,WAAAA;AAE3B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,OAAO;EAAK,CAAA;AACrD,GAH4B;;;ACCrB,IAAMC,eAAe,wBAACC,QAAgBC,YAAuB,UAAUC,wBAAwB,MAAMC,UAAU,UAAK;AACzH,MAAIC,UAAoB,CAAA;AACxB,UAAQH,WAAAA;IACN,KAAK,YA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,QAAQE,OAAAA,MAAQ;AAC5D,UAAMsD,mBAAmB,OAAOf,SAASM,SAASU,mBAAmB,WAAWhB,SAASM,SAASU,iBAAiB,CAAC;AACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,MAEtC,MAAMzC,QAAQC,IACZgC,OAAOC,QAAQP,iBAAAA,EAAmBpB,IAAI,OAAO,CAAC5B,QAAQE,OAAAA,MAAQ;AAC5D,UAAMsD,mBAAmB,OAAOf,SAASQ,SAASQ,mBAAmB,WAAWhB,SAASQ,SAASQ,iBAAiB,CAAC;AACpH,WAAOzD,SACH,MAAMD,cACNC,QACAyC,SAASxC,WACT6B,YAAY;MAAC0B;MACXf,SAASiB,MAAMxD,WAAW,CAAC;MAC1B,OAAOA,YAAY,WAAWA,UAAU,CAAC;MAC1C;QAAEyD,UAAU;QAAWvD,QAAQ;MAAe;KAAE,GAClDD,OAAAA,IAEA;EACN,CAAA,CAAA,GAEFyD,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA,KACrC;AAEP,GA9EkC;;;AFvElCC,mBAAmB;EAAEC,SAAS;AAAK,CAAA,EAChCC,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","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","build","defineConfig","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined","deepMerge","target","source","key","Object","keys","Array","isArray","deepMergeObjects","objects","result","obj","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","packageCompileTsc","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","emitDeclarationOnly","noEmit","validTsExt","includes","files","buildEntries","filter","file","find","ext","endsWith","include","console","log","chalk","green","length","program","createProgramFromConfig","basePath","exclude","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","compileFolder","folder","entryMode","options","verbose","outDir","console","log","entry","buildEntries","optionsResult","defineConfig","bundle","cjsInterop","clean","dts","format","silent","sourcemap","splitting","tsconfig","optionsList","Promise","all","Array","isArray","flatMap","result","flat","map","build","tsupOptions","standardLoaders","standardOptions","loader","outExtension","js","skipNodeModulesBundle","target","deepMergeObjects","packageCompileTsup","config","compile","depth","compileForNode","node","src","compileForBrowser","browser","compileForNeutral","neutral","errors","packageCompileTypes","packageCompileTsc","undefined","Object","entries","inEsBuildOptions","esbuildOptions","tsup","platform","reduce","prev","value","packageCompileTsup","verbose","then","value","process","exitCode","catch","reason","console","error","chalk","red"]}
@@ -119,29 +119,32 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
119
119
  ];
120
120
  const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
121
121
  console.log(chalk2.green(`Compiling Types ${pkg}: ${files.length}`));
122
- const program = createProgramFromConfig({
123
- basePath: pkg ?? cwd(),
124
- compilerOptions,
125
- exclude: [
126
- "dist",
127
- "docs",
128
- "**/*.spec.*",
129
- "**/*.stories.*",
130
- "src/**/spec/**/*"
131
- ],
132
- files
133
- });
134
- const diagnostics = getPreEmitDiagnostics(program);
135
- if (diagnostics.length > 0) {
136
- const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
137
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
138
- getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
139
- getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
122
+ if (files.length > 0) {
123
+ const program = createProgramFromConfig({
124
+ basePath: pkg ?? cwd(),
125
+ compilerOptions,
126
+ exclude: [
127
+ "dist",
128
+ "docs",
129
+ "**/*.spec.*",
130
+ "**/*.stories.*",
131
+ "src/**/spec/**/*"
132
+ ],
133
+ files
140
134
  });
141
- console.error(formattedDiagnostics);
135
+ const diagnostics = getPreEmitDiagnostics(program);
136
+ if (diagnostics.length > 0) {
137
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
138
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
139
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
140
+ getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
141
+ });
142
+ console.error(formattedDiagnostics);
143
+ }
144
+ program.emit();
145
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
142
146
  }
143
- program.emit();
144
- return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
147
+ return 0;
145
148
  }, "packageCompileTscTypes");
146
149
 
147
150
  // src/actions/package/compile/compileTypes.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/bin/package/compile-types.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts","../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompileTypes } from '../../actions/index.ts'\n\npackageCompileTypes({ verbose: true })\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'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\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 deepmerge(config, params ?? {}) as T\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} 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 deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst 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 deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;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,UAAUH,QAAQE,UAAU,CAAC,CAAA;AACtC,GAZ0B;;;ACN1B,SAASY,YAAY;AAEd,IAAMC,eAAe,wBAACC,WAAAA;AAE3B,SAAOC,KAAKC,KAAK,GAAGF,MAAAA,WAAiB;IAAEG,OAAO;EAAK,CAAA;AACrD,GAH4B;;;ACCrB,IAAMC,eAAe,wBAACC,QAAgBC,YAAuB,UAAUC,wBAAwB,MAAMC,UAAU,UAAK;AACzH,MAAIC,UAAoB,CAAA;AACxB,UAAQH,WAAAA;IACN,KAAK,YAAY;AACfG,gBAAU;QAAC,GAAGJ,MAAAA;QAAwB,GAAGA,MAAAA;;AACzC;IACF;IACA,KAAK,OAAO;AACVI,gBAAUF,wBAAwBG,aAAaL,MAAAA,EAAQM,OAAOC,CAAAA,UAAS,CAACA,MAAMC,SAAS,QAAA,KAAa,CAACD,MAAMC,SAAS,WAAA,CAAA,IAAgBH,aAAaL,MAAAA;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A;AAC3C,GALmC;;;ANAnCI,oBAAoB;EAAEC,SAAS;AAAK,CAAA,EACjCC,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","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined","packageCompileTypes","verbose","then","value","process","exit","catch","reason","console","error","chalk","red"]}
1
+ {"version":3,"sources":["../../../src/bin/package/compile-types.ts","../../../src/lib/loadConfig.ts","../../../src/actions/package/compile/inputs.ts","../../../src/actions/package/compile/buildEntries.ts","../../../src/actions/package/compile/packageCompileTscTypes.ts","../../../src/actions/package/compile/getCompilerOptions.ts","../../../src/actions/package/compile/compileTypes.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageCompileTypes } from '../../actions/index.ts'\n\npackageCompileTypes({ verbose: true })\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'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return deepmerge(config, params ?? {}) as T\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 deepmerge(config, params ?? {}) as T\n}\n","import { glob } from 'glob'\n\nexport const getAllInputs = (folder: string) => {\n /* tsup wants posix paths */\n return glob.sync(`${folder}/**/*.*`, { posix: true })\n}\n","import { getAllInputs } from './inputs.ts'\nimport type { EntryMode } from './XyConfig.ts'\n\nexport const buildEntries = (folder: string, entryMode: EntryMode = 'single', excludeSpecAndStories = true, verbose = false) => {\n let entries: string[] = []\n switch (entryMode) {\n case 'platform': {\n entries = [`${folder}/index-node.ts`, `${folder}/index-browser.ts`]\n break\n }\n case 'all': {\n entries = excludeSpecAndStories ? getAllInputs(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.stories.')) : getAllInputs(folder)\n break\n }\n default: {\n entries = [`${folder}/index.ts`]\n break\n }\n }\n if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`)\n return entries\n}\n","import { cwd } from 'node:process'\n\nimport chalk from 'chalk'\nimport type { TsConfigCompilerOptions } from 'tsc-prog'\nimport { createProgramFromConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys,\n} from 'typescript'\n\nimport { buildEntries } from './buildEntries.ts'\nimport { getCompilerOptions } from './getCompilerOptions.ts'\nimport type { XyConfig } from './XyConfig.ts'\n\nexport const packageCompileTscTypes = (\n folder: string = 'src',\n config: XyConfig = {},\n compilerOptionsParam?: CompilerOptions,\n): number => {\n const pkg = process.env.INIT_CWD ?? cwd()\n const verbose = config?.verbose ?? false\n\n const compilerOptions = {\n ...(getCompilerOptions({\n emitDeclarationOnly: true,\n outDir: 'dist/types',\n removeComments: false,\n skipDefaultLibCheck: true,\n skipLibCheck: true,\n sourceMap: false,\n })),\n ...compilerOptionsParam,\n emitDeclarationOnly: true,\n noEmit: false,\n } as TsConfigCompilerOptions\n\n const validTsExt = ['.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts']\n const excludes = ['.stories.', '.spec.']\n\n // calling all here since the types do not get rolled up\n const files = buildEntries(folder, 'all', verbose)\n .filter(file => validTsExt.find(ext => file.endsWith(ext)) && !(excludes.some(exclude => file.includes(exclude))))\n\n console.log(chalk.green(`Compiling Types ${pkg}: ${files.length}`))\n\n if (files.length > 0) {\n const program = createProgramFromConfig({\n basePath: pkg ?? cwd(),\n compilerOptions,\n exclude: ['dist', 'docs', '**/*.spec.*', '**/*.stories.*', 'src/**/spec/**/*'],\n files,\n })\n\n const diagnostics = getPreEmitDiagnostics(program)\n\n if (diagnostics.length > 0) {\n const formattedDiagnostics = formatDiagnosticsWithColorAndContext(\n diagnostics,\n {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => folder,\n getNewLine: () => sys.newLine,\n },\n )\n console.error(formattedDiagnostics)\n }\n\n program.emit()\n return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0)\n }\n return 0\n}\n","import { createRequire } from 'node:module'\n\nimport deepmerge from 'deepmerge'\nimport type { TsConfig } from 'tsc-prog'\nimport type { CompilerOptions } from 'typescript'\nimport {\n findConfigFile, readConfigFile, sys,\n} 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 deepmerge(getNested(opts), config.compilerOptions ?? {}) as CompilerOptions\n }\n\n return config.compilerOptions as CompilerOptions\n}\n\nconst 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 deepmerge(configFileCompilerOptions, options)\n}\n","import chalk from 'chalk'\n\nimport { loadConfig } from '../../../lib/index.ts'\nimport { packageCompileTscTypes } from './packageCompileTscTypes.ts'\nimport type { XyConfig, XyTscConfig } from './XyConfig.ts'\n\nexport const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const config = await loadConfig(inConfig)\n\n return packageCompileTscTypes(undefined, config as XyTscConfig)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,OAAOC,eAAe;AAEtB,IAAIC;AAEG,IAAMC,aAAa,8BAAyBC,WAAAA;AACjD,MAAIF,QAAQ;AACV,WAAOG,UAAUH,QAAQE,UAAU,CAAC,CAAA;EACtC;AAEA,QAAME,qBAAqB,MAAMC,YAAY,MAAM;IAAEC,OAAO;EAAK,CAAA,EAAGC,OAAM;AAC1EP,WAASI,oBAAoBJ;AAC7B,QAAMQ,iBAAiBJ,oBAAoBK;AAC3C,MAAID,gBAAgB;AAClBE,YAAQC,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CC,UAAUlC,OAAOI,IAAAA;MACjBE;MACAmB,SAAS;QAAC;QAAQ;QAAQ;QAAe;QAAkB;;MAC3DR;IACF,CAAA;AAEA,UAAMkB,cAAcC,sBAAsBJ,OAAAA;AAE1C,QAAIG,YAAYJ,SAAS,GAAG;AAC1B,YAAMM,uBAAuBC,qCAC3BH,aACA;QACEI,sBAAsBC,wBAAAA,aAAYA,UAAZA;QACtBC,qBAAqB,6BAAM5C,QAAN;QACrB6C,YAAY,6BAAMC,KAAIC,SAAV;MACd,CAAA;AAEFjB,cAAQkB,MAAMR,oBAAAA;IAChB;AAEAL,YAAQc,KAAI;AACZ,WAAOX,YAAYY,OAAO,CAACC,KAAKC,SAASD,OAAOC,KAAKC,aAAaC,mBAAmBC,QAAQ,IAAI,IAAI,CAAA;EACvG;AACA,SAAO;AACT,GAzDsC;;;AER/B,IAAMC,sBAAsB,8BAAOC,WAAqB,CAAC,MAAC;AAC/D,QAAMC,MAAMC,QAAQC,IAAIC;AACxB,QAAMC,UAAS,MAAMC,WAAWN,QAAAA;AAEhC,SAAOO,uBAAuBC,QAAWH,OAAAA;AAC3C,GALmC;;;ANAnCI,oBAAoB;EAAEC,SAAS;AAAK,CAAA,EACjCC,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","deepmerge","config","loadConfig","params","deepmerge","cosmicConfigResult","cosmiconfig","cache","search","configFilePath","filepath","console","log","chalk","gray","glob","getAllInputs","folder","glob","sync","posix","buildEntries","folder","entryMode","excludeSpecAndStories","verbose","entries","getAllInputs","filter","entry","includes","console","log","length","cwd","chalk","createProgramFromConfig","DiagnosticCategory","formatDiagnosticsWithColorAndContext","getPreEmitDiagnostics","sys","createRequire","deepmerge","findConfigFile","readConfigFile","sys","getNested","config","extends","require","createRequire","url","opts","deepmerge","compilerOptions","getCompilerOptionsJSONFollowExtends","filename","readConfigFile","sys","readFile","getCompilerOptions","options","tsconfig","configFileName","findConfigFile","fileExists","configFileCompilerOptions","undefined","packageCompileTscTypes","folder","config","compilerOptionsParam","pkg","process","env","INIT_CWD","cwd","verbose","compilerOptions","getCompilerOptions","emitDeclarationOnly","outDir","removeComments","skipDefaultLibCheck","skipLibCheck","sourceMap","noEmit","validTsExt","excludes","files","buildEntries","filter","file","find","ext","endsWith","some","exclude","includes","console","log","chalk","green","length","program","createProgramFromConfig","basePath","diagnostics","getPreEmitDiagnostics","formattedDiagnostics","formatDiagnosticsWithColorAndContext","getCanonicalFileName","fileName","getCurrentDirectory","getNewLine","sys","newLine","error","emit","reduce","acc","diag","category","DiagnosticCategory","Error","packageCompileTypes","inConfig","pkg","process","env","INIT_CWD","config","loadConfig","packageCompileTscTypes","undefined","packageCompileTypes","verbose","then","value","process","exit","catch","reason","console","error","chalk","red"]}
@@ -169,29 +169,32 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", config2 = {
169
169
  ];
170
170
  const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
171
171
  console.log(chalk3.green(`Compiling Types ${pkg}: ${files.length}`));
172
- const program = createProgramFromConfig({
173
- basePath: pkg ?? cwd(),
174
- compilerOptions,
175
- exclude: [
176
- "dist",
177
- "docs",
178
- "**/*.spec.*",
179
- "**/*.stories.*",
180
- "src/**/spec/**/*"
181
- ],
182
- files
183
- });
184
- const diagnostics = getPreEmitDiagnostics(program);
185
- if (diagnostics.length > 0) {
186
- const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
187
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
188
- getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
189
- getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
172
+ if (files.length > 0) {
173
+ const program = createProgramFromConfig({
174
+ basePath: pkg ?? cwd(),
175
+ compilerOptions,
176
+ exclude: [
177
+ "dist",
178
+ "docs",
179
+ "**/*.spec.*",
180
+ "**/*.stories.*",
181
+ "src/**/spec/**/*"
182
+ ],
183
+ files
190
184
  });
191
- console.error(formattedDiagnostics);
185
+ const diagnostics = getPreEmitDiagnostics(program);
186
+ if (diagnostics.length > 0) {
187
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext(diagnostics, {
188
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
189
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
190
+ getNewLine: /* @__PURE__ */ __name(() => sys2.newLine, "getNewLine")
191
+ });
192
+ console.error(formattedDiagnostics);
193
+ }
194
+ program.emit();
195
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
192
196
  }
193
- program.emit();
194
- return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
197
+ return 0;
195
198
  }, "packageCompileTscTypes");
196
199
 
197
200
  // src/actions/package/compile/compileTypes.ts
@@ -255,28 +258,35 @@ var packageCompileTsc = /* @__PURE__ */ __name((folder = "src", config2 = {}, co
255
258
  ".mts",
256
259
  ".d.mts"
257
260
  ];
258
- const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)));
261
+ const includes = [
262
+ ".stories.",
263
+ ".spec."
264
+ ];
265
+ const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
259
266
  console.log(chalk4.green(`Compiling Files ${pkg}: ${files.length}`));
260
- const program = createProgramFromConfig2({
261
- basePath: pkg ?? cwd2(),
262
- compilerOptions,
263
- exclude: [
264
- "dist",
265
- "docs"
266
- ],
267
- files
268
- });
269
- const diagnostics = getPreEmitDiagnostics2(program);
270
- if (diagnostics.length > 0) {
271
- const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
272
- getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
273
- getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
274
- getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
267
+ if (files.length > 0) {
268
+ const program = createProgramFromConfig2({
269
+ basePath: pkg ?? cwd2(),
270
+ compilerOptions,
271
+ exclude: [
272
+ "dist",
273
+ "docs"
274
+ ],
275
+ files
275
276
  });
276
- console.error(formattedDiagnostics);
277
+ const diagnostics = getPreEmitDiagnostics2(program);
278
+ if (diagnostics.length > 0) {
279
+ const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(diagnostics, {
280
+ getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
281
+ getCurrentDirectory: /* @__PURE__ */ __name(() => folder, "getCurrentDirectory"),
282
+ getNewLine: /* @__PURE__ */ __name(() => sys3.newLine, "getNewLine")
283
+ });
284
+ console.error(formattedDiagnostics);
285
+ }
286
+ program.emit();
287
+ return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
277
288
  }
278
- program.emit();
279
- return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
289
+ return 0;
280
290
  }, "packageCompileTsc");
281
291
 
282
292
  // src/actions/package/compile/packageCompileTsup.ts