@storm-software/unbuild 0.38.2 → 0.38.4

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 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
- [![Version](https://img.shields.io/badge/version-0.38.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.38.3-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/bin/unbuild.cjs CHANGED
@@ -1373,9 +1373,9 @@ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
1373
1373
  var import_commander = require("commander");
1374
1374
 
1375
1375
  // src/build.ts
1376
- var import_devkit4 = require("@nx/devkit");
1376
+ var import_devkit3 = require("@nx/devkit");
1377
1377
  var import_js = require("@nx/js");
1378
- var import_buildable_libs_utils4 = require("@nx/js/src/utils/buildable-libs-utils");
1378
+ var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
1379
1379
 
1380
1380
  // ../build-tools/src/plugins/swc.ts
1381
1381
  var import_core = require("@swc/core");
@@ -1590,58 +1590,6 @@ async function cleanDirectories(name = "Unbuild", directory, config) {
1590
1590
  }
1591
1591
  __name(cleanDirectories, "cleanDirectories");
1592
1592
 
1593
- // src/plugins/analyze.ts
1594
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
1595
- if (bytes === 0) return "0 Byte";
1596
- const k = 1e3;
1597
- const dm = 3;
1598
- const sizes = [
1599
- "Bytes",
1600
- "KB",
1601
- "MB",
1602
- "GB"
1603
- ];
1604
- const i = Math.floor(Math.log(bytes) / Math.log(k));
1605
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
1606
- }, "formatBytes");
1607
- var analyzePlugin = /* @__PURE__ */ __name((options) => {
1608
- return {
1609
- name: "storm:analyzer",
1610
- renderChunk(source, chunk) {
1611
- const sourceBytes = formatBytes(source.length);
1612
- const fileName = chunk.fileName;
1613
- writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
1614
- }
1615
- };
1616
- }, "analyzePlugin");
1617
-
1618
- // src/plugins/on-error.ts
1619
- var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
1620
- name: "storm:on-error",
1621
- buildEnd(error) {
1622
- if (error) {
1623
- writeError(`The following errors occurred during the build:
1624
- ${error ? error.message : "Unknown build error"}
1625
-
1626
- `, options.config);
1627
- throw new Error("Storm unbuild process failed with errors.");
1628
- }
1629
- },
1630
- renderError(error) {
1631
- writeError(`The following errors occurred during the build:
1632
- ${error ? error.message : "Unknown build error"}
1633
-
1634
- `, options.config);
1635
- throw new Error("Storm unbuild process failed with errors.");
1636
- }
1637
- }), "onErrorPlugin");
1638
-
1639
- // src/plugins/tsc.ts
1640
- var import_devkit3 = require("@nx/devkit");
1641
- var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
1642
- var import_compiler_helper_dependency = require("@nx/js/src/utils/compiler-helper-dependency");
1643
- var import_rollup_plugin_typescript2 = __toESM(require("rollup-plugin-typescript2"), 1);
1644
-
1645
1593
  // src/utilities/helpers.ts
1646
1594
  var import_devkit2 = require("@nx/devkit");
1647
1595
  var import_buildable_libs_utils2 = require("@nx/js/src/utils/buildable-libs-utils");
@@ -1655,36 +1603,6 @@ async function loadConfig2(configPath) {
1655
1603
  return import((0, import_node_url.pathToFileURL)(configPath).toString()).then((config) => config.default);
1656
1604
  }
1657
1605
  __name(loadConfig2, "loadConfig");
1658
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
1659
- const tsConfigFile = import_typescript.default.readConfigFile((0, import_devkit2.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath), import_typescript.default.sys.readFile);
1660
- const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0, import_devkit2.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath)));
1661
- const compilerOptions = {
1662
- rootDir: projectRoot,
1663
- declaration: true,
1664
- paths: (0, import_buildable_libs_utils2.computeCompilerOptionsPaths)(tsConfig, dependencies ?? [])
1665
- };
1666
- writeTrace(compilerOptions, config);
1667
- return compilerOptions;
1668
- }
1669
- __name(createTsCompilerOptions, "createTsCompilerOptions");
1670
-
1671
- // src/plugins/tsc.ts
1672
- var tscPlugin = /* @__PURE__ */ __name(async (options) => {
1673
- const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
1674
- 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);
1675
- let dependencies = result.dependencies;
1676
- const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
1677
- if (tsLibDependency) {
1678
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
1679
- dependencies.push(tsLibDependency);
1680
- }
1681
- const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
1682
- return (0, import_rollup_plugin_typescript2.default)({
1683
- check: options.declaration !== false,
1684
- tsconfig: options.tsconfig,
1685
- tsconfigOverride: compilerOptions
1686
- });
1687
- }, "tscPlugin");
1688
1606
 
1689
1607
  // src/build.ts
1690
1608
  async function resolveOptions(options, config) {
@@ -1697,7 +1615,7 @@ async function resolveOptions(options, config) {
1697
1615
  }
1698
1616
  }
1699
1617
  const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
1700
- const projectGraph = (0, import_devkit4.readCachedProjectGraph)();
1618
+ const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
1701
1619
  const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
