@chuckcchen/vite-plugin 1.0.2 → 1.0.4

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/utils.js CHANGED
@@ -1,58 +1,46 @@
1
1
  /**
2
2
  * EdgeOne Vite Plugin Adapter - Utility Functions Module
3
3
  *
4
- * This module provides a set of general utility functions, including:
4
+ * This module provides utility functions for:
5
5
  * - Logging
6
- * - File system operations (read, write, copy, delete, etc.)
6
+ * - File system operations
7
7
  * - Path detection
8
- * - File size formatting
9
- * - Conditional waiting, etc.
8
+ * - Config file loading
9
+ * - Server wrapper generation
10
+ * - Meta configuration
10
11
  */
11
12
  import fs from "fs/promises";
12
13
  import path from "path";
14
+ import { pathToFileURL } from "url";
15
+ // ============================================================================
16
+ // Logging
17
+ // ============================================================================
13
18
  /**
14
19
  * Create logger instance
15
- *
16
- * @param verbose - Enable verbose logging mode, default is false
17
- * @returns Logger object with log, verbose, warn, error methods
18
- *
19
- * @example
20
- * const logger = createLogger(true);
21
- * logger.verbose("This message only shows in verbose mode");
22
- * logger.warn("This is a warning message");
23
20
  */
24
21
  export function createLogger(verbose = false) {
25
22
  return {
26
- // Normal log, always outputs
27
23
  log: (message, ...args) => {
28
24
  console.log(`[EdgeOne Adapter] ${message}`, ...args);
29
25
  },
30
- // Verbose log, only outputs in verbose mode
31
26
  verbose: (message, ...args) => {
32
27
  if (verbose) {
33
28
  console.log(`[EdgeOne Adapter] ${message}`, ...args);
34
29
  }
35
30
  },
36
- // Warning log with warning icon
37
31
  warn: (message, ...args) => {
38
32
  console.warn(`[EdgeOne Adapter] ⚠️ ${message}`, ...args);
39
33
  },
40
- // Error log with error icon
41
34
  error: (message, ...args) => {
42
35
  console.error(`[EdgeOne Adapter] ❌ ${message}`, ...args);
43
36
  },
44
37
  };
45
38
  }
39
+ // ============================================================================
40
+ // File System Operations
41
+ // ============================================================================
46
42
  /**
47
43
  * Check if specified path exists
48
- *
49
- * @param filePath - File or directory path to check
50
- * @returns True if path exists, false otherwise
51
- *
52
- * @example
53
- * if (await pathExists('/path/to/file')) {
54
- * console.log('File exists');
55
- * }
56
44
  */
