-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.ts
41 lines (38 loc) · 1.48 KB
/
bootstrap.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { createPlatformFactory, Injector, COMPILER_OPTIONS, InjectionToken } from 'https://jspm.dev/@angular/[email protected]';
import { ɵplatformCoreDynamic } from 'https://jspm.dev/@angular/[email protected]';
import { ResourceLoader } from 'https://jspm.dev/@angular/[email protected]';
import { INITIAL_CONFIG, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS } from './platform-server.mjs';
import { DenoFileSystemResourceLoader } from './resource-loader.ts';
export const RESOURCE_PATH = new InjectionToken('RESOURCE_PATH');
const platformDenoDynamicServer = (resourcePath: string) => createPlatformFactory(ɵplatformCoreDynamic, "serverDenoDynamic",
[...INTERNAL_SERVER_PLATFORM_PROVIDERS,
{
provide: COMPILER_OPTIONS,
useValue: {
providers: [
{
provide: RESOURCE_PATH,
useValue: resourcePath
},
{
provide: ResourceLoader,
useClass: DenoFileSystemResourceLoader,
deps: [Injector]
}
]
},
multi: true
}
]);
export async function bootstrap(module: any, document: string, resourcePath: string = "") {
return Promise.resolve(platformDenoDynamicServer(resourcePath)([
{
provide: INITIAL_CONFIG,
useValue: {
document,
url: '/'
}
}]).bootstrapModule(module, { ngZone: 'noop' }).then((ref: any) => {
return Promise.resolve(ref)
}));
}