Skip to content

Commit

Permalink
- fix bug: pug dependency path resolving incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
zbryikt committed Feb 6, 2021
1 parent f44742a commit bed6569
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 2.2.3

- fix bug: pug dependency path resolving incorrect


## 2.2.2

- fix bug: pug malformat crashes the whole server
Expand Down
10 changes: 5 additions & 5 deletions bin/lib/tree/PugTree.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/tree/PugTree.ls
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ pugbuild = require "../build/pug"
pugtree = new DocTree do
parser: (c, f) ->
/* use pug dependencies tracking */
cwd = path.resolve process.cwd!
cwd = path.resolve path.join(process.cwd!, @root)
try
ret2 = pug.compileClientWithDependenciesTracked(
ret = pug.compileClientWithDependenciesTracked(
c,
{basedir: path.join(cwd,path.dirname f), filename: f} <<< pugbuild.extapi
)
return ret2.dependencies.map(-> it.replace cwd, '../..')
return ret.dependencies.map(-> it.replace cwd, '/../..')
catch e
try
ret = c
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"main": "bin/lib/index.js",
"description": "simple, quick template for bootstrap a page",
"version": "2.2.2",
"version": "2.2.3",
"homepage": "https://github.com/zbryikt/template",
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions src/pug/dir/index.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
doctype html
html
head
body
include module.pug
2 changes: 2 additions & 0 deletions src/pug/dir/module.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//- module
div module
1 change: 1 addition & 0 deletions src/pug/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ html
+scope("hi"): div include module pug with #[code @] works.
include @static/assets/sample.pug
include module.pug
script: include:lsc module.ls
3 changes: 3 additions & 0 deletions src/pug/module.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
div = document.createElement("div")
div.innerText = "include:lsc module.ls works"
document.body.appendChild div
1 change: 1 addition & 0 deletions static/dir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head></head><body><div>module</div></body></html>
5 changes: 4 additions & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
div.textContent = "livescript filter test";</script><script type="application/json">{
"output": "lson test ok"
}
</script><div>i18n 翻譯測試 ( 編譯時期, pug filter )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>命名域測試成功.</div><div>/intl/zh-TW/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div></body></html>
</script><div>i18n 翻譯測試 ( 編譯時期, pug filter )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>命名域測試成功.</div><div>/intl/zh-TW/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div><script>var div;
div = document.createElement("div");
div.innerText = "include:lsc module.ls works";
document.body.appendChild(div);</script></body></html>
1 change: 1 addition & 0 deletions static/intl/en/dir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head></head><body><div>module</div></body></html>
5 changes: 4 additions & 1 deletion static/intl/en/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
div.textContent = "livescript filter test";</script><script type="application/json">{
"output": "lson test ok"
}
</script><div>i18n translation test ( compile time filter )</div><div>i18n translation test ( runtime function )</div><div>i18n translation test ( runtime function )</div><div>namespace test ok.</div><div>/intl/en/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div></body></html>
</script><div>i18n translation test ( compile time filter )</div><div>i18n translation test ( runtime function )</div><div>i18n translation test ( runtime function )</div><div>namespace test ok.</div><div>/intl/en/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div><script>var div;
div = document.createElement("div");
div.innerText = "include:lsc module.ls works";
document.body.appendChild(div);</script></body></html>
1 change: 1 addition & 0 deletions static/intl/zh-TW/dir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head></head><body><div>module</div></body></html>
5 changes: 4 additions & 1 deletion static/intl/zh-TW/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
div.textContent = "livescript filter test";</script><script type="application/json">{
"output": "lson test ok"
}
</script><div>i18n 翻譯測試 ( 編譯時期, pug filter )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>命名域測試成功.</div><div>/intl/zh-TW/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div></body></html>
</script><div>i18n 翻譯測試 ( 編譯時期, pug filter )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>i18n 翻譯測試 ( 執行時期, pug function )</div><div>命名域測試成功.</div><div>/intl/zh-TW/</div><div ld-scope="hi"><div>include module pug with <code>@</code> works.</div></div><div>include with <code>@static</code> works.</div><div>hi</div><script>var div;
div = document.createElement("div");
div.innerText = "include:lsc module.ls works";
document.body.appendChild(div);</script></body></html>

0 comments on commit bed6569

Please sign in to comment.