@0xchain/request 1.1.0-beta.18 → 1.1.0-beta.19

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present 0xchain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -11,5 +11,6 @@ export interface ApiError extends AxiosError {
11
11
  }
12
12
  declare const axiosInstance: import('axios').AxiosInstance;
13
13
  export default axiosInstance;
14
- export type { ApiRequestConfig, Pagination, Status, IResponse, IFilters, IPageRequest, } from './types';
14
+ export { setServerHeaderProvider } from './interceptors/commonHeader';
15
+ export type { ApiRequestConfig, ServerHeaderProvider, Pagination, Status, IResponse, IFilters, IPageRequest, } from './types';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAQ/C,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,QAAA,MAAM,aAAa,+BAYjB,CAAC;AASH,eAAe,aAAa,CAAC;AAE7B,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAQ/C,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,QAAA,MAAM,aAAa,+BAYjB,CAAC;AASH,eAAe,aAAa,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -4,13 +4,17 @@ import jsCookie from "js-cookie";
4
4
  import { logger } from "@0xchain/logger";
5
5
  import TokenManager, { isTokenExpired, getToken, removeAllToken } from "@0xchain/token";
6
6
  const isSimplifiedChinese = () => {
7
- return /^(zh-hans|zh-cn|zh-sg|zh-my)$/.test(window == null ? void 0 : window.navigator.language.toLowerCase());
7
+ return /^(zh-hans|zh-cn|zh-sg|zh-my)$/.test(window?.navigator.language.toLowerCase());
8
8
  };
9
9
  const matchSystemLanguage = () => {
10
10
  return isSimplifiedChinese() ? "zh-hans" : "";
11
11
  };
12
12
  let httpAgent;
13
13
  let httpsAgent;
14
+ let serverHeaderProvider;
15
+ function setServerHeaderProvider(provider) {
16
+ serverHeaderProvider = provider;
17
+ }
14
18
  function isServerRuntime() {
15
19
  return typeof window === "undefined" || process.env.IS_SERVER === "true";
16
20
  }
@@ -22,51 +26,60 @@ function isNodeRuntime() {
22
26
  }
23
27
  function getHeader(config, key) {
24
28
  const h = config.headers;
25
- if ((h == null ? void 0 : h.get) && typeof h.get === "function") return h.get(key);
26
- return h == null ? void 0 : h[key];
29
+ if (h?.get && typeof h.get === "function") return h.get(key);
30
+ return h?.[key];
27
31
  }
