@camstack/system 1.0.4 → 1.0.5
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/addon-runner.js +27 -1
- package/dist/addon-runner.mjs +27 -1
- package/dist/builtins/local-auth/local-auth.addon.js +5 -1518
- package/dist/builtins/local-auth/local-auth.addon.mjs +2 -1503
- package/dist/framework-resolver-hook.mjs +48 -0
- package/dist/graceful-fs-BoR9GuPS.mjs +1423 -0
- package/dist/graceful-fs-lg19SZNz.js +1434 -0
- package/dist/index.js +635 -1751
- package/dist/index.mjs +745 -1854
- package/dist/kernel/addon-installer.d.ts +20 -0
- package/dist/kernel/host-externals.d.ts +12 -0
- package/dist/kernel/index.d.ts +7 -0
- package/dist/kernel/lifecycle/framework-staging.d.ts +15 -0
- package/dist/kernel/lifecycle/job-journal.d.ts +19 -0
- package/dist/kernel/lifecycle/lifecycle-job-engine.d.ts +98 -0
- package/dist/kernel/lifecycle/staging-area.d.ts +22 -0
- package/dist/kernel/moleculer/addon-context-factory.d.ts +13 -1
- package/dist/kernel/moleculer/register-framework-resolver.d.ts +8 -0
- package/dist/{main-rtjOwPBR.mjs → main-BOG1xxwD.mjs} +2 -2
- package/dist/{main-DNnMW7Z2.js → main-B_G1JH3Q.js} +31 -31
- package/dist/{manifest-python-deps-D1DbAQEv.js → manifest-python-deps-B4BmMoGT.js} +259 -0
- package/dist/{manifest-python-deps-DZsKTbs1.mjs → manifest-python-deps-CXbKrOdk.mjs} +256 -2
- package/dist/semver-BQBSy1FJ.mjs +1504 -0
- package/dist/semver-D3n3E_fi.js +1515 -0
- package/package.json +3 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as path from 'node:path'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
3
|
+
|
|
4
|
+
// Mirror of host-externals.ts isHostExternal — kept inline because loader
|
|
5
|
+
// hooks run as raw ESM (no TS build). The host-externals.spec + this file's
|
|
6
|
+
// spec both pin the list; if they drift a test fails.
|
|
7
|
+
const HOST_EXTERNAL_SPECIFIERS = [
|
|
8
|
+
'@camstack/system',
|
|
9
|
+
'@camstack/shm-ring',
|
|
10
|
+
'@camstack/types',
|
|
11
|
+
'@camstack/sdk',
|
|
12
|
+
'zod',
|
|
13
|
+
'@trpc/server',
|
|
14
|
+
'@trpc/client',
|
|
15
|
+
// Common native deps addons genuinely import (sharp, node-av) — resolved from
|
|
16
|
+
// the framework's node_modules. better-sqlite3 is intentionally excluded: no
|
|
17
|
+
// addon imports it (only @camstack/system's hub-side sqlite-storage builtin),
|
|
18
|
+
// so a stray addon import must fail rather than be silently redirected. Keep
|
|
19
|
+
// in sync with host-externals.ts (a spec pins both).
|
|
20
|
+
'sharp',
|
|
21
|
+
'node-av',
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
function isHostExternal(specifier) {
|
|
25
|
+
for (const name of HOST_EXTERNAL_SPECIFIERS) {
|
|
26
|
+
if (specifier === name || specifier.startsWith(`${name}/`)) return true
|
|
27
|
+
}
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let anchorParentURL = null
|
|
32
|
+
|
|
33
|
+
// Receives { frameworkDir } via module.register(..., { data }). Computes the
|
|
34
|
+
// anchor file URL inside frameworkDir/node_modules so nextResolve walks up from
|
|
35
|
+
// there and finds @camstack/* via standard package resolution (honors exports).
|
|
36
|
+
export function initialize(data) {
|
|
37
|
+
const frameworkDir = data && typeof data.frameworkDir === 'string' ? data.frameworkDir : null
|
|
38
|
+
anchorParentURL = frameworkDir
|
|
39
|
+
? pathToFileURL(path.join(frameworkDir, 'node_modules', '__camstack_resolver_anchor__.js')).href
|
|
40
|
+
: null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
44
|
+
if (anchorParentURL && isHostExternal(specifier)) {
|
|
45
|
+
return nextResolve(specifier, { ...context, parentURL: anchorParentURL })
|
|
46
|
+
}
|
|
47
|
+
return nextResolve(specifier, context)
|
|
48
|
+
}
|