@edgeone/react-router 1.0.4 → 1.1.0

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/index.d.ts CHANGED
@@ -1,20 +1,12 @@
1
1
  /**
2
- * EdgeOne Adapter Plugin for React Router
3
- *
4
- * Automatically performs post-processing after React Router build completion,
5
- * converting build artifacts to a format deployable on the EdgeOne platform
2
+ * EdgeOne adapter for React Router v7 (SSR/SPA/Prerendering)
6
3
  */
7
4
  import type { Plugin } from "vite";
8
- /**
9
- * Plugin configuration options
10
- */
11
- export interface EdgeOneAdapterOptions {
12
- /** Whether to enable verbose logging, default false */
13
- verbose?: boolean;
5
+ import { type ReactRouterAdapterOptions } from "@chuckcchen/vite-plugin";
6
+ export interface ReactRouterEdgeoneAdapterOptions extends ReactRouterAdapterOptions {
14
7
  }
15
- /**
16
- * EdgeOne adapter plugin
17
- */
18
- export declare function edgeoneAdapter(options?: EdgeOneAdapterOptions): Plugin;
19
- export default edgeoneAdapter;
8
+ export declare function edgeoneReactRouterAdapter(options?: ReactRouterEdgeoneAdapterOptions): Plugin;
9
+ export default edgeoneReactRouterAdapter;
10
+ export { edgeoneReactRouterAdapter as edgeoneAdapter };
11
+ export type { ReactRouterAdapterOptions, RouteInfo, MetaConfig, BuildContext, BuildArtifacts, } from "@chuckcchen/vite-plugin";
20
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAsHD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,CAuwB1E;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAkBL,KAAK,yBAAyB,EAI/B,MAAM,yBAAyB,CAAC;AAgDjC,MAAM,WAAW,gCAAiC,SAAQ,yBAAyB;CAAG;AA6ItF,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,gCAAqC,GAAG,MAAM,CAKhG;AAED,eAAe,yBAAyB,CAAC;AACzC,OAAO,EAAE,yBAAyB,IAAI,cAAc,EAAE,CAAC;AAEvD,YAAY,EACV,yBAAyB,EACzB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,715 +1,146 @@
1
1
  /**
2
- * EdgeOne Adapter Plugin for React Router
3
- *
4
- * Automatically performs post-processing after React Router build completion,
5
- * converting build artifacts to a format deployable on the EdgeOne platform
2
+ * EdgeOne adapter for React Router v7 (SSR/SPA/Prerendering)
6
3
  */
7
- import * as esbuild from "esbuild";
8
- import fs from "fs/promises";
9
4
  import path from "path";
10
- /**
11
- * Format file size
12
- */
13
- // function formatSize(bytes: number): string {
14
- // if (bytes === 0) return "0 B";
15
- // const k = 1024;
16
- // const sizes = ["B", "KB", "MB", "GB"];
17
- // const i = Math.floor(Math.log(bytes) / Math.log(k));
18
- // return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
19
- // }
20
- /**
21
- * Parse prerender route configuration
22
- * Compatible with three formats: boolean, array, function
23
- * @returns { routes: string[], enableAll: boolean }
24
- * - routes: Specific list of prerender routes
25
- * - enableAll: Whether to enable prerender for all routes (when prerender is true)
26
- */
27
- async function resolvePrerenderRoutes(prerender) {
28
- if (!prerender) {
29
- return { routes: [], enableAll: false };
30
- }
31
- // 1. Boolean: true means enable prerender for all routes
32
- if (typeof prerender === "boolean") {
33
- return { routes: [], enableAll: true };
34
- }
35
- // 2. Array: directly return route list
36
- if (Array.isArray(prerender)) {
37
- return { routes: prerender, enableAll: false };
38
- }
39
- // 3. Function: call function to get route list
40
- if (typeof prerender === "function") {
41
- try {
42
- // Provide an empty getStaticPaths function as parameter
43
- // In actual projects, static paths might need to be obtained from route configuration
44
- const getStaticPaths = () => [];
45
- const routes = await Promise.resolve(prerender({ getStaticPaths }));
46
- return {
47
- routes: Array.isArray(routes) ? routes : [],
48
- enableAll: false,
49
- };
50
- }
51
- catch (error) {
52
- console.warn("[EdgeOne Adapter] Failed to call prerender function:", error);
53
- return { routes: [], enableAll: false };
54
- }
55
- }
56
- return { routes: [], enableAll: false };
5
+ import { createCoreAdapter, createStatefulAdapter, resolvePreset, pathExists, detectConfigFile, loadConfigFile, loadServerBuildRoutes, flattenRouteTree, generateServerWrapperCode, createDefaultMeta, convertRoutesToMetaFormat, logBuildArtifacts, } from "@chuckcchen/vite-plugin";
6
+ const REACT_ROUTER_SERVER_PRESET = {
7
+ imports: `import { createRequestHandler } from "react-router";`,
8
+ setup: `
9
+ const {
10
+ routes, assets, assetsBuildDirectory, basename,
11
+ entry, future, isSpaMode, publicPath, routeDiscovery, ssr
12
+ } = serverExports;
13
+
14
+ const buildConfig = {
15
+ assets, assetsBuildDirectory, basename, entry, future,
16
+ isSpaMode, publicPath, routes, routeDiscovery, ssr
17
+ };
18
+
19
+ const requestHandler = createRequestHandler(buildConfig);`,
20
+ invoke: "requestHandler(webRequest, ...args)",
21
+ };
22
+ /** Generate .data routes for React Router's Single Fetch */
23
+ function generateDataRoute(route, routePath, isStatic) {
24
+ if (isStatic || (!route.hasLoader && !route.hasAction))
25
+ return [];
26
+ if (routePath === "/")
27
+ return [{ path: "/_root.data", isStatic: false }];
28
+ if (routePath)
29
+ return [{ path: `${routePath}.data`, isStatic: false }];
30
+ return [];
57
31
  }
58
- /**
59
- * EdgeOne adapter plugin
60
- */
61
- export function edgeoneAdapter(options = {}) {
62
- const { verbose = false } = options;
63
- // Fixed configuration
64
- const outputDir = ".edgeone";
65
- const cleanOutput = true;
66
- let projectRoot;
67
- let isSSR = false;
68
- let prerenderRoutes = [];
69
- let prerenderEnabled = false; // Mark whether prerender is true
70
- let isBuildingForSSR = false; // Track if current build is for SSR
71
- const log = (message, ...args) => {
72
- console.log(`[EdgeOne Adapter] ${message}`, ...args);
73
- };
74
- const logVerbose = (message, ...args) => {
75
- if (verbose) {
76
- console.log(`[EdgeOne Adapter] ${message}`, ...args);
77
- }
78
- };
79
- return {
80
- name: "vite-plugin-edgeone-adapter",
81
- apply: "build",
82
- enforce: "post",
83
- configResolved(config) {
84
- projectRoot = config.root;
85
- // Detect if this is SSR build by checking build.ssr config
86
- isBuildingForSSR =
87
- config.build.ssr !== false && config.build.ssr !== undefined;
88
- logVerbose("Project root directory:", projectRoot);
89
- logVerbose("Current build type:", isBuildingForSSR ? "SSR" : "Client");
90
- },
91
- async writeBundle() {
92
- // Load React Router configuration first to know if SSR is enabled
93
- await loadReactRouterConfig();
94
- // Skip execution if:
95
- // 1. SSR is enabled in config AND
96
- // 2. Current build is NOT for SSR (i.e., it's client build)
97
- // This ensures we only run once after the server build completes
98
- if (isSSR && !isBuildingForSSR) {
99
- logVerbose("Skipping adapter execution (waiting for SSR build to complete)");
100
- return;
101
- }
102
- // Add a small delay to ensure all files are written
103
- await new Promise((resolve) => setTimeout(resolve, 100));
104
- try {
105
- // log("🚀 Starting EdgeOne adapter processing...\n");
106
- // 1. Wait for React Router build to complete
107
- await waitForBuildComplete();
108
- // 2. Clean output directory
109
- if (cleanOutput) {
110
- await cleanOutputDirectory();
111
- }
112
- // 3. Copy static assets
113
- await copyStaticAssets();
114
- // 4. Bundle server code (SSR mode only)
115
- if (isSSR) {
116
- await bundleServerCode();
32
+ function createReactRouterAdapter(_options) {
33
+ return createStatefulAdapter({ isSSR: true, isSpaMode: false, serverBuild: null, config: null }, (state) => ({
34
+ name: "react-router",
35
+ async detect(context) {
36
+ const { projectRoot, logger } = context;
37
+ const configPath = await detectConfigFile(projectRoot, [
38
+ "react-router.config.ts",
39
+ "react-router.config.js",
40
+ ]);
41
+ if (configPath) {
42
+ logger.verbose("Found React Router config:", configPath);
43
+ state.config = await loadConfigFile(configPath);
44
+ if (state.config?.ssr === false) {
45
+ state.isSSR = false;
46
+ state.isSpaMode = true;
117
47
  }
118
- // 5. Generate meta.json (SSR mode only)
119
- if (isSSR) {
120
- await generateMetaJson();
48
+ else if (state.config?.ssr === true) {
49
+ state.isSSR = true;
50
+ state.isSpaMode = false;
121
51
  }
122
- // log("\n✨ EdgeOne adapter processing completed!");
123
- // showUsageInstructions();
124
- }
125
- catch (error) {
126
- console.error("\n❌ EdgeOne adapter processing failed:", error);
127
- throw error;
52
+ return true;
128
53
  }
54
+ const buildDir = state.config?.buildDirectory || "build";
55
+ const buildPath = path.join(projectRoot, buildDir, "client");
56
+ return pathExists(buildPath);
129
57
  },
130
- };
131
- /**
132
- * Wait for React Router build to complete
133
- * Check if required build files exist, retry if not found
134
- */
135
- async function waitForBuildComplete() {
136
- const maxRetries = 15;
137
- const retryDelay = 300; // ms
138
- // Always check for client build
139
- const clientBuildPaths = [
140
- path.join(projectRoot, "build/client"),
141
- path.join(projectRoot, "build-csr/client"),
142
- path.join(projectRoot, "build-ssr/client"),
143
- ];
144
- // Check if any client build exists
145
- let clientBuildFound = false;
146
- for (const clientPath of clientBuildPaths) {
147
- try {
148
- await fs.access(clientPath);
149
- clientBuildFound = true;
150
- logVerbose(` ✅ Client build found: ${clientPath}`);
151
- break;
152
- }
153
- catch {
154
- continue;
58
+ async getBuildArtifacts(context) {
59
+ const { projectRoot, logger } = context;
60
+ const buildDir = state.config?.buildDirectory || "build";
61
+ const serverBuildFile = state.config?.serverBuildFile || "index.js";
62
+ const clientDir = path.join(projectRoot, buildDir, "client");
63
+ const serverDir = path.join(projectRoot, buildDir, "server");
64
+ const serverEntry = path.join(serverDir, serverBuildFile);
65
+ const hasClient = await pathExists(clientDir);
66
+ const hasServer = await pathExists(serverEntry);
67
+ if (!hasServer) {
68
+ state.isSSR = false;
69
+ state.isSpaMode = true;
155
70
  }
156
- }
157
- if (!clientBuildFound) {
158
- throw new Error("Client build directory not found. Please ensure React Router build completed successfully.");
159
- }
160
- // If SSR mode, check for server build (should exist since we run after SSR build)
161
- if (isSSR) {
162
- const serverBuildPath = path.join(projectRoot, "build/server/index.js");
163
- let serverBuildFound = false;
164
- // Since we're running after SSR build, the file should exist
165
- // But add a retry mechanism in case of file system delays
166
- for (let i = 0; i < maxRetries; i++) {
167
- try {
168
- await fs.access(serverBuildPath);
169
- serverBuildFound = true;
170
- logVerbose(` ✅ Server build found: ${serverBuildPath}`);
171
- break;
172
- }
173
- catch {
174
- if (i < maxRetries - 1) {
175
- await new Promise((resolve) => setTimeout(resolve, retryDelay));
71
+ else {
72
+ const serverBuild = await loadServerBuildRoutes(serverEntry, logger);
73
+ if (serverBuild) {
74
+ state.serverBuild = serverBuild;
75
+ if (state.config?.ssr === undefined) {
76
+ state.isSSR = serverBuild.ssr !== false;
77
+ state.isSpaMode = serverBuild.isSpaMode === true;
176
78
  }
177
79
  }
178
80
  }
179
- if (!serverBuildFound) {
180
- throw new Error(`Server build not found at ${serverBuildPath}. Please ensure React Router SSR build completed successfully.`);
181
- }
182
- }
183
- logVerbose(" ✅ Build files verification completed");
184
- }
185
- /**
186
- * Load React Router configuration
187
- */
188
- async function loadReactRouterConfig() {
189
- // log("📖 Loading React Router configuration...");
190
- try {
191
- // Try multiple possible config file paths and extensions
192
- const possibleConfigPaths = [
193
- path.join(projectRoot, "react-router.config.ts"),
194
- path.join(projectRoot, "react-router.config.js"),
195
- path.join(projectRoot, "react-router.config.mjs"),
196
- ];
197
- let configModule = null;
198
- // let foundConfigPath: string | null = null;
199
- for (const configPath of possibleConfigPaths) {
200
- try {
201
- // Check if file exists first
202
- await fs.access(configPath);
203
- // Use dynamic import with file:// protocol for better compatibility
204
- const fileUrl = `file://${configPath}`;
205
- configModule = await import(fileUrl);
206
- // foundConfigPath = configPath;
207
- logVerbose(` ✅ Found config file: ${configPath}`);
208
- break;
209
- }
210
- catch (error) {
211
- // Continue trying next path
212
- continue;
213
- }
214
- }
215
- if (!configModule) {
216
- throw new Error("Config file not found");
217
- }
218
- const config = configModule.default || configModule;
219
- // Read SSR configuration
220
- isSSR = config.ssr !== false;
221
- // Read prerender routes
222
- if (config.prerender) {
223
- const result = await resolvePrerenderRoutes(config.prerender);
224
- prerenderRoutes = result.routes;
225
- prerenderEnabled = result.enableAll;
226
- if (prerenderEnabled) {
227
- log(` Prerender mode: All routes`);
228
- }
229
- else if (prerenderRoutes.length > 0) {
230
- log(` Prerender routes: ${prerenderRoutes.join(", ")}`);
231
- }
232
- }
233
- log("");
234
- }
235
- catch (error) {
236
- logVerbose(` ⚠️ Unable to read react-router.config file: ${error}`);
237
- log(" ⚠️ Unable to read react-router.config.ts, using default configuration");
238
- log("");
239
- }
240
- }
241
- /**
242
- * Clean output directory
243
- */
244
- async function cleanOutputDirectory() {
245
- const outputPath = path.join(projectRoot, outputDir);
246
- const assetsPath = path.join(outputPath, "assets");
247
- const serverHandlerPath = path.join(outputPath, "server-handler");
248
- const metaPath = path.join(outputPath, "meta.json");
249
- try {
250
- // Clean assets and server-handler directories, as well as meta.json file
251
- await fs.rm(assetsPath, { recursive: true, force: true });
252
- await fs.rm(serverHandlerPath, { recursive: true, force: true });
253
- await fs.rm(metaPath, { force: true });
254
- logVerbose("🧹 Cleaned directories: assets, server-handler, meta.json");
255
- }
256
- catch (error) {
257
- // Directory might not exist, ignore error
258
- }
259
- // Ensure output directory exists
260
- await fs.mkdir(outputPath, { recursive: true });
261
- logVerbose("📁 Ensured output directory exists:", outputDir);
262
- logVerbose("");
263
- }
264
- /**
265
- * Copy static assets
266
- */
267
- async function copyStaticAssets() {
268
- // log("📦 Copying static assets...");
269
- const targetPath = path.join(projectRoot, outputDir, "assets");
270
- // Try multiple possible build artifact paths
271
- const possibleSourcePaths = [
272
- path.join(projectRoot, "build/client"),
273
- path.join(projectRoot, "build-csr/client"),
274
- path.join(projectRoot, "build-ssr/client"),
275
- ];
276
- let sourcePath = null;
277
- // Find existing build artifact directory
278
- for (const possiblePath of possibleSourcePaths) {
279
- try {
280
- await fs.access(possiblePath);
281
- sourcePath = possiblePath;
282
- logVerbose(` Found build artifacts: ${possiblePath}`);
283
- break;
284
- }
285
- catch (error) {
286
- // Continue trying next path
287
- continue;
288
- }
289
- }
290
- if (!sourcePath) {
291
- throw new Error(`Build artifact directory not found, please run build command first`);
292
- }
293
- try {
294
- // Recursively copy directory
295
- await fs.cp(sourcePath, targetPath, { recursive: true });
296
- // Count files
297
- // const fileCount = await countFiles(targetPath);
298
- // log(` ✅ Copied ${fileCount} files to ${outputDir}/assets`);
299
- }
300
- catch (error) {
301
- throw new Error(`Failed to copy static assets: ${error}`);
302
- }
303
- }
304
- /**
305
- * Bundle server code
306
- */
307
- async function bundleServerCode() {
308
- // log("🔨 Bundling server code...");
309
- const serverEntryPath = path.join(projectRoot, "build/server/index.js");
310
- const outputPath = path.join(projectRoot, outputDir, "server-handler");
311
- const outputFile = path.join(outputPath, "handler.js");
312
- try {
313
- // Check if entry file exists
314
- await fs.access(serverEntryPath);
315
- }
316
- catch (error) {
317
- log(" ⚠️ build/server/index.js does not exist, skipping server bundling");
318
- log(" Hint: Ensure React Router is configured for SSR mode and built correctly");
319
- log("");
320
- return;
321
- }
322
- try {
323
- // Create output directory
324
- await fs.mkdir(outputPath, { recursive: true });
325
- // Create server wrapper file
326
- const wrapperPath = await createServerWrapper(serverEntryPath);
327
- // Bundle using esbuild
328
- await esbuild.build({
329
- entryPoints: [wrapperPath],
330
- bundle: true,
331
- platform: "node",
332
- target: "node18",
333
- format: "esm",
334
- outfile: outputFile,
335
- minify: false,
336
- treeShaking: true,
337
- external: ["node:*"],
338
- metafile: true,
339
- logLevel: "warning",
340
- absWorkingDir: projectRoot,
341
- banner: {
342
- js: `import { createRequire } from 'node:module';
343
- const require = createRequire(import.meta.url);
344
- const __filename = new URL('', import.meta.url).pathname;
345
- const __dirname = new URL('.', import.meta.url).pathname;`,
346
- },
81
+ const needsServer = state.isSSR && !state.isSpaMode;
82
+ logBuildArtifacts(logger, "React Router", {
83
+ clientDir: hasClient ? clientDir : null,
84
+ serverDir: needsServer && hasServer ? serverDir : null,
85
+ serverEntry: needsServer && hasServer ? serverEntry : null,
347
86
  });
348
- // Clean up temporary file
349
- await fs.unlink(wrapperPath);
350
- // Show build statistics
351
- // const outputInfo =
352
- // result.metafile!.outputs[Object.keys(result.metafile!.outputs)[0]];
353
- // log(` ✅ Server code bundled`);
354
- // log(` File: ${outputDir}/server-handler/index.mjs`);
355
- // log(` Size: ${formatSize(outputInfo.bytes)}`);
356
- // log("");
357
- }
358
- catch (error) {
359
- throw new Error(`Failed to bundle server code: ${error}`);
360
- }
361
- }
362
- /**
363
- * Create server wrapper file
364
- */
365
- async function createServerWrapper(serverBuildPath) {
366
- logVerbose("📝 Creating server wrapper file...");
367
- // Read original build/server/index.js
368
- const serverBuildContent = await fs.readFile(serverBuildPath, "utf-8");
369
- const wrapperContent = `// ========== React Router Server Build ==========
370
- ${serverBuildContent}
371
-
372
- // ========== HTTP Server Wrapper ==========
373
- import { createRequestHandler } from "react-router";
374
-
375
- // Get exported build configuration
376
- const buildConfig = {
377
- assets: serverManifest,
378
- assetsBuildDirectory,
379
- basename,
380
- entry,
381
- future,
382
- isSpaMode,
383
- publicPath,
384
- routes,
385
- routeDiscovery,
386
- ssr
387
- };
388
-
389
- // Create React Router request listener (accepts Web Request)
390
- const requestHandler = createRequestHandler(buildConfig);
391
-
392
- /**
393
- * Convert Node.js IncomingMessage to Web API Request
394
- */
395
- function nodeRequestToWebRequest(nodeReq) {
396
- // Build full URL
397
- const protocol = nodeReq.connection.encrypted ? 'https' : 'http';
398
- const host = nodeReq.headers.host || 'localhost';
399
- const url = \`\${protocol}://\${host}\${nodeReq.url}\`;
400
-
401
- // Convert headers
402
- const headers = new Headers();
403
- for (const [key, value] of Object.entries(nodeReq.headers)) {
404
- if (value) {
405
- if (Array.isArray(value)) {
406
- value.forEach(v => headers.append(key, v));
407
- } else {
408
- headers.set(key, value);
409
- }
410
- }
411
- }
412
-
413
- // Build request init options
414
- const init = {
415
- method: nodeReq.method,
416
- headers: headers,
417
- };
418
-
419
- // Add body for non-GET/HEAD requests
420
- if (nodeReq.method !== 'GET' && nodeReq.method !== 'HEAD') {
421
- init.body = nodeReq;
422
- }
423
-
424
- return new Request(url, init);
425
- }
426
-
427
- /**
428
- * Node.js request handler wrapper
429
- * Converts first argument (Node.js req) to Web Request, other arguments are passed through
430
- */
431
- async function nodeRequestHandler(nodeReq, ...args) {
432
- // Convert Node.js request to Web Request
433
- const webRequest = nodeRequestToWebRequest(nodeReq);
434
-
435
- // Call React Router request handler with Web Request and other arguments
436
- return requestHandler(webRequest, ...args);
437
- }
438
-
439
- // Export Node.js request handler as default
440
- export default nodeRequestHandler;
441
- `;
442
- const tempPath = path.join(projectRoot, "server-wrapper.temp.js");
443
- await fs.writeFile(tempPath, wrapperContent);
444
- logVerbose(" ✅ Server wrapper file created");
445
- return tempPath;
446
- }
447
- /**
448
- * Generate meta.json
449
- */
450
- async function generateMetaJson() {
451
- // log("📄 Generating meta.json...");
452
- try {
453
- // Read route configuration (get serverManifest from build artifacts)
454
- const manifest = await parseRoutes();
455
- // Generate route list (intelligently determine rendering mode for each route)
456
- const frameworkRoutes = generateRouteList(manifest);
457
- // log("frameworkRoutes", frameworkRoutes);
458
- // Build meta configuration
459
- const metaConfig = {
460
- conf: {
461
- headers: [],
462
- redirects: [],
463
- rewrites: [],
464
- caches: [],
465
- has404: false,
466
- ssr404: true,
467
- },
468
- has404: false,
469
- frameworkRoutes,
87
+ return {
88
+ clientDir: hasClient ? clientDir : null,
89
+ serverDir: needsServer && hasServer ? serverDir : null,
90
+ serverEntry: needsServer && hasServer ? serverEntry : null,
91
+ assetsDir: hasClient ? clientDir : null,
470
92
  };
471
- // Write file to two locations
472
- const metaContent = JSON.stringify(metaConfig, null, 2);
473
- // 1. Write to server-handler directory
474
- const serverHandlerDir = path.join(projectRoot, outputDir, "server-handler");
475
- await fs.mkdir(serverHandlerDir, { recursive: true });
476
- const serverMetaPath = path.join(serverHandlerDir, "meta.json");
477
- await fs.writeFile(serverMetaPath, metaContent);
478
- // 2. Write to root directory
479
- const rootMetaPath = path.join(projectRoot, outputDir, "meta.json");
480
- await fs.writeFile(rootMetaPath, metaContent);
481
- // log(` ✅ meta.json generated`);
482
- // log(` Route count: ${frameworkRoutes.length}`);
483
- // log("");
484
- }
485
- catch (error) {
486
- throw new Error(`Failed to generate meta.json: ${error}`);
487
- }
488
- }
489
- /**
490
- * Parse route configuration - unified reading from client manifest file
491
- * Both SSR and CSR modes generate client manifest files
492
- * This allows getting complete meta information for each route (hasLoader, hasClientLoader, etc.)
493
- */
494
- async function parseRoutes() {
495
- logVerbose(" 🔍 Looking for manifest file...");
496
- // Possible build artifact paths (sorted by priority)
497
- const possibleBuildPaths = [path.join(projectRoot, "build/client")];
498
- for (const buildPath of possibleBuildPaths) {
499
- try {
500
- // Check if directory exists
501
- await fs.access(buildPath);
502
- // Search for manifest files in current directory and assets subdirectory
503
- const searchPaths = [buildPath, path.join(buildPath, "assets")];
504
- for (const searchPath of searchPaths) {
505
- try {
506
- const files = await fs.readdir(searchPath);
507
- // Look for manifest-*.js files
508
- const manifestFile = files.find((f) => f.startsWith("manifest-") && f.endsWith(".js"));
509
- if (manifestFile) {
510
- const manifestPath = path.join(searchPath, manifestFile);
511
- const manifest = await parseManifestFile(manifestPath);
512
- if (manifest) {
513
- logVerbose(` ✅ Successfully read manifest: ${manifestPath}`);
514
- return manifest;
515
- }
516
- }
517
- }
518
- catch (error) {
519
- // Continue trying next search path
520
- continue;
93
+ },
94
+ hooks: {
95
+ async generateRoutes(context) {
96
+ const { projectRoot, logger } = context;
97
+ if (!state.serverBuild) {
98
+ const buildDir = state.config?.buildDirectory || "build";
99
+ const serverBuildFile = state.config?.serverBuildFile || "index.js";
100
+ const serverEntry = path.join(projectRoot, buildDir, "server", serverBuildFile);
101
+ if (await pathExists(serverEntry)) {
102
+ state.serverBuild = await loadServerBuildRoutes(serverEntry, logger);
521
103
  }
522
104
  }
523
- }
524
- catch (error) {
525
- // Continue trying next build path
526
- continue;
527
- }
528
- }
529
- log(" ⚠️ Manifest file not found, will use default route configuration");
530
- return null;
531
- }
532
- /**
533
- * Parse manifest file content
534
- */
535
- async function parseManifestFile(manifestPath) {
536
- try {
537
- const manifestContent = await fs.readFile(manifestPath, "utf-8");
538
- // Parse manifest content (format: window.__reactRouterManifest={...})
539
- const match = manifestContent.match(/window\.__reactRouterManifest\s*=\s*({.*?});?\s*$/s);
540
- if (match) {
541
- const manifestData = JSON.parse(match[1]);
542
- // Validate manifest data structure
543
- if (manifestData.routes && manifestData.version) {
544
- return {
545
- routes: manifestData.routes,
546
- version: manifestData.version,
547
- };
105
+ if (state.serverBuild?.routes) {
106
+ const routes = flattenRouteTree(state.serverBuild.routes, {
107
+ isSSR: state.isSSR,
108
+ isSpaMode: state.isSpaMode,
109
+ onRouteProcessed: generateDataRoute,
110
+ });
111
+ if (state.isSSR && !state.isSpaMode) {
112
+ routes.push({ path: "/__manifest", isStatic: false });
113
+ }
114
+ logger.verbose(`Generated ${routes.length} routes from server build`);
115
+ return routes;
548
116
  }
549
- }
550
- logVerbose(` ⚠️ Manifest file format incorrect: ${manifestPath}`);
551
- return null;
552
- }
553
- catch (error) {
554
- logVerbose(` ⚠️ Failed to parse manifest file: ${error}`);
555
- return null;
556
- }
557
- }
558
- /**
559
- * Generate route list - intelligently determine rendering mode for each route based on serverManifest
560
- */
561
- function generateRouteList(manifest) {
562
- const routeList = [];
563
- if (!manifest) {
564
- log(" ⚠️ Unable to get route manifest, using default configuration");
565
- return routeList;
566
- }
567
- // Iterate through all routes
568
- for (const [routeId, routeInfo] of Object.entries(manifest.routes)) {
569
- // Skip root route
570
- if (routeId === "root")
571
- continue;
572
- // Calculate route path
573
- const routePath = calculateRoutePath(routeInfo);
574
- // Determine if it's a prerender route
575
- // 1. If prerender: true, all routes are prerendered
576
- // 2. Otherwise check if route is in prerender list
577
- const isPrerender = prerenderEnabled || prerenderRoutes.includes(routePath);
578
- // Determine rendering mode
579
- const renderMode = determineRenderMode(routeInfo, isPrerender);
580
- logVerbose(` Route: ${routePath} -> ${renderMode}`);
581
- // Add main route
582
- routeList.push({
583
- path: routePath,
584
- isStatic: !isSSR, // All routes are static in CSR mode
585
- srcRoute: routePath,
586
- });
587
- // SSR routes need .data routes (for getting data during client navigation)
588
- if (renderMode === "ssr" && routePath && routePath.trim() !== "") {
589
- // Root route's .data route should be /_root.data
590
- const dataPath = routePath === "/" ? "/_root.data" : `${routePath}.data`;
591
- routeList.push({
592
- path: dataPath,
593
- isStatic: false,
117
+ logger.warn("Cannot get routes from server build, using default");
118
+ return [{ path: "/", isStatic: state.isSpaMode || !state.isSSR, srcRoute: "/" }];
119
+ },
120
+ async generateMeta(_context, routes) {
121
+ const metaRoutes = convertRoutesToMetaFormat(routes);
122
+ const meta = createDefaultMeta(metaRoutes, { isSSR: state.isSSR });
123
+ meta.conf.ssr404 = state.isSSR && !state.isSpaMode;
124
+ return meta;
125
+ },
126
+ generateServerWrapper(_context, config) {
127
+ const resolved = resolvePreset(REACT_ROUTER_SERVER_PRESET);
128
+ return generateServerWrapperCode({
129
+ serverEntryPath: config.serverEntryPath,
130
+ imports: resolved.imports,
131
+ handlerSetup: resolved.setup,
132
+ handlerCall: resolved.invoke,
594
133
  });
595
- }
596
- }
597
- // Add __manifest route in SSR mode
598
- if (isSSR) {
599
- routeList.push({
600
- path: "/__manifest",
601
- isStatic: false,
602
- });
603
- }
604
- return routeList;
605
- }
606
- /**
607
- * Determine route rendering mode
608
- * @returns "ssr" | "csr" | "static"
609
- */
610
- function determineRenderMode(routeInfo, isPrerender) {
611
- // 1. Prerender route -> static
612
- if (isPrerender) {
613
- return "static";
614
- }
615
- // 2. Only clientLoader, no loader -> CSR
616
- if (routeInfo.hasClientLoader && !routeInfo.hasLoader) {
617
- return "csr";
618
- }
619
- // 3. Has loader (regardless of clientLoader) -> SSR
620
- if (routeInfo.hasLoader) {
621
- return "ssr";
622
- }
623
- // 4. Neither loader nor clientLoader, default to static
624
- return "static";
625
- }
626
- /**
627
- * Calculate complete route path
628
- */
629
- function calculateRoutePath(routeInfo) {
630
- // Handle index route
631
- if (routeInfo.index) {
632
- return "/";
633
- }
634
- // Handle regular route
635
- let routePath;
636
- if (routeInfo.path) {
637
- routePath = routeInfo.path.startsWith("/")
638
- ? routeInfo.path
639
- : `/${routeInfo.path}`;
640
- }
641
- else {
642
- // Infer path from id (fallback)
643
- const pathSegment = routeInfo.id.replace(/^routes\//, "");
644
- if (pathSegment === "home" || pathSegment === "index") {
645
- return "/";
646
- }
647
- routePath = `/${pathSegment.replace(/Page$/, "").toLowerCase()}`;
648
- }
649
- // Convert paths containing * to regex format (without parentheses)
650
- if (routePath.includes("*")) {
651
- // Escape special regex characters except *
652
- routePath = routePath.replace(/[.+?^${}|[\]\\]/g, "\\$&");
653
- // Handle trailing /* - can match empty or any path
654
- // /docs/* should match /docs, /docs/, /docs/anything
655
- // Using /.* with optional slash: make the / before * optional using /?.*
656
- if (routePath.endsWith("/*")) {
657
- routePath = routePath.slice(0, -2) + "/?.*";
658
- }
659
- else {
660
- // Replace other * with .*
661
- routePath = routePath.replace(/\*/g, ".*");
662
- }
663
- }
664
- return routePath;
665
- }
666
- /**
667
- * Count files
668
- */
669
- // async function countFiles(dir: string): Promise<number> {
670
- // let count = 0;
671
- // try {
672
- // const entries = await fs.readdir(dir, { withFileTypes: true });
673
- // for (const entry of entries) {
674
- // if (entry.isDirectory()) {
675
- // count += await countFiles(path.join(dir, entry.name));
676
- // } else {
677
- // count++;
678
- // }
679
- // }
680
- // } catch (error) {
681
- // // Ignore errors
682
- // }
683
- // return count;
684
- // }
685
- /**
686
- * Show usage instructions
687
- */
688
- // function showUsageInstructions() {
689
- // log("\n📖 Usage Instructions:");
690
- // log(` Output directory: ${outputDir}/`);
691
- // log(` ├── assets/ # Static assets`);
692
- // if (isSSR) {
693
- // log(` ├── server-handler/ # Server code`);
694
- // log(` │ └── index.mjs`);
695
- // }
696
- // log(` └── meta.json # Route metadata`);
697
- // log("");
698
- // if (isSSR) {
699
- // log(" Start server:");
700
- // log(` node ${outputDir}/server-handler/index.mjs`);
701
- // log("");
702
- // }
703
- // log(" Deploy to EdgeOne:");
704
- // log(` 1. Upload ${outputDir}/ directory to EdgeOne platform`);
705
- // log(` 2. Configure static asset path as ${outputDir}/assets`);
706
- // if (isSSR) {
707
- // log(
708
- // ` 3. Configure server entry as ${outputDir}/server-handler/index.mjs`
709
- // );
710
- // }
711
- // log("");
712
- // }
134
+ },
135
+ },
136
+ }));
137
+ }
138
+ export function edgeoneReactRouterAdapter(options = {}) {
139
+ return createCoreAdapter({
140
+ ...options,
141
+ adapter: createReactRouterAdapter(options),
142
+ });
713
143
  }
714
- export default edgeoneAdapter;
144
+ export default edgeoneReactRouterAdapter;
145
+ export { edgeoneReactRouterAdapter as edgeoneAdapter };
715
146
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAoExB;;GAEG;AACH,+CAA+C;AAC/C,mCAAmC;AACnC,oBAAoB;AACpB,2CAA2C;AAC3C,yDAAyD;AACzD,6EAA6E;AAC7E,IAAI;AAEJ;;;;;;GAMG;AACH,KAAK,UAAU,sBAAsB,CACnC,SAAyC;IAEzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAED,yDAAyD;IACzD,IAAI,OAAO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AAiB,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;gBACnE,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBACnD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,qBAAqB,CAAC,QAAsB,EAAE,MAA2B;gBACvE,MAAM,QAAQ,GAAG,aAAa,CAAC,0BAA0B,CAAC,CAAC;gBAC3D,OAAO,yBAAyB,CAAC;oBAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;oBACvC,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,YAAY,EAAE,QAAQ,CAAC,KAAK;oBAC5B,WAAW,EAAE,QAAQ,CAAC,MAAM;iBAC7B,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,UAA4C,EAAE;IACtF,OAAO,iBAAiB,CAAC;QACvB,GAAG,OAAO;QACV,OAAO,EAAE,wBAAwB,CAAC,OAAO,CAAC;KAC3C,CAAC,CAAC;AACL,CAAC;AAED,eAAe,yBAAyB,CAAC;AACzC,OAAO,EAAE,yBAAyB,IAAI,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edgeone/react-router",
3
- "version": "1.0.4",
4
- "description": "EdgeOne adapter plugin for React Router",
3
+ "version": "1.1.0",
4
+ "description": "EdgeOne adapter for React Router v7 framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -12,31 +12,31 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist",
16
- "README.md",
17
- "LICENSE"
15
+ "dist"
18
16
  ],
19
17
  "scripts": {
20
18
  "build": "tsc",
21
- "prepublishOnly": "npm run build"
19
+ "prepublishOnly": "npm run build",
20
+ "release": "npm run build && npm version patch && npm publish",
21
+ "release:minor": "npm run build && npm version minor && npm publish",
22
+ "release:major": "npm run build && npm version major && npm publish"
22
23
  },
23
24
  "keywords": [
24
25
  "vite",
25
26
  "vite-plugin",
26
27
  "react-router",
27
28
  "edgeone",
28
- "adapter"
29
+ "adapter",
30
+ "ssr"
29
31
  ],
30
32
  "author": "EdgeOne Team",
31
33
  "license": "MIT",
32
34
  "peerDependencies": {
35
+ "@chuckcchen/vite-plugin": "^1.0.0",
33
36
  "@react-router/dev": "^7.0.0",
37
+ "react-router": "^7.0.0",
34
38
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
35
39
  },
36
- "dependencies": {
37
- "esbuild": "^0.20.0",
38
- "react-router": "^7.9.4"
39
- },
40
40
  "devDependencies": {
41
41
  "@types/node": "^22.0.0",
42
42
  "typescript": "^5.9.0",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 EdgeOne Team
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.
package/README.md DELETED
@@ -1,17 +0,0 @@
1
- # @edgeone/react-router
2
-
3
- This adapter allows React Router to deploy your hybrid or server rendered site to [EdgeOne Pages](https://pages.edgeone.ai/).
4
-
5
- ## Documentation
6
-
7
- Read the [`@edgeone/react-router` docs](https://pages.edgeone.ai/document/framework-react-router)
8
-
9
- ## Support
10
-
11
- - Get help in the [EdgeOne Pages Discord](https://discord.com/invite/KpdcJ8xbq6).
12
-
13
- - Check our [Product Introduction](https://pages.edgeone.ai/document/product-introduction) for more on integrations.
14
-
15
- ## License
16
-
17
- MIT