Skip to content

Commit

Permalink
2.26 例行上线 (#519)
Browse files Browse the repository at this point in the history
* MIP 核心升级 mip-sandbox (#484)

* add event dot syntax (#466)
  • Loading branch information
zoumiaojiang authored Feb 26, 2019
1 parent 6f44e59 commit b83fd0b
Show file tree
Hide file tree
Showing 10 changed files with 2,469 additions and 2,259 deletions.
3 changes: 3 additions & 0 deletions packages/mip-component-validator/src/rules/lib/whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ nib
fe-siteopen-sdk
@baidu/fe-siteopen-sdk
@baidu/guid
web-animations-js
vue-lottery
mustache
3 changes: 2 additions & 1 deletion packages/mip-sandbox/lib/global-detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = function (code, fn, type) {
}

return fn.call(this, node, parent, ast)
}
},
fallback: 'iteration'
})

return ast
Expand Down
17 changes: 12 additions & 5 deletions packages/mip-sandbox/lib/global-mark.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ function mark (ast) {
enter: function (node, parent) {
// 标记变量声明
if (is(node, /^Import\w*Specifier$/)) {
node.local.isVar = true
if (node.local) {
node.local.isVar = true
}
if (node.imported && is(node.imported, 'Identifier')) {
node.imported.isIgnore = true
}
} else if (is(node, 'VariableDeclaration')) {
if (node.kind === 'var') {
node.declarations.forEach(elem => {
node.declarations.forEach(function (elem) {
elem.isLift = true
})
}
Expand Down Expand Up @@ -143,7 +145,10 @@ function mark (ast) {
}
})
} else if (is(node, 'ClassDeclaration')) {
node.id.isVar = true
// 可能会存在匿名类的情况 export default class {} 此时 id 为 null
if (node.id) {
node.id.isVar = true
}
} else if (is(node, 'CatchClause')) {
if (is(node.param, 'Identifier')) {
node.param.isVar = true
Expand Down Expand Up @@ -173,7 +178,8 @@ function mark (ast) {
node.exported.isIgnore = true
node.local.isIgnore = true
}
}
},
fallback: 'iteration'
})
}

Expand Down Expand Up @@ -222,7 +228,8 @@ function scope (ast, parentAst) {
ast.vars = ast.vars || []
ast.vars.push(node.name)
}
}
},
fallback: 'iteration'
})
}

Expand Down
4 changes: 2 additions & 2 deletions packages/mip-sandbox/lib/keywords-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@ module.exports = function () {
{
name: 'createElement',
getter: function () {
return function (nodename) {
return function (nodename, options) {
if (typeof nodename === 'string' && nodename.toLowerCase() === 'script') {
console.error('[MIP] 禁止创建 SCRIPT 标签引入第三方 JS 脚本')
}
return document.createElement(nodename)
return document.createElement(nodename, options)
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/mip-sandbox/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/mip-sandbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mip-sandbox",
"version": "1.1.3",
"version": "1.1.6",
"description": "sandbox tools for MIP project",
"main": "lib/sandbox.js",
"scripts": {
Expand Down
Loading

0 comments on commit b83fd0b

Please sign in to comment.