Skip to content

Commit ca7fce6

Browse files
Merge pull request #12 from WilliamRagstad/develop
2 parents 5ea69ff + 6dff96f commit ca7fce6

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@knight/knight",
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"license": "MIT",
55
"exports": "./mod.ts",
66
"imports": {

src/Knight.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,6 @@ export class Knight {
218218
return path;
219219
}
220220

221-
/**
222-
* Dynamically import a JavaScript module via a data URL
223-
* @param file File path to read as javascript text and import dynamically via data URL
224-
*/
225-
private static async dynamicImportUrl(file: string): Promise<string> {
226-
return `data:text/javascript,${await Deno.readTextFile(file)}`;
227-
}
228-
229221
/**
230222
* Find all controllers in the local project
231223
*/
@@ -237,7 +229,9 @@ export class Knight {
237229
const subControllers = await this.findLocalControllersIn(path);
238230
controllers.push(...subControllers);
239231
} else if (file.isFile && file.name.endsWith("Controller.ts")) {
240-
const module = await import(await Knight.dynamicImportUrl(path));
232+
// Dynamically import a JavaScript module via a data URL
233+
const fileContent = await Deno.readTextFile(path);
234+
const module = await import(`data:text/javascript,${fileContent}`);
241235
const defaultController = module.default;
242236
// Check that the default controller implements IController
243237
// console.log(module, defaultController);

0 commit comments

Comments
 (0)