Skip to content

Commit 8a08a90

Browse files
authored
Merge pull request #189 from rollup/sync-639f4ebe
docs(en): merge rollup/master into rollup-docs-cn/master @ 639f4eb
2 parents 63569c3 + 73c81cc commit 8a08a90

16 files changed

Lines changed: 429 additions & 411 deletions

File tree

.github/workflows/build-and-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ jobs:
246246
with:
247247
version: 0.14.1
248248
- name: Install cargo-zigbuild
249-
uses: taiki-e/install-action@b9c5db3aef04caffaf95a1d03931de10fb2a140f # v2.65.1
249+
uses: taiki-e/install-action@ff581034fb69296c525e51afd68cb9823bfbe4ed # v2.65.8
250250
if: ${{ matrix.settings.cross == 'zig' }}
251251
env:
252252
GITHUB_TOKEN: ${{ github.token }}

build-plugins/load-cli-help.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { readFile } from 'node:fs/promises';
2+
import type { Plugin } from 'rollup';
3+
4+
export default function loadCliHelp(): Plugin {
5+
return {
6+
async load(id) {
7+
if (id.endsWith('help.md')) {
8+
const [rawHelpFile, packageFile] = await Promise.all([
9+
readFile(id, 'utf8'),
10+
readFile(new URL('../package.json', import.meta.url), 'utf8')
11+
]);
12+
const finalHelpFile = rawHelpFile
13+
.replaceAll(/^\/\/\s*#(end)?region[^\n]*\n/gm, '')
14+
.replace('__VERSION__', JSON.parse(packageFile).version);
15+
return `export default ${JSON.stringify(finalHelpFile)};`;
16+
}
17+
return null;
18+
},
19+
name: 'load-cli-help'
20+
};
21+
}

cli/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const command = argParser(process.argv.slice(2), {
1212
});
1313

1414
if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) {
15-
console.log(`\n${help.replace('__VERSION__', version)}\n`);
15+
console.log(`\n${help}\n`);
1616
} else if (command.version) {
1717
console.log(`rollup v${version}`);
1818
} else {

cli/help.md

Lines changed: 101 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,105 +3,108 @@ rollup version __VERSION__
33

44
Usage: rollup [options] <entry file>
55

6-
Basic options:
6+
Options:
77

8-
-c, --config <filename> Use this config file (if argument is used but value
9-
is unspecified, defaults to rollup.config.js)
10-
-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)
11-
-e, --external <ids> Comma-separate list of module IDs to exclude
12-
-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)
13-
-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs
14-
-h, --help Show this help message
15-
-i, --input <filename> Input (alternative to <entry file>)
16-
-m, --sourcemap Generate sourcemap (`-m inline` for inline map)
17-
-n, --name <name> Name for UMD export
18-
-o, --file <output> Single output file (if absent, prints to stdout)
19-
-p, --plugin <plugin> Use the plugin specified (may be repeated)
20-
-v, --version Show version number
21-
-w, --watch Watch files in bundle and rebuild on changes
22-
--amd.autoId Generate the AMD ID based off the chunk name
23-
--amd.basePath <prefix> Path to prepend to auto generated AMD ID
24-
--amd.define <name> Function to use in place of `define`
25-
--amd.forceJsExtensionForImports Use `.js` extension in AMD imports
26-
--amd.id <id> ID for AMD module (default is anonymous)
27-
--assetFileNames <pattern> Name pattern for emitted assets
28-
--banner <text> Code to insert at top of bundle (outside wrapper)
29-
--chunkFileNames <pattern> Name pattern for emitted secondary chunks
30-
--compact Minify wrapper code
31-
--context <variable> Specify top-level `this` value
32-
--no-dynamicImportInCjs Write external dynamic CommonJS imports as require
33-
--entryFileNames <pattern> Name pattern for emitted entry chunks
34-
--environment <values> Settings passed to config file (see example)
35-
--no-esModule Do not add __esModule property
36-
--exports <mode> Specify export mode (auto, default, named, none)
37-
--extend Extend global variable defined by --name
38-
--no-externalImportAttributes Omit import attributes in "es" output
39-
--no-externalLiveBindings Do not generate code to support live bindings
40-
--failAfterWarnings Exit with an error if the build produced warnings
41-
--filterLogs <filter> Filter log messages
42-
--footer <text> Code to insert at end of bundle (outside wrapper)
43-
--forceExit Force exit the process when done
44-
--no-freeze Do not freeze namespace objects
45-
--generatedCode <preset> Which code features to use (es5/es2015)
46-
--generatedCode.arrowFunctions Use arrow functions in generated code
47-
--generatedCode.constBindings Use "const" in generated code
48-
--generatedCode.objectShorthand Use shorthand properties in generated code
49-
--no-generatedCode.reservedNamesAsProps Always quote reserved names as props
50-
--generatedCode.symbols Use symbols in generated code
51-
--hashCharacters <name> Use the specified character set for file hashes
52-
--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks
53-
--importAttributesKey <name> Use the specified keyword for import attributes
54-
--no-indent Don't indent result
55-
--inlineDynamicImports Create single bundle when using dynamic imports
56-
--no-interop Do not include interop block
57-
--intro <text> Code to insert at top of bundle (inside wrapper)
58-
--logLevel <level> Which kind of logs to display
59-
--no-makeAbsoluteExternalsRelative Prevent normalization of external imports
60-
--maxParallelFileOps <value> How many files to read in parallel
61-
--minifyInternalExports Force or disable minification of internal exports
62-
--noConflict Generate a noConflict method for UMD globals
63-
--outro <text> Code to insert at end of bundle (inside wrapper)
64-
--perf Display performance timings
65-
--no-preserveEntrySignatures Avoid facade chunks for entry points
66-
--preserveModules Preserve module structure
67-
--preserveModulesRoot Put preserved modules under this path at root level
68-
--preserveSymlinks Do not follow symlinks when resolving files
69-
--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports
70-
--no-sanitizeFileName Do not replace invalid characters in file names
71-
--shimMissingExports Create shim variables for missing exports
72-
--silent Don't print warnings
73-
--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base
74-
--sourcemapDebugIds Emit unique debug ids in source and sourcemaps
75-
--sourcemapExcludeSources Do not include source code in source maps
76-
--sourcemapFile <file> Specify bundle position for source maps
77-
--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps
78-
--stdin=ext Specify file extension used for stdin input
79-
--no-stdin Do not read "-" from stdin
80-
--no-strict Don't emit `"use strict";` in the generated modules
81-
--strictDeprecations Throw errors for deprecated features
82-
--no-systemNullSetters Do not replace empty SystemJS setters with `null`
83-
--no-treeshake Disable tree-shaking optimisations
84-
--no-treeshake.annotations Ignore pure call annotations
85-
--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared
86-
--treeshake.manualPureFunctions <names> Manually declare functions as pure
87-
--no-treeshake.moduleSideEffects Assume modules have no side effects
88-
--no-treeshake.propertyReadSideEffects Ignore property access side effects
89-
--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking
90-
--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw
91-
--validate Validate output
92-
--waitForBundleInput Wait for bundle input files
93-
--watch.allowInputInsideOutputPath Whether the input path is allowed to be a
94-
subpath of the output path
95-
--watch.buildDelay <number> Throttle watch rebuilds
96-
--no-watch.clearScreen Do not clear the screen when rebuilding
97-
--watch.exclude <files> Exclude files from being watched
98-
--watch.include <files> Limit watching to specified files
99-
--watch.onBundleEnd <cmd> Shell command to run on `"BUNDLE_END"` event
100-
--watch.onBundleStart <cmd> Shell command to run on `"BUNDLE_START"` event
101-
--watch.onEnd <cmd> Shell command to run on `"END"` event
102-
--watch.onError <cmd> Shell command to run on `"ERROR"` event
103-
--watch.onStart <cmd> Shell command to run on `"START"` event
104-
--watch.skipWrite Do not write files to disk when watching
8+
// #region options
9+
-c, --config <filename> 使用此配置文件(如果使用了该参
10+
数但未指定值时,Rollup 将尝试按以下顺序加载
11+
配置文件:
12+
rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)
13+
-d, --dir <dirname> 用于块的目录(如果不存在,则打印到 stdout)
14+
-e, --external <ids> 排除模块 ID 的逗号分隔列表
15+
-f, --format <format> 输出类型(amd、cjs、es、iife、umd、system)
16+
-g, --globals <pairs> `moduleID:Global` 对的逗号分隔列表
17+
-h, --help 显示此帮助消息
18+
-i, --input <filename> 输入(替代 <entry file>)
19+
-m, --sourcemap 生成源映射(`-m inline` 为内联映射)
20+
-n, --name <name> UMD 导出的名称
21+
-o, --file <output> 单个输出文件(如果不存在,则打印到 stdout)
22+
-p, --plugin <plugin> 使用指定的插件(可重复)
23+
-v, --version 显示版本号
24+
-w, --watch 监视产物文件并在更改时重新构建
25+
--amd.autoId 基于块名称生成 AMD ID
26+
--amd.basePath <prefix> 要预先添加到自动生成的 AMD ID 的路径
27+
--amd.define <name> 在 `define` 位置使用的函数
28+
--amd.forceJsExtensionForImports 在 AMD 导入中使用 `.js` 扩展名
29+
--amd.id <id> AMD 模块的 ID(默认为匿名)
30+
--assetFileNames <pattern> 发布资源的名称模式
31+
--banner <text> 在产物顶部插入的代码(位于包装器之外)
32+
--chunkFileNames <pattern> 发布次要块的名称模式
33+
--compact 缩小包装器代码
34+
--context <variable> 指定顶级 `this`
35+
--no-dynamicImportInCjs 将外部动态 CommonJS 导入编写为 require
36+
--entryFileNames <pattern> 发布入口块的名称模式
37+
--environment <values> 传递给配置文件的设置(请参阅示例)
38+
--no-esModule 不添加 __esModule 属性
39+
--exports <mode> 指定导出模式(auto、default、named、none)
40+
--extend 扩展由 --name 定义的全局变量
41+
--no-externalImportAttributes 在 "es" 格式输出中省略导入属性
42+
--no-externalLiveBindings 不生成支持实时绑定的代码
43+
--failAfterWarnings 如果生成的构建产生警告,则退出并显示错误
44+
--filterLogs <filter> 过滤日志信息
45+
--footer <text> 在产物底部插入的代码(位于包装器之外)
46+
--forceExit 当任务完成后,强制结束进程
47+
--no-freeze 不冻结命名空间对象
48+
--generatedCode <preset> 使用哪些代码特性(es5/es2015)
49+
--generatedCode.arrowFunctions 在生成的代码中使用箭头函数
50+
--generatedCode.constBindings 在生成的代码中使用 "const"
51+
--generatedCode.objectShorthand 在生成的代码中使用简写属性
52+
--no-generatedCode.reservedNamesAsProps 始终引用保留名称作为 props
53+
--generatedCode.symbols 在生成的代码中使用符号
54+
--hashCharacters <name> 使用指定的字符集来生成文件的哈希值
55+
--no-hoistTransitiveImports 不将中转导入提升到入口块中
56+
--importAttributesKey <name> 使用特定的关键词作为导入属性
57+
--no-indent 不缩进结果
58+
--inlineDynamicImports 使用动态导入时创建单次打包
59+
--no-interop 不包括交互操作块
60+
--intro <text> 在产物顶部插入的代码(位于包装器内部)
61+
--logLevel <level> 要显示哪种类型的日志
62+
--no-makeAbsoluteExternalsRelative 不规范化外部导入
63+
--maxParallelFileOps <value> 并行读取的文件数
64+
--minifyInternalExports 强制或禁用内部导出的缩小
65+
--noConflict 为 UMD 全局生成 noConflict 方法
66+
--outro <text> 在产物底部插入的代码(位于包装器内部)
67+
--perf 显示性能计时
68+
--no-preserveEntrySignatures 避免入口点的门面块
69+
--preserveModules 保留模块结构
70+
--preserveModulesRoot 将保留的模块放置在根路径下的此路径下
71+
--preserveSymlinks 解析文件时不要跟随符号链接
72+
--no-reexportProtoFromExternal 在使用重新导出星号('*')时,忽略 __proto__
73+
--no-sanitizeFileName 不要替换文件名中的无效字符
74+
--shimMissingExports 为丢失的导出创建卡扣变量
75+
--silent 不打印警告
76+
--sourcemapBaseUrl <url> 使用给定的基本 URL 发出绝对源映射 URL
77+
--sourcemapDebugIds 在源代码和源映射中生成唯一的 debug ID
78+
--sourcemapExcludeSources 在源映射中不包括源代码
79+
--sourcemapFile <file> 指定源映射的包位置
80+
--sourcemapFileNames <pattern> 编译后 sourcemap 的命名模式
81+
--stdin=ext 指定用于标准输入的文件扩展名
82+
--no-stdin 不要从 stdin 读取 "-"
83+
--no-strict 不在生成的模块中发出 `"use strict";`
84+
--strictDeprecations 抛出有关不推荐使用的功能的错误
85+
--no-systemNullSetters 不要将空的 SystemJS setter 替换为 `null`
86+
--no-treeshake 禁用除屑优化
87+
--no-treeshake.annotations 忽略纯调用注释
88+
--treeshake.correctVarValueBeforeDeclaration 在声明之前将变量取消优化
89+
--treeshake.manualPureFunctions <names> 手动将函数声明为纯函数
90+
--no-treeshake.moduleSideEffects 假设模块没有副作用
91+
--no-treeshake.propertyReadSideEffects 忽略属性访问副作用
92+
--no-treeshake.tryCatchDeoptimization 不要关闭 try-catch-tree-shaking
93+
--no-treeshake.unknownGlobalSideEffects 假设未知的全局变量不会抛出异常
94+
--validate 验证输出
95+
--waitForBundleInput 等待打包输入文件
96+
--watch.allowInputInsideOutputPath 输入路径是否允许是输出路径的子路径
97+
--watch.buildDelay <number> 节流观察重建
98+
--no-watch.clearScreen 重建时不要清除屏幕
99+
--watch.exclude <files> 排除要观察的文件
100+
--watch.include <files> 限制观察到指定文件
101+
--watch.onBundleEnd <cmd> 在 "BUNDLE_END" 事件上运行的 Shell 命令
102+
--watch.onBundleStart <cmd> 在 "BUNDLE_START" 事件上运行的 Shell 命令
103+
--watch.onEnd <cmd> 在 "END" 事件上运行的 Shell 命令
104+
--watch.onError <cmd> 在 "ERROR" 事件上运行的 Shell 命令
105+
--watch.onStart <cmd> 在 "START" 事件上运行的 Shell 命令
106+
--watch.skipWrite 在监视时不要将文件写入磁盘
107+
// #endregion options
105108

106109
Examples:
107110

0 commit comments

Comments
 (0)