@powerlines/plugin-env 0.15.8 → 0.15.9
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/plugin-alloy/src/types/components.d.cts +3 -4
- package/dist/plugin-alloy/src/types/components.d.mts +3 -5
- package/dist/plugin-alloy/src/types/index.d.cts +1 -1
- package/dist/plugin-alloy/src/types/index.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +14 -2
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +15 -3
- package/package.json +3 -3
|
@@ -15,9 +15,8 @@ interface TypescriptFileImportItem {
|
|
|
15
15
|
alias?: string;
|
|
16
16
|
type?: boolean;
|
|
17
17
|
}
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
$builtins?: TypescriptFileImportList;
|
|
18
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>> & {
|
|
19
|
+
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
21
20
|
};
|
|
22
21
|
//#endregion
|
|
23
|
-
export { ComponentProps, TypescriptFileImportItem,
|
|
22
|
+
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../../powerlines/src/types/fs.mjs";
|
|
2
1
|
import "../../../powerlines/src/types/resolved.mjs";
|
|
3
2
|
import { Children } from "@alloy-js/core";
|
|
4
3
|
import { SourceFileContext as SourceFileContext$1 } from "@alloy-js/typescript";
|
|
@@ -17,9 +16,8 @@ interface TypescriptFileImportItem {
|
|
|
17
16
|
alias?: string;
|
|
18
17
|
type?: boolean;
|
|
19
18
|
}
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
$builtins?: TypescriptFileImportList;
|
|
19
|
+
type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>> & {
|
|
20
|
+
$builtins?: Record<string, null | Array<TypescriptFileImportItem | string>>;
|
|
23
21
|
};
|
|
24
22
|
//#endregion
|
|
25
|
-
export { ComponentProps, TypescriptFileImportItem,
|
|
23
|
+
export { ComponentProps, TypescriptFileImportItem, TypescriptFileImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, TypescriptFileImportItem,
|
|
1
|
+
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImports } from "./components.cjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.cjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComponentProps, TypescriptFileImportItem,
|
|
1
|
+
import { ComponentProps, TypescriptFileImportItem, TypescriptFileImports } from "./components.mjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.mjs";
|
|
@@ -167,8 +167,20 @@ function TypescriptFileHeaderImports(props) {
|
|
|
167
167
|
return !!imports && Object.keys(imports).length > 0;
|
|
168
168
|
},
|
|
169
169
|
get children() {
|
|
170
|
-
return
|
|
171
|
-
|
|
170
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
171
|
+
get each() {
|
|
172
|
+
return Object.entries(imports ?? {});
|
|
173
|
+
},
|
|
174
|
+
children: ([module$1, imported]) => {
|
|
175
|
+
if (module$1 === "$builtins") return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
176
|
+
get each() {
|
|
177
|
+
return Object.entries(imported ?? {});
|
|
178
|
+
},
|
|
179
|
+
children: ([builtinModule, builtinImports]) => __alloy_js_core.code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
180
|
+
});
|
|
181
|
+
const normalImports = imported;
|
|
182
|
+
return __alloy_js_core.code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module$1}";`;
|
|
183
|
+
}
|
|
172
184
|
});
|
|
173
185
|
}
|
|
174
186
|
}),
|
|
@@ -2,7 +2,7 @@ import { usePowerlines } from "../../core/contexts/context.mjs";
|
|
|
2
2
|
import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
|
|
3
3
|
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
4
4
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
-
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
5
|
+
import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
6
6
|
import { appendPath } from "@stryke/path/append";
|
|
7
7
|
import { isString } from "@stryke/type-checks/is-string";
|
|
8
8
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
@@ -166,8 +166,20 @@ function TypescriptFileHeaderImports(props) {
|
|
|
166
166
|
return !!imports && Object.keys(imports).length > 0;
|
|
167
167
|
},
|
|
168
168
|
get children() {
|
|
169
|
-
return
|
|
170
|
-
|
|
169
|
+
return createComponent(For, {
|
|
170
|
+
get each() {
|
|
171
|
+
return Object.entries(imports ?? {});
|
|
172
|
+
},
|
|
173
|
+
children: ([module, imported]) => {
|
|
174
|
+
if (module === "$builtins") return createComponent(For, {
|
|
175
|
+
get each() {
|
|
176
|
+
return Object.entries(imported ?? {});
|
|
177
|
+
},
|
|
178
|
+
children: ([builtinModule, builtinImports]) => code`import ${builtinImports === null ? "" : ` from ${builtinImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (builtinImports.filter((i) => !isString(i) && i.default).length > 0 && builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (builtinImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${builtinImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${builtinModule.includes(":") ? builtinModule : `${context.config.output.builtinPrefix}:${builtinModule}`}";`
|
|
179
|
+
});
|
|
180
|
+
const normalImports = imported;
|
|
181
|
+
return code`import ${normalImports === null ? "" : ` from ${normalImports.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (normalImports.filter((i) => !isString(i) && i.default).length > 0 && normalImports.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (normalImports.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${normalImports.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} "${module}";`;
|
|
182
|
+
}
|
|
171
183
|
});
|
|
172
184
|
}
|
|
173
185
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.9",
|
|
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.40",
|
|
197
|
-
"@powerlines/plugin-alloy": "^0.18.
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.18.7",
|
|
198
198
|
"@powerlines/plugin-automd": "^0.1.125",
|
|
199
199
|
"@powerlines/plugin-babel": "^0.12.134",
|
|
200
200
|
"@powerlines/plugin-plugin": "^0.12.77",
|
|
@@ -215,5 +215,5 @@
|
|
|
215
215
|
"vite": "8.0.0-beta.2"
|
|
216
216
|
},
|
|
217
217
|
"publishConfig": { "access": "public" },
|
|
218
|
-
"gitHead": "
|
|
218
|
+
"gitHead": "8c096ca8c2383603e770532ec0f828761d525947"
|
|
219
219
|
}
|