Return resolved path in loadStylesheet and loadModule

Source map support needs this in loadStylesheet but it makes more sense to be consistent and require it for both.
This commit is contained in:
Jordan Pittman 2025-04-18 10:40:54 -04:00
parent a4cd44d426
commit 68ce361ef4
12 changed files with 160 additions and 0 deletions

View file

@ -125,6 +125,7 @@ export async function loadModule(
let module = await importModule(pathToFileURL(resolvedPath).href)
return {
path: resolvedPath,
base: path.dirname(resolvedPath),
module: module.default ?? module,
}
@ -144,6 +145,7 @@ export async function loadModule(
onDependency(file)
}
return {
path: resolvedPath,
base: path.dirname(resolvedPath),
module: module.default ?? module,
}
@ -164,6 +166,7 @@ async function loadStylesheet(
let file = await globalThis.__tw_readFile(resolvedPath, 'utf-8')
if (file) {
return {
path: resolvedPath,
base: path.dirname(resolvedPath),
content: file,
}
@ -172,6 +175,7 @@ async function loadStylesheet(
let file = await fsPromises.readFile(resolvedPath, 'utf-8')
return {
path: resolvedPath,
base: path.dirname(resolvedPath),
content: file,
}