Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/helper-fixtures

Package Overview
Dependencies
Maintainers
6
Versions
101
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.0.0-beta.42 to 7.0.0-beta.43

245

lib/index.js
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = get;

@@ -8,26 +10,98 @@ exports.multiple = multiple;

var _assert = _interopRequireDefault(require("assert"));
function _assert() {
const data = _interopRequireDefault(require("assert"));
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
_assert = function () {
return data;
};
var _trimEnd = _interopRequireDefault(require("lodash/trimEnd"));
return data;
}
var _tryResolve = _interopRequireDefault(require("try-resolve"));
function _cloneDeep() {
const data = _interopRequireDefault(require("lodash/cloneDeep"));
var _clone = _interopRequireDefault(require("lodash/clone"));
_cloneDeep = function () {
return data;
};
var _extend = _interopRequireDefault(require("lodash/extend"));
return data;
}
var _semver = _interopRequireDefault(require("semver"));
function _trimEnd() {
const data = _interopRequireDefault(require("lodash/trimEnd"));
var _path = _interopRequireDefault(require("path"));
_trimEnd = function () {
return data;
};
var _fs = _interopRequireDefault(require("fs"));
return data;
}
function _tryResolve() {
const data = _interopRequireDefault(require("try-resolve"));
_tryResolve = function () {
return data;
};
return data;
}
function _clone() {
const data = _interopRequireDefault(require("lodash/clone"));
_clone = function () {
return data;
};
return data;
}
function _extend() {
const data = _interopRequireDefault(require("lodash/extend"));
_extend = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var nodeVersion = _semver.default.clean(process.version.slice(1));
const nodeVersion = _semver().default.clean(process.version.slice(1));
function humanize(val, noext) {
if (noext) val = _path.default.basename(val, _path.default.extname(val));
if (noext) val = _path().default.basename(val, _path().default.extname(val));
return val.replace(/-/g, " ");

@@ -37,4 +111,4 @@ }

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

@@ -48,5 +122,5 @@ }

var ext = _path.default.extname(name);
const ext = _path().default.extname(name);
var base = _path.default.basename(name, ext);
const base = _path().default.basename(name, ext);

@@ -57,11 +131,11 @@ return name[0] === "." || ext === ".md" || base === "LICENSE" || base === "options";

