function bundle(entryPoints, config, callback) {
    const entryPointsMap = {};
    entryPoints.forEach((module) => {
        entryPointsMap[module.name] = module;
    });
    const allMentionedModulesMap = {};
    entryPoints.forEach((module) => {
        allMentionedModulesMap[module.name] = true;
        (module.include || []).forEach(function (includedModule) {
            allMentionedModulesMap[includedModule] = true;
        });
        (module.exclude || []).forEach(function (excludedModule) {
            allMentionedModulesMap[excludedModule] = true;
        });
    });
    const code = require('fs').readFileSync(path.join(__dirname, '../../src/vs/loader.js'));
    const r = vm.runInThisContext('(function(require, module, exports) { ' + code + '\n});');
    const loaderModule = { exports: {} };
    r.call({}, require, loaderModule, loaderModule.exports);
    const loader = loaderModule.exports;
    config.isBuild = true;
    config.paths = config.paths || {};
    if (!config.paths['vs/nls']) {
        config.paths['vs/nls'] = 'out-build/vs/nls.build';
    }
    if (!config.paths['vs/css']) {
        config.paths['vs/css'] = 'out-build/vs/css.build';
    }
    loader.config(config);
    loader(['require'], (localRequire) => {
        const resolvePath = (path) => {
            const r = localRequire.toUrl(path);
            if (!/\.js/.test(r)) {
                return r + '.js';
            }
            return r;
        };
        for (const moduleId in entryPointsMap) {
            const entryPoint = entryPointsMap[moduleId];
            if (entryPoint.append) {
                entryPoint.append = entryPoint.append.map(resolvePath);
            }
            if (entryPoint.prepend) {
                entryPoint.prepend = entryPoint.prepend.map(resolvePath);
            }
        }
    });
    loader(Object.keys(allMentionedModulesMap), () => {
        const modules = loader.getBuildInfo();
        const partialResult = emitEntryPoints(modules, entryPointsMap);
        const cssInlinedResources = loader('vs/css').getInlinedResources();
        callback(null, {
            files: partialResult.files,
            cssInlinedResources: cssInlinedResources,
            bundleData: partialResult.bundleData
        });
    }, (err) => callback(err, null));
}
function bundle(entryPoints, config, callback) {
    const entryPointsMap = {};
    entryPoints.forEach((module) => {
        entryPointsMap[module.name] = module;
    });
    const allMentionedModulesMap = {};
    entryPoints.forEach((module) => {
        allMentionedModulesMap[module.name] = true;
        (module.include || []).forEach(function (includedModule) {
            allMentionedModulesMap[includedModule] = true;
        });
        (module.exclude || []).forEach(function (excludedModule) {
            allMentionedModulesMap[excludedModule] = true;
        });
    });
    const code = require('fs').readFileSync(path.join(__dirname, '../../src/vs/loader.js'));
    const r = vm.runInThisContext('(function(require, module, exports) { ' + code + '\n});');
    const loaderModule = { exports: {} };
    r.call({}, require, loaderModule, loaderModule.exports);
    const loader = loaderModule.exports;
    config.isBuild = true;
    config.paths = config.paths || {};
    if (!config.paths['vs/nls']) {
        config.paths['vs/nls'] = 'out-build/vs/nls.build';
    }
    if (!config.paths['vs/css']) {
        config.paths['vs/css'] = 'out-build/vs/css.build';
    }
    loader.config(config);
    loader(['require'], (localRequire) => {
        const resolvePath = (path) => {
            const r = localRequire.toUrl(path);
            if (!/\.js/.test(r)) {
                return r + '.js';
            }
            return r;
        };
        for (const moduleId in entryPointsMap) {
            const entryPoint = entryPointsMap[moduleId];
            if (entryPoint.append) {
                entryPoint.append = entryPoint.append.map(resolvePath);
            }
            if (entryPoint.prepend) {
                entryPoint.prepend = entryPoint.prepend.map(resolvePath);
            }
        }
    });
    loader(Object.keys(allMentionedModulesMap), () => {
        const modules = loader.getBuildInfo();
        const partialResult = emitEntryPoints(modules, entryPointsMap);
        const cssInlinedResources = loader('vs/css').getInlinedResources();
        callback(null, {
            files: partialResult.files,
            cssInlinedResources: cssInlinedResources,
            bundleData: partialResult.bundleData
        });
    }, (err) => callback(err, null));
}
function bundle ( entryPoints , config , callback ) { const entryPointsMap = { } ; entryPoints . forEach ( ( module ) => { entryPointsMap [ module . name ] = module ; } ) ; const allMentionedModulesMap = { } ; entryPoints . forEach ( ( module ) => { allMentionedModulesMap [ module . name ] = true ; ( module . include || [ ] ) . forEach ( function ( includedModule ) { allMentionedModulesMap [ includedModule ] = true ; } ) ; ( module . exclude || [ ] ) . forEach ( function ( excludedModule ) { allMentionedModulesMap [ excludedModule ] = true ; } ) ; } ) ; const code = require ( 'fs' ) . readFileSync ( path . join ( __dirname , '../../src/vs/loader.js' ) ) ; const r = vm . runInThisContext ( '(function(require, module, exports) { ' + code + '\n});' ) ; const loaderModule = { exports : { } } ; r . call ( { } , require , loaderModule , loaderModule . exports ) ; const loader = loaderModule . exports ; config . isBuild = true ; config . paths = config . paths || { } ; if ( ! config . paths [ 'vs/nls' ] ) { config . paths [ 'vs/nls' ] = 'out-build/vs/nls.build' ; } if ( ! config . paths [ 'vs/css' ] ) { config . paths [ 'vs/css' ] = 'out-build/vs/css.build' ; } loader . config ( config ) ; loader ( [ 'require' ] , ( localRequire ) => { const resolvePath = ( path ) => { const r = localRequire . toUrl ( path ) ; if ( ! / \.js / . test ( r ) ) { return r + '.js' ; } return r ; } ; for ( const moduleId in entryPointsMap ) { const entryPoint = entryPointsMap [ moduleId ] ; if ( entryPoint . append ) { entryPoint . append = entryPoint . append . map ( resolvePath ) ; } if ( entryPoint . prepend ) { entryPoint . prepend = entryPoint . prepend . map ( resolvePath ) ; } } } ) ; loader ( Object . keys ( allMentionedModulesMap ) , ( ) => { const modules = loader . getBuildInfo ( ) ; const partialResult = emitEntryPoints ( modules , entryPointsMap ) ; const cssInlinedResources = loader ( 'vs/css' ) . getInlinedResources ( ) ; callback ( null , { files : partialResult . files , cssInlinedResources : cssInlinedResources , bundleData : partialResult . bundleData } ) ; } , ( err ) => callback ( err , null ) ) ; }
Bundle `entryPoints` given config `config`.
Bundle entryPoints given config config .
Bundle the modules