This is plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.
For more information, check out the proposal repo.
You can use this module directly in order to get Acorn instance with plugin installed:
import acorn from 'acorn-dynamic-import';
// or...
const acorn = require('acorn-dynamic-import').default;
Or you can use inject.js
for injecting plugin into your own version of Acorn like this:
const acorn = require('acorn-dynamic-import/lib/inject').default(require('./custom-acorn'));
Then, use the plugins
option whenever you need to support dynamicImport while parsing:
const ast = acorn.parse(code, {
plugins: { dynamicImport: true }
});
To use the updated walk functionality the process is similar. You can require the default implementation as:
import walk from 'acorn-dynamic-import/lib/walk';
// or...
const dynamicImportWalk = require('acorn-dynamic-import/lib/walk').default;
Or you can use the injectable version for injecting the new walk functionality into your own version of Acorn like this:
import { inject } from 'acorn-dynamic-import/lib/walk';
import acornWalk from 'acorn/dist/walk';
const walk = inject(acornWalk);
This plugin is issued under the MIT license.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。