next-font 1.2.0 → 1.2.1
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/README.md +12 -8
- package/dist/chunk-9UNmgxP_.js +1 -0
- package/dist/constants.js +1 -1
- package/dist/declarations-D084A7_6.d.ts +39 -0
- package/dist/fontkit.d.ts +2 -2
- package/dist/fontkit.js +3 -1
- package/dist/format-available-values.js +1 -1
- package/dist/get-fallback-font-override-metrics-u23t231H.js +1 -0
- package/dist/google/fetch-css-from-google-fonts.js +1 -2
- package/dist/google/fetch-font-file.js +1 -1
- package/dist/google/fetch-resource.js +1 -1
- package/dist/google/find-font-files-in-css.js +2 -1
- package/dist/google/get-fallback-font-override-metrics.js +1 -1
- package/dist/google/get-font-axes.js +1 -3
- package/dist/google/get-google-fonts-url.js +1 -1
- package/dist/google/get-proxy-agent.js +13 -4
- package/dist/google/google-fonts-metadata.js +1 -1
- package/dist/google/index.js +1 -1
- package/dist/google/loader.d.ts +4 -38
- package/dist/google/loader.js +8 -9
- package/dist/google/retry.js +1 -3
- package/dist/google/sort-fonts-variant-values.js +1 -1
- package/dist/google/validate-google-font-function-call.js +1 -9
- package/dist/google-fonts-metadata-uXngxjL5.js +1 -0
- package/dist/index.d.ts +2 -38
- package/dist/index.js +1 -1
- package/dist/local/get-fallback-metrics-from-font-file.js +1 -1
- package/dist/local/index.js +1 -1
- package/dist/local/loader.d.ts +4 -38
- package/dist/local/loader.js +3 -5
- package/dist/local/pick-font-file-for-fallback-generation.js +1 -2
- package/dist/local/validate-local-font-function-call.js +1 -2
- package/dist/next-font-error.js +1 -1
- package/dist/types.js +1 -1
- package/dist/utils-Vxow00oE.js +1 -0
- package/google/index.d.ts +1 -1
- package/google/index.js +2 -2
- package/google/loader.d.ts +1 -1
- package/google/loader.js +1 -1
- package/local/index.d.ts +1 -1
- package/local/index.js +2 -2
- package/local/loader.d.ts +1 -1
- package/local/loader.js +1 -1
- package/manifest/index.d.ts +17 -15
- package/manifest/index.js +3 -1
- package/package.json +27 -28
- package/LICENSE +0 -11
- package/dist/cc-D_YwSRId.js +0 -1
- package/dist/constants.d.ts +0 -3
- package/dist/format-available-values.d.ts +0 -7
- package/dist/google/cc-BnfmUjCg.mjs +0 -1
- package/dist/google/fetch-css-from-google-fonts.d.ts +0 -10
- package/dist/google/fetch-font-file.d.ts +0 -7
- package/dist/google/fetch-resource.d.ts +0 -8
- package/dist/google/find-font-files-in-css.d.ts +0 -11
- package/dist/google/get-fallback-font-override-metrics.d.ts +0 -16
- package/dist/google/get-font-axes.d.ts +0 -10
- package/dist/google/get-google-fonts-url.d.ts +0 -10
- package/dist/google/get-proxy-agent.d.ts +0 -8
- package/dist/google/google-fonts-metadata.d.ts +0 -16
- package/dist/google/index.d.ts +0 -18414
- package/dist/google/retry.d.ts +0 -5
- package/dist/google/sort-fonts-variant-values.d.ts +0 -7
- package/dist/google/validate-google-font-function-call.d.ts +0 -18
- package/dist/local/fontkit-DX1wsFnK.js +0 -1
- package/dist/local/get-fallback-metrics-from-font-file.d.ts +0 -21
- package/dist/local/index.d.ts +0 -23
- package/dist/local/pick-font-file-for-fallback-generation.d.ts +0 -15
- package/dist/local/validate-local-font-function-call.d.ts +0 -26
- package/dist/next-font-error.d.ts +0 -6
- package/dist/types.d.ts +0 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
variableName: string;
|
|
4
|
-
data: any[];
|
|
5
|
-
emitFontFile: (content: Buffer, ext: string, preload: boolean, isUsingSizeAdjust?: boolean) => string;
|
|
6
|
-
resolve: (src: string) => string;
|
|
7
|
-
isDev: boolean;
|
|
8
|
-
isServer: boolean;
|
|
9
|
-
loaderContext: any;
|
|
10
|
-
}, 'loaderContext'> & {
|
|
11
|
-
loaderContext: {
|
|
12
|
-
fs?: {
|
|
13
|
-
readFile: (...args: any[]) => Promise<Buffer | Uint8Array | string>;
|
|
14
|
-
};
|
|
15
|
-
error: (message: string) => any;
|
|
16
|
-
};
|
|
17
|
-
cache?: {
|
|
18
|
-
css?: Map<string, string | null>;
|
|
19
|
-
font?: Map<string, string | null>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
type FontLoader = (options: FontLoaderOptions) => Promise<{
|
|
23
|
-
css: string;
|
|
24
|
-
fallbackFonts?: string[];
|
|
25
|
-
variable?: string;
|
|
26
|
-
adjustFontFallback?: AdjustFontFallback;
|
|
27
|
-
weight?: string;
|
|
28
|
-
style?: string;
|
|
29
|
-
}>;
|
|
30
|
-
type AdjustFontFallback = {
|
|
31
|
-
fallbackFont: string;
|
|
32
|
-
ascentOverride?: string;
|
|
33
|
-
descentOverride?: string;
|
|
34
|
-
lineGapOverride?: string;
|
|
35
|
-
sizeAdjust?: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type { AdjustFontFallback, FontLoader };
|
|
1
|
+
import { n as FontLoader, t as AdjustFontFallback } from "./declarations-D084A7_6.js";
|
|
2
|
+
export { type AdjustFontFallback, type FontLoader };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e={name:`Arial`,azAvgWidth:934.5116279069767,unitsPerEm:2048},t={name:`Times New Roman`,azAvgWidth:854.3953488372093,unitsPerEm:2048};function n(e){try{let t=`aaabcdeeeefghiijklmnnoopqrrssttuvwxyz `;if(!e.glyphsForString(t).flatMap(e=>e.codePoints).every(t=>e.hasGlyphForCodePoint(t)))return;let n=e.glyphsForString(t).map(e=>e.advanceWidth);return n.reduce((e,t)=>e+t,0)/n.length}catch{return}}function r(e){return Math.abs(e*100).toFixed(2)+`%`}function i(i,a=`serif`){let o=a===`serif`?t:e,s=n(i),{ascent:c,descent:l,lineGap:u,unitsPerEm:d}=i,f=o.azAvgWidth/o.unitsPerEm,p=s?s/d/f:1;return{ascentOverride:r(c/(d*p)),descentOverride:r(l/(d*p)),lineGapOverride:r(u/(d*p)),fallbackFont:o.name,sizeAdjust:r(p)}}export{i as getFallbackMetricsFromFontFile};
|
package/dist/local/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e){throw Error()}export{e as default};
|
package/dist/local/loader.d.ts
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
functionName: string;
|
|
3
|
-
variableName: string;
|
|
4
|
-
data: any[];
|
|
5
|
-
emitFontFile: (content: Buffer, ext: string, preload: boolean, isUsingSizeAdjust?: boolean) => string;
|
|
6
|
-
resolve: (src: string) => string;
|
|
7
|
-
isDev: boolean;
|
|
8
|
-
isServer: boolean;
|
|
9
|
-
loaderContext: any;
|
|
10
|
-
}, 'loaderContext'> & {
|
|
11
|
-
loaderContext: {
|
|
12
|
-
fs?: {
|
|
13
|
-
readFile: (...args: any[]) => Promise<Buffer | Uint8Array | string>;
|
|
14
|
-
};
|
|
15
|
-
error: (message: string) => any;
|
|
16
|
-
};
|
|
17
|
-
cache?: {
|
|
18
|
-
css?: Map<string, string | null>;
|
|
19
|
-
font?: Map<string, string | null>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
type FontLoader = (options: FontLoaderOptions) => Promise<{
|
|
23
|
-
css: string;
|
|
24
|
-
fallbackFonts?: string[];
|
|
25
|
-
variable?: string;
|
|
26
|
-
adjustFontFallback?: AdjustFontFallback;
|
|
27
|
-
weight?: string;
|
|
28
|
-
style?: string;
|
|
29
|
-
}>;
|
|
30
|
-
type AdjustFontFallback = {
|
|
31
|
-
fallbackFont: string;
|
|
32
|
-
ascentOverride?: string;
|
|
33
|
-
descentOverride?: string;
|
|
34
|
-
lineGapOverride?: string;
|
|
35
|
-
sizeAdjust?: string;
|
|
36
|
-
};
|
|
1
|
+
import { n as FontLoader } from "../declarations-D084A7_6.js";
|
|
37
2
|
|
|
3
|
+
//#region src/local/loader.d.ts
|
|
38
4
|
declare const loader: FontLoader;
|
|
39
|
-
|
|
40
|
-
export { loader as default };
|
|
5
|
+
//#endregion
|
|
6
|
+
export { loader as default };
|
package/dist/local/loader.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import t from"node:fs/promises";import{validateLocalFontFunctionCall as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
`,fontMetadata:c,weight:o,style:a}}));if(!1!==y){let{pickFontFileForFallbackGeneration:t}=await l(),e=t(k);if(e.fontMetadata){let{getFallbackMetricsFromFontFile:t}=await o();c=t(e.fontMetadata,"Times New Roman"===y?"serif":"sans-serif")}}return{css:k.map(({css:t})=>t).join("\n"),fallbackFonts:h,weight:1===d.length?d[0].weight:void 0,style:1===d.length?d[0].style:void 0,variable:w,adjustFontFallback:c}};export{i as default};
|
|
1
|
+
import{t as e}from"../utils-Vxow00oE.js";import t from"node:fs/promises";import{validateLocalFontFunctionCall as n}from"./validate-local-font-function-call.js";const r=e(()=>import(`./get-fallback-metrics-from-font-file.js`).then(e=>e.default||e)),i=e(()=>import(`./pick-font-file-for-fallback-generation.js`).then(e=>e.default||e)),a=e(()=>import(`../fontkit.js`).then(e=>e.default||e)),o=async({functionName:e,variableName:o,data:s,emitFontFile:c,resolve:l,loaderContext:u})=>{let{src:d,display:f,fallback:p,preload:m,variable:h,adjustFontFallback:g,declarations:_,weight:v,style:y}=n(e,s[0]),b=await Promise.all(d.map(async({path:e,style:n,weight:r,ext:i,format:s})=>{let d=l(e),p=Buffer.from(await(u.fs??t).readFile(d)),h=c(p,i,m,g===void 0||!!g),b=await a(),x;try{x=b(p)}catch(e){console.error(`Failed to load font file: ${d}\n${e}`)}let S=_?.some(({prop:e})=>e===`font-family`);return{css:`@font-face {\n${[..._?_.map(({prop:e,value:t})=>[e,t]):[],...S?[]:[[`font-family`,o]],[`src`,`url(${h}) format('${s}')`],[`font-display`,f],...r??v?[[`font-weight`,r??v]]:[],...n??y?[[`font-style`,n??y]]:[]].map(([e,t])=>`${e}: ${t};`).join(`
|
|
2
|
+
`)}\n}\n`,fontMetadata:x,weight:r,style:n}})),x;if(g!==!1){let{pickFontFileForFallbackGeneration:e}=await i(),t=e(b);if(t.fontMetadata){let{getFallbackMetricsFromFontFile:e}=await r();x=e(t.fontMetadata,g===`Times New Roman`?`serif`:`sans-serif`)}}return{css:b.map(({css:e})=>e).join(`
|
|
3
|
+
`),fallbackFonts:p,weight:d.length===1?d[0].weight:void 0,style:d.length===1?d[0].style:void 0,variable:h,adjustFontFallback:x}};export{o as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{nextFontError as
|
|
2
|
-
Expected \`normal\`, \`bold\` or a number.`),!a)return n-400;if(n<=400&&a>=400)return 0;let i=n-400,o=a-400;return Math.abs(i)<Math.abs(o)?i:o}function n(r){return r.reduce((r,t)=>{if(!r)return t;let n=e(r.weight),a=e(t.weight);if(n===a&&(void 0===t.style||"normal"===t.style))return t;let i=Math.abs(n),o=Math.abs(a);return o<i||i===o&&a<n?t:r})}export{n as pickFontFileForFallbackGeneration};
|
|
1
|
+
import{nextFontError as e}from"../next-font-error.js";function t(e){return e===`normal`?400:e===`bold`?700:Number(e)}function n(n){if(!n)return 0;let[r,i]=n.trim().split(/ +/).map(t);if((Number.isNaN(r)||Number.isNaN(i))&&e(`Invalid weight value in src array: \`${n}\`.\nExpected \`normal\`, \`bold\` or a number.`),!i)return r-400;if(r<=400&&i>=400)return 0;let a=r-400,o=i-400;return Math.abs(a)<Math.abs(o)?a:o}function r(e){return e.reduce((e,t)=>{if(!e)return t;let r=n(e.weight),i=n(t.weight);if(r===i&&(t.style===void 0||t.style===`normal`))return t;let a=Math.abs(r),o=Math.abs(i);return o<a||a===o&&i<r?t:e})}export{r as pickFontFileForFallbackGeneration};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Available display values: ${e(t)}`),n||o("Missing required `src` property"),Array.isArray(n)?0===n.length&&o("Unexpected empty `src` array."):n=[{path:n,weight:l,style:i}],n=n.map(t=>{let e=/\.(woff|woff2|eot|ttf|otf)$/.exec(t.path)?.[1];return e||o(`Unexpected file \`${t.path}\``),{...t,ext:e,format:r[e]}}),Array.isArray(m)&&m.forEach(t=>{["src","font-display","font-weight","font-style"].includes(t?.prop)&&o(`Invalid declaration prop: \`${t.prop}\``)}),{src:n,display:p,weight:l,style:i,fallback:s,preload:d,variable:c,adjustFontFallback:y,declarations:m}}export{a as validateLocalFontFunctionCall};
|
|
1
|
+
import{formatAvailableValues as e}from"../format-available-values.js";import{allowedDisplayValues as t}from"../constants.js";import{nextFontError as n}from"../next-font-error.js";const r={woff:`woff`,woff2:`woff2`,ttf:`truetype`,otf:`opentype`,eot:`embedded-opentype`};function i(i,a){i&&n(`next-font/local has no named exports`);let{src:o,display:s=`swap`,weight:c,style:l,fallback:u,preload:d=!0,variable:f,adjustFontFallback:p,declarations:m}=a||{};return t.includes(s)||n(`Invalid display value \`${s}\`.\nAvailable display values: ${e(t)}`),o||n("Missing required `src` property"),Array.isArray(o)?o.length===0&&n("Unexpected empty `src` array."):o=[{path:o,weight:c,style:l}],o=o.map(e=>{let t=/\.(woff|woff2|eot|ttf|otf)$/.exec(e.path)?.[1];return t||n(`Unexpected file \`${e.path}\``),{...e,ext:t,format:r[t]}}),Array.isArray(m)&&m.forEach(e=>{[`src`,`font-display`,`font-weight`,`font-style`].includes(e?.prop)&&n(`Invalid declaration prop: \`${e.prop}\``)}),{src:o,display:s,weight:c,style:l,fallback:u,preload:d,variable:f,adjustFontFallback:p,declarations:m}}export{i as validateLocalFontFunctionCall};
|
package/dist/next-font-error.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e){let t=Error(e);throw t.name=`NextFontError`,t}export{e as nextFontError};
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{let t;return()=>(t||=e().then(e=>(t=e,e)),t)},t=/[|\\{}()[\]^$+*?.-]/,n=/[|\\{}()[\]^$+*?.-]/g,r=e=>t.test(e)?e.replace(n,`\\$&`):e;export{r as n,e as t};
|
package/google/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../dist/google'
|
|
1
|
+
export * from '../dist/google';
|
package/google/index.js
CHANGED
|
@@ -4,7 +4,7 @@ if (semver.lt(require('next/package.json').version, '13.0.0')) {
|
|
|
4
4
|
throw new Error('`@next/font` is only available in Next.js 13 and newer.')
|
|
5
5
|
}*/
|
|
6
6
|
|
|
7
|
-
const message = 'next-font/google failed to run or is incorrectly configured.'
|
|
7
|
+
const message = 'next-font/google failed to run or is incorrectly configured.';
|
|
8
8
|
/*if (process.env.NODE_ENV === 'development') {
|
|
9
9
|
message +=
|
|
10
10
|
'\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
|
|
@@ -12,4 +12,4 @@ const message = 'next-font/google failed to run or is incorrectly configured.'
|
|
|
12
12
|
|
|
13
13
|
message += `\n\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts`*/
|
|
14
14
|
|
|
15
|
-
throw new Error(message)
|
|
15
|
+
throw new Error(message);
|
package/google/loader.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../dist/google/loader'
|
|
1
|
+
export { default } from '../dist/google/loader';
|
package/google/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../dist/google/loader.js'
|
|
1
|
+
export { default } from '../dist/google/loader.js';
|
package/local/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../dist/local/index'
|
|
1
|
+
export { default } from '../dist/local/index';
|
package/local/index.js
CHANGED
|
@@ -4,7 +4,7 @@ if (semver.lt(require('next/package.json').version, '13.0.0')) {
|
|
|
4
4
|
throw new Error('`@next/font` is only available in Next.js 13 and newer.')
|
|
5
5
|
}*/
|
|
6
6
|
|
|
7
|
-
const message = 'next-font/local failed to run or is incorrectly configured.'
|
|
7
|
+
const message = 'next-font/local failed to run or is incorrectly configured.';
|
|
8
8
|
/*if (process.env.NODE_ENV === 'development') {
|
|
9
9
|
message +=
|
|
10
10
|
'\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
|
|
@@ -12,4 +12,4 @@ const message = 'next-font/local failed to run or is incorrectly configured.'
|
|
|
12
12
|
|
|
13
13
|
message += `\n\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts`*/
|
|
14
14
|
|
|
15
|
-
throw new Error(message)
|
|
15
|
+
throw new Error(message);
|
package/local/loader.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../dist/local/loader'
|
|
1
|
+
export { default } from '../dist/local/loader';
|
package/local/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../dist/local/loader.js'
|
|
1
|
+
export { default } from '../dist/local/loader.js';
|
package/manifest/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export type NextFontManifest = Readonly<
|
|
2
2
|
Record<string, string[]> & {
|
|
3
|
-
isUsingSizeAdjust: boolean
|
|
3
|
+
isUsingSizeAdjust: boolean;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
>;
|
|
6
6
|
|
|
7
|
-
export declare const manifest: NextFontManifest
|
|
7
|
+
export declare const manifest: NextFontManifest;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Get hrefs for fonts to preload
|
|
@@ -13,24 +13,26 @@ export declare const manifest: NextFontManifest
|
|
|
13
13
|
* Returns empty string[] if there are fonts but none to preload and no other fonts have been preloaded
|
|
14
14
|
* Returns null if there are fonts but none to preload and at least some were previously preloaded
|
|
15
15
|
*/
|
|
16
|
-
export declare const getPreloadableFonts: (
|
|
16
|
+
export declare const getPreloadableFonts: (
|
|
17
|
+
filePath?: string,
|
|
18
|
+
) => string[] | null;
|
|
17
19
|
|
|
18
20
|
export declare const getFontMetadata: (filePath?: string) => {
|
|
19
21
|
preconnect: {
|
|
20
|
-
href: string
|
|
21
|
-
type: string
|
|
22
|
-
crossOrigin?: string
|
|
23
|
-
nonce?: string
|
|
24
|
-
}[]
|
|
22
|
+
href: string;
|
|
23
|
+
type: string;
|
|
24
|
+
crossOrigin?: string;
|
|
25
|
+
nonce?: string;
|
|
26
|
+
}[];
|
|
25
27
|
preload: {
|
|
26
|
-
href: string
|
|
27
|
-
crossOrigin?: string
|
|
28
|
-
nonce?: string
|
|
29
|
-
}[]
|
|
30
|
-
}
|
|
28
|
+
href: string;
|
|
29
|
+
crossOrigin?: string;
|
|
30
|
+
nonce?: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
31
33
|
|
|
32
34
|
export default {
|
|
33
35
|
manifest,
|
|
34
36
|
getPreloadableFonts,
|
|
35
37
|
getFontMetadata,
|
|
36
|
-
}
|
|
38
|
+
};
|
package/manifest/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-font",
|
|
3
|
+
"version": "1.2.1",
|
|
3
4
|
"description": "@next/font (next/font) replacement",
|
|
4
|
-
"version": "1.2.0",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/kijv/next-font.git",
|
|
9
|
+
"directory": "packages/next-font"
|
|
10
|
+
},
|
|
6
11
|
"files": [
|
|
7
12
|
"dist",
|
|
8
13
|
"google",
|
|
@@ -14,52 +19,46 @@
|
|
|
14
19
|
"types": "./dist/index.d.ts",
|
|
15
20
|
"exports": {
|
|
16
21
|
"./google": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
22
|
+
"types": "./google/index.d.ts",
|
|
23
|
+
"import": "./google/index.js"
|
|
19
24
|
},
|
|
20
25
|
"./local": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
26
|
+
"types": "./local/index.d.ts",
|
|
27
|
+
"import": "./local/index.js"
|
|
23
28
|
},
|
|
24
29
|
"./google/loader": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
30
|
+
"types": "./google/loader.d.ts",
|
|
31
|
+
"import": "./google/loader.js"
|
|
27
32
|
},
|
|
28
33
|
"./local/loader": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
34
|
+
"types": "./local/loader.d.ts",
|
|
35
|
+
"import": "./local/loader.js"
|
|
31
36
|
},
|
|
32
37
|
"./google/target.css": "./google/target.css",
|
|
33
38
|
"./local/target.css": "./local/target.css",
|
|
34
39
|
"./manifest": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
40
|
+
"types": "./manifest/index.d.ts",
|
|
41
|
+
"import": "./manifest/index.js"
|
|
37
42
|
},
|
|
38
43
|
"./dist/*": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
44
|
+
"types": "./dist/*.d.ts",
|
|
45
|
+
"import": "./dist/*.js"
|
|
41
46
|
},
|
|
42
47
|
".": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"import": "./dist/index.js"
|
|
45
50
|
}
|
|
46
51
|
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
47
55
|
"scripts": {
|
|
48
|
-
"build": "bun run
|
|
49
|
-
"clean": "bun run ./scripts/clean-dist.ts",
|
|
50
|
-
"build-next-font": "bun run ./scripts/build-next-font.ts",
|
|
51
|
-
"build-src": "bun run ./scripts/build-src.ts"
|
|
56
|
+
"build": "bun run ./scripts/build"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
59
|
"@types/fontkit": "^2.0.8",
|
|
55
|
-
"fontkit": "^2.0.4"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"access": "public"
|
|
59
|
-
},
|
|
60
|
-
"repository": {
|
|
61
|
-
"type": "git",
|
|
62
|
-
"url": "git+https://github.com/kijv/next-font.git",
|
|
63
|
-
"directory": "packages/next-font"
|
|
60
|
+
"fontkit": "^2.0.4",
|
|
61
|
+
"next": "^16.1.6",
|
|
62
|
+
"next-repo": "git://github.com/vercel/next.js#adf8c612adddd103647c90ff0f511ea35c57076e"
|
|
64
63
|
}
|
|
65
64
|
}
|
package/LICENSE
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
BSD 2-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025, kijv
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
6
|
-
|
|
7
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
8
|
-
|
|
9
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/dist/cc-D_YwSRId.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t,r,n){var o,c=arguments.length,f=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(f=(c<3?o(f):c>3?o(t,r,f):o(t,r))||f);return c>3&&f&&Object.defineProperty(t,r,f),f}export{t as _,e as a};
|
package/dist/constants.d.ts
DELETED
|
@@ -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,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,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,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 };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates and gets the data for each font axis required to generate the Google Fonts URL.
|
|
3
|
-
*/
|
|
4
|
-
declare function getFontAxes(fontFamily: string, weights: string[], styles: string[], selectedVariableAxes?: string[]): {
|
|
5
|
-
wght?: string[];
|
|
6
|
-
ital?: string[];
|
|
7
|
-
variableAxes?: [string, string][];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { getFontAxes };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate the Google Fonts URL given the requested weight(s), style(s) and additional variable axes
|
|
3
|
-
*/
|
|
4
|
-
declare function getGoogleFontsUrl(fontFamily: string, axes: {
|
|
5
|
-
wght?: string[];
|
|
6
|
-
ital?: string[];
|
|
7
|
-
variableAxes?: [string, string][];
|
|
8
|
-
}, display: string): string;
|
|
9
|
-
|
|
10
|
-
export { getGoogleFontsUrl };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type GoogleFontsMetadata = {
|
|
2
|
-
[fontFamily: string]: {
|
|
3
|
-
weights: string[];
|
|
4
|
-
styles: string[];
|
|
5
|
-
subsets: string[];
|
|
6
|
-
axes?: Array<{
|
|
7
|
-
tag: string;
|
|
8
|
-
min: number;
|
|
9
|
-
max: number;
|
|
10
|
-
defaultValue: number;
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
declare const googleFontsMetadata: GoogleFontsMetadata;
|
|
15
|
-
|
|
16
|
-
export { googleFontsMetadata };
|