( config: InputOptions, watchMode: boolean )
| 30 | } |
| 31 | |
| 32 | export async function normalizeInputOptions( |
| 33 | config: InputOptions, |
| 34 | watchMode: boolean |
| 35 | ): Promise<{ |
| 36 | options: NormalizedInputOptions; |
| 37 | unsetOptions: Set<string>; |
| 38 | }> { |
| 39 | // These are options that may trigger special warnings or behaviour later |
| 40 | // if the user did not select an explicit value |
| 41 | const unsetOptions = new Set<string>(); |
| 42 | |
| 43 | const context = config.context ?? 'undefined'; |
| 44 | const plugins = await normalizePluginOption(config.plugins); |
| 45 | const logLevel = config.logLevel || LOGLEVEL_INFO; |
| 46 | const onLog = getLogger(plugins, getOnLog(config, logLevel), watchMode, logLevel); |
| 47 | const strictDeprecations = config.strictDeprecations || false; |
| 48 | const maxParallelFileOps = getMaxParallelFileOps(config); |
| 49 | const options: NormalizedInputOptions & InputOptions = { |
| 50 | cache: getCache(config), |
| 51 | context, |
| 52 | experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10, |
| 53 | experimentalLogSideEffects: config.experimentalLogSideEffects || false, |
| 54 | external: getIdMatcher(config.external), |
| 55 | fs: config.fs ?? (fs as RollupFsModule), |
| 56 | input: getInput(config), |
| 57 | jsx: getJsx(config), |
| 58 | logLevel, |
| 59 | makeAbsoluteExternalsRelative: config.makeAbsoluteExternalsRelative ?? 'ifRelativeSource', |
| 60 | maxParallelFileOps, |
| 61 | moduleContext: getModuleContext(config, context), |
| 62 | onLog, |
| 63 | perf: config.perf || false, |
| 64 | plugins, |
| 65 | preserveEntrySignatures: config.preserveEntrySignatures ?? 'exports-only', |
| 66 | preserveSymlinks: config.preserveSymlinks || false, |
| 67 | shimMissingExports: config.shimMissingExports || false, |
| 68 | strictDeprecations, |
| 69 | treeshake: getTreeshake(config) |
| 70 | }; |
| 71 | |
| 72 | warnUnknownOptions( |
| 73 | config, |
| 74 | [...Object.keys(options), 'onwarn', 'watch'], |
| 75 | 'input options', |
| 76 | onLog, |
| 77 | /^(output)$/ |
| 78 | ); |
| 79 | return { options, unsetOptions }; |
| 80 | } |
| 81 | |
| 82 | const getCache = (config: InputOptions): NormalizedInputOptions['cache'] => |
| 83 | config.cache === true // `true` is the default |
no test coverage detected
searching dependent graphs…