@storm-software/esbuild 0.34.2 → 0.34.3

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 (117) hide show
  1. package/README.md +2 -1
  2. package/bin/esbuild.cjs +12143 -158
  3. package/dist/assets.cjs +9 -0
  4. package/dist/assets.d.cts +16 -0
  5. package/dist/assets.d.ts +16 -0
  6. package/dist/assets.js +9 -0
  7. package/dist/build.cjs +13 -17
  8. package/dist/build.d.cts +3 -13
  9. package/dist/build.d.ts +3 -13
  10. package/dist/build.js +14 -18
  11. package/dist/chunk-2CM3VAO5.cjs +119 -0
  12. package/dist/{chunk-Y7JBB452.js → chunk-4D6ICA75.js} +36 -3
  13. package/dist/{chunk-5RVOO3YF.js → chunk-ABRK5MYP.js} +3 -5
  14. package/dist/chunk-CVOQEYHW.cjs +117 -0
  15. package/dist/{chunk-3PF5YMWK.js → chunk-DNZNN5SK.js} +2 -2
  16. package/dist/chunk-EBTMX5WL.js +117 -0
  17. package/dist/chunk-ECCVVXNX.js +100 -0
  18. package/dist/chunk-EDLA3ZZN.js +26 -0
  19. package/dist/{chunk-GJHRTQAS.cjs → chunk-EVDNG72R.cjs} +35 -37
  20. package/dist/{chunk-TDBBRZTC.cjs → chunk-FQQYNAPT.cjs} +111 -189
  21. package/dist/{chunk-QKJ7KLDL.cjs → chunk-G66JI4BS.cjs} +5 -7
  22. package/dist/{chunk-SKJRUPDP.js → chunk-NJJBR57W.js} +24 -102
  23. package/dist/{chunk-STCE44IS.js → chunk-OCDIIBBZ.js} +2 -2
  24. package/dist/{chunk-M3AOQRGN.cjs → chunk-PTHYT3U2.cjs} +188 -582
  25. package/dist/chunk-QVMJLFU5.cjs +26 -0
  26. package/dist/{chunk-DPRINYB6.js → chunk-QWTKBUQW.js} +40 -434
  27. package/dist/chunk-R2KKGNQL.js +119 -0
  28. package/dist/{chunk-TH2QFJHI.cjs → chunk-RK34D7S5.cjs} +6 -6
  29. package/dist/chunk-SLSBBNRF.cjs +52 -0
  30. package/dist/{chunk-VQHKIS7J.js → chunk-TSQT5MWW.js} +2 -4
  31. package/dist/{chunk-BNPCRQK4.cjs → chunk-VTBMJYSM.cjs} +6 -6
  32. package/dist/chunk-WLJT52I3.cjs +100 -0
  33. package/dist/chunk-WXURMFT7.js +52 -0
  34. package/dist/{chunk-VPTKC3UK.cjs → chunk-YHMM6RY5.cjs} +42 -9
  35. package/dist/clean.cjs +4 -5
  36. package/dist/clean.d.cts +1 -2
  37. package/dist/clean.d.ts +1 -2
  38. package/dist/clean.js +3 -4
  39. package/dist/config.cjs +5 -14
  40. package/dist/config.d.cts +4 -6
  41. package/dist/config.d.ts +4 -6
  42. package/dist/config.js +6 -15
  43. package/dist/context.cjs +11 -0
  44. package/dist/context.d.cts +16 -0
  45. package/dist/context.d.ts +16 -0
  46. package/dist/context.js +11 -0
  47. package/dist/index.cjs +14 -52
  48. package/dist/index.d.cts +3 -216
  49. package/dist/index.d.ts +3 -216
  50. package/dist/index.js +15 -53
  51. package/dist/package-json.cjs +9 -0
  52. package/dist/package-json.d.cts +16 -0
  53. package/dist/package-json.d.ts +16 -0
  54. package/dist/package-json.js +9 -0
  55. package/dist/plugins/deps-check.cjs +4 -5
  56. package/dist/plugins/deps-check.js +3 -4
  57. package/dist/plugins/resolve-paths.cjs +3 -4
  58. package/dist/plugins/resolve-paths.d.cts +3 -4
  59. package/dist/plugins/resolve-paths.d.ts +3 -4
  60. package/dist/plugins/resolve-paths.js +2 -3
  61. package/dist/tsup.cjs +8 -0
  62. package/dist/tsup.d.cts +16 -0
  63. package/dist/tsup.d.ts +16 -0
  64. package/dist/tsup.js +8 -0
  65. package/dist/types.d.cts +1 -2
  66. package/dist/types.d.ts +1 -2
  67. package/dist/watch.cjs +111 -0
  68. package/dist/watch.d.cts +18 -0
  69. package/dist/watch.d.ts +18 -0
  70. package/dist/watch.js +111 -0
  71. package/package.json +59 -38
  72. package/dist/chunk-27VOV3G4.cjs +0 -23
  73. package/dist/chunk-2TG2H4XL.js +0 -29
  74. package/dist/chunk-2X5ZMEAN.js +0 -167
  75. package/dist/chunk-3QHFCKSI.js +0 -140
  76. package/dist/chunk-AZON722Q.js +0 -23
  77. package/dist/chunk-B4CUDMY2.cjs +0 -39
  78. package/dist/chunk-BOFHC4OE.cjs +0 -26
  79. package/dist/chunk-BWSIRV3D.js +0 -26
  80. package/dist/chunk-CCEWV2BR.js +0 -39
  81. package/dist/chunk-CGMLIVTB.cjs +0 -167
  82. package/dist/chunk-ILJQ4NCE.cjs +0 -29
  83. package/dist/chunk-N62ZR7UV.cjs +0 -140
  84. package/dist/chunk-RLQJRD62.cjs +0 -27
  85. package/dist/chunk-UYE6LM4C.js +0 -60
  86. package/dist/chunk-XLUZXKDY.js +0 -27
  87. package/dist/chunk-Y5SBBYX3.cjs +0 -60
  88. package/dist/plugins/esm-split-code-to-cjs.cjs +0 -7
  89. package/dist/plugins/esm-split-code-to-cjs.d.cts +0 -15
  90. package/dist/plugins/esm-split-code-to-cjs.d.ts +0 -15
  91. package/dist/plugins/esm-split-code-to-cjs.js +0 -7
  92. package/dist/plugins/fix-imports.cjs +0 -7
  93. package/dist/plugins/fix-imports.d.cts +0 -14
  94. package/dist/plugins/fix-imports.d.ts +0 -14
  95. package/dist/plugins/fix-imports.js +0 -7
  96. package/dist/plugins/native-node-module.cjs +0 -7
  97. package/dist/plugins/native-node-module.d.cts +0 -11
  98. package/dist/plugins/native-node-module.d.ts +0 -11
  99. package/dist/plugins/native-node-module.js +0 -7
  100. package/dist/plugins/node-protocol.cjs +0 -7
  101. package/dist/plugins/node-protocol.d.cts +0 -15
  102. package/dist/plugins/node-protocol.d.ts +0 -15
  103. package/dist/plugins/node-protocol.js +0 -7
  104. package/dist/plugins/on-error.cjs +0 -9
  105. package/dist/plugins/on-error.d.cts +0 -14
  106. package/dist/plugins/on-error.d.ts +0 -14
  107. package/dist/plugins/on-error.js +0 -9
  108. package/dist/plugins/tsc.cjs +0 -9
  109. package/dist/plugins/tsc.d.cts +0 -14
  110. package/dist/plugins/tsc.d.ts +0 -14
  111. package/dist/plugins/tsc.js +0 -9
  112. package/dist/tsc.cjs +0 -17
  113. package/dist/tsc.d.cts +0 -21
  114. package/dist/tsc.d.ts +0 -21
  115. package/dist/tsc.js +0 -17
  116. package/dist/types-B4jbZA4j.d.cts +0 -1286
  117. package/dist/types-B4jbZA4j.d.ts +0 -1286
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkQVMJLFU5cjs = require('./chunk-QVMJLFU5.cjs');
4
+ require('./chunk-FQQYNAPT.cjs');
5
+ require('./chunk-EVDNG72R.cjs');
6
+ require('./chunk-YHMM6RY5.cjs');
7
+
8
+
9
+ exports.copyBuildAssets = _chunkQVMJLFU5cjs.copyBuildAssets;
@@ -0,0 +1,16 @@
1
+ import { ESBuildContext } from './types.cjs';
2
+ import '@nx/devkit';
3
+ import '@storm-software/build-tools';
4
+ import '@storm-software/config';
5
+ import 'esbuild';
6
+ import 'tsup';
7
+
8
+ /**
9
+ * Copy the assets to the build directory
10
+ *
11
+ * @param context - The build context
12
+ * @returns The build context
13
+ */
14
+ declare function copyBuildAssets(context: ESBuildContext): Promise<ESBuildContext>;
15
+
16
+ export { copyBuildAssets };
@@ -0,0 +1,16 @@
1
+ import { ESBuildContext } from './types.js';
2
+ import '@nx/devkit';
3
+ import '@storm-software/build-tools';
4
+ import '@storm-software/config';
5
+ import 'esbuild';
6
+ import 'tsup';
7
+
8
+ /**
9
+ * Copy the assets to the build directory
10
+ *
11
+ * @param context - The build context
12
+ * @returns The build context
13
+ */
14
+ declare function copyBuildAssets(context: ESBuildContext): Promise<ESBuildContext>;
15
+
16
+ export { copyBuildAssets };
package/dist/assets.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ copyBuildAssets
3
+ } from "./chunk-EDLA3ZZN.js";
4
+ import "./chunk-NJJBR57W.js";
5
+ import "./chunk-TSQT5MWW.js";
6
+ import "./chunk-4D6ICA75.js";
7
+ export {
8
+ copyBuildAssets
9
+ };
package/dist/build.cjs CHANGED
@@ -1,21 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkCVOQEYHWcjs = require('./chunk-CVOQEYHW.cjs');
4
+ require('./chunk-VTBMJYSM.cjs');
5
+ require('./chunk-QVMJLFU5.cjs');
6
+ require('./chunk-RK34D7S5.cjs');
7
+ require('./chunk-WLJT52I3.cjs');
8
+ require('./chunk-G66JI4BS.cjs');
9
+ require('./chunk-SLSBBNRF.cjs');
10
+ require('./chunk-2CM3VAO5.cjs');
11
+ require('./chunk-FQQYNAPT.cjs');
12
+ require('./chunk-PTHYT3U2.cjs');
13
+ require('./chunk-EVDNG72R.cjs');
14
+ require('./chunk-YHMM6RY5.cjs');
3
15
 
