@powerlines/plugin-env 0.15.2 → 0.15.4
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/components/docs.cjs +3 -70
- package/dist/components/docs.d.cts +1 -8
- package/dist/components/docs.d.mts +1 -8
- package/dist/components/docs.mjs +2 -68
- package/dist/components/env.cjs +4 -574
- package/dist/components/env.d.cts +2 -19
- package/dist/components/env.d.mts +3 -19
- package/dist/components/env.mjs +2 -570
- package/dist/components/index.cjs +7 -5
- package/dist/components/index.d.cts +4 -2
- package/dist/components/index.d.mts +5 -2
- package/dist/components/index.mjs +4 -2
- package/dist/{plugin-alloy/src/types/components.d.cts → components-8W0Zgj0y.d.mts} +2 -1
- package/dist/components-C9bYrQVK.cjs +0 -0
- package/dist/components-CNIQFfeK.mjs +1 -0
- package/dist/create-reflection-resource-BNYxBgW2.mjs +9846 -0
- package/dist/create-reflection-resource-BWYhmX7O.cjs +10085 -0
- package/dist/docs-5r844zC1.d.mts +9 -0
- package/dist/docs-B66b9li3.mjs +219 -0
- package/dist/docs-_MmTNBQX.d.cts +9 -0
- package/dist/docs-hBlKCRWK.cjs +224 -0
- package/dist/env-BPodCdD1.d.cts +116 -0
- package/dist/env-IQvgnabX.mjs +1578 -0
- package/dist/env-cO4BUDn1.cjs +1596 -0
- package/dist/env-zhzvpUI5.d.mts +98 -0
- package/dist/index-BXxhKmeA.d.mts +1 -0
- package/dist/index-Cc7fCJU9.d.mts +1 -0
- package/dist/index-CqdNToYT.d.cts +1 -0
- package/dist/index-DWPDThxu.d.cts +1 -0
- package/dist/index.cjs +702 -77
- package/dist/index.d.cts +185 -12
- package/dist/index.d.mts +190 -17
- package/dist/index.mjs +648 -28
- package/dist/{deepkit/schemas/reflection.d.mts → plugin-BaInAuAh.d.mts} +326 -59
- package/dist/{deepkit/schemas/reflection.d.cts → plugin-BwuEBScL.d.cts} +268 -1
- package/dist/plugin-D3B5E_Hg.mjs +1 -0
- package/dist/plugin-D5qyQPqC.cjs +0 -0
- package/dist/resolved-BZG2cwRG.d.cts +1789 -0
- package/dist/resolved-V5COsfDu.d.mts +1791 -0
- package/dist/runtime-Bisl_1Ja.cjs +0 -0
- package/dist/runtime-Q8Ni8SeN.d.cts +794 -0
- package/dist/runtime-azNoeKr-.mjs +1 -0
- package/dist/runtime-qZ0Z2kEd.d.mts +794 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +4 -2
- package/dist/types/index.d.mts +5 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -156
- package/dist/types/plugin.d.mts +4 -158
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +2 -793
- package/dist/types/runtime.d.mts +2 -793
- package/dist/types/runtime.mjs +2 -0
- package/dist/types-DwElXV6q.mjs +1 -0
- package/dist/types-MYBaygjr.cjs +0 -0
- package/package.json +7 -7
- package/dist/_virtual/rolldown_runtime.cjs +0 -37
- package/dist/_virtual/rolldown_runtime.mjs +0 -29
- package/dist/babel/index.cjs +0 -1
- package/dist/babel/index.d.mts +0 -1
- package/dist/babel/index.mjs +0 -3
- package/dist/babel/plugin.cjs +0 -121
- package/dist/babel/plugin.d.cts +0 -7
- package/dist/babel/plugin.d.mts +0 -9
- package/dist/babel/plugin.mjs +0 -119
- package/dist/deepkit/schemas/reflection.cjs +0 -3940
- package/dist/deepkit/schemas/reflection.mjs +0 -3938
- package/dist/deepkit/schemas/reflection2.cjs +0 -4112
- package/dist/deepkit/schemas/reflection2.mjs +0 -4110
- package/dist/deepkit/src/capnp.cjs +0 -913
- package/dist/deepkit/src/capnp.mjs +0 -911
- package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
- package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
- package/dist/deepkit/src/reflect-type.cjs +0 -22
- package/dist/deepkit/src/reflect-type.mjs +0 -20
- package/dist/deepkit/src/resolve-reflections.cjs +0 -16
- package/dist/deepkit/src/resolve-reflections.mjs +0 -15
- package/dist/deepkit/src/transformer.cjs +0 -52
- package/dist/deepkit/src/transformer.mjs +0 -49
- package/dist/deepkit/src/transpile.cjs +0 -29
- package/dist/deepkit/src/transpile.mjs +0 -27
- package/dist/deepkit/src/types.d.cts +0 -10
- package/dist/deepkit/src/types.d.mts +0 -10
- package/dist/deepkit/src/utilities.cjs +0 -66
- package/dist/deepkit/src/utilities.mjs +0 -65
- package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
- package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
- package/dist/deepkit/src/vendor/type.cjs +0 -20
- package/dist/deepkit/src/vendor/type.d.cts +0 -7
- package/dist/deepkit/src/vendor/type.d.mts +0 -7
- package/dist/deepkit/src/vendor/type.mjs +0 -11
- package/dist/helpers/automd-generator.cjs +0 -22
- package/dist/helpers/automd-generator.mjs +0 -21
- package/dist/helpers/create-reflection-resource.cjs +0 -55
- package/dist/helpers/create-reflection-resource.d.cts +0 -15
- package/dist/helpers/create-reflection-resource.d.mts +0 -15
- package/dist/helpers/create-reflection-resource.mjs +0 -54
- package/dist/helpers/index.cjs +0 -6
- package/dist/helpers/index.d.mts +0 -6
- package/dist/helpers/index.mjs +0 -8
- package/dist/helpers/load.cjs +0 -83
- package/dist/helpers/load.d.cts +0 -35
- package/dist/helpers/load.d.mts +0 -36
- package/dist/helpers/load.mjs +0 -80
- package/dist/helpers/persistence.cjs +0 -214
- package/dist/helpers/persistence.d.cts +0 -84
- package/dist/helpers/persistence.d.mts +0 -84
- package/dist/helpers/persistence.mjs +0 -202
- package/dist/helpers/reflect.cjs +0 -111
- package/dist/helpers/reflect.d.cts +0 -46
- package/dist/helpers/reflect.d.mts +0 -46
- package/dist/helpers/reflect.mjs +0 -103
- package/dist/helpers/source-file-env.cjs +0 -28
- package/dist/helpers/source-file-env.d.cts +0 -8
- package/dist/helpers/source-file-env.d.mts +0 -8
- package/dist/helpers/source-file-env.mjs +0 -26
- package/dist/helpers/template-helpers.cjs +0 -42
- package/dist/helpers/template-helpers.d.cts +0 -15
- package/dist/helpers/template-helpers.d.mts +0 -15
- package/dist/helpers/template-helpers.mjs +0 -41
- package/dist/plugin-alloy/src/core/components/output.cjs +0 -45
- package/dist/plugin-alloy/src/core/components/output.mjs +0 -44
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
- package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
- package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
- package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
- package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
- package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
- package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
- package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
- package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
- package/dist/plugin-alloy/src/index.cjs +0 -93
- package/dist/plugin-alloy/src/index.mjs +0 -91
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
- package/dist/plugin-alloy/src/types/components.d.mts +0 -25
- package/dist/plugin-alloy/src/types/index.d.mts +0 -2
- package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
- package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -57
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -25
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -56
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -126
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -124
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -442
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -27
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -28
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -433
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -194
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -14
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -15
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -191
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -68
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -11
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -67
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
- package/dist/plugin-automd/src/index.cjs +0 -101
- package/dist/plugin-automd/src/index.mjs +0 -98
- package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
- package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
- package/dist/plugin-automd/src/types/toc.d.cts +0 -33
- package/dist/plugin-automd/src/types/toc.d.mts +0 -33
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
- package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
- package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
- package/dist/plugin-babel/src/helpers/index.cjs +0 -5
- package/dist/plugin-babel/src/helpers/index.mjs +0 -7
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
- package/dist/plugin-babel/src/helpers/options.cjs +0 -50
- package/dist/plugin-babel/src/helpers/options.mjs +0 -47
- package/dist/plugin-babel/src/index.cjs +0 -91
- package/dist/plugin-babel/src/index.mjs +0 -89
- package/dist/plugin-babel/src/types/index.d.mts +0 -1
- package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
- package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
- package/dist/powerlines/schemas/fs.d.mts +0 -1
- package/dist/powerlines/src/api.d.mts +0 -7
- package/dist/powerlines/src/index.d.mts +0 -12
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -5
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
- package/dist/powerlines/src/lib/entry.cjs +0 -12
- package/dist/powerlines/src/lib/entry.mjs +0 -14
- package/dist/powerlines/src/lib/logger.cjs +0 -41
- package/dist/powerlines/src/lib/logger.mjs +0 -39
- package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
- package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
- package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
- package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
- package/dist/powerlines/src/types/api.d.mts +0 -5
- package/dist/powerlines/src/types/babel.d.cts +0 -23
- package/dist/powerlines/src/types/babel.d.mts +0 -23
- package/dist/powerlines/src/types/build.d.cts +0 -145
- package/dist/powerlines/src/types/build.d.mts +0 -147
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -380
- package/dist/powerlines/src/types/config.d.mts +0 -381
- package/dist/powerlines/src/types/context.d.cts +0 -414
- package/dist/powerlines/src/types/context.d.mts +0 -416
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/index.d.mts +0 -12
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
- package/dist/powerlines/src/types/unplugin.d.mts +0 -7
package/dist/index.cjs
CHANGED
|
@@ -1,44 +1,669 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const require_plugin = require('./babel/plugin.cjs');
|
|
10
|
-
const require_source_file_env = require('./helpers/source-file-env.cjs');
|
|
11
|
-
const require_load = require('./helpers/load.cjs');
|
|
12
|
-
const require_create_reflection_resource = require('./helpers/create-reflection-resource.cjs');
|
|
13
|
-
const require_components_env = require('./components/env.cjs');
|
|
14
|
-
const require_automd_generator = require('./helpers/automd-generator.cjs');
|
|
15
|
-
require('./babel/index.cjs');
|
|
16
|
-
const require_components_docs = require('./components/docs.cjs');
|
|
17
|
-
require('./components/index.cjs');
|
|
18
|
-
const require_template_helpers = require('./helpers/template-helpers.cjs');
|
|
19
|
-
require('./helpers/index.cjs');
|
|
2
|
+
const require_create_reflection_resource = require('./create-reflection-resource-BWYhmX7O.cjs');
|
|
3
|
+
const require_env = require('./env-cO4BUDn1.cjs');
|
|
4
|
+
const require_docs = require('./docs-hBlKCRWK.cjs');
|
|
5
|
+
require('./components-C9bYrQVK.cjs');
|
|
6
|
+
require('./plugin-D5qyQPqC.cjs');
|
|
7
|
+
require('./runtime-Bisl_1Ja.cjs');
|
|
8
|
+
require('./types-MYBaygjr.cjs');
|
|
20
9
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
10
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
11
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
12
|
+
let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
|
|
13
|
+
__alloy_js_rollup_plugin = require_create_reflection_resource.__toESM(__alloy_js_rollup_plugin);
|
|
14
|
+
let __stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
15
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
21
16
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
17
|
+
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
18
|
+
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
19
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
20
|
+
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
21
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
22
|
+
let automd = require("automd");
|
|
23
|
+
let c12 = require("c12");
|
|
22
24
|
let defu = require("defu");
|
|
23
|
-
defu =
|
|
25
|
+
defu = require_create_reflection_resource.__toESM(defu);
|
|
26
|
+
let markdown_toc = require("markdown-toc");
|
|
27
|
+
markdown_toc = require_create_reflection_resource.__toESM(markdown_toc);
|
|
28
|
+
let __babel_core = require("@babel/core");
|
|
24
29
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
30
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
25
31
|
let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
32
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
33
|
+
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
34
|
+
require("@stryke/type-checks/is-object");
|
|
35
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
36
|
+
let chalk = require("chalk");
|
|
37
|
+
chalk = require_create_reflection_resource.__toESM(chalk);
|
|
38
|
+
let __babel_generator = require("@babel/generator");
|
|
39
|
+
__babel_generator = require_create_reflection_resource.__toESM(__babel_generator);
|
|
40
|
+
require("@babel/parser");
|
|
41
|
+
let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
|
|
42
|
+
require("@storm-software/config-tools/logger");
|
|
43
|
+
require("@storm-software/config-tools/utilities/colors");
|
|
44
|
+
require("@stryke/helpers/noop");
|
|
45
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
26
46
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
47
|
+
let __babel_types = require("@babel/types");
|
|
48
|
+
__babel_types = require_create_reflection_resource.__toESM(__babel_types);
|
|
49
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
27
50
|
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
28
51
|
let __stryke_env_types = require("@stryke/env/types");
|
|
29
52
|
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
30
53
|
let __stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
31
54
|
let __stryke_path_join = require("@stryke/path/join");
|
|
32
55
|
let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
56
|
+
let __stryke_capnp = require("@stryke/capnp");
|
|
57
|
+
__stryke_capnp = require_create_reflection_resource.__toESM(__stryke_capnp);
|
|
58
|
+
let __stryke_fs_buffer = require("@stryke/fs/buffer");
|
|
59
|
+
let node_fs = require("node:fs");
|
|
33
60
|
|
|
61
|
+
//#region ../plugin-alloy/src/core/components/output.tsx
|
|
62
|
+
/**
|
|
63
|
+
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
64
|
+
*/
|
|
65
|
+
function Output(props) {
|
|
66
|
+
const [{ children, context, meta, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
67
|
+
"children",
|
|
68
|
+
"context",
|
|
69
|
+
"meta",
|
|
70
|
+
"basePath"
|
|
71
|
+
]);
|
|
72
|
+
const contextRef = (0, __alloy_js_core.ref)(context);
|
|
73
|
+
const metaRef = (0, __alloy_js_core.ref)(meta ?? {});
|
|
74
|
+
const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
|
|
75
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Output, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
76
|
+
get basePath() {
|
|
77
|
+
return basePathRef.value;
|
|
78
|
+
},
|
|
79
|
+
get children() {
|
|
80
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_create_reflection_resource.PowerlinesContext.Provider, {
|
|
81
|
+
value: {
|
|
82
|
+
ref: contextRef,
|
|
83
|
+
meta: metaRef
|
|
84
|
+
},
|
|
85
|
+
get children() {
|
|
86
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
87
|
+
get when() {
|
|
88
|
+
return Boolean(contextRef.value);
|
|
89
|
+
},
|
|
90
|
+
children
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../plugin-alloy/src/index.tsx
|
|
100
|
+
/**
|
|
101
|
+
* Alloy-js plugin for Powerlines.
|
|
102
|
+
*
|
|
103
|
+
* @param options - The Alloy-js plugin user configuration options.
|
|
104
|
+
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
105
|
+
*/
|
|
106
|
+
const plugin$3 = (options = {}) => {
|
|
107
|
+
return [{
|
|
108
|
+
name: "alloy:config",
|
|
109
|
+
config() {
|
|
110
|
+
return {
|
|
111
|
+
alloy: {
|
|
112
|
+
typescript: true,
|
|
113
|
+
...options
|
|
114
|
+
},
|
|
115
|
+
build: {
|
|
116
|
+
inputOptions: { transform: { jsx: {
|
|
117
|
+
runtime: "classic",
|
|
118
|
+
pragma: "Alloy.createElement",
|
|
119
|
+
importSource: "@alloy-js/core"
|
|
120
|
+
} } },
|
|
121
|
+
plugins: [(0, __alloy_js_rollup_plugin.default)()]
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
async configResolved() {
|
|
126
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
127
|
+
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
128
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
129
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
130
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
131
|
+
}
|
|
132
|
+
this.dependencies["@alloy-js/core"] = "^0.22.0";
|
|
133
|
+
if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
|
|
134
|
+
if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
|
|
135
|
+
if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
name: "alloy:update-context",
|
|
139
|
+
configResolved: {
|
|
140
|
+
order: "pre",
|
|
141
|
+
async handler() {
|
|
142
|
+
this.render = async (children) => {
|
|
143
|
+
const _self$ = this;
|
|
144
|
+
const meta = {};
|
|
145
|
+
await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(Output, {
|
|
146
|
+
context: _self$,
|
|
147
|
+
meta,
|
|
148
|
+
get basePath() {
|
|
149
|
+
return _self$.workspaceConfig.workspaceRoot;
|
|
150
|
+
},
|
|
151
|
+
children
|
|
152
|
+
})), {
|
|
153
|
+
visitDirectory: (directory) => {
|
|
154
|
+
if (this.fs.existsSync(directory.path)) return;
|
|
155
|
+
this.fs.mkdirSync(directory.path);
|
|
156
|
+
},
|
|
157
|
+
visitFile: (file) => {
|
|
158
|
+
if ("contents" in file) {
|
|
159
|
+
const metadata = meta[file.path] ?? {};
|
|
160
|
+
if (metadata.kind === "builtin") {
|
|
161
|
+
if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
|
|
162
|
+
this.emitBuiltinSync(file.contents, metadata.id, file.path, {
|
|
163
|
+
skipFormat: metadata.skipFormat,
|
|
164
|
+
storage: metadata.storage
|
|
165
|
+
});
|
|
166
|
+
} else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
|
|
167
|
+
skipFormat: metadata.skipFormat,
|
|
168
|
+
storage: metadata.storage,
|
|
169
|
+
...metadata.typeDefinition ?? {}
|
|
170
|
+
});
|
|
171
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
172
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}];
|
|
179
|
+
};
|
|
180
|
+
var src_default$1 = plugin$3;
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region ../plugin-automd/src/index.ts
|
|
184
|
+
/**
|
|
185
|
+
* AutoMD Plugin
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
189
|
+
*
|
|
190
|
+
* @see https://automd.unjs.io/
|
|
191
|
+
*
|
|
192
|
+
* @param options - The plugin options.
|
|
193
|
+
* @returns A Powerlines plugin instance.
|
|
194
|
+
*/
|
|
195
|
+
const plugin$2 = (options = {}) => {
|
|
196
|
+
return {
|
|
197
|
+
name: "automd",
|
|
198
|
+
async config() {
|
|
199
|
+
const config = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
|
|
200
|
+
if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
|
|
201
|
+
if (!config.prefix.includes("automd")) config.prefix.push("automd");
|
|
202
|
+
if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
|
|
203
|
+
return { automd: (0, defu.default)(config ?? {}, {
|
|
204
|
+
configFile: options.configFile,
|
|
205
|
+
allowIssues: true,
|
|
206
|
+
dir: this.config.projectRoot,
|
|
207
|
+
watch: false,
|
|
208
|
+
input: "README.md",
|
|
209
|
+
toc: {
|
|
210
|
+
maxDepth: 6,
|
|
211
|
+
bullets: "-"
|
|
212
|
+
}
|
|
213
|
+
}) };
|
|
214
|
+
},
|
|
215
|
+
async configResolved() {
|
|
216
|
+
if (this.config.framework && !(0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
|
|
217
|
+
if (this.config.automd.configFile) {
|
|
218
|
+
const { config } = await (0, c12.loadConfig)({
|
|
219
|
+
cwd: this.config.automd.dir,
|
|
220
|
+
configFile: this.config.automd.configFile,
|
|
221
|
+
defaults: {
|
|
222
|
+
ignore: [
|
|
223
|
+
"**/node_modules",
|
|
224
|
+
"**/dist",
|
|
225
|
+
"**/.*"
|
|
226
|
+
],
|
|
227
|
+
dir: this.config.automd.dir
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
|
|
231
|
+
...config,
|
|
232
|
+
prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
236
|
+
if (input.includes("*")) return (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
|
|
237
|
+
return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
|
|
238
|
+
}))).flat();
|
|
239
|
+
if (this.config.automd.output && !(0, __stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, __stryke_path_append.appendPath)(this.config.automd.output, this.config.projectRoot);
|
|
240
|
+
this.config.automd.generators ??= {};
|
|
241
|
+
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
242
|
+
name: "toc",
|
|
243
|
+
generate: (ctx) => {
|
|
244
|
+
const opts = this.config.automd.toc ?? {};
|
|
245
|
+
return { contents: (0, markdown_toc.default)(ctx.block.md, {
|
|
246
|
+
...opts,
|
|
247
|
+
maxdepth: opts.maxDepth,
|
|
248
|
+
first1: opts.firstH1
|
|
249
|
+
}).content };
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
async docs() {
|
|
254
|
+
await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
255
|
+
const contents = await this.fs.read(input);
|
|
256
|
+
if (contents) {
|
|
257
|
+
const result = await (0, automd.transform)(contents, this.config.automd);
|
|
258
|
+
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
259
|
+
if (result.hasChanged) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.automd.output ? (0, __stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, __stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
|
|
260
|
+
}
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
var src_default$2 = plugin$2;
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region ../plugin-babel/src/helpers/filters.ts
|
|
269
|
+
function getPluginName(plugin$4) {
|
|
270
|
+
return (0, __stryke_type_checks_is_set_string.isSetString)(plugin$4) ? plugin$4 : Array.isArray(plugin$4) && plugin$4.length > 0 ? getPluginName(plugin$4[0]) : plugin$4.$$name || plugin$4.name ? plugin$4.$$name || plugin$4.name : void 0;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Check if a Babel plugin is a duplicate of another plugin in the list.
|
|
274
|
+
*
|
|
275
|
+
* @param plugins - The list of existing Babel plugins.
|
|
276
|
+
* @param plugin - The Babel plugin to check for duplicates.
|
|
277
|
+
* @returns True if the plugin is a duplicate, false otherwise.
|
|
278
|
+
*/
|
|
279
|
+
function isDuplicatePlugin(plugins, plugin$4) {
|
|
280
|
+
return !!(getPluginName(plugin$4) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin$4)));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region ../plugin-babel/src/helpers/options.ts
|
|
285
|
+
function resolvePluginFunction(context, plugin$4) {
|
|
286
|
+
try {
|
|
287
|
+
return Array.isArray(plugin$4) && plugin$4.length > 0 && plugin$4[0] ? (0, __stryke_type_checks_is_function.isFunction)(plugin$4[0]) ? plugin$4[0](context) : plugin$4[0] : (0, __stryke_type_checks_is_function.isFunction)(plugin$4) ? plugin$4(context) : plugin$4;
|
|
288
|
+
} catch {
|
|
289
|
+
return plugin$4[0];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Resolve the [Babel](https://babeljs.io/) plugin.
|
|
294
|
+
*
|
|
295
|
+
* @param context - The context for the transformation.
|
|
296
|
+
* @param code - The code to be transformed.
|
|
297
|
+
* @param id - The ID of the source file.
|
|
298
|
+
* @param plugin - The Babel plugin to resolve.
|
|
299
|
+
* @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
|
|
300
|
+
*/
|
|
301
|
+
function resolveBabelPlugin(context, code, id, plugin$4) {
|
|
302
|
+
if (Array.isArray(plugin$4) && plugin$4.length > 0 && plugin$4[0]) {
|
|
303
|
+
if (plugin$4.length > 2 && plugin$4[2] && (0, __stryke_type_checks_is_function.isFunction)(plugin$4[2]) && !plugin$4[2](code, id)) {
|
|
304
|
+
context.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping filtered Babel plugin ${chalk.default.bold.cyanBright(getPluginName(plugin$4) || "unnamed")} for ${id}`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
return plugin$4.length > 2 ? [
|
|
308
|
+
resolvePluginFunction(context, plugin$4),
|
|
309
|
+
plugin$4[1],
|
|
310
|
+
plugin$4[2]
|
|
311
|
+
] : [
|
|
312
|
+
resolvePluginFunction(context, plugin$4),
|
|
313
|
+
plugin$4[1],
|
|
314
|
+
null
|
|
315
|
+
];
|
|
316
|
+
}
|
|
317
|
+
return [
|
|
318
|
+
resolvePluginFunction(context, plugin$4),
|
|
319
|
+
{},
|
|
320
|
+
null
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region ../plugin-babel/src/helpers/ast-utils.ts
|
|
326
|
+
let generate = __babel_generator.default;
|
|
327
|
+
if ("default" in generate) generate = generate.default;
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region ../powerlines/src/lib/logger.ts
|
|
331
|
+
const BADGE_COLORS = [
|
|
332
|
+
"#00A0DD",
|
|
333
|
+
"#6FCE4E",
|
|
334
|
+
"#FBBF24",
|
|
335
|
+
"#F43F5E",
|
|
336
|
+
"#3B82F6",
|
|
337
|
+
"#A855F7",
|
|
338
|
+
"#469592",
|
|
339
|
+
"#288EDF",
|
|
340
|
+
"#D8B4FE",
|
|
341
|
+
"#10B981",
|
|
342
|
+
"#EF4444",
|
|
343
|
+
"#F0EC56",
|
|
344
|
+
"#F472B6",
|
|
345
|
+
"#22D3EE",
|
|
346
|
+
"#EAB308",
|
|
347
|
+
"#84CC16",
|
|
348
|
+
"#F87171",
|
|
349
|
+
"#0EA5E9",
|
|
350
|
+
"#D946EF",
|
|
351
|
+
"#FACC15",
|
|
352
|
+
"#34D399",
|
|
353
|
+
"#8B5CF6"
|
|
354
|
+
];
|
|
355
|
+
const extendLog = (logFn, name) => {
|
|
356
|
+
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region ../plugin-babel/src/helpers/create-plugin.ts
|
|
361
|
+
/**
|
|
362
|
+
* Create a Babel plugin using the provided builder function.
|
|
363
|
+
*
|
|
364
|
+
* @param name - The name of the plugin.
|
|
365
|
+
* @param builder - The builder function that defines the plugin behavior.
|
|
366
|
+
* @returns A Babel plugin declaration.
|
|
367
|
+
*/
|
|
368
|
+
function createBabelPlugin(name, builder) {
|
|
369
|
+
const plugin$4 = (context) => {
|
|
370
|
+
return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
|
|
371
|
+
api.cache.using(() => context.meta.checksum);
|
|
372
|
+
api.assertVersion("^7.0.0-0");
|
|
373
|
+
const log = extendLog(context.log, name);
|
|
374
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
375
|
+
const result = builder({
|
|
376
|
+
log,
|
|
377
|
+
name,
|
|
378
|
+
api,
|
|
379
|
+
options,
|
|
380
|
+
context,
|
|
381
|
+
dirname
|
|
382
|
+
});
|
|
383
|
+
result.name = name;
|
|
384
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
|
|
385
|
+
return result;
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
plugin$4.$$name = name;
|
|
389
|
+
return plugin$4;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region ../plugin-babel/src/helpers/module-helpers.ts
|
|
394
|
+
/**
|
|
395
|
+
* Adds an import to the program if it doesn't already exist.
|
|
396
|
+
*
|
|
397
|
+
* @param path - The current NodePath in the AST.
|
|
398
|
+
* @param specifier - The import specifier.
|
|
399
|
+
*/
|
|
400
|
+
function addImport(path, specifier) {
|
|
401
|
+
addImportsToProgram(path.scope.getProgramParent().path, specifier);
|
|
402
|
+
}
|
|
403
|
+
function isNonNamespacedImport(importDeclPath) {
|
|
404
|
+
return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
|
|
405
|
+
}
|
|
406
|
+
function getExistingImports(program) {
|
|
407
|
+
const existingImports = /* @__PURE__ */ new Map();
|
|
408
|
+
program.traverse({ ImportDeclaration(path) {
|
|
409
|
+
if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
|
|
410
|
+
} });
|
|
411
|
+
return existingImports;
|
|
412
|
+
}
|
|
413
|
+
function addImportsToProgram(path, specifier) {
|
|
414
|
+
/**
|
|
415
|
+
* If an existing import of this module exists (ie \`import \{ ... \} from
|
|
416
|
+
* '<moduleName>'\`), inject new imported specifiers into the list of
|
|
417
|
+
* destructured variables.
|
|
418
|
+
*/
|
|
419
|
+
if (!getExistingImports(path).get(specifier.module)) path.unshiftContainer("body", __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(specifier.name || specifier.imported), __babel_types.identifier(specifier.imported))], __babel_types.stringLiteral(specifier.module)));
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region ../plugin-babel/src/index.ts
|
|
424
|
+
/**
|
|
425
|
+
* Babel plugin for Powerlines.
|
|
426
|
+
*
|
|
427
|
+
* @param options - The Babel plugin user configuration options.
|
|
428
|
+
* @returns A Powerlines plugin that integrates Babel transformations.
|
|
429
|
+
*/
|
|
430
|
+
const plugin$1 = (options = {}) => {
|
|
431
|
+
return {
|
|
432
|
+
name: "babel",
|
|
433
|
+
config() {
|
|
434
|
+
if (!(0, __stryke_type_checks_is_set_object.isSetObject)(options)) return;
|
|
435
|
+
return { transform: { babel: options } };
|
|
436
|
+
},
|
|
437
|
+
configResolved: {
|
|
438
|
+
order: "pre",
|
|
439
|
+
handler() {
|
|
440
|
+
this.devDependencies["@babel/core"] = "^7.28.4";
|
|
441
|
+
this.config.transform.babel = (0, defu.default)(this.config.transform.babel ?? {}, {
|
|
442
|
+
plugins: [],
|
|
443
|
+
presets: []
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
async transform(code, id) {
|
|
448
|
+
if ((0, __stryke_path_is_parent_path.isParentPath)(id, this.powerlinesPath) || code.includes("/* @storm-ignore */") || code.includes("/* @storm-disable */")) {
|
|
449
|
+
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping Babel transformation for: ${id}`);
|
|
450
|
+
return {
|
|
451
|
+
code,
|
|
452
|
+
id
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Babel transforming file: ${id}`);
|
|
456
|
+
const plugins = this.config.transform.babel.plugins.map((plugin$4) => resolveBabelPlugin(this, code, id, plugin$4)).filter((plugin$4, _, arr) => plugin$4 && !isDuplicatePlugin(arr, plugin$4));
|
|
457
|
+
const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
|
|
458
|
+
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
459
|
+
code,
|
|
460
|
+
id
|
|
461
|
+
};
|
|
462
|
+
if ([
|
|
463
|
+
"ts",
|
|
464
|
+
"cts",
|
|
465
|
+
"mts",
|
|
466
|
+
"tsx"
|
|
467
|
+
].includes((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id)) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === ".tsx" }]);
|
|
468
|
+
const result = await (0, __babel_core.transformAsync)(code, {
|
|
469
|
+
highlightCode: true,
|
|
470
|
+
code: true,
|
|
471
|
+
ast: false,
|
|
472
|
+
cloneInputAst: false,
|
|
473
|
+
comments: true,
|
|
474
|
+
sourceType: "module",
|
|
475
|
+
configFile: false,
|
|
476
|
+
babelrc: false,
|
|
477
|
+
envName: this.config.mode,
|
|
478
|
+
caller: { name: this.config.framework },
|
|
479
|
+
...this.config.transform.babel ?? {},
|
|
480
|
+
filename: id,
|
|
481
|
+
plugins: plugins.map((plugin$4) => {
|
|
482
|
+
return Array.isArray(plugin$4) && plugin$4.length >= 2 ? [plugin$4[0], (0, defu.default)(plugin$4.length > 1 && plugin$4[1] ? plugin$4[1] : {}, { options })] : plugin$4;
|
|
483
|
+
}).filter(Boolean),
|
|
484
|
+
presets: presets.map((preset) => {
|
|
485
|
+
return Array.isArray(preset) && preset.length >= 2 ? [preset[0], (0, defu.default)(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
|
|
486
|
+
}).filter(Boolean)
|
|
487
|
+
});
|
|
488
|
+
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
489
|
+
return {
|
|
490
|
+
code: result.code,
|
|
491
|
+
id
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
var src_default$3 = plugin$1;
|
|
497
|
+
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/babel/plugin.ts
|
|
500
|
+
const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
501
|
+
function extractEnv(node, pass, isInjectable = false) {
|
|
502
|
+
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
503
|
+
if (node.name) {
|
|
504
|
+
const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
|
|
505
|
+
let name = node.name;
|
|
506
|
+
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
507
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
508
|
+
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
|
|
509
|
+
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
|
|
510
|
+
if (!envProperty || envProperty.isIgnored()) return;
|
|
511
|
+
if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
|
|
512
|
+
if (context.config.env.inject && isInjectable) {
|
|
513
|
+
let value = context.env.parsed?.[name];
|
|
514
|
+
if (value === void 0) {
|
|
515
|
+
const prefix$1 = context.config.env.prefix.find((pre) => {
|
|
516
|
+
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
517
|
+
});
|
|
518
|
+
if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
|
|
519
|
+
}
|
|
520
|
+
value ??= envProperty.getDefaultValue();
|
|
521
|
+
if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
|
|
522
|
+
return require_env.stringifyDefaultValue(envProperty, value);
|
|
523
|
+
}
|
|
524
|
+
} else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
|
|
525
|
+
|
|
526
|
+
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
visitor: { MemberExpression(path, pass) {
|
|
531
|
+
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
|
|
532
|
+
const identifier = path.get("property")?.node;
|
|
533
|
+
extractEnv(identifier, pass, false);
|
|
534
|
+
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
535
|
+
addImport(path, {
|
|
536
|
+
module: "storm:env",
|
|
537
|
+
name: "env",
|
|
538
|
+
imported: "env"
|
|
539
|
+
});
|
|
540
|
+
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
|
|
541
|
+
name: "useStorm",
|
|
542
|
+
type: "Identifier"
|
|
543
|
+
} }) && path.get("property")?.isIdentifier()) {
|
|
544
|
+
const identifier = path.get("property")?.node;
|
|
545
|
+
extractEnv(identifier, pass, false);
|
|
546
|
+
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
547
|
+
addImport(path, {
|
|
548
|
+
module: "storm:env",
|
|
549
|
+
name: "env",
|
|
550
|
+
imported: "env"
|
|
551
|
+
});
|
|
552
|
+
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
553
|
+
const identifier = path.get("property")?.node;
|
|
554
|
+
if (!identifier.name) return;
|
|
555
|
+
extractEnv(identifier, pass, false);
|
|
556
|
+
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
557
|
+
addImport(path, {
|
|
558
|
+
module: "storm:env",
|
|
559
|
+
name: "env",
|
|
560
|
+
imported: "env"
|
|
561
|
+
});
|
|
562
|
+
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
|
|
563
|
+
const identifier = path.get("property")?.node;
|
|
564
|
+
if (!identifier.name) return;
|
|
565
|
+
extractEnv(identifier, pass, false);
|
|
566
|
+
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
567
|
+
addImport(path, {
|
|
568
|
+
module: "storm:env",
|
|
569
|
+
name: "env",
|
|
570
|
+
imported: "env"
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
} },
|
|
574
|
+
post() {
|
|
575
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
|
|
576
|
+
let persistedEnv = __powerlines_deepkit_vendor_type.ReflectionClass.from({
|
|
577
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
578
|
+
description: `An object containing the environment variables used by the application.`,
|
|
579
|
+
types: []
|
|
580
|
+
});
|
|
581
|
+
const reflectionPath = require_create_reflection_resource.getEnvReflectionsPath(context, "env");
|
|
582
|
+
if (reflectionPath && (0, node_fs.existsSync)(reflectionPath)) {
|
|
583
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
|
|
584
|
+
persistedEnv = (0, __powerlines_deepkit_vendor_type.resolveClassType)((0, __powerlines_deepkit_vendor_type.deserializeType)(require_create_reflection_resource.convertFromCapnp(new __stryke_capnp.Message((0, __stryke_fs_buffer.readFileBufferSync)(reflectionPath), false).getRoot(require_create_reflection_resource.SerializedTypes).types)));
|
|
585
|
+
}
|
|
586
|
+
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
|
|
587
|
+
persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
|
|
588
|
+
context.env.used.env.addProperty({
|
|
589
|
+
...property,
|
|
590
|
+
name: property.getNameAsString(),
|
|
591
|
+
description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
|
|
592
|
+
default: property.getDefaultValue(),
|
|
593
|
+
optional: property.isOptional() ? true : void 0,
|
|
594
|
+
readonly: property.isReadonly() ? true : void 0,
|
|
595
|
+
visibility: property.getVisibility(),
|
|
596
|
+
type: property.getType(),
|
|
597
|
+
tags: property.getTags()
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/helpers/automd-generator.ts
|
|
606
|
+
/**
|
|
607
|
+
* AutoMD generator to generate environment variable documentation
|
|
608
|
+
*
|
|
609
|
+
* @param context - The generator context.
|
|
610
|
+
* @returns The generated documentation content.
|
|
611
|
+
*/
|
|
612
|
+
const env = (context) => (0, automd.defineGenerator)({
|
|
613
|
+
name: "env",
|
|
614
|
+
async generate() {
|
|
615
|
+
const envDocFile = (0, __stryke_path_join_paths.joinPaths)(context.config.projectRoot, "docs", "generated", "env.md");
|
|
616
|
+
if (!context.fs.existsSync(envDocFile)) return { contents: "" };
|
|
617
|
+
return { contents: await context.fs.read(envDocFile) || "" };
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/helpers/template-helpers.ts
|
|
623
|
+
/**
|
|
624
|
+
* Creates the reflection data used when generating runtime template files.
|
|
625
|
+
*
|
|
626
|
+
* @param context - The context for the configuration plugin.
|
|
627
|
+
* @param name - The name of the configuration template.
|
|
628
|
+
* @returns The reflection for the specified configuration template.
|
|
629
|
+
*/
|
|
630
|
+
async function createTemplateReflection(context, name) {
|
|
631
|
+
const reflection = await require_create_reflection_resource.readEnvTypeReflection(context, name);
|
|
632
|
+
reflection.getProperties().forEach((prop) => {
|
|
633
|
+
prop.getAlias().filter(Boolean).forEach((alias) => {
|
|
634
|
+
reflection.addProperty({
|
|
635
|
+
name: alias,
|
|
636
|
+
optional: prop.isOptional() ? true : void 0,
|
|
637
|
+
readonly: prop.isReadonly() ? true : void 0,
|
|
638
|
+
description: prop.getDescription(),
|
|
639
|
+
visibility: prop.getVisibility(),
|
|
640
|
+
type: prop.getType(),
|
|
641
|
+
default: prop.getDefaultValue(),
|
|
642
|
+
tags: {
|
|
643
|
+
hidden: prop.isHidden(),
|
|
644
|
+
ignore: prop.isIgnored(),
|
|
645
|
+
internal: prop.isInternal(),
|
|
646
|
+
alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
|
|
647
|
+
title: prop.getTitle() || (0, __stryke_string_format_title_case.titleCase)(prop.name),
|
|
648
|
+
readonly: prop.isReadonly(),
|
|
649
|
+
permission: prop.getPermission(),
|
|
650
|
+
domain: prop.getDomain()
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
return reflection;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
//#endregion
|
|
34
659
|
//#region src/index.tsx
|
|
35
660
|
/**
|
|
36
661
|
* A Powerlines plugin to inject environment variables into the source code.
|
|
37
662
|
*/
|
|
38
663
|
const plugin = (options = {}) => {
|
|
39
664
|
return [
|
|
40
|
-
|
|
41
|
-
|
|
665
|
+
src_default$1(options.alloy),
|
|
666
|
+
src_default$3(options.babel),
|
|
42
667
|
{
|
|
43
668
|
name: "env",
|
|
44
669
|
async config() {
|
|
@@ -48,17 +673,17 @@ const plugin = (options = {}) => {
|
|
|
48
673
|
types: {},
|
|
49
674
|
prefix: []
|
|
50
675
|
}),
|
|
51
|
-
transform: { babel: { plugins: [
|
|
676
|
+
transform: { babel: { plugins: [envBabelPlugin] } }
|
|
52
677
|
};
|
|
53
678
|
if (config.env.types) config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.types);
|
|
54
679
|
else {
|
|
55
680
|
this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, "The `env.types` configuration parameter was not provided. Please ensure this is expected.");
|
|
56
|
-
const envDefaultTypeDefinition = await
|
|
681
|
+
const envDefaultTypeDefinition = await require_create_reflection_resource.getEnvDefaultTypeDefinition(this);
|
|
57
682
|
config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
|
|
58
683
|
}
|
|
59
684
|
if (config.env.secrets) config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.secrets);
|
|
60
685
|
else {
|
|
61
|
-
const secretsDefaultTypeDefinition = await
|
|
686
|
+
const secretsDefaultTypeDefinition = await require_create_reflection_resource.getSecretsDefaultTypeDefinition(this);
|
|
62
687
|
config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
|
|
63
688
|
}
|
|
64
689
|
config.env.prefix = (0, __stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce((ret, prefix) => {
|
|
@@ -75,7 +700,7 @@ const plugin = (options = {}) => {
|
|
|
75
700
|
async configResolved() {
|
|
76
701
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
77
702
|
this.config.env.inject ??= this.config.projectType === "application";
|
|
78
|
-
this.env = (0, defu.default)({ parsed: await
|
|
703
|
+
this.env = (0, defu.default)({ parsed: await require_create_reflection_resource.loadEnv(this, this.config.env) }, this.env ?? {}, {
|
|
79
704
|
types: { env: {} },
|
|
80
705
|
used: {
|
|
81
706
|
env: {},
|
|
@@ -84,22 +709,22 @@ const plugin = (options = {}) => {
|
|
|
84
709
|
parsed: {},
|
|
85
710
|
injected: {}
|
|
86
711
|
});
|
|
87
|
-
if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(
|
|
712
|
+
if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvTypeReflectionsPath(this, "env"))) {
|
|
88
713
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping reflection initialization as the meta checksum has not changed.`);
|
|
89
|
-
this.env.types.env = await
|
|
90
|
-
if ((0, __stryke_fs_exists.existsSync)(
|
|
91
|
-
if ((0, __stryke_fs_exists.existsSync)(
|
|
92
|
-
if ((0, __stryke_fs_exists.existsSync)(
|
|
714
|
+
this.env.types.env = await require_create_reflection_resource.readEnvTypeReflection(this, "env");
|
|
715
|
+
if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvReflectionsPath(this, "env"))) this.env.used.env = await require_create_reflection_resource.readEnvReflection(this);
|
|
716
|
+
if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await require_create_reflection_resource.readEnvTypeReflection(this, "secrets");
|
|
717
|
+
if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await require_create_reflection_resource.readSecretsReflection(this);
|
|
93
718
|
} else {
|
|
94
|
-
this.env.types.env = await
|
|
719
|
+
this.env.types.env = await require_create_reflection_resource.reflectEnv(this, this.config.env.types?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
|
|
95
720
|
if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
|
|
96
|
-
await
|
|
97
|
-
this.env.types.secrets = await
|
|
721
|
+
await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.env, "env");
|
|
722
|
+
this.env.types.secrets = await require_create_reflection_resource.reflectSecrets(this, this.config.env.secrets?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
|
|
98
723
|
if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
|
|
99
|
-
await
|
|
724
|
+
await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
100
725
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
|
|
101
726
|
const envWithAlias = this.env.types.env.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
102
|
-
Object.entries(await
|
|
727
|
+
Object.entries(await require_create_reflection_resource.loadEnv(this, this.config.env)).forEach(([key, value]) => {
|
|
103
728
|
const unprefixedKey = this.config.env.prefix.reduce((ret, prefix) => {
|
|
104
729
|
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
105
730
|
return ret;
|
|
@@ -107,29 +732,29 @@ const plugin = (options = {}) => {
|
|
|
107
732
|
const aliasKey = envWithAlias.find((prop) => prop?.getAlias().reverse().includes(unprefixedKey));
|
|
108
733
|
if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
|
|
109
734
|
});
|
|
110
|
-
this.env.used.env = new
|
|
111
|
-
kind:
|
|
735
|
+
this.env.used.env = new __powerlines_deepkit_vendor_type.ReflectionClass({
|
|
736
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
112
737
|
typeName: "Env",
|
|
113
738
|
description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
114
739
|
types: []
|
|
115
740
|
}, this.env.types.env);
|
|
116
|
-
await
|
|
741
|
+
await require_create_reflection_resource.writeEnvReflection(this, this.env.used.env, "env");
|
|
117
742
|
if (this.env.types.secrets) {
|
|
118
|
-
await
|
|
119
|
-
this.env.used.secrets = new
|
|
120
|
-
kind:
|
|
743
|
+
await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
744
|
+
this.env.used.secrets = new __powerlines_deepkit_vendor_type.ReflectionClass({
|
|
745
|
+
kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
121
746
|
typeName: "Secrets",
|
|
122
747
|
description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
123
748
|
types: []
|
|
124
749
|
}, this.env.types.secrets);
|
|
125
|
-
await
|
|
750
|
+
await require_create_reflection_resource.writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
126
751
|
}
|
|
127
752
|
}
|
|
128
753
|
},
|
|
129
754
|
async prepare() {
|
|
130
755
|
const _self$ = this;
|
|
131
756
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Preparing the Environment runtime artifacts for the Powerlines project.`);
|
|
132
|
-
return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
757
|
+
return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_env.EnvBuiltin, { get defaultConfig() {
|
|
133
758
|
return _self$.config.env.defaultConfig;
|
|
134
759
|
} }));
|
|
135
760
|
},
|
|
@@ -137,7 +762,7 @@ const plugin = (options = {}) => {
|
|
|
137
762
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Writing Environment documentation for the Powerlines project artifacts.");
|
|
138
763
|
const outputPath = (0, __stryke_path_join.joinPaths)(this.config.projectRoot, "docs", "generated");
|
|
139
764
|
if (!(0, __stryke_fs_exists.existsSync)(outputPath)) await (0, __stryke_fs_helpers.createDirectory)(outputPath);
|
|
140
|
-
const reflection = await
|
|
765
|
+
const reflection = await require_create_reflection_resource.readEnvTypeReflection(this, "env");
|
|
141
766
|
const envDocFile = (0, __stryke_path_join.joinPaths)(outputPath, "env.md");
|
|
142
767
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Documenting environment variables configuration in "${envDocFile}"`);
|
|
143
768
|
await this.fs.write(envDocFile, `<!-- Generated by ${(0, __stryke_string_format_title_case.titleCase)(this.config.framework) || "Powerlines"} -->
|
|
@@ -147,20 +772,20 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
|
|
|
147
772
|
| Name | Description | Type | Default Value | Required |
|
|
148
773
|
| ---- | ----------- | ---- | ------------- | :------: |
|
|
149
774
|
${reflection.getProperties().filter((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
|
|
150
|
-
return `| ${reflectionProperty.getNameAsString().trim()} | ${(reflectionProperty.getDescription()?.replaceAll("\r", "")?.replaceAll("\n", "") ?? "").trim()} | ${(0,
|
|
775
|
+
return `| ${reflectionProperty.getNameAsString().trim()} | ${(reflectionProperty.getDescription()?.replaceAll("\r", "")?.replaceAll("\n", "") ?? "").trim()} | ${(0, __powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or ")} | ${reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : ""} | ${reflectionProperty.isValueRequired() ? "" : "✔"} |`;
|
|
151
776
|
}).join("\n")}
|
|
152
777
|
`);
|
|
153
778
|
},
|
|
154
779
|
async buildEnd() {
|
|
155
|
-
const reflectionPath =
|
|
780
|
+
const reflectionPath = require_create_reflection_resource.getEnvReflectionsPath(this, "env");
|
|
156
781
|
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Writing env reflection types to ${reflectionPath}.`);
|
|
157
|
-
await
|
|
782
|
+
await require_create_reflection_resource.writeEnvReflection(this, this.env.used.env, "env");
|
|
158
783
|
}
|
|
159
784
|
},
|
|
160
785
|
{
|
|
161
786
|
name: "env:automd-generator",
|
|
162
787
|
config() {
|
|
163
|
-
return { automd: (0, defu.default)(options.automd ?? {}, { generators: { "env":
|
|
788
|
+
return { automd: (0, defu.default)(options.automd ?? {}, { generators: { "env": env(this) } }) };
|
|
164
789
|
}
|
|
165
790
|
},
|
|
166
791
|
{
|
|
@@ -169,40 +794,40 @@ ${reflection.getProperties().filter((property) => property.getNameAsString() !==
|
|
|
169
794
|
return { envPrefix: this.config?.env?.prefix };
|
|
170
795
|
} }
|
|
171
796
|
},
|
|
172
|
-
|
|
797
|
+
src_default$2(options.automd)
|
|
173
798
|
];
|
|
174
799
|
};
|
|
175
800
|
var src_default = plugin;
|
|
176
801
|
|
|
177
802
|
//#endregion
|
|
178
|
-
exports.BaseEnv =
|
|
179
|
-
exports.BaseSecrets =
|
|
180
|
-
exports.EnvBuiltin =
|
|
181
|
-
exports.EnvDocs =
|
|
182
|
-
exports.EnvTypeDefinition =
|
|
183
|
-
exports.createEnvReflection =
|
|
803
|
+
exports.BaseEnv = require_create_reflection_resource.BaseEnv;
|
|
804
|
+
exports.BaseSecrets = require_create_reflection_resource.BaseSecrets;
|
|
805
|
+
exports.EnvBuiltin = require_env.EnvBuiltin;
|
|
806
|
+
exports.EnvDocs = require_docs.EnvDocs;
|
|
807
|
+
exports.EnvTypeDefinition = require_env.EnvTypeDefinition;
|
|
808
|
+
exports.createEnvReflection = require_create_reflection_resource.createEnvReflection;
|
|
184
809
|
exports.createReflectionResource = require_create_reflection_resource.createReflectionResource;
|
|
185
|
-
exports.createSecretsReflection =
|
|
186
|
-
exports.createTemplateReflection =
|
|
810
|
+
exports.createSecretsReflection = require_create_reflection_resource.createSecretsReflection;
|
|
811
|
+
exports.createTemplateReflection = createTemplateReflection;
|
|
187
812
|
exports.default = src_default;
|
|
188
|
-
exports.envBabelPlugin =
|
|
189
|
-
exports.formatEnvField =
|
|
190
|
-
exports.getEnvDefaultTypeDefinition =
|
|
191
|
-
exports.getEnvReflectionsPath =
|
|
192
|
-
exports.getEnvTypeReflectionsPath =
|
|
193
|
-
exports.getSecretsDefaultTypeDefinition =
|
|
194
|
-
exports.loadEnv =
|
|
195
|
-
exports.loadEnvFromContext =
|
|
196
|
-
exports.mergeEnvReflections =
|
|
197
|
-
exports.mergeSecretsReflections =
|
|
813
|
+
exports.envBabelPlugin = envBabelPlugin;
|
|
814
|
+
exports.formatEnvField = require_create_reflection_resource.formatEnvField;
|
|
815
|
+
exports.getEnvDefaultTypeDefinition = require_create_reflection_resource.getEnvDefaultTypeDefinition;
|
|
816
|
+
exports.getEnvReflectionsPath = require_create_reflection_resource.getEnvReflectionsPath;
|
|
817
|
+
exports.getEnvTypeReflectionsPath = require_create_reflection_resource.getEnvTypeReflectionsPath;
|
|
818
|
+
exports.getSecretsDefaultTypeDefinition = require_create_reflection_resource.getSecretsDefaultTypeDefinition;
|
|
819
|
+
exports.loadEnv = require_create_reflection_resource.loadEnv;
|
|
820
|
+
exports.loadEnvFromContext = require_create_reflection_resource.loadEnvFromContext;
|
|
821
|
+
exports.mergeEnvReflections = require_create_reflection_resource.mergeEnvReflections;
|
|
822
|
+
exports.mergeSecretsReflections = require_create_reflection_resource.mergeSecretsReflections;
|
|
198
823
|
exports.plugin = plugin;
|
|
199
|
-
exports.readEnvReflection =
|
|
200
|
-
exports.readEnvTypeReflection =
|
|
201
|
-
exports.readSecretsReflection =
|
|
202
|
-
exports.reflectEnv =
|
|
203
|
-
exports.reflectSecrets =
|
|
204
|
-
exports.removeEnvPrefix =
|
|
205
|
-
exports.resolveRuntimeTypeFile =
|
|
206
|
-
exports.writeEnvReflection =
|
|
207
|
-
exports.writeEnvReflectionSync =
|
|
208
|
-
exports.writeEnvTypeReflection =
|
|
824
|
+
exports.readEnvReflection = require_create_reflection_resource.readEnvReflection;
|
|
825
|
+
exports.readEnvTypeReflection = require_create_reflection_resource.readEnvTypeReflection;
|
|
826
|
+
exports.readSecretsReflection = require_create_reflection_resource.readSecretsReflection;
|
|
827
|
+
exports.reflectEnv = require_create_reflection_resource.reflectEnv;
|
|
828
|
+
exports.reflectSecrets = require_create_reflection_resource.reflectSecrets;
|
|
829
|
+
exports.removeEnvPrefix = require_create_reflection_resource.removeEnvPrefix;
|
|
830
|
+
exports.resolveRuntimeTypeFile = require_create_reflection_resource.resolveRuntimeTypeFile;
|
|
831
|
+
exports.writeEnvReflection = require_create_reflection_resource.writeEnvReflection;
|
|
832
|
+
exports.writeEnvReflectionSync = require_create_reflection_resource.writeEnvReflectionSync;
|
|
833
|
+
exports.writeEnvTypeReflection = require_create_reflection_resource.writeEnvTypeReflection;
|