diff --git a/examples/event/.pages.yaml b/examples/event/.pages.yaml new file mode 100644 index 0000000..cb7651c --- /dev/null +++ b/examples/event/.pages.yaml @@ -0,0 +1,5 @@ +routes: + - path: "**" + js: + exec: "index.js" + debug: true diff --git a/examples/event/index.html b/examples/event/index.html new file mode 100644 index 0000000..be95f65 --- /dev/null +++ b/examples/event/index.html @@ -0,0 +1,12 @@ + + + + + + + JS 概念验证 + + + + \ No newline at end of file diff --git a/examples/event/index.js b/examples/event/index.js new file mode 100644 index 0000000..e530f1c --- /dev/null +++ b/examples/event/index.js @@ -0,0 +1,18 @@ +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +console.log('boot'); +(async () => { + console.log(0); + await sleep(1000); + console.log(1000); + await sleep(1000); + console.log(2000); + await sleep(1000); + console.log(3000); + await sleep(1000); + console.log(4000); + await sleep(1000); + console.log(5000); +})(); +console.log('boot end'); \ No newline at end of file diff --git a/examples/HelloWorld/index.html b/examples/hello_world/index.html similarity index 100% rename from examples/HelloWorld/index.html rename to examples/hello_world/index.html diff --git a/examples/JS/.pages.yaml b/examples/js/.pages.yaml similarity index 100% rename from examples/JS/.pages.yaml rename to examples/js/.pages.yaml diff --git a/examples/JS/index.html b/examples/js/index.html similarity index 100% rename from examples/JS/index.html rename to examples/js/index.html diff --git a/examples/JS/index.js b/examples/js/index.js similarity index 100% rename from examples/JS/index.js rename to examples/js/index.js diff --git a/examples/JS/json.js b/examples/js/json.js similarity index 100% rename from examples/JS/json.js rename to examples/js/json.js diff --git a/pkg/core/domain.go b/pkg/core/domain.go index 934527e..50e96c3 100644 --- a/pkg/core/domain.go +++ b/pkg/core/domain.go @@ -72,7 +72,7 @@ func (p *PageDomain) returnMeta(ctx context.Context, owner, repo, branch string, result := &PageContent{} meta, err := p.GetMeta(ctx, owner, repo, branch) if err != nil { - zap.L().Debug("查询错误", zap.Error(err)) + zap.L().Debug("repo does not exists", zap.Error(err), zap.Strings("meta", []string{owner, repo, branch})) if meta != nil { // 解析错误汇报 return nil, errors.New(meta.ErrorMsg) @@ -85,7 +85,7 @@ func (p *PageDomain) returnMeta(ctx context.Context, owner, repo, branch string, result.Path = strings.Join(path, "/") if err = p.alias.Bind(ctx, meta.Alias, result.Owner, result.Repo, branch); err != nil { - zap.L().Warn("别名绑定失败", zap.Error(err)) + zap.L().Warn("alias binding error.", zap.Error(err)) return nil, err } return result, nil diff --git a/pkg/filters/goja/debug.tmpl b/pkg/filters/goja/debug.tmpl index 92ed3eb..e598a35 100644 --- a/pkg/filters/goja/debug.tmpl +++ b/pkg/filters/goja/debug.tmpl @@ -7,6 +7,10 @@ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">