Skip to content

Commit cd26c04

Browse files
committed
chore: initial commit
0 parents  commit cd26c04

39 files changed

+10491
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
indent_style = space
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/ci.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: corepack enable
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install dependencies
23+
run: npx nypm@latest i
24+
25+
- name: Lint
26+
run: npm run lint
27+
28+
test:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
- run: corepack enable
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
38+
- name: Install dependencies
39+
run: npx nypm@latest i
40+
41+
- name: Playground prepare
42+
run: npm run dev:prepare
43+
44+
- name: Test
45+
run: npm run test

.gitignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Logs
5+
*.log*
6+
7+
# Temp directories
8+
.temp
9+
.tmp
10+
.cache
11+
12+
# Yarn
13+
**/.yarn/cache
14+
**/.yarn/*state*
15+
16+
# Generated dirs
17+
dist
18+
19+
# Nuxt
20+
.nuxt
21+
.output
22+
.data
23+
.vercel_build_output
24+
.build-*
25+
.netlify
26+
27+
# Env
28+
.env
29+
30+
# Testing
31+
reports
32+
coverage
33+
*.lcov
34+
.nyc_output
35+
36+
# VSCode
37+
.vscode/*
38+
!.vscode/settings.json
39+
!.vscode/tasks.json
40+
!.vscode/launch.json
41+
!.vscode/extensions.json
42+
!.vscode/*.code-snippets
43+
44+
# Intellij idea
45+
*.iml
46+
.idea
47+
48+
# OSX
49+
.DS_Store
50+
.AppleDouble
51+
.LSOverride
52+
.AppleDB
53+
.AppleDesktop
54+
Network Trash Folder
55+
Temporary Items
56+
.apdisk

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false
3+
shell-emulator=true

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.experimental.useFlatConfig": true
3+
}

README.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt HTTP Client Hints
2+
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![License][license-src]][license-href]
6+
[![Nuxt][nuxt-src]][nuxt-href]
7+
8+
My new Nuxt module for doing amazing things.
9+
10+
- [ Release Notes](/CHANGELOG.md)
11+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
12+
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
13+
14+
## Features
15+
16+
<!-- Highlight some of the features your module provide here -->
17+
-&nbsp;Foo
18+
- 🚠 &nbsp;Bar
19+
- 🌲 &nbsp;Baz
20+
21+
## Quick Setup
22+
23+
Install the module to your Nuxt application with one command:
24+
25+
```bash
26+
npx nuxi module add my-module
27+
```
28+
29+
That's it! You can now use HTTP Client Hints in your Nuxt app ✨
30+
31+
32+
## Contribution
33+
34+
<details>
35+
<summary>Local development</summary>
36+
37+
```bash
38+
# Install dependencies
39+
npm install
40+
41+
# Generate type stubs
42+
npm run dev:prepare
43+
44+
# Develop with the playground
45+
npm run dev
46+
47+
# Build the playground
48+
npm run dev:build
49+
50+
# Run ESLint
51+
npm run lint
52+
53+
# Run Vitest
54+
npm run test
55+
npm run test:watch
56+
57+
# Release new version
58+
npm run release
59+
```
60+
61+
</details>
62+
63+
64+
<!-- Badges -->
65+
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
66+
[npm-version-href]: https://npmjs.com/package/my-module
67+
68+
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
69+
[npm-downloads-href]: https://npmjs.com/package/my-module
70+
71+
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
72+
[license-href]: https://npmjs.com/package/my-module
73+
74+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
75+
[nuxt-href]: https://nuxt.com

eslint.config.mjs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3+
4+
// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5+
export default createConfigForNuxt({
6+
features: {
7+
// Rules for module authors
8+
tooling: true,
9+
// Rules for formatting
10+
stylistic: true,
11+
},
12+
dirs: {
13+
src: [
14+
'./playground',
15+
],
16+
},
17+
})
18+
.append(
19+
// your custom flat config here...
20+
)

package.json

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "nuxt-http-client-hints",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"packageManager": "[email protected]",
6+
"description": "Nuxt HTTP Client Hints",
7+
"author": "userquin <[email protected]>",
8+
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/userquin/nuxt-http-client-hints.git"
12+
},
13+
"bugs": "https://github.com/userquin/nuxt-http-client-hints/issues",
14+
"keywords": [
15+
"HTTP Client Hints",
16+
"User Agent Client Hints",
17+
"Device Client Hints",
18+
"Network Client Hints",
19+
"Browser detection",
20+
"nuxt module"
21+
],
22+
"sideEffects": false,
23+
"exports": {
24+
".": {
25+
"types": "./dist/types.d.ts",
26+
"default": "./dist/module.mjs"
27+
},
28+
"./package.json": "./package.json"
29+
},
30+
"main": "./dist/module.mjs",
31+
"types": "./dist/types.d.ts",
32+
"files": [
33+
"dist"
34+
],
35+
"scripts": {
36+
"prepack": "nuxt-module-build build",
37+
"dev": "nuxi dev playground",
38+
"dev:build": "nuxi build playground",
39+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
40+
"release": "bumpp && npm publish",
41+
"lint": "eslint .",
42+
"test": "vitest run",
43+
"test:watch": "vitest watch",
44+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
45+
},
46+
"dependencies": {
47+
"@nuxt/kit": "^3.13.2",
48+
"detect-browser-es": "^0.1.1"
49+
},
50+
"devDependencies": {
51+
"@nuxt/devtools": "^1.5.0",
52+
"@nuxt/eslint-config": "^0.5.7",
53+
"@nuxt/module-builder": "^0.8.4",
54+
"@nuxt/schema": "^3.13.2",
55+
"@nuxt/test-utils": "^3.14.2",
56+
"@types/node": "latest",
57+
"bumpp": "^9.2.0",
58+
"changelogen": "^0.5.7",
59+
"eslint": "^9.11.0",
60+
"nuxt": "^3.13.0",
61+
"typescript": "latest",
62+
"vitest": "^2.1.1",
63+
"vue-tsc": "^2.1.6"
64+
}
65+
}

playground/app.vue

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<pre>{{ $httpClientHints }}</pre>
3+
</template>
4+
5+
<script setup>
6+
useNuxtApp().$
7+
</script>

playground/nuxt.config.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default defineNuxtConfig({
2+
modules: ['../src/module'],
3+
4+
httpClientHints: {
5+
detectBrowser: true,
6+
detectOS: 'windows-11',
7+
http: {
8+
prefersColorScheme: true,
9+
},
10+
},
11+
12+
devtools: { enabled: true },
13+
compatibilityDate: '2024-10-11',
14+
})

playground/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"private": true,
3+
"name": "my-module-playground",
4+
"type": "module",
5+
"scripts": {
6+
"dev": "nuxi dev",
7+
"build": "nuxi build",
8+
"generate": "nuxi generate"
9+
},
10+
"dependencies": {
11+
"nuxt": "^3.13.2"
12+
}
13+
}

playground/plugins/plugin.server.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default defineNuxtPlugin({
2+
setup(nuxt) {
3+
nuxt.hook('http-client-hints:ssr-client-hints', (ssrClientHints) => {
4+
console.log(ssrClientHints)
5+
})
6+
},
7+
})

playground/server/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../.nuxt/tsconfig.server.json"
3+
}

playground/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./.nuxt/tsconfig.json"
3+
}

0 commit comments

Comments
 (0)