Socket
Socket
Sign inDemoInstall

@babel/core

Package Overview
Dependencies
Maintainers
4
Versions
193
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.25.2 to 7.25.7

tsconfig.json

5

lib/config/files/configuration.js

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

var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
var _async = require("../../gensync-utils/async.js");
const debug = _debug()("babel:config:loading:files:configuration");

@@ -69,3 +70,3 @@ const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts"];

if (!_fs().existsSync(filepath)) return null;
let options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously.");
let options = yield* (0, _moduleTypes.default)(filepath, (yield* (0, _async.isAsync)()) ? "auto" : "require", "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", "You appear to be using a configuration file that contains top-level " + "await, which is only supported when running Babel asynchronously.");
let cacheNeedsConfiguration = false;

@@ -107,3 +108,3 @@ if (typeof options === "function") {

const babel = file.options["babel"];
if (typeof babel === "undefined") return null;
if (babel === undefined) return null;
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {

@@ -110,0 +111,0 @@ throw new _configError.default(`.babel property must be an object`, file.filepath);

62

lib/config/files/module-types.js

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

exports.supportsESM = void 0;
var _async = require("../../gensync-utils/async.js");
var _async3 = require("../../gensync-utils/async.js");
function _path() {

@@ -41,4 +41,4 @@ const data = require("path");

var _transformFile = require("../../transform-file.js");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
const debug = _debug()("babel:config:loading:files:module-types");

@@ -65,8 +65,7 @@ {

{
var _module;
return (_module = module) != null && _module.__esModule ? module.default || (arguments[1] ? module : undefined) : module;
return module != null && (module.__esModule || module[Symbol.toStringTag] === "Module") ? module.default || (arguments[1] ? module : undefined) : module;
}
}
const loadMjsDefault = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
var _loadMjsDefault = _asyncToGenerator(function* (filepath) {
const loadMjsFromPath = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
var _loadMjsFromPath = _asyncToGenerator(function* (filepath) {
const url = (0, _url().pathToFileURL)(filepath).toString();

@@ -77,21 +76,29 @@ {

}
return (yield import_(url)).default;
return yield import_(url);
}
});
function loadMjsDefault(_x) {
return _loadMjsDefault.apply(this, arguments);
function loadMjsFromPath(_x) {
return _loadMjsFromPath.apply(this, arguments);
}
return loadMjsDefault;
return loadMjsFromPath;
}());
function* loadCodeDefault(filepath, asyncError) {
switch (_path().extname(filepath)) {
case ".cjs":
const SUPPORTED_EXTENSIONS = new Set([".js", ".mjs", ".cjs", ".cts"]);
function* loadCodeDefault(filepath, loader, esmError, tlaError) {
var _async2;
let async;
let ext = _path().extname(filepath);
if (!SUPPORTED_EXTENSIONS.has(ext)) ext = ".js";
const pattern = `${loader} ${ext}`;
switch (pattern) {
case "require .cjs":
case "auto .cjs":
{
return loadCjsDefault(filepath, arguments[2]);
}
case ".mjs":
break;
case ".cts":
case "require .cts":
case "auto .cts":
return loadCtsDefault(filepath);
default:
case "auto .js":
case "require .js":
case "require .mjs":
try {

@@ -102,9 +109,18 @@ {

} catch (e) {
if (e.code !== "ERR_REQUIRE_ESM") throw e;
var _async;
if (e.code === "ERR_REQUIRE_ASYNC_MODULE" && !((_async = async) != null ? _async : async = yield* (0, _async3.isAsync)())) {
throw new _configError.default(tlaError, filepath);
}
if (e.code !== "ERR_REQUIRE_ESM" && ext !== ".mjs") {
throw e;
}
}
case "auto .mjs":
if ((_async2 = async) != null ? _async2 : async = yield* (0, _async3.isAsync)()) {
return (yield* (0, _async3.waitFor)(loadMjsFromPath(filepath))).default;
}
throw new _configError.default(esmError, filepath);
default:
throw new Error("Internal Babel error: unreachable code.");
}
if (yield* (0, _async.isAsync)()) {
return yield* (0, _async.waitFor)(loadMjsDefault(filepath));
}
throw new _configError.default(asyncError, filepath);
}

@@ -111,0 +127,0 @@ function loadCtsDefault(filepath) {

@@ -52,4 +52,7 @@ "use strict";

function* loadPlugin(name, dirname) {
const filepath = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
const value = yield* requireModule("plugin", filepath);
const {
filepath,
loader
} = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
const value = yield* requireModule("plugin", loader, filepath);
debug("Loaded plugin %o from %o.", name, dirname);

@@ -62,4 +65,7 @@ return {

function* loadPreset(name, dirname) {
const filepath = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
const value = yield* requireModule("preset", filepath);
const {
filepath,
loader
} = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
const value = yield* requireModule("preset", loader, filepath);
debug("Loaded preset %o from %o.", name, dirname);

@@ -159,3 +165,6 @@ return {

}
return res.value;
return {
loader: "require",
filepath: res.value
};
}

@@ -169,6 +178,9 @@ function resolveStandardizedNameForImport(type, name, dirname) {

}
return (0, _url().fileURLToPath)(res.value);
return {
loader: "auto",
filepath: (0, _url().fileURLToPath)(res.value)
};
}
function resolveStandardizedName(type, name, dirname, resolveESM) {
if (!_moduleTypes.supportsESM || !resolveESM) {
function resolveStandardizedName(type, name, dirname, allowAsync) {
if (!_moduleTypes.supportsESM || !allowAsync) {
return resolveStandardizedNameForRequire(type, name, dirname);

@@ -178,3 +190,3 @@ }

const resolved = resolveStandardizedNameForImport(type, name, dirname);
if (!(0, _fs().existsSync)(resolved)) {
if (!(0, _fs().existsSync)(resolved.filepath)) {
throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname}.`), {

@@ -198,3 +210,3 @@ type: "MODULE_NOT_FOUND"

}
function* requireModule(type, name) {
function* requireModule(type, loader, name) {
{

@@ -210,3 +222,3 @@ if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) {

{
return yield* (0, _moduleTypes.default)(name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", true);
return yield* (0, _moduleTypes.default)(name, loader, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", `You appear to be using a ${type} that contains top-level await, ` + "which is only supported when running Babel asynchronously.", true);
}

@@ -213,0 +225,0 @@ } catch (err) {

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

const env = value => cache.using(data => {
if (typeof value === "undefined") return data.envName;
if (value === undefined) return data.envName;
if (typeof value === "function") {

@@ -23,0 +23,0 @@ return (0, _caching.assertSimpleType)(value(data.envName));

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

const _excluded = ["showIgnoredFiles"];
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
function resolveRootMode(rootDir, rootMode) {

@@ -27,0 +27,0 @@ switch (rootMode) {

@@ -18,4 +18,4 @@ "use strict";

}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
const runGenerator = _gensync()(function* (item) {

@@ -22,0 +22,0 @@ return yield* item;

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

;
const version = exports.version = "7.25.2";
const version = exports.version = "7.25.7";
const DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);

@@ -230,0 +230,0 @@ ;

{
"name": "@babel/core",
"version": "7.25.2",
"version": "7.25.7",
"description": "Babel compiler core.",

@@ -50,11 +50,11 @@ "main": "./lib/index.js",

"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.24.7",
"@babel/generator": "^7.25.0",
"@babel/helper-compilation-targets": "^7.25.2",
"@babel/helper-module-transforms": "^7.25.2",
"@babel/helpers": "^7.25.0",
"@babel/parser": "^7.25.0",
"@babel/template": "^7.25.0",
"@babel/traverse": "^7.25.2",
"@babel/types": "^7.25.2",
"@babel/code-frame": "^7.25.7",
"@babel/generator": "^7.25.7",
"@babel/helper-compilation-targets": "^7.25.7",
"@babel/helper-module-transforms": "^7.25.7",
"@babel/helpers": "^7.25.7",
"@babel/parser": "^7.25.7",
"@babel/template": "^7.25.7",
"@babel/traverse": "^7.25.7",
"@babel/types": "^7.25.7",
"convert-source-map": "^2.0.0",

@@ -67,8 +67,8 @@ "debug": "^4.1.0",

"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.25.2",
"@babel/plugin-syntax-flow": "^7.24.7",
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/preset-env": "^7.25.2",
"@babel/preset-typescript": "^7.24.7",
"@babel/helper-transform-fixture-test-runner": "^7.25.7",
"@babel/plugin-syntax-flow": "^7.25.7",
"@babel/plugin-transform-flow-strip-types": "^7.25.7",
"@babel/plugin-transform-modules-commonjs": "^7.25.7",
"@babel/preset-env": "^7.25.7",
"@babel/preset-typescript": "^7.25.7",
"@jridgewell/trace-mapping": "^0.3.25",

@@ -75,0 +75,0 @@ "@types/convert-source-map": "^2.0.0",

@@ -77,4 +77,8 @@ import type { Handler } from "gensync";

type Resolved =
| { loader: "require"; filepath: string }
| { loader: "import"; filepath: string };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePlugin(name: string, dirname: string): string | null {
export function resolvePlugin(name: string, dirname: string): Resolved | null {
return null;

@@ -84,3 +88,3 @@ }

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePreset(name: string, dirname: string): string | null {
export function resolvePreset(name: string, dirname: string): Resolved | null {
return null;

@@ -87,0 +91,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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