UNPKG

vike

Version:

The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.

30 lines (29 loc) 990 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.injectRollupInputs = injectRollupInputs; exports.normalizeRollupInput = normalizeRollupInput; const assert_js_1 = require("./assert.js"); const isObject_js_1 = require("./isObject.js"); const isArray_js_1 = require("./isArray.js"); function injectRollupInputs(inputsNew, config) { const inputsCurrent = normalizeRollupInput(config.build.rollupOptions.input); const input = { ...inputsNew, ...inputsCurrent, }; return input; } function normalizeRollupInput(input) { if (!input) { return {}; } // Usually `input` is an object, but the user can set it as a `string` or `string[]` if (typeof input === 'string') { input = [input]; } if ((0, isArray_js_1.isArray)(input)) { return Object.fromEntries(input.map((input) => [input, input])); } (0, assert_js_1.assert)((0, isObject_js_1.isObject)(input)); return input; }