Skip to content

Commit

Permalink
Remove legacy implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed Jun 29, 2022
1 parent 60a59e0 commit 50a68fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
26 changes: 1 addition & 25 deletions htmlbars-plugins/v-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,6 @@ var plugin = function ({ syntax }) {
};
};

// Legacy implementation
function VGet(options) {
this.options = options;
this.syntax = null; // set by HTMLBars
}

VGet.prototype.transform = function (ast) {
var context = this;
var walker = new this.syntax.Walker();

walker.visit(ast, function (node) {
let validNodeTypes = ['BlockStatement', 'MustacheStatement', 'ElementNode'];

if (validNodeTypes.indexOf(node.type) > -1) {
processNode(node, context.syntax);
}
});

return ast;
};

function processNode(node, syntax) {
var type = node.type;
node = unwrapNode(node);
Expand Down Expand Up @@ -227,7 +206,4 @@ function unwrapNode(node) {
}
}

module.exports = {
plugin: plugin,
legacy: VGet,
};
module.exports = plugin;
20 changes: 8 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@ module.exports = {
name: require('./package').name,

setupPreprocessorRegistry: function (type, registry) {
const plugin = this._buildPlugin();

plugin.parallelBabel = {
requireFile: __filename,
buildUsing: '_buildPlugin',
params: {},
};

registry.add('htmlbars-ast-plugin', plugin);
registry.add('htmlbars-ast-plugin', this._buildPlugin());
},

_buildPlugin() {
// We may need to use VGet.legacy for older versions
const VGet = require('./htmlbars-plugins/v-get');
const vGetPlugin = require('./htmlbars-plugins/v-get');

return {
name: 'v-get',
plugin: VGet.plugin,
baseDir: function () {
return __dirname;
},
parallelBabel: {
requireFile: __filename,
buildUsing: '_buildPlugin',
params: {},
},
plugin: vGetPlugin,
};
},
};

0 comments on commit 50a68fc

Please sign in to comment.