diff --git a/README.md b/README.md index 09aac96..18ff7f5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Angular renderer in Deno +Now Supported Angular 11 and Deno 1.6 + This is experimental Angular SSR in Deno, and will be used as a renderer for [Alosaur](https://github.com/alosaur/alosaur) web framework, as well as handlebars, ejs, mustache. ## How to use @@ -12,7 +14,7 @@ importmap.json: ```json { "imports": { - "@angular/core": "https://jspm.dev/@angular/core@10.0.1", + "@angular/core": "https://jspm.dev/@angular/core@11", "@angular/deno": "https://deno.land/x/angular_deno/mod.ts", "@angular/deno/": "https://deno.land/x/angular_deno/", "zone.js": "https://jspm.dev/zone.js/dist/zone" diff --git a/bootstrap.ts b/bootstrap.ts index c39ec6b..bfa7abc 100644 --- a/bootstrap.ts +++ b/bootstrap.ts @@ -1,6 +1,6 @@ -import { createPlatformFactory, Injector, COMPILER_OPTIONS, InjectionToken } from 'https://jspm.dev/@angular/core@10.0.1'; -import { ɵplatformCoreDynamic } from 'https://jspm.dev/@angular/platform-browser-dynamic@10.0.1'; -import { ResourceLoader } from 'https://jspm.dev/@angular/compiler@10.0.1'; +import { createPlatformFactory, Injector, COMPILER_OPTIONS, InjectionToken } from 'https://jspm.dev/@angular/core@11'; +import { ɵplatformCoreDynamic } from 'https://jspm.dev/@angular/platform-browser-dynamic@11'; +import { ResourceLoader } from 'https://jspm.dev/@angular/compiler@11'; import { INITIAL_CONFIG, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS } from './platform-server.mjs'; import { DenoFileSystemResourceLoader } from './resource-loader.ts'; @@ -38,4 +38,4 @@ export async function bootstrap(module: any, document: string, resourcePath: str }]).bootstrapModule(module, { ngZone: 'noop' }).then((ref: any) => { return Promise.resolve(ref) })); -} \ No newline at end of file +} diff --git a/engine.ts b/engine.ts index eb375d2..3d5cf63 100644 --- a/engine.ts +++ b/engine.ts @@ -1,5 +1,5 @@ -import { NgModuleFactory, CompilerFactory, StaticProvider, Compiler } from 'https://jspm.dev/@angular/core@10.0.1'; +import { NgModuleFactory, CompilerFactory, Compiler } from 'https://jspm.dev/@angular/core@11'; import { INITIAL_CONFIG, renderModuleFactory } from './platform-server.mjs'; const { readFile } = Deno; const decoder = new TextDecoder(); @@ -7,7 +7,10 @@ const decoder = new TextDecoder(); export class CommonEngine { /** Return an instance of the platformServer compiler */ + + // @ts-ignore getCompiler(): Compiler { + // @ts-ignore const compilerFactory: CompilerFactory = this.compilerFactory;//platformCoreDynamic().injector.get(CompilerFactory); return compilerFactory.createCompiler(); @@ -16,8 +19,9 @@ export class CommonEngine { private factoryCacheMap = new Map(); private readonly templateCache: Map = new Map() + // @ts-ignore constructor(private compilerFactory: CompilerFactory, private moduleOrFactory?: any, - private providers: StaticProvider[] = []) { } + private providers: any[] = []) { } /** * Render an HTML document for a specific URL with specified @@ -79,4 +83,4 @@ export class CommonEngine { return template; }); } -} \ No newline at end of file +} diff --git a/example/README.md b/example/README.md index 5d14774..8afb4d0 100644 --- a/example/README.md +++ b/example/README.md @@ -20,7 +20,7 @@ Output: - Angular in Deno v1.1.2 + Angular in Deno v1.6.2 -``` \ No newline at end of file +``` diff --git a/example/importmap.json b/example/importmap.json index 4b98f15..ef8f26f 100644 --- a/example/importmap.json +++ b/example/importmap.json @@ -1,6 +1,6 @@ { "imports": { - "@angular/core": "https://jspm.dev/@angular/core@10.0.1", + "@angular/core": "https://jspm.dev/@angular/core@11", "zone.js": "https://jspm.dev/zone.js/dist/zone" } -} \ No newline at end of file +} diff --git a/example/server.ts b/example/server.ts index bd92f03..04f149b 100644 --- a/example/server.ts +++ b/example/server.ts @@ -1,4 +1,4 @@ -import { serve } from "https://deno.land/std@0.59.0/http/server.ts"; +import { serve } from "https://deno.land/std@0.82.0/http/server.ts"; import { CompilerFactory, enableProdMode } from "@angular/core"; import { bootstrap, CommonEngine } from "../mod.ts"; diff --git a/platform-server.mjs b/platform-server.mjs index 05b732b..d5ce80e 100644 --- a/platform-server.mjs +++ b/platform-server.mjs @@ -1,14 +1,14 @@ -import _core from 'https://jspm.dev/npm:@angular/core@10.0.1!cjs'; +import _core from 'https://jspm.dev/npm:@angular/core@11!cjs'; import 'https://jspm.dev/npm:rxjs@6!cjs'; import 'https://jspm.dev/npm:rxjs@6/operators!cjs'; -import _common from 'https://jspm.dev/npm:@angular/common@10.0.1!cjs'; -import _platformBrowser from 'https://jspm.dev/npm:@angular/platform-browser@10.0.1!cjs'; -import _browser from 'https://jspm.dev/npm:@angular/animations@10.0.1/browser!cjs'; -import _http from 'https://jspm.dev/npm:@angular/common@10.0.1/http!cjs'; -import _compiler from 'https://jspm.dev/npm:@angular/compiler@10.0.1!cjs'; -import _platformBrowserDynamic from 'https://jspm.dev/npm:@angular/platform-browser-dynamic@10.0.1!cjs'; -import 'https://jspm.dev/npm:@angular/animations@10.0.1!cjs'; -import _animations from 'https://jspm.dev/npm:@angular/platform-browser@10.0.1/animations!cjs'; +import _common from 'https://jspm.dev/npm:@angular/common@11!cjs'; +import _platformBrowser from 'https://jspm.dev/npm:@angular/platform-browser@11!cjs'; +import _browser from 'https://jspm.dev/npm:@angular/animations@11/browser!cjs'; +import _http from 'https://jspm.dev/npm:@angular/common@11/http!cjs'; +import _compiler from 'https://jspm.dev/npm:@angular/compiler@11!cjs'; +import _platformBrowserDynamic from 'https://jspm.dev/npm:@angular/platform-browser-dynamic@11!cjs'; +import 'https://jspm.dev/npm:@angular/animations@11!cjs'; +import _animations from 'https://jspm.dev/npm:@angular/platform-browser@11/animations!cjs'; import _rxjs from 'https://jspm.dev/npm:rxjs!cjs'; import _url from 'https://jspm.dev/npm:@jspm/core@2/nodelibs/url'; import _operators from 'https://jspm.dev/npm:rxjs/operators!cjs'; @@ -1858,4 +1858,4 @@ const BEFORE_APP_SERIALIZED = exports.BEFORE_APP_SERIALIZED, export default exports; export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, __esModule, platformDynamicServer, platformServer, renderModule, renderModuleFactory, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, ɵSERVER_RENDER_PROVIDERS, ɵServerRendererFactory2, ɵangular_packages_platform_server_platform_server_a, ɵangular_packages_platform_server_platform_server_b, ɵangular_packages_platform_server_platform_server_c, ɵangular_packages_platform_server_platform_server_d, ɵangular_packages_platform_server_platform_server_e, ɵangular_packages_platform_server_platform_server_f, ɵangular_packages_platform_server_platform_server_g }; -//# sourceMappingURL=platform-server@10.0.1!cjs.map \ No newline at end of file +//# sourceMappingURL=platform-server@11!cjs.map diff --git a/resource-loader.ts b/resource-loader.ts index fd511fb..11c0df0 100644 --- a/resource-loader.ts +++ b/resource-loader.ts @@ -1,6 +1,6 @@ -import { ResourceLoader } from 'https://jspm.dev/@angular/compiler@10.0.1'; -import { Injector } from 'https://jspm.dev/@angular/core@10.0.1'; -import { join } from "https://deno.land/std@0.65.0/path/posix.ts"; +import { ResourceLoader } from 'https://jspm.dev/@angular/compiler@11'; +import { Injector } from 'https://jspm.dev/@angular/core@11'; +import { join } from "https://deno.land/std@0.82.0/path/posix.ts"; import { RESOURCE_PATH } from './bootstrap.ts'; const { readFile } = Deno; @@ -10,6 +10,7 @@ export class DenoFileSystemResourceLoader extends ResourceLoader { private readonly filesCache: Map = new Map() private readonly resourcePath: string; + // @ts-ignore constructor(private readonly injector: Injector) { super(); @@ -41,4 +42,4 @@ export class DenoFileSystemResourceLoader extends ResourceLoader { return template; }); } -} \ No newline at end of file +}