File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
routes/docs/screenshot/[component] Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export async function loadExample(
2828 default : Component ;
2929 layers ?: string [ ] ;
3030 } ;
31- const source = ( rawSource . default as string ) . replace ( / ^ .* e x p o r t .* ; .* $ / gm, '' ) ;
31+ const source = ( rawSource . default as string ) . replace ( / ( \n \s * ) * ^ .* e x p o r t .* ; .* $ ( \n \s * ) * / gm, '\n ' ) ;
3232
3333 return { component : comp , source, module } ;
3434 } catch ( e ) {
@@ -84,7 +84,7 @@ export async function loadExampleByPath(resolvedPath: string): Promise<LoadedExa
8484 }
8585
8686 const comp = componentModule . default as Component ;
87- const source = ( rawSource as string ) . replace ( / ^ .* e x p o r t .* ; .* $ / gm, '' ) ;
87+ const source = ( rawSource as string ) . replace ( / ( \n \s * ) * ^ .* e x p o r t .* ; .* $ ( \n \s * ) * / gm, '\n ' ) ;
8888
8989 return { component : comp , source } ;
9090 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ export const getExample = query(
177177 }
178178
179179 // Remove `export { data };` from the code
180- const cleanCode = code . replace ( / ^ .* e x p o r t .* ; .* $ / gm, '' ) ;
180+ const cleanCode = code . replace ( / ( \n \s * ) * ^ .* e x p o r t .* ; .* $ ( \n \s * ) * / gm, '\n ' ) ;
181181
182182 // Prepare additional files to include
183183 const additionalFiles : Record < string , string > = { } ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export const load = async ({ params }) => {
1818 const source = ( await componentSources [ path ] ( ) ) as string ;
1919
2020 // Remove `export { data };`
21- const cleanupSource = source . replace ( / ^ .* e x p o r t .* ; .* $ / gm, '' ) ;
21+ const cleanupSource = source . replace ( / ( \n \s * ) * ^ .* e x p o r t .* ; .* $ ( \n \s * ) * / gm, '\n ' ) ;
2222
2323 if ( ! examples [ comp ] ) {
2424 examples [ comp ] = { } ;
You can’t perform that action at this time.
0 commit comments