@suseejs/duplicates 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +14 -0
- package/dist/index.cjs +579 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.mjs +574 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
// cSpell:disable
|
|
43
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
44
|
+
var node_path_1 = __importDefault(require("node:path"));
|
|
45
|
+
var transformer_1 = __importDefault(require("@suseejs/transformer"));
|
|
46
|
+
var resolves_1 = __importDefault(require("@phothinmaung/resolves"));
|
|
47
|
+
/**
|
|
48
|
+
* Returns an object with methods to generate unique names based on a prefix.
|
|
49
|
+
* The `setPrefix` method sets a prefix for the generated names.
|
|
50
|
+
* The `getName` method generates a unique name based on the prefix and an input string.
|
|
51
|
+
* The `getPrefix` method returns the prefix associated with a key.
|
|
52
|
+
* If a prefix is set multiple times, an error will be thrown.
|
|
53
|
+
*/
|
|
54
|
+
function uniqueName() {
|
|
55
|
+
var storedPrefix = new Map();
|
|
56
|
+
var obj = {
|
|
57
|
+
setPrefix: function (_a) {
|
|
58
|
+
var key = _a.key, value = _a.value;
|
|
59
|
+
var names = [];
|
|
60
|
+
var _fix;
|
|
61
|
+
if (storedPrefix.has(key)) {
|
|
62
|
+
console.warn("".concat(key, " already exist"));
|
|
63
|
+
throw new Error();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
_fix = value;
|
|
67
|
+
storedPrefix.set(key, value);
|
|
68
|
+
}
|
|
69
|
+
function getName(input) {
|
|
70
|
+
var length = names.length;
|
|
71
|
+
var _name = _fix
|
|
72
|
+
? "".concat(_fix).concat(input, "_").concat(length + 1)
|
|
73
|
+
: "$nyein".concat(input, "_").concat(length + 1);
|
|
74
|
+
names.push(_name);
|
|
75
|
+
return _name;
|
|
76
|
+
}
|
|
77
|
+
return { getName: getName };
|
|
78
|
+
},
|
|
79
|
+
getPrefix: function (key) {
|
|
80
|
+
if (storedPrefix.has(key)) {
|
|
81
|
+
return storedPrefix.get(key);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
var dupName = uniqueName().setPrefix({
|
|
88
|
+
key: "DuplicatesNames",
|
|
89
|
+
value: "d_",
|
|
90
|
+
});
|
|
91
|
+
var normalizePathKey = function (filePath) {
|
|
92
|
+
var parsed = node_path_1.default.parse(filePath);
|
|
93
|
+
var noExt = node_path_1.default.join(parsed.dir, parsed.name);
|
|
94
|
+
if (parsed.name === "index") {
|
|
95
|
+
noExt = parsed.dir;
|
|
96
|
+
}
|
|
97
|
+
return node_path_1.default.normalize(noExt);
|
|
98
|
+
};
|
|
99
|
+
var getFileKey = function (filePath) { return normalizePathKey(filePath); };
|
|
100
|
+
var getModuleKeyFromSpecifier = function (moduleSpecifier, sourceFile, containingFile) {
|
|
101
|
+
var spec = "";
|
|
102
|
+
if (typescript_1.default.isStringLiteral(moduleSpecifier)) {
|
|
103
|
+
spec = moduleSpecifier.text;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
spec = moduleSpecifier.getText(sourceFile).replace(/^['"]|['"]$/g, "");
|
|
107
|
+
}
|
|
108
|
+
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
109
|
+
var baseDir = node_path_1.default.dirname(containingFile);
|
|
110
|
+
return normalizePathKey(node_path_1.default.resolve(baseDir, spec));
|
|
111
|
+
}
|
|
112
|
+
return spec;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* A bundle handler that transforms call expression in a given source file.
|
|
116
|
+
* @param callNameMap - A mapping of base names to new names for call expressions.
|
|
117
|
+
* @param importNameMap - A mapping of base names to new names for import expressions.
|
|
118
|
+
* @param compilerOptions - The compiler options for the TypeScript compiler.
|
|
119
|
+
* @return A new source file with transformed call expressions.
|
|
120
|
+
*/
|
|
121
|
+
var callExpression = function (callNameMap, importNameMap, compilerOptions) {
|
|
122
|
+
return function (_a) {
|
|
123
|
+
var file = _a.file, content = _a.content;
|
|
124
|
+
var sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
125
|
+
var transformer = function (context) {
|
|
126
|
+
var factory = context.factory;
|
|
127
|
+
var visitor = function (node) {
|
|
128
|
+
if (typescript_1.default.isCallExpression(node)) {
|
|
129
|
+
if (typescript_1.default.isIdentifier(node.expression)) {
|
|
130
|
+
var base_1 = node.expression.text;
|
|
131
|
+
var new_name = null;
|
|
132
|
+
var mapping = callNameMap.find(function (m) { return m.base === base_1 && m.file === file; });
|
|
133
|
+
var importMapping = importNameMap.find(function (m) { return m.base === base_1 && m.file === file; });
|
|
134
|
+
if (mapping) {
|
|
135
|
+
new_name = mapping.newName;
|
|
136
|
+
}
|
|
137
|
+
else if (importMapping) {
|
|
138
|
+
new_name = importMapping.newName;
|
|
139
|
+
//flag.push(new_name);
|
|
140
|
+
}
|
|
141
|
+
if (new_name) {
|
|
142
|
+
return factory.updateCallExpression(node, factory.createIdentifier(new_name), node.typeArguments, node.arguments);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else if (typescript_1.default.isPropertyAccessExpression(node)) {
|
|
147
|
+
if (typescript_1.default.isIdentifier(node.expression)) {
|
|
148
|
+
var base_2 = node.expression.text;
|
|
149
|
+
var new_name = null;
|
|
150
|
+
var mapping = callNameMap.find(function (m) { return m.base === base_2 && m.file === file; });
|
|
151
|
+
var importMapping = importNameMap.find(function (m) { return m.base === base_2 && m.file === file; });
|
|
152
|
+
if (mapping) {
|
|
153
|
+
new_name = mapping.newName;
|
|
154
|
+
}
|
|
155
|
+
else if (importMapping) {
|
|
156
|
+
new_name = importMapping.newName;
|
|
157
|
+
}
|
|
158
|
+
if (new_name) {
|
|
159
|
+
return factory.updatePropertyAccessExpression(node, factory.createIdentifier(new_name), node.name);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else if (typescript_1.default.isNewExpression(node)) {
|
|
164
|
+
if (typescript_1.default.isIdentifier(node.expression)) {
|
|
165
|
+
var base_3 = node.expression.text;
|
|
166
|
+
var new_name = null;
|
|
167
|
+
var mapping = callNameMap.find(function (m) { return m.base === base_3 && m.file === file; });
|
|
168
|
+
var importMapping = importNameMap.find(function (m) { return m.base === base_3 && m.file === file; });
|
|
169
|
+
if (mapping) {
|
|
170
|
+
new_name = mapping.newName;
|
|
171
|
+
}
|
|
172
|
+
else if (importMapping) {
|
|
173
|
+
new_name = importMapping.newName;
|
|
174
|
+
}
|
|
175
|
+
if (new_name) {
|
|
176
|
+
return factory.updateNewExpression(node, factory.createIdentifier(new_name), node.typeArguments, node.arguments);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/* ----------------------Returns for visitor function------------------------------- */
|
|
181
|
+
return typescript_1.default.visitEachChild(node, visitor, context);
|
|
182
|
+
}; // visitor;
|
|
183
|
+
/* --------------------Returns for transformer function--------------------------------- */
|
|
184
|
+
return function (rootNode) { return typescript_1.default.visitNode(rootNode, visitor); };
|
|
185
|
+
}; // transformer;
|
|
186
|
+
/* --------------------Returns for main handler function--------------------------------- */
|
|
187
|
+
var _content = (0, transformer_1.default)(transformer, sourceFile, compilerOptions);
|
|
188
|
+
return { file: file, content: _content };
|
|
189
|
+
}; // returns
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* A bundle handler that renames the exported expression according to the given maps.
|
|
193
|
+
* It will traverse the given source file and rename the exported expression if a mapping is found.
|
|
194
|
+
*
|
|
195
|
+
* @param callNameMap - A map of base names to new names for function calls.
|
|
196
|
+
* @param importNameMap - A map of base names to new names for import expressions.
|
|
197
|
+
* @param exportNameMap - A map of base names to new names for export expressions.
|
|
198
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
199
|
+
* @returns A bundle handler that takes a source file and returns a new source file with the renamed exported expressions.
|
|
200
|
+
*/
|
|
201
|
+
var exportExpression = function (callNameMap, importNameMap, exportNameMap, compilerOptions) {
|
|
202
|
+
return function (_a) {
|
|
203
|
+
var file = _a.file, content = _a.content;
|
|
204
|
+
var sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
205
|
+
var transformer = function (context) {
|
|
206
|
+
var factory = context.factory;
|
|
207
|
+
var visitor = function (node) {
|
|
208
|
+
if (typescript_1.default.isExportSpecifier(node)) {
|
|
209
|
+
if (typescript_1.default.isIdentifier(node.name)) {
|
|
210
|
+
var base_4 = node.name.text;
|
|
211
|
+
var new_name = null;
|
|
212
|
+
var mapping = callNameMap.find(function (m) { return m.base === base_4 && m.file === file; });
|
|
213
|
+
var importMapping = importNameMap.find(function (m) { return m.base === base_4 && m.file === file; });
|
|
214
|
+
if (mapping) {
|
|
215
|
+
exportNameMap.push({
|
|
216
|
+
base: base_4,
|
|
217
|
+
file: getFileKey(file),
|
|
218
|
+
newName: mapping.newName,
|
|
219
|
+
});
|
|
220
|
+
new_name = mapping.newName;
|
|
221
|
+
}
|
|
222
|
+
else if (importMapping) {
|
|
223
|
+
new_name = importMapping.newName;
|
|
224
|
+
}
|
|
225
|
+
if (new_name) {
|
|
226
|
+
return factory.updateExportSpecifier(node, node.isTypeOnly, node.propertyName, factory.createIdentifier(new_name));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else if (typescript_1.default.isExportAssignment(node)) {
|
|
231
|
+
var expr = node.expression;
|
|
232
|
+
if (typescript_1.default.isIdentifier(expr)) {
|
|
233
|
+
var base_5 = expr.text;
|
|
234
|
+
var new_name = null;
|
|
235
|
+
var mapping = callNameMap.find(function (m) { return m.base === base_5 && m.file === file; });
|
|
236
|
+
var importMapping = importNameMap.find(function (m) { return m.base === base_5 && m.file === file; });
|
|
237
|
+
if (mapping) {
|
|
238
|
+
exportNameMap.push({
|
|
239
|
+
base: base_5,
|
|
240
|
+
file: getFileKey(file),
|
|
241
|
+
newName: mapping.newName,
|
|
242
|
+
});
|
|
243
|
+
new_name = mapping.newName;
|
|
244
|
+
}
|
|
245
|
+
else if (importMapping) {
|
|
246
|
+
new_name = importMapping.newName;
|
|
247
|
+
}
|
|
248
|
+
if (new_name) {
|
|
249
|
+
return factory.updateExportAssignment(node, node.modifiers, factory.createIdentifier(new_name));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/* ----------------------Returns for visitor function------------------------------- */
|
|
254
|
+
return typescript_1.default.visitEachChild(node, visitor, context);
|
|
255
|
+
}; // visitor;
|
|
256
|
+
/* --------------------Returns for transformer function--------------------------------- */
|
|
257
|
+
return function (rootNode) { return typescript_1.default.visitNode(rootNode, visitor); };
|
|
258
|
+
}; // transformer;
|
|
259
|
+
/* --------------------Returns for main handler function--------------------------------- */
|
|
260
|
+
var _content = (0, transformer_1.default)(transformer, sourceFile, compilerOptions);
|
|
261
|
+
return { file: file, content: _content };
|
|
262
|
+
}; // returns
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* A bundle handler that transforms import expressions in a given source file.
|
|
266
|
+
* @param exportNameMap - A mapping of base names to new names for export expressions.
|
|
267
|
+
* @param importNameMap - A mapping of base names to new names for import expressions.
|
|
268
|
+
* @param compilerOptions - The compiler options for the TypeScript compiler.
|
|
269
|
+
* @return A new source file with transformed import expressions.
|
|
270
|
+
*/
|
|
271
|
+
var importExpression = function (exportNameMap, importNameMap, compilerOptions) {
|
|
272
|
+
return function (_a) {
|
|
273
|
+
var file = _a.file, content = _a.content;
|
|
274
|
+
var sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
275
|
+
var transformer = function (context) {
|
|
276
|
+
var factory = context.factory;
|
|
277
|
+
var visitor = function (node) {
|
|
278
|
+
var _a, _b;
|
|
279
|
+
if (typescript_1.default.isImportDeclaration(node)) {
|
|
280
|
+
var moduleKey_1 = getModuleKeyFromSpecifier(node.moduleSpecifier, sourceFile, file);
|
|
281
|
+
var baseNames = [];
|
|
282
|
+
if (((_a = node.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) &&
|
|
283
|
+
typescript_1.default.isNamedImports(node.importClause.namedBindings)) {
|
|
284
|
+
baseNames = node.importClause.namedBindings.elements.map(function (el) {
|
|
285
|
+
return el.name.text.trim();
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
// import default expression
|
|
289
|
+
if (((_b = node.importClause) === null || _b === void 0 ? void 0 : _b.name) &&
|
|
290
|
+
typescript_1.default.isIdentifier(node.importClause.name)) {
|
|
291
|
+
var base_6 = node.importClause.name.text.trim();
|
|
292
|
+
var mapping = exportNameMap.find(function (m) { return m.base === base_6 && m.file === moduleKey_1; });
|
|
293
|
+
if (mapping) {
|
|
294
|
+
importNameMap.push({
|
|
295
|
+
base: mapping.base,
|
|
296
|
+
file: file,
|
|
297
|
+
newName: mapping.newName,
|
|
298
|
+
});
|
|
299
|
+
var newImportClause = factory.updateImportClause(node.importClause, node.importClause.phaseModifier, factory.createIdentifier(mapping.newName), node.importClause.namedBindings);
|
|
300
|
+
return factory.updateImportDeclaration(node, node.modifiers, newImportClause, node.moduleSpecifier, node.attributes);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
// import name , `import{ ... }`
|
|
304
|
+
if (baseNames.length > 0 &&
|
|
305
|
+
node.importClause &&
|
|
306
|
+
node.importClause.namedBindings &&
|
|
307
|
+
typescript_1.default.isNamedImports(node.importClause.namedBindings)) {
|
|
308
|
+
var updatedElements = node.importClause.namedBindings.elements.map(function (el) {
|
|
309
|
+
var mapping = exportNameMap.find(function (m) { return m.base === el.name.text.trim() && m.file === moduleKey_1; });
|
|
310
|
+
if (mapping) {
|
|
311
|
+
importNameMap.push({
|
|
312
|
+
base: mapping.base,
|
|
313
|
+
file: file,
|
|
314
|
+
newName: mapping.newName,
|
|
315
|
+
});
|
|
316
|
+
return factory.updateImportSpecifier(el, el.isTypeOnly, el.propertyName, factory.createIdentifier(mapping.newName));
|
|
317
|
+
}
|
|
318
|
+
return el;
|
|
319
|
+
});
|
|
320
|
+
var newNamedImports = factory.updateNamedImports(node.importClause.namedBindings, updatedElements);
|
|
321
|
+
var newImportClause = factory.updateImportClause(node.importClause, node.importClause.phaseModifier, node.importClause.name, newNamedImports);
|
|
322
|
+
return factory.updateImportDeclaration(node, node.modifiers, newImportClause, node.moduleSpecifier, node.attributes);
|
|
323
|
+
}
|
|
324
|
+
} //&&
|
|
325
|
+
/* ----------------------Returns for visitor function------------------------------- */
|
|
326
|
+
return typescript_1.default.visitEachChild(node, visitor, context);
|
|
327
|
+
}; // visitor;
|
|
328
|
+
/* --------------------Returns for transformer function--------------------------------- */
|
|
329
|
+
return function (rootNode) { return typescript_1.default.visitNode(rootNode, visitor); };
|
|
330
|
+
}; // transformer;
|
|
331
|
+
/* --------------------Returns for main handler function--------------------------------- */
|
|
332
|
+
var _content = (0, transformer_1.default)(transformer, sourceFile, compilerOptions);
|
|
333
|
+
return { file: file, content: _content };
|
|
334
|
+
}; // returns
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* A bundle handler that collects information about the usage of given names in a given source file.
|
|
338
|
+
* It will traverse the given source file and collect information about the usage of given names.
|
|
339
|
+
* The information will be stored in a namesMap.
|
|
340
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
341
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
342
|
+
* @return A new source file with collected information.
|
|
343
|
+
*/
|
|
344
|
+
var collector = function (namesMap, compilerOptions) {
|
|
345
|
+
return function (_a) {
|
|
346
|
+
var file = _a.file, content = _a.content;
|
|
347
|
+
var sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
348
|
+
var transformer = function (context) {
|
|
349
|
+
function visitNode(node, isGlobalScope) {
|
|
350
|
+
var _a;
|
|
351
|
+
if (isGlobalScope === void 0) { isGlobalScope = true; }
|
|
352
|
+
// Global declarations များကိုသာ collect လုပ်မယ်
|
|
353
|
+
if (isGlobalScope) {
|
|
354
|
+
// Variable statements (const, let, var)
|
|
355
|
+
if (typescript_1.default.isVariableStatement(node)) {
|
|
356
|
+
node.declarationList.declarations.forEach(function (decl) {
|
|
357
|
+
if (typescript_1.default.isIdentifier(decl.name)) {
|
|
358
|
+
var $name = decl.name.text;
|
|
359
|
+
if (!namesMap.has($name)) {
|
|
360
|
+
namesMap.set($name, new Set([{ file: file }]));
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// biome-ignore lint/style/noNonNullAssertion : !namesMap.has($name) before
|
|
364
|
+
namesMap.get($name).add({ file: file });
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
// Function, Class, Enum, Interface, Type declarations
|
|
370
|
+
else if (typescript_1.default.isFunctionDeclaration(node) ||
|
|
371
|
+
typescript_1.default.isClassDeclaration(node) ||
|
|
372
|
+
typescript_1.default.isEnumDeclaration(node) ||
|
|
373
|
+
typescript_1.default.isInterfaceDeclaration(node) ||
|
|
374
|
+
typescript_1.default.isTypeAliasDeclaration(node)) {
|
|
375
|
+
var $name = (_a = node.name) === null || _a === void 0 ? void 0 : _a.text;
|
|
376
|
+
if ($name) {
|
|
377
|
+
if (!namesMap.has($name)) {
|
|
378
|
+
namesMap.set($name, new Set([{ file: file }]));
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
// biome-ignore lint/style/noNonNullAssertion : !namesMap.has($name) before
|
|
382
|
+
namesMap.get($name).add({ file: file });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// Local scope ထဲရောက်သွားတဲ့ node တွေအတွက် recursive visit
|
|
388
|
+
if (typescript_1.default.isBlock(node) ||
|
|
389
|
+
typescript_1.default.isFunctionDeclaration(node) ||
|
|
390
|
+
typescript_1.default.isFunctionExpression(node) ||
|
|
391
|
+
typescript_1.default.isArrowFunction(node) ||
|
|
392
|
+
typescript_1.default.isMethodDeclaration(node) ||
|
|
393
|
+
typescript_1.default.isClassDeclaration(node)) {
|
|
394
|
+
// Local scope ထဲကို ဝင်သွားပြီဆိုတာနဲ့ isGlobalScope = false
|
|
395
|
+
if (typescript_1.default.isBlock(node)) {
|
|
396
|
+
typescript_1.default.visitNodes(node.statements, function (child) { return visitNode(child, false); });
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
typescript_1.default.forEachChild(node, function (child) {
|
|
400
|
+
visitNode(child, false);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
// Global scope ထဲဆက်ရှိနေတဲ့ node တွေအတွက်
|
|
406
|
+
return typescript_1.default.visitEachChild(node, function (child) { return visitNode(child, isGlobalScope); }, context);
|
|
407
|
+
}
|
|
408
|
+
/* ----------------------Returns for visitNode function------------------------------- */
|
|
409
|
+
return node;
|
|
410
|
+
} // visitNode
|
|
411
|
+
/* --------------------Returns for transformer function--------------------------------- */
|
|
412
|
+
return function (rootNode) { return visitNode(rootNode, true); };
|
|
413
|
+
}; // transformer;
|
|
414
|
+
/* --------------------Returns for main handler function--------------------------------- */
|
|
415
|
+
var _content = (0, transformer_1.default)(transformer, sourceFile, compilerOptions);
|
|
416
|
+
return { file: file, content: _content };
|
|
417
|
+
}; // returns
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* A bundle handler that updates the given source file based on the given namesMap and callNameMap.
|
|
421
|
+
* It will traverse the given source file and update the names of the exported expressions, call expressions, and import expressions if a mapping is found in the callNameMap.
|
|
422
|
+
* The updated source file will be returned.
|
|
423
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
424
|
+
* @param callNameMap - A map of base names to new names for call expressions.
|
|
425
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
426
|
+
* @returns A new source file with updated names.
|
|
427
|
+
*/
|
|
428
|
+
var updater = function (namesMap, callNameMap, compilerOptions) {
|
|
429
|
+
return function (_a) {
|
|
430
|
+
var file = _a.file, content = _a.content;
|
|
431
|
+
var sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
432
|
+
var transformer = function (context) {
|
|
433
|
+
var factory = context.factory;
|
|
434
|
+
var visitor = function (node) {
|
|
435
|
+
if (typescript_1.default.isVariableStatement(node)) {
|
|
436
|
+
var newDeclarations = node.declarationList.declarations.map(function (decl) {
|
|
437
|
+
if (typescript_1.default.isIdentifier(decl.name)) {
|
|
438
|
+
var base = decl.name.text;
|
|
439
|
+
// biome-ignore lint/style/noNonNullAssertion : namesMap.has(base) before that get just only size
|
|
440
|
+
if (namesMap.has(base) && namesMap.get(base).size > 1) {
|
|
441
|
+
var newName = dupName.getName(base);
|
|
442
|
+
callNameMap.push({ base: base, file: file, newName: newName });
|
|
443
|
+
return factory.updateVariableDeclaration(decl, factory.createIdentifier(newName), decl.exclamationToken, decl.type, decl.initializer);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return decl;
|
|
447
|
+
});
|
|
448
|
+
var newDeclList = factory.updateVariableDeclarationList(node.declarationList, newDeclarations);
|
|
449
|
+
return factory.updateVariableStatement(node, node.modifiers, newDeclList);
|
|
450
|
+
}
|
|
451
|
+
else if (typescript_1.default.isFunctionDeclaration(node)) {
|
|
452
|
+
if (node.name && typescript_1.default.isIdentifier(node.name)) {
|
|
453
|
+
var base = node.name.text;
|
|
454
|
+
// biome-ignore lint/style/noNonNullAssertion : namesMap.has(base) before that get just only size
|
|
455
|
+
if (namesMap.has(base) && namesMap.get(base).size > 1) {
|
|
456
|
+
var newName = dupName.getName(base);
|
|
457
|
+
callNameMap.push({ base: base, file: file, newName: newName });
|
|
458
|
+
return factory.updateFunctionDeclaration(node, node.modifiers, node.asteriskToken, factory.createIdentifier(newName), node.typeParameters, node.parameters, node.type, node.body);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
else if (typescript_1.default.isClassDeclaration(node)) {
|
|
463
|
+
if (node.name && typescript_1.default.isIdentifier(node.name)) {
|
|
464
|
+
var base = node.name.text;
|
|
465
|
+
// biome-ignore lint/style/noNonNullAssertion : namesMap.has(base) before that get just only size
|
|
466
|
+
if (namesMap.has(base) && namesMap.get(base).size > 1) {
|
|
467
|
+
var newName = dupName.getName(base);
|
|
468
|
+
callNameMap.push({ base: base, file: file, newName: newName });
|
|
469
|
+
return factory.updateClassDeclaration(node, node.modifiers, factory.createIdentifier(newName), node.typeParameters, node.heritageClauses, node.members);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/* ----------------------Returns for visitor function------------------------------- */
|
|
474
|
+
return typescript_1.default.visitEachChild(node, visitor, context);
|
|
475
|
+
}; // visitor;
|
|
476
|
+
/* --------------------Returns for transformer function--------------------------------- */
|
|
477
|
+
return function (rootNode) { return typescript_1.default.visitNode(rootNode, visitor); };
|
|
478
|
+
}; // transformer;
|
|
479
|
+
/* --------------------Returns for main handler function--------------------------------- */
|
|
480
|
+
var _content = (0, transformer_1.default)(transformer, sourceFile, compilerOptions);
|
|
481
|
+
return { file: file, content: _content };
|
|
482
|
+
}; // returns
|
|
483
|
+
};
|
|
484
|
+
var wait = function (time) {
|
|
485
|
+
return new Promise(function (resolve) { return setTimeout(resolve, time); });
|
|
486
|
+
};
|
|
487
|
+
var duplicateHandlers = {
|
|
488
|
+
/**
|
|
489
|
+
* A bundle handler that takes a list of source files and transforms them into renamed source files.
|
|
490
|
+
* The transformation is done in a series of steps, each step transforms the source files based on the given maps.
|
|
491
|
+
* The order of the steps is important, as it will determine the final output.
|
|
492
|
+
* @param deps - A list of source files to be transformed.
|
|
493
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
494
|
+
* @param callNameMap - A map of base names to new names for call expressions.
|
|
495
|
+
* @param importNameMap - A map of base names to new names for import expressions.
|
|
496
|
+
* @param exportNameMap - A map of base names to new names for export expressions.
|
|
497
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
498
|
+
* @returns A list of transformed source files.
|
|
499
|
+
*/
|
|
500
|
+
renamed: function (deps, namesMap, callNameMap, importNameMap, exportNameMap, compilerOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
501
|
+
var duplicates, duplicate, _i, duplicate_1, func;
|
|
502
|
+
return __generator(this, function (_a) {
|
|
503
|
+
switch (_a.label) {
|
|
504
|
+
case 0:
|
|
505
|
+
duplicates = (0, resolves_1.default)([
|
|
506
|
+
[collector, namesMap, compilerOptions],
|
|
507
|
+
[updater, namesMap, callNameMap, compilerOptions],
|
|
508
|
+
[callExpression, callNameMap, importNameMap, compilerOptions],
|
|
509
|
+
[
|
|
510
|
+
exportExpression,
|
|
511
|
+
callNameMap,
|
|
512
|
+
importNameMap,
|
|
513
|
+
exportNameMap,
|
|
514
|
+
compilerOptions,
|
|
515
|
+
],
|
|
516
|
+
[importExpression, exportNameMap, importNameMap, compilerOptions],
|
|
517
|
+
[callExpression, callNameMap, importNameMap, compilerOptions],
|
|
518
|
+
[
|
|
519
|
+
exportExpression,
|
|
520
|
+
callNameMap,
|
|
521
|
+
importNameMap,
|
|
522
|
+
exportNameMap,
|
|
523
|
+
compilerOptions,
|
|
524
|
+
],
|
|
525
|
+
]);
|
|
526
|
+
return [4 /*yield*/, duplicates.concurrent()];
|
|
527
|
+
case 1:
|
|
528
|
+
duplicate = _a.sent();
|
|
529
|
+
for (_i = 0, duplicate_1 = duplicate; _i < duplicate_1.length; _i++) {
|
|
530
|
+
func = duplicate_1[_i];
|
|
531
|
+
deps = deps.map(func);
|
|
532
|
+
}
|
|
533
|
+
return [2 /*return*/, deps];
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}); },
|
|
537
|
+
/**
|
|
538
|
+
* A bundle handler that takes a list of source files and checks if they have been renamed correctly.
|
|
539
|
+
* If a source file has not been renamed, an error will be thrown.
|
|
540
|
+
* @param deps - A list of source files to be checked.
|
|
541
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
542
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
543
|
+
* @returns A list of source files that have been renamed correctly.
|
|
544
|
+
*/
|
|
545
|
+
notRenamed: function (deps, namesMap, compilerOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
546
|
+
var _err, duplicates, duplicate;
|
|
547
|
+
return __generator(this, function (_a) {
|
|
548
|
+
switch (_a.label) {
|
|
549
|
+
case 0:
|
|
550
|
+
_err = false;
|
|
551
|
+
duplicates = (0, resolves_1.default)([[collector, namesMap, compilerOptions]]);
|
|
552
|
+
return [4 /*yield*/, duplicates.concurrent()];
|
|
553
|
+
case 1:
|
|
554
|
+
duplicate = _a.sent();
|
|
555
|
+
deps.map(duplicate[0]);
|
|
556
|
+
return [4 /*yield*/, wait(1000)];
|
|
557
|
+
case 2:
|
|
558
|
+
_a.sent();
|
|
559
|
+
namesMap.forEach(function (files, name) {
|
|
560
|
+
if (files.size > 1) {
|
|
561
|
+
_err = true;
|
|
562
|
+
console.warn("Name -> ".concat(name, " declared in multiple files :"));
|
|
563
|
+
// biome-ignore lint/suspicious/useIterableCallbackReturn : just log warn
|
|
564
|
+
files.forEach(function (f) { return console.warn(" - ".concat(f.file)); });
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
return [4 /*yield*/, wait(500)];
|
|
568
|
+
case 3:
|
|
569
|
+
_a.sent();
|
|
570
|
+
if (_err) {
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
return [2 /*return*/, deps];
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}); },
|
|
577
|
+
};
|
|
578
|
+
module.exports = duplicateHandlers;
|
|
579
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAiB;AACjB,0DAA4B;AAC5B,wDAA6B;AAE7B,qEAAqD;AACrD,oEAA8C;AAE9C;;;;;;GAMG;AACH,SAAS,UAAU;IACjB,IAAM,YAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEpD,IAAM,GAAG,GAAG;QACV,SAAS,YAAC,EAA8C;gBAA5C,GAAG,SAAA,EAAE,KAAK,WAAA;YACpB,IAAM,KAAK,GAAa,EAAE,CAAC;YAC3B,IAAI,IAAwB,CAAC;YAE7B,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC,UAAG,GAAG,mBAAgB,CAAC,CAAC;gBACrC,MAAM,IAAI,KAAK,EAAE,CAAC;YACpB,CAAC;iBAAM,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wBAC3B,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;4BACnB,IAAI,GAAG,IAAI,CAAC;4BACZ,OAAO,CAAC,IAAI,CAAC,kBAAW,IAAI,kCAA+B,CAAC,CAAC;4BAC7D,yEAAyE;4BACzE,KAAK,CAAC,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,cAAO,CAAC,CAAC,IAAI,CAAE,CAAC,EAA7B,CAA6B,CAAC,CAAC;wBACtD,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,qBAAM,IAAI,CAAC,GAAG,CAAC,EAAA;;oBAAf,SAAe,CAAC;oBAChB,IAAI,IAAI,EAAE,CAAC;wBACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClB,CAAC;oBACD,sBAAO,IAAI,EAAC;;;SACb;CACF,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type SuSee from "@suseejs/types";
|
|
3
|
+
declare const duplicateHandlers: {
|
|
4
|
+
/**
|
|
5
|
+
* A bundle handler that takes a list of source files and transforms them into renamed source files.
|
|
6
|
+
* The transformation is done in a series of steps, each step transforms the source files based on the given maps.
|
|
7
|
+
* The order of the steps is important, as it will determine the final output.
|
|
8
|
+
* @param deps - A list of source files to be transformed.
|
|
9
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
10
|
+
* @param callNameMap - A map of base names to new names for call expressions.
|
|
11
|
+
* @param importNameMap - A map of base names to new names for import expressions.
|
|
12
|
+
* @param exportNameMap - A map of base names to new names for export expressions.
|
|
13
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
14
|
+
* @returns A list of transformed source files.
|
|
15
|
+
*/
|
|
16
|
+
renamed: (deps: SuSee.DepsFile[], namesMap: SuSee.DuplicatesNameMap, callNameMap: SuSee.NamesSets, importNameMap: SuSee.NamesSets, exportNameMap: SuSee.NamesSets, compilerOptions: ts.CompilerOptions) => unknown;
|
|
17
|
+
/**
|
|
18
|
+
* A bundle handler that takes a list of source files and checks if they have been renamed correctly.
|
|
19
|
+
* If a source file has not been renamed, an error will be thrown.
|
|
20
|
+
* @param deps - A list of source files to be checked.
|
|
21
|
+
* @param namesMap - A map of base names to new names for function calls, import expressions, and export expressions.
|
|
22
|
+
* @param compilerOptions - The options for the TypeScript compiler.
|
|
23
|
+
* @returns A list of source files that have been renamed correctly.
|
|
24
|
+
*/
|
|
25
|
+
notRenamed: (deps: SuSee.DepsFile[], namesMap: SuSee.DuplicatesNameMap, compilerOptions: ts.CompilerOptions) => unknown;
|
|
26
|
+
};
|
|
27
|
+
export = duplicateHandlers;
|