@openmixer/plugin-qualify 0.13.0 → 0.13.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/dist/hosting-codes.d.ts +15 -89
- package/dist/hosting-codes.generated.d.ts +76 -0
- package/dist/hosting-codes.generated.js +84 -0
- package/dist/hosting-codes.generated.js.map +1 -0
- package/dist/hosting-codes.js +10 -87
- package/dist/hosting-codes.js.map +1 -1
- package/package.json +3 -3
- package/src/hosting-codes.generated.ts +84 -0
- package/src/hosting-codes.ts +12 -178
- package/tools/clap-core-tsdir.d.mts +16 -0
- package/tools/clap-core-tsdir.mjs +93 -0
- package/tools/gen-hosting-codes.d.mts +8 -0
- package/tools/gen-hosting-codes.mjs +92 -0
package/dist/hosting-codes.d.ts
CHANGED
|
@@ -1,91 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The hosting verdict's message codes. Codes, never prose: the surface renders the operator's
|
|
3
|
+
* locale.
|
|
4
|
+
*
|
|
5
|
+
* omx-clap-core declares every hosting code: one `HOSTING_<DIMENSION>_CODES` table per dimension,
|
|
6
|
+
* in the TypeScript modules its package installs under `pkg-config --variable=tsdir omx-clap-core`
|
|
7
|
+
* (BUILDING.md). {@link HOSTING_CODE} is those tables flattened into one `key: code` map, written
|
|
8
|
+
* as plain data into `hosting-codes.generated.ts` by `tools/gen-hosting-codes.mjs` at build time:
|
|
9
|
+
* a code omx-clap-core does not declare cannot be named here, and this module reads no file and
|
|
10
|
+
* imports no `node:` module, so every public subpath that reaches it bundles for a browser.
|
|
11
|
+
* `src/contract-vocabulary-conformance.test.ts` holds the generated map to omx-clap-core's real
|
|
12
|
+
* modules, either way.
|
|
6
13
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* omx-clap-core's hosting codes, by key, across its two TypeScript modules — hand-kept here
|
|
12
|
-
* (not derived from a static import: the source is a runtime-resolved install directory, not an
|
|
13
|
-
* npm dependency) and held to the real modules by
|
|
14
|
-
* `src/contract-vocabulary-conformance.test.ts`, which turns red on any drift either way.
|
|
15
|
-
*/
|
|
16
|
-
export interface HostingCodeTable {
|
|
17
|
-
readonly clapExtensionsNotCovered: "hosting.clap.extensions-not-covered";
|
|
18
|
-
readonly clapFormatNotHosted: "hosting.clap.format-not-hosted";
|
|
19
|
-
readonly clapHeadlessFailed: "hosting.clap.headless-failed";
|
|
20
|
-
readonly clapLatencyMismatch: "hosting.clap.latency-mismatch";
|
|
21
|
-
readonly clapNoteInput: "hosting.clap.note-input";
|
|
22
|
-
readonly clapProcessError: "hosting.clap.process-error";
|
|
23
|
-
readonly clapThreadViolation: "hosting.clap.thread-violation";
|
|
24
|
-
readonly clapUnqualified: "hosting.clap.unqualified";
|
|
25
|
-
readonly costAboveCeiling: "hosting.cost.above-ceiling";
|
|
26
|
-
readonly costFieldsMissing: "hosting.cost.fields-missing";
|
|
27
|
-
readonly costSpiky: "hosting.cost.spiky-tail";
|
|
28
|
-
readonly costUnmeasured: "hosting.cost.unmeasured-at-rate-and-quantum";
|
|
29
|
-
readonly costWithinCeiling: "hosting.cost.within-ceiling";
|
|
30
|
-
readonly featuresAtomInUnfed: "hosting.features.atom-in-unfed";
|
|
31
|
-
readonly featuresDisqualifying: "hosting.features.host-not-provided";
|
|
32
|
-
readonly featuresMidiIn: "hosting.features.midi-in-fed-empty";
|
|
33
|
-
readonly featuresMissing: "hosting.features.missing";
|
|
34
|
-
readonly featuresPortsUnreadable: "hosting.features.ports-unreadable";
|
|
35
|
-
readonly featuresProvided: "hosting.features.all-provided";
|
|
36
|
-
readonly featuresUnscanned: "hosting.features.scan-predates-field";
|
|
37
|
-
readonly idleHoldRefused: "hosting.idle.hold-refused";
|
|
38
|
-
readonly latencyNonconforming: "hosting.latency.nonconforming";
|
|
39
|
-
readonly latencyParameterDependent: "hosting.latency.parameter-dependent";
|
|
40
|
-
readonly latencyResolved: "hosting.latency.resolved";
|
|
41
|
-
readonly latencyUnmeasured: "hosting.latency.unmeasured";
|
|
42
|
-
readonly outputNonFinite: "hosting.output.non-finite";
|
|
43
|
-
readonly overrideIsolated: "hosting.override.curator-isolated";
|
|
44
|
-
readonly patchBusy: "hosting.patch.busy";
|
|
45
|
-
readonly patchNotWritable: "hosting.patch.not-writable";
|
|
46
|
-
readonly patchTooLarge: "hosting.patch.too-large";
|
|
47
|
-
readonly presetNotFound: "hosting.preset.not-found";
|
|
48
|
-
readonly hostProvenanceDiffers: "hosting.provenance.host-differs";
|
|
49
|
-
readonly sweepControlDidNotFire: "hosting.provenance.sweep-control-did-not-fire";
|
|
50
|
-
readonly disabled: "hosting.disabled";
|
|
51
|
-
readonly linked: "hosting.linked";
|
|
52
|
-
readonly noRealisation: "hosting.no-realisation";
|
|
53
|
-
readonly realisedInProcess: "hosting.realised.in-process";
|
|
54
|
-
readonly unjudged: "hosting.unjudged";
|
|
55
|
-
readonly rtSafetyClean: "hosting.rt-safety.clean-under-sweep";
|
|
56
|
-
readonly rtSafetyNotReproducible: "hosting.rt-safety.not-reproducible";
|
|
57
|
-
readonly rtSafetyNotesClean: "hosting.rt-safety.clean-under-notes";
|
|
58
|
-
readonly rtSafetyNotesUnmeasured: "hosting.rt-safety.notes-unmeasured";
|
|
59
|
-
readonly rtSafetyNotesViolations: "hosting.rt-safety.violations-under-notes";
|
|
60
|
-
readonly rtSafetyUnmeasured: "hosting.rt-safety.unmeasured";
|
|
61
|
-
readonly rtSafetyViolations: "hosting.rt-safety.violations-in-run";
|
|
62
|
-
readonly stabilityBelowFloor: "hosting.stability.cycles-below-floor";
|
|
63
|
-
readonly stabilityCrashUnattributed: "hosting.stability.crash-unattributed";
|
|
64
|
-
readonly stabilityCrashedAttributed: "hosting.stability.crashed-attributed-plugin";
|
|
65
|
-
readonly stabilityCrashedLive: "hosting.stability.crashed-live-on-this-rig";
|
|
66
|
-
readonly stabilityLinksGuiToolkit: "hosting.stability.links-gui-toolkit";
|
|
67
|
-
readonly stabilitySoakFailedAtRate: "hosting.stability.soak-failed-at-rate";
|
|
68
|
-
readonly stabilitySoaked: "hosting.stability.soaked";
|
|
69
|
-
readonly stabilitySpawnsThreads: "hosting.stability.spawns-threads";
|
|
70
|
-
readonly stabilityUnmeasured: "hosting.stability.unmeasured";
|
|
71
|
-
readonly stabilityUnsoaked: "hosting.stability.unsoaked";
|
|
72
|
-
readonly stateNotACopy: "hosting.state.not-a-copy";
|
|
73
|
-
readonly statePathOnAudio: "hosting.state.path-on-audio";
|
|
74
|
-
readonly statePathOutside: "hosting.state.path-outside";
|
|
75
|
-
readonly statePathSymlink: "hosting.state.path-symlink";
|
|
76
|
-
readonly statePathTooLong: "hosting.state.path-too-long";
|
|
77
|
-
readonly statePathUnmakeable: "hosting.state.path-unmakeable";
|
|
78
|
-
readonly stateUnreadable: "hosting.state.unreadable";
|
|
79
|
-
readonly topologyAmbisonicConfig: "hosting.topology.ambisonic-config";
|
|
80
|
-
readonly topologyChannelMapUnknown: "hosting.topology.channel-map-unknown";
|
|
81
|
-
readonly topologyInstrument: "hosting.topology.instrument";
|
|
82
|
-
readonly topologyMatched: "hosting.topology.matched";
|
|
83
|
-
readonly topologyNoAudioInput: "hosting.topology.no-audio-input";
|
|
84
|
-
readonly topologyNoAudioOutput: "hosting.topology.no-audio-output";
|
|
85
|
-
readonly topologyPortTooWide: "hosting.topology.port-too-wide";
|
|
86
|
-
readonly topologyPortWithoutChannels: "hosting.topology.port-without-channels";
|
|
87
|
-
readonly topologyTooManyPorts: "hosting.topology.too-many-ports";
|
|
88
|
-
readonly topologyWiderThanStrip: "hosting.topology.wider-than-strip";
|
|
89
|
-
readonly workerNonconforming: "hosting.worker.nonconforming";
|
|
90
|
-
}
|
|
91
|
-
export declare const HOSTING_CODE: HostingCodeTable;
|
|
14
|
+
import { HOSTING_CODE } from "./hosting-codes.generated.js";
|
|
15
|
+
export { HOSTING_CODE };
|
|
16
|
+
/** {@link HOSTING_CODE}'s type: each key's literal code. */
|
|
17
|
+
export type HostingCodeTable = typeof HOSTING_CODE;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** omx-clap-core's hosting codes, by key: every `HOSTING_<DIMENSION>_CODES` table, flattened. */
|
|
2
|
+
export declare const HOSTING_CODE: Readonly<{
|
|
3
|
+
readonly clapExtensionsNotCovered: "hosting.clap.extensions-not-covered";
|
|
4
|
+
readonly clapFormatNotHosted: "hosting.clap.format-not-hosted";
|
|
5
|
+
readonly clapHeadlessFailed: "hosting.clap.headless-failed";
|
|
6
|
+
readonly clapLatencyMismatch: "hosting.clap.latency-mismatch";
|
|
7
|
+
readonly clapNoteInput: "hosting.clap.note-input";
|
|
8
|
+
readonly clapProcessError: "hosting.clap.process-error";
|
|
9
|
+
readonly clapThreadViolation: "hosting.clap.thread-violation";
|
|
10
|
+
readonly clapUnqualified: "hosting.clap.unqualified";
|
|
11
|
+
readonly costAboveCeiling: "hosting.cost.above-ceiling";
|
|
12
|
+
readonly costFieldsMissing: "hosting.cost.fields-missing";
|
|
13
|
+
readonly costSpiky: "hosting.cost.spiky-tail";
|
|
14
|
+
readonly costUnmeasured: "hosting.cost.unmeasured-at-rate-and-quantum";
|
|
15
|
+
readonly costWithinCeiling: "hosting.cost.within-ceiling";
|
|
16
|
+
readonly featuresAtomInUnfed: "hosting.features.atom-in-unfed";
|
|
17
|
+
readonly featuresDisqualifying: "hosting.features.host-not-provided";
|
|
18
|
+
readonly featuresMidiIn: "hosting.features.midi-in-fed-empty";
|
|
19
|
+
readonly featuresMissing: "hosting.features.missing";
|
|
20
|
+
readonly featuresPortsUnreadable: "hosting.features.ports-unreadable";
|
|
21
|
+
readonly featuresProvided: "hosting.features.all-provided";
|
|
22
|
+
readonly featuresUnscanned: "hosting.features.scan-predates-field";
|
|
23
|
+
readonly latencyNonconforming: "hosting.latency.nonconforming";
|
|
24
|
+
readonly latencyParameterDependent: "hosting.latency.parameter-dependent";
|
|
25
|
+
readonly latencyResolved: "hosting.latency.resolved";
|
|
26
|
+
readonly latencyUnmeasured: "hosting.latency.unmeasured";
|
|
27
|
+
readonly outputNonFinite: "hosting.output.non-finite";
|
|
28
|
+
readonly overrideIsolated: "hosting.override.curator-isolated";
|
|
29
|
+
readonly patchBusy: "hosting.patch.busy";
|
|
30
|
+
readonly patchNotWritable: "hosting.patch.not-writable";
|
|
31
|
+
readonly patchTooLarge: "hosting.patch.too-large";
|
|
32
|
+
readonly presetNotFound: "hosting.preset.not-found";
|
|
33
|
+
readonly hostProvenanceDiffers: "hosting.provenance.host-differs";
|
|
34
|
+
readonly sweepControlDidNotFire: "hosting.provenance.sweep-control-did-not-fire";
|
|
35
|
+
readonly disabled: "hosting.disabled";
|
|
36
|
+
readonly linked: "hosting.linked";
|
|
37
|
+
readonly noRealisation: "hosting.no-realisation";
|
|
38
|
+
readonly realisedInProcess: "hosting.realised.in-process";
|
|
39
|
+
readonly unjudged: "hosting.unjudged";
|
|
40
|
+
readonly rtSafetyClean: "hosting.rt-safety.clean-under-sweep";
|
|
41
|
+
readonly rtSafetyNotReproducible: "hosting.rt-safety.not-reproducible";
|
|
42
|
+
readonly rtSafetyNotesClean: "hosting.rt-safety.clean-under-notes";
|
|
43
|
+
readonly rtSafetyNotesUnmeasured: "hosting.rt-safety.notes-unmeasured";
|
|
44
|
+
readonly rtSafetyNotesViolations: "hosting.rt-safety.violations-under-notes";
|
|
45
|
+
readonly rtSafetyUnmeasured: "hosting.rt-safety.unmeasured";
|
|
46
|
+
readonly rtSafetyViolations: "hosting.rt-safety.violations-in-run";
|
|
47
|
+
readonly stabilityBelowFloor: "hosting.stability.cycles-below-floor";
|
|
48
|
+
readonly stabilityCrashUnattributed: "hosting.stability.crash-unattributed";
|
|
49
|
+
readonly stabilityCrashedAttributed: "hosting.stability.crashed-attributed-plugin";
|
|
50
|
+
readonly stabilityCrashedLive: "hosting.stability.crashed-live-on-this-rig";
|
|
51
|
+
readonly stabilityLinksGuiToolkit: "hosting.stability.links-gui-toolkit";
|
|
52
|
+
readonly stabilitySoakFailedAtRate: "hosting.stability.soak-failed-at-rate";
|
|
53
|
+
readonly stabilitySoaked: "hosting.stability.soaked";
|
|
54
|
+
readonly stabilitySpawnsThreads: "hosting.stability.spawns-threads";
|
|
55
|
+
readonly stabilityUnmeasured: "hosting.stability.unmeasured";
|
|
56
|
+
readonly stabilityUnsoaked: "hosting.stability.unsoaked";
|
|
57
|
+
readonly stateNotACopy: "hosting.state.not-a-copy";
|
|
58
|
+
readonly statePathOnAudio: "hosting.state.path-on-audio";
|
|
59
|
+
readonly statePathOutside: "hosting.state.path-outside";
|
|
60
|
+
readonly statePathSymlink: "hosting.state.path-symlink";
|
|
61
|
+
readonly statePathTooLong: "hosting.state.path-too-long";
|
|
62
|
+
readonly statePathUnmakeable: "hosting.state.path-unmakeable";
|
|
63
|
+
readonly stateUnreadable: "hosting.state.unreadable";
|
|
64
|
+
readonly topologyAmbisonicConfig: "hosting.topology.ambisonic-config";
|
|
65
|
+
readonly topologyChannelMapUnknown: "hosting.topology.channel-map-unknown";
|
|
66
|
+
readonly topologyInstrument: "hosting.topology.instrument";
|
|
67
|
+
readonly topologyMatched: "hosting.topology.matched";
|
|
68
|
+
readonly topologyNoAudioInput: "hosting.topology.no-audio-input";
|
|
69
|
+
readonly topologyNoAudioOutput: "hosting.topology.no-audio-output";
|
|
70
|
+
readonly topologyPortTooWide: "hosting.topology.port-too-wide";
|
|
71
|
+
readonly topologyPortWithoutChannels: "hosting.topology.port-without-channels";
|
|
72
|
+
readonly topologyTooManyPorts: "hosting.topology.too-many-ports";
|
|
73
|
+
readonly topologyWiderThanStrip: "hosting.topology.wider-than-strip";
|
|
74
|
+
readonly workerNonconforming: "hosting.worker.nonconforming";
|
|
75
|
+
readonly idleHoldRefused: "hosting.idle.hold-refused";
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// GENERATED by tools/gen-hosting-codes.mjs from omx-clap-core's hosting tables — do not hand-edit.
|
|
5
|
+
//
|
|
6
|
+
// Regenerate: node tools/gen-hosting-codes.mjs --write
|
|
7
|
+
// Verify: node tools/gen-hosting-codes.mjs --check
|
|
8
|
+
/** omx-clap-core's hosting codes, by key: every `HOSTING_<DIMENSION>_CODES` table, flattened. */
|
|
9
|
+
export const HOSTING_CODE = Object.freeze({
|
|
10
|
+
"clapExtensionsNotCovered": "hosting.clap.extensions-not-covered",
|
|
11
|
+
"clapFormatNotHosted": "hosting.clap.format-not-hosted",
|
|
12
|
+
"clapHeadlessFailed": "hosting.clap.headless-failed",
|
|
13
|
+
"clapLatencyMismatch": "hosting.clap.latency-mismatch",
|
|
14
|
+
"clapNoteInput": "hosting.clap.note-input",
|
|
15
|
+
"clapProcessError": "hosting.clap.process-error",
|
|
16
|
+
"clapThreadViolation": "hosting.clap.thread-violation",
|
|
17
|
+
"clapUnqualified": "hosting.clap.unqualified",
|
|
18
|
+
"costAboveCeiling": "hosting.cost.above-ceiling",
|
|
19
|
+
"costFieldsMissing": "hosting.cost.fields-missing",
|
|
20
|
+
"costSpiky": "hosting.cost.spiky-tail",
|
|
21
|
+
"costUnmeasured": "hosting.cost.unmeasured-at-rate-and-quantum",
|
|
22
|
+
"costWithinCeiling": "hosting.cost.within-ceiling",
|
|
23
|
+
"featuresAtomInUnfed": "hosting.features.atom-in-unfed",
|
|
24
|
+
"featuresDisqualifying": "hosting.features.host-not-provided",
|
|
25
|
+
"featuresMidiIn": "hosting.features.midi-in-fed-empty",
|
|
26
|
+
"featuresMissing": "hosting.features.missing",
|
|
27
|
+
"featuresPortsUnreadable": "hosting.features.ports-unreadable",
|
|
28
|
+
"featuresProvided": "hosting.features.all-provided",
|
|
29
|
+
"featuresUnscanned": "hosting.features.scan-predates-field",
|
|
30
|
+
"latencyNonconforming": "hosting.latency.nonconforming",
|
|
31
|
+
"latencyParameterDependent": "hosting.latency.parameter-dependent",
|
|
32
|
+
"latencyResolved": "hosting.latency.resolved",
|
|
33
|
+
"latencyUnmeasured": "hosting.latency.unmeasured",
|
|
34
|
+
"outputNonFinite": "hosting.output.non-finite",
|
|
35
|
+
"overrideIsolated": "hosting.override.curator-isolated",
|
|
36
|
+
"patchBusy": "hosting.patch.busy",
|
|
37
|
+
"patchNotWritable": "hosting.patch.not-writable",
|
|
38
|
+
"patchTooLarge": "hosting.patch.too-large",
|
|
39
|
+
"presetNotFound": "hosting.preset.not-found",
|
|
40
|
+
"hostProvenanceDiffers": "hosting.provenance.host-differs",
|
|
41
|
+
"sweepControlDidNotFire": "hosting.provenance.sweep-control-did-not-fire",
|
|
42
|
+
"disabled": "hosting.disabled",
|
|
43
|
+
"linked": "hosting.linked",
|
|
44
|
+
"noRealisation": "hosting.no-realisation",
|
|
45
|
+
"realisedInProcess": "hosting.realised.in-process",
|
|
46
|
+
"unjudged": "hosting.unjudged",
|
|
47
|
+
"rtSafetyClean": "hosting.rt-safety.clean-under-sweep",
|
|
48
|
+
"rtSafetyNotReproducible": "hosting.rt-safety.not-reproducible",
|
|
49
|
+
"rtSafetyNotesClean": "hosting.rt-safety.clean-under-notes",
|
|
50
|
+
"rtSafetyNotesUnmeasured": "hosting.rt-safety.notes-unmeasured",
|
|
51
|
+
"rtSafetyNotesViolations": "hosting.rt-safety.violations-under-notes",
|
|
52
|
+
"rtSafetyUnmeasured": "hosting.rt-safety.unmeasured",
|
|
53
|
+
"rtSafetyViolations": "hosting.rt-safety.violations-in-run",
|
|
54
|
+
"stabilityBelowFloor": "hosting.stability.cycles-below-floor",
|
|
55
|
+
"stabilityCrashUnattributed": "hosting.stability.crash-unattributed",
|
|
56
|
+
"stabilityCrashedAttributed": "hosting.stability.crashed-attributed-plugin",
|
|
57
|
+
"stabilityCrashedLive": "hosting.stability.crashed-live-on-this-rig",
|
|
58
|
+
"stabilityLinksGuiToolkit": "hosting.stability.links-gui-toolkit",
|
|
59
|
+
"stabilitySoakFailedAtRate": "hosting.stability.soak-failed-at-rate",
|
|
60
|
+
"stabilitySoaked": "hosting.stability.soaked",
|
|
61
|
+
"stabilitySpawnsThreads": "hosting.stability.spawns-threads",
|
|
62
|
+
"stabilityUnmeasured": "hosting.stability.unmeasured",
|
|
63
|
+
"stabilityUnsoaked": "hosting.stability.unsoaked",
|
|
64
|
+
"stateNotACopy": "hosting.state.not-a-copy",
|
|
65
|
+
"statePathOnAudio": "hosting.state.path-on-audio",
|
|
66
|
+
"statePathOutside": "hosting.state.path-outside",
|
|
67
|
+
"statePathSymlink": "hosting.state.path-symlink",
|
|
68
|
+
"statePathTooLong": "hosting.state.path-too-long",
|
|
69
|
+
"statePathUnmakeable": "hosting.state.path-unmakeable",
|
|
70
|
+
"stateUnreadable": "hosting.state.unreadable",
|
|
71
|
+
"topologyAmbisonicConfig": "hosting.topology.ambisonic-config",
|
|
72
|
+
"topologyChannelMapUnknown": "hosting.topology.channel-map-unknown",
|
|
73
|
+
"topologyInstrument": "hosting.topology.instrument",
|
|
74
|
+
"topologyMatched": "hosting.topology.matched",
|
|
75
|
+
"topologyNoAudioInput": "hosting.topology.no-audio-input",
|
|
76
|
+
"topologyNoAudioOutput": "hosting.topology.no-audio-output",
|
|
77
|
+
"topologyPortTooWide": "hosting.topology.port-too-wide",
|
|
78
|
+
"topologyPortWithoutChannels": "hosting.topology.port-without-channels",
|
|
79
|
+
"topologyTooManyPorts": "hosting.topology.too-many-ports",
|
|
80
|
+
"topologyWiderThanStrip": "hosting.topology.wider-than-strip",
|
|
81
|
+
"workerNonconforming": "hosting.worker.nonconforming",
|
|
82
|
+
"idleHoldRefused": "hosting.idle.hold-refused",
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=hosting-codes.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosting-codes.generated.js","sourceRoot":"","sources":["../src/hosting-codes.generated.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sDAAsD;AACtD,EAAE;AACF,mGAAmG;AACnG,EAAE;AACF,uDAAuD;AACvD,uDAAuD;AAEvD,iGAAiG;AACjG,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,0BAA0B,EAAE,qCAAqC;IACjE,qBAAqB,EAAE,gCAAgC;IACvD,oBAAoB,EAAE,8BAA8B;IACpD,qBAAqB,EAAE,+BAA+B;IACtD,eAAe,EAAE,yBAAyB;IAC1C,kBAAkB,EAAE,4BAA4B;IAChD,qBAAqB,EAAE,+BAA+B;IACtD,iBAAiB,EAAE,0BAA0B;IAC7C,kBAAkB,EAAE,4BAA4B;IAChD,mBAAmB,EAAE,6BAA6B;IAClD,WAAW,EAAE,yBAAyB;IACtC,gBAAgB,EAAE,6CAA6C;IAC/D,mBAAmB,EAAE,6BAA6B;IAClD,qBAAqB,EAAE,gCAAgC;IACvD,uBAAuB,EAAE,oCAAoC;IAC7D,gBAAgB,EAAE,oCAAoC;IACtD,iBAAiB,EAAE,0BAA0B;IAC7C,yBAAyB,EAAE,mCAAmC;IAC9D,kBAAkB,EAAE,+BAA+B;IACnD,mBAAmB,EAAE,sCAAsC;IAC3D,sBAAsB,EAAE,+BAA+B;IACvD,2BAA2B,EAAE,qCAAqC;IAClE,iBAAiB,EAAE,0BAA0B;IAC7C,mBAAmB,EAAE,4BAA4B;IACjD,iBAAiB,EAAE,2BAA2B;IAC9C,kBAAkB,EAAE,mCAAmC;IACvD,WAAW,EAAE,oBAAoB;IACjC,kBAAkB,EAAE,4BAA4B;IAChD,eAAe,EAAE,yBAAyB;IAC1C,gBAAgB,EAAE,0BAA0B;IAC5C,uBAAuB,EAAE,iCAAiC;IAC1D,wBAAwB,EAAE,+CAA+C;IACzE,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,gBAAgB;IAC1B,eAAe,EAAE,wBAAwB;IACzC,mBAAmB,EAAE,6BAA6B;IAClD,UAAU,EAAE,kBAAkB;IAC9B,eAAe,EAAE,qCAAqC;IACtD,yBAAyB,EAAE,oCAAoC;IAC/D,oBAAoB,EAAE,qCAAqC;IAC3D,yBAAyB,EAAE,oCAAoC;IAC/D,yBAAyB,EAAE,0CAA0C;IACrE,oBAAoB,EAAE,8BAA8B;IACpD,oBAAoB,EAAE,qCAAqC;IAC3D,qBAAqB,EAAE,sCAAsC;IAC7D,4BAA4B,EAAE,sCAAsC;IACpE,4BAA4B,EAAE,6CAA6C;IAC3E,sBAAsB,EAAE,4CAA4C;IACpE,0BAA0B,EAAE,qCAAqC;IACjE,2BAA2B,EAAE,uCAAuC;IACpE,iBAAiB,EAAE,0BAA0B;IAC7C,wBAAwB,EAAE,kCAAkC;IAC5D,qBAAqB,EAAE,8BAA8B;IACrD,mBAAmB,EAAE,4BAA4B;IACjD,eAAe,EAAE,0BAA0B;IAC3C,kBAAkB,EAAE,6BAA6B;IACjD,kBAAkB,EAAE,4BAA4B;IAChD,kBAAkB,EAAE,4BAA4B;IAChD,kBAAkB,EAAE,6BAA6B;IACjD,qBAAqB,EAAE,+BAA+B;IACtD,iBAAiB,EAAE,0BAA0B;IAC7C,yBAAyB,EAAE,mCAAmC;IAC9D,2BAA2B,EAAE,sCAAsC;IACnE,oBAAoB,EAAE,6BAA6B;IACnD,iBAAiB,EAAE,0BAA0B;IAC7C,sBAAsB,EAAE,iCAAiC;IACzD,uBAAuB,EAAE,kCAAkC;IAC3D,qBAAqB,EAAE,gCAAgC;IACvD,6BAA6B,EAAE,wCAAwC;IACvE,sBAAsB,EAAE,iCAAiC;IACzD,wBAAwB,EAAE,mCAAmC;IAC7D,qBAAqB,EAAE,8BAA8B;IACrD,iBAAiB,EAAE,2BAA2B;CACtC,CAAC,CAAC"}
|
package/dist/hosting-codes.js
CHANGED
|
@@ -4,92 +4,15 @@
|
|
|
4
4
|
* The hosting verdict's message codes. Codes, never prose: the surface renders the operator's
|
|
5
5
|
* locale.
|
|
6
6
|
*
|
|
7
|
-
* omx-clap-core declares every hosting code
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* omx-clap-core declares every hosting code: one `HOSTING_<DIMENSION>_CODES` table per dimension,
|
|
8
|
+
* in the TypeScript modules its package installs under `pkg-config --variable=tsdir omx-clap-core`
|
|
9
|
+
* (BUILDING.md). {@link HOSTING_CODE} is those tables flattened into one `key: code` map, written
|
|
10
|
+
* as plain data into `hosting-codes.generated.ts` by `tools/gen-hosting-codes.mjs` at build time:
|
|
11
|
+
* a code omx-clap-core does not declare cannot be named here, and this module reads no file and
|
|
12
|
+
* imports no `node:` module, so every public subpath that reaches it bundles for a browser.
|
|
13
|
+
* `src/contract-vocabulary-conformance.test.ts` holds the generated map to omx-clap-core's real
|
|
14
|
+
* modules, either way.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import { fileURLToPath } from "node:url";
|
|
20
|
-
/** The two TypeScript modules omx-clap-core's `tsdir` carries, each a `HOSTING_<DIMENSION>_CODES` source. */
|
|
21
|
-
const CLAP_CORE_TS_MODULES = ["omx-clap-core-vocabulary.js", "omx-clap-core-hosting.js"];
|
|
22
|
-
/** This package's own root, resolved from this module so it follows wherever it is installed. */
|
|
23
|
-
const PACKAGE_ROOT = fileURLToPath(new URL("..", import.meta.url));
|
|
24
|
-
/** `native/fetch-deps.sh`'s own checkout of omx-clap-core, for a build with no omx-clap-core-devel installed. */
|
|
25
|
-
const DEPS_TS_DIR = join(PACKAGE_ROOT, "native/deps/omx-clap-core/ts");
|
|
26
|
-
/** Where `make install` of omx-clap-host puts them (BUILDING.md), for a run with no `pkg-config` binary at all. */
|
|
27
|
-
const DEFAULT_SYSTEM_TS_DIR = "/usr/share/omx-clap-core/ts";
|
|
28
|
-
/** `pkg-config --variable=tsdir omx-clap-core`, or `undefined` where pkg-config or the package is absent. */
|
|
29
|
-
function pkgConfigTsDir(env) {
|
|
30
|
-
try {
|
|
31
|
-
const out = execFileSync(env.PKG_CONFIG ?? "pkg-config", ["--variable=tsdir", "omx-clap-core"], {
|
|
32
|
-
encoding: "utf8",
|
|
33
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
34
|
-
}).trim();
|
|
35
|
-
return out === "" ? undefined : out;
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Where omx-clap-core's TypeScript modules are looked for, in order: `OMX_CLAP_CORE_TSDIR` when
|
|
43
|
-
* set (and only that), else `pkg-config --variable=tsdir omx-clap-core`, else the checkout
|
|
44
|
-
* `native/fetch-deps.sh` stages, else the path `make install` of omx-clap-host uses by default —
|
|
45
|
-
* a packaged plugin-qualify's runtime has no `pkg-config` binary to ask.
|
|
46
|
-
*/
|
|
47
|
-
export function clapCoreTsDirCandidates(env = process.env) {
|
|
48
|
-
const set = env.OMX_CLAP_CORE_TSDIR;
|
|
49
|
-
if (set !== undefined && set !== "")
|
|
50
|
-
return [set];
|
|
51
|
-
const fromPkgConfig = pkgConfigTsDir(env);
|
|
52
|
-
return [...(fromPkgConfig === undefined ? [] : [fromPkgConfig]), DEPS_TS_DIR, DEFAULT_SYSTEM_TS_DIR];
|
|
53
|
-
}
|
|
54
|
-
function locateClapCoreTsDir() {
|
|
55
|
-
const candidates = clapCoreTsDirCandidates();
|
|
56
|
-
const dir = candidates.find((d) => CLAP_CORE_TS_MODULES.every((m) => existsSync(join(d, m))));
|
|
57
|
-
if (dir === undefined) {
|
|
58
|
-
throw new Error(`omx-clap-core's TypeScript modules (${CLAP_CORE_TS_MODULES.join(", ")}) were not found in any of: ` +
|
|
59
|
-
`${candidates.join(", ")}. Install omx-clap-core-devel (pkg-config omx-clap-core), set ` +
|
|
60
|
-
"OMX_CLAP_CORE_TSDIR to its tsdir, or run native/fetch-deps.sh.");
|
|
61
|
-
}
|
|
62
|
-
return dir;
|
|
63
|
-
}
|
|
64
|
-
/** True for an export name that is one of omx-clap-core's hosting tables. */
|
|
65
|
-
export function isHostingTableName(name) {
|
|
66
|
-
return /^HOSTING_[A-Z0-9_]+_CODES$/.test(name);
|
|
67
|
-
}
|
|
68
|
-
async function loadHostingTables() {
|
|
69
|
-
const dir = locateClapCoreTsDir();
|
|
70
|
-
const tables = {};
|
|
71
|
-
for (const name of CLAP_CORE_TS_MODULES) {
|
|
72
|
-
// The modules are self-contained ES modules in a directory with no package.json: Node 18 reads such a .js as
|
|
73
|
-
// CommonJS and refuses `export`, so the source is imported as a data: module, which is a module on every Node.
|
|
74
|
-
const source = readFileSync(join(dir, name), "utf8");
|
|
75
|
-
const mod = await import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
|
|
76
|
-
for (const [exportName, table] of Object.entries(mod)) {
|
|
77
|
-
if (isHostingTableName(exportName))
|
|
78
|
-
tables[exportName] = table;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return tables;
|
|
82
|
-
}
|
|
83
|
-
function flatten(tables) {
|
|
84
|
-
const table = {};
|
|
85
|
-
for (const [name, entries] of Object.entries(tables)) {
|
|
86
|
-
for (const [key, entry] of Object.entries(entries)) {
|
|
87
|
-
if (key in table)
|
|
88
|
-
throw new Error(`omx-clap-core declares the hosting key ${key} twice (${name})`);
|
|
89
|
-
table[key] = entry.code;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return Object.freeze(table);
|
|
93
|
-
}
|
|
94
|
-
export const HOSTING_CODE = flatten(await loadHostingTables());
|
|
16
|
+
import { HOSTING_CODE } from "./hosting-codes.generated.js";
|
|
17
|
+
export { HOSTING_CODE };
|
|
95
18
|
//# sourceMappingURL=hosting-codes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting-codes.js","sourceRoot":"","sources":["../src/hosting-codes.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sDAAsD;AACtD;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"hosting-codes.js","sourceRoot":"","sources":["../src/hosting-codes.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sDAAsD;AACtD;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmixer/plugin-qualify",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Qualify audio plugins for real-time hosting: scan, offline latency and cost measurement, a mod-host hosting sweep, and a fail-closed rating.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -77,12 +77,12 @@
|
|
|
77
77
|
"LICENSE"
|
|
78
78
|
],
|
|
79
79
|
"scripts": {
|
|
80
|
-
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|
|
80
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && node tools/gen-hosting-codes.mjs --build && tsc -p tsconfig.json",
|
|
81
81
|
"prepare": "npm run build",
|
|
82
82
|
"test": "vitest run src",
|
|
83
83
|
"lint": "tsc -p tsconfig.lint.json",
|
|
84
84
|
"test:py": "python3 -m pytest tools -q",
|
|
85
|
-
"check:generated": "node tools/gen-python-declarations.mjs --check",
|
|
85
|
+
"check:generated": "node tools/gen-python-declarations.mjs --check && node tools/gen-hosting-codes.mjs --check",
|
|
86
86
|
"check:private-refs": "tools/private-refs-check.sh && tools/private-refs-check.sh --self-test"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
+
//
|
|
4
|
+
// GENERATED by tools/gen-hosting-codes.mjs from omx-clap-core's hosting tables — do not hand-edit.
|
|
5
|
+
//
|
|
6
|
+
// Regenerate: node tools/gen-hosting-codes.mjs --write
|
|
7
|
+
// Verify: node tools/gen-hosting-codes.mjs --check
|
|
8
|
+
|
|
9
|
+
/** omx-clap-core's hosting codes, by key: every `HOSTING_<DIMENSION>_CODES` table, flattened. */
|
|
10
|
+
export const HOSTING_CODE = Object.freeze({
|
|
11
|
+
"clapExtensionsNotCovered": "hosting.clap.extensions-not-covered",
|
|
12
|
+
"clapFormatNotHosted": "hosting.clap.format-not-hosted",
|
|
13
|
+
"clapHeadlessFailed": "hosting.clap.headless-failed",
|
|
14
|
+
"clapLatencyMismatch": "hosting.clap.latency-mismatch",
|
|
15
|
+
"clapNoteInput": "hosting.clap.note-input",
|
|
16
|
+
"clapProcessError": "hosting.clap.process-error",
|
|
17
|
+
"clapThreadViolation": "hosting.clap.thread-violation",
|
|
18
|
+
"clapUnqualified": "hosting.clap.unqualified",
|
|
19
|
+
"costAboveCeiling": "hosting.cost.above-ceiling",
|
|
20
|
+
"costFieldsMissing": "hosting.cost.fields-missing",
|
|
21
|
+
"costSpiky": "hosting.cost.spiky-tail",
|
|
22
|
+
"costUnmeasured": "hosting.cost.unmeasured-at-rate-and-quantum",
|
|
23
|
+
"costWithinCeiling": "hosting.cost.within-ceiling",
|
|
24
|
+
"featuresAtomInUnfed": "hosting.features.atom-in-unfed",
|
|
25
|
+
"featuresDisqualifying": "hosting.features.host-not-provided",
|
|
26
|
+
"featuresMidiIn": "hosting.features.midi-in-fed-empty",
|
|
27
|
+
"featuresMissing": "hosting.features.missing",
|
|
28
|
+
"featuresPortsUnreadable": "hosting.features.ports-unreadable",
|
|
29
|
+
"featuresProvided": "hosting.features.all-provided",
|
|
30
|
+
"featuresUnscanned": "hosting.features.scan-predates-field",
|
|
31
|
+
"latencyNonconforming": "hosting.latency.nonconforming",
|
|
32
|
+
"latencyParameterDependent": "hosting.latency.parameter-dependent",
|
|
33
|
+
"latencyResolved": "hosting.latency.resolved",
|
|
34
|
+
"latencyUnmeasured": "hosting.latency.unmeasured",
|
|
35
|
+
"outputNonFinite": "hosting.output.non-finite",
|
|
36
|
+
"overrideIsolated": "hosting.override.curator-isolated",
|
|
37
|
+
"patchBusy": "hosting.patch.busy",
|
|
38
|
+
"patchNotWritable": "hosting.patch.not-writable",
|
|
39
|
+
"patchTooLarge": "hosting.patch.too-large",
|
|
40
|
+
"presetNotFound": "hosting.preset.not-found",
|
|
41
|
+
"hostProvenanceDiffers": "hosting.provenance.host-differs",
|
|
42
|
+
"sweepControlDidNotFire": "hosting.provenance.sweep-control-did-not-fire",
|
|
43
|
+
"disabled": "hosting.disabled",
|
|
44
|
+
"linked": "hosting.linked",
|
|
45
|
+
"noRealisation": "hosting.no-realisation",
|
|
46
|
+
"realisedInProcess": "hosting.realised.in-process",
|
|
47
|
+
"unjudged": "hosting.unjudged",
|
|
48
|
+
"rtSafetyClean": "hosting.rt-safety.clean-under-sweep",
|
|
49
|
+
"rtSafetyNotReproducible": "hosting.rt-safety.not-reproducible",
|
|
50
|
+
"rtSafetyNotesClean": "hosting.rt-safety.clean-under-notes",
|
|
51
|
+
"rtSafetyNotesUnmeasured": "hosting.rt-safety.notes-unmeasured",
|
|
52
|
+
"rtSafetyNotesViolations": "hosting.rt-safety.violations-under-notes",
|
|
53
|
+
"rtSafetyUnmeasured": "hosting.rt-safety.unmeasured",
|
|
54
|
+
"rtSafetyViolations": "hosting.rt-safety.violations-in-run",
|
|
55
|
+
"stabilityBelowFloor": "hosting.stability.cycles-below-floor",
|
|
56
|
+
"stabilityCrashUnattributed": "hosting.stability.crash-unattributed",
|
|
57
|
+
"stabilityCrashedAttributed": "hosting.stability.crashed-attributed-plugin",
|
|
58
|
+
"stabilityCrashedLive": "hosting.stability.crashed-live-on-this-rig",
|
|
59
|
+
"stabilityLinksGuiToolkit": "hosting.stability.links-gui-toolkit",
|
|
60
|
+
"stabilitySoakFailedAtRate": "hosting.stability.soak-failed-at-rate",
|
|
61
|
+
"stabilitySoaked": "hosting.stability.soaked",
|
|
62
|
+
"stabilitySpawnsThreads": "hosting.stability.spawns-threads",
|
|
63
|
+
"stabilityUnmeasured": "hosting.stability.unmeasured",
|
|
64
|
+
"stabilityUnsoaked": "hosting.stability.unsoaked",
|
|
65
|
+
"stateNotACopy": "hosting.state.not-a-copy",
|
|
66
|
+
"statePathOnAudio": "hosting.state.path-on-audio",
|
|
67
|
+
"statePathOutside": "hosting.state.path-outside",
|
|
68
|
+
"statePathSymlink": "hosting.state.path-symlink",
|
|
69
|
+
"statePathTooLong": "hosting.state.path-too-long",
|
|
70
|
+
"statePathUnmakeable": "hosting.state.path-unmakeable",
|
|
71
|
+
"stateUnreadable": "hosting.state.unreadable",
|
|
72
|
+
"topologyAmbisonicConfig": "hosting.topology.ambisonic-config",
|
|
73
|
+
"topologyChannelMapUnknown": "hosting.topology.channel-map-unknown",
|
|
74
|
+
"topologyInstrument": "hosting.topology.instrument",
|
|
75
|
+
"topologyMatched": "hosting.topology.matched",
|
|
76
|
+
"topologyNoAudioInput": "hosting.topology.no-audio-input",
|
|
77
|
+
"topologyNoAudioOutput": "hosting.topology.no-audio-output",
|
|
78
|
+
"topologyPortTooWide": "hosting.topology.port-too-wide",
|
|
79
|
+
"topologyPortWithoutChannels": "hosting.topology.port-without-channels",
|
|
80
|
+
"topologyTooManyPorts": "hosting.topology.too-many-ports",
|
|
81
|
+
"topologyWiderThanStrip": "hosting.topology.wider-than-strip",
|
|
82
|
+
"workerNonconforming": "hosting.worker.nonconforming",
|
|
83
|
+
"idleHoldRefused": "hosting.idle.hold-refused",
|
|
84
|
+
} as const);
|
package/src/hosting-codes.ts
CHANGED
|
@@ -4,184 +4,18 @@
|
|
|
4
4
|
* The hosting verdict's message codes. Codes, never prose: the surface renders the operator's
|
|
5
5
|
* locale.
|
|
6
6
|
*
|
|
7
|
-
* omx-clap-core declares every hosting code
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* omx-clap-core declares every hosting code: one `HOSTING_<DIMENSION>_CODES` table per dimension,
|
|
8
|
+
* in the TypeScript modules its package installs under `pkg-config --variable=tsdir omx-clap-core`
|
|
9
|
+
* (BUILDING.md). {@link HOSTING_CODE} is those tables flattened into one `key: code` map, written
|
|
10
|
+
* as plain data into `hosting-codes.generated.ts` by `tools/gen-hosting-codes.mjs` at build time:
|
|
11
|
+
* a code omx-clap-core does not declare cannot be named here, and this module reads no file and
|
|
12
|
+
* imports no `node:` module, so every public subpath that reaches it bundles for a browser.
|
|
13
|
+
* `src/contract-vocabulary-conformance.test.ts` holds the generated map to omx-clap-core's real
|
|
14
|
+
* modules, either way.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { HOSTING_CODE } from "./hosting-codes.generated.js";
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
const CLAP_CORE_TS_MODULES = ["omx-clap-core-vocabulary.js", "omx-clap-core-hosting.js"] as const;
|
|
18
|
+
export { HOSTING_CODE };
|
|
23
19
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/** `native/fetch-deps.sh`'s own checkout of omx-clap-core, for a build with no omx-clap-core-devel installed. */
|
|
28
|
-
const DEPS_TS_DIR = join(PACKAGE_ROOT, "native/deps/omx-clap-core/ts");
|
|
29
|
-
|
|
30
|
-
/** Where `make install` of omx-clap-host puts them (BUILDING.md), for a run with no `pkg-config` binary at all. */
|
|
31
|
-
const DEFAULT_SYSTEM_TS_DIR = "/usr/share/omx-clap-core/ts";
|
|
32
|
-
|
|
33
|
-
/** `pkg-config --variable=tsdir omx-clap-core`, or `undefined` where pkg-config or the package is absent. */
|
|
34
|
-
function pkgConfigTsDir(env: Readonly<Record<string, string | undefined>>): string | undefined {
|
|
35
|
-
try {
|
|
36
|
-
const out = execFileSync(env.PKG_CONFIG ?? "pkg-config", ["--variable=tsdir", "omx-clap-core"], {
|
|
37
|
-
encoding: "utf8",
|
|
38
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
39
|
-
}).trim();
|
|
40
|
-
return out === "" ? undefined : out;
|
|
41
|
-
} catch {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Where omx-clap-core's TypeScript modules are looked for, in order: `OMX_CLAP_CORE_TSDIR` when
|
|
48
|
-
* set (and only that), else `pkg-config --variable=tsdir omx-clap-core`, else the checkout
|
|
49
|
-
* `native/fetch-deps.sh` stages, else the path `make install` of omx-clap-host uses by default —
|
|
50
|
-
* a packaged plugin-qualify's runtime has no `pkg-config` binary to ask.
|
|
51
|
-
*/
|
|
52
|
-
export function clapCoreTsDirCandidates(env: Readonly<Record<string, string | undefined>> = process.env): readonly string[] {
|
|
53
|
-
const set = env.OMX_CLAP_CORE_TSDIR;
|
|
54
|
-
if (set !== undefined && set !== "") return [set];
|
|
55
|
-
const fromPkgConfig = pkgConfigTsDir(env);
|
|
56
|
-
return [...(fromPkgConfig === undefined ? [] : [fromPkgConfig]), DEPS_TS_DIR, DEFAULT_SYSTEM_TS_DIR];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function locateClapCoreTsDir(): string {
|
|
60
|
-
const candidates = clapCoreTsDirCandidates();
|
|
61
|
-
const dir = candidates.find((d) => CLAP_CORE_TS_MODULES.every((m) => existsSync(join(d, m))));
|
|
62
|
-
if (dir === undefined) {
|
|
63
|
-
throw new Error(
|
|
64
|
-
`omx-clap-core's TypeScript modules (${CLAP_CORE_TS_MODULES.join(", ")}) were not found in any of: ` +
|
|
65
|
-
`${candidates.join(", ")}. Install omx-clap-core-devel (pkg-config omx-clap-core), set ` +
|
|
66
|
-
"OMX_CLAP_CORE_TSDIR to its tsdir, or run native/fetch-deps.sh.",
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return dir;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** True for an export name that is one of omx-clap-core's hosting tables. */
|
|
73
|
-
export function isHostingTableName(name: string): boolean {
|
|
74
|
-
return /^HOSTING_[A-Z0-9_]+_CODES$/.test(name);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
type HostingEntries = Record<string, { readonly code: string }>;
|
|
78
|
-
|
|
79
|
-
async function loadHostingTables(): Promise<Record<string, HostingEntries>> {
|
|
80
|
-
const dir = locateClapCoreTsDir();
|
|
81
|
-
const tables: Record<string, HostingEntries> = {};
|
|
82
|
-
for (const name of CLAP_CORE_TS_MODULES) {
|
|
83
|
-
// The modules are self-contained ES modules in a directory with no package.json: Node 18 reads such a .js as
|
|
84
|
-
// CommonJS and refuses `export`, so the source is imported as a data: module, which is a module on every Node.
|
|
85
|
-
const source = readFileSync(join(dir, name), "utf8");
|
|
86
|
-
const mod: Record<string, unknown> = await import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
|
|
87
|
-
for (const [exportName, table] of Object.entries(mod)) {
|
|
88
|
-
if (isHostingTableName(exportName)) tables[exportName] = table as HostingEntries;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return tables;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function flatten(tables: Record<string, HostingEntries>): HostingCodeTable {
|
|
95
|
-
const table: Record<string, string> = {};
|
|
96
|
-
for (const [name, entries] of Object.entries(tables)) {
|
|
97
|
-
for (const [key, entry] of Object.entries(entries)) {
|
|
98
|
-
if (key in table) throw new Error(`omx-clap-core declares the hosting key ${key} twice (${name})`);
|
|
99
|
-
table[key] = entry.code;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return Object.freeze(table) as unknown as HostingCodeTable;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* omx-clap-core's hosting codes, by key, across its two TypeScript modules — hand-kept here
|
|
107
|
-
* (not derived from a static import: the source is a runtime-resolved install directory, not an
|
|
108
|
-
* npm dependency) and held to the real modules by
|
|
109
|
-
* `src/contract-vocabulary-conformance.test.ts`, which turns red on any drift either way.
|
|
110
|
-
*/
|
|
111
|
-
export interface HostingCodeTable {
|
|
112
|
-
readonly clapExtensionsNotCovered: "hosting.clap.extensions-not-covered";
|
|
113
|
-
readonly clapFormatNotHosted: "hosting.clap.format-not-hosted";
|
|
114
|
-
readonly clapHeadlessFailed: "hosting.clap.headless-failed";
|
|
115
|
-
readonly clapLatencyMismatch: "hosting.clap.latency-mismatch";
|
|
116
|
-
readonly clapNoteInput: "hosting.clap.note-input";
|
|
117
|
-
readonly clapProcessError: "hosting.clap.process-error";
|
|
118
|
-
readonly clapThreadViolation: "hosting.clap.thread-violation";
|
|
119
|
-
readonly clapUnqualified: "hosting.clap.unqualified";
|
|
120
|
-
readonly costAboveCeiling: "hosting.cost.above-ceiling";
|
|
121
|
-
readonly costFieldsMissing: "hosting.cost.fields-missing";
|
|
122
|
-
readonly costSpiky: "hosting.cost.spiky-tail";
|
|
123
|
-
readonly costUnmeasured: "hosting.cost.unmeasured-at-rate-and-quantum";
|
|
124
|
-
readonly costWithinCeiling: "hosting.cost.within-ceiling";
|
|
125
|
-
readonly featuresAtomInUnfed: "hosting.features.atom-in-unfed";
|
|
126
|
-
readonly featuresDisqualifying: "hosting.features.host-not-provided";
|
|
127
|
-
readonly featuresMidiIn: "hosting.features.midi-in-fed-empty";
|
|
128
|
-
readonly featuresMissing: "hosting.features.missing";
|
|
129
|
-
readonly featuresPortsUnreadable: "hosting.features.ports-unreadable";
|
|
130
|
-
readonly featuresProvided: "hosting.features.all-provided";
|
|
131
|
-
readonly featuresUnscanned: "hosting.features.scan-predates-field";
|
|
132
|
-
readonly idleHoldRefused: "hosting.idle.hold-refused";
|
|
133
|
-
readonly latencyNonconforming: "hosting.latency.nonconforming";
|
|
134
|
-
readonly latencyParameterDependent: "hosting.latency.parameter-dependent";
|
|
135
|
-
readonly latencyResolved: "hosting.latency.resolved";
|
|
136
|
-
readonly latencyUnmeasured: "hosting.latency.unmeasured";
|
|
137
|
-
readonly outputNonFinite: "hosting.output.non-finite";
|
|
138
|
-
readonly overrideIsolated: "hosting.override.curator-isolated";
|
|
139
|
-
readonly patchBusy: "hosting.patch.busy";
|
|
140
|
-
readonly patchNotWritable: "hosting.patch.not-writable";
|
|
141
|
-
readonly patchTooLarge: "hosting.patch.too-large";
|
|
142
|
-
readonly presetNotFound: "hosting.preset.not-found";
|
|
143
|
-
readonly hostProvenanceDiffers: "hosting.provenance.host-differs";
|
|
144
|
-
readonly sweepControlDidNotFire: "hosting.provenance.sweep-control-did-not-fire";
|
|
145
|
-
readonly disabled: "hosting.disabled";
|
|
146
|
-
readonly linked: "hosting.linked";
|
|
147
|
-
readonly noRealisation: "hosting.no-realisation";
|
|
148
|
-
readonly realisedInProcess: "hosting.realised.in-process";
|
|
149
|
-
readonly unjudged: "hosting.unjudged";
|
|
150
|
-
readonly rtSafetyClean: "hosting.rt-safety.clean-under-sweep";
|
|
151
|
-
readonly rtSafetyNotReproducible: "hosting.rt-safety.not-reproducible";
|
|
152
|
-
readonly rtSafetyNotesClean: "hosting.rt-safety.clean-under-notes";
|
|
153
|
-
readonly rtSafetyNotesUnmeasured: "hosting.rt-safety.notes-unmeasured";
|
|
154
|
-
readonly rtSafetyNotesViolations: "hosting.rt-safety.violations-under-notes";
|
|
155
|
-
readonly rtSafetyUnmeasured: "hosting.rt-safety.unmeasured";
|
|
156
|
-
readonly rtSafetyViolations: "hosting.rt-safety.violations-in-run";
|
|
157
|
-
readonly stabilityBelowFloor: "hosting.stability.cycles-below-floor";
|
|
158
|
-
readonly stabilityCrashUnattributed: "hosting.stability.crash-unattributed";
|
|
159
|
-
readonly stabilityCrashedAttributed: "hosting.stability.crashed-attributed-plugin";
|
|
160
|
-
readonly stabilityCrashedLive: "hosting.stability.crashed-live-on-this-rig";
|
|
161
|
-
readonly stabilityLinksGuiToolkit: "hosting.stability.links-gui-toolkit";
|
|
162
|
-
readonly stabilitySoakFailedAtRate: "hosting.stability.soak-failed-at-rate";
|
|
163
|
-
readonly stabilitySoaked: "hosting.stability.soaked";
|
|
164
|
-
readonly stabilitySpawnsThreads: "hosting.stability.spawns-threads";
|
|
165
|
-
readonly stabilityUnmeasured: "hosting.stability.unmeasured";
|
|
166
|
-
readonly stabilityUnsoaked: "hosting.stability.unsoaked";
|
|
167
|
-
readonly stateNotACopy: "hosting.state.not-a-copy";
|
|
168
|
-
readonly statePathOnAudio: "hosting.state.path-on-audio";
|
|
169
|
-
readonly statePathOutside: "hosting.state.path-outside";
|
|
170
|
-
readonly statePathSymlink: "hosting.state.path-symlink";
|
|
171
|
-
readonly statePathTooLong: "hosting.state.path-too-long";
|
|
172
|
-
readonly statePathUnmakeable: "hosting.state.path-unmakeable";
|
|
173
|
-
readonly stateUnreadable: "hosting.state.unreadable";
|
|
174
|
-
readonly topologyAmbisonicConfig: "hosting.topology.ambisonic-config";
|
|
175
|
-
readonly topologyChannelMapUnknown: "hosting.topology.channel-map-unknown";
|
|
176
|
-
readonly topologyInstrument: "hosting.topology.instrument";
|
|
177
|
-
readonly topologyMatched: "hosting.topology.matched";
|
|
178
|
-
readonly topologyNoAudioInput: "hosting.topology.no-audio-input";
|
|
179
|
-
readonly topologyNoAudioOutput: "hosting.topology.no-audio-output";
|
|
180
|
-
readonly topologyPortTooWide: "hosting.topology.port-too-wide";
|
|
181
|
-
readonly topologyPortWithoutChannels: "hosting.topology.port-without-channels";
|
|
182
|
-
readonly topologyTooManyPorts: "hosting.topology.too-many-ports";
|
|
183
|
-
readonly topologyWiderThanStrip: "hosting.topology.wider-than-strip";
|
|
184
|
-
readonly workerNonconforming: "hosting.worker.nonconforming";
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export const HOSTING_CODE: HostingCodeTable = flatten(await loadHostingTables());
|
|
20
|
+
/** {@link HOSTING_CODE}'s type: each key's literal code. */
|
|
21
|
+
export type HostingCodeTable = typeof HOSTING_CODE;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
+
/** The two TypeScript modules omx-clap-core's `tsdir` carries. */
|
|
4
|
+
export const CLAP_CORE_TS_MODULES: readonly string[];
|
|
5
|
+
/** Where omx-clap-core's TypeScript modules are looked for, in order. */
|
|
6
|
+
export function clapCoreTsDirCandidates(env?: Readonly<Record<string, string | undefined>>): readonly string[];
|
|
7
|
+
/** The first candidate holding both modules, or `undefined`. */
|
|
8
|
+
export function findClapCoreTsDir(env?: Readonly<Record<string, string | undefined>>): string | undefined;
|
|
9
|
+
/** True for an export name that is one of omx-clap-core's hosting tables. */
|
|
10
|
+
export function isHostingTableName(name: string): boolean;
|
|
11
|
+
/** One hosting table: key to its entry. */
|
|
12
|
+
export type HostingEntries = Readonly<Record<string, { readonly code: string }>>;
|
|
13
|
+
/** Every hosting table the modules in `dir` export, by export name. */
|
|
14
|
+
export function loadHostingTables(dir: string): Promise<Record<string, HostingEntries>>;
|
|
15
|
+
/** The tables flattened into one `key: code` map. */
|
|
16
|
+
export function flattenHostingTables(tables: Readonly<Record<string, HostingEntries>>): Record<string, string>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
+
/*
|
|
4
|
+
* clap-core-tsdir.mjs — where omx-clap-core's TypeScript modules are, and their hosting tables.
|
|
5
|
+
*
|
|
6
|
+
* omx-clap-core declares every hosting code: one `HOSTING_<DIMENSION>_CODES` table per dimension,
|
|
7
|
+
* rendered into the modules its package installs under `pkg-config --variable=tsdir omx-clap-core`
|
|
8
|
+
* (BUILDING.md) — `omx-clap-core-vocabulary.js` for the dimensions carried from omx-contract,
|
|
9
|
+
* `omx-clap-core-hosting.js` for `hosting.idle.*`. `tools/gen-hosting-codes.mjs` reads them here
|
|
10
|
+
* to write `src/hosting-codes.generated.ts`, and the conformance test reads them here to hold that
|
|
11
|
+
* file to them.
|
|
12
|
+
*
|
|
13
|
+
* Node only, and build and test only: no module under src/ imports it, so nothing a public subpath
|
|
14
|
+
* reaches touches the filesystem or a child process.
|
|
15
|
+
*/
|
|
16
|
+
import { execFileSync } from 'node:child_process';
|
|
17
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
18
|
+
import { dirname, join, resolve } from 'node:path';
|
|
19
|
+
import { fileURLToPath } from 'node:url';
|
|
20
|
+
|
|
21
|
+
/** The two TypeScript modules omx-clap-core's `tsdir` carries, each a `HOSTING_<DIMENSION>_CODES` source. */
|
|
22
|
+
export const CLAP_CORE_TS_MODULES = Object.freeze(['omx-clap-core-vocabulary.js', 'omx-clap-core-hosting.js']);
|
|
23
|
+
|
|
24
|
+
/** This package's root. */
|
|
25
|
+
const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
26
|
+
|
|
27
|
+
/** `native/fetch-deps.sh`'s own checkout of omx-clap-core, for a build with no omx-clap-core-devel installed. */
|
|
28
|
+
const DEPS_TS_DIR = join(PACKAGE_ROOT, 'native/deps/omx-clap-core/ts');
|
|
29
|
+
|
|
30
|
+
/** Where `make install` of omx-clap-host puts them (BUILDING.md), for a run with no `pkg-config` binary at all. */
|
|
31
|
+
const DEFAULT_SYSTEM_TS_DIR = '/usr/share/omx-clap-core/ts';
|
|
32
|
+
|
|
33
|
+
/** `pkg-config --variable=tsdir omx-clap-core`, or `undefined` where pkg-config or the package is absent. */
|
|
34
|
+
function pkgConfigTsDir(env) {
|
|
35
|
+
try {
|
|
36
|
+
const out = execFileSync(env.PKG_CONFIG ?? 'pkg-config', ['--variable=tsdir', 'omx-clap-core'], {
|
|
37
|
+
encoding: 'utf8',
|
|
38
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
39
|
+
}).trim();
|
|
40
|
+
return out === '' ? undefined : out;
|
|
41
|
+
} catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Where omx-clap-core's TypeScript modules are looked for, in order: `OMX_CLAP_CORE_TSDIR` when
|
|
48
|
+
* set (and only that), else `pkg-config --variable=tsdir omx-clap-core`, else the checkout
|
|
49
|
+
* `native/fetch-deps.sh` stages, else the path `make install` of omx-clap-host uses by default.
|
|
50
|
+
*/
|
|
51
|
+
export function clapCoreTsDirCandidates(env = process.env) {
|
|
52
|
+
const set = env.OMX_CLAP_CORE_TSDIR;
|
|
53
|
+
if (set !== undefined && set !== '') return [set];
|
|
54
|
+
const fromPkgConfig = pkgConfigTsDir(env);
|
|
55
|
+
return [...(fromPkgConfig === undefined ? [] : [fromPkgConfig]), DEPS_TS_DIR, DEFAULT_SYSTEM_TS_DIR];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The first candidate holding both modules, or `undefined`. */
|
|
59
|
+
export function findClapCoreTsDir(env = process.env) {
|
|
60
|
+
return clapCoreTsDirCandidates(env).find((d) => CLAP_CORE_TS_MODULES.every((m) => existsSync(join(d, m))));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** True for an export name that is one of omx-clap-core's hosting tables. */
|
|
64
|
+
export function isHostingTableName(name) {
|
|
65
|
+
return /^HOSTING_[A-Z0-9_]+_CODES$/.test(name);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Every `HOSTING_<DIMENSION>_CODES` table the two modules in `dir` export, by export name, in module order. */
|
|
69
|
+
export async function loadHostingTables(dir) {
|
|
70
|
+
const tables = {};
|
|
71
|
+
for (const name of CLAP_CORE_TS_MODULES) {
|
|
72
|
+
// The modules are self-contained ES modules in a directory with no package.json: Node 18 reads such a .js as
|
|
73
|
+
// CommonJS and refuses `export`, so the source is imported as a data: module, which is a module on every Node.
|
|
74
|
+
const source = readFileSync(join(dir, name), 'utf8');
|
|
75
|
+
const mod = await import(`data:text/javascript;base64,${Buffer.from(source).toString('base64')}`);
|
|
76
|
+
for (const [exportName, table] of Object.entries(mod)) {
|
|
77
|
+
if (isHostingTableName(exportName)) tables[exportName] = table;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return tables;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The tables flattened into one `key: code` map; a key two tables declare is refused. */
|
|
84
|
+
export function flattenHostingTables(tables) {
|
|
85
|
+
const flat = {};
|
|
86
|
+
for (const [name, entries] of Object.entries(tables)) {
|
|
87
|
+
for (const [key, entry] of Object.entries(entries)) {
|
|
88
|
+
if (key in flat) throw new Error(`omx-clap-core declares the hosting key ${key} twice (${name})`);
|
|
89
|
+
flat[key] = entry.code;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return flat;
|
|
93
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
+
/** The committed generated module, `src/hosting-codes.generated.ts`. */
|
|
4
|
+
export const OUT: string;
|
|
5
|
+
/** The generated module's text for a flattened `key: code` map. */
|
|
6
|
+
export function hostingCodesFile(flat: Readonly<Record<string, string>>): string;
|
|
7
|
+
/** The generated module's text from the omx-clap-core modules in `dir`. */
|
|
8
|
+
export function hostingCodesFileFrom(dir: string): Promise<string>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
4
|
+
/*
|
|
5
|
+
* gen-hosting-codes.mjs — `src/hosting-codes.generated.ts`, omx-clap-core's hosting tables flattened
|
|
6
|
+
* into one `key: code` map, as plain data.
|
|
7
|
+
*
|
|
8
|
+
* The codes are omx-clap-core's (tools/clap-core-tsdir.mjs finds its TypeScript modules). They reach
|
|
9
|
+
* `HOSTING_CODE` as a generated module rather than a read at import, so every module a public subpath
|
|
10
|
+
* reaches stays free of `node:` imports and bundles for a browser (#134). The file is committed and
|
|
11
|
+
* checked identical, as `tools/_declarations.py` is; `pnpm build` regenerates it whenever omx-clap-core's
|
|
12
|
+
* modules are found, and keeps the committed one where they are not.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* node tools/gen-hosting-codes.mjs --check # exit 1 if the committed file is stale, 2 if omx-clap-core is absent
|
|
16
|
+
* node tools/gen-hosting-codes.mjs --write # (re)write the committed file; omx-clap-core required
|
|
17
|
+
* node tools/gen-hosting-codes.mjs --build # --write when omx-clap-core is found, else keep the committed file
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
20
|
+
import { dirname, join, resolve } from 'node:path';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
import { clapCoreTsDirCandidates, findClapCoreTsDir, flattenHostingTables, loadHostingTables } from './clap-core-tsdir.mjs';
|
|
23
|
+
|
|
24
|
+
const PKG = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
25
|
+
export const OUT = join(PKG, 'src/hosting-codes.generated.ts');
|
|
26
|
+
|
|
27
|
+
/** The generated module's text for a flattened `key: code` map. */
|
|
28
|
+
export function hostingCodesFile(flat) {
|
|
29
|
+
const lines = Object.entries(flat).map(([key, code]) => ` ${JSON.stringify(key)}: ${JSON.stringify(code)},\n`);
|
|
30
|
+
return (
|
|
31
|
+
`// SPDX-License-Identifier: GPL-3.0-or-later\n` +
|
|
32
|
+
`// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>\n` +
|
|
33
|
+
`//\n` +
|
|
34
|
+
`// GENERATED by tools/gen-hosting-codes.mjs from omx-clap-core's hosting tables — do not hand-edit.\n` +
|
|
35
|
+
`//\n` +
|
|
36
|
+
`// Regenerate: node tools/gen-hosting-codes.mjs --write\n` +
|
|
37
|
+
`// Verify: node tools/gen-hosting-codes.mjs --check\n` +
|
|
38
|
+
`\n` +
|
|
39
|
+
`/** omx-clap-core's hosting codes, by key: every \`HOSTING_<DIMENSION>_CODES\` table, flattened. */\n` +
|
|
40
|
+
`export const HOSTING_CODE = Object.freeze({\n` +
|
|
41
|
+
lines.join('') +
|
|
42
|
+
`} as const);\n`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The generated module's text from the omx-clap-core modules in `dir`. */
|
|
47
|
+
export async function hostingCodesFileFrom(dir) {
|
|
48
|
+
return hostingCodesFile(flattenHostingTables(await loadHostingTables(dir)));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function absent() {
|
|
52
|
+
return (
|
|
53
|
+
`omx-clap-core's TypeScript modules were not found in any of: ${clapCoreTsDirCandidates().join(', ')}. ` +
|
|
54
|
+
'Install omx-clap-core-devel (pkg-config omx-clap-core), set OMX_CLAP_CORE_TSDIR to its tsdir, or run make -C native deps.'
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function main() {
|
|
59
|
+
const mode = process.argv[2];
|
|
60
|
+
if (!['--check', '--write', '--build'].includes(mode)) {
|
|
61
|
+
console.error('usage: node tools/gen-hosting-codes.mjs --check|--write|--build');
|
|
62
|
+
process.exit(2);
|
|
63
|
+
}
|
|
64
|
+
const dir = findClapCoreTsDir();
|
|
65
|
+
if (dir === undefined) {
|
|
66
|
+
if (mode === '--build') {
|
|
67
|
+
console.log(`gen-hosting-codes: omx-clap-core not found, keeping the committed ${OUT}`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
console.error(`gen-hosting-codes: ${absent()}`);
|
|
71
|
+
process.exit(2);
|
|
72
|
+
}
|
|
73
|
+
const content = await hostingCodesFileFrom(dir);
|
|
74
|
+
let onDisk;
|
|
75
|
+
try {
|
|
76
|
+
onDisk = readFileSync(OUT, 'utf8');
|
|
77
|
+
} catch {
|
|
78
|
+
onDisk = undefined;
|
|
79
|
+
}
|
|
80
|
+
if (mode === '--check') {
|
|
81
|
+
if (onDisk !== content) {
|
|
82
|
+
console.error(`gen-hosting-codes: ${OUT} is stale against ${dir} — run with --write`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
console.log('gen-hosting-codes: up to date');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (onDisk !== content) writeFileSync(OUT, content);
|
|
89
|
+
console.log(`gen-hosting-codes: ${onDisk === content ? 'up to date' : 'wrote'} ${OUT} from ${dir}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) await main();
|