jsdoc-builder 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dori
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.MD CHANGED
@@ -61,7 +61,7 @@ jsdoc-builder example.ts
61
61
 
62
62
  ```typescript
63
63
  /**
64
- * @description Function add
64
+ * @description Press Your { Function add } Description
65
65
  * @param {number} a
66
66
  * @param {number} b
67
67
  * @returns {void}
@@ -71,7 +71,7 @@ function add(a: number, b: number) {
71
71
  }
72
72
 
73
73
  /**
74
- * @description Function multiply
74
+ * @description Press Your { Function multiply } Description
75
75
  * @param {number} a
76
76
  * @param {number} b
77
77
  * @returns {number}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateJSDoc = void 0;
3
+ exports.generateJSDoc = generateJSDoc;
4
4
  const ts = require("typescript");
5
5
  const fs = require("fs");
6
6
  /**
@@ -11,7 +11,8 @@ function generateJSDoc(filePath) {
11
11
  const sourceCode = fs.readFileSync(filePath, "utf-8");
12
12
  const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.Latest, true);
13
13
  const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
14
- function visit(node) {
14
+ // Visit function that processes each node
15
+ function visit(node, context) {
15
16
  if (ts.isFunctionDeclaration(node) && node.name) {
16
17
  const jsDoc = createJSDoc(node.name.text, node.parameters, node.type);
17
18
  ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, jsDoc.comment, true);
@@ -30,35 +31,20 @@ function generateJSDoc(filePath) {
30
31
  }
31
32
  return node;
32
33
  }
33
- return ts.visitEachChild(node, visit, context);
34
+ return ts.visitEachChild(node, (child) => visit(child, context), context); // Pass context to visit
34
35
  }
35
- // Create a transformation context
36
- const context = {
37
- factory: ts.factory,
38
- startLexicalEnvironment: () => { },
39
- endLexicalEnvironment: () => [],
40
- suspendLexicalEnvironment: () => { },
41
- resumeLexicalEnvironment: () => { },
42
- requestEmitHelper: () => { },
43
- readEmitHelpers: () => undefined,
44
- enableSubstitution: () => { },
45
- isSubstitutionEnabled: () => false,
46
- onSubstituteNode: (hint, node) => node,
47
- enableEmitNotification: () => { },
48
- isEmitNotificationEnabled: () => false,
49
- onEmitNode: (hint, node, emitCallback) => emitCallback(hint, node),
50
- getCompilerOptions: () => ({}),
51
- hoistFunctionDeclaration: () => { },
52
- hoistVariableDeclaration: () => { },
36
+ // Create the transformer
37
+ const transformer = (context) => {
38
+ return (sourceFile) => {
39
+ return ts.visitNode(sourceFile, (node) => visit(node, context)); // Pass context to visit
40
+ };
53
41
  };
54
- const result = ts.transform(sourceFile, [
55
- (context) => (rootNode) => ts.visitNode(rootNode, visit),
56
- ]);
42
+ // Apply the transformer
43
+ const result = ts.transform(sourceFile, [transformer]);
57
44
  const transformedSourceFile = result.transformed[0];
58
45
  const updatedCode = printer.printFile(transformedSourceFile);
59
46
  fs.writeFileSync(filePath, updatedCode, "utf-8");
60
47
  }
61
- exports.generateJSDoc = generateJSDoc;
62
48
  /**
63
49
  * Creates a JSDoc comment.
64
50
  * @param functionName - The name of the function.
package/package.json CHANGED
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "name": "jsdoc-builder",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "author": "dori",
5
5
  "description": "Generate JSDoc comments for JavaScript and TypeScript files.",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/klmhyeonwoo/jsdoc-builder"
12
+ },
13
+ "homepage": "https://github.com/klmhyeonwoo/jsdoc-builder#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/klmhyeonwoo/jsdoc-builder/issues"
16
+ },
6
17
  "bin": {
7
18
  "jsdoc-builder": "./dist/cli.js"
8
19
  },
@@ -12,12 +23,13 @@
12
23
  "license": "MIT",
13
24
  "keywords": [
14
25
  "jsdoc-generator",
15
- "jsdoc",
16
- "typescript",
17
- "javascript",
18
- "documentation",
19
- "cli",
20
- "auto-jsdoc"
26
+ "documentation-generator",
27
+ "auto-jsdoc",
28
+ "typescript-docs",
29
+ "typescript-jsdoc",
30
+ "javascript-documentation",
31
+ "cli-tool",
32
+ "developer-tools"
21
33
  ],
22
34
  "scripts": {
23
35
  "build": "tsc",