| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- diff --git a/node_modules/@openim/wasm-client-sdk/lib/index.es.js b/node_modules/@openim/wasm-client-sdk/lib/index.es.js
- index daa048f..28bd430 100644
- --- a/node_modules/@openim/wasm-client-sdk/lib/index.es.js
- +++ b/node_modules/@openim/wasm-client-sdk/lib/index.es.js
- @@ -475,42 +475,32 @@ function supportsModuleWorkers() {
- }
- }
- function initWorker() {
- - if (typeof window === 'undefined') {
- - return;
- - }
- - // use for webpack 4
- - // const IMWorker = require('worker-loader!./worker.js');
- - // worker = new IMWorker.default();
- - // use for webpack5+ or vite
- - const isViteEnvironment = import.meta.url.includes('.vite/deps');
- - const isNuxtEnvironment = import.meta.url.includes('_nuxt/node_modules');
- - const isQuasarEnvironment = import.meta.url.includes('.q-cache');
- - const isSupportModuleWorker = supportsModuleWorkers();
- - let workerUrl = isSupportModuleWorker
- - ? new URL('worker.js', import.meta.url)
- - : new URL('worker-legacy.js', import.meta.url);
- - if (isViteEnvironment) {
- - workerUrl = workerUrl.href.replace('.vite/deps', '@openim/wasm-client-sdk/lib');
- - }
- - if (isNuxtEnvironment) {
- - workerUrl = workerUrl.href.replace('.cache/vite/client/deps', '@openim/wasm-client-sdk/lib');
- - }
- - if (isQuasarEnvironment) {
- - workerUrl = workerUrl.href.replace(/\.q-cache\/dev-spa\/[^/]+\/deps/, '@openim/wasm-client-sdk/lib');
- - }
- - worker = new Worker(workerUrl, {
- - type: isSupportModuleWorker ? 'module' : 'classic',
- - });
- - // This is only required because Safari doesn't support nested
- - // workers. This installs a handler that will proxy creating web
- - // workers through the main thread
- - initBackend(worker);
- - rpc = new RPC({
- - event: new RPCMessageEvent({
- - currentEndpoint: worker,
- - targetEndpoint: worker,
- - }),
- - });
- + if (typeof window === 'undefined') {
- + return;
- + }
- + // use for webpack 4
- + const IMWorker = require('worker-loader!./worker.js');
- + worker = new IMWorker.default();
- + // use for webpack5+ or vite
- + // const isViteEnvironment = import.meta.url.includes('.vite/deps');
- + // const isSupportModuleWorker = supportsModuleWorkers();
- + // const getWorkerUrl = (url) => url.href.replace('.vite/deps', 'open-im-sdk-wasm/lib');
- + // const workerUrl = isSupportModuleWorker
- + // ? new URL('worker.js', import.meta.url)
- + // : new URL('worker-legacy.js', import.meta.url);
- + // worker = new Worker(isViteEnvironment ? getWorkerUrl(workerUrl) : workerUrl, {
- + // type: isSupportModuleWorker ? 'module' : 'classic',
- + // });
- + // This is only required because Safari doesn't support nested
- + // workers. This installs a handler that will proxy creating web
- + // workers through the main thread
- + initBackend(worker);
- + rpc = new RPC({
- + event: new RPCMessageEvent({
- + currentEndpoint: worker,
- + targetEndpoint: worker,
- + }),
- + });
- }
- function resetWorker() {
- if (rpc) {
- diff --git a/node_modules/@openim/wasm-client-sdk/lib/index.js b/node_modules/@openim/wasm-client-sdk/lib/index.js
- index 61b6467..31253c3 100644
- --- a/node_modules/@openim/wasm-client-sdk/lib/index.js
- +++ b/node_modules/@openim/wasm-client-sdk/lib/index.js
- @@ -479,42 +479,32 @@ function supportsModuleWorkers() {
- }
- }
- function initWorker() {
- - if (typeof window === 'undefined') {
- - return;
- - }
- - // use for webpack 4
- - // const IMWorker = require('worker-loader!./worker.js');
- - // worker = new IMWorker.default();
- - // use for webpack5+ or vite
- - const isViteEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('.vite/deps');
- - const isNuxtEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('_nuxt/node_modules');
- - const isQuasarEnvironment = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)).includes('.q-cache');
- - const isSupportModuleWorker = supportsModuleWorkers();
- - let workerUrl = isSupportModuleWorker
- - ? new URL('worker.js', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)))
- - : new URL('worker-legacy.js', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
- - if (isViteEnvironment) {
- - workerUrl = workerUrl.href.replace('.vite/deps', '@openim/wasm-client-sdk/lib');
- - }
- - if (isNuxtEnvironment) {
- - workerUrl = workerUrl.href.replace('.cache/vite/client/deps', '@openim/wasm-client-sdk/lib');
- - }
- - if (isQuasarEnvironment) {
- - workerUrl = workerUrl.href.replace(/\.q-cache\/dev-spa\/[^/]+\/deps/, '@openim/wasm-client-sdk/lib');
- - }
- - worker = new Worker(workerUrl, {
- - type: isSupportModuleWorker ? 'module' : 'classic',
- - });
- - // This is only required because Safari doesn't support nested
- - // workers. This installs a handler that will proxy creating web
- - // workers through the main thread
- - initBackend(worker);
- - rpc = new RPC({
- - event: new RPCMessageEvent({
- - currentEndpoint: worker,
- - targetEndpoint: worker,
- - }),
- - });
- + if (typeof window === 'undefined') {
- + return;
- + }
- + // use for webpack 4
- + const IMWorker = require('worker-loader!./worker.js');
- + worker = new IMWorker.default();
- + // use for webpack5+ or vite
- + // const isViteEnvironment = import.meta.url.includes('.vite/deps');
- + // const isSupportModuleWorker = supportsModuleWorkers();
- + // const getWorkerUrl = (url) => url.href.replace('.vite/deps', 'open-im-sdk-wasm/lib');
- + // const workerUrl = isSupportModuleWorker
- + // ? new URL('worker.js', import.meta.url)
- + // : new URL('worker-legacy.js', import.meta.url);
- + // worker = new Worker(isViteEnvironment ? getWorkerUrl(workerUrl) : workerUrl, {
- + // type: isSupportModuleWorker ? 'module' : 'classic',
- + // });
- + // This is only required because Safari doesn't support nested
- + // workers. This installs a handler that will proxy creating web
- + // workers through the main thread
- + initBackend(worker);
- + rpc = new RPC({
- + event: new RPCMessageEvent({
- + currentEndpoint: worker,
- + targetEndpoint: worker,
- + }),
- + });
- }
- function resetWorker() {
- if (rpc) {
|