Sha256: 8a1f71e06dead6fd7c7d6f5f90f09c7dff7d1da1d484ccdfe3e594a0d5708f07

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

# Dynamic import support in acorn

This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.

For more information, check out the [proposal repo](https://github.com/tc39/proposal-dynamic-import).

## Usage

You can use this module directly in order to get Acorn instance with plugin installed:

```js
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:

```js
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:

```js
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:

```js
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:

```js
import { inject } from 'acorn-dynamic-import/lib/walk';
import acornWalk from 'acorn/dist/walk';

const walk = inject(acornWalk);

``` 

## License

This plugin is issued under the [MIT license](./LICENSE).

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/acorn-dynamic-import/README.md
locomotivecms-3.4.0 app/javascript/node_modules/acorn-dynamic-import/README.md
condenser-0.0.4 lib/condenser/processors/node_modules/acorn-dynamic-import/README.md
dragonfly_puppeteer-0.1.0 node_modules/acorn-dynamic-import/README.md