Skip to content

Commit

Permalink
Merge branch 'main' into carmen/wrangler-beta-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmenPopoviciu authored Jan 21, 2025
2 parents 9dc6a5d + 6c2e943 commit c17b408
Show file tree
Hide file tree
Showing 344 changed files with 9,873 additions and 649 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-lamps-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Fix Durable Objects transfer migration validation
11 changes: 11 additions & 0 deletions .changeset/c3-frameworks-update-7822.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"create-cloudflare": patch
---

chore: update dependencies of "create-cloudflare" package

The following dependency versions have been updated:

| Dependency | From | To |
| ---------- | ------ | ------ |
| sv | 0.6.11 | 0.6.13 |
11 changes: 11 additions & 0 deletions .changeset/c3-frameworks-update-7823.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"create-cloudflare": patch
---

chore: update dependencies of "create-cloudflare" package

The following dependency versions have been updated:

| Dependency | From | To |
| --------------- | ------ | ------ |
| create-next-app | 15.1.4 | 15.1.5 |
11 changes: 11 additions & 0 deletions .changeset/c3-frameworks-update-7824.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"create-cloudflare": patch
---

chore: update dependencies of "create-cloudflare" package

The following dependency versions have been updated:

| Dependency | From | To |
| --------------- | ------ | ------ |
| @angular/create | 19.0.7 | 19.1.2 |
5 changes: 5 additions & 0 deletions .changeset/chilled-maps-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/vite-plugin": patch
---

Initial beta release of the Cloudflare Vite plugin
5 changes: 0 additions & 5 deletions .changeset/cold-turtles-impress.md

This file was deleted.

7 changes: 7 additions & 0 deletions .changeset/cuddly-radios-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-cloudflare": patch
---

fix: bump `vitest-pool-workers` version range in templates

This resolves [#7815](https://github.com/cloudflare/workers-sdk/issues/7815), where users encountered an error about missing `nodejs_compat` or `nodejs_compat_v2` compatibility flags when running Vitest on a fresh Hello World project created with `create-cloudflare`.
5 changes: 5 additions & 0 deletions .changeset/dry-snakes-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix(wrangler): fix wrangler config schema defaults
5 changes: 5 additions & 0 deletions .changeset/gentle-sloths-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

Support service bindings from Pages projects to Workers in a single `workerd` instance. To try it out, pass multiple `-c` flags to Wrangler: i.e. `wrangler pages dev -c wrangler.toml -c ../other-worker/wrangler.toml`. The first `-c` flag must point to your Pages config file, and the rest should point to Workers that are bound to your Pages project.
8 changes: 8 additions & 0 deletions .changeset/green-mice-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"wrangler": patch
---

Relax the messaging when Wrangler uses redirected configuration

Previously the messaging was rendered as a warning, which implied that the user
had done something wrong. Now it is just a regular info message.
5 changes: 5 additions & 0 deletions .changeset/heavy-parents-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-shared": patch
---

fix: fix analytics not being logged for `asset-worker` in the case of a successful request.
5 changes: 0 additions & 5 deletions .changeset/little-pugs-change.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/old-panthers-brush.md

This file was deleted.

14 changes: 14 additions & 0 deletions .changeset/red-comics-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@cloudflare/unenv-preset": patch
"wrangler": patch
---

chore: update unenv to 2.0.0-rc.0

Pull a couple changes in node:timers

- unjs/unenv#384 fix function bindings in node:timer
- unjs/unenv#385 implement active and \_unrefActive in node:timer

The unenv update also includes #unjs/unenv/381 which implements
`stdout`, `stderr` and `stdin` of `node:process` with `node:tty`
37 changes: 37 additions & 0 deletions .changeset/thick-dots-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
"wrangler": minor
---

add support for assets bindings to `getPlatformProxy`

this change makes sure that that `getPlatformProxy`, when the input configuration
file contains an assets field, correctly returns the appropriate asset binding proxy

example:

```json
// wrangler.json
{
"name": "my-worker",
"assets": {
"directory": "./public/",
"binding": "ASSETS"
},
"vars": {
"MY_VAR": "my-var"
}
}
```

```js
import { getPlatformProxy } from "wrangler";

const { env, dispose } = await getPlatformProxy();

if (env.ASSETS) {
const text = await (await env.ASSETS.fetch("http://0.0.0.0/file.txt")).text();
console.log(text); // logs the content of file.txt
}

await dispose();
```
5 changes: 5 additions & 0 deletions .changeset/twenty-ears-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

improve multi account error message in non-interactive mode
6 changes: 6 additions & 0 deletions .github/workflows/prereleases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
node .github/version-script.js create-cloudflare
node .github/version-script.js workers-shared
node .github/version-script.js unenv-preset
node .github/version-script.js vite-plugin-cloudflare
- name: Build
run: pnpm run build
Expand Down Expand Up @@ -79,6 +80,11 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Publish @cloudflare/vite-plugin@beta to NPM
run: pnpm --filter vite-plugin publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Get Package Version
run: echo "WRANGLER_VERSION=$(npm view wrangler@beta version)" >> $GITHUB_ENV
working-directory: packages/wrangler
7 changes: 6 additions & 1 deletion .github/workflows/test-and-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
filter: ["./packages/*", "./fixtures/*"]
filter:
[
"./packages/*",
"./fixtures/*",
"./packages/vite-plugin-cloudflare/playground",
]
# Things in the tools folder are for running in CI, and so only need to run on linux
include:
- os: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ fixtures/interactive-dev-tests/src/startup-error.ts

# These are generated by the build step
fixtures/pages-redirected-config/build/*
fixtures/redirected-config-worker/build/*
fixtures/redirected-config-worker/build/*

packages/vite-plugin-cloudflare/playground/**/*.d.ts
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,15 @@
"jsx",
"decorators",
"explicitResourceManagement"
],
"overrides": [
{
"files": "packages/vite-plugin-cloudflare/README.md",
"options": {
"useTabs": false,
"trailingComma": "all",
"plugins": []
}
}
]
}
7 changes: 7 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
# Workflows ownership
/packages/workflows-shared/ @cloudflare/workflows @cloudflare/wrangler

