@ledgerhq/speculos-transport 0.1.8-fix-build-number-pre.0
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/.eslintrc.js +33 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +4 -0
- package/CHANGELOG.md +132 -0
- package/LICENSE.txt +21 -0
- package/README.md +38 -0
- package/lib/index.d.ts +69 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +280 -0
- package/lib/index.js.map +1 -0
- package/lib-es/index.d.ts +69 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +270 -0
- package/lib-es/index.js.map +1 -0
- package/package.json +59 -0
- package/src/index.ts +340 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ChildProcessWithoutNullStreams } from "child_process";
|
|
3
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
4
|
+
import SpeculosTransportHttp from "@ledgerhq/hw-transport-node-speculos-http";
|
|
5
|
+
import SpeculosTransportWebsocket from "@ledgerhq/hw-transport-node-speculos";
|
|
6
|
+
export type SpeculosDevice = {
|
|
7
|
+
transport: SpeculosTransport;
|
|
8
|
+
id: string;
|
|
9
|
+
appPath: string;
|
|
10
|
+
ports: ReturnType<typeof getPorts>;
|
|
11
|
+
};
|
|
12
|
+
export type SpeculosTransport = SpeculosTransportHttp | SpeculosTransportWebsocket;
|
|
13
|
+
export { DeviceModelId };
|
|
14
|
+
export type SpeculosDeviceInternal = {
|
|
15
|
+
process: ChildProcessWithoutNullStreams;
|
|
16
|
+
apduPort: number;
|
|
17
|
+
buttonPort: number;
|
|
18
|
+
automationPort: number;
|
|
19
|
+
transport: SpeculosTransportWebsocket;
|
|
20
|
+
destroy: () => void;
|
|
21
|
+
} | {
|
|
22
|
+
process: ChildProcessWithoutNullStreams;
|
|
23
|
+
apiPort: string | undefined;
|
|
24
|
+
transport: SpeculosTransportHttp;
|
|
25
|
+
destroy: () => void;
|
|
26
|
+
};
|
|
27
|
+
export declare function getMemorySpeculosDeviceInternal(id: string): SpeculosDeviceInternal | undefined;
|
|
28
|
+
export declare const modelMap: Record<string, DeviceModelId>;
|
|
29
|
+
/**
|
|
30
|
+
* Release a speculos device
|
|
31
|
+
*/
|
|
32
|
+
export declare function releaseSpeculosDevice(id: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Close all speculos devices
|
|
35
|
+
*/
|
|
36
|
+
export declare function closeAllSpeculosDevices(): Promise<void[]>;
|
|
37
|
+
declare const getPorts: (idCounter: number, isSpeculosWebsocket?: boolean) => {
|
|
38
|
+
apduPort: number;
|
|
39
|
+
vncPort: number;
|
|
40
|
+
buttonPort: number;
|
|
41
|
+
automationPort: number;
|
|
42
|
+
apiPort?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
apiPort: number;
|
|
45
|
+
vncPort: number;
|
|
46
|
+
apduPort?: undefined;
|
|
47
|
+
buttonPort?: undefined;
|
|
48
|
+
automationPort?: undefined;
|
|
49
|
+
};
|
|
50
|
+
interface Dependency {
|
|
51
|
+
name: string;
|
|
52
|
+
appVersion?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* instanciate a speculos device that runs through docker
|
|
56
|
+
*/
|
|
57
|
+
export declare function createSpeculosDevice(arg: {
|
|
58
|
+
model: DeviceModelId;
|
|
59
|
+
firmware: string;
|
|
60
|
+
appName: string;
|
|
61
|
+
appVersion: string;
|
|
62
|
+
dependency?: string;
|
|
63
|
+
dependencies?: Dependency[];
|
|
64
|
+
seed: string;
|
|
65
|
+
coinapps: string;
|
|
66
|
+
overridesAppPath?: string;
|
|
67
|
+
onSpeculosDeviceCreated?: (device: SpeculosDevice) => Promise<void>;
|
|
68
|
+
}, maxRetry?: number): Promise<SpeculosDevice>;
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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B,OAAO;;;;;;;;;;;;CAcjE,CAAC;AAWF,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAC;IAEjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE,EACD,QAAQ,SAAI,GACX,OAAO,CAAC,cAAc,CAAC,CAuMzB"}
|
package/lib-es/index.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { spawn, exec } from "child_process";
|
|
11
|
+
import { log } from "@ledgerhq/logs";
|
|
12
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
13
|
+
import SpeculosTransportHttp from "@ledgerhq/hw-transport-node-speculos-http";
|
|
14
|
+
import SpeculosTransportWebsocket from "@ledgerhq/hw-transport-node-speculos";
|
|
15
|
+
import { getEnv } from "@ledgerhq/live-env";
|
|
16
|
+
import { delay } from "@ledgerhq/live-promise";
|
|
17
|
+
export { DeviceModelId };
|
|
18
|
+
// FIXME we need to figure out a better system, using a filesystem file?
|
|
19
|
+
let idCounter;
|
|
20
|
+
const isSpeculosWebsocket = getEnv("SPECULOS_USE_WEBSOCKET");
|
|
21
|
+
const data = {};
|
|
22
|
+
export function getMemorySpeculosDeviceInternal(id) {
|
|
23
|
+
return data[id];
|
|
24
|
+
}
|
|
25
|
+
export const modelMap = {
|
|
26
|
+
nanos: DeviceModelId.nanoS,
|
|
27
|
+
"nanos+": DeviceModelId.nanoSP,
|
|
28
|
+
nanox: DeviceModelId.nanoX,
|
|
29
|
+
blue: DeviceModelId.blue,
|
|
30
|
+
};
|
|
31
|
+
const reverseModelMap = {};
|
|
32
|
+
for (const k in modelMap) {
|
|
33
|
+
reverseModelMap[modelMap[k]] = k;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Release a speculos device
|
|
37
|
+
*/
|
|
38
|
+
export function releaseSpeculosDevice(id) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
log("speculos", "release " + id);
|
|
41
|
+
const obj = data[id];
|
|
42
|
+
if (obj) {
|
|
43
|
+
yield obj.destroy();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Close all speculos devices
|
|
49
|
+
*/
|
|
50
|
+
export function closeAllSpeculosDevices() {
|
|
51
|
+
return Promise.all(Object.keys(data).map(releaseSpeculosDevice));
|
|
52
|
+
}
|
|
53
|
+
// to keep in sync from https://github.com/LedgerHQ/speculos/tree/master/speculos/cxlib
|
|
54
|
+
const existingSdks = [
|
|
55
|
+
"nanos-cx-2.0.elf",
|
|
56
|
+
"nanos-cx-2.1.elf",
|
|
57
|
+
"nanosp-cx-1.0.3.elf",
|
|
58
|
+
"nanosp-cx-1.0.elf",
|
|
59
|
+
"nanox-cx-2.0.2.elf",
|
|
60
|
+
"nanox-cx-2.0.elf",
|
|
61
|
+
];
|
|
62
|
+
function inferSDK(firmware, model) {
|
|
63
|
+
const begin = `${model.toLowerCase()}-cx-`;
|
|
64
|
+
if (existingSdks.includes(begin + firmware + ".elf"))
|
|
65
|
+
return firmware;
|
|
66
|
+
const shortVersion = firmware.slice(0, 3);
|
|
67
|
+
if (existingSdks.includes(begin + shortVersion + ".elf"))
|
|
68
|
+
return shortVersion;
|
|
69
|
+
}
|
|
70
|
+
const getPorts = (idCounter, isSpeculosWebsocket) => {
|
|
71
|
+
if (isSpeculosWebsocket) {
|
|
72
|
+
const apduPort = 30000 + idCounter;
|
|
73
|
+
const vncPort = 35000 + idCounter;
|
|
74
|
+
const buttonPort = 40000 + idCounter;
|
|
75
|
+
const automationPort = 45000 + idCounter;
|
|
76
|
+
return { apduPort, vncPort, buttonPort, automationPort };
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const apiPort = 30000 + idCounter;
|
|
80
|
+
const vncPort = 35000 + idCounter;
|
|
81
|
+
return { apiPort, vncPort };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function conventionalAppSubpath(model, firmware, appName, appVersion) {
|
|
85
|
+
return `${reverseModelMap[model]}/${firmware}/${appName.replace(/ /g, "")}/app_${appVersion}.elf`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* instanciate a speculos device that runs through docker
|
|
89
|
+
*/
|
|
90
|
+
export function createSpeculosDevice(arg_1) {
|
|
91
|
+
return __awaiter(this, arguments, void 0, function* (arg, maxRetry = 3) {
|
|
92
|
+
var _a, _b, _c;
|
|
93
|
+
const { overridesAppPath, model, firmware, appName, appVersion, seed, coinapps, dependency, dependencies, } = arg;
|
|
94
|
+
idCounter = idCounter !== null && idCounter !== void 0 ? idCounter : getEnv("SPECULOS_PID_OFFSET");
|
|
95
|
+
const speculosID = `speculosID-${++idCounter}`;
|
|
96
|
+
const ports = getPorts(idCounter, isSpeculosWebsocket);
|
|
97
|
+
const sdk = inferSDK(firmware, model);
|
|
98
|
+
const subpath = overridesAppPath || conventionalAppSubpath(model, firmware, appName, appVersion);
|
|
99
|
+
const appPath = `./apps/${subpath}`;
|
|
100
|
+
const params = [
|
|
101
|
+
"run",
|
|
102
|
+
"-v",
|
|
103
|
+
`${coinapps}:/speculos/apps`,
|
|
104
|
+
...(isSpeculosWebsocket
|
|
105
|
+
? [
|
|
106
|
+
// websocket ports
|
|
107
|
+
"-p",
|
|
108
|
+
`${ports.apduPort}:40000`,
|
|
109
|
+
"-p",
|
|
110
|
+
`${ports.vncPort}:41000`,
|
|
111
|
+
"-p",
|
|
112
|
+
`${ports.buttonPort}:42000`,
|
|
113
|
+
"-p",
|
|
114
|
+
`${ports.automationPort}:43000`,
|
|
115
|
+
]
|
|
116
|
+
: [
|
|
117
|
+
// http ports
|
|
118
|
+
"-p",
|
|
119
|
+
`${ports.apiPort}:40000`,
|
|
120
|
+
"-p",
|
|
121
|
+
`${ports.vncPort}:41000`,
|
|
122
|
+
]),
|
|
123
|
+
"-e",
|
|
124
|
+
`SPECULOS_APPNAME=${appName}:${appVersion}`,
|
|
125
|
+
"--name",
|
|
126
|
+
`${speculosID}`,
|
|
127
|
+
(_a = process.env.SPECULOS_IMAGE_TAG) !== null && _a !== void 0 ? _a : "ghcr.io/ledgerhq/speculos:sha-e262a0c",
|
|
128
|
+
"--model",
|
|
129
|
+
model.toLowerCase(),
|
|
130
|
+
appPath,
|
|
131
|
+
...(dependency
|
|
132
|
+
? [
|
|
133
|
+
"-l",
|
|
134
|
+
`${dependency}:./apps/${conventionalAppSubpath(model, firmware, dependency, appVersion)}`,
|
|
135
|
+
]
|
|
136
|
+
: []),
|
|
137
|
+
...(dependencies !== undefined
|
|
138
|
+
? dependencies.flatMap(dependency => [
|
|
139
|
+
"-l",
|
|
140
|
+
`${dependency.name}:./apps/${conventionalAppSubpath(model, firmware, dependency.name, dependency.appVersion ? dependency.appVersion : "1.0.0")}`,
|
|
141
|
+
])
|
|
142
|
+
: []),
|
|
143
|
+
...(sdk ? ["--sdk", sdk] : []),
|
|
144
|
+
"--display",
|
|
145
|
+
"headless",
|
|
146
|
+
...(process.env.CI ? ["--vnc-password", "live", "--vnc-port", "41000"] : []),
|
|
147
|
+
...(isSpeculosWebsocket
|
|
148
|
+
? [
|
|
149
|
+
// websocket ports
|
|
150
|
+
"--apdu-port",
|
|
151
|
+
"40000",
|
|
152
|
+
"--button-port",
|
|
153
|
+
"42000",
|
|
154
|
+
"--automation-port",
|
|
155
|
+
"43000",
|
|
156
|
+
]
|
|
157
|
+
: [
|
|
158
|
+
// http ports
|
|
159
|
+
"--api-port",
|
|
160
|
+
"40000",
|
|
161
|
+
]),
|
|
162
|
+
];
|
|
163
|
+
log("speculos", `${speculosID}: spawning = ${params.join(" ")}`);
|
|
164
|
+
const p = spawn("docker", [...params, "--seed", `${seed}`]);
|
|
165
|
+
let resolveReady;
|
|
166
|
+
let rejectReady;
|
|
167
|
+
const ready = new Promise((resolve, reject) => {
|
|
168
|
+
resolveReady = resolve;
|
|
169
|
+
rejectReady = reject;
|
|
170
|
+
});
|
|
171
|
+
let destroyed = false;
|
|
172
|
+
const destroy = () => {
|
|
173
|
+
if (destroyed)
|
|
174
|
+
return;
|
|
175
|
+
destroyed = true;
|
|
176
|
+
new Promise((resolve, reject) => {
|
|
177
|
+
if (!data[speculosID])
|
|
178
|
+
return;
|
|
179
|
+
delete data[speculosID];
|
|
180
|
+
exec(`docker rm -f ${speculosID}`, (error, stdout, stderr) => {
|
|
181
|
+
if (error) {
|
|
182
|
+
log("speculos-error", `${speculosID} not destroyed ${error} ${stderr}`);
|
|
183
|
+
reject(error);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
log("speculos", `destroyed ${speculosID}`);
|
|
187
|
+
resolve(undefined);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
p.stdout.on("data", data => {
|
|
193
|
+
if (data) {
|
|
194
|
+
log("speculos-stdout", `${speculosID}: ${String(data).trim()}`);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
let latestStderr;
|
|
198
|
+
p.stderr.on("data", data => {
|
|
199
|
+
if (!data)
|
|
200
|
+
return;
|
|
201
|
+
latestStderr = data;
|
|
202
|
+
if (!data.includes("apdu: ")) {
|
|
203
|
+
log("speculos-stderr", `${speculosID}: ${String(data).trim()}`);
|
|
204
|
+
}
|
|
205
|
+
if (/using\s(?:SDK|API_LEVEL)/.test(data)) {
|
|
206
|
+
setTimeout(() => resolveReady(true), 500);
|
|
207
|
+
}
|
|
208
|
+
else if (data.includes("is already in use by container")) {
|
|
209
|
+
rejectReady(new Error("speculos already in use! Try `ledger-live cleanSpeculos` or check logs"));
|
|
210
|
+
}
|
|
211
|
+
else if (data.includes("address already in use")) {
|
|
212
|
+
if (maxRetry > 0) {
|
|
213
|
+
log("speculos", "retrying speculos connection");
|
|
214
|
+
destroy();
|
|
215
|
+
resolveReady(false);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
p.on("close", () => {
|
|
220
|
+
log("speculos", `${speculosID} closed`);
|
|
221
|
+
if (!destroyed) {
|
|
222
|
+
destroy();
|
|
223
|
+
rejectReady(new Error(`speculos process failure. ${latestStderr || ""}`));
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
const hasSucceed = yield ready;
|
|
227
|
+
if (!hasSucceed) {
|
|
228
|
+
yield delay(1000);
|
|
229
|
+
return createSpeculosDevice(arg, maxRetry - 1);
|
|
230
|
+
}
|
|
231
|
+
let transport;
|
|
232
|
+
if (isSpeculosWebsocket) {
|
|
233
|
+
transport = yield SpeculosTransportWebsocket.open({
|
|
234
|
+
apduPort: ports === null || ports === void 0 ? void 0 : ports.apduPort,
|
|
235
|
+
buttonPort: ports === null || ports === void 0 ? void 0 : ports.buttonPort,
|
|
236
|
+
automationPort: ports === null || ports === void 0 ? void 0 : ports.automationPort,
|
|
237
|
+
});
|
|
238
|
+
data[speculosID] = {
|
|
239
|
+
process: p,
|
|
240
|
+
apduPort: ports.apduPort,
|
|
241
|
+
buttonPort: ports.buttonPort,
|
|
242
|
+
automationPort: ports.automationPort,
|
|
243
|
+
transport,
|
|
244
|
+
destroy,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
transport = yield SpeculosTransportHttp.open({
|
|
249
|
+
apiPort: (_b = ports.apiPort) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
250
|
+
});
|
|
251
|
+
data[speculosID] = {
|
|
252
|
+
process: p,
|
|
253
|
+
apiPort: (_c = ports.apiPort) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
254
|
+
transport,
|
|
255
|
+
destroy,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const device = {
|
|
259
|
+
id: speculosID,
|
|
260
|
+
transport,
|
|
261
|
+
appPath,
|
|
262
|
+
ports,
|
|
263
|
+
};
|
|
264
|
+
if (arg.onSpeculosDeviceCreated != null) {
|
|
265
|
+
yield arg.onSpeculosDeviceCreated(device);
|
|
266
|
+
}
|
|
267
|
+
return device;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAkC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,qBAAqB,MAAM,2CAA2C,CAAC;AAC9E,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,MAAM,EA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,EAAE,UAAU;YACd,SAAS;YACT,OAAO;YACP,KAAK;SACN,CAAC;QAEF,IAAI,GAAG,CAAC,uBAAuB,IAAI,IAAI,EAAE,CAAC;YACxC,MAAM,GAAG,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ledgerhq/speculos-transport",
|
|
3
|
+
"version": "0.1.8-fix-build-number-pre.0",
|
|
4
|
+
"description": "Ledger Live speculos transport test helper",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Ledger"
|
|
7
|
+
],
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/LedgerHQ/ledger-live/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/speculos-transport",
|
|
16
|
+
"main": "lib/index.js",
|
|
17
|
+
"module": "lib-es/index.js",
|
|
18
|
+
"types": "lib/index.d.ts",
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@ledgerhq/live-env": "2.4.1-fix-build-number-pre.0",
|
|
22
|
+
"@ledgerhq/live-promise": "0.1.0",
|
|
23
|
+
"@ledgerhq/logs": "6.12.0",
|
|
24
|
+
"@ledgerhq/devices": "8.4.4",
|
|
25
|
+
"@ledgerhq/hw-transport-node-speculos": "6.29.4",
|
|
26
|
+
"@ledgerhq/hw-transport-node-speculos-http": "6.29.4"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^20.8.10",
|
|
30
|
+
"documentation": "14.0.2"
|
|
31
|
+
},
|
|
32
|
+
"typesVersions": {
|
|
33
|
+
"*": {
|
|
34
|
+
"*.json": [
|
|
35
|
+
"*.json"
|
|
36
|
+
],
|
|
37
|
+
"*": [
|
|
38
|
+
"lib/*"
|
|
39
|
+
],
|
|
40
|
+
"lib/*": [
|
|
41
|
+
"lib/*"
|
|
42
|
+
],
|
|
43
|
+
"lib-es/*": [
|
|
44
|
+
"lib-es/*"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"clean": "rimraf lib lib-es",
|
|
50
|
+
"build": "tsc && tsc -m ES6 --outDir lib-es",
|
|
51
|
+
"prewatch": "pnpm build",
|
|
52
|
+
"watch": "tsc --watch",
|
|
53
|
+
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
|
|
54
|
+
"lint:fix": "pnpm lint --fix",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"unimported": "unimported",
|
|
57
|
+
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts"
|
|
58
|
+
}
|
|
59
|
+
}
|