datagrok-tools 4.14.22 → 4.14.23
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/bin/commands/check.js +1 -0
- package/bin/utils/utils.js +19 -4
- package/package.json +1 -1
package/bin/commands/check.js
CHANGED
|
@@ -35,6 +35,7 @@ function check(args) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function runChecks(packagePath, soft = false) {
|
|
38
|
+
if (packagePath.includes(`${_path.default.sep}node_modules${_path.default.sep}`)) return true;
|
|
38
39
|
const files = _ignoreWalk.default.sync({
|
|
39
40
|
path: packagePath,
|
|
40
41
|
ignoreFiles: ['.npmignore', '.gitignore']
|
package/bin/utils/utils.js
CHANGED
|
@@ -194,10 +194,25 @@ const nameAnnRegex = exports.nameAnnRegex = /\s*(name[^:]*): ([^\n\r\[\{]+)/;
|
|
|
194
194
|
const nameRegex = exports.nameRegex = /(?:|(?:static)(?:export )(?:async ))\s+function\s+([a-zA-Z_][a-zA-Z0-9_$]*)\s*\((.*?).*/;
|
|
195
195
|
const absUrlRegex = exports.absUrlRegex = new RegExp('^(?:[a-z+]+:)?//', 'i');
|
|
196
196
|
function getScriptOutputType(script, comment = '#') {
|
|
197
|
-
const regex =
|
|
198
|
-
const
|
|
199
|
-
if (!
|
|
200
|
-
|
|
197
|
+
const regex = /\s*output:\s?([a-z_]+)\s*([^\s]*)/g;
|
|
198
|
+
const matches = script.matchAll(regex);
|
|
199
|
+
if (!matches) return 'void';
|
|
200
|
+
let resType = 'void';
|
|
201
|
+
let firstItemName = '';
|
|
202
|
+
let wasSecond = false;
|
|
203
|
+
for (let match of matches) {
|
|
204
|
+
if (resType === 'void') {
|
|
205
|
+
resType = dgToTsTypeMap[match[1]];
|
|
206
|
+
firstItemName = match[2];
|
|
207
|
+
} else {
|
|
208
|
+
if (!wasSecond) {
|
|
209
|
+
resType = `${firstItemName}: ${resType}`;
|
|
210
|
+
wasSecond = true;
|
|
211
|
+
}
|
|
212
|
+
resType = [resType, `${match[2]}: ${dgToTsTypeMap[match[1]]}`].join(', ');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return wasSecond ? `{${resType}}` : resType;
|
|
201
216
|
}
|
|
202
217
|
;
|
|
203
218
|
function getScriptInputs(script, comment = '#') {
|
package/package.json
CHANGED