@xylabs/ts-scripts-yarn3 4.0.0 → 4.0.2

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 (49) hide show
  1. package/dist/actions/build.mjs +3 -1
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/compile.mjs +9 -7
  4. package/dist/actions/compile.mjs.map +1 -1
  5. package/dist/actions/index.mjs +112 -39
  6. package/dist/actions/index.mjs.map +1 -1
  7. package/dist/actions/package/compile/compile.mjs +79 -10
  8. package/dist/actions/package/compile/compile.mjs.map +1 -1
  9. package/dist/actions/package/compile/index.mjs +79 -10
  10. package/dist/actions/package/compile/index.mjs.map +1 -1
  11. package/dist/actions/package/compile/packageCompileTsup.mjs +239 -6
  12. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  13. package/dist/actions/package/index.mjs +93 -24
  14. package/dist/actions/package/index.mjs.map +1 -1
  15. package/dist/actions/package/recompile.mjs +79 -10
  16. package/dist/actions/package/recompile.mjs.map +1 -1
  17. package/dist/bin/package/build.mjs +551 -0
  18. package/dist/bin/package/build.mjs.map +1 -0
  19. package/dist/bin/package/compile-only.mjs +81 -12
  20. package/dist/bin/package/compile-only.mjs.map +1 -1
  21. package/dist/bin/package/compile-tsup.mjs +239 -8
  22. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  23. package/dist/bin/package/compile.mjs +81 -12
  24. package/dist/bin/package/compile.mjs.map +1 -1
  25. package/dist/bin/package/recompile.mjs +81 -12
  26. package/dist/bin/package/recompile.mjs.map +1 -1
  27. package/dist/bin/xy-ts.mjs +26 -12
  28. package/dist/bin/xy-ts.mjs.map +1 -1
  29. package/dist/bin/xy.mjs +26 -12
  30. package/dist/bin/xy.mjs.map +1 -1
  31. package/dist/index.d.ts +7 -5
  32. package/dist/index.mjs +136 -53
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/xy/index.mjs +26 -12
  35. package/dist/xy/index.mjs.map +1 -1
  36. package/dist/xy/xy.mjs +26 -12
  37. package/dist/xy/xy.mjs.map +1 -1
  38. package/dist/xy/xyBuildCommands.mjs +17 -12
  39. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  40. package/dist/xy/xyParseOptions.mjs +9 -0
  41. package/dist/xy/xyParseOptions.mjs.map +1 -1
  42. package/package.json +5 -4
  43. package/src/actions/build.ts +1 -1
  44. package/src/actions/compile.ts +22 -7
  45. package/src/actions/package/compile/compile.ts +2 -2
  46. package/src/actions/package/compile/packageCompileTsup.ts +18 -5
  47. package/src/bin/package/build.ts +16 -0
  48. package/src/xy/xyBuildCommands.ts +5 -4
  49. package/src/xy/xyParseOptions.ts +7 -0
@@ -141,7 +141,9 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
141
141
  ...targetOptions,
142
142
  ...verboseOptions,
143
143
  ...jobsOptions,
144
- ...incrementalOptions
144
+ ...incrementalOptions,
145
+ "--types",
146
+ "tsc"
145
147
  ]
146
148
  ],
