create-analog 1.6.4 → 1.7.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-analog",
3
- "version": "1.6.4",
3
+ "version": "1.7.0-beta.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Brandon Roberts",
@@ -15,8 +15,8 @@
15
15
  "test": "ng test"
16
16
  },
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.6.4",
19
- "@analogjs/router": "^1.6.4",
18
+ "@analogjs/content": "^1.7.0-beta.10",
19
+ "@analogjs/router": "^1.7.0-beta.10",
20
20
  "@angular/animations": "^16.2.0",
21
21
  "@angular/common": "^16.2.0",
22
22
  "@angular/compiler": "^16.2.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.13.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^1.6.4",
42
- "@analogjs/vite-plugin-angular": "^1.6.4",
43
- "@analogjs/vitest-angular": "^1.6.4",
41
+ "@analogjs/platform": "^1.7.0-beta.10",
42
+ "@analogjs/vite-plugin-angular": "^1.7.0-beta.10",
43
+ "@analogjs/vitest-angular": "^1.7.0-beta.10",
44
44
  "@angular-devkit/build-angular": "^16.2.0",
45
45
  "@angular/cli": "^16.2.0",
46
46
  "@angular/compiler-cli": "^16.2.0",
@@ -15,8 +15,8 @@
15
15
  "test": "ng test"
16
16
  },
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.6.4",
19
- "@analogjs/router": "^1.6.4",
18
+ "@analogjs/content": "^1.7.0-beta.10",
19
+ "@analogjs/router": "^1.7.0-beta.10",
20
20
  "@angular/animations": "^17.2.0",
21
21
  "@angular/common": "^17.2.0",
22
22
  "@angular/compiler": "^17.2.0",
@@ -38,9 +38,9 @@
38
38
  "zone.js": "~0.14.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@analogjs/platform": "^1.6.4",
42
- "@analogjs/vite-plugin-angular": "^1.6.4",
43
- "@analogjs/vitest-angular": "^1.6.4",
41
+ "@analogjs/platform": "^1.7.0-beta.10",
42
+ "@analogjs/vite-plugin-angular": "^1.7.0-beta.10",
43
+ "@analogjs/vitest-angular": "^1.7.0-beta.10",
44
44
  "@angular-devkit/build-angular": "^17.2.0",
45
45
  "@angular/cli": "^17.2.0",
46
46
  "@angular/compiler-cli": "^17.2.0",
@@ -15,8 +15,8 @@
15
15
  "test": "ng test"
16
16
  },
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.6.4",
19
- "@analogjs/router": "^1.6.4",
18
+ "@analogjs/content": "^1.7.0-beta.10",
19
+ "@analogjs/router": "^1.7.0-beta.10",
20
20
  "@angular/animations": "^18.0.0",
21
21
  "@angular/common": "^18.0.0",
22
22
  "@angular/compiler": "^18.0.0",
@@ -35,9 +35,9 @@
35
35
  "zone.js": "~0.14.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@analogjs/platform": "^1.6.4",
39
- "@analogjs/vite-plugin-angular": "^1.6.4",
40
- "@analogjs/vitest-angular": "^1.6.4",
38
+ "@analogjs/platform": "^1.7.0-beta.10",
39
+ "@analogjs/vite-plugin-angular": "^1.7.0-beta.10",
40
+ "@analogjs/vitest-angular": "^1.7.0-beta.10",
41
41
  "@angular-devkit/build-angular": "^18.0.0",
42
42
  "@angular/cli": "^18.0.0",
43
43
  "@angular/compiler-cli": "^18.0.0",
@@ -1,15 +1,9 @@
1
1
  import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2
- import {
3
- provideServerRendering,
4
- ɵSERVER_CONTEXT as SERVER_CONTEXT,
5
- } from '@angular/platform-server';
2
+ import { provideServerRendering } from '@angular/platform-server';
6
3
  import { appConfig } from './app.config';
7
4
 
8
5
  const serverConfig: ApplicationConfig = {
9
- providers: [
10
- provideServerRendering(),
11
- { provide: SERVER_CONTEXT, useValue: 'ssr-analog' },
12
- ],
6
+ providers: [provideServerRendering()],
13
7
  };
14
8
 
15
9
  export const config = mergeApplicationConfig(appConfig, serverConfig);
@@ -1,7 +1,11 @@
1
- import { provideHttpClient, withFetch } from '@angular/common/http';
1
+ import {
2
+ provideHttpClient,
3
+ withFetch,
4
+ withInterceptors,
5
+ } from '@angular/common/http';
2
6
  import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
3
7
  import { provideClientHydration } from '@angular/platform-browser';
4
- import { provideFileRouter } from '@analogjs/router';
8
+ import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
5
9
  import { provideContent, withMarkdownRenderer } from '@analogjs/content';
6
10
  import { __HIGHLIGHTER__ } from '@analogjs/content/__HIGHLIGHTER_ENTRY_POINT__';
7
11
 
@@ -9,7 +13,10 @@ export const appConfig: ApplicationConfig = {
9
13
  providers: [
10
14
  provideZoneChangeDetection({ eventCoalescing: true }),
11
15
  provideFileRouter(),
12
- provideHttpClient(withFetch()),
16
+ provideHttpClient(
17
+ withFetch(),
18
+ withInterceptors([requestContextInterceptor])
19
+ ),
13
20
  provideClientHydration(),
14
21
  provideContent(withMarkdownRenderer(), __HIGHLIGHTER__()),
15
22
  ],
@@ -24,6 +24,6 @@ import PostAttributes from '../../post-attributes';
24
24
  `,
25
25
  ],
26
26
  })
27
- export default class HomeComponent {
27
+ export default class BlogPostComponent {
28
28
  readonly post$ = injectContent<PostAttributes>('slug');
29
29
  }
@@ -31,6 +31,6 @@ import { RouterLink } from '@angular/router';
31
31
  `,
32
32
  ],