4
- var _chunkM3AOQRGNcjs = require('./chunk-M3AOQRGN.cjs');
5
- require('./chunk-TH2QFJHI.cjs');
6
- require('./chunk-TDBBRZTC.cjs');
7
- require('./chunk-ILJQ4NCE.cjs');
8
- require('./chunk-Y5SBBYX3.cjs');
9
- require('./chunk-27VOV3G4.cjs');
10
- require('./chunk-BOFHC4OE.cjs');
11
- require('./chunk-QKJ7KLDL.cjs');
12
- require('./chunk-N62ZR7UV.cjs');
13
- require('./chunk-BNPCRQK4.cjs');
14
- require('./chunk-GJHRTQAS.cjs');
15
- require('./chunk-VPTKC3UK.cjs');
16
- require('./chunk-RLQJRD62.cjs');
17
- require('./chunk-B4CUDMY2.cjs');
18
16
 
19
-
20
-
21
- exports.build = _chunkM3AOQRGNcjs.build; exports.watch = _chunkM3AOQRGNcjs.watch;
17
+ exports.build = _chunkCVOQEYHWcjs.build;
package/dist/build.d.cts CHANGED
@@ -1,10 +1,8 @@
1
- import * as esbuild from 'esbuild';
2
- import { BuildContext } from 'esbuild';
3
1
  import { ESBuildOptions } from './types.cjs';
