@microlink/mql 0.13.6 → 0.13.7
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/README.md +1 -1
- package/lightweight/index.js +362 -363
- package/lightweight/index.umd.js +366 -376
- package/package.json +8 -8
- package/src/factory.js +9 -2
- package/src/node.js +0 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@microlink/mql",
|
|
3
3
|
"description": "Microlink Query Language. The official HTTP client to interact with Microlink API for Node.js, browsers & Deno.",
|
|
4
4
|
"homepage": "https://microlink.io/mql",
|
|
5
|
-
"version": "0.13.
|
|
5
|
+
"version": "0.13.7",
|
|
6
6
|
"types": "lightweight/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
"require": "./src/node.js",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"flattie": "~1.1.0",
|
|
50
50
|
"got": "~11.8.6",
|
|
51
|
-
"url-http": "~1.2.0",
|
|
52
51
|
"whoops": "~4.1.7"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
@@ -67,7 +66,6 @@
|
|
|
67
66
|
"github-generate-release": "latest",
|
|
68
67
|
"ky": "latest",
|
|
69
68
|
"nano-staged": "latest",
|
|
70
|
-
"npm-check-updates": "latest",
|
|
71
69
|
"prettier-standard": "latest",
|
|
72
70
|
"rollup": "latest",
|
|
73
71
|
"rollup-plugin-filesize": "latest",
|
|
@@ -98,14 +96,11 @@
|
|
|
98
96
|
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
|
|
99
97
|
"prebuild": "npm run clean:build",
|
|
100
98
|
"prepublishOnly": "npm run build",
|
|
101
|
-
"prerelease": "npm run update:check",
|
|
102
99
|
"pretest": "npm run lint && npm run build",
|
|
103
100
|
"release": "standard-version -a",
|
|
104
101
|
"release:github": "github-generate-release",
|
|
105
102
|
"release:tags": "git push --follow-tags origin HEAD:master",
|
|
106
|
-
"test": "c8 ava --verbose"
|
|
107
|
-
"update": "ncu -u",
|
|
108
|
-
"update:check": "ncu -- --error-level 2"
|
|
103
|
+
"test": "c8 ava --verbose"
|
|
109
104
|
},
|
|
110
105
|
"license": "MIT",
|
|
111
106
|
"ava": {
|
|
@@ -118,7 +113,12 @@
|
|
|
118
113
|
"commitlint": {
|
|
119
114
|
"extends": [
|
|
120
115
|
"@commitlint/config-conventional"
|
|
121
|
-
]
|
|
116
|
+
],
|
|
117
|
+
"rules": {
|
|
118
|
+
"body-max-line-length": [
|
|
119
|
+
0
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
122
|
},
|
|
123
123
|
"nano-staged": {
|
|
124
124
|
"*.js": [
|
package/src/factory.js
CHANGED
|
@@ -28,15 +28,22 @@ const parseBody = (input, error, url) => {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
const isURL = url => {
|
|
32
|
+
try {
|
|
33
|
+
return /^https?:\/\//i.test(new URL(url).href)
|
|
34
|
+
} catch (_) {
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
const factory = streamResponseType => ({
|
|
32
40
|
VERSION,
|
|
33
41
|
MicrolinkError,
|
|
34
|
-
urlHttp,
|
|
35
42
|
got,
|
|
36
43
|
flatten
|
|
37
44
|
}) => {
|
|
38
45
|
const assertUrl = (url = '') => {
|
|
39
|
-
if (!
|
|
46
|
+
if (!isURL(url)) {
|
|
40
47
|
const message = `The \`url\` as \`${url}\` is not valid. Ensure it has protocol (http or https) and hostname.`
|
|
41
48
|
throw new MicrolinkError({
|
|
42
49
|
status: 'fail',
|
package/src/node.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const mql = require('./factory')('buffer')({
|
|
2
2
|
MicrolinkError: require('whoops')('MicrolinkError'),
|
|
3
|
-
urlHttp: require('url-http/lightweight'),
|
|
4
3
|
got: require('got').extend({ headers: { 'user-agent': undefined } }),
|
|
5
4
|
flatten: require('flattie').flattie,
|
|
6
5
|
VERSION: require('../package.json').version
|