@hoardodile/host 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/worker-entry.mjs +2 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/sandbox/fixtures/asset-plugin.mjs +8 -3
- package/src/sandbox/host.test.ts +26 -3
- package/src/sandbox/host.ts +15 -8
- package/src/sandbox/worker-entry.mjs +2 -2
|
@@ -153,10 +153,10 @@ function toFileUrl(path) {
|
|
|
153
153
|
return pathToFileURL(path).href
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const pluginDirPrefix = normalizePath(toFileUrl(pluginDir)
|
|
156
|
+
const pluginDirPrefix = normalizePath(`${toFileUrl(pluginDir)}/`)
|
|
157
157
|
const assetVaultPrefix =
|
|
158
158
|
typeof assetVaultDir === "string" && assetVaultDir.length > 0
|
|
159
|
-
? normalizePath(toFileUrl(assetVaultDir)
|
|
159
|
+
? normalizePath(`${toFileUrl(assetVaultDir)}/`)
|
|
160
160
|
: undefined
|
|
161
161
|
const entryUrl = normalizePath(import.meta.url)
|
|
162
162
|
|
package/dist/index.d.ts
CHANGED
|
@@ -143,7 +143,12 @@ type PluginRegistry = {
|
|
|
143
143
|
* workbench) omit it and the methods answer `UNAVAILABLE`.
|
|
144
144
|
*/
|
|
145
145
|
type PluginAssetHandler = {
|
|
146
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Download one request or a batch of requests. Answers with the
|
|
148
|
+
* result array (batch shape) — this adapter unwraps the single
|
|
149
|
+
* result for a single request (see {@link dispatchApi}).
|
|
150
|
+
*/
|
|
151
|
+
readonly download: (pluginId: string, request: PluginDownloadRequest | readonly PluginDownloadRequest[]) => Promise<readonly PluginDownloadResult[]>;
|
|
147
152
|
readonly statAsset: (pluginId: string, path: string) => Promise<{
|
|
148
153
|
readonly sizeBytes: number;
|
|
149
154
|
} | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -3004,10 +3004,9 @@ function createPluginSandbox(config = DEFAULT_SANDBOX_CONFIG) {
|
|
|
3004
3004
|
return;
|
|
3005
3005
|
}
|
|
3006
3006
|
if (method === "download") {
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
);
|
|
3007
|
+
const request = args[0];
|
|
3008
|
+
const results = await handler.download(state.id, request);
|
|
3009
|
+
respond(true, Array.isArray(request) ? results : results[0]);
|
|
3011
3010
|
} else if (method === "statAsset") {
|
|
3012
3011
|
respond(true, await handler.statAsset(state.id, args[0]));
|
|
3013
3012
|
} else if (method === "readAsset") {
|