Comparing version 1.17.0 to 1.18.0
@@ -5,3 +5,2 @@ /** | ||
import {File} from "./types.js"; | ||
import {isString, checkType, getFullDocPath} from "./utils.js"; | ||
@@ -73,7 +72,13 @@ | ||
} | ||
if (isString(handler["fn"])) { | ||
const fn = await this.compiler.compile(handler["fn"]); | ||
return fn(new File(file, handler["ctx"], ctx)); | ||
let fn = handler["fn"]; | ||
if (isString(fn)) { | ||
fn = await this.compiler.compile(handler["fn"]); | ||
} | ||
return handler["fn"](new File(file, handler["ctx"], ctx)); | ||
// We support two methods to access file properties, first the file | ||
// properties will be merged with context properties, so you could | ||
// directly access them via property names, and then you could also access | ||
// file properties via `file` object, this is recommended because it is | ||
// easier to prevent the single `file` property name from conflicting and | ||
// it is always accessible. | ||
return fn(Object.assign(file, handler["ctx"], ctx, {"file": file})); | ||
} | ||
@@ -80,0 +85,0 @@ return file["content"]; |
{ | ||
"name": "hikarujs", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"description": "A static site generator that generates routes based on directories naturally.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
136875
4037