rolldown-require 2.0.2 → 2.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +28 -30
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -10,25 +10,25 @@ interface CacheEvent {
10
10
  }
11
11
  interface CacheOptions {
12
12
  /**
13
- * Enable persistent cache. Pass an object to configure.
13
+ * 启用持久化缓存,可传入对象进行配置。
14
14
  */
15
15
  enabled?: boolean;
16
16
  /**
17
- * Optional cache directory. Defaults to nearest `node_modules/.rolldown-require-cache`
18
- * or `os.tmpdir()/rolldown-require-cache`.
17
+ * 可选缓存目录。默认使用最近的 `node_modules/.rolldown-require-cache`
18
+ * `os.tmpdir()/rolldown-require-cache`。
19
19
  */
20
20
  dir?: string;
21
21
  /**
22
- * Clear any existing cache entry before writing a new one.
22
+ * 写入新缓存前清理已有条目。
23
23
  */
24
24
  reset?: boolean;
25
25
  /**
26
- * Also keep a process-local in-memory cache to skip filesystem hits.
27
- * Defaults to true when persistent cache is enabled.
26
+ * 同时保留进程内缓存以减少文件系统访问。
27
+ * 启用持久化缓存时默认 true
28
28
  */
29
29
  memory?: boolean;
30
30
  /**
31
- * Receive cache events for debugging/metrics.
31
+ * 接收缓存事件,用于调试或指标统计。
32
32
  */
33
33
  onEvent?: (event: CacheEvent) => void;
34
34
  }
@@ -36,62 +36,60 @@ type GetOutputFile = (filepath: string, format: 'esm' | 'cjs') => string;
36
36
  interface Options {
37
37
  cwd?: string;
38
38
  /**
39
- * The filepath to bundle and require
39
+ * 需要打包并 require 的文件路径。
40
40
  */
41
41
  filepath: string;
42
42
  /**
43
- * The `require` function that is used to load the output file
44
- * Default to the global `require` function
45
- * This function can be asynchronous, i.e. returns a Promise
43
+ * 用于加载输出文件的 `require` 方法。
44
+ * 默认为全局 `require`。
45
+ * 可为异步函数(返回 Promise)。
46
46
  */
47
47
  require?: RequireFunction;
48
48
  /**
49
- * esbuild options
50
- *
49
+ * Rolldown 构建选项。
51
50
  */
52
51
  rolldownOptions?: {
53
52
  input?: InputOptions;
54
53
  output?: OutputOptions;
55
54
  };
56
55
  /**
57
- * Get the path to the output file
58
- * By default we simply replace the extension with `.bundled_{randomId}.js`
56
+ * 获取输出文件路径。
57
+ * 默认仅替换扩展名为 `.bundled_{randomId}.js`。
59
58
  */
60
59
  getOutputFile?: GetOutputFile;
61
60
  /**
62
- * Enable watching and call the callback after each rebuild
61
+ * 启用监听并在每次重建后触发回调。
63
62
  */
64
- /** External packages */
63
+ /** 外部依赖(external) */
65
64
  external?: ExternalOption;
66
- /** Not external packages */
65
+ /** external 的依赖 */
67
66
  /**
68
- * Automatically mark node_modules as external
69
- * @default true - `false` when `filepath` is in node_modules
67
+ * 自动将 node_modules 标记为 external
68
+ * @default true - `filepath` 位于 node_modules 时为 false
70
69
  */
71
70
  /**
72
- * A custom tsconfig path to read `paths` option
71
+ * 自定义 tsconfig 路径,用于读取 `paths` 配置。
73
72
  *
74
- * Set to `false` to disable tsconfig
73
+ * 设为 `false` 以禁用 tsconfig
75
74
  */
76
75
  tsconfig?: string | false;
77
76
  /**
78
- * Preserve compiled temporary file for debugging
79
- * Default to `process.env.BUNDLE_REQUIRE_PRESERVE`
77
+ * 保留编译后的临时文件便于调试。
78
+ * 默认为 `process.env.BUNDLE_REQUIRE_PRESERVE`。
80
79
  */
81
80
  preserveTemporaryFile?: boolean;
82
81
  /**
83
- * Provide bundle format explicitly
84
- * to skip the default format inference
82
+ * 显式指定 bundle 格式,跳过默认推断。
85
83
  */
86
84
  format?: 'cjs' | 'esm';
87
85
  /**
88
- * Enable source maps for debugging.
89
- * - `true` will default to inline source maps.
90
- * - `'inline'` forces inline source maps.
86
+ * 启用 source map 便于调试。
87
+ * - `true` 默认使用内联 source map。
88
+ * - `'inline'` 强制内联 source map。
91
89
  */
92
90
  sourcemap?: boolean | 'inline';
93
91
  /**
94
- * Persistent cache for bundled output to speed up repeated loads.
92
+ * 持久化缓存打包结果,加速重复加载。
95
93
  */
96
94
  cache?: boolean | CacheOptions;
97
95
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rolldown-require",
3
3
  "type": "module",
4
- "version": "2.0.2",
4
+ "version": "2.0.4",
5
5
  "description": "bundle and require a file using rolldown!",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@rollup/pluginutils": "^5.3.0",
55
- "get-tsconfig": "^4.13.0"
55
+ "get-tsconfig": "^4.13.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/pnpapi": "^0.0.5"