@o3r/schematics 11.0.0-next.0 → 11.0.0-next.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/README.md +5 -1
  2. package/{src/cli → cli}/environment.d.ts.map +1 -1
  3. package/{src/cli → cli}/environment.js +1 -1
  4. package/cli/environment.js.map +1 -0
  5. package/cli/package.json +3 -0
  6. package/package.json +61 -43
  7. package/schematics/ng-add/index.d.ts +3 -1
  8. package/schematics/ng-add/index.d.ts.map +1 -1
  9. package/schematics/ng-add/index.js +36 -25
  10. package/schematics/ng-add/index.js.map +1 -1
  11. package/schematics/ng-add/schema.d.ts +1 -1
  12. package/schematics/ng-add/schema.d.ts.map +1 -1
  13. package/src/interfaces/angular-workspace.d.ts.map +1 -1
  14. package/src/interfaces/index.d.ts +1 -0
  15. package/src/interfaces/index.d.ts.map +1 -1
  16. package/src/interfaces/index.js +1 -0
  17. package/src/interfaces/index.js.map +1 -1
  18. package/src/{rule-factories/interfaces.d.ts → interfaces/rule-factories.d.ts} +2 -2
  19. package/src/interfaces/rule-factories.d.ts.map +1 -0
  20. package/src/{rule-factories/interfaces.js → interfaces/rule-factories.js} +1 -1
  21. package/src/interfaces/rule-factories.js.map +1 -0
  22. package/src/modules/modules.display.rule.d.ts.map +1 -1
  23. package/src/modules/modules.display.rule.js +3 -4
  24. package/src/modules/modules.display.rule.js.map +1 -1
  25. package/src/modules/modules.helpers.d.ts +2 -2
  26. package/src/modules/modules.helpers.d.ts.map +1 -1
  27. package/src/modules/modules.helpers.js +2 -2
  28. package/src/modules/modules.helpers.js.map +1 -1
  29. package/src/public_api.d.ts +6 -1
  30. package/src/public_api.d.ts.map +1 -1
  31. package/src/public_api.js +6 -1
  32. package/src/public_api.js.map +1 -1
  33. package/src/rule-factories/add-imports/index.js.map +1 -1
  34. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  35. package/src/rule-factories/dev-tools/devtools-registration.js +7 -7
  36. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
  37. package/src/rule-factories/eslint-fix/index.d.ts +8 -3
  38. package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
  39. package/src/rule-factories/eslint-fix/index.js +5 -3
  40. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  41. package/src/rule-factories/get-test-frameworks/index.js +2 -2
  42. package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
  43. package/src/rule-factories/index.d.ts +1 -1
  44. package/src/rule-factories/index.d.ts.map +1 -1
  45. package/src/rule-factories/index.js +1 -1
  46. package/src/rule-factories/index.js.map +1 -1
  47. package/src/rule-factories/ng-add/dependencies.d.ts +93 -0
  48. package/src/rule-factories/ng-add/dependencies.d.ts.map +1 -0
  49. package/src/rule-factories/ng-add/dependencies.js +174 -0
  50. package/src/rule-factories/ng-add/dependencies.js.map +1 -0
  51. package/src/rule-factories/ng-add/index.d.ts +3 -36
  52. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  53. package/src/rule-factories/ng-add/index.js +4 -218
  54. package/src/rule-factories/ng-add/index.js.map +1 -1
  55. package/src/rule-factories/ng-add/ng-add.helpers.d.ts +22 -0
  56. package/src/rule-factories/ng-add/ng-add.helpers.d.ts.map +1 -0
  57. package/src/rule-factories/ng-add/ng-add.helpers.js +162 -0
  58. package/src/rule-factories/ng-add/ng-add.helpers.js.map +1 -0
  59. package/src/rule-factories/ng-add/schematics-register.d.ts +17 -0
  60. package/src/rule-factories/ng-add/schematics-register.d.ts.map +1 -0
  61. package/src/rule-factories/ng-add/schematics-register.js +64 -0
  62. package/src/rule-factories/ng-add/schematics-register.js.map +1 -0
  63. package/src/rule-factories/remove-packages/index.js.map +1 -1
  64. package/src/rule-factories/update-imports/index.d.ts +0 -1
  65. package/src/rule-factories/update-imports/index.d.ts.map +1 -1
  66. package/src/rule-factories/update-imports/index.js +0 -1
  67. package/src/rule-factories/update-imports/index.js.map +1 -1
  68. package/src/rule-factories/update-imports/list-of-vars.d.ts +4 -5
  69. package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -1
  70. package/src/rule-factories/update-imports/list-of-vars.js.map +1 -1
  71. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +1 -1
  72. package/src/rule-factories/update-imports/update-imports-with-scope.js +3 -3
  73. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
  74. package/src/rule-factories/update-imports/update-ts-imports.d.ts +1 -1
  75. package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -1
  76. package/src/rule-factories/update-imports/update-ts-imports.js +7 -6
  77. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
  78. package/src/rule-factories/vscode-extensions/index.js.map +1 -1
  79. package/src/rules/install.d.ts +8 -4
  80. package/src/rules/install.d.ts.map +1 -1
  81. package/src/rules/install.js +10 -8
  82. package/src/rules/install.js.map +1 -1
  83. package/src/tasks/eslint/index.d.ts +8 -1
  84. package/src/tasks/eslint/index.d.ts.map +1 -1
  85. package/src/tasks/eslint/index.js +8 -1
  86. package/src/tasks/eslint/index.js.map +1 -1
  87. package/src/tasks/ng-add/index.d.ts +1 -0
  88. package/src/tasks/ng-add/index.d.ts.map +1 -1
  89. package/src/tasks/ng-add/index.js +1 -0
  90. package/src/tasks/ng-add/index.js.map +1 -1
  91. package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
  92. package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
  93. package/src/tasks/package-manager/add-dev-dependency.js +4 -3
  94. package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
  95. package/src/tasks/package-manager/interfaces.d.ts +1 -1
  96. package/src/tasks/package-manager/interfaces.d.ts.map +1 -1
  97. package/src/tasks/package-manager/npm-install.js +3 -3
  98. package/src/tasks/package-manager/npm-install.js.map +1 -1
  99. package/src/utility/ast.d.ts +2 -1
  100. package/src/utility/ast.d.ts.map +1 -1
  101. package/src/utility/ast.js +8 -2
  102. package/src/utility/ast.js.map +1 -1
  103. package/src/utility/builder.js.map +1 -1
  104. package/src/utility/collection.d.ts.map +1 -1
  105. package/src/utility/collection.js +1 -1
  106. package/src/utility/collection.js.map +1 -1
  107. package/src/utility/component.d.ts +1 -1
  108. package/src/utility/component.d.ts.map +1 -1
  109. package/src/utility/component.js.map +1 -1
  110. package/src/utility/dependencies.d.ts.map +1 -1
  111. package/src/utility/dependencies.js +1 -1
  112. package/src/utility/dependencies.js.map +1 -1
  113. package/src/utility/environment.d.ts +1 -0
  114. package/src/utility/environment.d.ts.map +1 -1
  115. package/src/utility/environment.js.map +1 -1
  116. package/src/utility/file-info.d.ts +1 -2
  117. package/src/utility/file-info.d.ts.map +1 -1
  118. package/src/utility/file-info.js.map +1 -1
  119. package/src/utility/generation.d.ts +1 -1
  120. package/src/utility/generation.d.ts.map +1 -1
  121. package/src/utility/generation.js.map +1 -1
  122. package/src/utility/gitignore.d.ts +1 -1
  123. package/src/utility/gitignore.d.ts.map +1 -1
  124. package/src/utility/gitignore.js.map +1 -1
  125. package/src/utility/index.d.ts +2 -0
  126. package/src/utility/index.d.ts.map +1 -1
  127. package/src/utility/index.js +2 -0
  128. package/src/utility/index.js.map +1 -1
  129. package/src/utility/loaders.d.ts +6 -1
  130. package/src/utility/loaders.d.ts.map +1 -1
  131. package/src/utility/loaders.js +10 -2
  132. package/src/utility/loaders.js.map +1 -1
  133. package/src/utility/matching-peers.d.ts +7 -3
  134. package/src/utility/matching-peers.d.ts.map +1 -1
  135. package/src/utility/matching-peers.js +7 -5
  136. package/src/utility/matching-peers.js.map +1 -1
  137. package/src/utility/modules.js.map +1 -1
  138. package/src/utility/monorepo.d.ts +3 -2
  139. package/src/utility/monorepo.d.ts.map +1 -1
  140. package/src/utility/monorepo.js +2 -1
  141. package/src/utility/monorepo.js.map +1 -1
  142. package/src/utility/package-manager-runner.d.ts +1 -1
  143. package/src/utility/package-manager-runner.d.ts.map +1 -1
  144. package/src/utility/package-manager-runner.js.map +1 -1
  145. package/src/utility/package-version.js.map +1 -1
  146. package/src/utility/routes.d.ts +1 -1
  147. package/src/utility/routes.d.ts.map +1 -1
  148. package/src/utility/routes.js.map +1 -1
  149. package/src/utility/sub-entry.d.ts +1 -1
  150. package/src/utility/sub-entry.d.ts.map +1 -1
  151. package/src/utility/sub-entry.js.map +1 -1
  152. package/src/utility/template-property.helper.js.map +1 -1
  153. package/src/utility/update-imports.d.ts.map +1 -1
  154. package/src/utility/update-imports.js +21 -10
  155. package/src/utility/update-imports.js.map +1 -1
  156. package/src/utility/update-pipes.d.ts +15 -0
  157. package/src/utility/update-pipes.d.ts.map +1 -0
  158. package/src/utility/update-pipes.js +82 -0
  159. package/src/utility/update-pipes.js.map +1 -0
  160. package/src/utility/wrapper.d.ts +8 -0
  161. package/src/utility/wrapper.d.ts.map +1 -0
  162. package/src/utility/wrapper.js +87 -0
  163. package/src/utility/wrapper.js.map +1 -0
  164. package/src/cli/environment.js.map +0 -1
  165. package/src/index.d.ts +0 -7
  166. package/src/index.d.ts.map +0 -1
  167. package/src/index.js +0 -10
  168. package/src/index.js.map +0 -1
  169. package/src/rule-factories/interfaces.d.ts.map +0 -1
  170. package/src/rule-factories/interfaces.js.map +0 -1
  171. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts +0 -8
  172. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +0 -1
  173. package/src/rule-factories/update-imports/v7-to-v8-map-object.js +0 -2049
  174. package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +0 -1
  175. /package/{src/cli → cli}/environment.d.ts +0 -0
