mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-29 09:47:43 +08:00
fix(build): enhance type check (#7880)
* fix(build): enhance type check * feat: stricter ts check
This commit is contained in:
parent
87bc35371c
commit
7ff199c60f
8
.github/workflows/test-unit.yml
vendored
8
.github/workflows/test-unit.yml
vendored
@ -14,12 +14,15 @@ jobs:
|
||||
include:
|
||||
- node-version: '16'
|
||||
node-name: 'Latest'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Add dev branch
|
||||
run: git branch dev origin/dev
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
|
||||
@ -31,7 +34,12 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
|
||||
- name: Type Check
|
||||
run: pnpm typecheck
|
||||
|
||||
- name: Test
|
||||
run: pnpm test
|
||||
|
@ -3,9 +3,9 @@ import path from 'path'
|
||||
import fs from 'fs/promises'
|
||||
import consola from 'consola'
|
||||
import * as vueCompiler from 'vue/compiler-sfc'
|
||||
import { Project } from 'ts-morph'
|
||||
import glob from 'fast-glob'
|
||||
import chalk from 'chalk'
|
||||
import { Project } from 'ts-morph'
|
||||
import {
|
||||
buildOutput,
|
||||
epRoot,
|
||||
@ -15,105 +15,41 @@ import {
|
||||
} from '@element-plus/build-utils'
|
||||
import { pathRewriter } from '../utils'
|
||||
import typeUnsafe from '../type-unsafe.json'
|
||||
|
||||
import type { SourceFile } from 'ts-morph'
|
||||
import typeUnsafeStricter from '../type-unsafe-stricter.json'
|
||||
import type { CompilerOptions, SourceFile } from 'ts-morph'
|
||||
|
||||
const TSCONFIG_PATH = path.resolve(projRoot, 'tsconfig.web.json')
|
||||
const outDir = path.resolve(buildOutput, 'types')
|
||||
|
||||
// Type unsafe list. The TS errors are not all fixed yet, so we need a list of which files are not fixed with TS errors to prevent accidental TS errors.
|
||||
const typeUnsafePaths = typeUnsafe.map((_path) => {
|
||||
let paths = path.resolve(projRoot, _path)
|
||||
if (_path.endsWith('/')) paths += path.sep
|
||||
return paths
|
||||
})
|
||||
|
||||
/**
|
||||
* fork = require( https://github.com/egoist/vue-dts-gen/blob/main/src/index.ts
|
||||
*/
|
||||
export const generateTypesDefinitions = async () => {
|
||||
const compilerOptions: CompilerOptions = {
|
||||
emitDeclarationOnly: true,
|
||||
outDir,
|
||||
baseUrl: projRoot,
|
||||
preserveSymlinks: true,
|
||||
skipLibCheck: true,
|
||||
noImplicitAny: false,
|
||||
}
|
||||
const project = new Project({
|
||||
compilerOptions: {
|
||||
emitDeclarationOnly: true,
|
||||
outDir,
|
||||
baseUrl: projRoot,
|
||||
paths: {
|
||||
'@element-plus/*': ['packages/*'],
|
||||
},
|
||||
preserveSymlinks: true,
|
||||
types: [
|
||||
path.resolve(projRoot, 'typings/env'),
|
||||
'unplugin-vue-define-options',
|
||||
],
|
||||
},
|
||||
compilerOptions,
|
||||
tsConfigFilePath: TSCONFIG_PATH,
|
||||
skipAddingFilesFromTsConfig: true,
|
||||
})
|
||||
|
||||
const globAnyFile = '**/*.{js?(x),ts?(x),vue}'
|
||||
const filePaths = excludeFiles(
|
||||
await glob([globAnyFile, '!element-plus/**/*'], {
|
||||
cwd: pkgRoot,
|
||||
absolute: true,
|
||||
onlyFiles: true,
|
||||
})
|
||||
)
|
||||
const epPaths = excludeFiles(
|
||||
await glob(globAnyFile, {
|
||||
cwd: epRoot,
|
||||
onlyFiles: true,
|
||||
})
|
||||
)
|
||||
const sourceFiles = await addSourceFiles(project)
|
||||
consola.success('Added source files')
|
||||
|
||||
const sourceFiles: SourceFile[] = []
|
||||
await Promise.all([
|
||||
...filePaths.map(async (file) => {
|
||||
if (file.endsWith('.vue')) {
|
||||
const content = await fs.readFile(file, 'utf-8')
|
||||
const sfc = vueCompiler.parse(content)
|
||||
const { script, scriptSetup } = sfc.descriptor
|
||||
if (script || scriptSetup) {
|
||||
let content = script?.content ?? ''
|
||||
typeCheck(project, typeUnsafeStricter)
|
||||
consola.success('Stricter type check passed!')
|
||||
|
||||
if (scriptSetup) {
|
||||
const compiled = vueCompiler.compileScript(sfc.descriptor, {
|
||||
id: 'xxx',
|
||||
})
|
||||
content += compiled.content
|
||||
}
|
||||
compilerOptions.noImplicitAny = false
|
||||
project.compilerOptions.set(compilerOptions)
|
||||
|
||||
const lang = scriptSetup?.lang || script?.lang || 'js'
|
||||
const sourceFile = project.createSourceFile(
|
||||
`${path.relative(process.cwd(), file)}.${lang}`,
|
||||
content
|
||||
)
|
||||
sourceFiles.push(sourceFile)
|
||||
}
|
||||
} else {
|
||||
const sourceFile = project.addSourceFileAtPath(file)
|
||||
sourceFiles.push(sourceFile)
|
||||
}
|
||||
}),
|
||||
...epPaths.map(async (file) => {
|
||||
const content = await fs.readFile(path.resolve(epRoot, file), 'utf-8')
|
||||
sourceFiles.push(
|
||||
project.createSourceFile(path.resolve(pkgRoot, file), content)
|
||||
)
|
||||
}),
|
||||
])
|
||||
|
||||
const diagnostics = project.getPreEmitDiagnostics().filter((diagnostic) => {
|
||||
const filePath = diagnostic.getSourceFile()?.getFilePath()!
|
||||
if (!filePath) return false
|
||||
const file = path.normalize(filePath)
|
||||
return !typeUnsafePaths.some((safePath) => file.startsWith(safePath))
|
||||
})
|
||||
if (diagnostics.length > 0) {
|
||||
consola.error(project.formatDiagnosticsWithColorAndContext(diagnostics))
|
||||
const err = new Error('Failed to generate dts.')
|
||||
consola.error(err)
|
||||
throw err
|
||||
}
|
||||
typeCheck(project, typeUnsafe)
|
||||
consola.success('Type check passed!')
|
||||
|
||||
await project.emit({
|
||||
emitOnlyDtsFiles: true,
|
||||
@ -157,3 +93,84 @@ export const generateTypesDefinitions = async () => {
|
||||
|
||||
await Promise.all(tasks)
|
||||
}
|
||||
|
||||
async function addSourceFiles(project: Project) {
|
||||
project.addSourceFileAtPath(path.resolve(projRoot, 'typings/env.d.ts'))
|
||||
|
||||
const globSourceFile = '**/*.{js?(x),ts?(x),vue}'
|
||||
const filePaths = excludeFiles(
|
||||
await glob([globSourceFile, '!element-plus/**/*'], {
|
||||
cwd: pkgRoot,
|
||||
absolute: true,
|
||||
onlyFiles: true,
|
||||
})
|
||||
)
|
||||
const epPaths = excludeFiles(
|
||||
await glob(globSourceFile, {
|
||||
cwd: epRoot,
|
||||
onlyFiles: true,
|
||||
})
|
||||
)
|
||||
|
||||
const sourceFiles: SourceFile[] = []
|
||||
await Promise.all([
|
||||
...filePaths.map(async (file) => {
|
||||
if (file.endsWith('.vue')) {
|
||||
const content = await fs.readFile(file, 'utf-8')
|
||||
const sfc = vueCompiler.parse(content)
|
||||
const { script, scriptSetup } = sfc.descriptor
|
||||
if (script || scriptSetup) {
|
||||
let content = script?.content ?? ''
|
||||
|
||||
if (scriptSetup) {
|
||||
const compiled = vueCompiler.compileScript(sfc.descriptor, {
|
||||
id: 'xxx',
|
||||
})
|
||||
content += compiled.content
|
||||
}
|
||||
|
||||
const lang = scriptSetup?.lang || script?.lang || 'js'
|
||||
const sourceFile = project.createSourceFile(
|
||||
`${path.relative(process.cwd(), file)}.${lang}`,
|
||||
content
|
||||
)
|
||||
sourceFiles.push(sourceFile)
|
||||
}
|
||||
} else {
|
||||
const sourceFile = project.addSourceFileAtPath(file)
|
||||
sourceFiles.push(sourceFile)
|
||||
}
|
||||
}),
|
||||
...epPaths.map(async (file) => {
|
||||
const content = await fs.readFile(path.resolve(epRoot, file), 'utf-8')
|
||||
sourceFiles.push(
|
||||
project.createSourceFile(path.resolve(pkgRoot, file), content)
|
||||
)
|
||||
}),
|
||||
])
|
||||
|
||||
return sourceFiles
|
||||
}
|
||||
|
||||
function typeCheck(project: Project, paths: string[]) {
|
||||
// Type unsafe list. The TS errors are not all fixed yet, so we need a list of which files are not fixed with TS errors to prevent accidental TS errors.
|
||||
const typeUnsafePaths = paths.map((_path) => {
|
||||
let paths = path.resolve(projRoot, _path)
|
||||
if (_path.endsWith('/')) paths += path.sep
|
||||
return paths
|
||||
})
|
||||
|
||||
const diagnostics = project.getPreEmitDiagnostics().filter((diagnostic) => {
|
||||
const filePath = diagnostic.getSourceFile()?.getFilePath()!
|
||||
if (!filePath) return false
|
||||
const file = path.normalize(filePath)
|
||||
return !typeUnsafePaths.some((safePath) => file.startsWith(safePath))
|
||||
})
|
||||
|
||||
if (diagnostics.length > 0) {
|
||||
consola.error(project.formatDiagnosticsWithColorAndContext(diagnostics))
|
||||
const err = new Error('Failed to generate dts.')
|
||||
consola.error(err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
66
internal/build/src/type-unsafe-stricter.json
Normal file
66
internal/build/src/type-unsafe-stricter.json
Normal file
@ -0,0 +1,66 @@
|
||||
[
|
||||
"packages/components/autocomplete/",
|
||||
"packages/components/cascader-panel/",
|
||||
"packages/components/cascader/",
|
||||
"packages/components/checkbox/",
|
||||
"packages/components/col/",
|
||||
"packages/components/collapse-transition/",
|
||||
"packages/components/collection/",
|
||||
"packages/components/color-picker/",
|
||||
"packages/components/date-picker/",
|
||||
"packages/components/descriptions/",
|
||||
"packages/components/dialog/",
|
||||
"packages/components/drawer/",
|
||||
"packages/components/dropdown/",
|
||||
"packages/components/focus-trap/",
|
||||
"packages/components/image-viewer/",
|
||||
"packages/components/infinite-scroll/",
|
||||
"packages/components/input-number/",
|
||||
"packages/components/input/",
|
||||
"packages/components/loading/",
|
||||
"packages/components/menu/",
|
||||
"packages/components/message-box/",
|
||||
"packages/components/message/",
|
||||
"packages/components/notification/",
|
||||
"packages/components/option-group/",
|
||||
"packages/components/option/",
|
||||
"packages/components/overlay/",
|
||||
"packages/components/popconfirm/",
|
||||
"packages/components/popover/",
|
||||
"packages/components/popper/",
|
||||
"packages/components/result/",
|
||||
"packages/components/roving-focus-group/",
|
||||
"packages/components/scrollbar/",
|
||||
"packages/components/select-v2/",
|
||||
"packages/components/select/",
|
||||
"packages/components/skeleton-item/",
|
||||
"packages/components/skeleton/",
|
||||
"packages/components/slider/",
|
||||
"packages/components/space/",
|
||||
"packages/components/steps/",
|
||||
"packages/components/table-column/",
|
||||
"packages/components/table-v2/",
|
||||
"packages/components/table/",
|
||||
"packages/components/tabs/",
|
||||
"packages/components/time-picker/",
|
||||
"packages/components/time-select/",
|
||||
"packages/components/timeline-item/",
|
||||
"packages/components/timeline/",
|
||||
"packages/components/tooltip-v2/",
|
||||
"packages/components/tooltip/",
|
||||
"packages/components/transfer/",
|
||||
"packages/components/tree-select/",
|
||||
"packages/components/tree-v2/",
|
||||
"packages/components/tree/",
|
||||
"packages/components/upload/",
|
||||
"packages/components/virtual-list/",
|
||||
"packages/components/visual-hidden/",
|
||||
"packages/directives/",
|
||||
"packages/hooks/use-floating/",
|
||||
"packages/hooks/use-forward-ref/",
|
||||
"packages/hooks/use-global-config/",
|
||||
"packages/hooks/use-prop/",
|
||||
"packages/make-installer.ts",
|
||||
"packages/utils/dom/",
|
||||
"packages/utils/vue/"
|
||||
]
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2021",
|
||||
"lib": ["ES2021"],
|
||||
"types": ["node"],
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["**/*"]
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "concurrently \"pnpm run build:contributor\" \"pnpm run build:components\"",
|
||||
"build": "run-p build:*",
|
||||
"build:contributor": "tsx src/contributor.ts",
|
||||
"build:components": "tsx src/components.ts",
|
||||
"dev": "cross-env DEV=1 pnpm run build"
|
||||
@ -24,11 +24,11 @@
|
||||
"@element-plus/build-utils": "^0.0.1",
|
||||
"@types/lodash-es": "^4.17.6",
|
||||
"chalk": "^5.0.1",
|
||||
"concurrently": "^7.2.0",
|
||||
"consola": "^2.15.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"fast-glob": "^3.2.11",
|
||||
"lodash-es": "^4.17.21",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"octokit": "^1.7.1",
|
||||
"tsx": "^3.4.0"
|
||||
}
|
||||
|
@ -25,6 +25,12 @@
|
||||
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx,.md,.json --max-warnings 0 && pretty-quick --check --branch dev",
|
||||
"lint:fix": "eslint --fix . --ext .vue,.js,.ts,.jsx,.tsx,.md,.json && pretty-quick --branch dev",
|
||||
"lint:commit": "commitlint --from $(git merge-base dev HEAD) --to HEAD > ./commit-lint.txt",
|
||||
"typecheck": "run-p typecheck:node typecheck:vite-config",
|
||||
"typecheck:web": "vue-tsc -p tsconfig.web.json --composite false --noEmit",
|
||||
"typecheck:node": "tsc -p tsconfig.node.json --noEmit",
|
||||
"typecheck:play": "vue-tsc -p tsconfig.play.json --composite false --noEmit",
|
||||
"typecheck:vite-config": "vue-tsc -p tsconfig.vite-config.json --composite false --noEmit",
|
||||
"typecheck:vitest": "vue-tsc -p tsconfig.vitest.json --composite false --noEmit",
|
||||
"docs:dev": "pnpm run -C docs dev",
|
||||
"docs:build": "pnpm run -C docs build",
|
||||
"docs:serve": "pnpm run -C docs serve",
|
||||
@ -73,13 +79,13 @@
|
||||
"@pnpm/types": "^8.0.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/gulp": "^4.0.9",
|
||||
"@types/jsdom": "^16.2.14",
|
||||
"@types/node": "*",
|
||||
"@types/sass": "^1.43.1",
|
||||
"@vitejs/plugin-vue": "^2.3.3",
|
||||
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||
"@vitest/ui": "^0.12.6",
|
||||
"@vue/test-utils": "^2.0.0-rc.21",
|
||||
"@vue/tsconfig": "^0.1.3",
|
||||
"c8": "^7.11.3",
|
||||
"chalk": "^5.0.1",
|
||||
"concurrently": "^7.2.0",
|
||||
@ -93,6 +99,7 @@
|
||||
"husky": "^8.0.1",
|
||||
"jsdom": "16.4.0",
|
||||
"lint-staged": "^12.4.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.6.2",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"puppeteer": "^14.1.1",
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
2
play/env.d.ts
vendored
Normal file
2
play/env.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vue/macros-global" />
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"types": ["node", "vite/client", "../typings/components"],
|
||||
"paths": {
|
||||
"element-plus": ["../packages/element-plus"]
|
||||
},
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["**/*"]
|
||||
}
|
149
pnpm-lock.yaml
149
pnpm-lock.yaml
@ -26,6 +26,7 @@ importers:
|
||||
'@popperjs/core': npm:@sxzz/popperjs-es@^2.11.7
|
||||
'@types/fs-extra': ^9.0.13
|
||||
'@types/gulp': ^4.0.9
|
||||
'@types/jsdom': ^16.2.14
|
||||
'@types/lodash': ^4.14.182
|
||||
'@types/lodash-es': ^4.17.6
|
||||
'@types/node': '*'
|
||||
@ -34,7 +35,6 @@ importers:
|
||||
'@vitejs/plugin-vue-jsx': ^1.3.10
|
||||
'@vitest/ui': ^0.12.6
|
||||
'@vue/test-utils': ^2.0.0-rc.21
|
||||
'@vue/tsconfig': ^0.1.3
|
||||
'@vueuse/core': ^8.5.0
|
||||
async-validator: ^4.1.1
|
||||
c8: ^7.11.3
|
||||
@ -57,6 +57,7 @@ importers:
|
||||
lodash-unified: ^1.0.2
|
||||
memoize-one: ^6.0.0
|
||||
normalize-wheel-es: ^1.1.2
|
||||
npm-run-all: ^4.1.5
|
||||
prettier: ^2.6.2
|
||||
pretty-quick: ^3.1.3
|
||||
puppeteer: ^14.1.1
|
||||
@ -108,13 +109,13 @@ importers:
|
||||
'@pnpm/types': 8.0.1
|
||||
'@types/fs-extra': 9.0.13
|
||||
'@types/gulp': 4.0.9
|
||||
'@types/jsdom': 16.2.14
|
||||
'@types/node': 17.0.25
|
||||
'@types/sass': 1.43.1
|
||||
'@vitejs/plugin-vue': 2.3.3_vue@3.2.33
|
||||
'@vitejs/plugin-vue-jsx': 1.3.10
|
||||
'@vitest/ui': 0.12.6
|
||||
'@vue/test-utils': 2.0.0-rc.21_vue@3.2.33
|
||||
'@vue/tsconfig': 0.1.3_@types+node@17.0.25
|
||||
c8: 7.11.3
|
||||
chalk: 5.0.1
|
||||
concurrently: 7.2.0
|
||||
@ -128,6 +129,7 @@ importers:
|
||||
husky: 8.0.1
|
||||
jsdom: 16.4.0
|
||||
lint-staged: 12.4.1
|
||||
npm-run-all: 4.1.5
|
||||
prettier: 2.6.2
|
||||
pretty-quick: 3.1.3_prettier@2.6.2
|
||||
puppeteer: 14.1.1
|
||||
@ -340,11 +342,11 @@ importers:
|
||||
'@element-plus/build-utils': ^0.0.1
|
||||
'@types/lodash-es': ^4.17.6
|
||||
chalk: ^5.0.1
|
||||
concurrently: ^7.2.0
|
||||
consola: ^2.15.3
|
||||
cross-env: ^7.0.3
|
||||
fast-glob: ^3.2.11
|
||||
lodash-es: ^4.17.21
|
||||
npm-run-all: ^4.1.5
|
||||
octokit: ^1.7.1
|
||||
tsx: ^3.4.0
|
||||
devDependencies:
|
||||
@ -353,11 +355,11 @@ importers:
|
||||
'@element-plus/build-utils': link:../build-utils
|
||||
'@types/lodash-es': 4.17.6
|
||||
chalk: 5.0.1
|
||||
concurrently: 7.2.0
|
||||
consola: 2.15.3
|
||||
cross-env: 7.0.3
|
||||
fast-glob: 3.2.11
|
||||
lodash-es: 4.17.21
|
||||
npm-run-all: 4.1.5
|
||||
octokit: 1.7.1
|
||||
tsx: 3.4.0
|
||||
|
||||
@ -2882,6 +2884,14 @@ packages:
|
||||
resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==}
|
||||
dev: true
|
||||
|
||||
/@types/jsdom/16.2.14:
|
||||
resolution: {integrity: sha512-6BAy1xXEmMuHeAJ4Fv4yXKwBDTGTOseExKE3OaHiNycdHdZw59KfYzrt0DkDluvwmik1HRt6QS7bImxUmpSy+w==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.25
|
||||
'@types/parse5': 6.0.3
|
||||
'@types/tough-cookie': 4.0.2
|
||||
dev: true
|
||||
|
||||
/@types/json-schema/7.0.11:
|
||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: false
|
||||
@ -2953,6 +2963,10 @@ packages:
|
||||
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
|
||||
dev: true
|
||||
|
||||
/@types/parse5/6.0.3:
|
||||
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
|
||||
dev: true
|
||||
|
||||
/@types/resolve/1.17.1:
|
||||
resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==}
|
||||
dependencies:
|
||||
@ -2964,6 +2978,10 @@ packages:
|
||||
'@types/node': 17.0.25
|
||||
dev: true
|
||||
|
||||
/@types/tough-cookie/4.0.2:
|
||||
resolution: {integrity: sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==}
|
||||
dev: true
|
||||
|
||||
/@types/trusted-types/2.0.2:
|
||||
resolution: {integrity: sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==}
|
||||
dev: true
|
||||
@ -3443,17 +3461,6 @@ packages:
|
||||
vue: 3.2.33
|
||||
dev: true
|
||||
|
||||
/@vue/tsconfig/0.1.3_@types+node@17.0.25:
|
||||
resolution: {integrity: sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==}
|
||||
peerDependencies:
|
||||
'@types/node': '*'
|
||||
peerDependenciesMeta:
|
||||
'@types/node':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/node': 17.0.25
|
||||
dev: true
|
||||
|
||||
/@vueuse/core/8.5.0_vue@3.2.33:
|
||||
resolution: {integrity: sha512-VEJ6sGNsPlUp0o9BGda2YISvDZbhWJSOJu5zlp2TufRGVrLcYUKr31jyFEOj6RXzG3k/H4aCYeZyjpItfU8glw==}
|
||||
peerDependencies:
|
||||
@ -4801,6 +4808,17 @@ packages:
|
||||
- encoding
|
||||
dev: true
|
||||
|
||||
/cross-spawn/6.0.5:
|
||||
resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==}
|
||||
engines: {node: '>=4.8'}
|
||||
dependencies:
|
||||
nice-try: 1.0.5
|
||||
path-key: 2.0.1
|
||||
semver: 5.7.1
|
||||
shebang-command: 1.2.0
|
||||
which: 1.3.1
|
||||
dev: true
|
||||
|
||||
/cross-spawn/7.0.3:
|
||||
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
|
||||
engines: {node: '>= 8'}
|
||||
@ -7700,6 +7718,10 @@ packages:
|
||||
engines: {node: '>=4'}
|
||||
hasBin: true
|
||||
|
||||
/json-parse-better-errors/1.0.2:
|
||||
resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==}
|
||||
dev: true
|
||||
|
||||
/json-parse-even-better-errors/2.3.1:
|
||||
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
|
||||
|
||||
@ -7972,6 +7994,16 @@ packages:
|
||||
strip-bom: 2.0.0
|
||||
dev: false
|
||||
|
||||
/load-json-file/4.0.0:
|
||||
resolution: {integrity: sha1-L19Fq5HjMhYjT9U62rZo607AmTs=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
graceful-fs: 4.2.10
|
||||
parse-json: 4.0.0
|
||||
pify: 3.0.0
|
||||
strip-bom: 3.0.0
|
||||
dev: true
|
||||
|
||||
/load-json-file/6.2.0:
|
||||
resolution: {integrity: sha512-gUD/epcRms75Cw8RT1pUdHugZYM5ce64ucs2GEISABwkRsOQr0q2wm/MV2TKThycIe5e0ytRweW2RZxclogCdQ==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8219,6 +8251,11 @@ packages:
|
||||
resolution: {integrity: sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==}
|
||||
dev: false
|
||||
|
||||
/memorystream/0.3.1:
|
||||
resolution: {integrity: sha1-htcJCzDORV1j+64S3aUaR93K+bI=}
|
||||
engines: {node: '>= 0.10.0'}
|
||||
dev: true
|
||||
|
||||
/meow/8.1.2:
|
||||
resolution: {integrity: sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==}
|
||||
engines: {node: '>=10'}
|
||||
@ -8493,6 +8530,10 @@ packages:
|
||||
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
|
||||
dev: false
|
||||
|
||||
/nice-try/1.0.5:
|
||||
resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==}
|
||||
dev: true
|
||||
|
||||
/njre/0.2.0:
|
||||
resolution: {integrity: sha512-+Wq8R6VmjK+jI8a9NdzfU6Vh50r3tjsdvl5KJE1OyHeH8I/nx5Ptm12qpO3qNUbstXuZfBDgDL0qQZw9JyjhMw==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8576,6 +8617,22 @@ packages:
|
||||
once: 1.4.0
|
||||
dev: false
|
||||
|
||||
/npm-run-all/4.1.5:
|
||||
resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==}
|
||||
engines: {node: '>= 4'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
ansi-styles: 3.2.1
|
||||
chalk: 2.4.2
|
||||
cross-spawn: 6.0.5
|
||||
memorystream: 0.3.1
|
||||
minimatch: 3.1.2
|
||||
pidtree: 0.3.1
|
||||
read-pkg: 3.0.0
|
||||
shell-quote: 1.7.3
|
||||
string.prototype.padend: 3.1.3
|
||||
dev: true
|
||||
|
||||
/npm-run-path/4.0.1:
|
||||
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8865,6 +8922,14 @@ packages:
|
||||
error-ex: 1.3.2
|
||||
dev: false
|
||||
|
||||
/parse-json/4.0.0:
|
||||
resolution: {integrity: sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
error-ex: 1.3.2
|
||||
json-parse-better-errors: 1.0.2
|
||||
dev: true
|
||||
|
||||
/parse-json/5.2.0:
|
||||
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8926,6 +8991,11 @@ packages:
|
||||
resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
/path-key/2.0.1:
|
||||
resolution: {integrity: sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/path-key/3.1.1:
|
||||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8963,6 +9033,13 @@ packages:
|
||||
pinkie-promise: 2.0.1
|
||||
dev: false
|
||||
|
||||
/path-type/3.0.0:
|
||||
resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
pify: 3.0.0
|
||||
dev: true
|
||||
|
||||
/path-type/4.0.0:
|
||||
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
||||
engines: {node: '>=8'}
|
||||
@ -8998,6 +9075,12 @@ packages:
|
||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
||||
/pidtree/0.3.1:
|
||||
resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==}
|
||||
engines: {node: '>=0.10'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/pidtree/0.5.0:
|
||||
resolution: {integrity: sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==}
|
||||
engines: {node: '>=0.10'}
|
||||
@ -9009,6 +9092,11 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/pify/3.0.0:
|
||||
resolution: {integrity: sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/pinkie-promise/2.0.1:
|
||||
resolution: {integrity: sha1-ITXW36ejWMBprJsXh3YogihFD/o=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -9281,6 +9369,15 @@ packages:
|
||||
path-type: 1.1.0
|
||||
dev: false
|
||||
|
||||
/read-pkg/3.0.0:
|
||||
resolution: {integrity: sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
load-json-file: 4.0.0
|
||||
normalize-package-data: 2.5.0
|
||||
path-type: 3.0.0
|
||||
dev: true
|
||||
|
||||
/read-pkg/5.2.0:
|
||||
resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==}
|
||||
engines: {node: '>=8'}
|
||||
@ -9795,12 +9892,24 @@ packages:
|
||||
split-string: 3.1.0
|
||||
dev: false
|
||||
|
||||
/shebang-command/1.2.0:
|
||||
resolution: {integrity: sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dependencies:
|
||||
shebang-regex: 1.0.0
|
||||
dev: true
|
||||
|
||||
/shebang-command/2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
|
||||
/shebang-regex/1.0.0:
|
||||
resolution: {integrity: sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/shebang-regex/3.0.0:
|
||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||
engines: {node: '>=8'}
|
||||
@ -10100,6 +10209,15 @@ packages:
|
||||
side-channel: 1.0.4
|
||||
dev: true
|
||||
|
||||
/string.prototype.padend/3.1.3:
|
||||
resolution: {integrity: sha512-jNIIeokznm8SD/TZISQsZKYu7RJyheFNt84DUPrh482GC8RVp2MKqm2O5oBRdGxbDQoXrhhWtPIWQOiy20svUg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dependencies:
|
||||
call-bind: 1.0.2
|
||||
define-properties: 1.1.4
|
||||
es-abstract: 1.20.1
|
||||
dev: true
|
||||
|
||||
/string.prototype.trimend/1.0.5:
|
||||
resolution: {integrity: sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==}
|
||||
dependencies:
|
||||
@ -10178,7 +10296,6 @@ packages:
|
||||
/strip-bom/3.0.0:
|
||||
resolution: {integrity: sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=}
|
||||
engines: {node: '>=4'}
|
||||
dev: false
|
||||
|
||||
/strip-bom/4.0.0:
|
||||
resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==}
|
||||
|
@ -39,7 +39,7 @@ async function main() {
|
||||
await writeVersion(elementPlus)
|
||||
await writeVersion(eslintConfig)
|
||||
await writeVersion(metadata)
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
errorAndExit(err)
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||
"extends": "../tsconfig.node.json",
|
||||
"include": ["../packages/components/**/ssr/*.vue", "**/*"],
|
||||
"compilerOptions": {
|
||||
"isolatedModules": false,
|
||||
|
22
tsconfig.base.json
Normal file
22
tsconfig.base.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"target": "es2018",
|
||||
"module": "esnext",
|
||||
"baseUrl": ".",
|
||||
"sourceMap": false,
|
||||
"moduleResolution": "node",
|
||||
"allowJs": false,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"removeComments": false,
|
||||
"rootDir": ".",
|
||||
"types": [],
|
||||
"paths": {
|
||||
"@element-plus/*": ["packages/*"]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.web.json" },
|
||||
{ "path": "./tsconfig.play.json" },
|
||||
{ "path": "./tsconfig.node.json" },
|
||||
{ "path": "./tsconfig.vite-config.json" },
|
||||
{ "path": "./tsconfig.vitest.json" }
|
||||
]
|
||||
|
18
tsconfig.node.json
Normal file
18
tsconfig.node.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"lib": ["ESNext"],
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"internal/**/*",
|
||||
"internal/**/*.json",
|
||||
"scripts/**/*",
|
||||
"packages/theme-chalk/*",
|
||||
"packages/element-plus/version.ts",
|
||||
"packages/element-plus/package.json"
|
||||
],
|
||||
"exclude": ["**/__tests__/**", "**/tests/**", "**/dist"]
|
||||
}
|
18
tsconfig.play.json
Normal file
18
tsconfig.play.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "./tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"packages",
|
||||
"typings/components.d.ts",
|
||||
"env.d.ts",
|
||||
|
||||
// playground
|
||||
"play/main.ts",
|
||||
"play/env.d.ts",
|
||||
"play/src/**/*"
|
||||
]
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||
"include": ["**/vite.config.*", "**/vitest.config.*"],
|
||||
"extends": "./tsconfig.node.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node", "vitest"]
|
||||
}
|
||||
},
|
||||
"include": ["**/vite.config.*", "**/vitest.config.*", "**/vite.init.*"],
|
||||
"exclude": ["docs"]
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.node.json",
|
||||
"include": ["packages", "vitest.setup.ts"],
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"extends": "./tsconfig.web.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"lib": ["DOM"],
|
||||
"types": ["node"],
|
||||
"jsx": "preserve"
|
||||
}
|
||||
"lib": ["ES2021", "DOM", "DOM.Iterable"],
|
||||
"types": ["node", "jsdom", "vitest/globals"]
|
||||
},
|
||||
"include": ["packages", "vitest.setup.ts"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
@ -1,22 +1,18 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.web.json",
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES2018",
|
||||
"noImplicitAny": false,
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"composite": true,
|
||||
"jsx": "preserve",
|
||||
"lib": ["ES2018", "DOM", "DOM.Iterable"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"types": ["unplugin-vue-define-options"]
|
||||
},
|
||||
"include": ["packages", "typings"],
|
||||
"include": ["packages", "typings/components.d.ts", "env.d.ts"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/dist",
|
||||
"**/__tests__/**/*",
|
||||
"**/test/**",
|
||||
"**/tests/**"
|
||||
"**/gulpfile.ts",
|
||||
"**/test-helper",
|
||||
"packages/test-utils"
|
||||
]
|
||||
}
|
||||
|
4
typings/env.d.ts
vendored
4
typings/env.d.ts
vendored
@ -2,7 +2,9 @@ import type { vShow } from 'vue'
|
||||
|
||||
declare global {
|
||||
const process: {
|
||||
env: { NODE_ENV: string }
|
||||
env: {
|
||||
NODE_ENV: string
|
||||
}
|
||||
}
|
||||
|
||||
namespace JSX {
|
||||
|
Loading…
Reference in New Issue
Block a user