microlink.io 0.5.0 → 0.5.1
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.md +0 -0
- package/bin/index.js +17 -2
- package/package.json +10 -9
package/LICENSE.md
CHANGED
|
File without changes
|
package/bin/index.js
CHANGED
|
@@ -245,6 +245,19 @@ const showHelp = command => {
|
|
|
245
245
|
process.exit(0)
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
const httpUrl = value => {
|
|
249
|
+
if (!URL.canParse(value)) return
|
|
250
|
+
const { protocol } = new URL(value)
|
|
251
|
+
if (protocol === 'http:' || protocol === 'https:') return value
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const asUrl = input => {
|
|
255
|
+
if (typeof input !== 'string' || !input) return
|
|
256
|
+
if (httpUrl(input)) return input
|
|
257
|
+
if (/^[a-z][a-z\d+.-]*:\/\//i.test(input) || !/[.:]/.test(input)) return
|
|
258
|
+
return httpUrl(`https://${input}`)
|
|
259
|
+
}
|
|
260
|
+
|
|
248
261
|
const HTTP_HEADER = 'http.header.'
|
|
249
262
|
|
|
250
263
|
const parseHeaders = input => {
|
|
@@ -322,8 +335,9 @@ if (command === 'login' || command === 'logout') {
|
|
|
322
335
|
})
|
|
323
336
|
|
|
324
337
|
if (typeof client[command] !== 'function') {
|
|
325
|
-
|
|
326
|
-
|
|
338
|
+
const url = asUrl(command)
|
|
339
|
+
if (!target && url) {
|
|
340
|
+
target = url
|
|
327
341
|
command = 'metadata'
|
|
328
342
|
} else if (help) {
|
|
329
343
|
showHelp()
|
|
@@ -336,6 +350,7 @@ if (command === 'login' || command === 'logout') {
|
|
|
336
350
|
}
|
|
337
351
|
|
|
338
352
|
if (help || !target) showHelp(command)
|
|
353
|
+
if (command !== 'search') target = asUrl(target) ?? target
|
|
339
354
|
|
|
340
355
|
if (
|
|
341
356
|
isTrace &&
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "microlink.io",
|
|
3
3
|
"description": "The Microlink API organized into products, each returning a direct result",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/microlink",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.1",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"main": "./src/index.js",
|
|
8
8
|
"exports": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"seo"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"mri": "~1.2.0",
|
|
48
|
-
"terminal-link": "~5.0.0",
|
|
49
|
-
"@microlink/google": "1.2.0",
|
|
50
47
|
"@microlink/function": "0.3.2",
|
|
51
|
-
"@microlink/
|
|
48
|
+
"@microlink/google": "1.2.0",
|
|
49
|
+
"@microlink/mql": "0.18.1",
|
|
50
|
+
"mri": "~1.2.0",
|
|
51
|
+
"terminal-link": "~5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"ava": "latest",
|
|
@@ -63,6 +63,9 @@
|
|
|
63
63
|
"bin",
|
|
64
64
|
"src"
|
|
65
65
|
],
|
|
66
|
+
"scripts": {
|
|
67
|
+
"test": "ava && tsd"
|
|
68
|
+
},
|
|
66
69
|
"preferGlobal": true,
|
|
67
70
|
"license": "MIT",
|
|
68
71
|
"ava": {
|
|
@@ -75,7 +78,5 @@
|
|
|
75
78
|
},
|
|
76
79
|
"directory": "test"
|
|
77
80
|
},
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
81
|
+
"gitHead": "231f3506d8b3345d55a0473a50f9dc1d90d45aed"
|
|
82
|
+
}
|