Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .changeset/v1-tsdown-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@cloudflare/vite-plugin": patch
---

Update the plugin build and bundle shared declaration dependencies

Use tsdown 0.22.14 for the plugin and retained remote bindings package, and keep shared SDK types bundled in the published plugin declarations. Validate the declarations from a consumer project without workspace development dependencies.
Comment thread
edmundhung marked this conversation as resolved.
Resolved
3 changes: 3 additions & 0 deletions .github/workflows/test-and-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- run: pnpm check
env:
NODE_OPTIONS: --max_old_space_size=8192
# The repository check above builds the plugin before this check runs.
- name: Check Vite plugin build output
run: node -r esbuild-register tools/test/check-built-entry-points.ts vite-plugin-cloudflare
test:
name: Tests (${{ matrix.description }}, ${{ matrix.suite }})
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/ws": "^8.5.13",
"capnweb": "catalog:default",
"esbuild": "catalog:default",
"tsdown": "0.16.3",
"tsdown": "catalog:default",
"typescript": "catalog:default",
"vitest": "catalog:default"
}
Expand Down
16 changes: 9 additions & 7 deletions packages/remote-bindings/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ export default defineConfig({
outDir: "dist",
dts: true,
tsconfig: "tsconfig.json",
external: (id) => {
const unprefixedId = id.charCodeAt(0) === 0 ? id.slice(1) : id;
return (
!unprefixedId.startsWith("worker:") &&
!unprefixedId.startsWith(".") &&
!path.isAbsolute(unprefixedId)
);
deps: {
neverBundle: (id) => {
const unprefixedId = id.charCodeAt(0) === 0 ? id.slice(1) : id;
return (
!unprefixedId.startsWith("worker:") &&
!unprefixedId.startsWith(".") &&
!path.isAbsolute(unprefixedId)
);
},
},
plugins: [embedWorkersPlugin()],
});
2 changes: 1 addition & 1 deletion packages/vite-plugin-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"semver": "7.8.5",
"tinyglobby": "0.2.16",
"tree-kill": "1.2.2",
"tsdown": "0.16.3",
"tsdown": "catalog:default",
"typescript": "5.8.3",
"vite": "catalog:default",
"vite-legacy": "npm:vite@7.1.12",
Expand Down
15 changes: 13 additions & 2 deletions packages/vite-plugin-cloudflare/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ export default defineConfig([
sourcemap,
outDir: "dist",
tsconfig: "tsconfig.plugin.json",
deps: {
dts: {
alwaysBundle: [
/^@cloudflare\/(?!workers-types(?:\/|$))/,
/^cloudflare(?:\/.*)?$/,
"jsonc-parser",
"zod",
],
},
},
dts: {
resolver: "tsc",
sourcemap,
compilerOptions: {
// workaround for https://github.com/rolldown/tsdown/issues/345
Expand All @@ -34,7 +45,7 @@ export default defineConfig([
"module-runner": "vite/module-runner",
"module-runner-legacy": "vite-legacy/module-runner",
},
external: ["cloudflare:workers", "vite/module-runner"],
deps: { neverBundle: ["cloudflare:workers", "vite/module-runner"] },
}),
worker("vite-proxy-worker"),
]);
Expand All @@ -54,7 +65,7 @@ function worker(name: string, options: UserConfig = {}): UserConfig {
},
},
dts: false,
external: ["cloudflare:workers"],
deps: { neverBundle: ["cloudflare:workers"] },
tsconfig: "tsconfig.worker.json",
ignoreWatch,
...options,
Expand Down
13 changes: 13 additions & 0 deletions patches/rolldown-plugin-dts@0.27.14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/dist/index.mjs b/dist/index.mjs
index 56fe487103a0cbb35b2657f184368111bc214ca9..6979fcde77321f656b13c1f1c698014d2fc1b658 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1023,7 +1023,7 @@ function isReferenceId(node) {
return is.oneOf(node, ["Identifier", "MemberExpression"]);
}
function isHelperImport(node) {
- return node.type === "ImportDeclaration" && node.specifiers.length && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport"].includes(spec.local.name));
+ return node.type === "ImportDeclaration" && node.specifiers.length && node.specifiers.every((spec) => spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && ["__exportAll", "__reExport", "__name"].includes(spec.local.name));
}
/**
* patch `.d.ts` suffix in import source to `.js`
Loading
Loading