@chuckcchen/vite-plugin 0.0.2 → 0.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/bundler.d.ts CHANGED
@@ -1,22 +1,22 @@
1
1
  /**
2
- * EdgeOne Vite Plugin Adapter - 服务端打包模块
2
+ * EdgeOne Vite Plugin Adapter - Server Bundling Module
3
3
  *
4
- * 本模块负责使用 esbuild 打包服务端代码,主要功能包括:
5
- * - 将框架的服务端构建产物打包成单个文件
6
- * - 生成 HTTP 请求处理的包装器代码
7
- * - 处理 Node.js 请求到 Web API Request 的转换
4
+ * This module handles server-side code bundling using esbuild, main features include:
5
+ * - Bundle framework's server build artifacts into a single file
6
+ * - Generate HTTP request handling wrapper code
7
+ * - Handle Node.js request to Web API Request conversion
8
8
  */
9
9
  import * as esbuild from "esbuild";
10
10
  import type { BuildContext, ServerBundleConfig, ServerWrapperConfig } from "./types.js";
11
11
  /**
12
- * 使用 esbuild 打包服务端代码
12
+ * Bundle server code using esbuild
13
13
  *
14
- * 将服务端入口文件及其所有依赖打包成单个 JavaScript 文件,
15
- * 以便在 EdgeOne 边缘函数环境中运行
14
+ * Bundle server entry file and all dependencies into a single JavaScript file
15
+ * for running in EdgeOne edge function environment
16
16
  *
17
- * @param context - 构建上下文,包含项目根目录和日志工具
18
- * @param config - 打包配置,包含入口点、输出路径等
19
- * @returns esbuild 的构建结果,包含元数据信息
17
+ * @param context - Build context containing project root and logger
18
+ * @param config - Bundle configuration including entry points, output path, etc.
19
+ * @returns esbuild build result containing metadata info
20
20
  *
21
21
  * @example
22
22
  * await bundleServerCode(context, {
@@ -26,17 +26,17 @@ import type { BuildContext, ServerBundleConfig, ServerWrapperConfig } from "./ty
26
26
  */
27
27
  export declare function bundleServerCode(context: BuildContext, config: ServerBundleConfig): Promise<esbuild.BuildResult>;
28
28
  /**
29
- * 创建服务端包装器文件
29
+ * Create server wrapper file
30
30
  *
31
- * 将框架的服务端构建产物包装成一个统一的 HTTP 请求处理器,
32
- * 该包装器负责:
33
- * 1. Node.js IncomingMessage 转换为 Web API Request 对象
34
- * 2. 调用框架的请求处理函数
35
- * 3. 导出统一的请求处理接口
31
+ * Wrap framework's server build artifacts into a unified HTTP request handler.
32
+ * The wrapper is responsible for:
33
+ * 1. Converting Node.js IncomingMessage to Web API Request object
34
+ * 2. Calling framework's request handler function
35
+ * 3. Exporting unified request handling interface
36
36
  *
37
- * @param context - 构建上下文
38
- * @param config - 包装器配置
39
- * @returns 生成的临时包装器文件路径
37
+ * @param context - Build context
38
+ * @param config - Wrapper configuration
39
+ * @returns Path to generated temporary wrapper file
40
40
  *
41
41
  * @example
42
42
  * const wrapperPath = await createServerWrapper(context, {
@@ -45,22 +45,22 @@ export declare function bundleServerCode(context: BuildContext, config: ServerBu
45
45
  */
46
46
  export declare function createServerWrapper(context: BuildContext, config: ServerWrapperConfig): Promise<string>;
47
47
  /**
48
- * 清理临时包装器文件
49
- * 在打包完成后删除临时生成的包装器文件
48
+ * Cleanup temporary wrapper file
49
+ * Delete temporarily generated wrapper file after bundling completes
50
50
  *
51
- * @param wrapperPath - 包装器文件路径
51
+ * @param wrapperPath - Wrapper file path
52
52
  */
53
53
  export declare function cleanupWrapper(wrapperPath: string): Promise<void>;
54
54
  /**
55
- * 获取打包结果的文件大小
55
+ * Get bundle result file size
56
56
  *
57
- * @param result - esbuild 的构建结果
58
- * @returns 打包后的文件大小(字节),如果无法获取则返回 0
57
+ * @param result - esbuild build result
58
+ * @returns Bundled file size in bytes, returns 0 if unavailable
59
59
  *
60
60
  * @example
61
61
  * const result = await bundleServerCode(context, config);
62
62
  * const size = getBundleSize(result);
63
- * console.log(`打包大小: ${formatSize(size)}`);
63
+ * console.log(`Bundle size: ${formatSize(size)}`);
64
64
  */
