@xylabs/ts-scripts-yarn3 3.0.11 → 3.0.13

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 (74) hide show
  1. package/dist/actions/package/compile/CompileParams.js +17 -0
  2. package/dist/actions/package/compile/CompileParams.js.map +1 -0
  3. package/dist/actions/package/compile/CompileParams.mjs +1 -0
  4. package/dist/actions/package/compile/CompileParams.mjs.map +1 -0
  5. package/dist/actions/package/compile/compile.js +98 -0
  6. package/dist/actions/package/compile/compile.js.map +1 -0
  7. package/dist/actions/package/compile/compile.mjs +64 -0
  8. package/dist/actions/package/compile/compile.mjs.map +1 -0
  9. package/dist/actions/package/compile/copyTypeFiles.js +49 -0
  10. package/dist/actions/package/compile/copyTypeFiles.js.map +1 -0
  11. package/dist/actions/package/compile/copyTypeFiles.mjs +25 -0
  12. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -0
  13. package/dist/actions/package/compile/index.js +29 -0
  14. package/dist/actions/package/compile/index.js.map +1 -0
  15. package/dist/actions/package/compile/index.mjs +5 -0
  16. package/dist/actions/package/compile/index.mjs.map +1 -0
  17. package/dist/actions/package/compile/inputs.js +58 -0
  18. package/dist/actions/package/compile/inputs.js.map +1 -0
  19. package/dist/actions/package/compile/inputs.mjs +32 -0
  20. package/dist/actions/package/compile/inputs.mjs.map +1 -0
  21. package/dist/actions/package/{compile.js → compile/rollup.js} +24 -75
  22. package/dist/actions/package/compile/rollup.js.map +1 -0
  23. package/dist/actions/package/compile/rollup.mjs +98 -0
  24. package/dist/actions/package/compile/rollup.mjs.map +1 -0
  25. package/dist/actions/package/compile/tsc.js +105 -0
  26. package/dist/actions/package/compile/tsc.js.map +1 -0
  27. package/dist/actions/package/compile/tsc.mjs +79 -0
  28. package/dist/actions/package/compile/tsc.mjs.map +1 -0
  29. package/dist/actions/package/compile/tscTypes.js +53 -0
  30. package/dist/actions/package/compile/tscTypes.js.map +1 -0
  31. package/dist/actions/package/compile/tscTypes.mjs +29 -0
  32. package/dist/actions/package/compile/tscTypes.mjs.map +1 -0
  33. package/dist/actions/package/compile/tsup.js +75 -0
  34. package/dist/actions/package/compile/tsup.js.map +1 -0
  35. package/dist/actions/package/compile/tsup.mjs +51 -0
  36. package/dist/actions/package/compile/tsup.mjs.map +1 -0
  37. package/dist/actions/package/publint.js +1 -1
  38. package/dist/actions/package/publint.js.map +1 -1
  39. package/dist/actions/package/publint.mjs +1 -1
  40. package/dist/actions/package/publint.mjs.map +1 -1
  41. package/dist/bin/package/compile-tsup.js +31 -0
  42. package/dist/bin/package/compile-tsup.js.map +1 -0
  43. package/dist/bin/package/compile-tsup.mjs +8 -0
  44. package/dist/bin/package/compile-tsup.mjs.map +1 -0
  45. package/dist/index.d.mts +53 -10
  46. package/dist/index.d.ts +53 -10
  47. package/dist/lib/index.js +2 -0
  48. package/dist/lib/index.js.map +1 -1
  49. package/dist/lib/index.mjs +1 -0
  50. package/dist/lib/index.mjs.map +1 -1
  51. package/dist/lib/loadConfig.js +54 -0
  52. package/dist/lib/loadConfig.js.map +1 -0
  53. package/dist/lib/loadConfig.mjs +20 -0
  54. package/dist/lib/loadConfig.mjs.map +1 -0
  55. package/package.json +5 -6
  56. package/src/actions/package/compile/CompileParams.ts +10 -0
  57. package/src/actions/package/compile/compile.ts +73 -0
  58. package/src/actions/package/compile/copyTypeFiles.ts +26 -0
  59. package/src/actions/package/compile/index.ts +4 -0
  60. package/src/actions/package/compile/inputs.ts +33 -0
  61. package/src/actions/package/compile/rollup.ts +109 -0
  62. package/src/actions/package/compile/tsc.ts +105 -0
  63. package/src/actions/package/compile/tscTypes.ts +30 -0
  64. package/src/actions/package/compile/tsup.ts +69 -0
  65. package/src/actions/package/publint.ts +5 -1
  66. package/src/bin/package/compile-tsup.ts +9 -0
  67. package/src/lib/index.ts +1 -0
  68. package/src/lib/loadConfig.ts +21 -0
  69. package/tsconfig.build.json +2 -2
  70. package/tsconfig.json +1 -7
  71. package/dist/actions/package/compile.js.map +0 -1
  72. package/dist/actions/package/compile.mjs +0 -150
  73. package/dist/actions/package/compile.mjs.map +0 -1
  74. package/src/actions/package/compile.ts +0 -177
