CodeSampleX

샘플

baseline-browser-mapping 2.11.28: getTimeline

검증된 샘플 — npm baseline-browser-mapping 2.11.28: getTimeline. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: getTimeline() returns chronologically…

sha256:118f1945f9efb2f8c1cf9b5115b810de0b96ef8ab63c683b91fd315b4b525a8c

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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-11-23

케이스

HOW
목표
verify baseline-browser-mapping.getTimeline in pkg:npm/baseline-browser-mapping@2.11.28
패키지
심벌
  • baseline-browser-mapping.getTimeline
환경
node 22.23.2
생성일
2026-11-23T15:24:34Z

컨트랙트

  1. getTimeline() returns chronologically ascending events with all 7 core browsers initially and only changed browsers on subsequent dates
  2. getTimeline({ listAllBrowsers: true }) includes all 7 core browsers on each timeline event
  3. getTimeline({ groupBy: "browser" }) returns an object mapping each core browser to its ascending version change history
  4. getTimeline({ includeDownstreamBrowsers: true }) adds downstream browsers with engine and engine_version metadata while excluding kai_os by default
  5. getTimeline({ includeDownstreamBrowsers: true, includeKaiOS: true, groupBy: "browser" }) includes kai_os entries with Gecko engine metadata
  6. getTimeline({ includeDownstreamBrowsers: false, includeKaiOS: true }) throws an error requiring downstream browsers to be enabled

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

