示例
filelist 1.0.6
已验证示例 — npm filelist 1.0.6. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: FileList instance includes string filenames and array of filenames
sha256:74e0b73db78506aeadb79713c3d4afd6932ce67c833fa0ff110a4b956c4929e7
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| 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-26 |
案例
HOW- 目标
- verify pkg:npm/filelist@1.0.6
- 环境
- node 22.23.2
- 创建时间
- 2026-08-26T07:25:55Z
契约
- FileList instance includes string filenames and array of filenames
- exclude(string) removes exact matching files from the resolved file list
- exclude(RegExp) removes pattern matching files from the resolved file list
- exclude(Function) removes files that satisfy the predicate function
- shouldExclude(filename) returns true for excluded paths and false otherwise
- clearInclusions() resets pending additions before resolution
- clearExclusions() clears active exclusion patterns
- length() returns the number of resolved files in the list
- Array methods like map() return a new FileList instance with transformed items
- FileList.clone(fl) creates a cloned copy of the FileList
文件
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
源代码
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/filelist@1.0.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/filelist@1.0.6
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:8e54586697e18c168b6aa6352b1349cd8ff088ef0d304e256912e56fc5f4af42","contract":["FileList instance includes string filenames and array of filenames","exclude(string) removes exact matching files from the resolved file list","exclude(RegExp) removes pattern matching files from the resolved file list","exclude(Function) removes files that satisfy the predicate function","shouldExclude(filename) returns true for excluded paths and false otherwise","clearInclusions() resets pending additions before resolution","clearExclusions() clears active exclusion patterns","length() returns the number of resolved files in the list","Array methods like map() return a new FileList instance with transformed items","FileList.clone(fl) creates a cloned copy of the FileList"],"goal":"verify pkg:npm/filelist@1.0.6","kind":"HOW","packages":["pkg:npm/filelist@1.0.6"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/filelist@1.0.6"],"schemaVersion":1,"subject":"pkg:npm/filelist@1.0.6","verifierAdapter":"node-typescript@1"}
'use strict';
const { FileList } = require('filelist');
function createFileList(...items) {
const fl = new FileList();
if (items.length > 0) {
fl.include(...items);
}
return fl;
}
module.exports = {
FileList,
createFileList,
};
{
"name": "sample-1138045718",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-1138045718",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"filelist": "1.0.6"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/filelist": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz",
"integrity": "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==",
"license": "Apache-2.0",
"dependencies": {
"minimatch": "^5.0.1"
}
},
"node_modules/minimatch": {
"version": "5.1.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
"integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-1138045718",
"version": "1.0.0",
"description": "Minimal sample verifying filelist@1.0.6",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"keywords": [],
"author": "",
"license": "MIT-0",
"dependencies": {
"filelist": "1.0.6"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/filelist@1.0.6",
"kind": "HOW",
"packages": [
"pkg:npm/filelist@1.0.6"
]
}
'use strict';
const assert = require('assert');
const { FileList, createFileList } = require('../index.js');
function runContract() {
// 1. FileList instance includes string filenames and array of filenames
const fl1 = createFileList('foo.txt', 'bar.js');
fl1.include(['baz.md', 'temp.tmp']);
assert.deepStrictEqual(fl1.toArray(), ['foo.txt', 'bar.js', 'baz.md', 'temp.tmp']);
// 2. exclude(string) removes exact matching files from the resolved file list
const fl2 = new FileList();
fl2.include('foo.txt', 'bar.js', 'baz.txt');
fl2.exclude('bar.js');
assert.deepStrictEqual(fl2.toArray(), ['foo.txt', 'baz.txt']);
// 3. exclude(RegExp) removes pattern matching files from the resolved file list
const fl3 = new FileList();
fl3.include('app.js', 'app.test.js', 'server.js');
fl3.exclude(/\.test\.js$/);
assert.deepStrictEqual(fl3.toArray(), ['app.js', 'server.js']);
// 4. exclude(Function) removes files that satisfy the predicate function
const fl4 = new FileList();
fl4.include('doc.md', 'temp1.tmp', 'temp2.tmp');
fl4.exclude((item) => item.endsWith('.tmp'));
assert.deepStrictEqual(fl4.toArray(), ['doc.md']);
// 5. shouldExclude(filename) returns true for excluded paths and false otherwise
const fl5 = new FileList();
fl5.exclude(/\.tmp$/);
fl5.exclude((item) => item.startsWith('ignore-'));
assert.strictEqual(fl5.shouldExclude('data.tmp'), true);
assert.strictEqual(fl5.shouldExclude('ignore-me.txt'), true);
assert.strictEqual(fl5.shouldExclude('valid.txt'), false);
// 6. clearInclusions() resets pending additions before resolution
const fl6 = new FileList();
fl6.include('first.txt');
fl6.clearInclusions();
fl6.include('second.txt');
assert.deepStrictEqual(fl6.toArray(), ['second.txt']);
// 7. clearExclusions() clears active exclusion patterns
const fl7 = new FileList();
fl7.include('item1.js', 'item2.js');
fl7.exclude('item1.js');
fl7.clearExclusions();
assert.deepStrictEqual(fl7.toArray(), ['item1.js', 'item2.js']);
// 8. length() returns the number of resolved files in the list
const fl8 = new FileList();
fl8.include('a.txt', 'b.txt', 'c.txt');
fl8.exclude('c.txt');
assert.strictEqual(fl8.length(), 2);
// 9. Array methods like map() return a new FileList instance with transformed items
const fl9 = new FileList();
fl9.include('a.txt', 'b.txt');
const mapped = fl9.map((f) => f.toUpperCase());
assert.ok(mapped instanceof FileList);
assert.deepStrictEqual(mapped.toArray(), ['A.TXT', 'B.TXT']);
// 10. FileList.clone(fl) creates a cloned copy of the FileList
const fl10 = new FileList();
fl10.include('alpha.txt', 'beta.txt');
const cloned = FileList.clone(fl10);
assert.ok(cloned instanceof FileList);
assert.deepStrictEqual(cloned.toArray(), ['alpha.txt', 'beta.txt']);
console.log('Contract tests passed.');
}
runContract();
原始种子者
匿名