diff --git a/packages/compiler/package.json b/packages/compiler/package.json index 4f04b367..0e3866a3 100644 --- a/packages/compiler/package.json +++ b/packages/compiler/package.json @@ -4,7 +4,7 @@ "description": "@vue/compiler", "main": "index.js", "module": "dist/compiler.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", diff --git a/packages/core/package.json b/packages/core/package.json index 17d243c2..3cfd3367 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,7 +4,7 @@ "description": "@vue/core", "main": "index.js", "module": "dist/core.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", diff --git a/packages/observer/package.json b/packages/observer/package.json index d12346c8..da6feeac 100644 --- a/packages/observer/package.json +++ b/packages/observer/package.json @@ -4,7 +4,7 @@ "description": "@vue/observer", "main": "index.js", "module": "dist/observer.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "unpkg": "dist/observer.global.js", "sideEffects": false, "repository": { diff --git a/packages/renderer-dom/package.json b/packages/renderer-dom/package.json index b5a33ed9..5626e486 100644 --- a/packages/renderer-dom/package.json +++ b/packages/renderer-dom/package.json @@ -4,7 +4,7 @@ "description": "@vue/renderer-dom", "main": "index.js", "module": "dist/renderer-dom.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "unpkg": "dist/renderer-dom.global.js", "sideEffects": false, "buildOptions": { diff --git a/packages/renderer-server/package.json b/packages/renderer-server/package.json index 2c1ee256..6340c6fa 100644 --- a/packages/renderer-server/package.json +++ b/packages/renderer-server/package.json @@ -3,7 +3,7 @@ "version": "3.0.0-alpha.1", "description": "@vue/renderer-server", "main": "index.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "buildOptions": { "formats": ["cjs"] }, diff --git a/packages/renderer-test/package.json b/packages/renderer-test/package.json index 8984a70f..0427f6e9 100644 --- a/packages/renderer-test/package.json +++ b/packages/renderer-test/package.json @@ -4,7 +4,7 @@ "description": "@vue/renderer-test", "main": "index.js", "module": "dist/renderer-test.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/vuejs/vue.git" diff --git a/packages/scheduler/package.json b/packages/scheduler/package.json index 60b35db1..397fdc2a 100644 --- a/packages/scheduler/package.json +++ b/packages/scheduler/package.json @@ -4,7 +4,7 @@ "description": "@vue/scheduler", "main": "index.js", "module": "dist/scheduler.esm-bundler.js", - "typings": "dist/index.d.ts", + "types": "dist/index.d.ts", "sideEffects": false, "repository": { "type": "git", diff --git a/packages/vue/package.json b/packages/vue/package.json index 45b9e306..6b748c03 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -4,7 +4,6 @@ "description": "vue", "main": "index.js", "module": "dist/vue.esm-bundler.js", - "typings": "dist/index.d.ts", "unpkg": "dist/vue.global.js", "sideEffects": false, "buildOptions": { diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index 6ae92e1e..72fa6708 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -6,12 +6,13 @@ import { createComponentClassFromOptions } from '@vue/renderer-dom' -class Vue { - static h = h - static render = render - static nextTick = nextTick +// Note: typing for this is intentionally loose, as it will be using 2.x types. + +class Vue { + static h: any = h + static render: any = render + static nextTick: any = nextTick - // Note: typing for this is intentionally loose, as it will be using 2.x types. constructor(options: any) { // convert it to a class const Component = createComponentClassFromOptions(options || {}) diff --git a/scripts/build.js b/scripts/build.js index 47d7e446..e65ea810 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -43,6 +43,7 @@ async function buildAll(targets) { async function build(target) { const pkgDir = path.resolve(`packages/${target}`) + const pkg = require(`${pkgDir}/package.json`) await fs.remove(`${pkgDir}/dist`) @@ -58,16 +59,20 @@ async function build(target) { { stdio: 'inherit' } ) - const dtsOptions = { - name: target === 'vue' ? target : `@vue/${target}`, - main: `${pkgDir}/dist/packages/${target}/src/index.d.ts`, - out: `${pkgDir}/dist/index.d.ts` - } - dts.bundle(dtsOptions) - console.log() - console.log(chalk.blue(chalk.bold(`generated typings at ${dtsOptions.out}`))) + if (pkg.types) { + const dtsOptions = { + name: target === 'vue' ? target : `@vue/${target}`, + main: `${pkgDir}/dist/packages/${target}/src/index.d.ts`, + out: `${pkgDir}/${pkg.types}` + } + dts.bundle(dtsOptions) + console.log() + console.log( + chalk.blue(chalk.bold(`generated typings at ${dtsOptions.out}`)) + ) - await fs.remove(`${pkgDir}/dist/packages`) + await fs.remove(`${pkgDir}/dist/packages`) + } } function checkAllSizes(targets) { diff --git a/scripts/utils.js b/scripts/utils.js index 627ed740..8aca7cab 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -1,7 +1,14 @@ const fs = require('fs') const targets = (exports.targets = fs.readdirSync('packages').filter(f => { - return f !== 'shared' && fs.statSync(`packages/${f}`).isDirectory() + if (!fs.statSync(`packages/${f}`).isDirectory()) { + return false + } + const pkg = require(`../packages/${f}/package.json`) + if (pkg.private) { + return false + } + return true })) exports.fuzzyMatchTarget = partialTarget => {