@microlink/cli 2.1.40 → 2.1.42

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.
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../src/cli')
4
+ cli.flags.endpoint = 'https://beta.microlink.io'
5
+ delete cli.flags.apiKey
6
+
7
+ require('../src/api')(cli, {
8
+ headers: {
9
+ authorization: require('../../api/src/constant').MICROLINK_API_AUTHORIZATION
10
+ }
11
+ })
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../src/cli')
4
+ cli.flags.endpoint = 'http://localhost:3000'
5
+ delete cli.flags.apiKey
6
+
7
+ require('../src/api')(cli, {
8
+ retry: 0,
9
+ headers: {
10
+ authorization: require('../../api/src/constant').MICROLINK_API_AUTHORIZATION
11
+ }
12
+ })
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../src/cli')
4
+ cli.flags.endpoint = 'https://next.microlink.io'
5
+ delete cli.flags.apiKey
6
+
7
+ require('../src/api')(cli, {
8
+ headers: {
9
+ authorization: require('../../api/src/constant').MICROLINK_API_AUTHORIZATION
10
+ }
11
+ })
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../src/cli')
4
+ cli.flags.endpoint = 'https://vercel.microlink.io'
5
+ require('../src/api')(cli)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microlink/cli",
3
3
  "description": "Interacting with Microlink API from your terminal.",
4
4
  "homepage": "https://github.com/microlinkhq/cli",
5
- "version": "2.1.40",
5
+ "version": "2.1.42",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "microlink": "bin/microlink",
@@ -40,7 +40,7 @@
40
40
  "mri": "~1.2.0",
41
41
  "nanospinner": "~1.2.2",
42
42
  "picocolors": "~1.1.1",
43
- "pretty-bytes": "~7.0.1",
43
+ "pretty-bytes": "5",
44
44
  "pretty-ms": "~7.0.1",
45
45
  "restore-cursor": "~3.1.0",
46
46
  "temperment": "~1.0.0",
package/src/api.js CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  require('update-notifier')({ pkg: require('../package.json') }).notify()
6
6
 
7
+ const getContentType = require('@kikobeats/content-type')
7
8
  const { URLSearchParams } = require('url')
8
9
  const clipboardy = require('clipboardy')
9
10
  const mql = require('@microlink/mql')
@@ -17,7 +18,7 @@ const print = require('./print')
17
18
  const exit = require('./exit')
18
19
 
19
20
  const microlinkUrl = () =>
20
- /^https?:\/\/((?!geolocation\.)[a-z0-9-]+\.)+microlink\.io/
21
+ /^https?:\/\/((?!fonts|geolocation\.)[a-z0-9-]+\.)+microlink\.io/
21
22
 
22
23
  const normalizeInput = input => {
23
24
  if (!input) return input
@@ -61,7 +62,7 @@ const render = ({ response, flags }) => {
61
62
  const { headers, timings, requestUrl: uri, body } = response
62
63
  if (!flags.pretty) return console.log(body.toString())
63
64
 
64
- const contentType = headers['content-type'].split(';')[0].toLowerCase()
65
+ const contentType = getContentType(headers['content-type'])
65
66
  const time = prettyMs(timings.phases.total)
66
67
  const serverTiming = headers['server-timing']
67
68
  const id = headers['x-request-id']