@powerlines/deepkit 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/capnp.cjs +48 -47
  2. package/dist/capnp.js +3 -2
  3. package/dist/{chunk-TVDEXHJN.js → chunk-2ODODKQQ.js} +8 -9
  4. package/dist/{chunk-KYFUOGZ6.cjs → chunk-6QPIKQMO.cjs} +9 -10
  5. package/dist/chunk-7J3ZDT6O.cjs +30 -0
  6. package/dist/chunk-C7BRLIIA.js +187 -0
  7. package/dist/{chunk-55HOZO7D.cjs → chunk-EKHXI2JI.cjs} +5 -7
  8. package/dist/chunk-GRNJVY7I.cjs +19 -0
  9. package/dist/{chunk-DGXATHAN.js → chunk-I5CVIT7W.js} +41 -46
  10. package/dist/chunk-IRPJW6HH.js +16 -0
  11. package/dist/{chunk-SKYW5GV2.cjs → chunk-J2FVIV7W.cjs} +127 -132
  12. package/dist/chunk-J4SVRFV4.js +127 -0
  13. package/dist/{chunk-BTXPY3B4.js → chunk-LPLPOVLC.js} +2 -4
  14. package/dist/{chunk-FEBG7WWO.js → chunk-MEMIQ5AA.js} +1 -3
  15. package/dist/{chunk-U4JSDAXK.js → chunk-MNUBEEIW.js} +12 -7
  16. package/dist/chunk-ORA4UQMU.cjs +2 -0
  17. package/dist/chunk-OULCUN6I.js +1 -0
  18. package/dist/chunk-QABG54Y3.cjs +193 -0
  19. package/dist/chunk-QLKLDV3V.cjs +135 -0
  20. package/dist/{chunk-JHEBLHYK.cjs → chunk-VMRRVNO2.cjs} +2 -4
  21. package/dist/chunk-VXZTOOL6.cjs +69 -0
  22. package/dist/chunk-XGQQM64U.js +8 -0
  23. package/dist/esbuild-plugin.cjs +5 -5
  24. package/dist/esbuild-plugin.d.cts +3 -2
  25. package/dist/esbuild-plugin.d.ts +3 -2
  26. package/dist/esbuild-plugin.js +4 -4
  27. package/dist/index.cjs +69 -69
  28. package/dist/index.js +10 -12
  29. package/dist/reflect-type.cjs +7 -6
  30. package/dist/reflect-type.js +6 -5
  31. package/dist/resolve-reflections.cjs +3 -3
  32. package/dist/resolve-reflections.js +2 -2
  33. package/dist/transformer.cjs +4 -4
  34. package/dist/transformer.js +2 -2
  35. package/dist/transpile.cjs +4 -4
  36. package/dist/transpile.js +3 -3
  37. package/dist/types.cjs +1 -2
  38. package/dist/types.js +1 -2
  39. package/dist/utilities.cjs +10 -9
  40. package/dist/utilities.js +3 -2
  41. package/dist/vendor/chunk-IOMA7ABE.js +359 -0
  42. package/dist/vendor/chunk-K5KCTNDL.cjs +2678 -0
  43. package/dist/vendor/chunk-L3KIZV6P.js +2664 -0
  44. package/dist/vendor/chunk-M3FJ3QXG.cjs +377 -0
  45. package/dist/vendor/compiler.cjs +12 -13
  46. package/dist/vendor/compiler.js +2 -5
  47. package/dist/vendor/config.cjs +9 -10
  48. package/dist/vendor/config.js +1 -5
  49. package/dist/vendor/core.cjs +130 -130
  50. package/dist/vendor/core.js +2 -5
  51. package/dist/vendor/index.cjs +42 -22
  52. package/dist/vendor/index.d.cts +2 -0
  53. package/dist/vendor/index.d.ts +2 -0
  54. package/dist/vendor/index.js +4 -11
  55. package/dist/vendor/type-spec.cjs +5 -5
  56. package/dist/vendor/type-spec.js +2 -5
  57. package/dist/vendor/type.cjs +2269 -691
  58. package/dist/vendor/type.js +1607 -92
  59. package/package.json +5 -5
  60. package/dist/chunk-2V4ET57D.js +0 -6954
  61. package/dist/chunk-4WJJKR53.js +0 -3731
  62. package/dist/chunk-6ETLMANX.js +0 -3472
  63. package/dist/chunk-6IQVU53O.cjs +0 -24
  64. package/dist/chunk-6OXPIOZY.cjs +0 -43
  65. package/dist/chunk-7WAH4JD3.js +0 -115
  66. package/dist/chunk-B4PTD5KQ.js +0 -4
  67. package/dist/chunk-ITQKPDCW.cjs +0 -3859
  68. package/dist/chunk-LBHO5BRF.js +0 -2251
  69. package/dist/chunk-OYRIJX67.cjs +0 -3487
  70. package/dist/chunk-PANPZ6S6.cjs +0 -6
  71. package/dist/chunk-QPSZUUB6.cjs +0 -2259
  72. package/dist/chunk-QQ7GKXIS.js +0 -43
  73. package/dist/chunk-SA3DCC4M.cjs +0 -6968
  74. package/dist/chunk-WVKPC33H.cjs +0 -49
  75. package/dist/chunk-YKFG2BZQ.cjs +0 -115
  76. package/dist/chunk-YUO4MCOI.js +0 -18
  77. package/dist/vendor/chunk-MCNMRQDT.js +0 -3513
  78. package/dist/vendor/chunk-RH4YMONA.js +0 -7064
  79. package/dist/vendor/chunk-RZKB5IQZ.cjs +0 -3531
  80. package/dist/vendor/chunk-WOXMCJJU.cjs +0 -7078
  81. package/dist/vendor/type-compiler/compiler.cjs +0 -46
  82. package/dist/vendor/type-compiler/compiler.d.cts +0 -1
  83. package/dist/vendor/type-compiler/compiler.d.ts +0 -1
  84. package/dist/vendor/type-compiler/compiler.js +0 -7
  85. package/dist/vendor/type-compiler/config.cjs +0 -36
  86. package/dist/vendor/type-compiler/config.d.cts +0 -6
  87. package/dist/vendor/type-compiler/config.d.ts +0 -6
  88. package/dist/vendor/type-compiler/config.js +0 -5
  89. package/dist/vendor/type-compiler/index.cjs +0 -108
  90. package/dist/vendor/type-compiler/index.d.cts +0 -1
  91. package/dist/vendor/type-compiler/index.d.ts +0 -1
  92. package/dist/vendor/type-compiler/index.js +0 -67
@@ -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 };