@multiplatform.one/config 9.16.1 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/design-lint.mjs +29 -6
  2. package/lib/index.js +4 -4
  3. package/lib/{storybook-BpaziEtP.js → storybook-BRZwQLAM.js} +150 -9
  4. package/lib/storybook.js +1 -1
  5. package/lib/{tamaguiWorkspacePaths-DR3dud79.js → tamaguiWorkspacePaths-BFMQNk1l.js} +8 -5
  6. package/lib/{vite-CgiDLR6V.js → vite-DaBjbGS0.js} +40 -52
  7. package/lib/vite.js +4 -4
  8. package/lib/{vitest-B2vcGrZM.js → vitest-NTT7k5jB.js} +97 -10
  9. package/lib/vitest.js +2 -2
  10. package/lib/{workspacePublicPackages-DN-1LPcH.js → workspacePublicPackages-z0fVhgGN.js} +121 -8
  11. package/lint.mjs +874 -52
  12. package/oxlint.mjs +26 -1
  13. package/package.json +6 -6
  14. package/press-lint.mjs +86 -5
  15. package/spec-registry.mjs +15 -0
  16. package/src/lint.spec.ts +696 -12
  17. package/src/movedDepAliases.spec.ts +73 -0
  18. package/src/movedDepAliases.ts +91 -0
  19. package/src/nativeBlockScoping.spec.ts +12 -14
  20. package/src/nativeOnlyDepStubs.spec.ts +178 -0
  21. package/src/nativeOnlyDepStubs.ts +215 -0
  22. package/src/noVoicelessText.rule.spec.ts +1 -1
  23. package/src/noVoicelessText.spec.ts +1 -1
  24. package/src/oxlint.spec.ts +5 -5
  25. package/src/phosphorNativeInk.spec.ts +17 -18
  26. package/src/phosphorTokenColor.spec.ts +35 -0
  27. package/src/phosphorTokenColor.ts +8 -5
  28. package/src/press-lint.spec.ts +64 -3
  29. package/src/react-native.config.cjs +9 -0
  30. package/src/shims/phosphorThemeInk.js +6 -1
  31. package/src/shims/svgTouchSound.web.js +23 -0
  32. package/src/singletonDepAliases.spec.ts +99 -14
  33. package/src/singletonDepAliases.ts +102 -7
  34. package/src/storybook.spec.ts +0 -3
  35. package/src/storybook.ts +17 -6
  36. package/src/vite.nativeEntries.spec.ts +21 -20
  37. package/src/vite.spec.ts +11 -20
  38. package/src/vite.ts +44 -68
  39. package/src/vitest.spec.ts +142 -4
  40. package/src/vitest.ts +106 -8
  41. package/types/movedDepAliases.d.ts +8 -0
  42. package/types/movedDepAliases.d.ts.map +1 -0
  43. package/types/nativeOnlyDepStubs.d.ts +41 -0
  44. package/types/nativeOnlyDepStubs.d.ts.map +1 -0
  45. package/types/phosphorTokenColor.d.ts.map +1 -1
  46. package/types/singletonDepAliases.d.ts +55 -3
  47. package/types/singletonDepAliases.d.ts.map +1 -1
  48. package/types/storybook.d.ts.map +1 -1
  49. package/types/vite.d.ts +10 -1
  50. package/types/vite.d.ts.map +1 -1
  51. package/types/vitest.d.ts +46 -1
  52. package/types/vitest.d.ts.map +1 -1
package/oxlint.mjs CHANGED
@@ -80,6 +80,31 @@ export function findHexEscapes(src) {
80
80
  return sites;
81
81
  }
82
82
 
83
+ /**
84
+ * A `pseudo-prop-escape: <reason>` line or block comment (FZ-10849). A JSDoc
85
+ * `*` line or a backticked mention is prose about the marker, not the marker.
86
+ */
87
+ const PSEUDO_PROP_ESCAPE_COMMENT =
88
+ /(?<!`)(?:\/\/|\/\*)\s*pseudo-prop-escape:\s*(.*?)\s*(?:\*\/.*)?$/;
89
+
90
+ /**
91
+ * Every `pseudo-prop-escape:` comment in a source file, with the reason it
92
+ * writes and the line it sits on.
93
+ * @param {string} src
94
+ * @returns {{ line: number, reason: string }[]}
95
+ */
96
+ export function findPseudoPropEscapes(src) {
97
+ if (!src.includes("pseudo-prop-escape:")) return [];
98
+ /** @type {{ line: number, reason: string }[]} */
99
+ const sites = [];
100
+ src.split("\n").forEach((text, index) => {
101
+ if (text.trim().startsWith("*")) return;
102
+ const match = text.match(PSEUDO_PROP_ESCAPE_COMMENT);
103
+ if (match) sites.push({ line: index + 1, reason: match[1].trim() });
104
+ });
105
+ return sites;
106
+ }
107
+
83
108
  /**
84
109
  * @param {unknown} context
85
110
  * @returns {string}
@@ -475,7 +500,7 @@ export const plugin = {
475
500
  },
476
501
  schema: [],
477
502
  messages: {
478
- hex: "Color literal {{value}} is banned. Use theme tokens (e.g. $color10) or semantic ramps.",
503
+ hex: "Color literal {{value}} is banned. Use theme tokens (e.g. $color-10) or semantic ramps.",
479
504
  },
480
505
  },
481
506
  create(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/config",
3
- "version": "9.16.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared build and test configuration presets for multiplatform.one",
5
5
  "keywords": [
6
6
  "config",
@@ -122,8 +122,8 @@
122
122
  "@babel/parser": "^7.29.9",
123
123
  "@babel/plugin-transform-block-scoping": "^7.29.7",
124
124
  "@babel/traverse": "^7.29.10",
125
- "@multiplatform.one/utils": "^9.16.1",
126
- "@tamagui/vite-plugin": "2.7.6",
125
+ "@multiplatform.one/utils": "^10.0.0",
126
+ "@tamagui/vite-plugin": "3.2.3",
127
127
  "@vitejs/plugin-react": "^6.1.2",
128
128
  "dotenv": "^17.4.2",
129
129
  "fast-flow-transform": "^0.0.3",
@@ -143,11 +143,11 @@
143
143
  },
144
144
  "peerDependencies": {
145
145
  "@playwright/test": ">=1.20.0",
146
- "one": "^1.4.10",
146
+ "one": "^2.14.1",
147
147
  "react": ">=19.0.0",
148
148
  "react-native": ">=0.83.0",
149
- "tamagui": ">=2.0.0",
150
- "vxrn": "^1.4.10"
149
+ "tamagui": ">=3.0.0",
150
+ "vxrn": "^2.14.1"
151
151
  },
152
152
  "peerDependenciesMeta": {
153
153
  "@playwright/test": {
package/press-lint.mjs CHANGED
@@ -33,6 +33,55 @@ const claimKeys = new Set(["pressStyle", "focusVisibleStyle"]);
33
33
  const pressHandlers = new Set(["onPress", "onPressIn", "onPressOut", "onLongPress"]);
34
34
  const inputTag = /(?:Input|TextArea)$/;
35
35
 
36
+ const claimStates = new Set(["press", "active", "focus-visible"]);
37
+ const claimObjectStates = new Set(["press", "focus-visible"]);
38
+ const flatClaimHint = /pressStyle|focusVisibleStyle|(?<![\w/-])(?:press|active|focus-visible):/;
39
+
40
+ /**
41
+ * The modifier chain of every clause in a Tamagui 3 flat value:
42
+ * `"1 dark:press:0.5 focus-within:2"` gives `[["dark", "press"], ["focus-within"]]`.
43
+ * @param {string} value
44
+ * @returns {string[][]}
45
+ */
46
+ function clauseChains(value) {
47
+ /** @type {string[][]} */
48
+ const chains = [];
49
+ for (const word of value.split(/\s+/)) {
50
+ const chain = word.match(/^((?:[@A-Za-z][\w/@-]*:)+)\S/)?.[1];
51
+ if (chain) chains.push(chain.slice(0, -1).split(":"));
52
+ }
53
+ return chains;
54
+ }
55
+
56
+ /**
57
+ * A string literal's text, or undefined for anything else.
58
+ * @param {ts.Node | undefined} node
59
+ */
60
+ function stringText(node) {
61
+ if (!node) return undefined;
62
+ if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return node.text;
63
+ if (ts.isJsxExpression(node)) return stringText(node.expression);
64
+ return undefined;
65
+ }
66
+
67
+ /**
68
+ * Whether a flat value, or a typed value object's keys, name a state that
69
+ * makes Tamagui 3 attach press events on native: a `press:`, `active:` or
70
+ * `focus-visible:` clause, or a `press` / `focus-visible` key.
71
+ * @param {ts.Node | undefined} node
72
+ */
73
+ function claimsByValue(node) {
74
+ const text = stringText(node);
75
+ if (text !== undefined)
76
+ return clauseChains(text).some((chain) => chain.some((state) => claimStates.has(state)));
77
+ const expr = node && ts.isJsxExpression(node) ? node.expression : node;
78
+ if (!expr || !ts.isObjectLiteralExpression(expr)) return false;
79
+ return expr.properties.some((prop) => {
80
+ const key = prop.name && keyName(prop.name);
81
+ return !!key && key.split(":").some((state) => claimObjectStates.has(state));
82
+ });
83
+ }
84
+
36
85
  /** @param {ts.Node} node */
37
86
  function keyName(node) {
38
87
  if (ts.isIdentifier(node) || ts.isStringLiteral(node)) return node.text;
@@ -132,6 +181,7 @@ function parse(source, filename) {
132
181
  if (ts.isSpreadAssignment(prop)) return carriesClaim(prop.expression, seen);
133
182
  const key = prop.name && keyName(prop.name);
134
183
  if (key && claimKeys.has(key)) return true;
184
+ if (ts.isPropertyAssignment(prop) && claimsByValue(prop.initializer)) return true;
135
185
  return ts.isPropertyAssignment(prop) && carriesClaim(prop.initializer, seen);
136
186
  });
137
187
  if (
@@ -198,7 +248,7 @@ function parse(source, filename) {
198
248
  * @returns {string[]}
199
249
  */
200
250
  export function exportedPressClaimants(source, filename) {
201
- if (!/pressStyle|focusVisibleStyle/.test(source)) return [];
251
+ if (!flatClaimHint.test(source)) return [];
202
252
  const { exported, isClaimant, isInput } = parse(source, filename);
203
253
  return [...exported].filter((name) => !isInput(name) && isClaimant(name, new Set()));
204
254
  }
@@ -257,7 +307,9 @@ export function findNestedPressClaimants(source, filename, imported = new Set())
257
307
  const named = ts.isIdentifier(el.tagName);
258
308
  const claims =
259
309
  !(named && isInput(tag)) &&
260
- ([...claimKeys].some((key) => props.has(key)) || (named && isClaimant(tag, imported)));
310
+ ([...claimKeys].some((key) => props.has(key)) ||
311
+ [...props.values()].some((attr) => claimsByValue(attr.initializer)) ||
312
+ (named && isClaimant(tag, imported)));
261
313
  if (owner && claims && !handles && !props.has("asChild") && pointerEvents !== "box-none") {
262
314
  const { line } = file.getLineAndCharacterOfPosition(el.getStart(file));
263
315
  found.push({ line: line + 1, tag, owner });
@@ -389,9 +441,34 @@ function webGated(node, file) {
389
441
  * @param {ts.SourceFile} file
390
442
  */
391
443
  function isFocusWithinKey(node, file) {
392
- if (ts.isJsxAttribute(node)) return node.name.getText(file) === "focusWithinStyle";
444
+ if (ts.isJsxAttribute(node))
445
+ return (
446
+ node.name.getText(file) === "focusWithinStyle" || nativeFocusWithinValue(node.initializer)
447
+ );
393
448
  const property = ts.isPropertyAssignment(node) || ts.isShorthandPropertyAssignment(node);
394
- return property && keyName(node.name) === "focusWithinStyle";
449
+ if (!property) return false;
450
+ const key = keyName(node.name);
451
+ if (key === "focusWithinStyle") return true;
452
+ if (key && nativeFocusWithinChain(key.split(":"))) return true;
453
+ return ts.isPropertyAssignment(node) && stringText(node.initializer) !== undefined
454
+ ? nativeFocusWithinValue(node.initializer)
455
+ : false;
456
+ }
457
+
458
+ /** @param {string[]} chain */
459
+ function nativeFocusWithinChain(chain) {
460
+ return chain.includes("focus-within");
461
+ }
462
+
463
+ /**
464
+ * A flat value with a `focus-within:` clause. A `web:` modifier in the same
465
+ * chain is not taken as a gate: whether Tamagui 3 keeps the state off native
466
+ * for it is not verified, and the isWeb spread is.
467
+ * @param {ts.Node | undefined} node
468
+ */
469
+ function nativeFocusWithinValue(node) {
470
+ const text = stringText(node);
471
+ return text !== undefined && clauseChains(text).some(nativeFocusWithinChain);
395
472
  }
396
473
 
397
474
  /**
@@ -414,7 +491,11 @@ function isFocusWithinKey(node, file) {
414
491
  * @returns {{ line: number }[]}
415
492
  */
416
493
  export function findNativeFocusWithin(source, filename) {
417
- if (!source.includes("focusWithinStyle") || /\.web\.[cm]?[jt]sx?$/.test(filename)) return [];
494
+ if (
495
+ !(source.includes("focusWithinStyle") || source.includes("focus-within")) ||
496
+ /\.web\.[cm]?[jt]sx?$/.test(filename)
497
+ )
498
+ return [];
418
499
  const file = ts.createSourceFile(
419
500
  filename,
420
501
  source,
package/spec-registry.mjs CHANGED
@@ -37,6 +37,7 @@ export const SLOT_MARGIN_CLASS = "SLOT-MARGIN";
37
37
  export const SIZE_RECIPE_ESCAPE_HEADING = "## Size-recipe escapes";
38
38
  export const HEX_ESCAPE_HEADING = "## Colour-literal escapes";
39
39
  export const TITLE_CASE_ESCAPE_HEADING = "## Title-case escapes";
40
+ export const PSEUDO_PROP_ESCAPE_HEADING = "## Pseudo-prop escapes";
40
41
 
41
42
  /** `` `a — b` `` → `a — b`. */
42
43
  function unwrapCode(cell) {
@@ -178,6 +179,20 @@ export function readTitleCaseEscapeRegistry(specPath = defaultSpecPath()) {
178
179
  return readFileReasonRegistry(specPath, TITLE_CASE_ESCAPE_HEADING);
179
180
  }
180
181
 
182
+ /**
183
+ * Sites allowed to keep a Tamagui 2 pseudo-style prop (FZ-10849): one
184
+ * `{ file, reason }` per row, matched verbatim against the site's
185
+ * `pseudo-prop-escape:` comment. The props emit nothing under Tamagui 3, so an
186
+ * escape is only for a value no clause can express, not for a value nobody
187
+ * rewrote yet.
188
+ *
189
+ * @param {string} [specPath]
190
+ * @returns {{ specPath: string, present: boolean, escapes: { file: string, reason: string }[] }}
191
+ */
192
+ export function readPseudoPropEscapeRegistry(specPath = defaultSpecPath()) {
193
+ return readFileReasonRegistry(specPath, PSEUDO_PROP_ESCAPE_HEADING);
194
+ }
195
+
181
196
  const invokedDirectly =
182
197
  typeof process.argv[1] === "string" && import.meta.url === pathToFileURL(process.argv[1]).href;
183
198