@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.cjs CHANGED
@@ -536,7 +536,7 @@ function createInstallTempDir(opts) {
536
536
  } catch (err) {
537
537
  const fallback = os4.tmpdir();
538
538
  if (requested || isOutOfSpaceError(err) || path4.resolve(fallback) === path4.resolve(root)) throw err;
539
- const reason = err instanceof Error ? err.message.split("\n")[0] : String(err);
539
+ const reason = err instanceof Error ? err.message.split(/\r?\n/)[0] : String(err);
540
540
  (opts.logger ?? noopLogger).warn(`${reason} Falling back to '${fallback}'.`);
541
541
  return { dir: createTempWorkDir(fallback, opts.prefix), root: fallback };
542
542
  }
@@ -2161,7 +2161,12 @@ async function installApp(opts) {
2161
2161
  if (!fs17.existsSync(hapPath)) {
2162
2162
  throw new OniroError(`HAP file not found at: ${hapPath}. Build and sign the app first.`);
2163
2163
  }
2164
- const result = await hdcExec({ config: opts.config, args: ["install", hapPath], timeoutMs: 3e5 });
2164
+ const result = await hdcExec({
2165
+ config: opts.config,
2166
+ args: ["install", hapPath],
2167
+ deviceSerial: opts.deviceSerial,
2168
+ timeoutMs: 3e5
2169
+ });
2165
2170
  if (result.stdout.trim()) logger.info(result.stdout.trim());
2166
2171
  if (result.stderr.trim()) logger.warn(result.stderr.trim());
2167
2172
  ensureOk(result, `hdc install ${hapPath}`);
@@ -2253,7 +2258,7 @@ function listRunningProcesses(config, options = {}) {
2253
2258
  const processes = [];
2254
2259
  let resolved = false;
2255
2260
  proc.stdout?.on("data", (data) => {
2256
- for (const line of data.toString().split("\n").filter(Boolean)) {
2261
+ for (const line of data.toString().split(/\r?\n/).filter(Boolean)) {
2257
2262
  const match = line.match(/^(\d+)\s+(.+)$/);
2258
2263
  if (!match) continue;
2259
2264
  const pid = match[1];
@@ -2830,10 +2835,9 @@ function waitForLog(opts) {
2830
2835
  child = stream;
2831
2836
  stream.stdout.on("data", (d) => {
2832
2837
  buf += d.toString();
2833
- let idx;
2834
- while ((idx = buf.indexOf("\n")) >= 0) {
2835
- const line = buf.slice(0, idx);
2836
- buf = buf.slice(idx + 1);
2838
+ const lines = buf.split(/\r?\n/);
2839
+ buf = lines.pop() ?? "";
2840
+ for (const line of lines) {
2837
2841
  const entry = parseHilogLine(line);
2838
2842
  if (entry && opts.pattern.test(entryText(entry))) {
2839
2843
  finish(entry);
@@ -2889,10 +2893,9 @@ function watchLog(opts) {
2889
2893
  child = stream;
2890
2894
  stream.stdout.on("data", (d) => {
2891
2895
  buf += d.toString();
2892
- let idx;
2893
- while ((idx = buf.indexOf("\n")) >= 0) {
2894
- const line = buf.slice(0, idx);
2895
- buf = buf.slice(idx + 1);
2896
+ const lines = buf.split(/\r?\n/);
2897
+ buf = lines.pop() ?? "";
2898
+ for (const line of lines) {
2896
2899
  const entry = parseHilogLine(line);
2897
2900
  if (entry && opts.pattern.test(entryText(entry))) matches.push(entry);
2898
2901
  }
@@ -2925,7 +2928,7 @@ async function dumpLog(opts) {
2925
2928
  timeoutMs: opts.timeoutMs ?? 3e4,
2926
2929
  logger: opts.logger
2927
2930
  });
2928
- return res.stdout.split("\n").map((line) => parseHilogLine(line)).filter((e) => e !== null);
2931
+ return res.stdout.split(/\r?\n/).map((line) => parseHilogLine(line)).filter((e) => e !== null);
2929
2932
  }
2930
2933
 
2931
2934
  // src/build/runHvigorw.ts
@@ -3597,7 +3600,7 @@ async function applyChanges(opts) {
3597
3600
  }
3598
3601
 
3599
3602
  // src/index.ts
3600
- var VERSION = "0.9.0";
3603
+ var VERSION = "0.10.0";
3601
3604
  // Annotate the CommonJS export names for ESM import in node:
3602
3605
  0 && (module.exports = {
3603
3606
  ALL_SDKS,