@storm-software/esbuild 0.0.1 → 0.2.0

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 (70) hide show
  1. package/README.md +9 -8
  2. package/dist/build.cjs +15 -0
  3. package/dist/build.cjs.map +1 -0
  4. package/dist/build.d.cts +14 -0
  5. package/dist/build.d.ts +14 -0
  6. package/dist/build.js +15 -0
  7. package/dist/build.js.map +1 -0
  8. package/dist/chunk-4ZPYEZJO.cjs +15 -0
  9. package/dist/chunk-4ZPYEZJO.cjs.map +1 -0
  10. package/dist/chunk-75SHW3Z4.cjs +320 -0
  11. package/dist/chunk-75SHW3Z4.cjs.map +1 -0
  12. package/dist/chunk-7U3F23ZZ.js +102 -0
  13. package/dist/chunk-7U3F23ZZ.js.map +1 -0
  14. package/dist/chunk-BF5W6GVP.cjs +53 -0
  15. package/dist/chunk-BF5W6GVP.cjs.map +1 -0
  16. package/dist/chunk-CMF37LBT.js +23 -0
  17. package/dist/chunk-CMF37LBT.js.map +1 -0
  18. package/dist/chunk-D5PRB2E2.cjs +40 -0
  19. package/dist/chunk-D5PRB2E2.cjs.map +1 -0
  20. package/dist/chunk-DFGHPRBD.cjs +29 -0
  21. package/dist/chunk-DFGHPRBD.cjs.map +1 -0
  22. package/dist/chunk-DRRPNILS.js +40 -0
  23. package/dist/chunk-DRRPNILS.js.map +1 -0
  24. package/dist/chunk-IDO67KEL.js +320 -0
  25. package/dist/chunk-IDO67KEL.js.map +1 -0
  26. package/dist/chunk-MUYXFAKB.cjs +1 -0
  27. package/dist/chunk-MUYXFAKB.cjs.map +1 -0
  28. package/dist/chunk-PRNPZZSV.cjs +23 -0
  29. package/dist/chunk-PRNPZZSV.cjs.map +1 -0
  30. package/dist/chunk-QBYHNHXL.js +127 -0
  31. package/dist/chunk-QBYHNHXL.js.map +1 -0
  32. package/dist/chunk-QNDLJ2W7.js +1 -0
  33. package/dist/chunk-QNDLJ2W7.js.map +1 -0
  34. package/dist/chunk-T5H2LBQA.cjs +127 -0
  35. package/dist/chunk-T5H2LBQA.cjs.map +1 -0
  36. package/dist/chunk-TTHABTDU.js +53 -0
  37. package/dist/chunk-TTHABTDU.js.map +1 -0
  38. package/dist/chunk-WCQVDF3K.js +14 -0
  39. package/dist/chunk-WCQVDF3K.js.map +1 -0
  40. package/dist/chunk-WGEGR3DF.cjs +14 -0
  41. package/dist/chunk-WGEGR3DF.cjs.map +1 -0
  42. package/dist/chunk-YQBU3FSL.js +29 -0
  43. package/dist/chunk-YQBU3FSL.js.map +1 -0
  44. package/dist/chunk-Z2M426LD.cjs +102 -0
  45. package/dist/chunk-Z2M426LD.cjs.map +1 -0
  46. package/dist/chunk-ZQ5NVDFP.js +15 -0
  47. package/dist/chunk-ZQ5NVDFP.js.map +1 -0
  48. package/dist/config.cjs +10 -0
  49. package/dist/config.cjs.map +1 -0
  50. package/dist/config.d.cts +15 -0
  51. package/dist/config.d.ts +15 -0
  52. package/dist/config.js +10 -0
  53. package/dist/config.js.map +1 -0
  54. package/dist/index.cjs +39 -0
  55. package/dist/index.cjs.map +1 -0
  56. package/dist/index.d.cts +230 -0
  57. package/dist/index.d.ts +230 -0
  58. package/dist/index.js +39 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/types.cjs +2 -0
  61. package/dist/types.cjs.map +1 -0
  62. package/dist/types.d.cts +20 -0
  63. package/dist/types.d.ts +20 -0
  64. package/dist/types.js +2 -0
  65. package/dist/types.js.map +1 -0
  66. package/package.json +159 -3
  67. package/index.cjs +0 -19751
  68. package/index.js +0 -19748
  69. package/meta.cjs.json +0 -12657
  70. package/meta.esm.json +0 -12669
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-MUYXFAKB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-MUYXFAKB.cjs"],"names":[],"mappings":"AAAA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-MUYXFAKB.cjs"}
@@ -0,0 +1,23 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
4
+
5
+ // src/plugins/on-error.ts
6
+ var onErrorPlugin = {
7
+ name: "storm:on-error",
8
+ setup(build) {
9
+ build.onEnd((result) => {
10
+ if (result.errors.length > 0 && process.env.WATCH !== "true") {
11
+ _chunk4ZPYEZJOcjs.writeLog.call(void 0, "error", `The following errors occurred during the build:
12
+ ${result.errors.map((error) => error.text).join("\n")}
13
+ `);
14
+ throw new Error("ESBuild process failed with errors.");
15
+ }
16
+ });
17
+ }
18
+ };
19
+
20
+
21
+
22
+ exports.onErrorPlugin = onErrorPlugin;
23
+ //# sourceMappingURL=chunk-PRNPZZSV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-PRNPZZSV.cjs","../src/plugins/on-error.ts"],"names":["onErrorPlugin","name","setup","build","onEnd","result","errors","length","process","env","WATCH","writeLog","map","error","text","join","Error"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACmBO,IAAMA,cAAAA,EAAgC;ADjB7C,ECkBEC,IAAAA,EAAM,gBAAA;ADjBR,ECkBEC,KAAAA,CAAMC,KAAAA,EAAK;AACTA,IAAAA,KAAAA,CAAMC,KAAAA,CAAMC,CAAAA,MAAAA,EAAAA,GAAAA;AAEV,MAAA,GAAA,CAAIA,MAAAA,CAAOC,MAAAA,CAAOC,OAAAA,EAAS,EAAA,GAAKC,OAAAA,CAAQC,GAAAA,CAAIC,MAAAA,IAAU,MAAA,EAAQ;AAC5DC,QAAAA,wCAAAA,OACE,EACA,CAAA;ADpBV,ECqBEN,MAAAA,CAAOC,MAAAA,CAAOM,GAAAA,CAAIC,CAAAA,KAAAA,EAAAA,GAASA,KAAAA,CAAMC,IAAI,CAAA,CAAEC,IAAAA,CAAK,IAAA,CAAA,CAAA;ADpB9C,CCqBC,CAAA;AAGO,QAAA,MAAM,IAAIC,KAAAA,CAAM,qCAAA,CAAA;ADtBxB,MCuBM;ADtBN,ICuBI,CAAA,CAAA;ADtBJ,ECuBE;AACF,CAAA;ADtBA;AACA;AACE;AACF,sCAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-PRNPZZSV.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport type * as esbuild from \"esbuild\";\nimport { writeLog } from \"../utilities\";\n\n/**\n * Causes esbuild to exit immediately with an error code.\n */\nexport const onErrorPlugin: esbuild.Plugin = {\n name: \"storm:on-error\",\n setup(build) {\n build.onEnd(result => {\n // if there were errors found on the build\n if (result.errors.length > 0 && process.env.WATCH !== \"true\") {\n writeLog(\n \"error\",\n `The following errors occurred during the build:\n${result.errors.map(error => error.text).join(\"\\n\")}\n`\n );\n\n throw new Error(\"ESBuild process failed with errors.\");\n }\n });\n }\n};\n"]}
@@ -0,0 +1,127 @@
1
+ import {
2
+ writeLog
3
+ } from "./chunk-ZQ5NVDFP.js";
4
+ import {
5
+ __name,
6
+ __require
7
+ } from "./chunk-WCQVDF3K.js";
8
+
9
+ // src/plugins/tsc.ts
10
+ import { hfs } from "@humanfs/node";
11
+ import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
12
+ import path from "node:path";
13
+
14
+ // src/utilities/run.ts
15
+ import { execaCommand } from "execa";
16
+ function run(command) {
17
+ return execaCommand(command, {
18
+ preferLocal: true,
19
+ shell: true,
20
+ stdio: "inherit"
21
+ });
22
+ }
23
+ __name(run, "run");
24
+
25
+ // src/plugins/tsc.ts
26
+ function bundleTypeDefinitions(filename, outfile, externals) {
27
+ const { dependencies, peerDependencies, devDependencies } = __require(`${process.cwd()}/package.json`);
28
+ const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
29
+ p,
30
+ getTypeDependencyPackageName(p)
31
+ ]);
32
+ const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
33
+ p,
34
+ getTypeDependencyPackageName(p)
35
+ ]);
36
+ const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
37
+ p,
38
+ getTypeDependencyPackageName(p)
39
+ ]);
40
+ const includeDeps = devDependenciesKeys;
41
+ const excludeDeps = /* @__PURE__ */ new Set([
42
+ ...dependenciesKeys,
43
+ ...peerDependenciesKeys,
44
+ ...externals
45
+ ]);
46
+ const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
47
+ const extractorConfig = ExtractorConfig.prepare({
48
+ configObject: {
49
+ projectFolder: process.cwd(),
50
+ mainEntryPointFilePath: filename,
51
+ bundledPackages,
52
+ compiler: {
53
+ tsconfigFilePath: path.join(process.cwd(), "tsconfig.build.json"),
54
+ overrideTsconfig: {
55
+ compilerOptions: {
56
+ paths: {}
57
+ // bug with api extract + paths
58
+ }
59
+ }
60
+ },
61
+ dtsRollup: {
62
+ enabled: true,
63
+ untrimmedFilePath: path.join(process.cwd(), `${outfile}.d.ts`)
64
+ },
65
+ tsdocMetadata: {
66
+ enabled: false
67
+ }
68
+ },
69
+ packageJsonFullPath: path.join(process.cwd(), "package.json"),
70
+ configObjectFullPath: void 0
71
+ });
72
+ const extractorResult = Extractor.invoke(extractorConfig, {
73
+ showVerboseMessages: true,
74
+ localBuild: true
75
+ });
76
+ if (extractorResult.succeeded === false) {
77
+ writeLog("error", `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
78
+ throw new Error("API Extractor completed with errors");
79
+ }
80
+ }
81
+ __name(bundleTypeDefinitions, "bundleTypeDefinitions");
82
+ var tscPlugin = /* @__PURE__ */ __name((emitTypes) => ({
83
+ name: "tscPlugin",
84
+ setup(build) {
85
+ const options = build.initialOptions;
86
+ if (emitTypes === false) return;
87
+ build.onStart(async () => {
88
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
89
+ await run(`tsc --project ${options.tsconfig} --paths null`);
90
+ }
91
+ if (options.bundle && options.outfile && options.entryPoints?.[0].endsWith(".ts")) {
92
+ const tsconfig = __require(`${process.cwd()}/${options.tsconfig}`);
93
+ const typeOutDir = tsconfig?.compilerOptions?.outDir ?? ".";
94
+ const entryPoint = options.entryPoints?.[0].replace(/\.ts$/, "");
95
+ const bundlePath = options.outfile.replace(/\.m?js$/, "");
96
+ let dtsPath;
97
+ if (await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)) {
98
+ dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;
99
+ } else if (await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`)) {
100
+ dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`;
101
+ }
102
+ const ext = options.format === "esm" ? "d.mts" : "d.ts";
103
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
104
+ bundleTypeDefinitions(dtsPath, bundlePath, options.external ?? []);
105
+ const dtsContents = await hfs.text(`${bundlePath}.d.ts`);
106
+ await hfs.write(`${bundlePath}.${ext}`, dtsContents);
107
+ } else {
108
+ await hfs.write(`${bundlePath}.${ext}`, `export * from '${process.cwd()}/${entryPoint}'`);
109
+ }
110
+ }
111
+ });
112
+ }
113
+ }), "tscPlugin");
114
+ function getTypeDependencyPackageName(npmPackage) {
115
+ if (npmPackage.startsWith("@")) {
116
+ const [scope, name] = npmPackage.split("/");
117
+ return `@types/${scope?.slice(1)}__${name}`;
118
+ }
119
+ return `@types/${npmPackage}`;
120
+ }
121
+ __name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
122
+
123
+ export {
124
+ run,
125
+ tscPlugin
126
+ };
127
+ //# sourceMappingURL=chunk-QBYHNHXL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/tsc.ts","../src/utilities/run.ts"],"sourcesContent":["/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { hfs } from \"@humanfs/node\";\nimport { Extractor, ExtractorConfig } from \"@microsoft/api-extractor\";\nimport type * as esbuild from \"esbuild\";\nimport path from \"node:path\";\nimport { writeLog } from \"../utilities/log\";\nimport { run } from \"../utilities/run\";\n\n/**\n * Bundle all type definitions by using the API Extractor from RushStack\n *\n * @param filename - the source d.ts to bundle\n * @param outfile - the output bundled file\n * @param externals - the list of external dependencies\n */\nfunction bundleTypeDefinitions(\n filename: string,\n outfile: string,\n externals: string[]\n) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { dependencies, peerDependencies, devDependencies } = require(\n `${process.cwd()}/package.json`\n );\n\n // get the list of bundled and non bundled as well as their eventual type dependencies\n const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap(\n p => [p, getTypeDependencyPackageName(p)]\n );\n const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n\n const includeDeps = devDependenciesKeys;\n const excludeDeps = new Set([\n ...dependenciesKeys,\n ...peerDependenciesKeys,\n ...externals\n ]);\n const bundledPackages = includeDeps.filter(dep => !excludeDeps.has(dep));\n\n // we give the config in its raw form instead of a file\n const extractorConfig = ExtractorConfig.prepare({\n configObject: {\n projectFolder: process.cwd(),\n mainEntryPointFilePath: filename,\n bundledPackages,\n compiler: {\n tsconfigFilePath: path.join(process.cwd(), \"tsconfig.build.json\"),\n overrideTsconfig: {\n compilerOptions: {\n paths: {} // bug with api extract + paths\n }\n }\n },\n dtsRollup: {\n enabled: true,\n untrimmedFilePath: path.join(process.cwd(), `${outfile}.d.ts`)\n },\n tsdocMetadata: {\n enabled: false\n }\n },\n packageJsonFullPath: path.join(process.cwd(), \"package.json\"),\n configObjectFullPath: undefined\n });\n\n // here we trigger the \"command line\" interface equivalent\n const extractorResult = Extractor.invoke(extractorConfig, {\n showVerboseMessages: true,\n localBuild: true\n });\n\n // we exit the process immediately if there were errors\n if (extractorResult.succeeded === false) {\n writeLog(\n \"error\",\n `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? \"error\" : \"errors\"}`\n );\n\n throw new Error(\"API Extractor completed with errors\");\n }\n}\n\n/**\n * Triggers the TypeScript compiler and the type bundler.\n */\nexport const tscPlugin: (emitTypes?: boolean) => esbuild.Plugin = (\n emitTypes?: boolean\n) => ({\n name: \"tscPlugin\",\n setup(build) {\n const options = build.initialOptions;\n\n if (emitTypes === false) return; // build has opted out of emitting types\n\n build.onStart(async () => {\n // we only call tsc if not in watch mode or in dev mode (they skip types)\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // --paths null basically prevents typescript from using paths from the\n // tsconfig.json that is passed from the esbuild config. We need to do\n // this because TS would include types from the paths into this build.\n // but our paths, in our specific case only represent separate packages.\n await run(`tsc --project ${options.tsconfig} --paths null`);\n }\n\n // we bundle types if we also bundle the entry point and it is a ts file\n if (\n options.bundle &&\n options.outfile &&\n options.entryPoints?.[0].endsWith(\".ts\")\n ) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsconfig = require(`${process.cwd()}/${options.tsconfig}`); // tsconfig\n const typeOutDir = tsconfig?.compilerOptions?.outDir ?? \".\"; // type out dir\n const entryPoint = options.entryPoints?.[0].replace(/\\.ts$/, \"\");\n const bundlePath = options.outfile.replace(/\\.m?js$/, \"\");\n\n let dtsPath;\n if (\n await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;\n } else if (\n await hfs.isFile(\n `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`\n )\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`;\n }\n\n const ext = options.format === \"esm\" ? \"d.mts\" : \"d.ts\";\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // we get the types generated by tsc and bundle them near the output\n bundleTypeDefinitions(dtsPath, bundlePath, options.external ?? []);\n\n const dtsContents = await hfs.text(`${bundlePath}.d.ts`);\n await hfs.write(`${bundlePath}.${ext}`, dtsContents!);\n } else {\n // in watch mode, it wouldn't be viable to bundle the types every time\n // we haven't built any types with tsc at this stage, but we want types\n // we link the types locally by re-exporting them from the entry point\n await hfs.write(\n `${bundlePath}.${ext}`,\n `export * from '${process.cwd()}/${entryPoint}'`\n );\n }\n }\n });\n }\n});\n\n/**\n * Automatically get the type dependency package name, following the\n * DefinitelyTyped naming conventions.\n *\n * @param npmPackage - the npm package name\n * @returns the type dependency package name\n */\nfunction getTypeDependencyPackageName(npmPackage: string) {\n if (npmPackage.startsWith(\"@\")) {\n const [scope, name] = npmPackage.split(\"/\");\n\n return `@types/${scope?.slice(1)}__${name}`;\n }\n return `@types/${npmPackage}`;\n}\n","/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { execaCommand } from \"execa\";\n\n// wrapper around execa to run our build cmds\n\nexport function run(command: string) {\n return execaCommand(command, {\n preferLocal: true,\n shell: true,\n stdio: \"inherit\"\n });\n}\n"],"mappings":"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","names":["hfs","Extractor","ExtractorConfig","path","execaCommand","run","command","execaCommand","preferLocal","shell","stdio","bundleTypeDefinitions","filename","outfile","externals","dependencies","peerDependencies","devDependencies","require","process","cwd","dependenciesKeys","Object","keys","flatMap","p","getTypeDependencyPackageName","peerDependenciesKeys","devDependenciesKeys","includeDeps","excludeDeps","Set","bundledPackages","filter","dep","has","extractorConfig","ExtractorConfig","prepare","configObject","projectFolder","mainEntryPointFilePath","compiler","tsconfigFilePath","path","join","overrideTsconfig","compilerOptions","paths","dtsRollup","enabled","untrimmedFilePath","tsdocMetadata","packageJsonFullPath","configObjectFullPath","undefined","extractorResult","Extractor","invoke","showVerboseMessages","localBuild","succeeded","writeLog","errorCount","Error","tscPlugin","emitTypes","name","setup","build","options","initialOptions","onStart","env","WATCH","DEV","run","tsconfig","bundle","entryPoints","endsWith","typeOutDir","outDir","entryPoint","replace","bundlePath","dtsPath","hfs","isFile","ext","format","external","dtsContents","text","write","npmPackage","startsWith","scope","split","slice"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-QNDLJ2W7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,127 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
4
+
5
+
6
+
7
+ var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
8
+
9
+ // src/plugins/tsc.ts
10
+ var _node = require('@humanfs/node');
11
+ var _apiextractor = require('@microsoft/api-extractor');
12
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
13
+
14
+ // src/utilities/run.ts
15
+ var _execa = require('execa');
16
+ function run(command) {
17
+ return _execa.execaCommand.call(void 0, command, {
18
+ preferLocal: true,
19
+ shell: true,
20
+ stdio: "inherit"
21
+ });
22
+ }
23
+ _chunkWGEGR3DFcjs.__name.call(void 0, run, "run");
24
+
25
+ // src/plugins/tsc.ts
26
+ function bundleTypeDefinitions(filename, outfile, externals) {
27
+ const { dependencies, peerDependencies, devDependencies } = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/package.json`);
28
+ const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
29
+ p,
30
+ getTypeDependencyPackageName(p)
31
+ ]);
32
+ const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
33
+ p,
34
+ getTypeDependencyPackageName(p)
35
+ ]);
36
+ const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
37
+ p,
38
+ getTypeDependencyPackageName(p)
39
+ ]);
40
+ const includeDeps = devDependenciesKeys;
41
+ const excludeDeps = /* @__PURE__ */ new Set([
42
+ ...dependenciesKeys,
43
+ ...peerDependenciesKeys,
44
+ ...externals
45
+ ]);
46
+ const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
47
+ const extractorConfig = _apiextractor.ExtractorConfig.prepare({
48
+ configObject: {
49
+ projectFolder: process.cwd(),
50
+ mainEntryPointFilePath: filename,
51
+ bundledPackages,
52
+ compiler: {
53
+ tsconfigFilePath: _path2.default.join(process.cwd(), "tsconfig.build.json"),
54
+ overrideTsconfig: {
55
+ compilerOptions: {
56
+ paths: {}
57
+ // bug with api extract + paths
58
+ }
59
+ }
60
+ },
61
+ dtsRollup: {
62
+ enabled: true,
63
+ untrimmedFilePath: _path2.default.join(process.cwd(), `${outfile}.d.ts`)
64
+ },
65
+ tsdocMetadata: {
66
+ enabled: false
67
+ }
68
+ },
69
+ packageJsonFullPath: _path2.default.join(process.cwd(), "package.json"),
70
+ configObjectFullPath: void 0
71
+ });
72
+ const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
73
+ showVerboseMessages: true,
74
+ localBuild: true
75
+ });
76
+ if (extractorResult.succeeded === false) {
77
+ _chunk4ZPYEZJOcjs.writeLog.call(void 0, "error", `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
78
+ throw new Error("API Extractor completed with errors");
79
+ }
80
+ }
81
+ _chunkWGEGR3DFcjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
82
+ var tscPlugin = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (emitTypes) => ({
83
+ name: "tscPlugin",
84
+ setup(build) {
85
+ const options = build.initialOptions;
86
+ if (emitTypes === false) return;
87
+ build.onStart(async () => {
88
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
89
+ await run(`tsc --project ${options.tsconfig} --paths null`);
90
+ }
91
+ if (options.bundle && options.outfile && _optionalChain([options, 'access', _ => _.entryPoints, 'optionalAccess', _2 => _2[0], 'access', _3 => _3.endsWith, 'call', _4 => _4(".ts")])) {
92
+ const tsconfig = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/${options.tsconfig}`);
93
+ const typeOutDir = _nullishCoalesce(_optionalChain([tsconfig, 'optionalAccess', _5 => _5.compilerOptions, 'optionalAccess', _6 => _6.outDir]), () => ( "."));
94
+ const entryPoint = _optionalChain([options, 'access', _7 => _7.entryPoints, 'optionalAccess', _8 => _8[0], 'access', _9 => _9.replace, 'call', _10 => _10(/\.ts$/, "")]);
95
+ const bundlePath = options.outfile.replace(/\.m?js$/, "");
96
+ let dtsPath;
97
+ if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)) {
98
+ dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;
99
+ } else if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`)) {
100
+ dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`;
101
+ }
102
+ const ext = options.format === "esm" ? "d.mts" : "d.ts";
103
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
104
+ bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(options.external, () => ( [])));
105
+ const dtsContents = await _node.hfs.text(`${bundlePath}.d.ts`);
106
+ await _node.hfs.write(`${bundlePath}.${ext}`, dtsContents);
107
+ } else {
108
+ await _node.hfs.write(`${bundlePath}.${ext}`, `export * from '${process.cwd()}/${entryPoint}'`);
109
+ }
110
+ }
111
+ });
112
+ }
113
+ }), "tscPlugin");
114
+ function getTypeDependencyPackageName(npmPackage) {
115
+ if (npmPackage.startsWith("@")) {
116
+ const [scope, name] = npmPackage.split("/");
117
+ return `@types/${_optionalChain([scope, 'optionalAccess', _11 => _11.slice, 'call', _12 => _12(1)])}__${name}`;
118
+ }
119
+ return `@types/${npmPackage}`;
120
+ }
121
+ _chunkWGEGR3DFcjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
122
+
123
+
124
+
125
+
126
+ exports.run = run; exports.tscPlugin = tscPlugin;
127
+ //# sourceMappingURL=chunk-T5H2LBQA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-T5H2LBQA.cjs","../src/plugins/tsc.ts","../src/utilities/run.ts"],"names":["run","command","execaCommand","preferLocal","shell","stdio","bundleTypeDefinitions","filename","outfile","externals","dependencies","peerDependencies","devDependencies","require","p","flatMap","devDependenciesKeys","dependenciesKeys","peerDependenciesKeys","dep","bundledPackages","undefined","errorCount","initialOptions","endsWith","dtsPath","entryPoint","dtsContents","process","name","npmPackage","getTypeDependencyPackageName"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACSA,qCAAoB;AACpB,wDAA2C;AAE3C,wEAAiB;ADRjB;AACA;AEIA,8BAA6B;AAItB,SAASA,GAAAA,CAAIC,OAAAA,EAAe;AACjC,EAAA,OAAOC,iCAAAA,OAAaD,EAAS;AFL/B,IEMIE,WAAAA,EAAa,IAAA;AFLjB,IEMIC,KAAAA,EAAO,IAAA;AFLX,IEMIC,KAAAA,EAAO;AFLX,EEME,CAAA,CAAA;AACF;AANgBL,sCAAAA,GAAAA,EAAAA,KAAAA,CAAAA;AFEhB;AACA;ACOA,SAASM,qBAAAA,CACPC,QAAAA,EACAC,OAAAA,EACAC,SAAAA,EAAmB;AAGnB,EAAA,MAAM,EAAEC,YAAAA,EAAcC,gBAAAA,EAAkBC,gBAAe,EAAA,EAAKC,yCAAAA,CAC1D,EAAA;AAI+DC,EAAAA;AAC/DA,IAAAA;AAC6BA,IAAAA;AAC9B,EAAA;AACgEC,EAAAA;AACzDD,IAAAA;AAAgCA,IAAAA;AAAG,EAAA;AAE4BA,EAAAA;AACrEA,IAAAA;AAC6BA,IAAAA;AAC9B,EAAA;AAEmBE,EAAAA;AACQ,EAAA;AACvBC,IAAAA;AACAC,IAAAA;AACAT,IAAAA;AACJ,EAAA;AACkEU,EAAAA;AAGnB,EAAA;AAChC,IAAA;AACc,MAAA;AACFZ,MAAAA;AACxBa,MAAAA;AACU,MAAA;AACmC,QAAA;AACzB,QAAA;AACC,UAAA;AACP,YAAA;ADhBqD;ACiB/D,UAAA;AACF,QAAA;AACF,MAAA;AACW,MAAA;AACA,QAAA;AACoD,QAAA;AAC/D,MAAA;AACe,MAAA;AACJ,QAAA;AACX,MAAA;AACF,IAAA;AAC8C,IAAA;AACxBC,IAAAA;AACxB,EAAA;AAG0D,EAAA;AACnC,IAAA;AACT,IAAA;AACd,EAAA;AAGyC,EAAA;AAGWC,IAAAA;AAGlC,IAAA;AAClB,EAAA;AACF;AAxEShB;AA+EH;AACE,EAAA;AACK,EAAA;AACaiB,IAAAA;AAEG,IAAA;AAEX,IAAA;AAEoD,MAAA;AAKJ,QAAA;AAC5D,MAAA;AAM2BC,MAAAA;AAGsC,QAAA;AACP,QAAA;AACK,QAAA;AACP,QAAA;AAElDC,QAAAA;AAEiDC,QAAAA;AAEPA,UAAAA;AAGRA,QAAAA;AAG2B,UAAA;AACjE,QAAA;AAEiD,QAAA;AACe,QAAA;AAEC,UAAA;AAER,UAAA;AACfC,UAAAA;AACnC,QAAA;AAMeC,UAAAA;AAEtB,QAAA;AACF,MAAA;AACF,IAAA;AACF,EAAA;AA9DgE;AAwEV;AACtB,EAAA;AACS,IAAA;AAEFC,IAAAA;AACvC,EAAA;AACiBC,EAAAA;AACnB;AAPSC;AD3DgE;AACA;AACA;AACA;AACA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-T5H2LBQA.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { hfs } from \"@humanfs/node\";\nimport { Extractor, ExtractorConfig } from \"@microsoft/api-extractor\";\nimport type * as esbuild from \"esbuild\";\nimport path from \"node:path\";\nimport { writeLog } from \"../utilities/log\";\nimport { run } from \"../utilities/run\";\n\n/**\n * Bundle all type definitions by using the API Extractor from RushStack\n *\n * @param filename - the source d.ts to bundle\n * @param outfile - the output bundled file\n * @param externals - the list of external dependencies\n */\nfunction bundleTypeDefinitions(\n filename: string,\n outfile: string,\n externals: string[]\n) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { dependencies, peerDependencies, devDependencies } = require(\n `${process.cwd()}/package.json`\n );\n\n // get the list of bundled and non bundled as well as their eventual type dependencies\n const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap(\n p => [p, getTypeDependencyPackageName(p)]\n );\n const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n\n const includeDeps = devDependenciesKeys;\n const excludeDeps = new Set([\n ...dependenciesKeys,\n ...peerDependenciesKeys,\n ...externals\n ]);\n const bundledPackages = includeDeps.filter(dep => !excludeDeps.has(dep));\n\n // we give the config in its raw form instead of a file\n const extractorConfig = ExtractorConfig.prepare({\n configObject: {\n projectFolder: process.cwd(),\n mainEntryPointFilePath: filename,\n bundledPackages,\n compiler: {\n tsconfigFilePath: path.join(process.cwd(), \"tsconfig.build.json\"),\n overrideTsconfig: {\n compilerOptions: {\n paths: {} // bug with api extract + paths\n }\n }\n },\n dtsRollup: {\n enabled: true,\n untrimmedFilePath: path.join(process.cwd(), `${outfile}.d.ts`)\n },\n tsdocMetadata: {\n enabled: false\n }\n },\n packageJsonFullPath: path.join(process.cwd(), \"package.json\"),\n configObjectFullPath: undefined\n });\n\n // here we trigger the \"command line\" interface equivalent\n const extractorResult = Extractor.invoke(extractorConfig, {\n showVerboseMessages: true,\n localBuild: true\n });\n\n // we exit the process immediately if there were errors\n if (extractorResult.succeeded === false) {\n writeLog(\n \"error\",\n `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? \"error\" : \"errors\"}`\n );\n\n throw new Error(\"API Extractor completed with errors\");\n }\n}\n\n/**\n * Triggers the TypeScript compiler and the type bundler.\n */\nexport const tscPlugin: (emitTypes?: boolean) => esbuild.Plugin = (\n emitTypes?: boolean\n) => ({\n name: \"tscPlugin\",\n setup(build) {\n const options = build.initialOptions;\n\n if (emitTypes === false) return; // build has opted out of emitting types\n\n build.onStart(async () => {\n // we only call tsc if not in watch mode or in dev mode (they skip types)\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // --paths null basically prevents typescript from using paths from the\n // tsconfig.json that is passed from the esbuild config. We need to do\n // this because TS would include types from the paths into this build.\n // but our paths, in our specific case only represent separate packages.\n await run(`tsc --project ${options.tsconfig} --paths null`);\n }\n\n // we bundle types if we also bundle the entry point and it is a ts file\n if (\n options.bundle &&\n options.outfile &&\n options.entryPoints?.[0].endsWith(\".ts\")\n ) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsconfig = require(`${process.cwd()}/${options.tsconfig}`); // tsconfig\n const typeOutDir = tsconfig?.compilerOptions?.outDir ?? \".\"; // type out dir\n const entryPoint = options.entryPoints?.[0].replace(/\\.ts$/, \"\");\n const bundlePath = options.outfile.replace(/\\.m?js$/, \"\");\n\n let dtsPath;\n if (\n await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;\n } else if (\n await hfs.isFile(\n `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`\n )\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`;\n }\n\n const ext = options.format === \"esm\" ? \"d.mts\" : \"d.ts\";\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // we get the types generated by tsc and bundle them near the output\n bundleTypeDefinitions(dtsPath, bundlePath, options.external ?? []);\n\n const dtsContents = await hfs.text(`${bundlePath}.d.ts`);\n await hfs.write(`${bundlePath}.${ext}`, dtsContents!);\n } else {\n // in watch mode, it wouldn't be viable to bundle the types every time\n // we haven't built any types with tsc at this stage, but we want types\n // we link the types locally by re-exporting them from the entry point\n await hfs.write(\n `${bundlePath}.${ext}`,\n `export * from '${process.cwd()}/${entryPoint}'`\n );\n }\n }\n });\n }\n});\n\n/**\n * Automatically get the type dependency package name, following the\n * DefinitelyTyped naming conventions.\n *\n * @param npmPackage - the npm package name\n * @returns the type dependency package name\n */\nfunction getTypeDependencyPackageName(npmPackage: string) {\n if (npmPackage.startsWith(\"@\")) {\n const [scope, name] = npmPackage.split(\"/\");\n\n return `@types/${scope?.slice(1)}__${name}`;\n }\n return `@types/${npmPackage}`;\n}\n","/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { execaCommand } from \"execa\";\n\n// wrapper around execa to run our build cmds\n\nexport function run(command: string) {\n return execaCommand(command, {\n preferLocal: true,\n shell: true,\n stdio: \"inherit\"\n });\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import {
2
+ __name,
3
+ __require
4
+ } from "./chunk-WCQVDF3K.js";
5
+
6
+ // src/plugins/resolve-paths.ts
7
+ import path from "node:path";
8
+ function resolvePathsConfig(options, cwd) {
9
+ if (options?.compilerOptions?.paths) {
10
+ const paths = Object.entries(options.compilerOptions.paths);
11
+ const resolvedPaths = paths.map(([key, paths2]) => {
12
+ return [
13
+ key,
14
+ paths2.map((v) => path.resolve(cwd, v))
15
+ ];
16
+ });
17
+ return Object.fromEntries(resolvedPaths);
18
+ }
19
+ if (options.extends) {
20
+ const extendsPath = path.resolve(cwd, options.extends);
21
+ const extendsDir = path.dirname(extendsPath);
22
+ const extendsConfig = __require(extendsPath);
23
+ return resolvePathsConfig(extendsConfig, extendsDir);
24
+ }
25
+ return [];
26
+ }
27
+ __name(resolvePathsConfig, "resolvePathsConfig");
28
+ var resolvePathsPlugin = {
29
+ name: "storm:resolve-paths",
30
+ setup(build) {
31
+ const parentTsConfig = __require(`${process.cwd()}/${build.initialOptions.tsconfig}`);
32
+ const resolvedTsPaths = resolvePathsConfig(parentTsConfig, process.cwd());
33
+ const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
34
+ build.onResolve({
35
+ filter: packagesRegex
36
+ }, (args) => {
37
+ if (build.initialOptions.external?.includes(args.path)) {
38
+ return {
39
+ path: args.path,
40
+ external: true
41
+ };
42
+ }
43
+ return {
44
+ path: `${resolvedTsPaths[args.path][0]}/index.ts`
45
+ };
46
+ });
47
+ }
48
+ };
49
+
50
+ export {
51
+ resolvePathsPlugin
52
+ };
53
+ //# sourceMappingURL=chunk-TTHABTDU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/resolve-paths.ts"],"sourcesContent":["/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport type * as esbuild from \"esbuild\";\nimport path from \"node:path\";\n\ntype TsConfig = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n };\n extends?: string;\n};\n\n/**\n * Recursive function to resolve the paths config from a tsconfig.json, whether\n * it is in the config directly or via an inherited config (via \"extends\").\n * @param options\n * @param cwd\n * @returns\n */\nfunction resolvePathsConfig(options: TsConfig, cwd: string) {\n if (options?.compilerOptions?.paths) {\n const paths = Object.entries(options.compilerOptions.paths);\n\n const resolvedPaths = paths.map(([key, paths]) => {\n return [key, paths.map(v => path.resolve(cwd, v))] as const;\n });\n\n return Object.fromEntries(resolvedPaths);\n }\n\n if (options.extends) {\n const extendsPath = path.resolve(cwd, options.extends);\n const extendsDir = path.dirname(extendsPath);\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const extendsConfig = require(extendsPath);\n\n return resolvePathsConfig(extendsConfig, extendsDir);\n }\n\n return [];\n}\n\n/**\n * Forces `esbuild` to always use the TS compiler paths, even when we are\n * bundling a local dependency of a local dependency, ensuring maximum\n * tree-shaking. Note: `esbuild` has some support for this, though it is limited\n * in the amount of dependency nesting it supports.\n */\nexport const resolvePathsPlugin: esbuild.Plugin = {\n name: \"storm:resolve-paths\",\n setup(build) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parentTsConfig = require(\n `${process.cwd()}/${build.initialOptions.tsconfig}`\n );\n const resolvedTsPaths = resolvePathsConfig(parentTsConfig, process.cwd());\n const packagesRegex = new RegExp(\n `^(${Object.keys(resolvedTsPaths).join(\"|\")})$`\n );\n\n build.onResolve({ filter: packagesRegex }, args => {\n if (build.initialOptions.external?.includes(args.path)) {\n return { path: args.path, external: true };\n }\n\n return { path: `${resolvedTsPaths[args.path][0]}/index.ts` };\n });\n }\n};\n"],"mappings":";;;;;;AAkBA,OAAOA,UAAU;AAgBjB,SAASC,mBAAmBC,SAAmBC,KAAW;AACxD,MAAID,SAASE,iBAAiBC,OAAO;AACnC,UAAMA,QAAQC,OAAOC,QAAQL,QAAQE,gBAAgBC,KAAK;AAE1D,UAAMG,gBAAgBH,MAAMI,IAAI,CAAC,CAACC,KAAKL,MAAAA,MAAM;AAC3C,aAAO;QAACK;QAAKL,OAAMI,IAAIE,CAAAA,MAAKC,KAAKC,QAAQV,KAAKQ,CAAAA,CAAAA;;IAChD,CAAA;AAEA,WAAOL,OAAOQ,YAAYN,aAAAA;EAC5B;AAEA,MAAIN,QAAQa,SAAS;AACnB,UAAMC,cAAcJ,KAAKC,QAAQV,KAAKD,QAAQa,OAAO;AACrD,UAAME,aAAaL,KAAKM,QAAQF,WAAAA;AAEhC,UAAMG,gBAAgBC,UAAQJ,WAAAA;AAE9B,WAAOf,mBAAmBkB,eAAeF,UAAAA;EAC3C;AAEA,SAAO,CAAA;AACT;AArBShB;AA6BF,IAAMoB,qBAAqC;EAChDC,MAAM;EACNC,MAAMC,OAAK;AAET,UAAMC,iBAAiBL,UACrB,GAAGM,QAAQvB,IAAG,CAAA,IAAMqB,MAAMG,eAAeC,QAAQ,EAAE;AAErD,UAAMC,kBAAkB5B,mBAAmBwB,gBAAgBC,QAAQvB,IAAG,CAAA;AACtE,UAAM2B,gBAAgB,IAAIC,OACxB,KAAKzB,OAAO0B,KAAKH,eAAAA,EAAiBI,KAAK,GAAA,CAAA,IAAQ;AAGjDT,UAAMU,UAAU;MAAEC,QAAQL;IAAc,GAAGM,CAAAA,SAAAA;AACzC,UAAIZ,MAAMG,eAAeU,UAAUC,SAASF,KAAKxB,IAAI,GAAG;AACtD,eAAO;UAAEA,MAAMwB,KAAKxB;UAAMyB,UAAU;QAAK;MAC3C;AAEA,aAAO;QAAEzB,MAAM,GAAGiB,gBAAgBO,KAAKxB,IAAI,EAAE,CAAA,CAAE;MAAY;IAC7D,CAAA;EACF;AACF;","names":["path","resolvePathsConfig","options","cwd","compilerOptions","paths","Object","entries","resolvedPaths","map","key","v","path","resolve","fromEntries","extends","extendsPath","extendsDir","dirname","extendsConfig","require","resolvePathsPlugin","name","setup","build","parentTsConfig","process","initialOptions","tsconfig","resolvedTsPaths","packagesRegex","RegExp","keys","join","onResolve","filter","args","external","includes"]}
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+ export {
11
+ __name,
12
+ __require
13
+ };
14
+ //# sourceMappingURL=chunk-WCQVDF3K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+
11
+
12
+
13
+ exports.__name = __name; exports.__require = __require;
14
+ //# sourceMappingURL=chunk-WGEGR3DF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-WGEGR3DF.cjs"],"names":[],"mappings":"AAAA,6EAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACxF,IAAI,UAAU,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,QAAQ,IAAI,YAAY,EAAE,QAAQ,EAAE,OAAO,MAAM,IAAI,YAAY,EAAE,IAAI,KAAK,CAAC,CAAC,EAAE;AAC/H,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,QAAQ,IAAI,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE;AACpB,EAAE,GAAG,CAAC,OAAO,QAAQ,IAAI,WAAW,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AAC3E,EAAE,MAAM,KAAK,CAAC,uBAAuB,EAAE,EAAE,EAAE,oBAAoB,CAAC;AAChE,CAAC,CAAC;AACF;AACA;AACE;AACA;AACF,uDAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-WGEGR3DF.cjs"}
@@ -0,0 +1,29 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-WCQVDF3K.js";
4
+
5
+ // src/plugins/fix-imports.ts
6
+ var fixImportsPlugin = {
7
+ name: "storm:fix-imports",
8
+ setup(build) {
9
+ build.onResolve({
10
+ filter: /^spdx-exceptions/
11
+ }, () => {
12
+ return {
13
+ path: __require.resolve("spdx-exceptions")
14
+ };
15
+ });
16
+ build.onResolve({
17
+ filter: /^spdx-license-ids/
18
+ }, () => {
19
+ return {
20
+ path: __require.resolve("spdx-license-ids")
21
+ };
22
+ });
23
+ }
24
+ };
25
+
26
+ export {
27
+ fixImportsPlugin
28
+ };
29
+ //# sourceMappingURL=chunk-YQBU3FSL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/fix-imports.ts"],"sourcesContent":["/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport type * as esbuild from \"esbuild\";\n\n/**\n * For dependencies that forgot to add them into their package.json.\n */\nexport const fixImportsPlugin: esbuild.Plugin = {\n name: \"storm:fix-imports\",\n setup(build) {\n build.onResolve({ filter: /^spdx-exceptions/ }, () => {\n return { path: require.resolve(\"spdx-exceptions\") };\n });\n build.onResolve({ filter: /^spdx-license-ids/ }, () => {\n return { path: require.resolve(\"spdx-license-ids\") };\n });\n }\n};\n"],"mappings":";;;;;AAsBO,IAAMA,mBAAmC;EAC9CC,MAAM;EACNC,MAAMC,OAAK;AACTA,UAAMC,UAAU;MAAEC,QAAQ;IAAmB,GAAG,MAAA;AAC9C,aAAO;QAAEC,MAAMC,UAAQC,QAAQ,iBAAA;MAAmB;IACpD,CAAA;AACAL,UAAMC,UAAU;MAAEC,QAAQ;IAAoB,GAAG,MAAA;AAC/C,aAAO;QAAEC,MAAMC,UAAQC,QAAQ,kBAAA;MAAoB;IACrD,CAAA;EACF;AACF;","names":["fixImportsPlugin","name","setup","build","onResolve","filter","path","require","resolve"]}
@@ -0,0 +1,102 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
4
+
5
+
6
+
7
+ var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
8
+
9
+ // src/plugins/deps-check.ts
10
+ var _module = require('module');
11
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
12
+ var unusedIgnore = [
13
+ // these are our dev dependencies
14
+ /@types\/.*?/,
15
+ /@typescript-eslint.*?/,
16
+ /eslint.*?/,
17
+ "esbuild",
18
+ "husky",
19
+ "is-ci",
20
+ "lint-staged",
21
+ "prettier",
22
+ "typescript",
23
+ "ts-node",
24
+ "ts-jest",
25
+ "@swc/core",
26
+ "@swc/jest",
27
+ "jest",
28
+ // these are missing 3rd party deps
29
+ "spdx-exceptions",
30
+ "spdx-license-ids",
31
+ // type-only, so it is not detected
32
+ "ts-toolbelt",
33
+ // these are indirectly used by build
34
+ "buffer"
35
+ ];
36
+ var missingIgnore = [
37
+ ".prisma",
38
+ "@prisma/client",
39
+ "ts-toolbelt"
40
+ ];
41
+ var depsCheckPlugin = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (bundle) => ({
42
+ name: "storm:deps-check",
43
+ setup(build) {
44
+ const pkgJsonPath = _path2.default.join(process.cwd(), "package.json");
45
+ const pkgContents = _chunkWGEGR3DFcjs.__require.call(void 0, pkgJsonPath);
46
+ const regDependencies = Object.keys(_nullishCoalesce(pkgContents["dependencies"], () => ( {})));
47
+ const devDependencies = Object.keys(_nullishCoalesce(pkgContents["devDependencies"], () => ( {})));
48
+ const peerDependencies = Object.keys(_nullishCoalesce(pkgContents["peerDependencies"], () => ( {})));
49
+ const dependencies = [
50
+ ...regDependencies,
51
+ ...bundle ? devDependencies : []
52
+ ];
53
+ const collectedDependencies = /* @__PURE__ */ new Set();
54
+ const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
55
+ build.onResolve({
56
+ filter: onlyPackages
57
+ }, (args) => {
58
+ if (args.importer.includes(process.cwd())) {
59
+ if (args.path[0] === "@") {
60
+ const [org, pkg] = args.path.split("/");
61
+ collectedDependencies.add(`${org}/${pkg}`);
62
+ } else {
63
+ const [pkg] = args.path.split("/");
64
+ collectedDependencies.add(pkg);
65
+ }
66
+ }
67
+ return {
68
+ external: true
69
+ };
70
+ });
71
+ build.onEnd(() => {
72
+ const unusedDependencies = [
73
+ ...dependencies
74
+ ].filter((dep) => {
75
+ return !collectedDependencies.has(dep) || _module.builtinModules.includes(dep);
76
+ });
77
+ const missingDependencies = [
78
+ ...collectedDependencies
79
+ ].filter((dep) => {
80
+ return !dependencies.includes(dep) && !_module.builtinModules.includes(dep);
81
+ });
82
+ const filteredUnusedDeps = unusedDependencies.filter((dep) => {
83
+ return !unusedIgnore.some((pattern) => dep.match(pattern));
84
+ });
85
+ const filteredMissingDeps = missingDependencies.filter((dep) => {
86
+ return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
87
+ });
88
+ _chunk4ZPYEZJOcjs.writeLog.call(void 0, "warn", `unusedDependencies: ${JSON.stringify(filteredUnusedDeps)}`);
89
+ _chunk4ZPYEZJOcjs.writeLog.call(void 0, "warn", `missingDependencies: ${JSON.stringify(filteredMissingDeps)}`);
90
+ if (filteredMissingDeps.length > 0) {
91
+ throw new Error(`Missing dependencies detected - please install them:
92
+ ${JSON.stringify(filteredMissingDeps)}
93
+ `);
94
+ }
95
+ });
96
+ }
97
+ }), "depsCheckPlugin");
98
+
99
+
100
+
101
+ exports.depsCheckPlugin = depsCheckPlugin;
102
+ //# sourceMappingURL=chunk-Z2M426LD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-Z2M426LD.cjs","../src/plugins/deps-check.ts"],"names":["unusedIgnore","missingIgnore","depsCheckPlugin","bundle","name","setup","build","pkgJsonPath","path","join","process","cwd","pkgContents","require","regDependencies","Object","keys","devDependencies","peerDependencies","dependencies","collectedDependencies","Set","onlyPackages","onResolve","filter","args","importer","includes","org","pkg","split","add","dep","unusedDependencies","pattern","missingDependencies","length","filteredMissingDeps"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACUA,gCAA+B;AAC/B,wEAAiB;AAKjB,IAAMA,aAAAA,EAAe;ADZrB;AACA,ECaE,aAAA;ADZF,ECaE,uBAAA;ADZF,ECaE,WAAA;ADZF,ECaE,SAAA;ADZF,ECaE,OAAA;ADZF,ECaE,OAAA;ADZF,ECaE,aAAA;ADZF,ECaE,UAAA;ADZF,ECaE,YAAA;ADZF,ECaE,SAAA;ADZF,ECaE,SAAA;ADZF,ECaE,WAAA;ADZF,ECaE,WAAA;ADZF,ECaE,MAAA;ADZF;AACA,ECcE,iBAAA;ADbF,ECcE,kBAAA;ADbF;AACA,ECeE,aAAA;ADdF;AACA,ECgBE;ADfF,CAAC;ACmBD,IAAMC,cAAAA,EAAgB;ADjBtB,ECiBuB,SAAA;ADhBvB,ECgBkC,gBAAA;ADflC,ECeoD;ADdpD,CAAC;ACmBM,IAAMC,gBAAAA,kBAAkB,sCAAA,CAACC,MAAAA,EAAAA,GAAAA,CAAsC;ADjBtE,ECkBEC,IAAAA,EAAM,kBAAA;ADjBR,ECkBEC,KAAAA,CAAMC,KAAAA,EAAK;AAET,IAAA,MAAMC,YAAAA,EAAcC,cAAAA,CAAKC,IAAAA,CAAKC,OAAAA,CAAQC,GAAAA,CAAG,CAAA,EAAI,cAAA,CAAA;AAE7C,IAAA,MAAMC,YAAAA,EAAcC,yCAAAA,WAAQN,CAAAA;AAC5B,IAAA,MAAMO,gBAAAA,EAAkBC,MAAAA,CAAOC,IAAAA,kBAAKJ,WAAAA,CAAY,cAAA,CAAA,UAAmB,CAAC,GAAA,CAAA;AACpE,IAAA,MAAMK,gBAAAA,EAAkBF,MAAAA,CAAOC,IAAAA,kBAAKJ,WAAAA,CAAY,iBAAA,CAAA,UAAsB,CAAC,GAAA,CAAA;AACvE,IAAA,MAAMM,iBAAAA,EAAmBH,MAAAA,CAAOC,IAAAA,kBAAKJ,WAAAA,CAAY,kBAAA,CAAA,UAAuB,CAAC,GAAA,CAAA;AACzE,IAAA,MAAMO,aAAAA,EAAe;ADnBzB,MAAM,GCoBGL,eAAAA;ADnBT,MAAM,GCoBIX,OAAAA,EAASc,gBAAAA,EAAkB,CAAA;ADnBrC,IAAI,CAAC;ACuBD,IAAA,MAAMG,sBAAAA,kBAAwB,IAAIC,GAAAA,CAAAA,CAAAA;AAClC,IAAA,MAAMC,aAAAA,EAAe,gCAAA;AACrBhB,IAAAA,KAAAA,CAAMiB,SAAAA,CAAU;ADrBpB,MCqBsBC,MAAAA,EAAQF;ADpB9B,ICoB2C,CAAA,EAAGG,CAAAA,IAAAA,EAAAA,GAAAA;AAExC,MAAA,GAAA,CAAIA,IAAAA,CAAKC,QAAAA,CAASC,QAAAA,CAASjB,OAAAA,CAAQC,GAAAA,CAAG,CAAA,CAAA,EAAK;AAEzC,QAAA,GAAA,CAAIc,IAAAA,CAAKjB,IAAAA,CAAK,CAAA,EAAA,IAAO,GAAA,EAAK;AAExB,UAAA,MAAM,CAACoB,GAAAA,EAAKC,GAAAA,EAAAA,EAAOJ,IAAAA,CAAKjB,IAAAA,CAAKsB,KAAAA,CAAM,GAAA,CAAA;AACnCV,UAAAA,qBAAAA,CAAsBW,GAAAA,CAAI,CAAA,EAAA;AACrB,QAAA;AAEmBD,UAAAA;AACED,UAAAA;AAC5B,QAAA;AACF,MAAA;AAEO,MAAA;AAAY,QAAA;AAAK,MAAA;AAC1B,IAAA;AAEY,IAAA;AAEiB,MAAA;AAAIV,QAAAA;AAAqBa,MAAAA;AAC1CZ,QAAAA;AACV,MAAA;AAG4B,MAAA;AAAIA,QAAAA;AAA8BY,MAAAA;AACvCL,QAAAA;AACvB,MAAA;AAG2BM,MAAAA;AACCC,QAAAA;AAC5B,MAAA;AAG4BC,MAAAA;AAEJD,QAAAA;AAGxB,MAAA;AAIE,MAAA;AAIA,MAAA;AAGsBE,MAAAA;AACN,QAAA;AACPC;AAChB;AACK,MAAA;AACF,IAAA;AACF,EAAA;AA3E6B;ADuCM;AACA;AACA;AACA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-Z2M426LD.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport type * as esbuild from \"esbuild\";\nimport { builtinModules } from \"node:module\";\nimport path from \"node:path\";\nimport { writeLog } from \"../utilities/log\";\n\n// packages that aren't detected but used\n// TODO: these could be scoped at the root\nconst unusedIgnore = [\n // these are our dev dependencies\n /@types\\/.*?/,\n /@typescript-eslint.*?/,\n /eslint.*?/,\n \"esbuild\",\n \"husky\",\n \"is-ci\",\n \"lint-staged\",\n \"prettier\",\n \"typescript\",\n \"ts-node\",\n \"ts-jest\",\n \"@swc/core\",\n \"@swc/jest\",\n \"jest\",\n\n // these are missing 3rd party deps\n \"spdx-exceptions\",\n \"spdx-license-ids\",\n\n // type-only, so it is not detected\n \"ts-toolbelt\",\n\n // these are indirectly used by build\n \"buffer\"\n];\n\n// packages that aren't missing but are detected\nconst missingIgnore = [\".prisma\", \"@prisma/client\", \"ts-toolbelt\"];\n\n/**\n * Checks for unused and missing dependencies.\n */\nexport const depsCheckPlugin = (bundle?: boolean): esbuild.Plugin => ({\n name: \"storm:deps-check\",\n setup(build) {\n // we load the package.json of the project do do our analysis\n const pkgJsonPath = path.join(process.cwd(), \"package.json\");\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const pkgContents = require(pkgJsonPath) as Record<string, object>;\n const regDependencies = Object.keys(pkgContents[\"dependencies\"] ?? {});\n const devDependencies = Object.keys(pkgContents[\"devDependencies\"] ?? {});\n const peerDependencies = Object.keys(pkgContents[\"peerDependencies\"] ?? {});\n const dependencies = [\n ...regDependencies,\n ...(bundle ? devDependencies : [])\n ];\n\n // we prepare to collect dependencies that are only packages\n const collectedDependencies = new Set<string>();\n const onlyPackages = /^[^./](?!:)|^\\.[^./]|^\\.\\.[^/]/;\n build.onResolve({ filter: onlyPackages }, args => {\n // we limit this search to the parent folder, don't go back\n if (args.importer.includes(process.cwd())) {\n // handle cases where there is extra path @org/pkg/folder\n if (args.path[0] === \"@\") {\n // we have a package that lives in org's scope, trim it\n const [org, pkg] = args.path.split(\"/\");\n collectedDependencies.add(`${org}/${pkg}`);\n } else {\n // we have a regular package without scope, we trim it\n const [pkg] = args.path.split(\"/\");\n collectedDependencies.add(pkg!);\n }\n }\n\n return { external: true }; // we don't care for the bundling\n });\n\n build.onEnd(() => {\n // we take all the dependencies that aren't collected and are native\n const unusedDependencies = [...dependencies].filter(dep => {\n return !collectedDependencies.has(dep) || builtinModules.includes(dep);\n });\n\n // we take all the collected deps that aren't deps and aren't native\n const missingDependencies = [...collectedDependencies].filter(dep => {\n return !dependencies.includes(dep) && !builtinModules.includes(dep);\n });\n\n // we exclude the deps that match our unusedIgnore patterns\n const filteredUnusedDeps = unusedDependencies.filter(dep => {\n return !unusedIgnore.some(pattern => dep.match(pattern));\n });\n\n // we exclude the deps that match our unusedIgnore patterns\n const filteredMissingDeps = missingDependencies.filter(dep => {\n return (\n !missingIgnore.some(pattern => dep.match(pattern)) &&\n !peerDependencies.includes(dep)\n );\n });\n\n writeLog(\n \"warn\",\n `unusedDependencies: ${JSON.stringify(filteredUnusedDeps)}`\n );\n writeLog(\n \"warn\",\n `missingDependencies: ${JSON.stringify(filteredMissingDeps)}`\n );\n\n if (filteredMissingDeps.length > 0) {\n throw new Error(`Missing dependencies detected - please install them:\n${JSON.stringify(filteredMissingDeps)}\n`);\n }\n });\n }\n});\n"]}
@@ -0,0 +1,15 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-WCQVDF3K.js";
4
+
5
+ // src/utilities/log.ts
6
+ import { consola } from "consola";
7
+ function writeLog(type, ...args) {
8
+ consola[type]("[Storm]", ...args);
9
+ }
10
+ __name(writeLog, "writeLog");
11
+
12
+ export {
13
+ writeLog
14
+ };
15
+ //# sourceMappingURL=chunk-ZQ5NVDFP.js.map