Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cube-babel

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cube-babel - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

25

index.js
'use strict';
const path = require('path');
const babelCore = require('babel-core');

@@ -12,2 +13,22 @@ const _ = require('lodash');

function importPlugin(nameString) {
let plugin = null;
if (/^\//.test(nameString)) {
// absolute import
const pluginPath = nameString.slice(1);
plugin = require(__dirname, '../..', pluginPath);
} else if (/^(\.\/|\.\.\/)/.test(nameString)) {
// relative import
plugin = require(__dirname, '../..', nameString);
} else if (/^(babel-plugin-|@\w+\/babel-plugin-)/.test(nameString)) {
// full-name or with scope
plugin = require(nameString);
} else {
// shorthand
plugin = require('babel-plugin-' + nameString)
}
// 部分插件导出 { default: [Function] } 形式
return plugin.default ? plugin.default : plugin;
}
class BabelProcessor {

@@ -60,5 +81,5 @@ constructor(cube, config) {

if (Array.isArray(v) && typeof v[0] === 'string') {
v[0] = require('babel-plugin-transform-' + v[0]);
v[0] = importPlugin(v[0]);
} else if (typeof v === 'string') {
a[i] = require('babel-plugin-transform-' + v);
a[i] = importPlugin(v);
}

@@ -65,0 +86,0 @@ });

2

package.json
{
"name": "cube-babel",
"version": "0.0.5",
"version": "0.0.6",
"description": "cube babel processor",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,16 +16,3 @@ cube-babel

{
presets: [
'react',
[
'env',
{
"targets": {
"browsers": [
"chrome >= 50",
"safari >= 7"
]
}
}
]
],
presets: [['es2015']],
plugins: [

@@ -41,3 +28,1 @@ ['${plugin-name}', {/** ${config} **/}]

更多配置,请参考babel文档 http://babeljs.io/docs/plugins/#official-presets
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