Giter Club home page Giter Club logo

babel-plugin-dedupe-string-literals's People

Contributors

hzoo avatar mathiasbynens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

babel-plugin-dedupe-string-literals's Issues

Improve performance?

Understandably this tool is slow for large files such as https://raw.githubusercontent.com/mathiasbynens/unicode-8.0.0/15228776965be9ef1af995403b7d47386607318c/bidi-classes/index.js (over 6 MB).

One idea is to use a Map rather than a plain object for the cache, which should result in faster lookups.

Of course, this assumes the Map usage isn’t transpiled away before publishing to npm. (Node.js v0.12.14+ supports Map; personally I only care about Node.js v6 support since that’s what I use in my build environment.)

Add an 'ignore' option

When using dedupe-string-literals with webpack and babel-loader, we don't want strings passed to require.ensure() or require() to be deduped. Having another option that we could pass into this plugin would us specify strings that we do not want deduped.

plugins: [
    ['dedupe-string-literals', {
        minimumStringLength: 2,
        ignore: ['polyfills/x', 'modules/chunk']
    }]
]

Account for different parentPaths

It's hardcoded for 2 cases

['a','a'] - ExpressionStatement, ArrayExpression in the body
var a = ['a','a'] - VariableDeclaration, VariableDeclarator, ArrayExpression.

Needs to traverse parents to some level where a VariableDeclaration is possible - basically the closest parent function scope?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.