Skip to content

Commit

Permalink
- fix bug: pug malformat crashes the whole server
Browse files Browse the repository at this point in the history
  • Loading branch information
zbryikt committed Feb 5, 2021
1 parent 2b594f0 commit f44742a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 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.2

- fix bug: pug malformat crashes the whole server


## 2.2.1

- fix bug: update of dependencies doesn't trigger pug file's rebuilding.
Expand Down
32 changes: 24 additions & 8 deletions bin/lib/tree/PugTree.js

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

21 changes: 16 additions & 5 deletions lib/tree/PugTree.ls
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@ pugtree = new DocTree do
parser: (c, f) ->
/* use pug dependencies tracking */
cwd = path.resolve process.cwd!
ret2 = pug.compileClientWithDependenciesTracked(
c,
{basedir: path.join(cwd,path.dirname f), filename: f} <<< pugbuild.extapi
)
return ret2.dependencies.map(-> it.replace cwd, '../..')
try
ret2 = pug.compileClientWithDependenciesTracked(
c,
{basedir: path.join(cwd,path.dirname f), filename: f} <<< pugbuild.extapi
)
return ret2.dependencies.map(-> it.replace cwd, '../..')
catch e
try
ret = c
.split \\n
.map -> /\s*(extend|include)\s+(.+)$/.exec(it)
.filter -> it
.map -> it.2
catch e
return []


module.exports = pugtree
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.1",
"version": "2.2.2",
"homepage": "https://github.com/zbryikt/template",
"repository": {
"type": "git",
Expand Down

0 comments on commit f44742a

Please sign in to comment.