MCPcopy
hub / github.com/rollup/rollup / normalizeInputOptions

Function normalizeInputOptions

src/utils/options/normalizeInputOptions.ts:32–80  ·  view source on GitHub ↗
(
	config: InputOptions,
	watchMode: boolean
)

Source from the content-addressed store, hash-verified

30}
31
32export 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
82const getCache = (config: InputOptions): NormalizedInputOptions['cache'] =>
83 config.cache === true // `true` is the default

Callers 1

getInputOptionsFunction · 0.90

Calls 11

normalizePluginOptionFunction · 0.90
getLoggerFunction · 0.90
getOnLogFunction · 0.90
warnUnknownOptionsFunction · 0.90
getMaxParallelFileOpsFunction · 0.85
getCacheFunction · 0.85
getIdMatcherFunction · 0.85
getInputFunction · 0.85
getJsxFunction · 0.85
getModuleContextFunction · 0.85
getTreeshakeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…