Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100717310
README.md
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 03:57
Size
877 B
Mime Type
text/x-java
Expires
Tue, Feb 4, 03:57 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24017484
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
README.md
View Options
#
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
Importing
this
module
gives
you
a
plugin
that
can
be
used
to
extend
an
Acorn
parser
:
```
js
import
Parser
from
'
acorn
'
;
import
dynamicImport
from
'
acorn
-
dynamic
-
import
'
;
Parser
.
extend
(
dynamicImport
).
parse
(
'
import
(
"something"
);
'
);
```
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
import
inject
from
'
acorn
-
dynamic
-
import
/
lib
/
walk
'
;
import
*
as
acornWalk
from
'
acorn
-
walk
'
;
const
walk
=
inject
(
acornWalk
);
```
##
License
This
plugin
is
issued
under
the
[
MIT
license
](./
LICENSE
).
Event Timeline
Log In to Comment