147
149
  [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/build.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = pkg ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries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D;AAEA,QAAMgB,SAAS,MAAMC,cAAc,QAAQlB,cAAc,iBAAiB,EAAA,KAAOI,OAAO,KAAA,KAAU;IAChG;MAAC;MAAQ;QAAC;QAAM;WAAcI;WAAeG;WAAkBD;WAAmBE;WAAgBH;;;IAClG;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBD;;;IAC7D;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBE;WAAgBH;;;GAC9E;AACDI,UAAQC,IAAI,GAAGC,OAAMI,KAAK,UAAA,CAAA,KAAgBJ,OAAMK,UAAUd,KAAKC,IAAG,IAAKF,SAAS,KAAMgB,QAAQ,CAAA,CAAA,CAAA,KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GApBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/build.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = pkg ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, '--types', 'tsc']],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWI;AACjD,GAPyB;;;ACElB,IAAME,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC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C,aAAaC,MAAMC,QAAQC,SAASC,IAAG,MAC3B;AACZ,QAAMC,QAAQC,KAAKC,IAAG;AACtB,QAAMC,aAAaJ,MAAM;IAACA;MAAO,CAAA;AACjC,QAAMK,qBAAqBT,cAAc;IAAC;MAAQ,CAAA;AAClD,QAAMU,iBAAiBP,UAAU;IAAC;MAAQ,CAAA;AAC1C,QAAMQ,gBAAgBT,SAAS;IAAC;IAAMA;MAAU,CAAA;AAChD,QAAMU,cAAcX,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRY,YAAQC,IAAIC,OAAMC,KAAK,gBAAgBf,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMgB,SAAS,MAAMC,cAAc,QAAQlB,cAAc,iBAAiB,EAAA,KAAOI,OAAO,KAAA,KAAU;IAChG;MAAC;MAAQ;QAAC;QAAM;WAAcI;WAAeG;WAAkBD;WAAmBE;WAAgBH;QAAoB;QAAW;;;IACjI;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBD;;;IAC7D;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBE;WAAgBH;;;GAC9E;AACDI,UAAQC,IAAI,GAAGC,OAAMI,KAAK,UAAA,CAAA,KAAgBJ,OAAMK,UAAUd,KAAKC,IAAG,IAAKF,SAAS,KAAMgB,QAAQ,CAAA,CAAA,CAAA,KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GApBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","spawn","existsSync","chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
@@ -98,21 +98,23 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
98
98
  }, "runSteps");
99
99
 
100
100
  // src/actions/compile.ts
101
- var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint, jobs }) => {
101
+ var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint, jobs, types }) => {
102
102
  return pkg ? compilePackage({
103
103
  pkg,
104
104
  publint,
105
105
  target,
106
- verbose
106
+ verbose,
107
+ types
107
108
  }) : compileAll({
108
109
  incremental,
109
110
  publint,
110
111
  target,
111
112
  verbose,
112
- jobs
113
+ jobs,
114
+ types
113
115
  });
114
116
  }, "compile");
115
- var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
117
+ var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
116
118
  const targetOptions = target ? [
117
119
  "-t",
118
120
  target
@@ -124,13 +126,13 @@ var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
124
126
  "workspace",
125
127
  pkg,
126
128
  "run",
127
- "package-compile",
129
+ types === "tsup" ? "package-compile" : "package-build",
128
130
  ...targetOptions
129
131
  ]
130
132
  ]
131
133
  ]);
132
134
  }, "compilePackage");
133
- var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
135
+ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, types }) => {
134
136
  const start = Date.now();
135
137
  const verboseOptions = verbose ? [
136
138
  "--verbose"
@@ -167,7 +169,7 @@ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental })
167
169
  ...jobsOptions,
168
170
  ...verboseOptions,
169
171
  "run",
170
- "package-compile",
172
+ types === "tsup" ? "package-compile" : "package-build",
171
173
  ...targetOptions
172
174
  ]
173
175
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/compile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({\n verbose, target, pkg, incremental, publint, jobs,\n}: CompileParams) => {\n return pkg\n ? compilePackage({\n pkg, publint, target, verbose,\n })\n : compileAll({\n incremental, publint, target, verbose, jobs,\n })\n}\n\nexport const compilePackage = ({ target, pkg }: CompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]])\n}\n\nexport const compileAll = ({\n jobs, verbose, target, incremental,\n}: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-Apt', '--topological-dev'] : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces', 'foreach', ...incrementalOptions, ...jobsOptions, ...verboseOptions, 'run', 'package-compile', ...targetOptions]],\n ])\n console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG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","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","compile","verbose","target","pkg","incremental","publint","jobs","compilePackage","compileAll","targetOptions","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/compile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n types?: 'tsc' | 'tsup'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n types?: 'tsc' | 'tsup'\n verbose?: boolean\n}\n\nexport const compile = ({\n verbose, target, pkg, incremental, publint, jobs, types,\n}: CompileParams) => {\n return pkg\n ? compilePackage({\n pkg, publint, target, verbose, types,\n })\n : compileAll({\n incremental, publint, target, verbose, jobs, types,\n })\n}\n\nexport const compilePackage = ({\n target, pkg, types,\n}: CompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', types === 'tsup' ? 'package-compile' : 'package-build', ...targetOptions]]],\n )\n}\n\nexport const compileAll = ({\n jobs, verbose, target, incremental, types,\n}: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-Apt', '--topological-dev'] : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n types === 'tsup' ? 'package-compile' : 'package-build',\n ...targetOptions,\n ]],\n ])\n console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWI;AACjD,GAPyB;;;ACElB,IAAME,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,OAAO;AACLH,cAAQL,MAAMM,OAAMC,IA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AAcX,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRY,YAAQC,IAAIC,OAAMC,KAAK,gBAAgBf,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMgB,SAASX,SAAS,UAAUP,cAAc,iBAAiB,EAAA,UAAY;IAC3E;MAAC;MAAQ;QAAC;QACR;WACGY;WACAC;WACAF;QACH;QACAR,UAAU,SAAS,oBAAoB;WACpCG;;;GAEN;AACDQ,UAAQC,IAAI,GAAGC,OAAMG,KAAK,aAAA,CAAA,KAAmBH,OAAMI,UAAUX,KAAKC,IAAG,IAAKF,SAAS,KAAMa,QAAQ,CAAA,CAAA,CAAA,KAAQL,OAAMG,KAAK,SAAA,CAAA,EAAY;AAChI,SAAOD;AACT,GAzB0B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","compile","verbose","target","pkg","incremental","publint","jobs","types","compilePackage","compileAll","targetOptions","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
@@ -446,7 +446,7 @@ var mergeEntries = /* @__PURE__ */ __name((a, b) => [
446
446
  ].sort(), "mergeEntries");
