gavinjoyce / babel-plugin-remove-functions Goto Github PK
View Code? Open in Web Editor NEWRemove function based on configuration
License: MIT License
Remove function based on configuration
License: MIT License
Perhaps babel-plugin-remove-call-expressions
?
This addon supports simple destructuring but doesn't yet support nested destructuring such as:
const { run: { later }} = Ember;
I'm not sure that this type of destructuring is good practice, it seems pretty unreadable to me. I also haven't yet come across an ember app which uses this form. Also, the main motivation for this plugin to address ember-cli/rfcs#50 which doesn't include any nested functions.
Input:
const {
assert,
deprecate
} = Ember;
deprecate('message', test);
assert('message', test);
console.log(message);
Expected output:
console.log(message);
(though I don't really think we care if we leave the destructuring around)
Babel 6's API is dramatically different, do you plan to make this plugin compatible?
WIP here to give you some idea of the required changes: paddyobrien@d2a077c
We're appending to callPathsToRemove
without clearing when we start processing a new file.
Performance wasn't considered for the initial implementation of this. We should make changes so that the babel plugin does as little work as possible on files which don't have anything to strip
with the config:
{
removals: [
{
global: 'Ember',
paths: [
'deprecate' //Ember.deprecate will be removed
]
}]
}
The following code:
console.log('hi there');
Ember.deprecate('this will be removed', test);
deprecate('this will NOT be removed', test);
should become:
console.log('hi there');
deprecate('this will NOT be removed', test);
``
We currently support removing functions that are imported as follows:
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
console.log('didInsertElement');
Ember.debug('didInsertElement'); //will be removed
}
});
Do we need to support other types of import? eg:
import { debug } from 'ember'?
Should we handle global uses of Ember
too?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.