trigger.dev 0.0.0-v3-canary-20240321134710 → 0.0.0-v3-canary-20240321164857

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
@@ -800,7 +800,7 @@ import invariant from "tiny-invariant";
800
800
  import { z as z4 } from "zod";
801
801
 
802
802
  // package.json
803
- var version = "0.0.0-v3-canary-20240321134710";
803
+ var version = "0.0.0-v3-canary-20240321164857";
804
804
  var dependencies = {
805
805
  "@baselime/node-opentelemetry": "^0.4.6",
806
806
  "@clack/prompts": "^0.7.0",
@@ -821,7 +821,7 @@ var dependencies = {
821
821
  "@opentelemetry/sdk-trace-node": "^1.21.0",
822
822
  "@opentelemetry/semantic-conventions": "^1.21.0",
823
823
  "@traceloop/instrumentation-openai": "^0.3.9",
824
- "@trigger.dev/core": "workspace:0.0.0-v3-canary-20240321134710",
824
+ "@trigger.dev/core": "workspace:0.0.0-v3-canary-20240321164857",
825
825
  "@types/degit": "^2.8.3",
826
826
  chalk: "^5.2.0",
827
827
  chokidar: "^3.5.3",
@@ -2625,6 +2625,52 @@ ${authorizationCodeResult.error}`
2625
2625
  });
2626
2626
  }
2627
2627
 
2628
+ // src/utilities/build.ts
2629
+ import { createRequire } from "node:module";
2630
+ function bundleDependenciesPlugin(config) {
2631
+ return {
2632
+ name: "bundle-dependencies",
2633
+ setup(build3) {
2634
+ build3.onResolve({ filter: /.*/ }, (args) => {
2635
+ if (args.kind !== "import-statement") {
2636
+ return void 0;
2637
+ }
2638
+ for (let pattern of config.dependenciesToBundle ?? []) {
2639
+ if (typeof pattern === "string" ? args.path === pattern : pattern.test(args.path)) {
2640
+ try {
2641
+ const resolvedPath = resolvePath(args.path);
2642
+ logger.debug(`Bundling ${args.path} as ${resolvedPath}`);
2643
+ return {
2644
+ path: resolvedPath,
2645
+ external: false
2646
+ };
2647
+ } catch (error) {
2648
+ logger.error(`Failed to resolve path ${args.path}`, error);
2649
+ return void 0;
2650
+ }
2651
+ }
2652
+ }
2653
+ return void 0;
2654
+ });
2655
+ }
2656
+ };
2657
+ }
2658
+ function resolvePath(path6) {
2659
+ try {
2660
+ logger.debug("[bundle-dependencies] Attempting to resolve path using ESM resolver", {
2661
+ path: path6,
2662
+ importMetaUrl: import.meta.url
2663
+ });
2664
+ return createRequire(import.meta.url).resolve(path6);
2665
+ } catch (error) {
2666
+ logger.debug("[bundle-dependencies] Failed. Falling back to require.resolve", {
2667
+ path: path6,
2668
+ error
2669
+ });
2670
+ return __require.resolve(path6);
2671
+ }
2672
+ }
2673
+
2628
2674
  // src/commands/deploy.ts
2629
2675
  var DeployCommandOptions = CommonCommandOptions.extend({
2630
2676
  skipTypecheck: z4.boolean().default(false),
@@ -3189,7 +3235,8 @@ async function compileProject(config, options, configPath) {
3189
3235
  define: {
3190
3236
  TRIGGER_API_URL: `"${config.triggerUrl}"`,
3191
3237
  __PROJECT_CONFIG__: JSON.stringify(config)
3192
- }
3238
+ },
3239
+ plugins: [bundleDependenciesPlugin(config)]
3193
3240
  });
3194
3241
  if (result.errors.length > 0) {
3195
3242
  compileSpinner.stop("Build failed, aborting deployment");
@@ -4325,6 +4372,7 @@ function useDev({
4325
4372
  __PROJECT_CONFIG__: JSON.stringify(config)
4326
4373
  },
4327
4374
  plugins: [
4375
+ bundleDependenciesPlugin(config),
4328
4376
  {
4329
4377
  name: "trigger.dev v3",
4330
4378
  setup(build3) {