@atlaspack/workers 2.12.1-dev.3478 → 2.12.1-dev.3520

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 CHANGED
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function _core() {
8
- const data = require("@atlaspack/core");
9
- _core = function () {
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, _core().registerSerializableClass)(`${_package.default.version}:Handle`, Handle);
45
+ (0, _buildCache().registerSerializableClass)(`${_package.default.version}:Handle`, Handle);
package/lib/WorkerFarm.js CHANGED
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "Handle", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
- var coreWorker = _interopRequireWildcard(require("./core-worker"));
14
13
  var bus = _interopRequireWildcard(require("./bus"));
15
14
  function _assert() {
16
15
  const data = _interopRequireDefault(require("assert"));
@@ -33,9 +32,9 @@ function _events() {
33
32
  };
34
33
  return data;
35
34
  }
36
- function _core() {
37
- const data = require("@atlaspack/core");
38
- _core = function () {
35
+ function _buildCache() {
36
+ const data = require("@atlaspack/build-cache");
37
+ _buildCache = function () {
39
38
  return data;
40
39
  };
41
40
  return data;
@@ -111,16 +110,7 @@ class WorkerFarm extends _events().default {
111
110
  }
112
111
 
113
112
  // $FlowFixMe
114
- if (process.browser) {
115
- if (this.options.workerPath === '@atlaspack/core/src/worker.js') {
116
- this.localWorker = coreWorker;
117
- } else {
118
- throw new Error('No dynamic require possible: ' + this.options.workerPath);
119
- }
120
- } else {
121
- // $FlowFixMe this must be dynamic
122
- this.localWorker = require(this.options.workerPath);
123
- }
113
+ this.localWorker = require(this.options.workerPath);
124
114
  this.localWorkerInit = this.localWorker.childInit != null ? this.localWorker.childInit() : null;
125
115
  this.run = this.createHandle('run');
126
116
 
@@ -142,7 +132,7 @@ class WorkerFarm extends _events().default {
142
132
  ...request,
143
133
  awaitResponse
144
134
  });
145
- return (0, _core().deserialize)((0, _core().serialize)(result));
135
+ return (0, _buildCache().deserialize)((0, _buildCache().serialize)(result));
146
136
  },
147
137
  createReverseHandle: fn => this.createReverseHandle(fn),
148
138
  callChild: (childId, request) => new Promise((resolve, reject) => {
@@ -198,7 +188,7 @@ class WorkerFarm extends _events().default {
198
188
  }
199
189
  let processedArgs;
200
190
  if (!useMainThread) {
201
- processedArgs = (0, _core().restoreDeserializedObject)((0, _core().prepareForSerialization)([...args, false]));
191
+ processedArgs = (0, _buildCache().restoreDeserializedObject)((0, _buildCache().prepareForSerialization)([...args, false]));
202
192
  } else {
203
193
  processedArgs = args;
204
194
  }
@@ -299,7 +289,7 @@ class WorkerFarm extends _events().default {
299
289
  } else if (location) {
300
290
  // $FlowFixMe
301
291
  if (process.browser) {
302
- if (location === '@atlaspack/workers/src/bus.js') {
292
+ if (location === '@atlaspack/workers/bus') {
303
293
  mod = bus;
304
294
  } else {
305
295
  throw new Error('No dynamic require possible: ' + location);
@@ -440,7 +430,7 @@ class WorkerFarm extends _events().default {
440
430
  return cached;
441
431
  }
442
432
  let value = this.sharedReferences.get(ref);
443
- let buf = (0, _core().serialize)(value).buffer;
433
+ let buf = (0, _buildCache().serialize)(value).buffer;
444
434
 
445
435
  // If the reference was created with the isCacheable option set to false,
446
436
  // serializedSharedReferences will contain `null` as the value.
package/lib/bus.js CHANGED
@@ -18,7 +18,7 @@ class Bus extends _events().default {
18
18
  if (_childState.child) {
19
19
  _childState.child.workerApi.callMaster({
20
20
  // $FlowFixMe
21
- location: process.browser ? '@atlaspack/workers/src/bus.js' : __filename,
21
+ location: process.browser ? '@atlaspack/workers/bus' : __filename,
22
22
  method: 'emit',
23
23
  args: [event, ...args]
24
24
  }, false);
package/lib/child.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Child = void 0;
7
- var coreWorker = _interopRequireWildcard(require("./core-worker"));
8
7
  function _assert() {
9
8
  const data = _interopRequireDefault(require("assert"));
10
9
  _assert = function () {
@@ -19,6 +18,13 @@ function _nullthrows() {
19
18
  };
20
19
  return data;
21
20
  }
21
+ function _buildCache() {
22
+ const data = require("@atlaspack/build-cache");
23
+ _buildCache = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
22
28
  function _logger() {
23
29
  const data = _interopRequireWildcard(require("@atlaspack/logger"));
24
30
  _logger = function () {
@@ -33,13 +39,6 @@ function _diagnostic() {
33
39
  };
34
40
  return data;
35
41
  }
36
- function _core() {
37
- const data = require("@atlaspack/core");
38
- _core = function () {
39
- return data;
40
- };
41
- return data;
42
- }
43
42
  var _bus = _interopRequireDefault(require("./bus"));
44
43
  function _profiler() {
45
44
  const data = require("@atlaspack/profiler");
@@ -49,9 +48,9 @@ function _profiler() {
49
48
  return data;
50
49
  }
51
50
  var _Handle2 = _interopRequireDefault(require("./Handle"));
52
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
51
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
54
52
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
53
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55
54
  // The import of './Handle' should really be imported eagerly (with @babel/plugin-transform-modules-commonjs's lazy mode).
56
55
  const Handle = _Handle2.default;
57
56
  class Child {
@@ -99,16 +98,7 @@ class Child {
99
98
  }
100
99
  async childInit(module, childId) {
101
100
  // $FlowFixMe
102
- if (process.browser) {
103
- if (module === '@atlaspack/core/src/worker.js') {
104
- this.module = coreWorker;
105
- } else {
106
- throw new Error('No dynamic require possible: ' + module);
107
- }
108
- } else {
109
- // $FlowFixMe this must be dynamic
110
- this.module = require(module);
111
- }
101
+ this.module = require(module);
112
102
  this.childId = childId;
113
103
  if (this.module.childInit != null) {
114
104
  await this.module.childInit();
@@ -186,7 +176,7 @@ class Child {
186
176
  let value = _value instanceof ArrayBuffer ?
187
177
  // In the case the value is pre-serialized as a buffer,
188
178
  // deserialize it.
189
- (0, _core().deserialize)(Buffer.from(_value)) : _value;
179
+ (0, _buildCache().deserialize)(Buffer.from(_value)) : _value;
190
180
  this.sharedReferences.set(ref, value);
191
181
  this.sharedReferencesByValue.set(value, ref);
192
182
  result = responseFromContent(null);
@@ -4,22 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function _nullthrows() {
8
- const data = _interopRequireDefault(require("nullthrows"));
9
- _nullthrows = function () {
7
+ function _buildCache() {
8
+ const data = require("@atlaspack/build-cache");
9
+ _buildCache = function () {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- var _childState = require("../childState");
15
- var _child = require("../child");
16
- function _core() {
17
- const data = require("@atlaspack/core");
18
- _core = function () {
14
+ function _nullthrows() {
15
+ const data = _interopRequireDefault(require("nullthrows"));
16
+ _nullthrows = function () {
19
17
  return data;
20
18
  };
21
19
  return data;
22
20
  }
21
+ var _child = require("../child");
22
+ var _childState = require("../childState");
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
24
  class ProcessChild {
25
25
  constructor(onMessage, onExit) {
@@ -34,11 +34,11 @@ class ProcessChild {
34
34
  if (data === 'die') {
35
35
  return this.stop();
36
36
  }
37
- this.onMessage((0, _core().deserialize)(Buffer.from(data, 'base64')));
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, _core().serialize)(data).toString('base64'), err => {
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,22 +11,15 @@ function _child_process() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _path() {
15
- const data = _interopRequireDefault(require("path"));
16
- _path = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _core() {
22
- const data = require("@atlaspack/core");
23
- _core = function () {
14
+ function _buildCache() {
15
+ const data = require("@atlaspack/build-cache");
16
+ _buildCache = function () {
24
17
  return data;
25
18
  };
26
19
  return data;
27
20
  }
28
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
- const WORKER_PATH = _path().default.join(__dirname, 'ProcessChild.js');
22
+ const WORKER_PATH = require.resolve('./ProcessChild');
30
23
  class ProcessWorker {
31
24
  processQueue = true;
32
25
  sendQueue = [];
@@ -43,7 +36,7 @@ class ProcessWorker {
43
36
  cwd: process.cwd()
44
37
  });
45
38
  this.child.on('message', data => {
46
- this.onMessage((0, _core().deserialize)(Buffer.from(data, 'base64')));
39
+ this.onMessage((0, _buildCache().deserialize)(Buffer.from(data, 'base64')));
47
40
  });
48
41
  this.child.once('exit', this.onExit);
49
42
  this.child.on('error', this.onError);
@@ -62,7 +55,7 @@ class ProcessWorker {
62
55
  this.sendQueue.push(data);
63
56
  return;
64
57
  }
65
- let result = this.child.send((0, _core().serialize)(data).toString('base64'), error => {
58
+ let result = this.child.send((0, _buildCache().serialize)(data).toString('base64'), error => {
66
59
  if (error && error instanceof Error) {
67
60
  // Ignore this, the workerfarm handles child errors
68
61
  return;
@@ -11,22 +11,22 @@ function _worker_threads() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _nullthrows() {
15
- const data = _interopRequireDefault(require("nullthrows"));
16
- _nullthrows = function () {
14
+ function _buildCache() {
15
+ const data = require("@atlaspack/build-cache");
16
+ _buildCache = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- var _childState = require("../childState");
22
- var _child = require("../child");
23
- function _core() {
24
- const data = require("@atlaspack/core");
25
- _core = function () {
21
+ function _nullthrows() {
22
+ const data = _interopRequireDefault(require("nullthrows"));
23
+ _nullthrows = function () {
26
24
  return data;
27
25
  };
28
26
  return data;
29
27
  }
28
+ var _child = require("../child");
29
+ var _childState = require("../childState");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
31
  class ThreadsChild {
32
32
  constructor(onMessage, onExit) {
@@ -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, _core().restoreDeserializedObject)(data));
42
+ this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
43
43
  }
44
44
  send(data) {
45
- (0, _nullthrows().default)(_worker_threads().parentPort).postMessage((0, _core().prepareForSerialization)(data));
45
+ (0, _nullthrows().default)(_worker_threads().parentPort).postMessage((0, _buildCache().prepareForSerialization)(data));
46
46
  }
47
47
  }
48
48
  exports.default = ThreadsChild;
@@ -11,22 +11,14 @@ function _worker_threads() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _path() {
15
- const data = _interopRequireDefault(require("path"));
16
- _path = function () {
14
+ function _buildCache() {
15
+ const data = require("@atlaspack/build-cache");
16
+ _buildCache = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- function _core() {
22
- const data = require("@atlaspack/core");
23
- _core = function () {
24
- return data;
25
- };
26
- return data;
27
- }
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
- const WORKER_PATH = _path().default.join(__dirname, 'ThreadsChild.js');
21
+ const WORKER_PATH = require.resolve('./ThreadsChild');
30
22
  class ThreadsWorker {
31
23
  constructor(execArgv, onMessage, onError, onExit) {
32
24
  this.execArgv = execArgv;
@@ -52,10 +44,10 @@ class ThreadsWorker {
52
44
  return Promise.resolve(this.worker.terminate());
53
45
  }
54
46
  handleMessage(data) {
55
- this.onMessage((0, _core().restoreDeserializedObject)(data));
47
+ this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
56
48
  }
57
49
  send(data) {
58
- this.worker.postMessage((0, _core().prepareForSerialization)(data));
50
+ this.worker.postMessage((0, _buildCache().prepareForSerialization)(data));
59
51
  }
60
52
  }
61
53
  exports.default = ThreadsWorker;
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _childState = require("../childState");
8
- var _child = require("../child");
9
- function _core() {
10
- const data = require("@atlaspack/core");
11
- _core = function () {
7
+ function _buildCache() {
8
+ const data = require("@atlaspack/build-cache");
9
+ _buildCache = function () {
12
10
  return data;
13
11
  };
14
12
  return data;
15
13
  }
14
+ var _child = require("../child");
15
+ var _childState = require("../childState");
16
16
  /* eslint-env worker*/
17
17
  class WebChild {
18
18
  constructor(onMessage, onExit) {
@@ -34,10 +34,10 @@ class WebChild {
34
34
  self.postMessage('online');
35
35
  }
36
36
  handleMessage(data) {
37
- this.onMessage((0, _core().restoreDeserializedObject)(data));
37
+ this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
38
38
  }
39
39
  send(data) {
40
- self.postMessage((0, _core().prepareForSerialization)(data));
40
+ self.postMessage((0, _buildCache().prepareForSerialization)(data));
41
41
  }
42
42
  }
43
43
  exports.default = WebChild;
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function _core() {
8
- const data = require("@atlaspack/core");
9
- _core = function () {
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, _core().restoreDeserializedObject)(data));
79
+ this.onMessage((0, _buildCache().restoreDeserializedObject)(data));
80
80
  }
81
81
  send(data) {
82
- this.worker.postMessage((0, _core().prepareForSerialization)(data));
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.3478+5fd2da535",
3
+ "version": "2.12.1-dev.3520+8a5346e28",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -17,20 +17,17 @@
17
17
  "node": ">= 16.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "@atlaspack/diagnostic": "2.12.1-dev.3478+5fd2da535",
21
- "@atlaspack/logger": "2.12.1-dev.3478+5fd2da535",
22
- "@atlaspack/profiler": "2.12.1-dev.3478+5fd2da535",
23
- "@atlaspack/types-internal": "2.12.1-dev.3478+5fd2da535",
24
- "@atlaspack/utils": "2.12.1-dev.3478+5fd2da535",
20
+ "@atlaspack/build-cache": "2.12.1-dev.3520+8a5346e28",
21
+ "@atlaspack/diagnostic": "2.12.1-dev.3520+8a5346e28",
22
+ "@atlaspack/logger": "2.12.1-dev.3520+8a5346e28",
23
+ "@atlaspack/profiler": "2.12.1-dev.3520+8a5346e28",
24
+ "@atlaspack/types-internal": "2.12.1-dev.3520+8a5346e28",
25
+ "@atlaspack/utils": "2.12.1-dev.3520+8a5346e28",
25
26
  "nullthrows": "^1.1.1"
26
27
  },
27
- "peerDependencies": {
28
- "@atlaspack/core": "^2.12.1-dev.3478+5fd2da535"
29
- },
30
28
  "browser": {
31
29
  "./src/process/ProcessWorker.js": false,
32
- "./src/threads/ThreadsWorker.js": false,
33
- "./src/core-worker.js": "./src/core-worker.browser.js"
30
+ "./src/threads/ThreadsWorker.js": false
34
31
  },
35
- "gitHead": "5fd2da535ecbe096d57e03aec15e80bb1d7601f7"
32
+ "gitHead": "8a5346e28c1bb3b9cd40f1c4e77c66dd6666f1e4"
36
33
  }
package/src/Handle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @flow strict-local
2
- import {registerSerializableClass} from '@atlaspack/core';
2
+ import {registerSerializableClass} from '@atlaspack/build-cache';
3
3
  // $FlowFixMe
4
4
  import packageJson from '../package.json';
5
5
 
package/src/WorkerFarm.js CHANGED
@@ -11,7 +11,6 @@ import type {
11
11
  } from './types';
12
12
  import type {HandleFunction} from './Handle';
13
13
 
14
- import * as coreWorker from './core-worker';
15
14
  import * as bus from './bus';
16
15
  import invariant from 'assert';
17
16
  import nullthrows from 'nullthrows';
@@ -21,7 +20,7 @@ import {
21
20
  prepareForSerialization,
22
21
  restoreDeserializedObject,
23
22
  serialize,
24
- } from '@atlaspack/core';
23
+ } from '@atlaspack/build-cache';
25
24
  import ThrowableDiagnostic, {anyToDiagnostic, md} from '@atlaspack/diagnostic';
26
25
  import Worker, {type WorkerCall} from './Worker';
27
26
  import cpuCount from './cpuCount';
@@ -104,18 +103,7 @@ export default class WorkerFarm extends EventEmitter {
104
103
  }
105
104
 
106
105
  // $FlowFixMe
107
- if (process.browser) {
108
- if (this.options.workerPath === '@atlaspack/core/src/worker.js') {
109
- this.localWorker = coreWorker;
110
- } else {
111
- throw new Error(
112
- 'No dynamic require possible: ' + this.options.workerPath,
113
- );
114
- }
115
- } else {
116
- // $FlowFixMe this must be dynamic
117
- this.localWorker = require(this.options.workerPath);
118
- }
106
+ this.localWorker = require(this.options.workerPath);
119
107
 
120
108
  this.localWorkerInit =
121
109
  this.localWorker.childInit != null ? this.localWorker.childInit() : null;
@@ -357,7 +345,7 @@ export default class WorkerFarm extends EventEmitter {
357
345
  } else if (location) {
358
346
  // $FlowFixMe
359
347
  if (process.browser) {
360
- if (location === '@atlaspack/workers/src/bus.js') {
348
+ if (location === '@atlaspack/workers/bus') {
361
349
  mod = (bus: any);
362
350
  } else {
363
351
  throw new Error('No dynamic require possible: ' + location);
package/src/bus.js CHANGED
@@ -8,9 +8,7 @@ class Bus extends EventEmitter {
8
8
  child.workerApi.callMaster(
9
9
  {
10
10
  // $FlowFixMe
11
- location: process.browser
12
- ? '@atlaspack/workers/src/bus.js'
13
- : __filename,
11
+ location: process.browser ? '@atlaspack/workers/bus' : __filename,
14
12
  method: 'emit',
15
13
  args: [event, ...args],
16
14
  },
package/src/child.js CHANGED
@@ -12,12 +12,11 @@ import type {
12
12
  import type {Async, IDisposable} from '@atlaspack/types-internal';
13
13
  import type {SharedReference} from './WorkerFarm';
14
14
 
15
- import * as coreWorker from './core-worker';
16
15
  import invariant from 'assert';
17
16
  import nullthrows from 'nullthrows';
17
+ import {deserialize} from '@atlaspack/build-cache';
18
18
  import Logger, {patchConsole, unpatchConsole} from '@atlaspack/logger';
19
19
  import ThrowableDiagnostic, {anyToDiagnostic} from '@atlaspack/diagnostic';
20
- import {deserialize} from '@atlaspack/core';
21
20
  import bus from './bus';
22
21
  import {SamplingProfiler, tracer} from '@atlaspack/profiler';
23
22
  import _Handle from './Handle';
@@ -102,16 +101,7 @@ export class Child {
102
101
 
103
102
  async childInit(module: string, childId: number): Promise<void> {
104
103
  // $FlowFixMe
105
- if (process.browser) {
106
- if (module === '@atlaspack/core/src/worker.js') {
107
- this.module = coreWorker;
108
- } else {
109
- throw new Error('No dynamic require possible: ' + module);
110
- }
111
- } else {
112
- // $FlowFixMe this must be dynamic
113
- this.module = require(module);
114
- }
104
+ this.module = require(module);
115
105
  this.childId = childId;
116
106
 
117
107
  if (this.module.childInit != null) {
@@ -6,10 +6,12 @@ import type {
6
6
  ExitHandler,
7
7
  WorkerMessage,
8
8
  } from '../types';
9
+
10
+ import {serialize, deserialize} from '@atlaspack/build-cache';
9
11
  import nullthrows from 'nullthrows';
10
- import {setChild} from '../childState';
12
+
11
13
  import {Child} from '../child';
12
- import {serialize, deserialize} from '@atlaspack/core';
14
+ import {setChild} from '../childState';
13
15
 
14
16
  export default class ProcessChild implements ChildImpl {
15
17
  onMessage: MessageHandler;
@@ -7,11 +7,12 @@ import type {
7
7
  ExitHandler,
8
8
  WorkerMessage,
9
9
  } from '../types';
10
+
10
11
  import childProcess, {type ChildProcess} from 'child_process';
11
- import path from 'path';
12
- import {serialize, deserialize} from '@atlaspack/core';
13
12
 
14
- const WORKER_PATH = path.join(__dirname, 'ProcessChild.js');
13
+ import {serialize, deserialize} from '@atlaspack/build-cache';
14
+
15
+ const WORKER_PATH = require.resolve('./ProcessChild');
15
16
 
16
17
  export default class ProcessWorker implements WorkerImpl {
17
18
  execArgv: Object;
@@ -6,14 +6,17 @@ import type {
6
6
  ExitHandler,
7
7
  WorkerMessage,
8
8
  } from '../types';
9
+
9
10
  import {isMainThread, parentPort} from 'worker_threads';
10
- import nullthrows from 'nullthrows';
11
- import {setChild} from '../childState';
12
- import {Child} from '../child';
11
+
13
12
  import {
14
13
  prepareForSerialization,
15
14
  restoreDeserializedObject,
16
- } from '@atlaspack/core';
15
+ } from '@atlaspack/build-cache';
16
+ import nullthrows from 'nullthrows';
17
+
18
+ import {Child} from '../child';
19
+ import {setChild} from '../childState';
17
20
 
18
21
  export default class ThreadsChild implements ChildImpl {
19
22
  onMessage: MessageHandler;
@@ -7,14 +7,15 @@ import type {
7
7
  ExitHandler,
8
8
  WorkerMessage,
9
9
  } from '../types';
10
+
10
11
  import {Worker} from 'worker_threads';
11
- import path from 'path';
12
+
12
13
  import {
13
14
  prepareForSerialization,
14
15
  restoreDeserializedObject,
15
- } from '@atlaspack/core';
16
+ } from '@atlaspack/build-cache';
16
17
 
17
- const WORKER_PATH = path.join(__dirname, 'ThreadsChild.js');
18
+ const WORKER_PATH = require.resolve('./ThreadsChild');
18
19
 
19
20
  export default class ThreadsWorker implements WorkerImpl {
20
21
  execArgv: Object;
@@ -7,12 +7,14 @@ import type {
7
7
  ExitHandler,
8
8
  WorkerMessage,
9
9
  } from '../types';
10
- import {setChild} from '../childState';
11
- import {Child} from '../child';
10
+
12
11
  import {
13
12
  prepareForSerialization,
14
13
  restoreDeserializedObject,
15
- } from '@atlaspack/core';
14
+ } from '@atlaspack/build-cache';
15
+
16
+ import {Child} from '../child';
17
+ import {setChild} from '../childState';
16
18
 
17
19
  export default class WebChild implements ChildImpl {
18
20
  onMessage: MessageHandler;
@@ -7,10 +7,11 @@ import type {
7
7
  ExitHandler,
8
8
  WorkerMessage,
9
9
  } from '../types';
10
+
10
11
  import {
11
12
  prepareForSerialization,
12
13
  restoreDeserializedObject,
13
- } from '@atlaspack/core';
14
+ } from '@atlaspack/build-cache';
14
15
  import {makeDeferredWithPromise} from '@atlaspack/utils';
15
16
 
16
17
  let id = 0;
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- // eslint-disable-next-line monorepo/no-internal-import
4
- module.exports = require('@atlaspack/core/src/worker.js');
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- // This is used only in browser builds
4
- module.exports = {};
@@ -1,3 +0,0 @@
1
- // @flow
2
- // eslint-disable-next-line monorepo/no-internal-import
3
- module.exports = require('@atlaspack/core/src/worker.js');
@@ -1,2 +0,0 @@
1
- // This is used only in browser builds
2
- module.exports = {};