export async function importWorkerExtensions(config) {
    if (!config.extensions)
        return;
    const now = Date.now().toString();
    for (const extension of config.extensions) {
        await importWorkerExtension(extension);
    }
    async function importWorkerExtension(type) {
        const extension = typeof type === "string" || type instanceof URL ? {
            url: type
        } : type;
        if (extension.url === type || !extension.name) {
            // If not named, we will import into the global scope.
            const urls = Array.isArray(extension.url) ? extension.url : [extension.url];
            for (const url of urls) {
                const instance = new URL(url, config.url);
                instance.searchParams.set("importCacheBust", now);
                await import(instance.toString());
            }
        }
    }
}
//# sourceMappingURL=worker-extensions.js.map