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

v8r

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v8r - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

8

CHANGELOG.md
# Changelog
## 📦 [4.2.0](https://www.npmjs.com/package/v8r/v/4.2.0) - 2024-10-24
* Add `V8R_CONFIG_FILE` environment variable.
This allows loading a config file from a location other than the directory v8r is invoked from.
More info: https://chris48s.github.io/v8r/configuration/
## 📦 [4.1.0](https://www.npmjs.com/package/v8r/v/4.1.0) - 2024-08-25

@@ -7,3 +13,3 @@

More info: https://chris48s.github.io/v8r/usage-examples/#files-containing-multiple-documents
* The `parseInputFile()` plugin hook may now tionally return an array of `Document` objects
* The `parseInputFile()` plugin hook may now conditionally return an array of `Document` objects
* The `ValidationResult` object now contains a `documentIndex` property.

@@ -10,0 +16,0 @@ This identifies the document when a multi-doc file has been validated.

2

package.json
{
"name": "v8r",
"version": "4.1.0",
"version": "4.2.0",
"description": "A command-line JSON, YAML and TOML validator that's on your wavelength",

@@ -5,0 +5,0 @@ "scripts": {

@@ -1,2 +0,2 @@

import { createRequire } from "module";
import { createRequire } from "node:module";
// TODO: once JSON modules is stable these requires could become imports

@@ -3,0 +3,0 @@ // https://nodejs.org/api/esm.html#esm_experimental_json_modules

@@ -1,2 +0,2 @@

import { createRequire } from "module";
import { createRequire } from "node:module";
// TODO: once JSON modules is stable these requires could become imports

@@ -6,6 +6,6 @@ // https://nodejs.org/api/esm.html#esm_experimental_json_modules

import fs from "node:fs";
import path from "node:path";
import { cosmiconfig } from "cosmiconfig";
import decamelize from "decamelize";
import isUrl from "is-url";
import path from "path";
import yargs from "yargs";

@@ -21,23 +21,24 @@ import { hideBin } from "yargs/helpers";

function preProcessConfig(configFile) {
if (!configFile?.config?.customCatalog?.schemas) {
return;
}
for (const schema of configFile.config.customCatalog.schemas) {
if (!path.isAbsolute(schema.location) && !isUrl(schema.location)) {
schema.location = path.join(
path.dirname(configFile.filepath),
schema.location,
);
async function getCosmiConfig(cosmiconfigOptions) {
let configFile;
if (process.env.V8R_CONFIG_FILE) {
if (!fs.existsSync(process.env.V8R_CONFIG_FILE)) {
throw new Error(`File ${process.env.V8R_CONFIG_FILE} does not exist.`);
}
configFile = await cosmiconfig("v8r", cosmiconfigOptions).load(
process.env.V8R_CONFIG_FILE,
);
} else {
cosmiconfigOptions.stopDir = process.cwd();
configFile = (await cosmiconfig("v8r", cosmiconfigOptions).search(
process.cwd(),
)) || { config: {} };
}
}
async function getCosmiConfig(cosmiconfigOptions) {
cosmiconfigOptions.stopDir = process.cwd();
const configFile = (await cosmiconfig("v8r", cosmiconfigOptions).search(
process.cwd(),
)) || { config: {} };
if (configFile.filepath) {
logger.info(`Loaded config file from ${getRelativeFilePath(configFile)}`);
logger.info(
`Patterns and relative paths will be resolved relative to current working directory: ${process.cwd()}`,
);
} else {

@@ -205,3 +206,2 @@ logger.info(`No config file found`);

validateConfigOutputFormats(configFile, outputFormats);
preProcessConfig(configFile);

@@ -219,8 +219,2 @@ // parse command line arguments

export {
bootstrap,
getDocumentFormats,
getOutputFormats,
parseArgs,
preProcessConfig,
};
export { bootstrap, getDocumentFormats, getOutputFormats, parseArgs };

@@ -0,3 +1,3 @@

import path from "node:path";
import { minimatch } from "minimatch";
import path from "path";
import { validate } from "./ajv.js";

@@ -4,0 +4,0 @@ import { getFromUrlOrFile } from "./io.js";

@@ -0,5 +1,5 @@

import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import flatCache from "flat-cache";
import fs from "fs";
import os from "os";
import path from "path";
import isUrl from "is-url";

@@ -6,0 +6,0 @@ import { validate } from "./ajv.js";

@@ -1,2 +0,2 @@

import { createRequire } from "module";
import { createRequire } from "node:module";
// TODO: once JSON modules is stable these requires could become imports

@@ -3,0 +3,0 @@ // https://nodejs.org/api/esm.html#esm_experimental_json_modules

@@ -1,3 +0,3 @@

import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import isUrl from "is-url";

@@ -4,0 +4,0 @@ import { parseSchema } from "./parser.js";

@@ -1,2 +0,2 @@

import path from "path";
import path from "node:path";
import yaml from "js-yaml";

@@ -3,0 +3,0 @@ import { Document } from "./plugins.js";

@@ -1,2 +0,2 @@

import path from "path";
import path from "node:path";

@@ -3,0 +3,0 @@ /**

@@ -7,2 +7,3 @@ import flatCache from "flat-cache";

const testCacheName = process.env.V8R_CACHE_NAME;
const env = process.env;

@@ -15,2 +16,3 @@ function setUp() {

logger.writeErr = function () {};
process.env = { ...env };
}

@@ -24,2 +26,3 @@

logger.writeErr = origWriteErr;
process.env = env;
}

@@ -26,0 +29,0 @@

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