MCPcopy
hub / github.com/rollup/rollup / getAmd

Function getAmd

src/utils/options/normalizeOutputOptions.ts:241–288  ·  view source on GitHub ↗
(config: OutputOptions)

Source from the content-addressed store, hash-verified

239};
240
241const getAmd = (config: OutputOptions): NormalizedOutputOptions['amd'] => {
242 const mergedOption: {
243 autoId: boolean;
244 basePath: string;
245 define: string;
246 forceJsExtensionForImports: boolean;
247 id?: string;
248 } = {
249 autoId: false,
250 basePath: '',
251 define: 'define',
252 forceJsExtensionForImports: false,
253 ...config.amd
254 };
255
256 if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
257 return error(
258 logInvalidOption(
259 'output.amd.id',
260 URL_OUTPUT_AMD_ID,
261 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'
262 )
263 );
264 }
265 if (mergedOption.basePath && !mergedOption.autoId) {
266 return error(
267 logInvalidOption(
268 'output.amd.basePath',
269 URL_OUTPUT_AMD_BASEPATH,
270 'this option only works with "output.amd.autoId"'
271 )
272 );
273 }
274
275 return mergedOption.autoId
276 ? {
277 autoId: true,
278 basePath: mergedOption.basePath,
279 define: mergedOption.define,
280 forceJsExtensionForImports: mergedOption.forceJsExtensionForImports
281 }
282 : {
283 autoId: false,
284 define: mergedOption.define,
285 forceJsExtensionForImports: mergedOption.forceJsExtensionForImports,
286 id: mergedOption.id
287 };
288};
289
290const getAddon = <T extends 'banner' | 'footer' | 'intro' | 'outro'>(
291 config: OutputOptions,

Callers 1

normalizeOutputOptionsFunction · 0.85

Calls 2

errorFunction · 0.90
logInvalidOptionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…