@powerlines/plugin-env 0.16.302 → 0.16.303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +0 -14
- package/dist/babel/plugin.cjs +3 -11
- package/dist/babel/plugin.mjs +3 -5
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +3 -14
- package/dist/components/docs.mjs +3 -8
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +3 -15
- package/dist/components/env-builtin.mjs +3 -9
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/automd-generator.cjs +1 -9
- package/dist/helpers/automd-generator.mjs +2 -4
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/load.cjs +3 -13
- package/dist/helpers/load.d.cts +2 -2
- package/dist/helpers/load.d.mts +2 -2
- package/dist/helpers/load.mjs +2 -7
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/schema.cjs +2 -18
- package/dist/helpers/schema.mjs +3 -13
- package/dist/helpers/schema.mjs.map +1 -1
- package/dist/helpers/source-file-env.cjs +1 -12
- package/dist/helpers/source-file-env.mjs +1 -6
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +8 -8
- package/dist/types/plugin.d.mts +1 -1
- package/package.json +12 -137
- package/dist/_virtual/_rolldown/runtime.mjs +0 -18
- package/dist/babel/plugin.test.cjs +0 -16
- package/dist/babel/plugin.test.d.cts +0 -1
- package/dist/babel/plugin.test.d.mts +0 -1
- package/dist/babel/plugin.test.mjs +0 -18
- package/dist/babel/plugin.test.mjs.map +0 -1
- package/dist/components/docs.test.cjs +0 -16
- package/dist/components/docs.test.d.cts +0 -1
- package/dist/components/docs.test.d.mts +0 -1
- package/dist/components/docs.test.mjs +0 -18
- package/dist/components/docs.test.mjs.map +0 -1
- package/dist/components/env-builtin.test.cjs +0 -16
- package/dist/components/env-builtin.test.d.cts +0 -1
- package/dist/components/env-builtin.test.d.mts +0 -1
- package/dist/components/env-builtin.test.mjs +0 -18
- package/dist/components/env-builtin.test.mjs.map +0 -1
- package/dist/helpers/automd-generator.test.cjs +0 -16
- package/dist/helpers/automd-generator.test.d.cts +0 -1
- package/dist/helpers/automd-generator.test.d.mts +0 -1
- package/dist/helpers/automd-generator.test.mjs +0 -18
- package/dist/helpers/automd-generator.test.mjs.map +0 -1
- package/dist/helpers/load.test.cjs +0 -16
- package/dist/helpers/load.test.d.cts +0 -1
- package/dist/helpers/load.test.d.mts +0 -1
- package/dist/helpers/load.test.mjs +0 -18
- package/dist/helpers/load.test.mjs.map +0 -1
- package/dist/helpers/schema.test.cjs +0 -16
- package/dist/helpers/schema.test.d.cts +0 -1
- package/dist/helpers/schema.test.d.mts +0 -1
- package/dist/helpers/schema.test.mjs +0 -18
- package/dist/helpers/schema.test.mjs.map +0 -1
- package/dist/helpers/source-file-env.test.cjs +0 -16
- package/dist/helpers/source-file-env.test.d.cts +0 -1
- package/dist/helpers/source-file-env.test.d.mts +0 -1
- package/dist/helpers/source-file-env.test.mjs +0 -18
- package/dist/helpers/source-file-env.test.mjs.map +0 -1
- package/dist/index.test.cjs +0 -30
- package/dist/index.test.d.cts +0 -1
- package/dist/index.test.d.mts +0 -1
- package/dist/index.test.mjs +0 -32
- package/dist/index.test.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -78
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.cjs +0 -1487
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs +0 -1473
- package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.cjs +0 -889
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs +0 -888
- package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.cjs +0 -1614
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs +0 -1594
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.mjs +0 -3
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.mjs +0 -3
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.cjs +0 -923
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs +0 -922
- package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.cjs +0 -391
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs +0 -386
- package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -82
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -82
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.cjs +0 -1358
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs +0 -1357
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.cjs +0 -561
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs +0 -559
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.cjs +0 -37
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs +0 -38
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.cjs +0 -197
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs +0 -181
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.cjs +0 -29
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs +0 -27
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.cjs +0 -77
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs +0 -77
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.cjs +0 -374
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs +0 -374
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.cjs +0 -38
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs +0 -37
- package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -2978
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -2973
- package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -940
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.cjs +0 -87
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs +0 -87
- package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -6
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -6
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.cjs +0 -54
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +0 -52
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.cjs +0 -2696
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +0 -2697
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.cjs +0 -47
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +0 -45
- package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +0 -1
|
@@ -5,19 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __exportAll = (all, no_symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
__defProp(target, name, {
|
|
12
|
-
get: all[name],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (!no_symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
8
|
var __copyProps = (to, from, except, desc) => {
|
|
22
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
10
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -39,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
26
|
|
|
40
27
|
//#endregion
|
|
41
28
|
|
|
42
|
-
exports.__exportAll = __exportAll;
|
|
43
29
|
exports.__toESM = __toESM;
|
package/dist/babel/plugin.cjs
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
|
-
let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
|
|
5
|
-
let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
|
|
6
3
|
let _powerlines_schema = require("@powerlines/schema");
|
|
7
4
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
5
|
+
let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
|
|
6
|
+
let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
|
|
8
7
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
9
8
|
|
|
10
9
|
//#region src/babel/plugin.ts
|
|
11
|
-
var plugin_exports = /* @__PURE__ */ require_runtime.__exportAll({ envBabelPlugin: () => envBabelPlugin });
|
|
12
10
|
function __assignType(fn, args) {
|
|
13
11
|
fn.__type = args;
|
|
14
12
|
return fn;
|
|
@@ -87,10 +85,4 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
|
|
|
87
85
|
])));
|
|
88
86
|
|
|
89
87
|
//#endregion
|
|
90
|
-
exports.envBabelPlugin = envBabelPlugin;
|
|
91
|
-
Object.defineProperty(exports, 'plugin_exports', {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return plugin_exports;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
88
|
+
exports.envBabelPlugin = envBabelPlugin;
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
3
|
-
import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
|
|
4
|
-
import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
|
|
5
2
|
import { getProperties, stringifyValue } from "@powerlines/schema";
|
|
6
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
|
+
import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
|
|
5
|
+
import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
|
|
7
6
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
8
7
|
|
|
9
8
|
//#region src/babel/plugin.ts
|
|
10
|
-
var plugin_exports = /* @__PURE__ */ __exportAll({ envBabelPlugin: () => envBabelPlugin });
|
|
11
9
|
function __assignType(fn, args) {
|
|
12
10
|
fn.__type = args;
|
|
13
11
|
return fn;
|
|
@@ -86,5 +84,5 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
|
|
|
86
84
|
])));
|
|
87
85
|
|
|
88
86
|
//#endregion
|
|
89
|
-
export { envBabelPlugin
|
|
87
|
+
export { envBabelPlugin };
|
|
90
88
|
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"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 { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport {\n getProperties,\n JsonSchemaProperty,\n stringifyValue\n} from \"@powerlines/schema\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ logger, context }) => {\n const config = getProperties(context.env.config);\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n logger.trace({\n meta: {\n category: \"env\"\n },\n message: `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n });\n\n if (\n name in config &&\n isSetObject(config[name]) &&\n !config[name]?.isIgnored\n ) {\n config[name] ??= {} as JsonSchemaProperty<Record<string, any>>;\n\n logger.debug({\n meta: {\n category: \"env\"\n },\n message: `The \"${name}\" environment variable is used in the source code file \"${\n pass.filename || \"unknown file\"\n }\" and will be added to the environment schema's active variables list.`\n });\n\n context.env.config.active.push(name);\n if (\n !config[name].runtime &&\n ((context.config.env.inject && isInjectable) ||\n context.config.env.validate)\n ) {\n if (\n context.config.env.validate &&\n !config[name].required &&\n isUndefined(config[name].default)\n ) {\n throw new Error(\n `Environment variable \\`${\n name\n }\\` is missing a default value, but is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }.\\n\\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`\n );\n }\n\n return stringifyValue(config[name].default);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. Please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n );\n } else {\n logger.warn({\n meta: {\n category: \"env\"\n },\n message: `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n });\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n }\n }\n }\n };\n }\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"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 { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport {\n getProperties,\n JsonSchemaProperty,\n stringifyValue\n} from \"@powerlines/schema\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ logger, context }) => {\n const config = getProperties(context.env.config);\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n logger.trace({\n meta: {\n category: \"env\"\n },\n message: `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n });\n\n if (\n name in config &&\n isSetObject(config[name]) &&\n !config[name]?.isIgnored\n ) {\n config[name] ??= {} as JsonSchemaProperty<Record<string, any>>;\n\n logger.debug({\n meta: {\n category: \"env\"\n },\n message: `The \"${name}\" environment variable is used in the source code file \"${\n pass.filename || \"unknown file\"\n }\" and will be added to the environment schema's active variables list.`\n });\n\n context.env.config.active.push(name);\n if (\n !config[name].runtime &&\n ((context.config.env.inject && isInjectable) ||\n context.config.env.validate)\n ) {\n if (\n context.config.env.validate &&\n !config[name].required &&\n isUndefined(config[name].default)\n ) {\n throw new Error(\n `Environment variable \\`${\n name\n }\\` is missing a default value, but is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }.\\n\\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`\n );\n }\n\n return stringifyValue(config[name].default);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. Please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n );\n } else {\n logger.warn({\n meta: {\n category: \"env\"\n },\n message: `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n });\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;4HAaA,QACA,cACM;CACN,MAAQ,SAAC,cAAmB,QAAW,IAAA,MAAO;CAC9C,SAAS,WAAA,MAAkB,MAAO,eAAW,OAAO;EACpD,IAAO,KAAA,MAAA;GACL,MAAA,OAAa,KAAA,KAAA,QAAA,IAAA,OAAA,KAAA,QAAA,OAAA,IAAA,OAAA,KAAA,GAAA,EAAA,GAAA,GAAA,EAAA;GACb,OAAA,MAAA;IACA,MAAA,EACO,UAAW,MACZ;IACA,SAAC,wBAAgC,KAAC,YAAU,KAAU,YAAA,eAAA;GACxD,CAAC;;IAEN,OAAA,UAAA,CAAA;IACM,OAAA,MAAa;KACnB,MAAA,EACS,UAAY,MAClB;KACF,SAAA,QAAA,KAAA,0DAAA,KAAA,YAAA,eAAA;IACK,CAAA;IACA,QAAA,IAAA,OAAA,OAAA,KAAA,IAAA;IACF,IAAO,CAAC,OAAO,MAAM,YAAC,QAAA,OAAA,IAAA,UAAA,gBAAA,QAAA,OAAA,IAAA,WAAA;KACjB,IAAA,QAAS,OAAA,IAAc,YAAY,CAAA,OAAO,MAAA,YAAA,YAAA,OAAA,MAAA,OAAA,GACxC,MAAC,IAAA,MAAU,0BAAA,KAAA,iEAAA,KAAA,WAAA,WAAA,KAAA,SAAA,MAAA,GAAA,mIAAA;KAEb,OAAE,eAAe,OAAA,MAAA,OAAA;IACrB;GACA,OAAA,IAAA,QAAA,OAAA,IAAA,UACE,MAAM,IAAC,MAAM,0BAAA,KAAA,iCAAA,KAAA,WAAA,WAAA,KAAA,SAAA,MAAA,GAAA,0OAAA;QAEb,OAAM,KAAM;IACV,MAAC,EACF,UAAA;IAED,SAAO,0BAAM,KAAA,iCAAA,KAA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;CAAA,CAAA,EACP,EACF;AACF,GAAG;CAAC;CAAQ;CAAM;AAAA,CAAA,CAAA"}
|
package/dist/components/docs.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
|
-
let
|
|
3
|
+
let _powerlines_schema = require("@powerlines/schema");
|
|
5
4
|
let _stryke_path_join = require("@stryke/path/join");
|
|
6
5
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
7
|
-
let
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
7
|
let _alloy_js_core = require("@alloy-js/core");
|
|
9
8
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
9
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
@@ -13,10 +12,6 @@ let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@power
|
|
|
13
12
|
let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
|
|
14
13
|
|
|
15
14
|
//#region src/components/docs.tsx
|
|
16
|
-
var docs_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
17
|
-
EnvDocsFile: () => EnvDocsFile,
|
|
18
|
-
__ΩEnvDocsFileProps: () => __ΩEnvDocsFileProps
|
|
19
|
-
});
|
|
20
15
|
const __ΩPartial = [
|
|
21
16
|
"T",
|
|
22
17
|
"Partial",
|
|
@@ -98,10 +93,4 @@ EnvDocsFile.__type = [
|
|
|
98
93
|
|
|
99
94
|
//#endregion
|
|
100
95
|
exports.EnvDocsFile = EnvDocsFile;
|
|
101
|
-
exports.__ΩEnvDocsFileProps = __ΩEnvDocsFileProps;
|
|
102
|
-
Object.defineProperty(exports, 'docs_exports', {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return docs_exports;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
96
|
+
exports.__ΩEnvDocsFileProps = __ΩEnvDocsFileProps;
|
package/dist/components/docs.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { getPropertiesList, stringifyType } from "@powerlines/schema";
|
|
4
3
|
import { joinPaths } from "@stryke/path/join";
|
|
5
4
|
import { getDocsOutputPath } from "powerlines/plugin-utils";
|
|
6
|
-
import {
|
|
5
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
7
6
|
import { code } from "@alloy-js/core";
|
|
8
7
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
9
8
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
@@ -12,10 +11,6 @@ import { MarkdownFile } from "@powerlines/plugin-alloy/markdown/components/markd
|
|
|
12
11
|
import { MarkdownTable } from "@powerlines/plugin-alloy/markdown/components/markdown-table";
|
|
13
12
|
|
|
14
13
|
//#region src/components/docs.tsx
|
|
15
|
-
var docs_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
-
EnvDocsFile: () => EnvDocsFile,
|
|
17
|
-
__ΩEnvDocsFileProps: () => __ΩEnvDocsFileProps
|
|
18
|
-
});
|
|
19
14
|
const __ΩPartial = [
|
|
20
15
|
"T",
|
|
21
16
|
"Partial",
|
|
@@ -96,5 +91,5 @@ EnvDocsFile.__type = [
|
|
|
96
91
|
];
|
|
97
92
|
|
|
98
93
|
//#endregion
|
|
99
|
-
export { EnvDocsFile, __ΩEnvDocsFileProps
|
|
94
|
+
export { EnvDocsFile, __ΩEnvDocsFileProps };
|
|
100
95
|
//# sourceMappingURL=docs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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 } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\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 { getPropertiesList, stringifyType } from \"@powerlines/schema\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\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\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment</Heading>\n {code`The ${\n context.config.name\n } package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \\`config.json\\` file in the application configuration directory.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Configuration</Heading>\n <Spacing />\n {code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.config)\n .filter(\n property =>\n getPropertiesList(context.env.config).some(\n p =>\n p.name === property.name &&\n context.env.config.active.includes(property.name)\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.required ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":"
|
|
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 } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\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 { getPropertiesList, stringifyType } from \"@powerlines/schema\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\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\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment</Heading>\n {code`The ${\n context.config.name\n } package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \\`config.json\\` file in the application configuration directory.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Configuration</Heading>\n <Spacing />\n {code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.config)\n .filter(\n property =>\n getPropertiesList(context.env.config).some(\n p =>\n p.name === property.name &&\n context.env.config.active.includes(property.name)\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.required ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA2BA,MAAK,sBAAkB;OAAU;CAAa;CAAU;CAAA;CAAa;CAAA;AAAA;;;;AAKrE,SAAM,YAAa,OAAA;CACjB,MAAE,EACF,cAAc,GAChB,GAAA;CAEE,MAAA,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,IAAA,CAAA,GAAA,cAAA;CACA,OAAC,gBAAc,cAAY,WAAuB,EAClD,IAAA,OAAA;EACI,OAAC,UAAS,kBAAmB,QAAA,OAAkB,IAAA,GAAA,QAAA;CACnD,aAEA,IAAM,WAAU;;;IAEV,OAAC,IAAA;IACJ,UAAA;GACC,CAAA;GAAI,WAAY,IAAA,OAAA,QAAkB,OAAQ,KAAM,+QAAiB;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,SAAA;IAC/D,OAAO,IAAA;IACR,UAAQ;GACT,CAAC;GAAA,gBAAU,SAAA,CAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,eAAA,EACT,IAAA,OAAQ;IACR,OAAQ,kBAAa,QAAc,IAAA,MAAU,EAAC,OAAG,cAAY,aAAgB,kBAAmB,QAAA,IAAW,MAAO,EAAA,KAAQ,cAAI,MAAY,EAAA,SAAU,SAAS,QAAW,QAAQ,IAAI,OAAK,OAAO,SAAW,SAAI,IAAO,GAAK;KAAC;KAAK;KAAI;IAAI,CAAA,CAAA,KAAY,CAAA,UAAA,UAAc,CAAA,UAAW,UAAA,CAAA,UAAA,YAAA,CAAA,UAAA,UAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,KAAA,cAAA,GAAA,MAAA,CAAA,GAAA,QAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,KAAA,EAAA,KAAA,cAAA,EAAA,IAAA,GAAA;KAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,IAAA,cAAA,aAAA;KAC/Q,OAAS;MACF,MAAM,SAAM,MAAA,KAAa;MACzB,cAAE,SAAA,eAAA,IAAA,KAAA;MACJ,MAAI,cAAc,QAAA,EAAc,KAAA,EAAA,WAAiB,mBAAiB,OAAU;MAC1E,cAAE,SAAA,UAAA,cAAA,SAAA,OAAA,IAAA;MACT,UAAA,SAAA,WAAA,KAAA;KACK;IACF,GAAA;KAAA;KAAA;KAAkB;IAAW,CAAC,CAAA,KAAM,CAAA;GACtC,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAQ;OAAQ;CAAkB;CAAS;CAAa;CAAA;AAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_helpers_load = require('../helpers/load.cjs');
|
|
4
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
6
3
|
let _powerlines_schema = require("@powerlines/schema");
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
8
6
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
7
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
@@ -11,13 +9,9 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
|
11
9
|
let _powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
|
|
12
10
|
let _powerlines_plugin_alloy_typescript_components = require("@powerlines/plugin-alloy/typescript/components");
|
|
13
11
|
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
14
13
|
|
|
15
14
|
//#region src/components/env-builtin.tsx
|
|
16
|
-
var env_builtin_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
17
|
-
EnvBuiltin: () => EnvBuiltin,
|
|
18
|
-
EnvTypeDefinition: () => EnvTypeDefinition,
|
|
19
|
-
__ΩEnvBuiltinProps: () => __ΩEnvBuiltinProps
|
|
20
|
-
});
|
|
21
15
|
const __ΩOmit = [
|
|
22
16
|
"T",
|
|
23
17
|
"K",
|
|
@@ -629,10 +623,4 @@ EnvBuiltin.__type = [
|
|
|
629
623
|
//#endregion
|
|
630
624
|
exports.EnvBuiltin = EnvBuiltin;
|
|
631
625
|
exports.EnvTypeDefinition = EnvTypeDefinition;
|
|
632
|
-
exports.__ΩEnvBuiltinProps = __ΩEnvBuiltinProps;
|
|
633
|
-
Object.defineProperty(exports, 'env_builtin_exports', {
|
|
634
|
-
enumerable: true,
|
|
635
|
-
get: function () {
|
|
636
|
-
return env_builtin_exports;
|
|
637
|
-
}
|
|
638
|
-
});
|
|
626
|
+
exports.__ΩEnvBuiltinProps = __ΩEnvBuiltinProps;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { loadEnvFromContext } from "../helpers/load.mjs";
|
|
3
|
-
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { getUnique } from "@stryke/helpers/get-unique";
|
|
5
2
|
import { generateParserCode, getPropertiesList } from "@powerlines/schema";
|
|
3
|
+
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
6
4
|
import { For, Show, code, computed, splitProps } from "@alloy-js/core";
|
|
7
5
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
6
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
@@ -10,13 +8,9 @@ import { ElseIfClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, V
|
|
|
10
8
|
import { refkey } from "@powerlines/plugin-alloy/helpers/refkey";
|
|
11
9
|
import { BuiltinFile, InterfaceDeclaration as InterfaceDeclaration$1, InterfaceMember, ObjectDeclaration, TSDocSchemaProperty } from "@powerlines/plugin-alloy/typescript/components";
|
|
12
10
|
import { TSDoc, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
11
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
13
12
|
|
|
14
13
|
//#region src/components/env-builtin.tsx
|
|
15
|
-
var env_builtin_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
-
EnvBuiltin: () => EnvBuiltin,
|
|
17
|
-
EnvTypeDefinition: () => EnvTypeDefinition,
|
|
18
|
-
__ΩEnvBuiltinProps: () => __ΩEnvBuiltinProps
|
|
19
|
-
});
|
|
20
14
|
const __ΩOmit = [
|
|
21
15
|
"T",
|
|
22
16
|
"K",
|
|
@@ -626,5 +620,5 @@ EnvBuiltin.__type = [
|
|
|
626
620
|
];
|
|
627
621
|
|
|
628
622
|
//#endregion
|
|
629
|
-
export { EnvBuiltin, EnvTypeDefinition, __ΩEnvBuiltinProps
|
|
623
|
+
export { EnvBuiltin, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
630
624
|
//# sourceMappingURL=env-builtin.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.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 {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport type { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps,\n InterfaceDeclaration,\n InterfaceMember,\n ObjectDeclaration,\n TSDocSchemaProperty\n} from \"@powerlines/plugin-alloy/typescript/components\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n generateParserCode,\n getPropertiesList,\n GetPropertiesResult,\n JsonSchema\n} from \"@powerlines/schema\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport type { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.config.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` 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.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n getPropertiesList(context.env.config.schema).filter(\n property => !property.ignore\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty\n schema={property}\n defaultValue={property?.default}\n />\n <InterfaceMember\n name={`${prefix}_${property.name}`}\n type={`UnprefixedEnv[\"${property.name}\"]`}\n schema={property}\n required={property.required}\n readOnly={property.readOnly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JsonSchema;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const schemaGetProperties = computed(\n () =>\n (getPropertiesList(context.env.config)\n .filter(property => !property?.ignore && !property?.writeOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []) as GetPropertiesResult[]\n );\n const schemaSetProperties = computed(\n () =>\n (getPropertiesList(context.env.config)\n .filter(property => !property?.ignore && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []) as GetPropertiesResult[]\n );\n\n const parserCode = generateParserCode(context.env.config.schema);\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.config.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.config.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n {parserCode}\n <Spacing />\n <Show when={Boolean(context?.entryPath)}>\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n parse({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={schemaGetProperties.value}>\n {(property: GetPropertiesResult, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={schemaSetProperties.value} ender={code` else `}>\n {(property: GetPropertiesResult, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {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:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAAA,IAAA,CAAA,CAAA,oBAAA,MAAA,CAAA,GAAA,cAAA;CAChB,OAAA;EAAA,gBAAoB,wBAAA;GACpB,MAAA;GACA,IAAA,SAAA;IACA,OAAA,QAAA,IAAA,OAAA;GACA;GACF,UAAO;EACL,CAAA;EAAA,gBAAK,SAAA,CAAA,CAAA;EAAA,gBAAA,OAAA;GACL,SAAU;GACV,IAAA,WAAY;IACZ,OAAA,gBAAA,cAAA,EACM,UAAC,sPACH,CAAC;GACL;EACA,CAAA;EAAA,gBAAiB,sBAAA;GACjB,MAAA;GACA,UAAA;GACA,WAAO;GACT,IAAQ,WAAW;IACb,OAAG,gBAAqB,KAAM;KAC7B,IAAK,OAAE;;;;;;KAEZ;KACC,gBAAc;KACf,IAAA,WAAA;MACK,OAAS,cAAA,WAAoB,gBAAA,KAAA;OAC5B,IAAQ,OAAE;;;;;;OAET;OACJ,gBAAA;OACE,IAAA,WAAA;QACO,OAAA,cAAa,aAAA,CAAA,gBAAA,qBAAA;SACX,QAAQ;SAChB,IAAA,eAAA;UACD,OAAA,UAAA;SACS;QACH,CAAA,GAAA,gBAAa,iBAA0B;SAC3C,IAAA,OAAY;UACH,OAAM,GAAI,OAAC,GAAQ,SAAM;SACjC;SACG,IAAA,OAAA;UACN,OAAA,kBAAoC,SAAO,KAAO;SAChD;SACO,QAAA;SACJ,IAAO,WAAY;UACp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"],"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 {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport type { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps,\n InterfaceDeclaration,\n InterfaceMember,\n ObjectDeclaration,\n TSDocSchemaProperty\n} from \"@powerlines/plugin-alloy/typescript/components\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport {\n generateParserCode,\n getPropertiesList,\n GetPropertiesResult,\n JsonSchema\n} from \"@powerlines/schema\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport type { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.config.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` 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.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n getPropertiesList(context.env.config.schema).filter(\n property => !property.ignore\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty\n schema={property}\n defaultValue={property?.default}\n />\n <InterfaceMember\n name={`${prefix}_${property.name}`}\n type={`UnprefixedEnv[\"${property.name}\"]`}\n schema={property}\n required={property.required}\n readOnly={property.readOnly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JsonSchema;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const schemaGetProperties = computed(\n () =>\n (getPropertiesList(context.env.config)\n .filter(property => !property?.ignore && !property?.writeOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []) as GetPropertiesResult[]\n );\n const schemaSetProperties = computed(\n () =>\n (getPropertiesList(context.env.config)\n .filter(property => !property?.ignore && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []) as GetPropertiesResult[]\n );\n\n const parserCode = generateParserCode(context.env.config.schema);\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.config.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.config.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n {parserCode}\n <Spacing />\n <Show when={Boolean(context?.entryPath)}>\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n parse({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={schemaGetProperties.value}>\n {(property: GetPropertiesResult, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={schemaSetProperties.value} ender={code` else `}>\n {(property: GetPropertiesResult, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {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:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAAA,IAAA,CAAA,CAAA,oBAAA,MAAA,CAAA,GAAA,cAAA;CAChB,OAAA;EAAA,gBAAoB,wBAAA;GACpB,MAAA;GACA,IAAA,SAAA;IACA,OAAA,QAAA,IAAA,OAAA;GACA;GACF,UAAO;EACL,CAAA;EAAA,gBAAK,SAAA,CAAA,CAAA;EAAA,gBAAA,OAAA;GACL,SAAU;GACV,IAAA,WAAY;IACZ,OAAA,gBAAA,cAAA,EACM,UAAC,sPACH,CAAC;GACL;EACA,CAAA;EAAA,gBAAiB,sBAAA;GACjB,MAAA;GACA,UAAA;GACA,WAAO;GACT,IAAQ,WAAW;IACb,OAAG,gBAAqB,KAAM;KAC7B,IAAK,OAAE;;;;;;KAEZ;KACC,gBAAc;KACf,IAAA,WAAA;MACK,OAAS,cAAA,WAAoB,gBAAA,KAAA;OAC5B,IAAQ,OAAE;;;;;;OAET;OACJ,gBAAA;OACE,IAAA,WAAA;QACO,OAAA,cAAa,aAAA,CAAA,gBAAA,qBAAA;SACX,QAAQ;SAChB,IAAA,eAAA;UACD,OAAA,UAAA;SACS;QACH,CAAA,GAAA,gBAAa,iBAA0B;SAC3C,IAAA,OAAY;UACH,OAAM,GAAI,OAAC,GAAQ,SAAM;SACjC;SACG,IAAA,OAAA;UAC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}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
4
2
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
3
|
let automd = require("automd");
|
|
4
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
6
5
|
|
|
7
6
|
//#region src/helpers/automd-generator.ts
|
|
8
|
-
var automd_generator_exports = /* @__PURE__ */ require_runtime.__exportAll({ env: () => env });
|
|
9
7
|
function __assignType(fn, args) {
|
|
10
8
|
fn.__type = args;
|
|
11
9
|
return fn;
|
|
@@ -30,10 +28,4 @@ const env = __assignType((context) => (0, automd.defineGenerator)({
|
|
|
30
28
|
]);
|
|
31
29
|
|
|
32
30
|
//#endregion
|
|
33
|
-
Object.defineProperty(exports, 'automd_generator_exports', {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return automd_generator_exports;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
31
|
exports.env = env;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { getDocsOutputPath } from "powerlines/plugin-utils";
|
|
3
1
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
4
2
|
import { defineGenerator } from "automd";
|
|
3
|
+
import { getDocsOutputPath } from "powerlines/plugin-utils";
|
|
5
4
|
|
|
6
5
|
//#region src/helpers/automd-generator.ts
|
|
7
|
-
var automd_generator_exports = /* @__PURE__ */ __exportAll({ env: () => env });
|
|
8
6
|
function __assignType(fn, args) {
|
|
9
7
|
fn.__type = args;
|
|
10
8
|
return fn;
|
|
@@ -29,5 +27,5 @@ const env = __assignType((context) => defineGenerator({
|
|
|
29
27
|
]);
|
|
30
28
|
|
|
31
29
|
//#endregion
|
|
32
|
-
export {
|
|
30
|
+
export { env };
|
|
33
31
|
//# sourceMappingURL=automd-generator.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;CAE9B,OAAO;;;;;;;;AA4BT,MAAE,MAAgB,cAAA,YAAA,gBAAA;CAChB,MAAM;CACN,UAAQ,aAAW,eAAA,WAAA;EACjB,MAAE,aAAiB,UAAE,kBAAS,QAAA,OAAA,IAAA,GAAA,QAAA;EAC9B,IAAI,CAAA,QAAA,GAAA,WAAkB,UAAe,GACnC,OAAO,EACN,UAAA;EAIH,OAAM,EACJ,UAAG,MAFM,QAAA,GAAA,KAAA,UAAA,KAEN,GACL;;AAEJ,CAAC,GAAG;CAAC;CAAO;CAAQ;AAAS,CAAA"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_helpers_source_file_env = require('./source-file-env.cjs');
|
|
3
3
|
const require_helpers_load = require('./load.cjs');
|
|
4
|
-
const require_helpers_automd_generator = require('./automd-generator.cjs');
|
|
5
4
|
const require_helpers_schema = require('./schema.cjs');
|
|
5
|
+
const require_helpers_automd_generator = require('./automd-generator.cjs');
|
|
6
6
|
|
|
7
7
|
exports.env = require_helpers_automd_generator.env;
|
|
8
8
|
exports.extractEnv = require_helpers_schema.extractEnv;
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
|
|
2
2
|
import { loadEnv, loadEnvFromContext } from "./load.mjs";
|
|
3
|
-
import { env } from "./automd-generator.mjs";
|
|
4
3
|
import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv } from "./schema.mjs";
|
|
4
|
+
import { env } from "./automd-generator.mjs";
|
|
5
5
|
|
|
6
6
|
export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeTypeFile, writeEnv };
|
package/dist/helpers/load.cjs
CHANGED
|
@@ -2,8 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
4
|
const require_helpers_source_file_env = require('./source-file-env.cjs');
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
7
5
|
let _powerlines_schema = require("@powerlines/schema");
|
|
8
6
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
9
7
|
let _storm_software_config_tools_get_config = require("@storm-software/config-tools/get-config");
|
|
@@ -12,13 +10,11 @@ let _stryke_env_load_env = require("@stryke/env/load-env");
|
|
|
12
10
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
13
11
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
14
12
|
let c12 = require("c12");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
15
15
|
let powerlines_constants = require("powerlines/constants");
|
|
16
16
|
|
|
17
17
|
//#region src/helpers/load.ts
|
|
18
|
-
var load_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
19
|
-
loadEnv: () => loadEnv,
|
|
20
|
-
loadEnvFromContext: () => loadEnvFromContext
|
|
21
|
-
});
|
|
22
18
|
function __assignType(fn, args) {
|
|
23
19
|
fn.__type = args;
|
|
24
20
|
return fn;
|
|
@@ -144,10 +140,4 @@ loadEnv.__type = [
|
|
|
144
140
|
|
|
145
141
|
//#endregion
|
|
146
142
|
exports.loadEnv = loadEnv;
|
|
147
|
-
exports.loadEnvFromContext = loadEnvFromContext;
|
|
148
|
-
Object.defineProperty(exports, 'load_exports', {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
get: function () {
|
|
151
|
-
return load_exports;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
143
|
+
exports.loadEnvFromContext = loadEnvFromContext;
|
package/dist/helpers/load.d.cts
CHANGED
|
@@ -24,11 +24,11 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "development" | "test" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
34
|
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
|
package/dist/helpers/load.d.mts
CHANGED
|
@@ -24,11 +24,11 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "development" | "test" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
34
|
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
|
package/dist/helpers/load.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
|
|
3
2
|
import { removeEnvPrefix } from "./source-file-env.mjs";
|
|
4
|
-
import defu from "defu";
|
|
5
3
|
import { getProperties } from "@powerlines/schema";
|
|
6
4
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
7
5
|
import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
|
|
@@ -10,13 +8,10 @@ import { loadEnv as loadEnv$1, loadEnvFile } from "@stryke/env/load-env";
|
|
|
10
8
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
9
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
12
10
|
import { loadConfig } from "c12";
|
|
11
|
+
import defu from "defu";
|
|
13
12
|
import { DEFAULT_ENVIRONMENT } from "powerlines/constants";
|
|
14
13
|
|
|
15
14
|
//#region src/helpers/load.ts
|
|
16
|
-
var load_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
-
loadEnv: () => loadEnv,
|
|
18
|
-
loadEnvFromContext: () => loadEnvFromContext
|
|
19
|
-
});
|
|
20
15
|
function __assignType(fn, args) {
|
|
21
16
|
fn.__type = args;
|
|
22
17
|
return fn;
|
|
@@ -141,5 +136,5 @@ loadEnv.__type = [
|
|
|
141
136
|
];
|
|
142
137
|
|
|
143
138
|
//#endregion
|
|
144
|
-
export { loadEnv, loadEnvFromContext
|
|
139
|
+
export { loadEnv, loadEnvFromContext };
|
|
145
140
|
//# sourceMappingURL=load.mjs.map
|