@powerlines/deepkit 0.5.5 → 0.5.6

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.
@@ -1,43 +1,44 @@
1
1
  'use strict';
2
2
 
3
- var chunkK5KCTNDL_cjs = require('./chunk-K5KCTNDL.cjs');
4
- require('./chunk-M3FJ3QXG.cjs');
5
-
3
+ var chunkWOXMCJJU_cjs = require('./chunk-WOXMCJJU.cjs');
4
+ var chunkRZKB5IQZ_cjs = require('./chunk-RZKB5IQZ.cjs');
6
5
 
6
+ // src/vendor/type-compiler/compiler.ts
7
+ chunkRZKB5IQZ_cjs.init_cjs_shims();
7
8
 
8
9
  Object.defineProperty(exports, "Cache", {
9
10
  enumerable: true,
10
- get: function () { return chunkK5KCTNDL_cjs.Cache; }
11
+ get: function () { return chunkWOXMCJJU_cjs.Cache; }
11
12
  });
12
13
  Object.defineProperty(exports, "DeclarationTransformer", {
13
14
  enumerable: true,
14
- get: function () { return chunkK5KCTNDL_cjs.DeclarationTransformer; }
15
+ get: function () { return chunkWOXMCJJU_cjs.DeclarationTransformer; }
15
16
  });
16
17
  Object.defineProperty(exports, "ReflectionTransformer", {
17
18
  enumerable: true,
18
- get: function () { return chunkK5KCTNDL_cjs.ReflectionTransformer; }
19
+ get: function () { return chunkWOXMCJJU_cjs.ReflectionTransformer; }
19
20
  });
20
21
  Object.defineProperty(exports, "debugPackStruct", {
21
22
  enumerable: true,
22
- get: function () { return chunkK5KCTNDL_cjs.debugPackStruct; }
23
+ get: function () { return chunkWOXMCJJU_cjs.debugPackStruct; }
23
24
  });
24
25
  Object.defineProperty(exports, "declarationTransformer", {
25
26
  enumerable: true,
26
- get: function () { return chunkK5KCTNDL_cjs.declarationTransformer; }
27
+ get: function () { return chunkWOXMCJJU_cjs.declarationTransformer; }
27
28
  });
28
29
  Object.defineProperty(exports, "encodeOps", {
29
30
  enumerable: true,
30
- get: function () { return chunkK5KCTNDL_cjs.encodeOps; }
31
+ get: function () { return chunkWOXMCJJU_cjs.encodeOps; }
31
32
  });
32
33
  Object.defineProperty(exports, "packSize", {
33
34
  enumerable: true,
34
- get: function () { return chunkK5KCTNDL_cjs.packSize; }
35
+ get: function () { return chunkWOXMCJJU_cjs.packSize; }
35
36
  });
36
37
  Object.defineProperty(exports, "packSizeByte", {
37
38
  enumerable: true,
38
- get: function () { return chunkK5KCTNDL_cjs.packSizeByte; }
39
+ get: function () { return chunkWOXMCJJU_cjs.packSizeByte; }
39
40
  });
40
41
  Object.defineProperty(exports, "transformer", {
41
42
  enumerable: true,
42
- get: function () { return chunkK5KCTNDL_cjs.transformer; }
43
+ get: function () { return chunkWOXMCJJU_cjs.transformer; }
43
44
  });
@@ -1,2 +1,5 @@
1
- export { Cache, DeclarationTransformer, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer } from './chunk-L3KIZV6P.js';
2
- import './chunk-IOMA7ABE.js';
1
+ export { Cache, DeclarationTransformer, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer } from './chunk-RH4YMONA.js';
2
+ import { init_esm_shims } from './chunk-MCNMRQDT.js';
3
+
4
+ // src/vendor/type-compiler/compiler.ts
5
+ init_esm_shims();
@@ -1,34 +1,35 @@
1
1
  'use strict';
2
2
 
