@powerlines/plugin-env 0.15.79 → 0.15.80

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.
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_pathe_M_eThtNZ = require('../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs');
3
3
  const require_defu = require('../../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
4
- const require_nypm_CLjaS_sz = require('../../../../../nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.cjs');
4
+ const require_index = require('../../../../../nypm@0.6.3/node_modules/nypm/dist/index.cjs');
5
5
  const require_proxy$1 = require('../../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.cjs');
6
6
  let node_fs = require("node:fs");
7
7
  node_fs = require_rolldown_runtime.__toESM(node_fs);
@@ -2681,7 +2681,7 @@ async function downloadTemplate(input, options = {}) {
2681
2681
  debug(`Extracted to ${extractPath} in ${Date.now() - s$7}ms`);
2682
2682
  if (options.install) {
2683
2683
  debug("Installing dependencies...");
2684
- await require_nypm_CLjaS_sz.installDependencies({
2684
+ await require_index.installDependencies({
2685
2685
  cwd: extractPath,
2686
2686
  silent: options.silent
2687
2687
  });
@@ -1,6 +1,6 @@
1
1
  import { basename, dirname as dirname$1, resolve as resolve$1 } from "../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
2
2
  import { defu } from "../../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
3
- import { installDependencies } from "../../../../../nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs";
3
+ import { installDependencies } from "../../../../../nypm@0.6.3/node_modules/nypm/dist/index.mjs";
4
4
  import { require_proxy } from "../../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs";
5
5
  import fs, { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
6
6
  import path from "node:path";
@@ -1,12 +1,13 @@
1
- const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_pathe_M_eThtNZ = require('../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs');
3
- const require_main = require('../../../../../tinyexec@1.0.2/node_modules/tinyexec/dist/main.cjs');
1
+ const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_pathe_M_eThtNZ = require('../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs');
3
+ const require_main = require('../../../../tinyexec@1.0.2/node_modules/tinyexec/dist/main.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_rolldown_runtime.__toESM(node_fs);
6
+ let node_path = require("node:path");
6
7
  let node_fs_promises = require("node:fs/promises");
7
8
  let node_module = require("node:module");
8
9
 
9
- //#region ../../node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs
10
+ //#region ../../node_modules/.pnpm/nypm@0.6.3/node_modules/nypm/dist/index.mjs
10
11
  async function findup(cwd, match, options = {}) {
11
12
  const segments = require_pathe_M_eThtNZ.normalize(cwd).split("/");
12
13
  while (segments.length > 0) {
@@ -35,7 +36,7 @@ const hasCorepack = cached(async () => {
35
36
  }
36
37
  });
37
38
  async function executeCommand(command, args, options = {}) {
38
- const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]];
39
+ const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
39
40
  const { exitCode, stdout, stderr } = await require_main.K(xArgs[0], xArgs[1], { nodeOptions: {
40
41
  cwd: require_pathe_M_eThtNZ.resolve(options.cwd || process.cwd()),
41
42
  env: options.env,
@@ -64,7 +65,8 @@ async function resolveOperationOptions(options = {}) {
64
65
  dev: options.dev ?? false,
65
66
  workspace: options.workspace,
66
67
  global: options.global ?? false,
67
- dry: options.dry ?? false
68
+ dry: options.dry ?? false,
69
+ corepack: options.corepack ?? true
68
70
  };
69
71
  }
70
72
  function parsePackageManagerField(packageManager) {
@@ -75,7 +77,7 @@ function parsePackageManagerField(packageManager) {
75
77
  version,
76
78
  buildMeta
77
79
  };
78
- const sanitized = name.replace(/\W+/g, "");
80
+ const sanitized = (name || "").replace(/\W+/g, "");
79
81
  return {
80
82
  name: sanitized,
81
83
  version,
@@ -113,6 +115,13 @@ const packageManagers = [
113
115
  files: ["deno.json"]
114
116
  }
115
117
  ];
118
+ /**
119
+ * Detect the package manager used in a directory (and up) by checking various sources:
120
+ *
121
+ * 1. Use `packageManager` field from package.json
122
+ *
123
+ * 2. Known lock files and other files
124
+ */
116
125
  async function detectPackageManager(cwd, options = {}) {
117
126
  const detected = await findup(require_pathe_M_eThtNZ.resolve(cwd || "."), async (path) => {
118
127
  if (!options.ignorePackageJSON) {
@@ -151,6 +160,15 @@ async function detectPackageManager(cwd, options = {}) {
151
160
  }
152
161
  return detected;
153
162
  }
163
+ /**
164
+ * Installs project dependencies.
165
+ *
166
+ * @param options - Options to pass to the API call.
167
+ * @param options.cwd - The directory to run the command in.
168
+ * @param options.silent - Whether to run the command in silent mode.
169
+ * @param options.packageManager - The package manager info to use (auto-detected).
170
+ * @param options.frozenLockFile - Whether to install dependencies with frozen lock file.
171
+ */
154
172
  async function installDependencies(options = {}) {
155
173
  const resolvedOptions = await resolveOperationOptions(options);
156
174
  const commandArgs = options.frozenLockFile ? {
@@ -160,9 +178,11 @@ async function installDependencies(options = {}) {
160
178
  pnpm: ["install", "--frozen-lockfile"],
161
179
  deno: ["install", "--frozen"]
162
180
  }[resolvedOptions.packageManager.name] : ["install"];
181
+ if (options.ignoreWorkspace && resolvedOptions.packageManager.name === "pnpm") commandArgs.push("--ignore-workspace");
163
182
  if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
164
183
  cwd: resolvedOptions.cwd,
165
- silent: resolvedOptions.silent
184
+ silent: resolvedOptions.silent,
185
+ corepack: resolvedOptions.corepack
166
186
  });
167
187
  return { exec: {
168
188
  command: resolvedOptions.packageManager.command,
@@ -1,12 +1,12 @@
1
- import { join, normalize, resolve } from "../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
2
- import { K } from "../../../../../tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs";
1
+ import { join, normalize as normalize$1, resolve as resolve$1 } from "../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
2
+ import { K } from "../../../../tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync } from "node:fs";
5
5
  import { readFile } from "node:fs/promises";
6
6
 
7
- //#region ../../node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs
7
+ //#region ../../node_modules/.pnpm/nypm@0.6.3/node_modules/nypm/dist/index.mjs
8
8
  async function findup(cwd, match, options = {}) {
9
- const segments = normalize(cwd).split("/");
9
+ const segments = normalize$1(cwd).split("/");
10
10
  while (segments.length > 0) {
11
11
  const result = await match(segments.join("/") || "/");
12
12
  if (result || !options.includeParentDirs) return result;
@@ -33,9 +33,9 @@ const hasCorepack = cached(async () => {
33
33
  }
34
34
  });
35
35
  async function executeCommand(command, args, options = {}) {
36
- const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]];
36
+ const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
37
37
  const { exitCode, stdout, stderr } = await K(xArgs[0], xArgs[1], { nodeOptions: {
38
- cwd: resolve(options.cwd || process.cwd()),
38
+ cwd: resolve$1(options.cwd || process.cwd()),
39
39
  env: options.env,
40
40
  stdio: options.silent ? "pipe" : "inherit"
41
41
  } });
@@ -62,7 +62,8 @@ async function resolveOperationOptions(options = {}) {
62
62
  dev: options.dev ?? false,
63
63
  workspace: options.workspace,
64
64
  global: options.global ?? false,
65
- dry: options.dry ?? false
65
+ dry: options.dry ?? false,
66
+ corepack: options.corepack ?? true
66
67
  };
67
68
  }
68
69
  function parsePackageManagerField(packageManager) {
@@ -73,7 +74,7 @@ function parsePackageManagerField(packageManager) {
73
74
  version,
74
75
  buildMeta
75
76
  };
76
- const sanitized = name.replace(/\W+/g, "");
77
+ const sanitized = (name || "").replace(/\W+/g, "");
77
78
  return {
78
79
  name: sanitized,
79
80
  version,
@@ -111,10 +112,17 @@ const packageManagers = [
111
112
  files: ["deno.json"]
112
113
  }
113
114
  ];
115
+ /**
116
+ * Detect the package manager used in a directory (and up) by checking various sources:
117
+ *
118
+ * 1. Use `packageManager` field from package.json
119
+ *
120
+ * 2. Known lock files and other files
121
+ */
114
122
  async function detectPackageManager(cwd, options = {}) {
115
- const detected = await findup(resolve(cwd || "."), async (path) => {
123
+ const detected = await findup(resolve$1(cwd || "."), async (path$1) => {
116
124
  if (!options.ignorePackageJSON) {
117
- const packageJSONPath = join(path, "package.json");
125
+ const packageJSONPath = join(path$1, "package.json");
118
126
  if (existsSync(packageJSONPath)) {
119
127
  const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
120
128
  if (packageJSON?.packageManager) {
@@ -135,10 +143,10 @@ async function detectPackageManager(cwd, options = {}) {
135
143
  }
136
144
  }
137
145
  }
138
- if (existsSync(join(path, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
146
+ if (existsSync(join(path$1, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
139
147
  }
140
148
  if (!options.ignoreLockFile) {
141
- for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve(path, file)))) return { ...packageManager };
149
+ for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve$1(path$1, file)))) return { ...packageManager };
142
150
  }
143
151
  }, { includeParentDirs: options.includeParentDirs ?? true });
144
152
  if (!detected && !options.ignoreArgv) {
@@ -149,6 +157,15 @@ async function detectPackageManager(cwd, options = {}) {
149
157
  }
150
158
  return detected;
151
159
  }
160
+ /**
161
+ * Installs project dependencies.
162
+ *
163
+ * @param options - Options to pass to the API call.
164
+ * @param options.cwd - The directory to run the command in.
165
+ * @param options.silent - Whether to run the command in silent mode.
166
+ * @param options.packageManager - The package manager info to use (auto-detected).
167
+ * @param options.frozenLockFile - Whether to install dependencies with frozen lock file.
168
+ */
152
169
  async function installDependencies(options = {}) {
153
170
  const resolvedOptions = await resolveOperationOptions(options);
154
171
  const commandArgs = options.frozenLockFile ? {
@@ -158,9 +175,11 @@ async function installDependencies(options = {}) {
158
175
  pnpm: ["install", "--frozen-lockfile"],
159
176
  deno: ["install", "--frozen"]
160
177
  }[resolvedOptions.packageManager.name] : ["install"];
178
+ if (options.ignoreWorkspace && resolvedOptions.packageManager.name === "pnpm") commandArgs.push("--ignore-workspace");
161
179
  if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
162
180
  cwd: resolvedOptions.cwd,
163
- silent: resolvedOptions.silent
181
+ silent: resolvedOptions.silent,
182
+ corepack: resolvedOptions.corepack
164
183
  });
165
184
  return { exec: {
166
185
  command: resolvedOptions.packageManager.command,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.15.79",
3
+ "version": "0.15.80",
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.76",
197
- "@powerlines/plugin-automd": "^0.1.187",
198
- "@powerlines/plugin-babel": "^0.12.196",
199
- "@powerlines/plugin-plugin": "^0.12.139",
196
+ "@powerlines/plugin-alloy": "^0.18.77",
197
+ "@powerlines/plugin-automd": "^0.1.188",
198
+ "@powerlines/plugin-babel": "^0.12.197",
199
+ "@powerlines/plugin-plugin": "^0.12.140",
200
200
  "@storm-software/config-tools": "^1.188.80",
201
201
  "@stryke/capnp": "^0.12.60",
202
202
  "@stryke/env": "^0.20.52",
@@ -206,14 +206,14 @@
206
206
  "@stryke/type-checks": "^0.5.19",
207
207
  "@stryke/types": "^0.10.33",
208
208
  "automd": "^0.4.2",
209
- "powerlines": "^0.37.61"
209
+ "powerlines": "^0.37.62"
210
210
  },
211
211
  "devDependencies": {
212
- "@powerlines/deepkit": "^0.5.104",
213
- "@powerlines/plugin-deepkit": "^0.11.65",
212
+ "@powerlines/deepkit": "^0.5.105",
213
+ "@powerlines/plugin-deepkit": "^0.11.66",
214
214
  "@types/node": "^24.10.9",
215
215
  "vite": "8.0.0-beta.2"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "e32ac1e96e167d4d1d0b6cb88fa1c5b273e01641"
218
+ "gitHead": "b535c27a2e65db3f031f63ee1a0d5a9140917c0a"
219
219
  }