updated ui extensions api to allow top-level await calls

This commit is contained in:
Gani Georgiev
2026-05-10 14:36:09 +03:00
parent 1b5ea9a1fa
commit 81a5672498
6 changed files with 11 additions and 9 deletions
+2
View File
@@ -2,6 +2,8 @@
- Silenced the superuser IPs confirmation if there is no change.
- Updated UI extensions APIs to allow top-level `await` in the initialization script.
## v0.38.0
+2 -1
View File
@@ -81,7 +81,8 @@ func copyExtensionMainjs(buf *bytes.Buffer, ext core.UIExtension) error {
defer f.Close()
// wrap in a self-executing function to avoid scope and concatenation issues
_, _ = buf.WriteString("(function(){")
// (the await/async is for top-level await)
_, _ = buf.WriteString("await (async function(){")
_, err = io.Copy(buf, f)
if err != nil {
+1 -1
View File
@@ -12,4 +12,4 @@ PB_DOCS_URL = "https://pocketbase.io/docs"
PB_JS_SDK_URL = "https://github.com/pocketbase/js-sdk"
PB_DART_SDK_URL = "https://github.com/pocketbase/dart-sdk"
PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases"
PB_VERSION = "v0.38.0"
PB_VERSION = "v0.38.1-dev"
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -13,7 +13,7 @@
<!-- prism -->
<script src="./libs/prism/prism.js" data-manual></script>
<script type="module" crossorigin src="./assets/index-fOxZ9qpE.js"></script>
<script type="module" crossorigin src="./assets/index-C5XHp9-e.js"></script>
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
<link rel="stylesheet" crossorigin href="./assets/index-DR1PnFnr.css">
</head>
+3 -4
View File
@@ -134,8 +134,8 @@ watch(
);
// load extensions
let extensionsScript = t.script({
type: "module",
document.body.appendChild(t.script({
type: "module", // allow top-level await
src: app.pb.buildURL("/_/extensions.js"),
onload: () => {
app.store._ready = true;
@@ -144,5 +144,4 @@ let extensionsScript = t.script({
console.warn("Failed to load extensions:", err);
app.store._ready = true;
},
});
document.body.appendChild(extensionsScript);
}));