@grame/faustwasm 0.15.2 → 0.15.4

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -35,10 +35,6 @@ for (let i = 0; i < argv.length; i += 1) {
35
35
  i += 1;
36
36
  continue;
37
37
  }
38
- if (arg.startsWith("-I") && arg.length > 2) {
39
- argvFaust.push(arg);
40
- continue;
41
- }
42
38
  if (positionals.length < 2 && !arg.startsWith("-")) {
43
39
  positionals.push(arg);
44
40
  continue;
@@ -10,6 +10,28 @@ import {
10
10
  } from '../dist/esm/index.js';
11
11
  import { fileURLToPath } from 'url';
12
12
 
13
+ // Include handling overview (WASM compiler only sees its in-memory FS):
14
+ // 1) Grab the Faust FS via compiler.fs() and compute inputDir from inputFile.
15
+ // 2) Parse include args with parseIncludeArgs(argv):
16
+ // - Collects only `-I <dir>` into includeDirs.
17
+ // - Preserves non-include args as otherArgs.
18
+ // 3) Helper utilities:
19
+ // - ensureFsDir(dir) creates in-memory directories via mkdirTree (errors ignored).
20
+ // - isFaustSource(filePath) filters to .lib/.dsp files.
21
+ // - copyIncludeDirToFs(srcDir, destDir) mirrors Faust sources into the in-memory FS.
22
+ // 4) Build include list:
23
+ // - Always add inputDir.
24
+ // - Add any user-provided `-I` dirs.
25
+ // - Classify each include as host (disk) or fs (already in-memory).
26
+ // 5) Mirror host includes into the in-memory FS:
27
+ // - Map each host include to /faust/user/incN.
28
+ // - Copy sources into that path.
29
+ // - Record the mapped in-memory include dir.
30
+ // 6) Rewrite argv to only use in-memory include dirs:
31
+ // - Clear argv.
32
+ // - Add `-I /faust/user/incN` (and any original fs include dirs).
33
+ // - Append otherArgs, then `-ftz 2` as usual.
34
+
13
35
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
36
  const __filename = fileURLToPath(import.meta.url);
15
37
 
@@ -52,10 +74,6 @@ const faust2wasmFiles = async (
52
74
  i += 1;
53
75
  continue;
54
76
  }
55
- if (arg.startsWith('-I') && arg.length > 2) {
56
- includeDirs.push(arg.slice(2));
57
- continue;
58
- }
59
77
  otherArgs.push(arg);
60
78
  }
61
79
  return { includeDirs, otherArgs };