@powerlines/plugin-env 0.15.87 → 0.15.89

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.
@@ -104,34 +104,13 @@ const envBabelPlugin = (__powerlines_plugin_babel_helpers_create_plugin.createBa
104
104
  ];
105
105
  return {
106
106
  visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
107
- if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
108
- const identifier = path.get("property")?.node;
109
- extractEnv(identifier, pass, false);
110
- path.replaceWithSourceString(`env.${identifier.name}`);
111
- (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
112
- module: "storm:env",
113
- name: "env",
114
- imported: "env"
115
- });
116
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
117
- name: "useStorm",
118
- type: "Identifier"
119
- } }) && path.get("property")?.isIdentifier()) {
120
- const identifier = path.get("property")?.node;
121
- extractEnv(identifier, pass, false);
122
- path.replaceWithSourceString(`env.${identifier.name}`);
123
- (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
124
- module: "storm:env",
125
- name: "env",
126
- imported: "env"
127
- });
128
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
107
+ if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
129
108
  const identifier = path.get("property")?.node;
130
109
  if (!identifier.name) return;
131
110
  extractEnv(identifier, pass, false);
132
111
  path.replaceWithSourceString(`env.${identifier.name}`);
133
112
  (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
134
- module: "storm:env",
113
+ module: `${context.config.framework}:env`,
135
114
  name: "env",
136
115
  imported: "env"
137
116
  });
@@ -141,7 +120,7 @@ const envBabelPlugin = (__powerlines_plugin_babel_helpers_create_plugin.createBa
141
120
  extractEnv(identifier, pass, false);
142
121
  path.replaceWithSourceString(`env.${identifier.name}`);
143
122
  (0, __powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
144
- module: "storm:env",
123
+ module: `${context.config.framework}:env`,
145
124
  name: "env",
146
125
  imported: "env"
147
126
  });
@@ -102,34 +102,13 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
102
102
  ];
103
103
  return {
104
104
  visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
105
- if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
106
- const identifier = path.get("property")?.node;
107
- extractEnv(identifier, pass, false);
108
- path.replaceWithSourceString(`env.${identifier.name}`);
109
- addImport(path, {
110
- module: "storm:env",
111
- name: "env",
112
- imported: "env"
113
- });
114
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
115
- name: "useStorm",
116
- type: "Identifier"
117
- } }) && path.get("property")?.isIdentifier()) {
118
- const identifier = path.get("property")?.node;
119
- extractEnv(identifier, pass, false);
120
- path.replaceWithSourceString(`env.${identifier.name}`);
121
- addImport(path, {
122
- module: "storm:env",
123
- name: "env",
124
- imported: "env"
125
- });
126
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
105
+ if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
127
106
  const identifier = path.get("property")?.node;
128
107
  if (!identifier.name) return;
129
108
  extractEnv(identifier, pass, false);
130
109
  path.replaceWithSourceString(`env.${identifier.name}`);
131
110
  addImport(path, {
132
- module: "storm:env",
111
+ module: `${context.config.framework}:env`,
133
112
  name: "env",
134
113
  imported: "env"
135
114
  });
@@ -139,7 +118,7 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
139
118
  extractEnv(identifier, pass, false);
140
119
  path.replaceWithSourceString(`env.${identifier.name}`);
141
120
  addImport(path, {
142
- module: "storm:env",
121
+ module: `${context.config.framework}:env`,
143
122
  name: "env",
144
123
  imported: "env"
145
124
  });
package/dist/index.cjs CHANGED
@@ -83,7 +83,6 @@ const plugin = (options = {}) => {
83
83
  },
84
84
  async configResolved() {
85
85
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
86
- this.config.env.inject ??= this.config.projectType === "application";
87
86
  this.env = require_defu.defu({ parsed: await require_helpers_load.loadEnv(this, this.config.env) }, this.env ?? {}, {
88
87
  types: { env: {} },
89
88
  used: {
package/dist/index.mjs CHANGED
@@ -78,7 +78,6 @@ const plugin = (options = {}) => {
78
78
  },
79
79
  async configResolved() {
80
80
  this.log(LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
81
- this.config.env.inject ??= this.config.projectType === "application";
82
81
  this.env = defu({ parsed: await loadEnv(this, this.config.env) }, this.env ?? {}, {
83
82
  types: { env: {} },
84
83
  used: {
@@ -29,9 +29,6 @@ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
29
29
  /**
30
30
  * Should the plugin inject the env variables in the source code with their values?
31
31
  *
32
- * @remarks
33
- * This option is set to `true` when building an application project.
34
- *
35
32
  * @defaultValue false
36
33
  */
37
34
  inject?: boolean;
@@ -30,9 +30,6 @@ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
30
30
  /**
31
31
  * Should the plugin inject the env variables in the source code with their values?
32
32
  *
33
- * @remarks
34
- * This option is set to `true` when building an application project.
35
- *
36
33
  * @defaultValue false
37
34
  */
38
35
  inject?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.15.87",
3
+ "version": "0.15.89",
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.83",
197
- "@powerlines/plugin-automd": "^0.1.194",
198
- "@powerlines/plugin-babel": "^0.12.203",
199
- "@powerlines/plugin-plugin": "^0.12.146",
196
+ "@powerlines/plugin-alloy": "^0.18.85",
197
+ "@powerlines/plugin-automd": "^0.1.196",
198
+ "@powerlines/plugin-babel": "^0.12.205",
199
+ "@powerlines/plugin-plugin": "^0.12.148",
200
200
  "@storm-software/config-tools": "^1.188.80",
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.68"
209
+ "powerlines": "^0.37.70"
210
210
  },
211
211
  "devDependencies": {
212
- "@powerlines/deepkit": "^0.5.111",
213
- "@powerlines/plugin-deepkit": "^0.11.72",
212
+ "@powerlines/deepkit": "^0.5.113",
213
+ "@powerlines/plugin-deepkit": "^0.11.74",
214
214
  "@types/node": "^24.10.9",
215
215
  "vite": "8.0.0-beta.2"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "f8260d0aec03ef3e809d6c0a7f95faf703fc3801"
218
+ "gitHead": "49824cd670e66c1adee0b6da4008c3d8aed5a8a4"
219
219
  }