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

This commit is contained in:
Daniel Roe 2024-12-30 00:12:01 +00:00 committed by GitHub
parent ca6e31c5d6
commit f0ce20388d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 73 additions and 66 deletions

View File

@ -20,45 +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',
'nitro',
'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": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
"hookable": "5.5.3",
"ignore": "7.0.0",
"nitro": "npm:nitro-nightly@3.0.0-beta-28796231.359af68d",
"ofetch": "1.4.1",
"pkg-types": "1.3.0",
"sass-loader": "16.0.4",
"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,
},

View File

@ -650,45 +650,18 @@ importers:
packages/schema:
dependencies:
c12:
specifier: 2.0.1
version: 2.0.1(magicast@0.3.5)
compatx:
specifier: ^0.1.8
version: 0.1.8
consola:
specifier: ^3.3.3
version: 3.3.3
defu:
specifier: ^6.1.4
version: 6.1.4
hookable:
specifier: ^5.5.3
version: 5.5.3
pathe:
specifier: ^1.1.2
version: 1.1.2
pkg-types:
specifier: ^1.3.0
version: 1.3.0
scule:
specifier: ^1.3.0
version: 1.3.0
std-env:
specifier: ^3.8.0
version: 3.8.0
ufo:
specifier: 1.5.4
version: 1.5.4
uncrypto:
specifier: ^0.1.3
version: 0.1.3
unimport:
specifier: 3.14.5
version: 3.14.5(rollup@4.29.1)
untyped:
specifier: ^1.5.2
version: 1.5.2
devDependencies:
'@types/pug':
specifier: 2.0.10
@ -711,6 +684,12 @@ importers:
'@vue/language-core':
specifier: 2.2.0
version: 2.2.0(typescript@5.7.2)
c12:
specifier: 2.0.1
version: 2.0.1(magicast@0.3.5)
compatx:
specifier: 0.1.8
version: 0.1.8
esbuild-loader:
specifier: 4.2.2
version: 4.2.2(webpack@5.97.1)
@ -720,6 +699,9 @@ importers:
h3:
specifier: npm:h3-nightly@2.0.0-1718872656.6765a6e
version: h3-nightly@2.0.0-1718872656.6765a6e
hookable:
specifier: 5.5.3
version: 5.5.3
ignore:
specifier: 7.0.0
version: 7.0.0
@ -729,15 +711,27 @@ importers:
ofetch:
specifier: 1.4.1
version: 1.4.1
pkg-types:
specifier: 1.3.0
version: 1.3.0
sass-loader:
specifier: 16.0.4
version: 16.0.4(@rspack/core@1.1.8)(sass@1.78.0)(webpack@5.97.1)
scule:
specifier: 1.3.0
version: 1.3.0
unbuild:
specifier: 3.2.0
version: 3.2.0(sass@1.78.0)(typescript@5.7.2)(vue-tsc@2.2.0(typescript@5.7.2))(vue@3.5.13(typescript@5.7.2))
unctx:
specifier: 2.4.1
version: 2.4.1
unimport:
specifier: 3.14.5
version: 3.14.5(rollup@4.29.1)
untyped:
specifier: 1.5.2
version: 1.5.2
vite:
specifier: 6.0.6
version: 6.0.6(@types/node@22.10.2)(jiti@2.4.2)(sass@1.78.0)(terser@5.32.0)(tsx@4.19.2)(yaml@2.6.1)