an ability to require modules using "./" and "../" syntax

This commit is contained in:
Blue 2023-10-04 17:09:44 -03:00
parent 7d0c2d079b
commit 26edf60654
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 60 additions and 8 deletions

3
test/inner/dependency.js Normal file
View file

@ -0,0 +1,3 @@
mimicry.module(function () {
return "Dep";
})

6
test/inner/inner.js Normal file
View file

@ -0,0 +1,6 @@
mimicry.module([
"./dependency",
"../outer"
], function (global, [dependency, outer]) {
return dependency === "Dep" && outer === "Outer";
})

View file

@ -4,8 +4,9 @@ mimicry.module([
"simple", Mimicry.Type.json,
"background", Mimicry.Type.css,
"text", Mimicry.Type.text,
"binary", Mimicry.Type.binary
], function (global, [terminalModule, simple, background, text, binary]) {
"binary", Mimicry.Type.binary,
"inner/inner"
], function (global, [terminalModule, simple, background, text, binary, inner]) {
let bnr = false;
if (binary instanceof ArrayBuffer) {
const view = new Uint8Array(binary);
@ -27,6 +28,7 @@ mimicry.module([
terminalModule === "terminal",
simple.a[4] === 115,
text === "Lorem ipsum, I guess",
bnr
bnr,
inner === true
];
});

3
test/outer.js Normal file
View file

@ -0,0 +1,3 @@
mimicry.module(function () {
return "Outer";
});