3
- var chunkM3FJ3QXG_cjs = require('./chunk-M3FJ3QXG.cjs');
4
-
3
+ var chunkRZKB5IQZ_cjs = require('./chunk-RZKB5IQZ.cjs');
5
4
 
5
+ // src/vendor/type-compiler/config.ts
6
+ chunkRZKB5IQZ_cjs.init_cjs_shims();
6
7
 
7
8
  Object.defineProperty(exports, "defaultExcluded", {
8
9
  enumerable: true,
9
- get: function () { return chunkM3FJ3QXG_cjs.defaultExcluded; }
10
+ get: function () { return chunkRZKB5IQZ_cjs.defaultExcluded; }
10
11
  });
11
12
  Object.defineProperty(exports, "getConfigResolver", {
12
13
  enumerable: true,
13
- get: function () { return chunkM3FJ3QXG_cjs.getConfigResolver; }
14
+ get: function () { return chunkRZKB5IQZ_cjs.getConfigResolver; }
14
15
  });
15
16
  Object.defineProperty(exports, "isObject", {
16
17
  enumerable: true,
17
- get: function () { return chunkM3FJ3QXG_cjs.isObject; }
18
+ get: function () { return chunkRZKB5IQZ_cjs.isObject; }
18
19
  });
19
20
  Object.defineProperty(exports, "parseRawMode", {
20
21
  enumerable: true,
21
- get: function () { return chunkM3FJ3QXG_cjs.parseRawMode; }
22
+ get: function () { return chunkRZKB5IQZ_cjs.parseRawMode; }
22
23
  });
23
24
  Object.defineProperty(exports, "reflectionLevel", {
24
25
  enumerable: true,
25
- get: function () { return chunkM3FJ3QXG_cjs.reflectionLevel; }
26
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionLevel; }
26
27
  });
27
28
  Object.defineProperty(exports, "reflectionModeMatcher", {
28
29
  enumerable: true,
29
- get: function () { return chunkM3FJ3QXG_cjs.reflectionModeMatcher; }
30
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionModeMatcher; }
30
31
  });
31
32
  Object.defineProperty(exports, "reflectionModes", {
32
33
  enumerable: true,
33
- get: function () { return chunkM3FJ3QXG_cjs.reflectionModes; }
34
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionModes; }
34
35
  });
@@ -1 +1,5 @@
1
- export { defaultExcluded, getConfigResolver, isObject, parseRawMode, reflectionLevel, reflectionModeMatcher, reflectionModes } from './chunk-IOMA7ABE.js';
1
+ import { init_esm_shims } from './chunk-MCNMRQDT.js';
2
+ export { defaultExcluded, getConfigResolver, isObject, parseRawMode, reflectionLevel, reflectionModeMatcher, reflectionModes } from './chunk-MCNMRQDT.js';
3
+
4
+ // src/vendor/type-compiler/config.ts
5
+ init_esm_shims();
@@ -1,16 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunkK5KCTNDL_cjs = require('./chunk-K5KCTNDL.cjs');
4
- var chunkM3FJ3QXG_cjs = require('./chunk-M3FJ3QXG.cjs');
3
+ var chunkWOXMCJJU_cjs = require('./chunk-WOXMCJJU.cjs');
4
+ var chunkRZKB5IQZ_cjs = require('./chunk-RZKB5IQZ.cjs');
5
5
  var ts = require('typescript');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var ts__default = /*#__PURE__*/_interopDefault(ts);
10
10
 
