Skip to content

Commit

Permalink
Reference types when normalizing options
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jun 16, 2021
1 parent 3bcbee1 commit e4b840d
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/utils/options/normalizeInputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export interface CommandConfigObject {
globals: { [id: string]: string } | undefined;
}

export function normalizeInputOptions(config: InputOptions): {
options: NormalizedInputOptions;
unsetOptions: Set<string>;
} {
export function normalizeInputOptions(
config: InputOptions
): { options: NormalizedInputOptions; unsetOptions: Set<string> } {
// These are options that may trigger special warnings or behaviour later
// if the user did not select an explicit value
const unsetOptions = new Set<string>();
Expand Down Expand Up @@ -103,7 +102,7 @@ const getAcornInjectPlugins = (
): NormalizedInputOptions['acornInjectPlugins'] => ensureArray(config.acornInjectPlugins);

const getCache = (config: InputOptions): NormalizedInputOptions['cache'] =>
(config.cache as unknown as RollupBuild)?.cache || config.cache;
((config.cache as unknown) as RollupBuild)?.cache || config.cache;

const getIdMatcher = <T extends Array<any>>(
option:
Expand Down Expand Up @@ -234,16 +233,7 @@ const getTreeshake = (
if (configTreeshake === false) {
return false;
}
if (!configTreeshake || configTreeshake === true) {
return {
annotations: true,
moduleSideEffects: () => true,
propertyReadSideEffects: true,
tryCatchDeoptimization: true,
unknownGlobalSideEffects: true
};
}
if (typeof configTreeshake === 'object') {
if (configTreeshake && typeof configTreeshake === 'object') {
if (typeof configTreeshake.pureExternalModules !== 'undefined') {
warnDeprecationWithOptions(
`The "treeshake.pureExternalModules" option is deprecated. The "treeshake.moduleSideEffects" option should be used instead. "treeshake.pureExternalModules: true" is equivalent to "treeshake.moduleSideEffects: 'no-external'"`,
Expand Down

0 comments on commit e4b840d

Please sign in to comment.