@edgeone/react-router 1.0.5 → 1.1.1

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