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 18, 2023
1 parent c44bc08 commit 79ff8f0
Show file tree
Hide file tree
Showing 620 changed files with 12 additions and 5,125 deletions.
20 changes: 0 additions & 20 deletions docs/configuration-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2556,22 +2556,6 @@ Whether to skip the `bundle.write()` step when a rebuild is triggered.
☢️ 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.
### output.externalImportAssertions
_Use the [`output.externalImportAttributes`](#output-externalimportattributes) option instead._
Expand All @@ -2583,7 +2567,3 @@ _Use the [`output.externalImportAttributes`](#output-externalimportattributes) o
| Default: | `true` |
Whether to add import assertions to external imports in the output if the output format is `es`. By default, assertions are taken from the input files, but plugins can add or remove assertions later. E.g. `import "foo" assert {type: "json"}` will cause the same import to appear in the output unless the option is set to `false`. Note that all imports of a module need to have consistent assertions, otherwise a warning is emitted.
### 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 @@ -568,19 +568,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 @@ -601,19 +595,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 @@ -135,16 +135,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
@@ -1,7 +1,6 @@
import type {
HasModuleSideEffects,
InputOptions,
LogHandler,
ModuleSideEffectsOption,
NormalizedInputOptions,
RollupBuild
Expand All @@ -10,15 +9,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 @@ -49,7 +42,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 = {
cache: getCache(config),
context,
Expand All @@ -59,16 +52,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 @@ -125,40 +115,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 @@ -186,24 +146,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
11 changes: 5 additions & 6 deletions src/utils/options/normalizeOutputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
OutputOptions,
SourcemapPathTransformOption
} from '../../rollup/types';
import { error, logInvalidExportOptionValue, logInvalidOption } from '../logs';
import { error, logInvalidExportOptionValue, logInvalidOption, warnDeprecation } from '../logs';
import { resolve } from '../path';
import { sanitizeFileName as defaultSanitizeFileName } from '../sanitizeFileName';
import { addTrailingSlashIfMissed, isValidUrl } from '../url';
Expand Down Expand Up @@ -74,7 +74,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 @@ -198,7 +198,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 @@ -417,10 +417,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.

0 comments on commit 79ff8f0

Please sign in to comment.