next-font 1.2.0 → 1.2.2-beta.0

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 (83) hide show
  1. package/LICENSE +1 -1
  2. package/dist/declaration-DT93DSPn.d.mts +16 -0
  3. package/dist/entireMetricsCollection-B27p4vNx.mjs +1 -0
  4. package/dist/font-data-DAoQ4nTq.mjs +1 -0
  5. package/dist/fontkit-DZqVarF0.mjs +3 -0
  6. package/dist/google/index.d.mts +19164 -0
  7. package/dist/google/index.mjs +1 -0
  8. package/dist/local.d.mts +24 -0
  9. package/dist/local.mjs +1 -0
  10. package/dist/manifest.d.mts +14 -0
  11. package/dist/manifest.mjs +1 -0
  12. package/dist/rolldown-EavF8sBr.mjs +80 -0
  13. package/dist/rolldown.d.mts +6 -0
  14. package/dist/rolldown.mjs +1 -0
  15. package/dist/vite.d.mts +6 -0
  16. package/dist/vite.mjs +1 -0
  17. package/package.json +44 -44
  18. package/README.md +0 -51
  19. package/dist/cc-D_YwSRId.js +0 -1
  20. package/dist/constants.d.ts +0 -3
  21. package/dist/constants.js +0 -1
  22. package/dist/fontkit.d.ts +0 -2
  23. package/dist/fontkit.js +0 -1
  24. package/dist/format-available-values.d.ts +0 -7
  25. package/dist/format-available-values.js +0 -1
  26. package/dist/google/cc-BnfmUjCg.mjs +0 -1
  27. package/dist/google/fetch-css-from-google-fonts.d.ts +0 -10
  28. package/dist/google/fetch-css-from-google-fonts.js +0 -2
  29. package/dist/google/fetch-font-file.d.ts +0 -7
  30. package/dist/google/fetch-font-file.js +0 -1
  31. package/dist/google/fetch-resource.d.ts +0 -8
  32. package/dist/google/fetch-resource.js +0 -1
  33. package/dist/google/find-font-files-in-css.d.ts +0 -11
  34. package/dist/google/find-font-files-in-css.js +0 -1
  35. package/dist/google/get-fallback-font-override-metrics.d.ts +0 -16
  36. package/dist/google/get-fallback-font-override-metrics.js +0 -1
  37. package/dist/google/get-font-axes.d.ts +0 -10
  38. package/dist/google/get-font-axes.js +0 -3
  39. package/dist/google/get-google-fonts-url.d.ts +0 -10
  40. package/dist/google/get-google-fonts-url.js +0 -1
  41. package/dist/google/get-proxy-agent.d.ts +0 -8
  42. package/dist/google/get-proxy-agent.js +0 -4
  43. package/dist/google/google-fonts-metadata.d.ts +0 -16
  44. package/dist/google/google-fonts-metadata.js +0 -1
  45. package/dist/google/index.d.ts +0 -18414
  46. package/dist/google/index.js +0 -1
  47. package/dist/google/loader.d.ts +0 -40
  48. package/dist/google/loader.js +0 -9
  49. package/dist/google/retry.d.ts +0 -5
  50. package/dist/google/retry.js +0 -3
  51. package/dist/google/sort-fonts-variant-values.d.ts +0 -7
  52. package/dist/google/sort-fonts-variant-values.js +0 -1
  53. package/dist/google/validate-google-font-function-call.d.ts +0 -18
  54. package/dist/google/validate-google-font-function-call.js +0 -9
  55. package/dist/index.d.ts +0 -38
  56. package/dist/index.js +0 -1
  57. package/dist/local/fontkit-DX1wsFnK.js +0 -1
  58. package/dist/local/get-fallback-metrics-from-font-file.d.ts +0 -21
  59. package/dist/local/get-fallback-metrics-from-font-file.js +0 -1
  60. package/dist/local/index.d.ts +0 -23
  61. package/dist/local/index.js +0 -1
  62. package/dist/local/loader.d.ts +0 -40
  63. package/dist/local/loader.js +0 -5
  64. package/dist/local/pick-font-file-for-fallback-generation.d.ts +0 -15
  65. package/dist/local/pick-font-file-for-fallback-generation.js +0 -2
  66. package/dist/local/validate-local-font-function-call.d.ts +0 -26
  67. package/dist/local/validate-local-font-function-call.js +0 -2
  68. package/dist/next-font-error.d.ts +0 -6
  69. package/dist/next-font-error.js +0 -1
  70. package/dist/types.d.ts +0 -15
  71. package/dist/types.js +0 -1
  72. package/google/index.d.ts +0 -1
  73. package/google/index.js +0 -15
  74. package/google/loader.d.ts +0 -1
  75. package/google/loader.js +0 -1
  76. package/google/target.css +0 -1
  77. package/local/index.d.ts +0 -1
  78. package/local/index.js +0 -15
  79. package/local/loader.d.ts +0 -1
  80. package/local/loader.js +0 -1
  81. package/local/target.css +0 -1
  82. package/manifest/index.d.ts +0 -36
  83. package/manifest/index.js +0 -1
@@ -1,7 +0,0 @@
1
- /**
2
- * Formats an array of values into a string that can be used error messages.
3
- * ["a", "b", "c"] => "`a`, `b`, `c`"
4
- */
5
- declare const formatAvailableValues: (values: string[]) => string;
6
-
7
- export { formatAvailableValues };
@@ -1 +0,0 @@
1
- let a=a=>a.map(a=>`\`${a}\``).join(", ");export{a as formatAvailableValues};
@@ -1 +0,0 @@
1
- var e,r={};function u(){return e||(e=1,r._=function(e){return e&&e.__esModule?e:{default:e}}),r}export{u as r};
@@ -1,10 +0,0 @@
1
- /**
2
- * Fetches the CSS containing the @font-face declarations from Google Fonts.
3
- * The fetch has a user agent header with a modern browser to ensure we'll get .woff2 files.
4
- *
5
- * The env variable NEXT_FONT_GOOGLE_MOCKED_RESPONSES may be set containing a path to mocked data.
6
- * It's used to define mocked data to avoid hitting the Google Fonts API during tests.
7
- */
8
- declare function fetchCSSFromGoogleFonts(url: string, fontFamily: string, isDev: boolean): Promise<string>;
9
-
10
- export { fetchCSSFromGoogleFonts };
@@ -1,2 +0,0 @@
1
- import{nextFontError as e}from"../next-font-error.js";import{fetchResource as o}from"./fetch-resource.js";import{retry as r}from"./retry.js";import t from"node:module";let n=t.createRequire(import.meta.url);async function s(t,s,c){if(process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES){let o=n(process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES)[t];return o||e("Missing mocked response for URL: "+t),o}return(await r(async()=>o(t,c,`Failed to fetch font \`${s}\`: ${t}
2
- Please check your network connection.`),3)).toString("utf8")}export{s as fetchCSSFromGoogleFonts};
@@ -1,7 +0,0 @@
1
- /**
2
- * Fetches a font file and returns its contents as a Buffer.
3
- * If NEXT_FONT_GOOGLE_MOCKED_RESPONSES is set, we handle mock data logic.
4
- */
5
- declare function fetchFontFile(url: string, isDev: boolean): Promise<any>;
6
-
7
- export { fetchFontFile };
@@ -1 +0,0 @@
1
- import r from"node:fs";import{retry as e}from"./retry.js";import{fetchResource as t}from"./fetch-resource.js";async function o(o,f){return process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES?o.startsWith("/")?r.readFileSync(o):Buffer.from(o):await e(async()=>t(o,f,`Failed to fetch font file from \`${o}\`.`),3)}export{o as fetchFontFile};
@@ -1,8 +0,0 @@
1
- /**
2
- * Makes a simple GET request and returns the entire response as a Buffer.
3
- * - Throws if the response status is not 200.
4
- * - Applies a 3000 ms timeout when `isDev` is `true`.
5
- */
6
- declare function fetchResource(url: string, isDev: boolean, errorMessage?: string): Promise<Buffer>;
7
-
8
- export { fetchResource };
@@ -1 +0,0 @@
1
- import e from"node:http";import t from"node:https";import{getProxyAgent as r}from"./get-proxy-agent.js";function o(o,s,n){return new Promise((a,i)=>{let{protocol:u}=new URL(o),f=s?3e3:void 0,d=("https:"===u?t:e).request(o,{agent:r(),headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"}},e=>{if(200!==e.statusCode)return void i(Error(n||`Request failed: ${o} (status: ${e.statusCode})`));let t=[];e.on("data",e=>t.push(Buffer.from(e))),e.on("end",()=>a(Buffer.concat(t)))});f&&d.setTimeout(f,()=>{d.destroy(Error(`Request timed out after ${f}ms`))}),d.on("error",e=>i(e)),d.end()})}export{o as fetchResource};
@@ -1,11 +0,0 @@
1
- /**
2
- * Find all font files in the CSS response and determine which files should be preloaded.
3
- * In Google Fonts responses, the @font-face's subset is above it in a comment.
4
- * Walk through the CSS from top to bottom, keeping track of the current subset.
5
- */
6
- declare function findFontFilesInCss(css: string, subsetsToPreload?: string[]): {
7
- googleFontFileUrl: string;
8
- preloadFontFile: boolean;
9
- }[];
10
-
11
- export { findFontFilesInCss };
@@ -1 +0,0 @@
1
- function e(e,l){let o=[],t="";for(let n of e.split("\n")){let e=/\/\* (.+?) \*\//.exec(n)?.[1];if(e)t=e;else{let e=/src: url\((.+?)\)/.exec(n)?.[1];e&&!o.some(l=>l.googleFontFileUrl===e)&&o.push({googleFontFileUrl:e,preloadFontFile:!!l?.includes(t)})}}return o}export{e as findFontFilesInCss};
@@ -1,16 +0,0 @@
1
- /**
2
- * Get precalculated fallback font metrics for the Google Fonts family.
3
- *
4
- * TODO:
5
- * We might want to calculate these values with fontkit instead (like in next/font/local).
6
- * That way we don't have to update the precalculated values every time a new font is added to Google Fonts.
7
- */
8
- declare function getFallbackFontOverrideMetrics(fontFamily: string): {
9
- fallbackFont: string;
10
- ascentOverride: string;
11
- descentOverride: string;
12
- lineGapOverride: string;
13
- sizeAdjust: string;
14
- } | undefined;
15
-
16
- export { getFallbackFontOverrideMetrics };