@lakutata/webrtc 3.1.5 → 3.1.6
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/cjs/lib/ice/dns/lookup.js +11 -3
- package/dist/cjs/peer/PeerThreads.js +3 -0
- package/dist/cjs/sfu/SFUWorkerCode.js +1 -1
- package/dist/cjs/sfu/SFUWorkers.js +3 -1
- package/dist/cjs/turn/TURNWorkers.js +3 -1
- package/dist/esm/lib/ice/dns/lookup.js +11 -3
- package/dist/esm/peer/PeerThreads.js +3 -0
- package/dist/esm/sfu/SFUWorkerCode.js +1 -1
- package/dist/esm/sfu/SFUWorkers.js +3 -1
- package/dist/esm/turn/TURNWorkers.js +3 -1
- package/package.json +3 -3
|
@@ -77,8 +77,13 @@ class DnsLookup {
|
|
|
77
77
|
constructor() {
|
|
78
78
|
this.cache = new Map();
|
|
79
79
|
const lookupWorkerFunction = () => {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
//The modules of Node.js: process.getBuiltinModule where there is one (Bun has no global.require), else the
|
|
81
|
+
//require of the script (Node.js before 20.16). No require is named in the function, whose text runs in the
|
|
82
|
+
//worker: a bundler would rewrite it
|
|
83
|
+
//node-compat: process.getBuiltinModule (checked first, global.require where it is missing)
|
|
84
|
+
const load = (id) => typeof process.getBuiltinModule === 'function' ? process.getBuiltinModule(id) : global.require(id);
|
|
85
|
+
const worker_thread = load('worker_threads');
|
|
86
|
+
const { lookup } = load('dns');
|
|
82
87
|
const dnsLookup = (host) => lookup(host, (err, address, family) => {
|
|
83
88
|
const res = {
|
|
84
89
|
err: err?.message,
|
|
@@ -96,7 +101,10 @@ class DnsLookup {
|
|
|
96
101
|
};
|
|
97
102
|
const lookupEval = `(${lookupWorkerFunction})()`;
|
|
98
103
|
this.thread = new worker_thread.Worker(lookupEval, {
|
|
99
|
-
eval: true
|
|
104
|
+
eval: true,
|
|
105
|
+
//Without the options of the command line of the process, which a worker inherits: with --input-type=module, its code
|
|
106
|
+
//(CommonJS) would run as an ES module
|
|
107
|
+
execArgv: []
|
|
100
108
|
});
|
|
101
109
|
this.thread.setMaxListeners(100);
|
|
102
110
|
}
|
|
@@ -176,6 +176,9 @@ let PeerThreads = class PeerThreads extends core_1.Component {
|
|
|
176
176
|
return slot.ready;
|
|
177
177
|
const worker = new node_worker_threads_1.Worker(PeerWorkerCode_js_1.peerWorkerCode, {
|
|
178
178
|
eval: true,
|
|
179
|
+
//Without the options of the command line of the process, which a worker inherits: with --input-type=module, its code
|
|
180
|
+
//(CommonJS) would run as an ES module
|
|
181
|
+
execArgv: [],
|
|
179
182
|
workerData: { thread: slot.index },
|
|
180
183
|
...this.resourceLimits ? { resourceLimits: this.resourceLimits } : {}
|
|
181
184
|
});
|