@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.
- package/README.md +1 -1
- package/dist/build.cjs +15 -11
- package/dist/build.d.cts +3 -3
- package/dist/build.d.ts +3 -3
- package/dist/build.js +14 -10
- package/dist/{chunk-WCQVDF3K.js → chunk-3GQAWCBQ.js} +0 -1
- package/dist/chunk-4JLYXTKD.cjs +26 -0
- package/dist/chunk-5I2MGPRN.cjs +919 -0
- package/dist/{chunk-CMWXE5MF.js → chunk-7KR3YBS6.js} +5 -3
- package/dist/chunk-7MDMXJ5V.js +26 -0
- package/dist/{chunk-WGEGR3DF.cjs → chunk-BGYQAVKQ.cjs} +0 -1
- package/dist/{chunk-J34FQYKV.cjs → chunk-CGFDQ5AJ.cjs} +8 -5
- package/dist/{chunk-TTHABTDU.js → chunk-DAGDNKO5.js} +8 -6
- package/dist/{chunk-DFGHPRBD.cjs → chunk-EZGTDCYM.cjs} +6 -6
- package/dist/chunk-GGNOJ77I.js +0 -0
- package/dist/{chunk-YQBU3FSL.js → chunk-GWG4HOQ6.js} +4 -4
- package/dist/chunk-HQGUIF4U.js +537 -0
- package/dist/{chunk-X5TLV7MF.js → chunk-KE5DL2BG.js} +11 -6
- package/dist/{chunk-KJ7ZHAFS.js → chunk-KOK4WCHS.js} +52 -28
- package/dist/chunk-LVWQSCJM.cjs +26 -0
- package/dist/chunk-LYDEMC26.js +23 -0
- package/dist/chunk-MAMLS55E.js +582 -0
- package/dist/chunk-NVWDQVN6.js +21 -0
- package/dist/chunk-PQ6YIJ72.cjs +136 -0
- package/dist/{chunk-BF5W6GVP.cjs → chunk-RMB62XEL.cjs} +10 -8
- package/dist/chunk-S6M44SSZ.cjs +60 -0
- package/dist/chunk-SFZRYJZ2.cjs +1 -0
- package/dist/chunk-T5272PC2.js +60 -0
- package/dist/chunk-TP5EOMRD.cjs +21 -0
- package/dist/chunk-VBINBV4Z.cjs +537 -0
- package/dist/chunk-VLP3P6HF.js +919 -0
- package/dist/{chunk-KVBDKVBU.cjs → chunk-VZBOWHCM.cjs} +9 -7
- package/dist/chunk-WRBUO7H6.cjs +23 -0
- package/dist/chunk-WYMD6YG2.cjs +582 -0
- package/dist/{chunk-437F3SFI.js → chunk-YNQ45EAM.js} +7 -4
- package/dist/clean.cjs +9 -0
- package/dist/clean.d.cts +1194 -0
- package/dist/clean.d.ts +1194 -0
- package/dist/clean.js +9 -0
- package/dist/config.cjs +14 -4
- package/dist/config.d.cts +8 -13
- package/dist/config.d.ts +8 -13
- package/dist/config.js +15 -5
- package/dist/esbuild.cjs +1185 -0
- package/dist/index.cjs +21 -12
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +22 -13
- package/dist/types.cjs +1 -2
- package/dist/types.d.cts +84 -1177
- package/dist/types.d.ts +84 -1177
- package/dist/types.js +1 -2
- package/package.json +1 -222
- package/dist/build.cjs.map +0 -1
- package/dist/build.js.map +0 -1
- package/dist/chunk-263L44RM.cjs +0 -112
- package/dist/chunk-263L44RM.cjs.map +0 -1
- package/dist/chunk-437F3SFI.js.map +0 -1
- package/dist/chunk-BF5W6GVP.cjs.map +0 -1
- package/dist/chunk-CMEDJ4L4.js +0 -352
- package/dist/chunk-CMEDJ4L4.js.map +0 -1
- package/dist/chunk-CMWXE5MF.js.map +0 -1
- package/dist/chunk-D5PRB2E2.cjs +0 -40
- package/dist/chunk-D5PRB2E2.cjs.map +0 -1
- package/dist/chunk-DFGHPRBD.cjs.map +0 -1
- package/dist/chunk-DRRPNILS.js +0 -40
- package/dist/chunk-DRRPNILS.js.map +0 -1
- package/dist/chunk-J34FQYKV.cjs.map +0 -1
- package/dist/chunk-KJ7ZHAFS.js.map +0 -1
- package/dist/chunk-KVBDKVBU.cjs.map +0 -1
- package/dist/chunk-MUYXFAKB.cjs +0 -1
- package/dist/chunk-MUYXFAKB.cjs.map +0 -1
- package/dist/chunk-MVLEDP7K.cjs +0 -21
- package/dist/chunk-MVLEDP7K.cjs.map +0 -1
- package/dist/chunk-PBHOTQGA.cjs +0 -352
- package/dist/chunk-PBHOTQGA.cjs.map +0 -1
- package/dist/chunk-QNDLJ2W7.js +0 -1
- package/dist/chunk-QNDLJ2W7.js.map +0 -1
- package/dist/chunk-TTHABTDU.js.map +0 -1
- package/dist/chunk-WCQVDF3K.js.map +0 -1
- package/dist/chunk-WGEGR3DF.cjs.map +0 -1
- package/dist/chunk-X5TLV7MF.js.map +0 -1
- package/dist/chunk-YQBU3FSL.js.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.js.map +0 -1
package/dist/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
import "./chunk-GGNOJ77I.js";
|
package/package.json
CHANGED
|
@@ -1,222 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@storm-software/esbuild",
|
|
3
|
-
"version": "0.4.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "A package containing `esbuild` utilities for building Storm Software libraries and applications",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "github",
|
|
8
|
-
"url": "https://github.com/storm-software/storm-ops.git",
|
|
9
|
-
"directory": "packages/esbuild"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://stormsoftware.com",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/storm-software/storm-ops/issues",
|
|
14
|
-
"email": "support@stormsoftware.com"
|
|
15
|
-
},
|
|
16
|
-
"author": {
|
|
17
|
-
"name": "Storm Software",
|
|
18
|
-
"email": "contact@stormsoftware.com",
|
|
19
|
-
"url": "https://stormsoftware.com"
|
|
20
|
-
},
|
|
21
|
-
"maintainers": [
|
|
22
|
-
{
|
|
23
|
-
"name": "Storm Software",
|
|
24
|
-
"email": "contact@stormsoftware.com",
|
|
25
|
-
"url": "https://stormsoftware.com"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "Pat Sullivan",
|
|
29
|
-
"email": "admin@stormsoftware.com",
|
|
30
|
-
"url": "https://patsullivan.org"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"contributors": [
|
|
34
|
-
{
|
|
35
|
-
"name": "Storm Software",
|
|
36
|
-
"email": "contact@stormsoftware.com",
|
|
37
|
-
"url": "https://stormsoftware.com"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"funding": {
|
|
41
|
-
"type": "github",
|
|
42
|
-
"url": "https://github.com/sponsors/storm-software"
|
|
43
|
-
},
|
|
44
|
-
"license": "Apache-2.0",
|
|
45
|
-
"private": false,
|
|
46
|
-
"packageManager": "pnpm@9.10.0",
|
|
47
|
-
"engines": {
|
|
48
|
-
"node": ">=22.4.0",
|
|
49
|
-
"pnpm": ">=9.10.0"
|
|
50
|
-
},
|
|
51
|
-
"main": "./dist/index.cjs",
|
|
52
|
-
"module": "./dist/index.js",
|
|
53
|
-
"exports": {
|
|
54
|
-
"./package.json": "./package.json",
|
|
55
|
-
"./index": {
|
|
56
|
-
"import": {
|
|
57
|
-
"types": "./dist/index.d.ts",
|
|
58
|
-
"default": "./dist/index.js"
|
|
59
|
-
},
|
|
60
|
-
"require": {
|
|
61
|
-
"types": "./dist/index.d.cts",
|
|
62
|
-
"default": "./dist/index.cjs"
|
|
63
|
-
},
|
|
64
|
-
"default": {
|
|
65
|
-
"types": "./dist/index.d.ts",
|
|
66
|
-
"default": "./dist/index.js"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"./build": {
|
|
70
|
-
"import": {
|
|
71
|
-
"types": "./dist/build.d.ts",
|
|
72
|
-
"default": "./dist/build.js"
|
|
73
|
-
},
|
|
74
|
-
"require": {
|
|
75
|
-
"types": "./dist/build.d.cts",
|
|
76
|
-
"default": "./dist/build.cjs"
|
|
77
|
-
},
|
|
78
|
-
"default": {
|
|
79
|
-
"types": "./dist/build.d.ts",
|
|
80
|
-
"default": "./dist/build.js"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"./config": {
|
|
84
|
-
"import": {
|
|
85
|
-
"types": "./dist/config.d.ts",
|
|
86
|
-
"default": "./dist/config.js"
|
|
87
|
-
},
|
|
88
|
-
"require": {
|
|
89
|
-
"types": "./dist/config.d.cts",
|
|
90
|
-
"default": "./dist/config.cjs"
|
|
91
|
-
},
|
|
92
|
-
"default": {
|
|
93
|
-
"types": "./dist/config.d.ts",
|
|
94
|
-
"default": "./dist/config.js"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"./types": {
|
|
98
|
-
"import": {
|
|
99
|
-
"types": "./dist/types.d.ts",
|
|
100
|
-
"default": "./dist/types.js"
|
|
101
|
-
},
|
|
102
|
-
"require": {
|
|
103
|
-
"types": "./dist/types.d.cts",
|
|
104
|
-
"default": "./dist/types.cjs"
|
|
105
|
-
},
|
|
106
|
-
"default": {
|
|
107
|
-
"types": "./dist/types.d.ts",
|
|
108
|
-
"default": "./dist/types.js"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"./plugins/*": {
|
|
112
|
-
"import": {
|
|
113
|
-
"types": "./dist/plugins/*.d.ts",
|
|
114
|
-
"default": "./dist/plugins/*.js"
|
|
115
|
-
},
|
|
116
|
-
"require": {
|
|
117
|
-
"types": "./dist/plugins/*.d.cts",
|
|
118
|
-
"default": "./dist/plugins/*.cjs"
|
|
119
|
-
},
|
|
120
|
-
"default": {
|
|
121
|
-
"types": "./dist/plugins/*.d.ts",
|
|
122
|
-
"default": "./dist/plugins/*.js"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
".": {
|
|
126
|
-
"import": {
|
|
127
|
-
"types": "./dist/index.d.ts",
|
|
128
|
-
"default": "./dist/index.js"
|
|
129
|
-
},
|
|
130
|
-
"require": {
|
|
131
|
-
"types": "./dist/index.d.cts",
|
|
132
|
-
"default": "./dist/index.cjs"
|
|
133
|
-
},
|
|
134
|
-
"default": {
|
|
135
|
-
"types": "./dist/index.d.ts",
|
|
136
|
-
"default": "./dist/index.js"
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"types": "./dist/index.d.ts",
|
|
141
|
-
"files": [
|
|
142
|
-
"dist/**/*"
|
|
143
|
-
],
|
|
144
|
-
"keywords": [
|
|
145
|
-
"storm",
|
|
146
|
-
"storm-ops",
|
|
147
|
-
"storm-stack",
|
|
148
|
-
"acidic",
|
|
149
|
-
"cyclone-ui",
|
|
150
|
-
"esbuild",
|
|
151
|
-
"sullivanpj",
|
|
152
|
-
"monorepo"
|
|
153
|
-
],
|
|
154
|
-
"peerDependencies": {
|
|
155
|
-
"@microsoft/api-extractor": "^7.48.1",
|
|
156
|
-
"@nx/devkit": "^20.2.2",
|
|
157
|
-
"@nx/js": "^20.2.2",
|
|
158
|
-
"@nx/workspace": "^20.2.2",
|
|
159
|
-
"@storm-software/build-tools": "workspace:*",
|
|
160
|
-
"@storm-software/config-tools": "workspace:*",
|
|
161
|
-
"esbuild": "^0.24.0",
|
|
162
|
-
"nx": "^20.2.2",
|
|
163
|
-
"spdx-exceptions": "^2.5.0",
|
|
164
|
-
"spdx-license-ids": "^3.0.20"
|
|
165
|
-
},
|
|
166
|
-
"peerDependenciesMeta": {
|
|
167
|
-
"@microsoft/api-extractor": {
|
|
168
|
-
"optional": true
|
|
169
|
-
},
|
|
170
|
-
"@nx/devkit": {
|
|
171
|
-
"optional": false
|
|
172
|
-
},
|
|
173
|
-
"@nx/js": {
|
|
174
|
-
"optional": false
|
|
175
|
-
},
|
|
176
|
-
"@nx/workspace": {
|
|
177
|
-
"optional": false
|
|
178
|
-
},
|
|
179
|
-
"@storm-software/build-tools": {
|
|
180
|
-
"optional": false
|
|
181
|
-
},
|
|
182
|
-
"@storm-software/config-tools": {
|
|
183
|
-
"optional": false
|
|
184
|
-
},
|
|
185
|
-
"esbuild": {
|
|
186
|
-
"optional": false
|
|
187
|
-
},
|
|
188
|
-
"nx": {
|
|
189
|
-
"optional": false
|
|
190
|
-
},
|
|
191
|
-
"spdx-exceptions": {
|
|
192
|
-
"optional": true
|
|
193
|
-
},
|
|
194
|
-
"spdx-license-ids": {
|
|
195
|
-
"optional": true
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
"dependencies": {
|
|
199
|
-
"@humanfs/node": "^0.16.6",
|
|
200
|
-
"chokidar": "^4.0.3",
|
|
201
|
-
"es-toolkit": "^1.30.1",
|
|
202
|
-
"globby": "^14.0.2"
|
|
203
|
-
},
|
|
204
|
-
"devDependencies": {
|
|
205
|
-
"@microsoft/api-extractor": "^7.48.1",
|
|
206
|
-
"@nx/devkit": "^20.2.2",
|
|
207
|
-
"@nx/js": "^20.2.2",
|
|
208
|
-
"@nx/workspace": "^20.2.2",
|
|
209
|
-
"@storm-software/build-tools": "0.110.0",
|
|
210
|
-
"@storm-software/config": "1.79.0",
|
|
211
|
-
"@storm-software/config-tools": "1.118.0",
|
|
212
|
-
"esbuild": "^0.24.0",
|
|
213
|
-
"nx": "^20.2.2",
|
|
214
|
-
"spdx-exceptions": "^2.5.0",
|
|
215
|
-
"spdx-license-ids": "^3.0.20",
|
|
216
|
-
"tsup": "^8.3.5"
|
|
217
|
-
},
|
|
218
|
-
"publishConfig": {
|
|
219
|
-
"access": "public"
|
|
220
|
-
},
|
|
221
|
-
"sideEffects": false
|
|
222
|
-
}
|
|
1
|
+
{"name":"@storm-software/esbuild","version":"0.14.2","type":"module","description":"A package containing `esbuild` utilities for building Storm Software libraries and applications","repository":{"type":"github","url":"https://github.com/storm-software/storm-ops.git","directory":"packages/esbuild"},"homepage":"https://stormsoftware.com","bugs":"https://github.com/storm-software/storm-ops/issues","author":{"name":"Storm Software","email":"contact@stormsoftware.com","url":"https://stormsoftware.com"},"maintainers":[{"name":"Storm Software","email":"contact@stormsoftware.com","url":"https://stormsoftware.com"},{"name":"Pat Sullivan","email":"admin@stormsoftware.com","url":"https://patsullivan.org"}],"contributors":[{"name":"Storm Software","email":"contact@stormsoftware.com","url":"https://stormsoftware.com"}],"funding":{"type":"github","url":"https://github.com/sponsors/storm-software"},"license":"Apache-2.0","private":false,"packageManager":"pnpm@9.15.2","engines":{"node":">=22.4.0","pnpm":">=9.15.2"},"bin":{"storm-esbuild":"./bin/storm-esbuild.js","storm-esbuild-cjs":"./bin/storm-esbuild.cjs","storm-esbuild-esm":"./bin/storm-esbuild.js"},"main":"./dist/index.cjs","module":"./dist/index.js","exports":{"./package.json":"./package.json","./types":{"import":{"types":"./dist/types.d.ts","default":"./dist/types.js"},"require":{"types":"./dist/types.d.cts","default":"./dist/types.cjs"},"default":{"types":"./dist/types.d.ts","default":"./dist/types.js"}},"./index":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./config":{"import":{"types":"./dist/config.d.ts","default":"./dist/config.js"},"require":{"types":"./dist/config.d.cts","default":"./dist/config.cjs"},"default":{"types":"./dist/config.d.ts","default":"./dist/config.js"}},"./clean":{"import":{"types":"./dist/clean.d.ts","default":"./dist/clean.js"},"require":{"types":"./dist/clean.d.cts","default":"./dist/clean.cjs"},"default":{"types":"./dist/clean.d.ts","default":"./dist/clean.js"}},"./build":{"import":{"types":"./dist/build/index.d.ts","default":"./dist/build/index.js"},"require":{"types":"./dist/build/index.d.cts","default":"./dist/build/index.cjs"},"default":{"types":"./dist/build/index.d.ts","default":"./dist/build/index.js"}},"./plugins/*":{"import":{"types":"./dist/plugins/*.d.ts","default":"./dist/plugins/*.js"},"require":{"types":"./dist/plugins/*.d.cts","default":"./dist/plugins/*.cjs"},"default":{"types":"./dist/plugins/*.d.ts","default":"./dist/plugins/*.js"}}},"types":"./dist/index.d.ts","files":["dist/**/*"],"keywords":["acidic","cyclone-ui","esbuild","monorepo","storm","storm-ops","storm-stack","sullivanpj"],"peerDependencies":{"@microsoft/api-extractor":"^7.48.1","@nx/devkit":"^20.3.1","@nx/js":"^20.3.1","@storm-software/build-tools":"workspace:*","@storm-software/config-tools":"workspace:*","esbuild":"^0.24.0","spdx-exceptions":"^2.5.0","spdx-license-ids":"^3.0.20"},"peerDependenciesMeta":{"@microsoft/api-extractor":{"optional":true},"@nx/devkit":{"optional":false},"@nx/js":{"optional":false},"@storm-software/build-tools":{"optional":false},"@storm-software/config-tools":{"optional":false},"esbuild":{"optional":false},"spdx-exceptions":{"optional":true},"spdx-license-ids":{"optional":true}},"dependencies":{"@humanfs/node":"^0.16.6","chokidar":"^4.0.3","commander":"^12.1.0","es-toolkit":"^1.30.1","globby":"^14.0.2","nx":"^20.3.1","source-map":"0.7.4","tsup":"8.3.5"},"devDependencies":{"@microsoft/api-extractor":"^7.48.1","@nx/devkit":"^20.3.1","@nx/js":"^20.3.1","@storm-software/build-tools":"0.122.2","@storm-software/config":"1.91.2","@storm-software/config-tools":"1.130.2","@types/node":"^22.10.2","defu":"6.1.4","esbuild":"^0.24.0","rollup":"4.29.1","spdx-exceptions":"^2.5.0","spdx-license-ids":"^3.0.20"},"publishConfig":{"access":"public"},"sideEffects":false}
|
package/dist/build.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/build.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wCAAC","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/build.cjs"}
|
package/dist/build.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-263L44RM.cjs
DELETED
|
@@ -1,112 +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; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkWGEGR3DFcjs = require('./chunk-WGEGR3DF.cjs');
|
|
5
|
-
|
|
6
|
-
// src/plugins/tsc.ts
|
|
7
|
-
var _node = require('@humanfs/node');
|
|
8
|
-
var _apiextractor = require('@microsoft/api-extractor');
|
|
9
|
-
var _configtools = require('@storm-software/config-tools');
|
|
10
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
11
|
-
function bundleTypeDefinitions(filename, outfile, externals) {
|
|
12
|
-
const { dependencies, peerDependencies, devDependencies } = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/package.json`);
|
|
13
|
-
const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
|
|
14
|
-
p,
|
|
15
|
-
getTypeDependencyPackageName(p)
|
|
16
|
-
]);
|
|
17
|
-
const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
|
|
18
|
-
p,
|
|
19
|
-
getTypeDependencyPackageName(p)
|
|
20
|
-
]);
|
|
21
|
-
const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
|
|
22
|
-
p,
|
|
23
|
-
getTypeDependencyPackageName(p)
|
|
24
|
-
]);
|
|
25
|
-
const includeDeps = devDependenciesKeys;
|
|
26
|
-
const excludeDeps = /* @__PURE__ */ new Set([
|
|
27
|
-
...dependenciesKeys,
|
|
28
|
-
...peerDependenciesKeys,
|
|
29
|
-
...externals
|
|
30
|
-
]);
|
|
31
|
-
const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
|
|
32
|
-
const extractorConfig = _apiextractor.ExtractorConfig.prepare({
|
|
33
|
-
configObject: {
|
|
34
|
-
projectFolder: process.cwd(),
|
|
35
|
-
mainEntryPointFilePath: filename,
|
|
36
|
-
bundledPackages,
|
|
37
|
-
compiler: {
|
|
38
|
-
tsconfigFilePath: _path2.default.join(process.cwd(), "tsconfig.build.json"),
|
|
39
|
-
overrideTsconfig: {
|
|
40
|
-
compilerOptions: {
|
|
41
|
-
paths: {}
|
|
42
|
-
// bug with api extract + paths
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
dtsRollup: {
|
|
47
|
-
enabled: true,
|
|
48
|
-
untrimmedFilePath: _path2.default.join(process.cwd(), `${outfile}.d.ts`)
|
|
49
|
-
},
|
|
50
|
-
tsdocMetadata: {
|
|
51
|
-
enabled: false
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
packageJsonFullPath: _path2.default.join(process.cwd(), "package.json"),
|
|
55
|
-
configObjectFullPath: void 0
|
|
56
|
-
});
|
|
57
|
-
const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
|
|
58
|
-
showVerboseMessages: true,
|
|
59
|
-
localBuild: true
|
|
60
|
-
});
|
|
61
|
-
if (extractorResult.succeeded === false) {
|
|
62
|
-
_configtools.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
63
|
-
throw new Error("API Extractor completed with errors");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
_chunkWGEGR3DFcjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
67
|
-
var tscPlugin = /* @__PURE__ */ _chunkWGEGR3DFcjs.__name.call(void 0, (emitTypes) => ({
|
|
68
|
-
name: "tscPlugin",
|
|
69
|
-
setup(build) {
|
|
70
|
-
const options = build.initialOptions;
|
|
71
|
-
if (emitTypes === false) return;
|
|
72
|
-
build.onStart(async () => {
|
|
73
|
-
const config = await _configtools.loadStormConfig.call(void 0, );
|
|
74
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
75
|
-
await _configtools.run.call(void 0, config, `pnpm exec tsc --project ${options.tsconfig} --paths null`, config.workspaceRoot);
|
|
76
|
-
}
|
|
77
|
-
if (options.bundle && options.outfile && _optionalChain([options, 'access', _ => _.entryPoints, 'optionalAccess', _2 => _2[0], 'access', _3 => _3.endsWith, 'call', _4 => _4(".ts")])) {
|
|
78
|
-
const tsconfig = _chunkWGEGR3DFcjs.__require.call(void 0, `${process.cwd()}/${options.tsconfig}`);
|
|
79
|
-
const typeOutDir = _nullishCoalesce(_optionalChain([tsconfig, 'optionalAccess', _5 => _5.compilerOptions, 'optionalAccess', _6 => _6.outDir]), () => ( "."));
|
|
80
|
-
const entryPoint = _optionalChain([options, 'access', _7 => _7.entryPoints, 'optionalAccess', _8 => _8[0], 'access', _9 => _9.replace, 'call', _10 => _10(/\.ts$/, "")]);
|
|
81
|
-
const bundlePath = options.outfile.replace(/\.m?js$/, "");
|
|
82
|
-
let dtsPath;
|
|
83
|
-
if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)) {
|
|
84
|
-
dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;
|
|
85
|
-
} else if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`)) {
|
|
86
|
-
dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`;
|
|
87
|
-
}
|
|
88
|
-
const ext = options.format === "esm" ? "d.mts" : "d.ts";
|
|
89
|
-
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
90
|
-
bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(options.external, () => ( [])));
|
|
91
|
-
const dtsContents = await _node.hfs.text(`${bundlePath}.d.ts`);
|
|
92
|
-
await _node.hfs.write(`${bundlePath}.${ext}`, dtsContents);
|
|
93
|
-
} else {
|
|
94
|
-
await _node.hfs.write(`${bundlePath}.${ext}`, `export * from '${process.cwd()}/${entryPoint}'`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}), "tscPlugin");
|
|
100
|
-
function getTypeDependencyPackageName(npmPackage) {
|
|
101
|
-
if (npmPackage.startsWith("@")) {
|
|
102
|
-
const [scope, name] = npmPackage.split("/");
|
|
103
|
-
return `@types/${_optionalChain([scope, 'optionalAccess', _11 => _11.slice, 'call', _12 => _12(1)])}__${name}`;
|
|
104
|
-
}
|
|
105
|
-
return `@types/${npmPackage}`;
|
|
106
|
-
}
|
|
107
|
-
_chunkWGEGR3DFcjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
exports.tscPlugin = tscPlugin;
|
|
112
|
-
//# sourceMappingURL=chunk-263L44RM.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-263L44RM.cjs","../src/plugins/tsc.ts"],"names":["bundleTypeDefinitions","filename","outfile","externals","dependencies","peerDependencies","devDependencies","require","p","flatMap","devDependenciesKeys","dependenciesKeys","peerDependenciesKeys","dep","bundledPackages","undefined","initialOptions","loadStormConfig","endsWith","dtsPath","entryPoint","dtsContents","process","name","npmPackage","getTypeDependencyPackageName"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACYA,qCAAoB;AACpB,wDAA2C;AAC3C,2DAAiD;AAEjD,wEAAiB;AASjB,SAASA,qBAAAA,CACPC,QAAAA,EACAC,OAAAA,EACAC,SAAAA,EAAmB;AAGnB,EAAA,MAAM,EAAEC,YAAAA,EAAcC,gBAAAA,EAAkBC,gBAAe,EAAA,EAAKC,yCAAAA,CAC1D,EAAA;AAI+DC,EAAAA;AAC/DA,IAAAA;AAC6BA,IAAAA;AAC9B,EAAA;AACgEC,EAAAA;AACzDD,IAAAA;AAAgCA,IAAAA;AAAG,EAAA;AAE4BA,EAAAA;AACrEA,IAAAA;AAC6BA,IAAAA;AAC9B,EAAA;AAEmBE,EAAAA;AACQ,EAAA;AACvBC,IAAAA;AACAC,IAAAA;AACAT,IAAAA;AACJ,EAAA;AACkEU,EAAAA;AAGnB,EAAA;AAChC,IAAA;AACc,MAAA;AACFZ,MAAAA;AACxBa,MAAAA;AACU,MAAA;AACmC,QAAA;AACzB,QAAA;AACC,UAAA;AACP,YAAA;AD9BqD;AC+B/D,UAAA;AACF,QAAA;AACF,MAAA;AACW,MAAA;AACA,QAAA;AACoD,QAAA;AAC/D,MAAA;AACe,MAAA;AACJ,QAAA;AACX,MAAA;AACF,IAAA;AAC8C,IAAA;AACxBC,IAAAA;AACxB,EAAA;AAG0D,EAAA;AACnC,IAAA;AACT,IAAA;AACd,EAAA;AAGyC,EAAA;AAEqB,IAAA;AAG5C,IAAA;AAClB,EAAA;AACF;AAvESf;AA8EH;AACE,EAAA;AACK,EAAA;AACagB,IAAAA;AAEG,IAAA;AAEX,IAAA;AACSC,MAAAA;AAG2C,MAAA;AAOjB,QAAA;AAG/C,MAAA;AAM2BC,MAAAA;AAGsC,QAAA;AACP,QAAA;AACK,QAAA;AACP,QAAA;AAElDC,QAAAA;AAEiDC,QAAAA;AAEPA,UAAAA;AAGRA,QAAAA;AAG2B,UAAA;AACjE,QAAA;AAEiD,QAAA;AACe,QAAA;AAEC,UAAA;AAER,UAAA;AACfC,UAAAA;AACnC,QAAA;AAMeC,UAAAA;AAEtB,QAAA;AACF,MAAA;AACF,IAAA;AACF,EAAA;AApEgE;AA8EV;AACtB,EAAA;AACS,IAAA;AAEFC,IAAAA;AACvC,EAAA;AACiBC,EAAAA;AACnB;AAPSC;AD7EgE;AACA;AACA;AACA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-263L44RM.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport { hfs } from \"@humanfs/node\";\nimport { Extractor, ExtractorConfig } from \"@microsoft/api-extractor\";\nimport { loadStormConfig, run, writeError } from \"@storm-software/config-tools\";\nimport type * as esbuild from \"esbuild\";\nimport path from \"node:path\";\n\n/**\n * Bundle all type definitions by using the API Extractor from RushStack\n *\n * @param filename - the source d.ts to bundle\n * @param outfile - the output bundled file\n * @param externals - the list of external dependencies\n */\nfunction bundleTypeDefinitions(\n filename: string,\n outfile: string,\n externals: string[]\n) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { dependencies, peerDependencies, devDependencies } = require(\n `${process.cwd()}/package.json`\n );\n\n // get the list of bundled and non bundled as well as their eventual type dependencies\n const dependenciesKeys = Object.keys(dependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n const peerDependenciesKeys = Object.keys(peerDependencies ?? {}).flatMap(\n p => [p, getTypeDependencyPackageName(p)]\n );\n const devDependenciesKeys = Object.keys(devDependencies ?? {}).flatMap(p => [\n p,\n getTypeDependencyPackageName(p)\n ]);\n\n const includeDeps = devDependenciesKeys;\n const excludeDeps = new Set([\n ...dependenciesKeys,\n ...peerDependenciesKeys,\n ...externals\n ]);\n const bundledPackages = includeDeps.filter(dep => !excludeDeps.has(dep));\n\n // we give the config in its raw form instead of a file\n const extractorConfig = ExtractorConfig.prepare({\n configObject: {\n projectFolder: process.cwd(),\n mainEntryPointFilePath: filename,\n bundledPackages,\n compiler: {\n tsconfigFilePath: path.join(process.cwd(), \"tsconfig.build.json\"),\n overrideTsconfig: {\n compilerOptions: {\n paths: {} // bug with api extract + paths\n }\n }\n },\n dtsRollup: {\n enabled: true,\n untrimmedFilePath: path.join(process.cwd(), `${outfile}.d.ts`)\n },\n tsdocMetadata: {\n enabled: false\n }\n },\n packageJsonFullPath: path.join(process.cwd(), \"package.json\"),\n configObjectFullPath: undefined\n });\n\n // here we trigger the \"command line\" interface equivalent\n const extractorResult = Extractor.invoke(extractorConfig, {\n showVerboseMessages: true,\n localBuild: true\n });\n\n // we exit the process immediately if there were errors\n if (extractorResult.succeeded === false) {\n writeError(\n `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? \"error\" : \"errors\"}`\n );\n\n throw new Error(\"API Extractor completed with errors\");\n }\n}\n\n/**\n * Triggers the TypeScript compiler and the type bundler.\n */\nexport const tscPlugin: (emitTypes?: boolean) => esbuild.Plugin = (\n emitTypes?: boolean\n) => ({\n name: \"tscPlugin\",\n setup(build) {\n const options = build.initialOptions;\n\n if (emitTypes === false) return; // build has opted out of emitting types\n\n build.onStart(async () => {\n const config = await loadStormConfig();\n\n // we only call tsc if not in watch mode or in dev mode (they skip types)\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // --paths null basically prevents typescript from using paths from the\n // tsconfig.json that is passed from the esbuild config. We need to do\n // this because TS would include types from the paths into this build.\n // but our paths, in our specific case only represent separate packages.\n await run(\n config,\n `pnpm exec tsc --project ${options.tsconfig} --paths null`,\n config.workspaceRoot\n );\n }\n\n // we bundle types if we also bundle the entry point and it is a ts file\n if (\n options.bundle &&\n options.outfile &&\n options.entryPoints?.[0].endsWith(\".ts\")\n ) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsconfig = require(`${process.cwd()}/${options.tsconfig}`); // tsconfig\n const typeOutDir = tsconfig?.compilerOptions?.outDir ?? \".\"; // type out dir\n const entryPoint = options.entryPoints?.[0].replace(/\\.ts$/, \"\");\n const bundlePath = options.outfile.replace(/\\.m?js$/, \"\");\n\n let dtsPath;\n if (\n await hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;\n } else if (\n await hfs.isFile(\n `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`\n )\n ) {\n dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\\//, \"\")}.d.ts`;\n }\n\n const ext = options.format === \"esm\" ? \"d.mts\" : \"d.ts\";\n if (process.env.WATCH !== \"true\" && process.env.DEV !== \"true\") {\n // we get the types generated by tsc and bundle them near the output\n bundleTypeDefinitions(dtsPath, bundlePath, options.external ?? []);\n\n const dtsContents = await hfs.text(`${bundlePath}.d.ts`);\n await hfs.write(`${bundlePath}.${ext}`, dtsContents!);\n } else {\n // in watch mode, it wouldn't be viable to bundle the types every time\n // we haven't built any types with tsc at this stage, but we want types\n // we link the types locally by re-exporting them from the entry point\n await hfs.write(\n `${bundlePath}.${ext}`,\n `export * from '${process.cwd()}/${entryPoint}'`\n );\n }\n }\n });\n }\n});\n\n/**\n * Automatically get the type dependency package name, following the\n * DefinitelyTyped naming conventions.\n *\n * @param npmPackage - the npm package name\n * @returns the type dependency package name\n */\nfunction getTypeDependencyPackageName(npmPackage: string) {\n if (npmPackage.startsWith(\"@\")) {\n const [scope, name] = npmPackage.split(\"/\");\n\n return `@types/${scope?.slice(1)}__${name}`;\n }\n return `@types/${npmPackage}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugins/esm-split-code-to-cjs.ts"],"sourcesContent":["/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport * as esbuild from \"esbuild\";\n\n/**\n * Code splitting only works in ESM at the moment, this plugin will convert the\n * ESM code to CJS automatically after the build. Only works with `outdir` set.\n */\nexport const esmSplitCodeToCjsPlugin: esbuild.Plugin = {\n name: \"storm:esm-split-code-to-cjs\",\n setup(build) {\n build.onEnd(async result => {\n const outFiles = Object.keys(result.metafile?.outputs ?? {});\n const jsFiles = outFiles.filter(f => f.endsWith(\"js\"));\n\n await esbuild.build({\n outdir: build.initialOptions.outdir,\n entryPoints: jsFiles,\n allowOverwrite: true,\n format: \"cjs\",\n logLevel: \"error\",\n packages: \"external\"\n });\n });\n }\n};\n"],"mappings":";AAiBA,YAAYA,aAAa;AAMlB,IAAMC,0BAA0C;EACrDC,MAAM;EACNC,MAAMC,QAAK;AACTA,IAAAA,OAAMC,MAAM,OAAMC,WAAAA;AAChB,YAAMC,WAAWC,OAAOC,KAAKH,OAAOI,UAAUC,WAAW,CAAC,CAAA;AAC1D,YAAMC,UAAUL,SAASM,OAAOC,CAAAA,MAAKA,EAAEC,SAAS,IAAA,CAAA;AAEhD,YAAcX,cAAM;QAClBY,QAAQZ,OAAMa,eAAeD;QAC7BE,aAAaN;QACbO,gBAAgB;QAChBC,QAAQ;QACRC,UAAU;QACVC,UAAU;MACZ,CAAA;IACF,CAAA;EACF;AACF;","names":["esbuild","esmSplitCodeToCjsPlugin","name","setup","build","onEnd","result","outFiles","Object","keys","metafile","outputs","jsFiles","filter","f","endsWith","outdir","initialOptions","entryPoints","allowOverwrite","format","logLevel","packages"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-BF5W6GVP.cjs","../src/plugins/resolve-paths.ts"],"names":["resolvePathsConfig","options","cwd","compilerOptions","paths","Object","entries","resolvedPaths","map","key","v","path","resolve","fromEntries","extends","extendsPath","extendsDir","dirname","extendsConfig","require","resolvePathsPlugin","name","setup","build","parentTsConfig","packagesRegex","args","external"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACaA,wEAAiB;AAgBjB,SAASA,kBAAAA,CAAmBC,OAAAA,EAAmBC,GAAAA,EAAW;AACxD,EAAA,GAAA,iBAAID,OAAAA,2BAASE,eAAAA,6BAAiBC,OAAAA,EAAO;AACnC,IAAA,MAAMA,MAAAA,EAAQC,MAAAA,CAAOC,OAAAA,CAAQL,OAAAA,CAAQE,eAAAA,CAAgBC,KAAK,CAAA;AAE1D,IAAA,MAAMG,cAAAA,EAAgBH,KAAAA,CAAMI,GAAAA,CAAI,CAAC,CAACC,GAAAA,EAAKL,MAAAA,CAAAA,EAAAA,GAAM;AAC3C,MAAA,OAAO;AD3Bb,QC2BcK,GAAAA;AD1Bd,QC0BmBL,MAAAA,CAAMI,GAAAA,CAAIE,CAAAA,CAAAA,EAAAA,GAAKC,cAAAA,CAAKC,OAAAA,CAAQV,GAAAA,EAAKQ,CAAAA,CAAAA;ADzBpD,MAAM,CAAC;AACP,ICyBI,CAAA,CAAA;AAEA,IAAA,OAAOL,MAAAA,CAAOQ,WAAAA,CAAYN,aAAAA,CAAAA;ADzB9B,EC0BE;AAEA,EAAA,GAAA,CAAIN,OAAAA,CAAQa,OAAAA,EAAS;AACnB,IAAA,MAAMC,YAAAA,EAAcJ,cAAAA,CAAKC,OAAAA,CAAQV,GAAAA,EAAKD,OAAAA,CAAQa,OAAO,CAAA;AACrD,IAAA,MAAME,WAAAA,EAAaL,cAAAA,CAAKM,OAAAA,CAAQF,WAAAA,CAAAA;AAEhC,IAAA,MAAMG,cAAAA,EAAgBC,yCAAAA,WAAQJ,CAAAA;AAE9B,IAAA,OAAOf,kBAAAA,CAAmBkB,aAAAA,EAAeF,UAAAA,CAAAA;AD5B7C,EC6BE;AAEA,EAAA,OAAO,CAAA,CAAA;AACT;AArBShB,sCAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA;AA6BF,IAAMoB,mBAAAA,EAAqC;ADnClD,ECoCEC,IAAAA,EAAM,qBAAA;ADnCR,ECoCEC,KAAAA,CAAMC,KAAAA,EAAK;AAET,IAAA,MAAMC,eAAAA,EAAiBL,yCAAAA,CACrB,EAAA;AAEsBnB,IAAAA;AAEtB,IAAA;AAGc,IAAA;AAAUyB,MAAAA;AAAiBC,IAAAA;AAChBC,MAAAA;AAChB,QAAA;AAAahB,UAAAA;AAAgB,UAAA;AAAK,QAAA;AAC3C,MAAA;AAEO,MAAA;AAAgCA,QAAAA;AAAoB,MAAA;AAC7D,IAAA;AACF,EAAA;AACF;ADnCsC;AACA;AACA;AACA","file":"/home/runner/work/storm-ops/storm-ops/packages/esbuild/dist/chunk-BF5W6GVP.cjs","sourcesContent":[null,"/*-------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-ops\n Documentation: https://stormsoftware.com/projects/storm-ops/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/storm-ops/license\n\n -------------------------------------------------------------------*/\n\nimport type * as esbuild from \"esbuild\";\nimport path from \"node:path\";\n\ntype TsConfig = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n };\n extends?: string;\n};\n\n/**\n * Recursive function to resolve the paths config from a tsconfig.json, whether\n * it is in the config directly or via an inherited config (via \"extends\").\n * @param options\n * @param cwd\n * @returns\n */\nfunction resolvePathsConfig(options: TsConfig, cwd: string) {\n if (options?.compilerOptions?.paths) {\n const paths = Object.entries(options.compilerOptions.paths);\n\n const resolvedPaths = paths.map(([key, paths]) => {\n return [key, paths.map(v => path.resolve(cwd, v))] as const;\n });\n\n return Object.fromEntries(resolvedPaths);\n }\n\n if (options.extends) {\n const extendsPath = path.resolve(cwd, options.extends);\n const extendsDir = path.dirname(extendsPath);\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const extendsConfig = require(extendsPath);\n\n return resolvePathsConfig(extendsConfig, extendsDir);\n }\n\n return [];\n}\n\n/**\n * Forces `esbuild` to always use the TS compiler paths, even when we are\n * bundling a local dependency of a local dependency, ensuring maximum\n * tree-shaking. Note: `esbuild` has some support for this, though it is limited\n * in the amount of dependency nesting it supports.\n */\nexport const resolvePathsPlugin: esbuild.Plugin = {\n name: \"storm:resolve-paths\",\n setup(build) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parentTsConfig = require(\n `${process.cwd()}/${build.initialOptions.tsconfig}`\n );\n const resolvedTsPaths = resolvePathsConfig(parentTsConfig, process.cwd());\n const packagesRegex = new RegExp(\n `^(${Object.keys(resolvedTsPaths).join(\"|\")})$`\n );\n\n build.onResolve({ filter: packagesRegex }, args => {\n if (build.initialOptions.external?.includes(args.path)) {\n return { path: args.path, external: true };\n }\n\n return { path: `${resolvedTsPaths[args.path][0]}/index.ts` };\n });\n }\n};\n"]}
|