From 0f3bdd424f32fef939fba86230aa83bc290433c8 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 31 Jan 2026 19:59:22 -0500 Subject: [PATCH 01/28] feat: refactor getValue to static parseAttribute for JSX compilation --- src/jsx-loader.js | 36 ++++++--- .../fixtures/attribute-changed-callback.txt | 76 ++++++++++--------- .../fixtures/attribute-changed-callback.txt | 12 ++- 3 files changed, 72 insertions(+), 52 deletions(-) diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 55b17e20..012e90bd 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -282,13 +282,16 @@ export function parseJsx(moduleURL) { const hasOwnObservedAttributes = undefined; let inferredObservability = false; let observedAttributes = []; + let componentName; let tree = acorn.Parser.extend(jsx()).parse(result.code, { ecmaVersion: 'latest', sourceType: 'module', }); string = ''; - // TODO: would be nice to do this one pass, but first we need to know if `inferredObservability` is set first + // TODO: would be nice to do everything in one pass, but first we need to know + // - if `inferredObservability` is set + // - get the name of the component for `static` references walk.simple( tree, { @@ -308,6 +311,18 @@ export function parseJsx(moduleURL) { } } }, + ExportDefaultDeclaration(node) { + const { declaration } = node; + + if ( + declaration && + declaration.type === 'ClassDeclaration' && + declaration.id && + declaration.id.name + ) { + componentName = declaration.id.name; + } + }, }, { // https://github.com/acornjs/acorn/issues/829#issuecomment-1172586171 @@ -435,24 +450,21 @@ export function parseJsx(moduleURL) { static get observedAttributes() { return [${[...trackingAttrs].map((attr) => `'${attr}'`).join()}] } - + static parseAttribute = (value) => value.charAt(0) === '{' || value.charAt(0) === '[' + ? JSON.parse(value) + : !isNaN(value) + ? parseInt(value, 10) + : value === 'true' || value === 'false' + ? value === 'true' ? true : false + : value; attributeChangedCallback(name, oldValue, newValue) { - function getValue(value) { - return value.charAt(0) === '{' || value.charAt(0) === '[' - ? JSON.parse(value) - : !isNaN(value) - ? parseInt(value, 10) - : value === 'true' || value === 'false' - ? value === 'true' ? true : false - : value; - } if (newValue !== oldValue) { switch(name) { ${trackingAttrs .map((attr) => { return ` case '${attr}': - this.${attr} = getValue(newValue); + this.${attr} = ${componentName}.parseAttribute(newValue); break; `; }) diff --git a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt index ccc626bd..9edcceb0 100644 --- a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -1,40 +1,44 @@ +static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === '[' + ? JSON.parse(value) + : !isNaN(value) + ? parseInt(value, 10) + : value === 'true' || value === 'false' + ? value === 'true' ? true : false + : value; attributeChangedCallback(name, oldValue, newValue) { - function getValue(value) { - return value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) : !isNaN(value) ? parseInt(value, 10) : value === 'true' || value === 'false' ? value === 'true' ? true : false : value; - } - if (newValue !== oldValue) { - switch (name) { - case 'count': - this.count = getValue(newValue); - break; - case 'highlight': - this.highlight = getValue(newValue); - break; - } - this.update(name, oldValue, newValue); - } + if (newValue !== oldValue) { + switch (name) { + case 'count': + this.count = Counter.parseAttribute(newValue); + break; + case 'highlight': + this.highlight = Counter.parseAttribute(newValue); + break; } - update(name, oldValue, newValue) { - const attr = `data-wcc-${ name }`; - const selector = `[${ attr }]`; + this.update(name, oldValue, newValue); + } +} +update(name, oldValue, newValue) { + const attr = `data-wcc-${ name }`; + const selector = `[${ attr }]`; - (this?.shadowRoot || this).querySelectorAll(selector).forEach(el => { - const needle = oldValue === '' ? '' : oldValue ?? el.getAttribute(attr); + (this?.shadowRoot || this).querySelectorAll(selector).forEach(el => { + const needle = oldValue === '' ? '' : oldValue ?? el.getAttribute(attr); - switch (el.getAttribute('data-wcc-ins')) { - case 'text': - el.textContent = el.textContent.replace(needle, newValue); - break; - case 'attr': - if (el.hasAttribute(el.getAttribute(attr))) { - el.setAttribute(el.getAttribute(attr), newValue); - } - break; - } - }); - if ([ - 'count', - 'highlight' - ].includes(name)) { - } - } \ No newline at end of file + switch (el.getAttribute('data-wcc-ins')) { + case 'text': + el.textContent = el.textContent.replace(needle, newValue); + break; + case 'attr': + if (el.hasAttribute(el.getAttribute(attr))) { + el.setAttribute(el.getAttribute(attr), newValue); + } + break; + } + }); + if ([ + 'count', + 'highlight' + ].includes(name)) { + } +} \ No newline at end of file diff --git a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt index bc925d60..625a979b 100644 --- a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -1,11 +1,15 @@ +static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === '[' + ? JSON.parse(value) + : !isNaN(value) + ? parseInt(value, 10) + : value === 'true' || value === 'false' + ? value === 'true' ? true : false + : value; attributeChangedCallback(name, oldValue, newValue) { - function getValue(value) { - return value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) : !isNaN(value) ? parseInt(value, 10) : value === 'true' || value === 'false' ? value === 'true' ? true : false : value; - } if (newValue !== oldValue) { switch (name) { case 'count': - this.count = getValue(newValue); + this.count = Counter.parseAttribute(newValue); break; } this.update(name,oldValue,newValue); From df648e47fb6d668ddd985217cfe1d10db985c02e Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 31 Jan 2026 21:33:03 -0500 Subject: [PATCH 02/28] feat: #232 refactor attributeChangedCallback and remove this.update --- docs/components/sandbox/signal-counter.jsx | 45 + docs/pages/sandbox.html | 61 +- package-lock.json | 778 +----------------- package.json | 1 + src/jsx-loader.js | 54 +- .../fixtures/attribute-changed-callback.txt | 36 +- .../fixtures/attribute-changed-callback.txt | 9 +- 7 files changed, 110 insertions(+), 874 deletions(-) create mode 100644 docs/components/sandbox/signal-counter.jsx diff --git a/docs/components/sandbox/signal-counter.jsx b/docs/components/sandbox/signal-counter.jsx new file mode 100644 index 00000000..df3f1a42 --- /dev/null +++ b/docs/components/sandbox/signal-counter.jsx @@ -0,0 +1,45 @@ +export const inferredObservability = true; + +export default class SignalCounter extends HTMLElement { + constructor() { + super(); + this.count = new Signal.State(0); + this.parity = new Signal.Computed(() => (this.count.get() % 2 === 0 ? 'even' : 'odd')); + } + + connectedCallback() { + if (!this.shadowRoot) { + this.attachShadow({ + mode: 'open', + }); + this.render(); + } + } + + increment() { + this.count.set(this.count.get() + 1); + console.log('increment', this.count.get()); + } + + decrement() { + this.count.set(this.count.get() - 1); + console.log('decrement', this.count.get()); + } + + render() { + const { count, parity } = this; + + return ( +
+ + + + + The count is ${count.get()} (${parity.get()}) + +
+ ); + } +} + +customElements.define('sb-signal-counter-jsx', SignalCounter); diff --git a/docs/pages/sandbox.html b/docs/pages/sandbox.html index 07f7c4e6..6634476d 100644 --- a/docs/pages/sandbox.html +++ b/docs/pages/sandbox.html @@ -32,7 +32,8 @@ } - + + + + + @@ -73,7 +92,19 @@

