@powerlines/plugin-alloy 0.17.6 → 0.18.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.
- package/dist/_virtual/rolldown_runtime.cjs +8 -0
- package/dist/_virtual/rolldown_runtime.mjs +29 -0
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/components/single-line-comment.d.mts +2 -2
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/core/contexts/reflection.d.cts +8 -7
- package/dist/core/contexts/reflection.d.mts +8 -7
- package/dist/deepkit/src/utilities.cjs +42 -41
- package/dist/deepkit/src/utilities.mjs +42 -41
- package/dist/deepkit/src/vendor/core.cjs +20 -0
- package/dist/deepkit/src/vendor/core.mjs +11 -0
- package/dist/deepkit/src/vendor/type.cjs +20 -0
- package/dist/deepkit/src/vendor/type.d.cts +7 -0
- package/dist/deepkit/src/vendor/type.d.mts +7 -0
- package/dist/deepkit/src/vendor/type.mjs +11 -0
- package/dist/helpers/capnp.cjs +20 -18
- package/dist/helpers/capnp.d.cts +14 -13
- package/dist/helpers/capnp.d.mts +14 -13
- package/dist/helpers/capnp.mjs +20 -18
- package/dist/helpers/typescript.d.cts +3 -1
- package/dist/helpers/typescript.d.mts +3 -1
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/types/components.d.cts +6 -2
- package/dist/types/components.d.mts +6 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/typescript-file.cjs +2 -1
- package/dist/typescript/components/typescript-file.mjs +2 -1
- package/dist/typescript/components/typescript-interface.cjs +2 -1
- package/dist/typescript/components/typescript-interface.d.cts +6 -5
- package/dist/typescript/components/typescript-interface.d.mts +6 -5
- package/dist/typescript/components/typescript-interface.mjs +2 -1
- package/dist/typescript/components/typescript-object.d.cts +6 -5
- package/dist/typescript/components/typescript-object.d.mts +6 -5
- package/package.json +3 -3
|
@@ -19,6 +19,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
}
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
23
|
+
if (symbols) {
|
|
24
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
26
|
+
}
|
|
27
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
28
|
+
};
|
|
22
29
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
30
|
value: mod,
|
|
24
31
|
enumerable: true
|
|
@@ -26,4 +33,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
33
|
|
|
27
34
|
//#endregion
|
|
28
35
|
|
|
36
|
+
exports.__reExport = __reExport;
|
|
29
37
|
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
+
key = keys[i];
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
11
|
+
__defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
21
|
+
if (symbols) {
|
|
22
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
+
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
}
|
|
25
|
+
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { __reExport };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluginContext } from "../../powerlines/src/types/context.mjs";
|
|
2
2
|
import { MetaItem } from "../contexts/context.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
4
|
import { OutputProps as OutputProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/output.d.ts
|
|
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
|
|
|
17
17
|
/**
|
|
18
18
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
19
19
|
*/
|
|
20
|
-
declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>):
|
|
20
|
+
declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core0.Children;
|
|
21
21
|
declare type __ΩOutputProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { Output, OutputProps, __ΩOutputProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/core/components/single-line-comment.d.ts
|
|
5
5
|
type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
|
|
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
|
|
|
15
15
|
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
16
16
|
* are broken into multiple lines
|
|
17
17
|
*/
|
|
18
|
-
declare function SingleLineComment(props: SingleLineCommentProps):
|
|
18
|
+
declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core1.Children;
|
|
19
19
|
declare type __ΩSingleLineCommentVariant = any[];
|
|
20
20
|
declare type __ΩSingleLineCommentProps = any[];
|
|
21
21
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/core/components/single-line-comment.d.ts
|
|
5
5
|
type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
|
|
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
|
|
|
15
15
|
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
16
16
|
* are broken into multiple lines
|
|
17
17
|
*/
|
|
18
|
-
declare function SingleLineComment(props: SingleLineCommentProps):
|
|
18
|
+
declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core1.Children;
|
|
19
19
|
declare type __ΩSingleLineCommentVariant = any[];
|
|
20
20
|
declare type __ΩSingleLineCommentProps = any[];
|
|
21
21
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StoragePreset } from "../../powerlines/src/types/fs.cjs";
|
|
2
2
|
import { ComponentProps } from "../../types/components.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
4
|
import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/source-file.d.ts
|
|
@@ -26,7 +26,7 @@ type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
|
26
26
|
* @param props - The properties for the source file.
|
|
27
27
|
* @returns The rendered source file component.
|
|
28
28
|
*/
|
|
29
|
-
declare function SourceFile(props: SourceFileProps):
|
|
29
|
+
declare function SourceFile(props: SourceFileProps): _alloy_js_core0.Children;
|
|
30
30
|
declare type __ΩSourceFileProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SourceFile, SourceFileProps, __ΩSourceFileProps };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReflectionOverrideInterface } from "../../types/components.cjs";
|
|
2
|
+
import { type_d_exports } from "../../deepkit/src/vendor/type.cjs";
|
|
2
3
|
import { ComponentContext } from "@alloy-js/core";
|
|
3
4
|
|
|
4
5
|
//#region src/core/contexts/reflection.d.ts
|
|
5
6
|
interface ReflectionClassContextInterface<T extends Record<string, any> = Record<string, any>> {
|
|
6
|
-
reflection: ReflectionClass<T>;
|
|
7
|
+
reflection: type_d_exports.ReflectionClass<T>;
|
|
7
8
|
override?: ReflectionOverrideInterface<T>;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
@@ -19,33 +20,33 @@ declare function useReflectionClass<T extends Record<string, any> = Record<strin
|
|
|
19
20
|
/**
|
|
20
21
|
* The reflection property context used in template rendering.
|
|
21
22
|
*/
|
|
22
|
-
declare const ReflectionPropertyContext: ComponentContext<ReflectionProperty>;
|
|
23
|
+
declare const ReflectionPropertyContext: ComponentContext<type_d_exports.ReflectionProperty>;
|
|
23
24
|
/**
|
|
24
25
|
* Hook to access the Reflection Property context.
|
|
25
26
|
*
|
|
26
27
|
* @returns A reactive version of the current reflection.
|
|
27
28
|
*/
|
|
28
|
-
declare function useReflectionProperty(): ReflectionProperty;
|
|
29
|
+
declare function useReflectionProperty(): type_d_exports.ReflectionProperty;
|
|
29
30
|
/**
|
|
30
31
|
* The reflection method context used in template rendering.
|
|
31
32
|
*/
|
|
32
|
-
declare const ReflectionMethodContext: ComponentContext<ReflectionMethod>;
|
|
33
|
+
declare const ReflectionMethodContext: ComponentContext<type_d_exports.ReflectionMethod>;
|
|
33
34
|
/**
|
|
34
35
|
* Hook to access the Reflection Method context.
|
|
35
36
|
*
|
|
36
37
|
* @returns A reactive version of the current reflection.
|
|
37
38
|
*/
|
|
38
|
-
declare function useReflectionMethod(): ReflectionMethod;
|
|
39
|
+
declare function useReflectionMethod(): type_d_exports.ReflectionMethod;
|
|
39
40
|
/**
|
|
40
41
|
* The reflection parameter context used in template rendering.
|
|
41
42
|
*/
|
|
42
|
-
declare const ReflectionParameterContext: ComponentContext<ReflectionParameter>;
|
|
43
|
+
declare const ReflectionParameterContext: ComponentContext<type_d_exports.ReflectionParameter>;
|
|
43
44
|
/**
|
|
44
45
|
* Hook to access the Reflection Parameter context.
|
|
45
46
|
*
|
|
46
47
|
* @returns A reactive version of the current reflection.
|
|
47
48
|
*/
|
|
48
|
-
declare function useReflectionParameter(): ReflectionParameter;
|
|
49
|
+
declare function useReflectionParameter(): type_d_exports.ReflectionParameter;
|
|
49
50
|
declare type __ΩReflectionClassContextInterface = any[];
|
|
50
51
|
//#endregion
|
|
51
52
|
export { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReflectionOverrideInterface } from "../../types/components.mjs";
|
|
2
|
+
import { type_d_exports } from "../../deepkit/src/vendor/type.mjs";
|
|
2
3
|
import { ComponentContext } from "@alloy-js/core";
|
|
3
4
|
|
|
4
5
|
//#region src/core/contexts/reflection.d.ts
|
|
5
6
|
interface ReflectionClassContextInterface<T extends Record<string, any> = Record<string, any>> {
|
|
6
|
-
reflection: ReflectionClass<T>;
|
|
7
|
+
reflection: type_d_exports.ReflectionClass<T>;
|
|
7
8
|
override?: ReflectionOverrideInterface<T>;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
@@ -19,33 +20,33 @@ declare function useReflectionClass<T extends Record<string, any> = Record<strin
|
|
|
19
20
|
/**
|
|
20
21
|
* The reflection property context used in template rendering.
|
|
21
22
|
*/
|
|
22
|
-
declare const ReflectionPropertyContext: ComponentContext<ReflectionProperty>;
|
|
23
|
+
declare const ReflectionPropertyContext: ComponentContext<type_d_exports.ReflectionProperty>;
|
|
23
24
|
/**
|
|
24
25
|
* Hook to access the Reflection Property context.
|
|
25
26
|
*
|
|
26
27
|
* @returns A reactive version of the current reflection.
|
|
27
28
|
*/
|
|
28
|
-
declare function useReflectionProperty(): ReflectionProperty;
|
|
29
|
+
declare function useReflectionProperty(): type_d_exports.ReflectionProperty;
|
|
29
30
|
/**
|
|
30
31
|
* The reflection method context used in template rendering.
|
|
31
32
|
*/
|
|
32
|
-
declare const ReflectionMethodContext: ComponentContext<ReflectionMethod>;
|
|
33
|
+
declare const ReflectionMethodContext: ComponentContext<type_d_exports.ReflectionMethod>;
|
|
33
34
|
/**
|
|
34
35
|
* Hook to access the Reflection Method context.
|
|
35
36
|
*
|
|
36
37
|
* @returns A reactive version of the current reflection.
|
|
37
38
|
*/
|
|
38
|
-
declare function useReflectionMethod(): ReflectionMethod;
|
|
39
|
+
declare function useReflectionMethod(): type_d_exports.ReflectionMethod;
|
|
39
40
|
/**
|
|
40
41
|
* The reflection parameter context used in template rendering.
|
|
41
42
|
*/
|
|
42
|
-
declare const ReflectionParameterContext: ComponentContext<ReflectionParameter>;
|
|
43
|
+
declare const ReflectionParameterContext: ComponentContext<type_d_exports.ReflectionParameter>;
|
|
43
44
|
/**
|
|
44
45
|
* Hook to access the Reflection Parameter context.
|
|
45
46
|
*
|
|
46
47
|
* @returns A reactive version of the current reflection.
|
|
47
48
|
*/
|
|
48
|
-
declare function useReflectionParameter(): ReflectionParameter;
|
|
49
|
+
declare function useReflectionParameter(): type_d_exports.ReflectionParameter;
|
|
49
50
|
declare type __ΩReflectionClassContextInterface = any[];
|
|
50
51
|
//#endregion
|
|
51
52
|
export { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_type = require('./vendor/type.cjs');
|
|
2
3
|
let __stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
3
4
|
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
4
5
|
let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
@@ -33,7 +34,7 @@ function stringifyStringValue(value) {
|
|
|
33
34
|
* @returns A string representation of the value.
|
|
34
35
|
*/
|
|
35
36
|
function stringifyValue(type, value) {
|
|
36
|
-
return (0, __stryke_type_checks_is_undefined.isUndefined)(value) ? "undefined" : (0, __stryke_type_checks_is_null.isNull)(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(__stryke_json_storm_json.StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? __stryke_json_storm_json.StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
37
|
+
return (0, __stryke_type_checks_is_undefined.isUndefined)(value) ? "undefined" : (0, __stryke_type_checks_is_null.isNull)(value) ? "null" : type.kind === require_type.type_exports.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === require_type.type_exports.ReflectionKind.string || type.kind === require_type.type_exports.ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(type.literal) ? stringifyStringValue(value) : type.kind === require_type.type_exports.ReflectionKind.enum ? getEnumReflectionType(type).kind === require_type.type_exports.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === require_type.type_exports.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === require_type.type_exports.ReflectionKind.array ? stringifyStringValue(__stryke_json_storm_json.StormJSON.stringify(value)) : type.kind === require_type.type_exports.ReflectionKind.object || type.kind === require_type.type_exports.ReflectionKind.objectLiteral ? __stryke_json_storm_json.StormJSON.stringify(value) : type.kind === require_type.type_exports.ReflectionKind.property || type.kind === require_type.type_exports.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* Converts a {@link TypeEnum} to its underlying primitive type representation.
|
|
@@ -42,10 +43,10 @@ function stringifyValue(type, value) {
|
|
|
42
43
|
* @returns A string representation of the primitive type.
|
|
43
44
|
*/
|
|
44
45
|
function getEnumReflectionType(type) {
|
|
45
|
-
if (type.kind !== ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
46
|
-
const unique = (0, __stryke_helpers_get_unique.getUniqueBy)(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => (0, __stryke_type_checks_is_string.isString)(enumMember) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number });
|
|
46
|
+
if (type.kind !== require_type.type_exports.ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
47
|
+
const unique = (0, __stryke_helpers_get_unique.getUniqueBy)(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => (0, __stryke_type_checks_is_string.isString)(enumMember) ? { kind: require_type.type_exports.ReflectionKind.string } : { kind: require_type.type_exports.ReflectionKind.number });
|
|
47
48
|
if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
|
|
48
|
-
return unique[0] && (0, __stryke_type_checks_is_string.isString)(unique[0]) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number };
|
|
49
|
+
return unique[0] && (0, __stryke_type_checks_is_string.isString)(unique[0]) ? { kind: require_type.type_exports.ReflectionKind.string } : { kind: require_type.type_exports.ReflectionKind.number };
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* Converts a {@link TypeUnion} to its underlying primitive type representation.
|
|
@@ -54,11 +55,11 @@ function getEnumReflectionType(type) {
|
|
|
54
55
|
* @returns A string representation of the primitive type.
|
|
55
56
|
*/
|
|
56
57
|
function getUnionTypes(type) {
|
|
57
|
-
if (type.kind === ReflectionKind.union && type.types.length > 0) return (0, __stryke_helpers_get_unique.getUniqueBy)(type.types, (member) => member.kind);
|
|
58
|
+
if (type.kind === require_type.type_exports.ReflectionKind.union && type.types.length > 0) return (0, __stryke_helpers_get_unique.getUniqueBy)(type.types, (member) => member.kind);
|
|
58
59
|
throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
|
|
59
60
|
}
|
|
60
61
|
function isStringUnion(type) {
|
|
61
|
-
return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(member.literal));
|
|
62
|
+
return getUnionTypes(type).some((member) => member.kind === require_type.type_exports.ReflectionKind.string || member.kind === require_type.type_exports.ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(member.literal));
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
65
|
* Converts a ReflectionKind to its string representation.
|
|
@@ -67,41 +68,41 @@ function isStringUnion(type) {
|
|
|
67
68
|
* @returns A string representation of the kind.
|
|
68
69
|
*/
|
|
69
70
|
function kindToName(kind) {
|
|
70
|
-
if (kind === ReflectionKind.void) return "void";
|
|
71
|
-
else if (kind === ReflectionKind.never) return "never";
|
|
72
|
-
else if (kind === ReflectionKind.null) return "null";
|
|
73
|
-
else if (kind === ReflectionKind.undefined) return "undefined";
|
|
74
|
-
else if (kind === ReflectionKind.symbol) return "symbol";
|
|
75
|
-
else if (kind === ReflectionKind.bigint) return "bigint";
|
|
76
|
-
else if (kind === ReflectionKind.number) return "number";
|
|
77
|
-
else if (kind === ReflectionKind.string) return "string";
|
|
78
|
-
else if (kind === ReflectionKind.boolean) return "boolean";
|
|
79
|
-
else if (kind === ReflectionKind.literal) return "literal";
|
|
80
|
-
else if (kind === ReflectionKind.class) return "class";
|
|
81
|
-
else if (kind === ReflectionKind.array) return "array";
|
|
82
|
-
else if (kind === ReflectionKind.object) return "object";
|
|
83
|
-
else if (kind === ReflectionKind.objectLiteral) return "objectLiteral";
|
|
84
|
-
else if (kind === ReflectionKind.union) return "union";
|
|
85
|
-
else if (kind === ReflectionKind.enum) return "enum";
|
|
86
|
-
else if (kind === ReflectionKind.regexp) return "regexp";
|
|
87
|
-
else if (kind === ReflectionKind.templateLiteral) return "templateLiteral";
|
|
88
|
-
else if (kind === ReflectionKind.property) return "property";
|
|
89
|
-
else if (kind === ReflectionKind.method) return "method";
|
|
90
|
-
else if (kind === ReflectionKind.function) return "function";
|
|
91
|
-
else if (kind === ReflectionKind.parameter) return "parameter";
|
|
92
|
-
else if (kind === ReflectionKind.promise) return "promise";
|
|
93
|
-
else if (kind === ReflectionKind.typeParameter) return "typeParameter";
|
|
94
|
-
else if (kind === ReflectionKind.tuple) return "tuple";
|
|
95
|
-
else if (kind === ReflectionKind.tupleMember) return "tupleMember";
|
|
96
|
-
else if (kind === ReflectionKind.enumMember) return "enumMember";
|
|
97
|
-
else if (kind === ReflectionKind.rest) return "rest";
|
|
98
|
-
else if (kind === ReflectionKind.indexSignature) return "indexSignature";
|
|
99
|
-
else if (kind === ReflectionKind.propertySignature) return "propertySignature";
|
|
100
|
-
else if (kind === ReflectionKind.methodSignature) return "methodSignature";
|
|
101
|
-
else if (kind === ReflectionKind.infer) return "infer";
|
|
102
|
-
else if (kind === ReflectionKind.callSignature) return "callSignature";
|
|
103
|
-
else if (kind === ReflectionKind.any) return "any";
|
|
104
|
-
else if (kind === ReflectionKind.intersection) return "intersection";
|
|
71
|
+
if (kind === require_type.type_exports.ReflectionKind.void) return "void";
|
|
72
|
+
else if (kind === require_type.type_exports.ReflectionKind.never) return "never";
|
|
73
|
+
else if (kind === require_type.type_exports.ReflectionKind.null) return "null";
|
|
74
|
+
else if (kind === require_type.type_exports.ReflectionKind.undefined) return "undefined";
|
|
75
|
+
else if (kind === require_type.type_exports.ReflectionKind.symbol) return "symbol";
|
|
76
|
+
else if (kind === require_type.type_exports.ReflectionKind.bigint) return "bigint";
|
|
77
|
+
else if (kind === require_type.type_exports.ReflectionKind.number) return "number";
|
|
78
|
+
else if (kind === require_type.type_exports.ReflectionKind.string) return "string";
|
|
79
|
+
else if (kind === require_type.type_exports.ReflectionKind.boolean) return "boolean";
|
|
80
|
+
else if (kind === require_type.type_exports.ReflectionKind.literal) return "literal";
|
|
81
|
+
else if (kind === require_type.type_exports.ReflectionKind.class) return "class";
|
|
82
|
+
else if (kind === require_type.type_exports.ReflectionKind.array) return "array";
|
|
83
|
+
else if (kind === require_type.type_exports.ReflectionKind.object) return "object";
|
|
84
|
+
else if (kind === require_type.type_exports.ReflectionKind.objectLiteral) return "objectLiteral";
|
|
85
|
+
else if (kind === require_type.type_exports.ReflectionKind.union) return "union";
|
|
86
|
+
else if (kind === require_type.type_exports.ReflectionKind.enum) return "enum";
|
|
87
|
+
else if (kind === require_type.type_exports.ReflectionKind.regexp) return "regexp";
|
|
88
|
+
else if (kind === require_type.type_exports.ReflectionKind.templateLiteral) return "templateLiteral";
|
|
89
|
+
else if (kind === require_type.type_exports.ReflectionKind.property) return "property";
|
|
90
|
+
else if (kind === require_type.type_exports.ReflectionKind.method) return "method";
|
|
91
|
+
else if (kind === require_type.type_exports.ReflectionKind.function) return "function";
|
|
92
|
+
else if (kind === require_type.type_exports.ReflectionKind.parameter) return "parameter";
|
|
93
|
+
else if (kind === require_type.type_exports.ReflectionKind.promise) return "promise";
|
|
94
|
+
else if (kind === require_type.type_exports.ReflectionKind.typeParameter) return "typeParameter";
|
|
95
|
+
else if (kind === require_type.type_exports.ReflectionKind.tuple) return "tuple";
|
|
96
|
+
else if (kind === require_type.type_exports.ReflectionKind.tupleMember) return "tupleMember";
|
|
97
|
+
else if (kind === require_type.type_exports.ReflectionKind.enumMember) return "enumMember";
|
|
98
|
+
else if (kind === require_type.type_exports.ReflectionKind.rest) return "rest";
|
|
99
|
+
else if (kind === require_type.type_exports.ReflectionKind.indexSignature) return "indexSignature";
|
|
100
|
+
else if (kind === require_type.type_exports.ReflectionKind.propertySignature) return "propertySignature";
|
|
101
|
+
else if (kind === require_type.type_exports.ReflectionKind.methodSignature) return "methodSignature";
|
|
102
|
+
else if (kind === require_type.type_exports.ReflectionKind.infer) return "infer";
|
|
103
|
+
else if (kind === require_type.type_exports.ReflectionKind.callSignature) return "callSignature";
|
|
104
|
+
else if (kind === require_type.type_exports.ReflectionKind.any) return "any";
|
|
105
|
+
else if (kind === require_type.type_exports.ReflectionKind.intersection) return "intersection";
|
|
105
106
|
return "unknown";
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type_exports } from "./vendor/type.mjs";
|
|
1
2
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
2
3
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
3
4
|
import { isNull } from "@stryke/type-checks/is-null";
|
|
@@ -32,7 +33,7 @@ function stringifyStringValue(value) {
|
|
|
32
33
|
* @returns A string representation of the value.
|
|
33
34
|
*/
|
|
34
35
|
function stringifyValue(type, value) {
|
|
35
|
-
return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
36
|
+
return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type.kind === type_exports.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === type_exports.ReflectionKind.string || type.kind === type_exports.ReflectionKind.literal && isString(type.literal) ? stringifyStringValue(value) : type.kind === type_exports.ReflectionKind.enum ? getEnumReflectionType(type).kind === type_exports.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === type_exports.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === type_exports.ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === type_exports.ReflectionKind.object || type.kind === type_exports.ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === type_exports.ReflectionKind.property || type.kind === type_exports.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Converts a {@link TypeEnum} to its underlying primitive type representation.
|
|
@@ -41,10 +42,10 @@ function stringifyValue(type, value) {
|
|
|
41
42
|
* @returns A string representation of the primitive type.
|
|
42
43
|
*/
|
|
43
44
|
function getEnumReflectionType(type) {
|
|
44
|
-
if (type.kind !== ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
45
|
-
const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number });
|
|
45
|
+
if (type.kind !== type_exports.ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
46
|
+
const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? { kind: type_exports.ReflectionKind.string } : { kind: type_exports.ReflectionKind.number });
|
|
46
47
|
if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
|
|
47
|
-
return unique[0] && isString(unique[0]) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number };
|
|
48
|
+
return unique[0] && isString(unique[0]) ? { kind: type_exports.ReflectionKind.string } : { kind: type_exports.ReflectionKind.number };
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Converts a {@link TypeUnion} to its underlying primitive type representation.
|
|
@@ -53,11 +54,11 @@ function getEnumReflectionType(type) {
|
|
|
53
54
|
* @returns A string representation of the primitive type.
|
|
54
55
|
*/
|
|
55
56
|
function getUnionTypes(type) {
|
|
56
|
-
if (type.kind === ReflectionKind.union && type.types.length > 0) return getUniqueBy(type.types, (member) => member.kind);
|
|
57
|
+
if (type.kind === type_exports.ReflectionKind.union && type.types.length > 0) return getUniqueBy(type.types, (member) => member.kind);
|
|
57
58
|
throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
|
|
58
59
|
}
|
|
59
60
|
function isStringUnion(type) {
|
|
60
|
-
return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && isString(member.literal));
|
|
61
|
+
return getUnionTypes(type).some((member) => member.kind === type_exports.ReflectionKind.string || member.kind === type_exports.ReflectionKind.literal && isString(member.literal));
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Converts a ReflectionKind to its string representation.
|
|
@@ -66,41 +67,41 @@ function isStringUnion(type) {
|
|
|
66
67
|
* @returns A string representation of the kind.
|
|
67
68
|
*/
|
|
68
69
|
function kindToName(kind) {
|
|
69
|
-
if (kind === ReflectionKind.void) return "void";
|
|
70
|
-
else if (kind === ReflectionKind.never) return "never";
|
|
71
|
-
else if (kind === ReflectionKind.null) return "null";
|
|
72
|
-
else if (kind === ReflectionKind.undefined) return "undefined";
|
|
73
|
-
else if (kind === ReflectionKind.symbol) return "symbol";
|
|
74
|
-
else if (kind === ReflectionKind.bigint) return "bigint";
|
|
75
|
-
else if (kind === ReflectionKind.number) return "number";
|
|
76
|
-
else if (kind === ReflectionKind.string) return "string";
|
|
77
|
-
else if (kind === ReflectionKind.boolean) return "boolean";
|
|
78
|
-
else if (kind === ReflectionKind.literal) return "literal";
|
|
79
|
-
else if (kind === ReflectionKind.class) return "class";
|
|
80
|
-
else if (kind === ReflectionKind.array) return "array";
|
|
81
|
-
else if (kind === ReflectionKind.object) return "object";
|
|
82
|
-
else if (kind === ReflectionKind.objectLiteral) return "objectLiteral";
|
|
83
|
-
else if (kind === ReflectionKind.union) return "union";
|
|
84
|
-
else if (kind === ReflectionKind.enum) return "enum";
|
|
85
|
-
else if (kind === ReflectionKind.regexp) return "regexp";
|
|
86
|
-
else if (kind === ReflectionKind.templateLiteral) return "templateLiteral";
|
|
87
|
-
else if (kind === ReflectionKind.property) return "property";
|
|
88
|
-
else if (kind === ReflectionKind.method) return "method";
|
|
89
|
-
else if (kind === ReflectionKind.function) return "function";
|
|
90
|
-
else if (kind === ReflectionKind.parameter) return "parameter";
|
|
91
|
-
else if (kind === ReflectionKind.promise) return "promise";
|
|
92
|
-
else if (kind === ReflectionKind.typeParameter) return "typeParameter";
|
|
93
|
-
else if (kind === ReflectionKind.tuple) return "tuple";
|
|
94
|
-
else if (kind === ReflectionKind.tupleMember) return "tupleMember";
|
|
95
|
-
else if (kind === ReflectionKind.enumMember) return "enumMember";
|
|
96
|
-
else if (kind === ReflectionKind.rest) return "rest";
|
|
97
|
-
else if (kind === ReflectionKind.indexSignature) return "indexSignature";
|
|
98
|
-
else if (kind === ReflectionKind.propertySignature) return "propertySignature";
|
|
99
|
-
else if (kind === ReflectionKind.methodSignature) return "methodSignature";
|
|
100
|
-
else if (kind === ReflectionKind.infer) return "infer";
|
|
101
|
-
else if (kind === ReflectionKind.callSignature) return "callSignature";
|
|
102
|
-
else if (kind === ReflectionKind.any) return "any";
|
|
103
|
-
else if (kind === ReflectionKind.intersection) return "intersection";
|
|
70
|
+
if (kind === type_exports.ReflectionKind.void) return "void";
|
|
71
|
+
else if (kind === type_exports.ReflectionKind.never) return "never";
|
|
72
|
+
else if (kind === type_exports.ReflectionKind.null) return "null";
|
|
73
|
+
else if (kind === type_exports.ReflectionKind.undefined) return "undefined";
|
|
74
|
+
else if (kind === type_exports.ReflectionKind.symbol) return "symbol";
|
|
75
|
+
else if (kind === type_exports.ReflectionKind.bigint) return "bigint";
|
|
76
|
+
else if (kind === type_exports.ReflectionKind.number) return "number";
|
|
77
|
+
else if (kind === type_exports.ReflectionKind.string) return "string";
|
|
78
|
+
else if (kind === type_exports.ReflectionKind.boolean) return "boolean";
|
|
79
|
+
else if (kind === type_exports.ReflectionKind.literal) return "literal";
|
|
80
|
+
else if (kind === type_exports.ReflectionKind.class) return "class";
|
|
81
|
+
else if (kind === type_exports.ReflectionKind.array) return "array";
|
|
82
|
+
else if (kind === type_exports.ReflectionKind.object) return "object";
|
|
83
|
+
else if (kind === type_exports.ReflectionKind.objectLiteral) return "objectLiteral";
|
|
84
|
+
else if (kind === type_exports.ReflectionKind.union) return "union";
|
|
85
|
+
else if (kind === type_exports.ReflectionKind.enum) return "enum";
|
|
86
|
+
else if (kind === type_exports.ReflectionKind.regexp) return "regexp";
|
|
87
|
+
else if (kind === type_exports.ReflectionKind.templateLiteral) return "templateLiteral";
|
|
88
|
+
else if (kind === type_exports.ReflectionKind.property) return "property";
|
|
89
|
+
else if (kind === type_exports.ReflectionKind.method) return "method";
|
|
90
|
+
else if (kind === type_exports.ReflectionKind.function) return "function";
|
|
91
|
+
else if (kind === type_exports.ReflectionKind.parameter) return "parameter";
|
|
92
|
+
else if (kind === type_exports.ReflectionKind.promise) return "promise";
|
|
93
|
+
else if (kind === type_exports.ReflectionKind.typeParameter) return "typeParameter";
|
|
94
|
+
else if (kind === type_exports.ReflectionKind.tuple) return "tuple";
|
|
95
|
+
else if (kind === type_exports.ReflectionKind.tupleMember) return "tupleMember";
|
|
96
|
+
else if (kind === type_exports.ReflectionKind.enumMember) return "enumMember";
|
|
97
|
+
else if (kind === type_exports.ReflectionKind.rest) return "rest";
|
|
98
|
+
else if (kind === type_exports.ReflectionKind.indexSignature) return "indexSignature";
|
|
99
|
+
else if (kind === type_exports.ReflectionKind.propertySignature) return "propertySignature";
|
|
100
|
+
else if (kind === type_exports.ReflectionKind.methodSignature) return "methodSignature";
|
|
101
|
+
else if (kind === type_exports.ReflectionKind.infer) return "infer";
|
|
102
|
+
else if (kind === type_exports.ReflectionKind.callSignature) return "callSignature";
|
|
103
|
+
else if (kind === type_exports.ReflectionKind.any) return "any";
|
|
104
|
+
else if (kind === type_exports.ReflectionKind.intersection) return "intersection";
|
|
104
105
|
return "unknown";
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../deepkit/src/vendor/core.ts
|
|
4
|
+
var core_exports = {};
|
|
5
|
+
require_rolldown_runtime.__reExport(core_exports, require("@deepkit/core"));
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
Object.defineProperty(exports, 'core_exports', {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return core_exports;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var __deepkit_core = require("@deepkit/core");
|
|
15
|
+
Object.keys(__deepkit_core).forEach(function (k) {
|
|
16
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return __deepkit_core[k]; }
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __reExport } from "../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
export * from "@deepkit/core"
|
|
4
|
+
|
|
5
|
+
//#region ../deepkit/src/vendor/core.ts
|
|
6
|
+
var core_exports = {};
|
|
7
|
+
import * as import___deepkit_core from "@deepkit/core";
|
|
8
|
+
__reExport(core_exports, import___deepkit_core);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { core_exports };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
|
|
3
|
+
//#region ../deepkit/src/vendor/type.ts
|
|
4
|
+
var type_exports = {};
|
|
5
|
+
require_rolldown_runtime.__reExport(type_exports, require("@deepkit/type"));
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
Object.defineProperty(exports, 'type_exports', {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return type_exports;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var __deepkit_type = require("@deepkit/type");
|
|
15
|
+
Object.keys(__deepkit_type).forEach(function (k) {
|
|
16
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return __deepkit_type[k]; }
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __reExport } from "../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
export * from "@deepkit/type"
|
|
4
|
+
|
|
5
|
+
//#region ../deepkit/src/vendor/type.ts
|
|
6
|
+
var type_exports = {};
|
|
7
|
+
import * as import___deepkit_type from "@deepkit/type";
|
|
8
|
+
__reExport(type_exports, import___deepkit_type);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { type_exports };
|