@babel/core
Advanced tools
Comparing version 7.22.5 to 7.23.7
@@ -18,4 +18,4 @@ "use strict"; | ||
} | ||
var _async = require("../gensync-utils/async"); | ||
var _util = require("./util"); | ||
var _async = require("../gensync-utils/async.js"); | ||
var _util = require("./util.js"); | ||
const synchronize = gen => { | ||
@@ -22,0 +22,0 @@ return _gensync()(gen).sync; |
@@ -23,10 +23,10 @@ "use strict"; | ||
} | ||
var _options = require("./validation/options"); | ||
var _patternToRegex = require("./pattern-to-regex"); | ||
var _printer = require("./printer"); | ||
var _rewriteStackTrace = require("../errors/rewrite-stack-trace"); | ||
var _configError = require("../errors/config-error"); | ||
var _files = require("./files"); | ||
var _caching = require("./caching"); | ||
var _configDescriptors = require("./config-descriptors"); | ||
var _options = require("./validation/options.js"); | ||
var _patternToRegex = require("./pattern-to-regex.js"); | ||
var _printer = require("./printer.js"); | ||
var _rewriteStackTrace = require("../errors/rewrite-stack-trace.js"); | ||
var _configError = require("../errors/config-error.js"); | ||
var _index = require("./files/index.js"); | ||
var _caching = require("./caching.js"); | ||
var _configDescriptors = require("./config-descriptors.js"); | ||
const debug = _debug()("babel:config:config-chain"); | ||
@@ -43,3 +43,3 @@ function* buildPresetChain(arg, context) { | ||
} | ||
const buildPresetChainWalker = makeChainWalker({ | ||
const buildPresetChainWalker = exports.buildPresetChainWalker = makeChainWalker({ | ||
root: preset => loadPresetDescriptors(preset), | ||
@@ -51,3 +51,2 @@ env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName), | ||
}); | ||
exports.buildPresetChainWalker = buildPresetChainWalker; | ||
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors)); | ||
@@ -68,5 +67,5 @@ const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName))); | ||
if (typeof opts.configFile === "string") { | ||
configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); | ||
configFile = yield* (0, _index.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); | ||
} else if (opts.configFile !== false) { | ||
configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller); | ||
configFile = yield* (0, _index.findRootConfig)(context.root, context.envName, context.caller); | ||
} | ||
@@ -98,3 +97,3 @@ let { | ||
if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") { | ||
const pkgData = yield* (0, _files.findPackageData)(context.filename); | ||
const pkgData = yield* (0, _index.findPackageData)(context.filename); | ||
if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) { | ||
@@ -104,3 +103,3 @@ ({ | ||
config: babelrcFile | ||
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller)); | ||
} = yield* (0, _index.findRelativeConfig)(pkgData, context.envName, context.caller)); | ||
if (ignoreFile) { | ||
@@ -199,5 +198,3 @@ fileChain.files.add(ignoreFile.filepath); | ||
const chain = yield* loadFileChainWalker(input, context, files, baseLogger); | ||
if (chain) { | ||
chain.files.add(input.filepath); | ||
} | ||
chain == null || chain.files.add(input.filepath); | ||
return chain; | ||
@@ -236,3 +233,4 @@ } | ||
}, alias, descriptors, envName) { | ||
const opts = options.env && options.env[envName]; | ||
var _options$env; | ||
const opts = (_options$env = options.env) == null ? void 0 : _options$env[envName]; | ||
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null; | ||
@@ -244,3 +242,4 @@ } | ||
}, alias, descriptors, index) { | ||
const opts = options.overrides && options.overrides[index]; | ||
var _options$overrides; | ||
const opts = (_options$overrides = options.overrides) == null ? void 0 : _options$overrides[index]; | ||
if (!opts) throw new Error("Assertion failure - missing override"); | ||
@@ -253,5 +252,6 @@ return descriptors(dirname, opts, `${alias}.overrides[${index}]`); | ||
}, alias, descriptors, index, envName) { | ||
const override = options.overrides && options.overrides[index]; | ||
var _options$overrides2, _override$env; | ||
const override = (_options$overrides2 = options.overrides) == null ? void 0 : _options$overrides2[index]; | ||
if (!override) throw new Error("Assertion failure - missing override"); | ||
const opts = override.env && override.env[envName]; | ||
const opts = (_override$env = override.env) == null ? void 0 : _override$env[envName]; | ||
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null; | ||
@@ -333,3 +333,3 @@ } | ||
if (opts.extends === undefined) return true; | ||
const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller); | ||
const file = yield* (0, _index.loadConfig)(opts.extends, dirname, context.envName, context.caller); | ||
if (files.has(file)) { | ||
@@ -336,0 +336,0 @@ throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n")); |
@@ -16,9 +16,10 @@ "use strict"; | ||
} | ||
var _functional = require("../gensync-utils/functional"); | ||
var _files = require("./files"); | ||
var _item = require("./item"); | ||
var _caching = require("./caching"); | ||
var _resolveTargets = require("./resolve-targets"); | ||
var _functional = require("../gensync-utils/functional.js"); | ||
var _index = require("./files/index.js"); | ||
var _item = require("./item.js"); | ||
var _caching = require("./caching.js"); | ||
var _resolveTargets = require("./resolve-targets.js"); | ||
function isEqualDescriptor(a, b) { | ||
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved); | ||
var _a$file, _b$file, _a$file2, _b$file2; | ||
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && ((_a$file = a.file) == null ? void 0 : _a$file.request) === ((_b$file = b.file) == null ? void 0 : _b$file.request) && ((_a$file2 = a.file) == null ? void 0 : _a$file2.resolved) === ((_b$file2 = b.file) == null ? void 0 : _b$file2.resolved); | ||
} | ||
@@ -135,3 +136,3 @@ function* handlerOf(value) { | ||
} | ||
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset; | ||
const resolver = type === "plugin" ? _index.loadPlugin : _index.loadPreset; | ||
const request = value; | ||
@@ -138,0 +139,0 @@ ({ |
@@ -47,42 +47,30 @@ "use strict"; | ||
} | ||
var _caching = require("../caching"); | ||
var _configApi = require("../helpers/config-api"); | ||
var _utils = require("./utils"); | ||
var _moduleTypes = require("./module-types"); | ||
var _patternToRegex = require("../pattern-to-regex"); | ||
var _configError = require("../../errors/config-error"); | ||
var fs = require("../../gensync-utils/fs"); | ||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); | ||
var _caching = require("../caching.js"); | ||
var _configApi = require("../helpers/config-api.js"); | ||
var _utils = require("./utils.js"); | ||
var _moduleTypes = require("./module-types.js"); | ||
var _patternToRegex = require("../pattern-to-regex.js"); | ||
var _configError = require("../../errors/config-error.js"); | ||
var fs = require("../../gensync-utils/fs.js"); | ||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js"); | ||
const debug = _debug()("babel:config:loading:files:configuration"); | ||
const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts"]; | ||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; | ||
const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts"]; | ||
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json", ".babelrc.cts"]; | ||
const BABELIGNORE_FILENAME = ".babelignore"; | ||
const LOADING_CONFIGS = new Set(); | ||
const readConfigCode = (0, _caching.makeStrongCache)(function* readConfigCode(filepath, cache) { | ||
if (!_fs().existsSync(filepath)) { | ||
cache.never(); | ||
return null; | ||
} | ||
if (LOADING_CONFIGS.has(filepath)) { | ||
cache.never(); | ||
debug("Auto-ignoring usage of config %o.", filepath); | ||
return { | ||
filepath, | ||
dirname: _path().dirname(filepath), | ||
options: {} | ||
}; | ||
} | ||
let options; | ||
try { | ||
LOADING_CONFIGS.add(filepath); | ||
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."); | ||
} finally { | ||
LOADING_CONFIGS.delete(filepath); | ||
} | ||
let assertCache = false; | ||
const runConfig = (0, _caching.makeWeakCache)(function* runConfig(options, cache) { | ||
yield* []; | ||
return { | ||
options: (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)), | ||
cacheNeedsConfiguration: !cache.configured() | ||
}; | ||
}); | ||
function* readConfigCode(filepath, data) { | ||
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 cacheNeedsConfiguration = false; | ||
if (typeof options === "function") { | ||
yield* []; | ||
options = (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)); | ||
assertCache = true; | ||
({ | ||
options, | ||
cacheNeedsConfiguration | ||
} = yield* runConfig(options, data)); | ||
} | ||
@@ -93,11 +81,25 @@ if (!options || typeof options !== "object" || Array.isArray(options)) { | ||
if (typeof options.then === "function") { | ||
options.catch == null || options.catch(() => {}); | ||
throw new _configError.default(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`, filepath); | ||
} | ||
if (assertCache && !cache.configured()) throwConfigError(filepath); | ||
return { | ||
filepath, | ||
dirname: _path().dirname(filepath), | ||
options | ||
}; | ||
}); | ||
if (cacheNeedsConfiguration) throwConfigError(filepath); | ||
return buildConfigFileObject(options, filepath); | ||
} | ||
const cfboaf = new WeakMap(); | ||
function buildConfigFileObject(options, filepath) { | ||
let configFilesByFilepath = cfboaf.get(options); | ||
if (!configFilesByFilepath) { | ||
cfboaf.set(options, configFilesByFilepath = new Map()); | ||
} | ||
let configFile = configFilesByFilepath.get(filepath); | ||
if (!configFile) { | ||
configFile = { | ||
filepath, | ||
dirname: _path().dirname(filepath), | ||
options | ||
}; | ||
configFilesByFilepath.set(filepath, configFile); | ||
} | ||
return configFile; | ||
} | ||
const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => { | ||
@@ -104,0 +106,0 @@ const babel = file.options["babel"]; |
@@ -43,4 +43,3 @@ "use strict"; | ||
} | ||
const ROOT_CONFIG_FILENAMES = []; | ||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; | ||
const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = []; | ||
function resolvePlugin(name, dirname) { | ||
@@ -47,0 +46,0 @@ return null; |
@@ -72,5 +72,5 @@ "use strict"; | ||
}); | ||
var _package = require("./package"); | ||
var _configuration = require("./configuration"); | ||
var _plugins = require("./plugins"); | ||
var _package = require("./package.js"); | ||
var _configuration = require("./configuration.js"); | ||
var _plugins = require("./plugins.js"); | ||
({}); | ||
@@ -77,0 +77,0 @@ 0 && 0; |
@@ -8,3 +8,3 @@ "use strict"; | ||
exports.supportsESM = void 0; | ||
var _async = require("../../gensync-utils/async"); | ||
var _async = require("../../gensync-utils/async.js"); | ||
function _path() { | ||
@@ -31,7 +31,15 @@ const data = require("path"); | ||
} | ||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); | ||
var _configError = require("../../errors/config-error"); | ||
var _transformFile = require("../../transform-file"); | ||
function _debug() { | ||
const data = require("debug"); | ||
_debug = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js"); | ||
var _configError = require("../../errors/config-error.js"); | ||
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); }); }; } | ||
const debug = _debug()("babel:config:loading:files:module-types"); | ||
let import_; | ||
@@ -41,4 +49,3 @@ try { | ||
} catch (_unused) {} | ||
const supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2"); | ||
exports.supportsESM = supportsESM; | ||
const supportsESM = exports.supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2"); | ||
function* loadCodeDefault(filepath, asyncError) { | ||
@@ -107,4 +114,3 @@ switch (_path().extname(filepath)) { | ||
try { | ||
const module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); | ||
return module != null && module.__esModule ? module.default : module; | ||
return loadCjsDefault(filepath); | ||
} finally { | ||
@@ -117,6 +123,18 @@ if (!hasTsSupport) { | ||
} | ||
const LOADING_CJS_FILES = new Set(); | ||
function loadCjsDefault(filepath) { | ||
const module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); | ||
if (LOADING_CJS_FILES.has(filepath)) { | ||
debug("Auto-ignoring usage of config %o.", filepath); | ||
return {}; | ||
} | ||
let module; | ||
try { | ||
LOADING_CJS_FILES.add(filepath); | ||
module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); | ||
} finally { | ||
LOADING_CJS_FILES.delete(filepath); | ||
} | ||
{ | ||
return module != null && module.__esModule ? module.default || (arguments[1] ? module : undefined) : module; | ||
var _module; | ||
return (_module = module) != null && _module.__esModule ? module.default || (arguments[1] ? module : undefined) : module; | ||
} | ||
@@ -123,0 +141,0 @@ } |
@@ -14,4 +14,4 @@ "use strict"; | ||
} | ||
var _utils = require("./utils"); | ||
var _configError = require("../../errors/config-error"); | ||
var _utils = require("./utils.js"); | ||
var _configError = require("../../errors/config-error.js"); | ||
const PACKAGE_FILENAME = "package.json"; | ||
@@ -18,0 +18,0 @@ const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => { |
@@ -23,4 +23,4 @@ "use strict"; | ||
} | ||
var _async = require("../../gensync-utils/async"); | ||
var _moduleTypes = require("./module-types"); | ||
var _async = require("../../gensync-utils/async.js"); | ||
var _moduleTypes = require("./module-types.js"); | ||
function _url() { | ||
@@ -33,3 +33,10 @@ const data = require("url"); | ||
} | ||
var _importMetaResolve = require("./import-meta-resolve"); | ||
var _importMetaResolve = require("../../vendor/import-meta-resolve.js"); | ||
function _fs() { | ||
const data = require("fs"); | ||
_fs = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
const debug = _debug()("babel:config:loading:files:plugins"); | ||
@@ -44,6 +51,4 @@ const EXACT_RE = /^module:/; | ||
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/; | ||
const resolvePlugin = resolveStandardizedName.bind(null, "plugin"); | ||
exports.resolvePlugin = resolvePlugin; | ||
const resolvePreset = resolveStandardizedName.bind(null, "preset"); | ||
exports.resolvePreset = resolvePreset; | ||
const resolvePlugin = exports.resolvePlugin = resolveStandardizedName.bind(null, "plugin"); | ||
const resolvePreset = exports.resolvePreset = resolveStandardizedName.bind(null, "preset"); | ||
function* loadPlugin(name, dirname) { | ||
@@ -140,3 +145,3 @@ const filepath = resolvePlugin(name, dirname, yield* (0, _async.isAsync)()); | ||
error: null, | ||
value: (0, _importMetaResolve.default)(id, options) | ||
value: (0, _importMetaResolve.resolve)(id, options) | ||
}; | ||
@@ -172,3 +177,9 @@ } catch (error) { | ||
try { | ||
return resolveStandardizedNameForImport(type, name, dirname); | ||
const resolved = resolveStandardizedNameForImport(type, name, dirname); | ||
if (!(0, _fs().existsSync)(resolved)) { | ||
throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname}.`), { | ||
type: "MODULE_NOT_FOUND" | ||
}); | ||
} | ||
return resolved; | ||
} catch (e) { | ||
@@ -175,0 +186,0 @@ try { |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.makeStaticFileCache = makeStaticFileCache; | ||
var _caching = require("../caching"); | ||
var fs = require("../../gensync-utils/fs"); | ||
var _caching = require("../caching.js"); | ||
var fs = require("../../gensync-utils/fs.js"); | ||
function _fs2() { | ||
@@ -11,0 +11,0 @@ const data = require("fs"); |
@@ -14,9 +14,9 @@ "use strict"; | ||
} | ||
var _async = require("../gensync-utils/async"); | ||
var _util = require("./util"); | ||
var context = require("../index"); | ||
var _plugin = require("./plugin"); | ||
var _item = require("./item"); | ||
var _configChain = require("./config-chain"); | ||
var _deepArray = require("./helpers/deep-array"); | ||
var _async = require("../gensync-utils/async.js"); | ||
var _util = require("./util.js"); | ||
var context = require("../index.js"); | ||
var _plugin = require("./plugin.js"); | ||
var _item = require("./item.js"); | ||
var _configChain = require("./config-chain.js"); | ||
var _deepArray = require("./helpers/deep-array.js"); | ||
function _traverse() { | ||
@@ -29,9 +29,9 @@ const data = require("@babel/traverse"); | ||
} | ||
var _caching = require("./caching"); | ||
var _options = require("./validation/options"); | ||
var _plugins = require("./validation/plugins"); | ||
var _configApi = require("./helpers/config-api"); | ||
var _partial = require("./partial"); | ||
var _configError = require("../errors/config-error"); | ||
var _default = _gensync()(function* loadFullConfig(inputOpts) { | ||
var _caching = require("./caching.js"); | ||
var _options = require("./validation/options.js"); | ||
var _plugins = require("./validation/plugins.js"); | ||
var _configApi = require("./helpers/config-api.js"); | ||
var _partial = require("./partial.js"); | ||
var _configError = require("../errors/config-error.js"); | ||
var _default = exports.default = _gensync()(function* loadFullConfig(inputOpts) { | ||
var _opts$assumptions; | ||
@@ -155,3 +155,2 @@ const result = yield* (0, _partial.default)(inputOpts); | ||
}); | ||
exports.default = _default; | ||
function enhanceError(context, fn) { | ||
@@ -274,2 +273,3 @@ return function* (arg1, arg2) { | ||
if (!context.filename) { | ||
var _options$overrides; | ||
const { | ||
@@ -279,5 +279,3 @@ options | ||
validateIfOptionNeedsFilename(options, descriptor); | ||
if (options.overrides) { | ||
options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor)); | ||
} | ||
(_options$overrides = options.overrides) == null || _options$overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor)); | ||
} | ||
@@ -284,0 +282,0 @@ }; |
@@ -16,4 +16,4 @@ "use strict"; | ||
} | ||
var _ = require("../../"); | ||
var _caching = require("../caching"); | ||
var _index = require("../../index.js"); | ||
var _caching = require("../caching.js"); | ||
function makeConfigAPI(cache) { | ||
@@ -34,3 +34,3 @@ const env = value => cache.using(data => { | ||
return { | ||
version: _.version, | ||
version: _index.version, | ||
cache: cache.simple(), | ||
@@ -69,4 +69,3 @@ env, | ||
} | ||
; | ||
if (_semver().satisfies(_.version, range)) return; | ||
if (_semver().satisfies(_index.version, range)) return; | ||
const limit = Error.stackTraceLimit; | ||
@@ -76,3 +75,3 @@ if (typeof limit === "number" && limit < 25) { | ||
} | ||
const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); | ||
const err = new Error(`Requires Babel "${range}", but was loaded with "${_index.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); | ||
if (typeof limit === "number") { | ||
@@ -83,3 +82,3 @@ Error.stackTraceLimit = limit; | ||
code: "BABEL_VERSION_UNSUPPORTED", | ||
version: _.version, | ||
version: _index.version, | ||
range | ||
@@ -86,0 +85,0 @@ }); |
@@ -7,3 +7,4 @@ "use strict"; | ||
exports.createConfigItem = createConfigItem; | ||
exports.createConfigItemSync = exports.createConfigItemAsync = void 0; | ||
exports.createConfigItemAsync = createConfigItemAsync; | ||
exports.createConfigItemSync = createConfigItemSync; | ||
Object.defineProperty(exports, "default", { | ||
@@ -15,3 +16,8 @@ enumerable: true, | ||
}); | ||
exports.loadPartialConfigSync = exports.loadPartialConfigAsync = exports.loadPartialConfig = exports.loadOptionsSync = exports.loadOptionsAsync = exports.loadOptions = void 0; | ||
exports.loadOptions = loadOptions; | ||
exports.loadOptionsAsync = loadOptionsAsync; | ||
exports.loadOptionsSync = loadOptionsSync; | ||
exports.loadPartialConfig = loadPartialConfig; | ||
exports.loadPartialConfigAsync = loadPartialConfigAsync; | ||
exports.loadPartialConfigSync = loadPartialConfigSync; | ||
function _gensync() { | ||
@@ -24,49 +30,63 @@ const data = require("gensync"); | ||
} | ||
var _full = require("./full"); | ||
var _partial = require("./partial"); | ||
var _item = require("./item"); | ||
const loadOptionsRunner = _gensync()(function* (opts) { | ||
var _full = require("./full.js"); | ||
var _partial = require("./partial.js"); | ||
var _item = require("./item.js"); | ||
var _rewriteStackTrace = require("../errors/rewrite-stack-trace.js"); | ||
const loadPartialConfigRunner = _gensync()(_partial.loadPartialConfig); | ||
function loadPartialConfigAsync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.async)(...args); | ||
} | ||
function loadPartialConfigSync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.sync)(...args); | ||
} | ||
function loadPartialConfig(opts, callback) { | ||
if (callback !== undefined) { | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(opts, callback); | ||
} else if (typeof opts === "function") { | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(undefined, opts); | ||
} else { | ||
{ | ||
return loadPartialConfigSync(opts); | ||
} | ||
} | ||
} | ||
function* loadOptionsImpl(opts) { | ||
var _config$options; | ||
const config = yield* (0, _full.default)(opts); | ||
return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null; | ||
}); | ||
const createConfigItemRunner = _gensync()(_item.createConfigItem); | ||
const maybeErrback = runner => (argOrCallback, maybeCallback) => { | ||
let arg; | ||
let callback; | ||
if (maybeCallback === undefined && typeof argOrCallback === "function") { | ||
callback = argOrCallback; | ||
arg = undefined; | ||
} | ||
const loadOptionsRunner = _gensync()(loadOptionsImpl); | ||
function loadOptionsAsync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.async)(...args); | ||
} | ||
function loadOptionsSync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.sync)(...args); | ||
} | ||
function loadOptions(opts, callback) { | ||
if (callback !== undefined) { | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(opts, callback); | ||
} else if (typeof opts === "function") { | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(undefined, opts); | ||
} else { | ||
callback = maybeCallback; | ||
arg = argOrCallback; | ||
{ | ||
return loadOptionsSync(opts); | ||
} | ||
} | ||
if (!callback) { | ||
return runner.sync(arg); | ||
} | ||
runner.errback(arg, callback); | ||
}; | ||
const loadPartialConfig = maybeErrback(_partial.loadPartialConfig); | ||
exports.loadPartialConfig = loadPartialConfig; | ||
const loadPartialConfigSync = _partial.loadPartialConfig.sync; | ||
exports.loadPartialConfigSync = loadPartialConfigSync; | ||
const loadPartialConfigAsync = _partial.loadPartialConfig.async; | ||
exports.loadPartialConfigAsync = loadPartialConfigAsync; | ||
const loadOptions = maybeErrback(loadOptionsRunner); | ||
exports.loadOptions = loadOptions; | ||
const loadOptionsSync = loadOptionsRunner.sync; | ||
exports.loadOptionsSync = loadOptionsSync; | ||
const loadOptionsAsync = loadOptionsRunner.async; | ||
exports.loadOptionsAsync = loadOptionsAsync; | ||
const createConfigItemSync = createConfigItemRunner.sync; | ||
exports.createConfigItemSync = createConfigItemSync; | ||
const createConfigItemAsync = createConfigItemRunner.async; | ||
exports.createConfigItemAsync = createConfigItemAsync; | ||
} | ||
const createConfigItemRunner = _gensync()(_item.createConfigItem); | ||
function createConfigItemAsync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.async)(...args); | ||
} | ||
function createConfigItemSync(...args) { | ||
return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.sync)(...args); | ||
} | ||
function createConfigItem(target, options, callback) { | ||
if (callback !== undefined) { | ||
createConfigItemRunner.errback(target, options, callback); | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, options, callback); | ||
} else if (typeof options === "function") { | ||
createConfigItemRunner.errback(target, undefined, callback); | ||
(0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, undefined, callback); | ||
} else { | ||
return createConfigItemRunner.sync(target, options); | ||
{ | ||
return createConfigItemSync(target, options); | ||
} | ||
} | ||
@@ -73,0 +93,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
var _configDescriptors = require("./config-descriptors"); | ||
var _configDescriptors = require("./config-descriptors.js"); | ||
function createItemFromDescriptor(desc) { | ||
@@ -19,0 +19,0 @@ return new ConfigItem(desc); |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = loadPrivatePartialConfig; | ||
exports.loadPartialConfig = void 0; | ||
exports.loadPartialConfig = loadPartialConfig; | ||
function _path() { | ||
@@ -16,17 +16,10 @@ const data = require("path"); | ||
} | ||
function _gensync() { | ||
const data = require("gensync"); | ||
_gensync = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
var _plugin = require("./plugin"); | ||
var _util = require("./util"); | ||
var _item = require("./item"); | ||
var _configChain = require("./config-chain"); | ||
var _environment = require("./helpers/environment"); | ||
var _options = require("./validation/options"); | ||
var _files = require("./files"); | ||
var _resolveTargets = require("./resolve-targets"); | ||
var _plugin = require("./plugin.js"); | ||
var _util = require("./util.js"); | ||
var _item = require("./item.js"); | ||
var _configChain = require("./config-chain.js"); | ||
var _environment = require("./helpers/environment.js"); | ||
var _options = require("./validation/options.js"); | ||
var _index = require("./files/index.js"); | ||
var _resolveTargets = require("./resolve-targets.js"); | ||
const _excluded = ["showIgnoredFiles"]; | ||
@@ -40,3 +33,3 @@ 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; } | ||
{ | ||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); | ||
const upwardRootDir = (0, _index.findConfigUpwards)(rootDir); | ||
return upwardRootDir === null ? rootDir : upwardRootDir; | ||
@@ -46,5 +39,5 @@ } | ||
{ | ||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); | ||
const upwardRootDir = (0, _index.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}".\n` + `One of the following config files must be in the directory tree: ` + `"${_files.ROOT_CONFIG_FILENAMES.join(", ")}".`), { | ||
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}".\n` + `One of the following config files must be in the directory tree: ` + `"${_index.ROOT_CONFIG_FILENAMES.join(", ")}".`), { | ||
code: "BABEL_ROOT_NOT_FOUND", | ||
@@ -74,3 +67,3 @@ dirname: rootDir | ||
const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined; | ||
const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd); | ||
const showConfigPath = yield* (0, _index.resolveShowConfigPath)(absoluteCwd); | ||
const context = { | ||
@@ -117,3 +110,3 @@ filename, | ||
} | ||
const loadPartialConfig = _gensync()(function* (opts) { | ||
function* loadPartialConfig(opts) { | ||
let showIgnoredFiles = false; | ||
@@ -147,4 +140,3 @@ if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) { | ||
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files); | ||
}); | ||
exports.loadPartialConfig = loadPartialConfig; | ||
} | ||
class PartialConfig { | ||
@@ -151,0 +143,0 @@ constructor(options, babelrc, ignore, config, fileHandling, files) { |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _deepArray = require("./helpers/deep-array"); | ||
var _deepArray = require("./helpers/deep-array.js"); | ||
class Plugin { | ||
@@ -10,0 +10,0 @@ constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) { |
@@ -14,7 +14,6 @@ "use strict"; | ||
} | ||
const ChainFormatter = { | ||
const ChainFormatter = exports.ChainFormatter = { | ||
Programmatic: 0, | ||
Config: 1 | ||
}; | ||
exports.ChainFormatter = ChainFormatter; | ||
const Formatter = { | ||
@@ -21,0 +20,0 @@ title(type, callerName, filepath) { |
@@ -33,3 +33,3 @@ "use strict"; | ||
} | ||
var _options = require("./options"); | ||
var _options = require("./options.js"); | ||
function msg(loc) { | ||
@@ -136,5 +136,3 @@ switch (loc.type) { | ||
const arr = assertArray(loc, value); | ||
if (arr) { | ||
arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item)); | ||
} | ||
arr == null || arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item)); | ||
return arr; | ||
@@ -141,0 +139,0 @@ } |
@@ -9,5 +9,5 @@ "use strict"; | ||
exports.validate = validate; | ||
var _removed = require("./removed"); | ||
var _optionAssertions = require("./option-assertions"); | ||
var _configError = require("../../errors/config-error"); | ||
var _removed = require("./removed.js"); | ||
var _optionAssertions = require("./option-assertions.js"); | ||
var _configError = require("../../errors/config-error.js"); | ||
const ROOT_VALIDATORS = { | ||
@@ -75,4 +75,3 @@ cwd: _optionAssertions.assertString, | ||
const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "objectRestNoSymbols", "privateFieldsAsSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"]; | ||
const assumptionsNames = new Set(knownAssumptions); | ||
exports.assumptionsNames = assumptionsNames; | ||
const assumptionsNames = exports.assumptionsNames = new Set(knownAssumptions); | ||
function getSource(loc) { | ||
@@ -79,0 +78,0 @@ return loc.type === "root" ? loc.source : getSource(loc.parent); |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.validatePluginObject = validatePluginObject; | ||
var _optionAssertions = require("./option-assertions"); | ||
var _optionAssertions = require("./option-assertions.js"); | ||
const VALIDATORS = { | ||
@@ -22,3 +22,7 @@ name: _optionAssertions.assertString, | ||
if (obj) { | ||
Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop])); | ||
Object.keys(obj).forEach(prop => { | ||
if (prop !== "_exploded" && prop !== "_verified") { | ||
assertVisitorHandler(prop, obj[prop]); | ||
} | ||
}); | ||
if (obj.enter || obj.exit) { | ||
@@ -40,3 +44,2 @@ throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`); | ||
} | ||
return value; | ||
} | ||
@@ -43,0 +46,0 @@ function validatePluginObject(obj) { |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _default = { | ||
var _default = exports.default = { | ||
auxiliaryComment: { | ||
@@ -67,5 +67,4 @@ message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`" | ||
}; | ||
exports.default = _default; | ||
0 && 0; | ||
//# sourceMappingURL=removed.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _rewriteStackTrace = require("./rewrite-stack-trace"); | ||
var _rewriteStackTrace = require("./rewrite-stack-trace.js"); | ||
class ConfigError extends Error { | ||
@@ -10,0 +10,0 @@ constructor(message, filename) { |
@@ -10,4 +10,5 @@ "use strict"; | ||
exports.injectVirtualStackFrame = injectVirtualStackFrame; | ||
var _Object$getOwnPropert; | ||
const ErrorToString = Function.call.bind(Error.prototype.toString); | ||
const SUPPORTED = !!Error.captureStackTrace; | ||
const SUPPORTED = !!Error.captureStackTrace && ((_Object$getOwnPropert = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit")) == null ? void 0 : _Object$getOwnPropert.writable) === true; | ||
const START_HIDING = "startHiding - secret - don't use this - v1"; | ||
@@ -14,0 +15,0 @@ const STOP_HIDING = "stopHiding - secret - don't use this - v1"; |
@@ -23,7 +23,6 @@ "use strict"; | ||
}); | ||
const isAsync = _gensync()({ | ||
const isAsync = exports.isAsync = _gensync()({ | ||
sync: () => false, | ||
errback: cb => cb(null, true) | ||
}); | ||
exports.isAsync = isAsync; | ||
function maybeAsync(fn, message) { | ||
@@ -59,3 +58,3 @@ return _gensync()({ | ||
} | ||
const onFirstPause = _gensync()({ | ||
const onFirstPause = exports.onFirstPause = _gensync()({ | ||
name: "onFirstPause", | ||
@@ -77,4 +76,3 @@ arity: 2, | ||
}); | ||
exports.onFirstPause = onFirstPause; | ||
const waitFor = _gensync()({ | ||
const waitFor = exports.waitFor = _gensync()({ | ||
sync: x => x, | ||
@@ -90,3 +88,2 @@ async: function () { | ||
}); | ||
exports.waitFor = waitFor; | ||
function isThenable(val) { | ||
@@ -93,0 +90,0 @@ return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; |
@@ -21,14 +21,12 @@ "use strict"; | ||
} | ||
const readFile = _gensync()({ | ||
const readFile = exports.readFile = _gensync()({ | ||
sync: _fs().readFileSync, | ||
errback: _fs().readFile | ||
}); | ||
exports.readFile = readFile; | ||
const stat = _gensync()({ | ||
const stat = exports.stat = _gensync()({ | ||
sync: _fs().statSync, | ||
errback: _fs().stat | ||
}); | ||
exports.stat = stat; | ||
0 && 0; | ||
//# sourceMappingURL=fs.js.map |
@@ -7,24 +7,49 @@ "use strict"; | ||
exports.once = once; | ||
var _async = require("./async"); | ||
var _async = require("./async.js"); | ||
function once(fn) { | ||
let result; | ||
let resultP; | ||
let promiseReferenced = false; | ||
return function* () { | ||
if (result) return result; | ||
if (!(yield* (0, _async.isAsync)())) return result = yield* fn(); | ||
if (resultP) return yield* (0, _async.waitFor)(resultP); | ||
let resolve, reject; | ||
resultP = new Promise((res, rej) => { | ||
resolve = res; | ||
reject = rej; | ||
}); | ||
try { | ||
result = yield* fn(); | ||
resultP = null; | ||
resolve(result); | ||
return result; | ||
} catch (error) { | ||
reject(error); | ||
throw error; | ||
if (!result) { | ||
if (resultP) { | ||
promiseReferenced = true; | ||
return yield* (0, _async.waitFor)(resultP); | ||
} | ||
if (!(yield* (0, _async.isAsync)())) { | ||
try { | ||
result = { | ||
ok: true, | ||
value: yield* fn() | ||
}; | ||
} catch (error) { | ||
result = { | ||
ok: false, | ||
value: error | ||
}; | ||
} | ||
} else { | ||
let resolve, reject; | ||
resultP = new Promise((res, rej) => { | ||
resolve = res; | ||
reject = rej; | ||
}); | ||
try { | ||
result = { | ||
ok: true, | ||
value: yield* fn() | ||
}; | ||
resultP = null; | ||
if (promiseReferenced) resolve(result.value); | ||
} catch (error) { | ||
result = { | ||
ok: false, | ||
value: error | ||
}; | ||
resultP = null; | ||
if (promiseReferenced) reject(error); | ||
} | ||
} | ||
} | ||
if (result.ok) return result.value;else throw result.value; | ||
}; | ||
@@ -31,0 +56,0 @@ } |
@@ -22,3 +22,3 @@ "use strict"; | ||
get: function () { | ||
return _config.createConfigItem; | ||
return _index2.createConfigItem; | ||
} | ||
@@ -29,3 +29,3 @@ }); | ||
get: function () { | ||
return _config.createConfigItemAsync; | ||
return _index2.createConfigItemAsync; | ||
} | ||
@@ -36,3 +36,3 @@ }); | ||
get: function () { | ||
return _config.createConfigItemSync; | ||
return _index2.createConfigItemSync; | ||
} | ||
@@ -49,3 +49,3 @@ }); | ||
get: function () { | ||
return _config.loadOptions; | ||
return _index2.loadOptions; | ||
} | ||
@@ -56,3 +56,3 @@ }); | ||
get: function () { | ||
return _config.loadOptionsAsync; | ||
return _index2.loadOptionsAsync; | ||
} | ||
@@ -63,3 +63,3 @@ }); | ||
get: function () { | ||
return _config.loadOptionsSync; | ||
return _index2.loadOptionsSync; | ||
} | ||
@@ -70,3 +70,3 @@ }); | ||
get: function () { | ||
return _config.loadPartialConfig; | ||
return _index2.loadPartialConfig; | ||
} | ||
@@ -77,3 +77,3 @@ }); | ||
get: function () { | ||
return _config.loadPartialConfigAsync; | ||
return _index2.loadPartialConfigAsync; | ||
} | ||
@@ -84,3 +84,3 @@ }); | ||
get: function () { | ||
return _config.loadPartialConfigSync; | ||
return _index2.loadPartialConfigSync; | ||
} | ||
@@ -109,3 +109,3 @@ }); | ||
get: function () { | ||
return _files.resolvePlugin; | ||
return _index.resolvePlugin; | ||
} | ||
@@ -116,3 +116,3 @@ }); | ||
get: function () { | ||
return _files.resolvePreset; | ||
return _index.resolvePreset; | ||
} | ||
@@ -193,6 +193,6 @@ }); | ||
exports.version = exports.types = void 0; | ||
var _file = require("./transformation/file/file"); | ||
var _buildExternalHelpers = require("./tools/build-external-helpers"); | ||
var _files = require("./config/files"); | ||
var _environment = require("./config/helpers/environment"); | ||
var _file = require("./transformation/file/file.js"); | ||
var _buildExternalHelpers = require("./tools/build-external-helpers.js"); | ||
var _index = require("./config/files/index.js"); | ||
var _environment = require("./config/helpers/environment.js"); | ||
function _types() { | ||
@@ -232,24 +232,21 @@ const data = require("@babel/types"); | ||
} | ||
var _config = require("./config"); | ||
var _transform = require("./transform"); | ||
var _transformFile = require("./transform-file"); | ||
var _transformAst = require("./transform-ast"); | ||
var _parse = require("./parse"); | ||
var thisFile = require("./index"); | ||
const version = "7.22.5"; | ||
exports.version = version; | ||
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]); | ||
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; | ||
var _index2 = require("./config/index.js"); | ||
var _transform = require("./transform.js"); | ||
var _transformFile = require("./transform-file.js"); | ||
var _transformAst = require("./transform-ast.js"); | ||
var _parse = require("./parse.js"); | ||
var thisFile = require("./index.js"); | ||
; | ||
const version = exports.version = "7.23.7"; | ||
const DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]); | ||
; | ||
{ | ||
{ | ||
exports.OptionManager = class OptionManager { | ||
init(opts) { | ||
return (0, _config.loadOptionsSync)(opts); | ||
} | ||
}; | ||
exports.Plugin = function Plugin(alias) { | ||
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`); | ||
}; | ||
} | ||
exports.OptionManager = class OptionManager { | ||
init(opts) { | ||
return (0, _index2.loadOptionsSync)(opts); | ||
} | ||
}; | ||
exports.Plugin = function Plugin(alias) { | ||
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`); | ||
}; | ||
} | ||
@@ -256,0 +253,0 @@ 0 && (exports.types = exports.traverse = exports.tokTypes = exports.template = 0); |
@@ -16,14 +16,14 @@ "use strict"; | ||
} | ||
var _config = require("./config"); | ||
var _parser = require("./parser"); | ||
var _normalizeOpts = require("./transformation/normalize-opts"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); | ||
var _index = require("./config/index.js"); | ||
var _index2 = require("./parser/index.js"); | ||
var _normalizeOpts = require("./transformation/normalize-opts.js"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js"); | ||
const parseRunner = _gensync()(function* parse(code, opts) { | ||
const config = yield* (0, _config.default)(opts); | ||
const config = yield* (0, _index.default)(opts); | ||
if (config === null) { | ||
return null; | ||
} | ||
return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code); | ||
return yield* (0, _index2.default)(config.passes, (0, _normalizeOpts.default)(config), code); | ||
}); | ||
const parse = function parse(code, opts, callback) { | ||
const parse = exports.parse = function parse(code, opts, callback) { | ||
if (typeof opts === "function") { | ||
@@ -40,3 +40,2 @@ callback = opts; | ||
}; | ||
exports.parse = parse; | ||
function parseSync(...args) { | ||
@@ -43,0 +42,0 @@ return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args); |
@@ -21,3 +21,3 @@ "use strict"; | ||
} | ||
var _missingPluginHelper = require("./util/missing-plugin-helper"); | ||
var _missingPluginHelper = require("./util/missing-plugin-helper.js"); | ||
function* parser(pluginPasses, { | ||
@@ -24,0 +24,0 @@ parserOpts, |
@@ -35,3 +35,3 @@ "use strict"; | ||
} | ||
var _file = require("../transformation/file/file"); | ||
var _file = require("../transformation/file/file.js"); | ||
const { | ||
@@ -38,0 +38,0 @@ arrayExpression, |
@@ -16,12 +16,12 @@ "use strict"; | ||
} | ||
var _config = require("./config"); | ||
var _transformation = require("./transformation"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); | ||
var _index = require("./config/index.js"); | ||
var _index2 = require("./transformation/index.js"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js"); | ||
const transformFromAstRunner = _gensync()(function* (ast, code, opts) { | ||
const config = yield* (0, _config.default)(opts); | ||
const config = yield* (0, _index.default)(opts); | ||
if (config === null) return null; | ||
if (!ast) throw new Error("No AST given"); | ||
return yield* (0, _transformation.run)(config, code, ast); | ||
return yield* (0, _index2.run)(config, code, ast); | ||
}); | ||
const transformFromAst = function transformFromAst(ast, code, optsOrCallback, maybeCallback) { | ||
const transformFromAst = exports.transformFromAst = function transformFromAst(ast, code, optsOrCallback, maybeCallback) { | ||
let opts; | ||
@@ -43,3 +43,2 @@ let callback; | ||
}; | ||
exports.transformFromAst = transformFromAst; | ||
function transformFromAstSync(...args) { | ||
@@ -46,0 +45,0 @@ return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args); |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.transformFileSync = transformFileSync; | ||
const transformFile = function transformFile(filename, opts, callback) { | ||
const transformFile = exports.transformFile = function transformFile(filename, opts, callback) { | ||
if (typeof opts === "function") { | ||
@@ -16,3 +16,2 @@ callback = opts; | ||
}; | ||
exports.transformFile = transformFile; | ||
function transformFileSync() { | ||
@@ -19,0 +18,0 @@ throw new Error("Transforming files is not supported in browsers"); |
@@ -16,5 +16,5 @@ "use strict"; | ||
} | ||
var _config = require("./config"); | ||
var _transformation = require("./transformation"); | ||
var fs = require("./gensync-utils/fs"); | ||
var _index = require("./config/index.js"); | ||
var _index2 = require("./transformation/index.js"); | ||
var fs = require("./gensync-utils/fs.js"); | ||
({}); | ||
@@ -25,6 +25,6 @@ const transformFileRunner = _gensync()(function* (filename, opts) { | ||
}); | ||
const config = yield* (0, _config.default)(options); | ||
const config = yield* (0, _index.default)(options); | ||
if (config === null) return null; | ||
const code = yield* fs.readFile(filename, "utf8"); | ||
return yield* (0, _transformation.run)(config, code); | ||
return yield* (0, _index2.run)(config, code); | ||
}); | ||
@@ -31,0 +31,0 @@ function transformFile(...args) { |
@@ -16,11 +16,11 @@ "use strict"; | ||
} | ||
var _config = require("./config"); | ||
var _transformation = require("./transformation"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); | ||
var _index = require("./config/index.js"); | ||
var _index2 = require("./transformation/index.js"); | ||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js"); | ||
const transformRunner = _gensync()(function* transform(code, opts) { | ||
const config = yield* (0, _config.default)(opts); | ||
const config = yield* (0, _index.default)(opts); | ||
if (config === null) return null; | ||
return yield* (0, _transformation.run)(config, code); | ||
return yield* (0, _index2.run)(config, code); | ||
}); | ||
const transform = function transform(code, optsOrCallback, maybeCallback) { | ||
const transform = exports.transform = function transform(code, optsOrCallback, maybeCallback) { | ||
let opts; | ||
@@ -42,3 +42,2 @@ let callback; | ||
}; | ||
exports.transform = transform; | ||
function transformSync(...args) { | ||
@@ -45,0 +44,0 @@ return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args); |
@@ -14,3 +14,3 @@ "use strict"; | ||
} | ||
var _plugin = require("../config/plugin"); | ||
var _plugin = require("../config/plugin.js"); | ||
let LOADED_PLUGIN; | ||
@@ -17,0 +17,0 @@ const blockHoistPlugin = { |
@@ -21,3 +21,3 @@ "use strict"; | ||
} | ||
var _mergeMap = require("./merge-map"); | ||
var _mergeMap = require("./merge-map.js"); | ||
function generateCode(pluginPasses, file) { | ||
@@ -24,0 +24,0 @@ const { |
@@ -14,8 +14,8 @@ "use strict"; | ||
} | ||
var _pluginPass = require("./plugin-pass"); | ||
var _blockHoistPlugin = require("./block-hoist-plugin"); | ||
var _normalizeOpts = require("./normalize-opts"); | ||
var _normalizeFile = require("./normalize-file"); | ||
var _generate = require("./file/generate"); | ||
var _deepArray = require("../config/helpers/deep-array"); | ||
var _pluginPass = require("./plugin-pass.js"); | ||
var _blockHoistPlugin = require("./block-hoist-plugin.js"); | ||
var _normalizeOpts = require("./normalize-opts.js"); | ||
var _normalizeFile = require("./normalize-file.js"); | ||
var _generate = require("./file/generate.js"); | ||
var _deepArray = require("../config/helpers/deep-array.js"); | ||
function* run(config, code, ast) { | ||
@@ -82,3 +82,5 @@ const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); | ||
const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod); | ||
(0, _traverse().default)(file.ast, visitor, file.scope); | ||
{ | ||
(0, _traverse().default)(file.ast, visitor, file.scope); | ||
} | ||
for (const [plugin, pass] of passPairs) { | ||
@@ -85,0 +87,0 @@ const fn = plugin.post; |
@@ -42,5 +42,5 @@ "use strict"; | ||
} | ||
var _file = require("./file/file"); | ||
var _parser = require("../parser"); | ||
var _cloneDeep = require("./util/clone-deep"); | ||
var _file = require("./file/file.js"); | ||
var _index = require("../parser/index.js"); | ||
var _cloneDeep = require("./util/clone-deep.js"); | ||
const { | ||
@@ -65,3 +65,3 @@ file, | ||
} else { | ||
ast = yield* (0, _parser.default)(pluginPasses, options, code); | ||
ast = yield* (0, _index.default)(pluginPasses, options, code); | ||
} | ||
@@ -77,5 +77,7 @@ let inputMap = null; | ||
try { | ||
inputMap = _convertSourceMap().fromComment(lastComment); | ||
inputMap = _convertSourceMap().fromComment("//" + lastComment); | ||
} catch (err) { | ||
debug("discarding unknown inline input sourcemap", err); | ||
{ | ||
debug("discarding unknown inline input sourcemap"); | ||
} | ||
} | ||
@@ -82,0 +84,0 @@ } |
@@ -64,5 +64,4 @@ "use strict"; | ||
} | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const isWindows = _process().platform === 'win32'; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
const own$1 = {}.hasOwnProperty; | ||
@@ -145,4 +144,4 @@ const classRegExp = /^([A-Z][a-z\d]*)+$/; | ||
}, Error); | ||
codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { | ||
return `Cannot find ${type} '${path}' imported from ${base}`; | ||
codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', (path, base, exactUrl = false) => { | ||
return `Cannot find ${exactUrl ? 'module' : 'package'} '${path}' imported from ${base}`; | ||
}, Error); | ||
@@ -169,10 +168,2 @@ codes.ERR_NETWORK_IMPORT_DISALLOWED = createError('ERR_NETWORK_IMPORT_DISALLOWED', "import of '%s' by %s is not supported: %s", Error); | ||
}, TypeError); | ||
codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => { | ||
let message = `Only URLs with a scheme in: ${formatList(supported)} are supported by the default ESM loader`; | ||
if (isWindows && url.protocol.length === 2) { | ||
message += '. On Windows, absolute paths must be valid file:// URLs'; | ||
} | ||
message += `. Received protocol '${url.protocol}'`; | ||
return message; | ||
}, Error); | ||
function createError(sym, value, def) { | ||
@@ -278,2 +269,7 @@ messages.set(sym, value); | ||
} | ||
const hasOwnProperty$1 = {}.hasOwnProperty; | ||
const { | ||
ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 | ||
} = codes; | ||
const cache = new Map(); | ||
const reader = { | ||
@@ -283,81 +279,80 @@ read | ||
var packageJsonReader = reader; | ||
function read(jsonPath) { | ||
try { | ||
const string = _fs().default.readFileSync(_path().toNamespacedPath(_path().join(_path().dirname(jsonPath), 'package.json')), 'utf8'); | ||
return { | ||
string | ||
}; | ||
} catch (error) { | ||
const exception = error; | ||
if (exception.code === 'ENOENT') { | ||
return { | ||
string: undefined | ||
}; | ||
} | ||
throw exception; | ||
} | ||
} | ||
const { | ||
ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG$1 | ||
} = codes; | ||
const packageJsonCache = new Map(); | ||
function getPackageConfig(path, specifier, base) { | ||
const existing = packageJsonCache.get(path); | ||
if (existing !== undefined) { | ||
function read(jsonPath, { | ||
base, | ||
specifier | ||
}) { | ||
const existing = cache.get(jsonPath); | ||
if (existing) { | ||
return existing; | ||
} | ||
const source = packageJsonReader.read(path).string; | ||
if (source === undefined) { | ||
const packageConfig = { | ||
pjsonPath: path, | ||
exists: false, | ||
main: undefined, | ||
name: undefined, | ||
type: 'none', | ||
exports: undefined, | ||
imports: undefined | ||
}; | ||
packageJsonCache.set(path, packageConfig); | ||
return packageConfig; | ||
} | ||
let packageJson; | ||
let string; | ||
try { | ||
packageJson = JSON.parse(source); | ||
string = _fs().default.readFileSync(_path().toNamespacedPath(jsonPath), 'utf8'); | ||
} catch (error) { | ||
const exception = error; | ||
throw new ERR_INVALID_PACKAGE_CONFIG$1(path, (base ? `"${specifier}" from ` : '') + (0, _url().fileURLToPath)(base || specifier), exception.message); | ||
if (exception.code !== 'ENOENT') { | ||
throw exception; | ||
} | ||
} | ||
const { | ||
exports, | ||
imports, | ||
main, | ||
name, | ||
type | ||
} = packageJson; | ||
const packageConfig = { | ||
pjsonPath: path, | ||
exists: true, | ||
main: typeof main === 'string' ? main : undefined, | ||
name: typeof name === 'string' ? name : undefined, | ||
type: type === 'module' || type === 'commonjs' ? type : 'none', | ||
exports, | ||
imports: imports && typeof imports === 'object' ? imports : undefined | ||
const result = { | ||
exists: false, | ||
pjsonPath: jsonPath, | ||
main: undefined, | ||
name: undefined, | ||
type: 'none', | ||
exports: undefined, | ||
imports: undefined | ||
}; | ||
packageJsonCache.set(path, packageConfig); | ||
return packageConfig; | ||
if (string !== undefined) { | ||
let parsed; | ||
try { | ||
parsed = JSON.parse(string); | ||
} catch (error_) { | ||
const cause = error_; | ||
const error = new ERR_INVALID_PACKAGE_CONFIG$1(jsonPath, (base ? `"${specifier}" from ` : '') + (0, _url().fileURLToPath)(base || specifier), cause.message); | ||
error.cause = cause; | ||
throw error; | ||
} | ||
result.exists = true; | ||
if (hasOwnProperty$1.call(parsed, 'name') && typeof parsed.name === 'string') { | ||
result.name = parsed.name; | ||
} | ||
if (hasOwnProperty$1.call(parsed, 'main') && typeof parsed.main === 'string') { | ||
result.main = parsed.main; | ||
} | ||
if (hasOwnProperty$1.call(parsed, 'exports')) { | ||
result.exports = parsed.exports; | ||
} | ||
if (hasOwnProperty$1.call(parsed, 'imports')) { | ||
result.imports = parsed.imports; | ||
} | ||
if (hasOwnProperty$1.call(parsed, 'type') && (parsed.type === 'commonjs' || parsed.type === 'module')) { | ||
result.type = parsed.type; | ||
} | ||
} | ||
cache.set(jsonPath, result); | ||
return result; | ||
} | ||
function getPackageScopeConfig(resolved) { | ||
let packageJsonUrl = new (_url().URL)('package.json', resolved); | ||
let packageJSONUrl = new (_url().URL)('package.json', resolved); | ||
while (true) { | ||
const packageJsonPath = packageJsonUrl.pathname; | ||
if (packageJsonPath.endsWith('node_modules/package.json')) break; | ||
const packageConfig = getPackageConfig((0, _url().fileURLToPath)(packageJsonUrl), resolved); | ||
if (packageConfig.exists) return packageConfig; | ||
const lastPackageJsonUrl = packageJsonUrl; | ||
packageJsonUrl = new (_url().URL)('../package.json', packageJsonUrl); | ||
if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break; | ||
const packageJSONPath = packageJSONUrl.pathname; | ||
if (packageJSONPath.endsWith('node_modules/package.json')) { | ||
break; | ||
} | ||
const packageConfig = packageJsonReader.read((0, _url().fileURLToPath)(packageJSONUrl), { | ||
specifier: resolved | ||
}); | ||
if (packageConfig.exists) { | ||
return packageConfig; | ||
} | ||
const lastPackageJSONUrl = packageJSONUrl; | ||
packageJSONUrl = new (_url().URL)('../package.json', packageJSONUrl); | ||
if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) { | ||
break; | ||
} | ||
} | ||
const packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); | ||
const packageConfig = { | ||
pjsonPath: packageJsonPath, | ||
const packageJSONPath = (0, _url().fileURLToPath)(packageJSONUrl); | ||
return { | ||
pjsonPath: packageJSONPath, | ||
exists: false, | ||
@@ -370,4 +365,2 @@ main: undefined, | ||
}; | ||
packageJsonCache.set(packageJsonPath, packageConfig); | ||
return packageConfig; | ||
} | ||
@@ -427,4 +420,15 @@ function getPackageType(url) { | ||
if (ext === '.js') { | ||
return getPackageType(url) === 'module' ? 'module' : 'commonjs'; | ||
const packageType = getPackageType(url); | ||
if (packageType !== 'none') { | ||
return packageType; | ||
} | ||
return 'commonjs'; | ||
} | ||
if (ext === '') { | ||
const packageType = getPackageType(url); | ||
if (packageType === 'none' || packageType === 'commonjs') { | ||
return 'commonjs'; | ||
} | ||
return 'module'; | ||
} | ||
const format = extensionFormatMap[ext]; | ||
@@ -440,6 +444,7 @@ if (format) return format; | ||
function defaultGetFormatWithoutErrors(url, context) { | ||
if (!hasOwnProperty.call(protocolHandlers, url.protocol)) { | ||
const protocol = url.protocol; | ||
if (!hasOwnProperty.call(protocolHandlers, protocol)) { | ||
return null; | ||
} | ||
return protocolHandlers[url.protocol](url, context, true) || null; | ||
return protocolHandlers[protocol](url, context, true) || null; | ||
} | ||
@@ -467,3 +472,2 @@ const { | ||
const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace]; | ||
const experimentalNetworkImports = false; | ||
const { | ||
@@ -477,4 +481,3 @@ ERR_NETWORK_IMPORT_DISALLOWED, | ||
ERR_PACKAGE_PATH_NOT_EXPORTED, | ||
ERR_UNSUPPORTED_DIR_IMPORT, | ||
ERR_UNSUPPORTED_ESM_URL_SCHEME | ||
ERR_UNSUPPORTED_DIR_IMPORT | ||
} = codes; | ||
@@ -490,2 +493,5 @@ const own = {}.hasOwnProperty; | ||
function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) { | ||
if (_process().noDeprecation) { | ||
return; | ||
} | ||
const pjsonPath = (0, _url().fileURLToPath)(packageJsonUrl); | ||
@@ -496,2 +502,5 @@ const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null; | ||
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) { | ||
if (_process().noDeprecation) { | ||
return; | ||
} | ||
const format = defaultGetFormatWithoutErrors(url, { | ||
@@ -501,6 +510,10 @@ parentURL: base.href | ||
if (format !== 'module') return; | ||
const path = (0, _url().fileURLToPath)(url.href); | ||
const urlPath = (0, _url().fileURLToPath)(url.href); | ||
const pkgPath = (0, _url().fileURLToPath)(new (_url().URL)('.', packageJsonUrl)); | ||
const basePath = (0, _url().fileURLToPath)(base); | ||
if (main) _process().emitWarning(`Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, ` + `excluding the full filename and extension to the resolved file at "${path.slice(pkgPath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is` + 'deprecated for ES modules.', 'DeprecationWarning', 'DEP0151');else _process().emitWarning(`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path.slice(pkgPath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, 'DeprecationWarning', 'DEP0151'); | ||
if (!main) { | ||
_process().emitWarning(`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${urlPath.slice(pkgPath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, 'DeprecationWarning', 'DEP0151'); | ||
} else if (_path().resolve(pkgPath, main) !== urlPath) { | ||
_process().emitWarning(`Package ${pkgPath} has a "main" field set to "${main}", ` + `excluding the full filename and extension to the resolved file at "${urlPath.slice(pkgPath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is ` + 'deprecated for ES modules.', 'DeprecationWarning', 'DEP0151'); | ||
} | ||
} | ||
@@ -552,4 +565,18 @@ function tryStatSync(path) { | ||
function finalizeResolution(resolved, base, preserveSymlinks) { | ||
if (encodedSepRegEx.exec(resolved.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', (0, _url().fileURLToPath)(base)); | ||
const filePath = (0, _url().fileURLToPath)(resolved); | ||
if (encodedSepRegEx.exec(resolved.pathname) !== null) { | ||
throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', (0, _url().fileURLToPath)(base)); | ||
} | ||
let filePath; | ||
try { | ||
filePath = (0, _url().fileURLToPath)(resolved); | ||
} catch (error) { | ||
const cause = error; | ||
Object.defineProperty(cause, 'input', { | ||
value: String(resolved) | ||
}); | ||
Object.defineProperty(cause, 'module', { | ||
value: String(base) | ||
}); | ||
throw cause; | ||
} | ||
const stats = tryStatSync(filePath.endsWith('/') ? filePath.slice(-1) : filePath); | ||
@@ -562,3 +589,5 @@ if (stats.isDirectory()) { | ||
if (!stats.isFile()) { | ||
throw new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && (0, _url().fileURLToPath)(base), 'module'); | ||
const error = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && (0, _url().fileURLToPath)(base), true); | ||
error.url = String(resolved); | ||
throw error; | ||
} | ||
@@ -721,2 +750,5 @@ if (!preserveSymlinks) { | ||
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) { | ||
if (_process().noDeprecation) { | ||
return; | ||
} | ||
const pjsonPath = (0, _url().fileURLToPath)(pjsonUrl); | ||
@@ -880,3 +912,6 @@ if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; | ||
} | ||
const packageConfig = getPackageConfig(packageJsonPath, specifier, base); | ||
const packageConfig = packageJsonReader.read(packageJsonPath, { | ||
base, | ||
specifier | ||
}); | ||
if (packageConfig.exports !== undefined && packageConfig.exports !== null) { | ||
@@ -890,3 +925,3 @@ return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions); | ||
} while (packageJsonPath.length !== lastPath.length); | ||
throw new ERR_MODULE_NOT_FOUND(packageName, (0, _url().fileURLToPath)(base)); | ||
throw new ERR_MODULE_NOT_FOUND(packageName, (0, _url().fileURLToPath)(base), false); | ||
} | ||
@@ -961,14 +996,2 @@ function isRelativeSpecifier(specifier) { | ||
} | ||
function throwIfUnsupportedURLProtocol(url) { | ||
const protocol = url.protocol; | ||
if (protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:') { | ||
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url); | ||
} | ||
} | ||
function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { | ||
const protocol = parsed == null ? void 0 : parsed.protocol; | ||
if (protocol && protocol !== 'file:' && protocol !== 'data:' && (!experimentalNetworkImports || protocol !== 'https:' && protocol !== 'http:')) { | ||
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, ['file', 'data'].concat(experimentalNetworkImports ? ['https', 'http'] : [])); | ||
} | ||
} | ||
function defaultResolve(specifier, context = {}) { | ||
@@ -990,3 +1013,3 @@ const { | ||
const protocol = parsed.protocol; | ||
if (protocol === 'data:' || experimentalNetworkImports && (protocol === 'https:' || protocol === 'http:')) { | ||
if (protocol === 'data:') { | ||
return { | ||
@@ -1003,6 +1026,4 @@ url: parsed.href, | ||
}; | ||
throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports); | ||
const conditions = getConditionsSet(context.conditions); | ||
const url = moduleResolve(specifier, new (_url().URL)(parentURL), conditions, false); | ||
throwIfUnsupportedURLProtocol(url); | ||
return { | ||
@@ -1025,3 +1046,3 @@ url: url.href, | ||
const exception = error; | ||
if (exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' && typeof exception.url === 'string') { | ||
if ((exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' || exception.code === 'ERR_MODULE_NOT_FOUND') && typeof exception.url === 'string') { | ||
return exception.url; | ||
@@ -1028,0 +1049,0 @@ } |
{ | ||
"name": "@babel/core", | ||
"version": "7.22.5", | ||
"version": "7.23.7", | ||
"description": "Babel compiler core.", | ||
@@ -50,26 +50,26 @@ "main": "./lib/index.js", | ||
"@ampproject/remapping": "^2.2.0", | ||
"@babel/code-frame": "^7.22.5", | ||
"@babel/generator": "^7.22.5", | ||
"@babel/helper-compilation-targets": "^7.22.5", | ||
"@babel/helper-module-transforms": "^7.22.5", | ||
"@babel/helpers": "^7.22.5", | ||
"@babel/parser": "^7.22.5", | ||
"@babel/template": "^7.22.5", | ||
"@babel/traverse": "^7.22.5", | ||
"@babel/types": "^7.22.5", | ||
"convert-source-map": "^1.7.0", | ||
"@babel/code-frame": "^7.23.5", | ||
"@babel/generator": "^7.23.6", | ||
"@babel/helper-compilation-targets": "^7.23.6", | ||
"@babel/helper-module-transforms": "^7.23.3", | ||
"@babel/helpers": "^7.23.7", | ||
"@babel/parser": "^7.23.6", | ||
"@babel/template": "^7.22.15", | ||
"@babel/traverse": "^7.23.7", | ||
"@babel/types": "^7.23.6", | ||
"convert-source-map": "^2.0.0", | ||
"debug": "^4.1.0", | ||
"gensync": "^1.0.0-beta.2", | ||
"json5": "^2.2.2", | ||
"semver": "^6.3.0" | ||
"json5": "^2.2.3", | ||
"semver": "^6.3.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/helper-transform-fixture-test-runner": "^7.22.5", | ||
"@babel/plugin-syntax-flow": "^7.22.5", | ||
"@babel/plugin-transform-flow-strip-types": "^7.22.5", | ||
"@babel/plugin-transform-modules-commonjs": "^7.22.5", | ||
"@babel/preset-env": "^7.22.5", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@babel/helper-transform-fixture-test-runner": "^7.22.19", | ||
"@babel/plugin-syntax-flow": "^7.23.3", | ||
"@babel/plugin-transform-flow-strip-types": "^7.23.3", | ||
"@babel/plugin-transform-modules-commonjs": "^7.23.3", | ||
"@babel/preset-env": "^7.23.7", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@jridgewell/trace-mapping": "^0.3.17", | ||
"@types/convert-source-map": "^1.5.1", | ||
"@types/convert-source-map": "^2.0.0", | ||
"@types/debug": "^4.1.0", | ||
@@ -76,0 +76,0 @@ "@types/gensync": "^1.0.0", |
@@ -5,3 +5,3 @@ # @babel/core | ||
See our website [@babel/core](https://babeljs.io/docs/en/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package. | ||
See our website [@babel/core](https://babeljs.io/docs/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package. | ||
@@ -8,0 +8,0 @@ ## Install |
@@ -8,5 +8,5 @@ import type { Handler } from "gensync"; | ||
FilePackageData, | ||
} from "./types"; | ||
} from "./types.ts"; | ||
import type { CallerMetadata } from "../validation/options"; | ||
import type { CallerMetadata } from "../validation/options.ts"; | ||
@@ -13,0 +13,0 @@ export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; |
@@ -8,3 +8,3 @@ type indexBrowserType = typeof import("./index-browser"); | ||
export { findPackageData } from "./package"; | ||
export { findPackageData } from "./package.ts"; | ||
@@ -18,3 +18,3 @@ export { | ||
ROOT_CONFIG_FILENAMES, | ||
} from "./configuration"; | ||
} from "./configuration.ts"; | ||
export type { | ||
@@ -25,3 +25,3 @@ ConfigFile, | ||
FilePackageData, | ||
} from "./types"; | ||
} from "./types.ts"; | ||
export { | ||
@@ -32,2 +32,2 @@ loadPlugin, | ||
resolvePreset, | ||
} from "./plugins"; | ||
} from "./plugins.ts"; |
@@ -1,2 +0,2 @@ | ||
import type { ValidatedOptions } from "./validation/options"; | ||
import type { ValidatedOptions } from "./validation/options.ts"; | ||
import getTargets, { | ||
@@ -3,0 +3,0 @@ type InputTargets, |
@@ -8,3 +8,3 @@ type browserType = typeof import("./resolve-targets-browser"); | ||
import type { ValidatedOptions } from "./validation/options"; | ||
import type { ValidatedOptions } from "./validation/options.ts"; | ||
import path from "path"; | ||
@@ -11,0 +11,0 @@ import getTargets, { |
import gensync, { type Handler } from "gensync"; | ||
import loadConfig from "./config"; | ||
import type { InputOptions, ResolvedConfig } from "./config"; | ||
import { run } from "./transformation"; | ||
import type { FileResult, FileResultCallback } from "./transformation"; | ||
import * as fs from "./gensync-utils/fs"; | ||
import loadConfig from "./config/index.ts"; | ||
import type { InputOptions, ResolvedConfig } from "./config/index.ts"; | ||
import { run } from "./transformation/index.ts"; | ||
import type { FileResult, FileResultCallback } from "./transformation/index.ts"; | ||
import * as fs from "./gensync-utils/fs.ts"; | ||
@@ -9,0 +9,0 @@ type transformFileBrowserType = typeof import("./transform-file-browser"); |
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
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
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
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
778305
6853
118
12
+ Addedconvert-source-map@2.0.0(transitive)
- Removedconvert-source-map@1.9.0(transitive)
Updated@babel/code-frame@^7.23.5
Updated@babel/generator@^7.23.6
Updated@babel/helpers@^7.23.7
Updated@babel/parser@^7.23.6
Updated@babel/template@^7.22.15
Updated@babel/traverse@^7.23.7
Updated@babel/types@^7.23.6
Updatedconvert-source-map@^2.0.0
Updatedjson5@^2.2.3
Updatedsemver@^6.3.1