11
+ // src/vendor/type-compiler/index.ts
12
+ chunkRZKB5IQZ_cjs.init_cjs_shims();
13
+
14
+ // ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/index.js
15
+ chunkRZKB5IQZ_cjs.init_cjs_shims();
16
+
17
+ // ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/src/loader.js
18
+ chunkRZKB5IQZ_cjs.init_cjs_shims();
11
19
  var DeepkitLoader = class {
12
20
  static {
13
- chunkM3FJ3QXG_cjs.__name(this, "DeepkitLoader");
21
+ chunkRZKB5IQZ_cjs.__name(this, "DeepkitLoader");
14
22
  }
15
23
  constructor() {
16
24
  this.options = {
@@ -22,7 +30,7 @@ var DeepkitLoader = class {
22
30
  this.printer = ts__default.default.createPrinter({
23
31
  newLine: ts__default.default.NewLineKind.LineFeed
24
32
  });
25
- this.cache = new chunkK5KCTNDL_cjs.Cache();
33
+ this.cache = new chunkWOXMCJJU_cjs.Cache();
26
34
  this.knownFiles = {};
27
35
  this.sourceFiles = {};
28
36
  const originReadFile = this.host.readFile;
@@ -44,7 +52,7 @@ var DeepkitLoader = class {
44
52
  let newSource = source;
45
53
  ts__default.default.transform(sourceFile, [
46
54
  (context) => {
47
- const transformer2 = new chunkK5KCTNDL_cjs.ReflectionTransformer(context, this.cache).forHost(this.host).withReflection({
55
+ const transformer2 = new chunkWOXMCJJU_cjs.ReflectionTransformer(context, this.cache).forHost(this.host).withReflection({
48
56
  reflection: "default",
49
57
  reflectionLevel: "normal"
50
58
  });
@@ -61,66 +69,66 @@ var DeepkitLoader = class {
61
69
 
62
70
  Object.defineProperty(exports, "Cache", {
63
71
  enumerable: true,
64
- get: function () { return chunkK5KCTNDL_cjs.Cache; }
72
+ get: function () { return chunkWOXMCJJU_cjs.Cache; }
65
73
  });
66
74
  Object.defineProperty(exports, "DeclarationTransformer", {
67
75
  enumerable: true,
68
- get: function () { return chunkK5KCTNDL_cjs.DeclarationTransformer; }
76
+ get: function () { return chunkWOXMCJJU_cjs.DeclarationTransformer; }
69
77
  });
70
78
  Object.defineProperty(exports, "ReflectionTransformer", {
71
79
  enumerable: true,
72
- get: function () { return chunkK5KCTNDL_cjs.ReflectionTransformer; }
80
+ get: function () { return chunkWOXMCJJU_cjs.ReflectionTransformer; }
73
81
  });
74
82
  Object.defineProperty(exports, "debugPackStruct", {
75
83
  enumerable: true,
76
- get: function () { return chunkK5KCTNDL_cjs.debugPackStruct; }
84
+ get: function () { return chunkWOXMCJJU_cjs.debugPackStruct; }
77
85
  });
78
86
  Object.defineProperty(exports, "declarationTransformer", {
79
87
  enumerable: true,
80
- get: function () { return chunkK5KCTNDL_cjs.declarationTransformer; }
88
+ get: function () { return chunkWOXMCJJU_cjs.declarationTransformer; }
81
89
  });
82
90
  Object.defineProperty(exports, "encodeOps", {
83
91
  enumerable: true,
84
- get: function () { return chunkK5KCTNDL_cjs.encodeOps; }
92
+ get: function () { return chunkWOXMCJJU_cjs.encodeOps; }
85
93
  });
86
94
  Object.defineProperty(exports, "packSize", {
87
95
  enumerable: true,
88
- get: function () { return chunkK5KCTNDL_cjs.packSize; }
96
+ get: function () { return chunkWOXMCJJU_cjs.packSize; }
89
97
  });
90
98
  Object.defineProperty(exports, "packSizeByte", {
91
99
  enumerable: true,
92
- get: function () { return chunkK5KCTNDL_cjs.packSizeByte; }
100
+ get: function () { return chunkWOXMCJJU_cjs.packSizeByte; }
93
101
  });
94
102
  Object.defineProperty(exports, "transformer", {
95
103
  enumerable: true,
96
- get: function () { return chunkK5KCTNDL_cjs.transformer; }
104
+ get: function () { return chunkWOXMCJJU_cjs.transformer; }
97
105
  });
98
106
  Object.defineProperty(exports, "defaultExcluded", {
99
107
  enumerable: true,
100
- get: function () { return chunkM3FJ3QXG_cjs.defaultExcluded; }
108
+ get: function () { return chunkRZKB5IQZ_cjs.defaultExcluded; }
101
109
  });
102
110
  Object.defineProperty(exports, "getConfigResolver", {
103
111
  enumerable: true,
104
- get: function () { return chunkM3FJ3QXG_cjs.getConfigResolver; }
112
+ get: function () { return chunkRZKB5IQZ_cjs.getConfigResolver; }
105
113
  });
106
114
  Object.defineProperty(exports, "isObject", {
107
115
  enumerable: true,
108
- get: function () { return chunkM3FJ3QXG_cjs.isObject; }
116
+ get: function () { return chunkRZKB5IQZ_cjs.isObject; }
109
117
  });
110
118
  Object.defineProperty(exports, "parseRawMode", {
111
119
  enumerable: true,
112
- get: function () { return chunkM3FJ3QXG_cjs.parseRawMode; }
120
+ get: function () { return chunkRZKB5IQZ_cjs.parseRawMode; }
113
121
  });
114
122
  Object.defineProperty(exports, "reflectionLevel", {
115
123
  enumerable: true,
116
- get: function () { return chunkM3FJ3QXG_cjs.reflectionLevel; }
124
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionLevel; }
117
125
  });
118
126
  Object.defineProperty(exports, "reflectionModeMatcher", {
119
127
  enumerable: true,
120
- get: function () { return chunkM3FJ3QXG_cjs.reflectionModeMatcher; }
128
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionModeMatcher; }
121
129
  });
122
130
  Object.defineProperty(exports, "reflectionModes", {
123
131
  enumerable: true,
124
- get: function () { return chunkM3FJ3QXG_cjs.reflectionModes; }
132
+ get: function () { return chunkRZKB5IQZ_cjs.reflectionModes; }
125
133
  });
126
134
  exports.DeepkitLoader = DeepkitLoader;
@@ -1,9 +1,17 @@
1
- import { Cache, ReflectionTransformer } from './chunk-L3KIZV6P.js';
2
- export { Cache, DeclarationTransformer, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer } from './chunk-L3KIZV6P.js';
3
- import { __name } from './chunk-IOMA7ABE.js';
4
- export { defaultExcluded, getConfigResolver, isObject, parseRawMode, reflectionLevel, reflectionModeMatcher, reflectionModes } from './chunk-IOMA7ABE.js';
1
+ import { Cache, ReflectionTransformer } from './chunk-RH4YMONA.js';
2
+ export { Cache, DeclarationTransformer, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer } from './chunk-RH4YMONA.js';
3
+ import { init_esm_shims, __name } from './chunk-MCNMRQDT.js';
4
+ export { defaultExcluded, getConfigResolver, isObject, parseRawMode, reflectionLevel, reflectionModeMatcher, reflectionModes } from './chunk-MCNMRQDT.js';
5
5
  import ts from 'typescript';
6
6
 
7
+ // src/vendor/type-compiler/index.ts
8
+ init_esm_shims();
9
+
10
+ // ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/index.js
11
+ init_esm_shims();
12
+
13
+ // ../../node_modules/.pnpm/@deepkit+type-compiler@1.0.5_patch_hash=88e8267ac73f46799c551ae3696181dc1f272895f490f8c_ef8b874d406bec4900e1fddc1ea375be/node_modules/@deepkit/type-compiler/dist/esm/src/loader.js
14
+ init_esm_shims();
7
15
  var DeepkitLoader = class {
8
16
  static {
9
17
  __name(this, "DeepkitLoader");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/deepkit",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -141,5 +141,5 @@
141
141
  "esbuild": "^0.25.12"
142
142
  },
143
143
  "publishConfig": { "access": "public" },
144
- "gitHead": "2f0ec16cbf83221dde440cd38765491c048b4509"
144
+ "gitHead": "cadf48ea6f9f62834655063cbf5c65e74203d6dc"
145
145
  }
@@ -1,359 +0,0 @@
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 };