샘플
react-dom 19.0.0: prefetchDNS
검증된 샘플 — npm react-dom 19.0.0: prefetchDNS. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: prefetchDNS is exported as a function from the…
sha256:2b246636f26f5629ab93a00dfb4c86ce71b601494e06aa1e00c10aee89cd7d82
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
케이스
HOW- 목표
- verify react-dom.prefetchDNS in pkg:npm/react-dom@19.0.0
- 패키지
- 심벌
-
- react-dom.prefetchDNS
- 생성일
- 2026-09-07T00:09:07Z
컨트랙트
- prefetchDNS is exported as a function from the react-dom entrypoint
- prefetchDNS returns undefined and accepts a target origin string
- calling prefetchDNS during server rendering emits a link rel="dns-prefetch" element
- subsequent prefetchDNS calls with the same URL are deduplicated in rendered output
- prefetchDNS calls with different URLs emit distinct link elements for each origin
- imperative invocation of prefetchDNS outside of render pass executes without error
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify react-dom.prefetchDNS in pkg:npm/react-dom@19.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-dom@19.0.0
Demonstrate these symbols/APIs:
- react-dom.prefetchDNS
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:bab6a2627e8d99d273d23b424418117e38f2efb62ec96a89b6b8ef252e27ad88","contract":["prefetchDNS is exported as a function from the react-dom entrypoint","prefetchDNS returns undefined and accepts a target origin string","calling prefetchDNS during server rendering emits a link rel=\"dns-prefetch\" element","subsequent prefetchDNS calls with the same URL are deduplicated in rendered output","prefetchDNS calls with different URLs emit distinct link elements for each origin","imperative invocation of prefetchDNS outside of render pass executes without error"],"goal":"verify react-dom.prefetchDNS in pkg:npm/react-dom@19.0.0","kind":"HOW","packages":["pkg:npm/react-dom@19.0.0"],"schemaVersion":1,"symbols":["react-dom.prefetchDNS"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react-dom@19.0.0"],"schemaVersion":1,"subject":"pkg:npm/react-dom@19.0.0","symbols":["react-dom.prefetchDNS"],"verifierAdapter":"node-typescript@1"}
import { prefetchDNS } from 'react-dom';
/**
* Prefetches DNS for a given origin URL using ReactDOM.prefetchDNS.
*
* @param {string} href - The domain or origin URL to prefetch DNS for.
* @returns {void}
*/
export function triggerPrefetchDNS(href) {
return prefetchDNS(href);
}
export { prefetchDNS };
{
"name": "sample-react-dom-prefetchdns",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-dom-prefetchdns",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react": "19.0.0",
"react-dom": "19.0.0"
}
},
"node_modules/react": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz",
"integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/react-dom": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz",
"integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==",
"license": "MIT",
"dependencies": {
"scheduler": "^0.25.0"
},
"peerDependencies": {
"react": "^19.0.0"
}
},
"node_modules/scheduler": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz",
"integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==",
"license": "MIT"
}
}
}
{
"name": "sample-react-dom-prefetchdns",
"version": "1.0.0",
"description": "Clean-room sample verifying react-dom prefetchDNS",
"main": "index.js",
"type": "module",
"license": "MIT-0",
"dependencies": {
"react": "19.0.0",
"react-dom": "19.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify react-dom.prefetchDNS in pkg:npm/react-dom@19.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/react-dom@19.0.0"
],
"symbols": [
"react-dom.prefetchDNS"
]
}
import assert from 'node:assert/strict';
import React from 'react';
import * as ReactDOM from 'react-dom';
import { prefetchDNS } from 'react-dom';
import ReactDOMServer from 'react-dom/server';
import { triggerPrefetchDNS } from '../index.js';
// 1. prefetchDNS is exported as a function from the react-dom entrypoint
assert.equal(typeof ReactDOM.prefetchDNS, 'function', 'ReactDOM.prefetchDNS should be a function');
assert.equal(typeof prefetchDNS, 'function', 'prefetchDNS should be a function');
assert.equal(typeof triggerPrefetchDNS, 'function', 'triggerPrefetchDNS should be a function');
// 2. prefetchDNS returns undefined and accepts a target origin string
const ret = prefetchDNS('https://example.com');
assert.equal(ret, undefined, 'prefetchDNS must return undefined');
const helperRet = triggerPrefetchDNS('https://example.org');
assert.equal(helperRet, undefined, 'triggerPrefetchDNS helper must return undefined');
// 3. calling prefetchDNS during server rendering emits a link rel="dns-prefetch" element
function PageWithPrefetch() {
prefetchDNS('https://api.example.com');
return React.createElement('div', { id: 'app' }, 'hello world');
}
const html = ReactDOMServer.renderToString(React.createElement(PageWithPrefetch));
assert.match(
html,
/<link href="https:\/\/api\.example\.com" rel="dns-prefetch"\/>/,
'renderToString should emit dns-prefetch link'
);
assert.ok(html.includes('<div id="app">hello world</div>'), 'rendered HTML should include component content');
// 4. subsequent prefetchDNS calls with the same URL are deduplicated in rendered output
function PageWithDuplicatePrefetch() {
prefetchDNS('https://cdn.example.com');
prefetchDNS('https://cdn.example.com');
prefetchDNS('https://cdn.example.com');
return React.createElement('div', null, 'content');
}
const htmlDup = ReactDOMServer.renderToString(React.createElement(PageWithDuplicatePrefetch));
const matches = htmlDup.match(/<link href="https:\/\/cdn\.example\.com" rel="dns-prefetch"\/>/g);
assert.equal(matches?.length, 1, 'identical prefetchDNS calls should be deduplicated to a single link element');
// 5. prefetchDNS calls with different URLs emit distinct link elements for each origin
function PageWithMultiplePrefetches() {
prefetchDNS('https://cdn1.example.com');
prefetchDNS('https://cdn2.example.com');
return React.createElement('div', null, 'multi');
}
const htmlMulti = ReactDOMServer.renderToString(React.createElement(PageWithMultiplePrefetches));
assert.ok(htmlMulti.includes('<link href="https://cdn1.example.com" rel="dns-prefetch"/>'), 'should include first prefetch link');
assert.ok(htmlMulti.includes('<link href="https://cdn2.example.com" rel="dns-prefetch"/>'), 'should include second prefetch link');
// 6. imperative invocation of prefetchDNS outside of render pass executes without error
assert.doesNotThrow(() => {
prefetchDNS('https://offline.example.com');
}, 'prefetchDNS outside of render pass executes without error');
console.log('CONTRACT PASS: react-dom.prefetchDNS verified');
오리진 시더
익명