@babel/helper-fixtures
Advanced tools
Comparing version 7.22.9 to 8.0.0-alpha.0
@@ -1,18 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = get; | ||
exports.multiple = multiple; | ||
exports.readFile = readFile; | ||
exports.resolveOptionPluginOrPreset = resolveOptionPluginOrPreset; | ||
var _semver = require("semver"); | ||
var _path = require("path"); | ||
var _fs = require("fs"); | ||
var _url = require("url"); | ||
var _module = require("module"); | ||
const nodeVersion = _semver.clean(process.version.slice(1)); | ||
import semver from "semver"; | ||
import path from "path"; | ||
import fs from "fs"; | ||
import { fileURLToPath } from "url"; | ||
import { createRequire } from "module"; | ||
const require = createRequire(import.meta.url); | ||
const nodeVersion = semver.clean(process.version.slice(1)); | ||
function humanize(val, noext) { | ||
if (noext) val = _path.basename(val, _path.extname(val)); | ||
if (noext) val = path.basename(val, path.extname(val)); | ||
return val.replace(/-/g, " "); | ||
@@ -28,3 +20,3 @@ } | ||
function assertDirectory(loc) { | ||
if (!_fs.statSync(loc).isDirectory()) { | ||
if (!fs.statSync(loc).isDirectory()) { | ||
throw new Error(`Expected ${loc} to be a directory.`); | ||
@@ -37,4 +29,4 @@ } | ||
} | ||
const ext = _path.extname(name); | ||
const base = _path.basename(name, ext); | ||
const ext = path.extname(name); | ||
const base = path.basename(name, ext); | ||
return name[0] === "." || ext === ".md" || base === "LICENSE" || base === "options" || name === "package.json"; | ||
@@ -49,3 +41,3 @@ } | ||
const name = filepath + ext; | ||
if (_fs.existsSync(name)) matches.push(name); | ||
if (fs.existsSync(name)) matches.push(name); | ||
} | ||
@@ -58,8 +50,7 @@ if (matches.length > 1) { | ||
function pushTask(taskName, taskDir, suite, suiteName) { | ||
var _taskOpts$externalHel; | ||
const taskDirStats = _fs.statSync(taskDir); | ||
const taskDirStats = fs.statSync(taskDir); | ||
let actualLoc = findFile(taskDir + "/input"); | ||
let execLoc = findFile(taskDir + "/exec"); | ||
if (taskDirStats.isDirectory() && !actualLoc && !execLoc) { | ||
if (_fs.readdirSync(taskDir).length > 0) { | ||
if (fs.readdirSync(taskDir).length > 0) { | ||
console.warn(`Skipped test folder with invalid layout: ${taskDir}`); | ||
@@ -76,7 +67,7 @@ } | ||
const stderrLoc = taskDir + "/stderr.txt"; | ||
const actualLocAlias = suiteName + "/" + taskName + "/" + _path.basename(actualLoc); | ||
const expectLocAlias = suiteName + "/" + taskName + "/" + _path.basename(actualLoc); | ||
let execLocAlias = suiteName + "/" + taskName + "/" + _path.basename(actualLoc); | ||
const actualLocAlias = suiteName + "/" + taskName + "/" + path.basename(actualLoc); | ||
const expectLocAlias = suiteName + "/" + taskName + "/" + path.basename(actualLoc); | ||
let execLocAlias = suiteName + "/" + taskName + "/" + path.basename(actualLoc); | ||
if (taskDirStats.isFile()) { | ||
const ext = _path.extname(taskDir); | ||
const ext = path.extname(taskDir); | ||
if (EXTENSIONS.indexOf(ext) === -1) return; | ||
@@ -91,8 +82,8 @@ execLoc = taskDir; | ||
taskDir, | ||
optionsDir: taskOptsLoc ? _path.dirname(taskOptsLoc) : null, | ||
optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, | ||
title: humanize(taskName, true), | ||
disabled: taskName[0] === "." || taskOpts.BABEL_8_BREAKING === true, | ||
disabled: taskName[0] === "." || taskOpts.BABEL_8_BREAKING === false, | ||
options: taskOpts, | ||
doNotSetSourceType: taskOpts.DO_NOT_SET_SOURCE_TYPE, | ||
externalHelpers: (_taskOpts$externalHel = taskOpts.externalHelpers) != null ? _taskOpts$externalHel : !!tryResolve("@babel/plugin-external-helpers"), | ||
externalHelpers: taskOpts.externalHelpers ?? !!tryResolve("@babel/plugin-external-helpers"), | ||
validateLogs: taskOpts.validateLogs, | ||
@@ -130,7 +121,7 @@ ignoreOutput: taskOpts.ignoreOutput, | ||
if (taskOpts.minNodeVersion) { | ||
const minimumVersion = _semver.clean(taskOpts.minNodeVersion); | ||
const minimumVersion = semver.clean(taskOpts.minNodeVersion); | ||
if (minimumVersion == null) { | ||
throw new Error(`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`); | ||
} | ||
if (_semver.lt(nodeVersion, minimumVersion)) { | ||
if (semver.lt(nodeVersion, minimumVersion)) { | ||
return; | ||
@@ -158,3 +149,3 @@ } | ||
const sourceMapLoc = taskDir + "/source-map.json"; | ||
if (_fs.existsSync(sourceMapLoc)) { | ||
if (fs.existsSync(sourceMapLoc)) { | ||
test.sourceMap = JSON.parse(readFile(sourceMapLoc)); | ||
@@ -168,3 +159,3 @@ } | ||
const inputMapLoc = taskDir + "/input-source-map.json"; | ||
if (_fs.existsSync(inputMapLoc)) { | ||
if (fs.existsSync(inputMapLoc)) { | ||
test.inputSourceMap = JSON.parse(readFile(inputMapLoc)); | ||
@@ -202,3 +193,3 @@ } | ||
} | ||
val[0] = _path.resolve(optionsDir, val[0]); | ||
val[0] = path.resolve(optionsDir, val[0]); | ||
} else { | ||
@@ -210,4 +201,4 @@ let name = val[0]; | ||
} | ||
const monorepoPath = _path.join(_path.dirname(__filename), "../../..", name.startsWith("codemod") ? "codemods" : "packages", `babel-${type}-${name}/lib/index.js`); | ||
if (_fs.existsSync(monorepoPath)) { | ||
const monorepoPath = path.join(path.dirname(fileURLToPath(import.meta.url)), "../../..", name.startsWith("codemod") ? "codemods" : "packages", `babel-${type}-${name}/lib/index.js`); | ||
if (fs.existsSync(monorepoPath)) { | ||
if (match) { | ||
@@ -222,3 +213,3 @@ throw new Error(`Remove the "${match[1]}" prefix from "${val[0]}", to load it from the monorepo`); | ||
} | ||
function resolveOptionPluginOrPreset(options, optionsDir) { | ||
export function resolveOptionPluginOrPreset(options, optionsDir) { | ||
if (options.overrides) { | ||
@@ -248,3 +239,3 @@ for (const subOption of options.overrides) { | ||
} | ||
function get(entryLoc) { | ||
export default function get(entryLoc) { | ||
const suites = []; | ||
@@ -254,3 +245,3 @@ let rootOpts = {}; | ||
if (rootOptsLoc) rootOpts = require(rootOptsLoc); | ||
for (const suiteName of _fs.readdirSync(entryLoc)) { | ||
for (const suiteName of fs.readdirSync(entryLoc)) { | ||
if (shouldIgnore(suiteName)) continue; | ||
@@ -269,3 +260,3 @@ const suite = { | ||
} | ||
for (const taskName of _fs.readdirSync(suite.filename)) { | ||
for (const taskName of fs.readdirSync(suite.filename)) { | ||
pushTask(taskName, suite.filename + "/" + taskName, suite, suiteName); | ||
@@ -276,7 +267,7 @@ } | ||
} | ||
function multiple(entryLoc, ignore) { | ||
export function multiple(entryLoc, ignore) { | ||
const categories = {}; | ||
for (const name of _fs.readdirSync(entryLoc)) { | ||
for (const name of fs.readdirSync(entryLoc)) { | ||
if (shouldIgnore(name, ignore)) continue; | ||
const loc = _path.join(entryLoc, name); | ||
const loc = path.join(entryLoc, name); | ||
assertDirectory(loc); | ||
@@ -287,5 +278,5 @@ categories[name] = get(loc); | ||
} | ||
function readFile(filename) { | ||
if (_fs.existsSync(filename)) { | ||
let file = _fs.readFileSync(filename, "utf8").trimRight(); | ||
export function readFile(filename) { | ||
if (fs.existsSync(filename)) { | ||
let file = fs.readFileSync(filename, "utf8").trimRight(); | ||
file = file.replace(/\r\n/g, "\n"); | ||
@@ -292,0 +283,0 @@ return file; |
{ | ||
"name": "@babel/helper-fixtures", | ||
"version": "7.22.9", | ||
"version": "8.0.0-alpha.0", | ||
"description": "Helper function to support fixtures", | ||
@@ -18,3 +18,3 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"semver": "^6.3.1" | ||
"semver": "^7.3.4" | ||
}, | ||
@@ -25,5 +25,9 @@ "devDependencies": { | ||
"engines": { | ||
"node": ">=6.9.0" | ||
"node": "^16.20.0 || ^18.16.0 || >=20.0.0" | ||
}, | ||
"type": "commonjs" | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"type": "module" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Yes
37421
324
1
+ Addedsemver@7.6.3(transitive)
- Removedsemver@6.3.1(transitive)
Updatedsemver@^7.3.4