@@ -1,221 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchematics = exports.ngAddPeerDependencyPackages = exports.ngAddPackages = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const tasks_1 = require("@angular-devkit/schematics/tasks");
6
- const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
- const node_fs_1 = require("node:fs");
8
- const path = require("node:path");
9
- const rxjs_1 = require("rxjs");
10
- const index_1 = require("../../utility/index");
11
- /**
12
- * Install via `ng add` a list of npm packages.
13
- * @param packages List of packages to be installed via `ng add`
14
- * @param options install options
15
- * @param packageJsonPath path of the package json of the project where they will be installed
16
- */
17
- function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
18
- if (!packages.length) {
19
- return schematics_1.noop;
20
- }
21
- const cwd = process.cwd().replace(/[\\/]+/g, '/');
22
- // FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
23
- const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
24
- const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
25
- if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
26
- packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
27
- }
28
- const getInstalledVersion = (packageName) => {
29
- let versionFound;
30
- for (const workingDirectory of new Set([fsWorkingDirectory, '.'])) {
31
- try {
32
- const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(workingDirectory, 'package.json'), { encoding: 'utf8' }));
33
- let version;
34
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
35
- version = fileSystemPackageJson.devDependencies[packageName];
36
- }
37
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
38
- version = fileSystemPackageJson.peerDependencies[packageName];
39
- }
40
- else {
41
- version = fileSystemPackageJson.dependencies[packageName];
42
- }
43
- if (versionFound && version !== versionFound) {
44
- // In case of conflict between package.json files, we consider the package as not installed to force its update
45
- return;
46
- }
47
- versionFound = version;
48
- }
49
- catch (e) {
50
- return;
51
- }
52
- }
53
- return versionFound;
54
- };
55
- const getNgAddSchema = (packageName, context) => {
56
- try {
57
- const collection = context.engine.createCollection(packageName);
58
- return collection.createSchematic('ng-add');
59
- }
60
- catch {
61
- context.logger.warn(`No ng-add found for ${packageName}`);
62
- return undefined;
63
- }
64
- };
65
- const getOptions = (schema) => {
66
- const schemaOptions = schema.description.schemaJson?.properties || {};
67
- return Object.entries(options || {}).reduce((accOptions, [key, value]) => {
68
- if (schemaOptions[key]) {
69
- accOptions[key] = value;
70
- }
71
- return accOptions;
72
- }, {});
73
- };
74
- const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
75
- const packageManager = (0, index_1.getPackageManager)();
76
- const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
77
- if (packagesToInstall.length < 1) {
78
- return schematics_1.noop;
79
- }
80
- return (0, schematics_1.chain)([
81
- // Update package.json in tree
82
- (tree) => {
83
- const sortDependencies = (packageJson, depType) => {
84
- packageJson[depType] = packageJson[depType] ?
85
- Object.fromEntries(Object.entries(packageJson[depType]).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2))) :
86
- undefined;
87
- };
88
- for (const filePath of new Set([packageJsonPath, './package.json'])) {
89
- const packageJson = tree.readJson(filePath);
90
- packages.forEach((packageName) => {
91
- const version = versions[packageName] || 'latest';
92
- if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
93
- packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: version };
94
- }
95
- else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
96
- packageJson.peerDependencies = { ...packageJson.peerDependencies, [packageName]: version };
97
- }
98
- else {
99
- packageJson.dependencies = { ...packageJson.dependencies, [packageName]: version };
100
- }
101
- });
102
- ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {
103
- sortDependencies(packageJson, depType);
104
- });
105
- tree.overwrite(filePath, JSON.stringify(packageJson, null, 2));
106
- }
107
- },
108
- // Run ng-adds
109
- async (tree, context) => {
110
- if (options?.skipNgAddSchematicRun) {
111
- context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
112
- The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
113
- return schematics_1.noop;
114
- }
115
- new Set([packageJsonPath, './package.json']).forEach((filePath) => {
116
- (0, node_fs_1.mkdirSync)(path.join(process.cwd(), path.dirname(filePath)), { recursive: true });
117
- (0, node_fs_1.writeFileSync)(path.join(process.cwd(), filePath), tree.readText(filePath));
118
- });
119
- context.addTask(new tasks_1.NodePackageInstallTask({
120
- packageManager: packageManager,
121
- hideOutput: false,
122
- quiet: false
123
- }));
124
- await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
125
- const ngAddsToApply = packagesToInstall
126
- .map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
127
- .filter(({ packageName, ngAddCollection }) => {
128
- if (!ngAddCollection) {
129
- context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
130
- }
131
- return !!ngAddCollection;
132
- })
133
- .map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
134
- return (0, schematics_1.chain)(ngAddsToApply);
135
- }
136
- ]);
137
- }
138
- exports.ngAddPackages = ngAddPackages;
139
- /**
140
- * Look for the peer dependencies and run ng add on the package requested version
141
- * @param packages list of the name of the packages needed
142
- * @param packageJsonPath path to package json that needs the peer to be resolved
143
- * @param type how to install the dependency (dev, peer for a library or default for an application)
144
- * @param options
145
- * @param parentPackageInfo for logging purposes
146
- */
147
- function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependencies_1.NodeDependencyType.Default, options, parentPackageInfo) {
148
- if (!packages.length) {
149
- return schematics_1.noop;
150
- }
151
- const dependencies = (0, index_1.getNodeDependencyList)((0, index_1.getExternalDependenciesVersionRange)(packages, packageJsonPath), type);
152
- return ngAddPackages(dependencies.map(({ name }) => name), {
153
- ...options,
154
- skipConfirmation: true,
155
- version: dependencies.map(({ version }) => version),
156
- parentPackageInfo,
157
- dependencyType: type,
158
- workingDirectory: options.workingDirectory
159
- });
160
- }
161
- exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
162
- /**
163
- * Register the given package in the Angular CLI schematics
164
- * @param packageJson PackageJson of the project containing the collection to add to the project
165
- * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
166
- */
167
- function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
168
- return (tree, context) => {
169
- if (!packageJson.name) {
170
- return tree;
171
- }
172
- const workspace = (0, index_1.getWorkspaceConfig)(tree, angularJsonFile);
173
- if (!workspace) {
174
- context.logger.error('No workspace found');
175
- return tree;
176
- }
177
- return (0, index_1.writeAngularJson)(tree, (0, index_1.registerCollectionSchematics)(workspace, packageJson.name), angularJsonFile);
178
- };
179
- }
180
- exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
181
- /**
182
- * Setup schematics default params in angular.json
183
- * @param schematicsDefaultParams default params to setup by schematic
184
- * @param overrideValue Define if the given value should override the one already defined in the workspace
185
- * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
186
- */
187
- function setupSchematicsDefaultParams(schematicsDefaultParams, overrideValue = false, angularJsonFile) {
188
- return (tree, context) => {
189
- const workspace = (0, index_1.getWorkspaceConfig)(tree, angularJsonFile);
190
- if (!workspace) {
191
- context.logger.error('No workspace found');
192
- return tree;
193
- }
194
- workspace.schematics ||= {};
195
- Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
196
- workspace.schematics[schematicName] = overrideValue ? {
197
- ...workspace.schematics[schematicName],
198
- ...defaultParams
199
- } : {
200
- ...defaultParams,
201
- ...workspace.schematics[schematicName]
202
- };
203
- });
204
- Object.values(workspace.projects).forEach((project) => {
205
- Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
206
- if (project.schematics?.[schematicName]) {
207
- project.schematics[schematicName] = overrideValue ? {
208
- ...project.schematics[schematicName],
209
- ...defaultParams
210
- } : {
211
- ...defaultParams,
212
- ...project.schematics[schematicName]
213
- };
214
- }
215
- });
216
- });
217
- return (0, index_1.writeAngularJson)(tree, workspace, angularJsonFile);
218
- };
219
- }
220
- exports.setupSchematicsDefaultParams = setupSchematicsDefaultParams;
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./schematics-register"), exports);
5
+ tslib_1.__exportStar(require("./dependencies"), exports);
6
+ tslib_1.__exportStar(require("./ng-add.helpers"), exports);
221
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAA+G;AAC/G,4DAA0E;AAE1E,2EAA8E;AAC9E,qCAAiE;AACjE,kCAAkC;AAClC,+BAAqC;AAIrC,+CAAwL;AAExL;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA8F,EAAE,eAAe,GAAG,eAAe;IACjL,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,iBAAI,CAAC;KACb;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAClD,wHAAwH;IACxH,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,gBAAgB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;IACnI,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAA+B,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CACpG,CAAC,WAAW,EAAE,OAAO,OAAO,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpG,IAAI,OAAO,EAAE,gBAAgB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,E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aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;gBACrD,GAAG,SAAS,CAAC,UAAW,CAAC,aAAa,CAAC;gBACvC,GAAG,aAAa;aACjB,CAAC,CAAC,CAAC;gBACF,GAAG,aAAa;gBAChB,GAAG,SAAS,CAAC,UAAW,CAAC,aAAa,CAAC;aACxC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,EAAE;gBACjF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,EAAE;oBACvC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;wBAClD,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;wBACpC,GAAG,aAAa;qBACjB,CAAC,CAAC,CAAC;wBACF,GAAG,aAAa;wBAChB,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;qBACrC,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,wBAAgB,EAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAhCD,oEAgCC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,yDAA+B;AAC/B,2DAAiC"}
@@ -0,0 +1,22 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
3
+ import type { NgAddPackageOptions } from '../../tasks/index';
4
+ /**
5
+ * Install via `ng add` a list of npm packages.
6
+ * @param packages List of packages to be installed via `ng add`
7
+ * @param options install options
8
+ * @param packageJsonPath path of the package json of the project where they will be installed
9
+ */
10
+ export declare function ngAddPackages(packages: string[], options?: Omit<NgAddPackageOptions, 'version'> & {
11
+ version?: string | (string | undefined)[];
12
+ }, packageJsonPath?: string): Rule;
13
+ /**
14
+ * Look for the peer dependencies and run ng add on the package requested version
15
+ * @param packages list of the name of the packages needed
16
+ * @param packageJsonPath path to package json that needs the peer to be resolved
17
+ * @param type how to install the dependency (dev, peer for a library or default for an application)
18
+ * @param options
19
+ * @param parentPackageInfo for logging purposes
20
+ */
21
+ export declare function ngAddPeerDependencyPackages(packages: string[], packageJsonPath: string, type: NodeDependencyType | undefined, options: NgAddPackageOptions, parentPackageInfo?: string): Rule;
22
+ //# sourceMappingURL=ng-add.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-add.helpers.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAA+B,MAAM,4BAA4B,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAK9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CAAE,EAAE,eAAe,SAAkB,GAAG,IAAI,CA0HzL;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,IAAI,gCAAiD,EAC5I,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,MAAM,QAgBzD"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAddPeerDependencyPackages = exports.ngAddPackages = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
+ const node_fs_1 = require("node:fs");
8
+ const path = require("node:path");
9
+ const rxjs_1 = require("rxjs");
10
+ const index_1 = require("../../utility/index");
11
+ /**
12
+ * Install via `ng add` a list of npm packages.
13
+ * @param packages List of packages to be installed via `ng add`
14
+ * @param options install options
15
+ * @param packageJsonPath path of the package json of the project where they will be installed
16
+ */
17
+ function ngAddPackages(packages, options, packageJsonPath = '/package.json') {
18
+ if (!packages.length) {
19
+ return schematics_1.noop;
20
+ }
21
+ const cwd = process.cwd().replace(/[\\/]+/g, '/');
22
+ // FileSystem working directory might be different from Tree working directory (when using `yarn workspace` for example)
23
+ const fsWorkingDirectory = (options?.workingDirectory && !cwd.endsWith(options.workingDirectory)) ? options.workingDirectory : '.';
24
+ const versions = Object.fromEntries(packages.map((packageName, index) => [packageName, typeof options?.version === 'object' ? options.version[index] : options?.version]));
25
+ if (options?.workingDirectory && !packageJsonPath.startsWith(options.workingDirectory)) {
26
+ packageJsonPath = path.join(options.workingDirectory, packageJsonPath);
27
+ }
28
+ const getInstalledVersion = (packageName) => {
29
+ let versionFound;
30
+ for (const workingDirectory of new Set([fsWorkingDirectory, '.'])) {
31
+ try {
32
+ const fileSystemPackageJson = JSON.parse((0, node_fs_1.readFileSync)(path.join(workingDirectory, 'package.json'), { encoding: 'utf8' }));
33
+ let version;
34
+ if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
35
+ version = fileSystemPackageJson.devDependencies[packageName];
36
+ }
37
+ else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
38
+ version = fileSystemPackageJson.peerDependencies[packageName];
39
+ }
40
+ else {
41
+ version = fileSystemPackageJson.dependencies[packageName];
42
+ }
43
+ if (versionFound && version !== versionFound) {
44
+ // In case of conflict between package.json files, we consider the package as not installed to force its update
45
+ return;
46
+ }
47
+ versionFound = version;
48
+ }
49
+ catch (e) {
50
+ return;
51
+ }
52
+ }
53
+ return versionFound;
54
+ };
55
+ const getNgAddSchema = (packageName, context) => {
56
+ try {
57
+ const collection = context.engine.createCollection(packageName);
58
+ return collection.createSchematic('ng-add');
59
+ }
60
+ catch {
61
+ context.logger.warn(`No ng-add found for ${packageName}`);
62
+ return undefined;
63
+ }
64
+ };
65
+ const getOptions = (schema) => {
66
+ const schemaOptions = schema.description.schemaJson?.properties || {};
67
+ return Object.entries(options || {}).reduce((accOptions, [key, value]) => {
68
+ if (schemaOptions[key]) {
69
+ accOptions[key] = value;
70
+ }
71
+ return accOptions;
72
+ }, {});
73
+ };
74
+ const installedVersions = packages.map((packageName) => getInstalledVersion(packageName));
75
+ const packageManager = (0, index_1.getPackageManager)();
76
+ const packagesToInstall = packages.filter((packageName, index) => !installedVersions[index] || installedVersions[index] !== versions[packageName]);
77
+ if (packagesToInstall.length < 1) {
78
+ return schematics_1.noop;
79
+ }
80
+ return (0, schematics_1.chain)([
81
+ // Update package.json in tree
82
+ (tree) => {
83
+ const sortDependencies = (packageJson, depType) => {
84
+ packageJson[depType] = packageJson[depType] ?
85
+ Object.fromEntries(Object.entries(packageJson[depType] || {}).sort(([key1, _val1], [key2, _val2]) => key1.localeCompare(key2))) :
86
+ undefined;
87
+ };
88
+ for (const filePath of new Set([packageJsonPath, './package.json'])) {
89
+ const packageJson = tree.readJson(filePath);
90
+ packages.forEach((packageName) => {
91
+ const version = versions[packageName] || 'latest';
92
+ if (options?.dependencyType === dependencies_1.NodeDependencyType.Dev) {
93
+ packageJson.devDependencies = { ...packageJson.devDependencies, [packageName]: version };
94
+ }
95
+ else if (options?.dependencyType === dependencies_1.NodeDependencyType.Peer) {
96
+ packageJson.peerDependencies = { ...packageJson.peerDependencies, [packageName]: version };
97
+ }
98
+ else {
99
+ packageJson.dependencies = { ...packageJson.dependencies, [packageName]: version };
100
+ }
101
+ });
102
+ ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {
103
+ sortDependencies(packageJson, depType);
104
+ });
105
+ tree.overwrite(filePath, JSON.stringify(packageJson, null, 2));
106
+ }
107
+ },
108
+ // Run ng-adds
109
+ async (tree, context) => {
110
+ if (options?.skipNgAddSchematicRun) {
111
+ context.logger.info(`Package(s) '${packagesToInstall.join(', ')}' was(were) installed.
112
+ The run of 'ng-add' schematics for the package(s) is intentionally skipped. You can do the run standalone, later.`);
113
+ return schematics_1.noop;
114
+ }
115
+ new Set([packageJsonPath, './package.json']).forEach((filePath) => {
116
+ (0, node_fs_1.mkdirSync)(path.join(process.cwd(), path.dirname(filePath)), { recursive: true });
117
+ (0, node_fs_1.writeFileSync)(path.join(process.cwd(), filePath), tree.readText(filePath));
118
+ });
119
+ context.addTask(new tasks_1.NodePackageInstallTask({
120
+ packageManager: packageManager,
121
+ hideOutput: false,
122
+ quiet: false
123
+ }));
124
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
125
+ const ngAddsToApply = packagesToInstall
126
+ .map((packageName) => ({ packageName, ngAddCollection: getNgAddSchema(packageName, context) }))
127
+ .filter(({ packageName, ngAddCollection }) => {
128
+ if (!ngAddCollection) {
129
+ context.logger.info(`No ng-add schematic found for: '${packageName}'. Skipping ng add for: ${packageName}${versions[packageName] ? ' with version: ' + versions[packageName] : ''}`);
130
+ }
131
+ return !!ngAddCollection;
132
+ })
133
+ .map(({ packageName, ngAddCollection }) => (0, schematics_1.externalSchematic)(packageName, 'ng-add', getOptions(ngAddCollection)));
134
+ return (0, schematics_1.chain)(ngAddsToApply);
135
+ }
136
+ ]);
137
+ }
138
+ exports.ngAddPackages = ngAddPackages;
139
+ /**
140
+ * Look for the peer dependencies and run ng add on the package requested version
141
+ * @param packages list of the name of the packages needed
142
+ * @param packageJsonPath path to package json that needs the peer to be resolved
143
+ * @param type how to install the dependency (dev, peer for a library or default for an application)
144
+ * @param options
145
+ * @param parentPackageInfo for logging purposes
146
+ */
147
+ function ngAddPeerDependencyPackages(packages, packageJsonPath, type = dependencies_1.NodeDependencyType.Default, options, parentPackageInfo) {
148
+ if (!packages.length) {
149
+ return schematics_1.noop;
150
+ }
151
+ const dependencies = (0, index_1.getNodeDependencyList)((0, index_1.getExternalDependenciesVersionRange)(packages, packageJsonPath), type);
152
+ return ngAddPackages(dependencies.map(({ name }) => name), {
153
+ ...options,
154
+ skipConfirmation: true,
155
+ version: dependencies.map(({ version }) => version),
156
+ parentPackageInfo,
157
+ dependencyType: type,
158
+ workingDirectory: options.workingDirectory
159
+ });
160
+ }
161
+ exports.ngAddPeerDependencyPackages = ngAddPeerDependencyPackages;
162
+ //# sourceMappingURL=ng-add.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-add.helpers.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/ng-add.helpers.ts"],"names":[],"mappings":";;;AAAA,2DAA+G;AAC/G,4DAA0E;AAE1E,2EAA8E;AAC9E,qCAAiE;AACjE,kCAAkC;AAClC,+BAAqC;AAGrC,+CAAoH;AAEpH;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAkB,EAAE,OAA8F,EAAE,eAAe,GAAG,eAAe;IACjL,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,iBAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAClD,wHAAwH;IACxH,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,gBAAgB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;IACnI,MAAM,QAAQ,GAAG,MAAM,CAAC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;QAC9B,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AA1HD,sCA0HC;AAED;;;;;;;GAOG;AACH,SAAgB,2BAA2B,CAAC,QAAkB,EAAE,eAAuB,EAAE,OAA2B,iCAAkB,CAAC,OAAO,EAC5I,OAA4B,EAAE,iBAA0B;IACxD,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,iBAAI,CAAC;IACd,CAAC;IACD,MAAM,YAAY,GAAqB,IAAA,6BAAqB,EAC1D,IAAA,2CAAmC,EAAC,QAAQ,EAAE,eAAe,CAAC,EAC9D,IAAI,CACL,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;QACzD,GAAG,OAAO;QACV,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC;QACnD,iBAAiB;QACjB,cAAc,EAAE,IAAI;QACpB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAC;AACL,CAAC;AAjBD,kEAiBC"}
@@ -0,0 +1,17 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ import type { PackageJson } from 'type-fest';
3
+ import type { SchematicOptionObject } from '../../interfaces/index';
4
+ /**
5
+ * Register the given package in the Angular CLI schematics
6
+ * @param packageJson PackageJson of the project containing the collection to add to the project
7
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
8
+ */
9
+ export declare function registerPackageCollectionSchematics(packageJson: PackageJson, angularJsonFile?: string): Rule;
10
+ /**
11
+ * Setup schematics default params in angular.json
12
+ * @param schematicsDefaultParams default params to setup by schematic
13
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
14
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
15
+ */
16
+ export declare function setupSchematicsDefaultParams(schematicsDefaultParams: Record<string, SchematicOptionObject>, overrideValue?: boolean, angularJsonFile?: string): Rule;
17
+ //# sourceMappingURL=schematics-register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-register.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAY5G;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,aAAa,UAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAgClK"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupSchematicsDefaultParams = exports.registerPackageCollectionSchematics = void 0;
4
+ const utility_1 = require("../../utility");
5
+ /**
6
+ * Register the given package in the Angular CLI schematics
7
+ * @param packageJson PackageJson of the project containing the collection to add to the project
8
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
9
+ */
10
+ function registerPackageCollectionSchematics(packageJson, angularJsonFile) {
11
+ return (tree, context) => {
12
+ if (!packageJson.name) {
13
+ return tree;
14
+ }
15
+ const workspace = (0, utility_1.getWorkspaceConfig)(tree, angularJsonFile);
16
+ if (!workspace) {
17
+ context.logger.error('No workspace found');
18
+ return tree;
19
+ }
20
+ return (0, utility_1.writeAngularJson)(tree, (0, utility_1.registerCollectionSchematics)(workspace, packageJson.name), angularJsonFile);
21
+ };
22
+ }
23
+ exports.registerPackageCollectionSchematics = registerPackageCollectionSchematics;
24
+ /**
25
+ * Setup schematics default params in angular.json
26
+ * @param schematicsDefaultParams default params to setup by schematic
27
+ * @param overrideValue Define if the given value should override the one already defined in the workspace
28
+ * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified
29
+ */
30
+ function setupSchematicsDefaultParams(schematicsDefaultParams, overrideValue = false, angularJsonFile) {
31
+ return (tree, context) => {
32
+ const workspace = (0, utility_1.getWorkspaceConfig)(tree, angularJsonFile);
33
+ if (!workspace) {
34
+ context.logger.error('No workspace found');
35
+ return tree;
36
+ }
37
+ workspace.schematics ||= {};
38
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
39
+ workspace.schematics[schematicName] = overrideValue ? {
40
+ ...workspace.schematics[schematicName],
41
+ ...defaultParams
42
+ } : {
43
+ ...defaultParams,
44
+ ...workspace.schematics[schematicName]
45
+ };
46
+ });
47
+ Object.values(workspace.projects).forEach((project) => {
48
+ Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => {
49
+ if (project.schematics?.[schematicName]) {
50
+ project.schematics[schematicName] = overrideValue ? {
51
+ ...project.schematics[schematicName],
52
+ ...defaultParams
53
+ } : {
54
+ ...defaultParams,
55
+ ...project.schematics[schematicName]
56
+ };
57
+ }
58
+ });
59
+ });
60
+ return (0, utility_1.writeAngularJson)(tree, workspace, angularJsonFile);
61
+ };
62
+ }
63
+ exports.setupSchematicsDefaultParams = setupSchematicsDefaultParams;
64
+ //# sourceMappingURL=schematics-register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schematics-register.js","sourceRoot":"","sources":["../../../../src/rule-factories/ng-add/schematics-register.ts"],"names":[],"mappings":";;;AAGA,2CAAmG;AAGnG;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,WAAwB,EAAE,eAAwB;IACpG,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACvB,IAAI,CAAC,WAAW,CAA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K,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEpF,WAAW,CAAC,YAAY,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC7F,WAAW,CAAC,eAAe,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACnG,WAAW,CAAC,gBAAgB,KAAK,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAErG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAtBD,wCAsBC"}
@@ -1,5 +1,4 @@
1
1
  export * from './list-of-vars';
