Beispiel
bare-bundle 1.10.0: Bundle.prototype.unmount
Verifiziertes Beispiel für npm bare-bundle 1.10.0: Bundle.prototype.unmount. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.
sha256:28fe0c5f105243596d1028a8db4a903f93c43940cfe4be543c03358c36ea59d8
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-05 |
Fall
HOW- Ziel
- verify pkg:npm/bare-bundle@1.10.0
- Pakete
- Symbole
-
- Bundle.prototype.unmount
- Umgebung
- node 22.23.2
- Erstellt
- 2026-09-05T11:00:37Z
Contract
- Bundle.prototype.unmount returns a new Bundle instance preserving source bundle immutability
- Bundle.prototype.unmount converts files under root URL back to absolute paths
- Bundle.prototype.unmount reverses main entry point URL to its specifier path
- Bundle.prototype.unmount preserves external URLs whose origin does not match root
- Bundle.prototype.unmount unmounts addon and asset paths under the root URL
- Bundle.prototype.unmount unmounts nested imports and resolutions specifiers
Dateien
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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-bundle@1.10.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-bundle@1.10.0
Demonstrate these symbols/APIs:
- Bundle.prototype.unmount
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:661118eaf6e8c6e85ce703410aa26c1d0a01496fe7124ff23a16533f21bf1926","contract":["Bundle.prototype.unmount returns a new Bundle instance preserving source bundle immutability","Bundle.prototype.unmount converts files under root URL back to absolute paths","Bundle.prototype.unmount reverses main entry point URL to its specifier path","Bundle.prototype.unmount preserves external URLs whose origin does not match root","Bundle.prototype.unmount unmounts addon and asset paths under the root URL","Bundle.prototype.unmount unmounts nested imports and resolutions specifiers"],"goal":"verify pkg:npm/bare-bundle@1.10.0","kind":"HOW","packages":["pkg:npm/bare-bundle@1.10.0"],"schemaVersion":1,"symbols":["Bundle.prototype.unmount"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/bare-bundle@1.10.0"],"schemaVersion":1,"subject":"pkg:npm/bare-bundle@1.10.0","symbols":["Bundle.prototype.unmount"],"verifierAdapter":"node-typescript@1"}
import Bundle from 'bare-bundle';
/**
* Unmounts bundle specifiers from a given root URL back to absolute paths.
* @param {Bundle} bundle
* @param {string|URL} root
* @param {object} [opts]
* @returns {Bundle}
*/
export function unmountBundle(bundle, root, opts) {
return bundle.unmount(root, opts);
}
/**
* Mounts and then unmounts a bundle against a root URL.
* @param {Bundle} bundle
* @param {string|URL} root
* @param {object} [opts]
* @returns {Bundle}
*/
export function roundtripMount(bundle, root, opts) {
const mounted = bundle.mount(root, opts);
return mounted.unmount(root, opts);
}
export default Bundle;
export { Bundle };
{
"name": "sample-bare-bundle",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-bundle",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-bundle": "1.10.0"
}
},
"node_modules/bare-bundle": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/bare-bundle/-/bare-bundle-1.10.0.tgz",
"integrity": "sha512-4LVlnJAHr00Hh6Vu6ZUJS38rcEtJT3b3vChXSsBsJ2mk1TN0lQ+gzd+Dw5L0aV7uqDZv84smuwW+O02X7PfDlw==",
"license": "Apache-2.0",
"peerDependencies": {
"bare-buffer": "*",
"bare-url": "*"
},
"peerDependenciesMeta": {
"bare-buffer": {
"optional": true
},
"bare-url": {
"optional": true
}
}
}
}
}
{
"name": "sample-bare-bundle",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"bare-bundle": "1.10.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/bare-bundle@1.10.0",
"kind": "HOW",
"packages": [
"pkg:npm/bare-bundle@1.10.0"
],
"symbols": [
"Bundle.prototype.unmount"
]
}
import assert from 'node:assert/strict';
import Bundle, { unmountBundle, roundtripMount } from '../index.js';
// 1. Bundle.prototype.unmount returns a new Bundle instance preserving source bundle immutability
{
const original = new Bundle();
original.write('https://example.com/app/index.js', 'console.log("hello");', { main: true });
const unmounted = original.unmount('https://example.com/app/');
assert.notEqual(unmounted, original);
assert.equal(Bundle.isBundle(unmounted), true);
assert.equal(original.exists('https://example.com/app/index.js'), true);
assert.equal(original.exists('/index.js'), false);
assert.equal(unmounted.exists('/index.js'), true);
assert.equal(unmounted.exists('https://example.com/app/index.js'), false);
}
// 2. Bundle.prototype.unmount converts files under root URL back to absolute paths
{
const bundle = new Bundle();
bundle.write('https://example.com/app/index.js', 'console.log("app");');
bundle.write('https://example.com/app/lib/helper.js', 'console.log("helper");');
const unmounted = unmountBundle(bundle, 'https://example.com/app/');
assert.equal(unmounted.exists('/index.js'), true);
assert.equal(unmounted.exists('/lib/helper.js'), true);
assert.equal(unmounted.read('/index.js').toString('utf8'), 'console.log("app");');
assert.equal(unmounted.read('/lib/helper.js').toString('utf8'), 'console.log("helper");');
}
// 3. Bundle.prototype.unmount reverses main entry point URL to its specifier path
{
const bundle = new Bundle();
bundle.write('/main.js', 'export default 42;', { main: true });
const mounted = bundle.mount('https://example.com/app/');
assert.equal(mounted.main, 'https://example.com/app/main.js');
const unmounted = mounted.unmount('https://example.com/app/');
assert.equal(unmounted.main, '/main.js');
assert.equal(unmounted.read('/main.js').toString('utf8'), 'export default 42;');
}
// 4. Bundle.prototype.unmount preserves external URLs whose origin does not match root
{
const bundle = new Bundle();
bundle.write('https://external.example.org/shared.js', 'export const shared = 1;');
bundle.write('https://example.com/app/local.js', 'export const local = 2;');
const unmounted = bundle.unmount('https://example.com/app/');
assert.equal(unmounted.exists('https://external.example.org/shared.js'), true);
assert.equal(unmounted.exists('/local.js'), true);
assert.equal(unmounted.read('https://external.example.org/shared.js').toString('utf8'), 'export const shared = 1;');
assert.equal(unmounted.read('/local.js').toString('utf8'), 'export const local = 2;');
}
// 5. Bundle.prototype.unmount unmounts addon and asset paths under the root URL
{
const bundle = new Bundle();
bundle.write('https://example.com/app/native.bare', Buffer.from([0x01, 0x02]), { addon: true });
bundle.write('https://example.com/app/icon.png', Buffer.from([0x89, 0x50]), { asset: true });
const unmounted = bundle.unmount('https://example.com/app/');
assert.deepEqual(unmounted.addons, ['/native.bare']);
assert.deepEqual(unmounted.assets, ['/icon.png']);
}
// 6. Bundle.prototype.unmount unmounts nested imports and resolutions specifiers
{
const bundle = new Bundle();
bundle.write('https://example.com/app/app.js', 'import dep from "dep";', {
alias: 'main-entry',
imports: { dep: 'https://example.com/app/dep.js' }
});
const unmounted = bundle.unmount('https://example.com/app/');
assert.deepEqual(unmounted.imports, { 'main-entry': '/app.js' });
assert.deepEqual(unmounted.resolutions, { '/app.js': { dep: '/dep.js' } });
// Also test roundtripMount helper
const roundtripped = roundtripMount(unmounted, 'https://example.com/app/');
assert.deepEqual(roundtripped.imports, { 'main-entry': '/app.js' });
}
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym