@storm-software/pulumi-tools 0.7.59 → 0.7.61
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 +2 -1
- package/dist/{chunk-MI4RA6QW.mjs → chunk-25V5OEPQ.mjs} +236 -1081
- package/dist/{chunk-AXVXZHVE.js → chunk-3FM2OLFY.js} +2 -2
- package/dist/{chunk-I4G5K5GD.mjs → chunk-6AYQ7VHF.mjs} +1 -1
- package/dist/{chunk-OPIOF623.js → chunk-DF7BQ6B4.js} +3 -3
- package/dist/{chunk-WPCCF4XK.mjs → chunk-GYUDNNH4.mjs} +1 -1
- package/dist/{chunk-RJZXZ7GO.mjs → chunk-LFMHCSYT.mjs} +1 -1
- package/dist/{chunk-VGSUCQ2S.mjs → chunk-N7GSKHH2.mjs} +1 -1
- package/dist/{chunk-BKOYMFG3.mjs → chunk-OD2UU3AH.mjs} +2 -2
- package/dist/{chunk-2GH5SAMT.js → chunk-OSYGW3FK.js} +2 -2
- package/dist/{chunk-Q4PTOHZI.js → chunk-RK4VN42S.js} +2 -2
- package/dist/{chunk-2LR3EV7Z.js → chunk-SFEDXEAP.js} +2 -2
- package/dist/{chunk-ADA6T4UC.mjs → chunk-TCRO6LLA.mjs} +1 -1
- package/dist/{chunk-OYUEUFJH.mjs → chunk-UFKMKONY.mjs} +3 -3
- package/dist/{chunk-SGIOQFKJ.js → chunk-VCUPZ253.js} +229 -1074
- package/dist/{chunk-DFKCFC3J.mjs → chunk-VW6DYIQY.mjs} +1 -1
- package/dist/{chunk-R4CTTR6E.js → chunk-WHDLXZDP.js} +2 -2
- package/dist/{chunk-JHWN77K2.mjs → chunk-XKY462OA.mjs} +1 -1
- package/dist/{chunk-KRE7ESUT.js → chunk-ZPLIND4J.js} +5 -5
- package/dist/executors.d.mts +2 -2
- package/dist/executors.d.ts +2 -2
- package/dist/executors.js +7 -7
- package/dist/executors.mjs +8 -8
- package/dist/{generators-BziLQ-SK.d.ts → generators-CdJ1t-Yr.d.mts} +2 -14
- package/dist/{generators-8hNcjX5A.d.mts → generators-CdJ1t-Yr.d.ts} +2 -14
- package/dist/generators.d.mts +3 -3
- package/dist/generators.d.ts +3 -3
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +4 -4
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +10 -10
- package/dist/src/base/base-executor.d.mts +2 -28
- package/dist/src/base/base-executor.d.ts +2 -28
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +3 -3
- package/dist/src/base/index.d.mts +2 -2
- package/dist/src/base/index.d.ts +2 -2
- package/dist/src/base/index.js +3 -3
- package/dist/src/base/index.mjs +4 -4
- package/dist/src/base/providers.mjs +2 -2
- package/dist/src/executors/config/executor.d.mts +2 -2
- package/dist/src/executors/config/executor.d.ts +2 -2
- package/dist/src/executors/config/executor.js +4 -4
- package/dist/src/executors/config/executor.mjs +4 -4
- package/dist/src/executors/import/executor.d.mts +2 -2
- package/dist/src/executors/import/executor.d.ts +2 -2
- package/dist/src/executors/import/executor.js +4 -4
- package/dist/src/executors/import/executor.mjs +4 -4
- package/dist/src/executors/preview/executor.d.mts +2 -2
- package/dist/src/executors/preview/executor.d.ts +2 -2
- package/dist/src/executors/preview/executor.js +4 -4
- package/dist/src/executors/preview/executor.mjs +4 -4
- package/dist/src/executors/refresh/executor.d.mts +2 -2
- package/dist/src/executors/refresh/executor.d.ts +2 -2
- package/dist/src/executors/refresh/executor.js +4 -4
- package/dist/src/executors/refresh/executor.mjs +4 -4
- package/dist/src/executors/up/executor.d.mts +2 -2
- package/dist/src/executors/up/executor.d.ts +2 -2
- package/dist/src/executors/up/executor.js +4 -4
- package/dist/src/executors/up/executor.mjs +4 -4
- package/dist/src/generators/init/generator.d.mts +3 -3
- package/dist/src/generators/init/generator.d.ts +3 -3
- package/dist/src/generators/init/generator.js +3 -3
- package/dist/src/generators/init/generator.mjs +4 -4
- package/dist/tsup.config.mjs +1 -1
- package/package.json +6 -9
- package/dist/types-D-xLCTdY.d.mts +0 -1286
- package/dist/types-D-xLCTdY.d.ts +0 -1286
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__dirname,
|
|
3
3
|
__name,
|
|
4
4
|
__require
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N7GSKHH2.mjs";
|
|
6
6
|
|
|
7
7
|
// ../config-tools/src/utilities/run.ts
|
|
8
8
|
import { exec, execSync } from "node:child_process";
|
|
@@ -277,65 +277,65 @@ __name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
|
277
277
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
278
278
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
279
279
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
280
|
-
var correctPaths = /* @__PURE__ */ __name(function(
|
|
281
|
-
if (!
|
|
280
|
+
var correctPaths = /* @__PURE__ */ __name(function(path4) {
|
|
281
|
+
if (!path4 || path4.length === 0) {
|
|
282
282
|
return ".";
|
|
283
283
|
}
|
|
284
|
-
|
|
285
|
-
const isUNCPath =
|
|
286
|
-
const isPathAbsolute = isAbsolute(
|
|
287
|
-
const trailingSeparator =
|
|
288
|
-
|
|
289
|
-
if (
|
|
284
|
+
path4 = normalizeWindowsPath(path4);
|
|
285
|
+
const isUNCPath = path4.match(_UNC_REGEX);
|
|
286
|
+
const isPathAbsolute = isAbsolute(path4);
|
|
287
|
+
const trailingSeparator = path4[path4.length - 1] === "/";
|
|
288
|
+
path4 = normalizeString(path4, !isPathAbsolute);
|
|
289
|
+
if (path4.length === 0) {
|
|
290
290
|
if (isPathAbsolute) {
|
|
291
291
|
return "/";
|
|
292
292
|
}
|
|
293
293
|
return trailingSeparator ? "./" : ".";
|
|
294
294
|
}
|
|
295
295
|
if (trailingSeparator) {
|
|
296
|
-
|
|
296
|
+
path4 += "/";
|
|
297
297
|
}
|
|
298
|
-
if (_DRIVE_LETTER_RE.test(
|
|
299
|
-
|
|
298
|
+
if (_DRIVE_LETTER_RE.test(path4)) {
|
|
299
|
+
path4 += "/";
|
|
300
300
|
}
|
|
301
301
|
if (isUNCPath) {
|
|
302
302
|
if (!isPathAbsolute) {
|
|
303
|
-
return `//./${
|
|
303
|
+
return `//./${path4}`;
|
|
304
304
|
}
|
|
305
|
-
return `//${
|
|
305
|
+
return `//${path4}`;
|
|
306
306
|
}
|
|
307
|
-
return isPathAbsolute && !isAbsolute(
|
|
307
|
+
return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
|
|
308
308
|
}, "correctPaths");
|
|
309
309
|
var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
310
|
-
let
|
|
310
|
+
let path4 = "";
|
|
311
311
|
for (const seg of segments) {
|
|
312
312
|
if (!seg) {
|
|
313
313
|
continue;
|
|
314
314
|
}
|
|
315
|
-
if (
|
|
316
|
-
const pathTrailing =
|
|
315
|
+
if (path4.length > 0) {
|
|
316
|
+
const pathTrailing = path4[path4.length - 1] === "/";
|
|
317
317
|
const segLeading = seg[0] === "/";
|
|
318
318
|
const both = pathTrailing && segLeading;
|
|
319
319
|
if (both) {
|
|
320
|
-
|
|
320
|
+
path4 += seg.slice(1);
|
|
321
321
|
} else {
|
|
322
|
-
|
|
322
|
+
path4 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
323
323
|
}
|
|
324
324
|
} else {
|
|
325
|
-
|
|
325
|
+
path4 += seg;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
return correctPaths(
|
|
328
|
+
return correctPaths(path4);
|
|
329
329
|
}, "joinPaths");
|
|
330
|
-
function normalizeString(
|
|
330
|
+
function normalizeString(path4, allowAboveRoot) {
|
|
331
331
|
let res = "";
|
|
332
332
|
let lastSegmentLength = 0;
|
|
333
333
|
let lastSlash = -1;
|
|
334
334
|
let dots = 0;
|
|
335
335
|
let char = null;
|
|
336
|
-
for (let index = 0; index <=
|
|
337
|
-
if (index <
|
|
338
|
-
char =
|
|
336
|
+
for (let index = 0; index <= path4.length; ++index) {
|
|
337
|
+
if (index < path4.length) {
|
|
338
|
+
char = path4[index];
|
|
339
339
|
} else if (char === "/") {
|
|
340
340
|
break;
|
|
341
341
|
} else {
|
|
@@ -371,9 +371,9 @@ function normalizeString(path7, allowAboveRoot) {
|
|
|
371
371
|
}
|
|
372
372
|
} else {
|
|
373
373
|
if (res.length > 0) {
|
|
374
|
-
res += `/${
|
|
374
|
+
res += `/${path4.slice(lastSlash + 1, index)}`;
|
|
375
375
|
} else {
|
|
376
|
-
res =
|
|
376
|
+
res = path4.slice(lastSlash + 1, index);
|
|
377
377
|
}
|
|
378
378
|
lastSegmentLength = index - lastSlash - 1;
|
|
379
379
|
}
|
|
@@ -659,10 +659,6 @@ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
|
|
|
659
659
|
}
|
|
660
660
|
return LogLevelLabel.INFO;
|
|
661
661
|
}, "getLogLevelLabel");
|
|
662
|
-
var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
|
|
663
|
-
const logLevel = typeof label === "string" ? getLogLevel(label) : label;
|
|
664
|
-
return logLevel >= LogLevel.DEBUG;
|
|
665
|
-
}, "isVerbose");
|
|
666
662
|
|
|
667
663
|
// ../config-tools/src/logger/console.ts
|
|
668
664
|
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
@@ -749,15 +745,15 @@ var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth2 = 0
|
|
|
749
745
|
return "<max depth>";
|
|
750
746
|
}
|
|
751
747
|
const prefix = options.prefix ?? "-";
|
|
752
|
-
const
|
|
748
|
+
const skip = options.skip ?? [];
|
|
753
749
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
754
750
|
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
755
751
|
prefix: `${prefix}-`,
|
|
756
|
-
skip
|
|
752
|
+
skip
|
|
757
753
|
}, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
758
|
-
${Object.keys(message).filter((key) => !
|
|
754
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
|
|
759
755
|
prefix: `${prefix}-`,
|
|
760
|
-
skip
|
|
756
|
+
skip
|
|
761
757
|
}, depth2 + 1) : message[key]}`).join("\n")}` : message;
|
|
762
758
|
}, "formatLogMessage");
|
|
763
759
|
var _isFunction = /* @__PURE__ */ __name((value) => {
|
|
@@ -1413,21 +1409,28 @@ ${formatLogMessage(config)}`, config);
|
|
|
1413
1409
|
var getConfig = /* @__PURE__ */ __name((workspaceRoot3, skipLogs = false) => {
|
|
1414
1410
|
return loadStormWorkspaceConfig(workspaceRoot3, skipLogs);
|
|
1415
1411
|
}, "getConfig");
|
|
1412
|
+
var getWorkspaceConfig = /* @__PURE__ */ __name((skipLogs = false, options = {}) => {
|
|
1413
|
+
let workspaceRoot3 = options.workspaceRoot;
|
|
1414
|
+
if (!workspaceRoot3) {
|
|
1415
|
+
workspaceRoot3 = findWorkspaceRoot(options.cwd);
|
|
1416
|
+
}
|
|
1417
|
+
return getConfig(workspaceRoot3, skipLogs);
|
|
1418
|
+
}, "getWorkspaceConfig");
|
|
1416
1419
|
|
|
1417
1420
|
// ../workspace-tools/src/base/base-executor.ts
|
|
1418
1421
|
import { defu as defu3 } from "defu";
|
|
1419
|
-
var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options,
|
|
1422
|
+
var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
|
|
1420
1423
|
const stopwatch = getStopwatch(name);
|
|
1421
1424
|
let options = _options;
|
|
1422
1425
|
let config = {};
|
|
1423
1426
|
try {
|
|
1424
|
-
if (!
|
|
1427
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1425
1428
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
1426
1429
|
}
|
|
1427
1430
|
const workspaceRoot3 = findWorkspaceRoot();
|
|
1428
|
-
const projectRoot =
|
|
1429
|
-
const sourceRoot =
|
|
1430
|
-
const projectName =
|
|
1431
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot3;
|
|
1432
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot3;
|
|
1433
|
+
const projectName = context.projectName;
|
|
1431
1434
|
config.workspaceRoot = workspaceRoot3;
|
|
1432
1435
|
writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
|
|
1433
1436
|
if (!executorOptions.skipReadingConfig) {
|
|
@@ -1453,7 +1456,7 @@ ${formatLogMessage(options)}
|
|
|
1453
1456
|
sourceRoot,
|
|
1454
1457
|
projectName,
|
|
1455
1458
|
config
|
|
1456
|
-
}, config,
|
|
1459
|
+
}, config, context.projectsConfigurations.projects[context.projectName]), applyWorkspaceProjectTokens);
|
|
1457
1460
|
writeTrace(`Executor schema tokenized options \u2699\uFE0F
|
|
1458
1461
|
${formatLogMessage(tokenized)}
|
|
1459
1462
|
`, config);
|
|
@@ -1462,7 +1465,7 @@ ${formatLogMessage(tokenized)}
|
|
|
1462
1465
|
await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
|
|
1463
1466
|
writeDebug("Completed the preProcess hook", config);
|
|
1464
1467
|
}
|
|
1465
|
-
const ret = executorFn(tokenized,
|
|
1468
|
+
const ret = executorFn(tokenized, context, config);
|
|
1466
1469
|
if (_isFunction2(ret?.next)) {
|
|
1467
1470
|
const asyncGen = ret;
|
|
1468
1471
|
for await (const iter of asyncGen) {
|
|
@@ -1605,7 +1608,7 @@ var INVALID_CARGO_ARGS = [
|
|
|
1605
1608
|
"package",
|
|
1606
1609
|
"tsConfig"
|
|
1607
1610
|
];
|
|
1608
|
-
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options,
|
|
1611
|
+
var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context) => {
|
|
1609
1612
|
const args = [];
|
|
1610
1613
|
if (options.toolchain && options.toolchain !== "stable") {
|
|
1611
1614
|
args.push(`+${options.toolchain}`);
|
|
@@ -1627,8 +1630,8 @@ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context2)
|
|
|
1627
1630
|
args.push(`--${key}`, String(value));
|
|
1628
1631
|
}
|
|
1629
1632
|
}
|
|
1630
|
-
if (
|
|
1631
|
-
args.push("-p",
|
|
1633
|
+
if (context.projectName) {
|
|
1634
|
+
args.push("-p", context.projectName);
|
|
1632
1635
|
}
|
|
1633
1636
|
if (options.allFeatures && !args.includes("--all-features")) {
|
|
1634
1637
|
args.push("--all-features");
|
|
@@ -1720,8 +1723,8 @@ function runProcess(processCmd, ...args) {
|
|
|
1720
1723
|
__name(runProcess, "runProcess");
|
|
1721
1724
|
|
|
1722
1725
|
// ../workspace-tools/src/executors/cargo-build/executor.ts
|
|
1723
|
-
async function cargoBuildExecutor(options,
|
|
1724
|
-
const command = buildCargoCommand("build", options,
|
|
1726
|
+
async function cargoBuildExecutor(options, context) {
|
|
1727
|
+
const command = buildCargoCommand("build", options, context);
|
|
1725
1728
|
return await cargoCommand(...command);
|
|
1726
1729
|
}
|
|
1727
1730
|
__name(cargoBuildExecutor, "cargoBuildExecutor");
|
|
@@ -1737,8 +1740,8 @@ var executor_default = withRunExecutor("Cargo Build", cargoBuildExecutor, {
|
|
|
1737
1740
|
});
|
|
1738
1741
|
|
|
1739
1742
|
// ../workspace-tools/src/executors/cargo-check/executor.ts
|
|
1740
|
-
async function cargoCheckExecutor(options,
|
|
1741
|
-
const command = buildCargoCommand("check", options,
|
|
1743
|
+
async function cargoCheckExecutor(options, context) {
|
|
1744
|
+
const command = buildCargoCommand("check", options, context);
|
|
1742
1745
|
return await cargoCommand(...command);
|
|
1743
1746
|
}
|
|
1744
1747
|
__name(cargoCheckExecutor, "cargoCheckExecutor");
|
|
@@ -1753,8 +1756,8 @@ var executor_default2 = withRunExecutor("Cargo Check", cargoCheckExecutor, {
|
|
|
1753
1756
|
});
|
|
1754
1757
|
|
|
1755
1758
|
// ../workspace-tools/src/executors/cargo-clippy/executor.ts
|
|
1756
|
-
async function cargoClippyExecutor(options,
|
|
1757
|
-
const command = buildCargoCommand("clippy", options,
|
|
1759
|
+
async function cargoClippyExecutor(options, context) {
|
|
1760
|
+
const command = buildCargoCommand("clippy", options, context);
|
|
1758
1761
|
return await cargoCommand(...command);
|
|
1759
1762
|
}
|
|
1760
1763
|
__name(cargoClippyExecutor, "cargoClippyExecutor");
|
|
@@ -1770,13 +1773,13 @@ var executor_default3 = withRunExecutor("Cargo Clippy", cargoClippyExecutor, {
|
|
|
1770
1773
|
});
|
|
1771
1774
|
|
|
1772
1775
|
// ../workspace-tools/src/executors/cargo-doc/executor.ts
|
|
1773
|
-
async function cargoDocExecutor(options,
|
|
1776
|
+
async function cargoDocExecutor(options, context) {
|
|
1774
1777
|
const opts = {
|
|
1775
1778
|
...options
|
|
1776
1779
|
};
|
|
1777
1780
|
opts["no-deps"] = opts.noDeps;
|
|
1778
1781
|
delete opts.noDeps;
|
|
1779
|
-
const command = buildCargoCommand("doc", options,
|
|
1782
|
+
const command = buildCargoCommand("doc", options, context);
|
|
1780
1783
|
return await cargoCommand(...command);
|
|
1781
1784
|
}
|
|
1782
1785
|
__name(cargoDocExecutor, "cargoDocExecutor");
|
|
@@ -1798,8 +1801,8 @@ var executor_default4 = withRunExecutor("Cargo Doc", cargoDocExecutor, {
|
|
|
1798
1801
|
});
|
|
1799
1802
|
|
|
1800
1803
|
// ../workspace-tools/src/executors/cargo-format/executor.ts
|
|
1801
|
-
async function cargoFormatExecutor(options,
|
|
1802
|
-
const command = buildCargoCommand("fmt", options,
|
|
1804
|
+
async function cargoFormatExecutor(options, context) {
|
|
1805
|
+
const command = buildCargoCommand("fmt", options, context);
|
|
1803
1806
|
return await cargoCommand(...command);
|
|
1804
1807
|
}
|
|
1805
1808
|
__name(cargoFormatExecutor, "cargoFormatExecutor");
|
|
@@ -1828,7 +1831,7 @@ import { logger } from "@nx/devkit";
|
|
|
1828
1831
|
var LARGE_BUFFER2 = 1024 * 1e6;
|
|
1829
1832
|
|
|
1830
1833
|
// ../esbuild/src/build.ts
|
|
1831
|
-
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
|
|
1834
|
+
import { createProjectGraphAsync as createProjectGraphAsync2, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
|
|
1832
1835
|
|
|
1833
1836
|
// ../build-tools/src/config.ts
|
|
1834
1837
|
var DEFAULT_COMPILED_BANNER = `/*****************************************
|
|
@@ -1914,9 +1917,18 @@ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildabl
|
|
|
1914
1917
|
import { Glob } from "glob";
|
|
1915
1918
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
1916
1919
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
1917
|
-
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1920
|
+
import { createProjectGraphAsync, readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1918
1921
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, projectRoot, projectName, packageJson) => {
|
|
1919
|
-
|
|
1922
|
+
let projectGraph;
|
|
1923
|
+
try {
|
|
1924
|
+
projectGraph = readCachedProjectGraph();
|
|
1925
|
+
} catch {
|
|
1926
|
+
await createProjectGraphAsync();
|
|
1927
|
+
projectGraph = readCachedProjectGraph();
|
|
1928
|
+
}
|
|
1929
|
+
if (!projectGraph) {
|
|
1930
|
+
throw new Error("The Build process failed because the project graph is not available. Please run the build command again.");
|
|
1931
|
+
}
|
|
1920
1932
|
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot3, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1921
1933
|
const localPackages = [];
|
|
1922
1934
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot3)) {
|
|
@@ -1971,8 +1983,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
1971
1983
|
}
|
|
1972
1984
|
return packageJson;
|
|
1973
1985
|
}, "addPackageDependencies");
|
|
1974
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (
|
|
1975
|
-
const workspaceRoot3 =
|
|
1986
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
1987
|
+
const workspaceRoot3 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
1976
1988
|
const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot3, "package.json"), "utf8");
|
|
1977
1989
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
1978
1990
|
packageJson.type ??= "module";
|
|
@@ -2043,159 +2055,18 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
|
|
|
2043
2055
|
|
|
2044
2056
|
// ../esbuild/src/build.ts
|
|
2045
2057
|
import { watch as createWatcher } from "chokidar";
|
|
2046
|
-
import
|
|
2047
|
-
import { debounce
|
|
2048
|
-
import
|
|
2049
|
-
import * as esbuild2 from "esbuild";
|
|
2058
|
+
import defu4 from "defu";
|
|
2059
|
+
import { debounce } from "es-toolkit";
|
|
2060
|
+
import * as esbuild from "esbuild";
|
|
2050
2061
|
import { globbySync } from "globby";
|
|
2051
|
-
import { existsSync as
|
|
2062
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
2052
2063
|
import hf from "node:fs/promises";
|
|
2053
2064
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
2054
|
-
|
|
2055
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
2056
|
-
import path3 from "node:path";
|
|
2057
|
-
import { SourceMapConsumer, SourceMapGenerator } from "source-map";
|
|
2058
|
-
|
|
2059
|
-
// ../esbuild/src/utilities/output-file.ts
|
|
2060
|
-
import fs2 from "node:fs";
|
|
2061
|
-
import path2 from "node:path";
|
|
2062
|
-
var outputFile = /* @__PURE__ */ __name(async (filepath, data, options) => {
|
|
2063
|
-
await fs2.promises.mkdir(path2.dirname(filepath), {
|
|
2064
|
-
recursive: true
|
|
2065
|
-
});
|
|
2066
|
-
await fs2.promises.writeFile(filepath, data, options);
|
|
2067
|
-
}, "outputFile");
|
|
2068
|
-
|
|
2069
|
-
// ../esbuild/src/base/renderer-engine.ts
|
|
2070
|
-
var parseSourceMap = /* @__PURE__ */ __name((map2) => {
|
|
2071
|
-
return typeof map2 === "string" ? JSON.parse(map2) : map2;
|
|
2072
|
-
}, "parseSourceMap");
|
|
2073
|
-
var isJS = /* @__PURE__ */ __name((path7) => /\.(js|mjs|cjs)$/.test(path7), "isJS");
|
|
2074
|
-
var isCSS = /* @__PURE__ */ __name((path7) => /\.css$/.test(path7), "isCSS");
|
|
2075
|
-
var getSourcemapComment = /* @__PURE__ */ __name((inline, map2, filepath, isCssFile) => {
|
|
2076
|
-
if (!map2) return "";
|
|
2077
|
-
const prefix = isCssFile ? "/*" : "//";
|
|
2078
|
-
const suffix = isCssFile ? " */" : "";
|
|
2079
|
-
const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${path3.basename(filepath)}.map`;
|
|
2080
|
-
return `${prefix}# sourceMappingURL=${url}${suffix}`;
|
|
2081
|
-
}, "getSourcemapComment");
|
|
2082
|
-
var RendererEngine = class {
|
|
2083
|
-
static {
|
|
2084
|
-
__name(this, "RendererEngine");
|
|
2085
|
-
}
|
|
2086
|
-
#renderers;
|
|
2087
|
-
#options;
|
|
2088
|
-
constructor(renderers) {
|
|
2089
|
-
this.#renderers = renderers;
|
|
2090
|
-
}
|
|
2091
|
-
setOptions(options) {
|
|
2092
|
-
this.#options = options;
|
|
2093
|
-
}
|
|
2094
|
-
getOptions() {
|
|
2095
|
-
if (!this.#options) {
|
|
2096
|
-
throw new Error(`Renderer options is not set`);
|
|
2097
|
-
}
|
|
2098
|
-
return this.#options;
|
|
2099
|
-
}
|
|
2100
|
-
modifyEsbuildOptions(options) {
|
|
2101
|
-
for (const renderer of this.#renderers) {
|
|
2102
|
-
if (renderer.esbuildOptions) {
|
|
2103
|
-
renderer.esbuildOptions.call(this.getOptions(), options);
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
async buildStarted() {
|
|
2108
|
-
for (const renderer of this.#renderers) {
|
|
2109
|
-
if (renderer.buildStart) {
|
|
2110
|
-
await renderer.buildStart.call(this.getOptions());
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
async buildFinished({ outputFiles, metafile }) {
|
|
2115
|
-
const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
|
|
2116
|
-
if (isJS(file.path) || isCSS(file.path)) {
|
|
2117
|
-
let relativePath = path3.relative(this.getOptions().config.workspaceRoot, file.path);
|
|
2118
|
-
if (!relativePath.startsWith("\\\\?\\")) {
|
|
2119
|
-
relativePath = relativePath.replace(/\\/g, "/");
|
|
2120
|
-
}
|
|
2121
|
-
const meta = metafile?.outputs[relativePath];
|
|
2122
|
-
return {
|
|
2123
|
-
type: "chunk",
|
|
2124
|
-
path: file.path,
|
|
2125
|
-
code: file.text,
|
|
2126
|
-
map: outputFiles.find((f) => f.path === `${file.path}.map`)?.text,
|
|
2127
|
-
entryPoint: meta?.entryPoint,
|
|
2128
|
-
exports: meta?.exports,
|
|
2129
|
-
imports: meta?.imports
|
|
2130
|
-
};
|
|
2131
|
-
} else {
|
|
2132
|
-
return {
|
|
2133
|
-
type: "asset",
|
|
2134
|
-
path: file.path,
|
|
2135
|
-
contents: file.contents
|
|
2136
|
-
};
|
|
2137
|
-
}
|
|
2138
|
-
});
|
|
2139
|
-
const writtenFiles = [];
|
|
2140
|
-
await Promise.all(files.map(async (info) => {
|
|
2141
|
-
for (const renderer of this.#renderers) {
|
|
2142
|
-
if (info.type === "chunk" && renderer.renderChunk) {
|
|
2143
|
-
const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
|
|
2144
|
-
if (result) {
|
|
2145
|
-
info.code = result.code;
|
|
2146
|
-
if (result.map) {
|
|
2147
|
-
const originalConsumer = await new SourceMapConsumer(parseSourceMap(info.map));
|
|
2148
|
-
const newConsumer = await new SourceMapConsumer(parseSourceMap(result.map));
|
|
2149
|
-
const generator = SourceMapGenerator.fromSourceMap(newConsumer);
|
|
2150
|
-
generator.applySourceMap(originalConsumer, info.path);
|
|
2151
|
-
info.map = generator.toJSON();
|
|
2152
|
-
originalConsumer.destroy();
|
|
2153
|
-
newConsumer.destroy();
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
const inlineSourceMap = this.#options.sourcemap === "inline";
|
|
2159
|
-
const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
|
|
2160
|
-
await outputFile(info.path, contents, {
|
|
2161
|
-
mode: info.type === "chunk" ? info.mode : void 0
|
|
2162
|
-
});
|
|
2163
|
-
writtenFiles.push({
|
|
2164
|
-
get name() {
|
|
2165
|
-
return path3.relative(process.cwd(), info.path);
|
|
2166
|
-
},
|
|
2167
|
-
get size() {
|
|
2168
|
-
return contents.length;
|
|
2169
|
-
}
|
|
2170
|
-
});
|
|
2171
|
-
if (info.type === "chunk" && info.map && !inlineSourceMap) {
|
|
2172
|
-
const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
|
|
2173
|
-
const outPath = `${info.path}.map`;
|
|
2174
|
-
const contents2 = JSON.stringify(map2);
|
|
2175
|
-
await outputFile(outPath, contents2);
|
|
2176
|
-
writtenFiles.push({
|
|
2177
|
-
get name() {
|
|
2178
|
-
return path3.relative(process.cwd(), outPath);
|
|
2179
|
-
},
|
|
2180
|
-
get size() {
|
|
2181
|
-
return contents2.length;
|
|
2182
|
-
}
|
|
2183
|
-
});
|
|
2184
|
-
}
|
|
2185
|
-
}));
|
|
2186
|
-
for (const renderer of this.#renderers) {
|
|
2187
|
-
if (renderer.buildEnd) {
|
|
2188
|
-
await renderer.buildEnd.call(this.getOptions(), {
|
|
2189
|
-
writtenFiles
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
};
|
|
2065
|
+
import { build as tsup } from "tsup";
|
|
2195
2066
|
|
|
2196
2067
|
// ../esbuild/src/clean.ts
|
|
2197
2068
|
import { rm } from "node:fs/promises";
|
|
2198
|
-
async function cleanDirectories(
|
|
2069
|
+
async function cleanDirectories(directory) {
|
|
2199
2070
|
await rm(directory, {
|
|
2200
2071
|
recursive: true,
|
|
2201
2072
|
force: true
|
|
@@ -2203,315 +2074,24 @@ async function cleanDirectories(name = "ESBuild", directory, config) {
|
|
|
2203
2074
|
}
|
|
2204
2075
|
__name(cleanDirectories, "cleanDirectories");
|
|
2205
2076
|
|
|
2206
|
-
// ../esbuild/src/plugins/esm-split-code-to-cjs.ts
|
|
2207
|
-
import * as esbuild from "esbuild";
|
|
2208
|
-
var esmSplitCodeToCjsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
2209
|
-
name: "storm:esm-split-code-to-cjs",
|
|
2210
|
-
setup(build4) {
|
|
2211
|
-
build4.onEnd(async (result) => {
|
|
2212
|
-
const outFiles = Object.keys(result.metafile?.outputs ?? {});
|
|
2213
|
-
const jsFiles = outFiles.filter((f) => f.endsWith("js"));
|
|
2214
|
-
await esbuild.build({
|
|
2215
|
-
outdir: resolvedOptions.outdir,
|
|
2216
|
-
entryPoints: jsFiles,
|
|
2217
|
-
allowOverwrite: true,
|
|
2218
|
-
format: "cjs",
|
|
2219
|
-
logLevel: "error",
|
|
2220
|
-
packages: "external"
|
|
2221
|
-
});
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2224
|
-
}), "esmSplitCodeToCjsPlugin");
|
|
2225
|
-
|
|
2226
|
-
// ../esbuild/src/plugins/fix-imports.ts
|
|
2227
|
-
var fixImportsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
2228
|
-
name: "storm:fix-imports",
|
|
2229
|
-
setup(build4) {
|
|
2230
|
-
build4.onResolve({
|
|
2231
|
-
filter: /^spdx-exceptions/
|
|
2232
|
-
}, () => {
|
|
2233
|
-
return {
|
|
2234
|
-
path: __require.resolve("spdx-exceptions")
|
|
2235
|
-
};
|
|
2236
|
-
});
|
|
2237
|
-
build4.onResolve({
|
|
2238
|
-
filter: /^spdx-license-ids/
|
|
2239
|
-
}, () => {
|
|
2240
|
-
return {
|
|
2241
|
-
path: __require.resolve("spdx-license-ids")
|
|
2242
|
-
};
|
|
2243
|
-
});
|
|
2244
|
-
}
|
|
2245
|
-
}), "fixImportsPlugin");
|
|
2246
|
-
|
|
2247
|
-
// ../esbuild/src/plugins/native-node-module.ts
|
|
2248
|
-
import { dirname } from "node:path";
|
|
2249
|
-
var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
2250
|
-
return {
|
|
2251
|
-
name: "native-node-modules",
|
|
2252
|
-
setup(build4) {
|
|
2253
|
-
build4.onResolve({
|
|
2254
|
-
filter: /\.node$/,
|
|
2255
|
-
namespace: "file"
|
|
2256
|
-
}, (args) => {
|
|
2257
|
-
const resolvedId = __require.resolve(args.path, {
|
|
2258
|
-
paths: [
|
|
2259
|
-
args.resolveDir
|
|
2260
|
-
]
|
|
2261
|
-
});
|
|
2262
|
-
if (resolvedId.endsWith(".node")) {
|
|
2263
|
-
return {
|
|
2264
|
-
path: resolvedId,
|
|
2265
|
-
namespace: "node-file"
|
|
2266
|
-
};
|
|
2267
|
-
}
|
|
2268
|
-
return {
|
|
2269
|
-
path: resolvedId
|
|
2270
|
-
};
|
|
2271
|
-
});
|
|
2272
|
-
build4.onLoad({
|
|
2273
|
-
filter: /.*/,
|
|
2274
|
-
namespace: "node-file"
|
|
2275
|
-
}, (args) => {
|
|
2276
|
-
return {
|
|
2277
|
-
contents: `
|
|
2278
|
-
import path from ${JSON.stringify(args.path)}
|
|
2279
|
-
try { module.exports = require(path) }
|
|
2280
|
-
catch {}
|
|
2281
|
-
`,
|
|
2282
|
-
resolveDir: dirname(args.path)
|
|
2283
|
-
};
|
|
2284
|
-
});
|
|
2285
|
-
build4.onResolve({
|
|
2286
|
-
filter: /\.node$/,
|
|
2287
|
-
namespace: "node-file"
|
|
2288
|
-
}, (args) => ({
|
|
2289
|
-
path: args.path,
|
|
2290
|
-
namespace: "file"
|
|
2291
|
-
}));
|
|
2292
|
-
const opts = build4.initialOptions;
|
|
2293
|
-
opts.loader = opts.loader || {};
|
|
2294
|
-
opts.loader[".node"] = "file";
|
|
2295
|
-
}
|
|
2296
|
-
};
|
|
2297
|
-
}, "nativeNodeModulesPlugin");
|
|
2298
|
-
|
|
2299
|
-
// ../esbuild/src/plugins/node-protocol.ts
|
|
2300
|
-
var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
2301
|
-
const nodeProtocol = "node:";
|
|
2302
|
-
return {
|
|
2303
|
-
name: "node-protocol-plugin",
|
|
2304
|
-
setup({ onResolve }) {
|
|
2305
|
-
onResolve({
|
|
2306
|
-
filter: /^node:/
|
|
2307
|
-
}, ({ path: path7 }) => ({
|
|
2308
|
-
path: path7.slice(nodeProtocol.length),
|
|
2309
|
-
external: true
|
|
2310
|
-
}));
|
|
2311
|
-
}
|
|
2312
|
-
};
|
|
2313
|
-
}, "nodeProtocolPlugin");
|
|
2314
|
-
|
|
2315
|
-
// ../esbuild/src/plugins/on-error.ts
|
|
2316
|
-
var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
2317
|
-
name: "storm:on-error",
|
|
2318
|
-
setup(build4) {
|
|
2319
|
-
build4.onEnd((result) => {
|
|
2320
|
-
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
2321
|
-
writeError(`The following errors occurred during the build:
|
|
2322
|
-
${result.errors.map((error) => error.text).join("\n")}
|
|
2323
|
-
|
|
2324
|
-
`, resolvedOptions.config);
|
|
2325
|
-
throw new Error("Storm esbuild process failed with errors.");
|
|
2326
|
-
}
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
}), "onErrorPlugin");
|
|
2330
|
-
|
|
2331
|
-
// ../esbuild/src/plugins/resolve-paths.ts
|
|
2332
|
-
import path4 from "node:path";
|
|
2333
|
-
function resolvePathsConfig(options, cwd) {
|
|
2334
|
-
if (options?.compilerOptions?.paths) {
|
|
2335
|
-
const paths = Object.entries(options.compilerOptions.paths);
|
|
2336
|
-
const resolvedPaths = paths.map(([key, paths2]) => {
|
|
2337
|
-
return [
|
|
2338
|
-
key,
|
|
2339
|
-
paths2.map((v) => path4.resolve(cwd, v))
|
|
2340
|
-
];
|
|
2341
|
-
});
|
|
2342
|
-
return Object.fromEntries(resolvedPaths);
|
|
2343
|
-
}
|
|
2344
|
-
if (options.extends) {
|
|
2345
|
-
const extendsPath = path4.resolve(cwd, options.extends);
|
|
2346
|
-
const extendsDir = path4.dirname(extendsPath);
|
|
2347
|
-
const extendsConfig = __require(extendsPath);
|
|
2348
|
-
return resolvePathsConfig(extendsConfig, extendsDir);
|
|
2349
|
-
}
|
|
2350
|
-
return [];
|
|
2351
|
-
}
|
|
2352
|
-
__name(resolvePathsConfig, "resolvePathsConfig");
|
|
2353
|
-
var resolvePathsPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
2354
|
-
name: "storm:resolve-paths",
|
|
2355
|
-
setup(build4) {
|
|
2356
|
-
const parentTsConfig = build4.initialOptions.tsconfig ? __require(joinPaths(resolvedOptions.config.workspaceRoot, build4.initialOptions.tsconfig)) : __require(joinPaths(resolvedOptions.config.workspaceRoot, "tsconfig.json"));
|
|
2357
|
-
const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
|
|
2358
|
-
const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
|
|
2359
|
-
build4.onResolve({
|
|
2360
|
-
filter: packagesRegex
|
|
2361
|
-
}, (args) => {
|
|
2362
|
-
if (build4.initialOptions.external?.includes(args.path)) {
|
|
2363
|
-
return {
|
|
2364
|
-
path: args.path,
|
|
2365
|
-
external: true
|
|
2366
|
-
};
|
|
2367
|
-
}
|
|
2368
|
-
return {
|
|
2369
|
-
path: `${resolvedTsPaths[args.path][0]}/index.ts`
|
|
2370
|
-
};
|
|
2371
|
-
});
|
|
2372
|
-
}
|
|
2373
|
-
}), "resolvePathsPlugin");
|
|
2374
|
-
|
|
2375
|
-
// ../esbuild/src/plugins/tsc.ts
|
|
2376
|
-
import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
|
|
2377
|
-
import { existsSync as existsSync5 } from "node:fs";
|
|
2378
|
-
import fs3 from "node:fs/promises";
|
|
2379
|
-
function bundleTypeDefinitions(filename, outfile, externals, options) {
|
|
2380
|
-
const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(options.projectRoot, "package.json"));
|
|
2381
|
-
const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
|
|
2382
|
-
p,
|
|
2383
|
-
getTypeDependencyPackageName(p)
|
|
2384
|
-
]);
|
|
2385
|
-
const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
|
|
2386
|
-
p,
|
|
2387
|
-
getTypeDependencyPackageName(p)
|
|
2388
|
-
]);
|
|
2389
|
-
const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
|
|
2390
|
-
p,
|
|
2391
|
-
getTypeDependencyPackageName(p)
|
|
2392
|
-
]);
|
|
2393
|
-
const includeDeps = devDependenciesKeys;
|
|
2394
|
-
const excludeDeps = /* @__PURE__ */ new Set([
|
|
2395
|
-
...dependenciesKeys,
|
|
2396
|
-
...peerDependenciesKeys,
|
|
2397
|
-
...externals
|
|
2398
|
-
]);
|
|
2399
|
-
const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
|
|
2400
|
-
const extractorConfig = ExtractorConfig.prepare({
|
|
2401
|
-
configObject: {
|
|
2402
|
-
projectFolder: options.projectRoot,
|
|
2403
|
-
mainEntryPointFilePath: filename,
|
|
2404
|
-
bundledPackages,
|
|
2405
|
-
compiler: {
|
|
2406
|
-
tsconfigFilePath: options.tsconfig,
|
|
2407
|
-
overrideTsconfig: {
|
|
2408
|
-
compilerOptions: {
|
|
2409
|
-
paths: {}
|
|
2410
|
-
// bug with api extract + paths
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
},
|
|
2414
|
-
dtsRollup: {
|
|
2415
|
-
enabled: true,
|
|
2416
|
-
untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
|
|
2417
|
-
},
|
|
2418
|
-
tsdocMetadata: {
|
|
2419
|
-
enabled: false
|
|
2420
|
-
}
|
|
2421
|
-
},
|
|
2422
|
-
packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
|
|
2423
|
-
configObjectFullPath: void 0
|
|
2424
|
-
});
|
|
2425
|
-
const extractorResult = Extractor.invoke(extractorConfig, {
|
|
2426
|
-
showVerboseMessages: true,
|
|
2427
|
-
localBuild: true
|
|
2428
|
-
});
|
|
2429
|
-
if (extractorResult.succeeded === false) {
|
|
2430
|
-
writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
2431
|
-
throw new Error("API Extractor completed with errors");
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
__name(bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
2435
|
-
var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
2436
|
-
name: "storm:tsc",
|
|
2437
|
-
setup(build4) {
|
|
2438
|
-
if (options.dts === false) {
|
|
2439
|
-
return;
|
|
2440
|
-
}
|
|
2441
|
-
build4.onStart(async () => {
|
|
2442
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
2443
|
-
await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
|
|
2444
|
-
}
|
|
2445
|
-
if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0]?.in && resolvedOptions.entryPoints[0].in.endsWith(".ts")) {
|
|
2446
|
-
const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
|
|
2447
|
-
const typeOutDir = resolvedOptions.outdir;
|
|
2448
|
-
const entryPoint = resolvedOptions.entryPoints[0].in.replace(sourceRoot, "").replace(/\.ts$/, "");
|
|
2449
|
-
const bundlePath = joinPaths(resolvedOptions.outdir, entryPoint);
|
|
2450
|
-
let dtsPath;
|
|
2451
|
-
if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
|
|
2452
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
|
|
2453
|
-
} else if (existsSync5(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
|
|
2454
|
-
dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
|
|
2455
|
-
}
|
|
2456
|
-
const ext = resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
|
|
2457
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
2458
|
-
bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
|
|
2459
|
-
const dtsContents = await fs3.readFile(`${bundlePath}.d.ts`, "utf8");
|
|
2460
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, dtsContents);
|
|
2461
|
-
} else {
|
|
2462
|
-
await fs3.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
});
|
|
2466
|
-
}
|
|
2467
|
-
}), "tscPlugin");
|
|
2468
|
-
function getTypeDependencyPackageName(npmPackage) {
|
|
2469
|
-
if (npmPackage.startsWith("@")) {
|
|
2470
|
-
const [scope, name] = npmPackage.split("/");
|
|
2471
|
-
return `@types/${scope?.slice(1)}__${name}`;
|
|
2472
|
-
}
|
|
2473
|
-
return `@types/${npmPackage}`;
|
|
2474
|
-
}
|
|
2475
|
-
__name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
2476
|
-
|
|
2477
2077
|
// ../esbuild/src/config.ts
|
|
2478
|
-
var getDefaultBuildPlugins = /* @__PURE__ */ __name((options, resolvedOptions) => [
|
|
2479
|
-
nodeProtocolPlugin(options, resolvedOptions),
|
|
2480
|
-
resolvePathsPlugin(options, resolvedOptions),
|
|
2481
|
-
fixImportsPlugin(options, resolvedOptions),
|
|
2482
|
-
nativeNodeModulesPlugin(options, resolvedOptions),
|
|
2483
|
-
esmSplitCodeToCjsPlugin(options, resolvedOptions),
|
|
2484
|
-
tscPlugin(options, resolvedOptions),
|
|
2485
|
-
onErrorPlugin(options, resolvedOptions)
|
|
2486
|
-
], "getDefaultBuildPlugins");
|
|
2487
2078
|
var DEFAULT_BUILD_OPTIONS = {
|
|
2079
|
+
assets: [],
|
|
2488
2080
|
platform: "node",
|
|
2489
|
-
target:
|
|
2081
|
+
target: [
|
|
2082
|
+
"esnext"
|
|
2083
|
+
],
|
|
2490
2084
|
format: "esm",
|
|
2491
|
-
external: [],
|
|
2492
|
-
logLevel: "error",
|
|
2493
2085
|
tsconfig: "tsconfig.json",
|
|
2494
2086
|
mode: "production",
|
|
2087
|
+
generatePackageJson: true,
|
|
2088
|
+
includeSrc: false,
|
|
2495
2089
|
keepNames: true,
|
|
2496
|
-
metafile:
|
|
2497
|
-
|
|
2498
|
-
|
|
2090
|
+
metafile: false,
|
|
2091
|
+
treeshake: true,
|
|
2092
|
+
shims: false,
|
|
2499
2093
|
watch: false,
|
|
2500
2094
|
bundle: true,
|
|
2501
|
-
clean: true,
|
|
2502
|
-
debug: false,
|
|
2503
|
-
resolveExtensions: [
|
|
2504
|
-
".tsx",
|
|
2505
|
-
".ts",
|
|
2506
|
-
".cts",
|
|
2507
|
-
".mts",
|
|
2508
|
-
".jsx",
|
|
2509
|
-
".js",
|
|
2510
|
-
".cjs",
|
|
2511
|
-
".mjs",
|
|
2512
|
-
".css",
|
|
2513
|
-
".json"
|
|
2514
|
-
],
|
|
2515
2095
|
loader: {
|
|
2516
2096
|
".aac": "file",
|
|
2517
2097
|
".css": "file",
|
|
@@ -2533,12 +2113,15 @@ var DEFAULT_BUILD_OPTIONS = {
|
|
|
2533
2113
|
".woff": "file",
|
|
2534
2114
|
".woff2": "file"
|
|
2535
2115
|
},
|
|
2536
|
-
banner:
|
|
2116
|
+
banner: {
|
|
2117
|
+
js: DEFAULT_COMPILED_BANNER,
|
|
2118
|
+
css: DEFAULT_COMPILED_BANNER
|
|
2119
|
+
}
|
|
2537
2120
|
};
|
|
2538
2121
|
|
|
2539
2122
|
// ../esbuild/src/plugins/deps-check.ts
|
|
2540
2123
|
import { builtinModules as builtinModules2 } from "node:module";
|
|
2541
|
-
import
|
|
2124
|
+
import path2 from "node:path";
|
|
2542
2125
|
var unusedIgnore = [
|
|
2543
2126
|
// these are our dev dependencies
|
|
2544
2127
|
/@types\/.*?/,
|
|
@@ -2570,8 +2153,8 @@ var missingIgnore = [
|
|
|
2570
2153
|
];
|
|
2571
2154
|
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
2572
2155
|
name: "storm:deps-check",
|
|
2573
|
-
setup(
|
|
2574
|
-
const pkgJsonPath =
|
|
2156
|
+
setup(build3) {
|
|
2157
|
+
const pkgJsonPath = path2.join(process.cwd(), "package.json");
|
|
2575
2158
|
const pkgContents = __require(pkgJsonPath);
|
|
2576
2159
|
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
2577
2160
|
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
@@ -2582,7 +2165,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
2582
2165
|
];
|
|
2583
2166
|
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
2584
2167
|
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
2585
|
-
|
|
2168
|
+
build3.onResolve({
|
|
2586
2169
|
filter: onlyPackages
|
|
2587
2170
|
}, (args) => {
|
|
2588
2171
|
if (args.importer.includes(process.cwd())) {
|
|
@@ -2598,7 +2181,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
2598
2181
|
external: true
|
|
2599
2182
|
};
|
|
2600
2183
|
});
|
|
2601
|
-
|
|
2184
|
+
build3.onEnd(() => {
|
|
2602
2185
|
const unusedDependencies = [
|
|
2603
2186
|
...dependencies
|
|
2604
2187
|
].filter((dep) => {
|
|
@@ -2626,391 +2209,53 @@ ${JSON.stringify(filteredMissingDeps)}
|
|
|
2626
2209
|
}
|
|
2627
2210
|
}), "depsCheckPlugin");
|
|
2628
2211
|
|
|
2629
|
-
// ../esbuild/src/renderers/shebang.ts
|
|
2630
|
-
var shebangRenderer = {
|
|
2631
|
-
name: "shebang",
|
|
2632
|
-
renderChunk(_, __, info) {
|
|
2633
|
-
if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
|
|
2634
|
-
info.mode = 493;
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
};
|
|
2638
|
-
|
|
2639
|
-
// ../esbuild/src/tsc.ts
|
|
2640
|
-
import { loadTsConfig } from "bundle-require";
|
|
2641
|
-
import defu4 from "defu";
|
|
2642
|
-
import { existsSync as existsSync6, mkdirSync, writeFileSync } from "node:fs";
|
|
2643
|
-
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join3, normalize } from "node:path";
|
|
2644
|
-
import ts from "typescript";
|
|
2645
|
-
function ensureTempDeclarationDir(workspaceConfig) {
|
|
2646
|
-
const root = workspaceConfig.directories.temp || join3(workspaceConfig.workspaceRoot, "tmp");
|
|
2647
|
-
const dirPath = join3(root, ".tsc", "declaration");
|
|
2648
|
-
if (existsSync6(dirPath)) {
|
|
2649
|
-
return dirPath;
|
|
2650
|
-
}
|
|
2651
|
-
mkdirSync(dirPath, {
|
|
2652
|
-
recursive: true
|
|
2653
|
-
});
|
|
2654
|
-
const gitIgnorePath = join3(root, ".tsc", ".gitignore");
|
|
2655
|
-
writeFileSync(gitIgnorePath, "**/*\n");
|
|
2656
|
-
return dirPath;
|
|
2657
|
-
}
|
|
2658
|
-
__name(ensureTempDeclarationDir, "ensureTempDeclarationDir");
|
|
2659
|
-
function slash(path7) {
|
|
2660
|
-
const isExtendedLengthPath = path7.startsWith("\\\\?\\");
|
|
2661
|
-
if (isExtendedLengthPath) {
|
|
2662
|
-
return path7;
|
|
2663
|
-
}
|
|
2664
|
-
return path7.replace(/\\/g, "/");
|
|
2665
|
-
}
|
|
2666
|
-
__name(slash, "slash");
|
|
2667
|
-
function toAbsolutePath(workspaceConfig, p, cwd) {
|
|
2668
|
-
if (isAbsolute2(p)) {
|
|
2669
|
-
return p;
|
|
2670
|
-
}
|
|
2671
|
-
return slash(normalize(join3(cwd || workspaceConfig.workspaceRoot, p)));
|
|
2672
|
-
}
|
|
2673
|
-
__name(toAbsolutePath, "toAbsolutePath");
|
|
2674
|
-
var AliasPool = class AliasPool2 {
|
|
2675
|
-
static {
|
|
2676
|
-
__name(this, "AliasPool");
|
|
2677
|
-
}
|
|
2678
|
-
seen = /* @__PURE__ */ new Set();
|
|
2679
|
-
assign(name) {
|
|
2680
|
-
let suffix = 0;
|
|
2681
|
-
let alias = name === "default" ? "default_alias" : name;
|
|
2682
|
-
while (this.seen.has(alias)) {
|
|
2683
|
-
alias = `${name}_alias_${++suffix}`;
|
|
2684
|
-
if (suffix >= 1e3) {
|
|
2685
|
-
throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
this.seen.add(alias);
|
|
2689
|
-
return alias;
|
|
2690
|
-
}
|
|
2691
|
-
};
|
|
2692
|
-
function getExports(workspaceConfig, program, fileMapping) {
|
|
2693
|
-
const checker = program.getTypeChecker();
|
|
2694
|
-
const aliasPool = new AliasPool();
|
|
2695
|
-
const assignAlias = aliasPool.assign.bind(aliasPool);
|
|
2696
|
-
function extractExports(sourceFileName) {
|
|
2697
|
-
const cwd = program.getCurrentDirectory();
|
|
2698
|
-
sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
|
|
2699
|
-
const sourceFile = program.getSourceFile(sourceFileName);
|
|
2700
|
-
if (!sourceFile) {
|
|
2701
|
-
return [];
|
|
2702
|
-
}
|
|
2703
|
-
const destFileName = fileMapping.get(sourceFileName);
|
|
2704
|
-
if (!destFileName) {
|
|
2705
|
-
return [];
|
|
2706
|
-
}
|
|
2707
|
-
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
2708
|
-
if (!moduleSymbol) {
|
|
2709
|
-
return [];
|
|
2710
|
-
}
|
|
2711
|
-
const exports = [];
|
|
2712
|
-
const exportSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
2713
|
-
exportSymbols.forEach((symbol) => {
|
|
2714
|
-
const name = symbol.getName();
|
|
2715
|
-
exports.push({
|
|
2716
|
-
kind: "named",
|
|
2717
|
-
sourceFileName,
|
|
2718
|
-
destFileName,
|
|
2719
|
-
name,
|
|
2720
|
-
alias: assignAlias(name),
|
|
2721
|
-
isTypeOnly: false
|
|
2722
|
-
});
|
|
2723
|
-
});
|
|
2724
|
-
return exports;
|
|
2725
|
-
}
|
|
2726
|
-
__name(extractExports, "extractExports");
|
|
2727
|
-
return program.getRootFileNames().flatMap(extractExports);
|
|
2728
|
-
}
|
|
2729
|
-
__name(getExports, "getExports");
|
|
2730
|
-
function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
|
|
2731
|
-
const fileMapping = /* @__PURE__ */ new Map();
|
|
2732
|
-
const writeFile3 = /* @__PURE__ */ __name((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
2733
|
-
const sourceFile = sourceFiles?.[0];
|
|
2734
|
-
const sourceFileName = sourceFile?.fileName;
|
|
2735
|
-
if (sourceFileName && !fileName.endsWith(".map")) {
|
|
2736
|
-
const cwd = program.getCurrentDirectory();
|
|
2737
|
-
fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
|
|
2738
|
-
}
|
|
2739
|
-
return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
2740
|
-
}, "writeFile");
|
|
2741
|
-
const emitResult = program.emit(void 0, writeFile3, void 0, emitOnlyDtsFiles, customTransformers);
|
|
2742
|
-
const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
2743
|
-
const diagnosticMessages = [];
|
|
2744
|
-
diagnostics.forEach((diagnostic) => {
|
|
2745
|
-
if (diagnostic.file) {
|
|
2746
|
-
const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
2747
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
2748
|
-
diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
2749
|
-
} else {
|
|
2750
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
2751
|
-
diagnosticMessages.push(message);
|
|
2752
|
-
}
|
|
2753
|
-
});
|
|
2754
|
-
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
2755
|
-
if (diagnosticMessage) {
|
|
2756
|
-
writeError(`Failed to emit declaration files.
|
|
2757
|
-
|
|
2758
|
-
${diagnosticMessage}`, workspaceConfig);
|
|
2759
|
-
throw new Error("TypeScript compilation failed");
|
|
2760
|
-
}
|
|
2761
|
-
return fileMapping;
|
|
2762
|
-
}
|
|
2763
|
-
__name(emitDtsFiles, "emitDtsFiles");
|
|
2764
|
-
function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
|
|
2765
|
-
const rawTsconfig = loadTsConfig(workspaceConfig.workspaceRoot, tsconfig);
|
|
2766
|
-
if (!rawTsconfig) {
|
|
2767
|
-
throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
|
|
2768
|
-
}
|
|
2769
|
-
const declarationDir = ensureTempDeclarationDir(workspaceConfig);
|
|
2770
|
-
const parsedTsconfig = ts.parseJsonConfigFileContent(defu4({
|
|
2771
|
-
compilerOptions: {
|
|
2772
|
-
// Enable declaration emit and disable javascript emit
|
|
2773
|
-
noEmit: false,
|
|
2774
|
-
declaration: true,
|
|
2775
|
-
declarationMap: true,
|
|
2776
|
-
declarationDir,
|
|
2777
|
-
emitDeclarationOnly: true
|
|
2778
|
-
}
|
|
2779
|
-
}, tsconfigRaw?.compilerOptions ?? {}, rawTsconfig.data ?? {}), ts.sys, tsconfig ? dirname2(tsconfig) : "./");
|
|
2780
|
-
const options = parsedTsconfig.options;
|
|
2781
|
-
const host = ts.createCompilerHost(options);
|
|
2782
|
-
const program = ts.createProgram(parsedTsconfig.fileNames, options, host);
|
|
2783
|
-
const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
|
|
2784
|
-
return getExports(workspaceConfig, program, fileMapping);
|
|
2785
|
-
}
|
|
2786
|
-
__name(emitDts, "emitDts");
|
|
2787
|
-
|
|
2788
|
-
// ../esbuild/src/utilities/get-entry-points.ts
|
|
2789
|
-
import { glob as glob3 } from "glob";
|
|
2790
|
-
var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
2791
|
-
const workspaceRoot3 = config.workspaceRoot || findWorkspaceRoot();
|
|
2792
|
-
const entryPoints = [];
|
|
2793
|
-
if (entry) {
|
|
2794
|
-
if (typeof entry === "string") {
|
|
2795
|
-
entryPoints.push({
|
|
2796
|
-
in: entry,
|
|
2797
|
-
out: entry
|
|
2798
|
-
});
|
|
2799
|
-
} else if (Array.isArray(entry)) {
|
|
2800
|
-
entryPoints.push(...entry.map((entry2) => ({
|
|
2801
|
-
in: entry2,
|
|
2802
|
-
out: entry2
|
|
2803
|
-
})));
|
|
2804
|
-
} else {
|
|
2805
|
-
entryPoints.push(...Object.entries(entry).map(([key, value]) => {
|
|
2806
|
-
if (typeof value === "string") {
|
|
2807
|
-
return {
|
|
2808
|
-
in: value,
|
|
2809
|
-
out: key
|
|
2810
|
-
};
|
|
2811
|
-
} else {
|
|
2812
|
-
return {
|
|
2813
|
-
in: key,
|
|
2814
|
-
out: key
|
|
2815
|
-
};
|
|
2816
|
-
}
|
|
2817
|
-
}));
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
if (emitOnAll) {
|
|
2821
|
-
entryPoints.push({
|
|
2822
|
-
in: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}"),
|
|
2823
|
-
out: joinPaths(workspaceRoot3, sourceRoot || projectRoot, "**/*.{ts,tsx}")
|
|
2824
|
-
});
|
|
2825
|
-
}
|
|
2826
|
-
const results = await Promise.all(entryPoints.map(async (entryPoint) => {
|
|
2827
|
-
const paths = [];
|
|
2828
|
-
if (entryPoint.in.includes("*")) {
|
|
2829
|
-
const files = await glob3(entryPoint.in, {
|
|
2830
|
-
withFileTypes: true,
|
|
2831
|
-
ignore: [
|
|
2832
|
-
"**/node_modules/**"
|
|
2833
|
-
]
|
|
2834
|
-
});
|
|
2835
|
-
paths.push(...files.reduce((ret, filePath) => {
|
|
2836
|
-
const result = correctPaths(joinPaths(filePath.path, filePath.name).replaceAll(correctPaths(workspaceRoot3), "").replaceAll(correctPaths(projectRoot), ""));
|
|
2837
|
-
if (result) {
|
|
2838
|
-
writeDebug(`Trying to add entry point ${result} at "${joinPaths(filePath.path, filePath.name)}"`, config);
|
|
2839
|
-
if (!paths.some((p) => p.in === result)) {
|
|
2840
|
-
paths.push({
|
|
2841
|
-
in: result,
|
|
2842
|
-
out: entryPoint.out.replace(entryPoint.in, result)
|
|
2843
|
-
});
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
return ret;
|
|
2847
|
-
}, []));
|
|
2848
|
-
} else {
|
|
2849
|
-
writeDebug(`Adding ESBuild entry point
|
|
2850
|
-
- Input: ${entryPoint.in}
|
|
2851
|
-
- Output: ${entryPoint.out}`, config);
|
|
2852
|
-
if (!paths.some((p) => p.out === entryPoint.out)) {
|
|
2853
|
-
paths.push(entryPoint);
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
return paths;
|
|
2857
|
-
}));
|
|
2858
|
-
return results.filter(Boolean).reduce((ret, result) => {
|
|
2859
|
-
result.forEach((res) => {
|
|
2860
|
-
if (res && !ret.some((p) => p.in === res.in)) {
|
|
2861
|
-
ret.push(res);
|
|
2862
|
-
}
|
|
2863
|
-
});
|
|
2864
|
-
return ret;
|
|
2865
|
-
}, []);
|
|
2866
|
-
}, "getEntryPoints");
|
|
2867
|
-
|
|
2868
|
-
// ../esbuild/src/utilities/helpers.ts
|
|
2869
|
-
function handleSync(fn) {
|
|
2870
|
-
try {
|
|
2871
|
-
return fn();
|
|
2872
|
-
} catch (error_) {
|
|
2873
|
-
return error_;
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
__name(handleSync, "handleSync");
|
|
2877
|
-
async function handleAsync(fn) {
|
|
2878
|
-
try {
|
|
2879
|
-
return await fn();
|
|
2880
|
-
} catch (error_) {
|
|
2881
|
-
return error_;
|
|
2882
|
-
}
|
|
2883
|
-
}
|
|
2884
|
-
__name(handleAsync, "handleAsync");
|
|
2885
|
-
var handle = handleSync;
|
|
2886
|
-
handle.async = handleAsync;
|
|
2887
|
-
var skip = Symbol("skip");
|
|
2888
|
-
function transduceSync(list, transformer) {
|
|
2889
|
-
const transduced = [];
|
|
2890
|
-
for (const [i, element_] of list.entries()) {
|
|
2891
|
-
const transformed = transformer(element_, i);
|
|
2892
|
-
if (transformed !== skip) {
|
|
2893
|
-
transduced[transduced.length] = transformed;
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
2896
|
-
return transduced;
|
|
2897
|
-
}
|
|
2898
|
-
__name(transduceSync, "transduceSync");
|
|
2899
|
-
async function transduceAsync(list, transformer) {
|
|
2900
|
-
const transduced = [];
|
|
2901
|
-
await Promise.all(list.entries().map(async ([i, element_]) => {
|
|
2902
|
-
const transformed = await transformer(element_, i);
|
|
2903
|
-
if (transformed !== skip) {
|
|
2904
|
-
transduced[transduced.length] = transformed;
|
|
2905
|
-
}
|
|
2906
|
-
}));
|
|
2907
|
-
return transduced;
|
|
2908
|
-
}
|
|
2909
|
-
__name(transduceAsync, "transduceAsync");
|
|
2910
|
-
var transduce = transduceSync;
|
|
2911
|
-
transduce.async = transduceAsync;
|
|
2912
|
-
function pipeSync(fn, ...fns) {
|
|
2913
|
-
return (...args) => {
|
|
2914
|
-
let result = fn(...args);
|
|
2915
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
2916
|
-
result = fns[i]?.(result);
|
|
2917
|
-
}
|
|
2918
|
-
return result;
|
|
2919
|
-
};
|
|
2920
|
-
}
|
|
2921
|
-
__name(pipeSync, "pipeSync");
|
|
2922
|
-
function pipeAsync(fn, ...fns) {
|
|
2923
|
-
return async (...args) => {
|
|
2924
|
-
let result = await fn(...args);
|
|
2925
|
-
for (let i = 0; result !== skip && i < fns.length; ++i) {
|
|
2926
|
-
result = await fns[i]?.(result);
|
|
2927
|
-
}
|
|
2928
|
-
return result;
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
__name(pipeAsync, "pipeAsync");
|
|
2932
|
-
var pipe = pipeSync;
|
|
2933
|
-
pipe.async = pipeAsync;
|
|
2934
|
-
|
|
2935
2212
|
// ../esbuild/src/build.ts
|
|
2936
|
-
|
|
2213
|
+
async function resolveContext(userOptions) {
|
|
2937
2214
|
const projectRoot = userOptions.projectRoot;
|
|
2938
2215
|
const workspaceRoot3 = findWorkspaceRoot2(projectRoot);
|
|
2939
2216
|
if (!workspaceRoot3) {
|
|
2940
2217
|
throw new Error("Cannot find Nx workspace root");
|
|
2941
2218
|
}
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2219
|
+
const workspaceConfig = await getWorkspaceConfig(true, {
|
|
2220
|
+
workspaceRoot: workspaceRoot3.dir
|
|
2221
|
+
});
|
|
2222
|
+
writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
|
|
2944
2223
|
const stopwatch = getStopwatch("Build options resolution");
|
|
2945
|
-
const projectGraph = await
|
|
2224
|
+
const projectGraph = await createProjectGraphAsync2({
|
|
2946
2225
|
exitOnError: true
|
|
2947
2226
|
});
|
|
2948
2227
|
const projectJsonPath = joinPaths(workspaceRoot3.dir, projectRoot, "project.json");
|
|
2949
|
-
if (!
|
|
2228
|
+
if (!existsSync5(projectJsonPath)) {
|
|
2950
2229
|
throw new Error("Cannot find project.json configuration");
|
|
2951
2230
|
}
|
|
2952
2231
|
const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
|
|
2953
2232
|
const projectJson = JSON.parse(projectJsonFile);
|
|
2954
|
-
const projectName = projectJson.name;
|
|
2233
|
+
const projectName = projectJson.name || userOptions.name;
|
|
2955
2234
|
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
2956
2235
|
if (!projectConfigurations?.projects?.[projectName]) {
|
|
2957
2236
|
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.");
|
|
2958
2237
|
}
|
|
2959
|
-
const options =
|
|
2238
|
+
const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
|
|
2960
2239
|
options.name ??= `${projectName}-${options.format}`;
|
|
2961
2240
|
options.target ??= DEFAULT_TARGET;
|
|
2962
2241
|
const packageJsonPath = joinPaths(workspaceRoot3.dir, options.projectRoot, "package.json");
|
|
2963
|
-
if (!
|
|
2242
|
+
if (!existsSync5(packageJsonPath)) {
|
|
2964
2243
|
throw new Error("Cannot find package.json configuration");
|
|
2965
2244
|
}
|
|
2966
2245
|
const env = getEnv("esbuild", options);
|
|
2967
|
-
const
|
|
2246
|
+
const resolvedOptions = {
|
|
2968
2247
|
...options,
|
|
2969
|
-
config,
|
|
2970
|
-
mainFields: options.platform === "node" ? [
|
|
2971
|
-
"module",
|
|
2972
|
-
"main"
|
|
2973
|
-
] : [
|
|
2974
|
-
"browser",
|
|
2975
|
-
"module",
|
|
2976
|
-
"main"
|
|
2977
|
-
],
|
|
2978
|
-
...userOptions,
|
|
2979
2248
|
tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
projectName,
|
|
2988
|
-
projectGraph,
|
|
2989
|
-
sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || joinPaths(projectRoot, "src"),
|
|
2990
|
-
minify: userOptions.minify || !userOptions.debug,
|
|
2991
|
-
verbose: userOptions.verbose || isVerbose() || userOptions.debug === true,
|
|
2992
|
-
includeSrc: userOptions.includeSrc === true,
|
|
2993
|
-
metafile: userOptions.metafile !== false,
|
|
2994
|
-
generatePackageJson: userOptions.generatePackageJson !== false,
|
|
2995
|
-
clean: userOptions.clean !== false,
|
|
2996
|
-
assets: userOptions.assets ?? [],
|
|
2997
|
-
injectShims: userOptions.injectShims !== true,
|
|
2998
|
-
bundle: userOptions.bundle !== false,
|
|
2999
|
-
keepNames: true,
|
|
3000
|
-
watch: userOptions.watch === true,
|
|
3001
|
-
footer: userOptions.footer,
|
|
3002
|
-
banner: {
|
|
3003
|
-
js: options.banner || DEFAULT_COMPILED_BANNER,
|
|
3004
|
-
css: options.banner || DEFAULT_COMPILED_BANNER
|
|
3005
|
-
},
|
|
3006
|
-
splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
|
|
3007
|
-
treeShaking: options.format === "esm",
|
|
2249
|
+
distDir: "dist",
|
|
2250
|
+
name: projectName,
|
|
2251
|
+
metafile: userOptions.mode === "development",
|
|
2252
|
+
...userOptions,
|
|
2253
|
+
clean: false,
|
|
2254
|
+
target: userOptions.target || options.target,
|
|
2255
|
+
splitting: options.format === "iife" ? false : options.treeshake === void 0 ? options.splitting : true,
|
|
3008
2256
|
env,
|
|
3009
2257
|
define: {
|
|
3010
|
-
STORM_FORMAT: JSON.stringify(options.format
|
|
3011
|
-
...options.format === "cjs" && options.injectShims ? {
|
|
3012
|
-
"import.meta.url": "importMetaUrl"
|
|
3013
|
-
} : {},
|
|
2258
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
3014
2259
|
...options.define,
|
|
3015
2260
|
...Object.keys(env || {}).reduce((res, key) => {
|
|
3016
2261
|
const value = JSON.stringify(env[key]);
|
|
@@ -3021,167 +2266,98 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
|
|
|
3021
2266
|
[`import.meta.env.${safeKey}`]: value
|
|
3022
2267
|
};
|
|
3023
2268
|
}, {})
|
|
3024
|
-
}
|
|
3025
|
-
inject: [
|
|
3026
|
-
options.format === "cjs" && options.injectShims ? joinPaths(__dirname, "../assets/cjs_shims.js") : void 0,
|
|
3027
|
-
options.format === "esm" && options.injectShims && options.platform === "node" ? joinPaths(__dirname, "../assets/esm_shims.js") : void 0
|
|
3028
|
-
].filter(Boolean)
|
|
2269
|
+
}
|
|
3029
2270
|
};
|
|
3030
|
-
result.plugins = userOptions.plugins ?? getDefaultBuildPlugins(userOptions, result);
|
|
3031
|
-
if (options.inject && Array.isArray(options.inject) && options.inject.length > 0) {
|
|
3032
|
-
result.inject = options.inject.reduce((ret, inj) => {
|
|
3033
|
-
if (inj && typeof inj === "string" && ret.includes(inj)) {
|
|
3034
|
-
ret.push(inj);
|
|
3035
|
-
}
|
|
3036
|
-
return ret;
|
|
3037
|
-
}, result.inject);
|
|
3038
|
-
}
|
|
3039
|
-
delete result.entry;
|
|
3040
|
-
delete result.outputPath;
|
|
3041
2271
|
stopwatch();
|
|
3042
|
-
return
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
2272
|
+
return {
|
|
2273
|
+
options: resolvedOptions,
|
|
2274
|
+
clean: userOptions.clean !== false,
|
|
2275
|
+
workspaceConfig,
|
|
2276
|
+
projectConfigurations,
|
|
2277
|
+
projectName,
|
|
2278
|
+
projectGraph,
|
|
2279
|
+
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
|
|
2280
|
+
outputPath: resolvedOptions.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
|
|
2281
|
+
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2284
|
+
__name(resolveContext, "resolveContext");
|
|
2285
|
+
async function generatePackageJson(context) {
|
|
2286
|
+
if (context.options.generatePackageJson !== false && existsSync5(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
2287
|
+
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
3047
2288
|
const stopwatch = getStopwatch("Write package.json file");
|
|
3048
|
-
const packageJsonPath = joinPaths(
|
|
3049
|
-
if (!
|
|
2289
|
+
const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
|
|
2290
|
+
if (!existsSync5(packageJsonPath)) {
|
|
3050
2291
|
throw new Error("Cannot find package.json configuration");
|
|
3051
2292
|
}
|
|
3052
|
-
const packageJsonFile = await hf.readFile(joinPaths(
|
|
2293
|
+
const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
|
|
3053
2294
|
let packageJson = JSON.parse(packageJsonFile);
|
|
3054
2295
|
if (!packageJson) {
|
|
3055
2296
|
throw new Error("Cannot find package.json configuration file");
|
|
3056
2297
|
}
|
|
3057
|
-
packageJson = await addPackageDependencies(
|
|
3058
|
-
packageJson = await addWorkspacePackageJsonFields(
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
2298
|
+
packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
|
|
2299
|
+
packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
|
|
2300
|
+
if (context.options.entry) {
|
|
2301
|
+
packageJson.exports ??= {};
|
|
2302
|
+
packageJson.exports["./package.json"] ??= "./package.json";
|
|
2303
|
+
packageJson.exports["."] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js`;
|
|
2304
|
+
const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
|
|
2305
|
+
for (const entryPoint of entryPoints) {
|
|
2306
|
+
if (context.options.entry[entryPoint]) {
|
|
2307
|
+
const entry = context.options.entry[entryPoint].replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
|
|
2308
|
+
packageJson.exports[`./${entry}`] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entry}.js`;
|
|
2309
|
+
}
|
|
3066
2310
|
}
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
packageJson.main = packageJson.type === "commonjs" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.cjs`;
|
|
3072
|
-
}
|
|
3073
|
-
packageJson.types = `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.d.ts`;
|
|
3074
|
-
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
3075
|
-
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
3076
|
-
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
2311
|
+
if (context.options.format === "esm") {
|
|
2312
|
+
packageJson.module = packageJson.type === "module" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.mjs`;
|
|
2313
|
+
} else {
|
|
2314
|
+
packageJson.main = packageJson.type === "commonjs" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.cjs`;
|
|
3077
2315
|
}
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
2316
|
+
packageJson.types = `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.d.ts`;
|
|
2317
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
2318
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
2319
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
2320
|
+
}
|
|
2321
|
+
return ret;
|
|
2322
|
+
}, packageJson.exports);
|
|
2323
|
+
}
|
|
2324
|
+
await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
|
|
3081
2325
|
stopwatch();
|
|
3082
2326
|
}
|
|
3083
|
-
return
|
|
2327
|
+
return context;
|
|
3084
2328
|
}
|
|
3085
2329
|
__name(generatePackageJson, "generatePackageJson");
|
|
3086
|
-
async function
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
const options = await getOptions();
|
|
3095
|
-
const rendererEngine = new RendererEngine([
|
|
3096
|
-
shebangRenderer,
|
|
3097
|
-
...options.renderers || []
|
|
3098
|
-
]);
|
|
3099
|
-
return {
|
|
3100
|
-
options,
|
|
3101
|
-
rendererEngine
|
|
3102
|
-
};
|
|
3103
|
-
}
|
|
3104
|
-
__name(generateContext, "generateContext");
|
|
3105
|
-
async function executeEsBuild(context2) {
|
|
3106
|
-
writeDebug(` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
|
|
3107
|
-
const stopwatch = getStopwatch(`${context2.options.name} build`);
|
|
3108
|
-
if (process.env.STORM_WATCH) {
|
|
3109
|
-
const ctx = await esbuild2.context(context2.options);
|
|
3110
|
-
watch(ctx, context2.options);
|
|
3111
|
-
}
|
|
3112
|
-
const options = {
|
|
3113
|
-
...context2.options
|
|
3114
|
-
};
|
|
3115
|
-
options.outdir = joinPaths(context2.options.outdir, context2.options.distDir);
|
|
3116
|
-
if (!options.inject || !Array.isArray(options.inject) || options.inject.length === 0 || // eslint-disable-next-line no-constant-binary-expression, @typescript-eslint/no-explicit-any
|
|
3117
|
-
options.inject === {}) {
|
|
3118
|
-
delete options.inject;
|
|
3119
|
-
}
|
|
3120
|
-
delete options.dts;
|
|
3121
|
-
delete options.env;
|
|
3122
|
-
delete options.name;
|
|
3123
|
-
delete options.assets;
|
|
3124
|
-
delete options.mode;
|
|
3125
|
-
delete options.orgName;
|
|
3126
|
-
delete options.watch;
|
|
3127
|
-
delete options.clean;
|
|
3128
|
-
delete options.debug;
|
|
3129
|
-
delete options.generatePackageJson;
|
|
3130
|
-
delete options.distDir;
|
|
3131
|
-
delete options.includeSrc;
|
|
3132
|
-
delete options.verbose;
|
|
3133
|
-
delete options.projectRoot;
|
|
3134
|
-
delete options.projectName;
|
|
3135
|
-
delete options.projectGraph;
|
|
3136
|
-
delete options.projectConfigurations;
|
|
3137
|
-
delete options.renderers;
|
|
3138
|
-
delete options.config;
|
|
3139
|
-
delete options.injectShims;
|
|
3140
|
-
delete options.external;
|
|
3141
|
-
writeTrace(`Run esbuild (${context2.options.name}) with the following options:
|
|
3142
|
-
${formatLogMessage({
|
|
3143
|
-
...options,
|
|
3144
|
-
define: "<Hidden>"
|
|
3145
|
-
})}`, context2.options.config);
|
|
3146
|
-
const result = await esbuild2.build(options);
|
|
3147
|
-
await esbuild2.stop();
|
|
3148
|
-
if (result.metafile) {
|
|
3149
|
-
const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
|
|
3150
|
-
await hf.writeFile(metafilePath, JSON.stringify(result.metafile));
|
|
3151
|
-
}
|
|
2330
|
+
async function executeTsup(context) {
|
|
2331
|
+
writeDebug(` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
|
|
2332
|
+
const stopwatch = getStopwatch(`${context.options.name} build`);
|
|
2333
|
+
await tsup({
|
|
2334
|
+
...context.options,
|
|
2335
|
+
outDir: context.outputPath,
|
|
2336
|
+
workspaceConfig: context.workspaceConfig
|
|
2337
|
+
});
|
|
3152
2338
|
stopwatch();
|
|
3153
|
-
return
|
|
3154
|
-
}
|
|
3155
|
-
__name(executeEsBuild, "executeEsBuild");
|
|
3156
|
-
async function executeTypescript(context2) {
|
|
3157
|
-
if (context2.result?.errors.length === 0 && context2.options.dts) {
|
|
3158
|
-
writeDebug(` \u{1F4CB} Running TypeScript Compiler for ${context2.options.name}`, context2.options.config);
|
|
3159
|
-
const stopwatch = getStopwatch(`${context2.options.name} asset copy`);
|
|
3160
|
-
await emitDts(context2.options.config, context2.options.tsconfig, context2.options.tsconfigRaw, true);
|
|
3161
|
-
stopwatch();
|
|
3162
|
-
}
|
|
3163
|
-
return context2;
|
|
2339
|
+
return context;
|
|
3164
2340
|
}
|
|
3165
|
-
__name(
|
|
3166
|
-
async function copyBuildAssets(
|
|
3167
|
-
if (
|
|
3168
|
-
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${
|
|
3169
|
-
const stopwatch = getStopwatch(`${
|
|
3170
|
-
await copyAssets(
|
|
2341
|
+
__name(executeTsup, "executeTsup");
|
|
2342
|
+
async function copyBuildAssets(context) {
|
|
2343
|
+
if (context.result?.errors.length === 0) {
|
|
2344
|
+
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`, context.workspaceConfig);
|
|
2345
|
+
const stopwatch = getStopwatch(`${context.options.name} asset copy`);
|
|
2346
|
+
await copyAssets(context.workspaceConfig, context.options.assets ?? [], context.outputPath, context.options.projectRoot, context.sourceRoot, true, false);
|
|
3171
2347
|
stopwatch();
|
|
3172
2348
|
}
|
|
3173
|
-
return
|
|
2349
|
+
return context;
|
|
3174
2350
|
}
|
|
3175
2351
|
__name(copyBuildAssets, "copyBuildAssets");
|
|
3176
|
-
async function reportResults(
|
|
3177
|
-
if (
|
|
3178
|
-
if (
|
|
3179
|
-
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${
|
|
2352
|
+
async function reportResults(context) {
|
|
2353
|
+
if (context.result?.errors.length === 0) {
|
|
2354
|
+
if (context.result.warnings.length > 0) {
|
|
2355
|
+
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
|
|
3180
2356
|
}
|
|
3181
|
-
writeSuccess(` \u{1F4E6} The ${
|
|
3182
|
-
} else if (
|
|
3183
|
-
writeError(` \u274C The ${
|
|
3184
|
-
throw new Error(`The ${
|
|
2357
|
+
writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
|
|
2358
|
+
} else if (context.result?.errors && context.result?.errors.length > 0) {
|
|
2359
|
+
writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
|
|
2360
|
+
throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
|
|
3185
2361
|
}
|
|
3186
2362
|
}
|
|
3187
2363
|
__name(reportResults, "reportResults");
|
|
@@ -3192,7 +2368,7 @@ async function dependencyCheck(options) {
|
|
|
3192
2368
|
if (process.env.CI && !process.env.BUILDKITE) {
|
|
3193
2369
|
return void 0;
|
|
3194
2370
|
}
|
|
3195
|
-
const buildPromise =
|
|
2371
|
+
const buildPromise = esbuild.build({
|
|
3196
2372
|
entryPoints: globbySync("**/*.{j,t}s", {
|
|
3197
2373
|
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
3198
2374
|
ignore: [
|
|
@@ -3215,17 +2391,17 @@ async function dependencyCheck(options) {
|
|
|
3215
2391
|
return void 0;
|
|
3216
2392
|
}
|
|
3217
2393
|
__name(dependencyCheck, "dependencyCheck");
|
|
3218
|
-
async function cleanOutputPath(
|
|
3219
|
-
if (
|
|
3220
|
-
writeDebug(` \u{1F9F9} Cleaning ${
|
|
3221
|
-
const stopwatch = getStopwatch(`${
|
|
3222
|
-
await cleanDirectories(
|
|
2394
|
+
async function cleanOutputPath(context) {
|
|
2395
|
+
if (context.clean !== false && context.outputPath) {
|
|
2396
|
+
writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
|
|
2397
|
+
const stopwatch = getStopwatch(`${context.options.name} output clean`);
|
|
2398
|
+
await cleanDirectories(context.outputPath);
|
|
3223
2399
|
stopwatch();
|
|
3224
2400
|
}
|
|
3225
|
-
return
|
|
2401
|
+
return context;
|
|
3226
2402
|
}
|
|
3227
2403
|
__name(cleanOutputPath, "cleanOutputPath");
|
|
3228
|
-
async function
|
|
2404
|
+
async function build2(options) {
|
|
3229
2405
|
writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
|
|
3230
2406
|
const stopwatch = getStopwatch("ESBuild pipeline");
|
|
3231
2407
|
try {
|
|
@@ -3235,8 +2411,15 @@ async function build3(options) {
|
|
|
3235
2411
|
if (opts.length === 0) {
|
|
3236
2412
|
throw new Error("No build options were provided");
|
|
3237
2413
|
}
|
|
3238
|
-
|
|
3239
|
-
await
|
|
2414
|
+
const context = await resolveContext(options);
|
|
2415
|
+
await cleanOutputPath(context);
|
|
2416
|
+
await Promise.all([
|
|
2417
|
+
dependencyCheck(context.options),
|
|
2418
|
+
generatePackageJson(context),
|
|
2419
|
+
copyBuildAssets(context),
|
|
2420
|
+
executeTsup(context)
|
|
2421
|
+
]);
|
|
2422
|
+
await reportResults(context);
|
|
3240
2423
|
writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
|
|
3241
2424
|
} catch (error) {
|
|
3242
2425
|
writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
|
|
@@ -3245,47 +2428,19 @@ async function build3(options) {
|
|
|
3245
2428
|
stopwatch();
|
|
3246
2429
|
}
|
|
3247
2430
|
}
|
|
3248
|
-
__name(
|
|
3249
|
-
var watch = /* @__PURE__ */ __name((context2, options) => {
|
|
3250
|
-
if (!options.watch) {
|
|
3251
|
-
return context2;
|
|
3252
|
-
}
|
|
3253
|
-
const config = {
|
|
3254
|
-
ignoreInitial: true,
|
|
3255
|
-
useFsEvents: true,
|
|
3256
|
-
ignored: [
|
|
3257
|
-
"./src/__tests__/**/*",
|
|
3258
|
-
"./package.json"
|
|
3259
|
-
]
|
|
3260
|
-
};
|
|
3261
|
-
const changeWatcher = createWatcher([
|
|
3262
|
-
"./src/**/*"
|
|
3263
|
-
], config);
|
|
3264
|
-
const fastRebuild = debounce(async () => {
|
|
3265
|
-
const timeBefore = Date.now();
|
|
3266
|
-
const rebuildResult = await handle.async(() => {
|
|
3267
|
-
return context2.rebuild();
|
|
3268
|
-
});
|
|
3269
|
-
if (rebuildResult instanceof Error) {
|
|
3270
|
-
writeError(rebuildResult.message);
|
|
3271
|
-
}
|
|
3272
|
-
writeTrace(`${Date.now() - timeBefore}ms [${options.name ?? ""}]`);
|
|
3273
|
-
}, 10);
|
|
3274
|
-
changeWatcher.on("change", fastRebuild);
|
|
3275
|
-
return void 0;
|
|
3276
|
-
}, "watch");
|
|
2431
|
+
__name(build2, "build");
|
|
3277
2432
|
|
|
3278
2433
|
// ../workspace-tools/src/executors/esbuild/executor.ts
|
|
3279
|
-
async function esbuildExecutorFn(options,
|
|
2434
|
+
async function esbuildExecutorFn(options, context, config) {
|
|
3280
2435
|
writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
|
|
3281
|
-
if (!
|
|
2436
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
3282
2437
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
3283
2438
|
}
|
|
3284
|
-
await
|
|
2439
|
+
await build2({
|
|
3285
2440
|
...options,
|
|
3286
|
-
projectRoot:
|
|
3287
|
-
|
|
3288
|
-
sourceRoot:
|
|
2441
|
+
projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
|
|
2442
|
+
name: context.projectName,
|
|
2443
|
+
sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
|
|
3289
2444
|
format: options.format,
|
|
3290
2445
|
platform: options.format
|
|
3291
2446
|
});
|
|
@@ -3313,7 +2468,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
3313
2468
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
3314
2469
|
|
|
3315
2470
|
// ../workspace-tools/src/utils/pnpm-deps-update.ts
|
|
3316
|
-
import { existsSync as
|
|
2471
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
3317
2472
|
import { readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
|
|
3318
2473
|
import { format } from "prettier";
|
|
3319
2474
|
import readYamlFile from "read-yaml-file";
|
|
@@ -3327,19 +2482,19 @@ import esBuildPlugin from "@size-limit/esbuild";
|
|
|
3327
2482
|
import esBuildWhyPlugin from "@size-limit/esbuild-why";
|
|
3328
2483
|
import filePlugin from "@size-limit/file";
|
|
3329
2484
|
import sizeLimit from "size-limit";
|
|
3330
|
-
async function sizeLimitExecutorFn(options,
|
|
3331
|
-
if (!
|
|
2485
|
+
async function sizeLimitExecutorFn(options, context, config) {
|
|
2486
|
+
if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
|
|
3332
2487
|
throw new Error("The Size-Limit process failed because the context is not valid. Please run this command from a workspace.");
|
|
3333
2488
|
}
|
|
3334
|
-
writeInfo(`\u{1F4CF} Running Size-Limit on ${
|
|
2489
|
+
writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
|
|
3335
2490
|
sizeLimit([
|
|
3336
2491
|
filePlugin,
|
|
3337
2492
|
esBuildPlugin,
|
|
3338
2493
|
esBuildWhyPlugin
|
|
3339
2494
|
], {
|
|
3340
|
-
checks: options.entry ??
|
|
2495
|
+
checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(context.projectsConfigurations.projects[context.projectName]?.root ?? "./", "src")
|
|
3341
2496
|
}).then((result) => {
|
|
3342
|
-
writeInfo(`\u{1F4CF} ${
|
|
2497
|
+
writeInfo(`\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`, config);
|
|
3343
2498
|
});
|
|
3344
2499
|
return {
|
|
3345
2500
|
success: true
|
|
@@ -3392,17 +2547,17 @@ var executor_default8 = withRunExecutor("Typia runtime validation generator", ty
|
|
|
3392
2547
|
});
|
|
3393
2548
|
|
|
3394
2549
|
// ../workspace-tools/src/executors/unbuild/executor.ts
|
|
3395
|
-
import { defu as
|
|
2550
|
+
import { defu as defu5 } from "defu";
|
|
3396
2551
|
import { createJiti } from "jiti";
|
|
3397
|
-
async function unbuildExecutorFn(options,
|
|
2552
|
+
async function unbuildExecutorFn(options, context, config) {
|
|
3398
2553
|
writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
|
|
3399
|
-
if (!
|
|
2554
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
3400
2555
|
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace root directory.");
|
|
3401
2556
|
}
|
|
3402
|
-
if (!
|
|
2557
|
+
if (!context.projectsConfigurations.projects[context.projectName].root) {
|
|
3403
2558
|
throw new Error("The Build process failed because the project root is not valid. Please run this command from a workspace root directory.");
|
|
3404
2559
|
}
|
|
3405
|
-
if (!
|
|
2560
|
+
if (!context.projectsConfigurations.projects[context.projectName].sourceRoot) {
|
|
3406
2561
|
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.");
|
|
3407
2562
|
}
|
|
3408
2563
|
const jiti = createJiti(config.workspaceRoot, {
|
|
@@ -3410,11 +2565,11 @@ async function unbuildExecutorFn(options, context2, config) {
|
|
|
3410
2565
|
interopDefault: true
|
|
3411
2566
|
});
|
|
3412
2567
|
const stormUnbuild = await jiti.import(jiti.esmResolve("@storm-software/unbuild/build"));
|
|
3413
|
-
await stormUnbuild.build(
|
|
2568
|
+
await stormUnbuild.build(defu5({
|
|
3414
2569
|
...options,
|
|
3415
|
-
projectRoot:
|
|
3416
|
-
projectName:
|
|
3417
|
-
sourceRoot:
|
|
2570
|
+
projectRoot: context.projectsConfigurations.projects[context.projectName].root,
|
|
2571
|
+
projectName: context.projectName,
|
|
2572
|
+
sourceRoot: context.projectsConfigurations.projects[context.projectName].sourceRoot,
|
|
3418
2573
|
platform: options.platform
|
|
3419
2574
|
}, {
|
|
3420
2575
|
stubOptions: {
|
|
@@ -4012,7 +3167,7 @@ var generator_default4 = withRunGenerator("TypeScript Library Creator (NodeJs Pl
|
|
|
4012
3167
|
|
|
4013
3168
|
// ../workspace-tools/src/generators/preset/generator.ts
|
|
4014
3169
|
import { addDependenciesToPackageJson as addDependenciesToPackageJson3, addProjectConfiguration as addProjectConfiguration2, formatFiles as formatFiles7, generateFiles as generateFiles4, joinPathFragments as joinPathFragments4, updateJson as updateJson2 } from "@nx/devkit";
|
|
4015
|
-
import * as
|
|
3170
|
+
import * as path3 from "node:path";
|
|
4016
3171
|
async function presetGeneratorFn(tree, options) {
|
|
4017
3172
|
const projectRoot = ".";
|
|
4018
3173
|
options.description ??= `\u26A1The ${options.namespace ? options.namespace : options.name} monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.`;
|
|
@@ -4160,7 +3315,7 @@ async function presetGeneratorFn(tree, options) {
|
|
|
4160
3315
|
};
|
|
4161
3316
|
return json;
|
|
4162
3317
|
});
|
|
4163
|
-
generateFiles4(tree,
|
|
3318
|
+
generateFiles4(tree, path3.join(__dirname, "files"), projectRoot, {
|
|
4164
3319
|
...options,
|
|
4165
3320
|
pnpmVersion,
|
|
4166
3321
|
nodeVersion
|
|
@@ -4868,27 +4023,27 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
|
|
|
4868
4023
|
|
|
4869
4024
|
// ../workspace-tools/src/utils/lock-file.ts
|
|
4870
4025
|
import { output as output2, readJsonFile, workspaceRoot as workspaceRoot2 } from "@nx/devkit";
|
|
4871
|
-
import { existsSync as
|
|
4872
|
-
import { join as
|
|
4026
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
4027
|
+
import { join as join4 } from "node:path";
|
|
4873
4028
|
import { getNpmLockfileDependencies, getNpmLockfileNodes } from "nx/src/plugins/js/lock-file/npm-parser";
|
|
4874
4029
|
import { getPnpmLockfileDependencies, getPnpmLockfileNodes } from "nx/src/plugins/js/lock-file/pnpm-parser";
|
|
4875
4030
|
import { getYarnLockfileDependencies, getYarnLockfileNodes } from "nx/src/plugins/js/lock-file/yarn-parser";
|
|
4876
4031
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
4877
4032
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
4878
4033
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
4879
|
-
var YARN_LOCK_PATH =
|
|
4880
|
-
var NPM_LOCK_PATH =
|
|
4881
|
-
var PNPM_LOCK_PATH =
|
|
4034
|
+
var YARN_LOCK_PATH = join4(workspaceRoot2, YARN_LOCK_FILE);
|
|
4035
|
+
var NPM_LOCK_PATH = join4(workspaceRoot2, NPM_LOCK_FILE);
|
|
4036
|
+
var PNPM_LOCK_PATH = join4(workspaceRoot2, PNPM_LOCK_FILE);
|
|
4882
4037
|
|
|
4883
4038
|
// ../workspace-tools/src/utils/package-helpers.ts
|
|
4884
4039
|
import { joinPathFragments as joinPathFragments6, readJsonFile as readJsonFile2 } from "@nx/devkit";
|
|
4885
|
-
import { existsSync as
|
|
4040
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
4886
4041
|
|
|
4887
4042
|
// ../workspace-tools/src/utils/plugin-helpers.ts
|
|
4888
4043
|
import { readJsonFile as readJsonFile3 } from "@nx/devkit";
|
|
4889
|
-
import
|
|
4890
|
-
import { existsSync as
|
|
4891
|
-
import { dirname
|
|
4044
|
+
import defu6 from "defu";
|
|
4045
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
4046
|
+
import { dirname, join as join5 } from "node:path";
|
|
4892
4047
|
|
|
4893
4048
|
// ../workspace-tools/src/utils/typia-transform.ts
|
|
4894
4049
|
import transform2 from "typia/lib/transform";
|