-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add debug info for unserializable values
- Loading branch information
1 parent
b883c8c
commit 09c0558
Showing
22 changed files
with
272 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/runtime-tags": patch | ||
--- | ||
|
||
Fix issue where streams that had aborted but then finished were swallowing the abort error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@marko/runtime-tags": patch | ||
--- | ||
|
||
Add errors with debug info when attempting to serialize a non serializable value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"marko": patch | ||
"@marko/runtime-tags": patch | ||
"@marko/compiler": patch | ||
"@marko/translator-interop-class-tags": patch | ||
--- | ||
|
||
Ensure Marko 5 renderBodies are serialized properly across the compat layer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
{ | ||
"name": "*", | ||
"total": { | ||
"min": 18072, | ||
"brotli": 6619 | ||
"min": 18085, | ||
"brotli": 6624 | ||
} | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ags/src/__tests__/fixtures/unserializable-warning/__snapshots__/html.expected/template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as _$ from "@marko/runtime-tags/debug/html"; | ||
const _renderer = /* @__PURE__ */_$.createRenderer((input, _tagVar) => { | ||
const _scope0_id = _$.nextScopeId(); | ||
const Foo = { | ||
content: _$.register(/* @__PURE__ */_$.createRenderer(() => { | ||
const _scope1_id = _$.nextScopeId(); | ||
const unserializable = { | ||
nested: { | ||
thing: Buffer.from("") | ||
} | ||
}; | ||
const test = _$.register(function () { | ||
return unserializable; | ||
}, "__tests__/template.marko_1/test", _scope1_id); | ||
_$.writeEffect(_scope1_id, "__tests__/template.marko_1_test"); | ||
_$.debug(_$.writeScope(_scope1_id, { | ||
"unserializable": unserializable, | ||
"test": test | ||
}), "__tests__/template.marko", "1:2", { | ||
"unserializable": "2:10", | ||
"test": "7:10" | ||
}); | ||
}), "__tests__/template.marko_1_renderer", _scope0_id) | ||
}; | ||
const _dynamicScope = _$.peekNextScope(); | ||
_$.dynamicTagInput(_scope0_id, "#text/0", Foo, {}); | ||
_$.debug(_$.writeScope(_scope0_id, { | ||
"#text/0!": _$.writeExistingScope(_dynamicScope), | ||
"#text/0(": _$.normalizeDynamicRenderer(Foo) | ||
}), "__tests__/template.marko", 0, { | ||
"Foo": "1:9" | ||
}); | ||
}); | ||
export default /* @__PURE__ */_$.createTemplate("__tests__/template.marko", _renderer); |
Empty file.
4 changes: 4 additions & 0 deletions
4
...ags/src/__tests__/fixtures/unserializable-warning/__snapshots__/ssr.expected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Emit error | ||
``` | ||
TypeError: Unable to serialize "unserializable" in __tests__/template.marko:2:10 (reading nested.thing) | ||
``` |
15 changes: 15 additions & 0 deletions
15
packages/runtime-tags/src/__tests__/fixtures/unserializable-warning/template.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<define/Foo> | ||
<const/unserializable = { | ||
nested: { | ||
thing: Buffer.from("") | ||
} | ||
}/> | ||
<const/test() { | ||
return unserializable; | ||
}/> | ||
<script> | ||
test(); | ||
</script> | ||
</> | ||
|
||
<Foo/> |
1 change: 1 addition & 0 deletions
1
packages/runtime-tags/src/__tests__/fixtures/unserializable-warning/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const skip_dom = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
const prefix = MARKO_DEBUG ? "$compat_" : "$C_"; | ||
export const RENDERER_REGISTER_ID = prefix + (MARKO_DEBUG ? "renderer" : "r"); | ||
export const SET_SCOPE_REGISTER_ID = prefix + (MARKO_DEBUG ? "setScope" : "s"); | ||
export const RENDER_BODY_ID = prefix + (MARKO_DEBUG ? "renderBody" : "b"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.