@@ -5,7 +5,6 @@ import * as path from "@std/path";
55import { pathToPattern } from "../router.ts" ;
66import { CommandType } from "../commands.ts" ;
77import { sortRoutePaths } from "../fs_routes.ts" ;
8- import { RequestedModuleType , ResolutionMode , Workspace } from "@deno/loader" ;
98import type { RouteConfig } from "../types.ts" ;
109
1110const GROUP_REG = / [ / \\ \\ ] \( ( _ [ ^ / \\ \\ ] + ) \) [ / \\ \\ ] / ;
@@ -17,12 +16,6 @@ export async function crawlRouteDir<State>(
1716 onIslandSpecifier : ( spec : string ) => void ,
1817 files : FsRouteFileNoMod < State > [ ] ,
1918) {
20- const workspace = await new Workspace ( {
21- noTranspile : true ,
22- preserveJsx : true ,
23- } ) ;
24- const loader = await workspace . createLoader ( { entrypoints : [ ] } ) ;
25-
2619 await walkDir (
2720 fs ,
2821 routeDir ,
@@ -82,23 +75,15 @@ export async function crawlRouteDir<State>(
8275
8376 routePattern = pathToPattern ( id . slice ( 1 ) ) ;
8477
85- const resolved = loader . resolve (
86- entry . path ,
87- undefined ,
88- ResolutionMode . Import ,
89- ) ;
90- const loaded = await loader . load ( resolved , RequestedModuleType . Text ) ;
91- if ( loaded . kind !== "external" ) {
92- const text = new TextDecoder ( ) . decode ( loaded . code ) ;
93- lazy = ! text . includes ( "routeOverride" ) ;
78+ const code = await fs . readTextFile ( entry . path ) ;
79+ lazy = ! code . includes ( "routeOverride" ) ;
9480
95- // TODO: We could do an AST parse here to detect the
96- // kind of handler that's used to get a more accurate
97- // list of methods this route supports.
98- overrideConfig = {
99- methods : "ALL" ,
100- } ;
101- }
81+ // TODO: We could do an AST parse here to detect the
82+ // kind of handler that's used to get a more accurate
83+ // list of methods this route supports.
84+ overrideConfig = {
85+ methods : "ALL" ,
86+ } ;
10287 }
10388
10489 files . push ( {
0 commit comments