@waywake/youzanyun-sdk 2.0.0 → 2.0.2

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.
@@ -2,10 +2,11 @@
2
2
  * API 调用客户端
3
3
  */
4
4
  import type { ApiCallParams } from './types';
5
+ import * as utilHttp from './utils/http';
5
6
  /**
6
7
  * 发起接口调用
7
8
  *
8
9
  * @param apiParam 接口调用参数 { api, version, token?, params?, files?, config?, host? }
9
10
  */
10
- export declare function call(apiParam: ApiCallParams): Promise<import("axios").AxiosResponse<any, any, {}>>;
11
+ export declare function call(apiParam: ApiCallParams): Promise<utilHttp.HttpResponse<unknown>>;
11
12
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,aAAa,wDAgC3C"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAWzC;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,aAAa,2CAgC3C"}
package/dist/cjs/index.js CHANGED
@@ -98,35 +98,94 @@ function getUrlTextArea(api, version) {
98
98
 
99
99
  // src/utils/http.ts
100
100
  var import_fs = __toESM(require("fs"));
101
- var import_axios = __toESM(require("axios"));
102
- var import_form_data = __toESM(require("form-data"));
103
- var httpClient = import_axios.default.create({
104
- baseURL: getBaseUrl(),
105
- headers: {
106
- "User-Agent": "YZY-Open-Client 1.0.0 - Node"
101
+ var import_path = __toESM(require("path"));
102
+ var USER_AGENT = "YZY-Open-Client 1.0.0 - Node";
103
+
104
+ class HttpError extends Error {
105
+ response;
106
+ constructor(response) {
107
+ super(`Request failed with status code ${response.status}`);
108
+ this.name = "HttpError";
109
+ this.response = response;
107
110
  }
108
- });
111
+ }
112
+
113
+ class YouzanApiError extends Error {
114
+ response;
115
+ constructor(response) {
116
+ const data = response.data;
117
+ const message = typeof data.message === "string" ? data.message : "Youzan API request failed";
118
+ super(message);
119
+ this.name = "YouzanApiError";
120
+ this.response = response;
121
+ }
122
+ }
123
+ function getRequestUrl(url) {
124
+ return new URL(url, getBaseUrl()).toString();
125
+ }
126
+ function headersToObject(headers) {
127
+ const result = {};
128
+ headers.forEach((value, key) => {
129
+ result[key] = value;
130
+ });
131
+ return result;
132
+ }
133
+ async function parseResponseBody(resp) {
134
+ const text = await resp.text();
135
+ if (text === "") {
136
+ return null;
137
+ }
138
+ const contentType = resp.headers.get("content-type");
139
+ if (contentType?.includes("application/json")) {
140
+ return JSON.parse(text);
141
+ }
142
+ return text;
143
+ }
144
+ async function toHttpResponse(resp) {
145
+ const response = {
146
+ data: await parseResponseBody(resp),
147
+ status: resp.status,
148
+ statusText: resp.statusText,
149
+ headers: headersToObject(resp.headers),
150
+ url: resp.url
151
+ };
152
+ if (!resp.ok) {
153
+ throw new HttpError(response);
154
+ }
155
+ if (isFailedApiResponse(response.data)) {
156
+ throw new YouzanApiError(response);
157
+ }
158
+ return response;
159
+ }
160
+ function isFailedApiResponse(data) {
161
+ return typeof data === "object" && data !== null && "success" in data && data.success === false;
162
+ }
109
163
  async function post(url, params) {
110
- const resp = await httpClient.post(url, params, {
111
- headers: { "Content-type": "application/json;charset=UTF-8" }
164
+ const resp = await fetch(getRequestUrl(url), {
165
+ method: "POST",
166
+ headers: {
167
+ "User-Agent": USER_AGENT,
168
+ "Content-type": "application/json;charset=UTF-8"
169
+ },
170
+ body: params === undefined ? undefined : JSON.stringify(params)
112
171
  });
113
- return resp;
172
+ return toHttpResponse(resp);
114
173
  }
115
174
  async function upload(url, files) {
116
- const form = new import_form_data.default;
117
- if (files instanceof Map) {
118
- files.forEach((filePath, key) => {
119
- form.append(key, import_fs.default.createReadStream(filePath));
120
- });
121
- } else {
122
- for (const [key, filePath] of Object.entries(files)) {
123
- form.append(key, import_fs.default.createReadStream(filePath));
124
- }
175
+ const form = new FormData;
176
+ for (const [key, filePath] of files instanceof Map ? files : Object.entries(files)) {
177
+ const data = await import_fs.default.promises.readFile(filePath);
178
+ const blob = new Blob([new Uint8Array(data)]);
179
+ form.append(key, blob, import_path.default.basename(filePath));
125
180
  }
126
- const resp = await httpClient.post(url, form, {
127
- headers: form.getHeaders()
181
+ const resp = await fetch(getRequestUrl(url), {
182
+ method: "POST",
183
+ headers: {
184
+ "User-Agent": USER_AGENT
185
+ },
186
+ body: form
128
187
  });
129
- return resp;
188
+ return toHttpResponse(resp);
130
189
  }
131
190
 
132
191
  // src/client.ts
@@ -2,6 +2,7 @@
2
2
  * Token 管理
3
3
  */
4
4
  import type { TokenParams } from './types';
5
+ import * as utilHttp from './utils/http';
5
6
  /**
6
7
  * 获取 Token
7
8
  *
@@ -11,5 +12,5 @@ import type { TokenParams } from './types';
11
12
  * 工具型应用获取 Token: authorize_type = authorization_code, 必传 code redirect_uri
12
13
  * 工具型应用/自用型应用刷新 Token: authorize_type = refresh_token, 必传 refresh_token
13
14
  */
14
- export declare function get(params: TokenParams): Promise<import("axios").AxiosResponse<any, any, {}>>;
15
+ export declare function get(params: TokenParams): Promise<utilHttp.HttpResponse<unknown>>;
15
16
  //# sourceMappingURL=token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/token.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAU3C;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,WAAW,wDA4CtC"}
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/token.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAQzC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,WAAW,2CA4CtC"}
@@ -1,18 +1,33 @@
1
1
  /**
2
2
  * HTTP 请求工具
3
3
  */
4
+ export interface HttpResponse<T = unknown> {
5
+ data: T;
6
+ status: number;
7
+ statusText: string;
8
+ headers: Record<string, string>;
9
+ url: string;
10
+ }
11
+ export declare class HttpError<T = unknown> extends Error {
12
+ response: HttpResponse<T>;
13
+ constructor(response: HttpResponse<T>);
14
+ }
15
+ export declare class YouzanApiError<T = unknown> extends Error {
16
+ response: HttpResponse<T>;
17
+ constructor(response: HttpResponse<T>);
18
+ }
4
19
  /**
5
20
  * 发起 POST 请求
6
21
  *
7
22
  * @param url 支持绝对路径、相对路径
8
23
  * @param params POST 参数
9
24
  */
10
- export declare function post(url: string, params?: Record<string, unknown>): Promise<import("axios").AxiosResponse<any, any, {}>>;
25
+ export declare function post(url: string, params?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
11
26
  /**
12
27
  * 发起上传文件请求
13
28
  *
14
29
  * @param url 支持绝对路径、相对路径
15
30
  * @param files 上传文件参数,支持 Map 或 Object。示例: {"image": "/path/to/filename.jpg"}
16
31
  */
17
- export declare function upload(url: string, files: Map<string, string> | Record<string, string>): Promise<import("axios").AxiosResponse<any, any, {}>>;
32
+ export declare function upload(url: string, files: Map<string, string> | Record<string, string>): Promise<HttpResponse<unknown>>;
18
33
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,wDAKvE;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,wDAiB5F"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,qBAAa,SAAS,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,KAAK;IAC/C,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;gBAEd,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;CAKtC;AAED,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,KAAK;IACpD,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;gBAEd,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;CAQtC;AAoDD;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kCAUvE;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kCAiB5F"}
@@ -2,10 +2,11 @@
2
2
  * API 调用客户端
3
3
  */
4
4
  import type { ApiCallParams } from './types';
5
+ import * as utilHttp from './utils/http';
5
6
  /**
6
7
  * 发起接口调用
7
8
  *
8
9
  * @param apiParam 接口调用参数 { api, version, token?, params?, files?, config?, host? }
9
10
  */
10
- export declare function call(apiParam: ApiCallParams): Promise<import("axios").AxiosResponse<any, any, {}>>;
11
+ export declare function call(apiParam: ApiCallParams): Promise<utilHttp.HttpResponse<unknown>>;
11
12
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,aAAa,wDAgC3C"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAWzC;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,aAAa,2CAgC3C"}
package/dist/esm/index.js CHANGED
@@ -39,35 +39,94 @@ function getUrlTextArea(api, version) {
39
39
 
40
40
  // src/utils/http.ts
41
41
  import fs from "fs";
42
- import axios from "axios";
43
- import FormData from "form-data";
44
- var httpClient = axios.create({
45
- baseURL: getBaseUrl(),
46
- headers: {
47
- "User-Agent": "YZY-Open-Client 1.0.0 - Node"
42
+ import path from "path";
43
+ var USER_AGENT = "YZY-Open-Client 1.0.0 - Node";
44
+
45
+ class HttpError extends Error {
46
+ response;
47
+ constructor(response) {
48
+ super(`Request failed with status code ${response.status}`);
49
+ this.name = "HttpError";
50
+ this.response = response;
48
51
  }
49
- });
52
+ }
53
+
54
+ class YouzanApiError extends Error {
55
+ response;
56
+ constructor(response) {
57
+ const data = response.data;
58
+ const message = typeof data.message === "string" ? data.message : "Youzan API request failed";
59
+ super(message);
60
+ this.name = "YouzanApiError";
61
+ this.response = response;
62
+ }
63
+ }
64
+ function getRequestUrl(url) {
65
+ return new URL(url, getBaseUrl()).toString();
66
+ }
67
+ function headersToObject(headers) {
68
+ const result = {};
69
+ headers.forEach((value, key) => {
70
+ result[key] = value;
71
+ });
72
+ return result;
73
+ }
74
+ async function parseResponseBody(resp) {
75
+ const text = await resp.text();
76
+ if (text === "") {
77
+ return null;
78
+ }
79
+ const contentType = resp.headers.get("content-type");
80
+ if (contentType?.includes("application/json")) {
81
+ return JSON.parse(text);
82
+ }
83
+ return text;
84
+ }
85
+ async function toHttpResponse(resp) {
86
+ const response = {
87
+ data: await parseResponseBody(resp),
88
+ status: resp.status,
89
+ statusText: resp.statusText,
90
+ headers: headersToObject(resp.headers),
91
+ url: resp.url
92
+ };
93
+ if (!resp.ok) {
94
+ throw new HttpError(response);
95
+ }
96
+ if (isFailedApiResponse(response.data)) {
97
+ throw new YouzanApiError(response);
98
+ }
99
+ return response;
100
+ }
101
+ function isFailedApiResponse(data) {
102
+ return typeof data === "object" && data !== null && "success" in data && data.success === false;
103
+ }
50
104
  async function post(url, params) {
51
- const resp = await httpClient.post(url, params, {
52
- headers: { "Content-type": "application/json;charset=UTF-8" }
105
+ const resp = await fetch(getRequestUrl(url), {
106
+ method: "POST",
107
+ headers: {
108
+ "User-Agent": USER_AGENT,
109
+ "Content-type": "application/json;charset=UTF-8"
110
+ },
111
+ body: params === undefined ? undefined : JSON.stringify(params)
53
112
  });
54
- return resp;
113
+ return toHttpResponse(resp);
55
114
  }
56
115
  async function upload(url, files) {
57
116
  const form = new FormData;
58
- if (files instanceof Map) {
59
- files.forEach((filePath, key) => {
60
- form.append(key, fs.createReadStream(filePath));
61
- });
62
- } else {
63
- for (const [key, filePath] of Object.entries(files)) {
64
- form.append(key, fs.createReadStream(filePath));
65
- }
117
+ for (const [key, filePath] of files instanceof Map ? files : Object.entries(files)) {
118
+ const data = await fs.promises.readFile(filePath);
119
+ const blob = new Blob([new Uint8Array(data)]);
120
+ form.append(key, blob, path.basename(filePath));
66
121
  }
67
- const resp = await httpClient.post(url, form, {
68
- headers: form.getHeaders()
122
+ const resp = await fetch(getRequestUrl(url), {
123
+ method: "POST",
124
+ headers: {
125
+ "User-Agent": USER_AGENT
126
+ },
127
+ body: form
69
128
  });
70
- return resp;
129
+ return toHttpResponse(resp);
71
130
  }
72
131
 
73
132
  // src/client.ts
@@ -2,6 +2,7 @@
2
2
  * Token 管理
3
3
  */
4
4
  import type { TokenParams } from './types';
5
+ import * as utilHttp from './utils/http';
5
6
  /**
6
7
  * 获取 Token
7
8
  *
@@ -11,5 +12,5 @@ import type { TokenParams } from './types';
11
12
  * 工具型应用获取 Token: authorize_type = authorization_code, 必传 code redirect_uri
12
13
  * 工具型应用/自用型应用刷新 Token: authorize_type = refresh_token, 必传 refresh_token
13
14
  */
14
- export declare function get(params: TokenParams): Promise<import("axios").AxiosResponse<any, any, {}>>;
15
+ export declare function get(params: TokenParams): Promise<utilHttp.HttpResponse<unknown>>;
15
16
  //# sourceMappingURL=token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/token.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAU3C;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,WAAW,wDA4CtC"}
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/token.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,QAAQ,MAAM,cAAc,CAAC;AAQzC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,WAAW,2CA4CtC"}
@@ -1,18 +1,33 @@
1
1
  /**
2
2
  * HTTP 请求工具
3
3
  */
4
+ export interface HttpResponse<T = unknown> {
5
+ data: T;
6
+ status: number;
7
+ statusText: string;
8
+ headers: Record<string, string>;
9
+ url: string;
10
+ }
11
+ export declare class HttpError<T = unknown> extends Error {
12
+ response: HttpResponse<T>;
13
+ constructor(response: HttpResponse<T>);
14
+ }
15
+ export declare class YouzanApiError<T = unknown> extends Error {
16
+ response: HttpResponse<T>;
17
+ constructor(response: HttpResponse<T>);
18
+ }
4
19
  /**
5
20
  * 发起 POST 请求
6
21
  *
7
22
  * @param url 支持绝对路径、相对路径
8
23
  * @param params POST 参数
9
24
  */
10
- export declare function post(url: string, params?: Record<string, unknown>): Promise<import("axios").AxiosResponse<any, any, {}>>;
25
+ export declare function post(url: string, params?: Record<string, unknown>): Promise<HttpResponse<unknown>>;
11
26
  /**
12
27
  * 发起上传文件请求
13
28
  *
14
29
  * @param url 支持绝对路径、相对路径
15
30
  * @param files 上传文件参数,支持 Map 或 Object。示例: {"image": "/path/to/filename.jpg"}
16
31
  */
17
- export declare function upload(url: string, files: Map<string, string> | Record<string, string>): Promise<import("axios").AxiosResponse<any, any, {}>>;
32
+ export declare function upload(url: string, files: Map<string, string> | Record<string, string>): Promise<HttpResponse<unknown>>;
18
33
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,wDAKvE;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,wDAiB5F"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,qBAAa,SAAS,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,KAAK;IAC/C,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;gBAEd,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;CAKtC;AAED,qBAAa,cAAc,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,KAAK;IACpD,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;gBAEd,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;CAQtC;AAoDD;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kCAUvE;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kCAiB5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waywake/youzanyun-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "YouzanYun SDK for Node",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "scripts": {
25
25
  "build": "bun run build:cjs && bun run build:esm",
26
- "build:cjs": "bun build src/index.ts --outdir dist/cjs --target node --format cjs --external axios --external form-data && tsc -p tsconfig.cjs.json --emitDeclarationOnly && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
27
- "build:esm": "bun build src/index.ts --outdir dist/esm --target node --format esm --external axios --external form-data && tsc -p tsconfig.esm.json --emitDeclarationOnly",
26
+ "build:cjs": "bun build src/index.ts --outdir dist/cjs --target node --format cjs && tsc -p tsconfig.cjs.json --emitDeclarationOnly && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
27
+ "build:esm": "bun build src/index.ts --outdir dist/esm --target node --format esm && tsc -p tsconfig.esm.json --emitDeclarationOnly",
28
28
  "clean": "rm -rf dist",
29
29
  "test": "bun test",
30
30
  "prepublishOnly": "bun run clean && bun run build"
@@ -46,11 +46,7 @@
46
46
  "url": "https://github.com/waywake/youzan-sdk-ts/issues"
47
47
  },
48
48
  "engines": {
49
- "node": ">=16.0.0"
50
- },
51
- "dependencies": {
52
- "axios": "^1.7.0",
53
- "form-data": "^4.0.0"
49
+ "node": ">=18.0.0"
54
50
  },
55
51
  "devDependencies": {
56
52
  "@types/bun": "^1.1.0",