|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
763 bytes
|
| Line | |
|---|
| 1 | # Support for `import defer` and `import souce` in acorn
|
|---|
| 2 |
|
|---|
| 3 | ## Install
|
|---|
| 4 |
|
|---|
| 5 | ```
|
|---|
| 6 | npm install acorn-import-phases
|
|---|
| 7 | ```
|
|---|
| 8 |
|
|---|
| 9 | ## Usage
|
|---|
| 10 |
|
|---|
| 11 | This module provides a plugin that can be used to extend the Acorn Parser class:
|
|---|
| 12 |
|
|---|
| 13 | ```js
|
|---|
| 14 | const {Parser} = require('acorn');
|
|---|
| 15 | const importPhases = require('acorn-import-phases');
|
|---|
| 16 | Parser.extend(importPhases()).parse('...');
|
|---|
| 17 | ```
|
|---|
| 18 |
|
|---|
| 19 | By default, the plugin supports both `import defer` and `import source` syntax. You can disable one of them by passing an options object:
|
|---|
| 20 |
|
|---|
| 21 | ```js
|
|---|
| 22 | const {Parser} = require('acorn');
|
|---|
| 23 | const importPhases = require('acorn-import-phases');
|
|---|
| 24 | Parser.extend(importPhases({ defer: false })).parse('...');
|
|---|
| 25 | Parser.extend(importPhases({ source: false })).parse('...');
|
|---|
| 26 | ```
|
|---|
| 27 |
|
|---|
| 28 | ## License
|
|---|
| 29 |
|
|---|
| 30 | This plugin is released under an MIT License.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.