@percy/core
Advanced tools
Comparing version 1.0.0-beta.76 to 1.0.0
{ | ||
"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" | ||
} |
104
README.md
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
279
0
2
Yes
14811
13
3
0
+ Addedfast-glob@^3.2.11
+ Addedmicromatch@^4.0.4
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@percy/client@1.0.0(transitive)
+ Added@percy/config@1.0.0(transitive)
+ Added@percy/dom@1.0.0(transitive)
+ Added@percy/env@1.0.0(transitive)
+ Added@percy/logger@1.0.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removed@percy/client@1.0.0-beta.76(transitive)
- Removed@percy/config@1.0.0-beta.76(transitive)
- Removed@percy/dom@1.0.0-beta.76(transitive)
- Removed@percy/env@1.0.0-beta.76(transitive)
- Removed@percy/logger@1.0.0-beta.76(transitive)
Updated@percy/client@1.0.0
Updated@percy/config@1.0.0
Updated@percy/dom@1.0.0
Updated@percy/logger@1.0.0