Skip to content

Commit 48c61b6

Browse files
authored
Use the date that the plugin is built as the default compatibility date (#13653)
1 parent df9319d commit 48c61b6

11 files changed

Lines changed: 308 additions & 240 deletions

File tree

.changeset/silent-bananas-shop.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@cloudflare/vite-plugin": patch
3+
---
4+
5+
Use the date that the plugin is built as the default compatibility date.
6+
7+
When no compatibility date was set by the user, the plugin was falling back to the current date. This meant that the date could get ahead of the latest date supported by the installed version of workerd. We now populate the default compatibility date when the plugin is built. This means that it is updated with each release but then stays fixed.

packages/vite-plugin-cloudflare/playground/bindings/__tests__/shortcuts.spec.ts

Lines changed: 0 additions & 221 deletions
This file was deleted.

packages/vite-plugin-cloudflare/playground/bindings/wrangler.auxiliary.jsonc

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/vite-plugin-cloudflare/playground/worker-♫/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "worker",
33
"main": "./src/index.ts",
4-
"compatibility_date": "2024-12-30",
4+
// compatibility date omitted to test fallback
55
"services": [
66
{
77
"binding": "TEST_IF_VITE_CRASH_WITH_UNKNOWN_NAMED_ENTRYPOINT",

packages/vite-plugin-cloudflare/src/__tests__/resolve-plugin-config.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,8 @@ describe("resolvePluginConfig - zero-config mode", () => {
553553

554554
expect(result.type).toBe("assets-only");
555555
const assetsOnlyResult = result as AssetsOnlyResolvedConfig;
556-
expect(assetsOnlyResult.config.compatibility_date).toMatch(
557-
/^\d{4}-\d{2}-\d{2}$/
558-
);
556+
// The compatibility date is mocked for the tests
557+
expect(assetsOnlyResult.config.compatibility_date).toBe("2024-01-01");
559558
});
560559

561560
test("should allow config() to add main in zero-config mode", ({

0 commit comments

Comments
 (0)