1702
1620
  if (!(0, import_node_fs6.existsSync)(projectJsonPath)) {
1703
1621
  throw new Error("Cannot find project.json configuration");
@@ -1729,7 +1647,7 @@ async function resolveOptions(options, config) {
1729
1647
  if (!(0, import_node_fs6.existsSync)(sourceRoot)) {
1730
1648
  throw new Error("Cannot find sourceRoot directory");
1731
1649
  }
1732
- const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1650
+ const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1733
1651
  let dependencies = result.dependencies;
1734
1652
  const tsLibDependency = (0, import_js.getHelperDependency)(import_js.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
1735
1653
  if (tsLibDependency) {
@@ -1869,17 +1787,6 @@ async function resolveOptions(options, config) {
1869
1787
  }
1870
1788
  resolvedOptions.hooks = {
1871
1789
  "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
1872
- if (options.plugins && options.plugins.length > 0) {
1873
- writeDebug(` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`, config);
1874
- opts.plugins = options.plugins;
1875
- } else {
1876
- writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1877
- opts.plugins = await Promise.all([
1878
- analyzePlugin(resolvedOptions),
1879
- tscPlugin(resolvedOptions),
1880
- onErrorPlugin(resolvedOptions)
1881
- ]);
1882
- }
1883
1790
  }, "rollup:options"),
1884
1791
  "mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
1885
1792
  opts.esbuild ||= {};
@@ -1916,15 +1823,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1916
1823
  }
1917
1824
  return {
1918
1825
  import: {
1919
- types: `./dist/${entry}.d.mts`,
1826
+ types: `./dist/${entry}.d.ts`,
1920
1827
  default: `./dist/${entry}.mjs`
1921
1828
  },
1922
1829
  require: {
1923
- types: `./dist/${entry}.d.cts`,
1830
+ types: `./dist/${entry}.d.ts`,
1924
1831
  default: `./dist/${entry}.cjs`
1925
1832
  },
1926
1833
  default: {
1927
- types: `./dist/${entry}.d.mts`,
1834
+ types: `./dist/${entry}.d.ts`,
1928
1835
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1929
1836
  }
1930
1837
  };
@@ -1985,7 +1892,7 @@ async function generatePackageJson(options) {
1985
1892
  }, packageJson.exports);
1986
1893
  packageJson.exports["./package.json"] ??= "./package.json";
1987
1894
  packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot, options.projectRoot);
1988
- await (0, import_devkit4.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
1895
+ await (0, import_devkit3.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
1989
1896
  stopwatch();
1990
1897
  }
1991
1898
  return options;
package/bin/unbuild.js CHANGED
@@ -1352,9 +1352,9 @@ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
1352
1352
  import { Command, Option } from "commander";
1353
1353
 
1354
1354
  // src/build.ts
1355
- import { readCachedProjectGraph as readCachedProjectGraph3, writeJsonFile } from "@nx/devkit";
1356
- import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
1357
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
1355
+ import { readCachedProjectGraph as readCachedProjectGraph2, writeJsonFile } from "@nx/devkit";
1356
+ import { getHelperDependency, HelperDependency } from "@nx/js";
1357
+ import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
1358
1358
 
1359
1359
  // ../build-tools/src/plugins/swc.ts
1360
1360
  import { transform } from "@swc/core";
@@ -1569,58 +1569,6 @@ async function cleanDirectories(name = "Unbuild", directory, config) {
1569
1569
  }
1570
1570
  __name(cleanDirectories, "cleanDirectories");
1571
1571
 
1572
- // src/plugins/analyze.ts
1573
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
1574
- if (bytes === 0) return "0 Byte";
1575
- const k = 1e3;
1576
- const dm = 3;
1577
- const sizes = [
1578
- "Bytes",
1579
- "KB",
1580
- "MB",
1581
- "GB"
1582
- ];
1583
- const i = Math.floor(Math.log(bytes) / Math.log(k));
1584
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
1585
- }, "formatBytes");
1586
- var analyzePlugin = /* @__PURE__ */ __name((options) => {
1587
- return {
1588
- name: "storm:analyzer",
1589
- renderChunk(source, chunk) {
1590
- const sourceBytes = formatBytes(source.length);
1591
- const fileName = chunk.fileName;
1592
- writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
1593
- }
1594
- };
1595
- }, "analyzePlugin");
1596
-
1597
- // src/plugins/on-error.ts
1598
- var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
1599
- name: "storm:on-error",
1600
- buildEnd(error) {
1601
- if (error) {
1602
- writeError(`The following errors occurred during the build:
1603
- ${error ? error.message : "Unknown build error"}
1604
-
1605
- `, options.config);
1606
- throw new Error("Storm unbuild process failed with errors.");
1607
- }
1608
- },
1609
- renderError(error) {
1610
- writeError(`The following errors occurred during the build:
1611
- ${error ? error.message : "Unknown build error"}
1612
-
1613
- `, options.config);
1614
- throw new Error("Storm unbuild process failed with errors.");
1615
- }
1616
- }), "onErrorPlugin");
1617
-
1618
- // src/plugins/tsc.ts
1619
- import { readCachedProjectGraph as readCachedProjectGraph2 } from "@nx/devkit";
1620
- import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
1621
- import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
1622
- import ts2Plugin from "rollup-plugin-typescript2";
1623
-
1624
1572
  // src/utilities/helpers.ts
1625
1573
  import { joinPathFragments } from "@nx/devkit";
1626
1574
  import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
@@ -1634,36 +1582,6 @@ async function loadConfig2(configPath) {
1634
1582
  return import(pathToFileURL(configPath).toString()).then((config) => config.default);
1635
1583
  }
1636
1584
  __name(loadConfig2, "loadConfig");
