@cedarjs/prerender 5.0.4-next.167 → 5.0.4
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/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/dist/babelPlugins/babel-plugin-redwood-cell.js +1 -2
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts.map +1 -1
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +1 -2
- package/dist/cjs/babelPlugins/babel-plugin-redwood-cell.d.ts.map +1 -1
- package/dist/cjs/babelPlugins/babel-plugin-redwood-cell.js +1 -2
- package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +1 -2
- package/dist/cjs/runPrerender.d.ts.map +1 -1
- package/dist/cjs/runPrerender.js +5 -5
- package/dist/cjs/runPrerenderEsm.js +1 -1
- package/dist/runPrerenderEsm.js +1 -1
- package/package.json +15 -15
|
@@ -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;
|
|
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"}
|
|
@@ -2,7 +2,6 @@ import { parse } from "path";
|
|
|
2
2
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
3
3
|
"beforeQuery",
|
|
4
4
|
"QUERY",
|
|
5
|
-
"FRAGMENT",
|
|
6
5
|
"data",
|
|
7
6
|
"isEmpty",
|
|
8
7
|
"afterQuery",
|
|
@@ -45,7 +44,7 @@ function babelPluginRedwoodCell({
|
|
|
45
44
|
hasDefaultExport = false;
|
|
46
45
|
},
|
|
47
46
|
exit(path) {
|
|
48
|
-
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("
|
|
47
|
+
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
|
|
49
48
|
if (hasDefaultExport || !hasQueryOrDataExport) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
@@ -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;
|
|
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"}
|
|
@@ -7,7 +7,6 @@ const generate = babelGenerator.default;
|
|
|
7
7
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
8
8
|
"beforeQuery",
|
|
9
9
|
"QUERY",
|
|
10
|
-
"FRAGMENT",
|
|
11
10
|
"data",
|
|
12
11
|
"isEmpty",
|
|
13
12
|
"afterQuery",
|
|
@@ -65,7 +64,7 @@ function cellTransformPlugin() {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
|
-
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("
|
|
67
|
+
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
|
|
69
68
|
if (hasDefaultExport || !hasQueryOrDataExport) {
|
|
70
69
|
return null;
|
|
71
70
|
}
|
|
@@ -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;
|
|
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"}
|
|
@@ -25,7 +25,6 @@ var import_path = require("path");
|
|
|
25
25
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
26
26
|
"beforeQuery",
|
|
27
27
|
"QUERY",
|
|
28
|
-
"FRAGMENT",
|
|
29
28
|
"data",
|
|
30
29
|
"isEmpty",
|
|
31
30
|
"afterQuery",
|
|
@@ -68,7 +67,7 @@ function babelPluginRedwoodCell({
|
|
|
68
67
|
hasDefaultExport = false;
|
|
69
68
|
},
|
|
70
69
|
exit(path) {
|
|
71
|
-
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("
|
|
70
|
+
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
|
|
72
71
|
if (hasDefaultExport || !hasQueryOrDataExport) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
@@ -40,7 +40,6 @@ const generate = import_generator.default.default;
|
|
|
40
40
|
const EXPECTED_EXPORTS_FROM_CELL = [
|
|
41
41
|
"beforeQuery",
|
|
42
42
|
"QUERY",
|
|
43
|
-
"FRAGMENT",
|
|
44
43
|
"data",
|
|
45
44
|
"isEmpty",
|
|
46
45
|
"afterQuery",
|
|
@@ -98,7 +97,7 @@ function cellTransformPlugin() {
|
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
|
-
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("
|
|
100
|
+
const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
|
|
102
101
|
if (hasDefaultExport || !hasQueryOrDataExport) {
|
|
103
102
|
return null;
|
|
104
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../../src/runPrerender.tsx"],"names":[],"mappings":"
|
|
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"}
|
package/dist/cjs/runPrerender.js
CHANGED
|
@@ -40,6 +40,8 @@ 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");
|
|
43
45
|
var import_babel_plugin_redwood_cell = require("./babelPlugins/babel-plugin-redwood-cell.js");
|
|
44
46
|
var import_babel_plugin_redwood_prerender_media_imports = require("./babelPlugins/babel-plugin-redwood-prerender-media-imports.js");
|
|
45
47
|
var import_detection = require("./detection/detection.js");
|
|
@@ -50,7 +52,6 @@ const { ApolloClient, InMemoryCache } = apolloClient.default || apolloClient;
|
|
|
50
52
|
const prerenderApolloClient = new ApolloClient({ cache: new InMemoryCache() });
|
|
51
53
|
async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandler, queryCache) {
|
|
52
54
|
const { CellCacheContextProvider, getOperationName } = require("@cedarjs/web");
|
|
53
|
-
const { LocationProvider } = require("@cedarjs/router");
|
|
54
55
|
let shouldShowGraphqlHandlerNotFoundWarn = false;
|
|
55
56
|
await Promise.all(
|
|
56
57
|
Object.entries(queryCache).map(async ([cacheKey, value]) => {
|
|
@@ -113,7 +114,7 @@ async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandl
|
|
|
113
114
|
);
|
|
114
115
|
const prerenderUrl = process.env.RWJS_PRERENDER_ORIGIN || "http://localhost" + renderPath;
|
|
115
116
|
const componentAsHtml = import_server.default.renderToString(
|
|
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))))
|
|
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))))
|
|
117
118
|
);
|
|
118
119
|
if (Object.values(queryCache).some((value) => !value.hasProcessed)) {
|
|
119
120
|
return recursivelyRender(
|
|
@@ -134,13 +135,12 @@ async function recursivelyRender(App, Routes, renderPath, fileImporter, gqlHandl
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
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 matchPath(route2.routePath, renderPath).match;
|
|
143
|
+
return (0, import_util.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.
|
|
283
|
+
`<script> globalThis.__REDWOOD__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.
|
|
280
|
+
`<script> globalThis.__REDWOOD__APOLLO_STATE = ${JSON.stringify(
|
|
281
281
|
prerenderApolloClient.extract()
|
|
282
282
|
)}</script>`
|
|
283
283
|
);
|
package/dist/runPrerenderEsm.js
CHANGED
|
@@ -251,7 +251,7 @@ const runPrerender = async ({
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
indexHtmlTree("head").append(
|
|
254
|
-
`<script> globalThis.
|
|
254
|
+
`<script> globalThis.__REDWOOD__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.4
|
|
3
|
+
"version": "5.0.4",
|
|
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.
|
|
70
|
+
"@ast-grep/napi": "0.43.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.4
|
|
75
|
-
"@cedarjs/project-config": "5.0.4
|
|
76
|
-
"@cedarjs/structure": "5.0.4
|
|
77
|
-
"@cedarjs/vite": "5.0.4
|
|
74
|
+
"@cedarjs/babel-config": "5.0.4",
|
|
75
|
+
"@cedarjs/project-config": "5.0.4",
|
|
76
|
+
"@cedarjs/structure": "5.0.4",
|
|
77
|
+
"@cedarjs/vite": "5.0.4",
|
|
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.
|
|
82
|
+
"@swc/core": "1.15.41",
|
|
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.
|
|
92
|
+
"vite": "7.3.5"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@cedarjs/framework-tools": "5.0.4
|
|
96
|
-
"@cedarjs/router": "5.0.4
|
|
97
|
-
"@cedarjs/web": "5.0.4
|
|
95
|
+
"@cedarjs/framework-tools": "5.0.4",
|
|
96
|
+
"@cedarjs/router": "5.0.4",
|
|
97
|
+
"@cedarjs/web": "5.0.4",
|
|
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.
|
|
102
|
+
"publint": "0.3.21",
|
|
103
103
|
"typescript": "5.9.3",
|
|
104
|
-
"vitest": "
|
|
104
|
+
"vitest": "3.2.6"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@cedarjs/router": "5.0.4
|
|
108
|
-
"@cedarjs/web": "5.0.4
|
|
107
|
+
"@cedarjs/router": "5.0.4",
|
|
108
|
+
"@cedarjs/web": "5.0.4",
|
|
109
109
|
"react": "18.3.1",
|
|
110
110
|
"react-dom": "18.3.1"
|
|
111
111
|
},
|