vite-plugin-zephyr
Version:
Vite plugin for Zephyr
30 lines (29 loc) • 1.25 kB
JavaScript
import { basename, resolve } from "node:path";
import { readDirRecursiveWithContents } from "zephyr-agent";
import { normalizeFilesystemVitePath, normalizeVitePath } from "../utils/normalize-vite-path.mjs";
async function load_public_dir({ publicDir, outDir, target }) {
const files = 'tap-app' === target ? await readDirRecursiveWithContents(publicDir, {
includeIgnoredPaths: true,
failOnError: true
}) : await readDirRecursiveWithContents(publicDir);
const normalizedOutDir = resolve(outDir);
return files.filter((file)=>file.fullPath !== normalizedOutDir && !file.fullPath.startsWith(normalizedOutDir + '/')).map((file)=>{
const fileName = basename(file.fullPath);
return {
name: fileName,
names: [
fileName
],
needsCodeReference: false,
source: file.content,
type: 'asset',
fileName: 'tap-app' === target ? normalizeFilesystemVitePath(file.relativePath) : normalizeVitePath(file.relativePath),
originalFileName: fileName,
originalFileNames: [
fileName
]
};
});
}
export { load_public_dir };
//# sourceMappingURL=load_public_dir.mjs.map