-
Notifications
You must be signed in to change notification settings - Fork 737
Description
Why
The main problem is that the concept NormalizedInputOptions is try to give a final form of options while it still in Js side not passing to the rust.
Take external option as an example, NormalizedInputOptions require external option to be a function, which means though users passed static ['external'] data and it would still needs be wrapped in a js function, that's bad for performance. If external option is setted, every resolve process would need to call Js function in sequence.
How
I looked into the ``NormalizedInputOptions` and delete we highly not going to support. We got
export interface NormalizedInputOptions {
// acorn: Record<string, unknown>
// acornInjectPlugins: (() => unknown)[]
// cache: false | undefined | RollupCache
context: string
experimentalCacheExpiry: number
experimentalLogSideEffects: boolean
external: IsExternal
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports: boolean | undefined
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
treeshake: false | NormalizedTreeshakingOptions
}The problem here is that for properties whose value is function is complicated/impossible to pass them from rust to js, so we only have
export interface NormalizedInputOptions {
context: string
experimentalCacheExpiry: number
experimentalLogSideEffects: boolean
/** @deprecated Use the "inlineDynamicImports" output option instead. */
inlineDynamicImports: boolean | undefined
input: string[] | { [entryAlias: string]: string }
logLevel: LogLevelOption
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource'
perf: boolean
preserveEntrySignatures: PreserveEntrySignaturesOption
/** @deprecated Use the "preserveModules" output option instead. */
preserveModules: boolean | undefined
preserveSymlinks: boolean
shimMissingExports: boolean
strictDeprecations: boolean
treeshake: false | NormalizedTreeshakingOptions
}I kind of feel this is enough for compatibility support. I hardly think of the situation the users want to "have" the function in the NormalizedInputOptions and do something with it. Unless they want to do something hacky, but that's not our scope.
The above analysis also applies on NormalizedOutputOptions. As long as we don't consider properties whose value is function, it's all fine.
As a bonus:
- Parallel js plugins could also visit options even in worker Enviromint.
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority