@edgeone/react-router 1.0.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/LICENSE +21 -0
- package/README.md +158 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +690 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# @edgeone/react-router-pages
|
|
2
|
+
|
|
3
|
+
EdgeOne adapter plugin for React Router - Automatically converts React Router build output to EdgeOne deployment format with zero configuration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ✅ **Automatic Asset Migration** - Copies `build/client` to `.edgeone/assets`
|
|
8
|
+
- ✅ **Server Bundling** - Bundles server code into a single file (SSR mode)
|
|
9
|
+
- ✅ **Route Metadata Generation** - Generates `meta.json` configuration
|
|
10
|
+
- ✅ **Multi-Mode Support** - CSR, SSR, and Hybrid (SSR + Prerender)
|
|
11
|
+
- ✅ **Tree-Shaking** - Removes unused code automatically
|
|
12
|
+
- ✅ **Zero External Dependencies** - Bundled file requires only Node.js built-ins
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @edgeone/react-router-pages --save-dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
Add the plugin to `vite.config.ts`:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
26
|
+
import { edgeoneAdapter } from "@edgeone/react-router-pages";
|
|
27
|
+
import { defineConfig } from "vite";
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [reactRouter(), edgeoneAdapter()],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Build your project:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Output structure:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
.edgeone/
|
|
44
|
+
├── assets/ # Static assets
|
|
45
|
+
├── server-handler/ # Server code (SSR only)
|
|
46
|
+
│ └── index.mjs # Single-file server
|
|
47
|
+
└── meta.json # Route metadata
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Rendering Modes
|
|
51
|
+
|
|
52
|
+
### CSR (Client-Side Rendering)
|
|
53
|
+
|
|
54
|
+
Configure in `react-router.config.ts`:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
export default { ssr: false } satisfies Config;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Deploy to any static hosting:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx serve .edgeone/assets
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### SSR (Server-Side Rendering)
|
|
67
|
+
|
|
68
|
+
Configure in `react-router.config.ts`:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
export default { ssr: true } satisfies Config;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Run locally:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node .edgeone/server-handler/index.mjs
|
|
78
|
+
# Server at http://localhost:9000
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Hybrid (SSR + Prerender)
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
export default {
|
|
85
|
+
ssr: true,
|
|
86
|
+
async prerender() {
|
|
87
|
+
return ["/", "/about"];
|
|
88
|
+
},
|
|
89
|
+
} satisfies Config;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Deployment
|
|
93
|
+
|
|
94
|
+
### EdgeOne Platform
|
|
95
|
+
|
|
96
|
+
1. Upload `.edgeone` directory
|
|
97
|
+
2. Set static path: `.edgeone/assets`
|
|
98
|
+
3. Set server entry: `.edgeone/server-handler/index.mjs`
|
|
99
|
+
|
|
100
|
+
### Docker
|
|
101
|
+
|
|
102
|
+
```dockerfile
|
|
103
|
+
FROM node:18-alpine
|
|
104
|
+
WORKDIR /app
|
|
105
|
+
COPY .edgeone .edgeone
|
|
106
|
+
EXPOSE 9000
|
|
107
|
+
CMD ["node", ".edgeone/server-handler/index.mjs"]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Static Hosting (CSR)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Vercel
|
|
114
|
+
vercel --prod .edgeone/assets
|
|
115
|
+
|
|
116
|
+
# Netlify
|
|
117
|
+
netlify deploy --prod --dir=.edgeone/assets
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Build Process
|
|
121
|
+
|
|
122
|
+
The adapter uses esbuild to bundle the server with the following optimizations:
|
|
123
|
+
|
|
124
|
+
- **Platform**: Node.js 18+
|
|
125
|
+
- **Format**: ESM
|
|
126
|
+
- **Tree-shaking**: Enabled
|
|
127
|
+
- **External**: Node.js built-in modules only
|
|
128
|
+
- **Bundle size**: ~1.88 MB (includes React, React Router, and all dependencies)
|
|
129
|
+
|
|
130
|
+
## Troubleshooting
|
|
131
|
+
|
|
132
|
+
**Build fails**: Ensure `build/client` exists. Run `npm run build` first.
|
|
133
|
+
|
|
134
|
+
**Port in use**:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
PORT=8080 node .edgeone/server-handler/index.mjs
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Missing routes**: Enable verbose logging:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
edgeoneAdapter({ verbose: true });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Environment Variables
|
|
147
|
+
|
|
148
|
+
- `PORT` - Server port (default: 9000)
|
|
149
|
+
|
|
150
|
+
## Requirements
|
|
151
|
+
|
|
152
|
+
- Node.js >= 18.0.0
|
|
153
|
+
- Vite >= 5.0.0
|
|
154
|
+
- React Router >= 7.0.0
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
6
|
+
*/
|
|
7
|
+
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;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* EdgeOne adapter plugin
|
|
17
|
+
*/
|
|
18
|
+
export declare function edgeoneAdapter(options?: EdgeOneAdapterOptions): Plugin;
|
|
19
|
+
export default edgeoneAdapter;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,CA2uB1E;AAED,eAAe,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
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
|
|
6
|
+
*/
|
|
7
|
+
import * as esbuild from "esbuild";
|
|
8
|
+
import fs from "fs/promises";
|
|
9
|
+
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 };
|
|
57
|
+
}
|
|
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();
|
|
117
|
+
}
|
|
118
|
+
// 5. Generate meta.json (SSR mode only)
|
|
119
|
+
if (isSSR) {
|
|
120
|
+
await generateMetaJson();
|
|
121
|
+
}
|
|
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;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
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;
|
|
155
|
+
}
|
|
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));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
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
|
+
const configPath = path.join(projectRoot, "react-router.config.ts");
|
|
192
|
+
// Dynamic import of configuration file
|
|
193
|
+
const configModule = await import(configPath);
|
|
194
|
+
const config = configModule.default;
|
|
195
|
+
// Read SSR configuration
|
|
196
|
+
isSSR = config.ssr !== false;
|
|
197
|
+
// Read prerender routes
|
|
198
|
+
if (config.prerender) {
|
|
199
|
+
const result = await resolvePrerenderRoutes(config.prerender);
|
|
200
|
+
prerenderRoutes = result.routes;
|
|
201
|
+
prerenderEnabled = result.enableAll;
|
|
202
|
+
if (prerenderEnabled) {
|
|
203
|
+
log(` Prerender mode: All routes`);
|
|
204
|
+
}
|
|
205
|
+
else if (prerenderRoutes.length > 0) {
|
|
206
|
+
log(` Prerender routes: ${prerenderRoutes.join(", ")}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
log("");
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
log(" ⚠️ Unable to read react-router.config.ts, using default configuration");
|
|
213
|
+
log("");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Clean output directory
|
|
218
|
+
*/
|
|
219
|
+
async function cleanOutputDirectory() {
|
|
220
|
+
const outputPath = path.join(projectRoot, outputDir);
|
|
221
|
+
const assetsPath = path.join(outputPath, "assets");
|
|
222
|
+
const serverHandlerPath = path.join(outputPath, "server-handler");
|
|
223
|
+
const metaPath = path.join(outputPath, "meta.json");
|
|
224
|
+
try {
|
|
225
|
+
// Clean assets and server-handler directories, as well as meta.json file
|
|
226
|
+
await fs.rm(assetsPath, { recursive: true, force: true });
|
|
227
|
+
await fs.rm(serverHandlerPath, { recursive: true, force: true });
|
|
228
|
+
await fs.rm(metaPath, { force: true });
|
|
229
|
+
logVerbose("🧹 Cleaned directories: assets, server-handler, meta.json");
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
// Directory might not exist, ignore error
|
|
233
|
+
}
|
|
234
|
+
// Ensure output directory exists
|
|
235
|
+
await fs.mkdir(outputPath, { recursive: true });
|
|
236
|
+
logVerbose("📁 Ensured output directory exists:", outputDir);
|
|
237
|
+
logVerbose("");
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Copy static assets
|
|
241
|
+
*/
|
|
242
|
+
async function copyStaticAssets() {
|
|
243
|
+
// log("📦 Copying static assets...");
|
|
244
|
+
const targetPath = path.join(projectRoot, outputDir, "assets");
|
|
245
|
+
// Try multiple possible build artifact paths
|
|
246
|
+
const possibleSourcePaths = [
|
|
247
|
+
path.join(projectRoot, "build/client"),
|
|
248
|
+
path.join(projectRoot, "build-csr/client"),
|
|
249
|
+
path.join(projectRoot, "build-ssr/client"),
|
|
250
|
+
];
|
|
251
|
+
let sourcePath = null;
|
|
252
|
+
// Find existing build artifact directory
|
|
253
|
+
for (const possiblePath of possibleSourcePaths) {
|
|
254
|
+
try {
|
|
255
|
+
await fs.access(possiblePath);
|
|
256
|
+
sourcePath = possiblePath;
|
|
257
|
+
logVerbose(` Found build artifacts: ${possiblePath}`);
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
// Continue trying next path
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (!sourcePath) {
|
|
266
|
+
throw new Error(`Build artifact directory not found, please run build command first`);
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
// Recursively copy directory
|
|
270
|
+
await fs.cp(sourcePath, targetPath, { recursive: true });
|
|
271
|
+
// Count files
|
|
272
|
+
// const fileCount = await countFiles(targetPath);
|
|
273
|
+
// log(` ✅ Copied ${fileCount} files to ${outputDir}/assets`);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
throw new Error(`Failed to copy static assets: ${error}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Bundle server code
|
|
281
|
+
*/
|
|
282
|
+
async function bundleServerCode() {
|
|
283
|
+
// log("🔨 Bundling server code...");
|
|
284
|
+
const serverEntryPath = path.join(projectRoot, "build/server/index.js");
|
|
285
|
+
const outputPath = path.join(projectRoot, outputDir, "server-handler");
|
|
286
|
+
const outputFile = path.join(outputPath, "handler.js");
|
|
287
|
+
try {
|
|
288
|
+
// Check if entry file exists
|
|
289
|
+
await fs.access(serverEntryPath);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
log(" ⚠️ build/server/index.js does not exist, skipping server bundling");
|
|
293
|
+
log(" Hint: Ensure React Router is configured for SSR mode and built correctly");
|
|
294
|
+
log("");
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
try {
|
|
298
|
+
// Create output directory
|
|
299
|
+
await fs.mkdir(outputPath, { recursive: true });
|
|
300
|
+
// Create server wrapper file
|
|
301
|
+
const wrapperPath = await createServerWrapper(serverEntryPath);
|
|
302
|
+
// Bundle using esbuild
|
|
303
|
+
await esbuild.build({
|
|
304
|
+
entryPoints: [wrapperPath],
|
|
305
|
+
bundle: true,
|
|
306
|
+
platform: "node",
|
|
307
|
+
target: "node18",
|
|
308
|
+
format: "esm",
|
|
309
|
+
outfile: outputFile,
|
|
310
|
+
minify: false,
|
|
311
|
+
treeShaking: true,
|
|
312
|
+
external: ["node:*"],
|
|
313
|
+
metafile: true,
|
|
314
|
+
logLevel: "warning",
|
|
315
|
+
absWorkingDir: projectRoot,
|
|
316
|
+
banner: {
|
|
317
|
+
js: `import { createRequire } from 'node:module';
|
|
318
|
+
const require = createRequire(import.meta.url);
|
|
319
|
+
const __filename = new URL('', import.meta.url).pathname;
|
|
320
|
+
const __dirname = new URL('.', import.meta.url).pathname;`,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
// Clean up temporary file
|
|
324
|
+
await fs.unlink(wrapperPath);
|
|
325
|
+
// Show build statistics
|
|
326
|
+
// const outputInfo =
|
|
327
|
+
// result.metafile!.outputs[Object.keys(result.metafile!.outputs)[0]];
|
|
328
|
+
// log(` ✅ Server code bundled`);
|
|
329
|
+
// log(` File: ${outputDir}/server-handler/index.mjs`);
|
|
330
|
+
// log(` Size: ${formatSize(outputInfo.bytes)}`);
|
|
331
|
+
// log("");
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
throw new Error(`Failed to bundle server code: ${error}`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Create server wrapper file
|
|
339
|
+
*/
|
|
340
|
+
async function createServerWrapper(serverBuildPath) {
|
|
341
|
+
logVerbose("📝 Creating server wrapper file...");
|
|
342
|
+
// Read original build/server/index.js
|
|
343
|
+
const serverBuildContent = await fs.readFile(serverBuildPath, "utf-8");
|
|
344
|
+
const wrapperContent = `// ========== React Router Server Build ==========
|
|
345
|
+
${serverBuildContent}
|
|
346
|
+
|
|
347
|
+
// ========== HTTP Server Wrapper ==========
|
|
348
|
+
import { createRequestHandler } from "react-router";
|
|
349
|
+
|
|
350
|
+
// Get exported build configuration
|
|
351
|
+
const buildConfig = {
|
|
352
|
+
assets: serverManifest,
|
|
353
|
+
assetsBuildDirectory,
|
|
354
|
+
basename,
|
|
355
|
+
entry,
|
|
356
|
+
future,
|
|
357
|
+
isSpaMode,
|
|
358
|
+
publicPath,
|
|
359
|
+
routes,
|
|
360
|
+
routeDiscovery,
|
|
361
|
+
ssr
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// Create React Router request listener (accepts Web Request)
|
|
365
|
+
const requestHandler = createRequestHandler(buildConfig);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Convert Node.js IncomingMessage to Web API Request
|
|
369
|
+
*/
|
|
370
|
+
function nodeRequestToWebRequest(nodeReq) {
|
|
371
|
+
// Build full URL
|
|
372
|
+
const protocol = nodeReq.connection.encrypted ? 'https' : 'http';
|
|
373
|
+
const host = nodeReq.headers.host || 'localhost';
|
|
374
|
+
const url = \`\${protocol}://\${host}\${nodeReq.url}\`;
|
|
375
|
+
|
|
376
|
+
// Convert headers
|
|
377
|
+
const headers = new Headers();
|
|
378
|
+
for (const [key, value] of Object.entries(nodeReq.headers)) {
|
|
379
|
+
if (value) {
|
|
380
|
+
if (Array.isArray(value)) {
|
|
381
|
+
value.forEach(v => headers.append(key, v));
|
|
382
|
+
} else {
|
|
383
|
+
headers.set(key, value);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Build request init options
|
|
389
|
+
const init = {
|
|
390
|
+
method: nodeReq.method,
|
|
391
|
+
headers: headers,
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// Add body for non-GET/HEAD requests
|
|
395
|
+
if (nodeReq.method !== 'GET' && nodeReq.method !== 'HEAD') {
|
|
396
|
+
init.body = nodeReq;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return new Request(url, init);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Node.js request handler wrapper
|
|
404
|
+
* Converts first argument (Node.js req) to Web Request, other arguments are passed through
|
|
405
|
+
*/
|
|
406
|
+
async function nodeRequestHandler(nodeReq, ...args) {
|
|
407
|
+
// Convert Node.js request to Web Request
|
|
408
|
+
const webRequest = nodeRequestToWebRequest(nodeReq);
|
|
409
|
+
|
|
410
|
+
// Call React Router request handler with Web Request and other arguments
|
|
411
|
+
return requestHandler(webRequest, ...args);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Export Node.js request handler as default
|
|
415
|
+
export default nodeRequestHandler;
|
|
416
|
+
`;
|
|
417
|
+
const tempPath = path.join(projectRoot, "server-wrapper.temp.js");
|
|
418
|
+
await fs.writeFile(tempPath, wrapperContent);
|
|
419
|
+
logVerbose(" ✅ Server wrapper file created");
|
|
420
|
+
return tempPath;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Generate meta.json
|
|
424
|
+
*/
|
|
425
|
+
async function generateMetaJson() {
|
|
426
|
+
// log("📄 Generating meta.json...");
|
|
427
|
+
try {
|
|
428
|
+
// Read route configuration (get serverManifest from build artifacts)
|
|
429
|
+
const manifest = await parseRoutes();
|
|
430
|
+
// Generate route list (intelligently determine rendering mode for each route)
|
|
431
|
+
const frameworkRoutes = generateRouteList(manifest);
|
|
432
|
+
// log("frameworkRoutes", frameworkRoutes);
|
|
433
|
+
// Build meta configuration
|
|
434
|
+
const metaConfig = {
|
|
435
|
+
conf: {
|
|
436
|
+
headers: [],
|
|
437
|
+
redirects: [],
|
|
438
|
+
rewrites: [],
|
|
439
|
+
caches: [],
|
|
440
|
+
has404: false,
|
|
441
|
+
ssr404: true,
|
|
442
|
+
},
|
|
443
|
+
has404: false,
|
|
444
|
+
frameworkRoutes,
|
|
445
|
+
};
|
|
446
|
+
// Write file to two locations
|
|
447
|
+
const metaContent = JSON.stringify(metaConfig, null, 2);
|
|
448
|
+
// 1. Write to server-handler directory
|
|
449
|
+
const serverHandlerDir = path.join(projectRoot, outputDir, "server-handler");
|
|
450
|
+
await fs.mkdir(serverHandlerDir, { recursive: true });
|
|
451
|
+
const serverMetaPath = path.join(serverHandlerDir, "meta.json");
|
|
452
|
+
await fs.writeFile(serverMetaPath, metaContent);
|
|
453
|
+
// 2. Write to root directory
|
|
454
|
+
const rootMetaPath = path.join(projectRoot, outputDir, "meta.json");
|
|
455
|
+
await fs.writeFile(rootMetaPath, metaContent);
|
|
456
|
+
// log(` ✅ meta.json generated`);
|
|
457
|
+
// log(` Route count: ${frameworkRoutes.length}`);
|
|
458
|
+
// log("");
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
throw new Error(`Failed to generate meta.json: ${error}`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Parse route configuration - unified reading from client manifest file
|
|
466
|
+
* Both SSR and CSR modes generate client manifest files
|
|
467
|
+
* This allows getting complete meta information for each route (hasLoader, hasClientLoader, etc.)
|
|
468
|
+
*/
|
|
469
|
+
async function parseRoutes() {
|
|
470
|
+
logVerbose(" 🔍 Looking for manifest file...");
|
|
471
|
+
// Possible build artifact paths (sorted by priority)
|
|
472
|
+
const possibleBuildPaths = [path.join(projectRoot, "build/client")];
|
|
473
|
+
for (const buildPath of possibleBuildPaths) {
|
|
474
|
+
try {
|
|
475
|
+
// Check if directory exists
|
|
476
|
+
await fs.access(buildPath);
|
|
477
|
+
// Search for manifest files in current directory and assets subdirectory
|
|
478
|
+
const searchPaths = [buildPath, path.join(buildPath, "assets")];
|
|
479
|
+
for (const searchPath of searchPaths) {
|
|
480
|
+
try {
|
|
481
|
+
const files = await fs.readdir(searchPath);
|
|
482
|
+
// Look for manifest-*.js files
|
|
483
|
+
const manifestFile = files.find((f) => f.startsWith("manifest-") && f.endsWith(".js"));
|
|
484
|
+
if (manifestFile) {
|
|
485
|
+
const manifestPath = path.join(searchPath, manifestFile);
|
|
486
|
+
const manifest = await parseManifestFile(manifestPath);
|
|
487
|
+
if (manifest) {
|
|
488
|
+
logVerbose(` ✅ Successfully read manifest: ${manifestPath}`);
|
|
489
|
+
return manifest;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
catch (error) {
|
|
494
|
+
// Continue trying next search path
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
// Continue trying next build path
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
log(" ⚠️ Manifest file not found, will use default route configuration");
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Parse manifest file content
|
|
509
|
+
*/
|
|
510
|
+
async function parseManifestFile(manifestPath) {
|
|
511
|
+
try {
|
|
512
|
+
const manifestContent = await fs.readFile(manifestPath, "utf-8");
|
|
513
|
+
// Parse manifest content (format: window.__reactRouterManifest={...})
|
|
514
|
+
const match = manifestContent.match(/window\.__reactRouterManifest\s*=\s*({.*?});?\s*$/s);
|
|
515
|
+
if (match) {
|
|
516
|
+
const manifestData = JSON.parse(match[1]);
|
|
517
|
+
// Validate manifest data structure
|
|
518
|
+
if (manifestData.routes && manifestData.version) {
|
|
519
|
+
return {
|
|
520
|
+
routes: manifestData.routes,
|
|
521
|
+
version: manifestData.version,
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
logVerbose(` ⚠️ Manifest file format incorrect: ${manifestPath}`);
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
catch (error) {
|
|
529
|
+
logVerbose(` ⚠️ Failed to parse manifest file: ${error}`);
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Generate route list - intelligently determine rendering mode for each route based on serverManifest
|
|
535
|
+
*/
|
|
536
|
+
function generateRouteList(manifest) {
|
|
537
|
+
const routeList = [];
|
|
538
|
+
if (!manifest) {
|
|
539
|
+
log(" ⚠️ Unable to get route manifest, using default configuration");
|
|
540
|
+
return routeList;
|
|
541
|
+
}
|
|
542
|
+
// Iterate through all routes
|
|
543
|
+
for (const [routeId, routeInfo] of Object.entries(manifest.routes)) {
|
|
544
|
+
// Skip root route
|
|
545
|
+
if (routeId === "root")
|
|
546
|
+
continue;
|
|
547
|
+
// Calculate route path
|
|
548
|
+
const routePath = calculateRoutePath(routeInfo);
|
|
549
|
+
// Determine if it's a prerender route
|
|
550
|
+
// 1. If prerender: true, all routes are prerendered
|
|
551
|
+
// 2. Otherwise check if route is in prerender list
|
|
552
|
+
const isPrerender = prerenderEnabled || prerenderRoutes.includes(routePath);
|
|
553
|
+
// Determine rendering mode
|
|
554
|
+
const renderMode = determineRenderMode(routeInfo, isPrerender);
|
|
555
|
+
logVerbose(` Route: ${routePath} -> ${renderMode}`);
|
|
556
|
+
// Add main route
|
|
557
|
+
routeList.push({
|
|
558
|
+
path: routePath,
|
|
559
|
+
isStatic: !isSSR, // All routes are static in CSR mode
|
|
560
|
+
srcRoute: routePath,
|
|
561
|
+
});
|
|
562
|
+
// SSR routes need .data routes (for getting data during client navigation)
|
|
563
|
+
if (renderMode === "ssr" && routePath && routePath.trim() !== "") {
|
|
564
|
+
// Root route's .data route should be /_root.data
|
|
565
|
+
const dataPath = routePath === "/" ? "/_root.data" : `${routePath}.data`;
|
|
566
|
+
routeList.push({
|
|
567
|
+
path: dataPath,
|
|
568
|
+
isStatic: false,
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
// Add __manifest route in SSR mode
|
|
573
|
+
if (isSSR) {
|
|
574
|
+
routeList.push({
|
|
575
|
+
path: "/__manifest",
|
|
576
|
+
isStatic: false,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
return routeList;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Determine route rendering mode
|
|
583
|
+
* @returns "ssr" | "csr" | "static"
|
|
584
|
+
*/
|
|
585
|
+
function determineRenderMode(routeInfo, isPrerender) {
|
|
586
|
+
// 1. Prerender route -> static
|
|
587
|
+
if (isPrerender) {
|
|
588
|
+
return "static";
|
|
589
|
+
}
|
|
590
|
+
// 2. Only clientLoader, no loader -> CSR
|
|
591
|
+
if (routeInfo.hasClientLoader && !routeInfo.hasLoader) {
|
|
592
|
+
return "csr";
|
|
593
|
+
}
|
|
594
|
+
// 3. Has loader (regardless of clientLoader) -> SSR
|
|
595
|
+
if (routeInfo.hasLoader) {
|
|
596
|
+
return "ssr";
|
|
597
|
+
}
|
|
598
|
+
// 4. Neither loader nor clientLoader, default to static
|
|
599
|
+
return "static";
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Calculate complete route path
|
|
603
|
+
*/
|
|
604
|
+
function calculateRoutePath(routeInfo) {
|
|
605
|
+
// Handle index route
|
|
606
|
+
if (routeInfo.index) {
|
|
607
|
+
return "/";
|
|
608
|
+
}
|
|
609
|
+
// Handle regular route
|
|
610
|
+
let routePath;
|
|
611
|
+
if (routeInfo.path) {
|
|
612
|
+
routePath = routeInfo.path.startsWith("/")
|
|
613
|
+
? routeInfo.path
|
|
614
|
+
: `/${routeInfo.path}`;
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
// Infer path from id (fallback)
|
|
618
|
+
const pathSegment = routeInfo.id.replace(/^routes\//, "");
|
|
619
|
+
if (pathSegment === "home" || pathSegment === "index") {
|
|
620
|
+
return "/";
|
|
621
|
+
}
|
|
622
|
+
routePath = `/${pathSegment.replace(/Page$/, "").toLowerCase()}`;
|
|
623
|
+
}
|
|
624
|
+
// Convert paths containing * to regex format (without parentheses)
|
|
625
|
+
if (routePath.includes("*")) {
|
|
626
|
+
// Escape special regex characters except *
|
|
627
|
+
routePath = routePath.replace(/[.+?^${}|[\]\\]/g, "\\$&");
|
|
628
|
+
// Handle trailing /* - can match empty or any path
|
|
629
|
+
// /docs/* should match /docs, /docs/, /docs/anything
|
|
630
|
+
// Using /.* with optional slash: make the / before * optional using /?.*
|
|
631
|
+
if (routePath.endsWith("/*")) {
|
|
632
|
+
routePath = routePath.slice(0, -2) + "/?.*";
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
// Replace other * with .*
|
|
636
|
+
routePath = routePath.replace(/\*/g, ".*");
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return routePath;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Count files
|
|
643
|
+
*/
|
|
644
|
+
// async function countFiles(dir: string): Promise<number> {
|
|
645
|
+
// let count = 0;
|
|
646
|
+
// try {
|
|
647
|
+
// const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
648
|
+
// for (const entry of entries) {
|
|
649
|
+
// if (entry.isDirectory()) {
|
|
650
|
+
// count += await countFiles(path.join(dir, entry.name));
|
|
651
|
+
// } else {
|
|
652
|
+
// count++;
|
|
653
|
+
// }
|
|
654
|
+
// }
|
|
655
|
+
// } catch (error) {
|
|
656
|
+
// // Ignore errors
|
|
657
|
+
// }
|
|
658
|
+
// return count;
|
|
659
|
+
// }
|
|
660
|
+
/**
|
|
661
|
+
* Show usage instructions
|
|
662
|
+
*/
|
|
663
|
+
// function showUsageInstructions() {
|
|
664
|
+
// log("\n📖 Usage Instructions:");
|
|
665
|
+
// log(` Output directory: ${outputDir}/`);
|
|
666
|
+
// log(` ├── assets/ # Static assets`);
|
|
667
|
+
// if (isSSR) {
|
|
668
|
+
// log(` ├── server-handler/ # Server code`);
|
|
669
|
+
// log(` │ └── index.mjs`);
|
|
670
|
+
// }
|
|
671
|
+
// log(` └── meta.json # Route metadata`);
|
|
672
|
+
// log("");
|
|
673
|
+
// if (isSSR) {
|
|
674
|
+
// log(" Start server:");
|
|
675
|
+
// log(` node ${outputDir}/server-handler/index.mjs`);
|
|
676
|
+
// log("");
|
|
677
|
+
// }
|
|
678
|
+
// log(" Deploy to EdgeOne:");
|
|
679
|
+
// log(` 1. Upload ${outputDir}/ directory to EdgeOne platform`);
|
|
680
|
+
// log(` 2. Configure static asset path as ${outputDir}/assets`);
|
|
681
|
+
// if (isSSR) {
|
|
682
|
+
// log(
|
|
683
|
+
// ` 3. Configure server entry as ${outputDir}/server-handler/index.mjs`
|
|
684
|
+
// );
|
|
685
|
+
// }
|
|
686
|
+
// log("");
|
|
687
|
+
// }
|
|
688
|
+
}
|
|
689
|
+
export default edgeoneAdapter;
|
|
690
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,SAAS,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC;IAED,uCAAuC;IACvC,IA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CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;YAE1D,mDAAmD;YACnD,qDAAqD;YACrD,yEAAyE;YACzE,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7B,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,0BAA0B;gBAC1B,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,4DAA4D;IAC5D,mBAAmB;IAEnB,UAAU;IACV,sEAAsE;IAEtE,qCAAqC;IACrC,mCAAmC;IACnC,iEAAiE;IACjE,iBAAiB;IACjB,mBAAmB;IACnB,UAAU;IACV,QAAQ;IACR,sBAAsB;IACtB,uBAAuB;IACvB,MAAM;IAEN,kBAAkB;IAClB,IAAI;IAEJ;;OAEG;IACH,uCAAuC;IACvC,uCAAuC;IACvC,iDAAiD;IACjD,sDAAsD;IACtD,mBAAmB;IACnB,sDAAsD;IACtD,qCAAqC;IACrC,QAAQ;IACR,uDAAuD;IACvD,eAAe;IAEf,mBAAmB;IACnB,iCAAiC;IACjC,8DAA8D;IAC9D,iBAAiB;IACjB,QAAQ;IAER,oCAAoC;IACpC,uEAAuE;IACvE,uEAAuE;IACvE,mBAAmB;IACnB,aAAa;IACb,kFAAkF;IAClF,WAAW;IACX,QAAQ;IACR,eAAe;IACf,MAAM;AACR,CAAC;AAED,eAAe,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@edgeone/react-router",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "EdgeOne adapter plugin for React Router",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"vite",
|
|
25
|
+
"vite-plugin",
|
|
26
|
+
"react-router",
|
|
27
|
+
"edgeone",
|
|
28
|
+
"adapter"
|
|
29
|
+
],
|
|
30
|
+
"author": "EdgeOne Team",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@react-router/dev": "^7.0.0",
|
|
34
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"esbuild": "^0.20.0",
|
|
38
|
+
"react-router": "^7.9.4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^22.0.0",
|
|
42
|
+
"typescript": "^5.9.0",
|
|
43
|
+
"vite": "^7.1.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
51
|
+
}
|