@astrojs/cloudflare 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ @astrojs/cloudflare:build: cache hit, replaying output f28e120d799f877a
2
+ @astrojs/cloudflare:build: 
3
+ @astrojs/cloudflare:build: > @astrojs/cloudflare@0.2.3 build /home/runner/work/astro/astro/packages/integrations/cloudflare
4
+ @astrojs/cloudflare:build: > astro-scripts build "src/**/*.ts" && tsc
5
+ @astrojs/cloudflare:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @astrojs/cloudflare
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3854](https://github.com/withastro/astro/pull/3854) [`b012ee55`](https://github.com/withastro/astro/commit/b012ee55b107dea0730286263b27d83e530fad5d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - [astro add] Support adapters and third party packages
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3777](https://github.com/withastro/astro/pull/3777) [`976e1f17`](https://github.com/withastro/astro/commit/976e1f175a95ea39f737b8575e4fdf3c3d89e1ee) Thanks [@tony-sull](https://github.com/tony-sull)! - Disables HTTP streaming in Cloudflare Pages deployments
14
+
15
+ ## 0.2.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [#3695](https://github.com/withastro/astro/pull/3695) [`0d667d0e`](https://github.com/withastro/astro/commit/0d667d0e572d76d4c819816ddf51ed14b43e2551) Thanks [@nrgnrg](https://github.com/nrgnrg)! - fix custom 404 pages not rendering
20
+
3
21
  ## 0.2.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -22,3 +22,11 @@ $ pnpm install wrangler --save-dev
22
22
  ```
23
23
 
24
24
  It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`
25
+
26
+ ## Streams
27
+
28
+ Some integrations such as [React](https://github.com/withastro/astro/tree/main/packages/integrations/react) rely on web streams. Currently Cloudflare Pages functions are in beta and don't support the `streams_enable_constructors` feature flag.
29
+
30
+ In order to work around this:
31
+ - install the `"web-streams-polyfill"` package
32
+ - add `import "web-streams-polyfill/es2018";` to the top of the front matter of every page which requires streams, such as server rendering a React component.
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./shim.js";
2
2
  import { App } from "astro/app";
3
3
  function createExports(manifest) {
4
- const app = new App(manifest);
4
+ const app = new App(manifest, false);
5
5
  const fetch = async (request, env) => {
6
6
  const { origin, pathname } = new URL(request.url);
7
7
  if (manifest.assets.has(pathname)) {
@@ -11,6 +11,10 @@ function createExports(manifest) {
11
11
  if (app.match(request)) {
12
12
  return app.render(request);
13
13
  }
14
+ const _404Request = new Request(`${origin}/404`, request);
15
+ if (app.match(_404Request)) {
16
+ return app.render(_404Request);
17
+ }
14
18
  return new Response(null, {
15
19
  status: 404,
16
20
  statusText: "Not found"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/cloudflare",
3
3
  "description": "Deploy your site to cloudflare pages functions",
4
- "version": "0.2.0",
4
+ "version": "0.2.3",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -11,6 +11,9 @@
11
11
  "url": "https://github.com/withastro/astro.git",
12
12
  "directory": "packages/integrations/cloudflare"
13
13
  },
14
+ "keywords": [
15
+ "astro-adapter"
16
+ ],
14
17
  "bugs": "https://github.com/withastro/astro/issues",
15
18
  "homepage": "https://astro.build",
16
19
  "exports": {
@@ -22,8 +25,8 @@
22
25
  "esbuild": "^0.14.42"
23
26
  },
24
27
  "devDependencies": {
25
- "astro": "1.0.0-beta.47",
26
- "astro-scripts": "0.0.4"
28
+ "astro": "1.0.0-beta.65",
29
+ "astro-scripts": "0.0.6"
27
30
  },
28
31
  "scripts": {
29
32
  "build": "astro-scripts build \"src/**/*.ts\" && tsc",
package/src/server.ts CHANGED
@@ -8,7 +8,7 @@ type Env = {
8
8
  };
9
9
 
10
10
  export function createExports(manifest: SSRManifest) {
11
- const app = new App(manifest);
11
+ const app = new App(manifest, false);
12
12
 
13
13
  const fetch = async (request: Request, env: Env) => {
14
14
  const { origin, pathname } = new URL(request.url);
@@ -24,6 +24,11 @@ export function createExports(manifest: SSRManifest) {
24
24
  }
25
25
 
26
26
  // 404
27
+ const _404Request = new Request(`${origin}/404`, request);
28
+ if (app.match(_404Request)) {
29
+ return app.render(_404Request);
30
+ }
31
+
27
32
  return new Response(null, {
28
33
  status: 404,
29
34
  statusText: 'Not found',