Socket
Socket
Sign inDemoInstall

babel-plugin-vtex-render-route

Package Overview
Dependencies
14
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-vtex-render-route

A babel plugin for extracting VTEX Render route information from a component


Version published
Maintainers
1
Install size
4.60 MB
Created

Readme

Source

babel-plugin-vtex-render-route

A babel plugin for extracting VTEX Render route information from a component

What?

If you write the following:

import route from 'vtex.renderjs/route.js'

// Your React component code here
// Let's call this component 'Home'

export default route('home', '/')(Home)

It will extract the information on the parameters provided for the route function and append it to the babel's file metadata property. With the example above it would create something like this:

file {
  metadata {
    // Various babel's properties
    vtexRender {
      route {
        name: 'home',
        path: '/'
      }
    }
  }
}

How?

For the extraction to be succesful it depends on some rules:

  • You must make a default import from vtex.renderjs/route.js
  • The arguments given for the imported function must be string literals, for now we're not accepting variables or expressions

That's it! The name of the function isn't fixed, sou you're not required to use the name route (as written on our example).

Why?

This plugin is intended to be used in conjunction with gulp-vtex-render on the VTEX Toolbelt. Together they're able to extract route information on build time for the VTEX Render framework.

Keywords

FAQs

Last updated on 07 Jul 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc