@energycap/components 0.39.8-schematics.20240229-1407 → 0.39.8-schematics.20240307-1409
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/controls/combobox/combobox.component.mjs +1 -1
- package/esm2020/lib/controls/form-control/form-control.component.mjs +2 -2
- package/esm2020/lib/controls/select/select.component.mjs +2 -2
- package/fesm2015/energycap-components.mjs +4 -4
- package/fesm2015/energycap-components.mjs.map +1 -1
- package/fesm2020/energycap-components.mjs +4 -4
- package/fesm2020/energycap-components.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-generate/rxjs-7-upgrade/index.js +100 -74
- package/schematics/ng-generate/rxjs-7-upgrade/index.js.map +1 -1
package/package.json
CHANGED
@@ -25,86 +25,112 @@ function rxjs7Upgrade() {
|
|
25
25
|
const basePath = process.cwd().replace(/\\/g, '/');
|
26
26
|
tsConfigPaths.forEach(tsConfigPath => {
|
27
27
|
const program = createTsProgram(tree, tsConfigPath, basePath);
|
28
|
-
|
29
|
-
|
30
|
-
//
|
31
|
-
const
|
32
|
-
|
28
|
+
const printer = ts.createPrinter();
|
29
|
+
const checker = program.getTypeChecker();
|
30
|
+
// const migratedFiles = new Map<string, string>();
|
31
|
+
const transformer = getTransformer(checker);
|
32
|
+
for (const sourceFile of program.getSourceFiles()) {
|
33
|
+
// Skip declaration files and external library files
|
34
|
+
if (sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
|
35
|
+
continue;
|
36
|
+
}
|
37
|
+
const result = ts.transform(sourceFile, [transformer]);
|
38
|
+
const transformedSourceFile = result.transformed[0];
|
39
|
+
const transformedContent = printer.printFile(transformedSourceFile);
|
40
|
+
console.log(transformedContent === sourceFile.getFullText() ? 'No changes' : 'Changes detected');
|
41
|
+
}
|
33
42
|
});
|
34
43
|
});
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
});
|
45
|
-
},
|
46
|
-
writeFile(path, data) {
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
48
|
-
return tree.overwrite(path, data);
|
49
|
-
});
|
50
|
-
},
|
51
|
-
isDirectory(path) {
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
53
|
-
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
54
|
-
});
|
55
|
-
},
|
56
|
-
isFile(path) {
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
58
|
-
return tree.exists(path);
|
59
|
-
});
|
60
|
-
}
|
61
|
-
};
|
62
|
-
}
|
63
|
-
function getTsConfigPaths(workspace, tree) {
|
64
|
-
const buildPaths = new Set();
|
65
|
-
const testPaths = new Set();
|
66
|
-
for (const [name, target] of (0, workspace_1.allWorkspaceTargets)(workspace)) {
|
67
|
-
if (name !== 'build' && name !== 'test') {
|
68
|
-
continue;
|
69
|
-
}
|
70
|
-
for (const [, options] of (0, workspace_1.allTargetOptions)(target)) {
|
71
|
-
if (options.tsConfig && typeof options.tsConfig === 'string' && tree.exists(options.tsConfig)) {
|
72
|
-
const normalizedPath = (0, core_1.normalize)(options.tsConfig);
|
73
|
-
name === 'build' ? buildPaths.add(normalizedPath) : testPaths.add(normalizedPath);
|
44
|
+
}
|
45
|
+
exports.rxjs7Upgrade = rxjs7Upgrade;
|
46
|
+
function createWorkspaceHost(tree) {
|
47
|
+
return {
|
48
|
+
readFile(path) {
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
50
|
+
const data = tree.read(path);
|
51
|
+
if (!data) {
|
52
|
+
throw new Error(`File not found: ${path}`);
|
74
53
|
}
|
54
|
+
return core_1.virtualFs.fileBufferToString(data);
|
55
|
+
});
|
56
|
+
},
|
57
|
+
writeFile(path, data) {
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
59
|
+
return tree.overwrite(path, data);
|
60
|
+
});
|
61
|
+
},
|
62
|
+
isDirectory(path) {
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
64
|
+
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
65
|
+
});
|
66
|
+
},
|
67
|
+
isFile(path) {
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
69
|
+
return tree.exists(path);
|
70
|
+
});
|
71
|
+
}
|
72
|
+
};
|
73
|
+
}
|
74
|
+
function getTsConfigPaths(workspace, tree) {
|
75
|
+
const buildPaths = new Set();
|
76
|
+
const testPaths = new Set();
|
77
|
+
for (const [name, target] of (0, workspace_1.allWorkspaceTargets)(workspace)) {
|
78
|
+
if (name !== 'build' && name !== 'test') {
|
79
|
+
continue;
|
80
|
+
}
|
81
|
+
for (const [, options] of (0, workspace_1.allTargetOptions)(target)) {
|
82
|
+
if (options.tsConfig && typeof options.tsConfig === 'string' && tree.exists(options.tsConfig)) {
|
83
|
+
const normalizedPath = (0, core_1.normalize)(options.tsConfig);
|
84
|
+
name === 'build' ? buildPaths.add(normalizedPath) : testPaths.add(normalizedPath);
|
75
85
|
}
|
76
86
|
}
|
77
|
-
return [...buildPaths, ...testPaths];
|
78
87
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
88
|
+
return [...buildPaths];
|
89
|
+
}
|
90
|
+
function createTsProgram(tree, tsConfigPath, basePath) {
|
91
|
+
tsConfigPath = (0, path_1.resolve)(basePath, tsConfigPath);
|
92
|
+
const parsed = parseTsConfig(tsConfigPath, (0, path_1.dirname)(tsConfigPath));
|
93
|
+
const options = Object.assign(Object.assign({}, parsed.options), { skipLibCheck: true, skipDefaultLibCheck: true });
|
94
|
+
const host = createTsCompilerHost(tree, options, basePath);
|
95
|
+
return ts.createProgram(parsed.fileNames, options, host);
|
96
|
+
}
|
97
|
+
function parseTsConfig(tsConfigPath, basePath) {
|
98
|
+
const { config } = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
|
99
|
+
const parseHost = {
|
100
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
101
|
+
fileExists: ts.sys.fileExists,
|
102
|
+
readFile: ts.sys.readFile,
|
103
|
+
readDirectory: ts.sys.readDirectory
|
104
|
+
};
|
105
|
+
return ts.parseJsonConfigFileContent(config, parseHost, basePath, {});
|
106
|
+
}
|
107
|
+
function createTsCompilerHost(tree, options, basePath) {
|
108
|
+
const host = ts.createCompilerHost(options);
|
109
|
+
// Read files from the virtual tree to prevent conflicting changes between project migrations
|
110
|
+
host.readFile = (fileName) => {
|
111
|
+
var _a;
|
112
|
+
const relativePath = (0, path_1.relative)(basePath, fileName);
|
113
|
+
const result = (_a = tree.read(relativePath)) === null || _a === void 0 ? void 0 : _a.toString();
|
114
|
+
// Remove BOM header to prevent TSC parsing errors
|
115
|
+
return result === null || result === void 0 ? void 0 : result.replace(/^\uFEFF/, '');
|
116
|
+
};
|
117
|
+
return host;
|
118
|
+
}
|
119
|
+
function getTransformer(checker) {
|
120
|
+
return (context) => {
|
121
|
+
const visit = (node) => {
|
122
|
+
// Check if this is a call expression where the expression is a property access expression with the name 'toPromise'
|
123
|
+
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === 'toPromise') {
|
124
|
+
// Get the type of the object on which 'toPromise' is being called
|
125
|
+
const symbol = checker.getTypeAtLocation(node.expression.expression).symbol;
|
126
|
+
if (symbol && ['Observable', 'Subject', 'BehaviorSubject', 'ReplaySubject', 'AsyncSubject'].includes(symbol.name)) {
|
127
|
+
// Replace the node with a call expression where the expression is an identifier with the name 'lastValueFrom'
|
128
|
+
return ts.factory.createCallExpression(ts.factory.createIdentifier('lastValueFrom'), undefined, [node.expression.expression]);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
return ts.visitEachChild(node, visit, context);
|
105
132
|
};
|
106
|
-
return
|
107
|
-
}
|
133
|
+
return (sourceFile) => ts.visitNode(sourceFile, visit);
|
134
|
+
};
|
108
135
|
}
|
109
|
-
exports.rxjs7Upgrade = rxjs7Upgrade;
|
110
136
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/components/schematics/ng-generate/rxjs-7-upgrade/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+CAAwE;AACxE,qEAA8F;AAC9F,iCAAiC;AACjC,+BAAkD;AAClD,mFAAmF;AAEnF,SAAgB,YAAY;IAC1B,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,iBAAU,CAAC,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QAEzE,sEAAsE;QACtE,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACxD,6HAA6H;QAC7H,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEnD,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;YACnC,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;YAC9D,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/components/schematics/ng-generate/rxjs-7-upgrade/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+CAAwE;AACxE,qEAA8F;AAC9F,iCAAiC;AACjC,+BAAkD;AAClD,mFAAmF;AAEnF,SAAgB,YAAY;IAC1B,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,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