diff --git a/src/ast.js b/src/ast.js index c2bfa15..c6d1b11 100644 --- a/src/ast.js +++ b/src/ast.js @@ -1282,7 +1282,7 @@ class AstSerializer { let childContent; if(externalSource) { // fetch file contents, note that child content of the node is ignored here // We could check to make sure this isn’t already in the asset aggregation bucket *before* we read but that could result in out-of-date content - let fileContent = this.fileCache.read(externalSource, options.closestParentComponent || this.filePath); + let fileContent = await this.fileCache.read(externalSource, options.closestParentComponent || this.filePath); childContent = await this.transformContent(fileContent, options.currentTransformTypes, node, slots, options, streamEnabled); } else { let { html } = await this.getChildContent(node, slots, options, false); diff --git a/src/fsCache.js b/src/fsCache.js index 495166b..a591eeb 100644 --- a/src/fsCache.js +++ b/src/fsCache.js @@ -1,5 +1,6 @@ import fs from "node:fs"; import path from "node:path"; +import { customLoader } from "../webc.js"; class FileSystemCache { constructor() { @@ -24,12 +25,12 @@ class FileSystemCache { } isFileInProjectDirectory(filePath) { - let workingDir = path.resolve(); - let absoluteFile = path.resolve(filePath); + let workingDir = customLoader.resolve(); + let absoluteFile = customLoader.resolve(filePath); return absoluteFile.startsWith(workingDir); } - read(filePath, relativeTo) { + async read(filePath, relativeTo) { if(this.isFullUrl(filePath)) { throw new Error(`Full URLs in