@powerlines/plugin-env 0.16.83 → 0.16.84
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/package.json +9 -9
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/_virtual/_rolldown/runtime.mjs +0 -3
- package/dist/babel/index.cjs +0 -4
- package/dist/babel/index.d.cts +0 -2
- package/dist/babel/index.d.mts +0 -2
- package/dist/babel/index.mjs +0 -3
- package/dist/babel/plugin.cjs +0 -144
- package/dist/babel/plugin.d.cts +0 -8
- package/dist/babel/plugin.d.cts.map +0 -1
- package/dist/babel/plugin.d.mts +0 -8
- package/dist/babel/plugin.d.mts.map +0 -1
- package/dist/babel/plugin.mjs +0 -143
- package/dist/babel/plugin.mjs.map +0 -1
- package/dist/components/docs.cjs +0 -70
- package/dist/components/docs.d.cts +0 -25
- package/dist/components/docs.d.cts.map +0 -1
- package/dist/components/docs.d.mts +0 -25
- package/dist/components/docs.d.mts.map +0 -1
- package/dist/components/docs.mjs +0 -69
- package/dist/components/docs.mjs.map +0 -1
- package/dist/components/env-builtin.cjs +0 -568
- package/dist/components/env-builtin.d.cts +0 -22
- package/dist/components/env-builtin.d.cts.map +0 -1
- package/dist/components/env-builtin.d.mts +0 -22
- package/dist/components/env-builtin.d.mts.map +0 -1
- package/dist/components/env-builtin.mjs +0 -565
- package/dist/components/env-builtin.mjs.map +0 -1
- package/dist/components/index.cjs +0 -7
- package/dist/components/index.d.cts +0 -3
- package/dist/components/index.d.mts +0 -3
- package/dist/components/index.mjs +0 -4
- package/dist/helpers/automd-generator.cjs +0 -33
- package/dist/helpers/automd-generator.d.cts +0 -14
- package/dist/helpers/automd-generator.d.cts.map +0 -1
- package/dist/helpers/automd-generator.d.mts +0 -14
- package/dist/helpers/automd-generator.d.mts.map +0 -1
- package/dist/helpers/automd-generator.mjs +0 -32
- package/dist/helpers/automd-generator.mjs.map +0 -1
- package/dist/helpers/create-reflection-resource.cjs +0 -23
- package/dist/helpers/create-reflection-resource.d.cts +0 -13
- package/dist/helpers/create-reflection-resource.d.cts.map +0 -1
- package/dist/helpers/create-reflection-resource.d.mts +0 -13
- package/dist/helpers/create-reflection-resource.d.mts.map +0 -1
- package/dist/helpers/create-reflection-resource.mjs +0 -23
- package/dist/helpers/create-reflection-resource.mjs.map +0 -1
- package/dist/helpers/docs-helper.cjs +0 -25
- package/dist/helpers/docs-helper.d.cts +0 -13
- package/dist/helpers/docs-helper.d.cts.map +0 -1
- package/dist/helpers/docs-helper.d.mts +0 -13
- package/dist/helpers/docs-helper.d.mts.map +0 -1
- package/dist/helpers/docs-helper.mjs +0 -24
- package/dist/helpers/docs-helper.mjs.map +0 -1
- package/dist/helpers/index.cjs +0 -34
- package/dist/helpers/index.d.cts +0 -7
- package/dist/helpers/index.d.mts +0 -7
- package/dist/helpers/index.mjs +0 -8
- package/dist/helpers/load.cjs +0 -136
- package/dist/helpers/load.d.cts +0 -35
- package/dist/helpers/load.d.cts.map +0 -1
- package/dist/helpers/load.d.mts +0 -35
- package/dist/helpers/load.d.mts.map +0 -1
- package/dist/helpers/load.mjs +0 -133
- package/dist/helpers/load.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -323
- package/dist/helpers/persistence.d.cts +0 -84
- package/dist/helpers/persistence.d.cts.map +0 -1
- package/dist/helpers/persistence.d.mts +0 -84
- package/dist/helpers/persistence.d.mts.map +0 -1
- package/dist/helpers/persistence.mjs +0 -311
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/reflect.cjs +0 -299
- package/dist/helpers/reflect.d.cts +0 -69
- package/dist/helpers/reflect.d.cts.map +0 -1
- package/dist/helpers/reflect.d.mts +0 -69
- package/dist/helpers/reflect.d.mts.map +0 -1
- package/dist/helpers/reflect.mjs +0 -290
- package/dist/helpers/reflect.mjs.map +0 -1
- package/dist/helpers/source-file-env.cjs +0 -59
- package/dist/helpers/source-file-env.d.cts +0 -9
- package/dist/helpers/source-file-env.d.cts.map +0 -1
- package/dist/helpers/source-file-env.d.mts +0 -9
- package/dist/helpers/source-file-env.d.mts.map +0 -1
- package/dist/helpers/source-file-env.mjs +0 -57
- package/dist/helpers/source-file-env.mjs.map +0 -1
- package/dist/helpers/template-helpers.cjs +0 -71
- package/dist/helpers/template-helpers.d.cts +0 -15
- package/dist/helpers/template-helpers.d.cts.map +0 -1
- package/dist/helpers/template-helpers.d.mts +0 -15
- package/dist/helpers/template-helpers.d.mts.map +0 -1
- package/dist/helpers/template-helpers.mjs +0 -70
- package/dist/helpers/template-helpers.mjs.map +0 -1
- package/dist/index.cjs +0 -195
- package/dist/index.d.cts +0 -17
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -17
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -189
- package/dist/index.mjs.map +0 -1
- package/dist/types/index.cjs +0 -11
- package/dist/types/index.d.cts +0 -3
- package/dist/types/index.d.mts +0 -3
- package/dist/types/index.mjs +0 -4
- package/dist/types/plugin.cjs +0 -137
- package/dist/types/plugin.d.cts +0 -168
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts +0 -168
- package/dist/types/plugin.d.mts.map +0 -1
- package/dist/types/plugin.mjs +0 -132
- package/dist/types/plugin.mjs.map +0 -1
- package/dist/types/runtime.cjs +0 -244
- package/dist/types/runtime.d.cts +0 -792
- package/dist/types/runtime.d.cts.map +0 -1
- package/dist/types/runtime.d.mts +0 -792
- package/dist/types/runtime.d.mts.map +0 -1
- package/dist/types/runtime.mjs +0 -242
- package/dist/types/runtime.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Heading, Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"../helpers/docs-helper\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n property.getNameAsString() !== \"__POWERLINES_INJECTED__\"\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(\" | \", \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;CA8CE,MAAA,EACF,cAAA,eAEE,GAAA,SACC;CACD,MAAA,UAAA,eAAA;AACF,QAAO,gBAAoB,cAAQ,WAAkB,EACnD,IAAM,OAAE;;cAIR,IAAM,WAAC;AACJ,SAAA;GAAA,gBAAA,SAAA;IACC,OAAM,IAAA;IACJ,UAAO;IACR,CAAA;GAAA,IAAO;GAAoD,gBAAO,MAAA;IAClE,IAAK,OAAM;AACX,YAAU,CAAC,CAAC,QAAQ,YAAY;;IAE/B,IAAE,WAAa;AACb,YAAO,gBAAQ,MAAgB;MAChC,IAAA,OAAA;AACG,cAAA,iCAAA,QAAA,YAAA;;MAEL,IAAS,QAAA;AACF,cAAO,QAAK,YAAa;;MAE5B,CAAC;;IAEL,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,SAAA;IACC,OAAK,IAAA;IACL,UAAE;IACH,CAAC;GAAE,gBAAkB,SAAA,EAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,eAAA,EACpB,IAAI,OAAO;AACT,WAAI,YAAU,eAAA,CAAA,QAAA,aAAA,SAAA,iBAAA,KAAA,0BAAA,CAAA,MAAA,GAAA,MAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,CAAA,CAAA,KAAA,uBAAA;AACZ,YAAI;MACJ,MAAA,mBAAA,iBAAA,CAAA,MAAA;MACC,cAAa,mBAAA,gBAAA,IAAA,IAAA,MAAA;MACZ,MAAE,cAAkB,mBAAgB,SAAA,CAAA,CAAA,MAAiB,CAAA,WAAA,OAAA,QAAA;MACvD,cAAA,mBAAA,YAAA,GAAA,OAAA,mBAAA,iBAAA,CAAA,EAAA,SAAA,KAAA,GAAA,mBAAA,iBAAA,GAAA,KAAA,mBAAA,iBAAA,CAAA,MAAA;MACC,UAAI,mBAAsB,iBAAA,GAAA,KAAA;MAC1B;MACD,IAAI,EAAA;MAET,CAAC;GAAC;IAEN,CAAC,CAAC"}
|
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_helpers_load = require('../helpers/load.cjs');
|
|
4
|
-
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
5
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
|
-
let defu = require("defu");
|
|
7
|
-
defu = require_runtime.__toESM(defu);
|
|
8
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
10
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
11
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
12
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
13
|
-
let _powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
|
|
14
|
-
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
15
|
-
let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
|
|
16
|
-
let _powerlines_plugin_alloy_typescript_components_object_declaration = require("@powerlines/plugin-alloy/typescript/components/object-declaration");
|
|
17
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
18
|
-
|
|
19
|
-
//#region src/components/env-builtin.tsx
|
|
20
|
-
/**
|
|
21
|
-
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
22
|
-
*/
|
|
23
|
-
function EnvTypeDefinition(props) {
|
|
24
|
-
const [{ defaultValue, reflection }] = (0, _alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
|
|
25
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
26
|
-
return [
|
|
27
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
28
|
-
name: " EnvBase",
|
|
29
|
-
defaultValue,
|
|
30
|
-
reflection,
|
|
31
|
-
"export": true
|
|
32
|
-
}),
|
|
33
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
34
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
35
|
-
heading: "The environment configuration object with prefixed keys.",
|
|
36
|
-
get children() {
|
|
37
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The \`Env\` type extends the \`EnvBase\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` });
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
40
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
|
|
41
|
-
name: "Env",
|
|
42
|
-
"export": true,
|
|
43
|
-
get children() {
|
|
44
|
-
return _alloy_js_core.code` {
|
|
45
|
-
[Key in keyof EnvBase as Key ${context.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}),
|
|
50
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
51
|
-
];
|
|
52
|
-
}
|
|
53
|
-
function ConfigPropertyConditional(props) {
|
|
54
|
-
const [{ context, name }] = (0, _alloy_js_core.splitProps)(props, ["context", "name"]);
|
|
55
|
-
return _alloy_js_core.code`propertyName === "${name}" || propertyName.replace(/^(${context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)).map((prefix) => `${prefix.replace(/_$/, "")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
|
|
56
|
-
}
|
|
57
|
-
function ConfigPropertyGet(props) {
|
|
58
|
-
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
59
|
-
"context",
|
|
60
|
-
"property",
|
|
61
|
-
"index"
|
|
62
|
-
]);
|
|
63
|
-
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
64
|
-
get condition() {
|
|
65
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
66
|
-
get name() {
|
|
67
|
-
return property.getNameAsString();
|
|
68
|
-
},
|
|
69
|
-
context
|
|
70
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
71
|
-
get when() {
|
|
72
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
73
|
-
},
|
|
74
|
-
get children() {
|
|
75
|
-
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
76
|
-
get each() {
|
|
77
|
-
return property.getAlias();
|
|
78
|
-
},
|
|
79
|
-
joiner: _alloy_js_core.code` || `,
|
|
80
|
-
children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
81
|
-
name: alias,
|
|
82
|
-
context
|
|
83
|
-
})
|
|
84
|
-
})];
|
|
85
|
-
}
|
|
86
|
-
})];
|
|
87
|
-
},
|
|
88
|
-
get children() {
|
|
89
|
-
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
90
|
-
}
|
|
91
|
-
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
92
|
-
get condition() {
|
|
93
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
94
|
-
get name() {
|
|
95
|
-
return property.getNameAsString();
|
|
96
|
-
},
|
|
97
|
-
context
|
|
98
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
99
|
-
get when() {
|
|
100
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
101
|
-
},
|
|
102
|
-
get children() {
|
|
103
|
-
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
104
|
-
get each() {
|
|
105
|
-
return property.getAlias();
|
|
106
|
-
},
|
|
107
|
-
joiner: _alloy_js_core.code` || `,
|
|
108
|
-
children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
109
|
-
name: alias,
|
|
110
|
-
context
|
|
111
|
-
})
|
|
112
|
-
})];
|
|
113
|
-
}
|
|
114
|
-
})];
|
|
115
|
-
},
|
|
116
|
-
get children() {
|
|
117
|
-
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
118
|
-
}
|
|
119
|
-
})];
|
|
120
|
-
}
|
|
121
|
-
function ConfigPropertySet(props) {
|
|
122
|
-
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
123
|
-
"context",
|
|
124
|
-
"property",
|
|
125
|
-
"index"
|
|
126
|
-
]);
|
|
127
|
-
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
128
|
-
get condition() {
|
|
129
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
130
|
-
get name() {
|
|
131
|
-
return property.getNameAsString();
|
|
132
|
-
},
|
|
133
|
-
context
|
|
134
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
135
|
-
get when() {
|
|
136
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
137
|
-
},
|
|
138
|
-
get children() {
|
|
139
|
-
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
140
|
-
get each() {
|
|
141
|
-
return property.getAlias();
|
|
142
|
-
},
|
|
143
|
-
joiner: _alloy_js_core.code` || `,
|
|
144
|
-
children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
145
|
-
name: alias,
|
|
146
|
-
context
|
|
147
|
-
})
|
|
148
|
-
})];
|
|
149
|
-
}
|
|
150
|
-
})];
|
|
151
|
-
},
|
|
152
|
-
get children() {
|
|
153
|
-
return _alloy_js_core.code`
|
|
154
|
-
target["${property.getNameAsString()}"] = newValue;
|
|
155
|
-
return true;
|
|
156
|
-
`;
|
|
157
|
-
}
|
|
158
|
-
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
159
|
-
get condition() {
|
|
160
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
161
|
-
get name() {
|
|
162
|
-
return property.getNameAsString();
|
|
163
|
-
},
|
|
164
|
-
context
|
|
165
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
166
|
-
get when() {
|
|
167
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
168
|
-
},
|
|
169
|
-
get children() {
|
|
170
|
-
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
171
|
-
get each() {
|
|
172
|
-
return property.getAlias();
|
|
173
|
-
},
|
|
174
|
-
joiner: _alloy_js_core.code` || `,
|
|
175
|
-
children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
176
|
-
name: alias,
|
|
177
|
-
context
|
|
178
|
-
})
|
|
179
|
-
})];
|
|
180
|
-
}
|
|
181
|
-
})];
|
|
182
|
-
},
|
|
183
|
-
get children() {
|
|
184
|
-
return _alloy_js_core.code`
|
|
185
|
-
target["${property.getNameAsString()}"] = newValue;
|
|
186
|
-
return true;
|
|
187
|
-
`;
|
|
188
|
-
}
|
|
189
|
-
})];
|
|
190
|
-
}
|
|
191
|
-
const createEnvRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("createEnv");
|
|
192
|
-
const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
|
|
193
|
-
const envSerializerRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("EnvSerializer");
|
|
194
|
-
/**
|
|
195
|
-
* Generates the environment configuration module for the Powerlines project.
|
|
196
|
-
*/
|
|
197
|
-
function EnvBuiltin(props) {
|
|
198
|
-
const [{ defaultConfig, reflection, children }, rest] = (0, _alloy_js_core.splitProps)(props, [
|
|
199
|
-
"defaultConfig",
|
|
200
|
-
"reflection",
|
|
201
|
-
"children"
|
|
202
|
-
]);
|
|
203
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
204
|
-
const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
|
|
205
|
-
const envInstance = (0, _alloy_js_core.computed)(() => {
|
|
206
|
-
return new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
207
|
-
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
208
|
-
description: `The initial environment configuration state for the ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.name)} project.`,
|
|
209
|
-
types: []
|
|
210
|
-
}, reflection);
|
|
211
|
-
});
|
|
212
|
-
const reflectionGetProperties = (0, _alloy_js_core.computed)(() => reflection?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
213
|
-
const reflectionSetProperties = (0, _alloy_js_core.computed)(() => reflection?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
214
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
215
|
-
id: "env",
|
|
216
|
-
description: "The environment configuration module provides an interface to define environment configuration parameters."
|
|
217
|
-
}, rest, {
|
|
218
|
-
get imports() {
|
|
219
|
-
return (0, defu.default)({ "@powerlines/deepkit/vendor/type": [
|
|
220
|
-
"stringify",
|
|
221
|
-
"serializer",
|
|
222
|
-
"serializeFunction",
|
|
223
|
-
"deserializeFunction",
|
|
224
|
-
"ReflectionKind",
|
|
225
|
-
"Serializer",
|
|
226
|
-
"TemplateState",
|
|
227
|
-
"Type",
|
|
228
|
-
"TypeProperty",
|
|
229
|
-
"TypePropertySignature"
|
|
230
|
-
] }, rest.imports ?? {});
|
|
231
|
-
},
|
|
232
|
-
get children() {
|
|
233
|
-
return [
|
|
234
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
235
|
-
get when() {
|
|
236
|
-
return Boolean(reflection);
|
|
237
|
-
},
|
|
238
|
-
get children() {
|
|
239
|
-
return [
|
|
240
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, {
|
|
241
|
-
get defaultValue() {
|
|
242
|
-
return defaultValue.value;
|
|
243
|
-
},
|
|
244
|
-
reflection
|
|
245
|
-
}),
|
|
246
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
247
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
248
|
-
];
|
|
249
|
-
}
|
|
250
|
-
}),
|
|
251
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_object_declaration.ObjectDeclaration, {
|
|
252
|
-
name: "initialEnv",
|
|
253
|
-
type: "Partial<EnvBase>",
|
|
254
|
-
defaultValue,
|
|
255
|
-
reflection: envInstance,
|
|
256
|
-
"export": true,
|
|
257
|
-
"const": true,
|
|
258
|
-
doc: "The initial environment configuration object values for the runtime."
|
|
259
|
-
}),
|
|
260
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
261
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
262
|
-
heading: "The environment configuration serializer for the Powerlines application.",
|
|
263
|
-
get children() {
|
|
264
|
-
return [
|
|
265
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
266
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
267
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
268
|
-
];
|
|
269
|
-
}
|
|
270
|
-
}),
|
|
271
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ClassDeclaration, {
|
|
272
|
-
refkey: envSerializerRefkey,
|
|
273
|
-
name: "EnvSerializer",
|
|
274
|
-
"extends": "Serializer",
|
|
275
|
-
"export": true,
|
|
276
|
-
get children() {
|
|
277
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ClassMethod, {
|
|
278
|
-
name: "constructor",
|
|
279
|
-
"public": true,
|
|
280
|
-
doc: "Initializes a new instance of the `EnvSerializer` class.",
|
|
281
|
-
children: _alloy_js_core.code`super("env");
|
|
282
|
-
|
|
283
|
-
this.deserializeRegistry.register(
|
|
284
|
-
ReflectionKind.boolean,
|
|
285
|
-
(type: Type, state: TemplateState) => {
|
|
286
|
-
state.addSetter(
|
|
287
|
-
\`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
); `
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}),
|
|
294
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
295
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
296
|
-
heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
|
|
297
|
-
get children() {
|
|
298
|
-
return [
|
|
299
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
300
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
301
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
302
|
-
];
|
|
303
|
-
}
|
|
304
|
-
}),
|
|
305
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
306
|
-
name: "envSerializer",
|
|
307
|
-
"export": false,
|
|
308
|
-
"const": true,
|
|
309
|
-
get initializer() {
|
|
310
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.NewExpression, {
|
|
311
|
-
args: [],
|
|
312
|
-
target: "EnvSerializer"
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}),
|
|
316
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
317
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
318
|
-
heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
|
|
319
|
-
get children() {
|
|
320
|
-
return [
|
|
321
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
|
|
322
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
|
|
323
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
|
|
324
|
-
];
|
|
325
|
-
}
|
|
326
|
-
}),
|
|
327
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
328
|
-
name: "serializeEnv",
|
|
329
|
-
"export": true,
|
|
330
|
-
"const": true,
|
|
331
|
-
initializer: "serializeFunction<EnvBase>(envSerializer)"
|
|
332
|
-
}),
|
|
333
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
334
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
335
|
-
heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
|
|
336
|
-
get children() {
|
|
337
|
-
return [
|
|
338
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
|
|
339
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
|
|
340
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
}),
|
|
344
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
345
|
-
name: "deserializeEnv",
|
|
346
|
-
"export": true,
|
|
347
|
-
"const": true,
|
|
348
|
-
initializer: "deserializeFunction<EnvBase>(envSerializer)"
|
|
349
|
-
}),
|
|
350
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
351
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
352
|
-
heading: "Initializes the Powerlines environment configuration module.",
|
|
353
|
-
get children() {
|
|
354
|
-
return [
|
|
355
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
356
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
357
|
-
name: "environmentConfig",
|
|
358
|
-
children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
|
|
359
|
-
}),
|
|
360
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
|
|
361
|
-
];
|
|
362
|
-
}
|
|
363
|
-
}),
|
|
364
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
365
|
-
get when() {
|
|
366
|
-
return Boolean(context?.entryPath);
|
|
367
|
-
},
|
|
368
|
-
get children() {
|
|
369
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
370
|
-
refkey: createEnvRefkey,
|
|
371
|
-
async: false,
|
|
372
|
-
"export": true,
|
|
373
|
-
name: "createEnv",
|
|
374
|
-
parameters: [{
|
|
375
|
-
name: "environmentConfig",
|
|
376
|
-
type: `Partial<Env>`,
|
|
377
|
-
optional: false,
|
|
378
|
-
default: "{}"
|
|
379
|
-
}],
|
|
380
|
-
returnType: "Env",
|
|
381
|
-
get children() {
|
|
382
|
-
return [
|
|
383
|
-
_alloy_js_core.code`
|
|
384
|
-
return new Proxy<Env>(
|
|
385
|
-
deserializeEnv({
|
|
386
|
-
...initialEnv,
|
|
387
|
-
...environmentConfig
|
|
388
|
-
}) as Env,
|
|
389
|
-
{
|
|
390
|
-
get: (target: EnvBase, propertyName: string) => { `,
|
|
391
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
392
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
393
|
-
each: reflectionGetProperties,
|
|
394
|
-
children: (property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
|
|
395
|
-
index,
|
|
396
|
-
context,
|
|
397
|
-
property
|
|
398
|
-
})
|
|
399
|
-
}),
|
|
400
|
-
_alloy_js_core.code`
|
|
401
|
-
return undefined;
|
|
402
|
-
}, `,
|
|
403
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
404
|
-
_alloy_js_core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
|
|
405
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
406
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
407
|
-
each: reflectionSetProperties,
|
|
408
|
-
ender: _alloy_js_core.code` else `,
|
|
409
|
-
children: (property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
|
|
410
|
-
index,
|
|
411
|
-
context,
|
|
412
|
-
property
|
|
413
|
-
})
|
|
414
|
-
}),
|
|
415
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
416
|
-
_alloy_js_core.code`return false;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
);
|
|
420
|
-
`
|
|
421
|
-
];
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}),
|
|
426
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
427
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
428
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
429
|
-
heading: "The environment configuration object.",
|
|
430
|
-
get children() {
|
|
431
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` });
|
|
432
|
-
}
|
|
433
|
-
}),
|
|
434
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
435
|
-
refkey: envRefkey,
|
|
436
|
-
name: "env",
|
|
437
|
-
type: "Env",
|
|
438
|
-
"export": true,
|
|
439
|
-
"const": true,
|
|
440
|
-
get initializer() {
|
|
441
|
-
return [_alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
|
|
442
|
-
}
|
|
443
|
-
}),
|
|
444
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
445
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
446
|
-
"export": true,
|
|
447
|
-
"const": true,
|
|
448
|
-
name: "isCI",
|
|
449
|
-
doc: "Detect if the application is running in a continuous integration (CI) environment.",
|
|
450
|
-
initializer: _alloy_js_core.code`Boolean(
|
|
451
|
-
env.CI ||
|
|
452
|
-
env.RUN_ID ||
|
|
453
|
-
env.AGOLA_GIT_REF ||
|
|
454
|
-
env.AC_APPCIRCLE ||
|
|
455
|
-
env.APPVEYOR ||
|
|
456
|
-
env.CODEBUILD ||
|
|
457
|
-
env.TF_BUILD ||
|
|
458
|
-
env.bamboo_planKey ||
|
|
459
|
-
env.BITBUCKET_COMMIT ||
|
|
460
|
-
env.BITRISE_IO ||
|
|
461
|
-
env.BUDDY_WORKSPACE_ID ||
|
|
462
|
-
env.BUILDKITE ||
|
|
463
|
-
env.CIRCLECI ||
|
|
464
|
-
env.CIRRUS_CI ||
|
|
465
|
-
env.CF_BUILD_ID ||
|
|
466
|
-
env.CM_BUILD_ID ||
|
|
467
|
-
env.CI_NAME ||
|
|
468
|
-
env.DRONE ||
|
|
469
|
-
env.DSARI ||
|
|
470
|
-
env.EARTHLY_CI ||
|
|
471
|
-
env.EAS_BUILD ||
|
|
472
|
-
env.GERRIT_PROJECT ||
|
|
473
|
-
env.GITEA_ACTIONS ||
|
|
474
|
-
env.GITHUB_ACTIONS ||
|
|
475
|
-
env.GITLAB_CI ||
|
|
476
|
-
env.GOCD ||
|
|
477
|
-
env.BUILDER_OUTPUT ||
|
|
478
|
-
env.HARNESS_BUILD_ID ||
|
|
479
|
-
env.JENKINS_URL ||
|
|
480
|
-
env.LAYERCI ||
|
|
481
|
-
env.MAGNUM ||
|
|
482
|
-
env.NETLIFY ||
|
|
483
|
-
env.NEVERCODE ||
|
|
484
|
-
env.PROW_JOB_ID ||
|
|
485
|
-
env.RELEASE_BUILD_ID ||
|
|
486
|
-
env.RENDER ||
|
|
487
|
-
env.SAILCI ||
|
|
488
|
-
env.HUDSON ||
|
|
489
|
-
env.SCREWDRIVER ||
|
|
490
|
-
env.SEMAPHORE ||
|
|
491
|
-
env.SOURCEHUT ||
|
|
492
|
-
env.STRIDER ||
|
|
493
|
-
env.TASK_ID ||
|
|
494
|
-
env.RUN_ID ||
|
|
495
|
-
env.TEAMCITY_VERSION ||
|
|
496
|
-
env.TRAVIS ||
|
|
497
|
-
env.VELA ||
|
|
498
|
-
env.NOW_BUILDER ||
|
|
499
|
-
env.APPCENTER_BUILD_ID ||
|
|
500
|
-
env.CI_XCODE_PROJECT ||
|
|
501
|
-
env.XCS || false
|
|
502
|
-
);
|
|
503
|
-
`
|
|
504
|
-
}),
|
|
505
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
506
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
507
|
-
heading: "Detect the \\`mode\\` of the current runtime environment.",
|
|
508
|
-
get children() {
|
|
509
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_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, it is generally recommended to only allow a value in the following list:
|
|
510
|
-
- \`production\`
|
|
511
|
-
- \`test\`
|
|
512
|
-
- \`development\`
|
|
513
|
-
` });
|
|
514
|
-
}
|
|
515
|
-
}),
|
|
516
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
517
|
-
"export": true,
|
|
518
|
-
"const": true,
|
|
519
|
-
name: "mode",
|
|
520
|
-
initializer: _alloy_js_core.code`String(env.MODE) || "production"; `
|
|
521
|
-
}),
|
|
522
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
523
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
524
|
-
"export": true,
|
|
525
|
-
"const": true,
|
|
526
|
-
name: "isProduction",
|
|
527
|
-
doc: "Detect if the application is running in `\"production\"` mode",
|
|
528
|
-
initializer: _alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
|
|
529
|
-
}),
|
|
530
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
531
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
532
|
-
"export": true,
|
|
533
|
-
"const": true,
|
|
534
|
-
name: "isTest",
|
|
535
|
-
doc: "Detect if the application is running in `\"test\"` mode",
|
|
536
|
-
initializer: _alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
|
|
537
|
-
}),
|
|
538
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
539
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
540
|
-
"export": true,
|
|
541
|
-
"const": true,
|
|
542
|
-
name: "isDevelopment",
|
|
543
|
-
doc: "Detect if the application is running in `\"development\"` mode",
|
|
544
|
-
initializer: _alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
|
|
545
|
-
}),
|
|
546
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
547
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
548
|
-
"export": true,
|
|
549
|
-
"const": true,
|
|
550
|
-
name: "isDebug",
|
|
551
|
-
doc: "Detect if the application is currently being debugged",
|
|
552
|
-
initializer: _alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
553
|
-
}),
|
|
554
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
555
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
556
|
-
get when() {
|
|
557
|
-
return Boolean(children);
|
|
558
|
-
},
|
|
559
|
-
children
|
|
560
|
-
})
|
|
561
|
-
];
|
|
562
|
-
}
|
|
563
|
-
}));
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
//#endregion
|
|
567
|
-
exports.EnvBuiltin = EnvBuiltin;
|
|
568
|
-
exports.EnvTypeDefinition = EnvTypeDefinition;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Children } from "@alloy-js/core";
|
|
2
|
-
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
-
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
-
import { InterfaceDeclarationProps } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
5
|
-
|
|
6
|
-
//#region src/components/env-builtin.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
9
|
-
*/
|
|
10
|
-
declare function EnvTypeDefinition(props: Omit<InterfaceDeclarationProps, "name">): Children;
|
|
11
|
-
interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
12
|
-
defaultConfig?: Children;
|
|
13
|
-
reflection: ReflectionClass<any>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generates the environment configuration module for the Powerlines project.
|
|
17
|
-
*/
|
|
18
|
-
declare function EnvBuiltin(props: EnvBuiltinProps): Children;
|
|
19
|
-
declare type __ΩEnvBuiltinProps = any[];
|
|
20
|
-
//#endregion
|
|
21
|
-
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
22
|
-
//# sourceMappingURL=env-builtin.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.d.cts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;;;AAqEA;iBAAgB,iBAAA,CACd,KAAA,EAAO,IAAA,CAAK,yBAAA,YAAkC,QAAA;AAAA,UAkL/B,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;EAChB,UAAA,EAAY,eAAA;AAAA;;;;iBAUE,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA;AAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
2
|
-
import { Children } from "@alloy-js/core";
|
|
3
|
-
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
-
import { InterfaceDeclarationProps } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
5
|
-
|
|
6
|
-
//#region src/components/env-builtin.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
9
|
-
*/
|
|
10
|
-
declare function EnvTypeDefinition(props: Omit<InterfaceDeclarationProps, "name">): Children;
|
|
11
|
-
interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
12
|
-
defaultConfig?: Children;
|
|
13
|
-
reflection: ReflectionClass<any>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generates the environment configuration module for the Powerlines project.
|
|
17
|
-
*/
|
|
18
|
-
declare function EnvBuiltin(props: EnvBuiltinProps): Children;
|
|
19
|
-
declare type __ΩEnvBuiltinProps = any[];
|
|
20
|
-
//#endregion
|
|
21
|
-
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
22
|
-
//# sourceMappingURL=env-builtin.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.d.mts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;;;AAqEA;iBAAgB,iBAAA,CACd,KAAA,EAAO,IAAA,CAAK,yBAAA,YAAkC,QAAA;AAAA,UAkL/B,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;EAChB,UAAA,EAAY,eAAA;AAAA;;;;iBAUE,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA;AAAA"}
|