Skip to content

Commit 487d64a

Browse files
committed
Update deps.
1 parent 50fff5f commit 487d64a

14 files changed

+654
-438
lines changed

.uglifyrc .terserrc

File renamed without changes.

package-lock.json

+599-364
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"test:prod": "node script/test.js --prod"
3030
},
3131
"devDependencies": {
32-
"@babel/core": "^7.0.0",
32+
"@babel/core": "^7.0.1",
3333
"@babel/plugin-proposal-class-properties": "^7.0.0",
3434
"@babel/plugin-proposal-optional-catch-binding": "^7.0.0",
3535
"@babel/plugin-transform-arrow-functions": "^7.0.0",
@@ -42,7 +42,7 @@
4242
"@babel/runtime": "^7.0.0",
4343
"@std/esm": "^0.25.5",
4444
"@types/node": "^10.9.4",
45-
"acorn": "^5.7.3",
45+
"acorn": "^6.0.1",
4646
"ava": "1.0.0-beta.7",
4747
"babel-eslint": "^9.0.0",
4848
"babel-loader": "^8.0.2",
@@ -52,7 +52,7 @@
5252
"bluebird": "^3.5.2",
5353
"chai": "^4.1.2",
5454
"download": "^7.1.0",
55-
"eslint": "^5.5.0",
55+
"eslint": "^5.6.0",
5656
"eslint-plugin-import": "^2.14.0",
5757
"eslint-plugin-node": "^7.0.1",
5858
"execa": "^1.0.0",
@@ -82,15 +82,15 @@
8282
"sleep": "^5.2.3",
8383
"sqreen": "^1.23.0",
8484
"strip-ansi": "^4.0.0",
85+
"terser": "^3.8.2",
86+
"terser-webpack-plugin": "^1.1.0",
8587
"test262-parser": "^2.0.7",
8688
"trash": "^4.3.0",
8789
"ts-node": "^7.0.1",
8890
"typescript": "^3.0.3",
89-
"uglify-es": "^3.3.10",
90-
"uglifyjs-webpack-plugin": "^1.3.0",
9191
"unused-webpack-plugin": "^2.0.0",
92-
"webpack": "^4.18.0",
93-
"webpack-bundle-analyzer": "^3.0.1",
92+
"webpack": "^4.19.0",
93+
"webpack-bundle-analyzer": "^3.0.2",
9494
"webpack-cli": "^3.1.0",
9595
"yargs": "^12.0.2"
9696
},

script/build.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const rootPath = path.resolve(__dirname, "..")
1818
const buildPath = path.resolve(rootPath, "build")
1919
const loaderPath = path.resolve(rootPath, "esm/loader.js")
2020

21-
const uglifyPluginPath = path.resolve(rootPath, "node_modules/uglifyjs-webpack-plugin")
22-
const uglifyPath = path.resolve(uglifyPluginPath, "node_modules/uglify-es")
21+
const terserPluginPath = path.resolve(rootPath, "node_modules/terser-webpack-plugin")
22+
const terserPath = path.resolve(terserPluginPath, "node_modules/terser")
2323

2424
const trashPaths = [
2525
buildPath,
2626
loaderPath,
27-
uglifyPath
27+
terserPath
2828
]
2929

