Skip to content

Commit

Permalink
Merge branch 'main' into cole/pipe-160-pipelines-cors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 authored Jan 28, 2025
2 parents 7669912 + 12675cc commit 92e74e8
Show file tree
Hide file tree
Showing 148 changed files with 9,020 additions and 5,584 deletions.
6 changes: 0 additions & 6 deletions .changeset/clean-sheep-promise.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/cuddly-wombats-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@cloudflare/workers-shared": minor
"wrangler": minor
---

chore: provides `run_worker_first` for Worker-script-first configuration. Deprecates `experimental_serve_directly`.
5 changes: 5 additions & 0 deletions .changeset/lucky-jeans-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix(wrangler): handling of `process.env.NODE_ENV` in bundling mode
5 changes: 5 additions & 0 deletions .changeset/neat-foxes-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"miniflare": patch
---

Switch to `capnp-es` over `capnp-ts`
7 changes: 0 additions & 7 deletions .changeset/neat-needles-brush.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/nervous-jeans-obey.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/old-bees-design.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/olive-tigers-raise.md

This file was deleted.

10 changes: 10 additions & 0 deletions .changeset/orange-camels-hunt_vite-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@cloudflare/vite-plugin": patch
---

Add full support for `.dev.vars` files.

This change makes sure that `.dev.vars` files work when the environment is specified. It also
copies the target `.dev.vars` file (which might be environment specific, e.g. `.dev.vars.prod`)
to the worker's dist directory so that `vite preview` can pick it up.
The copied file will always be named `.dev.vars`.
9 changes: 9 additions & 0 deletions .changeset/orange-camels-hunt_wrangler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": minor
---

Update the `unstable_getMiniflareWorkerOptions` types to always include an `env` parameter.

The `unstable_getMiniflareWorkerOptions` types, when accepting a config object as the first argument,
didn't accept a second `env` argument. The changes here make sure they do, since the `env` is still
relevant for picking up variables from `.dev.vars` files.
5 changes: 5 additions & 0 deletions .changeset/poor-rabbits-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/unenv-preset": patch
---

Remove clearImmediate and setImmediate injects
8 changes: 0 additions & 8 deletions .changeset/popular-pigs-glow.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/thick-bikes-teach.md

This file was deleted.

10 changes: 3 additions & 7 deletions .github/workflows/test-and-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,11 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
filter:
[
"./packages/*",
"./fixtures/*",
"./packages/vite-plugin-cloudflare/playground",
]
- '--filter="./packages/*" --filter="./fixtures/*" --filter="./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
filter: "./tools"
filter: '--filter="./tools"'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
Expand All @@ -136,7 +132,7 @@ jobs:

- name: Run tests
if: steps.changes.outputs.everything_but_markdown == 'true'
run: pnpm run test:ci --concurrency 1 --filter=${{ matrix.filter }}
run: pnpm run test:ci --concurrency 1 ${{ matrix.filter }}
env:
TMP_CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TMP_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/validate-pr-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@ name: Validate PR Description

on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
types:
[
opened,
synchronize,
reopened,
labeled,
unlabeled,
edited,
ready_for_review,
converted_to_draft,
]

jobs:
check:
# Don't check the Version Packages PR
if: github.head_ref != 'changeset-release/main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-add-pr
Expand Down Expand Up @@ -47,3 +58,4 @@ jobs:
BODY: ${{ github.event.pull_request.body }}
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
FILES: ${{ steps.files.outputs.all }}
DRAFT: ${{ github.event.pull_request.draft }}
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ packages/create-cloudflare/templates*/**/*.*
packages/create-cloudflare/templates*/hello-world/**/worker-configuration.d.ts
packages/chrome-devtools-patches/devtools-frontend

packages/vitest-pool-workers/scripts/rtti/rtti.js

# dist-functions are generated in the fixtures/vitest-pool-workers-examples/pages-functions-unit-integration-self folder
dist-functions

Expand All @@ -45,4 +47,4 @@ fixtures/interactive-dev-tests/src/startup-error.ts
fixtures/pages-redirected-config/build/*
fixtures/redirected-config-worker/build/*

packages/vite-plugin-cloudflare/playground/**/*.d.ts
packages/vite-plugin-cloudflare/playground/**/*.d.ts
3 changes: 2 additions & 1 deletion fixtures/asset-config/html-handling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ describe.each(testSuites)("$title", ({ title, suite }) => {
return {
html_handling,
not_found_handling: "none",
serve_directly: true,
run_worker_first: true,
serve_directly: false,
};
});
});
Expand Down
3 changes: 2 additions & 1 deletion fixtures/asset-config/redirects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ describe("[Asset Worker] `test location rewrite`", () => {
return {
html_handling: "none",
not_found_handling: "none",
serve_directly: true,
run_worker_first: true,
serve_directly: false,
};
});
});
Expand Down
3 changes: 2 additions & 1 deletion fixtures/asset-config/url-normalization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ describe("[Asset Worker] `test slash normalization`", () => {
return {
html_handling: "none",
not_found_handling: "none",
serve_directly: true,
run_worker_first: true,
serve_directly: false,
};
});
});
Expand Down
17 changes: 17 additions & 0 deletions fixtures/workers-with-assets-run-worker-first/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# workers-assets-with-user-worker"

`workers-assets-with-user-worker-run-worker-first"` is a test fixture that showcases Workers with Assets using the run_worker_first option. This particular fixture forces a user Worker to be invoked, even if it otherwise would have matched an assets request.

## dev

To start a dev session you can run

```
wrangler dev
```

## Run tests

```
npm run test
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "workers-assets-with-user-worker-serve-directly",
"name": "workers-assets-with-user-worker-run-worker-first",
"private": true,
"scripts": {
"check:type": "tsc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fetch } from "undici";
import { afterAll, beforeAll, describe, it } from "vitest";
import { runWranglerDev } from "../../shared/src/run-wrangler-long-lived";

describe("[Workers + Assets] serve_directly false", () => {
describe("[Workers + Assets] run_worker_first true", () => {
let ip: string, port: number, stop: (() => Promise<unknown>) | undefined;

beforeAll(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#:schema node_modules/wrangler/config-schema.json

name = "worker-with-assets-serve-directly"
name = "worker-with-assets-run-worker-first"
main = "src/index.ts"
compatibility_date = "2024-01-01"

[assets]
directory = "./public"
binding="ASSETS"
experimental_serve_directly = false
run_worker_first = true
17 changes: 0 additions & 17 deletions fixtures/workers-with-assets-serve-directly/README.md

This file was deleted.

1 change: 1 addition & 0 deletions fixtures/workers-with-assets/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ compatibility_date = "2024-01-01"
[assets]
directory = "./public"
binding="ASSETS"
experimental_serve_directly = true
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
},
"patchedDependencies": {
"@cloudflare/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/create-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dev:codemod": "node -r esbuild-register scripts/codemodDev.ts",
"check:lint": "eslint . --max-warnings=0",
"check:type": "tsc",
"prepublishOnly": "pnpm -w run build",
"prepublishOnly": "pnpm exec turbo build -F create-cloudflare",
"test:e2e": "vitest run --config ./vitest-e2e.config.mts",
"test:e2e:npm": "pnpm run build && cross-env TEST_PM=npm vitest run --config ./vitest-e2e.config.mts",
"test:e2e:pnpm": "pnpm run build && cross-env TEST_PM=pnpm vitest run --config ./vitest-e2e.config.mts",
Expand Down
6 changes: 6 additions & 0 deletions packages/edge-preview-authenticated-proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# edge-preview-authenticated-proxy

## 0.2.3

### Patch Changes

- [#7793](https://github.com/cloudflare/workers-sdk/pull/7793) [`9941219`](https://github.com/cloudflare/workers-sdk/commit/994121908de7b0537c06ed4f6bae6cb35d32521d) Thanks [@edmundhung](https://github.com/edmundhung)! - fix: ensure no body is passed when constructing a GET or HEAD request to the preview worker

## 0.2.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/edge-preview-authenticated-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edge-preview-authenticated-proxy",
"version": "0.2.2",
"version": "0.2.3",
"private": true,
"scripts": {
"check:lint": "eslint . --max-warnings=0",
Expand Down
8 changes: 4 additions & 4 deletions packages/miniflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
],
"scripts": {
"build": "node scripts/build.mjs && pnpm run types:build",
"capnp:workerd": "capnpc -o ts src/runtime/config/workerd.capnp",
"capnp:workerd": "node scripts/build-capnp.mjs",
"check:lint": "eslint --max-warnings=0 \"{src,test}/**/*.ts\" \"scripts/**/*.{js,mjs}\" \"types/**/*.ts\"",
"check:type": "tsc",
"clean": "rimraf ./dist ./dist-types",
Expand All @@ -45,7 +45,6 @@
"@cspotcode/source-map-support": "0.8.1",
"acorn": "^8.8.0",
"acorn-walk": "^8.2.0",
"capnp-ts": "^0.7.0",
"exit-hook": "^2.2.1",
"glob-to-regexp": "^0.4.1",
"stoppable": "^1.1.0",
Expand All @@ -61,7 +60,7 @@
"@cloudflare/workers-shared": "workspace:*",
"@cloudflare/workers-types": "^4.20250121.0",
"@cloudflare/workflows-shared": "workspace:*",
"@microsoft/api-extractor": "^7.47.0",
"@microsoft/api-extractor": "7.49.1",
"@types/debug": "^4.1.7",
"@types/estree": "^1.0.0",
"@types/glob-to-regexp": "^0.4.1",
Expand All @@ -74,7 +73,7 @@
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"ava": "^6.0.1",
"capnpc-ts": "^0.7.0",
"capnp-es": "^0.0.7",
"concurrently": "^8.2.2",
"devalue": "^4.3.0",
"devtools-protocol": "^0.0.1182435",
Expand All @@ -92,6 +91,7 @@
"pretty-bytes": "^6.0.0",
"rimraf": "catalog:default",
"source-map": "^0.6.1",
"typescript": "catalog:default",
"which": "^2.0.2"
},
"engines": {
Expand Down
9 changes: 9 additions & 0 deletions packages/miniflare/scripts/build-capnp.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { execSync } from "node:child_process";
import { copyFileSync } from "node:fs";

execSync("capnp-es node_modules/workerd/workerd.capnp -ots");

copyFileSync(
"node_modules/workerd/workerd.ts",
"src/runtime/config/generated.ts"
);
12 changes: 0 additions & 12 deletions packages/miniflare/scripts/types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,6 @@ function bundleTypes() {

fs.copyFileSync(indexTsPath, indexDtsPath);
try {
fs.copyFileSync(
path.join(pkgRoot, "src", "runtime", "config", "workerd.capnp.d.ts"),
path.join(
pkgRoot,
"dist-types",
"src",
"runtime",
"config",
"workerd.capnp.d.ts"
)
);

const extractorCfg = ExtractorConfig.prepare({
projectFolderLookupToken: pkgRoot,
packageJsonFullPath: path.join(pkgRoot, "package.json"),
Expand Down
Loading

0 comments on commit 92e74e8

Please sign in to comment.