@cedarjs/prerender 5.0.3 → 5.0.4-next.167

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":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AA+BnD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAgHZ"}
1
+ {"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAgCnD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAmHZ"}
@@ -2,6 +2,7 @@ import { parse } from "path";
2
2
  const EXPECTED_EXPORTS_FROM_CELL = [
3
3
  "beforeQuery",
4
4
  "QUERY",
5
+ "FRAGMENT",
5
6
  "data",
6
7
  "isEmpty",
7
8
  "afterQuery",
@@ -44,7 +45,7 @@ function babelPluginRedwoodCell({
44
45
  hasDefaultExport = false;
45
46
  },
46
47
  exit(path) {
47
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
48
+ const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("FRAGMENT") || exportNames.includes("data");
48
49
  if (hasDefaultExport || !hasQueryOrDataExport) {
49
50
  return;
50
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-plugin-cedarjs-cell.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAmBpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAmK5C"}
1
+ {"version":3,"file":"rollup-plugin-cedarjs-cell.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAoBpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAsK5C"}
@@ -7,6 +7,7 @@ const generate = babelGenerator.default;
7
7
  const EXPECTED_EXPORTS_FROM_CELL = [
8
8
  "beforeQuery",
9
9
  "QUERY",
10
+ "FRAGMENT",
10
11
  "data",
11
12
  "isEmpty",
12
13
  "afterQuery",
@@ -64,7 +65,7 @@ function cellTransformPlugin() {
64
65
  }
65
66
  }
66
67
  });
67
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
68
+ const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("FRAGMENT") || exportNames.includes("data");
68
69
  if (hasDefaultExport || !hasQueryOrDataExport) {
69
70
  return null;
70
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AA+BnD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAgHZ"}
1
+ {"version":3,"file":"babel-plugin-redwood-cell.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/babel-plugin-redwood-cell.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAgCnD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAmHZ"}
@@ -25,6 +25,7 @@ var import_path = require("path");
25
25
  const EXPECTED_EXPORTS_FROM_CELL = [
26
26
  "beforeQuery",
27
27
  "QUERY",
28
+ "FRAGMENT",
28
29
  "data",
29
30
  "isEmpty",
30
31
  "afterQuery",
@@ -67,7 +68,7 @@ function babelPluginRedwoodCell({
67
68
  hasDefaultExport = false;
68
69
  },
69
70
  exit(path) {
70
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
71
+ const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("FRAGMENT") || exportNames.includes("data");
71
72
  if (hasDefaultExport || !hasQueryOrDataExport) {
72
73
  return;
73
74
  }
@@ -40,6 +40,7 @@ const generate = import_generator.default.default;
40
40
  const EXPECTED_EXPORTS_FROM_CELL = [
41
41
  "beforeQuery",
42
42
  "QUERY",
43
+ "FRAGMENT",
43
44
  "data",
44
45
  "isEmpty",
45
46
  "afterQuery",
@@ -97,7 +98,7 @@ function cellTransformPlugin() {
97
98
  }
98
99
  }
99
100
  });
100
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
101
+ const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("FRAGMENT") || exportNames.includes("data");
101
102
  if (hasDefaultExport || !hasQueryOrDataExport) {
102
103
  return null;
103
104
  }
@@ -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;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"}
1
+ {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../../src/runPrerender.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AA0O7C,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"}
@@ -40,8 +40,6 @@ var import_cheerio = require("cheerio");
40
40
  var import_server = __toESM(require("react-dom/server"), 1);
41
41
  var import_babel_config = require("@cedarjs/babel-config");
42
42
  var import_project_config = require("@cedarjs/project-config");
43
- var import_router = require("@cedarjs/router");
44
- var import_util = require("@cedarjs/router/dist/util");
45
43
  var import_babel_plugin_redwood_cell = require("./babelPlugins/babel-plugin-redwood-cell.js");
46
44
  var import_babel_plugin_redwood_prerender_media_imports = require("./babelPlugins/babel-plugin-redwood-prerender-media-imports.js");
47
45
  var import_detection = require("./detection/detection.js");
@@ -52,6 +50,7 @@ const { ApolloClient, InMemoryCache } = apolloClient.default || apolloClient;
52
50
  const prerenderApolloClient = new ApolloClient({ cache: new InMemoryCache() });
53
51
  async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandler, queryCache) {
54
52
  const { CellCacheContextProvider, getOperationName } = require("@cedarjs/web");
53
+ const { LocationProvider } = require("@cedarjs/router");
55
54
  let shouldShowGraphqlHandlerNotFoundWarn = false;
56
55
  await Promise.all(
57
56
  Object.entries(queryCache).map(async ([cacheKey, value]) => {
@@ -114,7 +113,7 @@ async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandl
114
113
  );
115
114
  const prerenderUrl = process.env.RWJS_PRERENDER_ORIGIN || "http://localhost" + renderPath;
116
115
  const componentAsHtml = import_server.default.renderToString(
117
- /* @__PURE__ */ import_react.default.createElement(import_router.LocationProvider, { location: new URL(prerenderUrl) }, /* @__PURE__ */ import_react.default.createElement(CellCacheContextProvider, { queryCache }, /* @__PURE__ */ import_react.default.createElement(App, null, /* @__PURE__ */ import_react.default.createElement(Routes, null))))
116
+ /* @__PURE__ */ import_react.default.createElement(LocationProvider, { location: new URL(prerenderUrl) }, /* @__PURE__ */ import_react.default.createElement(CellCacheContextProvider, { queryCache }, /* @__PURE__ */ import_react.default.createElement(App, null, /* @__PURE__ */ import_react.default.createElement(Routes, null))))
118
117
  );
119
118
  if (Object.values(queryCache).some((value) => !value.hasProcessed)) {
120
119
  return recursivelyRender(
@@ -135,12 +134,13 @@ async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandl
135
134
  }
136
135
  }
137
136
  function insertChunkLoadingScript(indexHtmlTree, renderPath) {
137
+ const { matchPath } = require("@cedarjs/router/dist/util");
138
138
  const prerenderRoutes = (0, import_detection.detectPrerenderRoutes)();
139
139
  const route = prerenderRoutes.find((route2) => {
140
140
  if (!route2.routePath) {
141
141
  return false;
142
142
  }
143
- return (0, import_util.matchPath)(route2.routePath, renderPath).match;
143
+ return matchPath(route2.routePath, renderPath).match;
144
144
  });
145
145
  if (!route) {
146
146
  throw new Error("Could not find a Route matching " + renderPath);
@@ -280,7 +280,7 @@ const runPrerender = async ({
280
280
  }
281
281
  }
282
282
  indexHtmlTree("head").append(
283
- `<script> globalThis.__REDWOOD__APOLLO_STATE = ${JSON.stringify(
283
+ `<script> globalThis.__CEDAR__APOLLO_STATE = ${JSON.stringify(
284
284
  prerenderApolloClient.extract()
285
285
  )}</script>`
286
286
  );
@@ -277,7 +277,7 @@ const runPrerender = async ({
277
277
  }
278
278
  }
279
279
  indexHtmlTree("head").append(
280
- `<script> globalThis.__REDWOOD__APOLLO_STATE = ${JSON.stringify(
280
+ `<script> globalThis.__CEDAR__APOLLO_STATE = ${JSON.stringify(
281
281
  prerenderApolloClient.extract()
282
282
  )}</script>`
283
283
  );
@@ -251,7 +251,7 @@ const runPrerender = async ({
251
251
  }
252
252
  }
253
253
  indexHtmlTree("head").append(
254
- `<script> globalThis.__REDWOOD__APOLLO_STATE = ${JSON.stringify(
254
+ `<script> globalThis.__CEDAR__APOLLO_STATE = ${JSON.stringify(
255
255
  prerenderApolloClient.extract()
256
256
  )}</script>`
257
257
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "5.0.3",
3
+ "version": "5.0.4-next.167",
4
4
  "description": "CedarJS prerender",
5
5
  "repository": {
6
6
  "type": "git",
@@ -67,19 +67,19 @@
67
67
  "test:watch": "vitest watch"
68
68
  },
69
69
  "dependencies": {
70
- "@ast-grep/napi": "0.43.0",
70
+ "@ast-grep/napi": "0.45.0",
71
71
  "@babel/generator": "7.29.7",
72
72
  "@babel/parser": "7.29.7",
73
73
  "@babel/traverse": "7.29.7",
74
- "@cedarjs/babel-config": "5.0.3",
75
- "@cedarjs/project-config": "5.0.3",
76
- "@cedarjs/structure": "5.0.3",
77
- "@cedarjs/vite": "5.0.3",
74
+ "@cedarjs/babel-config": "5.0.4-next.167",
75
+ "@cedarjs/project-config": "5.0.4-next.167",
76
+ "@cedarjs/structure": "5.0.4-next.167",
77
+ "@cedarjs/vite": "5.0.4-next.167",
78
78
  "@rollup/plugin-alias": "5.1.1",
79
79
  "@rollup/plugin-commonjs": "28.0.9",
80
80
  "@rollup/plugin-node-resolve": "16.0.3",
81
81
  "@rollup/plugin-replace": "6.0.3",
82
- "@swc/core": "1.15.41",
82
+ "@swc/core": "1.15.46",
83
83
  "@whatwg-node/fetch": "0.10.13",
84
84
  "babel-plugin-ignore-html-and-css-imports": "0.1.0",
85
85
  "cheerio": "1.2.0",
@@ -89,23 +89,23 @@
89
89
  "rollup-plugin-swc3": "0.12.1",
90
90
  "unimport": "5.7.0",
91
91
  "unplugin-auto-import": "19.3.0",
92
- "vite": "7.3.5"
92
+ "vite": "7.3.6"
93
93
  },
94
94
  "devDependencies": {
95
- "@cedarjs/framework-tools": "5.0.3",
96
- "@cedarjs/router": "5.0.3",
97
- "@cedarjs/web": "5.0.3",
95
+ "@cedarjs/framework-tools": "5.0.4-next.167",
96
+ "@cedarjs/router": "5.0.4-next.167",
97
+ "@cedarjs/web": "5.0.4-next.167",
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.4",
102
- "publint": "0.3.21",
102
+ "publint": "0.3.22",
103
103
  "typescript": "5.9.3",
104
- "vitest": "3.2.6"
104
+ "vitest": "4.1.10"
105
105
  },
106
106
  "peerDependencies": {
107
- "@cedarjs/router": "5.0.3",
108
- "@cedarjs/web": "5.0.3",
107
+ "@cedarjs/router": "5.0.4-next.167",
108
+ "@cedarjs/web": "5.0.4-next.167",
109
109
  "react": "18.3.1",
110
110
  "react-dom": "18.3.1"
111
111
  },