function get(entryLoc) {
var suites = [];
var rootOpts = {};
var rootOptsLoc = (0, _tryResolve.default)(entryLoc + "/options");
const suites = [];
let rootOpts = {};
const rootOptsLoc = (0, _tryResolve().default)(entryLoc + "/options");
if (rootOptsLoc) rootOpts = require(rootOptsLoc);
var _loop = function _loop(suiteName) {
if (shouldIgnore(suiteName)) return "continue";
var suite = {
options: (0, _clone.default)(rootOpts),
for (const suiteName of _fs().default.readdirSync(entryLoc)) {
if (shouldIgnore(suiteName)) continue;
const suite = {
options: (0, _clone().default)(rootOpts),
tests: [],

@@ -73,35 +147,23 @@ title: humanize(suiteName),

suites.push(suite);
var suiteOptsLoc = (0, _tryResolve.default)(suite.filename + "/options");
const suiteOptsLoc = (0, _tryResolve().default)(suite.filename + "/options");
if (suiteOptsLoc) suite.options = require(suiteOptsLoc);
for (var _iterator2 = _fs.default.readdirSync(suite.filename), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var _taskName = _ref2;
push(_taskName, suite.filename + "/" + _taskName);
for (const taskName of _fs().default.readdirSync(suite.filename)) {
push(taskName, suite.filename + "/" + taskName);
}
function push(taskName, taskDir) {
var actualLocAlias = suiteName + "/" + taskName + "/input.js";
var expectLocAlias = suiteName + "/" + taskName + "/output.js";
var execLocAlias = suiteName + "/" + taskName + "/exec.js";
var actualLoc = taskDir + "/input.js";
var expectLoc = taskDir + "/output.js";
var execLoc = taskDir + "/exec.js";
let actualLocAlias = suiteName + "/" + taskName + "/input.js";
let expectLocAlias = suiteName + "/" + taskName + "/output.js";
let execLocAlias = suiteName + "/" + taskName + "/exec.js";
let actualLoc = taskDir + "/input.js";
let expectLoc = taskDir + "/output.js";
let execLoc = taskDir + "/exec.js";
var hasExecJS = _fs.default.existsSync(execLoc);
const hasExecJS = _fs().default.existsSync(execLoc);
var hasExecMJS = _fs.default.existsSync(asMJS(execLoc));
const hasExecMJS = _fs().default.existsSync(asMJS(execLoc));
if (hasExecMJS) {
(0, _assert.default)(!hasExecJS, asMJS(execLoc) + ": Found conflicting .js");
(0, _assert().default)(!hasExecJS, `${asMJS(execLoc)}: Found conflicting .js`);
execLoc = asMJS(execLoc);

@@ -111,8 +173,8 @@ execLocAlias = asMJS(execLocAlias);

var hasExpectJS = _fs.default.existsSync(expectLoc);
const hasExpectJS = _fs().default.existsSync(expectLoc);
var hasExpectMJS = _fs.default.existsSync(asMJS(expectLoc));
const hasExpectMJS = _fs().default.existsSync(asMJS(expectLoc));
if (hasExpectMJS) {
(0, _assert.default)(!hasExpectJS, asMJS(expectLoc) + ": Found conflicting .js");
(0, _assert().default)(!hasExpectJS, `${asMJS(expectLoc)}: Found conflicting .js`);
expectLoc = asMJS(expectLoc);

@@ -122,8 +184,8 @@ expectLocAlias = asMJS(expectLocAlias);

var hasActualJS = _fs.default.existsSync(actualLoc);
const hasActualJS = _fs().default.existsSync(actualLoc);
var hasActualMJS = _fs.default.existsSync(asMJS(actualLoc));
const hasActualMJS = _fs().default.existsSync(asMJS(actualLoc));
if (hasActualMJS) {
(0, _assert.default)(!hasActualJS, asMJS(actualLoc) + ": Found conflicting .js");
(0, _assert().default)(!hasActualJS, `${asMJS(actualLoc)}: Found conflicting .js`);
actualLoc = asMJS(actualLoc);

@@ -133,4 +195,4 @@ actualLocAlias = asMJS(actualLocAlias);

if (_fs.default.statSync(taskDir).isFile()) {
var ext = _path.default.extname(taskDir);
if (_fs().default.statSync(taskDir).isFile()) {
const ext = _path().default.extname(taskDir);

@@ -142,3 +204,3 @@ if (ext !== ".js" && ext !== ".mjs") return;

if (_tryResolve.default.relative(expectLoc + "on")) {
if (_tryResolve().default.relative(expectLoc + "on")) {
expectLoc += "on";

@@ -148,7 +210,7 @@ expectLocAlias += "on";

var taskOpts = (0, _cloneDeep.default)(suite.options);
var taskOptsLoc = (0, _tryResolve.default)(taskDir + "/options");
if (taskOptsLoc) (0, _extend.default)(taskOpts, require(taskOptsLoc));
var test = {
optionsDir: taskOptsLoc ? _path.default.dirname(taskOptsLoc) : null,
const taskOpts = (0, _cloneDeep().default)(suite.options);
const taskOptsLoc = (0, _tryResolve().default)(taskDir + "/options");
if (taskOptsLoc) (0, _extend().default)(taskOpts, require(taskOptsLoc));
const test = {
optionsDir: taskOptsLoc ? _path().default.dirname(taskOptsLoc) : null,
title: humanize(taskName, true),

@@ -175,9 +237,9 @@ disabled: taskName[0] === ".",

if (taskOpts.minNodeVersion) {
var minimumVersion = _semver.default.clean(taskOpts.minNodeVersion);
const minimumVersion = _semver().default.clean(taskOpts.minNodeVersion);
if (minimumVersion == null) {
throw new Error("'minNodeVersion' has invalid semver format: " + taskOpts.minNodeVersion);
throw new Error(`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`);
}
if (_semver.default.lt(nodeVersion, minimumVersion)) {
if (_semver().default.lt(nodeVersion, minimumVersion)) {
return;

@@ -194,33 +256,14 @@ }

suite.tests.push(test);
var sourceMappingsLoc = taskDir + "/source-mappings.json";
const sourceMappingsLoc = taskDir + "/source-mappings.json";
if (_fs.default.existsSync(sourceMappingsLoc)) {
if (_fs().default.existsSync(sourceMappingsLoc)) {
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc));
}
var sourceMapLoc = taskDir + "/source-map.json";
const sourceMapLoc = taskDir + "/source-map.json";
if (_fs.default.existsSync(sourceMapLoc)) {
if (_fs().default.existsSync(sourceMapLoc)) {
test.sourceMap = JSON.parse(readFile(sourceMapLoc));
}
}
};
for (var _iterator = _fs.default.readdirSync(entryLoc), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var suiteName = _ref;
var _ret = _loop(suiteName);
if (_ret === "continue") continue;
}

@@ -232,23 +275,11 @@

function multiple(entryLoc, ignore) {
var categories = {};
const categories = {};
for (var _iterator3 = _fs.default.readdirSync(entryLoc), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
for (const name of _fs().default.readdirSync(entryLoc)) {
if (shouldIgnore(name, ignore)) continue;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
const loc = _path().default.join(entryLoc, name);
var _name = _ref3;
if (shouldIgnore(_name, ignore)) continue;
var _loc2 = _path.default.join(entryLoc, _name);
assertDirectory(_loc2);
categories[_name] = get(_loc2);
assertDirectory(loc);
categories[name] = get(loc);
}

@@ -264,4 +295,4 @@

function readFile(filename) {
if (_fs.default.existsSync(filename)) {
var file = (0, _trimEnd.default)(_fs.default.readFileSync(filename, "utf8"));
if (_fs().default.existsSync(filename)) {
let file = (0, _trimEnd().default)(_fs().default.readFileSync(filename, "utf8"));
file = file.replace(/\r\n/g, "\n");

@@ -268,0 +299,0 @@ return file;

{
"name": "@babel/helper-fixtures",
"version": "7.0.0-beta.42",
"version": "7.0.0-beta.43",
"description": "Helper function to support fixtures",

@@ -5,0 +5,0 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

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