@cedarjs/prerender 9.0.0-canary.1784 → 9.0.0-canary.3124

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.
Files changed (89) hide show
  1. package/dist/apolloState.d.ts +13 -0
  2. package/dist/apolloState.d.ts.map +1 -0
  3. package/dist/apolloState.js +6 -0
  4. package/dist/browserUtils/index.d.ts +1 -1
  5. package/dist/browserUtils/index.d.ts.map +1 -1
  6. package/dist/build-and-import/buildAndImport.d.ts +1 -1
  7. package/dist/build-and-import/buildAndImport.d.ts.map +1 -1
  8. package/dist/build-and-import/buildAndImport.js +22 -9
  9. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.d.ts +14 -0
  10. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.d.ts.map +1 -0
  11. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedar-remove-dev-fatal-error-page.js +29 -0
  12. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts.map +1 -1
  13. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +2 -1
  14. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts +4 -3
  15. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts.map +1 -1
  16. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.d.ts.map +1 -1
  17. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.d.ts.map +1 -1
  18. package/dist/detection/detection.d.ts.map +1 -1
  19. package/dist/detection/detection.js +1 -3
  20. package/dist/graphql/graphql.d.ts +17 -2
  21. package/dist/graphql/graphql.d.ts.map +1 -1
  22. package/dist/graphql/node-runner.d.ts +1 -1
  23. package/dist/graphql/node-runner.d.ts.map +1 -1
  24. package/dist/graphql/node-runner.js +27 -37
  25. package/dist/{cjs/index.d.ts.map → index.d.ts.map} +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/runPrerender.d.ts.map +1 -0
  28. package/dist/{runPrerenderEsm.js → runPrerender.js} +76 -63
  29. package/package.json +36 -65
  30. package/LICENSE +0 -21
  31. package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -5
  32. package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  33. package/dist/babelPlugins/babel-plugin-redwood-cell.js +0 -97
  34. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts +0 -5
  35. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts.map +0 -1
  36. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.js +0 -76
  37. package/dist/babelPlugins/utils.d.ts +0 -2
  38. package/dist/babelPlugins/utils.d.ts.map +0 -1
  39. package/dist/babelPlugins/utils.js +0 -15
  40. package/dist/cjs/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -5
  41. package/dist/cjs/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  42. package/dist/cjs/babelPlugins/babel-plugin-redwood-cell.js +0 -121
  43. package/dist/cjs/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts +0 -5
  44. package/dist/cjs/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts.map +0 -1
  45. package/dist/cjs/babelPlugins/babel-plugin-redwood-prerender-media-imports.js +0 -100
  46. package/dist/cjs/babelPlugins/utils.d.ts +0 -2
  47. package/dist/cjs/babelPlugins/utils.d.ts.map +0 -1
  48. package/dist/cjs/babelPlugins/utils.js +0 -49
  49. package/dist/cjs/browserUtils/index.d.ts +0 -8
  50. package/dist/cjs/browserUtils/index.d.ts.map +0 -1
  51. package/dist/cjs/browserUtils/index.js +0 -47
  52. package/dist/cjs/build-and-import/buildAndImport.js +0 -173
  53. package/dist/cjs/build-and-import/load-tsconfig.d.js +0 -1
  54. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +0 -183
  55. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js +0 -83
  56. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.js +0 -125
  57. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.js +0 -48
  58. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.js +0 -66
  59. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.js +0 -118
  60. package/dist/cjs/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.js +0 -146
  61. package/dist/cjs/build-and-import/rollupPlugins/utils.js +0 -78
  62. package/dist/cjs/build-and-import/utils.js +0 -68
  63. package/dist/cjs/detection/detection.d.ts +0 -11
  64. package/dist/cjs/detection/detection.d.ts.map +0 -1
  65. package/dist/cjs/detection/detection.js +0 -48
  66. package/dist/cjs/errors.d.ts +0 -19
  67. package/dist/cjs/errors.d.ts.map +0 -1
  68. package/dist/cjs/errors.js +0 -52
  69. package/dist/cjs/graphql/graphql.d.ts +0 -19
  70. package/dist/cjs/graphql/graphql.d.ts.map +0 -1
  71. package/dist/cjs/graphql/graphql.js +0 -152
  72. package/dist/cjs/graphql/node-runner.js +0 -109
  73. package/dist/cjs/graphql/vite-plugin-cedar-auto-import.js +0 -107
  74. package/dist/cjs/graphql/vite-plugin-cedar-import-dir.js +0 -118
  75. package/dist/cjs/index.js +0 -22
  76. package/dist/cjs/internal.d.ts +0 -28
  77. package/dist/cjs/internal.d.ts.map +0 -1
  78. package/dist/cjs/internal.js +0 -135
  79. package/dist/cjs/package.json +0 -1
  80. package/dist/cjs/runPrerender.d.ts.map +0 -1
  81. package/dist/cjs/runPrerender.js +0 -307
  82. package/dist/cjs/runPrerenderEsm.js +0 -304
  83. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts +0 -19
  84. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts.map +0 -1
  85. package/dist/graphql/vite-plugin-cedar-import-dir.js +0 -84
  86. package/dist/runPrerenderEsm.d.ts +0 -9
  87. package/dist/runPrerenderEsm.d.ts.map +0 -1
  88. /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
  89. /package/dist/{cjs/runPrerender.d.ts → runPrerender.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "description": "CedarJS prerender",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,103 +11,74 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "import": {
15
- "types": "./dist/runPrerenderEsm.d.ts",
16
- "default": "./dist/runPrerenderEsm.js"
17
- },
18
- "require": {
19
- "types": "./dist/cjs/runPrerender.d.ts",
20
- "default": "./dist/cjs/runPrerender.js"
21
- }
22
- },
23
- "./cjs": {
24
- "types": "./dist/cjs/runPrerender.d.ts",
25
- "default": "./dist/cjs/runPrerender.js"
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
26
16
  },
