@youcan/cli-kit 2.4.3 → 2.4.4

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.
@@ -1,4 +1,3 @@
1
1
  import type { RequestInit } from 'node-fetch';
2
- export declare function scheme(): 'http' | 'https';
3
2
  export declare function get<T>(endpoint: string, options?: RequestInit): Promise<T>;
4
3
  export declare function post<T>(endpoint: string, options?: RequestInit): Promise<T>;
package/dist/node/http.js CHANGED
@@ -1,9 +1,11 @@
1
+ import https from 'node:https';
2
+ import process from 'node:process';
1
3
  import { isJson } from '../common/string.js';
2
4
  import fetch from 'node-fetch';
3
5
  import { is, mergeDeepLeft } from 'ramda';
4
6
  import './cli.js';
5
7
  import 'conf';
6
- import { get as get$1 } from './env.js';
8
+ import { get as get$2 } from './env.js';
7
9
  import './filesystem.js';
8
10
  import 'formdata-node';
9
11
  import 'formdata-node/file-from-path';
@@ -12,22 +14,21 @@ import 'execa';
12
14
  import 'find-process';
13
15
  import 'get-port';
14
16
  import 'tcp-port-used';
15
- import { get as get$2 } from './session.js';
17
+ import { get as get$1 } from './session.js';
16
18
  import 'kleur';
17
19
  import 'dayjs';
18
20
  import '../ui/components/DevOutput.js';
19
21
  import 'react';
20
22
  import 'ink';
21
23
 
22
- function scheme() {
23
- return get$1('HOST_ENV') === 'dev' ? 'http' : 'https';
24
- }
25
24
  async function agent() {
26
- const { Agent } = await import(scheme());
27
- return new Agent({ keepAlive: true, keepAliveMsecs: 5 * 60 * 1000 });
25
+ if (get$2('HOST_ENV') === 'dev') {
26
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
27
+ }
28
+ return new https.Agent({ keepAlive: true, keepAliveMsecs: 5 * 60 * 1000 });
28
29
  }
29
30
  async function defaults() {
30
- const session$1 = await get$2();
31
+ const session$1 = await get$1();
31
32
  return {
32
33
  agent: await agent(),
33
34
  headers: {
@@ -47,10 +48,10 @@ async function request(endpoint, options = {}) {
47
48
  return response.json();
48
49
  }
49
50
  async function get(endpoint, options = {}) {
50
- return request(`${scheme()}://${endpoint}`, { ...options, method: 'GET' });
51
+ return request(`https://${endpoint}`, { ...options, method: 'GET' });
51
52
  }
52
53
  async function post(endpoint, options = {}) {
53
- return request(`${scheme()}://${endpoint}`, { ...options, method: 'POST' });
54
+ return request(`https://${endpoint}`, { ...options, method: 'POST' });
54
55
  }
55
56
 
56
- export { get, post, scheme };
57
+ export { get, post };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/cli-kit",
3
3
  "type": "module",
4
- "version": "2.4.3",
4
+ "version": "2.4.4",
5
5
  "description": "Utilities for the YouCan CLI",
6
6
  "author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
7
7
  "license": "MIT",