@babel/helper-fixtures
Advanced tools
Comparing version 7.13.13 to 7.14.5
@@ -11,16 +11,16 @@ "use strict"; | ||
var _url = require("url"); | ||
var _semver = require("semver"); | ||
var _module = require("module"); | ||
var _path = require("path"); | ||
const semver = require("semver"); | ||
var _fs = require("fs"); | ||
const path = require("path"); | ||
var _url = require("url"); | ||
const fs = require("fs"); | ||
var _module = require("module"); | ||
const nodeVersion = semver.clean(process.version.slice(1)); | ||
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, " "); | ||
@@ -38,3 +38,3 @@ } | ||
function assertDirectory(loc) { | ||
if (!fs.statSync(loc).isDirectory()) { | ||
if (!_fs.statSync(loc).isDirectory()) { | ||
throw new Error(`Expected ${loc} to be a directory.`); | ||
@@ -49,4 +49,6 @@ } | ||
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"; | ||
@@ -62,3 +64,3 @@ } | ||
const name = filepath + ext; | ||
if (fs.existsSync(name)) matches.push(name); | ||
if (_fs.existsSync(name)) matches.push(name); | ||
} | ||
@@ -76,3 +78,4 @@ | ||
const taskDirStats = fs.statSync(taskDir); | ||
const taskDirStats = _fs.statSync(taskDir); | ||
let actualLoc = findFile(taskDir + "/input"); | ||
@@ -82,3 +85,3 @@ 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}`); | ||
@@ -97,8 +100,12 @@ } | ||
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; | ||
@@ -113,3 +120,3 @@ execLoc = taskDir; | ||
const test = { | ||
optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, | ||
optionsDir: taskOptsLoc ? _path.dirname(taskOptsLoc) : null, | ||
title: humanize(taskName, true), | ||
@@ -151,3 +158,3 @@ disabled: taskName[0] === "." || taskOpts.BABEL_8_BREAKING === true, | ||
if (taskOpts.minNodeVersion) { | ||
const minimumVersion = semver.clean(taskOpts.minNodeVersion); | ||
const minimumVersion = _semver.clean(taskOpts.minNodeVersion); | ||
@@ -158,3 +165,3 @@ if (minimumVersion == null) { | ||
if (semver.lt(nodeVersion, minimumVersion)) { | ||
if (_semver.lt(nodeVersion, minimumVersion)) { | ||
return; | ||
@@ -191,3 +198,3 @@ } | ||
if (fs.existsSync(sourceMappingsLoc)) { | ||
if (_fs.existsSync(sourceMappingsLoc)) { | ||
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); | ||
@@ -198,3 +205,3 @@ } | ||
if (fs.existsSync(sourceMapLoc)) { | ||
if (_fs.existsSync(sourceMapLoc)) { | ||
test.sourceMap = JSON.parse(readFile(sourceMapLoc)); | ||
@@ -205,3 +212,3 @@ } | ||
if (fs.existsSync(inputMapLoc)) { | ||
if (_fs.existsSync(inputMapLoc)) { | ||
test.inputSourceMap = JSON.parse(readFile(inputMapLoc)); | ||
@@ -252,7 +259,7 @@ } | ||
val[0] = path.resolve(optionsDir, val[0]); | ||
val[0] = _path.resolve(optionsDir, val[0]); | ||
} else { | ||
const monorepoPath = path.join(path.dirname(__filename), "../..", `babel-${type}-${val[0]}`); | ||
const monorepoPath = _path.join(_path.dirname(__filename), "../..", `babel-${type}-${val[0]}`); | ||
if (fs.existsSync(monorepoPath)) { | ||
if (_fs.existsSync(monorepoPath)) { | ||
val[0] = monorepoPath; | ||
@@ -290,3 +297,3 @@ } | ||
for (const suiteName of fs.readdirSync(entryLoc)) { | ||
for (const suiteName of _fs.readdirSync(entryLoc)) { | ||
if (shouldIgnore(suiteName)) continue; | ||
@@ -307,3 +314,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); | ||
@@ -319,5 +326,7 @@ } | ||
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); | ||
@@ -331,4 +340,5 @@ categories[name] = get(loc); | ||
function readFile(filename) { | ||
if (fs.existsSync(filename)) { | ||
let file = fs.readFileSync(filename, "utf8").trimRight(); | ||
if (_fs.existsSync(filename)) { | ||
let file = _fs.readFileSync(filename, "utf8").trimRight(); | ||
file = file.replace(/\r\n/g, "\n"); | ||
@@ -335,0 +345,0 @@ return file; |
{ | ||
"name": "@babel/helper-fixtures", | ||
"version": "7.13.13", | ||
"version": "7.14.5", | ||
"description": "Helper function to support fixtures", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"author": "The Babel Team (https://babel.dev/team)", | ||
"license": "MIT", | ||
@@ -16,3 +16,3 @@ "publishConfig": { | ||
"homepage": "https://babel.dev/docs/en/next/babel-helper-fixtures", | ||
"main": "lib/index.js", | ||
"main": "./lib/index.js", | ||
"dependencies": { | ||
@@ -23,3 +23,6 @@ "semver": "^6.3.0" | ||
"@types/semver": "^7.3.4" | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
} | ||
} |
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
10772