@powerlines/deepkit 0.6.166 → 0.7.0

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 (137) 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-D9R8cdSo.d.mts} +26 -32
  23. package/dist/resolve-reflections.cjs +15 -9
  24. package/dist/resolve-reflections.d.cts +4 -2
  25. package/dist/{resolve-reflections.d.ts → resolve-reflections.d.mts} +4 -2
  26. package/dist/resolve-reflections.mjs +16 -0
  27. package/dist/rolldown-plugin.cjs +44 -11
  28. package/dist/rolldown-plugin.d.cts +5 -3
  29. package/dist/{rolldown-plugin.d.ts → rolldown-plugin.d.mts} +5 -3
  30. package/dist/rolldown-plugin.mjs +45 -0
  31. package/dist/transformer.cjs +52 -13
  32. package/dist/transformer.d.cts +6 -4
  33. package/dist/{transformer.d.ts → transformer.d.mts} +6 -4
  34. package/dist/transformer.mjs +51 -0
  35. package/dist/transpile.cjs +29 -10
  36. package/dist/transpile.d.cts +6 -4
  37. package/dist/{transpile.d.ts → transpile.d.mts} +6 -4
  38. package/dist/transpile.mjs +29 -0
  39. package/dist/types.cjs +0 -4
  40. package/dist/types.d.cts +9 -9
  41. package/dist/{types.d.ts → types.d.mts} +9 -9
  42. package/dist/types.mjs +1 -0
  43. package/dist/utilities.cjs +116 -33
  44. package/dist/utilities.d.cts +4 -2
  45. package/dist/{utilities.d.ts → utilities.d.mts} +4 -2
  46. package/dist/utilities.mjs +111 -0
  47. package/dist/vendor/core.cjs +1240 -513
  48. package/dist/vendor/core.mjs +1116 -0
  49. package/dist/vendor/string-BoXo0wS7.cjs +2983 -0
  50. package/dist/vendor/string-BuMgdahD.mjs +2467 -0
  51. package/dist/vendor/type-BMLjRtLY.cjs +202 -0
  52. package/dist/vendor/type-Dgeqs-rL.mjs +190 -0
  53. package/dist/vendor/type-compiler/compiler-BUrWMhGi.cjs +6792 -0
  54. package/dist/vendor/type-compiler/compiler-Bg8jX6qU.mjs +6739 -0
  55. package/dist/vendor/type-compiler/compiler-D1z5h1MK.d.cts +578 -0
  56. package/dist/vendor/type-compiler/compiler-Nkxc4PLJ.d.mts +578 -0
  57. package/dist/vendor/type-compiler/compiler.cjs +11 -43
  58. package/dist/vendor/type-compiler/compiler.d.cts +2 -3
  59. package/dist/vendor/type-compiler/compiler.d.mts +2 -0
  60. package/dist/vendor/type-compiler/compiler.mjs +3 -0
  61. package/dist/vendor/type-compiler/config-BEX924PC.cjs +3709 -0
  62. package/dist/vendor/type-compiler/config-B_cKkYZm.d.cts +116 -0
  63. package/dist/vendor/type-compiler/config-D9DM7Du_.d.mts +116 -0
  64. package/dist/vendor/type-compiler/config-y0HNkbCH.mjs +3640 -0
  65. package/dist/vendor/type-compiler/config.cjs +9 -34
  66. package/dist/vendor/type-compiler/config.d.cts +2 -1
  67. package/dist/vendor/type-compiler/config.d.mts +2 -0
  68. package/dist/vendor/type-compiler/config.mjs +3 -0
  69. package/dist/vendor/type-compiler/index.cjs +56 -129
  70. package/dist/vendor/type-compiler/index.d.cts +22 -3
  71. package/dist/vendor/type-compiler/index.d.mts +22 -0
  72. package/dist/vendor/type-compiler/index.mjs +50 -0
  73. package/dist/vendor/type-spec.cjs +11 -12
  74. package/dist/vendor/type-spec.mjs +3 -0
  75. package/dist/vendor/type.cjs +8407 -17892
  76. package/dist/vendor/type.d.cts +10 -196
  77. package/dist/vendor/{type.d.ts → type.d.mts} +10 -196
  78. package/dist/vendor/type.mjs +9109 -0
  79. package/package.json +43 -31
  80. package/schemas/reflection.cjs +4018 -4129
  81. package/schemas/reflection.d.cts +30 -38
  82. package/schemas/{reflection.d.ts → reflection.d.mts} +30 -38
  83. package/schemas/reflection.mjs +4036 -0
  84. package/dist/capnp.js +0 -2
  85. package/dist/chunk-23YNDVRG.js +0 -34
  86. package/dist/chunk-27RKMKSF.cjs +0 -50
  87. package/dist/chunk-2XDQUCXZ.js +0 -2392
  88. package/dist/chunk-34OFD7LS.cjs +0 -68
  89. package/dist/chunk-7FXYDYVQ.cjs +0 -5246
  90. package/dist/chunk-7QZGCBH7.cjs +0 -11
  91. package/dist/chunk-ALM6UMVU.js +0 -9
  92. package/dist/chunk-BLLXF42T.cjs +0 -41
  93. package/dist/chunk-H3Q3XL3D.js +0 -19
  94. package/dist/chunk-HPVJ6OV3.cjs +0 -31
  95. package/dist/chunk-JQUKKAFM.js +0 -48
  96. package/dist/chunk-KK7TQA7L.cjs +0 -25
  97. package/dist/chunk-NPV2346T.js +0 -25
  98. package/dist/chunk-ORA4UQMU.cjs +0 -2
  99. package/dist/chunk-OUGDFUKJ.cjs +0 -2400
  100. package/dist/chunk-OULCUN6I.js +0 -1
  101. package/dist/chunk-SHUYVCID.js +0 -4
  102. package/dist/chunk-TDYIUJGY.js +0 -5180
  103. package/dist/chunk-USNT2KNT.cjs +0 -6
  104. package/dist/chunk-WYEFKIRL.js +0 -66
  105. package/dist/esbuild-plugin.d.ts +0 -33
  106. package/dist/esbuild-plugin.js +0 -4
  107. package/dist/index.d.ts +0 -19
  108. package/dist/index.js +0 -10
  109. package/dist/reflect-type.js +0 -5
  110. package/dist/resolve-reflections.js +0 -2
  111. package/dist/rolldown-plugin.js +0 -4
  112. package/dist/transformer.js +0 -2
  113. package/dist/transpile.js +0 -3
  114. package/dist/types.js +0 -1
  115. package/dist/utilities.js +0 -2
  116. package/dist/vendor/chunk-5BKT4CS5.js +0 -28
  117. package/dist/vendor/chunk-BLN7QVCP.js +0 -3704
  118. package/dist/vendor/chunk-BR2FK5K7.js +0 -109
  119. package/dist/vendor/chunk-EPQZMVJO.cjs +0 -3859
  120. package/dist/vendor/chunk-IFK6AU6M.cjs +0 -42
  121. package/dist/vendor/chunk-SHDAXCXF.cjs +0 -115
  122. package/dist/vendor/core.js +0 -2
  123. package/dist/vendor/type-compiler/chunk-3LL3TSRJ.js +0 -3762
  124. package/dist/vendor/type-compiler/chunk-CUTGHVNY.js +0 -7100
  125. package/dist/vendor/type-compiler/chunk-IAWCLVUK.cjs +0 -3780
  126. package/dist/vendor/type-compiler/chunk-UIWPG352.cjs +0 -7114
  127. package/dist/vendor/type-compiler/compiler.d.ts +0 -3
  128. package/dist/vendor/type-compiler/compiler.js +0 -5
  129. package/dist/vendor/type-compiler/config.d.ts +0 -1
  130. package/dist/vendor/type-compiler/config.js +0 -5
  131. package/dist/vendor/type-compiler/index.d.ts +0 -3
  132. package/dist/vendor/type-compiler/index.js +0 -66
  133. package/dist/vendor/type-spec.js +0 -2
  134. package/dist/vendor/type.js +0 -18359
  135. package/schemas/reflection.js +0 -4153
  136. /package/dist/vendor/{core.d.ts → core.d.mts} +0 -0
  137. /package/dist/vendor/{type-spec.d.ts → type-spec.d.mts} +0 -0
