サンプル
bare-module-resolve 1.12.4: resolve
検証済みサンプル — npm bare-module-resolve 1.12.4: resolve. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: resolve yields candidate URLs for relative…
sha256:fbf384c14256eb5d992d14cde6fc44d99714aea20cb8013c91270eef2d2d1638
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
ケース
HOW- ゴール
- verify pkg:npm/bare-module-resolve@1.12.4
- シンボル
-
- resolve
- 作成日
- 2026-08-27T13:12:58Z
コントラクト
- resolve yields candidate URLs for relative paths and appends configured file extensions and directory index files
- resolve queries package.json via readPackage and resolves package main entry point
- resolve handles package exports conditions and subpath patterns
- resolve supports async iteration when readPackage returns a promise
- resolve throws ModuleResolveError with INVALID_MODULE_SPECIFIER for invalid package specifiers
- resolve throws ModuleResolveError with PACKAGE_PATH_NOT_EXPORTED when subpath is not in exports
ファイル
- PROMPT.md
- csx.json
- 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 pkg:npm/bare-module-resolve@1.12.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-module-resolve@1.12.4
Demonstrate these symbols/APIs:
- resolve
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:1fafac81d27032e1582d7618a0e8ddc8340211a97f954729b226eb2f6e208657","contract":["resolve yields candidate URLs for relative paths and appends configured file extensions and directory index files","resolve queries package.json via readPackage and resolves package main entry point","resolve handles package exports conditions and subpath patterns","resolve supports async iteration when readPackage returns a promise","resolve throws ModuleResolveError with INVALID_MODULE_SPECIFIER for invalid package specifiers","resolve throws ModuleResolveError with PACKAGE_PATH_NOT_EXPORTED when subpath is not in exports"],"goal":"verify pkg:npm/bare-module-resolve@1.12.4","kind":"HOW","packages":["pkg:npm/bare-module-resolve@1.12.4"],"schemaVersion":1,"symbols":["resolve"]},"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/bare-module-resolve@1.12.4"],"schemaVersion":1,"subject":"pkg:npm/bare-module-resolve@1.12.4","symbols":["resolve"],"verifierAdapter":"node-typescript@1"}
{
"name": "bare-module-resolve-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "bare-module-resolve-sample",
"version": "1.0.0",
"dependencies": {
"bare-module-resolve": "1.12.4"
}
},
"node_modules/bare-module-resolve": {
"version": "1.12.4",
"resolved": "https://registry.npmjs.org/bare-module-resolve/-/bare-module-resolve-1.12.4.tgz",
"integrity": "sha512-xcfgg2u7HqgJiBmah71O9vvdFAgHCvkqC/WSC2O7Bbgosoc1eC/BWe/6IDJ4OsfKlkxuvC/TDWXC+oH5yeW8mA==",
"license": "Apache-2.0",
"dependencies": {
"bare-semver": "^1.0.0"
},
"peerDependencies": {
"bare-url": "*"
},
"peerDependenciesMeta": {
"bare-url": {
"optional": true
}
}
},
"node_modules/bare-semver": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/bare-semver/-/bare-semver-1.1.0.tgz",
"integrity": "sha512-1Hw5qJ7hXdVt3uPUqjeFTuxyvBUJauvz5A1I2jk8gzjZMHp04n//6nV9MDbG9CMw78JHY2lGV0w6s//LrASm2w==",
"license": "Apache-2.0"
}
}
}
{
"name": "bare-module-resolve-sample",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for bare-module-resolve",
"dependencies": {
"bare-module-resolve": "1.12.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/bare-module-resolve@1.12.4",
"kind": "HOW",
"packages": [
"pkg:npm/bare-module-resolve@1.12.4"
],
"symbols": [
"resolve"
]
}
import assert from 'node:assert';
import resolve from 'bare-module-resolve';
// 1. resolve yields candidate URLs for relative paths and appends configured file extensions and directory index files
const parentURL = new URL('file:///workspace/project/src/app.js');
const relativeCandidates = [...resolve('./helpers', parentURL, { extensions: ['.js', '.json'] })];
assert.deepStrictEqual(relativeCandidates.map((u) => u.href), [
'file:///workspace/project/src/helpers',
'file:///workspace/project/src/helpers.js',
'file:///workspace/project/src/helpers.json',
'file:///workspace/project/src/helpers/index.js',
'file:///workspace/project/src/helpers/index.json'
]);
// 2. resolve queries package.json via readPackage and resolves package main entry point
const packageCandidates = [
...resolve('example-lib', parentURL, { extensions: ['.js'] }, (packageURL) => {
if (packageURL.href === 'file:///workspace/project/node_modules/example-lib/package.json') {
return {
name: 'example-lib',
main: './lib/index.js'
};
}
return null;
})
];
assert.strictEqual(
packageCandidates[0].href,
'file:///workspace/project/node_modules/example-lib/lib/index.js'
);
// 3. resolve handles package exports conditions and subpath patterns
const exportCandidates = [
...resolve(
'example-pkg/feature/sub',
parentURL,
{ conditions: ['import', 'node', 'default'] },
(packageURL) => {
if (packageURL.href === 'file:///workspace/project/node_modules/example-pkg/package.json') {
return {
name: 'example-pkg',
exports: {
'.': {
import: './esm/index.js',
require: './cjs/index.cjs'
},
'./feature/*': {
import: './esm/features/*.js',
default: './cjs/features/*.cjs'
}
}
};
}
return null;
}
)
];
assert.strictEqual(
exportCandidates[0].href,
'file:///workspace/project/node_modules/example-pkg/esm/features/sub.js'
);
// 4. resolve supports async iteration when readPackage returns a promise
const asyncResults = [];
for await (const candidate of resolve('async-pkg', parentURL, {}, async (packageURL) => {
if (packageURL.href === 'file:///workspace/project/node_modules/async-pkg/package.json') {
return {
name: 'async-pkg',
main: './dist/bundle.js'
};
}
return null;
})) {
asyncResults.push(candidate);
}
assert.strictEqual(
asyncResults[0].href,
'file:///workspace/project/node_modules/async-pkg/dist/bundle.js'
);
// 5. resolve throws ModuleResolveError with INVALID_MODULE_SPECIFIER for invalid package specifiers
assert.throws(
() => {
[...resolve('', parentURL)];
},
(err) => {
return err.name === 'ModuleResolveError' && err.code === 'INVALID_MODULE_SPECIFIER';
}
);
// 6. resolve throws ModuleResolveError with PACKAGE_PATH_NOT_EXPORTED when subpath is not in exports
assert.throws(
() => {
[
...resolve('example-pkg/unexported', parentURL, {}, (packageURL) => {
if (packageURL.href === 'file:///workspace/project/node_modules/example-pkg/package.json') {
return {
name: 'example-pkg',
exports: {
'./valid': './dist/valid.js'
}
};
}
return null;
})
];
},
(err) => {
return err.name === 'ModuleResolveError' && err.code === 'PACKAGE_PATH_NOT_EXPORTED';
}
);
console.log('Contract passed');
オリジンシーダー
匿名