-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve
jiti/native
compatibility with node and deno
- Loading branch information
Showing
12 changed files
with
176 additions
and
64 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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ dist | |
*.log* | ||
coverage | ||
.tmp | ||
deno.lock |
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
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
import { readdir } from "node:fs/promises"; | ||
// @ts-ignore | ||
import { test } from "bun:test"; | ||
|
||
import { createJiti } from "../../lib/jiti-native.mjs"; | ||
|
||
const fixtures = await readdir(new URL("../fixtures", import.meta.url)); | ||
|
||
const jiti = createJiti(import.meta.url, { importMeta: import.meta }); | ||
|
||
const ignore = new Set(["error-runtime", "error-parse", "typescript"]); | ||
|
||
for (const fixture of fixtures) { | ||
if (ignore.has(fixture)) { | ||
continue; | ||
} | ||
|
||
test("fixtures/" + fixture + " (ESM) (Native)", async () => { | ||
await jiti.import("../fixtures/" + fixture); | ||
}); | ||
} |
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,36 @@ | ||
import { readdir } from "node:fs/promises"; | ||
import { test } from "node:test"; | ||
|
||
import { createJiti } from "../../lib/jiti-native.mjs"; | ||
|
||
const fixtures = await readdir(new URL("../fixtures", import.meta.url)); | ||
|
||
const jiti = createJiti(import.meta.url, { importMeta: import.meta }); | ||
|
||
// Mostly broken because default type is set to commonjs in fixtures root | ||
const ignore = new Set( | ||
[ | ||
"error-runtime", | ||
"error-parse", | ||
"pure-esm-dep", | ||
"proto", | ||
"json", | ||
"esm", | ||
"env", | ||
"typescript", | ||
"top-level-await", | ||
"exotic", | ||
"circular", | ||
"import-map", | ||
].filter(Boolean), | ||
); | ||
|
||
for (const fixture of fixtures) { | ||
if (ignore.has(fixture)) { | ||
continue; | ||
} | ||
|
||
test("fixtures/" + fixture + " (ESM) (Native)", async () => { | ||
await jiti.import("../fixtures/" + fixture); | ||
}); | ||
} |
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,35 @@ | ||
import { readdir } from "node:fs/promises"; | ||
import { test } from "node:test"; | ||
|
||
import { createJiti } from "../../lib/jiti-native.mjs"; | ||
|
||
const fixtures = await readdir(new URL("../fixtures", import.meta.url)); | ||
|
||
const jiti = createJiti(import.meta.url, { importMeta: import.meta }); | ||
|
||
// Mostly broken because default type is set to commonjs in fixtures root | ||
const ignore = new Set( | ||
[ | ||
"error-runtime", | ||
"error-parse", | ||
"pure-esm-dep", | ||
"proto", | ||
"json", | ||
"esm", | ||
"env", | ||
"typescript", | ||
"top-level-await", | ||
"exotic", | ||
"circular", | ||
].filter(Boolean), | ||
); | ||
|
||
for (const fixture of fixtures) { | ||
if (ignore.has(fixture)) { | ||
continue; | ||
} | ||
|
||
test("fixtures/" + fixture + " (ESM) (Native)", async () => { | ||
await jiti.import("../fixtures/" + fixture); | ||
}); | ||
} |
File renamed without changes.
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