feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

21
node_modules/@nuxtjs/google-fonts/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Nuxt Modules
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

62
node_modules/@nuxtjs/google-fonts/README.md generated vendored Normal file
View File

@@ -0,0 +1,62 @@
[![@nuxtjs/google-fonts](https://google-fonts.nuxtjs.org/social-card.png)](https://google-fonts.nuxtjs.org)
# @nuxtjs/google-fonts
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
> [Google Fonts](https://developers.google.com/fonts) module for [Nuxt](https://nuxtjs.org)
- [✨  Release Notes](https://google-fonts.nuxtjs.org/releases)
- [📖  Documentation](https://google-fonts.nuxtjs.org)
## Features
- Nuxt 3 and Nuxt Bridge support
- Specify fonts by name/variant
- Parse head links to Google Fonts
- Creates only an external link to Google Fonts
- [Support CSS API v2](https://developers.google.com/fonts/docs/css2)
- [Add dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch)
- [Add preconnect](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch#Best_practices)
- [Add preload](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload)
- Download css/fonts to local project (No need external resources)
- Encode fonts to base64
[📖  Read more](https://google-fonts.nuxtjs.org)
## Contributing
You can contribute to this module online with CodeSandBox:
[![Edit @nuxtjs/google-fonts](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/nuxt-modules/google-fonts/?fontsize=14&hidenavigation=1&theme=dark)
Or locally:
1. Clone this repository
2. Install dependencies using `pnpm install`
3. Prepare development server using `pnpm dev:prepare`
4. Build module using `pnpm build`
5. Launch playground using `pnpm dev`
## License
[MIT License](./LICENSE)
Copyright (c) Nuxt Modules
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/google-fonts/latest.svg
[npm-version-href]: https://npmjs.com/package/@nuxtjs/google-fonts
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/google-fonts.svg
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/google-fonts
[github-actions-ci-src]: https://github.com/nuxt-modules/google-fonts/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt-modules/google-fonts/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-modules/google-fonts.svg
[codecov-href]: https://codecov.io/gh/nuxt-modules/google-fonts
[license-src]: https://img.shields.io/npm/l/@nuxtjs/google-fonts.svg
[license-href]: https://npmjs.com/package/@nuxtjs/google-fonts

5
node_modules/@nuxtjs/google-fonts/dist/module.cjs generated vendored Normal file
View File

@@ -0,0 +1,5 @@
module.exports = function(...args) {
return import('./module.mjs').then(m => m.default.call(this, ...args))
}
const _meta = module.exports.meta = require('./module.json')
module.exports.getMeta = () => Promise.resolve(_meta)

14
node_modules/@nuxtjs/google-fonts/dist/module.d.mts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as _nuxt_schema from '@nuxt/schema';
import { DownloadOptions, GoogleFonts } from 'google-fonts-helper';
interface ModuleOptions extends Partial<DownloadOptions>, GoogleFonts {
prefetch?: boolean;
preconnect?: boolean;
preload?: boolean;
useStylesheet?: boolean;
download?: boolean;
inject?: boolean;
}
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
export { type ModuleOptions, _default as default };

14
node_modules/@nuxtjs/google-fonts/dist/module.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as _nuxt_schema from '@nuxt/schema';
import { DownloadOptions, GoogleFonts } from 'google-fonts-helper';
interface ModuleOptions extends Partial<DownloadOptions>, GoogleFonts {
prefetch?: boolean;
preconnect?: boolean;
preload?: boolean;
useStylesheet?: boolean;
download?: boolean;
inject?: boolean;
}
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
export { type ModuleOptions, _default as default };

5
node_modules/@nuxtjs/google-fonts/dist/module.json generated vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"name": "@nuxtjs/google-fonts",
"version": "3.2.0",
"configKey": "googleFonts"
}

166
node_modules/@nuxtjs/google-fonts/dist/module.mjs generated vendored Normal file
View File

@@ -0,0 +1,166 @@
import { resolve } from 'pathe';
import { useLogger, defineNuxtModule, resolvePath, isNuxt2 } from '@nuxt/kit';
import { isValidURL, parse, constructURL, merge, download } from 'google-fonts-helper';
const name = "@nuxtjs/google-fonts";
const version = "3.2.0";
const logger = useLogger("nuxt:google-fonts");
const module = defineNuxtModule({
meta: {
name,
version,
configKey: "googleFonts"
},
defaults: {
families: {},
display: void 0,
// set to 'swap' later if no preload or user value
subsets: [],
text: void 0,
prefetch: true,
preconnect: true,
preload: false,
useStylesheet: false,
download: true,
base64: false,
inject: true,
overwriting: false,
outputDir: "node_modules/.cache/nuxt-google-fonts",
stylePath: "css/nuxt-google-fonts.css",
fontsDir: "fonts",
fontsPath: "../fonts"
},
async setup(options, nuxt) {
if (options.display === void 0 && !options.preload) {
options.display = "swap";
}
const fontsParsed = [];
const head = nuxt.options.app.head || nuxt.options.head;
if (typeof head === "function") {
logger.warn("This module does not work with `head` as function.");
return;
}
fontsParsed.push(
...head.link.filter((link) => isValidURL(String(link.href))).map((link) => parse(String(link.href)))
);
const url = constructURL(merge(options, ...fontsParsed));
if (!url) {
logger.warn("No provided fonts.");
return;
}
head.link = head.link.filter((link) => !isValidURL(String(link.href)));
if (options.download && options.outputDir) {
const outputDir = await resolvePath(options.outputDir);
try {
const downloader = download(url, {
base64: options.base64,
overwriting: options.overwriting,
outputDir,
stylePath: options.stylePath,
fontsDir: options.fontsDir,
fontsPath: options.fontsPath
});
const outputFonts = [];
downloader.hook("download:start", () => {
logger.start("Downloading fonts...");
});
downloader.hook("download:complete", () => {
logger.success("Download fonts completed.");
logger.log("");
});
downloader.hook("download-css:done", (url2) => {
logger.success(url2);
});
downloader.hook("download-font:done", (font) => {
const fontName = font.outputFont.replace(`-${font.outputFont.replace(/.*-/, "")}`, "");
if (!outputFonts.includes(fontName)) {
outputFonts.push(fontName);
logger.info(fontName);
}
});
await downloader.execute();
if (options.inject && options.stylePath) {
nuxt.options.css.push(resolve(outputDir, options.stylePath));
}
nuxt.options.nitro = nuxt.options.nitro || {};
nuxt.options.nitro.publicAssets = nuxt.options.nitro.publicAssets || [];
nuxt.options.nitro.publicAssets.push({ dir: outputDir });
} catch (e) {
logger.error(e);
}
return;
}
if (options.prefetch) {
head.link.push({
key: "gf-prefetch",
rel: "dns-prefetch",
href: "https://fonts.gstatic.com/"
});
}
if (options.preconnect) {
head.link.push(
// connect to domain of font files
{
key: "gf-preconnect",
rel: "preconnect",
href: "https://fonts.gstatic.com/",
crossorigin: "anonymous"
},
// Should also preconnect to origin of Google fonts stylesheet.
{
key: "gf-origin-preconnect",
rel: "preconnect",
href: "https://fonts.googleapis.com/"
}
);
}
if (options.preload) {
head.link.push({
key: "gf-preload",
rel: "preload",
as: "style",
href: url
});
}
if (options.useStylesheet) {
head.link.push({
key: "gf-style",
rel: "stylesheet",
href: url
});
return;
}
if (isNuxt2()) {
head.script.push({
key: "gf-script",
innerHTML: `(function(){var l=document.createElement('link');l.rel="stylesheet";l.href="${url}";document.querySelector("head").appendChild(l);})();`
});
head.noscript.push({
key: "gf-noscript",
innerHTML: `<link rel="stylesheet" href="${url}">`,
tagPosition: "bodyOpen"
});
head.__dangerouslyDisableSanitizersByTagID = head.__dangerouslyDisableSanitizersByTagID || {};
head.__dangerouslyDisableSanitizersByTagID["gf-script"] = ["innerHTML"];
head.__dangerouslyDisableSanitizersByTagID["gf-noscript"] = ["innerHTML"];
return;
}
head.script.unshift({
key: "gf-script",
children: `(function(){
var h=document.querySelector("head");
var m=h.querySelector('meta[name="head:count"]');
if(m){m.setAttribute('content',Number(m.getAttribute('content'))+1);}
else{m=document.createElement('meta');m.setAttribute('name','head:count');m.setAttribute('content','1');h.append(m);}
var l=document.createElement('link');l.rel='stylesheet';l.href='${url}';h.appendChild(l);
})();`
});
head.noscript.push({
children: `<link rel="stylesheet" href="${url}">`,
tagPosition: "bodyOpen"
});
}
});
export { module as default };

16
node_modules/@nuxtjs/google-fonts/dist/types.d.mts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { ModuleOptions } from './module'
declare module '@nuxt/schema' {
interface NuxtConfig { ['googleFonts']?: Partial<ModuleOptions> }
interface NuxtOptions { ['googleFonts']?: ModuleOptions }
}
declare module 'nuxt/schema' {
interface NuxtConfig { ['googleFonts']?: Partial<ModuleOptions> }
interface NuxtOptions { ['googleFonts']?: ModuleOptions }
}
export type { ModuleOptions, default } from './module'

16
node_modules/@nuxtjs/google-fonts/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { ModuleOptions } from './module'
declare module '@nuxt/schema' {
interface NuxtConfig { ['googleFonts']?: Partial<ModuleOptions> }
interface NuxtOptions { ['googleFonts']?: ModuleOptions }
}
declare module 'nuxt/schema' {
interface NuxtConfig { ['googleFonts']?: Partial<ModuleOptions> }
interface NuxtOptions { ['googleFonts']?: ModuleOptions }
}
export type { ModuleOptions, default } from './module'

52
node_modules/@nuxtjs/google-fonts/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"name": "@nuxtjs/google-fonts",
"version": "3.2.0",
"description": "Google Fonts module for Nuxt",
"repository": "nuxt-modules/google-fonts",
"license": "MIT",
"contributors": [
"Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
],
"type": "module",
"sideEffects": false,
"exports": {
".": {
"require": "./dist/module.cjs",
"import": "./dist/module.mjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist"
],
"dependencies": {
"@nuxt/kit": "^3.10.3",
"google-fonts-helper": "^3.5.0",
"pathe": "^1.1.2"
},
"devDependencies": {
"@nuxt/module-builder": "latest",
"@nuxt/test-utils": "latest",
"@nuxtjs/eslint-config-typescript": "latest",
"@vitest/coverage-v8": "latest",
"changelogen": "latest",
"del": "latest",
"eslint": "latest",
"nuxt": "latest",
"vitest": "latest"
},
"publishConfig": {
"access": "public"
},
"packageManager": "pnpm@8.15.4",
"scripts": {
"build": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"lint": "eslint --ext .js,.ts,.vue",
"release": "pnpm test && pnpm prepack && pnpm changelogen --release --push && pnpm publish",
"test": "pnpm lint && vitest run --coverage"
}
}