@powerlines/deepkit 0.6.167 → 0.7.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.
Files changed (138) hide show
  1. package/bin/deepkit-install.cjs +55 -90
  2. package/dist/capnp-BLx1WTBU.cjs +5175 -0
  3. package/dist/capnp-BiGNkOmV.mjs +4905 -0
  4. package/dist/capnp.cjs +47 -186
  5. package/dist/capnp.d.cts +78 -77
  6. package/dist/{capnp.d.ts → capnp.d.mts} +78 -77
  7. package/dist/capnp.mjs +3 -0
  8. package/dist/chunk-C0xms8kb.cjs +34 -0
  9. package/dist/esbuild-plugin.cjs +47 -11
  10. package/dist/esbuild-plugin.d.cts +20 -18
  11. package/dist/esbuild-plugin.d.mts +35 -0
  12. package/dist/esbuild-plugin.mjs +48 -0
  13. package/dist/index.cjs +69 -250
  14. package/dist/index.d.cts +10 -19
  15. package/dist/index.d.mts +10 -0
  16. package/dist/index.mjs +11 -0
  17. package/dist/reflect-type.cjs +24 -12
  18. package/dist/reflect-type.d.cts +7 -5
  19. package/dist/{reflect-type.d.ts → reflect-type.d.mts} +7 -5
  20. package/dist/reflect-type.mjs +24 -0
  21. package/dist/{reflection-9KUpjPqV.d.cts → reflection-BwdnCwaK.d.cts} +11 -17
  22. package/dist/{reflection-9KUpjPqV.d.ts → reflection-Chr4fE0i.d.mts} +11 -17
  23. package/dist/reflection-D9R8cdSo.d.mts +1561 -0
  24. package/dist/resolve-reflections.cjs +15 -9
  25. package/dist/resolve-reflections.d.cts +4 -2
  26. package/dist/{resolve-reflections.d.ts → resolve-reflections.d.mts} +4 -2
  27. package/dist/resolve-reflections.mjs +16 -0
  28. package/dist/rolldown-plugin.cjs +44 -11
  29. package/dist/rolldown-plugin.d.cts +5 -3
  30. package/dist/{rolldown-plugin.d.ts → rolldown-plugin.d.mts} +5 -3
  31. package/dist/rolldown-plugin.mjs +45 -0
  32. package/dist/transformer.cjs +52 -13
  33. package/dist/transformer.d.cts +6 -4
  34. package/dist/{transformer.d.ts → transformer.d.mts} +6 -4
  35. package/dist/transformer.mjs +51 -0
  36. package/dist/transpile.cjs +29 -10
  37. package/dist/transpile.d.cts +6 -4
  38. package/dist/{transpile.d.ts → transpile.d.mts} +6 -4
  39. package/dist/transpile.mjs +29 -0
  40. package/dist/types.cjs +0 -4
  41. package/dist/types.d.cts +9 -9
  42. package/dist/{types.d.ts → types.d.mts} +9 -9
  43. package/dist/types.mjs +1 -0
  44. package/dist/utilities.cjs +116 -33
  45. package/dist/utilities.d.cts +4 -2
  46. package/dist/{utilities.d.ts → utilities.d.mts} +4 -2
  47. package/dist/utilities.mjs +111 -0
  48. package/dist/vendor/core.cjs +1240 -513
  49. package/dist/vendor/core.mjs +1116 -0
  50. package/dist/vendor/string-BoXo0wS7.cjs +2983 -0
  51. package/dist/vendor/string-BuMgdahD.mjs +2467 -0
  52. package/dist/vendor/type-BMLjRtLY.cjs +202 -0
  53. package/dist/vendor/type-Dgeqs-rL.mjs +190 -0
  54. package/dist/vendor/type-compiler/compiler-BUrWMhGi.cjs +6792 -0
  55. package/dist/vendor/type-compiler/compiler-Bg8jX6qU.mjs +6739 -0
  56. package/dist/vendor/type-compiler/compiler-D1z5h1MK.d.cts +578 -0
  57. package/dist/vendor/type-compiler/compiler-Nkxc4PLJ.d.mts +578 -0
  58. package/dist/vendor/type-compiler/compiler.cjs +11 -43
  59. package/dist/vendor/type-compiler/compiler.d.cts +2 -3
  60. package/dist/vendor/type-compiler/compiler.d.mts +2 -0
  61. package/dist/vendor/type-compiler/compiler.mjs +3 -0
  62. package/dist/vendor/type-compiler/config-BEX924PC.cjs +3709 -0
  63. package/dist/vendor/type-compiler/config-B_cKkYZm.d.cts +116 -0
  64. package/dist/vendor/type-compiler/config-D9DM7Du_.d.mts +116 -0
  65. package/dist/vendor/type-compiler/config-y0HNkbCH.mjs +3640 -0
  66. package/dist/vendor/type-compiler/config.cjs +9 -34
  67. package/dist/vendor/type-compiler/config.d.cts +2 -1
  68. package/dist/vendor/type-compiler/config.d.mts +2 -0
  69. package/dist/vendor/type-compiler/config.mjs +3 -0
  70. package/dist/vendor/type-compiler/index.cjs +56 -129
  71. package/dist/vendor/type-compiler/index.d.cts +22 -3
  72. package/dist/vendor/type-compiler/index.d.mts +22 -0
  73. package/dist/vendor/type-compiler/index.mjs +50 -0
  74. package/dist/vendor/type-spec.cjs +11 -12
  75. package/dist/vendor/type-spec.mjs +3 -0
  76. package/dist/vendor/type.cjs +8407 -17892
  77. package/dist/vendor/type.d.cts +10 -196
  78. package/dist/vendor/{type.d.ts → type.d.mts} +10 -196
  79. package/dist/vendor/type.mjs +9109 -0
  80. package/package.json +43 -31
  81. package/schemas/reflection.cjs +4018 -4129
  82. package/schemas/reflection.d.cts +30 -38
  83. package/schemas/{reflection.d.ts → reflection.d.mts} +30 -38
  84. package/schemas/reflection.mjs +4036 -0
  85. package/dist/capnp.js +0 -2
  86. package/dist/chunk-23YNDVRG.js +0 -34
  87. package/dist/chunk-27RKMKSF.cjs +0 -50
  88. package/dist/chunk-2XDQUCXZ.js +0 -2392
  89. package/dist/chunk-34OFD7LS.cjs +0 -68
  90. package/dist/chunk-7FXYDYVQ.cjs +0 -5246
  91. package/dist/chunk-7QZGCBH7.cjs +0 -11
  92. package/dist/chunk-ALM6UMVU.js +0 -9
  93. package/dist/chunk-BLLXF42T.cjs +0 -41
  94. package/dist/chunk-H3Q3XL3D.js +0 -19
  95. package/dist/chunk-HPVJ6OV3.cjs +0 -31
  96. package/dist/chunk-JQUKKAFM.js +0 -48
  97. package/dist/chunk-KK7TQA7L.cjs +0 -25
  98. package/dist/chunk-NPV2346T.js +0 -25
  99. package/dist/chunk-ORA4UQMU.cjs +0 -2
  100. package/dist/chunk-OUGDFUKJ.cjs +0 -2400
  101. package/dist/chunk-OULCUN6I.js +0 -1
  102. package/dist/chunk-SHUYVCID.js +0 -4
  103. package/dist/chunk-TDYIUJGY.js +0 -5180
  104. package/dist/chunk-USNT2KNT.cjs +0 -6
  105. package/dist/chunk-WYEFKIRL.js +0 -66
  106. package/dist/esbuild-plugin.d.ts +0 -33
  107. package/dist/esbuild-plugin.js +0 -4
  108. package/dist/index.d.ts +0 -19
  109. package/dist/index.js +0 -10
  110. package/dist/reflect-type.js +0 -5
  111. package/dist/resolve-reflections.js +0 -2
  112. package/dist/rolldown-plugin.js +0 -4
  113. package/dist/transformer.js +0 -2
  114. package/dist/transpile.js +0 -3
  115. package/dist/types.js +0 -1
  116. package/dist/utilities.js +0 -2
  117. package/dist/vendor/chunk-5BKT4CS5.js +0 -28
  118. package/dist/vendor/chunk-BLN7QVCP.js +0 -3704
  119. package/dist/vendor/chunk-BR2FK5K7.js +0 -109
  120. package/dist/vendor/chunk-EPQZMVJO.cjs +0 -3859
  121. package/dist/vendor/chunk-IFK6AU6M.cjs +0 -42
  122. package/dist/vendor/chunk-SHDAXCXF.cjs +0 -115
  123. package/dist/vendor/core.js +0 -2
  124. package/dist/vendor/type-compiler/chunk-3LL3TSRJ.js +0 -3762
  125. package/dist/vendor/type-compiler/chunk-CUTGHVNY.js +0 -7100
  126. package/dist/vendor/type-compiler/chunk-IAWCLVUK.cjs +0 -3780
  127. package/dist/vendor/type-compiler/chunk-UIWPG352.cjs +0 -7114
  128. package/dist/vendor/type-compiler/compiler.d.ts +0 -3
  129. package/dist/vendor/type-compiler/compiler.js +0 -5
  130. package/dist/vendor/type-compiler/config.d.ts +0 -1
  131. package/dist/vendor/type-compiler/config.js +0 -5
  132. package/dist/vendor/type-compiler/index.d.ts +0 -3
  133. package/dist/vendor/type-compiler/index.js +0 -66
  134. package/dist/vendor/type-spec.js +0 -2
  135. package/dist/vendor/type.js +0 -18359
  136. package/schemas/reflection.js +0 -4153
  137. /package/dist/vendor/{core.d.ts → core.d.mts} +0 -0
  138. /package/dist/vendor/{type-spec.d.ts → type-spec.d.mts} +0 -0
