@storm-software/workspace-tools 1.266.9 → 1.267.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 (154) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-Z2D5X5KJ.mjs → chunk-2C37GBZ2.mjs} +2 -2
  4. package/dist/{chunk-5AVEZVE5.mjs → chunk-2TEC7IFE.mjs} +4 -4
  5. package/dist/{chunk-WBNGMFYP.js → chunk-4Y6B6JDH.js} +11 -11
  6. package/dist/{chunk-K7B7YVQF.mjs → chunk-5I7ULQZF.mjs} +1 -1
  7. package/dist/{chunk-JL5QGFBX.js → chunk-6CGAYKQL.js} +20 -20
  8. package/dist/{chunk-BJ6UNKNM.js → chunk-6JJB5AYA.js} +9 -9
  9. package/dist/{chunk-TKGD3SNO.mjs → chunk-7FHFHZRB.mjs} +1 -1
  10. package/dist/{chunk-Z255YQZR.js → chunk-7NNHBZC5.js} +2 -2
  11. package/dist/{chunk-HYRQEEMO.js → chunk-7PRHEOCT.js} +2 -2
  12. package/dist/{chunk-UBMOQCNN.js → chunk-B3DVFXXD.js} +2 -2
  13. package/dist/{chunk-5G2XZTUU.mjs → chunk-BFGWJ7BS.mjs} +4 -4
  14. package/dist/{chunk-YWAH4DHJ.mjs → chunk-BJMT4ECA.mjs} +3 -3
  15. package/dist/chunk-BUPROWVS.js +653 -0
  16. package/dist/{chunk-4UPFP6EX.mjs → chunk-CM2FQCBL.mjs} +3 -3
  17. package/dist/{chunk-VUIT3ZAI.mjs → chunk-CNCYVRZ4.mjs} +1 -1
  18. package/dist/{chunk-NCTH2PTP.mjs → chunk-EHFWY65U.mjs} +3 -3
  19. package/dist/{chunk-XGSZL5N7.mjs → chunk-FM2TFXVW.mjs} +4 -4
  20. package/dist/{chunk-7LP6KWJ4.mjs → chunk-FPAOVOZX.mjs} +3 -3
  21. package/dist/{chunk-MP2P2MGP.js → chunk-G4QFSE5B.js} +8 -5
  22. package/dist/{chunk-2RRVYK6E.mjs → chunk-GNFQ5PGW.mjs} +1 -1
  23. package/dist/{chunk-E2GASAYN.js → chunk-HOXPAVCL.js} +2 -2
  24. package/dist/{chunk-TBE7H5P7.js → chunk-ICPUM2HS.js} +5 -5
  25. package/dist/{chunk-36QIKTAL.mjs → chunk-IXHY3ZPO.mjs} +3 -3
  26. package/dist/{chunk-TCZC6XD6.mjs → chunk-IZHZKPHV.mjs} +12 -9
  27. package/dist/{chunk-SORZ4BJW.mjs → chunk-KP5JD22G.mjs} +4 -4
  28. package/dist/{chunk-A2Z3X5GK.mjs → chunk-LS27TGDZ.mjs} +2 -2
  29. package/dist/chunk-LUR7U35A.mjs +653 -0
  30. package/dist/{chunk-QDLQJ3QS.mjs → chunk-MFSIJSBW.mjs} +3 -3
  31. package/dist/{chunk-L6BH2OLB.mjs → chunk-MIVNJALE.mjs} +1 -1
  32. package/dist/{chunk-XRZPNGM5.mjs → chunk-N4QRXJLZ.mjs} +2 -2
  33. package/dist/{chunk-VGSUCQ2S.mjs → chunk-N7GSKHH2.mjs} +1 -1
  34. package/dist/{chunk-4CLX5NBT.js → chunk-NSCWEC2S.js} +2 -2
  35. package/dist/{chunk-YWHLDLKE.js → chunk-OKW5O5P4.js} +5 -5
  36. package/dist/{chunk-YT3ECNTF.js → chunk-OQPX75CG.js} +2 -2
  37. package/dist/{chunk-5NTNN2XK.mjs → chunk-OW6VGYDT.mjs} +1 -1
  38. package/dist/{chunk-TPWVZZWY.js → chunk-P4OVFIT6.js} +2 -2
  39. package/dist/{chunk-YMFIVYHZ.mjs → chunk-PGEZGCU2.mjs} +2 -2
  40. package/dist/{chunk-GEIXDGFR.mjs → chunk-PZL7IZ7I.mjs} +2 -2
  41. package/dist/{chunk-4FJCOFII.mjs → chunk-Q7WXH4GA.mjs} +3 -3
  42. package/dist/{chunk-LY5IGOQR.mjs → chunk-QXE7GTBY.mjs} +3 -3
  43. package/dist/{chunk-KWARMR7G.mjs → chunk-RMLZO26I.mjs} +4 -4
  44. package/dist/{chunk-USRO6ZCF.mjs → chunk-RPMGDH44.mjs} +2 -2
  45. package/dist/{chunk-G4S2HWXN.js → chunk-RUKOOSWL.js} +2 -2
  46. package/dist/{chunk-474QFQKX.mjs → chunk-SYTBJXTM.mjs} +1 -1
  47. package/dist/{chunk-NYP6AVTV.js → chunk-TET4GF3D.js} +2 -2
  48. package/dist/{chunk-IOUCRBHV.mjs → chunk-TPK3STUY.mjs} +4 -4
  49. package/dist/{chunk-WHITLY6G.mjs → chunk-TRD4W5ZK.mjs} +4 -4
  50. package/dist/{chunk-TMCMTZPP.mjs → chunk-UY3Q5IDT.mjs} +1 -1
  51. package/dist/{chunk-KDQGKQHN.mjs → chunk-V42FQ4FR.mjs} +3 -3
  52. package/dist/{chunk-FJ3HUDJN.mjs → chunk-WAXAZ5PV.mjs} +3 -3
  53. package/dist/{chunk-VFXWLOY7.mjs → chunk-WDFR6LVR.mjs} +2 -2
  54. package/dist/{chunk-D2OJX4DZ.mjs → chunk-XCBLUQPM.mjs} +3 -3
  55. package/dist/{chunk-QIF3QXOA.mjs → chunk-XYRHMXLC.mjs} +3 -3
  56. package/dist/{chunk-Z4WOCHYB.mjs → chunk-YHPRTWSY.mjs} +2 -2
  57. package/dist/{chunk-PKL7UOGQ.js → chunk-YW4UN25U.js} +4 -4
  58. package/dist/{chunk-NCV26VAW.js → chunk-Z4NKRWWJ.js} +15 -15
  59. package/dist/{chunk-3DMOUTDH.mjs → chunk-Z6GV7C5U.mjs} +1 -1
  60. package/dist/{chunk-TIOK7TNA.mjs → chunk-ZJ3QSWTQ.mjs} +4 -4
  61. package/dist/executors.js +14 -14
  62. package/dist/executors.mjs +28 -28
  63. package/dist/generators.js +10 -10
  64. package/dist/generators.mjs +21 -21
  65. package/dist/index.js +22 -22
  66. package/dist/index.mjs +51 -51
  67. package/dist/src/base/base-executor.js +3 -3
  68. package/dist/src/base/base-executor.mjs +6 -6
  69. package/dist/src/base/base-executor.untyped.mjs +1 -1
  70. package/dist/src/base/base-generator.js +3 -3
  71. package/dist/src/base/base-generator.mjs +6 -6
  72. package/dist/src/base/base-generator.untyped.mjs +1 -1
  73. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  74. package/dist/src/base/index.js +4 -4
  75. package/dist/src/base/index.mjs +10 -10
  76. package/dist/src/base/typescript-build-executor.untyped.mjs +2 -2
  77. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  78. package/dist/src/executors/cargo-build/executor.js +4 -4
  79. package/dist/src/executors/cargo-build/executor.mjs +8 -8
  80. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  81. package/dist/src/executors/cargo-check/executor.js +4 -4
  82. package/dist/src/executors/cargo-check/executor.mjs +8 -8
  83. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  84. package/dist/src/executors/cargo-clippy/executor.js +4 -4
  85. package/dist/src/executors/cargo-clippy/executor.mjs +8 -8
  86. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  87. package/dist/src/executors/cargo-doc/executor.js +4 -4
  88. package/dist/src/executors/cargo-doc/executor.mjs +8 -8
  89. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  90. package/dist/src/executors/cargo-format/executor.js +4 -4
  91. package/dist/src/executors/cargo-format/executor.mjs +8 -8
  92. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  93. package/dist/src/executors/cargo-publish/executor.mjs +3 -3
  94. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  95. package/dist/src/executors/clean-package/executor.js +5 -5
  96. package/dist/src/executors/clean-package/executor.mjs +6 -6
  97. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  98. package/dist/src/executors/esbuild/executor.js +4 -4
  99. package/dist/src/executors/esbuild/executor.mjs +7 -7
  100. package/dist/src/executors/esbuild/untyped.mjs +2 -2
  101. package/dist/src/executors/npm-publish/executor.mjs +4 -4
  102. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  103. package/dist/src/executors/size-limit/executor.js +4 -4
  104. package/dist/src/executors/size-limit/executor.mjs +7 -7
  105. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  106. package/dist/src/executors/typia/executor.js +4 -4
  107. package/dist/src/executors/typia/executor.mjs +7 -7
  108. package/dist/src/executors/typia/untyped.mjs +1 -1
  109. package/dist/src/executors/unbuild/executor.js +4 -4
  110. package/dist/src/executors/unbuild/executor.mjs +7 -7
  111. package/dist/src/executors/unbuild/untyped.mjs +2 -2
  112. package/dist/src/generators/browser-library/generator.js +4 -4
  113. package/dist/src/generators/browser-library/generator.mjs +9 -9
  114. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  115. package/dist/src/generators/config-schema/generator.js +4 -4
  116. package/dist/src/generators/config-schema/generator.mjs +7 -7
  117. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  118. package/dist/src/generators/init/init.mjs +2 -2
  119. package/dist/src/generators/init/untyped.mjs +1 -1
  120. package/dist/src/generators/neutral-library/generator.js +4 -4
  121. package/dist/src/generators/neutral-library/generator.mjs +9 -9
  122. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  123. package/dist/src/generators/node-library/generator.js +4 -4
  124. package/dist/src/generators/node-library/generator.mjs +9 -9
  125. package/dist/src/generators/node-library/untyped.mjs +1 -1
  126. package/dist/src/generators/preset/generator.js +4 -4
  127. package/dist/src/generators/preset/generator.mjs +7 -7
  128. package/dist/src/generators/preset/untyped.mjs +1 -1
  129. package/dist/src/generators/release-version/generator.js +3 -3
  130. package/dist/src/generators/release-version/generator.mjs +6 -6
  131. package/dist/src/generators/release-version/untyped.mjs +1 -1
  132. package/dist/src/plugins/rust/cargo-toml.mjs +4 -4
  133. package/dist/src/plugins/rust/index.mjs +4 -4
  134. package/dist/src/plugins/typescript/index.mjs +4 -4
  135. package/dist/src/plugins/typescript/project-config.mjs +4 -4
  136. package/dist/src/plugins/typescript/tsup.mjs +2 -2
  137. package/dist/src/plugins/typescript/untyped-schema.mjs +2 -2
  138. package/dist/src/types.mjs +1 -1
  139. package/dist/src/utils/apply-workspace-tokens.mjs +4 -4
  140. package/dist/src/utils/cargo.mjs +2 -2
  141. package/dist/src/utils/create-cli-options.mjs +2 -2
  142. package/dist/src/utils/get-project-configurations.mjs +4 -4
  143. package/dist/src/utils/index.mjs +14 -14
  144. package/dist/src/utils/lock-file.mjs +2 -2
  145. package/dist/src/utils/package-helpers.mjs +4 -4
  146. package/dist/src/utils/plugin-helpers.mjs +3 -3
  147. package/dist/src/utils/pnpm-deps-update.mjs +3 -3
  148. package/dist/src/utils/project-tags.mjs +2 -2
  149. package/dist/src/utils/toml.mjs +2 -2
  150. package/dist/src/utils/typia-transform.mjs +2 -2
  151. package/dist/src/utils/versions.mjs +1 -1
  152. package/package.json +2 -2
  153. package/dist/chunk-JDFMHRPQ.mjs +0 -1533
  154. package/dist/chunk-OWBD5WVM.js +0 -1532
