@cedarjs/prerender 0.9.0 → 0.9.1-next.19

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 (68) hide show
  1. package/dist/browserUtils/index.js +4 -31
  2. package/dist/build-and-import/buildAndImport.d.ts +12 -0
  3. package/dist/build-and-import/buildAndImport.d.ts.map +1 -0
  4. package/dist/build-and-import/buildAndImport.js +142 -0
  5. package/dist/build-and-import/load-tsconfig.d.js +0 -0
  6. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts +23 -0
  7. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts.map +1 -0
  8. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +149 -0
  9. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.d.ts +3 -0
  10. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.d.ts.map +1 -0
  11. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js +49 -0
  12. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.d.ts +9 -0
  13. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.d.ts.map +1 -0
  14. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.js +91 -0
  15. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts +24 -0
  16. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.d.ts.map +1 -0
  17. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.js +24 -0
  18. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.d.ts +3 -0
  19. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.d.ts.map +1 -0
  20. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.js +32 -0
  21. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.d.ts +25 -0
  22. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.d.ts.map +1 -0
  23. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.js +84 -0
  24. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.d.ts +6 -0
  25. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.d.ts.map +1 -0
  26. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.js +117 -0
  27. package/dist/build-and-import/rollupPlugins/utils.d.ts +3 -0
  28. package/dist/build-and-import/rollupPlugins/utils.d.ts.map +1 -0
  29. package/dist/build-and-import/rollupPlugins/utils.js +43 -0
  30. package/dist/build-and-import/utils.d.ts +14 -0
  31. package/dist/build-and-import/utils.d.ts.map +1 -0
  32. package/dist/build-and-import/utils.js +30 -0
  33. package/dist/detection/{index.d.ts → detection.d.ts} +1 -1
  34. package/dist/detection/detection.d.ts.map +1 -0
  35. package/dist/detection/detection.js +24 -0
  36. package/dist/errors.js +4 -30
  37. package/dist/graphql/graphql.d.ts +5 -5
  38. package/dist/graphql/graphql.d.ts.map +1 -1
  39. package/dist/graphql/graphql.js +17 -52
  40. package/dist/graphql/node-runner.d.ts +11 -0
  41. package/dist/graphql/node-runner.d.ts.map +1 -0
  42. package/dist/graphql/node-runner.js +90 -0
  43. package/dist/graphql/vite-plugin-cedar-auto-import.d.ts +2 -0
  44. package/dist/graphql/vite-plugin-cedar-auto-import.d.ts.map +1 -0
  45. package/dist/graphql/vite-plugin-cedar-auto-import.js +77 -0
  46. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts +19 -0
  47. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts.map +1 -0
  48. package/dist/graphql/vite-plugin-cedar-import-dir.js +84 -0
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -22
  52. package/dist/internal.d.ts +24 -0
  53. package/dist/internal.d.ts.map +1 -1
  54. package/dist/internal.js +66 -52
  55. package/dist/runPrerender.d.ts.map +1 -1
  56. package/dist/runPrerender.js +116 -137
  57. package/package.json +24 -12
  58. package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -5
  59. package/dist/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
  60. package/dist/babelPlugins/babel-plugin-redwood-cell.js +0 -115
  61. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts +0 -5
  62. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.d.ts.map +0 -1
  63. package/dist/babelPlugins/babel-plugin-redwood-prerender-media-imports.js +0 -94
  64. package/dist/babelPlugins/utils.d.ts +0 -2
  65. package/dist/babelPlugins/utils.d.ts.map +0 -1
  66. package/dist/babelPlugins/utils.js +0 -49
  67. package/dist/detection/index.d.ts.map +0 -1
  68. package/dist/detection/index.js +0 -48
