@bemedev/codebase 0.3.0 → 1.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.
Files changed (100) hide show
  1. package/README.md +26 -13
  2. package/lib/analyse.cjs +10 -8
  3. package/lib/analyse.cjs.map +1 -1
  4. package/lib/analyse.d.ts +4 -3
  5. package/lib/analyse.d.ts.map +1 -0
  6. package/lib/analyse.js +9 -7
  7. package/lib/analyse.js.map +1 -1
  8. package/lib/analyse.utils.cjs +6 -6
  9. package/lib/analyse.utils.cjs.map +1 -1
  10. package/lib/analyse.utils.d.ts +8 -7
  11. package/lib/analyse.utils.d.ts.map +1 -0
  12. package/lib/analyse.utils.js +6 -6
  13. package/lib/analyse.utils.js.map +1 -1
  14. package/lib/cli/cli.cjs +2 -2
  15. package/lib/cli/cli.cjs.map +1 -1
  16. package/lib/cli/cli.d.ts +1 -0
  17. package/lib/cli/cli.d.ts.map +1 -0
  18. package/lib/cli/cli.js +2 -1
  19. package/lib/cli/cli.js.map +1 -1
  20. package/lib/cli/constants.d.ts +1 -0
  21. package/lib/cli/constants.d.ts.map +1 -0
  22. package/lib/cli/index.cjs +0 -1
  23. package/lib/cli/index.cjs.map +1 -1
  24. package/lib/cli/index.d.ts +1 -0
  25. package/lib/cli/index.d.ts.map +1 -0
  26. package/lib/cli/index.js +0 -0
  27. package/lib/cli/index.js.map +1 -1
  28. package/lib/config.cjs +12 -0
  29. package/lib/config.cjs.map +1 -0
  30. package/lib/config.d.ts +7 -0
  31. package/lib/config.d.ts.map +1 -0
  32. package/lib/config.js +11 -0
  33. package/lib/config.js.map +1 -0
  34. package/lib/constants.cjs +6 -5
  35. package/lib/constants.cjs.map +1 -1
  36. package/lib/constants.d.ts +4 -2
  37. package/lib/constants.d.ts.map +1 -0
  38. package/lib/constants.js +4 -3
  39. package/lib/constants.js.map +1 -1
  40. package/lib/exports.cjs +0 -1
  41. package/lib/exports.cjs.map +1 -1
  42. package/lib/exports.d.ts +1 -0
  43. package/lib/exports.d.ts.map +1 -0
  44. package/lib/exports.js.map +1 -1
  45. package/lib/functions/add.cjs +6 -5
  46. package/lib/functions/add.cjs.map +1 -1
  47. package/lib/functions/add.d.ts +2 -1
  48. package/lib/functions/add.d.ts.map +1 -0
  49. package/lib/functions/add.js +6 -5
  50. package/lib/functions/add.js.map +1 -1
  51. package/lib/functions/generate.cjs +5 -6
  52. package/lib/functions/generate.cjs.map +1 -1
  53. package/lib/functions/generate.d.ts +3 -2
  54. package/lib/functions/generate.d.ts.map +1 -0
  55. package/lib/functions/generate.js +5 -5
  56. package/lib/functions/generate.js.map +1 -1
  57. package/lib/functions/index.d.ts +1 -0
  58. package/lib/functions/index.d.ts.map +1 -0
  59. package/lib/functions/init.cjs +29 -16
  60. package/lib/functions/init.cjs.map +1 -1
  61. package/lib/functions/init.d.ts +6 -3
  62. package/lib/functions/init.d.ts.map +1 -0
  63. package/lib/functions/init.js +30 -16
  64. package/lib/functions/init.js.map +1 -1
  65. package/lib/functions/remove.cjs +11 -10
  66. package/lib/functions/remove.cjs.map +1 -1
  67. package/lib/functions/remove.d.ts +2 -1
  68. package/lib/functions/remove.d.ts.map +1 -0
  69. package/lib/functions/remove.js +11 -10
  70. package/lib/functions/remove.js.map +1 -1
  71. package/lib/helpers.cjs +1 -2
  72. package/lib/helpers.cjs.map +1 -1
  73. package/lib/helpers.d.ts +4 -3
  74. package/lib/helpers.d.ts.map +1 -0
  75. package/lib/helpers.js +1 -1
  76. package/lib/helpers.js.map +1 -1
  77. package/lib/imports.cjs +2 -3
  78. package/lib/imports.cjs.map +1 -1
  79. package/lib/imports.d.ts +4 -3
  80. package/lib/imports.d.ts.map +1 -0
  81. package/lib/imports.js +2 -2
  82. package/lib/imports.js.map +1 -1
  83. package/lib/index.cjs +2 -0
  84. package/lib/index.d.ts +6 -4
  85. package/lib/index.d.ts.map +1 -0
  86. package/lib/index.js +2 -1
  87. package/lib/schemas.cjs +1 -1
  88. package/lib/schemas.cjs.map +1 -1
  89. package/lib/schemas.d.ts +2 -1
  90. package/lib/schemas.d.ts.map +1 -0
  91. package/lib/schemas.js.map +1 -1
  92. package/lib/types.d.ts +1 -6
  93. package/lib/types.d.ts.map +1 -0
  94. package/lib/utils.cjs +2 -2
  95. package/lib/utils.cjs.map +1 -1
  96. package/lib/utils.d.ts +2 -1
  97. package/lib/utils.d.ts.map +1 -0
  98. package/lib/utils.js +2 -2
  99. package/lib/utils.js.map +1 -1
  100. package/package.json +43 -62
package/README.md CHANGED
@@ -51,16 +51,16 @@ pnpm add -D @bemedev/codebase
51
51
 
52
52
  ```bash
53
53
  # Basic analysis - generates a codebase.json file
54
- @bemedev/codebase
54
+ codebase
55
55
 
56
56
  # Specify a custom output file
57
- @bemedev/codebase --output my-analysis.json
57
+ codebase --output my-analysis.json
58
58
 
59
59
  # Exclude specific files
60
- @bemedev/codebase --exclude node_modules dist lib build
60
+ codebase --exclude node_modules dist lib build
61
61
 
62
62
  # Use short options
63
- @bemedev/codebase -o output.json node_modules dist
63
+ codebase -o output.json node_modules dist
64
64
  ```
65
65
 
66
66
  #### Available options
