fix(discord): journal.mjs takes BINDING_NAME from errors.mjs, not binding.mjs (#1873)
The journal label import pulled binding.mjs and its config readers into every journal.mjs importer. The queue test repo copies only journal.mjs and errors.mjs, so its genesis failed with ERR_MODULE_NOT_FOUND (webui reads.test.mjs red, 4 tests). BINDING_NAME now lives in errors.mjs and binding.mjs re-exports it, so its export is unchanged.
This commit is contained in:
1 parent
809b1b0100
commit
c3fe6b77ad
3 files changed
+7
-4
No files matched your search
@@ -24,12 +24,12 @@ import { loadWebConfig } from "./web.mjs";
|
|||||||
import { loadSetsparkConfig } from "./setspark.mjs";
|
import { loadSetsparkConfig } from "./setspark.mjs";
|
||||||
import { basename, isAbsolute, join, resolve, sep } from "node:path";
|
import { basename, isAbsolute, join, resolve, sep } from "node:path";
|
||||||
import { homedir } from "node:os";
|
import { homedir } from "node:os";
|
||||||
import { DiscordError, plainKey, quietRead } from "./errors.mjs";
|
import { BINDING_NAME, DiscordError, plainKey, quietRead } from "./errors.mjs";
|
||||||
import { TOOL_DEFAULTS } from "./tools.mjs";
|
import { TOOL_DEFAULTS } from "./tools.mjs";
|
||||||
import { loadGitConfig } from "./git.mjs";
|
import { loadGitConfig } from "./git.mjs";
|
||||||
|
|
||||||
export const BINDING_VERSION = 1;
|
export const BINDING_VERSION = 1;
|
||||||
export const BINDING_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
export { BINDING_NAME };
|
||||||
export const SNOWFLAKE = /^[0-9]{17,20}$/;
|
export const SNOWFLAKE = /^[0-9]{17,20}$/;
|
||||||
export const CHANNEL_MODES = Object.freeze(["open", "mention"]);
|
export const CHANNEL_MODES = Object.freeze(["open", "mention"]);
|
||||||
export const THINKING_LEVELS = Object.freeze(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
export const THINKING_LEVELS = Object.freeze(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
// A refusal that names an unknown key quotes it only when it is a plain name;
|
// A refusal that names an unknown key quotes it only when it is a plain name;
|
||||||
// a key that could carry a host path or a secret is described, never echoed (#1873).
|
// a key that could carry a host path or a secret is described, never echoed (#1873).
|
||||||
export const plainKey = (k) => (/^[A-Za-z_][A-Za-z0-9_-]{0,63}$/.test(String(k)) ? JSON.stringify(k) : "that is not a plain name");
|
export const plainKey = (k) => (/^[A-Za-z_][A-Za-z0-9_-]{0,63}$/.test(String(k)) ? JSON.stringify(k) : "that is not a plain name");
|
||||||
|
// A binding (and seat) name. Defined here, not in binding.mjs, so journal.mjs can label a
|
||||||
|
// journal directory without importing binding.mjs and its config readers; copies of
|
||||||
|
// journal.mjs + errors.mjs (the queue test repo) stay self-contained. binding.mjs re-exports it.
|
||||||
|
export const BINDING_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/;
|
||||||
|
|
||||||
// A read that fails names the file by label and the error code, never the
|
// A read that fails names the file by label and the error code, never the
|
||||||
// path Node puts in the message. The same error object is rethrown, so its
|
// path Node puts in the message. The same error object is rethrown, so its
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ import {
|
|||||||
unlinkSync, writeFileSync, writeSync,
|
unlinkSync, writeFileSync, writeSync,
|
||||||
} from "node:fs";
|
} from "node:fs";
|
||||||
import { basename, join } from "node:path";
|
import { basename, join } from "node:path";
|
||||||
import { DiscordError, quietRead } from "./errors.mjs";
|
import { BINDING_NAME, DiscordError, quietRead } from "./errors.mjs";
|
||||||
import { BINDING_NAME } from "./binding.mjs";
|
|
||||||
|
|
||||||
// Where a refusal says a binding's journal is: its place under the data root
|
// Where a refusal says a binding's journal is: its place under the data root
|
||||||
// when the directory carries a valid binding name (bindingDataDir() makes it
|
// when the directory carries a valid binding name (bindingDataDir() makes it
|
||||||
|
|||||||
Reference in new issue
Block a user