@oniroproject/core 0.11.0 → 0.12.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/README.md +2 -2
- package/dist/index.cjs +39 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +39 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -146,6 +146,12 @@ interface SdkRelease {
|
|
|
146
146
|
linuxWindows: number;
|
|
147
147
|
darwin: number;
|
|
148
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Appended to the archive basename when the mirror re-published a release under a
|
|
151
|
+
* dated name (e.g. 7.0 ships `ohos-sdk-windows_linux-public_20260829.tar.gz`, whose
|
|
152
|
+
* components are the `-Release` build; the undated archive holds `-Beta` ones).
|
|
153
|
+
*/
|
|
154
|
+
archiveSuffix?: string;
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
157
|
* Known OpenHarmony SDK releases. Kept in sync with the bash CLI / extension.
|
|
@@ -171,8 +177,8 @@ interface SdkArchiveInfo {
|
|
|
171
177
|
*
|
|
172
178
|
* The Huawei mirror packages Linux and Windows together in one tarball with `linux/` and
|
|
173
179
|
* `windows/` subfolders; macOS tarballs have a deeper layout. The per-release strip counts
|
|
174
|
-
* live in {@link ALL_SDKS} (`tarballStrip`)
|
|
175
|
-
* historical default (linux/windows=1, darwin=3).
|
|
180
|
+
* live in {@link ALL_SDKS} (`tarballStrip`), as does any dated `archiveSuffix`. An
|
|
181
|
+
* unrecognized version falls back to the historical default (linux/windows=1, darwin=3).
|
|
176
182
|
*/
|
|
177
183
|
declare function getSdkFilename(version?: string): SdkArchiveInfo;
|
|
178
184
|
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,12 @@ interface SdkRelease {
|
|
|
146
146
|
linuxWindows: number;
|
|
147
147
|
darwin: number;
|
|
148
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Appended to the archive basename when the mirror re-published a release under a
|
|
151
|
+
* dated name (e.g. 7.0 ships `ohos-sdk-windows_linux-public_20260829.tar.gz`, whose
|
|
152
|
+
* components are the `-Release` build; the undated archive holds `-Beta` ones).
|
|
153
|
+
*/
|
|
154
|
+
archiveSuffix?: string;
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
157
|
* Known OpenHarmony SDK releases. Kept in sync with the bash CLI / extension.
|
|
@@ -171,8 +177,8 @@ interface SdkArchiveInfo {
|
|
|
171
177
|
*
|
|
172
178
|
* The Huawei mirror packages Linux and Windows together in one tarball with `linux/` and
|
|
173
179
|
* `windows/` subfolders; macOS tarballs have a deeper layout. The per-release strip counts
|
|
174
|
-
* live in {@link ALL_SDKS} (`tarballStrip`)
|
|
175
|
-
* historical default (linux/windows=1, darwin=3).
|
|
180
|
+
* live in {@link ALL_SDKS} (`tarballStrip`), as does any dated `archiveSuffix`. An
|
|
181
|
+
* unrecognized version falls back to the historical default (linux/windows=1, darwin=3).
|
|
176
182
|
*/
|
|
177
183
|
declare function getSdkFilename(version?: string): SdkArchiveInfo;
|
|
178
184
|
|
package/dist/index.js
CHANGED
|
@@ -171,7 +171,8 @@ var ALL_SDKS = [
|
|
|
171
171
|
{ version: "5.1.0", api: "18", tarballStrip: { linuxWindows: 1, darwin: 3 } },
|
|
172
172
|
{ version: "5.1.1", api: "19", tarballStrip: { linuxWindows: 1, darwin: 3 } },
|
|
173
173
|
{ version: "6.0", api: "20", tarballStrip: { linuxWindows: 0, darwin: 3 } },
|
|
174
|
-
{ version: "6.1", api: "23", tarballStrip: { linuxWindows: 0, darwin: 3 } }
|
|
174
|
+
{ version: "6.1", api: "23", tarballStrip: { linuxWindows: 0, darwin: 3 } },
|
|
175
|
+
{ version: "7.0", api: "26", tarballStrip: { linuxWindows: 1, darwin: 3 }, archiveSuffix: "_20260829" }
|
|
175
176
|
];
|
|
176
177
|
var OHOS_URL_BASE = "https://repo.huaweicloud.com/openharmony/os";
|
|
177
178
|
|
|
@@ -187,18 +188,20 @@ function getOsFolder() {
|
|
|
187
188
|
function getSdkFilename(version) {
|
|
188
189
|
const platform7 = os2.platform();
|
|
189
190
|
const v = version ?? ALL_SDKS[ALL_SDKS.length - 1].version;
|
|
190
|
-
const
|
|
191
|
+
const release = ALL_SDKS.find((r) => r.version === v);
|
|
192
|
+
const strips = release?.tarballStrip ?? { linuxWindows: 1, darwin: 3 };
|
|
193
|
+
const archive = (base) => `${base}${release?.archiveSuffix ?? ""}.tar.gz`;
|
|
191
194
|
if (platform7 === "linux") {
|
|
192
|
-
return { filename: "ohos-sdk-windows_linux-public
|
|
195
|
+
return { filename: archive("ohos-sdk-windows_linux-public"), osFolder: "linux", strip: strips.linuxWindows };
|
|
193
196
|
}
|
|
194
197
|
if (platform7 === "darwin") {
|
|
195
198
|
if (os2.arch() === "arm64") {
|
|
196
|
-
return { filename: "L2-SDK-MAC-M1-PUBLIC
|
|
199
|
+
return { filename: archive("L2-SDK-MAC-M1-PUBLIC"), osFolder: "darwin", strip: strips.darwin };
|
|
197
200
|
}
|
|
198
|
-
return { filename: "ohos-sdk-mac-public
|
|
201
|
+
return { filename: archive("ohos-sdk-mac-public"), osFolder: "darwin", strip: strips.darwin };
|
|
199
202
|
}
|
|
200
203
|
if (platform7 === "win32") {
|
|
201
|
-
return { filename: "ohos-sdk-windows_linux-public
|
|
204
|
+
return { filename: archive("ohos-sdk-windows_linux-public"), osFolder: "windows", strip: strips.linuxWindows };
|
|
202
205
|
}
|
|
203
206
|
throw new UnsupportedPlatformError(platform7);
|
|
204
207
|
}
|
|
@@ -2260,19 +2263,39 @@ async function isReachable(config, deviceSerial) {
|
|
|
2260
2263
|
}
|
|
2261
2264
|
}
|
|
2262
2265
|
var TCP_SERIAL_RE = /^.+:\d+$/;
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2266
|
+
var WEDGED_POLLS_BEFORE_RESTART = 3;
|
|
2267
|
+
function tcpReconnector(config, deviceSerial, logger) {
|
|
2268
|
+
let wedgedPolls = 0;
|
|
2269
|
+
return async () => {
|
|
2270
|
+
if (!deviceSerial || !TCP_SERIAL_RE.test(deviceSerial)) return;
|
|
2271
|
+
let claimsConnected = false;
|
|
2272
|
+
try {
|
|
2273
|
+
const res = await hdcExec({ config, args: ["tconn", deviceSerial], timeoutMs: 5e3, logger });
|
|
2274
|
+
claimsConnected = /already connected|repeat operation/i.test(`${res.stdout}
|
|
2275
|
+
${res.stderr}`);
|
|
2276
|
+
} catch {
|
|
2277
|
+
}
|
|
2278
|
+
if (!claimsConnected || await isReachable(config, deviceSerial)) {
|
|
2279
|
+
wedgedPolls = 0;
|
|
2280
|
+
return;
|
|
2281
|
+
}
|
|
2282
|
+
if (++wedgedPolls < WEDGED_POLLS_BEFORE_RESTART) return;
|
|
2283
|
+
wedgedPolls = 0;
|
|
2284
|
+
logger.warn(`hdc reports ${deviceSerial} as connected but it does not answer; restarting the hdc server.`);
|
|
2285
|
+
try {
|
|
2286
|
+
await hdcExec({ config, args: ["start", "-r"], timeoutMs: 15e3, logger });
|
|
2287
|
+
await hdcExec({ config, args: ["tconn", deviceSerial], timeoutMs: 5e3, logger });
|
|
2288
|
+
} catch {
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2269
2291
|
}
|
|
2270
2292
|
async function waitForBundle(opts) {
|
|
2271
2293
|
const logger = scopedLogger(opts.logger ?? noopLogger, "hdc");
|
|
2272
2294
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
2295
|
+
const reconnectIfTcp = tcpReconnector(opts.config, opts.deviceSerial, logger);
|
|
2273
2296
|
await waitForCondition({
|
|
2274
2297
|
probe: async () => {
|
|
2275
|
-
await reconnectIfTcp(
|
|
2298
|
+
await reconnectIfTcp();
|
|
2276
2299
|
return await findRunningProcess({ config: opts.config, bundle: opts.bundle, deviceSerial: opts.deviceSerial, timeoutMs: 8e3 }) !== null;
|
|
2277
2300
|
},
|
|
2278
2301
|
timeoutMs,
|
|
@@ -2285,9 +2308,10 @@ async function waitForBundle(opts) {
|
|
|
2285
2308
|
async function waitForBoot(opts) {
|
|
2286
2309
|
const logger = scopedLogger(opts.logger ?? noopLogger, "hdc");
|
|
2287
2310
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
2311
|
+
const reconnectIfTcp = tcpReconnector(opts.config, opts.deviceSerial, logger);
|
|
2288
2312
|
await waitForCondition({
|
|
2289
2313
|
probe: async () => {
|
|
2290
|
-
await reconnectIfTcp(
|
|
2314
|
+
await reconnectIfTcp();
|
|
2291
2315
|
if (!await isReachable(opts.config, opts.deviceSerial)) return false;
|
|
2292
2316
|
if (!opts.untilPidOf) return true;
|
|
2293
2317
|
return await findRunningProcess({ config: opts.config, bundle: opts.untilPidOf, deviceSerial: opts.deviceSerial, timeoutMs: 8e3 }) !== null;
|
|
@@ -4743,7 +4767,7 @@ async function harmonyOsAutoSign(opts) {
|
|
|
4743
4767
|
}
|
|
4744
4768
|
|
|
4745
4769
|
// src/index.ts
|
|
4746
|
-
var VERSION = "0.
|
|
4770
|
+
var VERSION = "0.12.0";
|
|
4747
4771
|
export {
|
|
4748
4772
|
ALL_SDKS,
|
|
4749
4773
|
APL_VALUES,
|