JSPM

babel-file

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1894
    • Score
      100M100P100Q150886F
    • License MIT

    Easily create a Babel File object

    Package Exports

    • babel-file

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    babel-file

    Easily create a Babel File object

    • Constructs File object
    • Adds/parses code with nice errors
    import createFile from 'babel-file';
    import createBabylonOptions from 'babylon-options';
    
    const file = createFile(code, {
      filename: 'filename.js',
      parserOpts: createBabylonOptions({
        stage: 2,
      }),
    });
    
    file.code;
    file.ast;
    file.path;

    Accepts all the same options as the normal Babel File object.