1637
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
1638
- const tsConfigFile = ts.readConfigFile(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
1639
- const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath)));
1640
- const compilerOptions = {
1641
- rootDir: projectRoot,
1642
- declaration: true,
1643
- paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
1644
- };
1645
- writeTrace(compilerOptions, config);
1646
- return compilerOptions;
1647
- }
1648
- __name(createTsCompilerOptions, "createTsCompilerOptions");
1649
-
1650
- // src/plugins/tsc.ts
1651
- var tscPlugin = /* @__PURE__ */ __name(async (options) => {
1652
- const projectGraph = readCachedProjectGraph2();
1653
- 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);
1654
- let dependencies = result.dependencies;
1655
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
1656
- if (tsLibDependency) {
1657
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
1658
- dependencies.push(tsLibDependency);
1659
- }
1660
- const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
1661
- return ts2Plugin({
1662
- check: options.declaration !== false,
1663
- tsconfig: options.tsconfig,
1664
- tsconfigOverride: compilerOptions
1665
- });
1666
- }, "tscPlugin");
1667
1585
 
1668
1586
  // src/build.ts
1669
1587
  async function resolveOptions(options, config) {
@@ -1676,7 +1594,7 @@ async function resolveOptions(options, config) {
1676
1594
  }
1677
1595
  }
1678
1596
  const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
1679
- const projectGraph = readCachedProjectGraph3();
1597
+ const projectGraph = readCachedProjectGraph2();
1680
1598
  const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
