mirror of https://github.com/vuejs/core.git
chore(types): perform strict es2016 lib check when building dts
This commit is contained in:
parent
7ae9dbf57d
commit
2ae908d00c
|
@ -6,7 +6,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.js",
|
"dev": "node scripts/dev.js",
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
"build-dts": "tsc -p tsconfig.build.json && rollup -c rollup.dts.config.js",
|
"build-dts": "tsc -p tsconfig.build-browser.json && tsc -p tsconfig.build-node.json && rollup -c rollup.dts.config.js",
|
||||||
"clean": "rimraf packages/*/dist temp .eslintcache",
|
"clean": "rimraf packages/*/dist temp .eslintcache",
|
||||||
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
|
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
|
||||||
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
|
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
type StylePreprocessorResults,
|
type StylePreprocessorResults,
|
||||||
processors,
|
processors,
|
||||||
} from './style/preprocessors'
|
} from './style/preprocessors'
|
||||||
import type { RawSourceMap } from 'source-map-js'
|
import type { RawSourceMap } from '@vue/compiler-core'
|
||||||
import { cssVarsPlugin } from './style/cssVars'
|
import { cssVarsPlugin } from './style/cssVars'
|
||||||
import postcssModules from 'postcss-modules'
|
import postcssModules from 'postcss-modules'
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,11 @@ import {
|
||||||
type NodeTransform,
|
type NodeTransform,
|
||||||
NodeTypes,
|
NodeTypes,
|
||||||
type ParserOptions,
|
type ParserOptions,
|
||||||
|
type RawSourceMap,
|
||||||
type RootNode,
|
type RootNode,
|
||||||
createRoot,
|
createRoot,
|
||||||
} from '@vue/compiler-core'
|
} from '@vue/compiler-core'
|
||||||
import {
|
import { SourceMapConsumer, SourceMapGenerator } from 'source-map-js'
|
||||||
type RawSourceMap,
|
|
||||||
SourceMapConsumer,
|
|
||||||
SourceMapGenerator,
|
|
||||||
} from 'source-map-js'
|
|
||||||
import {
|
import {
|
||||||
type AssetURLOptions,
|
type AssetURLOptions,
|
||||||
type AssetURLTagConfig,
|
type AssetURLTagConfig,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import merge from 'merge-source-map'
|
import merge from 'merge-source-map'
|
||||||
import type { RawSourceMap } from 'source-map-js'
|
import type { RawSourceMap } from '@vue/compiler-core'
|
||||||
import type { SFCStyleCompileOptions } from '../compileStyle'
|
import type { SFCStyleCompileOptions } from '../compileStyle'
|
||||||
import { isFunction } from '@vue/shared'
|
import { isFunction } from '@vue/shared'
|
||||||
|
|
||||||
|
|
|
@ -427,15 +427,14 @@ function applySingletonPrototype(app: App, Ctor: Function) {
|
||||||
app.config.globalProperties = Object.create(Ctor.prototype)
|
app.config.globalProperties = Object.create(Ctor.prototype)
|
||||||
}
|
}
|
||||||
let hasPrototypeAugmentations = false
|
let hasPrototypeAugmentations = false
|
||||||
const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype)
|
for (const key of Object.getOwnPropertyNames(Ctor.prototype)) {
|
||||||
for (const key in descriptors) {
|
|
||||||
if (key !== 'constructor') {
|
if (key !== 'constructor') {
|
||||||
hasPrototypeAugmentations = true
|
hasPrototypeAugmentations = true
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
Object.defineProperty(
|
Object.defineProperty(
|
||||||
app.config.globalProperties,
|
app.config.globalProperties,
|
||||||
key,
|
key,
|
||||||
descriptors[key],
|
Object.getOwnPropertyDescriptor(Ctor.prototype, key)!,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,9 @@ export const toNumber = (val: any): any => {
|
||||||
return isNaN(n) ? val : n
|
return isNaN(n) ? val : n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for typeof global checks without @types/node
|
||||||
|
declare var global: {}
|
||||||
|
|
||||||
let _globalThis: any
|
let _globalThis: any
|
||||||
export const getGlobalThis = (): any => {
|
export const getGlobalThis = (): any => {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -54,4 +54,6 @@ const replacer = (_key: string, val: any): any => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const stringifySymbol = (v: unknown, i: number | string = ''): any =>
|
const stringifySymbol = (v: unknown, i: number | string = ''): any =>
|
||||||
isSymbol(v) ? `Symbol(${v.description ?? i})` : v
|
// Symbol.description in es2019+ so we need to cast here to pass
|
||||||
|
// the lib: es2016 check
|
||||||
|
isSymbol(v) ? `Symbol(${(v as any).description ?? i})` : v
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": [],
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"stripInternal": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"packages/global.d.ts",
|
||||||
|
"packages/vue/src",
|
||||||
|
"packages/vue-compat/src",
|
||||||
|
"packages/compiler-core/src",
|
||||||
|
"packages/compiler-dom/src",
|
||||||
|
"packages/runtime-core/src",
|
||||||
|
"packages/runtime-dom/src",
|
||||||
|
"packages/reactivity/src",
|
||||||
|
"packages/shared/src"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["node"],
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"stripInternal": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"packages/global.d.ts",
|
||||||
|
"packages/compiler-sfc/src",
|
||||||
|
"packages/compiler-ssr/src",
|
||||||
|
"packages/server-renderer/src"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
"stripInternal": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"packages/*/__tests__",
|
|
||||||
"packages/runtime-test",
|
|
||||||
"packages/template-explorer",
|
|
||||||
"packages/sfc-playground",
|
|
||||||
"packages/dts-test",
|
|
||||||
"packages/dts-built-test"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue