@cedarjs/prerender 4.2.0 → 4.2.1-next.258

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 +1 @@
1
- {"version":3,"file":"buildAndImport.d.ts","sourceRoot":"","sources":["../../src/build-and-import/buildAndImport.ts"],"names":[],"mappings":"AAoCA,UAAU,OAAO;IACf,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAqJlD"}
1
+ {"version":3,"file":"buildAndImport.d.ts","sourceRoot":"","sources":["../../src/build-and-import/buildAndImport.ts"],"names":[],"mappings":"AAqCA,UAAU,OAAO;IACf,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAsJlD"}
@@ -12,6 +12,7 @@ import {
12
12
  getPathsFromTypeScriptConfig,
13
13
  parseTypeScriptConfigFiles
14
14
  } from "../internal.js";
15
+ import { cedarRemoveDevFatalErrorPagePlugin } from "./rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.js";
15
16
  import { cellTransformPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-cell.js";
16
17
  import { cedarjsDirectoryNamedImportPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js";
17
18
  import { externalPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-external.js";
@@ -96,6 +97,7 @@ async function buildAndImport(options) {
96
97
  }
97
98
  }
98
99
  },
100
+ cedarRemoveDevFatalErrorPagePlugin(),
99
101
  ignoreHtmlAndCssImportsPlugin(),
100
102
  cellTransformPlugin(),
101
103
  cedarjsRoutesAutoLoaderPlugin(),
@@ -0,0 +1,14 @@
1
+ import type { Plugin as RollupPlugin } from 'rollup';
2
+ /**
3
+ * Rollup plugin to remove the DevFatalErrorPage import during prerendering.
4
+ *
5
+ * Replaces:
6
+ * import { DevFatalErrorPage } from '@cedarjs/web/dist/components/DevFatalErrorPage'
7
+ * with:
8
+ * const DevFatalErrorPage = undefined
9
+ *
10
+ * Prerendering runs in a production context and should not include the
11
+ * dev-only error page component in the bundle.
12
+ */
13
+ export declare const cedarRemoveDevFatalErrorPagePlugin: () => RollupPlugin;
14
+ //# sourceMappingURL=rollup-plugin-cedar-remove-dev-fatal-error-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup-plugin-cedar-remove-dev-fatal-error-page.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAA;AAcpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC,QAAO,YAqBrD,CAAA"}
@@ -0,0 +1,29 @@
1
+ const DEV_FATAL_ERROR_PAGE_MODULE = "@cedarjs/web/dist/components/DevFatalErrorPage";
2
+ function escapeRegExp(s) {
3
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4
+ }
5
+ const ESCAPED_MODULE = escapeRegExp(DEV_FATAL_ERROR_PAGE_MODULE);
6
+ const IMPORT_PATTERN = new RegExp(
7
+ `import\\s*\\{[^}]*\\bDevFatalErrorPage\\b[^}]*\\}\\s*from\\s*['"]${ESCAPED_MODULE}['"]`
8
+ );
9
+ const cedarRemoveDevFatalErrorPagePlugin = () => {
10
+ return {
11
+ name: "cedar-remove-dev-fatal-error-page",
12
+ transform(code) {
13
+ if (!code.includes(DEV_FATAL_ERROR_PAGE_MODULE)) {
14
+ return null;
15
+ }
16
+ const newCode = code.replace(
17
+ IMPORT_PATTERN,
18
+ "const DevFatalErrorPage = undefined"
19
+ );
20
+ if (newCode === code) {
21
+ return null;
22
+ }
23
+ return { code: newCode, map: null };
24
+ }
25
+ };
26
+ };
27
+ export {
28
+ cedarRemoveDevFatalErrorPagePlugin
29
+ };
@@ -42,6 +42,7 @@ var import_rollup_plugin_swc3 = require("rollup-plugin-swc3");
42
42
  var import_unplugin = __toESM(require("unimport/unplugin"), 1);
43
43
  var import_project_config = require("@cedarjs/project-config");
44
44
  var import_internal = require("../internal.js");
45
+ var import_rollup_plugin_cedar_remove_dev_fatal_error_page = require("./rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.js");
45
46
  var import_rollup_plugin_cedarjs_cell = require("./rollupPlugins/rollup-plugin-cedarjs-cell.js");
46
47
  var import_rollup_plugin_cedarjs_directory_named_imports = require("./rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js");
47
48
  var import_rollup_plugin_cedarjs_external = require("./rollupPlugins/rollup-plugin-cedarjs-external.js");
@@ -126,6 +127,7 @@ async function buildAndImport(options) {
126
127
  }
127
128
  }
128
129
  },
