fix: remove unused dependencies and tidy project (#30043)

This commit is contained in:
Daniel Roe 2024-11-26 13:01:38 +00:00
parent a02af23483
commit 92b5a3d931
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
15 changed files with 1323 additions and 991 deletions

View File

@ -1,27 +1,60 @@
{ {
"$schema": "https://unpkg.com/knip@5/schema.json", "$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreBinaries": [
"prepack"
],
"ignoreWorkspaces": ["test/fixtures/basic"],
"ignoreDependencies": [
"bing",
"uno.css"
],
"workspaces": { "workspaces": {
".": { ".": {
"entry": [ "entry": [
"scripts/*", "scripts/*"
"test/*", ]
"test/fixtures/*" },
"test/fixtures/*": {
"entry": [
"nuxt.config.{js,ts}",
"modules/*.ts",
"types.ts"
] ]
}, },
"packages/*": { "packages/*": {
"entry": [ "entry": [
"src/index.ts", "src/index.ts",
"src/runtime/**/*.ts" "src/runtime/**/*.{js,ts,mjs}"
] ]
}, },
"packages/nuxt": { "packages/nuxt": {
"entry": [ "entry": [
"src/app/**/*.ts", "src/app/**/*.ts",
"src/app/*.ts", "src/app/*.ts",
"src/*/runtime/**/*.ts", "src/*/runtime/**/*.{ts,js}",
"src/core/templates.ts", "src/core/templates.ts",
"src/index.ts" "src/index.ts"
] ]
},
"packages/rspack": {
"entry": [
"../webpack/src/index.ts",
"../webpack/src/runtime/**/*.{js,ts,mjs}",
"builder.mjs"
]
},
"packages/ui-templates": {
"entry": [
"lib/*.ts",
"styles.ts"
]
},
"packages/webpack": {
"entry": [
"src/index.ts",
"src/runtime/**/*.{js,ts,mjs}",
"builder.mjs"
]
} }
} }
} }

View File

@ -17,5 +17,8 @@ export default defineNuxtConfig({
}, },
], ],
pages: process.env.DOCS_TYPECHECK === 'true', pages: process.env.DOCS_TYPECHECK === 'true',
typescript: { shim: process.env.DOCS_TYPECHECK === 'true' }, typescript: {
shim: process.env.DOCS_TYPECHECK === 'true',
hoist: ['@vitejs/plugin-vue', 'vue-router'],
},
}) })

View File

@ -17,7 +17,7 @@
"lint:fix": "eslint . --cache --fix", "lint:fix": "eslint . --cache --fix",
"lint:docs": "markdownlint ./docs && case-police 'docs/**/*.md' *.md", "lint:docs": "markdownlint ./docs && case-police 'docs/**/*.md' *.md",
"lint:docs:fix": "markdownlint ./docs --fix && case-police 'docs/**/*.md' *.md --fix", "lint:docs:fix": "markdownlint ./docs --fix && case-police 'docs/**/*.md' *.md --fix",
"lint:knip": "pnpx knip", "lint:knip": "knip",
"play": "nuxi dev playground", "play": "nuxi dev playground",
"play:build": "nuxi build playground", "play:build": "nuxi build playground",
"play:generate": "nuxi generate playground", "play:generate": "nuxi generate playground",
@ -37,7 +37,6 @@
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
"@nuxt/rspack-builder": "workspace:*", "@nuxt/rspack-builder": "workspace:*",
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"@nuxt/ui-templates": "workspace:*",
"@nuxt/vite-builder": "workspace:*", "@nuxt/vite-builder": "workspace:*",
"@nuxt/webpack-builder": "workspace:*", "@nuxt/webpack-builder": "workspace:*",
"@types/node": "22.10.0", "@types/node": "22.10.0",
@ -62,19 +61,16 @@
"vue": "3.5.13" "vue": "3.5.13"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "9.15.0",
"@nuxt/eslint-config": "0.7.2", "@nuxt/eslint-config": "0.7.2",
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
"@nuxt/rspack-builder": "workspace:*", "@nuxt/rspack-builder": "workspace:*",
"@nuxt/test-utils": "3.14.4", "@nuxt/test-utils": "3.14.4",
"@nuxt/webpack-builder": "workspace:*", "@nuxt/webpack-builder": "workspace:*",
"@testing-library/vue": "8.1.0", "@testing-library/vue": "8.1.0",
"@types/eslint__js": "8.42.3",
"@types/node": "22.10.0", "@types/node": "22.10.0",
"@types/semver": "7.5.8", "@types/semver": "7.5.8",
"@unhead/schema": "1.11.13", "@unhead/schema": "1.11.13",
"@unhead/vue": "1.11.13", "@unhead/vue": "1.11.13",
"@vitejs/plugin-vue": "5.2.1",
"@vitest/coverage-v8": "2.1.6", "@vitest/coverage-v8": "2.1.6",
"@vue/test-utils": "2.4.6", "@vue/test-utils": "2.4.6",
"autoprefixer": "10.4.20", "autoprefixer": "10.4.20",
@ -91,6 +87,7 @@
"h3": "1.13.0", "h3": "1.13.0",
"happy-dom": "15.11.6", "happy-dom": "15.11.6",
"jiti": "2.4.0", "jiti": "2.4.0",
"knip": "5.38.1",
"markdownlint-cli": "0.43.0", "markdownlint-cli": "0.43.0",
"nitropack": "2.10.4", "nitropack": "2.10.4",
"nuxi": "3.15.0", "nuxi": "3.15.0",
@ -110,7 +107,6 @@
"vitest": "2.1.6", "vitest": "2.1.6",
"vitest-environment-nuxt": "1.0.1", "vitest-environment-nuxt": "1.0.1",
"vue": "3.5.13", "vue": "3.5.13",
"vue-router": "4.5.0",
"vue-tsc": "2.1.10" "vue-tsc": "2.1.10"
}, },
"packageManager": "pnpm@9.14.2", "packageManager": "pnpm@9.14.2",

View File

@ -32,12 +32,12 @@
"defu": "^6.1.4", "defu": "^6.1.4",
"destr": "^2.0.3", "destr": "^2.0.3",
"globby": "^14.0.2", "globby": "^14.0.2",
"hash-sum": "^2.0.0",
"ignore": "^6.0.2", "ignore": "^6.0.2",
"jiti": "^2.4.0", "jiti": "^2.4.0",
"klona": "^2.0.6", "klona": "^2.0.6",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"mlly": "^1.7.3", "mlly": "^1.7.3",
"ohash": "^1.1.4",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"pkg-types": "^1.2.1", "pkg-types": "^1.2.1",
"scule": "^1.3.0", "scule": "^1.3.0",
@ -49,7 +49,6 @@
}, },
"devDependencies": { "devDependencies": {
"@rspack/core": "1.1.4", "@rspack/core": "1.1.4",
"@types/hash-sum": "1.0.2",
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
"@types/semver": "7.5.8", "@types/semver": "7.5.8",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",

View File

@ -1,6 +1,6 @@
import { existsSync, promises as fsp } from 'node:fs' import { existsSync, promises as fsp } from 'node:fs'
import { basename, isAbsolute, join, parse, relative, resolve } from 'pathe' import { basename, isAbsolute, join, parse, relative, resolve } from 'pathe'
import hash from 'hash-sum' import { hash } from 'ohash'
import type { Nuxt, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, TSReference } from '@nuxt/schema' import type { Nuxt, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, TSReference } from '@nuxt/schema'
import { withTrailingSlash } from 'ufo' import { withTrailingSlash } from 'ufo'
import { defu } from 'defu' import { defu } from 'defu'

View File

@ -126,7 +126,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/scripts": "0.9.5", "@nuxt/scripts": "0.9.5",
"@nuxt/ui-templates": "1.3.4",
"@parcel/watcher": "2.5.0", "@parcel/watcher": "2.5.0",
"@types/estree": "1.0.6", "@types/estree": "1.0.6",
"@vitejs/plugin-vue": "5.2.1", "@vitejs/plugin-vue": "5.2.1",

View File

@ -39,18 +39,15 @@
"defu": "^6.1.4", "defu": "^6.1.4",
"esbuild-loader": "^4.2.2", "esbuild-loader": "^4.2.2",
"escape-string-regexp": "^5.0.0", "escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^9.0.2", "fork-ts-checker-webpack-plugin": "^9.0.2",
"globby": "^14.0.2", "globby": "^14.0.2",
"h3": "^1.13.0", "h3": "^1.13.0",
"hash-sum": "^2.0.0",
"jiti": "^2.4.0", "jiti": "^2.4.0",
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"magic-string": "^0.30.14", "magic-string": "^0.30.14",
"memfs": "^4.14.0", "memfs": "^4.14.0",
"mlly": "^1.7.3",
"ohash": "^1.1.4", "ohash": "^1.1.4",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"pify": "^6.1.0", "pify": "^6.1.0",
@ -71,12 +68,10 @@
"webpack-bundle-analyzer": "^4.10.2", "webpack-bundle-analyzer": "^4.10.2",
"webpack-dev-middleware": "^7.4.2", "webpack-dev-middleware": "^7.4.2",
"webpack-hot-middleware": "^2.26.1", "webpack-hot-middleware": "^2.26.1",
"webpack-virtual-modules": "^0.6.2",
"webpackbar": "^7.0.0" "webpackbar": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"@types/hash-sum": "1.0.2",
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
"@types/pify": "5.0.4", "@types/pify": "5.0.4",
"@types/webpack-bundle-analyzer": "4.7.0", "@types/webpack-bundle-analyzer": "4.7.0",

View File

@ -27,7 +27,6 @@ export default defineBuildConfig({
'autoprefixer', 'autoprefixer',
'ofetch', 'ofetch',
'vue-router', 'vue-router',
'@nuxt/telemetry',
'vue-bundle-renderer', 'vue-bundle-renderer',
'@unhead/schema', '@unhead/schema',
'vue', 'vue',
@ -54,7 +53,6 @@ export default defineBuildConfig({
'pug', 'pug',
'sass-loader', 'sass-loader',
'c12', 'c12',
'unenv',
'@vue/language-core', '@vue/language-core',
// Implicit // Implicit
'@vue/compiler-core', '@vue/compiler-core',

View File

@ -34,8 +34,6 @@
"prepack": "unbuild" "prepack": "unbuild"
}, },
"devDependencies": { "devDependencies": {
"@nuxt/telemetry": "2.6.0",
"@nuxt/ui-templates": "1.3.4",
"@types/file-loader": "5.0.4", "@types/file-loader": "5.0.4",
"@types/pug": "2.0.10", "@types/pug": "2.0.10",
"@types/sass-loader": "8.0.9", "@types/sass-loader": "8.0.9",
@ -52,7 +50,6 @@
"ofetch": "1.4.1", "ofetch": "1.4.1",
"unbuild": "latest", "unbuild": "latest",
"unctx": "2.3.1", "unctx": "2.3.1",
"unenv": "1.10.0",
"vite": "6.0.1", "vite": "6.0.1",
"vue": "3.5.13", "vue": "3.5.13",
"vue-bundle-renderer": "2.1.1", "vue-bundle-renderer": "2.1.1",

View File

@ -14,8 +14,7 @@
"dev": "vite", "dev": "vite",
"optimize-assets": "npx svgo public/assets/**/*.svg", "optimize-assets": "npx svgo public/assets/**/*.svg",
"postinstall": "pnpm build", "postinstall": "pnpm build",
"prerender": "pnpm build && jiti ./lib/prerender", "prerender": "pnpm build && jiti ./lib/prerender"
"test": "pnpm lint && pnpm build"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
@ -29,6 +28,7 @@
"pathe": "1.1.2", "pathe": "1.1.2",
"prettier": "3.4.1", "prettier": "3.4.1",
"scule": "1.3.0", "scule": "1.3.0",
"svgo": "^3.3.2",
"tinyexec": "0.3.1", "tinyexec": "0.3.1",
"tinyglobby": "0.2.10", "tinyglobby": "0.2.10",
"unocss": "0.64.1", "unocss": "0.64.1",

View File

@ -26,7 +26,6 @@
"devDependencies": { "devDependencies": {
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"@types/clear": "0.1.4", "@types/clear": "0.1.4",
"@types/estree": "1.0.6",
"rollup": "4.27.4", "rollup": "4.27.4",
"unbuild": "latest", "unbuild": "latest",
"vue": "3.5.13" "vue": "3.5.13"
@ -43,7 +42,6 @@
"defu": "^6.1.4", "defu": "^6.1.4",
"esbuild": "^0.24.0", "esbuild": "^0.24.0",
"escape-string-regexp": "^5.0.0", "escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"externality": "^1.0.2", "externality": "^1.0.2",
"get-port-please": "^3.1.2", "get-port-please": "^3.1.2",
"h3": "^1.13.0", "h3": "^1.13.0",
@ -51,14 +49,11 @@
"knitwork": "^1.1.0", "knitwork": "^1.1.0",
"magic-string": "^0.30.14", "magic-string": "^0.30.14",
"mlly": "^1.7.3", "mlly": "^1.7.3",
"ohash": "^1.1.4",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"perfect-debounce": "^1.0.0",
"pkg-types": "^1.2.1", "pkg-types": "^1.2.1",
"postcss": "^8.4.49", "postcss": "^8.4.49",
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"std-env": "^3.8.0", "std-env": "^3.8.0",
"strip-literal": "^2.1.1",
"ufo": "^1.5.4", "ufo": "^1.5.4",
"unenv": "^1.10.0", "unenv": "^1.10.0",
"unplugin": "^1.16.0", "unplugin": "^1.16.0",

View File

@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url'
import { createApp, createError, defineEventHandler, defineLazyEventHandler, eventHandler, toNodeListener } from 'h3' import { createApp, createError, defineEventHandler, defineLazyEventHandler, eventHandler, toNodeListener } from 'h3'
import { ViteNodeServer } from 'vite-node/server' import { ViteNodeServer } from 'vite-node/server'
import { isAbsolute, normalize, resolve } from 'pathe' import { isAbsolute, normalize, resolve } from 'pathe'
import { addDevServerHandler } from '@nuxt/kit' // import { addDevServerHandler } from '@nuxt/kit'
import { isFileServingAllowed } from 'vite' import { isFileServingAllowed } from 'vite'
import type { ModuleNode, Plugin as VitePlugin } from 'vite' import type { ModuleNode, Plugin as VitePlugin } from 'vite'
import { getQuery } from 'ufo' import { getQuery } from 'ufo'
@ -16,7 +16,7 @@ import { createIsExternal } from './utils/external'
import { transpile } from './utils/transpile' import { transpile } from './utils/transpile'
// TODO: Remove this in favor of registerViteNodeMiddleware // TODO: Remove this in favor of registerViteNodeMiddleware
// after Nitropack or h3 fixed for adding middlewares after setup // after Nitropack or h3 allows adding middleware after setup
export function viteNodePlugin (ctx: ViteBuildContext): VitePlugin { export function viteNodePlugin (ctx: ViteBuildContext): VitePlugin {
// Store the invalidates for the next rendering // Store the invalidates for the next rendering
const invalidates = new Set<string>() const invalidates = new Set<string>()
@ -71,12 +71,13 @@ export function viteNodePlugin (ctx: ViteBuildContext): VitePlugin {
} }
} }
export function registerViteNodeMiddleware (ctx: ViteBuildContext) { // TODO: Use this when Nitropack or h3 allows adding middleware after setup
addDevServerHandler({ // export function registerViteNodeMiddleware (ctx: ViteBuildContext) {
route: '/__nuxt_vite_node__/', // addDevServerHandler({
handler: createViteNodeApp(ctx).handler, // route: '/__nuxt_vite_node__/',
}) // handler: createViteNodeApp(ctx).handler,
} // })
// }
function getManifest (ctx: ViteBuildContext) { function getManifest (ctx: ViteBuildContext) {
const css = new Set<string>() const css = new Set<string>()

View File

@ -38,17 +38,14 @@
"defu": "^6.1.4", "defu": "^6.1.4",
"esbuild-loader": "^4.2.2", "esbuild-loader": "^4.2.2",
"escape-string-regexp": "^5.0.0", "escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^9.0.2", "fork-ts-checker-webpack-plugin": "^9.0.2",
"h3": "^1.13.0", "h3": "^1.13.0",
"hash-sum": "^2.0.0",
"jiti": "^2.4.0", "jiti": "^2.4.0",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"magic-string": "^0.30.14", "magic-string": "^0.30.14",
"memfs": "^4.14.0", "memfs": "^4.14.0",
"mini-css-extract-plugin": "^2.9.2", "mini-css-extract-plugin": "^2.9.2",
"mlly": "^1.7.3",
"ohash": "^1.1.4", "ohash": "^1.1.4",
"pathe": "^1.1.2", "pathe": "^1.1.2",
"pify": "^6.1.0", "pify": "^6.1.0",
@ -75,7 +72,6 @@
"devDependencies": { "devDependencies": {
"@nuxt/schema": "workspace:*", "@nuxt/schema": "workspace:*",
"@rspack/core": "1.1.4", "@rspack/core": "1.1.4",
"@types/hash-sum": "1.0.2",
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
"@types/pify": "5.0.4", "@types/pify": "5.0.4",
"@types/webpack-bundle-analyzer": "4.7.0", "@types/webpack-bundle-analyzer": "4.7.0",

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vue/devtools-api": "latest", "@vue/devtools-api": "latest",
"defu": "latest",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"ufo": "latest", "ufo": "latest",
"unplugin": "latest", "unplugin": "latest",