Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit dbdcd37

Browse files
committed
refactor: remove isModuleURL function
1 parent c6b916f commit dbdcd37

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

server/app.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { Config, LoaderPlugin, LoaderTransformResult, ModuleOptions, Router
1212
import { VERSION } from '../version.ts'
1313
import { Bundler } from './bundler.ts'
1414
import { defaultConfig, loadConfig } from './config.ts'
15-
import { clearCompilation, computeHash, createHtml, formatBytesWithColor, getAlephPkgUri, getRelativePath, isModuleURL, reFullVersion, reHashJs, reHashResolve, toLocalUrl, trimModuleExt } from './helper.ts'
15+
import { clearCompilation, computeHash, createHtml, formatBytesWithColor, getAlephPkgUri, getRelativePath, reFullVersion, reHashJs, reHashResolve, toLocalUrl, trimModuleExt } from './helper.ts'
1616

1717
/** A module includes the compilation details. */
1818
export type Module = {
@@ -268,15 +268,16 @@ export class Application implements ServerApplication {
268268
}
269269

270270
private isScopedModule(url: string) {
271-
// is module
272-
if (isModuleURL(url)) {
273-
if (url.startsWith('/pages/') || url.startsWith('/api/')) {
274-
return true
275-
}
276-
switch (trimModuleExt(url)) {
277-
case '/404':
278-
case '/app':
271+
for (const ext of moduleExts) {
272+
if (url.endsWith('.' + ext)) {
273+
if (url.startsWith('/pages/') || url.startsWith('/api/')) {
279274
return true
275+
}
276+
switch (trimModuleExt(url)) {
277+
case '/404':
278+
case '/app':
279+
return true
280+
}
280281
}
281282
}
282283

server/helper.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ export function getRelativePath(from: string, to: string): string {
6060
return r
6161
}
6262

63-
export function isModuleURL(url: string) {
64-
for (const ext of moduleExts) {
65-
if (url.endsWith('.' + ext)) {
66-
return true
67-
}
68-
}
69-
return false
70-
}
71-
7263
export function trimModuleExt(url: string) {
7364
for (const ext of moduleExts) {
7465
if (url.endsWith('.' + ext)) {

0 commit comments

Comments
 (0)