workflow: adjust esm-bundler build file name

This commit is contained in:
Evan You 2018-09-19 21:51:21 -04:00
parent 77d57813eb
commit 38109fe915
15 changed files with 43 additions and 67 deletions

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm.js",
"module": "dist/compiler-core.esm-bundler.js",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm.js",
"module": "dist/compiler-dom.esm-bundler.js",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/compiler-server",
"main": "index.js",
"module": "dist/compiler-server.esm.js",
"module": "dist/compiler-server.esm-bundler.js",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/core",
"main": "index.js",
"module": "dist/core.esm.js",
"module": "dist/core.esm-bundler.js",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",

View File

@ -1283,7 +1283,7 @@ export function createRenderer(options: RendererOptions) {
// API -----------------------------------------------------------------------
function render(vnode: VNode | null, container: RenderNode) {
function render(vnode: VNode | null, container: any) {
const prevVNode = container.vnode
if (vnode && vnode.el) {
vnode = cloneVNode(vnode)

View File

@ -22,7 +22,7 @@ type ElementType =
| typeof Portal
export interface createElement {
(tag: ElementType, data: any, children: any): VNode
(tag: ElementType, data?: any, children?: any): VNode
c: typeof createComponentVNode
e: typeof createElementVNode
t: typeof createTextVNode
@ -30,7 +30,7 @@ export interface createElement {
p: typeof createPortal
}
export const h = ((tag: ElementType, data: any, children: any): VNode => {
export const h = ((tag: ElementType, data?: any, children?: any): VNode => {
if (Array.isArray(data) || (data !== void 0 && typeof data !== 'object')) {
children = data
data = null

View File

@ -4,23 +4,11 @@ export { cloneVNode, createPortal, createFragment } from './vdom'
export { createRenderer } from './createRenderer'
import { Component as InternalComponent, ComponentClass } from './component'
// the public component constructor with proper type inference.
export const Component = InternalComponent as ComponentClass
// observer api
export {
autorun,
stop,
observable,
immutable,
computed,
isObservable,
isImmutable,
markImmutable,
markNonReactive,
unwrap
} from '@vue/observer'
export * from '@vue/observer'
// flags & types
export { FunctionalComponent } from './component'

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/observer",
"main": "index.js",
"module": "dist/observer.esm.js",
"module": "dist/observer.esm-bundler.js",
"typings": "dist/index.d.ts",
"unpkg": "dist/observer.global.js",
"repository": {

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/renderer-dom",
"main": "index.js",
"module": "dist/renderer-dom.esm.js",
"module": "dist/renderer-dom.esm-bundler.js",
"typings": "dist/index.d.ts",
"unpkg": "dist/renderer-dom.global.js",
"buildOptions": {

View File

@ -1,46 +1,23 @@
import {
h,
cloneVNode,
createPortal,
Component,
createRenderer
} from '@vue/core'
import { queueJob, nextTick } from '@vue/scheduler'
import { createRenderer, VNode } from '@vue/core'
import { queueJob } from '@vue/scheduler'
import { nodeOps } from './nodeOps'
import { patchData } from './patchData'
import { teardownVNode } from './teardownVNode'
const { render } = createRenderer({
const { render: _render } = createRenderer({
queueJob,
nodeOps,
patchData,
teardownVNode
})
// important: inline the definition for nextTick
const publicNextTick = nextTick as (fn: Function) => Promise<void>
type publicRender = (node: VNode | null, container: HTMLElement) => void
export const render = _render as publicRender
export {
h,
cloneVNode,
createPortal,
Component,
render,
publicNextTick as nextTick
}
// nextTick from scheduler
export { nextTick } from '@vue/scheduler'
// also expose observer API
export {
autorun,
stop,
observable,
immutable,
computed,
isObservable,
isImmutable,
markImmutable,
markNonReactive,
unwrap
} from '@vue/core'
// re-export everything from core
// h, Component, observer API, flags & types
export * from '@vue/core'

View File

@ -3,8 +3,10 @@
"version": "3.0.0-alpha.1",
"description": "@vue/renderer-server",
"main": "index.js",
"module": "dist/renderer-server.esm.js",
"typings": "dist/index.d.ts",
"buildOptions": {
"formats": ["cjs"]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue.git"

View File

@ -3,7 +3,7 @@
"version": "3.0.0-alpha.1",
"description": "@vue/scheduler",
"main": "index.js",
"module": "dist/scheduler.esm.js",
"module": "dist/scheduler.esm-bundler.js",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",

View File

@ -18,7 +18,10 @@ const packageOptions = pkg.buildOptions || {}
// build aliases dynamically
const aliasOptions = { resolve: ['.ts'] }
fs.readdirSync(packagesDir).forEach(dir => {
if (fs.statSync(path.resolve(packagesDir, dir)).isDirectory()) {
if (
dir !== 'vue' &&
fs.statSync(path.resolve(packagesDir, dir)).isDirectory()
) {
aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`)
}
})
@ -71,6 +74,7 @@ function createConfig(output, plugins = []) {
const isGlobalBuild = /\.global(\.prod)?\.js$/.test(output.file)
const isBunlderESMBuild = /\.esm\.js$/.test(output.file)
const isBrowserESMBuild = /esm-browser(\.prod)?\.js$/.test(output.file)
const isCompat = /dist\/vue\./.test(output.file)
if (isGlobalBuild) {
output.name = packageOptions.name
@ -100,7 +104,7 @@ function createConfig(output, plugins = []) {
plugins: [
tsPlugin,
aliasPlugin,
createReplacePlugin(isProductionBuild, isBunlderESMBuild),
createReplacePlugin(isProductionBuild, isBunlderESMBuild, isCompat),
...plugins
],
output,
@ -112,7 +116,7 @@ function createConfig(output, plugins = []) {
}
}
function createReplacePlugin(isProduction, isBunlderESMBuild) {
function createReplacePlugin(isProduction, isBunlderESMBuild, isCompat) {
return replace({
__DEV__: isBunlderESMBuild
? // preserve to be handled by bundlers
@ -120,7 +124,7 @@ function createReplacePlugin(isProduction, isBunlderESMBuild) {
: // hard coded dev/prod builds
!isProduction,
// compatibility builds
__COMPAT__: !!process.env.COMPAT
__COMPAT__: !!packageOptions.compat
})
}

View File

@ -21,7 +21,7 @@ files.forEach(shortName => {
version: baseVersion,
description: name,
main: 'index.js',
module: `dist/${shortName}.esm.js`,
module: `dist/${shortName}.esm-bundler.js`,
typings: 'dist/index.d.ts',
repository: {
type: 'git',

View File

@ -21,7 +21,12 @@
"paths": {
"@vue/core": ["packages/core/src"],
"@vue/observer": ["packages/observer/src"],
"@vue/scheduler": ["packages/scheduler/src"]
"@vue/scheduler": ["packages/scheduler/src"],
"@vue/renderer-dom": ["packages/renderer-dom/src"],
"@vue/renderer-server": ["packages/renderer-server/src"],
"@vue/compiler-core": ["packages/compiler-core/src"],
"@vue/compiler-dom": ["packages/compiler-dom/src"],
"@vue/compiler-server": ["packages/compiler-server/src"]
}
},
"include": [