Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.fingerprint = 0xda130f3af836cea0,
.dependencies = .{
.v8 = .{
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/7177ee1ae267a44751a0e7e012e257177699a375.tar.gz",
.hash = "v8-0.0.0-xddH63TCAwC1D1hEiOtbEnLBbtz9ZPHrdiGWLcBcYQB7",
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/c25223900587005c9cf13f25e56a7e0be26a533c.tar.gz",
.hash = "v8-0.0.0-xddH6x_DAwBh0gSbFFv1fyiExhExXKzZpbmj5sFH4MRY",
},
// .v8 = .{ .path = "../zig-v8-fork" }
},
Expand Down
2 changes: 2 additions & 0 deletions src/browser/html/elements.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,8 @@ test "Browser: HTML.HtmlStyleElement" {
test "Browser: HTML.HtmlScriptElement" {
try testing.htmlRunner("html/script/script.html");
try testing.htmlRunner("html/script/inline_defer.html");
try testing.htmlRunner("html/script/import.html");
try testing.htmlRunner("html/script/dynamic_import.html");
}

test "Browser: HTML.HtmlSlotElement" {
Expand Down
359 changes: 161 additions & 198 deletions src/runtime/js.zig

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/tests/html/script/dynamic_import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>

<script src="../../testing.js"></script>

<script id=dynamic_import type=module>
const promise1 = new Promise((resolve) => {
Promise.all([
import('./import.js'),
import('./import.js'),
import('./import2.js'),
]).then(resolve);
});

testing.async(promise1, (res) => {
testing.expectEqual('hello', res[0].greeting);
testing.expectEqual('hello', res[1].greeting);
testing.expectEqual('world', res[2].greeting);
})
</script>
15 changes: 15 additions & 0 deletions src/tests/html/script/import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>

<script src="../../testing.js"></script>

<script id=import type=module>
import * as im from './import.js';
testing.expectEqual('hello', im.greeting);
</script>

<script id=cached type=module>
// hopefully cached, who knows, no real way to assert this
// but at least it works.
import * as im from './import.js';
testing.expectEqual('hello', im.greeting);
</script>
2 changes: 2 additions & 0 deletions src/tests/html/script/import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let greeting = 'hello';
export {greeting as 'greeting'};
2 changes: 2 additions & 0 deletions src/tests/html/script/import2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let greeting = 'world';
export {greeting as 'greeting'};
2 changes: 1 addition & 1 deletion src/tests/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}

async function async(promise, cb) {
const script_id = document.currentScript.id;
const script_id = document.currentScript ? document.currentScript.id : '<script id is unavailable in browsers>';
const stack = new Error().stack;
const value = await promise;
this._captured = {script_id: script_id, stack: stack};
Expand Down