@anydocs/core 1.0.2 → 1.0.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-runtime-bridge.d.ts","sourceRoot":"","sources":["../../src/services/web-runtime-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"web-runtime-bridge.d.ts","sourceRoot":"","sources":["../../src/services/web-runtime-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAsD/D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnD,KAAK,iBAAiB,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,aAAa,EAAE,MAAM,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC1F,CAAC;AA0LF,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBlF;AAyDD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,wBAAwB,CAAC,CAuCnC;AAOD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CA6CvE"}
|
|
@@ -7,22 +7,29 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { ValidationError } from "../errors/validation-error.js";
|
|
8
8
|
const CORE_PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
9
|
let webRuntimeQueue = Promise.resolve();
|
|
10
|
+
const WEB_RUNTIME_ROOT_ENV = 'ANYDOCS_WEB_RUNTIME_ROOT';
|
|
10
11
|
const WEB_RUNTIME_LOCK_DIR = '.anydocs-web-runtime.lock';
|
|
11
12
|
const WEB_RUNTIME_LOCK_TIMEOUT_MS = 5 * 60000;
|
|
12
13
|
const WEB_RUNTIME_LOCK_POLL_MS = 250;
|
|
14
|
+
function isWebRuntimeRoot(candidate) {
|
|
15
|
+
return existsSync(path.join(candidate, 'scripts', 'gen-public-assets.mjs'));
|
|
16
|
+
}
|
|
13
17
|
function resolveWebPackageRoot() {
|
|
14
18
|
const cwd = process.cwd();
|
|
19
|
+
const configuredRoot = process.env[WEB_RUNTIME_ROOT_ENV]?.trim();
|
|
15
20
|
const candidates = [
|
|
21
|
+
...(configuredRoot ? [path.resolve(cwd, configuredRoot)] : []),
|
|
16
22
|
cwd,
|
|
17
23
|
path.join(cwd, 'packages', 'web'),
|
|
18
24
|
path.join(path.resolve(CORE_PACKAGE_ROOT, '../../..'), 'packages', 'web'),
|
|
25
|
+
path.resolve(CORE_PACKAGE_ROOT, '../../cli/docs-runtime'),
|
|
19
26
|
];
|
|
20
27
|
for (const candidate of candidates) {
|
|
21
|
-
if (
|
|
28
|
+
if (isWebRuntimeRoot(candidate)) {
|
|
22
29
|
return candidate;
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
throw new Error(`Unable to locate the docs web runtime. Set ${WEB_RUNTIME_ROOT_ENV} or install a CLI package that includes docs-runtime.`);
|
|
26
33
|
}
|
|
27
34
|
const BRIDGE_ENV_ALLOWLIST = new Set([
|
|
28
35
|
'CI',
|