@powerlines/plugin-env 0.15.97 → 0.15.100

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.
@@ -110,7 +110,7 @@ const envBabelPlugin = (__powerlines_plugin_babel_helpers_create_plugin.createBa
110
110
  extractEnv(identifier, pass, false);
111
111
  path.replaceWithSourceString(`env.${identifier.name}`);
112
112
  (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
113
- module: `${context.config.framework}:env`,
113
+ module: `${context.config.framework || "powerlines"}:env`,
114
114
  name: "env",
115
115
  imported: "env"
116
116
  });
@@ -120,10 +120,14 @@ const envBabelPlugin = (__powerlines_plugin_babel_helpers_create_plugin.createBa
120
120
  extractEnv(identifier, pass, false);
121
121
  path.replaceWithSourceString(`env.${identifier.name}`);
122
122
  (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
123
- module: `${context.config.framework}:env`,
123
+ module: `${context.config.framework || "powerlines"}:env`,
124
124
  name: "env",
125
125
  imported: "env"
126
126
  });
127
+ } else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
128
+ const identifier = path.get("property")?.node;
129
+ if (!identifier.name) return;
130
+ extractEnv(identifier, pass, false);
127
131
  }
128
132
  }, [
129
133
  () => __babel_core.NodePath,
@@ -108,7 +108,7 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
108
108
  extractEnv(identifier, pass, false);
109
109
  path.replaceWithSourceString(`env.${identifier.name}`);
110
110
  addImport(path, {
111
- module: `${context.config.framework}:env`,
111
+ module: `${context.config.framework || "powerlines"}:env`,
112
112
  name: "env",
113
113
  imported: "env"
114
114
  });
@@ -118,10 +118,14 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
118
118
  extractEnv(identifier, pass, false);
119
119
  path.replaceWithSourceString(`env.${identifier.name}`);
120
120
  addImport(path, {
121
- module: `${context.config.framework}:env`,
121
+ module: `${context.config.framework || "powerlines"}:env`,
122
122
  name: "env",
123
123
  imported: "env"
124
124
  });
125
+ } else if (path.get("object")?.isIdentifier({ name: "env" }) && path.get("property")?.isIdentifier()) {
126
+ const identifier = path.get("property")?.node;
127
+ if (!identifier.name) return;
128
+ extractEnv(identifier, pass, false);
125
129
  }
126
130
  }, [
127
131
  () => NodePath,
package/dist/index.cjs CHANGED
@@ -91,13 +91,14 @@ const plugin = (options = {}) => {
91
91
  parsed: {},
92
92
  injected: {}
93
93
  });
94
- if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "env"))) {
94
+ if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "env"))) {
95
95
  this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
96
96
  this.env.types.env = await require_helpers_persistence.readEnvTypeReflection(this, "env");
97
97
  if ((0, __stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "env"))) this.env.used.env = await require_helpers_persistence.readEnvReflection(this);
98
98
  if ((0, __stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await require_helpers_persistence.readEnvTypeReflection(this, "secrets");
99
99
  if ((0, __stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await require_helpers_persistence.readSecretsReflection(this);
100
100
  } else {
101
+ this.debug(`Starting environment configuration reflection initialization.`);
101
102
  this.env.types.env = await require_helpers_reflect.reflectEnv(this, this.config.env.types?.file ? require_is_parent_path.isParentPath(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : require_join_paths.joinPaths(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
102
103
  if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
103
104
  await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.env, "env");
package/dist/index.mjs CHANGED
@@ -86,13 +86,14 @@ const plugin = (options = {}) => {
86
86
  parsed: {},
87
87
  injected: {}
88
88
  });
89
- if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && existsSync(getEnvTypeReflectionsPath(this, "env"))) {
89
+ if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && existsSync(getEnvTypeReflectionsPath(this, "env"))) {
90
90
  this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
91
91
  this.env.types.env = await readEnvTypeReflection(this, "env");
92
92
  if (existsSync(getEnvReflectionsPath(this, "env"))) this.env.used.env = await readEnvReflection(this);
93
93
  if (existsSync(getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await readEnvTypeReflection(this, "secrets");
94
94
  if (existsSync(getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await readSecretsReflection(this);
95
95
  } else {
96
+ this.debug(`Starting environment configuration reflection initialization.`);
96
97
  this.env.types.env = await reflectEnv(this, this.config.env.types?.file ? isParentPath(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : joinPaths(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
97
98
  if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
98
99
  await writeEnvTypeReflection(this, this.env.types.env, "env");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.15.97",
3
+ "version": "0.15.100",
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": {
@@ -193,10 +193,10 @@
193
193
  "@alloy-js/typescript": "^0.22.0",
194
194
  "@babel/core": "^7.28.6",
195
195
  "@babel/types": "^7.28.6",
196
- "@powerlines/plugin-alloy": "^0.18.93",
197
- "@powerlines/plugin-automd": "^0.1.203",
198
- "@powerlines/plugin-babel": "^0.12.212",
199
- "@powerlines/plugin-plugin": "^0.12.154",
196
+ "@powerlines/plugin-alloy": "^0.18.95",
197
+ "@powerlines/plugin-automd": "^0.1.205",
198
+ "@powerlines/plugin-babel": "^0.12.214",
199
+ "@powerlines/plugin-plugin": "^0.12.156",
200
200
  "@storm-software/config-tools": "^1.189.0",
201
201
  "@stryke/capnp": "^0.12.61",
202
202
  "@stryke/env": "^0.20.53",
@@ -206,14 +206,14 @@
206
206
  "@stryke/type-checks": "^0.5.20",
207
207
  "@stryke/types": "^0.10.34",
208
208
  "automd": "^0.4.2",
209
- "powerlines": "^0.37.76"
209
+ "powerlines": "^0.37.78"
210
210
  },
211
211
  "devDependencies": {
212
- "@powerlines/deepkit": "^0.5.120",
213
- "@powerlines/plugin-deepkit": "^0.11.82",
212
+ "@powerlines/deepkit": "^0.5.122",
213
+ "@powerlines/plugin-deepkit": "^0.11.84",
214
214
  "@types/node": "^24.10.9",
215
215
  "vite": "8.0.0-beta.2"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "faf70247de1b07de32c226f429c2715445191813"
218
+ "gitHead": "b9c9c76658b8cd7f3491ff9212b40ffc5b0d0e02"
219
219
  }