@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/types/runtime.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
|
|
6
6
|
"repository": {
|
|
@@ -193,11 +193,11 @@
|
|
|
193
193
|
"@alloy-js/json": "^0.22.0",
|
|
194
194
|
"@babel/core": "^7.28.5",
|
|
195
195
|
"@babel/types": "^7.28.5",
|
|
196
|
-
"@powerlines/deepkit": "^0.5.
|
|
197
|
-
"@powerlines/plugin-alloy": "^0.18.
|
|
198
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
199
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
200
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
196
|
+
"@powerlines/deepkit": "^0.5.37",
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.18.2",
|
|
198
|
+
"@powerlines/plugin-automd": "^0.1.122",
|
|
199
|
+
"@powerlines/plugin-babel": "^0.12.131",
|
|
200
|
+
"@powerlines/plugin-plugin": "^0.12.74",
|
|
201
201
|
"@storm-software/config-tools": "^1.188.75",
|
|
202
202
|
"@stryke/capnp": "^0.12.52",
|
|
203
203
|
"@stryke/env": "^0.20.44",
|
|
@@ -211,5 +211,5 @@
|
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": { "@types/node": "^24.10.4", "vite": "8.0.0-beta.2" },
|
|
213
213
|
"publishConfig": { "access": "public" },
|
|
214
|
-
"gitHead": "
|
|
214
|
+
"gitHead": "a703a2dd9be6175a67a9bf4847d0217be4e920af"
|
|
215
215
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
23
|
-
if (symbols) {
|
|
24
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
26
|
-
}
|
|
27
|
-
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
32
|
-
}) : target, mod));
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
|
|
36
|
-
exports.__reExport = __reExport;
|
|
37
|
-
exports.__toESM = __toESM;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
-
key = keys[i];
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
11
|
-
__defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget, symbols) => {
|
|
21
|
-
if (symbols) {
|
|
22
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
23
|
-
secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
|
|
24
|
-
}
|
|
25
|
-
__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { __reExport };
|
package/dist/babel/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const require_plugin = require('./plugin.cjs');
|
package/dist/babel/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { envBabelPlugin } from "./plugin.mjs";
|
package/dist/babel/index.mjs
DELETED
package/dist/babel/plugin.cjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_type = require('../deepkit/src/vendor/type.cjs');
|
|
3
|
-
const require_create_plugin = require('../plugin-babel/src/helpers/create-plugin.cjs');
|
|
4
|
-
const require_module_helpers = require('../plugin-babel/src/helpers/module-helpers.cjs');
|
|
5
|
-
const require_capnp = require('../deepkit/src/capnp.cjs');
|
|
6
|
-
const require_reflection = require('../deepkit/schemas/reflection2.cjs');
|
|
7
|
-
const require_utilities = require('../deepkit/src/utilities.cjs');
|
|
8
|
-
const require_persistence = require('../helpers/persistence.cjs');
|
|
9
|
-
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
10
|
-
let __stryke_capnp = require("@stryke/capnp");
|
|
11
|
-
__stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
|
|
12
|
-
let __stryke_fs_buffer = require("@stryke/fs/buffer");
|
|
13
|
-
let node_fs = require("node:fs");
|
|
14
|
-
|
|
15
|
-
//#region src/babel/plugin.ts
|
|
16
|
-
const envBabelPlugin = require_create_plugin.createBabelPlugin("env", ({ log, context }) => {
|
|
17
|
-
function extractEnv(node, pass, isInjectable = false) {
|
|
18
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
19
|
-
if (node.name) {
|
|
20
|
-
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}_`, "")))));
|
|
21
|
-
let name = node.name;
|
|
22
|
-
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
23
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
24
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
|
|
25
|
-
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
|
|
26
|
-
if (!envProperty || envProperty.isIgnored()) return;
|
|
27
|
-
if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
|
|
28
|
-
if (context.config.env.inject && isInjectable) {
|
|
29
|
-
let value = context.env.parsed?.[name];
|
|
30
|
-
if (value === void 0) {
|
|
31
|
-
const prefix$1 = context.config.env.prefix.find((pre) => {
|
|
32
|
-
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
33
|
-
});
|
|
34
|
-
if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
|
|
35
|
-
}
|
|
36
|
-
value ??= envProperty.getDefaultValue();
|
|
37
|
-
if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
|
|
38
|
-
return require_utilities.stringifyDefaultValue(envProperty, value);
|
|
39
|
-
}
|
|
40
|
-
} 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"}.
|
|
41
|
-
|
|
42
|
-
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`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
visitor: { MemberExpression(path, pass) {
|
|
47
|
-
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
|
|
48
|
-
const identifier = path.get("property")?.node;
|
|
49
|
-
extractEnv(identifier, pass, false);
|
|
50
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
51
|
-
require_module_helpers.addImport(path, {
|
|
52
|
-
module: "storm:env",
|
|
53
|
-
name: "env",
|
|
54
|
-
imported: "env"
|
|
55
|
-
});
|
|
56
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
|
|
57
|
-
name: "useStorm",
|
|
58
|
-
type: "Identifier"
|
|
59
|
-
} }) && path.get("property")?.isIdentifier()) {
|
|
60
|
-
const identifier = path.get("property")?.node;
|
|
61
|
-
extractEnv(identifier, pass, false);
|
|
62
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
63
|
-
require_module_helpers.addImport(path, {
|
|
64
|
-
module: "storm:env",
|
|
65
|
-
name: "env",
|
|
66
|
-
imported: "env"
|
|
67
|
-
});
|
|
68
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
69
|
-
const identifier = path.get("property")?.node;
|
|
70
|
-
if (!identifier.name) return;
|
|
71
|
-
extractEnv(identifier, pass, false);
|
|
72
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
73
|
-
require_module_helpers.addImport(path, {
|
|
74
|
-
module: "storm:env",
|
|
75
|
-
name: "env",
|
|
76
|
-
imported: "env"
|
|
77
|
-
});
|
|
78
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
|
|
79
|
-
const identifier = path.get("property")?.node;
|
|
80
|
-
if (!identifier.name) return;
|
|
81
|
-
extractEnv(identifier, pass, false);
|
|
82
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
83
|
-
require_module_helpers.addImport(path, {
|
|
84
|
-
module: "storm:env",
|
|
85
|
-
name: "env",
|
|
86
|
-
imported: "env"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
} },
|
|
90
|
-
post() {
|
|
91
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
|
|
92
|
-
let persistedEnv = require_type.type_exports.ReflectionClass.from({
|
|
93
|
-
kind: require_type.type_exports.ReflectionKind.objectLiteral,
|
|
94
|
-
description: `An object containing the environment variables used by the application.`,
|
|
95
|
-
types: []
|
|
96
|
-
});
|
|
97
|
-
const reflectionPath = require_persistence.getEnvReflectionsPath(context, "env");
|
|
98
|
-
if (reflectionPath && (0, node_fs.existsSync)(reflectionPath)) {
|
|
99
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
|
|
100
|
-
persistedEnv = (0, require_type.type_exports.resolveClassType)((0, require_type.type_exports.deserializeType)(require_capnp.convertFromCapnp(new __stryke_capnp.Message((0, __stryke_fs_buffer.readFileBufferSync)(reflectionPath), false).getRoot(require_reflection.SerializedTypes).types)));
|
|
101
|
-
}
|
|
102
|
-
log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
|
|
103
|
-
persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
|
|
104
|
-
context.env.used.env.addProperty({
|
|
105
|
-
...property,
|
|
106
|
-
name: property.getNameAsString(),
|
|
107
|
-
description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
|
|
108
|
-
default: property.getDefaultValue(),
|
|
109
|
-
optional: property.isOptional() ? true : void 0,
|
|
110
|
-
readonly: property.isReadonly() ? true : void 0,
|
|
111
|
-
visibility: property.getVisibility(),
|
|
112
|
-
type: property.getType(),
|
|
113
|
-
tags: property.getTags()
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
//#endregion
|
|
121
|
-
exports.envBabelPlugin = envBabelPlugin;
|
package/dist/babel/plugin.d.cts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DeclareBabelTransformPluginReturn } from "../powerlines/src/types/babel.cjs";
|
|
2
|
-
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.cjs";
|
|
3
|
-
|
|
4
|
-
//#region src/babel/plugin.d.ts
|
|
5
|
-
declare const envBabelPlugin: DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { envBabelPlugin };
|
package/dist/babel/plugin.d.mts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DeclareBabelTransformPluginReturn } from "../powerlines/src/types/babel.mjs";
|
|
2
|
-
import "../powerlines/src/index.mjs";
|
|
3
|
-
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.mjs";
|
|
4
|
-
import "../index.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/babel/plugin.d.ts
|
|
7
|
-
declare const envBabelPlugin: DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { envBabelPlugin };
|
package/dist/babel/plugin.mjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { type_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
|
-
import { createBabelPlugin } from "../plugin-babel/src/helpers/create-plugin.mjs";
|
|
3
|
-
import { addImport } from "../plugin-babel/src/helpers/module-helpers.mjs";
|
|
4
|
-
import { convertFromCapnp } from "../deepkit/src/capnp.mjs";
|
|
5
|
-
import { SerializedTypes } from "../deepkit/schemas/reflection2.mjs";
|
|
6
|
-
import { stringifyDefaultValue } from "../deepkit/src/utilities.mjs";
|
|
7
|
-
import { getEnvReflectionsPath } from "../helpers/persistence.mjs";
|
|
8
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
9
|
-
import * as capnp from "@stryke/capnp";
|
|
10
|
-
import { readFileBufferSync } from "@stryke/fs/buffer";
|
|
11
|
-
import { existsSync } from "node:fs";
|
|
12
|
-
|
|
13
|
-
//#region src/babel/plugin.ts
|
|
14
|
-
const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
15
|
-
function extractEnv(node, pass, isInjectable = false) {
|
|
16
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
|
|
17
|
-
if (node.name) {
|
|
18
|
-
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}_`, "")))));
|
|
19
|
-
let name = node.name;
|
|
20
|
-
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
21
|
-
log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
22
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
|
|
23
|
-
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
|
|
24
|
-
if (!envProperty || envProperty.isIgnored()) return;
|
|
25
|
-
if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
|
|
26
|
-
if (context.config.env.inject && isInjectable) {
|
|
27
|
-
let value = context.env.parsed?.[name];
|
|
28
|
-
if (value === void 0) {
|
|
29
|
-
const prefix$1 = context.config.env.prefix.find((pre) => {
|
|
30
|
-
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
31
|
-
});
|
|
32
|
-
if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
|
|
33
|
-
}
|
|
34
|
-
value ??= envProperty.getDefaultValue();
|
|
35
|
-
if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
|
|
36
|
-
return stringifyDefaultValue(envProperty, value);
|
|
37
|
-
}
|
|
38
|
-
} 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"}.
|
|
39
|
-
|
|
40
|
-
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`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
visitor: { MemberExpression(path, pass) {
|
|
45
|
-
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
|
|
46
|
-
const identifier = path.get("property")?.node;
|
|
47
|
-
extractEnv(identifier, pass, false);
|
|
48
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
49
|
-
addImport(path, {
|
|
50
|
-
module: "storm:env",
|
|
51
|
-
name: "env",
|
|
52
|
-
imported: "env"
|
|
53
|
-
});
|
|
54
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
|
|
55
|
-
name: "useStorm",
|
|
56
|
-
type: "Identifier"
|
|
57
|
-
} }) && path.get("property")?.isIdentifier()) {
|
|
58
|
-
const identifier = path.get("property")?.node;
|
|
59
|
-
extractEnv(identifier, pass, false);
|
|
60
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
61
|
-
addImport(path, {
|
|
62
|
-
module: "storm:env",
|
|
63
|
-
name: "env",
|
|
64
|
-
imported: "env"
|
|
65
|
-
});
|
|
66
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
67
|
-
const identifier = path.get("property")?.node;
|
|
68
|
-
if (!identifier.name) return;
|
|
69
|
-
extractEnv(identifier, pass, false);
|
|
70
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
71
|
-
addImport(path, {
|
|
72
|
-
module: "storm:env",
|
|
73
|
-
name: "env",
|
|
74
|
-
imported: "env"
|
|
75
|
-
});
|
|
76
|
-
} else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
|
|
77
|
-
const identifier = path.get("property")?.node;
|
|
78
|
-
if (!identifier.name) return;
|
|
79
|
-
extractEnv(identifier, pass, false);
|
|
80
|
-
path.replaceWithSourceString(`env.${identifier.name}`);
|
|
81
|
-
addImport(path, {
|
|
82
|
-
module: "storm:env",
|
|
83
|
-
name: "env",
|
|
84
|
-
imported: "env"
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
} },
|
|
88
|
-
post() {
|
|
89
|
-
log(LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
|
|
90
|
-
let persistedEnv = type_exports.ReflectionClass.from({
|
|
91
|
-
kind: type_exports.ReflectionKind.objectLiteral,
|
|
92
|
-
description: `An object containing the environment variables used by the application.`,
|
|
93
|
-
types: []
|
|
94
|
-
});
|
|
95
|
-
const reflectionPath = getEnvReflectionsPath(context, "env");
|
|
96
|
-
if (reflectionPath && existsSync(reflectionPath)) {
|
|
97
|
-
log(LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
|
|
98
|
-
persistedEnv = (0, type_exports.resolveClassType)((0, type_exports.deserializeType)(convertFromCapnp(new capnp.Message(readFileBufferSync(reflectionPath), false).getRoot(SerializedTypes).types)));
|
|
99
|
-
}
|
|
100
|
-
log(LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
|
|
101
|
-
persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
|
|
102
|
-
context.env.used.env.addProperty({
|
|
103
|
-
...property,
|
|
104
|
-
name: property.getNameAsString(),
|
|
105
|
-
description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
|
|
106
|
-
default: property.getDefaultValue(),
|
|
107
|
-
optional: property.isOptional() ? true : void 0,
|
|
108
|
-
readonly: property.isReadonly() ? true : void 0,
|
|
109
|
-
visibility: property.getVisibility(),
|
|
110
|
-
type: property.getType(),
|
|
111
|
-
tags: property.getTags()
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
//#endregion
|
|
119
|
-
export { envBabelPlugin };
|