@powerlines/plugin-env 0.16.330 → 0.16.332
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/babel/plugin.cjs
CHANGED
|
@@ -4,6 +4,7 @@ let _powerlines_schema = require("@powerlines/schema");
|
|
|
4
4
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
5
5
|
let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
|
|
6
6
|
let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
|
|
7
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
7
8
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
8
9
|
|
|
9
10
|
//#region src/babel/plugin.ts
|
|
@@ -18,22 +19,22 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
|
|
|
18
19
|
const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
|
|
19
20
|
logger.trace({
|
|
20
21
|
meta: { category: "env" },
|
|
21
|
-
message: `Environment variable \`${name}\` found in ${pass.filename
|
|
22
|
+
message: `Environment variable \`${name}\` found in ${pass.filename ? (0, _stryke_path_replace.replacePath)(pass.filename, context.config.cwd) : "unknown file"}.`
|
|
22
23
|
});
|
|
23
24
|
if (name in config && (0, _stryke_type_checks_is_set_object.isSetObject)(config[name]) && !config[name]?.ignore) {
|
|
24
25
|
config[name] ??= {};
|
|
25
26
|
logger.debug({
|
|
26
27
|
meta: { category: "env" },
|
|
27
|
-
message: `The \`${name}\` environment variable is used in the source code file "${pass.filename
|
|
28
|
+
message: `The \`${name}\` environment variable is used in the source code file "${pass.filename ? (0, _stryke_path_replace.replacePath)(pass.filename, context.config.cwd) : "unknown file"}" and will be added to the environment schema's active variables list.`
|
|
28
29
|
});
|
|
29
30
|
context.env.config.active.push(name);
|
|
30
31
|
if (!config[name]?.runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
|
|
31
|
-
if (context.config.env.validate && !config[name]?.required && (0, _stryke_type_checks_is_undefined.isUndefined)(config[name]?.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
32
|
+
if (context.config.env.validate && !config[name]?.required && (0, _stryke_type_checks_is_undefined.isUndefined)(config[name]?.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${(0, _stryke_path_replace.replacePath)(pass.filename, context.config.cwd)}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
32
33
|
}
|
|
33
|
-
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, 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.`);
|
|
34
|
+
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${(0, _stryke_path_replace.replacePath)(pass.filename, context.config.cwd)}\`` : ""}, 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.`);
|
|
34
35
|
else logger.warn({
|
|
35
36
|
meta: { category: "env" },
|
|
36
|
-
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, 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.`
|
|
37
|
+
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${(0, _stryke_path_replace.replacePath)(pass.filename, context.config.cwd)}\`` : ""}, 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.`
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAmCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CAiK1B,uBAAA"}
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { getProperties } from "@powerlines/schema";
|
|
|
3
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
4
|
import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
|
|
5
5
|
import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
|
|
6
|
+
import { replacePath } from "@stryke/path/replace";
|
|
6
7
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
8
|
|
|
8
9
|
//#region src/babel/plugin.ts
|
|
@@ -17,22 +18,22 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
|
|
|
17
18
|
const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
|
|
18
19
|
logger.trace({
|
|
19
20
|
meta: { category: "env" },
|
|
20
|
-
message: `Environment variable \`${name}\` found in ${pass.filename
|
|
21
|
+
message: `Environment variable \`${name}\` found in ${pass.filename ? replacePath(pass.filename, context.config.cwd) : "unknown file"}.`
|
|
21
22
|
});
|
|
22
23
|
if (name in config && isSetObject(config[name]) && !config[name]?.ignore) {
|
|
23
24
|
config[name] ??= {};
|
|
24
25
|
logger.debug({
|
|
25
26
|
meta: { category: "env" },
|
|
26
|
-
message: `The \`${name}\` environment variable is used in the source code file "${pass.filename
|
|
27
|
+
message: `The \`${name}\` environment variable is used in the source code file "${pass.filename ? replacePath(pass.filename, context.config.cwd) : "unknown file"}" and will be added to the environment schema's active variables list.`
|
|
27
28
|
});
|
|
28
29
|
context.env.config.active.push(name);
|
|
29
30
|
if (!config[name]?.runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
|
|
30
|
-
if (context.config.env.validate && !config[name]?.required && isUndefined(config[name]?.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
31
|
+
if (context.config.env.validate && !config[name]?.required && isUndefined(config[name]?.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${replacePath(pass.filename, context.config.cwd)}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
31
32
|
}
|
|
32
|
-
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, 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.`);
|
|
33
|
+
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${replacePath(pass.filename, context.config.cwd)}\`` : ""}, 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.`);
|
|
33
34
|
else logger.warn({
|
|
34
35
|
meta: { category: "env" },
|
|
35
|
-
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, 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.`
|
|
36
|
+
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${replacePath(pass.filename, context.config.cwd)}\`` : ""}, 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.`
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
}
|
package/dist/helpers/load.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
20
20
|
RELEASE_TAG: string;
|
|
21
21
|
DEFAULT_LOCALE: string | undefined;
|
|
22
22
|
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
-
LOG_LEVEL: "
|
|
23
|
+
LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
package/dist/helpers/load.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
20
20
|
RELEASE_TAG: string;
|
|
21
21
|
DEFAULT_LOCALE: string | undefined;
|
|
22
22
|
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
-
LOG_LEVEL: "
|
|
23
|
+
LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.332",
|
|
4
4
|
"private": false,
|
|
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
|
"keywords": ["dotenv", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -250,12 +250,12 @@
|
|
|
250
250
|
"@alloy-js/typescript": "^0.23.0",
|
|
251
251
|
"@babel/core": "8.0.0-rc.6",
|
|
252
252
|
"@babel/types": "8.0.0-rc.6",
|
|
253
|
-
"@powerlines/core": "0.48.
|
|
254
|
-
"@powerlines/plugin-alloy": "0.26.
|
|
255
|
-
"@powerlines/plugin-automd": "0.1.
|
|
256
|
-
"@powerlines/plugin-babel": "0.13.
|
|
257
|
-
"@powerlines/plugin-plugin": "0.12.
|
|
258
|
-
"@powerlines/schema": "0.11.
|
|
253
|
+
"@powerlines/core": "0.48.50",
|
|
254
|
+
"@powerlines/plugin-alloy": "0.26.221",
|
|
255
|
+
"@powerlines/plugin-automd": "0.1.589",
|
|
256
|
+
"@powerlines/plugin-babel": "0.13.124",
|
|
257
|
+
"@powerlines/plugin-plugin": "0.12.540",
|
|
258
|
+
"@powerlines/schema": "0.11.110",
|
|
259
259
|
"@storm-software/config-tools": "^1.190.40",
|
|
260
260
|
"@stryke/capnp": "^0.12.111",
|
|
261
261
|
"@stryke/convert": "^0.7.15",
|
|
@@ -270,9 +270,9 @@
|
|
|
270
270
|
"automd": "^0.4.3",
|
|
271
271
|
"c12": "^3.3.4",
|
|
272
272
|
"defu": "^6.1.7",
|
|
273
|
-
"powerlines": "0.47.
|
|
273
|
+
"powerlines": "0.47.128"
|
|
274
274
|
},
|
|
275
|
-
"devDependencies": { "@types/node": "^25.9.
|
|
275
|
+
"devDependencies": { "@types/node": "^25.9.2", "vite": "^8.0.16" },
|
|
276
276
|
"publishConfig": { "access": "public" },
|
|
277
|
-
"gitHead": "
|
|
277
|
+
"gitHead": "c5d53659563ee53a4d919ab56b16cd18b0c9090b"
|
|
278
278
|
}
|