Skip to content

Commit

Permalink
fix: ensure crawlFiles supports relative paths for all plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Sep 12, 2023
1 parent 9ddc785 commit e9c25c6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion framework-plugins/preact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const preactFrameworkPlugin: FrameworkPluginFactory = {
defaultWrapperPath: "__previewjs__/Wrapper.tsx",
previewDirPath,
typeAnalyzer,
crawlFiles: async (absoluteFilePaths) => {
crawlFiles: async (filePaths) => {
const absoluteFilePaths = filePaths.map((f) =>
path.isAbsolute(f) ? f : path.join(rootDir, f)
);
const resolver = typeAnalyzer.analyze(absoluteFilePaths);
const components: Component[] = [];
const stories: Story[] = [];
Expand Down
5 changes: 4 additions & 1 deletion framework-plugins/solid/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const solidFrameworkPlugin: FrameworkPluginFactory = {
defaultWrapperPath: "__previewjs__/Wrapper.tsx",
previewDirPath,
typeAnalyzer,
crawlFiles: async (absoluteFilePaths) => {
crawlFiles: async (filePaths) => {
const absoluteFilePaths = filePaths.map((f) =>
path.isAbsolute(f) ? f : path.join(rootDir, f)
);
const resolver = typeAnalyzer.analyze(absoluteFilePaths);
const components: Component[] = [];
const stories: Story[] = [];
Expand Down
5 changes: 4 additions & 1 deletion framework-plugins/svelte/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const svelteFrameworkPlugin: FrameworkPluginFactory = {
defaultWrapperPath: "__previewjs__/Wrapper.svelte",
previewDirPath,
typeAnalyzer,
crawlFiles: async (absoluteFilePaths) => {
crawlFiles: async (filePaths) => {
const absoluteFilePaths = filePaths.map((f) =>
path.isAbsolute(f) ? f : path.join(rootDir, f)
);
const resolver = typeAnalyzer.analyze(
absoluteFilePaths.map((p) => (p.endsWith(".svelte") ? `${p}.ts` : p))
);
Expand Down
5 changes: 4 additions & 1 deletion framework-plugins/vue2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ const vue2FrameworkPlugin: FrameworkPluginFactory = {
defaultWrapperPath: "__previewjs__/Wrapper.vue",
previewDirPath,
typeAnalyzer,
crawlFiles: async (absoluteFilePaths) => {
crawlFiles: async (filePaths) => {
const absoluteFilePaths = filePaths.map((f) =>
path.isAbsolute(f) ? f : path.join(rootDir, f)
);
const resolver = typeAnalyzer.analyze(
absoluteFilePaths.map((p) => (p.endsWith(".vue") ? p + ".ts" : p))
);
Expand Down
5 changes: 4 additions & 1 deletion framework-plugins/vue3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const vue3FrameworkPlugin: FrameworkPluginFactory = {
defaultWrapperPath: "__previewjs__/Wrapper.vue",
previewDirPath,
typeAnalyzer,
crawlFiles: async (absoluteFilePaths) => {
crawlFiles: async (filePaths) => {
const absoluteFilePaths = filePaths.map((f) =>
path.isAbsolute(f) ? f : path.join(rootDir, f)
);
const resolver = typeAnalyzer.analyze(
absoluteFilePaths.map((p) => (p.endsWith(".vue") ? p + ".ts" : p))
);
Expand Down

0 comments on commit e9c25c6

Please sign in to comment.