4
2
  import '@nx/devkit';
5
3
  import '@storm-software/build-tools';
6
- import './types-B4jbZA4j.cjs';
7
- import 'zod';
4
+ import '@storm-software/config';
5
+ import 'esbuild';
8
6
  import 'tsup';
9
7
 
10
8
  /**
@@ -14,13 +12,5 @@ import 'tsup';
14
12
  * @returns the build result
15
13
  */
16
14
  declare function build(options: ESBuildOptions): Promise<void>;
17
- /**
18
- * Executes the build and rebuilds what is necessary
19
- *
20
- * @param context - the build context
21
- * @param options - the build options
22
- * @returns the build result
23
- */
24
- declare const watch: (context: BuildContext, options: ESBuildOptions) => esbuild.BuildContext<esbuild.BuildOptions> | undefined;
25
15
 
26
- export { build, watch };
16
+ export { build };
package/dist/build.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import * as esbuild from 'esbuild';
2
- import { BuildContext } from 'esbuild';
3
1
  import { ESBuildOptions } from './types.js';
4
2
  import '@nx/devkit';
5
3
  import '@storm-software/build-tools';
6
- import './types-B4jbZA4j.js';
7
- import 'zod';
4
+ import '@storm-software/config';
5
+ import 'esbuild';
8
6
  import 'tsup';
