Skip to content

Add @taffyjs/yoga-wasm package - #27

Merged
hyfdev merged 4 commits into
mainfrom
agent/yoga-wasm-research
Aug 16, 2026
Merged

hyfdev merged 4 commits into
mainfrom
agent/yoga-wasm-research

Conversation

@hyfdev

@hyfdev hyfdev commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • add @taffyjs/yoga-wasm, built from the exact @taffyjs/yoga TypeScript source with only the public backend import redirected from @taffyjs/node to @taffyjs/wasm
  • preserve Yoga's eager root entry and genuinely lazy /load entry without embedding another Wasm payload or pulling in the native package
  • reuse the complete Yoga behavior and public type suites against the Wasm backend, then verify package contents, npm/pnpm tarball consumers, Vite browser selection, and real Chromium execution
  • document the shared compatibility boundary and add regression coverage for the reviewed shrink-factor, percentage-gap, and percentage-string cases

Why

This provides a Yoga-compatible API for Node.js and modern bundled browsers while keeping one facade implementation and one compatibility policy. Consumers can substitute the package for yoga-layout through a package-manager alias without changing application imports.

Validation

  • vp run check
  • vp run check:wasm

@hyfdev
hyfdev force-pushed the agent/yoga-wasm-research branch from df81a8e to 6e1a199 Compare August 16, 2026 13:15
@hyfdev
hyfdev marked this pull request as ready for review August 16, 2026 13:32
Copilot AI lite review requested due to automatic review settings August 16, 2026 13:32
@hyfdev
hyfdev merged commit db6923f into main Aug 16, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new @taffyjs/yoga-wasm package that reuses the existing @taffyjs/yoga TypeScript facade while redirecting the backend from @taffyjs/node to @taffyjs/wasm, and expands the CI/task graph and test suites to validate behavior, package contents, consumer installation, bundler selection, and real Chromium execution.

Changes:

  • Add packages/taffyjs-yoga-wasm with Vite+ build-time backend redirection and documentation/licensing.
  • Expand Yoga compatibility and Wasm validation coverage (behavior diffs, percentage parsing cases, packed-consumer + browser bundle/runtime checks).
  • Stop committing Yoga build outputs (dist/), update CI/task orchestration, and refresh/extend Project Context Records.

Reviewed changes

