@powerlines/plugin-date 0.12.136 → 0.12.138
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/plugin-alloy/src/core/components/single-line-comment.cjs +20 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +19 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +60 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +58 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +50 -1
- package/dist/plugin-alloy/src/core/contexts/context.mjs +46 -2
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
- package/dist/plugin-alloy/src/types/components.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +47 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +46 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +75 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +73 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +359 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +350 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +142 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +139 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +53 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +52 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +94 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +93 -0
- package/dist/plugin-env/src/components/docs.cjs +3 -3
- package/dist/plugin-env/src/components/docs.mjs +3 -3
- package/dist/plugin-env/src/components/env.cjs +151 -40
- package/dist/plugin-env/src/components/env.mjs +126 -15
- package/dist/powerlines/src/lib/build/esbuild.mjs +1 -1
- package/dist/powerlines/src/lib/entry.mjs +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type_exports } from "../../../../deepkit/src/vendor/type.mjs";
|
|
2
|
+
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
3
|
+
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
4
|
+
import { For, computed, splitProps } from "@alloy-js/core";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
+
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
9
|
+
|
|
10
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
13
|
+
*/
|
|
14
|
+
function TypeScriptInterface(props) {
|
|
15
|
+
const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
|
|
16
|
+
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
17
|
+
const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
18
|
+
return /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
19
|
+
value: { reflection },
|
|
20
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsx(InterfaceDeclaration, {
|
|
21
|
+
export: true,
|
|
22
|
+
name: interfaceName.value,
|
|
23
|
+
...rest,
|
|
24
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
25
|
+
each: properties,
|
|
26
|
+
doubleHardline: true,
|
|
27
|
+
semicolon: true,
|
|
28
|
+
children: (prop) => /* @__PURE__ */ jsx(TypescriptInterfaceProperty, { property: prop })
|
|
29
|
+
})
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
35
|
+
*/
|
|
36
|
+
function TypescriptInterfaceProperty(props) {
|
|
37
|
+
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
39
|
+
value: property,
|
|
40
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionProperty, {}), /* @__PURE__ */ jsx(InterfaceMember, {
|
|
41
|
+
name: property.getNameAsString(),
|
|
42
|
+
readonly: property.isReadonly(),
|
|
43
|
+
optional: property.isOptional(),
|
|
44
|
+
nullish: property.isNullable(),
|
|
45
|
+
type: (0, type_exports.stringifyType)(property.getType()),
|
|
46
|
+
...rest
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { TypeScriptInterface };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utilities = require('../../../../deepkit/src/utilities.cjs');
|
|
3
|
+
const require_reflection = require('../../core/contexts/reflection.cjs');
|
|
4
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
5
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
+
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
9
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
10
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
12
|
+
|
|
13
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript object for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
function TypescriptObject(props) {
|
|
18
|
+
if (!props.reflection?.value) return null;
|
|
19
|
+
const objectName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_camel_case.camelCase)(((0, __stryke_type_checks_is_string.isString)(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
20
|
+
const objectType = (0, __alloy_js_core.computed)(() => props.type || (0, __stryke_string_format_pascal_case.pascalCase)(props.reflection.value.getName()));
|
|
21
|
+
const properties = (0, __alloy_js_core.computed)(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
22
|
+
if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
23
|
+
return ret;
|
|
24
|
+
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
25
|
+
const TypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
26
|
+
const ValueTypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
27
|
+
const sym = (0, __alloy_js_typescript.createValueSymbol)(props.name, {
|
|
28
|
+
refkeys: props.refkey,
|
|
29
|
+
default: props.default,
|
|
30
|
+
export: props.export,
|
|
31
|
+
metadata: props.metadata,
|
|
32
|
+
tsFlags: props.nullish ? __alloy_js_typescript.TSSymbolFlags.Nullish : __alloy_js_typescript.TSSymbolFlags.None,
|
|
33
|
+
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
34
|
+
namePolicy: (0, __alloy_js_typescript.useTSNamePolicy)().for("variable")
|
|
35
|
+
});
|
|
36
|
+
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
37
|
+
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
38
|
+
const type = props.type ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_typescript.TypeRefContext, { children: [": ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
39
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
40
|
+
when: !!props.reflection.value,
|
|
41
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
reflection: props.reflection.value,
|
|
44
|
+
override: {
|
|
45
|
+
name: objectName.value,
|
|
46
|
+
type: objectType.value,
|
|
47
|
+
defaultValue: props.defaultValue?.value
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
51
|
+
when: !!objectName.value && !!objectType.value,
|
|
52
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Declaration, {
|
|
53
|
+
symbol: sym,
|
|
54
|
+
children: [
|
|
55
|
+
props.export ? "export " : "",
|
|
56
|
+
props.default ? "default " : "",
|
|
57
|
+
keyword,
|
|
58
|
+
" ",
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Name, {}),
|
|
60
|
+
type,
|
|
61
|
+
" =",
|
|
62
|
+
" ",
|
|
63
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectExpression, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
|
|
64
|
+
each: properties.value ?? [],
|
|
65
|
+
comma: true,
|
|
66
|
+
doubleHardline: true,
|
|
67
|
+
children: (prop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptObjectProperty, { property: prop })
|
|
68
|
+
}) }) })
|
|
69
|
+
]
|
|
70
|
+
})]
|
|
71
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
77
|
+
*/
|
|
78
|
+
function TypescriptObjectProperty(props) {
|
|
79
|
+
const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
80
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
81
|
+
value: property,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
|
|
84
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectProperty, {
|
|
85
|
+
name: property.getNameAsString(),
|
|
86
|
+
value: require_utilities.stringifyDefaultValue(property)
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.TypescriptObject = TypescriptObject;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { stringifyDefaultValue } from "../../../../deepkit/src/utilities.mjs";
|
|
2
|
+
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
3
|
+
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
4
|
+
import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
8
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
9
|
+
import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
10
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
11
|
+
|
|
12
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Generates a TypeScript object for the given reflection class.
|
|
15
|
+
*/
|
|
16
|
+
function TypescriptObject(props) {
|
|
17
|
+
if (!props.reflection?.value) return null;
|
|
18
|
+
const objectName = computed(() => camelCase((isString(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
19
|
+
const objectType = computed(() => props.type || pascalCase(props.reflection.value.getName()));
|
|
20
|
+
const properties = computed(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !isUndefined(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
21
|
+
if (isUndefined(ret) && !isUndefined(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
22
|
+
return ret;
|
|
23
|
+
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
24
|
+
const TypeSymbolSlot = createSymbolSlot();
|
|
25
|
+
const ValueTypeSymbolSlot = createSymbolSlot();
|
|
26
|
+
const sym = createValueSymbol(props.name, {
|
|
27
|
+
refkeys: props.refkey,
|
|
28
|
+
default: props.default,
|
|
29
|
+
export: props.export,
|
|
30
|
+
metadata: props.metadata,
|
|
31
|
+
tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
|
|
32
|
+
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
33
|
+
namePolicy: useTSNamePolicy().for("variable")
|
|
34
|
+
});
|
|
35
|
+
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
36
|
+
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
37
|
+
const type = props.type ? /* @__PURE__ */ jsxs(TypeRefContext, { children: [": ", /* @__PURE__ */ jsx(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
38
|
+
return /* @__PURE__ */ jsx(Show, {
|
|
39
|
+
when: !!props.reflection.value,
|
|
40
|
+
children: /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
41
|
+
value: {
|
|
42
|
+
reflection: props.reflection.value,
|
|
43
|
+
override: {
|
|
44
|
+
name: objectName.value,
|
|
45
|
+
type: objectType.value,
|
|
46
|
+
defaultValue: props.defaultValue?.value
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
children: [/* @__PURE__ */ jsxs(Show, {
|
|
50
|
+
when: !!objectName.value && !!objectType.value,
|
|
51
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsxs(Declaration, {
|
|
52
|
+
symbol: sym,
|
|
53
|
+
children: [
|
|
54
|
+
props.export ? "export " : "",
|
|
55
|
+
props.default ? "default " : "",
|
|
56
|
+
keyword,
|
|
57
|
+
" ",
|
|
58
|
+
/* @__PURE__ */ jsx(Name, {}),
|
|
59
|
+
type,
|
|
60
|
+
" =",
|
|
61
|
+
" ",
|
|
62
|
+
/* @__PURE__ */ jsx(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ jsx(ObjectExpression, { children: /* @__PURE__ */ jsx(For, {
|
|
63
|
+
each: properties.value ?? [],
|
|
64
|
+
comma: true,
|
|
65
|
+
doubleHardline: true,
|
|
66
|
+
children: (prop) => /* @__PURE__ */ jsx(TypescriptObjectProperty, { property: prop })
|
|
67
|
+
}) }) })
|
|
68
|
+
]
|
|
69
|
+
})]
|
|
70
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
76
|
+
*/
|
|
77
|
+
function TypescriptObjectProperty(props) {
|
|
78
|
+
const [{ property }] = splitProps(props, ["property"]);
|
|
79
|
+
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
80
|
+
value: property,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(TSDocReflectionProperty, {}),
|
|
83
|
+
/* @__PURE__ */ jsx(ObjectProperty, {
|
|
84
|
+
name: property.getNameAsString(),
|
|
85
|
+
value: stringifyDefaultValue(property)
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { TypescriptObject };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require('../../../deepkit/src/vendor/type.cjs');
|
|
2
|
+
require('../../../plugin-alloy/src/core/contexts/context.cjs');
|
|
2
3
|
require('../helpers/create-reflection-resource.cjs');
|
|
4
|
+
require('../../../plugin-alloy/src/markdown/components/markdown-file.cjs');
|
|
5
|
+
require('../../../plugin-alloy/src/markdown/components/markdown-table.cjs');
|
|
3
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
4
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
8
|
let __stryke_path_join = require("@stryke/path/join");
|
|
6
|
-
let __powerlines_alloy_core_contexts_context = require("@powerlines/alloy/core/contexts/context");
|
|
7
9
|
require("@alloy-js/markdown");
|
|
8
|
-
require("@powerlines/alloy/markdown/components/markdown-file");
|
|
9
|
-
require("@powerlines/alloy/markdown/components/markdown-table");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../deepkit/src/vendor/type.mjs";
|
|
2
|
+
import "../../../plugin-alloy/src/core/contexts/context.mjs";
|
|
2
3
|
import "../helpers/create-reflection-resource.mjs";
|
|
4
|
+
import "../../../plugin-alloy/src/markdown/components/markdown-file.mjs";
|
|
5
|
+
import "../../../plugin-alloy/src/markdown/components/markdown-table.mjs";
|
|
3
6
|
import { Show, code } from "@alloy-js/core";
|
|
4
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
8
|
import { joinPaths } from "@stryke/path/join";
|
|
6
|
-
import { usePowerlines } from "@powerlines/alloy/core/contexts/context";
|
|
7
9
|
import "@alloy-js/markdown";
|
|
8
|
-
import "@powerlines/alloy/markdown/components/markdown-file";
|
|
9
|
-
import "@powerlines/alloy/markdown/components/markdown-table";
|
|
10
10
|
|
|
11
11
|
export { };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_type = require('../../../deepkit/src/vendor/type.cjs');
|
|
3
|
+
const require_context = require('../../../plugin-alloy/src/core/contexts/context.cjs');
|
|
4
|
+
const require_refkey = require('../../../plugin-alloy/src/helpers/refkey.cjs');
|
|
5
|
+
const require_tsdoc = require('../../../plugin-alloy/src/typescript/components/tsdoc.cjs');
|
|
6
|
+
const require_builtin_file = require('../../../plugin-alloy/src/typescript/components/builtin-file.cjs');
|
|
7
|
+
const require_typescript_interface = require('../../../plugin-alloy/src/typescript/components/typescript-interface.cjs');
|
|
8
|
+
const require_typescript_object = require('../../../plugin-alloy/src/typescript/components/typescript-object.cjs');
|
|
3
9
|
const require_load = require('../helpers/load.cjs');
|
|
4
10
|
const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
|
|
5
11
|
let __alloy_js_core = require("@alloy-js/core");
|
|
@@ -9,12 +15,6 @@ defu = require_rolldown_runtime.__toESM(defu);
|
|
|
9
15
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
16
|
let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
11
17
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
12
|
-
let __powerlines_alloy_core_contexts_context = require("@powerlines/alloy/core/contexts/context");
|
|
13
|
-
let __powerlines_alloy_helpers_refkey = require("@powerlines/alloy/helpers/refkey");
|
|
14
|
-
let __powerlines_alloy_typescript_components_builtin_file = require("@powerlines/alloy/typescript/components/builtin-file");
|
|
15
|
-
let __powerlines_alloy_typescript_components_tsdoc = require("@powerlines/alloy/typescript/components/tsdoc");
|
|
16
|
-
let __powerlines_alloy_typescript_components_typescript_interface = require("@powerlines/alloy/typescript/components/typescript-interface");
|
|
17
|
-
let __powerlines_alloy_typescript_components_typescript_object = require("@powerlines/alloy/typescript/components/typescript-object");
|
|
18
18
|
|
|
19
19
|
//#region ../plugin-env/src/components/env.tsx
|
|
20
20
|
/**
|
|
@@ -22,9 +22,9 @@ let __powerlines_alloy_typescript_components_typescript_object = require("@power
|
|
|
22
22
|
*/
|
|
23
23
|
function EnvTypeDefinition(props) {
|
|
24
24
|
const [{ defaultValue, reflection }] = (0, __alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
|
|
25
|
-
const context =
|
|
25
|
+
const context = require_context.usePowerlines();
|
|
26
26
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
27
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
27
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_typescript_interface.TypeScriptInterface, {
|
|
28
28
|
name: " EnvBase",
|
|
29
29
|
extends: ["EnvInterface"],
|
|
30
30
|
defaultValue,
|
|
@@ -136,15 +136,15 @@ function ConfigPropertySet(props) {
|
|
|
136
136
|
`
|
|
137
137
|
}) });
|
|
138
138
|
}
|
|
139
|
-
const createEnvRefkey =
|
|
140
|
-
const envRefkey =
|
|
141
|
-
const envSerializerRefkey =
|
|
139
|
+
const createEnvRefkey = require_refkey.refkey("createEnv");
|
|
140
|
+
const envRefkey = require_refkey.refkey("env");
|
|
141
|
+
const envSerializerRefkey = require_refkey.refkey("EnvSerializer");
|
|
142
142
|
/**
|
|
143
143
|
* Generates the environment configuration module for the Powerlines project.
|
|
144
144
|
*/
|
|
145
145
|
function EnvBuiltin(props) {
|
|
146
146
|
const [{ defaultConfig }, rest] = (0, __alloy_js_core.splitProps)(props, ["defaultConfig"]);
|
|
147
|
-
const context =
|
|
147
|
+
const context = require_context.usePowerlines();
|
|
148
148
|
const defaultValue = (0, __alloy_js_core.computed)(() => context && require_load.loadEnvFromContext(context, process.env));
|
|
149
149
|
const reflection = require_create_reflection_resource.createReflectionResource(context);
|
|
150
150
|
const envInstance = (0, __alloy_js_core.computed)(() => {
|
|
@@ -156,7 +156,7 @@ function EnvBuiltin(props) {
|
|
|
156
156
|
});
|
|
157
157
|
const reflectionGetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
158
158
|
const reflectionSetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
159
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
159
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_builtin_file.BuiltinFile, {
|
|
160
160
|
...rest,
|
|
161
161
|
id: "env",
|
|
162
162
|
description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters.",
|
|
@@ -187,7 +187,7 @@ function EnvBuiltin(props) {
|
|
|
187
187
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
|
|
188
188
|
]
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
190
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_typescript_object.TypescriptObject, {
|
|
191
191
|
name: "initialEnv",
|
|
192
192
|
type: "Partial<EnvBase>",
|
|
193
193
|
defaultValue,
|
|
@@ -197,12 +197,12 @@ function EnvBuiltin(props) {
|
|
|
197
197
|
}),
|
|
198
198
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
199
199
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
200
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
200
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tsdoc.TSDoc, {
|
|
201
201
|
heading: "The environment configuration serializer for the Powerlines application.",
|
|
202
202
|
children: [
|
|
203
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
204
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
205
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
203
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
204
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
205
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
206
206
|
]
|
|
207
207
|
}),
|
|
208
208
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ClassDeclaration, {
|
|
@@ -229,12 +229,12 @@ function EnvBuiltin(props) {
|
|
|
229
229
|
}),
|
|
230
230
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
231
231
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
232
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
232
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tsdoc.TSDoc, {
|
|
233
233
|
heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
|
|
234
234
|
children: [
|
|
235
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
236
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
237
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
235
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
237
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
238
238
|
]
|
|
239
239
|
}),
|
|
240
240
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
@@ -248,12 +248,12 @@ function EnvBuiltin(props) {
|
|
|
248
248
|
}),
|
|
249
249
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
250
250
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
251
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
251
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tsdoc.TSDoc, {
|
|
252
252
|
heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
|
|
253
253
|
children: [
|
|
254
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
255
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
256
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
254
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using JSON.stringify().` }),
|
|
255
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
|
|
256
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
|
|
257
257
|
]
|
|
258
258
|
}),
|
|
259
259
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
@@ -264,12 +264,12 @@ function EnvBuiltin(props) {
|
|
|
264
264
|
}),
|
|
265
265
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
266
266
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
267
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
267
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tsdoc.TSDoc, {
|
|
268
268
|
heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
|
|
269
269
|
children: [
|
|
270
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
271
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
272
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
270
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
|
|
271
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
|
|
272
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
|
|
273
273
|
]
|
|
274
274
|
}),
|
|
275
275
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
@@ -280,15 +280,15 @@ function EnvBuiltin(props) {
|
|
|
280
280
|
}),
|
|
281
281
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
282
282
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
283
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
283
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tsdoc.TSDoc, {
|
|
284
284
|
heading: "Initializes the Powerlines environment configuration module.",
|
|
285
285
|
children: [
|
|
286
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
287
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
286
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
287
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocParam, {
|
|
288
288
|
name: "environmentConfig",
|
|
289
289
|
children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
|
|
290
290
|
}),
|
|
291
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
291
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
|
|
292
292
|
]
|
|
293
293
|
}),
|
|
294
294
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
@@ -357,12 +357,123 @@ function EnvBuiltin(props) {
|
|
|
357
357
|
type: "Env",
|
|
358
358
|
export: true,
|
|
359
359
|
const: true,
|
|
360
|
-
initializer: /* @__PURE__ */ (0, react_jsx_runtime.
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
360
|
+
initializer: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: __alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
363
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
364
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
365
|
+
export: true,
|
|
366
|
+
const: true,
|
|
367
|
+
name: "isCI",
|
|
368
|
+
doc: "Detect if the application is running in a CI environment.",
|
|
369
|
+
initializer: __alloy_js_core.code`Boolean(
|
|
370
|
+
env.CI ||
|
|
371
|
+
env.RUN_ID ||
|
|
372
|
+
env.AGOLA_GIT_REF ||
|
|
373
|
+
env.AC_APPCIRCLE ||
|
|
374
|
+
env.APPVEYOR ||
|
|
375
|
+
env.CODEBUILD ||
|
|
376
|
+
env.TF_BUILD ||
|
|
377
|
+
env.bamboo_planKey ||
|
|
378
|
+
env.BITBUCKET_COMMIT ||
|
|
379
|
+
env.BITRISE_IO ||
|
|
380
|
+
env.BUDDY_WORKSPACE_ID ||
|
|
381
|
+
env.BUILDKITE ||
|
|
382
|
+
env.CIRCLECI ||
|
|
383
|
+
env.CIRRUS_CI ||
|
|
384
|
+
env.CF_BUILD_ID ||
|
|
385
|
+
env.CM_BUILD_ID ||
|
|
386
|
+
env.CI_NAME ||
|
|
387
|
+
env.DRONE ||
|
|
388
|
+
env.DSARI ||
|
|
389
|
+
env.EARTHLY_CI ||
|
|
390
|
+
env.EAS_BUILD ||
|
|
391
|
+
env.GERRIT_PROJECT ||
|
|
392
|
+
env.GITEA_ACTIONS ||
|
|
393
|
+
env.GITHUB_ACTIONS ||
|
|
394
|
+
env.GITLAB_CI ||
|
|
395
|
+
env.GOCD ||
|
|
396
|
+
env.BUILDER_OUTPUT ||
|
|
397
|
+
env.HARNESS_BUILD_ID ||
|
|
398
|
+
env.JENKINS_URL ||
|
|
399
|
+
env.LAYERCI ||
|
|
400
|
+
env.MAGNUM ||
|
|
401
|
+
env.NETLIFY ||
|
|
402
|
+
env.NEVERCODE ||
|
|
403
|
+
env.PROW_JOB_ID ||
|
|
404
|
+
env.RELEASE_BUILD_ID ||
|
|
405
|
+
env.RENDER ||
|
|
406
|
+
env.SAILCI ||
|
|
407
|
+
env.HUDSON ||
|
|
408
|
+
env.SCREWDRIVER ||
|
|
409
|
+
env.SEMAPHORE ||
|
|
410
|
+
env.SOURCEHUT ||
|
|
411
|
+
env.STRIDER ||
|
|
412
|
+
env.TASK_ID ||
|
|
413
|
+
env.RUN_ID ||
|
|
414
|
+
env.TEAMCITY_VERSION ||
|
|
415
|
+
env.TRAVIS ||
|
|
416
|
+
env.VELA ||
|
|
417
|
+
env.NOW_BUILDER ||
|
|
418
|
+
env.APPCENTER_BUILD_ID ||
|
|
419
|
+
env.CI_XCODE_PROJECT ||
|
|
420
|
+
env.XCS || false
|
|
421
|
+
);
|
|
422
|
+
`
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
425
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
426
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDoc, {
|
|
427
|
+
heading: "Detect the \\`mode\\` of the current runtime environment.",
|
|
428
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, Storm Software generally only allows a value in the following list:
|
|
429
|
+
- \`production\`
|
|
430
|
+
- \`test\`
|
|
431
|
+
- \`development\`` })
|
|
432
|
+
}),
|
|
433
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
434
|
+
export: true,
|
|
435
|
+
const: true,
|
|
436
|
+
name: "mode",
|
|
437
|
+
initializer: __alloy_js_core.code`String(env.MODE) || "production"; `
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
440
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
441
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
442
|
+
export: true,
|
|
443
|
+
const: true,
|
|
444
|
+
name: "isProduction",
|
|
445
|
+
doc: "Detect if the application is running in \\\"production\\\\\" mode",
|
|
446
|
+
initializer: __alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
|
|
447
|
+
}),
|
|
448
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
449
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
450
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
451
|
+
export: true,
|
|
452
|
+
const: true,
|
|
453
|
+
name: "isTest",
|
|
454
|
+
doc: "Detect if the application is running in \"test\" mode",
|
|
455
|
+
initializer: __alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
458
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
459
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
460
|
+
export: true,
|
|
461
|
+
const: true,
|
|
462
|
+
name: "isDevelopment",
|
|
463
|
+
doc: "Detect if the application is running in \"development\" mode",
|
|
464
|
+
initializer: __alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
|
|
465
|
+
}),
|
|
466
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
467
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
468
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
|
|
469
|
+
export: true,
|
|
470
|
+
const: true,
|
|
471
|
+
name: "isDebug",
|
|
472
|
+
doc: "Detect if the application is running in \"debug\" mode",
|
|
473
|
+
initializer: __alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
|
|
476
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
|
|
366
477
|
]
|
|
367
478
|
});
|
|
368
479
|
}
|