9
7
 
10
8
  /**
@@ -14,13 +12,5 @@ import 'tsup';
14
12
  * @returns the build result
15
13
  */
16
14
  declare function build(options: ESBuildOptions): Promise<void>;
17
- /**
18
- * Executes the build and rebuilds what is necessary
19
- *
20
- * @param context - the build context
21
- * @param options - the build options
22
- * @returns the build result
23
- */
24
- declare const watch: (context: BuildContext, options: ESBuildOptions) => esbuild.BuildContext<esbuild.BuildOptions> | undefined;
25
15
 
26
- export { build, watch };
16
+ export { build };
package/dist/build.js CHANGED
@@ -1,21 +1,17 @@
1
1
  import {
2
- build,
3
- watch
4
- } from "./chunk-DPRINYB6.js";
5
- import "./chunk-3PF5YMWK.js";
6
- import "./chunk-SKJRUPDP.js";
7
- import "./chunk-2TG2H4XL.js";
8
- import "./chunk-UYE6LM4C.js";
9
- import "./chunk-AZON722Q.js";
10
- import "./chunk-BWSIRV3D.js";
11
- import "./chunk-5RVOO3YF.js";
12
- import "./chunk-3QHFCKSI.js";
13
- import "./chunk-STCE44IS.js";
14
- import "./chunk-VQHKIS7J.js";
15
- import "./chunk-Y7JBB452.js";
16
- import "./chunk-XLUZXKDY.js";
17
- import "./chunk-CCEWV2BR.js";
2
+ build
3
+ } from "./chunk-EBTMX5WL.js";
4
+ import "./chunk-OCDIIBBZ.js";
5
+ import "./chunk-EDLA3ZZN.js";
6
+ import "./chunk-DNZNN5SK.js";
7
+ import "./chunk-ECCVVXNX.js";
8
+ import "./chunk-ABRK5MYP.js";
9
+ import "./chunk-WXURMFT7.js";
10
+ import "./chunk-R2KKGNQL.js";
11
+ import "./chunk-NJJBR57W.js";
12
+ import "./chunk-QWTKBUQW.js";
13
+ import "./chunk-TSQT5MWW.js";
14
+ import "./chunk-4D6ICA75.js";
18
15
  export {
19
- build,
20
- watch
16
+ build
21
17
  };