28
32
  function setHeader(config, key, value) {
29
33
  const h = config.headers;
30
- if ((h == null ? void 0 : h.set) && typeof h.set === "function") {
34
+ if (h?.set && typeof h.set === "function") {
31
35
  h.set(key, value);
32
36
  } else {
33
37
  h[key] = value;
34
38
  }
35
39
  }
36
40
  async function commonHeader(config) {
37
- var _a, _b;
38
41
  let access_token = "";
39
42
  let language = "";
40
43
  if (isServerRuntime()) {
41
44
  if (isNodeRuntime()) {
42
45
  try {
43
46
  const http = await import("http");
44
- const https = await import("./__vite-browser-external-2Ng8QIWW.js");
45
- const baseURL = config == null ? void 0 : config.baseURL;
47
+ const https = await import("https");
48
+ const baseURL = config?.baseURL;
46
49
  const isHttps = typeof baseURL === "string" ? baseURL.startsWith("https://") : false;
47
- if (!httpAgent && (http == null ? void 0 : http.Agent)) httpAgent = new http.Agent({ keepAlive: true });
48
- if (!httpsAgent && (https == null ? void 0 : https.Agent)) httpsAgent = new https.Agent({ keepAlive: true });
50
+ if (!httpAgent && http?.Agent) httpAgent = new http.Agent({ keepAlive: true });
51
+ if (!httpsAgent && https?.Agent) httpsAgent = new https.Agent({ keepAlive: true });
49
52
  config.httpAgent = isHttps ? void 0 : httpAgent;
50
53
  config.httpsAgent = isHttps ? httpsAgent : void 0;
51
54
  } catch {
52
55
  }
53
56
  }
54
- try {
57
+ setHeader(config, "x-whistle-nohost-env", process.env.NO_HOST_ENV || "ichaingo");
58
+ if (serverHeaderProvider) {
55
59
  const startLanguage = getHeader(config, "Accept-Language");
56
- setHeader(config, "x-whistle-nohost-env", process.env.NO_HOST_ENV || "ichaingo");
57
- const { cookies, headers } = await import("next/headers");
58
- const cookieStore = await cookies();
59
- access_token = ((_a = cookieStore.get("access_token")) == null ? void 0 : _a.value) || "";
60
- const hList = await headers();
61
- language = startLanguage || hList.get("x-next-intl-locale") || "en";
62
- } catch (error) {
63
- console.error("Error accessing cookies in server component:", error);
60
+ try {
61
+ access_token = await serverHeaderProvider.getAccessToken() || "";
62
+ language = startLanguage || await serverHeaderProvider.getLanguage() || "en";
63
+ } catch (error) {
64
+ console.error("Error accessing server headers via provider:", error);
65
+ }
66
+ } else {
67
+ try {
68
+ const startLanguage = getHeader(config, "Accept-Language");
69
+ const { cookies, headers } = await import("next/headers");
70
+ const cookieStore = await cookies();
71
+ access_token = cookieStore.get("access_token")?.value || "";
72
+ const hList = await headers();
73
+ language = startLanguage || hList.get("x-next-intl-locale") || "en";
74
+ } catch (error) {
75
+ console.error("Error accessing cookies in server component:", error);
76
+ }
64
77
  }
65
78
  } else {
66
79
  access_token = jsCookie.get("access_token") || "";
67
80
  language = jsCookie.get("NEXT_LOCALE") || matchSystemLanguage() || "en";
68
81
  }
69
- const isRefreshToken = (_b = config.headers) == null ? void 0 : _b["isRefreshToken"];
82
+ const isRefreshToken = config.headers?.["isRefreshToken"];
70
83
  setHeader(config, "Accept-Language", language);
71
84
  if (access_token && !isRefreshToken) {
72
85
  setHeader(config, "Authorization", `Bearer ${access_token}`);
@@ -78,13 +91,12 @@ function toUpperMethod(m) {
78
91
  return m ? m.toUpperCase() : void 0;
79
92
  }
80
93
  function getTypeName(v) {
81
- var _a;
82
94
  if (v === null) return "null";
83
95
  if (v === void 0) return "undefined";
84
96
  const t = typeof v;
85
97
  if (t !== "object") return t;
86
98
  try {
87
- return ((_a = v == null ? void 0 : v.constructor) == null ? void 0 : _a.name) || "object";
99
+ return v?.constructor?.name || "object";
88
100
  } catch {
89
101
  return "object";
90
102
  }
@@ -105,15 +117,14 @@ function n(v) {
105
117
  return v === void 0 ? null : v;
106
118
  }
107
119
  function buildErrorMessage(err) {
108
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
109
- const method = toUpperMethod((_a = err.config) == null ? void 0 : _a.method);
110
- const baseURL = ((_b = err.config) == null ? void 0 : _b.baseURL) || "";
111
- const url = ((_c = err.config) == null ? void 0 : _c.url) ? `${baseURL || ""}${err.config.url}` : "";
112
- const status = (_d = err.response) == null ? void 0 : _d.status;
113
- const statusText = (_e = err.response) == null ? void 0 : _e.statusText;
114
- const respData = (_f = err.response) == null ? void 0 : _f.data;
115
- const requestId = ((_h = (_g = err.response) == null ? void 0 : _g.headers) == null ? void 0 : _h["x-request-id"]) || ((_i = respData == null ? void 0 : respData.status) == null ? void 0 : _i.requestId);
116
- const serverMsg = (respData == null ? void 0 : respData.message) || (respData == null ? void 0 : respData.msg) || ((_j = respData == null ? void 0 : respData.status) == null ? void 0 : _j.msg);
120
+ const method = toUpperMethod(err.config?.method);
121
+ const baseURL = err.config?.baseURL || "";
122
+ const url = err.config?.url ? `${baseURL || ""}${err.config.url}` : "";
123
+ const status = err.response?.status;
124
+ const statusText = err.response?.statusText;
125
+ const respData = err.response?.data;
126
+ const requestId = err.response?.headers?.["x-request-id"] || respData?.status?.requestId;
127
+ const serverMsg = respData?.message || respData?.msg || respData?.status?.msg;
117
128
  const summary = [
118
129
  status ? `HTTP ${status}` : "HTTP ERROR",
119
130
  method,
@@ -127,18 +138,17 @@ function buildErrorMessage(err) {
127
138
  return [summary, shortMsg, ridMsg, codeMsg, localMsg].filter(Boolean).join(" | ");
128
139
  }
129
140
  function buildDetails(err) {
130
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
131
141
  const cfg = err.config;
132
- let body = cfg == null ? void 0 : cfg.data;
142
+ let body = cfg?.data;
133
143
  if (typeof body === "string") {
134
144
  try {
135
145
  body = JSON.parse(body);
136
146
  } catch {
137
147
  }
138
148
  }
139
- const baseURL = cfg == null ? void 0 : cfg.baseURL;
140
- const url = (cfg == null ? void 0 : cfg.url) ? baseURL ? `${baseURL}${cfg.url}` : cfg.url : void 0;
141
- const requestId = ((_b = (_a = err.response) == null ? void 0 : _a.headers) == null ? void 0 : _b["x-request-id"]) || ((_e = (_d = (_c = err.response) == null ? void 0 : _c.data) == null ? void 0 : _d.status) == null ? void 0 : _e.requestId);
149
+ const baseURL = cfg?.baseURL;
150
+ const url = cfg?.url ? baseURL ? `${baseURL}${cfg.url}` : cfg.url : void 0;
151
+ const requestId = err.response?.headers?.["x-request-id"] || err.response?.data?.status?.requestId;
142
152
  return {
143
153
  // error 基础信息(保证不会被 stringify 成 {})
144
154
  name: n(err.name),
@@ -146,29 +156,28 @@ function buildDetails(err) {
146
156
  code: n(err.code),
147
157
  stack: n(err.stack),
148
158
  // request 信息
149
- method: n(toUpperMethod(cfg == null ? void 0 : cfg.method)),
159
+ method: n(toUpperMethod(cfg?.method)),
150
160
  baseURL: n(baseURL),
151
161
  url: n(url),
152
- timeout: n(cfg == null ? void 0 : cfg.timeout),
153
- withCredentials: n(cfg == null ? void 0 : cfg.withCredentials),
154
- params: n(cfg == null ? void 0 : cfg.params),
162
+ timeout: n(cfg?.timeout),
163
+ withCredentials: n(cfg?.withCredentials),
164
+ params: n(cfg?.params),
155
165
  data: n(body),
156
166
  // response 信息
157
- status: n((_f = err.response) == null ? void 0 : _f.status),
158
- statusText: n((_g = err.response) == null ? void 0 : _g.statusText),
167
+ status: n(err.response?.status),
168
+ statusText: n(err.response?.statusText),
159
169
  requestId: n(requestId),
160
- responseDataType: n(getTypeName((_h = err.response) == null ? void 0 : _h.data)),
161
- responseData: n(safeResponseData((_i = err.response) == null ? void 0 : _i.data))
170
+ responseDataType: n(getTypeName(err.response?.data)),
171
+ responseData: n(safeResponseData(err.response?.data))
162
172
  };
163
173
  }
164
174
  function errorInterceptor(error) {
165
- var _a, _b, _c;
166
175
  const err = isAxiosError(error) ? error : new AxiosError(String(error));
167
176
  const isTimeout = err.code === "ECONNABORTED" || /timeout/i.test(err.message || "");
168
177
  if (isTimeout) {
169
- const method = toUpperMethod((_a = err.config) == null ? void 0 : _a.method);
170
- const baseURL = ((_b = err.config) == null ? void 0 : _b.baseURL) || "";
171
- const url = ((_c = err.config) == null ? void 0 : _c.url) ? `${baseURL || ""}${err.config.url}` : "";
178
+ const method = toUpperMethod(err.config?.method);
179
+ const baseURL = err.config?.baseURL || "";
180
+ const url = err.config?.url ? `${baseURL || ""}${err.config.url}` : "";
172
181
  const summary = [`TIMEOUT`, method, url].filter(Boolean).join(" | ");
173
182
  err.summary = summary;
174
183
  err.details = buildDetails(err);
@@ -182,7 +191,6 @@ function errorInterceptor(error) {
182
191
  return Promise.reject(err);
183
192
  }
184
193
  function ResponseInterceptor(response) {
185
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
186
194
  const config = response.config;
187
195
  if (config.returnFullResponse) {
188
196
  return response;
@@ -194,27 +202,26 @@ function ResponseInterceptor(response) {
194
202
  return response;
195
203
  }
196
204
  if (response.status === 200) {
197
- if ((_a = response.headers["content-type"]) == null ? void 0 : _a.includes("text/event-stream")) {
205
+ if (response.headers["content-type"]?.includes("text/event-stream")) {
198
206
  return response;
199
207
  }
200
208
  const data = response.data;
201
209
  const businessStatus = data.status;
202
210
  if (businessStatus && typeof businessStatus.code === "number" && ![0, 200].includes(businessStatus.code) && businessStatus.code !== 401) {
203
211
  const err = new AxiosError(
204
- (businessStatus == null ? void 0 : businessStatus.msg) || "Business error",
212
+ businessStatus?.msg || "Business error",
205
213
  String(businessStatus.code),
206
214
  response.config,
207
215
  response.request,
208
216
  response
209
217
  );
210
- const summary = `BIZ ${businessStatus.code} | ${(_c = (_b = response.config) == null ? void 0 : _b.method) == null ? void 0 : _c.toUpperCase()} | ${((_d = response.config) == null ? void 0 : _d.baseURL) || ""}${((_e = response.config) == null ? void 0 : _e.url) || ""} | server: ${businessStatus == null ? void 0 : businessStatus.msg}`;
218
+ const summary = `BIZ ${businessStatus.code} | ${response.config?.method?.toUpperCase()} | ${response.config?.baseURL || ""}${response.config?.url || ""} | server: ${businessStatus?.msg}`;
211
219
  const details = {
212
- method: (_g = (_f = response.config) == null ? void 0 : _f.method) == null ? void 0 : _g.toUpperCase(),
213
- url: ((_h = response.config) == null ? void 0 : _h.baseURL) ? `${response.config.baseURL}${response.config.url || ""}` : response.config.url,
214
- params: (_i = response.config) == null ? void 0 : _i.params,
220
+ method: response.config?.method?.toUpperCase(),
221
+ url: response.config?.baseURL ? `${response.config.baseURL}${response.config.url || ""}` : response.config.url,
222
+ params: response.config?.params,
215
223
  data: (() => {
216
- var _a2;
217
- let d = (_a2 = response.config) == null ? void 0 : _a2.data;
224
+ let d = response.config?.data;
218
225
  if (typeof d === "string") {
219
226
  try {
220
227
  d = JSON.parse(d);
@@ -225,7 +232,7 @@ function ResponseInterceptor(response) {
225
232
  })(),
226
233
  status: response.status,
227
234
  statusText: response.statusText,
228
- requestId: ((_j = response.headers) == null ? void 0 : _j["x-request-id"]) || (businessStatus == null ? void 0 : businessStatus.requestId),
235
+ requestId: response.headers?.["x-request-id"] || businessStatus?.requestId,
229
236
  responseData: data
230
237
  };
231
238
  if (process.env.NODE_ENV !== "development") {
@@ -288,8 +295,7 @@ async function refreshToken(config) {
288
295
  ...refreshHeaders
289
296
  }
290
297
  }).then((res) => {
291
- var _a;
292
- if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) {
298
+ if (res?.data?.data) {
293
299
  return res.data.data;
294
300
  } else {
295
301
  removeAllToken();
@@ -321,5 +327,6 @@ axiosInstance.interceptors.request.use(refreshToken);
321
327
  axiosInstance.interceptors.request.use(commonHeader, errorInterceptor);
322
328
  axiosInstance.interceptors.response.use(ResponseInterceptor, errorInterceptor);
323
329
  export {
324
- axiosInstance as default
330
+ axiosInstance as default,
331
+ setServerHeaderProvider
325
332
  };
@@ -1,3 +1,5 @@
1
1
  import { InternalAxiosRequestConfig } from 'axios';
2
+ import { ServerHeaderProvider } from '../types';
3
+ export declare function setServerHeaderProvider(provider: ServerHeaderProvider): void;
2
4
  export declare function commonHeader(config: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig<any>>;
3
5
  //# sourceMappingURL=commonHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonHeader.d.ts","sourceRoot":"","sources":["../../src/interceptors/commonHeader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAiCrE,wBAAsB,YAAY,CAChC,MAAM,EAAE,0BAA0B,4CA+CnC"}
1
+ {"version":3,"file":"commonHeader.d.ts","sourceRoot":"","sources":["../../src/interceptors/commonHeader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOrD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,QAErE;AA6BD,wBAAsB,YAAY,CAChC,MAAM,EAAE,0BAA0B,4CAwDnC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
+ export interface ServerHeaderProvider {
3
+ getAccessToken(): Promise<string | undefined>;
4
+ getLanguage(): Promise<string | undefined>;
5
+ }
2
6
  export interface ApiRequestConfig extends AxiosRequestConfig {
3
7
  withCredentials?: boolean;
4
8
  returnFullResponse?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"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G,CAAC;CACzB;AAED;;EAEE;AACF,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB;AACD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xchain/request",
3
- "version": "1.1.0-beta.18",
3
+ "version": "1.1.0-beta.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -17,17 +17,28 @@
17
17
  "dist",
18
18
  "!**/*.tsbuildinfo"
19
19
  ],
20
+ "peerDependencies": {
21
+ "axios": "1.13.2",
22
+ "js-cookie": "3.0.5",
23
+ "next": "16.1.6",
24
+ "qs": "6.14.0"
25
+ },
20
26
  "devDependencies": {
21
27
  "@types/js-cookie": "3.0.6",
22
- "@types/qs": "6.14.0"
23
- },
24
- "dependencies": {
28
+ "@types/qs": "6.14.0",
25
29
  "axios": "1.13.2",
26
30
  "js-cookie": "3.0.5",
27
31
  "next": "16.1.6",
28
- "qs": "6.14.0",
29
- "@0xchain/logger": "1.1.0-beta.18",
30
- "@0xchain/token": "1.1.0-beta.18"
32
+ "qs": "6.14.0"
33
+ },
34
+ "dependencies": {
35
+ "@0xchain/logger": "1.1.0-beta.19",
36
+ "@0xchain/token": "1.1.0-beta.19"
37
+ },
38
+ "nx": {
39
+ "tags": [
40
+ "type:util"
41
+ ]
31
42
  },
32
43
  "publishConfig": {
33
44
  "access": "public"
@@ -1,4 +0,0 @@
1
- const __viteBrowserExternal = {};
2
- export {
3
- __viteBrowserExternal as default
4
- };