Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deltaBundler
) {
// Get all the polyfills from the relevant option params (the
// `getPolyfills()` method and the `polyfillModuleNames` variable).
const polyfillModuleNames = config.serializer
.getPolyfills({
platform: options.platform
})
.concat(config.serializer.polyfillModuleNames);
const transformOptions = _objectSpread({}, options, {
type: "script"
});
const graph = yield deltaBundler.buildGraph(
[defaults.moduleSystem].concat(_toConsumableArray(polyfillModuleNames)),
{
resolve: yield transformHelpers.getResolveDependencyFn(
bundler,
options.platform
),
transform: yield transformHelpers.getTransformFn(
[defaults.moduleSystem].concat(
_toConsumableArray(polyfillModuleNames)
),
bundler,
deltaBundler,
config,
transformOptions
),
onProgress: null
}
): Promise<$ReadOnlyArray>> {
// Get all the polyfills from the relevant option params (the
// `getPolyfills()` method and the `polyfillModuleNames` variable).
const polyfillModuleNames = config.serializer
.getPolyfills({
platform: options.platform,
})
.concat(config.serializer.polyfillModuleNames);
const transformOptions: TransformInputOptions = {
...options,
type: 'script',
};
const graph = await deltaBundler.buildGraph(
[defaults.moduleSystem, ...polyfillModuleNames],
{
resolve: await transformHelpers.getResolveDependencyFn(
bundler,
options.platform,
),
transform: await transformHelpers.getTransformFn(
[defaults.moduleSystem, ...polyfillModuleNames],
bundler,
deltaBundler,
config,
transformOptions,
),
onProgress: null,
experimentalImportBundleSupport:
config.transformer.experimentalImportBundleSupport,
shallow: false,
const _ref2 = yield Promise.all([
_asyncToGenerator(function*() {
const result = yield graphFn(entryPointPaths);
const modules = result.modules,
entryModules = result.entryModules;
const prModules = postProcessModules(
modules,
_toConsumableArray(entryPointPaths)
);
return {
modules: prModules,
entryModules
};
})(),
graphOnlyModules([translateDefaultsPath(defaults.moduleSystem)]),
graphOnlyModules(
getPolyfills({
platform
}).map(translateDefaultsPath)
)
]),
_ref3 = _slicedToArray(_ref2, 3),
graph = _ref3[0],
moduleSystem = _ref3[1],
polyfills = _ref3[2];
const entryModules = graph.entryModules;
const preludeScript = virtualModule(
getPreludeCode({
extraVars: {
__FRAMEWORK__: options.framework
optimize,
platform,
postProcessModules,
translateDefaultsPath,
} = options;
const graphOnlyModules = async m => (await graphFn(m)).modules;
const [graph, moduleSystem, polyfills] = await Promise.all([
(async () => {
const result = await graphFn(entryPointPaths);
const {modules, entryModules} = result;
const prModules = postProcessModules(modules, [...entryPointPaths]);
return {modules: prModules, entryModules};
})(),
graphOnlyModules([translateDefaultsPath(defaults.moduleSystem)]),
graphOnlyModules(getPolyfills({platform}).map(translateDefaultsPath)),
]);
const {entryModules} = graph;
const preludeScript = virtualModule(
getPreludeCode({
extraVars: {
__FRAMEWORK__: options.framework,
},
isDev: !optimize,
}),
'//prelude.js',
);
const prependedScripts = [preludeScript, ...moduleSystem, ...polyfills];
return {
entryModules,