@@ -0,0 +1,77 @@
1
+ import path from "node:path";
2
+ import unimportPlugin from "unimport/unplugin";
3
+ import autoImport from "unplugin-auto-import/vite";
4
+ import {
5
+ getConfig,
6
+ getPaths,
7
+ importStatementPath
8
+ } from "@cedarjs/project-config";
9
+ function cedarAutoImportsPlugin() {
10
+ const config = getConfig();
11
+ const cedarPaths = getPaths();
12
+ const useTrustedDocumentsGqlTag = config?.graphql?.trustedDocuments;
13
+ return [
14
+ autoImport({
15
+ // targets to transform
16
+ include: [
17
+ /web\/.*\.[tj]sx?$/,
18
+ // Assume we want the trusted documents gql tag import in all .jsx and
19
+ // .tsx files
20
+ /\.[tj]sx$/
21
+ ],
22
+ // global imports to register
23
+ imports: [
24
+ // import gql from 'graphql-tag'
25
+ !useTrustedDocumentsGqlTag && {
26
+ "graphql-tag": ["gql"]
27
+ },
28
+ // import { gql } from 'src/graphql/gql'
29
+ useTrustedDocumentsGqlTag && {
30
+ [importStatementPath(
31
+ path.join(cedarPaths.web.base, "src", "graphql", "gql")
32
+ )]: ["gql"]
33
+ }
34
+ ].filter((v) => Boolean(v)),
35
+ // Types aren't important since the output is ephemeral
36
+ dts: false
37
+ }),
38
+ autoImport({
39
+ // targets to transform
40
+ include: [/\.[tj]sx?$/],
41
+ // global imports to register
42
+ imports: [
43
+ {
44
+ "@cedarjs/context": ["context"]
45
+ }
46
+ ],
47
+ // Types aren't important since the output is ephemeral
48
+ dts: false
49
+ }),
50
+ autoImport({
51
+ // targets to transform
52
+ include: [/api\/.*\.[tj]sx?$/],
53
+ // global imports to register
54
+ imports: [
55
+ // import gql from 'graphql-tag'
56
+ {
57
+ "graphql-tag": ["gql"]
58
+ }
59
+ ],
60
+ // Types aren't important since the output is ephemeral
61
+ dts: false
62
+ }),
63
+ unimportPlugin.vite({
64
+ imports: [
65
+ // import React from 'react'
66
+ {
67
+ name: "default",
68
+ as: "React",
69
+ from: "react"
70
+ }
71
+ ]
72
+ })
73
+ ];
74
+ }
75
+ export {
76
+ cedarAutoImportsPlugin
77
+ };
@@ -0,0 +1,19 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * This Vite plugin will search for import statements that include a glob double
4
+ * star `**` in the source part of the statement. The files that are matched are
5
+ * imported and appended to an object.
6
+ *
7
+ * @example
8
+ * Given a directory "src/services" that contains "a.js", "b.ts" and
9
+ * "nested/c.js" will produce the following results:
10
+ * ```js
11
+ * import services from 'src/services/**\/*.{js,ts}'
12
+ * console.log(services)
13
+ * // services.a = import('src/services/a')
14
+ * // services.b = import('src/services/b')
15
+ * // services.nested_c = import('src/services/nested/c')
16
+ * ```
17
+ */
18
+ export declare function cedarImportDirPlugin(): Plugin;
19
+ //# sourceMappingURL=vite-plugin-cedar-import-dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-cedar-import-dir.d.ts","sourceRoot":"","sources":["../../src/graphql/vite-plugin-cedar-import-dir.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAgH7C"}
@@ -0,0 +1,84 @@
1
+ import path from "node:path";
2
+ import { parse, Lang } from "@ast-grep/napi";
3
+ import fg from "fast-glob";
4
+ import { importStatementPath, getPaths } from "@cedarjs/project-config";
5
+ function cedarImportDirPlugin() {
6
+ return {
7
+ name: "vite-plugin-cedar-import-dir",
8
+ enforce: "pre",
9
+ async transform(code, id) {
10
+ if (!code.includes("/**/")) {
11
+ return null;
12
+ }
13
+ const ext = path.extname(id);
14
+ const language = ext === ".ts" || ext === ".tsx" ? Lang.TypeScript : Lang.JavaScript;
15
+ let ast;
16
+ try {
17
+ ast = parse(language, code);
18
+ } catch (error) {
19
+ console.warn("Failed to parse file:", id);
20
+ console.warn(error);
21
+ return null;
22
+ }
23
+ const root = ast.root();
24
+ let hasTransformations = false;
25
+ const edits = [];
26
+ const globImports = root.findAll({
27
+ rule: {
28
+ pattern: "import $DEFAULT_IMPORT from $SOURCE"
29
+ }
30
+ });
31
+ for (const importNode of globImports) {
32
+ const sourceNode = importNode.getMatch("SOURCE");
33
+ const defaultImportNode = importNode.getMatch("DEFAULT_IMPORT");
34
+ if (!sourceNode || !defaultImportNode) {
35
+ continue;
36
+ }
37
+ const sourceValue = sourceNode.text().slice(1, -1);
38
+ if (!sourceValue.includes("/**/")) {
39
+ continue;
40
+ }
41
+ hasTransformations = true;
42
+ const importName = defaultImportNode.text();
43
+ const importGlob = importStatementPath(sourceValue);
44
+ const cwd = importGlob.startsWith("src/") ? getPaths().api.base : path.dirname(id);
45
+ try {
46
+ const dirFiles = fg.sync(importGlob, { cwd }).filter(
47
+ (n) => !n.includes(".test.") && !n.includes(".scenarios.") && !n.includes(".d.ts")
48
+ );
49
+ const staticGlob = importGlob.split("*")[0];
50
+ const filePathToVarName = (filePath) => {
51
+ return filePath.replace(staticGlob, "").replace(/\.(js|ts)$/, "").replace(/[^a-zA-Z0-9]/g, "_");
52
+ };
53
+ let replacement = `let ${importName} = {};
54
+ `;
55
+ for (const filePath of dirFiles) {
56
+ const { dir: fileDir, name: fileName } = path.parse(filePath);
57
+ const fileImportPath = fileDir + "/" + fileName;
58
+ const filePathVarName = filePathToVarName(filePath);
59
+ const namespaceImportName = `${importName}_${filePathVarName}`;
60
+ replacement += `import * as ${namespaceImportName} from '${fileImportPath}';
61
+ `;
62
+ replacement += `${importName}.${filePathVarName} = ${namespaceImportName};
63
+ `;
64
+ }
65
+ edits.push(importNode.replace(replacement.trim()));
66
+ } catch (error) {
67
+ console.warn(`Failed to process glob import: ${sourceValue}`, error);
68
+ }
69
+ }
70
+ if (hasTransformations && edits.length > 0) {
71
+ const transformedCode = root.commitEdits(edits);
72
+ return {
73
+ code: transformedCode,
74
+ map: null
75
+ // For simplicity, not generating source maps
76
+ };
77
+ }
78
+ return null;
79
+ }
80
+ };
81
+ }
82
+ export {
83
+ cedarImportDirPlugin
84
+ };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './runPrerender';
1
+ export * from './runPrerender.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -1,22 +1 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var index_exports = {};
17
- module.exports = __toCommonJS(index_exports);
18
- __reExport(index_exports, require("./runPrerender"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./runPrerender")
22
- });
1
+ export * from "./runPrerender.js";
@@ -1,4 +1,28 @@
1
1
  export declare const getRootHtmlPath: () => string;