@@ -1,11 +1,17 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-C0xms8kb.cjs');
3
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
2
4
 
3
- var chunk7QZGCBH7_cjs = require('./chunk-7QZGCBH7.cjs');
4
- require('./chunk-USNT2KNT.cjs');
5
+ //#region src/resolve-reflections.ts
6
+ /**
7
+ * Returns the path to the reflections artifact directory.
8
+ *
9
+ * @param context - The context object containing the environment paths.
10
+ * @returns The path to the reflections artifact directory.
11
+ */
12
+ function getReflectionsPath(context) {
13
+ return (0, _stryke_path_join_paths.joinPaths)(context.dataPath, "reflections");
14
+ }
5
15
 
6
-
7
-
8
- Object.defineProperty(exports, "getReflectionsPath", {
9
- enumerable: true,
10
- get: function () { return chunk7QZGCBH7_cjs.getReflectionsPath; }
11
- });
16
+ //#endregion
17
+ exports.getReflectionsPath = getReflectionsPath;
@@ -1,5 +1,6 @@
1
- import { Context } from 'powerlines';
1
+ import { Context } from "@powerlines/core";
2
2
 
3
+ //#region src/resolve-reflections.d.ts
3
4
  /**
4
5
  * Returns the path to the reflections artifact directory.
5
6
  *
@@ -7,5 +8,6 @@ import { Context } from 'powerlines';
7
8
  * @returns The path to the reflections artifact directory.
8
9
  */
