Skip to content

Commit ef9e872

Browse files
committed
fix: function replaceLibImport to replace single and double quotes
1 parent bf0d6a1 commit ef9e872

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/routes/utils/HighlightCompo.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
if (replaceLib) {
2929
code = replaceLibImport(code);
3030
}
31+
console.log('code: ', code)
3132
3233
let showExpandButton: boolean = $state(false);
3334
let expand: boolean = $state(false);

src/routes/utils/helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ export function getFilteredFileNames(dirName: string): string[] {
106106
}
107107

108108
export function replaceLibImport(componentString: string): string {
109-
return componentString.replace(/from "\$lib"/g, "from 'svelte-5-ui-lib'");
109+
return componentString
110+
.replace(/from ["']\$lib["']/g, "from 'svelte-5-ui-lib'")
111+
.replace(/from ["']\$lib\//g, "from 'svelte-5-ui-lib/");
110112
}
111113

114+
112115
export function getExampleFileName(
113116
selectedExample: string,
114117
exampleArr: { name: string }[]

0 commit comments

Comments
 (0)