@storm-software/unbuild 0.25.2 → 0.26.0

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.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/bin/unbuild.cjs +3366 -0
  3. package/bin/unbuild.js +2713 -62900
  4. package/dist/build.cjs +14 -0
  5. package/dist/{build.d.mts → build.d.cts} +1 -3
  6. package/dist/build.d.ts +0 -2
  7. package/dist/build.js +14 -20
  8. package/dist/chunk-3GQAWCBQ.js +13 -0
  9. package/dist/{chunk-4BAUMYRN.mjs → chunk-4RR7YISH.js} +9 -8
  10. package/dist/chunk-BRHZNXQM.js +603 -0
  11. package/dist/chunk-DRQUQQ5D.js +2459 -0
  12. package/dist/{chunk-4ENAOJ33.mjs → chunk-ESRR2FD2.js} +2 -4
  13. package/dist/chunk-GHVDJY3S.cjs +603 -0
  14. package/dist/chunk-HO6B5DC7.cjs +27 -0
  15. package/dist/{chunk-6UMHN4KS.mjs → chunk-JIVM7FQJ.js} +3 -5
  16. package/dist/chunk-KAXKUEZ7.cjs +63 -0
  17. package/dist/chunk-ORA4UQMU.cjs +1 -0
  18. package/dist/chunk-OULCUN6I.js +0 -0
  19. package/dist/{chunk-P6LWSWAQ.js → chunk-SHHAZOHN.cjs} +2 -4
  20. package/dist/{chunk-ESGPHEWU.mjs → chunk-TFMXUACY.js} +6 -8
  21. package/dist/{chunk-PVZYPNLZ.js → chunk-TRA2WJ3W.cjs} +6 -8
  22. package/dist/{chunk-BUCFGCTW.js → chunk-UV35N5R4.cjs} +5 -7
  23. package/dist/chunk-VEX5RCZW.js +63 -0
  24. package/dist/chunk-XGMJ3OUH.cjs +2460 -0
  25. package/dist/{chunk-SQOZCV36.js → chunk-XKHSZIHP.cjs} +8 -7
  26. package/dist/{chunk-WXJPXYHF.mjs → chunk-YCGXRIUD.js} +3 -5
  27. package/dist/chunk-YDYGZTJK.cjs +18 -0
  28. package/dist/clean.cjs +10 -0
  29. package/dist/clean.js +10 -10
  30. package/dist/config.cjs +12 -0
  31. package/dist/{config.d.mts → config.d.cts} +1 -3
  32. package/dist/config.d.ts +0 -2
  33. package/dist/config.js +12 -12
  34. package/dist/index.cjs +28 -0
  35. package/dist/{index.d.mts → index.d.cts} +4 -6
  36. package/dist/index.d.ts +0 -2
  37. package/dist/index.js +28 -39
  38. package/dist/types.cjs +2 -0
  39. package/dist/{types.d.mts → types.d.cts} +0 -4
  40. package/dist/types.d.ts +0 -4
  41. package/dist/types.js +1 -2
  42. package/package.json +38 -37
  43. package/bin/unbuild.mjs +0 -63530
  44. package/dist/build.mjs +0 -20
  45. package/dist/chunk-3TNHGERR.mjs +0 -49
  46. package/dist/chunk-44VTNVZA.js +0 -29
  47. package/dist/chunk-45FJ3WQ6.js +0 -7528
  48. package/dist/chunk-4HFICKAT.js +0 -451
  49. package/dist/chunk-4IU7LXNH.mjs +0 -4054
  50. package/dist/chunk-523YIUTF.js +0 -19937
  51. package/dist/chunk-7G3WYTPJ.js +0 -6
  52. package/dist/chunk-AMTVM7UD.js +0 -4054
  53. package/dist/chunk-DIRFSBOA.mjs +0 -84
  54. package/dist/chunk-EGCWTBMT.mjs +0 -1120
  55. package/dist/chunk-EKTZK3IJ.mjs +0 -765
  56. package/dist/chunk-FAXWFK7Q.mjs +0 -7528
  57. package/dist/chunk-G6BE6UP3.mjs +0 -2481
  58. package/dist/chunk-K5SQO3GD.mjs +0 -451
  59. package/dist/chunk-MCNTIU52.js +0 -3050
  60. package/dist/chunk-NMYL4VJJ.js +0 -84
  61. package/dist/chunk-NOVWJHZD.mjs +0 -6
  62. package/dist/chunk-Q4GMTWGF.mjs +0 -19937
  63. package/dist/chunk-RBSVNX4W.js +0 -49
  64. package/dist/chunk-RM7SW35Z.js +0 -1120
  65. package/dist/chunk-S532A3LO.js +0 -510
  66. package/dist/chunk-TEEYWCSY.mjs +0 -3050
  67. package/dist/chunk-VJI72AA6.mjs +0 -510
  68. package/dist/chunk-W7YS7HE5.js +0 -765
  69. package/dist/chunk-YIP6AERX.js +0 -2484
  70. package/dist/clean.mjs +0 -10
  71. package/dist/config.mjs +0 -12
  72. package/dist/dist-JWSUGJW5.js +0 -17571
  73. package/dist/dist-LXRVOZWD.mjs +0 -17570
  74. package/dist/esm-2JSYGY2W.js +0 -1716
  75. package/dist/esm-2LICJFKF.mjs +0 -1716
  76. package/dist/execa-2KYLC5PR.mjs +0 -2424
  77. package/dist/execa-QRX32ES4.js +0 -2424
  78. package/dist/index.mjs +0 -39
  79. package/dist/json5-JI6Y4EBT.mjs +0 -10
  80. package/dist/json5-ZRUT32KA.js +0 -10
  81. package/dist/jsonc-2MC7UMCL.js +0 -15
  82. package/dist/jsonc-PDDMSRDH.mjs +0 -15
  83. package/dist/multipart-parser-FQDS23TV.mjs +0 -187
  84. package/dist/multipart-parser-IX66WIWH.js +0 -187
  85. package/dist/toml-IHKP66UV.mjs +0 -10
  86. package/dist/toml-MDHAEB3G.js +0 -10
  87. package/dist/types.mjs +0 -2
  88. package/dist/yaml-GMY56OHD.mjs +0 -10
  89. package/dist/yaml-UTMAXQ2T.js +0 -10
  90. /package/dist/{clean.d.mts → clean.d.cts} +0 -0