Copilot reviewed 37 out of 46 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.ts Updates task graph: renames Yoga test workspace target, adds Yoga-Wasm checks, and adjusts build/check ordering and ignores.
tests/taffyjs-yoga/yoga-layout-source.d.ts Adds ambient module declarations to map yoga-layout specifiers to test-only source entries.
tests/taffyjs-yoga/vite.config.ts Adds Vite resolve aliases to run runtime tests against built Yoga dist entries; updates lint ignores.
tests/taffyjs-yoga/types/public-api.test-d.ts Extends public API type assertions, including new percentage-string literal cases.
tests/taffyjs-yoga/tsconfig.json Adds TS paths mappings to Yoga source and includes the new ambient declaration file.
tests/taffyjs-yoga/style.test.mts Expands numeric/percentage boundary fixture set to include whitespace and non-decimal numeric forms.
tests/taffyjs-yoga/package.json Renames the Yoga integration test workspace package.
tests/taffyjs-yoga/measurement.test.mts Renames a test to be backend-neutral (native → backend).
tests/taffyjs-yoga/fixtures/measure-path-profile.mjs Makes backend and Yoga entry specifiers injectable via env vars for reuse in wasm runs.
tests/taffyjs-yoga/differences.test.mts Adds new “Different” regression fixtures (partial shrink when total < 1; percentage gap in auto-sized container) and imports Gutter.
tests/taffyjs-yoga-wasm/vite.config.ts New: config to rerun Yoga tests against wasm backend via aliases and env-injected entry URLs.
tests/taffyjs-yoga-wasm/tsconfig.public-api.json New: public API typecheck against @taffyjs/yoga-wasm declaration outputs.
tests/taffyjs-yoga-wasm/tsconfig.json New: TS config for the Yoga-Wasm test workspace.
tests/taffyjs-yoga-wasm/tests/packed-consumer.ts New: packs tarballs, installs via npm/pnpm, validates Node and Chromium behavior and lazy /load compilation boundary.
tests/taffyjs-yoga-wasm/tests/package-contents.ts New: validates packed file set, backend imports, no embedded wasm payload, and no stray .d.ts emission into shared Yoga source.
tests/taffyjs-yoga-wasm/package.json New: scripts and deps for Yoga-Wasm test workspace (including Playwright).
tests/taffyjs-wasm/tests/packed-consumer.ts Ensures consumer install has a minimal package.json (module context) before running eval program.
README.md Promotes @taffyjs/yoga-wasm from WIP and links Yoga/Yoga-Wasm docs and compatibility boundary.
pnpm-lock.yaml Adds lock entries for the new packages/taffyjs-yoga-wasm and tests/taffyjs-yoga-wasm workspaces.
packages/taffyjs-yoga/THIRD-PARTY-LICENSES Renames/standardizes third-party license bundle file naming.
packages/taffyjs-yoga/src/values.ts Expands accepted percentage string syntax (whitespace + hex/binary/octal) and refines numeric parsing checks.
packages/taffyjs-yoga/src/projection.ts Updates the third-party license reference path in the PixelGrid attribution comment.
packages/taffyjs-yoga/src/load.ts Makes loadYoga() genuinely lazy by dynamically importing createYoga from the facade.
packages/taffyjs-yoga/README.md Updates third-party license reference to the standardized filename.
packages/taffyjs-yoga/package.json Updates published files list to include THIRD-PARTY-LICENSES instead of the prior notice filename.
packages/taffyjs-yoga/dist/types-CQnSOAjF.d.ts Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/dist/load.js Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/dist/load.d.ts Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/dist/index.js Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/dist/index.d.ts Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/dist/facade-CjSanW_Y.js Removes committed Yoga build artifact (dist no longer tracked).
packages/taffyjs-yoga/COMPATIBILITY.md Updates compatibility wording and adds new “Different” rows for shrink-total<1 and percentage gap in auto main size.
packages/taffyjs-yoga-wasm/vite.config.ts New: builds Yoga facade entries from shared Yoga source while externalizing @taffyjs/wasm and rewriting @taffyjs/node imports.
packages/taffyjs-yoga-wasm/tsconfig.json New: TS config for the Yoga-Wasm package’s Vite+ config.
packages/taffyjs-yoga-wasm/THIRD-PARTY-LICENSES New: third-party license bundle for derived PixelGrid logic used by the shared facade.
packages/taffyjs-yoga-wasm/README.md New: consumer guidance (aliasing yoga-layout), lazy /load contract, and compatibility boundary notes.
packages/taffyjs-yoga-wasm/package.json New: Yoga-Wasm package metadata/exports/scripts/dependencies.
.gitignore Ignores Yoga and Yoga-Wasm dist/ outputs now treated as build artifacts.
.github/workflows/ci.yml Stops asserting committed Yoga dist freshness; keeps other artifact drift checks.
.agents/docs/tooling-decisions.md Records/vouches repository-wide third-party license filename convention.
.agents/docs/technology-stack.md Updates build/test orchestration narrative for uncommitted Yoga dist and adds Yoga-Wasm verification flow.
.agents/docs/taffyjs-yoga-wasm-package.md New PCR: Yoga-Wasm package design, boundaries, and verification contract.
.agents/docs/taffyjs-yoga-reference.md Updates implementation reference to include new “Different” cases and percent-string parsing boundary.
.agents/docs/README.md Updates PCR map to include Yoga-Wasm design and the new tooling decision topic.
.agents/docs/intent.md Updates repo intent to include @taffyjs/yoga-wasm as a first-class package.
.agents/docs/architecture.md Updates architecture overview to include the 4th public package and Yoga-Wasm testing strategy.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +83 to +90
const numericSource = value.slice(0, -1);
if (!Number.isFinite(Number(numericSource))) {
throw new TypeError(`${name} percentage must be finite`);
}
const numeric = Number.parseFloat(numericSource);
if (Number.isNaN(numeric)) {
throw new TypeError(`${name} percentage must be numeric`);
}
Comment on lines 129 to +133
node.setWidth(100);
node.setWidth(" 1%");
node.setWidth("0x10%");
node.setWidth("0b10%");
node.setWidth("0o10%");
hyfdev added a commit that referenced this pull request Aug 16, 2026
hyfdev added a commit that referenced this pull request Aug 16, 2026
Add partial native style updates and the Yoga-compatible package backed by WebAssembly.

Refs: #26, #27, #29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants