@liiift-studio/sanity-font-manager 2.5.2 → 2.5.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.
- package/dist/UploadModal-NQZGBJAH.js +7 -0
- package/dist/UploadModal-YJCVHM63.mjs +7 -0
- package/dist/chunk-EBO3CZXG.mjs +15 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/{chunk-YMQEM4AO.js → chunk-PGSHWNGW.js} +5 -3466
- package/dist/{chunk-FT7YTFZW.mjs → chunk-WSQYNIIZ.mjs} +4 -3465
- package/dist/index.js +46 -45
- package/dist/index.mjs +3 -2
- package/dist/unbrotli-CTU3FKHW.mjs +3434 -0
- package/dist/unbrotli-NSXTNE2T.js +3434 -0
- package/package.json +1 -1
- package/src/utils/parseFont.js +12 -16
- package/dist/UploadModal-2AAJXZJK.js +0 -6
- package/dist/UploadModal-DDTVJ2MA.mjs +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liiift-studio/sanity-font-manager",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.3",
|
|
4
4
|
"description": "Sanity Studio plugin — full font management suite with batch upload, format conversion, metadata extraction, CSS generation, collection/pair generation, and script variant support. Supports Sanity v3, v4, and v5.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Liiift Studio",
|
package/src/utils/parseFont.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
// Async font parser — wraps lib-font event model in a Promise with decompressor bootstrap
|
|
2
2
|
|
|
3
|
-
import pako from 'pako';
|
|
4
|
-
|
|
5
|
-
// Set decompressor globals BEFORE lib-font is imported.
|
|
6
|
-
// lib-font reads globalThis.pako and globalThis.unbrotli at module evaluation time
|
|
7
|
-
// (top of woff.js / woff2.js), not at parse time. These must be set before lib-font
|
|
8
|
-
// is first evaluated, so we use dynamic import() below to guarantee ordering.
|
|
9
|
-
globalThis.pako = pako;
|
|
10
|
-
|
|
11
|
-
// unbrotli is a UMD that sets globalThis.unbrotli as a side effect on evaluation.
|
|
12
|
-
// We vendor it from lib-font/lib/unbrotli.js because the subpath is not in
|
|
13
|
-
// lib-font's exports map (ERR_PACKAGE_PATH_NOT_EXPORTED).
|
|
14
|
-
import '../vendor/unbrotli.js';
|
|
15
|
-
|
|
16
3
|
// Lazy-loaded lib-font Font constructor — resolved on first parseFont() call.
|
|
17
|
-
//
|
|
18
|
-
//
|
|
4
|
+
// All decompressor globals (pako for WOFF, unbrotli for WOFF2) are set dynamically
|
|
5
|
+
// inside getFont() BEFORE lib-font is imported, guaranteeing correct evaluation order
|
|
6
|
+
// regardless of how the bundler (tsup/esbuild/vite) reorders static imports.
|
|
19
7
|
let _Font = null;
|
|
20
8
|
|
|
21
|
-
/** Returns the lib-font Font constructor,
|
|
9
|
+
/** Returns the lib-font Font constructor, bootstrapping decompressors on first call */
|
|
22
10
|
async function getFont() {
|
|
23
11
|
if (!_Font) {
|
|
12
|
+
// Set pako (zlib) for WOFF decompression
|
|
13
|
+
const pako = await import('pako');
|
|
14
|
+
globalThis.pako = pako.default || pako;
|
|
15
|
+
|
|
16
|
+
// Set unbrotli for WOFF2 decompression — UMD side-effect sets globalThis.unbrotli
|
|
17
|
+
await import('../vendor/unbrotli.js');
|
|
18
|
+
|
|
19
|
+
// NOW safe to import lib-font — both globals are set
|
|
24
20
|
const mod = await import('lib-font');
|
|
25
21
|
_Font = mod.Font;
|
|
26
22
|
}
|