@atlaspack/workers 2.14.5-dev.1c70d50f9.99 → 2.14.5-dev.69

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/CHANGELOG.md CHANGED
@@ -1,44 +1,5 @@
1
1
  # @atlaspack/workers
2
2
 
3
- ## 2.14.14
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies []:
8
- - @atlaspack/types-internal@2.14.12
9
- - @atlaspack/utils@2.15.2
10
- - @atlaspack/profiler@2.14.12
11
-
12
- ## 2.14.13
13
-
14
- ### Patch Changes
15
-
16
- - [#650](https://github.com/atlassian-labs/atlaspack/pull/650) [`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb) Thanks [@alshdavid](https://github.com/alshdavid)! - Remove package.json#exports
17
-
18
- - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
19
- - @atlaspack/logger@2.14.11
20
- - @atlaspack/utils@2.15.1
21
- - @atlaspack/types-internal@2.14.11
22
- - @atlaspack/profiler@2.14.11
23
-
24
- ## 2.14.12
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
29
- - @atlaspack/utils@2.15.0
30
- - @atlaspack/types-internal@2.14.10
31
- - @atlaspack/profiler@2.14.10
32
-
33
- ## 2.14.11
34
-
35
- ### Patch Changes
36
-
37
- - Updated dependencies []:
38
- - @atlaspack/types-internal@2.14.9
39
- - @atlaspack/utils@2.14.11
40
- - @atlaspack/profiler@2.14.9
41
-
42
3
  ## 2.14.10
43
4
 
44
5
  ### Patch Changes
package/lib/WorkerFarm.js CHANGED
@@ -72,6 +72,13 @@ function _logger() {
72
72
  };
73
73
  return data;
74
74
  }
75
+ function _core() {
76
+ const data = require("@atlaspack/core");
77
+ _core = function () {
78
+ return data;
79
+ };
80
+ return data;
81
+ }
75
82
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
76
83
  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); }
77
84
  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; }
