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

@stoplight/spectral

Package Overview
Dependencies
Maintainers
18
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/spectral - npm Package Compare versions

Comparing version 4.1.1-beta3 to 4.1.1-beta4

14

dist/cli/commands/lint.js
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const yargs_1 = require("yargs");

@@ -80,3 +70,3 @@ const lodash_1 = require("lodash");

handler: args => {
const _a = args, { document, ruleset, format, output, encoding } = _a, config = __rest(_a, ["document", "ruleset", "format", "output", "encoding"]);
const _a = args, { document, ruleset, format, output, encoding } = _a, config = tslib_1.__rest(_a, ["document", "ruleset", "format", "output", "encoding"]);
return linter_1.lint(document, Object.assign({ format, output, encoding }, lodash_1.pick(config, ['ruleset', 'skipRule', 'verbose', 'quiet'])), ruleset)

@@ -83,0 +73,0 @@ .then(results => {

14

dist/cli/services/linter.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path_1 = require("@stoplight/path");

@@ -21,3 +13,3 @@ const yaml_1 = require("@stoplight/yaml");

function loadRulesets(cwd, rulesetFiles) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (rulesetFiles.length === 0) {

@@ -34,3 +26,3 @@ return {

function lint(name, flags, rulesetFile) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (flags.verbose) {

@@ -37,0 +29,0 @@ console.info(`Linting ${name}`);

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fs_1 = require("fs");

@@ -24,3 +16,3 @@ const util_1 = require("util");

function writeOutput(outputStr, outputFile) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (outputFile) {

@@ -27,0 +19,0 @@ return writeFileAsync(outputFile, outputStr);

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./json"));
__export(require("./stylish"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./json"), exports);
tslib_1.__exportStar(require("./stylish"), exports);
//# sourceMappingURL=index.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path_1 = require("@stoplight/path");

@@ -17,3 +9,3 @@ const fs = require("fs");

function readFile(name, opts) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
if (path_1.isURL(name)) {

@@ -72,3 +64,3 @@ let response;

function readParsable(name, opts) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
try {

@@ -75,0 +67,0 @@ return yield readFile(name, opts);

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./spectral"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./spectral"), exports);
//# sourceMappingURL=index.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const json_ref_resolver_1 = require("@stoplight/json-ref-resolver");

@@ -16,3 +8,3 @@ const fetch = require('node-fetch');

resolve(ref) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (yield fetch(String(ref))).text();

@@ -19,0 +11,0 @@ });

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path = require("@stoplight/path");

@@ -17,3 +9,3 @@ const fs = require("fs");

function resolveSpectralVersion(pkg) {
return String(pkg).replace('@stoplight/spectral', '@stoplight/spectral@4.1.1-beta3');
return String(pkg).replace('@stoplight/spectral', '@stoplight/spectral@4.1.1-beta4');
}

@@ -29,3 +21,3 @@ function resolveFromNPM(pkg) {

function resolveFromFS(from, to) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
let targetPath;

@@ -46,3 +38,3 @@ if (SPECTRAL_SRC_ROOT.length > 0 && SPECTRAL_SRC_ROOT !== '/' && to.startsWith('@stoplight/spectral')) {

function findFile(from, to) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const mapped = map_1.filesMap.get(to);

@@ -49,0 +41,0 @@ if (mapped !== void 0) {

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./mergers"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./mergers"), exports);
var reader_1 = require("./reader");

@@ -8,0 +6,0 @@ exports.readRuleset = reader_1.readRuleset;

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./formats"));
__export(require("./functions"));
__export(require("./rules"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./formats"), exports);
tslib_1.__exportStar(require("./functions"), exports);
tslib_1.__exportStar(require("./rules"), exports);
//# sourceMappingURL=index.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const reader_1 = require("../reader");

@@ -25,3 +17,3 @@ exports.commonOasFunctions = () => {

};
exports.rules = () => __awaiter(void 0, void 0, void 0, function* () {
exports.rules = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
console.warn('This is deprecated. Use loadRuleset method instead');

@@ -28,0 +20,0 @@ return (yield reader_1.readRuleset(require.resolve('./index.json'))).rules;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const reader_1 = require("../reader");
var oas_1 = require("../oas");
exports.oas2Functions = oas_1.commonOasFunctions;
exports.rules = () => __awaiter(void 0, void 0, void 0, function* () {
exports.rules = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
console.warn('This is deprecated. Use loadRuleset method instead');

@@ -17,0 +9,0 @@ return (yield reader_1.readRuleset(require.resolve('./index.json'))).rules;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const reader_1 = require("../reader");
var oas_1 = require("../oas");
exports.oas3Functions = oas_1.commonOasFunctions;
exports.rules = () => __awaiter(void 0, void 0, void 0, function* () {
exports.rules = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
console.warn('This is deprecated. Use loadRuleset method instead');

@@ -17,0 +9,0 @@ return (yield reader_1.readRuleset(require.resolve('./index.json'))).rules;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const json_ref_resolver_1 = require("@stoplight/json-ref-resolver");

@@ -21,3 +13,3 @@ const path_1 = require("@stoplight/path");

function readRuleset(uris, opts) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const base = {

@@ -43,3 +35,3 @@ rules: {},

return function processRuleset(baseUri, uri, severity) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const rulesetUri = yield finder_1.findFile(path_1.join(baseUri, '..'), uri);

@@ -58,3 +50,3 @@ if (processedRulesets.has(rulesetUri)) {

parseResolveResult(opts) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
try {

@@ -103,3 +95,3 @@ opts.result = yaml_1.parse(opts.result);

const resolvedFunctions = {};
yield Promise.all(rulesetFunctions.map((fn) => __awaiter(this, void 0, void 0, function* () {
yield Promise.all(rulesetFunctions.map((fn) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const fnName = Array.isArray(fn) ? fn[0] : fn;

@@ -106,0 +98,0 @@ const fnSchema = Array.isArray(fn) ? fn[1] : null;

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const json_1 = require("@stoplight/json");

@@ -37,3 +17,3 @@ const json_ref_resolver_1 = require("@stoplight/json-ref-resolver");

const runner_1 = require("./runner");
__export(require("./types"));
tslib_1.__exportStar(require("./types"), exports);
class Spectral {

@@ -48,3 +28,3 @@ constructor(opts) {

};
this._parseResolveResult = (refDiagnostics) => (resolveOpts) => __awaiter(this, void 0, void 0, function* () {
this._parseResolveResult = (refDiagnostics) => (resolveOpts) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const ref = resolveOpts.targetAuthority.toString();

@@ -82,3 +62,3 @@ const ext = path_1.extname(ref);

runWithResolved(target, opts = {}) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
let results = [];

@@ -123,3 +103,3 @@ let parsedResult;

run(target, opts = {}) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (yield this.runWithResolved(target, opts)).results;

@@ -172,3 +152,3 @@ });

loadRuleset(uris, options) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
this.setRuleset(yield rulesets_1.readRuleset(Array.isArray(uris) ? uris : [uris], options));

@@ -210,13 +190,13 @@ });

}
__decorate([
tslib_1.__decorate([
deprecated_decorator_1.default('loadRuleset', '4.1'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object]),
tslib_1.__metadata("design:returntype", void 0)
], Spectral.prototype, "addFunctions", null);
__decorate([
tslib_1.__decorate([
deprecated_decorator_1.default('loadRuleset', '4.1'),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
tslib_1.__metadata("design:type", Function),
tslib_1.__metadata("design:paramtypes", [Object]),
tslib_1.__metadata("design:returntype", void 0)
], Spectral.prototype, "addRules", null);

@@ -223,0 +203,0 @@ exports.Spectral = Spectral;

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./enums"));
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./enums"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@stoplight/spectral",
"version": "4.1.1-beta3",
"version": "4.1.1-beta4",
"description": "A flexible object linter with out of the box support for OpenAPI v2 and v3.",

@@ -74,2 +74,3 @@ "keywords": [

"text-table": "^0.2",
"tslib": "^1.10.0",
"typescript-json-schema": "~0.40",

@@ -76,0 +77,0 @@ "yargs": "^14.0.0"

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 too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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