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

rollup-plugin-babel

Package Overview
Dependencies
Maintainers
10
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-babel - npm Package Compare versions

Comparing version 4.0.0-beta.8 to 4.0.0

44

dist/rollup-plugin-babel.cjs.js

@@ -103,2 +103,5 @@ 'use strict';

var regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
var escapeRegExpCharacters = function (str) { return str.replace(regExpCharactersRegExp, '\\$&'); };
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }

@@ -108,2 +111,3 @@

if ( ref === void 0 ) ref = {};
var extensions = ref.extensions; if ( extensions === void 0 ) extensions = core.DEFAULT_EXTENSIONS;
var sourcemap = ref.sourcemap; if ( sourcemap === void 0 ) sourcemap = true;

@@ -113,12 +117,30 @@ var sourcemaps = ref.sourcemaps; if ( sourcemaps === void 0 ) sourcemaps = true;

var sourceMaps = ref.sourceMaps; if ( sourceMaps === void 0 ) sourceMaps = true;
var rest$1 = objectWithoutProperties( ref, ["sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest$1 = objectWithoutProperties( ref, ["extensions", "sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest = rest$1;
return (Object.assign({}, {sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest));
return (Object.assign({}, {extensions: extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest,
{caller: Object.assign({}, {name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true},
rest.caller)}));
};
function babel ( options ) {
// TODO: remove it later, just provide a helpful warning to people for now
try {
core.loadPartialConfig({
caller: undefined,
babelrc: false,
configFile: false,
});
} catch (err) {
throw new Error('You should be using @babel/core@^7.0.0-rc.2. Please upgrade or pin rollup-plugin-babel to 4.0.0-beta.8');
}
var ref = unpackOptions(options);
var exclude = ref.exclude;
var extensions = ref.extensions;
var externalHelpers = ref.externalHelpers;

@@ -128,6 +150,8 @@ var externalHelpersWhitelist = ref.externalHelpersWhitelist;

var runtimeHelpers = ref.runtimeHelpers;
var rest = objectWithoutProperties( ref, ["exclude", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var rest = objectWithoutProperties( ref, ["exclude", "extensions", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var babelOptions = rest;
var filter = rollupPluginutils.createFilter( include, exclude );
var extensionRegExp = new RegExp(("(" + (extensions.map(escapeRegExpCharacters).join('|')) + ")$"));
var includeExcludeFilter = rollupPluginutils.createFilter( include, exclude );
var filter = function (id) { return extensionRegExp.test(id) && includeExcludeFilter(id); };
var preflightCheck = createPreflightCheck();

@@ -162,8 +186,8 @@

var localOpts = Object.assign({ filename: id }, babelOptions);
var localOpts = Object.assign({}, {filename: id},
babelOptions,
{plugins: helpers !== RUNTIME
? babelOptions.plugins.concat( [importHelperPlugin])
: babelOptions.plugins});
if ( helpers !== RUNTIME ) {
localOpts = Object.assign({}, localOpts, { plugins: (localOpts.plugins || []).concat(importHelperPlugin) });
}
var transformed = core.transform( code, localOpts );

@@ -170,0 +194,0 @@

import { join, dirname } from 'path';
import { transform, buildExternalHelpers } from '@babel/core';
import { transform, buildExternalHelpers, DEFAULT_EXTENSIONS, loadPartialConfig } from '@babel/core';
import { addNamed } from '@babel/helper-module-imports';

@@ -101,2 +101,5 @@ import { createFilter } from 'rollup-pluginutils';

var regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
var escapeRegExpCharacters = function (str) { return str.replace(regExpCharactersRegExp, '\\$&'); };
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }

@@ -106,2 +109,3 @@

if ( ref === void 0 ) ref = {};
var extensions = ref.extensions; if ( extensions === void 0 ) extensions = DEFAULT_EXTENSIONS;
var sourcemap = ref.sourcemap; if ( sourcemap === void 0 ) sourcemap = true;

@@ -111,12 +115,30 @@ var sourcemaps = ref.sourcemaps; if ( sourcemaps === void 0 ) sourcemaps = true;

var sourceMaps = ref.sourceMaps; if ( sourceMaps === void 0 ) sourceMaps = true;
var rest$1 = objectWithoutProperties( ref, ["sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest$1 = objectWithoutProperties( ref, ["extensions", "sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest = rest$1;
return (Object.assign({}, {sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest));
return (Object.assign({}, {extensions: extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest,
{caller: Object.assign({}, {name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true},
rest.caller)}));
};
function babel ( options ) {
// TODO: remove it later, just provide a helpful warning to people for now
try {
loadPartialConfig({
caller: undefined,
babelrc: false,
configFile: false,
});
} catch (err) {
throw new Error('You should be using @babel/core@^7.0.0-rc.2. Please upgrade or pin rollup-plugin-babel to 4.0.0-beta.8');
}
var ref = unpackOptions(options);
var exclude = ref.exclude;
var extensions = ref.extensions;
var externalHelpers = ref.externalHelpers;

@@ -126,6 +148,8 @@ var externalHelpersWhitelist = ref.externalHelpersWhitelist;

var runtimeHelpers = ref.runtimeHelpers;
var rest = objectWithoutProperties( ref, ["exclude", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var rest = objectWithoutProperties( ref, ["exclude", "extensions", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var babelOptions = rest;
var filter = createFilter( include, exclude );
var extensionRegExp = new RegExp(("(" + (extensions.map(escapeRegExpCharacters).join('|')) + ")$"));
var includeExcludeFilter = createFilter( include, exclude );
var filter = function (id) { return extensionRegExp.test(id) && includeExcludeFilter(id); };
var preflightCheck = createPreflightCheck();

@@ -160,8 +184,8 @@

var localOpts = Object.assign({ filename: id }, babelOptions);
var localOpts = Object.assign({}, {filename: id},
babelOptions,
{plugins: helpers !== RUNTIME
? babelOptions.plugins.concat( [importHelperPlugin])
: babelOptions.plugins});
if ( helpers !== RUNTIME ) {
localOpts = Object.assign({}, localOpts, { plugins: (localOpts.plugins || []).concat(importHelperPlugin) });
}
var transformed = transform( code, localOpts );

@@ -168,0 +192,0 @@

{
"name": "rollup-plugin-babel",
"version": "4.0.0-beta.8",
"version": "4.0.0",
"description": "Seamless integration between Rollup and Babel.",

@@ -33,19 +33,21 @@ "main": "dist/rollup-plugin-babel.cjs.js",

"dependencies": {
"@babel/helper-module-imports": "7.0.0-beta.56",
"@babel/helper-module-imports": "7.0.0-rc.2",
"rollup-pluginutils": "^2.3.0"
},
"peerDependencies": {
"@babel/core": "7 || ^7.0.0-beta"
"@babel/core": "7 || ^7.0.0-rc.2",
"rollup": "^0.60.0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.56",
"@babel/plugin-external-helpers": "7.0.0-beta.56",
"@babel/plugin-proposal-decorators": "7.0.0-beta.56",
"@babel/plugin-transform-runtime": "7.0.0-beta.56",
"@babel/preset-env": "7.0.0-beta.56",
"@babel/core": "7.0.0-rc.2",
"@babel/plugin-external-helpers": "7.0.0-rc.2",
"@babel/plugin-proposal-decorators": "7.0.0-rc.2",
"@babel/plugin-transform-runtime": "7.0.0-rc.2",
"@babel/preset-env": "7.0.0-rc.2",
"buble": "^0.19.3",
"eslint": "^5.0.1",
"mocha": "^5.2.0",
"rollup": "^0.62.0",
"rollup": "^0.64.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-json": "^3.0.0",
"source-map": "^0.6.1",

@@ -52,0 +54,0 @@ "source-map-support": "^0.5.6"

import { dirname } from 'path';
import { buildExternalHelpers, transform } from '@babel/core';
import { buildExternalHelpers, DEFAULT_EXTENSIONS, loadPartialConfig, transform } from '@babel/core';
import { createFilter } from 'rollup-pluginutils';
import createPreflightCheck from './preflightCheck.js';
import helperPlugin from './helperPlugin.js';
import { warnOnce } from './utils.js';
import { escapeRegExpCharacters, warnOnce } from './utils.js';
import { RUNTIME, EXTERNAL, HELPERS } from './constants.js';
const unpackOptions = ({
extensions = DEFAULT_EXTENSIONS,
// rollup uses sourcemap, babel uses sourceMaps

@@ -18,9 +19,29 @@ // just normalize them here so people don't have to worry about it

} = {}) => ({
extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps,
...rest
...rest,
caller: {
name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true,
...rest.caller,
}
});
export default function babel ( options ) {
// TODO: remove it later, just provide a helpful warning to people for now
try {
loadPartialConfig({
caller: undefined,
babelrc: false,
configFile: false,
});
} catch (err) {
throw new Error('You should be using @babel/core@^7.0.0-rc.2. Please upgrade or pin rollup-plugin-babel to 4.0.0-beta.8');
}
const {
exclude,
extensions,
externalHelpers,

@@ -33,3 +54,5 @@ externalHelpersWhitelist,

const filter = createFilter( include, exclude );
const extensionRegExp = new RegExp(`(${extensions.map(escapeRegExpCharacters).join('|')})$`);
const includeExcludeFilter = createFilter( include, exclude );
const filter = id => extensionRegExp.test(id) && includeExcludeFilter(id);
const preflightCheck = createPreflightCheck();

@@ -64,8 +87,10 @@

let localOpts = Object.assign({ filename: id }, babelOptions);
const localOpts = {
filename: id,
...babelOptions,
plugins: helpers !== RUNTIME
? [...babelOptions.plugins, helperPlugin]
: babelOptions.plugins,
};
if ( helpers !== RUNTIME ) {
localOpts = Object.assign({}, localOpts, { plugins: (localOpts.plugins || []).concat(helperPlugin) });
}
const transformed = transform( code, localOpts );

@@ -72,0 +97,0 @@

@@ -7,1 +7,4 @@ let warned = {};

}
const regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
export const escapeRegExpCharacters = str => str.replace(regExpCharactersRegExp, '\\$&');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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