@liiift-studio/sanity-font-manager 2.5.3 → 2.5.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/sanity-font-manager",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
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",
@@ -51,9 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "base-64": "^1.0.0",
54
- "lib-font": "^3.0.1",
55
54
  "nanoid": "^5.0.0",
56
- "pako": "^2.1.0",
57
55
  "slugify": "^1.6.6"
58
56
  },
59
57
  "peerDependencies": {
package/src/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  // Entry point for @liiift-studio/sanity-font-manager — exports all font manager components, hooks, and utilities
2
2
 
3
+ // Bootstrap decompressors FIRST — sets globalThis.pako and globalThis.unbrotli
4
+ // before lib-font can be evaluated by any bundler. This must be the first import.
5
+ import './utils/setupDecompressors.js';
6
+
3
7
  // Components
4
8
  export { BatchUploadFonts } from './components/BatchUploadFonts.jsx';
5
9
  export { GenerateCollectionsPairsComponent } from './components/GenerateCollectionsPairsComponent.jsx';
@@ -1,27 +1,8 @@
1
- // Async font parser — wraps lib-font event model in a Promise with decompressor bootstrap
1
+ // Async font parser — wraps lib-font event model in a Promise.
2
+ // Decompressor globals (pako, unbrotli) are set by setupDecompressors.js
3
+ // which is imported at the top of index.js before this module loads.
2
4
 
3
- // Lazy-loaded lib-font Font constructor resolved on first parseFont() call.
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.
7
- let _Font = null;
8
-
9
- /** Returns the lib-font Font constructor, bootstrapping decompressors on first call */
10
- async function getFont() {
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
20
- const mod = await import('lib-font');
21
- _Font = mod.Font;
22
- }
23
- return _Font;
24
- }
5
+ import { Font } from 'lib-font';
25
6
 
26
7
  /** Maximum font file size accepted for parsing (50 MB) */
27
8
  const MAX_FONT_FILE_SIZE = 50 * 1024 * 1024;
@@ -40,8 +21,6 @@ export async function parseFont(buffer, filename) {
40
21
  throw new Error(`Font file exceeds ${MAX_FONT_FILE_SIZE / 1024 / 1024}MB limit: ${filename} (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB)`);
41
22
  }
42
23
 
43
- const Font = await getFont();
44
-
45
24
  return new Promise((resolve, reject) => {
46
25
  const font = new Font('font', { skipStyleSheet: true });
47
26
  font.onload = (evt) => resolve(evt.detail.font);
@@ -0,0 +1,10 @@
1
+ // Sets up globalThis.pako and globalThis.unbrotli for lib-font WOFF/WOFF2 decompression.
2
+ // This module MUST be imported before lib-font is ever evaluated.
3
+ // It runs synchronously at module evaluation time to set the globals.
4
+
5
+ import pako from 'pako';
6
+ import '../vendor/unbrotli.js';
7
+
8
+ globalThis.pako = pako;
9
+ // unbrotli.js is a UMD that sets globalThis.unbrotli as a side effect on evaluation.
10
+ // The import above triggers that side effect.
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkPGSHWNGWjs = require('./chunk-PGSHWNGW.js');
4
- require('./chunk-MCKGQKYU.js');
5
-
6
-
7
- exports.default = _chunkPGSHWNGWjs.UploadModal;
@@ -1,7 +0,0 @@
1
- import {
2
- UploadModal
3
- } from "./chunk-WSQYNIIZ.mjs";
4
- import "./chunk-EBO3CZXG.mjs";
5
- export {
6
- UploadModal as default
7
- };
@@ -1,15 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
- var __commonJS = (cb, mod) => function __require2() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
-
12
- export {
13
- __require,
14
- __commonJS
15
- };
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
- var __commonJS = (cb, mod) => function __require2() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
-
12
-
13
-
14
-
15
- exports.__require = __require; exports.__commonJS = __commonJS;