Skip to content

Commit

Permalink
refactor: tweak devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 17, 2020
1 parent b0c9471 commit 06884c8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
6 changes: 0 additions & 6 deletions packages/runtime-dom/src/devtools.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/runtime-dom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { nodeOps } from './nodeOps'
import { patchProp } from './patchProp'
// Importing from the compiler, will be tree-shaken in prod
import { isFunction, isString, isHTMLTag, isSVGTag, extend } from '@vue/shared'
import './devtools'

declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
Expand Down
16 changes: 16 additions & 0 deletions packages/vue/src/dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { version, setDevtoolsHook } from '@vue/runtime-dom'

export function initDev() {
const target: any = __BROWSER__ ? window : global

target.__VUE__ = version
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__)

if (__BROWSER__) {
// @ts-ignore `console.info` cannot be null error
console[console.info ? 'info' : 'log'](
`You are running a development build of Vue.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`
)
}
}
7 changes: 0 additions & 7 deletions packages/vue/src/devCheck.ts

This file was deleted.

4 changes: 3 additions & 1 deletion packages/vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// This entry is the "full-build" that includes both the runtime
// and the compiler, and supports on-the-fly compilation of the template option.
import './devCheck'
import { initDev } from './dev'
import { compile, CompilerOptions, CompilerError } from '@vue/compiler-dom'
import { registerRuntimeCompiler, RenderFunction, warn } from '@vue/runtime-dom'
import * as runtimeDom from '@vue/runtime-dom'
import { isString, NOOP, generateCodeFrame, extend } from '@vue/shared'

__DEV__ && initDev()

const compileCache: Record<string, RenderFunction> = Object.create(null)

function compileToFunction(
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// This entry exports the runtime only, and is built as
// `dist/vue.esm-bundler.js` which is used by default for bundlers.
import './devCheck'
import { initDev } from './dev'
import { warn } from '@vue/runtime-dom'

__DEV__ && initDev()

export * from '@vue/runtime-dom'

export const compile = () => {
Expand Down

0 comments on commit 06884c8

Please sign in to comment.