CodeSampleX

サンプル

@vue/shared 3.5.41: looseEqual, normalizeClass, normalizeStyle

検証済みサンプル — npm @vue/shared 3.5.41: looseEqual, normalizeClass, normalizeStyle. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました.

sha256:aee49d988b961d9053602ebcc4afa031326c67f0c3c67162bc02147d0556dcf8

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。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 normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41
パッケージ
シンボル
  • looseEqual
  • normalizeClass
  • normalizeStyle
作成日
2026-08-27T15:50:43Z

コントラクト

  1. normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names
  2. normalizeClass recursively normalizes nested array and object structures and ignores falsy values
  3. parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects
  4. normalizeStyle preserves string styles, passes object styles, and merges array of styles
  5. looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects
  6. looseIndexOf finds element index in array using looseEqual semantics

ファイル

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

ソースアーティファクトをダウンロード (tar.gz)

ソース

PROMPT.md
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 normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40vue/shared@3.5.41
Demonstrate these symbols/APIs:
  - looseEqual
  - normalizeClass
  - normalizeStyle

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.
csx.json
{"case":{"caseId":"case:sha256:c65fe754abaab836da3f15d1687e27c4317b07c63d87987076a02866e7012979","contract":["normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names","normalizeClass recursively normalizes nested array and object structures and ignores falsy values","parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects","normalizeStyle preserves string styles, passes object styles, and merges array of styles","looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects","looseIndexOf finds element index in array using looseEqual semantics"],"goal":"verify normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41","kind":"HOW","packages":["pkg:npm/%40vue/shared@3.5.41"],"schemaVersion":1,"symbols":["looseEqual","normalizeClass","normalizeStyle"]},"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/%40vue/shared@3.5.41"],"schemaVersion":1,"subject":"pkg:npm/%40vue/shared@3.5.41","symbols":["looseEqual","normalizeClass","normalizeStyle"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-vue-shared",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-vue-shared",
      "version": "1.0.0",
      "dependencies": {
        "@vue/shared": "3.5.41"
      }
    },
    "node_modules/@vue/shared": {
      "version": "3.5.41",
      "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.41.tgz",
      "integrity": "sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-vue-shared",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "@vue/shared": "3.5.41"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40vue/shared@3.5.41"
  ],
  "symbols": [
    "looseEqual",
    "normalizeClass",
    "normalizeStyle"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import {
  normalizeClass,
  normalizeStyle,
  parseStringStyle,
  stringifyStyle,
  looseEqual,
  looseIndexOf
} from '@vue/shared';

// 1. normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names
{
  assert.equal(normalizeClass('foo bar'), 'foo bar');
  assert.equal(normalizeClass(['foo', 'bar']), 'foo bar');
  assert.equal(normalizeClass({ foo: true, bar: false, baz: 1 }), 'foo baz');
}

// 2. normalizeClass recursively normalizes nested array and object structures and ignores falsy values
{
  assert.equal(
    normalizeClass(['foo', { bar: true, baz: false }, ['nested', { inner: true }], null, undefined, false]),
    'foo bar nested inner'
  );
  assert.equal(normalizeClass(null), '');
  assert.equal(normalizeClass(undefined), '');
  assert.equal(normalizeClass(false), '');
}

// 3. parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects
{
  assert.deepEqual(parseStringStyle('color: red; font-size: 14px;'), {
    color: 'red',
    'font-size': '14px'
  });
  assert.deepEqual(parseStringStyle('margin-top: 10px; opacity: 0.5;'), {
    'margin-top': '10px',
    opacity: '0.5'
  });
  assert.equal(stringifyStyle({ color: 'red', fontSize: '14px' }), 'color:red;font-size:14px;');
}

// 4. normalizeStyle preserves string styles, passes object styles, and merges array of styles
{
  assert.equal(normalizeStyle('color: red; font-size: 14px;'), 'color: red; font-size: 14px;');
  assert.deepEqual(normalizeStyle({ color: 'red', fontSize: '14px' }), {
    color: 'red',
    fontSize: '14px'
  });

  const merged = normalizeStyle([
    'color: red;',
    { fontSize: '12px' },
    { color: 'blue', fontWeight: 'bold' }
  ]);
  assert.deepEqual(merged, {
    color: 'blue',
    fontSize: '12px',
    fontWeight: 'bold'
  });
}

// 5. looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects
{
  assert.equal(looseEqual(1, 1), true);
  assert.equal(looseEqual('1', 1), true);
  assert.equal(looseEqual(new Date(1600000000000), new Date(1600000000000)), true);
  assert.equal(looseEqual(new Date(1600000000000), new Date(1700000000000)), false);
  assert.equal(looseEqual(/abc/g, /abc/g), true);
  assert.equal(looseEqual(/abc/g, /abc/i), false);
  assert.equal(looseEqual([1, 2, 3], [1, 2, 3]), true);
  assert.equal(looseEqual([1, 2], [1, 2, 3]), false);
  assert.equal(looseEqual({ a: 1, b: '2' }, { b: 2, a: 1 }), true);
}

// 6. looseIndexOf finds element index in array using looseEqual semantics
{
  const list = [1, { id: 1 }, { id: 2 }];
  assert.equal(looseIndexOf(list, { id: 1 }), 1);
  assert.equal(looseIndexOf(list, { id: 2 }), 2);
  assert.equal(looseIndexOf(list, { id: 3 }), -1);
}

オリジンシーダー

匿名