Socket
Socket
Sign inDemoInstall

@percy/core

Package Overview
Dependencies
Maintainers
6
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/core - npm Package Compare versions

Comparing version 1.0.0-beta.76 to 1.0.0

38

package.json
{
"name": "@percy/core",
"version": "1.0.0-beta.76",
"version": "1.0.0",
"license": "MIT",

@@ -13,12 +13,20 @@ "repository": {

},
"main": "dist/index.js",
"types": "types/index.d.ts",
"engines": {
"node": ">=14"
},
"files": [
"dist",
"post-install.js",
"types/index.d.ts",
"test/helpers/server.js"
"./dist",
"./post-install.js",
"./types/index.d.ts",
"./test/helpers/server.js"
],
"engines": {
"node": ">=12"
"main": "./dist/index.js",
"types": "types/index.d.ts",
"type": "module",
"exports": {
".": "./dist/index.js",
"./utils": "./dist/utils.js",
"./config": "./dist/config.js",
"./install": "./dist/install.js",
"./test/helpers": "./test/helpers/index.js"
},

@@ -34,9 +42,11 @@ "scripts": {

"dependencies": {
"@percy/client": "1.0.0-beta.76",
"@percy/config": "1.0.0-beta.76",
"@percy/dom": "1.0.0-beta.76",
"@percy/logger": "1.0.0-beta.76",
"@percy/client": "1.0.0",
"@percy/config": "1.0.0",
"@percy/dom": "1.0.0",
"@percy/logger": "1.0.0",
"content-disposition": "^0.5.4",
"cross-spawn": "^7.0.3",
"extract-zip": "^2.0.1",
"fast-glob": "^3.2.11",
"micromatch": "^4.0.4",
"mime-types": "^2.1.34",

@@ -47,3 +57,3 @@ "path-to-regexp": "^6.2.0",

},
"gitHead": "445af68d8e270e2a35fc74e26422ed5d3c91d2ae"
"gitHead": "6df509421a60144e4f9f5d59dc57a5675372a0b2"
}

@@ -5,3 +5,3 @@ # @percy/core

assets, uploading snapshots, and finalizing builds. Uses `@percy/client` for API communication, a
Puppeteer browser for asset discovery, and starts a local API server for posting snapshots from
Chromium browser for asset discovery, and starts a local API server for posting snapshots from
other processes.

@@ -53,2 +53,3 @@

- `allowedHostnames` — Array of allowed hostnames to capture assets from
- `disallowedHostnames` — Array of hostnames where requests will be aborted
- `requestHeaders` — Request headers used when discovering snapshot assets

@@ -132,7 +133,10 @@ - `authorization` — Basic auth `username` and `password` for protected snapshot assets

Performs asset discovery for a snapshot and queues uploading the snapshot to the associated Percy
build. When an existing DOM snapshot is provided, it is served as the root resource during asset
discovery. When no existing DOM snapshot is provided, a new one will be captured using any provided
snapshot capture options.
Takes one or more snapshots of a page while discovering resources to upload with the snapshot. Once
asset discovery has completed, the queued snapshot will resolve and an upload task will be queued
separately. Accepts several different syntaxes for taking snapshots in various ways.
All available syntaxes will push snapshots into the snapshot queue without the need to await on the
method directly. This method resolves after the snapshot upload is queued, but does not await on the
upload to complete.
``` js

@@ -146,11 +150,8 @@ // snapshots can be handled concurrently, no need to await

environmentInfo: 'my-lib'
...snapshotOptions
})
// without a domSnapshot, capture options will be used to take one
percy.snapshot({
name: 'Snapshot 2',
url: 'http://localhost:3000/',
...snapshotOptions,
// without a domSnapshot, capture options will be used to take one
url: 'http://localhost:3000',
waitForTimeout: 1000,

@@ -161,6 +162,26 @@ waitForSelector: '.done-loading',

name: 'Snapshot 2.1',
execute: () => {},
...snapshotOptions
execute: () => {}
}]
})
// alternate shorthand syntax
percy.snapshot({
baseUrl: 'http://localhost:3000',
snapshots: ['/', '/about', '/contact'],
options: {
widths: [600, 1200]
}
})
// gather snapshots from an external sitemap
percy.snapshot({
sitemap: 'https://example.com/sitemap.xml',
exclude: ['/blog/*']
})
// start a server and take static snapshots
percy.snapshot({
serve: './public',
cleanUrls: true,
})
```

@@ -170,12 +191,19 @@

When capturing a single snapshot, the snapshot URL may be provided as the only argument rather than
a snapshot options object. When providing an options object, a few alternate syntaxes are available
depending on the provided properties ([see alternate syntaxes below](#alternate-syntaxes)).
**Common options** accepted for each snapshot:
- `url` — Snapshot URL (**required**)
- `name` — Snapshot name
- `domSnapshot` — Snapshot DOM string
- `clientInfo` — Additional client info
- `environmentInfo` — Additional environment info
- `discovery` - Limited snapshot specific discovery options
- `allowedHostnames`, `requestHeaders`, `authorization`, `disableCache`, `userAgent`
- `allowedHostnames`, `disallowedHostnames`, `requestHeaders`, `authorization`, `disableCache`, `userAgent`
**Capture options** can only be provided when `domSnapshot` is missing.
Common snapshot options are also accepted and will override instance snapshot options. [See instance
options](#options) for common snapshot and discovery options.
**Capture options** can only be provided when `domSnapshot` is missing:
- `waitForTimeout` — Milliseconds to wait before taking a snapshot

@@ -189,6 +217,46 @@ - `waitForSelector` — CSS selector to wait for before taking a snapshot

- `waitForTimeout`, `waitForSelector`, `execute` — See above
#### Alternate syntaxes
Common snapshot options are also accepted and will override instance snapshot options. [See instance
options](#options) for common snapshot and discovery options.
All snapshot syntaxes can be provided as items within an array. For example, a single method call
can upload multiple DOM snapshots, capture multiple external snapshots, crawl a sitemap for
snapshots, and host a local static server for snapshots.
**Shared options** accepted by all syntaxes:
- `clientInfo` — Client info to include with the build
- `environmentInfo` — Environment info to include with the build
The following alternate syntaxes may **not** be combined with snapshot options, but rather offer
alternate methods for taking multiple snapshots.
**List options** can only be provided when a top-level `snapshots` is present:
- `snapshots` — An array of snapshot URLs or snapshot options (**required**)
- `baseUrl` — The full base URL (including protocol) used when snapshot URLs only include a pathname
- `include`/`exclude` — Include and exclude matching snapshot names
- `options` — Additional options to apply to snapshots
- `include`/`exclude` — Include and exclude snapshots to apply these options to
- [Common snapshot and capture options](#options) (**excluding** `url`, `domSnapshot`)
**Sitemap options** can only be provided when a top-level `sitemap` is present:
- `sitemap` — The URL where an XML sitemap can be located (**required**)
- `include`/`exclude` — Include and exclude matching snapshot names
- `options` — Additional options to apply to snapshots
- `include`/`exclude` — Include and exclude snapshots to apply these options to
- [Common snapshot and capture options](#options) (**excluding** `url`, `domSnapshot`)
**Server options** can only be provided when a top-level `serve` is present:
- `serve` — The static directory to serve relative to the current working directory (**required**)
- `baseUrl` — The base URL to serve the directory at, starting with a forward slash (/)
- `cleanUrls` — Set to `true` to strip `.html` and `index.html` from served URLs
- `rewrites` — A source-destination map for rewriting source URLs into destination pathnames
- `snapshots` — An array of specific snapshots to take while serving the static directory
- `include`/`exclude` — Include and exclude matching snapshot names
- `options` — Additional options to apply to snapshots
- `include`/`exclude` — Include and exclude snapshots to apply these options to
- [Common snapshot and capture options](#options) (**excluding** `url`, `domSnapshot`)
## Advanced

@@ -195,0 +263,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