ocjs-fluidcad 1.7.0 → 1.8.0
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/index.d.ts +15 -2
- package/dist/index.js +14 -1
- package/dist/opencascade.fluidcad.multi-threaded.build-manifest.json +4 -4
- package/dist/opencascade.fluidcad.multi-threaded.d.ts +27752 -27752
- package/dist/opencascade.fluidcad.multi-threaded.js +153 -153
- package/dist/opencascade.fluidcad.multi-threaded.js.symbols +11852 -11853
- package/dist/opencascade.fluidcad.multi-threaded.provenance.json +17 -7
- package/dist/opencascade.fluidcad.multi-threaded.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,22 @@ import type { OpenCascadeInstance } from "./opencascade.fluidcad.multi-threaded.
|
|
|
13
13
|
// deprecated-name `export type` aliases, FS, OCJS, … (everything but `init`).
|
|
14
14
|
export * from "./opencascade.fluidcad.multi-threaded.js";
|
|
15
15
|
|
|
16
|
+
/** Options for {@link init}: Emscripten Module overrides plus the worker pool size. */
|
|
17
|
+
export interface InitOptions extends Record<string, unknown> {
|
|
18
|
+
/**
|
|
19
|
+
* pthread workers to pre-spawn for OCCT's parallel algorithms (booleans, meshing).
|
|
20
|
+
* Defaults to one per logical CPU. When set (>= 1), OCCT's default thread pool is
|
|
21
|
+
* capped at the same count, so OCCT never asks for more threads than the pool holds.
|
|
22
|
+
* `OSD_ThreadPool.DefaultPool().Init(n)` changes OCCT's count later. The pre-spawned
|
|
23
|
+
* workers stay for the life of the instance; raising the count past them spawns more
|
|
24
|
+
* on demand under Node, but can deadlock a browser.
|
|
25
|
+
*/
|
|
26
|
+
pthreadPoolSize?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
/**
|
|
17
30
|
* Initialize the multi-threaded OCCT V8 module. The returned instance exposes the
|
|
18
31
|
* canonical (mangled) classes AND the restored deprecated OCCT names.
|
|
19
|
-
* @param options Emscripten Module overrides (e.g. `locateFile`)
|
|
32
|
+
* @param options Emscripten Module overrides (e.g. `locateFile`) and `pthreadPoolSize`.
|
|
20
33
|
*/
|
|
21
|
-
export default function init(options?:
|
|
34
|
+
export default function init(options?: InitOptions): Promise<OpenCascadeInstance>;
|
package/dist/index.js
CHANGED
|
@@ -13,13 +13,20 @@
|
|
|
13
13
|
// twice"; see FORK_PLAN.md §5.)
|
|
14
14
|
//
|
|
15
15
|
// Consumers who want the un-aliased module can import "<pkg>/raw".
|
|
16
|
+
//
|
|
17
|
+
// `pthreadPoolSize` sizes the pthread worker pool the runtime pre-spawns (default:
|
|
18
|
+
// one per logical CPU). It also caps OCCT's default thread pool at the same count,
|
|
19
|
+
// before any parallel algorithm can run: otherwise OCCT sizes its pool from the CPU
|
|
20
|
+
// count and asks for more threads than were pre-spawned, which Node absorbs by
|
|
21
|
+
// spawning workers on demand but which can deadlock a browser.
|
|
16
22
|
|
|
17
23
|
import rawInit from "./opencascade.fluidcad.multi-threaded.js";
|
|
18
24
|
import ALIASES from "./aliases.generated.js";
|
|
19
25
|
|
|
20
26
|
/**
|
|
21
27
|
* Initialize the OCCT V8 WASM module with deprecated OCCT type names restored.
|
|
22
|
-
* @param {Record<string, unknown>} [options] Emscripten
|
|
28
|
+
* @param {Record<string, unknown> & { pthreadPoolSize?: number }} [options] Emscripten
|
|
29
|
+
* Module overrides (e.g. `locateFile`), plus `pthreadPoolSize`.
|
|
23
30
|
* @returns {Promise<any>} the initialized instance (canonical + deprecated names).
|
|
24
31
|
*/
|
|
25
32
|
export default async function init(options) {
|
|
@@ -30,5 +37,11 @@ export default async function init(options) {
|
|
|
30
37
|
oc[alias] = oc[canonical];
|
|
31
38
|
}
|
|
32
39
|
}
|
|
40
|
+
const poolSize = options?.pthreadPoolSize;
|
|
41
|
+
if (Number.isInteger(poolSize) && poolSize >= 1) {
|
|
42
|
+
// The first DefaultPool() call creates the pool at that size; drop the
|
|
43
|
+
// returned handle wrapper, the pool itself lives on as OCCT's static.
|
|
44
|
+
oc.OSD_ThreadPool.DefaultPool(poolSize).delete();
|
|
45
|
+
}
|
|
33
46
|
return oc;
|
|
34
47
|
}
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
"error_categories": {},
|
|
4
4
|
"failed": 0,
|
|
5
5
|
"failures": [],
|
|
6
|
-
"total":
|
|
6
|
+
"total": 5357
|
|
7
7
|
},
|
|
8
8
|
"outputs": [
|
|
9
9
|
{
|
|
10
10
|
"js_exists": true,
|
|
11
|
-
"js_size":
|
|
11
|
+
"js_size": 68071,
|
|
12
12
|
"name": "opencascade.fluidcad.multi-threaded.js",
|
|
13
13
|
"pass": true,
|
|
14
14
|
"wasm_exists": true,
|
|
15
15
|
"wasm_file": "opencascade.fluidcad.multi-threaded.wasm",
|
|
16
|
-
"wasm_size":
|
|
16
|
+
"wasm_size": 23369947
|
|
17
17
|
}
|
|
18
18
|
],
|
|
19
19
|
"runtime_helpers": {
|
|
@@ -385,5 +385,5 @@
|
|
|
385
385
|
"timestamp": "2026-07-22T20:05:33Z",
|
|
386
386
|
"validation_passed": true,
|
|
387
387
|
"yaml_config": "fluidcad_multi.yml",
|
|
388
|
-
"yaml_hash": "
|
|
388
|
+
"yaml_hash": "8eb2a24b5c4e"
|
|
389
389
|
}
|