All files entry.ts

100% Statements 18/18
100% Branches 8/8
100% Functions 1/1
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25      1x 6x 6x 6x 6x 1x 1x 5x   6x 1x 1x   6x 4x 4x 4x 4x   5x 5x  
import type { RspackOptionsNormalized } from '@rspack/core';
import type { ParsedModuleLinkPluginOptions } from './types';
 
export function initEntry(
    options: RspackOptionsNormalized,
    opts: ParsedModuleLinkPluginOptions
) {
    if (typeof options.entry === 'function') {
        throw new TypeError(`'entry' option does not support functions`);
    }
    let entry = options.entry;
 
    if (entry.main && Object.keys(entry.main).length === 0) {
        entry = {};
    }
 
    for (const value of Object.values(opts.exports)) {
        entry[value.name] = {
            import: [...opts.preEntries, value.file]
        };
    }
 
    options.entry = entry;
}