@xylabs/ts-scripts-yarn3 3.0.10 → 3.0.12

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 (73) 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 +86 -0
  6. package/dist/actions/package/compile/compile.js.map +1 -0
  7. package/dist/actions/package/compile/compile.mjs +52 -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} +26 -76
  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 +114 -0
  26. package/dist/actions/package/compile/tsc.js.map +1 -0
  27. package/dist/actions/package/compile/tsc.mjs +80 -0
  28. package/dist/actions/package/compile/tsc.mjs.map +1 -0
  29. package/dist/actions/package/compile/tscTypes.js +55 -0
  30. package/dist/actions/package/compile/tscTypes.js.map +1 -0
  31. package/dist/actions/package/compile/tscTypes.mjs +31 -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 +3 -1
  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 +6 -6
  56. package/src/actions/package/compile/CompileParams.ts +10 -0
  57. package/src/actions/package/compile/compile.ts +59 -0
  58. package/src/actions/package/compile/copyTypeFiles.ts +27 -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 +108 -0
  62. package/src/actions/package/compile/tsc.ts +100 -0
  63. package/src/actions/package/compile/tscTypes.ts +32 -0
  64. package/src/actions/package/compile/tsup.ts +64 -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 +19 -0
  69. package/tsconfig.json +1 -7
  70. package/dist/actions/package/compile.js.map +0 -1
  71. package/dist/actions/package/compile.mjs +0 -149
  72. package/dist/actions/package/compile.mjs.map +0 -1
  73. package/src/actions/package/compile.ts +0 -176
@@ -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 { getInputDirs, getInputs } from "./inputs";
9
+ import { packagePublint } from "../publint";
10
+ import { loadPackageConfig } from "../../../loadPackageConfig";
11
+ import { loadConfig } from "../../../lib";
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'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packagePublint } from '../publint'\nimport { loadPackageConfig } from '../../../loadPackageConfig'\nimport { CompileParams } from './CompileParams'\nimport { loadConfig } from '../../../lib'\n\nexport interface PackageCompileRollupParams extends CompileParams {\n\n}\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 = (await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir('cjs', cjsExt, inputDir, verbose) + await compileSubDir('esm', esmExt, inputDir, verbose)\n }),\n )).reduce(((prev, result) => prev + result), 0)\n return result + (publint ? await packagePublint() : 0)\n}"],"mappings":"AAAA,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,SAAwB,cAAwC;AAChE,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,cAAc,iBAAiB;AACxC,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAElC,SAAS,kBAAkB;AAMpB,MAAM,gBAAgB,OAAO,QAAuB,KAAa,QAAiB,UAAU,UAAU;AAC3G,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,WAAwB,CAAC;AAC/B,QAAM,QAAqB,CAAC;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AG,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,UAAU,MAAM,QAAQ;AAAA,IAC5B,UAAU,IAAI,OAAO,aAAa;AAChC,aAAO,MAAM,cAAc,OAAO,QAAQ,UAAU,OAAO,IAAI,MAAM,cAAc,OAAO,QAAQ,UAAU,OAAO;AAAA,IACrH,CAAC;AAAA,EACH,GAAG,OAAQ,CAAC,MAAMA,YAAW,OAAOA,SAAS,CAAC;AAC9C,SAAO,UAAU,UAAU,MAAM,eAAe,IAAI;AACtD;","names":["result"]}
@@ -0,0 +1,114 @@
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_typescript = __toESM(require("typescript"));
35
+ var import_lib = require("../../../lib");
36
+ var import_inputs = require("./inputs");
37
+ var import_merge = __toESM(require("lodash/merge"));
38
+ var import_chalk = __toESM(require("chalk"));
39
+ const getCompilerOptionsJSONFollowExtends = (filename) => {
40
+ let opts = {};
41
+ const config = (0, import_typescript.readConfigFile)(filename, import_typescript.default.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 config.compilerOptions;
50
+ };
51
+ const getCompilerOptions = (options, tsconfig = "tsconfig.json") => {
52
+ const configFileName = (0, import_typescript.findConfigFile)(
53
+ "./",
54
+ import_typescript.default.sys.fileExists,
55
+ tsconfig
56
+ );
57
+ const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
58
+ return (0, import_merge.default)({}, configFileCompilerOptions, options);
59
+ };
60
+ const getConfigFile = (options, tsconfig = "tsconfig.json") => {
61
+ const configFileName = (0, import_typescript.findConfigFile)(
62
+ "./",
63
+ import_typescript.default.sys.fileExists,
64
+ tsconfig
65
+ );
66
+ return { ...configFileName ? (0, import_typescript.readConfigFile)(configFileName, import_typescript.sys.readFile).config : {}, compilerOptions: getCompilerOptions(options) };
67
+ };
68
+ const compile = (fileNames, optionsParam) => {
69
+ console.log(import_chalk.default.blue(`compile`));
70
+ const { moduleResolution, ...options } = optionsParam;
71
+ console.log(import_chalk.default.magenta(`options: ${JSON.stringify(options, null, 2)}`));
72
+ const program = (0, import_typescript.createProgram)(fileNames, options);
73
+ console.log(import_chalk.default.blue(`createProgram`));
74
+ const emitResult = program.emit();
75
+ console.log(import_chalk.default.blue(`emit`));
76
+ const allDiagnostics = (0, import_typescript.getPreEmitDiagnostics)(program).concat(emitResult.diagnostics);
77
+ const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1);
78
+ allDiagnostics.forEach((diagnostic) => {
79
+ if (diagnostic.file) {
80
+ let { line, character } = (0, import_typescript.getLineAndCharacterOfPosition)(diagnostic.file, diagnostic.start);
81
+ let message = (0, import_typescript.flattenDiagnosticMessageText)(diagnostic.messageText, "\n");
82
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
83
+ } else {
84
+ console.log((0, import_typescript.flattenDiagnosticMessageText)(diagnostic.messageText, "\n"));
85
+ }
86
+ });
87
+ if (errorDiagnostics.length) {
88
+ console.log(import_chalk.default.red(`Errors: ${errorDiagnostics.length}`));
89
+ process.exit(errorDiagnostics.length);
90
+ }
91
+ return errorDiagnostics.length;
92
+ };
93
+ const packageCompileTsc = async (params) => {
94
+ const defaultCompilerOptions = {
95
+ sourceMap: true,
96
+ declaration: true,
97
+ declarationMap: true,
98
+ rootDir: "src",
99
+ outDir: "dist"
100
+ };
101
+ const compilerOptions = (0, import_merge.default)({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions);
102
+ const config = await (0, import_lib.loadConfig)(params);
103
+ if (config.verbose) {
104
+ console.log(`Compiling with TSC`);
105
+ }
106
+ const fileNames = (await (0, import_inputs.getAllInputs)(config.compile?.depth)).map((fileName) => `src/${fileName}`);
107
+ const configFile = getConfigFile(compilerOptions);
108
+ return compile(fileNames, configFile.compilerOptions);
109
+ };
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ packageCompileTsc
113
+ });
114
+ //# sourceMappingURL=tsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import ts, { CompilerOptions, readConfigFile, sys, getPreEmitDiagnostics, parseJsonConfigFileContent, getLineAndCharacterOfPosition, flattenDiagnosticMessageText, createProgram, convertCompilerOptionsFromJson, Diagnostic, findConfigFile } from \"typescript\"\nimport { CompileParams } from \"./CompileParams\"\nimport { loadConfig } from \"../../../lib\"\nimport { getAllInputs } from \"./inputs\"\nimport merge from 'lodash/merge'\nimport chalk from \"chalk\"\n\nexport type PackageCompileTscParams = Partial<CompileParams & {\n compile?: {\n tsc?: {\n tsconfig?: string\n compilerOptions?: CompilerOptions\n }\n }\n}>\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): Record<string, any> => {\n let opts = {};\n const config = readConfigFile(filename, ts.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 config.compilerOptions\n}\n\nconst getCompilerOptions = (options?: CompilerOptions, tsconfig: string = \"tsconfig.json\"): CompilerOptions => {\n const configFileName = findConfigFile(\n \"./\",\n ts.sys.fileExists,\n tsconfig\n )\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(\n \"./\",\n ts.sys.fileExists,\n tsconfig\n )\n return {...(configFileName ? readConfigFile(configFileName, sys.readFile).config : {}), compilerOptions: getCompilerOptions(options)}\n}\n\nconst compile = (fileNames: string[], optionsParam: CompilerOptions) => {\n console.log(chalk.blue(`compile`))\n const {moduleResolution, ...options} = optionsParam\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)\n .concat(emitResult.diagnostics)\n\n const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1)\n\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n let { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!)\n let 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 sourceMap: true,\n declaration: true,\n declarationMap: true,\n rootDir: 'src',\n outDir: 'dist',\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}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAoP;AAEpP,iBAA2B;AAC3B,oBAA6B;AAC7B,mBAAkB;AAClB,mBAAkB;AAWlB,MAAM,sCAAsC,CAAC,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, sys, getPreEmitDiagnostics, getLineAndCharacterOfPosition, flattenDiagnosticMessageText, createProgram, findConfigFile } from "typescript";
2
+ import { loadConfig } from "../../../lib";
3
+ import { getAllInputs } from "./inputs";
4
+ import merge from "lodash/merge";
5
+ import chalk from "chalk";
6
+ const getCompilerOptionsJSONFollowExtends = (filename) => {
7
+ let opts = {};
8
+ const config = readConfigFile(filename, ts.sys.readFile).config;
9
+ if (config.extends) {
10
+ const requirePath = require.resolve(config.extends);
11
+ opts = getCompilerOptionsJSONFollowExtends(requirePath);
12
+ }
13
+ if (config?.error) {
14
+ throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`);
15
+ }
16
+ return config.compilerOptions;
17
+ };
18
+ const getCompilerOptions = (options, tsconfig = "tsconfig.json") => {
19
+ const configFileName = findConfigFile(
20
+ "./",
21
+ ts.sys.fileExists,
22
+ tsconfig
23
+ );
24
+ const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
25
+ return merge({}, configFileCompilerOptions, options);
26
+ };
27
+ const getConfigFile = (options, tsconfig = "tsconfig.json") => {
28
+ const configFileName = findConfigFile(
29
+ "./",
30
+ ts.sys.fileExists,
31
+ tsconfig
32
+ );
33
+ return { ...configFileName ? readConfigFile(configFileName, sys.readFile).config : {}, compilerOptions: getCompilerOptions(options) };
34
+ };
35
+ const compile = (fileNames, optionsParam) => {
36
+ console.log(chalk.blue(`compile`));
37
+ const { moduleResolution, ...options } = optionsParam;
38
+ console.log(chalk.magenta(`options: ${JSON.stringify(options, null, 2)}`));
39
+ const program = createProgram(fileNames, options);
40
+ console.log(chalk.blue(`createProgram`));
41
+ const emitResult = program.emit();
42
+ console.log(chalk.blue(`emit`));
43
+ const allDiagnostics = getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
44
+ const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1);
45
+ allDiagnostics.forEach((diagnostic) => {
46
+ if (diagnostic.file) {
47
+ let { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
48
+ let message = flattenDiagnosticMessageText(diagnostic.messageText, "\n");
49
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
50
+ } else {
51
+ console.log(flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
52
+ }
53
+ });
54
+ if (errorDiagnostics.length) {
55
+ console.log(chalk.red(`Errors: ${errorDiagnostics.length}`));
56
+ process.exit(errorDiagnostics.length);
57
+ }
58
+ return errorDiagnostics.length;
59
+ };
60
+ const packageCompileTsc = async (params) => {
61
+ const defaultCompilerOptions = {
62
+ sourceMap: true,
63
+ declaration: true,
64
+ declarationMap: true,
65
+ rootDir: "src",
66
+ outDir: "dist"
67
+ };
68
+ const compilerOptions = merge({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions);
69
+ const config = await loadConfig(params);
70
+ if (config.verbose) {
71
+ console.log(`Compiling with TSC`);
72
+ }
73
+ const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`);
74
+ const configFile = getConfigFile(compilerOptions);
75
+ return compile(fileNames, configFile.compilerOptions);
76
+ };
77
+ export {
78
+ packageCompileTsc
79
+ };
80
+ //# sourceMappingURL=tsc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import ts, { CompilerOptions, readConfigFile, sys, getPreEmitDiagnostics, parseJsonConfigFileContent, getLineAndCharacterOfPosition, flattenDiagnosticMessageText, createProgram, convertCompilerOptionsFromJson, Diagnostic, findConfigFile } from \"typescript\"\nimport { CompileParams } from \"./CompileParams\"\nimport { loadConfig } from \"../../../lib\"\nimport { getAllInputs } from \"./inputs\"\nimport merge from 'lodash/merge'\nimport chalk from \"chalk\"\n\nexport type PackageCompileTscParams = Partial<CompileParams & {\n compile?: {\n tsc?: {\n tsconfig?: string\n compilerOptions?: CompilerOptions\n }\n }\n}>\n\nconst getCompilerOptionsJSONFollowExtends = (filename: string): Record<string, any> => {\n let opts = {};\n const config = readConfigFile(filename, ts.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 config.compilerOptions\n}\n\nconst getCompilerOptions = (options?: CompilerOptions, tsconfig: string = \"tsconfig.json\"): CompilerOptions => {\n const configFileName = findConfigFile(\n \"./\",\n ts.sys.fileExists,\n tsconfig\n )\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(\n \"./\",\n ts.sys.fileExists,\n tsconfig\n )\n return {...(configFileName ? readConfigFile(configFileName, sys.readFile).config : {}), compilerOptions: getCompilerOptions(options)}\n}\n\nconst compile = (fileNames: string[], optionsParam: CompilerOptions) => {\n console.log(chalk.blue(`compile`))\n const {moduleResolution, ...options} = optionsParam\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)\n .concat(emitResult.diagnostics)\n\n const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1)\n\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n let { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!)\n let 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 sourceMap: true,\n declaration: true,\n declarationMap: true,\n rootDir: 'src',\n outDir: 'dist',\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}"],"mappings":"AAAA,OAAO,MAAuB,gBAAgB,KAAK,uBAAmD,+BAA+B,8BAA8B,eAA2D,sBAAsB;AAEpP,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,OAAO,WAAW;AAClB,OAAO,WAAW;AAWlB,MAAM,sCAAsC,CAAC,aAA0C;AACrF,MAAI,OAAO,CAAC;AACZ,QAAM,SAAS,eAAe,UAAU,GAAG,IAAI,QAAQ,EAAE;AACzD,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,OAAO;AAChB;AAEA,MAAM,qBAAqB,CAAC,SAA2B,WAAmB,oBAAqC;AAC7G,QAAM,iBAAiB;AAAA,IACrB;AAAA,IACA,GAAG,IAAI;AAAA,IACP;AAAA,EACF;AACA,QAAM,4BAA4B,iBAAiB,oCAAoC,cAAc,IAAI;AAEzG,SAAO,MAAM,CAAC,GAAG,2BAA2B,OAAO;AACrD;AAEA,MAAM,gBAAgB,CAAC,S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AC1B;AAEO,MAAM,oBAAoB,OAAO,WAAsD;AAC5F,QAAM,yBAA0C;AAAA,IAC9C,WAAW;AAAA,IACX,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AACA,QAAM,kBAAkB,MAAM,CAAC,GAAG,wBAAwB,QAAQ,SAAS,KAAK,eAAe;AAC/F,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;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,55 @@
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_tsc_prog = require("tsc-prog");
25
+ var import_lib = require("../../../lib");
26
+ var import_inputs = require("./inputs");
27
+ var import_process = require("process");
28
+ const packageCompileTscTypes = async (params) => {
29
+ const pkg = process.env.INIT_CWD;
30
+ const buildOptions = {
31
+ basePath: pkg ?? (0, import_process.cwd)(),
32
+ compilerOptions: {
33
+ sourceMap: true,
34
+ declaration: true,
35
+ declarationMap: true,
36
+ emitDeclarationOnly: true,
37
+ esModuleInterop: true,
38
+ outDir: "dist"
39
+ },
40
+ include: ["src"],
41
+ exclude: ["dist", "docs"]
42
+ };
43
+ const config = await (0, import_lib.loadConfig)(params);
44
+ if (config.verbose) {
45
+ console.log(`Compiling types with TSC [${pkg}]`);
46
+ }
47
+ const fileNames = (await (0, import_inputs.getAllInputs)(config.compile?.depth)).map((fileName) => `src/${fileName}`);
48
+ (0, import_tsc_prog.build)(buildOptions);
49
+ return 0;
50
+ };
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ packageCompileTscTypes
54
+ });
55
+ //# sourceMappingURL=tscTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { build, BuildOptions } from 'tsc-prog'\nimport { CompileParams } from \"./CompileParams\"\nimport { loadConfig } from \"../../../lib\"\nimport { getAllInputs } from \"./inputs\"\nimport { cwd } from 'process'\n\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 sourceMap: true,\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist'\n },\n include: ['src'],\n exclude: ['dist', 'docs']\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`)\n build(buildOptions)\n return 0\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoC;AAEpC,iBAA2B;AAC3B,oBAA6B;AAC7B,qBAAoB;AAGb,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,WAAO,oBAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,WAAW;AAAA,MACX,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,IACV;AAAA,IACA,SAAS,CAAC,KAAK;AAAA,IACf,SAAS,CAAC,QAAQ,MAAM;AAAA,EAC1B;AAEA,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,aAAa,UAAM,4BAAa,OAAO,SAAS,KAAK,GAAG,IAAI,CAAC,aAAa,OAAO,QAAQ,EAAE;AACjG,6BAAM,YAAY;AAClB,SAAO;AACT;","names":[]}
@@ -0,0 +1,31 @@
1
+ import { build } from "tsc-prog";
2
+ import { loadConfig } from "../../../lib";
3
+ import { getAllInputs } from "./inputs";
4
+ import { cwd } from "process";
5
+ const packageCompileTscTypes = async (params) => {
6
+ const pkg = process.env.INIT_CWD;
7
+ const buildOptions = {
8
+ basePath: pkg ?? cwd(),
9
+ compilerOptions: {
10
+ sourceMap: true,
11
+ declaration: true,
12
+ declarationMap: true,
13
+ emitDeclarationOnly: true,
14
+ esModuleInterop: true,
15
+ outDir: "dist"
16
+ },
17
+ include: ["src"],
18
+ exclude: ["dist", "docs"]
19
+ };
20
+ const config = await loadConfig(params);
21
+ if (config.verbose) {
22
+ console.log(`Compiling types with TSC [${pkg}]`);
23
+ }
24
+ const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`);
25
+ build(buildOptions);
26
+ return 0;
27
+ };
28
+ export {
29
+ packageCompileTscTypes
30
+ };
31
+ //# sourceMappingURL=tscTypes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { build, BuildOptions } from 'tsc-prog'\nimport { CompileParams } from \"./CompileParams\"\nimport { loadConfig } from \"../../../lib\"\nimport { getAllInputs } from \"./inputs\"\nimport { cwd } from 'process'\n\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 sourceMap: true,\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist'\n },\n include: ['src'],\n exclude: ['dist', 'docs']\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`)\n build(buildOptions)\n return 0\n}"],"mappings":"AAAA,SAAS,aAA2B;AAEpC,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,WAAW;AAGb,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,OAAO,IAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,WAAW;AAAA,MACX,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,IACV;AAAA,IACA,SAAS,CAAC,KAAK;AAAA,IACf,SAAS,CAAC,QAAQ,MAAM;AAAA,EAC1B;AAEA,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,aAAa,MAAM,aAAa,OAAO,SAAS,KAAK,GAAG,IAAI,CAAC,aAAa,OAAO,QAAQ,EAAE;AACjG,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_inputs = require("./inputs");
26
+ var import_publint = require("../publint");
27
+ var import_lib = require("../../../lib");
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
+ resolve: false,
39
+ only: 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'\nimport {getInputDirs, getInputs} from './inputs'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { loadConfig } from '../../../lib'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\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 resolve: false,\n only: 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 = (await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose )\n }),\n )).reduce(((prev, result) => prev + result), 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAC7C,oBAAsC;AACtC,qBAA+B;AAE/B,iBAA2B;AAC3B,sBAAuC;AAUvC,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;AAAA,IACP,KAAK;AAAA,MACH,OAAO,CAAC,cAAc;AAAA,MACtB,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,iBAAY,mBAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO,UAAM,wCAAuB,EAAC,QAAO,CAAC;AAC/C;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,UAAM,4BAAa,OAAO,SAAS,KAAK;AAE1D,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,UAAU,IAAI,OAAO,aAAa;AAChC,aAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAQ;AAAA,IACrF,CAAC;AAAA,EACH,GAAG,OAAQ,CAAC,MAAMC,YAAW,OAAOA,SAAS,CAAC;AAC9C,SAAO,UAAU,OAAO,SAAS,UAAU,UAAM,+BAAe,IAAI;AACtE;","names":["options","result"]}
@@ -0,0 +1,51 @@
1
+ import { build, defineConfig } from "tsup";
2
+ import { getInputDirs, getInputs } from "./inputs";
3
+ import { packagePublint } from "../publint";
4
+ import { loadConfig } from "../../../lib";
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
+ resolve: false,
16
+ only: 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'\nimport {getInputDirs, getInputs} from './inputs'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { loadConfig } from '../../../lib'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\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 resolve: false,\n only: 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 = (await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose )\n }),\n )).reduce(((prev, result) => prev + result), 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAC7C,SAAQ,cAAc,iBAAgB;AACtC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB;AAC3B,SAAS,8BAA8B;AAUvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,YAAsB;AACrF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,MAAM,UAAU,GAAG;AACjC,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,MACH,OAAO,CAAC,cAAc;AAAA,MACtB,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,aAAY,MAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO,MAAM,uBAAuB,EAAC,QAAO,CAAC;AAC/C;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,MAAM,aAAa,OAAO,SAAS,KAAK;AAE1D,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,UAAU,IAAI,OAAO,aAAa;AAChC,aAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAQ;AAAA,IACrF,CAAC;AAAA,EACH,GAAG,OAAQ,CAAC,MAAMC,YAAW,OAAOA,SAAS,CAAC;AAC9C,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,WAAkC;AACrE,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,WAAkC;AACrE,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":[]}