@3dsource/angular-unreal-module 0.0.175 → 0.0.181
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/README.md +50 -19
- package/fesm2022/3dsource-angular-unreal-module-config.mjs +10 -0
- package/fesm2022/3dsource-angular-unreal-module-config.mjs.map +1 -0
- package/fesm2022/3dsource-angular-unreal-module.mjs +1055 -507
- package/fesm2022/3dsource-angular-unreal-module.mjs.map +1 -1
- package/package.json +8 -4
- package/types/3dsource-angular-unreal-module-config.d.ts +27 -0
- package/types/3dsource-angular-unreal-module.d.ts +246 -165
package/README.md
CHANGED
|
@@ -9,18 +9,27 @@ command/callback APIs, reconnection, file transfer and telemetry.
|
|
|
9
9
|
- Angular, Angular CDK and Angular Forms `>=19.0.0 <23.0.0`
|
|
10
10
|
- NgRx Store and Effects `>=19.0.0 <23.0.0`
|
|
11
11
|
- RxJS `>=7.8.0 <8.0.0`
|
|
12
|
-
- `@3dsource/types-unreal >=0.0.
|
|
13
|
-
- `@3dsource/utils >=1.0.21`
|
|
12
|
+
- `@3dsource/types-unreal >=0.0.14 <0.1.0`
|
|
14
13
|
- `provideHttpClient()` in the host application
|
|
15
14
|
|
|
16
15
|
## Installation
|
|
17
16
|
|
|
18
17
|
```shell
|
|
19
|
-
pnpm add @3dsource/angular-unreal-module @3dsource/types-unreal
|
|
18
|
+
pnpm add @3dsource/angular-unreal-module @3dsource/types-unreal
|
|
20
19
|
```
|
|
21
20
|
|
|
22
21
|
The package is standalone and does not expose an NgModule.
|
|
23
22
|
|
|
23
|
+
### Entry points
|
|
24
|
+
|
|
25
|
+
| Entry point | Contains |
|
|
26
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
27
|
+
| `@3dsource/angular-unreal-module` | Everything — scene component, services, NgRx state, providers, helpers |
|
|
28
|
+
| `@3dsource/angular-unreal-module/config` | `UNREAL_CONFIG`, `UnrealInitialConfig`, `UnrealMode` only — no engine, 266 B of FESM |
|
|
29
|
+
|
|
30
|
+
Import the token from `/config` in the application root and keep every other
|
|
31
|
+
import behind a lazy route — see [Setup](#setup) for why.
|
|
32
|
+
|
|
24
33
|
### Styling
|
|
25
34
|
|
|
26
35
|
The package ships its own styles and requires no UI library. Everything it draws
|
|
@@ -232,11 +241,11 @@ root. `UNREAL_CONFIG` is required, although all its fields are optional.
|
|
|
232
241
|
import { provideHttpClient } from '@angular/common/http';
|
|
233
242
|
import type { ApplicationConfig } from '@angular/core';
|
|
234
243
|
import { provideStore } from '@ngrx/store';
|
|
244
|
+
import { provideUnrealState } from '@3dsource/angular-unreal-module';
|
|
235
245
|
import {
|
|
236
|
-
provideUnrealState,
|
|
237
246
|
UNREAL_CONFIG,
|
|
238
247
|
type UnrealInitialConfig,
|
|
239
|
-
} from '@3dsource/angular-unreal-module';
|
|
248
|
+
} from '@3dsource/angular-unreal-module/config';
|
|
240
249
|
|
|
241
250
|
const unrealConfig = {
|
|
242
251
|
regionsPingUrl: 'https://datacenter.3dsource.com/regions/',
|
|
@@ -257,6 +266,21 @@ export const appConfig: ApplicationConfig = {
|
|
|
257
266
|
|
|
258
267
|
Omit `provideStore()` when the root NgRx store is already configured.
|
|
259
268
|
|
|
269
|
+
`UNREAL_CONFIG` comes from the `/config` entry point on purpose. The token has to
|
|
270
|
+
be provided in the **root** injector, because the module's services are
|
|
271
|
+
`providedIn: 'root'` singletons and cannot see a route-level provider. The package
|
|
272
|
+
itself ships as one FESM, and esbuild places a module in the common-ancestor chunk
|
|
273
|
+
of its importers — so importing the token from the package root here pulls the
|
|
274
|
+
whole engine into the application's eager bundle. On a metabox production build
|
|
275
|
+
that was 180 kB raw (49 kB gzip) of `main` spent on pages that never stream.
|
|
276
|
+
|
|
277
|
+
This pays off only while **nothing else** in the eager graph imports the package
|
|
278
|
+
root. Following the example above literally does not qualify — the
|
|
279
|
+
`provideUnrealState()` import next to it brings the FESM back. An app that wants
|
|
280
|
+
the engine out of its initial bundle moves `provideUnrealState()` to the lazy
|
|
281
|
+
route alongside `provideUnrealModule()` (step 2) and leaves only the
|
|
282
|
+
`UNREAL_CONFIG` provider at the root.
|
|
283
|
+
|
|
260
284
|
Available configuration fields:
|
|
261
285
|
|
|
262
286
|
| Field | Purpose |
|
|
@@ -353,6 +377,14 @@ export class StreamComponent {}
|
|
|
353
377
|
|
|
354
378
|
Command packet types are provided by `@3dsource/types-unreal`.
|
|
355
379
|
|
|
380
|
+
That package ships two type contours, prod and QA, and your application and
|
|
381
|
+
this package must resolve the **same** one — the selection is a `tsconfig`
|
|
382
|
+
path override on the bare specifier, never an import. A bundler that ignores
|
|
383
|
+
`tsconfig` paths (plain Vite or webpack without a matching `resolve.alias`)
|
|
384
|
+
takes the types from one contour and the enum values from the other, which
|
|
385
|
+
fails at runtime rather than at compile time. See "Two contours: prod and QA"
|
|
386
|
+
in the `@3dsource/types-unreal` README.
|
|
387
|
+
|
|
356
388
|
Run `pnpm demo:start` from the repository root to see the scene component in
|
|
357
389
|
the demo application.
|
|
358
390
|
|
|
@@ -405,31 +437,30 @@ required.
|
|
|
405
437
|
Run commands from the repository root:
|
|
406
438
|
|
|
407
439
|
```shell
|
|
408
|
-
pnpm unreal:build
|
|
409
|
-
pnpm unreal:build:watch
|
|
410
|
-
pnpm unreal:lint
|
|
411
|
-
pnpm unreal:test
|
|
412
|
-
pnpm unreal:test:watch
|
|
413
|
-
pnpm unreal:test:signalling
|
|
414
|
-
pnpm unreal:test:signalling:leaks
|
|
440
|
+
pnpm unreal-module:build
|
|
441
|
+
pnpm unreal-module:build:watch
|
|
442
|
+
pnpm unreal-module:lint
|
|
443
|
+
pnpm unreal-module:test
|
|
444
|
+
pnpm unreal-module:test:watch
|
|
445
|
+
pnpm unreal-module:test:signalling
|
|
446
|
+
pnpm unreal-module:test:signalling:leaks
|
|
415
447
|
```
|
|
416
448
|
|
|
417
|
-
`unreal:build` builds the local `types-unreal`
|
|
418
|
-
this package.
|
|
449
|
+
`unreal-module:build` builds the local `types-unreal` dependency before this package.
|
|
419
450
|
|
|
420
451
|
Release commands publish only this package:
|
|
421
452
|
|
|
422
453
|
```shell
|
|
423
|
-
pnpm unreal:release:patch
|
|
424
|
-
pnpm unreal:release:dev
|
|
454
|
+
pnpm unreal-module:release:patch
|
|
455
|
+
pnpm unreal-module:release:dev
|
|
425
456
|
```
|
|
426
457
|
|
|
427
458
|
After a successful publish, the release automatically purges the matching
|
|
428
459
|
jsDelivr tag. Retry a failed purge without rerunning the release:
|
|
429
460
|
|
|
430
461
|
```shell
|
|
431
|
-
pnpm unreal:purge-cdn -- latest
|
|
432
|
-
pnpm unreal:purge-cdn -- dev
|
|
462
|
+
pnpm unreal-module:purge-cdn -- latest
|
|
463
|
+
pnpm unreal-module:purge-cdn -- dev
|
|
433
464
|
```
|
|
434
465
|
|
|
435
|
-
Repository tooling requires Node.js 24.16.0 or newer and pnpm
|
|
466
|
+
Repository tooling requires Node.js 24.16.0 or newer and pnpm last version.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
const UNREAL_CONFIG = new InjectionToken('Unreal Initial Configuration');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generated bundle index. Do not edit.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { UNREAL_CONFIG };
|
|
10
|
+
//# sourceMappingURL=3dsource-angular-unreal-module-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3dsource-angular-unreal-module-config.mjs","sources":["../../../../projects/3dsource/angular-unreal-module/config/lib/unreal-config.token.ts","../../../../projects/3dsource/angular-unreal-module/config/3dsource-angular-unreal-module-config.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { UnrealInitialConfig } from './initial-config';\n\nexport const UNREAL_CONFIG = new InjectionToken<UnrealInitialConfig>(\n 'Unreal Initial Configuration',\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAGa,aAAa,GAAG,IAAI,cAAc,CAC7C,8BAA8B;;ACJhC;;AAEG;;;;"}
|