@storm-software/esbuild 0.4.1 → 0.14.2

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 (89) hide show
  1. package/README.md +1 -1
  2. package/dist/build.cjs +15 -11
  3. package/dist/build.d.cts +3 -3
  4. package/dist/build.d.ts +3 -3
  5. package/dist/build.js +14 -10
  6. package/dist/{chunk-WCQVDF3K.js → chunk-3GQAWCBQ.js} +0 -1
  7. package/dist/chunk-4JLYXTKD.cjs +26 -0
  8. package/dist/chunk-5I2MGPRN.cjs +919 -0
  9. package/dist/{chunk-CMWXE5MF.js → chunk-7KR3YBS6.js} +5 -3
  10. package/dist/chunk-7MDMXJ5V.js +26 -0
  11. package/dist/{chunk-WGEGR3DF.cjs → chunk-BGYQAVKQ.cjs} +0 -1
  12. package/dist/{chunk-J34FQYKV.cjs → chunk-CGFDQ5AJ.cjs} +8 -5
  13. package/dist/{chunk-TTHABTDU.js → chunk-DAGDNKO5.js} +8 -6
  14. package/dist/{chunk-DFGHPRBD.cjs → chunk-EZGTDCYM.cjs} +6 -6
  15. package/dist/chunk-GGNOJ77I.js +0 -0
  16. package/dist/{chunk-YQBU3FSL.js → chunk-GWG4HOQ6.js} +4 -4
  17. package/dist/chunk-HQGUIF4U.js +537 -0
  18. package/dist/{chunk-X5TLV7MF.js → chunk-KE5DL2BG.js} +11 -6
  19. package/dist/{chunk-KJ7ZHAFS.js → chunk-KOK4WCHS.js} +52 -28
  20. package/dist/chunk-LVWQSCJM.cjs +26 -0
  21. package/dist/chunk-LYDEMC26.js +23 -0
  22. package/dist/chunk-MAMLS55E.js +582 -0
  23. package/dist/chunk-NVWDQVN6.js +21 -0
  24. package/dist/chunk-PQ6YIJ72.cjs +136 -0
  25. package/dist/{chunk-BF5W6GVP.cjs → chunk-RMB62XEL.cjs} +10 -8
  26. package/dist/chunk-S6M44SSZ.cjs +60 -0
  27. package/dist/chunk-SFZRYJZ2.cjs +1 -0
  28. package/dist/chunk-T5272PC2.js +60 -0
  29. package/dist/chunk-TP5EOMRD.cjs +21 -0
  30. package/dist/chunk-VBINBV4Z.cjs +537 -0
  31. package/dist/chunk-VLP3P6HF.js +919 -0
  32. package/dist/{chunk-KVBDKVBU.cjs → chunk-VZBOWHCM.cjs} +9 -7
  33. package/dist/chunk-WRBUO7H6.cjs +23 -0
  34. package/dist/chunk-WYMD6YG2.cjs +582 -0
  35. package/dist/{chunk-437F3SFI.js → chunk-YNQ45EAM.js} +7 -4
  36. package/dist/clean.cjs +9 -0
  37. package/dist/clean.d.cts +1194 -0
  38. package/dist/clean.d.ts +1194 -0
  39. package/dist/clean.js +9 -0
  40. package/dist/config.cjs +14 -4
  41. package/dist/config.d.cts +8 -13
  42. package/dist/config.d.ts +8 -13
  43. package/dist/config.js +15 -5
  44. package/dist/esbuild.cjs +1185 -0
  45. package/dist/index.cjs +21 -12
  46. package/dist/index.d.cts +7 -5
  47. package/dist/index.d.ts +7 -5
  48. package/dist/index.js +22 -13
  49. package/dist/types.cjs +1 -2
  50. package/dist/types.d.cts +84 -1177
  51. package/dist/types.d.ts +84 -1177
  52. package/dist/types.js +1 -2
  53. package/package.json +1 -222
  54. package/dist/build.cjs.map +0 -1
  55. package/dist/build.js.map +0 -1
  56. package/dist/chunk-263L44RM.cjs +0 -112
  57. package/dist/chunk-263L44RM.cjs.map +0 -1
  58. package/dist/chunk-437F3SFI.js.map +0 -1
  59. package/dist/chunk-BF5W6GVP.cjs.map +0 -1
  60. package/dist/chunk-CMEDJ4L4.js +0 -352
  61. package/dist/chunk-CMEDJ4L4.js.map +0 -1
  62. package/dist/chunk-CMWXE5MF.js.map +0 -1
  63. package/dist/chunk-D5PRB2E2.cjs +0 -40
  64. package/dist/chunk-D5PRB2E2.cjs.map +0 -1
  65. package/dist/chunk-DFGHPRBD.cjs.map +0 -1
  66. package/dist/chunk-DRRPNILS.js +0 -40
  67. package/dist/chunk-DRRPNILS.js.map +0 -1
  68. package/dist/chunk-J34FQYKV.cjs.map +0 -1
  69. package/dist/chunk-KJ7ZHAFS.js.map +0 -1
  70. package/dist/chunk-KVBDKVBU.cjs.map +0 -1
  71. package/dist/chunk-MUYXFAKB.cjs +0 -1
  72. package/dist/chunk-MUYXFAKB.cjs.map +0 -1
  73. package/dist/chunk-MVLEDP7K.cjs +0 -21
  74. package/dist/chunk-MVLEDP7K.cjs.map +0 -1
  75. package/dist/chunk-PBHOTQGA.cjs +0 -352
  76. package/dist/chunk-PBHOTQGA.cjs.map +0 -1
  77. package/dist/chunk-QNDLJ2W7.js +0 -1
  78. package/dist/chunk-QNDLJ2W7.js.map +0 -1
  79. package/dist/chunk-TTHABTDU.js.map +0 -1
  80. package/dist/chunk-WCQVDF3K.js.map +0 -1
  81. package/dist/chunk-WGEGR3DF.cjs.map +0 -1
  82. package/dist/chunk-X5TLV7MF.js.map +0 -1
  83. package/dist/chunk-YQBU3FSL.js.map +0 -1
  84. package/dist/config.cjs.map +0 -1
  85. package/dist/config.js.map +0 -1
  86. package/dist/index.cjs.map +0 -1
  87. package/dist/index.js.map +0 -1
  88. package/dist/types.cjs.map +0 -1
  89. package/dist/types.js.map +0 -1
@@ -0,0 +1,136 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
2
+
3
+ var _chunkVBINBV4Zcjs = require('./chunk-VBINBV4Z.cjs');
4
+
5
+
6
+ var _chunkLVWQSCJMcjs = require('./chunk-LVWQSCJM.cjs');
7
+
8
+
9
+
10
+ var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
11
+
12
+ // src/plugins/tsc.ts
13
+ var _node = require('@humanfs/node');
14
+ var _apiextractor = require('@microsoft/api-extractor');
15
+
16
+ // ../config-tools/src/utilities/run.ts
17
+ var _child_process = require('child_process');
18
+ var LARGE_BUFFER = 1024 * 1e6;
19
+ var run = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), stdio = "inherit", env = process.env) => {
20
+ return _child_process.execSync.call(void 0, command, {
21
+ cwd,
22
+ env: {
23
+ ...process.env,
24
+ ...env,
25
+ CLICOLOR: "true",
26
+ FORCE_COLOR: "true"
27
+ },
28
+ windowsHide: true,
29
+ stdio,
30
+ maxBuffer: LARGE_BUFFER,
31
+ killSignal: "SIGTERM"
32
+ });
33
+ }, "run");
34
+
35
+ // src/plugins/tsc.ts
36
+ function bundleTypeDefinitions(filename, outfile, externals, options) {
37
+ const { dependencies, peerDependencies, devDependencies } = _chunkBGYQAVKQcjs.__require.call(void 0, _chunkLVWQSCJMcjs.joinPaths.call(void 0, options.projectRoot, "package.json"));
38
+ const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
39
+ p,
40
+ getTypeDependencyPackageName(p)
41
+ ]);
42
+ const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
43
+ p,
44
+ getTypeDependencyPackageName(p)
45
+ ]);
46
+ const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
47
+ p,
48
+ getTypeDependencyPackageName(p)
49
+ ]);
50
+ const includeDeps = devDependenciesKeys;
51
+ const excludeDeps = /* @__PURE__ */ new Set([
52
+ ...dependenciesKeys,
53
+ ...peerDependenciesKeys,
54
+ ...externals
55
+ ]);
56
+ const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
57
+ const extractorConfig = _apiextractor.ExtractorConfig.prepare({
58
+ configObject: {
59
+ projectFolder: options.projectRoot,
60
+ mainEntryPointFilePath: filename,
61
+ bundledPackages,
62
+ compiler: {
63
+ tsconfigFilePath: options.tsconfig,
64
+ overrideTsconfig: {
65
+ compilerOptions: {
66
+ paths: {}
67
+ // bug with api extract + paths
68
+ }
69
+ }
70
+ },
71
+ dtsRollup: {
72
+ enabled: true,
73
+ untrimmedFilePath: _chunkLVWQSCJMcjs.joinPaths.call(void 0, options.outdir, `${outfile}.d.ts`)
74
+ },
75
+ tsdocMetadata: {
76
+ enabled: false
77
+ }
78
+ },
79
+ packageJsonFullPath: _chunkLVWQSCJMcjs.joinPaths.call(void 0, options.projectRoot, "package.json"),
80
+ configObjectFullPath: void 0
81
+ });
82
+ const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
83
+ showVerboseMessages: true,
84
+ localBuild: true
85
+ });
86
+ if (extractorResult.succeeded === false) {
87
+ _chunkVBINBV4Zcjs.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
88
+ throw new Error("API Extractor completed with errors");
89
+ }
90
+ }
91
+ _chunkBGYQAVKQcjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
92
+ var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => ({
93
+ name: "storm:tsc",
94
+ setup(build) {
95
+ if (options.emitTypes === false) {
96
+ return;
97
+ }
98
+ build.onStart(async () => {
99
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
100
+ await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
101
+ }
102
+ if (resolvedOptions.bundle && resolvedOptions.entryPoints && resolvedOptions.entryPoints.length > 0 && resolvedOptions.entryPoints[0] && resolvedOptions.entryPoints[0].endsWith(".ts")) {
103
+ const sourceRoot = resolvedOptions.sourceRoot.replaceAll(resolvedOptions.projectRoot, "");
104
+ const typeOutDir = resolvedOptions.outdir;
105
+ const entryPoint = resolvedOptions.entryPoints[0].replace(sourceRoot, "").replace(/\.ts$/, "");
106
+ const bundlePath = _chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.outdir, entryPoint);
107
+ let dtsPath;
108
+ if (await _node.hfs.isFile(_chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
109
+ dtsPath = _chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
110
+ } else if (await _node.hfs.isFile(_chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
111
+ dtsPath = _chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
112
+ }
113
+ const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
114
+ if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
115
+ bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(resolvedOptions.external, () => ( [])), resolvedOptions);
116
+ const dtsContents = await _node.hfs.text(`${bundlePath}.d.ts`);
117
+ await _node.hfs.write(`${bundlePath}.${ext}`, dtsContents);
118
+ } else {
119
+ await _node.hfs.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
120
+ }
121
+ }
122
+ });
123
+ }
124
+ }), "tscPlugin");
125
+ function getTypeDependencyPackageName(npmPackage) {
126
+ if (npmPackage.startsWith("@")) {
127
+ const [scope, name] = npmPackage.split("/");
128
+ return `@types/${_optionalChain([scope, 'optionalAccess', _ => _.slice, 'call', _2 => _2(1)])}__${name}`;
129
+ }
130
+ return `@types/${npmPackage}`;
131
+ }
132
+ _chunkBGYQAVKQcjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
133
+
134
+
135
+
136
+ exports.tscPlugin = tscPlugin;
@@ -1,7 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
2
 
3
+ var _chunkLVWQSCJMcjs = require('./chunk-LVWQSCJM.cjs');
3
4
 
4
- var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
5
+
6
+
7
+ var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
5
8
 
6
9
  // src/plugins/resolve-paths.ts
7
10
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -19,17 +22,17 @@ function resolvePathsConfig(options, cwd) {
19
22
  if (options.extends) {
20
23
  const extendsPath = _path2.default.resolve(cwd, options.extends);
21
24
  const extendsDir = _path2.default.dirname(extendsPath);
22
- const extendsConfig = _chunkWGEGR3DFcjs.__require.call(void 0, extendsPath);
25
+ const extendsConfig = _chunkBGYQAVKQcjs.__require.call(void 0, extendsPath);
23
26
  return resolvePathsConfig(extendsConfig, extendsDir);
24
27
  }
25
28
  return [];
26
29
  }
27
- _chunkWGEGR3DFcjs.__name.call(void 0, resolvePathsConfig, "resolvePathsConfig");
28
- var resolvePathsPlugin = {
30
+ _chunkBGYQAVKQcjs.__name.call(void 0, resolvePathsConfig, "resolvePathsConfig");
31
+ var resolvePathsPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => ({
29
32
  name: "storm:resolve-paths",
30
33
  setup(build) {
31
- const parentTsConfig = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/${build.initialOptions.tsconfig}`);
32
- const resolvedTsPaths = resolvePathsConfig(parentTsConfig, process.cwd());
34
+ const parentTsConfig = build.initialOptions.tsconfig ? _chunkBGYQAVKQcjs.__require.call(void 0, _chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, build.initialOptions.tsconfig)) : _chunkBGYQAVKQcjs.__require.call(void 0, _chunkLVWQSCJMcjs.joinPaths.call(void 0, resolvedOptions.config.workspaceRoot, "tsconfig.json"));
35
+ const resolvedTsPaths = resolvePathsConfig(parentTsConfig, options.projectRoot);
33
36
  const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
34
37
  build.onResolve({
35
38
  filter: packagesRegex
@@ -45,9 +48,8 @@ var resolvePathsPlugin = {
45
48
  };
46
49
  });
47
50
  }
48
- };
51
+ }), "resolvePathsPlugin");
49
52
 
50
53
 
51
54
 
52
55
  exports.resolvePathsPlugin = resolvePathsPlugin;
53
- //# sourceMappingURL=chunk-BF5W6GVP.cjs.map
@@ -0,0 +1,60 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
5
+
6
+ // src/plugins/native-node-module.ts
7
+ var _path = require('path');
8
+ var nativeNodeModulesPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => {
9
+ return {
10
+ name: "native-node-modules",
11
+ setup(build) {
12
+ build.onResolve({
13
+ filter: /\.node$/,
14
+ namespace: "file"
15
+ }, (args) => {
16
+ const resolvedId = _chunkBGYQAVKQcjs.__require.resolve(args.path, {
17
+ paths: [
18
+ args.resolveDir
19
+ ]
20
+ });
21
+ if (resolvedId.endsWith(".node")) {
22
+ return {
23
+ path: resolvedId,
24
+ namespace: "node-file"
25
+ };
26
+ }
27
+ return {
28
+ path: resolvedId
29
+ };
30
+ });
31
+ build.onLoad({
32
+ filter: /.*/,
33
+ namespace: "node-file"
34
+ }, (args) => {
35
+ return {
36
+ contents: `
37
+ import path from ${JSON.stringify(args.path)}
38
+ try { module.exports = require(path) }
39
+ catch {}
40
+ `,
41
+ resolveDir: _path.dirname.call(void 0, args.path)
42
+ };
43
+ });
44
+ build.onResolve({
45
+ filter: /\.node$/,
46
+ namespace: "node-file"
47
+ }, (args) => ({
48
+ path: args.path,
49
+ namespace: "file"
50
+ }));
51
+ const opts = build.initialOptions;
52
+ opts.loader = opts.loader || {};
53
+ opts.loader[".node"] = "file";
54
+ }
55
+ };
56
+ }, "nativeNodeModulesPlugin");
57
+
58
+
59
+
60
+ exports.nativeNodeModulesPlugin = nativeNodeModulesPlugin;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,60 @@
1
+ import {
2
+ __name,
3
+ __require
4
+ } from "./chunk-3GQAWCBQ.js";
5
+
6
+ // src/plugins/native-node-module.ts
7
+ import { dirname } from "node:path";
8
+ var nativeNodeModulesPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
9
+ return {
10
+ name: "native-node-modules",
11
+ setup(build) {
12
+ build.onResolve({
13
+ filter: /\.node$/,
14
+ namespace: "file"
15
+ }, (args) => {
16
+ const resolvedId = __require.resolve(args.path, {
17
+ paths: [
18
+ args.resolveDir
19
+ ]
20
+ });
21
+ if (resolvedId.endsWith(".node")) {
22
+ return {
23
+ path: resolvedId,
24
+ namespace: "node-file"
25
+ };
26
+ }
27
+ return {
28
+ path: resolvedId
29
+ };
30
+ });
31
+ build.onLoad({
32
+ filter: /.*/,
33
+ namespace: "node-file"
34
+ }, (args) => {
35
+ return {
36
+ contents: `
37
+ import path from ${JSON.stringify(args.path)}
38
+ try { module.exports = require(path) }
39
+ catch {}
40
+ `,
41
+ resolveDir: dirname(args.path)
42
+ };
43
+ });
44
+ build.onResolve({
45
+ filter: /\.node$/,
46
+ namespace: "node-file"
47
+ }, (args) => ({
48
+ path: args.path,
49
+ namespace: "file"
50
+ }));
51
+ const opts = build.initialOptions;
52
+ opts.loader = opts.loader || {};
53
+ opts.loader[".node"] = "file";
54
+ }
55
+ };
56
+ }, "nativeNodeModulesPlugin");
57
+
58
+ export {
59
+ nativeNodeModulesPlugin
60
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkVBINBV4Zcjs = require('./chunk-VBINBV4Z.cjs');
5
+
6
+
7
+ var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
8
+
9
+ // src/clean.ts
10
+ var _node = require('@humanfs/node');
11
+ async function clean(name = "ESBuild", directory, config) {
12
+ _chunkVBINBV4Zcjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
13
+ const stopwatch = _chunkVBINBV4Zcjs.getStopwatch.call(void 0, `${name} output clean`);
14
+ await _node.hfs.deleteAll(directory);
15
+ stopwatch();
16
+ }
17
+ _chunkBGYQAVKQcjs.__name.call(void 0, clean, "clean");
18
+
19
+
20
+
21
+ exports.clean = clean;