Socket
Socket
Sign inDemoInstall

@babel/core

Package Overview
Dependencies
Maintainers
4
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/core - npm Package Compare versions

Comparing version 7.0.1 to 7.1.0

4

lib/config/config-chain.js

@@ -111,3 +111,3 @@ "use strict";

config: babelrcFile
} = (0, _files.findRelativeConfig)(pkgData, context.envName));
} = (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));

@@ -342,3 +342,3 @@ if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {

if (options.sourceMap) {
if (options.hasOwnProperty("sourceMap")) {
options.sourceMaps = options.sourceMap;

@@ -345,0 +345,0 @@ delete options.sourceMap;

@@ -6,2 +6,3 @@ "use strict";

});
exports.findConfigUpwards = findConfigUpwards;
exports.findRelativeConfig = findRelativeConfig;

@@ -77,2 +78,19 @@ exports.findRootConfig = findRootConfig;

function findConfigUpwards(rootDir) {
let dirname = rootDir;
while (true) {
if (_fs().default.existsSync(_path().default.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
return dirname;
}
const nextDir = _path().default.dirname(dirname);
if (dirname === nextDir) break;
dirname = nextDir;
}
return null;
}
function findRelativeConfig(packageData, envName, caller) {

@@ -79,0 +97,0 @@ let config = null;

@@ -6,2 +6,3 @@ "use strict";

});
exports.findConfigUpwards = findConfigUpwards;
exports.findPackageData = findPackageData;

@@ -16,2 +17,6 @@ exports.findRelativeConfig = findRelativeConfig;

function findConfigUpwards(rootDir) {
return null;
}
function findPackageData(filepath) {

@@ -18,0 +23,0 @@ return {

@@ -12,2 +12,8 @@ "use strict";

});
Object.defineProperty(exports, "findConfigUpwards", {
enumerable: true,
get: function () {
return _configuration.findConfigUpwards;
}
});
Object.defineProperty(exports, "findRelativeConfig", {

@@ -14,0 +20,0 @@ enumerable: true,

@@ -31,4 +31,32 @@ "use strict";

var _files = require("./files");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveRootMode(rootDir, rootMode) {
switch (rootMode) {
case "root":
return rootDir;
case "upward-optional":
{
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
return upwardRootDir === null ? rootDir : upwardRootDir;
}
case "upward":
{
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
if (upwardRootDir !== null) return upwardRootDir;
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}"`), {
code: "BABEL_ROOT_NOT_FOUND",
dirname: rootDir
});
}
default:
throw new Error(`Assertion failure - unknown rootMode value`);
}
}
function loadPrivatePartialConfig(inputOpts) {

@@ -44,2 +72,3 @@ if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {

root: rootDir = ".",
rootMode = "root",
caller

@@ -50,4 +79,3 @@ } = args;

const absoluteRootDir = _path().default.resolve(absoluteCwd, rootDir);
const absoluteRootDir = resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
const context = {

@@ -54,0 +82,0 @@ filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined,

@@ -8,2 +8,3 @@ "use strict";

exports.access = access;
exports.assertRootMode = assertRootMode;
exports.assertSourceMaps = assertSourceMaps;

@@ -55,2 +56,10 @@ exports.assertCompact = assertCompact;

function assertRootMode(loc, value) {
if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") {
throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`);
}
return value;
}
function assertSourceMaps(loc, value) {

@@ -57,0 +66,0 @@ if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {

@@ -19,2 +19,3 @@ "use strict";

root: _optionAssertions.assertString,
rootMode: _optionAssertions.assertRootMode,
configFile: _optionAssertions.assertConfigFileSearch,

@@ -21,0 +22,0 @@ caller: _optionAssertions.assertCallerMetadata,

@@ -186,4 +186,5 @@ "use strict";

if (typeof versionRange !== "string") return true;
if (_semver().default.valid(versionRange)) versionRange = `^${versionRange}`;
return typeof versionRange !== "string" || !_semver().default.intersects(`<${minVersion}`, versionRange) && !_semver().default.intersects(`>=8.0.0`, versionRange);
return !_semver().default.intersects(`<${minVersion}`, versionRange) && !_semver().default.intersects(`>=8.0.0`, versionRange);
}

@@ -190,0 +191,0 @@

{
"name": "@babel/core",
"version": "7.0.1",
"version": "7.1.0",
"description": "Babel compiler core.",

@@ -9,2 +9,5 @@ "main": "lib/index.js",

"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": "https://github.com/babel/babel/tree/master/packages/babel-core",

@@ -36,6 +39,6 @@ "keywords": [

"@babel/generator": "^7.0.0",
"@babel/helpers": "^7.0.0",
"@babel/parser": "^7.0.0",
"@babel/template": "^7.0.0",
"@babel/traverse": "^7.0.0",
"@babel/helpers": "^7.1.0",
"@babel/parser": "^7.1.0",
"@babel/template": "^7.1.0",
"@babel/traverse": "^7.1.0",
"@babel/types": "^7.0.0",

@@ -42,0 +45,0 @@ "convert-source-map": "^1.1.0",

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