2
2
  export declare const registerShims: (routerPath: string) => void;
3
3
  export declare const writeToDist: (outputHtmlPath: string, renderOutput: string) => void;
4
+ /**
5
+ * Finds, reads and parses the [ts|js]config.json file
6
+ * @returns The config object
7
+ */
8
+ export declare const parseTypeScriptConfigFiles: () => {
9
+ api: any;
10
+ web: any;
11
+ };
12
+ type CompilerOptionsForPaths = {
13
+ compilerOptions: {
14
+ baseUrl: string;
15
+ paths: Record<string, string[]>;
16
+ };
17
+ };
18
+ /**
19
+ * Extracts and formats the paths from the [ts|js]config.json file
20
+ * @param config The config object
21
+ * @param rootDir {string} Where the jsconfig/tsconfig is loaded from
22
+ */
23
+ export declare function getPathsFromTypeScriptConfig(config: CompilerOptionsForPaths, rootDir: string): {
24
+ find: string;
25
+ replacement: string;
26
+ }[];
27
+ export {};
4
28
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,cAM3B,CAAA;AAED,eAAO,MAAM,aAAa,eAAgB,MAAM,SAmC/C,CAAA;AAED,eAAO,MAAM,WAAW,mBAAoB,MAAM,gBAAgB,MAAM,SAQvE,CAAA"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,cAM3B,CAAA;AAED,eAAO,MAAM,aAAa,eAAgB,MAAM,SAiC/C,CAAA;AAED,eAAO,MAAM,WAAW,mBAAoB,MAAM,gBAAgB,MAAM,SAQvE,CAAA;AAGD;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;CA0BtC,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CACtE,CAAA;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,MAAM;UAsBQ,MAAM;iBAAe,MAAM;IAkBnD"}
package/dist/internal.js CHANGED
@@ -1,60 +1,26 @@
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 internal_exports = {};
30
- __export(internal_exports, {
31
- getRootHtmlPath: () => getRootHtmlPath,
32
- registerShims: () => registerShims,
33
- writeToDist: () => writeToDist
34
- });
35
- module.exports = __toCommonJS(internal_exports);
36
- var import_fs = __toESM(require("fs"));
37
- var import_path = __toESM(require("path"));
38
- var import_fetch = require("@whatwg-node/fetch");
39
- var import_project_config = require("@cedarjs/project-config");
40
- const INDEX_FILE = import_path.default.join((0, import_project_config.getPaths)().web.dist, "index.html");
41
- const DEFAULT_INDEX = import_path.default.join((0, import_project_config.getPaths)().web.dist, "200.html");
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fetch } from "@whatwg-node/fetch";
4
+ import { parseConfigFileTextToJson } from "typescript";
5
+ import { getConfig, getPaths } from "@cedarjs/project-config";
6
+ const INDEX_FILE = path.join(getPaths().web.dist, "index.html");
7
+ const DEFAULT_INDEX = path.join(getPaths().web.dist, "200.html");
42
8
  const getRootHtmlPath = () => {
43
- if (import_fs.default.existsSync(DEFAULT_INDEX)) {
9
+ if (fs.existsSync(DEFAULT_INDEX)) {
44
10
  return DEFAULT_INDEX;
45
11
  } else {
46
12
  return INDEX_FILE;
47
13
  }
48
14
  };
49
15
  const registerShims = (routerPath) => {
50
- const rwjsConfig = (0, import_project_config.getConfig)();
16
+ const rwjsConfig = getConfig();
51
17
  globalThis.RWJS_ENV = {
52
18
  RWJS_API_GRAPHQL_URL: rwjsConfig.web.apiGraphQLUrl ?? rwjsConfig.web.apiUrl + "/graphql",
53
19
  RWJS_API_URL: rwjsConfig.web.apiUrl,
54
20
  __REDWOOD__APP_TITLE: rwjsConfig.web.title
55
21
  };
56
22
  globalThis.RWJS_DEBUG_ENV = {
57
- RWJS_SRC_ROOT: (0, import_project_config.getPaths)().web.src
23
+ RWJS_SRC_ROOT: getPaths().web.src
58
24
  };
59
25
  globalThis.__REDWOOD__PRERENDERING = true;
60
26
  globalThis.__REDWOOD__HELMET_CONTEXT = {};
@@ -64,20 +30,68 @@ const registerShims = (routerPath) => {
64
30
  pathname: routerPath
65
31
  };
66
32
  if (!globalThis.fetch) {
67
- globalThis.fetch = import_fetch.fetch;
33
+ globalThis.fetch = fetch;
68
34
  }
69
35
  };
70
36
  const writeToDist = (outputHtmlPath, renderOutput) => {
71
- const dirName = import_path.default.dirname(outputHtmlPath);
72
- const exist = import_fs.default.existsSync(dirName);
37
+ const dirName = path.dirname(outputHtmlPath);
38
+ const exist = fs.existsSync(dirName);
73
39
  if (!exist) {
74
- import_fs.default.mkdirSync(dirName, { recursive: true });
40
+ fs.mkdirSync(dirName, { recursive: true });
75
41
  }
76
- import_fs.default.writeFileSync(outputHtmlPath, renderOutput);
42
+ fs.writeFileSync(outputHtmlPath, renderOutput);
43
+ };
44
+ const parseTypeScriptConfigFiles = () => {
45
+ const rwPaths = getPaths();
46
+ const parseConfigFile = (basePath) => {
47
+ let configPath = path.join(basePath, "tsconfig.json");
48
+ if (!fs.existsSync(configPath)) {
49
+ configPath = path.join(basePath, "jsconfig.json");
50
+ if (!fs.existsSync(configPath)) {
51
+ return null;
52
+ }
53
+ }
54
+ return parseConfigFileTextToJson(
55
+ configPath,
56
+ fs.readFileSync(configPath, "utf-8")
57
+ );
58
+ };
59
+ const apiConfig = parseConfigFile(rwPaths.api.base);
60
+ const webConfig = parseConfigFile(rwPaths.web.base);
61
+ return {
62
+ api: apiConfig?.config ?? null,
63
+ web: webConfig?.config ?? null
64
+ };
77
65
  };
78
- // Annotate the CommonJS export names for ESM import in node:
79
- 0 && (module.exports = {
66
+ function getPathsFromTypeScriptConfig(config, rootDir) {
67
+ if (!config) {
68
+ return [];
69
+ }
70
+ if (!config.compilerOptions?.paths) {
71
+ return [];
72
+ }
73
+ const { baseUrl, paths } = config.compilerOptions;
74
+ let absoluteBase;
75
+ if (baseUrl) {
76
+ absoluteBase = path.isAbsolute(baseUrl) ? baseUrl : path.join(rootDir, baseUrl);
77
+ } else {
78
+ absoluteBase = rootDir;
79
+ }
80
+ const aliases = [];
81
+ for (const [key, value] of Object.entries(paths)) {
82
+ if (key.match(/src\/|\$api\/\*|types\/\*|\@cedarjs\/.*/g)) {
83
+ continue;
84
+ }
85
+ const aliasKey = key.replace("/*", "");
86
+ const aliasValue = path.join(absoluteBase, value[0].replace("/*", ""));
87
+ aliases.push({ find: aliasKey, replacement: aliasValue });
88
+ }
89
+ return aliases;
90
+ }
91
+ export {
92
+ getPathsFromTypeScriptConfig,
80
93
  getRootHtmlPath,
94
+ parseTypeScriptConfigFiles,
81
95
  registerShims,
82
96
  writeToDist
83
- });
97
+ };
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"runPrerender.d.ts","sourceRoot":"","sources":["../src/runPrerender.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAmQ7C,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,CAwHzC,CAAA;AAGD,eAAO,MAAM,wBAAwB,mBACnB,MAAM,WACb,MAAM,SAchB,CAAA"}