Socket
Socket
Sign inDemoInstall

babel-file-loader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-file-loader

Load files into memory to be parsed & traversed using Babylon/Babel


Version published
Weekly downloads
1.1K
increased by17.39%
Maintainers
1
Weekly downloads
 
Created
Source

babel-file-loader

Load files into memory to be parsed & traversed using Babylon/Babel

import {loadImportSync} from 'babel-file-loader';

export function plugin() {
  return {
    visitor: {
      ImportDefaultDeclaration(path) {
        let file = loadImportSync(path);

        file.path.traverse({
          ExportDefaultDeclaration() {
            console.log('Found matching export default');
          },
        });
      },
    },
  },
};

API

resolveFilePath{Async,Sync}(path, filePath, resolveOpts)

Resolve a filePath relative to the file a path belongs to. Returns string.

resolveImportFilePath{Async,Sync}(path, resolveOpts)

Resolve an import declaration path to extract a file path. Returns string.

loadFile{Async,Sync}(filePath, parserOpts)

Load and parse a file from a filePath. Returns File.

loadImport{Async,Sync}(path, resolveOpts, parserOpts)

Load and parse a file from an import declaration path. Returns File.

FAQs

Package last updated on 08 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc