Skip to content

Commit d773b04

Browse files
devvaannshabose
authored andcommitted
fix: remove define blocks
1 parent 767e0b0 commit d773b04

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

build/api-docs-generator.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,17 @@ function removeDir(dirPath) {
6363
*/
6464
function modifyJs(content, fileName) {
6565

66-
// replace function wrapper with export block
66+
// remove function wrapper
6767
if (content.includes('\n(function () {')) {
68-
// IIFE function modification
6968

7069
content = content.replace(
7170
/\(function \(\) \{/,
72-
`export function ${fileName} () {`
71+
''
7372
);
7473

7574
// Remove matching closing parentheses
7675
if (content.trim().endsWith('}());')) {
77-
content = content.trim().slice(0, -4);
76+
content = content.trim().slice(0, -5);
7877
}
7978

8079
// Clean up any leftover unmatched brackets
@@ -100,21 +99,18 @@ function modifyJs(content, fileName) {
10099
}
101100
} else if (content.includes('define(function')) {
102101

103-
// replace define block with export block
102+
// remove define blocks
104103
content = content.replace(
105104
/define\(function\s*\([^)]*\)\s*{/,
106-
`export function ${fileName} () {`
105+
''
107106
);
108107

109108
// remove trailing braces from define block
110109
if (content.trim().endsWith('});')) {
111-
content = content.trim().slice(0, -2);
110+
content = content.trim().slice(0, -3);
112111
}
113112
}
114113

115-
// Fix some JSDoc issues, where MDX breaks
116-
content = content.replace(/@module/g, 'module');
117-
118114
return content;
119115
}
120116

@@ -142,7 +138,9 @@ function modifyMarkdown(content, relativePath) {
142138
).replace(/\\/g, '/');
143139

144140
const importStatement =
145-
`### Import :\n\`\`\`js\nbrackets.getModule("${modulePath}")\n\`\`\`\n\n`;
141+
`### Import :\n\`\`\`js\nbrackets.getModule("${modulePath}")\n\`\`\`\n\n`;
142+
143+
content = content.replace(/~/g, '.');
146144

147145
// Combine the import statement with the modified content
148146
return importStatement + content;

0 commit comments

Comments
 (0)