Skip to content

Commit 12fa278

Browse files
committed
fix formatting
1 parent d09605b commit 12fa278

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

code/builders/builder-vite/src/codegen-modern-iframe-script.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest';
22

3-
import { generateAddonSetupCode } from './codegen-set-addon-channel';
43
import { generateModernIframeScriptCodeFromPreviews } from './codegen-modern-iframe-script';
4+
import { generateAddonSetupCode } from './codegen-set-addon-channel';
55
import { optimizeViteDeps } from './preset';
66

77
describe('generateModernIframeScriptCodeFromPreviews', () => {
@@ -137,16 +137,21 @@ describe('generateModernIframeScriptCodeFromPreviews', () => {
137137
/**
138138
* Extract bare package import specifiers from a block of generated JavaScript/TypeScript code.
139139
* Captures both `import ... from 'pkg'` and `import 'pkg'` forms, excluding:
140-
* - relative paths (start with `.`)
141-
* - virtual module IDs (start with `virtual:`)
142-
* - absolute paths (start with `/`)
140+
*
141+
* - Relative paths (start with `.`)
142+
* - Virtual module IDs (start with `virtual:`)
143+
* - Absolute paths (start with `/`)
143144
*/
144145
function extractPackageImports(code: string): string[] {
145146
const importRegex = /import\s+(?:[^'"]*\s+from\s+)?['"]([^'"]+)['"]/g;
146147
const specifiers = new Set<string>();
147148
for (const match of code.matchAll(importRegex)) {
148149
const specifier = match[1];
149-
if (!specifier.startsWith('.') && !specifier.startsWith('virtual:') && !specifier.startsWith('/')) {
150+
if (
151+
!specifier.startsWith('.') &&
152+
!specifier.startsWith('virtual:') &&
153+
!specifier.startsWith('/')
154+
) {
150155
specifiers.add(specifier);
151156
}
152157
}

0 commit comments

Comments
 (0)