feat(vite): support remote islands (#3294)

This commit is contained in:
Marvin Hagemeister
2025-09-01 12:11:08 +02:00
committed by GitHub
parent 54942987eb
commit 541bc6c6ca
11 changed files with 197 additions and 75 deletions
+1 -1
View File
@@ -64,7 +64,7 @@
"@std/streams": "jsr:@std/streams@1",
"@astral/astral": "jsr:@astral/astral@^0.5.3",
"@marvinh-test/fresh-island": "jsr:@marvinh-test/fresh-island@^0.0.2",
"@marvinh-test/fresh-island": "jsr:@marvinh-test/fresh-island@^0.0.3",
"linkedom": "npm:linkedom@^0.18.10",
"@std/async": "jsr:@std/async@^1.0.13",
"@std/expect": "jsr:@std/expect@^1.0.16",
Generated
+75 -66
View File
@@ -10,13 +10,13 @@
"jsr:@deno/graph@~0.82.3": "0.82.3",
"jsr:@deno/loader@~0.3.2": "0.3.5",
"jsr:@deno/loader@~0.3.3": "0.3.5",
"jsr:@marvinh-test/fresh-island@^0.0.2": "0.0.2",
"jsr:@marvinh-test/fresh-island@^0.0.3": "0.0.3",
"jsr:@marvinh-test/import-json@^0.0.1": "0.0.1",
"jsr:@std/assert@^1.0.13": "1.0.14",
"jsr:@std/assert@^1.0.14": "1.0.14",
"jsr:@std/async@1": "1.0.14",
"jsr:@std/async@^1.0.13": "1.0.14",
"jsr:@std/bytes@^1.0.2": "1.0.6",
"jsr:@std/bytes@^1.0.5": "1.0.6",
"jsr:@std/bytes@^1.0.6": "1.0.6",
"jsr:@std/cli@^1.0.19": "1.0.21",
"jsr:@std/cli@^1.0.21": "1.0.21",
@@ -41,13 +41,13 @@
"jsr:@std/http@^1.0.15": "1.0.20",
"jsr:@std/internal@^1.0.10": "1.0.10",
"jsr:@std/internal@^1.0.9": "1.0.10",
"jsr:@std/io@0.225": "0.225.0",
"jsr:@std/io@0.225": "0.225.2",
"jsr:@std/io@0.225.0": "0.225.0",
"jsr:@std/json@^1.0.2": "1.0.2",
"jsr:@std/jsonc@1": "1.0.2",
"jsr:@std/media-types@1": "1.1.0",
"jsr:@std/media-types@^1.1.0": "1.1.0",
"jsr:@std/net@^1.0.4": "1.0.4",
"jsr:@std/net@^1.0.4": "1.0.5",
"jsr:@std/path@1": "1.1.2",
"jsr:@std/path@^1.0.8": "1.1.2",
"jsr:@std/path@^1.1.1": "1.1.2",
@@ -151,8 +151,8 @@
"@deno/loader@0.3.5": {
"integrity": "72f6ce9c6e7242c6e070705dbd8a838884dd236d5dd0bd907d08bece92db5722"
},
"@marvinh-test/fresh-island@0.0.2": {
"integrity": "77fc811a677de22d7149e326aa99e03530e4ce06fb8ce3ea296c16729ef65a54",
"@marvinh-test/fresh-island@0.0.3": {
"integrity": "6d06b6009b7dfba9bba28e941e03e6ff652c4ef4f2fbfdf4b78741abd6c6c1c6",
"dependencies": [
"npm:@preact/signals@2",
"npm:preact@^10.22.0"
@@ -242,9 +242,12 @@
"integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7"
},
"@std/io@0.225.0": {
"integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3",
"integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3"
},
"@std/io@0.225.2": {
"integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7",
"dependencies": [
"jsr:@std/bytes@^1.0.2"
"jsr:@std/bytes@^1.0.5"
]
},
"@std/json@1.0.2": {
@@ -259,8 +262,8 @@
"@std/media-types@1.1.0": {
"integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4"
},
"@std/net@1.0.4": {
"integrity": "2f403b455ebbccf83d8a027d29c5a9e3a2452fea39bb2da7f2c04af09c8bc852"
"@std/net@1.0.5": {
"integrity": "b759d8c5e17d997e164af6379d57764668c6714f30109685eec0fd5e194d501a"
},
"@std/path@1.1.0": {
"integrity": "ddc94f8e3c275627281cbc23341df6b8bcc874d70374f75fec2533521e3d6886"
@@ -509,21 +512,21 @@
"@babel/helper-validator-identifier"
]
},
"@emnapi/core@1.4.5": {
"integrity": "sha512-XsLw1dEOpkSX/WucdqUhPWP7hDxSvZiY+fsUC14h+FtQ2Ifni4znbBt8punRX+Uj2JG/uDb8nEHVKvrVlvdZ5Q==",
"@emnapi/core@1.5.0": {
"integrity": "sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg==",
"dependencies": [
"@emnapi/wasi-threads",
"tslib"
]
},
"@emnapi/runtime@1.4.5": {
"integrity": "sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==",
"@emnapi/runtime@1.5.0": {
"integrity": "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==",
"dependencies": [
"tslib"
]
},
"@emnapi/wasi-threads@1.0.4": {
"integrity": "sha512-PJR+bOmMOPH8AtcTGAyYNiuJ3/Fcoj2XN/gBEWzDIKh254XO+mM9XoXHk5GNEhodxeMznbg7BlRojVbKN+gC6g==",
"@emnapi/wasi-threads@1.1.0": {
"integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==",
"dependencies": [
"tslib"
]
@@ -1169,103 +1172,108 @@
"picomatch@2.3.1"
]
},
"@rollup/rollup-android-arm-eabi@4.48.1": {
"integrity": "sha512-rGmb8qoG/zdmKoYELCBwu7vt+9HxZ7Koos3pD0+sH5fR3u3Wb/jGcpnqxcnWsPEKDUyzeLSqksN8LJtgXjqBYw==",
"@rollup/rollup-android-arm-eabi@4.50.0": {
"integrity": "sha512-lVgpeQyy4fWN5QYebtW4buT/4kn4p4IJ+kDNB4uYNT5b8c8DLJDg6titg20NIg7E8RWwdWZORW6vUFfrLyG3KQ==",
"os": ["android"],
"cpu": ["arm"]
},
"@rollup/rollup-android-arm64@4.48.1": {
"integrity": "sha512-4e9WtTxrk3gu1DFE+imNJr4WsL13nWbD/Y6wQcyku5qadlKHY3OQ3LJ/INrrjngv2BJIHnIzbqMk1GTAC2P8yQ==",
"@rollup/rollup-android-arm64@4.50.0": {
"integrity": "sha512-2O73dR4Dc9bp+wSYhviP6sDziurB5/HCym7xILKifWdE9UsOe2FtNcM+I4xZjKrfLJnq5UR8k9riB87gauiQtw==",
"os": ["android"],
"cpu": ["arm64"]
},
"@rollup/rollup-darwin-arm64@4.48.1": {
"integrity": "sha512-+XjmyChHfc4TSs6WUQGmVf7Hkg8ferMAE2aNYYWjiLzAS/T62uOsdfnqv+GHRjq7rKRnYh4mwWb4Hz7h/alp8A==",
"@rollup/rollup-darwin-arm64@4.50.0": {
"integrity": "sha512-vwSXQN8T4sKf1RHr1F0s98Pf8UPz7pS6P3LG9NSmuw0TVh7EmaE+5Ny7hJOZ0M2yuTctEsHHRTMi2wuHkdS6Hg==",
"os": ["darwin"],
"cpu": ["arm64"]
},
"@rollup/rollup-darwin-x64@4.48.1": {
"integrity": "sha512-upGEY7Ftw8M6BAJyGwnwMw91rSqXTcOKZnnveKrVWsMTF8/k5mleKSuh7D4v4IV1pLxKAk3Tbs0Lo9qYmii5mQ==",
"@rollup/rollup-darwin-x64@4.50.0": {
"integrity": "sha512-cQp/WG8HE7BCGyFVuzUg0FNmupxC+EPZEwWu2FCGGw5WDT1o2/YlENbm5e9SMvfDFR6FRhVCBePLqj0o8MN7Vw==",
"os": ["darwin"],
"cpu": ["x64"]
},
"@rollup/rollup-freebsd-arm64@4.48.1": {
"integrity": "sha512-P9ViWakdoynYFUOZhqq97vBrhuvRLAbN/p2tAVJvhLb8SvN7rbBnJQcBu8e/rQts42pXGLVhfsAP0k9KXWa3nQ==",
"@rollup/rollup-freebsd-arm64@4.50.0": {
"integrity": "sha512-UR1uTJFU/p801DvvBbtDD7z9mQL8J80xB0bR7DqW7UGQHRm/OaKzp4is7sQSdbt2pjjSS72eAtRh43hNduTnnQ==",
"os": ["freebsd"],
"cpu": ["arm64"]
},
"@rollup/rollup-freebsd-x64@4.48.1": {
"integrity": "sha512-VLKIwIpnBya5/saccM8JshpbxfyJt0Dsli0PjXozHwbSVaHTvWXJH1bbCwPXxnMzU4zVEfgD1HpW3VQHomi2AQ==",
"@rollup/rollup-freebsd-x64@4.50.0": {
"integrity": "sha512-G/DKyS6PK0dD0+VEzH/6n/hWDNPDZSMBmqsElWnCRGrYOb2jC0VSupp7UAHHQ4+QILwkxSMaYIbQ72dktp8pKA==",
"os": ["freebsd"],
"cpu": ["x64"]
},
"@rollup/rollup-linux-arm-gnueabihf@4.48.1": {
"integrity": "sha512-3zEuZsXfKaw8n/yF7t8N6NNdhyFw3s8xJTqjbTDXlipwrEHo4GtIKcMJr5Ed29leLpB9AugtAQpAHW0jvtKKaQ==",
"@rollup/rollup-linux-arm-gnueabihf@4.50.0": {
"integrity": "sha512-u72Mzc6jyJwKjJbZZcIYmd9bumJu7KNmHYdue43vT1rXPm2rITwmPWF0mmPzLm9/vJWxIRbao/jrQmxTO0Sm9w==",
"os": ["linux"],
"cpu": ["arm"]
},
"@rollup/rollup-linux-arm-musleabihf@4.48.1": {
"integrity": "sha512-leo9tOIlKrcBmmEypzunV/2w946JeLbTdDlwEZ7OnnsUyelZ72NMnT4B2vsikSgwQifjnJUbdXzuW4ToN1wV+Q==",
"@rollup/rollup-linux-arm-musleabihf@4.50.0": {
"integrity": "sha512-S4UefYdV0tnynDJV1mdkNawp0E5Qm2MtSs330IyHgaccOFrwqsvgigUD29uT+B/70PDY1eQ3t40+xf6wIvXJyg==",
"os": ["linux"],
"cpu": ["arm"]
},
"@rollup/rollup-linux-arm64-gnu@4.48.1": {
"integrity": "sha512-Vy/WS4z4jEyvnJm+CnPfExIv5sSKqZrUr98h03hpAMbE2aI0aD2wvK6GiSe8Gx2wGp3eD81cYDpLLBqNb2ydwQ==",
"@rollup/rollup-linux-arm64-gnu@4.50.0": {
"integrity": "sha512-1EhkSvUQXJsIhk4msxP5nNAUWoB4MFDHhtc4gAYvnqoHlaL9V3F37pNHabndawsfy/Tp7BPiy/aSa6XBYbaD1g==",
"os": ["linux"],
"cpu": ["arm64"]
},
"@rollup/rollup-linux-arm64-musl@4.48.1": {
"integrity": "sha512-x5Kzn7XTwIssU9UYqWDB9VpLpfHYuXw5c6bJr4Mzv9kIv242vmJHbI5PJJEnmBYitUIfoMCODDhR7KoZLot2VQ==",
"@rollup/rollup-linux-arm64-musl@4.50.0": {
"integrity": "sha512-EtBDIZuDtVg75xIPIK1l5vCXNNCIRM0OBPUG+tbApDuJAy9mKago6QxX+tfMzbCI6tXEhMuZuN1+CU8iDW+0UQ==",
"os": ["linux"],
"cpu": ["arm64"]
},
"@rollup/rollup-linux-loongarch64-gnu@4.48.1": {
"integrity": "sha512-yzCaBbwkkWt/EcgJOKDUdUpMHjhiZT/eDktOPWvSRpqrVE04p0Nd6EGV4/g7MARXXeOqstflqsKuXVM3H9wOIQ==",
"@rollup/rollup-linux-loongarch64-gnu@4.50.0": {
"integrity": "sha512-BGYSwJdMP0hT5CCmljuSNx7+k+0upweM2M4YGfFBjnFSZMHOLYR0gEEj/dxyYJ6Zc6AiSeaBY8dWOa11GF/ppQ==",
"os": ["linux"],
"cpu": ["loong64"]
},
"@rollup/rollup-linux-ppc64-gnu@4.48.1": {
"integrity": "sha512-UK0WzWUjMAJccHIeOpPhPcKBqax7QFg47hwZTp6kiMhQHeOYJeaMwzeRZe1q5IiTKsaLnHu9s6toSYVUlZ2QtQ==",
"@rollup/rollup-linux-ppc64-gnu@4.50.0": {
"integrity": "sha512-I1gSMzkVe1KzAxKAroCJL30hA4DqSi+wGc5gviD0y3IL/VkvcnAqwBf4RHXHyvH66YVHxpKO8ojrgc4SrWAnLg==",
"os": ["linux"],
"cpu": ["ppc64"]
},
"@rollup/rollup-linux-riscv64-gnu@4.48.1": {
"integrity": "sha512-3NADEIlt+aCdCbWVZ7D3tBjBX1lHpXxcvrLt/kdXTiBrOds8APTdtk2yRL2GgmnSVeX4YS1JIf0imFujg78vpw==",
"@rollup/rollup-linux-riscv64-gnu@4.50.0": {
"integrity": "sha512-bSbWlY3jZo7molh4tc5dKfeSxkqnf48UsLqYbUhnkdnfgZjgufLS/NTA8PcP/dnvct5CCdNkABJ56CbclMRYCA==",
"os": ["linux"],
"cpu": ["riscv64"]
},
"@rollup/rollup-linux-riscv64-musl@4.48.1": {
"integrity": "sha512-euuwm/QTXAMOcyiFCcrx0/S2jGvFlKJ2Iro8rsmYL53dlblp3LkUQVFzEidHhvIPPvcIsxDhl2wkBE+I6YVGzA==",
"@rollup/rollup-linux-riscv64-musl@4.50.0": {
"integrity": "sha512-LSXSGumSURzEQLT2e4sFqFOv3LWZsEF8FK7AAv9zHZNDdMnUPYH3t8ZlaeYYZyTXnsob3htwTKeWtBIkPV27iQ==",
"os": ["linux"],
"cpu": ["riscv64"]
},
"@rollup/rollup-linux-s390x-gnu@4.48.1": {
"integrity": "sha512-w8mULUjmPdWLJgmTYJx/W6Qhln1a+yqvgwmGXcQl2vFBkWsKGUBRbtLRuKJUln8Uaimf07zgJNxOhHOvjSQmBQ==",
"@rollup/rollup-linux-s390x-gnu@4.50.0": {
"integrity": "sha512-CxRKyakfDrsLXiCyucVfVWVoaPA4oFSpPpDwlMcDFQvrv3XY6KEzMtMZrA+e/goC8xxp2WSOxHQubP8fPmmjOQ==",
"os": ["linux"],
"cpu": ["s390x"]
},
"@rollup/rollup-linux-x64-gnu@4.48.1": {
"integrity": "sha512-90taWXCWxTbClWuMZD0DKYohY1EovA+W5iytpE89oUPmT5O1HFdf8cuuVIylE6vCbrGdIGv85lVRzTcpTRZ+kA==",
"@rollup/rollup-linux-x64-gnu@4.50.0": {
"integrity": "sha512-8PrJJA7/VU8ToHVEPu14FzuSAqVKyo5gg/J8xUerMbyNkWkO9j2ExBho/68RnJsMGNJq4zH114iAttgm7BZVkA==",
"os": ["linux"],
"cpu": ["x64"]
},
"@rollup/rollup-linux-x64-musl@4.48.1": {
"integrity": "sha512-2Gu29SkFh1FfTRuN1GR1afMuND2GKzlORQUP3mNMJbqdndOg7gNsa81JnORctazHRokiDzQ5+MLE5XYmZW5VWg==",
"@rollup/rollup-linux-x64-musl@4.50.0": {
"integrity": "sha512-SkE6YQp+CzpyOrbw7Oc4MgXFvTw2UIBElvAvLCo230pyxOLmYwRPwZ/L5lBe/VW/qT1ZgND9wJfOsdy0XptRvw==",
"os": ["linux"],
"cpu": ["x64"]
},
"@rollup/rollup-win32-arm64-msvc@4.48.1": {
"integrity": "sha512-6kQFR1WuAO50bxkIlAVeIYsz3RUx+xymwhTo9j94dJ+kmHe9ly7muH23sdfWduD0BA8pD9/yhonUvAjxGh34jQ==",
"@rollup/rollup-openharmony-arm64@4.50.0": {
"integrity": "sha512-PZkNLPfvXeIOgJWA804zjSFH7fARBBCpCXxgkGDRjjAhRLOR8o0IGS01ykh5GYfod4c2yiiREuDM8iZ+pVsT+Q==",
"os": ["openharmony"],
"cpu": ["arm64"]
},
"@rollup/rollup-win32-arm64-msvc@4.50.0": {
"integrity": "sha512-q7cIIdFvWQoaCbLDUyUc8YfR3Jh2xx3unO8Dn6/TTogKjfwrax9SyfmGGK6cQhKtjePI7jRfd7iRYcxYs93esg==",
"os": ["win32"],
"cpu": ["arm64"]
},
"@rollup/rollup-win32-ia32-msvc@4.48.1": {
"integrity": "sha512-RUyZZ/mga88lMI3RlXFs4WQ7n3VyU07sPXmMG7/C1NOi8qisUg57Y7LRarqoGoAiopmGmChUhSwfpvQ3H5iGSQ==",
"@rollup/rollup-win32-ia32-msvc@4.50.0": {
"integrity": "sha512-XzNOVg/YnDOmFdDKcxxK410PrcbcqZkBmz+0FicpW5jtjKQxcW1BZJEQOF0NJa6JO7CZhett8GEtRN/wYLYJuw==",
"os": ["win32"],
"cpu": ["ia32"]
},
"@rollup/rollup-win32-x64-msvc@4.48.1": {
"integrity": "sha512-8a/caCUN4vkTChxkaIJcMtwIVcBhi4X2PQRoT+yCK3qRYaZ7cURrmJFL5Ux9H9RaMIXj9RuihckdmkBX3zZsgg==",
"@rollup/rollup-win32-x64-msvc@4.50.0": {
"integrity": "sha512-xMmiWRR8sp72Zqwjgtf3QbZfF1wdh8X2ABu3EaozvZcyHJeU0r+XAnXdKgs4cCAp6ORoYoCygipYP1mjmbjrsg==",
"os": ["win32"],
"cpu": ["x64"]
},
@@ -1512,8 +1520,8 @@
"fill-range"
]
},
"browserslist@4.25.3": {
"integrity": "sha512-cDGv1kkDI4/0e5yON9yM5G/0A5u8sf5TnmdX5C9qHzI9PPu++sQ9zjm1k9NiOrf3riY4OkK0zSGqfvJyJsgCBQ==",
"browserslist@4.25.4": {
"integrity": "sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==",
"dependencies": [
"caniuse-lite",
"electron-to-chromium",
@@ -1540,8 +1548,8 @@
"lodash.uniq"
]
},
"caniuse-lite@1.0.30001737": {
"integrity": "sha512-BiloLiXtQNrY5UyF0+1nSJLXUENuhka2pzy2Fx5pGxqavdrxSCW4U6Pn/PoG3Efspi2frRbHpBV2XsrPE6EDlw=="
"caniuse-lite@1.0.30001739": {
"integrity": "sha512-y+j60d6ulelrNSwpPyrHdl+9mJnQzHBr08xm48Qno0nSk4h3Qojh+ziv2qE6rXf4k3tadF4o1J/1tAbVm1NtnA=="
},
"chokidar@3.6.0": {
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
@@ -1756,8 +1764,8 @@
"eastasianwidth@0.2.0": {
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
},
"electron-to-chromium@1.5.209": {
"integrity": "sha512-Xoz0uMrim9ZETCQt8UgM5FxQF9+imA7PBpokoGcZloA1uw2LeHzTlip5cb5KOAsXZLjh/moN2vReN3ZjJmjI9A=="
"electron-to-chromium@1.5.211": {
"integrity": "sha512-IGBvimJkotaLzFnwIVgW9/UD/AOJ2tByUmeOrtqBfACSbAw5b1G0XpvdaieKyc7ULmbwXVx+4e4Be8pOPBrYkw=="
},
"emoji-regex@8.0.0": {
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
@@ -2584,8 +2592,8 @@
],
"bin": true
},
"rollup@4.48.1": {
"integrity": "sha512-jVG20NvbhTYDkGAty2/Yh7HK6/q3DGSRH4o8ALKGArmMuaauM9kLfoMZ+WliPwA5+JHr2lTn3g557FxBV87ifg==",
"rollup@4.50.0": {
"integrity": "sha512-/Zl4D8zPifNmyGzJS+3kVoyXeDeT/GrsJM94sACNg9RtUE0hrHa1bNPtRSrfHTMH5HjRzce6K7rlTh3Khiw+pw==",
"dependencies": [
"@types/estree"
],
@@ -2607,6 +2615,7 @@
"@rollup/rollup-linux-s390x-gnu",
"@rollup/rollup-linux-x64-gnu",
"@rollup/rollup-linux-x64-musl",
"@rollup/rollup-openharmony-arm64",
"@rollup/rollup-win32-arm64-msvc",
"@rollup/rollup-win32-ia32-msvc",
"@rollup/rollup-win32-x64-msvc",
@@ -2820,7 +2829,7 @@
"picomatch@4.0.3"
]
},
"update-browserslist-db@1.1.3_browserslist@4.25.3": {
"update-browserslist-db@1.1.3_browserslist@4.25.4": {
"integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
"dependencies": [
"browserslist",
@@ -3013,7 +3022,7 @@
"jsr:@deno/esbuild-plugin@^1.2.0",
"jsr:@fresh/build-id@1",
"jsr:@fresh/core@^2.0.0-alpha.37",
"jsr:@marvinh-test/fresh-island@^0.0.2",
"jsr:@marvinh-test/fresh-island@^0.0.3",
"jsr:@std/async@^1.0.13",
"jsr:@std/cli@^1.0.19",
"jsr:@std/collections@^1.1.2",
+12 -3
View File
@@ -14,6 +14,7 @@ import { clientSnapshot } from "./plugins/client_snapshot.ts";
import { serverSnapshot } from "./plugins/server_snapshot.ts";
import { patches } from "./plugins/patches.ts";
import process from "node:process";
import { specToName, UniqueNamer } from "@fresh/core/internal-dev";
export function fresh(config?: FreshViteConfig): Plugin[] {
const fConfig: ResolvedFreshViteConfig = {
@@ -22,6 +23,8 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
islandsDir: config?.islandsDir ?? "islands",
routeDir: config?.routeDir ?? "routes",
ignore: config?.ignore ?? [],
islandSpecifiers: new Map(),
namer: new UniqueNamer(),
};
const plugins: Plugin[] = [
@@ -103,9 +106,15 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
},
};
},
configResolved(config) {
fConfig.islandsDir = pathWithRoot(fConfig.islandsDir, config.root);
fConfig.routeDir = pathWithRoot(fConfig.routeDir, config.root);
configResolved(vConfig) {
fConfig.islandsDir = pathWithRoot(fConfig.islandsDir, vConfig.root);
fConfig.routeDir = pathWithRoot(fConfig.routeDir, vConfig.root);
config?.islandSpecifiers?.map((spec) => {
const specName = specToName(spec);
const name = fConfig.namer.getUniqueName(specName);
fConfig.islandSpecifiers.set(spec, name);
});
},
},
serverEntryPlugin(fConfig),
@@ -31,6 +31,11 @@ export function clientSnapshot(options: ResolvedFreshViteConfig): Plugin {
},
};
},
configResolved() {
options.islandSpecifiers.forEach((_name, spec) => {
islands.add(spec);
});
},
async buildStart() {
const result = await crawlFsItem({
islandDir: options.islandsDir,
@@ -28,8 +28,6 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
let isDev = false;
let server: ViteDevServer | undefined;
const namer = new UniqueNamer();
let clientOutDir = "";
let root = "";
let publicDir = "";
@@ -54,6 +52,12 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
config.environments.client.build.outDir,
config.root,
);
options.islandSpecifiers.forEach((name, spec) => {
islands.set(spec, { name, chunk: null });
islandSpecByName.set(name, spec);
// islandsByFile.add(spec);
});
},
configureServer(viteServer) {
server = viteServer;
@@ -124,7 +128,7 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
for (let i = 0; i < result.islands.length; i++) {
const spec = result.islands[i];
const specName = specToName(spec);
const name = namer.getUniqueName(specName);
const name = options.namer.getUniqueName(specName);
islands.set(spec, { name, chunk: null });
islandSpecByName.set(name, spec);
@@ -163,6 +167,19 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
path.join(clientOutDir, ".vite", "manifest.json"),
),
) as Manifest;
const resolvedIslandSpecs = new Map<string, string>();
for (const spec of options.islandSpecifiers.keys()) {
const resolved = await this.resolve(spec);
if (resolved === null) continue;
const id = resolved.id.startsWith("\0")
? resolved.id.slice(1)
: resolved.id;
resolvedIslandSpecs.set(id, spec);
}
const clientEntryName = "client-entry";
@@ -199,7 +216,21 @@ export function serverSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
if (chunk.name === "client-snapshot") {
for (const id of chunk.dynamicImports ?? []) {
const mod = manifest[id];
const serverPath = path.join(root, mod.src ?? id);
let serverPath = path.join(root, mod.src ?? id);
const idx = mod.src?.indexOf("deno::") ?? -1;
if (idx > -1 && mod.src) {
const src = mod.src
.slice(idx)
.replace(
/(https?):\/([^/])/,
(_m, protocol, rest) => {
return `${protocol}://${rest}`;
},
);
serverPath = resolvedIslandSpecs.get(src)!;
}
let spec = pathToSpec(clientOutDir, mod.file);
+6 -1
View File
@@ -40,6 +40,11 @@ export interface FreshViteConfig {
islandsDir?: string;
routeDir?: string;
ignore?: RegExp[];
islandSpecifiers?: string[];
}
export type ResolvedFreshViteConfig = Required<FreshViteConfig>;
export type ResolvedFreshViteConfig =
& Required<
Omit<FreshViteConfig, "islandSpecifiers">
>
& { islandSpecifiers: Map<string, string>; namer: UniqueNamer };
+25
View File
@@ -350,3 +350,28 @@ Deno.test({
sanitizeOps: false,
sanitizeResources: false,
});
Deno.test({
name: "vite build - remote island",
fn: async () => {
const fixture = path.join(FIXTURE_DIR, "remote_island");
await using res = await buildVite(fixture);
await launchProd(
{ cwd: res.tmp },
async (address) => {
await withBrowser(async (page) => {
await page.goto(`${address}`, {
waitUntil: "networkidle2",
});
await page.locator(".remote-island").wait();
await page.locator(".increment").click();
await waitForText(page, ".result", "Count: 1");
});
},
);
},
sanitizeOps: false,
sanitizeResources: false,
});
@@ -289,3 +289,23 @@ Deno.test({
sanitizeResources: false,
sanitizeOps: false,
});
Deno.test({
name: "vite dev - remote island",
fn: async () => {
const fixture = path.join(FIXTURE_DIR, "remote_island");
await launchDevServer(fixture, async (address) => {
await withBrowser(async (page) => {
await page.goto(`${address}`, {
waitUntil: "networkidle2",
});
await page.locator(".remote-island").wait();
await page.locator(".increment").click();
await waitForText(page, ".result", "Count: 1");
});
});
},
sanitizeResources: false,
sanitizeOps: false,
});
@@ -0,0 +1,5 @@
import { App, staticFiles } from "@fresh/core";
export const app = new App()
.use(staticFiles())
.fsRoutes();
@@ -0,0 +1,5 @@
import { RemoteIsland } from "@marvinh-test/fresh-island";
export default function Hello() {
return <RemoteIsland />;
}
@@ -0,0 +1,8 @@
import { defineConfig } from "vite";
import { fresh } from "@fresh/plugin-vite";
export default defineConfig({
plugins: [fresh({
islandSpecifiers: ["@marvinh-test/fresh-island"],
})],
});