@cedarjs/prerender 1.0.0-canary.12478 → 1.0.0-canary.12481

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":"AAsCA,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,CAiIlD"}
1
+ {"version":3,"file":"buildAndImport.d.ts","sourceRoot":"","sources":["../../src/build-and-import/buildAndImport.ts"],"names":[],"mappings":"AAiCA,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,CAgIlD"}
@@ -152,9 +152,8 @@ async function buildAndImport(options) {
152
152
  if (chunk.type !== "chunk") {
153
153
  throw new Error("[bundle-require] Expected chunk output");
154
154
  }
155
- const code = (0, import_utils.setPrerenderChunkIds)(chunk.code, chunk.dynamicImports);
156
155
  const chunkPath = import_node_path.default.join(outDir, chunk.fileName);
157
- await import_node_fs.default.promises.writeFile(chunkPath, code, "utf8");
156
+ await import_node_fs.default.promises.writeFile(chunkPath, chunk.code, "utf8");
158
157
  }
159
158
  const importPath = (0, import_utils.makeFilePath)(import_node_path.default.join(outDir, output[0].fileName));
160
159
  return import(importPath);
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-plugin-cedarjs-routes-auto-loader.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAYpC,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AA8BD,wBAAgB,6BAA6B,IAAI,MAAM,CAiJtD"}
1
+ {"version":3,"file":"rollup-plugin-cedarjs-routes-auto-loader.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAYpC,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAuBD,wBAAgB,6BAA6B,IAAI,MAAM,CAoJtD"}
@@ -47,12 +47,6 @@ function withRelativeImports(page) {
47
47
  relativeImport: (0, import_project_config.ensurePosixPath)(getPathRelativeToSrc(page.importPath))
48
48
  };
49
49
  }