# unenv-preset ownership
/packages/unenv-preset/ @cloudflare/workers-frameworks @cloudflare/wrangler

# vite-plugin-cloudflare ownership
/packages/vite-plugin-cloudflare/ @cloudflare/workers-frameworks @cloudflare/wrangler
/packages/workers-tsconfig/ @cloudflare/workers-frameworks @cloudflare/wrangler

# Owners intentionally left blank on these shared directories / files
# to avoid noisy review requests
/.changeset/
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ We use the following guidelines to determine the kind of change for a PR:

### Styleguide

When contributing to Wrangler, please refer to the [`STYLEGUIDE.md file`](https://github.com/STYLEGUIDE.md) file where possible to help maintain consistent patterns throughout Wrangler.
When contributing to Wrangler, please refer to the [`STYLEGUIDE.md file`](STYLEGUIDE.md) file where possible to help maintain consistent patterns throughout Wrangler.

## Releases

Expand Down
1 change: 1 addition & 0 deletions fixtures/get-platform-proxy/public/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is a test text file!
18 changes: 17 additions & 1 deletion fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import path from "path";
import { D1Database, R2Bucket } from "@cloudflare/workers-types";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { getPlatformProxy } from "./shared";
import type { Hyperdrive, KVNamespace } from "@cloudflare/workers-types";
import type {
Fetcher,
Hyperdrive,
KVNamespace,
} from "@cloudflare/workers-types";
import type { Unstable_DevWorker } from "wrangler";

type Env = {
Expand All @@ -15,6 +19,7 @@ type Env = {
MY_BUCKET: R2Bucket;
MY_D1: D1Database;
MY_HYPERDRIVE: Hyperdrive;
ASSETS: Fetcher;
};

const wranglerTomlFilePath = path.join(__dirname, "..", "wrangler.toml");
Expand Down Expand Up @@ -115,6 +120,17 @@ describe("getPlatformProxy - env", () => {
}
});

it("correctly obtains functioning ASSETS bindings", async () => {
const { env, dispose } = await getPlatformProxy<Env>({
configPath: wranglerTomlFilePath,
});
const { ASSETS } = env;
const res = await ASSETS.fetch("https://0.0.0.0/test.txt");
const text = await res.text();
expect(text).toEqual("this is a test text file!\n");
await dispose();
});

it("correctly obtains functioning KV bindings", async () => {
const { env, dispose } = await getPlatformProxy<Env>({
configPath: wranglerTomlFilePath,
Expand Down
6 changes: 6 additions & 0 deletions fixtures/get-platform-proxy/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ MY_VAR = "my-var-value"
MY_VAR_A = "my-var-a"
MY_JSON_VAR = { test = true }

[assets]
directory = "./public"
binding = "ASSETS"
html_handling = "auto-trailing-slash"
not_found_handling = "none"

[[kv_namespaces]]
binding = "MY_KV"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Expand Down
23 changes: 21 additions & 2 deletions packages/create-cloudflare/e2e-tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,24 @@ export type RunnerConfig = {
argv?: string[];
quarantine?: boolean;
timeout?: number;
/**
* Specifies whether to assert the response from the specified route after deployment.
*/
verifyDeploy: null | {
route: string;
expectedText: string;
};
/**
* Specifies whether to run the preview script for the project and assert the response from the specified route.
*/
verifyPreview: null | {
route: string;
expectedText: string;
};
/**
* Specifies whether to run the test script for the project and verify the exit code.
*/
verifyTest?: boolean;
};

export const runC3 = async (
Expand Down Expand Up @@ -372,9 +382,18 @@ export const testProjectDir = (suite: string, test: string) => {
const randomSuffix = crypto.randomBytes(4).toString("hex");
const baseProjectName = `${C3_E2E_PREFIX}${randomSuffix}`;

const getName = () =>
const getName = () => {
// Worker project names cannot be longer than 58 characters
`${baseProjectName}-${test.substring(0, 57 - baseProjectName.length)}`;
const projectName = `${baseProjectName}-${test.substring(0, 57 - baseProjectName.length)}`;

// Project name cannot start/end with a dash
if (projectName.endsWith("-")) {
return projectName.slice(0, -1);
}

return projectName;
};

const getPath = () => path.join(tmpDirPath, getName());
const clean = () => {
try {
Expand Down
Loading

0 comments on commit c17b408

Please sign in to comment.