Merge remote-tracking branch 'origin/master' into development
Conflicts: packages/babel/scripts/build-dist.sh
This commit is contained in:
commit
061ba7b2a2
@ -9,13 +9,13 @@ mkdir -p dist
|
||||
|
||||
node scripts/cache-templates
|
||||
|
||||
node $BROWSERIFY_CMD -e ../babel-polyfill/lib/polyfill.js >dist/polyfill.js
|
||||
node $UGLIFY_CMD dist/polyfill.js >dist/polyfill.min.js
|
||||
#node $BROWSERIFY_CMD -e lib/polyfill.js >dist/polyfill.js
|
||||
#node $UGLIFY_CMD dist/polyfill.js >dist/polyfill.min.js
|
||||
|
||||
# Add a Unicode BOM so browsers will interpret the file as UTF-8
|
||||
printf '\xEF\xBB\xBF' > dist/browser.js
|
||||
node -p '"\uFEFF"' > dist/browser.js
|
||||
node $BROWSERIFY_CMD lib/api/browser.js -s babel $BROWSERIFY_IGNORE >>dist/browser.js
|
||||
printf '\xEF\xBB\xBF' > dist/browser.min.js
|
||||
node -p '"\uFEFF"' > dist/browser.min.js
|
||||
node $UGLIFY_CMD dist/browser.js >>dist/browser.min.js
|
||||
|
||||
node $BROWSERIFY_CMD lib/api/node.js --node $BROWSERIFY_IGNORE >dist/node.js
|
||||
|
||||
26
packages/babel/scripts/build-dist.sh
Executable file
26
packages/babel/scripts/build-dist.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BROWSERIFY_CMD="../../node_modules/browserify/bin/cmd.js"
|
||||
UGLIFY_CMD="../../node_modules/uglify-js/bin/uglifyjs"
|
||||
BROWSERIFY_IGNORE="-i esprima-fb"
|
||||
|
||||
mkdir -p dist
|
||||
|
||||
node scripts/cache-templates
|
||||
|
||||
node $BROWSERIFY_CMD -e lib/polyfill.js >dist/polyfill.js
|
||||
node $UGLIFY_CMD dist/polyfill.js >dist/polyfill.min.js
|
||||
|
||||
# Add a Unicode BOM so browsers will interpret the file as UTF-8
|
||||
node -p '"\uFEFF"' > dist/browser.js
|
||||
node $BROWSERIFY_CMD lib/api/browser.js -s babel $BROWSERIFY_IGNORE >>dist/browser.js
|
||||
node -p '"\uFEFF"' > dist/browser.min.js
|
||||
node $UGLIFY_CMD dist/browser.js >>dist/browser.min.js
|
||||
|
||||
node $BROWSERIFY_CMD lib/api/node.js --node $BROWSERIFY_IGNORE >dist/node.js
|
||||
|
||||
node ../babel-cli/lib/babel-external-helpers >dist/external-helpers.js
|
||||
node $UGLIFY_CMD dist/external-helpers.js >dist/external-helpers.min.js
|
||||
|
||||
rm -rf templates.json
|
||||
@ -256,7 +256,6 @@ pp.flowParseObjectTypeCallProperty = function (node, isStatic) {
|
||||
pp.flowParseObjectType = function (allowStatic) {
|
||||
var nodeStart = this.startNode();
|
||||
var node;
|
||||
var optional = false;
|
||||
var propertyKey;
|
||||
var isStatic;
|
||||
|
||||
@ -267,6 +266,7 @@ pp.flowParseObjectType = function (allowStatic) {
|
||||
this.expect(tt.braceL);
|
||||
|
||||
while (!this.match(tt.braceR)) {
|
||||
var optional = false;
|
||||
var startPos = this.state.start, startLoc = this.state.startLoc;
|
||||
node = this.startNode();
|
||||
if (allowStatic && this.isContextual("static")) {
|
||||
|
||||
1
packages/babylon/test/fixtures/flow/type-annotations/98/actual.js
vendored
Normal file
1
packages/babylon/test/fixtures/flow/type-annotations/98/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var a: {param1?: number; param2: string; param3: string;}
|
||||
259
packages/babylon/test/fixtures/flow/type-annotations/98/expected.json
vendored
Normal file
259
packages/babylon/test/fixtures/flow/type-annotations/98/expected.json
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"name": "a",
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 5,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "ObjectTypeAnnotation",
|
||||
"start": 7,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 57
|
||||
}
|
||||
},
|
||||
"callProperties": [],
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 8,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 8,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"name": "param1"
|
||||
},
|
||||
"value": {
|
||||
"type": "NumberTypeAnnotation",
|
||||
"start": 17,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 25,
|
||||
"end": 40,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"name": "param2"
|
||||
},
|
||||
"value": {
|
||||
"type": "StringTypeAnnotation",
|
||||
"start": 33,
|
||||
"end": 39,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 33
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 39
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"type": "ObjectTypeProperty",
|
||||
"start": 41,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 56
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start": 41,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"name": "param3"
|
||||
},
|
||||
"value": {
|
||||
"type": "StringTypeAnnotation",
|
||||
"start": 49,
|
||||
"end": 55,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 49
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 55
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": false
|
||||
}
|
||||
],
|
||||
"indexers": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": []
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user