@powerlines/plugin-env 0.15.0 → 0.15.1

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.
@@ -14,6 +14,9 @@ interface TypescriptFileImportItem {
14
14
  alias?: string;
15
15
  type?: boolean;
16
16
  }
17
- type TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
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 TypescriptFileImports = Record<string, null | Array<TypescriptFileImportItem | string>>;
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.0",
3
+ "version": "0.15.1",
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.17.6",
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": "41988f81e266a609148fcac22a535e5f12bbeb5f"
214
+ "gitHead": "b9a0574767447bffa6549e0492812dfe64e879e3"
215
215
  }