2
2
  export * from './update-imports-with-scope';
3
3
  export * from './update-ts-imports';
4
- export * from './v7-to-v8-map-object';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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"}
@@ -4,5 +4,4 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./list-of-vars"), exports);
5
5
  tslib_1.__exportStar(require("./update-imports-with-scope"), exports);
6
6
  tslib_1.__exportStar(require("./update-ts-imports"), exports);
7
- tslib_1.__exportStar(require("./v7-to-v8-map-object"), exports);
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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"}
@@ -1,13 +1,12 @@
1
1
  /**
2
- *
3
- *Represents an element that is exposed in a Sass import.
4
- * @property value: The name of the exposed element.
5
- * @property type: The type of the exposed element, either 'function' or 'var'.
6
- * @property replacement: The name of the replacement element, if any.
2
+ * Represents an element that is exposed in a Sass import.
7
3
  */
8
4
  export interface SassImportExposedElement {
5
+ /** The name of the exposed element */
9
6
  value: string;
7
+ /** The type of the exposed element, either 'function' or 'var' */
10
8
  type: 'function' | 'var';
9
+ /** The name of the replacement element, if any */
11
10
  replacement?: string | undefined;
12
11
  }
13
12
  export declare const listOfExposedElements: SassImportExposedElement[];
@@ -1 +1 @@
1
- {"version":3,"file":"list-of-vars.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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"}
1
+ {"version":3,"file":"list-of-vars.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;IACzB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,qBAAqB,EAAE,wBAAwB,EAuC3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"list-of-vars.js","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/list-of-vars.ts"],"names":[],"mappings":";;;AAaa,QAAA,qBAAqB,GAA+B;IAC/D,QAAQ;IACR,EAAC,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAC;IAC1C,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC;IAClC,EAAC,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,KAAK,EAAC;IACpD,EAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAC;IAC1C,EAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAC;IAC5C,EAAC,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAC;IACzC,EAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC;IAC9B,EAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAC;IACzC,iBAAiB;IACjB,EAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAC;IACxC,EAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAC;IAC3C,oBAAoB;IACpB,EAAC,KAAK,EAAE,0BAA0B,EAAE,IAAI,EAAE,UAAU,EAAC;IACrD,EAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAC;IAC3C,EAAC,KAAK,EAAE,gB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c,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAC;IAC1E,EAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAC;IACpE,sBAAsB;IACtB,EAAC,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAC;IACjD,EAAC,KAAK,EAAE,2BAA2B,EAAE,IAAI,EAAE,UAAU,EAAC;IACtD,qBAAqB;IACrB,EAAC,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAC;IAC7C,EAAC,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,KAAK,EAAC;CAC5C,CAAC"}
@@ -4,7 +4,7 @@ import { SassImportExposedElement } from './list-of-vars';
4
4
  * Update SASS imports to use a scoped dependency
5
5
  * @param alias The name of the otter styling package
6
6
  * @param dependencyName The name of the dependency to update imports on
7
- * @param exposedElements The list of exposed elemeents
7
+ * @param exposedElements The list of exposed elements
8
8
  * @param fromRoot Perform on all files in project
9
9
  */
10
10
  export declare function updateSassImports(alias: string, dependencyName?: string, exposedElements?: SassImportExposedElement[], fromRoot?: boolean): Rule;