@cedarjs/prerender 4.1.1-next.14 → 4.1.1-next.64

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.
@@ -22,9 +22,6 @@ __export(node_runner_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(node_runner_exports);
24
24
  var import_vite = require("vite");
25
- var import_client = require("vite-node/client");
26
- var import_server = require("vite-node/server");
27
- var import_source_map = require("vite-node/source-map");
28
25
  var import_project_config = require("@cedarjs/project-config");
29
26
  var import_vite2 = require("@cedarjs/vite");
30
27
  var import_vite_plugin_cedar_auto_import = require("./vite-plugin-cedar-auto-import.js");
@@ -33,10 +30,16 @@ async function createViteServer(customConfig = {}) {
33
30
  const defaultConfig = {
34
31
  mode: "production",
35
32
  optimizeDeps: {
36
- // This is recommended in the vite-node readme
37
33
  noDiscovery: true,
38
34
  include: void 0
39
35
  },
36
+ server: {
37
+ hmr: false,
38
+ watch: null
39
+ },
40
+ environments: {
41
+ nodeRunnerEnv: {}
42
+ },
40
43
  resolve: {
41
44
  alias: [
42
45
  {
@@ -46,6 +49,7 @@ async function createViteServer(customConfig = {}) {
46
49
  ]
47
50
  },
48
51
  plugins: [
52
+ (0, import_vite2.cedarCjsCompatPlugin)(),
49
53
  (0, import_vite_plugin_cedar_import_dir.cedarImportDirPlugin)(),
50
54
  (0, import_vite_plugin_cedar_auto_import.cedarAutoImportsPlugin)(),
51
55
  (0, import_vite2.cedarjsResolveCedarStyleImportsPlugin)(),
@@ -56,48 +60,33 @@ async function createViteServer(customConfig = {}) {
56
60
  };
57
61
  const mergedConfig = (0, import_vite.mergeConfig)(defaultConfig, customConfig);
58
62
  const server = await (0, import_vite.createServer)(mergedConfig);
59
- if (Number(import_vite.version.split(".")[0]) < 6) {
60
- await server.pluginContainer.buildStart({});
61
- }
62
63
  return server;
63
64
  }
64
65
  class NodeRunner {
65
66
  viteServer = void 0;
66
- runner = void 0;
67
+ env = void 0;
67
68
  customViteConfig;
68
69
  constructor(customViteConfig = {}) {
69
70
  this.customViteConfig = customViteConfig;
70
71
  }
71
72
  async init() {
72
73
  this.viteServer = await createViteServer(this.customViteConfig);
73
- const nodeServer = new import_server.ViteNodeServer(this.viteServer, {
74
- transformMode: {
75
- ssr: [/.*/],
76
- web: [/\/web\//]
77
- },
78
- deps: {
79
- fallbackCJS: true
80
- }
81
- });
82
- (0, import_source_map.installSourcemapsSupport)({
83
- getSourceMap: (source) => nodeServer?.getSourceMap(source)
84
- });
85
- this.runner = new import_client.ViteNodeRunner({
86
- root: this.viteServer.config.root,
87
- base: this.viteServer.config.base,
88
- fetchModule(id) {
89
- return nodeServer.fetchModule(id);
90
- },
91
- resolveId(id, importer) {
92
- return nodeServer.resolveId(id, importer);
93
- }
94
- });
74
+ const env = this.viteServer.environments.nodeRunnerEnv;
75
+ if (!env || !(0, import_vite.isRunnableDevEnvironment)(env)) {
76
+ await this.viteServer.close();
77
+ throw new Error("Vite environment is not runnable.");
78
+ }
79
+ this.env = env;
95
80
  }
96
81
  async importFile(filePath) {
97
- if (!this.runner) {
82
+ if (!this.env) {
98
83
  await this.init();
99
84
  }
100
- return this.runner?.executeFile(filePath);
85
+ const env = this.env;
86
+ if (!env) {
87
+ throw new Error("NodeRunner failed to initialize");
88
+ }
89
+ return env.runner.import(filePath);
101
90
  }
102
91
  async close() {
103
92
  await this.viteServer?.close();
@@ -1,7 +1,7 @@
1
1
  import type { UserConfig } from 'vite';
2
2
  export declare class NodeRunner {
3
3
  private viteServer?;
4
- private runner?;
4
+ private env?;
5
5
  private readonly customViteConfig;
6
6
  constructor(customViteConfig?: UserConfig);
7
7
  init(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"node-runner.d.ts","sourceRoot":"","sources":["../../src/graphql/node-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,MAAM,CAAA;AAsDrD,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAC,CAA2B;IAC9C,OAAO,CAAC,MAAM,CAAC,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAY;gBAEjC,gBAAgB,GAAE,UAAe;IAIvC,IAAI;IA6BJ,UAAU,CAAC,QAAQ,EAAE,MAAM;IAQ3B,KAAK;CAGZ"}
1
+ {"version":3,"file":"node-runner.d.ts","sourceRoot":"","sources":["../../src/graphql/node-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyC,UAAU,EAAE,MAAM,MAAM,CAAA;AAsD7E,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAC,CAA2B;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAoC;IAChD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAY;gBAEjC,gBAAgB,GAAE,UAAe;IAIvC,IAAI;IAYJ,UAAU,CAAC,QAAQ,EAAE,MAAM;IAa3B,KAAK;CAGZ"}
@@ -1,13 +1,11 @@
1
- import { createServer, version as viteVersion, mergeConfig } from "vite";
2
- import { ViteNodeRunner } from "vite-node/client";
3
- import { ViteNodeServer } from "vite-node/server";
4
- import { installSourcemapsSupport } from "vite-node/source-map";
1
+ import { createServer, isRunnableDevEnvironment, mergeConfig } from "vite";
5
2
  import { getPaths } from "@cedarjs/project-config";
6
3
  import {
7
4
  cedarCellTransform,
8
5
  cedarjsResolveCedarStyleImportsPlugin,
9
6
  cedarjsJobPathInjectorPlugin,
10
- cedarSwapApolloProvider
7
+ cedarSwapApolloProvider,
8
+ cedarCjsCompatPlugin
11
9
  } from "@cedarjs/vite";
12
10
  import { cedarAutoImportsPlugin } from "./vite-plugin-cedar-auto-import.js";
13
11
  import { cedarImportDirPlugin } from "./vite-plugin-cedar-import-dir.js";
@@ -15,10 +13,16 @@ async function createViteServer(customConfig = {}) {
15
13
  const defaultConfig = {
16
14
  mode: "production",
17
15
  optimizeDeps: {
18
- // This is recommended in the vite-node readme
19
16
  noDiscovery: true,
20
17
  include: void 0
21
18
  },
19
+ server: {
20
+ hmr: false,
21
+ watch: null
22
+ },
23
+ environments: {
24
+ nodeRunnerEnv: {}
25
+ },
22
26
  resolve: {
23
27
  alias: [
24
28
  {
@@ -28,6 +32,7 @@ async function createViteServer(customConfig = {}) {
28
32
  ]
29
33
  },
30
34
  plugins: [
35
+ cedarCjsCompatPlugin(),
31
36
  cedarImportDirPlugin(),
32
37
  cedarAutoImportsPlugin(),
33
38
  cedarjsResolveCedarStyleImportsPlugin(),
@@ -38,48 +43,33 @@ async function createViteServer(customConfig = {}) {
38
43
  };
39
44
  const mergedConfig = mergeConfig(defaultConfig, customConfig);
40
45
  const server = await createServer(mergedConfig);
41
- if (Number(viteVersion.split(".")[0]) < 6) {
42
- await server.pluginContainer.buildStart({});
43
- }
44
46
  return server;
45
47
  }
46
48
  class NodeRunner {
47
49
  viteServer = void 0;
48
- runner = void 0;
50
+ env = void 0;
49
51
  customViteConfig;
50
52
  constructor(customViteConfig = {}) {
51
53
  this.customViteConfig = customViteConfig;
52
54
  }
53
55
  async init() {
54
56
  this.viteServer = await createViteServer(this.customViteConfig);
55
- const nodeServer = new ViteNodeServer(this.viteServer, {
56
- transformMode: {
57
- ssr: [/.*/],
58
- web: [/\/web\//]
59
- },
60
- deps: {
61
- fallbackCJS: true
62
- }
63
- });
64
- installSourcemapsSupport({
65
- getSourceMap: (source) => nodeServer?.getSourceMap(source)
66
- });
67
- this.runner = new ViteNodeRunner({
68
- root: this.viteServer.config.root,
69
- base: this.viteServer.config.base,
70
- fetchModule(id) {
71
- return nodeServer.fetchModule(id);
72
- },
73
- resolveId(id, importer) {
74
- return nodeServer.resolveId(id, importer);
75
- }
76
- });
57
+ const env = this.viteServer.environments.nodeRunnerEnv;
58
+ if (!env || !isRunnableDevEnvironment(env)) {
59
+ await this.viteServer.close();
60
+ throw new Error("Vite environment is not runnable.");
61
+ }
62
+ this.env = env;
77
63
  }
78
64
  async importFile(filePath) {
79
- if (!this.runner) {
65
+ if (!this.env) {
80
66
  await this.init();
81
67
  }
82
- return this.runner?.executeFile(filePath);
68
+ const env = this.env;
69
+ if (!env) {
70
+ throw new Error("NodeRunner failed to initialize");
71
+ }
72
+ return env.runner.import(filePath);
83
73
  }
84
74
  async close() {
85
75
  await this.viteServer?.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/prerender",
3
- "version": "4.1.1-next.14+69388bd68a",
3
+ "version": "4.1.1-next.64",
4
4
  "description": "CedarJS prerender",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,19 +69,19 @@
69
69
  "dependencies": {
70
70
  "@ast-grep/napi": "0.42.1",
71
71
  "@babel/generator": "7.29.1",
72
- "@babel/parser": "7.29.2",
72
+ "@babel/parser": "7.29.3",
73
73
  "@babel/traverse": "7.29.0",
74
- "@cedarjs/babel-config": "4.1.1-next.14+69388bd68a",
75
- "@cedarjs/project-config": "4.1.1-next.14+69388bd68a",
76
- "@cedarjs/router": "4.1.1-next.14+69388bd68a",
77
- "@cedarjs/structure": "4.1.1-next.14+69388bd68a",
78
- "@cedarjs/vite": "4.1.1-next.14+69388bd68a",
79
- "@cedarjs/web": "4.1.1-next.14+69388bd68a",
74
+ "@cedarjs/babel-config": "4.1.0",
75
+ "@cedarjs/project-config": "4.1.0",
76
+ "@cedarjs/router": "4.1.0",
77
+ "@cedarjs/structure": "4.1.0",
78
+ "@cedarjs/vite": "4.1.0",
79
+ "@cedarjs/web": "4.1.0",
80
80
  "@rollup/plugin-alias": "5.1.1",
81
81
  "@rollup/plugin-commonjs": "28.0.9",
82
82
  "@rollup/plugin-node-resolve": "16.0.3",
83
83
  "@rollup/plugin-replace": "6.0.3",
84
- "@swc/core": "1.15.32",
84
+ "@swc/core": "1.15.33",
85
85
  "@whatwg-node/fetch": "0.10.13",
86
86
  "babel-plugin-ignore-html-and-css-imports": "0.1.0",
87
87
  "cheerio": "1.2.0",
@@ -91,16 +91,15 @@
91
91
  "rollup-plugin-swc3": "0.12.1",
92
92
  "unimport": "5.7.0",
93
93
  "unplugin-auto-import": "19.3.0",
94
- "vite": "7.3.2",
95
- "vite-node": "3.2.4"
94
+ "vite": "7.3.2"
96
95
  },
97
96
  "devDependencies": {
98
- "@cedarjs/framework-tools": "4.1.1-next.14",
97
+ "@cedarjs/framework-tools": "4.1.1-next.64",
99
98
  "@types/mime-types": "2.1.4",
100
99
  "@types/react": "^18.2.55",
101
100
  "babel-plugin-tester": "11.0.4",
102
101
  "concurrently": "9.2.1",
103
- "publint": "0.3.18",
102
+ "publint": "0.3.20",
104
103
  "tsx": "4.21.0",
105
104
  "typescript": "5.9.3",
106
105
  "vitest": "3.2.4"
@@ -119,5 +118,5 @@
119
118
  "react": "react",
120
119
  "react-dom": "react-dom"
121
120
  },
122
- "gitHead": "69388bd68ad03ce3b1afd399167899369c2c08c1"
121
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
123
122
  }
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.