@@ -71,18 +71,31 @@ pnpm add -D @bemedev/codebase
71
71
  ### Programmatic API
72
72
 
73
73
  ```typescript
74
- import { generate, analyze } from "@bemedev/codebase";
74
+ import { generate, analyze } from '@bemedev/codebase';
75
75
 
76
76
  // Analyze the codebase
77
- const analysis = analyze("src");
77
+ const analysis = analyze({ src: 'src' });
78
78
 
79
79
  // Generate an analysis file
80
80
  await generate({
81
- output: "my-codebase.json",
82
- excludes: ["node_modules", "dist"],
81
+ output: 'my-codebase.json',
82
+ excludes: ['node_modules', 'dist'],
83
83
  });
84
84
  ```
85
85
 
86
+ ### Configuration
87
+
88
+ You can also customize the global configuration used by the programmatic
89
+ API:
90
+
91
+ ```typescript
92
+ import { config } from '@bemedev/codebase';
93
+
94
+ // Customize the configuration
95
+ config.json = '.my-custom-config.json';
96
+ config.tsConfigPath = '#custom/*';
97
+ ```
98
+
86
99
  ## 📊 Output format
87
100
 
88
101
  The generated JSON file contains:
@@ -114,7 +127,7 @@ src/
114
127
  │ ├── generate.ts # Generate analysis
115
128
  │ ├── init.ts # Initialization
116
129
  │ └── remove.ts # Removal
117
- ├── analyze.ts # Analysis engine
130
+ ├── analyse.ts # Analysis engine
118
131
  ├── types.ts # TypeScript definitions
119
132
  └── constants.ts # Global constants
120
133
  ```
@@ -140,13 +153,13 @@ pnpm dev
140
153
  ### Analyze a React project
141
154
 
142
155
  ```bash
143
- @bemedev/codebase -o react-analysis.json node_modules public build
156
+ codebase -o react-analysis.json node_modules public build
144
157
  ```
145
158
 
146
159
  ### Analyze a Node.js project
147
160
 
148
161
  ```bash
149
- @bemedev/codebase -o backend-analysis.json node_modules dist coverage
162
+ codebase -o backend-analysis.json node_modules dist coverage
150
163
  ```
151
164
 
152
165
  ### Integrate into an NPM script
@@ -154,8 +167,8 @@ pnpm dev
154
167
  ```json
155
168
  {
156
169
  "scripts": {
157
- "analyze": "@bemedev/codebase -o analysis/codebase.json",
158
- "analyze:clean": "@bemedev/codebase -o analysis/clean.json node_modules dist lib build"
170
+ "analyze": "codebase -o analysis/codebase.json",
171
+ "analyze:clean": "codebase -o analysis/clean.json node_modules dist lib build"
159
172
  }
160
173
  }
161
174
  ```
package/lib/analyse.cjs CHANGED
@@ -1,27 +1,29 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
3
3
  const require_utils = require("./utils.cjs");
4
- const require_constants = require("./constants.cjs");
5
4
  const require_schemas = require("./schemas.cjs");
6
5
  const require_analyse_utils = require("./analyse.utils.cjs");
7
6
  const require_exports = require("./exports.cjs");
8
7
  const require_helpers = require("./helpers.cjs");
9
8
  const require_imports = require("./imports.cjs");
10
9
  let valibot = require("valibot");
11
- valibot = require_runtime.__toESM(valibot);
10
+ valibot = require_runtime.__toESM(valibot, 1);
12
11
  let path = require("path");
13
12
  let ts_morph = require("ts-morph");
14
13
  //#region src/analyse.ts
15
14
  /**
16
- * Analyse tous les fichiers TypeScript dans src/ (sauf src/scripts/)
15
+ * Analyzes all TypeScript files in src/ (except src/scripts/)
17
16
  */
18
- const analyze = ({ src = require_constants.SRC_DIR, excludes: _excludes } = {}) => {
19
- console.log("🔍 Analyse du codebase en cours...");
17
+ const analyze = ({ src, excludes: _excludes }) => {
18
+ console.log("🔍 Codebase analysis in progress...");
20
19
  const excludes = require_helpers.toArray(_excludes);
21
20
  const sourceFiles = new ts_morph.Project({ tsConfigFilePath: (0, path.join)(process.cwd(), "tsconfig.json") }).addSourceFilesAtPaths([
22
21
  `${src}/**/*.ts`,
22
+ `${src}/**/*.tsx`,
23
23
  `!${src}/**/*.test.ts`,
24
- `!${src}/**/*.spec.ts`
24
+ `!${src}/**/*.test.tsx`,
25
+ `!${src}/**/*.spec.ts`,
26
+ `!${src}/**/*.spec.tsx`
25
27
  ].concat(excludes.map((exclude) => `!${exclude}`)));
26
28
  const analysis = {};
27
29
  let processedCount = 0;
@@ -43,9 +45,9 @@ ${_text}
43
45
  text
44
46
  };
45
47
  processedCount++;
46
- if (processedCount % 50 === 0) console.log(`📊 Analysé ${processedCount}/${sourceFiles.length} fichiers...`);
48
+ if (processedCount % 50 === 0) console.log(`📊 Analyzed ${processedCount}/${sourceFiles.length} files...`);
47
49
  }
48
- console.log(`✅ Analyse terminée: ${processedCount} fichiers analysés`);
50
+ console.log(`✅ Analysis completed: ${processedCount} files analyzed`);
49
51
  return valibot.parse(require_schemas.CodebaseAnalysisSchema, analysis);
50
52
  };
51
53
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"analyse.cjs","names":["SRC_DIR","toArray","Project","addJSDocToSourceText","analyzeImports","analyzeExports","buildImportStrings","pathToDotNotation","v","CodebaseAnalysisSchema"],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from \"path\";\nimport { Project } from \"ts-morph\";\nimport * as v from \"valibot\";\nimport { addJSDocToSourceText } from \"./analyse.utils\";\nimport { SRC_DIR } from \"./constants\";\nimport { analyzeExports } from \"./exports\";\nimport { toArray } from \"./helpers\";\nimport { analyzeImports, buildImportStrings } from \"./imports\";\nimport { CodebaseAnalysisSchema } from \"./schemas\";\nimport { pathToDotNotation } from \"./utils\";\n\nexport type AnalyzeOptions = {\n src?: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyse tous les fichiers TypeScript dans src/ (sauf src/scripts/)\n */\nexport const analyze = ({\n src = SRC_DIR,\n excludes: _excludes,\n}: AnalyzeOptions = {}) => {\n console.log(\"🔍 Analyse du codebase en cours...\");\n const excludes = toArray(_excludes);\n\n // Initialiser le projet ts-morph\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), \"tsconfig.json\"),\n });\n\n // Ajouter tous les fichiers TypeScript du dossier src\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `!${src}/**/*.test.ts`, // Exclude test files\n `!${src}/**/*.spec.ts`, // Exclude spec files\n ].concat(excludes.map((exclude) => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Générer le texte modifié avec JSDoc pour les exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyser les imports et exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Construire les imports à partir de fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combiner imports et contenu\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join(\"\\n\") : \"\";\n\n const text =\n importsSection === \"\"\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Afficher l'avancement de l'analyse par palliers de 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analysé ${processedCount}/${sourceFiles.length} fichiers...`,\n );\n }\n // #endregion\n }\n\n console.log(`✅ Analyse terminée: ${processedCount} fichiers analysés`);\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAa,WAAW,EACtB,MAAMA,kBAAAA,SACN,UAAU,cACQ,EAAE,KAAK;AACzB,SAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAWC,gBAAAA,QAAQ,UAAU;CAQnC,MAAM,cALU,IAAIC,SAAAA,QAAQ,EAC1B,mBAAA,GAAA,KAAA,MAAuB,QAAQ,KAAK,EAAE,gBAAgB,EACvD,CAAC,CAG0B,sBAC1B;EACE,GAAG,IAAI;EACP,IAAI,IAAI;EACR,IAAI,IAAI;EACT,CAAC,OAAO,SAAS,KAAK,YAAY,IAAI,UAAU,CAAC,CACnD;CAED,MAAM,WAAwD,EAAE;CAChE,IAAI,iBAAiB;AAErB,MAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,gBAAA,GAAA,KAAA,UAAwB,KADb,WAAW,aAAa,CACG;EAI5C,MAAM,QAAQC,sBAAAA,qBAAqB,WAAW;EAG9C,MAAM,UAAUC,gBAAAA,eAAe,WAAW;EAC1C,MAAM,UAAUC,gBAAAA,eAAe,WAAW;EAI1C,MAAM,iBAAiBC,gBAAAA,mBAAmB,QAAQ;EAGlD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,KAAK,GAAG;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;AAGJ,WAASC,cAAAA,kBAAkB,aAAa,IAAI;GAC1C;GACA;GACA;GACA;GACD;AAED;AAGA,MAAI,iBAAiB,OAAO,EAC1B,SAAQ,IACN,cAAc,eAAe,GAAG,YAAY,OAAO,cACpD;;AAKL,SAAQ,IAAI,uBAAuB,eAAe,oBAAoB;AACtE,QAAOC,QAAE,MAAMC,gBAAAA,wBAAwB,SAAS"}
1
+ {"version":3,"file":"analyse.cjs","names":["toArray","Project","addJSDocToSourceText","analyzeImports","analyzeExports","buildImportStrings","pathToDotNotation","v","CodebaseAnalysisSchema"],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { addJSDocToSourceText } from './analyse.utils';\nimport { analyzeExports } from './exports';\nimport { toArray } from './helpers';\nimport { analyzeImports, buildImportStrings } from './imports';\nimport { CodebaseAnalysisSchema } from './schemas';\nimport { pathToDotNotation } from './utils';\n\nexport type AnalyzeOptions = {\n src: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyzes all TypeScript files in src/ (except src/scripts/)\n */\nexport const analyze = ({\n src,\n excludes: _excludes,\n}: AnalyzeOptions) => {\n console.log('🔍 Codebase analysis in progress...');\n const excludes = toArray(_excludes);\n\n // Initialize the ts-morph project\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), 'tsconfig.json'),\n });\n\n // Add all TypeScript files from the src folder\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `${src}/**/*.tsx`,\n\n // #region Exclude test files\n `!${src}/**/*.test.ts`,\n `!${src}/**/*.test.tsx`,\n `!${src}/**/*.spec.ts`,\n `!${src}/**/*.spec.tsx`,\n // #endregion\n ].concat(excludes.map(exclude => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Generate modified text with JSDoc for exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyze imports and exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Build imports from fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combine imports and content\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join('\\n') : '';\n\n const text =\n importsSection === ''\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Display analysis progress in increments of 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analyzed ${processedCount}/${sourceFiles.length} files...`,\n );\n }\n // #endregion\n }\n\n console.log(\n `✅ Analysis completed: ${processedCount} files analyzed`,\n );\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,WAAW,EACtB,KACA,UAAU,gBACU;CACpB,QAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAWA,gBAAAA,QAAQ,SAAS;CAQlC,MAAM,cAAc,IALAC,SAAAA,QAAQ,EAC1B,mBAAA,GAAA,KAAA,KAAA,CAAuB,QAAQ,IAAI,GAAG,eAAe,EACvD,CAG0B,CAAC,CAAC,sBAC1B;EACE,GAAG,IAAI;EACP,GAAG,IAAI;EAGP,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;CAEV,CAAC,CAAC,OAAO,SAAS,KAAI,YAAW,IAAI,SAAS,CAAC,CACjD;CAEA,MAAM,WAAwD,CAAC;CAC/D,IAAI,iBAAiB;CAErB,KAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,gBAAA,GAAA,KAAA,SAAA,CAAwB,KADb,WAAW,YACc,CAAC;EAI3C,MAAM,QAAQC,sBAAAA,qBAAqB,UAAU;EAG7C,MAAM,UAAUC,gBAAAA,eAAe,UAAU;EACzC,MAAM,UAAUC,gBAAAA,eAAe,UAAU;EAIzC,MAAM,iBAAiBC,gBAAAA,mBAAmB,OAAO;EAGjD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,IAAI,IAAI;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;EAGJ,SAASC,cAAAA,kBAAkB,YAAY,KAAK;GAC1C;GACA;GACA;GACA;EACF;EAEA;EAGA,IAAI,iBAAiB,OAAO,GAC1B,QAAQ,IACN,eAAe,eAAe,GAAG,YAAY,OAAO,UACtD;CAGJ;CAEA,QAAQ,IACN,yBAAyB,eAAe,gBAC1C;CACA,OAAOC,QAAE,MAAMC,gBAAAA,wBAAwB,QAAQ;AACjD"}
package/lib/analyse.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export type AnalyzeOptions = {
2
- src?: string;
2
+ src: string;
3
3
  excludes?: string | string[];
4
4
  };
5
5
  /**
6
- * Analyse tous les fichiers TypeScript dans src/ (sauf src/scripts/)
6
+ * Analyzes all TypeScript files in src/ (except src/scripts/)
7
7
  */
8
- export declare const analyze: ({ src, excludes: _excludes, }?: AnalyzeOptions) => {
8
+ export declare const analyze: ({ src, excludes: _excludes, }: AnalyzeOptions) => {
9
9
  [x: string]: {
10
10
  relativePath: string;
11
11
  imports: {
@@ -26,3 +26,4 @@ export declare const analyze: ({ src, excludes: _excludes, }?: AnalyzeOptions) =
26
26
  text: string;
27
27
  };
28
28
  };
29
+ //# sourceMappingURL=analyse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyse.d.ts","sourceRoot":"","sources":["../src/analyse.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,+BAGrB,cAAc;;;;;;;;;;;;;;;;;;;;CA6EhB,CAAC"}
package/lib/analyse.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { pathToDotNotation } from "./utils.js";
2
- import { SRC_DIR } from "./constants.js";
3
2
  import { CodebaseAnalysisSchema } from "./schemas.js";
4
3
  import { addJSDocToSourceText } from "./analyse.utils.js";
5
4
  import { analyzeExports } from "./exports.js";
@@ -10,15 +9,18 @@ import { join, relative } from "path";
10
9
  import { Project } from "ts-morph";
11
10
  //#region src/analyse.ts
12
11
  /**
13
- * Analyse tous les fichiers TypeScript dans src/ (sauf src/scripts/)
12
+ * Analyzes all TypeScript files in src/ (except src/scripts/)
14
13
  */
15
- const analyze = ({ src = SRC_DIR, excludes: _excludes } = {}) => {
16
- console.log("🔍 Analyse du codebase en cours...");
14
+ const analyze = ({ src, excludes: _excludes }) => {
15
+ console.log("🔍 Codebase analysis in progress...");
17
16
  const excludes = toArray(_excludes);
18
17
  const sourceFiles = new Project({ tsConfigFilePath: join(process.cwd(), "tsconfig.json") }).addSourceFilesAtPaths([
19
18
  `${src}/**/*.ts`,
19
+ `${src}/**/*.tsx`,
20
20
  `!${src}/**/*.test.ts`,
21
- `!${src}/**/*.spec.ts`
21
+ `!${src}/**/*.test.tsx`,
22
+ `!${src}/**/*.spec.ts`,
23
+ `!${src}/**/*.spec.tsx`
22
24
  ].concat(excludes.map((exclude) => `!${exclude}`)));
23
25
  const analysis = {};
24
26
  let processedCount = 0;
@@ -40,9 +42,9 @@ ${_text}
40
42
  text
41
43
  };
42
44
  processedCount++;
43
- if (processedCount % 50 === 0) console.log(`📊 Analysé ${processedCount}/${sourceFiles.length} fichiers...`);
45
+ if (processedCount % 50 === 0) console.log(`📊 Analyzed ${processedCount}/${sourceFiles.length} files...`);
44
46
  }
45
- console.log(`✅ Analyse terminée: ${processedCount} fichiers analysés`);
47
+ console.log(`✅ Analysis completed: ${processedCount} files analyzed`);
46
48
  return v.parse(CodebaseAnalysisSchema, analysis);
47
49
  };
48
50
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"analyse.js","names":[],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from \"path\";\nimport { Project } from \"ts-morph\";\nimport * as v from \"valibot\";\nimport { addJSDocToSourceText } from \"./analyse.utils\";\nimport { SRC_DIR } from \"./constants\";\nimport { analyzeExports } from \"./exports\";\nimport { toArray } from \"./helpers\";\nimport { analyzeImports, buildImportStrings } from \"./imports\";\nimport { CodebaseAnalysisSchema } from \"./schemas\";\nimport { pathToDotNotation } from \"./utils\";\n\nexport type AnalyzeOptions = {\n src?: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyse tous les fichiers TypeScript dans src/ (sauf src/scripts/)\n */\nexport const analyze = ({\n src = SRC_DIR,\n excludes: _excludes,\n}: AnalyzeOptions = {}) => {\n console.log(\"🔍 Analyse du codebase en cours...\");\n const excludes = toArray(_excludes);\n\n // Initialiser le projet ts-morph\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), \"tsconfig.json\"),\n });\n\n // Ajouter tous les fichiers TypeScript du dossier src\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `!${src}/**/*.test.ts`, // Exclude test files\n `!${src}/**/*.spec.ts`, // Exclude spec files\n ].concat(excludes.map((exclude) => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Générer le texte modifié avec JSDoc pour les exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyser les imports et exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Construire les imports à partir de fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combiner imports et contenu\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join(\"\\n\") : \"\";\n\n const text =\n importsSection === \"\"\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Afficher l'avancement de l'analyse par palliers de 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analysé ${processedCount}/${sourceFiles.length} fichiers...`,\n );\n }\n // #endregion\n }\n\n console.log(`✅ Analyse terminée: ${processedCount} fichiers analysés`);\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAa,WAAW,EACtB,MAAM,SACN,UAAU,cACQ,EAAE,KAAK;AACzB,SAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAW,QAAQ,UAAU;CAQnC,MAAM,cALU,IAAI,QAAQ,EAC1B,kBAAkB,KAAK,QAAQ,KAAK,EAAE,gBAAgB,EACvD,CAAC,CAG0B,sBAC1B;EACE,GAAG,IAAI;EACP,IAAI,IAAI;EACR,IAAI,IAAI;EACT,CAAC,OAAO,SAAS,KAAK,YAAY,IAAI,UAAU,CAAC,CACnD;CAED,MAAM,WAAwD,EAAE;CAChE,IAAI,iBAAiB;AAErB,MAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,eAAe,SAAS,KADb,WAAW,aAAa,CACG;EAI5C,MAAM,QAAQ,qBAAqB,WAAW;EAG9C,MAAM,UAAU,eAAe,WAAW;EAC1C,MAAM,UAAU,eAAe,WAAW;EAI1C,MAAM,iBAAiB,mBAAmB,QAAQ;EAGlD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,KAAK,GAAG;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;AAGJ,WAAS,kBAAkB,aAAa,IAAI;GAC1C;GACA;GACA;GACA;GACD;AAED;AAGA,MAAI,iBAAiB,OAAO,EAC1B,SAAQ,IACN,cAAc,eAAe,GAAG,YAAY,OAAO,cACpD;;AAKL,SAAQ,IAAI,uBAAuB,eAAe,oBAAoB;AACtE,QAAO,EAAE,MAAM,wBAAwB,SAAS"}
1
+ {"version":3,"file":"analyse.js","names":[],"sources":["../src/analyse.ts"],"sourcesContent":["import { join, relative } from 'path';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { addJSDocToSourceText } from './analyse.utils';\nimport { analyzeExports } from './exports';\nimport { toArray } from './helpers';\nimport { analyzeImports, buildImportStrings } from './imports';\nimport { CodebaseAnalysisSchema } from './schemas';\nimport { pathToDotNotation } from './utils';\n\nexport type AnalyzeOptions = {\n src: string;\n excludes?: string | string[];\n};\n\n/**\n * Analyzes all TypeScript files in src/ (except src/scripts/)\n */\nexport const analyze = ({\n src,\n excludes: _excludes,\n}: AnalyzeOptions) => {\n console.log('🔍 Codebase analysis in progress...');\n const excludes = toArray(_excludes);\n\n // Initialize the ts-morph project\n const project = new Project({\n tsConfigFilePath: join(process.cwd(), 'tsconfig.json'),\n });\n\n // Add all TypeScript files from the src folder\n const sourceFiles = project.addSourceFilesAtPaths(\n [\n `${src}/**/*.ts`,\n `${src}/**/*.tsx`,\n\n // #region Exclude test files\n `!${src}/**/*.test.ts`,\n `!${src}/**/*.test.tsx`,\n `!${src}/**/*.spec.ts`,\n `!${src}/**/*.spec.tsx`,\n // #endregion\n ].concat(excludes.map(exclude => `!${exclude}`)),\n );\n\n const analysis: v.InferInput<typeof CodebaseAnalysisSchema> = {};\n let processedCount = 0;\n\n for (const sourceFile of sourceFiles) {\n const filePath = sourceFile.getFilePath();\n const relativePath = relative(src, filePath);\n\n // Generate modified text with JSDoc for exports\n\n const _text = addJSDocToSourceText(sourceFile);\n\n // #region Analyze imports and exports\n const imports = analyzeImports(sourceFile);\n const exports = analyzeExports(sourceFile);\n // #endregion\n\n // Build imports from fileAnalysis.imports\n const importsStrings = buildImportStrings(imports);\n\n // Combine imports and content\n const importsSection =\n importsStrings.length > 0 ? importsStrings.join('\\n') : '';\n\n const text =\n importsSection === ''\n ? _text\n : `${importsSection}\n\n${_text}\n `;\n\n analysis[pathToDotNotation(relativePath)] = {\n relativePath,\n imports,\n exports,\n text,\n };\n\n processedCount++;\n\n // #region Display analysis progress in increments of 50\n if (processedCount % 50 === 0) {\n console.log(\n `📊 Analyzed ${processedCount}/${sourceFiles.length} files...`,\n );\n }\n // #endregion\n }\n\n console.log(\n `✅ Analysis completed: ${processedCount} files analyzed`,\n );\n return v.parse(CodebaseAnalysisSchema, analysis);\n};\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAa,WAAW,EACtB,KACA,UAAU,gBACU;CACpB,QAAQ,IAAI,qCAAqC;CACjD,MAAM,WAAW,QAAQ,SAAS;CAQlC,MAAM,cAAc,IALA,QAAQ,EAC1B,kBAAkB,KAAK,QAAQ,IAAI,GAAG,eAAe,EACvD,CAG0B,CAAC,CAAC,sBAC1B;EACE,GAAG,IAAI;EACP,GAAG,IAAI;EAGP,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;EACR,IAAI,IAAI;CAEV,CAAC,CAAC,OAAO,SAAS,KAAI,YAAW,IAAI,SAAS,CAAC,CACjD;CAEA,MAAM,WAAwD,CAAC;CAC/D,IAAI,iBAAiB;CAErB,KAAK,MAAM,cAAc,aAAa;EAEpC,MAAM,eAAe,SAAS,KADb,WAAW,YACc,CAAC;EAI3C,MAAM,QAAQ,qBAAqB,UAAU;EAG7C,MAAM,UAAU,eAAe,UAAU;EACzC,MAAM,UAAU,eAAe,UAAU;EAIzC,MAAM,iBAAiB,mBAAmB,OAAO;EAGjD,MAAM,iBACJ,eAAe,SAAS,IAAI,eAAe,KAAK,IAAI,IAAI;EAE1D,MAAM,OACJ,mBAAmB,KACf,QACA,GAAG,eAAe;;EAE1B,MAAM;;EAGJ,SAAS,kBAAkB,YAAY,KAAK;GAC1C;GACA;GACA;GACA;EACF;EAEA;EAGA,IAAI,iBAAiB,OAAO,GAC1B,QAAQ,IACN,eAAe,eAAe,GAAG,YAAY,OAAO,UACtD;CAGJ;CAEA,QAAQ,IACN,yBAAyB,eAAe,gBAC1C;CACA,OAAO,EAAE,MAAM,wBAAwB,QAAQ;AACjD"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/analyse.utils.ts
3
3
  /**
4
- * Génère un JSDoc pour une expression exportée générée automatiquement
4
+ * Generates a JSDoc for an automatically generated exported expression
5
5
  */
6
6
  const generateJSDoc = (exportName, declarationKind) => {
7
7
  return `/**
@@ -62,7 +62,7 @@ const extractExportDetails = (trimmedLine) => {
62
62
  };
63
63
  };
64
64
  /**
65
- * Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export
65
+ * Checks if an export line contains a declaration and not just a simple re-export
66
66
  */
67
67
  const hasDeclaration = (exportLine) => {
68
68
  const trimmed = exportLine.trim();
@@ -87,7 +87,7 @@ const hasDeclaration = (exportLine) => {
87
87
  ].some((kw) => trimmed.includes(kw));
88
88
  };
89
89
  /**
90
- * Extrait le nom d'une déclaration (const, function, etc.)
90
+ * Extracts the name of a declaration (const, function, etc.)
91
91
  */
92
92
  const extractDeclarationName = (line) => {
93
93
  const trimmed = line.trim();
@@ -118,7 +118,7 @@ const extractDeclarationName = (line) => {
118
118
  return null;
119
119
  };
120
120
  /**
121
- * Vérifie si une déclaration est exportée plus tard dans le fichier
121
+ * Checks if a declaration is exported later in the file
122
122
  */
123
123
  const isExportedLater = (lines, declarationName) => {
124
124
  return lines.some((line) => {
@@ -127,7 +127,7 @@ const isExportedLater = (lines, declarationName) => {
127
127
  });
128
128
  };
129
129
  /**
130
- * Détermine le type de déclaration
130
+ * Determines the declaration kind
131
131
  */
132
132
  const getDeclarationKind = (line) => {
133
133
  const trimmed = line.trim();
@@ -142,7 +142,7 @@ const getDeclarationKind = (line) => {
142
142
  return "variable";
143
143
  };
144
144
  /**
145
- * Ajoute des JSDoc aux expressions exportées dans le texte source
145
+ * Adds JSDoc to exported expressions in the source text
146
146
  */
147
147
  const addJSDocToSourceText = (sourceFile) => {
148
148
  const fullText = sourceFile.getText();
@@ -1 +1 @@
1
- {"version":3,"file":"analyse.utils.cjs","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,YAAY,MAAM,mBAAmB;AACnD,eAAa,Q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AO"}
1
+ {"version":3,"file":"analyse.utils.cjs","names":[],"sources":["../src/analyse.utils.ts"],"sourcesContent":["import type { SourceFile } from 'ts-morph';\n\n/**\n * Generates a JSDoc for an automatically generated exported expression\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 * Checks if an export line contains a declaration and not just a 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(\n /^export\\s+default\\s+[a-zA-Z_$][a-zA-Z0-9_$]*\\s*;?\\s*$/,\n ); // export default identifier;\n\n // Re-exports and simple exports to exclude\n if (falsy) return false;\n\n // Declarations to include (with declaration keywords)\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 * Extracts the name of a declaration (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 * Checks if a declaration is exported later in the file\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 * Determines the declaration kind\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 * Adds JSDoc to exported expressions in the source text\n */\nexport const addJSDocToSourceText = (\n sourceFile: SourceFile,\n): string => {\n // Get the text without imports from the start\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 // A simpler approach: analyze the text directly to find exports\n const lines = modifiedText.split('\\n');\n\n lines.forEach((line, lineIndex) => {\n const trimmedLine = line.trim();\n\n // Detect lines that start with export AND contain a declaration\n if (\n trimmedLine.startsWith('export ') &&\n hasDeclaration(trimmedLine)\n ) {\n // Calculate the position in the original text\n const position =\n lines.slice(0, lineIndex).join('\\n').length +\n (lineIndex > 0 ? 1 : 0);\n\n // Determine the export name and kind\n const { exportName, declarationKind } =\n extractExportDetails(trimmedLine);\n\n const jsdoc = generateJSDoc(exportName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n\n // Detect internal declarations (const, function, etc.) that are exported later\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 // Check if this declaration is exported later in the file\n const declarationName = extractDeclarationName(trimmedLine);\n if (declarationName && isExportedLater(lines, declarationName)) {\n // Calculate the position in the original text\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 // Sort by descending position to insert from the end to the beginning\n insertions.sort((a, b) => b.position - a.position);\n\n // Insert JSDocs\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;CAEX,OAAO;KACJ,aAFc,kBAAkB,IAAI,oBAAoB,GAElC;;;;;;;;;AAS3B;AAEA,MAAa,wBAAwB,gBAAwB;CAC3D,IAAI,aAAa;CACjB,IAAI;CAEJ,IAAI,YAAY,SAAS,iBAAiB,GAAG;EAC3C,aAAa;EACb,IAAI,YAAY,SAAS,UAAU,GAAG,kBAAkB;OACnD,IAAI,YAAY,SAAS,OAAO,GAAG,kBAAkB;OACrD,kBAAkB;CACzB,OAAO,IAAI,YAAY,SAAS,eAAe,GAAG;EAChD,MAAM,QAAQ,YAAY,MAAM,oBAAoB;EACpD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAAO,IAAI,YAAY,SAAS,aAAa,GAAG;EAC9C,MAAM,QAAQ,YAAY,MAAM,kBAAkB;EAClD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAA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AK;KAAE;KAAU,OAAO,GAAG,MAAM;IAAI,CAAC;GACnD;EACF;CACF,CAAC;CAGD,WAAW,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;CAGjD,KAAK,MAAM,aAAa,YACtB,eACE,aAAa,MAAM,GAAG,UAAU,QAAQ,IACxC,UAAU,QACV,aAAa,MAAM,UAAU,QAAQ;CAGzC,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
- import type { SourceFile } from "ts-morph";
1
+ import type { SourceFile } from 'ts-morph';
2
2
  /**
3
- * Génère un JSDoc pour une expression exportée générée automatiquement
3
+ * Generates a JSDoc for an automatically generated exported expression
4
4
  */
5
5
  export declare const generateJSDoc: (exportName: string, declarationKind?: string) => string;
6
6
  export declare const extractExportDetails: (trimmedLine: string) => {
@@ -8,22 +8,23 @@ export declare const extractExportDetails: (trimmedLine: string) => {
8
8
  declarationKind: string | undefined;
9
9
  };
10
10
  /**
11
- * Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export
11
+ * Checks if an export line contains a declaration and not just a simple re-export
12
12
  */
13
13
  export declare const hasDeclaration: (exportLine: string) => boolean;
14
14
  /**
15
- * Extrait le nom d'une déclaration (const, function, etc.)
15
+ * Extracts the name of a declaration (const, function, etc.)
16
16
  */
17
17
  export declare const extractDeclarationName: (line: string) => string | null;
18
18
  /**
19
- * Vérifie si une déclaration est exportée plus tard dans le fichier
19
+ * Checks if a declaration is exported later in the file
20
20
  */
21
21
  export declare const isExportedLater: (lines: string[], declarationName: string) => boolean;
22
22
  /**
23
- * Détermine le type de déclaration
23
+ * Determines the declaration kind
24
24
  */
25
25
  export declare const getDeclarationKind: (line: string) => string;
26
26
  /**
27
- * Ajoute des JSDoc aux expressions exportées dans le texte source
27
+ * Adds JSDoc to exported expressions in the source text
28
28
  */
29
29
  export declare const addJSDocToSourceText: (sourceFile: SourceFile) => string;
30
+ //# sourceMappingURL=analyse.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyse.utils.d.ts","sourceRoot":"","sources":["../src/analyse.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,YAAY,MAAM,EAClB,kBAAkB,MAAM,KACvB,MAYF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM;;;CA2CvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,KAAG,OAmCnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IA6B9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EAAE,EACf,iBAAiB,MAAM,KACtB,OASF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAajD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MA6EF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  //#region src/analyse.utils.ts
2
2
  /**
3
- * Génère un JSDoc pour une expression exportée générée automatiquement
3
+ * Generates a JSDoc for an automatically generated exported expression
4
4
  */
5
5
  const generateJSDoc = (exportName, declarationKind) => {
6
6
  return `/**
@@ -61,7 +61,7 @@ const extractExportDetails = (trimmedLine) => {
61
61
  };
62
62
  };
63
63
  /**
64
- * Vérifie si une ligne d'export contient une déclaration et non pas un simple re-export
64
+ * Checks if an export line contains a declaration and not just a simple re-export
65
65
  */
66
66
  const hasDeclaration = (exportLine) => {
67
67
  const trimmed = exportLine.trim();
@@ -86,7 +86,7 @@ const hasDeclaration = (exportLine) => {
86
86
  ].some((kw) => trimmed.includes(kw));
87
87
  };
88
88
  /**
89
- * Extrait le nom d'une déclaration (const, function, etc.)
89
+ * Extracts the name of a declaration (const, function, etc.)
90
90
  */
91
91
  const extractDeclarationName = (line) => {
92
92
  const trimmed = line.trim();
@@ -117,7 +117,7 @@ const extractDeclarationName = (line) => {
117
117
  return null;
118
118
  };
119
119
  /**
120
- * Vérifie si une déclaration est exportée plus tard dans le fichier
120
+ * Checks if a declaration is exported later in the file
121
121
  */
122
122
  const isExportedLater = (lines, declarationName) => {
123
123
  return lines.some((line) => {
@@ -126,7 +126,7 @@ const isExportedLater = (lines, declarationName) => {
126
126
  });
127
127
  };
128
128
  /**
129
- * Détermine le type de déclaration
129
+ * Determines the declaration kind
130
130
  */
131
131
  const getDeclarationKind = (line) => {
132
132
  const trimmed = line.trim();
@@ -141,7 +141,7 @@ const getDeclarationKind = (line) => {
141
141
  return "variable";
142
142
  };
143
143
  /**
144
- * Ajoute des JSDoc aux expressions exportées dans le texte source
144
+ * Adds JSDoc to exported expressions in the source text
145
145
  */
146
146
  const addJSDocToSourceText = (sourceFile) => {
147
147
  const fullText = sourceFile.getText();
@@ -1 +1 @@
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,YAAY,MAAM,mBAAmB;AACnD,eAAa,QAAQ,MAAM,KAAK;AAChC,oBAAkB;YACT,YAAY,SAAS,mBAAmB,EAAE;EACnD,MAAM,QAAQ,YAAY,MAAM,wBAAwB;AACxD,eAAa,QAAQ,MAAM,KAAK;AAChC,oBAAkB;YACT,YAAY,SAAS,gBAAgB,EAAE;EAChD,MAAM,QAAQ,YAAY,MAAM,qBAAqB;AACrD,eAAa,QAAQ,MAAM,KAAK;AAChC,oBAAkB;YACT,YAAY,SAAS,oBAAoB,EAAE;EACpD,MAAM,QAAQ,YAAY,MAAM,yBAAyB;AACzD,eAAa,QAAQ,MAAM,K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UAAU,CAAC,KAAK,KAAK,CAAC,UAAU,YAAY,IAAI,IAAI;GAGrE,MAAM,EAAE,YAAY,oBAAoB,qBAAqB,YAAY;GAEzE,MAAM,QAAQ,cAAc,YAAY,gBAAgB;AACxD,cAAW,KAAK;IAAE;IAAU,OAAO,GAAG,MAAM;IAAK,CAAC;;AAIpD,MACE,CAAC,YAAY,WAAW,UAAU,KACjC,YAAY,WAAW,SAAS,IAC/B,YAAY,WAAW,YAAY,IACnC,YAAY,WAAW,SAAS,IAChC,YAAY,WAAW,aAAa,IACpC,YAAY,WAAW,QAAQ,IAC/B,YAAY,WAAW,QAAQ,GACjC;GAEA,MAAM,kBAAkB,uBAAuB,YAAY;AAC3D,OAAI,mBAAmB,gBAAgB,OAAO,gBAAgB,EAAE;IAE9D,MAAM,WACJ,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,KAAK,CAAC,UAAU,YAAY,IAAI,IAAI;IAGrE,MAAM,QAAQ,cAAc,iBADJ,mBAAmB,YAAY,CACM;AAC7D,eAAW,KAAK;KAAE;KAAU,OAAO,GAAG,MAAM;KAAK,CAAC;;;GAGtD;AAGF,YAAW,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,SAAS;AAGlD,MAAK,MAAM,aAAa,WACtB,gBACE,aAAa,MAAM,GAAG,UAAU,SAAS,GACzC,UAAU,QACV,aAAa,MAAM,UAAU,SAAS;AAG1C,QAAO"}
1
+ {"version":3,"file":"analyse.utils.js","names":[],"sources":["../src/analyse.utils.ts"],"sourcesContent":["import type { SourceFile } from 'ts-morph';\n\n/**\n * Generates a JSDoc for an automatically generated exported expression\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 * Checks if an export line contains a declaration and not just a 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(\n /^export\\s+default\\s+[a-zA-Z_$][a-zA-Z0-9_$]*\\s*;?\\s*$/,\n ); // export default identifier;\n\n // Re-exports and simple exports to exclude\n if (falsy) return false;\n\n // Declarations to include (with declaration keywords)\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 * Extracts the name of a declaration (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 * Checks if a declaration is exported later in the file\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 * Determines the declaration kind\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 * Adds JSDoc to exported expressions in the source text\n */\nexport const addJSDocToSourceText = (\n sourceFile: SourceFile,\n): string => {\n // Get the text without imports from the start\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 // A simpler approach: analyze the text directly to find exports\n const lines = modifiedText.split('\\n');\n\n lines.forEach((line, lineIndex) => {\n const trimmedLine = line.trim();\n\n // Detect lines that start with export AND contain a declaration\n if (\n trimmedLine.startsWith('export ') &&\n hasDeclaration(trimmedLine)\n ) {\n // Calculate the position in the original text\n const position =\n lines.slice(0, lineIndex).join('\\n').length +\n (lineIndex > 0 ? 1 : 0);\n\n // Determine the export name and kind\n const { exportName, declarationKind } =\n extractExportDetails(trimmedLine);\n\n const jsdoc = generateJSDoc(exportName, declarationKind);\n insertions.push({ position, jsdoc: `${jsdoc}\\n` });\n }\n\n // Detect internal declarations (const, function, etc.) that are exported later\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 // Check if this declaration is exported later in the file\n const declarationName = extractDeclarationName(trimmedLine);\n if (declarationName && isExportedLater(lines, declarationName)) {\n // Calculate the position in the original text\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 // Sort by descending position to insert from the end to the beginning\n insertions.sort((a, b) => b.position - a.position);\n\n // Insert JSDocs\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;CAEX,OAAO;KACJ,aAFc,kBAAkB,IAAI,oBAAoB,GAElC;;;;;;;;;AAS3B;AAEA,MAAa,wBAAwB,gBAAwB;CAC3D,IAAI,aAAa;CACjB,IAAI;CAEJ,IAAI,YAAY,SAAS,iBAAiB,GAAG;EAC3C,aAAa;EACb,IAAI,YAAY,SAAS,UAAU,GAAG,kBAAkB;OACnD,IAAI,YAAY,SAAS,OAAO,GAAG,kBAAkB;OACrD,kBAAkB;CACzB,OAAO,IAAI,YAAY,SAAS,eAAe,GAAG;EAChD,MAAM,QAAQ,YAAY,MAAM,oBAAoB;EACpD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAAO,IAAI,YAAY,SAAS,aAAa,GAAG;EAC9C,MAAM,QAAQ,YAAY,MAAM,kBAAkB;EAClD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAAO,IAAI,YAAY,SAAS,aAAa,GAAG;EAC9C,MAAM,QAAQ,YAAY,MAAM,kBAAkB;EAClD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAAO,IAAI,YAAY,SAAS,kBAAkB,GAAG;EACnD,MAAM,QAAQ,YAAY,MAAM,uBAAuB;EACvD,aAAa,QAAQ,MAAM,KAAK;EAChC,kBAAkB;CACpB,OAAO,IAAI,YAAY,SAAS,eAAe,GAAG;EAChD,MAAM,QAAQ,YAAY,MAAM,oBAAoB;EACpD,aAAa,QAAQ,MAAM,KAAK;EAChC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js");
3
2
  const require_constants = require("../constants.cjs");
4
3
  const require_functions_generate = require("../functions/generate.cjs");
4
+ const require_cli_constants = require("./constants.cjs");
5
5
  let cmd_ts = require("cmd-ts");
6
6
  //#region src/cli/cli.ts
7
7
  const cli = (0, cmd_ts.command)({
8
- name: "generate",
9
8
  args: {
10
9
  output: (0, cmd_ts.option)({
11
10
  long: "output",
@@ -22,6 +21,7 @@ const cli = (0, cmd_ts.command)({
22
21
  defaultValue: () => []
23
22
  })
24
23
  },
24
+ name: require_cli_constants.BIN,
25
25
  handler: require_functions_generate.generate
26
26
  });
27
27
  //#endregion
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"cli.cjs","names":["string","CODEBASE_FILE","BIN"],"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';\nimport { BIN } from './constants';\n\nexport const cli = command({\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\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\n name: BIN,\n handler,\n});\n"],"mappings":";;;;;;AAKA,MAAa,OAAA,GAAA,OAAA,QAAA,CAAc;CACzB,MAAM;EACJ,SAAA,GAAA,OAAA,OAAA,CAAe;GACb,MAAM;GACN,OAAO;GACP,MAAMA,OAAAA;GACN,aAAa;GACb,oBAAoBC,kBAAAA;EACtB,CAAC;EAED,WAAA,GAAA,OAAA,YAAA,CAAsB;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,OAAA,GAAA,OAAA,MAAA,CAAYD,OAAAA,MAAM;GAClB,oBAAoB,CAAC;EACvB,CAAC;CACH;CAEA,MAAME,sBAAAA;CACN,SAAA,2BAAA;AACF,CAAC"}
package/lib/cli/cli.d.ts CHANGED
@@ -9,3 +9,4 @@ 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG;;;;;;;;;;oJAqBd,CAAC"}
package/lib/cli/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { CODEBASE_FILE } from "../constants.js";
2
2
  import { generate } from "../functions/generate.js";
3
+ import { BIN } from "./constants.js";
3
4
  import { array, command, multioption, option, string } from "cmd-ts";
4
5
  //#region src/cli/cli.ts
5
6
  const cli = command({
6
- name: "generate",
7
7
  args: {
8
8
  output: option({
9
9
  long: "output",
@@ -20,6 +20,7 @@ const cli = command({
20
20
  defaultValue: () => []
21
21
  })
22
22
  },
23
+ name: BIN,
23
24
  handler: generate
24
25
  });
25
26
  //#endregion
@@ -1 +1 @@
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"}
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';\nimport { BIN } from './constants';\n\nexport const cli = command({\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\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\n name: BIN,\n handler,\n});\n"],"mappings":";;;;;AAKA,MAAa,MAAM,QAAQ;CACzB,MAAM;EACJ,QAAQ,OAAO;GACb,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,oBAAoB;EACtB,CAAC;EAED,UAAU,YAAY;GACpB,aAAa;GACb,MAAM;GACN,OAAO;GACP,MAAM,MAAM,MAAM;GAClB,oBAAoB,CAAC;EACvB,CAAC;CACH;CAEA,MAAM;CACN,SAAA;AACF,CAAC"}
@@ -1 +1,2 @@
1
1
  export declare const BIN = "codebase";
2
+ //# sourceMappingURL=constants.d.ts.map