@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
@@ -1,15 +1,40 @@
1
+ import {
2
+ writeError
3
+ } from "./chunk-HQGUIF4U.js";
4
+ import {
5
+ joinPaths
6
+ } from "./chunk-7MDMXJ5V.js";
1
7
  import {
2
8
  __name,
3
9
  __require
4
- } from "./chunk-WCQVDF3K.js";
10
+ } from "./chunk-3GQAWCBQ.js";
5
11
 
6
12
  // src/plugins/tsc.ts
7
13
  import { hfs } from "@humanfs/node";
8
14
  import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
9
- import { loadStormConfig, run, writeError } from "@storm-software/config-tools";
10
- import path from "node:path";
11
- function bundleTypeDefinitions(filename, outfile, externals) {
12
- const { dependencies, peerDependencies, devDependencies } = __require(`${process.cwd()}/package.json`);
15
+
16
+ // ../config-tools/src/utilities/run.ts
17
+ import { exec, execSync } from "node:child_process";
18
+ var LARGE_BUFFER = 1024 * 1e6;
19
+ var run = /* @__PURE__ */ __name((config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
20
+ return execSync(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 } = __require(joinPaths(options.projectRoot, "package.json"));
13
38
  const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
14
39
  p,
15
40
  getTypeDependencyPackageName(p)
@@ -31,11 +56,11 @@ function bundleTypeDefinitions(filename, outfile, externals) {
31
56
  const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
32
57
  const extractorConfig = ExtractorConfig.prepare({
33
58
  configObject: {
34
- projectFolder: process.cwd(),
59
+ projectFolder: options.projectRoot,
35
60
  mainEntryPointFilePath: filename,
36
61
  bundledPackages,
37
62
  compiler: {
38
- tsconfigFilePath: path.join(process.cwd(), "tsconfig.build.json"),
63
+ tsconfigFilePath: options.tsconfig,
39
64
  overrideTsconfig: {
40
65
  compilerOptions: {
41
66
  paths: {}
@@ -45,13 +70,13 @@ function bundleTypeDefinitions(filename, outfile, externals) {
45
70
  },
46
71
  dtsRollup: {
47
72
  enabled: true,
48
- untrimmedFilePath: path.join(process.cwd(), `${outfile}.d.ts`)
73
+ untrimmedFilePath: joinPaths(options.outdir, `${outfile}.d.ts`)
49
74
  },
50
75
  tsdocMetadata: {
51
76
  enabled: false
52
77
  }
53
78
  },
54
- packageJsonFullPath: path.join(process.cwd(), "package.json"),
79
+ packageJsonFullPath: joinPaths(options.projectRoot, "package.json"),
55
80
  configObjectFullPath: void 0
56
81
  });
57
82
  const extractorResult = Extractor.invoke(extractorConfig, {
@@ -64,34 +89,34 @@ function bundleTypeDefinitions(filename, outfile, externals) {
64
89
  }
65
90
  }
66
91
  __name(bundleTypeDefinitions, "bundleTypeDefinitions");
67
- var tscPlugin = /* @__PURE__ */ __name((emitTypes) => ({
68
- name: "tscPlugin",
92
+ var tscPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
93
+ name: "storm:tsc",
69
94
  setup(build) {
70
- const options = build.initialOptions;
71
- if (emitTypes === false) return;
95
+ if (options.emitTypes === false) {
96
+ return;
97
+ }
72
98
  build.onStart(async () => {
73
- const config = await loadStormConfig();
74
99
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
75
- await run(config, `pnpm exec tsc --project ${options.tsconfig} --paths null`, config.workspaceRoot);
100
+ await run(resolvedOptions.config, `pnpm exec tsc --project ${resolvedOptions.tsconfig}`, resolvedOptions.config.workspaceRoot);
76
101
  }
77
- if (options.bundle && options.outfile && options.entryPoints?.[0].endsWith(".ts")) {
78
- const tsconfig = __require(`${process.cwd()}/${options.tsconfig}`);
79
- const typeOutDir = tsconfig?.compilerOptions?.outDir ?? ".";
80
- const entryPoint = options.entryPoints?.[0].replace(/\.ts$/, "");
81
- const bundlePath = options.outfile.replace(/\.m?js$/, "");
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 = joinPaths(resolvedOptions.outdir, entryPoint);
82
107
  let dtsPath;
83
- if (await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)) {
84
- dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;
85
- } else if (await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`)) {
86
- dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`;
108
+ if (await hfs.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
109
+ dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
110
+ } else if (await hfs.isFile(joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
111
+ dtsPath = joinPaths(resolvedOptions.config.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
87
112
  }
88
- const ext = options.format === "esm" ? "d.mts" : "d.ts";
113
+ const ext = resolvedOptions.outExtension.dts || resolvedOptions.format === "esm" ? "d.mts" : "d.ts";
89
114
  if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
90
- bundleTypeDefinitions(dtsPath, bundlePath, options.external ?? []);
115
+ bundleTypeDefinitions(dtsPath, bundlePath, resolvedOptions.external ?? [], resolvedOptions);
91
116
  const dtsContents = await hfs.text(`${bundlePath}.d.ts`);
92
117
  await hfs.write(`${bundlePath}.${ext}`, dtsContents);
93
118
  } else {
94
- await hfs.write(`${bundlePath}.${ext}`, `export * from '${process.cwd()}/${entryPoint}'`);
119
+ await hfs.write(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
95
120
  }
96
121
  }
97
122
  });
@@ -109,4 +134,3 @@ __name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
109
134
  export {
110
135
  tscPlugin
111
136
  };
112
- //# sourceMappingURL=chunk-KJ7ZHAFS.js.map
@@ -0,0 +1,26 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
4
+
5
+ // ../config-tools/src/utilities/correct-paths.ts
6
+ var _devkit = require('@nx/devkit');
7
+ var correctPaths = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (path) => {
8
+ if (!path) {
9
+ return "";
10
+ }
11
+ if (!path.toUpperCase().startsWith("C:") && path.includes("\\")) {
12
+ path = `C:${path}`;
13
+ }
14
+ return path.replaceAll("\\", "/");
15
+ }, "correctPaths");
16
+ var joinPaths = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (...paths) => {
17
+ if (!paths || paths.length === 0) {
18
+ return "";
19
+ }
20
+ return correctPaths(_devkit.joinPathFragments.call(void 0, ...paths.map((path) => correctPaths(path))));
21
+ }, "joinPaths");
22
+
23
+
24
+
25
+
26
+ exports.correctPaths = correctPaths; exports.joinPaths = joinPaths;
@@ -0,0 +1,23 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-3GQAWCBQ.js";
4
+
5
+ // src/plugins/node-protocol.ts
6
+ var nodeProtocolPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
7
+ const nodeProtocol = "node:";
8
+ return {
9
+ name: "node-protocol-plugin",
10
+ setup({ onResolve }) {
11
+ onResolve({
12
+ filter: /^node:/
13
+ }, ({ path }) => ({
14
+ path: path.slice(nodeProtocol.length),
15
+ external: true
16
+ }));
17
+ }
18
+ };
19
+ }, "nodeProtocolPlugin");
20
+
21
+ export {
22
+ nodeProtocolPlugin
23
+ };