Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/deep-states-talk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'astro': major
---

Updates how schema types are inferred for content loaders with schemas (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/TODO:))
Updates how schema types are inferred for content loaders with schemas (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#changed-schema-types-are-inferred-instead-of-generated-content-loader-api))
2 changes: 1 addition & 1 deletion .changeset/fresh-rocks-sing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'astro': major
---

Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent `createSchema()` property (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/TODO:))
Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent `createSchema()` property (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#removed-schema-function-signature-content-loader-api))
5 changes: 5 additions & 0 deletions .changeset/major-lights-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes the links to Astro Docs to match the v6 structure.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"test:smoke:docs": "turbo run build --filter=docs",
"test:check-examples": "node ./scripts/smoke/check.js",
"test:vite-ci": "cd packages/astro && pnpm run test:unit && pnpm run test:integration",
"test:e2e": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e",
"test:e2e:match": "cd packages/astro && pnpm playwright install chromium firefox && pnpm run test:e2e:match",
"test:e2e": "cd packages/astro && pnpm playwright install firefox && pnpm run test:e2e",
"test:e2e:match": "cd packages/astro && pnpm playwright install firefox && pnpm run test:e2e:match",
"test:e2e:hosts": "turbo run test:hosted",
"benchmark": "astro-benchmark",
"lint": "biome lint && knip && eslint . --report-unused-disable-directives-severity=warn --concurrency=auto",
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,11 @@
- [#14956](https://github.com/withastro/astro/pull/14956) [`0ff51df`](https://github.com/withastro/astro/commit/0ff51dfa3c6c615af54228e159f324034472b1a2) Thanks [@matthewp](https://github.com/matthewp)! - Astro v6.0 upgrades to Zod v4 for schema validation - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#zod-4))
- [#14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Updates how schema types are inferred for content loaders with schemas (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/TODO:))
- [#14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Updates how schema types are inferred for content loaders with schemas (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#changed-schema-types-are-inferred-instead-of-generated-content-loader-api))
- [#14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@ematipico](https://github.com/ematipico)! - Removes support for routes with percent-encoded percent signs (e.g. `%25`) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#removed-percent-encoding-in-routes))
- [#14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent `createSchema()` property (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/TODO:))
- [#14759](https://github.com/withastro/astro/pull/14759) [`d7889f7`](https://github.com/withastro/astro/commit/d7889f768a4d27e8c4ad3a0022099d19145a7d58) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent `createSchema()` property (Loader API) - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#removed-schema-function-signature-content-loader-api))
- [#14306](https://github.com/withastro/astro/pull/14306) [`141c4a2`](https://github.com/withastro/astro/commit/141c4a26419fe5bb4341953ea5a0a861d9b398c0) Thanks [@ematipico](https://github.com/ematipico)! - Removes `RouteData.generate` from the Integration API - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#removed-routedatagenerate-adapter-api))
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/server-islands/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function injectServerIslandRoute(config: ConfigFields, routeManifest: Rou
routeManifest.routes.unshift(getServerIslandRouteData(config));
}

type RenderOptions = {
export type RenderOptions = {
encryptedComponentExport: string;
encryptedProps: string;
encryptedSlots: string;
Expand All @@ -54,7 +54,7 @@ function badRequest(reason: string) {
});
}

async function getRequestData(request: Request): Promise<Response | RenderOptions> {
export async function getRequestData(request: Request): Promise<Response | RenderOptions> {
switch (request.method) {
case 'GET': {
const url = new URL(request.url);
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/types/public/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ export interface AstroUserConfig<
* Enabling this feature adds additional security to Astro's handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types.
*
* This feature comes with some limitations:
* - External scripts and external styles are not supported out of the box, but you can [provide your own hashes](https://v6.docs.astro.build/en/reference/configuration-reference/#hashes).
* - External scripts and external styles are not supported out of the box, but you can [provide your own hashes](https://v6.docs.astro.build/en/reference/configuration-reference/#securitycspscriptdirectivehashes).
* - [Astro's view transitions](https://v6.docs.astro.build/en/guides/view-transitions/) using the `<ClientRouter />` are not supported, but you can [consider migrating to the browser native View Transition API](https://events-3bg.pages.dev/jotter/astro-view-transitions/) instead if you are not using Astro's enhancements to the native View Transitions and Navigation APIs.
* - Shiki isn't currently supported. By design, Shiki functions use inline styles that cannot work with Astro CSP implementation. Consider [using `<Prism />`](https://v6.docs.astro.build/en/guides/syntax-highlighting/#prism-) when your project requires both CSP and syntax highlighting.
* - `unsafe-inline` directives are incompatible with Astro's CSP implementation. By default, Astro will emit hashes for all its bundled scripts (e.g. client islands) and all modern browsers will automatically reject `unsafe-inline` when it occurs in a directive with a hash or nonce.
Expand Down Expand Up @@ -803,7 +803,7 @@ export interface AstroUserConfig<
* @version 6.0.0
* @description
*
* A configuration object that allows you to override the default sources for the `style-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#resources) property, or to provide additional [hashes](https://v6.docs.astro.build/en/reference/configuration-reference#hashes) to be rendered. */
* A configuration object that allows you to override the default sources for the `style-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#securitycspstyledirectiveresources) property, or to provide additional [hashes](https://v6.docs.astro.build/en/reference/configuration-reference#securitycspstyledirectivehashes) to be rendered. */
styleDirective?: {
/**
* @docs
Expand Down Expand Up @@ -904,7 +904,7 @@ export interface AstroUserConfig<
* @version 6.0.0
* @description
*
* A configuration object that allows you to override the default sources for the `script-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#resources) property, or to provide additional [hashes](https://v6.docs.astro.build/en/reference/configuration-reference#hashes) to be rendered.
* A configuration object that allows you to override the default sources for the `script-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#securitycspscriptdirectiveresources) property, or to provide additional [hashes](https://v6.docs.astro.build/en/reference/configuration-reference#securitycspscriptdirectivehashes) to be rendered.
*/
scriptDirective?: {
/**
Expand Down Expand Up @@ -1497,7 +1497,7 @@ export interface AstroUserConfig<
* An optional default time-to-live expiration period for session values, in seconds.
*
* By default, session values persist until they are deleted or the session is destroyed, and do not automatically expire because a particular amount of time has passed.
* Set `session.ttl` to add a default expiration period for your session values. Passing a `ttl` option to [`session.set()`](https://docs.astro.build/en/reference/api-reference/#set) will override the global default
* Set `session.ttl` to add a default expiration period for your session values. Passing a `ttl` option to [`session.set()`](https://v6.docs.astro.build/en/reference/api-reference/#sessionset) will override the global default
* for that individual entry.
*
* ```js title="astro.config.mjs" ins={3-4}
Expand Down
71 changes: 0 additions & 71 deletions packages/astro/test/csp-server-islands.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,77 +77,6 @@ describe('Server islands', () => {
const response = await app.render(request);
assert.equal(response.headers.get('x-robots-tag'), 'noindex');
});
it('omits empty props from the query string', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/empty-props');
const response = await app.render(request);
assert.equal(response.status, 200);
const html = await response.text();
const fetchMatch = html.match(/fetch\('\/_server-islands\/Island\?[^']*p=([^&']*)/);
assert.equal(fetchMatch.length, 2, 'should include props in the query string');
assert.equal(fetchMatch[1], '', 'should not include encrypted empty props');
});
it('re-encrypts props on each request', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/includeComponentWithProps/');
const response = await app.render(request);
assert.equal(response.status, 200);
const html = await response.text();
const fetchMatch = html.match(
/fetch\('\/_server-islands\/ComponentWithProps\?[^']*p=([^&']*)/,
);
assert.equal(fetchMatch.length, 2, 'should include props in the query string');
const firstProps = fetchMatch[1];
const secondRequest = new Request('http://example.com/includeComponentWithProps/');
const secondResponse = await app.render(secondRequest);
assert.equal(secondResponse.status, 200);
const secondHtml = await secondResponse.text();
const secondFetchMatch = secondHtml.match(
/fetch\('\/_server-islands\/ComponentWithProps\?[^']*p=([^&']*)/,
);
assert.equal(secondFetchMatch.length, 2, 'should include props in the query string');
assert.notEqual(
secondFetchMatch[1],
firstProps,
'should re-encrypt props on each request with a different IV',
);
});

it('omits empty props from the query string', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/empty-props');
const response = await app.render(request);
assert.equal(response.status, 200);
const html = await response.text();
const fetchMatch = html.match(/fetch\('\/_server-islands\/Island\?[^']*p=([^&']*)/);
assert.equal(fetchMatch.length, 2, 'should include props in the query string');
assert.equal(fetchMatch[1], '', 'should not include encrypted empty props');
});
it('re-encrypts props on each request', async () => {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/includeComponentWithProps/');
const response = await app.render(request);
assert.equal(response.status, 200);
const html = await response.text();
const fetchMatch = html.match(
/fetch\('\/_server-islands\/ComponentWithProps\?[^']*p=([^&']*)/,
);
assert.equal(fetchMatch.length, 2, 'should include props in the query string');
const firstProps = fetchMatch[1];
const secondRequest = new Request('http://example.com/includeComponentWithProps/');
const secondResponse = await app.render(secondRequest);
assert.equal(secondResponse.status, 200);
const secondHtml = await secondResponse.text();
const secondFetchMatch = secondHtml.match(
/fetch\('\/_server-islands\/ComponentWithProps\?[^']*p=([^&']*)/,
);
assert.equal(secondFetchMatch.length, 2, 'should include props in the query string');
assert.notEqual(
secondFetchMatch[1],
firstProps,
'should re-encrypt props on each request with a different IV',
);
});
});

describe('Hybrid', () => {
Expand Down
Loading