datagrok-tools 4.14.49 → 4.14.50
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.
|
@@ -129,7 +129,7 @@ function getFuncAnnotation(data, comment = '//', sep = '\n') {
|
|
|
129
129
|
const isFileViewer = data.tags?.includes(FUNC_TYPES.FILE_VIEWER) ?? false;
|
|
130
130
|
const isFileImporter = data.tags?.includes(FUNC_TYPES.FILE_HANDLER) ?? false;
|
|
131
131
|
let s = '';
|
|
132
|
-
if (data.name
|
|
132
|
+
if (data.name) s += `${comment}name: ${data.name}${sep}`;
|
|
133
133
|
if (pseudoParams.EXTENSION in data && data.tags != null && data.tags.includes(FUNC_TYPES.FILE_EXPORTER)) s += `${comment}description: Save as ${data[pseudoParams.EXTENSION]}${sep}`;else if (data.description) s += `${comment}description: ${data.description}${sep}`;
|
|
134
134
|
if (data.tags && data.tags?.length > 0) {
|
|
135
135
|
s += `${comment}tags: ${isFileViewer && data[pseudoParams.EXTENSIONS] ? data.tags.concat(data[pseudoParams.EXTENSIONS].map(ext => 'fileViewer-' + ext)).join(', ') : data.tags.join(', ')}${sep}`;
|
package/package.json
CHANGED
|
@@ -173,11 +173,13 @@ class FuncGeneratorPlugin {
|
|
|
173
173
|
node?.type === 'MethodDefinition' ? className : identifierName,
|
|
174
174
|
modifyImportPath(path.dirname(this.options.outputPath), file),
|
|
175
175
|
);
|
|
176
|
+
|
|
176
177
|
imports.add(importString);
|
|
177
178
|
const funcName = `${
|
|
178
179
|
node?.type === 'MethodDefinition' ? '' : '_'
|
|
179
180
|
}${identifierName}`;
|
|
180
181
|
const funcAnnotaionOptions = {
|
|
182
|
+
...{name: funcName},
|
|
181
183
|
...reservedDecorators[name]['metadata'],
|
|
182
184
|
...(annotationByReturnObj ?
|
|
183
185
|
{outputs: annotationByReturnObj ?? []} :
|
|
@@ -196,10 +198,20 @@ class FuncGeneratorPlugin {
|
|
|
196
198
|
actualType = 'void';
|
|
197
199
|
|
|
198
200
|
// if (!funcAnnotaionOptions.name) funcAnnotaionOptions.name = identifierName;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
function containsAnything(funcAnnotaionOptions) {
|
|
202
|
+
let hasValues = false;
|
|
203
|
+
const arrays = ['tags', 'inputs', 'outputs'];
|
|
204
|
+
for (const option of Object.keys(funcAnnotaionOptions)) {
|
|
205
|
+
if (arrays.includes(option)) {
|
|
206
|
+
if (funcAnnotaionOptions[option].length > 0)
|
|
207
|
+
hasValues = true;
|
|
208
|
+
} else if (option != 'isAsync' && option != 'name')
|
|
209
|
+
hasValues = true;
|
|
210
|
+
}
|
|
211
|
+
return hasValues;
|
|
212
|
+
}
|
|
213
|
+
if (funcAnnotaionOptions.name === funcName && containsAnything(funcAnnotaionOptions))
|
|
214
|
+
delete funcAnnotaionOptions.name;
|
|
203
215
|
functions.push(
|
|
204
216
|
reservedDecorators[name]['genFunc'](
|
|
205
217
|
getFuncAnnotation(funcAnnotaionOptions),
|