@soundworks/core 4.0.0-alpha.27 → 4.0.0-alpha.28

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,3 +1,7 @@
1
+ ## v4.0.0-alpha.28 - 06/09/2025
2
+
3
+ - Fix: make it can work without `node_modules` when bundled to `.cjs` for use in Max
4
+
1
5
  ## v4.0.0-alpha.27 - 06/09/2025
2
6
 
3
7
  - Fix: assign to `const`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soundworks/core",
3
- "version": "4.0.0-alpha.27",
3
+ "version": "4.0.0-alpha.28",
4
4
  "description": "Open-source creative coding framework for distributed applications based on Web technologies",
5
5
  "authors": [
6
6
  "Benjamin Matuszewski",
@@ -1,2 +1,2 @@
1
1
  // [WARNING] This file is generated, do not edit
2
- export default '4.0.0-alpha.27';
2
+ export default '4.0.0-alpha.28';
@@ -4,6 +4,7 @@
4
4
  // Should move back to regular esm module once Max has fixed its loader
5
5
  export default `
6
6
  const { parentPort } = require('node:worker_threads');
7
+ const { hrtime } = require('node:process');
7
8
 
8
9
  let stack = [];
9
10
  let averageLatencyWindow = 5;
@@ -13,12 +14,14 @@ let intervalId = null;
13
14
  let meanLatency = 0;
14
15
 
15
16
  // workaround that sc-utils is pure emascript module
16
- let getTime;
17
- let inited = new Promise(async (resolve) => {
18
- module = await import('@ircam/sc-utils');
19
- getTime = module.getTime;
20
- resolve(true);
21
- });
17
+ // 2024/09/06 - Just copy getTime implementation so that we don't even need the node_modules
18
+ const start = hrtime.bigint();
19
+
20
+ function getTime() {
21
+ const now = hrtime.bigint();
22
+ const delta = now - start;
23
+ return Number(delta) * 1e-9;
24
+ }
22
25
 
23
26
  parentPort.on('message', async msg => {
24
27
  switch (msg.type) {
@@ -26,7 +29,6 @@ parentPort.on('message', async msg => {
26
29
  averageLatencyWindow = msg.value.averageLatencyWindow;
27
30
  averageLatencyPeriod = msg.value.averageLatencyPeriod;
28
31
 
29
- await inited;
30
32
  // launch compute in its own loop so that the number of computation is
31
33
  // decoupled from the number of connected clients
32
34
  clearInterval(intervalId);