@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
@@ -1,167 +0,0 @@
1
- import {
2
- writeError
3
- } from "./chunk-VQHKIS7J.js";
4
- import {
5
- __name
6
- } from "./chunk-CCEWV2BR.js";
7
-
8
- // src/tsc.ts
9
- import { loadTsConfig } from "bundle-require";
10
- import defu from "defu";
11
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
12
- import { dirname, isAbsolute, join, normalize } from "node:path";
13
- import ts from "typescript";
14
- function ensureTempDeclarationDir(workspaceConfig) {
15
- const root = workspaceConfig.directories.temp || join(workspaceConfig.workspaceRoot, "tmp");
16
- const dirPath = join(root, ".tsc", "declaration");
17
- if (existsSync(dirPath)) {
18
- return dirPath;
19
- }
20
- mkdirSync(dirPath, {
21
- recursive: true
22
- });
23
- const gitIgnorePath = join(root, ".tsc", ".gitignore");
24
- writeFileSync(gitIgnorePath, "**/*\n");
25
- return dirPath;
26
- }
27
- __name(ensureTempDeclarationDir, "ensureTempDeclarationDir");
28
- function slash(path) {
29
- const isExtendedLengthPath = path.startsWith("\\\\?\\");
30
- if (isExtendedLengthPath) {
31
- return path;
32
- }
33
- return path.replace(/\\/g, "/");
34
- }
35
- __name(slash, "slash");
36
- function toAbsolutePath(workspaceConfig, p, cwd) {
37
- if (isAbsolute(p)) {
38
- return p;
39
- }
40
- return slash(normalize(join(cwd || workspaceConfig.workspaceRoot, p)));
41
- }
42
- __name(toAbsolutePath, "toAbsolutePath");
43
- var AliasPool = class AliasPool2 {
44
- static {
45
- __name(this, "AliasPool");
46
- }
47
- seen = /* @__PURE__ */ new Set();
48
- assign(name) {
49
- let suffix = 0;
50
- let alias = name === "default" ? "default_alias" : name;
51
- while (this.seen.has(alias)) {
52
- alias = `${name}_alias_${++suffix}`;
53
- if (suffix >= 1e3) {
54
- throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
55
- }
56
- }
57
- this.seen.add(alias);
58
- return alias;
59
- }
60
- };
61
- function getExports(workspaceConfig, program, fileMapping) {
62
- const checker = program.getTypeChecker();
63
- const aliasPool = new AliasPool();
64
- const assignAlias = aliasPool.assign.bind(aliasPool);
65
- function extractExports(sourceFileName) {
66
- const cwd = program.getCurrentDirectory();
67
- sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
68
- const sourceFile = program.getSourceFile(sourceFileName);
69
- if (!sourceFile) {
70
- return [];
71
- }
72
- const destFileName = fileMapping.get(sourceFileName);
73
- if (!destFileName) {
74
- return [];
75
- }
76
- const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
77
- if (!moduleSymbol) {
78
- return [];
79
- }
80
- const exports = [];
81
- const exportSymbols = checker.getExportsOfModule(moduleSymbol);
82
- exportSymbols.forEach((symbol) => {
83
- const name = symbol.getName();
84
- exports.push({
85
- kind: "named",
86
- sourceFileName,
87
- destFileName,
88
- name,
89
- alias: assignAlias(name),
90
- isTypeOnly: false
91
- });
92
- });
93
- return exports;
94
- }
95
- __name(extractExports, "extractExports");
96
- return program.getRootFileNames().flatMap(extractExports);
97
- }
98
- __name(getExports, "getExports");
99
- function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
100
- const fileMapping = /* @__PURE__ */ new Map();
101
- const writeFile = /* @__PURE__ */ __name((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
102
- const sourceFile = sourceFiles?.[0];
103
- const sourceFileName = sourceFile?.fileName;
104
- if (sourceFileName && !fileName.endsWith(".map")) {
105
- const cwd = program.getCurrentDirectory();
106
- fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
107
- }
108
- return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
109
- }, "writeFile");
110
- const emitResult = program.emit(void 0, writeFile, void 0, emitOnlyDtsFiles, customTransformers);
111
- const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
112
- const diagnosticMessages = [];
113
- diagnostics.forEach((diagnostic) => {
114
- if (diagnostic.file) {
115
- const { line, character } = ts.getLineAndCharacterOfPosition(
116
- diagnostic.file,
117
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
118
- diagnostic.start
119
- );
120
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
121
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
122
- } else {
123
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
124
- diagnosticMessages.push(message);
125
- }
126
- });
127
- const diagnosticMessage = diagnosticMessages.join("\n");
128
- if (diagnosticMessage) {
129
- writeError(`Failed to emit declaration files.
130
-
131
- ${diagnosticMessage}`, workspaceConfig);
132
- throw new Error("TypeScript compilation failed");
133
- }
134
- return fileMapping;
135
- }
136
- __name(emitDtsFiles, "emitDtsFiles");
137
- function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
138
- const rawTsconfig = loadTsConfig(workspaceConfig.workspaceRoot, tsconfig);
139
- if (!rawTsconfig) {
140
- throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
141
- }
142
- const declarationDir = ensureTempDeclarationDir(workspaceConfig);
143
- const parsedTsconfig = ts.parseJsonConfigFileContent(defu({
144
- compilerOptions: {
145
- // Enable declaration emit and disable javascript emit
146
- noEmit: false,
147
- declaration: true,
148
- declarationMap: true,
149
- declarationDir,
150
- emitDeclarationOnly: true
151
- }
152
- }, tsconfigRaw?.compilerOptions ?? {}, rawTsconfig.data ?? {}), ts.sys, tsconfig ? dirname(tsconfig) : "./");
153
- const options = parsedTsconfig.options;
154
- const host = ts.createCompilerHost(options);
155
- const program = ts.createProgram(parsedTsconfig.fileNames, options, host);
156
- const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
157
- return getExports(workspaceConfig, program, fileMapping);
158
- }
159
- __name(emitDts, "emitDts");
160
-
161
- export {
162
- ensureTempDeclarationDir,
163
- slash,
164
- toAbsolutePath,
165
- emitDtsFiles,
166
- emitDts
167
- };
@@ -1,140 +0,0 @@
1
- import {
2
- writeError
3
- } from "./chunk-VQHKIS7J.js";
4
- import {
5
- joinPaths
6
- } from "./chunk-Y7JBB452.js";
7
- import {
8
- __name,
9
- __require
10
- } from "./chunk-CCEWV2BR.js";
11
-
12
- // src/plugins/tsc.ts
13
- import { Extractor, ExtractorConfig } from "@microsoft/api-extractor";
14
-
15
- // ../config-tools/src/utilities/run.ts
16
- import { exec, execSync } from "node:child_process";
17
- var LARGE_BUFFER = 1024 * 1e6;
18
- var run = /* @__PURE__ */ __name((config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
19
- return execSync(command, {
20
- cwd,
21
- env: {
22
- ...process.env,
23
- ...env,
24
- CLICOLOR: "true",
25
- FORCE_COLOR: "true"
26
- },
27
- windowsHide: true,
28
- stdio,
29
- maxBuffer: LARGE_BUFFER,
30
- killSignal: "SIGTERM"
31
- });
32
- }, "run");
33
-
34
- // src/plugins/tsc.ts
35
- import { existsSync } from "node:fs";
36
- import fs from "node:fs/promises";
37
- function bundleTypeDefinitions(filename, outfile, context) {
38
- const { dependencies, peerDependencies, devDependencies } = __require(joinPaths(context.workspaceConfig.workspaceRoot, "package.json"));
39
- const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap((p) => [
40
- p,
41
- getTypeDependencyPackageName(p)
42
- ]);
43
- const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap((p) => [
44
- p,
45
- getTypeDependencyPackageName(p)
46
- ]);
47
- const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap((p) => [
48
- p,
49
- getTypeDependencyPackageName(p)
50
- ]);
51
- const includeDeps = devDependenciesKeys;
52
- const excludeDeps = /* @__PURE__ */ new Set([
53
- ...dependenciesKeys,
54
- ...peerDependenciesKeys,
55
- ...context.options.external ?? []
56
- ]);
57
- const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
58
- const extractorConfig = ExtractorConfig.prepare({
59
- configObject: {
60
- projectFolder: context.options.projectRoot,
61
- mainEntryPointFilePath: filename,
62
- bundledPackages,
63
- compiler: {
64
- tsconfigFilePath: context.options.tsconfig,
65
- overrideTsconfig: {
66
- compilerOptions: {
67
- paths: {}
68
- // bug with api extract + paths
69
- }
70
- }
71
- },
72
- dtsRollup: {
73
- enabled: true,
74
- untrimmedFilePath: joinPaths(context.workspaceConfig.workspaceRoot, `${outfile}.d.ts`)
75
- },
76
- tsdocMetadata: {
77
- enabled: false
78
- }
79
- },
80
- packageJsonFullPath: joinPaths(context.workspaceConfig.workspaceRoot, "package.json"),
81
- configObjectFullPath: void 0
82
- });
83
- const extractorResult = Extractor.invoke(extractorConfig, {
84
- showVerboseMessages: true,
85
- localBuild: true
86
- });
87
- if (extractorResult.succeeded === false) {
88
- writeError(`API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
89
- throw new Error("API Extractor completed with errors");
90
- }
91
- }
92
- __name(bundleTypeDefinitions, "bundleTypeDefinitions");
93
- var tscPlugin = /* @__PURE__ */ __name((context) => ({
94
- name: "storm:tsc",
95
- setup(build) {
96
- if (context.options.dts === false) {
97
- return;
98
- }
99
- build.onStart(async () => {
100
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
101
- await run(context.workspaceConfig, `pnpm exec tsc --project ${context.options.tsconfig}`, context.workspaceConfig.workspaceRoot);
102
- }
103
- if (context.options.bundle && context.options.entry) {
104
- const sourceRoot = context.sourceRoot.replaceAll(context.options.projectRoot, "");
105
- const typeOutDir = context.options.outputPath || joinPaths(context.workspaceConfig.workspaceRoot, "dist", context.options.projectRoot);
106
- const entries = Array.isArray(context.options.entry) ? context.options.entry : Object.values(context.options.entry);
107
- for (const entry of entries) {
108
- const entryPoint = entry.replace(sourceRoot, "").replace(/\.ts$/, "");
109
- const bundlePath = joinPaths(typeOutDir, entryPoint);
110
- let dtsPath;
111
- if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`))) {
112
- dtsPath = joinPaths(context.workspaceConfig.workspaceRoot, typeOutDir, `${entryPoint}.d.ts`);
113
- } else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`))) {
114
- dtsPath = joinPaths(context.workspaceConfig.workspaceRoot, typeOutDir, `${entryPoint.replace(/^src\//, "")}.d.ts`);
115
- }
116
- const ext = (Array.isArray(context.options.format) ? context.options.format?.some((format) => format === "esm") : context.options.format === "esm") ? "d.mts" : "d.ts";
117
- if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
118
- bundleTypeDefinitions(dtsPath, bundlePath, context);
119
- const dtsContents = await fs.readFile(`${bundlePath}.d.ts`, "utf8");
120
- await fs.writeFile(`${bundlePath}.${ext}`, dtsContents);
121
- } else {
122
- await fs.writeFile(`${bundlePath}.${ext}`, `export * from './${entryPoint}'`);
123
- }
124
- }
125
- }
126
- });
127
- }
128
- }), "tscPlugin");
129
- function getTypeDependencyPackageName(npmPackage) {
130
- if (npmPackage.startsWith("@")) {
131
- const [scope, name] = npmPackage.split("/");
132
- return `@types/${scope?.slice(1)}__${name}`;
133
- }
134
- return `@types/${npmPackage}`;
135
- }
136
- __name(getTypeDependencyPackageName, "getTypeDependencyPackageName");
137
-
138
- export {
139
- tscPlugin
140
- };
@@ -1,23 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-CCEWV2BR.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
- };
@@ -1,39 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});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
- ));
33
-
34
-
35
-
36
-
37
-
38
-
39
- exports.__name = __name; exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
@@ -1,26 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkGJHRTQAScjs = require('./chunk-GJHRTQAS.cjs');
4
-
5
-
6
- var _chunkB4CUDMY2cjs = require('./chunk-B4CUDMY2.cjs');
7
-
8
- // src/plugins/on-error.ts
9
- var onErrorPlugin = /* @__PURE__ */ _chunkB4CUDMY2cjs.__name.call(void 0, (options, resolvedOptions) => ({
10
- name: "storm:on-error",
11
- setup(build) {
12
- build.onEnd((result) => {
13
- if (result.errors.length > 0 && process.env.WATCH !== "true") {
14
- _chunkGJHRTQAScjs.writeError.call(void 0, `The following errors occurred during the build:
15
- ${result.errors.map((error) => error.text).join("\n")}
16
-
17
- `);
18
- throw new Error("Storm esbuild process failed with errors.");
19
- }
20
- });
21
- }
22
- }), "onErrorPlugin");
23
-
24
-
25
-
26
- exports.onErrorPlugin = onErrorPlugin;
@@ -1,26 +0,0 @@
1
- import {
2
- writeError
3
- } from "./chunk-VQHKIS7J.js";
4
- import {
5
- __name
6
- } from "./chunk-CCEWV2BR.js";
7
-
8
- // src/plugins/on-error.ts
9
- var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
10
- name: "storm:on-error",
11
- setup(build) {
12
- build.onEnd((result) => {
13
- if (result.errors.length > 0 && process.env.WATCH !== "true") {
14
- writeError(`The following errors occurred during the build:
15
- ${result.errors.map((error) => error.text).join("\n")}
16
-
17
- `);
18
- throw new Error("Storm esbuild process failed with errors.");
19
- }
20
- });
21
- }
22
- }), "onErrorPlugin");
23
-
24
- export {
25
- onErrorPlugin
26
- };
@@ -1,39 +0,0 @@
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
- ));
33
-
34
- export {
35
- __name,
36
- __require,
37
- __commonJS,
38
- __toESM
39
- };
@@ -1,167 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkGJHRTQAScjs = require('./chunk-GJHRTQAS.cjs');
4
-
5
-
6
- var _chunkB4CUDMY2cjs = require('./chunk-B4CUDMY2.cjs');
7
-
8
- // src/tsc.ts
9
- var _bundlerequire = require('bundle-require');
10
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
11
- var _fs = require('fs');
12
- var _path = require('path');
13
- var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
14
- function ensureTempDeclarationDir(workspaceConfig) {
15
- const root = workspaceConfig.directories.temp || _path.join.call(void 0, workspaceConfig.workspaceRoot, "tmp");
16
- const dirPath = _path.join.call(void 0, root, ".tsc", "declaration");
17
- if (_fs.existsSync.call(void 0, dirPath)) {
18
- return dirPath;
19
- }
20
- _fs.mkdirSync.call(void 0, dirPath, {
21
- recursive: true
22
- });
23
- const gitIgnorePath = _path.join.call(void 0, root, ".tsc", ".gitignore");
24
- _fs.writeFileSync.call(void 0, gitIgnorePath, "**/*\n");
25
- return dirPath;
26
- }
27
- _chunkB4CUDMY2cjs.__name.call(void 0, ensureTempDeclarationDir, "ensureTempDeclarationDir");
28
- function slash(path) {
29
- const isExtendedLengthPath = path.startsWith("\\\\?\\");
30
- if (isExtendedLengthPath) {
31
- return path;
32
- }
33
- return path.replace(/\\/g, "/");
34
- }
35
- _chunkB4CUDMY2cjs.__name.call(void 0, slash, "slash");
36
- function toAbsolutePath(workspaceConfig, p, cwd) {
37
- if (_path.isAbsolute.call(void 0, p)) {
38
- return p;
39
- }
40
- return slash(_path.normalize.call(void 0, _path.join.call(void 0, cwd || workspaceConfig.workspaceRoot, p)));
41
- }
42
- _chunkB4CUDMY2cjs.__name.call(void 0, toAbsolutePath, "toAbsolutePath");
43
- var AliasPool = (_class = class AliasPool2 {constructor() { _class.prototype.__init.call(this); }
44
- static {
45
- _chunkB4CUDMY2cjs.__name.call(void 0, this, "AliasPool");
46
- }
47
- __init() {this.seen = /* @__PURE__ */ new Set()}
48
- assign(name) {
49
- let suffix = 0;
50
- let alias = name === "default" ? "default_alias" : name;
51
- while (this.seen.has(alias)) {
52
- alias = `${name}_alias_${++suffix}`;
53
- if (suffix >= 1e3) {
54
- throw new Error("Alias generation exceeded limit. Possible infinite loop detected.");
55
- }
56
- }
57
- this.seen.add(alias);
58
- return alias;
59
- }
60
- }, _class);
61
- function getExports(workspaceConfig, program, fileMapping) {
62
- const checker = program.getTypeChecker();
63
- const aliasPool = new AliasPool();
64
- const assignAlias = aliasPool.assign.bind(aliasPool);
65
- function extractExports(sourceFileName) {
66
- const cwd = program.getCurrentDirectory();
67
- sourceFileName = toAbsolutePath(workspaceConfig, sourceFileName, cwd);
68
- const sourceFile = program.getSourceFile(sourceFileName);
69
- if (!sourceFile) {
70
- return [];
71
- }
72
- const destFileName = fileMapping.get(sourceFileName);
73
- if (!destFileName) {
74
- return [];
75
- }
76
- const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
77
- if (!moduleSymbol) {
78
- return [];
79
- }
80
- const exports = [];
81
- const exportSymbols = checker.getExportsOfModule(moduleSymbol);
82
- exportSymbols.forEach((symbol) => {
83
- const name = symbol.getName();
84
- exports.push({
85
- kind: "named",
86
- sourceFileName,
87
- destFileName,
88
- name,
89
- alias: assignAlias(name),
90
- isTypeOnly: false
91
- });
92
- });
93
- return exports;
94
- }
95
- _chunkB4CUDMY2cjs.__name.call(void 0, extractExports, "extractExports");
96
- return program.getRootFileNames().flatMap(extractExports);
97
- }
98
- _chunkB4CUDMY2cjs.__name.call(void 0, getExports, "getExports");
99
- function emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles = true, customTransformers) {
100
- const fileMapping = /* @__PURE__ */ new Map();
101
- const writeFile = /* @__PURE__ */ _chunkB4CUDMY2cjs.__name.call(void 0, (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
102
- const sourceFile = _optionalChain([sourceFiles, 'optionalAccess', _ => _[0]]);
103
- const sourceFileName = _optionalChain([sourceFile, 'optionalAccess', _2 => _2.fileName]);
104
- if (sourceFileName && !fileName.endsWith(".map")) {
105
- const cwd = program.getCurrentDirectory();
106
- fileMapping.set(toAbsolutePath(workspaceConfig, sourceFileName, cwd), toAbsolutePath(workspaceConfig, fileName, cwd));
107
- }
108
- return host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
109
- }, "writeFile");
110
- const emitResult = program.emit(void 0, writeFile, void 0, emitOnlyDtsFiles, customTransformers);
111
- const diagnostics = _typescript2.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
112
- const diagnosticMessages = [];
113
- diagnostics.forEach((diagnostic) => {
114
- if (diagnostic.file) {
115
- const { line, character } = _typescript2.default.getLineAndCharacterOfPosition(
116
- diagnostic.file,
117
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
118
- diagnostic.start
119
- );
120
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
121
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
122
- } else {
123
- const message = _typescript2.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
124
- diagnosticMessages.push(message);
125
- }
126
- });
127
- const diagnosticMessage = diagnosticMessages.join("\n");
128
- if (diagnosticMessage) {
129
- _chunkGJHRTQAScjs.writeError.call(void 0, `Failed to emit declaration files.
130
-
131
- ${diagnosticMessage}`, workspaceConfig);
132
- throw new Error("TypeScript compilation failed");
133
- }
134
- return fileMapping;
135
- }
136
- _chunkB4CUDMY2cjs.__name.call(void 0, emitDtsFiles, "emitDtsFiles");
137
- function emitDts(workspaceConfig, tsconfig, tsconfigRaw, emitOnlyDtsFiles = true, customTransformers) {
138
- const rawTsconfig = _bundlerequire.loadTsConfig.call(void 0, workspaceConfig.workspaceRoot, tsconfig);
139
- if (!rawTsconfig) {
140
- throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${workspaceConfig.workspaceRoot}`);
141
- }
142
- const declarationDir = ensureTempDeclarationDir(workspaceConfig);
143
- const parsedTsconfig = _typescript2.default.parseJsonConfigFileContent(_defu2.default.call(void 0, {
144
- compilerOptions: {
145
- // Enable declaration emit and disable javascript emit
146
- noEmit: false,
147
- declaration: true,
148
- declarationMap: true,
149
- declarationDir,
150
- emitDeclarationOnly: true
151
- }
152
- }, _nullishCoalesce(_optionalChain([tsconfigRaw, 'optionalAccess', _3 => _3.compilerOptions]), () => ( {})), _nullishCoalesce(rawTsconfig.data, () => ( {}))), _typescript2.default.sys, tsconfig ? _path.dirname.call(void 0, tsconfig) : "./");
153
- const options = parsedTsconfig.options;
154
- const host = _typescript2.default.createCompilerHost(options);
155
- const program = _typescript2.default.createProgram(parsedTsconfig.fileNames, options, host);
156
- const fileMapping = emitDtsFiles(workspaceConfig, program, host, emitOnlyDtsFiles, customTransformers);
157
- return getExports(workspaceConfig, program, fileMapping);
158
- }
159
- _chunkB4CUDMY2cjs.__name.call(void 0, emitDts, "emitDts");
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
- exports.ensureTempDeclarationDir = ensureTempDeclarationDir; exports.slash = slash; exports.toAbsolutePath = toAbsolutePath; exports.emitDtsFiles = emitDtsFiles; exports.emitDts = emitDts;
@@ -1,29 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkB4CUDMY2cjs = require('./chunk-B4CUDMY2.cjs');
5
-
6
- // src/plugins/fix-imports.ts
7
- var fixImportsPlugin = /* @__PURE__ */ _chunkB4CUDMY2cjs.__name.call(void 0, (options, resolvedOptions) => ({
8
- name: "storm:fix-imports",
9
- setup(build) {
10
- build.onResolve({
11
- filter: /^spdx-exceptions/
12
- }, () => {
13
- return {
14
- path: _chunkB4CUDMY2cjs.__require.resolve("spdx-exceptions")
15
- };
16
- });
17
- build.onResolve({
18
- filter: /^spdx-license-ids/
19
- }, () => {
20
- return {
21
- path: _chunkB4CUDMY2cjs.__require.resolve("spdx-license-ids")
22
- };
23
- });
24
- }
25
- }), "fixImportsPlugin");
26
-
27
-
28
-
29
- exports.fixImportsPlugin = fixImportsPlugin;