@@ -287,8 +294,15 @@ class WorkerFarm extends _events().default {
287
294
  var _this$handles$get;
288
295
  mod = (0, _nullthrows().default)((_this$handles$get = this.handles.get(handleId)) === null || _this$handles$get === void 0 ? void 0 : _this$handles$get.fn);
289
296
  } else if (location) {
290
- // $FlowFixMe
291
- if (process.browser) {
297
+ if ((0, _core().isSuperPackage)()) {
298
+ // Fixes for super package builds as they require static requires
299
+ if (location.endsWith('core/workers/bus.js')) {
300
+ mod = bus;
301
+ } else {
302
+ throw new Error('No dynamic require possible: ' + location);
303
+ }
304
+ // $FlowFixMe
305
+ } else if (process.browser) {
292
306
  if (location === '@atlaspack/workers/bus') {
293
307
  mod = bus;
294
308
  } else {
package/lib/backend.js CHANGED
@@ -13,12 +13,9 @@ function detectBackend() {
13
13
  case 'process':
14
14
  return process.env.ATLASPACK_WORKER_BACKEND;
15
15
  }
16
- try {
17
- require('worker_threads');
18
- return 'threads';
19
- } catch (err) {
20
- return 'process';
21
- }
16
+
17
+ // default to threads if no explicit option has been passed
18
+ return 'threads';
22
19
  }
23
20
  function getWorkerBackend(backend) {
24
21
  switch (backend) {
@@ -26,8 +23,6 @@ function getWorkerBackend(backend) {
26
23
  return require('./threads/ThreadsWorker').default;
27
24
  case 'process':
28
25
  return require('./process/ProcessWorker').default;
29
- case 'web':
30
- return require('./web/WebWorker').default;
31
26
  default:
32
27
  throw new Error(`Invalid backend: ${backend}`);
33
28
  }
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/bus' : __filename,
21
+ location: process.browser ? '@atlaspack/workers/bus' : /*#__ATLASPACK_IGNORE__*/__filename,
22
22
  method: 'emit',
23
23
  args: [event, ...args]
24
24
  }, false);
@@ -26,7 +26,7 @@ function _buildCache() {
26
26
  return data;
27
27
  }
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
- const WORKER_PATH = _path().default.join(__dirname, './ProcessChild.js');
29
+ const WORKER_PATH = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, './ProcessChild.js');
30
30
  class ProcessWorker {
31
31
  processQueue = true;
32
32
  sendQueue = [];
@@ -26,7 +26,7 @@ function _buildCache() {
26
26
  return data;
27
27
  }
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
- const WORKER_PATH = _path().default.join(__dirname, './ThreadsChild.js');
29
+ const WORKER_PATH = _path().default.join( /*#__ATLASPACK_IGNORE__*/__dirname, './ThreadsChild.js');
30
30
  class ThreadsWorker {
31
31
  constructor(execArgv, onMessage, onError, onExit) {
32
32
  this.execArgv = execArgv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/workers",
3
- "version": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
3
+ "version": "2.14.5-dev.69+67cb517ae",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -16,13 +16,20 @@
16
16
  "engines": {
17
17
  "node": ">= 16.0.0"
18
18
  },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./index.d.ts",
22
+ "@atlaspack::sources": "./src/index.js",
23
+ "default": "./lib/index.js"
24
+ }
25
+ },
19
26
  "dependencies": {
20
- "@atlaspack/build-cache": "2.13.3-dev.1c70d50f9.167+1c70d50f9",
21
- "@atlaspack/diagnostic": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
22
- "@atlaspack/logger": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
23
- "@atlaspack/profiler": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
24
- "@atlaspack/types-internal": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
25
- "@atlaspack/utils": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
27
+ "@atlaspack/build-cache": "2.13.3-dev.137+67cb517ae",
28
+ "@atlaspack/diagnostic": "2.14.1-dev.137+67cb517ae",
29
+ "@atlaspack/logger": "2.14.5-dev.69+67cb517ae",
30
+ "@atlaspack/profiler": "2.14.1-dev.137+67cb517ae",
31
+ "@atlaspack/types-internal": "2.14.1-dev.137+67cb517ae",
32
+ "@atlaspack/utils": "2.14.5-dev.69+67cb517ae",
26
33
  "nullthrows": "^1.1.1"
27
34
  },
28
35
  "browser": {
@@ -30,5 +37,5 @@
30
37
  "./src/threads/ThreadsWorker.js": false
31
38
  },
32
39
  "type": "commonjs",
33
- "gitHead": "1c70d50f914cb662515b0b61053e51a06f3af234"
40
+ "gitHead": "67cb517ae793046fb5a0d2ef02ba74510fefccf3"
34
41
  }
package/src/WorkerFarm.js CHANGED
@@ -30,6 +30,7 @@ import {detectBackend} from './backend';
30
30
  import {SamplingProfiler, Trace} from '@atlaspack/profiler';
31
31
  import fs from 'fs';
32
32
  import logger from '@atlaspack/logger';
33
+ import {isSuperPackage} from '@atlaspack/core';
33
34
 
34
35
  let referenceId = 1;
35
36
 
@@ -343,8 +344,15 @@ export default class WorkerFarm extends EventEmitter {
343
344
  if (handleId != null) {
344
345
  mod = nullthrows(this.handles.get(handleId)?.fn);
345
346
  } else if (location) {
346
- // $FlowFixMe
347
- if (process.browser) {
347
+ if (isSuperPackage()) {
348
+ // Fixes for super package builds as they require static requires
349
+ if (location.endsWith('core/workers/bus.js')) {
350
+ mod = (bus: any);
351
+ } else {
352
+ throw new Error('No dynamic require possible: ' + location);
353
+ }
354
+ // $FlowFixMe
355
+ } else if (process.browser) {
348
356
  if (location === '@atlaspack/workers/bus') {
349
357
  mod = (bus: any);
350
358
  } else {
package/src/backend.js CHANGED
@@ -11,12 +11,8 @@ export function detectBackend(): BackendType {
11
11
  return process.env.ATLASPACK_WORKER_BACKEND;
12
12
  }
13
13
 
14
- try {
15
- require('worker_threads');
16
- return 'threads';
17
- } catch (err) {
18
- return 'process';
19
- }
14
+ // default to threads if no explicit option has been passed
15
+ return 'threads';
20
16
  }
21
17
 
22
18
  export function getWorkerBackend(backend: BackendType): Class<WorkerImpl> {
@@ -25,8 +21,6 @@ export function getWorkerBackend(backend: BackendType): Class<WorkerImpl> {
25
21
  return require('./threads/ThreadsWorker').default;
26
22
  case 'process':
27
23
  return require('./process/ProcessWorker').default;
28
- case 'web':
29
- return require('./web/WebWorker').default;
30
24
  default:
31
25
  throw new Error(`Invalid backend: ${backend}`);
32
26
  }
package/src/bus.js CHANGED
@@ -8,7 +8,9 @@ class Bus extends EventEmitter {
8
8
  child.workerApi.callMaster(
9
9
  {
10
10
  // $FlowFixMe
11
- location: process.browser ? '@atlaspack/workers/bus' : __filename,
11
+ location: process.browser
12
+ ? '@atlaspack/workers/bus'
13
+ : /*#__ATLASPACK_IGNORE__*/ __filename,
12
14
  method: 'emit',
13
15
  args: [event, ...args],
14
16
  },
@@ -13,7 +13,10 @@ import path from 'path';
13
13
 
14
14
  import {serialize, deserialize} from '@atlaspack/build-cache';
15
15
 
16
- const WORKER_PATH = path.join(__dirname, './ProcessChild.js');
16
+ const WORKER_PATH = path.join(
17
+ /*#__ATLASPACK_IGNORE__*/ __dirname,
18
+ './ProcessChild.js',
19
+ );
17
20
 
18
21
  export default class ProcessWorker implements WorkerImpl {
19
22
  execArgv: Object;
@@ -16,7 +16,10 @@ import {
16
16
  restoreDeserializedObject,
17
17
  } from '@atlaspack/build-cache';
18
18
 
19
- const WORKER_PATH = path.join(__dirname, './ThreadsChild.js');
19
+ const WORKER_PATH = path.join(
20
+ /*#__ATLASPACK_IGNORE__*/ __dirname,
21
+ './ThreadsChild.js',
22
+ );
20
23
 
21
24
  export default class ThreadsWorker implements WorkerImpl {
22
25
  execArgv: Object;