@ng-doc/add 22.0.0-beta.1 → 22.0.0
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 +19 -29
- package/package.json +23 -21
- package/schematics/collection.json +14 -14
- package/schematics/ng-add/constants/modules.d.ts +22 -0
- package/schematics/ng-add/constants/modules.js +25 -11
- package/schematics/ng-add/constants/modules.js.map +1 -1
- package/schematics/ng-add/constants/styles.d.ts +4 -0
- package/schematics/ng-add/constants/styles.js +8 -1
- package/schematics/ng-add/constants/styles.js.map +1 -1
- package/schematics/ng-add/index.d.ts +5 -2
- package/schematics/ng-add/index.js +43 -14
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.d.ts +8 -0
- package/schematics/ng-add/schema.json +19 -14
- package/schematics/ng-add/steps/add-assets.d.ts +2 -3
- package/schematics/ng-add/steps/add-assets.js +9 -4
- package/schematics/ng-add/steps/add-assets.js.map +1 -1
- package/schematics/ng-add/steps/add-git-ignore.d.ts +1 -3
- package/schematics/ng-add/steps/add-git-ignore.js +9 -4
- package/schematics/ng-add/steps/add-git-ignore.js.map +1 -1
- package/schematics/ng-add/steps/add-layout.d.ts +2 -2
- package/schematics/ng-add/steps/add-layout.js +8 -2
- package/schematics/ng-add/steps/add-layout.js.map +1 -1
- package/schematics/ng-add/steps/add-ng-doc-app-config.d.ts +5 -1
- package/schematics/ng-add/steps/add-ng-doc-app-config.js +200 -54
- package/schematics/ng-add/steps/add-ng-doc-app-config.js.map +1 -1
- package/schematics/ng-add/steps/add-tsconfig-paths.js +2 -1
- package/schematics/ng-add/steps/add-tsconfig-paths.js.map +1 -1
- package/schematics/ng-add/steps/post-install.d.ts +4 -2
- package/schematics/ng-add/steps/post-install.js +4 -3
- package/schematics/ng-add/steps/post-install.js.map +1 -1
- package/schematics/ng-add/steps/raise-initial-budget.d.ts +22 -0
- package/schematics/ng-add/steps/raise-initial-budget.js +70 -0
- package/schematics/ng-add/steps/raise-initial-budget.js.map +1 -0
- package/schematics/ng-add/steps/replace-builders.d.ts +2 -2
- package/schematics/ng-add/steps/replace-builders.js +12 -4
- package/schematics/ng-add/steps/replace-builders.js.map +1 -1
- package/schematics/ng-add/steps/update-app-ts-config.js +2 -1
- package/schematics/ng-add/steps/update-app-ts-config.js.map +1 -1
- package/schematics/ng-add/utils/add-array-entry.d.ts +56 -0
- package/schematics/ng-add/utils/add-array-entry.js +325 -0
- package/schematics/ng-add/utils/add-array-entry.js.map +1 -0
- package/schematics/ng-add/utils/add-unique-import.d.ts +7 -3
- package/schematics/ng-add/utils/add-unique-import.js +21 -16
- package/schematics/ng-add/utils/add-unique-import.js.map +1 -1
- package/schematics/ng-add/utils/get-app-component.d.ts +4 -3
- package/schematics/ng-add/utils/get-app-component.js +7 -5
- package/schematics/ng-add/utils/get-app-component.js.map +1 -1
- package/schematics/ng-add/utils/get-app-template-path.d.ts +4 -8
- package/schematics/ng-add/utils/get-app-template-path.js +4 -4
- package/schematics/ng-add/utils/get-app-template-path.js.map +1 -1
- package/schematics/ng-add/utils/get-build-options-target.d.ts +17 -0
- package/schematics/ng-add/utils/get-build-options-target.js +27 -0
- package/schematics/ng-add/utils/get-build-options-target.js.map +1 -0
- package/schematics/ng-add/utils/get-main-path.d.ts +2 -2
- package/schematics/ng-add/utils/get-main-path.js +4 -3
- package/schematics/ng-add/utils/get-main-path.js.map +1 -1
- package/schematics/ng-add/utils/get-root-module.d.ts +14 -0
- package/schematics/ng-add/utils/get-root-module.js +31 -0
- package/schematics/ng-add/utils/get-root-module.js.map +1 -0
- package/schematics/ng-add/utils/select-engine.d.ts +38 -0
- package/schematics/ng-add/utils/select-engine.js +97 -0
- package/schematics/ng-add/utils/select-engine.js.map +1 -0
package/README.md
CHANGED
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<h1 align="center" style="margin-bottom: 0; border-bottom: 0">NgDoc</h1>
|
|
9
|
-
<p align="center">
|
|
10
|
-
Create user-friendly documentation for your projects with ease!
|
|
11
|
-
<br />
|
|
12
|
-
<a href="https://ng-doc.com/">Documentation</a>
|
|
13
|
-
·
|
|
14
|
-
<a href="https://github.com/ng-doc/ng-doc/issues/new/choose">Report Bug</a>
|
|
15
|
-
·
|
|
16
|
-
<a href="https://github.com/ng-doc/ng-doc/issues/new/choose">Request Feature</a>
|
|
17
|
-
|
|
18
|
-
[![GitHub Workflow Status][build-shield]][build-url]
|
|
1
|
+
# 🪄 @ng-doc/add
|
|
2
|
+
|
|
3
|
+
The `ng add` schematics that install NgDoc and configure your project.
|
|
4
|
+
|
|
5
|
+
It's part of [NgDoc](https://ng-doc.com/) 📚, the documentation engine for Angular projects.
|
|
6
|
+
|
|
19
7
|
[![NPM][npm-shield]][npm-url]
|
|
20
8
|
[![MIT License][license-shield]][license-url]
|
|
21
9
|
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
## 🚀 Getting started
|
|
11
|
+
|
|
12
|
+
Run it in your Angular project to install and configure NgDoc:
|
|
24
13
|
|
|
25
|
-
|
|
14
|
+
```bash
|
|
15
|
+
ng add @ng-doc/add
|
|
16
|
+
```
|
|
26
17
|
|
|
27
|
-
##
|
|
18
|
+
## 📖 Learn more
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
- [Documentation](https://ng-doc.com/)
|
|
21
|
+
- [GitHub repository](https://github.com/ng-doc/ng-doc)
|
|
22
|
+
- [Report a bug or request a feature](https://github.com/ng-doc/ng-doc/issues/new/choose)
|
|
31
23
|
|
|
32
|
-
[npm-shield]: https://img.shields.io/npm/v
|
|
33
|
-
[npm-url]: https://www.npmjs.com/package/@ng-doc/
|
|
24
|
+
[npm-shield]: https://img.shields.io/npm/v/%40ng-doc%2Fadd.svg?style=for-the-badge
|
|
25
|
+
[npm-url]: https://www.npmjs.com/package/@ng-doc/add
|
|
34
26
|
[license-shield]: https://img.shields.io/github/license/ng-doc/ng-doc.svg?style=for-the-badge
|
|
35
|
-
[license-url]: https://github.com/
|
|
36
|
-
[build-shield]: https://img.shields.io/github/actions/workflow/status/ng-doc/ng-doc/release.yml?style=for-the-badge&branch=release
|
|
37
|
-
[build-url]: https://github.com/ng-doc/ng-doc/actions
|
|
27
|
+
[license-url]: https://github.com/ng-doc/ng-doc/blob/main/LICENSE
|
package/package.json
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-doc/add",
|
|
3
|
-
"version": "22.0.0
|
|
4
|
-
"
|
|
5
|
-
"schematics": "./schematics/collection.json",
|
|
6
|
-
"ng-add": {
|
|
7
|
-
"save": true
|
|
8
|
-
},
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@angular/cdk": ">=21.0.0 < 22.0.0",
|
|
14
|
-
"@angular-devkit/schematics": ">=21.0.0 < 22.0.0",
|
|
15
|
-
"ng-morph": "4.8.4"
|
|
16
|
-
},
|
|
17
|
-
"types": "./schematics/index.d.ts",
|
|
18
|
-
"main": "./schematics/index.js",
|
|
3
|
+
"version": "22.0.0",
|
|
4
|
+
"description": "Adds NgDoc to an Angular or Nx project with `ng add` and sets everything up for you.",
|
|
19
5
|
"keywords": [
|
|
20
6
|
"angular",
|
|
21
7
|
"documentation",
|
|
@@ -26,14 +12,30 @@
|
|
|
26
12
|
"demo",
|
|
27
13
|
"ng-doc"
|
|
28
14
|
],
|
|
29
|
-
"
|
|
15
|
+
"homepage": "https://ng-doc.com",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/ng-doc/ng-doc/issues"
|
|
18
|
+
},
|
|
30
19
|
"repository": {
|
|
31
20
|
"type": "git",
|
|
32
21
|
"url": "git+https://github.com/ng-doc/ng-doc.git"
|
|
33
22
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"schematics": "./schematics/collection.json",
|
|
26
|
+
"ng-add": {
|
|
27
|
+
"save": true
|
|
36
28
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@ng-doc/builder": "22.0.0",
|
|
34
|
+
"@angular/cdk": ">=22.0.0 < 23.0.0",
|
|
35
|
+
"@angular-devkit/schematics": ">=22.0.0 < 23.0.0",
|
|
36
|
+
"ng-morph": "4.9.0"
|
|
37
|
+
},
|
|
38
|
+
"types": "./schematics/index.d.ts",
|
|
39
|
+
"main": "./schematics/index.js",
|
|
40
|
+
"author": "Skoropad Aleksandr <alex@skoropad.dev>"
|
|
39
41
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add NgDoc library to the project.",
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"ng-add-setup-project": {
|
|
10
|
+
"private": true,
|
|
11
|
+
"description": "Sets up the project; runs before the dependencies added by ng-add are installed",
|
|
12
|
+
"factory": "./ng-add/index#ngAddSetupProject",
|
|
13
|
+
"schema": "./ng-add/schema.json"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
16
|
}
|
|
@@ -3,9 +3,25 @@ export interface EntityImport {
|
|
|
3
3
|
name: string;
|
|
4
4
|
path: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* One entry that `ng add` puts into an `imports` or `providers` array.
|
|
8
|
+
*
|
|
9
|
+
* An array entry is matched by its function or identifier name (the text of `initializer` before
|
|
10
|
+
* its first `(`). When the application already has such an entry, `ng add` extends it with
|
|
11
|
+
* `routes`, `features` and `options` instead of adding a second one, so the router and the HTTP
|
|
12
|
+
* client are never registered twice and a second `ng add` run changes nothing.
|
|
13
|
+
*/
|
|
6
14
|
export interface ImportConstant {
|
|
15
|
+
/** Expression added when the array has no entry with the same name yet. */
|
|
7
16
|
initializer: string;
|
|
17
|
+
/** Named imports that the expression needs. */
|
|
8
18
|
imports: EntityImport[];
|
|
19
|
+
/** Routes that the first argument of an existing call must include. */
|
|
20
|
+
routes?: string;
|
|
21
|
+
/** Feature calls that an existing call must pass, matched by their function name. */
|
|
22
|
+
features?: string[];
|
|
23
|
+
/** Properties that the options object (second argument) of an existing call must set. */
|
|
24
|
+
options?: Array<[name: string, initializer: string]>;
|
|
9
25
|
}
|
|
10
26
|
export interface AppImports {
|
|
11
27
|
imports: ImportConstant[];
|
|
@@ -13,4 +29,10 @@ export interface AppImports {
|
|
|
13
29
|
}
|
|
14
30
|
export declare const NG_DOC_COMPONENT_IMPORTS: ImportConstant[];
|
|
15
31
|
export declare const MODULE_APP: AppImports;
|
|
32
|
+
/**
|
|
33
|
+
* Features that earlier versions of `ng add` added and that are deprecated now. They are dropped
|
|
34
|
+
* when `ng add` merges the duplicate calls those versions left behind; a call that the
|
|
35
|
+
* application wrote itself keeps them.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DROPPED_FEATURES: string[];
|
|
16
38
|
export declare const STANDALONE_APP: AppImports;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STANDALONE_APP = exports.MODULE_APP = exports.NG_DOC_COMPONENT_IMPORTS = exports.GENERATED_PATH = void 0;
|
|
3
|
+
exports.STANDALONE_APP = exports.DROPPED_FEATURES = exports.MODULE_APP = exports.NG_DOC_COMPONENT_IMPORTS = exports.GENERATED_PATH = void 0;
|
|
4
4
|
exports.GENERATED_PATH = '@ng-doc/generated';
|
|
5
5
|
exports.NG_DOC_COMPONENT_IMPORTS = [
|
|
6
6
|
{
|
|
@@ -16,14 +16,20 @@ exports.NG_DOC_COMPONENT_IMPORTS = [
|
|
|
16
16
|
imports: [{ name: 'NgDocSidebarComponent', path: '@ng-doc/app' }],
|
|
17
17
|
},
|
|
18
18
|
];
|
|
19
|
+
/*
|
|
20
|
+
* No change-detection provider on purpose: NgDoc works with and without zone.js, so `ng add`
|
|
21
|
+
* keeps whatever the application uses (zoneless by default since Angular 21). No `withFetch()`
|
|
22
|
+
* either: the fetch backend is the default since Angular 22 and the feature is deprecated.
|
|
23
|
+
*/
|
|
19
24
|
const NG_DOC_PROVIDERS = [
|
|
20
25
|
{
|
|
21
|
-
initializer: 'provideHttpClient(withInterceptorsFromDi()
|
|
26
|
+
initializer: 'provideHttpClient(withInterceptorsFromDi())',
|
|
22
27
|
imports: [
|
|
23
28
|
{ name: 'provideHttpClient', path: '@angular/common/http' },
|
|
24
29
|
{ name: 'withInterceptorsFromDi', path: '@angular/common/http' },
|
|
25
|
-
{ name: 'withFetch', path: '@angular/common/http' },
|
|
26
30
|
],
|
|
31
|
+
// NgDoc registers class-based interceptors through `HTTP_INTERCEPTORS`.
|
|
32
|
+
features: ['withInterceptorsFromDi()'],
|
|
27
33
|
},
|
|
28
34
|
{
|
|
29
35
|
initializer: 'provideNgDocContext()',
|
|
@@ -66,28 +72,36 @@ exports.MODULE_APP = {
|
|
|
66
72
|
path: exports.GENERATED_PATH,
|
|
67
73
|
},
|
|
68
74
|
],
|
|
75
|
+
routes: 'NG_DOC_ROUTING',
|
|
76
|
+
options: [
|
|
77
|
+
['scrollPositionRestoration', "'enabled'"],
|
|
78
|
+
['anchorScrolling', "'enabled'"],
|
|
79
|
+
['scrollOffset', '[0, 70]'],
|
|
80
|
+
],
|
|
69
81
|
},
|
|
70
82
|
...exports.NG_DOC_COMPONENT_IMPORTS,
|
|
71
83
|
],
|
|
72
84
|
providers: NG_DOC_PROVIDERS,
|
|
73
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Features that earlier versions of `ng add` added and that are deprecated now. They are dropped
|
|
88
|
+
* when `ng add` merges the duplicate calls those versions left behind; a call that the
|
|
89
|
+
* application wrote itself keeps them.
|
|
90
|
+
*/
|
|
91
|
+
exports.DROPPED_FEATURES = ['withFetch'];
|
|
92
|
+
const IN_MEMORY_SCROLLING = 'withInMemoryScrolling({scrollPositionRestoration: "enabled", anchorScrolling: "enabled"})';
|
|
74
93
|
exports.STANDALONE_APP = {
|
|
75
94
|
imports: exports.NG_DOC_COMPONENT_IMPORTS,
|
|
76
95
|
providers: [
|
|
77
96
|
{
|
|
78
|
-
initializer:
|
|
79
|
-
imports: [
|
|
80
|
-
{ name: 'provideHttpClient', path: '@angular/common/http' },
|
|
81
|
-
{ name: 'withInterceptorsFromDi', path: '@angular/common/http' },
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
initializer: 'provideRouter(NG_DOC_ROUTING, withInMemoryScrolling({scrollPositionRestoration: "enabled", anchorScrolling: "enabled"}))',
|
|
97
|
+
initializer: `provideRouter(NG_DOC_ROUTING, ${IN_MEMORY_SCROLLING})`,
|
|
86
98
|
imports: [
|
|
87
99
|
{ name: 'provideRouter', path: '@angular/router' },
|
|
88
100
|
{ name: 'NG_DOC_ROUTING', path: exports.GENERATED_PATH },
|
|
89
101
|
{ name: 'withInMemoryScrolling', path: '@angular/router' },
|
|
90
102
|
],
|
|
103
|
+
routes: 'NG_DOC_ROUTING',
|
|
104
|
+
features: [IN_MEMORY_SCROLLING],
|
|
91
105
|
},
|
|
92
106
|
...NG_DOC_PROVIDERS,
|
|
93
107
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/constants/modules.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAW,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/constants/modules.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAW,mBAAmB,CAAC;AAiC7C,QAAA,wBAAwB,GAAqB;IACxD;QACE,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KAC/D;IACD;QACE,WAAW,EAAE,sBAAsB;QACnC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KACjE;IACD;QACE,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KAClE;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,gBAAgB,GAAqB;IACzC;QACE,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,sBAAsB,EAAE;YAC3D,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,sBAAsB,EAAE;SACjE;QACD,wEAAwE;QACxE,QAAQ,EAAE,CAAC,0BAA0B,CAAC;KACvC;IACD;QACE,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,sBAAc,EAAE,CAAC;KACjE;IACD;QACE,WAAW,EAAE,mBAAmB;QAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KAC5D;IACD;QACE,WAAW,EAAE,+CAA+C;QAC5D,OAAO,EAAE;YACP,EAAE,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EAAE,IAAI,EAAE,iBAAiB,EAAE;gBAClD,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,sBAAc,EAAE;gBAChD,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,iBAAiB,EAAE;aAC3D;YACD,MAAM,EAAE,gBAAgB;YACxB,QAAQ,EAAE,CAAC,mBAAmB,CAAC;SAChC;QACD,GAAG,gBAAgB;KACpB;CACF,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NG_DOC_STYLES = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The NgDoc stylesheets `ng-doc add` puts first in the build's `styles`: the global styles and the
|
|
6
|
+
* dark theme, which the theme toggle's Dark and Auto options switch to.
|
|
7
|
+
*/
|
|
8
|
+
exports.NG_DOC_STYLES = [
|
|
9
|
+
'node_modules/@ng-doc/app/styles/global.css',
|
|
10
|
+
'node_modules/@ng-doc/app/styles/themes/dark.css',
|
|
11
|
+
];
|
|
5
12
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/constants/styles.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/constants/styles.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,aAAa,GAAa;IACrC,4CAA4C;IAC5C,iDAAiD;CAClD,CAAC"}
|
|
@@ -6,7 +6,10 @@ import { Schema } from './schema';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function ngAdd(options: Schema): Rule;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Sets up the project. It runs as a task before the install task of `ngAdd`, while `@ng-doc/add` is
|
|
10
|
+
* still installed. The styles, assets and providers are the same for both engines. The Vite engine then reads the build target, as it now is, into
|
|
11
|
+
* `vite.config.mjs` and the Vite targets (`@ng-doc/builder:vite-setup`); the legacy engine swaps
|
|
12
|
+
* the builders of the build and serve targets.
|
|
13
|
+
* @param options - The `ng add` options.
|
|
11
14
|
*/
|
|
12
15
|
export declare function ngAddSetupProject(options: Schema): Rule;
|
|
@@ -4,6 +4,7 @@ exports.ngAdd = ngAdd;
|
|
|
4
4
|
exports.ngAddSetupProject = ngAddSetupProject;
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
7
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
7
8
|
const ng_morph_1 = require("ng-morph");
|
|
8
9
|
const version_1 = require("./constants/version");
|
|
9
10
|
const add_assets_1 = require("./steps/add-assets");
|
|
@@ -14,8 +15,12 @@ const add_ng_doc_app_config_1 = require("./steps/add-ng-doc-app-config");
|
|
|
14
15
|
const add_styles_1 = require("./steps/add-styles");
|
|
15
16
|
const add_tsconfig_paths_1 = require("./steps/add-tsconfig-paths");
|
|
16
17
|
const post_install_1 = require("./steps/post-install");
|
|
18
|
+
const raise_initial_budget_1 = require("./steps/raise-initial-budget");
|
|
17
19
|
const replace_builders_1 = require("./steps/replace-builders");
|
|
18
20
|
const update_app_ts_config_1 = require("./steps/update-app-ts-config");
|
|
21
|
+
const get_project_1 = require("./utils/get-project");
|
|
22
|
+
const get_project_name_1 = require("./utils/get-project-name");
|
|
23
|
+
const select_engine_1 = require("./utils/select-engine");
|
|
19
24
|
/**
|
|
20
25
|
*
|
|
21
26
|
* @param options
|
|
@@ -34,21 +39,45 @@ function ngAdd(options) {
|
|
|
34
39
|
};
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
42
|
+
* Sets up the project. It runs as a task before the install task of `ngAdd`, while `@ng-doc/add` is
|
|
43
|
+
* still installed. The styles, assets and providers are the same for both engines. The Vite engine then reads the build target, as it now is, into
|
|
44
|
+
* `vite.config.mjs` and the Vite targets (`@ng-doc/builder:vite-setup`); the legacy engine swaps
|
|
45
|
+
* the builders of the build and serve targets.
|
|
46
|
+
* @param options - The `ng add` options.
|
|
39
47
|
*/
|
|
40
48
|
function ngAddSetupProject(options) {
|
|
41
|
-
return (
|
|
42
|
-
(0,
|
|
43
|
-
(0,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(0,
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
(
|
|
51
|
-
(0,
|
|
52
|
-
|
|
49
|
+
return async (tree, context) => {
|
|
50
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
51
|
+
const project = (0, get_project_1.getProject)(options, workspace);
|
|
52
|
+
if (!project) {
|
|
53
|
+
throw new schematics_1.SchematicsException(`[NGDOC_ADD_PROJECT] Project "${(0, get_project_name_1.getProjectName)(options, workspace)}" was not found. Pass --project.`);
|
|
54
|
+
}
|
|
55
|
+
const choice = (0, select_engine_1.selectEngine)(tree, project, options.engine, context.logger);
|
|
56
|
+
// The Vite targets hold no Angular build options: a second run must not add any to them.
|
|
57
|
+
const editBuildTarget = !(choice.engine === 'vite' && choice.existing);
|
|
58
|
+
context.logger.info(`[INFO]: Engine: ${choice.engine === 'vite' ? 'Vite (@ng-doc/builder:vite-application)' : 'legacy (@ng-doc/builder:application)'}`);
|
|
59
|
+
return (0, schematics_1.chain)([
|
|
60
|
+
choice.engine === 'legacy' && choice.replaceBuilders ? (0, replace_builders_1.replaceBuilders)(options) : (0, schematics_1.noop)(),
|
|
61
|
+
// Only a project new to NgDoc: an existing one chose its budgets.
|
|
62
|
+
choice.engine === 'legacy' && !choice.existing ? (0, raise_initial_budget_1.raiseInitialBudget)(options) : (0, schematics_1.noop)(),
|
|
63
|
+
editBuildTarget ? (0, add_styles_1.addStyles)(options) : (0, schematics_1.noop)(),
|
|
64
|
+
editBuildTarget ? (0, add_assets_1.addAssets)(options) : (0, schematics_1.noop)(),
|
|
65
|
+
editBuildTarget ? (0, add_js_dependencies_1.addJsDependencies)(options) : (0, schematics_1.noop)(),
|
|
66
|
+
(0, add_ng_doc_app_config_1.addNgDocAppConfig)(options),
|
|
67
|
+
(0, add_layout_1.addLayout)(options),
|
|
68
|
+
(0, add_tsconfig_paths_1.addTsconfigPaths)(options),
|
|
69
|
+
(0, update_app_ts_config_1.updateAppTsConfig)(options),
|
|
70
|
+
(0, add_git_ignore_1.addGitIgnore)(),
|
|
71
|
+
// `@ng-doc/add` depends on `@ng-doc/builder`, so the schematic is there before the install
|
|
72
|
+
// that follows this one. That install also installs the Vite dependencies it adds.
|
|
73
|
+
choice.engine === 'vite'
|
|
74
|
+
? (0, schematics_1.externalSchematic)('@ng-doc/builder', 'vite-setup', {
|
|
75
|
+
project: (0, get_project_name_1.getProjectName)(options, workspace),
|
|
76
|
+
skipInstall: true,
|
|
77
|
+
})
|
|
78
|
+
: (0, schematics_1.noop)(),
|
|
79
|
+
(0, post_install_1.postInstall)(choice.engine),
|
|
80
|
+
]);
|
|
81
|
+
};
|
|
53
82
|
}
|
|
54
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/add/schematics/ng-add/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/add/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAwCA,sBAcC;AASD,8CA0CC;AAxGD,2DAQoC;AACpC,4DAA4F;AAC5F,qEAAqE;AACrE,uCAKkB;AAElB,iDAAqD;AAErD,mDAA+C;AAC/C,2DAAsD;AACtD,qEAAgE;AAChE,mDAA+C;AAC/C,yEAAkE;AAClE,mDAA+C;AAC/C,mEAA8D;AAC9D,uDAAmD;AACnD,uEAAkE;AAClE,+DAA2D;AAC3D,uEAAiE;AACjE,qDAAiD;AACjD,+DAA0D;AA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,IAAA,wCAAiB,EAAC,OAAO,CAAC;YAC1B,IAAA,6BAAY,GAAE;YACd,2FAA2F;YAC3F,mFAAmF;YACnF,MAAM,CAAC,MAAM,KAAK,MAAM;gBACtB,CAAC,CAAC,IAAA,8BAAiB,EAAC,iBAAiB,EAAE,YAAY,EAAE;oBACjD,OAAO,EAAE,IAAA,iCAAc,EAAC,OAAO,EAAE,SAAS,CAAC;oBAC3C,WAAW,EAAE,IAAI;iBAClB,CAAC;gBACJ,CAAC,CAAC,IAAA,iBAAI,GAAE;YACV,IAAA,0BAAW,EAAC,MAAM,CAAC,MAAM,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/** The NgDoc engine that `ng add` sets up. */
|
|
2
|
+
export type NgDocEngine = 'vite' | 'legacy';
|
|
1
3
|
export interface Schema {
|
|
2
4
|
readonly project: string;
|
|
5
|
+
/**
|
|
6
|
+
* `vite` (the Vite engine) or `legacy` (the legacy builders). Without it, a standalone
|
|
7
|
+
* application gets the Vite engine, and an NgModule application or a project that already uses
|
|
8
|
+
* NgDoc keeps or gets the legacy builders.
|
|
9
|
+
*/
|
|
10
|
+
readonly engine?: NgDocEngine;
|
|
3
11
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "ng-doc-ng-add",
|
|
4
|
+
"title": "NgDoc ng-add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the project.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"engine": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": ["vite", "legacy"],
|
|
17
|
+
"description": "The engine to set up: \"vite\" (the @ng-doc/builder:vite-application and vite-dev-server builders) or \"legacy\" (the @ng-doc/builder:application and dev-server builders). By default a standalone application on Angular's application builder gets the Vite engine; an NgModule application, or one on another builder, gets the legacy builders. A project that already uses NgDoc keeps its builders."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": []
|
|
16
21
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param options
|
|
6
|
-
* @param context
|
|
4
|
+
* Adds the NgDoc assets to the build target. Entries that are already there are not added again.
|
|
5
|
+
* @param options - The `ng add` options.
|
|
7
6
|
*/
|
|
8
7
|
export declare function addAssets(options: Schema): Rule;
|
|
@@ -6,9 +6,8 @@ const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
|
6
6
|
const assets_1 = require("../constants/assets");
|
|
7
7
|
const get_project_1 = require("../utils/get-project");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param options
|
|
11
|
-
* @param context
|
|
9
|
+
* Adds the NgDoc assets to the build target. Entries that are already there are not added again.
|
|
10
|
+
* @param options - The `ng add` options.
|
|
12
11
|
*/
|
|
13
12
|
function addAssets(options) {
|
|
14
13
|
return async (tree, context) => {
|
|
@@ -24,7 +23,13 @@ function addAssets(options) {
|
|
|
24
23
|
}
|
|
25
24
|
const targetOptions = (0, schematics_1.getProjectTargetOptions)(project, 'build');
|
|
26
25
|
const assets = targetOptions['assets'];
|
|
27
|
-
|
|
26
|
+
// Asset entries are objects, so they are compared by content: a second `ng add` run must
|
|
27
|
+
// not add them again.
|
|
28
|
+
const existing = new Set((assets ?? []).map((asset) => JSON.stringify(asset)));
|
|
29
|
+
targetOptions['assets'] = [
|
|
30
|
+
...(0, assets_1.getNgDocAssets)(options, workspace).filter((asset) => !existing.has(JSON.stringify(asset))),
|
|
31
|
+
...(assets ?? []),
|
|
32
|
+
];
|
|
28
33
|
logger.info('✅ Done!');
|
|
29
34
|
}
|
|
30
35
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-assets.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-assets.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"add-assets.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-assets.ts"],"names":[],"mappings":";;AAiBA,8BA2CC;AA5DD,wDAAkE;AAGlE,qEAI+C;AAE/C,gDAAqD;AAErD,sDAAkD;AAElD;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,OAAO,IAAA,2BAAe,EAAC,CAAC,SAA8B,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAExD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;YAEzD,IAAI,CAAC;gBACH,MAAM,OAAO,GAAkC,IAAA,wBAAU,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAE9E,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;oBAExE,OAAO;gBACT,CAAC;gBAED,MAAM,aAAa,GAA0C,IAAA,oCAAuB,EAClF,OAAO,EACP,OAAO,CACR,CAAC;gBAEF,MAAM,MAAM,GAA0B,aAAa,CAAC,QAAQ,CAA0B,CAAC;gBAEvF,yFAAyF;gBACzF,sBAAsB;gBACtB,MAAM,QAAQ,GAAgB,IAAI,GAAG,CACnC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAChE,CAAC;gBAEF,aAAa,CAAC,QAAQ,CAAC,GAAG;oBACxB,GAAG,IAAA,uBAAc,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC,MAAM,CAC1C,CAAC,KAAgB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAC3D;oBACD,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;iBAClB,CAAC;gBAEF,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addGitIgnore = addGitIgnore;
|
|
4
4
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @param options
|
|
8
|
-
* @param context
|
|
6
|
+
* Adds the generated `ng-doc` folder to `.gitignore` unless it is already ignored.
|
|
9
7
|
*/
|
|
10
8
|
function addGitIgnore() {
|
|
11
9
|
return async (tree, context) => {
|
|
@@ -19,7 +17,14 @@ function addGitIgnore() {
|
|
|
19
17
|
logger.warn(`⚠️ ".gitignore" file was not found, please add "/ng-doc" folder into it manually.`);
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
|
-
|
|
20
|
+
// A second `ng add` run must not append the entry again.
|
|
21
|
+
const ignored = gitignore
|
|
22
|
+
.toString()
|
|
23
|
+
.split(/\r?\n/)
|
|
24
|
+
.some((line) => /^\/?ng-doc\/?$/.test(line.trim()));
|
|
25
|
+
if (!ignored) {
|
|
26
|
+
tree.overwrite('.gitignore', `${gitignore}\n\n# NgDoc files\n/ng-doc`);
|
|
27
|
+
}
|
|
23
28
|
logger.info('✅ Done!');
|
|
24
29
|
}
|
|
25
30
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-git-ignore.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-git-ignore.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"add-git-ignore.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-git-ignore.ts"],"names":[],"mappings":";;AAMA,oCAmCC;AAxCD,qEAAwE;AAExE;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,OAAO,IAAA,2BAAe,EAAC,GAAG,EAAE;YAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;YAE3D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;YAE/D,IAAI,CAAC;gBACH,MAAM,SAAS,GAAkB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAEzD,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CACT,mFAAmF,CACpF,CAAC;oBAEF,OAAO;gBACT,CAAC;gBAED,yDAAyD;gBACzD,MAAM,OAAO,GAAY,SAAS;qBAC/B,QAAQ,EAAE;qBACV,KAAK,CAAC,OAAO,CAAC;qBACd,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,4BAA4B,CAAC,CAAC;gBACzE,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param options
|
|
4
|
+
* Replaces the root component's template with the NgDoc layout.
|
|
5
|
+
* @param options - The `ng add` options.
|
|
6
6
|
*/
|
|
7
7
|
export declare function addLayout(options: Schema): Rule;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLayout = addLayout;
|
|
4
4
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
5
|
+
const ng_morph_1 = require("ng-morph");
|
|
5
6
|
const app_component_content_1 = require("../constants/app-component-content");
|
|
6
7
|
const get_app_template_path_1 = require("../utils/get-app-template-path");
|
|
7
8
|
const get_main_path_1 = require("../utils/get-main-path");
|
|
8
9
|
const get_project_1 = require("../utils/get-project");
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param options
|
|
11
|
+
* Replaces the root component's template with the NgDoc layout.
|
|
12
|
+
* @param options - The `ng add` options.
|
|
12
13
|
*/
|
|
13
14
|
function addLayout(options) {
|
|
14
15
|
return async (tree, context) => {
|
|
@@ -23,6 +24,8 @@ function addLayout(options) {
|
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
const mainPath = (0, get_main_path_1.getMainPath)(project);
|
|
27
|
+
// A project of its own: the one of an earlier step may hold edits that step did not save.
|
|
28
|
+
(0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(tree, '/', ['**/*.ts', '**/*.json']));
|
|
26
29
|
const appTemplatePath = (0, get_app_template_path_1.getAppTemplatePath)(tree, mainPath);
|
|
27
30
|
if (!appTemplatePath || !mainPath) {
|
|
28
31
|
logger.error('❌ Could not find the default main template file for the project. Please replace the content of the root component with NgDoc layout manually.');
|
|
@@ -37,6 +40,9 @@ function addLayout(options) {
|
|
|
37
40
|
catch (e) {
|
|
38
41
|
logger.error(`❌ Error: ${e}`);
|
|
39
42
|
}
|
|
43
|
+
finally {
|
|
44
|
+
(0, ng_morph_1.resetActiveProject)();
|
|
45
|
+
}
|
|
40
46
|
};
|
|
41
47
|
}
|
|
42
48
|
//# sourceMappingURL=add-layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-layout.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-layout.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"add-layout.js","sourceRoot":"","sources":["../../../../../../libs/add/schematics/ng-add/steps/add-layout.ts"],"names":[],"mappings":";;AAeA,8BA+CC;AA5DD,qEAAqE;AACrE,uCAA+E;AAE/E,8EAA2E;AAE3E,0EAAoE;AACpE,0DAAqD;AACrD,sDAAkD;AAElD;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAExD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;QAEnF,IAAI,CAAC;YACH,MAAM,SAAS,GAAwB,MAAM,IAAA,wBAAY,EAAC,I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