Socket
Socket
Sign inDemoInstall

@next/font

Package Overview
Dependencies
Maintainers
5
Versions
1033
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@next/font - npm Package Compare versions

Comparing version 12.3.2-canary.12 to 12.3.2-canary.13

17

dist/google/loader.js

@@ -63,8 +63,15 @@ "use strict";

// Add fallback font
let adjustFontFallbackMetrics;
if (adjustFontFallback) {
try {
updatedCssResponse += (0, font_utils_1.calculateOverrideCSS)(fontFamily, require('next/dist/server/google-font-metrics.json'));
const { ascent, descent, lineGap, fallbackFont } = (0, font_utils_1.calculateOverrideValues)(fontFamily, require('next/dist/server/google-font-metrics.json'));
adjustFontFallbackMetrics = {
fallbackFont,
ascentOverride: ascent,
descentOverride: descent,
lineGapOverride: lineGap,
};
}
catch (e) {
console.log('Error getting font override values - ', e);
catch {
console.error(`Failed to find font override values for font \`${fontFamily}\``);
}

@@ -75,4 +82,8 @@ }

fallbackFonts: fallback,
weight: weight === 'variable' ? undefined : weight,
style,
variable: `--next-font-${fontFamily.toLowerCase().replace(/ /g, '-')}${weight !== 'variable' ? `-${weight}` : ''}${style === 'italic' ? `-italic` : ''}`,
adjustFontFallback: adjustFontFallbackMetrics,
};
};
exports.default = downloadGoogleFonts;

8

dist/local/index.d.ts

@@ -1,2 +0,2 @@

import type { FontModule } from 'next/font';
import type { AdjustFontFallback, FontModule } from 'next/font';
declare type Display = 'auto' | 'block' | 'swap' | 'fallback' | 'optional';

@@ -13,4 +13,3 @@ declare type LocalFont = {

preload?: boolean;
ascentOverride?: string;
descentOverride?: string;
variable?: string;
fontStretch?: string;

@@ -20,6 +19,9 @@ fontVariant?: string;

fontVariationSettings?: string;
ascentOverride?: string;
descentOverride?: string;
lineGapOverride?: string;
sizeAdjust?: string;
adjustFontFallback?: AdjustFontFallback;
};
export default function localFont(options: LocalFont): FontModule;
export {};

@@ -6,3 +6,3 @@ "use strict";

const fetchFonts = async ({ functionName, data, emitFontFile, resolve, fs, }) => {
const { family, files, display, weight, style, fallback, preload, ascentOverride, descentOverride, lineGapOverride, fontStretch, fontFeatureSettings, sizeAdjust, } = (0, utils_1.validateData)(functionName, data);
const { family, files, display, weight, style, fallback, preload, variable, ascentOverride, descentOverride, lineGapOverride, fontStretch, fontFeatureSettings, sizeAdjust, adjustFontFallback, } = (0, utils_1.validateData)(functionName, data);
const fontFaces = await Promise.all(files.map(async ({ file, ext, format, unicodeRange }) => {

@@ -37,4 +37,8 @@ const resolved = await resolve(file);

fallbackFonts: fallback,
weight,
style,
variable,
adjustFontFallback,
};
};
exports.default = fetchFonts;

@@ -0,1 +1,2 @@

import { AdjustFontFallback } from 'next/font';
declare type FontOptions = {

@@ -14,2 +15,3 @@ family: string;

preload: boolean;
variable?: string;
ascentOverride?: string;

@@ -23,4 +25,5 @@ descentOverride?: string;

sizeAdjust?: string;
adjustFontFallback?: AdjustFontFallback;
};
export declare function validateData(functionName: string, data: any): FontOptions;
export {};

@@ -17,3 +17,3 @@ "use strict";

}
let { src, display = 'optional', weight, style, fallback, preload = true, ascentOverride, descentOverride, fontStretch, fontVariant, fontFeatureSettings, fontVariationSettings, lineGapOverride, sizeAdjust, } = data[0] || {};
let { src, display = 'optional', weight, style, fallback, preload = true, variable, ascentOverride, descentOverride, fontStretch, fontVariant, fontFeatureSettings, fontVariationSettings, lineGapOverride, sizeAdjust, adjustFontFallback, } = data[0] || {};
if (!allowedDisplayValues.includes(display)) {

@@ -54,2 +54,3 @@ throw new Error(`Invalid display value \`${display}\`.\nAvailable display values: ${formatValues(allowedDisplayValues)}`);

preload,
variable,
ascentOverride,

@@ -63,4 +64,5 @@ descentOverride,

sizeAdjust,
adjustFontFallback,
};
}
exports.validateData = validateData;
{
"name": "@next/font",
"version": "12.3.2-canary.12",
"version": "12.3.2-canary.13",
"repository": {

@@ -5,0 +5,0 @@ "url": "vercel/next.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc