@storm-software/terraform-tools 0.54.64 → 0.54.65
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/README.md +1 -1
- package/dist/{chunk-ASFTANKT.mjs → chunk-4SYDCN3A.mjs} +1 -1
- package/dist/{chunk-3OHP5XR7.mjs → chunk-DYXYEK43.mjs} +1 -1
- package/dist/{chunk-EVACDYVV.js → chunk-ESAA5DIO.js} +2 -2
- package/dist/{chunk-DLJYMU67.js → chunk-FC5AL6FF.js} +8 -27
- package/dist/{chunk-6DHDE4R5.mjs → chunk-GUH7JMSX.mjs} +21 -3
- package/dist/{chunk-IQBE77EA.mjs → chunk-HIHHRCT4.mjs} +1 -1
- package/dist/{chunk-YRJ6SG2R.js → chunk-JPGERIM3.js} +2 -2
- package/dist/{chunk-JJLWDVUK.js → chunk-LXKO7ZLH.js} +2 -2
- package/dist/{chunk-VGSUCQ2S.mjs → chunk-N7GSKHH2.mjs} +1 -1
- package/dist/{chunk-YKYW2IDQ.js → chunk-RB36TVDB.js} +258 -1118
- package/dist/{chunk-5L6S5MSQ.mjs → chunk-RW373JXN.mjs} +9 -28
- package/dist/{chunk-MVJYL7QB.mjs → chunk-S53JCUPE.mjs} +1 -1
- package/dist/{chunk-6DOGULXV.mjs → chunk-UAT7XLGY.mjs} +180 -1040
- package/dist/{chunk-DHBOQ6QN.js → chunk-YBMM6DDX.js} +2 -2
- package/dist/{chunk-JYWO443U.js → chunk-ZAMME4JX.js} +23 -5
- package/dist/executors.js +6 -6
- package/dist/executors.mjs +7 -7
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +3 -3
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/dist/src/base/base-terraform-executor.untyped.mjs +1 -1
- package/dist/src/base/index.js +3 -3
- package/dist/src/base/index.mjs +3 -3
- package/dist/src/base/terraform-executor.js +3 -3
- package/dist/src/base/terraform-executor.mjs +3 -3
- package/dist/src/executors/apply/executor.js +4 -4
- package/dist/src/executors/apply/executor.mjs +4 -4
- package/dist/src/executors/destroy/executor.js +4 -4
- package/dist/src/executors/destroy/executor.mjs +4 -4
- package/dist/src/executors/output/executor.js +4 -4
- package/dist/src/executors/output/executor.mjs +4 -4
- package/dist/src/executors/plan/executor.js +4 -4
- package/dist/src/executors/plan/executor.mjs +4 -4
- package/dist/src/generators/init/init.js +3 -3
- package/dist/src/generators/init/init.mjs +3 -3
- package/dist/tsup.config.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyWorkspaceBaseTokens,
|
|
3
3
|
applyWorkspaceTokens,
|
|
4
|
-
correctPaths,
|
|
5
4
|
findWorkspaceRoot,
|
|
6
|
-
formatLogMessage,
|
|
7
5
|
getConfig,
|
|
8
6
|
getStopwatch,
|
|
9
|
-
|
|
7
|
+
getWorkspaceConfig,
|
|
10
8
|
joinPaths,
|
|
11
|
-
run,
|
|
12
9
|
stormWorkspaceConfigSchema,
|
|
13
10
|
withRunExecutor,
|
|
14
11
|
writeDebug,
|
|
@@ -18,12 +15,12 @@ import {
|
|
|
18
15
|
writeSuccess,
|
|
19
16
|
writeTrace,
|
|
20
17
|
writeWarning
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RW373JXN.mjs";
|
|
22
19
|
import {
|
|
23
20
|
__dirname,
|
|
24
21
|
__name,
|
|
25
22
|
__require
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-N7GSKHH2.mjs";
|
|
27
24
|
|
|
28
25
|
// src/generators/init/init.ts
|
|
29
26
|
import { formatFiles as formatFiles9 } from "@nx/devkit";
|
|
@@ -40,7 +37,7 @@ var INVALID_CARGO_ARGS = [
|
|
|
40
37
|
"package",
|
|
41
38
|
"tsConfig"
|
|
42
39
|
];
|
|
43
|
-
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options,
|
|
40
|
+
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context) => {
|
|
44
41
|
const args = [];
|
|
45
42
|
if (options.toolchain && options.toolchain !== "stable") {
|
|
46
43
|
args.push(`+${options.toolchain}`);
|
|
@@ -62,8 +59,8 @@ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2)
|
|
|
62
59
|
args.push(`--${key}`, String(value));
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
if (
|
|
66
|
-
args.push("-p",
|
|
62
|
+
if (context.projectName) {
|
|
63
|
+
args.push("-p", context.projectName);
|
|
67
64
|
}
|
|
68
65
|
if (options.allFeatures && !args.includes("--all-features")) {
|
|
69
66
|
args.push("--all-features");
|
|
@@ -155,8 +152,8 @@ function runProcess(processCmd, ...args) {
|
|
|
155
152
|
__name(runProcess, "runProcess");
|
|
156
153
|
|
|
157
154
|
// ../workspace-tools/src/executors/cargo-build/executor.ts
|
|
158
|
-
async function cargoBuildExecutor(options,
|
|
159
|
-
const command = buildCargoCommand("build", options,
|
|
155
|
+
async function cargoBuildExecutor(options, context) {
|
|
156
|
+
const command = buildCargoCommand("build", options, context);
|
|
160
157
|
return await cargoCommand(...command);
|
|
161
158
|
}
|
|
162
159
|
__name(cargoBuildExecutor, "cargoBuildExecutor");
|
|
@@ -172,8 +169,8 @@ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
|
|
|
172
169
|
});
|
|
173
170
|
|
|
174
171
|
// ../workspace-tools/src/executors/cargo-check/executor.ts
|
|
175
|
-
async function cargoCheckExecutor(options,
|
|
176
|
-
const command = buildCargoCommand("check", options,
|
|
172
|
+
async function cargoCheckExecutor(options, context) {
|
|
173
|
+
const command = buildCargoCommand("check", options, context);
|
|
177
174
|
return await cargoCommand(...command);
|
|
178
175
|
}
|
|
179
176
|
__name(cargoCheckExecutor, "cargoCheckExecutor");
|
|
@@ -188,8 +185,8 @@ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
|
|
|
188
185
|
});
|
|
189
186
|
|
|
190
187
|
// ../workspace-tools/src/executors/cargo-clippy/executor.ts
|
|
191
|
-
async function cargoClippyExecutor(options,
|
|
192
|
-
const command = buildCargoCommand("clippy", options,
|
|
188
|
+
async function cargoClippyExecutor(options, context) {
|
|
189
|
+
const command = buildCargoCommand("clippy", options, context);
|
|
193
190
|
return await cargoCommand(...command);
|
|
194
191
|
}
|
|
195
192
|
__name(cargoClippyExecutor, "cargoClippyExecutor");
|
|
@@ -205,13 +202,13 @@ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
|
|
|
205
202
|
});
|
|
206
203
|
|
|
207
204
|
// ../workspace-tools/src/executors/cargo-doc/executor.ts
|
|
208
|
-
async function cargoDocExecutor(options,
|
|
205
|
+
async function cargoDocExecutor(options, context) {
|
|
209
206
|
const opts = {
|
|
210
207
|
...options
|
|
211
208
|
};
|
|
212
209
|
opts["no-deps"] = opts.noDeps;
|
|
213
210
|
delete opts.noDeps;
|
|
214
|
-
const command = buildCargoCommand("doc", options,
|
|
211
|
+
const command = buildCargoCommand("doc", options, context);
|
|
215
212
|
return await cargoCommand(...command);
|
|
216
213
|
}
|
|
217
214
|
__name(cargoDocExecutor, "cargoDocExecutor");
|
|
@@ -233,8 +230,8 @@ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
|
|
|
233
230
|
});
|
|
234
231
|
|
|
235
232
|
// ../workspace-tools/src/executors/cargo-format/executor.ts
|
|
236
|
-
async function cargoFormatExecutor(options,
|
|
237
|
-
const command = buildCargoCommand("fmt", options,
|
|
233
|
+
async function cargoFormatExecutor(options, context) {
|
|
234
|
+
const command = buildCargoCommand("fmt", options, context);
|
|
238
235
|
return await cargoCommand(...command);
|
|
239
236
|
}
|
|
240
237
|
__name(cargoFormatExecutor, "cargoFormatExecutor");
|
|
@@ -406,8 +403,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
406
403
|
}
|
|
407
404
|
return packageJson;
|
|
408
405
|
}, "addPackageDependencies");
|
|
409
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (
|
|
410
|
-
const workspaceRoot3 =
|
|
406
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
407
|
+
const workspaceRoot3 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
411
408
|
const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot3, "package.json"), "utf8");
|
|
412
409
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
413
410
|
packageJson.type ??= "module";
|
|
@@ -478,159 +475,18 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
|
|
|
478
475
|
|
|
479
476
|
// ../esbuild/src/build.ts
|
|
480
477
|
import { watch as createWatcher } from "chokidar";
|
|
481
|
-
import
|
|
482
|
-
import { debounce
|
|
483
|
-
import
|
|
484
|
-
import * as esbuild2 from "esbuild";
|
|
478
|
+
import defu from "defu";
|
|
479
|
+
import { debounce } from "es-toolkit";
|
|
480
|
+
import * as esbuild from "esbuild";
|
|
485
481
|
import { globbySync } from "globby";
|
|
486
|
-
import { existsSync as
|
|
482
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
487
483
|
import hf from "node:fs/promises";
|
|
488
484
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
489
|
-
|
|
490
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
491
|
-
import path3 from "node:path";
|
|
492
|
-
import { SourceMapConsumer, SourceMapGenerator } from "source-map";
|
|
493
|
-
|
|
494
|
-
// ../esbuild/src/utilities/output-file.ts
|
|
495
|
-
import fs2 from "node:fs";
|
|
496
|
-
import path2 from "node:path";
|
|
497
|
-
var outputFile = /* @__PURE__ */ __name(async (filepath, data, options) => {
|
|
498
|
-
await fs2.promises.mkdir(path2.dirname(filepath), {
|
|
499
|
-
recursive: true
|
|
500
|
-
});
|
|
501
|
-
await fs2.promises.writeFile(filepath, data, options);
|
|
502
|
-
}, "outputFile");
|
|
503
|
-
|
|
504
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
505
|
-
var parseSourceMap = /* @__PURE__ */ __name((map2) => {
|
|
506
|
-
return typeof map2 === "string" ? JSON.parse(map2) : map2;
|
|
507
|
-
}, "parseSourceMap");
|
|
508
|
-
var isJS = /* @__PURE__ */ __name((path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
|
|
509
|
-
var isCSS = /* @__PURE__ */ __name((path7) => /\.css$/.test(path7), "isCSS");
|
|
510
|
-
var getSourcemapComment = /* @__PURE__ */ __name((inline, map2, filepath, isCssFile) => {
|
|
511
|
-
if (!map2) return "";
|
|
512
|
-
const prefix = isCssFile ? "/*" : "//";
|
|
513
|
-
const suffix = isCssFile ? " */" : "";
|
|
514
|
-
const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path3.basename(filepath)}.map`;
|
|
515
|
-
return `${prefix}# sourceMappingURL=${url}${suffix}`;
|
|
516
|
-
}, "getSourcemapComment");
|
|
517
|
-
var RendererEngine = class {
|
|
518
|
-
static {
|
|
519
|
-
__name(this, "RendererEngine");
|
|
520
|
-
}
|
|
521
|
-
#renderers;
|
|
522
|
-
#options;
|
|
523
|
-
constructor(renderers) {
|
|
524
|
-
this.#renderers = renderers;
|
|
525
|
-
}
|
|
526
|
-
setOptions(options) {
|
|
527
|
-
this.#options = options;
|
|
528
|
-
}
|
|
529
|
-
getOptions() {
|
|
530
|
-
if (!this.#options) {
|
|
531
|
-
throw new Error(`Renderer options is not set`);
|
|
532
|
-
}
|
|
533
|
-
return this.#options;
|
|
534
|
-
}
|
|
535
|
-
modifyEsbuildOptions(options) {
|
|
536
|
-
for (const renderer of this.#renderers) {
|
|
537
|
-
if (renderer.esbuildOptions) {
|
|
538
|
-
renderer.esbuildOptions.call(this.getOptions(), options);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
async buildStarted() {
|
|
543
|
-
for (const renderer of this.#renderers) {
|
|
544
|
-
if (renderer.buildStart) {
|
|
545
|
-
await renderer.buildStart.call(this.getOptions());
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
async buildFinished({ outputFiles, metafile }) {
|
|
550
|
-
const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
|
|
551
|
-
if (isJS(file.path) || isCSS(file.path)) {
|
|
552
|
-
let relativePath = path3.relative(this.getOptions().config.workspaceRoot, file.path);
|
|
553
|
-
if (!relativePath.startsWith("\\\\?\\")) {
|
|
554
|
-
relativePath = relativePath.replace(/\\/g, "/");
|
|
555
|
-
}
|
|
556
|
-
const meta = metafile?.outputs[relativePath];
|
|
557
|
-
return {
|
|
558
|
-
type: "chunk",
|
|
559
|
-
path: file.path,
|
|
560
|
-
code: file.text,
|
|
561
|
-
map: outputFiles.find((f) => f.path === `${file.path}.map`)?.text,
|
|
562
|
-
entryPoint: meta?.entryPoint,
|
|
563
|
-
exports: meta?.exports,
|
|
564
|
-
imports: meta?.imports
|
|
565
|
-
};
|
|
566
|
-
} else {
|
|
567
|
-
return {
|
|
568
|
-
type: "asset",
|
|
569
|
-
path: file.path,
|
|
570
|
-
contents: file.contents
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
const writtenFiles = [];
|
|
575
|
-
await Promise.all(files.map(async (info) => {
|
|
576
|
-
for (const renderer of this.#renderers) {
|
|
577
|
-
if (info.type === "chunk" && renderer.renderChunk) {
|
|
578
|
-
const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
|
|
579
|
-
if (result) {
|
|
580
|
-
info.code = result.code;
|
|
581
|
-
if (result.map) {
|
|
582
|
-
const originalConsumer = await new SourceMapConsumer(parseSourceMap(info.map));
|
|
583
|
-
const newConsumer = await new SourceMapConsumer(parseSourceMap(result.map));
|
|
584
|
-
const generator = SourceMapGenerator.fromSourceMap(newConsumer);
|
|
585
|
-
generator.applySourceMap(originalConsumer, info.path);
|
|
586
|
-
info.map = generator.toJSON();
|
|
587
|
-
originalConsumer.destroy();
|
|
588
|
-
newConsumer.destroy();
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
const inlineSourceMap = this.#options.sourcemap === "inline";
|
|
594
|
-
const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
|
|
595
|
-
await outputFile(info.path, contents, {
|
|
596
|
-
mode: info.type === "chunk" ? info.mode : void 0
|
|
597
|
-
});
|
|
598
|
-
writtenFiles.push({
|
|
599
|
-
get name() {
|
|
600
|
-
return path3.relative(process.cwd(), info.path);
|
|
601
|
-
},
|
|
602
|
-
get size() {
|
|
603
|
-
return contents.length;
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
if (info.type === "chunk" && info.map && !inlineSourceMap) {
|
|
607
|
-
const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
|
|
608
|
-
const outPath = `${info.path}.map`;
|
|
609
|
-
const contents2 = JSON.stringify(map2);
|
|
610
|
-
await outputFile(outPath, contents2);
|
|
611
|
-
writtenFiles.push({
|
|
612
|
-
get name() {
|
|
613
|
-
return path3.relative(process.cwd(), outPath);
|
|
614
|
-
},
|
|
615
|
-
get size() {
|
|
616
|
-
return contents2.length;
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
}));
|
|
621
|
-
for (const renderer of this.#renderers) {
|
|
622
|
-
if (renderer.buildEnd) {
|
|
623
|
-
await renderer.buildEnd.call(this.getOptions(), {
|
|
624
|
-
writtenFiles
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
};
|
|
485
|
+
import { build as tsup } from "tsup";
|
|
630
486
|
|
|
631
487
|
// ../esbuild/src/clean.ts
|
|
632
488
|
import { rm } from "node:fs/promises";
|
|
633
|
-
async function cleanDirectories(
|
|
489
|
+
async function cleanDirectories(directory) {
|
|
634
490
|
await rm(directory, {
|
|
635
491
|
recursive: true,
|
|
636
492
|
force: true
|
|
@@ -638,315 +494,24 @@ async function cleanDirectories(name = "ESBuild", directory, config) {
|
|
|
638
494
|
}
|
|
639
495
|
__name(cleanDirectories, "cleanDirectories");
|
|
640
496
|
|
|
641
|
-
// ../esbuild/src/plugins/esm-split-code-to-cjs.ts
|
|
642
|
-
import * as esbuild from "esbuild";
|
|
643
|
-
var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
644
|
-
name: "storm:esm-split-code-to-cjs",
|
|
645
|
-
setup(build4) {
|
|
646
|
-
build4.onEnd(async (result) => {
|
|
647
|
-
const outFiles = Object.keys(result.metafile?.outputs ?? {});
|
|
648
|
-
const jsFiles = outFiles.filter((f) => f.endsWith("js"));
|
|
649
|
-
await esbuild.build({
|
|
650
|
-
outdir: resolvedOptions.outdir,
|
|
651
|
-
entryPoints: jsFiles,
|
|
652
|
-
allowOverwrite: true,
|
|
653
|
-
format: "cjs",
|
|
654
|
-
logLevel: "error",
|
|
655
|
-
packages: "external"
|
|
656
|
-
});
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
}), "esmSplitCodeToCjsPlugin");
|
|
660
|
-
|
|
661
|
-
// ../esbuild/src/plugins/fix-imports.ts
|
|
662
|
-
var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
663
|
-
name: "storm:fix-imports",
|
|
664
|
-
setup(build4) {
|
|
665
|
-
build4.onResolve({
|
|
666
|
-
filter: /^spdx-exceptions/
|
|
667
|
-
}, () => {
|
|
668
|
-
return {
|
|
669
|
-
path: __require.resolve("spdx-exceptions")
|
|
670
|
-
};
|
|
671
|
-
});
|
|
672
|
-
build4.onResolve({
|
|
673
|
-
filter: /^spdx-license-ids/
|
|
674
|
-
}, () => {
|
|
675
|
-
return {
|
|
676
|
-
path: __require.resolve("spdx-license-ids")
|
|
677
|
-
};
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
}), "fixImportsPlugin");
|
|
681
|
-
|
|
682
|
-
// ../esbuild/src/plugins/native-node-module.ts
|
|
683
|
-
import { dirname } from "node:path";
|
|
684
|
-
var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
685
|
-
return {
|
|
686
|
-
name: "native-node-modules",
|
|
687
|
-
setup(build4) {
|
|
688
|
-
build4.onResolve({
|
|
689
|
-
filter: /\.node$/,
|
|
690
|
-
namespace: "file"
|
|
691
|
-
}, (args) => {
|
|
692
|
-
const resolvedId = __require.resolve(args.path, {
|
|
693
|
-
paths: [
|
|
694
|
-
args.resolveDir
|
|
695
|
-
]
|
|
696
|
-
});
|
|
697
|
-
if (resolvedId.endsWith(".node")) {
|
|
698
|
-
return {
|
|
699
|
-
path: resolvedId,
|
|
700
|
-
namespace: "node-file"
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
return {
|
|
704
|
-
path: resolvedId
|
|
705
|
-
};
|
|
706
|
-
});
|
|
707
|
-
build4.onLoad({
|
|
708
|
-
filter: /.*/,
|
|
709
|
-
namespace: "node-file"
|
|
710
|
-
}, (args) => {
|
|
711
|
-
return {
|
|
712
|
-
contents: `
|
|
713
|
-
import path from ${JSON.stringify(args.path)}
|
|
714
|
-
try { module.exports = require(path) }
|
|
715
|
-
catch {}
|
|
716
|
-
`,
|
|
717
|
-
resolveDir: dirname(args.path)
|
|
718
|
-
};
|
|
719
|
-
});
|
|
720
|
-
build4.onResolve({
|
|
721
|
-
filter: /\.node$/,
|
|
722
|
-
namespace: "node-file"
|
|
723
|
-
}, (args) => ({
|
|
724
|
-
path: args.path,
|
|
725
|
-
namespace: "file"
|
|
726
|
-
}));
|
|
727
|
-
const opts = build4.initialOptions;
|
|
728
|
-
opts.loader = opts.loader || {};
|
|
729
|
-
opts.loader[".node"] = "file";
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
}, "nativeNodeModulesPlugin");
|
|
733
|
-
|
|
734
|
-
// ../esbuild/src/plugins/node-protocol.ts
|
|
735
|
-
var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
736
|
-
const nodeProtocol = "node:";
|
|
737
|
-
return {
|
|
738
|
-
name: "node-protocol-plugin",
|
|
739
|
-
setup({ onResolve }) {
|
|
740
|
-
onResolve({
|
|
741
|
-
filter: /^node:/
|
|
742
|
-
}, ({ path: path7 }) => ({
|
|
743
|
-
path: path7.slice(nodeProtocol.length),
|
|
744
|
-
external: true
|
|
745
|
-
}));
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
}, "nodeProtocolPlugin");
|
|
749
|
-
|
|
750
|
-
// ../esbuild/src/plugins/on-error.ts
|
|
751
|
-
var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
752
|
-
name: "storm:on-error",
|
|
753
|
-
setup(build4) {
|
|
754
|
-
build4.onEnd((result) => {
|
|
755
|
-
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
756
|
-
writeError(`The following errors occurred during the build:
|
|
757
|
-
${result.errors.map((error) => error.text).join("\n")}
|
|
758
|
-
|
|
759
|
-
`, resolvedOptions.config);
|
|
760
|
-
throw new Error("Storm esbuild process failed with errors.");
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
}), "onErrorPlugin");
|
|
765
|
-
|
|
766
|
-
// ../esbuild/src/plugins/resolve-paths.ts
|
|
767
|
-
import path4 from "node:path";
|
|
768
|
-
function resolvePathsConfig(options, cwd) {
|
|
769
|
-
if (options?.compilerOptions?.paths) {
|
|
770
|
-
const paths = Object.entries(options.compilerOptions.paths);
|
|
771
|
-
const resolvedPaths = paths.map(([key, paths2]) => {
|
|
772
|
-
return [
|
|
773
|
-
key,
|
|
774
|
-
paths2.map((v) => path4.resolve(cwd, v))
|
|
775
|
-
];
|
|
776
|
-
});
|
|
777
|
-
return Object.fromEntries(resolvedPaths);
|
|
778
|
-
}
|
|
779
|
-
if (options.extends) {
|
|
780
|
-
const extendsPath = path4.resolve(cwd, options.extends);
|
|
781
|
-
const extendsDir = path4.dirname(extendsPath);
|
|
782
|
-
const extendsConfig = __require(extendsPath);
|
|
783
|
-
return resolvePathsConfig(extendsConfig, extendsDir);
|
|
784
|
-
}
|
|
785
|
-
return [];
|
|
786
|
-
}
|
|
787
|
-
__name(resolvePathsConfig, "resolvePathsConfig");
|
|
788
|
-
var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
789
|
-
name: "storm:resolve-paths",
|
|
790
|
-
setup(build4) {
|
|
791
|
-
const parentTsConfig = build4.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build4.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
|
|
792
|
-
const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
|
|
793
|
-
const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
|
|
794
|
-
build4.onResolve({
|
|
795
|
-
filter: packagesRegex
|
|
796
|
-
}, (args) => {
|
|
797
|
-
if (build4.initialOptions.external?.includes(args.path)) {
|
|
798
|
-
return {
|
|
799
|
-
path: args.path,
|
|
800
|
-
external: true
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
return {
|
|
804
|
-
path: `${resolvedTsPaths[args.path][0]}/index.ts`
|
|
805
|
-
};
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
}), "resolvePathsPlugin");
|
|
809
|
-
|
|
810
|
-
// ../esbuild/src/plugins/tsc.ts
|
|
811
|
-
import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
|
|
812
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
813
|
-
import fs3 from "node:fs/promises";
|
|
814
|
-
function bundleTypeDefinitions(filename, outfile, externals, options) {
|
|
815
|
-
const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
|
|
816
|
-
const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
|
|
817
|
-
p,
|
|
818
|
-
getTypeDependencyPackageName(p)
|
|
819
|
-
]);
|
|
820
|
-
const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
|
|
821
|
-
p,
|
|
822
|
-
getTypeDependencyPackageName(p)
|
|
823
|
-
]);
|
|
824
|
-
const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
|
|
825
|
-
p,
|
|
826
|
-
getTypeDependencyPackageName(p)
|
|
827
|
-
]);
|
|
828
|
-
const includeDeps = devDependenciesKeys;
|
|
829
|
-
const excludeDeps = /* @__PURE__ */ new Set([
|
|
830
|
-
...dependenciesKeys,
|
|
831
|
-
...peerDependenciesKeys,
|
|
832
|
-
...externals
|
|
833
|
-
]);
|
|
834
|
-
const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
|
|
835
|
-
const extractorConfig = ExtractorConfig.prepare({
|
|
836
|
-
configObject: {
|
|
837
|
-
projectFolder: options.projectRoot,
|
|
838
|
-
mainEntryPointFilePath: filename,
|
|
839
|
-
bundledPackages,
|
|
840
|
-
compiler: {
|
|
841
|
-
tsconfigFilePath: options.tsconfig,
|
|
842
|
-
overrideTsconfig: {
|
|
843
|
-
compilerOptions: {
|
|
844
|
-
paths: {}
|
|
845
|
-
// bug with api extract + paths
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
},
|
|
849
|
-
dtsRollup: {
|
|
850
|
-
enabled: true,
|
|
851
|
-
untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
|
|
852
|
-
},
|
|
853
|
-
tsdocMetadata: {
|
|
854
|
-
enabled: false
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
|
|
858
|
-
configObjectFullPath: void 0
|
|
859
|
-
});
|
|
860
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
861
|
-
showVerboseMessages: true,
|
|
862
|
-
localBuild: true
|
|
863
|
-
});
|
|
864
|
-
if (extractorResult.succeeded === false) {
|
|
865
|
-
writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
866
|
-
throw new Error("API Extractor completed with errors");
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
__name(bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
870
|
-
var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
871
|
-
name: "storm:tsc",
|
|
872
|
-
setup(build4) {
|
|
873
|
-
if (options.dts === false) {
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
build4.onStart(async () => {
|
|
877
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
878
|
-
await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
|
|
879
|
-
}
|
|
880
|
-
if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0]?.in && resolvedOptions.entryPoints[0].in.endsWith(".ts")) {
|
|
881
|
-
const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
|
|
882
|
-
const typeOutDir = resolvedOptions.outdir;
|
|
883
|
-
const entryPoint = resolvedOptions.entryPoints[0].in.replace(sourceRoot, "").replace(/\.ts$/, "");
|
|
884
|
-
const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
|
|
885
|
-
let dtsPath;
|
|
886
|
-
if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
|
|
887
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
|
|
888
|
-
} else if (existsSync3(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
|
|
889
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
|
|
890
|
-
}
|
|
891
|
-
const ext = resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
|
|
892
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
893
|
-
bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
|
|
894
|
-
const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
|
|
895
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
|
|
896
|
-
} else {
|
|
897
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
}), "tscPlugin");
|
|
903
|
-
function getTypeDependencyPackageName(npmPackage) {
|
|
904
|
-
if (npmPackage.startsWith("@")) {
|
|
905
|
-
const [scope, name] = npmPackage.split("/");
|
|
906
|
-
return `@types/${scope?.slice(1)}__${name}`;
|
|
907
|
-
}
|
|
908
|
-
return `@types/${npmPackage}`;
|
|
909
|
-
}
|
|
910
|
-
__name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
911
|
-
|
|
912
497
|
// ../esbuild/src/config.ts
|
|
913
|
-
var getDefaultBuildPlugins = /* @__PURE__ */ __name((options, resolvedOptions) => [
|
|
914
|
-
nodeProtocolPlugin(options, resolvedOptions),
|
|
915
|
-
resolvePathsPlugin(options, resolvedOptions),
|
|
916
|
-
fixImportsPlugin(options, resolvedOptions),
|
|
917
|
-
nativeNodeModulesPlugin(options, resolvedOptions),
|
|
918
|
-
esmSplitCodeToCjsPlugin(options, resolvedOptions),
|
|
919
|
-
tscPlugin(options, resolvedOptions),
|
|
920
|
-
onErrorPlugin(options, resolvedOptions)
|
|
921
|
-
], "getDefaultBuildPlugins");
|
|
922
498
|
var DEFAULT_BUILD_OPTIONS = {
|
|
499
|
+
assets: [],
|
|
923
500
|
platform: "node",
|
|
924
|
-
target:
|
|
501
|
+
target: [
|
|
502
|
+
"esnext"
|
|
503
|
+
],
|
|
925
504
|
format: "esm",
|
|
926
|
-
external: [],
|
|
927
|
-
logLevel: "error",
|
|
928
505
|
tsconfig: "tsconfig.json",
|
|
929
506
|
mode: "production",
|
|
507
|
+
generatePackageJson: true,
|
|
508
|
+
includeSrc: false,
|
|
930
509
|
keepNames: true,
|
|
931
|
-
metafile:
|
|
932
|
-
|
|
933
|
-
|
|
510
|
+
metafile: false,
|
|
511
|
+
treeshake: true,
|
|
512
|
+
shims: false,
|
|
934
513
|
watch: false,
|
|
935
514
|
bundle: true,
|
|
936
|
-
clean: true,
|
|
937
|
-
debug: false,
|
|
938
|
-
resolveExtensions: [
|
|
939
|
-
".tsx",
|
|
940
|
-
".ts",
|
|
941
|
-
".cts",
|
|
942
|
-
".mts",
|
|
943
|
-
".jsx",
|
|
944
|
-
".js",
|
|
945
|
-
".cjs",
|
|
946
|
-
".mjs",
|
|
947
|
-
".css",
|
|
948
|
-
".json"
|
|
949
|
-
],
|
|
950
515
|
loader: {
|
|
951
516
|
".aac": "file",
|
|
952
517
|
".css": "file",
|
|
@@ -968,12 +533,15 @@ var DEFAULT_BUILD_OPTIONS = {
|
|
|
968
533
|
".woff": "file",
|
|
969
534
|
".woff2": "file"
|
|
970
535
|
},
|
|
971
|
-
banner:
|
|
536
|
+
banner: {
|
|
537
|
+
js: DEFAULT_COMPILED_BANNER,
|
|
538
|
+
css: DEFAULT_COMPILED_BANNER
|
|
539
|
+
}
|
|
972
540
|
};
|
|
973
541
|
|
|
974
542
|
// ../esbuild/src/plugins/deps-check.ts
|
|
975
543
|
import { builtinModules as builtinModules2 } from "node:module";
|
|
976
|
-
import
|
|
544
|
+
import path2 from "node:path";
|
|
977
545
|
var unusedIgnore = [
|
|
978
546
|
// these are our dev dependencies
|
|
979
547
|
/@types\/.*?/,
|
|
@@ -1005,8 +573,8 @@ var missingIgnore = [
|
|
|
1005
573
|
];
|
|
1006
574
|
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
1007
575
|
name: "storm:deps-check",
|
|
1008
|
-
setup(
|
|
1009
|
-
const pkgJsonPath =
|
|
576
|
+
setup(build3) {
|
|
577
|
+
const pkgJsonPath = path2.join(process.cwd(), "package.json");
|
|
1010
578
|
const pkgContents = __require(pkgJsonPath);
|
|
1011
579
|
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
1012
580
|
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
@@ -1017,7 +585,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
1017
585
|
];
|
|
1018
586
|
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
1019
587
|
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
1020
|
-
|
|
588
|
+
build3.onResolve({
|
|
1021
589
|
filter: onlyPackages
|
|
1022
590
|
}, (args) => {
|
|
1023
591
|
if (args.importer.includes(process.cwd())) {
|
|
@@ -1033,7 +601,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
1033
601
|
external: true
|
|
1034
602
|
};
|
|
1035
603
|
});
|
|
1036
|
-
|
|
604
|
+
build3.onEnd(() => {
|
|
1037
605
|
const unusedDependencies = [
|
|
1038
606
|
...dependencies
|
|
1039
607
|
].filter((dep) => {
|
|
@@ -1061,391 +629,53 @@ ${JSON.stringify(filteredMissingDeps)}
|
|
|
1061
629
|
}
|
|
1062
630
|
}), "depsCheckPlugin");
|
|
1063
631
|
|
|
1064
|
-
// ../esbuild/src/renderers/shebang.ts
|
|
1065
|
-
var shebangRenderer = {
|
|
1066
|
-
name: "shebang",
|
|
1067
|
-
renderChunk(_, __, info) {
|
|
1068
|
-
if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
|
|
1069
|
-
info.mode = 493;
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
|
|
1074
|
-
// ../esbuild/src/tsc.ts
|
|
1075
|
-
import { loadTsConfig } from "bundle-require";
|
|
1076
|
-
import defu from "defu";
|
|
1077
|
-
import { existsSync as existsSync4, mkdirSync, writeFileSync } from "node:fs";
|
|
1078
|
-
import { dirname as dirname2, isAbsolute, join, normalize } from "node:path";
|
|
1079
|
-
import ts from "typescript";
|
|
1080
|
-
function ensureTempDeclarationDir(workspaceConfig) {
|
|
1081
|
-
const root = workspaceConfig.directories.temp || join(workspaceConfig.workspaceRoot, "tmp");
|
|
1082
|
-
const dirPath = join(root, ".tsc", "declaration");
|
|
1083
|
-
if (existsSync4(dirPath)) {
|
|
1084
|
-
return dirPath;
|
|
1085
|
-
}
|
|
1086
|
-
mkdirSync(dirPath, {
|
|
1087
|
-
recursive: true
|
|
1088
|
-
});
|
|
1089
|
-
const gitIgnorePath = join(root, ".tsc", ".gitignore");
|
|
1090
|
-
writeFileSync(gitIgnorePath, "**/*\n");
|
|
1091
|
-
return dirPath;
|
|
1092
|
-
}
|
|
1093
|
-
__name(ensureTempDeclarationDir, "ensureTempDeclarationDir");
|
|
1094
|
-
function slash(path7) {
|
|
1095
|
-
const isExtendedLengthPath = path7.startsWith("\\\\?\\");
|
|
1096
|
-
if (isExtendedLengthPath) {
|
|
1097
|
-
return path7;
|
|
1098
|
-
}
|
|
1099
|
-
return path7.replace(/\\/g, "/");
|
|
1100
|
-
}
|
|
1101
|
-
__name(slash, "slash");
|
|
1102
|
-
function toAbsolutePath(workspaceConfig, p, cwd) {
|
|
1103
|
-
if (isAbsolute(p)) {
|
|
1104
|
-
return p;
|
|
1105
|
-
}
|
|
1106
|
-
return slash(normalize(join(cwd || workspaceConfig.workspaceRoot, p)));
|
|
1107
|
-
}
|
|
1108
|
-
__name(toAbsolutePath, "toAbsolutePath");
|
|
1109
|
-
var AliasPool = class AliasPool2 {
|
|
1110
|
-
static {
|
|
1111
|
-
__name(this, "AliasPool");
|
|
1112
|
-
}
|
|
1113
|
-
seen = /* @__PURE__ */ new Set();
|
|
1114
|
-
assign(name) {
|
|
1115
|
-
let suffix = 0;
|
|
1116
|
-
let alias = name === "default" ? "default_alias" : name;
|
|
1117
|
-
while (this.seen.has(alias)) {
|
|
1118
|
-
alias = `${name}_alias_${++suffix}`;
|
|
1119
|
-
if (suffix >= 1e3) {
|
|
1120
|
-
throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
this.seen.add(alias);
|
|
1124
|
-
return alias;
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
function getExports(workspaceConfig, program, fileMapping) {
|
|
1128
|
-
const checker = program.getTypeChecker();
|
|
1129
|
-
const aliasPool = new AliasPool();
|
|
1130
|
-
const assignAlias = aliasPool.assign.bind(aliasPool);
|
|
1131
|
-
function extractExports(sourceFileName) {
|
|
1132
|
-
const cwd = program.getCurrentDirectory();
|
|
1133
|
-
sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
|
|
1134
|
-
const sourceFile = program.getSourceFile(sourceFileName);
|
|
1135
|
-
if (!sourceFile) {
|
|
1136
|
-
return [];
|
|
1137
|
-
}
|
|
1138
|
-
const destFileName = fileMapping.get(sourceFileName);
|
|
1139
|
-
if (!destFileName) {
|
|
1140
|
-
return [];
|
|
1141
|
-
}
|
|
1142
|
-
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
1143
|
-
if (!moduleSymbol) {
|
|
1144
|
-
return [];
|
|
1145
|
-
}
|
|
1146
|
-
const exports = [];
|
|
1147
|
-
const exportSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1148
|
-
exportSymbols.forEach((symbol) => {
|
|
1149
|
-
const name = symbol.getName();
|
|
1150
|
-
exports.push({
|
|
1151
|
-
kind: "named",
|
|
1152
|
-
sourceFileName,
|
|
1153
|
-
destFileName,
|
|
1154
|
-
name,
|
|
1155
|
-
alias: assignAlias(name),
|
|
1156
|
-
isTypeOnly: false
|
|
1157
|
-
});
|
|
1158
|
-
});
|
|
1159
|
-
return exports;
|
|
1160
|
-
}
|
|
1161
|
-
__name(extractExports, "extractExports");
|
|
1162
|
-
return program.getRootFileNames().flatMap(extractExports);
|
|
1163
|
-
}
|
|
1164
|
-
__name(getExports, "getExports");
|
|
1165
|
-
function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
|
|
1166
|
-
const fileMapping = /* @__PURE__ */ new Map();
|
|
1167
|
-
const writeFile3 = /* @__PURE__ */ __name((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
1168
|
-
const sourceFile = sourceFiles?.[0];
|
|
1169
|
-
const sourceFileName = sourceFile?.fileName;
|
|
1170
|
-
if (sourceFileName && !fileName.endsWith(".map")) {
|
|
1171
|
-
const cwd = program.getCurrentDirectory();
|
|
1172
|
-
fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
|
|
1173
|
-
}
|
|
1174
|
-
return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
1175
|
-
}, "writeFile");
|
|
1176
|
-
const emitResult = program.emit(void 0, writeFile3, void 0, emitOnlyDtsFiles, customTransformers);
|
|
1177
|
-
const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
1178
|
-
const diagnosticMessages = [];
|
|
1179
|
-
diagnostics.forEach((diagnostic) => {
|
|
1180
|
-
if (diagnostic.file) {
|
|
1181
|
-
const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
1182
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
1183
|
-
diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
1184
|
-
} else {
|
|
1185
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
1186
|
-
diagnosticMessages.push(message);
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
1190
|
-
if (diagnosticMessage) {
|
|
1191
|
-
writeError(`Failed to emit declaration files.
|
|
1192
|
-
|
|
1193
|
-
${diagnosticMessage}`, workspaceConfig);
|
|
1194
|
-
throw new Error("TypeScript compilation failed");
|
|
1195
|
-
}
|
|
1196
|
-
return fileMapping;
|
|
1197
|
-
}
|
|
1198
|
-
__name(emitDtsFiles, "emitDtsFiles");
|
|
1199
|
-
function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
|
|
1200
|
-
const rawTsconfig = loadTsConfig(workspaceConfig.workspaceRoot, tsconfig);
|
|
1201
|
-
if (!rawTsconfig) {
|
|
1202
|
-
throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
|
|
1203
|
-
}
|
|
1204
|
-
const declarationDir = ensureTempDeclarationDir(workspaceConfig);
|
|
1205
|
-
const parsedTsconfig = ts.parseJsonConfigFileContent(defu({
|
|
1206
|
-
compilerOptions: {
|
|
1207
|
-
// Enable declaration emit and disable javascript emit
|
|
1208
|
-
noEmit: false,
|
|
1209
|
-
declaration: true,
|
|
1210
|
-
declarationMap: true,
|
|
1211
|
-
declarationDir,
|
|
1212
|
-
emitDeclarationOnly: true
|
|
1213
|
-
}
|
|
1214
|
-
}, tsconfigRaw?.compilerOptions ?? {}, rawTsconfig.data ?? {}), ts.sys, tsconfig ? dirname2(tsconfig) : "./");
|
|
1215
|
-
const options = parsedTsconfig.options;
|
|
1216
|
-
const host = ts.createCompilerHost(options);
|
|
1217
|
-
const program = ts.createProgram(parsedTsconfig.fileNames, options, host);
|
|
1218
|
-
const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
|
|
1219
|
-
return getExports(workspaceConfig, program, fileMapping);
|
|
1220
|
-
}
|
|
1221
|
-
__name(emitDts, "emitDts");
|
|
1222
|
-
|
|
1223
|
-
// ../esbuild/src/utilities/get-entry-points.ts
|
|
1224
|
-
import { glob as glob3 } from "glob";
|
|
1225
|
-
var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
1226
|
-
const workspaceRoot3 = config.workspaceRoot || findWorkspaceRoot();
|
|
1227
|
-
const entryPoints = [];
|
|
1228
|
-
if (entry) {
|
|
1229
|
-
if (typeof entry === "string") {
|
|
1230
|
-
entryPoints.push({
|
|
1231
|
-
in: entry,
|
|
1232
|
-
out: entry
|
|
1233
|
-
});
|
|
1234
|
-
} else if (Array.isArray(entry)) {
|
|
1235
|
-
entryPoints.push(...entry.map((entry2) => ({
|
|
1236
|
-
in: entry2,
|
|
1237
|
-
out: entry2
|
|
1238
|
-
})));
|
|
1239
|
-
} else {
|
|
1240
|
-
entryPoints.push(...Object.entries(entry).map(([key, value]) => {
|
|
1241
|
-
if (typeof value === "string") {
|
|
1242
|
-
return {
|
|
1243
|
-
in: value,
|
|
1244
|
-
out: key
|
|
1245
|
-
};
|
|
1246
|
-
} else {
|
|
1247
|
-
return {
|
|
1248
|
-
in: key,
|
|
1249
|
-
out: key
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
}));
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
if (emitOnAll) {
|
|
1256
|
-
entryPoints.push({
|
|
1257
|
-
in: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"),
|
|
1258
|
-
out: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}")
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
const results = await Promise.all(entryPoints.map(async (entryPoint) => {
|
|
1262
|
-
const paths = [];
|
|
1263
|
-
if (entryPoint.in.includes("*")) {
|
|
1264
|
-
const files = await glob3(entryPoint.in, {
|
|
1265
|
-
withFileTypes: true,
|
|
1266
|
-
ignore: [
|
|
1267
|
-
"**/node_modules/**"
|
|
1268
|
-
]
|
|
1269
|
-
});
|
|
1270
|
-
paths.push(...files.reduce((ret, filePath) => {
|
|
1271
|
-
const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot3), "").replaceAll(correctPaths(projectRoot), ""));
|
|
1272
|
-
if (result) {
|
|
1273
|
-
writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
|
|
1274
|
-
if (!paths.some((p) => p.in === result)) {
|
|
1275
|
-
paths.push({
|
|
1276
|
-
in: result,
|
|
1277
|
-
out: entryPoint.out.replace(entryPoint.in, result)
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
return ret;
|
|
1282
|
-
}, []));
|
|
1283
|
-
} else {
|
|
1284
|
-
writeDebug(`Adding ESBuild entry point
|
|
1285
|
-
- Input: ${entryPoint.in}
|
|
1286
|
-
- Output: ${entryPoint.out}`, config);
|
|
1287
|
-
if (!paths.some((p) => p.out === entryPoint.out)) {
|
|
1288
|
-
paths.push(entryPoint);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
return paths;
|
|
1292
|
-
}));
|
|
1293
|
-
return results.filter(Boolean).reduce((ret, result) => {
|
|
1294
|
-
result.forEach((res) => {
|
|
1295
|
-
if (res && !ret.some((p) => p.in === res.in)) {
|
|
1296
|
-
ret.push(res);
|
|
1297
|
-
}
|
|
1298
|
-
});
|
|
1299
|
-
return ret;
|
|
1300
|
-
}, []);
|
|
1301
|
-
}, "getEntryPoints");
|
|
1302
|
-
|
|
1303
|
-
// ../esbuild/src/utilities/helpers.ts
|
|
1304
|
-
function handleSync(fn) {
|
|
1305
|
-
try {
|
|
1306
|
-
return fn();
|
|
1307
|
-
} catch (error_) {
|
|
1308
|
-
return error_;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
__name(handleSync, "handleSync");
|
|
1312
|
-
async function handleAsync(fn) {
|
|
1313
|
-
try {
|
|
1314
|
-
return await fn();
|
|
1315
|
-
} catch (error_) {
|
|
1316
|
-
return error_;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
__name(handleAsync, "handleAsync");
|
|
1320
|
-
var handle = handleSync;
|
|
1321
|
-
handle.async = handleAsync;
|
|
1322
|
-
var skip = Symbol("skip");
|
|
1323
|
-
function transduceSync(list, transformer) {
|
|
1324
|
-
const transduced = [];
|
|
1325
|
-
for (const [i, element_] of list.entries()) {
|
|
1326
|
-
const transformed = transformer(element_, i);
|
|
1327
|
-
if (transformed !== skip) {
|
|
1328
|
-
transduced[transduced.length] = transformed;
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
return transduced;
|
|
1332
|
-
}
|
|
1333
|
-
__name(transduceSync, "transduceSync");
|
|
1334
|
-
async function transduceAsync(list, transformer) {
|
|
1335
|
-
const transduced = [];
|
|
1336
|
-
await Promise.all(list.entries().map(async ([i, element_]) => {
|
|
1337
|
-
const transformed = await transformer(element_, i);
|
|
1338
|
-
if (transformed !== skip) {
|
|
1339
|
-
transduced[transduced.length] = transformed;
|
|
1340
|
-
}
|
|
1341
|
-
}));
|
|
1342
|
-
return transduced;
|
|
1343
|
-
}
|
|
1344
|
-
__name(transduceAsync, "transduceAsync");
|
|
1345
|
-
var transduce = transduceSync;
|
|
1346
|
-
transduce.async = transduceAsync;
|
|
1347
|
-
function pipeSync(fn, ...fns) {
|
|
1348
|
-
return (...args) => {
|
|
1349
|
-
let result = fn(...args);
|
|
1350
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
1351
|
-
result = fns[i]?.(result);
|
|
1352
|
-
}
|
|
1353
|
-
return result;
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
__name(pipeSync, "pipeSync");
|
|
1357
|
-
function pipeAsync(fn, ...fns) {
|
|
1358
|
-
return async (...args) => {
|
|
1359
|
-
let result = await fn(...args);
|
|
1360
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
1361
|
-
result = await fns[i]?.(result);
|
|
1362
|
-
}
|
|
1363
|
-
return result;
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
__name(pipeAsync, "pipeAsync");
|
|
1367
|
-
var pipe = pipeSync;
|
|
1368
|
-
pipe.async = pipeAsync;
|
|
1369
|
-
|
|
1370
632
|
// ../esbuild/src/build.ts
|
|
1371
|
-
|
|
633
|
+
async function resolveContext(userOptions) {
|
|
1372
634
|
const projectRoot = userOptions.projectRoot;
|
|
1373
635
|
const workspaceRoot3 = findWorkspaceRoot2(projectRoot);
|
|
1374
636
|
if (!workspaceRoot3) {
|
|
1375
637
|
throw new Error("Cannot find Nx workspace root");
|
|
1376
638
|
}
|
|
1377
|
-
const
|
|
1378
|
-
|
|
639
|
+
const workspaceConfig = await getWorkspaceConfig(true, {
|
|
640
|
+
workspaceRoot: workspaceRoot3.dir
|
|
641
|
+
});
|
|
642
|
+
writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
|
|
1379
643
|
const stopwatch = getStopwatch("Build options resolution");
|
|
1380
644
|
const projectGraph = await createProjectGraphAsync({
|
|
1381
645
|
exitOnError: true
|
|
1382
646
|
});
|
|
1383
647
|
const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
|
|
1384
|
-
if (!
|
|
648
|
+
if (!existsSync3(projectJsonPath)) {
|
|
1385
649
|
throw new Error("Cannot find project.json configuration");
|
|
1386
650
|
}
|
|
1387
651
|
const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
|
|
1388
652
|
const projectJson = JSON.parse(projectJsonFile);
|
|
1389
|
-
const projectName = projectJson.name;
|
|
653
|
+
const projectName = projectJson.name || userOptions.name;
|
|
1390
654
|
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
1391
655
|
if (!projectConfigurations?.projects?.[projectName]) {
|
|
1392
656
|
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.");
|
|
1393
657
|
}
|
|
1394
|
-
const options =
|
|
658
|
+
const options = defu(userOptions, DEFAULT_BUILD_OPTIONS);
|
|
1395
659
|
options.name ??= `${projectName}-${options.format}`;
|
|
1396
660
|
options.target ??= DEFAULT_TARGET;
|
|
1397
661
|
const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
|
|
1398
|
-
if (!
|
|
662
|
+
if (!existsSync3(packageJsonPath)) {
|
|
1399
663
|
throw new Error("Cannot find package.json configuration");
|
|
1400
664
|
}
|
|
1401
665
|
const env = getEnv("esbuild", options);
|
|
1402
|
-
const
|
|
666
|
+
const resolvedOptions = {
|
|
1403
667
|
...options,
|
|
1404
|
-
config,
|
|
1405
|
-
mainFields: options.platform === "node" ? [
|
|
1406
|
-
"module",
|
|
1407
|
-
"main"
|
|
1408
|
-
] : [
|
|
1409
|
-
"browser",
|
|
1410
|
-
"module",
|
|
1411
|
-
"main"
|
|
1412
|
-
],
|
|
1413
|
-
...userOptions,
|
|
1414
668
|
tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
projectName,
|
|
1423
|
-
projectGraph,
|
|
1424
|
-
sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
|
|
1425
|
-
minify: userOptions.minify || !userOptions.debug,
|
|
1426
|
-
verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
|
|
1427
|
-
includeSrc: userOptions.includeSrc === true,
|
|
1428
|
-
metafile: userOptions.metafile !== false,
|
|
1429
|
-
generatePackageJson: userOptions.generatePackageJson !== false,
|
|
1430
|
-
clean: userOptions.clean !== false,
|
|
1431
|
-
assets: userOptions.assets ?? [],
|
|
1432
|
-
injectShims: userOptions.injectShims !== true,
|
|
1433
|
-
bundle: userOptions.bundle !== false,
|
|
1434
|
-
keepNames: true,
|
|
1435
|
-
watch: userOptions.watch === true,
|
|
1436
|
-
footer: userOptions.footer,
|
|
1437
|
-
banner: {
|
|
1438
|
-
js: options.banner || DEFAULT_COMPILED_BANNER,
|
|
1439
|
-
css: options.banner || DEFAULT_COMPILED_BANNER
|
|
1440
|
-
},
|
|
1441
|
-
splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
|
|
1442
|
-
treeShaking: options.format === "esm",
|
|
669
|
+
distDir: "dist",
|
|
670
|
+
name: projectName,
|
|
671
|
+
metafile: userOptions.mode === "development",
|
|
672
|
+
...userOptions,
|
|
673
|
+
clean: false,
|
|
674
|
+
target: userOptions.target || options.target,
|
|
675
|
+
splitting: options.format === "iife" ? false : options.treeshake === void 0 ? options.splitting : true,
|
|
1443
676
|
env,
|
|
1444
677
|
define: {
|
|
1445
|
-
STORM_FORMAT: JSON.stringify(options.format
|
|
1446
|
-
...options.format === "cjs" && options.injectShims ? {
|
|
1447
|
-
"import.meta.url": "importMetaUrl"
|
|
1448
|
-
} : {},
|
|
678
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
1449
679
|
...options.define,
|
|
1450
680
|
...Object.keys(env || {}).reduce((res, key) => {
|
|
1451
681
|
const value = JSON.stringify(env[key]);
|
|
@@ -1456,167 +686,98 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
|
|
|
1456
686
|
[`import.meta.env.${safeKey}`]: value
|
|
1457
687
|
};
|
|
1458
688
|
}, {})
|
|
1459
|
-
}
|
|
1460
|
-
inject: [
|
|
1461
|
-
options.format === "cjs" && options.injectShims ? joinPaths(__dirname, "../assets/cjs_shims.js") : void 0,
|
|
1462
|
-
options.format === "esm" && options.injectShims && options.platform === "node" ? joinPaths(__dirname, "../assets/esm_shims.js") : void 0
|
|
1463
|
-
].filter(Boolean)
|
|
689
|
+
}
|
|
1464
690
|
};
|
|
1465
|
-
result.plugins = userOptions.plugins ?? getDefaultBuildPlugins(userOptions, result);
|
|
1466
|
-
if (options.inject && Array.isArray(options.inject) && options.inject.length > 0) {
|
|
1467
|
-
result.inject = options.inject.reduce((ret, inj) => {
|
|
1468
|
-
if (inj && typeof inj === "string" && ret.includes(inj)) {
|
|
1469
|
-
ret.push(inj);
|
|
1470
|
-
}
|
|
1471
|
-
return ret;
|
|
1472
|
-
}, result.inject);
|
|
1473
|
-
}
|
|
1474
|
-
delete result.entry;
|
|
1475
|
-
delete result.outputPath;
|
|
1476
691
|
stopwatch();
|
|
1477
|
-
return
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
692
|
+
return {
|
|
693
|
+
options: resolvedOptions,
|
|
694
|
+
clean: userOptions.clean !== false,
|
|
695
|
+
workspaceConfig,
|
|
696
|
+
projectConfigurations,
|
|
697
|
+
projectName,
|
|
698
|
+
projectGraph,
|
|
699
|
+
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
|
|
700
|
+
outputPath: resolvedOptions.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
|
|
701
|
+
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
__name(resolveContext, "resolveContext");
|
|
705
|
+
async function generatePackageJson(context) {
|
|
706
|
+
if (context.options.generatePackageJson !== false && existsSync3(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
707
|
+
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
1482
708
|
const stopwatch = getStopwatch("Write package.json file");
|
|
1483
|
-
const packageJsonPath = joinPaths(
|
|
1484
|
-
if (!
|
|
709
|
+
const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
|
|
710
|
+
if (!existsSync3(packageJsonPath)) {
|
|
1485
711
|
throw new Error("Cannot find package.json configuration");
|
|
1486
712
|
}
|
|
1487
|
-
const packageJsonFile = await hf.readFile(joinPaths(
|
|
713
|
+
const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
|
|
1488
714
|
let packageJson = JSON.parse(packageJsonFile);
|
|
1489
715
|
if (!packageJson) {
|
|
1490
716
|
throw new Error("Cannot find package.json configuration file");
|
|
1491
717
|
}
|
|
1492
|
-
packageJson = await addPackageDependencies(
|
|
1493
|
-
packageJson = await addWorkspacePackageJsonFields(
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
718
|
+
packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
|
|
719
|
+
packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
|
|
720
|
+
if (context.options.entry) {
|
|
721
|
+
packageJson.exports ??= {};
|
|
722
|
+
packageJson.exports["./package.json"] ??= "./package.json";
|
|
723
|
+
packageJson.exports["."] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js`;
|
|
724
|
+
const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
|
|
725
|
+
for (const entryPoint of entryPoints) {
|
|
726
|
+
if (context.options.entry[entryPoint]) {
|
|
727
|
+
const entry = context.options.entry[entryPoint].replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
|
|
728
|
+
packageJson.exports[`./${entry}`] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entry}.js`;
|
|
729
|
+
}
|
|
1501
730
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
packageJson.main = packageJson.type === "commonjs" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.cjs`;
|
|
1507
|
-
}
|
|
1508
|
-
packageJson.types = `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.d.ts`;
|
|
1509
|
-
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
1510
|
-
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
1511
|
-
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
731
|
+
if (context.options.format === "esm") {
|
|
732
|
+
packageJson.module = packageJson.type === "module" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.mjs`;
|
|
733
|
+
} else {
|
|
734
|
+
packageJson.main = packageJson.type === "commonjs" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.cjs`;
|
|
1512
735
|
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
736
|
+
packageJson.types = `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.d.ts`;
|
|
737
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
738
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
739
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
740
|
+
}
|
|
741
|
+
return ret;
|
|
742
|
+
}, packageJson.exports);
|
|
743
|
+
}
|
|
744
|
+
await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
|
|
1516
745
|
stopwatch();
|
|
1517
746
|
}
|
|
1518
|
-
return
|
|
747
|
+
return context;
|
|
1519
748
|
}
|
|
1520
749
|
__name(generatePackageJson, "generatePackageJson");
|
|
1521
|
-
async function
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
const options = await getOptions();
|
|
1530
|
-
const rendererEngine = new RendererEngine([
|
|
1531
|
-
shebangRenderer,
|
|
1532
|
-
...options.renderers || []
|
|
1533
|
-
]);
|
|
1534
|
-
return {
|
|
1535
|
-
options,
|
|
1536
|
-
rendererEngine
|
|
1537
|
-
};
|
|
1538
|
-
}
|
|
1539
|
-
__name(generateContext, "generateContext");
|
|
1540
|
-
async function executeEsBuild(context2) {
|
|
1541
|
-
writeDebug(` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
|
|
1542
|
-
const stopwatch = getStopwatch(`${context2.options.name} build`);
|
|
1543
|
-
if (process.env.STORM_WATCH) {
|
|
1544
|
-
const ctx = await esbuild2.context(context2.options);
|
|
1545
|
-
watch(ctx, context2.options);
|
|
1546
|
-
}
|
|
1547
|
-
const options = {
|
|
1548
|
-
...context2.options
|
|
1549
|
-
};
|
|
1550
|
-
options.outdir = joinPaths(context2.options.outdir, context2.options.distDir);
|
|
1551
|
-
if (!options.inject || !Array.isArray(options.inject) || options.inject.length === 0 || // eslint-disable-next-line no-constant-binary-expression, @typescript-eslint/no-explicit-any
|
|
1552
|
-
options.inject === {}) {
|
|
1553
|
-
delete options.inject;
|
|
1554
|
-
}
|
|
1555
|
-
delete options.dts;
|
|
1556
|
-
delete options.env;
|
|
1557
|
-
delete options.name;
|
|
1558
|
-
delete options.assets;
|
|
1559
|
-
delete options.mode;
|
|
1560
|
-
delete options.orgName;
|
|
1561
|
-
delete options.watch;
|
|
1562
|
-
delete options.clean;
|
|
1563
|
-
delete options.debug;
|
|
1564
|
-
delete options.generatePackageJson;
|
|
1565
|
-
delete options.distDir;
|
|
1566
|
-
delete options.includeSrc;
|
|
1567
|
-
delete options.verbose;
|
|
1568
|
-
delete options.projectRoot;
|
|
1569
|
-
delete options.projectName;
|
|
1570
|
-
delete options.projectGraph;
|
|
1571
|
-
delete options.projectConfigurations;
|
|
1572
|
-
delete options.renderers;
|
|
1573
|
-
delete options.config;
|
|
1574
|
-
delete options.injectShims;
|
|
1575
|
-
delete options.external;
|
|
1576
|
-
writeTrace(`Run esbuild (${context2.options.name}) with the following options:
|
|
1577
|
-
${formatLogMessage({
|
|
1578
|
-
...options,
|
|
1579
|
-
define: "<Hidden>"
|
|
1580
|
-
})}`, context2.options.config);
|
|
1581
|
-
const result = await esbuild2.build(options);
|
|
1582
|
-
await esbuild2.stop();
|
|
1583
|
-
if (result.metafile) {
|
|
1584
|
-
const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
|
|
1585
|
-
await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
|
|
1586
|
-
}
|
|
750
|
+
async function executeTsup(context) {
|
|
751
|
+
writeDebug(` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
|
|
752
|
+
const stopwatch = getStopwatch(`${context.options.name} build`);
|
|
753
|
+
await tsup({
|
|
754
|
+
...context.options,
|
|
755
|
+
outDir: context.outputPath,
|
|
756
|
+
workspaceConfig: context.workspaceConfig
|
|
757
|
+
});
|
|
1587
758
|
stopwatch();
|
|
1588
|
-
return
|
|
1589
|
-
}
|
|
1590
|
-
__name(executeEsBuild, "executeEsBuild");
|
|
1591
|
-
async function executeTypescript(context2) {
|
|
1592
|
-
if (context2.result?.errors.length === 0 && context2.options.dts) {
|
|
1593
|
-
writeDebug(` \u{1F4CB} Running TypeScript Compiler for ${context2.options.name}`, context2.options.config);
|
|
1594
|
-
const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
|
|
1595
|
-
await emitDts(context2.options.config, context2.options.tsconfig, context2.options.tsconfigRaw, true);
|
|
1596
|
-
stopwatch();
|
|
1597
|
-
}
|
|
1598
|
-
return context2;
|
|
759
|
+
return context;
|
|
1599
760
|
}
|
|
1600
|
-
__name(
|
|
1601
|
-
async function copyBuildAssets(
|
|
1602
|
-
if (
|
|
1603
|
-
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${
|
|
1604
|
-
const stopwatch = getStopwatch(`${
|
|
1605
|
-
await copyAssets(
|
|
761
|
+
__name(executeTsup, "executeTsup");
|
|
762
|
+
async function copyBuildAssets(context) {
|
|
763
|
+
if (context.result?.errors.length === 0) {
|
|
764
|
+
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`, context.workspaceConfig);
|
|
765
|
+
const stopwatch = getStopwatch(`${context.options.name} asset copy`);
|
|
766
|
+
await copyAssets(context.workspaceConfig, context.options.assets ?? [], context.outputPath, context.options.projectRoot, context.sourceRoot, true, false);
|
|
1606
767
|
stopwatch();
|
|
1607
768
|
}
|
|
1608
|
-
return
|
|
769
|
+
return context;
|
|
1609
770
|
}
|
|
1610
771
|
__name(copyBuildAssets, "copyBuildAssets");
|
|
1611
|
-
async function reportResults(
|
|
1612
|
-
if (
|
|
1613
|
-
if (
|
|
1614
|
-
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${
|
|
772
|
+
async function reportResults(context) {
|
|
773
|
+
if (context.result?.errors.length === 0) {
|
|
774
|
+
if (context.result.warnings.length > 0) {
|
|
775
|
+
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
|
|
1615
776
|
}
|
|
1616
|
-
writeSuccess(` \u{1F4E6} The ${
|
|
1617
|
-
} else if (
|
|
1618
|
-
writeError(` \u274C The ${
|
|
1619
|
-
throw new Error(`The ${
|
|
777
|
+
writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
|
|
778
|
+
} else if (context.result?.errors && context.result?.errors.length > 0) {
|
|
779
|
+
writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
|
|
780
|
+
throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
|
|
1620
781
|
}
|
|
1621
782
|
}
|
|
1622
783
|
__name(reportResults, "reportResults");
|
|
@@ -1627,7 +788,7 @@ async function dependencyCheck(options) {
|
|
|
1627
788
|
if (process.env.CI && !process.env.BUILDKITE) {
|
|
1628
789
|
return void 0;
|
|
1629
790
|
}
|
|
1630
|
-
const buildPromise =
|
|
791
|
+
const buildPromise = esbuild.build({
|
|
1631
792
|
entryPoints: globbySync("**/*.{j,t}s", {
|
|
1632
793
|
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
1633
794
|
ignore: [
|
|
@@ -1650,17 +811,17 @@ async function dependencyCheck(options) {
|
|
|
1650
811
|
return void 0;
|
|
1651
812
|
}
|
|
1652
813
|
__name(dependencyCheck, "dependencyCheck");
|
|
1653
|
-
async function cleanOutputPath(
|
|
1654
|
-
if (
|
|
1655
|
-
writeDebug(` \u{1F9F9} Cleaning ${
|
|
1656
|
-
const stopwatch = getStopwatch(`${
|
|
1657
|
-
await cleanDirectories(
|
|
814
|
+
async function cleanOutputPath(context) {
|
|
815
|
+
if (context.clean !== false && context.outputPath) {
|
|
816
|
+
writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
|
|
817
|
+
const stopwatch = getStopwatch(`${context.options.name} output clean`);
|
|
818
|
+
await cleanDirectories(context.outputPath);
|
|
1658
819
|
stopwatch();
|
|
1659
820
|
}
|
|
1660
|
-
return
|
|
821
|
+
return context;
|
|
1661
822
|
}
|
|
1662
823
|
__name(cleanOutputPath, "cleanOutputPath");
|
|
1663
|
-
async function
|
|
824
|
+
async function build2(options) {
|
|
1664
825
|
writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
|
|
1665
826
|
const stopwatch = getStopwatch("ESBuild pipeline");
|
|
1666
827
|
try {
|
|
@@ -1670,8 +831,15 @@ async function build3(options) {
|
|
|
1670
831
|
if (opts.length === 0) {
|
|
1671
832
|
throw new Error("No build options were provided");
|
|
1672
833
|
}
|
|
1673
|
-
|
|
1674
|
-
await
|
|
834
|
+
const context = await resolveContext(options);
|
|
835
|
+
await cleanOutputPath(context);
|
|
836
|
+
await Promise.all([
|
|
837
|
+
dependencyCheck(context.options),
|
|
838
|
+
generatePackageJson(context),
|
|
839
|
+
copyBuildAssets(context),
|
|
840
|
+
executeTsup(context)
|
|
841
|
+
]);
|
|
842
|
+
await reportResults(context);
|
|
1675
843
|
writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
|
|
1676
844
|
} catch (error) {
|
|
1677
845
|
writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
|
|
@@ -1680,47 +848,19 @@ async function build3(options) {
|
|
|
1680
848
|
stopwatch();
|
|
1681
849
|
}
|
|
1682
850
|
}
|
|
1683
|
-
__name(
|
|
1684
|
-
var watch = /* @__PURE__ */ __name((context2, options) => {
|
|
1685
|
-
if (!options.watch) {
|
|
1686
|
-
return context2;
|
|
1687
|
-
}
|
|
1688
|
-
const config = {
|
|
1689
|
-
ignoreInitial: true,
|
|
1690
|
-
useFsEvents: true,
|
|
1691
|
-
ignored: [
|
|
1692
|
-
"./src/__tests__/**/*",
|
|
1693
|
-
"./package.json"
|
|
1694
|
-
]
|
|
1695
|
-
};
|
|
1696
|
-
const changeWatcher = createWatcher([
|
|
1697
|
-
"./src/**/*"
|
|
1698
|
-
], config);
|
|
1699
|
-
const fastRebuild = debounce(async () => {
|
|
1700
|
-
const timeBefore = Date.now();
|
|
1701
|
-
const rebuildResult = await handle.async(() => {
|
|
1702
|
-
return context2.rebuild();
|
|
1703
|
-
});
|
|
1704
|
-
if (rebuildResult instanceof Error) {
|
|
1705
|
-
writeError(rebuildResult.message);
|
|
1706
|
-
}
|
|
1707
|
-
writeTrace(`${Date.now() - timeBefore}ms [${options.name ?? ""}]`);
|
|
1708
|
-
}, 10);
|
|
1709
|
-
changeWatcher.on("change", fastRebuild);
|
|
1710
|
-
return void 0;
|
|
1711
|
-
}, "watch");
|
|
851
|
+
__name(build2, "build");
|
|
1712
852
|
|
|
1713
853
|
// ../workspace-tools/src/executors/esbuild/executor.ts
|
|
1714
|
-
async function esbuildExecutorFn(options,
|
|
854
|
+
async function esbuildExecutorFn(options, context, config) {
|
|
1715
855
|
writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
|
|
1716
|
-
if (!
|
|
856
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
1717
857
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
1718
858
|
}
|
|
1719
|
-
await
|
|
859
|
+
await build2({
|
|
1720
860
|
...options,
|
|
1721
|
-
projectRoot:
|
|
1722
|
-
|
|
1723
|
-
sourceRoot:
|
|
861
|
+
projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
|
|
862
|
+
name: context.projectName,
|
|
863
|
+
sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
|
|
1724
864
|
format: options.format,
|
|
1725
865
|
platform: options.format
|
|
1726
866
|
});
|
|
@@ -1748,7 +888,7 @@ import { execSync as execSync3 } from "node:child_process";
|
|
|
1748
888
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
1749
889
|
|
|
1750
890
|
// ../workspace-tools/src/utils/pnpm-deps-update.ts
|
|
1751
|
-
import { existsSync as
|
|
891
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1752
892
|
import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
1753
893
|
import { format } from "prettier";
|
|
1754
894
|
import readYamlFile from "read-yaml-file";
|
|
@@ -1762,19 +902,19 @@ import esBuildPlugin from "@size-limit/esbuild";
|
|
|
1762
902
|
import esBuildWhyPlugin from "@size-limit/esbuild-why";
|
|
1763
903
|
import filePlugin from "@size-limit/file";
|
|
1764
904
|
import sizeLimit from "size-limit";
|
|
1765
|
-
async function sizeLimitExecutorFn(options,
|
|
1766
|
-
if (!
|
|
905
|
+
async function sizeLimitExecutorFn(options, context, config) {
|
|
906
|
+
if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1767
907
|
throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
|
|
1768
908
|
}
|
|
1769
|
-
writeInfo(`\u{1F4CF} Running Size-Limit on ${
|
|
909
|
+
writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
|
|
1770
910
|
sizeLimit([
|
|
1771
911
|
filePlugin,
|
|
1772
912
|
esBuildPlugin,
|
|
1773
913
|
esBuildWhyPlugin
|
|
1774
914
|
], {
|
|
1775
|
-
checks: options.entry ??
|
|
915
|
+
checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(context.projectsConfigurations.projects[context.projectName]?.root ?? "./", "src")
|
|
1776
916
|
}).then((result) => {
|
|
1777
|
-
writeInfo(`\u{1F4CF} ${
|
|
917
|
+
writeInfo(`\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
|
|
1778
918
|
});
|
|
1779
919
|
return {
|
|
1780
920
|
success: true
|
|
@@ -1827,17 +967,17 @@ var executor_default8 = withRunExecutor("Typia runtime validation generator", ty
|
|
|
1827
967
|
});
|
|
1828
968
|
|
|
1829
969
|
// ../workspace-tools/src/executors/unbuild/executor.ts
|
|
1830
|
-
import { defu as
|
|
970
|
+
import { defu as defu2 } from "defu";
|
|
1831
971
|
import { createJiti } from "jiti";
|
|
1832
|
-
async function unbuildExecutorFn(options,
|
|
972
|
+
async function unbuildExecutorFn(options, context, config) {
|
|
1833
973
|
writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
|
|
1834
|
-
if (!
|
|
974
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1835
975
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
|
|
1836
976
|
}
|
|
1837
|
-
if (!
|
|
977
|
+
if (!context.projectsConfigurations.projects[context.projectName].root) {
|
|
1838
978
|
throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
|
|
1839
979
|
}
|
|
1840
|
-
if (!
|
|
980
|
+
if (!context.projectsConfigurations.projects[context.projectName].sourceRoot) {
|
|
1841
981
|
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.");
|
|
1842
982
|
}
|
|
1843
983
|
const jiti = createJiti(config.workspaceRoot, {
|
|
@@ -1845,11 +985,11 @@ async function unbuildExecutorFn(options, context2, config) {
|
|
|
1845
985
|
interopDefault: true
|
|
1846
986
|
});
|
|
1847
987
|
const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
|
|
1848
|
-
await stormUnbuild.build(
|
|
988
|
+
await stormUnbuild.build(defu2({
|
|
1849
989
|
...options,
|
|
1850
|
-
projectRoot:
|
|
1851
|
-
projectName:
|
|
1852
|
-
sourceRoot:
|
|
990
|
+
projectRoot: context.projectsConfigurations.projects[context.projectName].root,
|
|
991
|
+
projectName: context.projectName,
|
|
992
|
+
sourceRoot: context.projectsConfigurations.projects[context.projectName].sourceRoot,
|
|
1853
993
|
platform: options.platform
|
|
1854
994
|
}, {
|
|
1855
995
|
stubOptions: {
|
|
@@ -2532,7 +1672,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
|
|
|
2532
1672
|
|
|
2533
1673
|
// ../workspace-tools/src/generators/preset/generator.ts
|
|
2534
1674
|
import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
|
|
2535
|
-
import * as
|
|
1675
|
+
import * as path3 from "node:path";
|
|
2536
1676
|
async function presetGeneratorFn(tree, options) {
|
|
2537
1677
|
const projectRoot = ".";
|
|
2538
1678
|
options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
|
|
@@ -2680,7 +1820,7 @@ async function presetGeneratorFn(tree, options) {
|
|
|
2680
1820
|
};
|
|
2681
1821
|
return json;
|
|
2682
1822
|
});
|
|
2683
|
-
generateFiles4(tree,
|
|
1823
|
+
generateFiles4(tree, path3.join(__dirname, "files"), projectRoot, {
|
|
2684
1824
|
...options,
|
|
2685
1825
|
pnpmVersion,
|
|
2686
1826
|
nodeVersion
|
|
@@ -3388,27 +2528,27 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
|
|
|
3388
2528
|
|
|
3389
2529
|
// ../workspace-tools/src/utils/lock-file.ts
|
|
3390
2530
|
import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
|
|
3391
|
-
import { existsSync as
|
|
3392
|
-
import { join as
|
|
2531
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
2532
|
+
import { join as join2 } from "node:path";
|
|
3393
2533
|
import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
|
|
3394
2534
|
import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
|
|
3395
2535
|
import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
|
|
3396
2536
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
3397
2537
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
3398
2538
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
3399
|
-
var YARN_LOCK_PATH =
|
|
3400
|
-
var NPM_LOCK_PATH =
|
|
3401
|
-
var PNPM_LOCK_PATH =
|
|
2539
|
+
var YARN_LOCK_PATH = join2(workspaceRoot2, YARN_LOCK_FILE);
|
|
2540
|
+
var NPM_LOCK_PATH = join2(workspaceRoot2, NPM_LOCK_FILE);
|
|
2541
|
+
var PNPM_LOCK_PATH = join2(workspaceRoot2, PNPM_LOCK_FILE);
|
|
3402
2542
|
|
|
3403
2543
|
// ../workspace-tools/src/utils/package-helpers.ts
|
|
3404
2544
|
import { joinPathFragments as joinPathFragments6, readJsonFile as readJsonFile2 } from "@nx/devkit";
|
|
3405
|
-
import { existsSync as
|
|
2545
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
3406
2546
|
|
|
3407
2547
|
// ../workspace-tools/src/utils/plugin-helpers.ts
|
|
3408
2548
|
import { readJsonFile as readJsonFile3 } from "@nx/devkit";
|
|
3409
|
-
import
|
|
3410
|
-
import { existsSync as
|
|
3411
|
-
import { dirname
|
|
2549
|
+
import defu3 from "defu";
|
|
2550
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
2551
|
+
import { dirname, join as join3 } from "node:path";
|
|
3412
2552
|
|
|
3413
2553
|
// ../workspace-tools/src/utils/typia-transform.ts
|
|
3414
2554
|
import transform2 from "typia/lib/transform";
|