9
10
  declare function getReflectionsPath(context: Context): string;
10
-
11
+ //#endregion
11
12
  export { getReflectionsPath };
13
+ //# sourceMappingURL=resolve-reflections.d.cts.map
@@ -1,5 +1,6 @@
1
- import { Context } from 'powerlines';
1
+ import { Context } from "@powerlines/core";
2
2
 
3
+ //#region src/resolve-reflections.d.ts
3
4
  /**
4
5
  * Returns the path to the reflections artifact directory.
5
6
  *
@@ -7,5 +8,6 @@ import { Context } from 'powerlines';
7
8
  * @returns The path to the reflections artifact directory.
8
9
  */
9
10
  declare function getReflectionsPath(context: Context): string;
10
-
11
+ //#endregion
11
12
  export { getReflectionsPath };
13
+ //# sourceMappingURL=resolve-reflections.d.mts.map
@@ -0,0 +1,16 @@
1
+ import { joinPaths } from "@stryke/path/join-paths";
2
+
3
+ //#region src/resolve-reflections.ts
4
+ /**
5
+ * Returns the path to the reflections artifact directory.
6
+ *
7
+ * @param context - The context object containing the environment paths.
8
+ * @returns The path to the reflections artifact directory.
9
+ */
10
+ function getReflectionsPath(context) {
11
+ return joinPaths(context.dataPath, "reflections");
12
+ }
13
+
14
+ //#endregion
15
+ export { getReflectionsPath };
16
+ //# sourceMappingURL=resolve-reflections.mjs.map
@@ -1,13 +1,46 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-C0xms8kb.cjs');
3
+ const require_transpile = require('./transpile.cjs');
4
+ let _stryke_type_checks = require("@stryke/type-checks");
5
+ let typescript = require("typescript");
6
+ let _stryke_path = require("@stryke/path");
2
7
 
