@powerlines/deepkit 0.7.7 → 0.7.8
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/dist/{packages/deepkit/schemas/reflection.mjs → capnp-BYEUkMpr.mjs} +1167 -259
- package/dist/{packages/deepkit/schemas/reflection.cjs → capnp-C8UENZHc.cjs} +1181 -4
- package/dist/capnp.cjs +46 -955
- package/dist/capnp.d.cts +1 -1
- package/dist/capnp.d.mts +1 -1
- package/dist/capnp.mjs +2 -911
- package/dist/{_virtual/_rolldown/runtime.cjs → chunk-BmvPcxpV.cjs} +12 -2
- package/dist/config-B6lMYoYG.d.mts +32 -0
- package/dist/config-C8svu6th.d.cts +32 -0
- package/dist/esbuild-plugin.cjs +1 -1
- package/dist/esbuild-plugin.d.cts +1 -1
- package/dist/esbuild-plugin.d.mts +1 -1
- package/dist/index.cjs +3 -2
- package/dist/index.mjs +3 -2
- package/dist/reflect-type.cjs +2 -2
- package/dist/{packages/deepkit/schemas/reflection.d.mts → reflection-DGOuMF8F.d.cts} +2 -2
- package/dist/{packages/deepkit/schemas/reflection.d.cts → reflection-DaLz4ZT5.d.mts} +2 -2
- package/dist/resolve-reflections.cjs +1 -1
- package/dist/rolldown-plugin.cjs +1 -1
- package/dist/transformer-BiefehPu.mjs +1360 -0
- package/dist/transformer-DS0zKU7l.cjs +1367 -0
- package/dist/transformer.cjs +3 -52
- package/dist/transformer.d.cts +1 -1
- package/dist/transformer.d.mts +1 -1
- package/dist/transformer.mjs +2 -50
- package/dist/transpile.cjs +3 -3
- package/dist/transpile.d.cts +1 -1
- package/dist/transpile.d.mts +1 -1
- package/dist/transpile.mjs +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/utilities.cjs +1 -1
- package/package.json +2 -2
- package/dist/_virtual/_rolldown/runtime.mjs +0 -8
|
@@ -0,0 +1,1360 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { DeclarationTransformer, ReflectionTransformer } from "@powerlines/deepkit/vendor/type-compiler";
|
|
4
|
+
import defu from "defu";
|
|
5
|
+
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../node_modules/.pnpm/@deepkit+type-spec@1.0.1_patch_hash=f3c3a4fd486751022d78f17d39a5a79f493bca20b185964ca1aba41fbfc93244/node_modules/@deepkit/type-spec/dist/esm/src/type.js
|
|
12
|
+
/**
|
|
13
|
+
* note: Checks are based on range checks (>, <, etc), so when adding
|
|
14
|
+
* new types a check is required for all code using `TypeNumberBrand`.
|
|
15
|
+
*/
|
|
16
|
+
var TypeNumberBrand;
|
|
17
|
+
(function(TypeNumberBrand) {
|
|
18
|
+
TypeNumberBrand[TypeNumberBrand["integer"] = 0] = "integer";
|
|
19
|
+
TypeNumberBrand[TypeNumberBrand["int8"] = 1] = "int8";
|
|
20
|
+
TypeNumberBrand[TypeNumberBrand["int16"] = 2] = "int16";
|
|
21
|
+
TypeNumberBrand[TypeNumberBrand["int32"] = 3] = "int32";
|
|
22
|
+
TypeNumberBrand[TypeNumberBrand["uint8"] = 4] = "uint8";
|
|
23
|
+
TypeNumberBrand[TypeNumberBrand["uint16"] = 5] = "uint16";
|
|
24
|
+
TypeNumberBrand[TypeNumberBrand["uint32"] = 6] = "uint32";
|
|
25
|
+
TypeNumberBrand[TypeNumberBrand["float"] = 7] = "float";
|
|
26
|
+
TypeNumberBrand[TypeNumberBrand["float32"] = 8] = "float32";
|
|
27
|
+
TypeNumberBrand[TypeNumberBrand["float64"] = 9] = "float64";
|
|
28
|
+
})(TypeNumberBrand || (TypeNumberBrand = {}));
|
|
29
|
+
/**
|
|
30
|
+
* The instruction set.
|
|
31
|
+
* Should not be greater than 93 members, because we encode it via charCode starting at 33. +93 means we end up with charCode=126
|
|
32
|
+
* (which is '~' and the last char that can be represented without \x. The next 127 is '\x7F').
|
|
33
|
+
*/
|
|
34
|
+
var ReflectionOp;
|
|
35
|
+
(function(ReflectionOp) {
|
|
36
|
+
ReflectionOp[ReflectionOp["never"] = 0] = "never";
|
|
37
|
+
ReflectionOp[ReflectionOp["any"] = 1] = "any";
|
|
38
|
+
ReflectionOp[ReflectionOp["unknown"] = 2] = "unknown";
|
|
39
|
+
ReflectionOp[ReflectionOp["void"] = 3] = "void";
|
|
40
|
+
ReflectionOp[ReflectionOp["object"] = 4] = "object";
|
|
41
|
+
ReflectionOp[ReflectionOp["string"] = 5] = "string";
|
|
42
|
+
ReflectionOp[ReflectionOp["number"] = 6] = "number";
|
|
43
|
+
ReflectionOp[ReflectionOp["numberBrand"] = 7] = "numberBrand";
|
|
44
|
+
ReflectionOp[ReflectionOp["boolean"] = 8] = "boolean";
|
|
45
|
+
ReflectionOp[ReflectionOp["bigint"] = 9] = "bigint";
|
|
46
|
+
ReflectionOp[ReflectionOp["symbol"] = 10] = "symbol";
|
|
47
|
+
ReflectionOp[ReflectionOp["null"] = 11] = "null";
|
|
48
|
+
ReflectionOp[ReflectionOp["undefined"] = 12] = "undefined";
|
|
49
|
+
/**
|
|
50
|
+
* The literal type of string, number, or boolean.
|
|
51
|
+
*
|
|
52
|
+
* This OP has 1 parameter. The next byte is the absolute address of the literal on the stack, which is the actual literal value.
|
|
53
|
+
*
|
|
54
|
+
* Pushes a function type.
|
|
55
|
+
*/
|
|
56
|
+
ReflectionOp[ReflectionOp["literal"] = 13] = "literal";
|
|
57
|
+
/**
|
|
58
|
+
* This OP pops all types on the current stack frame.
|
|
59
|
+
*
|
|
60
|
+
* This OP has 1 parameter. The next byte is the absolute address of a string|number|symbol entry on the stack.
|
|
61
|
+
*
|
|
62
|
+
* Pushes a function type.
|
|
63
|
+
*/
|
|
64
|
+
ReflectionOp[ReflectionOp["function"] = 14] = "function";
|
|
65
|
+
/**
|
|
66
|
+
* This OP pops all types on the current stack frame.
|
|
67
|
+
*
|
|
68
|
+
* Pushes a method type.
|
|
69
|
+
*/
|
|
70
|
+
ReflectionOp[ReflectionOp["method"] = 15] = "method";
|
|
71
|
+
ReflectionOp[ReflectionOp["methodSignature"] = 16] = "methodSignature";
|
|
72
|
+
ReflectionOp[ReflectionOp["parameter"] = 17] = "parameter";
|
|
73
|
+
/**
|
|
74
|
+
* This OP pops the latest type entry on the stack.
|
|
75
|
+
*
|
|
76
|
+
* Pushes a property type.
|
|
77
|
+
*/
|
|
78
|
+
ReflectionOp[ReflectionOp["property"] = 18] = "property";
|
|
79
|
+
ReflectionOp[ReflectionOp["propertySignature"] = 19] = "propertySignature";
|
|
80
|
+
/**
|
|
81
|
+
* This OP pops all types on the current stack frame. Those types should be method|property.
|
|
82
|
+
*
|
|
83
|
+
* Pushes a TypeClass onto the stack.
|
|
84
|
+
*/
|
|
85
|
+
ReflectionOp[ReflectionOp["class"] = 20] = "class";
|
|
86
|
+
/**
|
|
87
|
+
* If a class extends another class with generics, this OP represents the generic type arguments of the super class.
|
|
88
|
+
*
|
|
89
|
+
* e.g. `class A extends B<string, boolean>`, string and boolean are on the stack and classExtends pops() them, and then assigns to A.extendsTypeArguments = [string, boolean].
|
|
90
|
+
*
|
|
91
|
+
* This is only emitted when the class that is currently being described actually extends another class and uses generics.
|
|
92
|
+
*
|
|
93
|
+
* This OP has 1 argument and pops x types from the stack. X is the first argument.
|
|
94
|
+
* Expects a TypeClass on the stack.
|
|
95
|
+
*/
|
|
96
|
+
ReflectionOp[ReflectionOp["classExtends"] = 21] = "classExtends";
|
|
97
|
+
/**
|
|
98
|
+
* This OP has 1 parameter, the stack entry to the actual class symbol.
|
|
99
|
+
*/
|
|
100
|
+
ReflectionOp[ReflectionOp["classReference"] = 22] = "classReference";
|
|
101
|
+
/**
|
|
102
|
+
* Marks the last entry in the stack as optional. Used for method|property. Equal to the QuestionMark operator in a property assignment.
|
|
103
|
+
*/
|
|
104
|
+
ReflectionOp[ReflectionOp["optional"] = 23] = "optional";
|
|
105
|
+
ReflectionOp[ReflectionOp["readonly"] = 24] = "readonly";
|
|
106
|
+
ReflectionOp[ReflectionOp["public"] = 25] = "public";
|
|
107
|
+
ReflectionOp[ReflectionOp["private"] = 26] = "private";
|
|
108
|
+
ReflectionOp[ReflectionOp["protected"] = 27] = "protected";
|
|
109
|
+
ReflectionOp[ReflectionOp["abstract"] = 28] = "abstract";
|
|
110
|
+
ReflectionOp[ReflectionOp["defaultValue"] = 29] = "defaultValue";
|
|
111
|
+
ReflectionOp[ReflectionOp["description"] = 30] = "description";
|
|
112
|
+
ReflectionOp[ReflectionOp["rest"] = 31] = "rest";
|
|
113
|
+
ReflectionOp[ReflectionOp["regexp"] = 32] = "regexp";
|
|
114
|
+
ReflectionOp[ReflectionOp["enum"] = 33] = "enum";
|
|
115
|
+
ReflectionOp[ReflectionOp["enumMember"] = 34] = "enumMember";
|
|
116
|
+
ReflectionOp[ReflectionOp["set"] = 35] = "set";
|
|
117
|
+
ReflectionOp[ReflectionOp["map"] = 36] = "map";
|
|
118
|
+
/**
|
|
119
|
+
* Pops the latest stack entry and uses it as T for an array type.
|
|
120
|
+
*
|
|
121
|
+
* Pushes an array type.
|
|
122
|
+
*/
|
|
123
|
+
ReflectionOp[ReflectionOp["array"] = 37] = "array";
|
|
124
|
+
ReflectionOp[ReflectionOp["tuple"] = 38] = "tuple";
|
|
125
|
+
ReflectionOp[ReflectionOp["tupleMember"] = 39] = "tupleMember";
|
|
126
|
+
ReflectionOp[ReflectionOp["namedTupleMember"] = 40] = "namedTupleMember";
|
|
127
|
+
ReflectionOp[ReflectionOp["union"] = 41] = "union";
|
|
128
|
+
ReflectionOp[ReflectionOp["intersection"] = 42] = "intersection";
|
|
129
|
+
ReflectionOp[ReflectionOp["indexSignature"] = 43] = "indexSignature";
|
|
130
|
+
ReflectionOp[ReflectionOp["objectLiteral"] = 44] = "objectLiteral";
|
|
131
|
+
ReflectionOp[ReflectionOp["mappedType"] = 45] = "mappedType";
|
|
132
|
+
ReflectionOp[ReflectionOp["in"] = 46] = "in";
|
|
133
|
+
ReflectionOp[ReflectionOp["frame"] = 47] = "frame";
|
|
134
|
+
ReflectionOp[ReflectionOp["moveFrame"] = 48] = "moveFrame";
|
|
135
|
+
ReflectionOp[ReflectionOp["return"] = 49] = "return";
|
|
136
|
+
ReflectionOp[ReflectionOp["templateLiteral"] = 50] = "templateLiteral";
|
|
137
|
+
ReflectionOp[ReflectionOp["date"] = 51] = "date";
|
|
138
|
+
ReflectionOp[ReflectionOp["int8Array"] = 52] = "int8Array";
|
|
139
|
+
ReflectionOp[ReflectionOp["uint8ClampedArray"] = 53] = "uint8ClampedArray";
|
|
140
|
+
ReflectionOp[ReflectionOp["uint8Array"] = 54] = "uint8Array";
|
|
141
|
+
ReflectionOp[ReflectionOp["int16Array"] = 55] = "int16Array";
|
|
142
|
+
ReflectionOp[ReflectionOp["uint16Array"] = 56] = "uint16Array";
|
|
143
|
+
ReflectionOp[ReflectionOp["int32Array"] = 57] = "int32Array";
|
|
144
|
+
ReflectionOp[ReflectionOp["uint32Array"] = 58] = "uint32Array";
|
|
145
|
+
ReflectionOp[ReflectionOp["float32Array"] = 59] = "float32Array";
|
|
146
|
+
ReflectionOp[ReflectionOp["float64Array"] = 60] = "float64Array";
|
|
147
|
+
ReflectionOp[ReflectionOp["bigInt64Array"] = 61] = "bigInt64Array";
|
|
148
|
+
ReflectionOp[ReflectionOp["arrayBuffer"] = 62] = "arrayBuffer";
|
|
149
|
+
ReflectionOp[ReflectionOp["promise"] = 63] = "promise";
|
|
150
|
+
ReflectionOp[ReflectionOp["arg"] = 64] = "arg";
|
|
151
|
+
ReflectionOp[ReflectionOp["typeParameter"] = 65] = "typeParameter";
|
|
152
|
+
ReflectionOp[ReflectionOp["typeParameterDefault"] = 66] = "typeParameterDefault";
|
|
153
|
+
ReflectionOp[ReflectionOp["var"] = 67] = "var";
|
|
154
|
+
ReflectionOp[ReflectionOp["loads"] = 68] = "loads";
|
|
155
|
+
ReflectionOp[ReflectionOp["indexAccess"] = 69] = "indexAccess";
|
|
156
|
+
ReflectionOp[ReflectionOp["keyof"] = 70] = "keyof";
|
|
157
|
+
ReflectionOp[ReflectionOp["infer"] = 71] = "infer";
|
|
158
|
+
ReflectionOp[ReflectionOp["typeof"] = 72] = "typeof";
|
|
159
|
+
ReflectionOp[ReflectionOp["condition"] = 73] = "condition";
|
|
160
|
+
ReflectionOp[ReflectionOp["jumpCondition"] = 74] = "jumpCondition";
|
|
161
|
+
ReflectionOp[ReflectionOp["jump"] = 75] = "jump";
|
|
162
|
+
ReflectionOp[ReflectionOp["call"] = 76] = "call";
|
|
163
|
+
ReflectionOp[ReflectionOp["inline"] = 77] = "inline";
|
|
164
|
+
ReflectionOp[ReflectionOp["inlineCall"] = 78] = "inlineCall";
|
|
165
|
+
ReflectionOp[ReflectionOp["distribute"] = 79] = "distribute";
|
|
166
|
+
ReflectionOp[ReflectionOp["extends"] = 80] = "extends";
|
|
167
|
+
ReflectionOp[ReflectionOp["widen"] = 81] = "widen";
|
|
168
|
+
ReflectionOp[ReflectionOp["static"] = 82] = "static";
|
|
169
|
+
ReflectionOp[ReflectionOp["mappedType2"] = 83] = "mappedType2";
|
|
170
|
+
ReflectionOp[ReflectionOp["functionReference"] = 84] = "functionReference";
|
|
171
|
+
ReflectionOp[ReflectionOp["callSignature"] = 85] = "callSignature";
|
|
172
|
+
/**
|
|
173
|
+
* Assign for Enum, Interface, Class, and TypeAlias declaration at the very end
|
|
174
|
+
* of the program the typeName. This is so that we have type names available even
|
|
175
|
+
* if the JS code is minified.
|
|
176
|
+
*
|
|
177
|
+
* his operator also assigns originTypes to the type, as it acts as the finalization
|
|
178
|
+
* step of a type.
|
|
179
|
+
*/
|
|
180
|
+
ReflectionOp[ReflectionOp["typeName"] = 86] = "typeName";
|
|
181
|
+
/**
|
|
182
|
+
* If a class implement an interface or type,
|
|
183
|
+
*
|
|
184
|
+
* e.g. `class A implements B`, then B is on the stack and implements pops() it, and then assigns to A.implements = [B].
|
|
185
|
+
*
|
|
186
|
+
* This is only emitted when the class that is currently being described actually implements something.
|
|
187
|
+
*
|
|
188
|
+
* This OP has 1 argument and pops x types from the stack. X is the first argument.
|
|
189
|
+
* Expects a TypeClass on the stack.
|
|
190
|
+
*/
|
|
191
|
+
ReflectionOp[ReflectionOp["implements"] = 87] = "implements";
|
|
192
|
+
ReflectionOp[ReflectionOp["nominal"] = 88] = "nominal";
|
|
193
|
+
/**
|
|
194
|
+
* Custom Storm Software operators
|
|
195
|
+
*/
|
|
196
|
+
ReflectionOp[ReflectionOp["tags"] = 89] = "tags";
|
|
197
|
+
})(ReflectionOp || (ReflectionOp = {}));
|
|
198
|
+
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region ../../node_modules/.pnpm/@typescript+vfs@1.6.4_typescript@5.9.3/node_modules/@typescript/vfs/dist/vfs.cjs.production.min.js
|
|
201
|
+
var require_vfs_cjs_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
202
|
+
function e() {
|
|
203
|
+
return e = Object.assign ? Object.assign.bind() : function(e) {
|
|
204
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
205
|
+
var r = arguments[t];
|
|
206
|
+
for (var i in r) ({}).hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
207
|
+
}
|
|
208
|
+
return e;
|
|
209
|
+
}, e.apply(null, arguments);
|
|
210
|
+
}
|
|
211
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
212
|
+
var t = !1;
|
|
213
|
+
try {
|
|
214
|
+
t = "undefined" != typeof localStorage;
|
|
215
|
+
} catch (e) {}
|
|
216
|
+
var r = "undefined" != typeof process, i = t && "function" == typeof localStorage.getItem && localStorage.getItem("DEBUG") || r && process.env.DEBUG ? console.log : function(e) {
|
|
217
|
+
return "";
|
|
218
|
+
}, s = function(e, t) {
|
|
219
|
+
var r, i = e.lib || [], s = [
|
|
220
|
+
"lib.d.ts",
|
|
221
|
+
"lib.core.d.ts",
|
|
222
|
+
"lib.decorators.d.ts",
|
|
223
|
+
"lib.decorators.legacy.d.ts",
|
|
224
|
+
"lib.dom.asynciterable.d.ts",
|
|
225
|
+
"lib.dom.d.ts",
|
|
226
|
+
"lib.dom.iterable.d.ts",
|
|
227
|
+
"lib.webworker.asynciterable.d.ts",
|
|
228
|
+
"lib.webworker.d.ts",
|
|
229
|
+
"lib.webworker.importscripts.d.ts",
|
|
230
|
+
"lib.webworker.iterable.d.ts",
|
|
231
|
+
"lib.scripthost.d.ts",
|
|
232
|
+
"lib.es5.d.ts",
|
|
233
|
+
"lib.es6.d.ts",
|
|
234
|
+
"lib.es7.d.ts",
|
|
235
|
+
"lib.core.es6.d.ts",
|
|
236
|
+
"lib.core.es7.d.ts",
|
|
237
|
+
"lib.es2015.collection.d.ts",
|
|
238
|
+
"lib.es2015.core.d.ts",
|
|
239
|
+
"lib.es2015.d.ts",
|
|
240
|
+
"lib.es2015.generator.d.ts",
|
|
241
|
+
"lib.es2015.iterable.d.ts",
|
|
242
|
+
"lib.es2015.promise.d.ts",
|
|
243
|
+
"lib.es2015.proxy.d.ts",
|
|
244
|
+
"lib.es2015.reflect.d.ts",
|
|
245
|
+
"lib.es2015.symbol.d.ts",
|
|
246
|
+
"lib.es2015.symbol.wellknown.d.ts",
|
|
247
|
+
"lib.es2016.array.include.d.ts",
|
|
248
|
+
"lib.es2016.d.ts",
|
|
249
|
+
"lib.es2016.full.d.ts",
|
|
250
|
+
"lib.es2016.intl.d.ts",
|
|
251
|
+
"lib.es2017.arraybuffer.d.ts",
|
|
252
|
+
"lib.es2017.d.ts",
|
|
253
|
+
"lib.es2017.date.d.ts",
|
|
254
|
+
"lib.es2017.full.d.ts",
|
|
255
|
+
"lib.es2017.intl.d.ts",
|
|
256
|
+
"lib.es2017.object.d.ts",
|
|
257
|
+
"lib.es2017.sharedmemory.d.ts",
|
|
258
|
+
"lib.es2017.string.d.ts",
|
|
259
|
+
"lib.es2017.typedarrays.d.ts",
|
|
260
|
+
"lib.es2018.asyncgenerator.d.ts",
|
|
261
|
+
"lib.es2018.asynciterable.d.ts",
|
|
262
|
+
"lib.es2018.d.ts",
|
|
263
|
+
"lib.es2018.full.d.ts",
|
|
264
|
+
"lib.es2018.intl.d.ts",
|
|
265
|
+
"lib.es2018.promise.d.ts",
|
|
266
|
+
"lib.es2018.regexp.d.ts",
|
|
267
|
+
"lib.es2019.array.d.ts",
|
|
268
|
+
"lib.es2019.d.ts",
|
|
269
|
+
"lib.es2019.full.d.ts",
|
|
270
|
+
"lib.es2019.intl.d.ts",
|
|
271
|
+
"lib.es2019.object.d.ts",
|
|
272
|
+
"lib.es2019.string.d.ts",
|
|
273
|
+
"lib.es2019.symbol.d.ts",
|
|
274
|
+
"lib.es2020.bigint.d.ts",
|
|
275
|
+
"lib.es2020.d.ts",
|
|
276
|
+
"lib.es2020.date.d.ts",
|
|
277
|
+
"lib.es2020.full.d.ts",
|
|
278
|
+
"lib.es2020.intl.d.ts",
|
|
279
|
+
"lib.es2020.number.d.ts",
|
|
280
|
+
"lib.es2020.promise.d.ts",
|
|
281
|
+
"lib.es2020.sharedmemory.d.ts",
|
|
282
|
+
"lib.es2020.string.d.ts",
|
|
283
|
+
"lib.es2020.symbol.wellknown.d.ts",
|
|
284
|
+
"lib.es2021.d.ts",
|
|
285
|
+
"lib.es2021.full.d.ts",
|
|
286
|
+
"lib.es2021.intl.d.ts",
|
|
287
|
+
"lib.es2021.promise.d.ts",
|
|
288
|
+
"lib.es2021.string.d.ts",
|
|
289
|
+
"lib.es2021.weakref.d.ts",
|
|
290
|
+
"lib.es2022.array.d.ts",
|
|
291
|
+
"lib.es2022.d.ts",
|
|
292
|
+
"lib.es2022.error.d.ts",
|
|
293
|
+
"lib.es2022.full.d.ts",
|
|
294
|
+
"lib.es2022.intl.d.ts",
|
|
295
|
+
"lib.es2022.object.d.ts",
|
|
296
|
+
"lib.es2022.regexp.d.ts",
|
|
297
|
+
"lib.es2022.sharedmemory.d.ts",
|
|
298
|
+
"lib.es2022.string.d.ts",
|
|
299
|
+
"lib.es2023.array.d.ts",
|
|
300
|
+
"lib.es2023.collection.d.ts",
|
|
301
|
+
"lib.es2023.d.ts",
|
|
302
|
+
"lib.es2023.full.d.ts",
|
|
303
|
+
"lib.es2023.intl.d.ts",
|
|
304
|
+
"lib.es2024.arraybuffer.d.ts",
|
|
305
|
+
"lib.es2024.collection.d.ts",
|
|
306
|
+
"lib.es2024.d.ts",
|
|
307
|
+
"lib.es2024.full.d.ts",
|
|
308
|
+
"lib.es2024.object.d.ts",
|
|
309
|
+
"lib.es2024.promise.d.ts",
|
|
310
|
+
"lib.es2024.regexp.d.ts",
|
|
311
|
+
"lib.es2024.sharedmemory.d.ts",
|
|
312
|
+
"lib.es2024.string.d.ts",
|
|
313
|
+
"lib.es2025.collection.d.ts",
|
|
314
|
+
"lib.es2025.d.ts",
|
|
315
|
+
"lib.es2025.float16.d.ts",
|
|
316
|
+
"lib.es2025.full.d.ts",
|
|
317
|
+
"lib.es2025.intl.d.ts",
|
|
318
|
+
"lib.es2025.iterator.d.ts",
|
|
319
|
+
"lib.es2025.promise.d.ts",
|
|
320
|
+
"lib.es2025.regexp.d.ts",
|
|
321
|
+
"lib.esnext.array.d.ts",
|
|
322
|
+
"lib.esnext.asynciterable.d.ts",
|
|
323
|
+
"lib.esnext.bigint.d.ts",
|
|
324
|
+
"lib.esnext.collection.d.ts",
|
|
325
|
+
"lib.esnext.d.ts",
|
|
326
|
+
"lib.esnext.date.d.ts",
|
|
327
|
+
"lib.esnext.decorators.d.ts",
|
|
328
|
+
"lib.esnext.disposable.d.ts",
|
|
329
|
+
"lib.esnext.error.d.ts",
|
|
330
|
+
"lib.esnext.float16.d.ts",
|
|
331
|
+
"lib.esnext.full.d.ts",
|
|
332
|
+
"lib.esnext.intl.d.ts",
|
|
333
|
+
"lib.esnext.iterator.d.ts",
|
|
334
|
+
"lib.esnext.object.d.ts",
|
|
335
|
+
"lib.esnext.promise.d.ts",
|
|
336
|
+
"lib.esnext.regexp.d.ts",
|
|
337
|
+
"lib.esnext.sharedmemory.d.ts",
|
|
338
|
+
"lib.esnext.string.d.ts",
|
|
339
|
+
"lib.esnext.symbol.d.ts",
|
|
340
|
+
"lib.esnext.temporal.d.ts",
|
|
341
|
+
"lib.esnext.typedarrays.d.ts",
|
|
342
|
+
"lib.esnext.weakref.d.ts"
|
|
343
|
+
], n = t.ScriptTarget[e.target || t.ScriptTarget.ES5], l = s.filter(function(e) {
|
|
344
|
+
return e.startsWith("lib." + n.toLowerCase());
|
|
345
|
+
}), o = s.indexOf(l.pop()), c = ((r = i.map(function(e) {
|
|
346
|
+
var t = s.filter(function(t) {
|
|
347
|
+
return t.startsWith("lib." + e.toLowerCase());
|
|
348
|
+
});
|
|
349
|
+
return 0 === t.length ? 0 : s.indexOf(t.pop());
|
|
350
|
+
})) && r.length ? r.reduce(function(e, t) {
|
|
351
|
+
return t > e ? t : e;
|
|
352
|
+
}) : void 0) || 0, u = Math.max(o, c);
|
|
353
|
+
return s.slice(0, u + 1);
|
|
354
|
+
}, n = function(e, t) {
|
|
355
|
+
var r = f(), i = b(), s = function(e) {
|
|
356
|
+
var t = [];
|
|
357
|
+
return i.readdirSync(e).forEach(function(n) {
|
|
358
|
+
n = r.join(e, n);
|
|
359
|
+
var l = i.statSync(n);
|
|
360
|
+
l && l.isDirectory() ? t = t.concat(s(n)) : t.push(n);
|
|
361
|
+
}), t;
|
|
362
|
+
};
|
|
363
|
+
s(t).forEach(function(s) {
|
|
364
|
+
var n = "/node_modules/@types" + s.replace(t, ""), l = i.readFileSync(s, "utf8");
|
|
365
|
+
[".ts", ".tsx"].includes(r.extname(n)) && e.set(n, l);
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
function l(e) {
|
|
369
|
+
throw new Error("Method '" + e + "' is not implemented.");
|
|
370
|
+
}
|
|
371
|
+
function o(e, t) {
|
|
372
|
+
return function() {
|
|
373
|
+
for (var r = arguments.length, s = new Array(r), n = 0; n < r; n++) s[n] = arguments[n];
|
|
374
|
+
var l = t.apply(void 0, s), o = "string" == typeof l ? l.slice(0, 80) + "..." : l;
|
|
375
|
+
return i.apply(void 0, ["> " + e].concat(s)), i("< " + o), l;
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
var a = function(t) {
|
|
379
|
+
return e({}, t.getDefaultCompilerOptions(), {
|
|
380
|
+
jsx: t.JsxEmit.React,
|
|
381
|
+
strict: !0,
|
|
382
|
+
esModuleInterop: !0,
|
|
383
|
+
module: t.ModuleKind.ESNext,
|
|
384
|
+
suppressOutputPathCheck: !0,
|
|
385
|
+
skipLibCheck: !0,
|
|
386
|
+
skipDefaultLibCheck: !0
|
|
387
|
+
}, t.versionMajorMinor && Number(t.versionMajorMinor.split(".")[0]) >= 6 ? { ignoreDeprecations: "6.0" } : { moduleResolution: t.ModuleResolutionKind.NodeJs });
|
|
388
|
+
}, c = function(e) {
|
|
389
|
+
return e.replace("/", "/lib.").toLowerCase();
|
|
390
|
+
};
|
|
391
|
+
function u(t, r, i) {
|
|
392
|
+
var s = /* @__PURE__ */ new Map();
|
|
393
|
+
return {
|
|
394
|
+
compilerHost: e({}, t, {
|
|
395
|
+
getCanonicalFileName: function(e) {
|
|
396
|
+
return e;
|
|
397
|
+
},
|
|
398
|
+
getDefaultLibFileName: function() {
|
|
399
|
+
return "/" + i.getDefaultLibFileName(r);
|
|
400
|
+
},
|
|
401
|
+
getNewLine: function() {
|
|
402
|
+
return t.newLine;
|
|
403
|
+
},
|
|
404
|
+
getSourceFile: function(e, n) {
|
|
405
|
+
var l, o;
|
|
406
|
+
return s.get(e) || (o = i.createSourceFile(e, t.readFile(e), null != (l = null != n ? n : r.target) ? l : a(i).target, !1), s.set(o.fileName, o), o);
|
|
407
|
+
},
|
|
408
|
+
useCaseSensitiveFileNames: function() {
|
|
409
|
+
return t.useCaseSensitiveFileNames;
|
|
410
|
+
}
|
|
411
|
+
}),
|
|
412
|
+
updateFile: function(e) {
|
|
413
|
+
var r = s.has(e.fileName);
|
|
414
|
+
return t.writeFile(e.fileName, e.text), s.set(e.fileName, e), r;
|
|
415
|
+
},
|
|
416
|
+
deleteFile: function(e) {
|
|
417
|
+
var r = s.has(e.fileName);
|
|
418
|
+
return s.delete(e.fileName), t.deleteFile(e.fileName), r;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function d(t, r, i, s, n) {
|
|
423
|
+
var l = [].concat(r), o = u(t, i, s), a = o.compilerHost, c = o.updateFile, d = o.deleteFile, f = /* @__PURE__ */ new Map(), b = 0;
|
|
424
|
+
return {
|
|
425
|
+
languageServiceHost: e({}, a, {
|
|
426
|
+
getProjectVersion: function() {
|
|
427
|
+
return b.toString();
|
|
428
|
+
},
|
|
429
|
+
getCompilationSettings: function() {
|
|
430
|
+
return i;
|
|
431
|
+
},
|
|
432
|
+
getCustomTransformers: function() {
|
|
433
|
+
return n;
|
|
434
|
+
},
|
|
435
|
+
getScriptFileNames: function() {
|
|
436
|
+
return l.slice();
|
|
437
|
+
},
|
|
438
|
+
getScriptSnapshot: function(e) {
|
|
439
|
+
var r = t.readFile(e);
|
|
440
|
+
if (r && "string" == typeof r) return s.ScriptSnapshot.fromString(r);
|
|
441
|
+
},
|
|
442
|
+
getScriptVersion: function(e) {
|
|
443
|
+
return f.get(e) || "0";
|
|
444
|
+
},
|
|
445
|
+
writeFile: t.writeFile
|
|
446
|
+
}),
|
|
447
|
+
updateFile: function(e) {
|
|
448
|
+
b++, f.set(e.fileName, b.toString()), l.includes(e.fileName) || l.push(e.fileName), c(e);
|
|
449
|
+
},
|
|
450
|
+
deleteFile: function(e) {
|
|
451
|
+
b++, f.set(e.fileName, b.toString());
|
|
452
|
+
var t = l.indexOf(e.fileName);
|
|
453
|
+
-1 !== t && l.splice(t, 1), d(e);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
var f = function() {
|
|
458
|
+
return __require(String.fromCharCode(112, 97, 116, 104));
|
|
459
|
+
}, b = function() {
|
|
460
|
+
return __require(String.fromCharCode(102, 115));
|
|
461
|
+
};
|
|
462
|
+
exports.addAllFilesFromFolder = n, exports.addFilesForTypesIntoFolder = function(e) {
|
|
463
|
+
return n(e, "node_modules/@types");
|
|
464
|
+
}, exports.createDefaultMapFromCDN = function(e, t, r, i, n, l, o) {
|
|
465
|
+
var a = l || fetch, c = /* @__PURE__ */ new Map(), u = s(e, i), d = "https://playgroundcdn.typescriptlang.org/cdn/" + t + "/typescript/lib/";
|
|
466
|
+
return (r ? function() {
|
|
467
|
+
var e = o || localStorage;
|
|
468
|
+
return Object.keys(e).forEach(function(r) {
|
|
469
|
+
r.startsWith("ts-lib-") && !r.startsWith("ts-lib-" + t) && e.removeItem(r);
|
|
470
|
+
}), Promise.all(u.map(function(r) {
|
|
471
|
+
var i, s = "ts-lib-" + t + "-" + r, l = e.getItem(s);
|
|
472
|
+
return l ? Promise.resolve((i = l, n ? n.decompressFromUTF16(i) : i)) : a(d + r).then(function(e) {
|
|
473
|
+
return e.text();
|
|
474
|
+
}).then(function(t) {
|
|
475
|
+
var r;
|
|
476
|
+
return e.setItem(s, (r = t, n ? n.compressToUTF16(r) : r)), t;
|
|
477
|
+
}).catch(function() {});
|
|
478
|
+
})).then(function(e) {
|
|
479
|
+
e.forEach(function(e, t) {
|
|
480
|
+
e && c.set("/" + u[t], e);
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
} : function() {
|
|
484
|
+
return Promise.all(u.map(function(e) {
|
|
485
|
+
return a(d + e).then(function(e) {
|
|
486
|
+
return e.text();
|
|
487
|
+
});
|
|
488
|
+
})).then(function(e) {
|
|
489
|
+
e.forEach(function(e, t) {
|
|
490
|
+
return c.set("/" + u[t], e);
|
|
491
|
+
});
|
|
492
|
+
}).catch(function() {});
|
|
493
|
+
})().then(function() {
|
|
494
|
+
return c;
|
|
495
|
+
});
|
|
496
|
+
}, exports.createDefaultMapFromNodeModules = function(e, t, r) {
|
|
497
|
+
var i = f(), s = b(), n = s.readdirSync(r || i.dirname(__require.resolve("typescript"))).filter(function(e) {
|
|
498
|
+
return e.startsWith("lib.") && /\.d\.([^\.]+\.)?[cm]?ts$/i.test(e);
|
|
499
|
+
}), l = /* @__PURE__ */ new Map();
|
|
500
|
+
return n.forEach(function(e) {
|
|
501
|
+
l.set("/" + e, function(e) {
|
|
502
|
+
var t = r || i.dirname(__require.resolve("typescript"));
|
|
503
|
+
return s.readFileSync(i.join(t, e), "utf8");
|
|
504
|
+
}(e));
|
|
505
|
+
}), l;
|
|
506
|
+
}, exports.createFSBackedSystem = function(e, t, r, i) {
|
|
507
|
+
var s = t + "/vfs", n = f(), a = r.sys, c = null != i ? i : n.dirname(__require.resolve("typescript"));
|
|
508
|
+
return {
|
|
509
|
+
name: "fs-vfs",
|
|
510
|
+
root: s,
|
|
511
|
+
args: [],
|
|
512
|
+
createDirectory: function() {
|
|
513
|
+
return l("createDirectory");
|
|
514
|
+
},
|
|
515
|
+
directoryExists: o("directoryExists", function(t) {
|
|
516
|
+
return Array.from(e.keys()).some(function(e) {
|
|
517
|
+
return e.startsWith(t);
|
|
518
|
+
}) || a.directoryExists(t);
|
|
519
|
+
}),
|
|
520
|
+
exit: a.exit,
|
|
521
|
+
fileExists: o("fileExists", function(t) {
|
|
522
|
+
if (e.has(t)) return !0;
|
|
523
|
+
if (t.includes("tsconfig.json") || t.includes("tsconfig.json")) return !1;
|
|
524
|
+
if (t.startsWith("/lib")) {
|
|
525
|
+
var r = c + "/" + t.replace("/", "");
|
|
526
|
+
return a.fileExists(r);
|
|
527
|
+
}
|
|
528
|
+
return a.fileExists(t);
|
|
529
|
+
}),
|
|
530
|
+
getCurrentDirectory: function() {
|
|
531
|
+
return s;
|
|
532
|
+
},
|
|
533
|
+
getDirectories: a.getDirectories,
|
|
534
|
+
getExecutingFilePath: function() {
|
|
535
|
+
return l("getExecutingFilePath");
|
|
536
|
+
},
|
|
537
|
+
readDirectory: o("readDirectory", function() {
|
|
538
|
+
return "/" === (arguments.length <= 0 ? void 0 : arguments[0]) ? Array.from(e.keys()) : a.readDirectory.apply(a, arguments);
|
|
539
|
+
}),
|
|
540
|
+
readFile: o("readFile", function(t) {
|
|
541
|
+
if (e.has(t)) return e.get(t);
|
|
542
|
+
if (t.startsWith("/lib")) {
|
|
543
|
+
var r = c + "/" + t.replace("/", ""), i = a.readFile(r);
|
|
544
|
+
if (!i) {
|
|
545
|
+
var s = a.readDirectory(c);
|
|
546
|
+
throw new Error("TSVFS: A request was made for " + r + " but there wasn't a file found in the file map. You likely have a mismatch in the compiler options for the CDN download vs the compiler program. Existing Libs: " + s + ".");
|
|
547
|
+
}
|
|
548
|
+
return i;
|
|
549
|
+
}
|
|
550
|
+
return a.readFile(t);
|
|
551
|
+
}),
|
|
552
|
+
resolvePath: function(t) {
|
|
553
|
+
return e.has(t) ? t : a.resolvePath(t);
|
|
554
|
+
},
|
|
555
|
+
newLine: "\n",
|
|
556
|
+
useCaseSensitiveFileNames: !0,
|
|
557
|
+
write: function() {
|
|
558
|
+
return l("write");
|
|
559
|
+
},
|
|
560
|
+
writeFile: function(t, r) {
|
|
561
|
+
e.set(t, r);
|
|
562
|
+
},
|
|
563
|
+
deleteFile: function(t) {
|
|
564
|
+
e.delete(t);
|
|
565
|
+
},
|
|
566
|
+
realpath: a.realpath
|
|
567
|
+
};
|
|
568
|
+
}, exports.createSystem = function(e) {
|
|
569
|
+
return {
|
|
570
|
+
args: [],
|
|
571
|
+
createDirectory: function() {
|
|
572
|
+
return l("createDirectory");
|
|
573
|
+
},
|
|
574
|
+
directoryExists: o("directoryExists", function(t) {
|
|
575
|
+
return Array.from(e.keys()).some(function(e) {
|
|
576
|
+
return e.startsWith(t);
|
|
577
|
+
});
|
|
578
|
+
}),
|
|
579
|
+
exit: function() {
|
|
580
|
+
return l("exit");
|
|
581
|
+
},
|
|
582
|
+
fileExists: o("fileExists", function(t) {
|
|
583
|
+
return e.has(t) || e.has(c(t));
|
|
584
|
+
}),
|
|
585
|
+
getCurrentDirectory: function() {
|
|
586
|
+
return "/";
|
|
587
|
+
},
|
|
588
|
+
getDirectories: function() {
|
|
589
|
+
return [];
|
|
590
|
+
},
|
|
591
|
+
getExecutingFilePath: function() {
|
|
592
|
+
return l("getExecutingFilePath");
|
|
593
|
+
},
|
|
594
|
+
readDirectory: o("readDirectory", function(t) {
|
|
595
|
+
return "/" === t ? Array.from(e.keys()) : [];
|
|
596
|
+
}),
|
|
597
|
+
readFile: o("readFile", function(t) {
|
|
598
|
+
var r;
|
|
599
|
+
return null != (r = e.get(t)) ? r : e.get(c(t));
|
|
600
|
+
}),
|
|
601
|
+
resolvePath: function(e) {
|
|
602
|
+
return e;
|
|
603
|
+
},
|
|
604
|
+
newLine: "\n",
|
|
605
|
+
useCaseSensitiveFileNames: !0,
|
|
606
|
+
write: function() {
|
|
607
|
+
return l("write");
|
|
608
|
+
},
|
|
609
|
+
writeFile: function(t, r) {
|
|
610
|
+
e.set(t, r);
|
|
611
|
+
},
|
|
612
|
+
deleteFile: function(t) {
|
|
613
|
+
e.delete(t);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
}, exports.createVirtualCompilerHost = u, exports.createVirtualLanguageServiceHost = d, exports.createVirtualTypeScriptEnvironment = function(t, r, i, s, n) {
|
|
617
|
+
void 0 === s && (s = {});
|
|
618
|
+
var l = e({}, a(i), s), o = d(t, r, l, i, n), c = o.updateFile, f = o.deleteFile, b = i.createLanguageService(o.languageServiceHost), p = b.getCompilerOptionsDiagnostics();
|
|
619
|
+
if (p.length) {
|
|
620
|
+
var g = u(t, s, i);
|
|
621
|
+
throw new Error(i.formatDiagnostics(p, g.compilerHost));
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
name: "vfs",
|
|
625
|
+
sys: t,
|
|
626
|
+
languageService: b,
|
|
627
|
+
getSourceFile: function(e) {
|
|
628
|
+
var t;
|
|
629
|
+
return null == (t = b.getProgram()) ? void 0 : t.getSourceFile(e);
|
|
630
|
+
},
|
|
631
|
+
createFile: function(e, t) {
|
|
632
|
+
c(i.createSourceFile(e, t, l.target, !1));
|
|
633
|
+
},
|
|
634
|
+
updateFile: function(e, t, r) {
|
|
635
|
+
var s = b.getProgram().getSourceFile(e);
|
|
636
|
+
if (!s) throw new Error("Did not find a source file for " + e);
|
|
637
|
+
var n = s.text, l = null != r ? r : i.createTextSpan(0, n.length), o = n.slice(0, l.start) + t + n.slice(l.start + l.length);
|
|
638
|
+
c(i.updateSourceFile(s, o, {
|
|
639
|
+
span: l,
|
|
640
|
+
newLength: t.length
|
|
641
|
+
}));
|
|
642
|
+
},
|
|
643
|
+
deleteFile: function(e) {
|
|
644
|
+
var t = b.getProgram().getSourceFile(e);
|
|
645
|
+
t && f(t);
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}, exports.knownLibFilesForCompilerOptions = s;
|
|
649
|
+
}));
|
|
650
|
+
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region ../../node_modules/.pnpm/@typescript+vfs@1.6.4_typescript@5.9.3/node_modules/@typescript/vfs/dist/vfs.cjs.development.js
|
|
653
|
+
var require_vfs_cjs_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
654
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
655
|
+
function _extends() {
|
|
656
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
657
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
658
|
+
var t = arguments[e];
|
|
659
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
660
|
+
}
|
|
661
|
+
return n;
|
|
662
|
+
}, _extends.apply(null, arguments);
|
|
663
|
+
}
|
|
664
|
+
var hasLocalStorage = false;
|
|
665
|
+
try {
|
|
666
|
+
hasLocalStorage = typeof localStorage !== "undefined";
|
|
667
|
+
} catch (error) {}
|
|
668
|
+
var hasProcess = typeof process !== "undefined";
|
|
669
|
+
var debugLog = hasLocalStorage && typeof localStorage.getItem === "function" && /* @__PURE__ */ localStorage.getItem("DEBUG") || hasProcess && process.env.DEBUG ? console.log : function(_message) {
|
|
670
|
+
return "";
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
|
|
674
|
+
* @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
|
|
675
|
+
*
|
|
676
|
+
* @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
|
|
677
|
+
* @param rootFiles a list of files which are considered inside the project
|
|
678
|
+
* @param ts a copy pf the TypeScript module
|
|
679
|
+
* @param compilerOptions the options for this compiler run
|
|
680
|
+
* @param customTransformers custom transformers for this compiler run
|
|
681
|
+
*/
|
|
682
|
+
function createVirtualTypeScriptEnvironment(sys, rootFiles, ts, compilerOptions, customTransformers) {
|
|
683
|
+
if (compilerOptions === void 0) compilerOptions = {};
|
|
684
|
+
var mergedCompilerOpts = _extends({}, defaultCompilerOptions(ts), compilerOptions);
|
|
685
|
+
var _createVirtualLanguag = createVirtualLanguageServiceHost(sys, rootFiles, mergedCompilerOpts, ts, customTransformers), languageServiceHost = _createVirtualLanguag.languageServiceHost, _updateFile = _createVirtualLanguag.updateFile, _deleteFile = _createVirtualLanguag.deleteFile;
|
|
686
|
+
var languageService = ts.createLanguageService(languageServiceHost);
|
|
687
|
+
var diagnostics = languageService.getCompilerOptionsDiagnostics();
|
|
688
|
+
if (diagnostics.length) {
|
|
689
|
+
var compilerHost = createVirtualCompilerHost(sys, compilerOptions, ts);
|
|
690
|
+
throw new Error(ts.formatDiagnostics(diagnostics, compilerHost.compilerHost));
|
|
691
|
+
}
|
|
692
|
+
return {
|
|
693
|
+
name: "vfs",
|
|
694
|
+
sys,
|
|
695
|
+
languageService,
|
|
696
|
+
getSourceFile: function getSourceFile(fileName) {
|
|
697
|
+
var _languageService$getP;
|
|
698
|
+
return (_languageService$getP = languageService.getProgram()) == null ? void 0 : _languageService$getP.getSourceFile(fileName);
|
|
699
|
+
},
|
|
700
|
+
createFile: function createFile(fileName, content) {
|
|
701
|
+
_updateFile(ts.createSourceFile(fileName, content, mergedCompilerOpts.target, false));
|
|
702
|
+
},
|
|
703
|
+
updateFile: function updateFile(fileName, content, optPrevTextSpan) {
|
|
704
|
+
var prevSourceFile = languageService.getProgram().getSourceFile(fileName);
|
|
705
|
+
if (!prevSourceFile) throw new Error("Did not find a source file for " + fileName);
|
|
706
|
+
var prevFullContents = prevSourceFile.text;
|
|
707
|
+
var prevTextSpan = optPrevTextSpan != null ? optPrevTextSpan : ts.createTextSpan(0, prevFullContents.length);
|
|
708
|
+
var newText = prevFullContents.slice(0, prevTextSpan.start) + content + prevFullContents.slice(prevTextSpan.start + prevTextSpan.length);
|
|
709
|
+
_updateFile(ts.updateSourceFile(prevSourceFile, newText, {
|
|
710
|
+
span: prevTextSpan,
|
|
711
|
+
newLength: content.length
|
|
712
|
+
}));
|
|
713
|
+
},
|
|
714
|
+
deleteFile: function deleteFile(fileName) {
|
|
715
|
+
var sourceFile = languageService.getProgram().getSourceFile(fileName);
|
|
716
|
+
if (sourceFile) _deleteFile(sourceFile);
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Grab the list of lib files for a particular target, will return a bit more than necessary (by including
|
|
722
|
+
* the dom) but that's OK, we're really working with the constraint that you can't get a list of files
|
|
723
|
+
* when running in a browser.
|
|
724
|
+
*
|
|
725
|
+
* @param target The compiler settings target baseline
|
|
726
|
+
* @param ts A copy of the TypeScript module
|
|
727
|
+
*/
|
|
728
|
+
var knownLibFilesForCompilerOptions = function knownLibFilesForCompilerOptions(compilerOptions, ts) {
|
|
729
|
+
var target = compilerOptions.target || ts.ScriptTarget.ES5;
|
|
730
|
+
var lib = compilerOptions.lib || [];
|
|
731
|
+
var files = [
|
|
732
|
+
"lib.d.ts",
|
|
733
|
+
"lib.core.d.ts",
|
|
734
|
+
"lib.decorators.d.ts",
|
|
735
|
+
"lib.decorators.legacy.d.ts",
|
|
736
|
+
"lib.dom.asynciterable.d.ts",
|
|
737
|
+
"lib.dom.d.ts",
|
|
738
|
+
"lib.dom.iterable.d.ts",
|
|
739
|
+
"lib.webworker.asynciterable.d.ts",
|
|
740
|
+
"lib.webworker.d.ts",
|
|
741
|
+
"lib.webworker.importscripts.d.ts",
|
|
742
|
+
"lib.webworker.iterable.d.ts",
|
|
743
|
+
"lib.scripthost.d.ts",
|
|
744
|
+
"lib.es5.d.ts",
|
|
745
|
+
"lib.es6.d.ts",
|
|
746
|
+
"lib.es7.d.ts",
|
|
747
|
+
"lib.core.es6.d.ts",
|
|
748
|
+
"lib.core.es7.d.ts",
|
|
749
|
+
"lib.es2015.collection.d.ts",
|
|
750
|
+
"lib.es2015.core.d.ts",
|
|
751
|
+
"lib.es2015.d.ts",
|
|
752
|
+
"lib.es2015.generator.d.ts",
|
|
753
|
+
"lib.es2015.iterable.d.ts",
|
|
754
|
+
"lib.es2015.promise.d.ts",
|
|
755
|
+
"lib.es2015.proxy.d.ts",
|
|
756
|
+
"lib.es2015.reflect.d.ts",
|
|
757
|
+
"lib.es2015.symbol.d.ts",
|
|
758
|
+
"lib.es2015.symbol.wellknown.d.ts",
|
|
759
|
+
"lib.es2016.array.include.d.ts",
|
|
760
|
+
"lib.es2016.d.ts",
|
|
761
|
+
"lib.es2016.full.d.ts",
|
|
762
|
+
"lib.es2016.intl.d.ts",
|
|
763
|
+
"lib.es2017.arraybuffer.d.ts",
|
|
764
|
+
"lib.es2017.d.ts",
|
|
765
|
+
"lib.es2017.date.d.ts",
|
|
766
|
+
"lib.es2017.full.d.ts",
|
|
767
|
+
"lib.es2017.intl.d.ts",
|
|
768
|
+
"lib.es2017.object.d.ts",
|
|
769
|
+
"lib.es2017.sharedmemory.d.ts",
|
|
770
|
+
"lib.es2017.string.d.ts",
|
|
771
|
+
"lib.es2017.typedarrays.d.ts",
|
|
772
|
+
"lib.es2018.asyncgenerator.d.ts",
|
|
773
|
+
"lib.es2018.asynciterable.d.ts",
|
|
774
|
+
"lib.es2018.d.ts",
|
|
775
|
+
"lib.es2018.full.d.ts",
|
|
776
|
+
"lib.es2018.intl.d.ts",
|
|
777
|
+
"lib.es2018.promise.d.ts",
|
|
778
|
+
"lib.es2018.regexp.d.ts",
|
|
779
|
+
"lib.es2019.array.d.ts",
|
|
780
|
+
"lib.es2019.d.ts",
|
|
781
|
+
"lib.es2019.full.d.ts",
|
|
782
|
+
"lib.es2019.intl.d.ts",
|
|
783
|
+
"lib.es2019.object.d.ts",
|
|
784
|
+
"lib.es2019.string.d.ts",
|
|
785
|
+
"lib.es2019.symbol.d.ts",
|
|
786
|
+
"lib.es2020.bigint.d.ts",
|
|
787
|
+
"lib.es2020.d.ts",
|
|
788
|
+
"lib.es2020.date.d.ts",
|
|
789
|
+
"lib.es2020.full.d.ts",
|
|
790
|
+
"lib.es2020.intl.d.ts",
|
|
791
|
+
"lib.es2020.number.d.ts",
|
|
792
|
+
"lib.es2020.promise.d.ts",
|
|
793
|
+
"lib.es2020.sharedmemory.d.ts",
|
|
794
|
+
"lib.es2020.string.d.ts",
|
|
795
|
+
"lib.es2020.symbol.wellknown.d.ts",
|
|
796
|
+
"lib.es2021.d.ts",
|
|
797
|
+
"lib.es2021.full.d.ts",
|
|
798
|
+
"lib.es2021.intl.d.ts",
|
|
799
|
+
"lib.es2021.promise.d.ts",
|
|
800
|
+
"lib.es2021.string.d.ts",
|
|
801
|
+
"lib.es2021.weakref.d.ts",
|
|
802
|
+
"lib.es2022.array.d.ts",
|
|
803
|
+
"lib.es2022.d.ts",
|
|
804
|
+
"lib.es2022.error.d.ts",
|
|
805
|
+
"lib.es2022.full.d.ts",
|
|
806
|
+
"lib.es2022.intl.d.ts",
|
|
807
|
+
"lib.es2022.object.d.ts",
|
|
808
|
+
"lib.es2022.regexp.d.ts",
|
|
809
|
+
"lib.es2022.sharedmemory.d.ts",
|
|
810
|
+
"lib.es2022.string.d.ts",
|
|
811
|
+
"lib.es2023.array.d.ts",
|
|
812
|
+
"lib.es2023.collection.d.ts",
|
|
813
|
+
"lib.es2023.d.ts",
|
|
814
|
+
"lib.es2023.full.d.ts",
|
|
815
|
+
"lib.es2023.intl.d.ts",
|
|
816
|
+
"lib.es2024.arraybuffer.d.ts",
|
|
817
|
+
"lib.es2024.collection.d.ts",
|
|
818
|
+
"lib.es2024.d.ts",
|
|
819
|
+
"lib.es2024.full.d.ts",
|
|
820
|
+
"lib.es2024.object.d.ts",
|
|
821
|
+
"lib.es2024.promise.d.ts",
|
|
822
|
+
"lib.es2024.regexp.d.ts",
|
|
823
|
+
"lib.es2024.sharedmemory.d.ts",
|
|
824
|
+
"lib.es2024.string.d.ts",
|
|
825
|
+
"lib.es2025.collection.d.ts",
|
|
826
|
+
"lib.es2025.d.ts",
|
|
827
|
+
"lib.es2025.float16.d.ts",
|
|
828
|
+
"lib.es2025.full.d.ts",
|
|
829
|
+
"lib.es2025.intl.d.ts",
|
|
830
|
+
"lib.es2025.iterator.d.ts",
|
|
831
|
+
"lib.es2025.promise.d.ts",
|
|
832
|
+
"lib.es2025.regexp.d.ts",
|
|
833
|
+
"lib.esnext.array.d.ts",
|
|
834
|
+
"lib.esnext.asynciterable.d.ts",
|
|
835
|
+
"lib.esnext.bigint.d.ts",
|
|
836
|
+
"lib.esnext.collection.d.ts",
|
|
837
|
+
"lib.esnext.d.ts",
|
|
838
|
+
"lib.esnext.date.d.ts",
|
|
839
|
+
"lib.esnext.decorators.d.ts",
|
|
840
|
+
"lib.esnext.disposable.d.ts",
|
|
841
|
+
"lib.esnext.error.d.ts",
|
|
842
|
+
"lib.esnext.float16.d.ts",
|
|
843
|
+
"lib.esnext.full.d.ts",
|
|
844
|
+
"lib.esnext.intl.d.ts",
|
|
845
|
+
"lib.esnext.iterator.d.ts",
|
|
846
|
+
"lib.esnext.object.d.ts",
|
|
847
|
+
"lib.esnext.promise.d.ts",
|
|
848
|
+
"lib.esnext.regexp.d.ts",
|
|
849
|
+
"lib.esnext.sharedmemory.d.ts",
|
|
850
|
+
"lib.esnext.string.d.ts",
|
|
851
|
+
"lib.esnext.symbol.d.ts",
|
|
852
|
+
"lib.esnext.temporal.d.ts",
|
|
853
|
+
"lib.esnext.typedarrays.d.ts",
|
|
854
|
+
"lib.esnext.weakref.d.ts"
|
|
855
|
+
];
|
|
856
|
+
var targetToCut = ts.ScriptTarget[target];
|
|
857
|
+
var matches = files.filter(function(f) {
|
|
858
|
+
return f.startsWith("lib." + targetToCut.toLowerCase());
|
|
859
|
+
});
|
|
860
|
+
var targetCutIndex = files.indexOf(matches.pop());
|
|
861
|
+
var libCutIndex = function getMax(array) {
|
|
862
|
+
return array && array.length ? array.reduce(function(max, current) {
|
|
863
|
+
return current > max ? current : max;
|
|
864
|
+
}) : void 0;
|
|
865
|
+
}(lib.map(function(lib) {
|
|
866
|
+
var matches = files.filter(function(f) {
|
|
867
|
+
return f.startsWith("lib." + lib.toLowerCase());
|
|
868
|
+
});
|
|
869
|
+
if (matches.length === 0) return 0;
|
|
870
|
+
return files.indexOf(matches.pop());
|
|
871
|
+
})) || 0;
|
|
872
|
+
var finalCutIndex = Math.max(targetCutIndex, libCutIndex);
|
|
873
|
+
return files.slice(0, finalCutIndex + 1);
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* Sets up a Map with lib contents by grabbing the necessary files from
|
|
877
|
+
* the local copy of typescript via the file system.
|
|
878
|
+
*
|
|
879
|
+
* The first two args are un-used, but kept around so as to not cause a
|
|
880
|
+
* semver major bump for no gain to module users.
|
|
881
|
+
*/
|
|
882
|
+
var createDefaultMapFromNodeModules = function createDefaultMapFromNodeModules(_compilerOptions, _ts, tsLibDirectory) {
|
|
883
|
+
var path = requirePath();
|
|
884
|
+
var fs = requireFS();
|
|
885
|
+
var getLib = function getLib(name) {
|
|
886
|
+
var lib = tsLibDirectory || path.dirname(__require.resolve("typescript"));
|
|
887
|
+
return fs.readFileSync(path.join(lib, name), "utf8");
|
|
888
|
+
};
|
|
889
|
+
var isDtsFile = function isDtsFile(file) {
|
|
890
|
+
return /\.d\.([^\.]+\.)?[cm]?ts$/i.test(file);
|
|
891
|
+
};
|
|
892
|
+
var knownLibFiles = fs.readdirSync(tsLibDirectory || path.dirname(__require.resolve("typescript"))).filter(function(f) {
|
|
893
|
+
return f.startsWith("lib.") && isDtsFile(f);
|
|
894
|
+
});
|
|
895
|
+
var fsMap = /* @__PURE__ */ new Map();
|
|
896
|
+
knownLibFiles.forEach(function(lib) {
|
|
897
|
+
fsMap.set("/" + lib, getLib(lib));
|
|
898
|
+
});
|
|
899
|
+
return fsMap;
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Adds recursively files from the FS into the map based on the folder
|
|
903
|
+
*/
|
|
904
|
+
var addAllFilesFromFolder = function addAllFilesFromFolder(map, workingDir) {
|
|
905
|
+
var path = requirePath();
|
|
906
|
+
var fs = requireFS();
|
|
907
|
+
var _walk = function walk(dir) {
|
|
908
|
+
var results = [];
|
|
909
|
+
fs.readdirSync(dir).forEach(function(file) {
|
|
910
|
+
file = path.join(dir, file);
|
|
911
|
+
var stat = fs.statSync(file);
|
|
912
|
+
if (stat && stat.isDirectory()) results = results.concat(_walk(file));
|
|
913
|
+
else results.push(file);
|
|
914
|
+
});
|
|
915
|
+
return results;
|
|
916
|
+
};
|
|
917
|
+
_walk(workingDir).forEach(function(lib) {
|
|
918
|
+
var fsPath = "/node_modules/@types" + lib.replace(workingDir, "");
|
|
919
|
+
var content = fs.readFileSync(lib, "utf8");
|
|
920
|
+
if ([".ts", ".tsx"].includes(path.extname(fsPath))) map.set(fsPath, content);
|
|
921
|
+
});
|
|
922
|
+
};
|
|
923
|
+
/** Adds all files from node_modules/@types into the FS Map */
|
|
924
|
+
var addFilesForTypesIntoFolder = function addFilesForTypesIntoFolder(map) {
|
|
925
|
+
return addAllFilesFromFolder(map, "node_modules/@types");
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Create a virtual FS Map with the lib files from a particular TypeScript
|
|
929
|
+
* version based on the target, Always includes dom ATM.
|
|
930
|
+
*
|
|
931
|
+
* @param options The compiler target, which dictates the libs to set up
|
|
932
|
+
* @param version the versions of TypeScript which are supported
|
|
933
|
+
* @param cache should the values be stored in local storage
|
|
934
|
+
* @param ts a copy of the typescript import
|
|
935
|
+
* @param lzstring an optional copy of the lz-string import
|
|
936
|
+
* @param fetcher an optional replacement for the global fetch function (tests mainly)
|
|
937
|
+
* @param storer an optional replacement for the localStorage global (tests mainly)
|
|
938
|
+
*/
|
|
939
|
+
var createDefaultMapFromCDN = function createDefaultMapFromCDN(options, version, cache, ts, lzstring, fetcher, storer) {
|
|
940
|
+
var fetchlike = fetcher || fetch;
|
|
941
|
+
var fsMap = /* @__PURE__ */ new Map();
|
|
942
|
+
var files = knownLibFilesForCompilerOptions(options, ts);
|
|
943
|
+
var prefix = "https://playgroundcdn.typescriptlang.org/cdn/" + version + "/typescript/lib/";
|
|
944
|
+
function zip(str) {
|
|
945
|
+
return lzstring ? lzstring.compressToUTF16(str) : str;
|
|
946
|
+
}
|
|
947
|
+
function unzip(str) {
|
|
948
|
+
return lzstring ? lzstring.decompressFromUTF16(str) : str;
|
|
949
|
+
}
|
|
950
|
+
function uncached() {
|
|
951
|
+
return Promise.all(files.map(function(lib) {
|
|
952
|
+
return fetchlike(prefix + lib).then(function(resp) {
|
|
953
|
+
return resp.text();
|
|
954
|
+
});
|
|
955
|
+
})).then(function(contents) {
|
|
956
|
+
contents.forEach(function(text, index) {
|
|
957
|
+
return fsMap.set("/" + files[index], text);
|
|
958
|
+
});
|
|
959
|
+
})["catch"](function() {});
|
|
960
|
+
}
|
|
961
|
+
function cached() {
|
|
962
|
+
var storelike = storer || localStorage;
|
|
963
|
+
Object.keys(storelike).forEach(function(key) {
|
|
964
|
+
if (key.startsWith("ts-lib-") && !key.startsWith("ts-lib-" + version)) storelike.removeItem(key);
|
|
965
|
+
});
|
|
966
|
+
return Promise.all(files.map(function(lib) {
|
|
967
|
+
var cacheKey = "ts-lib-" + version + "-" + lib;
|
|
968
|
+
var content = storelike.getItem(cacheKey);
|
|
969
|
+
if (!content) return fetchlike(prefix + lib).then(function(resp) {
|
|
970
|
+
return resp.text();
|
|
971
|
+
}).then(function(t) {
|
|
972
|
+
storelike.setItem(cacheKey, zip(t));
|
|
973
|
+
return t;
|
|
974
|
+
})["catch"](function() {});
|
|
975
|
+
else return Promise.resolve(unzip(content));
|
|
976
|
+
})).then(function(contents) {
|
|
977
|
+
contents.forEach(function(text, index) {
|
|
978
|
+
if (text) {
|
|
979
|
+
var name = "/" + files[index];
|
|
980
|
+
fsMap.set(name, text);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
return (cache ? cached : uncached)().then(function() {
|
|
986
|
+
return fsMap;
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
function notImplemented(methodName) {
|
|
990
|
+
throw new Error("Method '" + methodName + "' is not implemented.");
|
|
991
|
+
}
|
|
992
|
+
function audit(name, fn) {
|
|
993
|
+
return function() {
|
|
994
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
995
|
+
var res = fn.apply(void 0, args);
|
|
996
|
+
var smallres = typeof res === "string" ? res.slice(0, 80) + "..." : res;
|
|
997
|
+
debugLog.apply(void 0, ["> " + name].concat(args));
|
|
998
|
+
debugLog("< " + smallres);
|
|
999
|
+
return res;
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
/** The default compiler options if TypeScript could ever change the compiler options */
|
|
1003
|
+
var defaultCompilerOptions = function defaultCompilerOptions(ts) {
|
|
1004
|
+
return _extends({}, ts.getDefaultCompilerOptions(), {
|
|
1005
|
+
jsx: ts.JsxEmit.React,
|
|
1006
|
+
strict: true,
|
|
1007
|
+
esModuleInterop: true,
|
|
1008
|
+
module: ts.ModuleKind.ESNext,
|
|
1009
|
+
suppressOutputPathCheck: true,
|
|
1010
|
+
skipLibCheck: true,
|
|
1011
|
+
skipDefaultLibCheck: true
|
|
1012
|
+
}, ts.versionMajorMinor && Number(ts.versionMajorMinor.split(".")[0]) >= 6 ? { ignoreDeprecations: "6.0" } : { moduleResolution: ts.ModuleResolutionKind.NodeJs });
|
|
1013
|
+
};
|
|
1014
|
+
var libize = function libize(path) {
|
|
1015
|
+
return path.replace("/", "/lib.").toLowerCase();
|
|
1016
|
+
};
|
|
1017
|
+
/**
|
|
1018
|
+
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
1019
|
+
* is what provides read/write aspects of the virtual fs
|
|
1020
|
+
*/
|
|
1021
|
+
function createSystem(files) {
|
|
1022
|
+
return {
|
|
1023
|
+
args: [],
|
|
1024
|
+
createDirectory: function createDirectory() {
|
|
1025
|
+
return notImplemented("createDirectory");
|
|
1026
|
+
},
|
|
1027
|
+
directoryExists: audit("directoryExists", function(directory) {
|
|
1028
|
+
return Array.from(files.keys()).some(function(path) {
|
|
1029
|
+
return path.startsWith(directory);
|
|
1030
|
+
});
|
|
1031
|
+
}),
|
|
1032
|
+
exit: function exit() {
|
|
1033
|
+
return notImplemented("exit");
|
|
1034
|
+
},
|
|
1035
|
+
fileExists: audit("fileExists", function(fileName) {
|
|
1036
|
+
return files.has(fileName) || files.has(libize(fileName));
|
|
1037
|
+
}),
|
|
1038
|
+
getCurrentDirectory: function getCurrentDirectory() {
|
|
1039
|
+
return "/";
|
|
1040
|
+
},
|
|
1041
|
+
getDirectories: function getDirectories() {
|
|
1042
|
+
return [];
|
|
1043
|
+
},
|
|
1044
|
+
getExecutingFilePath: function getExecutingFilePath() {
|
|
1045
|
+
return notImplemented("getExecutingFilePath");
|
|
1046
|
+
},
|
|
1047
|
+
readDirectory: audit("readDirectory", function(directory) {
|
|
1048
|
+
return directory === "/" ? Array.from(files.keys()) : [];
|
|
1049
|
+
}),
|
|
1050
|
+
readFile: audit("readFile", function(fileName) {
|
|
1051
|
+
var _files$get;
|
|
1052
|
+
return (_files$get = files.get(fileName)) != null ? _files$get : files.get(libize(fileName));
|
|
1053
|
+
}),
|
|
1054
|
+
resolvePath: function resolvePath(path) {
|
|
1055
|
+
return path;
|
|
1056
|
+
},
|
|
1057
|
+
newLine: "\n",
|
|
1058
|
+
useCaseSensitiveFileNames: true,
|
|
1059
|
+
write: function write() {
|
|
1060
|
+
return notImplemented("write");
|
|
1061
|
+
},
|
|
1062
|
+
writeFile: function writeFile(fileName, contents) {
|
|
1063
|
+
files.set(fileName, contents);
|
|
1064
|
+
},
|
|
1065
|
+
deleteFile: function deleteFile(fileName) {
|
|
1066
|
+
files["delete"](fileName);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Creates a file-system backed System object which can be used in a TypeScript program, you provide
|
|
1072
|
+
* a set of virtual files which are prioritised over the FS versions, then a path to the root of your
|
|
1073
|
+
* project (basically the folder your node_modules lives)
|
|
1074
|
+
*/
|
|
1075
|
+
function createFSBackedSystem(files, _projectRoot, ts, tsLibDirectory) {
|
|
1076
|
+
var root = _projectRoot + "/vfs";
|
|
1077
|
+
var path = requirePath();
|
|
1078
|
+
var nodeSys = ts.sys;
|
|
1079
|
+
var tsLib = tsLibDirectory != null ? tsLibDirectory : path.dirname(__require.resolve("typescript"));
|
|
1080
|
+
return {
|
|
1081
|
+
name: "fs-vfs",
|
|
1082
|
+
root,
|
|
1083
|
+
args: [],
|
|
1084
|
+
createDirectory: function createDirectory() {
|
|
1085
|
+
return notImplemented("createDirectory");
|
|
1086
|
+
},
|
|
1087
|
+
directoryExists: audit("directoryExists", function(directory) {
|
|
1088
|
+
return Array.from(files.keys()).some(function(path) {
|
|
1089
|
+
return path.startsWith(directory);
|
|
1090
|
+
}) || nodeSys.directoryExists(directory);
|
|
1091
|
+
}),
|
|
1092
|
+
exit: nodeSys.exit,
|
|
1093
|
+
fileExists: audit("fileExists", function(fileName) {
|
|
1094
|
+
if (files.has(fileName)) return true;
|
|
1095
|
+
if (fileName.includes("tsconfig.json") || fileName.includes("tsconfig.json")) return false;
|
|
1096
|
+
if (fileName.startsWith("/lib")) {
|
|
1097
|
+
var tsLibName = tsLib + "/" + fileName.replace("/", "");
|
|
1098
|
+
return nodeSys.fileExists(tsLibName);
|
|
1099
|
+
}
|
|
1100
|
+
return nodeSys.fileExists(fileName);
|
|
1101
|
+
}),
|
|
1102
|
+
getCurrentDirectory: function getCurrentDirectory() {
|
|
1103
|
+
return root;
|
|
1104
|
+
},
|
|
1105
|
+
getDirectories: nodeSys.getDirectories,
|
|
1106
|
+
getExecutingFilePath: function getExecutingFilePath() {
|
|
1107
|
+
return notImplemented("getExecutingFilePath");
|
|
1108
|
+
},
|
|
1109
|
+
readDirectory: audit("readDirectory", function() {
|
|
1110
|
+
if ((arguments.length <= 0 ? void 0 : arguments[0]) === "/") return Array.from(files.keys());
|
|
1111
|
+
else return nodeSys.readDirectory.apply(nodeSys, arguments);
|
|
1112
|
+
}),
|
|
1113
|
+
readFile: audit("readFile", function(fileName) {
|
|
1114
|
+
if (files.has(fileName)) return files.get(fileName);
|
|
1115
|
+
if (fileName.startsWith("/lib")) {
|
|
1116
|
+
var tsLibName = tsLib + "/" + fileName.replace("/", "");
|
|
1117
|
+
var result = nodeSys.readFile(tsLibName);
|
|
1118
|
+
if (!result) {
|
|
1119
|
+
var libs = nodeSys.readDirectory(tsLib);
|
|
1120
|
+
throw new Error("TSVFS: A request was made for " + tsLibName + " but there wasn't a file found in the file map. You likely have a mismatch in the compiler options for the CDN download vs the compiler program. Existing Libs: " + libs + ".");
|
|
1121
|
+
}
|
|
1122
|
+
return result;
|
|
1123
|
+
}
|
|
1124
|
+
return nodeSys.readFile(fileName);
|
|
1125
|
+
}),
|
|
1126
|
+
resolvePath: function resolvePath(path) {
|
|
1127
|
+
if (files.has(path)) return path;
|
|
1128
|
+
return nodeSys.resolvePath(path);
|
|
1129
|
+
},
|
|
1130
|
+
newLine: "\n",
|
|
1131
|
+
useCaseSensitiveFileNames: true,
|
|
1132
|
+
write: function write() {
|
|
1133
|
+
return notImplemented("write");
|
|
1134
|
+
},
|
|
1135
|
+
writeFile: function writeFile(fileName, contents) {
|
|
1136
|
+
files.set(fileName, contents);
|
|
1137
|
+
},
|
|
1138
|
+
deleteFile: function deleteFile(fileName) {
|
|
1139
|
+
files["delete"](fileName);
|
|
1140
|
+
},
|
|
1141
|
+
realpath: nodeSys.realpath
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Creates an in-memory CompilerHost -which is essentially an extra wrapper to System
|
|
1146
|
+
* which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile
|
|
1147
|
+
* instances to the in-memory file system.
|
|
1148
|
+
*/
|
|
1149
|
+
function createVirtualCompilerHost(sys, compilerOptions, ts) {
|
|
1150
|
+
var sourceFiles = /* @__PURE__ */ new Map();
|
|
1151
|
+
var save = function save(sourceFile) {
|
|
1152
|
+
sourceFiles.set(sourceFile.fileName, sourceFile);
|
|
1153
|
+
return sourceFile;
|
|
1154
|
+
};
|
|
1155
|
+
return {
|
|
1156
|
+
compilerHost: _extends({}, sys, {
|
|
1157
|
+
getCanonicalFileName: function getCanonicalFileName(fileName) {
|
|
1158
|
+
return fileName;
|
|
1159
|
+
},
|
|
1160
|
+
getDefaultLibFileName: function getDefaultLibFileName() {
|
|
1161
|
+
return "/" + ts.getDefaultLibFileName(compilerOptions);
|
|
1162
|
+
},
|
|
1163
|
+
getNewLine: function getNewLine() {
|
|
1164
|
+
return sys.newLine;
|
|
1165
|
+
},
|
|
1166
|
+
getSourceFile: function getSourceFile(fileName, languageVersionOrOptions) {
|
|
1167
|
+
var _ref;
|
|
1168
|
+
return sourceFiles.get(fileName) || save(ts.createSourceFile(fileName, sys.readFile(fileName), (_ref = languageVersionOrOptions != null ? languageVersionOrOptions : compilerOptions.target) != null ? _ref : defaultCompilerOptions(ts).target, false));
|
|
1169
|
+
},
|
|
1170
|
+
useCaseSensitiveFileNames: function useCaseSensitiveFileNames() {
|
|
1171
|
+
return sys.useCaseSensitiveFileNames;
|
|
1172
|
+
}
|
|
1173
|
+
}),
|
|
1174
|
+
updateFile: function updateFile(sourceFile) {
|
|
1175
|
+
var alreadyExists = sourceFiles.has(sourceFile.fileName);
|
|
1176
|
+
sys.writeFile(sourceFile.fileName, sourceFile.text);
|
|
1177
|
+
sourceFiles.set(sourceFile.fileName, sourceFile);
|
|
1178
|
+
return alreadyExists;
|
|
1179
|
+
},
|
|
1180
|
+
deleteFile: function deleteFile(sourceFile) {
|
|
1181
|
+
var alreadyExists = sourceFiles.has(sourceFile.fileName);
|
|
1182
|
+
sourceFiles["delete"](sourceFile.fileName);
|
|
1183
|
+
sys.deleteFile(sourceFile.fileName);
|
|
1184
|
+
return alreadyExists;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Creates an object which can host a language service against the virtual file-system
|
|
1190
|
+
*/
|
|
1191
|
+
function createVirtualLanguageServiceHost(sys, rootFiles, compilerOptions, ts, customTransformers) {
|
|
1192
|
+
var fileNames = [].concat(rootFiles);
|
|
1193
|
+
var _createVirtualCompile = createVirtualCompilerHost(sys, compilerOptions, ts), compilerHost = _createVirtualCompile.compilerHost, _updateFile2 = _createVirtualCompile.updateFile, _deleteFile2 = _createVirtualCompile.deleteFile;
|
|
1194
|
+
var fileVersions = /* @__PURE__ */ new Map();
|
|
1195
|
+
var projectVersion = 0;
|
|
1196
|
+
return {
|
|
1197
|
+
languageServiceHost: _extends({}, compilerHost, {
|
|
1198
|
+
getProjectVersion: function getProjectVersion() {
|
|
1199
|
+
return projectVersion.toString();
|
|
1200
|
+
},
|
|
1201
|
+
getCompilationSettings: function getCompilationSettings() {
|
|
1202
|
+
return compilerOptions;
|
|
1203
|
+
},
|
|
1204
|
+
getCustomTransformers: function getCustomTransformers() {
|
|
1205
|
+
return customTransformers;
|
|
1206
|
+
},
|
|
1207
|
+
getScriptFileNames: function getScriptFileNames() {
|
|
1208
|
+
return fileNames.slice();
|
|
1209
|
+
},
|
|
1210
|
+
getScriptSnapshot: function getScriptSnapshot(fileName) {
|
|
1211
|
+
var contents = sys.readFile(fileName);
|
|
1212
|
+
if (contents && typeof contents === "string") return ts.ScriptSnapshot.fromString(contents);
|
|
1213
|
+
},
|
|
1214
|
+
getScriptVersion: function getScriptVersion(fileName) {
|
|
1215
|
+
return fileVersions.get(fileName) || "0";
|
|
1216
|
+
},
|
|
1217
|
+
writeFile: sys.writeFile
|
|
1218
|
+
}),
|
|
1219
|
+
updateFile: function updateFile(sourceFile) {
|
|
1220
|
+
projectVersion++;
|
|
1221
|
+
fileVersions.set(sourceFile.fileName, projectVersion.toString());
|
|
1222
|
+
if (!fileNames.includes(sourceFile.fileName)) fileNames.push(sourceFile.fileName);
|
|
1223
|
+
_updateFile2(sourceFile);
|
|
1224
|
+
},
|
|
1225
|
+
deleteFile: function deleteFile(sourceFile) {
|
|
1226
|
+
projectVersion++;
|
|
1227
|
+
fileVersions.set(sourceFile.fileName, projectVersion.toString());
|
|
1228
|
+
var index = fileNames.indexOf(sourceFile.fileName);
|
|
1229
|
+
if (index !== -1) fileNames.splice(index, 1);
|
|
1230
|
+
_deleteFile2(sourceFile);
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
var requirePath = function requirePath() {
|
|
1235
|
+
return __require(String.fromCharCode(112, 97, 116, 104));
|
|
1236
|
+
};
|
|
1237
|
+
var requireFS = function requireFS() {
|
|
1238
|
+
return __require(String.fromCharCode(102, 115));
|
|
1239
|
+
};
|
|
1240
|
+
exports.addAllFilesFromFolder = addAllFilesFromFolder;
|
|
1241
|
+
exports.addFilesForTypesIntoFolder = addFilesForTypesIntoFolder;
|
|
1242
|
+
exports.createDefaultMapFromCDN = createDefaultMapFromCDN;
|
|
1243
|
+
exports.createDefaultMapFromNodeModules = createDefaultMapFromNodeModules;
|
|
1244
|
+
exports.createFSBackedSystem = createFSBackedSystem;
|
|
1245
|
+
exports.createSystem = createSystem;
|
|
1246
|
+
exports.createVirtualCompilerHost = createVirtualCompilerHost;
|
|
1247
|
+
exports.createVirtualLanguageServiceHost = createVirtualLanguageServiceHost;
|
|
1248
|
+
exports.createVirtualTypeScriptEnvironment = createVirtualTypeScriptEnvironment;
|
|
1249
|
+
exports.knownLibFilesForCompilerOptions = knownLibFilesForCompilerOptions;
|
|
1250
|
+
}));
|
|
1251
|
+
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region ../../node_modules/.pnpm/@typescript+vfs@1.6.4_typescript@5.9.3/node_modules/@typescript/vfs/dist/index.js
|
|
1254
|
+
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1255
|
+
if (process.env.NODE_ENV === "production") module.exports = require_vfs_cjs_production_min();
|
|
1256
|
+
else module.exports = require_vfs_cjs_development();
|
|
1257
|
+
}));
|
|
1258
|
+
|
|
1259
|
+
//#endregion
|
|
1260
|
+
//#region ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=439aa6e683a9a48c3ebbf3529be5811680c45c22d6a265d_be73b50bc43bac944747b8ca0498113a/node_modules/@deepkit/type-compiler/dist/esm/src/compiler.js
|
|
1261
|
+
var import_dist = require_dist();
|
|
1262
|
+
const { visitEachChild, visitNode, isPropertyAssignment, isArrayTypeNode, isArrowFunction, isBlock, isCallExpression, isCallSignatureDeclaration, isClassDeclaration, isClassExpression, isConstructorDeclaration, isConstructorTypeNode, isConstructSignatureDeclaration, isEnumDeclaration, isExportDeclaration, isExpression, isExpressionWithTypeArguments, isFunctionDeclaration, isFunctionExpression, isFunctionLike, isIdentifier, isImportClause, isImportDeclaration, isImportSpecifier, isInferTypeNode, isInterfaceDeclaration, isMethodDeclaration, isMethodSignature, isModuleDeclaration, isNamedExports, isNamedTupleMember, isNewExpression, isObjectLiteralExpression, isOptionalTypeNode, isParameter, isParenthesizedExpression, isParenthesizedTypeNode, isPropertyAccessExpression, isQualifiedName, isSourceFile, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeParameterDeclaration, isTypeQueryNode, isTypeReferenceNode, isUnionTypeNode, isExpressionStatement, isVariableDeclaration, getEffectiveConstraintOfTypeParameter, addSyntheticLeadingComment, createCompilerHost, createPrinter, escapeLeadingUnderscores, EmitHint, NodeFlags, SyntaxKind, ScriptTarget, ModifierFlags, ScriptKind } = ts;
|
|
1263
|
+
const packSizeByte = 6;
|
|
1264
|
+
/**
|
|
1265
|
+
* It can't be more ops than this given number
|
|
1266
|
+
*/
|
|
1267
|
+
const packSize = 2 ** 6;
|
|
1268
|
+
const OPs = {
|
|
1269
|
+
[ReflectionOp.literal]: { params: 1 },
|
|
1270
|
+
[ReflectionOp.classReference]: { params: 1 },
|
|
1271
|
+
[ReflectionOp.propertySignature]: { params: 1 },
|
|
1272
|
+
[ReflectionOp.property]: { params: 1 },
|
|
1273
|
+
[ReflectionOp.jump]: { params: 1 },
|
|
1274
|
+
[ReflectionOp.enum]: { params: 0 },
|
|
1275
|
+
[ReflectionOp.enumMember]: { params: 1 },
|
|
1276
|
+
[ReflectionOp.typeParameter]: { params: 1 },
|
|
1277
|
+
[ReflectionOp.typeParameterDefault]: { params: 1 },
|
|
1278
|
+
[ReflectionOp.mappedType]: { params: 2 },
|
|
1279
|
+
[ReflectionOp.call]: { params: 1 },
|
|
1280
|
+
[ReflectionOp.inline]: { params: 1 },
|
|
1281
|
+
[ReflectionOp.inlineCall]: { params: 2 },
|
|
1282
|
+
[ReflectionOp.loads]: { params: 2 },
|
|
1283
|
+
[ReflectionOp.extends]: { params: 0 },
|
|
1284
|
+
[ReflectionOp.infer]: { params: 2 },
|
|
1285
|
+
[ReflectionOp.defaultValue]: { params: 1 },
|
|
1286
|
+
[ReflectionOp.parameter]: { params: 1 },
|
|
1287
|
+
[ReflectionOp.method]: { params: 1 },
|
|
1288
|
+
[ReflectionOp.function]: { params: 1 },
|
|
1289
|
+
[ReflectionOp.description]: { params: 1 },
|
|
1290
|
+
[ReflectionOp.numberBrand]: { params: 1 },
|
|
1291
|
+
[ReflectionOp.typeof]: { params: 1 },
|
|
1292
|
+
[ReflectionOp.classExtends]: { params: 1 },
|
|
1293
|
+
[ReflectionOp.distribute]: { params: 1 },
|
|
1294
|
+
[ReflectionOp.jumpCondition]: { params: 2 },
|
|
1295
|
+
[ReflectionOp.typeName]: { params: 1 },
|
|
1296
|
+
[ReflectionOp.implements]: { params: 1 },
|
|
1297
|
+
[ReflectionOp.tags]: { params: 1 }
|
|
1298
|
+
};
|
|
1299
|
+
var Cache = class {
|
|
1300
|
+
constructor() {
|
|
1301
|
+
this.resolver = {};
|
|
1302
|
+
this.sourceFiles = {};
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Signals the cache to check if it needs to be cleared.
|
|
1306
|
+
*/
|
|
1307
|
+
tick() {
|
|
1308
|
+
if (Object.keys(this.sourceFiles).length > 300) this.sourceFiles = {};
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
const cache$1 = new Cache();
|
|
1312
|
+
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region src/transformer.ts
|
|
1315
|
+
let loaded = false;
|
|
1316
|
+
const cache = new Cache();
|
|
1317
|
+
/**
|
|
1318
|
+
* Creates a Deepkit TypeScript transformer.
|
|
1319
|
+
*
|
|
1320
|
+
* @param context - The Powerlines plugin context.
|
|
1321
|
+
* @param options - The transformation options.
|
|
1322
|
+
* @returns A Deepkit TypeScript custom transformer factory.
|
|
1323
|
+
*/
|
|
1324
|
+
function createTransformer(context, options = {}) {
|
|
1325
|
+
return function transformer(ctx) {
|
|
1326
|
+
if (!loaded) loaded = true;
|
|
1327
|
+
cache.tick();
|
|
1328
|
+
return new ReflectionTransformer(ctx, cache).withReflection(defu(options, {
|
|
1329
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
1330
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
1331
|
+
}, {
|
|
1332
|
+
exclude: [],
|
|
1333
|
+
reflection: "default",
|
|
1334
|
+
reflectionLevel: "normal"
|
|
1335
|
+
}));
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Creates a Deepkit TypeScript declaration transformer.
|
|
1340
|
+
*
|
|
1341
|
+
* @param context - The Powerlines plugin context.
|
|
1342
|
+
* @param options - The transformation options.
|
|
1343
|
+
* @returns A Deepkit TypeScript custom declaration transformer factory.
|
|
1344
|
+
*/
|
|
1345
|
+
function createDeclarationTransformer(context, options = {}) {
|
|
1346
|
+
return function declarationTransformer(ctx) {
|
|
1347
|
+
return new DeclarationTransformer(ctx, cache).withReflection(defu(options, {
|
|
1348
|
+
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
1349
|
+
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
1350
|
+
}, {
|
|
1351
|
+
exclude: [],
|
|
1352
|
+
reflection: "default",
|
|
1353
|
+
reflectionLevel: "normal"
|
|
1354
|
+
}));
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
//#endregion
|
|
1359
|
+
export { createTransformer as n, createDeclarationTransformer as t };
|
|
1360
|
+
//# sourceMappingURL=transformer-BiefehPu.mjs.map
|