@newhighsco/press-start 2.8.3 → 2.9.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newhighsco/press-start",
3
3
  "description": "Chipset + Next.js site starter by New High Score",
4
- "version": "2.8.3",
4
+ "version": "2.9.0",
5
5
  "author": "New High Score",
6
6
  "license": "ISC",
7
7
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "src"
18
18
  ],
19
19
  "dependencies": {
20
- "@newhighsco/chipset": "7.2.3",
20
+ "@newhighsco/chipset": "7.4.0",
21
21
  "next-seo": "6.8.0"
22
22
  },
23
23
  "peerDependencies": {
@@ -11,6 +11,17 @@ import { DefaultSeo } from 'next-seo'
11
11
  import { func, object } from 'prop-types'
12
12
  import React from 'react'
13
13
 
14
+ const preloadFonts = ({ urls }) =>
15
+ urls
16
+ ?.split(',')
17
+ .map(href => ({
18
+ rel: 'preload',
19
+ href,
20
+ as: 'font',
21
+ type: `font/${href.split('.').at(-1)}`,
22
+ crossOrigin: 'anonymous'
23
+ }))
24
+
14
25
  const renderImage = ({ priority, fetchPriority, loading, ...rest }) => (
15
26
  <Image
16
27
  fetchPriority={priority ? 'high' : fetchPriority}
@@ -21,7 +32,7 @@ const renderImage = ({ priority, fetchPriority, loading, ...rest }) => (
21
32
 
22
33
  const renderLink = props => <Link {...props} />
23
34
 
24
- const AppPage = ({ Component, pageProps, theme, config, meta }) => {
35
+ const AppPage = ({ Component, pageProps, theme, config, meta, fonts = {} }) => {
25
36
  const {
26
37
  name,
27
38
  titleTemplate = name => `%s | ${name}`,
@@ -55,7 +66,8 @@ const AppPage = ({ Component, pageProps, theme, config, meta }) => {
55
66
  additionalLinkTags: [
56
67
  ...(meta?.additionalLinkTags || []),
57
68
  icon && { rel: 'icon', href: icon },
58
- { rel: 'sitemap', type: 'application/xml', href: '/sitemap.xml' }
69
+ { rel: 'sitemap', type: 'application/xml', href: '/sitemap.xml' },
70
+ ...(preloadFonts(fonts) || [])
59
71
  ].filter(Boolean)
60
72
  }
61
73
 
@@ -78,7 +90,8 @@ AppPage.propTypes = {
78
90
  pageProps: object,
79
91
  theme: object,
80
92
  config: object,
81
- meta: object
93
+ meta: object,
94
+ fonts: object
82
95
  }
83
96
 
84
97
  export default AppPage