65
65
  export declare function getBundleSize(result: esbuild.BuildResult): number;
66
66
  //# sourceMappingURL=bundler.d.ts.map
package/dist/bundler.js CHANGED
@@ -1,32 +1,32 @@
1
1
  /**
2
- * EdgeOne Vite Plugin Adapter - 服务端打包模块
2
+ * EdgeOne Vite Plugin Adapter - Server Bundling Module
3
3
  *
4
- * 本模块负责使用 esbuild 打包服务端代码,主要功能包括:
5
- * - 将框架的服务端构建产物打包成单个文件
6
- * - 生成 HTTP 请求处理的包装器代码
7
- * - 处理 Node.js 请求到 Web API Request 的转换
4
+ * This module handles server-side code bundling using esbuild, main features include:
5
+ * - Bundle framework's server build artifacts into a single file
6
+ * - Generate HTTP request handling wrapper code
7
+ * - Handle Node.js request to Web API Request conversion
8
8
  */
9
9
  import * as esbuild from "esbuild";
10
10
  import path from "path";
11
11
  import { readFile, writeFile, deleteFile, ensureDirectory } from "./utils.js";
12
12
  /**
13
- * 默认的 ESM 兼容性代码头
14
- * 用于在 ESM 模块中提供 CommonJS require、__filename__dirname 支持
15
- * 这是因为某些依赖可能仍然使用 CommonJS 语法
13
+ * Default ESM compatibility banner code
14
+ * Provides CommonJS require, __filename, __dirname support in ESM modules
15
+ * This is because some dependencies may still use CommonJS syntax
16
16
  */
17
17
  const DEFAULT_BANNER = `import { createRequire } from 'node:module';
18
18
  const require = createRequire(import.meta.url);
19
19
  const __filename = new URL('', import.meta.url).pathname;
20
20
  const __dirname = new URL('.', import.meta.url).pathname;`;
21
21
  /**
22
- * 使用 esbuild 打包服务端代码
22
+ * Bundle server code using esbuild
23
23
  *
24
- * 将服务端入口文件及其所有依赖打包成单个 JavaScript 文件,
25
- * 以便在 EdgeOne 边缘函数环境中运行
24
+ * Bundle server entry file and all dependencies into a single JavaScript file
25
+ * for running in EdgeOne edge function environment
26
26
  *
27
- * @param context - 构建上下文,包含项目根目录和日志工具
28
- * @param config - 打包配置,包含入口点、输出路径等
29
- * @returns esbuild 的构建结果,包含元数据信息
27
+ * @param context - Build context containing project root and logger
28
+ * @param config - Bundle configuration including entry points, output path, etc.
29
+ * @returns esbuild build result containing metadata info
30
30
  *
31
31
  * @example
32
32
  * await bundleServerCode(context, {
@@ -36,43 +36,43 @@ const __dirname = new URL('.', import.meta.url).pathname;`;
36
36
  */
37
37
  export async function bundleServerCode(context, config) {
38
38
  const { projectRoot, logger } = context;
39
- logger.verbose("正在打包服务端代码...");
40
- // 确保输出目录存在
39
+ logger.verbose("Bundling server code...");
40
+ // Ensure output directory exists
41
41
  await ensureDirectory(path.dirname(config.outfile));
42
- // 使用 esbuild 进行打包
42
+ // Bundle using esbuild
43
43
  const result = await esbuild.build({
44
- entryPoints: config.entryPoints, // 入口文件列表
45
- bundle: true, // 启用打包模式,将所有依赖打包到一起
46
- platform: "node", // 目标平台为 Node.js
47
- target: "node18", // 目标 Node.js 版本
48
- format: "esm", // 输出格式为 ESM
49
- outfile: config.outfile, // 输出文件路径
50
- minify: false, // 不压缩代码,便于调试
51
- treeShaking: true, // 启用 Tree Shaking 移除未使用的代码
52
- external: ["node:*", ...(config.external || [])], // 排除 Node.js 内置模块
53
- metafile: true, // 生成元数据文件,用于分析打包结果
54
- logLevel: "warning", // 日志级别
55
- absWorkingDir: projectRoot, // 工作目录
44
+ entryPoints: config.entryPoints, // Entry file list
45
+ bundle: true, // Enable bundling, pack all dependencies together
46
+ platform: "node", // Target platform is Node.js
47
+ target: "node18", // Target Node.js version
48
+ format: "esm", // Output format is ESM
49
+ outfile: config.outfile, // Output file path
50
+ minify: false, // Don't minify for easier debugging
51
+ treeShaking: true, // Enable tree shaking to remove unused code
52
+ external: ["node:*", ...(config.external || [])], // Exclude Node.js built-in modules
53
+ metafile: true, // Generate metafile for bundle analysis
54
+ logLevel: "warning", // Log level
55
+ absWorkingDir: projectRoot, // Working directory
56
56
  banner: {
57
- js: DEFAULT_BANNER, // 添加 ESM 兼容性代码头
57
+ js: DEFAULT_BANNER, // Add ESM compatibility banner
58
58
  },
59
- ...config.esbuildOptions, // 合并额外的 esbuild 配置
59
+ ...config.esbuildOptions, // Merge additional esbuild options
60
60
  });
61
- logger.verbose(`服务端代码已打包到: ${config.outfile}`);
61
+ logger.verbose(`Server code bundled to: ${config.outfile}`);
62
62
  return result;
63
63
  }
64
64
  /**
65
- * 创建服务端包装器文件
65
+ * Create server wrapper file
66
66
  *
67
- * 将框架的服务端构建产物包装成一个统一的 HTTP 请求处理器,
68
- * 该包装器负责:
69
- * 1. Node.js IncomingMessage 转换为 Web API Request 对象
70
- * 2. 调用框架的请求处理函数
71
- * 3. 导出统一的请求处理接口
67
+ * Wrap framework's server build artifacts into a unified HTTP request handler.
68
+ * The wrapper is responsible for:
69
+ * 1. Converting Node.js IncomingMessage to Web API Request object
70
+ * 2. Calling framework's request handler function
71
+ * 3. Exporting unified request handling interface
72
72
  *
73
- * @param context - 构建上下文
74
- * @param config - 包装器配置
75
- * @returns 生成的临时包装器文件路径
73
+ * @param context - Build context
74
+ * @param config - Wrapper configuration
75
+ * @returns Path to generated temporary wrapper file
76
76
  *
77
77
  * @example
78
78
  * const wrapperPath = await createServerWrapper(context, {
@@ -81,88 +81,88 @@ export async function bundleServerCode(context, config) {
81
81
  */
82
82
  export async function createServerWrapper(context, config) {
83
83
  const { projectRoot, logger } = context;
84
- logger.verbose("正在创建服务端包装器...");
85
- // 读取原始服务端构建内容
84
+ logger.verbose("Creating server wrapper...");
85
+ // Read original server build content
86
86
  const serverBuildContent = await readFile(config.serverEntryPath);
87
- // 生成包装器内容
87
+ // Generate wrapper content
88
88
  let wrapperContent;
89
89
  if (config.wrapperTemplate) {
90
- // 使用自定义模板,替换占位符
90
+ // Use custom template, replace placeholders
91
91
  wrapperContent = config.wrapperTemplate.replace("{{SERVER_BUILD_CONTENT}}", serverBuildContent);
92
92
  }
93
93
  else {
94
- // 使用默认包装器模板
94
+ // Use default wrapper template
95
95
  wrapperContent = generateDefaultWrapper(serverBuildContent, config);
96
96
  }
97
- // 写入临时文件
97
+ // Write to temporary file
98
98
  const tempPath = path.join(projectRoot, "server-wrapper.temp.js");
99
99
  await writeFile(tempPath, wrapperContent);
100
- logger.verbose("服务端包装器创建完成");
100
+ logger.verbose("Server wrapper created");
101
101
  return tempPath;
102
102
  }
103
103
  /**
104
- * 清理临时包装器文件
105
- * 在打包完成后删除临时生成的包装器文件
104
+ * Cleanup temporary wrapper file
105
+ * Delete temporarily generated wrapper file after bundling completes
106
106
  *
107
- * @param wrapperPath - 包装器文件路径
107
+ * @param wrapperPath - Wrapper file path
108
108
  */
109
109
  export async function cleanupWrapper(wrapperPath) {
110
110
  try {
111
111
  await deleteFile(wrapperPath);
112
112
  }
113
113
  catch {
114
- // 忽略删除错误(文件可能不存在)
114
+ // Ignore delete errors (file may not exist)
115
115
  }
116
116
  }
