From 33e54bac16786112260bbcf04a89f6270574536e Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Fri, 11 Feb 2022 21:54:19 -0500 Subject: [PATCH] add generate help script to build, incl. generated file --- .gitignore | 4 +- cli/help.ts | 102 +++++++++++++++++++ package.json | 278 +++++++++++++++++++++++++-------------------------- 3 files changed, 242 insertions(+), 142 deletions(-) create mode 100644 cli/help.ts diff --git a/.gitignore b/.gitignore index e27b45d0054..839c412224f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,4 @@ test/hooks/tmp test/tmp test/typescript/typings perf/ -.nyc_output/ - -cli/help.ts \ No newline at end of file +.nyc_output/ \ No newline at end of file diff --git a/cli/help.ts b/cli/help.ts new file mode 100644 index 00000000000..283a7a5ed4f --- /dev/null +++ b/cli/help.ts @@ -0,0 +1,102 @@ +import { version } from '../package.json'; + +export default `rollup version ${version} +===================================== + +Usage: rollup [options] + +Basic options: + +-c, --config Use this config file (if argument is used but value + is unspecified, defaults to 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.id ID for AMD module (default is anonymous) +--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\` +--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 +--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-externalLiveBindings Do not generate code to support live bindings +--failAfterWarnings Exit with an error if the build produced warnings +--footer Code to insert at end of bundle (outside wrapper) +--no-freeze Do not freeze namespace objects +--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks +--no-indent Don't indent result +--no-interop Do not include interop block +--inlineDynamicImports Create single bundle when using dynamic imports +--intro Code to insert at top of bundle (inside wrapper) +--minifyInternalExports Force or disable minification of internal exports +--namespaceToStringTag Create proper \`.toString\` methods for namespaces +--noConflict Generate a noConflict method for UMD globals +--outro Code to insert at end of bundle (inside wrapper) +--preferConst Use \`const\` instead of \`var\` for exports +--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-sanitizeFileName Do not replace invalid characters in file names +--shimMissingExports Create shim variables for missing exports +--silent Don't print warnings +--sourcemapExcludeSources Do not include source code in source maps +--sourcemapFile Specify bundle position for source maps +--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 +--systemNullSetters Replace empty SystemJS setters with \`null\` +--no-treeshake Disable tree-shaking optimisations +--no-treeshake.annotations Ignore pure call annotations +--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 +--waitForBundleInput Wait for bundle input files +--watch.buildDelay Throttle watch rebuilds +--no-watch.clearScreen Do not clear the screen when rebuilding +--watch.skipWrite Do not write files to disk when watching +--watch.exclude Exclude files from being watched +--watch.include Limit watching to specified files +--validate Validate output + +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/package.json b/package.json index 3ca15d913ff..da302906f4d 100644 --- a/package.json +++ b/package.json @@ -1,141 +1,141 @@ { - "name": "rollup", - "version": "2.67.2", - "description": "Next-generation ES module bundler", - "main": "dist/rollup.js", - "module": "dist/es/rollup.js", - "typings": "dist/rollup.d.ts", - "bin": { - "rollup": "dist/bin/rollup" - }, - "scripts": { - "build": "shx rm -rf dist && npm run generate:help && git rev-parse HEAD > .commithash && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:cjs": "shx rm -rf dist && npm run generate:help && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", - "ci:lint": "npm run lint:nofix", - "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all", - "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only", - "ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha", - "generate:help": "node ./scripts/generate-help-module", - "lint": "eslint . --fix --cache && prettier --write \"**/*.md\"", - "lint:nofix": "eslint . && prettier --check \"**/*.md\"", - "lint:markdown": "prettier --write \"**/*.md\"", - "perf": "npm run build:cjs && node --expose-gc scripts/perf.js", - "perf:debug": "node --inspect-brk scripts/perf-debug.js", - "perf:init": "node scripts/perf-init.js", - "postinstall": "husky install", - "postpublish": "pinst --enable && git push && git push --tags", - "prepare": "husky install && npm run build", - "prepublishOnly": "pinst --disable && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all", - "security": "npm audit", - "test": "npm run build && npm run test:all", - "test:cjs": "npm run build:cjs && npm run test:only", - "test:quick": "mocha -b test/test.js", - "test:all": "npm run test:only && npm run test:browser && npm run test:typescript && npm run test:leak && npm run test:package", - "test:coverage": "npm run build:cjs && shx rm -rf coverage/* && nyc --reporter html mocha test/test.js", - "test:coverage:browser": "npm run build && shx rm -rf coverage/* && nyc mocha test/browser/index.js", - "test:leak": "node --expose-gc test/leak/index.js", - "test:package": "node scripts/test-package.js", - "test:only": "mocha test/test.js", - "test:typescript": "shx rm -rf test/typescript/dist && shx cp -r dist test/typescript/ && tsc --noEmit -p test/typescript && tsc --noEmit", - "test:browser": "mocha test/browser/index.js", - "watch": "rollup --config rollup.config.ts --configPlugin typescript --watch" - }, - "repository": "rollup/rollup", - "keywords": [ - "modules", - "bundler", - "bundling", - "es6", - "optimizer" - ], - "author": "Rich Harris", - "license": "MIT", - "bugs": { - "url": "https://github.com/rollup/rollup/issues" - }, - "homepage": "https://rollupjs.org/", - "optionalDependencies": { - "fsevents": "~2.3.2" - }, - "devDependencies": { - "@rollup/plugin-buble": "^0.21.3", - "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.1.3", - "@rollup/plugin-replace": "^3.0.1", - "@rollup/plugin-typescript": "^8.3.0", - "@rollup/pluginutils": "^4.1.2", - "@types/estree": "0.0.51", - "@types/node": "^10.17.60", - "@types/signal-exit": "^3.0.1", - "@types/yargs-parser": "^20.2.1", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", - "acorn": "^8.7.0", - "acorn-jsx": "^5.3.2", - "acorn-walk": "^8.2.0", - "buble": "^0.20.0", - "chokidar": "^3.5.3", - "colorette": "^2.0.16", - "core-js": "^3.21.0", - "date-time": "^4.0.0", - "es5-shim": "^4.6.4", - "es6-shim": "^0.35.6", - "eslint": "^8.8.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.4", - "eslint-plugin-prettier": "^4.0.0", - "execa": "^5.1.1", - "fixturify": "^2.1.1", - "fs-extra": "^10.0.0", - "hash.js": "^1.1.7", - "husky": "^7.0.4", - "is-reference": "^3.0.0", - "lint-staged": "^10.5.4", - "locate-character": "^2.0.5", - "magic-string": "^0.25.7", - "mocha": "^9.2.0", - "nyc": "^15.1.0", - "pinst": "^2.1.6", - "prettier": "^2.5.1", - "pretty-bytes": "^5.6.0", - "pretty-ms": "^7.0.1", - "requirejs": "^2.3.6", - "rollup": "^2.67.1", - "rollup-plugin-license": "^2.6.1", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-thatworks": "^1.0.4", - "shx": "^0.3.4", - "signal-exit": "^3.0.7", - "source-map": "^0.7.3", - "source-map-support": "^0.5.21", - "sourcemap-codec": "^1.4.8", - "systemjs": "^6.12.1", - "terser": "^5.10.0", - "tslib": "^2.3.1", - "typescript": "^4.5.5", - "weak-napi": "^2.0.2", - "yargs-parser": "^20.2.9" - }, - "files": [ - "dist/**/*.js", - "dist/*.d.ts", - "dist/bin/rollup", - "dist/es/package.json", - "dist/rollup.browser.js.map" - ], - "engines": { - "node": ">=10.0.0" - }, - "exports": { - ".": { - "node": { - "require": "./dist/rollup.js", - "import": "./dist/es/rollup.js" - }, - "default": "./dist/es/rollup.browser.js" - }, - "./dist/": "./dist/" - } + "name": "rollup", + "version": "2.67.2", + "description": "Next-generation ES module bundler", + "main": "dist/rollup.js", + "module": "dist/es/rollup.js", + "typings": "dist/rollup.d.ts", + "bin": { + "rollup": "dist/bin/rollup" + }, + "scripts": { + "build": "shx rm -rf dist && git rev-parse HEAD > .commithash && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "ci:lint": "npm run lint:nofix", + "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all", + "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only", + "ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha", + "generate:help": "node ./scripts/generate-help-module", + "lint": "eslint . --fix --cache && prettier --write \"**/*.md\"", + "lint:nofix": "eslint . && prettier --check \"**/*.md\"", + "lint:markdown": "prettier --write \"**/*.md\"", + "perf": "npm run build:cjs && node --expose-gc scripts/perf.js", + "perf:debug": "node --inspect-brk scripts/perf-debug.js", + "perf:init": "node scripts/perf-init.js", + "postinstall": "husky install", + "postpublish": "pinst --enable && git push && git push --tags", + "prepare": "husky install && npm run build", + "prepublishOnly": "pinst --disable && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all", + "security": "npm audit", + "test": "npm run build && npm run test:all", + "test:cjs": "npm run build:cjs && npm run test:only", + "test:quick": "mocha -b test/test.js", + "test:all": "npm run test:only && npm run test:browser && npm run test:typescript && npm run test:leak && npm run test:package", + "test:coverage": "npm run build:cjs && shx rm -rf coverage/* && nyc --reporter html mocha test/test.js", + "test:coverage:browser": "npm run build && shx rm -rf coverage/* && nyc mocha test/browser/index.js", + "test:leak": "node --expose-gc test/leak/index.js", + "test:package": "node scripts/test-package.js", + "test:only": "mocha test/test.js", + "test:typescript": "shx rm -rf test/typescript/dist && shx cp -r dist test/typescript/ && tsc --noEmit -p test/typescript && tsc --noEmit", + "test:browser": "mocha test/browser/index.js", + "watch": "rollup --config rollup.config.ts --configPlugin typescript --watch" + }, + "repository": "rollup/rollup", + "keywords": [ + "modules", + "bundler", + "bundling", + "es6", + "optimizer" + ], + "author": "Rich Harris", + "license": "MIT", + "bugs": { + "url": "https://github.com/rollup/rollup/issues" + }, + "homepage": "https://rollupjs.org/", + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "devDependencies": { + "@rollup/plugin-buble": "^0.21.3", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-replace": "^3.0.1", + "@rollup/plugin-typescript": "^8.3.0", + "@rollup/pluginutils": "^4.1.2", + "@types/estree": "0.0.51", + "@types/node": "^10.17.60", + "@types/signal-exit": "^3.0.1", + "@types/yargs-parser": "^20.2.1", + "@typescript-eslint/eslint-plugin": "^5.11.0", + "@typescript-eslint/parser": "^5.11.0", + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.2", + "acorn-walk": "^8.2.0", + "buble": "^0.20.0", + "chokidar": "^3.5.3", + "colorette": "^2.0.16", + "core-js": "^3.21.0", + "date-time": "^4.0.0", + "es5-shim": "^4.6.4", + "es6-shim": "^0.35.6", + "eslint": "^8.8.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-prettier": "^4.0.0", + "execa": "^5.1.1", + "fixturify": "^2.1.1", + "fs-extra": "^10.0.0", + "hash.js": "^1.1.7", + "husky": "^7.0.4", + "is-reference": "^3.0.0", + "lint-staged": "^10.5.4", + "locate-character": "^2.0.5", + "magic-string": "^0.25.7", + "mocha": "^9.2.0", + "nyc": "^15.1.0", + "pinst": "^2.1.6", + "prettier": "^2.5.1", + "pretty-bytes": "^5.6.0", + "pretty-ms": "^7.0.1", + "requirejs": "^2.3.6", + "rollup": "^2.67.1", + "rollup-plugin-license": "^2.6.1", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-thatworks": "^1.0.4", + "shx": "^0.3.4", + "signal-exit": "^3.0.7", + "source-map": "^0.7.3", + "source-map-support": "^0.5.21", + "sourcemap-codec": "^1.4.8", + "systemjs": "^6.12.1", + "terser": "^5.10.0", + "tslib": "^2.3.1", + "typescript": "^4.5.5", + "weak-napi": "^2.0.2", + "yargs-parser": "^20.2.9" + }, + "files": [ + "dist/**/*.js", + "dist/*.d.ts", + "dist/bin/rollup", + "dist/es/package.json", + "dist/rollup.browser.js.map" + ], + "engines": { + "node": ">=10.0.0" + }, + "exports": { + ".": { + "node": { + "require": "./dist/rollup.js", + "import": "./dist/es/rollup.js" + }, + "default": "./dist/es/rollup.browser.js" + }, + "./dist/": "./dist/" + } }