27
17
  "./browserUtils": {
28
- "import": {
29
- "types": "./dist/browserUtils/index.d.ts",
30
- "default": "./dist/browserUtils/index.js"
31
- },
32
- "require": {
33
- "types": "./dist/cjs/browserUtils/index.d.ts",
34
- "default": "./dist/cjs/browserUtils/index.js"
35
- }
18
+ "types": "./dist/browserUtils/index.d.ts",
19
+ "default": "./dist/browserUtils/index.js"
36
20
  },
37
21
  "./detection": {
38
- "import": {
39
- "types": "./dist/detection/detection.d.ts",
40
- "default": "./dist/detection/detection.js"
41
- },
42
- "require": {
43
- "types": "./dist/cjs/detection/detection.d.ts",
44
- "default": "./dist/cjs/detection/detection.js"
45
- }
46
- },
47
- "./cjs/detection": {
48
- "types": "./dist/cjs/detection/detection.d.ts",
49
- "default": "./dist/cjs/detection/detection.js"
22
+ "types": "./dist/detection/detection.d.ts",
23
+ "default": "./dist/detection/detection.js"
50
24
  }
51
25
  },
52
- "main": "dist/cjs/index.js",
53
- "types": "./dist/cjs/index.d.ts",
54
26
  "files": [
55
27
  "dist"
56
28
  ],
57
29
  "scripts": {
58
- "build": "tsx ./build.mts && yarn build:types",
30
+ "build": "node ./build.mts && yarn build:types",
59
31
  "build:pack": "yarn pack -o cedarjs-prerender.tgz",
60
32
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
61
- "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
62
33
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
63
- "check:attw": "yarn rw-fwtools-attw",
34
+ "check:attw": "yarn cedar-fwtools-attw",
64
35
  "check:package": "concurrently npm:check:attw yarn:publint",
65
36
  "prepublishOnly": "yarn build",
66
37
  "test": "vitest run",
67
38
  "test:watch": "vitest watch"
68
39
  },
69
40
  "dependencies": {
70
- "@ast-grep/napi": "0.40.5",
71
- "@babel/generator": "7.29.1",
72
- "@babel/parser": "7.29.0",
73
- "@babel/traverse": "7.29.0",
74
- "@cedarjs/babel-config": "9.0.0-canary.1784",
75
- "@cedarjs/project-config": "9.0.0-canary.1784",
76
- "@cedarjs/router": "9.0.0-canary.1784",
77
- "@cedarjs/structure": "9.0.0-canary.1784",
78
- "@cedarjs/vite": "9.0.0-canary.1784",
79
- "@cedarjs/web": "9.0.0-canary.1784",
41
+ "@babel/generator": "7.29.8",
42
+ "@babel/parser": "7.29.8",
43
+ "@babel/traverse": "7.29.8",
44
+ "@babel/types": "7.29.8",
45
+ "@cedarjs/project-config": "9.0.0-canary.3124",
46
+ "@cedarjs/structure": "9.0.0-canary.3124",
47
+ "@cedarjs/vite": "9.0.0-canary.3124",
80
48
  "@rollup/plugin-alias": "5.1.1",
81
49
  "@rollup/plugin-commonjs": "28.0.9",
82
50
  "@rollup/plugin-node-resolve": "16.0.3",
83
51
  "@rollup/plugin-replace": "6.0.3",
84
- "@swc/core": "1.15.11",
52
+ "@swc/core": "1.16.1",
85
53
  "@whatwg-node/fetch": "0.10.13",
86
- "babel-plugin-ignore-html-and-css-imports": "0.1.0",
87
54
  "cheerio": "1.2.0",
88
- "graphql": "16.12.0",
55
+ "graphql": "16.14.2",
89
56
  "mime-types": "2.1.35",
90
- "rollup": "4.57.1",
57
+ "rollup": "4.63.1",
91
58
  "rollup-plugin-swc3": "0.12.1",
92
- "unimport": "5.6.0",
59
+ "unimport": "5.7.0",
93
60
  "unplugin-auto-import": "19.3.0",
94
- "vite": "5.4.21",
95
- "vite-node": "3.2.4"
61
+ "vite": "7.3.6"
96
62
  },
97
63
  "devDependencies": {
98
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
64
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
65
+ "@cedarjs/router": "9.0.0-canary.3124",
66
+ "@cedarjs/web": "9.0.0-canary.3124",
99
67
  "@types/mime-types": "2.1.4",
100
- "@types/react": "^18.2.55",
101
- "babel-plugin-tester": "11.0.4",
102
- "concurrently": "9.2.1",
103
- "publint": "0.3.17",
104
- "tsx": "4.21.0",
68
+ "@types/react": "^19.2.0",
69
+ "concurrently": "9.2.4",
70
+ "publint": "0.3.24",
105
71
  "typescript": "5.9.3",
106
- "vitest": "3.2.4"
72
+ "vitest": "4.1.11"
107
73
  },
108
74
  "peerDependencies": {
109
- "react": "19.2.3",
110
- "react-dom": "19.2.3"
75
+ "@cedarjs/router": "9.0.0-canary.3124",
76
+ "@cedarjs/web": "9.0.0-canary.3124",
77
+ "react": "19.2.8",
78
+ "react-dom": "19.2.8"
79
+ },
80
+ "engines": {
81
+ "node": ">=24"
111
82
  },
112
83
  "publishConfig": {
113
84
  "access": "public"
@@ -116,5 +87,5 @@
116
87
  "react": "react",
117
88
  "react-dom": "react-dom"
118
89
  },
