@bemedev/codebase 0.1.2 → 0.2.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/README.md +8 -8
- package/lib/_virtual/_rolldown/runtime.cjs +23 -0
- package/lib/analyse.cjs +48 -62
- package/lib/analyse.cjs.map +1 -1
- package/lib/analyse.d.ts +21 -3
- package/lib/analyse.js +45 -60
- package/lib/analyse.js.map +1 -1
- package/lib/analyse.utils.cjs +154 -205
- package/lib/analyse.utils.cjs.map +1 -1
- package/lib/analyse.utils.d.ts +1 -2
- package/lib/analyse.utils.js +153 -203
- package/lib/analyse.utils.js.map +1 -1
- package/lib/cli/cli.cjs +28 -27
- package/lib/cli/cli.cjs.map +1 -1
- package/lib/cli/cli.d.ts +0 -1
- package/lib/cli/cli.js +25 -24
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/constants.cjs +6 -5
- package/lib/cli/constants.cjs.map +1 -1
- package/lib/cli/constants.d.ts +0 -1
- package/lib/cli/constants.js +5 -3
- package/lib/cli/constants.js.map +1 -1
- package/lib/cli/index.cjs +6 -6
- package/lib/cli/index.cjs.map +1 -1
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js +7 -4
- package/lib/cli/index.js.map +1 -1
- package/lib/constants.cjs +26 -28
- package/lib/constants.cjs.map +1 -1
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +24 -26
- package/lib/constants.js.map +1 -1
- package/lib/exports.cjs +51 -72
- package/lib/exports.cjs.map +1 -1
- package/lib/exports.d.ts +1 -2
- package/lib/exports.js +49 -70
- package/lib/exports.js.map +1 -1
- package/lib/functions/add.cjs +71 -84
- package/lib/functions/add.cjs.map +1 -1
- package/lib/functions/add.d.ts +1 -2
- package/lib/functions/add.js +68 -82
- package/lib/functions/add.js.map +1 -1
- package/lib/functions/generate.cjs +53 -56
- package/lib/functions/generate.cjs.map +1 -1
- package/lib/functions/generate.d.ts +1 -2
- package/lib/functions/generate.js +51 -54
- package/lib/functions/generate.js.map +1 -1
- package/lib/functions/index.cjs +11 -16
- package/lib/functions/index.d.ts +0 -1
- package/lib/functions/index.js +5 -5
- package/lib/functions/init.cjs +68 -97
- package/lib/functions/init.cjs.map +1 -1
- package/lib/functions/init.d.ts +1 -2
- package/lib/functions/init.js +66 -95
- package/lib/functions/init.js.map +1 -1
- package/lib/functions/remove.cjs +85 -103
- package/lib/functions/remove.cjs.map +1 -1
- package/lib/functions/remove.d.ts +1 -2
- package/lib/functions/remove.js +82 -101
- package/lib/functions/remove.js.map +1 -1
- package/lib/helpers.cjs +32 -38
- package/lib/helpers.cjs.map +1 -1
- package/lib/helpers.d.ts +3 -4
- package/lib/helpers.js +30 -36
- package/lib/helpers.js.map +1 -1
- package/lib/imports.cjs +88 -118
- package/lib/imports.cjs.map +1 -1
- package/lib/imports.d.ts +2 -3
- package/lib/imports.js +86 -116
- package/lib/imports.js.map +1 -1
- package/lib/index.cjs +22 -24
- package/lib/index.d.ts +4 -4
- package/lib/index.js +8 -6
- package/lib/schemas.cjs +53 -63
- package/lib/schemas.cjs.map +1 -1
- package/lib/schemas.d.ts +5 -2
- package/lib/schemas.js +43 -35
- package/lib/schemas.js.map +1 -1
- package/lib/types.d.ts +0 -1
- package/lib/utils.cjs +9 -10
- package/lib/utils.cjs.map +1 -1
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +8 -8
- package/lib/utils.js.map +1 -1
- package/package.json +56 -44
- package/CHANGE_LOG.md +0 -143
- package/lib/analyse.d.ts.map +0 -1
- package/lib/analyse.utils.d.ts.map +0 -1
- package/lib/cli/cli.d.ts.map +0 -1
- package/lib/cli/constants.d.ts.map +0 -1
- package/lib/cli/index.d.ts.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/exports.d.ts.map +0 -1
- package/lib/functions/add.d.ts.map +0 -1
- package/lib/functions/generate.d.ts.map +0 -1
- package/lib/functions/index.cjs.map +0 -1
- package/lib/functions/index.d.ts.map +0 -1
- package/lib/functions/index.js.map +0 -1
- package/lib/functions/init.d.ts.map +0 -1
- package/lib/functions/remove.d.ts.map +0 -1
- package/lib/helpers.d.ts.map +0 -1
- package/lib/imports.d.ts.map +0 -1
- package/lib/index.cjs.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/schemas.d.ts.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/utils.d.ts.map +0 -1
package/lib/analyse.utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
//#region src/analyse.utils.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
* Génère un JSDoc pour une expression exportée générée automatiquement
|
|
4
|
+
*/
|
|
4
5
|
const generateJSDoc = (exportName, declarationKind) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* ${exportName}${kindText} - Auto-generated expression
|
|
6
|
+
return `/**
|
|
7
|
+
* ${exportName}${declarationKind ? ` ${declarationKind}` : ""} - Auto-generated expression
|
|
8
8
|
*
|
|
9
9
|
* ⚠️ WARNING: This expression is auto-generated and should not be modified.
|
|
10
10
|
* Any manual changes will be overwritten during the next generation.
|
|
@@ -15,218 +15,168 @@ const generateJSDoc = (exportName, declarationKind) => {
|
|
|
15
15
|
*/`;
|
|
16
16
|
};
|
|
17
17
|
const extractExportDetails = (trimmedLine) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
declarationKind = 'type';
|
|
63
|
-
}
|
|
64
|
-
else if (trimmedLine.includes('export enum ')) {
|
|
65
|
-
const match = trimmedLine.match(/export enum (\w+)/);
|
|
66
|
-
exportName = match ? match[1] : 'enum';
|
|
67
|
-
declarationKind = 'enum';
|
|
68
|
-
}
|
|
69
|
-
return { exportName, declarationKind };
|
|
18
|
+
let exportName = "export";
|
|
19
|
+
let declarationKind;
|
|
20
|
+
if (trimmedLine.includes("export default ")) {
|
|
21
|
+
exportName = "default";
|
|
22
|
+
if (trimmedLine.includes("function")) declarationKind = "function";
|
|
23
|
+
else if (trimmedLine.includes("class")) declarationKind = "class";
|
|
24
|
+
else declarationKind = "value";
|
|
25
|
+
} else if (trimmedLine.includes("export const ")) {
|
|
26
|
+
const match = trimmedLine.match(/export const (\w+)/);
|
|
27
|
+
exportName = match ? match[1] : "const";
|
|
28
|
+
declarationKind = "variable";
|
|
29
|
+
} else if (trimmedLine.includes("export let ")) {
|
|
30
|
+
const match = trimmedLine.match(/export let (\w+)/);
|
|
31
|
+
exportName = match ? match[1] : "let";
|
|
32
|
+
declarationKind = "variable";
|
|
33
|
+
} else if (trimmedLine.includes("export var ")) {
|
|
34
|
+
const match = trimmedLine.match(/export var (\w+)/);
|
|
35
|
+
exportName = match ? match[1] : "var";
|
|
36
|
+
declarationKind = "variable";
|
|
37
|
+
} else if (trimmedLine.includes("export function ")) {
|
|
38
|
+
const match = trimmedLine.match(/export function (\w+)/);
|
|
39
|
+
exportName = match ? match[1] : "function";
|
|
40
|
+
declarationKind = "function";
|
|
41
|
+
} else if (trimmedLine.includes("export class ")) {
|
|
42
|
+
const match = trimmedLine.match(/export class (\w+)/);
|
|
43
|
+
exportName = match ? match[1] : "class";
|
|
44
|
+
declarationKind = "class";
|
|
45
|
+
} else if (trimmedLine.includes("export interface ")) {
|
|
46
|
+
const match = trimmedLine.match(/export interface (\w+)/);
|
|
47
|
+
exportName = match ? match[1] : "interface";
|
|
48
|
+
declarationKind = "interface";
|
|
49
|
+
} else if (trimmedLine.includes("export type ")) {
|
|
50
|
+
const match = trimmedLine.match(/export type (\w+)/);
|
|
51
|
+
exportName = match ? match[1] : "type";
|
|
52
|
+
declarationKind = "type";
|
|
53
|
+
} else if (trimmedLine.includes("export enum ")) {
|
|
54
|
+
const match = trimmedLine.match(/export enum (\w+)/);
|
|
55
|
+
exportName = match ? match[1] : "enum";
|
|
56
|
+
declarationKind = "enum";
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
exportName,
|
|
60
|
+
declarationKind
|
|
61
|
+
};
|
|
70
62
|
};
|
|
71
63
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
* Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export
|
|
65
|
+
*/
|
|
74
66
|
const hasDeclaration = (exportLine) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'export default function ',
|
|
96
|
-
'export default class ',
|
|
97
|
-
'export default interface ',
|
|
98
|
-
'export default enum ',
|
|
99
|
-
'export default const ',
|
|
100
|
-
'export default let ',
|
|
101
|
-
'export default var ',
|
|
102
|
-
];
|
|
103
|
-
return keywords.some(kw => trimmed.includes(kw));
|
|
67
|
+
const trimmed = exportLine.trim();
|
|
68
|
+
if (trimmed.startsWith("export {") || trimmed.startsWith("export *") || trimmed.includes("} from ") || trimmed.match(/^export\s+\{[^}]*\}\s*;?\s*$/) || trimmed.match(/^export\s+default\s+[a-zA-Z_$][a-zA-Z0-9_$]*\s*;?\s*$/)) return false;
|
|
69
|
+
return [
|
|
70
|
+
"export const ",
|
|
71
|
+
"export let ",
|
|
72
|
+
"export var ",
|
|
73
|
+
"export function ",
|
|
74
|
+
"export class ",
|
|
75
|
+
"export interface ",
|
|
76
|
+
"export type ",
|
|
77
|
+
"export enum ",
|
|
78
|
+
"export namespace ",
|
|
79
|
+
"export default function ",
|
|
80
|
+
"export default class ",
|
|
81
|
+
"export default interface ",
|
|
82
|
+
"export default enum ",
|
|
83
|
+
"export default const ",
|
|
84
|
+
"export default let ",
|
|
85
|
+
"export default var "
|
|
86
|
+
].some((kw) => trimmed.includes(kw));
|
|
104
87
|
};
|
|
105
88
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
* Extrait le nom d'une déclaration (const, function, etc.)
|
|
90
|
+
*/
|
|
108
91
|
const extractDeclarationName = (line) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
92
|
+
const trimmed = line.trim();
|
|
93
|
+
if (trimmed.startsWith("const ")) {
|
|
94
|
+
const match = trimmed.match(/const\s+(\w+)/);
|
|
95
|
+
return match ? match[1] : null;
|
|
96
|
+
}
|
|
97
|
+
if (trimmed.startsWith("function ")) {
|
|
98
|
+
const match = trimmed.match(/function\s+(\w+)/);
|
|
99
|
+
return match ? match[1] : null;
|
|
100
|
+
}
|
|
101
|
+
if (trimmed.startsWith("class ")) {
|
|
102
|
+
const match = trimmed.match(/class\s+(\w+)/);
|
|
103
|
+
return match ? match[1] : null;
|
|
104
|
+
}
|
|
105
|
+
if (trimmed.startsWith("interface ")) {
|
|
106
|
+
const match = trimmed.match(/interface\s+(\w+)/);
|
|
107
|
+
return match ? match[1] : null;
|
|
108
|
+
}
|
|
109
|
+
if (trimmed.startsWith("type ")) {
|
|
110
|
+
const match = trimmed.match(/type\s+(\w+)/);
|
|
111
|
+
return match ? match[1] : null;
|
|
112
|
+
}
|
|
113
|
+
if (trimmed.startsWith("enum ")) {
|
|
114
|
+
const match = trimmed.match(/enum\s+(\w+)/);
|
|
115
|
+
return match ? match[1] : null;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
135
118
|
};
|
|
136
119
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
* Vérifie si une déclaration est exportée plus tard dans le fichier
|
|
121
|
+
*/
|
|
139
122
|
const isExportedLater = (lines, declarationName) => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
trimmed.includes(`export * as ${declarationName}`));
|
|
145
|
-
});
|
|
123
|
+
return lines.some((line) => {
|
|
124
|
+
const trimmed = line.trim();
|
|
125
|
+
return trimmed === `export default ${declarationName};` || trimmed.includes(`export { ${declarationName}`) || trimmed.includes(`export * as ${declarationName}`);
|
|
126
|
+
});
|
|
146
127
|
};
|
|
147
128
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
* Détermine le type de déclaration
|
|
130
|
+
*/
|
|
150
131
|
const getDeclarationKind = (line) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return 'class';
|
|
162
|
-
if (trimmed.startsWith('interface '))
|
|
163
|
-
return 'interface';
|
|
164
|
-
if (trimmed.startsWith('type '))
|
|
165
|
-
return 'type';
|
|
166
|
-
if (trimmed.startsWith('enum '))
|
|
167
|
-
return 'enum';
|
|
168
|
-
return 'variable';
|
|
132
|
+
const trimmed = line.trim();
|
|
133
|
+
if (trimmed.startsWith("const ")) return "const";
|
|
134
|
+
if (trimmed.startsWith("let ")) return "let";
|
|
135
|
+
if (trimmed.startsWith("var ")) return "var";
|
|
136
|
+
if (trimmed.startsWith("function ")) return "function";
|
|
137
|
+
if (trimmed.startsWith("class ")) return "class";
|
|
138
|
+
if (trimmed.startsWith("interface ")) return "interface";
|
|
139
|
+
if (trimmed.startsWith("type ")) return "type";
|
|
140
|
+
if (trimmed.startsWith("enum ")) return "enum";
|
|
141
|
+
return "variable";
|
|
169
142
|
};
|
|
170
143
|
/**
|
|
171
|
-
|
|
172
|
-
|
|
144
|
+
* Ajoute des JSDoc aux expressions exportées dans le texte source
|
|
145
|
+
*/
|
|
173
146
|
const addJSDocToSourceText = (sourceFile) => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
trimmedLine.startsWith('type ') ||
|
|
206
|
-
trimmedLine.startsWith('enum '))) {
|
|
207
|
-
// Vérifier si cette déclaration est exportée plus tard dans le fichier
|
|
208
|
-
const declarationName = extractDeclarationName(trimmedLine);
|
|
209
|
-
if (declarationName && isExportedLater(lines, declarationName)) {
|
|
210
|
-
// Calculer la position dans le texte original
|
|
211
|
-
const position = lines.slice(0, lineIndex).join('\n').length +
|
|
212
|
-
(lineIndex > 0 ? 1 : 0);
|
|
213
|
-
const declarationKind = getDeclarationKind(trimmedLine);
|
|
214
|
-
const jsdoc = generateJSDoc(declarationName, declarationKind);
|
|
215
|
-
insertions.push({ position, jsdoc: `${jsdoc}\n` });
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
// Trier par position décroissante pour insérer de la fin vers le début
|
|
220
|
-
insertions.sort((a, b) => b.position - a.position);
|
|
221
|
-
// Insérer les JSDoc
|
|
222
|
-
for (const insertion of insertions) {
|
|
223
|
-
modifiedText =
|
|
224
|
-
modifiedText.slice(0, insertion.position) +
|
|
225
|
-
insertion.jsdoc +
|
|
226
|
-
modifiedText.slice(insertion.position);
|
|
227
|
-
}
|
|
228
|
-
return modifiedText;
|
|
147
|
+
const fullText = sourceFile.getText();
|
|
148
|
+
const imports = sourceFile.getImportDeclarations().map((importDecl) => importDecl.getText());
|
|
149
|
+
let modifiedText = fullText.replace(imports.join("\n"), "").trimStart();
|
|
150
|
+
const insertions = [];
|
|
151
|
+
const lines = modifiedText.split("\n");
|
|
152
|
+
lines.forEach((line, lineIndex) => {
|
|
153
|
+
const trimmedLine = line.trim();
|
|
154
|
+
if (trimmedLine.startsWith("export ") && hasDeclaration(trimmedLine)) {
|
|
155
|
+
const position = lines.slice(0, lineIndex).join("\n").length + (lineIndex > 0 ? 1 : 0);
|
|
156
|
+
const { exportName, declarationKind } = extractExportDetails(trimmedLine);
|
|
157
|
+
const jsdoc = generateJSDoc(exportName, declarationKind);
|
|
158
|
+
insertions.push({
|
|
159
|
+
position,
|
|
160
|
+
jsdoc: `${jsdoc}\n`
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (!trimmedLine.startsWith("export ") && (trimmedLine.startsWith("const ") || trimmedLine.startsWith("function ") || trimmedLine.startsWith("class ") || trimmedLine.startsWith("interface ") || trimmedLine.startsWith("type ") || trimmedLine.startsWith("enum "))) {
|
|
164
|
+
const declarationName = extractDeclarationName(trimmedLine);
|
|
165
|
+
if (declarationName && isExportedLater(lines, declarationName)) {
|
|
166
|
+
const position = lines.slice(0, lineIndex).join("\n").length + (lineIndex > 0 ? 1 : 0);
|
|
167
|
+
const jsdoc = generateJSDoc(declarationName, getDeclarationKind(trimmedLine));
|
|
168
|
+
insertions.push({
|
|
169
|
+
position,
|
|
170
|
+
jsdoc: `${jsdoc}\n`
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
insertions.sort((a, b) => b.position - a.position);
|
|
176
|
+
for (const insertion of insertions) modifiedText = modifiedText.slice(0, insertion.position) + insertion.jsdoc + modifiedText.slice(insertion.position);
|
|
177
|
+
return modifiedText;
|
|
229
178
|
};
|
|
230
|
-
|
|
179
|
+
//#endregion
|
|
231
180
|
export { addJSDocToSourceText, extractDeclarationName, extractExportDetails, generateJSDoc, getDeclarationKind, hasDeclaration, isExportedLater };
|
|
232
|
-
|
|
181
|
+
|
|
182
|
+
//# sourceMappingURL=analyse.utils.js.map
|
package/lib/analyse.utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyse.utils.js","sources":["../src/analyse.utils.ts"],"sourcesContent":["import type { SourceFile } from 'ts-morph';\n\n/**\n * Génère un JSDoc pour une expression exportée générée automatiquement\n */\nexport const generateJSDoc = (\n exportName: string,\n declarationKind?: string,\n): string => {\n const kindText = declarationKind ? ` ${declarationKind}` : '';\n return `/**\n * ${exportName}${kindText} - Auto-generated expression\n * \n * ⚠️ WARNING: This expression is auto-generated and should not be modified.\n * Any manual changes will be overwritten during the next generation.\n * \n * @generated\n * @readonly\n * @author chlbri (bri_lvi@icloud.com)\n */`;\n};\n\nexport const extractExportDetails = (trimmedLine: string) => {\n let exportName = 'export';\n let declarationKind: string | undefined;\n\n if (trimmedLine.includes('export default ')) {\n exportName = 'default';\n if (trimmedLine.includes('function')) declarationKind = 'function';\n else if (trimmedLine.includes('class')) declarationKind = 'class';\n else declarationKind = 'value';\n } else if (trimmedLine.includes('export const ')) {\n const match = trimmedLine.match(/export const (\\w+)/);\n exportName = match ? match[1] : 'const';\n declarationKind = 'variable';\n } else if (trimmedLine.includes('export let ')) {\n const match = trimmedLine.match(/export let (\\w+)/);\n exportName = match ? match[1] : 'let';\n declarationKind = 'variable';\n } else if (trimmedLine.includes('export var ')) {\n const match = trimmedLine.match(/export var (\\w+)/);\n exportName = match ? match[1] : 'var';\n declarationKind = 'variable';\n } else if (trimmedLine.includes('export function ')) {\n const match = trimmedLine.match(/export function (\\w+)/);\n exportName = match ? match[1] : 'function';\n declarationKind = 'function';\n } else if (trimmedLine.includes('export class ')) {\n const match = trimmedLine.match(/export class (\\w+)/);\n exportName = match ? match[1] : 'class';\n declarationKind = 'class';\n } else if (trimmedLine.includes('export interface ')) {\n const match = trimmedLine.match(/export interface (\\w+)/);\n exportName = match ? match[1] : 'interface';\n declarationKind = 'interface';\n } else if (trimmedLine.includes('export type ')) {\n const match = trimmedLine.match(/export type (\\w+)/);\n exportName = match ? match[1] : 'type';\n declarationKind = 'type';\n } else if (trimmedLine.includes('export enum ')) {\n const match = trimmedLine.match(/export enum (\\w+)/);\n exportName = match ? match[1] : 'enum';\n declarationKind = 'enum';\n }\n return { exportName, declarationKind };\n};\n\n/**\n * Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export\n */\nexport const hasDeclaration = (exportLine: string): boolean => {\n const trimmed = exportLine.trim();\n const falsy =\n trimmed.startsWith('export {') || // export { something }\n trimmed.startsWith('export *') || // export * from\n trimmed.includes('} from ') || // export { a, b } from\n trimmed.match(/^export\\s+\\{[^}]*\\}\\s*;?\\s*$/) || // export { a, b };\n trimmed.match(/^export\\s+default\\s+[a-zA-Z_$][a-zA-Z0-9_$]*\\s*;?\\s*$/); // export default identifier;\n\n // Re-exports et exports simples à exclure\n if (falsy) return false;\n\n // Déclarations à inclure (avec mots-clés de déclaration)\n const keywords = [\n 'export const ',\n 'export let ',\n 'export var ',\n 'export function ',\n 'export class ',\n 'export interface ',\n 'export type ',\n 'export enum ',\n 'export namespace ',\n 'export default function ',\n 'export default class ',\n 'export default interface ',\n 'export default enum ',\n 'export default const ',\n 'export default let ',\n 'export default var ',\n ];\n\n return keywords.some(kw => trimmed.includes(kw));\n};\n\n/**\n * Extrait le nom d'une déclaration (const, function, etc.)\n */\nexport const extractDeclarationName = (line: string): string | null => {\n const trimmed = line.trim();\n\n if (trimmed.startsWith('const ')) {\n const match = trimmed.match(/const\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith('function ')) {\n const match = trimmed.match(/function\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith('class ')) {\n const match = trimmed.match(/class\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith('interface ')) {\n const match = trimmed.match(/interface\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith('type ')) {\n const match = trimmed.match(/type\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith('enum ')) {\n const match = trimmed.match(/enum\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n\n return null;\n};\n\n/**\n * Vérifie si une déclaration est exportée plus tard dans le fichier\n */\nexport const isExportedLater = (\n lines: string[],\n declarationName: string,\n): boolean => {\n return lines.some(line => {\n const trimmed = line.trim();\n return (\n trimmed === `export default ${declarationName};` ||\n trimmed.includes(`export { ${declarationName}`) ||\n trimmed.includes(`export * as ${declarationName}`)\n );\n });\n};\n\n/**\n * Détermine le type de déclaration\n */\nexport const getDeclarationKind = (line: string): string => {\n const trimmed = line.trim();\n\n if (trimmed.startsWith('const ')) return 'const';\n if (trimmed.startsWith('let ')) return 'let';\n if (trimmed.startsWith('var ')) return 'var';\n if (trimmed.startsWith('function ')) return 'function';\n if (trimmed.startsWith('class ')) return 'class';\n if (trimmed.startsWith('interface ')) return 'interface';\n if (trimmed.startsWith('type ')) return 'type';\n if (trimmed.startsWith('enum ')) return 'enum';\n\n return 'variable';\n};\n\n/**\n * Ajoute des JSDoc aux expressions exportées dans le texte source\n */\nexport const addJSDocToSourceText = (sourceFile: SourceFile): string => {\n // Obtenir le texte sans les imports dès le début\n const fullText = sourceFile.getText();\n const imports = sourceFile\n .getImportDeclarations()\n .map(importDecl => importDecl.getText());\n\n const linesWithoutImports = fullText\n .replace(imports.join('\\n'), '')\n .trimStart();\n\n let modifiedText = linesWithoutImports;\n\n // Collecter toutes les positions d'insertion avec leurs JSDoc\n const insertions: Array<{ position: number; jsdoc: string }> = [];\n\n // Une approche plus simple : analyser le texte directement pour trouver les exports\n const lines = modifiedText.split('\\n');\n\n lines.forEach((line, lineIndex) => {\n const trimmedLine = line.trim();\n\n // Détecter les lignes qui commencent par export ET contiennent une déclaration\n if (trimmedLine.startsWith('export ') && hasDeclaration(trimmedLine)) {\n // Calculer la position dans le texte original\n const position =\n lines.slice(0, lineIndex).join('\\n').length +\n (lineIndex > 0 ? 1 : 0);\n\n // Déterminer le nom et le type d'export\n const { exportName, declarationKind } =\n extractExportDetails(trimmedLine);\n\n const jsdoc = generateJSDoc(exportName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n\n // Détecter les déclarations internes (const, function, etc.) qui sont ensuite exportées\n if (\n !trimmedLine.startsWith('export ') &&\n (trimmedLine.startsWith('const ') ||\n trimmedLine.startsWith('function ') ||\n trimmedLine.startsWith('class ') ||\n trimmedLine.startsWith('interface ') ||\n trimmedLine.startsWith('type ') ||\n trimmedLine.startsWith('enum '))\n ) {\n // Vérifier si cette déclaration est exportée plus tard dans le fichier\n const declarationName = extractDeclarationName(trimmedLine);\n if (declarationName && isExportedLater(lines, declarationName)) {\n // Calculer la position dans le texte original\n const position =\n lines.slice(0, lineIndex).join('\\n').length +\n (lineIndex > 0 ? 1 : 0);\n\n const declarationKind = getDeclarationKind(trimmedLine);\n const jsdoc = generateJSDoc(declarationName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n }\n });\n\n // Trier par position décroissante pour insérer de la fin vers le début\n insertions.sort((a, b) => b.position - a.position);\n\n // Insérer les JSDoc\n for (const insertion of insertions) {\n modifiedText =\n modifiedText.slice(0, insertion.position) +\n insertion.jsdoc +\n modifiedText.slice(insertion.position);\n }\n\n return modifiedText;\n};\n"],"names":[],"mappings":"AAEA;;AAEG;MACU,aAAa,GAAG,CAC3B,UAAkB,EAClB,eAAwB,KACd;AACV,IAAA,MAAM,QAAQ,GAAG,eAAe,GAAG,CAAA,CAAA,EAAI,eAAe,CAAA,CAAE,GAAG,EAAE;IAC7D,OAAO,CAAA;AACJ,GAAA,EAAA,UAAU,GAAG,QAAQ,CAAA;;;;;;;;IAQtB;AACJ;AAEO,MAAM,oBAAoB,GAAG,CAAC,WAAmB,KAAI;IAC1D,IAAI,UAAU,GAAG,QAAQ;AACzB,IAAA,IAAI,eAAmC;AAEvC,IAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QAC3C,UAAU,GAAG,SAAS;AACtB,QAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,eAAe,GAAG,UAAU;AAC7D,aAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,eAAe,GAAG,OAAO;;YAC5D,eAAe,GAAG,OAAO;IAChC;AAAO,SAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QAChD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC;AACrD,QAAA,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO;QACvC,eAAe,GAAG,UAAU;IAC9B;AAAO,SAAA,IAAI,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QAC9C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC;AACnD,QAAA,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK;QACrC,eAAe,GAAG,UAAU;IAC9B;AAAO,SAAA,IAAI,WAAW,CAAC,QAA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CAAC,EAClC;;AAEA,YAAA,MAAM,eAAe,GAAG,sBAAsB,CAAC,WAAW,CAAC;YAC3D,IAAI,eAAe,IAAI,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE;;AAE9D,gBAAA,MAAM,QAAQ,GACZ,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM;AAC3C,qBAAC,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEzB,gBAAA,MAAM,eAAe,GAAG,kBAAkB,CAAC,WAAW,CAAC;gBACvD,MAAM,KAAK,GAAG,aAAa,CAAC,eAAe,EAAE,eAAe,CAAC;AAC7D,gBAAA,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA,EAAG,KAAK,CAAA,EAAA,CAAI,EAAE,CAAC;YACpD;QACF;AACF,IAAA,CAAC,CAAC;;AAGF,IAAA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;;AAGlD,IAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,YAAY;YACV,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC;AACzC,gBAAA,SAAS,CAAC,KAAK;AACf,gBAAA,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC1C;AAEA,IAAA,OAAO,YAAY;AACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"analyse.utils.js","names":[],"sources":["../src/analyse.utils.ts"],"sourcesContent":["import type { SourceFile } from \"ts-morph\";\n\n/**\n * Génère un JSDoc pour une expression exportée générée automatiquement\n */\nexport const generateJSDoc = (\n exportName: string,\n declarationKind?: string,\n): string => {\n const kindText = declarationKind ? ` ${declarationKind}` : \"\";\n return `/**\n * ${exportName}${kindText} - Auto-generated expression\n * \n * ⚠️ WARNING: This expression is auto-generated and should not be modified.\n * Any manual changes will be overwritten during the next generation.\n * \n * @generated\n * @readonly\n * @author chlbri (bri_lvi@icloud.com)\n */`;\n};\n\nexport const extractExportDetails = (trimmedLine: string) => {\n let exportName = \"export\";\n let declarationKind: string | undefined;\n\n if (trimmedLine.includes(\"export default \")) {\n exportName = \"default\";\n if (trimmedLine.includes(\"function\")) declarationKind = \"function\";\n else if (trimmedLine.includes(\"class\")) declarationKind = \"class\";\n else declarationKind = \"value\";\n } else if (trimmedLine.includes(\"export const \")) {\n const match = trimmedLine.match(/export const (\\w+)/);\n exportName = match ? match[1] : \"const\";\n declarationKind = \"variable\";\n } else if (trimmedLine.includes(\"export let \")) {\n const match = trimmedLine.match(/export let (\\w+)/);\n exportName = match ? match[1] : \"let\";\n declarationKind = \"variable\";\n } else if (trimmedLine.includes(\"export var \")) {\n const match = trimmedLine.match(/export var (\\w+)/);\n exportName = match ? match[1] : \"var\";\n declarationKind = \"variable\";\n } else if (trimmedLine.includes(\"export function \")) {\n const match = trimmedLine.match(/export function (\\w+)/);\n exportName = match ? match[1] : \"function\";\n declarationKind = \"function\";\n } else if (trimmedLine.includes(\"export class \")) {\n const match = trimmedLine.match(/export class (\\w+)/);\n exportName = match ? match[1] : \"class\";\n declarationKind = \"class\";\n } else if (trimmedLine.includes(\"export interface \")) {\n const match = trimmedLine.match(/export interface (\\w+)/);\n exportName = match ? match[1] : \"interface\";\n declarationKind = \"interface\";\n } else if (trimmedLine.includes(\"export type \")) {\n const match = trimmedLine.match(/export type (\\w+)/);\n exportName = match ? match[1] : \"type\";\n declarationKind = \"type\";\n } else if (trimmedLine.includes(\"export enum \")) {\n const match = trimmedLine.match(/export enum (\\w+)/);\n exportName = match ? match[1] : \"enum\";\n declarationKind = \"enum\";\n }\n return { exportName, declarationKind };\n};\n\n/**\n * Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export\n */\nexport const hasDeclaration = (exportLine: string): boolean => {\n const trimmed = exportLine.trim();\n const falsy =\n trimmed.startsWith(\"export {\") || // export { something }\n trimmed.startsWith(\"export *\") || // export * from\n trimmed.includes(\"} from \") || // export { a, b } from\n trimmed.match(/^export\\s+\\{[^}]*\\}\\s*;?\\s*$/) || // export { a, b };\n trimmed.match(/^export\\s+default\\s+[a-zA-Z_$][a-zA-Z0-9_$]*\\s*;?\\s*$/); // export default identifier;\n\n // Re-exports et exports simples à exclure\n if (falsy) return false;\n\n // Déclarations à inclure (avec mots-clés de déclaration)\n const keywords = [\n \"export const \",\n \"export let \",\n \"export var \",\n \"export function \",\n \"export class \",\n \"export interface \",\n \"export type \",\n \"export enum \",\n \"export namespace \",\n \"export default function \",\n \"export default class \",\n \"export default interface \",\n \"export default enum \",\n \"export default const \",\n \"export default let \",\n \"export default var \",\n ];\n\n return keywords.some((kw) => trimmed.includes(kw));\n};\n\n/**\n * Extrait le nom d'une déclaration (const, function, etc.)\n */\nexport const extractDeclarationName = (line: string): string | null => {\n const trimmed = line.trim();\n\n if (trimmed.startsWith(\"const \")) {\n const match = trimmed.match(/const\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith(\"function \")) {\n const match = trimmed.match(/function\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith(\"class \")) {\n const match = trimmed.match(/class\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith(\"interface \")) {\n const match = trimmed.match(/interface\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith(\"type \")) {\n const match = trimmed.match(/type\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n if (trimmed.startsWith(\"enum \")) {\n const match = trimmed.match(/enum\\s+(\\w+)/);\n return match ? match[1] : null;\n }\n\n return null;\n};\n\n/**\n * Vérifie si une déclaration est exportée plus tard dans le fichier\n */\nexport const isExportedLater = (\n lines: string[],\n declarationName: string,\n): boolean => {\n return lines.some((line) => {\n const trimmed = line.trim();\n return (\n trimmed === `export default ${declarationName};` ||\n trimmed.includes(`export { ${declarationName}`) ||\n trimmed.includes(`export * as ${declarationName}`)\n );\n });\n};\n\n/**\n * Détermine le type de déclaration\n */\nexport const getDeclarationKind = (line: string): string => {\n const trimmed = line.trim();\n\n if (trimmed.startsWith(\"const \")) return \"const\";\n if (trimmed.startsWith(\"let \")) return \"let\";\n if (trimmed.startsWith(\"var \")) return \"var\";\n if (trimmed.startsWith(\"function \")) return \"function\";\n if (trimmed.startsWith(\"class \")) return \"class\";\n if (trimmed.startsWith(\"interface \")) return \"interface\";\n if (trimmed.startsWith(\"type \")) return \"type\";\n if (trimmed.startsWith(\"enum \")) return \"enum\";\n\n return \"variable\";\n};\n\n/**\n * Ajoute des JSDoc aux expressions exportées dans le texte source\n */\nexport const addJSDocToSourceText = (sourceFile: SourceFile): string => {\n // Obtenir le texte sans les imports dès le début\n const fullText = sourceFile.getText();\n const imports = sourceFile\n .getImportDeclarations()\n .map((importDecl) => importDecl.getText());\n\n const linesWithoutImports = fullText\n .replace(imports.join(\"\\n\"), \"\")\n .trimStart();\n\n let modifiedText = linesWithoutImports;\n\n // Collecter toutes les positions d'insertion avec leurs JSDoc\n const insertions: Array<{ position: number; jsdoc: string }> = [];\n\n // Une approche plus simple : analyser le texte directement pour trouver les exports\n const lines = modifiedText.split(\"\\n\");\n\n lines.forEach((line, lineIndex) => {\n const trimmedLine = line.trim();\n\n // Détecter les lignes qui commencent par export ET contiennent une déclaration\n if (trimmedLine.startsWith(\"export \") && hasDeclaration(trimmedLine)) {\n // Calculer la position dans le texte original\n const position =\n lines.slice(0, lineIndex).join(\"\\n\").length + (lineIndex > 0 ? 1 : 0);\n\n // Déterminer le nom et le type d'export\n const { exportName, declarationKind } = extractExportDetails(trimmedLine);\n\n const jsdoc = generateJSDoc(exportName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n\n // Détecter les déclarations internes (const, function, etc.) qui sont ensuite exportées\n if (\n !trimmedLine.startsWith(\"export \") &&\n (trimmedLine.startsWith(\"const \") ||\n trimmedLine.startsWith(\"function \") ||\n trimmedLine.startsWith(\"class \") ||\n trimmedLine.startsWith(\"interface \") ||\n trimmedLine.startsWith(\"type \") ||\n trimmedLine.startsWith(\"enum \"))\n ) {\n // Vérifier si cette déclaration est exportée plus tard dans le fichier\n const declarationName = extractDeclarationName(trimmedLine);\n if (declarationName && isExportedLater(lines, declarationName)) {\n // Calculer la position dans le texte original\n const position =\n lines.slice(0, lineIndex).join(\"\\n\").length + (lineIndex > 0 ? 1 : 0);\n\n const declarationKind = getDeclarationKind(trimmedLine);\n const jsdoc = generateJSDoc(declarationName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n }\n });\n\n // Trier par position décroissante pour insérer de la fin vers le début\n insertions.sort((a, b) => b.position - a.position);\n\n // Insérer les JSDoc\n for (const insertion of insertions) {\n modifiedText =\n modifiedText.slice(0, insertion.position) +\n insertion.jsdoc +\n modifiedText.slice(insertion.position);\n }\n\n return modifiedText;\n};\n"],"mappings":";;;;AAKA,MAAa,iBACX,YACA,oBACW;AAEX,QAAO;KACJ,aAFc,kBAAkB,IAAI,oBAAoB,GAElC;;;;;;;;;;AAW3B,MAAa,wBAAwB,gBAAwB;CAC3D,IAAI,aAAa;CACjB,IAAI;AAEJ,KAAI,YAAY,SAAS,kBAAkB,EAAE;AAC3C,eAAa;AACb,MAAI,YAAY,SAAS,WAAW,CAAE,mBAAkB;WAC/C,YAAY,SAAS,QAAQ,CAAE,mBAAkB;MACrD,mBAAkB;YACd,YAAY,SAAS,gBAAgB,EAAE;EAChD,MAAM,QAAQ,YAAY,MAAM,qBAAqB;AACrD,eAAa,QAAQ,MAAM,KAAK;AAChC,oBAAkB;YACT,YAAY,SAAS,cAAc,EAAE;EAC9C,MAAM,QAAQ,YAAY,MAAM,mBAAmB;AACnD,eAAa,QAAQ,MAAM,KAAK;AAChC,oBAAkB;YACT,YAAY,SAAS,cAAc,EAAE;EAC9C,MAAM,QAAQ,YA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Aa,MAAM,UAAU,SAAS;AAG1C,QAAO"}
|
package/lib/cli/cli.cjs
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const cli =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_constants = require("../constants.cjs");
|
|
4
|
+
const require_functions_generate = require("../functions/generate.cjs");
|
|
5
|
+
let cmd_ts = require("cmd-ts");
|
|
6
|
+
//#region src/cli/cli.ts
|
|
7
|
+
const cli = (0, cmd_ts.command)({
|
|
8
|
+
name: "generate",
|
|
9
|
+
args: {
|
|
10
|
+
output: (0, cmd_ts.option)({
|
|
11
|
+
long: "output",
|
|
12
|
+
short: "o",
|
|
13
|
+
type: cmd_ts.string,
|
|
14
|
+
description: "Output file path",
|
|
15
|
+
defaultValue: () => require_constants.CODEBASE_FILE
|
|
16
|
+
}),
|
|
17
|
+
excludes: (0, cmd_ts.multioption)({
|
|
18
|
+
description: "The files to exclude, globs",
|
|
19
|
+
long: "excludes",
|
|
20
|
+
short: "x",
|
|
21
|
+
type: (0, cmd_ts.array)(cmd_ts.string),
|
|
22
|
+
defaultValue: () => []
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
handler: require_functions_generate.generate
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
//#endregion
|
|
28
28
|
exports.cli = cli;
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=cli.cjs.map
|
package/lib/cli/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["string","CODEBASE_FILE"],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"mappings":";;;;;;AAIA,MAAa,OAAA,GAAA,OAAA,SAAc;CACzB,MAAM;CAEN,MAAM;EACJ,SAAA,GAAA,OAAA,QAAe;GACb,MAAM;GACN,OAAO;GACP,MAAMA,OAAAA;GACN,aAAa;GACb,oBAAoBC,kBAAAA;GACrB,CAAC;EACF,WAAA,GAAA,OAAA,aAAsB;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,OAAA,GAAA,OAAA,OAAYD,OAAAA,OAAO;GACnB,oBAAoB,EAAE;GACvB,CAAC;EACH;CACD,SAAA,2BAAA;CACD,CAAC"}
|
package/lib/cli/cli.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export declare const cli: Partial<import("cmd-ts/dist/cjs/argparser").Register>
|
|
|
9
9
|
}, boolean> & {
|
|
10
10
|
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<boolean>>;
|
|
11
11
|
} & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned & import("cmd-ts/dist/cjs/helpdoc").Descriptive & import("cmd-ts/dist/cjs/helpdoc").Aliased>;
|
|
12
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/lib/cli/cli.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { CODEBASE_FILE } from "../constants.js";
|
|
2
|
+
import { generate } from "../functions/generate.js";
|
|
3
|
+
import { array, command, multioption, option, string } from "cmd-ts";
|
|
4
|
+
//#region src/cli/cli.ts
|
|
5
5
|
const cli = command({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
name: "generate",
|
|
7
|
+
args: {
|
|
8
|
+
output: option({
|
|
9
|
+
long: "output",
|
|
10
|
+
short: "o",
|
|
11
|
+
type: string,
|
|
12
|
+
description: "Output file path",
|
|
13
|
+
defaultValue: () => CODEBASE_FILE
|
|
14
|
+
}),
|
|
15
|
+
excludes: multioption({
|
|
16
|
+
description: "The files to exclude, globs",
|
|
17
|
+
long: "excludes",
|
|
18
|
+
short: "x",
|
|
19
|
+
type: array(string),
|
|
20
|
+
defaultValue: () => []
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
handler: generate
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
//#endregion
|
|
26
26
|
export { cli };
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=cli.js.map
|
package/lib/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"mappings":";;;;AAIA,MAAa,MAAM,QAAQ;CACzB,MAAM;CAEN,MAAM;EACJ,QAAQ,OAAO;GACb,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,oBAAoB;GACrB,CAAC;EACF,UAAU,YAAY;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,MAAM,MAAM,OAAO;GACnB,oBAAoB,EAAE;GACvB,CAAC;EACH;CACD,SAAA;CACD,CAAC"}
|
package/lib/cli/constants.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const BIN =
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/cli/constants.ts
|
|
3
|
+
const BIN = "codebase";
|
|
4
|
+
//#endregion
|
|
5
5
|
exports.BIN = BIN;
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../src/cli/constants.ts"],"sourcesContent":["export const BIN = 'codebase';\n"],"
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../src/cli/constants.ts"],"sourcesContent":["export const BIN = 'codebase';\n"],"mappings":";;AAAA,MAAa,MAAM"}
|