Open huixisheng opened 5 years ago
this Compile {
_hooks:
{ 'before-compiler-less': [ [Function: styleHooker] ],
'before-compiler-sass': [ [Function: styleHooker] ],
'before-compiler-stylus': [ [Function: styleHooker] ],
'output-app': [ [Function] ],
'output-pages': [ [Function] ],
'output-components': [ [Function] ],
'output-vendor': [ [Function] ],
'output-assets': [ [Function] ],
'output-static': [ [Function] ],
'script-dep-fix': [ [Function: scriptDepFix] ],
'script-injection': [ [Function: scriptInjection] ],
'build-app': [ [Function: buildApp] ],
'build-pages': [ [Function: buildPages] ],
'build-components': [ [Function: buildComponents] ],
'build-vendor': [ [Function: buildPages] ],
'build-assets': [ [Function: buildAssets] ],
'template-parse-ast-attr': [ [Function: parseAstAttr] ],
'template-parse-ast-tag': [ [Function: parseAstTag] ],
'template-parse-ast': [ [Function: parseAST] ],
'template-parse-ast-to-str': [ [Function: astToStr] ],
'template-parse': [ [Function: parse] ],
'template-parse-ast-attr-:class': [ [Function: parseBindClass] ],
'template-parse-ast-attr-:style': [ [Function: parseBindClass] ],
'url-to-module': [ [Function: urlToModule] ],
'template-parse-ast-attr-src': [ [Function: parseAssetUrl] ],
'template-parse-ast-attr-ref': [ [Function: parseRef] ],
'template-parse-ast-attr-v-show': [ [Function: v-show] ],
'template-parse-ast-attr-v-if': [ [Function: v-if] ],
'template-parse-ast-attr-v-else-if': [ [Function: v-else-if] ],
'template-parse-ast-attr-v-else': [ [Function: v-else] ],
'template-parse-ast-attr-v-bind': [ [Function: parseAstBind] ],
'template-parse-ast-pre-attr-v-for': [ [Function: preParseDirectivesFor] ],
'template-parse-ast-attr-v-for': [ [Function: parseDirectivesFor] ],
'template-parse-ast-attr-v-model': [ [Function: parseVModel] ],
'template-parse-ast-attr-v-model-apply': [ [Function: parseVModelApply] ],
'template-parse-ast-attr-[other]': [ [Function: parseDirectivesFor] ],
'template-parse-ast-attr-[other]-apply': [ [Function: applyDirective] ],
'template-parse-ast-attr-v-on': [ [Function: parseAstOn] ],
'template-parse-ast-attr-v-on-apply': [ [Function: parseBindClass] ],
'pre-check-sfc': [ [Function] ],
'sfc-custom-block': [ [Function] ],
'sfc-custom-block-config': [ [Function] ],
'sfc-custom-block-wxs': [ [Function] ],
'gen-code-frame': [ [Function] ],
'gen-code-frame-html': [ [Function] ],
'error-handler': [ [Function] ],
'error-handler-script': [ [Function] ],
'error-handler-template': [ [Function] ],
'wepy-compiler-js': [ [Function] ],
'wepy-compiler-json': [ [Function] ],
'wepy-compiler-css': [ [Function] ],
'wepy-compiler-wxml': [ [Function] ],
'wepy-compiler-wxss': [ [Function] ],
'wepy-parser-wpy': [ [Function] ],
'wepy-parser-dep': [ [Function] ],
'wepy-parser-script': [ [Function] ],
'wepy-parser-style': [ [Function] ],
'wepy-parser-template': [ [Function] ],
'wepy-parser-config': [ [Function] ],
'wepy-parser-config-component-module': [ [Function] ],
'wepy-parser-config-component-path': [ [Function] ],
'wepy-parser-component': [ [Function] ],
'wepy-parser-wxs': [ [Function] ],
'wepy-compiler-less': [ [Function] ],
'wepy-compiler-babel': [ [Function] ] },
version: '2.0.0-alpha.1',
options:
{ entry: '/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy',
src: 'src',
target: 'weapp',
static: 'static',
output: 'weapp',
wpyExt: '.wpy',
eslint: true,
cliLogs: true,
resolve:
{ alias: [Object],
aliasFields: [Array],
modules: [Array],
extensions: [Array] },
compilers: { less: [Object], babel: [Object] },
plugins: [],
appConfig: { noPromiseAPI: [Array] },
watch: true,
noCache: false },
compiled:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy': { sfc: [Object] },
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index': {},
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy': { sfc: [Object] } },
involved:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/common/eventHub.js': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime-module.js': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime.js': 1,
'/Users/huixisheng/WorkspacesContribution/wepy/packages/core/dist/wepy.js': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/mixins/test.js': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index.js': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index.wxml': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/indexwxss': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index.json': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy': 1 },
vendors:
ModuleSet {
_index: 3,
_map:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime-module.js': 0,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime.js': 1,
'/Users/huixisheng/WorkspacesContribution/wepy/packages/core/dist/wepy.js': 2,
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index': 3 },
_set:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime.js': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime-module.js': [Object],
'/Users/huixisheng/WorkspacesContribution/wepy/packages/core/dist/wepy.js': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index': [Object] },
_array:
{ '0':
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime-module.js',
'1':
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime.js',
'2':
'/Users/huixisheng/WorkspacesContribution/wepy/packages/core/dist/wepy.js',
'3':
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index',
length: 4 },
_type:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime-module.js': 'require',
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/regenerator-runtime/runtime.js': 'require',
'/Users/huixisheng/WorkspacesContribution/wepy/packages/core/dist/wepy.js': 'require',
'/Users/huixisheng/x/lab/miniapp/wepy2/node_modules/miniprogram-slide-view/miniprogram_dist/index': 'require' },
length: 4 },
assets:
ModuleSet {
_index: 8,
_map:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/src/common/eventHub.js': 0,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy': 1,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/mixins/test.js': 2,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy': 3,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy': 4,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy': 5,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy': 6,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy': 7,
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy': 8 },
_set:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/src/common/eventHub.js': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/mixins/test.js': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy': [Object],
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy': [Object] },
_array:
{ '0':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/common/eventHub.js',
'1': '/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy',
'2': '/Users/huixisheng/x/lab/miniapp/wepy2/src/mixins/test.js',
'3': '/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy',
'4':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy',
'5':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy',
'6':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy',
'7':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy',
'8':
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy',
length: 9 },
_type:
{ '/Users/huixisheng/x/lab/miniapp/wepy2/src/common/eventHub.js': 'require',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/app.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/mixins/test.js': 'require',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/pages/index.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/panel.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/group.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/counter.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/wepy-list.wpy': 'component',
'/Users/huixisheng/x/lab/miniapp/wepy2/src/components/groupitem.wpy': 'component' },
length: 9 },
resolvers:
{ normal:
Resolver {
_pluginCompat: [SyncBailHook],
fileSystem: [CachedInputFileSystem],
hooks: [Object],
resolveSync: [Function],
resolve: [Function] },
context:
Resolver {
_pluginCompat: [SyncBailHook],
fileSystem: [CachedInputFileSystem],
hooks: [Object],
resolveSync: [Function],
resolve: [Function] } },
context: '/Users/huixisheng/x/lab/miniapp/wepy2',
tags:
{ htmlTags:
[ 'html',
'link',
'meta',
'style',
'title',
'body',
'address',
'article',
'aside',
'footer',
'header',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hgroup',
'nav',
'section',
'blockquote',
'dd',
'dir',
'div',
'dl',
'dt',
'figcaption',
'figure',
'hr',
'li',
'main',
'ol',
'p',
'pre',
'ul',
'a',
'abbr',
'b',
'bdi',
'bdo',
'br',
'cite',
'code',
'data',
'dfn',
'em',
'i',
'kdb',
'mark',
'nobr',
'q',
'rp',
'rt',
'rtc',
'ruby',
's',
'samp',
'small',
'span',
'strong',
'sub',
'sup',
'time',
'tt',
'u',
'var',
'wbr',
'area',
'audio',
'img',
'map',
'track',
'video',
'applet',
'embed',
'iframe',
'noembed',
'object',
'param',
'picture',
'source',
'canvas',
'noscript',
'script',
'del',
'ins',
'caption',
'col',
'colgroup',
'table',
'tbody',
'td',
'tfoot',
'th',
'thead',
'tr',
'button',
'datalist',
'fieldset',
'form',
... 51 more items ],
wxmlTags:
[ 'block',
'view',
'scroll-view',
'swiper',
'movable-view',
'cover-view',
'icon',
'text',
'rich-text',
'progress',
'button',
'checkbox',
'form',
'input',
'label',
'picker',
'picker-view',
'radio',
'slider',
'switch',
'textarea',
'navigator',
'image',
'video',
'camera',
'live-player',
'live-pusher',
'map',
'canvas',
'slot',
'open-data',
'web-view',
'ad' ],
html2wxmlMap:
{ select: 'picker',
datalist: 'picker',
img: 'image',
source: 'audio',
video: 'video',
track: 'video',
a: 'navigator',
span: 'label',
'contact-button': 'contact-button',
'wx-template': 'template' } },
logger:
{ info: [Function],
silly: [Function],
verbose: [Function],
http: [Function],
timing: [Function],
notice: [Function],
silent: [Function],
warn: [Function],
error: [Function],
level: [Function] },
inputFileSystem:
CachedInputFileSystem {
fileSystem: NodeJsInputFileSystem {},
_statStorage:
Storage {
duration: 60000,
running: Map {},
data: [Map],
levels: [Array],
count: 80,
interval:
Timeout {
_called: true,
_idleTimeout: 530,
_idlePrev: [Timeout],
_idleNext: [Timeout],
_idleStart: 5897,
_onTimeout: [Function: bound tick],
_timerArgs: undefined,
_repeat: 530,
_destroyed: false,
[Symbol(unrefed)]: false,
[Symbol(asyncId)]: 21,
[Symbol(triggerId)]: 14 },
needTickCheck: false,
nextTick: null,
passive: false,
tick: [Function: bound tick] },
_readdirStorage:
Storage {
duration: 60000,
running: Map {},
data: Map {},
levels: [Array],
count: 0,
interval: null,
needTickCheck: false,
nextTick: null,
passive: true,
tick: [Function: bound tick] },
_readFileStorage:
Storage {
duration: 60000,
running: Map {},
data: [Map],
levels: [Array],
count: 34,
interval:
Timeout {
_called: true,
_idleTimeout: 530,
_idlePrev: [Timeout],
_idleNext: [TimersList],
_idleStart: 5897,
_onTimeout: [Function: bound tick],
_timerArgs: undefined,
_repeat: 530,
_destroyed: false,
[Symbol(unrefed)]: false,
[Symbol(asyncId)]: 11,
[Symbol(triggerId)]: 10 },
needTickCheck: false,
nextTick: null,
passive: true,
tick: [Function: bound tick] },
_readJsonStorage:
Storage {
duration: 60000,
running: Map {},
data: [Map],
levels: [Array],
count: 34,
interval:
Timeout {
_called: true,
_idleTimeout: 530,
_idlePrev: [Timeout],
_idleNext: [Timeout],
_idleStart: 5897,
_onTimeout: [Function: bound tick],
_timerArgs: undefined,
_repeat: 530,
_destroyed: false,
[Symbol(unrefed)]: false,
[Symbol(asyncId)]: 13,
[Symbol(triggerId)]: 10 },
needTickCheck: false,
nextTick: null,
passive: false,
tick: [Function: bound tick] },
_readlinkStorage:
Storage {
duration: 60000,
running: Map {},
data: [Map],
levels: [Array],
count: 86,
interval:
Timeout {
_called: true,
_idleTimeout: 530,
_idlePrev: [TimersList],
_idleNext: [Timeout],
_idleStart: 5897,
_onTimeout: [Function: bound tick],
_timerArgs: undefined,
_repeat: 530,
_destroyed: false,
[Symbol(unrefed)]: false,
[Symbol(asyncId)]: 106,
[Symbol(triggerId)]: 88 },
needTickCheck: false,
nextTick: null,
passive: false,
tick: [Function: bound tick] },
_stat: [Function: bound bound ],
_statSync: [Function: bound bound ],
_readdir: [Function: bound readdir],
_readdirSync: [Function: bound readdirSync],
_readFile: [Function: bound bound readFile],
_readFileSync: [Function: bound bound readFileSync],
_readJson: [Function],
_readJsonSync: [Function],
_readlink: [Function: bound bound readlink],
_readlinkSync: [Function: bound bound readlinkSync] },
watchInitialized: true }
发现部分代码是无用的,阅读的时候有点干扰 output-pages 无用
使用
lerna
包管理工具Compile编译器实例继承Hook(类试webpack tapable)生成相关生命周期的钩子。提供了同步异步执行的方法
使用
vue-template-compiler
解析.wpy
文件 使用chokidar
进行文件watch
enhanced-resolve/lib/CachedInputFileSystem
文件缓存 ResolverFactory, NodeJsInputFileSystem, CachedInputFileSystem, enhanced-resolve/lib/node enhanced-resolvemoduleSet 存储入口文件和对应的依赖
Compile init->start->watch
解析流程
wepy-parser-wpy
过程output-pages 无用