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

@pixeleye/cli-config

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixeleye/cli-config - npm Package Compare versions

Comparing version 0.4.9 to 0.5.0

24

dist/index.js

@@ -35,2 +35,3 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {

import { fileURLToPath } from "node:url";
import fb from "fast-glob";
var _filename = typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url);

@@ -66,3 +67,3 @@ var jiti = null;

}
function readConfig(path) {
function readFile(path) {
let config = function() {

@@ -94,3 +95,3 @@ try {

const relativePath = join(process.cwd(), path ?? "");
let userConfig = readConfig(relativePath);
let userConfig = readFile(relativePath);
if (typeof userConfig === "function") {

@@ -110,2 +111,6 @@ userConfig = await userConfig().catch((err) => {

const merged = mergeObjects(defaultConfig, userConfig);
if (typeof merged.snapshotFiles === "function") {
const { snapshotFiles: _, ...rest } = merged;
merged.snapshotFiles = await merged.snapshotFiles(rest);
}
for (const key of Object.keys(merged)) {

@@ -120,2 +125,13 @@ if (typeof merged[key] === "string") {

}
async function readSnapshotFiles(files) {
const fileNames = await fb(files, {
absolute: true
});
return Promise.all(
fileNames.map(async (fileName) => {
const content = readFile(fileName);
return typeof content === "function" ? content() : content;
})
).then((results) => results.flat());
}

@@ -142,3 +158,5 @@ // src/getConfig.ts

getEnvConfig,
loadConfig
loadConfig,
readFile,
readSnapshotFiles
};

4

dist/loadConfig.d.ts

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

import { Config } from "./types";
import { Config, SnapshotDefinition } from "./types";
export declare function readFile<T>(path: string): T | (() => Promise<T>);
export declare function loadConfig(path?: string): Promise<Config>;
export declare function readSnapshotFiles(files: string[]): Promise<SnapshotDefinition[]>;
//# sourceMappingURL=loadConfig.d.ts.map
import { DeviceDescriptor } from "@pixeleye/cli-devices";
export type DomEnvironment = "jsdom" | "happy-dom";
export type SnapshotDefinition = {
/**
* The URL that you want to capture a screenshot of.
*/
url: string;
/**
* The name of the snapshot.
* We default to the URL if no name is provided.
*/
name?: string;
/**
* The variant of the snapshot.
* This will make up part of the snapshots name.
* @example "Dark"
*/
variant?: string;
/**
* Provide an array of css selectors and we will wait for it before capturing the screenshot.
* Unlike `selector`, we won't only capture this selector. We just wait for it.
* `waitForSelectors` is waited for before `selector`.
*/
waitForSelectors?: string[];
/**
* Provide a css selector and we wait for it and only capture the screenshot of the element.
* `waitForSelectors` is waited for before `selector`.
*/
selector?: string;
/**
* A list of css selectors that you want to mask.
* We will mask these elements with the color defined in the config.
*/
maskSelectors?: string[];
/**
* Mask color for this snapshot.
* This will override the mask color defined in the config.
*/
maskColor?: string;
/**
* Should we capture the full page? If true, we will capture the entire page.
*
* @default false
*/
fullPage?: boolean;
/**
* The css that you want to inject into the page before capturing the screenshot.
* This will be combined with the css defined in the config.
* @example "body { background-color: red; }"
*/
css?: string;
};
export type StorybookVariant = {

@@ -70,3 +119,10 @@ /**

};
/**
* An array of file matchers which contain snapshot definition files
*
* @example ['./snaps.pixeleye.ts', './src/*.pixeleye.ts']
*/
snapshotFiles?: string[] | ((config: ConfigWithoutSnapshotFiles) => Promise<string[]>);
};
export type ConfigWithoutSnapshotFiles = Omit<Config, "snapshotFiles">;
//# sourceMappingURL=types.d.ts.map
{
"name": "@pixeleye/cli-config",
"version": "0.4.9",
"version": "0.5.0",
"private": false,

@@ -25,2 +25,3 @@ "license": "AGPL-3.0",

"dependencies": {
"fast-glob": "^3.3.2",
"jiti": "^1.21.0",

@@ -27,0 +28,0 @@ "sucrase": "^3.35.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

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