@plone/aurora 1.0.0-alpha.19 → 1.0.0-alpha.20
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.
- package/CHANGELOG.md +53 -0
- package/acceptance/tests/anonymous-401-redirect.test.ts +75 -0
- package/acceptance/tests/multilingual-root-redirect.test.ts +45 -0
- package/app/config/server.server.test.ts +13 -0
- package/app/config/server.server.ts +17 -1
- package/app/config/types.ts +18 -0
- package/app/i18next.server.ts +2 -0
- package/app/middleware.server.test.ts +744 -8
- package/app/middleware.server.ts +211 -19
- package/app/root.tsx +2 -0
- package/app/routes.ts +1 -1
- package/package.json +26 -26
- package/react-router.config.ts +6 -0
- package/vite.config.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,59 @@
|
|
|
8
8
|
|
|
9
9
|
<!-- towncrier release notes start -->
|
|
10
10
|
|
|
11
|
+
## 1.0.0-alpha.20 (2026-10-29)
|
|
12
|
+
|
|
13
|
+
### Feature
|
|
14
|
+
|
|
15
|
+
- A visitor who is not signed in and opens private content is sent to the login page with the page as `return_url`, as in Volto, instead of a bare 401 page. An expired sign-in does the same and clears the cookie. Signed-in users without permission still see the 401 page. @mpalomaki
|
|
16
|
+
- Added `config.settings.apiExpanders`, so add-ons can add expandable components to the main content request, optionally for signed-in users only. @sneridagh
|
|
17
|
+
- Added the `clientEndpoints` utility type, so add-ons can add custom endpoint methods to the request Plone client. @sneridagh
|
|
18
|
+
- Added the `contentResource` utility type and its middleware, which answers resources below a content path, like `/<path>/@blocks-schema`. @sneridagh
|
|
19
|
+
- On a multilingual site a request for the site root is redirected to the default language root — a full load and a client-side navigation alike — as Plone's language switcher view and Volto's `MultilingualRedirector` do. The root stays reachable through its contents view. @mpalomaki
|
|
20
|
+
- The build directory can be set from the environment (`REACT_ROUTER_BUILD_DIR`), so a deployment can build aside into a versioned directory and swap a symlink rather than overwrite the directory the running server serves — `react-router build` removes its build directory first. The default `build` is unchanged. @mpalomaki
|
|
21
|
+
- The content request expands the page's `translations` by default, for the LanguageSwitcher. A site without `plone.app.multilingual` ignores it. @sneridagh
|
|
22
|
+
- The root middleware no longer loads the Plone content, site and user for resource routes, whose path has a segment that starts with a single `@` (`@search`, `@@contents/@delete`), nor for the `/ok` health check, which saves three backend requests per call. The `reset-fetcher` route is renamed to `@reset-fetcher`. @sneridagh
|
|
23
|
+
|
|
24
|
+
### Bugfix
|
|
25
|
+
|
|
26
|
+
- Apply the server configuration once per process instead of on every request, which made `config.routes` and the slot components grow without bound. @sneridagh
|
|
27
|
+
- Serve user portraits to browser image requests and persist the preferred interface language. @sneridagh
|
|
28
|
+
|
|
29
|
+
### Internal
|
|
30
|
+
|
|
31
|
+
- Pre-bundled `jotai/vanilla` for `@plone/helpers`, which its form layer imports. @sneridagh
|
|
32
|
+
- Removed the `@plone/components > react-aria-components/DropZone` Vite pre-bundling entry, since `@plone/components` no longer has a `DropZone`. @pnicolli
|
|
33
|
+
- Updated React Aria Components to 1.22, and moved all React Aria packages and `tailwindcss-react-aria-components` into the pnpm catalog. @sneridagh
|
|
34
|
+
- Upgraded pnpm to 12, and enabled `autoDedupe` and `minimumReleaseAgeExcludePrune`. @sneridagh
|
|
35
|
+
- Upgraded to Node.js 26 in CI, and to React Router 8.5.0 and React 19.3. @sneridagh
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
- Added the "Form fields, controls, widgets, and adapters" conceptual guide, with a diagram, worked examples and a glossary. @sneridagh [#97](https://github.com/plone/aurora/issues/97)
|
|
40
|
+
- Solved a few Vale issues, by replacing failing regular expressions with functional ones, and corrected spelling of "Sass" in narrative docs. @silviubogan [#297](https://github.com/plone/aurora/issues/297)
|
|
41
|
+
- Added Node.js 26 to the supported Node.js versions. @sneridagh
|
|
42
|
+
- Added a "Forms and widgets" section to the upgrade guide: the widget contract, the new form engine, validators, and the renamed Quanta pickers. @sneridagh
|
|
43
|
+
- Added the "Add custom endpoints to the Plone client" how-to guide. @sneridagh
|
|
44
|
+
- Added the "Add expanders to the content request" how-to guide. @sneridagh
|
|
45
|
+
- Added the "Core widgets" reference: what each widget is registered for, the value it reads and writes, and its widget options, such as the image widget's `extraFields`. @sneridagh
|
|
46
|
+
- Added the "Validate form fields" how-to: default validators, registering validators by format, type, widget, behavior or block, overriding them, writing them, translating their messages, and invariants. Updated the block schema side effects how-to to the current block settings form. @sneridagh
|
|
47
|
+
- Added the Quanta components reference, with how each component relates to React Aria's Tailwind starter. @sneridagh
|
|
48
|
+
- Added the upgrade guide entry for the Quanta `Sheet`. @sneridagh
|
|
49
|
+
- Added the upgrade guide entry for the Quanta palette removed from `@plone/components`' basic CSS. @pnicolli
|
|
50
|
+
- Added the upgrade guide entry for the components removed from `@plone/components`, and linked the `@plone/icons` Storybook. @pnicolli
|
|
51
|
+
- Added the upgrade guide for Quanta's `MultiSelect`. @sneridagh
|
|
52
|
+
- Added the upgrade guide for the Quanta collections. @sneridagh
|
|
53
|
+
- Added the upgrade guide for the Quanta fields, which follow React Aria's Tailwind starter. @sneridagh
|
|
54
|
+
- Added the upgrade guide for the Quanta navigation components. @sneridagh
|
|
55
|
+
- Documented form validation and how to register validators. @sneridagh
|
|
56
|
+
- Documented how to add Plate plugins from an add-on. @sneridagh
|
|
57
|
+
- Documented how to write block docs, the `@blocks-schema` endpoint, and how to answer a resource below a content path with a `contentResource` utility. @sneridagh
|
|
58
|
+
- Documented how widgets read the form and where it is, and the widget context upgrade step. @sneridagh
|
|
59
|
+
- Documented testing widgets against the contract, and the compile-time check of registered widgets. @sneridagh
|
|
60
|
+
- Documented the new core widgets, the choices widget in the widget lookup order, and the file and image fields in the upgrade guide. @sneridagh
|
|
61
|
+
- Documented the route naming convention, `@@` for views and a single `@` for resource routes, and that the root middleware does not load the content for resource routes. @sneridagh
|
|
62
|
+
- Updated the metadata text binding reference for the form context. @sneridagh
|
|
63
|
+
|
|
11
64
|
## 1.0.0-alpha.19 (2026-10-06)
|
|
12
65
|
|
|
13
66
|
### Documentation
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContent,
|
|
3
|
+
setWorkflowSeven,
|
|
4
|
+
} from '../../../../packages/tooling/playwright/content';
|
|
5
|
+
import {
|
|
6
|
+
expect,
|
|
7
|
+
test,
|
|
8
|
+
} from '../../../../packages/tooling/playwright/multilingual';
|
|
9
|
+
|
|
10
|
+
test.describe('Anonymous 401 redirect', () => {
|
|
11
|
+
test('a private page sends an anonymous visitor to the login page', async ({
|
|
12
|
+
page,
|
|
13
|
+
request,
|
|
14
|
+
}) => {
|
|
15
|
+
// New content is private until published.
|
|
16
|
+
await createContent(request, {
|
|
17
|
+
contentType: 'Document',
|
|
18
|
+
contentId: 'internal',
|
|
19
|
+
contentTitle: 'Internal page',
|
|
20
|
+
path: 'en',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
await page.goto('/en/internal');
|
|
24
|
+
await expect(page).toHaveURL(/\/login\?return_url=%2Fen%2Finternal$/);
|
|
25
|
+
await expect(page.getByLabel('username')).toBeVisible();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('a private language root sends an anonymous visitor to the login page', async ({
|
|
29
|
+
page,
|
|
30
|
+
request,
|
|
31
|
+
}) => {
|
|
32
|
+
await setWorkflowSeven(request, { path: 'en', review_state: 'retract' });
|
|
33
|
+
|
|
34
|
+
await page.goto('/en');
|
|
35
|
+
await expect(page).toHaveURL(/\/login\?return_url=%2Fen$/);
|
|
36
|
+
await expect(page.getByLabel('username')).toBeVisible();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('the site root does not loop when the default language root is private', async ({
|
|
40
|
+
page,
|
|
41
|
+
request,
|
|
42
|
+
}) => {
|
|
43
|
+
await setWorkflowSeven(request, { path: 'en', review_state: 'retract' });
|
|
44
|
+
|
|
45
|
+
// / → /en (the multilingual root redirect) → /login?return_url=/en,
|
|
46
|
+
// never back to /.
|
|
47
|
+
const response = await page.goto('/');
|
|
48
|
+
expect(response?.ok()).toBe(true);
|
|
49
|
+
await expect(page).toHaveURL(/\/login\?return_url=%2Fen$/);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('a signed-in editor is not redirected from a page they can see', async ({
|
|
53
|
+
page,
|
|
54
|
+
request,
|
|
55
|
+
}) => {
|
|
56
|
+
await createContent(request, {
|
|
57
|
+
contentType: 'Document',
|
|
58
|
+
contentId: 'internal',
|
|
59
|
+
contentTitle: 'Internal page',
|
|
60
|
+
path: 'en',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await page.goto('/login', { waitUntil: 'networkidle' });
|
|
64
|
+
await page.getByLabel('username').fill('admin');
|
|
65
|
+
await page.getByLabel('password').fill('secret');
|
|
66
|
+
await page.getByRole('button', { name: /sign in/i }).click();
|
|
67
|
+
await expect(page).toHaveURL(/\/en$/);
|
|
68
|
+
|
|
69
|
+
await page.goto('/en/internal');
|
|
70
|
+
await expect(page).toHaveURL(/\/en\/internal$/);
|
|
71
|
+
await expect(
|
|
72
|
+
page.getByRole('heading', { name: 'Internal page' }),
|
|
73
|
+
).toBeVisible();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect,
|
|
3
|
+
test,
|
|
4
|
+
} from '../../../../packages/tooling/playwright/multilingual';
|
|
5
|
+
|
|
6
|
+
test.describe('Multilingual root redirect', () => {
|
|
7
|
+
test('a full load of the site root lands on the default language root', async ({
|
|
8
|
+
page,
|
|
9
|
+
}) => {
|
|
10
|
+
await page.goto('/');
|
|
11
|
+
await expect(page).toHaveURL(/\/en$/);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('a client-side navigation to the site root lands on the default language root', async ({
|
|
15
|
+
page,
|
|
16
|
+
}) => {
|
|
17
|
+
// The login action redirects to the site root once signed in. That is a
|
|
18
|
+
// client-side navigation, which fetches /_.data, not /.
|
|
19
|
+
await page.goto('/login', { waitUntil: 'networkidle' });
|
|
20
|
+
await page.getByLabel('username').fill('admin');
|
|
21
|
+
await page.getByLabel('password').fill('secret');
|
|
22
|
+
|
|
23
|
+
const rootData = page.waitForRequest((request) =>
|
|
24
|
+
/^\/_[^/]*\.data$/.test(new URL(request.url()).pathname),
|
|
25
|
+
);
|
|
26
|
+
await page.getByRole('button', { name: /sign in/i }).click();
|
|
27
|
+
await rootData;
|
|
28
|
+
|
|
29
|
+
await expect(page).toHaveURL(/\/en$/);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('a language root is not redirected', async ({ page }) => {
|
|
33
|
+
await page.goto('/de');
|
|
34
|
+
await expect(page).toHaveURL(/\/de$/);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test.describe('Multilingual root redirect with another default language', () => {
|
|
39
|
+
test.use({ languages: ['de', 'en'] });
|
|
40
|
+
|
|
41
|
+
test('the site root lands on the default language root', async ({ page }) => {
|
|
42
|
+
await page.goto('/');
|
|
43
|
+
await expect(page).toHaveURL(/\/de$/);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -19,6 +19,19 @@ describe('config/server', () => {
|
|
|
19
19
|
supportedLanguages: ['en'],
|
|
20
20
|
defaultLanguage: 'en',
|
|
21
21
|
apiPath: 'http://localhost:8080/Plone',
|
|
22
|
+
apiExpanders: [
|
|
23
|
+
{
|
|
24
|
+
match: '',
|
|
25
|
+
expand: [
|
|
26
|
+
'navroot',
|
|
27
|
+
'breadcrumbs',
|
|
28
|
+
'navigation',
|
|
29
|
+
'actions',
|
|
30
|
+
'translations',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{ match: '', expand: ['types'], authenticated: true },
|
|
34
|
+
],
|
|
22
35
|
}),
|
|
23
36
|
);
|
|
24
37
|
expect(
|
|
@@ -8,14 +8,30 @@ import applyAddonConfiguration from '../../.plone/registry.loader';
|
|
|
8
8
|
// eslint-disable-next-line import/no-unresolved
|
|
9
9
|
import applyServerAddonConfiguration from '../../.plone/registry.loader.server';
|
|
10
10
|
|
|
11
|
-
import type { ListingBlockFormData } from '@plone/types';
|
|
11
|
+
import type { ContentExpander, ListingBlockFormData } from '@plone/types';
|
|
12
12
|
import type { LoaderUtilityArgs } from './types';
|
|
13
13
|
import installMigrations from './server/migrations.server';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The components that the main content request expands by default. Add-ons
|
|
17
|
+
* can add to, change, or remove them through `config.settings.apiExpanders`.
|
|
18
|
+
*/
|
|
19
|
+
export const defaultApiExpanders: ContentExpander[] = [
|
|
20
|
+
// `translations` gives the LanguageSwitcher the page's translations to
|
|
21
|
+
// link to; a site without plone.app.multilingual ignores it.
|
|
22
|
+
{
|
|
23
|
+
match: '',
|
|
24
|
+
expand: ['navroot', 'breadcrumbs', 'navigation', 'actions', 'translations'],
|
|
25
|
+
},
|
|
26
|
+
{ match: '', expand: ['types'], authenticated: true },
|
|
27
|
+
];
|
|
28
|
+
|
|
15
29
|
export default function install() {
|
|
16
30
|
config.settings.apiPath =
|
|
17
31
|
process.env.PLONE_API_PATH || 'http://localhost:8080/Plone';
|
|
18
32
|
|
|
33
|
+
config.settings.apiExpanders = [...defaultApiExpanders];
|
|
34
|
+
|
|
19
35
|
config.registerUtility({
|
|
20
36
|
name: 'ploneClient',
|
|
21
37
|
type: 'client',
|
package/app/config/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Content } from '@plone/types';
|
|
2
2
|
import type PloneClient from '@plone/client';
|
|
3
|
+
import type { PloneClientMethods } from '@plone/client';
|
|
3
4
|
import type { Value } from '@plone/plate/components/editor';
|
|
4
5
|
import type { Params } from 'react-router';
|
|
5
6
|
|
|
@@ -8,6 +9,10 @@ export type PloneClientUtility = typeof PloneClient;
|
|
|
8
9
|
declare module '@plone/types' {
|
|
9
10
|
interface UtilityTypeMap {
|
|
10
11
|
client: () => PloneClientUtility;
|
|
12
|
+
// A `clientEndpoints` utility returns methods that the Plone Aurora
|
|
13
|
+
// middleware adds to the `PloneClient` instance of each request. Type
|
|
14
|
+
// them by augmenting `PloneClientExtensions` from `@plone/client`.
|
|
15
|
+
clientEndpoints: () => PloneClientMethods;
|
|
11
16
|
rootContentSubRequest: (args: LoaderUtilityArgs) => Promise<unknown>;
|
|
12
17
|
// A `rootLoaderData` utility returns a `{ status, data }` envelope — the
|
|
13
18
|
// same shape as a PloneClient response — so a utility that queries Plone
|
|
@@ -19,6 +24,11 @@ declare module '@plone/types' {
|
|
|
19
24
|
rootLoaderData: (
|
|
20
25
|
args: LoaderUtilityArgs,
|
|
21
26
|
) => Promise<{ status: number; data: unknown }>;
|
|
27
|
+
// A `contentResource` utility answers `/<path>/<name>[/<subpath>]`, a
|
|
28
|
+
// resource below a content path, like plone.restapi endpoints. Its name
|
|
29
|
+
// is the `@`-prefixed segment, for example `@blocks-schema`. Resources
|
|
30
|
+
// without a content path are regular resource routes.
|
|
31
|
+
contentResource: (args: ContentResourceArgs) => Promise<Response>;
|
|
22
32
|
somersaultBlockMigration: (
|
|
23
33
|
args: SomersaultBlockMigrationArgs,
|
|
24
34
|
) => SomersaultMigrationArgs['value'];
|
|
@@ -37,6 +47,14 @@ export interface LoaderUtilityArgs {
|
|
|
37
47
|
locale: string;
|
|
38
48
|
}
|
|
39
49
|
|
|
50
|
+
export interface ContentResourceArgs {
|
|
51
|
+
request: Request;
|
|
52
|
+
/** The content path, for example `/news`. */
|
|
53
|
+
path: string;
|
|
54
|
+
/** What follows the resource name, if anything, without leading slash. */
|
|
55
|
+
subpath?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
40
58
|
export interface SomersaultMigrationArgs {
|
|
41
59
|
content: Content;
|
|
42
60
|
value: Value;
|
package/app/i18next.server.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
import { initReactI18next } from 'react-i18next';
|
|
4
4
|
import { createI18nextMiddleware } from 'remix-i18next';
|
|
5
5
|
import i18n from './i18n'; // your i18n configuration file
|
|
6
|
+
import { localeCookie } from '@plone/react-router';
|
|
6
7
|
|
|
7
8
|
// The add-on locales are generated into `public/locales`, which the build copies
|
|
8
9
|
// to `build/client/locales`. Resolve them relative to this module, not the
|
|
@@ -22,6 +23,7 @@ export const [i18nextMiddleware, getLocale, getInstance] =
|
|
|
22
23
|
detection: {
|
|
23
24
|
supportedLanguages: i18n.supportedLngs,
|
|
24
25
|
fallbackLanguage: i18n.fallbackLng as string,
|
|
26
|
+
cookie: localeCookie,
|
|
25
27
|
},
|
|
26
28
|
// This is the configuration for i18next used
|
|
27
29
|
// when translating messages server-side only
|