1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1 1 184 184 184 184 183 183 1 | var b = require("acorn-ast-types").builders; module.exports = function (ast, file) { var body = ast.program.body; var first = body[0]; var noStrict = !first || first.type !== "ExpressionStatement" || first.expression.type !== "Literal" || first.expression.value !== "use strict"; if (noStrict) { Iif (file.opts._noStrict) return; body.unshift(b.expressionStatement(b.literal("use strict"))); } else { Iif (file.opts._noStrict) body.shift(); } }; |