示例
lightningcss 1.33.0: bundle
已验证示例 — npm lightningcss 1.33.0: bundle. contract 在 node 22 · linux debian/x64 · docker 上运行并通过: bundle inlines nested @import rules into a single CSS output
sha256:f9abaee8dcb6a28e08887213caf71f63f4a10ac5bd1629fc8190f02ac294896b
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 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 debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-02 |
案例
HOW- 目标
- verify bundle in pkg:npm/lightningcss@1.33.0
- 符号
-
- bundle
- 环境
- node 22.23.2
- 创建时间
- 2026-09-02T01:42:05Z
契约
- bundle inlines nested @import rules into a single CSS output
- bundle minifies bundled CSS output when minify option is true
- bundle generates source map when sourceMap option is true
- bundle generates scoped CSS class names and exports mapping when cssModules option is true
- bundle lowers CSS syntax according to specified browser targets
- bundle throws an error when an imported file cannot be resolved
- bundle throws an error when entry file does not exist
文件
- PROMPT.md
- csx.json
- fixtures/components.css
- fixtures/main.css
- fixtures/missing-import.css
- fixtures/module-button.css
- fixtures/module-entry.css
- fixtures/reset.css
- fixtures/target.css
- fixtures/vars.css
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
源代码
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 bundle in pkg:npm/lightningcss@1.33.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/lightningcss@1.33.0
Demonstrate these symbols/APIs:
- bundle
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:dda3872af5248b534c7ece84f12719753e01fab21b4282bfc1fd7c33b08a6f5a","constraints":{"executionContext":"node"},"contract":["bundle inlines nested @import rules into a single CSS output","bundle minifies bundled CSS output when minify option is true","bundle generates source map when sourceMap option is true","bundle generates scoped CSS class names and exports mapping when cssModules option is true","bundle lowers CSS syntax according to specified browser targets","bundle throws an error when an imported file cannot be resolved","bundle throws an error when entry file does not exist"],"goal":"verify bundle in pkg:npm/lightningcss@1.33.0","kind":"HOW","packages":["pkg:npm/lightningcss@1.33.0"],"schemaVersion":1,"symbols":["bundle"]},"contractCommand":["node","test/contract.cjs"],"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/lightningcss@1.33.0"],"schemaVersion":1,"subject":"pkg:npm/lightningcss@1.33.0","symbols":["bundle"],"verifierAdapter":"node-typescript@1"}
@import "./vars.css";
.card {
background: var(--main-bg);
padding: 10px;
}
@import "./reset.css";
@import "./components.css";
body {
margin: 0;
}
@import "./non-existent-subfile.css";
.test {
color: red;
}
.btn {
color: blue;
}
@import "./module-button.css";
.container {
display: flex;
}
* {
box-sizing: border-box;
}
.box {
user-select: none;
display: flex;
}
:root {
--main-bg: #fff;
}
{
"name": "sample-lightningcss-bundle",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-lightningcss-bundle",
"version": "1.0.0",
"dependencies": {
"lightningcss": "1.33.0"
}
},
"node_modules/detect-libc": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/lightningcss": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
"integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
"license": "MPL-2.0",
"dependencies": {
"detect-libc": "^2.0.3"
},
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"optionalDependencies": {
"lightningcss-android-arm64": "1.33.0",
"lightningcss-darwin-arm64": "1.33.0",
"lightningcss-darwin-x64": "1.33.0",
"lightningcss-freebsd-x64": "1.33.0",
"lightningcss-linux-arm-gnueabihf": "1.33.0",
"lightningcss-linux-arm64-gnu": "1.33.0",
"lightningcss-linux-arm64-musl": "1.33.0",
"lightningcss-linux-x64-gnu": "1.33.0",
"lightningcss-linux-x64-musl": "1.33.0",
"lightningcss-win32-arm64-msvc": "1.33.0",
"lightningcss-win32-x64-msvc": "1.33.0"
}
},
"node_modules/lightningcss-android-arm64": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
"integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-arm64": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
"integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-x64": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
"integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
"cpu": [
"x64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-freebsd-x64": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
"integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
"cpu": [
"x64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm-gnueabihf": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
"integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
"cpu": [
"arm"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-gnu": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
"integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-musl": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
"integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-gnu": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
"integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
"cpu": [
"x64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-musl": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
"integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
"cpu": [
"x64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-arm64-msvc": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
"integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-x64-msvc": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
"integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
"cpu": [
"x64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
}
}
}
{
"name": "sample-lightningcss-bundle",
"version": "1.0.0",
"private": true,
"dependencies": {
"lightningcss": "1.33.0"
}
}
{
"schemaVersion": 1,
"goal": "verify bundle in pkg:npm/lightningcss@1.33.0",
"kind": "HOW",
"packages": [
"pkg:npm/lightningcss@1.33.0"
],
"symbols": [
"bundle"
]
}
const assert = require('node:assert/strict');
const path = require('node:path');
const { bundle, browserslistToTargets } = require('lightningcss');
const fixturesDir = path.join(__dirname, '..', 'fixtures');
// 1. bundle inlines nested @import rules into a single CSS output
{
const entryPath = path.join(fixturesDir, 'main.css');
const result = bundle({
filename: entryPath,
});
const css = result.code.toString();
assert.ok(css.includes('box-sizing: border-box;'), 'Should include reset styles');
assert.ok(css.includes('--main-bg: #fff;'), 'Should include variable definitions');
assert.ok(css.includes('background: var(--main-bg);'), 'Should include component styles');
assert.ok(css.includes('margin: 0;'), 'Should include body styles');
assert.ok(!css.includes('@import'), 'All @import statements should be inlined');
}
// 2. bundle minifies bundled CSS output when minify option is true
{
const entryPath = path.join(fixturesDir, 'main.css');
const result = bundle({
filename: entryPath,
minify: true,
});
const css = result.code.toString();
assert.equal(css.includes('\n'), false, 'Minified CSS should not contain newlines');
assert.ok(css.includes('*{box-sizing:border-box}'), 'Should minify reset rule');
assert.ok(css.includes(':root{--main-bg:#fff}'), 'Should minify root variables');
assert.ok(css.includes('.card{background:var(--main-bg);padding:10px}'), 'Should minify card rule');
assert.ok(css.includes('body{margin:0}'), 'Should minify body rule');
}
// 3. bundle generates source map when sourceMap option is true
{
const entryPath = path.join(fixturesDir, 'main.css');
const result = bundle({
filename: entryPath,
sourceMap: true,
});
assert.ok(Buffer.isBuffer(result.map), 'result.map should be a Buffer');
const map = JSON.parse(result.map.toString());
assert.equal(map.version, 3, 'Source map version should be 3');
assert.ok(Array.isArray(map.sources), 'Source map should contain sources array');
assert.ok(map.sources.some((s) => s.endsWith('main.css')), 'Sources should contain main.css');
assert.ok(map.sources.some((s) => s.endsWith('reset.css')), 'Sources should contain reset.css');
assert.ok(map.sources.some((s) => s.endsWith('vars.css')), 'Sources should contain vars.css');
assert.ok(map.sources.some((s) => s.endsWith('components.css')), 'Sources should contain components.css');
}
// 4. bundle generates scoped CSS class names and exports mapping when cssModules option is true
{
const entryPath = path.join(fixturesDir, 'module-entry.css');
const result = bundle({
filename: entryPath,
cssModules: true,
});
assert.ok(result.exports, 'result.exports should be defined');
assert.ok(result.exports.container, 'result.exports should contain container export');
assert.ok(typeof result.exports.container.name === 'string', 'container name should be a string');
assert.ok(result.exports.container.name.includes('container'), 'container name should include local name');
const css = result.code.toString();
assert.ok(css.includes(result.exports.container.name), 'Bundled CSS should contain scoped class name');
}
// 5. bundle lowers CSS syntax according to specified browser targets
{
const entryPath = path.join(fixturesDir, 'target.css');
const result = bundle({
filename: entryPath,
targets: browserslistToTargets(['ie 11']),
minify: true,
});
const css = result.code.toString();
assert.ok(css.includes('-ms-user-select:none'), 'Should prefix user-select for IE 11');
assert.ok(css.includes('user-select:none'), 'Should include standard user-select');
}
// 6. bundle throws an error when an imported file cannot be resolved
{
const entryPath = path.join(fixturesDir, 'missing-import.css');
assert.throws(
() => {
bundle({
filename: entryPath,
});
},
(err) => {
return err instanceof Error && (err.name === 'SyntaxError' || err.message.includes('No such file') || err.data === 'ResolverError');
},
'Should throw error when imported file does not exist'
);
}
// 7. bundle throws an error when entry file does not exist
{
const entryPath = path.join(fixturesDir, 'does-not-exist.css');
assert.throws(
() => {
bundle({
filename: entryPath,
});
},
(err) => {
return err instanceof Error && (err.name === 'SyntaxError' || err.message.includes('No such file') || err.data === 'ResolverError');
},
'Should throw error when entry file does not exist'
);
}
原始种子者
匿名