@hot-updater/bare 0.29.2 → 0.29.4

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
@@ -22,6 +22,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  enumerable: true
23
23
  }) : target, mod));
24
24
  //#endregion
25
+ let fs_promises = require("fs/promises");
26
+ fs_promises = __toESM(fs_promises);
27
+ let path = require("path");
28
+ path = __toESM(path);
25
29
  let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
26
30
  let node_url = require("node:url");
27
31
  let node_child_process = require("node:child_process");
@@ -33,8 +37,6 @@ let node_tty = require("node:tty");
33
37
  node_tty = __toESM(node_tty);
34
38
  let node_path = require("node:path");
35
39
  node_path = __toESM(node_path);
36
- let path = require("path");
37
- path = __toESM(path);
38
40
  let fs = require("fs");
39
41
  fs = __toESM(fs);
40
42
  let node_timers_promises = require("node:timers/promises");
@@ -45,8 +47,6 @@ let node_fs = require("node:fs");
45
47
  let node_stream_promises = require("node:stream/promises");
46
48
  let node_stream = require("node:stream");
47
49
  let node_buffer = require("node:buffer");
48
- let fs_promises = require("fs/promises");
49
- fs_promises = __toESM(fs_promises);
50
50
  let uuidv7 = require("uuidv7");
51
51
  //#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
52
52
  function isPlainObject(value) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
+ import fs from "fs/promises";
3
+ import path from "path";
2
4
  import { getReactNativeMetadatas, log } from "@hot-updater/cli-tools";
3
5
  import { fileURLToPath } from "node:url";
4
6
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
@@ -6,9 +8,8 @@ import { StringDecoder } from "node:string_decoder";
6
8
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
7
9
  import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
8
10
  import tty from "node:tty";
9
- import path from "node:path";
10
- import path$1 from "path";
11
- import fs from "fs";
11
+ import path$1 from "node:path";
12
+ import fs$1 from "fs";
12
13
  import { scheduler, setImmediate, setTimeout } from "node:timers/promises";
13
14
  import { constants } from "node:os";
14
15
  import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
@@ -17,7 +18,6 @@ import { appendFileSync, createReadStream, createWriteStream, readFileSync, stat
17
18
  import { finished } from "node:stream/promises";
18
19
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
19
20
  import { Buffer as Buffer$1 } from "node:buffer";
20
- import fs$1 from "fs/promises";
21
21
  import { uuidv7 } from "uuidv7";
22
22
  //#region \0rolldown/runtime.js
23
23
  var __create = Object.create;
@@ -1214,33 +1214,33 @@ function toPath(urlOrPath) {
1214
1214
  }
1215
1215
  function traversePathUp(startPath) {
1216
1216
  return { *[Symbol.iterator]() {
1217
- let currentPath = path.resolve(toPath(startPath));
1217
+ let currentPath = path$1.resolve(toPath(startPath));
1218
1218
  let previousPath;
1219
1219
  while (previousPath !== currentPath) {
1220
1220
  yield currentPath;
1221
1221
  previousPath = currentPath;
1222
- currentPath = path.resolve(currentPath, "..");
1222
+ currentPath = path$1.resolve(currentPath, "..");
1223
1223
  }
1224
1224
  } };
1225
1225
  }
1226
1226
  //#endregion
1227
1227
  //#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
1228
1228
  const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
1229
- const cwdPath = path.resolve(toPath(cwd));
1229
+ const cwdPath = path$1.resolve(toPath(cwd));
1230
1230
  const result = [];
1231
- const pathParts = pathOption.split(path.delimiter);
1231
+ const pathParts = pathOption.split(path$1.delimiter);
1232
1232
  if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
1233
1233
  if (addExecPath) applyExecPath(result, pathParts, execPath, cwdPath);
1234
- return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
1234
+ return pathOption === "" || pathOption === path$1.delimiter ? `${result.join(path$1.delimiter)}${pathOption}` : [...result, pathOption].join(path$1.delimiter);
1235
1235
  };
1236
1236
  const applyPreferLocal = (result, pathParts, cwdPath) => {
1237
1237
  for (const directory of traversePathUp(cwdPath)) {
1238
- const pathPart = path.join(directory, "node_modules/.bin");
1238
+ const pathPart = path$1.join(directory, "node_modules/.bin");
1239
1239
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1240
1240
  }
1241
1241
  };