@@ -0,0 +1,119 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunkFQQYNAPTcjs = require('./chunk-FQQYNAPT.cjs');
5
+
6
+
7
+
8
+ var _chunkEVDNG72Rcjs = require('./chunk-EVDNG72R.cjs');
9
+
10
+
11
+
12
+ var _chunkYHMM6RY5cjs = require('./chunk-YHMM6RY5.cjs');
13
+
14
+ // src/package-json.ts
15
+ var _devkit = require('@nx/devkit');
16
+ var _fs = require('fs');
17
+ var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
18
+ async function generatePackageJson(context) {
19
+ if (context.options.generatePackageJson !== false && _fs.existsSync.call(void 0, _chunkYHMM6RY5cjs.joinPaths.call(void 0, context.options.projectRoot, "package.json"))) {
20
+ _chunkEVDNG72Rcjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", context.workspaceConfig);
21
+ const stopwatch = _chunkEVDNG72Rcjs.getStopwatch.call(void 0, "Write package.json file");
22
+ const packageJsonPath = _chunkYHMM6RY5cjs.joinPaths.call(void 0, context.options.projectRoot, "project.json");
23
+ if (!_fs.existsSync.call(void 0, packageJsonPath)) {
24
+ throw new Error("Cannot find package.json configuration");
25
+ }
26
+ const packageJsonFile = await _promises2.default.readFile(_chunkYHMM6RY5cjs.joinPaths.call(void 0, context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
27
+ let packageJson = JSON.parse(packageJsonFile);
28
+ if (!packageJson) {
29
+ throw new Error("Cannot find package.json configuration file");
30
+ }
31
+ packageJson = await _chunkFQQYNAPTcjs.addPackageDependencies.call(void 0, context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
32
+ packageJson = await _chunkFQQYNAPTcjs.addWorkspacePackageJsonFields.call(void 0, context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
33
+ if (context.options.entry) {
34
+ packageJson.exports ??= {};
35
+ packageJson.exports["./package.json"] ??= "./package.json";
36
+ const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
37
+ if (entryPoints.length > 0) {
38
+ const defaultEntry = entryPoints.includes("index") ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entryPoints[0]}`;
39
+ const isEsm = Array.isArray(context.options.format) ? context.options.format.includes("esm") : context.options.format === "esm";
40
+ const isCjs = Array.isArray(context.options.format) ? context.options.format.includes("cjs") : context.options.format === "cjs";
41
+ const isDts = context.options.dts || context.options.experimentalDts;
42
+ packageJson.exports["."] ??= `${defaultEntry}.${isEsm ? "mjs" : isCjs ? "cjs" : "js"}`;
43
+ for (const entryPoint of entryPoints) {
44
+ packageJson.exports[`./${entryPoint}`] ??= {};
45
+ if (isEsm) {
46
+ if (isDts) {
47
+ packageJson.exports[`./${entryPoint}`].import = {
48
+ types: `./dist/${entryPoint}.d.mts`,
49
+ default: `./dist/${entryPoint}.mjs`
50
+ };
51
+ } else {
52
+ packageJson.exports[`./${entryPoint}`].import = `./dist/${entryPoint}.mjs`;
53
+ }
54
+ if (isDts) {
55
+ packageJson.exports[`./${entryPoint}`].default = {
56
+ types: `./dist/${entryPoint}.d.mts`,
57
+ default: `./dist/${entryPoint}.mjs`
58
+ };
59
+ } else {
60
+ packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.mjs`;
61
+ }
62
+ }
63
+ if (isCjs) {
64
+ if (isDts) {
65
+ packageJson.exports[`./${entryPoint}`].require = {
66
+ types: `./dist/${entryPoint}.d.cts`,
67
+ default: `./dist/${entryPoint}.cjs`
68
+ };
69
+ } else {
70
+ packageJson.exports[`./${entryPoint}`].require = `./dist/${entryPoint}.cjs`;
71
+ }
72
+ if (!isEsm) {
73
+ if (isDts) {
74
+ packageJson.exports[`./${entryPoint}`].default = {
75
+ types: `./dist/${entryPoint}.d.cts`,
76
+ default: `./dist/${entryPoint}.cjs`
77
+ };
78
+ } else {
79
+ packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.cjs`;
80
+ }
81
+ }
82
+ }
83
+ if (!isEsm && !isCjs) {
84
+ if (isDts) {
85
+ packageJson.exports[`./${entryPoint}`].default = {
86
+ types: `./dist/${entryPoint}.d.ts`,
87
+ default: `./dist/${entryPoint}.js`
88
+ };
89
+ } else {
90
+ packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.js`;
91
+ }
92
+ }
93
+ }
94
+ if (isEsm) {
95
+ packageJson.module = `${defaultEntry}.mjs`;
96
+ } else {
97
+ packageJson.main = `${defaultEntry}.cjs`;
98
+ }
99
+ if (isDts) {
100
+ packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
101
+ }
102
+ packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
103
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
104
+ ret[key.replace("/index", "")] = packageJson.exports[key];
105
+ }
106
+ return ret;
107
+ }, packageJson.exports);
108
+ }
109
+ }
110
+ await _devkit.writeJsonFile.call(void 0, _chunkYHMM6RY5cjs.joinPaths.call(void 0, context.outputPath, "package.json"), packageJson);
111
+ stopwatch();
112
+ }
113
+ return context;
114
+ }
115
+ _chunkYHMM6RY5cjs.__name.call(void 0, generatePackageJson, "generatePackageJson");
116
+
117
+
118
+
119
+ exports.generatePackageJson = generatePackageJson;
@@ -1,6 +1,35 @@
1
- import {
2
- __name
3
- } from "./chunk-CCEWV2BR.js";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
4
33
 