50
- function prerenderLoaderImpl(relativeImport) {
51
- return `{
52
- const chunkId = './${relativeImport.split("/").at(-1)}-__PRERENDER_CHUNK_ID.js';
53
- return require(chunkId);
54
- }`;
55
- }
56
50
  function cedarjsRoutesAutoLoaderPlugin() {
57
51
  let pages = (0, import_project_config.processPagesDir)().map(withRelativeImports);
58
52
  const duplicatePageImportNames = /* @__PURE__ */ new Set();
@@ -125,9 +119,12 @@ function cedarjsRoutesAutoLoaderPlugin() {
125
119
  if (excludedPages.has(importName)) {
126
120
  continue;
127
121
  }
122
+ imports.push(
123
+ `import __cedarjs_prerender__${importName} from '${relativeImport}';`
124
+ );
128
125
  const declaration = (0, import_utils.dedent)(8)`const ${importName} = {
129
126
  name: "${importName}",
130
- prerenderLoader: (name) => ${prerenderLoaderImpl(relativeImport)},
127
+ prerenderLoader: (name) => ({ default: __cedarjs_prerender__${importName} }),
131
128
  LazyComponent: lazy(() => import("${relativeImport}"))
132
129
  }`;
133
130
  declarations.push(declaration);
@@ -6,8 +6,6 @@ export type RequireFunction = (outfile: string, ctx: {
6
6
  export declare function getPkgType(): any;
7
7
  export declare const getRandomId: () => string;
8
8
  export declare function isValidJsFile(filepath: string): boolean;
9
- import type { OutputChunk } from 'rollup';
10
- export declare function setPrerenderChunkIds(code: string, dynamicImports: OutputChunk['dynamicImports']): string;
11
9
  /**
12
10
  * Converts a file path to a URL path (file://...)
13
11
  * Without this, absolute paths can't be imported on Windows
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/build-and-import/utils.ts"],"names":[],"mappings":"AAIA,sCAAsC;AACtC,eAAO,MAAM,SAAS,QAA2B,CAAA;AAEjD,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE;IAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAAA;CAAE,KAC3B,GAAG,CAAA;AAER,wBAAgB,UAAU,QAYzB;AAED,eAAO,MAAM,WAAW,cAEvB,CAAA;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,WAE7C;AAED,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzC,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAAC,UA2B9C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/build-and-import/utils.ts"],"names":[],"mappings":"AAIA,sCAAsC;AACtC,eAAO,MAAM,SAAS,QAA2B,CAAA;AAEjD,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE;IAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAAA;CAAE,KAC3B,GAAG,CAAA;AAER,wBAAgB,UAAU,QAYzB;AAED,eAAO,MAAM,WAAW,cAEvB,CAAA;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,WAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC"}
@@ -32,8 +32,7 @@ __export(utils_exports, {
32
32
  getPkgType: () => getPkgType,
33
33
  getRandomId: () => getRandomId,
34
34
  isValidJsFile: () => isValidJsFile,
35
- makeFilePath: () => makeFilePath,
36
- setPrerenderChunkIds: () => setPrerenderChunkIds
35
+ makeFilePath: () => makeFilePath
37
36
  });
38
37
  module.exports = __toCommonJS(utils_exports);
39
38
  var import_node_fs = __toESM(require("node:fs"));
@@ -56,21 +55,6 @@ const getRandomId = () => {
56
55
  function isValidJsFile(filepath) {
57
56
  return JS_EXT_RE.test(filepath);
58
57
  }
59
- function setPrerenderChunkIds(code, dynamicImports) {
60
- if (!code.includes("__PRERENDER_CHUNK_ID.js")) {
61
- return code;
62
- }
63
- const newCode = code.replace(
64
- /'\.\/([^']+Page-)__PRERENDER_CHUNK_ID\.js'/g,
65
- (_match, pageName) => {
66
- const chunkName = dynamicImports.find(
67
- (importedChunk) => importedChunk.startsWith(pageName)
68
- );
69
- return `'./${chunkName}'`;
70
- }
71
- );
72
- return newCode;
73
- }
74
58
  function makeFilePath(path2) {
75
59
  return (0, import_node_url.pathToFileURL)(path2).href;
76
60
  }
@@ -80,6 +64,5 @@ function makeFilePath(path2) {
80
64
  getPkgType,
81
65
  getRandomId,
82
66
  isValidJsFile,
83
- makeFilePath,
84
- setPrerenderChunkIds
67
+ makeFilePath
85
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "1.0.0-canary.12478+507810cd8",
3
+ "version": "1.0.0-canary.12481+069fd5996",
4
4
  "description": "RedwoodJS prerender",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,11 +40,11 @@
40
40
  "test:watch": "vitest watch"
41
41
  },
42
42
  "dependencies": {
43
- "@cedarjs/babel-config": "1.0.0-canary.12478",
44
- "@cedarjs/project-config": "1.0.0-canary.12478",
45
- "@cedarjs/router": "1.0.0-canary.12478",
46
- "@cedarjs/structure": "1.0.0-canary.12478",
47
- "@cedarjs/web": "1.0.0-canary.12478",
43
+ "@cedarjs/babel-config": "1.0.0-canary.12481",
44
+ "@cedarjs/project-config": "1.0.0-canary.12481",
45
+ "@cedarjs/router": "1.0.0-canary.12481",
46
+ "@cedarjs/structure": "1.0.0-canary.12481",
47
+ "@cedarjs/web": "1.0.0-canary.12481",
48
48
  "@rollup/plugin-alias": "5.1.1",
49
49
  "@rollup/plugin-commonjs": "28.0.6",
50
50
  "@rollup/plugin-node-resolve": "16.0.1",
@@ -61,7 +61,7 @@
61
61
  "unimport": "5.0.1"
62
62
  },
63
63
  "devDependencies": {
64
- "@cedarjs/framework-tools": "1.0.0-canary.12478",
64
+ "@cedarjs/framework-tools": "1.0.0-canary.12481",
65
65
  "@types/mime-types": "2.1.4",
66
66
  "babel-plugin-tester": "11.0.4",
67
67
  "concurrently": "8.2.2",
@@ -78,5 +78,5 @@
78
78
  "react": "react",
79
79
  "react-dom": "react-dom"
80
80
  },
81
- "gitHead": "507810cd835cbb833694fbcc290752ce679b44e1"
81
+ "gitHead": "069fd5996c989755df85207b2dc3c3f93cd69995"
82
82
  }