@powerlines/plugin-env 0.16.277 → 0.16.278
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/helpers/load.d.cts +3 -3
- package/dist/helpers/load.d.mts +3 -3
- package/dist/index.cjs +2 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/helpers/load.d.cts
CHANGED
|
@@ -20,15 +20,15 @@ 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";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "edge" | "browser" | "nodejs" | "workerd" | 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
|
@@ -20,15 +20,15 @@ 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";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "edge" | "browser" | "nodejs" | "workerd" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
34
|
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
|
package/dist/index.cjs
CHANGED
|
@@ -48,11 +48,8 @@ const plugin = __assignType((options = {}) => {
|
|
|
48
48
|
plugins: [require_babel_plugin.envBabelPlugin]
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
config.env.config = await require_helpers_schema.getDefaultConfig(this);
|
|
54
|
-
}
|
|
55
|
-
if (!config.env.secrets) config.env.secrets = await require_helpers_schema.getDefaultSecrets(this);
|
|
51
|
+
config.env.config ??= await require_helpers_schema.getDefaultConfig(this);
|
|
52
|
+
config.env.secrets ??= await require_helpers_schema.getDefaultSecrets(this);
|
|
56
53
|
config.env.prefix = (0, _stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce(__assignType((ret, prefix) => {
|
|
57
54
|
const formattedPrefix = (0, _stryke_string_format_constant_case.constantCase)(prefix);
|
|
58
55
|
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAmHJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAmHJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -43,11 +43,8 @@ const plugin = __assignType((options = {}) => {
|
|
|
43
43
|
plugins: [envBabelPlugin]
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
config.env.config = await getDefaultConfig(this);
|
|
49
|
-
}
|
|
50
|
-
if (!config.env.secrets) config.env.secrets = await getDefaultSecrets(this);
|
|
46
|
+
config.env.config ??= await getDefaultConfig(this);
|
|
47
|
+
config.env.secrets ??= await getDefaultSecrets(this);
|
|
51
48
|
config.env.prefix = toArray(config.env.prefix ?? []).reduce(__assignType((ret, prefix) => {
|
|
52
49
|
const formattedPrefix = constantCase(prefix);
|
|
53
50
|
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnv,\n getDefaultConfig,\n getDefaultSecrets,\n writeEnv\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnv,\n getDefaultConfig,\n getDefaultSecrets,\n writeEnv\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n config.env.config ??= await getDefaultConfig(this as UnresolvedContext);\n config.env.secrets ??= await getDefaultSecrets(\n this as UnresolvedContext\n );\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n await extractEnv(this);\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n return render(\n this,\n <EnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n return render(this, <EnvDocsFile levelOffset={0} />);\n },\n async buildEnd() {\n this.debug(\"Writing active environment variables to disk.\");\n\n await writeEnv(this);\n }\n },\n {\n name: \"env:automd-generator\",\n configResolved() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;CAEE,GAAG,SAAS;;AAEd;;;;;CAqCA,OAAS;EAAA,MAAO,QAAO,KAAA;EAAA;;GAEvB,MAAQ,SAAQ;IACd,KAAS,MAAC,wEAAO;IACf,MAAM,SAAA;KACR,KAAA,KAAA,SAAA;MACF,UAAA;;MAEE,QAAA,CAAA;KACG,CAAA;KACH,OAAA;MACK,GAAM,QAAQ;MACX,eAAC,CAAA,QAAoB;MAC1B,SAAA,CAAA,cAAA;KACG;IACJ;IACA,OAAA,IAAA,WAAA,MAAA,iBAAA,IAAA;IACE,OAAO,IAAI,YAAA,MAAA,kBAAA,IAAA;IACX,OAAM,IAAA,SAAS,QAAA,OAAA,IAAA,UAAA,CAAA,CAAA,EAAA,OAAA,cAAA,KAAA,WAAA;KACb,MAAK,kBAAK,aAAA,MAAA;KACV,IAAG,CAAA,IAAA,SAAU,eAAQ,GACpB,IAAA,KAAA,eAAA;KAED,OAAM;IACR,GAAG;KAAC;KAAK;KAAY;KAAE;IAAA,CAAA,GAAA,CAAA,eAAA,KAAA,OAAA,WAAA,QAAA,KAAA,OAAA,WAAA,SAAA,gBAAA,GAAA,aAAA,KAAA,OAAA,WAAA,IAAA,EAAA,EAAA,EAAA,OAAA,OAAA,CAAA;IACvB,OAAM,IAAA,SAAU,UAAK,QAAA,OAAA,IAAA,MAAA,EAAA,OAAA,cAAA,KAAA,WAAA;KACnB,IAAI,CAAA,IAAA,SAAa,OAAA,QAAA,OAAA,EAAA,CAAA,GACf,IAAE,KAAO,OAAE,QAAA,OAAA,EAAA,CAAA;KAEb,OAAO;IACT,GAAG;KAAC;KAAK;KAAQ;KAAK;IAAA,CAAA,GAAA,CAAA,CAAA,CAAA;IACtB,OAAM;GACR;GACA,gBAAM,aAAA,eAAA,iBAAA;IACJ,KAAG,MAAA,gFAAA;;GAEL,GAAG,CAAC,kBAAkB,OAAI,CAAA;GAC1B,SAAI,aAAkB,eAAW,UAAA;IAC/B,MAAI,SAAQ;IACZ,KAAG,MAAA,yEAAA;sDAED,IAAA,gBAAoB;KAClB,OAAO,OAAK,OAAS,IAAI;IAC3B,EACF,CAAC,CAAC;GACJ,GAAG,CAAC,WAAU,OAAA,CAAA;GACd,MAAM,aAAW,eAAS,OAAe;IACvC,KAAK,MAAM,8DAAsB,UAAA,kBAAA,KAAA,OAAA,IAAA,GAAA,QAAA,EAAA,EAAA;IACjC,OAAM,OAAA,MAAA,gBAAA,aAAA,iBAEN,CAAC,CAAC;GACJ,GAAG,CAAC,QAAG,OAAA,CAAA;GACP,UAAM,aAAA,eAAA,WAAA;IACJ,KAAK,MAAE,+CAAY;IACnB,MAAM,SAAK,IAAO;GACpB,GAAG,CAAC,YAAW,OAAO,CAAA;EACxB;EAAG;GACD,MAAM;GACN,gBAAK,aAAA,SAAA,iBAAA;aAED,QAAO,KAAI,QAAS,UAAS,CAAA,GAAA,EAC3B,YAAQ,EACN,KAAK,IAAI,IAAA,EACX,EACF,CAAC,EACH;GACF,GAAG,CAAC,kBAAkB,OAAC,CAAA;EACzB;EAAG;;GAED,MAAI,EACF,gBAAC,aAAA,SAAA,iBAAA;IACD,OAAM,EACJ,WAAU,KAAA,QAAA,KAAA,OACV;GACF,GAAG;IAAA;IAAA;IAAA;IAAA;GAAA,CAAA;EAEP;EAAG,OAAG,QAAM,MAAW;CAAA;AACzB,GAAG;CAAC;CAAG;QAAA,CAAA;CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.278",
|
|
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"],
|
|
@@ -107,12 +107,12 @@
|
|
|
107
107
|
"@alloy-js/typescript": "^0.23.0",
|
|
108
108
|
"@babel/core": "8.0.0-rc.6",
|
|
109
109
|
"@babel/types": "8.0.0-rc.6",
|
|
110
|
-
"@powerlines/core": "0.48.19",
|
|
111
|
-
"@powerlines/plugin-alloy": "0.26.
|
|
112
|
-
"@powerlines/plugin-automd": "0.1.537",
|
|
113
|
-
"@powerlines/plugin-babel": "0.13.72",
|
|
114
|
-
"@powerlines/plugin-plugin": "0.12.488",
|
|
115
|
-
"@powerlines/schema": "0.11.
|
|
110
|
+
"@powerlines/core": "^0.48.19",
|
|
111
|
+
"@powerlines/plugin-alloy": "0.26.167",
|
|
112
|
+
"@powerlines/plugin-automd": "^0.1.537",
|
|
113
|
+
"@powerlines/plugin-babel": "^0.13.72",
|
|
114
|
+
"@powerlines/plugin-plugin": "^0.12.488",
|
|
115
|
+
"@powerlines/schema": "0.11.60",
|
|
116
116
|
"@storm-software/config-tools": "^1.190.33",
|
|
117
117
|
"@stryke/capnp": "^0.12.104",
|
|
118
118
|
"@stryke/convert": "^0.7.9",
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
"automd": "^0.4.3",
|
|
128
128
|
"c12": "^3.3.4",
|
|
129
129
|
"defu": "^6.1.7",
|
|
130
|
-
"powerlines": "0.47.76"
|
|
130
|
+
"powerlines": "^0.47.76"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": { "@types/node": "^25.9.1", "vite": "^8.0.14" },
|
|
133
133
|
"publishConfig": { "access": "public" },
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "3c8e1ad5b1a50860626e97aed87ea56db57981b3"
|
|
135
135
|
}
|