117
117
  /**
118
- * 生成默认的服务端包装器代码
118
+ * Generate default server wrapper code
119
119
  *
120
- * 包装器代码包含:
121
- * 1. 原始服务端构建内容
122
- * 2. Node.js 请求到 Web Request 的转换函数
123
- * 3. 统一的请求处理器导出
120
+ * Wrapper code contains:
121
+ * 1. Original server build content
122
+ * 2. Node.js request to Web Request conversion function
123
+ * 3. Unified request handler export
124
124
  *
125
- * @param serverBuildContent - 服务端构建的原始代码内容
126
- * @param config - 包装器配置
127
- * @returns 生成的包装器代码字符串
125
+ * @param serverBuildContent - Original server build code content
126
+ * @param config - Wrapper configuration
127
+ * @returns Generated wrapper code string
128
128
  */
129
129
  function generateDefaultWrapper(serverBuildContent, config) {
130
130
  const banner = config.banner || "";
131
131
  const exports = config.exports || [];
132
- // 构建导出语句
132
+ // Build export statement
133
133
  const exportsStr = exports.length > 0
134
134
  ? exports.join(", ")
135
135
  : "default as handler";
136
- return `// ========== 服务端构建内容 ==========
136
+ return `// ========== Server Build Content ==========
137
137
  ${serverBuildContent}
138
138
 
139
- // ========== HTTP 服务端包装器 ==========
139
+ // ========== HTTP Server Wrapper ==========
140
140
  ${banner}
141
141
 
142
142
  /**
143
- * Node.js IncomingMessage 转换为 Web API Request
143
+ * Convert Node.js IncomingMessage to Web API Request
144
144
  *
145
- * EdgeOne 边缘函数使用 Web API 标准的 Request/Response
146
- * 但某些框架的服务端构建可能期望 Node.js 风格的请求对象,
147
- * 此函数负责进行转换
145
+ * EdgeOne edge functions use Web API standard Request/Response,
146
+ * but some framework server builds may expect Node.js style request objects.
147
+ * This function handles the conversion.
148
148
  *
149
- * @param nodeReq - Node.js IncomingMessage 对象
150
- * @returns Web API Request 对象
149
+ * @param nodeReq - Node.js IncomingMessage object
150
+ * @returns Web API Request object
151
151
  */
152
152
  function nodeRequestToWebRequest(nodeReq) {
153
- // 构建完整的 URL
154
- // 根据连接是否加密判断协议
153
+ // Build complete URL
154
+ // Determine protocol based on whether connection is encrypted
155
155
  const protocol = nodeReq.connection?.encrypted ? 'https' : 'http';
156
156
  const host = nodeReq.headers.host || 'localhost';
157
157
  const url = \`\${protocol}://\${host}\${nodeReq.url}\`;
158
158
 
159
- // 转换请求头
160
- // Node.js headers 是普通对象,需要转换为 Headers 实例
159
+ // Convert request headers
160
+ // Node.js headers are plain objects, need to convert to Headers instance
161
161
  const headers = new Headers();
162
162
  for (const [key, value] of Object.entries(nodeReq.headers)) {
163
163
  if (value) {
164
164
  if (Array.isArray(value)) {
165
- // 多值头部(如 Set-Cookie)需要多次 append
165
+ // Multi-value headers (like Set-Cookie) need multiple appends
166
166
  value.forEach(v => headers.append(key, v));
167
167
  } else {
168
168
  headers.set(key, value);
@@ -170,14 +170,14 @@ function nodeRequestToWebRequest(nodeReq) {
170
170
  }
171
171
  }
172
172
 
173
- // 构建 Request 初始化选项
173
+ // Build Request init options
174
174
  const init = {
175
175
  method: nodeReq.method,
176
176
  headers: headers,
177
177
  };
178
178
 
179
- // 对于非 GET/HEAD 请求,添加请求体
180
- // GET HEAD 请求不应该有请求体
179
+ // Add request body for non-GET/HEAD requests
180
+ // GET and HEAD requests should not have body
181
181
  if (nodeReq.method !== 'GET' && nodeReq.method !== 'HEAD') {
182
182
  init.body = nodeReq;
183
183
  }
@@ -186,14 +186,14 @@ function nodeRequestToWebRequest(nodeReq) {
186
186
  }
187
187
 
188
188
  /**
189
- * Node.js 请求处理器包装函数
189
+ * Node.js request handler wrapper function
190
190
  *
191
- * 这是导出给 EdgeOne 边缘函数调用的主入口
192
- * 负责将 Node.js 请求转换后传递给框架的处理函数
191
+ * This is the main entry exported for EdgeOne edge functions to call.
192
+ * Responsible for converting Node.js request before passing to framework handler.
193
193
  *
194
- * @param nodeReq - Node.js 的请求对象
195
- * @param args - 其他参数(如环境变量、上下文等)
196
- * @returns 框架处理函数的返回值(通常是 Response 对象)
194
+ * @param nodeReq - Node.js request object
195
+ * @param args - Other arguments (e.g. env variables, context, etc.)
196
+ * @returns Framework handler return value (usually Response object)
197
197
  */
198
198
  async function nodeRequestHandler(nodeReq, ...args) {
199
199
  const webRequest = nodeRequestToWebRequest(nodeReq);
@@ -205,25 +205,25 @@ export { ${exportsStr} };
205
205
  `;
206
206
  }
207
207
  /**
208
- * 获取打包结果的文件大小
208
+ * Get bundle result file size
209
209
  *
210
- * @param result - esbuild 的构建结果
211
- * @returns 打包后的文件大小(字节),如果无法获取则返回 0
210
+ * @param result - esbuild build result
211
+ * @returns Bundled file size in bytes, returns 0 if unavailable
212
212
  *
213
213
  * @example
214
214
  * const result = await bundleServerCode(context, config);
215
215
  * const size = getBundleSize(result);
216
- * console.log(`打包大小: ${formatSize(size)}`);
216
+ * console.log(`Bundle size: ${formatSize(size)}`);
217
217
  */
218
218
  export function getBundleSize(result) {
219
- // 需要 metafile 才能获取大小信息
219
+ // Need metafile to get size info
220
220
  if (!result.metafile)
221
221
  return 0;
222
222
  const outputs = result.metafile.outputs;
223
223
  const outputKeys = Object.keys(outputs);
224
224
  if (outputKeys.length === 0)
225
225
  return 0;
226
- // 返回第一个输出文件的大小
226
+ // Return size of first output file
227
227
  return outputs[outputKeys[0]].bytes;
228
228
  }
229
229
  //# sourceMappingURL=bundler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAgEG,UAAU;CACpB,CAAC;AACF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,MAA2B;IACvD,iCAAiC;IACjC,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,OAAO,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAExC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEtC,mCAAmC;IACnC,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtC,CAAC"}
package/dist/core.d.ts CHANGED
@@ -1,30 +1,30 @@
1
1
  /**
2
- * EdgeOne Vite Plugin Adapter - 核心插件模块
2
+ * EdgeOne Vite Plugin Adapter - Core Plugin Module
3
3
  *
4
- * 本模块是整个适配器系统的核心,负责:
5
- * - 构建产物检测:自动识别客户端和服务端的构建输出
6
- * - 静态资源复制:将客户端构建产物复制到部署目录
7
- * - 服务端代码打包:将服务端代码打包成单文件
8
- * - 路由配置生成:根据框架特性生成路由信息
9
- * - Meta.json 生成:生成 EdgeOne 部署所需的配置文件
4
+ * This module is the core of the adapter system, responsible for:
5
+ * - Build artifacts detection: Auto-detect client and server build outputs
6
+ * - Static assets copying: Copy client build artifacts to deployment directory
7
+ * - Server code bundling: Bundle server code into a single file
8
+ * - Route config generation: Generate route info based on framework features
9
+ * - Meta.json generation: Generate configuration file for EdgeOne deployment
10
10
  */
11
11
  import type { Plugin } from "vite";
12
12
  import type { CoreAdapterOptions } from "./types.js";
13
13
  /**
14
- * 创建 EdgeOne 核心适配器插件
14
+ * Create EdgeOne core adapter plugin
15
15
  *
16
- * 这是创建适配器的主要入口函数,返回一个 Vite 插件实例。
17
- * 该插件会在 Vite 构建完成后执行,处理构建产物并生成部署配置。
16
+ * This is the main entry function for creating adapters, returns a Vite plugin instance.
17
+ * The plugin executes after Vite build completes, processing build artifacts and generating deployment config.
18
18
  *
19
- * @param options - 适配器配置选项
20
- * @returns Vite 插件实例
19
+ * @param options - Adapter configuration options
20
+ * @returns Vite plugin instance
21
21
  *
22
22
  * @example
23
- * // 基本用法
23
+ * // Basic usage
24
24
  * createCoreAdapter({ verbose: true })
25
25
  *
26
26
  * @example
27
- * // 使用框架适配器
27
+ * // Using framework adapter
28
28
  * createCoreAdapter({
29
29
  * adapter: myFrameworkAdapter,
30
30
  * outputDir: '.edgeone'
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAEnD,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,YAAY,CAAC;AAepB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAmI1E;AAyRD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAEnD,OAAO,KAAK,EACV,kBAAkB,EAOnB,MAAM,YAAY,CAAC;AAepB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAiJ1E;AAgTD,eAAe,iBAAiB,CAAC"}