feat: update acorn for dynamic import

This commit is contained in:
Daan Roet 2019-07-05 13:24:39 +02:00
parent 0976bd35e6
commit b56c3ecf1c
4 changed files with 6 additions and 13 deletions

View File

@ -7,14 +7,13 @@
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
const acorn = require("acorn");
const acornDynamicImport = require("acorn-dynamic-import").default;
const { Tapable, SyncBailHook, HookMap } = require("tapable");
const util = require("util");
const vm = require("vm");
const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
const StackedSetMap = require("./util/StackedSetMap");
const acornParser = acorn.Parser.extend(acornDynamicImport);
const acornParser = acorn.Parser;
const joinRanges = (startRange, endRange) => {
if (!endRange) return startRange;
@ -25,7 +24,7 @@ const joinRanges = (startRange, endRange) => {
const defaultParserOptions = {
ranges: true,
locations: true,
ecmaVersion: 2019,
ecmaVersion: 11,
sourceType: "module",
onComment: null
};

View File

@ -9,8 +9,7 @@
"@webassemblyjs/helper-module-context": "1.8.5",
"@webassemblyjs/wasm-edit": "1.8.5",
"@webassemblyjs/wasm-parser": "1.8.5",
"acorn": "^6.0.5",
"acorn-dynamic-import": "^4.0.0",
"acorn": "^6.2.0",
"ajv": "^6.1.0",
"ajv-keywords": "^3.1.0",
"chrome-trace-event": "^1.0.0",

View File

@ -1,14 +1,14 @@
"use strict";
const acorn = require("acorn");
const acornParser = acorn.Parser.extend(require("acorn-dynamic-import").default);
const acornParser = acorn.Parser;
module.exports = function(source) {
const comments = [];
const ast = acornParser.parse(source, {
ranges: true,
locations: true,
ecmaVersion: 2017,
ecmaVersion: 11,
sourceType: "module",
onComment: comments
});

View File

@ -595,11 +595,6 @@ accepts@~1.3.5:
mime-types "~2.1.18"
negotiator "0.6.1"
acorn-dynamic-import@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948"
integrity sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==
acorn-globals@^1.0.3:
version "1.0.9"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf"
@ -657,7 +652,7 @@ acorn@^5.5.3:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==
acorn@^6.0.1, acorn@^6.0.5, acorn@^6.0.7:
acorn@^6.0.1, acorn@^6.0.7, acorn@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3"
integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw==