@cmssy/remix 9.1.1 → 9.2.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.
package/dist/index.cjs CHANGED
@@ -9,6 +9,26 @@ function createCmssyLoader(config) {
9
9
  }) {
10
10
  const url = new URL(request.url);
11
11
  const isEdit = await core.isVerifiedEditUrl(url, config);
12
+ const editRequested = url.searchParams.getAll(core.CMSSY_EDIT_QUERY_PARAM).includes("1");
13
+ if (!isEdit && editRequested && core.isDevelopment()) {
14
+ const { collectEditDiagnostics, renderEditDiagnostics } = await import('@cmssy/core/preflight');
15
+ const diagnosed = await collectEditDiagnostics({
16
+ config,
17
+ providedSecret: url.searchParams.get(core.CMSSY_SECRET_QUERY_PARAM),
18
+ devOrigin: url.origin
19
+ });
20
+ const locales = await core.resolveSiteLocales(config);
21
+ return {
22
+ page: null,
23
+ layouts: [],
24
+ locale: locales.defaultLocale,
25
+ defaultLocale: locales.defaultLocale,
26
+ enabledLocales: locales.locales,
27
+ isEdit: false,
28
+ editorOrigin: config.editorOrigin ?? "*",
29
+ diagnostics: renderEditDiagnostics(diagnosed)
30
+ };
31
+ }
12
32
  const siteLocales = await core.resolveSiteLocales(config);
13
33
  const segments = url.pathname.split("/").filter(Boolean);
14
34
  const fromPath = core.splitLocaleFromPath(segments, siteLocales);
package/dist/index.d.cts CHANGED
@@ -10,6 +10,7 @@ interface CmssyRouteData {
10
10
  /** True for a VERIFIED editor request. The route renders the edit bridge. */
11
11
  isEdit: boolean;
12
12
  editorOrigin: string | string[];
13
+ diagnostics?: string;
13
14
  }
14
15
  /**
15
16
  * The page loader.
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ interface CmssyRouteData {
10
10
  /** True for a VERIFIED editor request. The route renders the edit bridge. */
11
11
  isEdit: boolean;
12
12
  editorOrigin: string | string[];
13
+ diagnostics?: string;
13
14
  }
14
15
  /**
15
16
  * The page loader.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isVerifiedEditUrl, resolveSiteLocales, splitLocaleFromPath, CMSSY_LOCALE_HEADER, fetchPage, fetchLayouts, cmssyCspHeaders, fetchPages, normalizeSlug, localizedPath } from '@cmssy/core';
1
+ import { isVerifiedEditUrl, CMSSY_EDIT_QUERY_PARAM, isDevelopment, CMSSY_SECRET_QUERY_PARAM, resolveSiteLocales, splitLocaleFromPath, CMSSY_LOCALE_HEADER, fetchPage, fetchLayouts, cmssyCspHeaders, fetchPages, normalizeSlug, localizedPath } from '@cmssy/core';
2
2
  export { CMSSY_LOCALE_HEADER, buildBlockContext, createCmssyClient, defineCmssyConfig, fetchLayouts, fetchPage, fetchPageMeta, fetchPages, fetchProduct, fetchProducts, isVerifiedEditUrl, localizeHref, localizedPath, resolveSiteLocales } from '@cmssy/core';
3
3
 
4
4
  // src/loader.ts
@@ -8,6 +8,26 @@ function createCmssyLoader(config) {
8
8
  }) {
9
9
  const url = new URL(request.url);
10
10
  const isEdit = await isVerifiedEditUrl(url, config);
11
+ const editRequested = url.searchParams.getAll(CMSSY_EDIT_QUERY_PARAM).includes("1");
12
+ if (!isEdit && editRequested && isDevelopment()) {
13
+ const { collectEditDiagnostics, renderEditDiagnostics } = await import('@cmssy/core/preflight');
14
+ const diagnosed = await collectEditDiagnostics({
15
+ config,
16
+ providedSecret: url.searchParams.get(CMSSY_SECRET_QUERY_PARAM),
17
+ devOrigin: url.origin
18
+ });
19
+ const locales = await resolveSiteLocales(config);
20
+ return {
21
+ page: null,
22
+ layouts: [],
23
+ locale: locales.defaultLocale,
24
+ defaultLocale: locales.defaultLocale,
25
+ enabledLocales: locales.locales,
26
+ isEdit: false,
27
+ editorOrigin: config.editorOrigin ?? "*",
28
+ diagnostics: renderEditDiagnostics(diagnosed)
29
+ };
30
+ }
11
31
  const siteLocales = await resolveSiteLocales(config);
12
32
  const segments = url.pathname.split("/").filter(Boolean);
13
33
  const fromPath = splitLocaleFromPath(segments, siteLocales);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/remix",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "description": "React Router 7 bindings for cmssy headless sites: page loader, framing CSP, sitemap and robots.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -48,7 +48,7 @@
48
48
  "vitest": "^2.1.0"
49
49
  },
50
50
  "dependencies": {
51
- "@cmssy/core": "9.1.1"
51
+ "@cmssy/core": "9.2.0"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tsup",