@astrojs/cloudflare 4.1.1 → 6.0.0-beta.0

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.
@@ -1,5 +1,5 @@
1
- @astrojs/cloudflare:build: cache hit, replaying output dd5d4ee36edb0254
2
- @astrojs/cloudflare:build: 
3
- @astrojs/cloudflare:build: > @astrojs/cloudflare@4.1.1 build /home/runner/work/astro/astro/packages/integrations/cloudflare
4
- @astrojs/cloudflare:build: > astro-scripts build "src/**/*.ts" && tsc
5
- @astrojs/cloudflare:build: 
1
+ @astrojs/cloudflare:build: cache hit, replaying output 10df366120dbb5b2
2
+ @astrojs/cloudflare:build: 
3
+ @astrojs/cloudflare:build: > @astrojs/cloudflare@6.0.0-beta.0 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
+ ## 6.0.0-beta.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#5707](https://github.com/withastro/astro/pull/5707) [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b) Thanks [@bluwy](https://github.com/bluwy)! - Remove `astro:build:start` backwards compatibility code
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144), [`8fb28648f`](https://github.com/withastro/astro/commit/8fb28648f66629741cb976bfe34ccd9d8f55661e), [`dd56c1941`](https://github.com/withastro/astro/commit/dd56c19411b126439b8bc42d681b6fa8c06e8c61), [`f6cf92b48`](https://github.com/withastro/astro/commit/f6cf92b48317a19a3840ad781b77d6d3cae143bb), [`16c7d0bfd`](https://github.com/withastro/astro/commit/16c7d0bfd49d2b9bfae45385f506bcd642f9444a), [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b), [`5eba34fcc`](https://github.com/withastro/astro/commit/5eba34fcc663def20bdf6e0daad02a6a5472776b)]:
12
+ - astro@2.0.0-beta.0
13
+
14
+ ## 5.0.0
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`d85ec7484`](https://github.com/withastro/astro/commit/d85ec7484ce14a4c7d3f480da8f38fcb9aff388f), [`d2960984c`](https://github.com/withastro/astro/commit/d2960984c59af7b60a3ea472c6c58fb00534a8e6), [`31ec84797`](https://github.com/withastro/astro/commit/31ec8479721a1cd65538ec041458c5ffe8f50ee9), [`5ec0f6ed5`](https://github.com/withastro/astro/commit/5ec0f6ed55b0a14a9663a90a03428345baf126bd), [`dced4a8a2`](https://github.com/withastro/astro/commit/dced4a8a2657887ec569860d9862d20f695dc23a), [`6b156dd3b`](https://github.com/withastro/astro/commit/6b156dd3b467884839a571c53114aadf26fa4b0b)]:
19
+ - astro@1.7.0
20
+
3
21
  ## 4.1.1
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -81,19 +81,9 @@ getRuntime(Astro.request);
81
81
 
82
82
  Depending on your adapter mode (advanced = worker, directory = pages), the runtime object will look a little different due to differences in the Cloudflare API.
83
83
 
84
- ## Streams
85
-
86
- Some integrations such as [React](https://github.com/withastro/astro/tree/main/packages/integrations/react) rely on web streams. Currently Cloudflare Pages Functions require enabling a flag to support Streams.
87
-
88
- To do this:
89
- - go to the Cloudflare Pages project
90
- - click on Settings in the top bar, then Functions in the sidebar
91
- - scroll down to Compatibility Flags, click Configure Production Compatibility Flags, and add `streams_enable_constructors`
92
- - do this for both the Production Compatibility Flags and Preview Compatibility Flags
93
-
94
84
  ## Environment Variables
95
85
 
96
- As Cloudflare Pages Functions [provides environment variables per request](https://developers.cloudflare.com/pages/platform/functions/#adding-environment-variables-locally), you can only access private environment variables when a request has happened. Usually, this means moving environment variable access inside a function.
86
+ See Cloudflare's documentation for [working with environment variables](https://developers.cloudflare.com/pages/platform/functions/bindings/#environment-variables).
97
87
 
98
88
  ```js
99
89
  // pages/[id].json.js
package/dist/index.js CHANGED
@@ -22,13 +22,11 @@ const SERVER_BUILD_FOLDER = "/$server_build/";
22
22
  function createIntegration(args) {
23
23
  let _config;
24
24
  let _buildConfig;
25
- let needsBuildConfig = false;
26
25
  const isModeDirectory = (args == null ? void 0 : args.mode) === "directory";
27
26
  return {
28
27
  name: "@astrojs/cloudflare",
29
28
  hooks: {
30
29
  "astro:config:setup": ({ config, updateConfig }) => {
31
- needsBuildConfig = !config.build.client;
32
30
  updateConfig({
33
31
  build: {
34
32
  client: new URL(`.${config.base}`, config.outDir),
@@ -68,13 +66,6 @@ function createIntegration(args) {
68
66
  vite.ssr.target = vite.ssr.target || "webworker";
69
67
  }
70
68
  },
71
- "astro:build:start": ({ buildConfig }) => {
72
- if (needsBuildConfig) {
73
- buildConfig.client = new URL(`.${_config.base}`, _config.outDir);
74
- buildConfig.server = new URL(`.${SERVER_BUILD_FOLDER}`, _config.outDir);
75
- buildConfig.serverEntry = "_worker.js";
76
- }
77
- },
78
69
  "astro:build:done": async () => {
79
70
  const entryPath = fileURLToPath(new URL(_buildConfig.serverEntry, _buildConfig.server)), entryUrl = new URL(_buildConfig.serverEntry, _config.outDir), buildPath = fileURLToPath(entryUrl);
80
71
  await esbuild.build({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/cloudflare",
3
3
  "description": "Deploy your site to cloudflare workers or cloudflare pages",
4
- "version": "4.1.1",
4
+ "version": "6.0.0-beta.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -32,10 +32,10 @@
32
32
  "tiny-glob": "^0.2.9"
33
33
  },
34
34
  "peerDependencies": {
35
- "astro": "^1.6.14"
35
+ "astro": "^2.0.0-beta.0"
36
36
  },
37
37
  "devDependencies": {
38
- "astro": "1.6.14",
38
+ "astro": "2.0.0-beta.0",
39
39
  "astro-scripts": "0.0.9",
40
40
  "chai": "^4.3.6",
41
41
  "cheerio": "^1.0.0-rc.11",
package/src/index.ts CHANGED
@@ -39,14 +39,12 @@ const SERVER_BUILD_FOLDER = '/$server_build/';
39
39
  export default function createIntegration(args?: Options): AstroIntegration {
40
40
  let _config: AstroConfig;
41
41
  let _buildConfig: BuildConfig;
42
- let needsBuildConfig = false;
43
42
  const isModeDirectory = args?.mode === 'directory';
44
43
 
45
44
  return {
46
45
  name: '@astrojs/cloudflare',
47
46
  hooks: {
48
47
  'astro:config:setup': ({ config, updateConfig }) => {
49
- needsBuildConfig = !config.build.client;
50
48
  updateConfig({
51
49
  build: {
52
50
  client: new URL(`.${config.base}`, config.outDir),
@@ -90,14 +88,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
90
88
  vite.ssr.target = vite.ssr.target || 'webworker';
91
89
  }
92
90
  },
93
- 'astro:build:start': ({ buildConfig }) => {
94
- // Backwards compat
95
- if (needsBuildConfig) {
96
- buildConfig.client = new URL(`.${_config.base}`, _config.outDir);
97
- buildConfig.server = new URL(`.${SERVER_BUILD_FOLDER}`, _config.outDir);
98
- buildConfig.serverEntry = '_worker.js';
99
- }
100
- },
101
91
  'astro:build:done': async () => {
102
92
  const entryPath = fileURLToPath(new URL(_buildConfig.serverEntry, _buildConfig.server)),
103
93
  entryUrl = new URL(_buildConfig.serverEntry, _config.outDir),