@storm-software/unbuild 0.35.0 → 0.35.2
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 -2
- package/bin/unbuild.cjs +40 -26
- package/bin/unbuild.js +40 -26
- package/dist/build.cjs +6 -7
- package/dist/build.d.cts +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.js +5 -6
- package/dist/{chunk-WI52QJ54.js → chunk-3M7GEZDL.js} +7 -8
- package/dist/{chunk-GTRAQVBF.cjs → chunk-44QVHNBQ.cjs} +36 -6
- package/dist/{chunk-TUGA3ADZ.js → chunk-KXDOKQLW.js} +36 -6
- package/dist/{chunk-UELS4AUC.js → chunk-L3WYWYD4.js} +2 -2
- package/dist/{chunk-AGJ2KZ3K.cjs → chunk-N5KR37LU.cjs} +2 -2
- package/dist/{chunk-BDHZY5E7.cjs → chunk-OD3ULBE3.cjs} +4 -4
- package/dist/{chunk-ESRR2FD2.js → chunk-RBYYB7X2.js} +4 -4
- package/dist/{chunk-HHWS7REN.js → chunk-RFEZKCMQ.js} +3 -3
- package/dist/{chunk-SEWO2Q7T.cjs → chunk-Y7PS2HJA.cjs} +3 -3
- package/dist/{chunk-NGL4NRBA.cjs → chunk-ZPWH22ZM.cjs} +7 -8
- package/dist/index.cjs +7 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -10
- package/dist/plugins/analyze.cjs +2 -2
- package/dist/plugins/analyze.d.cts +4 -2
- package/dist/plugins/analyze.d.ts +4 -2
- package/dist/plugins/analyze.js +1 -1
- package/dist/plugins/on-error.cjs +2 -2
- package/dist/plugins/on-error.d.cts +4 -2
- package/dist/plugins/on-error.d.ts +4 -2
- package/dist/plugins/on-error.js +1 -1
- package/dist/plugins/swc.cjs +1 -1
- package/dist/plugins/swc.d.cts +4 -2
- package/dist/plugins/swc.d.ts +4 -2
- package/dist/plugins/swc.js +1 -1
- package/dist/plugins/tsc.cjs +2 -2
- package/dist/plugins/tsc.d.cts +4 -2
- package/dist/plugins/tsc.d.ts +4 -2
- package/dist/plugins/tsc.js +1 -1
- package/dist/plugins/type-definitions.cjs +2 -2
- package/dist/plugins/type-definitions.d.cts +7 -2
- package/dist/plugins/type-definitions.d.ts +7 -2
- package/dist/plugins/type-definitions.js +3 -3
- package/dist/types.d.cts +47 -2
- package/dist/types.d.ts +47 -2
- package/package.json +3 -1
- package/dist/chunk-DL7OBOWN.cjs +0 -27
- package/dist/chunk-UYR662XD.js +0 -27
- package/dist/config.cjs +0 -12
- package/dist/config.d.cts +0 -8
- package/dist/config.d.ts +0 -8
- package/dist/config.js +0 -12
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -40,7 +40,6 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
40
40
|
|
|
41
41
|
<!-- START doctoc -->
|
|
42
42
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
43
|
-
|
|
44
43
|
## Table of Contents
|
|
45
44
|
|
|
46
45
|
- [Storm Unbuild Package](#storm-unbuild-package)
|
package/bin/unbuild.cjs
CHANGED
|
@@ -1502,26 +1502,26 @@ var formatBytes = /* @__PURE__ */ __name((bytes) => {
|
|
|
1502
1502
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1503
1503
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
1504
1504
|
}, "formatBytes");
|
|
1505
|
-
var analyzePlugin = /* @__PURE__ */ __name((options
|
|
1505
|
+
var analyzePlugin = /* @__PURE__ */ __name((options) => {
|
|
1506
1506
|
return {
|
|
1507
1507
|
name: "storm:analyzer",
|
|
1508
1508
|
renderChunk(source, chunk) {
|
|
1509
1509
|
const sourceBytes = formatBytes(source.length);
|
|
1510
1510
|
const fileName = chunk.fileName;
|
|
1511
|
-
writeInfo(` - ${fileName} ${sourceBytes}`,
|
|
1511
|
+
writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
|
|
1512
1512
|
}
|
|
1513
1513
|
};
|
|
1514
1514
|
}, "analyzePlugin");
|
|
1515
1515
|
|
|
1516
1516
|
// src/plugins/on-error.ts
|
|
1517
|
-
var onErrorPlugin = /* @__PURE__ */ __name((options
|
|
1517
|
+
var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
|
|
1518
1518
|
name: "storm:on-error",
|
|
1519
1519
|
buildEnd(error) {
|
|
1520
1520
|
if (error) {
|
|
1521
1521
|
writeError(`The following errors occurred during the build:
|
|
1522
1522
|
${error ? error.message : "Unknown build error"}
|
|
1523
1523
|
|
|
1524
|
-
`,
|
|
1524
|
+
`, options.config);
|
|
1525
1525
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1526
1526
|
}
|
|
1527
1527
|
},
|
|
@@ -1529,7 +1529,7 @@ ${error ? error.message : "Unknown build error"}
|
|
|
1529
1529
|
writeError(`The following errors occurred during the build:
|
|
1530
1530
|
${error ? error.message : "Unknown build error"}
|
|
1531
1531
|
|
|
1532
|
-
`,
|
|
1532
|
+
`, options.config);
|
|
1533
1533
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1534
1534
|
}
|
|
1535
1535
|
}), "onErrorPlugin");
|
|
@@ -1567,27 +1567,26 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
1567
1567
|
__name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
1568
1568
|
|
|
1569
1569
|
// src/plugins/tsc.ts
|
|
1570
|
-
var tscPlugin = /* @__PURE__ */ __name(async (options
|
|
1570
|
+
var tscPlugin = /* @__PURE__ */ __name(async (options) => {
|
|
1571
1571
|
const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
|
|
1572
|
-
const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph,
|
|
1572
|
+
const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, options.config.workspaceRoot, options.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1573
1573
|
let dependencies = result.dependencies;
|
|
1574
|
-
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc,
|
|
1574
|
+
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
|
|
1575
1575
|
if (tsLibDependency) {
|
|
1576
1576
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
1577
1577
|
dependencies.push(tsLibDependency);
|
|
1578
1578
|
}
|
|
1579
|
+
const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
|
|
1579
1580
|
return (0, import_rollup_plugin_typescript2.default)({
|
|
1580
|
-
check: options.
|
|
1581
|
-
tsconfig:
|
|
1582
|
-
tsconfigOverride:
|
|
1583
|
-
compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
|
|
1584
|
-
}
|
|
1581
|
+
check: options.declaration !== false,
|
|
1582
|
+
tsconfig: options.tsconfig,
|
|
1583
|
+
tsconfigOverride: compilerOptions
|
|
1585
1584
|
});
|
|
1586
1585
|
}, "tscPlugin");
|
|
1587
1586
|
|
|
1588
1587
|
// src/plugins/type-definitions.ts
|
|
1589
1588
|
var import_node_path5 = require("path");
|
|
1590
|
-
function
|
|
1589
|
+
function typeDefinitionsPlugin(options) {
|
|
1591
1590
|
return {
|
|
1592
1591
|
name: "storm:dts-bundle",
|
|
1593
1592
|
async generateBundle(_opts, bundle) {
|
|
@@ -1596,7 +1595,7 @@ function typeDefinitions(projectRoot) {
|
|
|
1596
1595
|
continue;
|
|
1597
1596
|
}
|
|
1598
1597
|
const hasDefaultExport = file.exports.includes("default");
|
|
1599
|
-
const entrySourceFileName = (0, import_node_path5.relative)(projectRoot, file.facadeModuleId);
|
|
1598
|
+
const entrySourceFileName = (0, import_node_path5.relative)(options.projectRoot, file.facadeModuleId);
|
|
1600
1599
|
const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
|
|
1601
1600
|
const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
|
|
1602
1601
|
const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
|
|
@@ -1614,15 +1613,7 @@ export { default } from ${relativeSourceDtsName};
|
|
|
1614
1613
|
}
|
|
1615
1614
|
};
|
|
1616
1615
|
}
|
|
1617
|
-
__name(
|
|
1618
|
-
|
|
1619
|
-
// src/config.ts
|
|
1620
|
-
var getDefaultBuildPlugins = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
|
|
1621
|
-
analyzePlugin(options, resolvedOptions),
|
|
1622
|
-
typeDefinitions(resolvedOptions.projectRoot),
|
|
1623
|
-
tscPlugin(options, resolvedOptions),
|
|
1624
|
-
onErrorPlugin(options, resolvedOptions)
|
|
1625
|
-
].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
|
|
1616
|
+
__name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
|
|
1626
1617
|
|
|
1627
1618
|
// src/build.ts
|
|
1628
1619
|
async function resolveOptions(options, config) {
|
|
@@ -1675,13 +1666,17 @@ async function resolveOptions(options, config) {
|
|
|
1675
1666
|
sourceRoot
|
|
1676
1667
|
];
|
|
1677
1668
|
const resolvedOptions = {
|
|
1669
|
+
...options,
|
|
1678
1670
|
name,
|
|
1679
1671
|
config,
|
|
1680
1672
|
projectRoot: options.projectRoot,
|
|
1681
1673
|
sourceRoot,
|
|
1682
1674
|
projectName,
|
|
1683
1675
|
tsconfig,
|
|
1676
|
+
platform: options.platform ?? "neutral",
|
|
1677
|
+
generatePackageJson: true,
|
|
1684
1678
|
clean: false,
|
|
1679
|
+
env: {},
|
|
1685
1680
|
entries: entries.reduce((ret, entry) => {
|
|
1686
1681
|
let entryPath = entry.replace(options.projectRoot, "");
|
|
1687
1682
|
while (entryPath.startsWith(".")) {
|
|
@@ -1762,6 +1757,7 @@ async function resolveOptions(options, config) {
|
|
|
1762
1757
|
sourceMap: options.sourcemap ?? !!options.debug,
|
|
1763
1758
|
splitting: options.splitting !== false,
|
|
1764
1759
|
treeShaking: options.treeShaking !== false,
|
|
1760
|
+
platform: options.platform ?? "neutral",
|
|
1765
1761
|
color: true,
|
|
1766
1762
|
logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
|
|
1767
1763
|
}
|
|
@@ -1796,9 +1792,27 @@ async function resolveOptions(options, config) {
|
|
|
1796
1792
|
opts.plugins = options.plugins;
|
|
1797
1793
|
} else {
|
|
1798
1794
|
writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
|
|
1799
|
-
opts.plugins = await
|
|
1795
|
+
opts.plugins = await Promise.all([
|
|
1796
|
+
analyzePlugin(resolvedOptions),
|
|
1797
|
+
typeDefinitionsPlugin(resolvedOptions),
|
|
1798
|
+
tscPlugin(resolvedOptions),
|
|
1799
|
+
onErrorPlugin(resolvedOptions)
|
|
1800
|
+
]);
|
|
1801
|
+
}
|
|
1802
|
+
}, "rollup:options"),
|
|
1803
|
+
"mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
|
|
1804
|
+
opts.esbuild ||= {};
|
|
1805
|
+
opts.esbuild.platform ??= resolvedOptions.platform;
|
|
1806
|
+
opts.esbuild.minify ??= resolvedOptions.minify ?? !resolvedOptions.debug;
|
|
1807
|
+
opts.esbuild.sourcemap ??= resolvedOptions.sourcemap ?? !!options.debug;
|
|
1808
|
+
if (options.loaders) {
|
|
1809
|
+
if (typeof options.loaders === "function") {
|
|
1810
|
+
opts.loaders = await Promise.resolve(options.loaders(ctx, entry, opts));
|
|
1811
|
+
} else {
|
|
1812
|
+
opts.loaders = options.loaders;
|
|
1813
|
+
}
|
|
1800
1814
|
}
|
|
1801
|
-
}, "
|
|
1815
|
+
}, "mkdist:entry:options")
|
|
1802
1816
|
};
|
|
1803
1817
|
stopwatch();
|
|
1804
1818
|
return resolvedOptions;
|
package/bin/unbuild.js
CHANGED
|
@@ -1481,26 +1481,26 @@ var formatBytes = /* @__PURE__ */ __name((bytes) => {
|
|
|
1481
1481
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1482
1482
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
1483
1483
|
}, "formatBytes");
|
|
1484
|
-
var analyzePlugin = /* @__PURE__ */ __name((options
|
|
1484
|
+
var analyzePlugin = /* @__PURE__ */ __name((options) => {
|
|
1485
1485
|
return {
|
|
1486
1486
|
name: "storm:analyzer",
|
|
1487
1487
|
renderChunk(source, chunk) {
|
|
1488
1488
|
const sourceBytes = formatBytes(source.length);
|
|
1489
1489
|
const fileName = chunk.fileName;
|
|
1490
|
-
writeInfo(` - ${fileName} ${sourceBytes}`,
|
|
1490
|
+
writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
|
|
1491
1491
|
}
|
|
1492
1492
|
};
|
|
1493
1493
|
}, "analyzePlugin");
|
|
1494
1494
|
|
|
1495
1495
|
// src/plugins/on-error.ts
|
|
1496
|
-
var onErrorPlugin = /* @__PURE__ */ __name((options
|
|
1496
|
+
var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
|
|
1497
1497
|
name: "storm:on-error",
|
|
1498
1498
|
buildEnd(error) {
|
|
1499
1499
|
if (error) {
|
|
1500
1500
|
writeError(`The following errors occurred during the build:
|
|
1501
1501
|
${error ? error.message : "Unknown build error"}
|
|
1502
1502
|
|
|
1503
|
-
`,
|
|
1503
|
+
`, options.config);
|
|
1504
1504
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1505
1505
|
}
|
|
1506
1506
|
},
|
|
@@ -1508,7 +1508,7 @@ ${error ? error.message : "Unknown build error"}
|
|
|
1508
1508
|
writeError(`The following errors occurred during the build:
|
|
1509
1509
|
${error ? error.message : "Unknown build error"}
|
|
1510
1510
|
|
|
1511
|
-
`,
|
|
1511
|
+
`, options.config);
|
|
1512
1512
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1513
1513
|
}
|
|
1514
1514
|
}), "onErrorPlugin");
|
|
@@ -1546,27 +1546,26 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
1546
1546
|
__name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
1547
1547
|
|
|
1548
1548
|
// src/plugins/tsc.ts
|
|
1549
|
-
var tscPlugin = /* @__PURE__ */ __name(async (options
|
|
1549
|
+
var tscPlugin = /* @__PURE__ */ __name(async (options) => {
|
|
1550
1550
|
const projectGraph = readCachedProjectGraph2();
|
|
1551
|
-
const result = calculateProjectBuildableDependencies2(void 0, projectGraph,
|
|
1551
|
+
const result = calculateProjectBuildableDependencies2(void 0, projectGraph, options.config.workspaceRoot, options.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1552
1552
|
let dependencies = result.dependencies;
|
|
1553
|
-
const tsLibDependency = getHelperDependency(HelperDependency.tsc,
|
|
1553
|
+
const tsLibDependency = getHelperDependency(HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
|
|
1554
1554
|
if (tsLibDependency) {
|
|
1555
1555
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
1556
1556
|
dependencies.push(tsLibDependency);
|
|
1557
1557
|
}
|
|
1558
|
+
const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
|
|
1558
1559
|
return ts2Plugin({
|
|
1559
|
-
check: options.
|
|
1560
|
-
tsconfig:
|
|
1561
|
-
tsconfigOverride:
|
|
1562
|
-
compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
|
|
1563
|
-
}
|
|
1560
|
+
check: options.declaration !== false,
|
|
1561
|
+
tsconfig: options.tsconfig,
|
|
1562
|
+
tsconfigOverride: compilerOptions
|
|
1564
1563
|
});
|
|
1565
1564
|
}, "tscPlugin");
|
|
1566
1565
|
|
|
1567
1566
|
// src/plugins/type-definitions.ts
|
|
1568
1567
|
import { relative as relative2 } from "node:path";
|
|
1569
|
-
function
|
|
1568
|
+
function typeDefinitionsPlugin(options) {
|
|
1570
1569
|
return {
|
|
1571
1570
|
name: "storm:dts-bundle",
|
|
1572
1571
|
async generateBundle(_opts, bundle) {
|
|
@@ -1575,7 +1574,7 @@ function typeDefinitions(projectRoot) {
|
|
|
1575
1574
|
continue;
|
|
1576
1575
|
}
|
|
1577
1576
|
const hasDefaultExport = file.exports.includes("default");
|
|
1578
|
-
const entrySourceFileName = relative2(projectRoot, file.facadeModuleId);
|
|
1577
|
+
const entrySourceFileName = relative2(options.projectRoot, file.facadeModuleId);
|
|
1579
1578
|
const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
|
|
1580
1579
|
const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
|
|
1581
1580
|
const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
|
|
@@ -1593,15 +1592,7 @@ export { default } from ${relativeSourceDtsName};
|
|
|
1593
1592
|
}
|
|
1594
1593
|
};
|
|
1595
1594
|
}
|
|
1596
|
-
__name(
|
|
1597
|
-
|
|
1598
|
-
// src/config.ts
|
|
1599
|
-
var getDefaultBuildPlugins = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
|
|
1600
|
-
analyzePlugin(options, resolvedOptions),
|
|
1601
|
-
typeDefinitions(resolvedOptions.projectRoot),
|
|
1602
|
-
tscPlugin(options, resolvedOptions),
|
|
1603
|
-
onErrorPlugin(options, resolvedOptions)
|
|
1604
|
-
].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
|
|
1595
|
+
__name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
|
|
1605
1596
|
|
|
1606
1597
|
// src/build.ts
|
|
1607
1598
|
async function resolveOptions(options, config) {
|
|
@@ -1654,13 +1645,17 @@ async function resolveOptions(options, config) {
|
|
|
1654
1645
|
sourceRoot
|
|
1655
1646
|
];
|
|
1656
1647
|
const resolvedOptions = {
|
|
1648
|
+
...options,
|
|
1657
1649
|
name,
|
|
1658
1650
|
config,
|
|
1659
1651
|
projectRoot: options.projectRoot,
|
|
1660
1652
|
sourceRoot,
|
|
1661
1653
|
projectName,
|
|
1662
1654
|
tsconfig,
|
|
1655
|
+
platform: options.platform ?? "neutral",
|
|
1656
|
+
generatePackageJson: true,
|
|
1663
1657
|
clean: false,
|
|
1658
|
+
env: {},
|
|
1664
1659
|
entries: entries.reduce((ret, entry) => {
|
|
1665
1660
|
let entryPath = entry.replace(options.projectRoot, "");
|
|
1666
1661
|
while (entryPath.startsWith(".")) {
|
|
@@ -1741,6 +1736,7 @@ async function resolveOptions(options, config) {
|
|
|
1741
1736
|
sourceMap: options.sourcemap ?? !!options.debug,
|
|
1742
1737
|
splitting: options.splitting !== false,
|
|
1743
1738
|
treeShaking: options.treeShaking !== false,
|
|
1739
|
+
platform: options.platform ?? "neutral",
|
|
1744
1740
|
color: true,
|
|
1745
1741
|
logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
|
|
1746
1742
|
}
|
|
@@ -1775,9 +1771,27 @@ async function resolveOptions(options, config) {
|
|
|
1775
1771
|
opts.plugins = options.plugins;
|
|
1776
1772
|
} else {
|
|
1777
1773
|
writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
|
|
1778
|
-
opts.plugins = await
|
|
1774
|
+
opts.plugins = await Promise.all([
|
|
1775
|
+
analyzePlugin(resolvedOptions),
|
|
1776
|
+
typeDefinitionsPlugin(resolvedOptions),
|
|
1777
|
+
tscPlugin(resolvedOptions),
|
|
1778
|
+
onErrorPlugin(resolvedOptions)
|
|
1779
|
+
]);
|
|
1780
|
+
}
|
|
1781
|
+
}, "rollup:options"),
|
|
1782
|
+
"mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
|
|
1783
|
+
opts.esbuild ||= {};
|
|
1784
|
+
opts.esbuild.platform ??= resolvedOptions.platform;
|
|
1785
|
+
opts.esbuild.minify ??= resolvedOptions.minify ?? !resolvedOptions.debug;
|
|
1786
|
+
opts.esbuild.sourcemap ??= resolvedOptions.sourcemap ?? !!options.debug;
|
|
1787
|
+
if (options.loaders) {
|
|
1788
|
+
if (typeof options.loaders === "function") {
|
|
1789
|
+
opts.loaders = await Promise.resolve(options.loaders(ctx, entry, opts));
|
|
1790
|
+
} else {
|
|
1791
|
+
opts.loaders = options.loaders;
|
|
1792
|
+
}
|
|
1779
1793
|
}
|
|
1780
|
-
}, "
|
|
1794
|
+
}, "mkdist:entry:options")
|
|
1781
1795
|
};
|
|
1782
1796
|
stopwatch();
|
|
1783
1797
|
return resolvedOptions;
|
package/dist/build.cjs
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk44QVHNBQcjs = require('./chunk-44QVHNBQ.cjs');
|
|
9
|
+
require('./chunk-OD3ULBE3.cjs');
|
|
9
10
|
require('./chunk-3HGUCQU6.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-AGJ2KZ3K.cjs');
|
|
14
|
-
require('./chunk-SEWO2Q7T.cjs');
|
|
11
|
+
require('./chunk-N5KR37LU.cjs');
|
|
12
|
+
require('./chunk-Y7PS2HJA.cjs');
|
|
13
|
+
require('./chunk-ZPWH22ZM.cjs');
|
|
15
14
|
require('./chunk-5FQVMM7I.cjs');
|
|
16
15
|
require('./chunk-BGYQAVKQ.cjs');
|
|
17
16
|
|
|
@@ -21,4 +20,4 @@ require('./chunk-BGYQAVKQ.cjs');
|
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
exports.build =
|
|
23
|
+
exports.build = _chunk44QVHNBQcjs.build; exports.cleanOutputPath = _chunk44QVHNBQcjs.cleanOutputPath; exports.copyBuildAssets = _chunk44QVHNBQcjs.copyBuildAssets; exports.executeUnbuild = _chunk44QVHNBQcjs.executeUnbuild; exports.generatePackageJson = _chunk44QVHNBQcjs.generatePackageJson; exports.resolveOptions = _chunk44QVHNBQcjs.resolveOptions;
|
package/dist/build.d.cts
CHANGED
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -5,13 +5,12 @@ import {
|
|
|
5
5
|
executeUnbuild,
|
|
6
6
|
generatePackageJson,
|
|
7
7
|
resolveOptions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KXDOKQLW.js";
|
|
9
|
+
import "./chunk-RBYYB7X2.js";
|
|
9
10
|
import "./chunk-2E6P5U5P.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-UELS4AUC.js";
|
|
14
|
-
import "./chunk-HHWS7REN.js";
|
|
11
|
+
import "./chunk-L3WYWYD4.js";
|
|
12
|
+
import "./chunk-RFEZKCMQ.js";
|
|
13
|
+
import "./chunk-3M7GEZDL.js";
|
|
15
14
|
import "./chunk-PLJQK2VX.js";
|
|
16
15
|
import "./chunk-3GQAWCBQ.js";
|
|
17
16
|
export {
|
|
@@ -38,21 +38,20 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
38
38
|
__name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
39
39
|
|
|
40
40
|
// src/plugins/tsc.ts
|
|
41
|
-
var tscPlugin = /* @__PURE__ */ __name(async (options
|
|
41
|
+
var tscPlugin = /* @__PURE__ */ __name(async (options) => {
|
|
42
42
|
const projectGraph = readCachedProjectGraph();
|
|
43
|
-
const result = calculateProjectBuildableDependencies(void 0, projectGraph,
|
|
43
|
+
const result = calculateProjectBuildableDependencies(void 0, projectGraph, options.config.workspaceRoot, options.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
44
44
|
let dependencies = result.dependencies;
|
|
45
|
-
const tsLibDependency = getHelperDependency(HelperDependency.tsc,
|
|
45
|
+
const tsLibDependency = getHelperDependency(HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
|
|
46
46
|
if (tsLibDependency) {
|
|
47
47
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
48
48
|
dependencies.push(tsLibDependency);
|
|
49
49
|
}
|
|
50
|
+
const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
|
|
50
51
|
return ts2Plugin({
|
|
51
|
-
check: options.
|
|
52
|
-
tsconfig:
|
|
53
|
-
tsconfigOverride:
|
|
54
|
-
compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
|
|
55
|
-
}
|
|
52
|
+
check: options.declaration !== false,
|
|
53
|
+
tsconfig: options.tsconfig,
|
|
54
|
+
tsconfigOverride: compilerOptions
|
|
56
55
|
});
|
|
57
56
|
}, "tscPlugin");
|
|
58
57
|
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkOD3ULBE3cjs = require('./chunk-OD3ULBE3.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
var _chunk3HGUCQU6cjs = require('./chunk-3HGUCQU6.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
|
-
var
|
|
9
|
+
var _chunkN5KR37LUcjs = require('./chunk-N5KR37LU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkY7PS2HJAcjs = require('./chunk-Y7PS2HJA.cjs');
|
|
7
13
|
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
|
|
16
|
+
var _chunkZPWH22ZMcjs = require('./chunk-ZPWH22ZM.cjs');
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
|
|
@@ -750,7 +757,7 @@ async function resolveOptions(options, config) {
|
|
|
750
757
|
_chunk5FQVMM7Icjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
|
|
751
758
|
const stopwatch = _chunk5FQVMM7Icjs.getStopwatch.call(void 0, "Build options resolution");
|
|
752
759
|
if (options.configPath) {
|
|
753
|
-
const configFile = await
|
|
760
|
+
const configFile = await _chunkZPWH22ZMcjs.loadConfig.call(void 0, options.configPath);
|
|
754
761
|
if (configFile) {
|
|
755
762
|
options = _defu2.default.call(void 0, options, configFile);
|
|
756
763
|
}
|
|
@@ -796,13 +803,17 @@ async function resolveOptions(options, config) {
|
|
|
796
803
|
sourceRoot
|
|
797
804
|
]));
|
|
798
805
|
const resolvedOptions = {
|
|
806
|
+
...options,
|
|
799
807
|
name,
|
|
800
808
|
config,
|
|
801
809
|
projectRoot: options.projectRoot,
|
|
802
810
|
sourceRoot,
|
|
803
811
|
projectName,
|
|
804
812
|
tsconfig,
|
|
813
|
+
platform: _nullishCoalesce(options.platform, () => ( "neutral")),
|
|
814
|
+
generatePackageJson: true,
|
|
805
815
|
clean: false,
|
|
816
|
+
env: {},
|
|
806
817
|
entries: entries.reduce((ret, entry) => {
|
|
807
818
|
let entryPath = entry.replace(options.projectRoot, "");
|
|
808
819
|
while (entryPath.startsWith(".")) {
|
|
@@ -883,6 +894,7 @@ async function resolveOptions(options, config) {
|
|
|
883
894
|
sourceMap: _nullishCoalesce(options.sourcemap, () => ( !!options.debug)),
|
|
884
895
|
splitting: options.splitting !== false,
|
|
885
896
|
treeShaking: options.treeShaking !== false,
|
|
897
|
+
platform: _nullishCoalesce(options.platform, () => ( "neutral")),
|
|
886
898
|
color: true,
|
|
887
899
|
logLevel: config.logLevel === _chunk5FQVMM7Icjs.LogLevelLabel.FATAL ? _chunk5FQVMM7Icjs.LogLevelLabel.ERROR : _chunk5FQVMM7Icjs.isVerbose.call(void 0, ) ? "verbose" : config.logLevel
|
|
888
900
|
}
|
|
@@ -901,7 +913,7 @@ async function resolveOptions(options, config) {
|
|
|
901
913
|
if (options.rollup) {
|
|
902
914
|
let rollup = {};
|
|
903
915
|
if (typeof options.rollup === "string") {
|
|
904
|
-
const rollupFile = await
|
|
916
|
+
const rollupFile = await _chunkZPWH22ZMcjs.loadConfig.call(void 0, options.rollup);
|
|
905
917
|
if (rollupFile) {
|
|
906
918
|
rollup = rollupFile;
|
|
907
919
|
}
|
|
@@ -917,9 +929,27 @@ async function resolveOptions(options, config) {
|
|
|
917
929
|
opts.plugins = options.plugins;
|
|
918
930
|
} else {
|
|
919
931
|
_chunk5FQVMM7Icjs.writeDebug.call(void 0, ` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
|
|
920
|
-
opts.plugins = await
|
|
932
|
+
opts.plugins = await Promise.all([
|
|
933
|
+
_chunkN5KR37LUcjs.analyzePlugin.call(void 0, resolvedOptions),
|
|
934
|
+
_chunkOD3ULBE3cjs.typeDefinitionsPlugin.call(void 0, resolvedOptions),
|
|
935
|
+
_chunkZPWH22ZMcjs.tscPlugin.call(void 0, resolvedOptions),
|
|
936
|
+
_chunkY7PS2HJAcjs.onErrorPlugin.call(void 0, resolvedOptions)
|
|
937
|
+
]);
|
|
938
|
+
}
|
|
939
|
+
}, "rollup:options"),
|
|
940
|
+
"mkdist:entry:options": /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (ctx, entry, opts) => {
|
|
941
|
+
opts.esbuild ||= {};
|
|
942
|
+
opts.esbuild.platform ??= resolvedOptions.platform;
|
|
943
|
+
opts.esbuild.minify ??= _nullishCoalesce(resolvedOptions.minify, () => ( !resolvedOptions.debug));
|
|
944
|
+
opts.esbuild.sourcemap ??= _nullishCoalesce(resolvedOptions.sourcemap, () => ( !!options.debug));
|
|
945
|
+
if (options.loaders) {
|
|
946
|
+
if (typeof options.loaders === "function") {
|
|
947
|
+
opts.loaders = await Promise.resolve(options.loaders(ctx, entry, opts));
|
|
948
|
+
} else {
|
|
949
|
+
opts.loaders = options.loaders;
|
|
950
|
+
}
|
|
921
951
|
}
|
|
922
|
-
}, "
|
|
952
|
+
}, "mkdist:entry:options")
|
|
923
953
|
};
|
|
924
954
|
stopwatch();
|
|
925
955
|
return resolvedOptions;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
typeDefinitionsPlugin
|
|
3
|
+
} from "./chunk-RBYYB7X2.js";
|
|
1
4
|
import {
|
|
2
5
|
cleanDirectories
|
|
3
6
|
} from "./chunk-2E6P5U5P.js";
|
|
4
7
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
analyzePlugin
|
|
9
|
+
} from "./chunk-L3WYWYD4.js";
|
|
10
|
+
import {
|
|
11
|
+
onErrorPlugin
|
|
12
|
+
} from "./chunk-RFEZKCMQ.js";
|
|
7
13
|
import {
|
|
8
|
-
loadConfig
|
|
9
|
-
|
|
14
|
+
loadConfig,
|
|
15
|
+
tscPlugin
|
|
16
|
+
} from "./chunk-3M7GEZDL.js";
|
|
10
17
|
import {
|
|
11
18
|
COLOR_KEYS,
|
|
12
19
|
LogLevel,
|
|
@@ -796,13 +803,17 @@ async function resolveOptions(options, config) {
|
|
|
796
803
|
sourceRoot
|
|
797
804
|
];
|
|
798
805
|
const resolvedOptions = {
|
|
806
|
+
...options,
|
|
799
807
|
name,
|
|
800
808
|
config,
|
|
801
809
|
projectRoot: options.projectRoot,
|
|
802
810
|
sourceRoot,
|
|
803
811
|
projectName,
|
|
804
812
|
tsconfig,
|
|
813
|
+
platform: options.platform ?? "neutral",
|
|
814
|
+
generatePackageJson: true,
|
|
805
815
|
clean: false,
|
|
816
|
+
env: {},
|
|
806
817
|
entries: entries.reduce((ret, entry) => {
|
|
807
818
|
let entryPath = entry.replace(options.projectRoot, "");
|
|
808
819
|
while (entryPath.startsWith(".")) {
|
|
@@ -883,6 +894,7 @@ async function resolveOptions(options, config) {
|
|
|
883
894
|
sourceMap: options.sourcemap ?? !!options.debug,
|
|
884
895
|
splitting: options.splitting !== false,
|
|
885
896
|
treeShaking: options.treeShaking !== false,
|
|
897
|
+
platform: options.platform ?? "neutral",
|
|
886
898
|
color: true,
|
|
887
899
|
logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
|
|
888
900
|
}
|
|
@@ -917,9 +929,27 @@ async function resolveOptions(options, config) {
|
|
|
917
929
|
opts.plugins = options.plugins;
|
|
918
930
|
} else {
|
|
919
931
|
writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
|
|
920
|
-
opts.plugins = await
|
|
932
|
+
opts.plugins = await Promise.all([
|
|
933
|
+
analyzePlugin(resolvedOptions),
|
|
934
|
+
typeDefinitionsPlugin(resolvedOptions),
|
|
935
|
+
tscPlugin(resolvedOptions),
|
|
936
|
+
onErrorPlugin(resolvedOptions)
|
|
937
|
+
]);
|
|
938
|
+
}
|
|
939
|
+
}, "rollup:options"),
|
|
940
|
+
"mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
|
|
941
|
+
opts.esbuild ||= {};
|
|
942
|
+
opts.esbuild.platform ??= resolvedOptions.platform;
|
|
943
|
+
opts.esbuild.minify ??= resolvedOptions.minify ?? !resolvedOptions.debug;
|
|
944
|
+
opts.esbuild.sourcemap ??= resolvedOptions.sourcemap ?? !!options.debug;
|
|
945
|
+
if (options.loaders) {
|
|
946
|
+
if (typeof options.loaders === "function") {
|
|
947
|
+
opts.loaders = await Promise.resolve(options.loaders(ctx, entry, opts));
|
|
948
|
+
} else {
|
|
949
|
+
opts.loaders = options.loaders;
|
|
950
|
+
}
|
|
921
951
|
}
|
|
922
|
-
}, "
|
|
952
|
+
}, "mkdist:entry:options")
|
|
923
953
|
};
|
|
924
954
|
stopwatch();
|
|
925
955
|
return resolvedOptions;
|
|
@@ -19,13 +19,13 @@ var formatBytes = /* @__PURE__ */ __name((bytes) => {
|
|
|
19
19
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
20
20
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
21
21
|
}, "formatBytes");
|
|
22
|
-
var analyzePlugin = /* @__PURE__ */ __name((options
|
|
22
|
+
var analyzePlugin = /* @__PURE__ */ __name((options) => {
|
|
23
23
|
return {
|
|
24
24
|
name: "storm:analyzer",
|
|
25
25
|
renderChunk(source, chunk) {
|
|
26
26
|
const sourceBytes = formatBytes(source.length);
|
|
27
27
|
const fileName = chunk.fileName;
|
|
28
|
-
writeInfo(` - ${fileName} ${sourceBytes}`,
|
|
28
|
+
writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}, "analyzePlugin");
|
|
@@ -19,13 +19,13 @@ var formatBytes = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (bytes)
|
|
|
19
19
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
20
20
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
21
21
|
}, "formatBytes");
|
|
22
|
-
var analyzePlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options
|
|
22
|
+
var analyzePlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options) => {
|
|
23
23
|
return {
|
|
24
24
|
name: "storm:analyzer",
|
|
25
25
|
renderChunk(source, chunk) {
|
|
26
26
|
const sourceBytes = formatBytes(source.length);
|
|
27
27
|
const fileName = chunk.fileName;
|
|
28
|
-
_chunk5FQVMM7Icjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`,
|
|
28
|
+
_chunk5FQVMM7Icjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, options.config);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}, "analyzePlugin");
|