@storm-software/esbuild 0.1.0 → 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.
- package/dist/build.cjs +11 -10
- package/dist/build.cjs.map +1 -0
- package/dist/build.js +10 -9
- package/dist/build.js.map +1 -0
- package/dist/{chunk-RJQ3LCGJ.cjs → chunk-4ZPYEZJO.cjs} +3 -2
- package/dist/chunk-4ZPYEZJO.cjs.map +1 -0
- package/dist/{chunk-5S2XTAF2.cjs → chunk-75SHW3Z4.cjs} +73 -90
- package/dist/chunk-75SHW3Z4.cjs.map +1 -0
- package/dist/{chunk-PCGRI6Z6.js → chunk-7U3F23ZZ.js} +3 -2
- package/dist/chunk-7U3F23ZZ.js.map +1 -0
- package/dist/{chunk-WLHWKRZB.cjs → chunk-BF5W6GVP.cjs} +5 -4
- package/dist/chunk-BF5W6GVP.cjs.map +1 -0
- package/dist/{chunk-RKSGVSXZ.js → chunk-CMF37LBT.js} +2 -1
- package/dist/chunk-CMF37LBT.js.map +1 -0
- package/dist/{chunk-NVGEXPTG.cjs → chunk-D5PRB2E2.cjs} +1 -0
- package/dist/chunk-D5PRB2E2.cjs.map +1 -0
- package/dist/{chunk-3C3PXJUM.cjs → chunk-DFGHPRBD.cjs} +4 -3
- package/dist/chunk-DFGHPRBD.cjs.map +1 -0
- package/dist/{chunk-ELGZJRET.js → chunk-DRRPNILS.js} +1 -0
- package/dist/chunk-DRRPNILS.js.map +1 -0
- package/dist/{chunk-YGD5JBOH.js → chunk-IDO67KEL.js} +50 -67
- package/dist/chunk-IDO67KEL.js.map +1 -0
- package/dist/chunk-MUYXFAKB.cjs +1 -0
- package/dist/chunk-MUYXFAKB.cjs.map +1 -0
- package/dist/{chunk-DCWECOOS.cjs → chunk-PRNPZZSV.cjs} +3 -2
- package/dist/chunk-PRNPZZSV.cjs.map +1 -0
- package/dist/{chunk-5JHKW6MG.js → chunk-QBYHNHXL.js} +3 -2
- package/dist/chunk-QBYHNHXL.js.map +1 -0
- package/dist/chunk-QNDLJ2W7.js +1 -0
- package/dist/chunk-QNDLJ2W7.js.map +1 -0
- package/dist/{chunk-A6CGWMV7.cjs → chunk-T5H2LBQA.cjs} +10 -9
- package/dist/chunk-T5H2LBQA.cjs.map +1 -0
- package/dist/{chunk-4TW4ZA3I.js → chunk-TTHABTDU.js} +2 -1
- package/dist/chunk-TTHABTDU.js.map +1 -0
- package/dist/{chunk-3GQAWCBQ.js → chunk-WCQVDF3K.js} +1 -0
- package/dist/chunk-WCQVDF3K.js.map +1 -0
- package/dist/{chunk-BGYQAVKQ.cjs → chunk-WGEGR3DF.cjs} +1 -0
- package/dist/chunk-WGEGR3DF.cjs.map +1 -0
- package/dist/{chunk-LVDPGHWK.js → chunk-YQBU3FSL.js} +2 -1
- package/dist/chunk-YQBU3FSL.js.map +1 -0
- package/dist/{chunk-MTKAAECG.cjs → chunk-Z2M426LD.cjs} +7 -6
- package/dist/chunk-Z2M426LD.cjs.map +1 -0
- package/dist/{chunk-YIAZ64WG.js → chunk-ZQ5NVDFP.js} +2 -1
- package/dist/chunk-ZQ5NVDFP.js.map +1 -0
- package/dist/config.cjs +4 -3
- package/dist/config.cjs.map +1 -0
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -0
- package/dist/types.cjs +2 -1
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -0
- package/package.json +11 -1
- package/dist/chunk-GGNOJ77I.js +0 -0
- package/dist/chunk-SFZRYJZ2.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
|
|
4
4
|
|
|
5
5
|
// src/plugins/fix-imports.ts
|
|
6
6
|
var fixImportsPlugin = {
|
|
@@ -10,14 +10,14 @@ var fixImportsPlugin = {
|
|
|
10
10
|
filter: /^spdx-exceptions/
|
|
11
11
|
}, () => {
|
|
12
12
|
return {
|
|
13
|
-
path:
|
|
13
|
+
path: _chunkWGEGR3DFcjs.__require.resolve("spdx-exceptions")
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
16
|
build.onResolve({
|
|
17
17
|
filter: /^spdx-license-ids/
|
|
18
18
|
}, () => {
|
|
19
19
|
return {
|
|
20
|
-
path:
|
|
20
|
+
path: _chunkWGEGR3DFcjs.__require.resolve("spdx-license-ids")
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -26,3 +26,4 @@ var fixImportsPlugin = {
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
exports.fixImportsPlugin = fixImportsPlugin;
|
|
29
|
+
//# sourceMappingURL=chunk-DFGHPRBD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-DFGHPRBD.cjs","../src/plugins/fix-imports.ts"],"names":["fixImportsPlugin","name","setup","build","onResolve","filter","path","require","resolve"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACkBO,IAAMA,iBAAAA,EAAmC;ADhBhD,ECiBEC,IAAAA,EAAM,mBAAA;ADhBR,ECiBEC,KAAAA,CAAMC,KAAAA,EAAK;AACTA,IAAAA,KAAAA,CAAMC,SAAAA,CAAU;ADhBpB,MCgBsBC,MAAAA,EAAQ;ADf9B,ICeiD,CAAA,EAAG,CAAA,EAAA,GAAA;AAC9C,MAAA,OAAO;ADdb,QCceC,IAAAA,EAAMC,2BAAAA,CAAQC,OAAAA,CAAQ,iBAAA;ADbrC,MCawD,CAAA;ADZxD,ICaI,CAAA,CAAA;AACAL,IAAAA,KAAAA,CAAMC,SAAAA,CAAU;ADZpB,MCYsBC,MAAAA,EAAQ;ADX9B,ICWkD,CAAA,EAAG,CAAA,EAAA,GAAA;AAC/C,MAAA,OAAO;ADVb,QCUeC,IAAAA,EAAMC,2BAAAA,CAAQC,OAAAA,CAAQ,kBAAA;ADTrC,MCSyD,CAAA;ADRzD,ICSI,CAAA,CAAA;ADRJ,ECSE;AACF,CAAA;ADRA;AACA;AACE;AACF,4CAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-DFGHPRBD.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\";\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.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 { ESBuildOptions } from \"./types\";\n\nexport const DEFAULT_BUILD_OPTIONS = {\n platform: \"node\",\n target: \"ES2021\",\n logLevel: \"error\",\n tsconfig: \"tsconfig.json\",\n metafile: true\n} as const;\n\nexport const adapterConfig: Omit<ESBuildOptions, \"projectRoot\">[] = [\n {\n name: \"cjs\",\n format: \"cjs\",\n bundle: true,\n entryPoints: [\"src/index.ts\"],\n outExtension: { \".js\": \".js\" },\n emitTypes: true\n },\n {\n name: \"esm\",\n format: \"esm\",\n bundle: true,\n entryPoints: [\"src/index.ts\"],\n outExtension: { \".js\": \".mjs\" },\n emitTypes: true\n }\n];\n"],"mappings":";AAmBO,IAAMA,wBAAwB;EACnCC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,UAAU;AACZ;AAEO,IAAMC,gBAAuD;EAClE;IACEC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,aAAa;MAAC;;IACdC,cAAc;MAAE,OAAO;IAAM;IAC7BC,WAAW;EACb;EACA;IACEL,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,aAAa;MAAC;;IACdC,cAAc;MAAE,OAAO;IAAO;IAC9BC,WAAW;EACb;;","names":["DEFAULT_BUILD_OPTIONS","platform","target","logLevel","tsconfig","metafile","adapterConfig","name","format","bundle","entryPoints","outExtension","emitTypes"]}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
onErrorPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CMF37LBT.js";
|
|
4
4
|
import {
|
|
5
5
|
resolvePathsPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TTHABTDU.js";
|
|
7
7
|
import {
|
|
8
8
|
tscPlugin
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QBYHNHXL.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_BUILD_OPTIONS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DRRPNILS.js";
|
|
13
13
|
import {
|
|
14
14
|
depsCheckPlugin
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7U3F23ZZ.js";
|
|
16
16
|
import {
|
|
17
17
|
writeLog
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZQ5NVDFP.js";
|
|
19
19
|
import {
|
|
20
20
|
fixImportsPlugin
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YQBU3FSL.js";
|
|
22
22
|
import {
|
|
23
23
|
__name
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WCQVDF3K.js";
|
|
25
25
|
|
|
26
26
|
// src/build.ts
|
|
27
27
|
import { hfs } from "@humanfs/node";
|
|
28
|
-
import { createProjectGraphAsync, joinPathFragments,
|
|
29
|
-
import {
|
|
28
|
+
import { createProjectGraphAsync, joinPathFragments, readProjectsConfigurationFromProjectGraph, writeJsonFile } from "@nx/devkit";
|
|
29
|
+
import { addPackageDependencies, addPackageJsonExport, addWorkspacePackageJsonFields } from "@storm-software/build-tools";
|
|
30
|
+
import { loadStormConfig } from "@storm-software/config-tools";
|
|
30
31
|
import { watch as createWatcher } from "chokidar";
|
|
31
32
|
import { debounce, flatten, omit } from "es-toolkit";
|
|
32
33
|
import { map } from "es-toolkit/compat";
|
|
33
34
|
import * as esbuild from "esbuild";
|
|
34
35
|
import { globbySync } from "globby";
|
|
35
|
-
import { existsSync } from "node:fs";
|
|
36
36
|
import { findWorkspaceRoot } from "nx/src/utils/find-workspace-root";
|
|
37
37
|
|
|
38
38
|
// src/utilities/helpers.ts
|
|
@@ -143,16 +143,14 @@ var resolveOptions = /* @__PURE__ */ __name(async (options) => {
|
|
|
143
143
|
".js",
|
|
144
144
|
".node"
|
|
145
145
|
],
|
|
146
|
-
entryPoints: globbySync("./src/**/*.{j,t}s", {
|
|
147
|
-
ignore: [
|
|
148
|
-
"./src/__tests__/**/*"
|
|
149
|
-
]
|
|
150
|
-
}),
|
|
151
146
|
mainFields: [
|
|
152
147
|
"module",
|
|
153
148
|
"main"
|
|
154
149
|
],
|
|
155
150
|
...options,
|
|
151
|
+
entryPoints: options.entryPoints || [
|
|
152
|
+
"./src/index.ts"
|
|
153
|
+
],
|
|
156
154
|
outdir: options.outdir || joinPathFragments(workspaceRoot.dir, "dist", projectRoot),
|
|
157
155
|
plugins: [
|
|
158
156
|
...options.plugins ?? [],
|
|
@@ -168,67 +166,51 @@ var resolveOptions = /* @__PURE__ */ __name(async (options) => {
|
|
|
168
166
|
projectConfigurations,
|
|
169
167
|
projectName,
|
|
170
168
|
projectGraph,
|
|
171
|
-
workspaceRoot
|
|
169
|
+
workspaceRoot,
|
|
170
|
+
sourceRoot: options.sourceRoot || joinPathFragments(workspaceRoot.dir, projectRoot, "src")
|
|
172
171
|
};
|
|
173
172
|
}, "resolveOptions");
|
|
174
173
|
var generatePackageJson = /* @__PURE__ */ __name(async (options) => {
|
|
175
|
-
const
|
|
176
|
-
if (!await hfs.isFile(nxJsonPath)) {
|
|
177
|
-
throw new Error("Cannot find Nx workspace configuration");
|
|
178
|
-
}
|
|
179
|
-
const projectJsonPath = joinPathFragments(options.workspaceRoot.dir, options.projectRoot, "project.json");
|
|
180
|
-
if (!await hfs.isFile(projectJsonPath)) {
|
|
181
|
-
throw new Error("Cannot find project.json configuration");
|
|
182
|
-
}
|
|
183
|
-
if (!options.projectConfigurations?.projects?.[options.projectName]) {
|
|
184
|
-
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
185
|
-
}
|
|
174
|
+
const config = await loadStormConfig();
|
|
186
175
|
const packageJsonPath = joinPathFragments(options.projectRoot, "project.json");
|
|
187
176
|
if (!await hfs.isFile(packageJsonPath)) {
|
|
188
177
|
throw new Error("Cannot find package.json configuration");
|
|
189
178
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
}
|
|
179
|
+
let packageJson = await hfs.json(joinPathFragments(options.workspaceRoot.dir, options.projectRoot, "package.json"));
|
|
180
|
+
if (!packageJson) {
|
|
181
|
+
throw new Error("Cannot find package.json configuration file");
|
|
182
|
+
}
|
|
183
|
+
packageJson = await addPackageDependencies(options.workspaceRoot.dir, options.projectRoot, options.projectName, packageJson);
|
|
184
|
+
packageJson = await addWorkspacePackageJsonFields(config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
|
|
185
|
+
let entryPoints = [
|
|
186
|
+
{
|
|
187
|
+
in: "./src/index.ts",
|
|
188
|
+
out: "./src/index.ts"
|
|
202
189
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
packageJson.
|
|
222
|
-
if (!ret[localPackage.name]) {
|
|
223
|
-
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
224
|
-
}
|
|
225
|
-
return ret;
|
|
226
|
-
}, packageJson.peerDependencies ?? {});
|
|
227
|
-
} else {
|
|
228
|
-
writeLog("trace", "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
190
|
+
];
|
|
191
|
+
if (options.entryPoints) {
|
|
192
|
+
if (Array.isArray(options.entryPoints)) {
|
|
193
|
+
entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
|
|
194
|
+
in: entryPoint,
|
|
195
|
+
out: entryPoint
|
|
196
|
+
} : entryPoint);
|
|
197
|
+
} else {
|
|
198
|
+
entryPoints = Object.entries(options.entryPoints).map(([key, value]) => ({
|
|
199
|
+
in: key,
|
|
200
|
+
out: value
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
for (const entryPoint of entryPoints) {
|
|
205
|
+
const split = entryPoint.out.split(".");
|
|
206
|
+
split.pop();
|
|
207
|
+
const entry = split.join(".").replaceAll("\\", "/");
|
|
208
|
+
packageJson.entry[`./${entry}`] ??= addPackageJsonExport(entry);
|
|
229
209
|
}
|
|
210
|
+
packageJson.entry["./package.json"] = "./package.json";
|
|
211
|
+
packageJson.entry["."] ??= addPackageJsonExport("./src/index.ts");
|
|
230
212
|
packageJson.main = "./dist/index.cjs";
|
|
231
|
-
packageJson.module = "./dist/index.
|
|
213
|
+
packageJson.module = "./dist/index.js";
|
|
232
214
|
packageJson.types = "./dist/index.d.ts";
|
|
233
215
|
await writeJsonFile(joinPathFragments(options.outdir, "package.json"), packageJson);
|
|
234
216
|
return options;
|
|
@@ -335,3 +317,4 @@ export {
|
|
|
335
317
|
pipe,
|
|
336
318
|
build2 as build
|
|
337
319
|
};
|
|
320
|
+
//# sourceMappingURL=chunk-IDO67KEL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build.ts","../src/utilities/helpers.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 {\n createProjectGraphAsync,\n joinPathFragments,\n readProjectsConfigurationFromProjectGraph,\n writeJsonFile\n} from \"@nx/devkit\";\nimport {\n addPackageDependencies,\n addPackageJsonExport,\n addWorkspacePackageJsonFields\n} from \"@storm-software/build-tools\";\nimport { loadStormConfig } from \"@storm-software/config-tools\";\nimport { watch as createWatcher } from \"chokidar\";\nimport { debounce, flatten, omit } from \"es-toolkit\";\nimport { map } from \"es-toolkit/compat\";\nimport * as esbuild from \"esbuild\";\nimport { BuildContext } from \"esbuild\";\nimport { globbySync } from \"globby\";\nimport { findWorkspaceRoot } from \"nx/src/utils/find-workspace-root\";\nimport { DEFAULT_BUILD_OPTIONS } from \"./config\";\nimport { depsCheckPlugin } from \"./plugins/deps-check\";\nimport { fixImportsPlugin } from \"./plugins/fix-imports\";\nimport { onErrorPlugin } from \"./plugins/on-error\";\nimport { resolvePathsPlugin } from \"./plugins/resolve-paths\";\nimport { tscPlugin } from \"./plugins/tsc\";\nimport { ESBuildResolvedOptions, type ESBuildOptions } from \"./types\";\nimport { handle, pipe, transduce } from \"./utilities/helpers\";\nimport { writeLog } from \"./utilities/log\";\n\n/**\n * Apply defaults to the original build options\n *\n * @param options - the original build options\n * @returns the build options with defaults applied\n */\nconst resolveOptions = async (\n options: ESBuildOptions\n): Promise<ESBuildResolvedOptions> => {\n const projectRoot = options.projectRoot;\n\n const workspaceRoot = findWorkspaceRoot(projectRoot);\n if (!workspaceRoot) {\n throw new Error(\"Cannot find Nx workspace root\");\n }\n\n const nxJsonPath = joinPathFragments(workspaceRoot.dir, \"nx.json\");\n if (!(await hfs.isFile(nxJsonPath))) {\n throw new Error(\"Cannot find Nx workspace configuration\");\n }\n\n const projectGraph = await createProjectGraphAsync({\n exitOnError: true\n });\n\n const projectJsonPath = joinPathFragments(\n workspaceRoot.dir,\n projectRoot,\n \"project.json\"\n );\n if (!(await hfs.isFile(projectJsonPath))) {\n throw new Error(\"Cannot find project.json configuration\");\n }\n\n const projectJson = await hfs.json(projectJsonPath);\n const projectName = projectJson.name;\n\n const projectConfigurations =\n readProjectsConfigurationFromProjectGraph(projectGraph);\n if (!projectConfigurations?.projects?.[projectName]) {\n throw new Error(\n \"The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.\"\n );\n }\n\n // const packageJsonPath = joinPathFragments(projectRoot, \"project.json\");\n // if (!(await hfs.isFile(packageJsonPath))) {\n // throw new Error(\"Cannot find package.json configuration\");\n // }\n\n // const packageJson = await hfs.json(\n // joinPathFragments(workspaceRoot.dir, projectRoot, \"package.json\")\n // );\n\n return {\n ...DEFAULT_BUILD_OPTIONS,\n format: \"cjs\",\n outExtension: { \".js\": \".js\" },\n resolveExtensions: [\".ts\", \".js\", \".node\"],\n mainFields: [\"module\", \"main\"],\n ...options,\n entryPoints: options.entryPoints || [\"./src/index.ts\"],\n outdir:\n options.outdir ||\n joinPathFragments(workspaceRoot.dir, \"dist\", projectRoot),\n plugins: [\n ...(options.plugins ?? []),\n resolvePathsPlugin,\n fixImportsPlugin,\n tscPlugin(options.emitTypes),\n onErrorPlugin\n ],\n external: [...(options.external ?? [])],\n name: `${options.name || projectName}-${options.format || \"cjs\"}`,\n projectConfigurations,\n projectName,\n projectGraph,\n workspaceRoot,\n sourceRoot:\n options.sourceRoot ||\n joinPathFragments(workspaceRoot.dir, projectRoot, \"src\")\n };\n};\n\nconst generatePackageJson = async (options: ESBuildResolvedOptions) => {\n const config = await loadStormConfig();\n\n const packageJsonPath = joinPathFragments(\n options.projectRoot,\n \"project.json\"\n );\n if (!(await hfs.isFile(packageJsonPath))) {\n throw new Error(\"Cannot find package.json configuration\");\n }\n\n let packageJson = await hfs.json(\n joinPathFragments(\n options.workspaceRoot.dir,\n options.projectRoot,\n \"package.json\"\n )\n );\n if (!packageJson) {\n throw new Error(\"Cannot find package.json configuration file\");\n }\n\n packageJson = await addPackageDependencies(\n options.workspaceRoot.dir,\n options.projectRoot,\n options.projectName,\n packageJson\n );\n\n packageJson = await addWorkspacePackageJsonFields(\n config,\n options.projectRoot,\n options.sourceRoot,\n options.projectName,\n false,\n packageJson\n );\n\n let entryPoints = [{ in: \"./src/index.ts\", out: \"./src/index.ts\" }];\n if (options.entryPoints) {\n if (Array.isArray(options.entryPoints)) {\n entryPoints = (\n options.entryPoints as (string | { in: string; out: string })[]\n ).map(entryPoint =>\n typeof entryPoint === \"string\"\n ? { in: entryPoint, out: entryPoint }\n : entryPoint\n );\n } else {\n entryPoints = Object.entries(options.entryPoints).map(([key, value]) => ({\n in: key,\n out: value\n }));\n }\n }\n\n for (const entryPoint of entryPoints) {\n const split = entryPoint.out.split(\".\");\n split.pop();\n const entry = split.join(\".\").replaceAll(\"\\\\\", \"/\");\n\n packageJson.entry[`./${entry}`] ??= addPackageJsonExport(entry);\n }\n\n packageJson.entry[\"./package.json\"] = \"./package.json\";\n packageJson.entry[\".\"] ??= addPackageJsonExport(\"./src/index.ts\");\n\n packageJson.main = \"./dist/index.cjs\";\n packageJson.module = \"./dist/index.js\";\n packageJson.types = \"./dist/index.d.ts\";\n\n await writeJsonFile(\n joinPathFragments(options.outdir, \"package.json\"),\n packageJson\n );\n\n return options;\n};\n\n/**\n * Create two deferred builds for esm and cjs. The one follows the other:\n * - 1. The code gets compiled to an optimized tree-shaken esm output\n * - 2. We take that output and compile it to an optimized cjs output\n *\n * @param options - the original build options\n * @returns if options = [a, b], we get [a-esm, a-cjs, b-esm, b-cjs]\n */\nasync function createOptions(options: ESBuildOptions[]) {\n return flatten(\n await Promise.all(\n map(options, options => [\n // we defer it so that we don't trigger glob immediately\n () => resolveOptions(options)\n ])\n )\n );\n}\n\n/**\n * We only want to trigger the glob search once we are ready, and that is when\n * the previous build has finished. We get the build options from the deferred.\n */\nasync function computeOptions(\n options: () => Promise<ESBuildResolvedOptions>\n): Promise<ESBuildResolvedOptions> {\n return options();\n}\n\n// /**\n// * Extensions are not automatically by esbuild set for `options.outfile`. We\n// * look at the set `options.outExtension` and we add that to `options.outfile`.\n// */\n// function addExtensionFormat(options: ESBuildOptions) {\n// if (options.outfile && options.outExtension) {\n// const ext = options.outExtension[\".js\"];\n\n// options.outfile = `${options.outfile}${ext}`;\n// }\n\n// return options;\n// }\n\n// /**\n// * If we don't have `options.outfile`, we default `options.outdir`\n// */\n// function addDefaultOutDir(options: ESBuildOptions) {\n// if (options.outfile === undefined) {\n// options.outdir = getOutDir(options);\n// }\n\n// return options;\n// }\n\n/**\n * Execute esbuild with all the configurations we pass\n */\nasync function executeEsBuild(options: ESBuildResolvedOptions) {\n if (process.env.WATCH === \"true\") {\n const context = await esbuild.context(\n omit(options, [\"name\", \"emitTypes\", \"emitMetafile\"]) as any\n );\n\n watch(context, options);\n }\n\n const build = await esbuild.build(\n omit(options, [\"name\", \"emitTypes\", \"emitMetafile\"]) as any\n );\n\n if (build.metafile && options.emitMetafile) {\n const metafilePath = `${options.outdir}/${options.name}.meta.json`;\n await hfs.write(metafilePath, JSON.stringify(build.metafile));\n }\n\n return [options, build] as const;\n}\n\n/**\n * A blank esbuild run to do an analysis of our deps\n */\nasync function dependencyCheck(options: ESBuildResolvedOptions) {\n // we only check our dependencies for a full build\n if (process.env.DEV === \"true\") return undefined;\n // Only run on test and publish pipelines on Buildkite\n // Meaning we skip on GitHub Actions\n // Because it's slow and runs for each job, during setup, making each job slower\n if (process.env.CI && !process.env.BUILDKITE) return undefined;\n\n // we need to bundle everything to do the analysis\n const buildPromise = esbuild.build({\n entryPoints: globbySync(\"**/*.{j,t}s\", {\n // We don't check dependencies in ecosystem tests because tests are isolated from the build.\n ignore: [\"./src/__tests__/**/*\", \"./tests/e2e/**/*\", \"./dist/**/*\"],\n gitignore: true\n }),\n logLevel: \"silent\", // there will be errors\n bundle: true, // we bundle to get everything\n write: false, // no need to write for analysis\n outdir: \"out\",\n plugins: [depsCheckPlugin(options.bundle)]\n });\n\n // we absolutely don't care if it has any errors\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n await buildPromise.catch(() => {});\n\n return undefined;\n}\n\n/**\n * Execution pipeline that applies a set of actions\n *\n * @param options - the build options\n * @returns the build result\n */\nexport async function build(options: ESBuildOptions[]) {\n void transduce.async(options, dependencyCheck);\n\n return transduce.async(\n await createOptions(options),\n pipe.async(computeOptions, generatePackageJson, executeEsBuild)\n );\n}\n\n/**\n * Executes the build and rebuilds what is necessary\n *\n * @param context - the build context\n * @param options - the build options\n * @returns the build result\n */\nconst watch = (context: BuildContext, options: ESBuildResolvedOptions) => {\n if (process.env.WATCH !== \"true\") return context;\n\n // common chokidar options for the watchers\n const config = {\n ignoreInitial: true,\n useFsEvents: true,\n ignored: [\"./src/__tests__/**/*\", \"./package.json\"]\n };\n\n // prepare the incremental builds watcher\n const changeWatcher = createWatcher([\"./src/**/*\"], config);\n\n // triggers quick rebuild on file change\n const fastRebuild = debounce(async () => {\n const timeBefore = Date.now();\n\n // we handle possible rebuild exceptions\n const rebuildResult = await handle.async(() => {\n return context.rebuild();\n });\n\n if (rebuildResult instanceof Error) {\n writeLog(\"error\", rebuildResult.message);\n }\n\n writeLog(\"log\", `${Date.now() - timeBefore}ms [${options.name ?? \"\"}]`);\n }, 10);\n\n changeWatcher.on(\"change\", fastRebuild);\n\n return undefined;\n};\n\n// Utils ::::::::::::::::::::::::::::::::::::::::::::::::::\n\n// get the current project externals this helps to mark dependencies as external\n// by having convention in the package.json (dev = bundled, non-dev = external)\n// function getProjectExternals(options: ESBuildOptions) {\n// const pkg = require(`${process.cwd()}/package.json`);\n// const peerDeps = Object.keys(pkg.peerDependencies ?? {});\n// const regDeps = Object.keys(pkg.dependencies ?? {});\n\n// // when bundling, only the devDeps will be bundled\n// if (!process.env.IGNORE_EXTERNALS && options.bundle === true) {\n// return [...new Set([...peerDeps, ...regDeps])];\n// }\n\n// // otherwise, all the dependencies will be bundled\n// return [];\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\nfunction handleSync<R, E = Error>(fn: () => R): R | E {\n try {\n return fn();\n } catch (error_: unknown) {\n return error_ as E;\n }\n}\n\nasync function handleAsync<R, E = Error>(\n fn: () => Promise<R> | R\n): Promise<R | E> {\n try {\n return await fn();\n } catch (error_: unknown) {\n return error_ as E;\n }\n}\n\n/**\n * Executes a function, catches exceptions, and returns any outcome.\n * @param fn - to be executed\n */\nconst handle = handleSync as typeof handleSync & {\n async: typeof handleAsync;\n};\n\nhandle.async = handleAsync;\n\nexport { handle };\n\nconst skip = Symbol(\"skip\");\n\ntype SyncTransformer<I, R> = (item: I, key: number) => R | typeof skip;\ntype ASyncTransformer<I, R> = (\n item: I,\n key: number\n) => Promise<R | typeof skip>;\n\nfunction transduceSync<I, R>(\n list: Array<I>,\n transformer: SyncTransformer<I, R>\n) {\n const transduced = [] as R[];\n\n for (const [i, element_] of list.entries()) {\n const transformed = transformer(element_, i);\n\n if (transformed !== skip) {\n transduced[transduced.length] = transformed;\n }\n }\n\n return transduced;\n}\n\nasync function transduceAsync<I, R>(\n list: Array<I>,\n transformer: ASyncTransformer<I, R>\n) {\n const transduced = [] as R[];\n\n await Promise.all(\n list.entries().map(async ([i, element_]) => {\n const transformed = await transformer(element_, i);\n\n if (transformed !== skip) {\n transduced[transduced.length] = transformed;\n }\n })\n );\n\n return transduced;\n}\n\nconst Filter =\n <I>(filter: (item: I) => boolean) =>\n (item: I) => {\n return filter(item) ? item : (skip as never);\n };\n\nconst Mapper =\n <I, R>(mapper: (item: I) => R) =>\n (item: I) => {\n return mapper(item);\n };\n\n/**\n * Transducers enable efficient data processing. They allow the composition of\n * mappers and filters to be applied on a list. And this is applied in a single\n * pass, that's the efficient pipeline processing.\n *\n * (does not reduce at the same time)\n *\n * @see https://medium.com/javascript-scene/7985330fe73d\n *\n * @param list - to transform\n * @param transformer - to apply\n\n * @example\n * ```ts\n * const filterEven = Filter(<U>(unit: U) =>\n * typeof unit === 'number' ? !(unit % 2) : true,\n * )\n * const mapTimes2 = Mapper(<U>(unit: U) =>\n * typeof unit === 'number' ? unit * 2 : unit,\n * )\n * const mapString = Mapper(<U>(unit: U) => `${unit}`)\n *\n * const test0 = transduce(\n * [1, 2, 3, 4, 5, 6, 7, 'a'],\n * pipe(filterEven, mapTimes2, mapTimes2, mapString, filterEven),\n * )\n * ```\n */\nconst transduce = transduceSync as typeof transduceSync & {\n async: typeof transduceAsync;\n};\n\ntransduce.async = transduceAsync;\n\nexport { Filter, Mapper, skip, transduce };\n\ntype FunctionLike<P extends Array<any> = any, R = any> = (...args: P) => R;\ntype Await<P> = P extends Promise<infer A> ? A : P;\n\nfunction pipeSync(fn: FunctionLike, ...fns: FunctionLike[]) {\n return (...args: unknown[]) => {\n let result = fn(...args);\n\n for (let i = 0; result !== skip && i < fns.length; ++i) {\n result = fns[i]?.(result);\n }\n\n return result;\n };\n}\n\nfunction pipeAsync(fn: FunctionLike, ...fns: FunctionLike[]) {\n return async (...args: unknown[]) => {\n let result = await fn(...args);\n\n for (let i = 0; result !== skip && i < fns.length; ++i) {\n // eslint-disable-next-line no-await-in-loop\n result = await fns[i]?.(result);\n }\n\n return result;\n };\n}\n\n/**\n * Pipe the input and output of functions.\n *\n * @param fn - parameter-taking function\n * @param fns - subsequent piped functions\n * @returns\n */\nconst pipe = pipeSync as PipeMultiSync & {\n async: PipeMultiAsync;\n};\n\npipe.async = pipeAsync;\n\n// TODO: use the one from ts-toolbelt (broken atm since ts 4.1)\nexport declare type PipeMultiSync = {\n <R0, P extends any[]>(...fns: [FunctionLike<P, R0>]): FunctionLike<P, R0>;\n <R0, R1, P extends any[]>(\n ...fns: [FunctionLike<P, R0>, FunctionLike<[R0], R1>]\n ): FunctionLike<P, R1>;\n <R0, R1, R2, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>\n ]\n ): FunctionLike<P, R2>;\n <R0, R1, R2, R3, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>\n ]\n ): FunctionLike<P, R3>;\n <R0, R1, R2, R3, R4, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>\n ]\n ): FunctionLike<P, R4>;\n <R0, R1, R2, R3, R4, R5, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>\n ]\n ): FunctionLike<P, R5>;\n <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>\n ]\n ): FunctionLike<P, R6>;\n <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>\n ]\n ): FunctionLike<P, R7>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>,\n FunctionLike<[R7], R8>\n ]\n ): FunctionLike<P, R8>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[R0], R1>,\n FunctionLike<[R1], R2>,\n FunctionLike<[R2], R3>,\n FunctionLike<[R3], R4>,\n FunctionLike<[R4], R5>,\n FunctionLike<[R5], R6>,\n FunctionLike<[R6], R7>,\n FunctionLike<[R7], R8>,\n FunctionLike<[R8], R9>\n ]\n ): FunctionLike<P, R9>;\n};\n\nexport declare type PipeMultiAsync = {\n <R0, P extends any[]>(\n ...fns: [FunctionLike<P, R0>]\n ): FunctionLike<P, Promise<Await<R0>>>;\n <R0, R1, P extends any[]>(\n ...fns: [FunctionLike<P, R0>, FunctionLike<[Await<R0>], R1>]\n ): FunctionLike<P, Promise<Await<R1>>>;\n <R0, R1, R2, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>\n ]\n ): FunctionLike<P, Promise<Await<R2>>>;\n <R0, R1, R2, R3, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>\n ]\n ): FunctionLike<P, Promise<Await<R3>>>;\n <R0, R1, R2, R3, R4, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>\n ]\n ): FunctionLike<P, Promise<Await<R4>>>;\n <R0, R1, R2, R3, R4, R5, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>\n ]\n ): FunctionLike<P, Promise<Await<R5>>>;\n <R0, R1, R2, R3, R4, R5, R6, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>\n ]\n ): FunctionLike<P, Promise<Await<R6>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>\n ]\n ): FunctionLike<P, Promise<Await<R7>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>,\n FunctionLike<[Await<R7>], R8>\n ]\n ): FunctionLike<P, Promise<Await<R8>>>;\n <R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, P extends any[]>(\n ...fns: [\n FunctionLike<P, R0>,\n FunctionLike<[Await<R0>], R1>,\n FunctionLike<[Await<R1>], R2>,\n FunctionLike<[Await<R2>], R3>,\n FunctionLike<[Await<R3>], R4>,\n FunctionLike<[Await<R4>], R5>,\n FunctionLike<[Await<R5>], R6>,\n FunctionLike<[Await<R6>], R7>,\n FunctionLike<[Await<R7>], R8>,\n FunctionLike<[Await<R8>], R9>\n ]\n ): FunctionLike<P, Promise<Await<R9>>>;\n};\n\nexport { pipe };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,SAASA,WAAW;AACpB,SACEC,yBACAC,mBACAC,2CACAC,qBACK;AACP,SACEC,wBACAC,s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,eAAe;IACfC,aAAa;IACbC,SAAS;MAAC;MAAwB;;EACpC;AAGA,QAAMC,gBAAgBC,cAAc;IAAC;KAAejE,MAAAA;AAGpD,QAAMkE,cAAcC,SAAS,YAAA;AAC3B,UAAMC,aAAaC,KAAKC,IAAG;AAG3B,UAAMC,gBAAgB,MAAMC,OAAOb,MAAM,MAAA;AACvC,aAAOxB,SAAQsC,QAAO;IACxB,CAAA;AAEA,QAAIF,yBAAyBxG,OAAO;AAClC2G,eAAS,SAASH,cAAcI,OAAO;IACzC;AAEAD,aAAS,OAAO,GAAGL,KAAKC,IAAG,IAAKF,UAAAA,OAAiBzG,QAAQiB,QAAQ,EAAA,GAAK;EACxE,GAAG,EAAA;AAEHoF,gBAAcY,GAAG,UAAUV,WAAAA;AAE3B,SAAOnB;AACT,GAhCc;","names":["hfs","createProjectGraphAsync","joinPathFragments","readProjectsConfigurationFromProjectGraph","writeJsonFile","addPackageDependencies","addPackageJsonExport","addWorkspacePackageJsonFields","loadStormConfig","watch","createWatcher","debounce","flatten","omit","map","esbuild","globbySync","findWorkspaceRoot","handleSync","fn","error_","handleAsync","handle","async","skip","Symbol","transduceSync","list","transformer","transduced","i","element_","entries","transformed","length","transduceAsync","Promise","all","map","Filter","filter","item","Mapper","mapper","transduce","async","pipeSync","fn","fns","args","result","i","skip","length","pipeAsync","pipe","async","resolveOptions","options","projectRoot","workspaceRoot","findWorkspaceRoot","Error","nxJsonPath","joinPathFragments","dir","hfs","isFile","projectGraph","createProjectGraphAsync","exitOnError","projectJsonPath","projectJson","json","projectName","name","projectConfigurations","readProjectsConfigurationFromProjectGraph","projects","DEFAULT_BUILD_OPTIONS","format","outExtension","resolveExtensions","mainFields","entryPoints","outdir","plugins","resolvePathsPlugin","fixImportsPlugin","tscPlugin","emitTypes","onErrorPlugin","external","sourceRoot","generatePackageJson","config","loadStormConfig","packageJsonPath","packageJson","addPackageDependencies","addWorkspacePackageJsonFields","in","out","Array","isArray","map","entryPoint","Object","entries","key","value","split","pop","entry","join","replaceAll","addPackageJsonExport","main","module","types","writeJsonFile","createOptions","flatten","Promise","all","computeOptions","executeEsBuild","process","env","WATCH","context","omit","watch","build","metafile","emitMetafile","metafilePath","write","JSON","stringify","dependencyCheck","DEV","undefined","CI","BUILDKITE","buildPromise","globbySync","ignore","gitignore","logLevel","bundle","depsCheckPlugin","catch","transduce","async","pipe","ignoreInitial","useFsEvents","ignored","changeWatcher","createWatcher","fastRebuild","debounce","timeBefore","Date","now","rebuildResult","handle","rebuild","writeLog","message","on"]}
|
|
@@ -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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
|
|
4
4
|
|
|
5
5
|
// src/plugins/on-error.ts
|
|
6
6
|
var onErrorPlugin = {
|
|
@@ -8,7 +8,7 @@ var onErrorPlugin = {
|
|
|
8
8
|
setup(build) {
|
|
9
9
|
build.onEnd((result) => {
|
|
10
10
|
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
11
|
-
|
|
11
|
+
_chunk4ZPYEZJOcjs.writeLog.call(void 0, "error", `The following errors occurred during the build:
|
|
12
12
|
${result.errors.map((error) => error.text).join("\n")}
|
|
13
13
|
`);
|
|
14
14
|
throw new Error("ESBuild process failed with errors.");
|
|
@@ -20,3 +20,4 @@ ${result.errors.map((error) => error.text).join("\n")}
|
|
|
20
20
|
|
|
21
21
|
|
|
22
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"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writeLog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZQ5NVDFP.js";
|
|
4
4
|
import {
|
|
5
5
|
__name,
|
|
6
6
|
__require
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WCQVDF3K.js";
|
|
8
8
|
|
|
9
9
|
// src/plugins/tsc.ts
|
|
10
10
|
import { hfs } from "@humanfs/node";
|
|
@@ -124,3 +124,4 @@ export {
|
|
|
124
124
|
run,
|
|
125
125
|
tscPlugin
|
|
126
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":";;;;;;;;;AAiBA,SAASA,WAAW;AACpB,SAASC,WAAWC,uBAAuB;AAE3C,OAAOC,UAAU;;;ACHjB,SAASC,oBAAoB;AAItB,SAASC,IAAIC,SAAe;AACjC,SAAOC,aAAaD,SAAS;IAC3BE,aAAa;IACbC,OA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U,EAAA,CAAA;QAC3E;AAEA,cAAMK,MAAMnB,QAAQoB,WAAW,QAAQ,UAAU;AACjD,YAAIvE,QAAQsD,IAAIC,UAAU,UAAUvD,QAAQsD,IAAIE,QAAQ,QAAQ;AAE9DhE,gCAAsB2E,SAASD,YAAYf,QAAQqB,YAAY,CAAA,CAAE;AAEjE,gBAAMC,cAAc,MAAML,IAAIM,KAAK,GAAGR,UAAAA,OAAiB;AACvD,gBAAME,IAAIO,MAAM,GAAGT,UAAAA,IAAcI,GAAAA,IAAOG,WAAAA;QAC1C,OAAO;AAIL,gBAAML,IAAIO,MACR,GAAGT,UAAAA,IAAcI,GAAAA,IACjB,kBAAkBtE,QAAQC,IAAG,CAAA,IAAM+D,UAAAA,GAAa;QAEpD;MACF;IACF,CAAA;EACF;AACF,IA/DkE;AAwElE,SAASzD,6BAA6BqE,YAAkB;AACtD,MAAIA,WAAWC,WAAW,GAAA,GAAM;AAC9B,UAAM,CAACC,OAAO9B,IAAAA,IAAQ4B,WAAWG,MAAM,GAAA;AAEvC,WAAO,UAAUD,OAAOE,MAAM,CAAA,CAAA,KAAOhC,IAAAA;EACvC;AACA,SAAO,UAAU4B,UAAAA;AACnB;AAPSrE;","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":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4ZPYEZJOcjs = require('./chunk-4ZPYEZJO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
|
|
8
8
|
|
|
9
9
|
// src/plugins/tsc.ts
|
|
10
10
|
var _node = require('@humanfs/node');
|
|
@@ -20,11 +20,11 @@ function run(command) {
|
|
|
20
20
|
stdio: "inherit"
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, run, "run");
|
|
24
24
|
|
|
25
25
|
// src/plugins/tsc.ts
|
|
26
26
|
function bundleTypeDefinitions(filename, outfile, externals) {
|
|
27
|
-
const { dependencies, peerDependencies, devDependencies } =
|
|
27
|
+
const { dependencies, peerDependencies, devDependencies } = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/package.json`);
|
|
28
28
|
const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
|
|
29
29
|
p,
|
|
30
30
|
getTypeDependencyPackageName(p)
|
|
@@ -74,12 +74,12 @@ function bundleTypeDefinitions(filename, outfile, externals) {
|
|
|
74
74
|
localBuild: true
|
|
75
75
|
});
|
|
76
76
|
if (extractorResult.succeeded === false) {
|
|
77
|
-
|
|
77
|
+
_chunk4ZPYEZJOcjs.writeLog.call(void 0, "error", `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
78
78
|
throw new Error("API Extractor completed with errors");
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
var tscPlugin = /* @__PURE__ */
|
|
81
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
82
|
+
var tscPlugin = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (emitTypes) => ({
|
|
83
83
|
name: "tscPlugin",
|
|
84
84
|
setup(build) {
|
|
85
85
|
const options = build.initialOptions;
|
|
@@ -89,7 +89,7 @@ var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (emitTypes
|
|
|
89
89
|
await run(`tsc --project ${options.tsconfig} --paths null`);
|
|
90
90
|
}
|
|
91
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 =
|
|
92
|
+
const tsconfig = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/${options.tsconfig}`);
|
|
93
93
|
const typeOutDir = _nullishCoalesce(_optionalChain([tsconfig, 'optionalAccess', _5 => _5.compilerOptions, 'optionalAccess', _6 => _6.outDir]), () => ( "."));
|
|
94
94
|
const entryPoint = _optionalChain([options, 'access', _7 => _7.entryPoints, 'optionalAccess', _8 => _8[0], 'access', _9 => _9.replace, 'call', _10 => _10(/\.ts$/, "")]);
|
|
95
95
|
const bundlePath = options.outfile.replace(/\.m?js$/, "");
|
|
@@ -118,9 +118,10 @@ function getTypeDependencyPackageName(npmPackage) {
|
|
|
118
118
|
}
|
|
119
119
|
return `@types/${npmPackage}`;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
_chunkWGEGR3DFcjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
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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,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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__name,
|
|
3
3
|
__require
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WCQVDF3K.js";
|
|
5
5
|
|
|
6
6
|
// src/plugins/resolve-paths.ts
|
|
7
7
|
import path from "node:path";
|
|
@@ -50,3 +50,4 @@ var resolvePathsPlugin = {
|
|
|
50
50
|
export {
|
|
51
51
|
resolvePathsPlugin
|
|
52
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WCQVDF3K.js";
|
|
4
4
|
|
|
5
5
|
// src/plugins/fix-imports.ts
|
|
6
6
|
var fixImportsPlugin = {
|
|
@@ -26,3 +26,4 @@ var fixImportsPlugin = {
|
|
|
26
26
|
export {
|
|
27
27
|
fixImportsPlugin
|
|
28
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"]}
|