nav tabs on admin dashboard
This commit is contained in:
+9
-13
@@ -6,26 +6,22 @@ For more information, check out the [proposal repo](https://github.com/tc39/prop
|
||||
|
||||
## Usage
|
||||
|
||||
You can use this module directly in order to get Acorn instance with plugin installed:
|
||||
Importing this module gives you a plugin that can be used to extend an Acorn parser:
|
||||
|
||||
```js
|
||||
import acorn from 'acorn-dynamic-import';
|
||||
// or...
|
||||
const acorn = require('acorn-dynamic-import').default;
|
||||
import Parser from 'acorn';
|
||||
import dynamicImport from 'acorn-dynamic-import';
|
||||
|
||||
Parser.extend(dynamicImport).parse('import("something");');
|
||||
```
|
||||
|
||||
Or you can use `inject.js` for injecting plugin into your own version of Acorn like this:
|
||||
To extend the AST walker for dynamic imports, you can injecting the new node type into [`acorn-walk`](https://www.npmjs.com/package/acorn-walk) like this:
|
||||
|
||||
```js
|
||||
const acorn = require('acorn-dynamic-import/lib/inject').default(require('./custom-acorn'));
|
||||
```
|
||||
import inject from 'acorn-dynamic-import/lib/walk';
|
||||
import * as acornWalk from 'acorn-walk';
|
||||
|
||||
Then, use the `plugins` option whenever you need to support dynamicImport while parsing:
|
||||
|
||||
```js
|
||||
const ast = acorn.parse(code, {
|
||||
plugins: { dynamicImport: true }
|
||||
});
|
||||
const walk = inject(acornWalk);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user