Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pkg.browser.fs === false;
if (!ignore) {
traverse(ast.program, fsVisitor, null, asset);
}
}
// Insert node globals
if (GLOBAL_RE.test(code)) {
asset.meta.globals = new Map();
walk.ancestor(ast.program, insertGlobals, asset);
}
}
if (options.scopeHoist) {
hoist(asset);
} else if (asset.meta.isES6Module) {
// Convert ES6 modules to CommonJS
let res = babelCore.transformFromAst(ast.program, code, {
code: false,
ast: true,
filename: asset.filePath,
babelrc: false,
configFile: false,
plugins: [require('@babel/plugin-transform-modules-commonjs')]
});
ast.program = res.ast;
ast.isDirty = true;
}
return [asset];
pkg.browser.fs === false;
if (!ignore) {
traverse(ast.program, fsVisitor, null, {asset, logger});
}
}
// Insert node globals
if (GLOBAL_RE.test(code)) {
asset.meta.globals = new Map();
walk.ancestor(ast.program, insertGlobals, asset);
}
}
if (options.scopeHoist) {
hoist(asset);
} else if (asset.meta.isES6Module) {
// Convert ES6 modules to CommonJS
let res = babelCore.transformFromAst(ast.program, code, {
code: false,
ast: true,
filename: asset.filePath,
babelrc: false,
configFile: false,
plugins: [require('@babel/plugin-transform-modules-commonjs')],
});
ast.program = res.ast;
ast.isDirty = true;
}
return [asset];
return replaceBundleReferences({
bundle,
bundleGraph,
contents,
getInlineReplacement: (dependency, inlineType, content) => ({
from: `"${dependency.id}"`,
to: inlineType === 'string' ? JSON.stringify(content) : content,
}),
getInlineBundleContents,
map,
});
}
// If scope hoisting is enabled, we use a different code path.
if (options.scopeHoist) {
let ast = await concat(bundle, bundleGraph);
ast = link({bundle, bundleGraph, ast, options});
return replaceReferences({
contents: generate(bundleGraph, bundle, ast, options).contents,
map: null,
});
}
if (bundle.env.outputFormat === 'esmodule') {
throw new Error(
`esmodule output is not supported without scope hoisting.`,
);
}
// For development, we just concatenate all of the code together
// rather then enabling scope hoisting, which would be too slow.
let codeQueue = new PromiseQueue({maxConcurrent: 32});
contents,
getInlineReplacement: (dependency, inlineType, content) => ({
from: `"${dependency.id}"`,
to: inlineType === 'string' ? JSON.stringify(content) : content,
}),
getInlineBundleContents,
map,
});
}
// If scope hoisting is enabled, we use a different code path.
if (options.scopeHoist) {
let ast = await concat(bundle, bundleGraph);
ast = link({bundle, bundleGraph, ast, options});
return replaceReferences({
contents: generate(bundleGraph, bundle, ast, options).contents,
map: null,
});
}
if (bundle.env.outputFormat === 'esmodule') {
throw new Error(
`esmodule output is not supported without scope hoisting.`,
);
}
// For development, we just concatenate all of the code together
// rather then enabling scope hoisting, which would be too slow.
let codeQueue = new PromiseQueue({maxConcurrent: 32});
let mapQueue = new PromiseQueue({maxConcurrent: 32});
bundle.traverse(node => {
if (node.type === 'asset') {
bundle,
bundleGraph,
contents,
getInlineReplacement: (dependency, inlineType, content) => ({
from: `"${dependency.id}"`,
to: inlineType === 'string' ? JSON.stringify(content) : content,
}),
getInlineBundleContents,
map,
});
}
// If scope hoisting is enabled, we use a different code path.
if (options.scopeHoist) {
let ast = await concat(bundle, bundleGraph);
ast = link({bundle, bundleGraph, ast, options});
return replaceReferences({
contents: generate(bundleGraph, bundle, ast, options).contents,
map: null,
});
}
if (bundle.env.outputFormat === 'esmodule') {
throw new Error(
`esmodule output is not supported without scope hoisting.`,
);
}
// For development, we just concatenate all of the code together
// rather then enabling scope hoisting, which would be too slow.
let codeQueue = new PromiseQueue({maxConcurrent: 32});
let mapQueue = new PromiseQueue({maxConcurrent: 32});