faustwave 0.97.0 → 0.97.1

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/README.md CHANGED
@@ -24,8 +24,8 @@ faustwave build plugin tremolo.dsp --name "Tremolo" --version 1.0.0 --out plugin
24
24
 
25
25
  - **Presets:** a `tremolo.presets.json` beside the patch goes into the plugin (found and loaded through CLAP).
26
26
  - **Its page:** every plugin carries a page that draws its controls. Tags in a control's label lay them out —
27
- `[device:big]`, `[device:fader]`, `[device:col:1]` … `[device:monitor:<name>]` on a bargraph; `faustwave build plugin`
28
- alone lists them. `--theme` picks its colours, `--css <file>` adds your own.
27
+ `[device:big]`, `[device:fader]`, `[device:col:1]` … `[device:monitor:<name>]` on a bargraph; `faustwave build plugin --help`
28
+ lists them and every option. `--theme` picks its colours, `--css <file>` adds your own.
29
29
  - It compiles as faustwasm does and plays sample for sample as the patch plays there.
30
30
 
31
31
  ## Always current
@@ -8720,6 +8720,7 @@ var init_src2 = __esm({
8720
8720
  // src/convert.ts
8721
8721
  var convert_exports = {};
8722
8722
  __export(convert_exports, {
8723
+ PLUGIN_HELP: () => PLUGIN_HELP,
8723
8724
  convert: () => convert,
8724
8725
  convertArgs: () => convertArgs
8725
8726
  });
@@ -8733,20 +8734,19 @@ function convertArgs(args) {
8733
8734
  let sources = false;
8734
8735
  const files = [];
8735
8736
  for (let i = 0; i < args.length; i++) {
8736
- if (args[i] === "--page") throw new Error("--page is gone: a plugin's page is 2D (its controls) \u2014 leave it out; --theme and --css shape it.");
8737
- const m = /^--(name|id|version|out|look|theme|css|density)$/.exec(args[i]);
8737
+ const m = /^--(name|id|version|out|theme|css|density)$/.exec(args[i]);
8738
8738
  if (args[i] === "--sources") sources = true;
8739
8739
  else if (m) {
8740
- if (args[i + 1] === void 0) throw new Error(USAGE);
8740
+ if (args[i + 1] === void 0) throw wrong(`${args[i]} needs a value`);
8741
8741
  opts[m[1]] = args[++i];
8742
- } else if (args[i].startsWith("-")) throw new Error(`${args[i]}: no such option \u2014 ${USAGE}`);
8742
+ } else if (args[i].startsWith("-")) throw wrong(`${args[i]}: no such option`);
8743
8743
  else files.push(args[i]);
8744
8744
  }
8745
- if (files.length !== 1) throw new Error(USAGE);
8746
- if (opts.density !== void 0 && opts.density !== "compact") throw new Error(`--density ${opts.density}: only compact \u2014 ${USAGE}`);
8747
- if (opts.theme !== void 0) opts.look = opts.theme;
8748
- delete opts.theme;
8749
- return { file: files[0], ...opts, ...sources ? { sources } : {} };
8745
+ if (files.length !== 1) throw wrong(files.length ? `one patch at a time \u2014 ${files.length} were named: ${files.join(", ")}` : "which patch? faustwave build plugin <patch.dsp>");
8746
+ if (opts.density !== void 0 && opts.density !== "compact") throw wrong(`--density ${opts.density}: only compact`);
8747
+ if (opts.theme !== void 0 && !THEMES.includes(opts.theme)) throw wrong(`--theme ${opts.theme}: no such theme \u2014 ${THEMES.join(", ")}`);
8748
+ const { theme, ...rest2 } = opts;
8749
+ return { file: files[0], ...rest2, ...theme !== void 0 ? { look: theme } : {}, ...sources ? { sources } : {} };
8750
8750
  }
8751
8751
  async function convert(args) {
8752
8752
  const o = convertArgs(args);
@@ -8810,21 +8810,44 @@ async function convert(args) {
8810
8810
  return `${to}: "${info.name}" (${info.id}) ${info.version}, ${what}${withPresets}, ${sources ? "with its sources, " : ""}with its page (${built.info.ui ? `${built.info.ui.width} \xD7 ${built.info.ui.height}, ` : ""}${laid}), ${(archive.length / 1024).toFixed(0)} KB; ${tail}.
8811
8811
  Import it into a WebCLAP host (openDAW: Load Plugin \u2192 from disk)` + (true ? "." : ` \u2014 or publish it on the Hub as version ${info.version}: faustwave workflow run publish-plugin <inputs>.`);
8812
8812
  }
8813
- var USAGE;
8813
+ var PLUGIN_HELP, THEMES, wrong;
8814
8814
  var init_convert = __esm({
8815
8815
  "src/convert.ts"() {
8816
8816
  "use strict";
8817
8817
  init_src2();
8818
- USAGE = [
8819
- "usage: faustwave build plugin <patch.dsp> [--sources] [--theme studio|amber] [--density compact] [--css <file>] [--name <name>] [--id <id>] [--version <x.y.z>] [--out <folder>]",
8820
- " --sources the patch (and its presets file) packed with it, under src/ \u2014 who has the plugin can read and rebuild it",
8821
- " --theme its page's colours (default: FaustWave's); --css a file of your own over them",
8822
- " --density compact: smaller knobs, tighter panels (as a host's own devices sit)",
8823
- " --version the plugin's version (else the patch's declare version, else the day)",
8824
- " its page lays the controls out by [device:*] tags in their labels: big (a big knob \u2014 the macros), fader,",
8825
- " monitor:<name> on bargraphs (a line drawn of them, under their group's controls); its rows are the patch's groups",
8826
- " (v:Synth/h:sound/h:osc A/\u2026 \u2014 a group of groups a row, its groups the sections) \u2014 no tags: as Faust groups them"
8827
- ].join("\n");
8818
+ PLUGIN_HELP = `faustwave build plugin <patch.dsp> [options]
8819
+
8820
+ A Faust patch as a WebCLAP plugin with its page: <name>.wclap.tar.gz \u2014 the module, its page, its licence. Presets come
8821
+ from <patch>.presets.json beside the patch, when there is one.
8822
+
8823
+ Options:
8824
+ --out <folder> where the package goes (default: here)
8825
+ --name <name> the plugin's name (default: the patch's declare name, else the file's)
8826
+ --id <id> its CLAP id (default: io.faustwave.<name>)
8827
+ --version <x.y.z> its version (default: the patch's declare version, else the day)
8828
+ --theme <theme> its page's colours: studio, amber (default: FaustWave's)
8829
+ --css <file> a CSS file of your own over the theme
8830
+ --density compact smaller knobs, tighter panels (as a host's own devices sit)
8831
+ --sources pack the patch and its presets file with it, under src/ \u2014 who has the plugin can read them
8832
+ -h, --help this
8833
+
8834
+ Examples:
8835
+ faustwave build plugin tremolo.dsp
8836
+ faustwave build plugin synth.dsp --theme studio --out plugins/
8837
+ faustwave build plugin synth.dsp --name "My Synth" --version 1.0.0 --sources
8838
+
8839
+ Its page lays the controls out as Faust groups them (v:Synth/h:sound/h:osc A/\u2026 \u2014 a group of groups is a row, its
8840
+ groups the sections). Tags in a control's label shape it:
8841
+ [device:big] a big knob (the macros)
8842
+ [device:fader] a fader
8843
+ [device:col:<n>] its column
8844
+ [device:monitor:<name>] on a bargraph: a line drawn of it, under its group's controls
8845
+
8846
+ Import the package into a WebCLAP host (openDAW: Load Plugin \u2192 from disk), or try a patch first in the browser:
8847
+ https://faustwave.io/webclap`;
8848
+ THEMES = ["studio", "amber"];
8849
+ wrong = (said) => new Error(`${said}
8850
+ faustwave build plugin --help says the options.`);
8828
8851
  }
8829
8852
  });
8830
8853
 
@@ -8847,7 +8870,8 @@ function newer(a, b) {
8847
8870
  async function latest() {
8848
8871
  try {
8849
8872
  const res = await fetch(`https://registry.npmjs.org/${NAME}/latest`, { signal: AbortSignal.timeout(2e3) });
8850
- return res.ok ? (await res.json()).version ?? null : null;
8873
+ const version2 = res.ok ? (await res.json()).version : void 0;
8874
+ return version2 && /^\d+\.\d+\.\d+(-[\w.]+)?$/.test(version2) ? version2 : null;
8851
8875
  } catch {
8852
8876
  return null;
8853
8877
  }
@@ -8858,7 +8882,7 @@ async function update() {
8858
8882
  if (!l) throw new Error("npm gave no faustwave (not reached, or not published yet) \u2014 later again, or: npm i -g faustwave@latest");
8859
8883
  if (!newer(l, VERSION2)) return `faustwave ${VERSION2} is the newest`;
8860
8884
  const code = await new Promise((resolve) => {
8861
- const child = spawn("npm", ["install", "--global", `${NAME}@${l}`], { stdio: "inherit", shell: process.platform === "win32" });
8885
+ const child = spawn(`npm install --global ${NAME}@${l}`, { stdio: "inherit", shell: true });
8862
8886
  child.on("close", (c) => resolve(c ?? 1));
8863
8887
  child.on("error", () => resolve(1));
8864
8888
  });
@@ -8891,7 +8915,7 @@ var init_update = __esm({
8891
8915
  "src/update.ts"() {
8892
8916
  "use strict";
8893
8917
  init_pipe();
8894
- VERSION2 = false ? null : "0.97.0";
8918
+ VERSION2 = false ? null : "0.97.1";
8895
8919
  NAME = "faustwave";
8896
8920
  DAY = 24 * 60 * 60 * 1e3;
8897
8921
  }
@@ -31138,7 +31162,7 @@ init_pipe();
31138
31162
  // package.json
31139
31163
  var package_default = {
31140
31164
  name: "faustwave",
31141
- version: "0.97.0",
31165
+ version: "0.97.1",
31142
31166
  description: "The FaustWave CLI \u2014 a Faust patch as a WebCLAP plugin with its page, from a terminal or a script.",
31143
31167
  keywords: [
31144
31168
  "faust",
@@ -31344,17 +31368,21 @@ The Hub (FW_HUB_URL, FW_LOGTO_ENDPOINT, FW_LOGTO_CLI_APP_ID) \u2014 no IDE neede
31344
31368
  refund <purchase-id> [reason]
31345
31369
  refund the purchase's transaction in full through Paddle; revoked once Paddle reports it
31346
31370
  reconcile [days] the Hub against Paddle: purchases whose notification was lost, refunds, chargebacks`;
31347
- var USAGE2 = `faustwave <command>
31348
- ${STUDIO ? USAGE_STUDIO : ""}
31349
- update the newest faustwave (the npm package: npm i -g faustwave@latest)
31371
+ var VERSION3 = false ? null : "0.97.1";
31372
+ var USAGE = `faustwave \u2014 Faust patches as WebCLAP plugins, from the command line
31350
31373
 
31351
- ${STUDIO ? "No IDE needed:" : "Plugins:"}
31352
- build plugin <patch.dsp> [--sources] [--theme studio|amber] [--density compact] [--css <file>] [--name <name>] [--id <id>] [--version <x.y.z>] [--out <folder>]
31353
- a Faust patch as a WebCLAP plugin with its page: <Name>.wclap.tar.gz, compiled as the IDE
31354
- compiles; its presets from <patch>.presets.json beside it, when there is one; its
31355
- controls laid out by [device:*] tags (faustwave build plugin alone says them); --sources packs
31356
- the patch with it
31357
- ${HUB2 ? USAGE_HUB : ""}`;
31374
+ faustwave <command> [options]
31375
+
31376
+ ${STUDIO ? "No IDE needed:" : "Commands:"}
31377
+ build plugin <patch.dsp> a Faust patch as a WebCLAP plugin with its page: <name>.wclap.tar.gz
31378
+ (faustwave build plugin --help: its options, examples, the layout tags)
31379
+ update the newest faustwave (the npm package: npm i -g faustwave@latest)
31380
+ help this (also: -h, --help)
31381
+ version which faustwave this is (also: -v, --version)
31382
+ ${STUDIO ? USAGE_STUDIO : ""}${HUB2 ? USAGE_HUB : ""}
31383
+ Start here:
31384
+ faustwave build plugin tremolo.dsp then import tremolo.wclap.tar.gz into a WebCLAP host (openDAW: Load Plugin)
31385
+ https://faustwave.io/webclap write and hear a patch in the browser first`;
31358
31386
  var HUB_COMMANDS = ["login", "logout", "app", "item", "purchases", "refund", "reconcile", "push", "submit", "review", "publish", "yank", "releases"];
31359
31387
  var run = async (action, input = {}) => {
31360
31388
  const r = await askWaking({ op: "call", name: "palette.run", input: { action_id: action, input } });
@@ -31362,6 +31390,8 @@ var run = async (action, input = {}) => {
31362
31390
  };
31363
31391
  var inputOf = (arg) => arg === void 0 ? {} : JSON.parse(fs7.existsSync(arg) ? fs7.readFileSync(arg, "utf8") : arg);
31364
31392
  var [command, ...rest] = process.argv.slice(2);
31393
+ var HELP = ["help", "--help", "-h"];
31394
+ var pluginHelp = HELP.includes(command) && rest[0] === "build" || command === "build" && rest.some((a) => HELP.includes(a)) || command === "build" && rest.length === 1 && rest[0] === "plugin";
31365
31395
  var endsByItself = HUB_COMMANDS.includes(command) && !process.versions.electron;
31366
31396
  var done = () => process.stdout.write("", () => process.exit(0));
31367
31397
  try {
@@ -31369,7 +31399,13 @@ try {
31369
31399
  throw new Error(`faustwave ${command} plays the FaustWave studio \u2014 it comes with a later update (faustwave update).`);
31370
31400
  if (!HUB2 && (HUB_COMMANDS.includes(command) || command === "workflow"))
31371
31401
  throw new Error(`faustwave ${command} works with the FaustWave Hub \u2014 it comes with a later update (faustwave update).`);
31372
- if (command === "mcp") await mcp();
31402
+ if (pluginHelp) process.stdout.write(`${(await Promise.resolve().then(() => (init_convert(), convert_exports))).PLUGIN_HELP}
31403
+ `);
31404
+ else if (command === void 0 || HELP.includes(command) || rest.includes("--help") || rest.includes("-h")) process.stdout.write(`${USAGE}
31405
+ `);
31406
+ else if (["version", "--version", "-v"].includes(command)) process.stdout.write(`faustwave ${VERSION3 ?? "(a development checkout \u2014 it has no version of its own)"}
31407
+ `);
31408
+ else if (command === "mcp") await mcp();
31373
31409
  else if (command === "run" && rest[0]) process.stdout.write(await run(rest[0], inputOf(rest[1])) + "\n");
31374
31410
  else if (command === "shot" && rest[0]) {
31375
31411
  const r = await askWaking({ op: "call", name: "palette.run", input: { action_id: "stage.picture", input: { module_id: rest[0] } } });
@@ -31403,8 +31439,9 @@ try {
31403
31439
  process.stdout.write(`${await (await Promise.resolve().then(() => (init_update(), update_exports))).update()}
31404
31440
  `);
31405
31441
  } else {
31406
- process.stderr.write(USAGE2 + "\n");
31407
- process.exit(command ? 2 : 0);
31442
+ process.stderr.write(`faustwave ${command}: no such command \u2014 faustwave help lists them.
31443
+ `);
31444
+ process.exit(2);
31408
31445
  }
31409
31446
  if (command !== "mcp" && command !== "update") await (await Promise.resolve().then(() => (init_update(), update_exports))).hint();
31410
31447
  if (command !== "mcp" && !endsByItself) done();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "faustwave",
3
- "version": "0.97.0",
3
+ "version": "0.97.1",
4
4
  "description": "The FaustWave CLI — a Faust patch as a WebCLAP plugin with its page, from a terminal or a script.",
5
5
  "keywords": [
6
6
  "faust",