@lincyaw/kernel 1.0.0-rc.16 → 1.0.0-rc.18
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/package.json +1 -1
- package/src/node/fonts.ts +6 -3
package/package.json
CHANGED
package/src/node/fonts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs'
|
|
1
|
+
import { readFileSync, realpathSync } from 'node:fs'
|
|
2
2
|
import { createRequire, findPackageJSON } from 'node:module'
|
|
3
3
|
|
|
4
4
|
export const FONT_LICENSE = 'presmium/fonts/LICENSE'
|
|
@@ -10,8 +10,11 @@ const FONT_COPYRIGHTS: Record<string, string> = {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function fontLicense(from: string | URL): string {
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
13
|
+
const found = findPackageJSON('@lincyaw/host', from)
|
|
14
|
+
if (!found) throw new Error('@lincyaw/host is not installed')
|
|
15
|
+
// findPackageJSON keeps the symlinked path; the fonts are host's own dependencies, which an isolated store (pnpm's
|
|
16
|
+
// global store) puts beside the real package, so they are resolved from there.
|
|
17
|
+
const manifest = realpathSync(found)
|
|
15
18
|
const { dependencies = {} } = JSON.parse(readFileSync(manifest, 'utf8')) as { dependencies?: Record<string, string> }
|
|
16
19
|
const require = createRequire(manifest)
|
|
17
20
|
const files = Object.keys(dependencies).filter(name => name.startsWith('@fontsource/')).sort().map((name) => {
|