1242
1242
  const applyExecPath = (result, pathParts, execPath, cwdPath) => {
1243
- const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
1243
+ const pathPart = path$1.resolve(cwdPath, toPath(execPath), "..");
1244
1244
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1245
1245
  };
1246
1246
  const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
@@ -2250,7 +2250,7 @@ const mapNode = ({ options }) => {
2250
2250
  const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath, ...options }) => {
2251
2251
  if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
2252
2252
  const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
2253
- const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
2253
+ const resolvedNodePath = path$1.resolve(cwd, normalizedNodePath);
2254
2254
  const newOptions = {
2255
2255
  ...options,
2256
2256
  nodePath: resolvedNodePath,
@@ -2262,7 +2262,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
2262
2262
  commandArguments,
2263
2263
  newOptions
2264
2264
  ];
2265
- if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2265
+ if (path$1.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2266
2266
  return [
2267
2267
  resolvedNodePath,
2268
2268
  [
@@ -2346,7 +2346,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
2346
2346
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
2347
2347
  const normalizeCwd = (cwd = getDefaultCwd()) => {
2348
2348
  const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
2349
- return path.resolve(cwdString);
2349
+ return path$1.resolve(cwdString);
2350
2350
  };
2351
2351
  const getDefaultCwd = () => {
2352
2352
  try {
@@ -2384,7 +2384,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
2384
2384
  options.killSignal = normalizeKillSignal(options.killSignal);
2385
2385
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
2386
2386
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
2387
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2387
+ if (process$1.platform === "win32" && path$1.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2388
2388
  return {
2389
2389
  file,
2390
2390
  commandArguments,
@@ -6221,7 +6221,7 @@ function getHermesOSExe() {
6221
6221
  }
6222
6222
  function getHermesCompilerPackagePath(reactNativePath) {
6223
6223
  try {
6224
- return path$1.dirname(__require.resolve("hermes-compiler/package.json", { paths: [reactNativePath] }));
6224
+ return path.dirname(__require.resolve("hermes-compiler/package.json", { paths: [reactNativePath] }));
6225
6225
  } catch {
6226
6226
  return null;
6227
6227
  }
@@ -6231,8 +6231,8 @@ function getHermesCompilerPackagePath(reactNativePath) {
6231
6231
  */
6232
6232
  function getComposeSourceMapsPath(cwd) {
6233
6233
  const rnPackagePath = getReactNativeMetadatas(cwd).packagePath;
6234
- const composeSourceMaps = path$1.join(rnPackagePath, "scripts", "compose-source-maps.js");
6235
- return fs.existsSync(composeSourceMaps) ? composeSourceMaps : null;
6234
+ const composeSourceMaps = path.join(rnPackagePath, "scripts", "compose-source-maps.js");
6235
+ return fs$1.existsSync(composeSourceMaps) ? composeSourceMaps : null;
6236
6236
  }
6237
6237
  /**
6238
6238
  * Finds the Hermes command.
@@ -6244,7 +6244,7 @@ function getComposeSourceMapsPath(cwd) {
6244
6244
  async function getHermesCommand(cwd) {
6245
6245
  const fileExists = (file) => {
6246
6246
  try {
6247
- return fs.statSync(file).isFile();
6247
+ return fs$1.statSync(file).isFile();
6248
6248
  } catch {
6249
6249
  return false;
6250
6250
  }
@@ -6252,14 +6252,14 @@ async function getHermesCommand(cwd) {
6252
6252
  const reactNativePath = getReactNativeMetadatas(cwd).packagePath;
6253
6253
  const hermesCompilerPath = getHermesCompilerPackagePath(reactNativePath);
6254
6254
  if (hermesCompilerPath) {
6255
- const engine = path$1.join(hermesCompilerPath, "hermesc", getHermesOSBin(), getHermesOSExe());
6255
+ const engine = path.join(hermesCompilerPath, "hermesc", getHermesOSBin(), getHermesOSExe());
6256
6256
  if (fileExists(engine)) return engine;
6257
6257
  }
6258
- const bundledHermesEngine = path$1.join(reactNativePath, "sdks", "hermesc", getHermesOSBin(), getHermesOSExe());
6258
+ const bundledHermesEngine = path.join(reactNativePath, "sdks", "hermesc", getHermesOSBin(), getHermesOSExe());
6259
6259
  if (fileExists(bundledHermesEngine)) return bundledHermesEngine;
6260
- const hermesEngine = path$1.join("node_modules", "hermes-engine", getHermesOSBin(), getHermesOSExe());
6260
+ const hermesEngine = path.join("node_modules", "hermes-engine", getHermesOSBin(), getHermesOSExe());
6261
6261
  if (fileExists(hermesEngine)) return hermesEngine;
6262
- return path$1.join("node_modules", "hermesvm", getHermesOSBin(), "hermes");
6262
+ return path.join("node_modules", "hermesvm", getHermesOSBin(), "hermes");
6263
6263
  }
6264
6264
  /**
6265
6265
  * Compiles a JS bundle into an HBC file using the Hermes compiler,
@@ -6292,7 +6292,7 @@ async function compileHermes({ cwd, sourcemap, inputJsFile }) {
6292
6292
  if (sourcemap) {
6293
6293
  const sourceMapFile = `${inputJsFile}.map`;
6294
6294
  const hermesSourceMapFile = `${inputJsFile}.hbc.map`;
6295
- if (!fs.existsSync(hermesSourceMapFile)) throw new Error(`Hermes-generated sourcemap file (${hermesSourceMapFile}) not found.`);
6295
+ if (!fs$1.existsSync(hermesSourceMapFile)) throw new Error(`Hermes-generated sourcemap file (${hermesSourceMapFile}) not found.`);
6296
6296
  const composeSourceMapsPath = getComposeSourceMapsPath(cwd);
6297
6297
  if (!composeSourceMapsPath) throw new Error("Could not find react-native's compose-source-maps.js script.");
6298
6298
  try {
@@ -6314,9 +6314,9 @@ async function compileHermes({ cwd, sourcemap, inputJsFile }) {
6314
6314
  //#region src/bare.ts
6315
6315
  const runBundle = async ({ entryFile, cwd, platform, buildPath, sourcemap, enableHermes, resetCache }) => {
6316
6316
  const reactNativePath = __require.resolve("react-native/package.json", { paths: [cwd] });
6317
- const cliPath = path$1.join(path$1.dirname(reactNativePath), "cli.js");
6317
+ const cliPath = path.join(path.dirname(reactNativePath), "cli.js");
6318
6318
  const filename = `index.${platform}`;
6319
- const bundleOutput = path$1.join(buildPath, `${filename}.bundle`);
6319
+ const bundleOutput = path.join(buildPath, `${filename}.bundle`);
6320
6320
  const bundleId = uuidv7();
6321
6321
  const args = [
6322
6322
  "bundle",
@@ -6364,12 +6364,12 @@ const bare = (config) => ({ cwd }) => {
6364
6364
  const { outDir = "dist", sourcemap = false, entryFile = "index.js", enableHermes, resetCache = true } = config;
6365
6365
  return {
6366
6366
  build: async ({ platform }) => {
6367
- const buildPath = path$1.join(cwd, outDir);
6368
- await fs$1.rm(buildPath, {
6367
+ const buildPath = path.join(cwd, outDir);
6368
+ await fs.rm(buildPath, {
6369
6369
  recursive: true,
6370
6370
  force: true
6371
6371
  });
6372
- await fs$1.mkdir(buildPath, { recursive: true });
6372
+ await fs.mkdir(buildPath, { recursive: true });
6373
6373
  const { bundleId, stdout } = await runBundle({
6374
6374
  entryFile,
6375
6375
  cwd,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/bare",
3
3
  "type": "module",
4
- "version": "0.29.2",
4
+ "version": "0.29.4",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -22,8 +22,8 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "uuidv7": "^1.0.2",
25
- "@hot-updater/cli-tools": "0.29.2",
26
- "@hot-updater/plugin-core": "0.29.2"
25
+ "@hot-updater/plugin-core": "0.29.4",
26
+ "@hot-updater/cli-tools": "0.29.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20",