Skip to content

Commit

Permalink
Merge branch 'main' into cloudflare-astro-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre committed Jan 7, 2025
2 parents b2f9ef9 + d7e7d5e commit 291fb56
Show file tree
Hide file tree
Showing 77 changed files with 936 additions and 1,276 deletions.
6 changes: 6 additions & 0 deletions .changeset/brown-coats-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/cloudflare': minor
'@astrojs/netlify': minor
---

Stabilizes `astro:env` secrets support
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
"@astrojs/check": "^0.9.4",
"@biomejs/biome": "1.9.4",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.10",
"@types/node": "^22.10.0",
"@changesets/cli": "^2.27.11",
"@types/node": "^22.10.5",
"esbuild": "^0.24.0",
"eslint": "^9.15.0",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-regexp": "^2.7.0",
"only-allow": "^1.2.1",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"turbo": "^2.3.3",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0"
"typescript-eslint": "^8.19.0"
}
}
18 changes: 9 additions & 9 deletions packages/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@
"test": "astro-scripts test \"test/**/*.test.js\""
},
"dependencies": {
"@astrojs/internal-helpers": "0.4.1",
"@astrojs/underscore-redirects": "^0.4.0-alpha.0",
"@cloudflare/workers-types": "^4.20241112.0",
"@astrojs/internal-helpers": "0.4.2",
"@astrojs/underscore-redirects": "^0.5.0",
"@cloudflare/workers-types": "^4.20241230.0",
"esbuild": "^0.24.0",
"estree-walker": "^3.0.3",
"magic-string": "^0.30.14",
"miniflare": "^3.20241106.1",
"magic-string": "^0.30.17",
"miniflare": "^3.20241218.0",
"tiny-glob": "^0.2.9",
"vite": "^6.0.2",
"wrangler": "^3.91.0"
"vite": "^6.0.7",
"wrangler": "^3.99.0"
},
"peerDependencies": {
"astro": "^5.0.0"
},
"devDependencies": {
"@astrojs/test-utils": "workspace:*",
"astro": "^5.0.6",
"astro": "^5.1.3",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"rollup": "^4.27.4",
"rollup": "^4.29.1",
"strip-ansi": "^7.1.0"
},
"publishConfig": {
Expand Down
1 change: 1 addition & 0 deletions packages/cloudflare/src/entrypoints/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function createExports(manifest: SSRManifest) {
'`passThroughOnException` is currently not available in Cloudflare Pages. See https://developers.cloudflare.com/pages/platform/known-issues/#pages-functions.'
);
},
props: {},
},
},
};
Expand Down
5 changes: 4 additions & 1 deletion packages/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function resolvedRouteToRouteData(

export default function createIntegration(args?: Options): AstroIntegration {
let _config: AstroConfig;
let finalBuildOutput: HookParameters<'astro:config:done'>['buildOutput'];

const cloudflareModulePlugin: PluginOption & CloudflareModulePluginExtra = cloudflareModuleLoader(
args?.cloudflareModules ?? true
Expand Down Expand Up @@ -182,6 +183,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
}

_config = config;
finalBuildOutput = buildOutput;

setAdapter({
name: '@astrojs/cloudflare',
Expand All @@ -201,7 +203,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
message:
'Cloudflare does not support sharp. You can use the `compile` image service to compile images at build time. It will not work for any on-demand rendered images.',
},
envGetSecret: 'experimental',
envGetSecret: 'stable',
},
});
},
Expand Down Expand Up @@ -376,6 +378,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
config: _config,
routeToDynamicTargetMap: new Map(Array.from(redirectRoutes)),
dir,
buildOutput: finalBuildOutput,
});

if (!trueRedirects.empty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
},
"devDependencies": {
"wrangler": "^3.84.0"
"wrangler": "^3.99.0"
}
}
4 changes: 2 additions & 2 deletions packages/cloudflare/test/fixtures/astro-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
},
"devDependencies": {
"wrangler": "^3.84.0"
"wrangler": "^3.99.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
2 changes: 1 addition & 1 deletion packages/cloudflare/test/fixtures/no-output/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
2 changes: 1 addition & 1 deletion packages/cloudflare/test/fixtures/routes-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/cloudflare/test/fixtures/with-solid-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"@astrojs/solid-js": "^5.0.0",
"astro": "^5.0.6",
"@astrojs/solid-js": "^5.0.1",
"astro": "^5.1.3",
"solid-js": "^1.9.3"
}
}
6 changes: 3 additions & 3 deletions packages/cloudflare/test/fixtures/with-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"@astrojs/svelte": "^7.0.1",
"astro": "^5.0.6",
"svelte": "^5.6.0"
"@astrojs/svelte": "^7.0.3",
"astro": "^5.1.3",
"svelte": "^5.16.1"
}
}
4 changes: 2 additions & 2 deletions packages/cloudflare/test/fixtures/with-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"@astrojs/vue": "^5.0.1",
"astro": "^5.0.6",
"@astrojs/vue": "^5.0.4",
"astro": "^5.1.3",
"vue": "^3.5.13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"@astrojs/cloudflare": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
12 changes: 6 additions & 6 deletions packages/netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"test:hosted": "astro-scripts test \"test/hosted/*.test.js\""
},
"dependencies": {
"@astrojs/internal-helpers": "0.4.1",
"@astrojs/underscore-redirects": "^0.4.0-alpha.0",
"@astrojs/internal-helpers": "0.4.2",
"@astrojs/underscore-redirects": "^0.5.0",
"@netlify/functions": "^2.8.0",
"@vercel/nft": "^0.27.6",
"@vercel/nft": "^0.29.0",
"esbuild": "^0.24.0",
"vite": "^6.0.2"
"vite": "^6.0.7"
},
"peerDependencies": {
"astro": "^5.0.0"
Expand All @@ -45,8 +45,8 @@
"@astrojs/test-utils": "workspace:*",
"@netlify/edge-functions": "^2.11.1",
"@netlify/edge-handler-types": "^0.34.1",
"@types/node": "^22.10.0",
"astro": "^5.0.6",
"@types/node": "^22.10.5",
"astro": "^5.1.3",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0",
"execa": "^8.0.1",
Expand Down
8 changes: 5 additions & 3 deletions packages/netlify/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export default function netlifyIntegration(
};
}

async function writeRedirects(routes: IntegrationRouteData[], dir: URL) {
async function writeRedirects(routes: IntegrationRouteData[], dir: URL,buildOutput: HookParameters<'astro:config:done'>['buildOutput']) {
const fallback = finalBuildOutput === 'static' ? '/.netlify/static' : '/.netlify/functions/ssr';
const redirects = createRedirectsFromAstroRoutes({
config: _config,
Expand All @@ -251,6 +251,7 @@ export default function netlifyIntegration(
return [route, fallback];
})
),
buildOutput,
});

if (!redirects.empty()) {
Expand Down Expand Up @@ -510,7 +511,7 @@ export default function netlifyIntegration(
staticOutput: 'stable',
serverOutput: 'stable',
sharpImageService: 'stable',
envGetSecret: 'experimental',
envGetSecret: 'stable',
},
});
},
Expand All @@ -520,7 +521,8 @@ export default function netlifyIntegration(
'astro:build:done': async ({ assets, dir, logger }) => {
await writeRedirects(
routes.map((route) => resolvedRouteToRouteData(assets, route)),
dir
dir,
finalBuildOutput
);
logger.info('Emitted _redirects');

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},
"dependencies": {
"@astrojs/netlify": "workspace:*",
"astro": "^5.0.6"
"astro": "^5.1.3"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
8 changes: 4 additions & 4 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
},
"devDependencies": {
"@astrojs/test-utils": "workspace:*",
"@types/node": "^22.10.0",
"@types/node": "^22.10.5",
"@types/send": "^0.17.4",
"@types/server-destroy": "^1.0.4",
"astro": "^5.0.6",
"astro": "^5.1.3",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0",
"express": "^4.21.1",
"node-mocks-http": "^1.16.1"
"express": "^4.21.2",
"node-mocks-http": "^1.16.2"
},
"publishConfig": {
"provenance": true
Expand Down
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/api-route/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/bad-urls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/encoded/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/headers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
},
"peerDependencies": {
"sharp": "^0.33.5"
Expand Down
4 changes: 2 additions & 2 deletions packages/node/test/fixtures/locals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"astro": "^5.0.6",
"@astrojs/node": "workspace:*"
"@astrojs/node": "workspace:*",
"astro": "^5.1.3"
}
}
Loading

0 comments on commit 291fb56

Please sign in to comment.