130
+ (0, import_rollup_plugin_cedar_remove_dev_fatal_error_page.cedarRemoveDevFatalErrorPagePlugin)(),
129
131
  (0, import_rollup_plugin_cedarjs_ignore_html_and_css_imports.ignoreHtmlAndCssImportsPlugin)(),
130
132
  (0, import_rollup_plugin_cedarjs_cell.cellTransformPlugin)(),
131
133
  (0, import_rollup_plugin_cedarjs_routes_auto_loader.cedarjsRoutesAutoLoaderPlugin)(),
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var rollup_plugin_cedar_remove_dev_fatal_error_page_exports = {};
20
+ __export(rollup_plugin_cedar_remove_dev_fatal_error_page_exports, {
21
+ cedarRemoveDevFatalErrorPagePlugin: () => cedarRemoveDevFatalErrorPagePlugin
22
+ });
23
+ module.exports = __toCommonJS(rollup_plugin_cedar_remove_dev_fatal_error_page_exports);
24
+ const DEV_FATAL_ERROR_PAGE_MODULE = "@cedarjs/web/dist/components/DevFatalErrorPage";
25
+ function escapeRegExp(s) {
26
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
27
+ }
28
+ const ESCAPED_MODULE = escapeRegExp(DEV_FATAL_ERROR_PAGE_MODULE);
29
+ const IMPORT_PATTERN = new RegExp(
30
+ `import\\s*\\{[^}]*\\bDevFatalErrorPage\\b[^}]*\\}\\s*from\\s*['"]${ESCAPED_MODULE}['"]`
31
+ );
32
+ const cedarRemoveDevFatalErrorPagePlugin = () => {
33
+ return {
34
+ name: "cedar-remove-dev-fatal-error-page",
35
+ transform(code) {
36
+ if (!code.includes(DEV_FATAL_ERROR_PAGE_MODULE)) {
37
+ return null;
38
+ }
39
+ const newCode = code.replace(
40
+ IMPORT_PATTERN,
41
+ "const DevFatalErrorPage = undefined"
42
+ );
43
+ if (newCode === code) {
44
+ return null;
45
+ }
46
+ return { code: newCode, map: null };
47
+ }
48
+ };
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ cedarRemoveDevFatalErrorPagePlugin
53
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../../src/runPrerender.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAmO7C,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,YAAY,GAAU,6BAGhC,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAkIzC,CAAA;AAGD,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,SAAS,MAAM,SAchB,CAAA"}
1
+ {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../../src/runPrerender.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAsO7C,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,YAAY,GAAU,6BAGhC,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAkIzC,CAAA;AAGD,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,SAAS,MAAM,SAchB,CAAA"}
@@ -156,7 +156,7 @@ function insertChunkLoadingScript(indexHtmlTree, renderPath) {
156
156
  );
157
157
  const chunkPaths = [];
158
158
  if (route?.filePath) {
159
- const pagesIndex = route.filePath.indexOf(import_node_path.default.join("web", "src", "pages")) + 8;
159
+ const pagesIndex = route.filePath.indexOf(import_node_path.default.join("web", "src", "pages")) + 4;
160
160
  const pagePath = (0, import_project_config.ensurePosixPath)(route.filePath.slice(pagesIndex));
161
161
  const pageChunkPath = buildManifest[pagePath]?.file;
162
162
  if (pageChunkPath) {
@@ -286,7 +286,7 @@ const runPrerender = async ({
286
286
  );
287
287
  prerenderApolloClient.resetStore();
288
288
  insertChunkLoadingScript(indexHtmlTree, renderPath);
289
- indexHtmlTree("#redwood-app").append(componentAsHtml);
289
+ indexHtmlTree("#cedar-app, #redwood-app").append(componentAsHtml);
290
290
  const renderOutput = indexHtmlTree.html();
291
291
  return renderOutput;
292
292
  };
@@ -156,7 +156,7 @@ function insertChunkLoadingScript(indexHtmlTree, renderPath) {
156
156
  );
157
157
  const chunkPaths = [];
158
158
  if (route?.filePath) {
159
- const pagesIndex = route.filePath.indexOf(import_node_path.default.join("web", "src", "pages")) + 8;
159
+ const pagesIndex = route.filePath.indexOf(import_node_path.default.join("web", "src", "pages")) + 4;
160
160
  const pagePath = (0, import_project_config.ensurePosixPath)(route.filePath.slice(pagesIndex));
161
161
  const pageChunkPath = buildManifest[pagePath]?.file;
162
162
  if (pageChunkPath) {
@@ -283,7 +283,7 @@ const runPrerender = async ({
283
283
  );
284
284
  prerenderApolloClient.resetStore();
285
285
  insertChunkLoadingScript(indexHtmlTree, renderPath);
286
- indexHtmlTree("#redwood-app").append(componentAsHtml);
286
+ indexHtmlTree("#cedar-app, #redwood-app").append(componentAsHtml);
287
287
  const renderOutput = indexHtmlTree.html();
288
288
  return renderOutput;
289
289
  };
@@ -130,7 +130,7 @@ function insertChunkLoadingScript(indexHtmlTree, renderPath) {
130
130
  );
131
131
  const chunkPaths = [];
132
132
  if (route?.filePath) {
133
- const pagesIndex = route.filePath.indexOf(path.join("web", "src", "pages")) + 8;
133
+ const pagesIndex = route.filePath.indexOf(path.join("web", "src", "pages")) + 4;
134
134
  const pagePath = ensurePosixPath(route.filePath.slice(pagesIndex));
135
135
  const pageChunkPath = buildManifest[pagePath]?.file;
136
136
  if (pageChunkPath) {
@@ -257,7 +257,7 @@ const runPrerender = async ({
257
257
  );
258
258
  prerenderApolloClient.resetStore();
259
259
  insertChunkLoadingScript(indexHtmlTree, renderPath);
260
- indexHtmlTree("#redwood-app").append(componentAsHtml);
260
+ indexHtmlTree("#cedar-app, #redwood-app").append(componentAsHtml);
261
261
  const renderOutput = indexHtmlTree.html();
262
262
  return renderOutput;
263
263
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "4.2.0",
3
+ "version": "4.2.1-next.258",
4
4
  "description": "CedarJS prerender",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,51 +60,53 @@
60
60
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
61
61
  "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
62
62
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
63
- "check:attw": "yarn rw-fwtools-attw",
63
+ "check:attw": "yarn cedar-fwtools-attw",
64
64
  "check:package": "concurrently npm:check:attw yarn:publint",
65
65
  "prepublishOnly": "yarn build",
66
66
  "test": "vitest run",
67
67
  "test:watch": "vitest watch"
68
68
  },
69
69
  "dependencies": {
70
- "@ast-grep/napi": "0.42.1",
71
- "@babel/generator": "7.29.1",
72
- "@babel/parser": "7.29.3",
73
- "@babel/traverse": "7.29.0",
70
+ "@ast-grep/napi": "0.43.0",
71
+ "@babel/generator": "7.29.7",
72
+ "@babel/parser": "7.29.7",
73
+ "@babel/traverse": "7.29.7",
74
74
  "@cedarjs/babel-config": "4.2.0",
75
75
  "@cedarjs/project-config": "4.2.0",
76
- "@cedarjs/router": "4.2.0",
77
76
  "@cedarjs/structure": "4.2.0",
78
77
  "@cedarjs/vite": "4.2.0",
79
- "@cedarjs/web": "4.2.0",
80
78
  "@rollup/plugin-alias": "5.1.1",
81
79
  "@rollup/plugin-commonjs": "28.0.9",
82
80
  "@rollup/plugin-node-resolve": "16.0.3",
83
81
  "@rollup/plugin-replace": "6.0.3",
84
- "@swc/core": "1.15.33",
82
+ "@swc/core": "1.15.41",
85
83
  "@whatwg-node/fetch": "0.10.13",
86
84
  "babel-plugin-ignore-html-and-css-imports": "0.1.0",
87
85
  "cheerio": "1.2.0",
88
86
  "graphql": "16.13.2",
89
87
  "mime-types": "2.1.35",
90
- "rollup": "4.60.2",
88
+ "rollup": "4.60.4",
91
89
  "rollup-plugin-swc3": "0.12.1",
92
90
  "unimport": "5.7.0",
93
91
  "unplugin-auto-import": "19.3.0",
94
- "vite": "7.3.2"
92
+ "vite": "7.3.5"
95
93
  },
96
94
  "devDependencies": {
97
95
  "@cedarjs/framework-tools": "4.2.0",
96
+ "@cedarjs/router": "4.2.0",
97
+ "@cedarjs/web": "4.2.0",
98
98
  "@types/mime-types": "2.1.4",
99
99
  "@types/react": "^18.2.55",
100
100
  "babel-plugin-tester": "11.0.4",
101
101
  "concurrently": "9.2.1",
102
- "publint": "0.3.20",
103
- "tsx": "4.21.0",
102
+ "publint": "0.3.21",
103
+ "tsx": "4.22.4",
104
104
  "typescript": "5.9.3",
105
- "vitest": "3.2.4"
105
+ "vitest": "3.2.6"
106
106
  },
107
107
  "peerDependencies": {
108
+ "@cedarjs/router": "4.2.0",
109
+ "@cedarjs/web": "4.2.0",
108
110
  "react": "18.3.1",
109
111
  "react-dom": "18.3.1"
110
112
  },