snappy-prerender 2.6.0-rc.3 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +191 -0
- package/README.md +149 -107
- package/docs/limitations.md +58 -0
- package/docs/react-snap-migration.md +45 -0
- package/docs/report.md +102 -0
- package/package.json +9 -5
- package/src/cli-init.js +205 -0
- package/src/cli.js +159 -168
- package/src/core/artifacts.js +112 -0
- package/src/core/audit/index.js +114 -0
- package/src/core/audit/links.js +63 -0
- package/src/core/audit/metadata.js +88 -0
- package/src/core/audit/sitemap.js +39 -0
- package/src/core/blocking.js +53 -1
- package/src/core/browser.js +109 -39
- package/src/core/build-origin.js +19 -0
- package/src/core/config.js +256 -6
- package/src/core/crawl.js +300 -0
- package/src/core/csp.js +127 -0
- package/src/core/css-url.js +34 -0
- package/src/core/destination.js +28 -3
- package/src/core/frameworks.js +94 -0
- package/src/core/hydration-diff.js +93 -0
- package/src/core/init.js +187 -31
- package/src/core/inline-css.js +34 -13
- package/src/core/metadata-origin.js +11 -2
- package/src/core/normalize.js +59 -2
- package/src/core/output.js +32 -9
- package/src/core/page-content.js +13 -0
- package/src/core/page-meta.js +108 -0
- package/src/core/preload-links.js +120 -0
- package/src/core/preload-manifest.js +61 -7
- package/src/core/prune.js +65 -0
- package/src/core/render.js +147 -11
- package/src/core/report.js +108 -0
- package/src/core/resources.js +6 -1
- package/src/core/route-config.js +17 -0
- package/src/core/route-sources.js +209 -0
- package/src/core/routes.js +9 -0
- package/src/core/run.js +186 -358
- package/src/core/server.js +30 -4
- package/src/core/sitemap.js +128 -20
- package/src/core/url-policy.js +32 -0
- package/src/core/verify.js +103 -49
- package/src/core/write.js +363 -0
- package/src/head/index.js +2 -2
- package/src/head/manager.js +54 -13
- package/src/head/tags.js +71 -32
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
|
|
6
|
+
uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Earlier history predates
|
|
7
|
+
the release tags; see the Git history for those changes.
|
|
8
|
+
|
|
9
|
+
## [2.7.0] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Site audit for route health, links, metadata, sitemap and CSP. Findings are report-only
|
|
14
|
+
unless `failOnAuditError` is set; `auditIgnoreLinks` excludes dynamic links.
|
|
15
|
+
- `reportPath` / `--report` writes a versioned JSON report with per-route records, audit,
|
|
16
|
+
verification, sitemap, preload manifest, truncation and traces.
|
|
17
|
+
- `routesFile` and `routesFromSitemap` seed routes from text, JSON or a sitemap. Sitemap
|
|
18
|
+
indexes are followed one level, and relative paths resolve against the config file.
|
|
19
|
+
- Deterministic BFS crawling when `maxRoutes` or `routePriority` is set.
|
|
20
|
+
`truncated.droppedRoutes` lists the routes that did not fit.
|
|
21
|
+
- `routeOverrides` for per-route timeout, wait, readiness, crawl and storage state.
|
|
22
|
+
- `transformHtml`, sync or async, runs before preload and CSP injection.
|
|
23
|
+
- Framework detection for React, Vue, Svelte and Preact, with framework-specific hydration
|
|
24
|
+
messages and `firstMismatch` details.
|
|
25
|
+
- `preloadLinks` for runtime chunks, fonts and the LCP image.
|
|
26
|
+
- Sitemap hreflang alternates, image entries and `sitemap.locs` in the report.
|
|
27
|
+
- Head JSON-LD, `lang`/`dir` and hreflang alternates.
|
|
28
|
+
- App-declared 404 pages via `<meta name="prerender-status-code" content="404">`.
|
|
29
|
+
- `csp: 'hash'` adds a meta policy with SHA-256 hashes for inline scripts and styles.
|
|
30
|
+
- `retries`, `retryDelay` and `traceOnError` for failed renders.
|
|
31
|
+
- `init` migration for a legacy `reactSnap` block.
|
|
32
|
+
- CLI flags and documentation for the new options.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Verification reports the detected framework and uses its hydration message patterns.
|
|
37
|
+
- SVG `<title>` elements are no longer counted as page titles.
|
|
38
|
+
- Page metadata, audit findings and sitemap entries use the final HTML after transform and
|
|
39
|
+
preload injection.
|
|
40
|
+
- Route sources resolve relative paths against the config file. Sitemap base and origin
|
|
41
|
+
handling is stricter.
|
|
42
|
+
- The JSON report includes the verification summary, uses crawl acceptance order for
|
|
43
|
+
`order`, and redacts credentials, query strings and the storage-state path.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- A configured `notFoundRoute` may return HTTP 404 and is still written as `404.html`;
|
|
48
|
+
verification accepts that status for the same route.
|
|
49
|
+
- An explicit `framework` selects its hydration message patterns during verification.
|
|
50
|
+
- A non-string `transformHtml` result fails that route with a clear error.
|
|
51
|
+
- `routeOverrides` ignores undefined values instead of clearing base settings.
|
|
52
|
+
- `audit.linksChecked` counts every link pair considered, and route-health findings are
|
|
53
|
+
included in the audit.
|
|
54
|
+
- `preloadLinks` does not preload scripts removed by `removeScriptTags` or `transformHtml`.
|
|
55
|
+
- CSP hash mode warns when the generated policy blocks a browser request.
|
|
56
|
+
- `init` normalises a single-string `reactSnap.include`.
|
|
57
|
+
- The image sitemap collects `srcset` and `<picture><source>` candidates.
|
|
58
|
+
- New no-op option combinations produce configuration warnings.
|
|
59
|
+
|
|
60
|
+
## [2.6.0] - 2026-10-27
|
|
61
|
+
|
|
62
|
+
### Added
|
|
63
|
+
|
|
64
|
+
- `cleanDestination` empties the destination before copying the build output, so assets
|
|
65
|
+
removed from a build do not linger.
|
|
66
|
+
- `pruneStaleRoutes` removes pages recorded by the previous run's `.snappy-manifest.json`
|
|
67
|
+
when they are no longer produced, without touching assets or user files.
|
|
68
|
+
- New build gates: `failOnEmptyPage` (on by default), `failOnConsoleError`,
|
|
69
|
+
`failOnFailedRequest`, `failOnDuplicateContent`, `failOnUndetected`,
|
|
70
|
+
`failOnVerificationError` and the optional `failOnBuildOriginMetadata`.
|
|
71
|
+
- `browserDownloadVersion` pins the Chrome for Testing build id; a cached build is now
|
|
72
|
+
used without contacting the version feed, so offline rebuilds work.
|
|
73
|
+
- `stripBuildOriginMetadata` removes canonical and social tags that point at the
|
|
74
|
+
prerender server instead of shipping loopback URLs.
|
|
75
|
+
- Reports now expose `consoleErrors`, `failedRequests`, `emptyPages`, `duplicatePages`
|
|
76
|
+
and `pruned`; page files carry `noindex`, and verification entries carry `status` and
|
|
77
|
+
`empty`.
|
|
78
|
+
- CLI flags for the new gates and for `quietPeriod`, `scrollStepDelay`,
|
|
79
|
+
`serveCmdTimeout`, `shutdownTimeout`, `maxCachedBytes`, `viewport`, `readyFlag`,
|
|
80
|
+
`readySelector`, `headless`, `cleanDestination` and `metadata.base`.
|
|
81
|
+
- A Node 22/24 test workflow and a dedicated integration suite for the audit fixes.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- **Breaking:** the minimum supported Node version is now 22.12, matching
|
|
86
|
+
`@puppeteer/browsers`.
|
|
87
|
+
- **Breaking:** an explicit `browser` choice no longer falls back to another engine.
|
|
88
|
+
`chromium` uses a Playwright-managed Chromium and asks you to install it when missing;
|
|
89
|
+
`auto` is the only choice that walks machine, Playwright cache, cached Chrome for
|
|
90
|
+
Testing, then download.
|
|
91
|
+
- **Breaking:** `include` is a true output allowlist. A wildcard-only list still seeds the
|
|
92
|
+
root for crawling, but the seed itself is not written. Passing `include: ['/']` is
|
|
93
|
+
treated as the default and leaves crawling enabled.
|
|
94
|
+
- **Breaking:** canonical, Open Graph and sitemap URLs share one page-path policy:
|
|
95
|
+
directory output keeps its trailing slash, flat output stays extensionless, and an
|
|
96
|
+
explicit `trailingSlash` wins.
|
|
97
|
+
- **Breaking:** sitemap entries no longer carry `lastmod` (a build date claimed every page
|
|
98
|
+
changed), noindex pages are excluded, and sitemaps above 50,000 URLs are split behind a
|
|
99
|
+
sitemap index.
|
|
100
|
+
- **Breaking:** `metadata.siteUrl` must be an origin without a path; sub-path deployments
|
|
101
|
+
belong in `base`. A `serveCmd` URL with a path is rejected for the same reason.
|
|
102
|
+
- **Breaking:** `removeStyleTags` combined with `inlineCss: 'inline'` or `true` is
|
|
103
|
+
rejected instead of silently removing the CSS that was just inlined.
|
|
104
|
+
- Empty output now fails a route by default; 404 pages are emitted with a robots
|
|
105
|
+
`noindex` tag.
|
|
106
|
+
- Third-party blocking now covers WebSockets and accepts hostnames with ports, wildcard
|
|
107
|
+
suffixes and leading-dot suffixes. Service workers are blocked during rendering and
|
|
108
|
+
verification.
|
|
109
|
+
- Verification uses a real browser user agent and the same reduced-motion context as the
|
|
110
|
+
render pass; mode counts are always logged and can fail the build with
|
|
111
|
+
`failOnUndetected`.
|
|
112
|
+
- Inlined stylesheets rebase relative `url()` values against their source stylesheet;
|
|
113
|
+
sheets using `@import` stay linked to preserve the cascade.
|
|
114
|
+
- Preload manifests are derived from the final HTML, so inline CSS, tag surgery and failed
|
|
115
|
+
writes no longer leave stale hints. The not-found route is omitted.
|
|
116
|
+
- Screenshots use the same unchanged-file check as HTML and dry runs report the image file
|
|
117
|
+
instead of an HTML one.
|
|
118
|
+
- `init` reads Vite's resolved `outDir` and `base`, and Create React App's `homepage`, so
|
|
119
|
+
the wizard no longer guesses `dist` and `/` for custom projects. During a prerelease it
|
|
120
|
+
prints the `@next` install tag.
|
|
121
|
+
- Unknown config keys and options that have no effect in the current combination now
|
|
122
|
+
produce warnings instead of being ignored silently.
|
|
123
|
+
- Rendered output is split across smaller modules; `run.js` is back under the 600-line
|
|
124
|
+
limit.
|
|
125
|
+
|
|
126
|
+
### Fixed
|
|
127
|
+
|
|
128
|
+
- `setHead` called an undefined helper and threw `ReferenceError`.
|
|
129
|
+
- HTTP 4xx/5xx navigations, empty pages and zero-route runs could be written and reported
|
|
130
|
+
as successful; they now fail with route-level errors.
|
|
131
|
+
- The static server served `index.html` for dead extensionless links and failed dotted
|
|
132
|
+
routes; HTML navigations now fall back deliberately and duplicate output is detected.
|
|
133
|
+
- Canonical and `og:url` doubled a non-root `base` path.
|
|
134
|
+
- `verifyChangedOnly` could skip a changed page when a shared state script was unchanged.
|
|
135
|
+
- `asyncScriptTags` marked the injected state script `async`, allowing it to run after the
|
|
136
|
+
application bundle.
|
|
137
|
+
- `removeAttributes` with a global or sticky RegExp skipped every other match.
|
|
138
|
+
- Output collisions that differ only by case are detected on case-insensitive
|
|
139
|
+
filesystems.
|
|
140
|
+
- A destination inside the source directory recursed until the path length limit.
|
|
141
|
+
- Inlined CSS lost relative font and image URLs.
|
|
142
|
+
- Build-server metadata shipped loopback canonical and social URLs.
|
|
143
|
+
- Preload manifests described resources the final page no longer loaded.
|
|
144
|
+
- Sitemap and canonical URLs disagreed on trailing slashes and flat output.
|
|
145
|
+
- Allowed-host matching ignored ports and wildcards, and WebSocket requests bypassed
|
|
146
|
+
blocking.
|
|
147
|
+
- Browser downloads needed the network even when a cached browser was available.
|
|
148
|
+
- The CLI advertised `--preconnect-third-party` without defining it, and several other
|
|
149
|
+
documented flags had no CLI equivalent.
|
|
150
|
+
|
|
151
|
+
## [2.6.0-rc.3] - 2026-10-03
|
|
152
|
+
|
|
153
|
+
### Added
|
|
154
|
+
|
|
155
|
+
- Computed config files: `snappy.config.js` may export an async function that returns
|
|
156
|
+
options, so routes can come from a CMS, sitemap or file listing.
|
|
157
|
+
- Sitemap generation and the `sitemap` option.
|
|
158
|
+
- Stable output: unchanged pages, state scripts and artifacts are left untouched.
|
|
159
|
+
- React 16.8 and 17 fixtures and integration coverage.
|
|
160
|
+
|
|
161
|
+
### Changed
|
|
162
|
+
|
|
163
|
+
- Documentation links to the npm package and notes the release-candidate channel.
|
|
164
|
+
|
|
165
|
+
## [2.6.0-rc.2] - 2026-09-26
|
|
166
|
+
|
|
167
|
+
### Added
|
|
168
|
+
|
|
169
|
+
- `snappy-prerender init` setup wizard, with flags for non-interactive use.
|
|
170
|
+
- CSP-friendly output: `csp: 'off' | 'strict'`, `externalScripts` and configurable
|
|
171
|
+
`criticalCssPreload`.
|
|
172
|
+
|
|
173
|
+
## [2.6.0-rc.1] - 2026-09-26
|
|
174
|
+
|
|
175
|
+
### Added
|
|
176
|
+
|
|
177
|
+
- The `snappy-prerender/head` entry point: `Head`, `setHead`, `clearHead`, metadata
|
|
178
|
+
defaults, canonical, Open Graph and Twitter tags, and client-side reconciliation.
|
|
179
|
+
- Head-layer audit fixes for tag ownership, restoration and repeated runs.
|
|
180
|
+
|
|
181
|
+
## [2.5.0] - 2026-09-25
|
|
182
|
+
|
|
183
|
+
### Added
|
|
184
|
+
|
|
185
|
+
- react-snap feature parity for v2: `inlineCss`, `minifyHtml`, `minifyCss`,
|
|
186
|
+
`preloadImages`, `cacheAjaxRequests`, `snapSaveState`, `preloadManifest`,
|
|
187
|
+
`removeBlobs`, `removeStyleTags`, `removeScriptTags`, `asyncScriptTags`,
|
|
188
|
+
`destination`, `saveAs`, `browserArgs` and `ignoreHTTPSErrors`.
|
|
189
|
+
- Hydration verification that reports `hydrated`, `re-rendered`, `undetected` and
|
|
190
|
+
`unknown`, plus per-route React mismatch messages.
|
|
191
|
+
- Third-party requests allowed by default, with opt-in blocking and host allowlists.
|