@atlaspack/workers 2.12.1-dev.3460 → 2.12.1-dev.3466
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/lib/Handle.js +4 -4
- package/lib/WorkerFarm.js +6 -6
- package/lib/child.js +4 -4
- package/lib/process/ProcessChild.js +5 -5
- package/lib/process/ProcessWorker.js +5 -5
- package/lib/threads/ThreadsChild.js +5 -5
- package/lib/threads/ThreadsWorker.js +5 -5
- package/lib/web/WebChild.js +5 -5
- package/lib/web/WebWorker.js +5 -5
- package/package.json +9 -8
- package/src/Handle.js +1 -1
- package/src/WorkerFarm.js +1 -1
- package/src/child.js +1 -1
- package/src/process/ProcessChild.js +1 -1
- package/src/process/ProcessWorker.js +1 -1
- package/src/threads/ThreadsChild.js +1 -1
- package/src/threads/ThreadsWorker.js +1 -1
- package/src/web/WebChild.js +1 -1
- package/src/web/WebWorker.js +1 -1
package/lib/Handle.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@atlaspack/
|
|
9
|
-
|
|
7
|
+
function _buildCache() {
|
|
8
|
+
const data = require("@atlaspack/build-cache");
|
|
9
|
+
_buildCache = function () {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -42,4 +42,4 @@ class Handle {
|
|
|
42
42
|
// Register the Handle as a serializable class so that it will properly be deserialized
|
|
43
43
|
// by anything that uses WorkerFarm.
|
|
44
44
|
exports.default = Handle;
|
|
45
|
-
(0,
|
|
45
|
+
(0, _buildCache().registerSerializableClass)(`${_package.default.version}:Handle`, Handle);
|
package/lib/WorkerFarm.js
CHANGED
|
@@ -33,9 +33,9 @@ function _events() {
|
|
|
33
33
|
};
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const data = require("@atlaspack/
|
|
38
|
-
|
|
36
|
+
function _buildCache() {
|
|
37
|
+
const data = require("@atlaspack/build-cache");
|
|
38
|
+
_buildCache = function () {
|
|
39
39
|
return data;
|
|
40
40
|
};
|
|
41
41
|
return data;
|
|
@@ -142,7 +142,7 @@ class WorkerFarm extends _events().default {
|
|
|
142
142
|
...request,
|
|
143
143
|
awaitResponse
|
|
144
144
|
});
|
|
145
|
-
return (0,
|
|
145
|
+
return (0, _buildCache().deserialize)((0, _buildCache().serialize)(result));
|
|
146
146
|
},
|
|
147
147
|
createReverseHandle: fn => this.createReverseHandle(fn),
|
|
148
148
|
callChild: (childId, request) => new Promise((resolve, reject) => {
|
|
@@ -198,7 +198,7 @@ class WorkerFarm extends _events().default {
|
|
|
198
198
|
}
|
|
199
199
|
let processedArgs;
|
|
200
200
|
if (!useMainThread) {
|
|
201
|
-
processedArgs = (0,
|
|
201
|
+
processedArgs = (0, _buildCache().restoreDeserializedObject)((0, _buildCache().prepareForSerialization)([...args, false]));
|
|
202
202
|
} else {
|
|
203
203
|
processedArgs = args;
|
|
204
204
|
}
|
|
@@ -440,7 +440,7 @@ class WorkerFarm extends _events().default {
|
|
|
440
440
|
return cached;
|
|
441
441
|
}
|
|
442
442
|
let value = this.sharedReferences.get(ref);
|
|
443
|
-
let buf = (0,
|
|
443
|
+
let buf = (0, _buildCache().serialize)(value).buffer;
|
|
444
444
|
|
|
445
445
|
// If the reference was created with the isCacheable option set to false,
|
|
446
446
|
// serializedSharedReferences will contain `null` as the value.
|
package/lib/child.js
CHANGED
|
@@ -33,9 +33,9 @@ function _diagnostic() {
|
|
|
33
33
|
};
|
|
34
34
|
return data;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const data = require("@atlaspack/
|
|
38
|
-
|
|
36
|
+
function _buildCache() {
|
|
37
|
+
const data = require("@atlaspack/build-cache");
|
|
38
|
+
_buildCache = function () {
|
|
39
39
|
return data;
|
|
40
40
|
};
|
|
41
41
|
return data;
|
|
@@ -186,7 +186,7 @@ class Child {
|
|
|
186
186
|
let value = _value instanceof ArrayBuffer ?
|
|
187
187
|
// In the case the value is pre-serialized as a buffer,
|
|
188
188
|
// deserialize it.
|
|
189
|
-
(0,
|
|
189
|
+
(0, _buildCache().deserialize)(Buffer.from(_value)) : _value;
|
|
190
190
|
this.sharedReferences.set(ref, value);
|
|
191
191
|
this.sharedReferencesByValue.set(value, ref);
|
|
192
192
|
result = responseFromContent(null);
|
|
@@ -13,9 +13,9 @@ function _nullthrows() {
|
|
|
13
13
|
}
|
|
14
14
|
var _childState = require("../childState");
|
|
15
15
|
var _child = require("../child");
|
|
16
|
-
function
|
|
17
|
-
const data = require("@atlaspack/
|
|
18
|
-
|
|
16
|
+
function _buildCache() {
|
|
17
|
+
const data = require("@atlaspack/build-cache");
|
|
18
|
+
_buildCache = function () {
|
|
19
19
|
return data;
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
@@ -34,11 +34,11 @@ class ProcessChild {
|
|
|
34
34
|
if (data === 'die') {
|
|
35
35
|
return this.stop();
|
|
36
36
|
}
|
|
37
|
-
this.onMessage((0,
|
|
37
|
+
this.onMessage((0, _buildCache().deserialize)(Buffer.from(data, 'base64')));
|
|
38
38
|
}
|
|
39
39
|
send(data) {
|
|
40
40
|
let processSend = (0, _nullthrows().default)(process.send).bind(process);
|
|
41
|
-
processSend((0,
|
|
41
|
+
processSend((0, _buildCache().serialize)(data).toString('base64'), err => {
|
|
42
42
|
if (err && err instanceof Error) {
|
|
43
43
|
// $FlowFixMe[prop-missing]
|
|
44
44
|
if (err.code === 'ERR_IPC_CHANNEL_CLOSED') {
|
|
@@ -11,9 +11,9 @@ function _child_process() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("@atlaspack/
|
|
16
|
-
|
|
14
|
+
function _buildCache() {
|
|
15
|
+
const data = require("@atlaspack/build-cache");
|
|
16
|
+
_buildCache = function () {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
@@ -36,7 +36,7 @@ class ProcessWorker {
|
|
|
36
36
|
cwd: process.cwd()
|
|
37
37
|
});
|
|
38
38
|
this.child.on('message', data => {
|
|
39
|
-
this.onMessage((0,
|
|
39
|
+
this.onMessage((0, _buildCache().deserialize)(Buffer.from(data, 'base64')));
|
|
40
40
|
});
|
|
41
41
|
this.child.once('exit', this.onExit);
|
|
42
42
|
this.child.on('error', this.onError);
|
|
@@ -55,7 +55,7 @@ class ProcessWorker {
|
|
|
55
55
|
this.sendQueue.push(data);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
let result = this.child.send((0,
|
|
58
|
+
let result = this.child.send((0, _buildCache().serialize)(data).toString('base64'), error => {
|
|
59
59
|
if (error && error instanceof Error) {
|
|
60
60
|
// Ignore this, the workerfarm handles child errors
|
|
61
61
|
return;
|
|
@@ -20,9 +20,9 @@ function _nullthrows() {
|
|
|
20
20
|
}
|
|
21
21
|
var _childState = require("../childState");
|
|
22
22
|
var _child = require("../child");
|
|
23
|
-
function
|
|
24
|
-
const data = require("@atlaspack/
|
|
25
|
-
|
|
23
|
+
function _buildCache() {
|
|
24
|
+
const data = require("@atlaspack/build-cache");
|
|
25
|
+
_buildCache = function () {
|
|
26
26
|
return data;
|
|
27
27
|
};
|
|
28
28
|
return data;
|
|
@@ -39,10 +39,10 @@ class ThreadsChild {
|
|
|
39
39
|
_worker_threads().parentPort.on('close', this.onExit);
|
|
40
40
|
}
|
|
41
41
|
handleMessage(data) {
|
|
42
|
-
this.onMessage((0,
|
|
42
|
+
this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
|
|
43
43
|
}
|
|
44
44
|
send(data) {
|
|
45
|
-
(0, _nullthrows().default)(_worker_threads().parentPort).postMessage((0,
|
|
45
|
+
(0, _nullthrows().default)(_worker_threads().parentPort).postMessage((0, _buildCache().prepareForSerialization)(data));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
exports.default = ThreadsChild;
|
|
@@ -11,9 +11,9 @@ function _worker_threads() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("@atlaspack/
|
|
16
|
-
|
|
14
|
+
function _buildCache() {
|
|
15
|
+
const data = require("@atlaspack/build-cache");
|
|
16
|
+
_buildCache = function () {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
@@ -44,10 +44,10 @@ class ThreadsWorker {
|
|
|
44
44
|
return Promise.resolve(this.worker.terminate());
|
|
45
45
|
}
|
|
46
46
|
handleMessage(data) {
|
|
47
|
-
this.onMessage((0,
|
|
47
|
+
this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
|
|
48
48
|
}
|
|
49
49
|
send(data) {
|
|
50
|
-
this.worker.postMessage((0,
|
|
50
|
+
this.worker.postMessage((0, _buildCache().prepareForSerialization)(data));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
exports.default = ThreadsWorker;
|
package/lib/web/WebChild.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _childState = require("../childState");
|
|
8
8
|
var _child = require("../child");
|
|
9
|
-
function
|
|
10
|
-
const data = require("@atlaspack/
|
|
11
|
-
|
|
9
|
+
function _buildCache() {
|
|
10
|
+
const data = require("@atlaspack/build-cache");
|
|
11
|
+
_buildCache = function () {
|
|
12
12
|
return data;
|
|
13
13
|
};
|
|
14
14
|
return data;
|
|
@@ -34,10 +34,10 @@ class WebChild {
|
|
|
34
34
|
self.postMessage('online');
|
|
35
35
|
}
|
|
36
36
|
handleMessage(data) {
|
|
37
|
-
this.onMessage((0,
|
|
37
|
+
this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
|
|
38
38
|
}
|
|
39
39
|
send(data) {
|
|
40
|
-
self.postMessage((0,
|
|
40
|
+
self.postMessage((0, _buildCache().prepareForSerialization)(data));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.default = WebChild;
|
package/lib/web/WebWorker.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@atlaspack/
|
|
9
|
-
|
|
7
|
+
function _buildCache() {
|
|
8
|
+
const data = require("@atlaspack/build-cache");
|
|
9
|
+
_buildCache = function () {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -76,10 +76,10 @@ class WebWorker {
|
|
|
76
76
|
return this.stopping;
|
|
77
77
|
}
|
|
78
78
|
handleMessage(data) {
|
|
79
|
-
this.onMessage((0,
|
|
79
|
+
this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
|
|
80
80
|
}
|
|
81
81
|
send(data) {
|
|
82
|
-
this.worker.postMessage((0,
|
|
82
|
+
this.worker.postMessage((0, _buildCache().prepareForSerialization)(data));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
exports.default = WebWorker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/workers",
|
|
3
|
-
"version": "2.12.1-dev.
|
|
3
|
+
"version": "2.12.1-dev.3466+9a12fb8bd",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,20 +17,21 @@
|
|
|
17
17
|
"node": ">= 16.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
|
21
|
-
"@atlaspack/logger": "2.12.1-dev.
|
|
22
|
-
"@atlaspack/profiler": "2.12.1-dev.
|
|
23
|
-
"@atlaspack/types-internal": "2.12.1-dev.
|
|
24
|
-
"@atlaspack/utils": "2.12.1-dev.
|
|
20
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3466+9a12fb8bd",
|
|
21
|
+
"@atlaspack/logger": "2.12.1-dev.3466+9a12fb8bd",
|
|
22
|
+
"@atlaspack/profiler": "2.12.1-dev.3466+9a12fb8bd",
|
|
23
|
+
"@atlaspack/types-internal": "2.12.1-dev.3466+9a12fb8bd",
|
|
24
|
+
"@atlaspack/utils": "2.12.1-dev.3466+9a12fb8bd",
|
|
25
25
|
"nullthrows": "^1.1.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@atlaspack/
|
|
28
|
+
"@atlaspack/build-cache": "^2.12.0",
|
|
29
|
+
"@atlaspack/core": "^2.12.1-dev.3466+9a12fb8bd"
|
|
29
30
|
},
|
|
30
31
|
"browser": {
|
|
31
32
|
"./src/process/ProcessWorker.js": false,
|
|
32
33
|
"./src/threads/ThreadsWorker.js": false,
|
|
33
34
|
"./src/core-worker.js": "./src/core-worker.browser.js"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9a12fb8bd1b72e407ed043e20337dc60fbec9cbe"
|
|
36
37
|
}
|
package/src/Handle.js
CHANGED
package/src/WorkerFarm.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
prepareForSerialization,
|
|
22
22
|
restoreDeserializedObject,
|
|
23
23
|
serialize,
|
|
24
|
-
} from '@atlaspack/
|
|
24
|
+
} from '@atlaspack/build-cache';
|
|
25
25
|
import ThrowableDiagnostic, {anyToDiagnostic, md} from '@atlaspack/diagnostic';
|
|
26
26
|
import Worker, {type WorkerCall} from './Worker';
|
|
27
27
|
import cpuCount from './cpuCount';
|
package/src/child.js
CHANGED
|
@@ -17,7 +17,7 @@ import invariant from 'assert';
|
|
|
17
17
|
import nullthrows from 'nullthrows';
|
|
18
18
|
import Logger, {patchConsole, unpatchConsole} from '@atlaspack/logger';
|
|
19
19
|
import ThrowableDiagnostic, {anyToDiagnostic} from '@atlaspack/diagnostic';
|
|
20
|
-
import {deserialize} from '@atlaspack/
|
|
20
|
+
import {deserialize} from '@atlaspack/build-cache';
|
|
21
21
|
import bus from './bus';
|
|
22
22
|
import {SamplingProfiler, tracer} from '@atlaspack/profiler';
|
|
23
23
|
import _Handle from './Handle';
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
import nullthrows from 'nullthrows';
|
|
10
10
|
import {setChild} from '../childState';
|
|
11
11
|
import {Child} from '../child';
|
|
12
|
-
import {serialize, deserialize} from '@atlaspack/
|
|
12
|
+
import {serialize, deserialize} from '@atlaspack/build-cache';
|
|
13
13
|
|
|
14
14
|
export default class ProcessChild implements ChildImpl {
|
|
15
15
|
onMessage: MessageHandler;
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
WorkerMessage,
|
|
9
9
|
} from '../types';
|
|
10
10
|
import childProcess, {type ChildProcess} from 'child_process';
|
|
11
|
-
import {serialize, deserialize} from '@atlaspack/
|
|
11
|
+
import {serialize, deserialize} from '@atlaspack/build-cache';
|
|
12
12
|
|
|
13
13
|
const WORKER_PATH = require.resolve('./ProcessChild');
|
|
14
14
|
|
package/src/web/WebChild.js
CHANGED
package/src/web/WebWorker.js
CHANGED