diff --git a/.cspell.json b/.cspell.json index 156c2be7a33..5dd6e3f4b3d 100644 --- a/.cspell.json +++ b/.cspell.json @@ -4,6 +4,8 @@ "words": [ "Atsumu", "autoprefixer", + "treemap", + "Dont", "barbaz", "Cantarell", "Chizuru", diff --git a/packages/webpack-cli/bin/bundle-analyzer-flags.js b/packages/webpack-cli/bin/bundle-analyzer-flags.js new file mode 100644 index 00000000000..120d30db127 --- /dev/null +++ b/packages/webpack-cli/bin/bundle-analyzer-flags.js @@ -0,0 +1,159 @@ +"use strict"; + +module.exports = { + version: { + configs: [ + { + type: "boolean", + multiple: false, + description: "Output the version number", + path: "version", + }, + ], + description: "Output the version number", + simpleType: "boolean", + multiple: false, + }, + mode: { + configs: [ + { + type: "enum", + values: ["server", "static", "json"], + multiple: false, + description: "The mode to run the analyzer in: server, static, or json.", + path: "mode", + defaultValue: "server", + }, + ], + description: "The mode to run the analyzer in: server, static, or json.", + simpleType: "string", + multiple: false, + }, + report: { + configs: [ + { + type: "string", + multiple: false, + description: 'Path to bundle report file that will be generated in "static" mode.', + path: "report", + defaultValue: "report.html", + }, + ], + description: 'Path to bundle report file that will be generated in "static" mode.', + simpleType: "string", + multiple: false, + }, + title: { + configs: [ + { + type: "string", + multiple: false, + description: "String to use in title element of html report.", + path: "title", + defaultValue: "Webpack Bundle Report", + }, + ], + description: "String to use in title element of html report.", + simpleType: "string", + multiple: false, + }, + size: { + configs: [ + { + type: "enum", + values: ["stat", "parsed", "gzip"], + multiple: false, + description: "Module sizes to show in treemap by default.", + path: "defaultSizes", + defaultValue: "parsed", + }, + ], + description: "Module sizes to show in treemap by default.", + simpleType: "string", + multiple: false, + }, + "Dont Open": { + configs: [ + { + type: "boolean", + multiple: false, + description: "Don't open report in default browser automatically", + path: "noOpen", + defaultValue: false, + }, + ], + description: "Don't open report in default browser automatically", + simpleType: "boolean", + multiple: false, + }, + port: { + configs: [ + { + type: "number", + multiple: false, + description: "Port that will be used in `server` mode, default is 8888.", + path: "port", + defaultValue: 8888, + }, + ], + description: "Port that will be used in `server` mode, default is 8888.", + simpleType: "number", + multiple: false, + }, + host: { + configs: [ + { + type: "string", + multiple: false, + description: "Host that will be used in `server` mode, default is 127.0.0.1.", + path: "host", + defaultValue: "127.0.0.1", + }, + ], + description: "Host that will be used in `server` mode, default is 127.0.0.1.", + simpleType: "string", + multiple: false, + }, + "log-level": { + configs: [ + { + type: "enum", + values: ["debug", "info", "warn", "error", "silent"], + multiple: true, + description: "Level of logger (info, warn, error, silent).", + path: "logLevel", + defaultValue: "info", + }, + ], + description: "Level of logger (info, warn, error, silent).", + simpleType: "string", + multiple: true, + }, + exclude: { + configs: [ + { + type: "string", + multiple: false, + description: "Assets that should be excluded from the report.", + path: "exclude", + defaultValue: "", + }, + ], + description: "Assets that should be excluded from the report.", + simpleType: "string", + multiple: false, + }, + help: { + configs: [ + { + type: "boolean", + multiple: false, + description: "output usage information", + path: "help", + }, + ], + description: "Output usage information", + simpleType: "boolean", + multiple: false, + }, +}; diff --git a/packages/webpack-cli/bin/cli.js b/packages/webpack-cli/bin/cli.js old mode 100755 new mode 100644 diff --git a/packages/webpack-cli/src/types.ts b/packages/webpack-cli/src/types.ts index edbc901b7f3..9546f10b099 100644 --- a/packages/webpack-cli/src/types.ts +++ b/packages/webpack-cli/src/types.ts @@ -171,7 +171,6 @@ type WebpackDevServerOptions = DevServerConfig & nodeEnv?: "string"; watchOptionsStdin?: boolean; progress?: boolean | "profile" | undefined; - analyze?: boolean; prefetch?: string; json?: boolean; entry: EntryOptions; diff --git a/packages/webpack-cli/src/webpack-cli.ts b/packages/webpack-cli/src/webpack-cli.ts index 73b194338b8..575dfdd63f8 100644 --- a/packages/webpack-cli/src/webpack-cli.ts +++ b/packages/webpack-cli/src/webpack-cli.ts @@ -986,7 +986,6 @@ class WebpackCLI implements IWebpackCLI { helpLevel: "verbose", }, - // Adding more plugins { name: "analyze", configs: [