From 4b2c770ea931d0f54b7914c1da43b1cac7a6c974 Mon Sep 17 00:00:00 2001 From: Ryan Loebs <66971815+ObsidianSnoo@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:12:34 -0700 Subject: [PATCH] Update linker to provide new webviewAssets field --- package-lock.json | 223 ++++++++---------------------- package.json | 14 +- src/bundler/linker.ts | 137 ++++++------------ src/elements/play-pen/play-pen.ts | 6 +- 4 files changed, 109 insertions(+), 271 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e0dd9d..b4d8410 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,12 +16,12 @@ "@codemirror/lint": "6.5.0", "@codemirror/state": "6.4.1", "@codemirror/view": "6.26.3", - "@devvit/previews": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/public-api": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/runtime-lite": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/shared-types": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/ui-renderer": "0.10.21-next-2024-05-13-b48ce196f.0", + "@devvit/previews": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/public-api": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/runtime-lite": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/shared-types": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/ui-renderer": "0.10.23-next-2024-06-13-cad38246a.0", "@esm-bundle/chai": "4.3.4-fix.0", "@types/jsdom": "21.1.6", "@types/mocha": "10.0.6", @@ -235,16 +235,25 @@ "w3c-keyname": "^2.2.4" } }, + "node_modules/@devvit/multiplatform": { + "version": "0.0.1-20240529-491771c9", + "resolved": "https://registry.npmjs.org/@devvit/multiplatform/-/multiplatform-0.0.1-20240529-491771c9.tgz", + "integrity": "sha512-FbZhSATdBFiaKwTufKZWT3bmdQ0KAJjFfiTPpUYfW1peeCAWgUqVMqSzjPpWfNPDQ2axy8Zk924TxCks7T8i/g==", + "dev": true, + "dependencies": { + "format-util": "^1.0.5" + } + }, "node_modules/@devvit/previews": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/previews/-/previews-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-3zDWXAK5LMUgjU033lN5bmKPjpE+rkbonu2HE6XUxgUXJoiiIYYbcS5iM+nobf1k9w+0fY66KPkvMjl/K3XKuA==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/previews/-/previews-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-ESaCG6h8jyYUgymPsYL9+Gl6pCovHpof39NzWj3/kY7dlZa7UgIjF+ku+gUpr9RbBY67Z/h2aX650tyXQZv7fQ==", "dev": true, "dependencies": { - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/public-api": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/runtime-lite": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/ui-renderer": "0.10.21-next-2024-05-13-b48ce196f.0", + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/public-api": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/runtime-lite": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/ui-renderer": "0.10.23-next-2024-06-13-cad38246a.0", "lit": "2.2.8", "p-queue": "7.3.4" } @@ -290,9 +299,9 @@ } }, "node_modules/@devvit/protos": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/protos/-/protos-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-lFIQwTfLkgNpLMoTOAtStuOuivIAp4eA/oDDqqs1OOatVc1YjWM3hEkoT4+X6hpWubJX6ozPF2pXnoNjMXqZLg==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/protos/-/protos-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-BCvWINsUfgb2f73Wwal6ypSj+Xjv32POxQjoI7wjrfm2rk3114DgnMtf7/e4OlSolqUaGH8rJg2yEMXn2ATmwA==", "dev": true, "dependencies": { "protobufjs": "7.2.4", @@ -308,13 +317,13 @@ } }, "node_modules/@devvit/public-api": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/public-api/-/public-api-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-qrQZdEe4Je4kPD0g37q3tK0pFwhYB1dffKUJ/9Du8v9/RId2miXfZoX7xGj5AIvwCuPZtQeurvEPh2CYS57vqQ==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/public-api/-/public-api-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-DknU3Y2k/riPoU68oJW+YCTBVAHJD88ROTS/9Qo5mM5ZBj9HvCJk6m06GCuQTjkrJFMdKPeJA9aqFvHFPdLTuQ==", "dev": true, "dependencies": { - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/shared-types": "0.10.21-next-2024-05-13-b48ce196f.0", + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/shared-types": "0.10.23-next-2024-06-13-cad38246a.0", "base64-js": "1.5.1", "clone-deep": "4.0.1", "core-js": "3.27.2", @@ -322,9 +331,9 @@ } }, "node_modules/@devvit/runtime-lite": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/runtime-lite/-/runtime-lite-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-9eZi36WTg71psMXpeY15N3uElc5HkhMi2awXKwmuGw9FMNdRqYgmzdpOl/ZEsaMIMu8WPsIPpE/HmaGnMH5qsQ==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/runtime-lite/-/runtime-lite-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-2xkwZBJaHB7nRlgshlfjMbnq2d1E63Id9i4GCsp0R5/uArrMndug9EwcRU/6hl9NCXHVCYsCWqBT39/H2rYphQ==", "dev": true, "dependencies": { "@formatjs/intl-datetimeformat": "6.12.0", @@ -334,44 +343,25 @@ "lean-intl": "4.2.2" } }, - "node_modules/@devvit/runtimes": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/runtimes/-/runtimes-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-dp07OSkMX9zchfgv1kJoTSnN9OyDhdQlOoCuApLXo2JG7p1ZLBSPzJ+1Sy2LKcJOz2c8Ex0NqkDORgiYUdmTqA==", - "dev": true, - "dependencies": { - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/shared-types": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/web-worker": "0.10.21-next-2024-05-13-b48ce196f.0", - "base64-js": "1.5.1", - "buffer": "6.0.3", - "cron-parser": "4.7.1", - "lru-cache": "7.10.1", - "node-localstorage": "2.2.1", - "rxjs": "7.8.1", - "undici": "5.28.2", - "uuid": "9.0.0" - } - }, "node_modules/@devvit/shared-types": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/shared-types/-/shared-types-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-bvcuhF5P3STum3kQ+CyCftLPLX447uEESY5QZjkxzg0omIW86XXru5mf0wMsBrcvuIjwcamYtELPxPNfeZgvWA==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/shared-types/-/shared-types-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-xFJ02EZX/ro9+Z244Wpp/8MK0DOn0WQuQbmJ6/c1dxKvru1WoNojY9BtEEVyclrFt95Yq01O6Dc//ZJdXvpAmA==", "dev": true, "dependencies": { - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0" + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0" } }, "node_modules/@devvit/ui-renderer": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/ui-renderer/-/ui-renderer-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-YxyPz/mc0x59v4ZglAzbXwEoc1CfsimRsl4b1uU4Y7SdRQJWelbMWj4kLF4iGF/PKIu0sxVyQfpt59HxLbE98w==", + "version": "0.10.23-next-2024-06-13-cad38246a.0", + "resolved": "https://registry.npmjs.org/@devvit/ui-renderer/-/ui-renderer-0.10.23-next-2024-06-13-cad38246a.0.tgz", + "integrity": "sha512-Ev4k4Y9xzZYT1bbLZ0vmXl2esumjQhWVCgwWr5mykhnzX27+biZsOBxSCUHNvDWW1eaUJ3B07XA5JINGkyEC3g==", "dev": true, "dependencies": { - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/runtime-lite": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/runtimes": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/shared-types": "0.10.21-next-2024-05-13-b48ce196f.0", + "@devvit/multiplatform": "0.0.1-20240529-491771c9", + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/runtime-lite": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/shared-types": "0.10.23-next-2024-06-13-cad38246a.0", "@dotlottie/player-component": "2.7.2", "compare-versions": "6.1.0", "nice-grpc-web": "3.3.3", @@ -442,12 +432,6 @@ "@types/trusted-types": "^2.0.2" } }, - "node_modules/@devvit/web-worker": { - "version": "0.10.21-next-2024-05-13-b48ce196f.0", - "resolved": "https://registry.npmjs.org/@devvit/web-worker/-/web-worker-0.10.21-next-2024-05-13-b48ce196f.0.tgz", - "integrity": "sha512-IFhIqHH8qvH5Mh9XTBet1btYPRtBAJlkNV9Df9ODkgcxRFZQH6sXuK9aHwfQd7/6sy1BnE8DJv/8lttfiPD6vg==", - "dev": true - }, "node_modules/@dotlottie/common": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@dotlottie/common/-/common-0.7.3.tgz", @@ -909,15 +893,6 @@ "@types/chai": "^4.2.12" } }, - "node_modules/@fastify/busboy": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", - "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", - "dev": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@formatjs/ecma402-abstract": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.18.0.tgz", @@ -1308,9 +1283,9 @@ } }, "node_modules/@preact/signals-core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@preact/signals-core/-/signals-core-1.6.0.tgz", - "integrity": "sha512-O/XGxwP85h1F7+ouqTMOIZ3+V1whfaV9ToIVcuyGriD4JkSD00cQo54BKdqjvBJxbenvp7ynfqRHEwI6e+NIhw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@preact/signals-core/-/signals-core-1.6.1.tgz", + "integrity": "sha512-KXEEmJoKDlo0Igju/cj9YvKIgyaWFDgnprShQjzimUd5VynAAdTWMshawEOjUVeKbsI0aR58V6WOQp+DNcKApw==", "dev": true, "funding": { "type": "opencollective", @@ -3924,18 +3899,6 @@ "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", "dev": true }, - "node_modules/cron-parser": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.7.1.tgz", - "integrity": "sha512-WguFaoQ0hQ61SgsCZLHUcNbAvlK0lypKXu62ARguefYmjzaOXIVRNrAmyXzabTwUn4sQvQLkk6bjH+ipGfw8bA==", - "dev": true, - "dependencies": { - "luxon": "^3.2.1" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -4699,6 +4662,12 @@ "node": ">= 6" } }, + "node_modules/format-util": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/format-util/-/format-util-1.0.5.tgz", + "integrity": "sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg==", + "dev": true + }, "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", @@ -5124,15 +5093,6 @@ "node": ">= 4" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, "node_modules/inflation": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.1.0.tgz", @@ -5918,24 +5878,6 @@ "get-func-name": "^2.0.1" } }, - "node_modules/lru-cache": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.10.1.tgz", - "integrity": "sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/luxon": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz", - "integrity": "sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", @@ -6211,9 +6153,9 @@ } }, "node_modules/node-abi": { - "version": "3.62.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.62.0.tgz", - "integrity": "sha512-CPMcGa+y33xuL1E0TcNIu4YyaZCxnnvkVaEXrsosR3FxN+fV8xvb7Mzpb7IgKler10qeMkE6+Dp8qJhpzdq35g==", + "version": "3.65.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.65.0.tgz", + "integrity": "sha512-ThjYBfoDNr08AWx6hGaRbfPwxKV9kVzAzOzlLKbk2CuqXE2xnCh+cbAGnwM3t8Lq4v9rUB7VfondlkBckcJrVA==", "dev": true, "dependencies": { "semver": "^7.3.5" @@ -6228,18 +6170,6 @@ "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==", "dev": true }, - "node_modules/node-localstorage": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-2.2.1.tgz", - "integrity": "sha512-vv8fJuOUCCvSPjDjBLlMqYMHob4aGjkmrkaE42/mZr0VT+ZAU10jRF8oTnX9+pgU9/vYJ8P7YT3Vd6ajkmzSCw==", - "dev": true, - "dependencies": { - "write-file-atomic": "^1.1.4" - }, - "engines": { - "node": ">=0.12" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -7477,15 +7407,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/slide": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -8085,18 +8006,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/undici": { - "version": "5.28.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", - "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", - "dev": true, - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -8233,15 +8142,6 @@ "integrity": "sha512-uLn55gYhtxFcS2X6rgvd3+aIEx5xVA3GBQgBkyJRdKAHxXXYiyB5P6ZmL/94HIWvgZaVs8xnNRCiiiRUBqyUIA==", "dev": true }, - "node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", @@ -8724,17 +8624,6 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, - "node_modules/write-file-atomic": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", - "integrity": "sha512-SdrHoC/yVBPpV0Xq/mUZQIpW2sWXAShb/V4pomcJXh92RuaO+f3UTWItiR3Px+pLnV2PvC2/bfn5cwr5X6Vfxw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "slide": "^1.1.5" - } - }, "node_modules/ws": { "version": "7.5.9", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", diff --git a/package.json b/package.json index c1e4f8f..756149d 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,12 @@ "@codemirror/lint": "6.5.0", "@codemirror/state": "6.4.1", "@codemirror/view": "6.26.3", - "@devvit/previews": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/protos": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/public-api": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/runtime-lite": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/shared-types": "0.10.21-next-2024-05-13-b48ce196f.0", - "@devvit/ui-renderer": "0.10.21-next-2024-05-13-b48ce196f.0", + "@devvit/previews": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/protos": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/public-api": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/runtime-lite": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/shared-types": "0.10.23-next-2024-06-13-cad38246a.0", + "@devvit/ui-renderer": "0.10.23-next-2024-06-13-cad38246a.0", "@esm-bundle/chai": "4.3.4-fix.0", "@types/jsdom": "21.1.6", "@types/mocha": "10.0.6", @@ -60,7 +60,7 @@ "gzip": "3.5 KB" }, "dist/play-pen.js": { - "none": "37000 KB", + "none": "37200 KB", "gzip": "5400 KB" } }, diff --git a/src/bundler/linker.ts b/src/bundler/linker.ts index 5ee32c0..d423a61 100644 --- a/src/bundler/linker.ts +++ b/src/bundler/linker.ts @@ -1,21 +1,29 @@ import type {LinkedBundle, SerializableServiceDefinition} from '@devvit/protos' import type {AssetMap} from '@devvit/shared-types/Assets.js' +type LinkerAssetMaps = { + // Standard assets from the /assets project path + assets?: AssetMap | undefined + // Webview-only assets from the /webroot project path + webviewAssets: AssetMap | undefined +} + /** * @arg es JavaScript * @arg hostname Arbitrary but something unique to the window like * hello-world.local may allow concurrent sessions with the * remote. - * @arg assets AssetMap describing how to map project assets to URLs + * @param assetMaps Provide maps from relative filenames to their accessible URL */ export function link( es: string, hostname: string, - assets: AssetMap + assetMaps: LinkerAssetMaps ): LinkedBundle { return { actor: {name: 'pen', owner: 'play', version: '0.0.0.0'}, - assets: assets ?? {}, + assets: assetMaps.assets ?? {}, + webviewAssets: assetMaps.webviewAssets ?? {}, code: es, hostname, provides: provides(), @@ -144,10 +152,7 @@ function uses(): LinkedBundle[] { name: 'Logger', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -168,10 +173,7 @@ function uses(): LinkedBundle[] { name: 'HTTP', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -216,10 +218,7 @@ function uses(): LinkedBundle[] { name: 'KVStore', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -512,10 +511,7 @@ function uses(): LinkedBundle[] { name: 'RedisAPI', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -536,10 +532,7 @@ function uses(): LinkedBundle[] { name: 'MediaService', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -560,10 +553,7 @@ function uses(): LinkedBundle[] { name: 'Modlog', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -696,10 +686,7 @@ function uses(): LinkedBundle[] { name: 'Flair', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -730,10 +717,7 @@ function uses(): LinkedBundle[] { name: 'GraphQL', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -990,10 +974,7 @@ function uses(): LinkedBundle[] { name: 'LinksAndComments', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -1072,10 +1053,7 @@ function uses(): LinkedBundle[] { name: 'Listings', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -1306,10 +1284,7 @@ function uses(): LinkedBundle[] { name: 'Moderation', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -1366,10 +1341,7 @@ function uses(): LinkedBundle[] { name: 'ModNote', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -1594,10 +1566,7 @@ function uses(): LinkedBundle[] { name: 'NewModmail', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -1710,10 +1679,7 @@ function uses(): LinkedBundle[] { name: 'PrivateMessages', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2010,10 +1976,7 @@ function uses(): LinkedBundle[] { name: 'Subreddits', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2139,10 +2102,7 @@ function uses(): LinkedBundle[] { name: 'PostCollections', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2271,10 +2231,7 @@ function uses(): LinkedBundle[] { name: 'Users', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2467,10 +2424,7 @@ function uses(): LinkedBundle[] { name: 'Widgets', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2575,10 +2529,7 @@ function uses(): LinkedBundle[] { name: 'Wiki', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2612,10 +2563,7 @@ function uses(): LinkedBundle[] { name: 'RedditAPIV2', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2652,10 +2600,7 @@ function uses(): LinkedBundle[] { name: 'Scheduler', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2676,10 +2621,7 @@ function uses(): LinkedBundle[] { name: 'Settings', version: '' } - ], - code: '', - uses: [], - assets: {} + ] }, { actor: {name: 'default', owner: 'devvit', version: '1.0.0'}, @@ -2712,10 +2654,13 @@ function uses(): LinkedBundle[] { name: 'AssetResolver', version: '' } - ], - code: '', - uses: [], - assets: {} + ] } - ] + ].map(partial => ({ + ...partial, + code: '', + uses: [], + assets: {}, + webviewAssets: {} + })) } diff --git a/src/elements/play-pen/play-pen.ts b/src/elements/play-pen/play-pen.ts index fdec985..b312a52 100644 --- a/src/elements/play-pen/play-pen.ts +++ b/src/elements/play-pen/play-pen.ts @@ -440,7 +440,11 @@ export class PlayPen extends LitElement { this._bundle = link( compile(this.#env), newHostname(this._name, this.#version), - this._assetsState.map + { + assets: this._assetsState.map, + // use a single source of assets to keep things simple + webviewAssets: this._assetsState.map + } ) if (save) this.#save() this.#upload()