@powerlines/deepkit 0.9.23 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esbuild-plugin.d.cts +2 -31
- package/dist/esbuild-plugin.d.mts +2 -31
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/rolldown-plugin.cjs +5 -4
- package/dist/rolldown-plugin.d.cts +7 -3
- package/dist/rolldown-plugin.d.mts +7 -3
- package/dist/rolldown-plugin.mjs +5 -4
- package/dist/types.d.cts +31 -1
- package/dist/types.d.mts +31 -1
- package/package.json +5 -5
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReflectionConfig } from "./types.cjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
import { OnLoadOptions, Plugin } from "esbuild";
|
|
4
4
|
|
|
5
5
|
//#region src/esbuild-plugin.d.ts
|
|
6
|
-
interface ReflectionConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Allows to exclude type definitions/TS files from being included in the type compilation step. When a global .d.ts is matched, their types won't be embedded (useful to exclude DOM for example)
|
|
9
|
-
*/
|
|
10
|
-
exclude?: string[];
|
|
11
|
-
/**
|
|
12
|
-
* Either a boolean indication general reflection mode, or a list of globs to match against.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* - `default`: The default reflection mode, which includes a standard set of type information in the output.
|
|
16
|
-
* - `true`: An alias for "default", enabling the default reflection mode.
|
|
17
|
-
* - `false`: Disables reflection, resulting in no type information being included in the output.
|
|
18
|
-
* - `string[]`: A list of glob patterns to match against files for which reflection should be applied. Only files matching these patterns will have type information included in the output.
|
|
19
|
-
*
|
|
20
|
-
* @defaultValue "default"
|
|
21
|
-
*/
|
|
22
|
-
reflection?: string[] | Mode;
|
|
23
|
-
/**
|
|
24
|
-
* Defines the level of reflection to be used during the transpilation process.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
28
|
-
* - `minimal` - Only the essential type information is captured. (only "hidden", "ignore" and "internal", "readonly")
|
|
29
|
-
* - `default` - Additional type information is captured, including some contextual data. (adds "alias" and "runtime")
|
|
30
|
-
* - `extended` - Even more detailed type information is captured, including extended contextual data. (adds "permissions" and "domain")
|
|
31
|
-
* - `all` - All available type information is captured, including detailed contextual data. (adds "title" and "description")
|
|
32
|
-
*/
|
|
33
|
-
level?: Level;
|
|
34
|
-
}
|
|
35
6
|
interface ESBuildPluginOptions extends Partial<ReflectionConfig> {
|
|
36
7
|
onLoad?: Partial<OnLoadOptions>;
|
|
37
8
|
}
|
|
@@ -44,5 +15,5 @@ interface ESBuildPluginOptions extends Partial<ReflectionConfig> {
|
|
|
44
15
|
*/
|
|
45
16
|
declare const esbuildPlugin: <TContext extends Context>(context: TContext, options?: ESBuildPluginOptions) => Plugin;
|
|
46
17
|
//#endregion
|
|
47
|
-
export { ESBuildPluginOptions,
|
|
18
|
+
export { ESBuildPluginOptions, esbuildPlugin };
|
|
48
19
|
//# sourceMappingURL=esbuild-plugin.d.cts.map
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReflectionConfig } from "./types.mjs";
|
|
2
2
|
import { Context } from "@powerlines/core";
|
|
3
3
|
import { OnLoadOptions, Plugin } from "esbuild";
|
|
4
4
|
|
|
5
5
|
//#region src/esbuild-plugin.d.ts
|
|
6
|
-
interface ReflectionConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Allows to exclude type definitions/TS files from being included in the type compilation step. When a global .d.ts is matched, their types won't be embedded (useful to exclude DOM for example)
|
|
9
|
-
*/
|
|
10
|
-
exclude?: string[];
|
|
11
|
-
/**
|
|
12
|
-
* Either a boolean indication general reflection mode, or a list of globs to match against.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* - `default`: The default reflection mode, which includes a standard set of type information in the output.
|
|
16
|
-
* - `true`: An alias for "default", enabling the default reflection mode.
|
|
17
|
-
* - `false`: Disables reflection, resulting in no type information being included in the output.
|
|
18
|
-
* - `string[]`: A list of glob patterns to match against files for which reflection should be applied. Only files matching these patterns will have type information included in the output.
|
|
19
|
-
*
|
|
20
|
-
* @defaultValue "default"
|
|
21
|
-
*/
|
|
22
|
-
reflection?: string[] | Mode;
|
|
23
|
-
/**
|
|
24
|
-
* Defines the level of reflection to be used during the transpilation process.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
28
|
-
* - `minimal` - Only the essential type information is captured. (only "hidden", "ignore" and "internal", "readonly")
|
|
29
|
-
* - `default` - Additional type information is captured, including some contextual data. (adds "alias" and "runtime")
|
|
30
|
-
* - `extended` - Even more detailed type information is captured, including extended contextual data. (adds "permissions" and "domain")
|
|
31
|
-
* - `all` - All available type information is captured, including detailed contextual data. (adds "title" and "description")
|
|
32
|
-
*/
|
|
33
|
-
level?: Level;
|
|
34
|
-
}
|
|
35
6
|
interface ESBuildPluginOptions extends Partial<ReflectionConfig> {
|
|
36
7
|
onLoad?: Partial<OnLoadOptions>;
|
|
37
8
|
}
|
|
@@ -44,5 +15,5 @@ interface ESBuildPluginOptions extends Partial<ReflectionConfig> {
|
|
|
44
15
|
*/
|
|
45
16
|
declare const esbuildPlugin: <TContext extends Context>(context: TContext, options?: ESBuildPluginOptions) => Plugin;
|
|
46
17
|
//#endregion
|
|
47
|
-
export { ESBuildPluginOptions,
|
|
18
|
+
export { ESBuildPluginOptions, esbuildPlugin };
|
|
48
19
|
//# sourceMappingURL=esbuild-plugin.d.mts.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion } from "./capnp.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { ContextReflectionRecord, Reflection, ReflectionConfig, ReflectionRecord } from "./types.cjs";
|
|
3
|
+
import { ESBuildPluginOptions, esbuildPlugin } from "./esbuild-plugin.cjs";
|
|
3
4
|
import { getReflectionsPath } from "./resolve-reflections.cjs";
|
|
4
|
-
import { rolldownPlugin } from "./rolldown-plugin.cjs";
|
|
5
|
+
import { RolldownPluginOptions, rolldownPlugin } from "./rolldown-plugin.cjs";
|
|
5
6
|
import { createDeclarationTransformer, createTransformer } from "./transformer.cjs";
|
|
6
7
|
import { transpile } from "./transpile.cjs";
|
|
7
|
-
import { ContextReflectionRecord, Reflection, ReflectionRecord } from "./types.cjs";
|
|
8
8
|
import { getEnumReflectionType, getUnionTypes, isStringUnion, kindToName, stringifyDefaultValue, stringifyStringValue, stringifyValue } from "./utilities.cjs";
|
|
9
|
-
export { ContextReflectionRecord, ESBuildPluginOptions, Reflection, ReflectionConfig, ReflectionRecord, WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion, createDeclarationTransformer, createTransformer, esbuildPlugin, getEnumReflectionType, getReflectionsPath, getUnionTypes, isStringUnion, kindToName, rolldownPlugin, stringifyDefaultValue, stringifyStringValue, stringifyValue, transpile };
|
|
9
|
+
export { ContextReflectionRecord, ESBuildPluginOptions, Reflection, ReflectionConfig, ReflectionRecord, RolldownPluginOptions, WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion, createDeclarationTransformer, createTransformer, esbuildPlugin, getEnumReflectionType, getReflectionsPath, getUnionTypes, isStringUnion, kindToName, rolldownPlugin, stringifyDefaultValue, stringifyStringValue, stringifyValue, transpile };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion } from "./capnp.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { ContextReflectionRecord, Reflection, ReflectionConfig, ReflectionRecord } from "./types.mjs";
|
|
3
|
+
import { ESBuildPluginOptions, esbuildPlugin } from "./esbuild-plugin.mjs";
|
|
3
4
|
import { getReflectionsPath } from "./resolve-reflections.mjs";
|
|
4
|
-
import { rolldownPlugin } from "./rolldown-plugin.mjs";
|
|
5
|
+
import { RolldownPluginOptions, rolldownPlugin } from "./rolldown-plugin.mjs";
|
|
5
6
|
import { createDeclarationTransformer, createTransformer } from "./transformer.mjs";
|
|
6
7
|
import { transpile } from "./transpile.mjs";
|
|
7
|
-
import { ContextReflectionRecord, Reflection, ReflectionRecord } from "./types.mjs";
|
|
8
8
|
import { getEnumReflectionType, getUnionTypes, isStringUnion, kindToName, stringifyDefaultValue, stringifyStringValue, stringifyValue } from "./utilities.mjs";
|
|
9
|
-
export { ContextReflectionRecord, ESBuildPluginOptions, Reflection, ReflectionConfig, ReflectionRecord, WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion, createDeclarationTransformer, createTransformer, esbuildPlugin, getEnumReflectionType, getReflectionsPath, getUnionTypes, isStringUnion, kindToName, rolldownPlugin, stringifyDefaultValue, stringifyStringValue, stringifyValue, transpile };
|
|
9
|
+
export { ContextReflectionRecord, ESBuildPluginOptions, Reflection, ReflectionConfig, ReflectionRecord, RolldownPluginOptions, WithIndexAccessOrigin, WithTagsReflection, convertFromCapnp, convertFromCapnpArray, convertFromCapnpBase, convertFromCapnpClassType, convertFromCapnpDefault, convertFromCapnpEnum, convertFromCapnpFunction, convertFromCapnpIndexAccessOrigin, convertFromCapnpInfer, convertFromCapnpIntersection, convertFromCapnpLiteral, convertFromCapnpMethodSignature, convertFromCapnpObjectLiteral, convertFromCapnpOther, convertFromCapnpParameter, convertFromCapnpProperty, convertFromCapnpPropertySignature, convertFromCapnpSimple, convertFromCapnpTagsReflection, convertFromCapnpTuple, convertFromCapnpTupleMember, convertFromCapnpUnion, convertToCapnp, convertToCapnpArray, convertToCapnpBase, convertToCapnpClassType, convertToCapnpDefault, convertToCapnpEnum, convertToCapnpFunction, convertToCapnpIndexAccessOrigin, convertToCapnpInfer, convertToCapnpIntersection, convertToCapnpLiteral, convertToCapnpMethod, convertToCapnpMethodSignature, convertToCapnpObjectLiteral, convertToCapnpOther, convertToCapnpParameter, convertToCapnpProperty, convertToCapnpPropertySignature, convertToCapnpSimple, convertToCapnpTagsReflection, convertToCapnpTuple, convertToCapnpTupleMember, convertToCapnpUnion, createDeclarationTransformer, createTransformer, esbuildPlugin, getEnumReflectionType, getReflectionsPath, getUnionTypes, isStringUnion, kindToName, rolldownPlugin, stringifyDefaultValue, stringifyStringValue, stringifyValue, transpile };
|
package/dist/rolldown-plugin.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_chunk = require('./chunk-tvSNC7pH.cjs');
|
|
3
3
|
const require_transpile = require('./transpile.cjs');
|
|
4
4
|
let _stryke_type_checks = require("@stryke/type-checks");
|
|
5
|
+
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
5
6
|
let typescript = require("typescript");
|
|
6
7
|
let _stryke_path = require("@stryke/path");
|
|
7
8
|
|
|
@@ -10,23 +11,23 @@ let _stryke_path = require("@stryke/path");
|
|
|
10
11
|
* Rolldown plugin for Deepkit Type reflections.
|
|
11
12
|
*
|
|
12
13
|
* @param context - The Powerlines context.
|
|
13
|
-
* @param
|
|
14
|
+
* @param options - Optional Rolldown plugin options, including filter and reflection configuration.
|
|
14
15
|
* @returns A Rolldown plugin instance.
|
|
15
16
|
*/
|
|
16
|
-
const rolldownPlugin = (context,
|
|
17
|
+
const rolldownPlugin = (context, options = {}) => {
|
|
17
18
|
return {
|
|
18
19
|
name: "powerlines:deepkit",
|
|
19
20
|
load: {
|
|
20
21
|
filter: {
|
|
21
22
|
id: /\.(m|c)?tsx?$/,
|
|
22
|
-
...filter
|
|
23
|
+
...options.filter
|
|
23
24
|
},
|
|
24
25
|
async handler(id) {
|
|
25
26
|
const path = await context.resolve(id);
|
|
26
27
|
if (!path?.id) return null;
|
|
27
28
|
const contents = await context.fs.read(path.id);
|
|
28
29
|
if (!contents) return null;
|
|
29
|
-
const result = require_transpile.transpile(context, contents, path.id);
|
|
30
|
+
const result = require_transpile.transpile(context, contents, path.id, (0, _stryke_helpers_omit.omit)(options, ["filter"]));
|
|
30
31
|
if (result.diagnostics && result.diagnostics.length > 0) if (result.diagnostics.some((d) => d.category === typescript.DiagnosticCategory.Error)) {
|
|
31
32
|
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
33
|
context.error(errorMessage);
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { ReflectionConfig } from "./types.cjs";
|
|
1
2
|
import { Context } from "@powerlines/core";
|
|
2
3
|
import { HookFilter, Plugin } from "rolldown";
|
|
3
4
|
|
|
4
5
|
//#region src/rolldown-plugin.d.ts
|
|
6
|
+
interface RolldownPluginOptions extends Partial<ReflectionConfig> {
|
|
7
|
+
filter?: Partial<Pick<HookFilter, "id">>;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Rolldown plugin for Deepkit Type reflections.
|
|
7
11
|
*
|
|
8
12
|
* @param context - The Powerlines context.
|
|
9
|
-
* @param
|
|
13
|
+
* @param options - Optional Rolldown plugin options, including filter and reflection configuration.
|
|
10
14
|
* @returns A Rolldown plugin instance.
|
|
11
15
|
*/
|
|
12
|
-
declare const rolldownPlugin: (context: Context,
|
|
16
|
+
declare const rolldownPlugin: (context: Context, options?: RolldownPluginOptions) => Plugin;
|
|
13
17
|
//#endregion
|
|
14
|
-
export { rolldownPlugin };
|
|
18
|
+
export { RolldownPluginOptions, rolldownPlugin };
|
|
15
19
|
//# sourceMappingURL=rolldown-plugin.d.cts.map
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { ReflectionConfig } from "./types.mjs";
|
|
1
2
|
import { Context } from "@powerlines/core";
|
|
2
3
|
import { HookFilter, Plugin } from "rolldown";
|
|
3
4
|
|
|
4
5
|
//#region src/rolldown-plugin.d.ts
|
|
6
|
+
interface RolldownPluginOptions extends Partial<ReflectionConfig> {
|
|
7
|
+
filter?: Partial<Pick<HookFilter, "id">>;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Rolldown plugin for Deepkit Type reflections.
|
|
7
11
|
*
|
|
8
12
|
* @param context - The Powerlines context.
|
|
9
|
-
* @param
|
|
13
|
+
* @param options - Optional Rolldown plugin options, including filter and reflection configuration.
|
|
10
14
|
* @returns A Rolldown plugin instance.
|
|
11
15
|
*/
|
|
12
|
-
declare const rolldownPlugin: (context: Context,
|
|
16
|
+
declare const rolldownPlugin: (context: Context, options?: RolldownPluginOptions) => Plugin;
|
|
13
17
|
//#endregion
|
|
14
|
-
export { rolldownPlugin };
|
|
18
|
+
export { RolldownPluginOptions, rolldownPlugin };
|
|
15
19
|
//# sourceMappingURL=rolldown-plugin.d.mts.map
|
package/dist/rolldown-plugin.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { transpile } from "./transpile.mjs";
|
|
2
2
|
import { isString } from "@stryke/type-checks";
|
|
3
|
+
import { omit } from "@stryke/helpers/omit";
|
|
3
4
|
import { DiagnosticCategory } from "typescript";
|
|
4
5
|
import { findFileExtension } from "@stryke/path";
|
|
5
6
|
|
|
@@ -8,23 +9,23 @@ import { findFileExtension } from "@stryke/path";
|
|
|
8
9
|
* Rolldown plugin for Deepkit Type reflections.
|
|
9
10
|
*
|
|
10
11
|
* @param context - The Powerlines context.
|
|
11
|
-
* @param
|
|
12
|
+
* @param options - Optional Rolldown plugin options, including filter and reflection configuration.
|
|
12
13
|
* @returns A Rolldown plugin instance.
|
|
13
14
|
*/
|
|
14
|
-
const rolldownPlugin = (context,
|
|
15
|
+
const rolldownPlugin = (context, options = {}) => {
|
|
15
16
|
return {
|
|
16
17
|
name: "powerlines:deepkit",
|
|
17
18
|
load: {
|
|
18
19
|
filter: {
|
|
19
20
|
id: /\.(m|c)?tsx?$/,
|
|
20
|
-
...filter
|
|
21
|
+
...options.filter
|
|
21
22
|
},
|
|
22
23
|
async handler(id) {
|
|
23
24
|
const path = await context.resolve(id);
|
|
24
25
|
if (!path?.id) return null;
|
|
25
26
|
const contents = await context.fs.read(path.id);
|
|
26
27
|
if (!contents) return null;
|
|
27
|
-
const result = transpile(context, contents, path.id);
|
|
28
|
+
const result = transpile(context, contents, path.id, omit(options, ["filter"]));
|
|
28
29
|
if (result.diagnostics && result.diagnostics.length > 0) if (result.diagnostics.some((d) => d.category === DiagnosticCategory.Error)) {
|
|
29
30
|
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
31
|
context.error(errorMessage);
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { S as SerializedTypes$1 } from "./reflection-8fgblw1P.cjs";
|
|
2
|
+
import { n as Mode, t as Level } from "./config-BV0kS7rg.cjs";
|
|
2
3
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
4
|
|
|
4
5
|
//#region src/types.d.ts
|
|
6
|
+
interface ReflectionConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Allows to exclude type definitions/TS files from being included in the type compilation step. When a global .d.ts is matched, their types won't be embedded (useful to exclude DOM for example)
|
|
9
|
+
*/
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Either a boolean indication general reflection mode, or a list of globs to match against.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* - `default`: The default reflection mode, which includes a standard set of type information in the output.
|
|
16
|
+
* - `true`: An alias for "default", enabling the default reflection mode.
|
|
17
|
+
* - `false`: Disables reflection, resulting in no type information being included in the output.
|
|
18
|
+
* - `string[]`: A list of glob patterns to match against files for which reflection should be applied. Only files matching these patterns will have type information included in the output.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "default"
|
|
21
|
+
*/
|
|
22
|
+
reflection?: string[] | Mode;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
28
|
+
* - `minimal` - Only the essential type information is captured. (only "hidden", "ignore" and "internal", "readonly")
|
|
29
|
+
* - `default` - Additional type information is captured, including some contextual data. (adds "alias" and "runtime")
|
|
30
|
+
* - `extended` - Even more detailed type information is captured, including extended contextual data. (adds "permissions" and "domain")
|
|
31
|
+
* - `all` - All available type information is captured, including detailed contextual data. (adds "title" and "description")
|
|
32
|
+
*/
|
|
33
|
+
level?: Level;
|
|
34
|
+
}
|
|
5
35
|
type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
|
|
6
36
|
dataBuffer?: ArrayBuffer;
|
|
7
37
|
messageRoot?: SerializedTypes$1;
|
|
@@ -9,5 +39,5 @@ type Reflection<T extends Record<string, any> = Record<string, any>> = Reflectio
|
|
|
9
39
|
type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
|
|
10
40
|
interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
|
|
11
41
|
//#endregion
|
|
12
|
-
export { ContextReflectionRecord, Reflection, ReflectionRecord };
|
|
42
|
+
export { ContextReflectionRecord, Reflection, ReflectionConfig, ReflectionRecord };
|
|
13
43
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { S as SerializedTypes$1 } from "./reflection-l3nKKCgX.mjs";
|
|
2
|
+
import { n as Mode, t as Level } from "./config-Q196_hzX.mjs";
|
|
2
3
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
4
|
|
|
4
5
|
//#region src/types.d.ts
|
|
6
|
+
interface ReflectionConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Allows to exclude type definitions/TS files from being included in the type compilation step. When a global .d.ts is matched, their types won't be embedded (useful to exclude DOM for example)
|
|
9
|
+
*/
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Either a boolean indication general reflection mode, or a list of globs to match against.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* - `default`: The default reflection mode, which includes a standard set of type information in the output.
|
|
16
|
+
* - `true`: An alias for "default", enabling the default reflection mode.
|
|
17
|
+
* - `false`: Disables reflection, resulting in no type information being included in the output.
|
|
18
|
+
* - `string[]`: A list of glob patterns to match against files for which reflection should be applied. Only files matching these patterns will have type information included in the output.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue "default"
|
|
21
|
+
*/
|
|
22
|
+
reflection?: string[] | Mode;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
28
|
+
* - `minimal` - Only the essential type information is captured. (only "hidden", "ignore" and "internal", "readonly")
|
|
29
|
+
* - `default` - Additional type information is captured, including some contextual data. (adds "alias" and "runtime")
|
|
30
|
+
* - `extended` - Even more detailed type information is captured, including extended contextual data. (adds "permissions" and "domain")
|
|
31
|
+
* - `all` - All available type information is captured, including detailed contextual data. (adds "title" and "description")
|
|
32
|
+
*/
|
|
33
|
+
level?: Level;
|
|
34
|
+
}
|
|
5
35
|
type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
|
|
6
36
|
dataBuffer?: ArrayBuffer;
|
|
7
37
|
messageRoot?: SerializedTypes$1;
|
|
@@ -9,5 +39,5 @@ type Reflection<T extends Record<string, any> = Record<string, any>> = Reflectio
|
|
|
9
39
|
type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
|
|
10
40
|
interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
|
|
11
41
|
//#endregion
|
|
12
|
-
export { ContextReflectionRecord, Reflection, ReflectionRecord };
|
|
42
|
+
export { ContextReflectionRecord, Reflection, ReflectionConfig, ReflectionRecord };
|
|
13
43
|
//# sourceMappingURL=types.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/deepkit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": ["deepkit", "powerlines", "storm-software"],
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
"bin": { "deepkit-install": "bin/deepkit-install.cjs" },
|
|
115
115
|
"files": ["bin", "dist", "schemas"],
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@powerlines/core": "^0.15.
|
|
118
|
-
"@storm-software/config-tools": "^1.190.
|
|
117
|
+
"@powerlines/core": "^0.15.26",
|
|
118
|
+
"@storm-software/config-tools": "^1.190.21",
|
|
119
119
|
"@stryke/capnp": "^0.12.102",
|
|
120
120
|
"@stryke/fs": "^0.33.76",
|
|
121
121
|
"@stryke/path": "^0.29.3",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"@deepkit/type": "1.0.5",
|
|
134
134
|
"@deepkit/type-compiler": "1.0.5",
|
|
135
135
|
"@deepkit/type-spec": "1.0.1",
|
|
136
|
-
"@types/node": "^25.9.
|
|
136
|
+
"@types/node": "^25.9.1",
|
|
137
137
|
"rolldown": "^1.0.1",
|
|
138
138
|
"tsdown": "^0.22.0",
|
|
139
139
|
"esbuild": "^0.27.7"
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"rolldown": { "optional": true }
|
|
145
145
|
},
|
|
146
146
|
"publishConfig": { "access": "public" },
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "830de55572504e17339908e5379e3725c56e42e9"
|
|
148
148
|
}
|