57
45
  export async function pathExists(filePath) {
58
46
  try {
@@ -63,200 +51,224 @@ export async function pathExists(filePath) {
63
51
  return false;
64
52
  }
65
53
  }
66
- /**
67
- * Find first existing path from candidate list
68
- *
69
- * @param candidates - Candidate paths array, sorted by priority
70
- * @returns First existing path, or null if none exist
71
- *
72
- * @example
73
- * const buildDir = await findExistingPath([
74
- * '/project/dist',
75
- * '/project/build',
76
- * '/project/output'
77
- * ]);
78
- */
79
- export async function findExistingPath(candidates) {
80
- for (const candidate of candidates) {
81
- if (await pathExists(candidate)) {
82
- return candidate;
83
- }
84
- }
85
- return null;
86
- }
87
54
  /**
88
55
  * Recursively copy directory
89
- * Copy all contents from source directory to destination directory
90
- *
91
- * @param src - Source directory path
92
- * @param dest - Destination directory path
93
- *
94
- * @example
95
- * await copyDirectory('dist/client', '.edgeone/assets');
96
56
  */
97
57
  export async function copyDirectory(src, dest) {
98
58
  await fs.cp(src, dest, { recursive: true });
99
59
  }
100
60
  /**
101
- * Clean directory (delete and recreate)
102
- * Used to ensure directory is in a clean empty state
103
- *
104
- * @param dir - Directory path to clean
105
- *
106
- * @example
107
- * await cleanDirectory('.edgeone');
108
- */
109
- export async function cleanDirectory(dir) {
110
- await fs.rm(dir, { recursive: true, force: true });
111
- await fs.mkdir(dir, { recursive: true });
112
- }
113
- /**
114
- * Ensure directory exists
115
- * Recursively create if directory doesn't exist
116
- *
117
- * @param dir - Directory path
118
- *
119
- * @example
120
- * await ensureDirectory('.edgeone/server-handler');
61
+ * Ensure directory exists (creates recursively if needed)
121
62
  */
122
63
  export async function ensureDirectory(dir) {
123
64
  await fs.mkdir(dir, { recursive: true });
124
65
  }
125
66
  /**
126
67
  * Read file content as string
127
- *
128
- * @param filePath - File path
129
- * @returns File content string (UTF-8 encoded)
130
- *
131
- * @example
132
- * const content = await readFile('dist/server/index.js');
133
68
  */
134
69
  export async function readFile(filePath) {
135
70
  return fs.readFile(filePath, "utf-8");
136
71
  }
137
72
  /**
138
- * Write content to file
139
- * Automatically creates parent directory if it doesn't exist
140
- *
141
- * @param filePath - File path
142
- * @param content - Content to write
143
- *
144
- * @example
145
- * await writeFile('.edgeone/meta.json', JSON.stringify(config));
73
+ * Write content to file (auto-creates parent directory)
146
74
  */
147
75
  export async function writeFile(filePath, content) {
148
- // Ensure parent directory exists
149
76
  await ensureDirectory(path.dirname(filePath));
150
77
  await fs.writeFile(filePath, content);
151
78
  }
152
79
  /**
153
80
  * Delete file
154
- *
155
- * @param filePath - File path to delete
156
- *
157
- * @example
158
- * await deleteFile('server-wrapper.temp.js');
159
81
  */
160
82
  export async function deleteFile(filePath) {
161
83
  await fs.unlink(filePath);
162
84
  }
163
85
  /**
164
- * Format file size to human-readable string
165
- *
166
- * @param bytes - Number of bytes
167
- * @returns Formatted string, e.g. "1.5 KB", "2.3 MB"
168
- *
169
- * @example
170
- * formatSize(1536); // "1.5 KB"
171
- * formatSize(2457600); // "2.34 MB"
86
+ * List files in directory
172
87
  */
173
- export function formatSize(bytes) {
174
- if (bytes === 0)
175
- return "0 B";
176
- const k = 1024;
177
- const sizes = ["B", "KB", "MB", "GB"];
178
- // Calculate appropriate unit level
179
- const i = Math.floor(Math.log(bytes) / Math.log(k));
180
- // Convert and keep two decimal places
181
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
88
+ export async function listFiles(dir) {
89
+ try {
90
+ return await fs.readdir(dir);
91
+ }
92
+ catch {
93
+ return [];
94
+ }
182
95
  }
96
+ // ============================================================================
97
+ // Path Detection
98
+ // ============================================================================
183
99
  /**
184
- * Wait for condition to be met (with retry mechanism)
185
- * Used to wait for async operations to complete, like file writes
186
- *
187
- * @param condition - Async condition function returning boolean
188
- * @param options - Configuration options
189
- * @param options.maxRetries - Maximum retry count, default 15
190
- * @param options.delay - Delay between retries in milliseconds, default 300ms
191
- * @returns True if condition met, false if timeout
192
- *
193
- * @example
194
- * const ready = await waitFor(
195
- * async () => await pathExists('dist/index.html'),
196
- * { maxRetries: 10, delay: 500 }
197
- * );
100
+ * Detect config file from candidate list
101
+ */
102
+ export async function detectConfigFile(projectRoot, patterns) {
103
+ for (const pattern of patterns) {
104
+ const fullPath = path.join(projectRoot, pattern);
105
+ if (await pathExists(fullPath)) {
106
+ return fullPath;
107
+ }
108
+ }
109
+ return null;
110
+ }
111
+ /**
112
+ * Detect build directory from candidate list
198
113
  */
199
- export async function waitFor(condition, options = {}) {
200
- const { maxRetries = 15, delay = 300 } = options;
201
- for (let i = 0; i < maxRetries; i++) {
202
- // Check if condition is met
203
- if (await condition()) {
204
- return true;
114
+ export async function detectBuildDir(projectRoot, candidates) {
115
+ for (const candidate of candidates) {
116
+ const dirPath = path.join(projectRoot, candidate);
117
+ if (await pathExists(dirPath)) {
118
+ return dirPath;
205
119
  }
206
- // If not last attempt, wait then retry
207
- if (i < maxRetries - 1) {
208
- await new Promise((resolve) => setTimeout(resolve, delay));
120
+ }
121
+ return null;
122
+ }
123
+ /**
124
+ * Detect server entry file from candidate list
125
+ */
126
+ export async function detectServerEntry(serverDir, candidates = ["index.js", "index.mjs", "entry.js", "main.js"]) {
127
+ for (const candidate of candidates) {
128
+ const entryPath = path.join(serverDir, candidate);
129
+ if (await pathExists(entryPath)) {
130
+ return entryPath;
209
131
  }
210
132
  }
211
- return false;
133
+ return null;
212
134
  }
213
135
  /**
214
- * List files and subdirectory names in directory
215
- *
216
- * @param dir - Directory path
217
- * @returns Array of file and directory names, empty array if directory doesn't exist
218
- *
219
- * @example
220
- * const files = await listFiles('dist/client');
221
- * // ['index.html', 'assets', 'favicon.ico']
136
+ * Dynamically import config file
222
137
  */
223
- export async function listFiles(dir) {
138
+ export async function loadConfigFile(configPath) {
224
139
  try {
225
- return await fs.readdir(dir);
140
+ const fileUrl = pathToFileURL(configPath).href;
141
+ const module = await import(`${fileUrl}?t=${Date.now()}`);
142
+ return module.default;
226
143
  }
227
144
  catch {
228
- return [];
145
+ return null;
229
146
  }
230
147
  }
148
+ // ============================================================================
149
+ // Route Helpers
150
+ // ============================================================================
231
151
  /**
232
- * Recursively count files in directory
233
- *
234
- * @param dir - Directory path
235
- * @returns Total file count (excluding directories)
236
- *
237
- * @example
238
- * const count = await countFiles('dist');
239
- * console.log(`Build artifacts contain ${count} files`);
152
+ * Normalize route path
240
153
  */
241
- export async function countFiles(dir) {
242
- let count = 0;
243
- try {
244
- // Get directory contents with type info
245
- const entries = await fs.readdir(dir, { withFileTypes: true });
246
- for (const entry of entries) {
247
- if (entry.isDirectory()) {
248
- // Recursively count subdirectory
249
- count += await countFiles(path.join(dir, entry.name));
250
- }
251
- else {
252
- // Increment file count
253
- count++;
254
- }
255
- }
154
+ export function normalizeRoutePath(routePath) {
155
+ let normalized = routePath.replace(/\/+/g, "/");
156
+ if (!normalized.startsWith("/")) {
157
+ normalized = "/" + normalized;
256
158
  }
257
- catch {
258
- // Ignore errors (e.g. directory doesn't exist)
159
+ if (normalized !== "/" && normalized.endsWith("/")) {
160
+ normalized = normalized.slice(0, -1);
161
+ }
162
+ return normalized;
163
+ }
164
+ // ============================================================================
165
+ // Meta Configuration
166
+ // ============================================================================
167
+ /**
168
+ * Create default meta configuration
169
+ */
170
+ export function createDefaultMeta(routes, options = {}) {
171
+ const { isSSR = false, has404 = false } = options;
172
+ return {
173
+ conf: {
174
+ headers: [],
175
+ redirects: [],
176
+ rewrites: [],
177
+ caches: [],
178
+ has404,
179
+ ssr404: isSSR && !has404,
180
+ },
181
+ has404,
182
+ frameworkRoutes: routes,
183
+ };
184
+ }
185
+ // ============================================================================
186
+ // Server Wrapper Generation
187
+ // ============================================================================
188
+ /** Node.js IncomingMessage to Web Request converter code */
189
+ export const NODE_REQUEST_CONVERTER_CODE = `
190
+ function nodeRequestToWebRequest(nodeReq) {
191
+ const protocol = nodeReq.connection?.encrypted ? 'https' : 'http';
192
+ const host = nodeReq.headers.host || 'localhost';
193
+ const url = \`\${protocol}://\${host}\${nodeReq.url}\`;
194
+
195
+ const headers = new Headers();
196
+ for (const [key, value] of Object.entries(nodeReq.headers)) {
197
+ if (value) {
198
+ if (Array.isArray(value)) {
199
+ value.forEach(v => headers.append(key, v));
200
+ } else {
201
+ headers.set(key, value);
202
+ }
203
+ }
204
+ }
205
+
206
+ const init = {
207
+ method: nodeReq.method,
208
+ headers: headers,
209
+ };
210
+
211
+ if (nodeReq.method !== 'GET' && nodeReq.method !== 'HEAD') {
212
+ init.body = nodeReq;
213
+ }
214
+
215
+ return new Request(url, init);
216
+ }
217
+ `.trim();
218
+ /**
219
+ * Generate server wrapper code
220
+ */
221
+ export async function generateServerWrapperCode(options) {
222
+ const { serverEntryPath, handlerSetup = "", handlerCall, imports = "", needsNodeRequestConversion = true, mode = "inline", additionalExports = [], } = options;
223
+ const parts = [];
224
+ if (mode === "inline") {
225
+ const serverBuildContent = await readFile(serverEntryPath);
226
+ parts.push(`// Server build content`);
227
+ parts.push(serverBuildContent);
228
+ parts.push(``);
229
+ parts.push(`// HTTP server wrapper`);
230
+ }
231
+ else {
232
+ parts.push(`// Server Wrapper for EdgeOne`);
233
+ parts.push(`import server from "${serverEntryPath}";`);
234
+ parts.push(``);
235
+ }
236
+ if (imports) {
237
+ parts.push(imports);
238
+ parts.push(``);
239
+ }
240
+ if (handlerSetup) {
241
+ parts.push(handlerSetup);
242
+ parts.push(``);
243
+ }
244
+ if (needsNodeRequestConversion) {
245
+ parts.push(NODE_REQUEST_CONVERTER_CODE);
246
+ parts.push(``);
247
+ }
248
+ parts.push(`
249
+ async function nodeRequestHandler(nodeReq, ...args) {
250
+ const webRequest = nodeRequestToWebRequest(nodeReq);
251
+ return ${handlerCall};
252
+ }
253
+
254
+ export default nodeRequestHandler;`.trim());
255
+ if (mode === "import" && additionalExports.length > 0) {
256
+ parts.push(`\nexport { ${additionalExports.join(", ")} };`);
257
+ }
258
+ return parts.join("\n");
259
+ }
260
+ // ============================================================================
261
+ // Logging Helpers
262
+ // ============================================================================
263
+ /**
264
+ * Log build artifacts info
265
+ */
266
+ export function logBuildArtifacts(logger, adapterName, artifacts) {
267
+ logger.verbose(`${adapterName} build artifacts:`);
268
+ logger.verbose(` Client: ${artifacts.clientDir || "not found"}`);
269
+ logger.verbose(` Server: ${artifacts.serverDir || "not found"}`);
270
+ if (artifacts.serverEntry) {
271
+ logger.verbose(` Server entry: ${artifacts.serverEntry}`);
259
272
  }
260
- return count;
261
273
  }
262
274
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAmB,KAAK;IACnD,OAAO;QACL,6BAA6B;QAC7B,GAAG,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QACvD,CAAC;QACD,4CAA4C;QAC5C,OAAO,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QACD,gCAAgC;QAChC,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC5C,OAAO,CAAC,IAAI,CAAC,yBAAyB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,4BAA4B;QAC5B,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC7C,OAAO,CAAC,KA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CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC;;;WAGF,WAAW;;;mCAGa,CAAC,IAAI,EAAE,CAAC,CAAC;IAE1C,IAAI,IAAI,KAAK,QAAQ,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,cAAc,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAc,EACd,WAAmB,EACnB,SAIC;IAED,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,mBAAmB,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,CAAC,aAAa,SAAS,CAAC,SAAS,IAAI,WAAW,EAAE,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,CAAC,aAAa,SAAS,CAAC,SAAS,IAAI,WAAW,EAAE,CAAC,CAAC;IAClE,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,OAAO,CAAC,mBAAmB,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chuckcchen/vite-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Core adapter plugin for EdgeOne platform - handles build artifacts, bundling, and deployment configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",