Socket
Socket
Sign inDemoInstall

@babel/helper-fixtures

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-fixtures - npm Package Compare versions

Comparing version 7.21.4-esm.2 to 7.21.4-esm.3

80

lib/index.js

@@ -1,10 +0,18 @@

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));
"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));
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, " ");

@@ -20,3 +28,3 @@ }

function assertDirectory(loc) {
if (!fs.statSync(loc).isDirectory()) {
if (!_fs.statSync(loc).isDirectory()) {
throw new Error(`Expected ${loc} to be a directory.`);

@@ -29,4 +37,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";

@@ -39,3 +47,3 @@ }

const name = filepath + ext;
if (fs.existsSync(name)) matches.push(name);
if (_fs.existsSync(name)) matches.push(name);
}

@@ -49,7 +57,7 @@ if (matches.length > 1) {

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}`);

@@ -66,7 +74,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;

@@ -81,3 +89,3 @@ execLoc = taskDir;

taskDir,
optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null,
optionsDir: taskOptsLoc ? _path.dirname(taskOptsLoc) : null,
title: humanize(taskName, true),

@@ -120,7 +128,7 @@ disabled: taskName[0] === "." || taskOpts.BABEL_8_BREAKING === true,

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;

@@ -148,3 +156,3 @@ }

const sourceMapLoc = taskDir + "/source-map.json";
if (fs.existsSync(sourceMapLoc)) {
if (_fs.existsSync(sourceMapLoc)) {
test.sourceMap = JSON.parse(readFile(sourceMapLoc));

@@ -158,3 +166,3 @@ }

const inputMapLoc = taskDir + "/input-source-map.json";
if (fs.existsSync(inputMapLoc)) {
if (_fs.existsSync(inputMapLoc)) {
test.inputSourceMap = JSON.parse(readFile(inputMapLoc));

@@ -192,3 +200,3 @@ }

}
val[0] = path.resolve(optionsDir, val[0]);
val[0] = _path.resolve(optionsDir, val[0]);
} else {

@@ -200,4 +208,4 @@ let name = val[0];

}
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)) {
const monorepoPath = _path.join(_path.dirname(__filename), "../../..", name.startsWith("codemod") ? "codemods" : "packages", `babel-${type}-${name}/lib/index.js`);
if (_fs.existsSync(monorepoPath)) {
if (match) {

@@ -212,3 +220,3 @@ throw new Error(`Remove the "${match[1]}" prefix from "${val[0]}", to load it from the monorepo`);

}
export function resolveOptionPluginOrPreset(options, optionsDir) {
function resolveOptionPluginOrPreset(options, optionsDir) {
if (options.plugins) {

@@ -227,3 +235,3 @@ options.plugins = wrapPackagesArray("plugin", options.plugins, optionsDir);

}
export default function get(entryLoc) {
function get(entryLoc) {
const suites = [];

@@ -233,3 +241,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;

@@ -248,3 +256,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);

@@ -255,7 +263,7 @@ }

}
export function multiple(entryLoc, ignore) {
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);

@@ -266,5 +274,5 @@ categories[name] = get(loc);

}
export function readFile(filename) {
if (fs.existsSync(filename)) {
let file = fs.readFileSync(filename, "utf8").trimRight();
function readFile(filename) {
if (_fs.existsSync(filename)) {
let file = _fs.readFileSync(filename, "utf8").trimRight();
file = file.replace(/\r\n/g, "\n");

@@ -271,0 +279,0 @@ return file;

{
"name": "@babel/helper-fixtures",
"version": "7.21.4-esm.2",
"version": "7.21.4-esm.3",
"description": "Helper function to support fixtures",

@@ -5,0 +5,0 @@ "author": "The Babel Team (https://babel.dev/team)",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc