代码拉取完成,页面将自动刷新
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = plugin;
function plugin(targets, nodeTypes, detect) {
class Plugin {
constructor(result) {
this.nodes = [];
this.result = result;
this.targets = targets;
this.nodeTypes = nodeTypes;
}
push(node, metadata) {
node._stylehacks = Object.assign({}, metadata, {
message: `Bad ${metadata.identifier}: ${metadata.hack}`,
browsers: this.targets
});
this.nodes.push(node);
}
any(node) {
if (~this.nodeTypes.indexOf(node.type)) {
detect.apply(this, arguments);
return !!node._stylehacks;
}
return false;
}
detectAndResolve(...args) {
this.nodes = [];
detect.apply(this, args);
return this.resolve();
}
detectAndWarn(...args) {
this.nodes = [];
detect.apply(this, args);
return this.warn();
}
resolve() {
return this.nodes.forEach(node => node.remove());
}
warn() {
return this.nodes.forEach(node => {
const { message, browsers, identifier, hack } = node._stylehacks;
return node.warn(this.result, message, { browsers, identifier, hack });
});
}
}
return Plugin;
}
module.exports = exports["default"];
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。