3
- var chunk27RKMKSF_cjs = require('./chunk-27RKMKSF.cjs');
4
- require('./chunk-HPVJ6OV3.cjs');
5
- require('./chunk-BLLXF42T.cjs');
6
- require('./chunk-USNT2KNT.cjs');
8
+ //#region src/rolldown-plugin.ts
9
+ /**
10
+ * Rolldown plugin for Deepkit Type reflections.
11
+ *
12
+ * @param context - The Powerlines context.
13
+ * @param filter - Optional filter to limit which files are processed.
14
+ * @returns A Rolldown plugin instance.
15
+ */
16
+ const rolldownPlugin = (context, filter = {}) => {
17
+ return {
18
+ name: "powerlines:deepkit",
19
+ load: {
20
+ filter: {
21
+ id: /\.(m|c)?tsx?$/,
22
+ ...filter
23
+ },
24
+ async handler(id) {
25
+ const path = await context.resolve(id);
26
+ if (!path?.id) return null;
27
+ const contents = await context.fs.read(path.id);
28
+ if (!contents) return null;
29
+ const result = require_transpile.transpile(context, contents, path.id);
30
+ if (result.diagnostics && result.diagnostics.length > 0) if (result.diagnostics.some((d) => d.category === typescript.DiagnosticCategory.Error)) {
31
+ const errorMessage = `Deepkit Type reflection transpilation errors: ${id} \n ${result.diagnostics.filter((d) => d.category === typescript.DiagnosticCategory.Error).map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${(0, _stryke_type_checks.isString)(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`;
32
+ context.error(errorMessage);
33
+ throw new Error(errorMessage);
34
+ } else if (result.diagnostics.some((d) => d.category === typescript.DiagnosticCategory.Warning)) context.warn(`Deepkit Type reflection transpilation warnings: ${id} \n ${result.diagnostics.filter((d) => d.category === typescript.DiagnosticCategory.Warning).map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${(0, _stryke_type_checks.isString)(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`);
35
+ else context.debug(`Deepkit Type reflection transpilation diagnostics: ${id} \n ${result.diagnostics.map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${(0, _stryke_type_checks.isString)(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`);
36
+ return {
37
+ code: result.outputText,
38
+ moduleType: (0, _stryke_path.findFileExtension)(path.id)
39
+ };
40
+ }
41
+ }
42
+ };
43
+ };
7
44
 
8
-
9
-
10
- Object.defineProperty(exports, "rolldownPlugin", {
11
- enumerable: true,
12
- get: function () { return chunk27RKMKSF_cjs.rolldownPlugin; }
13
- });
45
+ //#endregion
46
+ exports.rolldownPlugin = rolldownPlugin;
@@ -1,6 +1,7 @@
1
- import { Context } from 'powerlines';
2
- import { HookFilter, Plugin } from 'rolldown';
1
+ import { Context } from "@powerlines/core";
2
+ import { HookFilter, Plugin } from "rolldown";
3
3
 
4
+ //#region src/rolldown-plugin.d.ts
4
5
  /**
5
6
  * Rolldown plugin for Deepkit Type reflections.
6
7
  *
@@ -9,5 +10,6 @@ import { HookFilter, Plugin } from 'rolldown';
9
10
  * @returns A Rolldown plugin instance.
10
11
  */
11
12
  declare const rolldownPlugin: (context: Context, filter?: Partial<Pick<HookFilter, "id">>) => Plugin;
12
-
13
+ //#endregion
13
14
  export { rolldownPlugin };
15
+ //# sourceMappingURL=rolldown-plugin.d.cts.map
@@ -1,6 +1,7 @@
1
- import { Context } from 'powerlines';
2
- import { HookFilter, Plugin } from 'rolldown';
1
+ import { Context } from "@powerlines/core";
2
+ import { HookFilter, Plugin } from "rolldown";
3
3
 
4
+ //#region src/rolldown-plugin.d.ts
4
5
  /**
5
6
  * Rolldown plugin for Deepkit Type reflections.
6
7
  *
@@ -9,5 +10,6 @@ import { HookFilter, Plugin } from 'rolldown';
9
10
  * @returns A Rolldown plugin instance.
10
11
  */
11
12
  declare const rolldownPlugin: (context: Context, filter?: Partial<Pick<HookFilter, "id">>) => Plugin;
12
-
13
+ //#endregion
13
14
  export { rolldownPlugin };
15
+ //# sourceMappingURL=rolldown-plugin.d.mts.map
@@ -0,0 +1,45 @@
1
+ import { transpile } from "./transpile.mjs";
2
+ import { isString } from "@stryke/type-checks";
3
+ import { DiagnosticCategory } from "typescript";
4
+ import { findFileExtension } from "@stryke/path";
5
+
6
+ //#region src/rolldown-plugin.ts
7
+ /**
8
+ * Rolldown plugin for Deepkit Type reflections.
9
+ *
10
+ * @param context - The Powerlines context.
11
+ * @param filter - Optional filter to limit which files are processed.
12
+ * @returns A Rolldown plugin instance.
13
+ */
14
+ const rolldownPlugin = (context, filter = {}) => {
15
+ return {
16
+ name: "powerlines:deepkit",
17
+ load: {
18
+ filter: {
19
+ id: /\.(m|c)?tsx?$/,
20
+ ...filter
21
+ },
22
+ async handler(id) {
23
+ const path = await context.resolve(id);
24
+ if (!path?.id) return null;
25
+ const contents = await context.fs.read(path.id);
26
+ if (!contents) return null;
27
+ const result = transpile(context, contents, path.id);
28
+ if (result.diagnostics && result.diagnostics.length > 0) if (result.diagnostics.some((d) => d.category === DiagnosticCategory.Error)) {
29
+ const errorMessage = `Deepkit Type reflection transpilation errors: ${id} \n ${result.diagnostics.filter((d) => d.category === DiagnosticCategory.Error).map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${isString(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`;
30
+ context.error(errorMessage);
31
+ throw new Error(errorMessage);
32
+ } else if (result.diagnostics.some((d) => d.category === DiagnosticCategory.Warning)) context.warn(`Deepkit Type reflection transpilation warnings: ${id} \n ${result.diagnostics.filter((d) => d.category === DiagnosticCategory.Warning).map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${isString(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`);
33
+ else context.debug(`Deepkit Type reflection transpilation diagnostics: ${id} \n ${result.diagnostics.map((d) => `-${d.file ? `${d.file.fileName}:` : ""} ${isString(d.messageText) ? d.messageText : d.messageText.messageText} (at ${d.start}:${d.length})`).join("\n")}`);
34
+ return {
35
+ code: result.outputText,
36
+ moduleType: findFileExtension(path.id)
37
+ };
38
+ }
39
+ }
40
+ };
41
+ };
42
+
43
+ //#endregion
44
+ export { rolldownPlugin };
45
+ //# sourceMappingURL=rolldown-plugin.mjs.map
@@ -1,15 +1,54 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-C0xms8kb.cjs');
3
+ let _powerlines_deepkit_vendor_type_compiler = require("@powerlines/deepkit/vendor/type-compiler");
4
+ let _powerlines_deepkit_vendor_type_compiler_compiler = require("@powerlines/deepkit/vendor/type-compiler/compiler");
5
+ let defu = require("defu");
6
+ defu = require_chunk.__toESM(defu);
2
7
 
3
- var chunkBLLXF42T_cjs = require('./chunk-BLLXF42T.cjs');
4
- require('./chunk-USNT2KNT.cjs');
8
+ //#region src/transformer.ts
9
+ let loaded = false;
10
+ const cache = new _powerlines_deepkit_vendor_type_compiler_compiler.Cache();
11
+ /**
12
+ * Creates a Deepkit TypeScript transformer.
13
+ *
14
+ * @param context - The Powerlines plugin context.
15
+ * @param options - The transformation options.
16
+ * @returns A Deepkit TypeScript custom transformer factory.
17
+ */
18
+ function createTransformer(context, options = {}) {
19
+ return function transformer(ctx) {
20
+ if (!loaded) loaded = true;
21
+ cache.tick();
22
+ return new _powerlines_deepkit_vendor_type_compiler.ReflectionTransformer(ctx, cache).withReflection((0, defu.default)(options, {
23
+ reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
24
+ reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
25
+ }, {
26
+ exclude: [],
27
+ reflection: "default",
28
+ reflectionLevel: "minimal"
29
+ }));
30
+ };
31
+ }
32
+ /**
33
+ * Creates a Deepkit TypeScript declaration transformer.
34
+ *
35
+ * @param context - The Powerlines plugin context.
36
+ * @param options - The transformation options.
37
+ * @returns A Deepkit TypeScript custom declaration transformer factory.
38
+ */
39
+ function createDeclarationTransformer(context, options = {}) {
40
+ return function declarationTransformer(ctx) {
41
+ return new _powerlines_deepkit_vendor_type_compiler.DeclarationTransformer(ctx, cache).withReflection((0, defu.default)(options, {
42
+ reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
43
+ reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
44
+ }, {
45
+ exclude: [],
46
+ reflection: "default",
47
+ reflectionLevel: "minimal"
48
+ }));
49
+ };
50
+ }
5
51
 
6
-
7
-
8
- Object.defineProperty(exports, "createDeclarationTransformer", {
9
- enumerable: true,
10
- get: function () { return chunkBLLXF42T_cjs.createDeclarationTransformer; }
11
- });
12
- Object.defineProperty(exports, "createTransformer", {
13
- enumerable: true,
14
- get: function () { return chunkBLLXF42T_cjs.createTransformer; }
15
- });
52
+ //#endregion
53
+ exports.createDeclarationTransformer = createDeclarationTransformer;
54
+ exports.createTransformer = createTransformer;
@@ -1,7 +1,8 @@
1
- import { ReflectionConfig } from '@deepkit/type-compiler/config';
2
- import { Context } from 'powerlines';
3
- import ts from 'typescript';
1
+ import { Context } from "@powerlines/core";
2
+ import { ReflectionConfig } from "@powerlines/deepkit/vendor/type-compiler/config";
3
+ import ts from "typescript";
4
4
 
5
+ //#region src/transformer.d.ts
5
6
  /**
6
7
  * Creates a Deepkit TypeScript transformer.
7
8
  *
@@ -18,5 +19,6 @@ declare function createTransformer(context: Context, options?: Partial<Reflectio
18
19
  * @returns A Deepkit TypeScript custom declaration transformer factory.
19
20
  */
20
21
  declare function createDeclarationTransformer(context: Context, options?: Partial<ReflectionConfig>): ts.CustomTransformerFactory;
21
-
22
+ //#endregion
22
23
  export { createDeclarationTransformer, createTransformer };
24
+ //# sourceMappingURL=transformer.d.cts.map
@@ -1,7 +1,8 @@
1
- import { ReflectionConfig } from '@deepkit/type-compiler/config';
2
- import { Context } from 'powerlines';
3
- import ts from 'typescript';
1
+ import ts from "typescript";
2
+ import { Context } from "@powerlines/core";
3
+ import { ReflectionConfig } from "@powerlines/deepkit/vendor/type-compiler/config";
4
4
 
5
+ //#region src/transformer.d.ts
5
6
  /**
6
7
  * Creates a Deepkit TypeScript transformer.
7
8
  *
@@ -18,5 +19,6 @@ declare function createTransformer(context: Context, options?: Partial<Reflectio
18
19
  * @returns A Deepkit TypeScript custom declaration transformer factory.
19
20
  */
20
21
  declare function createDeclarationTransformer(context: Context, options?: Partial<ReflectionConfig>): ts.CustomTransformerFactory;
21
-
22
+ //#endregion
22
23
  export { createDeclarationTransformer, createTransformer };
24
+ //# sourceMappingURL=transformer.d.mts.map
@@ -0,0 +1,51 @@
1
+ import { DeclarationTransformer, ReflectionTransformer } from "@powerlines/deepkit/vendor/type-compiler";
2
+ import { Cache } from "@powerlines/deepkit/vendor/type-compiler/compiler";
3
+ import defu from "defu";
4
+
5
+ //#region src/transformer.ts
6
+ let loaded = false;
7
+ const cache = new Cache();
8
+ /**
9
+ * Creates a Deepkit TypeScript transformer.
10
+ *
11
+ * @param context - The Powerlines plugin context.
12
+ * @param options - The transformation options.
13
+ * @returns A Deepkit TypeScript custom transformer factory.
14
+ */
15
+ function createTransformer(context, options = {}) {
16
+ return function transformer(ctx) {
17
+ if (!loaded) loaded = true;
18
+ cache.tick();
19
+ return new ReflectionTransformer(ctx, cache).withReflection(defu(options, {
20
+ reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
21
+ reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
22
+ }, {
23
+ exclude: [],
24
+ reflection: "default",
25
+ reflectionLevel: "minimal"
26
+ }));
27
+ };
28
+ }
29
+ /**
30
+ * Creates a Deepkit TypeScript declaration transformer.
31
+ *
32
+ * @param context - The Powerlines plugin context.
33
+ * @param options - The transformation options.
34
+ * @returns A Deepkit TypeScript custom declaration transformer factory.
35
+ */
36
+ function createDeclarationTransformer(context, options = {}) {
37
+ return function declarationTransformer(ctx) {
38
+ return new DeclarationTransformer(ctx, cache).withReflection(defu(options, {
39
+ reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
40
+ reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
41
+ }, {
42
+ exclude: [],
43
+ reflection: "default",
44
+ reflectionLevel: "minimal"
45
+ }));
46
+ };
47
+ }
48
+
49
+ //#endregion
50
+ export { createDeclarationTransformer, createTransformer };
51
+ //# sourceMappingURL=transformer.mjs.map
@@ -1,12 +1,31 @@
1
- 'use strict';
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-C0xms8kb.cjs');
3
+ const require_transformer = require('./transformer.cjs');
4
+ let typescript = require("typescript");
5
+ typescript = require_chunk.__toESM(typescript);
2
6
 
3
- var chunkHPVJ6OV3_cjs = require('./chunk-HPVJ6OV3.cjs');
4
- require('./chunk-BLLXF42T.cjs');
5
- require('./chunk-USNT2KNT.cjs');
7
+ //#region src/transpile.ts
8
+ /**
9
+ * Transpile TypeScript code using the provided context and options.
10
+ *
11
+ * @param context - The base context containing TypeScript configuration and options.
12
+ * @param code - The TypeScript code to be transpiled.
13
+ * @param id - The identifier for the TypeScript file being transpiled.
14
+ * @param options - Optional configuration for the reflection process.
15
+ * @returns The transpiled output.
16
+ */
17
+ function transpile(context, code, id, options = {}) {
18
+ const transformer = require_transformer.createTransformer(context, options);
19
+ const declarationTransformer = require_transformer.createDeclarationTransformer(context, options);
20
+ return typescript.default.transpileModule(code, {
21
+ compilerOptions: { ...context.tsconfig.options },
22
+ fileName: id,
23
+ transformers: {
24
+ before: [transformer],
25
+ after: [declarationTransformer]
26
+ }
27
+ });
28
+ }
6
29
 
7
-
8
-
9
- Object.defineProperty(exports, "transpile", {
10
- enumerable: true,
11
- get: function () { return chunkHPVJ6OV3_cjs.transpile; }
12
- });
30
+ //#endregion
31
+ exports.transpile = transpile;
@@ -1,7 +1,8 @@
1
- import { ReflectionConfig } from '@powerlines/deepkit/vendor/type-compiler';
2
- import { Context } from 'powerlines';
3
- import ts from 'typescript';
1
+ import { Context } from "@powerlines/core";
2
+ import { ReflectionConfig } from "@powerlines/deepkit/vendor/type-compiler/config";
3
+ import ts from "typescript";
4
4
 
5
+ //#region src/transpile.d.ts
5
6
  /**
6
7
  * Transpile TypeScript code using the provided context and options.
7
8
  *
@@ -12,5 +13,6 @@ import ts from 'typescript';
12
13
  * @returns The transpiled output.
13
14
  */
14
15
  declare function transpile(context: Context, code: string, id: string, options?: Partial<ReflectionConfig>): ts.TranspileOutput;
15
-
16
+ //#endregion
16
17
  export { transpile };
18
+ //# sourceMappingURL=transpile.d.cts.map
@@ -1,7 +1,8 @@
1
- import { ReflectionConfig } from '@powerlines/deepkit/vendor/type-compiler';
2
- import { Context } from 'powerlines';
3
- import ts from 'typescript';
1
+ import ts from "typescript";
2
+ import { Context } from "@powerlines/core";
3
+ import { ReflectionConfig } from "@powerlines/deepkit/vendor/type-compiler/config";
4
4
 
5
+ //#region src/transpile.d.ts
5
6
  /**
6
7
  * Transpile TypeScript code using the provided context and options.
7
8
  *
@@ -12,5 +13,6 @@ import ts from 'typescript';
12
13
  * @returns The transpiled output.
13
14
  */
