@powerlines/plugin-env 0.15.0 → 0.15.2
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/env.cjs +11 -4
- package/dist/components/env.mjs +11 -4
- package/dist/helpers/create-reflection-resource.d.mts +2 -2
- package/dist/plugin-alloy/src/types/components.d.cts +4 -1
- package/dist/plugin-alloy/src/types/components.d.mts +5 -2
- package/dist/plugin-alloy/src/types/index.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +2 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +2 -1
- package/package.json +3 -3
package/dist/components/env.cjs
CHANGED
|
@@ -193,7 +193,7 @@ const envSerializerRefkey = require_refkey.refkey("EnvSerializer");
|
|
|
193
193
|
* Generates the environment configuration module for the Powerlines project.
|
|
194
194
|
*/
|
|
195
195
|
function EnvBuiltin(props) {
|
|
196
|
-
const [{ defaultConfig }, rest] = (0, __alloy_js_core.splitProps)(props, ["defaultConfig"]);
|
|
196
|
+
const [{ defaultConfig, children }, rest] = (0, __alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
|
|
197
197
|
const context = require_context.usePowerlines();
|
|
198
198
|
const defaultValue = (0, __alloy_js_core.computed)(() => context && require_load.loadEnvFromContext(context, process.env));
|
|
199
199
|
const reflection = require_create_reflection_resource.createReflectionResource(context);
|
|
@@ -206,9 +206,10 @@ function EnvBuiltin(props) {
|
|
|
206
206
|
});
|
|
207
207
|
const reflectionGetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
208
208
|
const reflectionSetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
209
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(
|
|
209
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
210
210
|
id: "env",
|
|
211
|
-
description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
|
|
211
|
+
description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
|
|
212
|
+
}, rest, {
|
|
212
213
|
get imports() {
|
|
213
214
|
return (0, defu.default)({
|
|
214
215
|
"@powerlines/deepkit/vendor/type": [
|
|
@@ -557,7 +558,13 @@ function EnvBuiltin(props) {
|
|
|
557
558
|
initializer: __alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
558
559
|
}),
|
|
559
560
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
560
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
561
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
562
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
563
|
+
get when() {
|
|
564
|
+
return Boolean(children);
|
|
565
|
+
},
|
|
566
|
+
children
|
|
567
|
+
})
|
|
561
568
|
];
|
|
562
569
|
}
|
|
563
570
|
}));
|
package/dist/components/env.mjs
CHANGED
|
@@ -191,7 +191,7 @@ const envSerializerRefkey = refkey$1("EnvSerializer");
|
|
|
191
191
|
* Generates the environment configuration module for the Powerlines project.
|
|
192
192
|
*/
|
|
193
193
|
function EnvBuiltin(props) {
|
|
194
|
-
const [{ defaultConfig }, rest] = splitProps(props, ["defaultConfig"]);
|
|
194
|
+
const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
|
|
195
195
|
const context = usePowerlines();
|
|
196
196
|
const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
|
|
197
197
|
const reflection = createReflectionResource(context);
|
|
@@ -204,9 +204,10 @@ function EnvBuiltin(props) {
|
|
|
204
204
|
});
|
|
205
205
|
const reflectionGetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
206
206
|
const reflectionSetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
|
|
207
|
-
return createComponent(BuiltinFile, mergeProps(
|
|
207
|
+
return createComponent(BuiltinFile, mergeProps({
|
|
208
208
|
id: "env",
|
|
209
|
-
description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
|
|
209
|
+
description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
|
|
210
|
+
}, rest, {
|
|
210
211
|
get imports() {
|
|
211
212
|
return defu({
|
|
212
213
|
"@powerlines/deepkit/vendor/type": [
|
|
@@ -555,7 +556,13 @@ function EnvBuiltin(props) {
|
|
|
555
556
|
initializer: code`Boolean(isDevelopment && env.DEBUG); `
|
|
556
557
|
}),
|
|
557
558
|
createIntrinsic("hbr", {}),
|
|
558
|
-
createIntrinsic("hbr", {})
|
|
559
|
+
createIntrinsic("hbr", {}),
|
|
560
|
+
createComponent(Show, {
|
|
561
|
+
get when() {
|
|
562
|
+
return Boolean(children);
|
|
563
|
+
},
|
|
564
|
+
children
|
|
565
|
+
})
|
|
559
566
|
];
|
|
560
567
|
}
|
|
561
568
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
2
|
import { EnvPluginContext } from "../types/plugin.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core3 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/create-reflection-resource.d.ts
|
|
6
6
|
|
|
@@ -10,6 +10,6 @@ import * as _alloy_js_core4 from "@alloy-js/core";
|
|
|
10
10
|
* @param context - The environment plugin context.
|
|
11
11
|
* @returns A resource that provides the reflection of the environment configuration.
|
|
12
12
|
*/
|
|
13
|
-
declare function createReflectionResource(context?: EnvPluginContext):
|
|
13
|
+
declare function createReflectionResource(context?: EnvPluginContext): _alloy_js_core3.Resource<type_d_exports.ReflectionClass<Record<string, any>>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { createReflectionResource };
|
|
@@ -14,6 +14,9 @@ interface TypescriptFileImportItem {
|
|
|
14
14
|
alias?: string;
|
|
15
15
|
type?: boolean;
|
|
16
16
|
}
|
|
17
|
-
type
|
|
17
|
+
type TypescriptFileImportList = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
18
|
+
type TypescriptFileImports = TypescriptFileImportList & {
|
|
19
|
+
$builtins?: TypescriptFileImportList;
|
|
20
|
+
};
|
|
18
21
|
//#endregion
|
|
19
22
|
export { ComponentProps, TypescriptFileImports };
|
|
@@ -17,6 +17,9 @@ interface TypescriptFileImportItem {
|
|
|
17
17
|
alias?: string;
|
|
18
18
|
type?: boolean;
|
|
19
19
|
}
|
|
20
|
-
type
|
|
20
|
+
type TypescriptFileImportList = Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
21
|
+
type TypescriptFileImports = TypescriptFileImportList & {
|
|
22
|
+
$builtins?: TypescriptFileImportList;
|
|
23
|
+
};
|
|
21
24
|
//#endregion
|
|
22
|
-
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
25
|
+
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImportList, TypescriptFileImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImports } from "./components.mjs";
|
|
1
|
+
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImportList, TypescriptFileImports } from "./components.mjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.mjs";
|
|
@@ -153,6 +153,7 @@ function TypescriptFileHeader(props) {
|
|
|
153
153
|
*/
|
|
154
154
|
function TypescriptFileHeaderImports(props) {
|
|
155
155
|
const { imports } = props;
|
|
156
|
+
const context = require_context.usePowerlines();
|
|
156
157
|
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
157
158
|
const scope = props.scope ?? sourceFile.scope;
|
|
158
159
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
@@ -166,7 +167,7 @@ function TypescriptFileHeaderImports(props) {
|
|
|
166
167
|
return !!imports && Object.keys(imports).length > 0;
|
|
167
168
|
},
|
|
168
169
|
get children() {
|
|
169
|
-
return Object.entries(imports ?? {}).map(([module$1, imported]) => {
|
|
170
|
+
return Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module$1, imported]) => {
|
|
170
171
|
return __alloy_js_core.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
|
|
171
172
|
});
|
|
172
173
|
}
|
|
@@ -152,6 +152,7 @@ function TypescriptFileHeader(props) {
|
|
|
152
152
|
*/
|
|
153
153
|
function TypescriptFileHeaderImports(props) {
|
|
154
154
|
const { imports } = props;
|
|
155
|
+
const context = usePowerlines();
|
|
155
156
|
const sourceFile = useSourceFile();
|
|
156
157
|
const scope = props.scope ?? sourceFile.scope;
|
|
157
158
|
return createComponent(Show, {
|
|
@@ -165,7 +166,7 @@ function TypescriptFileHeaderImports(props) {
|
|
|
165
166
|
return !!imports && Object.keys(imports).length > 0;
|
|
166
167
|
},
|
|
167
168
|
get children() {
|
|
168
|
-
return Object.entries(imports ?? {}).map(([module, imported]) => {
|
|
169
|
+
return Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module, imported]) => {
|
|
169
170
|
return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
|
|
170
171
|
});
|
|
171
172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
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": {
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"@babel/core": "^7.28.5",
|
|
195
195
|
"@babel/types": "^7.28.5",
|
|
196
196
|
"@powerlines/deepkit": "^0.5.36",
|
|
197
|
-
"@powerlines/plugin-alloy": "^0.
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.18.0",
|
|
198
198
|
"@powerlines/plugin-automd": "^0.1.121",
|
|
199
199
|
"@powerlines/plugin-babel": "^0.12.130",
|
|
200
200
|
"@powerlines/plugin-plugin": "^0.12.73",
|
|
@@ -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": "936b3cc1d4bba49e2ddfa38662e37868d0a30fd6"
|
|
215
215
|
}
|