Skip to content

Commit

Permalink
Remove manualChunks and preserveModules input options as well as maxP…
Browse files Browse the repository at this point in the history
…arallelFileReads
  • Loading branch information
lukastaegert committed Sep 17, 2023
1 parent e94a627 commit 70975b9
Show file tree
Hide file tree
Showing 620 changed files with 11 additions and 5,128 deletions.
24 changes: 0 additions & 24 deletions docs/configuration-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2578,27 +2578,3 @@ export default {
| Default: | `false` |
Whether to skip the `bundle.write()` step when a rebuild is triggered.
## Deprecated options
☢️ These options have been deprecated and may be removed in a future Rollup version.
### manualChunks
_Use the [`output.manualChunks`](#output-manualchunks) output option instead, which has the same signature._
### maxParallelFileReads
_Use the [`maxParallelFileOps`](#maxparallelfileops) option instead._
| | |
| -------: | :-------------------------------- |
| Type: | `number` |
| CLI: | `--maxParallelFileReads <number>` |
| Default: | 20 |
Limits the number of files rollup will open in parallel when reading modules. Without a limit or with a high enough value, builds can fail with an "EMFILE: too many open files". This depends on how many open file handles the os allows.
### preserveModules
_Use the [`output.preserveModules`](#output-preservemodules) output option instead, which has the same signature._
2 changes: 1 addition & 1 deletion docs/guide/en/slugs-and-pages-by-legacy-slugs.json

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions src/rollup/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,13 @@ export interface InputOptions {
input?: InputOption;
logLevel?: LogLevelOption;
makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks?: ManualChunksOption;
maxParallelFileOps?: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads?: number;
moduleContext?: ((id: string) => string | NullValue) | { [id: string]: string };
onLog?: LogHandlerWithDefault;
onwarn?: WarningHandlerWithDefault;
perf?: boolean;
plugins?: InputPluginOption;
preserveEntrySignatures?: PreserveEntrySignaturesOption;
/** @deprecated Use the "preserveModules" output option instead. */
preserveModules?: boolean;
preserveSymlinks?: boolean;
shimMissingExports?: boolean;
strictDeprecations?: boolean;
Expand All @@ -605,19 +599,13 @@ export interface NormalizedInputOptions {
input: string[] | { [entryAlias: string]: string };
logLevel: LogLevelOption;
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
/** @deprecated Use the "manualChunks" output option instead. */
manualChunks: ManualChunksOption | undefined;
maxParallelFileOps: number;
/** @deprecated Use the "maxParallelFileOps" option instead. */
maxParallelFileReads: number;
moduleContext: (id: string) => string;
onLog: LogHandler;
onwarn: (warning: RollupLog) => void;
perf: boolean;
plugins: Plugin[];
preserveEntrySignatures: PreserveEntrySignaturesOption;
/** @deprecated Use the "preserveModules" output option instead. */
preserveModules: boolean | undefined;
preserveSymlinks: boolean;
shimMissingExports: boolean;
strictDeprecations: boolean;
Expand Down
3 changes: 0 additions & 3 deletions src/utils/options/mergeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,13 @@ function mergeInputOptions(
input: getOption('input') || [],
logLevel: getOption('logLevel'),
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
manualChunks: getOption('manualChunks'),
maxParallelFileOps: getOption('maxParallelFileOps'),
maxParallelFileReads: getOption('maxParallelFileReads'),
moduleContext: getOption('moduleContext'),
onLog,
onwarn: undefined,
perf: getOption('perf'),
plugins,
preserveEntrySignatures: getOption('preserveEntrySignatures'),
preserveModules: getOption('preserveModules'),
preserveSymlinks: getOption('preserveSymlinks'),
shimMissingExports: getOption('shimMissingExports'),
strictDeprecations: getOption('strictDeprecations'),
Expand Down
68 changes: 5 additions & 63 deletions src/utils/options/normalizeInputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { importAssertions } from 'acorn-import-assertions';
import type {
HasModuleSideEffects,
InputOptions,
LogHandler,
ModuleSideEffectsOption,
NormalizedInputOptions,
RollupBuild
Expand All @@ -12,15 +11,9 @@ import { EMPTY_ARRAY } from '../blank';
import { ensureArray } from '../ensureArray';
import { getLogger } from '../logger';
import { LOGLEVEL_INFO, LOGLEVEL_WARN } from '../logging';
import { error, logInvalidOption, warnDeprecationWithOptions } from '../logs';
import { error, logInvalidOption } from '../logs';
import { resolve } from '../path';
import {
URL_MAXPARALLELFILEOPS,
URL_OUTPUT_MANUALCHUNKS,
URL_OUTPUT_PRESERVEMODULES,
URL_TREESHAKE,
URL_TREESHAKE_MODULESIDEEFFECTS
} from '../urls';
import { URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS } from '../urls';
import {
getOnLog,
getOptionWithPreset,
Expand Down Expand Up @@ -51,7 +44,7 @@ export async function normalizeInputOptions(
const logLevel = config.logLevel || LOGLEVEL_INFO;
const onLog = getLogger(plugins, getOnLog(config, logLevel), watchMode, logLevel);
const strictDeprecations = config.strictDeprecations || false;
const maxParallelFileOps = getMaxParallelFileOps(config, onLog, strictDeprecations);
const maxParallelFileOps = getMaxParallelFileOps(config);
const options: NormalizedInputOptions & InputOptions = {
acorn: getAcorn(config) as unknown as NormalizedInputOptions['acorn'],
acornInjectPlugins: getAcornInjectPlugins(config),
Expand All @@ -63,16 +56,13 @@ export async function normalizeInputOptions(
input: getInput(config),
logLevel,
makeAbsoluteExternalsRelative: config.makeAbsoluteExternalsRelative ?? 'ifRelativeSource',
manualChunks: getManualChunks(config, onLog, strictDeprecations),
maxParallelFileOps,
maxParallelFileReads: maxParallelFileOps,
moduleContext: getModuleContext(config, context),
onLog,
onwarn: warning => onLog(LOGLEVEL_WARN, warning),
perf: config.perf || false,
plugins,
preserveEntrySignatures: config.preserveEntrySignatures ?? 'exports-only',
preserveModules: getPreserveModules(config, onLog, strictDeprecations),
preserveSymlinks: config.preserveSymlinks || false,
shimMissingExports: config.shimMissingExports || false,
strictDeprecations,
Expand Down Expand Up @@ -142,40 +132,10 @@ const getInput = (config: InputOptions): NormalizedInputOptions['input'] => {
return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
};

const getManualChunks = (
config: InputOptions,
log: LogHandler,
strictDeprecations: boolean
): NormalizedInputOptions['manualChunks'] => {
const configManualChunks = config.manualChunks;
if (configManualChunks) {
warnDeprecationWithOptions(
'The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.',
URL_OUTPUT_MANUALCHUNKS,
true,
log,
strictDeprecations
);
}
return configManualChunks;
};

const getMaxParallelFileOps = (
config: InputOptions,
log: LogHandler,
strictDeprecations: boolean
config: InputOptions
): NormalizedInputOptions['maxParallelFileOps'] => {
const maxParallelFileReads = config.maxParallelFileReads;
if (typeof maxParallelFileReads === 'number') {
warnDeprecationWithOptions(
'The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.',
URL_MAXPARALLELFILEOPS,
true,
log,
strictDeprecations
);
}
const maxParallelFileOps = config.maxParallelFileOps ?? maxParallelFileReads;
const maxParallelFileOps = config.maxParallelFileOps;
if (typeof maxParallelFileOps === 'number') {
if (maxParallelFileOps <= 0) return Infinity;
return maxParallelFileOps;
Expand Down Expand Up @@ -203,24 +163,6 @@ const getModuleContext = (
return () => context;
};

const getPreserveModules = (
config: InputOptions,
log: LogHandler,
strictDeprecations: boolean
): NormalizedInputOptions['preserveModules'] => {
const configPreserveModules = config.preserveModules;
if (configPreserveModules) {
warnDeprecationWithOptions(
'The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.',
URL_OUTPUT_PRESERVEMODULES,
true,
log,
strictDeprecations
);
}
return configPreserveModules;
};

const getTreeshake = (config: InputOptions): NormalizedInputOptions['treeshake'] => {
const configTreeshake = config.treeshake;
if (configTreeshake === false) {
Expand Down
9 changes: 4 additions & 5 deletions src/utils/options/normalizeOutputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function normalizeOutputOptions(
inlineDynamicImports,
interop: getInterop(config),
intro: getAddon(config, 'intro'),
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules),
minifyInternalExports: getMinifyInternalExports(config, format, compact),
name: config.name,
noConflict: config.noConflict || false,
Expand Down Expand Up @@ -195,7 +195,7 @@ const getPreserveModules = (
inlineDynamicImports: boolean,
inputOptions: NormalizedInputOptions
): NormalizedOutputOptions['preserveModules'] => {
const preserveModules = (config.preserveModules ?? inputOptions.preserveModules) || false;
const preserveModules = config.preserveModules || false;
if (preserveModules) {
if (inlineDynamicImports) {
return error(
Expand Down Expand Up @@ -399,10 +399,9 @@ const validateInterop = (interop: InteropType): InteropType => {
const getManualChunks = (
config: OutputOptions,
inlineDynamicImports: boolean,
preserveModules: boolean,
inputOptions: NormalizedInputOptions
preserveModules: boolean
): NormalizedOutputOptions['manualChunks'] => {
const configManualChunks = config.manualChunks || inputOptions.manualChunks;
const configManualChunks = config.manualChunks;
if (configManualChunks) {
if (inlineDynamicImports) {
return error(
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 70975b9

Please sign in to comment.