trigger.dev 3.0.0-beta.1 → 3.0.0-beta.2
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 = "3.0.0-beta.
|
|
803
|
+
var version = "3.0.0-beta.2";
|
|
804
804
|
var dependencies = {
|
|
805
805
|
"@clack/prompts": "^0.7.0",
|
|
806
806
|
"@depot/cli": "0.0.1-cli.2.55.0",
|
|
@@ -816,7 +816,7 @@ var dependencies = {
|
|
|
816
816
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
817
817
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
818
818
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
819
|
-
"@trigger.dev/core": "workspace:^3.0.0-beta.
|
|
819
|
+
"@trigger.dev/core": "workspace:^3.0.0-beta.1",
|
|
820
820
|
"@types/degit": "^2.8.3",
|
|
821
821
|
chalk: "^5.2.0",
|
|
822
822
|
chokidar: "^3.5.3",
|
|
@@ -1736,7 +1736,7 @@ ${logo()} ${chalkGrey("(v3 Developer Preview)")}`;
|
|
|
1736
1736
|
}
|
|
1737
1737
|
function printDevBanner() {
|
|
1738
1738
|
logger.log(
|
|
1739
|
-
`${chalkGrey("Key:")} ${chalkWorker("
|
|
1739
|
+
`${chalkGrey("Key:")} ${chalkWorker("Version")} ${chalkGrey("|")} ${chalkTask(
|
|
1740
1740
|
"Task"
|
|
1741
1741
|
)} ${chalkGrey("|")} ${chalkRun("Run")}`
|
|
1742
1742
|
);
|
|
@@ -2722,9 +2722,9 @@ ${authorizationCodeResult.error}`
|
|
|
2722
2722
|
}
|
|
2723
2723
|
|
|
2724
2724
|
// src/utilities/build.ts
|
|
2725
|
+
import { readFileSync } from "node:fs";
|
|
2725
2726
|
import { extname, isAbsolute } from "node:path";
|
|
2726
2727
|
import tsConfigPaths from "tsconfig-paths";
|
|
2727
|
-
import { readFileSync } from "node:fs";
|
|
2728
2728
|
function workerSetupImportConfigPlugin(configPath) {
|
|
2729
2729
|
return {
|
|
2730
2730
|
name: "trigger-worker-setup",
|
|
@@ -2751,8 +2751,8 @@ function workerSetupImportConfigPlugin(configPath) {
|
|
|
2751
2751
|
}
|
|
2752
2752
|
};
|
|
2753
2753
|
}
|
|
2754
|
-
function bundleDependenciesPlugin(
|
|
2755
|
-
const matchPath =
|
|
2754
|
+
function bundleDependenciesPlugin(buildIdentifier, dependenciesToBundle, tsconfigPath) {
|
|
2755
|
+
const matchPath = tsconfigPath ? createMatchPath(tsconfigPath) : void 0;
|
|
2756
2756
|
function resolvePath(id) {
|
|
2757
2757
|
if (!matchPath) {
|
|
2758
2758
|
return id;
|
|
@@ -2764,26 +2764,7 @@ function bundleDependenciesPlugin(config) {
|
|
|
2764
2764
|
setup(build3) {
|
|
2765
2765
|
build3.onResolve({ filter: /.*/ }, (args) => {
|
|
2766
2766
|
const resolvedPath = resolvePath(args.path);
|
|
2767
|
-
logger.ignore(`Checking if ${args.path} should be bundled or external`, {
|
|
2768
|
-
...args,
|
|
2769
|
-
resolvedPath
|
|
2770
|
-
});
|
|
2771
2767
|
if (!isBareModuleId(resolvedPath)) {
|
|
2772
|
-
logger.ignore(`Bundling ${args.path} because its not a bareModuleId`, {
|
|
2773
|
-
...args
|
|
2774
|
-
});
|
|
2775
|
-
return void 0;
|
|
2776
|
-
}
|
|
2777
|
-
if (args.path.startsWith("@trigger.dev/")) {
|
|
2778
|
-
logger.ignore(`Bundling ${args.path} because its a trigger.dev package`, {
|
|
2779
|
-
...args
|
|
2780
|
-
});
|
|
2781
|
-
return void 0;
|
|
2782
|
-
}
|
|
2783
|
-
if (args.path === "superjson" || args.path === "copy-anything" || args.path === "is-what") {
|
|
2784
|
-
logger.debug(`Bundling ${args.path} because its superjson/copy-anything/is-what`, {
|
|
2785
|
-
...args
|
|
2786
|
-
});
|
|
2787
2768
|
return void 0;
|
|
2788
2769
|
}
|
|
2789
2770
|
let loader;
|
|
@@ -2797,12 +2778,12 @@ function bundleDependenciesPlugin(config) {
|
|
|
2797
2778
|
if (loader === "file") {
|
|
2798
2779
|
return void 0;
|
|
2799
2780
|
}
|
|
2800
|
-
for (let pattern of
|
|
2781
|
+
for (let pattern of dependenciesToBundle ?? []) {
|
|
2801
2782
|
if (typeof pattern === "string" ? args.path === pattern : pattern.test(args.path)) {
|
|
2802
2783
|
return void 0;
|
|
2803
2784
|
}
|
|
2804
2785
|
}
|
|
2805
|
-
logger.ignore(`Externalizing ${args.path}`, {
|
|
2786
|
+
logger.ignore(`[${buildIdentifier}] Externalizing ${args.path}`, {
|
|
2806
2787
|
...args
|
|
2807
2788
|
});
|
|
2808
2789
|
return {
|
|
@@ -3499,7 +3480,14 @@ async function compileProject(config, options, configPath) {
|
|
|
3499
3480
|
TRIGGER_API_URL: `"${config.triggerUrl}"`,
|
|
3500
3481
|
__PROJECT_CONFIG__: JSON.stringify(config)
|
|
3501
3482
|
},
|
|
3502
|
-
plugins: [
|
|
3483
|
+
plugins: [
|
|
3484
|
+
bundleDependenciesPlugin(
|
|
3485
|
+
"workerFacade",
|
|
3486
|
+
config.dependenciesToBundle,
|
|
3487
|
+
config.tsconfigPath
|
|
3488
|
+
),
|
|
3489
|
+
workerSetupImportConfigPlugin(configPath)
|
|
3490
|
+
]
|
|
3503
3491
|
});
|
|
3504
3492
|
if (result.errors.length > 0) {
|
|
3505
3493
|
compileSpinner.stop("Build failed, aborting deployment");
|
|
@@ -3531,17 +3519,23 @@ async function compileProject(config, options, configPath) {
|
|
|
3531
3519
|
write: false,
|
|
3532
3520
|
minify: false,
|
|
3533
3521
|
sourcemap: false,
|
|
3534
|
-
packages: "external",
|
|
3535
|
-
// https://esbuild.github.io/api/#packages
|
|
3536
3522
|
logLevel: "error",
|
|
3537
3523
|
platform: "node",
|
|
3524
|
+
packages: "external",
|
|
3538
3525
|
format: "cjs",
|
|
3539
3526
|
// This is needed to support opentelemetry instrumentation that uses module patching
|
|
3540
3527
|
target: ["node18", "es2020"],
|
|
3541
3528
|
outdir: "out",
|
|
3542
3529
|
define: {
|
|
3543
3530
|
__PROJECT_CONFIG__: JSON.stringify(config)
|
|
3544
|
-
}
|
|
3531
|
+
},
|
|
3532
|
+
plugins: [
|
|
3533
|
+
bundleDependenciesPlugin(
|
|
3534
|
+
"entryPoint.ts",
|
|
3535
|
+
config.dependenciesToBundle,
|
|
3536
|
+
config.tsconfigPath
|
|
3537
|
+
)
|
|
3538
|
+
]
|
|
3545
3539
|
});
|
|
3546
3540
|
if (entryPointResult.errors.length > 0) {
|
|
3547
3541
|
compileSpinner.stop("Build failed, aborting deployment");
|
|
@@ -3583,6 +3577,10 @@ async function compileProject(config, options, configPath) {
|
|
|
3583
3577
|
);
|
|
3584
3578
|
await writeFile2(join4(tempDir, "worker.js.map"), workerSourcemapFile.text);
|
|
3585
3579
|
await writeFile2(join4(tempDir, "index.js"), entryPointOutputFile.text);
|
|
3580
|
+
logger.debug("Getting the imports for the worker and entryPoint builds", {
|
|
3581
|
+
workerImports: metaOutput.imports,
|
|
3582
|
+
entryPointImports: entryPointMetaOutput.imports
|
|
3583
|
+
});
|
|
3586
3584
|
const allImports = [...metaOutput.imports, ...entryPointMetaOutput.imports];
|
|
3587
3585
|
const externalPackageJson = await readJSONFile(join4(config.projectDir, "package.json"));
|
|
3588
3586
|
const dependencies2 = await gatherRequiredDependencies(
|
|
@@ -3740,7 +3738,7 @@ async function typecheckProject(config, options) {
|
|
|
3740
3738
|
async function gatherRequiredDependencies(imports, config, projectPackageJson) {
|
|
3741
3739
|
const dependencies2 = {};
|
|
3742
3740
|
for (const file of imports) {
|
|
3743
|
-
if (file.kind !== "require-call" || !file.external) {
|
|
3741
|
+
if (file.kind !== "require-call" && file.kind !== "dynamic-import" || !file.external) {
|
|
3744
3742
|
continue;
|
|
3745
3743
|
}
|
|
3746
3744
|
const packageName = detectPackageNameFromImportPath(file.path);
|
|
@@ -3842,7 +3840,7 @@ async function findAllEnvironmentVariableReferencesInFile(filePath) {
|
|
|
3842
3840
|
const fileContents = await readFile2(filePath, "utf-8");
|
|
3843
3841
|
return findAllEnvironmentVariableReferences(fileContents);
|
|
3844
3842
|
}
|
|
3845
|
-
var IGNORED_ENV_VARS = ["NODE_ENV", "SHELL", "HOME", "PWD", "LOGNAME", "USER", "PATH"];
|
|
3843
|
+
var IGNORED_ENV_VARS = ["NODE_ENV", "SHELL", "HOME", "PWD", "LOGNAME", "USER", "PATH", "DEBUG"];
|
|
3846
3844
|
function findAllEnvironmentVariableReferences(code) {
|
|
3847
3845
|
const regex = /\bprocess\.env\.([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
|
|
3848
3846
|
const matches = code.matchAll(regex);
|
|
@@ -4708,7 +4706,11 @@ function useDev({
|
|
|
4708
4706
|
__PROJECT_CONFIG__: JSON.stringify(config)
|
|
4709
4707
|
},
|
|
4710
4708
|
plugins: [
|
|
4711
|
-
bundleDependenciesPlugin(
|
|
4709
|
+
bundleDependenciesPlugin(
|
|
4710
|
+
"workerFacade",
|
|
4711
|
+
(config.dependenciesToBundle ?? []).concat([/^@trigger.dev/]),
|
|
4712
|
+
config.tsconfigPath
|
|
4713
|
+
),
|
|
4712
4714
|
workerSetupImportConfigPlugin(configPath),
|
|
4713
4715
|
{
|
|
4714
4716
|
name: "trigger.dev v3",
|
|
@@ -4901,8 +4903,11 @@ function WebsocketFactory(apiKey) {
|
|
|
4901
4903
|
}
|
|
4902
4904
|
async function gatherRequiredDependencies2(outputMeta, config) {
|
|
4903
4905
|
const dependencies2 = {};
|
|
4906
|
+
logger.debug("Gathering required dependencies from imports", {
|
|
4907
|
+
imports: outputMeta.imports
|
|
4908
|
+
});
|
|
4904
4909
|
for (const file of outputMeta.imports) {
|
|
4905
|
-
if (file.kind !== "require-call" || !file.external) {
|
|
4910
|
+
if (file.kind !== "require-call" && file.kind !== "dynamic-import" || !file.external) {
|
|
4906
4911
|
continue;
|
|
4907
4912
|
}
|
|
4908
4913
|
const packageName = detectPackageNameFromImportPath(file.path);
|