Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onParserInstallation(acorn) {
if (options.onParserInstallation) {
options.onParserInstallation(acorn);
}
// Patch acorn to support dynamic import
// eslint-disable-next-line import/no-extraneous-dependencies
require('acorn-dynamic-import/lib/inject').default(acorn);
}
})
const acorn = require("acorn-dynamic-import/lib/inject").default(require("acorn"));
const walk = require("acorn/dist/walk");
const combineSourceMap = require("combine-source-map");
const umd = require("umd");
const bundleConstants = require("./bundleConstants");
const CWD = process.cwd();
const BUNDLE_MODULE_LOADER = bundleConstants.BUNDLE_MODULE_LOADER;
const REQUIRE_NAME = bundleConstants.REQUIRE_NAME;
const BUNDLE_ITERATOR_NAME = bundleConstants.BUNDLE_ITERATOR_NAME;
const PREAMBLE = `require=${BUNDLE_ITERATOR_NAME}=(${BUNDLE_MODULE_LOADER})`;
function buildBundle(modules, options) {
options = options || {};
const sourceMap = combineSourceMap.create();
import * as acorn from "acorn";
import * as babel from "babel-core";
import traverse from "babel-traverse";
import { ImportDeclaration, CallExpression, Literal } from "estree";
const walk = require("acorn/dist/walk");
require("acorn-dynamic-import/lib/inject").default(acorn);
require("acorn-jsx/inject")(acorn);
require("acorn-object-spread/inject")(acorn);
const ECMA_VERSION = 2017;
const config = {
presets: [require("babel-preset-env"), require("babel-preset-react")],
plugins: [
require("babel-plugin-transform-async-to-generator"),
require("babel-plugin-transform-object-rest-spread"),
require("babel-plugin-transform-class-properties"),
require("babel-plugin-transform-decorators-legacy").default,
require("babel-plugin-dynamic-import-node").default
]
};
return opts
}
module.exports = exports = xtend(acorn, {
parse: function parse (src, opts) {
return acorn.parse(src, mapOptions(opts))
},
parseExpressionAt: function parseExpressionAt (src, offset, opts) {
return acorn.parseExpressionAt(src, offset, mapOptions(opts))
},
tokenizer: function tokenizer (src, opts) {
return acorn.tokenizer(src, mapOptions(opts))
}
})
require('acorn-dynamic-import/lib/inject').default(exports)
require('./lib/import-meta')(exports)