@storm-software/cloudflare-tools 0.55.64 → 0.55.66
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/{chunk-HBBHWDJS.mjs → chunk-2FAHL7XD.mjs} +11 -3
- package/dist/{chunk-CI3G746G.mjs → chunk-3RLBM7SP.mjs} +1 -1
- package/dist/{chunk-H3FNUUB5.js → chunk-4O3YATGZ.js} +289 -1157
- package/dist/{chunk-4FV3KOBI.mjs → chunk-4XAH2R5U.mjs} +9 -7
- package/dist/{chunk-RGBGVGWZ.mjs → chunk-5VCVZQT4.mjs} +2 -2
- package/dist/{chunk-MLJ3OSJX.js → chunk-6B5PUF7X.js} +24 -18
- package/dist/{chunk-PG2M24AG.mjs → chunk-AMOQ2QRI.mjs} +210 -1078
- package/dist/{chunk-ZYEYSCDM.js → chunk-ENYRBMQC.js} +12 -12
- package/dist/{chunk-VQLLSEHB.mjs → chunk-IEYD3WT2.mjs} +1 -1
- package/dist/{chunk-ITJMNVMG.mjs → chunk-IGW2CIUT.mjs} +2 -2
- package/dist/{chunk-XFPT4O23.js → chunk-IVLCYFXD.js} +50 -42
- package/dist/{chunk-SSSAGTTW.mjs → chunk-LEJPLULT.mjs} +1 -6
- package/dist/{chunk-UBEHQVYS.js → chunk-QGRENI3O.js} +3 -3
- package/dist/{chunk-6RVDU4NC.mjs → chunk-QWFEAV3X.mjs} +4 -4
- package/dist/{chunk-EGSNPA63.js → chunk-U4CFTRNN.js} +8 -6
- package/dist/{chunk-TEEOPHLZ.js → chunk-V7LBWOVV.js} +1 -6
- package/dist/{chunk-C3CWFFYT.mjs → chunk-W2PVKWMH.mjs} +14 -8
- package/dist/executors.js +5 -5
- package/dist/executors.mjs +8 -8
- package/dist/generators.js +5 -5
- package/dist/generators.mjs +5 -5
- package/dist/index.js +8 -8
- package/dist/index.mjs +10 -10
- package/dist/src/executors/cloudflare-publish/executor.js +3 -3
- package/dist/src/executors/cloudflare-publish/executor.mjs +6 -6
- package/dist/src/executors/r2-upload-publish/executor.js +5 -5
- package/dist/src/executors/r2-upload-publish/executor.mjs +6 -6
- package/dist/src/executors/serve/executor.d.mts +2 -1300
- package/dist/src/executors/serve/executor.d.ts +2 -1300
- package/dist/src/executors/serve/executor.js +4 -4
- package/dist/src/executors/serve/executor.mjs +5 -5
- package/dist/src/generators/init/generator.js +2 -2
- package/dist/src/generators/init/generator.mjs +2 -2
- package/dist/src/generators/worker/generator.js +5 -5
- package/dist/src/generators/worker/generator.mjs +5 -5
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/index.mjs +3 -3
- package/dist/src/utils/r2-bucket-helpers.js +3 -3
- package/dist/src/utils/r2-bucket-helpers.mjs +3 -3
- package/dist/tsup.config.d.mts +3 -3
- package/dist/tsup.config.d.ts +3 -3
- package/dist/tsup.config.js +2 -1
- package/dist/tsup.config.mjs +3 -2
- package/package.json +8 -9
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProjectTagConstants,
|
|
3
3
|
addProjectTag
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3RLBM7SP.mjs";
|
|
5
5
|
import {
|
|
6
|
-
getConfig
|
|
7
|
-
|
|
6
|
+
getConfig,
|
|
7
|
+
getWorkspaceConfig
|
|
8
|
+
} from "./chunk-2FAHL7XD.mjs";
|
|
8
9
|
import {
|
|
9
|
-
correctPaths,
|
|
10
10
|
findWorkspaceRoot,
|
|
11
11
|
formatLogMessage,
|
|
12
12
|
getStopwatch,
|
|
13
|
-
isVerbose,
|
|
14
13
|
joinPaths,
|
|
15
14
|
stormWorkspaceConfigSchema,
|
|
16
15
|
writeDebug,
|
|
@@ -20,12 +19,12 @@ import {
|
|
|
20
19
|
writeSuccess,
|
|
21
20
|
writeTrace,
|
|
22
21
|
writeWarning
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LEJPLULT.mjs";
|
|
24
23
|
import {
|
|
25
24
|
__dirname,
|
|
26
25
|
__name,
|
|
27
26
|
__require
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-IEYD3WT2.mjs";
|
|
29
28
|
|
|
30
29
|
// ../config-tools/src/utilities/apply-workspace-tokens.ts
|
|
31
30
|
var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams) => {
|
|
@@ -80,39 +79,20 @@ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, t
|
|
|
80
79
|
return result;
|
|
81
80
|
}, "applyWorkspaceTokens");
|
|
82
81
|
|
|
83
|
-
// ../config-tools/src/utilities/run.ts
|
|
84
|
-
import { exec, execSync } from "node:child_process";
|
|
85
|
-
var LARGE_BUFFER = 1024 * 1e6;
|
|
86
|
-
var run = /* @__PURE__ */ __name((config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
|
|
87
|
-
return execSync(command, {
|
|
88
|
-
cwd,
|
|
89
|
-
env: {
|
|
90
|
-
...process.env,
|
|
91
|
-
...env,
|
|
92
|
-
CLICOLOR: "true",
|
|
93
|
-
FORCE_COLOR: "true"
|
|
94
|
-
},
|
|
95
|
-
windowsHide: true,
|
|
96
|
-
stdio,
|
|
97
|
-
maxBuffer: LARGE_BUFFER,
|
|
98
|
-
killSignal: "SIGTERM"
|
|
99
|
-
});
|
|
100
|
-
}, "run");
|
|
101
|
-
|
|
102
82
|
// ../workspace-tools/src/base/base-executor.ts
|
|
103
83
|
import { defu } from "defu";
|
|
104
|
-
var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options,
|
|
84
|
+
var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
|
|
105
85
|
const stopwatch = getStopwatch(name);
|
|
106
86
|
let options = _options;
|
|
107
87
|
let config = {};
|
|
108
88
|
try {
|
|
109
|
-
if (!
|
|
89
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
110
90
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
111
91
|
}
|
|
112
92
|
const workspaceRoot3 = findWorkspaceRoot();
|
|
113
|
-
const projectRoot =
|
|
114
|
-
const sourceRoot =
|
|
115
|
-
const projectName =
|
|
93
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot3;
|
|
94
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot3;
|
|
95
|
+
const projectName = context.projectName;
|
|
116
96
|
config.workspaceRoot = workspaceRoot3;
|
|
117
97
|
writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
|
|
118
98
|
if (!executorOptions.skipReadingConfig) {
|
|
@@ -138,7 +118,7 @@ ${formatLogMessage(options)}
|
|
|
138
118
|
sourceRoot,
|
|
139
119
|
projectName,
|
|
140
120
|
config
|
|
141
|
-
}, config,
|
|
121
|
+
}, config, context.projectsConfigurations.projects[context.projectName]), applyWorkspaceProjectTokens);
|
|
142
122
|
writeTrace(`Executor schema tokenized options \u2699\uFE0F
|
|
143
123
|
${formatLogMessage(tokenized)}
|
|
144
124
|
`, config);
|
|
@@ -147,7 +127,7 @@ ${formatLogMessage(tokenized)}
|
|
|
147
127
|
await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
|
|
148
128
|
writeDebug("Completed the preProcess hook", config);
|
|
149
129
|
}
|
|
150
|
-
const ret = executorFn(tokenized,
|
|
130
|
+
const ret = executorFn(tokenized, context, config);
|
|
151
131
|
if (_isFunction(ret?.next)) {
|
|
152
132
|
const asyncGen = ret;
|
|
153
133
|
for await (const iter of asyncGen) {
|
|
@@ -195,7 +175,7 @@ var _isFunction = /* @__PURE__ */ __name((value) => {
|
|
|
195
175
|
|
|
196
176
|
// ../workspace-tools/src/utils/cargo.ts
|
|
197
177
|
import { joinPathFragments, workspaceRoot } from "@nx/devkit";
|
|
198
|
-
import { execSync
|
|
178
|
+
import { execSync, spawn } from "node:child_process";
|
|
199
179
|
import { relative } from "node:path";
|
|
200
180
|
var INVALID_CARGO_ARGS = [
|
|
201
181
|
"allFeatures",
|
|
@@ -205,7 +185,7 @@ var INVALID_CARGO_ARGS = [
|
|
|
205
185
|
"package",
|
|
206
186
|
"tsConfig"
|
|
207
187
|
];
|
|
208
|
-
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options,
|
|
188
|
+
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context) => {
|
|
209
189
|
const args = [];
|
|
210
190
|
if (options.toolchain && options.toolchain !== "stable") {
|
|
211
191
|
args.push(`+${options.toolchain}`);
|
|
@@ -227,8 +207,8 @@ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2)
|
|
|
227
207
|
args.push(`--${key}`, String(value));
|
|
228
208
|
}
|
|
229
209
|
}
|
|
230
|
-
if (
|
|
231
|
-
args.push("-p",
|
|
210
|
+
if (context.projectName) {
|
|
211
|
+
args.push("-p", context.projectName);
|
|
232
212
|
}
|
|
233
213
|
if (options.allFeatures && !args.includes("--all-features")) {
|
|
234
214
|
args.push("--all-features");
|
|
@@ -260,7 +240,7 @@ function cargoCommandSync(args = "", options) {
|
|
|
260
240
|
};
|
|
261
241
|
try {
|
|
262
242
|
return {
|
|
263
|
-
output:
|
|
243
|
+
output: execSync(`cargo ${args}`, {
|
|
264
244
|
encoding: "utf8",
|
|
265
245
|
windowsHide: true,
|
|
266
246
|
stdio: normalizedOptions.stdio,
|
|
@@ -297,7 +277,7 @@ function runProcess(processCmd, ...args) {
|
|
|
297
277
|
success: true
|
|
298
278
|
});
|
|
299
279
|
}
|
|
300
|
-
|
|
280
|
+
execSync(`${processCmd} ${args.join(" ")}`, {
|
|
301
281
|
cwd: process.cwd(),
|
|
302
282
|
env: {
|
|
303
283
|
...process.env,
|
|
@@ -320,8 +300,8 @@ function runProcess(processCmd, ...args) {
|
|
|
320
300
|
__name(runProcess, "runProcess");
|
|
321
301
|
|
|
322
302
|
// ../workspace-tools/src/executors/cargo-build/executor.ts
|
|
323
|
-
async function cargoBuildExecutor(options,
|
|
324
|
-
const command = buildCargoCommand("build", options,
|
|
303
|
+
async function cargoBuildExecutor(options, context) {
|
|
304
|
+
const command = buildCargoCommand("build", options, context);
|
|
325
305
|
return await cargoCommand(...command);
|
|
326
306
|
}
|
|
327
307
|
__name(cargoBuildExecutor, "cargoBuildExecutor");
|
|
@@ -337,8 +317,8 @@ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
|
|
|
337
317
|
});
|
|
338
318
|
|
|
339
319
|
// ../workspace-tools/src/executors/cargo-check/executor.ts
|
|
340
|
-
async function cargoCheckExecutor(options,
|
|
341
|
-
const command = buildCargoCommand("check", options,
|
|
320
|
+
async function cargoCheckExecutor(options, context) {
|
|
321
|
+
const command = buildCargoCommand("check", options, context);
|
|
342
322
|
return await cargoCommand(...command);
|
|
343
323
|
}
|
|
344
324
|
__name(cargoCheckExecutor, "cargoCheckExecutor");
|
|
@@ -353,8 +333,8 @@ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
|
|
|
353
333
|
});
|
|
354
334
|
|
|
355
335
|
// ../workspace-tools/src/executors/cargo-clippy/executor.ts
|
|
356
|
-
async function cargoClippyExecutor(options,
|
|
357
|
-
const command = buildCargoCommand("clippy", options,
|
|
336
|
+
async function cargoClippyExecutor(options, context) {
|
|
337
|
+
const command = buildCargoCommand("clippy", options, context);
|
|
358
338
|
return await cargoCommand(...command);
|
|
359
339
|
}
|
|
360
340
|
__name(cargoClippyExecutor, "cargoClippyExecutor");
|
|
@@ -370,13 +350,13 @@ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
|
|
|
370
350
|
});
|
|
371
351
|
|
|
372
352
|
// ../workspace-tools/src/executors/cargo-doc/executor.ts
|
|
373
|
-
async function cargoDocExecutor(options,
|
|
353
|
+
async function cargoDocExecutor(options, context) {
|
|
374
354
|
const opts = {
|
|
375
355
|
...options
|
|
376
356
|
};
|
|
377
357
|
opts["no-deps"] = opts.noDeps;
|
|
378
358
|
delete opts.noDeps;
|
|
379
|
-
const command = buildCargoCommand("doc", options,
|
|
359
|
+
const command = buildCargoCommand("doc", options, context);
|
|
380
360
|
return await cargoCommand(...command);
|
|
381
361
|
}
|
|
382
362
|
__name(cargoDocExecutor, "cargoDocExecutor");
|
|
@@ -398,8 +378,8 @@ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
|
|
|
398
378
|
});
|
|
399
379
|
|
|
400
380
|
// ../workspace-tools/src/executors/cargo-format/executor.ts
|
|
401
|
-
async function cargoFormatExecutor(options,
|
|
402
|
-
const command = buildCargoCommand("fmt", options,
|
|
381
|
+
async function cargoFormatExecutor(options, context) {
|
|
382
|
+
const command = buildCargoCommand("fmt", options, context);
|
|
403
383
|
return await cargoCommand(...command);
|
|
404
384
|
}
|
|
405
385
|
__name(cargoFormatExecutor, "cargoFormatExecutor");
|
|
@@ -416,13 +396,13 @@ var executor_default5 = withRunExecutor("Cargo Format", cargoFormatExecutor, {
|
|
|
416
396
|
|
|
417
397
|
// ../workspace-tools/src/executors/cargo-publish/executor.ts
|
|
418
398
|
import { joinPathFragments as joinPathFragments2 } from "@nx/devkit";
|
|
419
|
-
import { execSync as
|
|
399
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
420
400
|
import { readFileSync } from "node:fs";
|
|
421
401
|
import https from "node:https";
|
|
422
|
-
var
|
|
402
|
+
var LARGE_BUFFER = 1024 * 1e6;
|
|
423
403
|
|
|
424
404
|
// ../esbuild/src/build.ts
|
|
425
|
-
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
|
|
405
|
+
import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
|
|
426
406
|
|
|
427
407
|
// ../build-tools/src/config.ts
|
|
428
408
|
var DEFAULT_COMPILED_BANNER = `/*****************************************
|
|
@@ -508,9 +488,18 @@ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildabl
|
|
|
508
488
|
import { Glob } from "glob";
|
|
509
489
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
510
490
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
511
|
-
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
491
|
+
import { createProjectGraphAsync, readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
512
492
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, projectRoot, projectName, packageJson) => {
|
|
513
|
-
|
|
493
|
+
let projectGraph;
|
|
494
|
+
try {
|
|
495
|
+
projectGraph = readCachedProjectGraph();
|
|
496
|
+
} catch {
|
|
497
|
+
await createProjectGraphAsync();
|
|
498
|
+
projectGraph = readCachedProjectGraph();
|
|
499
|
+
}
|
|
500
|
+
if (!projectGraph) {
|
|
501
|
+
throw new Error("The Build process failed because the project graph is not available. Please run the build command again.");
|
|
502
|
+
}
|
|
514
503
|
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
515
504
|
const localPackages = [];
|
|
516
505
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot3)) {
|
|
@@ -565,8 +554,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
565
554
|
}
|
|
566
555
|
return packageJson;
|
|
567
556
|
}, "addPackageDependencies");
|
|
568
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (
|
|
569
|
-
const workspaceRoot3 =
|
|
557
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
558
|
+
const workspaceRoot3 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
570
559
|
const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot3, "package.json"), "utf8");
|
|
571
560
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
572
561
|
packageJson.type ??= "module";
|
|
@@ -637,159 +626,18 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
|
|
|
637
626
|
|
|
638
627
|
// ../esbuild/src/build.ts
|
|
639
628
|
import { watch as createWatcher } from "chokidar";
|
|
640
|
-
import
|
|
641
|
-
import { debounce
|
|
642
|
-
import
|
|
643
|
-
import * as esbuild2 from "esbuild";
|
|
629
|
+
import defu2 from "defu";
|
|
630
|
+
import { debounce } from "es-toolkit";
|
|
631
|
+
import * as esbuild from "esbuild";
|
|
644
632
|
import { globbySync } from "globby";
|
|
645
|
-
import { existsSync as
|
|
633
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
646
634
|
import hf from "node:fs/promises";
|
|
647
635
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
648
|
-
|
|
649
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
650
|
-
import path3 from "node:path";
|
|
651
|
-
import { SourceMapConsumer, SourceMapGenerator } from "source-map";
|
|
652
|
-
|
|
653
|
-
// ../esbuild/src/utilities/output-file.ts
|
|
654
|
-
import fs2 from "node:fs";
|
|
655
|
-
import path2 from "node:path";
|
|
656
|
-
var outputFile = /* @__PURE__ */ __name(async (filepath, data, options) => {
|
|
657
|
-
await fs2.promises.mkdir(path2.dirname(filepath), {
|
|
658
|
-
recursive: true
|
|
659
|
-
});
|
|
660
|
-
await fs2.promises.writeFile(filepath, data, options);
|
|
661
|
-
}, "outputFile");
|
|
662
|
-
|
|
663
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
664
|
-
var parseSourceMap = /* @__PURE__ */ __name((map2) => {
|
|
665
|
-
return typeof map2 === "string" ? JSON.parse(map2) : map2;
|
|
666
|
-
}, "parseSourceMap");
|
|
667
|
-
var isJS = /* @__PURE__ */ __name((path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
|
|
668
|
-
var isCSS = /* @__PURE__ */ __name((path7) => /\.css$/.test(path7), "isCSS");
|
|
669
|
-
var getSourcemapComment = /* @__PURE__ */ __name((inline, map2, filepath, isCssFile) => {
|
|
670
|
-
if (!map2) return "";
|
|
671
|
-
const prefix = isCssFile ? "/*" : "//";
|
|
672
|
-
const suffix = isCssFile ? " */" : "";
|
|
673
|
-
const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path3.basename(filepath)}.map`;
|
|
674
|
-
return `${prefix}# sourceMappingURL=${url}${suffix}`;
|
|
675
|
-
}, "getSourcemapComment");
|
|
676
|
-
var RendererEngine = class {
|
|
677
|
-
static {
|
|
678
|
-
__name(this, "RendererEngine");
|
|
679
|
-
}
|
|
680
|
-
#renderers;
|
|
681
|
-
#options;
|
|
682
|
-
constructor(renderers) {
|
|
683
|
-
this.#renderers = renderers;
|
|
684
|
-
}
|
|
685
|
-
setOptions(options) {
|
|
686
|
-
this.#options = options;
|
|
687
|
-
}
|
|
688
|
-
getOptions() {
|
|
689
|
-
if (!this.#options) {
|
|
690
|
-
throw new Error(`Renderer options is not set`);
|
|
691
|
-
}
|
|
692
|
-
return this.#options;
|
|
693
|
-
}
|
|
694
|
-
modifyEsbuildOptions(options) {
|
|
695
|
-
for (const renderer of this.#renderers) {
|
|
696
|
-
if (renderer.esbuildOptions) {
|
|
697
|
-
renderer.esbuildOptions.call(this.getOptions(), options);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
async buildStarted() {
|
|
702
|
-
for (const renderer of this.#renderers) {
|
|
703
|
-
if (renderer.buildStart) {
|
|
704
|
-
await renderer.buildStart.call(this.getOptions());
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
async buildFinished({ outputFiles, metafile }) {
|
|
709
|
-
const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
|
|
710
|
-
if (isJS(file.path) || isCSS(file.path)) {
|
|
711
|
-
let relativePath = path3.relative(this.getOptions().config.workspaceRoot, file.path);
|
|
712
|
-
if (!relativePath.startsWith("\\\\?\\")) {
|
|
713
|
-
relativePath = relativePath.replace(/\\/g, "/");
|
|
714
|
-
}
|
|
715
|
-
const meta = metafile?.outputs[relativePath];
|
|
716
|
-
return {
|
|
717
|
-
type: "chunk",
|
|
718
|
-
path: file.path,
|
|
719
|
-
code: file.text,
|
|
720
|
-
map: outputFiles.find((f) => f.path === `${file.path}.map`)?.text,
|
|
721
|
-
entryPoint: meta?.entryPoint,
|
|
722
|
-
exports: meta?.exports,
|
|
723
|
-
imports: meta?.imports
|
|
724
|
-
};
|
|
725
|
-
} else {
|
|
726
|
-
return {
|
|
727
|
-
type: "asset",
|
|
728
|
-
path: file.path,
|
|
729
|
-
contents: file.contents
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
const writtenFiles = [];
|
|
734
|
-
await Promise.all(files.map(async (info) => {
|
|
735
|
-
for (const renderer of this.#renderers) {
|
|
736
|
-
if (info.type === "chunk" && renderer.renderChunk) {
|
|
737
|
-
const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
|
|
738
|
-
if (result) {
|
|
739
|
-
info.code = result.code;
|
|
740
|
-
if (result.map) {
|
|
741
|
-
const originalConsumer = await new SourceMapConsumer(parseSourceMap(info.map));
|
|
742
|
-
const newConsumer = await new SourceMapConsumer(parseSourceMap(result.map));
|
|
743
|
-
const generator = SourceMapGenerator.fromSourceMap(newConsumer);
|
|
744
|
-
generator.applySourceMap(originalConsumer, info.path);
|
|
745
|
-
info.map = generator.toJSON();
|
|
746
|
-
originalConsumer.destroy();
|
|
747
|
-
newConsumer.destroy();
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
const inlineSourceMap = this.#options.sourcemap === "inline";
|
|
753
|
-
const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
|
|
754
|
-
await outputFile(info.path, contents, {
|
|
755
|
-
mode: info.type === "chunk" ? info.mode : void 0
|
|
756
|
-
});
|
|
757
|
-
writtenFiles.push({
|
|
758
|
-
get name() {
|
|
759
|
-
return path3.relative(process.cwd(), info.path);
|
|
760
|
-
},
|
|
761
|
-
get size() {
|
|
762
|
-
return contents.length;
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
if (info.type === "chunk" && info.map && !inlineSourceMap) {
|
|
766
|
-
const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
|
|
767
|
-
const outPath = `${info.path}.map`;
|
|
768
|
-
const contents2 = JSON.stringify(map2);
|
|
769
|
-
await outputFile(outPath, contents2);
|
|
770
|
-
writtenFiles.push({
|
|
771
|
-
get name() {
|
|
772
|
-
return path3.relative(process.cwd(), outPath);
|
|
773
|
-
},
|
|
774
|
-
get size() {
|
|
775
|
-
return contents2.length;
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
}));
|
|
780
|
-
for (const renderer of this.#renderers) {
|
|
781
|
-
if (renderer.buildEnd) {
|
|
782
|
-
await renderer.buildEnd.call(this.getOptions(), {
|
|
783
|
-
writtenFiles
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
};
|
|
636
|
+
import { build as tsup } from "tsup";
|
|
789
637
|
|
|
790
638
|
// ../esbuild/src/clean.ts
|
|
791
639
|
import { rm } from "node:fs/promises";
|
|
792
|
-
async function cleanDirectories(
|
|
640
|
+
async function cleanDirectories(directory) {
|
|
793
641
|
await rm(directory, {
|
|
794
642
|
recursive: true,
|
|
795
643
|
force: true
|
|
@@ -797,315 +645,24 @@ async function cleanDirectories(name = "ESBuild", directory, config) {
|
|
|
797
645
|
}
|
|
798
646
|
__name(cleanDirectories, "cleanDirectories");
|
|
799
647
|
|
|
800
|
-
// ../esbuild/src/plugins/esm-split-code-to-cjs.ts
|
|
801
|
-
import * as esbuild from "esbuild";
|
|
802
|
-
var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
803
|
-
name: "storm:esm-split-code-to-cjs",
|
|
804
|
-
setup(build4) {
|
|
805
|
-
build4.onEnd(async (result) => {
|
|
806
|
-
const outFiles = Object.keys(result.metafile?.outputs ?? {});
|
|
807
|
-
const jsFiles = outFiles.filter((f) => f.endsWith("js"));
|
|
808
|
-
await esbuild.build({
|
|
809
|
-
outdir: resolvedOptions.outdir,
|
|
810
|
-
entryPoints: jsFiles,
|
|
811
|
-
allowOverwrite: true,
|
|
812
|
-
format: "cjs",
|
|
813
|
-
logLevel: "error",
|
|
814
|
-
packages: "external"
|
|
815
|
-
});
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
}), "esmSplitCodeToCjsPlugin");
|
|
819
|
-
|
|
820
|
-
// ../esbuild/src/plugins/fix-imports.ts
|
|
821
|
-
var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
822
|
-
name: "storm:fix-imports",
|
|
823
|
-
setup(build4) {
|
|
824
|
-
build4.onResolve({
|
|
825
|
-
filter: /^spdx-exceptions/
|
|
826
|
-
}, () => {
|
|
827
|
-
return {
|
|
828
|
-
path: __require.resolve("spdx-exceptions")
|
|
829
|
-
};
|
|
830
|
-
});
|
|
831
|
-
build4.onResolve({
|
|
832
|
-
filter: /^spdx-license-ids/
|
|
833
|
-
}, () => {
|
|
834
|
-
return {
|
|
835
|
-
path: __require.resolve("spdx-license-ids")
|
|
836
|
-
};
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
}), "fixImportsPlugin");
|
|
840
|
-
|
|
841
|
-
// ../esbuild/src/plugins/native-node-module.ts
|
|
842
|
-
import { dirname } from "node:path";
|
|
843
|
-
var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
844
|
-
return {
|
|
845
|
-
name: "native-node-modules",
|
|
846
|
-
setup(build4) {
|
|
847
|
-
build4.onResolve({
|
|
848
|
-
filter: /\.node$/,
|
|
849
|
-
namespace: "file"
|
|
850
|
-
}, (args) => {
|
|
851
|
-
const resolvedId = __require.resolve(args.path, {
|
|
852
|
-
paths: [
|
|
853
|
-
args.resolveDir
|
|
854
|
-
]
|
|
855
|
-
});
|
|
856
|
-
if (resolvedId.endsWith(".node")) {
|
|
857
|
-
return {
|
|
858
|
-
path: resolvedId,
|
|
859
|
-
namespace: "node-file"
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
return {
|
|
863
|
-
path: resolvedId
|
|
864
|
-
};
|
|
865
|
-
});
|
|
866
|
-
build4.onLoad({
|
|
867
|
-
filter: /.*/,
|
|
868
|
-
namespace: "node-file"
|
|
869
|
-
}, (args) => {
|
|
870
|
-
return {
|
|
871
|
-
contents: `
|
|
872
|
-
import path from ${JSON.stringify(args.path)}
|
|
873
|
-
try { module.exports = require(path) }
|
|
874
|
-
catch {}
|
|
875
|
-
`,
|
|
876
|
-
resolveDir: dirname(args.path)
|
|
877
|
-
};
|
|
878
|
-
});
|
|
879
|
-
build4.onResolve({
|
|
880
|
-
filter: /\.node$/,
|
|
881
|
-
namespace: "node-file"
|
|
882
|
-
}, (args) => ({
|
|
883
|
-
path: args.path,
|
|
884
|
-
namespace: "file"
|
|
885
|
-
}));
|
|
886
|
-
const opts = build4.initialOptions;
|
|
887
|
-
opts.loader = opts.loader || {};
|
|
888
|
-
opts.loader[".node"] = "file";
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
}, "nativeNodeModulesPlugin");
|
|
892
|
-
|
|
893
|
-
// ../esbuild/src/plugins/node-protocol.ts
|
|
894
|
-
var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
895
|
-
const nodeProtocol = "node:";
|
|
896
|
-
return {
|
|
897
|
-
name: "node-protocol-plugin",
|
|
898
|
-
setup({ onResolve }) {
|
|
899
|
-
onResolve({
|
|
900
|
-
filter: /^node:/
|
|
901
|
-
}, ({ path: path7 }) => ({
|
|
902
|
-
path: path7.slice(nodeProtocol.length),
|
|
903
|
-
external: true
|
|
904
|
-
}));
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
}, "nodeProtocolPlugin");
|
|
908
|
-
|
|
909
|
-
// ../esbuild/src/plugins/on-error.ts
|
|
910
|
-
var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
911
|
-
name: "storm:on-error",
|
|
912
|
-
setup(build4) {
|
|
913
|
-
build4.onEnd((result) => {
|
|
914
|
-
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
915
|
-
writeError(`The following errors occurred during the build:
|
|
916
|
-
${result.errors.map((error) => error.text).join("\n")}
|
|
917
|
-
|
|
918
|
-
`, resolvedOptions.config);
|
|
919
|
-
throw new Error("Storm esbuild process failed with errors.");
|
|
920
|
-
}
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
}), "onErrorPlugin");
|
|
924
|
-
|
|
925
|
-
// ../esbuild/src/plugins/resolve-paths.ts
|
|
926
|
-
import path4 from "node:path";
|
|
927
|
-
function resolvePathsConfig(options, cwd) {
|
|
928
|
-
if (options?.compilerOptions?.paths) {
|
|
929
|
-
const paths = Object.entries(options.compilerOptions.paths);
|
|
930
|
-
const resolvedPaths = paths.map(([key, paths2]) => {
|
|
931
|
-
return [
|
|
932
|
-
key,
|
|
933
|
-
paths2.map((v) => path4.resolve(cwd, v))
|
|
934
|
-
];
|
|
935
|
-
});
|
|
936
|
-
return Object.fromEntries(resolvedPaths);
|
|
937
|
-
}
|
|
938
|
-
if (options.extends) {
|
|
939
|
-
const extendsPath = path4.resolve(cwd, options.extends);
|
|
940
|
-
const extendsDir = path4.dirname(extendsPath);
|
|
941
|
-
const extendsConfig = __require(extendsPath);
|
|
942
|
-
return resolvePathsConfig(extendsConfig, extendsDir);
|
|
943
|
-
}
|
|
944
|
-
return [];
|
|
945
|
-
}
|
|
946
|
-
__name(resolvePathsConfig, "resolvePathsConfig");
|
|
947
|
-
var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
948
|
-
name: "storm:resolve-paths",
|
|
949
|
-
setup(build4) {
|
|
950
|
-
const parentTsConfig = build4.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build4.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
|
|
951
|
-
const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
|
|
952
|
-
const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
|
|
953
|
-
build4.onResolve({
|
|
954
|
-
filter: packagesRegex
|
|
955
|
-
}, (args) => {
|
|
956
|
-
if (build4.initialOptions.external?.includes(args.path)) {
|
|
957
|
-
return {
|
|
958
|
-
path: args.path,
|
|
959
|
-
external: true
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
return {
|
|
963
|
-
path: `${resolvedTsPaths[args.path][0]}/index.ts`
|
|
964
|
-
};
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
}), "resolvePathsPlugin");
|
|
968
|
-
|
|
969
|
-
// ../esbuild/src/plugins/tsc.ts
|
|
970
|
-
import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
|
|
971
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
972
|
-
import fs3 from "node:fs/promises";
|
|
973
|
-
function bundleTypeDefinitions(filename, outfile, externals, options) {
|
|
974
|
-
const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
|
|
975
|
-
const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
|
|
976
|
-
p,
|
|
977
|
-
getTypeDependencyPackageName(p)
|
|
978
|
-
]);
|
|
979
|
-
const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
|
|
980
|
-
p,
|
|
981
|
-
getTypeDependencyPackageName(p)
|
|
982
|
-
]);
|
|
983
|
-
const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
|
|
984
|
-
p,
|
|
985
|
-
getTypeDependencyPackageName(p)
|
|
986
|
-
]);
|
|
987
|
-
const includeDeps = devDependenciesKeys;
|
|
988
|
-
const excludeDeps = /* @__PURE__ */ new Set([
|
|
989
|
-
...dependenciesKeys,
|
|
990
|
-
...peerDependenciesKeys,
|
|
991
|
-
...externals
|
|
992
|
-
]);
|
|
993
|
-
const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
|
|
994
|
-
const extractorConfig = ExtractorConfig.prepare({
|
|
995
|
-
configObject: {
|
|
996
|
-
projectFolder: options.projectRoot,
|
|
997
|
-
mainEntryPointFilePath: filename,
|
|
998
|
-
bundledPackages,
|
|
999
|
-
compiler: {
|
|
1000
|
-
tsconfigFilePath: options.tsconfig,
|
|
1001
|
-
overrideTsconfig: {
|
|
1002
|
-
compilerOptions: {
|
|
1003
|
-
paths: {}
|
|
1004
|
-
// bug with api extract + paths
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
},
|
|
1008
|
-
dtsRollup: {
|
|
1009
|
-
enabled: true,
|
|
1010
|
-
untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
|
|
1011
|
-
},
|
|
1012
|
-
tsdocMetadata: {
|
|
1013
|
-
enabled: false
|
|
1014
|
-
}
|
|
1015
|
-
},
|
|
1016
|
-
packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
|
|
1017
|
-
configObjectFullPath: void 0
|
|
1018
|
-
});
|
|
1019
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
1020
|
-
showVerboseMessages: true,
|
|
1021
|
-
localBuild: true
|
|
1022
|
-
});
|
|
1023
|
-
if (extractorResult.succeeded === false) {
|
|
1024
|
-
writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
1025
|
-
throw new Error("API Extractor completed with errors");
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
__name(bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
1029
|
-
var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
1030
|
-
name: "storm:tsc",
|
|
1031
|
-
setup(build4) {
|
|
1032
|
-
if (options.dts === false) {
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
build4.onStart(async () => {
|
|
1036
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
1037
|
-
await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
|
|
1038
|
-
}
|
|
1039
|
-
if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0]?.in && resolvedOptions.entryPoints[0].in.endsWith(".ts")) {
|
|
1040
|
-
const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
|
|
1041
|
-
const typeOutDir = resolvedOptions.outdir;
|
|
1042
|
-
const entryPoint = resolvedOptions.entryPoints[0].in.replace(sourceRoot, "").replace(/\.ts$/, "");
|
|
1043
|
-
const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
|
|
1044
|
-
let dtsPath;
|
|
1045
|
-
if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
|
|
1046
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
|
|
1047
|
-
} else if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
|
|
1048
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
|
|
1049
|
-
}
|
|
1050
|
-
const ext = resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
|
|
1051
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
1052
|
-
bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
|
|
1053
|
-
const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
|
|
1054
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
|
|
1055
|
-
} else {
|
|
1056
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
}), "tscPlugin");
|
|
1062
|
-
function getTypeDependencyPackageName(npmPackage) {
|
|
1063
|
-
if (npmPackage.startsWith("@")) {
|
|
1064
|
-
const [scope, name] = npmPackage.split("/");
|
|
1065
|
-
return `@types/${scope?.slice(1)}__${name}`;
|
|
1066
|
-
}
|
|
1067
|
-
return `@types/${npmPackage}`;
|
|
1068
|
-
}
|
|
1069
|
-
__name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
1070
|
-
|
|
1071
648
|
// ../esbuild/src/config.ts
|
|
1072
|
-
var getDefaultBuildPlugins = /* @__PURE__ */ __name((options, resolvedOptions) => [
|
|
1073
|
-
nodeProtocolPlugin(options, resolvedOptions),
|
|
1074
|
-
resolvePathsPlugin(options, resolvedOptions),
|
|
1075
|
-
fixImportsPlugin(options, resolvedOptions),
|
|
1076
|
-
nativeNodeModulesPlugin(options, resolvedOptions),
|
|
1077
|
-
esmSplitCodeToCjsPlugin(options, resolvedOptions),
|
|
1078
|
-
tscPlugin(options, resolvedOptions),
|
|
1079
|
-
onErrorPlugin(options, resolvedOptions)
|
|
1080
|
-
], "getDefaultBuildPlugins");
|
|
1081
649
|
var DEFAULT_BUILD_OPTIONS = {
|
|
650
|
+
assets: [],
|
|
1082
651
|
platform: "node",
|
|
1083
|
-
target:
|
|
652
|
+
target: [
|
|
653
|
+
"esnext"
|
|
654
|
+
],
|
|
1084
655
|
format: "esm",
|
|
1085
|
-
external: [],
|
|
1086
|
-
logLevel: "error",
|
|
1087
656
|
tsconfig: "tsconfig.json",
|
|
1088
657
|
mode: "production",
|
|
658
|
+
generatePackageJson: true,
|
|
659
|
+
includeSrc: false,
|
|
1089
660
|
keepNames: true,
|
|
1090
|
-
metafile:
|
|
1091
|
-
|
|
1092
|
-
|
|
661
|
+
metafile: false,
|
|
662
|
+
treeshake: true,
|
|
663
|
+
shims: false,
|
|
1093
664
|
watch: false,
|
|
1094
665
|
bundle: true,
|
|
1095
|
-
clean: true,
|
|
1096
|
-
debug: false,
|
|
1097
|
-
resolveExtensions: [
|
|
1098
|
-
".tsx",
|
|
1099
|
-
".ts",
|
|
1100
|
-
".cts",
|
|
1101
|
-
".mts",
|
|
1102
|
-
".jsx",
|
|
1103
|
-
".js",
|
|
1104
|
-
".cjs",
|
|
1105
|
-
".mjs",
|
|
1106
|
-
".css",
|
|
1107
|
-
".json"
|
|
1108
|
-
],
|
|
1109
666
|
loader: {
|
|
1110
667
|
".aac": "file",
|
|
1111
668
|
".css": "file",
|
|
@@ -1127,12 +684,15 @@ var DEFAULT_BUILD_OPTIONS = {
|
|
|
1127
684
|
".woff": "file",
|
|
1128
685
|
".woff2": "file"
|
|
1129
686
|
},
|
|
1130
|
-
banner:
|
|
687
|
+
banner: {
|
|
688
|
+
js: DEFAULT_COMPILED_BANNER,
|
|
689
|
+
css: DEFAULT_COMPILED_BANNER
|
|
690
|
+
}
|
|
1131
691
|
};
|
|
1132
692
|
|
|
1133
693
|
// ../esbuild/src/plugins/deps-check.ts
|
|
1134
694
|
import { builtinModules as builtinModules2 } from "node:module";
|
|
1135
|
-
import
|
|
695
|
+
import path2 from "node:path";
|
|
1136
696
|
var unusedIgnore = [
|
|
1137
697
|
// these are our dev dependencies
|
|
1138
698
|
/@types\/.*?/,
|
|
@@ -1164,8 +724,8 @@ var missingIgnore = [
|
|
|
1164
724
|
];
|
|
1165
725
|
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
1166
726
|
name: "storm:deps-check",
|
|
1167
|
-
setup(
|
|
1168
|
-
const pkgJsonPath =
|
|
727
|
+
setup(build3) {
|
|
728
|
+
const pkgJsonPath = path2.join(process.cwd(), "package.json");
|
|
1169
729
|
const pkgContents = __require(pkgJsonPath);
|
|
1170
730
|
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
1171
731
|
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
@@ -1176,7 +736,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
1176
736
|
];
|
|
1177
737
|
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
1178
738
|
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
1179
|
-
|
|
739
|
+
build3.onResolve({
|
|
1180
740
|
filter: onlyPackages
|
|
1181
741
|
}, (args) => {
|
|
1182
742
|
if (args.importer.includes(process.cwd())) {
|
|
@@ -1192,7 +752,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
1192
752
|
external: true
|
|
1193
753
|
};
|
|
1194
754
|
});
|
|
1195
|
-
|
|
755
|
+
build3.onEnd(() => {
|
|
1196
756
|
const unusedDependencies = [
|
|
1197
757
|
...dependencies
|
|
1198
758
|
].filter((dep) => {
|
|
@@ -1220,391 +780,53 @@ ${JSON.stringify(filteredMissingDeps)}
|
|
|
1220
780
|
}
|
|
1221
781
|
}), "depsCheckPlugin");
|
|
1222
782
|
|
|
1223
|
-
// ../esbuild/src/renderers/shebang.ts
|
|
1224
|
-
var shebangRenderer = {
|
|
1225
|
-
name: "shebang",
|
|
1226
|
-
renderChunk(_, __, info) {
|
|
1227
|
-
if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
|
|
1228
|
-
info.mode = 493;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
// ../esbuild/src/tsc.ts
|
|
1234
|
-
import { loadTsConfig } from "bundle-require";
|
|
1235
|
-
import defu2 from "defu";
|
|
1236
|
-
import { existsSync as existsSync4, mkdirSync, writeFileSync } from "node:fs";
|
|
1237
|
-
import { dirname as dirname2, isAbsolute, join, normalize } from "node:path";
|
|
1238
|
-
import ts from "typescript";
|
|
1239
|
-
function ensureTempDeclarationDir(workspaceConfig) {
|
|
1240
|
-
const root = workspaceConfig.directories.temp || join(workspaceConfig.workspaceRoot, "tmp");
|
|
1241
|
-
const dirPath = join(root, ".tsc", "declaration");
|
|
1242
|
-
if (existsSync4(dirPath)) {
|
|
1243
|
-
return dirPath;
|
|
1244
|
-
}
|
|
1245
|
-
mkdirSync(dirPath, {
|
|
1246
|
-
recursive: true
|
|
1247
|
-
});
|
|
1248
|
-
const gitIgnorePath = join(root, ".tsc", ".gitignore");
|
|
1249
|
-
writeFileSync(gitIgnorePath, "**/*\n");
|
|
1250
|
-
return dirPath;
|
|
1251
|
-
}
|
|
1252
|
-
__name(ensureTempDeclarationDir, "ensureTempDeclarationDir");
|
|
1253
|
-
function slash(path7) {
|
|
1254
|
-
const isExtendedLengthPath = path7.startsWith("\\\\?\\");
|
|
1255
|
-
if (isExtendedLengthPath) {
|
|
1256
|
-
return path7;
|
|
1257
|
-
}
|
|
1258
|
-
return path7.replace(/\\/g, "/");
|
|
1259
|
-
}
|
|
1260
|
-
__name(slash, "slash");
|
|
1261
|
-
function toAbsolutePath(workspaceConfig, p, cwd) {
|
|
1262
|
-
if (isAbsolute(p)) {
|
|
1263
|
-
return p;
|
|
1264
|
-
}
|
|
1265
|
-
return slash(normalize(join(cwd || workspaceConfig.workspaceRoot, p)));
|
|
1266
|
-
}
|
|
1267
|
-
__name(toAbsolutePath, "toAbsolutePath");
|
|
1268
|
-
var AliasPool = class AliasPool2 {
|
|
1269
|
-
static {
|
|
1270
|
-
__name(this, "AliasPool");
|
|
1271
|
-
}
|
|
1272
|
-
seen = /* @__PURE__ */ new Set();
|
|
1273
|
-
assign(name) {
|
|
1274
|
-
let suffix = 0;
|
|
1275
|
-
let alias = name === "default" ? "default_alias" : name;
|
|
1276
|
-
while (this.seen.has(alias)) {
|
|
1277
|
-
alias = `${name}_alias_${++suffix}`;
|
|
1278
|
-
if (suffix >= 1e3) {
|
|
1279
|
-
throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
this.seen.add(alias);
|
|
1283
|
-
return alias;
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
function getExports(workspaceConfig, program, fileMapping) {
|
|
1287
|
-
const checker = program.getTypeChecker();
|
|
1288
|
-
const aliasPool = new AliasPool();
|
|
1289
|
-
const assignAlias = aliasPool.assign.bind(aliasPool);
|
|
1290
|
-
function extractExports(sourceFileName) {
|
|
1291
|
-
const cwd = program.getCurrentDirectory();
|
|
1292
|
-
sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
|
|
1293
|
-
const sourceFile = program.getSourceFile(sourceFileName);
|
|
1294
|
-
if (!sourceFile) {
|
|
1295
|
-
return [];
|
|
1296
|
-
}
|
|
1297
|
-
const destFileName = fileMapping.get(sourceFileName);
|
|
1298
|
-
if (!destFileName) {
|
|
1299
|
-
return [];
|
|
1300
|
-
}
|
|
1301
|
-
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
1302
|
-
if (!moduleSymbol) {
|
|
1303
|
-
return [];
|
|
1304
|
-
}
|
|
1305
|
-
const exports = [];
|
|
1306
|
-
const exportSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1307
|
-
exportSymbols.forEach((symbol) => {
|
|
1308
|
-
const name = symbol.getName();
|
|
1309
|
-
exports.push({
|
|
1310
|
-
kind: "named",
|
|
1311
|
-
sourceFileName,
|
|
1312
|
-
destFileName,
|
|
1313
|
-
name,
|
|
1314
|
-
alias: assignAlias(name),
|
|
1315
|
-
isTypeOnly: false
|
|
1316
|
-
});
|
|
1317
|
-
});
|
|
1318
|
-
return exports;
|
|
1319
|
-
}
|
|
1320
|
-
__name(extractExports, "extractExports");
|
|
1321
|
-
return program.getRootFileNames().flatMap(extractExports);
|
|
1322
|
-
}
|
|
1323
|
-
__name(getExports, "getExports");
|
|
1324
|
-
function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
|
|
1325
|
-
const fileMapping = /* @__PURE__ */ new Map();
|
|
1326
|
-
const writeFile3 = /* @__PURE__ */ __name((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
1327
|
-
const sourceFile = sourceFiles?.[0];
|
|
1328
|
-
const sourceFileName = sourceFile?.fileName;
|
|
1329
|
-
if (sourceFileName && !fileName.endsWith(".map")) {
|
|
1330
|
-
const cwd = program.getCurrentDirectory();
|
|
1331
|
-
fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
|
|
1332
|
-
}
|
|
1333
|
-
return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
1334
|
-
}, "writeFile");
|
|
1335
|
-
const emitResult = program.emit(void 0, writeFile3, void 0, emitOnlyDtsFiles, customTransformers);
|
|
1336
|
-
const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
1337
|
-
const diagnosticMessages = [];
|
|
1338
|
-
diagnostics.forEach((diagnostic) => {
|
|
1339
|
-
if (diagnostic.file) {
|
|
1340
|
-
const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
1341
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
1342
|
-
diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
1343
|
-
} else {
|
|
1344
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
1345
|
-
diagnosticMessages.push(message);
|
|
1346
|
-
}
|
|
1347
|
-
});
|
|
1348
|
-
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
1349
|
-
if (diagnosticMessage) {
|
|
1350
|
-
writeError(`Failed to emit declaration files.
|
|
1351
|
-
|
|
1352
|
-
${diagnosticMessage}`, workspaceConfig);
|
|
1353
|
-
throw new Error("TypeScript compilation failed");
|
|
1354
|
-
}
|
|
1355
|
-
return fileMapping;
|
|
1356
|
-
}
|
|
1357
|
-
__name(emitDtsFiles, "emitDtsFiles");
|
|
1358
|
-
function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
|
|
1359
|
-
const rawTsconfig = loadTsConfig(workspaceConfig.workspaceRoot, tsconfig);
|
|
1360
|
-
if (!rawTsconfig) {
|
|
1361
|
-
throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
|
|
1362
|
-
}
|
|
1363
|
-
const declarationDir = ensureTempDeclarationDir(workspaceConfig);
|
|
1364
|
-
const parsedTsconfig = ts.parseJsonConfigFileContent(defu2({
|
|
1365
|
-
compilerOptions: {
|
|
1366
|
-
// Enable declaration emit and disable javascript emit
|
|
1367
|
-
noEmit: false,
|
|
1368
|
-
declaration: true,
|
|
1369
|
-
declarationMap: true,
|
|
1370
|
-
declarationDir,
|
|
1371
|
-
emitDeclarationOnly: true
|
|
1372
|
-
}
|
|
1373
|
-
}, tsconfigRaw?.compilerOptions ?? {}, rawTsconfig.data ?? {}), ts.sys, tsconfig ? dirname2(tsconfig) : "./");
|
|
1374
|
-
const options = parsedTsconfig.options;
|
|
1375
|
-
const host = ts.createCompilerHost(options);
|
|
1376
|
-
const program = ts.createProgram(parsedTsconfig.fileNames, options, host);
|
|
1377
|
-
const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
|
|
1378
|
-
return getExports(workspaceConfig, program, fileMapping);
|
|
1379
|
-
}
|
|
1380
|
-
__name(emitDts, "emitDts");
|
|
1381
|
-
|
|
1382
|
-
// ../esbuild/src/utilities/get-entry-points.ts
|
|
1383
|
-
import { glob as glob3 } from "glob";
|
|
1384
|
-
var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
1385
|
-
const workspaceRoot3 = config.workspaceRoot || findWorkspaceRoot();
|
|
1386
|
-
const entryPoints = [];
|
|
1387
|
-
if (entry) {
|
|
1388
|
-
if (typeof entry === "string") {
|
|
1389
|
-
entryPoints.push({
|
|
1390
|
-
in: entry,
|
|
1391
|
-
out: entry
|
|
1392
|
-
});
|
|
1393
|
-
} else if (Array.isArray(entry)) {
|
|
1394
|
-
entryPoints.push(...entry.map((entry2) => ({
|
|
1395
|
-
in: entry2,
|
|
1396
|
-
out: entry2
|
|
1397
|
-
})));
|
|
1398
|
-
} else {
|
|
1399
|
-
entryPoints.push(...Object.entries(entry).map(([key, value]) => {
|
|
1400
|
-
if (typeof value === "string") {
|
|
1401
|
-
return {
|
|
1402
|
-
in: value,
|
|
1403
|
-
out: key
|
|
1404
|
-
};
|
|
1405
|
-
} else {
|
|
1406
|
-
return {
|
|
1407
|
-
in: key,
|
|
1408
|
-
out: key
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
}));
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
if (emitOnAll) {
|
|
1415
|
-
entryPoints.push({
|
|
1416
|
-
in: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"),
|
|
1417
|
-
out: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}")
|
|
1418
|
-
});
|
|
1419
|
-
}
|
|
1420
|
-
const results = await Promise.all(entryPoints.map(async (entryPoint) => {
|
|
1421
|
-
const paths = [];
|
|
1422
|
-
if (entryPoint.in.includes("*")) {
|
|
1423
|
-
const files = await glob3(entryPoint.in, {
|
|
1424
|
-
withFileTypes: true,
|
|
1425
|
-
ignore: [
|
|
1426
|
-
"**/node_modules/**"
|
|
1427
|
-
]
|
|
1428
|
-
});
|
|
1429
|
-
paths.push(...files.reduce((ret, filePath) => {
|
|
1430
|
-
const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot3), "").replaceAll(correctPaths(projectRoot), ""));
|
|
1431
|
-
if (result) {
|
|
1432
|
-
writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
|
|
1433
|
-
if (!paths.some((p) => p.in === result)) {
|
|
1434
|
-
paths.push({
|
|
1435
|
-
in: result,
|
|
1436
|
-
out: entryPoint.out.replace(entryPoint.in, result)
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
return ret;
|
|
1441
|
-
}, []));
|
|
1442
|
-
} else {
|
|
1443
|
-
writeDebug(`Adding ESBuild entry point
|
|
1444
|
-
- Input: ${entryPoint.in}
|
|
1445
|
-
- Output: ${entryPoint.out}`, config);
|
|
1446
|
-
if (!paths.some((p) => p.out === entryPoint.out)) {
|
|
1447
|
-
paths.push(entryPoint);
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
return paths;
|
|
1451
|
-
}));
|
|
1452
|
-
return results.filter(Boolean).reduce((ret, result) => {
|
|
1453
|
-
result.forEach((res) => {
|
|
1454
|
-
if (res && !ret.some((p) => p.in === res.in)) {
|
|
1455
|
-
ret.push(res);
|
|
1456
|
-
}
|
|
1457
|
-
});
|
|
1458
|
-
return ret;
|
|
1459
|
-
}, []);
|
|
1460
|
-
}, "getEntryPoints");
|
|
1461
|
-
|
|
1462
|
-
// ../esbuild/src/utilities/helpers.ts
|
|
1463
|
-
function handleSync(fn) {
|
|
1464
|
-
try {
|
|
1465
|
-
return fn();
|
|
1466
|
-
} catch (error_) {
|
|
1467
|
-
return error_;
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
__name(handleSync, "handleSync");
|
|
1471
|
-
async function handleAsync(fn) {
|
|
1472
|
-
try {
|
|
1473
|
-
return await fn();
|
|
1474
|
-
} catch (error_) {
|
|
1475
|
-
return error_;
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
__name(handleAsync, "handleAsync");
|
|
1479
|
-
var handle = handleSync;
|
|
1480
|
-
handle.async = handleAsync;
|
|
1481
|
-
var skip = Symbol("skip");
|
|
1482
|
-
function transduceSync(list, transformer) {
|
|
1483
|
-
const transduced = [];
|
|
1484
|
-
for (const [i, element_] of list.entries()) {
|
|
1485
|
-
const transformed = transformer(element_, i);
|
|
1486
|
-
if (transformed !== skip) {
|
|
1487
|
-
transduced[transduced.length] = transformed;
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
return transduced;
|
|
1491
|
-
}
|
|
1492
|
-
__name(transduceSync, "transduceSync");
|
|
1493
|
-
async function transduceAsync(list, transformer) {
|
|
1494
|
-
const transduced = [];
|
|
1495
|
-
await Promise.all(list.entries().map(async ([i, element_]) => {
|
|
1496
|
-
const transformed = await transformer(element_, i);
|
|
1497
|
-
if (transformed !== skip) {
|
|
1498
|
-
transduced[transduced.length] = transformed;
|
|
1499
|
-
}
|
|
1500
|
-
}));
|
|
1501
|
-
return transduced;
|
|
1502
|
-
}
|
|
1503
|
-
__name(transduceAsync, "transduceAsync");
|
|
1504
|
-
var transduce = transduceSync;
|
|
1505
|
-
transduce.async = transduceAsync;
|
|
1506
|
-
function pipeSync(fn, ...fns) {
|
|
1507
|
-
return (...args) => {
|
|
1508
|
-
let result = fn(...args);
|
|
1509
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
1510
|
-
result = fns[i]?.(result);
|
|
1511
|
-
}
|
|
1512
|
-
return result;
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
__name(pipeSync, "pipeSync");
|
|
1516
|
-
function pipeAsync(fn, ...fns) {
|
|
1517
|
-
return async (...args) => {
|
|
1518
|
-
let result = await fn(...args);
|
|
1519
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
1520
|
-
result = await fns[i]?.(result);
|
|
1521
|
-
}
|
|
1522
|
-
return result;
|
|
1523
|
-
};
|
|
1524
|
-
}
|
|
1525
|
-
__name(pipeAsync, "pipeAsync");
|
|
1526
|
-
var pipe = pipeSync;
|
|
1527
|
-
pipe.async = pipeAsync;
|
|
1528
|
-
|
|
1529
783
|
// ../esbuild/src/build.ts
|
|
1530
|
-
|
|
784
|
+
async function resolveContext(userOptions) {
|
|
1531
785
|
const projectRoot = userOptions.projectRoot;
|
|
1532
786
|
const workspaceRoot3 = findWorkspaceRoot2(projectRoot);
|
|
1533
787
|
if (!workspaceRoot3) {
|
|
1534
788
|
throw new Error("Cannot find Nx workspace root");
|
|
1535
789
|
}
|
|
1536
|
-
const
|
|
1537
|
-
|
|
790
|
+
const workspaceConfig = await getWorkspaceConfig(true, {
|
|
791
|
+
workspaceRoot: workspaceRoot3.dir
|
|
792
|
+
});
|
|
793
|
+
writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
|
|
1538
794
|
const stopwatch = getStopwatch("Build options resolution");
|
|
1539
|
-
const projectGraph = await
|
|
795
|
+
const projectGraph = await createProjectGraphAsync2({
|
|
1540
796
|
exitOnError: true
|
|
1541
797
|
});
|
|
1542
798
|
const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
|
|
1543
|
-
if (!
|
|
799
|
+
if (!existsSync3(projectJsonPath)) {
|
|
1544
800
|
throw new Error("Cannot find project.json configuration");
|
|
1545
801
|
}
|
|
1546
802
|
const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
|
|
1547
803
|
const projectJson = JSON.parse(projectJsonFile);
|
|
1548
|
-
const projectName = projectJson.name;
|
|
804
|
+
const projectName = projectJson.name || userOptions.name;
|
|
1549
805
|
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
1550
806
|
if (!projectConfigurations?.projects?.[projectName]) {
|
|
1551
807
|
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.");
|
|
1552
808
|
}
|
|
1553
|
-
const options =
|
|
809
|
+
const options = defu2(userOptions, DEFAULT_BUILD_OPTIONS);
|
|
1554
810
|
options.name ??= `${projectName}-${options.format}`;
|
|
1555
811
|
options.target ??= DEFAULT_TARGET;
|
|
1556
812
|
const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
|
|
1557
|
-
if (!
|
|
813
|
+
if (!existsSync3(packageJsonPath)) {
|
|
1558
814
|
throw new Error("Cannot find package.json configuration");
|
|
1559
815
|
}
|
|
1560
816
|
const env = getEnv("esbuild", options);
|
|
1561
|
-
const
|
|
817
|
+
const resolvedOptions = {
|
|
1562
818
|
...options,
|
|
1563
|
-
config,
|
|
1564
|
-
mainFields: options.platform === "node" ? [
|
|
1565
|
-
"module",
|
|
1566
|
-
"main"
|
|
1567
|
-
] : [
|
|
1568
|
-
"browser",
|
|
1569
|
-
"module",
|
|
1570
|
-
"main"
|
|
1571
|
-
],
|
|
1572
|
-
...userOptions,
|
|
1573
819
|
tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
projectName,
|
|
1582
|
-
projectGraph,
|
|
1583
|
-
sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
|
|
1584
|
-
minify: userOptions.minify || !userOptions.debug,
|
|
1585
|
-
verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
|
|
1586
|
-
includeSrc: userOptions.includeSrc === true,
|
|
1587
|
-
metafile: userOptions.metafile !== false,
|
|
1588
|
-
generatePackageJson: userOptions.generatePackageJson !== false,
|
|
1589
|
-
clean: userOptions.clean !== false,
|
|
1590
|
-
assets: userOptions.assets ?? [],
|
|
1591
|
-
injectShims: userOptions.injectShims !== true,
|
|
1592
|
-
bundle: userOptions.bundle !== false,
|
|
1593
|
-
keepNames: true,
|
|
1594
|
-
watch: userOptions.watch === true,
|
|
1595
|
-
footer: userOptions.footer,
|
|
1596
|
-
banner: {
|
|
1597
|
-
js: options.banner || DEFAULT_COMPILED_BANNER,
|
|
1598
|
-
css: options.banner || DEFAULT_COMPILED_BANNER
|
|
1599
|
-
},
|
|
1600
|
-
splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
|
|
1601
|
-
treeShaking: options.format === "esm",
|
|
820
|
+
distDir: "dist",
|
|
821
|
+
name: projectName,
|
|
822
|
+
metafile: userOptions.mode === "development",
|
|
823
|
+
...userOptions,
|
|
824
|
+
clean: false,
|
|
825
|
+
target: userOptions.target || options.target,
|
|
826
|
+
splitting: options.format === "iife" ? false : options.treeshake === void 0 ? options.splitting : true,
|
|
1602
827
|
env,
|
|
1603
828
|
define: {
|
|
1604
|
-
STORM_FORMAT: JSON.stringify(options.format
|
|
1605
|
-
...options.format === "cjs" && options.injectShims ? {
|
|
1606
|
-
"import.meta.url": "importMetaUrl"
|
|
1607
|
-
} : {},
|
|
829
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
1608
830
|
...options.define,
|
|
1609
831
|
...Object.keys(env || {}).reduce((res, key) => {
|
|
1610
832
|
const value = JSON.stringify(env[key]);
|
|
@@ -1615,167 +837,98 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
|
|
|
1615
837
|
[`import.meta.env.${safeKey}`]: value
|
|
1616
838
|
};
|
|
1617
839
|
}, {})
|
|
1618
|
-
}
|
|
1619
|
-
inject: [
|
|
1620
|
-
options.format === "cjs" && options.injectShims ? joinPaths(__dirname, "../assets/cjs_shims.js") : void 0,
|
|
1621
|
-
options.format === "esm" && options.injectShims && options.platform === "node" ? joinPaths(__dirname, "../assets/esm_shims.js") : void 0
|
|
1622
|
-
].filter(Boolean)
|
|
840
|
+
}
|
|
1623
841
|
};
|
|
1624
|
-
result.plugins = userOptions.plugins ?? getDefaultBuildPlugins(userOptions, result);
|
|
1625
|
-
if (options.inject && Array.isArray(options.inject) && options.inject.length > 0) {
|
|
1626
|
-
result.inject = options.inject.reduce((ret, inj) => {
|
|
1627
|
-
if (inj && typeof inj === "string" && ret.includes(inj)) {
|
|
1628
|
-
ret.push(inj);
|
|
1629
|
-
}
|
|
1630
|
-
return ret;
|
|
1631
|
-
}, result.inject);
|
|
1632
|
-
}
|
|
1633
|
-
delete result.entry;
|
|
1634
|
-
delete result.outputPath;
|
|
1635
842
|
stopwatch();
|
|
1636
|
-
return
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
843
|
+
return {
|
|
844
|
+
options: resolvedOptions,
|
|
845
|
+
clean: userOptions.clean !== false,
|
|
846
|
+
workspaceConfig,
|
|
847
|
+
projectConfigurations,
|
|
848
|
+
projectName,
|
|
849
|
+
projectGraph,
|
|
850
|
+
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
|
|
851
|
+
outputPath: resolvedOptions.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
|
|
852
|
+
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
__name(resolveContext, "resolveContext");
|
|
856
|
+
async function generatePackageJson(context) {
|
|
857
|
+
if (context.options.generatePackageJson !== false && existsSync3(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
858
|
+
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
1641
859
|
const stopwatch = getStopwatch("Write package.json file");
|
|
1642
|
-
const packageJsonPath = joinPaths(
|
|
1643
|
-
if (!
|
|
860
|
+
const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
|
|
861
|
+
if (!existsSync3(packageJsonPath)) {
|
|
1644
862
|
throw new Error("Cannot find package.json configuration");
|
|
1645
863
|
}
|
|
1646
|
-
const packageJsonFile = await hf.readFile(joinPaths(
|
|
864
|
+
const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
|
|
1647
865
|
let packageJson = JSON.parse(packageJsonFile);
|
|
1648
866
|
if (!packageJson) {
|
|
1649
867
|
throw new Error("Cannot find package.json configuration file");
|
|
1650
868
|
}
|
|
1651
|
-
packageJson = await addPackageDependencies(
|
|
1652
|
-
packageJson = await addWorkspacePackageJsonFields(
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
869
|
+
packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
|
|
870
|
+
packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
|
|
871
|
+
if (context.options.entry) {
|
|
872
|
+
packageJson.exports ??= {};
|
|
873
|
+
packageJson.exports["./package.json"] ??= "./package.json";
|
|
874
|
+
packageJson.exports["."] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js`;
|
|
875
|
+
const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
|
|
876
|
+
for (const entryPoint of entryPoints) {
|
|
877
|
+
if (context.options.entry[entryPoint]) {
|
|
878
|
+
const entry = context.options.entry[entryPoint].replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
|
|
879
|
+
packageJson.exports[`./${entry}`] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entry}.js`;
|
|
880
|
+
}
|
|
1660
881
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
packageJson.main = packageJson.type === "commonjs" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.cjs`;
|
|
1666
|
-
}
|
|
1667
|
-
packageJson.types = `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.d.ts`;
|
|
1668
|
-
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
1669
|
-
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
1670
|
-
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
882
|
+
if (context.options.format === "esm") {
|
|
883
|
+
packageJson.module = packageJson.type === "module" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.mjs`;
|
|
884
|
+
} else {
|
|
885
|
+
packageJson.main = packageJson.type === "commonjs" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.cjs`;
|
|
1671
886
|
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
887
|
+
packageJson.types = `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.d.ts`;
|
|
888
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
889
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
890
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
891
|
+
}
|
|
892
|
+
return ret;
|
|
893
|
+
}, packageJson.exports);
|
|
894
|
+
}
|
|
895
|
+
await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
|
|
1675
896
|
stopwatch();
|
|
1676
897
|
}
|
|
1677
|
-
return
|
|
898
|
+
return context;
|
|
1678
899
|
}
|
|
1679
900
|
__name(generatePackageJson, "generatePackageJson");
|
|
1680
|
-
async function
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
const options = await getOptions();
|
|
1689
|
-
const rendererEngine = new RendererEngine([
|
|
1690
|
-
shebangRenderer,
|
|
1691
|
-
...options.renderers || []
|
|
1692
|
-
]);
|
|
1693
|
-
return {
|
|
1694
|
-
options,
|
|
1695
|
-
rendererEngine
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
1698
|
-
__name(generateContext, "generateContext");
|
|
1699
|
-
async function executeEsBuild(context2) {
|
|
1700
|
-
writeDebug(` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
|
|
1701
|
-
const stopwatch = getStopwatch(`${context2.options.name} build`);
|
|
1702
|
-
if (process.env.STORM_WATCH) {
|
|
1703
|
-
const ctx = await esbuild2.context(context2.options);
|
|
1704
|
-
watch(ctx, context2.options);
|
|
1705
|
-
}
|
|
1706
|
-
const options = {
|
|
1707
|
-
...context2.options
|
|
1708
|
-
};
|
|
1709
|
-
options.outdir = joinPaths(context2.options.outdir, context2.options.distDir);
|
|
1710
|
-
if (!options.inject || !Array.isArray(options.inject) || options.inject.length === 0 || // eslint-disable-next-line no-constant-binary-expression, @typescript-eslint/no-explicit-any
|
|
1711
|
-
options.inject === {}) {
|
|
1712
|
-
delete options.inject;
|
|
1713
|
-
}
|
|
1714
|
-
delete options.dts;
|
|
1715
|
-
delete options.env;
|
|
1716
|
-
delete options.name;
|
|
1717
|
-
delete options.assets;
|
|
1718
|
-
delete options.mode;
|
|
1719
|
-
delete options.orgName;
|
|
1720
|
-
delete options.watch;
|
|
1721
|
-
delete options.clean;
|
|
1722
|
-
delete options.debug;
|
|
1723
|
-
delete options.generatePackageJson;
|
|
1724
|
-
delete options.distDir;
|
|
1725
|
-
delete options.includeSrc;
|
|
1726
|
-
delete options.verbose;
|
|
1727
|
-
delete options.projectRoot;
|
|
1728
|
-
delete options.projectName;
|
|
1729
|
-
delete options.projectGraph;
|
|
1730
|
-
delete options.projectConfigurations;
|
|
1731
|
-
delete options.renderers;
|
|
1732
|
-
delete options.config;
|
|
1733
|
-
delete options.injectShims;
|
|
1734
|
-
delete options.external;
|
|
1735
|
-
writeTrace(`Run esbuild (${context2.options.name}) with the following options:
|
|
1736
|
-
${formatLogMessage({
|
|
1737
|
-
...options,
|
|
1738
|
-
define: "<Hidden>"
|
|
1739
|
-
})}`, context2.options.config);
|
|
1740
|
-
const result = await esbuild2.build(options);
|
|
1741
|
-
await esbuild2.stop();
|
|
1742
|
-
if (result.metafile) {
|
|
1743
|
-
const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
|
|
1744
|
-
await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
|
|
1745
|
-
}
|
|
901
|
+
async function executeTsup(context) {
|
|
902
|
+
writeDebug(` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
|
|
903
|
+
const stopwatch = getStopwatch(`${context.options.name} build`);
|
|
904
|
+
await tsup({
|
|
905
|
+
...context.options,
|
|
906
|
+
outDir: context.outputPath,
|
|
907
|
+
workspaceConfig: context.workspaceConfig
|
|
908
|
+
});
|
|
1746
909
|
stopwatch();
|
|
1747
|
-
return
|
|
1748
|
-
}
|
|
1749
|
-
__name(executeEsBuild, "executeEsBuild");
|
|
1750
|
-
async function executeTypescript(context2) {
|
|
1751
|
-
if (context2.result?.errors.length === 0 && context2.options.dts) {
|
|
1752
|
-
writeDebug(` \u{1F4CB} Running TypeScript Compiler for ${context2.options.name}`, context2.options.config);
|
|
1753
|
-
const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
|
|
1754
|
-
await emitDts(context2.options.config, context2.options.tsconfig, context2.options.tsconfigRaw, true);
|
|
1755
|
-
stopwatch();
|
|
1756
|
-
}
|
|
1757
|
-
return context2;
|
|
910
|
+
return context;
|
|
1758
911
|
}
|
|
1759
|
-
__name(
|
|
1760
|
-
async function copyBuildAssets(
|
|
1761
|
-
if (
|
|
1762
|
-
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${
|
|
1763
|
-
const stopwatch = getStopwatch(`${
|
|
1764
|
-
await copyAssets(
|
|
912
|
+
__name(executeTsup, "executeTsup");
|
|
913
|
+
async function copyBuildAssets(context) {
|
|
914
|
+
if (context.result?.errors.length === 0) {
|
|
915
|
+
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`, context.workspaceConfig);
|
|
916
|
+
const stopwatch = getStopwatch(`${context.options.name} asset copy`);
|
|
917
|
+
await copyAssets(context.workspaceConfig, context.options.assets ?? [], context.outputPath, context.options.projectRoot, context.sourceRoot, true, false);
|
|
1765
918
|
stopwatch();
|
|
1766
919
|
}
|
|
1767
|
-
return
|
|
920
|
+
return context;
|
|
1768
921
|
}
|
|
1769
922
|
__name(copyBuildAssets, "copyBuildAssets");
|
|
1770
|
-
async function reportResults(
|
|
1771
|
-
if (
|
|
1772
|
-
if (
|
|
1773
|
-
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${
|
|
923
|
+
async function reportResults(context) {
|
|
924
|
+
if (context.result?.errors.length === 0) {
|
|
925
|
+
if (context.result.warnings.length > 0) {
|
|
926
|
+
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
|
|
1774
927
|
}
|
|
1775
|
-
writeSuccess(` \u{1F4E6} The ${
|
|
1776
|
-
} else if (
|
|
1777
|
-
writeError(` \u274C The ${
|
|
1778
|
-
throw new Error(`The ${
|
|
928
|
+
writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
|
|
929
|
+
} else if (context.result?.errors && context.result?.errors.length > 0) {
|
|
930
|
+
writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
|
|
931
|
+
throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
|
|
1779
932
|
}
|
|
1780
933
|
}
|
|
1781
934
|
__name(reportResults, "reportResults");
|
|
@@ -1786,7 +939,7 @@ async function dependencyCheck(options) {
|
|
|
1786
939
|
if (process.env.CI && !process.env.BUILDKITE) {
|
|
1787
940
|
return void 0;
|
|
1788
941
|
}
|
|
1789
|
-
const buildPromise =
|
|
942
|
+
const buildPromise = esbuild.build({
|
|
1790
943
|
entryPoints: globbySync("**/*.{j,t}s", {
|
|
1791
944
|
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
1792
945
|
ignore: [
|
|
@@ -1809,17 +962,17 @@ async function dependencyCheck(options) {
|
|
|
1809
962
|
return void 0;
|
|
1810
963
|
}
|
|
1811
964
|
__name(dependencyCheck, "dependencyCheck");
|
|
1812
|
-
async function cleanOutputPath(
|
|
1813
|
-
if (
|
|
1814
|
-
writeDebug(` \u{1F9F9} Cleaning ${
|
|
1815
|
-
const stopwatch = getStopwatch(`${
|
|
1816
|
-
await cleanDirectories(
|
|
965
|
+
async function cleanOutputPath(context) {
|
|
966
|
+
if (context.clean !== false && context.outputPath) {
|
|
967
|
+
writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
|
|
968
|
+
const stopwatch = getStopwatch(`${context.options.name} output clean`);
|
|
969
|
+
await cleanDirectories(context.outputPath);
|
|
1817
970
|
stopwatch();
|
|
1818
971
|
}
|
|
1819
|
-
return
|
|
972
|
+
return context;
|
|
1820
973
|
}
|
|
1821
974
|
__name(cleanOutputPath, "cleanOutputPath");
|
|
1822
|
-
async function
|
|
975
|
+
async function build2(options) {
|
|
1823
976
|
writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
|
|
1824
977
|
const stopwatch = getStopwatch("ESBuild pipeline");
|
|
1825
978
|
try {
|
|
@@ -1829,8 +982,15 @@ async function build3(options) {
|
|
|
1829
982
|
if (opts.length === 0) {
|
|
1830
983
|
throw new Error("No build options were provided");
|
|
1831
984
|
}
|
|
1832
|
-
|
|
1833
|
-
await
|
|
985
|
+
const context = await resolveContext(options);
|
|
986
|
+
await cleanOutputPath(context);
|
|
987
|
+
await Promise.all([
|
|
988
|
+
dependencyCheck(context.options),
|
|
989
|
+
generatePackageJson(context),
|
|
990
|
+
copyBuildAssets(context),
|
|
991
|
+
executeTsup(context)
|
|
992
|
+
]);
|
|
993
|
+
await reportResults(context);
|
|
1834
994
|
writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
|
|
1835
995
|
} catch (error) {
|
|
1836
996
|
writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
|
|
@@ -1839,47 +999,19 @@ async function build3(options) {
|
|
|
1839
999
|
stopwatch();
|
|
1840
1000
|
}
|
|
1841
1001
|
}
|
|
1842
|
-
__name(
|
|
1843
|
-
var watch = /* @__PURE__ */ __name((context2, options) => {
|
|
1844
|
-
if (!options.watch) {
|
|
1845
|
-
return context2;
|
|
1846
|
-
}
|
|
1847
|
-
const config = {
|
|
1848
|
-
ignoreInitial: true,
|
|
1849
|
-
useFsEvents: true,
|
|
1850
|
-
ignored: [
|
|
1851
|
-
"./src/__tests__/**/*",
|
|
1852
|
-
"./package.json"
|
|
1853
|
-
]
|
|
1854
|
-
};
|
|
1855
|
-
const changeWatcher = createWatcher([
|
|
1856
|
-
"./src/**/*"
|
|
1857
|
-
], config);
|
|
1858
|
-
const fastRebuild = debounce(async () => {
|
|
1859
|
-
const timeBefore = Date.now();
|
|
1860
|
-
const rebuildResult = await handle.async(() => {
|
|
1861
|
-
return context2.rebuild();
|
|
1862
|
-
});
|
|
1863
|
-
if (rebuildResult instanceof Error) {
|
|
1864
|
-
writeError(rebuildResult.message);
|
|
1865
|
-
}
|
|
1866
|
-
writeTrace(`${Date.now() - timeBefore}ms [${options.name ?? ""}]`);
|
|
1867
|
-
}, 10);
|
|
1868
|
-
changeWatcher.on("change", fastRebuild);
|
|
1869
|
-
return void 0;
|
|
1870
|
-
}, "watch");
|
|
1002
|
+
__name(build2, "build");
|
|
1871
1003
|
|
|
1872
1004
|
// ../workspace-tools/src/executors/esbuild/executor.ts
|
|
1873
|
-
async function esbuildExecutorFn(options,
|
|
1005
|
+
async function esbuildExecutorFn(options, context, config) {
|
|
1874
1006
|
writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
|
|
1875
|
-
if (!
|
|
1007
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
1876
1008
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
1877
1009
|
}
|
|
1878
|
-
await
|
|
1010
|
+
await build2({
|
|
1879
1011
|
...options,
|
|
1880
|
-
projectRoot:
|
|
1881
|
-
|
|
1882
|
-
sourceRoot:
|
|
1012
|
+
projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
|
|
1013
|
+
name: context.projectName,
|
|
1014
|
+
sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
|
|
1883
1015
|
format: options.format,
|
|
1884
1016
|
platform: options.format
|
|
1885
1017
|
});
|
|
@@ -1903,17 +1035,17 @@ var executor_default6 = withRunExecutor("Storm ESBuild build", esbuildExecutorFn
|
|
|
1903
1035
|
});
|
|
1904
1036
|
|
|
1905
1037
|
// ../workspace-tools/src/executors/npm-publish/executor.ts
|
|
1906
|
-
import { execSync as
|
|
1038
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
1907
1039
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
1908
1040
|
|
|
1909
1041
|
// ../workspace-tools/src/utils/pnpm-deps-update.ts
|
|
1910
|
-
import { existsSync as
|
|
1042
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1911
1043
|
import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
1912
1044
|
import { format } from "prettier";
|
|
1913
1045
|
import readYamlFile from "read-yaml-file";
|
|
1914
1046
|
|
|
1915
1047
|
// ../workspace-tools/src/executors/npm-publish/executor.ts
|
|
1916
|
-
var
|
|
1048
|
+
var LARGE_BUFFER2 = 1024 * 1e6;
|
|
1917
1049
|
|
|
1918
1050
|
// ../workspace-tools/src/executors/size-limit/executor.ts
|
|
1919
1051
|
import { joinPathFragments as joinPathFragments3 } from "@nx/devkit";
|
|
@@ -1921,19 +1053,19 @@ import esBuildPlugin from "@size-limit/esbuild";
|
|
|
1921
1053
|
import esBuildWhyPlugin from "@size-limit/esbuild-why";
|
|
1922
1054
|
import filePlugin from "@size-limit/file";
|
|
1923
1055
|
import sizeLimit from "size-limit";
|
|
1924
|
-
async function sizeLimitExecutorFn(options,
|
|
1925
|
-
if (!
|
|
1056
|
+
async function sizeLimitExecutorFn(options, context, config) {
|
|
1057
|
+
if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1926
1058
|
throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
|
|
1927
1059
|
}
|
|
1928
|
-
writeInfo(`\u{1F4CF} Running Size-Limit on ${
|
|
1060
|
+
writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
|
|
1929
1061
|
sizeLimit([
|
|
1930
1062
|
filePlugin,
|
|
1931
1063
|
esBuildPlugin,
|
|
1932
1064
|
esBuildWhyPlugin
|
|
1933
1065
|
], {
|
|
1934
|
-
checks: options.entry ??
|
|
1066
|
+
checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(context.projectsConfigurations.projects[context.projectName]?.root ?? "./", "src")
|
|
1935
1067
|
}).then((result) => {
|
|
1936
|
-
writeInfo(`\u{1F4CF} ${
|
|
1068
|
+
writeInfo(`\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
|
|
1937
1069
|
});
|
|
1938
1070
|
return {
|
|
1939
1071
|
success: true
|
|
@@ -1986,17 +1118,17 @@ var executor_default8 = withRunExecutor("Typia runtime validation generator", ty
|
|
|
1986
1118
|
});
|
|
1987
1119
|
|
|
1988
1120
|
// ../workspace-tools/src/executors/unbuild/executor.ts
|
|
1989
|
-
import { defu as
|
|
1121
|
+
import { defu as defu3 } from "defu";
|
|
1990
1122
|
import { createJiti } from "jiti";
|
|
1991
|
-
async function unbuildExecutorFn(options,
|
|
1123
|
+
async function unbuildExecutorFn(options, context, config) {
|
|
1992
1124
|
writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
|
|
1993
|
-
if (!
|
|
1125
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1994
1126
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
|
|
1995
1127
|
}
|
|
1996
|
-
if (!
|
|
1128
|
+
if (!context.projectsConfigurations.projects[context.projectName].root) {
|
|
1997
1129
|
throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
|
|
1998
1130
|
}
|
|
1999
|
-
if (!
|
|
1131
|
+
if (!context.projectsConfigurations.projects[context.projectName].sourceRoot) {
|
|
2000
1132
|
throw new Error("The Build process failed because the project's source root is not valid. Please run this command from a workspace root directory.");
|
|
2001
1133
|
}
|
|
2002
1134
|
const jiti = createJiti(config.workspaceRoot, {
|
|
@@ -2004,11 +1136,11 @@ async function unbuildExecutorFn(options, context2, config) {
|
|
|
2004
1136
|
interopDefault: true
|
|
2005
1137
|
});
|
|
2006
1138
|
const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
|
|
2007
|
-
await stormUnbuild.build(
|
|
1139
|
+
await stormUnbuild.build(defu3({
|
|
2008
1140
|
...options,
|
|
2009
|
-
projectRoot:
|
|
2010
|
-
projectName:
|
|
2011
|
-
sourceRoot:
|
|
1141
|
+
projectRoot: context.projectsConfigurations.projects[context.projectName].root,
|
|
1142
|
+
projectName: context.projectName,
|
|
1143
|
+
sourceRoot: context.projectsConfigurations.projects[context.projectName].sourceRoot,
|
|
2012
1144
|
platform: options.platform
|
|
2013
1145
|
}, {
|
|
2014
1146
|
stubOptions: {
|
|
@@ -2617,7 +1749,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
|
|
|
2617
1749
|
|
|
2618
1750
|
// ../workspace-tools/src/generators/preset/generator.ts
|
|
2619
1751
|
import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
|
|
2620
|
-
import * as
|
|
1752
|
+
import * as path3 from "node:path";
|
|
2621
1753
|
async function presetGeneratorFn(tree, options) {
|
|
2622
1754
|
const projectRoot = ".";
|
|
2623
1755
|
options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
|
|
@@ -2765,7 +1897,7 @@ async function presetGeneratorFn(tree, options) {
|
|
|
2765
1897
|
};
|
|
2766
1898
|
return json;
|
|
2767
1899
|
});
|
|
2768
|
-
generateFiles4(tree,
|
|
1900
|
+
generateFiles4(tree, path3.join(__dirname, "files"), projectRoot, {
|
|
2769
1901
|
...options,
|
|
2770
1902
|
pnpmVersion,
|
|
2771
1903
|
nodeVersion
|
|
@@ -3044,7 +2176,7 @@ var RuleConfigSeverity;
|
|
|
3044
2176
|
})(RuleConfigSeverity || (RuleConfigSeverity = {}));
|
|
3045
2177
|
|
|
3046
2178
|
// ../workspace-tools/src/generators/release-version/generator.ts
|
|
3047
|
-
import { exec
|
|
2179
|
+
import { exec, execSync as execSync4 } from "node:child_process";
|
|
3048
2180
|
import { relative as relative3 } from "node:path";
|
|
3049
2181
|
import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
|
|
3050
2182
|
import { getFirstGitCommit, getLatestGitTagForPattern } from "nx/src/command-line/release/utils/git";
|
|
@@ -3470,23 +2602,23 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
|
|
|
3470
2602
|
|
|
3471
2603
|
// ../workspace-tools/src/utils/lock-file.ts
|
|
3472
2604
|
import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
|
|
3473
|
-
import { existsSync as
|
|
3474
|
-
import { join as
|
|
2605
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
2606
|
+
import { join as join2 } from "node:path";
|
|
3475
2607
|
import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
|
|
3476
2608
|
import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
|
|
3477
2609
|
import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
|
|
3478
2610
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
3479
2611
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
3480
2612
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
3481
|
-
var YARN_LOCK_PATH =
|
|
3482
|
-
var NPM_LOCK_PATH =
|
|
3483
|
-
var PNPM_LOCK_PATH =
|
|
2613
|
+
var YARN_LOCK_PATH = join2(workspaceRoot2, YARN_LOCK_FILE);
|
|
2614
|
+
var NPM_LOCK_PATH = join2(workspaceRoot2, NPM_LOCK_FILE);
|
|
2615
|
+
var PNPM_LOCK_PATH = join2(workspaceRoot2, PNPM_LOCK_FILE);
|
|
3484
2616
|
|
|
3485
2617
|
// ../workspace-tools/src/utils/plugin-helpers.ts
|
|
3486
2618
|
import { readJsonFile as readJsonFile2 } from "@nx/devkit";
|
|
3487
|
-
import
|
|
3488
|
-
import { existsSync as
|
|
3489
|
-
import { dirname
|
|
2619
|
+
import defu4 from "defu";
|
|
2620
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
2621
|
+
import { dirname, join as join3 } from "node:path";
|
|
3490
2622
|
|
|
3491
2623
|
// ../workspace-tools/src/utils/typia-transform.ts
|
|
3492
2624
|
import transform2 from "typia/lib/transform";
|