14
15
  declare function transpile(context: Context, code: string, id: string, options?: Partial<ReflectionConfig>): ts.TranspileOutput;
15
-
16
+ //#endregion
16
17
  export { transpile };
18
+ //# sourceMappingURL=transpile.d.mts.map
@@ -0,0 +1,29 @@
1
+ import { createDeclarationTransformer, createTransformer } from "./transformer.mjs";
2
+ import ts from "typescript";
3
+
4
+ //#region src/transpile.ts
5
+ /**
6
+ * Transpile TypeScript code using the provided context and options.
7
+ *
8
+ * @param context - The base context containing TypeScript configuration and options.
9
+ * @param code - The TypeScript code to be transpiled.
10
+ * @param id - The identifier for the TypeScript file being transpiled.
11
+ * @param options - Optional configuration for the reflection process.
12
+ * @returns The transpiled output.
13
+ */
14
+ function transpile(context, code, id, options = {}) {
15
+ const transformer = createTransformer(context, options);
16
+ const declarationTransformer = createDeclarationTransformer(context, options);
17
+ return ts.transpileModule(code, {
18
+ compilerOptions: { ...context.tsconfig.options },
19
+ fileName: id,
20
+ transformers: {
21
+ before: [transformer],
22
+ after: [declarationTransformer]
23
+ }
24
+ });
25
+ }
26
+
27
+ //#endregion
28
+ export { transpile };
29
+ //# sourceMappingURL=transpile.mjs.map
package/dist/types.cjs CHANGED
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- require('./chunk-ORA4UQMU.cjs');
4
-
package/dist/types.d.cts CHANGED
@@ -1,16 +1,16 @@
1
- import { ReflectionClass } from '@powerlines/deepkit/vendor/type';
2
- import { t as SerializedTypes } from './reflection-9KUpjPqV.cjs';
3
- import '@stryke/capnp';
1
+ import { S as SerializedTypes$1 } from "./reflection-BwdnCwaK.cjs";
2
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
4
3
 
4
+ //#region src/types.d.ts
5
5
  type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
6
- dataBuffer?: ArrayBuffer;
7
- messageRoot?: SerializedTypes;
6
+ dataBuffer?: ArrayBuffer;
7
+ messageRoot?: SerializedTypes$1;
8
8
  };
9
9
  type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
10
- interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {
11
- }
10
+ interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
12
11
  declare type __ΩReflection = any[];
13
12
  declare type __ΩReflectionRecord = any[];
14
13
  declare type __ΩContextReflectionRecord = any[];
15
-
16
- export type { ContextReflectionRecord, Reflection, ReflectionRecord, __ΩContextReflectionRecord, __ΩReflection, __ΩReflectionRecord };
14
+ //#endregion
15
+ export { ContextReflectionRecord, Reflection, ReflectionRecord, __ΩContextReflectionRecord, __ΩReflection, __ΩReflectionRecord };
16
+ //# sourceMappingURL=types.d.cts.map
@@ -1,16 +1,16 @@
1
- import { ReflectionClass } from '@powerlines/deepkit/vendor/type';
2
- import { t as SerializedTypes } from './reflection-9KUpjPqV.js';
3
- import '@stryke/capnp';
1
+ import { S as SerializedTypes$1 } from "./reflection-Chr4fE0i.mjs";
2
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
4
3
 
4
+ //#region src/types.d.ts
5
5
  type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
6
- dataBuffer?: ArrayBuffer;
7
- messageRoot?: SerializedTypes;
6
+ dataBuffer?: ArrayBuffer;
7
+ messageRoot?: SerializedTypes$1;
8
8
  };
9
9
  type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
10
- interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {
11
- }
10
+ interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
12
11
  declare type __ΩReflection = any[];
13
12
  declare type __ΩReflectionRecord = any[];
14
13
  declare type __ΩContextReflectionRecord = any[];
15
-
16
- export type { ContextReflectionRecord, Reflection, ReflectionRecord, __ΩContextReflectionRecord, __ΩReflection, __ΩReflectionRecord };
14
+ //#endregion
15
+ export { ContextReflectionRecord, Reflection, ReflectionRecord, __ΩContextReflectionRecord, __ΩReflection, __ΩReflectionRecord };
16
+ //# sourceMappingURL=types.d.mts.map
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };