@cedarjs/prerender 1.0.0-canary.12491 → 1.0.0-canary.12493

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 (42) hide show
  1. package/dist/browserUtils/index.js +4 -31
  2. package/dist/build-and-import/buildAndImport.d.ts.map +1 -1
  3. package/dist/build-and-import/buildAndImport.js +55 -84
  4. package/dist/build-and-import/load-tsconfig.d.js +0 -1
  5. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.d.ts.map +1 -1
  6. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.js +13 -45
  7. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js +15 -49
  8. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-external.js +7 -41
  9. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.js +2 -26
  10. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.js +8 -42
  11. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.js +17 -51
  12. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.js +21 -50
  13. package/dist/build-and-import/rollupPlugins/rollup-plugin-cedarjs-typescript.js +4 -28
  14. package/dist/build-and-import/rollupPlugins/utils.d.ts.map +1 -1
  15. package/dist/build-and-import/rollupPlugins/utils.js +6 -41
  16. package/dist/build-and-import/utils.js +7 -45
  17. package/dist/detection/{index.d.ts → detection.d.ts} +1 -1
  18. package/dist/detection/detection.d.ts.map +1 -0
  19. package/dist/detection/detection.js +24 -0
  20. package/dist/errors.js +4 -30
  21. package/dist/graphql/graphql.d.ts +5 -5
  22. package/dist/graphql/graphql.d.ts.map +1 -1
  23. package/dist/graphql/graphql.js +17 -52
  24. package/dist/graphql/node-runner.d.ts +8 -0
  25. package/dist/graphql/node-runner.d.ts.map +1 -0
  26. package/dist/graphql/node-runner.js +117 -0
  27. package/dist/graphql/vite-plugin-auto-import.d.ts +2 -0
  28. package/dist/graphql/vite-plugin-auto-import.d.ts.map +1 -0
  29. package/dist/graphql/vite-plugin-auto-import.js +26 -0
  30. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts +24 -0
  31. package/dist/graphql/vite-plugin-cedar-import-dir.d.ts.map +1 -0
  32. package/dist/graphql/vite-plugin-cedar-import-dir.js +151 -0
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -22
  36. package/dist/internal.d.ts.map +1 -1
  37. package/dist/internal.js +26 -64
  38. package/dist/runPrerender.d.ts.map +1 -1
  39. package/dist/runPrerender.js +66 -86
  40. package/package.json +20 -12
  41. package/dist/detection/index.d.ts.map +0 -1
  42. package/dist/detection/index.js +0 -48
@@ -1,36 +1,10 @@
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 browserUtils_exports = {};
20
- __export(browserUtils_exports, {
21
- BrowserOnly: () => BrowserOnly,
22
- isBrowser: () => isBrowser,
23
- isPrerendering: () => isPrerendering,
24
- useIsBrowser: () => useIsBrowser
25
- });
26
- module.exports = __toCommonJS(browserUtils_exports);
27
- var import_react = require("react");
1
+ import { useMemo } from "react";
28
2
  const isPrerendering = () => {
29
3
  return globalThis.__REDWOOD__PRERENDERING ?? false;
30
4
  };
31
5
  const isBrowser = !isPrerendering();
32
6
  const useIsBrowser = () => {
33
- return (0, import_react.useMemo)(() => {
7
+ return useMemo(() => {
34
8
  return !globalThis?.__REDWOOD__PRERENDERING;
35
9
  }, []);
36
10
  };
@@ -38,10 +12,9 @@ const BrowserOnly = ({ children }) => {
38
12
  const isBrowser2 = useIsBrowser();
39
13
  return isBrowser2 ? children : null;
40
14
  };
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
15
+ export {
43
16
  BrowserOnly,
44
17
  isBrowser,
45
18
  isPrerendering,
46
19
  useIsBrowser
47
- });
20
+ };
@@ -1 +1 @@
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,CAyHlD"}
1
+ {"version":3,"file":"buildAndImport.d.ts","sourceRoot":"","sources":["../../src/build-and-import/buildAndImport.ts"],"names":[],"mappings":"AAoCA,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,CA0HlD"}
@@ -1,76 +1,47 @@
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 buildAndImport_exports = {};
30
- __export(buildAndImport_exports, {
31
- buildAndImport: () => buildAndImport
32
- });
33
- module.exports = __toCommonJS(buildAndImport_exports);
34
- var import_node_fs = __toESM(require("node:fs"));
35
- var import_node_path = __toESM(require("node:path"));
36
- var import_plugin_alias = __toESM(require("@rollup/plugin-alias"));
37
- var import_plugin_commonjs = __toESM(require("@rollup/plugin-commonjs"));
38
- var import_plugin_node_resolve = require("@rollup/plugin-node-resolve");
39
- var import_plugin_replace = __toESM(require("@rollup/plugin-replace"));
40
- var import_rollup = require("rollup");
41
- var import_unplugin = __toESM(require("unimport/unplugin"));
42
- var import_project_config = require("@cedarjs/project-config");
43
- var import_internal = require("../internal");
44
- var import_rollup_plugin_cedarjs_cell = require("./rollupPlugins/rollup-plugin-cedarjs-cell");
45
- var import_rollup_plugin_cedarjs_directory_named_imports = require("./rollupPlugins/rollup-plugin-cedarjs-directory-named-imports");
46
- var import_rollup_plugin_cedarjs_external = require("./rollupPlugins/rollup-plugin-cedarjs-external");
47
- var import_rollup_plugin_cedarjs_ignore_html_and_css_imports = require("./rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports");
48
- var import_rollup_plugin_cedarjs_inject_file_globals = require("./rollupPlugins/rollup-plugin-cedarjs-inject-file-globals");
49
- var import_rollup_plugin_cedarjs_prerender_media_imports = require("./rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports");
50
- var import_rollup_plugin_cedarjs_routes_auto_loader = require("./rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader");
51
- var import_rollup_plugin_cedarjs_typescript = require("./rollupPlugins/rollup-plugin-cedarjs-typescript");
52
- var import_utils = require("./utils");
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import alias from "@rollup/plugin-alias";
4
+ import commonjs from "@rollup/plugin-commonjs";
5
+ import { nodeResolve } from "@rollup/plugin-node-resolve";
6
+ import replace from "@rollup/plugin-replace";
7
+ import { rollup } from "rollup";
8
+ import unimportPlugin from "unimport/unplugin";
9
+ import { getConfig, getPaths } from "@cedarjs/project-config";
10
+ import {
11
+ getPathsFromTypeScriptConfig,
12
+ parseTypeScriptConfigFiles
13
+ } from "../internal.js";
14
+ import { cellTransformPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-cell.js";
15
+ import { cedarjsDirectoryNamedImportPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-directory-named-imports.js";
16
+ import { externalPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-external.js";
17
+ import { ignoreHtmlAndCssImportsPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-ignore-html-and-css-imports.js";
18
+ import { injectFileGlobalsPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-inject-file-globals.js";
19
+ import { cedarjsPrerenderMediaImportsPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-prerender-media-imports.js";
20
+ import { cedarjsRoutesAutoLoaderPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-routes-auto-loader.js";
21
+ import { typescriptPlugin } from "./rollupPlugins/rollup-plugin-cedarjs-typescript.js";
22
+ import { getPkgType, isValidJsFile, makeFilePath } from "./utils.js";
23
+ const fix = (f) => f;
53
24
  const tsconfigPathsToRegExp = (paths) => {
54
25
  return Object.keys(paths || {}).map((key) => {
55
26
  return new RegExp(`^${key.replace(/\*/g, ".*")}$`);
56
27
  });
57
28
  };
58
29
  async function buildAndImport(options) {
59
- if (!(0, import_utils.isValidJsFile)(options.filepath)) {
30
+ if (!isValidJsFile(options.filepath)) {
60
31
  throw new Error(`${options.filepath} is not a valid JS file`);
61
32
  }
62
- const tsConfigs = (0, import_internal.parseTypeScriptConfigFiles)();
33
+ const tsConfigs = parseTypeScriptConfigFiles();
63
34
  const resolvePaths = tsconfigPathsToRegExp(
64
35
  tsConfigs.web?.compilerOptions?.paths || {}
65
36
  );
66
- const config = (0, import_project_config.getConfig)();
37
+ const config = getConfig();
67
38
  const useTrustedDocumentsGqlTag = config.graphql.trustedDocuments;
68
- const webBase = (0, import_project_config.getPaths)().web.base;
69
- const outDir = import_node_path.default.join((0, import_project_config.getPaths)().web.dist, "__prerender");
70
- if (!import_node_fs.default.existsSync(outDir)) {
71
- import_node_fs.default.mkdirSync(outDir, { recursive: true });
39
+ const webBase = getPaths().web.base;
40
+ const outDir = path.join(getPaths().web.dist, "__prerender");
41
+ if (!fs.existsSync(outDir)) {
42
+ fs.mkdirSync(outDir, { recursive: true });
72
43
  }
73
- const build = await (0, import_rollup.rollup)({
44
+ const build = await rollup({
74
45
  input: [options.filepath],
75
46
  output: {
76
47
  dir: outDir
@@ -79,40 +50,41 @@ async function buildAndImport(options) {
79
50
  logLevel: "debug",
80
51
  external: ["react", "react-dom"],
81
52
  plugins: [
82
- (0, import_rollup_plugin_cedarjs_external.externalPlugin)({
53
+ externalPlugin({
83
54
  notExternal: resolvePaths,
84
55
  filepath: options.filepath
85
56
  }),
86
- (0, import_plugin_node_resolve.nodeResolve)({
57
+ nodeResolve({
87
58
  preferBuiltins: true,
88
59
  exportConditions: ["node"],
89
60
  extensions: [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]
90
61
  }),
91
- (0, import_plugin_replace.default)({
62
+ // @ts-expect-error - Ignore type errors for now
63
+ replace({
92
64
  preventAssignment: true,
93
65
  "process.env.NODE_ENV": '"production"'
94
66
  }),
95
- (0, import_plugin_alias.default)({
67
+ fix(alias)({
96
68
  entries: [
97
69
  {
98
70
  find: "src",
99
- replacement: (0, import_project_config.getPaths)().web.src
71
+ replacement: getPaths().web.src
100
72
  },
101
73
  {
102
74
  find: "$api",
103
- replacement: (0, import_project_config.getPaths)().api.base
75
+ replacement: getPaths().api.base
104
76
  },
105
- ...(0, import_internal.getPathsFromTypeScriptConfig)(tsConfigs.web, webBase)
77
+ ...getPathsFromTypeScriptConfig(tsConfigs.web, webBase)
106
78
  ]
107
79
  }),
108
- (0, import_rollup_plugin_cedarjs_ignore_html_and_css_imports.ignoreHtmlAndCssImportsPlugin)(),
109
- (0, import_rollup_plugin_cedarjs_cell.cellTransformPlugin)(),
110
- (0, import_rollup_plugin_cedarjs_routes_auto_loader.cedarjsRoutesAutoLoaderPlugin)(),
111
- (0, import_rollup_plugin_cedarjs_directory_named_imports.cedarjsDirectoryNamedImportPlugin)(),
112
- (0, import_rollup_plugin_cedarjs_prerender_media_imports.cedarjsPrerenderMediaImportsPlugin)(),
113
- (0, import_plugin_commonjs.default)(),
114
- (0, import_rollup_plugin_cedarjs_typescript.typescriptPlugin)(options.filepath, tsConfigs.web),
115
- import_unplugin.default.rollup({
80
+ ignoreHtmlAndCssImportsPlugin(),
81
+ cellTransformPlugin(),
82
+ cedarjsRoutesAutoLoaderPlugin(),
83
+ cedarjsDirectoryNamedImportPlugin(),
84
+ cedarjsPrerenderMediaImportsPlugin(),
85
+ fix(commonjs)(),
86
+ typescriptPlugin(options.filepath, tsConfigs.web),
87
+ unimportPlugin.rollup({
116
88
  imports: [
117
89
  // import React from 'react'
118
90
  {
@@ -133,13 +105,13 @@ async function buildAndImport(options) {
133
105
  }
134
106
  ].filter((v) => Boolean(v))
135
107
  }),
136
- (0, import_rollup_plugin_cedarjs_inject_file_globals.injectFileGlobalsPlugin)()
108
+ injectFileGlobalsPlugin()
137
109
  ]
138
110
  });
139
111
  try {
140
112
  const { output } = await build.generate({
141
113
  dir: outDir,
142
- format: (0, import_utils.getPkgType)() === "module" ? "es" : "cjs",
114
+ format: getPkgType() === "module" ? "es" : "cjs",
143
115
  exports: "auto",
144
116
  sourcemap: "inline"
145
117
  });
@@ -147,19 +119,18 @@ async function buildAndImport(options) {
147
119
  if (chunk.type !== "chunk") {
148
120
  throw new Error("[bundle-require] Expected chunk output");
149
121
  }
150
- const chunkPath = import_node_path.default.join(outDir, chunk.fileName);
151
- await import_node_fs.default.promises.writeFile(chunkPath, chunk.code, "utf8");
122
+ const chunkPath = path.join(outDir, chunk.fileName);
123
+ await fs.promises.writeFile(chunkPath, chunk.code, "utf8");
152
124
  }
153
- const importPath = (0, import_utils.makeFilePath)(import_node_path.default.join(outDir, output[0].fileName));
125
+ const importPath = makeFilePath(path.join(outDir, output[0].fileName));
154
126
  return import(importPath);
155
127
  } finally {
156
128
  if (!options.preserveTemporaryFile) {
157
- await import_node_fs.default.promises.rm(outDir, { recursive: true, force: true });
129
+ await fs.promises.rm(outDir, { recursive: true, force: true });
158
130
  }
159
131
  await build.close();
160
132
  }
161
133
  }
162
- // Annotate the CommonJS export names for ESM import in node:
163
- 0 && (module.exports = {
134
+ export {
164
135
  buildAndImport
165
- });
136
+ };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-plugin-cedarjs-cell.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAepC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAmK5C"}
1
+ {"version":3,"file":"rollup-plugin-cedarjs-cell.d.ts","sourceRoot":"","sources":["../../../src/build-and-import/rollupPlugins/rollup-plugin-cedarjs-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAmBpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAmK5C"}
@@ -1,40 +1,9 @@
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 rollup_plugin_cedarjs_cell_exports = {};
30
- __export(rollup_plugin_cedarjs_cell_exports, {
31
- cellTransformPlugin: () => cellTransformPlugin
32
- });
33
- module.exports = __toCommonJS(rollup_plugin_cedarjs_cell_exports);
34
- var import_node_path = require("node:path");
35
- var import_generator = __toESM(require("@babel/generator"));
36
- var import_parser = require("@babel/parser");
37
- var import_traverse = __toESM(require("@babel/traverse"));
1
+ import { parse as parsePath } from "node:path";
2
+ import babelGenerator from "@babel/generator";
3
+ import { parse } from "@babel/parser";
4
+ import babelTraverse from "@babel/traverse";
5
+ const traverse = babelTraverse.default;
6
+ const generate = babelGenerator.default;
38
7
  const EXPECTED_EXPORTS_FROM_CELL = [
39
8
  "beforeQuery",
40
9
  "QUERY",
@@ -54,7 +23,7 @@ function cellTransformPlugin() {
54
23
  return null;
55
24
  }
56
25
  try {
57
- const ast = (0, import_parser.parse)(code, {
26
+ const ast = parse(code, {
58
27
  sourceType: "module",
59
28
  plugins: [
60
29
  "jsx",
@@ -73,7 +42,7 @@ function cellTransformPlugin() {
73
42
  });
74
43
  const exportNames = [];
75
44
  let hasDefaultExport = false;
76
- (0, import_traverse.default)(ast, {
45
+ traverse(ast, {
77
46
  ExportDefaultDeclaration() {
78
47
  hasDefaultExport = true;
79
48
  },
@@ -101,7 +70,7 @@ function cellTransformPlugin() {
101
70
  }
102
71
  const createCellHookName = exportNames.includes("data") ? "createServerCell" : "createCell";
103
72
  const importFrom = exportNames.includes("data") ? "@cedarjs/web/dist/components/cell/createServerCell" : "@cedarjs/web";
104
- (0, import_traverse.default)(ast, {
73
+ traverse(ast, {
105
74
  Program(path) {
106
75
  const importDeclaration = {
107
76
  type: "ImportDeclaration",
@@ -135,7 +104,7 @@ function cellTransformPlugin() {
135
104
  key: { type: "Identifier", name: "displayName" },
136
105
  value: {
137
106
  type: "StringLiteral",
138
- value: (0, import_node_path.parse)(id).name
107
+ value: parsePath(id).name
139
108
  },
140
109
  shorthand: false,
141
110
  computed: false
@@ -160,7 +129,7 @@ function cellTransformPlugin() {
160
129
  path.node.body.push(exportDefaultDeclaration);
161
130
  }
162
131
  });
163
- const result = (0, import_generator.default)(ast, {
132
+ const result = generate(ast, {
164
133
  retainLines: true,
165
134
  compact: false
166
135
  });
@@ -175,7 +144,6 @@ function cellTransformPlugin() {
175
144
  }
176
145
  };
177
146
  }
178
- // Annotate the CommonJS export names for ESM import in node:
179
- 0 && (module.exports = {
147
+ export {
180
148
  cellTransformPlugin
181
- });
149
+ };
@@ -1,52 +1,19 @@
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 rollup_plugin_cedarjs_directory_named_imports_exports = {};
30
- __export(rollup_plugin_cedarjs_directory_named_imports_exports, {
31
- cedarjsDirectoryNamedImportPlugin: () => cedarjsDirectoryNamedImportPlugin
32
- });
33
- module.exports = __toCommonJS(rollup_plugin_cedarjs_directory_named_imports_exports);
34
- var import_node_fs = __toESM(require("node:fs"));
35
- var import_node_path = __toESM(require("node:path"));
36
- var import_project_config = require("@cedarjs/project-config");
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { resolveFile } from "@cedarjs/project-config";
37
4
  function getNewPath(value, filename) {
38
- const dirname = import_node_path.default.dirname(value);
39
- const basename = import_node_path.default.basename(value);
5
+ const dirname = path.dirname(value);
6
+ const basename = path.basename(value);
40
7
  const indexImportPath = [dirname, basename, "index"].join("/");
41
- const resolvedFile = (0, import_project_config.resolveFile)(
42
- import_node_path.default.resolve(import_node_path.default.dirname(filename), indexImportPath)
8
+ const resolvedFile = resolveFile(
9
+ path.resolve(path.dirname(filename), indexImportPath)
43
10
  );
44
11
  if (resolvedFile) {
45
12
  return resolvedFile;
46
13
  } else {
47
14
  const dirnameImportPath = [dirname, basename, basename].join("/");
48
- const dirnameResolvedFile = (0, import_project_config.resolveFile)(
49
- import_node_path.default.resolve(import_node_path.default.dirname(filename), dirnameImportPath)
15
+ const dirnameResolvedFile = resolveFile(
16
+ path.resolve(path.dirname(filename), dirnameImportPath)
50
17
  );
51
18
  if (dirnameResolvedFile) {
52
19
  return dirnameResolvedFile;
@@ -61,9 +28,9 @@ function cedarjsDirectoryNamedImportPlugin() {
61
28
  if (!importer || importer.includes("/node_modules/")) {
62
29
  return null;
63
30
  }
64
- const resolvedPath = import_node_path.default.resolve(import_node_path.default.dirname(importer), id);
65
- if (import_node_fs.default.existsSync(resolvedPath)) {
66
- const stats = import_node_fs.default.statSync(resolvedPath);
31
+ const resolvedPath = path.resolve(path.dirname(importer), id);
32
+ if (fs.existsSync(resolvedPath)) {
33
+ const stats = fs.statSync(resolvedPath);
67
34
  if (stats.isFile()) {
68
35
  return null;
69
36
  }
@@ -72,12 +39,11 @@ function cedarjsDirectoryNamedImportPlugin() {
72
39
  if (!newPath) {
73
40
  return null;
74
41
  }
75
- const resolvedDirnamePath = import_node_path.default.resolve(import_node_path.default.dirname(importer), newPath);
42
+ const resolvedDirnamePath = path.resolve(path.dirname(importer), newPath);
76
43
  return resolvedDirnamePath;
77
44
  }
78
45
  };
79
46
  }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
47
+ export {
82
48
  cedarjsDirectoryNamedImportPlugin
83
- });
49
+ };
@@ -1,38 +1,5 @@
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 rollup_plugin_cedarjs_external_exports = {};
30
- __export(rollup_plugin_cedarjs_external_exports, {
31
- externalPlugin: () => externalPlugin
32
- });
33
- module.exports = __toCommonJS(rollup_plugin_cedarjs_external_exports);
34
- var import_node_path = __toESM(require("node:path"));
35
- var import_node_url = require("node:url");
1
+ import path from "node:path";
2
+ import { pathToFileURL } from "node:url";
36
3
  const PATH_NODE_MODULES_RE = /[\/\\]node_modules[\/\\]/;
37
4
  const externalPlugin = ({
38
5
  external,
@@ -95,13 +62,13 @@ const externalPlugin = ({
95
62
  return null;
96
63
  }
97
64
  if (extNodeModules && id.match(PATH_NODE_MODULES_RE)) {
98
- const resolved = id.startsWith(".") && importer ? import_node_path.default.resolve(import_node_path.default.dirname(importer), id) : id;
65
+ const resolved = id.startsWith(".") && importer ? path.resolve(path.dirname(importer), id) : id;
99
66
  return {
100
- id: (0, import_node_url.pathToFileURL)(resolved).toString(),
67
+ id: pathToFileURL(resolved).toString(),
101
68
  external: true
102
69
  };
103
70
  }
104
- if (id.startsWith(".") || import_node_path.default.isAbsolute(id)) {
71
+ if (id.startsWith(".") || path.isAbsolute(id)) {
105
72
  return null;
106
73
  }
107
74
  return { id, external: true };
@@ -119,7 +86,6 @@ function match(id, patterns) {
119
86
  return id === p || id.startsWith(p + "/");
120
87
  });
121
88
  }
122
- // Annotate the CommonJS export names for ESM import in node:
123
- 0 && (module.exports = {
89
+ export {
124
90
  externalPlugin
125
- });
91
+ };
@@ -1,26 +1,3 @@
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 rollup_plugin_cedarjs_ignore_html_and_css_imports_exports = {};
20
- __export(rollup_plugin_cedarjs_ignore_html_and_css_imports_exports, {
21
- ignoreHtmlAndCssImportsPlugin: () => ignoreHtmlAndCssImportsPlugin
22
- });
23
- module.exports = __toCommonJS(rollup_plugin_cedarjs_ignore_html_and_css_imports_exports);
24
1
  const ignoreHtmlAndCssImportsPlugin = () => {
25
2
  const fileTypes = [".html", ".scss", ".css"];
26
3
  return {
@@ -42,7 +19,6 @@ const ignoreHtmlAndCssImportsPlugin = () => {
42
19
  }
43
20
  };
44
21
  };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
22
+ export {
47
23
  ignoreHtmlAndCssImportsPlugin
48
- });
24
+ };
@@ -1,39 +1,6 @@
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 rollup_plugin_cedarjs_inject_file_globals_exports = {};
30
- __export(rollup_plugin_cedarjs_inject_file_globals_exports, {
31
- injectFileGlobalsPlugin: () => injectFileGlobalsPlugin
32
- });
33
- module.exports = __toCommonJS(rollup_plugin_cedarjs_inject_file_globals_exports);
34
- var import_node_path = __toESM(require("node:path"));
35
- var import_node_url = require("node:url");
36
- var import_utils = require("../utils");
1
+ import path from "node:path";
2
+ import { pathToFileURL } from "node:url";
3
+ import { JS_EXT_RE } from "../utils.js";
37
4
  const DIRNAME_VAR_NAME = "__injected_dirname__";
38
5
  const FILENAME_VAR_NAME = "__injected_filename__";
39
6
  const IMPORT_META_URL_VAR_NAME = "__injected_import_meta_url__";
@@ -41,15 +8,15 @@ const injectFileGlobalsPlugin = () => {
41
8
  return {
42
9
  name: "bundle-require:inject-file-globals",
43
10
  transform(code, id) {
44
- if (!import_utils.JS_EXT_RE.test(id)) {
11
+ if (!JS_EXT_RE.test(id)) {
45
12
  return null;
46
13
  }
47
14
  const transformedCode = code.replace(/\b__filename\b/g, FILENAME_VAR_NAME).replace(/\b__dirname\b/g, DIRNAME_VAR_NAME).replace(/\bimport\.meta\.url\b/g, IMPORT_META_URL_VAR_NAME);
48
15
  const injectLines = [
49
16
  `const ${FILENAME_VAR_NAME} = ${JSON.stringify(id)};`,
50
- `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(import_node_path.default.dirname(id))};`,
17
+ `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(path.dirname(id))};`,
51
18
  `const ${IMPORT_META_URL_VAR_NAME} = ${JSON.stringify(
52
- (0, import_node_url.pathToFileURL)(id).href
19
+ pathToFileURL(id).href
53
20
  )};`
54
21
  ];
55
22
  return {
@@ -60,7 +27,6 @@ const injectFileGlobalsPlugin = () => {
60
27
  }
61
28
  };
62
29
  };
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
30
+ export {
65
31
  injectFileGlobalsPlugin
66
- });
32
+ };