5
34
  // ../config-tools/src/utilities/correct-paths.ts
6
35
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
@@ -130,6 +159,10 @@ var isAbsolute = /* @__PURE__ */ __name(function(p) {
130
159
  }, "isAbsolute");
131
160
 
132
161
  export {
162
+ __name,
163
+ __require,
164
+ __commonJS,
165
+ __toESM,
133
166
  correctPaths,
134
167
  joinPaths
135
168
  };
@@ -1,10 +1,8 @@
1
- import {
2
- joinPaths
3
- } from "./chunk-Y7JBB452.js";
4
1
  import {
5
2
  __name,
6
- __require
7
- } from "./chunk-CCEWV2BR.js";
3
+ __require,
4
+ joinPaths
5
+ } from "./chunk-4D6ICA75.js";
8
6
 
9
7
  // src/plugins/resolve-paths.ts
10
8
  import path from "node:path";
@@ -0,0 +1,117 @@
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 _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkVTBMJYSMcjs = require('./chunk-VTBMJYSM.cjs');
4
+
5
+
6
+ var _chunkQVMJLFU5cjs = require('./chunk-QVMJLFU5.cjs');
7
+
8
+
9
+ var _chunkRK34D7S5cjs = require('./chunk-RK34D7S5.cjs');
10
+
11
+
12
+ var _chunkWLJT52I3cjs = require('./chunk-WLJT52I3.cjs');
13
+
14
+
15
+ var _chunk2CM3VAO5cjs = require('./chunk-2CM3VAO5.cjs');
16
+
17
+
18
+ var _chunkPTHYT3U2cjs = require('./chunk-PTHYT3U2.cjs');
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ var _chunkEVDNG72Rcjs = require('./chunk-EVDNG72R.cjs');
27
+
28
+
29
+ var _chunkYHMM6RY5cjs = require('./chunk-YHMM6RY5.cjs');
30
+
31
+ // src/build.ts
32
+ var _esbuild = require('esbuild'); var esbuild = _interopRequireWildcard(_esbuild);
33
+ var _globby = require('globby');
34
+ async function reportResults(context) {
35
+ if (_optionalChain([context, 'access', _ => _.result, 'optionalAccess', _2 => _2.errors, 'access', _3 => _3.length]) === 0) {
36
+ if (context.result.warnings.length > 0) {
37
+ _chunkEVDNG72Rcjs.writeWarning.call(void 0, ` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
38
+ }
39
+ _chunkEVDNG72Rcjs.writeSuccess.call(void 0, ` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
40
+ } else if (_optionalChain([context, 'access', _4 => _4.result, 'optionalAccess', _5 => _5.errors]) && _optionalChain([context, 'access', _6 => _6.result, 'optionalAccess', _7 => _7.errors, 'access', _8 => _8.length]) > 0) {
41
+ _chunkEVDNG72Rcjs.writeError.call(void 0, ` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
42
+ throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
43
+ }
44
+ }
45
+ _chunkYHMM6RY5cjs.__name.call(void 0, reportResults, "reportResults");
46
+ async function dependencyCheck(options) {
47
+ if (process.env.DEV === "true") {
48
+ return void 0;
49
+ }
50
+ if (process.env.CI && !process.env.BUILDKITE) {
51
+ return void 0;
52
+ }
53
+ const buildPromise = esbuild.build({
54
+ entryPoints: _globby.globbySync.call(void 0, "**/*.{j,t}s", {
55
+ // We don't check dependencies in ecosystem tests because tests are isolated from the build.
56
+ ignore: [
57
+ "./src/__tests__/**/*",
58
+ "./tests/e2e/**/*",
59
+ "./dist/**/*"
60
+ ],
61
+ gitignore: true
62
+ }),
63
+ logLevel: "silent",
64
+ bundle: true,
65
+ write: false,
66
+ outdir: "out",
67
+ plugins: [
68
+ _chunkVTBMJYSMcjs.depsCheckPlugin.call(void 0, options.bundle)
69
+ ]
70
+ });
71
+ await buildPromise.catch(() => {
72
+ });
73
+ return void 0;
74
+ }
75
+ _chunkYHMM6RY5cjs.__name.call(void 0, dependencyCheck, "dependencyCheck");
76
+ async function cleanOutputPath(context) {
77
+ if (context.clean !== false && context.outputPath) {
78
+ _chunkEVDNG72Rcjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
79
+ const stopwatch = _chunkEVDNG72Rcjs.getStopwatch.call(void 0, `${context.options.name} output clean`);
80
+ await _chunkRK34D7S5cjs.cleanDirectories.call(void 0, context.outputPath);
81
+ stopwatch();
82
+ }
83
+ return context;
84
+ }
85
+ _chunkYHMM6RY5cjs.__name.call(void 0, cleanOutputPath, "cleanOutputPath");
86
+ async function build2(options) {
87
+ _chunkEVDNG72Rcjs.writeDebug.call(void 0, ` \u26A1 Executing Storm ESBuild pipeline`);
88
+ const stopwatch = _chunkEVDNG72Rcjs.getStopwatch.call(void 0, "ESBuild pipeline");
89
+ try {
90
+ const opts = Array.isArray(options) ? options : [
91
+ options
92
+ ];
93
+ if (opts.length === 0) {
94
+ throw new Error("No build options were provided");
95
+ }
96
+ const context = await _chunkWLJT52I3cjs.resolveContext.call(void 0, options);
97
+ await cleanOutputPath(context);
98
+ await Promise.all([
99
+ dependencyCheck(context.options),
100
+ _chunk2CM3VAO5cjs.generatePackageJson.call(void 0, context),
101
+ _chunkQVMJLFU5cjs.copyBuildAssets.call(void 0, context),
102
+ _chunkPTHYT3U2cjs.executeTsup.call(void 0, context)
103
+ ]);
104
+ await reportResults(context);
105
+ _chunkEVDNG72Rcjs.writeSuccess.call(void 0, " \u{1F3C1} ESBuild pipeline build completed successfully");
106
+ } catch (error) {
107
+ _chunkEVDNG72Rcjs.writeFatal.call(void 0, "Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
108
+ throw error;
109
+ } finally {
110
+ stopwatch();
111
+ }
112
+ }
113
+ _chunkYHMM6RY5cjs.__name.call(void 0, build2, "build");
114
+
115
+
116
+
117
+ exports.build = build2;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getStopwatch,
3
3
  writeDebug
4
- } from "./chunk-VQHKIS7J.js";
4
+ } from "./chunk-TSQT5MWW.js";
5
5
  import {
6
6
  __name
7
- } from "./chunk-CCEWV2BR.js";
7
+ } from "./chunk-4D6ICA75.js";
8
8
 
9
9
  // src/clean.ts
10
10
  import { rm } from "node:fs/promises";
@@ -0,0 +1,117 @@
1
+ import {
2
+ depsCheckPlugin
3
+ } from "./chunk-OCDIIBBZ.js";
4
+ import {
5
+ copyBuildAssets
6
+ } from "./chunk-EDLA3ZZN.js";
7
+ import {
8
+ cleanDirectories
9
+ } from "./chunk-DNZNN5SK.js";
10
+ import {
11
+ resolveContext
12
+ } from "./chunk-ECCVVXNX.js";
13
+ import {
14
+ generatePackageJson
15
+ } from "./chunk-R2KKGNQL.js";
16
+ import {
17
+ executeTsup
18
+ } from "./chunk-QWTKBUQW.js";
19
+ import {
20
+ getStopwatch,
21
+ writeDebug,
22
+ writeError,
23
+ writeFatal,
24
+ writeSuccess,
25
+ writeWarning
26
+ } from "./chunk-TSQT5MWW.js";
27
+ import {
28
+ __name
29
+ } from "./chunk-4D6ICA75.js";
30
+
31
+ // src/build.ts
32
+ import * as esbuild from "esbuild";
33
+ import { globbySync } from "globby";
34
+ async function reportResults(context) {
35
+ if (context.result?.errors.length === 0) {
36
+ if (context.result.warnings.length > 0) {
37
+ writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
38
+ }
39
+ writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
40
+ } else if (context.result?.errors && context.result?.errors.length > 0) {
41
+ writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
42
+ throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
43
+ }
44
+ }
45
+ __name(reportResults, "reportResults");
46
+ async function dependencyCheck(options) {
47
+ if (process.env.DEV === "true") {
48
+ return void 0;
49
+ }
50
+ if (process.env.CI && !process.env.BUILDKITE) {
51
+ return void 0;
52
+ }
53
+ const buildPromise = esbuild.build({
54
+ entryPoints: globbySync("**/*.{j,t}s", {
55
+ // We don't check dependencies in ecosystem tests because tests are isolated from the build.
56
+ ignore: [
57
+ "./src/__tests__/**/*",
58
+ "./tests/e2e/**/*",
59
+ "./dist/**/*"
60
+ ],
61
+ gitignore: true
62
+ }),
63
+ logLevel: "silent",
64
+ bundle: true,
65
+ write: false,
66
+ outdir: "out",
67
+ plugins: [
68
+ depsCheckPlugin(options.bundle)
69
+ ]
70
+ });
71
+ await buildPromise.catch(() => {
72
+ });
73
+ return void 0;
74
+ }
75
+ __name(dependencyCheck, "dependencyCheck");
76
+ async function cleanOutputPath(context) {
77
+ if (context.clean !== false && context.outputPath) {
78
+ writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
79
+ const stopwatch = getStopwatch(`${context.options.name} output clean`);
80
+ await cleanDirectories(context.outputPath);
81
+ stopwatch();
82
+ }
83
+ return context;
84
+ }
85
+ __name(cleanOutputPath, "cleanOutputPath");
86
+ async function build2(options) {
87
+ writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
88
+ const stopwatch = getStopwatch("ESBuild pipeline");
89
+ try {
90
+ const opts = Array.isArray(options) ? options : [
91
+ options
92
+ ];
93
+ if (opts.length === 0) {
94
+ throw new Error("No build options were provided");
95
+ }
96
+ const context = await resolveContext(options);
97
+ await cleanOutputPath(context);
98
+ await Promise.all([
99
+ dependencyCheck(context.options),
100
+ generatePackageJson(context),
101
+ copyBuildAssets(context),
102
+ executeTsup(context)
103
+ ]);
104
+ await reportResults(context);
105
+ writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
106
+ } catch (error) {
107
+ writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
108
+ throw error;
109
+ } finally {
110
+ stopwatch();
111
+ }
112
+ }
113
+ __name(build2, "build");
114
+
115
+ export {
116
+ build2 as build
117
+ };