@o3r/schematics 8.2.0-alpha.8 → 8.2.0-alpha.80
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +26 -26
- package/README.md +9 -197
- package/package.json +7 -4
- package/src/rule-factories/index.d.ts +2 -0
- package/src/rule-factories/index.d.ts.map +1 -1
- package/src/rule-factories/index.js +2 -0
- package/src/rule-factories/index.js.map +1 -1
- package/src/rule-factories/ng-add/index.d.ts.map +1 -1
- package/src/rule-factories/ng-add/index.js +5 -2
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/rule-factories/update-imports/index.d.ts +5 -0
- package/src/rule-factories/update-imports/index.d.ts.map +1 -0
- package/src/rule-factories/update-imports/index.js +8 -0
- package/src/rule-factories/update-imports/index.js.map +1 -0
- package/src/rule-factories/update-imports/list-of-vars.d.ts +15 -0
- package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -0
- package/src/rule-factories/update-imports/list-of-vars.js +44 -0
- package/src/rule-factories/update-imports/list-of-vars.js.map +1 -0
- package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +12 -0
- package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -0
- package/src/rule-factories/update-imports/update-imports-with-scope.js +34 -0
- package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -0
- package/src/rule-factories/update-imports/update-ts-imports.d.ts +11 -0
- package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -0
- package/src/rule-factories/update-imports/update-ts-imports.js +32 -0
- package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -0
- package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts +8 -0
- package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +1 -0
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js +2049 -0
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -0
- package/src/rule-factories/vscode-extensions/index.d.ts +8 -0
- package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -0
- package/src/rule-factories/vscode-extensions/index.js +26 -0
- package/src/rule-factories/vscode-extensions/index.js.map +1 -0
- package/src/utility/gitignore.js +1 -1
- package/src/utility/gitignore.js.map +1 -1
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +1 -0
- package/src/utility/index.js.map +1 -1
- package/src/utility/loaders.d.ts +10 -3
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +18 -5
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/modules.d.ts +51 -1
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +101 -1
- package/src/utility/modules.js.map +1 -1
- package/src/utility/routes.d.ts +2 -1
- package/src/utility/routes.d.ts.map +1 -1
- package/src/utility/routes.js +3 -2
- package/src/utility/routes.js.map +1 -1
- package/src/utility/template-property.helper.js +1 -1
- package/src/utility/template-property.helper.js.map +1 -1
- package/src/utility/update-imports.d.ts +25 -0
- package/src/utility/update-imports.d.ts.map +1 -0
- package/src/utility/update-imports.js +86 -0
- package/src/utility/update-imports.js.map +1 -0
package/LICENSE
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
Copyright Amadeus SAS
|
2
|
-
|
3
|
-
Redistribution and use in source and binary forms, with or without modification,
|
4
|
-
are permitted provided that the following conditions are met:
|
5
|
-
|
6
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
7
|
-
list of conditions and the following disclaimer.
|
8
|
-
|
9
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer in the documentation and/or
|
11
|
-
other materials provided with the distribution.
|
12
|
-
|
13
|
-
3. Neither the name of the copyright holder nor the names of its contributors
|
14
|
-
may be used to endorse or promote products derived from this software without
|
15
|
-
specific prior written permission.
|
16
|
-
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
18
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
21
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
24
|
-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1
|
+
Copyright Amadeus SAS
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification,
|
4
|
+
are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
7
|
+
list of conditions and the following disclaimer.
|
8
|
+
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation and/or
|
11
|
+
other materials provided with the distribution.
|
12
|
+
|
13
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
14
|
+
may be used to endorse or promote products derived from this software without
|
15
|
+
specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
21
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
24
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
@@ -1,212 +1,24 @@
|
|
1
|
-
<h1 align="center">Otter
|
1
|
+
<h1 align="center">Otter schematics</h1>
|
2
2
|
<p align="center">
|
3
|
-
<img src="
|
3
|
+
<img src="../../../.attachments/otter.png" alt="Super cute Otter!" width="40%"/>
|
4
4
|
</p>
|
5
5
|
|
6
|
+
This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
|
6
7
|
<br />
|
7
8
|
<br />
|
8
9
|
|
9
10
|
## Description
|
10
|
-
The **Otter** project is a highly modular framework whose goal is to provide a common platform to accelerate and facilitate the development on Angular web applications.
|
11
|
-
It is split into several units to cover different aspects of these applications (localization, testing, customization, etc.).
|
12
|
-
Also, to customize an application, metadata can be extracted from the application source code and injected into a CMS to manage dynamic configuration.
|
13
11
|
|
14
|
-
|
12
|
+
This module provides basic utilities and generic rules (install, lint) reused in other package schematics.
|
15
13
|
|
16
|
-
##
|
17
|
-
|
18
|
-
* [Angular](https://angular.io/)
|
19
|
-
* [Typescript](https://www.typescriptlang.org/)
|
20
|
-
* [RxJs](http://reactivex.io/rxjs/)
|
21
|
-
* [Redux](http://redux.js.org/)
|
22
|
-
* [Sass](http://sass-lang.com/)
|
23
|
-
* [Nx](https://nx.dev/)
|
24
|
-
|
25
|
-
## Get Started
|
26
|
-
|
27
|
-
A new application can be set up with these simple commands:
|
28
|
-
|
29
|
-
```shell
|
30
|
-
# Starting a new angular application
|
31
|
-
npm install -g @angular/cli
|
32
|
-
ng new my-app
|
33
|
-
|
34
|
-
# Add Otter framework
|
35
|
-
ng add @o3r/core
|
36
|
-
```
|
37
|
-
|
38
|
-
> **Note**: Please refer to [Otter Get Started](./docs/core/START_NEW_APPLICATION.md) and [Angular Get Started](https://angular.io/guide/setup-local#install-the-angular-cli) for complete documentation.
|
39
|
-
|
40
|
-
## Contributing
|
41
|
-
|
42
|
-
Please read the [Contributing](./CONTRIBUTING.md) file for details on our code of conduct and the process to submit pull requests.
|
43
|
-
|
44
|
-
## Versioning
|
45
|
-
|
46
|
-
Please refer to [Security file](./SECURITY.md).
|
47
|
-
|
48
|
-
## License
|
49
|
-
|
50
|
-
Please refer to the [License file](./LICENSE).
|
51
|
-
|
52
|
-
## Acknowledgments
|
53
|
-
|
54
|
-
The Otter Team, @AmadeusITGroup/otter_admins, is responsible for the review of the code of this repository.
|
55
|
-
Any bug of feature request can be addressed via [issue](https://github.com/AmadeusITGroup/otter/issues/new) report.
|
56
|
-
|
57
|
-
## Developer
|
58
|
-
|
59
|
-
### Building and Testing library
|
60
|
-
|
61
|
-
These documents describe how to set up your development environment to build and test the framework.
|
62
|
-
It also explains the basic mechanics of using `git`, `node`, and `npm`.
|
63
|
-
|
64
|
-
- [Description](#description)
|
65
|
-
- [Built With](#built-with)
|
66
|
-
- [Get Started](#get-started)
|
67
|
-
- [Contributing](#contributing)
|
68
|
-
- [Versioning](#versioning)
|
69
|
-
- [License](#license)
|
70
|
-
- [Acknowledgments](#acknowledgments)
|
71
|
-
- [Developer](#developer)
|
72
|
-
- [Building and Testing library](#building-and-testing-library)
|
73
|
-
- [Prerequisite Software](#prerequisite-software)
|
74
|
-
- [Getting the Sources](#getting-the-sources)
|
75
|
-
- [Installing NPM Modules](#installing-npm-modules)
|
76
|
-
- [Build command](#build-command)
|
77
|
-
- [Running tests locally](#running-tests-locally)
|
78
|
-
- [Manage task cache](#manage-task-cache)
|
79
|
-
- [Debugging with Visual Studio Code](#debugging-with-visual-studio-code)
|
80
|
-
- [Link local packages](#link-local-packages)
|
81
|
-
|
82
|
-
Refer to the [contribution guidelines](./CONTRIBUTING.md)
|
83
|
-
if you'd like to contribute to the framework.
|
84
|
-
|
85
|
-
#### Prerequisite Software
|
86
|
-
|
87
|
-
Before you can build and test Otter modules, you must install and configure the
|
88
|
-
following products on your development machine:
|
89
|
-
|
90
|
-
* [Git](http://git-scm.com) and/or the **GitHub app** (for [Mac](http://mac.github.com) or
|
91
|
-
[Windows](http://windows.github.com))
|
92
|
-
* [GitHub's Guide to Installing
|
93
|
-
Git](https://help.github.com/articles/set-up-git) is a good source of information.
|
94
|
-
|
95
|
-
* [Node.js](http://nodejs.org), (version `>=10.0.0`)
|
96
|
-
* This is used to run tests and generate distributable files. We also use Node's Package Manager, `npm`
|
97
|
-
(version `>3.8.x`), which comes with Node. Depending on your system, you can install Node either from
|
98
|
-
source or as a pre-packaged bundle.
|
99
|
-
|
100
|
-
* [Yarn](https://yarnpkg.com/lang/en/docs/install/), a Node's Package Manager
|
101
|
-
* You can install yarn using NPM manager (coming with Node.js).
|
102
|
-
The version of Yarn currently used is embedded in the repository. In case you need to link this library with your project, you can check the section "Link local packages".
|
103
|
-
|
104
|
-
* [Chrome](https://www.google.com/chrome/browser/desktop/index.html)
|
105
|
-
* We use Chrome to run our tests.
|
106
|
-
|
107
|
-
#### Getting the sources
|
108
|
-
|
109
|
-
Clone the Otter repository using the button `Code` or using the following git command:
|
110
|
-
|
111
|
-
```shell
|
112
|
-
git clone https://github.com/AmadeusITGroup/otter.git
|
113
|
-
```
|
114
|
-
|
115
|
-
#### Installing NPM modules
|
116
|
-
|
117
|
-
Next, install the JavaScript modules needed to build:
|
118
|
-
|
119
|
-
```shell
|
120
|
-
# Install library project dependencies (package.json)
|
121
|
-
yarn install
|
122
|
-
```
|
123
|
-
|
124
|
-
#### Build command
|
125
|
-
|
126
|
-
To build the modules, run:
|
127
|
-
|
128
|
-
```shell
|
129
|
-
yarn run build
|
130
|
-
```
|
131
|
-
|
132
|
-
Each module can be built independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
|
14
|
+
## How to install
|
133
15
|
|
134
16
|
```shell
|
135
|
-
|
136
|
-
yarn nx build core
|
17
|
+
ng add @o3r/schematics
|
137
18
|
```
|
138
19
|
|
139
|
-
> **
|
140
|
-
|
141
|
-
#### Running tests locally
|
142
|
-
|
143
|
-
Check the formatting:
|
144
|
-
|
145
|
-
```shell
|
146
|
-
yarn run lint
|
147
|
-
```
|
148
|
-
|
149
|
-
Check Unit Tests:
|
150
|
-
|
151
|
-
```shell
|
152
|
-
yarn run test
|
153
|
-
```
|
154
|
-
|
155
|
-
Each module can be test independently thanks to [Nx](https://nx.dev/packages/nx/documents/run) commands:
|
156
|
-
|
157
|
-
```shell
|
158
|
-
# ex: Test Core package only
|
159
|
-
yarn nx test core
|
160
|
-
|
161
|
-
# ex: Lint Core package only
|
162
|
-
yarn nx lint core
|
163
|
-
```
|
20
|
+
> **Warning**: this module requires [@o3r/core](https://www.npmjs.com/package/@o3r/core) to be installed.
|
164
21
|
|
165
|
-
|
166
|
-
|
167
|
-
When running the Build, Lint, or Test commands, **Nx** can use its [cache mechanism](https://nx.dev/concepts/how-caching-works).
|
168
|
-
In some cases, it may be useful to clear the cache to investigate an issue. This can be done with the following command:
|
169
|
-
|
170
|
-
```shell
|
171
|
-
yarn nx reset
|
172
|
-
```
|
173
|
-
|
174
|
-
#### Debugging with Visual Studio Code
|
175
|
-
|
176
|
-
The repository contains the mandatory configuration and the recommended VSCode plugins to ensure optimal comfort and productivity while developing on the Otter Framework.
|
177
|
-
|
178
|
-
The default configuration of the repository provides a way to run Unit Tests one by one and to define, within VSCode, break points using the `vscode-jest-tests` debugger task.
|
179
|
-
|
180
|
-
#### Link local packages
|
181
|
-
|
182
|
-
For Yarn v1, add the `resolutions` property in the main package.json. It should be filled with the relative path to the `dist` of the local packages you want to link. The protocol `link:` can be used.
|
183
|
-
|
184
|
-
NOTE: It will not import the transitive dependencies of the linked packages.
|
185
|
-
|
186
|
-
Example:
|
187
|
-
|
188
|
-
```json
|
189
|
-
{
|
190
|
-
"resolutions": {
|
191
|
-
"@o3r/localization": "./relative/path/to/otter/packages/@o3r/localization/dist",
|
192
|
-
"@o3r/core": "link:./relative/path/to/otter/packages/@o3r/core/dist",
|
193
|
-
}
|
194
|
-
}
|
195
|
-
```
|
196
|
-
|
197
|
-
For Yarn v2+, the protocol `portal:` can also be used.
|
198
|
-
|
199
|
-
NOTE: The portal protocol will also import all the transitive dependencies of the linked packages.
|
200
|
-
Please keep in mind that mismatched versions of these dependencies may cause some issues.
|
201
|
-
|
202
|
-
Example:
|
22
|
+
## Description
|
203
23
|
|
204
|
-
|
205
|
-
{
|
206
|
-
"resolutions": {
|
207
|
-
"@o3r/localization": "./relative/path/to/otter/library/@o3r/localization/dist",
|
208
|
-
"@o3r/core": "link:./relative/path/to/otter/library/@o3r/core/dist",
|
209
|
-
"@o3r/rules-engine": "portal:./relative/path/to/otter/library/@o3r/rules-engine/dist",
|
210
|
-
}
|
211
|
-
}
|
212
|
-
```
|
24
|
+
This is a technical package to be used as dependency by [Otter modules](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md) providing helpers to used in [Schematics](https://angular.io/guide/schematics) development.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/schematics",
|
3
|
-
"version": "8.2.0-alpha.
|
3
|
+
"version": "8.2.0-alpha.80",
|
4
4
|
"description": "Schematics module of the Otter framework",
|
5
5
|
"main": "./src/index.js",
|
6
6
|
"keywords": [
|
@@ -28,7 +28,7 @@
|
|
28
28
|
}
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@o3r/dev-tools": "^8.2.0-alpha.
|
31
|
+
"@o3r/dev-tools": "^8.2.0-alpha.80",
|
32
32
|
"comment-json": "^4.1.0",
|
33
33
|
"globby": "^11.1.0",
|
34
34
|
"minimatch": "^6.1.6",
|
@@ -47,12 +47,15 @@
|
|
47
47
|
"@angular/core": "~15.2.0",
|
48
48
|
"@angular/platform-browser": "~15.2.0",
|
49
49
|
"@angular/platform-browser-dynamic": "~15.2.0",
|
50
|
+
"@babel/core": "~7.21.0",
|
51
|
+
"@babel/preset-typescript": "~7.21.0",
|
52
|
+
"@compodoc/compodoc": "^1.1.19",
|
50
53
|
"@nrwl/cli": "~15.9.0",
|
51
54
|
"@nrwl/jest": "~15.9.0",
|
52
55
|
"@nrwl/js": "~15.9.0",
|
53
56
|
"@nrwl/linter": "~15.9.0",
|
54
|
-
"@o3r/build-helpers": "^8.2.0-alpha.
|
55
|
-
"@o3r/eslint-plugin": "^8.2.0-alpha.
|
57
|
+
"@o3r/build-helpers": "^8.2.0-alpha.80",
|
58
|
+
"@o3r/eslint-plugin": "^8.2.0-alpha.80",
|
56
59
|
"@schematics/angular": "~15.2.0",
|
57
60
|
"@types/jest": "~28.1.2",
|
58
61
|
"@types/node": "^17.0.45",
|
@@ -3,4 +3,6 @@ export * from './interfaces';
|
|
3
3
|
export * from './check-packages-peers/index';
|
4
4
|
export * from './ng-add/index';
|
5
5
|
export * from './remove-packages/index';
|
6
|
+
export * from './update-imports/index';
|
7
|
+
export * from './vscode-extensions/index';
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
|
@@ -6,4 +6,6 @@ tslib_1.__exportStar(require("./interfaces"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./check-packages-peers/index"), exports);
|
7
7
|
tslib_1.__exportStar(require("./ng-add/index"), exports);
|
8
8
|
tslib_1.__exportStar(require("./remove-packages/index"), exports);
|
9
|
+
tslib_1.__exportStar(require("./update-imports/index"), exports);
|
10
|
+
tslib_1.__exportStar(require("./vscode-extensions/index"), exports);
|
9
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rule-factories/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,uDAA6B;AAC7B,uEAA6C;AAC7C,yDAA+B;AAC/B,kEAAwC;AACxC,iEAAuC;AACvC,oEAA0C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,mBAAmB,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,mBAAmB,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAuBrF"}
|
@@ -18,7 +18,7 @@ function ngAddPackages(packages, options) {
|
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
};
|
21
|
-
return async (
|
21
|
+
return async (tree, context) => {
|
22
22
|
if (packages.length > 0) {
|
23
23
|
context.logger.info(`'${options?.parentPackageInfo || ''}' - 'ng add' has been launched for the following packages:`);
|
24
24
|
for (const packageName of packages) {
|
@@ -27,9 +27,12 @@ function ngAddPackages(packages, options) {
|
|
27
27
|
context.logger.info(`Running ng add for: ${packageName}${options?.version ? ' with version: ' + options.version : ''}`);
|
28
28
|
context.addTask(new index_1.NodePackageNgAddTask(packageName, options));
|
29
29
|
}
|
30
|
+
else {
|
31
|
+
context.logger.info(`Skipping ng add for: ${packageName}${options?.version ? ' with version: ' + options.version : ''}`);
|
32
|
+
}
|
30
33
|
}
|
31
34
|
}
|
32
|
-
return;
|
35
|
+
return () => tree;
|
33
36
|
};
|
34
37
|
}
|
35
38
|
exports.ngAddPackages = ngAddPackages;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AACA,6CAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA6B;IAC7E,MAAM,mBAAmB,GAAG,KAAK,EAAE,WAAmB,EAAE,EAAE;;QACxD,IAAI;YACF,OAAO,CAAC,YAAa,GAAG,WAAW,eAAe,4CAAC,CAAC,CAAC,OAAO,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;SACR;IACH,CAAC,CAAC;IACF,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AACA,6CAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA6B;IAC7E,MAAM,mBAAmB,GAAG,KAAK,EAAE,WAAmB,EAAE,EAAE;;QACxD,IAAI;YACF,OAAO,CAAC,YAAa,GAAG,WAAW,eAAe,4CAAC,CAAC,CAAC,OAAO,CAAC;SAC9D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;SACR;IACH,CAAC,CAAC;IACF,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,OAAO,EAAE,iBAAiB,IAAI,EAAE,4DAA4D,CAAC,CAAC;YACtH,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;gBAClC,MAAM,gBAAgB,GAAG,MAAM,mBAAmB,CAAC,WAAW,CAAC,CAAC;gBAChE,IAAI,CAAC,gBAAgB,IAAI,OAAO,EAAE,OAAO,KAAK,gBAAgB,EAAE;oBAC9D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,WAAW,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACxH,OAAO,CAAC,OAAO,CAAC,IAAI,4BAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;iBACjE;qBAAM;oBACL,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,WAAW,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;iBAC1H;aACF;SACF;QACD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAvBD,sCAuBC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./list-of-vars"), exports);
|
5
|
+
tslib_1.__exportStar(require("./update-imports-with-scope"), exports);
|
6
|
+
tslib_1.__exportStar(require("./update-ts-imports"), exports);
|
7
|
+
tslib_1.__exportStar(require("./v7-to-v8-map-object"), exports);
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,sEAA4C;AAC5C,8DAAoC;AACpC,gEAAsC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* Represents an element that is exposed in a Sass import.
|
4
|
+
*
|
5
|
+
* @property value: The name of the exposed element.
|
6
|
+
* @property type: The type of the exposed element, either 'function' or 'var'.
|
7
|
+
* @property replacement: The name of the replacement element, if any.
|
8
|
+
*/
|
9
|
+
export interface SassImportExposedElement {
|
10
|
+
value: string;
|
11
|
+
type: 'function' | 'var';
|
12
|
+
replacement?: string | undefined;
|
13
|
+
}
|
14
|
+
export declare const listOfExposedElements: SassImportExposedElement[];
|
15
|
+
//# sourceMappingURL=list-of-vars.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"list-of-vars.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,qBAAqB,EAAE,wBAAwB,EAuC3D,CAAC"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.listOfExposedElements = void 0;
|
4
|
+
exports.listOfExposedElements = [
|
5
|
+
// utils
|
6
|
+
{ value: '$test-mode-enabled', type: 'var' },
|
7
|
+
{ value: 'error', type: 'function' },
|
8
|
+
{ value: '$alternative-breakpoints-map', type: 'var' },
|
9
|
+
{ value: 'get-mandatory', type: 'function' },
|
10
|
+
{ value: 'multi-map-merge', type: 'function' },
|
11
|
+
{ value: '$metadata-logging', type: 'var' },
|
12
|
+
{ value: '$debug', type: 'var' },
|
13
|
+
{ value: 'log-variable', type: 'function' },
|
14
|
+
// theming mixins
|
15
|
+
{ value: 'apply-theme', type: 'function' },
|
16
|
+
{ value: 'override-theme', type: 'function' },
|
17
|
+
// theming functions
|
18
|
+
{ value: 'generate-theme-variables', type: 'function' },
|
19
|
+
{ value: 'revert-palette', type: 'function' },
|
20
|
+
{ value: 'generate-theme', type: 'function' },
|
21
|
+
{ value: 'meta-theme-to-otter', type: 'function' },
|
22
|
+
{ value: 'meta-theme-to-material', type: 'function' },
|
23
|
+
{ value: 'o3r-var', type: 'function', replacement: 'variable' },
|
24
|
+
{ value: 'o3r-get', type: 'function', replacement: 'get' },
|
25
|
+
{ value: 'o3r-color', type: 'function', replacement: 'color' },
|
26
|
+
{ value: 'o3r-contrast', type: 'function', replacement: 'contrast' },
|
27
|
+
{ value: 'is-o3r-variable', type: 'function', replacement: 'is-variable' },
|
28
|
+
// theming palettes
|
29
|
+
{ value: '$refx-primary', type: 'var', replacement: '$palettes-refx-primary' },
|
30
|
+
{ value: '$refx-highlight', type: 'var', replacement: '$palettes-refx-highlight' },
|
31
|
+
{ value: '$refx-accent', type: 'var', replacement: '$palettes-refx-accent' },
|
32
|
+
{ value: '$refx-warn', type: 'var', replacement: '$palettes-refx-warn' },
|
33
|
+
{ value: '$ama-highlight', type: 'var', replacement: '$palettes-ama-highlight' },
|
34
|
+
{ value: '$ama-accent', type: 'var', replacement: '$palettes-ama-accent' },
|
35
|
+
{ value: '$ama-primary', type: 'var', replacement: '$palettes-ama-primary' },
|
36
|
+
{ value: '$ama-warn', type: 'var', replacement: '$palettes-ama-warn' },
|
37
|
+
// theming otter-theme
|
38
|
+
{ value: 'generate-otter-theme', type: 'function' },
|
39
|
+
{ value: 'generate-otter-dark-theme', type: 'function' },
|
40
|
+
// theming dark-theme
|
41
|
+
{ value: '$private-dark-default', type: 'var' },
|
42
|
+
{ value: '$otter-dark-default', type: 'var' }
|
43
|
+
];
|
44
|
+
//# sourceMappingURL=list-of-vars.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"list-of-vars.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
2
|
+
import { SassImportExposedElement } from './list-of-vars';
|
3
|
+
/**
|
4
|
+
* Update SASS imports to use a scoped dependency
|
5
|
+
*
|
6
|
+
* @param alias The name of the otter styling package
|
7
|
+
* @param dependencyName The name of the dependency to update imports on
|
8
|
+
* @param exposedElements The list of exposed elemeents
|
9
|
+
* @param fromRoot Perform on all files in project
|
10
|
+
*/
|
11
|
+
export declare function updateSassImports(alias: string, dependencyName?: string, exposedElements?: SassImportExposedElement[], fromRoot?: boolean): Rule;
|
12
|
+
//# sourceMappingURL=update-imports-with-scope.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-imports-with-scope.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-imports-with-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAyB,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAIjF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,SAAiB,EAAE,eAAe,GAAE,wBAAwB,EAA0B,EAAE,QAAQ,UAAQ,GAAG,IAAI,CAmB7K"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.updateSassImports = void 0;
|
4
|
+
const utility_1 = require("../../utility");
|
5
|
+
const list_of_vars_1 = require("./list-of-vars");
|
6
|
+
const imports = new RegExp(/^@import\s+['"]~?@(o3r|otter)\/styling.*\s*/, 'gm');
|
7
|
+
/**
|
8
|
+
* Update SASS imports to use a scoped dependency
|
9
|
+
*
|
10
|
+
* @param alias The name of the otter styling package
|
11
|
+
* @param dependencyName The name of the dependency to update imports on
|
12
|
+
* @param exposedElements The list of exposed elemeents
|
13
|
+
* @param fromRoot Perform on all files in project
|
14
|
+
*/
|
15
|
+
function updateSassImports(alias, dependencyName = '@o3r/styling', exposedElements = list_of_vars_1.listOfExposedElements, fromRoot = false) {
|
16
|
+
return (tree, _context) => {
|
17
|
+
const files = fromRoot ? (0, utility_1.getFilesWithExtensionFromTree)(tree, 'scss') : (0, utility_1.getFilesFromRootOfWorkspaceProjects)(tree, 'scss');
|
18
|
+
files.forEach((file) => {
|
19
|
+
let content = tree.read(file).toString();
|
20
|
+
if (content.match(imports)) {
|
21
|
+
const contentWithoutImports = content.replace(imports, '');
|
22
|
+
content = `@use '${dependencyName}' as ${alias};\n${contentWithoutImports}`;
|
23
|
+
exposedElements.forEach(elem => {
|
24
|
+
const elemRegex = new RegExp(`(?<![\\w\\d-]|o3r\\.)${elem.type === 'var' ? '\\' : ''}${elem.value}((?![\\w\\d-])(?!(\\s*\\:)))`, 'g');
|
25
|
+
content = content.replace(elemRegex, `${alias}.${(elem.replacement || elem.value)}`);
|
26
|
+
});
|
27
|
+
tree.overwrite(file, content);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
return tree;
|
31
|
+
};
|
32
|
+
}
|
33
|
+
exports.updateSassImports = updateSassImports;
|
34
|
+
//# sourceMappingURL=update-imports-with-scope.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-imports-with-scope.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-imports-with-scope.ts"],"names":[],"mappings":";;;AACA,2CAAmG;AACnG,iDAAiF;AAEjF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,6CAA6C,EAAE,IAAI,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,cAAc,GAAG,cAAc,EAAE,kBAA8C,oCAAqB,EAAE,QAAQ,GAAG,KAAK;IACrK,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAEhD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,uCAA6B,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAA,6CAAmC,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzH,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,CAAC;YAC1C,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;gBAC1B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC3D,OAAO,GAAG,SAAS,cAAc,QAAQ,KAAK,MAAM,qBAAqB,EAAE,CAAC;gBAC5E,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC7B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,wBAAwB,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,8BAA8B,EAAE,GAAG,CAAC,CAAC;oBACtI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACvF,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAnBD,8CAmBC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
2
|
+
import { ImportsMapping } from '../../utility';
|
3
|
+
/**
|
4
|
+
* Update imports based on mapping
|
5
|
+
*
|
6
|
+
* @param mapImports Map of the import to replace
|
7
|
+
* @param renamedPackages Map of the import package to replace
|
8
|
+
* @param fromRoot Perform on all files in project
|
9
|
+
*/
|
10
|
+
export declare function updateImports(mapImports?: ImportsMapping, renamedPackages?: Record<string, string>, fromRoot?: boolean): Rule;
|
11
|
+
//# sourceMappingURL=update-ts-imports.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-ts-imports.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-ts-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAsE,cAAc,EAAuB,MAAM,eAAe,CAAC;AAExI;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,GAAE,cAAmB,EAAE,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EAAE,QAAQ,UAAQ,GAAG,IAAI,CA2BnI"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.updateImports = void 0;
|
4
|
+
const ts = require("typescript");
|
5
|
+
const utility_1 = require("../../utility");
|
6
|
+
/**
|
7
|
+
* Update imports based on mapping
|
8
|
+
*
|
9
|
+
* @param mapImports Map of the import to replace
|
10
|
+
* @param renamedPackages Map of the import package to replace
|
11
|
+
* @param fromRoot Perform on all files in project
|
12
|
+
*/
|
13
|
+
function updateImports(mapImports = {}, renamedPackages = {}, fromRoot = false) {
|
14
|
+
return (tree, context) => {
|
15
|
+
const files = fromRoot ? (0, utility_1.getFilesWithExtensionFromTree)(tree, 'ts') : (0, utility_1.getSourceFilesFromWorkspaceProjects)(tree);
|
16
|
+
// exact match on import path
|
17
|
+
const importsRegexp = new RegExp(`^(${[...Object.keys(mapImports)].join('|')})$`);
|
18
|
+
// match the import path starting with the package to be renamed
|
19
|
+
const renamePackagesRegexp = new RegExp(`^(${[...Object.keys(renamedPackages)].join('|')})`);
|
20
|
+
let nbOfUnResolvedImports = 0;
|
21
|
+
files.forEach((file) => {
|
22
|
+
const sourceFile = ts.createSourceFile(file, tree.read(file).toString(), ts.ScriptTarget.ES2015, true);
|
23
|
+
nbOfUnResolvedImports += (0, utility_1.updateImportsInFile)(context.logger, tree, sourceFile, importsRegexp, renamePackagesRegexp, mapImports, renamedPackages);
|
24
|
+
});
|
25
|
+
if (nbOfUnResolvedImports > 0) {
|
26
|
+
context.logger.warn(`The migration rule could not resolve a total of ${nbOfUnResolvedImports} imports that you may have to migrate manually (see the details above).`);
|
27
|
+
}
|
28
|
+
return tree;
|
29
|
+
};
|
30
|
+
}
|
31
|
+
exports.updateImports = updateImports;
|
32
|
+
//# sourceMappingURL=update-ts-imports.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-ts-imports.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/update-ts-imports.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AACjC,2CAAwI;AAExI;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,aAA6B,EAAE,EAAE,kBAA0C,EAAE,EAAE,QAAQ,GAAG,KAAK;IAE3H,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,uCAA6B,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,6CAAmC,EAAC,IAAI,CAAC,CAAC;QAE/G,6BAA6B;QAC7B,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClF,gEAAgE;QAChE,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7F,IAAI,qBAAqB,GAAG,CAAC,CAAC;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,EAAE,EAC3B,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;YACF,qBAAqB,IAAI,IAAA,6BAAmB,EAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QACnJ,CAAC,CAAC,CAAC;QAEH,IAAI,qBAAqB,GAAG,CAAC,EAAE;YAC7B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mDAAmD,qBAAqB,yEAAyE,CAAC,CAAC;SACxK;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA3BD,sCA2BC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ImportsMapping } from '../../utility';
|
2
|
+
/** Packages that were renamed */
|
3
|
+
export declare const renamedPackagesV7toV8: {
|
4
|
+
[key: string]: string;
|
5
|
+
};
|
6
|
+
/** Map containing the import changes in otter packages for the exported elements */
|
7
|
+
export declare const mapImportV7toV8: ImportsMapping;
|
8
|
+
//# sourceMappingURL=v7-to-v8-map-object.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"v7-to-v8-map-object.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/v7-to-v8-map-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,iCAAiC;AACjC,eAAO,MAAM,qBAAqB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAa1D,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,eAAe,EAAE,cA6+D7B,CAAC"}
|