How to use the acorn-dynamic-import/lib/inject.default function in acorn-dynamic-import

To help you get started, we’ve selected a few acorn-dynamic-import examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oligot / rollup-plugin-nodent / index.js View on Github external
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);
					}
				})
github MiguelCastillo / bit-bundler / src / bundler / chunkedBundleBuilder.js View on Github external
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();
github codesandbox / codesandbox-importers / packages / import-utils / src / create-sandbox / utils / extract-requires.ts View on Github external
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
  ]
};
github oceanofthelost / InteractiveBOM / GUI / node_modules / acorn-node / index.js View on Github external
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)