Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/webapp/app/utils/searchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function createSearchParams<TParams extends ParamType>(
return { success: true, params: new SearchParams<TParams>(parsed.params as TParams, schema) };
}

function parseSearchParams<TParams extends ParamType>(params: TParams, schema: ZodType<TParams>) {
function parseSearchParams<TParams>(params: unknown, schema: ZodType<TParams>) {
const parsedParams = schema.safeParse(params);

if (!parsedParams.success) {
Expand Down
2 changes: 2 additions & 0 deletions apps/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@
"tailwindcss": "^4.3.1",
"tsconfig-paths": "^3.14.1",
"tsx": "^4.20.6",
"typescript": "catalog:",
"typescript-legacy-api": "npm:typescript@6.0.3",
"vite-tsconfig-paths": "^5.1.4",
"vite": "^6.4.2"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/scripts/runOpsLegacyGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* pnpm --filter webapp run guard:runops-legacy # regenerate baseline
* pnpm --filter webapp run guard:runops-legacy -- --check # CI gate
*/
import ts from "typescript";
import ts from "typescript-legacy-api";
import * as fs from "node:fs";
import * as path from "node:path";

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"pkg-pr-new": "0.0.75",
"pkg-types": "1.1.3",
"tsx": "^3.7.1",
"turbo": "^1.10.3",
"turbo": "^1.13.4",
"typescript": "catalog:",
"vite-tsconfig-paths": "^4.0.5",
"vitest": "4.1.7"
Expand All @@ -90,11 +90,9 @@
"antlr4ts@0.5.0-alpha.4": "patches/antlr4ts@0.5.0-alpha.4.patch",
"@window-splitter/state@1.1.3": "patches/@window-splitter__state@1.1.3.patch",
"streamdown@2.5.0": "patches/streamdown@2.5.0.patch",
"tsup@8.4.0": "patches/tsup@8.4.0.patch",
"@remix-run/router@1.23.3": "patches/@remix-run__router@1.23.3.patch"
},
"overrides": {
"typescript": "catalog:",
"@types/node": "24.13.3",
"react@^18": "18.3.1",
"react-dom@^18": "18.3.1",
Expand Down
8 changes: 5 additions & 3 deletions packages/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@
"pkg-types": "^1.1.3",
"resolve": "^1.22.8",
"tinyglobby": "^0.2.2",
"tsconfck": "3.1.3"
"tsconfck": "3.1.3",
"typescript-legacy-api": "npm:typescript@6.0.3"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.5",
"@types/resolve": "^1.20.6",
"esbuild": "^0.23.0",
"rimraf": "6.0.1",
"tshy": "^3.0.2",
"tsx": "4.17.0"
"tshy": "^4.1.3",
"tsx": "4.17.0",
"typescript": "catalog:"
},
"engines": {
"node": ">=18.20.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/extensions/typescript.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BuildExtension } from "@trigger.dev/core/v3/build";
import { readFile } from "node:fs/promises";
import typescriptPkg from "typescript";
import typescriptPkg from "typescript-legacy-api";

const { transpileModule, ModuleKind } = typescriptPkg;

Expand Down
2 changes: 1 addition & 1 deletion packages/cli-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"find-up": "^7.0.0",
"rimraf": "^6.0.1",
"ts-essentials": "10.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"tsx": "4.17.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
"rimraf": "^6.0.1",
"superjson": "^2.2.1",
"ts-essentials": "10.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"tsx": "4.17.0"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
},
"scripts": {
"clean": "rimraf dist .turbo",
"build": "tsup",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "^24.13.3",
"rimraf": "6.0.1",
"tsup": "^8.4.0",
"tsdown": "0.22.10",
"typescript": "catalog:"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineConfig } from "tsup";
import { defineConfig } from "tsdown";

export default defineConfig({
entry: ["src/index.ts"],
format: ["cjs", "esm"],
fixedExtension: false,
dts: true,
splitting: false,
sourcemap: true,
clean: true,
treeshake: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"devDependencies": {
"@types/node": "^24.13.3",
"rimraf": "6.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"typescript": "catalog:",
"tsx": "4.17.0",
"esbuild": "^0.23.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/react": "*",
"@types/react-dom": "*",
"rimraf": "^6.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"tsx": "4.17.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/redis-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
],
"scripts": {
"clean": "rimraf dist .turbo",
"build": "tsup",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"typecheck": "tsc --noEmit -p tsconfig.src.json",
"test": "vitest --sequence.concurrent=false --no-file-parallelism"
},
Expand All @@ -38,7 +38,7 @@
"@types/lodash.omit": "^4.5.7",
"@types/seedrandom": "^3.0.8",
"rimraf": "6.0.1",
"tsup": "^8.4.0",
"tsdown": "0.22.10",
"tsx": "4.17.0"
},
"engines": {
Expand Down
48 changes: 48 additions & 0 deletions packages/redis-worker/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { defineConfig } from "tsdown";

export default defineConfig({
entry: ["src/index.ts"],
format: ["cjs", "esm"],
fixedExtension: false,
tsconfig: "tsconfig.src.json",
dts: true,
sourcemap: true,
clean: true,
treeshake: true,
minify: false,
deps: {
onlyBundle: false,
alwaysBundle: [
// Always bundle internal packages
/^@internal/,
// Always bundle ESM-only packages
"nanoid",
"p-limit",
],
dts: {
// The TypeScript 7 declaration emitter consumes referenced package declarations.
neverBundle: [/^@internal/],
},
Comment on lines +22 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 redis-worker published .d.ts may now reference private @internal packages

The old tsup config bundled @internal/* into both the JS output AND the declaration output (noExternal: [/^@internal/] + dts: true, where rollup-plugin-dts inlines those types). The new tsdown config keeps JS bundling (deps.alwaysBundle: [/^@internal/]) but explicitly disables it for declarations (deps.dts.neverBundle: [/^@internal/] at packages/redis-worker/tsdown.config.ts:22-25). The public surface of @trigger.dev/redis-worker leaks @internal/redis types (Redis, RedisOptions in packages/redis-worker/src/worker.ts:1) and @internal/tracing types (Span, Tracer, Meter in packages/redis-worker/src/fair-queue/types.ts:1-3). Since @internal/* are private workspace packages (devDependencies, never published), a published dist/index.d.ts that references them via import("@internal/redis") would be unresolvable for any external npm consumer, regressing type portability that the old build provided. The inline comment indicates this is a deliberate TS7-driven choice, so it may be intentional / acceptable if the package is effectively internal-only — worth confirming whether external consumers rely on these types resolving.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

},
// rolldown injects its own `__require` helper in the ESM output as
// `createRequire(import.meta.url)` with no fallback. When this ESM bundle is
// re-bundled into a CJS consumer (e.g. the webapp server), esbuild replaces
// `import.meta.url` with `undefined`, so `createRequire(undefined)` throws at
// startup. Patch the helper to fall back to a valid path, matching the
// fallback the previous tsup banner provided.
plugins: [
{
name: "resilient-create-require",
renderChunk(code: string) {
if (!code.includes("createRequire(import.meta.url)")) return null;
return {
code: code.replaceAll(
"createRequire(import.meta.url)",
"createRequire(import.meta.url || process.cwd() + '/index.js')"
),
map: null,
};
},
},
],
});
27 changes: 0 additions & 27 deletions packages/redis-worker/tsup.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/rsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/react": "*",
"@types/react-dom": "*",
"rimraf": "^6.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"tsx": "4.17.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema-to-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"arktype": "^2.0.0",
"runtypes": "^6.7.0",
"superstruct": "^2.0.2",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"@sinclair/typebox": "^0.34.3",
"valibot": "^1.1.0",
"yup": "^1.7.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/trigger-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@
"ai-v7": "npm:ai@7.0.0-canary.159",
"encoding": "^0.1.13",
"rimraf": "^6.0.1",
"tshy": "^3.0.2",
"tshy": "^4.1.3",
"tsx": "4.17.0",
"typed-emitter": "^2.1.0",
"typescript": "catalog:",
"zod": "3.25.76"
},
"peerDependencies": {
Expand Down
68 changes: 35 additions & 33 deletions packages/trigger-sdk/test/declaration-emit.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import {
cpSync,
existsSync,
mkdirSync,
mkdtempSync,
readFileSync,
realpathSync,
rmSync,
symlinkSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { dirname, join, resolve } from "node:path";
import { describe, expect, it } from "vitest";
import ts from "typescript";

/**
* Regression test for declaration-emit portability (customer TS2742).
Expand Down Expand Up @@ -76,40 +79,39 @@ describe("declaration emit portability", () => {
}

const fixturePath = join(consumerDir, "agent.ts");
ts.sys.writeFile(fixturePath, FIXTURE_SOURCE);

const emitted = new Map<string, string>();
const host = ts.createCompilerHost({});
host.writeFile = (fileName, text) => emitted.set(fileName, text);

const program = ts.createProgram({
rootNames: [fixturePath],
options: {
target: ts.ScriptTarget.ES2022,
module: ts.ModuleKind.NodeNext,
moduleResolution: ts.ModuleResolutionKind.NodeNext,
strict: true,
declaration: true,
emitDeclarationOnly: true,
skipLibCheck: true,
outDir: join(consumerDir, "out"),
rootDir: consumerDir,
},
host,
});
writeFileSync(fixturePath, FIXTURE_SOURCE);
writeFileSync(
join(consumerDir, "tsconfig.json"),
JSON.stringify({
compilerOptions: {
target: "ES2022",
module: "NodeNext",
moduleResolution: "NodeNext",
strict: true,
declaration: true,
emitDeclarationOnly: true,
skipLibCheck: true,
outDir: "out",
rootDir: ".",
},
files: ["agent.ts"],
})
);

const emitResult = program.emit();
const diagnostics = [
...ts.getPreEmitDiagnostics(program),
...emitResult.diagnostics,
].filter((d) => d.category === ts.DiagnosticCategory.Error);
const formatted = diagnostics.map((d) =>
ts.flattenDiagnosticMessageText(d.messageText, "\n")
const require = createRequire(import.meta.url);
const typescriptRoot = dirname(require.resolve("typescript/package.json"));
const result = spawnSync(
process.execPath,
[join(typescriptRoot, "bin", "tsc"), "-p", consumerDir],
{
encoding: "utf8",
}
);
Comment thread
carderne marked this conversation as resolved.
expect(formatted).toEqual([]);
const compilerOutput = [result.stdout, result.stderr].filter(Boolean).join("\n");
expect(result.error, compilerOutput).toBeUndefined();
expect(result.status, compilerOutput).toBe(0);

const dts = [...emitted.entries()].find(([name]) => name.endsWith("agent.d.ts"))?.[1];
expect(dts).toBeDefined();
const dts = readFileSync(join(consumerDir, "out", "agent.d.ts"), "utf8");
Comment on lines +103 to +114

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 declaration-emit test now shells out to the TS CLI instead of the in-process API

The test was rewritten to write a tsconfig.json and spawn bin/tsc via process.execPath (packages/trigger-sdk/test/declaration-emit.test.ts:103-111) rather than constructing an in-memory ts.Program. This relies on the resolved typescript package (now catalog TS 7.0.2, and newly added to trigger-sdk devDependencies) exposing a node-runnable bin/tsc. If TS7's CLI is delivered as a native binary rather than a JS entry, invoking it through node would fail. The output path mapping (rootDir ., outDir out, files: ["agent.ts"] → reading out/agent.d.ts) is consistent. Worth confirming the TS7 CLI packaging supports node bin/tsc in CI.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

// The payload generic must be named via the public subpath, and the
// emit must not fall back to file paths into the package.
expect(dts).toContain('import("@trigger.dev/sdk/chat").ChatTaskWirePayload');
Expand Down
12 changes: 0 additions & 12 deletions patches/tsup@8.4.0.patch

This file was deleted.

Loading
Loading