3030
const webpackArgs = [

script/publish.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ const fleece = require("golden-fleece")
55
const fs = require("fs-extra")
66
const htmlmin = require("html-minifier").minify
77
const path = require("path")
8-
const uglify = require("uglify-es").minify
8+
const terser = require("terser").minify
99

1010
const rootPath = path.resolve(__dirname, "..")
1111
const esmPath = path.resolve(rootPath, "esm.js")
1212
const indexPath = path.resolve(rootPath, "index.js")
1313
const pkgPath = path.resolve(rootPath, "package.json")
1414
const readmePath = path.resolve(rootPath, "README.md")
1515

16-
const uglifyOptions = fs.readJSONSync(path.resolve(rootPath, ".uglifyrc"))
17-
1816
const tableRegExp = /^<table>[^]*?\n<\/table>/gm
17+
const terserOptions = fs.readJSONSync(path.resolve(rootPath, ".terserrc"))
1918

2019
const defaultScripts = {
2120
test: 'echo "Error: no test specified" && exit 1'
@@ -86,7 +85,7 @@ function minifyHTML(content) {
8685
}
8786

8887
function minifyJS(content) {
89-
return uglify(content, uglifyOptions).code
88+
return terser(content, terserOptions).code
9089
}
9190

9291
function publishPackage() {

script/setup-acorn.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const acornPath = path.resolve(vendorPath, "acorn")
1111
const acornPkg = require("acorn/package.json")
1212
const acornURL = "https://github.com/ternjs/acorn/archive/" + acornPkg.version + ".zip"
1313

14-
const extractFilterRegExp = /^(?:pack|src).*?\.(?:js|json)$/
14+
const extractFilterRegExp = /^acorn[\\/].*?\.(?:js|json)$/
1515

1616
function setupAcorn() {
1717
if (fs.existsSync(acornPath)) {

script/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const ignorePaths = require("./ignore-paths.js")
66
const path = require("path")
77
const setupTest262 = require("./setup-test262.js")
88
const trash = require("./trash.js")
9-
const uglify = require("uglify-es").minify
9+
const terser = require("terser").minify
1010

1111
const argv = require("yargs")
1212
.boolean("prod")
@@ -58,7 +58,7 @@ nodeArgs.push(
5858
)
5959

6060
const trashPaths = ignorePaths.filter(isKept)
61-
const uglifyOptions = fs.readJSONSync(path.resolve(rootPath, ".uglifyrc"))
61+
const terserOptions = fs.readJSONSync(path.resolve(rootPath, ".terserrc"))
6262

6363
function cleanJS() {
6464
jsPaths.forEach((filename) => {
@@ -79,7 +79,7 @@ function isKept(thePath) {
7979
}
8080

8181
function minifyJS(content) {
82-
return uglify(content, uglifyOptions).code
82+
return terser(content, terserOptions).code
8383
}
8484

8585
function runTests(cached) {

src/acorn.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import "./vendor/acorn/src/expression.js"
2-
import "./vendor/acorn/src/location.js"
3-
import "./vendor/acorn/src/lval.js"
4-
import "./vendor/acorn/src/node.js"
5-
import "./vendor/acorn/src/scope.js"
6-
import "./vendor/acorn/src/statement.js"
7-
import "./vendor/acorn/src/tokencontext.js"
8-
import "./vendor/acorn/src/tokenize.js"
1+
import "./vendor/acorn/acorn/src/expression.js"
2+
import "./vendor/acorn/acorn/src/location.js"
3+
import "./vendor/acorn/acorn/src/lval.js"
4+
import "./vendor/acorn/acorn/src/node.js"
5+
import "./vendor/acorn/acorn/src/scope.js"
6+
import "./vendor/acorn/acorn/src/statement.js"
7+
import "./vendor/acorn/acorn/src/tokencontext.js"
8+
import "./vendor/acorn/acorn/src/tokenize.js"
99

1010
import {
1111
lineBreak as lineBreakRegExp,
1212
skipWhiteSpace as skipWhiteSpaceRegExp
13-
} from "./vendor/acorn/src/whitespace.js"
13+
} from "./vendor/acorn/acorn/src/whitespace.js"
1414

15-
import { Parser } from "./vendor/acorn/src/state.js"
16-
import { getLineInfo } from "./vendor/acorn/src/locutil.js"
17-
import { types as tokTypes } from "./vendor/acorn/src/tokentype.js"
15+
import { Parser } from "./vendor/acorn/acorn/src/state.js"
16+
import { getLineInfo } from "./vendor/acorn/acorn/src/locutil.js"
17+
import { types as tokTypes } from "./vendor/acorn/acorn/src/tokentype.js"
1818

1919
const literalRegExp = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/
2020

src/acorn/parser/class-fields.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function init() {
1616
const Plugin = {
1717
enable(parser) {
1818
parser.getTokenFromCode = wrap(parser.getTokenFromCode, getTokenFromCode)
19-
parser.parseClassMember = wrap(parser.parseClassMember, parseClassMember)
19+
parser.parseClassElement = wrap(parser.parseClassElement, parseClassElement)
2020
return parser
2121
}
2222
}
@@ -32,7 +32,7 @@ function init() {
3232
return this.finishToken(tt.name, this.readWord1())
3333
}
3434

35-
function parseClassMember(func, args) {
35+
function parseClassElement(func, args) {
3636
if (this.type !== tt.name) {
3737
return Reflect.apply(func, this, args)
3838
}
@@ -51,15 +51,13 @@ function init() {
5151
return Reflect.apply(func, this, args)
5252
}
5353

54-
const [classBody] = args
5554
const node = this.startNode()
5655

5756
node.computed = false
5857
node.key = this.parseIdent(true)
5958
node.value = this.eat(tt.eq) ? this.parseExpression() : null
6059

6160
this.finishNode(node, "FieldDefinition")
62-
classBody.body.push(node)
6361
this.semicolon()
6462
return node
6563
}

src/acorn/parser/for-await-outside-function.js

-26
This file was deleted.

src/acorn/parser/tolerance.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import noop from "../../util/noop.js"
44
import shared from "../../shared.js"
55

66
function init() {
7+
const scopes = { __proto__: null }
8+
79
const Plugin = {
810
enable(parser) {
911
parser.isDirectiveCandidate =
1012
parser.strictDirective = alwaysFalse
1113

12-
parser.canDeclareLexicalName =
13-
parser.canDeclareVarName =
1414
parser.isSimpleParamList = alwaysTrue
1515

1616
parser.adaptDirectivePrologue =
@@ -20,17 +20,13 @@ function init() {
2020
parser.checkPropClash =
2121
parser.checkVariableExport =
2222
parser.checkYieldAwaitInDefaultParams =
23-
parser.declareLexicalName =
24-
parser.declareVarName =
25-
parser.enterFunctionScope =
26-
parser.enterLexicalScope =
27-
parser.exitFunctionScope =
28-
parser.exitLexicalScope =
23+
parser.declareName =
2924
parser.invalidStringToken =
3025
parser.validateRegExpFlags =
3126
parser.validateRegExpPattern = noop
3227

3328
parser.checkExpressionErrors = checkExpressionErrors
29+
parser.enterScope = enterScope
3430
return parser
3531
}
3632
}
@@ -43,6 +39,22 @@ function init() {
4339
return false
4440
}
4541

42+
function enterScope(flags) {
43+
this.scopeStack.push(getScope(flags))
44+
}
45+
46+
function getScope(flags) {
47+
if (Reflect.has(scopes, flags)) {
48+
return scopes[flags]
49+
}
50+
51+
return scopes[flags] = {
52+
flags,
53+
lexical: [],
54+
var: []
55+
}
56+
}
57+
4658
return Plugin
4759
}
4860

src/acorn/parser/top-level.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function init() {
2929
let inited = false
3030

3131
while (this.type !== tt.eof) {
32-
const stmt = this.parseStatement(true, true, exported)
32+
const stmt = this.parseStatement(null, true, exported)
3333

3434
let { expression, type } = stmt
3535

src/parser.js

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Parser as AcornParser } from "./acorn.js"
55
import acornParserBigInt from "./acorn/parser/big-int.js"
66
import acornParserClassFields from "./acorn/parser/class-fields.js"
77
import acornParserErrorMessages from "./acorn/parser/error-messages.js"
8-
import acornParserForAwaitOutsideFunction from "./acorn/parser/for-await-outside-function.js"
98
import acornParserFunctionParamsStart from "./acorn/parser/function-params-start.js"
109
import acornParserHTMLComment from "./acorn/parser/html-comment.js"
1110
import acornParserImport from "./acorn/parser/import.js"
@@ -48,7 +47,6 @@ function init() {
4847
acornParserBigInt.enable(parser)
4948
acornParserClassFields.enable(parser)
5049
acornParserErrorMessages.enable(parser)
51-
acornParserForAwaitOutsideFunction.enable(parser)
5250
acornParserFunctionParamsStart.enable(parser)
5351
acornParserHTMLComment.enable(parser)
5452
acornParserImport.enable(parser)

webpack.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const {
1313

1414
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer")
1515
const OptimizeJsPlugin = require("optimize-js-plugin")
16-
const UglifyJSPlugin = require("uglifyjs-webpack-plugin")
16+
const TerserPlugin = require("terser-webpack-plugin")
1717
const UnusedPlugin = require("unused-webpack-plugin")
1818

1919
class WebpackRequirePlugin {
@@ -60,7 +60,7 @@ const hosted = [
6060
]
6161

6262
const babelOptions = require("./.babel.config.js")
63-
const uglifyOptions = fs.readJSONSync("./.uglifyrc")
63+
const terserOptions = fs.readJSONSync("./.terserrc")
6464

6565
const config = {
6666
devtool: false,
@@ -80,7 +80,7 @@ const config = {
8080
},
8181
optimization: {
8282
minimizer: [
83-
new UglifyJSPlugin({ uglifyOptions })
83+
new TerserPlugin({ terserOptions })
8484
],
8585
nodeEnv: false
8686
},

0 commit comments

Comments
 (0)