trigger.dev 3.0.0-beta.50 → 3.0.0-beta.51
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 +139 -17
- package/dist/index.js.map +1 -1
- package/dist/workers/dev/worker-setup.js +1 -1
- package/dist/workers/prod/worker-setup.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -798,7 +798,7 @@ import invariant from "tiny-invariant";
|
|
|
798
798
|
import { z as z4 } from "zod";
|
|
799
799
|
|
|
800
800
|
// package.json
|
|
801
|
-
var version = "3.0.0-beta.
|
|
801
|
+
var version = "3.0.0-beta.51";
|
|
802
802
|
var dependencies = {
|
|
803
803
|
"@anatine/esbuild-decorators": "^0.2.19",
|
|
804
804
|
"@clack/prompts": "^0.7.0",
|
|
@@ -815,7 +815,7 @@ var dependencies = {
|
|
|
815
815
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
816
816
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
817
817
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
818
|
-
"@trigger.dev/core": "workspace:3.0.0-beta.
|
|
818
|
+
"@trigger.dev/core": "workspace:3.0.0-beta.51",
|
|
819
819
|
"@types/degit": "^2.8.3",
|
|
820
820
|
chalk: "^5.2.0",
|
|
821
821
|
chokidar: "^3.5.3",
|
|
@@ -3016,7 +3016,7 @@ function workerSetupImportConfigPlugin(configPath) {
|
|
|
3016
3016
|
}
|
|
3017
3017
|
};
|
|
3018
3018
|
}
|
|
3019
|
-
function bundleDependenciesPlugin(buildIdentifier, dependenciesToBundle, tsconfigPath) {
|
|
3019
|
+
function bundleDependenciesPlugin(buildIdentifier, dependencies2, dependenciesToBundle, tsconfigPath) {
|
|
3020
3020
|
const matchPath = tsconfigPath ? createMatchPath(tsconfigPath) : void 0;
|
|
3021
3021
|
function resolvePath(id) {
|
|
3022
3022
|
if (!matchPath) {
|
|
@@ -3048,6 +3048,9 @@ function bundleDependenciesPlugin(buildIdentifier, dependenciesToBundle, tsconfi
|
|
|
3048
3048
|
return void 0;
|
|
3049
3049
|
}
|
|
3050
3050
|
}
|
|
3051
|
+
if (dependencies2[args.path] && !dependencies2[args.path].external) {
|
|
3052
|
+
return void 0;
|
|
3053
|
+
}
|
|
3051
3054
|
logger.debug(`[${buildIdentifier}] Externalizing ${args.path}`, {
|
|
3052
3055
|
...args
|
|
3053
3056
|
});
|
|
@@ -3447,10 +3450,33 @@ var JavascriptProject = class {
|
|
|
3447
3450
|
});
|
|
3448
3451
|
}
|
|
3449
3452
|
}
|
|
3450
|
-
async
|
|
3453
|
+
async extractDirectDependenciesMeta() {
|
|
3454
|
+
return tracer.startActiveSpan(
|
|
3455
|
+
"JavascriptProject.extractDirectDependenciesMeta",
|
|
3456
|
+
async (span) => {
|
|
3457
|
+
const command = await this.#getCommand();
|
|
3458
|
+
span.setAttributes({
|
|
3459
|
+
packageManager: command.name
|
|
3460
|
+
});
|
|
3461
|
+
try {
|
|
3462
|
+
span.end();
|
|
3463
|
+
return await command.extractDirectDependenciesMeta({
|
|
3464
|
+
cwd: this.projectPath
|
|
3465
|
+
});
|
|
3466
|
+
} catch (error) {
|
|
3467
|
+
recordSpanException4(span, error);
|
|
3468
|
+
span.end();
|
|
3469
|
+
logger.debug(`Failed to resolve internal dependencies using ${command.name}`, {
|
|
3470
|
+
error
|
|
3471
|
+
});
|
|
3472
|
+
throw error;
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
);
|
|
3476
|
+
}
|
|
3477
|
+
async resolveAll(packageNames) {
|
|
3451
3478
|
return tracer.startActiveSpan("JavascriptProject.resolveAll", async (span) => {
|
|
3452
3479
|
const externalPackages = packageNames.filter((packageName) => !isBuiltInModule(packageName));
|
|
3453
|
-
const opts = { allowDev: false, ...options };
|
|
3454
3480
|
const command = await this.#getCommand();
|
|
3455
3481
|
span.setAttributes({
|
|
3456
3482
|
externalPackages,
|
|
@@ -3478,15 +3504,6 @@ var JavascriptProject = class {
|
|
|
3478
3504
|
});
|
|
3479
3505
|
missingPackageVersions[packageName] = packageJsonVersion;
|
|
3480
3506
|
}
|
|
3481
|
-
if (opts.allowDev) {
|
|
3482
|
-
const devPackageJsonVersion = this.packageJson.devDependencies?.[packageName];
|
|
3483
|
-
if (typeof devPackageJsonVersion === "string") {
|
|
3484
|
-
logger.debug(`Resolved ${packageName} version using devDependencies`, {
|
|
3485
|
-
devPackageJsonVersion
|
|
3486
|
-
});
|
|
3487
|
-
missingPackageVersions[packageName] = devPackageJsonVersion;
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
3507
|
}
|
|
3491
3508
|
span.setAttributes({
|
|
3492
3509
|
...flattenAttributes2(missingPackageVersions, "missingPackageVersions"),
|
|
@@ -3596,6 +3613,36 @@ var PNPMCommands = class {
|
|
|
3596
3613
|
}
|
|
3597
3614
|
return results;
|
|
3598
3615
|
}
|
|
3616
|
+
async extractDirectDependenciesMeta(options) {
|
|
3617
|
+
const result = await this.#listDirectDependencies(options);
|
|
3618
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3619
|
+
const results = {};
|
|
3620
|
+
for (const projectPkg of result) {
|
|
3621
|
+
results[projectPkg.name] = { version: projectPkg.version, external: false };
|
|
3622
|
+
if (projectPkg.dependencies) {
|
|
3623
|
+
for (const [name, dep] of Object.entries(projectPkg.dependencies)) {
|
|
3624
|
+
const { version: version2 } = dep;
|
|
3625
|
+
results[name] = {
|
|
3626
|
+
version: version2,
|
|
3627
|
+
external: !version2.startsWith("link:")
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
return results;
|
|
3633
|
+
}
|
|
3634
|
+
async #listDirectDependencies(options) {
|
|
3635
|
+
const childProcess2 = await $({
|
|
3636
|
+
cwd: options.cwd,
|
|
3637
|
+
reject: false
|
|
3638
|
+
})`${this.cmd} list --recursive --json`;
|
|
3639
|
+
if (childProcess2.failed) {
|
|
3640
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3641
|
+
error: childProcess2
|
|
3642
|
+
});
|
|
3643
|
+
}
|
|
3644
|
+
return JSON.parse(childProcess2.stdout);
|
|
3645
|
+
}
|
|
3599
3646
|
async #listDependencies(packageNames, options) {
|
|
3600
3647
|
const childProcess2 = await $({
|
|
3601
3648
|
cwd: options.cwd,
|
|
@@ -3603,7 +3650,7 @@ var PNPMCommands = class {
|
|
|
3603
3650
|
})`${this.cmd} list ${packageNames} -r --json`;
|
|
3604
3651
|
if (childProcess2.failed) {
|
|
3605
3652
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3606
|
-
error: childProcess2
|
|
3653
|
+
error: childProcess2
|
|
3607
3654
|
});
|
|
3608
3655
|
}
|
|
3609
3656
|
return JSON.parse(childProcess2.stdout);
|
|
@@ -3638,6 +3685,23 @@ var NPMCommands = class {
|
|
|
3638
3685
|
}
|
|
3639
3686
|
return results;
|
|
3640
3687
|
}
|
|
3688
|
+
async extractDirectDependenciesMeta(options) {
|
|
3689
|
+
const result = await this.#listDirectDependencies(options);
|
|
3690
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3691
|
+
return result.dependencies ? this.#flattenDependenciesMeta(result.dependencies) : {};
|
|
3692
|
+
}
|
|
3693
|
+
async #listDirectDependencies(options) {
|
|
3694
|
+
const childProcess2 = await $({
|
|
3695
|
+
cwd: options.cwd,
|
|
3696
|
+
reject: false
|
|
3697
|
+
})`${this.cmd} list --json`;
|
|
3698
|
+
if (childProcess2.failed) {
|
|
3699
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3700
|
+
error: childProcess2
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
return JSON.parse(childProcess2.stdout);
|
|
3704
|
+
}
|
|
3641
3705
|
async #listDependencies(packageNames, options) {
|
|
3642
3706
|
const childProcess2 = await $({
|
|
3643
3707
|
cwd: options.cwd,
|
|
@@ -3645,7 +3709,7 @@ var NPMCommands = class {
|
|
|
3645
3709
|
})`${this.cmd} list ${packageNames} --json`;
|
|
3646
3710
|
if (childProcess2.failed) {
|
|
3647
3711
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3648
|
-
error: childProcess2
|
|
3712
|
+
error: childProcess2
|
|
3649
3713
|
});
|
|
3650
3714
|
}
|
|
3651
3715
|
return JSON.parse(childProcess2.stdout);
|
|
@@ -3663,6 +3727,17 @@ var NPMCommands = class {
|
|
|
3663
3727
|
}
|
|
3664
3728
|
}
|
|
3665
3729
|
}
|
|
3730
|
+
#flattenDependenciesMeta(dependencies2) {
|
|
3731
|
+
let results = {};
|
|
3732
|
+
for (const [name, dep] of Object.entries(dependencies2)) {
|
|
3733
|
+
const { version: version2, resolved, dependencies: children } = dep;
|
|
3734
|
+
results[name] = { version: version2, external: !!resolved && !resolved.startsWith("file:") };
|
|
3735
|
+
if (children) {
|
|
3736
|
+
results = { ...results, ...this.#flattenDependenciesMeta(children) };
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
return results;
|
|
3740
|
+
}
|
|
3666
3741
|
};
|
|
3667
3742
|
var YarnCommands = class {
|
|
3668
3743
|
get name() {
|
|
@@ -3700,6 +3775,30 @@ var YarnCommands = class {
|
|
|
3700
3775
|
}
|
|
3701
3776
|
return results;
|
|
3702
3777
|
}
|
|
3778
|
+
async extractDirectDependenciesMeta(options) {
|
|
3779
|
+
const result = await this.#listDirectDependencies(options);
|
|
3780
|
+
const rawPackagesData = result.split("\n");
|
|
3781
|
+
logger.debug(`Extracting direct dependencies metadata using ${this.name}`);
|
|
3782
|
+
const results = {};
|
|
3783
|
+
for (const rawPackageData of rawPackagesData) {
|
|
3784
|
+
const packageData = JSON.parse(rawPackageData);
|
|
3785
|
+
const [name, dependencyMeta] = this.#parseYarnValueIntoDependencyMeta(packageData.value);
|
|
3786
|
+
results[name] = dependencyMeta;
|
|
3787
|
+
}
|
|
3788
|
+
return results;
|
|
3789
|
+
}
|
|
3790
|
+
async #listDirectDependencies(options) {
|
|
3791
|
+
const childProcess2 = await $({
|
|
3792
|
+
cwd: options.cwd,
|
|
3793
|
+
reject: false
|
|
3794
|
+
})`${this.cmd} info --all --json`;
|
|
3795
|
+
if (childProcess2.failed) {
|
|
3796
|
+
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3797
|
+
error: childProcess2
|
|
3798
|
+
});
|
|
3799
|
+
}
|
|
3800
|
+
return childProcess2.stdout;
|
|
3801
|
+
}
|
|
3703
3802
|
async #listDependencies(packageNames, options) {
|
|
3704
3803
|
const childProcess2 = await $({
|
|
3705
3804
|
cwd: options.cwd,
|
|
@@ -3707,7 +3806,7 @@ var YarnCommands = class {
|
|
|
3707
3806
|
})`${this.cmd} info ${packageNames} --json`;
|
|
3708
3807
|
if (childProcess2.failed) {
|
|
3709
3808
|
logger.debug("Failed to list dependencies, using stdout anyway...", {
|
|
3710
|
-
error: childProcess2
|
|
3809
|
+
error: childProcess2
|
|
3711
3810
|
});
|
|
3712
3811
|
}
|
|
3713
3812
|
return childProcess2.stdout;
|
|
@@ -3723,6 +3822,26 @@ var YarnCommands = class {
|
|
|
3723
3822
|
}
|
|
3724
3823
|
return parts[0];
|
|
3725
3824
|
}
|
|
3825
|
+
#parseYarnValueIntoDependencyMeta(value) {
|
|
3826
|
+
const parts = value.split("@");
|
|
3827
|
+
let name, protocol, version2;
|
|
3828
|
+
if (parts.length === 3) {
|
|
3829
|
+
name = `@${parts[1]}`;
|
|
3830
|
+
[protocol = "", version2 = ""] = parts[2].split(":");
|
|
3831
|
+
} else if (parts.length === 2) {
|
|
3832
|
+
name = parts[0].toString();
|
|
3833
|
+
[protocol = "", version2 = ""] = parts[1].split(":");
|
|
3834
|
+
} else {
|
|
3835
|
+
throw new Error("Failed parsing ${value} into dependency meta");
|
|
3836
|
+
}
|
|
3837
|
+
return [
|
|
3838
|
+
name,
|
|
3839
|
+
{
|
|
3840
|
+
version: version2,
|
|
3841
|
+
external: protocol !== "workspace" && protocol !== "file"
|
|
3842
|
+
}
|
|
3843
|
+
];
|
|
3844
|
+
}
|
|
3726
3845
|
};
|
|
3727
3846
|
function isBuiltInModule(module) {
|
|
3728
3847
|
if (module.startsWith("node:")) {
|
|
@@ -4846,6 +4965,7 @@ async function compileProject(config, options, configPath) {
|
|
|
4846
4965
|
mockServerOnlyPlugin(),
|
|
4847
4966
|
bundleDependenciesPlugin(
|
|
4848
4967
|
"workerFacade",
|
|
4968
|
+
{},
|
|
4849
4969
|
config.dependenciesToBundle,
|
|
4850
4970
|
config.tsconfigPath
|
|
4851
4971
|
),
|
|
@@ -4897,6 +5017,7 @@ async function compileProject(config, options, configPath) {
|
|
|
4897
5017
|
plugins: [
|
|
4898
5018
|
bundleDependenciesPlugin(
|
|
4899
5019
|
"entryPoint.ts",
|
|
5020
|
+
{},
|
|
4900
5021
|
config.dependenciesToBundle,
|
|
4901
5022
|
config.tsconfigPath
|
|
4902
5023
|
)
|
|
@@ -6660,6 +6781,7 @@ function useDev({
|
|
|
6660
6781
|
bundleTriggerDevCore("workerFacade", config.tsconfigPath),
|
|
6661
6782
|
bundleDependenciesPlugin(
|
|
6662
6783
|
"workerFacade",
|
|
6784
|
+
{},
|
|
6663
6785
|
(config.dependenciesToBundle ?? []).concat([/^@trigger.dev/]),
|
|
6664
6786
|
config.tsconfigPath
|
|
6665
6787
|
),
|