Compare commits

...
23 changed files with 853 additions and 1850 deletions
+4 -1
View File
@@ -52,4 +52,7 @@ dist
.vscode/*
# Don't ignore VS Code settings that configure ESLint extension
!.vscode/settings.json
!.vscode/settings.json
# Nuxt
.nuxt
+7 -1
View File
@@ -21,8 +21,10 @@
"docs:build": "turbo run --no-daemon @vintl-dev/docs#build",
"docs:start": "turbo run --no-daemon @vintl-dev/docs#start",
"docs:lint": "turbo run --no-daemon @vintl-dev/docs#lint",
"mod:prepare": "turbo run --no-daemon @vintl/nuxt#dev:prepare",
"mod:build": "turbo run --no-daemon @vintl/nuxt#build",
"mod:lint": "turbo run --no-daemon @vintl/nuxt#lint",
"mod:typecheck": "turbo run --no-daemon @vintl/nuxt#typecheck",
"all:prepare": "turbo run --no-daemon prepare",
"all:lint": "turbo run --no-daemon lint",
"_ci:publish": "changeset publish"
@@ -36,5 +38,9 @@
}
}
},
"packageManager": "pnpm@9.4.0"
"packageManager": "pnpm@9.4.0",
"dependencies": {
"prettier": "^3.3.2",
"prettier-plugin-jsdoc": "^1.3.0"
}
}
-30
View File
@@ -1,30 +0,0 @@
{
"root": true,
"extends": ["@vintl-dev/eslint-config-peony"],
"overrides": [
{
"files": ["./src/**/*.ts", "./types/*.d.ts"],
"excludedFiles": ["./src/runtime/**/*.ts", "./dist"],
"parserOptions": {
"project": "./tsconfig.json"
}
},
{
"files": ["./build.config.ts"],
"parserOptions": {
"project": "./tsconfig.build.json"
}
},
{
"files": [
"./stubs/*.{d.ts,js}",
"./src/runtime/**/*.{ts,mts}",
"./types/*.d.ts"
],
"parserOptions": {
"project": "./tsconfig.runtime.json"
}
}
],
"ignorePatterns": ["/dist"]
}
+8
View File
@@ -1,5 +1,13 @@
# @vintl/nuxt
## 1.9.1
### Patch Changes
- a26c360: Switch to the official Nuxt module template
This should resolve any issues with our Nuxt-specific imports, e.g., breakage of the Nuxt injections (added through `provide`s in plugins) due to the invalid `Plugin` type specified by our package (sorry for that!).
## 1.9.0
### Minor Changes
-10
View File
@@ -3,16 +3,6 @@ import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
hooks: {
'build:before'(ctx) {
for (const entry of ctx.options.entries) {
if (
entry.builder === 'mkdist' &&
'ext' in entry &&
entry.input.endsWith('vintl-nuxt/src/runtime')
) {
entry.ext = 'js'
}
}
ctx.options.entries.push({
builder: 'rollup',
name: 'options',
+5 -41
View File
@@ -1,43 +1,7 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
import overrides from '@vintl-dev/eslint-config-peony/overrides'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import config from '@vintl-dev/eslint-config-peony'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default config.append([
{
name: 'vintl/nuxt/module',
files: ['./src/**/*.ts', './types/*.d.ts'],
ignores: ['./src/runtime/**/*.ts', './dist'],
languageOptions: {
parserOptions: {
project: resolve(__dirname, 'tsconfig.json'),
},
},
},
{
name: 'vintl/nuxt/build',
files: ['./build.config.ts'],
languageOptions: {
parserOptions: {
project: resolve(__dirname, 'tsconfig.build.json'),
},
},
},
{
name: 'vintl/nuxt/runtime',
files: [
'./stubs/*.{d.ts,js}',
'./src/runtime/**/*.{ts,mts}',
'./types/*.d.ts',
],
languageOptions: {
parserOptions: {
project: resolve(__dirname, 'tsconfig.runtime.json'),
},
},
},
])
export default createConfigForNuxt({
features: { tooling: true },
}).append(overrides)
+10
View File
@@ -0,0 +1,10 @@
export default defineNuxtConfig({
typescript: {
tsConfig: {
compilerOptions: {
moduleResolution: 'bundler',
allowImportingTsExtensions: true
}
}
}
})
+10 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@vintl/nuxt",
"version": "1.9.0",
"version": "1.9.1",
"description": "Nuxt Module for VIntl integration",
"keywords": [
"i18n",
@@ -27,32 +27,33 @@
"require": "./dist/module.cjs"
},
"./options": {
"types": "./dist/options.d.mts",
"import": "./dist/options.mjs"
},
"./package.json": "./package.json"
},
"module": "./dist/module.mjs",
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "nuxt-module-build build",
"lint": "eslint --cache .",
"prepack": "pnpm run -s lint && pnpm run -s build"
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
"lint": "eslint .",
"typecheck": "vue-tsc --noEmit"
},
"devDependencies": {
"@nuxt/devtools": "^1.3.9",
"@nuxt/eslint-config": "^0.3.13",
"@nuxt/module-builder": "^0.8.1",
"@nuxt/schema": "^3.12.2",
"@types/hash-sum": "^1.0.2",
"@types/node": "^18.19.39",
"@unhead/vue": "^1.9.14",
"@vintl-dev/eslint-config-peony": "workspace:^",
"hookable": "^5.5.3",
"prettier-plugin-jsdoc": "^1.3.0",
"typescript": "^5.5.2",
"vue-router": "^4.4.0"
"nuxt": "^3.12.2",
"typescript": "^5.4.5",
"vue-tsc": "^2.0.24"
},
"dependencies": {
"@formatjs/intl": "^2.10.4",
@@ -8,12 +8,12 @@ export function assertLanguageTagValid(
input: unknown,
): asserts input is LanguageTag {
if (typeof input !== 'string') {
throw new Error('Language tag must be a string')
throw new TypeError('Language tag must be a string')
}
try {
new Intl.Locale(input)
} catch {
throw new Error('Language tag must be a valid BCP 47 language tag')
throw new RangeError('Language tag must be a valid BCP 47 language tag')
}
}
+1 -2
View File
@@ -1,7 +1,6 @@
import { useHead } from '#imports'
import { useRouter as _useRouter, useHead, useRequestURL } from '#imports'
import type { SEOOptions } from '@vintl/nuxt-runtime/options'
import type { IntlController } from '@vintl/vintl/controller'
import { useRouter as _useRouter, useRequestURL } from 'nuxt/app'
import { joinURL } from 'ufo'
import { computed } from 'vue'
import type { LocationQuery, useRouter as _useRouter$type } from 'vue-router'
+1 -1
View File
@@ -18,7 +18,7 @@ import type {
} from '@vintl/vintl/events'
import { useNavigatorLanguage } from '@vintl/vintl/sources/navigator'
import { useAcceptLanguageHeader } from '@vintl/vintl/sources/header'
import { defineNuxtPlugin } from 'nuxt/app'
import { defineNuxtPlugin } from '#imports'
import { syncCaller } from './utils/hookable.js'
import { initHead } from './head.js'
import { match as matchLocales } from '@formatjs/intl-localematcher'
@@ -1,4 +1,4 @@
import type { Plugin } from 'nuxt/app'
import type { Plugin } from '#app'
type _NuxtApp = Parameters<Plugin>[0]
@@ -1,4 +1,4 @@
import { useCookie } from 'nuxt/app'
import { useCookie } from '#imports'
import { defineStorageAdapter } from '../storage-adapter.js'
export default defineStorageAdapter(() => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { readdir, stat } from 'node:fs/promises'
import { join } from 'path'
import { join } from 'node:path'
/**
* Creates a generator that yields for each file in the directory, and files
-1
View File
@@ -1 +0,0 @@
export * from 'nuxt/app'
-1
View File
@@ -1 +0,0 @@
export { useHead } from '@unhead/vue'
-19
View File
@@ -1,19 +0,0 @@
{
"compilerOptions": {
"target": "ESNext",
"rootDir": ".",
"strict": true,
"strictBindCallApply": true,
"verbatimModuleSyntax": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
}
}
-19
View File
@@ -1,19 +0,0 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"composite": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"types": ["node"],
"allowJs": true,
"emitDeclarationOnly": true
},
"include": ["./build.config.ts", "./eslint.config.mjs"]
}
+5 -22
View File
@@ -1,25 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"types": ["./types/nuxt"],
"outDir": "./dist",
"noEmit": true
},
"include": ["./src/**/*.ts", "./types/*.d.ts"],
"exclude": ["./src/runtime/**/*.ts", "dist"],
"references": [
{
"path": "./tsconfig.build.json"
},
{
"path": "./tsconfig.runtime.json"
}
"extends": "./.nuxt/tsconfig.json",
"exclude": [
"dist",
"node_modules",
"playground",
]
}
-24
View File
@@ -1,24 +0,0 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"composite": true,
"module": "nodenext",
"moduleResolution": "nodenext",
"types": ["./types/nuxt"],
"outDir": "./dist",
"paths": {
"#imports": ["./stubs/imports.js"],
"#app": ["./stubs/app.js"]
}
},
"include": [
"./stubs/*.d.ts",
"./stubs/*.js",
"./src/runtime/**/*.ts",
"./src/runtime/**/*.mts",
"./types/*.d.ts"
]
}
+1 -7
View File
@@ -1,11 +1,5 @@
/// <reference types="nuxt" />
import type { ModuleHooks } from '../src/module.js'
import type { ModuleHooks } from '../src/module.ts'
declare module '@nuxt/schema' {
interface NuxtHooks extends ModuleHooks {}
}
declare module '#imports' {
export { useHead } from '@unhead/vue'
}
+785 -1656
View File
File diff suppressed because it is too large Load Diff
+11 -1
View File
@@ -1,12 +1,18 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"@vintl/nuxt#dev:prepare": {
"inputs": ["package.json", "nuxt.config.ts", "src"],
"outputs": [".nuxt"]
},
"@vintl/nuxt#build": {
"dependsOn": ["@vintl/nuxt#dev:prepare"],
"outputs": ["dist"]
},
"@vintl/nuxt#lint": {
"outputs": [".eslintcache"]
},
"@vintl/nuxt#typecheck": {},
"@vintl-dev/pg#intl:extract": {
"outputs": ["./locales/en-US.json"]
},
@@ -64,7 +70,11 @@
"outputs": [".eslintcache"]
},
"//#prepare": {
"dependsOn": ["@vintl-dev/pg#dev:prepare", "@vintl-dev/docs#dev:prepare"]
"dependsOn": [
"@vintl/nuxt#dev:prepare",
"@vintl-dev/pg#dev:prepare",
"@vintl-dev/docs#dev:prepare"
]
},
"//#build": {
"dependsOn": [