@o3r/schematics 9.1.0-alpha.22 → 9.1.0-alpha.23
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +5 -5
- 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/logo.d.ts +5 -0
- package/src/utility/logo.d.ts.map +1 -0
- package/src/utility/logo.js +51 -0
- package/src/utility/logo.js.map +1 -0
- package/index.d.ts +0 -7
- package/index.d.ts.map +0 -1
- package/index.js +0 -10
- package/index.js.map +0 -1
- package/interfaces/angular-workspace.d.ts +0 -62
- package/interfaces/angular-workspace.d.ts.map +0 -1
- package/interfaces/angular-workspace.js +0 -3
- package/interfaces/angular-workspace.js.map +0 -1
- package/interfaces/index.d.ts +0 -3
- package/interfaces/index.d.ts.map +0 -1
- package/interfaces/index.js +0 -6
- package/interfaces/index.js.map +0 -1
- package/interfaces/schematic-option.d.ts +0 -5
- package/interfaces/schematic-option.d.ts.map +0 -1
- package/interfaces/schematic-option.js +0 -3
- package/interfaces/schematic-option.js.map +0 -1
- package/modules/index.d.ts +0 -3
- package/modules/index.d.ts.map +0 -1
- package/modules/index.js +0 -6
- package/modules/index.js.map +0 -1
- package/modules/modules.constants.d.ts +0 -34
- package/modules/modules.constants.d.ts.map +0 -1
- package/modules/modules.constants.js +0 -12
- package/modules/modules.constants.js.map +0 -1
- package/modules/modules.helpers.d.ts +0 -60
- package/modules/modules.helpers.d.ts.map +0 -1
- package/modules/modules.helpers.js +0 -165
- package/modules/modules.helpers.js.map +0 -1
- package/public_api.d.ts +0 -2
- package/public_api.d.ts.map +0 -1
- package/public_api.js +0 -5
- package/public_api.js.map +0 -1
- package/rule-factories/add-imports/index.d.ts +0 -12
- package/rule-factories/add-imports/index.d.ts.map +0 -1
- package/rule-factories/add-imports/index.js +0 -26
- package/rule-factories/add-imports/index.js.map +0 -1
- package/rule-factories/check-packages-peers/index.d.ts +0 -8
- package/rule-factories/check-packages-peers/index.d.ts.map +0 -1
- package/rule-factories/check-packages-peers/index.js +0 -106
- package/rule-factories/check-packages-peers/index.js.map +0 -1
- package/rule-factories/eslint-fix/index.d.ts +0 -28
- package/rule-factories/eslint-fix/index.d.ts.map +0 -1
- package/rule-factories/eslint-fix/index.js +0 -71
- package/rule-factories/eslint-fix/index.js.map +0 -1
- package/rule-factories/index.d.ts +0 -9
- package/rule-factories/index.d.ts.map +0 -1
- package/rule-factories/index.js +0 -12
- package/rule-factories/index.js.map +0 -1
- package/rule-factories/interfaces.d.ts +0 -6
- package/rule-factories/interfaces.d.ts.map +0 -1
- package/rule-factories/interfaces.js +0 -3
- package/rule-factories/interfaces.js.map +0 -1
- package/rule-factories/ng-add/index.d.ts +0 -38
- package/rule-factories/ng-add/index.d.ts.map +0 -1
- package/rule-factories/ng-add/index.js +0 -174
- package/rule-factories/ng-add/index.js.map +0 -1
- package/rule-factories/remove-packages/index.d.ts +0 -9
- package/rule-factories/remove-packages/index.d.ts.map +0 -1
- package/rule-factories/remove-packages/index.js +0 -29
- package/rule-factories/remove-packages/index.js.map +0 -1
- package/rule-factories/update-imports/index.d.ts +0 -5
- package/rule-factories/update-imports/index.d.ts.map +0 -1
- package/rule-factories/update-imports/index.js +0 -8
- package/rule-factories/update-imports/index.js.map +0 -1
- package/rule-factories/update-imports/list-of-vars.d.ts +0 -15
- package/rule-factories/update-imports/list-of-vars.d.ts.map +0 -1
- package/rule-factories/update-imports/list-of-vars.js +0 -44
- package/rule-factories/update-imports/list-of-vars.js.map +0 -1
- package/rule-factories/update-imports/update-imports-with-scope.d.ts +0 -12
- package/rule-factories/update-imports/update-imports-with-scope.d.ts.map +0 -1
- package/rule-factories/update-imports/update-imports-with-scope.js +0 -34
- package/rule-factories/update-imports/update-imports-with-scope.js.map +0 -1
- package/rule-factories/update-imports/update-ts-imports.d.ts +0 -11
- package/rule-factories/update-imports/update-ts-imports.d.ts.map +0 -1
- package/rule-factories/update-imports/update-ts-imports.js +0 -32
- package/rule-factories/update-imports/update-ts-imports.js.map +0 -1
- package/rule-factories/update-imports/v7-to-v8-map-object.d.ts +0 -8
- package/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +0 -1
- package/rule-factories/update-imports/v7-to-v8-map-object.js +0 -2049
- package/rule-factories/update-imports/v7-to-v8-map-object.js.map +0 -1
- package/rule-factories/vscode-extensions/index.d.ts +0 -8
- package/rule-factories/vscode-extensions/index.d.ts.map +0 -1
- package/rule-factories/vscode-extensions/index.js +0 -26
- package/rule-factories/vscode-extensions/index.js.map +0 -1
- package/rules/index.d.ts +0 -2
- package/rules/index.d.ts.map +0 -1
- package/rules/index.js +0 -5
- package/rules/index.js.map +0 -1
- package/rules/install.d.ts +0 -9
- package/rules/install.d.ts.map +0 -1
- package/rules/install.js +0 -21
- package/rules/install.js.map +0 -1
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/schema.js.map +0 -1
- package/tasks/eslint/index.d.ts +0 -10
- package/tasks/eslint/index.d.ts.map +0 -1
- package/tasks/eslint/index.js +0 -29
- package/tasks/eslint/index.js.map +0 -1
- package/tasks/index.d.ts +0 -5
- package/tasks/index.d.ts.map +0 -1
- package/tasks/index.js +0 -8
- package/tasks/index.js.map +0 -1
- package/tasks/link/index.d.ts +0 -10
- package/tasks/link/index.d.ts.map +0 -1
- package/tasks/link/index.js +0 -26
- package/tasks/link/index.js.map +0 -1
- package/tasks/ng-add/index.d.ts +0 -30
- package/tasks/ng-add/index.d.ts.map +0 -1
- package/tasks/ng-add/index.js +0 -30
- package/tasks/ng-add/index.js.map +0 -1
- package/tasks/package-manager/add-dev-dependency.d.ts +0 -24
- package/tasks/package-manager/add-dev-dependency.d.ts.map +0 -1
- package/tasks/package-manager/add-dev-dependency.js +0 -34
- package/tasks/package-manager/add-dev-dependency.js.map +0 -1
- package/tasks/package-manager/index.d.ts +0 -4
- package/tasks/package-manager/index.d.ts.map +0 -1
- package/tasks/package-manager/index.js +0 -7
- package/tasks/package-manager/index.js.map +0 -1
- package/tasks/package-manager/interfaces.d.ts +0 -14
- package/tasks/package-manager/interfaces.d.ts.map +0 -1
- package/tasks/package-manager/interfaces.js +0 -3
- package/tasks/package-manager/interfaces.js.map +0 -1
- package/tasks/package-manager/npm-install.d.ts +0 -24
- package/tasks/package-manager/npm-install.d.ts.map +0 -1
- package/tasks/package-manager/npm-install.js +0 -35
- package/tasks/package-manager/npm-install.js.map +0 -1
- package/utility/ast.d.ts +0 -142
- package/utility/ast.d.ts.map +0 -1
- package/utility/ast.js +0 -325
- package/utility/ast.js.map +0 -1
- package/utility/collection.d.ts +0 -10
- package/utility/collection.d.ts.map +0 -1
- package/utility/collection.js +0 -20
- package/utility/collection.js.map +0 -1
- package/utility/component.d.ts +0 -46
- package/utility/component.d.ts.map +0 -1
- package/utility/component.js +0 -104
- package/utility/component.js.map +0 -1
- package/utility/dependencies.d.ts +0 -18
- package/utility/dependencies.d.ts.map +0 -1
- package/utility/dependencies.js +0 -31
- package/utility/dependencies.js.map +0 -1
- package/utility/file-info.d.ts +0 -23
- package/utility/file-info.d.ts.map +0 -1
- package/utility/file-info.js +0 -36
- package/utility/file-info.js.map +0 -1
- package/utility/generation.d.ts +0 -22
- package/utility/generation.d.ts.map +0 -1
- package/utility/generation.js +0 -67
- package/utility/generation.js.map +0 -1
- package/utility/gitignore.d.ts +0 -12
- package/utility/gitignore.d.ts.map +0 -1
- package/utility/gitignore.js +0 -28
- package/utility/gitignore.js.map +0 -1
- package/utility/index.d.ts +0 -18
- package/utility/index.d.ts.map +0 -1
- package/utility/index.js +0 -21
- package/utility/index.js.map +0 -1
- package/utility/loaders.d.ts +0 -122
- package/utility/loaders.d.ts.map +0 -1
- package/utility/loaders.js +0 -222
- package/utility/loaders.js.map +0 -1
- package/utility/matching-peers.d.ts +0 -24
- package/utility/matching-peers.d.ts.map +0 -1
- package/utility/matching-peers.js +0 -41
- package/utility/matching-peers.js.map +0 -1
- package/utility/modules.d.ts +0 -73
- package/utility/modules.d.ts.map +0 -1
- package/utility/modules.js +0 -201
- package/utility/modules.js.map +0 -1
- package/utility/monorepo.d.ts +0 -17
- package/utility/monorepo.d.ts.map +0 -1
- package/utility/monorepo.js +0 -30
- package/utility/monorepo.js.map +0 -1
- package/utility/package-manager-runner.d.ts +0 -43
- package/utility/package-manager-runner.d.ts.map +0 -1
- package/utility/package-manager-runner.js +0 -61
- package/utility/package-manager-runner.js.map +0 -1
- package/utility/package-version.d.ts +0 -17
- package/utility/package-version.d.ts.map +0 -1
- package/utility/package-version.js +0 -34
- package/utility/package-version.js.map +0 -1
- package/utility/routes.d.ts +0 -40
- package/utility/routes.d.ts.map +0 -1
- package/utility/routes.js +0 -103
- package/utility/routes.js.map +0 -1
- package/utility/sub-entry.d.ts +0 -18
- package/utility/sub-entry.d.ts.map +0 -1
- package/utility/sub-entry.js +0 -51
- package/utility/sub-entry.js.map +0 -1
- package/utility/template-property.helper.d.ts +0 -101
- package/utility/template-property.helper.d.ts.map +0 -1
- package/utility/template-property.helper.js +0 -175
- package/utility/template-property.helper.js.map +0 -1
- package/utility/update-imports.d.ts +0 -25
- package/utility/update-imports.d.ts.map +0 -1
- package/utility/update-imports.js +0 -86
- package/utility/update-imports.js.map +0 -1
@@ -1,175 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getLibraryNameFromPath = exports.getComponentConfigKey = exports.getComponentFixtureName = exports.getComponentContextName = exports.getComponentTranslationName = exports.getComponentConfigName = exports.getKebabCaseBlockName = exports.getComponentBlockName = exports.getComponentName = exports.getComponentAnalyticsName = exports.getComponentModuleName = exports.getComponentSelectorWithoutSuffix = exports.getComponentFileName = exports.getComponentFolderName = exports.getInputComponentName = void 0;
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
5
|
-
/**
|
6
|
-
* Returns all elements from the provided component name path
|
7
|
-
*
|
8
|
-
* @param componentName
|
9
|
-
*/
|
10
|
-
function getComponentModuleItems(componentName) {
|
11
|
-
return (componentName || '').split('\\/');
|
12
|
-
}
|
13
|
-
/**
|
14
|
-
* Returns the component name as the last element of the provided component name path
|
15
|
-
*
|
16
|
-
* @param componentName
|
17
|
-
*/
|
18
|
-
function getInputComponentName(componentName) {
|
19
|
-
const componentModuleItems = getComponentModuleItems(componentName);
|
20
|
-
return componentModuleItems[componentModuleItems.length - 1];
|
21
|
-
}
|
22
|
-
exports.getInputComponentName = getInputComponentName;
|
23
|
-
/**
|
24
|
-
* returns the component folder name
|
25
|
-
*
|
26
|
-
* @param componentName
|
27
|
-
*/
|
28
|
-
function getComponentFolderName(componentName) {
|
29
|
-
const inputComponentName = getInputComponentName(componentName);
|
30
|
-
return core_1.strings.dasherize(inputComponentName).replace(/\s/g, '');
|
31
|
-
}
|
32
|
-
exports.getComponentFolderName = getComponentFolderName;
|
33
|
-
/**
|
34
|
-
* Returns the component file name
|
35
|
-
*
|
36
|
-
* @param componentName
|
37
|
-
* @param componentStructureDef
|
38
|
-
*/
|
39
|
-
function getComponentFileName(componentName, componentStructureDef) {
|
40
|
-
const componentFolderName = getComponentFolderName(componentName);
|
41
|
-
return componentStructureDef ? `${componentFolderName}-${core_1.strings.camelize(componentStructureDef)}` : componentFolderName;
|
42
|
-
}
|
43
|
-
exports.getComponentFileName = getComponentFileName;
|
44
|
-
/**
|
45
|
-
* Returns the component selector without suffix
|
46
|
-
*
|
47
|
-
* @param componentName
|
48
|
-
* @param prefix
|
49
|
-
*/
|
50
|
-
function getComponentSelectorWithoutSuffix(componentName, prefix) {
|
51
|
-
const selector = getComponentFolderName(componentName);
|
52
|
-
return prefix ? `${prefix.toLowerCase()}-${selector}` : selector; // o3r-air-offer : air-offer
|
53
|
-
}
|
54
|
-
exports.getComponentSelectorWithoutSuffix = getComponentSelectorWithoutSuffix;
|
55
|
-
/**
|
56
|
-
* Returns the component module name (e.g. AirOfferModule)
|
57
|
-
*
|
58
|
-
* @param componentName
|
59
|
-
* @param componentStructureDef
|
60
|
-
*/
|
61
|
-
function getComponentModuleName(componentName, componentStructureDef) {
|
62
|
-
const inputComponentName = getInputComponentName(componentName);
|
63
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Module`;
|
64
|
-
}
|
65
|
-
exports.getComponentModuleName = getComponentModuleName;
|
66
|
-
/**
|
67
|
-
* Returns the component analytics name (e.g. AirOfferAnalytics)
|
68
|
-
*
|
69
|
-
* @param componentName
|
70
|
-
* @param componentStructureDef
|
71
|
-
*/
|
72
|
-
function getComponentAnalyticsName(componentName, componentStructureDef) {
|
73
|
-
const inputComponentName = getInputComponentName(componentName);
|
74
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Analytics`;
|
75
|
-
}
|
76
|
-
exports.getComponentAnalyticsName = getComponentAnalyticsName;
|
77
|
-
/**
|
78
|
-
* Returns the component name (e.g. AirOfferComponent)
|
79
|
-
*
|
80
|
-
* @param componentName
|
81
|
-
* @param componentStructureDef
|
82
|
-
*/
|
83
|
-
function getComponentName(componentName, componentStructureDef) {
|
84
|
-
const inputComponentName = getInputComponentName(componentName);
|
85
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Component`;
|
86
|
-
}
|
87
|
-
exports.getComponentName = getComponentName;
|
88
|
-
/**
|
89
|
-
* Returns the component block name (e.g. AirOffer)
|
90
|
-
*
|
91
|
-
* @param componentName
|
92
|
-
*/
|
93
|
-
function getComponentBlockName(componentName) {
|
94
|
-
const inputComponentName = getInputComponentName(componentName);
|
95
|
-
return core_1.strings.classify(inputComponentName);
|
96
|
-
}
|
97
|
-
exports.getComponentBlockName = getComponentBlockName;
|
98
|
-
/**
|
99
|
-
* Return the component in kebab-case (e.g. air-offer)
|
100
|
-
*
|
101
|
-
* @param blockName
|
102
|
-
*/
|
103
|
-
function getKebabCaseBlockName(blockName) {
|
104
|
-
return core_1.strings.dasherize(blockName);
|
105
|
-
}
|
106
|
-
exports.getKebabCaseBlockName = getKebabCaseBlockName;
|
107
|
-
/**
|
108
|
-
* Returns the component config name (e.g. AirOfferConfig)
|
109
|
-
*
|
110
|
-
* @param componentName
|
111
|
-
* @param componentStructureDef
|
112
|
-
*/
|
113
|
-
function getComponentConfigName(componentName, componentStructureDef) {
|
114
|
-
const inputComponentName = getInputComponentName(componentName);
|
115
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Config`;
|
116
|
-
}
|
117
|
-
exports.getComponentConfigName = getComponentConfigName;
|
118
|
-
/**
|
119
|
-
* Returns the component translation name (e.g. AirOfferTranslation)
|
120
|
-
*
|
121
|
-
* @param componentName
|
122
|
-
* @param componentStructureDef
|
123
|
-
*/
|
124
|
-
function getComponentTranslationName(componentName, componentStructureDef) {
|
125
|
-
const inputComponentName = getInputComponentName(componentName);
|
126
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Translation`;
|
127
|
-
}
|
128
|
-
exports.getComponentTranslationName = getComponentTranslationName;
|
129
|
-
/**
|
130
|
-
* Returns the component context name (e.g. AirOfferContext)
|
131
|
-
*
|
132
|
-
* @param componentName
|
133
|
-
* @param componentStructureDef
|
134
|
-
*/
|
135
|
-
function getComponentContextName(componentName, componentStructureDef) {
|
136
|
-
const inputComponentName = getInputComponentName(componentName);
|
137
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Context`;
|
138
|
-
}
|
139
|
-
exports.getComponentContextName = getComponentContextName;
|
140
|
-
/**
|
141
|
-
* Returns the component fixture name (e.g. AirOfferFixture)
|
142
|
-
*
|
143
|
-
* @param componentName
|
144
|
-
* @param componentStructureDef
|
145
|
-
*/
|
146
|
-
function getComponentFixtureName(componentName, componentStructureDef) {
|
147
|
-
const inputComponentName = getInputComponentName(componentName);
|
148
|
-
return `${core_1.strings.classify(inputComponentName)}${core_1.strings.classify(componentStructureDef)}Fixture`;
|
149
|
-
}
|
150
|
-
exports.getComponentFixtureName = getComponentFixtureName;
|
151
|
-
/**
|
152
|
-
* Returns the component config key name (e.g. AIR_OFFER_CONT or AIR_OFFER_PRES)
|
153
|
-
*
|
154
|
-
* @param componentName
|
155
|
-
* @param componentStructureDef
|
156
|
-
*/
|
157
|
-
function getComponentConfigKey(componentName, componentStructureDef) {
|
158
|
-
const componentFileName = getComponentFileName(componentName, componentStructureDef);
|
159
|
-
return `${core_1.strings.underscore(componentFileName).toUpperCase()}`;
|
160
|
-
}
|
161
|
-
exports.getComponentConfigKey = getComponentConfigKey;
|
162
|
-
/**
|
163
|
-
* Return the library name from path in a monorepos
|
164
|
-
*
|
165
|
-
* @param path
|
166
|
-
*/
|
167
|
-
function getLibraryNameFromPath(path) {
|
168
|
-
if (!path) {
|
169
|
-
return null;
|
170
|
-
}
|
171
|
-
const libNameRes = /@[^@/]+\/[^/]+/.exec(path.replace(/\\/g, '/'));
|
172
|
-
return libNameRes && libNameRes[0];
|
173
|
-
}
|
174
|
-
exports.getLibraryNameFromPath = getLibraryNameFromPath;
|
175
|
-
//# sourceMappingURL=template-property.helper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"template-property.helper.js","sourceRoot":"","sources":["../../src/utility/template-property.helper.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAE7C;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,aAAqB;IACpD,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,aAAqB;IACzD,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACpE,OAAO,oBAAoB,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC;AAHD,sDAGC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,aAAqB;IAC1D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAChE,OAAO,cAAO,CAAC,SAAS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AC,kBAAkB,CAAC,GAAG,cAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,SAAS,CAAC;AACpG,CAAC;AAHD,0DAGC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,aAAqB,EAAE,qBAA6B;IAC1F,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAChE,OAAO,GAAG,cAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,cAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,SAAS,CAAC;AACpG,CAAC;AAHD,0DAGC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,aAAqB,EAAE,qBAA6B;IACxF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IACrF,OAAO,GAAG,cAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;AAClE,CAAC;AAHD,sDAGC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,IAA+B;IACpE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IACD,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACnE,OAAO,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAND,wDAMC"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import * as ts from 'typescript';
|
2
|
-
import { logging } from '@angular-devkit/core';
|
3
|
-
import type { Tree } from '@angular-devkit/schematics';
|
4
|
-
/** Map containing all import changes in otter packages */
|
5
|
-
export interface ImportsMapping {
|
6
|
-
[packageName: string]: {
|
7
|
-
[importName: string]: {
|
8
|
-
newPackage: string;
|
9
|
-
newValue?: string;
|
10
|
-
};
|
11
|
-
};
|
12
|
-
}
|
13
|
-
/**
|
14
|
-
* Update the imports of a given file according to replace mapping
|
15
|
-
*
|
16
|
-
* @param logger Logger to report messages
|
17
|
-
* @param tree File System tree
|
18
|
-
* @param sourceFile Source file to analyze
|
19
|
-
* @param importsRegexp Regexp of the imports to replace
|
20
|
-
* @param renamePackagesRegexp Regexp of the packages to replace
|
21
|
-
* @param mapImports Map of the import to replace
|
22
|
-
* @param renamedPackages Map of the import package to replace
|
23
|
-
*/
|
24
|
-
export declare function updateImportsInFile(logger: logging.LoggerApi, tree: Tree, sourceFile: ts.SourceFile, importsRegexp: RegExp, renamePackagesRegexp: RegExp, mapImports?: ImportsMapping, renamedPackages?: Record<string, string>): number;
|
25
|
-
//# sourceMappingURL=update-imports.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-imports.d.ts","sourceRoot":"","sources":["../../src/utility/update-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAavD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,CAAC,WAAW,EAAE,MAAM,GAAG;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC5F;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,aAAa,EAAE,MAAM,EACrB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,GAAE,cAAmB,EAC/B,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,UAkF7C"}
|
@@ -1,86 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.updateImportsInFile = void 0;
|
4
|
-
const ts = require("typescript");
|
5
|
-
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
6
|
-
/**
|
7
|
-
* Update the imports of a given file according to replace mapping
|
8
|
-
*
|
9
|
-
* @param logger Logger to report messages
|
10
|
-
* @param tree File System tree
|
11
|
-
* @param sourceFile Source file to analyze
|
12
|
-
* @param importsRegexp Regexp of the imports to replace
|
13
|
-
* @param renamePackagesRegexp Regexp of the packages to replace
|
14
|
-
* @param mapImports Map of the import to replace
|
15
|
-
* @param renamedPackages Map of the import package to replace
|
16
|
-
*/
|
17
|
-
function updateImportsInFile(logger, tree, sourceFile, importsRegexp, renamePackagesRegexp, mapImports = {}, renamedPackages = {}) {
|
18
|
-
const oldImportedSymbolsPerPackage = {};
|
19
|
-
const unResolvedImports = [];
|
20
|
-
const importNodes = [];
|
21
|
-
// First we look for all imports lines targeting an Otter package for which we know a mapping
|
22
|
-
(0, ast_utils_1.findNodes)(sourceFile, ts.SyntaxKind.ImportDeclaration).map((nodeImp) => {
|
23
|
-
const imp = nodeImp;
|
24
|
-
const importFrom = imp.moduleSpecifier.getText().replace(/['"]/g, '');
|
25
|
-
const renamePackageMatch = importFrom.match(renamePackagesRegexp);
|
26
|
-
const otterPackage = renamePackageMatch ? renamePackageMatch[0] : importFrom.match(importsRegexp)?.[0];
|
27
|
-
// If the import matched an Otter package
|
28
|
-
if (otterPackage) {
|
29
|
-
if (!oldImportedSymbolsPerPackage[otterPackage]) {
|
30
|
-
oldImportedSymbolsPerPackage[otterPackage] = [];
|
31
|
-
}
|
32
|
-
// We store the import line to be able to remove it afterwards
|
33
|
-
importNodes.push(imp);
|
34
|
-
// We retrieve all the symbols listed in the import statement
|
35
|
-
const namedImport = imp.importClause && imp.importClause.getChildAt(0);
|
36
|
-
const imports = namedImport && ts.isNamedImports(namedImport) ?
|
37
|
-
namedImport.elements.map((element) => ({ symbol: element.getText(), location: importFrom })) :
|
38
|
-
[];
|
39
|
-
// And associate them to the Otter package
|
40
|
-
oldImportedSymbolsPerPackage[otterPackage].push(...imports);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
// If did not capture any interesting import line, do nothing
|
44
|
-
if (importNodes.length === 0) {
|
45
|
-
return 0;
|
46
|
-
}
|
47
|
-
// Iterate over the imports and look into the renamed packages and into the map to see the import new module
|
48
|
-
// If no mapping is found, we keep the original import location
|
49
|
-
const resolvedImports = Object.entries(oldImportedSymbolsPerPackage).reduce((acc, [oldPackageName, importsFromOldPackage]) => {
|
50
|
-
importsFromOldPackage.forEach((importSymbol) => {
|
51
|
-
let newPackageNameImport;
|
52
|
-
if (Object.keys(renamedPackages).indexOf(oldPackageName) > 0) {
|
53
|
-
newPackageNameImport = importSymbol.location.replace(oldPackageName, renamedPackages[oldPackageName]);
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
newPackageNameImport = mapImports[oldPackageName]?.[importSymbol.symbol]?.newPackage;
|
57
|
-
}
|
58
|
-
const importFrom = newPackageNameImport || importSymbol.location;
|
59
|
-
if (!newPackageNameImport) {
|
60
|
-
unResolvedImports.push(importSymbol);
|
61
|
-
}
|
62
|
-
if (!acc[importFrom]) {
|
63
|
-
acc[importFrom] = [];
|
64
|
-
}
|
65
|
-
const newNameForExportedValue = mapImports[oldPackageName]?.[importSymbol.symbol]?.newValue;
|
66
|
-
acc[importFrom].push(newNameForExportedValue || importSymbol.symbol);
|
67
|
-
});
|
68
|
-
return acc;
|
69
|
-
}, {});
|
70
|
-
// Remove captured imports
|
71
|
-
const fileWithoutImports = tree.read(sourceFile.fileName).toString()
|
72
|
-
.replace(new RegExp(`(${importNodes.map((node) => node.getText()).join('|')})[\\n\\r]*`, 'g'), '');
|
73
|
-
// Add the computed imports at the top of the file
|
74
|
-
const fileWithNewImports = Object.entries(resolvedImports)
|
75
|
-
.map(([importFrom, imports]) => `import {${imports.join(', ')}} from '${importFrom}';`)
|
76
|
-
.join('\n') + '\n' + fileWithoutImports;
|
77
|
-
tree.overwrite(sourceFile.fileName, fileWithNewImports);
|
78
|
-
// Log details about imports for which we could not find an associated sub-entry
|
79
|
-
if (unResolvedImports.length > 0) {
|
80
|
-
logger.warn(`Some imports in file ${sourceFile.fileName} could not be resolved:`);
|
81
|
-
unResolvedImports.forEach((unResolvedImport) => logger.warn(` |-- symbol "${unResolvedImport.symbol}" from module "${unResolvedImport.location}"`));
|
82
|
-
}
|
83
|
-
return unResolvedImports.length;
|
84
|
-
}
|
85
|
-
exports.updateImportsInFile = updateImportsInFile;
|
86
|
-
//# sourceMappingURL=update-imports.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"update-imports.js","sourceRoot":"","sources":["../../src/utility/update-imports.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,qEAAkE;AAoBlE;;;;;;;;;;GAUG;AACH,SAAgB,mBAAmB,CACjC,MAAyB,EACzB,IAAU,EACV,UAAyB,EACzB,aAAqB,EACrB,oBAA4B,EAC5B,aAA6B,EAAE,EAC/B,kBAA0C,EAAE;IAE5C,MAAM,4BAA4B,GAAsC,EAAE,CAAC;IAC3E,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,6FAA6F;IAC7F,IAAA,qBAAS,EAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACrE,MAAM,GAAG,GAAG,OAA+B,CAAC;QAC5C,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEtE,MAAM,kBAAkB,GAAG,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAElE,MAAM,YAAY,GAAG,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,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