source: frontend/node_modules/rollup/dist/shared/mergeOptions.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 8.1 KB
Line 
1/*
2 @license
3 Rollup.js v2.80.0
4 Sun, 22 Feb 2026 06:16:40 GMT - commit d17ae15336a45c3c59b2a4aacac2b14186035d28
5
6 https://github.com/rollup/rollup
7
8 Released under the MIT License.
9*/
10'use strict';
11
12const rollup = require('./rollup.js');
13
14const commandAliases = {
15 c: 'config',
16 d: 'dir',
17 e: 'external',
18 f: 'format',
19 g: 'globals',
20 h: 'help',
21 i: 'input',
22 m: 'sourcemap',
23 n: 'name',
24 o: 'file',
25 p: 'plugin',
26 v: 'version',
27 w: 'watch'
28};
29function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler = rollup.defaultOnWarn) {
30 const command = getCommandOptions(rawCommandOptions);
31 const inputOptions = mergeInputOptions(config, command, defaultOnWarnHandler);
32 const warn = inputOptions.onwarn;
33 if (command.output) {
34 Object.assign(command, command.output);
35 }
36 const outputOptionsArray = rollup.ensureArray(config.output);
37 if (outputOptionsArray.length === 0)
38 outputOptionsArray.push({});
39 const outputOptions = outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn));
40 rollup.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'failAfterWarnings', 'stdin', 'waitForBundleInput', 'configPlugin'), 'CLI flags', warn, /^_$|output$|config/);
41 inputOptions.output = outputOptions;
42 return inputOptions;
43}
44function getCommandOptions(rawCommandOptions) {
45 const external = rawCommandOptions.external && typeof rawCommandOptions.external === 'string'
46 ? rawCommandOptions.external.split(',')
47 : [];
48 return {
49 ...rawCommandOptions,
50 external,
51 globals: typeof rawCommandOptions.globals === 'string'
52 ? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
53 const [id, variableName] = globalDefinition.split(':');
54 globals[id] = variableName;
55 if (!external.includes(id)) {
56 external.push(id);
57 }
58 return globals;
59 }, Object.create(null))
60 : undefined
61 };
62}
63function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
64 const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
65 const inputOptions = {
66 acorn: getOption('acorn'),
67 acornInjectPlugins: config.acornInjectPlugins,
68 cache: config.cache,
69 context: getOption('context'),
70 experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
71 external: getExternal(config, overrides),
72 inlineDynamicImports: getOption('inlineDynamicImports'),
73 input: getOption('input') || [],
74 makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
75 manualChunks: getOption('manualChunks'),
76 maxParallelFileOps: getOption('maxParallelFileOps'),
77 maxParallelFileReads: getOption('maxParallelFileReads'),
78 moduleContext: getOption('moduleContext'),
79 onwarn: getOnWarn(config, defaultOnWarnHandler),
80 perf: getOption('perf'),
81 plugins: rollup.ensureArray(config.plugins),
82 preserveEntrySignatures: getOption('preserveEntrySignatures'),
83 preserveModules: getOption('preserveModules'),
84 preserveSymlinks: getOption('preserveSymlinks'),
85 shimMissingExports: getOption('shimMissingExports'),
86 strictDeprecations: getOption('strictDeprecations'),
87 treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
88 watch: getWatch(config, overrides)
89 };
90 rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
91 return inputOptions;
92}
93const getExternal = (config, overrides) => {
94 const configExternal = config.external;
95 return typeof configExternal === 'function'
96 ? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
97 : rollup.ensureArray(configExternal).concat(overrides.external);
98};
99const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
100 ? warning => config.onwarn(warning, defaultOnWarnHandler)
101 : defaultOnWarnHandler;
102const getObjectOption = (config, overrides, name, objectifyValue = rollup.objectifyOption) => {
103 const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
104 const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
105 if (commandOption !== undefined) {
106 return commandOption && { ...configOption, ...commandOption };
107 }
108 return configOption;
109};
110const getWatch = (config, overrides) => config.watch !== false && getObjectOption(config, overrides, 'watch');
111const isWatchEnabled = (optionValue) => {
112 if (Array.isArray(optionValue)) {
113 return optionValue.reduce((result, value) => (typeof value === 'boolean' ? value : result), false);
114 }
115 return optionValue === true;
116};
117const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
118 if (!optionValue) {
119 return optionValue;
120 }
121 if (Array.isArray(optionValue)) {
122 return optionValue.reduce((result, value) => value && result && { ...result, ...objectifyValue(value) }, {});
123 }
124 return objectifyValue(optionValue);
125};
126function mergeOutputOptions(config, overrides, warn) {
127 const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
128 const outputOptions = {
129 amd: getObjectOption(config, overrides, 'amd'),
130 assetFileNames: getOption('assetFileNames'),
131 banner: getOption('banner'),
132 chunkFileNames: getOption('chunkFileNames'),
133 compact: getOption('compact'),
134 dir: getOption('dir'),
135 dynamicImportFunction: getOption('dynamicImportFunction'),
136 entryFileNames: getOption('entryFileNames'),
137 esModule: getOption('esModule'),
138 exports: getOption('exports'),
139 extend: getOption('extend'),
140 externalLiveBindings: getOption('externalLiveBindings'),
141 file: getOption('file'),
142 footer: getOption('footer'),
143 format: getOption('format'),
144 freeze: getOption('freeze'),
145 generatedCode: getObjectOption(config, overrides, 'generatedCode', rollup.objectifyOptionWithPresets(rollup.generatedCodePresets, 'output.generatedCode', '')),
146 globals: getOption('globals'),
147 hoistTransitiveImports: getOption('hoistTransitiveImports'),
148 indent: getOption('indent'),
149 inlineDynamicImports: getOption('inlineDynamicImports'),
150 interop: getOption('interop'),
151 intro: getOption('intro'),
152 manualChunks: getOption('manualChunks'),
153 minifyInternalExports: getOption('minifyInternalExports'),
154 name: getOption('name'),
155 namespaceToStringTag: getOption('namespaceToStringTag'),
156 noConflict: getOption('noConflict'),
157 outro: getOption('outro'),
158 paths: getOption('paths'),
159 plugins: rollup.ensureArray(config.plugins),
160 preferConst: getOption('preferConst'),
161 preserveModules: getOption('preserveModules'),
162 preserveModulesRoot: getOption('preserveModulesRoot'),
163 sanitizeFileName: getOption('sanitizeFileName'),
164 sourcemap: getOption('sourcemap'),
165 sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
166 sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
167 sourcemapFile: getOption('sourcemapFile'),
168 sourcemapPathTransform: getOption('sourcemapPathTransform'),
169 strict: getOption('strict'),
170 systemNullSetters: getOption('systemNullSetters'),
171 validate: getOption('validate')
172 };
173 rollup.warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn);
174 return outputOptions;
175}
176
177exports.commandAliases = commandAliases;
178exports.isWatchEnabled = isWatchEnabled;
179exports.mergeOptions = mergeOptions;
180//# sourceMappingURL=mergeOptions.js.map
Note: See TracBrowser for help on using the repository browser.