15376779826 1 mēnesi atpakaļ
vecāks
revīzija
929329f421

+ 146 - 0
patches/@openim+wasm-client-sdk+3.8.3-patch.3.patch

@@ -0,0 +1,146 @@
+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) {

+ 148 - 0
patches/open-im-sdk-wasm+3.8.0.patch

@@ -0,0 +1,148 @@
+diff --git a/node_modules/open-im-sdk-wasm/lib/index.es.js b/node_modules/open-im-sdk-wasm/lib/index.es.js
+index 64c4047..3400689 100644
+--- a/node_modules/open-im-sdk-wasm/lib/index.es.js
++++ b/node_modules/open-im-sdk-wasm/lib/index.es.js
+@@ -472,38 +472,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 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', 'open-im-sdk-wasm/lib');
+-    }
+-    if (isNuxtEnvironment) {
+-        workerUrl = workerUrl.href.replace('.cache/vite/client/deps', 'open-im-sdk-wasm/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/open-im-sdk-wasm/lib/index.js b/node_modules/open-im-sdk-wasm/lib/index.js
+index cd572cc..e0e7ea5 100644
+--- a/node_modules/open-im-sdk-wasm/lib/index.js
++++ b/node_modules/open-im-sdk-wasm/lib/index.js
+@@ -476,48 +476,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 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', 'open-im-sdk-wasm/lib');
+-    }
+-    if (isNuxtEnvironment) {
+-        workerUrl = workerUrl.href.replace('.cache/vite/client/deps', 'open-im-sdk-wasm/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,
+-        }),
+-    });
+-}
+-function resetWorker() {
+-    if (rpc) {
+-        rpc.destroy();
+-        rpc = undefined;
+-    }
+-    if (worker) {
+-        worker.terminate();
+-        worker = undefined;
+-    }
++  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,
++    }),
++  });
+ }
+ initWorker();
+ function catchErrorHandle(error) {