@cedarjs/prerender 0.9.1-next.0 → 0.9.1-next.20
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/browserUtils/index.js +4 -31
- package/dist/build-and-import/buildAndImport.d.ts +12 -0
- package/dist/build-and-import/buildAndImport.d.ts.map +1 -0
- package/dist/build-and-import/buildAndImport.js +142 -0
- package/dist/build-and-import/load-tsconfig.d.js +0 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts +23 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +149 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.d.ts +3 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js +49 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.d.ts +9 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.js +91 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts +24 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.js +24 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.d.ts +3 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.js +32 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.d.ts +25 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.js +84 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.d.ts +6 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.js +117 -0
- package/dist/build-and-import/rollupPlugins/utils.d.ts +3 -0
- package/dist/build-and-import/rollupPlugins/utils.d.ts.map +1 -0
- package/dist/build-and-import/rollupPlugins/utils.js +43 -0
- package/dist/build-and-import/utils.d.ts +14 -0
- package/dist/build-and-import/utils.d.ts.map +1 -0
- package/dist/build-and-import/utils.js +30 -0
- package/dist/detection/{index.d.ts → detection.d.ts} +1 -1
- package/dist/detection/detection.d.ts.map +1 -0
- package/dist/detection/detection.js +24 -0
- package/dist/errors.js +4 -30
- package/dist/graphql/graphql.d.ts +5 -5
- package/dist/graphql/graphql.d.ts.map +1 -1
- package/dist/graphql/graphql.js +17 -52
- package/dist/graphql/node-runner.d.ts +11 -0
- package/dist/graphql/node-runner.d.ts.map +1 -0
- package/dist/graphql/node-runner.js +90 -0
- package/dist/graphql/vite-plugin-cedar-auto-import.d.ts +2 -0
- package/dist/graphql/vite-plugin-cedar-auto-import.d.ts.map +1 -0
- package/dist/graphql/vite-plugin-cedar-auto-import.js +77 -0
- package/dist/graphql/vite-plugin-cedar-import-dir.d.ts +19 -0
- package/dist/graphql/vite-plugin-cedar-import-dir.d.ts.map +1 -0
- package/dist/graphql/vite-plugin-cedar-import-dir.js +84 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -22
- package/dist/internal.d.ts +24 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +66 -52
- package/dist/runPrerender.d.ts.map +1 -1
- package/dist/runPrerender.js +116 -137
- package/package.json +24 -12
- package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -5
- package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/dist/babelPlugins/babel-plugin-redwood-cell.js +0 -115
- package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts +0 -5
- package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts.map +0 -1
- package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.js +0 -94
- package/dist/babelPlugins/utils.d.ts +0 -2
- package/dist/babelPlugins/utils.d.ts.map +0 -1
- package/dist/babelPlugins/utils.js +0 -49
- package/dist/detection/index.d.ts.map +0 -1
- package/dist/detection/index.js +0 -48
|
@@ -1,94 +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
|
-
default: () => babel_plugin_redwood_prerender_media_imports_default
|
|
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");
|
|
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 babel_plugin_redwood_prerender_media_imports_default({ types: t }) {
|
|
55
|
-
const manifestPath = (0, import_path.join)((0, import_project_config.getPaths)().web.dist, "client-build-manifest.json");
|
|
56
|
-
const buildManifest = require(manifestPath);
|
|
57
|
-
return {
|
|
58
|
-
name: "babel-plugin-redwood-prerender-media-imports",
|
|
59
|
-
visitor: {
|
|
60
|
-
ImportDeclaration(p, state) {
|
|
61
|
-
const importPath = p.node.source.value;
|
|
62
|
-
const ext = (0, import_path.extname)(importPath);
|
|
63
|
-
const options = {
|
|
64
|
-
...defaultOptions,
|
|
65
|
-
...state.opts
|
|
66
|
-
};
|
|
67
|
-
if (ext && options.extensions.includes(ext)) {
|
|
68
|
-
const importConstName = getVariableName(p);
|
|
69
|
-
if (state.filename === void 0) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const absPath = (0, import_path.join)((0, import_path.dirname)(state.filename), p.node.source.value);
|
|
73
|
-
const viteManifestKey = (0, import_project_config.ensurePosixPath)(
|
|
74
|
-
(0, import_path.relative)((0, import_project_config.getPaths)().web.src, absPath)
|
|
75
|
-
);
|
|
76
|
-
const copiedAssetPath = buildManifest[viteManifestKey]?.file;
|
|
77
|
-
const assetSrc = copiedAssetPath ?? (0, import_utils.convertToDataUrl)(
|
|
78
|
-
(0, import_path.join)(state.file.opts.sourceRoot || "./", importPath)
|
|
79
|
-
);
|
|
80
|
-
if (importConstName) {
|
|
81
|
-
p.replaceWith(
|
|
82
|
-
t.variableDeclaration("const", [
|
|
83
|
-
t.variableDeclarator(
|
|
84
|
-
t.identifier(importConstName),
|
|
85
|
-
t.stringLiteral(assetSrc)
|
|
86
|
-
)
|
|
87
|
-
])
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
@@ -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,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var utils_exports = {};
|
|
30
|
-
__export(utils_exports, {
|
|
31
|
-
convertToDataUrl: () => convertToDataUrl
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(utils_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
|
-
var import_mime_types = __toESM(require("mime-types"));
|
|
36
|
-
function convertToDataUrl(assetPath) {
|
|
37
|
-
try {
|
|
38
|
-
const base64AssetContents = import_fs.default.readFileSync(assetPath, "base64");
|
|
39
|
-
const mimeType = import_mime_types.default.lookup(assetPath);
|
|
40
|
-
return `data:${mimeType};base64,${base64AssetContents}`;
|
|
41
|
-
} catch {
|
|
42
|
-
console.warn(`Could not read file ${assetPath} for conversion to data uri`);
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
convertToDataUrl
|
|
49
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;;;;;;;;;GAsBjC,CAAA"}
|
package/dist/detection/index.js
DELETED
|
@@ -1,48 +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 detection_exports = {};
|
|
20
|
-
__export(detection_exports, {
|
|
21
|
-
detectPrerenderRoutes: () => detectPrerenderRoutes
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(detection_exports);
|
|
24
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
25
|
-
var import_structure = require("@cedarjs/structure");
|
|
26
|
-
const detectPrerenderRoutes = () => {
|
|
27
|
-
const rwProject = (0, import_structure.getProject)((0, import_project_config.getPaths)().base);
|
|
28
|
-
const routes = rwProject.getRouter().routes;
|
|
29
|
-
const prerenderRoutes = routes.filter((route) => route.prerender).map((route) => ({
|
|
30
|
-
name: route.isNotFound ? "404" : route.name,
|
|
31
|
-
// `path` will be updated/expanded later where route parameters will be
|
|
32
|
-
// replaced with actual values
|
|
33
|
-
path: route.isNotFound ? "/404" : route.path,
|
|
34
|
-
// `routePath` is always the path specified on the <Route> component
|
|
35
|
-
// (or the special /404 path)
|
|
36
|
-
routePath: route.isNotFound ? "/404" : route.path,
|
|
37
|
-
hasParams: route.hasParameters,
|
|
38
|
-
id: route.id,
|
|
39
|
-
isNotFound: route.isNotFound,
|
|
40
|
-
filePath: route.page?.filePath,
|
|
41
|
-
pageIdentifier: route.page_identifier_str
|
|
42
|
-
}));
|
|
43
|
-
return prerenderRoutes;
|
|
44
|
-
};
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
detectPrerenderRoutes
|
|
48
|
-
});
|