@cedarjs/prerender 0.1.1 → 0.1.2-next.95

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.
@@ -0,0 +1,5 @@
1
+ import type { PluginObj, types } from '@babel/core';
2
+ export default function ({ types: t }: {
3
+ types: typeof types;
4
+ }): PluginObj;
5
+ //# sourceMappingURL=babel-plugin-redwood-cell.d.ts.map
@@ -0,0 +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,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAgHzE"}
@@ -0,0 +1,115 @@
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 babel_plugin_redwood_cell_exports = {};
20
+ __export(babel_plugin_redwood_cell_exports, {
21
+ default: () => babel_plugin_redwood_cell_default
22
+ });
23
+ module.exports = __toCommonJS(babel_plugin_redwood_cell_exports);
24
+ var import_path = require("path");
25
+ const EXPECTED_EXPORTS_FROM_CELL = [
26
+ "beforeQuery",
27
+ "QUERY",
28
+ "data",
29
+ "isEmpty",
30
+ "afterQuery",
31
+ "Loading",
32
+ "Success",
33
+ "Failure",
34
+ "Empty"
35
+ ];
36
+ function babel_plugin_redwood_cell_default({ types: t }) {
37
+ let exportNames = [];
38
+ let hasDefaultExport = false;
39
+ return {
40
+ name: "babel-plugin-redwood-cell",
41
+ visitor: {
42
+ ExportDefaultDeclaration() {
43
+ hasDefaultExport = true;
44
+ },
45
+ ExportNamedDeclaration(path) {
46
+ const declaration = path.node.declaration;
47
+ if (!declaration) {
48
+ return;
49
+ }
50
+ let name;
51
+ if (declaration.type === "VariableDeclaration") {
52
+ const id = declaration.declarations[0].id;
53
+ name = id.name;
54
+ }
55
+ if (declaration.type === "FunctionDeclaration") {
56
+ name = declaration?.id?.name;
57
+ }
58
+ if (name && EXPECTED_EXPORTS_FROM_CELL.includes(name)) {
59
+ exportNames.push(name);
60
+ }
61
+ },
62
+ Program: {
63
+ enter() {
64
+ exportNames = [];
65
+ hasDefaultExport = false;
66
+ },
67
+ exit(path) {
68
+ const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
69
+ if (hasDefaultExport || !hasQueryOrDataExport) {
70
+ return;
71
+ }
72
+ const createCellHookName = exportNames.includes("data") ? "createServerCell" : "createCell";
73
+ const importFrom = exportNames.includes("data") ? "@cedarjs/web/dist/components/cell/createServerCell" : "@cedarjs/web";
74
+ path.node.body.unshift(
75
+ t.importDeclaration(
76
+ [
77
+ t.importSpecifier(
78
+ t.identifier(createCellHookName),
79
+ t.identifier(createCellHookName)
80
+ )
81
+ ],
82
+ t.stringLiteral(importFrom)
83
+ )
84
+ );
85
+ path.node.body.push(
86
+ t.exportDefaultDeclaration(
87
+ t.callExpression(t.identifier(createCellHookName), [
88
+ t.objectExpression([
89
+ ...exportNames.map(
90
+ (name) => t.objectProperty(
91
+ t.identifier(name),
92
+ t.identifier(name),
93
+ false,
94
+ true
95
+ )
96
+ ),
97
+ // Add the `displayName` property so we can name the Cell
98
+ // after the filename.
99
+ t.objectProperty(
100
+ t.identifier("displayName"),
101
+ t.stringLiteral(
102
+ (0, import_path.parse)(this.file.opts.filename).name
103
+ ),
104
+ false,
105
+ true
106
+ )
107
+ ])
108
+ ])
109
+ )
110
+ );
111
+ }
112
+ }
113
+ }
114
+ };
115
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"babel-plugin-redwood-prerender-media-imports.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/babel-plugin-redwood-prerender-media-imports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,aAAa,CAAA;AAsC7D,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAqDzE"}
1
+ {"version":3,"file":"babel-plugin-redwood-prerender-media-imports.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/babel-plugin-redwood-prerender-media-imports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,aAAa,CAAA;AAuC7D,MAAM,CAAC,OAAO,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAqDzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../src/runPrerender.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAsN7C,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,YAAY,gCAGtB,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CA4HzC,CAAA;AAGD,eAAO,MAAM,wBAAwB,mBACnB,MAAM,WACb,MAAM,SAchB,CAAA"}
1
+ {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../src/runPrerender.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAuN7C,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,YAAY,gCAGtB,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAgIzC,CAAA;AAGD,eAAO,MAAM,wBAAwB,mBACnB,MAAM,WACb,MAAM,SAchB,CAAA"}
@@ -42,6 +42,7 @@ var import_babel_config = require("@cedarjs/babel-config");
42
42
  var import_project_config = require("@cedarjs/project-config");
43
43
  var import_router = require("@cedarjs/router");
44
44
  var import_util = require("@cedarjs/router/dist/util");
45
+ var import_babel_plugin_redwood_cell = __toESM(require("./babelPlugins/babel-plugin-redwood-cell"));
45
46
  var import_babel_plugin_redwood_prerender_media_imports = __toESM(require("./babelPlugins/babel-plugin-redwood-prerender-media-imports"));
46
47
  var import_detection = require("./detection");
47
48
  var import_errors = require("./errors");
@@ -222,6 +223,10 @@ const runPrerender = async ({
222
223
  // webpack/postcss handles CSS imports
223
224
  [import_babel_plugin_redwood_prerender_media_imports.default]
224
225
  ]
226
+ },
227
+ {
228
+ test: /.+Cell.(js|tsx|jsx)$/,
229
+ plugins: [import_babel_plugin_redwood_cell.default]
225
230
  }
226
231
  ],