소스 아티팩트 내려받기 (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 baseline-browser-mapping.getTimeline in pkg:npm/baseline-browser-mapping@2.11.28
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/baseline-browser-mapping@2.11.28
Demonstrate these symbols/APIs:
  - baseline-browser-mapping.getTimeline
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.
csx.json
{"case":{"caseId":"case:sha256:9a70a97f0bbc8c52fae2b3f9417dc90e4a8a703f947bded3b963eb0e5f3ff723","constraints":{"executionContext":"node"},"contract":["getTimeline() returns chronologically ascending events with all 7 core browsers initially and only changed browsers on subsequent dates","getTimeline({ listAllBrowsers: true }) includes all 7 core browsers on each timeline event","getTimeline({ groupBy: \"browser\" }) returns an object mapping each core browser to its ascending version change history","getTimeline({ includeDownstreamBrowsers: true }) adds downstream browsers with engine and engine_version metadata while excluding kai_os by default","getTimeline({ includeDownstreamBrowsers: true, includeKaiOS: true, groupBy: \"browser\" }) includes kai_os entries with Gecko engine metadata","getTimeline({ includeDownstreamBrowsers: false, includeKaiOS: true }) throws an error requiring downstream browsers to be enabled"],"goal":"verify baseline-browser-mapping.getTimeline in pkg:npm/baseline-browser-mapping@2.11.28","kind":"HOW","packages":["pkg:npm/baseline-browser-mapping@2.11.28"],"schemaVersion":1,"symbols":["baseline-browser-mapping.getTimeline"]},"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/baseline-browser-mapping@2.11.28"],"schemaVersion":1,"subject":"pkg:npm/baseline-browser-mapping@2.11.28","symbols":["baseline-browser-mapping.getTimeline"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "baseline-browser-mapping-timeline-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "baseline-browser-mapping-timeline-sample",
      "version": "1.0.0",
      "dependencies": {
        "baseline-browser-mapping": "2.11.28"
      }
    },
    "node_modules/baseline-browser-mapping": {
      "version": "2.11.28",
      "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.28.tgz",
      "integrity": "sha512-br0LOmjJqr6Rt4AEkadbcNf67Zpo7EPwKsWbjnRrJIa1QYFHQBqM4C7F2WTbV8ahTEcg1Eo+Y0aWjjORInYFyA==",
      "license": "Apache-2.0",
      "bin": {
        "baseline-browser-mapping": "dist/cli.cjs"
      },
      "engines": {
        "node": ">=6.0.0"
      }
    }
  }
}
package.json
{
  "name": "baseline-browser-mapping-timeline-sample",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "baseline-browser-mapping": "2.11.28"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify baseline-browser-mapping.getTimeline in pkg:npm/baseline-browser-mapping@2.11.28",
  "kind": "HOW",
  "packages": [
    "pkg:npm/baseline-browser-mapping@2.11.28"
  ],
  "symbols": [
    "baseline-browser-mapping.getTimeline"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const { getTimeline } = require("baseline-browser-mapping");

function queryBaselineTimeline(options) {
  return options === undefined ? getTimeline() : getTimeline(options);
}

module.exports = {
  getTimeline,
  queryBaselineTimeline,
};
test/contract.js
const assert = require("node:assert/strict");
const { getTimeline, queryBaselineTimeline } = require("../src/index.js");

const CORE_BROWSERS = [
  "chrome",
  "chrome_android",
  "edge",
  "firefox",
  "firefox_android",
  "safari",
  "safari_ios",
];

// 1. Default call returns chronologically sorted date events with changed browsers
{
  const events = queryBaselineTimeline();
  assert.ok(Array.isArray(events), "default getTimeline should return an array");
  assert.ok(events.length > 2, "timeline should contain multiple events");

  for (let i = 1; i < events.length; i += 1) {
    assert.ok(
      events[i].date > events[i - 1].date,
      `timeline dates must be strictly ascending: ${events[i - 1].date} < ${events[i].date}`
    );
  }

  const initial = events[0];
  assert.match(initial.date, /^\d{4}-\d{2}-\d{2}$/);
  assert.strictEqual(initial.browsers.length, CORE_BROWSERS.length);
  const initialNames = initial.browsers.map((entry) => entry.browser).sort();
  assert.deepStrictEqual(initialNames, [...CORE_BROWSERS].sort());

  const chrome = initial.browsers.find((entry) => entry.browser === "chrome");
  assert.ok(chrome);
  assert.strictEqual(chrome.version, "38");
  assert.strictEqual(chrome.release_date, "2014-10-07");

  const hasDeltaEvent = events.slice(1).some((ev) => ev.browsers.length < CORE_BROWSERS.length);
  assert.ok(hasDeltaEvent, "subsequent events should list only changed browsers by default");
}

// 2. listAllBrowsers: true includes every active core browser on each event
{
  const fullEvents = getTimeline({ listAllBrowsers: true });
  assert.ok(Array.isArray(fullEvents));
  assert.ok(fullEvents.length > 2);

  for (const ev of fullEvents.slice(0, 10)) {
    assert.strictEqual(
      ev.browsers.length,
      CORE_BROWSERS.length,
      `event ${ev.date} should contain all ${CORE_BROWSERS.length} core browsers`
    );
    const names = ev.browsers.map((entry) => entry.browser).sort();
    assert.deepStrictEqual(names, [...CORE_BROWSERS].sort());
  }
}

// 3. groupBy: "browser" returns per-browser chronological change histories
{
  const byBrowser = getTimeline({ groupBy: "browser" });
  assert.strictEqual(typeof byBrowser, "object");
  assert.ok(byBrowser !== null && !Array.isArray(byBrowser));
  assert.deepStrictEqual(Object.keys(byBrowser).sort(), [...CORE_BROWSERS].sort());

  for (const browser of CORE_BROWSERS) {
    const history = byBrowser[browser];
    assert.ok(Array.isArray(history) && history.length > 0, `expected non-empty history for ${browser}`);
    for (let i = 0; i < history.length; i += 1) {
      assert.match(history[i].date, /^\d{4}-\d{2}-\d{2}$/);
      assert.strictEqual(typeof history[i].version, "string");
      assert.ok(history[i].version.length > 0);
      assert.ok("release_date" in history[i]);
      if (i > 0) {
        assert.ok(history[i].date > history[i - 1].date);
      }
    }
  }
}

// 4. includeDownstreamBrowsers: true includes downstream browsers with engine metadata
{
  const downstreamEvents = getTimeline({ includeDownstreamBrowsers: true });
  assert.ok(Array.isArray(downstreamEvents));
  assert.ok(downstreamEvents[0].browsers.length > CORE_BROWSERS.length);

  const opera = downstreamEvents[0].browsers.find((entry) => entry.browser === "opera");
  assert.ok(opera, "opera should be present in downstream timeline");
  assert.strictEqual(opera.engine, "Blink");
  assert.strictEqual(typeof opera.engine_version, "string");

  const downstreamByBrowser = getTimeline({
    groupBy: "browser",
    includeDownstreamBrowsers: true,
  });
  assert.ok(Array.isArray(downstreamByBrowser.opera) && downstreamByBrowser.opera.length > 0);
  assert.ok(
    Array.isArray(downstreamByBrowser.samsunginternet_android) &&
      downstreamByBrowser.samsunginternet_android.length > 0
  );
  assert.ok(
    Array.isArray(downstreamByBrowser.webview_android) &&
      downstreamByBrowser.webview_android.length > 0
  );
  assert.strictEqual(downstreamByBrowser.kai_os, undefined, "kai_os should be excluded unless includeKaiOS is true");
}

// 5. includeKaiOS: true with includeDownstreamBrowsers: true includes kai_os with Gecko engine
{
  const withKaiOS = getTimeline({
    groupBy: "browser",
    includeDownstreamBrowsers: true,
    includeKaiOS: true,
  });
  assert.ok(Array.isArray(withKaiOS.kai_os) && withKaiOS.kai_os.length > 0);
  assert.strictEqual(withKaiOS.kai_os[0].engine, "Gecko");
  assert.strictEqual(typeof withKaiOS.kai_os[0].engine_version, "string");
}

// 6. includeKaiOS: true without includeDownstreamBrowsers: true throws an error
{
  assert.throws(
    () => {
      getTimeline({
        includeDownstreamBrowsers: false,
        includeKaiOS: true,
      });
    },
    /KaiOS.*downstream/i
  );
}

console.log("baseline-browser-mapping@2.11.28 getTimeline contract passed");

오리진 시더

익명