fix: add scoped error logging for lexer/parser errors

- Add std.log.scoped(.pugz) to template.zig and view_engine.zig
- Log detailed error info (code, line, column, message) when parsing fails
- Log template path context in ViewEngine on parse errors
- Remove debug print from lexer, use proper scoped logging instead
- Move benchmarks, docs, examples, playground, tests out of src/ to project root
- Update build.zig and documentation paths accordingly
- Bump version to 0.3.1
This commit is contained in:
2026-01-25 17:10:02 +05:30
parent 9d3b729c6c
commit aaf6a1af2d
1148 changed files with 57 additions and 330 deletions

View File

@@ -0,0 +1,166 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`pug-load 1`] = `
Object {
"filename": "<dirname>/foo.pug",
"line": 0,
"nodes": Array [
Object {
"column": 1,
"file": Object {
"ast": Object {
"filename": "<dirname>/bar.pug",
"line": 0,
"nodes": Array [
Object {
"column": 1,
"filename": "<dirname>/bar.pug",
"line": 1,
"mode": "replace",
"name": "bing",
"nodes": Array [],
"type": "NamedBlock",
},
],
"type": "Block",
},
"column": 9,
"filename": "<dirname>/foo.pug",
"fullPath": "<dirname>/bar.pug",
"line": 1,
"path": "bar.pug",
"raw": Object {
"hash": "538bf7d4b81ef364b1f2e9d42c11f156",
"size": 11,
"type": "Buffer",
},
"str": "block bing
",
"type": "FileReference",
},
"filename": "<dirname>/foo.pug",
"line": 1,
"type": "Extends",
},
Object {
"column": 1,
"filename": "<dirname>/foo.pug",
"line": 3,
"mode": "replace",
"name": "bing",
"nodes": Array [
Object {
"block": Object {
"filename": "<dirname>/foo.pug",
"line": 4,
"nodes": Array [],
"type": "Block",
},
"column": 3,
"file": Object {
"ast": Object {
"filename": "<dirname>/bing.pug",
"line": 0,
"nodes": Array [
Object {
"attributeBlocks": Array [],
"attrs": Array [
Object {
"column": 1,
"filename": "<basedir>/packages/pug-load/test/bing.pug",
"line": 1,
"mustEscape": false,
"name": "class",
"val": "'bing'",
},
],
"block": Object {
"filename": "<dirname>/bing.pug",
"line": 1,
"nodes": Array [
Object {
"column": 7,
"filename": "<dirname>/bing.pug",
"line": 1,
"type": "Text",
"val": "bong",
},
],
"type": "Block",
},
"column": 1,
"filename": "<dirname>/bing.pug",
"isInline": false,
"line": 1,
"name": "div",
"selfClosing": false,
"type": "Tag",
},
],
"type": "Block",
},
"column": 11,
"filename": "<dirname>/foo.pug",
"fullPath": "<dirname>/bing.pug",
"line": 4,
"path": "bing.pug",
"raw": Object {
"hash": "58ecbe086e7a045084cbddac849a2563",
"size": 11,
"type": "Buffer",
},
"str": ".bing bong
",
"type": "FileReference",
},
"filename": "<dirname>/foo.pug",
"line": 4,
"type": "Include",
},
Object {
"attributeBlocks": Array [],
"attrs": Array [],
"block": Object {
"filename": "<dirname>/foo.pug",
"line": 5,
"nodes": Array [
Object {
"column": 5,
"file": Object {
"column": 13,
"filename": "<dirname>/foo.pug",
"fullPath": "<dirname>/script.js",
"line": 6,
"path": "script.js",
"raw": Object {
"hash": "86d4f8e34165faeb09f10255121078f8",
"size": 32,
"type": "Buffer",
},
"str": "document.write('hello world!');
",
"type": "FileReference",
},
"filename": "<dirname>/foo.pug",
"filters": Array [],
"line": 6,
"type": "RawInclude",
},
],
"type": "Block",
},
"column": 3,
"filename": "<dirname>/foo.pug",
"isInline": false,
"line": 5,
"name": "script",
"selfClosing": false,
"type": "Tag",
},
],
"type": "NamedBlock",
},
],
"type": "Block",
}
`;