447
447
  var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
448
448
  console.log(chalk4.green(`Generate ${filename3} Files`));
449
- const cwd4 = INIT_CWD() ?? ".";
449
+ const cwd5 = INIT_CWD() ?? ".";
450
450
  const workspaces = pkg ? [
451
451
  yarnWorkspace(pkg)
452
452
  ] : yarnWorkspaces();
@@ -454,7 +454,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
454
454
  const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
455
455
  const results = workspaces.map(({ location, name }) => {
456
456
  try {
457
- writeEntries(location, mergeEntries(readEntries(cwd4), readEntries(location)));
457
+ writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
458
458
  return 0;
459
459
  } catch (ex) {
460
460
  const error = ex;
@@ -606,7 +606,9 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
606
606
  ...targetOptions,
607
607
  ...verboseOptions,
608
608
  ...jobsOptions,
609
- ...incrementalOptions
609
+ ...incrementalOptions,
610
+ "--types",
611
+ "tsc"
610
612
  ]
611
613
  ],
612
614
  [
@@ -690,21 +692,23 @@ var cleanDocs = /* @__PURE__ */ __name(() => {
690
692
 
691
693
  // src/actions/compile.ts
692
694
  import chalk10 from "chalk";
693
- var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs }) => {
695
+ var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs, types }) => {
694
696
  return pkg ? compilePackage({
695
697
  pkg,
696
698
  publint: publint2,
697
699
  target,
698
- verbose
700
+ verbose,
701
+ types
699
702
  }) : compileAll({
700
703
  incremental,
701
704
  publint: publint2,
702
705
  target,
703
706
  verbose,
704
- jobs
707
+ jobs,
708
+ types
705
709
  });
706
710
  }, "compile");
707
- var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
711
+ var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
708
712
  const targetOptions = target ? [
709
713
  "-t",
710
714
  target
@@ -716,13 +720,13 @@ var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
716
720
  "workspace",
717
721
  pkg,
718
722
  "run",
719
- "package-compile",
723
+ types === "tsup" ? "package-compile" : "package-build",
720
724
  ...targetOptions
721
725
  ]
722
726
  ]
723
727
  ]);
724
728
  }, "compilePackage");
725
- var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
729
+ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, types }) => {
726
730
  const start = Date.now();
727
731
  const verboseOptions = verbose ? [
728
732
  "--verbose"
@@ -759,7 +763,7 @@ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental })
759
763
  ...jobsOptions,
760
764
  ...verboseOptions,
761
765
  "run",
762
- "package-compile",
766
+ types === "tsup" ? "package-compile" : "package-build",
763
767
  ...targetOptions
764
768
  ]
765
769
  ]
@@ -1411,7 +1415,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
1411
1415
  }, "packageClean");
1412
1416
 
1413
1417
  // src/actions/package/compile/compile.ts
1414
- import chalk22 from "chalk";
1418
+ import chalk23 from "chalk";
1415
1419
 
1416
1420
  // src/actions/package/publint.ts
1417
1421
  import { promises as fs2 } from "node:fs";
