샘플
plist 3.1.0: build
검증된 샘플 — npm plist 3.1.0: build. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: plist.build serializes JavaScript primitives and objects into…
sha256:dcbf1d0744a14a1ea7a0e0282670f2a049c9a17c3b7823e17e74da359acf8c5c
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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 plist.build in pkg:npm/plist@3.1.0
- 패키지
- 심벌
-
- plist.build
- 환경
- node 22.23.2
- 생성일
- 2026-08-26T11:07:04Z
컨트랙트
- plist.build serializes JavaScript primitives and objects into standard XML property list format
- plist.build encodes numbers into integer or real tags and buffers into base64 data tags
- plist.build encodes Date objects into ISO 8601 date tags and booleans into true and false tags
- plist.build handles nested dictionaries and arrays with proper tag hierarchy
- plist.build escapes special XML characters in string values and keys
- plist.build applies custom formatting options such as custom indentation
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 plist.build in pkg:npm/plist@3.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/plist@3.1.0
Demonstrate these symbols/APIs:
- plist.build
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:2bdfc37b9346c87ebf102c2cb1032235e551d053048334f6708d9559a09ce3ca","constraints":{"executionContext":"node"},"contract":["plist.build serializes JavaScript primitives and objects into standard XML property list format","plist.build encodes numbers into integer or real tags and buffers into base64 data tags","plist.build encodes Date objects into ISO 8601 date tags and booleans into true and false tags","plist.build handles nested dictionaries and arrays with proper tag hierarchy","plist.build escapes special XML characters in string values and keys","plist.build applies custom formatting options such as custom indentation"],"goal":"verify plist.build in pkg:npm/plist@3.1.0","kind":"HOW","packages":["pkg:npm/plist@3.1.0"],"schemaVersion":1,"symbols":["plist.build"]},"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/plist@3.1.0"],"schemaVersion":1,"subject":"pkg:npm/plist@3.1.0","symbols":["plist.build"],"verifierAdapter":"node-typescript@1"}
{
"name": "plist-build-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "plist-build-sample",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"plist": "3.1.0"
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.15",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.15.tgz",
"integrity": "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/plist": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz",
"integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==",
"license": "MIT",
"dependencies": {
"@xmldom/xmldom": "^0.8.8",
"base64-js": "^1.5.1",
"xmlbuilder": "^15.1.1"
},
"engines": {
"node": ">=10.4.0"
}
},
"node_modules/xmlbuilder": {
"version": "15.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
"integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==",
"license": "MIT",
"engines": {
"node": ">=8.0"
}
}
}
}
{
"name": "plist-build-sample",
"version": "1.0.0",
"description": "verify plist.build in pkg:npm/plist@3.1.0",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"plist": "3.1.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify plist.build in pkg:npm/plist@3.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/plist@3.1.0"
],
"symbols": [
"plist.build"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const plist = require('plist');
/**
* Builds an XML Property List string from any JavaScript value.
*
* @param {*} data - JavaScript data structure to serialize.
* @param {object} [options] - Optional formatting options (indent, offset, head).
* @returns {string} The formatted XML Property List document string.
*/
function buildPlist(data, options) {
return plist.build(data, options);
}
/**
* Builds a Property List representing a dictionary (object) structure.
*
* @param {Record<string, *>} entries - Key-value map to serialize as a plist dictionary.
* @param {object} [options] - Optional formatting options.
* @returns {string} The formatted XML Property List string.
*/
function buildDictionary(entries, options) {
return plist.build(entries, options);
}
/**
* Builds a Property List representing an array structure.
*
* @param {Array<*>} items - Array of elements to serialize.
* @param {object} [options] - Optional formatting options.
* @returns {string} The formatted XML Property List string.
*/
function buildArray(items, options) {
return plist.build(items, options);
}
/**
* Builds a Property List with custom indentation.
*
* @param {*} data - JavaScript value to serialize.
* @param {string} indentString - Indentation string (e.g., '\t' or ' ').
* @returns {string} The formatted XML Property List string.
*/
function buildFormattedPlist(data, indentString) {
return plist.build(data, { indent: indentString });
}
module.exports = {
buildPlist,
buildDictionary,
buildArray,
buildFormattedPlist,
};
const assert = require('node:assert/strict');
const plist = require('plist');
const {
buildPlist,
buildDictionary,
buildArray,
buildFormattedPlist,
} = require('../src/index.js');
// Contract 1: plist.build serializes JavaScript primitives and objects into standard XML property list format
{
const input = { title: 'App Configuration', version: 1 };
const xml = buildPlist(input);
assert.ok(xml.includes('<?xml version="1.0" encoding="UTF-8"?>'), 'Must include XML declaration');
assert.ok(xml.includes('DOCTYPE plist PUBLIC') && xml.includes('PropertyList-1.0.dtd'), 'Must include Apple plist DOCTYPE');
assert.ok(xml.includes('<plist version="1.0">'), 'Must include plist root tag with version');
assert.ok(xml.includes('<dict>'), 'Object root should serialize as dict');
assert.ok(xml.includes('<key>title</key>'), 'Object keys should serialize as key tags');
assert.ok(xml.includes('<string>App Configuration</string>'), 'String values should serialize as string tags');
}
// Contract 2: plist.build encodes numbers into integer or real tags and buffers into base64 data tags
{
const bufferContent = Buffer.from('CodeSampleX payload', 'utf8');
const input = {
count: 42,
ratio: 3.14159,
binaryPayload: bufferContent,
};
const xml = buildDictionary(input);
assert.ok(xml.includes('<key>count</key>\n <integer>42</integer>'), 'Integer numbers should serialize as integer tags');
assert.ok(xml.includes('<key>ratio</key>\n <real>3.14159</real>'), 'Floating point numbers should serialize as real tags');
assert.ok(xml.includes('<key>binaryPayload</key>\n <data>' + bufferContent.toString('base64') + '</data>'), 'Buffers should serialize as base64 data tags');
}
// Contract 3: plist.build encodes Date objects into ISO 8601 date tags and booleans into true and false tags
{
const timestamp = new Date('2026-08-26T11:00:00.000Z');
const input = {
createdAt: timestamp,
isActive: true,
isDeprecated: false,
};
const xml = buildDictionary(input);
assert.ok(xml.includes('<key>createdAt</key>\n <date>2026-08-26T11:00:00Z</date>') || xml.includes('<date>' + timestamp.toISOString() + '</date>'), 'Date objects should serialize into ISO date tags');
assert.ok(xml.includes('<key>isActive</key>\n <true/>'), 'True boolean should serialize as true tag');
assert.ok(xml.includes('<key>isDeprecated</key>\n <false/>'), 'False boolean should serialize as false tag');
}
// Contract 4: plist.build handles nested dictionaries and arrays with proper tag hierarchy
{
const input = [
{
id: 101,
tags: ['alpha', 'beta'],
settings: {
enabled: true,
},
},
];
const xml = buildArray(input);
assert.ok(xml.includes('<plist version="1.0">\n <array>'), 'Array root should serialize as array tag');
assert.ok(xml.includes('<dict>'), 'Nested dictionary inside array');
assert.ok(xml.includes('<key>tags</key>\n <array>'), 'Nested array under key');
assert.ok(xml.includes('<string>alpha</string>'), 'Array items serialized properly');
assert.ok(xml.includes('<string>beta</string>'), 'Array items serialized properly');
// Verify round-trip parsing
const parsed = plist.parse(xml);
assert.strictEqual(parsed[0].id, 101);
assert.deepStrictEqual(parsed[0].tags, ['alpha', 'beta']);
assert.strictEqual(parsed[0].settings.enabled, true);
}
// Contract 5: plist.build escapes special XML characters in string values and keys
{
const input = {
'custom&key': '<script>alert("xss") & \'test\'</script>',
};
const xml = buildPlist(input);
assert.ok(xml.includes('<script>'), 'Unescaped tag brackets should be escaped');
assert.ok(xml.includes('&'), 'Ampersands must be escaped');
assert.ok(!xml.includes('<script>'), 'Raw script tags must not appear in XML output');
const parsed = plist.parse(xml);
assert.strictEqual(parsed['custom&key'], '<script>alert("xss") & \'test\'</script>');
}
// Contract 6: plist.build applies custom formatting options such as custom indentation
{
const input = { item: 1 };
const tabFormatted = buildFormattedPlist(input, '\t');
const spaceFormatted = buildFormattedPlist(input, ' ');
assert.ok(tabFormatted.includes('\t<dict>'), 'Custom tab indentation should be applied');
assert.ok(spaceFormatted.includes(' <dict>'), 'Custom 4-space indentation should be applied');
}
console.log('All contract tests passed successfully.');
오리진 시더
익명