@babel/core
Advanced tools
Comparing version 7.25.9 to 7.26.0
@@ -139,3 +139,3 @@ "use strict"; | ||
const ignoreDir = _path().dirname(filepath); | ||
const ignorePatterns = content.split("\n").map(line => line.replace(/#.*$/, "").trim()).filter(line => !!line); | ||
const ignorePatterns = content.split("\n").map(line => line.replace(/#.*$/, "").trim()).filter(Boolean); | ||
for (const pattern of ignorePatterns) { | ||
@@ -142,0 +142,0 @@ if (pattern[0] === "!") { |
@@ -68,3 +68,3 @@ "use strict"; | ||
var _loadMjsFromPath = _asyncToGenerator(function* (filepath) { | ||
const url = (0, _url().pathToFileURL)(filepath).toString(); | ||
const url = (0, _url().pathToFileURL)(filepath).toString() + "?import"; | ||
{ | ||
@@ -83,2 +83,3 @@ if (!import_) { | ||
const SUPPORTED_EXTENSIONS = new Set([".js", ".mjs", ".cjs", ".cts"]); | ||
const asyncModules = new Set(); | ||
function* loadCodeDefault(filepath, loader, esmError, tlaError) { | ||
@@ -107,7 +108,9 @@ var _async2; | ||
} catch (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") { | ||
if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) { | ||
var _async; | ||
asyncModules.add(filepath); | ||
if (!((_async = async) != null ? _async : async = yield* (0, _async3.isAsync)())) { | ||
throw new _configError.default(tlaError, filepath); | ||
} | ||
} else if (e.code === "ERR_REQUIRE_ESM" || ext === ".mjs") {} else { | ||
throw e; | ||
@@ -114,0 +117,0 @@ } |
@@ -238,5 +238,5 @@ "use strict"; | ||
}); | ||
plugin.pre = chain(inherits.pre, plugin.pre); | ||
plugin.post = chain(inherits.post, plugin.post); | ||
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions); | ||
plugin.pre = chainMaybeAsync(inherits.pre, plugin.pre); | ||
plugin.post = chainMaybeAsync(inherits.post, plugin.post); | ||
plugin.manipulateOptions = chainMaybeAsync(inherits.manipulateOptions, plugin.manipulateOptions); | ||
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]); | ||
@@ -300,9 +300,11 @@ if (inherits.externalDependencies.length > 0) { | ||
} | ||
function chain(a, b) { | ||
const fns = [a, b].filter(Boolean); | ||
if (fns.length <= 1) return fns[0]; | ||
function chainMaybeAsync(a, b) { | ||
if (!a) return b; | ||
if (!b) return a; | ||
return function (...args) { | ||
for (const fn of fns) { | ||
fn.apply(this, args); | ||
const res = a.apply(this, args); | ||
if (res && typeof res.then === "function") { | ||
return res.then(() => b.apply(this, args)); | ||
} | ||
return b.apply(this, args); | ||
}; | ||
@@ -309,0 +311,0 @@ } |
@@ -216,3 +216,3 @@ "use strict"; | ||
; | ||
const version = exports.version = "7.25.9"; | ||
const version = exports.version = "7.26.0"; | ||
const resolvePlugin = (name, dirname) => resolvers.resolvePlugin(name, dirname, false).filepath; | ||
@@ -219,0 +219,0 @@ exports.resolvePlugin = resolvePlugin; |
@@ -90,8 +90,2 @@ "use strict"; | ||
}, | ||
importAttributes: { | ||
syntax: { | ||
name: "@babel/plugin-syntax-import-attributes", | ||
url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-attributes" | ||
} | ||
}, | ||
pipelineOperator: { | ||
@@ -208,2 +202,8 @@ syntax: { | ||
}, | ||
importAttributes: { | ||
syntax: { | ||
name: "@babel/plugin-syntax-import-attributes", | ||
url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-attributes" | ||
} | ||
}, | ||
importMeta: { | ||
@@ -210,0 +210,0 @@ syntax: { |
@@ -20,2 +20,3 @@ "use strict"; | ||
var _deepArray = require("../config/helpers/deep-array.js"); | ||
var _async = require("../gensync-utils/async.js"); | ||
function* run(config, code, ast) { | ||
@@ -61,2 +62,3 @@ const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); | ||
function* transformFile(file, pluginPasses) { | ||
const async = yield* (0, _async.isAsync)(); | ||
for (const pluginPairs of pluginPasses) { | ||
@@ -67,3 +69,3 @@ const passPairs = []; | ||
for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) { | ||
const pass = new _pluginPass.default(file, plugin.key, plugin.options); | ||
const pass = new _pluginPass.default(file, plugin.key, plugin.options, async); | ||
passPairs.push([plugin, pass]); | ||
@@ -74,9 +76,5 @@ passes.push(pass); | ||
for (const [plugin, pass] of passPairs) { | ||
const fn = plugin.pre; | ||
if (fn) { | ||
const result = fn.call(pass, file); | ||
yield* []; | ||
if (isThenable(result)) { | ||
throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); | ||
} | ||
if (plugin.pre) { | ||
const fn = (0, _async.maybeAsync)(plugin.pre, `You appear to be using an async plugin/preset, but Babel has been called synchronously`); | ||
yield* fn.call(pass, file); | ||
} | ||
@@ -89,9 +87,5 @@ } | ||
for (const [plugin, pass] of passPairs) { | ||
const fn = plugin.post; | ||
if (fn) { | ||
const result = fn.call(pass, file); | ||
yield* []; | ||
if (isThenable(result)) { | ||
throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); | ||
} | ||
if (plugin.post) { | ||
const fn = (0, _async.maybeAsync)(plugin.post, `You appear to be using an async plugin/preset, but Babel has been called synchronously`); | ||
yield* fn.call(pass, file); | ||
} | ||
@@ -101,7 +95,4 @@ } | ||
} | ||
function isThenable(val) { | ||
return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; | ||
} | ||
0 && 0; | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
class PluginPass { | ||
constructor(file, key, options) { | ||
constructor(file, key, options, isAsync) { | ||
this._map = new Map(); | ||
@@ -16,2 +16,3 @@ this.key = void 0; | ||
this.filename = void 0; | ||
this.isAsync = void 0; | ||
this.key = key; | ||
@@ -22,2 +23,3 @@ this.file = file; | ||
this.filename = file.opts.filename; | ||
this.isAsync = isAsync; | ||
} | ||
@@ -24,0 +26,0 @@ set(key, val) { |
{ | ||
"name": "@babel/core", | ||
"version": "7.25.9", | ||
"version": "7.26.0", | ||
"description": "Babel compiler core.", | ||
@@ -50,11 +50,11 @@ "main": "./lib/index.js", | ||
"@ampproject/remapping": "^2.2.0", | ||
"@babel/code-frame": "^7.25.9", | ||
"@babel/generator": "^7.25.9", | ||
"@babel/code-frame": "^7.26.0", | ||
"@babel/generator": "^7.26.0", | ||
"@babel/helper-compilation-targets": "^7.25.9", | ||
"@babel/helper-module-transforms": "^7.25.9", | ||
"@babel/helpers": "^7.25.9", | ||
"@babel/parser": "^7.25.9", | ||
"@babel/helper-module-transforms": "^7.26.0", | ||
"@babel/helpers": "^7.26.0", | ||
"@babel/parser": "^7.26.0", | ||
"@babel/template": "^7.25.9", | ||
"@babel/traverse": "^7.25.9", | ||
"@babel/types": "^7.25.9", | ||
"@babel/types": "^7.26.0", | ||
"convert-source-map": "^2.0.0", | ||
@@ -67,8 +67,8 @@ "debug": "^4.1.0", | ||
"devDependencies": { | ||
"@babel/helper-transform-fixture-test-runner": "^7.25.9", | ||
"@babel/plugin-syntax-flow": "^7.25.9", | ||
"@babel/helper-transform-fixture-test-runner": "^7.26.0", | ||
"@babel/plugin-syntax-flow": "^7.26.0", | ||
"@babel/plugin-transform-flow-strip-types": "^7.25.9", | ||
"@babel/plugin-transform-modules-commonjs": "^7.25.9", | ||
"@babel/preset-env": "^7.25.9", | ||
"@babel/preset-typescript": "^7.25.9", | ||
"@babel/preset-env": "^7.26.0", | ||
"@babel/preset-typescript": "^7.26.0", | ||
"@jridgewell/trace-mapping": "^0.3.25", | ||
@@ -75,0 +75,0 @@ "@types/convert-source-map": "^2.0.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
793607
6926
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/compat-data@7.26.2(transitive)
+ Added@babel/generator@7.26.2(transitive)
+ Added@babel/parser@7.26.2(transitive)
+ Addedcaniuse-lite@1.0.30001676(transitive)
+ Addedelectron-to-chromium@1.5.50(transitive)
- Removed@babel/code-frame@7.26.0(transitive)
- Removed@babel/compat-data@7.26.0(transitive)
- Removed@babel/generator@7.26.0(transitive)
- Removed@babel/parser@7.26.1(transitive)
- Removedcaniuse-lite@1.0.30001674(transitive)
- Removedelectron-to-chromium@1.5.49(transitive)
Updated@babel/code-frame@^7.26.0
Updated@babel/generator@^7.26.0
Updated@babel/helpers@^7.26.0
Updated@babel/parser@^7.26.0
Updated@babel/types@^7.26.0