@storm-software/esbuild 0.34.1 → 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.
- package/README.md +2 -1
- package/bin/esbuild.cjs +12144 -159
- package/dist/assets.cjs +9 -0
- package/dist/assets.d.cts +16 -0
- package/dist/assets.d.ts +16 -0
- package/dist/assets.js +9 -0
- package/dist/build.cjs +13 -17
- package/dist/build.d.cts +3 -13
- package/dist/build.d.ts +3 -13
- package/dist/build.js +14 -18
- package/dist/chunk-2CM3VAO5.cjs +119 -0
- package/dist/{chunk-YMTDVMD6.js → chunk-4D6ICA75.js} +36 -3
- package/dist/{chunk-RGWII6NP.js → chunk-ABRK5MYP.js} +3 -5
- package/dist/chunk-CVOQEYHW.cjs +117 -0
- package/dist/{chunk-35YNFZCF.js → chunk-DNZNN5SK.js} +2 -2
- package/dist/chunk-EBTMX5WL.js +117 -0
- package/dist/chunk-ECCVVXNX.js +100 -0
- package/dist/chunk-EDLA3ZZN.js +26 -0
- package/dist/{chunk-Y3LXNK5C.cjs → chunk-EVDNG72R.cjs} +35 -37
- package/dist/{chunk-DZPLKD6O.cjs → chunk-FQQYNAPT.cjs} +111 -189
- package/dist/{chunk-4TQE46SC.cjs → chunk-G66JI4BS.cjs} +5 -7
- package/dist/{chunk-RTDGFM3J.js → chunk-NJJBR57W.js} +24 -102
- package/dist/{chunk-IX6DNVUR.js → chunk-OCDIIBBZ.js} +2 -2
- package/dist/chunk-PTHYT3U2.cjs +2545 -0
- package/dist/chunk-QVMJLFU5.cjs +26 -0
- package/dist/chunk-QWTKBUQW.js +2545 -0
- package/dist/chunk-R2KKGNQL.js +119 -0
- package/dist/{chunk-Y4XWI6JJ.cjs → chunk-RK34D7S5.cjs} +6 -6
- package/dist/chunk-SLSBBNRF.cjs +52 -0
- package/dist/{chunk-2IGRKQGI.js → chunk-TSQT5MWW.js} +2 -4
- package/dist/{chunk-MWGFCZF4.cjs → chunk-VTBMJYSM.cjs} +6 -6
- package/dist/chunk-WLJT52I3.cjs +100 -0
- package/dist/chunk-WXURMFT7.js +52 -0
- package/dist/{chunk-XITTOHOG.cjs → chunk-YHMM6RY5.cjs} +42 -9
- package/dist/clean.cjs +4 -5
- package/dist/clean.d.cts +1 -2
- package/dist/clean.d.ts +1 -2
- package/dist/clean.js +3 -4
- package/dist/config.cjs +5 -14
- package/dist/config.d.cts +4 -6
- package/dist/config.d.ts +4 -6
- package/dist/config.js +6 -15
- package/dist/context.cjs +11 -0
- package/dist/context.d.cts +16 -0
- package/dist/context.d.ts +16 -0
- package/dist/context.js +11 -0
- package/dist/index.cjs +14 -52
- package/dist/index.d.cts +3 -216
- package/dist/index.d.ts +3 -216
- package/dist/index.js +15 -53
- package/dist/package-json.cjs +9 -0
- package/dist/package-json.d.cts +16 -0
- package/dist/package-json.d.ts +16 -0
- package/dist/package-json.js +9 -0
- package/dist/plugins/deps-check.cjs +4 -5
- package/dist/plugins/deps-check.js +3 -4
- package/dist/plugins/resolve-paths.cjs +3 -4
- package/dist/plugins/resolve-paths.d.cts +3 -4
- package/dist/plugins/resolve-paths.d.ts +3 -4
- package/dist/plugins/resolve-paths.js +2 -3
- package/dist/tsup.cjs +8 -0
- package/dist/tsup.d.cts +16 -0
- package/dist/tsup.d.ts +16 -0
- package/dist/tsup.js +8 -0
- package/dist/types.d.cts +1 -2
- package/dist/types.d.ts +1 -2
- package/dist/watch.cjs +111 -0
- package/dist/watch.d.cts +18 -0
- package/dist/watch.d.ts +18 -0
- package/dist/watch.js +111 -0
- package/package.json +59 -38
- package/dist/chunk-3GQAWCBQ.js +0 -13
- package/dist/chunk-7A6JPBG7.js +0 -421
- package/dist/chunk-BGYQAVKQ.cjs +0 -13
- package/dist/chunk-ETTFFUNG.cjs +0 -167
- package/dist/chunk-EZGTDCYM.cjs +0 -29
- package/dist/chunk-GQCYZOAM.cjs +0 -27
- package/dist/chunk-GWG4HOQ6.js +0 -29
- package/dist/chunk-HXMVEX3P.js +0 -27
- package/dist/chunk-IMVMVEQS.cjs +0 -140
- package/dist/chunk-IO2TXOKO.js +0 -26
- package/dist/chunk-K6QIYIIY.cjs +0 -26
- package/dist/chunk-LYDEMC26.js +0 -23
- package/dist/chunk-RVMQBDDK.cjs +0 -421
- package/dist/chunk-S2P6KHZV.js +0 -140
- package/dist/chunk-S6M44SSZ.cjs +0 -60
- package/dist/chunk-T5272PC2.js +0 -60
- package/dist/chunk-WRBUO7H6.cjs +0 -23
- package/dist/chunk-XEGYFRBF.js +0 -167
- package/dist/plugins/esm-split-code-to-cjs.cjs +0 -7
- package/dist/plugins/esm-split-code-to-cjs.d.cts +0 -15
- package/dist/plugins/esm-split-code-to-cjs.d.ts +0 -15
- package/dist/plugins/esm-split-code-to-cjs.js +0 -7
- package/dist/plugins/fix-imports.cjs +0 -7
- package/dist/plugins/fix-imports.d.cts +0 -14
- package/dist/plugins/fix-imports.d.ts +0 -14
- package/dist/plugins/fix-imports.js +0 -7
- package/dist/plugins/native-node-module.cjs +0 -7
- package/dist/plugins/native-node-module.d.cts +0 -11
- package/dist/plugins/native-node-module.d.ts +0 -11
- package/dist/plugins/native-node-module.js +0 -7
- package/dist/plugins/node-protocol.cjs +0 -7
- package/dist/plugins/node-protocol.d.cts +0 -15
- package/dist/plugins/node-protocol.d.ts +0 -15
- package/dist/plugins/node-protocol.js +0 -7
- package/dist/plugins/on-error.cjs +0 -9
- package/dist/plugins/on-error.d.cts +0 -14
- package/dist/plugins/on-error.d.ts +0 -14
- package/dist/plugins/on-error.js +0 -9
- package/dist/plugins/tsc.cjs +0 -9
- package/dist/plugins/tsc.d.cts +0 -14
- package/dist/plugins/tsc.d.ts +0 -14
- package/dist/plugins/tsc.js +0 -9
- package/dist/tsc.cjs +0 -17
- package/dist/tsc.d.cts +0 -21
- package/dist/tsc.d.ts +0 -21
- package/dist/tsc.js +0 -17
- package/dist/types-DwxFThZu.d.cts +0 -1286
- package/dist/types-DwxFThZu.d.ts +0 -1286
package/dist/chunk-S2P6KHZV.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeError
|
|
3
|
-
} from "./chunk-2IGRKQGI.js";
|
|
4
|
-
import {
|
|
5
|
-
joinPaths
|
|
6
|
-
} from "./chunk-YMTDVMD6.js";
|
|
7
|
-
import {
|
|
8
|
-
__name,
|
|
9
|
-
__require
|
|
10
|
-
} from "./chunk-3GQAWCBQ.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
|
-
};
|
package/dist/chunk-S6M44SSZ.cjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
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;
|
package/dist/chunk-T5272PC2.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/chunk-WRBUO7H6.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
4
|
-
|
|
5
|
-
// src/plugins/node-protocol.ts
|
|
6
|
-
var nodeProtocolPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (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
|
-
|
|
22
|
-
|
|
23
|
-
exports.nodeProtocolPlugin = nodeProtocolPlugin;
|
package/dist/chunk-XEGYFRBF.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeError
|
|
3
|
-
} from "./chunk-2IGRKQGI.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-3GQAWCBQ.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,15 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.cjs';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Code splitting only works in ESM at the moment, this plugin will convert the
|
|
11
|
-
* ESM code to CJS automatically after the build. Only works with `outdir` set.
|
|
12
|
-
*/
|
|
13
|
-
declare const esmSplitCodeToCjsPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
14
|
-
|
|
15
|
-
export { esmSplitCodeToCjsPlugin };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.js';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.js';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Code splitting only works in ESM at the moment, this plugin will convert the
|
|
11
|
-
* ESM code to CJS automatically after the build. Only works with `outdir` set.
|
|
12
|
-
*/
|
|
13
|
-
declare const esmSplitCodeToCjsPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
14
|
-
|
|
15
|
-
export { esmSplitCodeToCjsPlugin };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.cjs';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* For dependencies that forgot to add them into their package.json.
|
|
11
|
-
*/
|
|
12
|
-
declare const fixImportsPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
13
|
-
|
|
14
|
-
export { fixImportsPlugin };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.js';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.js';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* For dependencies that forgot to add them into their package.json.
|
|
11
|
-
*/
|
|
12
|
-
declare const fixImportsPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
13
|
-
|
|
14
|
-
export { fixImportsPlugin };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.cjs';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
declare const nativeNodeModulesPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
10
|
-
|
|
11
|
-
export { nativeNodeModulesPlugin };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.js';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.js';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
declare const nativeNodeModulesPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
10
|
-
|
|
11
|
-
export { nativeNodeModulesPlugin };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.cjs';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The node: protocol was added to require in Node v14.18.0
|
|
11
|
-
* https://nodejs.org/api/esm.html#node-imports
|
|
12
|
-
*/
|
|
13
|
-
declare const nodeProtocolPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
14
|
-
|
|
15
|
-
export { nodeProtocolPlugin };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.js';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.js';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The node: protocol was added to require in Node v14.18.0
|
|
11
|
-
* https://nodejs.org/api/esm.html#node-imports
|
|
12
|
-
*/
|
|
13
|
-
declare const nodeProtocolPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
14
|
-
|
|
15
|
-
export { nodeProtocolPlugin };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkK6QIYIIYcjs = require('../chunk-K6QIYIIY.cjs');
|
|
4
|
-
require('../chunk-Y3LXNK5C.cjs');
|
|
5
|
-
require('../chunk-XITTOHOG.cjs');
|
|
6
|
-
require('../chunk-BGYQAVKQ.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.onErrorPlugin = _chunkK6QIYIIYcjs.onErrorPlugin;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as esbuild from 'esbuild';
|
|
2
|
-
import { ESBuildOptions } from '../types.cjs';
|
|
3
|
-
import '@nx/devkit';
|
|
4
|
-
import '@storm-software/build-tools';
|
|
5
|
-
import '../types-DwxFThZu.cjs';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'tsup';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Causes esbuild to exit immediately with an error code.
|
|
11
|
-
*/
|
|
12
|
-
declare const onErrorPlugin: (options: ESBuildOptions, resolvedOptions: ESBuildOptions) => esbuild.Plugin;
|
|
13
|
-
|
|
14
|
-
export { onErrorPlugin };
|