Repository navigation
Conversation
…cript, not its whole text #1437 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/flight-script-narrow-1437
branch
from
October 31, 2026 14:16
7264023 to
d8bcc2f
Compare
This was referenced Oct 31, 2026
Merged
Contributor
Author
|
Landed in v0.0.151 as nik |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1437.
A Next.js App Router flight script (
self.__next_f.push) was read as one block of text so the layout'snext/scriptloader is found. That also matched a vendor URL the page only renders as content (JSON-LDsameAs, meta description, CSP meta,<a href>, prose).packages/tech-detect/src/flight.ts: decodes thepush([1,"..."])chunks of ALL the page's flight scripts together (a production build splits them over many<script>elements and cuts rows mid-row), parses the rows and reads onlysrc,dangerouslySetInnerHTML.__htmland stringchildrenof ascriptelement or of anext/scriptcomponent. The component is identified by its props (strategy; oridwith__htmlor code-like children; or asrc), because a production build names it$L2with a numeric module id and nonext/scriptpath (the dev path form still counts). Data script types and every other element's props are not read. Bounded: 2 MB per script, 8 MB per page, depth 64, 400k nodes; no regex over the payload.push([1,"..."])chunk is read as an ordinary script (16 KB cap).self.__next_sis read like any ordinary inline script (16 KB cap).flight-script-narrow-1437.test.ts(34). Committed fixtures intests/fixtures/next-build/are realnext buildoutput (Next 15.5 and 14.2, App Router, production) with build hashes replaced: afterInteractive children, lazyOnload__html, lazyOnloadsrc, body-placed, Next 14, beforeInteractive inline and src, plain inline, and a 139 KB page with JSON-LDsameAs, link, meta and prose naming the vendor (no loader: not detected; with the loader: detected). 8 of the tests fail on the previous head of this PR. Synthetic cases cover each negative, split chunks, hostile payloads.The prior head of this PR lost the production
next/scriptloader (review: real Next 14 and 15 builds); this head fixes that and tests against real build output. The prose-children heuristic (idplus code-like children) is the one judgement call; a corpus run before release is still worthwhile.Skill: no change needed.
nik