Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 403ed74

Browse files
authored
Merge pull request #131 from GrabarzUndPartner/release
Release
2 parents ca56384 + 10b1cef commit 403ed74

File tree

8 files changed

+1190
-888
lines changed

8 files changed

+1190
-888
lines changed

Diff for: .branchlintrc

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
{
22
"branchNameLinter": {
3-
"prefixes": ["feature", "hotfix", "release"],
3+
"prefixes": [
4+
"feature",
5+
"hotfix",
6+
"release",
7+
"renovate"
8+
],
49
"suggestions": {
510
"features": "feature",
611
"feat": "feature",
712
"fix": "hotfix",
813
"releases": "release"
914
},
10-
"banned": ["wip"],
11-
"skip": ["skip-ci"],
12-
"disallowed": ["master", "develop", "staging"],
15+
"banned": [
16+
"wip"
17+
],
18+
"skip": [
19+
"skip-ci"
20+
],
21+
"disallowed": [
22+
"master",
23+
"develop",
24+
"staging"
25+
],
1326
"seperator": "/",
1427
"msgBranchBanned": "Branches with the name \"%s\" are not allowed.",
1528
"msgBranchDisallowed": "Pushing to \"%s\" is not allowed, use git-flow.",
1629
"msgPrefixNotAllowed": "Branch prefix \"%s\" is not allowed.",
1730
"msgPrefixSuggestion": "Instead of \"%s\" try \"%s\".",
1831
"msgSeperatorRequired": "Branch \"%s\" must contain a seperator \"%s\"."
1932
}
20-
}
33+
}

Diff for: lib/module.js

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ function addTemplates (moduleScope, fonts, options) {
7171
fonts
7272
}
7373
})
74+
moduleScope.addTemplate({
75+
src: resolve(__dirname, 'utils/index.js'),
76+
fileName: 'nuxt-font-loader-strategy/utils/index.js',
77+
options: { }
78+
})
7479
moduleScope.addTemplate({
7580
src: resolve(__dirname, 'utils/fontFace.js'),
7681
fileName: 'nuxt-font-loader-strategy/utils/fontFace.js',

Diff for: lib/utils/fontFace.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { extname } from 'path'
22
import { paramCase, snakeCase } from 'change-case'
3+
import { arrayFlat } from './index'
34

45
// Font-Face
56

@@ -35,7 +36,7 @@ export function getFontClasses (pattern, set, properties) {
3536

3637
export async function prepareFonts (options, resolve, kebabCaseProps = true) {
3738
const { fonts, classPattern } = options
38-
return (await Promise.all(fonts.map((font) => {
39+
const preparedFonts = (await Promise.all(fonts.map((font) => {
3940
const fileExtensions = getFileExtensions(font)
4041
return font.fontFaces.map((face) => {
4142
const sources = prepareSrc(face.src, fileExtensions, resolve)
@@ -53,7 +54,8 @@ export async function prepareFonts (options, resolve, kebabCaseProps = true) {
5354
local: [].concat(face.local || [])
5455
}
5556
})
56-
}))).flat()
57+
})))
58+
return arrayFlat(preparedFonts)
5759
}
5860

5961
export function createFontFace (font, baseUrl) {

Diff for: lib/utils/fontLoader.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { arrayFlat } from './index'
2+
13
export function loadFonts (options) {
24
options = Object.assign({
35
ignoredEffectiveTypes: [],
@@ -74,7 +76,7 @@ export function isSlowConnection (ignoredEffectiveTypes) {
7476
* @return Boolean
7577
*/
7678
export function isLighthouse () {
77-
return new RegExp('(Speed Insights)|(Chrome-Lighthouse)').test(window.navigator.userAgent)
79+
return /(Speed Insights)|(Chrome-Lighthouse)/.test(window.navigator.userAgent)
7880
}
7981

8082
export function linkFeaturePrefetch () {
@@ -101,14 +103,6 @@ async function prefetchFonts (fonts, options, classList = []) {
101103
}
102104
}
103105

104-
function arrayFlat (array) {
105-
if ('flat' in Array.prototype) {
106-
return array.flat()
107-
} else {
108-
return [].concat.apply([], array)
109-
}
110-
}
111-
112106
export function unlockClasses (classList, unlockDelay) {
113107
const cb = () => {
114108
document.documentElement.classList.add(...arrayFlat(classList))

Diff for: lib/utils/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
export function arrayFlat (array) {
3+
if ('flat' in Array.prototype) {
4+
return array.flat()
5+
} else {
6+
return [].concat.apply([], array)
7+
}
8+
}

Diff for: lib/worker/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { resolve } from 'path'
2+
import { arrayFlat } from '../utils/index'
23

34
export function addWebWorker (moduleScope, fonts, options) {
45
const preparedFonts = prepareFonts(fonts)
@@ -47,7 +48,7 @@ function prepareFonts (fonts) {
4748
result.sources.push(sources[0].path)
4849
return result
4950
}, {
50-
classes: fonts.map(font => font.classes).flat(),
51+
classes: arrayFlat(fonts.map(font => font.classes)),
5152
sources: []
5253
})
5354
}

0 commit comments

Comments
 (0)