1681
1599
  if (!existsSync5(projectJsonPath)) {
1682
1600
  throw new Error("Cannot find project.json configuration");
@@ -1708,9 +1626,9 @@ async function resolveOptions(options, config) {
1708
1626
  if (!existsSync5(sourceRoot)) {
1709
1627
  throw new Error("Cannot find sourceRoot directory");
1710
1628
  }
1711
- const result = calculateProjectBuildableDependencies3(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1629
+ const result = calculateProjectBuildableDependencies2(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1712
1630
  let dependencies = result.dependencies;
1713
- const tsLibDependency = getHelperDependency2(HelperDependency2.tsc, tsconfig, dependencies, projectGraph, true);
1631
+ const tsLibDependency = getHelperDependency(HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
1714
1632
  if (tsLibDependency) {
1715
1633
  dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
1716
1634
  dependencies.push(tsLibDependency);
@@ -1848,17 +1766,6 @@ async function resolveOptions(options, config) {
1848
1766
  }
1849
1767
  resolvedOptions.hooks = {
1850
1768
  "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
1851
- if (options.plugins && options.plugins.length > 0) {
1852
- writeDebug(` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`, config);
1853
- opts.plugins = options.plugins;
1854
- } else {
1855
- writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1856
- opts.plugins = await Promise.all([
1857
- analyzePlugin(resolvedOptions),
1858
- tscPlugin(resolvedOptions),
1859
- onErrorPlugin(resolvedOptions)
1860
- ]);
1861
- }
1862
1769
  }, "rollup:options"),
1863
1770
  "mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
1864
1771
  opts.esbuild ||= {};
@@ -1895,15 +1802,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1895
1802
  }
1896
1803
  return {
1897
1804
  import: {
1898
- types: `./dist/${entry}.d.mts`,
1805
+ types: `./dist/${entry}.d.ts`,
1899
1806
  default: `./dist/${entry}.mjs`
1900
1807
  },
1901
1808
  require: {
1902
- types: `./dist/${entry}.d.cts`,
1809
+ types: `./dist/${entry}.d.ts`,
1903
1810
  default: `./dist/${entry}.cjs`
1904
1811
  },
1905
1812
  default: {
1906
- types: `./dist/${entry}.d.mts`,
1813
+ types: `./dist/${entry}.d.ts`,
1907
1814
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1908
1815
  }
1909
1816
  };
package/dist/build.cjs CHANGED
@@ -5,11 +5,9 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkYUFE3NLGcjs = require('./chunk-YUFE3NLG.cjs');
8
+ var _chunkPZ266WAXcjs = require('./chunk-PZ266WAX.cjs');
9
9
  require('./chunk-WGGER7UI.cjs');
10
- require('./chunk-OOFPXPRC.cjs');
11
- require('./chunk-X25DCA4T.cjs');
12
- require('./chunk-VPCO2H3G.cjs');
10
+ require('./chunk-YC7U7HH4.cjs');
13
11
  require('./chunk-K5SEKFQA.cjs');
14
12
  require('./chunk-BGYQAVKQ.cjs');
15
13
 
@@ -19,4 +17,4 @@ require('./chunk-BGYQAVKQ.cjs');
19
17
 
20
18
 
21
19
 
22
- exports.build = _chunkYUFE3NLGcjs.build; exports.cleanOutputPath = _chunkYUFE3NLGcjs.cleanOutputPath; exports.copyBuildAssets = _chunkYUFE3NLGcjs.copyBuildAssets; exports.executeUnbuild = _chunkYUFE3NLGcjs.executeUnbuild; exports.generatePackageJson = _chunkYUFE3NLGcjs.generatePackageJson; exports.resolveOptions = _chunkYUFE3NLGcjs.resolveOptions;
20
+ exports.build = _chunkPZ266WAXcjs.build; exports.cleanOutputPath = _chunkPZ266WAXcjs.cleanOutputPath; exports.copyBuildAssets = _chunkPZ266WAXcjs.copyBuildAssets; exports.executeUnbuild = _chunkPZ266WAXcjs.executeUnbuild; exports.generatePackageJson = _chunkPZ266WAXcjs.generatePackageJson; exports.resolveOptions = _chunkPZ266WAXcjs.resolveOptions;
package/dist/build.js CHANGED
@@ -5,11 +5,9 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-HIBMLCH5.js";
8
+ } from "./chunk-LPAU53JZ.js";
9
9
  import "./chunk-JLKMLDBA.js";
10
- import "./chunk-5XTPDLOE.js";
11
- import "./chunk-2FX3WQNK.js";
12
- import "./chunk-IYFBAI6G.js";
10
+ import "./chunk-QOHGN7PS.js";
13
11
  import "./chunk-EJVOWVIQ.js";
14
12
  import "./chunk-3GQAWCBQ.js";
15
13
  export {
@@ -2,15 +2,8 @@ import {
2
2
  cleanDirectories
3
3
  } from "./chunk-JLKMLDBA.js";
4
4
  import {
5
- analyzePlugin
6
- } from "./chunk-5XTPDLOE.js";
7
- import {
8
- onErrorPlugin
9
- } from "./chunk-2FX3WQNK.js";
10
- import {
11
- loadConfig,
12
- tscPlugin
13
- } from "./chunk-IYFBAI6G.js";
5
+ loadConfig
6
+ } from "./chunk-QOHGN7PS.js";
14
7
  import {
15
8
  COLOR_KEYS,
16
9
  LogLevel,
@@ -996,17 +989,6 @@ async function resolveOptions(options, config) {
996
989
  }
997
990
  resolvedOptions.hooks = {
998
991
  "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
999
- if (options.plugins && options.plugins.length > 0) {
1000
- writeDebug(` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`, config);
1001
- opts.plugins = options.plugins;
1002
- } else {
1003
- writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1004
- opts.plugins = await Promise.all([
1005
- analyzePlugin(resolvedOptions),
1006
- tscPlugin(resolvedOptions),
1007
- onErrorPlugin(resolvedOptions)
1008
- ]);
1009
- }
1010
992
  }, "rollup:options"),
1011
993
  "mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
1012
994
  opts.esbuild ||= {};
@@ -1043,15 +1025,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1043
1025
  }
1044
1026
  return {
1045
1027
  import: {
1046
- types: `./dist/${entry}.d.mts`,
1028
+ types: `./dist/${entry}.d.ts`,
1047
1029
  default: `./dist/${entry}.mjs`
1048
1030
  },
1049
1031
  require: {
1050
- types: `./dist/${entry}.d.cts`,
1032
+ types: `./dist/${entry}.d.ts`,
1051
1033
  default: `./dist/${entry}.cjs`
1052
1034
  },
1053
1035
  default: {
1054
- types: `./dist/${entry}.d.mts`,
1036
+ types: `./dist/${entry}.d.ts`,
1055
1037
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1056
1038
  }
1057
1039
  };
@@ -3,14 +3,7 @@
3
3
  var _chunkWGGER7UIcjs = require('./chunk-WGGER7UI.cjs');
4
4
 
5
5
 
6
- var _chunkOOFPXPRCcjs = require('./chunk-OOFPXPRC.cjs');
7
-
8
-
9
- var _chunkX25DCA4Tcjs = require('./chunk-X25DCA4T.cjs');
10
-
11
-
12
-
13
- var _chunkVPCO2H3Gcjs = require('./chunk-VPCO2H3G.cjs');
6
+ var _chunkYC7U7HH4cjs = require('./chunk-YC7U7HH4.cjs');
14
7
 
15
8
 
16
9
 
@@ -818,7 +811,7 @@ async function resolveOptions(options, config) {
818
811
  _chunkK5SEKFQAcjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
819
812
  const stopwatch = _chunkK5SEKFQAcjs.getStopwatch.call(void 0, "Build options resolution");
820
813
  if (options.configPath) {
821
- const configFile = await _chunkVPCO2H3Gcjs.loadConfig.call(void 0, options.configPath);
814
+ const configFile = await _chunkYC7U7HH4cjs.loadConfig.call(void 0, options.configPath);
822
815
  if (configFile) {
823
816
  options = _defu2.default.call(void 0, options, configFile);
824
817
  }
@@ -985,7 +978,7 @@ async function resolveOptions(options, config) {
985
978
  if (options.rollup) {
986
979
  let rollup = {};
987
980
  if (typeof options.rollup === "string") {
988
- const rollupFile = await _chunkVPCO2H3Gcjs.loadConfig.call(void 0, options.rollup);
981
+ const rollupFile = await _chunkYC7U7HH4cjs.loadConfig.call(void 0, options.rollup);
989
982
  if (rollupFile) {
990
983
  rollup = rollupFile;
991
984
  }
@@ -996,17 +989,6 @@ async function resolveOptions(options, config) {
996
989
  }
997
990
  resolvedOptions.hooks = {
998
991
  "rollup:options": /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (ctx, opts) => {
999
- if (options.plugins && options.plugins.length > 0) {
1000
- _chunkK5SEKFQAcjs.writeDebug.call(void 0, ` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`, config);
1001
- opts.plugins = options.plugins;
1002
- } else {
1003
- _chunkK5SEKFQAcjs.writeDebug.call(void 0, ` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1004
- opts.plugins = await Promise.all([
1005
- _chunkOOFPXPRCcjs.analyzePlugin.call(void 0, resolvedOptions),
1006
- _chunkVPCO2H3Gcjs.tscPlugin.call(void 0, resolvedOptions),
1007
- _chunkX25DCA4Tcjs.onErrorPlugin.call(void 0, resolvedOptions)
1008
- ]);
1009
- }
1010
992
  }, "rollup:options"),
1011
993
  "mkdist:entry:options": /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (ctx, entry, opts) => {
1012
994
  opts.esbuild ||= {};
@@ -1043,15 +1025,15 @@ var addPackageJsonExport = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0,
1043
1025
  }
1044
1026
  return {
1045
1027
  import: {
1046
- types: `./dist/${entry}.d.mts`,
1028
+ types: `./dist/${entry}.d.ts`,
1047
1029
  default: `./dist/${entry}.mjs`
1048
1030
  },
1049
1031
  require: {
1050
- types: `./dist/${entry}.d.cts`,
1032
+ types: `./dist/${entry}.d.ts`,
1051
1033
  default: `./dist/${entry}.cjs`
1052
1034
  },
1053
1035
  default: {
1054
- types: `./dist/${entry}.d.mts`,
1036
+ types: `./dist/${entry}.d.ts`,
1055
1037
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1056
1038
  }
1057
1039
  };
@@ -0,0 +1,37 @@
1
+ import {
2
+ writeTrace
3
+ } from "./chunk-EJVOWVIQ.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-3GQAWCBQ.js";
7
+
8
+ // src/utilities/helpers.ts
9
+ import { joinPathFragments } from "@nx/devkit";
10
+ import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
11
+ import { dirname, extname } from "node:path";
12
+ import { pathToFileURL } from "node:url";
13
+ import ts from "typescript";
14
+ async function loadConfig(configPath) {
15
+ if (!/\.(js|mjs)$/.test(extname(configPath))) {
16
+ throw new Error("Unsupported config file format");
17
+ }
18
+ return import(pathToFileURL(configPath).toString()).then((config) => config.default);
19
+ }
20
+ __name(loadConfig, "loadConfig");
21
+ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
22
+ const tsConfigFile = ts.readConfigFile(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
23
+ const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath)));
24
+ const compilerOptions = {
25
+ rootDir: projectRoot,
26
+ declaration: true,
27
+ paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
28
+ };
29
+ writeTrace(compilerOptions, config);
30
+ return compilerOptions;
31
+ }
32
+ __name(createTsCompilerOptions, "createTsCompilerOptions");
33
+
34
+ export {
35
+ loadConfig,
36
+ createTsCompilerOptions
37
+ };
@@ -5,15 +5,9 @@ var _chunkK5SEKFQAcjs = require('./chunk-K5SEKFQA.cjs');
5
5
 
6
6
  var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
7
7
 
8
- // src/plugins/tsc.ts
8
+ // src/utilities/helpers.ts
9
9
  var _devkit = require('@nx/devkit');
10
10
  var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
11
- var _compilerhelperdependency = require('@nx/js/src/utils/compiler-helper-dependency');
12
- var _rollupplugintypescript2 = require('rollup-plugin-typescript2'); var _rollupplugintypescript22 = _interopRequireDefault(_rollupplugintypescript2);
13
-
14
- // src/utilities/helpers.ts
15
-
16
-
17
11
  var _path = require('path');
18
12
  var _url = require('url');
19
13
  var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
@@ -37,26 +31,7 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
37
31
  }
38
32
  _chunkBGYQAVKQcjs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
39
33
 
40
- // src/plugins/tsc.ts
41
- var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (options) => {
42
- const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
43
- const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, options.config.workspaceRoot, options.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
44
- let dependencies = result.dependencies;
45
- const tsLibDependency = _compilerhelperdependency.getHelperDependency.call(void 0, _compilerhelperdependency.HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
46
- if (tsLibDependency) {
47
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
48
- dependencies.push(tsLibDependency);
49
- }
50
- const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
51
- return _rollupplugintypescript22.default.call(void 0, {
52
- check: options.declaration !== false,
53
- tsconfig: options.tsconfig,
54
- tsconfigOverride: compilerOptions
55
- });
56
- }, "tscPlugin");
57
-
58
-
59
34
 
60
35
 
61
36
 
62
- exports.loadConfig = loadConfig; exports.createTsCompilerOptions = createTsCompilerOptions; exports.tscPlugin = tscPlugin;
37
+ exports.loadConfig = loadConfig; exports.createTsCompilerOptions = createTsCompilerOptions;
package/dist/index.cjs CHANGED
@@ -5,18 +5,16 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkYUFE3NLGcjs = require('./chunk-YUFE3NLG.cjs');
8
+ var _chunkPZ266WAXcjs = require('./chunk-PZ266WAX.cjs');
9
9
 
10
10
 
11
11
 
12
12
  var _chunkWGGER7UIcjs = require('./chunk-WGGER7UI.cjs');
13
13
  require('./chunk-ORA4UQMU.cjs');
14
- require('./chunk-OOFPXPRC.cjs');
15
- require('./chunk-X25DCA4T.cjs');
16
14
 
17
15
 
18
16
 
19
- var _chunkVPCO2H3Gcjs = require('./chunk-VPCO2H3G.cjs');
17
+ var _chunkYC7U7HH4cjs = require('./chunk-YC7U7HH4.cjs');
20
18
  require('./chunk-K5SEKFQA.cjs');
21
19
  require('./chunk-BGYQAVKQ.cjs');
22
20
 
@@ -30,4 +28,4 @@ require('./chunk-BGYQAVKQ.cjs');
30
28
 
31
29
 
32
30
 
33
- exports.build = _chunkYUFE3NLGcjs.build; exports.clean = _chunkWGGER7UIcjs.clean; exports.cleanDirectories = _chunkWGGER7UIcjs.cleanDirectories; exports.cleanOutputPath = _chunkYUFE3NLGcjs.cleanOutputPath; exports.copyBuildAssets = _chunkYUFE3NLGcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkVPCO2H3Gcjs.createTsCompilerOptions; exports.executeUnbuild = _chunkYUFE3NLGcjs.executeUnbuild; exports.generatePackageJson = _chunkYUFE3NLGcjs.generatePackageJson; exports.loadConfig = _chunkVPCO2H3Gcjs.loadConfig; exports.resolveOptions = _chunkYUFE3NLGcjs.resolveOptions;
31
+ exports.build = _chunkPZ266WAXcjs.build; exports.clean = _chunkWGGER7UIcjs.clean; exports.cleanDirectories = _chunkWGGER7UIcjs.cleanDirectories; exports.cleanOutputPath = _chunkPZ266WAXcjs.cleanOutputPath; exports.copyBuildAssets = _chunkPZ266WAXcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkYC7U7HH4cjs.createTsCompilerOptions; exports.executeUnbuild = _chunkPZ266WAXcjs.executeUnbuild; exports.generatePackageJson = _chunkPZ266WAXcjs.generatePackageJson; exports.loadConfig = _chunkYC7U7HH4cjs.loadConfig; exports.resolveOptions = _chunkPZ266WAXcjs.resolveOptions;
package/dist/index.js CHANGED
@@ -5,18 +5,16 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-HIBMLCH5.js";
8
+ } from "./chunk-LPAU53JZ.js";
9
9
  import {
10
10
  clean,
11
11
  cleanDirectories
12
12
  } from "./chunk-JLKMLDBA.js";
13
13
  import "./chunk-OULCUN6I.js";
14
- import "./chunk-5XTPDLOE.js";
15
- import "./chunk-2FX3WQNK.js";
16
14
  import {
17
15
  createTsCompilerOptions,
18
16
  loadConfig
19
- } from "./chunk-IYFBAI6G.js";
17
+ } from "./chunk-QOHGN7PS.js";
20
18
  import "./chunk-EJVOWVIQ.js";
21
19
  import "./chunk-3GQAWCBQ.js";
22
20
  export {
@@ -1,8 +1,34 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOOFPXPRCcjs = require('../chunk-OOFPXPRC.cjs');
4
- require('../chunk-K5SEKFQA.cjs');
5
- require('../chunk-BGYQAVKQ.cjs');
3
+ var _chunkK5SEKFQAcjs = require('../chunk-K5SEKFQA.cjs');
6
4
 
7
5
 
8
- exports.analyzePlugin = _chunkOOFPXPRCcjs.analyzePlugin;
6
+ var _chunkBGYQAVKQcjs = require('../chunk-BGYQAVKQ.cjs');
7
+
8
+ // src/plugins/analyze.ts
9
+ var formatBytes = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (bytes) => {
10
+ if (bytes === 0) return "0 Byte";
11
+ const k = 1e3;
12
+ const dm = 3;
13
+ const sizes = [
14
+ "Bytes",
15
+ "KB",
16
+ "MB",
17
+ "GB"
18
+ ];
19
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
20
+ return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
21
+ }, "formatBytes");
22
+ var analyzePlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options) => {
23
+ return {
24
+ name: "storm:analyzer",
25
+ renderChunk(source, chunk) {
26
+ const sourceBytes = formatBytes(source.length);
27
+ const fileName = chunk.fileName;
28
+ _chunkK5SEKFQAcjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, options.config);
29
+ }
30
+ };
31
+ }, "analyzePlugin");
32
+
33
+
34
+ exports.analyzePlugin = analyzePlugin;
@@ -1,8 +1,34 @@
1
1
  import {
2
- analyzePlugin
3
- } from "../chunk-5XTPDLOE.js";
4
- import "../chunk-EJVOWVIQ.js";
5
- import "../chunk-3GQAWCBQ.js";
2
+ writeInfo
3
+ } from "../chunk-EJVOWVIQ.js";
4
+ import {
5
+ __name
6
+ } from "../chunk-3GQAWCBQ.js";
7
+
8
+ // src/plugins/analyze.ts
9
+ var formatBytes = /* @__PURE__ */ __name((bytes) => {
10
+ if (bytes === 0) return "0 Byte";
11
+ const k = 1e3;
12
+ const dm = 3;
13
+ const sizes = [
14
+ "Bytes",
15
+ "KB",
16
+ "MB",
17
+ "GB"
18
+ ];
19
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
20
+ return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
21
+ }, "formatBytes");
22
+ var analyzePlugin = /* @__PURE__ */ __name((options) => {
23
+ return {
24
+ name: "storm:analyzer",
25
+ renderChunk(source, chunk) {
26
+ const sourceBytes = formatBytes(source.length);
27
+ const fileName = chunk.fileName;
28
+ writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
29
+ }
30
+ };
31
+ }, "analyzePlugin");
6
32
  export {
7
33
  analyzePlugin
8
34
  };
@@ -1,8 +1,30 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkX25DCA4Tcjs = require('../chunk-X25DCA4T.cjs');
4
- require('../chunk-K5SEKFQA.cjs');
5
- require('../chunk-BGYQAVKQ.cjs');
3
+ var _chunkK5SEKFQAcjs = require('../chunk-K5SEKFQA.cjs');
6
4
 
7
5
 
8
- exports.onErrorPlugin = _chunkX25DCA4Tcjs.onErrorPlugin;
6
+ var _chunkBGYQAVKQcjs = require('../chunk-BGYQAVKQ.cjs');
7
+
8
+ // src/plugins/on-error.ts
9
+ var onErrorPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options) => ({
10
+ name: "storm:on-error",
11
+ buildEnd(error) {
12
+ if (error) {
13
+ _chunkK5SEKFQAcjs.writeError.call(void 0, `The following errors occurred during the build:
14
+ ${error ? error.message : "Unknown build error"}
15
+
16
+ `, options.config);
17
+ throw new Error("Storm unbuild process failed with errors.");
18
+ }
19
+ },
20
+ renderError(error) {
21
+ _chunkK5SEKFQAcjs.writeError.call(void 0, `The following errors occurred during the build:
22
+ ${error ? error.message : "Unknown build error"}
23
+
24
+ `, options.config);
25
+ throw new Error("Storm unbuild process failed with errors.");
26
+ }
27
+ }), "onErrorPlugin");
28
+
29
+
30
+ exports.onErrorPlugin = onErrorPlugin;
@@ -1,8 +1,30 @@
1
1
  import {
2
- onErrorPlugin
3
- } from "../chunk-2FX3WQNK.js";
4
- import "../chunk-EJVOWVIQ.js";
5
- import "../chunk-3GQAWCBQ.js";
2
+ writeError
3
+ } from "../chunk-EJVOWVIQ.js";
4
+ import {
5
+ __name
6
+ } from "../chunk-3GQAWCBQ.js";
7
+
8
+ // src/plugins/on-error.ts
9
+ var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
10
+ name: "storm:on-error",
11
+ buildEnd(error) {
12
+ if (error) {
13
+ writeError(`The following errors occurred during the build:
14
+ ${error ? error.message : "Unknown build error"}
15
+
16
+ `, options.config);
17
+ throw new Error("Storm unbuild process failed with errors.");
18
+ }
19
+ },
20
+ renderError(error) {
21
+ writeError(`The following errors occurred during the build:
22
+ ${error ? error.message : "Unknown build error"}
23
+
24
+ `, options.config);
25
+ throw new Error("Storm unbuild process failed with errors.");
26
+ }
27
+ }), "onErrorPlugin");
6
28
  export {
7
29
  onErrorPlugin
8
30
  };
@@ -1,8 +1,32 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkVPCO2H3Gcjs = require('../chunk-VPCO2H3G.cjs');
3
+ var _chunkYC7U7HH4cjs = require('../chunk-YC7U7HH4.cjs');
4
4
  require('../chunk-K5SEKFQA.cjs');
5
- require('../chunk-BGYQAVKQ.cjs');
6
5
 
7
6
 
8
- exports.tscPlugin = _chunkVPCO2H3Gcjs.tscPlugin;
7
+ var _chunkBGYQAVKQcjs = require('../chunk-BGYQAVKQ.cjs');
8
+
9
+ // src/plugins/tsc.ts
10
+ var _devkit = require('@nx/devkit');
11
+ var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
12
+ var _compilerhelperdependency = require('@nx/js/src/utils/compiler-helper-dependency');
13
+ var _rollupplugintypescript2 = require('rollup-plugin-typescript2'); var _rollupplugintypescript22 = _interopRequireDefault(_rollupplugintypescript2);
14
+ var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (options) => {
15
+ const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
16
+ const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, options.config.workspaceRoot, options.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
17
+ let dependencies = result.dependencies;
18
+ const tsLibDependency = _compilerhelperdependency.getHelperDependency.call(void 0, _compilerhelperdependency.HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
19
+ if (tsLibDependency) {
20
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
21
+ dependencies.push(tsLibDependency);
22
+ }
23
+ const compilerOptions = await _chunkYC7U7HH4cjs.createTsCompilerOptions.call(void 0, options.config, options.tsconfig, options.projectRoot, dependencies);
24
+ return _rollupplugintypescript22.default.call(void 0, {
25
+ check: options.declaration !== false,
26
+ tsconfig: options.tsconfig,
27
+ tsconfigOverride: compilerOptions
28
+ });
29
+ }, "tscPlugin");
30
+
31
+
32
+ exports.tscPlugin = tscPlugin;
@@ -1,8 +1,32 @@
1
1
  import {
2
- tscPlugin
3
- } from "../chunk-IYFBAI6G.js";
2
+ createTsCompilerOptions
3
+ } from "../chunk-QOHGN7PS.js";
4
4
  import "../chunk-EJVOWVIQ.js";
5
- import "../chunk-3GQAWCBQ.js";
5
+ import {
6
+ __name
7
+ } from "../chunk-3GQAWCBQ.js";
8
+
9
+ // src/plugins/tsc.ts
10
+ import { readCachedProjectGraph } from "@nx/devkit";
11
+ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
12
+ import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
13
+ import ts2Plugin from "rollup-plugin-typescript2";
14
+ var tscPlugin = /* @__PURE__ */ __name(async (options) => {
15
+ const projectGraph = readCachedProjectGraph();
16
+ 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);
17
+ let dependencies = result.dependencies;
18
+ const tsLibDependency = getHelperDependency(HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
19
+ if (tsLibDependency) {
20
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
21
+ dependencies.push(tsLibDependency);
22
+ }
23
+ const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
24
+ return ts2Plugin({
25
+ check: options.declaration !== false,
26
+ tsconfig: options.tsconfig,
27
+ tsconfigOverride: compilerOptions
28
+ });
29
+ }, "tscPlugin");
6
30
  export {
7
31
  tscPlugin
8
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/unbuild",
3
- "version": "0.38.2",
3
+ "version": "0.38.4",
4
4
  "type": "module",
5
5
  "description": "A package containing `unbuild` utilities for building Storm Software libraries and applications",
6
6
  "repository": {
@@ -1,31 +0,0 @@
1
- import {
2
- writeError
3
- } from "./chunk-EJVOWVIQ.js";
4
- import {
5
- __name
6
- } from "./chunk-3GQAWCBQ.js";
7
-
8
- // src/plugins/on-error.ts
9
- var onErrorPlugin = /* @__PURE__ */ __name((options) => ({
10
- name: "storm:on-error",
11
- buildEnd(error) {
12
- if (error) {
13
- writeError(`The following errors occurred during the build:
14
- ${error ? error.message : "Unknown build error"}
15
-
16
- `, options.config);
17
- throw new Error("Storm unbuild process failed with errors.");
18
- }
19
- },
20
- renderError(error) {
21
- writeError(`The following errors occurred during the build:
22
- ${error ? error.message : "Unknown build error"}
23
-
24
- `, options.config);
25
- throw new Error("Storm unbuild process failed with errors.");
26
- }
27
- }), "onErrorPlugin");
28
-
29
- export {
30
- onErrorPlugin
31
- };
@@ -1,35 +0,0 @@
1
- import {
2
- writeInfo
3
- } from "./chunk-EJVOWVIQ.js";
4
- import {
5
- __name
6
- } from "./chunk-3GQAWCBQ.js";
7
-
8
- // src/plugins/analyze.ts
9
- var formatBytes = /* @__PURE__ */ __name((bytes) => {
10
- if (bytes === 0) return "0 Byte";
11
- const k = 1e3;
12
- const dm = 3;
13
- const sizes = [
14
- "Bytes",
15
- "KB",
16
- "MB",
17
- "GB"
18
- ];
19
- const i = Math.floor(Math.log(bytes) / Math.log(k));
20
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
21
- }, "formatBytes");
22
- var analyzePlugin = /* @__PURE__ */ __name((options) => {
23
- return {
24
- name: "storm:analyzer",
25
- renderChunk(source, chunk) {
26
- const sourceBytes = formatBytes(source.length);
27
- const fileName = chunk.fileName;
28
- writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
29
- }
30
- };
31
- }, "analyzePlugin");
32
-
33
- export {
34
- analyzePlugin
35
- };
@@ -1,62 +0,0 @@
1
- import {
2
- writeTrace
3
- } from "./chunk-EJVOWVIQ.js";
4
- import {
5
- __name
6
- } from "./chunk-3GQAWCBQ.js";
7
-
8
- // src/plugins/tsc.ts
9
- import { readCachedProjectGraph } from "@nx/devkit";
10
- import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
11
- import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
12
- import ts2Plugin from "rollup-plugin-typescript2";
13
-
14
- // src/utilities/helpers.ts
15
- import { joinPathFragments } from "@nx/devkit";
16
- import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
17
- import { dirname, extname } from "node:path";
18
- import { pathToFileURL } from "node:url";
19
- import ts from "typescript";
20
- async function loadConfig(configPath) {
21
- if (!/\.(js|mjs)$/.test(extname(configPath))) {
22
- throw new Error("Unsupported config file format");
23
- }
24
- return import(pathToFileURL(configPath).toString()).then((config) => config.default);
25
- }
26
- __name(loadConfig, "loadConfig");
27
- async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
28
- const tsConfigFile = ts.readConfigFile(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
29
- const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath)));
30
- const compilerOptions = {
31
- rootDir: projectRoot,
32
- declaration: true,
33
- paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
34
- };
35
- writeTrace(compilerOptions, config);
36
- return compilerOptions;
37
- }
38
- __name(createTsCompilerOptions, "createTsCompilerOptions");
39
-
40
- // src/plugins/tsc.ts
41
- var tscPlugin = /* @__PURE__ */ __name(async (options) => {
42
- const projectGraph = readCachedProjectGraph();
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
- let dependencies = result.dependencies;
45
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
46
- if (tsLibDependency) {
47
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
48
- dependencies.push(tsLibDependency);
49
- }
50
- const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
51
- return ts2Plugin({
52
- check: options.declaration !== false,
53
- tsconfig: options.tsconfig,
54
- tsconfigOverride: compilerOptions
55
- });
56
- }, "tscPlugin");
57
-
58
- export {
59
- loadConfig,
60
- createTsCompilerOptions,
61
- tscPlugin
62
- };
@@ -1,35 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkK5SEKFQAcjs = require('./chunk-K5SEKFQA.cjs');
4
-
5
-
6
- var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
7
-
8
- // src/plugins/analyze.ts
9
- var formatBytes = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (bytes) => {
10
- if (bytes === 0) return "0 Byte";
11
- const k = 1e3;
12
- const dm = 3;
13
- const sizes = [
14
- "Bytes",
15
- "KB",
16
- "MB",
17
- "GB"
18
- ];
19
- const i = Math.floor(Math.log(bytes) / Math.log(k));
20
- return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
21
- }, "formatBytes");
22
- var analyzePlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options) => {
23
- return {
24
- name: "storm:analyzer",
25
- renderChunk(source, chunk) {
26
- const sourceBytes = formatBytes(source.length);
27
- const fileName = chunk.fileName;
28
- _chunkK5SEKFQAcjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, options.config);
29
- }
30
- };
31
- }, "analyzePlugin");
32
-
33
-
34
-
35
- exports.analyzePlugin = analyzePlugin;
@@ -1,31 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkK5SEKFQAcjs = require('./chunk-K5SEKFQA.cjs');
4
-
5
-
6
- var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
7
-
8
- // src/plugins/on-error.ts
9
- var onErrorPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options) => ({
10
- name: "storm:on-error",
11
- buildEnd(error) {
12
- if (error) {
13
- _chunkK5SEKFQAcjs.writeError.call(void 0, `The following errors occurred during the build:
14
- ${error ? error.message : "Unknown build error"}
15
-
16
- `, options.config);
17
- throw new Error("Storm unbuild process failed with errors.");
18
- }
19
- },
20
- renderError(error) {
21
- _chunkK5SEKFQAcjs.writeError.call(void 0, `The following errors occurred during the build:
22
- ${error ? error.message : "Unknown build error"}
23
-
24
- `, options.config);
25
- throw new Error("Storm unbuild process failed with errors.");
26
- }
27
- }), "onErrorPlugin");
28
-
29
-
30
-
31
- exports.onErrorPlugin = onErrorPlugin;