Skip to content

Commit

Permalink
settings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
meepobrother committed May 4, 2019
1 parent 5d390ec commit c3bb97f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"files.watcherExclude": {
"**/dist/**": true,
"**/node_modules/**": true,
"**/attachment/**": true,
"**/.temp/**": true,
}
}
6 changes: 4 additions & 2 deletions addon/nger-demo/template/app/welcome/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { View } from 'nger-ui';
]
})
export class NgerDemoAppWelcomePage {
render() {
return <View className="nger-demo"></View>
render(h: any) {
return <View className="nger-demo">
<div></div>
</View>
}
}
23 changes: 11 additions & 12 deletions packages/nger-compiler/lib/ts/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ export class NgerCompilerBabel {
return code;
}
compile(from: string, config: ts.TranspileOptions = {}) {
// 如果已经处理过了则忽略
// 拿到文件内容
let code = this.getFileContent(from, config);
// 解析
const ast = parse(code, {
sourceType: 'module',
plugins:['estree']
});
// 替换处理
traverse(ast, this.visitor || {});
code = generator(ast).code;
return code;
try{
// 如果已经处理过了则忽略
// 拿到文件内容
let code = this.getFileContent(from, config);
// 解析
const ast = parse(code, {});
// 替换处理
traverse(ast, this.visitor || {});
code = generator(ast).code;
return code;
}catch(e){}
}
}
31 changes: 29 additions & 2 deletions packages/nger-platform-browser/lib/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,34 @@
import { ApplicationRef, ComponentFactory, ComponentRef, ElementRef, ComponentFactoryResolver, ComponentMetadataKey } from 'nger-core'
import { Injector, Type, InjectFlags } from 'nger-di'
const { render, h } = require('preact');
(window as any).h = h;
export function ngerRender(injector: Injector) {
return (vnode: any, parent: any, replaceNode?: any) => {

}
}
export function ngerCreateElement(injector: Injector) {
return (tag: any, attr: any, ...children) => {
if (tag === 'string') {
return {
tag,
attr,
children,
injector
}
} else {
const resolver = injector.get(ComponentFactoryResolver)
const factory = resolver.resolveComponentFactory(tag)
const ref = factory.create(injector);
if (ref) { }
}
}
}
(window as any).h = (injector: Injector) => (tag, attr, ...children) => {
if (typeof tag === 'string') {
} else {

}
};
export class BrowserApplicationRef extends ApplicationRef {
root = document.getElementById('app') as HTMLDivElement;
constructor(injector: Injector) {
Expand Down Expand Up @@ -39,7 +66,7 @@ export class BrowserApplicationRef extends ApplicationRef {
}
} catch (e) {
console.error({
ref,
ref,
injector,
e
})
Expand Down
4 changes: 0 additions & 4 deletions packages/nger-webpack/lib/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ export class NgerWebpackManager {
console.log((message || err) + '\n')
}
} else {
if(stats.hasErrors()){
const errors = stats.toJson().errors;
console.log(errors)
}
this.logger.info(`系统构建成功${new Date().getTime() - this.startTime}ms`);
}
}
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ nger start [-p 4200]
- [ ] nger start 启动框架
- [ ] nger publish nger-demo 发布模块

## 联系or资助
## 合作洽谈-聊天交友-技术交流
<p>
<img height="320" src="./docs/WechatIMG95.jpeg">
<img height="320" style="margin-left:30px;" src="./wechat.png">
</p>
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"node_modules",
"platforms",
"typings",
"**/*.aot.ts"
"**/*.aot.ts",
"node_modules/preact/dist/preact.d.ts"
]
}

0 comments on commit c3bb97f

Please sign in to comment.