@@ -0,0 +1,98 @@
1
+ import commonjs from "@rollup/plugin-commonjs";
2
+ import json from "@rollup/plugin-json";
3
+ import typescript from "@rollup/plugin-typescript";
4
+ import chalk from "chalk";
5
+ import { rollup } from "rollup";
6
+ import externalDeps from "rollup-plugin-exclude-dependencies-from-bundle";
7
+ import nodeExternals from "rollup-plugin-node-externals";
8
+ import { loadConfig } from "../../../lib";
9
+ import { loadPackageConfig } from "../../../loadPackageConfig";
10
+ import { packagePublint } from "../publint";
11
+ import { getInputDirs, getInputs } from "./inputs";
12
+ const compileSubDir = async (format, ext, subDir, _verbose = false) => {
13
+ const dir = subDir === "." ? void 0 : subDir;
14
+ const input = await getInputs(dir);
15
+ const tsPlugIn = typescript({
16
+ baseUrl: "src",
17
+ declaration: !dir || !subDir,
18
+ declarationMap: !dir || !subDir,
19
+ emitDeclarationOnly: false,
20
+ esModuleInterop: true,
21
+ exclude: ["**/*.spec.*", "dist", "docs", "node_modules", "packages"],
22
+ outDir: dir ? `dist/${dir}` : "dist",
23
+ rootDir: "src",
24
+ tsconfig: "tsconfig.json"
25
+ });
26
+ const errors = [];
27
+ const warnings = [];
28
+ const infos = [];
29
+ const debugs = [];
30
+ const options = {
31
+ input: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
32
+ logLevel: "warn",
33
+ onLog: (level, log, defaultHandler) => {
34
+ const pushLog = !(log.code === "EMPTY_BUNDLE" || log.code === "MIXED_EXPORTS" || log.code === "UNUSED_EXTERNAL_IMPORT");
35
+ if (pushLog) {
36
+ switch (level) {
37
+ case "warn": {
38
+ warnings.push(log);
39
+ break;
40
+ }
41
+ case "info": {
42
+ infos.push(log);
43
+ break;
44
+ }
45
+ case "debug": {
46
+ debugs.push(log);
47
+ break;
48
+ }
49
+ default: {
50
+ errors.push(log);
51
+ break;
52
+ }
53
+ }
54
+ }
55
+ console.log(chalk.yellow(`${level}: ${log.message} [${log.code}]`));
56
+ if (log.id) {
57
+ console.log(chalk.gray(log.id));
58
+ }
59
+ log.ids?.map((id) => {
60
+ console.log(chalk.gray(id));
61
+ });
62
+ return defaultHandler(level, log);
63
+ },
64
+ plugins: [commonjs(), externalDeps(), nodeExternals(), json(), tsPlugIn]
65
+ };
66
+ const outputOptions = {
67
+ dir: subDir ? `dist/${subDir}` : "dist",
68
+ dynamicImportInCjs: true,
69
+ entryFileNames: (chunkInfo) => `${chunkInfo.name}.${ext}`,
70
+ format,
71
+ sourcemap: true
72
+ };
73
+ if (input.length) {
74
+ await (await rollup(options)).write(outputOptions);
75
+ }
76
+ return errors.length + warnings.length;
77
+ };
78
+ const packageCompileRollup = async (params) => {
79
+ const config = await loadConfig(params);
80
+ const pkg = await loadPackageConfig();
81
+ const inputDirs = await getInputDirs(config.compile?.depth);
82
+ const verbose = config.verbose;
83
+ const publint = config.compile?.publint;
84
+ const pkgType = pkg.type ?? "commonjs";
85
+ const esmExt = pkgType === "module" ? "js" : "mjs";
86
+ const cjsExt = pkgType === "commonjs" ? "js" : "cjs";
87
+ const result = (await Promise.all(
88
+ inputDirs.map(async (inputDir) => {
89
+ return await compileSubDir("cjs", cjsExt, inputDir, verbose) + await compileSubDir("esm", esmExt, inputDir, verbose);
90
+ })
91
+ )).reduce((prev, result2) => prev + result2, 0);
92
+ return result + (publint ? await packagePublint() : 0);
93
+ };
94
+ export {
95
+ compileSubDir,
96
+ packageCompileRollup
97
+ };
98
+ //# sourceMappingURL=rollup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/rollup.ts"],"sourcesContent":["import commonjs from '@rollup/plugin-commonjs'\nimport json from '@rollup/plugin-json'\nimport typescript from '@rollup/plugin-typescript'\nimport chalk from 'chalk'\nimport { OutputOptions, rollup, RollupLog, RollupOptions } from 'rollup'\nimport externalDeps from 'rollup-plugin-exclude-dependencies-from-bundle'\nimport nodeExternals from 'rollup-plugin-node-externals'\n\nimport { loadConfig } from '../../../lib'\nimport { loadPackageConfig } from '../../../loadPackageConfig'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\n\nexport interface PackageCompileRollupParams extends CompileParams {}\n\nexport const compileSubDir = async (format: 'cjs' | 'esm', ext: string, subDir?: string, _verbose = false) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n const tsPlugIn = typescript({\n baseUrl: 'src',\n declaration: !dir || !subDir,\n declarationMap: !dir || !subDir,\n emitDeclarationOnly: false,\n esModuleInterop: true,\n exclude: ['**/*.spec.*', 'dist', 'docs', 'node_modules', 'packages'],\n outDir: dir ? `dist/${dir}` : 'dist',\n rootDir: 'src',\n tsconfig: 'tsconfig.json',\n })\n\n const errors: RollupLog[] = []\n const warnings: RollupLog[] = []\n const infos: RollupLog[] = []\n const debugs: RollupLog[] = []\n\n const options: RollupOptions = {\n input: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n logLevel: 'warn',\n onLog: (level, log, defaultHandler) => {\n const pushLog = !(log.code === 'EMPTY_BUNDLE' || log.code === 'MIXED_EXPORTS' || log.code === 'UNUSED_EXTERNAL_IMPORT')\n if (pushLog) {\n switch (level) {\n case 'warn': {\n warnings.push(log)\n break\n }\n case 'info': {\n infos.push(log)\n break\n }\n case 'debug': {\n debugs.push(log)\n break\n }\n default: {\n errors.push(log)\n break\n }\n }\n }\n console.log(chalk.yellow(`${level}: ${log.message} [${log.code}]`))\n if (log.id) {\n console.log(chalk.gray(log.id))\n }\n log.ids?.map((id) => {\n console.log(chalk.gray(id))\n })\n return defaultHandler(level, log)\n },\n plugins: [commonjs(), externalDeps(), nodeExternals(), json(), tsPlugIn],\n }\n\n const outputOptions: OutputOptions = {\n dir: subDir ? `dist/${subDir}` : 'dist',\n dynamicImportInCjs: true,\n entryFileNames: (chunkInfo) => `${chunkInfo.name}.${ext}`,\n format,\n sourcemap: true,\n }\n\n if (input.length) {\n await (await rollup(options)).write(outputOptions)\n }\n\n return errors.length + warnings.length\n}\n\nexport const packageCompileRollup = async (params?: PackageCompileRollupParams) => {\n const config = await loadConfig(params)\n const pkg = await loadPackageConfig()\n const inputDirs = await getInputDirs(config.compile?.depth)\n const verbose = config.verbose\n const publint = config.compile?.publint\n\n const pkgType = pkg.type ?? 'commonjs'\n\n const esmExt = pkgType === 'module' ? 'js' : 'mjs'\n const cjsExt = pkgType === 'commonjs' ? 'js' : 'cjs'\n\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return (await compileSubDir('cjs', cjsExt, inputDir, verbose)) + (await compileSubDir('esm', esmExt, inputDir, verbose))\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result + (publint ? await packagePublint() : 0)\n}\n"],"mappings":"AAAA,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,SAAwB,cAAwC;AAChE,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAE/B,SAAS,cAAc,iBAAiB;AAIjC,MAAM,gBAAgB,OAAO,QAAuB,KAAa,QAAiB,WAAW,UAAU;AAC5G,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,MAAM,UAAU,GAAG;AACjC,QAAM,WAAW,WAAW;AAAA,IAC1B,SAAS;AAAA,IACT,aAAa,CAAC,OAAO,CAAC;AAAA,IACtB,gBAAgB,CAAC,OAAO,CAAC;AAAA,IACzB,qBAAqB;AAAA,IACrB,iBAAiB;AAAA,IACjB,SAAS,CAAC,eAAe,QAAQ,QAAQ,gBAAgB,UAAU;AAAA,IACnE,QAAQ,MAAM,QAAQ,GAAG,KAAK;AAAA,IAC9B,SAAS;AAAA,IACT,UAAU;AAAA,EACZ,CAAC;AAED,QAAM,SAAsB,CAAC;AAC7B,QAAM,WAA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Q;AAChB,WAAO,MAAM,OAAO,OAAO,GAAG,MAAM,aAAa;AAAA,EACnD;AAEA,SAAO,OAAO,SAAS,SAAS;AAClC;AAEO,MAAM,uBAAuB,OAAO,WAAwC;AACjF,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,QAAM,MAAM,MAAM,kBAAkB;AACpC,QAAM,YAAY,MAAM,aAAa,OAAO,SAAS,KAAK;AAC1D,QAAM,UAAU,OAAO;AACvB,QAAM,UAAU,OAAO,SAAS;AAEhC,QAAM,UAAU,IAAI,QAAQ;AAE5B,QAAM,SAAS,YAAY,WAAW,OAAO;AAC7C,QAAM,SAAS,YAAY,aAAa,OAAO;AAE/C,QAAM,UACJ,MAAM,QAAQ;AAAA,IACZ,UAAU,IAAI,OAAO,aAAa;AAChC,aAAQ,MAAM,cAAc,OAAO,QAAQ,UAAU,OAAO,IAAM,MAAM,cAAc,OAAO,QAAQ,UAAU,OAAO;AAAA,IACxH,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAMA,YAAW,OAAOA,SAAQ,CAAC;AAC3C,SAAO,UAAU,UAAU,MAAM,eAAe,IAAI;AACtD;","names":["result"]}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var tsc_exports = {};
30
+ __export(tsc_exports, {
31
+ packageCompileTsc: () => packageCompileTsc
32
+ });
33
+ module.exports = __toCommonJS(tsc_exports);
34
+ var import_chalk = __toESM(require("chalk"));
35
+ var import_merge = __toESM(require("lodash/merge"));
36
+ var import_typescript = require("typescript");
37
+ var import_lib = require("../../../lib");
38
+ var import_inputs = require("./inputs");
39
+ const getCompilerOptionsJSONFollowExtends = (filename) => {
40
+ let opts = {};
41
+ const config = (0, import_typescript.readConfigFile)(filename, import_typescript.sys.readFile).config;
42
+ if (config.extends) {
43
+ const requirePath = require.resolve(config.extends);
44
+ opts = getCompilerOptionsJSONFollowExtends(requirePath);
45
+ }
46
+ if (config?.error) {
47
+ throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`);
48
+ }
49
+ return { ...opts, ...config.compilerOptions };
50
+ };
51
+ const getCompilerOptions = (options, tsconfig = "tsconfig.json") => {
52
+ const configFileName = (0, import_typescript.findConfigFile)("./", import_typescript.sys.fileExists, tsconfig);
53
+ const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
54
+ return (0, import_merge.default)({}, configFileCompilerOptions, options);
55
+ };
56
+ const getConfigFile = (options, tsconfig = "tsconfig.json") => {
57
+ const configFileName = (0, import_typescript.findConfigFile)("./", import_typescript.sys.fileExists, tsconfig);
58
+ return { ...configFileName ? (0, import_typescript.readConfigFile)(configFileName, import_typescript.sys.readFile).config : {}, compilerOptions: getCompilerOptions(options) };
59
+ };
60
+ const compile = (fileNames, options) => {
61
+ console.log(import_chalk.default.blue("compile"));
62
+ console.log(import_chalk.default.magenta(`options: ${JSON.stringify(options, null, 2)}`));
63
+ const program = (0, import_typescript.createProgram)(fileNames, options);
64
+ console.log(import_chalk.default.blue("createProgram"));
65
+ const emitResult = program.emit();
66
+ console.log(import_chalk.default.blue("emit"));
67
+ const allDiagnostics = (0, import_typescript.getPreEmitDiagnostics)(program).concat(emitResult.diagnostics);
68
+ const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1);
69
+ allDiagnostics.forEach((diagnostic) => {
70
+ if (diagnostic.file) {
71
+ const { line, character } = (0, import_typescript.getLineAndCharacterOfPosition)(diagnostic.file, diagnostic.start);
72
+ const message = (0, import_typescript.flattenDiagnosticMessageText)(diagnostic.messageText, "\n");
73
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
74
+ } else {
75
+ console.log((0, import_typescript.flattenDiagnosticMessageText)(diagnostic.messageText, "\n"));
76
+ }
77
+ });
78
+ if (errorDiagnostics.length) {
79
+ console.log(import_chalk.default.red(`Errors: ${errorDiagnostics.length}`));
80
+ process.exit(errorDiagnostics.length);
81
+ }
82
+ return errorDiagnostics.length;
83
+ };
84
+ const packageCompileTsc = async (params) => {
85
+ const defaultCompilerOptions = {
86
+ declaration: true,
87
+ declarationMap: true,
88
+ outDir: "dist",
89
+ rootDir: "src",
90
+ sourceMap: true
91
+ };
92
+ const compilerOptions = (0, import_merge.default)({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions);
93
+ const config = await (0, import_lib.loadConfig)(params);
94
+ if (config.verbose) {
95
+ console.log("Compiling with TSC");
96
+ }
97
+ const fileNames = (await (0, import_inputs.getAllInputs)(config.compile?.depth)).map((fileName) => `src/${fileName}`);
98
+ const configFile = getConfigFile(compilerOptions);
99
+ return compile(fileNames, configFile.compilerOptions);
100
+ };
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ packageCompileTsc
104
+ });
105
+ //# sourceMappingURL=tsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\nimport {\n CompilerOptions,\n createProgram,\n Diagnostic,\n findConfigFile,\n flattenDiagnosticMessageText,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n readConfigFile,\n sys,\n} from 'typescript'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs } from './inputs'\n\nexport type PackageCompileTscParams = Partial<\n CompileParams & {\n compile?: {\n tsc?: {\n compilerOptions?: CompilerOptions\n tsconfig?: string\n }\n }\n }\n>\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n let opts = {}\n const config = readConfigFile(filename, sys.readFile).config\n if (config.extends) {\n const requirePath = require.resolve(config.extends)\n opts = getCompilerOptionsJSONFollowExtends(requirePath)\n }\n if (config?.error) {\n throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`)\n }\n\n return { ...opts, ...config.compilerOptions }\n}\n\nconst getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n\nconst getConfigFile = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json') => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n return { ...(configFileName ? readConfigFile(configFileName, sys.readFile).config : {}), compilerOptions: getCompilerOptions(options) }\n}\n\nconst compile = (fileNames: string[], options: CompilerOptions) => {\n console.log(chalk.blue('compile'))\n console.log(chalk.magenta(`options: ${JSON.stringify(options, null, 2)}`))\n const program = createProgram(fileNames, options)\n console.log(chalk.blue('createProgram'))\n const emitResult = program.emit()\n console.log(chalk.blue('emit'))\n\n const allDiagnostics: Diagnostic[] = getPreEmitDiagnostics(program).concat(emitResult.diagnostics)\n\n const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1)\n\n allDiagnostics.forEach((diagnostic) => {\n if (diagnostic.file) {\n const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!)\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`)\n } else {\n console.log(flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n }\n })\n\n if (errorDiagnostics.length) {\n console.log(chalk.red(`Errors: ${errorDiagnostics.length}`))\n process.exit(errorDiagnostics.length)\n }\n\n return errorDiagnostics.length\n}\n\nexport const packageCompileTsc = async (params?: PackageCompileTscParams): Promise<number> => {\n const defaultCompilerOptions: CompilerOptions = {\n declaration: true,\n declarationMap: true,\n outDir: 'dist',\n rootDir: 'src',\n sourceMap: true,\n }\n const compilerOptions = merge({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions)\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSC')\n }\n\n const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`)\n const configFile = getConfigFile(compilerOptions)\n return compile(fileNames, configFile.compilerOptions)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAClB,wBAUO;AAEP,iBAA2B;AAE3B,oBAA6B;AAc7B,MAAM,sCAAsC,CAAC,aAAsC;AACjF,MAAI,OAAO,CAAC;AACZ,QAAM,aAAS,kCAAe,UAAU,sBAAI,QAAQ,EAAE;AACtD,MA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,WAAW,MAAM;AACnB,YAAM,EAAE,MAAM,UAAU,QAAI,iDAA8B,WAAW,MAAM,WAAW,KAAM;AAC5F,YAAM,cAAU,gDAA6B,WAAW,aAAa,IAAI;AACzE,cAAQ,IAAI,GAAG,WAAW,KAAK,QAAQ,KAAK,OAAO,CAAC,IAAI,YAAY,CAAC,MAAM,OAAO,EAAE;AAAA,IACtF,OAAO;AACL,cAAQ,QAAI,gDAA6B,WAAW,aAAa,IAAI,CAAC;AAAA,IACxE;AAAA,EACF,CAAC;AAED,MAAI,iBAAiB,QAAQ;AAC3B,YAAQ,IAAI,aAAAA,QAAM,IAAI,WAAW,iBAAiB,MAAM,EAAE,CAAC;AAC3D,YAAQ,KAAK,iBAAiB,MAAM;AAAA,EACtC;AAEA,SAAO,iBAAiB;AAC1B;AAEO,MAAM,oBAAoB,OAAO,WAAsD;AAC5F,QAAM,yBAA0C;AAAA,IAC9C,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACA,QAAM,sBAAkB,aAAAD,SAAM,CAAC,GAAG,wBAAwB,QAAQ,SAAS,KAAK,eAAe;AAC/F,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,oBAAoB;AAAA,EAClC;AAEA,QAAM,aAAa,UAAM,4BAAa,OAAO,SAAS,KAAK,GAAG,IAAI,CAAC,aAAa,OAAO,QAAQ,EAAE;AACjG,QAAM,aAAa,cAAc,eAAe;AAChD,SAAO,QAAQ,WAAW,WAAW,eAAe;AACtD;","names":["merge","chalk"]}
@@ -0,0 +1,79 @@
1
+ import chalk from "chalk";
2
+ import merge from "lodash/merge";
3
+ import {
4
+ createProgram,
5
+ findConfigFile,
6
+ flattenDiagnosticMessageText,
7
+ getLineAndCharacterOfPosition,
8
+ getPreEmitDiagnostics,
9
+ readConfigFile,
10
+ sys
11
+ } from "typescript";
12
+ import { loadConfig } from "../../../lib";
13
+ import { getAllInputs } from "./inputs";
14
+ const getCompilerOptionsJSONFollowExtends = (filename) => {
15
+ let opts = {};
16
+ const config = readConfigFile(filename, sys.readFile).config;
17
+ if (config.extends) {
18
+ const requirePath = require.resolve(config.extends);
19
+ opts = getCompilerOptionsJSONFollowExtends(requirePath);
20
+ }
21
+ if (config?.error) {
22
+ throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`);
23
+ }
24
+ return { ...opts, ...config.compilerOptions };
25
+ };
26
+ const getCompilerOptions = (options, tsconfig = "tsconfig.json") => {
27
+ const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
28
+ const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
29
+ return merge({}, configFileCompilerOptions, options);
30
+ };
31
+ const getConfigFile = (options, tsconfig = "tsconfig.json") => {
32
+ const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
33
+ return { ...configFileName ? readConfigFile(configFileName, sys.readFile).config : {}, compilerOptions: getCompilerOptions(options) };
34
+ };
35
+ const compile = (fileNames, options) => {
36
+ console.log(chalk.blue("compile"));
37
+ console.log(chalk.magenta(`options: ${JSON.stringify(options, null, 2)}`));
38
+ const program = createProgram(fileNames, options);
39
+ console.log(chalk.blue("createProgram"));
40
+ const emitResult = program.emit();
41
+ console.log(chalk.blue("emit"));
42
+ const allDiagnostics = getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
43
+ const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1);
44
+ allDiagnostics.forEach((diagnostic) => {
45
+ if (diagnostic.file) {
46
+ const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
47
+ const message = flattenDiagnosticMessageText(diagnostic.messageText, "\n");
48
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
49
+ } else {
50
+ console.log(flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
51
+ }
52
+ });
53
+ if (errorDiagnostics.length) {
54
+ console.log(chalk.red(`Errors: ${errorDiagnostics.length}`));
55
+ process.exit(errorDiagnostics.length);
56
+ }
57
+ return errorDiagnostics.length;
58
+ };
59
+ const packageCompileTsc = async (params) => {
60
+ const defaultCompilerOptions = {
61
+ declaration: true,
62
+ declarationMap: true,
63
+ outDir: "dist",
64
+ rootDir: "src",
65
+ sourceMap: true
66
+ };
67
+ const compilerOptions = merge({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions);
68
+ const config = await loadConfig(params);
69
+ if (config.verbose) {
70
+ console.log("Compiling with TSC");
71
+ }
72
+ const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`);
73
+ const configFile = getConfigFile(compilerOptions);
74
+ return compile(fileNames, configFile.compilerOptions);
75
+ };
76
+ export {
77
+ packageCompileTsc
78
+ };
79
+ //# sourceMappingURL=tsc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\nimport {\n CompilerOptions,\n createProgram,\n Diagnostic,\n findConfigFile,\n flattenDiagnosticMessageText,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n readConfigFile,\n sys,\n} from 'typescript'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs } from './inputs'\n\nexport type PackageCompileTscParams = Partial<\n CompileParams & {\n compile?: {\n tsc?: {\n compilerOptions?: CompilerOptions\n tsconfig?: string\n }\n }\n }\n>\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n let opts = {}\n const config = readConfigFile(filename, sys.readFile).config\n if (config.extends) {\n const requirePath = require.resolve(config.extends)\n opts = getCompilerOptionsJSONFollowExtends(requirePath)\n }\n if (config?.error) {\n throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`)\n }\n\n return { ...opts, ...config.compilerOptions }\n}\n\nconst getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n\nconst getConfigFile = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json') => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n return { ...(configFileName ? readConfigFile(configFileName, sys.readFile).config : {}), compilerOptions: getCompilerOptions(options) }\n}\n\nconst compile = (fileNames: string[], options: CompilerOptions) => {\n console.log(chalk.blue('compile'))\n console.log(chalk.magenta(`options: ${JSON.stringify(options, null, 2)}`))\n const program = createProgram(fileNames, options)\n console.log(chalk.blue('createProgram'))\n const emitResult = program.emit()\n console.log(chalk.blue('emit'))\n\n const allDiagnostics: Diagnostic[] = getPreEmitDiagnostics(program).concat(emitResult.diagnostics)\n\n const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1)\n\n allDiagnostics.forEach((diagnostic) => {\n if (diagnostic.file) {\n const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!)\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`)\n } else {\n console.log(flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n }\n })\n\n if (errorDiagnostics.length) {\n console.log(chalk.red(`Errors: ${errorDiagnostics.length}`))\n process.exit(errorDiagnostics.length)\n }\n\n return errorDiagnostics.length\n}\n\nexport const packageCompileTsc = async (params?: PackageCompileTscParams): Promise<number> => {\n const defaultCompilerOptions: CompilerOptions = {\n declaration: true,\n declarationMap: true,\n outDir: 'dist',\n rootDir: 'src',\n sourceMap: true,\n }\n const compilerOptions = merge({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions)\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSC')\n }\n\n const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`)\n const configFile = getConfigFile(compilerOptions)\n return compile(fileNames, configFile.compilerOptions)\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAElB,OAAO,WAAW;AAClB;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAc7B,MAAM,sCAAsC,CAAC,aAAsC;AACjF,MAAI,OAAO,CAAC;AACZ,QAAM,SAAS,eAAe,UAAU,IAAI,QAAQ,EAAE;AACtD,MAAI,OAAO,SAAS;AAClB,UAAM,cAAc,QAAQ,QAAQ,OAAO,OAAO;AAClD,WAAO,oCAAoC,WAAW;AAAA,EACxD;AACA,MAAI,QAAQ,OAAO;AACjB,UAAM,MAAM,8CAA8C,KAAK,UAAU,QAAQ,OAAO,aAAa,MAAM,CAAC,CAAC,EAAE;AAAA,EACjH;AAEA,SAAO,EAAE,GAAG,MAAM,GAAG,OAAO,gBAAgB;AAC9C;AAEA,MAAM,qBAAqB,CAAC,SAA2B,WAAmB,oBAAqC;AAC7G,QAAM,iBAAiB,eAAe,MAAM,IAAI,YAAY,QAAQ;AACpE,QAAM,4BAA4B,iBAAiB,oCAAoC,cAAc,IAAI;AAEzG,SAAO,MAAM,CAAC,GAAG,2BAA2B,OAAO;AACrD;AAEA,MAAM,gBAAgB,CAAC,SAA2B,WAAmB,oBAAoB;AACvF,QAAM,iBAAiB,eAAe,MAAM,IAAI,YAAY,QAAQ;AACpE,SAAO,EAAE,GAAI,iBAAiB,eAAe,gBAAgB,IAAI,QAAQ,EAAE,SAAS,CAAC,GAAI,iBAAiB,mBAAmB,OAAO,EAAE;AACxI;AAEA,MAAM,UAAU,CAAC,WAAqB,YAA6B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AAClB,YAAQ,IAAI,oBAAoB;AAAA,EAClC;AAEA,QAAM,aAAa,MAAM,aAAa,OAAO,SAAS,KAAK,GAAG,IAAI,CAAC,aAAa,OAAO,QAAQ,EAAE;AACjG,QAAM,aAAa,cAAc,eAAe;AAChD,SAAO,QAAQ,WAAW,WAAW,eAAe;AACtD;","names":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tscTypes_exports = {};
20
+ __export(tscTypes_exports, {
21
+ packageCompileTscTypes: () => packageCompileTscTypes
22
+ });
23
+ module.exports = __toCommonJS(tscTypes_exports);
24
+ var import_process = require("process");
25
+ var import_tsc_prog = require("tsc-prog");
26
+ var import_lib = require("../../../lib");
27
+ const packageCompileTscTypes = async (params) => {
28
+ const pkg = process.env.INIT_CWD;
29
+ const buildOptions = {
30
+ basePath: pkg ?? (0, import_process.cwd)(),
31
+ compilerOptions: {
32
+ declaration: true,
33
+ declarationMap: true,
34
+ emitDeclarationOnly: true,
35
+ esModuleInterop: true,
36
+ outDir: "dist",
37
+ sourceMap: true
38
+ },
39
+ exclude: ["dist", "docs"],
40
+ include: ["src"]
41
+ };
42
+ const config = await (0, import_lib.loadConfig)(params);
43
+ if (config.verbose) {
44
+ console.log(`Compiling types with TSC [${pkg}]`);
45
+ }
46
+ (0, import_tsc_prog.build)(buildOptions);
47
+ return 0;
48
+ };
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ packageCompileTscTypes
52
+ });
53
+ //# sourceMappingURL=tscTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { build, BuildOptions } from 'tsc-prog'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\n\nexport const packageCompileTscTypes = async (params?: CompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const buildOptions: BuildOptions = {\n basePath: pkg ?? cwd(),\n compilerOptions: {\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n sourceMap: true,\n },\n exclude: ['dist', 'docs'],\n include: ['src'],\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n build(buildOptions)\n return 0\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAoC;AAEpC,iBAA2B;AAGpB,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,WAAO,oBAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,SAAS,CAAC,QAAQ,MAAM;AAAA,IACxB,SAAS,CAAC,KAAK;AAAA,EACjB;AAEA,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,6BAAM,YAAY;AAClB,SAAO;AACT;","names":[]}
@@ -0,0 +1,29 @@
1
+ import { cwd } from "process";
2
+ import { build } from "tsc-prog";
3
+ import { loadConfig } from "../../../lib";
4
+ const packageCompileTscTypes = async (params) => {
5
+ const pkg = process.env.INIT_CWD;
6
+ const buildOptions = {
7
+ basePath: pkg ?? cwd(),
8
+ compilerOptions: {
9
+ declaration: true,
10
+ declarationMap: true,
11
+ emitDeclarationOnly: true,
12
+ esModuleInterop: true,
13
+ outDir: "dist",
14
+ sourceMap: true
15
+ },
16
+ exclude: ["dist", "docs"],
17
+ include: ["src"]
18
+ };
19
+ const config = await loadConfig(params);
20
+ if (config.verbose) {
21
+ console.log(`Compiling types with TSC [${pkg}]`);
22
+ }
23
+ build(buildOptions);
24
+ return 0;
25
+ };
26
+ export {
27
+ packageCompileTscTypes
28
+ };
29
+ //# sourceMappingURL=tscTypes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { build, BuildOptions } from 'tsc-prog'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\n\nexport const packageCompileTscTypes = async (params?: CompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const buildOptions: BuildOptions = {\n basePath: pkg ?? cwd(),\n compilerOptions: {\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n sourceMap: true,\n },\n exclude: ['dist', 'docs'],\n include: ['src'],\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n build(buildOptions)\n return 0\n}\n"],"mappings":"AAAA,SAAS,WAAW;AACpB,SAAS,aAA2B;AAEpC,SAAS,kBAAkB;AAGpB,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,OAAO,IAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,SAAS,CAAC,QAAQ,MAAM;AAAA,IACxB,SAAS,CAAC,KAAK;AAAA,EACjB;AAEA,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,YAAY;AAClB,SAAO;AACT;","names":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tsup_exports = {};
20
+ __export(tsup_exports, {
21
+ packageCompileTsup: () => packageCompileTsup
22
+ });
23
+ module.exports = __toCommonJS(tsup_exports);
24
+ var import_tsup = require("tsup");
25
+ var import_lib = require("../../../lib");
26
+ var import_publint = require("../publint");
27
+ var import_inputs = require("./inputs");
28
+ var import_tscTypes = require("./tscTypes");
29
+ const compileSubDir = async (subDir, options, verbose) => {
30
+ const dir = subDir === "." ? void 0 : subDir;
31
+ const input = await (0, import_inputs.getInputs)(dir);
32
+ const optionsResult = (0, import_tsup.defineConfig)({
33
+ bundle: true,
34
+ cjsInterop: true,
35
+ clean: true,
36
+ dts: {
37
+ entry: ["src/index.ts"],
38
+ only: false,
39
+ resolve: false
40
+ },
41
+ entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
42
+ format: ["cjs", "esm"],
43
+ outDir: "dist",
44
+ sourcemap: true,
45
+ splitting: false,
46
+ tsconfig: "tsconfig.json",
47
+ ...options
48
+ });
49
+ const optionsList = (await Promise.all(
50
+ (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).map(async (options2) => {
51
+ const result = typeof options2 === "function" ? await options2({}) : [options2];
52
+ return Array.isArray(result) ? result : [result];
53
+ }).flat()
54
+ )).flat();
55
+ await Promise.all(optionsList.map((options2) => (0, import_tsup.build)(options2)));
56
+ return await (0, import_tscTypes.packageCompileTscTypes)({ verbose });
57
+ };
58
+ const packageCompileTsup = async (params) => {
59
+ const config = await (0, import_lib.loadConfig)(params);
60
+ if (config.verbose) {
61
+ console.log("Compiling with TSUP");
62
+ }
63
+ const inputDirs = await (0, import_inputs.getInputDirs)(config.compile?.depth);
64
+ const result = (await Promise.all(
65
+ inputDirs.map(async (inputDir) => {
66
+ return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose);
67
+ })
68
+ )).reduce((prev, result2) => prev + result2, 0);
69
+ return result + (config.compile?.publint ? await (0, import_publint.packagePublint)() : 0);
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ packageCompileTsup
74
+ });
75
+ //# sourceMappingURL=tsup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: {\n entry: ['src/index.ts'],\n only: false,\n resolve: false,\n },\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return await packageCompileTscTypes({ verbose })\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAE7C,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAAwC;AACxC,sBAAuC;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,YAAsB;AACrF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,UAAM,yBAAU,GAAG;AACjC,QAAM,oBAAgB,0BAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO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,0 +1,51 @@
1
+ import { build, defineConfig } from "tsup";
2
+ import { loadConfig } from "../../../lib";
3
+ import { packagePublint } from "../publint";
4
+ import { getInputDirs, getInputs } from "./inputs";
5
+ import { packageCompileTscTypes } from "./tscTypes";
6
+ const compileSubDir = async (subDir, options, verbose) => {
7
+ const dir = subDir === "." ? void 0 : subDir;
8
+ const input = await getInputs(dir);
9
+ const optionsResult = defineConfig({
10
+ bundle: true,
11
+ cjsInterop: true,
12
+ clean: true,
13
+ dts: {
14
+ entry: ["src/index.ts"],
15
+ only: false,
16
+ resolve: false
17
+ },
18
+ entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
19
+ format: ["cjs", "esm"],
20
+ outDir: "dist",
21
+ sourcemap: true,
22
+ splitting: false,
23
+ tsconfig: "tsconfig.json",
24
+ ...options
25
+ });
26
+ const optionsList = (await Promise.all(
27
+ (Array.isArray(optionsResult) ? optionsResult : [optionsResult]).map(async (options2) => {
28
+ const result = typeof options2 === "function" ? await options2({}) : [options2];
29
+ return Array.isArray(result) ? result : [result];
30
+ }).flat()
31
+ )).flat();
32
+ await Promise.all(optionsList.map((options2) => build(options2)));
33
+ return await packageCompileTscTypes({ verbose });
34
+ };
35
+ const packageCompileTsup = async (params) => {
36
+ const config = await loadConfig(params);
37
+ if (config.verbose) {
38
+ console.log("Compiling with TSUP");
39
+ }
40
+ const inputDirs = await getInputDirs(config.compile?.depth);
41
+ const result = (await Promise.all(
42
+ inputDirs.map(async (inputDir) => {
43
+ return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose);
44
+ })
45
+ )).reduce((prev, result2) => prev + result2, 0);
46
+ return result + (config.compile?.publint ? await packagePublint() : 0);
47
+ };
48
+ export {
49
+ packageCompileTsup
50
+ };
51
+ //# sourceMappingURL=tsup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: {\n entry: ['src/index.ts'],\n only: false,\n resolve: false,\n },\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return await packageCompileTscTypes({ verbose })\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,cAAc,iBAAiB;AACxC,SAAS,8BAA8B;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,YAAsB;AACrF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,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AOA,SAAQ,CAAC;AAC3C,SAAO,UAAU,OAAO,SAAS,UAAU,MAAM,eAAe,IAAI;AACtE;","names":["options","result"]}
@@ -33,7 +33,7 @@ __export(publint_exports, {
33
33
  module.exports = __toCommonJS(publint_exports);
34
34
  var import_chalk = __toESM(require("chalk"));
35
35
  var import_fs = require("fs");
36
- const packagePublint = async () => {
36
+ const packagePublint = async (_params) => {
37
37
  const pkgDir = process.env.INIT_CWD;
38
38
  const pkg = JSON.parse(await import_fs.promises.readFile(`${pkgDir}/package.json`, "utf8"));
39
39
  const { publint } = await import("publint");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport const packagePublint = async () => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,gBAA+B;AAGxB,MAAM,iBAAiB,YAAY;AACxC,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,UAAAA,SAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,aAAAC,QAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,aAAAA,QAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,aAAAA,QAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":["fs","chalk"]}
1
+ {"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (_params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,gBAA+B;AAOxB,MAAM,iBAAiB,OAAO,YAAmC;AACtE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,UAAAA,SAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,aAAAC,QAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,aAAAA,QAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,aAAAA,QAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":["fs","chalk"]}
@@ -1,6 +1,6 @@
1
1
  import chalk from "chalk";
2
2
  import { promises as fs } from "fs";
3
- const packagePublint = async () => {
3
+ const packagePublint = async (_params) => {
4
4
  const pkgDir = process.env.INIT_CWD;
5
5
  const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
6
6
  const { publint } = await import("publint");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport const packagePublint = async () => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,YAAY,UAAU;AAGxB,MAAM,iBAAiB,YAAY;AACxC,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,MAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,MAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,MAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":[]}
1
+ {"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (_params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,YAAY,UAAU;AAOxB,MAAM,iBAAiB,OAAO,YAAmC;AACtE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,MAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,MAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,MAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":[]}