227
232
  options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-next.95+a711c9cda",
4
4
  "description": "CedarJS 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": "0.1.1",
44
- "@cedarjs/project-config": "0.1.1",
45
- "@cedarjs/router": "0.1.1",
46
- "@cedarjs/structure": "0.1.1",
47
- "@cedarjs/web": "0.1.1",
43
+ "@cedarjs/babel-config": "0.1.2-next.95+a711c9cda",
44
+ "@cedarjs/project-config": "0.1.2-next.95+a711c9cda",
45
+ "@cedarjs/router": "0.1.2-next.95+a711c9cda",
46
+ "@cedarjs/structure": "0.1.2-next.95+a711c9cda",
47
+ "@cedarjs/web": "0.1.2-next.95+a711c9cda",
48
48
  "@whatwg-node/fetch": "0.9.21",
49
49
  "babel-plugin-ignore-html-and-css-imports": "0.1.0",
50
50
  "cheerio": "1.0.0",
@@ -52,14 +52,14 @@
52
52
  "mime-types": "2.1.35"
53
53
  },
54
54
  "devDependencies": {
55
- "@cedarjs/framework-tools": "0.1.1",
55
+ "@cedarjs/framework-tools": "0.1.2-next.95",
56
56
  "@types/mime-types": "2.1.4",
57
57
  "babel-plugin-tester": "11.0.4",
58
58
  "concurrently": "8.2.2",
59
59
  "publint": "0.3.12",
60
- "tsx": "4.19.3",
60
+ "tsx": "4.19.4",
61
61
  "typescript": "5.6.2",
62
- "vitest": "2.1.9"
62
+ "vitest": "3.2.4"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "react": "18.3.1",
@@ -72,5 +72,5 @@
72
72
  "react": "react",
73
73
  "react-dom": "react-dom"
74
74
  },
75
- "gitHead": "87e486de4e0bced95a0441f3bbe4977508b161e9"
75
+ "gitHead": "a711c9cda09da9444fb0f6ff5d9dae804d6ba72b"
76
76
  }