33
33
  })
34
- export default class HomeComponent {
34
+ export default class BlogComponent {
35
35
  readonly posts = injectContentFiles<PostAttributes>();
36
36
  }
@@ -1,7 +1,10 @@
1
1
  import 'zone.js/node';
2
+ import '@angular/platform-server/init';
2
3
  import { enableProdMode } from '@angular/core';
3
4
  import { bootstrapApplication } from '@angular/platform-browser';
4
5
  import { renderApplication } from '@angular/platform-server';
6
+ import { provideServerContext } from '@analogjs/router/server';
7
+ import { ServerContext } from '@analogjs/router/tokens';
5
8
 
6
9
  import { config } from './app/app.config.server';
7
10
  import { AppComponent } from './app/app.component';
@@ -14,10 +17,15 @@ export function bootstrap() {
14
17
  return bootstrapApplication(AppComponent, config);
15
18
  }
16
19
 
17
- export default async function render(url: string, document: string) {
20
+ export default async function render(
21
+ url: string,
22
+ document: string,
23
+ serverContext: ServerContext
24
+ ) {
18
25
  const html = await renderApplication(bootstrap, {
19
26
  document,
20
27
  url,
28
+ platformProviders: [provideServerContext(serverContext)],
21
29
  });
22
30
 
23
31
  return html;
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "private": true,
17
17
  "dependencies": {
18
- "@analogjs/content": "^1.6.4",
19
- "@analogjs/router": "^1.6.4",
18
+ "@analogjs/content": "^1.7.0-beta.10",
19
+ "@analogjs/router": "^1.7.0-beta.10",
20
20
  "@angular/animations": "^18.0.0",
21
21
  "@angular/common": "^18.0.0",
22
22
  "@angular/compiler": "^18.0.0",
@@ -37,9 +37,9 @@
37
37
  "zone.js": "~0.14.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@analogjs/platform": "^1.6.4",
41
- "@analogjs/vite-plugin-angular": "^1.6.4",
42
- "@analogjs/vitest-angular": "^1.6.4",
40
+ "@analogjs/platform": "^1.7.0-beta.10",
41
+ "@analogjs/vite-plugin-angular": "^1.7.0-beta.10",
42
+ "@analogjs/vitest-angular": "^1.7.0-beta.10",
43
43
  "@angular-devkit/build-angular": "^18.0.0",
44
44
  "@angular/cli": "^18.0.0",
45
45
  "@angular/compiler-cli": "^18.0.0",
@@ -1,16 +1,10 @@
1
1
  import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2
- import {
3
- provideServerRendering,
4
- ɵSERVER_CONTEXT as SERVER_CONTEXT,
5
- } from '@angular/platform-server';
2
+ import { provideServerRendering } from '@angular/platform-server';
6
3
 
7
4
  import { appConfig } from './app.config';
8
5
 
9
6
  const serverConfig: ApplicationConfig = {
10
- providers: [
11
- provideServerRendering(),
12
- { provide: SERVER_CONTEXT, useValue: 'ssr-analog' },
13
- ],
7
+ providers: [provideServerRendering()],
14
8
  };
15
9
 
16
10
  export const config = mergeApplicationConfig(appConfig, serverConfig);
@@ -1,13 +1,20 @@
1
- import { provideHttpClient, withFetch } from '@angular/common/http';
1
+ import {
2
+ provideHttpClient,
3
+ withFetch,
4
+ withInterceptors,
5
+ } from '@angular/common/http';
2
6
  import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
3
7
  import { provideClientHydration } from '@angular/platform-browser';
4
- import { provideFileRouter } from '@analogjs/router';
8
+ import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
5
9
 
6
10
  export const appConfig: ApplicationConfig = {
7
11
  providers: [
8
12
  provideZoneChangeDetection({ eventCoalescing: true }),
9
13
  provideFileRouter(),
10
- provideHttpClient(withFetch()),
14
+ provideHttpClient(
15
+ withFetch(),
16
+ withInterceptors([requestContextInterceptor])
17
+ ),
11
18
  provideClientHydration(),
12
19
  ],
13
20
  };
@@ -1,9 +1,10 @@
1
1
  import 'zone.js/node';
2
2
  import '@angular/platform-server/init';
3
-
4
3
  import { enableProdMode } from '@angular/core';
5
4
  import { bootstrapApplication } from '@angular/platform-browser';
6
5
  import { renderApplication } from '@angular/platform-server';
6
+ import { provideServerContext } from '@analogjs/router/server';
7
+ import { ServerContext } from '@analogjs/router/tokens';
7
8
 
8
9
  import { config } from './app/app.config.server';
9
10
  import { AppComponent } from './app/app.component';
@@ -16,10 +17,15 @@ export function bootstrap() {
16
17
  return bootstrapApplication(AppComponent, config);
17
18
  }
18
19
 
19
- export default async function render(url: string, document: string) {
20
+ export default async function render(
21
+ url: string,
22
+ document: string,
23
+ serverContext: ServerContext
24
+ ) {
20
25
  const html = await renderApplication(bootstrap, {
21
26
  document,
22
27
  url,
28
+ platformProviders: [provideServerContext(serverContext)],
23
29
  });
24
30
 
25
31
  return html;