119
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
90
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
120
91
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,5 +0,0 @@
1
- import type { PluginObj, types } from '@babel/core';
2
- export declare function babelPluginRedwoodCell({ types: t, }: {
3
- types: typeof types;
4
- }): PluginObj;
5
- //# sourceMappingURL=babel-plugin-redwood-cell.d.ts.map
@@ -1 +0,0 @@
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,97 +0,0 @@
1
- import { parse } from "path";
2
- const EXPECTED_EXPORTS_FROM_CELL = [
3
- "beforeQuery",
4
- "QUERY",
5
- "data",
6
- "isEmpty",
7
- "afterQuery",
8
- "Loading",
9
- "Success",
10
- "Failure",
11
- "Empty"
12
- ];
13
- function babelPluginRedwoodCell({
14
- types: t
15
- }) {
16
- let exportNames = [];
17
- let hasDefaultExport = false;
18
- return {
19
- name: "babel-plugin-redwood-cell",
20
- visitor: {
21
- ExportDefaultDeclaration() {
22
- hasDefaultExport = true;
23
- },
24
- ExportNamedDeclaration(path) {
25
- const declaration = path.node.declaration;
26
- if (!declaration) {
27
- return;
28
- }
29
- let name;
30
- if (declaration.type === "VariableDeclaration") {
31
- const id = declaration.declarations[0].id;
32
- name = id.name;
33
- }
34
- if (declaration.type === "FunctionDeclaration") {
35
- name = declaration?.id?.name;
36
- }
37
- if (name && EXPECTED_EXPORTS_FROM_CELL.includes(name)) {
38
- exportNames.push(name);
39
- }
40
- },
41
- Program: {
42
- enter() {
43
- exportNames = [];
44
- hasDefaultExport = false;
45
- },
46
- exit(path) {
47
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
48
- if (hasDefaultExport || !hasQueryOrDataExport) {
49
- return;
50
- }
51
- const createCellHookName = exportNames.includes("data") ? "createServerCell" : "createCell";
52
- const importFrom = exportNames.includes("data") ? "@cedarjs/web/dist/components/cell/createServerCell" : "@cedarjs/web";
53
- path.node.body.unshift(
54
- t.importDeclaration(
55
- [
56
- t.importSpecifier(
57
- t.identifier(createCellHookName),
58
- t.identifier(createCellHookName)
59
- )
60
- ],
61
- t.stringLiteral(importFrom)
62
- )
63
- );
64
- path.node.body.push(
65
- t.exportDefaultDeclaration(
66
- t.callExpression(t.identifier(createCellHookName), [
67
- t.objectExpression([
68
- ...exportNames.map(
69
- (name) => t.objectProperty(
70
- t.identifier(name),
71
- t.identifier(name),
72
- false,
73
- true
74
- )
75
- ),
76
- // Add the `displayName` property so we can name the Cell
77
- // after the filename.
78
- t.objectProperty(
79
- t.identifier("displayName"),
80
- t.stringLiteral(
81
- parse(this.file.opts.filename).name
82
- ),
83
- false,
84
- true
85
- )
86
- ])
87
- ])
88
- )
89
- );
90
- }
91
- }
92
- }
93
- };
94
- }
95
- export {
96
- babelPluginRedwoodCell
97
- };
@@ -1,5 +0,0 @@
1
- import type { PluginObj, types } from '@babel/core';
2
- export declare function babelPluginRedwoodPrerenderMediaImports({ types: t, }: {
3
- types: typeof types;
4
- }): PluginObj;
5
- //# sourceMappingURL=babel-plugin-redwood-prerender-media-imports.d.ts.map
@@ -1 +0,0 @@
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;AAyC7D,wBAAgB,uCAAuC,CAAC,EACtD,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAqDZ"}
@@ -1,76 +0,0 @@
1
- import { extname, join, relative, dirname } from "path";
2
- import { ensurePosixPath, getPaths } from "@cedarjs/project-config";
3
- import { convertToDataUrl } from "./utils.js";
4
- const defaultOptions = {
5
- // This list of extensions matches config for file-loader in
6
- extensions: [
7
- ".ico",
8
- ".jpg",
9
- ".jpeg",
10
- ".png",
11
- ".gif",
12
- ".svg",
13
- ".eot",
14
- ".otf",
15
- ".webp",
16
- ".ttf",
17
- ".woff",
18
- ".woff2",
19
- ".cur",
20
- ".ani",
21
- ".pdf",
22
- ".bmp"
23
- ]
24
- };
25
- function getVariableName(p) {
26
- if (p.node.specifiers?.[0]?.local) {
27
- return p.node.specifiers[0].local.name;
28
- }
29
- return null;
30
- }
31
- function babelPluginRedwoodPrerenderMediaImports({
32
- types: t
33
- }) {
34
- const manifestPath = join(getPaths().web.dist, "client-build-manifest.json");
35
- const buildManifest = require(manifestPath);
36
- return {
37
- name: "babel-plugin-redwood-prerender-media-imports",
38
- visitor: {
39
- ImportDeclaration(p, state) {
40
- const importPath = p.node.source.value;
41
- const ext = extname(importPath);
42
- const options = {
43
- ...defaultOptions,
44
- ...state.opts
45
- };
46
- if (ext && options.extensions.includes(ext)) {
47
- const importConstName = getVariableName(p);
48
- if (state.filename === void 0) {
49
- return;
50
- }
51
- const absPath = join(dirname(state.filename), p.node.source.value);
52
- const viteManifestKey = ensurePosixPath(
53
- relative(getPaths().web.src, absPath)
54
- );
55
- const copiedAssetPath = buildManifest[viteManifestKey]?.file;
56
- const assetSrc = copiedAssetPath ?? convertToDataUrl(
57
- join(state.file.opts.sourceRoot || "./", importPath)
58
- );
59
- if (importConstName) {
60
- p.replaceWith(
61
- t.variableDeclaration("const", [
62
- t.variableDeclarator(
63
- t.identifier(importConstName),
64
- t.stringLiteral(assetSrc)
65
- )
66
- ])
67
- );
68
- }
69
- }
70
- }
71
- }
72
- };
73
- }
74
- export {
75
- babelPluginRedwoodPrerenderMediaImports
76
- };
@@ -1,2 +0,0 @@
1
- export declare function convertToDataUrl(assetPath: string): string;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/utils.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UASjD"}
@@ -1,15 +0,0 @@
1
- import fs from "node:fs";
2
- import mime from "mime-types";
3
- function convertToDataUrl(assetPath) {
4
- try {
5
- const base64AssetContents = fs.readFileSync(assetPath, "base64");
6
- const mimeType = mime.lookup(assetPath);
7
- return `data:${mimeType};base64,${base64AssetContents}`;
8
- } catch {
9
- console.warn(`Could not read file ${assetPath} for conversion to data uri`);
10
- return "";
11
- }
12
- }
13
- export {
14
- convertToDataUrl
15
- };
@@ -1,5 +0,0 @@
1
- import type { PluginObj, types } from '@babel/core';
2
- export declare function babelPluginRedwoodCell({ types: t, }: {
3
- types: typeof types;
4
- }): PluginObj;
5
- //# sourceMappingURL=babel-plugin-redwood-cell.d.ts.map
@@ -1 +0,0 @@
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,121 +0,0 @@
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
- babelPluginRedwoodCell: () => babelPluginRedwoodCell
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 babelPluginRedwoodCell({
37
- types: t
38
- }) {
39
- let exportNames = [];
40
- let hasDefaultExport = false;
41
- return {
42
- name: "babel-plugin-redwood-cell",
43
- visitor: {
44
- ExportDefaultDeclaration() {
45
- hasDefaultExport = true;
46
- },
47
- ExportNamedDeclaration(path) {
48
- const declaration = path.node.declaration;
49
- if (!declaration) {
50
- return;
51
- }
52
- let name;
53
- if (declaration.type === "VariableDeclaration") {
54
- const id = declaration.declarations[0].id;
55
- name = id.name;
56
- }
57
- if (declaration.type === "FunctionDeclaration") {
58
- name = declaration?.id?.name;
59
- }
60
- if (name && EXPECTED_EXPORTS_FROM_CELL.includes(name)) {
61
- exportNames.push(name);
62
- }
63
- },
64
- Program: {
65
- enter() {
66
- exportNames = [];
67
- hasDefaultExport = false;
68
- },
69
- exit(path) {
70
- const hasQueryOrDataExport = exportNames.includes("QUERY") || exportNames.includes("data");
71
- if (hasDefaultExport || !hasQueryOrDataExport) {
72
- return;
73
- }
74
- const createCellHookName = exportNames.includes("data") ? "createServerCell" : "createCell";
75
- const importFrom = exportNames.includes("data") ? "@cedarjs/web/dist/components/cell/createServerCell" : "@cedarjs/web";
76
- path.node.body.unshift(
77
- t.importDeclaration(
78
- [
79
- t.importSpecifier(
80
- t.identifier(createCellHookName),
81
- t.identifier(createCellHookName)
82
- )
83
- ],
84
- t.stringLiteral(importFrom)
85
- )
86
- );
87
- path.node.body.push(
88
- t.exportDefaultDeclaration(
89
- t.callExpression(t.identifier(createCellHookName), [
90
- t.objectExpression([
91
- ...exportNames.map(
92
- (name) => t.objectProperty(
93
- t.identifier(name),
94
- t.identifier(name),
95
- false,
96
- true
97
- )
98
- ),
99
- // Add the `displayName` property so we can name the Cell
100
- // after the filename.
101
- t.objectProperty(
102
- t.identifier("displayName"),
103
- t.stringLiteral(
104
- (0, import_path.parse)(this.file.opts.filename).name
105
- ),
106
- false,
107
- true
108
- )
109
- ])
110
- ])
111
- )
112
- );
113
- }
114
- }
115
- }
116
- };
117
- }
118
- // Annotate the CommonJS export names for ESM import in node:
119
- 0 && (module.exports = {
120
- babelPluginRedwoodCell
121
- });
@@ -1,5 +0,0 @@
1
- import type { PluginObj, types } from '@babel/core';
2
- export declare function babelPluginRedwoodPrerenderMediaImports({ types: t, }: {
3
- types: typeof types;
4
- }): PluginObj;
5
- //# sourceMappingURL=babel-plugin-redwood-prerender-media-imports.d.ts.map
@@ -1 +0,0 @@
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;AAyC7D,wBAAgB,uCAAuC,CAAC,EACtD,KAAK,EAAE,CAAC,GACT,EAAE;IACD,KAAK,EAAE,OAAO,KAAK,CAAA;CACpB,GAAG,SAAS,CAqDZ"}
@@ -1,100 +0,0 @@
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_prerender_media_imports_exports = {};
20
- __export(babel_plugin_redwood_prerender_media_imports_exports, {
21
- babelPluginRedwoodPrerenderMediaImports: () => babelPluginRedwoodPrerenderMediaImports
22
- });
23
- module.exports = __toCommonJS(babel_plugin_redwood_prerender_media_imports_exports);
24
- var import_path = require("path");
25
- var import_project_config = require("@cedarjs/project-config");
26
- var import_utils = require("./utils.js");
27
- const defaultOptions = {
28
- // This list of extensions matches config for file-loader in
29
- extensions: [
30
- ".ico",
31
- ".jpg",
32
- ".jpeg",
33
- ".png",
34
- ".gif",
35
- ".svg",
36
- ".eot",
37
- ".otf",
38
- ".webp",
39
- ".ttf",
40
- ".woff",
41
- ".woff2",
42
- ".cur",
43
- ".ani",
44
- ".pdf",
45
- ".bmp"
46
- ]
47
- };
48
- function getVariableName(p) {
49
- if (p.node.specifiers?.[0]?.local) {
50
- return p.node.specifiers[0].local.name;
51
- }
52
- return null;
53
- }
54
- function babelPluginRedwoodPrerenderMediaImports({
55
- types: t
56
- }) {
57
- const manifestPath = (0, import_path.join)((0, import_project_config.getPaths)().web.dist, "client-build-manifest.json");
58
- const buildManifest = require(manifestPath);
59
- return {
60
- name: "babel-plugin-redwood-prerender-media-imports",
61
- visitor: {
62
- ImportDeclaration(p, state) {
63
- const importPath = p.node.source.value;
64
- const ext = (0, import_path.extname)(importPath);
65
- const options = {
66
- ...defaultOptions,
67
- ...state.opts
68
- };
69
- if (ext && options.extensions.includes(ext)) {
70
- const importConstName = getVariableName(p);
71
- if (state.filename === void 0) {
72
- return;
73
- }
74
- const absPath = (0, import_path.join)((0, import_path.dirname)(state.filename), p.node.source.value);
75
- const viteManifestKey = (0, import_project_config.ensurePosixPath)(
76
- (0, import_path.relative)((0, import_project_config.getPaths)().web.src, absPath)
77
- );
78
- const copiedAssetPath = buildManifest[viteManifestKey]?.file;
79
- const assetSrc = copiedAssetPath ?? (0, import_utils.convertToDataUrl)(
80
- (0, import_path.join)(state.file.opts.sourceRoot || "./", importPath)
81
- );
82
- if (importConstName) {
83
- p.replaceWith(
84
- t.variableDeclaration("const", [
85
- t.variableDeclarator(
86
- t.identifier(importConstName),
87
- t.stringLiteral(assetSrc)
88
- )
89
- ])
90
- );
91
- }
92
- }
93
- }
94
- }
95
- };
96
- }
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- babelPluginRedwoodPrerenderMediaImports
100
- });
@@ -1,2 +0,0 @@
1
- export declare function convertToDataUrl(assetPath: string): string;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/babelPlugins/utils.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UASjD"}