@@ -0,0 +1,63 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkGHVDJY3Scjs = require('./chunk-GHVDJY3S.cjs');
4
+
5
+
6
+ var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
7
+
8
+ // src/plugins/tsc.ts
9
+ var _devkit = require('@nx/devkit');
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
+ var _path = require('path');
18
+ var _url = require('url');
19
+ var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
20
+ async function loadConfig(configPath) {
21
+ if (!/\.(js|mjs)$/.test(_path.extname.call(void 0, configPath))) {
22
+ throw new Error("Unsupported config file format");
23
+ }
24
+ return Promise.resolve().then(() => _interopRequireWildcard(require(_url.pathToFileURL.call(void 0, configPath).toString()))).then((config) => config.default);
25
+ }
26
+ _chunkYDYGZTJKcjs.__name.call(void 0, loadConfig, "loadConfig");
27
+ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
28
+ const tsConfigFile = _typescript2.default.readConfigFile(_devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath), _typescript2.default.sys.readFile);
29
+ const tsConfig = _typescript2.default.parseJsonConfigFileContent(tsConfigFile.config, _typescript2.default.sys, _path.dirname.call(void 0, _devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath)));
30
+ const compilerOptions = {
31
+ rootDir: projectRoot,
32
+ declaration: true,
33
+ paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
34
+ };
35
+ _chunkGHVDJY3Scjs.writeTrace.call(void 0, compilerOptions, config);
36
+ return compilerOptions;
37
+ }
38
+ _chunkYDYGZTJKcjs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
39
+
40
+ // src/plugins/tsc.ts
41
+ var tscPlugin = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (options, resolvedOptions) => {
42
+ const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
43
+ const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.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, resolvedOptions.tsconfig, dependencies, projectGraph, true);
46
+ if (tsLibDependency) {
47
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
48
+ dependencies.push(tsLibDependency);
49
+ }
50
+ return _rollupplugintypescript22.default.call(void 0, {
51
+ check: options.emitTypes !== false,
52
+ tsconfig: resolvedOptions.tsconfig,
53
+ tsconfigOverride: {
54
+ compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
55
+ }
56
+ });
57
+ }, "tscPlugin");
58
+
59
+
60
+
61
+
62
+
63
+ exports.loadConfig = loadConfig; exports.createTsCompilerOptions = createTsCompilerOptions; exports.tscPlugin = tscPlugin;
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -1,10 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
-
4
- var _chunkRBSVNX4Wjs = require('./chunk-RBSVNX4W.js');
3
+ var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
5
4
 
6
5
  // src/plugins/type-definitions.ts
7
- _chunkRBSVNX4Wjs.init_cjs_shims.call(void 0, );
8
6
  var _path = require('path');
9
7
  function typeDefinitions(projectRoot) {
10
8
  return {
@@ -33,7 +31,7 @@ export { default } from ${relativeSourceDtsName};
33
31
  }
34
32
  };
35
33
  }
36
- _chunkRBSVNX4Wjs.__name.call(void 0, typeDefinitions, "typeDefinitions");
34
+ _chunkYDYGZTJKcjs.__name.call(void 0, typeDefinitions, "typeDefinitions");
37
35
 
38
36
 
39
37
 
@@ -1,22 +1,20 @@
1
1
  import {
2
2
  tscPlugin
3
- } from "./chunk-Q4GMTWGF.mjs";
3
+ } from "./chunk-VEX5RCZW.js";
4
4
  import {
5
5
  typeDefinitions
6
- } from "./chunk-4ENAOJ33.mjs";
6
+ } from "./chunk-ESRR2FD2.js";
7
7
  import {
8
8
  analyzePlugin
9
- } from "./chunk-WXJPXYHF.mjs";
9
+ } from "./chunk-YCGXRIUD.js";
10
10
  import {
11
11
  onErrorPlugin
12
- } from "./chunk-4BAUMYRN.mjs";
12
+ } from "./chunk-4RR7YISH.js";
13
13
  import {
14
- __name,
15
- init_esm_shims
16
- } from "./chunk-3TNHGERR.mjs";
14
+ __name
15
+ } from "./chunk-3GQAWCBQ.js";
17
16
 
