This is an automated email from the ASF dual-hosted git repository. papegaaij pushed a commit to branch islands in repository https://gitbox.apache.org/repos/asf/wicket.git
commit f5e16953c7c49851a63bed6565b5374128d7a25c Author: Emond Papegaaij <[email protected]> AuthorDate: Thu Nov 5 17:44:49 2026 +0100 Add the client-side runtime, React adapter and Vite plugin of Wicket Islands The wicket-islands module rendered island hosts and answered their calls, but nothing in the browser mounted a framework component into a host or made the calls. An npm workspace in wicket-islands/npm now holds three packages. The runtime finds island hosts, mounts the module registered for their type, keeps a mounted island alive when Wicket re-renders it or an ancestor (moving its root element into the new host and passing the new props), unmounts islands whose host is gone, and sends calls as Wicket Ajax requests whose promise settles after the response's other updates have been applied. The React adapter turns a component into an island module that receives the props as React props and keeps its state across updates. The Vite plugin builds one entry per island type, named after it, so the Java side finds it in the manifest, and serves the entries to a Wicket application in development. The packages are type-checked and tested with Vitest under the js-test profile; the runtime tests run against the real wicket-ajax.js. The build of the module is unchanged without the profile. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../wicket-islands/npm/package-lock.json | 2221 ++++++++++++++++++++ .../wicket-islands/npm/package.json | 25 + .../wicket-islands/npm/packages/react/package.json | 21 + .../npm/packages/react/src/index.tsx | 131 ++ .../npm/packages/react/src/preamble.d.ts | 21 + .../npm/packages/react/src/preamble.js | 31 + .../npm/packages/react/test/react.test.tsx | 96 + .../npm/packages/runtime/package.json | 10 + .../npm/packages/runtime/src/index.ts | 42 + .../npm/packages/runtime/src/runtime.ts | 273 +++ .../npm/packages/runtime/src/types.ts | 88 + .../npm/packages/runtime/src/wicket.ts | 54 + .../npm/packages/runtime/test/runtime.test.ts | 250 +++ .../npm/packages/runtime/test/wicket-fixture.ts | 105 + .../npm/packages/vite-plugin/package.json | 16 + .../npm/packages/vite-plugin/src/index.d.ts | 37 + .../npm/packages/vite-plugin/src/index.js | 115 + .../npm/packages/vite-plugin/test/build.test.ts | 45 + .../packages/vite-plugin/test/fixture/src/demo.js | 30 + .../npm/packages/vite-plugin/test/plugin.test.ts | 92 + .../wicket-islands/npm/tsconfig.json | 19 + .../wicket-islands/npm/vitest.config.ts | 24 + wicket-experimental/wicket-islands/pom.xml | 55 + 23 files changed, 3801 insertions(+) diff --git a/wicket-experimental/wicket-islands/npm/package-lock.json b/wicket-experimental/wicket-islands/npm/package-lock.json new file mode 100644 index 0000000000..1cb750a256 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/package-lock.json @@ -0,0 +1,2221 @@ +{ + "name": "wicket-islands-workspace", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "wicket-islands-workspace", + "workspaces": [ + "packages/runtime", + "packages/react", + "packages/vite-plugin" + ], + "devDependencies": { + "@types/node": "^24.0.0", + "@types/react": "^19.2.0", + "@types/react-dom": "^19.2.0", + "jsdom": "^27.0.0", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "typescript": "^5.9.0", + "vite": "^7.1.0", + "vitest": "^4.0.0" + } + }, + "node_modules/@acemir/cssom": { + "version": "0.9.32", + "resolved": "https://registry.npmjs.org/@acemir/cssom/-/cssom-0.9.32.tgz", + "integrity": "sha512-OijrAUu7rrJhSIoHNg6LMPS5e344nwUHA+1EFYYjrh64D+GmytUsfBQjci45TjT+rd5Spsp8B5xsZDT+TgyXXQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@asamuzakjp/css-color": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-4.1.2.tgz", + "integrity": "sha512-NfBUvBaYgKIuq6E/RBLY1m0IohzNHAYyaJGuTK79Z23uNwmz2jl1mPsC5ZxCCxylinKhT1Amn5oNTlx1wN8cQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.0.0", + "@csstools/css-color-parser": "^4.0.1", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0", + "lru-cache": "^11.2.5" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-6.8.1.tgz", + "integrity": "sha512-MvRz1nCqW0fsy8Qz4dnLIvhOlMzqDVBabZx6lH+YywFDdjXhMY37SmpV1XFX3JzG5GWHn63j6HX6QPr3lZXHvQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.1.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.2.6" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.7.tgz", + "integrity": "sha512-zgm9yjQz5iJB4VL8RyVwd71TWB8Q89FSxt/NzXoWqPSkEBOVtn9L6vAPtSc9hpKfB0Awo/AL2VKFHjYetBLFHQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.16.tgz", + "integrity": "sha512-LsDbJPP/B8cPasUJyTA5S99F7C4G93ngW8hUluXz8CFeOaaRnBPtBiIlvgcPYU0HmHNz8CXg+1vwFrIB4F6Dgw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.67.5.tgz", + "integrity": "sha512-FdWPeulkH+FH+rBzyKBD59tuVN4tRKvmVilSJm0OcnoYsQTpd9UhD78OaPcsYqo2fX6hCwAG0YIjrDLoQ3pR3g==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.67.5.tgz", + "integrity": "sha512-bmkDuBGnF+Ji8atWlXcNjxIC52ShCbdXPbW7Nz0lRoCFi1lrvsO0XobJY36kTj7duc1vOmGJeQ9vtVuGjnzihA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-x64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-x64/-/rollup-android-x64-4.67.5.tgz", + "integrity": "sha512-6KvVfnqPTqmbQ5YobMl9HYiSymAsCt8HlNeriDshwJQcveXwT+vIMW6wGL1RcJbXH9+r3BAJvjab5+rIgtSEqA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.67.5.tgz", + "integrity": "sha512-SNamgdrY69oPdBrQV9fKGo6PSmKcVhyn0D0jnDmcqgRJvrxQGGBhtekOHTUJ7TCgkW0nE8XMH9v2CwXmjNIzVA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.67.5.tgz", + "integrity": "sha512-HNdl34thiJtHDSglogjmAlQ296L8cc8zA7ODH65nnmY7E+jPP55WEbh8J5583rWFLMjxyYywxZuwPOwRvEi5tA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.67.5.tgz", + "integrity": "sha512-WvZYtANNswfHzSNHaJAoG6Ipfc4SyZIDYuIjFdHv07xXxhHl+Xx8o+bNDWsxpOADFT2mKXcXVrfOG4OlWTLo8Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.67.5.tgz", + "integrity": "sha512-EUU+Wgf9NyHekceC+DxAdm42f6bq2ezH/7DEb/JnCb8SAUhG2xph5BiVukxplWal2m5pP8CzJZE+FLwRopywjQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.67.5.tgz", + "integrity": "sha512-dgU1CvUuE2IkaJBAeuAbxpDdMHAdZBT5oth5u22DtuoMg4gXXYr2+Sm30RigPJG1F2VEoiGJUziGLuIh9+jPxA==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.67.5.tgz", + "integrity": "sha512-rdgJcJig2VngYlcTCRQw2BA8kLWM6QwDFe9uLFo81lya0jPC1r8wZu92sAvTUIv48GWlkRVi6/fpsa5CoFSKoQ==", + "cpu": [ + "arm" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.67.5.tgz", + "integrity": "sha512-+jtCiQnrEFHWAUAcUpP7wppb1p6HKOgBP3mXx75cEYpDF2Y5MEqBky2HNz+osFuVx5uX44gnMTmbe5RJauzn6A==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.67.5.tgz", + "integrity": "sha512-heflX7ENhL8eHmLcUxDEHCSK8CKLyPprysb2JGoSTh5Ip7nHrzIRc+2USyxul3nxi98H8pGxJIEDEpURlS1X5A==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.67.5.tgz", + "integrity": "sha512-rRtNU0zBfRHkJ8pscHN9qRtUYLq8Rao4EX7aVWvKcFmJUANkCCXFRU7ovNBEMhpEONyUEB/3DRVDXwDDguSfHA==", + "cpu": [ + "loong64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.67.5.tgz", + "integrity": "sha512-/6auyi9yj8MD/Q+8P+f2ay57jQ7a0j7Yp1JK86pecH6ZnRViQZ5GOjoRSjGArFeTSHFznRbM2QPQcBgDPyNMfQ==", + "cpu": [ + "loong64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.67.5.tgz", + "integrity": "sha512-Hsc0vlt+vPvqzUkHKffWKf3YE/yexrY+yeFf7IsUvDC6PV7YGCsA/gJvPa+WJdgxGJnwuoO1HmLkbahaLKabYQ==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.67.5.tgz", + "integrity": "sha512-Jx5TMMSPJwHY7F/JwPdS6nuBwny2ECRK+EsAJV5HZrfiddeSS6ZrohkLkFZm3rjqBUuQ4FPX5gGMtakUuQO6fQ==", + "cpu": [ + "ppc64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.67.5.tgz", + "integrity": "sha512-fGWcq2lo/XCqAkBLOokg66D/z+MUouryB8i+QdU9RR6O5knG7rucc0WFPqWYL1Wk/wuiJouDfmyBxmZKRM9bag==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.67.5.tgz", + "integrity": "sha512-JwO/Ys3jybc0UW3V5XO2CMnp0RhvoczDDQTgAEE1IctT+HRY3W5parIIWLUpmAK4gHSeeYJofm2iQPFA62K6ag==", + "cpu": [ + "riscv64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.67.5.tgz", + "integrity": "sha512-vVD4iqel6J6A1xAJlb4mxEO9i1wOJ4/SkcKoDKAuK/wqEBPOA7/P5dDyZvNx46ocHwOUwzo3WjhTdKqET9kEAg==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.67.5.tgz", + "integrity": "sha512-HmEfNh5Cdd/NHxgqwMzKnjlvicQQA+D+w+vQXDJSV0x/aHiQSjVwh1Th5RoA7QsMieIaxibt/5iJq68BraTSUg==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.67.5.tgz", + "integrity": "sha512-NfmALpbe009nYzZ2QqlSW6nzbGddXpqk3nwualrIr+4QflQCTGMzt3QKK20yARiAnSV9fJdM5WNwIYUf31x3uA==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.67.5.tgz", + "integrity": "sha512-ngcE7Udpy/iJ3lexVhYcbpUV2OJIakRGus3snc6K52BnAAJetDBG1Ku5Eh3CECtnW3mpBYWg5VCD4tTaOXKOVQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.67.5.tgz", + "integrity": "sha512-DZ01A2EdTYX8xVeGoGiWkJBRWDh+/BOflwGPVsBay43PDxcq8ez0xuovZnPnk1xjE3CdI0pdZXxsJp/Xjmf7uQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.67.5.tgz", + "integrity": "sha512-nJKiMKDO140DUCEcQZl+f4HiGPMBxrW2webjuWJ2E3qPeoruHf2zByml4TP52lA1zDi6L4I92D/5stxeA/6pig==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.67.5.tgz", + "integrity": "sha512-ykLkBCf+Kls24QmqM3IRf1T4sGMh0rXPyymtj+hXlWKPJnXbXraHqUUsKtOIxqLasjT1i7DhfQGAaZYeiHbSOw==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.67.5.tgz", + "integrity": "sha512-NiFPUFw8cHhkmBlL1k1eaz+5AXXm89rztj+DQdDuQ7VGPM0+ADFhezQ2KcBMF50UEFzGUr0+DVjVND743XwKWQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.67.5.tgz", + "integrity": "sha512-Khj/vrKCpdbiAWYbJAeSy4D5iep+qwW/86lNoKvdleJYGxgbRE7h87+5d5T9D7gt8NcqhNFpreRgIg8T4bLzKQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz", + "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@vitest/expect": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.12.tgz", + "integrity": "sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.12.tgz", + "integrity": "sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.12", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.12.tgz", + "integrity": "sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.12.tgz", + "integrity": "sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.12", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.12.tgz", + "integrity": "sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.12", + "@vitest/utils": "4.1.12", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.12.tgz", + "integrity": "sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.12.tgz", + "integrity": "sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.12", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/cssstyle": { + "version": "5.3.7", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-5.3.7.tgz", + "integrity": "sha512-7D2EPVltRrsTkhpQmksIu+LxeWAIEk6wRDMJ1qljlv+CKHJM+cJLlfhWIzNA44eAsHXSNe3+vO6DW1yCYx8SuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^4.1.1", + "@csstools/css-syntax-patches-for-csstree": "^1.0.21", + "css-tree": "^3.1.0", + "lru-cache": "^11.2.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-6.0.1.tgz", + "integrity": "sha512-euIQENZg6x8mj3fO6o9+fOW8MimUI4PpD/fZBhJfeioZVy9TUpM4UY7KjQNVZFlqwJ0UdzRDzkycB997HEq1BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^15.1.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/data-urls/node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", + "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "27.4.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-27.4.0.tgz", + "integrity": "sha512-mjzqwWRD9Y1J1KUi7W97Gja1bwOOM5Ug0EZ6UDK3xS7j7mndrkwozHtSblfomlzyB4NepioNt+B2sOSzczVgtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@acemir/cssom": "^0.9.28", + "@asamuzakjp/dom-selector": "^6.7.6", + "@exodus/bytes": "^1.6.0", + "cssstyle": "^5.3.4", + "data-urls": "^6.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", + "is-potential-custom-element-name": "^1.0.1", + "parse5": "^8.0.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.0", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^15.1.0", + "ws": "^8.18.3", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/parse5": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.0.tgz", + "integrity": "sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^9.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.67.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.67.5.tgz", + "integrity": "sha512-3Ve5VH1hacCVutdpbmu/htg4kz+JCOIWgy4Q3hjHPYGHeHeIElNHJ0LcJ3rCfIsd5G7qOl5k5mwpzGMj9kdHPA==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.10" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.67.5", + "@rollup/rollup-android-arm64": "4.67.5", + "@rollup/rollup-android-x64": "4.67.5", + "@rollup/rollup-darwin-arm64": "4.67.5", + "@rollup/rollup-darwin-x64": "4.67.5", + "@rollup/rollup-freebsd-arm64": "4.67.5", + "@rollup/rollup-freebsd-x64": "4.67.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.67.5", + "@rollup/rollup-linux-arm-musleabihf": "4.67.5", + "@rollup/rollup-linux-arm64-gnu": "4.67.5", + "@rollup/rollup-linux-arm64-musl": "4.67.5", + "@rollup/rollup-linux-loong64-gnu": "4.67.5", + "@rollup/rollup-linux-loong64-musl": "4.67.5", + "@rollup/rollup-linux-ppc64-gnu": "4.67.5", + "@rollup/rollup-linux-ppc64-musl": "4.67.5", + "@rollup/rollup-linux-riscv64-gnu": "4.67.5", + "@rollup/rollup-linux-riscv64-musl": "4.67.5", + "@rollup/rollup-linux-s390x-gnu": "4.67.5", + "@rollup/rollup-linux-x64-gnu": "4.67.5", + "@rollup/rollup-linux-x64-musl": "4.67.5", + "@rollup/rollup-openbsd-x64": "4.67.5", + "@rollup/rollup-openharmony-arm64": "4.67.5", + "@rollup/rollup-win32-arm64-msvc": "4.67.5", + "@rollup/rollup-win32-ia32-msvc": "4.67.5", + "@rollup/rollup-win32-x64-gnu": "4.67.5", + "@rollup/rollup-win32-x64-msvc": "4.67.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyrainbow": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz", + "integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tldts": { + "version": "7.4.19", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz", + "integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.19" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.20", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.20.tgz", + "integrity": "sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.7.tgz", + "integrity": "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA==", + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-plugin-wicket-islands": { + "resolved": "packages/vite-plugin", + "link": true + }, + "node_modules/vitest": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.12.tgz", + "integrity": "sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.12", + "@vitest/mocker": "4.1.12", + "@vitest/pretty-format": "4.1.12", + "@vitest/runner": "4.1.12", + "@vitest/snapshot": "4.1.12", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.12", + "@vitest/browser-preview": "4.1.12", + "@vitest/browser-webdriverio": "^4.1.11", + "@vitest/coverage-istanbul": "4.1.12", + "@vitest/coverage-v8": "4.1.12", + "@vitest/ui": "4.1.12", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-url": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-15.1.0.tgz", + "integrity": "sha512-2ytDk0kiEj/yu90JOAp44PVPUkO9+jVhyf+SybKlRHSDlvOOZhdPIrr7xTH64l4WixO2cP+wQIcgujkGBPPz6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wicket-islands": { + "resolved": "packages/runtime", + "link": true + }, + "node_modules/wicket-islands-react": { + "resolved": "packages/react", + "link": true + }, + "node_modules/ws": { + "version": "8.22.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.1.tgz", + "integrity": "sha512-oyL6OPYme/CmiFvNuGzeoxCJ4nOrZE2O1FwM9MWM1AsGri6nLXB2pg+lNA8aLeXMSav0J6eIVS1j6vUPzUtK9g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, + "packages/react": { + "name": "wicket-islands-react", + "version": "0.0.0", + "license": "Apache-2.0", + "dependencies": { + "wicket-islands": "0.0.0" + }, + "peerDependencies": { + "react": "^19.0.0", + "react-dom": "^19.0.0" + } + }, + "packages/runtime": { + "name": "wicket-islands", + "version": "0.0.0", + "license": "Apache-2.0" + }, + "packages/vite-plugin": { + "name": "vite-plugin-wicket-islands", + "version": "0.0.0", + "license": "Apache-2.0", + "peerDependencies": { + "vite": ">=6.0.0" + } + } + } +} diff --git a/wicket-experimental/wicket-islands/npm/package.json b/wicket-experimental/wicket-islands/npm/package.json new file mode 100644 index 0000000000..72337d0871 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/package.json @@ -0,0 +1,25 @@ +{ + "name": "wicket-islands-workspace", + "private": true, + "type": "module", + "workspaces": [ + "packages/runtime", + "packages/react", + "packages/vite-plugin" + ], + "scripts": { + "typecheck": "tsc --noEmit -p .", + "test": "npm run typecheck && vitest run" + }, + "devDependencies": { + "@types/node": "^24.0.0", + "@types/react": "^19.2.0", + "@types/react-dom": "^19.2.0", + "jsdom": "^27.0.0", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "typescript": "^5.9.0", + "vite": "^7.1.0", + "vitest": "^4.0.0" + } +} diff --git a/wicket-experimental/wicket-islands/npm/packages/react/package.json b/wicket-experimental/wicket-islands/npm/packages/react/package.json new file mode 100644 index 0000000000..cf69b8c3c0 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/react/package.json @@ -0,0 +1,21 @@ +{ + "name": "wicket-islands-react", + "version": "0.0.0", + "description": "React adapter for Wicket Islands", + "license": "Apache-2.0", + "type": "module", + "exports": { + ".": "./src/index.tsx", + "./preamble": { + "types": "./src/preamble.d.ts", + "default": "./src/preamble.js" + } + }, + "dependencies": { + "wicket-islands": "0.0.0" + }, + "peerDependencies": { + "react": "^19.0.0", + "react-dom": "^19.0.0" + } +} diff --git a/wicket-experimental/wicket-islands/npm/packages/react/src/index.tsx b/wicket-experimental/wicket-islands/npm/packages/react/src/index.tsx new file mode 100644 index 0000000000..2e7ae45cc2 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/react/src/index.tsx @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createContext, useContext, useSyncExternalStore, type ComponentType } from 'react'; +import { createRoot } from 'react-dom/client'; +import type { IslandContext, IslandModule } from 'wicket-islands'; + +export { IslandCallError } from 'wicket-islands'; +export type { IslandCallErrorKind } from 'wicket-islands'; + +interface PropsStore<P> { + get(): P; + set(props: P): void; + subscribe(listener: () => void): () => void; +} + +function createPropsStore<P>(initial: P): PropsStore<P> { + let current = initial; + const listeners = new Set<() => void>(); + return { + get: () => current, + set(props) { + current = props; + listeners.forEach(listener => listener()); + }, + subscribe(listener) { + listeners.add(listener); + return () => listeners.delete(listener); + } + }; +} + +interface Binding { + context: IslandContext<unknown>; + props: PropsStore<unknown>; +} + +const BindingContext = createContext<Binding | null>(null); + +/** + * Makes a React component the client-side peer of a Wicket island. The component receives the + * island's props as its own props, and is re-rendered in place, keeping its state, whenever the + * server sends new ones. + * + * ```tsx + * export default defineIsland(TreasureBoard); + * ``` + */ +export function defineIsland<P extends object>(Component: ComponentType<P>): IslandModule<P> { + function IslandView({ binding }: { binding: Binding }) { + const props = useSyncExternalStore(binding.props.subscribe, binding.props.get) as P; + return ( + <BindingContext.Provider value={binding}> + <Component {...props} /> + </BindingContext.Provider> + ); + } + + return { + mount(root, context) { + const binding: Binding = { + context: context as IslandContext<unknown>, + props: createPropsStore<unknown>(context.props) + }; + const reactRoot = createRoot(root); + reactRoot.render(<IslandView binding={binding} />); + return { + update: props => binding.props.set(props), + unmount: () => reactRoot.unmount() + }; + } + }; +} + +/** + * What a component inside an island can use. + */ +export interface UseIsland<P> { + /** + * The island's current props. + */ + props: P; + + /** + * The key identifying the island across re-renders. + */ + key: string; + + /** + * Aborted when the island is unmounted. + */ + signal: AbortSignal; + + /** + * Calls the island on the server. The promise settles after every update the response carries + * has been applied, so the props are current when it does. + */ + call<R = unknown>(name: string, payload?: unknown): Promise<R>; +} + +/** + * Gives a component anywhere inside an island access to it. + */ +export function useIsland<P>(): UseIsland<P> { + const binding = useContext(BindingContext); + if (!binding) { + throw new Error('useIsland() can only be used inside a component passed to defineIsland().'); + } + const props = useSyncExternalStore(binding.props.subscribe, binding.props.get) as P; + const { context } = binding; + return { + props, + key: context.key, + signal: context.signal, + call: context.call + }; +} diff --git a/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.d.ts b/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.d.ts new file mode 100644 index 0000000000..f1350e5fdc --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.d.ts @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Installs React Fast Refresh in a page Vite does not serve itself. + */ +export declare const reactRefreshPreamble: string; diff --git a/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.js b/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.js new file mode 100644 index 0000000000..0569298995 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/react/src/preamble.js @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Installs React Fast Refresh in a page Vite does not serve itself. Pass it to the Wicket Islands + * Vite plugin, which runs it before any island module in development: + * + * ```js + * wicketIslands({ islands: { ... }, devPreamble: reactRefreshPreamble }) + * ``` + */ +export const reactRefreshPreamble = `import RefreshRuntime from '/@react-refresh'; +RefreshRuntime.injectIntoGlobalHook(window); +window.$RefreshReg$ = () => {}; +window.$RefreshSig$ = () => (type) => type; +window.__vite_plugin_react_preamble_installed__ = true; +`; diff --git a/wicket-experimental/wicket-islands/npm/packages/react/test/react.test.tsx b/wicket-experimental/wicket-islands/npm/packages/react/test/react.test.tsx new file mode 100644 index 0000000000..682b573935 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/react/test/react.test.tsx @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { act, useState } from 'react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import type { IslandContext, IslandInstance } from 'wicket-islands'; +import { defineIsland, useIsland } from '../src/index'; + +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +interface Props { + title: string; +} + +function Counter({ title }: Props) { + const [count, setCount] = useState(0); + const { call } = useIsland<Props>(); + return ( + <div> + <h1>{title}</h1> + <button id="increment" onClick={() => setCount(count + 1)}>{count}</button> + <button id="call" onClick={() => void call('save', { count })}>save</button> + </div> + ); +} + +describe('defineIsland', () => { + let root: HTMLElement; + let context: IslandContext<Props>; + let instance: IslandInstance<Props>; + + beforeEach(() => { + root = document.createElement('div'); + document.body.appendChild(root); + context = { + props: { title: 'first' }, + key: 'k1', + signal: new AbortController().signal, + call: vi.fn(() => Promise.resolve(undefined)) as IslandContext<Props>['call'] + }; + act(() => { + instance = defineIsland(Counter).mount(root, context); + }); + }); + + afterEach(() => { + root.remove(); + }); + + function click(id: string) { + act(() => { + root.querySelector<HTMLButtonElement>(`#${id}`)!.click(); + }); + } + + it('renders the component with the island props', () => { + expect(root.querySelector('h1')?.textContent).toBe('first'); + }); + + it('re-renders with new props, keeping the component state', () => { + click('increment'); + click('increment'); + + act(() => instance.update({ title: 'second' })); + + expect(root.querySelector('h1')?.textContent).toBe('second'); + expect(root.querySelector('#increment')?.textContent).toBe('2'); + }); + + it('calls the server through useIsland', () => { + click('increment'); + click('call'); + + expect(context.call).toHaveBeenCalledWith('save', { count: 1 }); + }); + + it('unmounts the React root', () => { + act(() => instance.unmount()); + + expect(root.innerHTML).toBe(''); + }); +}); diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/package.json b/wicket-experimental/wicket-islands/npm/packages/runtime/package.json new file mode 100644 index 0000000000..d5594b3452 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/package.json @@ -0,0 +1,10 @@ +{ + "name": "wicket-islands", + "version": "0.0.0", + "description": "Client-side runtime of Wicket Islands: mounts JavaScript framework components as peers of Wicket components", + "license": "Apache-2.0", + "type": "module", + "exports": { + ".": "./src/index.ts" + } +} diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/src/index.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/src/index.ts new file mode 100644 index 0000000000..f998422e16 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/src/index.ts @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IslandRuntime } from './runtime'; +import type { IslandModule } from './types'; + +export { IslandRuntime } from './runtime'; +export { IslandCallError } from './types'; +export type { IslandCallErrorKind, IslandContext, IslandInstance, IslandModule } from './types'; + +const GLOBAL_KEY = '__wicketIslandsRuntime'; + +/** + * The runtime of the page. It is kept on the window, so a page that ends up with two copies of + * this package still has a single runtime. + */ +export function runtime(): IslandRuntime { + const scope = globalThis as { [GLOBAL_KEY]?: IslandRuntime }; + return scope[GLOBAL_KEY] ??= new IslandRuntime(); +} + +/** + * Registers the module for an island type and mounts every island of that type on the page. + * Called by the entry modules the Vite plugin generates. + */ +export function registerIsland<P>(type: string, module: IslandModule<P>): void { + runtime().register(type, module as IslandModule<unknown>); +} diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/src/runtime.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/src/runtime.ts new file mode 100644 index 0000000000..4d31be6e9f --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/src/runtime.ts @@ -0,0 +1,273 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { IslandCallError, type IslandCallErrorKind, type IslandContext, type IslandInstance, + type IslandModule } from './types'; +import { TOPIC_AJAX_CALL_DATA, TOPIC_AJAX_CALL_DONE, TOPIC_DOM_NODE_ADDED, wicket, + type WicketAjaxAttributes, type WicketApi } from './wicket'; + +const ATTR_TYPE = 'data-wicket-island'; +const ATTR_KEY = 'data-wicket-island-key'; +const SELECTOR_STATE = ':scope > script[data-wicket-island-state]'; +const SELECTOR_ROOT = ':scope > [data-wicket-island-root]'; + +const DATA_NAME = 'wicket-islands'; +const PARAM_CALL = 'island-call'; +const PARAM_CALL_ID = 'island-call-id'; +const PARAM_PAYLOAD = 'island-payload'; + +interface IslandState { + props: unknown; + calls: string[]; + ajax: WicketAjaxAttributes; +} + +interface MountedIsland { + readonly type: string; + readonly key: string; + readonly root: HTMLElement; + readonly abort: AbortController; + host: HTMLElement; + state: IslandState; + instance?: IslandInstance<unknown>; +} + +interface PendingCall { + resolve(value: unknown): void; + reject(error: IslandCallError): void; +} + +interface Envelope { + call?: string; + ok?: boolean; + value?: unknown; + error?: { kind: IslandCallErrorKind; messages: string[] }; + invalidate?: string[]; +} + +/** + * Finds island hosts in the page, mounts the module registered for their type, keeps them alive + * when Wicket re-renders them, unmounts them when they are gone, and carries their calls. + */ +export class IslandRuntime { + private readonly modules = new Map<string, IslandModule<unknown>>(); + + private readonly mounted = new Map<string, MountedIsland>(); + + private readonly pending = new Map<string, PendingCall>(); + + private readonly invalidationListeners = new Set<(keys: readonly string[]) => void>(); + + private api?: WicketApi; + + private callSequence = 0; + + register(type: string, module: IslandModule<unknown>): void { + this.modules.set(type, module); + this.connect(); + this.scan(document.documentElement); + } + + /** + * Listens to the query keys the server marks as stale. + */ + onInvalidate(listener: (keys: readonly string[]) => void): () => void { + this.invalidationListeners.add(listener); + return () => this.invalidationListeners.delete(listener); + } + + private connect(): void { + if (this.api) { + return; + } + const api = wicket(); + this.api = api; + api.Event.subscribe(TOPIC_DOM_NODE_ADDED, + (_event, element: Element) => this.scan(element)); + api.Event.subscribe(TOPIC_AJAX_CALL_DATA, + (_event, _attributes: unknown, name: string, value: string) => { + if (name === DATA_NAME) { + this.receive(value); + } + }); + api.Event.subscribe(TOPIC_AJAX_CALL_DONE, () => this.sweep()); + } + + private scan(element: Element): void { + const hosts: Element[] = []; + if (element.matches(`[${ATTR_TYPE}]`)) { + hosts.push(element); + } + hosts.push(...element.querySelectorAll(`[${ATTR_TYPE}]`)); + for (const host of hosts) { + this.attach(host as HTMLElement); + } + } + + private attach(host: HTMLElement): void { + const key = host.getAttribute(ATTR_KEY); + const type = host.getAttribute(ATTR_TYPE); + if (!key || !type) { + return; + } + + const existing = this.mounted.get(key); + if (existing) { + if (existing.host !== host && !existing.host.isConnected) { + this.transfer(existing, host); + } + return; + } + + const module = this.modules.get(type); + if (!module) { + return; + } + + const island: MountedIsland = { + type, + key, + host, + root: findRoot(host), + state: readState(host), + abort: new AbortController() + }; + this.mounted.set(key, island); + island.instance = module.mount(island.root, this.createContext(island)); + } + + /** + * Moves a mounted island into the host Wicket rendered in place of its old one. + */ + private transfer(island: MountedIsland, host: HTMLElement): void { + findRoot(host).replaceWith(island.root); + island.host = host; + island.state = readState(host); + island.instance?.update(island.state.props); + } + + private sweep(): void { + for (const island of [...this.mounted.values()]) { + if (!island.host.isConnected) { + this.unmount(island); + } + } + } + + private unmount(island: MountedIsland): void { + this.mounted.delete(island.key); + island.abort.abort(); + try { + island.instance?.unmount(); + } catch (e) { + console.error(`Wicket Islands: unmounting island ${island.type} failed`, e); + } + } + + private createContext(island: MountedIsland): IslandContext<unknown> { + return { + get props() { + return island.state.props; + }, + key: island.key, + signal: island.abort.signal, + call: <R>(name: string, payload?: unknown) => this.call(island, name, payload) as Promise<R> + }; + } + + private call(island: MountedIsland, name: string, payload: unknown): Promise<unknown> { + if (island.abort.signal.aborted) { + return Promise.reject(new IslandCallError('error', ['The island is no longer mounted.'])); + } + + const id = String(++this.callSequence); + const parameters: Record<string, string> = { [PARAM_CALL]: name, [PARAM_CALL_ID]: id }; + if (payload !== undefined) { + parameters[PARAM_PAYLOAD] = JSON.stringify(payload); + } + + return new Promise((resolve, reject) => { + this.pending.set(id, { resolve, reject }); + const ajax = island.state.ajax; + this.api!.Ajax.ajax({ + ...ajax, + ep: parameters, + fh: [...(ajax.fh ?? []), () => this.fail(id, 'network', + 'The call did not complete.')], + dh: [...(ajax.dh ?? []), () => this.fail(id, 'error', + 'The server did not answer the call.')] + }); + }); + } + + private receive(value: string): void { + let envelope: Envelope; + try { + envelope = JSON.parse(value) as Envelope; + } catch (e) { + console.error('Wicket Islands: cannot read the answer of a call', e); + return; + } + + this.sweep(); + + if (envelope.invalidate && envelope.invalidate.length > 0) { + for (const listener of this.invalidationListeners) { + listener(envelope.invalidate); + } + } + + if (envelope.call === undefined) { + return; + } + const pending = this.pending.get(envelope.call); + if (!pending) { + return; + } + this.pending.delete(envelope.call); + if (envelope.ok) { + pending.resolve(envelope.value); + } else { + pending.reject(new IslandCallError(envelope.error?.kind ?? 'error', + envelope.error?.messages ?? [])); + } + } + + private fail(id: string, kind: IslandCallErrorKind, message: string): void { + const pending = this.pending.get(id); + if (pending) { + this.pending.delete(id); + pending.reject(new IslandCallError(kind, [message])); + } + } +} + +function findRoot(host: HTMLElement): HTMLElement { + const root = host.querySelector<HTMLElement>(SELECTOR_ROOT); + if (!root) { + throw new Error(`Wicket Islands: island host ${host.id} has no root element.`); + } + return root; +} + +function readState(host: HTMLElement): IslandState { + const script = host.querySelector(SELECTOR_STATE); + if (!script?.textContent) { + throw new Error(`Wicket Islands: island host ${host.id} has no state.`); + } + return JSON.parse(script.textContent) as IslandState; +} diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/src/types.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/src/types.ts new file mode 100644 index 0000000000..d943023f37 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/src/types.ts @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The client-side half of an island: what a framework adapter provides for an island type. + */ +export interface IslandModule<P> { + /** + * Mounts the island into its root element. + */ + mount(root: HTMLElement, context: IslandContext<P>): IslandInstance<P>; +} + +/** + * A mounted island. + */ +export interface IslandInstance<P> { + /** + * Delivers new props from the server. The island keeps its client-side state. + */ + update(props: P): void; + + /** + * Unmounts the island; it is not used again. + */ + unmount(): void; +} + +/** + * What the runtime gives a mounted island. + */ +export interface IslandContext<P> { + /** + * The current props. + */ + readonly props: P; + + /** + * The key identifying the island across re-renders. + */ + readonly key: string; + + /** + * Aborted when the island is unmounted, before any of its pending calls settles. + */ + readonly signal: AbortSignal; + + /** + * Calls the island on the server. The returned promise settles after every update the + * response carries has been applied: components, props of other islands, invalidations. + */ + call<R = unknown>(name: string, payload?: unknown): Promise<R>; +} + +/** + * Why a call failed. + */ +export type IslandCallErrorKind = 'invalid' | 'forbidden' | 'expired' | 'error' | 'network'; + +/** + * The rejection of a failed island call. + */ +export class IslandCallError extends Error { + readonly kind: IslandCallErrorKind; + + readonly messages: readonly string[]; + + constructor(kind: IslandCallErrorKind, messages: readonly string[]) { + super(messages.length > 0 ? messages.join('; ') : kind); + this.name = 'IslandCallError'; + this.kind = kind; + this.messages = messages; + } +} diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/src/wicket.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/src/wicket.ts new file mode 100644 index 0000000000..b8a4708808 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/src/wicket.ts @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The part of Wicket's client-side API the runtime uses. Both Ajax libraries, + * wicket-ajax-jquery.js and wicket-ajax.js, provide it. + */ +export interface WicketApi { + Event: { + subscribe(topic: string, subscriber: (event: unknown, ...args: never[]) => void): void; + }; + Ajax: { + ajax(attributes: WicketAjaxAttributes): void; + }; +} + +/** + * Wicket's Ajax request attributes, as rendered by the island's endpoint behavior. + */ +export interface WicketAjaxAttributes { + u: string; + ep?: Record<string, string>; + fh?: unknown[]; + dh?: unknown[]; + [name: string]: unknown; +} + +export const TOPIC_DOM_NODE_ADDED = '/dom/node/added'; + +export const TOPIC_AJAX_CALL_DATA = '/ajax/call/data'; + +export const TOPIC_AJAX_CALL_DONE = '/ajax/call/done'; + +export function wicket(): WicketApi { + const api = (globalThis as { Wicket?: WicketApi }).Wicket; + if (!api?.Event || !api.Ajax) { + throw new Error('Wicket Islands needs Wicket\'s Ajax library on the page.'); + } + return api; +} diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/test/runtime.test.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/test/runtime.test.ts new file mode 100644 index 0000000000..fddf3d8fd1 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/test/runtime.test.ts @@ -0,0 +1,250 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { beforeEach, describe, expect, it } from 'vitest'; +import { IslandCallError, IslandRuntime, type IslandContext, type IslandModule } from '../src/index'; +import { component, data, failRequest, host, requests, respond, setUpWicket } from './wicket-fixture'; + +interface Props { + label: string; +} + +/** + * Fires a call whose outcome the test does not care about. + */ +function ignore(call: Promise<unknown>): void { + call.catch(() => undefined); +} + +/** + * An island module that records what the runtime does with it. + */ +class Recorder { + mounts: { root: HTMLElement; context: IslandContext<Props> }[] = []; + updates: Props[] = []; + unmounts = 0; + + module(): IslandModule<Props> { + return { + mount: (root, context) => { + root.textContent = context.props.label; + this.mounts.push({ root, context }); + return { + update: props => { + root.textContent = props.label; + this.updates.push(props); + }, + unmount: () => { + this.unmounts++; + } + }; + } + }; + } + + get context(): IslandContext<Props> { + return this.mounts[this.mounts.length - 1].context; + } +} + +describe('IslandRuntime', () => { + let runtime: IslandRuntime; + let recorder: Recorder; + + beforeEach(() => { + setUpWicket(); + runtime = new IslandRuntime(); + recorder = new Recorder(); + document.body.innerHTML = `<div id="panel">${host('board1', 'board', 'k1', { label: 'one' })}</div>` + + '<span id="label">before</span>'; + }); + + it('mounts the islands on the page when their module registers', () => { + runtime.register('board', recorder.module()); + + expect(recorder.mounts).toHaveLength(1); + const { root, context } = recorder.mounts[0]; + expect(root.parentElement?.id).toBe('board1'); + expect(root.hasAttribute('data-wicket-island-root')).toBe(true); + expect(context.props).toEqual({ label: 'one' }); + expect(context.key).toBe('k1'); + }); + + it('ignores islands of other types', () => { + runtime.register('chart', recorder.module()); + + expect(recorder.mounts).toHaveLength(0); + }); + + it('sends a call as a Wicket Ajax request', () => { + runtime.register('board', recorder.module()); + + ignore(recorder.context.call('probe', { x: 1, y: 2 })); + + expect(requests).toHaveLength(1); + const { attributes } = requests[0]; + expect(attributes.u).toBe('./call?board1'); + expect(attributes.m).toBe('POST'); + expect(attributes.ep).toEqual({ + 'island-call': 'probe', + 'island-call-id': '1', + 'island-payload': '{"x":1,"y":2}' + }); + }); + + it('omits the payload of a call without one', () => { + runtime.register('board', recorder.module()); + + ignore(recorder.context.call('reset')); + + expect(requests[0].attributes.ep).toEqual({ 'island-call': 'reset', 'island-call-id': '1' }); + }); + + it('resolves a call after the components of the response are updated', async () => { + runtime.register('board', recorder.module()); + const result = recorder.context.call('probe', {}).then(value => ({ + value, + label: document.getElementById('label')?.textContent + })); + + respond(requests[0], component('label', '<span id="label">after</span>') + + data({ call: '1', ok: true, value: { distance: 3 }, invalidate: [] })); + + await expect(result).resolves.toEqual({ value: { distance: 3 }, label: 'after' }); + }); + + it('rejects a rejected call with its kind and messages, after its updates', async () => { + runtime.register('board', recorder.module()); + const result = recorder.context.call('probe', {}).catch((error: IslandCallError) => ({ + error, + label: document.getElementById('label')?.textContent + })); + + respond(requests[0], component('label', '<span id="label">after</span>') + + data({ call: '1', ok: false, error: { kind: 'invalid', messages: ['The game is over.'] } })); + + const { error, label } = await result as { error: IslandCallError; label: string }; + expect(error).toBeInstanceOf(IslandCallError); + expect(error.kind).toBe('invalid'); + expect(error.messages).toEqual(['The game is over.']); + expect(label).toBe('after'); + }); + + it('rejects a call that does not reach the server', async () => { + runtime.register('board', recorder.module()); + const result = recorder.context.call('probe', {}); + + failRequest(requests[0]); + + await expect(result).rejects.toMatchObject({ kind: 'network' }); + }); + + it('rejects a call the server does not answer', async () => { + runtime.register('board', recorder.module()); + const result = recorder.context.call('probe', {}); + + respond(requests[0], ''); + + await expect(result).rejects.toMatchObject({ kind: 'error' }); + }); + + it('keeps an island alive when Wicket re-renders it, and passes the new props', () => { + runtime.register('board', recorder.module()); + const { root } = recorder.mounts[0]; + ignore(recorder.context.call('probe', {})); + + respond(requests[0], component('panel', + `<div id="panel">${host('board1', 'board', 'k1', { label: 'two' }, './call?v2')}</div>`)); + + expect(recorder.mounts).toHaveLength(1); + expect(recorder.unmounts).toBe(0); + expect(recorder.updates).toEqual([{ label: 'two' }]); + expect(recorder.context.props).toEqual({ label: 'two' }); + expect(root.isConnected).toBe(true); + expect(document.getElementById('board1')?.querySelector('[data-wicket-island-root]')).toBe(root); + expect(root.textContent).toBe('two'); + + ignore(recorder.context.call('probe', {})); + expect(requests[1].attributes.u).toBe('./call?v2'); + }); + + it('remounts when Wicket renders a new island in its place', () => { + runtime.register('board', recorder.module()); + ignore(recorder.context.call('probe', {})); + + respond(requests[0], component('panel', + `<div id="panel">${host('board2', 'board', 'k2', { label: 'new' })}</div>`)); + + expect(recorder.mounts).toHaveLength(2); + expect(recorder.unmounts).toBe(1); + expect(recorder.mounts[0].context.signal.aborted).toBe(true); + expect(recorder.context.props).toEqual({ label: 'new' }); + }); + + it('unmounts an island Wicket removed, after the call', () => { + runtime.register('board', recorder.module()); + ignore(recorder.context.call('probe', {})); + + respond(requests[0], component('panel', '<div id="panel"></div>')); + + expect(recorder.unmounts).toBe(1); + }); + + it('aborts the signal of a removed island before its call settles', async () => { + runtime.register('board', recorder.module()); + const { context } = recorder.mounts[0]; + const result = context.call('probe', {}).then(() => context.signal.aborted); + + respond(requests[0], component('panel', '<div id="panel"></div>') + + data({ call: '1', ok: true, value: null })); + + await expect(result).resolves.toBe(true); + }); + + it('rejects calls of an unmounted island without sending them', async () => { + runtime.register('board', recorder.module()); + const { context } = recorder.mounts[0]; + ignore(context.call('probe', {})); + respond(requests[0], component('panel', '<div id="panel"></div>')); + + await expect(context.call('probe', {})).rejects.toMatchObject({ kind: 'error' }); + expect(requests).toHaveLength(1); + }); + + it('mounts an island added later, once its module is registered', () => { + runtime.register('board', recorder.module()); + const charts = new Recorder(); + ignore(recorder.context.call('probe', {})); + + respond(requests[0], component('label', `<span id="label">${host('chart1', 'chart', 'k9', { label: 'c' })}</span>`)); + expect(charts.mounts).toHaveLength(0); + + runtime.register('chart', charts.module()); + expect(charts.mounts).toHaveLength(1); + }); + + it('tells listeners which query keys were invalidated', () => { + runtime.register('board', recorder.module()); + const invalidated: string[][] = []; + runtime.onInvalidate(keys => invalidated.push([...keys])); + ignore(recorder.context.call('probe', {})); + + respond(requests[0], data({ call: '1', ok: true, value: null, invalidate: ['scores'] })); + + expect(invalidated).toEqual([['scores']]); + }); +}); diff --git a/wicket-experimental/wicket-islands/npm/packages/runtime/test/wicket-fixture.ts b/wicket-experimental/wicket-islands/npm/packages/runtime/test/wicket-fixture.ts new file mode 100644 index 0000000000..4d63d2dec9 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/runtime/test/wicket-fixture.ts @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { readFileSync } from 'node:fs'; +import path from 'node:path'; + +/** + * Loads Wicket's plain JavaScript Ajax library into the test window, with a fake transport: a + * test sees the requests the runtime makes and answers them with an <ajax-response>, which the + * real library then processes. + */ + +const WICKET_AJAX = path.resolve(process.cwd(), + '../../../wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax.js'); + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type Any = any; + +export interface Request { + attributes: Any; +} + +let loaded = false; + +export const requests: Request[] = []; + +export function wicket(): Any { + return (globalThis as Any).Wicket; +} + +export function setUpWicket(): void { + if (!loaded) { + (0, eval)(readFileSync(WICKET_AJAX, 'utf8')); + loaded = true; + } + wicket().Event.unsubscribe(); + wicket().Ajax.ajax = (attributes: Any) => { + requests.push({ attributes }); + }; + requests.length = 0; +} + +function run(attributes: Any, fill: (call: Any, context: Any) => void): void { + const W = wicket(); + const call = new W.Ajax.Call(); + const context = { attrs: attributes, steps: [] as unknown[] }; + fill(call, context); + context.steps.push(() => { + call.done(attributes); + return W.ChannelManager.FunctionsExecuter.DONE; + }); + new W.ChannelManager.FunctionsExecuter(context.steps).start(); +} + +/** + * Answers a request with the given children of <ajax-response>. + */ +export function respond(request: Request, content: string): void { + run(request.attributes, (call, context) => call.loadedCallback( + wicket().Xml.parse(`<?xml version="1.0" encoding="UTF-8"?><ajax-response>${content}</ajax-response>`), + context)); +} + +/** + * Fails a request, as when the server cannot be reached. + */ +export function failRequest(request: Request): void { + run(request.attributes, (call, context) => call.failure(context, null, 'unreachable', 'error')); +} + +export function component(id: string, markup: string): string { + return `<component id="${id}"><![CDATA[${markup}]]></component>`; +} + +export function data(value: unknown): string { + return `<data name="wicket-islands"><![CDATA[${JSON.stringify(value)}]]></data>`; +} + +/** + * The markup of an island host, as Island renders it. + */ +export function host(id: string, type: string, key: string, props: unknown, url = `./call?${id}`): string { + const state = JSON.stringify({ + props, + calls: ['probe'], + ajax: { u: url, m: 'POST', c: id, ch: `wicket-island-${id}|s` } + }).replace(/</g, '\\u003c'); + return `<div id="${id}" data-wicket-island="${type}" data-wicket-island-key="${key}">` + + `<script type="application/json" data-wicket-island-state>${state}</script>` + + '<div data-wicket-island-root></div></div>'; +} diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/package.json b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/package.json new file mode 100644 index 0000000000..66ce812b9a --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/package.json @@ -0,0 +1,16 @@ +{ + "name": "vite-plugin-wicket-islands", + "version": "0.0.0", + "description": "Vite plugin that builds Wicket Islands and serves them to Wicket in development", + "license": "Apache-2.0", + "type": "module", + "exports": { + ".": { + "types": "./src/index.d.ts", + "default": "./src/index.js" + } + }, + "peerDependencies": { + "vite": ">=6.0.0" + } +} diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.d.ts b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.d.ts new file mode 100644 index 0000000000..a30e5bcc45 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.d.ts @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { Plugin } from 'vite'; + +export interface WicketIslandsOptions { + /** + * The island modules by island type, relative to Vite's root. Each module's default export is + * the island, made by a framework adapter, e.g. `defineIsland` of wicket-islands-react. + */ + islands: Record<string, string>; + + /** + * Code run before any island module in development, e.g. `reactRefreshPreamble` of + * wicket-islands-react/preamble. + */ + devPreamble?: string; +} + +/** + * Builds the islands of a Wicket application and serves them to it in development. + */ +export default function wicketIslands(options: WicketIslandsOptions): Plugin; diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.js b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.js new file mode 100644 index 0000000000..3e52f8cbf2 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/src/index.js @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import path from 'node:path'; +import { normalizePath } from 'vite'; + +const TYPE_PATTERN = /^[A-Za-z0-9_-]+$/; +const ENTRY_PREFIX = 'virtual:wicket-island:'; +const RESOLVED_ENTRY_PREFIX = '\0wicket-island:'; +const PREAMBLE_ID = 'virtual:wicket-islands-preamble'; +const RESOLVED_PREAMBLE_ID = '\0wicket-islands-preamble'; +const DEV_PATH = '/@wicket-islands/'; + +/** + * Builds the islands of a Wicket application, one entry per island type, and serves them to a + * Wicket application running in development mode. + * + * Each island type becomes an input of the build named after the type, so Wicket finds its + * entry in the manifest. Its entry module imports the island's module and registers it with the + * runtime. In development, the module for a type is served at `/@wicket-islands/<type>`. + * + * @param {import('./index').WicketIslandsOptions} options + * @returns {import('vite').Plugin} + */ +export default function wicketIslands(options) { + const islands = options.islands; + for (const type of Object.keys(islands)) { + if (!TYPE_PATTERN.test(type)) { + throw new Error(`Invalid island type '${type}': use letters, digits, '-' and '_'.`); + } + } + + let root = process.cwd(); + let serving = false; + + return { + name: 'wicket-islands', + + config(_config, env) { + serving = env.command === 'serve'; + return { + build: { + manifest: true, + rollupOptions: { + input: Object.fromEntries(Object.keys(islands) + .map(type => [type, ENTRY_PREFIX + type])) + } + } + }; + }, + + configResolved(config) { + root = config.root; + }, + + resolveId(id) { + if (id.startsWith(ENTRY_PREFIX)) { + return RESOLVED_ENTRY_PREFIX + id.slice(ENTRY_PREFIX.length); + } + if (id === PREAMBLE_ID) { + return RESOLVED_PREAMBLE_ID; + } + return null; + }, + + load(id) { + if (id === RESOLVED_PREAMBLE_ID) { + return options.devPreamble ?? ''; + } + if (!id.startsWith(RESOLVED_ENTRY_PREFIX)) { + return null; + } + const type = id.slice(RESOLVED_ENTRY_PREFIX.length); + const file = islands[type]; + if (!file) { + throw new Error(`Unknown island type '${type}'.`); + } + const lines = []; + if (serving && options.devPreamble) { + lines.push(`import ${JSON.stringify(PREAMBLE_ID)};`); + } + lines.push( + `import island from ${JSON.stringify(normalizePath(path.resolve(root, file)))};`, + `import { registerIsland } from 'wicket-islands';`, + `registerIsland(${JSON.stringify(type)}, island);`); + return lines.join('\n'); + }, + + configureServer(server) { + server.middlewares.use((request, _response, next) => { + if (request.url?.startsWith(DEV_PATH)) { + const type = decodeURIComponent(request.url.slice(DEV_PATH.length).split('?')[0]); + if (Object.hasOwn(islands, type)) { + request.url = '/@id/__x00__wicket-island:' + type; + } + } + next(); + }); + } + }; +} diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/build.test.ts b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/build.test.ts new file mode 100644 index 0000000000..a0560eeac0 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/build.test.ts @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @vitest-environment node + +import path from 'node:path'; +import { build, type Rollup } from 'vite'; +import { describe, expect, it } from 'vitest'; +import wicketIslands from '../src/index.js'; + +describe('wicketIslands in a Vite build', () => { + it('produces a manifest entry per island type that Wicket can find by name', async () => { + const output = await build({ + root: path.resolve(process.cwd(), 'packages/vite-plugin/test/fixture'), + logLevel: 'silent', + plugins: [wicketIslands({ islands: { demo: 'src/demo.js' } })], + build: { write: false, minify: false } + }) as Rollup.RollupOutput; + + const manifestAsset = output.output.find(file => file.fileName === '.vite/manifest.json'); + expect(manifestAsset).toBeDefined(); + const manifest = JSON.parse((manifestAsset as Rollup.OutputAsset).source as string) as + Record<string, { file: string; name?: string; isEntry?: boolean }>; + const entry = Object.values(manifest).find(chunk => chunk.name === 'demo' && chunk.isEntry); + expect(entry).toBeDefined(); + + const code = (output.output.find(file => file.fileName === entry!.file) as Rollup.OutputChunk).code; + expect(code).toContain('registerIsland("demo"'); + expect(code).toContain('root.textContent = context.props.label'); + }); +}); diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/fixture/src/demo.js b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/fixture/src/demo.js new file mode 100644 index 0000000000..3bd224290d --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/fixture/src/demo.js @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + mount(root, context) { + root.textContent = context.props.label; + return { + update(props) { + root.textContent = props.label; + }, + unmount() { + root.textContent = ''; + } + }; + } +}; diff --git a/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/plugin.test.ts b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/plugin.test.ts new file mode 100644 index 0000000000..eadc550932 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/packages/vite-plugin/test/plugin.test.ts @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @vitest-environment node + +import { describe, expect, it } from 'vitest'; +import wicketIslands from '../src/index.js'; + +type Hook = (...args: unknown[]) => unknown; + +function hook(plugin: object, name: string): Hook { + return (plugin as Record<string, Hook>)[name]; +} + +function plugin(command: 'build' | 'serve', devPreamble?: string) { + const instance = wicketIslands({ + islands: { 'treasure-board': 'src/islands/TreasureBoard.tsx' }, + devPreamble + }); + const config = hook(instance, 'config')({}, { command, mode: 'development' }); + hook(instance, 'configResolved')({ root: '/app' }); + return { instance, config }; +} + +describe('wicketIslands', () => { + it('builds one entry per island type, named after it, with a manifest', () => { + const { config } = plugin('build'); + + expect(config).toEqual({ + build: { + manifest: true, + rollupOptions: { input: { 'treasure-board': 'virtual:wicket-island:treasure-board' } } + } + }); + }); + + it('generates an entry that registers the island module', () => { + const { instance } = plugin('build', 'preamble();'); + const id = hook(instance, 'resolveId')('virtual:wicket-island:treasure-board'); + + expect(id).toBe('\0wicket-island:treasure-board'); + expect(hook(instance, 'load')(id)).toBe([ + 'import island from "/app/src/islands/TreasureBoard.tsx";', + 'import { registerIsland } from \'wicket-islands\';', + 'registerIsland("treasure-board", island);' + ].join('\n')); + }); + + it('runs the dev preamble first when serving', () => { + const { instance } = plugin('serve', 'preamble();'); + + const entry = hook(instance, 'load')('\0wicket-island:treasure-board') as string; + + expect(entry.split('\n')[0]).toBe('import "virtual:wicket-islands-preamble";'); + expect(hook(instance, 'load')(hook(instance, 'resolveId')('virtual:wicket-islands-preamble'))) + .toBe('preamble();'); + }); + + it('serves the entry of an island type under /@wicket-islands/', () => { + const { instance } = plugin('serve'); + const middlewares: Hook[] = []; + hook(instance, 'configureServer')({ middlewares: { use: (m: Hook) => middlewares.push(m) } }); + + const known = { url: '/@wicket-islands/treasure-board?t=1' }; + const unknown = { url: '/@wicket-islands/other' }; + let nexts = 0; + middlewares[0](known, {}, () => nexts++); + middlewares[0](unknown, {}, () => nexts++); + + expect(known.url).toBe('/@id/__x00__wicket-island:treasure-board'); + expect(unknown.url).toBe('/@wicket-islands/other'); + expect(nexts).toBe(2); + }); + + it('rejects island types Wicket would not accept', () => { + expect(() => wicketIslands({ islands: { 'a b': 'x.tsx' } })).toThrow(/Invalid island type/); + }); +}); diff --git a/wicket-experimental/wicket-islands/npm/tsconfig.json b/wicket-experimental/wicket-islands/npm/tsconfig.json new file mode 100644 index 0000000000..d44919986e --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "Bundler", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "types": ["node"], + "jsx": "react-jsx", + "strict": true, + "noEmit": true, + "allowJs": true, + "checkJs": true, + "skipLibCheck": true, + "isolatedModules": true, + "verbatimModuleSyntax": true + }, + "include": ["packages/*/src", "packages/*/test", "vitest.config.ts"], + "exclude": ["packages/*/test/fixture"] +} diff --git a/wicket-experimental/wicket-islands/npm/vitest.config.ts b/wicket-experimental/wicket-islands/npm/vitest.config.ts new file mode 100644 index 0000000000..16d217e5c8 --- /dev/null +++ b/wicket-experimental/wicket-islands/npm/vitest.config.ts @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'jsdom', + include: ['packages/*/test/**/*.test.{ts,tsx}'] + } +}); diff --git a/wicket-experimental/wicket-islands/pom.xml b/wicket-experimental/wicket-islands/pom.xml index a15faf5db8..b06a7696ea 100644 --- a/wicket-experimental/wicket-islands/pom.xml +++ b/wicket-experimental/wicket-islands/pom.xml @@ -47,4 +47,59 @@ <artifactId>wicket-tester</artifactId> </dependency> </dependencies> + + <profiles> + <profile> + <!-- Type-checks and tests the JavaScript packages in npm/ --> + <id>js-test</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>com.github.eirslett</groupId> + <artifactId>frontend-maven-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <workingDirectory>npm</workingDirectory> + </configuration> + <executions> + <execution> + <id>install node and npm</id> + <goals> + <goal>install-node-and-npm</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <npmVersion>11.12.1</npmVersion> + <nodeVersion>v24.15.0</nodeVersion> + </configuration> + </execution> + <execution> + <id>npm ci</id> + <goals> + <goal>npm</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <arguments>ci</arguments> + </configuration> + </execution> + <execution> + <id>npm test</id> + <goals> + <goal>npm</goal> + </goals> + <phase>test</phase> + <configuration> + <arguments>test</arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project>