@@ -1576,8 +1580,69 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
1576
1580
  }
1577
1581
  }, "buildEntries");
1578
1582
 
1583
+ // src/actions/package/compile/packageCompileTscTypes.ts
1584
+ import { cwd as cwd3 } from "node:process";
1585
+ import chalk22 from "chalk";
1586
+ import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
1587
+ import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
1588
+ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
1589
+ const pkg = process.env.INIT_CWD ?? cwd3();
1590
+ if (verbose) {
1591
+ console.log(`Compiling types with TSC [${pkg}]`);
1592
+ }
1593
+ const compilerOptions = {
1594
+ ...getCompilerOptions({
1595
+ declaration: true,
1596
+ emitDeclarationOnly: true,
1597
+ outDir: "dist",
1598
+ removeComments: true,
1599
+ skipDefaultLibCheck: true,
1600
+ skipLibCheck: true,
1601
+ sourceMap: true
1602
+ }),
1603
+ ...compilerOptionsParam
1604
+ };
1605
+ const files = buildEntries(folder, "all");
1606
+ const result = createProgramFromConfig2({
1607
+ basePath: pkg ?? cwd3(),
1608
+ compilerOptions,
1609
+ exclude: [
1610
+ "dist",
1611
+ "docs",
1612
+ "**/*.spec.*",
1613
+ "**/*.stories.*",
1614
+ "src/**/spec/**/*"
1615
+ ],
1616
+ files
1617
+ }).emit();
1618
+ const diagResults = result.diagnostics.length;
1619
+ for (const diag of result.diagnostics) {
1620
+ switch (diag.category) {
1621
+ case DiagnosticCategory2.Error: {
1622
+ console.error(chalk22.red(diag.messageText));
1623
+ console.error(chalk22.grey(pkg));
1624
+ console.error(chalk22.blue(diag.file?.fileName));
1625
+ break;
1626
+ }
1627
+ case DiagnosticCategory2.Warning: {
1628
+ console.error(chalk22.yellow(diag.messageText));
1629
+ console.error(chalk22.grey(pkg));
1630
+ console.error(chalk22.blue(diag.file?.fileName));
1631
+ break;
1632
+ }
1633
+ case DiagnosticCategory2.Suggestion: {
1634
+ console.error(chalk22.white(diag.messageText));
1635
+ console.error(chalk22.grey(pkg));
1636
+ console.error(chalk22.blue(diag.file?.fileName));
1637
+ break;
1638
+ }
1639
+ }
1640
+ }
1641
+ return diagResults;
1642
+ }, "packageCompileTscTypes");
1643
+
1579
1644
  // src/actions/package/compile/packageCompileTsup.ts
1580
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
1645
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, types = "tsup", verbose) => {
1581
1646
  const outDir = options?.outDir ?? "dist";
1582
1647
  const entry = buildEntries(folder, entryMode);
1583
1648
  const optionsResult = defineConfig({
@@ -1591,7 +1656,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
1591
1656
  ],
1592
1657
  outDir,
1593
1658
  silent: true,
1594
- sourcemap: true,
1659
+ sourcemap: types === "tsup",
1595
1660
  splitting: false,
1596
1661
  tsconfig: "tsconfig.json",
1597
1662
  ...options
@@ -1607,9 +1672,17 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
1607
1672
  ];
1608
1673
  }))).flat();
1609
1674
  await Promise.all(optionsList.map((options2) => build2(options2)));
1675
+ if (types === "tsc") {
1676
+ return packageCompileTscTypes(folder, {
1677
+ verbose
1678
+ }, {
1679
+ outDir
1680
+ });
1681
+ }
1610
1682
  return 0;
1611
1683
  }, "compileFolder");
1612
- var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1684
+ var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsup") => {
1685
+ console.warn("packageCompileTsup-types", types);
1613
1686
  const compile2 = config2?.compile;
1614
1687
  const publint2 = config2?.publint ?? true;
1615
1688
  const verbose = config2?.verbose ?? false;
@@ -1661,7 +1734,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1661
1734
  platform: "node",
1662
1735
  ...compile2?.tsup?.options,
1663
1736
  ...typeof options === "object" ? options : {}
1664
- }, verbose) : 0;
1737
+ }, types, verbose) : 0;
1665
1738
  }))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
1666
1739
  const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
1667
1740
  return folder ? await compileFolder(folder, compile2?.entryMode, {
@@ -1674,7 +1747,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1674
1747
  platform: "browser",
1675
1748
  ...compile2?.tsup?.options,
1676
1749
  ...typeof options === "object" ? options : {}
1677
- }, verbose) : 0;
1750
+ }, types, verbose) : 0;
1678
1751
  }))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
1679
1752
  const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
1680
1753
  return folder ? await compileFolder(folder, compile2?.entryMode, {
@@ -1687,14 +1760,14 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1687
1760
  platform: "neutral",
1688
1761
  ...compile2?.tsup?.options,
1689
1762
  ...typeof options === "object" ? options : {}
1690
- }, verbose) : 0;
1763
+ }, types, verbose) : 0;
1691
1764
  }))).reduce((prev, value) => prev + value, 0) || (publint2 ? await packagePublint() : 0);
1692
1765
  }, "packageCompileTsup");
1693
1766
 
1694
1767
  // src/actions/package/compile/compile.ts
1695
- var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
1768
+ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}, types) => {
1696
1769
  const pkg = process.env.INIT_CWD;
1697
- console.log(chalk22.green(`Compiling ${pkg}`));
1770
+ console.log(chalk23.green(`Compiling ${pkg}`));
1698
1771
  const config2 = await loadConfig(inConfig);
1699
1772
  const publint2 = config2.publint;
1700
1773
  const mode = config2.compile?.mode ?? "tsup";
@@ -1705,7 +1778,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
1705
1778
  break;
1706
1779
  }
1707
1780
  case "tsup": {
1708
- result += await packageCompileTsup(config2);
1781
+ result += await packageCompileTsup(config2, types);
1709
1782
  break;
1710
1783
  }
1711
1784
  }
@@ -1714,7 +1787,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
1714
1787
 
1715
1788
  // src/actions/package/copy-assets.ts
1716
1789
  import path5 from "node:path/posix";
1717
- import chalk23 from "chalk";
1790
+ import chalk24 from "chalk";
1718
1791
  import cpy2 from "cpy";
1719
1792
  var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
1720
1793
  try {
@@ -1733,7 +1806,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
1733
1806
  flat: false
1734
1807
  });
1735
1808
  if (values.length > 0) {
1736
- console.log(chalk23.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1809
+ console.log(chalk24.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1737
1810
  }
1738
1811
  for (const value of values) {
1739
1812
  console.log(`${value.split("/").pop()} => ./dist/${target}`);
@@ -1763,8 +1836,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
1763
1836
 
1764
1837
  // src/actions/package/deps.ts
1765
1838
  import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
1766
- import { cwd as cwd3 } from "node:process";
1767
- import chalk24 from "chalk";
1839
+ import { cwd as cwd4 } from "node:process";
1840
+ import chalk25 from "chalk";
1768
1841
  import depcheck from "depcheck";
1769
1842
  var special = depcheck.special;
1770
1843
  var defaultIgnorePatterns = [
@@ -1791,21 +1864,21 @@ var defaultIgnoreDevPatterns = [
1791
1864
  var reportUnused = /* @__PURE__ */ __name((name, unused) => {
1792
1865
  if (unused.length > 0) {
1793
1866
  const message = [
1794
- chalk24.yellow(`${unused.length} Unused ${name}`)
1867
+ chalk25.yellow(`${unused.length} Unused ${name}`)
1795
1868
  ];
1796
- for (const value of unused) message.push(chalk24.gray(` ${value}`));
1869
+ for (const value of unused) message.push(chalk25.gray(` ${value}`));
1797
1870
  console.log(message.join("\n"));
1798
1871
  }
1799
1872
  }, "reportUnused");
1800
1873
  var reportMissing = /* @__PURE__ */ __name((name, missing) => {
1801
1874
  if (Object.keys(missing).length > 0) {
1802
1875
  const message = [
1803
- chalk24.yellow(`${Object.entries(missing).length} Missing ${name}`)
1876
+ chalk25.yellow(`${Object.entries(missing).length} Missing ${name}`)
1804
1877
  ];
1805
1878
  for (const [key, value] of Object.entries(missing)) {
1806
- message.push(`${key}`, chalk24.gray(` ${value.at(0)}`));
1879
+ message.push(`${key}`, chalk25.gray(` ${value.at(0)}`));
1807
1880
  }
1808
- console.log(chalk24.yellow(message.join("\n")));
1881
+ console.log(chalk25.yellow(message.join("\n")));
1809
1882
  }
1810
1883
  }, "reportMissing");
1811
1884
  var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
@@ -1860,7 +1933,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
1860
1933
  };
1861
1934
  }, "analyzeDeps");
1862
1935
  var packageDeps = /* @__PURE__ */ __name(async () => {
1863
- const pkg = process.env.INIT_CWD ?? cwd3();
1936
+ const pkg = process.env.INIT_CWD ?? cwd4();
1864
1937
  const pkgName = process.env.npm_package_name;
1865
1938
  const packageContent = existsSync4(`${pkg}/package.json`) ? JSON.parse(readFileSync3(`${pkg}/package.json`, {
1866
1939
  encoding: "utf8"
@@ -1910,10 +1983,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
1910
1983
  reportUnused("dependencies", unusedDeps);
1911
1984
  reportUnused("devDependencies", unusedDevDeps);
1912
1985
  if (Object.entries(invalidDirs).length > 0) {
1913
- for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk24.gray(`Invalid Dir: ${key}: ${value}`));
1986
+ for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk25.gray(`Invalid Dir: ${key}: ${value}`));
1914
1987
  }
1915
1988
  if (Object.entries(invalidFiles).length > 0) {
1916
- for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk24.gray(`Invalid File: ${key}: ${value}`));
1989
+ for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk25.gray(`Invalid File: ${key}: ${value}`));
1917
1990
  }
1918
1991
  reportMissing("dependencies", missingDepsObject);
1919
1992
  reportMissing("devDependencies", missingDevDepsObject);
@@ -1924,7 +1997,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
1924
1997
  // src/actions/package/gen-docs.ts
1925
1998
  import { existsSync as existsSync5 } from "node:fs";
1926
1999
  import path6 from "node:path";
1927
- import chalk25 from "chalk";
2000
+ import chalk26 from "chalk";
1928
2001
  import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
1929
2002
  var ExitCodes = {
1930
2003
  CompileError: 3,
@@ -2026,7 +2099,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
2026
2099
  return ExitCodes.OutputError;
2027
2100
  }
2028
2101
  }
2029
- console.log(chalk25.green(`${pkgName} - Ok`));
2102
+ console.log(chalk26.green(`${pkgName} - Ok`));
2030
2103
  return ExitCodes.Ok;
2031
2104
  }, "runTypeDoc");
2032
2105
 
@@ -2093,7 +2166,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
2093
2166
  }, "rebuild");
2094
2167
 
2095
2168
  // src/actions/recompile.ts
2096
- import chalk26 from "chalk";
2169
+ import chalk27 from "chalk";
2097
2170
  var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
2098
2171
  return pkg ? await recompilePackage({
2099
2172
  pkg,
@@ -2154,7 +2227,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2154
2227
  `${jobs}`
2155
2228
  ] : [];
2156
2229
  if (jobs) {
2157
- console.log(chalk26.blue(`Jobs set to [${jobs}]`));
2230
+ console.log(chalk27.blue(`Jobs set to [${jobs}]`));
2158
2231
  }
2159
2232
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
2160
2233
  [
@@ -2184,7 +2257,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2184
2257
  ]
2185
2258
  ]
2186
2259
  ]);
2187
- console.log(`${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`);
2260
+ console.log(`${chalk27.gray("Recompiled in")} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`);
2188
2261
  return result;
2189
2262
  }, "recompileAll");
2190
2263
 
@@ -2284,7 +2357,7 @@ var sonar = /* @__PURE__ */ __name(() => {
2284
2357
  }, "sonar");
2285
2358
 
2286
2359
  // src/actions/statics.ts
2287
- import chalk27 from "chalk";
2360
+ import chalk28 from "chalk";
2288
2361
  var DefaultDependencies = [
2289
2362
  "axios",
2290
2363
  "@xylabs/pixel",
@@ -2295,7 +2368,7 @@ var DefaultDependencies = [
2295
2368
  "@mui/system"
2296
2369
  ];
2297
2370
  var statics = /* @__PURE__ */ __name(() => {
2298
- console.log(chalk27.green("Check Required Static Dependencies"));
2371
+ console.log(chalk28.green("Check Required Static Dependencies"));
2299
2372
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2300
2373
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2301
2374
  }, "statics");