Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: treat any quote glued to an identifier as text in mask() (#12794)
[._.]/ Adam Eivy1e8387395ad5
diff --git a/scripts/lib/mockContractScan.js b/scripts/lib/mockContractScan.jsindex 9b97373f73..b65135c5f0 100644--- a/scripts/lib/mockContractScan.js+++ b/scripts/lib/mockContractScan.js@@ -23,15 +23,13 @@ function startsRegex(source, at) {return before === '' || /[(,=:[!&|?{};>]$/.test(before) || /\breturn$/.test(before);}-const KEYWORD_BEFORE_STRING = /(?:^|[^\w$.])(?:return|case|typeof|in|of|yield|await|default|else|do|void|delete|new|throw|instanceof|from|import|export|as)$/;-/*** A quote glued to the end of an identifier cannot open a string literal, so it- * is JSX text or prose (`scene's`), not code. Keywords legitimately precede strings.+ * is JSX text or prose (`scene's`, `the default's`), not code. Minified `return'x'` is+ * an accepted blind spot; formatted source puts a space before the quote.*/function isTextApostrophe(source, at) {- if (!/[\p{L}\p{N}_$]/u.test(source[at - 1] ?? '')) return false;- return !KEYWORD_BEFORE_STRING.test(source.slice(Math.max(0, at - 12), at));+ return /[\p{L}\p{N}_$]/u.test(source[at - 1] ?? '');}/** Blank comments and string/template text (keeping `${}` code), preserving offsets. */diff --git a/server/mockContractConventions.test.js b/server/mockContractConventions.test.jsindex 0e70506ca0..9b6e88e210 100644--- a/server/mockContractConventions.test.js+++ b/server/mockContractConventions.test.js@@ -45,6 +45,7 @@ describe('vi.mock factory contract conventions', () => {'export default Panel;',].join('\n');expect(mask(src)).toContain('export default Panel');+ expect(mask('export const a = <i>the default\'s value</i>;\nexport const b = 1;')).toContain('export const b');expect(mask('export const a = <i>Zoë\'s</i>;\nexport const b = 1;')).toContain('export const b');expect(mask("export const a = 'x';\nexport const b = 1;")).toContain('export const b');expect(mask("export const c = 'don\\'t';")).not.toContain('don');