18
17
  // src/config.ts
19
- init_esm_shims();
20
18
  var getDefaultBuildPlugins = /* @__PURE__ */ __name(async (options, resolvedOptions) => Promise.all([
21
19
  analyzePlugin(options, resolvedOptions),
22
20
  typeDefinitions(resolvedOptions.projectRoot),
@@ -1,29 +1,27 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkMCNTIU52js = require('./chunk-MCNTIU52.js');
4
+ var _chunkGHVDJY3Scjs = require('./chunk-GHVDJY3S.cjs');
5
5
 
6
6
 
7
-
8
- var _chunkRBSVNX4Wjs = require('./chunk-RBSVNX4W.js');
7
+ var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
9
8
 
10
9
  // src/clean.ts
11
- _chunkRBSVNX4Wjs.init_cjs_shims.call(void 0, );
12
10
  var _promises = require('fs/promises');
13
11
  async function clean(name = "Unbuild", directory, config) {
14
- _chunkMCNTIU52js.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
15
- const stopwatch = _chunkMCNTIU52js.getStopwatch.call(void 0, `${name} output clean`);
12
+ _chunkGHVDJY3Scjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
13
+ const stopwatch = _chunkGHVDJY3Scjs.getStopwatch.call(void 0, `${name} output clean`);
16
14
  await cleanDirectories(name, directory, config);
17
15
  stopwatch();
18
16
  }
19
- _chunkRBSVNX4Wjs.__name.call(void 0, clean, "clean");
17
+ _chunkYDYGZTJKcjs.__name.call(void 0, clean, "clean");
20
18
  async function cleanDirectories(name = "Unbuild", directory, config) {
21
19
  await _promises.rm.call(void 0, directory, {
22
20
  recursive: true,
23
21
  force: true
24
22
  });
25
23
  }
26
- _chunkRBSVNX4Wjs.__name.call(void 0, cleanDirectories, "cleanDirectories");
24
+ _chunkYDYGZTJKcjs.__name.call(void 0, cleanDirectories, "cleanDirectories");
27
25
 
28
26
 
29
27
 
@@ -1,14 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMCNTIU52js = require('./chunk-MCNTIU52.js');
3
+ var _chunkGHVDJY3Scjs = require('./chunk-GHVDJY3S.cjs');
4
4
 
5
5
 
6
-
7
- var _chunkRBSVNX4Wjs = require('./chunk-RBSVNX4W.js');
6
+ var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
8
7
 
9
8
  // src/plugins/analyze.ts
10
- _chunkRBSVNX4Wjs.init_cjs_shims.call(void 0, );
11
- var formatBytes = /* @__PURE__ */ _chunkRBSVNX4Wjs.__name.call(void 0, (bytes) => {
9
+ var formatBytes = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (bytes) => {
12
10
  if (bytes === 0) return "0 Byte";
13
11
  const k = 1e3;
14
12
  const dm = 3;
@@ -21,13 +19,13 @@ var formatBytes = /* @__PURE__ */ _chunkRBSVNX4Wjs.__name.call(void 0, (bytes) =
21
19
  const i = Math.floor(Math.log(bytes) / Math.log(k));
22
20
  return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
23
21
  }, "formatBytes");
24
- var analyzePlugin = /* @__PURE__ */ _chunkRBSVNX4Wjs.__name.call(void 0, (options, resolvedOptions) => {
22
+ var analyzePlugin = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (options, resolvedOptions) => {
25
23
  return {
26
24
  name: "storm:analyzer",
27
25
  renderChunk(source, chunk) {
28
26
  const sourceBytes = formatBytes(source.length);
29
27
  const fileName = chunk.fileName;
30
- _chunkMCNTIU52js.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
28
+ _chunkGHVDJY3Scjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
31
29
  }
32
30
  };
33
31
  }, "analyzePlugin");
@@ -0,0 +1,63 @@
1
+ import {
2
+ writeTrace
3
+ } from "./chunk-BRHZNXQM.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, resolvedOptions) => {
42
+ const projectGraph = readCachedProjectGraph();
43
+ const result = calculateProjectBuildableDependencies(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.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, resolvedOptions.tsconfig, dependencies, projectGraph, true);
46
+ if (tsLibDependency) {
47
+ dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
48
+ dependencies.push(tsLibDependency);
49
+ }
50
+ return ts2Plugin({
51
+ check: options.emitTypes !== false,
52
+ tsconfig: resolvedOptions.tsconfig,
53
+ tsconfigOverride: {
54
+ compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
55
+ }
56
+ });
57
+ }, "tscPlugin");
58
+
59
+ export {
60
+ loadConfig,
61
+ createTsCompilerOptions,
62
+ tscPlugin
63
+ };