Skip to content

Commit

Permalink
Remove babel plugins. Remove useless code optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromew committed Jun 13, 2020
1 parent cca9a97 commit 43e756b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 103 deletions.
93 changes: 0 additions & 93 deletions packages/pug-code-gen/babel-plugin-pug-concat.js

This file was deleted.

14 changes: 5 additions & 9 deletions packages/pug-code-gen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ var gen = require('babel-generator');
var babylon = require('babylon');
var babelTemplate = require('babel-template');
var babel = require('babel-core');
var babelPluginTransformWith = require('babel-plugin-transform-with');
var babelPluginPugConcat = require('./babel-plugin-pug-concat.js');

// This is used to prevent pretty printing inside certain tags
var WHITE_SPACE_SENSITIVE_TAGS = {
pre: true,
Expand Down Expand Up @@ -836,17 +835,14 @@ Compiler.prototype = {
, self = this;
var ast = [];

var bufferName = interpolated ? (tag.astExpr ? this.bufferAST(tag.astExpr) : this.bufferExpression(tag.expr)) : this.buffer(name);

/*
function bufferName() {
if (interpolated) {
if (tag.astExpr) return self.bufferAST(tag.astExpr);
return self.bufferExpression(tag.expr);
}
else return self.buffer(name);
}
*/

if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true) this.escapePrettyMode = true;

if (!this.hasCompiledTag) {
Expand All @@ -860,7 +856,7 @@ Compiler.prototype = {
push.apply(ast, this.prettyIndent(0, true));
if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) {
push.apply(ast, this.buffer('<'));
push.apply(ast, bufferName);
push.apply(ast, bufferName());
push.apply(ast, this.visitAttributes(tag.attrs, this.attributeBlocks(tag.attributeBlocks)));
if (this.terse && !tag.selfClosing) {
push.apply(ast, this.buffer('>'));
Expand Down Expand Up @@ -888,7 +884,7 @@ Compiler.prototype = {
} else {
// Optimize attributes buffering
push.apply(ast, this.buffer('<'));
push.apply(ast, bufferName);
push.apply(ast, bufferName());
push.apply(ast, this.visitAttributes(tag.attrs, this.attributeBlocks(tag.attributeBlocks)));
push.apply(ast, this.buffer('>'));
if (tag.code) push.apply(ast, this.visitCode(tag.code));
Expand All @@ -899,7 +895,7 @@ Compiler.prototype = {
push.apply(ast, this.prettyIndent(0, true));

push.apply(ast, this.buffer('</'));
push.apply(ast, bufferName);
push.apply(ast, bufferName());
push.apply(ast, this.buffer('>'));
}

Expand Down
1 change: 0 additions & 1 deletion packages/pug-code-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"dependencies": {
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-plugin-transform-with": "^1.0.0",
"babel-template": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
Expand Down

0 comments on commit 43e756b

Please sign in to comment.