@oniroproject/core 0.9.0 → 0.10.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/dist/index.d.cts CHANGED
@@ -1181,6 +1181,7 @@ interface InstallAppOptions {
1181
1181
  * Falls back to the `hapPath` config key, then to the well-known default.
1182
1182
  */
1183
1183
  hapPath?: string;
1184
+ deviceSerial?: string;
1184
1185
  logger?: Logger;
1185
1186
  }
1186
1187
  interface InstallAppResult {
package/dist/index.d.ts CHANGED
@@ -1181,6 +1181,7 @@ interface InstallAppOptions {
1181
1181
  * Falls back to the `hapPath` config key, then to the well-known default.
1182
1182
  */
1183
1183
  hapPath?: string;
1184
+ deviceSerial?: string;
1184
1185
  logger?: Logger;
1185
1186
  }
1186
1187
  interface InstallAppResult {
package/dist/index.js CHANGED
@@ -344,7 +344,7 @@ function createInstallTempDir(opts) {
344
344
  } catch (err) {
345
345
  const fallback = os4.tmpdir();
346
346
  if (requested || isOutOfSpaceError(err) || path4.resolve(fallback) === path4.resolve(root)) throw err;
347
- const reason = err instanceof Error ? err.message.split("\n")[0] : String(err);
347
+ const reason = err instanceof Error ? err.message.split(/\r?\n/)[0] : String(err);
348
348
  (opts.logger ?? noopLogger).warn(`${reason} Falling back to '${fallback}'.`);
349
349
  return { dir: createTempWorkDir(fallback, opts.prefix), root: fallback };
350
350
  }
@@ -1969,7 +1969,12 @@ async function installApp(opts) {
1969
1969
  if (!fs17.existsSync(hapPath)) {
1970
1970
  throw new OniroError(`HAP file not found at: ${hapPath}. Build and sign the app first.`);
1971
1971
  }
1972
- const result = await hdcExec({ config: opts.config, args: ["install", hapPath], timeoutMs: 3e5 });
1972
+ const result = await hdcExec({
1973
+ config: opts.config,
1974
+ args: ["install", hapPath],
1975
+ deviceSerial: opts.deviceSerial,
1976
+ timeoutMs: 3e5
1977
+ });
1973
1978
  if (result.stdout.trim()) logger.info(result.stdout.trim());
1974
1979
  if (result.stderr.trim()) logger.warn(result.stderr.trim());
1975
1980
  ensureOk(result, `hdc install ${hapPath}`);
@@ -2061,7 +2066,7 @@ function listRunningProcesses(config, options = {}) {
2061
2066
  const processes = [];
2062
2067
  let resolved = false;
2063
2068
  proc.stdout?.on("data", (data) => {
2064
- for (const line of data.toString().split("\n").filter(Boolean)) {
2069
+ for (const line of data.toString().split(/\r?\n/).filter(Boolean)) {
2065
2070
  const match = line.match(/^(\d+)\s+(.+)$/);
2066
2071
  if (!match) continue;
2067
2072
  const pid = match[1];
@@ -2638,10 +2643,9 @@ function waitForLog(opts) {
2638
2643
  child = stream;
2639
2644
  stream.stdout.on("data", (d) => {
2640
2645
  buf += d.toString();
2641
- let idx;
2642
- while ((idx = buf.indexOf("\n")) >= 0) {
2643
- const line = buf.slice(0, idx);
2644
- buf = buf.slice(idx + 1);
2646
+ const lines = buf.split(/\r?\n/);
2647
+ buf = lines.pop() ?? "";
2648
+ for (const line of lines) {
2645
2649
  const entry = parseHilogLine(line);
2646
2650
  if (entry && opts.pattern.test(entryText(entry))) {
2647
2651
  finish(entry);
@@ -2697,10 +2701,9 @@ function watchLog(opts) {
2697
2701
  child = stream;
2698
2702
  stream.stdout.on("data", (d) => {
2699
2703
  buf += d.toString();
2700
- let idx;
2701
- while ((idx = buf.indexOf("\n")) >= 0) {
2702
- const line = buf.slice(0, idx);
2703
- buf = buf.slice(idx + 1);
2704
+ const lines = buf.split(/\r?\n/);
2705
+ buf = lines.pop() ?? "";
2706
+ for (const line of lines) {
2704
2707
  const entry = parseHilogLine(line);
2705
2708
  if (entry && opts.pattern.test(entryText(entry))) matches.push(entry);
2706
2709
  }
@@ -2733,7 +2736,7 @@ async function dumpLog(opts) {
2733
2736
  timeoutMs: opts.timeoutMs ?? 3e4,
2734
2737
  logger: opts.logger
2735
2738
  });
2736
- return res.stdout.split("\n").map((line) => parseHilogLine(line)).filter((e) => e !== null);
2739
+ return res.stdout.split(/\r?\n/).map((line) => parseHilogLine(line)).filter((e) => e !== null);
2737
2740
  }
2738
2741
 
2739
2742
  // src/build/runHvigorw.ts
@@ -3405,7 +3408,7 @@ async function applyChanges(opts) {
3405
3408
  }
3406
3409
 
3407
3410
  // src/index.ts
3408
- var VERSION = "0.9.0";
3411
+ var VERSION = "0.10.0";
3409
3412
  export {
3410
3413
  ALL_SDKS,
3411
3414
  APL_VALUES,