@@ -1,5 +1,6 @@
1
- import * as $ from '@stryke/capnp';
1
+ import * as $ from "@stryke/capnp";
2
2
 
3
+ //#region schemas/reflection.d.ts
3
4
  declare const ReflectionKind: {
4
5
  readonly NEVER: 0;
5
6
  readonly ANY: 1;
@@ -44,8 +45,7 @@ declare const ReflectionVisibility: {
44
45
  readonly PROTECTED: 1;
45
46
  readonly PRIVATE: 2;
46
47
  };
47
- type ReflectionVisibility =
48
- (typeof ReflectionVisibility)[keyof typeof ReflectionVisibility];
48
+ type ReflectionVisibility = (typeof ReflectionVisibility)[keyof typeof ReflectionVisibility];
49
49
  declare class TagsReflection extends $.Struct {
50
50
  static readonly _capnp: {
51
51
  displayName: string;
@@ -85,8 +85,7 @@ declare const DefaultValueReflection_Value_Which: {
85
85
  readonly FLOAT: 3;
86
86
  readonly STRING: 4;
87
87
  };
88
- type DefaultValueReflection_Value_Which =
89
- (typeof DefaultValueReflection_Value_Which)[keyof typeof DefaultValueReflection_Value_Which];
88
+ type DefaultValueReflection_Value_Which = (typeof DefaultValueReflection_Value_Which)[keyof typeof DefaultValueReflection_Value_Which];
90
89
  declare class DefaultValueReflection_Value extends $.Struct {
91
90
  static readonly UNDEFINED: 0;
92
91
  static readonly BOOLEAN: 1;
@@ -239,9 +238,7 @@ declare class SerializedTypeClassType extends $.Struct {
239
238
  set globalObject(value: boolean);
240
239
  get classType(): string;
241
240
  set classType(value: string);
242
- _adoptExtendsArguments(
243
- value: $.Orphan<$.List<SerializedTypeReference>>
244
- ): void;
241
+ _adoptExtendsArguments(value: $.Orphan<$.List<SerializedTypeReference>>): void;
245
242
  _disownExtendsArguments(): $.Orphan<$.List<SerializedTypeReference>>;
246
243
  get extendsArguments(): $.List<SerializedTypeReference>;
247
244
  _hasExtendsArguments(): boolean;
@@ -1127,9 +1124,9 @@ declare class SerializedTypeLiteralSymbol extends $.Struct {
1127
1124
  size: $.ObjectSize;
1128
1125
  };
1129
1126
  /**
1130
- * "symbol"
1131
- *
1132
- */
1127
+ * "symbol"
1128
+ *
1129
+ */
1133
1130
  get type(): string;
1134
1131
  set type(value: string);
1135
1132
  get name(): string;
@@ -1143,9 +1140,9 @@ declare class SerializedTypeLiteralBigInt extends $.Struct {
1143
1140
  size: $.ObjectSize;
1144
1141
  };
1145
1142
  /**
1146
- * "bigint"
1147
- *
1148
- */
1143
+ * "bigint"
1144
+ *
1145
+ */
1149
1146
  get type(): string;
1150
1147
  set type(value: string);
1151
1148
  get value(): string;
@@ -1159,9 +1156,9 @@ declare class SerializedTypeLiteralRegex extends $.Struct {
1159
1156
  size: $.ObjectSize;
1160
1157
  };
1161
1158
  /**
1162
- * "regex"
1163
- *
1164
- */
1159
+ * "regex"
1160
+ *
1161
+ */
1165
1162
  get type(): string;
1166
1163
  set type(value: string);
1167
1164
  get regex(): string;
@@ -1176,8 +1173,7 @@ declare const SerializedTypeLiteral_Literal_Which: {
1176
1173
  readonly BIGINT: 4;
1177
1174
  readonly REGEX: 5;
1178
1175
  };
1179
- type SerializedTypeLiteral_Literal_Which =
1180
- (typeof SerializedTypeLiteral_Literal_Which)[keyof typeof SerializedTypeLiteral_Literal_Which];
1176
+ type SerializedTypeLiteral_Literal_Which = (typeof SerializedTypeLiteral_Literal_Which)[keyof typeof SerializedTypeLiteral_Literal_Which];
1181
1177
  declare class SerializedTypeLiteral_Literal extends $.Struct {
1182
1178
  static readonly SYMBOL: 0;
1183
1179
  static readonly STRING: 1;
@@ -1332,13 +1328,12 @@ declare const SerializedType_Type_Which: {
1332
1328
  readonly TUPLE_MEMBER: 20;
1333
1329
  readonly REST: 21;
1334
1330
  /**
1335
- * For any other type that is not explicitly defined
1336
- *
1337
- */
1331
+ * For any other type that is not explicitly defined
1332
+ *
1333
+ */
1338
1334
  readonly OTHER: 22;
1339
1335
  };
1340
- type SerializedType_Type_Which =
1341
- (typeof SerializedType_Type_Which)[keyof typeof SerializedType_Type_Which];
1336
+ type SerializedType_Type_Which = (typeof SerializedType_Type_Which)[keyof typeof SerializedType_Type_Which];
1342
1337
  declare class SerializedType_Type extends $.Struct {
1343
1338
  static readonly SIMPLE: 0;
1344
1339
  static readonly LITERAL: 1;
@@ -1473,9 +1468,7 @@ declare class SerializedType_Type extends $.Struct {
1473
1468
  _initIndexSignature(): SerializedTypeIndexSignature;
1474
1469
  get _isIndexSignature(): boolean;
1475
1470
  set indexSignature(value: SerializedTypeIndexSignature);
1476
- _adoptPropertySignature(
1477
- value: $.Orphan<SerializedTypePropertySignature>
1478
- ): void;
1471
+ _adoptPropertySignature(value: $.Orphan<SerializedTypePropertySignature>): void;
1479
1472
  _disownPropertySignature(): $.Orphan<SerializedTypePropertySignature>;
1480
1473
  get propertySignature(): SerializedTypePropertySignature;
1481
1474
  _hasPropertySignature(): boolean;
@@ -1527,9 +1520,9 @@ declare class SerializedType_Type extends $.Struct {
1527
1520
  _adoptOther(value: $.Orphan<SerializedTypeOther>): void;
1528
1521
  _disownOther(): $.Orphan<SerializedTypeOther>;
1529
1522
  /**
1530
- * For any other type that is not explicitly defined
1531
- *
1532
- */
1523
+ * For any other type that is not explicitly defined
1524
+ *
1525
+ */
1533
1526
  get other(): SerializedTypeOther;
1534
1527
  _hasOther(): boolean;
1535
1528
  _initOther(): SerializedTypeOther;
@@ -1563,5 +1556,6 @@ declare class SerializedTypes extends $.Struct {
1563
1556
  set types(value: $.List<SerializedType>);
1564
1557
  toString(): string;
1565
1558
  }
1566
-
1567
- export { DefaultValueReflection as D, IndexAccessOrigin as I, SerializedType as S, TagsReflection as T, SerializedTypeArray as a, SerializedType_Type as b, SerializedTypeClassType as c, SerializedTypeEnum as d, SerializedTypeFunction as e, SerializedTypeInfer as f, SerializedTypeIntersection as g, SerializedTypeLiteral as h, SerializedTypeMethodSignature as i, SerializedTypeObjectLiteral as j, SerializedTypeOther as k, SerializedTypeParameter as l, SerializedTypeProperty as m, SerializedTypePropertySignature as n, SimpleSerializedType as o, SerializedTypeTuple as p, SerializedTypeTupleMember as q, SerializedTypeUnion as r, SerializedTypeMethod as s, SerializedTypes as t };
1559
+ //#endregion
1560
+ export { SimpleSerializedType as C, SerializedTypes as S, SerializedTypePropertySignature as _, SerializedTypeClassType as a, SerializedTypeUnion as b, SerializedTypeInfer as c, SerializedTypeMethod as d, SerializedTypeMethodSignature as f, SerializedTypeProperty as g, SerializedTypeParameter as h, SerializedTypeArray as i, SerializedTypeIntersection as l, SerializedTypeOther as m, IndexAccessOrigin as n, SerializedTypeEnum as o, SerializedTypeObjectLiteral as p, SerializedType as r, SerializedTypeFunction as s, DefaultValueReflection as t, SerializedTypeLiteral as u, SerializedTypeTuple as v, TagsReflection as w, SerializedType_Type as x, SerializedTypeTupleMember as y };
1561
+ //# sourceMappingURL=reflection-D9R8cdSo.d.mts.map
@@ -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
-