@@ -3,11 +3,7 @@ import { colors, createHash, ensureDir, path, walk } from '../deps.ts'
3
3
import { EventEmitter } from '../framework/core/events.ts'
4
4
import { moduleExts , toPagePath , trimModuleExt } from '../framework/core/module.ts'
5
5
import { Routing , RouteModule } from '../framework/core/routing.ts'
6
- import {
7
- defaultReactVersion ,
8
- minDenoVersion ,
9
-
10
- } from '../shared/constants.ts'
6
+ import { defaultReactVersion , minDenoVersion } from '../shared/constants.ts'
11
7
import {
12
8
ensureTextFile ,
13
9
existsDirSync ,
@@ -65,7 +61,8 @@ export class Application implements ServerApplication {
65
61
reload = false
66
62
) {
67
63
if ( Deno . version . deno < minDenoVersion ) {
68
- log . fatal ( `need Deno ${ minDenoVersion } +, but got ${ Deno . version . deno } ` )
64
+ log . error ( `Aleph.js needs Deno ${ minDenoVersion } +, please upgrade Deno.` )
65
+ Deno . exit ( 1 )
69
66
}
70
67
this . workingDir = path . resolve ( workingDir )
71
68
this . mode = mode
@@ -90,6 +87,24 @@ export class Application implements ServerApplication {
90
87
Deno . env . set ( 'ALEPH_VERSION' , VERSION )
91
88
Deno . env . set ( 'BUILD_MODE' , this . mode )
92
89
90
+ // inject browser navigator polyfill
91
+ Object . assign ( ( globalThis as any ) . navigator , {
92
+ connection : {
93
+ downlink : 10 ,
94
+ effectiveType : "4g" ,
95
+ onchange : null ,
96
+ rtt : 50 ,
97
+ saveData : false ,
98
+ } ,
99
+ cookieEnabled : false ,
100
+ language : 'en' ,
101
+ languages : [ 'en' ] ,
102
+ onLine : true ,
103
+ platform : Deno . build . os ,
104
+ userAgent : `Deno/${ Deno . version . deno } ` ,
105
+ vendor : 'Deno Land'
106
+ } )
107
+
93
108
const alephPkgUri = getAlephPkgUri ( )
94
109
const buildManifestFile = path . join ( this . buildDir , 'build.manifest.json' )
95
110
const configHash = computeHash ( JSON . stringify ( {
0 commit comments