trigger.dev 0.0.0-v3-prerelease-20240424101411 → 0.0.0-v3-prerelease-20240425102616

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
@@ -792,15 +792,16 @@ import { execa as execa2 } from "execa";
792
792
  import { createHash } from "node:crypto";
793
793
  import { readFileSync as readFileSync2 } from "node:fs";
794
794
  import { copyFile, mkdir, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
795
- import { dirname, join as join6, relative as relative3, posix } from "node:path";
795
+ import { dirname, join as join6, posix, relative as relative3 } from "node:path";
796
796
  import { setTimeout as setTimeout2 } from "node:timers/promises";
797
797
  import terminalLink2 from "terminal-link";
798
798
  import invariant from "tiny-invariant";
799
799
  import { z as z4 } from "zod";
800
800
 
801
801
  // package.json
802
- var version = "0.0.0-v3-prerelease-20240424101411";
802
+ var version = "0.0.0-v3-prerelease-20240425102616";
803
803
  var dependencies = {
804
+ "@anatine/esbuild-decorators": "^0.2.19",
804
805
  "@clack/prompts": "^0.7.0",
805
806
  "@depot/cli": "0.0.1-cli.2.55.0",
806
807
  "@opentelemetry/api": "^1.8.0",
@@ -815,7 +816,7 @@ var dependencies = {
815
816
  "@opentelemetry/sdk-trace-base": "^1.22.0",
816
817
  "@opentelemetry/sdk-trace-node": "^1.22.0",
817
818
  "@opentelemetry/semantic-conventions": "^1.22.0",
818
- "@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240424101411",
819
+ "@trigger.dev/core": "workspace:0.0.0-v3-prerelease-20240425102616",
819
820
  "@types/degit": "^2.8.3",
820
821
  chalk: "^5.2.0",
821
822
  chokidar: "^3.5.3",
@@ -1596,6 +1597,7 @@ async function getTriggerDirectories(dirPath) {
1596
1597
 
1597
1598
  // src/utilities/configFiles.ts
1598
1599
  import { build } from "esbuild";
1600
+ import { esbuildDecorators } from "@anatine/esbuild-decorators";
1599
1601
  function getGlobalConfigFolderPath() {
1600
1602
  const configDir = mod_esm_default("trigger").config();
1601
1603
  return configDir;
@@ -1701,7 +1703,14 @@ async function readConfig(dir, options) {
1701
1703
  platform: "node",
1702
1704
  target: ["es2018", "node18"],
1703
1705
  outfile: builtConfigFilePath,
1704
- logLevel: "silent"
1706
+ logLevel: "silent",
1707
+ plugins: [
1708
+ esbuildDecorators({
1709
+ cwd: absoluteDir,
1710
+ tsx: false,
1711
+ force: false
1712
+ })
1713
+ ]
1705
1714
  });
1706
1715
  const userConfigModule = await import(builtConfigFileHref);
1707
1716
  const rawConfig = await normalizeConfig(
@@ -1802,14 +1811,18 @@ After installation, run Trigger.dev with \`npx trigger.dev\`.`
1802
1811
  }
1803
1812
  async function printStandloneInitialBanner(performUpdateCheck = true) {
1804
1813
  const cliVersion = getVersion();
1805
- logger.log(`
1806
- ${logo()} ${chalkGrey(`(${cliVersion})`)}
1807
- `);
1808
1814
  if (performUpdateCheck) {
1809
1815
  const maybeNewVersion = await updateCheck();
1810
1816
  if (maybeNewVersion !== void 0) {
1811
- logger.log(`Update available ${chalk3.green(maybeNewVersion)}`);
1817
+ logger.log(`
1818
+ ${logo()} ${chalkGrey(`(${cliVersion} -> ${chalk3.green(maybeNewVersion)})`)}`);
1819
+ } else {
1820
+ logger.log(`
1821
+ ${logo()} ${chalkGrey(`(${cliVersion})`)}`);
1812
1822
  }
1823
+ } else {
1824
+ logger.log(`
1825
+ ${logo()} ${chalkGrey(`(${cliVersion})`)}`);
1813
1826
  }
1814
1827
  logger.log(`${chalkGrey("-".repeat(54))}`);
1815
1828
  }
@@ -2836,6 +2849,7 @@ ${authorizationCodeResult.error}`
2836
2849
  }
2837
2850
 
2838
2851
  // src/commands/deploy.ts
2852
+ import { esbuildDecorators as esbuildDecorators2 } from "@anatine/esbuild-decorators";
2839
2853
  import { Glob } from "glob";
2840
2854
 
2841
2855
  // src/utilities/build.ts
@@ -3168,18 +3182,6 @@ ${chalkError("X Error:")} Failed to start. The following ${zodIssues.length ===
3168
3182
  }
3169
3183
  }
3170
3184
 
3171
- // src/utilities/safeJsonParse.ts
3172
- function safeJsonParse(json) {
3173
- if (!json) {
3174
- return void 0;
3175
- }
3176
- try {
3177
- return JSON.parse(json);
3178
- } catch {
3179
- return void 0;
3180
- }
3181
- }
3182
-
3183
3185
  // src/utilities/javascriptProject.ts
3184
3186
  import { $ } from "execa";
3185
3187
  import { join as join4 } from "node:path";
@@ -3451,6 +3453,18 @@ function cliRootPath() {
3451
3453
  return __dirname2;
3452
3454
  }
3453
3455
 
3456
+ // src/utilities/safeJsonParse.ts
3457
+ function safeJsonParse(json) {
3458
+ if (!json) {
3459
+ return void 0;
3460
+ }
3461
+ try {
3462
+ return JSON.parse(json);
3463
+ } catch {
3464
+ return void 0;
3465
+ }
3466
+ }
3467
+
3454
3468
  // src/commands/update.ts
3455
3469
  import { confirm, intro as intro3, isCancel, log as log4, outro as outro4 } from "@clack/prompts";
3456
3470
  import { join as join5, resolve as resolve2 } from "path";
@@ -3475,6 +3489,7 @@ async function updateCommand(dir, options) {
3475
3489
  await updateTriggerPackages(dir, options);
3476
3490
  }
3477
3491
  async function updateTriggerPackages(dir, options, embedded, requireUpdate) {
3492
+ let hasOutput = false;
3478
3493
  if (!embedded) {
3479
3494
  intro3("Updating packages");
3480
3495
  }
@@ -3482,7 +3497,7 @@ async function updateTriggerPackages(dir, options, embedded, requireUpdate) {
3482
3497
  const { packageJson, readonlyPackageJson, packageJsonPath } = await getPackageJson(projectPath);
3483
3498
  if (!packageJson) {
3484
3499
  log4.error("Failed to load package.json. Try to re-run with `-l debug` to see what's going on.");
3485
- return;
3500
+ return false;
3486
3501
  }
3487
3502
  const cliVersion = getVersion();
3488
3503
  const newCliVersion = await updateCheck();
@@ -3493,6 +3508,7 @@ async function updateTriggerPackages(dir, options, embedded, requireUpdate) {
3493
3508
  Latest: ${newCliVersion}`,
3494
3509
  "Run latest: npx trigger.dev@beta"
3495
3510
  );
3511
+ hasOutput = true;
3496
3512
  }
3497
3513
  const triggerDependencies = getTriggerDependencies(packageJson);
3498
3514
  function getVersionMismatches(deps, targetVersion) {
@@ -3509,8 +3525,9 @@ Latest: ${newCliVersion}`,
3509
3525
  if (versionMismatches.length === 0) {
3510
3526
  if (!embedded) {
3511
3527
  outro4(`Nothing to do${newCliVersion ? " ..but you should really update your CLI!" : ""}`);
3528
+ return hasOutput;
3512
3529
  }
3513
- return;
3530
+ return hasOutput;
3514
3531
  }
3515
3532
  prettyWarning(
3516
3533
  "Mismatch between your CLI version and installed packages",
@@ -3520,15 +3537,15 @@ Latest: ${newCliVersion}`,
3520
3537
  outro4("Deploy failed");
3521
3538
  console.log(
3522
3539
  `ERROR: Version mismatch detected while running in CI. This won't end well. Aborting.
3523
-
3524
- Please run the dev command locally and check that your CLI version matches the one printed below. Additionally, all \`@trigger.dev/*\` packages also need to match this version.
3525
-
3526
- If your local CLI version doesn't match the one below, you may want to add the \`trigger.dev\` package to your dependencies. You will also have to update your workflow deploy command to \`npx trigger.dev deploy\` to ensure your pinned CLI version is used.
3527
-
3528
- CLI version: ${cliVersion}
3529
-
3530
- Current package versions that don't match the CLI:
3531
- ${versionMismatches.map((dep) => `- ${dep.name}@${dep.version}`).join("\n")}
3540
+
3541
+ Please run the dev command locally and check that your CLI version matches the one printed below. Additionally, all \`@trigger.dev/*\` packages also need to match this version.
3542
+
3543
+ If your local CLI version doesn't match the one below, you may want to pin the CLI version in this CI step. To do that, just replace \`trigger.dev@beta\` with \`trigger.dev@<FULL_VERSION>\`, for example: \`npx trigger.dev@3.0.0-beta.17 deploy\`
3544
+
3545
+ CLI version: ${cliVersion}
3546
+
3547
+ Current package versions that don't match the CLI:
3548
+ ${versionMismatches.map((dep) => `- ${dep.name}@${dep.version}`).join("\n")}
3532
3549
  `
3533
3550
  );
3534
3551
  process.exit(1);
@@ -3552,7 +3569,7 @@ ${versionMismatches.map((dep) => `- ${dep.name}@${dep.version}`).join("\n")}
3552
3569
  if (!embedded) {
3553
3570
  outro4("You've been warned!");
3554
3571
  }
3555
- return;
3572
+ return hasOutput;
3556
3573
  }
3557
3574
  const installSpinner = spinner();
3558
3575
  installSpinner.start("Writing new package.json file");
@@ -3593,6 +3610,7 @@ ${versionMismatches.map((dep) => `- ${dep.name}@${dep.version}`).join("\n")}
3593
3610
  `Packages updated${newCliVersion ? " ..but you should really update your CLI too!" : ""}`
3594
3611
  );
3595
3612
  }
3613
+ return hasOutput;
3596
3614
  }
3597
3615
  function getTriggerDependencies(packageJson) {
3598
3616
  const deps = [];
@@ -4422,7 +4440,12 @@ async function compileProject(config, options, configPath) {
4422
4440
  config.dependenciesToBundle,
4423
4441
  config.tsconfigPath
4424
4442
  ),
4425
- workerSetupImportConfigPlugin(configPath)
4443
+ workerSetupImportConfigPlugin(configPath),
4444
+ esbuildDecorators2({
4445
+ tsconfig: config.tsconfigPath,
4446
+ tsx: true,
4447
+ force: false
4448
+ })
4426
4449
  ]
4427
4450
  });
4428
4451
  if (result.errors.length > 0) {
@@ -5484,6 +5507,7 @@ function runtimeCheck(minimumMajor, minimumMinor) {
5484
5507
 
5485
5508
  // src/commands/dev.tsx
5486
5509
  import { findUp as findUp3, pathExists as pathExists2 } from "find-up";
5510
+ import { esbuildDecorators as esbuildDecorators3 } from "@anatine/esbuild-decorators";
5487
5511
  var apiClient;
5488
5512
  var DevCommandOptions = CommonCommandOptions.extend({
5489
5513
  debugger: z5.boolean().default(false),
@@ -5539,11 +5563,11 @@ async function startDev(dir, options, authorization, dashboardUrl) {
5539
5563
  logger.loggerLevel = options.logLevel;
5540
5564
  }
5541
5565
  await printStandloneInitialBanner(true);
5566
+ let displayedUpdateMessage = false;
5542
5567
  if (!options.skipUpdateCheck) {
5543
- console.log();
5544
- await updateTriggerPackages(dir, { ...options }, false, true);
5568
+ displayedUpdateMessage = await updateTriggerPackages(dir, { ...options }, true, true);
5545
5569
  }
5546
- printDevBanner(!options.skipUpdateCheck);
5570
+ printDevBanner(displayedUpdateMessage);
5547
5571
  logger.debug("Starting dev session", { dir, options, authorization });
5548
5572
  let config = await readConfig(dir, {
5549
5573
  projectRef: options.projectRef,
@@ -5762,6 +5786,11 @@ function useDev({
5762
5786
  config.tsconfigPath
5763
5787
  ),
5764
5788
  workerSetupImportConfigPlugin(configPath),
5789
+ esbuildDecorators3({
5790
+ tsconfig: config.tsconfigPath,
5791
+ tsx: true,
5792
+ force: false
5793
+ }),
5765
5794
  {
5766
5795
  name: "trigger.dev v3",
5767
5796
  setup(build3) {