@chuckcchen/vite-plugin 1.0.19 → 1.0.21
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/bundler.d.ts +5 -18
- package/dist/bundler.d.ts.map +1 -1
- package/dist/bundler.js +43 -30
- package/dist/bundler.js.map +1 -1
- package/dist/core.d.ts +2 -18
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +125 -248
- package/dist/core.js.map +1 -1
- package/dist/factory/detectors.d.ts +5 -15
- package/dist/factory/detectors.d.ts.map +1 -1
- package/dist/factory/detectors.js +8 -22
- package/dist/factory/detectors.js.map +1 -1
- package/dist/factory/hooks.d.ts +4 -59
- package/dist/factory/hooks.d.ts.map +1 -1
- package/dist/factory/hooks.js +18 -117
- package/dist/factory/hooks.js.map +1 -1
- package/dist/factory/index.d.ts +7 -51
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +10 -55
- package/dist/factory/index.js.map +1 -1
- package/dist/factory/presets.d.ts +16 -121
- package/dist/factory/presets.d.ts.map +1 -1
- package/dist/factory/presets.js +143 -174
- package/dist/factory/presets.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -35
- package/dist/index.js.map +1 -1
- package/dist/route/index.d.ts +1 -1
- package/dist/route/index.d.ts.map +1 -1
- package/dist/route/index.js +1 -3
- package/dist/route/index.js.map +1 -1
- package/dist/route/parser.d.ts +0 -37
- package/dist/route/parser.d.ts.map +1 -1
- package/dist/route/parser.js +11 -124
- package/dist/route/parser.js.map +1 -1
- package/dist/route/regex.d.ts +15 -80
- package/dist/route/regex.d.ts.map +1 -1
- package/dist/route/regex.js +65 -169
- package/dist/route/regex.js.map +1 -1
- package/dist/route/regex.test.d.ts +7 -0
- package/dist/route/regex.test.d.ts.map +1 -0
- package/dist/route/regex.test.js +662 -0
- package/dist/route/regex.test.js.map +1 -0
- package/dist/route/types.d.ts +0 -58
- package/dist/route/types.d.ts.map +1 -1
- package/dist/types.d.ts +36 -147
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -78
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +11 -144
- package/dist/utils.js.map +1 -1
- package/dist/vite-config-parser.d.ts +4 -141
- package/dist/vite-config-parser.d.ts.map +1 -1
- package/dist/vite-config-parser.js +25 -235
- package/dist/vite-config-parser.js.map +1 -1
- package/package.json +1 -1
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,YAAY,CAAC,OAAO,GAAE,OAAe,GAAG,MAAM,CAe7D;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM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AC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM,CA0CxF;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/F,IAAI,CAON"}
|
package/dist/utils.js
CHANGED
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* EdgeOne Vite Plugin Adapter - Utility Functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides utility functions for:
|
|
5
|
-
* - Logging
|
|
6
|
-
* - File system operations
|
|
7
|
-
* - Path detection
|
|
8
|
-
* - Config file loading
|
|
9
|
-
* - Server wrapper generation
|
|
10
|
-
* - Meta configuration
|
|
11
|
-
*
|
|
12
|
-
* Note: Vite config parsing has been moved to vite-config-parser.ts
|
|
13
|
-
* Legacy functions are re-exported for backward compatibility.
|
|
2
|
+
* EdgeOne Vite Plugin Adapter - Utility Functions
|
|
14
3
|
*/
|
|
15
4
|
import fs from "fs/promises";
|
|
16
5
|
import path from "path";
|
|
17
6
|
import { pathToFileURL } from "url";
|
|
18
|
-
// Re-export Vite config parser functions for backward compatibility
|
|
19
7
|
export { getOutputDirFromViteConfig, getServerDirFromViteConfig, getServerEntryFromViteConfig, ViteConfigParser, createViteConfigParser, parseViteConfig, } from "./vite-config-parser.js";
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Logging
|
|
22
|
-
// ============================================================================
|
|
23
|
-
/**
|
|
24
|
-
* Create logger instance
|
|
25
|
-
*/
|
|
26
8
|
export function createLogger(verbose = false) {
|
|
27
9
|
return {
|
|
28
10
|
log: (message, ...args) => {
|
|
29
11
|
console.log(`[EdgeOne Adapter] ${message}`, ...args);
|
|
30
12
|
},
|
|
31
13
|
verbose: (message, ...args) => {
|
|
32
|
-
if (verbose)
|
|
14
|
+
if (verbose)
|
|
33
15
|
console.log(`[EdgeOne Adapter] ${message}`, ...args);
|
|
34
|
-
}
|
|
35
16
|
},
|
|
36
17
|
warn: (message, ...args) => {
|
|
37
18
|
console.warn(`[EdgeOne Adapter] ⚠️ ${message}`, ...args);
|
|
@@ -41,12 +22,6 @@ export function createLogger(verbose = false) {
|
|
|
41
22
|
},
|
|
42
23
|
};
|
|
43
24
|
}
|
|
44
|
-
// ============================================================================
|
|
45
|
-
// File System Operations
|
|
46
|
-
// ============================================================================
|
|
47
|
-
/**
|
|
48
|
-
* Check if specified path exists
|
|
49
|
-
*/
|
|
50
25
|
export async function pathExists(filePath) {
|
|
51
26
|
try {
|
|
52
27
|
await fs.access(filePath);
|
|
@@ -56,42 +31,22 @@ export async function pathExists(filePath) {
|
|
|
56
31
|
return false;
|
|
57
32
|
}
|
|
58
33
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Recursively copy directory
|
|
61
|
-
*/
|
|
62
34
|
export async function copyDirectory(src, dest) {
|
|
63
35
|
await fs.cp(src, dest, { recursive: true });
|
|
64
36
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Ensure directory exists (creates recursively if needed)
|
|
67
|
-
*/
|
|
68
37
|
export async function ensureDirectory(dir) {
|
|
69
38
|
await fs.mkdir(dir, { recursive: true });
|
|
70
39
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Read file content as string
|
|
73
|
-
*/
|
|
74
40
|
export async function readFile(filePath) {
|
|
75
41
|
return fs.readFile(filePath, "utf-8");
|
|
76
42
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Write content to file (auto-creates parent directory)
|
|
79
|
-
*/
|
|
80
43
|
export async function writeFile(filePath, content) {
|
|
81
44
|
await ensureDirectory(path.dirname(filePath));
|
|
82
45
|
await fs.writeFile(filePath, content);
|
|
83
46
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Delete file
|
|
86
|
-
*/
|
|
87
47
|
export async function deleteFile(filePath) {
|
|
88
48
|
await fs.unlink(filePath);
|
|
89
49
|
}
|
|
90
|
-
/**
|
|
91
|
-
* List files in directory
|
|
92
|
-
* @param dir - Directory path
|
|
93
|
-
* @param logger - Optional logger for verbose error reporting
|
|
94
|
-
*/
|
|
95
50
|
export async function listFiles(dir, logger) {
|
|
96
51
|
try {
|
|
97
52
|
return await fs.readdir(dir);
|
|
@@ -101,40 +56,24 @@ export async function listFiles(dir, logger) {
|
|
|
101
56
|
return [];
|
|
102
57
|
}
|
|
103
58
|
}
|
|
104
|
-
// ============================================================================
|
|
105
|
-
// Path Detection
|
|
106
|
-
// ============================================================================
|
|
107
|
-
/**
|
|
108
|
-
* Detect config file from candidate list
|
|
109
|
-
*/
|
|
110
59
|
export async function detectConfigFile(projectRoot, patterns) {
|
|
111
60
|
for (const pattern of patterns) {
|
|
112
61
|
const fullPath = path.join(projectRoot, pattern);
|
|
113
|
-
if (await pathExists(fullPath))
|
|
62
|
+
if (await pathExists(fullPath))
|
|
114
63
|
return fullPath;
|
|
115
|
-
}
|
|
116
64
|
}
|
|
117
65
|
return null;
|
|
118
66
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Detect build directory from candidate list
|
|
121
|
-
*/
|
|
122
67
|
export async function detectBuildDir(projectRoot, candidates) {
|
|
123
68
|
for (const candidate of candidates) {
|
|
124
69
|
const dirPath = path.join(projectRoot, candidate);
|
|
125
|
-
if (await pathExists(dirPath))
|
|
70
|
+
if (await pathExists(dirPath))
|
|
126
71
|
return dirPath;
|
|
127
|
-
}
|
|
128
72
|
}
|
|
129
73
|
return null;
|
|
130
74
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Detect server entry file from candidate list
|
|
133
|
-
* Supports both direct file names and subdirectory patterns (e.g., "static/entry-server.js")
|
|
134
|
-
*/
|
|
135
75
|
export async function detectServerEntry(serverDir, candidates = ["index.js", "index.mjs", "entry.js", "main.js"], options) {
|
|
136
76
|
const { recursive = true, logger } = options || {};
|
|
137
|
-
// First, try direct matches in serverDir
|
|
138
77
|
for (const candidate of candidates) {
|
|
139
78
|
const entryPath = path.join(serverDir, candidate);
|
|
140
79
|
if (await pathExists(entryPath)) {
|
|
@@ -142,7 +81,6 @@ export async function detectServerEntry(serverDir, candidates = ["index.js", "in
|
|
|
142
81
|
return entryPath;
|
|
143
82
|
}
|
|
144
83
|
}
|
|
145
|
-
// If recursive is enabled, search in subdirectories
|
|
146
84
|
if (recursive) {
|
|
147
85
|
const subdirs = await listFiles(serverDir, logger);
|
|
148
86
|
for (const subdir of subdirs) {
|
|
@@ -166,17 +104,6 @@ export async function detectServerEntry(serverDir, candidates = ["index.js", "in
|
|
|
166
104
|
}
|
|
167
105
|
return null;
|
|
168
106
|
}
|
|
169
|
-
// Note: findFileByPattern, getOutputDirFromViteConfig, getServerEntryFromViteConfig,
|
|
170
|
-
// and getServerDirFromViteConfig have been moved to vite-config-parser.ts
|
|
171
|
-
// They are re-exported above for backward compatibility.
|
|
172
|
-
/**
|
|
173
|
-
* Dynamically import config file
|
|
174
|
-
*/
|
|
175
|
-
/**
|
|
176
|
-
* Dynamically import config file
|
|
177
|
-
* @param configPath - Path to config file
|
|
178
|
-
* @param logger - Optional logger for verbose error reporting
|
|
179
|
-
*/
|
|
180
107
|
export async function loadConfigFile(configPath, logger) {
|
|
181
108
|
try {
|
|
182
109
|
const fileUrl = pathToFileURL(configPath).href;
|
|
@@ -185,7 +112,6 @@ export async function loadConfigFile(configPath, logger) {
|
|
|
185
112
|
}
|
|
186
113
|
catch (importError) {
|
|
187
114
|
logger?.verbose(`Dynamic import failed for ${configPath}: ${importError instanceof Error ? importError.message : String(importError)}`);
|
|
188
|
-
// If dynamic import fails (e.g., TypeScript file), try to parse the file content
|
|
189
115
|
try {
|
|
190
116
|
const content = await fs.readFile(configPath, "utf-8");
|
|
191
117
|
return parseConfigFromContent(content);
|
|
@@ -196,78 +122,41 @@ export async function loadConfigFile(configPath, logger) {
|
|
|
196
122
|
}
|
|
197
123
|
}
|
|
198
124
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Remove comments from source code content
|
|
201
|
-
* Handles single-line (//) and multi-line (/* *\/) comments
|
|
202
|
-
*/
|
|
203
125
|
function stripComments(content) {
|
|
204
|
-
// Remove multi-line comments (/* ... */)
|
|
205
126
|
let result = content.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
206
|
-
// Remove single-line comments (// ...)
|
|
207
127
|
result = result.replace(/\/\/.*$/gm, "");
|
|
208
128
|
return result;
|
|
209
129
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Parse config object from file content (simple extraction for common patterns)
|
|
212
|
-
* This is a fallback when dynamic import fails (e.g., for TypeScript files)
|
|
213
|
-
*
|
|
214
|
-
* Note: This uses simple regex extraction and has limitations:
|
|
215
|
-
* - Only supports literal values (not variables or template strings)
|
|
216
|
-
* - Works for simple key: value or key: "value" patterns
|
|
217
|
-
*/
|
|
218
130
|
function parseConfigFromContent(content) {
|
|
219
131
|
try {
|
|
220
|
-
// Strip comments to avoid matching commented-out config
|
|
221
132
|
const strippedContent = stripComments(content);
|
|
222
133
|
const config = {};
|
|
223
|
-
// Extract ssr: true/false
|
|
224
134
|
const ssrMatch = strippedContent.match(/ssr\s*:\s*(true|false)/);
|
|
225
|
-
if (ssrMatch)
|
|
135
|
+
if (ssrMatch)
|
|
226
136
|
config.ssr = ssrMatch[1] === "true";
|
|
227
|
-
}
|
|
228
|
-
// Extract buildDirectory: "..."
|
|
229
137
|
const buildDirMatch = strippedContent.match(/buildDirectory\s*:\s*["']([^"']+)["']/);
|
|
230
|
-
if (buildDirMatch)
|
|
138
|
+
if (buildDirMatch)
|
|
231
139
|
config.buildDirectory = buildDirMatch[1];
|
|
232
|
-
}
|
|
233
|
-
// Extract serverBuildFile: "..."
|
|
234
140
|
const serverBuildFileMatch = strippedContent.match(/serverBuildFile\s*:\s*["']([^"']+)["']/);
|
|
235
|
-
if (serverBuildFileMatch)
|
|
141
|
+
if (serverBuildFileMatch)
|
|
236
142
|
config.serverBuildFile = serverBuildFileMatch[1];
|
|
237
|
-
}
|
|
238
|
-
// Extract serverModuleFormat: "..."
|
|
239
143
|
const serverModuleFormatMatch = strippedContent.match(/serverModuleFormat\s*:\s*["']([^"']+)["']/);
|
|
240
|
-
if (serverModuleFormatMatch)
|
|
144
|
+
if (serverModuleFormatMatch)
|
|
241
145
|
config.serverModuleFormat = serverModuleFormatMatch[1];
|
|
242
|
-
}
|
|
243
146
|
return Object.keys(config).length > 0 ? config : null;
|
|
244
147
|
}
|
|
245
148
|
catch {
|
|
246
149
|
return null;
|
|
247
150
|
}
|
|
248
151
|
}
|
|
249
|
-
// ============================================================================
|
|
250
|
-
// Route Helpers
|
|
251
|
-
// ============================================================================
|
|
252
|
-
/**
|
|
253
|
-
* Normalize route path
|
|
254
|
-
*/
|
|
255
152
|
export function normalizeRoutePath(routePath) {
|
|
256
153
|
let normalized = routePath.replace(/\/+/g, "/");
|
|
257
|
-
if (!normalized.startsWith("/"))
|
|
154
|
+
if (!normalized.startsWith("/"))
|
|
258
155
|
normalized = "/" + normalized;
|
|
259
|
-
|
|
260
|
-
if (normalized !== "/" && normalized.endsWith("/")) {
|
|
156
|
+
if (normalized !== "/" && normalized.endsWith("/"))
|
|
261
157
|
normalized = normalized.slice(0, -1);
|
|
262
|
-
}
|
|
263
158
|
return normalized;
|
|
264
159
|
}
|
|
265
|
-
// ============================================================================
|
|
266
|
-
// Meta Configuration
|
|
267
|
-
// ============================================================================
|
|
268
|
-
/**
|
|
269
|
-
* Create default meta configuration
|
|
270
|
-
*/
|
|
271
160
|
export function createDefaultMeta(routes, options = {}) {
|
|
272
161
|
const { isSSR = false, has404 = false } = options;
|
|
273
162
|
return {
|
|
@@ -283,10 +172,6 @@ export function createDefaultMeta(routes, options = {}) {
|
|
|
283
172
|
frameworkRoutes: routes,
|
|
284
173
|
};
|
|
285
174
|
}
|
|
286
|
-
// ============================================================================
|
|
287
|
-
// Server Wrapper Generation
|
|
288
|
-
// ============================================================================
|
|
289
|
-
/** Node.js IncomingMessage to Web Request converter code */
|
|
290
175
|
export const NODE_REQUEST_CONVERTER_CODE = `
|
|
291
176
|
function nodeRequestToWebRequest(nodeReq) {
|
|
292
177
|
const protocol = nodeReq.connection?.encrypted ? 'https' : 'http';
|
|
@@ -317,16 +202,9 @@ function nodeRequestToWebRequest(nodeReq) {
|
|
|
317
202
|
return new Request(url, init);
|
|
318
203
|
}
|
|
319
204
|
`.trim();
|
|
320
|
-
/**
|
|
321
|
-
* Generate server wrapper code
|
|
322
|
-
*
|
|
323
|
-
* Always uses import (not inline) to preserve the original module's path context,
|
|
324
|
-
* which is essential for resolving relative dynamic imports (e.g., "./assets/xxx.js")
|
|
325
|
-
*/
|
|
326
205
|
export function generateServerWrapperCode(options) {
|
|
327
206
|
const { serverEntryPath, handlerSetup = "", handlerCall, imports = "", needsNodeRequestConversion = true, } = options;
|
|
328
207
|
const parts = [];
|
|
329
|
-
// Always use import to preserve module path context for relative imports
|
|
330
208
|
parts.push(`// Server Wrapper for EdgeOne`);
|
|
331
209
|
parts.push(`import * as serverBuild from "${serverEntryPath}";`);
|
|
332
210
|
parts.push(``);
|
|
@@ -334,12 +212,7 @@ export function generateServerWrapperCode(options) {
|
|
|
334
212
|
parts.push(imports);
|
|
335
213
|
parts.push(``);
|
|
336
214
|
}
|
|
337
|
-
|
|
338
|
-
parts.push(`// Extract exports from server build`);
|
|
339
|
-
parts.push(`const {`);
|
|
340
|
-
parts.push(` default: defaultExport,`);
|
|
341
|
-
parts.push(` ...serverExports`);
|
|
342
|
-
parts.push(`} = serverBuild;`);
|
|
215
|
+
parts.push(`const { default: defaultExport, ...serverExports } = serverBuild;`);
|
|
343
216
|
parts.push(``);
|
|
344
217
|
if (handlerSetup) {
|
|
345
218
|
parts.push(handlerSetup);
|
|
@@ -358,12 +231,6 @@ async function nodeRequestHandler(nodeReq, ...args) {
|
|
|
358
231
|
export default nodeRequestHandler;`.trim());
|
|
359
232
|
return parts.join("\n");
|
|
360
233
|
}
|
|
361
|
-
// ============================================================================
|
|
362
|
-
// Logging Helpers
|
|
363
|
-
// ============================================================================
|
|
364
|
-
/**
|
|
365
|
-
* Log build artifacts info
|
|
366
|
-
*/
|
|
367
234
|
export function logBuildArtifacts(logger, adapterName, artifacts) {
|
|
368
235
|
logger.verbose(`${adapterName} build artifacts:`);
|
|
369
236
|
logger.verbose(` Client: ${artifacts.clientDir || "not found"}`);
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGpC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAGhB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,YAAY,CAAC,UAAmB,KAAK;IACnD,OAAO;QACL,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,OAAO,EAAE,CAAC,OAAe,EAAE,GAAG,IAAe,EAAE,EAAE;YAC/C,IAAI,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QACpE,C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AAE,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,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAAc,EACd,WAAmB,EACnB,SAAgG;IAEhG,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"}
|
|
@@ -1,199 +1,62 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vite Config Parser -
|
|
3
|
-
*
|
|
4
|
-
* This module provides a unified interface for parsing and extracting
|
|
5
|
-
* configuration from Vite's ResolvedConfig object.
|
|
6
|
-
*
|
|
7
|
-
* Supported Vite Config Properties:
|
|
8
|
-
* - build.outDir: Custom output directory
|
|
9
|
-
* - build.assetsDir: Static assets directory name
|
|
10
|
-
* - build.ssr: SSR entry point (string or boolean)
|
|
11
|
-
* - build.manifest: Whether to generate manifest.json
|
|
12
|
-
* - build.ssrManifest: Whether to generate SSR manifest
|
|
13
|
-
* - base: Public base path
|
|
14
|
-
* - rollupOptions.input: Entry file(s) - string, array, or object
|
|
15
|
-
* - rollupOptions.output.dir: Output directory override
|
|
16
|
-
* - rollupOptions.output.entryFileNames: Output filename pattern
|
|
17
|
-
* - rollupOptions.output.assetFileNames: Asset filename pattern
|
|
18
|
-
* - rollupOptions.output.chunkFileNames: Chunk filename pattern
|
|
19
|
-
*
|
|
20
|
-
* Not Supported (with reasons):
|
|
21
|
-
* - rollupOptions.output.entryFileNames as function: Cannot be statically evaluated
|
|
22
|
-
* - rollupOptions.output.assetFileNames as function: Cannot be statically evaluated
|
|
23
|
-
* - rollupOptions.output.chunkFileNames as function: Cannot be statically evaluated
|
|
24
|
-
* - build.lib: Library mode is not applicable for EdgeOne deployment
|
|
25
|
-
* - build.watch: Watch mode is not relevant for production builds
|
|
2
|
+
* Vite Config Parser - Unified interface for parsing Vite configuration
|
|
26
3
|
*/
|
|
27
4
|
import type { ResolvedConfig } from "vite";
|
|
28
5
|
import type { Logger } from "./types.js";
|
|
29
|
-
/**
|
|
30
|
-
* Parsed Vite configuration information
|
|
31
|
-
*/
|
|
32
6
|
export interface ViteConfigInfo {
|
|
33
|
-
/** Project root directory */
|
|
34
7
|
root: string;
|
|
35
|
-
/** Public base path for assets */
|
|
36
8
|
base: string;
|
|
37
|
-
/** Build mode (development/production) */
|
|
38
9
|
mode: string;
|
|
39
|
-
/** Output directory (relative to root) */
|
|
40
10
|
outDir: string;
|
|
41
|
-
/** Assets directory name (relative to outDir) */
|
|
42
11
|
assetsDir: string;
|
|
43
|
-
/** Absolute path to output directory */
|
|
44
12
|
absoluteOutDir: string;
|
|
45
|
-
/** Absolute path to assets directory */
|
|
46
13
|
absoluteAssetsDir: string;
|
|
47
|
-
/** Whether this is an SSR build */
|
|
48
14
|
isSSR: boolean;
|
|
49
|
-
/** SSR entry point (if specified as string) */
|
|
50
15
|
ssrEntry: string | null;
|
|
51
|
-
/** Server output directory */
|
|
52
16
|
serverDir: string | null;
|
|
53
|
-
/** Server entry file path */
|
|
54
17
|
serverEntryPath: string | null;
|
|
55
|
-
/** Whether manifest.json is generated */
|
|
56
18
|
hasManifest: boolean;
|
|
57
|
-
/** Whether SSR manifest is generated */
|
|
58
19
|
hasSSRManifest: boolean;
|
|
59
|
-
/** Entry file naming pattern */
|
|
60
20
|
entryFileNames: string | null;
|
|
61
|
-
/** Asset file naming pattern */
|
|
62
21
|
assetFileNames: string | null;
|
|
63
|
-
/** Chunk file naming pattern */
|
|
64
22
|
chunkFileNames: string | null;
|
|
65
23
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Options for ViteConfigParser
|
|
68
|
-
*/
|
|
69
24
|
export interface ViteConfigParserOptions {
|
|
70
|
-
/** Logger instance for verbose output */
|
|
71
25
|
logger?: Logger;
|
|
72
|
-
/** Server entry file candidates for fallback detection */
|
|
73
26
|
serverEntryCandidates?: string[];
|
|
74
27
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Vite Configuration Parser
|
|
77
|
-
*
|
|
78
|
-
* Provides a unified interface for extracting and parsing Vite configuration.
|
|
79
|
-
* Handles various configuration patterns and provides sensible defaults.
|
|
80
|
-
*/
|
|
81
28
|
export declare class ViteConfigParser {
|
|
82
29
|
private config;
|
|
83
30
|
private projectRoot;
|
|
84
31
|
private logger?;
|
|
85
32
|
private serverEntryCandidates;
|
|
86
33
|
constructor(config: ResolvedConfig, projectRoot: string, options?: ViteConfigParserOptions);
|
|
87
|
-
/**
|
|
88
|
-
* Parse complete Vite configuration information
|
|
89
|
-
*/
|
|
90
34
|
parse(): Promise<ViteConfigInfo>;
|
|
91
|
-
/**
|
|
92
|
-
* Get public base path
|
|
93
|
-
* Used for asset URL prefixing
|
|
94
|
-
*/
|
|
95
35
|
getBase(): string;
|
|
96
|
-
/**
|
|
97
|
-
* Get output directory (relative path)
|
|
98
|
-
* Priority: rollupOptions.output.dir > build.outDir > "dist"
|
|
99
|
-
*/
|
|
100
36
|
getOutputDir(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Get absolute output directory path
|
|
103
|
-
*/
|
|
104
37
|
getAbsoluteOutputDir(): string;
|
|
105
|
-
/**
|
|
106
|
-
* Get assets directory name (relative to outDir)
|
|
107
|
-
* Default: "assets"
|
|
108
|
-
*/
|
|
109
38
|
getAssetsDir(): string;
|
|
110
|
-
/**
|
|
111
|
-
* Check if this is an SSR build
|
|
112
|
-
*/
|
|
113
39
|
isSSRBuild(): boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Get SSR entry point (if specified as string path)
|
|
116
|
-
*/
|
|
117
40
|
getSSREntry(): string | null;
|
|
118
|
-
/**
|
|
119
|
-
* Get server output directory for SSR builds
|
|
120
|
-
*/
|
|
121
41
|
getServerDir(): string | null;
|
|
122
|
-
/**
|
|
123
|
-
* Check if manifest.json is generated
|
|
124
|
-
*/
|
|
125
42
|
hasManifest(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Check if SSR manifest is generated
|
|
128
|
-
*/
|
|
129
43
|
hasSSRManifest(): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Get entry file naming pattern
|
|
132
|
-
* Returns null if pattern is a function (cannot be statically evaluated)
|
|
133
|
-
*/
|
|
134
44
|
getEntryFileNames(): string | null;
|
|
135
|
-
/**
|
|
136
|
-
* Get asset file naming pattern
|
|
137
|
-
* Returns null if pattern is a function (cannot be statically evaluated)
|
|
138
|
-
*/
|
|
139
45
|
getAssetFileNames(): string | null;
|
|
140
|
-
/**
|
|
141
|
-
* Get chunk file naming pattern
|
|
142
|
-
* Returns null if pattern is a function (cannot be statically evaluated)
|
|
143
|
-
*/
|
|
144
46
|
getChunkFileNames(): string | null;
|
|
145
|
-
/**
|
|
146
|
-
* Get rollup output configuration (handles array case)
|
|
147
|
-
*/
|
|
148
47
|
private getRollupOutput;
|
|
149
|
-
/**
|
|
150
|
-
* Find server entry file path
|
|
151
|
-
* Priority:
|
|
152
|
-
* 1. Derive from rollupOptions.input + entryFileNames pattern
|
|
153
|
-
* 2. Derive from build.ssr entry
|
|
154
|
-
* 3. Fall back to candidate file search
|
|
155
|
-
*/
|
|
156
48
|
findServerEntry(serverDir: string): Promise<string | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Derive server entry path from Vite configuration
|
|
159
|
-
*/
|
|
160
49
|
private deriveServerEntryFromConfig;
|
|
161
|
-
/**
|
|
162
|
-
* Extract input name from Vite configuration
|
|
163
|
-
* Handles: build.ssr (string), rollupOptions.input (string/array/object)
|
|
164
|
-
*/
|
|
165
50
|
private extractInputName;
|
|
166
|
-
/**
|
|
167
|
-
* Search for server entry using candidate file names
|
|
168
|
-
*/
|
|
169
51
|
private searchServerEntryCandidates;
|
|
170
|
-
/**
|
|
171
|
-
* Find file matching a pattern with placeholders
|
|
172
|
-
* Supports: [name], [hash], *
|
|
173
|
-
*/
|
|
174
52
|
private findFileByPattern;
|
|
175
53
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Create a ViteConfigParser instance
|
|
178
|
-
*/
|
|
179
54
|
export declare function createViteConfigParser(config: ResolvedConfig, projectRoot: string, options?: ViteConfigParserOptions): ViteConfigParser;
|
|
180
|
-
/**
|
|
181
|
-
* Parse Vite configuration (convenience function)
|
|
182
|
-
*/
|
|
183
55
|
export declare function parseViteConfig(config: ResolvedConfig, projectRoot: string, options?: ViteConfigParserOptions): Promise<ViteConfigInfo>;
|
|
184
|
-
/**
|
|
185
|
-
* Get the effective output directory from Vite config
|
|
186
|
-
* @deprecated Use ViteConfigParser.getOutputDir() instead
|
|
187
|
-
*/
|
|
56
|
+
/** @deprecated Use ViteConfigParser.getOutputDir() instead */
|
|
188
57
|
export declare function getOutputDirFromViteConfig(viteConfig: ResolvedConfig, logger?: Logger): string;
|
|
189
|
-
/**
|
|
190
|
-
* Get the effective server directory from Vite config
|
|
191
|
-
* @deprecated Use ViteConfigParser.getServerDir() instead
|
|
192
|
-
*/
|
|
58
|
+
/** @deprecated Use ViteConfigParser.getServerDir() instead */
|
|
193
59
|
export declare function getServerDirFromViteConfig(viteConfig: ResolvedConfig, projectRoot: string, logger?: Logger): string | null;
|
|
194
|
-
/**
|
|
195
|
-
* Extract server entry path from Vite config
|
|
196
|
-
* @deprecated Use ViteConfigParser.findServerEntry() instead
|
|
197
|
-
*/
|
|
60
|
+
/** @deprecated Use ViteConfigParser.findServerEntry() instead */
|
|
198
61
|
export declare function getServerEntryFromViteConfig(viteConfig: ResolvedConfig, serverDir: string, logger?: Logger): Promise<string | null>;
|
|
199
62
|
//# sourceMappingURL=vite-config-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-config-parser.d.ts","sourceRoot":"","sources":["../src/vite-config-parser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"vite-config-parser.d.ts","sourceRoot":"","sources":["../src/vite-config-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAMD,qBAAa,gBAAgB;IAC3B,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