mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move node-fetch to separate package (#7009)
* move node-fetch to separate package Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix node-fetch package runtime error Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix test:unit nx dependency Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix test:unit nx dependency Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * Add prepare step for node-fetch Signed-off-by: Sebastian Malton <sebastian@malton.name> * Update lock Signed-off-by: Sebastian Malton <sebastian@malton.name> * Remove dead comment Signed-off-by: Sebastian Malton <sebastian@malton.name> * Remove unnecessary fetchModuleInjectable Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> Signed-off-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
591d9f30f3
commit
7e8ae3fded
13
nx.json
13
nx.json
@ -5,7 +5,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"cacheableOperations": [
|
"cacheableOperations": [
|
||||||
"build",
|
"build",
|
||||||
"prepare:dev"
|
"prepare:dev",
|
||||||
|
"prepare:lint"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20,6 +21,16 @@
|
|||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"prepare:dev"
|
"prepare:dev"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^prepare:test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test:unit": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^prepare:test"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { open } from "fs/promises";
|
|||||||
import type { WriteStream } from "fs-extra";
|
import type { WriteStream } from "fs-extra";
|
||||||
import { constants, ensureDir, unlink } from "fs-extra";
|
import { constants, ensureDir, unlink } from "fs-extra";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import type * as FetchModule from "node-fetch";
|
import type * as FetchModule from "@k8slens/node-fetch";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { pipeline as _pipeline, Transform, Writable } from "stream";
|
import { pipeline as _pipeline, Transform, Writable } from "stream";
|
||||||
import type { SingleBar } from "cli-progress";
|
import type { SingleBar } from "cli-progress";
|
||||||
|
|||||||
@ -47,11 +47,9 @@
|
|||||||
"author": "OpenLens Authors <info@k8slens.dev>",
|
"author": "OpenLens Authors <info@k8slens.dev>",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "env NODE_ENV=production yarn run webpack --config webpack/library-bundle.ts",
|
"build": "env NODE_ENV=production yarn run webpack --config webpack/library-bundle.ts",
|
||||||
"clean": "rm -rf dist webpack/build/ static/build",
|
"clean": "rm -rf dist static/build",
|
||||||
"compile:node-fetch": "yarn run webpack --config webpack/node-fetch.ts",
|
|
||||||
"prepare:dev": "env NODE_ENV=development yarn run webpack --config webpack/library-bundle.ts --progress",
|
"prepare:dev": "env NODE_ENV=development yarn run webpack --config webpack/library-bundle.ts --progress",
|
||||||
"dev": "env NODE_ENV=development yarn run webpack --config webpack/library-bundle.ts --watch",
|
"dev": "env NODE_ENV=development yarn run webpack --config webpack/library-bundle.ts --watch",
|
||||||
"prepare": "yarn run compile:node-fetch",
|
|
||||||
"test:unit": "jest --testPathIgnorePatterns integration",
|
"test:unit": "jest --testPathIgnorePatterns integration",
|
||||||
"test:watch": "func() { jest ${1} --watch --testPathIgnorePatterns integration; }; func",
|
"test:watch": "func() { jest ${1} --watch --testPathIgnorePatterns integration; }; func",
|
||||||
"lint": "PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .",
|
"lint": "PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .",
|
||||||
@ -105,13 +103,11 @@
|
|||||||
"^build"
|
"^build"
|
||||||
],
|
],
|
||||||
"outputs": [
|
"outputs": [
|
||||||
"{workspaceRoot}/build/webpack/",
|
|
||||||
"{workspaceRoot}/static/build/"
|
"{workspaceRoot}/static/build/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"outputs": [
|
"outputs": [
|
||||||
"{workspaceRoot}/build/webpack/",
|
|
||||||
"{workspaceRoot}/static/build/"
|
"{workspaceRoot}/static/build/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -124,6 +120,7 @@
|
|||||||
"@astronautlabs/jsonpath": "^1.1.0",
|
"@astronautlabs/jsonpath": "^1.1.0",
|
||||||
"@hapi/call": "^9.0.0",
|
"@hapi/call": "^9.0.0",
|
||||||
"@hapi/subtext": "^7.0.4",
|
"@hapi/subtext": "^7.0.4",
|
||||||
|
"@k8slens/node-fetch": "^6.4.0-alpha.4",
|
||||||
"@kubernetes/client-node": "^0.18.0",
|
"@kubernetes/client-node": "^0.18.0",
|
||||||
"@material-ui/styles": "^4.11.5",
|
"@material-ui/styles": "^4.11.5",
|
||||||
"@ogre-tools/fp": "^12.0.1",
|
"@ogre-tools/fp": "^12.0.1",
|
||||||
@ -166,7 +163,6 @@
|
|||||||
"mobx-utils": "^6.0.4",
|
"mobx-utils": "^6.0.4",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"moment-timezone": "^0.5.40",
|
"moment-timezone": "^0.5.40",
|
||||||
"node-fetch": "^3.3.0",
|
|
||||||
"node-pty": "0.10.1",
|
"node-pty": "0.10.1",
|
||||||
"npm": "^8.19.3",
|
"npm": "^8.19.3",
|
||||||
"p-limit": "^3.1.0",
|
"p-limit": "^3.1.0",
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { RequestInit, Response } from "node-fetch";
|
import type { RequestInit, Response } from "@k8slens/node-fetch";
|
||||||
import type { AsyncResult } from "../utils/async-result";
|
import type { AsyncResult } from "../utils/async-result";
|
||||||
import fetchInjectable from "./fetch.injectable";
|
import fetchInjectable from "./fetch.injectable";
|
||||||
|
|
||||||
@ -22,7 +22,6 @@ const downloadBinaryInjectable = getInjectable({
|
|||||||
let result: Response;
|
let result: Response;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// TODO: upgrade node-fetch once we switch to ESM
|
|
||||||
result = await fetch(url, opts as RequestInit);
|
result = await fetch(url, opts as RequestInit);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import type { AsyncResult } from "../../utils/async-result";
|
import type { AsyncResult } from "../../utils/async-result";
|
||||||
import type { Fetch } from "../fetch.injectable";
|
import type { Fetch } from "../fetch.injectable";
|
||||||
import type { RequestInit, Response } from "node-fetch";
|
import type { RequestInit, Response } from "@k8slens/node-fetch";
|
||||||
|
|
||||||
export interface DownloadJsonOptions {
|
export interface DownloadJsonOptions {
|
||||||
signal?: AbortSignal | null | undefined;
|
signal?: AbortSignal | null | undefined;
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import type * as FetchModule from "node-fetch";
|
|
||||||
|
|
||||||
const { NodeFetch } = require("../../../build/webpack/node-fetch.bundle") as { NodeFetch: typeof FetchModule };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE: while using this module can cause side effects, this specific injectable is not marked as
|
|
||||||
* such since sometimes the request can be wholely within the perview of unit test
|
|
||||||
*/
|
|
||||||
const nodeFetchModuleInjectable = getInjectable({
|
|
||||||
id: "node-fetch-module",
|
|
||||||
instantiate: () => NodeFetch,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default nodeFetchModuleInjectable;
|
|
||||||
@ -3,18 +3,14 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { RequestInit, Response } from "node-fetch";
|
import type { RequestInit, Response } from "@k8slens/node-fetch";
|
||||||
import nodeFetchModuleInjectable from "./fetch-module.injectable";
|
import fetch from "@k8slens/node-fetch";
|
||||||
|
|
||||||
export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
|
export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
|
||||||
|
|
||||||
const fetchInjectable = getInjectable({
|
const fetchInjectable = getInjectable({
|
||||||
id: "fetch",
|
id: "fetch",
|
||||||
instantiate: (di): Fetch => {
|
instantiate: () => fetch as Fetch,
|
||||||
const { default: fetch } = di.inject(nodeFetchModuleInjectable);
|
|
||||||
|
|
||||||
return (url, init) => fetch(url, init);
|
|
||||||
},
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Agent } from "https";
|
import { Agent } from "https";
|
||||||
import type { RequestInit, Response } from "node-fetch";
|
import type { RequestInit, Response } from "@k8slens/node-fetch";
|
||||||
import lensProxyPortInjectable from "../../main/lens-proxy/lens-proxy-port.injectable";
|
import lensProxyPortInjectable from "../../main/lens-proxy/lens-proxy-port.injectable";
|
||||||
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
||||||
import nodeFetchModuleInjectable from "./fetch-module.injectable";
|
import fetch from "@k8slens/node-fetch";
|
||||||
|
|
||||||
export type LensRequestInit = Omit<RequestInit, "agent">;
|
export type LensRequestInit = Omit<RequestInit, "agent">;
|
||||||
|
|
||||||
@ -16,7 +16,6 @@ export type LensFetch = (pathnameAndQuery: string, init?: LensRequestInit) => Pr
|
|||||||
const lensFetchInjectable = getInjectable({
|
const lensFetchInjectable = getInjectable({
|
||||||
id: "lens-fetch",
|
id: "lens-fetch",
|
||||||
instantiate: (di): LensFetch => {
|
instantiate: (di): LensFetch => {
|
||||||
const { default: fetch } = di.inject(nodeFetchModuleInjectable);
|
|
||||||
const lensProxyPort = di.inject(lensProxyPortInjectable);
|
const lensProxyPort = di.inject(lensProxyPortInjectable);
|
||||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Agent } from "https";
|
import { Agent } from "https";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "@k8slens/node-fetch";
|
||||||
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
||||||
import fetchInjectable from "../fetch/fetch.injectable";
|
import fetchInjectable from "../fetch/fetch.injectable";
|
||||||
import loggerInjectable from "../logger.injectable";
|
import loggerInjectable from "../logger.injectable";
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { AgentOptions } from "https";
|
import type { AgentOptions } from "https";
|
||||||
import { Agent } from "https";
|
import { Agent } from "https";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "@k8slens/node-fetch";
|
||||||
import loggerInjectable from "../logger.injectable";
|
import loggerInjectable from "../logger.injectable";
|
||||||
import isDevelopmentInjectable from "../vars/is-development.injectable";
|
import isDevelopmentInjectable from "../vars/is-development.injectable";
|
||||||
import createKubeJsonApiInjectable from "./create-kube-json-api.injectable";
|
import createKubeJsonApiInjectable from "./create-kube-json-api.injectable";
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Agent } from "https";
|
import { Agent } from "https";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "@k8slens/node-fetch";
|
||||||
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
import lensProxyCertificateInjectable from "../certificate/lens-proxy-certificate.injectable";
|
||||||
import fetchInjectable from "../fetch/fetch.injectable";
|
import fetchInjectable from "../fetch/fetch.injectable";
|
||||||
import loggerInjectable from "../logger.injectable";
|
import loggerInjectable from "../logger.injectable";
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
import { Agent as HttpAgent } from "http";
|
import { Agent as HttpAgent } from "http";
|
||||||
import { Agent as HttpsAgent } from "https";
|
import { Agent as HttpsAgent } from "https";
|
||||||
import { merge } from "lodash";
|
import { merge } from "lodash";
|
||||||
import type { Response, RequestInit } from "node-fetch";
|
import type { Response, RequestInit } from "@k8slens/node-fetch";
|
||||||
import { stringify } from "querystring";
|
import { stringify } from "querystring";
|
||||||
import type { Patch } from "rfc6902";
|
import type { Patch } from "rfc6902";
|
||||||
import type { PartialDeep, ValueOf } from "type-fest";
|
import type { PartialDeep, ValueOf } from "type-fest";
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import type { IKubeWatchEvent } from "./kube-watch-event";
|
|||||||
import type { KubeJsonApiData, KubeJsonApi } from "./kube-json-api";
|
import type { KubeJsonApiData, KubeJsonApi } from "./kube-json-api";
|
||||||
import type { Disposer } from "../utils";
|
import type { Disposer } from "../utils";
|
||||||
import { isDefined, noop, WrappedAbortController } from "../utils";
|
import { isDefined, noop, WrappedAbortController } from "../utils";
|
||||||
import type { RequestInit, Response } from "node-fetch";
|
import type { RequestInit, Response } from "@k8slens/node-fetch";
|
||||||
import type { Patch } from "rfc6902";
|
import type { Patch } from "rfc6902";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import type { PartialDeep } from "type-fest";
|
import type { PartialDeep } from "type-fest";
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import type { JsonApiData, JsonApiError } from "./json-api";
|
import type { JsonApiData, JsonApiError } from "./json-api";
|
||||||
import { JsonApi } from "./json-api";
|
import { JsonApi } from "./json-api";
|
||||||
import type { Response } from "node-fetch";
|
import type { Response } from "@k8slens/node-fetch";
|
||||||
import type { KubeJsonApiObjectMetadata } from "./kube-object";
|
import type { KubeJsonApiObjectMetadata } from "./kube-object";
|
||||||
|
|
||||||
export interface KubeJsonApiListMetadata {
|
export interface KubeJsonApiListMetadata {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import type { IKubeWatchEvent } from "./kube-watch-event";
|
|||||||
import { ItemStore } from "../item.store";
|
import { ItemStore } from "../item.store";
|
||||||
import type { KubeApiQueryParams, KubeApi, KubeApiWatchCallback } from "./kube-api";
|
import type { KubeApiQueryParams, KubeApi, KubeApiWatchCallback } from "./kube-api";
|
||||||
import { parseKubeApi } from "./kube-api-parse";
|
import { parseKubeApi } from "./kube-api-parse";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "@k8slens/node-fetch";
|
||||||
import type { Patch } from "rfc6902";
|
import type { Patch } from "rfc6902";
|
||||||
import type { Logger } from "../logger";
|
import type { Logger } from "../logger";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
|||||||
@ -30,7 +30,7 @@ import { storesAndApisCanBeCreatedInjectionToken } from "../../common/k8s-api/st
|
|||||||
import type { JsonApiConfig } from "../../common/k8s-api/json-api";
|
import type { JsonApiConfig } from "../../common/k8s-api/json-api";
|
||||||
import type { KubeJsonApi as InternalKubeJsonApi } from "../../common/k8s-api/kube-json-api";
|
import type { KubeJsonApi as InternalKubeJsonApi } from "../../common/k8s-api/kube-json-api";
|
||||||
import createKubeJsonApiInjectable from "../../common/k8s-api/create-kube-json-api.injectable";
|
import createKubeJsonApiInjectable from "../../common/k8s-api/create-kube-json-api.injectable";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "@k8slens/node-fetch";
|
||||||
import createKubeJsonApiForClusterInjectable from "../../common/k8s-api/create-kube-json-api-for-cluster.injectable";
|
import createKubeJsonApiForClusterInjectable from "../../common/k8s-api/create-kube-json-api-for-cluster.injectable";
|
||||||
|
|
||||||
export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable);
|
export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable);
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { Cluster } from "../common/cluster/cluster";
|
import type { Cluster } from "../common/cluster/cluster";
|
||||||
import nodeFetchModuleInjectable from "../common/fetch/fetch-module.injectable";
|
import { FormData } from "@k8slens/node-fetch";
|
||||||
import type { RequestMetricsParams } from "../common/k8s-api/endpoints/metrics.api/request-metrics.injectable";
|
import type { RequestMetricsParams } from "../common/k8s-api/endpoints/metrics.api/request-metrics.injectable";
|
||||||
import { object } from "../common/utils";
|
import { object } from "../common/utils";
|
||||||
import k8sRequestInjectable from "./k8s-request.injectable";
|
import k8sRequestInjectable from "./k8s-request.injectable";
|
||||||
@ -16,7 +16,6 @@ const getMetricsInjectable = getInjectable({
|
|||||||
|
|
||||||
instantiate: (di): GetMetrics => {
|
instantiate: (di): GetMetrics => {
|
||||||
const k8sRequest = di.inject(k8sRequestInjectable);
|
const k8sRequest = di.inject(k8sRequestInjectable);
|
||||||
const { FormData } = di.inject(nodeFetchModuleInjectable);
|
|
||||||
|
|
||||||
return async (
|
return async (
|
||||||
cluster,
|
cluster,
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { Response, Headers as NodeFetchHeaders } from "node-fetch";
|
import type { Response, Headers as NodeFetchHeaders } from "@k8slens/node-fetch";
|
||||||
import { PassThrough } from "stream";
|
import { PassThrough } from "stream";
|
||||||
|
|
||||||
export const createMockResponseFromString = (url: string, data: string, statusCode = 200) => {
|
export const createMockResponseFromString = (url: string, data: string, statusCode = 200) => {
|
||||||
|
|||||||
@ -65,7 +65,6 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
|||||||
},
|
},
|
||||||
externals: [
|
externals: [
|
||||||
{
|
{
|
||||||
"node-fetch": "commonjs node-fetch",
|
|
||||||
"win-ca": "commonjs win-ca",
|
"win-ca": "commonjs win-ca",
|
||||||
},
|
},
|
||||||
...additionalExternals,
|
...additionalExternals,
|
||||||
|
|||||||
@ -4879,11 +4879,6 @@ dashdash@^1.12.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
assert-plus "^1.0.0"
|
assert-plus "^1.0.0"
|
||||||
|
|
||||||
data-uri-to-buffer@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
|
|
||||||
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
|
|
||||||
|
|
||||||
data-urls@^2.0.0:
|
data-urls@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
|
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
|
||||||
@ -6324,14 +6319,6 @@ fecha@^4.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd"
|
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd"
|
||||||
integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
|
integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==
|
||||||
|
|
||||||
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
|
|
||||||
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
|
|
||||||
dependencies:
|
|
||||||
node-domexception "^1.0.0"
|
|
||||||
web-streams-polyfill "^3.0.3"
|
|
||||||
|
|
||||||
figures@^3.0.0:
|
figures@^3.0.0:
|
||||||
version "3.2.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
|
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
|
||||||
@ -6599,13 +6586,6 @@ form-data@~2.3.2:
|
|||||||
combined-stream "^1.0.6"
|
combined-stream "^1.0.6"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
formdata-polyfill@^4.0.10:
|
|
||||||
version "4.0.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
|
|
||||||
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
|
|
||||||
dependencies:
|
|
||||||
fetch-blob "^3.1.2"
|
|
||||||
|
|
||||||
forwarded@0.2.0:
|
forwarded@0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
||||||
@ -9773,20 +9753,6 @@ node-addon-api@^5.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.0.0.tgz#7d7e6f9ef89043befdb20c1989c905ebde18c501"
|
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.0.0.tgz#7d7e6f9ef89043befdb20c1989c905ebde18c501"
|
||||||
integrity sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==
|
integrity sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==
|
||||||
|
|
||||||
node-domexception@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
|
||||||
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
|
||||||
|
|
||||||
node-fetch@^3.3.0:
|
|
||||||
version "3.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.0.tgz#37e71db4ecc257057af828d523a7243d651d91e4"
|
|
||||||
integrity sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA==
|
|
||||||
dependencies:
|
|
||||||
data-uri-to-buffer "^4.0.0"
|
|
||||||
fetch-blob "^3.1.4"
|
|
||||||
formdata-polyfill "^4.0.10"
|
|
||||||
|
|
||||||
node-forge@^1, node-forge@^1.2.1:
|
node-forge@^1, node-forge@^1.2.1:
|
||||||
version "1.3.1"
|
version "1.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
|
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
|
||||||
@ -13475,11 +13441,6 @@ wcwidth@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
defaults "^1.0.3"
|
defaults "^1.0.3"
|
||||||
|
|
||||||
web-streams-polyfill@^3.0.3:
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
|
|
||||||
integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
|
|
||||||
|
|
||||||
webidl-conversions@^5.0.0:
|
webidl-conversions@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
|
||||||
|
|||||||
2
packages/node-fetch/.gitignore
vendored
Normal file
2
packages/node-fetch/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
27
packages/node-fetch/package.json
Normal file
27
packages/node-fetch/package.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "@k8slens/node-fetch",
|
||||||
|
"version": "6.4.0-alpha.4",
|
||||||
|
"description": "Node fetch for Lens",
|
||||||
|
"license": "MIT",
|
||||||
|
"private": false,
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rm -rf dist/",
|
||||||
|
"build": "webpack --config webpack.ts",
|
||||||
|
"lint": "exit 0",
|
||||||
|
"prepare": "npm run build",
|
||||||
|
"prepare:dev": "yarn run build",
|
||||||
|
"prepare:test": "yarn run build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"node-fetch": "^3.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ts-loader": "^9.4.2",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"typescript": "^4.9.4",
|
||||||
|
"webpack": "^5.75.0",
|
||||||
|
"webpack-cli": "^5.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
packages/node-fetch/src/index.ts
Normal file
4
packages/node-fetch/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import fetch from "node-fetch";
|
||||||
|
|
||||||
|
export * from "node-fetch";
|
||||||
|
export default fetch;
|
||||||
18
packages/node-fetch/tsconfig.json
Normal file
18
packages/node-fetch/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "dist/",
|
||||||
|
"paths": {
|
||||||
|
"*": [
|
||||||
|
"node_modules/*",
|
||||||
|
"types/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*",
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -5,12 +5,11 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
entry: "./node_modules/node-fetch/src/index.js",
|
entry: "./src/index.ts",
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "..", "build", "webpack"),
|
path: path.resolve(__dirname, "dist"),
|
||||||
filename: "node-fetch.bundle.js",
|
filename: "index.js",
|
||||||
library: {
|
library: {
|
||||||
name: "NodeFetch",
|
|
||||||
type: "commonjs",
|
type: "commonjs",
|
||||||
},
|
},
|
||||||
clean: true,
|
clean: true,
|
||||||
@ -25,7 +24,22 @@ export default {
|
|||||||
externalsPresets: {
|
externalsPresets: {
|
||||||
node: true,
|
node: true,
|
||||||
},
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(ts|tsx)$/,
|
||||||
|
loader: "ts-loader",
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
declaration: true,
|
||||||
|
sourceMap: false,
|
||||||
|
outDir: path.resolve("./dist/"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".js"],
|
extensions: [".ts"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
1030
packages/node-fetch/yarn.lock
Normal file
1030
packages/node-fetch/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ import { open } from "fs/promises";
|
|||||||
import type { WriteStream } from "fs-extra";
|
import type { WriteStream } from "fs-extra";
|
||||||
import { constants, ensureDir, unlink } from "fs-extra";
|
import { constants, ensureDir, unlink } from "fs-extra";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import type * as FetchModule from "node-fetch";
|
import type * as FetchModule from "@k8slens/node-fetch";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { pipeline as _pipeline, Transform, Writable } from "stream";
|
import { pipeline as _pipeline, Transform, Writable } from "stream";
|
||||||
import type { SingleBar } from "cli-progress";
|
import type { SingleBar } from "cli-progress";
|
||||||
|
|||||||
@ -201,6 +201,7 @@
|
|||||||
"mobx": "^6.7.0"
|
"mobx": "^6.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@k8slens/node-fetch": "^6.4.0-alpha.4",
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
||||||
"@swc/core": "^1.3.28",
|
"@swc/core": "^1.3.28",
|
||||||
"@swc/jest": "^0.2.24",
|
"@swc/jest": "^0.2.24",
|
||||||
@ -212,7 +213,6 @@
|
|||||||
"@types/gunzip-maybe": "^1.4.0",
|
"@types/gunzip-maybe": "^1.4.0",
|
||||||
"@types/lodash": "^4.14.191",
|
"@types/lodash": "^4.14.191",
|
||||||
"@types/node": "^16.18.6",
|
"@types/node": "^16.18.6",
|
||||||
"@types/node-fetch": "^2.6.2",
|
|
||||||
"@types/proper-lockfile": "^4.1.2",
|
"@types/proper-lockfile": "^4.1.2",
|
||||||
"@types/react-dom": "^17.0.16",
|
"@types/react-dom": "^17.0.16",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
|
|||||||
@ -50,7 +50,6 @@
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
externals: [
|
externals: [
|
||||||
"node-fetch",
|
|
||||||
"npm",
|
"npm",
|
||||||
"win-ca"
|
"win-ca"
|
||||||
],
|
],
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user