@@ -1,1532 +0,0 @@
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(); } } 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; } var _class;
2
-
3
- var _chunkJL5QGFBXjs = require('./chunk-JL5QGFBX.js');
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- var _chunkMP2P2MGPjs = require('./chunk-MP2P2MGP.js');
17
-
18
-
19
- var _chunk4JOIS7WWjs = require('./chunk-4JOIS7WW.js');
20
-
21
-
22
-
23
- var _chunkJTAXCQX6js = require('./chunk-JTAXCQX6.js');
24
-
25
-
26
-
27
- var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
28
-
29
- // ../esbuild/src/build.ts
30
- var _devkit = require('@nx/devkit');
31
-
32
- // ../build-tools/src/config.ts
33
- var DEFAULT_COMPILED_BANNER = `/*****************************************
34
- *
35
- * \u26A1 Built by Storm Software
36
- *
37
- *****************************************/
38
- `;
39
- var DEFAULT_ENVIRONMENT = "production";
40
- var DEFAULT_TARGET = "esnext";
41
- var DEFAULT_ORGANIZATION = "storm-software";
42
-
43
- // ../build-tools/src/plugins/swc.ts
44
- var _core = require('@swc/core');
45
-
46
- // ../build-tools/src/plugins/ts-resolve.ts
47
- var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
48
- var _module = require('module');
49
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
50
- var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_resolve2);
51
-
52
- // ../build-tools/src/plugins/type-definitions.ts
53
-
54
-
55
-
56
- // ../build-tools/src/utilities/copy-assets.ts
57
- var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
58
- var _glob = require('glob');
59
- var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
60
- var copyAssets = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
61
- const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
62
- pendingAssets.push({
63
- input: projectRoot,
64
- glob: "*.md",
65
- output: "."
66
- });
67
- pendingAssets.push({
68
- input: ".",
69
- glob: "LICENSE",
70
- output: "."
71
- });
72
- if (generatePackageJson2 === false) {
73
- pendingAssets.push({
74
- input: projectRoot,
75
- glob: "package.json",
76
- output: "."
77
- });
78
- }
79
- if (includeSrc === true) {
80
- pendingAssets.push({
81
- input: sourceRoot,
82
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
83
- output: "src/"
84
- });
85
- }
86
- _chunkMP2P2MGPjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
87
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkJTAXCQX6js.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
88
- const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
89
- projectDir: projectRoot,
90
- rootDir: config.workspaceRoot,
91
- outputDir: outputPath,
92
- assets: pendingAssets
93
- });
94
- await assetHandler.processAllAssetsOnce();
95
- if (includeSrc === true) {
96
- _chunkMP2P2MGPjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkJTAXCQX6js.joinPaths.call(void 0, outputPath, "src")}`, config);
97
- const files = await _glob.glob.call(void 0, [
98
- _chunkJTAXCQX6js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
99
- _chunkJTAXCQX6js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
100
- _chunkJTAXCQX6js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
101
- _chunkJTAXCQX6js.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
102
- ]);
103
- await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
104
-
105
- ${await _promises.readFile.call(void 0, file, "utf8")}
106
-
107
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
108
- }
109
- }, "copyAssets");
110
-
111
- // ../build-tools/src/utilities/generate-package-json.ts
112
- var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
113
-
114
-
115
-
116
- var _projectgraph = require('nx/src/project-graph/project-graph');
117
- var addPackageDependencies = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
118
- const projectGraph = _projectgraph.readCachedProjectGraph.call(void 0, );
119
- const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
120
- const localPackages = [];
121
- for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && _optionalChain([dep, 'access', _2 => _2.node, 'access', _3 => _3.data, 'optionalAccess', _4 => _4.root]) !== projectRoot && _optionalChain([dep, 'access', _5 => _5.node, 'access', _6 => _6.data, 'optionalAccess', _7 => _7.root]) !== workspaceRoot)) {
122
- const projectNode = project.node;
123
- if (projectNode.data.root) {
124
- const projectPackageJsonPath = _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
125
- if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
126
- const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
127
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
128
- if (projectPackageJson.private !== true) {
129
- localPackages.push(projectPackageJson);
130
- }
131
- }
132
- }
133
- }
134
- if (localPackages.length > 0) {
135
- _chunkMP2P2MGPjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
136
- const projectJsonFile = await _promises.readFile.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, projectRoot, "project.json"), "utf8");
137
- const projectJson = JSON.parse(projectJsonFile);
138
- const projectName2 = projectJson.name;
139
- const projectConfigurations = _projectgraph.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
140
- if (!_optionalChain([projectConfigurations, 'optionalAccess', _8 => _8.projects, 'optionalAccess', _9 => _9[projectName2]])) {
141
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
142
- }
143
- const implicitDependencies = _optionalChain([projectConfigurations, 'access', _10 => _10.projects, 'optionalAccess', _11 => _11[projectName2], 'access', _12 => _12.implicitDependencies, 'optionalAccess', _13 => _13.reduce, 'call', _14 => _14((ret, dep) => {
144
- if (_optionalChain([projectConfigurations, 'access', _15 => _15.projects, 'optionalAccess', _16 => _16[dep]])) {
145
- const depPackageJsonPath = _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
146
- if (_fs.existsSync.call(void 0, depPackageJsonPath)) {
147
- const depPackageJsonContent = _fs.readFileSync.call(void 0, depPackageJsonPath, "utf8");
148
- const depPackageJson = JSON.parse(depPackageJsonContent);
149
- if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
150
- ret.push(depPackageJson.name);
151
- }
152
- }
153
- }
154
- return ret;
155
- }, [])]);
156
- packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
157
- if (!ret[localPackage.name] && !_optionalChain([implicitDependencies, 'optionalAccess', _17 => _17.includes, 'call', _18 => _18(localPackage.name)]) && _optionalChain([packageJson, 'access', _19 => _19.devDependencies, 'optionalAccess', _20 => _20[localPackage.name]]) === void 0) {
158
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
159
- }
160
- return ret;
161
- }, _nullishCoalesce(packageJson.dependencies, () => ( {})));
162
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
163
- if (!ret[localPackage.name] && _optionalChain([implicitDependencies, 'optionalAccess', _21 => _21.includes, 'call', _22 => _22(localPackage.name)]) && _optionalChain([packageJson, 'access', _23 => _23.dependencies, 'optionalAccess', _24 => _24[localPackage.name]]) === void 0) {
164
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
165
- }
166
- return ret;
167
- }, _nullishCoalesce(packageJson.devDependencies, () => ( {})));
168
- } else {
169
- _chunkMP2P2MGPjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
170
- }
171
- return packageJson;
172
- }, "addPackageDependencies");
173
- var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
174
- const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunk4JOIS7WWjs.findWorkspaceRoot.call(void 0, );
175
- const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
176
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
177
- packageJson.type ??= "module";
178
- packageJson.sideEffects ??= false;
179
- if (includeSrc === true) {
180
- let distSrc = sourceRoot.replace(projectRoot, "");
181
- if (distSrc.startsWith("/")) {
182
- distSrc = distSrc.substring(1);
183
- }
184
- packageJson.source ??= `${_chunkJTAXCQX6js.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
185
- }
186
- packageJson.files ??= [
187
- "dist/**/*"
188
- ];
189
- if (includeSrc === true && !packageJson.files.includes("src")) {
190
- packageJson.files.push("src/**/*");
191
- }
192
- packageJson.publishConfig ??= {
193
- access: "public"
194
- };
195
- packageJson.description ??= workspacePackageJson.description;
196
- packageJson.homepage ??= workspacePackageJson.homepage;
197
- packageJson.bugs ??= workspacePackageJson.bugs;
198
- packageJson.license ??= workspacePackageJson.license;
199
- packageJson.keywords ??= workspacePackageJson.keywords;
200
- packageJson.funding ??= workspacePackageJson.funding;
201
- packageJson.author ??= workspacePackageJson.author;
202
- packageJson.maintainers ??= workspacePackageJson.maintainers;
203
- if (!packageJson.maintainers && packageJson.author) {
204
- packageJson.maintainers = [
205
- packageJson.author
206
- ];
207
- }
208
- packageJson.contributors ??= workspacePackageJson.contributors;
209
- if (!packageJson.contributors && packageJson.author) {
210
- packageJson.contributors = [
211
- packageJson.author
212
- ];
213
- }
214
- packageJson.repository ??= workspacePackageJson.repository;
215
- packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkJTAXCQX6js.joinPaths.call(void 0, "packages", projectName);
216
- return packageJson;
217
- }, "addWorkspacePackageJsonFields");
218
-
219
- // ../config-tools/src/utilities/run.ts
220
- var _child_process = require('child_process');
221
- var LARGE_BUFFER = 1024 * 1e6;
222
- var run = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), stdio = "inherit", env = process.env) => {
223
- return _child_process.execSync.call(void 0, command, {
224
- cwd,
225
- env: {
226
- ...process.env,
227
- ...env,
228
- CLICOLOR: "true",
229
- FORCE_COLOR: "true"
230
- },
231
- windowsHide: true,
232
- stdio,
233
- maxBuffer: LARGE_BUFFER,
234
- killSignal: "SIGTERM"
235
- });
236
- }, "run");
237
-
238
- // ../build-tools/src/utilities/get-entry-points.ts
239
-
240
-
241
- // ../build-tools/src/utilities/get-env.ts
242
- var getEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (builder, options) => {
243
- return {
244
- STORM_BUILD: builder,
245
- STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
246
- STORM_NAME: options.name,
247
- STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
248
- STORM_PLATFORM: options.platform,
249
- STORM_FORMAT: JSON.stringify(options.format),
250
- STORM_TARGET: JSON.stringify(options.target),
251
- ...options.env
252
- };
253
- }, "getEnv");
254
-
255
- // ../build-tools/src/utilities/read-nx-config.ts
256
-
257
-
258
-
259
- // ../build-tools/src/utilities/task-graph.ts
260
- var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
261
-
262
- // ../esbuild/src/build.ts
263
- var _chokidar = require('chokidar');
264
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
265
- var _estoolkit = require('es-toolkit');
266
- var _compat = require('es-toolkit/compat');
267
- var _esbuild = require('esbuild'); var esbuild2 = _interopRequireWildcard(_esbuild); var esbuild = _interopRequireWildcard(_esbuild);
268
- var _globby = require('globby');
269
-
270
-
271
- var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
272
-
273
- // ../esbuild/src/base/renderer-engine.ts
274
-
275
- var _sourcemap = require('source-map');
276
-
277
- // ../esbuild/src/utilities/output-file.ts
278
-
279
-
280
- var outputFile = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (filepath, data, options) => {
281
- await _fs2.default.promises.mkdir(_path2.default.dirname(filepath), {
282
- recursive: true
283
- });
284
- await _fs2.default.promises.writeFile(filepath, data, options);
285
- }, "outputFile");
286
-
287
- // ../esbuild/src/base/renderer-engine.ts
288
- var parseSourceMap = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (map2) => {
289
- return typeof map2 === "string" ? JSON.parse(map2) : map2;
290
- }, "parseSourceMap");
291
- var isJS = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (path6) => /\.(js|mjs|cjs)$/.test(path6), "isJS");
292
- var isCSS = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (path6) => /\.css$/.test(path6), "isCSS");
293
- var getSourcemapComment = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (inline, map2, filepath, isCssFile) => {
294
- if (!map2) return "";
295
- const prefix = isCssFile ? "/*" : "//";
296
- const suffix = isCssFile ? " */" : "";
297
- const url = inline ? `data:application/json;base64,${Buffer.from(typeof map2 === "string" ? map2 : JSON.stringify(map2)).toString("base64")}` : `${_path2.default.basename(filepath)}.map`;
298
- return `${prefix}# sourceMappingURL=${url}${suffix}`;
299
- }, "getSourcemapComment");
300
- var RendererEngine = class {
301
- static {
302
- _chunk3GQAWCBQjs.__name.call(void 0, this, "RendererEngine");
303
- }
304
- #renderers;
305
- #options;
306
- constructor(renderers) {
307
- this.#renderers = renderers;
308
- }
309
- setOptions(options) {
310
- this.#options = options;
311
- }
312
- getOptions() {
313
- if (!this.#options) {
314
- throw new Error(`Renderer options is not set`);
315
- }
316
- return this.#options;
317
- }
318
- modifyEsbuildOptions(options) {
319
- for (const renderer of this.#renderers) {
320
- if (renderer.esbuildOptions) {
321
- renderer.esbuildOptions.call(this.getOptions(), options);
322
- }
323
- }
324
- }
325
- async buildStarted() {
326
- for (const renderer of this.#renderers) {
327
- if (renderer.buildStart) {
328
- await renderer.buildStart.call(this.getOptions());
329
- }
330
- }
331
- }
332
- async buildFinished({ outputFiles, metafile }) {
333
- const files = outputFiles.filter((file) => !file.path.endsWith(".map")).map((file) => {
334
- if (isJS(file.path) || isCSS(file.path)) {
335
- let relativePath = _path2.default.relative(this.getOptions().config.workspaceRoot, file.path);
336
- if (!relativePath.startsWith("\\\\?\\")) {
337
- relativePath = relativePath.replace(/\\/g, "/");
338
- }
339
- const meta = _optionalChain([metafile, 'optionalAccess', _25 => _25.outputs, 'access', _26 => _26[relativePath]]);
340
- return {
341
- type: "chunk",
342
- path: file.path,
343
- code: file.text,
344
- map: _optionalChain([outputFiles, 'access', _27 => _27.find, 'call', _28 => _28((f) => f.path === `${file.path}.map`), 'optionalAccess', _29 => _29.text]),
345
- entryPoint: _optionalChain([meta, 'optionalAccess', _30 => _30.entryPoint]),
346
- exports: _optionalChain([meta, 'optionalAccess', _31 => _31.exports]),
347
- imports: _optionalChain([meta, 'optionalAccess', _32 => _32.imports])
348
- };
349
- } else {
350
- return {
351
- type: "asset",
352
- path: file.path,
353
- contents: file.contents
354
- };
355
- }
356
- });
357
- const writtenFiles = [];
358
- await Promise.all(files.map(async (info) => {
359
- for (const renderer of this.#renderers) {
360
- if (info.type === "chunk" && renderer.renderChunk) {
361
- const result = await renderer.renderChunk.call(this.getOptions(), info.code, info);
362
- if (result) {
363
- info.code = result.code;
364
- if (result.map) {
365
- const originalConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(info.map));
366
- const newConsumer = await new (0, _sourcemap.SourceMapConsumer)(parseSourceMap(result.map));
367
- const generator = _sourcemap.SourceMapGenerator.fromSourceMap(newConsumer);
368
- generator.applySourceMap(originalConsumer, info.path);
369
- info.map = generator.toJSON();
370
- originalConsumer.destroy();
371
- newConsumer.destroy();
372
- }
373
- }
374
- }
375
- }
376
- const inlineSourceMap = this.#options.sourcemap === "inline";
377
- const contents = info.type === "chunk" ? info.code + getSourcemapComment(inlineSourceMap, info.map, info.path, isCSS(info.path)) : info.contents;
378
- await outputFile(info.path, contents, {
379
- mode: info.type === "chunk" ? info.mode : void 0
380
- });
381
- writtenFiles.push({
382
- get name() {
383
- return _path2.default.relative(process.cwd(), info.path);
384
- },
385
- get size() {
386
- return contents.length;
387
- }
388
- });
389
- if (info.type === "chunk" && info.map && !inlineSourceMap) {
390
- const map2 = typeof info.map === "string" ? JSON.parse(info.map) : info.map;
391
- const outPath = `${info.path}.map`;
392
- const contents2 = JSON.stringify(map2);
393
- await outputFile(outPath, contents2);
394
- writtenFiles.push({
395
- get name() {
396
- return _path2.default.relative(process.cwd(), outPath);
397
- },
398
- get size() {
399
- return contents2.length;
400
- }
401
- });
402
- }
403
- }));
404
- for (const renderer of this.#renderers) {
405
- if (renderer.buildEnd) {
406
- await renderer.buildEnd.call(this.getOptions(), {
407
- writtenFiles
408
- });
409
- }
410
- }
411
- }
412
- };
413
-
414
- // ../esbuild/src/clean.ts
415
-
416
- async function cleanDirectories(name = "ESBuild", directory, config) {
417
- await _promises.rm.call(void 0, directory, {
418
- recursive: true,
419
- force: true
420
- });
421
- }
422
- _chunk3GQAWCBQjs.__name.call(void 0, cleanDirectories, "cleanDirectories");
423
-
424
- // ../esbuild/src/plugins/esm-split-code-to-cjs.ts
425
-
426
- var esmSplitCodeToCjsPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => ({
427
- name: "storm:esm-split-code-to-cjs",
428
- setup(build4) {
429
- build4.onEnd(async (result) => {
430
- const outFiles = Object.keys(_nullishCoalesce(_optionalChain([result, 'access', _33 => _33.metafile, 'optionalAccess', _34 => _34.outputs]), () => ( {})));
431
- const jsFiles = outFiles.filter((f) => f.endsWith("js"));
432
- await esbuild.build({
433
- outdir: resolvedOptions.outdir,
434
- entryPoints: jsFiles,
435
- allowOverwrite: true,
436
- format: "cjs",
437
- logLevel: "error",
438
- packages: "external"
439
- });
440
- });
441
- }
442
- }), "esmSplitCodeToCjsPlugin");
443
-
444
- // ../esbuild/src/plugins/fix-imports.ts
445
- var fixImportsPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => ({
446
- name: "storm:fix-imports",
447
- setup(build4) {
448
- build4.onResolve({
449
- filter: /^spdx-exceptions/
450
- }, () => {
451
- return {
452
- path: _chunk3GQAWCBQjs.__require.resolve("spdx-exceptions")
453
- };
454
- });
455
- build4.onResolve({
456
- filter: /^spdx-license-ids/
457
- }, () => {
458
- return {
459
- path: _chunk3GQAWCBQjs.__require.resolve("spdx-license-ids")
460
- };
461
- });
462
- }
463
- }), "fixImportsPlugin");
464
-
465
- // ../esbuild/src/plugins/native-node-module.ts
466
-
467
- var nativeNodeModulesPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => {
468
- return {
469
- name: "native-node-modules",
470
- setup(build4) {
471
- build4.onResolve({
472
- filter: /\.node$/,
473
- namespace: "file"
474
- }, (args) => {
475
- const resolvedId = _chunk3GQAWCBQjs.__require.resolve(args.path, {
476
- paths: [
477
- args.resolveDir
478
- ]
479
- });
480
- if (resolvedId.endsWith(".node")) {
481
- return {
482
- path: resolvedId,
483
- namespace: "node-file"
484
- };
485
- }
486
- return {
487
- path: resolvedId
488
- };
489
- });
490
- build4.onLoad({
491
- filter: /.*/,
492
- namespace: "node-file"
493
- }, (args) => {
494
- return {
495
- contents: `
496
- import path from ${JSON.stringify(args.path)}
497
- try { module.exports = require(path) }
498
- catch {}
499
- `,
500
- resolveDir: _path.dirname.call(void 0, args.path)
501
- };
502
- });
503
- build4.onResolve({
504
- filter: /\.node$/,
505
- namespace: "node-file"
506
- }, (args) => ({
507
- path: args.path,
508
- namespace: "file"
509
- }));
510
- const opts = build4.initialOptions;
511
- opts.loader = opts.loader || {};
512
- opts.loader[".node"] = "file";
513
- }
514
- };
515
- }, "nativeNodeModulesPlugin");
516
-
517
- // ../esbuild/src/plugins/node-protocol.ts
518
- var nodeProtocolPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => {
519
- const nodeProtocol = "node:";
520
- return {
521
- name: "node-protocol-plugin",
522
- setup({ onResolve }) {
523
- onResolve({
524
- filter: /^node:/
525
- }, ({ path: path6 }) => ({
526
- path: path6.slice(nodeProtocol.length),
527
- external: true
528
- }));
529
- }
530
- };
531
- }, "nodeProtocolPlugin");
532
-
533
- // ../esbuild/src/plugins/on-error.ts
534
- var onErrorPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => ({
535
- name: "storm:on-error",
536
- setup(build4) {
537
- build4.onEnd((result) => {
538
- if (result.errors.length > 0 && process.env.WATCH !== "true") {
539
- _chunkMP2P2MGPjs.writeError.call(void 0, `The following errors occurred during the build:
540
- ${result.errors.map((error) => error.text).join("\n")}
541
-
542
- `, resolvedOptions.config);
543
- throw new Error("Storm esbuild process failed with errors.");
544
- }
545
- });
546
- }
547
- }), "onErrorPlugin");
548
-
549
- // ../esbuild/src/plugins/resolve-paths.ts
550
-
551
- function resolvePathsConfig(options, cwd) {
552
- if (_optionalChain([options, 'optionalAccess', _35 => _35.compilerOptions, 'optionalAccess', _36 => _36.paths])) {
553
- const paths = Object.entries(options.compilerOptions.paths);
554
- const resolvedPaths = paths.map(([key, paths2]) => {
555
- return [
556
- key,
557
- paths2.map((v) => _path2.default.resolve(cwd, v))
558
- ];
559
- });
560
- return Object.fromEntries(resolvedPaths);
561
- }
562
- if (options.extends) {
563
- const extendsPath = _path2.default.resolve(cwd, options.extends);
564
- const extendsDir = _path2.default.dirname(extendsPath);
565
- const extendsConfig = _chunk3GQAWCBQjs.__require.call(void 0, extendsPath);
566
- return resolvePathsConfig(extendsConfig, extendsDir);
567
- }
568
- return [];
569
- }
570
- _chunk3GQAWCBQjs.__name.call(void 0, resolvePathsConfig, "resolvePathsConfig");
571
- var resolvePathsPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => ({
572
- name: "storm:resolve-paths",
573
- setup(build4) {
574
- const parentTsConfig = build4.initialOptions.tsconfig ? _chunk3GQAWCBQjs.__require.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, build4.initialOptions.tsconfig)) : _chunk3GQAWCBQjs.__require.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, "tsconfig.json"));
575
- const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
576
- const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
577
- build4.onResolve({
578
- filter: packagesRegex
579
- }, (args) => {
580
- if (_optionalChain([build4, 'access', _37 => _37.initialOptions, 'access', _38 => _38.external, 'optionalAccess', _39 => _39.includes, 'call', _40 => _40(args.path)])) {
581
- return {
582
- path: args.path,
583
- external: true
584
- };
585
- }
586
- return {
587
- path: `${resolvedTsPaths[args.path][0]}/index.ts`
588
- };
589
- });
590
- }
591
- }), "resolvePathsPlugin");
592
-
593
- // ../esbuild/src/plugins/tsc.ts
594
- var _apiextractor = require('@microsoft/api-extractor');
595
-
596
-
597
- function bundleTypeDefinitions(filename, outfile, externals, options) {
598
- const { dependencies, peerDependencies, devDependencies } = _chunk3GQAWCBQjs.__require.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, options.projectRoot, "package.json"));
599
- const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
600
- p,
601
- getTypeDependencyPackageName(p)
602
- ]);
603
- const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
604
- p,
605
- getTypeDependencyPackageName(p)
606
- ]);
607
- const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
608
- p,
609
- getTypeDependencyPackageName(p)
610
- ]);
611
- const includeDeps = devDependenciesKeys;
612
- const excludeDeps = /* @__PURE__ */ new Set([
613
- ...dependenciesKeys,
614
- ...peerDependenciesKeys,
615
- ...externals
616
- ]);
617
- const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
618
- const extractorConfig = _apiextractor.ExtractorConfig.prepare({
619
- configObject: {
620
- projectFolder: options.projectRoot,
621
- mainEntryPointFilePath: filename,
622
- bundledPackages,
623
- compiler: {
624
- tsconfigFilePath: options.tsconfig,
625
- overrideTsconfig: {
626
- compilerOptions: {
627
- paths: {}
628
- // bug with api extract + paths
629
- }
630
- }
631
- },
632
- dtsRollup: {
633
- enabled: true,
634
- untrimmedFilePath: _chunkJTAXCQX6js.joinPaths.call(void 0, options.outdir, `${outfile}.d.ts`)
635
- },
636
- tsdocMetadata: {
637
- enabled: false
638
- }
639
- },
640
- packageJsonFullPath: _chunkJTAXCQX6js.joinPaths.call(void 0, options.projectRoot, "package.json"),
641
- configObjectFullPath: void 0
642
- });
643
- const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
644
- showVerboseMessages: true,
645
- localBuild: true
646
- });
647
- if (extractorResult.succeeded === false) {
648
- _chunkMP2P2MGPjs.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
649
- throw new Error("API Extractor completed with errors");
650
- }
651
- }
652
- _chunk3GQAWCBQjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
653
- var tscPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => ({
654
- name: "storm:tsc",
655
- setup(build4) {
656
- if (options.dts === false) {
657
- return;
658
- }
659
- build4.onStart(async () => {
660
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
661
- await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
662
- }
663
- if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && _optionalChain([resolvedOptions, 'access', _41 => _41.entryPoints, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.in]) && resolvedOptions.entryPoints[0].in.endsWith(".ts")) {
664
- const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
665
- const typeOutDir = resolvedOptions.outdir;
666
- const entryPoint = resolvedOptions.entryPoints[0].in.replace(sourceRoot, "").replace(/\.ts$/, "");
667
- const bundlePath = _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.outdir, entryPoint);
668
- let dtsPath;
669
- if (_fs.existsSync.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
670
- dtsPath = _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
671
- } else if (_fs.existsSync.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
672
- dtsPath = _chunkJTAXCQX6js.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
673
- }
674
- const ext = resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
675
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
676
- bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(resolvedOptions.external, () => ( [])), resolvedOptions);
677
- const dtsContents = await _promises2.default.readFile(`${bundlePath}.d.ts`, "utf8");
678
- await _promises2.default.writeFile(`${bundlePath}.${ext}`, dtsContents);
679
- } else {
680
- await _promises2.default.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
681
- }
682
- }
683
- });
684
- }
685
- }), "tscPlugin");
686
- function getTypeDependencyPackageName(npmPackage) {
687
- if (npmPackage.startsWith("@")) {
688
- const [scope, name] = npmPackage.split("/");
689
- return `@types/${_optionalChain([scope, 'optionalAccess', _44 => _44.slice, 'call', _45 => _45(1)])}__${name}`;
690
- }
691
- return `@types/${npmPackage}`;
692
- }
693
- _chunk3GQAWCBQjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
694
-
695
- // ../esbuild/src/config.ts
696
- var getDefaultBuildPlugins = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options, resolvedOptions) => [
697
- nodeProtocolPlugin(options, resolvedOptions),
698
- resolvePathsPlugin(options, resolvedOptions),
699
- fixImportsPlugin(options, resolvedOptions),
700
- nativeNodeModulesPlugin(options, resolvedOptions),
701
- esmSplitCodeToCjsPlugin(options, resolvedOptions),
702
- tscPlugin(options, resolvedOptions),
703
- onErrorPlugin(options, resolvedOptions)
704
- ], "getDefaultBuildPlugins");
705
- var DEFAULT_BUILD_OPTIONS = {
706
- platform: "node",
707
- target: "node22",
708
- format: "esm",
709
- external: [],
710
- logLevel: "error",
711
- tsconfig: "tsconfig.json",
712
- mode: "production",
713
- keepNames: true,
714
- metafile: true,
715
- injectShims: true,
716
- color: true,
717
- watch: false,
718
- bundle: true,
719
- clean: true,
720
- debug: false,
721
- resolveExtensions: [
722
- ".tsx",
723
- ".ts",
724
- ".cts",
725
- ".mts",
726
- ".jsx",
727
- ".js",
728
- ".cjs",
729
- ".mjs",
730
- ".css",
731
- ".json"
732
- ],
733
- loader: {
734
- ".aac": "file",
735
- ".css": "file",
736
- ".eot": "file",
737
- ".flac": "file",
738
- ".gif": "file",
739
- ".jpeg": "file",
740
- ".jpg": "file",
741
- ".mp3": "file",
742
- ".mp4": "file",
743
- ".ogg": "file",
744
- ".otf": "file",
745
- ".png": "file",
746
- ".svg": "file",
747
- ".ttf": "file",
748
- ".wav": "file",
749
- ".webm": "file",
750
- ".webp": "file",
751
- ".woff": "file",
752
- ".woff2": "file"
753
- },
754
- banner: DEFAULT_COMPILED_BANNER
755
- };
756
-
757
- // ../esbuild/src/plugins/deps-check.ts
758
-
759
-
760
- var unusedIgnore = [
761
- // these are our dev dependencies
762
- /@types\/.*?/,
763
- /@typescript-eslint.*?/,
764
- /eslint.*?/,
765
- "esbuild",
766
- "husky",
767
- "is-ci",
768
- "lint-staged",
769
- "prettier",
770
- "typescript",
771
- "ts-node",
772
- "ts-jest",
773
- "@swc/core",
774
- "@swc/jest",
775
- "jest",
776
- // these are missing 3rd party deps
777
- "spdx-exceptions",
778
- "spdx-license-ids",
779
- // type-only, so it is not detected
780
- "ts-toolbelt",
781
- // these are indirectly used by build
782
- "buffer"
783
- ];
784
- var missingIgnore = [
785
- ".prisma",
786
- "@prisma/client",
787
- "ts-toolbelt"
788
- ];
789
- var depsCheckPlugin = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (bundle) => ({
790
- name: "storm:deps-check",
791
- setup(build4) {
792
- const pkgJsonPath = _path2.default.join(process.cwd(), "package.json");
793
- const pkgContents = _chunk3GQAWCBQjs.__require.call(void 0, pkgJsonPath);
794
- const regDependencies = Object.keys(_nullishCoalesce(pkgContents["dependencies"], () => ( {})));
795
- const devDependencies = Object.keys(_nullishCoalesce(pkgContents["devDependencies"], () => ( {})));
796
- const peerDependencies = Object.keys(_nullishCoalesce(pkgContents["peerDependencies"], () => ( {})));
797
- const dependencies = [
798
- ...regDependencies,
799
- ...bundle ? devDependencies : []
800
- ];
801
- const collectedDependencies = /* @__PURE__ */ new Set();
802
- const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
803
- build4.onResolve({
804
- filter: onlyPackages
805
- }, (args) => {
806
- if (args.importer.includes(process.cwd())) {
807
- if (args.path[0] === "@") {
808
- const [org, pkg] = args.path.split("/");
809
- collectedDependencies.add(`${org}/${pkg}`);
810
- } else {
811
- const [pkg] = args.path.split("/");
812
- collectedDependencies.add(pkg);
813
- }
814
- }
815
- return {
816
- external: true
817
- };
818
- });
819
- build4.onEnd(() => {
820
- const unusedDependencies = [
821
- ...dependencies
822
- ].filter((dep) => {
823
- return !collectedDependencies.has(dep) || _module.builtinModules.includes(dep);
824
- });
825
- const missingDependencies = [
826
- ...collectedDependencies
827
- ].filter((dep) => {
828
- return !dependencies.includes(dep) && !_module.builtinModules.includes(dep);
829
- });
830
- const filteredUnusedDeps = unusedDependencies.filter((dep) => {
831
- return !unusedIgnore.some((pattern) => dep.match(pattern));
832
- });
833
- const filteredMissingDeps = missingDependencies.filter((dep) => {
834
- return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
835
- });
836
- _chunkMP2P2MGPjs.writeWarning.call(void 0, `Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`);
837
- _chunkMP2P2MGPjs.writeError.call(void 0, `Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`);
838
- if (filteredMissingDeps.length > 0) {
839
- throw new Error(`Missing dependencies detected - please install them:
840
- ${JSON.stringify(filteredMissingDeps)}
841
- `);
842
- }
843
- });
844
- }
845
- }), "depsCheckPlugin");
846
-
847
- // ../esbuild/src/renderers/shebang.ts
848
- var shebangRenderer = {
849
- name: "shebang",
850
- renderChunk(_, __, info) {
851
- if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
852
- info.mode = 493;
853
- }
854
- }
855
- };
856
-
857
- // ../esbuild/src/tsc.ts
858
- var _bundlerequire = require('bundle-require');
859
-
860
-
861
-
862
- var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
863
- function ensureTempDeclarationDir(workspaceConfig) {
864
- const root = workspaceConfig.directories.temp || _path.join.call(void 0, workspaceConfig.workspaceRoot, "tmp");
865
- const dirPath = _path.join.call(void 0, root, ".tsc", "declaration");
866
- if (_fs.existsSync.call(void 0, dirPath)) {
867
- return dirPath;
868
- }
869
- _fs.mkdirSync.call(void 0, dirPath, {
870
- recursive: true
871
- });
872
- const gitIgnorePath = _path.join.call(void 0, root, ".tsc", ".gitignore");
873
- _fs.writeFileSync.call(void 0, gitIgnorePath, "**/*\n");
874
- return dirPath;
875
- }
876
- _chunk3GQAWCBQjs.__name.call(void 0, ensureTempDeclarationDir, "ensureTempDeclarationDir");
877
- function slash(path6) {
878
- const isExtendedLengthPath = path6.startsWith("\\\\?\\");
879
- if (isExtendedLengthPath) {
880
- return path6;
881
- }
882
- return path6.replace(/\\/g, "/");
883
- }
884
- _chunk3GQAWCBQjs.__name.call(void 0, slash, "slash");
885
- function toAbsolutePath(workspaceConfig, p, cwd) {
886
- if (_path.isAbsolute.call(void 0, p)) {
887
- return p;
888
- }
889
- return slash(_path.normalize.call(void 0, _path.join.call(void 0, cwd || workspaceConfig.workspaceRoot, p)));
890
- }
891
- _chunk3GQAWCBQjs.__name.call(void 0, toAbsolutePath, "toAbsolutePath");
892
- var AliasPool = (_class = class AliasPool2 {constructor() { _class.prototype.__init.call(this); }
893
- static {
894
- _chunk3GQAWCBQjs.__name.call(void 0, this, "AliasPool");
895
- }
896
- __init() {this.seen = /* @__PURE__ */ new Set()}
897
- assign(name) {
898
- let suffix = 0;
899
- let alias = name === "default" ? "default_alias" : name;
900
- while (this.seen.has(alias)) {
901
- alias = `${name}_alias_${++suffix}`;
902
- if (suffix >= 1e3) {
903
- throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
904
- }
905
- }
906
- this.seen.add(alias);
907
- return alias;
908
- }
909
- }, _class);
910
- function getExports(workspaceConfig, program, fileMapping) {
911
- const checker = program.getTypeChecker();
912
- const aliasPool = new AliasPool();
913
- const assignAlias = aliasPool.assign.bind(aliasPool);
914
- function extractExports(sourceFileName) {
915
- const cwd = program.getCurrentDirectory();
916
- sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
917
- const sourceFile = program.getSourceFile(sourceFileName);
918
- if (!sourceFile) {
919
- return [];
920
- }
921
- const destFileName = fileMapping.get(sourceFileName);
922
- if (!destFileName) {
923
- return [];
924
- }
925
- const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
926
- if (!moduleSymbol) {
927
- return [];
928
- }
929
- const exports = [];
930
- const exportSymbols = checker.getExportsOfModule(moduleSymbol);
931
- exportSymbols.forEach((symbol) => {
932
- const name = symbol.getName();
933
- exports.push({
934
- kind: "named",
935
- sourceFileName,
936
- destFileName,
937
- name,
938
- alias: assignAlias(name),
939
- isTypeOnly: false
940
- });
941
- });
942
- return exports;
943
- }
944
- _chunk3GQAWCBQjs.__name.call(void 0, extractExports, "extractExports");
945
- return program.getRootFileNames().flatMap(extractExports);
946
- }
947
- _chunk3GQAWCBQjs.__name.call(void 0, getExports, "getExports");
948
- function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
949
- const fileMapping = /* @__PURE__ */ new Map();
950
- const writeFile2 = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
951
- const sourceFile = _optionalChain([sourceFiles, 'optionalAccess', _46 => _46[0]]);
952
- const sourceFileName = _optionalChain([sourceFile, 'optionalAccess', _47 => _47.fileName]);
953
- if (sourceFileName && !fileName.endsWith(".map")) {
954
- const cwd = program.getCurrentDirectory();
955
- fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
956
- }
957
- return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
958
- }, "writeFile");
959
- const emitResult = program.emit(void 0, writeFile2, void 0, emitOnlyDtsFiles, customTransformers);
960
- const diagnostics = _typescript2.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
961
- const diagnosticMessages = [];
962
- diagnostics.forEach((diagnostic) => {
963
- if (diagnostic.file) {
964
- const { line, character } = _typescript2.default.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
965
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
966
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
967
- } else {
968
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
969
- diagnosticMessages.push(message);
970
- }
971
- });
972
- const diagnosticMessage = diagnosticMessages.join("\n");
973
- if (diagnosticMessage) {
974
- _chunkMP2P2MGPjs.writeError.call(void 0, `Failed to emit declaration files.
975
-
976
- ${diagnosticMessage}`, workspaceConfig);
977
- throw new Error("TypeScript compilation failed");
978
- }
979
- return fileMapping;
980
- }
981
- _chunk3GQAWCBQjs.__name.call(void 0, emitDtsFiles, "emitDtsFiles");
982
- function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
983
- const rawTsconfig = _bundlerequire.loadTsConfig.call(void 0, workspaceConfig.workspaceRoot, tsconfig);
984
- if (!rawTsconfig) {
985
- throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
986
- }
987
- const declarationDir = ensureTempDeclarationDir(workspaceConfig);
988
- const parsedTsconfig = _typescript2.default.parseJsonConfigFileContent(_defu2.default.call(void 0, {
989
- compilerOptions: {
990
- // Enable declaration emit and disable javascript emit
991
- noEmit: false,
992
- declaration: true,
993
- declarationMap: true,
994
- declarationDir,
995
- emitDeclarationOnly: true
996
- }
997
- }, _nullishCoalesce(_optionalChain([tsconfigRaw, 'optionalAccess', _48 => _48.compilerOptions]), () => ( {})), _nullishCoalesce(rawTsconfig.data, () => ( {}))), _typescript2.default.sys, tsconfig ? _path.dirname.call(void 0, tsconfig) : "./");
998
- const options = parsedTsconfig.options;
999
- const host = _typescript2.default.createCompilerHost(options);
1000
- const program = _typescript2.default.createProgram(parsedTsconfig.fileNames, options, host);
1001
- const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
1002
- return getExports(workspaceConfig, program, fileMapping);
1003
- }
1004
- _chunk3GQAWCBQjs.__name.call(void 0, emitDts, "emitDts");
1005
-
1006
- // ../esbuild/src/utilities/get-entry-points.ts
1007
-
1008
- var getEntryPoints = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
1009
- const workspaceRoot = config.workspaceRoot || _chunk4JOIS7WWjs.findWorkspaceRoot.call(void 0, );
1010
- const entryPoints = [];
1011
- if (entry) {
1012
- if (typeof entry === "string") {
1013
- entryPoints.push({
1014
- in: entry,
1015
- out: entry
1016
- });
1017
- } else if (Array.isArray(entry)) {
1018
- entryPoints.push(...entry.map((entry2) => ({
1019
- in: entry2,
1020
- out: entry2
1021
- })));
1022
- } else {
1023
- entryPoints.push(...Object.entries(entry).map(([key, value]) => {
1024
- if (typeof value === "string") {
1025
- return {
1026
- in: value,
1027
- out: key
1028
- };
1029
- } else {
1030
- return {
1031
- in: key,
1032
- out: key
1033
- };
1034
- }
1035
- }));
1036
- }
1037
- }
1038
- if (emitOnAll) {
1039
- entryPoints.push({
1040
- in: _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}"),
1041
- out: _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}")
1042
- });
1043
- }
1044
- const results = await Promise.all(entryPoints.map(async (entryPoint) => {
1045
- const paths = [];
1046
- if (entryPoint.in.includes("*")) {
1047
- const files = await _glob.glob.call(void 0, entryPoint.in, {
1048
- withFileTypes: true,
1049
- ignore: [
1050
- "**/node_modules/**"
1051
- ]
1052
- });
1053
- paths.push(...files.reduce((ret, filePath) => {
1054
- const result = _chunkJTAXCQX6js.correctPaths.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunkJTAXCQX6js.correctPaths.call(void 0, workspaceRoot), "").replaceAll(_chunkJTAXCQX6js.correctPaths.call(void 0, projectRoot), ""));
1055
- if (result) {
1056
- _chunkMP2P2MGPjs.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunkJTAXCQX6js.joinPaths.call(void 0, filePath.path, filePath.name)}"`, config);
1057
- if (!paths.some((p) => p.in === result)) {
1058
- paths.push({
1059
- in: result,
1060
- out: entryPoint.out.replace(entryPoint.in, result)
1061
- });
1062
- }
1063
- }
1064
- return ret;
1065
- }, []));
1066
- } else {
1067
- _chunkMP2P2MGPjs.writeDebug.call(void 0, `Adding ESBuild entry point
1068
- - Input: ${entryPoint.in}
1069
- - Output: ${entryPoint.out}`, config);
1070
- if (!paths.some((p) => p.out === entryPoint.out)) {
1071
- paths.push(entryPoint);
1072
- }
1073
- }
1074
- return paths;
1075
- }));
1076
- return results.filter(Boolean).reduce((ret, result) => {
1077
- result.forEach((res) => {
1078
- if (res && !ret.some((p) => p.in === res.in)) {
1079
- ret.push(res);
1080
- }
1081
- });
1082
- return ret;
1083
- }, []);
1084
- }, "getEntryPoints");
1085
-
1086
- // ../esbuild/src/utilities/helpers.ts
1087
- function handleSync(fn) {
1088
- try {
1089
- return fn();
1090
- } catch (error_) {
1091
- return error_;
1092
- }
1093
- }
1094
- _chunk3GQAWCBQjs.__name.call(void 0, handleSync, "handleSync");
1095
- async function handleAsync(fn) {
1096
- try {
1097
- return await fn();
1098
- } catch (error_) {
1099
- return error_;
1100
- }
1101
- }
1102
- _chunk3GQAWCBQjs.__name.call(void 0, handleAsync, "handleAsync");
1103
- var handle = handleSync;
1104
- handle.async = handleAsync;
1105
- var skip = Symbol("skip");
1106
- function transduceSync(list, transformer) {
1107
- const transduced = [];
1108
- for (const [i, element_] of list.entries()) {
1109
- const transformed = transformer(element_, i);
1110
- if (transformed !== skip) {
1111
- transduced[transduced.length] = transformed;
1112
- }
1113
- }
1114
- return transduced;
1115
- }
1116
- _chunk3GQAWCBQjs.__name.call(void 0, transduceSync, "transduceSync");
1117
- async function transduceAsync(list, transformer) {
1118
- const transduced = [];
1119
- await Promise.all(list.entries().map(async ([i, element_]) => {
1120
- const transformed = await transformer(element_, i);
1121
- if (transformed !== skip) {
1122
- transduced[transduced.length] = transformed;
1123
- }
1124
- }));
1125
- return transduced;
1126
- }
1127
- _chunk3GQAWCBQjs.__name.call(void 0, transduceAsync, "transduceAsync");
1128
- var transduce = transduceSync;
1129
- transduce.async = transduceAsync;
1130
- function pipeSync(fn, ...fns) {
1131
- return (...args) => {
1132
- let result = fn(...args);
1133
- for (let i = 0; result !== skip && i < fns.length; ++i) {
1134
- result = _optionalChain([fns, 'access', _49 => _49[i], 'optionalCall', _50 => _50(result)]);
1135
- }
1136
- return result;
1137
- };
1138
- }
1139
- _chunk3GQAWCBQjs.__name.call(void 0, pipeSync, "pipeSync");
1140
- function pipeAsync(fn, ...fns) {
1141
- return async (...args) => {
1142
- let result = await fn(...args);
1143
- for (let i = 0; result !== skip && i < fns.length; ++i) {
1144
- result = await _optionalChain([fns, 'access', _51 => _51[i], 'optionalCall', _52 => _52(result)]);
1145
- }
1146
- return result;
1147
- };
1148
- }
1149
- _chunk3GQAWCBQjs.__name.call(void 0, pipeAsync, "pipeAsync");
1150
- var pipe = pipeSync;
1151
- pipe.async = pipeAsync;
1152
-
1153
- // ../esbuild/src/build.ts
1154
- var resolveOptions = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (userOptions) => {
1155
- const projectRoot = userOptions.projectRoot;
1156
- const workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
1157
- if (!workspaceRoot) {
1158
- throw new Error("Cannot find Nx workspace root");
1159
- }
1160
- const config = await _chunkMP2P2MGPjs.getConfig.call(void 0, workspaceRoot.dir);
1161
- _chunkMP2P2MGPjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
1162
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, "Build options resolution");
1163
- const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
1164
- exitOnError: true
1165
- });
1166
- const projectJsonPath = _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot.dir, projectRoot, "project.json");
1167
- if (!_fs.existsSync.call(void 0, projectJsonPath)) {
1168
- throw new Error("Cannot find project.json configuration");
1169
- }
1170
- const projectJsonFile = await _promises2.default.readFile(projectJsonPath, "utf8");
1171
- const projectJson = JSON.parse(projectJsonFile);
1172
- const projectName = projectJson.name;
1173
- const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
1174
- if (!_optionalChain([projectConfigurations, 'optionalAccess', _53 => _53.projects, 'optionalAccess', _54 => _54[projectName]])) {
1175
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
1176
- }
1177
- const options = _defu2.default.call(void 0, userOptions, DEFAULT_BUILD_OPTIONS);
1178
- options.name ??= `${projectName}-${options.format}`;
1179
- options.target ??= DEFAULT_TARGET;
1180
- const packageJsonPath = _chunkJTAXCQX6js.joinPaths.call(void 0, workspaceRoot.dir, options.projectRoot, "package.json");
1181
- if (!_fs.existsSync.call(void 0, packageJsonPath)) {
1182
- throw new Error("Cannot find package.json configuration");
1183
- }
1184
- const env = getEnv("esbuild", options);
1185
- const result = {
1186
- ...options,
1187
- config,
1188
- mainFields: options.platform === "node" ? [
1189
- "module",
1190
- "main"
1191
- ] : [
1192
- "browser",
1193
- "module",
1194
- "main"
1195
- ],
1196
- ...userOptions,
1197
- tsconfig: _chunkJTAXCQX6js.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
1198
- format: options.format || "cjs",
1199
- entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, _nullishCoalesce(userOptions.entry, () => ( "./src/index.ts")), false),
1200
- outdir: userOptions.outputPath || _chunkJTAXCQX6js.joinPaths.call(void 0, "dist", projectRoot),
1201
- distDir: userOptions.distDir || "dist",
1202
- plugins: [],
1203
- name: userOptions.name || projectName,
1204
- projectConfigurations,
1205
- projectName,
1206
- projectGraph,
1207
- sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || _chunkJTAXCQX6js.joinPaths.call(void 0, projectRoot, "src"),
1208
- minify: userOptions.minify || !userOptions.debug,
1209
- verbose: userOptions.verbose || _chunkMP2P2MGPjs.isVerbose.call(void 0, ) || userOptions.debug === true,
1210
- includeSrc: userOptions.includeSrc === true,
1211
- metafile: userOptions.metafile !== false,
1212
- generatePackageJson: userOptions.generatePackageJson !== false,
1213
- clean: userOptions.clean !== false,
1214
- assets: _nullishCoalesce(userOptions.assets, () => ( [])),
1215
- injectShims: userOptions.injectShims !== true,
1216
- bundle: userOptions.bundle !== false,
1217
- keepNames: true,
1218
- watch: userOptions.watch === true,
1219
- footer: userOptions.footer,
1220
- banner: {
1221
- js: options.banner || DEFAULT_COMPILED_BANNER,
1222
- css: options.banner || DEFAULT_COMPILED_BANNER
1223
- },
1224
- splitting: options.format === "iife" ? false : typeof options.splitting === "boolean" ? options.splitting : options.format === "esm",
1225
- treeShaking: options.format === "esm",
1226
- env,
1227
- define: {
1228
- STORM_FORMAT: JSON.stringify(options.format || "cjs"),
1229
- ...options.format === "cjs" && options.injectShims ? {
1230
- "import.meta.url": "importMetaUrl"
1231
- } : {},
1232
- ...options.define,
1233
- ...Object.keys(env || {}).reduce((res, key) => {
1234
- const value = JSON.stringify(env[key]);
1235
- const safeKey = key.replaceAll("(", "").replaceAll(")", "");
1236
- return {
1237
- ...res,
1238
- [`process.env.${safeKey}`]: value,
1239
- [`import.meta.env.${safeKey}`]: value
1240
- };
1241
- }, {})
1242
- },
1243
- inject: [
1244
- options.format === "cjs" && options.injectShims ? _chunkJTAXCQX6js.joinPaths.call(void 0, __dirname, "../assets/cjs_shims.js") : void 0,
1245
- options.format === "esm" && options.injectShims && options.platform === "node" ? _chunkJTAXCQX6js.joinPaths.call(void 0, __dirname, "../assets/esm_shims.js") : void 0
1246
- ].filter(Boolean)
1247
- };
1248
- result.plugins = _nullishCoalesce(userOptions.plugins, () => ( getDefaultBuildPlugins(userOptions, result)));
1249
- if (options.inject && Array.isArray(options.inject) && options.inject.length > 0) {
1250
- result.inject = options.inject.reduce((ret, inj) => {
1251
- if (inj && typeof inj === "string" && ret.includes(inj)) {
1252
- ret.push(inj);
1253
- }
1254
- return ret;
1255
- }, result.inject);
1256
- }
1257
- delete result.entry;
1258
- delete result.outputPath;
1259
- stopwatch();
1260
- return result;
1261
- }, "resolveOptions");
1262
- async function generatePackageJson(context2) {
1263
- if (context2.options.generatePackageJson !== false && _fs.existsSync.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, context2.options.projectRoot, "package.json"))) {
1264
- _chunkMP2P2MGPjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", context2.options.config);
1265
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, "Write package.json file");
1266
- const packageJsonPath = _chunkJTAXCQX6js.joinPaths.call(void 0, context2.options.projectRoot, "project.json");
1267
- if (!_fs.existsSync.call(void 0, packageJsonPath)) {
1268
- throw new Error("Cannot find package.json configuration");
1269
- }
1270
- const packageJsonFile = await _promises2.default.readFile(_chunkJTAXCQX6js.joinPaths.call(void 0, context2.options.config.workspaceRoot, context2.options.projectRoot, "package.json"), "utf8");
1271
- let packageJson = JSON.parse(packageJsonFile);
1272
- if (!packageJson) {
1273
- throw new Error("Cannot find package.json configuration file");
1274
- }
1275
- packageJson = await addPackageDependencies(context2.options.config.workspaceRoot, context2.options.projectRoot, context2.options.projectName, packageJson);
1276
- packageJson = await addWorkspacePackageJsonFields(context2.options.config, context2.options.projectRoot, context2.options.sourceRoot, context2.options.projectName, false, packageJson);
1277
- packageJson.exports ??= {};
1278
- packageJson.exports["./package.json"] ??= "./package.json";
1279
- packageJson.exports["."] ??= `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js`;
1280
- for (const entryPoint of context2.options.entryPoints) {
1281
- if (entryPoint.out) {
1282
- const entry = entryPoint.out.replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
1283
- packageJson.exports[`./${entry}`] ??= `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/${entry}.js`;
1284
- }
1285
- }
1286
- if (context2.options.format === "esm") {
1287
- packageJson.module = packageJson.type === "module" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.mjs`;
1288
- } else {
1289
- packageJson.main = packageJson.type === "commonjs" ? `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.js` : `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.cjs`;
1290
- }
1291
- packageJson.types = `.${context2.options.distDir ? `/${context2.options.distDir}` : ""}/index.d.ts`;
1292
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1293
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1294
- ret[key.replace("/index", "")] = packageJson.exports[key];
1295
- }
1296
- return ret;
1297
- }, packageJson.exports);
1298
- await _devkit.writeJsonFile.call(void 0, _chunkJTAXCQX6js.joinPaths.call(void 0, context2.options.outdir, "package.json"), packageJson);
1299
- stopwatch();
1300
- }
1301
- return context2;
1302
- }
1303
- _chunk3GQAWCBQjs.__name.call(void 0, generatePackageJson, "generatePackageJson");
1304
- async function createOptions(options) {
1305
- return _estoolkit.flatten.call(void 0, await Promise.all(_compat.map.call(void 0, options, (opt) => [
1306
- // we defer it so that we don't trigger glob immediately
1307
- () => resolveOptions(opt)
1308
- ])));
1309
- }
1310
- _chunk3GQAWCBQjs.__name.call(void 0, createOptions, "createOptions");
1311
- async function generateContext(getOptions) {
1312
- const options = await getOptions();
1313
- const rendererEngine = new RendererEngine([
1314
- shebangRenderer,
1315
- ...options.renderers || []
1316
- ]);
1317
- return {
1318
- options,
1319
- rendererEngine
1320
- };
1321
- }
1322
- _chunk3GQAWCBQjs.__name.call(void 0, generateContext, "generateContext");
1323
- async function executeEsBuild(context2) {
1324
- _chunkMP2P2MGPjs.writeDebug.call(void 0, ` \u{1F680} Running ${context2.options.name} build`, context2.options.config);
1325
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, `${context2.options.name} build`);
1326
- if (process.env.STORM_WATCH) {
1327
- const ctx = await esbuild2.context(context2.options);
1328
- watch(ctx, context2.options);
1329
- }
1330
- const options = {
1331
- ...context2.options
1332
- };
1333
- options.outdir = _chunkJTAXCQX6js.joinPaths.call(void 0, context2.options.outdir, context2.options.distDir);
1334
- if (!options.inject || !Array.isArray(options.inject) || options.inject.length === 0 || // eslint-disable-next-line no-constant-binary-expression, @typescript-eslint/no-explicit-any
1335
- options.inject === {}) {
1336
- delete options.inject;
1337
- }
1338
- delete options.dts;
1339
- delete options.env;
1340
- delete options.name;
1341
- delete options.assets;
1342
- delete options.mode;
1343
- delete options.orgName;
1344
- delete options.watch;
1345
- delete options.clean;
1346
- delete options.debug;
1347
- delete options.generatePackageJson;
1348
- delete options.distDir;
1349
- delete options.includeSrc;
1350
- delete options.verbose;
1351
- delete options.projectRoot;
1352
- delete options.projectName;
1353
- delete options.projectGraph;
1354
- delete options.projectConfigurations;
1355
- delete options.renderers;
1356
- delete options.config;
1357
- delete options.injectShims;
1358
- delete options.external;
1359
- _chunkMP2P2MGPjs.writeTrace.call(void 0, `Run esbuild (${context2.options.name}) with the following options:
1360
- ${_chunkMP2P2MGPjs.formatLogMessage.call(void 0, {
1361
- ...options,
1362
- define: "<Hidden>"
1363
- })}`, context2.options.config);
1364
- const result = await esbuild2.build(options);
1365
- await esbuild2.stop();
1366
- if (result.metafile) {
1367
- const metafilePath = `${context2.options.outdir}/${context2.options.name}.meta.json`;
1368
- await _promises2.default.writeFile(metafilePath, JSON.stringify(result.metafile));
1369
- }
1370
- stopwatch();
1371
- return context2;
1372
- }
1373
- _chunk3GQAWCBQjs.__name.call(void 0, executeEsBuild, "executeEsBuild");
1374
- async function executeTypescript(context2) {
1375
- if (_optionalChain([context2, 'access', _55 => _55.result, 'optionalAccess', _56 => _56.errors, 'access', _57 => _57.length]) === 0 && context2.options.dts) {
1376
- _chunkMP2P2MGPjs.writeDebug.call(void 0, ` \u{1F4CB} Running TypeScript Compiler for ${context2.options.name}`, context2.options.config);
1377
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, `${context2.options.name} asset copy`);
1378
- await emitDts(context2.options.config, context2.options.tsconfig, context2.options.tsconfigRaw, true);
1379
- stopwatch();
1380
- }
1381
- return context2;
1382
- }
1383
- _chunk3GQAWCBQjs.__name.call(void 0, executeTypescript, "executeTypescript");
1384
- async function copyBuildAssets(context2) {
1385
- if (_optionalChain([context2, 'access', _58 => _58.result, 'optionalAccess', _59 => _59.errors, 'access', _60 => _60.length]) === 0) {
1386
- _chunkMP2P2MGPjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${context2.options.outdir}`, context2.options.config);
1387
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, `${context2.options.name} asset copy`);
1388
- await copyAssets(context2.options.config, _nullishCoalesce(context2.options.assets, () => ( [])), context2.options.outdir, context2.options.projectRoot, context2.options.sourceRoot, true, false);
1389
- stopwatch();
1390
- }
1391
- return context2;
1392
- }
1393
- _chunk3GQAWCBQjs.__name.call(void 0, copyBuildAssets, "copyBuildAssets");
1394
- async function reportResults(context2) {
1395
- if (_optionalChain([context2, 'access', _61 => _61.result, 'optionalAccess', _62 => _62.errors, 'access', _63 => _63.length]) === 0) {
1396
- if (context2.result.warnings.length > 0) {
1397
- _chunkMP2P2MGPjs.writeWarning.call(void 0, ` \u{1F6A7} The following warnings occurred during the build: ${context2.result.warnings.map((warning) => warning.text).join("\n")}`, context2.options.config);
1398
- }
1399
- _chunkMP2P2MGPjs.writeSuccess.call(void 0, ` \u{1F4E6} The ${context2.options.name} build completed successfully`, context2.options.config);
1400
- } else if (_optionalChain([context2, 'access', _64 => _64.result, 'optionalAccess', _65 => _65.errors]) && _optionalChain([context2, 'access', _66 => _66.result, 'optionalAccess', _67 => _67.errors, 'access', _68 => _68.length]) > 0) {
1401
- _chunkMP2P2MGPjs.writeError.call(void 0, ` \u274C The ${context2.options.name} build failed with the following errors: ${context2.result.errors.map((error) => error.text).join("\n")}`, context2.options.config);
1402
- throw new Error(`The ${context2.options.name} build failed with the following errors: ${context2.result.errors.map((error) => error.text).join("\n")}`);
1403
- }
1404
- }
1405
- _chunk3GQAWCBQjs.__name.call(void 0, reportResults, "reportResults");
1406
- async function dependencyCheck(options) {
1407
- if (process.env.DEV === "true") {
1408
- return void 0;
1409
- }
1410
- if (process.env.CI && !process.env.BUILDKITE) {
1411
- return void 0;
1412
- }
1413
- const buildPromise = esbuild2.build({
1414
- entryPoints: _globby.globbySync.call(void 0, "**/*.{j,t}s", {
1415
- // We don't check dependencies in ecosystem tests because tests are isolated from the build.
1416
- ignore: [
1417
- "./src/__tests__/**/*",
1418
- "./tests/e2e/**/*",
1419
- "./dist/**/*"
1420
- ],
1421
- gitignore: true
1422
- }),
1423
- logLevel: "silent",
1424
- bundle: true,
1425
- write: false,
1426
- outdir: "out",
1427
- plugins: [
1428
- depsCheckPlugin(options.bundle)
1429
- ]
1430
- });
1431
- await buildPromise.catch(() => {
1432
- });
1433
- return void 0;
1434
- }
1435
- _chunk3GQAWCBQjs.__name.call(void 0, dependencyCheck, "dependencyCheck");
1436
- async function cleanOutputPath(context2) {
1437
- if (context2.options.clean !== false && context2.options.outdir) {
1438
- _chunkMP2P2MGPjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${context2.options.name} output path: ${context2.options.outdir}`, context2.options.config);
1439
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, `${context2.options.name} output clean`);
1440
- await cleanDirectories(context2.options.name, context2.options.outdir, context2.options.config);
1441
- stopwatch();
1442
- }
1443
- return context2;
1444
- }
1445
- _chunk3GQAWCBQjs.__name.call(void 0, cleanOutputPath, "cleanOutputPath");
1446
- async function build3(options) {
1447
- _chunkMP2P2MGPjs.writeDebug.call(void 0, ` \u26A1 Executing Storm ESBuild pipeline`);
1448
- const stopwatch = _chunkMP2P2MGPjs.getStopwatch.call(void 0, "ESBuild pipeline");
1449
- try {
1450
- const opts = Array.isArray(options) ? options : [
1451
- options
1452
- ];
1453
- if (opts.length === 0) {
1454
- throw new Error("No build options were provided");
1455
- }
1456
- void transduce.async(opts, dependencyCheck);
1457
- await transduce.async(await createOptions(opts), pipe.async(generateContext, cleanOutputPath, generatePackageJson, executeTypescript, executeEsBuild, copyBuildAssets, reportResults));
1458
- _chunkMP2P2MGPjs.writeSuccess.call(void 0, " \u{1F3C1} ESBuild pipeline build completed successfully");
1459
- } catch (error) {
1460
- _chunkMP2P2MGPjs.writeFatal.call(void 0, "Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
1461
- throw error;
1462
- } finally {
1463
- stopwatch();
1464
- }
1465
- }
1466
- _chunk3GQAWCBQjs.__name.call(void 0, build3, "build");
1467
- var watch = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (context2, options) => {
1468
- if (!options.watch) {
1469
- return context2;
1470
- }
1471
- const config = {
1472
- ignoreInitial: true,
1473
- useFsEvents: true,
1474
- ignored: [
1475
- "./src/__tests__/**/*",
1476
- "./package.json"
1477
- ]
1478
- };
1479
- const changeWatcher = _chokidar.watch.call(void 0, [
1480
- "./src/**/*"
1481
- ], config);
1482
- const fastRebuild = _estoolkit.debounce.call(void 0, async () => {
1483
- const timeBefore = Date.now();
1484
- const rebuildResult = await handle.async(() => {
1485
- return context2.rebuild();
1486
- });
1487
- if (rebuildResult instanceof Error) {
1488
- _chunkMP2P2MGPjs.writeError.call(void 0, rebuildResult.message);
1489
- }
1490
- _chunkMP2P2MGPjs.writeTrace.call(void 0, `${Date.now() - timeBefore}ms [${_nullishCoalesce(options.name, () => ( ""))}]`);
1491
- }, 10);
1492
- changeWatcher.on("change", fastRebuild);
1493
- return void 0;
1494
- }, "watch");
1495
-
1496
- // src/executors/esbuild/executor.ts
1497
- async function esbuildExecutorFn(options, context2, config) {
1498
- _chunkMP2P2MGPjs.writeInfo.call(void 0, "\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
1499
- if (!_optionalChain([context2, 'access', _69 => _69.projectsConfigurations, 'optionalAccess', _70 => _70.projects]) || !context2.projectName || !context2.projectsConfigurations.projects[context2.projectName] || !_optionalChain([context2, 'access', _71 => _71.projectsConfigurations, 'access', _72 => _72.projects, 'access', _73 => _73[context2.projectName], 'optionalAccess', _74 => _74.root])) {
1500
- throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1501
- }
1502
- await build3({
1503
- ...options,
1504
- projectRoot: _optionalChain([context2, 'access', _75 => _75.projectsConfigurations, 'access', _76 => _76.projects, 'optionalAccess', _77 => _77[context2.projectName], 'access', _78 => _78.root]),
1505
- projectName: context2.projectName,
1506
- sourceRoot: _optionalChain([context2, 'access', _79 => _79.projectsConfigurations, 'access', _80 => _80.projects, 'optionalAccess', _81 => _81[context2.projectName], 'optionalAccess', _82 => _82.sourceRoot]),
1507
- format: options.format,
1508
- platform: options.format
1509
- });
1510
- return {
1511
- success: true
1512
- };
1513
- }
1514
- _chunk3GQAWCBQjs.__name.call(void 0, esbuildExecutorFn, "esbuildExecutorFn");
1515
- var executor_default = _chunkJL5QGFBXjs.withRunExecutor.call(void 0, "Storm ESBuild build", esbuildExecutorFn, {
1516
- skipReadingConfig: false,
1517
- hooks: {
1518
- applyDefaultOptions: /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (options, config) => {
1519
- options.entry ??= [
1520
- "src/index.ts"
1521
- ];
1522
- options.outputPath ??= "dist/{projectRoot}";
1523
- options.tsconfig ??= "{projectRoot}/tsconfig.json";
1524
- return options;
1525
- }, "applyDefaultOptions")
1526
- }
1527
- });
1528
-
1529
-
1530
-
1531
-
1532
- exports.esbuildExecutorFn = esbuildExecutorFn; exports.executor_default = executor_default;