trigger.dev 0.0.0-v3-pnpm-fix-20240404112326 → 0.0.0-v3-pnpm-fix-20240404122439

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/index.js CHANGED
@@ -801,7 +801,7 @@ import invariant from "tiny-invariant";
801
801
  import { z as z4 } from "zod";
802
802
 
803
803
  // package.json
804
- var version = "0.0.0-v3-pnpm-fix-20240404112326";
804
+ var version = "0.0.0-v3-pnpm-fix-20240404122439";
805
805
  var dependencies = {
806
806
  "@clack/prompts": "^0.7.0",
807
807
  "@depot/cli": "0.0.1-cli.2.55.0",
@@ -817,7 +817,7 @@ var dependencies = {
817
817
  "@opentelemetry/sdk-trace-base": "^1.22.0",
818
818
  "@opentelemetry/sdk-trace-node": "^1.22.0",
819
819
  "@opentelemetry/semantic-conventions": "^1.22.0",
820
- "@trigger.dev/core": "workspace:0.0.0-v3-pnpm-fix-20240404112326",
820
+ "@trigger.dev/core": "workspace:0.0.0-v3-pnpm-fix-20240404122439",
821
821
  "@types/degit": "^2.8.3",
822
822
  chalk: "^5.2.0",
823
823
  chokidar: "^3.5.3",
@@ -4751,6 +4751,7 @@ function runtimeCheck(minimumMajor, minimumMinor) {
4751
4751
  }
4752
4752
 
4753
4753
  // src/commands/dev.tsx
4754
+ import { findUp as findUp2, pathExists as pathExists2 } from "find-up";
4754
4755
  var apiClient;
4755
4756
  var DevCommandOptions = CommonCommandOptions.extend({
4756
4757
  debugger: z5.boolean().default(false),
@@ -5072,7 +5073,7 @@ function useDev({
5072
5073
  await fs7.promises.writeFile(sourceMapPath2, sourceMapFile.text);
5073
5074
  }
5074
5075
  const environmentVariablesResponse = await environmentClient.getEnvironmentVariables(config.project);
5075
- const processEnv = gatherProcessEnv();
5076
+ const processEnv = await gatherProcessEnv();
5076
5077
  const backgroundWorker = new BackgroundWorker(fullPath, {
5077
5078
  projectConfig: config,
5078
5079
  dependencies: dependencies2,
@@ -5303,7 +5304,7 @@ ${task.filePath} -> ${task.exportName}`).join("")}`;
5303
5304
  }).join("");
5304
5305
  return `Duplicate ${chalkTask("task id")} detected:${duplicateTable}`;
5305
5306
  }
5306
- function gatherProcessEnv() {
5307
+ async function gatherProcessEnv() {
5307
5308
  const env = {
5308
5309
  NODE_ENV: process.env.NODE_ENV ?? "development",
5309
5310
  PATH: process.env.PATH,
@@ -5314,12 +5315,37 @@ function gatherProcessEnv() {
5314
5315
  NVM_BIN: process.env.NVM_BIN,
5315
5316
  LANG: process.env.LANG,
5316
5317
  TERM: process.env.TERM,
5317
- NODE_PATH: process.env.NODE_PATH,
5318
+ NODE_PATH: await amendNodePathWithPnpmNodeModules(process.env.NODE_PATH),
5318
5319
  HOME: process.env.HOME,
5319
5320
  BUN_INSTALL: process.env.BUN_INSTALL
5320
5321
  };
5321
5322
  return Object.fromEntries(Object.entries(env).filter(([key, value]) => value !== void 0));
5322
5323
  }
5324
+ async function amendNodePathWithPnpmNodeModules(nodePath) {
5325
+ const pnpmModulesPath = await findPnpmNodeModulesPath();
5326
+ if (!pnpmModulesPath) {
5327
+ return nodePath;
5328
+ }
5329
+ if (nodePath) {
5330
+ if (nodePath.includes(pnpmModulesPath)) {
5331
+ return nodePath;
5332
+ }
5333
+ return `${nodePath}:${pnpmModulesPath}`;
5334
+ }
5335
+ return pnpmModulesPath;
5336
+ }
5337
+ async function findPnpmNodeModulesPath() {
5338
+ return await findUp2(
5339
+ async (directory) => {
5340
+ const pnpmModules = join5(directory, "node_modules", ".pnpm", "node_modules");
5341
+ const hasPnpmNodeModules = await pathExists2(pnpmModules);
5342
+ if (hasPnpmNodeModules) {
5343
+ return pnpmModules;
5344
+ }
5345
+ },
5346
+ { type: "directory" }
5347
+ );
5348
+ }
5323
5349
 
5324
5350
  // src/commands/init.ts
5325
5351
  import { intro as intro4, isCancel, log as log3, outro as outro4, select as select2, spinner as spinner5, text } from "@clack/prompts";