Replies: 1 comment
-
🔗 Related Work: Token Schema Structure RFCA new RFC has been published that provides 70% of the foundation needed for this sourcemap proposal: RFC: Token Schema Structure and Validation System (PR #644) Already Implemented (Foundation Complete)✅ UUID Preservation - All tokens maintain stable UUIDs What This RFC Adds (Next Steps)🔨 Bidirectional Traceability - Track implementations back to tokens Example: What's Already Possible// Find all tokens that reference blue-800
const references = tokens.filter(t =>
t.name.structure.referencedToken === "blue-800"
);
// Returns: ["accent-color-100", "button-background-default", ...]### RecommendationThis RFC should be the next priority after schema RFC approval because:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
RFC: Design Token Sourcemaps and Traceability
Status: Draft - Concept Stage
Author: Garth Braithwaite
DACI: [To be assigned]
Related: Token Structure RFC, Token Lifecycle RFC
Executive Summary
This RFC proposes a sourcemap system for design tokens that creates bidirectional traceability between design data (spectrum-tokens), platform implementations (iOS, Android, Web), and design tools (Figma).
Problem: When tokens are transformed for platform use (e.g., Spectrum iOS), the connection to the original design data is lost. Engineers can't easily access lifecycle metadata, discover deprecations, or trace token origins. Design-to-code mapping is manual and error-prone.
Solution: Generate sourcemap-like files during token compilation that maintain references via UUIDs and semver, enabling:
Background & Context
Current Pain Points
Proposal
1. Token Sourcemap Specification
Inspired by JavaScript Source Maps v3, create a
.tokens.mapfile format for design token compilation.Sourcemap File Structure
{ "version": 1, "sourceRoot": "https://github.com/adobe/spectrum-tokens", "sourceVersion": "3.2.0", "platform": "ios", "mappings": { "button-background-default": { "uuid": "550e8400-e29b-41d4-a716-446655440000", "sourceFile": "tokens/semantic/action.json", "generatedFile": "Sources/SpectrumTokens/Action.swift", "generatedSymbol": "ButtonBackgroundDefault", "lifecycle": { "introduced": "2.0.0", "status": "active" }, "figmaMapping": { "variableId": "figma-var-id-123", "variableName": "button/background/default" } } } }2. UUID-Based Token Identity
Every token in spectrum-tokens gets a stable UUID that persists across renames and refactors.
Benefits:
3. Platform Build Tool Integration
Swift Example (iOS):
4. Figma ↔ Spectrum Tokens Mapping
Sourcemap enables bidirectional mapping between Figma variables and spectrum-tokens, even when naming differs.
Use Cases:
5. Cross-Platform Token Usage Tracking
Example Query: "Where is
button-background-defaultused?"Use Cases
Use Case 1: Platform Engineer Debugging
Look up generated code symbol → Find source token → Check GitHub history
Use Case 2: Migration Planning
Query deprecated tokens → Check platform usage → Prioritize migrations
Use Case 3: Figma Sync Validation
Compare Figma variables against sourcemap → Report mismatches → Automate sync
Use Case 4: Breaking Change Prevention
Compare old vs new sourcemaps → Detect removals/renames → Generate migration guide
Implementation Phases
Phase 1: Proof of Concept
Phase 2: Single Platform Validation
Phase 3: Multi-Platform Rollout
Phase 4: Figma Integration
Open Questions
Technical Questions
Integration Questions
References
External Standards
Related RFCs
Full RFC: View complete RFC with all technical details
Beta Was this translation helpful? Give feedback.
All reactions