@storm-software/unbuild 0.41.21 → 0.41.23

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 (40) hide show
  1. package/README.md +1 -2
  2. package/bin/unbuild.cjs +798 -412
  3. package/bin/unbuild.js +826 -420
  4. package/dist/build.cjs +8 -8
  5. package/dist/build.js +7 -7
  6. package/dist/{chunk-3GQAWCBQ.js → chunk-3RG5ZIWI.js} +0 -3
  7. package/dist/{chunk-HZNOKNKE.js → chunk-4KHUAP4R.js} +13 -10
  8. package/dist/{chunk-BFBEOACU.cjs → chunk-ALGMIE4E.cjs} +471 -257
  9. package/dist/{chunk-5FQ2QYFQ.js → chunk-ATN45QRM.js} +418 -204
  10. package/dist/{chunk-F4MPFQDI.cjs → chunk-FAW45G3E.cjs} +13 -10
  11. package/dist/{chunk-3BXXHK3F.cjs → chunk-MO3MUSJO.cjs} +7 -15
  12. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  13. package/dist/{chunk-DUDE4LYM.js → chunk-PCGRQKDH.js} +2 -10
  14. package/dist/{chunk-PWE7CANF.cjs → chunk-Q2G4VMOW.cjs} +198 -130
  15. package/dist/{chunk-ITHOVA3D.cjs → chunk-Q3NBYYR4.cjs} +4 -12
  16. package/dist/{chunk-ZB2JWLJS.cjs → chunk-Q4VUCJPK.cjs} +51 -16
  17. package/dist/chunk-WQLDD6CA.js +106 -0
  18. package/dist/{chunk-3BDIPKMO.js → chunk-XQLLOGJZ.js} +197 -129
  19. package/dist/{chunk-SMAV5VSP.js → chunk-XWLZOFQ4.js} +6 -14
  20. package/dist/clean.cjs +4 -4
  21. package/dist/clean.js +3 -3
  22. package/dist/index.cjs +9 -9
  23. package/dist/index.js +8 -8
  24. package/dist/plugins/analyze.cjs +4 -4
  25. package/dist/plugins/analyze.js +3 -3
  26. package/dist/plugins/on-error.cjs +4 -4
  27. package/dist/plugins/on-error.js +3 -3
  28. package/dist/plugins/swc.cjs +5 -8
  29. package/dist/plugins/swc.js +4 -7
  30. package/dist/plugins/tsc.cjs +4 -4
  31. package/dist/plugins/tsc.js +3 -3
  32. package/dist/plugins/type-definitions.cjs +9 -6
  33. package/dist/plugins/type-definitions.js +9 -6
  34. package/dist/types.cjs +1 -1
  35. package/dist/types.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-BGYQAVKQ.cjs +0 -13
  38. package/dist/chunk-XXRSY6EE.js +0 -71
  39. /package/dist/{chunk-OULCUN6I.js → chunk-GGNOJ77I.js} +0 -0
  40. /package/dist/{chunk-ORA4UQMU.cjs → chunk-SFZRYJZ2.cjs} +0 -0
@@ -1,19 +1,24 @@
1
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
2
 
3
- var _chunkPWE7CANFcjs = require('./chunk-PWE7CANF.cjs');
3
+ var _chunkQ2G4VMOWcjs = require('./chunk-Q2G4VMOW.cjs');
4
+
5
+ // src/plugins/tsc.ts
4
6
 
5
7
 
6
- var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
7
8
 
8
- // src/plugins/tsc.ts
9
9
  var _devkit = require('@nx/devkit');
10
10
  var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
11
+
12
+
13
+
11
14
  var _compilerhelperdependency = require('@nx/js/src/utils/compiler-helper-dependency');
12
15
  var _rollupplugintypescript2 = require('rollup-plugin-typescript2'); var _rollupplugintypescript22 = _interopRequireDefault(_rollupplugintypescript2);
13
16
 
14
17
  // src/utilities/helpers.ts
15
18
 
16
19
 
20
+
21
+
17
22
  var _path = require('path');
18
23
  var _url = require('url');
19
24
  var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
@@ -21,24 +26,31 @@ async function loadConfig(configPath) {
21
26
  if (!/\.(js|mjs)$/.test(_path.extname.call(void 0, configPath))) {
22
27
  throw new Error("Unsupported config file format");
23
28
  }
24
- return Promise.resolve().then(() => _interopRequireWildcard(require(_url.pathToFileURL.call(void 0, configPath).toString()))).then((config) => config.default);
29
+ return Promise.resolve().then(() => _interopRequireWildcard(require(_url.pathToFileURL.call(void 0, configPath).toString()))).then(
30
+ (config) => config.default
31
+ );
25
32
  }
26
- _chunkBGYQAVKQcjs.__name.call(void 0, loadConfig, "loadConfig");
27
33
  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)));
34
+ const tsConfigFile = _typescript2.default.readConfigFile(
35
+ _devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath),
36
+ _typescript2.default.sys.readFile
37
+ );
38
+ const tsConfig = _typescript2.default.parseJsonConfigFileContent(
39
+ tsConfigFile.config,
40
+ _typescript2.default.sys,
41
+ _path.dirname.call(void 0, _devkit.joinPathFragments.call(void 0, config.workspaceRoot, projectRoot, tsConfigPath))
42
+ );
30
43
  const compilerOptions = {
31
44
  rootDir: projectRoot,
32
45
  declaration: true,
33
46
  paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
34
47
  };
35
- _chunkPWE7CANFcjs.writeTrace.call(void 0, compilerOptions, config);
48
+ _chunkQ2G4VMOWcjs.writeTrace.call(void 0, compilerOptions, config);
36
49
  return compilerOptions;
37
50
  }
38
- _chunkBGYQAVKQcjs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
39
51
 
40
52
  // src/plugins/tsc.ts
41
- var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (options) => {
53
+ var tscPlugin = async (options) => {
42
54
  let projectGraph;
43
55
  try {
44
56
  projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
@@ -47,22 +59,45 @@ var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (opt
47
59
  projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
48
60
  }
49
61
  if (!projectGraph) {
50
- throw new Error("The build process failed because the project graph is not available. Please run the build command again.");
62
+ throw new Error(
63
+ "The build process failed because the project graph is not available. Please run the build command again."
64
+ );
51
65
  }
52
- 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);
66
+ const result = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0,
67
+ void 0,
68
+ projectGraph,
69
+ options.config.workspaceRoot,
70
+ options.projectName,
71
+ process.env.NX_TASK_TARGET_TARGET || "build",
72
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
73
+ true
74
+ );
53
75
  let dependencies = result.dependencies;
54
- const tsLibDependency = _compilerhelperdependency.getHelperDependency.call(void 0, _compilerhelperdependency.HelperDependency.tsc, options.tsconfig, dependencies, projectGraph, true);
76
+ const tsLibDependency = _compilerhelperdependency.getHelperDependency.call(void 0,
77
+ _compilerhelperdependency.HelperDependency.tsc,
78
+ options.tsconfig,
79
+ dependencies,
80
+ projectGraph,
81
+ true
82
+ );
55
83
  if (tsLibDependency) {
56
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
84
+ dependencies = dependencies.filter(
85
+ (deps) => deps.name !== tsLibDependency.name
86
+ );
57
87
  dependencies.push(tsLibDependency);
58
88
  }
59
- const compilerOptions = await createTsCompilerOptions(options.config, options.tsconfig, options.projectRoot, dependencies);
89
+ const compilerOptions = await createTsCompilerOptions(
90
+ options.config,
91
+ options.tsconfig,
92
+ options.projectRoot,
93
+ dependencies
94
+ );
60
95
  return _rollupplugintypescript22.default.call(void 0, {
61
96
  check: options.declaration !== false,
62
97
  tsconfig: options.tsconfig,
63
98
  tsconfigOverride: compilerOptions
64
99
  });
65
- }, "tscPlugin");
100
+ };
66
101
 
67
102
 
68
103
 
@@ -0,0 +1,106 @@
1
+ import {
2
+ writeTrace
3
+ } from "./chunk-XQLLOGJZ.js";
4
+
5
+ // src/plugins/tsc.ts
6
+ import {
7
+ createProjectGraphAsync,
8
+ readCachedProjectGraph
9
+ } from "@nx/devkit";
10
+ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
11
+ import {
12
+ getHelperDependency,
13
+ HelperDependency
14
+ } from "@nx/js/src/utils/compiler-helper-dependency";
15
+ import ts2Plugin from "rollup-plugin-typescript2";
16
+
17
+ // src/utilities/helpers.ts
18
+ import { joinPathFragments } from "@nx/devkit";
19
+ import {
20
+ computeCompilerOptionsPaths
21
+ } from "@nx/js/src/utils/buildable-libs-utils";
22
+ import { dirname, extname } from "node:path";
23
+ import { pathToFileURL } from "node:url";
24
+ import ts from "typescript";
25
+ async function loadConfig(configPath) {
26
+ if (!/\.(js|mjs)$/.test(extname(configPath))) {
27
+ throw new Error("Unsupported config file format");
28
+ }
29
+ return import(pathToFileURL(configPath).toString()).then(
30
+ (config) => config.default
31
+ );
32
+ }
33
+ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
34
+ const tsConfigFile = ts.readConfigFile(
35
+ joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath),
36
+ ts.sys.readFile
37
+ );
38
+ const tsConfig = ts.parseJsonConfigFileContent(
39
+ tsConfigFile.config,
40
+ ts.sys,
41
+ dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath))
42
+ );
43
+ const compilerOptions = {
44
+ rootDir: projectRoot,
45
+ declaration: true,
46
+ paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
47
+ };
48
+ writeTrace(compilerOptions, config);
49
+ return compilerOptions;
50
+ }
51
+
52
+ // src/plugins/tsc.ts
53
+ var tscPlugin = async (options) => {
54
+ let projectGraph;
55
+ try {
56
+ projectGraph = readCachedProjectGraph();
57
+ } catch {
58
+ await createProjectGraphAsync();
59
+ projectGraph = readCachedProjectGraph();
60
+ }
61
+ if (!projectGraph) {
62
+ throw new Error(
63
+ "The build process failed because the project graph is not available. Please run the build command again."
64
+ );
65
+ }
66
+ const result = calculateProjectBuildableDependencies(
67
+ void 0,
68
+ projectGraph,
69
+ options.config.workspaceRoot,
70
+ options.projectName,
71
+ process.env.NX_TASK_TARGET_TARGET || "build",
72
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
73
+ true
74
+ );
75
+ let dependencies = result.dependencies;
76
+ const tsLibDependency = getHelperDependency(
77
+ HelperDependency.tsc,
78
+ options.tsconfig,
79
+ dependencies,
80
+ projectGraph,
81
+ true
82
+ );
83
+ if (tsLibDependency) {
84
+ dependencies = dependencies.filter(
85
+ (deps) => deps.name !== tsLibDependency.name
86
+ );
87
+ dependencies.push(tsLibDependency);
88
+ }
89
+ const compilerOptions = await createTsCompilerOptions(
90
+ options.config,
91
+ options.tsconfig,
92
+ options.projectRoot,
93
+ dependencies
94
+ );
95
+ return ts2Plugin({
96
+ check: options.declaration !== false,
97
+ tsconfig: options.tsconfig,
98
+ tsconfigOverride: compilerOptions
99
+ });
100
+ };
101
+
102
+ export {
103
+ loadConfig,
104
+ createTsCompilerOptions,
105
+ tscPlugin
106
+ };