diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 20:23:12 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | 12d7a38ba0f1b1e4e301fce81e22f4b93036d211 (patch) | |
| tree | 003ad2b341e887dd7e102d0b1dad9f580bdef70a /src/util/js-template.ts | |
| parent | 2b3eb8ad79d2fed770cf665cff1cc746951a95d3 (diff) | |
refactor(util): strip comment noise
Removes file-header banners and comments that restate the code. Keeps
one-line notes at the optional-sharp dynamic import, the sharp .default
probe, the `never` contravariance trick, the sanctioned renderCall cast,
and safeJs's interpolation rule.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/util/js-template.ts')
| -rw-r--r-- | src/util/js-template.ts | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/util/js-template.ts b/src/util/js-template.ts index 392dbc0..75e0217 100644 --- a/src/util/js-template.ts +++ b/src/util/js-template.ts @@ -1,19 +1,4 @@ -/** - * Build a JavaScript source string with safely-interpolated values. - * Every interpolated value is JSON.stringify'd, so strings, numbers, - * objects, and special characters all become valid JS literals. - * - * This is the ONLY supported way to interpolate untrusted values into - * evaluation source — never use raw template literals for JS that - * crosses the CDP boundary. The static parts of the template (the - * `strings` array) must remain hard-coded; only the `${...}` slots - * are sanitized. - * - * Values must be JSON-serializable: BigInt and Symbol throw at runtime; - * functions and undefined serialize to `undefined`/omitted, which yields - * a ReferenceError when evaluated. Pass strings, numbers, booleans, - * plain objects, or arrays. - */ +// The ONLY supported way to interpolate untrusted values into evaluation source — never use raw template literals for JS crossing the CDP boundary. export const safeJs = ( strings: TemplateStringsArray, ...values: ReadonlyArray<unknown> |
