Skip to content

tech-detect: next/script props heuristic reads client components with a src or code-like prose (#1442 residual) #1444

Closed

Description

@nc9

Summary

Residual from the review of #1442 (Next.js flight scripts are read for the script elements they carry). A production Next build names the next/script component $L2 with a numeric module id, so the reader identifies it by its props: a strategy, an id with inline code, or a src. That shape can be matched by a client component that is not a script:

  • a component with an id and prose children that contain a ( and a ; or { (for example a note whose text mentions a vendor URL and some punctuation) is read as an inline loader;
  • any client component with a src prop (an embed, an avatar, a media wrapper) has its src read as a script URL.

So a vendor that the page only mentions or embeds as content can still be detected from a flight payload, narrower than before #1442 but not closed.

Acceptance Criteria

  • A client component with an id and prose children containing ( and ; (and no JavaScript token) is not read as an inline loader: a vendor URL in that prose does not detect the vendor, in a real next build fixture.
  • A client component with only a src prop (no strategy, no id) does not have its src read as a script URL.
  • A src on a component that also has a strategy or an id is still read, and the real-build loader positives (afterInteractive children, lazyOnload __html and src, body-placed, Next 14 and 15) are still detected.
  • String children of a component are read as code only when they contain a JavaScript token (function, =>, an assignment, .createElement, window.).
  • Tests cover parenthesised prose with an id, and a client component with a src, with the vendor URL as the only signal.
  • docs/cloud/technologies.mdx describes how a next/script component is recognised, accurately.

Activity

  1. added
    bug
    size: S
    rules
    on Oct 31, 2026
  2. added theissue type on Oct 31, 2026
  3. nc9 commented on Oct 31, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.152 (826306d7), verified against main: every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.152

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions