Skip to content

1.0.0-beta29

Pre-release
Pre-release
Compare
Choose a tag to compare
@karellm karellm released this 17 Sep 18:27
· 902 commits to master since this release

This release introduce breaking changes. If you rely on advanced Javascript features, you might need to include manually the plugins you need. The point is to limit the number of dependencies of this project.

If you used to do something like:

acorn: {
  sourceType: 'module', 
  ecmaVersion: 9, // forward compatibility
  plugins: {
    es7: true, // some es7 parsing that's not yet in acorn (decorators)
    stage3: true // load some stage3 configs not yet in a version
  }
}

You now must include the dependencies (via npm or yarn) and change the config file to:

// npm install or yarn add what you need and require them:
const injectAcornStaticClassPropertyInitializer = require('acorn-static-class-property-initializer/inject');
const injectAcornStage3 = require('acorn-stage3/inject');
const injectAcornEs7 = require('acorn-es7');

// ...
  js: [{
    lexer: 'JavascriptLexer'
    functions: ['t'], // Array of functions to match

    // acorn config (for more information on the acorn options, see here: https://github.com/acornjs/acorn#main-parser)
    acorn: {
      injectors: [
          injectAcornStaticClassPropertyInitializer,
          injectAcornStage3,
          injectAcornEs7,
        ],
      plugins: {
        // The presence of these plugin options is important -
        // without them, the plugins will be available but not
        // enabled.
        staticClassPropertyInitializer: true,
        stage3: true,
        es7: true,
      }
    }
  }],
// ...

All the options are well documented in the README.