@powerlines/deepkit 0.5.0 → 0.5.1
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/capnp.cjs +48 -47
- package/dist/capnp.js +3 -2
- package/dist/{chunk-TVDEXHJN.js → chunk-4V4LIAN2.js} +8 -9
- package/dist/chunk-7J3ZDT6O.cjs +30 -0
- package/dist/{chunk-U4JSDAXK.js → chunk-B6GTAZEL.js} +8 -7
- package/dist/{chunk-KYFUOGZ6.cjs → chunk-ESVH44QW.cjs} +9 -10
- package/dist/chunk-FFBZWTR7.cjs +63 -0
- package/dist/chunk-GRNJVY7I.cjs +19 -0
- package/dist/{chunk-DGXATHAN.js → chunk-I5CVIT7W.js} +41 -46
- package/dist/chunk-IRPJW6HH.js +16 -0
- package/dist/{chunk-SKYW5GV2.cjs → chunk-J2FVIV7W.cjs} +127 -132
- package/dist/chunk-J4SVRFV4.js +127 -0
- package/dist/{chunk-FEBG7WWO.js → chunk-MEMIQ5AA.js} +1 -3
- package/dist/chunk-ORA4UQMU.cjs +2 -0
- package/dist/chunk-OULCUN6I.js +1 -0
- package/dist/chunk-PKLLVKY2.cjs +193 -0
- package/dist/chunk-QLKLDV3V.cjs +135 -0
- package/dist/chunk-U5O6DHJ2.js +187 -0
- package/dist/{chunk-JHEBLHYK.cjs → chunk-VMRRVNO2.cjs} +2 -4
- package/dist/{chunk-55HOZO7D.cjs → chunk-VWKKT7CM.cjs} +5 -7
- package/dist/chunk-XGQQM64U.js +8 -0
- package/dist/{chunk-BTXPY3B4.js → chunk-YQQIT5YX.js} +2 -4
- package/dist/esbuild-plugin.cjs +5 -5
- package/dist/esbuild-plugin.d.cts +3 -2
- package/dist/esbuild-plugin.d.ts +3 -2
- package/dist/esbuild-plugin.js +4 -4
- package/dist/index.cjs +69 -69
- package/dist/index.js +10 -12
- package/dist/reflect-type.cjs +7 -6
- package/dist/reflect-type.js +6 -5
- package/dist/resolve-reflections.cjs +3 -3
- package/dist/resolve-reflections.js +2 -2
- package/dist/transformer.cjs +4 -4
- package/dist/transformer.js +2 -2
- package/dist/transpile.cjs +4 -4
- package/dist/transpile.js +3 -3
- package/dist/types.cjs +1 -2
- package/dist/types.js +1 -2
- package/dist/utilities.cjs +10 -9
- package/dist/utilities.js +3 -2
- package/dist/{chunk-YKFG2BZQ.cjs → vendor/chunk-5NPGWGPO.cjs} +0 -6
- package/dist/vendor/{chunk-BLN7QVCP.js → chunk-7LAB3COT.js} +7 -154
- package/dist/vendor/chunk-IOMA7ABE.js +359 -0
- package/dist/vendor/chunk-K5KCTNDL.cjs +2678 -0
- package/dist/vendor/chunk-L3KIZV6P.js +2664 -0
- package/dist/vendor/chunk-M3FJ3QXG.cjs +377 -0
- package/dist/vendor/chunk-SHUYVCID.js +4 -0
- package/dist/vendor/chunk-USNT2KNT.cjs +6 -0
- package/dist/{chunk-4WJJKR53.js → vendor/chunk-ZDFKNN7Y.cjs} +281 -322
- package/dist/vendor/compiler.cjs +12 -13
- package/dist/vendor/compiler.js +2 -5
- package/dist/vendor/config.cjs +9 -10
- package/dist/vendor/config.js +1 -5
- package/dist/vendor/core.cjs +130 -131
- package/dist/vendor/core.js +2 -5
- package/dist/vendor/index.cjs +14 -22
- package/dist/vendor/index.js +3 -11
- package/dist/vendor/type-spec.cjs +5 -6
- package/dist/vendor/type-spec.js +2 -5
- package/dist/vendor/type.cjs +631 -758
- package/dist/vendor/type.js +15 -138
- package/package.json +4 -4
- package/dist/chunk-2V4ET57D.js +0 -6954
- package/dist/chunk-6ETLMANX.js +0 -3472
- package/dist/chunk-6IQVU53O.cjs +0 -24
- package/dist/chunk-6OXPIOZY.cjs +0 -43
- package/dist/chunk-7WAH4JD3.js +0 -115
- package/dist/chunk-B4PTD5KQ.js +0 -4
- package/dist/chunk-ITQKPDCW.cjs +0 -3859
- package/dist/chunk-LBHO5BRF.js +0 -2251
- package/dist/chunk-OYRIJX67.cjs +0 -3487
- package/dist/chunk-PANPZ6S6.cjs +0 -6
- package/dist/chunk-QPSZUUB6.cjs +0 -2259
- package/dist/chunk-QQ7GKXIS.js +0 -43
- package/dist/chunk-SA3DCC4M.cjs +0 -6968
- package/dist/chunk-WVKPC33H.cjs +0 -49
- package/dist/chunk-YUO4MCOI.js +0 -18
- package/dist/vendor/chunk-5BKT4CS5.js +0 -28
- package/dist/vendor/chunk-BDXVTHBY.cjs +0 -3859
- package/dist/vendor/chunk-EQXMWOHO.cjs +0 -115
- package/dist/vendor/chunk-MCNMRQDT.js +0 -3513
- package/dist/vendor/chunk-MO4O4UYI.cjs +0 -42
- package/dist/vendor/chunk-RH4YMONA.js +0 -7064
- package/dist/vendor/chunk-RZKB5IQZ.cjs +0 -3531
- package/dist/vendor/chunk-WOXMCJJU.cjs +0 -7078
- package/dist/vendor/type-compiler/compiler.cjs +0 -46
- package/dist/vendor/type-compiler/compiler.d.cts +0 -1
- package/dist/vendor/type-compiler/compiler.d.ts +0 -1
- package/dist/vendor/type-compiler/compiler.js +0 -7
- package/dist/vendor/type-compiler/config.cjs +0 -36
- package/dist/vendor/type-compiler/config.d.cts +0 -6
- package/dist/vendor/type-compiler/config.d.ts +0 -6
- package/dist/vendor/type-compiler/config.js +0 -5
- package/dist/vendor/type-compiler/index.cjs +0 -108
- package/dist/vendor/type-compiler/index.d.cts +0 -1
- package/dist/vendor/type-compiler/index.d.ts +0 -1
- package/dist/vendor/type-compiler/index.js +0 -67
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkWVKPC33H_cjs = require('./chunk-WVKPC33H.cjs');
|
|
4
|
-
|
|
5
3
|
// ../../node_modules/.pnpm/@deepkit+type-spec@1.0.1_patch_hash=f3c3a4fd486751022d78f17d39a5a79f493bca20b185964ca1aba41fbfc93244/node_modules/@deepkit/type-spec/dist/esm/src/type.js
|
|
6
|
-
chunkWVKPC33H_cjs.init_cjs_shims();
|
|
7
4
|
exports.TypeNumberBrand = void 0;
|
|
8
5
|
(function(TypeNumberBrand2) {
|
|
9
6
|
TypeNumberBrand2[TypeNumberBrand2["integer"] = 0] = "integer";
|
|
@@ -110,6 +107,3 @@ exports.ReflectionOp = void 0;
|
|
|
110
107
|
ReflectionOp2[ReflectionOp2["nominal"] = 88] = "nominal";
|
|
111
108
|
ReflectionOp2[ReflectionOp2["tags"] = 89] = "tags";
|
|
112
109
|
})(exports.ReflectionOp || (exports.ReflectionOp = {}));
|
|
113
|
-
|
|
114
|
-
// ../../node_modules/.pnpm/@deepkit+type-spec@1.0.1_patch_hash=f3c3a4fd486751022d78f17d39a5a79f493bca20b185964ca1aba41fbfc93244/node_modules/@deepkit/type-spec/dist/esm/index.js
|
|
115
|
-
chunkWVKPC33H_cjs.init_cjs_shims();
|
|
@@ -1,147 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var require_is_obj = __commonJS({
|
|
5
|
-
"../../node_modules/.pnpm/is-obj@2.0.0/node_modules/is-obj/index.js"(exports$1, module) {
|
|
6
|
-
module.exports = (value) => {
|
|
7
|
-
const type = typeof value;
|
|
8
|
-
return value !== null && (type === "object" || type === "function");
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// ../../node_modules/.pnpm/dot-prop@5.3.0/node_modules/dot-prop/index.js
|
|
14
|
-
var require_dot_prop = __commonJS({
|
|
15
|
-
"../../node_modules/.pnpm/dot-prop@5.3.0/node_modules/dot-prop/index.js"(exports$1, module) {
|
|
16
|
-
var isObj = require_is_obj();
|
|
17
|
-
var disallowedKeys = [
|
|
18
|
-
"__proto__",
|
|
19
|
-
"prototype",
|
|
20
|
-
"constructor"
|
|
21
|
-
];
|
|
22
|
-
var isValidPath = /* @__PURE__ */ __name((pathSegments) => !pathSegments.some((segment) => disallowedKeys.includes(segment)), "isValidPath");
|
|
23
|
-
function getPathSegments(path) {
|
|
24
|
-
const pathArray = path.split(".");
|
|
25
|
-
const parts = [];
|
|
26
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
27
|
-
let p = pathArray[i];
|
|
28
|
-
while (p[p.length - 1] === "\\" && pathArray[i + 1] !== void 0) {
|
|
29
|
-
p = p.slice(0, -1) + ".";
|
|
30
|
-
p += pathArray[++i];
|
|
31
|
-
}
|
|
32
|
-
parts.push(p);
|
|
33
|
-
}
|
|
34
|
-
if (!isValidPath(parts)) {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
return parts;
|
|
38
|
-
}
|
|
39
|
-
__name(getPathSegments, "getPathSegments");
|
|
40
|
-
module.exports = {
|
|
41
|
-
get(object, path, value) {
|
|
42
|
-
if (!isObj(object) || typeof path !== "string") {
|
|
43
|
-
return value === void 0 ? object : value;
|
|
44
|
-
}
|
|
45
|
-
const pathArray = getPathSegments(path);
|
|
46
|
-
if (pathArray.length === 0) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
50
|
-
if (!Object.prototype.propertyIsEnumerable.call(object, pathArray[i])) {
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
object = object[pathArray[i]];
|
|
54
|
-
if (object === void 0 || object === null) {
|
|
55
|
-
if (i !== pathArray.length - 1) {
|
|
56
|
-
return value;
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return object;
|
|
62
|
-
},
|
|
63
|
-
set(object, path, value) {
|
|
64
|
-
if (!isObj(object) || typeof path !== "string") {
|
|
65
|
-
return object;
|
|
66
|
-
}
|
|
67
|
-
const root = object;
|
|
68
|
-
const pathArray = getPathSegments(path);
|
|
69
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
70
|
-
const p = pathArray[i];
|
|
71
|
-
if (!isObj(object[p])) {
|
|
72
|
-
object[p] = {};
|
|
73
|
-
}
|
|
74
|
-
if (i === pathArray.length - 1) {
|
|
75
|
-
object[p] = value;
|
|
76
|
-
}
|
|
77
|
-
object = object[p];
|
|
78
|
-
}
|
|
79
|
-
return root;
|
|
80
|
-
},
|
|
81
|
-
delete(object, path) {
|
|
82
|
-
if (!isObj(object) || typeof path !== "string") {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
const pathArray = getPathSegments(path);
|
|
86
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
87
|
-
const p = pathArray[i];
|
|
88
|
-
if (i === pathArray.length - 1) {
|
|
89
|
-
delete object[p];
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
object = object[p];
|
|
93
|
-
if (!isObj(object)) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
has(object, path) {
|
|
99
|
-
if (!isObj(object) || typeof path !== "string") {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
const pathArray = getPathSegments(path);
|
|
103
|
-
if (pathArray.length === 0) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
107
|
-
if (isObj(object)) {
|
|
108
|
-
if (!(pathArray[i] in object)) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
object = object[pathArray[i]];
|
|
112
|
-
} else {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// ../../node_modules/.pnpm/to-fast-properties@3.0.1/node_modules/to-fast-properties/index.js
|
|
123
|
-
var require_to_fast_properties = __commonJS({
|
|
124
|
-
"../../node_modules/.pnpm/to-fast-properties@3.0.1/node_modules/to-fast-properties/index.js"(exports$1, module) {
|
|
125
|
-
var fastProto = null;
|
|
126
|
-
function FastObject(o) {
|
|
127
|
-
if (fastProto !== null && typeof fastProto.property) {
|
|
128
|
-
const result = fastProto;
|
|
129
|
-
fastProto = FastObject.prototype = null;
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
fastProto = FastObject.prototype = o == null ? /* @__PURE__ */ Object.create(null) : o;
|
|
133
|
-
return new FastObject();
|
|
134
|
-
}
|
|
135
|
-
__name(FastObject, "FastObject");
|
|
136
|
-
var inlineCacheCutoff = 10;
|
|
137
|
-
for (let i = 0; i <= inlineCacheCutoff; i++) {
|
|
138
|
-
FastObject();
|
|
139
|
-
}
|
|
140
|
-
module.exports = /* @__PURE__ */ __name(function toFastproperties(o) {
|
|
141
|
-
return FastObject(o);
|
|
142
|
-
}, "toFastproperties");
|
|
143
|
-
}
|
|
144
|
-
});
|
|
1
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
+
import dotProp from 'dot-prop';
|
|
3
|
+
import toFastPropertiesOri from 'to-fast-properties';
|
|
145
4
|
|
|
146
5
|
// ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/iterators.js
|
|
147
6
|
var __\u03A9ArrayLike = [
|
|
@@ -295,9 +154,6 @@ eachPair.__type = [
|
|
|
295
154
|
"eachPair",
|
|
296
155
|
`PPP&"LM"o!"J2"PP&"GP'"GJo#"/$`
|
|
297
156
|
];
|
|
298
|
-
|
|
299
|
-
// ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/core.js
|
|
300
|
-
var import_dot_prop = __toESM(require_dot_prop(), 1);
|
|
301
157
|
var __\u03A9Object = [
|
|
302
158
|
() => Function,
|
|
303
159
|
"constructor",
|
|
@@ -1016,7 +872,7 @@ function getPathValue(bag, parameterPath, defaultValue) {
|
|
|
1016
872
|
if (isSet(bag[parameterPath])) {
|
|
1017
873
|
return bag[parameterPath];
|
|
1018
874
|
}
|
|
1019
|
-
const result =
|
|
875
|
+
const result = dotProp.get(bag, parameterPath);
|
|
1020
876
|
return isSet(result) ? result : defaultValue;
|
|
1021
877
|
}
|
|
1022
878
|
__name(getPathValue, "getPathValue");
|
|
@@ -1028,7 +884,7 @@ getPathValue.__type = [
|
|
|
1028
884
|
'PP&"LM2!&2""2#8"/$'
|
|
1029
885
|
];
|
|
1030
886
|
function setPathValue(bag, parameterPath, value) {
|
|
1031
|
-
|
|
887
|
+
dotProp.set(bag, parameterPath, value);
|
|
1032
888
|
}
|
|
1033
889
|
__name(setPathValue, "setPathValue");
|
|
1034
890
|
setPathValue.__type = [
|
|
@@ -1039,7 +895,7 @@ setPathValue.__type = [
|
|
|
1039
895
|
'P%2!&2""2#"/$'
|
|
1040
896
|
];
|
|
1041
897
|
function deletePathValue(bag, parameterPath) {
|
|
1042
|
-
|
|
898
|
+
dotProp.delete(bag, parameterPath);
|
|
1043
899
|
}
|
|
1044
900
|
__name(deletePathValue, "deletePathValue");
|
|
1045
901
|
deletePathValue.__type = [
|
|
@@ -1373,11 +1229,8 @@ assertDefined.__type = [
|
|
|
1373
1229
|
"assertDefined",
|
|
1374
1230
|
'P"2!!/"'
|
|
1375
1231
|
];
|
|
1376
|
-
|
|
1377
|
-
// ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/esm/src/perf.js
|
|
1378
|
-
var import_to_fast_properties = __toESM(require_to_fast_properties(), 1);
|
|
1379
1232
|
function toFastProperties(obj) {
|
|
1380
|
-
(
|
|
1233
|
+
toFastPropertiesOri(obj);
|
|
1381
1234
|
}
|
|
1382
1235
|
__name(toFastProperties, "toFastProperties");
|
|
1383
1236
|
toFastProperties.__type = [
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { dirname, join, isAbsolute } from 'path';
|
|
2
|
+
import ts2 from 'typescript';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import micromatch from 'micromatch';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/src/debug.js
|
|
16
|
+
function isDebug(level = 1) {
|
|
17
|
+
const expected = "deepkit" + (level > 1 ? "+".repeat(level - 1) : "");
|
|
18
|
+
return "undefined" !== typeof process && "string" === typeof process.env.DEBUG && process.env.DEBUG.includes(expected);
|
|
19
|
+
}
|
|
20
|
+
__name(isDebug, "isDebug");
|
|
21
|
+
function debug(...message) {
|
|
22
|
+
if (isDebug(1)) {
|
|
23
|
+
console.debug(...message);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
__name(debug, "debug");
|
|
27
|
+
function debug2(...message) {
|
|
28
|
+
if (isDebug(2)) {
|
|
29
|
+
console.debug(...message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
__name(debug2, "debug2");
|
|
33
|
+
var { createSourceFile, resolveModuleName, isStringLiteral, JSDocParsingMode, ScriptTarget } = ts2;
|
|
34
|
+
function patternMatch(path, patterns, base) {
|
|
35
|
+
const include = patterns.filter((pattern) => pattern[0] !== "!");
|
|
36
|
+
const exclude = patterns.filter((pattern) => pattern[0] === "!").map((pattern) => pattern.substring(1));
|
|
37
|
+
return micromatch.isMatch(path, include, {
|
|
38
|
+
ignore: exclude
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
__name(patternMatch, "patternMatch");
|
|
42
|
+
var Resolver = class {
|
|
43
|
+
static {
|
|
44
|
+
__name(this, "Resolver");
|
|
45
|
+
}
|
|
46
|
+
constructor(compilerOptions, host, sourceFiles) {
|
|
47
|
+
this.compilerOptions = compilerOptions;
|
|
48
|
+
this.host = host;
|
|
49
|
+
this.sourceFiles = sourceFiles;
|
|
50
|
+
}
|
|
51
|
+
resolve(from, importOrExportNode) {
|
|
52
|
+
const moduleSpecifier = importOrExportNode.moduleSpecifier;
|
|
53
|
+
if (!moduleSpecifier) return;
|
|
54
|
+
if (!isStringLiteral(moduleSpecifier)) return;
|
|
55
|
+
return this.resolveSourceFile(from, moduleSpecifier);
|
|
56
|
+
}
|
|
57
|
+
resolveImpl(modulePath, sourceFile) {
|
|
58
|
+
if (this.host.resolveModuleNameLiterals !== void 0) {
|
|
59
|
+
const results = this.host.resolveModuleNameLiterals(
|
|
60
|
+
[
|
|
61
|
+
modulePath
|
|
62
|
+
],
|
|
63
|
+
sourceFile.fileName,
|
|
64
|
+
/*reusedNames*/
|
|
65
|
+
void 0,
|
|
66
|
+
this.compilerOptions,
|
|
67
|
+
sourceFile,
|
|
68
|
+
void 0
|
|
69
|
+
);
|
|
70
|
+
if (results[0]) return results[0].resolvedModule;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (this.host.resolveModuleNames !== void 0) {
|
|
74
|
+
return this.host.resolveModuleNames(
|
|
75
|
+
[
|
|
76
|
+
modulePath.text
|
|
77
|
+
],
|
|
78
|
+
sourceFile.fileName,
|
|
79
|
+
/*reusedNames*/
|
|
80
|
+
void 0,
|
|
81
|
+
/*redirectedReference*/
|
|
82
|
+
void 0,
|
|
83
|
+
this.compilerOptions
|
|
84
|
+
)[0];
|
|
85
|
+
}
|
|
86
|
+
const result = resolveModuleName(modulePath.text, sourceFile.fileName, this.compilerOptions, this.host);
|
|
87
|
+
return result.resolvedModule;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Tries to resolve the .ts/d.ts file path for a given module path.
|
|
91
|
+
* Scans relative paths. Looks into package.json "types" and "exports" (with new 4.7 support)
|
|
92
|
+
*
|
|
93
|
+
* @param sourceFile the SourceFile of the file that contains the import. modulePath is relative to that.
|
|
94
|
+
* @param modulePath the x in 'from x'.
|
|
95
|
+
*/
|
|
96
|
+
resolveSourceFile(sourceFile, modulePath) {
|
|
97
|
+
const result = this.resolveImpl(modulePath, sourceFile);
|
|
98
|
+
if (!result) return;
|
|
99
|
+
if (!result.resolvedFileName.endsWith(".ts") && !result.resolvedFileName.endsWith(".tsx") && !result.resolvedFileName.endsWith(".d.ts")) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const fileName = result.resolvedFileName;
|
|
103
|
+
if (this.sourceFiles[fileName]) return this.sourceFiles[fileName];
|
|
104
|
+
const source = this.host.readFile(result.resolvedFileName);
|
|
105
|
+
if (!source) return;
|
|
106
|
+
const moduleSourceFile = this.sourceFiles[fileName] = createSourceFile(fileName, source, {
|
|
107
|
+
languageVersion: this.compilerOptions.target || ScriptTarget.ES2018,
|
|
108
|
+
// JSDocParsingMode is not available in TS < 5.3
|
|
109
|
+
jsDocParsingMode: JSDocParsingMode ? JSDocParsingMode.ParseNone : void 0
|
|
110
|
+
}, true);
|
|
111
|
+
this.sourceFiles[fileName] = moduleSourceFile;
|
|
112
|
+
ts2.bindSourceFile(moduleSourceFile, this.compilerOptions);
|
|
113
|
+
return moduleSourceFile;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/src/config.js
|
|
118
|
+
var reflectionModes = [
|
|
119
|
+
"default",
|
|
120
|
+
"explicit",
|
|
121
|
+
"never"
|
|
122
|
+
];
|
|
123
|
+
function isObject(obj) {
|
|
124
|
+
if (!obj) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return typeof obj === "object" && !Array.isArray(obj);
|
|
128
|
+
}
|
|
129
|
+
__name(isObject, "isObject");
|
|
130
|
+
var defaultMergeStrategy = "merge";
|
|
131
|
+
var reflectionLevel = [
|
|
132
|
+
"minimal",
|
|
133
|
+
"normal",
|
|
134
|
+
"verbose"
|
|
135
|
+
];
|
|
136
|
+
function readTsConfig(parseConfigHost, path) {
|
|
137
|
+
const configFile = ts2.readConfigFile(path, (path2) => parseConfigHost.readFile(path2));
|
|
138
|
+
if (configFile.error) {
|
|
139
|
+
debug(`Failed to read tsconfig ${path}: ${configFile.error.messageText}`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const parsed = ts2.parseJsonConfigFileContent(configFile.config, parseConfigHost, dirname(path));
|
|
143
|
+
const ignoredErrors = [
|
|
144
|
+
18003
|
|
145
|
+
// No inputs were found in config file.
|
|
146
|
+
];
|
|
147
|
+
const softErrors = [
|
|
148
|
+
18e3
|
|
149
|
+
// Circularity detected while resolving configuration
|
|
150
|
+
];
|
|
151
|
+
const errors = parsed.errors.filter((v) => !ignoredErrors.includes(v.code));
|
|
152
|
+
if (errors.length) {
|
|
153
|
+
debug(`Failed to parse tsconfig ${path}: ${parsed.errors.map((v) => v.messageText).join(", ")}`);
|
|
154
|
+
}
|
|
155
|
+
const hardErrors = errors.filter((v) => !softErrors.includes(v.code));
|
|
156
|
+
if (hardErrors.length) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const json = readFileSync(path, "utf8");
|
|
160
|
+
const tsconfig = JSON.parse(json);
|
|
161
|
+
return Object.assign(configFile.config, {
|
|
162
|
+
compilerOptions: parsed.options,
|
|
163
|
+
reflectionLevel: tsconfig.reflectionLevel ? String(tsconfig.reflectionLevel) : void 0
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
__name(readTsConfig, "readTsConfig");
|
|
167
|
+
function reflectionModeMatcher(config, filePath) {
|
|
168
|
+
if (Array.isArray(config.exclude)) {
|
|
169
|
+
if (patternMatch(filePath, config.exclude)) return "never";
|
|
170
|
+
}
|
|
171
|
+
if (Array.isArray(config.reflection)) {
|
|
172
|
+
return patternMatch(filePath, config.reflection) ? "default" : "never";
|
|
173
|
+
}
|
|
174
|
+
if (config.reflection === "default" || config.reflection === "explicit") return config.reflection;
|
|
175
|
+
return "never";
|
|
176
|
+
}
|
|
177
|
+
__name(reflectionModeMatcher, "reflectionModeMatcher");
|
|
178
|
+
function ensureStringArray(value) {
|
|
179
|
+
if (Array.isArray(value)) return value.map((v) => "" + v);
|
|
180
|
+
if ("string" === typeof value) return [
|
|
181
|
+
value
|
|
182
|
+
];
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
__name(ensureStringArray, "ensureStringArray");
|
|
186
|
+
function parseRawMode(mode) {
|
|
187
|
+
if ("boolean" === typeof mode) return mode ? "default" : "never";
|
|
188
|
+
if (mode === "default" || mode === "explicit") return mode;
|
|
189
|
+
return ensureStringArray(mode);
|
|
190
|
+
}
|
|
191
|
+
__name(parseRawMode, "parseRawMode");
|
|
192
|
+
function resolvePaths(baseDir, paths) {
|
|
193
|
+
if (!paths || !Array.isArray(paths)) return;
|
|
194
|
+
for (let i = 0; i < paths.length; i++) {
|
|
195
|
+
if ("string" !== typeof paths[i]) continue;
|
|
196
|
+
if (isAbsolute(paths[i])) continue;
|
|
197
|
+
let path = paths[i];
|
|
198
|
+
let exclude = false;
|
|
199
|
+
if (path.startsWith("!")) {
|
|
200
|
+
exclude = true;
|
|
201
|
+
path = path.substring(1);
|
|
202
|
+
}
|
|
203
|
+
if (path.startsWith("./") || path.includes("/")) {
|
|
204
|
+
path = join(baseDir, path);
|
|
205
|
+
}
|
|
206
|
+
path = path.replace(/\\/g, "/");
|
|
207
|
+
if (exclude) path = "!" + path;
|
|
208
|
+
paths[i] = path;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
__name(resolvePaths, "resolvePaths");
|
|
212
|
+
function appendPaths(strategy = defaultMergeStrategy, parent, existing) {
|
|
213
|
+
if (strategy === "replace") {
|
|
214
|
+
return [
|
|
215
|
+
...existing || parent
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
if (!existing) return [
|
|
219
|
+
...parent
|
|
220
|
+
];
|
|
221
|
+
return [
|
|
222
|
+
...parent,
|
|
223
|
+
...existing
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
__name(appendPaths, "appendPaths");
|
|
227
|
+
function applyConfigValues(existing, parent, baseDir) {
|
|
228
|
+
const parentReflection = isObject(parent.deepkitCompilerOptions) ? parent.deepkitCompilerOptions?.reflection : parent.reflection;
|
|
229
|
+
const parentReflectionLevel = parent.deepkitCompilerOptions?.reflectionLevel || parent.reflectionLevel || parent.compilerOptions?.reflectionLevel;
|
|
230
|
+
if (isObject(parent.deepkitCompilerOptions) && "undefined" === typeof existing.mergeStrategy) {
|
|
231
|
+
existing.mergeStrategy = parent.deepkitCompilerOptions.mergeStrategy;
|
|
232
|
+
}
|
|
233
|
+
if ("undefined" !== typeof parentReflection) {
|
|
234
|
+
const next = parseRawMode(parentReflection);
|
|
235
|
+
if ("undefined" === typeof existing.reflection) {
|
|
236
|
+
existing.reflection = next;
|
|
237
|
+
} else if ("string" === typeof existing.reflection) ; else if (Array.isArray(next) && Array.isArray(existing.reflection)) {
|
|
238
|
+
existing.reflection = appendPaths(existing.mergeStrategy, next, existing.reflection);
|
|
239
|
+
} else if ("string" === typeof next && Array.isArray(existing.reflection)) ;
|
|
240
|
+
}
|
|
241
|
+
if ("undefined" !== typeof parentReflectionLevel) {
|
|
242
|
+
if ("undefined" === typeof existing.reflectionLevel) {
|
|
243
|
+
existing.reflectionLevel = parentReflectionLevel;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (isObject(parent.deepkitCompilerOptions)) {
|
|
247
|
+
if (`undefined` !== typeof parent.deepkitCompilerOptions.exclude) {
|
|
248
|
+
const next = ensureStringArray(parent.deepkitCompilerOptions.exclude);
|
|
249
|
+
existing.exclude = appendPaths(existing.mergeStrategy, next, existing.exclude);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
resolvePaths(baseDir, existing.reflection);
|
|
253
|
+
resolvePaths(baseDir, existing.exclude);
|
|
254
|
+
if (parent.compilerOptions) {
|
|
255
|
+
if (Object.keys(existing.compilerOptions).length === 0) {
|
|
256
|
+
Object.assign(existing.compilerOptions, parent.compilerOptions);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
existing.extends = parent.extends;
|
|
260
|
+
}
|
|
261
|
+
__name(applyConfigValues, "applyConfigValues");
|
|
262
|
+
var defaultExcluded = [
|
|
263
|
+
"lib.dom*.d.ts",
|
|
264
|
+
"*typedarrays.d.ts",
|
|
265
|
+
"lib.webworker*.d.ts",
|
|
266
|
+
"lib.decorator*.d.ts",
|
|
267
|
+
"lib.es2015.proxy.d.ts",
|
|
268
|
+
"lib.es2020.sharedmemory.d.ts",
|
|
269
|
+
"lib.es2015.core.d.ts"
|
|
270
|
+
];
|
|
271
|
+
function getConfigResolver(cache, host, compilerOptions, sourceFile, tsConfigPath = "") {
|
|
272
|
+
let config = {
|
|
273
|
+
// We use the parameter `compilerOptions` only for compilerOptions.configFilePath.
|
|
274
|
+
// We load the compilerOptions manually since transformers don't get the full picture
|
|
275
|
+
// (path aliases are missing for example).
|
|
276
|
+
// It's important to load compilerOptions manually if there is compilerOptions.configFilePath
|
|
277
|
+
// since not all build tools provide the full compilerOptions.
|
|
278
|
+
compilerOptions: {}
|
|
279
|
+
};
|
|
280
|
+
tsConfigPath = tsConfigPath || ("string" === typeof compilerOptions.configFilePath ? compilerOptions.configFilePath : "");
|
|
281
|
+
if (tsConfigPath) {
|
|
282
|
+
if (cache[tsConfigPath]) {
|
|
283
|
+
return cache[tsConfigPath];
|
|
284
|
+
}
|
|
285
|
+
const configFile = readTsConfig(host, tsConfigPath);
|
|
286
|
+
if (configFile) applyConfigValues(config, configFile, dirname(tsConfigPath));
|
|
287
|
+
} else {
|
|
288
|
+
if (!tsConfigPath && sourceFile) {
|
|
289
|
+
const baseDir = dirname(sourceFile.fileName);
|
|
290
|
+
const configPath = ts2.findConfigFile(baseDir, (path) => {
|
|
291
|
+
path = isAbsolute(path) ? path : join(baseDir, path);
|
|
292
|
+
return host.fileExists(path);
|
|
293
|
+
});
|
|
294
|
+
debug2(`No tsConfigPath|compilerOptions.configFilePath provided. Manually searching for tsconfig.json in ${baseDir} returned ${configPath}`);
|
|
295
|
+
if (configPath) {
|
|
296
|
+
tsConfigPath = isAbsolute(configPath) ? configPath : join(baseDir, configPath);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (tsConfigPath) {
|
|
300
|
+
if (cache[tsConfigPath]) return cache[tsConfigPath];
|
|
301
|
+
const configFile = readTsConfig(host, tsConfigPath);
|
|
302
|
+
if (configFile) applyConfigValues(config, configFile, dirname(tsConfigPath));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (tsConfigPath) {
|
|
306
|
+
let basePath = dirname(tsConfigPath);
|
|
307
|
+
let currentConfig = config;
|
|
308
|
+
const seen = /* @__PURE__ */ new Set();
|
|
309
|
+
seen.add(tsConfigPath);
|
|
310
|
+
while (currentConfig.extends) {
|
|
311
|
+
const path = join(basePath, currentConfig.extends);
|
|
312
|
+
if (seen.has(path)) break;
|
|
313
|
+
seen.add(path);
|
|
314
|
+
const nextConfig = ts2.readConfigFile(path, (path2) => host.readFile(path2));
|
|
315
|
+
if (!nextConfig) break;
|
|
316
|
+
basePath = dirname(path);
|
|
317
|
+
applyConfigValues(currentConfig, nextConfig.config, basePath);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
throw new Error(`No tsconfig found for ${sourceFile?.fileName}, that is weird. Either provide a tsconfig or compilerOptions.configFilePath`);
|
|
321
|
+
}
|
|
322
|
+
config.exclude = config.exclude ? [
|
|
323
|
+
...defaultExcluded,
|
|
324
|
+
...config.exclude
|
|
325
|
+
] : [
|
|
326
|
+
...defaultExcluded
|
|
327
|
+
];
|
|
328
|
+
config.compilerOptions.configFilePath = tsConfigPath;
|
|
329
|
+
const resolvedConfig = {
|
|
330
|
+
path: tsConfigPath,
|
|
331
|
+
// we want to maintain options passed from tsc API (transpile, Program)
|
|
332
|
+
compilerOptions: Object.assign(config.compilerOptions, compilerOptions),
|
|
333
|
+
exclude: config.exclude,
|
|
334
|
+
reflection: config.reflection,
|
|
335
|
+
reflectionLevel: config.reflectionLevel || (config.compilerOptions?.reflectionLevel ? String(config.compilerOptions?.reflectionLevel) : void 0) || "normal",
|
|
336
|
+
mergeStrategy: config.mergeStrategy || defaultMergeStrategy
|
|
337
|
+
};
|
|
338
|
+
if (isDebug()) {
|
|
339
|
+
debug(`Found config ${resolvedConfig.path}:
|
|
340
|
+
reflection:`, resolvedConfig.reflection, `
|
|
341
|
+
exclude:`, resolvedConfig.exclude, `
|
|
342
|
+
paths:`, resolvedConfig.compilerOptions.paths);
|
|
343
|
+
}
|
|
344
|
+
const match = /* @__PURE__ */ __name((path) => {
|
|
345
|
+
const mode = reflectionModeMatcher(config, path);
|
|
346
|
+
return {
|
|
347
|
+
mode,
|
|
348
|
+
tsConfigPath,
|
|
349
|
+
level: resolvedConfig.reflectionLevel
|
|
350
|
+
};
|
|
351
|
+
}, "match");
|
|
352
|
+
return cache[tsConfigPath] = {
|
|
353
|
+
config: resolvedConfig,
|
|
354
|
+
match
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
__name(getConfigResolver, "getConfigResolver");
|
|
358
|
+
|
|
359
|
+
export { Resolver, __name, __require, debug, debug2, defaultExcluded, getConfigResolver, isObject, parseRawMode, reflectionLevel, reflectionModeMatcher, reflectionModes };
|