perf(schema): drop unneeded type-only schema dependencies (#30411)

This commit is contained in:
Daniel Roe 2024-12-30 00:12:01 +00:00
parent 5cad21572e
commit e629a2ddbf
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
5 changed files with 1253 additions and 1606 deletions

View File

@ -20,44 +20,60 @@ export default defineBuildConfig({
'src/index',
'src/builder-env',
],
hooks: {
'rollup:options' (ctx, options) {
ctx.options.rollup.dts.respectExternal = false
const isExternal = options.external! as (id: string, importer?: string, isResolved?: boolean) => boolean
options.external = (source, importer, isResolved) => {
if (source === 'untyped' || source === 'knitwork') {
return false
}
return isExternal(source, importer, isResolved)
}
},
},
externals: [
// Type imports
'nuxt/app',
'cssnano',
'autoprefixer',
'ofetch',
'vue-router',
'vue-bundle-renderer',
'@unhead/schema',
'vue',
'unctx',
'hookable',
'nitropack',
'webpack',
'webpack-bundle-analyzer',
'rollup-plugin-visualizer',
'vite',
'@vitejs/plugin-vue',
'@vitejs/plugin-vue-jsx',
'mini-css-extract-plugin',
'css-minimizer-webpack-plugin',
'webpack-dev-middleware',
'h3',
'webpack-hot-middleware',
'postcss',
'@vue/language-core',
'autoprefixer',
'c12',
'compatx',
'consola',
'ignore',
'vue-loader',
'css-minimizer-webpack-plugin',
'cssnano',
'esbuild-loader',
'file-loader',
'h3',
'hookable',
'ignore',
'mini-css-extract-plugin',
'nitro',
'nitropack',
'nuxt/app',
'ofetch',
'pkg-types',
'postcss',
'pug',
'rollup-plugin-visualizer',
'sass-loader',
'c12',
'@vue/language-core',
'scule',
'unctx',
'unimport',
'vite',
'vue',
'vue-bundle-renderer',
'vue-loader',
'vue-router',
'webpack',
'webpack-bundle-analyzer',
'webpack-dev-middleware',
'webpack-hot-middleware',
// Implicit
'@vue/compiler-core',
'@vue/compiler-sfc',
'@vue/shared',
'untyped',
],
})

View File

@ -43,15 +43,22 @@
"@vue/compiler-core": "3.5.13",
"@vue/compiler-sfc": "3.5.13",
"@vue/language-core": "2.2.0",
"c12": "2.0.1",
"compatx": "0.1.8",
"esbuild-loader": "4.2.2",
"file-loader": "6.2.0",
"h3": "1.13.0",
"hookable": "5.5.3",
"ignore": "7.0.0",
"nitropack": "2.10.4",
"ofetch": "1.4.1",
"pkg-types": "1.3.0",
"sass-loader": "16.0.4",
"unbuild": "latest",
"scule": "1.3.0",
"unbuild": "3.2.0",
"unctx": "2.4.1",
"unimport": "3.14.5",
"untyped": "1.5.2",
"vite": "6.0.6",
"vue": "3.5.13",
"vue-bundle-renderer": "2.1.1",
@ -61,19 +68,10 @@
"webpack-dev-middleware": "7.4.2"
},
"dependencies": {
"c12": "^2.0.1",
"compatx": "^0.1.8",
"consola": "^3.3.3",
"defu": "^6.1.4",
"hookable": "^5.5.3",
"pathe": "^1.1.2",
"pkg-types": "^1.3.0",
"scule": "^1.3.0",
"std-env": "^3.8.0",
"ufo": "^1.5.4",
"uncrypto": "^0.1.3",
"unimport": "^3.14.5",
"untyped": "^1.5.2"
"std-env": "^3.8.0"
},
"engines": {
"node": "^14.18.0 || >=16.10.0"

View File

@ -1,11 +1,12 @@
import { existsSync } from 'node:fs'
import { readdir } from 'node:fs/promises'
import { randomUUID } from 'node:crypto'
import { defineUntypedSchema } from 'untyped'
import { basename, join, relative, resolve } from 'pathe'
import { isDebug, isDevelopment, isTest } from 'std-env'
import { defu } from 'defu'
import { findWorkspaceDir } from 'pkg-types'
import { randomUUID } from 'uncrypto'
import type { RuntimeConfig } from '../types/config'
export default defineUntypedSchema({

View File

@ -1,7 +1,6 @@
import { consola } from 'consola'
import { resolve } from 'pathe'
import { isTest } from 'std-env'
import { withoutLeadingSlash } from 'ufo'
import { defineUntypedSchema } from 'untyped'
export default defineUntypedSchema({
@ -97,7 +96,7 @@ export default defineUntypedSchema({
clearScreen: true,
build: {
assetsDir: {
$resolve: async (val, get) => val ?? withoutLeadingSlash((await get('app') as Record<string, string>).buildAssetsDir),
$resolve: async (val, get) => val ?? (await get('app') as Record<string, string>).buildAssetsDir?.replace(/^\/+/, ''),
},
emptyOutDir: false,
},

File diff suppressed because it is too large Load Diff