expo-font 56.0.4 → 56.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/android/build.gradle +2 -2
  3. package/build/ExpoFontLoader.web.d.ts.map +1 -1
  4. package/build/ExpoFontLoader.web.js +5 -1
  5. package/build/ExpoFontLoader.web.js.map +1 -1
  6. package/expo-module.config.json +1 -1
  7. package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.module → 56.0.5/expo.modules.font-56.0.5.module} +7 -7
  8. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.md5 +1 -0
  9. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha1 +1 -0
  10. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha256 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.module.sha512 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.pom → 56.0.5/expo.modules.font-56.0.5.pom} +1 -1
  13. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.md5 +1 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha1 +1 -0
  15. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha256 +1 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.5/expo.modules.font-56.0.5.pom.sha512 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml +4 -4
  18. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.md5 +1 -1
  19. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha1 +1 -1
  20. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha256 +1 -1
  21. package/local-maven-repo/host/exp/exponent/expo.modules.font/maven-metadata.xml.sha512 +1 -1
  22. package/package.json +3 -3
  23. package/plugin/build/withFontsAndroid.js +1 -1
  24. package/plugin/src/withFontsAndroid.ts +1 -1
  25. package/prebuilds/output/debug/xcframeworks/ExpoFont.tar.gz +0 -0
  26. package/prebuilds/output/release/xcframeworks/ExpoFont.tar.gz +0 -0
  27. package/src/ExpoFontLoader.web.ts +9 -3
  28. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.module.md5 +0 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.module.sha1 +0 -1
  30. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.module.sha256 +0 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.module.sha512 +0 -1
  32. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.pom.md5 +0 -1
  33. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.pom.sha1 +0 -1
  34. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.pom.sha256 +0 -1
  35. package/local-maven-repo/host/exp/exponent/expo.modules.font/56.0.4/expo.modules.font-56.0.4.pom.sha512 +0 -1
  36. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4-sources.jar → 56.0.5/expo.modules.font-56.0.5-sources.jar} +0 -0
  37. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4-sources.jar.md5 → 56.0.5/expo.modules.font-56.0.5-sources.jar.md5} +0 -0
  38. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4-sources.jar.sha1 → 56.0.5/expo.modules.font-56.0.5-sources.jar.sha1} +0 -0
  39. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4-sources.jar.sha256 → 56.0.5/expo.modules.font-56.0.5-sources.jar.sha256} +0 -0
  40. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4-sources.jar.sha512 → 56.0.5/expo.modules.font-56.0.5-sources.jar.sha512} +0 -0
  41. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.aar → 56.0.5/expo.modules.font-56.0.5.aar} +0 -0
  42. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.aar.md5 → 56.0.5/expo.modules.font-56.0.5.aar.md5} +0 -0
  43. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.aar.sha1 → 56.0.5/expo.modules.font-56.0.5.aar.sha1} +0 -0
  44. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.aar.sha256 → 56.0.5/expo.modules.font-56.0.5.aar.sha256} +0 -0
  45. /package/local-maven-repo/host/exp/exponent/expo.modules.font/{56.0.4/expo.modules.font-56.0.4.aar.sha512 → 56.0.5/expo.modules.font-56.0.5.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 56.0.5 — 2026-05-19
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Sanitize values in web font loader and Android config plugin ([#45887](https://github.com/expo/expo/pull/45887) by [@kitten](https://github.com/kitten))
18
+
13
19
  ## 56.0.4 — 2026-05-15
14
20
 
15
21
  ### 🐛 Bug fixes
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '56.0.4'
7
+ version = '56.0.5'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.font"
11
11
  defaultConfig {
12
12
  versionCode 29
13
- versionName "56.0.4"
13
+ versionName "56.0.5"
14
14
  }
15
15
  }
16
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFontLoader.web.d.ts","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAe,KAAK,YAAY,EAAqC,MAAM,cAAc,CAAC;AAsEjG,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,oBAAoB,CA0GlD,CAAC;wBAcyB,OAAO,cAAc;AAAhD,wBAAiD;AAejD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAIzF"}
1
+ {"version":3,"file":"ExpoFontLoader.web.d.ts","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAe,KAAK,YAAY,EAAqC,MAAM,cAAc,CAAC;AAsEjG,QAAA,MAAM,cAAc,EAAE,QAAQ,CAAC,oBAAoB,CA0GlD,CAAC;wBAcyB,OAAO,cAAc;AAAhD,wBAAiD;AAiBjD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAQzF"}
@@ -165,8 +165,12 @@ function getStyleElement() {
165
165
  styleElement.id = ID;
166
166
  return styleElement;
167
167
  }
168
+ const CSS_IDENT_RE = /^[a-zA-Z_-][\w-]*$/;
168
169
  export function _createWebFontTemplate(fontFamily, resource) {
169
- return `@font-face{font-family:"${fontFamily}";src:url("${resource.uri}");font-display:${resource.display || FontDisplay.AUTO}}`;
170
+ const display = typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)
171
+ ? resource.display
172
+ : FontDisplay.AUTO;
173
+ return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(resource.uri)});font-display:${display}}`;
170
174
  }
171
175
  function _createWebStyle(fontFamily, resource) {
172
176
  const fontStyle = _createWebFontTemplate(fontFamily, resource);
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoFontLoader.web.js","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAwD,MAAM,cAAc,CAAC;AAEjG,SAAS,qBAAqB;IAC5B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;IACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,UAAU,CAAC,KAAuB,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAID,SAAS,gBAAgB;IACvB,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;IACtC,IAAI,KAAK,EAAE,CAAC;QACV,4BAA4B;QAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAElC,MAAM,KAAK,GAAe,EAAE,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;gBACpC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,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AED,SAAS,8BAA8B;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IACvC,2EAA2E;IAC3E,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5E,iGAAiG;IACjG,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,oBAAoB;IACpB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["import { CodedError, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport type { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport type { UnloadFontOptions } from './Font';\nimport { FontDisplay, type FontResource, type ServerFontResourceDescriptor } from './Font.types';\n\nfunction getFontFaceStyleSheet(): CSSStyleSheet | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const styleSheet = getStyleElement();\n return styleSheet.sheet ? (styleSheet.sheet as CSSStyleSheet) : null;\n}\n\ntype RuleItem = { rule: CSSFontFaceRule; index: number };\n\nfunction getFontFaceRules(): RuleItem[] {\n const sheet = getFontFaceStyleSheet();\n if (sheet) {\n // @ts-ignore: rule iterator\n const rules = [...sheet.cssRules];\n\n const items: RuleItem[] = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule instanceof CSSFontFaceRule) {\n items.push({ rule, index: i });\n }\n }\n return items;\n }\n return [];\n}\n\nfunction getFontFaceRulesMatchingResource(\n fontFamilyName: string,\n options?: UnloadFontOptions\n): RuleItem[] {\n const rules = getFontFaceRules();\n return rules.filter(({ rule }) => {\n return (\n rule.style.fontFamily === fontFamilyName &&\n (options && options.display ? options.display === (rule.style as any).fontDisplay : true)\n );\n });\n}\n\nconst serverContext: Set<{ name: string; css: string; resourceId: string }> = new Set();\n\nfunction getServerResourceDescriptors(): ServerFontResourceDescriptor[] {\n const entries = [...serverContext.entries()];\n if (!entries.length) {\n return [];\n }\n const css = entries.map(([{ css }]) => css).join('\\n');\n const links = entries.map(([{ resourceId }]) => resourceId);\n // TODO: Maybe return nothing if no fonts were loaded.\n return [\n {\n css,\n id: ID,\n type: 'style' as const,\n },\n ...links.map((resourceId) => ({\n as: 'font' as const,\n crossOrigin: '' as const,\n href: resourceId,\n rel: 'preload' as const,\n type: 'link' as const,\n })),\n ];\n}\n\nconst ExpoFontLoader: Required<ExpoFontLoaderModule> = {\n async unloadAllAsync(): Promise<void> {\n if (typeof window === 'undefined') return;\n\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n document.removeChild(element);\n }\n },\n\n async unloadAsync(fontFamilyName: string, options?: UnloadFontOptions): Promise<void> {\n const sheet = getFontFaceStyleSheet();\n if (!sheet) return;\n const items = getFontFaceRulesMatchingResource(fontFamilyName, options);\n for (const item of items) {\n sheet.deleteRule(item.index);\n }\n },\n\n getServerResources(): string[] {\n const elements = getServerResourceDescriptors();\n\n return elements\n .map((element) => {\n switch (element.type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.css}</style>`;\n case 'link':\n return `<link rel=\"${element.rel}\" href=\"${element.href}\" as=\"${element.as}\" crossorigin=\"${element.crossOrigin}\" />`;\n default:\n return '';\n }\n })\n .filter(Boolean);\n },\n\n getServerResourceDescriptors() {\n return getServerResourceDescriptors();\n },\n\n resetServerContext() {\n serverContext.clear();\n },\n\n getLoadedFonts(): string[] {\n if (typeof window === 'undefined') {\n return [...serverContext.values()].map(({ name }) => name);\n }\n const rules = getFontFaceRules();\n return rules.map(({ rule }) => rule.style.fontFamily);\n },\n\n isLoaded(fontFamilyName: string, resource: UnloadFontOptions = {}): boolean {\n if (typeof window === 'undefined') {\n return !![...serverContext.values()].find((asset) => {\n return asset.name === fontFamilyName;\n });\n }\n return getFontFaceRulesMatchingResource(fontFamilyName, resource)?.length > 0;\n },\n\n // NOTE(vonovak): This is used in RN vector-icons to load fonts dynamically on web. Changing the signature is breaking.\n // NOTE(EvanBacon): No async keyword! This cannot return a promise in Node environments.\n loadAsync(fontFamilyName: string, resource: FontResource): Promise<void> {\n if (__DEV__ && typeof resource !== 'object') {\n // to help devving on web, where loadAsync interface is different from native\n throw new CodedError(\n 'ERR_FONT_SOURCE',\n `Expected font resource of type \\`object\\` instead got: ${typeof resource}`\n );\n }\n if (typeof window === 'undefined') {\n serverContext.add({\n name: fontFamilyName,\n css: _createWebFontTemplate(fontFamilyName, resource),\n // @ts-expect-error: typeof string\n resourceId: resource.uri!,\n });\n return Promise.resolve();\n }\n\n const canInjectStyle = document.head && typeof document.head.appendChild === 'function';\n if (!canInjectStyle) {\n throw new CodedError(\n 'ERR_WEB_ENVIRONMENT',\n `The browser's \\`document.head\\` element doesn't support injecting fonts.`\n );\n }\n\n const style = getStyleElement();\n document.head!.appendChild(style);\n\n const res = getFontFaceRulesMatchingResource(fontFamilyName, resource);\n if (!res.length) {\n _createWebStyle(fontFamilyName, resource);\n }\n\n if (!isFontLoadingListenerSupported()) {\n return Promise.resolve();\n }\n\n return new FontObserver(fontFamilyName, {\n // @ts-expect-error: TODO(@kitten): Typings indicate that the polyfill may not support this?\n display: resource.display,\n }).load(resource.testString ?? null, 12000);\n },\n};\n\nconst isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';\n\nfunction createExpoFontLoader() {\n return ExpoFontLoader;\n}\nconst toExport = isServer\n ? ExpoFontLoader\n : // @ts-expect-error: registerWebModule calls `new` on the module implementation.\n // Normally that'd be a class but that doesn't work on server, so we use a function instead.\n // TS doesn't like that but we don't need it to be a class.\n registerWebModule(createExpoFontLoader, 'ExpoFontLoader');\n\nexport default toExport as typeof ExpoFontLoader;\n\nconst ID = 'expo-generated-fonts';\n\nfunction getStyleElement(): HTMLStyleElement {\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n return element;\n }\n const styleElement = document.createElement('style');\n styleElement.id = ID;\n\n return styleElement;\n}\n\nexport function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {\n return `@font-face{font-family:\"${fontFamily}\";src:url(\"${resource.uri}\");font-display:${\n resource.display || FontDisplay.AUTO\n }}`;\n}\n\nfunction _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {\n const fontStyle = _createWebFontTemplate(fontFamily, resource);\n\n const styleElement = getStyleElement();\n // @ts-ignore: TypeScript does not define HTMLStyleElement::styleSheet. This is just for IE and\n // possibly can be removed if it's unnecessary on IE 11.\n if (styleElement.styleSheet) {\n const styleElementIE = styleElement as any;\n styleElementIE.styleSheet.cssText = styleElementIE.styleSheet.cssText\n ? styleElementIE.styleSheet.cssText + fontStyle\n : fontStyle;\n } else {\n const textNode = document.createTextNode(fontStyle);\n styleElement.appendChild(textNode);\n }\n return styleElement;\n}\n\nfunction isFontLoadingListenerSupported(): boolean {\n const { userAgent } = window.navigator;\n // WebKit is broken https://github.com/bramstein/fontfaceobserver/issues/95\n const isIOS = !!userAgent.match(/iPad|iPhone/i);\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n // Edge is broken https://github.com/bramstein/fontfaceobserver/issues/109#issuecomment-333356795\n const isEdge = userAgent.includes('Edge');\n // Internet Explorer\n const isIE = userAgent.includes('Trident');\n return !isSafari && !isIOS && !isEdge && !isIE;\n}\n"]}
1
+ {"version":3,"file":"ExpoFontLoader.web.js","sourceRoot":"","sources":["../src/ExpoFontLoader.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAwD,MAAM,cAAc,CAAC;AAEjG,SAAS,qBAAqB;IAC5B,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AC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5E,iGAAiG;IACjG,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,oBAAoB;IACpB,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["import { CodedError, registerWebModule } from 'expo-modules-core';\nimport FontObserver from 'fontfaceobserver';\n\nimport type { ExpoFontLoaderModule } from './ExpoFontLoader';\nimport type { UnloadFontOptions } from './Font';\nimport { FontDisplay, type FontResource, type ServerFontResourceDescriptor } from './Font.types';\n\nfunction getFontFaceStyleSheet(): CSSStyleSheet | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const styleSheet = getStyleElement();\n return styleSheet.sheet ? (styleSheet.sheet as CSSStyleSheet) : null;\n}\n\ntype RuleItem = { rule: CSSFontFaceRule; index: number };\n\nfunction getFontFaceRules(): RuleItem[] {\n const sheet = getFontFaceStyleSheet();\n if (sheet) {\n // @ts-ignore: rule iterator\n const rules = [...sheet.cssRules];\n\n const items: RuleItem[] = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule instanceof CSSFontFaceRule) {\n items.push({ rule, index: i });\n }\n }\n return items;\n }\n return [];\n}\n\nfunction getFontFaceRulesMatchingResource(\n fontFamilyName: string,\n options?: UnloadFontOptions\n): RuleItem[] {\n const rules = getFontFaceRules();\n return rules.filter(({ rule }) => {\n return (\n rule.style.fontFamily === fontFamilyName &&\n (options && options.display ? options.display === (rule.style as any).fontDisplay : true)\n );\n });\n}\n\nconst serverContext: Set<{ name: string; css: string; resourceId: string }> = new Set();\n\nfunction getServerResourceDescriptors(): ServerFontResourceDescriptor[] {\n const entries = [...serverContext.entries()];\n if (!entries.length) {\n return [];\n }\n const css = entries.map(([{ css }]) => css).join('\\n');\n const links = entries.map(([{ resourceId }]) => resourceId);\n // TODO: Maybe return nothing if no fonts were loaded.\n return [\n {\n css,\n id: ID,\n type: 'style' as const,\n },\n ...links.map((resourceId) => ({\n as: 'font' as const,\n crossOrigin: '' as const,\n href: resourceId,\n rel: 'preload' as const,\n type: 'link' as const,\n })),\n ];\n}\n\nconst ExpoFontLoader: Required<ExpoFontLoaderModule> = {\n async unloadAllAsync(): Promise<void> {\n if (typeof window === 'undefined') return;\n\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n document.removeChild(element);\n }\n },\n\n async unloadAsync(fontFamilyName: string, options?: UnloadFontOptions): Promise<void> {\n const sheet = getFontFaceStyleSheet();\n if (!sheet) return;\n const items = getFontFaceRulesMatchingResource(fontFamilyName, options);\n for (const item of items) {\n sheet.deleteRule(item.index);\n }\n },\n\n getServerResources(): string[] {\n const elements = getServerResourceDescriptors();\n\n return elements\n .map((element) => {\n switch (element.type) {\n case 'style':\n return `<style id=\"${element.id}\">${element.css}</style>`;\n case 'link':\n return `<link rel=\"${element.rel}\" href=\"${element.href}\" as=\"${element.as}\" crossorigin=\"${element.crossOrigin}\" />`;\n default:\n return '';\n }\n })\n .filter(Boolean);\n },\n\n getServerResourceDescriptors() {\n return getServerResourceDescriptors();\n },\n\n resetServerContext() {\n serverContext.clear();\n },\n\n getLoadedFonts(): string[] {\n if (typeof window === 'undefined') {\n return [...serverContext.values()].map(({ name }) => name);\n }\n const rules = getFontFaceRules();\n return rules.map(({ rule }) => rule.style.fontFamily);\n },\n\n isLoaded(fontFamilyName: string, resource: UnloadFontOptions = {}): boolean {\n if (typeof window === 'undefined') {\n return !![...serverContext.values()].find((asset) => {\n return asset.name === fontFamilyName;\n });\n }\n return getFontFaceRulesMatchingResource(fontFamilyName, resource)?.length > 0;\n },\n\n // NOTE(vonovak): This is used in RN vector-icons to load fonts dynamically on web. Changing the signature is breaking.\n // NOTE(EvanBacon): No async keyword! This cannot return a promise in Node environments.\n loadAsync(fontFamilyName: string, resource: FontResource): Promise<void> {\n if (__DEV__ && typeof resource !== 'object') {\n // to help devving on web, where loadAsync interface is different from native\n throw new CodedError(\n 'ERR_FONT_SOURCE',\n `Expected font resource of type \\`object\\` instead got: ${typeof resource}`\n );\n }\n if (typeof window === 'undefined') {\n serverContext.add({\n name: fontFamilyName,\n css: _createWebFontTemplate(fontFamilyName, resource),\n // @ts-expect-error: typeof string\n resourceId: resource.uri!,\n });\n return Promise.resolve();\n }\n\n const canInjectStyle = document.head && typeof document.head.appendChild === 'function';\n if (!canInjectStyle) {\n throw new CodedError(\n 'ERR_WEB_ENVIRONMENT',\n `The browser's \\`document.head\\` element doesn't support injecting fonts.`\n );\n }\n\n const style = getStyleElement();\n document.head!.appendChild(style);\n\n const res = getFontFaceRulesMatchingResource(fontFamilyName, resource);\n if (!res.length) {\n _createWebStyle(fontFamilyName, resource);\n }\n\n if (!isFontLoadingListenerSupported()) {\n return Promise.resolve();\n }\n\n return new FontObserver(fontFamilyName, {\n // @ts-expect-error: TODO(@kitten): Typings indicate that the polyfill may not support this?\n display: resource.display,\n }).load(resource.testString ?? null, 12000);\n },\n};\n\nconst isServer = process.env.EXPO_OS === 'web' && typeof window === 'undefined';\n\nfunction createExpoFontLoader() {\n return ExpoFontLoader;\n}\nconst toExport = isServer\n ? ExpoFontLoader\n : // @ts-expect-error: registerWebModule calls `new` on the module implementation.\n // Normally that'd be a class but that doesn't work on server, so we use a function instead.\n // TS doesn't like that but we don't need it to be a class.\n registerWebModule(createExpoFontLoader, 'ExpoFontLoader');\n\nexport default toExport as typeof ExpoFontLoader;\n\nconst ID = 'expo-generated-fonts';\n\nfunction getStyleElement(): HTMLStyleElement {\n const element = document.getElementById(ID);\n if (element && element instanceof HTMLStyleElement) {\n return element;\n }\n const styleElement = document.createElement('style');\n styleElement.id = ID;\n\n return styleElement;\n}\n\nconst CSS_IDENT_RE = /^[a-zA-Z_-][\\w-]*$/;\n\nexport function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {\n const display =\n typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)\n ? resource.display\n : FontDisplay.AUTO;\n return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(\n resource.uri\n )});font-display:${display}}`;\n}\n\nfunction _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {\n const fontStyle = _createWebFontTemplate(fontFamily, resource);\n\n const styleElement = getStyleElement();\n // @ts-ignore: TypeScript does not define HTMLStyleElement::styleSheet. This is just for IE and\n // possibly can be removed if it's unnecessary on IE 11.\n if (styleElement.styleSheet) {\n const styleElementIE = styleElement as any;\n styleElementIE.styleSheet.cssText = styleElementIE.styleSheet.cssText\n ? styleElementIE.styleSheet.cssText + fontStyle\n : fontStyle;\n } else {\n const textNode = document.createTextNode(fontStyle);\n styleElement.appendChild(textNode);\n }\n return styleElement;\n}\n\nfunction isFontLoadingListenerSupported(): boolean {\n const { userAgent } = window.navigator;\n // WebKit is broken https://github.com/bramstein/fontfaceobserver/issues/95\n const isIOS = !!userAgent.match(/iPad|iPhone/i);\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n // Edge is broken https://github.com/bramstein/fontfaceobserver/issues/109#issuecomment-333356795\n const isEdge = userAgent.includes('Edge');\n // Internet Explorer\n const isIE = userAgent.includes('Trident');\n return !isSafari && !isIOS && !isEdge && !isIE;\n}\n"]}
@@ -8,7 +8,7 @@
8
8
  "publication": {
9
9
  "groupId": "host.exp.exponent",
10
10
  "artifactId": "expo.modules.font",
11
- "version": "56.0.4",
11
+ "version": "56.0.5",
12
12
  "repository": "local-maven-repo"
13
13
  }
14
14
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.font",
6
- "version": "56.0.4",
6
+ "version": "56.0.5",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.font-56.0.4.aar",
28
- "url": "expo.modules.font-56.0.4.aar",
27
+ "name": "expo.modules.font-56.0.5.aar",
28
+ "url": "expo.modules.font-56.0.5.aar",
29
29
  "size": 29409,
30
30
  "sha512": "27cd5270fb4a9e9c93cecfde8eb7521dea8ba1d6ff2523d2512ecdafa7a58b68c5c1e07c331f3c6bc16af18f8289d55bd01ace60feca7af8aaa2f6e9f3b487e1",
31
31
  "sha256": "d7ea73905f045bfec5b9c40172b9b29f327d7a80a0bf05389d12966d157a1430",
@@ -71,8 +71,8 @@
71
71
  ],
72
72
  "files": [
73
73
  {
74
- "name": "expo.modules.font-56.0.4.aar",
75
- "url": "expo.modules.font-56.0.4.aar",
74
+ "name": "expo.modules.font-56.0.5.aar",
75
+ "url": "expo.modules.font-56.0.5.aar",
76
76
  "size": 29409,
77
77
  "sha512": "27cd5270fb4a9e9c93cecfde8eb7521dea8ba1d6ff2523d2512ecdafa7a58b68c5c1e07c331f3c6bc16af18f8289d55bd01ace60feca7af8aaa2f6e9f3b487e1",
78
78
  "sha256": "d7ea73905f045bfec5b9c40172b9b29f327d7a80a0bf05389d12966d157a1430",
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "files": [
93
93
  {
94
- "name": "expo.modules.font-56.0.4-sources.jar",
95
- "url": "expo.modules.font-56.0.4-sources.jar",
94
+ "name": "expo.modules.font-56.0.5-sources.jar",
95
+ "url": "expo.modules.font-56.0.5-sources.jar",
96
96
  "size": 4135,
97
97
  "sha512": "99aeb8a7c324e889d4140890af18771545c97a69e128bf6a3fb2e70f3ddde11ec292c4d8e3b6470f0c7d0db50db21b782e1382767807899c9b1faf4552f0d41d",
98
98
  "sha256": "87a25fe7ac775341198279e739706b7594f5a863da55f215422209e737e5562f",
@@ -0,0 +1 @@
1
+ 852aee4a5076e83ca2a9fd6ef8f7e77f1fa0da727ba6d4e52de1445f7e87acc4
@@ -0,0 +1 @@
1
+ 134928d04fbb971bfe94310d7efffea17de3df27aa3305f9f421823874b2b44b83e9af869fff002c57ff0a1b5f4e5c9c27f97c4934bc06cdde3e7d80ab1f8dfd
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.font</artifactId>
12
- <version>56.0.4</version>
12
+ <version>56.0.5</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.font</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 1b51c324da92ee60f1827239c1061b896d09d44f
@@ -0,0 +1 @@
1
+ be4a9b40b90c536f9f695e06164c2f1280f8bd2973c8027a815e3ae6ae5f6da3
@@ -0,0 +1 @@
1
+ 920cc244cf00cc45711304ca1ab4000478937362e30189e72fe965f70bb3560ee50d12aa3b590f842d12adea4c407c5947612c489cd50d8f30849b2ec30e3c7a
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.font</artifactId>
5
5
  <versioning>
6
- <latest>56.0.4</latest>
7
- <release>56.0.4</release>
6
+ <latest>56.0.5</latest>
7
+ <release>56.0.5</release>
8
8
  <versions>
9
- <version>56.0.4</version>
9
+ <version>56.0.5</version>
10
10
  </versions>
11
- <lastUpdated>20260515152444</lastUpdated>
11
+ <lastUpdated>20260519105305</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 5e39a8b0c524a52e2ec8515f5b20afa3
1
+ 331c1994f4958bd2a937a5d3c1572b55
@@ -1 +1 @@
1
- 67f7b70cdf525a7ab9d3fbb6c14fcd5e7e983f4f
1
+ 3ae7b1be88a8ef248b9ce306c251c934d35368df
@@ -1 +1 @@
1
- 8cd0167804de4baa0bb101cf6a2e51963b52e60e5855993c192a444fb132968d
1
+ 5c7661b6631139856c42e6b5da33b5e94be99f4069700b276f955b7756f7f18f
@@ -1 +1 @@
1
- 4bdaf91c53e9562eef07eb01a3018997facfdfe40ee2fd43e6839f79d53ac863eb26f48739a4ccc21e1467bf80185555378f00a40bd68626ca165795f5338264
1
+ 946a300aa3126f3bbd7d058dc298a93b9a1fddba29f3ad75d34067aac62cd819a0db902e64d9b8aecc9e1b162ee171698d5a3ed00cbc97b66eeef8f0cb80dede
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-font",
3
- "version": "56.0.4",
3
+ "version": "56.0.5",
4
4
  "description": "Load fonts at runtime and use them in React Native components.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "@types/fontfaceobserver": "^2.1.3",
44
44
  "@types/node": "^22.14.0",
45
45
  "@types/react": "~19.2.0",
46
- "expo": "56.0.0-preview.12",
46
+ "expo": "56.0.0-preview.13",
47
47
  "expo-module-scripts": "56.0.2"
48
48
  },
49
49
  "peerDependencies": {
@@ -51,7 +51,7 @@
51
51
  "react": "*",
52
52
  "react-native": "*"
53
53
  },
54
- "gitHead": "f26be3dd9396bf7c399a1d607865d0fabdbc0d64",
54
+ "gitHead": "290368bc41026449a05a4ebf991b85c3a2fb0e3a",
55
55
  "scripts": {
56
56
  "build": "expo-module build",
57
57
  "clean": "expo-module clean",
@@ -106,7 +106,7 @@ function addFontXmlToMainApplication(config, xmlFontObjects) {
106
106
  function generateFontManagerCalls(xmlFontObjects, language) {
107
107
  const lineEnding = language === 'java' ? ';' : '';
108
108
  const indent = ' ';
109
- return Object.keys(xmlFontObjects).map((family) => `${indent}ReactFontManager.getInstance().addCustomFont(this, "${family}", R.font.${resourceNameConflictAvoidancePrefix + (0, utils_1.toValidAndroidResourceName)(family)})${lineEnding}`);
109
+ return Object.keys(xmlFontObjects).map((family) => `${indent}ReactFontManager.getInstance().addCustomFont(this, ${JSON.stringify(family)}, R.font.${resourceNameConflictAvoidancePrefix + (0, utils_1.toValidAndroidResourceName)(family)})${lineEnding}`);
110
110
  }
111
111
  function copyFontsToDir(config, paths, inAppDestination, filenameProcessor = (filenameWithExt) => filenameWithExt) {
112
112
  return (0, config_plugins_1.withDangerousMod)(config, [
@@ -145,7 +145,7 @@ export function generateFontManagerCalls(
145
145
 
146
146
  return Object.keys(xmlFontObjects).map(
147
147
  (family) =>
148
- `${indent}ReactFontManager.getInstance().addCustomFont(this, "${family}", R.font.${resourceNameConflictAvoidancePrefix + toValidAndroidResourceName(family)})${lineEnding}`
148
+ `${indent}ReactFontManager.getInstance().addCustomFont(this, ${JSON.stringify(family)}, R.font.${resourceNameConflictAvoidancePrefix + toValidAndroidResourceName(family)})${lineEnding}`
149
149
  );
150
150
  }
151
151
 
@@ -208,10 +208,16 @@ function getStyleElement(): HTMLStyleElement {
208
208
  return styleElement;
209
209
  }
210
210
 
211
+ const CSS_IDENT_RE = /^[a-zA-Z_-][\w-]*$/;
212
+
211
213
  export function _createWebFontTemplate(fontFamily: string, resource: FontResource): string {
212
- return `@font-face{font-family:"${fontFamily}";src:url("${resource.uri}");font-display:${
213
- resource.display || FontDisplay.AUTO
214
- }}`;
214
+ const display =
215
+ typeof resource.display === 'string' && CSS_IDENT_RE.test(resource.display)
216
+ ? resource.display
217
+ : FontDisplay.AUTO;
218
+ return `@font-face{font-family:${JSON.stringify(fontFamily)};src:url(${JSON.stringify(
219
+ resource.uri
220
+ )});font-display:${display}}`;
215
221
  }
216
222
 
217
223
  function _createWebStyle(fontFamily: string, resource: FontResource): HTMLStyleElement {
@@ -1 +0,0 @@
1
- 1dfc5fb385517ede4aa1ba17530db85fde8dfedf
@@ -1 +0,0 @@
1
- 4ce4005a7e29c90f3a6283a303149a24d03d914ca9febc5a8d904790b58b0262
@@ -1 +0,0 @@
1
- ead4bce47fddab8b5b9ebb609dd309c88662f64173248a23949560fae7c21c26bc2425dd4ae1d8ac3e8b9b44182941061ce04862b1654c34f3a0b11d58336445
@@ -1 +0,0 @@
1
- e15121a19155c4b4fd5da942afbae31f772ac6ad
@@ -1 +0,0 @@
1
- 8c02a712006489c8f8f44308286c6801602d897fa0698a753fb229172eb57c32
@@ -1 +0,0 @@
1
- cd246147bec7b12833455aab64d1661746b8e0072160364b24b5d1102ce3d8f64047a933bfbc423ad8163c893c3feffde1e7cd04a5b3fd4dd1983232836c5c96