diff --git a/build-plugins/load-cli-help.ts b/build-plugins/load-cli-help.ts new file mode 100644 index 000000000..ab4d32336 --- /dev/null +++ b/build-plugins/load-cli-help.ts @@ -0,0 +1,21 @@ +import { readFile } from 'node:fs/promises'; +import type { Plugin } from 'rollup'; + +export default function loadCliHelp(): Plugin { + return { + async load(id) { + if (id.endsWith('help.md')) { + const [rawHelpFile, packageFile] = await Promise.all([ + readFile(id, 'utf8'), + readFile(new URL('../package.json', import.meta.url), 'utf8') + ]); + const finalHelpFile = rawHelpFile + .replaceAll(/^\/\/\s*#(end)?region[^\n]*\n/gm, '') + .replace('__VERSION__', JSON.parse(packageFile).version); + return `export default ${JSON.stringify(finalHelpFile)};`; + } + return null; + }, + name: 'load-cli-help' + }; +} diff --git a/cli/cli.ts b/cli/cli.ts index 2f4f105a5..87a9e3392 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -12,7 +12,7 @@ const command = argParser(process.argv.slice(2), { }); if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) { - console.log(`\n${help.replace('__VERSION__', version)}\n`); + console.log(`\n${help}\n`); } else if (command.version) { console.log(`rollup v${version}`); } else { diff --git a/cli/help.md b/cli/help.md index 8c5560d02..c042bdd35 100644 --- a/cli/help.md +++ b/cli/help.md @@ -3,10 +3,13 @@ rollup version __VERSION__ Usage: rollup [options] -Basic options: +Options: +// #region options -c, --config Use this config file (if argument is used but value - is unspecified, defaults to rollup.config.js) + is unspecified, Rollup will try to load configuration files in + the following order: + rollup.config.mjs -> rollup.config.cjs -> rollup.config.js) -d, --dir Directory for chunks (if absent, prints to stdout) -e, --external Comma-separate list of module IDs to exclude -f, --format Type of output (amd, cjs, es, iife, umd, system) @@ -91,7 +94,7 @@ Basic options: --validate Validate output --waitForBundleInput Wait for bundle input files --watch.allowInputInsideOutputPath Whether the input path is allowed to be a - subpath of the output path + subpath of the output path --watch.buildDelay Throttle watch rebuilds --no-watch.clearScreen Do not clear the screen when rebuilding --watch.exclude Exclude files from being watched @@ -102,6 +105,7 @@ Basic options: --watch.onError Shell command to run on `"ERROR"` event --watch.onStart Shell command to run on `"START"` event --watch.skipWrite Do not write files to disk when watching +// #endregion options Examples: diff --git a/docs/command-line-interface/index.md b/docs/command-line-interface/index.md index 2373a0b5c..12886f8d9 100755 --- a/docs/command-line-interface/index.md +++ b/docs/command-line-interface/index.md @@ -374,6 +374,7 @@ export default { 许多选项都有等效的命令行标志。在这些情况下,如果你正在使用配置文件,则此处传递的任何参数都将覆盖配置文件。以下是所有支持的选项列表: +<<<<<<< HEAD ``` -c, --config 使用此配置文件 (如果使用参数但未指定值,则默认为 rollup.config.js) @@ -472,6 +473,9 @@ export default { --watch.onStart 在 "START" 事件上运行的 Shell 命令 --watch.skipWrite 在监视时不要将文件写入磁盘 ``` +======= +<<< ../../cli/help.md#options{text} +>>>>>>> fe42b2d7ea3154fbfb23e68a500db55d5f8e2957 以下标志仅通过命令行界面可用。所有其他标志都对应并覆盖其配置文件等效项,请参阅[选项大列表](../configuration-options/index.md)获取详细信息。 diff --git a/package-lock.json b/package-lock.json index ba2f22260..365481b05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -85,7 +85,6 @@ "requirejs": "^2.3.8", "rollup": "^4.54.0", "rollup-plugin-license": "^3.6.0", - "rollup-plugin-string": "^3.0.0", "semver": "^7.7.3", "shx": "^0.4.0", "signal-exit": "^4.1.0", @@ -273,6 +272,7 @@ "integrity": "sha512-ZsOJqu4HOG5BlvIFnMU0YKjQ9ZI6r3C31dg2jk5kMWPSdhJpYL9xa5hEe7aieE+707dXeMI4ej3diy6mXdZpgA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@algolia/client-common": "5.46.2", "@algolia/requester-browser-xhr": "5.46.2", @@ -428,6 +428,7 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -602,6 +603,7 @@ "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", @@ -864,39 +866,13 @@ } } }, - "node_modules/@docsearch/js/node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "extraneous": true, - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@docsearch/js/node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", - "extraneous": true, - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" - }, - "peerDependencies": { - "react": "^18.3.1" - } - }, "node_modules/@docsearch/js/node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "extraneous": true, + "dev": true, "license": "MIT", + "optional": true, "dependencies": { "loose-envify": "^1.1.0" } @@ -3658,6 +3634,7 @@ "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.3", @@ -3838,7 +3815,6 @@ "integrity": "sha512-aBSREisdsGH890S2rQqK82qmQYU3uFpSH8wcZWHgHzl3LfzsxAKbLNiAG9mO8v1Y0UICBeClICxPJvyr0rcuxg==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "debug": "^4.4.0", "extract-zip": "^2.0.1", @@ -4714,8 +4690,7 @@ "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@tybys/wasm-util": { "version": "0.10.1", @@ -5234,7 +5209,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "@types/node": "*" } @@ -5284,6 +5258,7 @@ "integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/types": "8.50.1", @@ -5980,6 +5955,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -6014,7 +5990,6 @@ "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 14" } @@ -6066,6 +6041,7 @@ "integrity": "sha512-qqAXW9QvKf2tTyhpDA4qXv1IfBwD2eduSW6tUEBFIfCeE9gn9HQ9I5+MaKoenRuHrzk5sQoNh1/iof8mY7uD6Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@algolia/abtesting": "1.12.2", "@algolia/client-abtesting": "5.46.2", @@ -6229,7 +6205,6 @@ "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "tslib": "^2.0.1" }, @@ -6284,7 +6259,6 @@ "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", "dev": true, "license": "Apache-2.0", - "peer": true, "peerDependencies": { "react-native-b4a": "*" }, @@ -6307,7 +6281,6 @@ "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", "dev": true, "license": "Apache-2.0", - "peer": true, "peerDependencies": { "bare-abort-controller": "*" }, @@ -6324,7 +6297,6 @@ "dev": true, "license": "Apache-2.0", "optional": true, - "peer": true, "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", @@ -6351,7 +6323,6 @@ "dev": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "bare": ">=1.14.0" } @@ -6363,7 +6334,6 @@ "dev": true, "license": "Apache-2.0", "optional": true, - "peer": true, "dependencies": { "bare-os": "^3.0.1" } @@ -6375,7 +6345,6 @@ "dev": true, "license": "Apache-2.0", "optional": true, - "peer": true, "dependencies": { "streamx": "^2.21.0" }, @@ -6399,7 +6368,6 @@ "dev": true, "license": "Apache-2.0", "optional": true, - "peer": true, "dependencies": { "bare-path": "^3.0.0" } @@ -6423,8 +6391,7 @@ "url": "https://feross.org/support" } ], - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/baseline-browser-mapping": { "version": "2.9.11", @@ -6442,7 +6409,6 @@ "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10.0.0" } @@ -6551,6 +6517,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -6590,6 +6557,7 @@ "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -6699,7 +6667,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -6711,7 +6678,6 @@ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": "*" } @@ -7010,7 +6976,6 @@ "integrity": "sha512-6CJWHkNRoyZyjV9Rwv2lYONZf1Xm0IuDyNq97nwSsxxP3wf5Bwy15K5rOvVKMtJ127jJBmxFUanSAOjgFRxgrA==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "mitt": "3.0.1", "zod": "3.23.8" @@ -7548,7 +7513,6 @@ "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", @@ -7636,6 +7600,7 @@ "integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.10" } @@ -8093,6 +8058,7 @@ "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": ">=12" } @@ -8200,7 +8166,6 @@ "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 14" } @@ -8337,7 +8302,6 @@ "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ast-types": "^0.13.4", "escodegen": "^2.1.0", @@ -8554,7 +8518,6 @@ "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6" } @@ -8578,7 +8541,6 @@ "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -8738,7 +8700,6 @@ "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -8762,7 +8723,6 @@ "dev": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -8773,6 +8733,7 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -8833,6 +8794,7 @@ "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", + "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -9149,7 +9111,6 @@ "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "bare-events": "^2.7.0" } @@ -9272,7 +9233,6 @@ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", @@ -9324,8 +9284,7 @@ "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/fast-glob": { "version": "3.3.3", @@ -9384,7 +9343,6 @@ "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "pend": "~1.2.0" } @@ -9601,6 +9559,7 @@ "integrity": "sha512-DJJDHpEgoSbP8ZE1MNeU2IzCpfFyFdNZZRilqmfH2XiQsPK6PtD8AfJqWzEBudUQB2yHwZc5iq54rjTaGQ+ljw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "tabbable": "^6.3.0" } @@ -9848,7 +9807,6 @@ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "pump": "^3.0.0" }, @@ -9865,7 +9823,6 @@ "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "basic-ftp": "^5.0.2", "data-uri-to-buffer": "^6.0.2", @@ -10200,7 +10157,6 @@ "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -10215,7 +10171,6 @@ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "agent-base": "^7.1.2", "debug": "4" @@ -10286,8 +10241,7 @@ "url": "https://feross.org/support" } ], - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/ignore": { "version": "5.3.2", @@ -10413,7 +10367,6 @@ "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 12" } @@ -10423,8 +10376,7 @@ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/is-binary-path": { "version": "2.1.0", @@ -10872,6 +10824,7 @@ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, "license": "MIT", + "peer": true, "bin": { "jiti": "bin/jiti.js" } @@ -10958,8 +10911,7 @@ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -11471,8 +11423,9 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "extraneous": true, + "dev": true, "license": "MIT", + "optional": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -11902,6 +11855,7 @@ "integrity": "sha512-n34QPDPEKmaeCG4WDMGy0OT6PSyxKCfy2pJgShP+Qow2KLrvWjclwbc3yXfSIf4BanqWEhQEpngWwNp/XhZt6w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@braintree/sanitize-url": "^7.1.1", "@iconify/utils": "^3.0.1", @@ -12755,7 +12709,6 @@ "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 0.4.0" } @@ -13413,7 +13366,6 @@ "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@tootallnate/quickjs-emscripten": "^0.23.0", "agent-base": "^7.1.2", @@ -13434,7 +13386,6 @@ "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "degenerator": "^5.0.0", "netmask": "^2.0.2" @@ -13512,7 +13463,6 @@ "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -13756,8 +13706,7 @@ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/perfect-debounce": { "version": "1.0.0", @@ -14011,6 +13960,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -14195,6 +14145,7 @@ "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -14290,7 +14241,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.4.0" } @@ -14312,7 +14262,6 @@ "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", @@ -14333,7 +14282,6 @@ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true, "license": "ISC", - "peer": true, "engines": { "node": ">=12" } @@ -14443,7 +14391,6 @@ "integrity": "sha512-3HZ2/7hdDKZvZQ7dhhITOUg4/wOrDRjyK2ZBllRB0ZCOi9u0cwq1ACHDjBB+nX+7+kltHjQvBRdeY7+W0T+7Gg==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@puppeteer/browsers": "2.6.1", "chromium-bidi": "0.11.0", @@ -14521,6 +14468,7 @@ "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -14531,6 +14479,7 @@ "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -14913,6 +14862,7 @@ "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -14972,33 +14922,6 @@ "rollup": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, - "node_modules/rollup-plugin-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-string/-/rollup-plugin-string-3.0.0.tgz", - "integrity": "sha512-vqyzgn9QefAgeKi+Y4A7jETeIAU1zQmS6VotH6bzm/zmUQEnYkpIGRaOBPY41oiWYV4JyBoGAaBjYMYuv+6wVw==", - "dev": true, - "license": "MIT", - "dependencies": { - "rollup-pluginutils": "^2.4.1" - } - }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-pluginutils/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true, - "license": "MIT" - }, "node_modules/roughjs": { "version": "4.6.6", "resolved": "https://registry.npmjs.org/roughjs/-/roughjs-4.6.6.tgz", @@ -15302,7 +15225,6 @@ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -15321,7 +15243,6 @@ "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ip-address": "^10.0.1", "smart-buffer": "^4.2.0" @@ -15337,7 +15258,6 @@ "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", @@ -15570,7 +15490,6 @@ "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", @@ -15890,6 +15809,7 @@ "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -15973,7 +15893,6 @@ "integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "pump": "^3.0.0", "tar-stream": "^3.1.5" @@ -15989,7 +15908,6 @@ "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", @@ -16082,7 +16000,6 @@ "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "b4a": "^1.6.4" } @@ -16142,8 +16059,7 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/time-zone": { "version": "2.0.0", @@ -16298,7 +16214,8 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/twoslash": { "version": "0.3.6", @@ -16377,8 +16294,7 @@ "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/typedarray": { "version": "0.0.6", @@ -16403,6 +16319,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -16465,7 +16382,6 @@ "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" @@ -16734,6 +16650,7 @@ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -17195,6 +17112,7 @@ "integrity": "sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@vue/compiler-dom": "3.5.26", "@vue/compiler-sfc": "3.5.26", @@ -17237,6 +17155,7 @@ "integrity": "sha512-CydUvFOQKD928UzZhTp4pr2vWz1L+H99t7Pkln2QSPdvmURT0MoC4wUccfCnuEaihNsu9aYYyk+bep8rlfkUXw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0", @@ -17271,6 +17190,7 @@ "integrity": "sha512-I23Rk8dkQfmcSbxDO0dmg9ioMLjKA1pjlU3Lz6Jfk2pMGu3Uryu9810XkcZH24IzPbhzPCnkKo2rEMRX0skSrw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@volar/typescript": "2.4.27", "@vue/language-core": "3.2.1" @@ -17594,7 +17514,6 @@ "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10.0.0" }, @@ -17644,6 +17563,7 @@ "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "dev": true, "license": "ISC", + "peer": true, "bin": { "yaml": "bin.mjs" }, @@ -17789,7 +17709,6 @@ "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -17827,7 +17746,6 @@ "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "dev": true, "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index dc5de0d2e..20a8114ff 100644 --- a/package.json +++ b/package.json @@ -189,7 +189,6 @@ "requirejs": "^2.3.8", "rollup": "^4.54.0", "rollup-plugin-license": "^3.6.0", - "rollup-plugin-string": "^3.0.0", "semver": "^7.7.3", "shx": "^0.4.0", "signal-exit": "^4.1.0", diff --git a/rollup.config.ts b/rollup.config.ts index 9a213ffb0..360377fab 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -7,7 +7,6 @@ import terser from '@rollup/plugin-terser'; import typescript from '@rollup/plugin-typescript'; import { fileURLToPath } from 'node:url'; import type { Plugin, RollupOptions, WarningHandlerWithDefault } from 'rollup'; -import { string } from 'rollup-plugin-string'; import addCliEntry from './build-plugins/add-cli-entry'; import { moduleAliases } from './build-plugins/aliases'; import cleanBeforeWrite from './build-plugins/clean-before-write'; @@ -20,6 +19,7 @@ import { externalNativeImport } from './build-plugins/external-native-import'; import { fsEventsReplacement } from './build-plugins/fs-events-replacement'; import getLicenseHandler from './build-plugins/generate-license-file'; import getBanner from './build-plugins/get-banner'; +import loadCliHelp from './build-plugins/load-cli-help'; import replaceBrowserModules from './build-plugins/replace-browser-modules'; import './typings/declarations'; @@ -43,7 +43,7 @@ const nodePlugins: readonly Plugin[] = [ alias(moduleAliases), nodeResolve({ preferBuiltins: true }), json(), - string({ include: '**/*.md' }), + loadCliHelp(), commonjs({ ignoreTryCatch: false, include: 'node_modules/**' diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 039360738..eb3269bbd 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1316,9 +1316,9 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "41.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1583da0d977424f5b637daf962cd8b0a08115c2e5b1e4563c8a159b19f5c3ba" +checksum = "651029fd98d105e6082dff8a77b637b9cbe73938203ef2d7b0276dbab486860c" dependencies = [ "anyhow", "base64", @@ -1430,9 +1430,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "38.0.1" +version = "40.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c8d16175fe77d4df22505885ae16770c72b440898a2c7d44126a599bdb8488" +checksum = "767255ba2a7b13a2d4985313afbc69787e2b40fc9ffe00a3ddacb9c6c659066c" dependencies = [ "arrayvec", "bitflags", @@ -1466,9 +1466,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "29.0.2" +version = "30.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63984b544fe1d8f66e9ce616e57429bb878572fcf1504851ef9d9f4f5260e2b" +checksum = "3fb84a1b1b605c85c38a982f8f6dac4908ca73721aee9f9924d6a60e27339290" dependencies = [ "bitflags", "either", @@ -1487,9 +1487,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "32.0.0" +version = "33.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "499486ed875ba49af2f36d0d809f61ce6e42943a3aa1d97f592d96f10fe734cc" +checksum = "00691748cc689f93316bb699051eadf058852b6326930c0355fe375110318ab5" dependencies = [ "better_scoped_tls", "indexmap", @@ -1509,9 +1509,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "34.0.0" +version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7678b46f04eff0937a86bf98b2db3235818e10cfd63590653482302a905c3911" +checksum = "78357477172085963b461ae9afd1724b607d2314298d732c5504676f96df21af" dependencies = [ "bytes-str", "dashmap", @@ -1533,9 +1533,9 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "26.0.0" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb7998f23f765b1fad1e8e015e9f58a0cdff31bfec783f708aa416e44bd5fd2" +checksum = "2e5215c48b139422dcf54958d746b5e9a7b31bab8fc126f28e4049c4985505d5" dependencies = [ "bitflags", "indexmap", diff --git a/rust/parse_ast/Cargo.toml b/rust/parse_ast/Cargo.toml index 2dd6781e6..407a5927a 100644 --- a/rust/parse_ast/Cargo.toml +++ b/rust/parse_ast/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dependencies] anyhow = "1.0.100" swc_atoms = "9.0.0" -swc_compiler_base = "41.0.0" +swc_compiler_base = "43.0.0" swc_config = "3.1.2" swc_common = { version = "18.0.1", features = ["parking_lot"] } swc_ecma_ast = "19.0.0" -swc_ecma_parser = "29.0.2" +swc_ecma_parser = "30.0.0" parking_lot = "0.12.5" diff --git a/scripts/test-options.js b/scripts/test-options.js index 088aa24b6..f4fe9e1a5 100644 --- a/scripts/test-options.js +++ b/scripts/test-options.js @@ -1,10 +1,9 @@ import { readFile } from 'node:fs/promises'; import { exit } from 'node:process'; -const [optionsText, helpText, commandReferenceText] = await Promise.all([ +const [optionsText, helpText] = await Promise.all([ readFile(new URL('../docs/configuration-options/index.md', import.meta.url), 'utf8'), - readFile(new URL('../cli/help.md', import.meta.url), 'utf8'), - readFile(new URL('../docs/command-line-interface/index.md', import.meta.url), 'utf8') + readFile(new URL('../cli/help.md', import.meta.url), 'utf8') ]); const optionSections = optionsText.split('\n## '); @@ -72,27 +71,3 @@ for (const line of splitHelpText) { exit(1); } } - -const helpOptionLines = splitHelpText.filter(line => line[0] === '-'); - -const cliFlagsText = commandReferenceText - .split('\n## ') - .find(text => text.startsWith('Command line flags')); -if (!cliFlagsText) { - throw new Error('Could not find "Command line flags" section.'); -} -const cliMarkdownSection = cliFlagsText.match(/```\n([\S\s]*?)\n```/); -if (!cliMarkdownSection) { - throw new Error('Could not find markdown section in "Command line flags" section.'); -} -const optionListLines = cliMarkdownSection[1].split('\n').filter(line => line[0] === '-'); - -for (const [index, line] of helpOptionLines.entries()) { - const optionListLine = optionListLines[index]; - if (line !== optionListLine) { - console.error( - `The command lines in command-line-interface/index.md do not match help.md. Expected line:\n${line}\n\nReceived line:\n${optionListLine}` - ); - exit(1); - } -} diff --git a/test/cli/samples/help/_config.js b/test/cli/samples/help/_config.js new file mode 100644 index 000000000..b6f16a441 --- /dev/null +++ b/test/cli/samples/help/_config.js @@ -0,0 +1,14 @@ +const { readFileSync } = require('node:fs'); +const { join } = require('node:path'); +const assert = require('node:assert'); + +module.exports = defineTest({ + description: 'displays the help text', + spawnArgs: ['--help'], + result(stdout) { + const [firstLine, ...restLines] = stdout.trim().split('\n'); + assert.match(firstLine, /^rollup version \d+\.\d+\.\d+$/); + const expected = readFileSync(join(__dirname, '_expected'), 'utf8'); + assert.equal([...restLines].join('\n'), expected.trim()); + } +}); diff --git a/test/cli/samples/help/_expected b/test/cli/samples/help/_expected new file mode 100644 index 000000000..388ecfadb --- /dev/null +++ b/test/cli/samples/help/_expected @@ -0,0 +1,128 @@ +===================================== + +Usage: rollup [options] + +Options: + +-c, --config Use this config file (if argument is used but value + is unspecified, Rollup will try to load configuration files in + the following order: + rollup.config.mjs -> rollup.config.cjs -> rollup.config.js) +-d, --dir Directory for chunks (if absent, prints to stdout) +-e, --external Comma-separate list of module IDs to exclude +-f, --format Type of output (amd, cjs, es, iife, umd, system) +-g, --globals Comma-separate list of `moduleID:Global` pairs +-h, --help Show this help message +-i, --input Input (alternative to ) +-m, --sourcemap Generate sourcemap (`-m inline` for inline map) +-n, --name Name for UMD export +-o, --file Single output file (if absent, prints to stdout) +-p, --plugin Use the plugin specified (may be repeated) +-v, --version Show version number +-w, --watch Watch files in bundle and rebuild on changes +--amd.autoId Generate the AMD ID based off the chunk name +--amd.basePath Path to prepend to auto generated AMD ID +--amd.define Function to use in place of `define` +--amd.forceJsExtensionForImports Use `.js` extension in AMD imports +--amd.id ID for AMD module (default is anonymous) +--assetFileNames Name pattern for emitted assets +--banner Code to insert at top of bundle (outside wrapper) +--chunkFileNames Name pattern for emitted secondary chunks +--compact Minify wrapper code +--context Specify top-level `this` value +--no-dynamicImportInCjs Write external dynamic CommonJS imports as require +--entryFileNames Name pattern for emitted entry chunks +--environment Settings passed to config file (see example) +--no-esModule Do not add __esModule property +--exports Specify export mode (auto, default, named, none) +--extend Extend global variable defined by --name +--no-externalImportAttributes Omit import attributes in "es" output +--no-externalLiveBindings Do not generate code to support live bindings +--failAfterWarnings Exit with an error if the build produced warnings +--filterLogs Filter log messages +--footer Code to insert at end of bundle (outside wrapper) +--forceExit Force exit the process when done +--no-freeze Do not freeze namespace objects +--generatedCode Which code features to use (es5/es2015) +--generatedCode.arrowFunctions Use arrow functions in generated code +--generatedCode.constBindings Use "const" in generated code +--generatedCode.objectShorthand Use shorthand properties in generated code +--no-generatedCode.reservedNamesAsProps Always quote reserved names as props +--generatedCode.symbols Use symbols in generated code +--hashCharacters Use the specified character set for file hashes +--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks +--importAttributesKey Use the specified keyword for import attributes +--no-indent Don't indent result +--inlineDynamicImports Create single bundle when using dynamic imports +--no-interop Do not include interop block +--intro Code to insert at top of bundle (inside wrapper) +--logLevel Which kind of logs to display +--no-makeAbsoluteExternalsRelative Prevent normalization of external imports +--maxParallelFileOps How many files to read in parallel +--minifyInternalExports Force or disable minification of internal exports +--noConflict Generate a noConflict method for UMD globals +--outro Code to insert at end of bundle (inside wrapper) +--perf Display performance timings +--no-preserveEntrySignatures Avoid facade chunks for entry points +--preserveModules Preserve module structure +--preserveModulesRoot Put preserved modules under this path at root level +--preserveSymlinks Do not follow symlinks when resolving files +--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports +--no-sanitizeFileName Do not replace invalid characters in file names +--shimMissingExports Create shim variables for missing exports +--silent Don't print warnings +--sourcemapBaseUrl Emit absolute sourcemap URLs with given base +--sourcemapDebugIds Emit unique debug ids in source and sourcemaps +--sourcemapExcludeSources Do not include source code in source maps +--sourcemapFile Specify bundle position for source maps +--sourcemapFileNames Name pattern for emitted sourcemaps +--stdin=ext Specify file extension used for stdin input +--no-stdin Do not read "-" from stdin +--no-strict Don't emit `"use strict";` in the generated modules +--strictDeprecations Throw errors for deprecated features +--no-systemNullSetters Do not replace empty SystemJS setters with `null` +--no-treeshake Disable tree-shaking optimisations +--no-treeshake.annotations Ignore pure call annotations +--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared +--treeshake.manualPureFunctions Manually declare functions as pure +--no-treeshake.moduleSideEffects Assume modules have no side effects +--no-treeshake.propertyReadSideEffects Ignore property access side effects +--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking +--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw +--validate Validate output +--waitForBundleInput Wait for bundle input files +--watch.allowInputInsideOutputPath Whether the input path is allowed to be a + subpath of the output path +--watch.buildDelay Throttle watch rebuilds +--no-watch.clearScreen Do not clear the screen when rebuilding +--watch.exclude Exclude files from being watched +--watch.include Limit watching to specified files +--watch.onBundleEnd Shell command to run on `"BUNDLE_END"` event +--watch.onBundleStart Shell command to run on `"BUNDLE_START"` event +--watch.onEnd Shell command to run on `"END"` event +--watch.onError Shell command to run on `"ERROR"` event +--watch.onStart Shell command to run on `"START"` event +--watch.skipWrite Do not write files to disk when watching + +Examples: + +# use settings in config file +rollup -c + +# in config file, process.env.INCLUDE_DEPS === 'true' +# and process.env.BUILD === 'production' +rollup -c --environment INCLUDE_DEPS,BUILD:production + +# create CommonJS bundle.js from src/main.js +rollup --format=cjs --file=bundle.js -- src/main.js + +# create self-executing IIFE using `window.jQuery` +# and `window._` as external globals +rollup -f iife --globals jquery:jQuery,lodash:_ \ + -i src/app.js -o build/app.js -m build/app.js.map + +Notes: + +* When piping to stdout, only inline sourcemaps are permitted + +For more information visit https://rollupjs.org diff --git a/test/watch/index.js b/test/watch/index.js index 988dab98d..168edf7b6 100644 --- a/test/watch/index.js +++ b/test/watch/index.js @@ -565,7 +565,7 @@ describe('rollup.watch', function () { }, 'START', 'BUNDLE_START', - "ERROR:main.js (1:7): Expected '{', got 'nope'", + "ERROR:main.js (1:7): Expected '{', got 'ident'", 'END', () => { atomicWriteFileSync(ENTRY_FILE, 'export default 43;'); @@ -713,7 +713,7 @@ describe('rollup.watch', function () { }, 'START', 'BUNDLE_START', - "ERROR:main.js (1:7): Expected '{', got 'nope'", + "ERROR:main.js (1:7): Expected '{', got 'ident'", 'END', () => { unlinkSync(ENTRY_FILE); @@ -751,7 +751,7 @@ describe('rollup.watch', function () { }, 'START', 'BUNDLE_START', - "ERROR:dep.js (1:7): Expected '{', got 'nope'", + "ERROR:dep.js (1:7): Expected '{', got 'ident'", 'END', () => { unlinkSync(path.join(INPUT_DIR, 'dep.js')); diff --git a/typings/declarations.ts b/typings/declarations.ts index 9831d8522..a69e86633 100644 --- a/typings/declarations.ts +++ b/typings/declarations.ts @@ -5,12 +5,6 @@ declare module 'help.md' { } // external libs -declare module 'rollup-plugin-string' { - import type { PluginImpl } from 'rollup'; - - export const string: PluginImpl; -} - declare module 'acorn-import-assertions' { export const importAssertions: () => unknown; } diff --git a/wasm/bindings_wasm.d.ts b/wasm/bindings_wasm.d.ts index 2ba9aa75b..6e11f7e99 100644 --- a/wasm/bindings_wasm.d.ts +++ b/wasm/bindings_wasm.d.ts @@ -1,10 +1,14 @@ /* tslint:disable */ /* eslint-disable */ + export function parse(code: string, allow_return_outside_function: boolean, jsx: boolean): Uint8Array; -export function xxhashBase64Url(input: Uint8Array): string; -export function xxhashBase36(input: Uint8Array): string; + export function xxhashBase16(input: Uint8Array): string; +export function xxhashBase36(input: Uint8Array): string; + +export function xxhashBase64Url(input: Uint8Array): string; + export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { @@ -20,6 +24,7 @@ export interface InitOutput { } export type SyncInitInput = BufferSource | WebAssembly.Module; + /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`.