WCC Sandbox

-

Light DOM (no JS)

+

JSX + inferredObservability

+ + + + + +
+      <sb-signal-counter-jsx
+        count="3"
+      ></sb-signal-counter-jsx>
+    
+ + diff --git a/package-lock.json b/package-lock.json index 17d0a40f..d193f4ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "acorn-walk": "^8.3.4", "astring": "^1.9.0", "parse5": "^7.2.1", + "signal-polyfill": "^0.2.2", "sucrase": "^3.35.0" }, "devDependencies": { @@ -319,443 +320,18 @@ "url": "https://github.com/sponsors/JounQin" } }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { + "node_modules/@esbuild/darwin-arm64": { "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", "cpu": [ - "x64" + "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "win32" + "darwin" ], "engines": { "node": ">=18" @@ -1362,34 +938,6 @@ } } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz", - "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz", - "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.57.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz", @@ -1404,314 +952,6 @@ "darwin" ] }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz", - "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz", - "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz", - "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz", - "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz", - "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz", - "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz", - "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz", - "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz", - "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz", - "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz", - "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz", - "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz", - "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz", - "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz", - "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz", - "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz", - "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz", - "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz", - "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz", - "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz", - "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.57.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz", - "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -12330,6 +11570,12 @@ "dev": true, "license": "ISC" }, + "node_modules/signal-polyfill": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/signal-polyfill/-/signal-polyfill-0.2.2.tgz", + "integrity": "sha512-p63Y4Er5/eMQ9RHg0M0Y64NlsQKpiu6MDdhBXpyywRuWiPywhJTpKJ1iB5K2hJEbFZ0BnDS7ZkJ+0AfTuL37Rg==", + "license": "Apache-2.0" + }, "node_modules/sirv": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", diff --git a/package.json b/package.json index bbbfa3b3..0f1228d6 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "acorn-walk": "^8.3.4", "astring": "^1.9.0", "parse5": "^7.2.1", + "signal-polyfill": "^0.2.2", "sucrase": "^3.35.0" }, "devDependencies": { diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 012e90bd..938787e6 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -10,6 +10,9 @@ import fs from 'fs'; import jsx from '@projectevergreen/acorn-jsx-esm'; import { parse, parseFragment, serialize } from 'parse5'; import { transform } from 'sucrase'; +import { Signal } from 'signal-polyfill'; + +globalThis.Signal = globalThis.Signal ?? Signal; const jsxRegex = /\.(jsx)$/; const tsxRegex = /\.(tsx)$/; @@ -432,17 +435,6 @@ export function parseJsx(moduleURL) { `; }) .join('\n'); - const derivedSetters = derivedAttrs - .map((attr) => { - const name = attr.id.name; - - return ` - const old_${name} = this.get_${name}(oldValue); - const new_${name} = this.get_${name}(newValue); - this.update('${name}', old_${name}, new_${name}); - `; - }) - .join('\n'); // TODO: better way to determine value type, e,g. array, int, object, etc? // TODO: better way to test for shadowRoot presence when running querySelectorAll @@ -458,45 +450,7 @@ export function parseJsx(moduleURL) { ? value === 'true' ? true : false : value; attributeChangedCallback(name, oldValue, newValue) { - if (newValue !== oldValue) { - switch(name) { - ${trackingAttrs - .map((attr) => { - return ` - case '${attr}': - this.${attr} = ${componentName}.parseAttribute(newValue); - break; - `; - }) - .join('\n')} - } - this.update(name, oldValue, newValue); - } - } - - update(name, oldValue, newValue) { - const attr = \`data-wcc-\${name}\`; - const selector = \`[\${attr}]\`; - - (this?.shadowRoot || this).querySelectorAll(selector).forEach((el) => { - // handle empty strings as a value for the purposes of attribute change detection - const needle = oldValue === '' ? '' : oldValue ?? el.getAttribute(attr); - - switch(el.getAttribute('data-wcc-ins')) { - case 'text': - el.textContent = el.textContent.replace(needle, newValue); - break; - case 'attr': - if (el.hasAttribute(el.getAttribute(attr))) { - el.setAttribute(el.getAttribute(attr), newValue); - } - break; - } - }) - - if ([${[...trackingAttrs].map((attr) => `'${attr}'`).join()}].includes(name)) { - ${derivedSetters} - } + this[name].set(${componentName}.parseAttribute(newValue)); } ${derivedGetters} diff --git a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt index 9edcceb0..d4ac4441 100644 --- a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -6,39 +6,5 @@ static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === ? value === 'true' ? true : false : value; attributeChangedCallback(name, oldValue, newValue) { - if (newValue !== oldValue) { - switch (name) { - case 'count': - this.count = Counter.parseAttribute(newValue); - break; - case 'highlight': - this.highlight = Counter.parseAttribute(newValue); - break; - } - this.update(name, oldValue, newValue); - } -} -update(name, oldValue, newValue) { - const attr = `data-wcc-${ name }`; - const selector = `[${ attr }]`; - - (this?.shadowRoot || this).querySelectorAll(selector).forEach(el => { - const needle = oldValue === '' ? '' : oldValue ?? el.getAttribute(attr); - - switch (el.getAttribute('data-wcc-ins')) { - case 'text': - el.textContent = el.textContent.replace(needle, newValue); - break; - case 'attr': - if (el.hasAttribute(el.getAttribute(attr))) { - el.setAttribute(el.getAttribute(attr), newValue); - } - break; - } - }); - if ([ - 'count', - 'highlight' - ].includes(name)) { - } + this[name].set(Counter.parseAttribute(newValue)); } \ No newline at end of file diff --git a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt index 625a979b..d4ac4441 100644 --- a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -6,12 +6,5 @@ static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === ? value === 'true' ? true : false : value; attributeChangedCallback(name, oldValue, newValue) { - if (newValue !== oldValue) { - switch (name) { - case 'count': - this.count = Counter.parseAttribute(newValue); - break; - } - this.update(name,oldValue,newValue); - } + this[name].set(Counter.parseAttribute(newValue)); } \ No newline at end of file From 3b8f4c50521b6384e7926319d607341b566905f2 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 31 Jan 2026 21:34:28 -0500 Subject: [PATCH 03/28] feat: #232 remove inferredObservability instruction markers --- src/jsx-loader.js | 28 ++++--------------- .../jsx-inferred-obsevability.spec.js | 9 ++---- .../tsx-inferred-obsevability.spec.js | 4 +-- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 938787e6..284cdf7b 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -80,7 +80,7 @@ function applyDomDepthSubstitutions(tree, currentDepth = 1, hasShadowRoot = fals return tree; } -function parseJsxElement(element, moduleContents = '', inferredObservability = false) { +function parseJsxElement(element, moduleContents = '') { try { const { type } = element; @@ -127,14 +127,8 @@ function parseJsxElement(element, moduleContents = '', inferredObservability = f if (left.object.type === 'ThisExpression') { if (left.property.type === 'Identifier') { - if (inferredObservability) { - // very naive (fine grained?) reactivity - // string += ` ${name}="__this__.${left.property.name}${expression.operator}${right.raw}; __this__.update(\\'${left.property.name}\\', null, __this__.${left.property.name});"`; - string += ` ${name}="__this__.${left.property.name}${expression.operator}${right.raw}; __this__.setAttribute(\\'${left.property.name}\\', __this__.${left.property.name});"`; - } else { - // implicit reactivity using this.render - string += ` ${name}="__this__.${left.property.name}${expression.operator}${right.raw}; __this__.render();"`; - } + // implicit reactivity using this.render + string += ` ${name}="__this__.${left.property.name}${expression.operator}${right.raw}; __this__.render();"`; } } } @@ -169,11 +163,6 @@ function parseJsxElement(element, moduleContents = '', inferredObservability = f default: break; } - - // only apply this when dealing with `this` references - if (inferredObservability) { - string += ` data-wcc-${expression.name}="${name}" data-wcc-ins="attr"`; - } } } else { // xxx > @@ -185,9 +174,7 @@ function parseJsxElement(element, moduleContents = '', inferredObservability = f string += openingElement.selfClosing ? ' />' : '>'; if (element.children.length > 0) { - element.children.forEach((child) => - parseJsxElement(child, moduleContents, inferredObservability), - ); + element.children.forEach((child) => parseJsxElement(child, moduleContents)); } string += ``; @@ -202,11 +189,6 @@ function parseJsxElement(element, moduleContents = '', inferredObservability = f if (type === 'Identifier') { // You have {count} TODOs left to complete - if (inferredObservability) { - const { name } = element.expression; - - string = `${string.slice(0, string.lastIndexOf('>'))} data-wcc-${name}="\${this.${name}}" data-wcc-ins="text">`; - } // TODO be able to remove this extra data attribute // string = `${string.slice(0, string.lastIndexOf('>'))} data-wcc-${name} data-wcc-ins="text">`; string += `$\{${element.expression.name}}`; @@ -359,7 +341,7 @@ export function parseJsx(moduleURL) { ]; // @ts-ignore } else if (n.type === 'ReturnStatement' && n.argument.type === 'JSXElement') { - const html = parseJsxElement(n.argument, moduleContents, inferredObservability); + const html = parseJsxElement(n.argument, moduleContents); const elementTree = getParse(html)(html); const elementRoot = hasShadowRoot ? 'this.shadowRoot' : 'this'; diff --git a/test/cases/jsx-inferred-observability/jsx-inferred-obsevability.spec.js b/test/cases/jsx-inferred-observability/jsx-inferred-obsevability.spec.js index fc230375..abfbdb39 100644 --- a/test/cases/jsx-inferred-observability/jsx-inferred-obsevability.spec.js +++ b/test/cases/jsx-inferred-observability/jsx-inferred-obsevability.spec.js @@ -55,23 +55,18 @@ describe('Run WCC For ', function () { expect(actual).to.contain(expected); }); - // + // it('should have the expected observability attributes on the component', () => { const badge = dom.window.document.querySelector('wcc-badge'); const conditionalClassSpan = badge.querySelector('span[class="unmet"]'); // conditional class rendering - expect(badge.getAttribute('data-wcc-count')).to.equal('count'); - expect(badge.getAttribute('data-wcc-ins')).to.equal('attr'); - expect(conditionalClassSpan.textContent.trim()).to.equal('0'); }); - // 0 + // 0 it('should have the expected observability attributes on the component', () => { const span = dom.window.document.querySelector('wcc-counter-jsx span[class="red"]'); - expect(span.getAttribute('data-wcc-highlight')).to.equal('class'); - expect(span.getAttribute('data-wcc-ins')).to.equal('attr'); expect(span.textContent.trim()).to.equal('0'); }); }); diff --git a/test/cases/tsx-inferred-observability/tsx-inferred-obsevability.spec.js b/test/cases/tsx-inferred-observability/tsx-inferred-obsevability.spec.js index 7f8dda3c..689f1345 100644 --- a/test/cases/tsx-inferred-observability/tsx-inferred-obsevability.spec.js +++ b/test/cases/tsx-inferred-observability/tsx-inferred-obsevability.spec.js @@ -55,12 +55,10 @@ describe('Run WCC For ', function () { expect(actual).to.contain(expected); }); - // 0 + // 0 it('should have the expected observability attributes on the component', () => { const span = dom.window.document.querySelector('wcc-counter-tsx span[class="red"]'); - expect(span.getAttribute('data-wcc-count')).to.equal('0'); - expect(span.getAttribute('data-wcc-ins')).to.equal('text'); expect(span.textContent.trim()).to.equal('0'); }); }); From 96c0252fb0aa3b3497ab987d2c455abd002740e3 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 14:39:56 -0500 Subject: [PATCH 04/28] feat: #232 local WCC override patches --- docs/pages/sandbox.html | 4 +- greenwood.config.ts | 2 +- package-lock.json | 294 ++++++++++++++++++ package.json | 4 +- patches/@greenwood+cli+0.34.0-alpha.4.patch | 10 + ...ood+plugin-import-jsx+0.34.0-alpha.4.patch | 13 + 6 files changed, 322 insertions(+), 5 deletions(-) create mode 100644 patches/@greenwood+cli+0.34.0-alpha.4.patch create mode 100644 patches/@greenwood+plugin-import-jsx+0.34.0-alpha.4.patch diff --git a/docs/pages/sandbox.html b/docs/pages/sandbox.html index 6634476d..d11d448d 100644 --- a/docs/pages/sandbox.html +++ b/docs/pages/sandbox.html @@ -32,7 +32,6 @@ } - - - + diff --git a/greenwood.config.ts b/greenwood.config.ts index 3a37489c..7daebac9 100644 --- a/greenwood.config.ts +++ b/greenwood.config.ts @@ -1,8 +1,8 @@ import type { Config } from '@greenwood/cli'; import { greenwoodPluginMarkdown } from '@greenwood/plugin-markdown'; -import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx'; import { greenwoodPluginCssModules } from '@greenwood/plugin-css-modules'; import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw'; +import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx'; const config: Config = { activeContent: true, diff --git a/package-lock.json b/package-lock.json index d193f4ef..88f85652 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "wc-compiler", "version": "0.19.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@projectevergreen/acorn-jsx-esm": "~0.1.0", @@ -43,6 +44,7 @@ "lint-staged": "^16.2.6", "mocha": "^9.2.2", "open-props": "^1.7.4", + "patch-package": "^8.0.1", "playwright": "^1.58.2", "prettier": "^3.6.2", "prism-themes": "^1.9.0", @@ -1778,6 +1780,13 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true, + "license": "BSD-2-Clause" + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -2556,6 +2565,25 @@ "@keyv/serialize": "^1.1.1" } }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -3529,6 +3557,24 @@ "dev": true, "license": "MIT" }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -4604,6 +4650,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -5233,6 +5289,19 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", @@ -6245,6 +6314,22 @@ "node": ">=0.10.0" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -6462,6 +6547,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", @@ -6627,6 +6725,26 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", + "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -6634,6 +6752,13 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -6644,6 +6769,16 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "license": "Public Domain", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/keygrip": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.1.0.tgz", @@ -6680,6 +6815,16 @@ "node": ">=0.10.0" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -9680,6 +9825,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -9743,6 +9898,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/open-props": { "version": "1.7.23", "resolved": "https://registry.npmjs.org/open-props/-/open-props-1.7.23.tgz", @@ -10019,6 +10191,110 @@ "node": ">= 0.8" } }, + "node_modules/patch-package": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.1.tgz", + "integrity": "sha512-VsKRIA8f5uqHQ7NGhwIna6Bx6D9s/1iXlA1hthBVBEbkq+t4kXD0HHt+rJhf/Z+Ci0F/HCB2hvn0qLdLG+Qxlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^10.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.2.4", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/patch-package/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/tmp": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/patch-package/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -11430,6 +11706,24 @@ "dev": true, "license": "ISC" }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/set-getter": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.1.tgz", diff --git a/package.json b/package.json index 0f1228d6..5303e7ef 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "test:tdd:jsx": "npm run test:jsx -- --watch", "test:docs": "vitest run --coverage", "test:docs:tdd": "vitest", - "prepare": "husky" + "prepare": "husky", + "postinstall": "patch-package" }, "dependencies": { "@projectevergreen/acorn-jsx-esm": "~0.1.0", @@ -90,6 +91,7 @@ "lint-staged": "^16.2.6", "mocha": "^9.2.2", "open-props": "^1.7.4", + "patch-package": "^8.0.1", "playwright": "^1.58.2", "prettier": "^3.6.2", "prism-themes": "^1.9.0", diff --git a/patches/@greenwood+cli+0.34.0-alpha.4.patch b/patches/@greenwood+cli+0.34.0-alpha.4.patch new file mode 100644 index 00000000..a68b79f3 --- /dev/null +++ b/patches/@greenwood+cli+0.34.0-alpha.4.patch @@ -0,0 +1,10 @@ +diff --git a/node_modules/@greenwood/cli/src/lib/execute-route-module.js b/node_modules/@greenwood/cli/src/lib/execute-route-module.js +index a7367ac..570f2f7 100644 +--- a/node_modules/@greenwood/cli/src/lib/execute-route-module.js ++++ b/node_modules/@greenwood/cli/src/lib/execute-route-module.js +@@ -1,4 +1,4 @@ +-import { renderToString, renderFromHTML } from "wc-compiler"; ++import { renderToString, renderFromHTML } from "../../../../../src/wcc.js"; + + async function executeRouteModule({ + moduleUrl, diff --git a/patches/@greenwood+plugin-import-jsx+0.34.0-alpha.4.patch b/patches/@greenwood+plugin-import-jsx+0.34.0-alpha.4.patch new file mode 100644 index 00000000..d2696cc8 --- /dev/null +++ b/patches/@greenwood+plugin-import-jsx+0.34.0-alpha.4.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@greenwood/plugin-import-jsx/src/index.js b/node_modules/@greenwood/plugin-import-jsx/src/index.js +index 5fe6e11..5975de3 100644 +--- a/node_modules/@greenwood/plugin-import-jsx/src/index.js ++++ b/node_modules/@greenwood/plugin-import-jsx/src/index.js +@@ -4,7 +4,7 @@ + * + */ + import { generate } from "astring"; +-import { parseJsx } from "wc-compiler/src/jsx-loader.js"; ++import { parseJsx } from "../../../../src/jsx-loader.js"; + + class ImportJsxResource { + constructor(compilation, options) { From 3671ea8b6beb16245a01a8379f132b6a5affe25f Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 14:43:24 -0500 Subject: [PATCH 05/28] feat: #232 local WCC override patches --- greenwood.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/greenwood.config.ts b/greenwood.config.ts index 7daebac9..3a37489c 100644 --- a/greenwood.config.ts +++ b/greenwood.config.ts @@ -1,8 +1,8 @@ import type { Config } from '@greenwood/cli'; import { greenwoodPluginMarkdown } from '@greenwood/plugin-markdown'; +import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx'; import { greenwoodPluginCssModules } from '@greenwood/plugin-css-modules'; import { greenwoodPluginImportRaw } from '@greenwood/plugin-import-raw'; -import { greenwoodPluginImportJsx } from '@greenwood/plugin-import-jsx'; const config: Config = { activeContent: true, From c869ba7d329fd4c69ebef3c4549b0c7323c971da Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 14:48:08 -0500 Subject: [PATCH 06/28] feat: #232 local WCC override patches --- package-lock.json | 457 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 400 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index 88f85652..9bc8ed43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -168,14 +168,14 @@ } }, "node_modules/@cacheable/utils": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.3.3.tgz", - "integrity": "sha512-JsXDL70gQ+1Vc2W/KUFfkAJzgb4puKwwKehNLuB+HrNKWf91O736kGfxn4KujXCCSuh6mRRL4XEB0PkAFjWS0A==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.3.4.tgz", + "integrity": "sha512-knwKUJEYgIfwShABS1BX6JyJJTglAFcEU7EXqzTdiGCXur4voqkiJkdgZIQtWNFhynzDWERcTYv/sETMu3uJWA==", "dev": true, "license": "MIT", "dependencies": { "hashery": "^1.3.0", - "keyv": "^5.5.5" + "keyv": "^5.6.0" } }, "node_modules/@cacheable/utils/node_modules/keyv": { @@ -940,6 +940,34 @@ } } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz", + "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz", + "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.57.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz", @@ -954,6 +982,314 @@ "darwin" ] }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz", + "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz", + "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz", + "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz", + "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz", + "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz", + "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz", + "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz", + "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz", + "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz", + "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz", + "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz", + "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz", + "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz", + "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz", + "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz", + "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz", + "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz", + "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz", + "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz", + "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz", + "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.57.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz", + "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -1233,9 +1569,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.19.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.8.tgz", - "integrity": "sha512-ebO/Yl+EAvVe8DnMfi+iaAyIqYdK0q/q0y0rw82INWEKJOBe6b/P3YWE8NW7oOlF/nXFNrHwhARrN/hdgDkraA==", + "version": "22.19.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.9.tgz", + "integrity": "sha512-PD03/U8g1F9T9MI+1OBisaIARhSzeidsUjQaf51fOxrfjeiKN9bLVO06lHuHYjxdnqLWJijJHfqXPSJri2EM2A==", "dev": true, "license": "MIT", "dependencies": { @@ -2798,11 +3134,20 @@ } }, "node_modules/ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", "dev": true, - "license": "MIT" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } }, "node_modules/cli-boxes": { "version": "2.2.1", @@ -4404,6 +4749,13 @@ "node": ">=0.10.0" } }, + "node_modules/expand-range/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, "node_modules/expand-range/node_modules/isobject": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", @@ -4859,9 +5211,9 @@ } }, "node_modules/geist": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/geist/-/geist-1.5.1.tgz", - "integrity": "sha512-mAHZxIsL2o3ZITFaBVFBnwyDOw+zNLYum6A6nIjpzCGIO8QtC3V76XF2RnZTyLx1wlDTmMDy8jg3Ib52MIjGvQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/geist/-/geist-1.7.0.tgz", + "integrity": "sha512-ZaoiZwkSf0DwwB1ncdLKp+ggAldqxl5L1+SXaNIBGkPAqcu+xjVJLxlf3/S8vLt9UHx1xu5fz3lbzKCj5iOVdQ==", "dev": true, "license": "SIL OPEN FONT LICENSE", "peerDependencies": { @@ -5132,6 +5484,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/globjoin": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", @@ -6277,6 +6639,13 @@ "is-ci": "bin.js" } }, + "node_modules/is-ci/node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true, + "license": "MIT" + }, "node_modules/is-core-module": { "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", @@ -6568,9 +6937,9 @@ "license": "MIT" }, "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true, "license": "MIT" }, @@ -6752,13 +7121,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-stable-stringify/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true, - "license": "MIT" - }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -10221,22 +10583,6 @@ "npm": ">5" } }, - "node_modules/patch-package/node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/patch-package/node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -10265,16 +10611,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/patch-package/node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/patch-package/node_modules/tmp": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", @@ -10888,6 +11224,13 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/readable-stream/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, "node_modules/readable-stream/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -11647,9 +11990,9 @@ } }, "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "dev": true, "license": "ISC", "bin": { @@ -11886,13 +12229,13 @@ } }, "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=6" } }, "node_modules/slice-ansi": { From c7f5058281a509007b3fefd89e0708b62d31df1a Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 18:42:36 -0500 Subject: [PATCH 07/28] feat: #232 remove unused getters and hoist observed attributes tracking to initial AST pass --- src/jsx-loader.js | 51 ++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 284cdf7b..04fb2a90 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -275,8 +275,9 @@ export function parseJsx(moduleURL) { string = ''; // TODO: would be nice to do everything in one pass, but first we need to know - // - if `inferredObservability` is set - // - get the name of the component for `static` references + // 1. if `inferredObservability` is set + // 2. get the name of the component class for `static` references + // 3, track observed attributes from `this` references in the template walk.simple( tree, { @@ -308,6 +309,29 @@ export function parseJsx(moduleURL) { componentName = declaration.id.name; } }, + ClassDeclaration(node) { + // @ts-ignore + if (node.superClass.name === 'HTMLElement') { + for (const n1 of node.body.body) { + if (n1.type === 'MethodDefinition') { + // @ts-ignore + const nodeName = n1.key.name; + if (nodeName === 'render') { + for (const n2 in n1.value.body.body) { + const n = n1.value.body.body[n2]; + + if (n.type === 'VariableDeclaration') { + observedAttributes = [ + ...observedAttributes, + ...findThisReferences('render', n), + ]; + } + } + } + } + } + } + }, }, { // https://github.com/acornjs/acorn/issues/829#issuecomment-1172586171 @@ -317,6 +341,7 @@ export function parseJsx(moduleURL) { }, ); + // apply all JSX transformations walk.simple( tree, { @@ -334,13 +359,7 @@ export function parseJsx(moduleURL) { for (const n2 in n1.value.body.body) { const n = n1.value.body.body[n2]; - if (n.type === 'VariableDeclaration') { - observedAttributes = [ - ...observedAttributes, - ...findThisReferences('render', n), - ]; - // @ts-ignore - } else if (n.type === 'ReturnStatement' && n.argument.type === 'JSXElement') { + if (n.type === 'ReturnStatement' && n.argument.type === 'JSXElement') { const html = parseJsxElement(n.argument, moduleContents); const elementTree = getParse(html)(html); const elementRoot = hasShadowRoot ? 'this.shadowRoot' : 'this'; @@ -405,18 +424,6 @@ export function parseJsx(moduleURL) { let newModuleContents = generate(tree); const trackingAttrs = observedAttributes.filter((attr) => typeof attr === 'string'); - // TODO ideally derivedAttrs would explicitly reference trackingAttrs - // and if there are no derivedAttrs, do not include the derivedGetters / derivedSetters code in the compiled output - const derivedAttrs = observedAttributes.filter((attr) => typeof attr !== 'string'); - const derivedGetters = derivedAttrs - .map((attr) => { - return ` - get_${attr.id.name}(${trackingAttrs.join(',')}) { - return ${moduleContents.slice(attr.init.start, attr.init.end)} - } - `; - }) - .join('\n'); // TODO: better way to determine value type, e,g. array, int, object, etc? // TODO: better way to test for shadowRoot presence when running querySelectorAll @@ -435,8 +442,6 @@ export function parseJsx(moduleURL) { this[name].set(${componentName}.parseAttribute(newValue)); } - ${derivedGetters} - ${newModuleContents.slice(insertPoint)} `; From dba95df907122529d2ea5c1d2d4368fea7fba5db Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 18:47:53 -0500 Subject: [PATCH 08/28] feat: #232 update TODO comments --- src/jsx-loader.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 04fb2a90..a805013b 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -17,11 +17,11 @@ globalThis.Signal = globalThis.Signal ?? Signal; const jsxRegex = /\.(jsx)$/; const tsxRegex = /\.(tsx)$/; -// TODO same hack as definitions +// TODO: same hack as definitions // https://github.com/ProjectEvergreen/wcc/discussions/74 let string; -// TODO move to a util +// TODO: move to a util // https://github.com/ProjectEvergreen/wcc/discussions/74 function getParse(html) { return html.indexOf('') >= 0 || html.indexOf('') >= 0 || html.indexOf('') >= 0 @@ -134,8 +134,7 @@ function parseJsxElement(element, moduleContents = '') { } } } else if (attribute.name.type === 'JSXIdentifier') { - // TODO is there any difference between an attribute for an event handler vs a normal attribute? - // Can all these be parsed using one function> + // TODO: is there any difference between an attribute for an event handler vs a normal attribute? if (attribute.value) { if (attribute.value.type === 'Literal') { // xxx="yyy" > @@ -189,8 +188,6 @@ function parseJsxElement(element, moduleContents = '') { if (type === 'Identifier') { // You have {count} TODOs left to complete - // TODO be able to remove this extra data attribute - // string = `${string.slice(0, string.lastIndexOf('>'))} data-wcc-${name} data-wcc-ins="text">`; string += `$\{${element.expression.name}}`; } else if (type === 'MemberExpression') { const { object } = element.expression.object; @@ -243,7 +240,7 @@ function findThisReferences(context, statement) { references.push(property.key.name); }); } else { - // TODO we are just blindly tracking anything here. + // TODO: we are just blindly tracking anything here. // everything should ideally be mapped to actual this references, to create a strong chain of direct reactivity // instead of tracking any declaration as a derived tracking attr // for convenience here, we push the entire declaration here, instead of the name like for direct this references (see above) @@ -274,7 +271,7 @@ export function parseJsx(moduleURL) { }); string = ''; - // TODO: would be nice to do everything in one pass, but first we need to know + // initial pass to get certain information before running JSX transformations (could we do this in one pass?) // 1. if `inferredObservability` is set // 2. get the name of the component class for `static` references // 3, track observed attributes from `this` references in the template @@ -412,6 +409,7 @@ export function parseJsx(moduleURL) { let insertPoint; for (const line of tree.body) { // TODO: test for class MyComponent vs export default class MyComponent + // https://github.com/ProjectEvergreen/wcc/issues/117 // @ts-ignore if ( line.type === 'ClassDeclaration' || @@ -425,8 +423,7 @@ export function parseJsx(moduleURL) { let newModuleContents = generate(tree); const trackingAttrs = observedAttributes.filter((attr) => typeof attr === 'string'); - // TODO: better way to determine value type, e,g. array, int, object, etc? - // TODO: better way to test for shadowRoot presence when running querySelectorAll + // TODO: better way to determine value type, e,g. array, number, object, etc within `parseAttribute`? newModuleContents = `${newModuleContents.slice(0, insertPoint)} static get observedAttributes() { return [${[...trackingAttrs].map((attr) => `'${attr}'`).join()}] From 1c6863533a8f4a84ef9a6d40c483cd1532bb30b1 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 Feb 2026 21:32:35 -0500 Subject: [PATCH 09/28] feat: #232 prune computed signals from observed attributes and handle signal transforms within templates for rendering --- docs/components/sandbox/signal-counter.jsx | 2 +- src/jsx-loader.js | 83 +++++++++++++++++-- .../src/counter.jsx | 24 +++--- .../src/counter.tsx | 13 +-- 4 files changed, 99 insertions(+), 23 deletions(-) diff --git a/docs/components/sandbox/signal-counter.jsx b/docs/components/sandbox/signal-counter.jsx index df3f1a42..0bdbdce2 100644 --- a/docs/components/sandbox/signal-counter.jsx +++ b/docs/components/sandbox/signal-counter.jsx @@ -35,7 +35,7 @@ export default class SignalCounter extends HTMLElement { - The count is ${count.get()} (${parity.get()}) + The count is {count.get()} ({parity.get()}) ); diff --git a/src/jsx-loader.js b/src/jsx-loader.js index a805013b..225a31d3 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -80,7 +80,7 @@ function applyDomDepthSubstitutions(tree, currentDepth = 1, hasShadowRoot = fals return tree; } -function parseJsxElement(element, moduleContents = '') { +function parseJsxElement(element, moduleContents = '', inferredObservability) { try { const { type } = element; @@ -136,9 +136,30 @@ function parseJsxElement(element, moduleContents = '') { } else if (attribute.name.type === 'JSXIdentifier') { // TODO: is there any difference between an attribute for an event handler vs a normal attribute? if (attribute.value) { + const expression = attribute?.value?.expression; if (attribute.value.type === 'Literal') { // xxx="yyy" > string += ` ${name}="${attribute.value.value}"`; + } else if ( + expression && + inferredObservability && + attribute.value.type === 'JSXExpressionContainer' && + expression?.type === 'CallExpression' && + expression?.callee.type === 'MemberExpression' && + expression?.arguments && + expression?.callee?.property?.name === 'get' + ) { + // xxx={products.get().length} > + // TODO: do we need to handle for set()? + const { object, property } = expression.callee; + + if (object.type === 'MemberExpression' && object?.object.type === 'ThisExpression') { + // The count is counter={this.count.get()} + string += ` ${name}=$\{${object.property.name}.${property.name}()}`; + } else if (object.type === 'Identifier') { + // xxx={products.get().length} > + string += ` ${name}=$\{${object.name}.${property.name}()}`; + } } else if (attribute.value.type === 'JSXExpressionContainer') { // xxx={allTodos.length} > const { value } = attribute; @@ -173,7 +194,9 @@ function parseJsxElement(element, moduleContents = '') { string += openingElement.selfClosing ? ' />' : '>'; if (element.children.length > 0) { - element.children.forEach((child) => parseJsxElement(child, moduleContents)); + element.children.forEach((child) => + parseJsxElement(child, moduleContents, inferredObservability), + ); } string += ``; @@ -186,7 +209,18 @@ function parseJsxElement(element, moduleContents = '') { if (type === 'JSXExpressionContainer') { const { type } = element.expression; - if (type === 'Identifier') { + if ( + inferredObservability && + type === 'CallExpression' && + element.expression.arguments && + element.expression?.callee?.type === 'MemberExpression' && + element.expression?.callee?.property?.name === 'get' + ) { + // The count is {count.get()} + // TODO: do we need to handle for set()? + const { object, property } = element.expression.callee; + string += `$\{${object.name}.${property.name}()}`; + } else if (type === 'Identifier') { // You have {count} TODOs left to complete string += `$\{${element.expression.name}}`; } else if (type === 'MemberExpression') { @@ -263,7 +297,9 @@ export function parseJsx(moduleURL) { // however, this requires making parseJsx async, but WCC acorn walking is done sync const hasOwnObservedAttributes = undefined; let inferredObservability = false; + // TODO: "merge" observedAtttibutes tracking with constructor tracking let observedAttributes = []; + let constructorMembersSignals = new Map(); let componentName; let tree = acorn.Parser.extend(jsx()).parse(result.code, { ecmaVersion: 'latest', @@ -329,6 +365,40 @@ export function parseJsx(moduleURL) { } } }, + MethodDefinition(node) { + // @ts-ignore + if ( + node.kind === 'constructor' && + node?.value.type === 'FunctionExpression' && + node.value.body?.type === 'BlockStatement' + ) { + const root = node.value.body?.body; + for (const n of root) { + if ( + n.type === 'ExpressionStatement' && + n.expression?.type === 'AssignmentExpression' && + n.expression?.operator === '=' && + n.expression.left.object.type === 'ThisExpression' + ) { + const { left, right } = n.expression; + if ( + right.type === 'NewExpression' && + right.callee?.object?.type === 'Identifier' && + right.callee?.object?.name === 'Signal' + ) { + const name = left.property.name; + const isState = right.callee?.property?.name === 'State'; + const isComputed = right.callee?.property?.name === 'Computed'; + + constructorMembersSignals.set(name, { + isState, + isComputed, + }); + } + } + } + } + }, }, { // https://github.com/acornjs/acorn/issues/829#issuecomment-1172586171 @@ -357,7 +427,7 @@ export function parseJsx(moduleURL) { const n = n1.value.body.body[n2]; if (n.type === 'ReturnStatement' && n.argument.type === 'JSXElement') { - const html = parseJsxElement(n.argument, moduleContents); + const html = parseJsxElement(n.argument, moduleContents, inferredObservability); const elementTree = getParse(html)(html); const elementRoot = hasShadowRoot ? 'this.shadowRoot' : 'this'; @@ -426,7 +496,10 @@ export function parseJsx(moduleURL) { // TODO: better way to determine value type, e,g. array, number, object, etc within `parseAttribute`? newModuleContents = `${newModuleContents.slice(0, insertPoint)} static get observedAttributes() { - return [${[...trackingAttrs].map((attr) => `'${attr}'`).join()}] + return [${[...trackingAttrs] + .filter((attr) => constructorMembersSignals.get(attr)?.isState) + .map((attr) => `'${attr}'`) + .join()}] } static parseAttribute = (value) => value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) diff --git a/test/cases/jsx-inferred-observability/src/counter.jsx b/test/cases/jsx-inferred-observability/src/counter.jsx index 478ef0e9..4e21d19a 100644 --- a/test/cases/jsx-inferred-observability/src/counter.jsx +++ b/test/cases/jsx-inferred-observability/src/counter.jsx @@ -5,18 +5,17 @@ export const inferredObservability = true; export default class Counter extends HTMLElement { constructor() { super(); - this.count = 0; - this.highlight = 'red'; + this.count = new Signal.State(0); + this.highlight = new Signal.State('red'); + this.parity = new Signal.Computed(() => (this.count.get() % 2 === 0 ? 'even' : 'odd')); } increment() { - this.count += 1; - this.render(); + this.count.set(this.count.get() + 1); } decrement() { - this.count -= 1; - this.render(); + this.count.set(this.count.get() - 1); } connectedCallback() { @@ -28,24 +27,27 @@ export default class Counter extends HTMLElement { return (
- +

Counter JSX

- You have clicked{' '} - - {count} + + {count.get()} {' '} times - +
); diff --git a/test/cases/tsx-inferred-observability/src/counter.tsx b/test/cases/tsx-inferred-observability/src/counter.tsx index 1aa52739..72ad9de0 100644 --- a/test/cases/tsx-inferred-observability/src/counter.tsx +++ b/test/cases/tsx-inferred-observability/src/counter.tsx @@ -1,20 +1,21 @@ export const inferredObservability = true; export default class Counter extends HTMLElement { - count: number; + // TODO: get Signal types for this + count: any; constructor() { super(); - this.count = 0; + this.count = new Signal.State(0); } increment() { - this.count += 1; + this.count.set(this.count.get() + 1); this.render(); } decrement() { - this.count -= 1; + this.count.set(this.count.get() - 1); this.render(); } @@ -39,11 +40,11 @@ export default class Counter extends HTMLElement { You have clicked{' '} - {count} + {count.get()} {' '} times - + ); From e6f60a86e2bf00928ab241b8bb51890d3785ce59 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Mon, 16 Feb 2026 10:50:11 -0500 Subject: [PATCH 10/28] feat: #232 transform template signals usage into effects and templates --- docs/components/sandbox/signal-counter.jsx | 10 +- docs/pages/sandbox.html | 21 +- greenwood.config.ts | 28 ++- package.json | 3 +- src/effect.js | 39 +++ src/jsx-loader.js | 222 ++++++++++++++---- .../fixtures/effects.txt | 3 + .../fixtures/static-templates.txt | 1 + .../jsx-inferred-obsevability.spec.js | 49 +++- .../src/counter.jsx | 20 +- .../fixtures/effects.txt | 3 + .../fixtures/static-templates.txt | 1 + .../src/counter.tsx | 6 +- .../tsx-inferred-obsevability.spec.js | 36 ++- 14 files changed, 371 insertions(+), 71 deletions(-) create mode 100644 src/effect.js create mode 100644 test/cases/jsx-inferred-observability/fixtures/effects.txt create mode 100644 test/cases/jsx-inferred-observability/fixtures/static-templates.txt create mode 100644 test/cases/tsx-inferred-observability/fixtures/effects.txt create mode 100644 test/cases/tsx-inferred-observability/fixtures/static-templates.txt diff --git a/docs/components/sandbox/signal-counter.jsx b/docs/components/sandbox/signal-counter.jsx index 0bdbdce2..5df6932b 100644 --- a/docs/components/sandbox/signal-counter.jsx +++ b/docs/components/sandbox/signal-counter.jsx @@ -18,12 +18,14 @@ export default class SignalCounter extends HTMLElement { increment() { this.count.set(this.count.get() + 1); - console.log('increment', this.count.get()); } decrement() { this.count.set(this.count.get() - 1); - console.log('decrement', this.count.get()); + } + + double() { + this.count.set(this.count.get() * 2); } render() { @@ -33,7 +35,9 @@ export default class SignalCounter extends HTMLElement {
- + {/* TODO: inline version breaks with effects */} + {/* */} + The count is {count.get()} ({parity.get()}) diff --git a/docs/pages/sandbox.html b/docs/pages/sandbox.html index d11d448d..cd49a136 100644 --- a/docs/pages/sandbox.html +++ b/docs/pages/sandbox.html @@ -46,7 +46,8 @@ @@ -55,6 +56,19 @@ globalThis.Signal = Signal; + - + diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 7cccaaf2..2c14ecbe 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -13,11 +13,11 @@ import { transform } from 'sucrase'; // Signal has to come before effect import { Signal } from 'signal-polyfill'; -globalThis.Signal = globalThis.Signal ?? Signal; +globalThis.Signal = Signal; // no-op implementation for SSR function effect() {} -globalThis.effect = globalThis.effect ?? effect; +globalThis.effect = effect; const jsxRegex = /\.(jsx)$/; const tsxRegex = /\.(tsx)$/; diff --git a/test/cases/tsx-inferred-observability/src/counter.tsx b/test/cases/tsx-inferred-observability/src/counter.tsx index 93e2cca3..544815dc 100644 --- a/test/cases/tsx-inferred-observability/src/counter.tsx +++ b/test/cases/tsx-inferred-observability/src/counter.tsx @@ -1,9 +1,8 @@ export const inferredObservability = true; export default class Counter extends HTMLElement { - // TODO: get Signal types for this - count: any; - parity: any; + count; + parity; constructor() { super(); @@ -33,7 +32,7 @@ export default class Counter extends HTMLElement { {' '} - (function reference) - From f0222a7bbd3809e2918bd226e305d587b61a21ec Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 14 Mar 2026 18:18:50 -0400 Subject: [PATCH 28/28] feat: #232 remove need for custom template string function --- docs/components/sandbox/signal-greeting.tsx | 31 +++++++++++++++++ docs/pages/sandbox.html | 33 ++++++++++++------- src/jsx-loader.js | 5 ++- .../fixtures/attribute-changed-callback.txt | 2 +- .../fixtures/static-templates.txt | 4 +-- .../fixtures/attribute-changed-callback.txt | 2 +- .../fixtures/static-templates.txt | 4 +-- 7 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 docs/components/sandbox/signal-greeting.tsx diff --git a/docs/components/sandbox/signal-greeting.tsx b/docs/components/sandbox/signal-greeting.tsx new file mode 100644 index 00000000..0d4a0ebc --- /dev/null +++ b/docs/components/sandbox/signal-greeting.tsx @@ -0,0 +1,31 @@ +export const inferredObservability = true; + +export default class SignalGreeting extends HTMLElement { + name; + + constructor() { + super(); + this.name = new Signal.State('World'); + } + + connectedCallback() { + if (!this.shadowRoot) { + this.attachShadow({ mode: 'open' }); + } + + this.render(); + } + + render() { + const { name } = this; + + // TODO: just using

breaks + return ( +
+

Hello {name.get()} 👋

+
+ ); + } +} + +customElements.define('sb-signal-greeting-jsx', SignalGreeting); diff --git a/docs/pages/sandbox.html b/docs/pages/sandbox.html index f52f3a8d..8b2dbad4 100644 --- a/docs/pages/sandbox.html +++ b/docs/pages/sandbox.html @@ -31,7 +31,9 @@ margin: 0 auto; } - sb-signal-counter-jsx { + sb-signal-counter-jsx, + sb-signal-greeting-jsx, + input { display: block; margin: 0 auto; width: 50%; @@ -59,21 +61,14 @@ +

WCC Sandbox

-

JSX + inferredObservability

+

JSX + inferredObservability (Greeting)

+ + + + +
+ +

JSX + inferredObservability (Counter)


diff --git a/src/jsx-loader.js b/src/jsx-loader.js index 2c14ecbe..3d3919dd 100644 --- a/src/jsx-loader.js +++ b/src/jsx-loader.js @@ -530,8 +530,7 @@ export function parseJsx(moduleURL) { if (template !== '' && signals.length > 0) { const $$templ = `$$tmpl${reactiveElements.length - 1}`; - // TODO: need to handle runtime assumption here with `_wcc`, or do we even need it all? I don't think so... - const staticTemplate = `static ${$$templ} = (${signals.join(',')}) => _wcc\`${template.trim()}\`;`; + const staticTemplate = `static ${$$templ} = (${signals.join(',')}) => \`${template.trim()}\`;`; // TODO: handle this references? // https://www.github.com/ProjectEvergreen/wcc/issues/88 const expression = `${componentName}.${$$templ}(${signals.map((s) => `this.${s}.get()`).join(', ')});`; @@ -691,7 +690,7 @@ export function parseJsx(moduleURL) { } static parseAttribute = (value) => value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) - : !isNaN(value) + : value !== '' && !isNaN(+value) ? parseInt(value, 10) : value === 'true' || value === 'false' ? value === 'true' ? true : false diff --git a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt index d4ac4441..eaf94fe6 100644 --- a/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/jsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -1,6 +1,6 @@ static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) - : !isNaN(value) + : value !== '' && !isNaN(+value) ? parseInt(value, 10) : value === 'true' || value === 'false' ? value === 'true' ? true : false diff --git a/test/cases/jsx-inferred-observability/fixtures/static-templates.txt b/test/cases/jsx-inferred-observability/fixtures/static-templates.txt index 888c44c9..d32bab75 100644 --- a/test/cases/jsx-inferred-observability/fixtures/static-templates.txt +++ b/test/cases/jsx-inferred-observability/fixtures/static-templates.txt @@ -1,5 +1,5 @@ $el0; $el1; $el2; -static $$tmpl1 = count => _wcc`Top level count is ${count}`; -static $$tmpl2 = parity => _wcc`Parity is: ${parity}`; \ No newline at end of file +static $$tmpl1 = count => `Top level count is ${count}`; +static $$tmpl2 = parity => `Parity is: ${parity}`; \ No newline at end of file diff --git a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt index d4ac4441..eaf94fe6 100644 --- a/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt +++ b/test/cases/tsx-inferred-observability/fixtures/attribute-changed-callback.txt @@ -1,6 +1,6 @@ static parseAttribute = value => value.charAt(0) === '{' || value.charAt(0) === '[' ? JSON.parse(value) - : !isNaN(value) + : value !== '' && !isNaN(+value) ? parseInt(value, 10) : value === 'true' || value === 'false' ? value === 'true' ? true : false diff --git a/test/cases/tsx-inferred-observability/fixtures/static-templates.txt b/test/cases/tsx-inferred-observability/fixtures/static-templates.txt index 61e4cd2d..c30088f0 100644 --- a/test/cases/tsx-inferred-observability/fixtures/static-templates.txt +++ b/test/cases/tsx-inferred-observability/fixtures/static-templates.txt @@ -1,4 +1,4 @@ $el0; $el1; -static $$tmpl0 = count => _wcc`Top level count is ${count}`; -static $$tmpl1 = parity => _wcc`Parity is: ${parity}`; \ No newline at end of file +static $$tmpl0 = count => `Top level count is ${count}`; +static $$tmpl1 = parity => `Parity is: ${parity}`; \ No newline at end of file