@hot-updater/repack 0.18.5 → 0.19.1-rc.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
@@ -26,23 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  //#endregion
27
27
  const fs = __toESM(require("fs"));
28
28
  const path = __toESM(require("path"));
29
- const __hot_updater_plugin_core = __toESM(require("@hot-updater/plugin-core"));
30
29
 
31
- //#region ../../node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/memoize.mjs
32
- function memoize(fn, options = {}) {
33
- const { cache = /* @__PURE__ */ new Map(), getCacheKey } = options;
34
- const memoizedFn = function(arg) {
35
- const key = getCacheKey ? getCacheKey(arg) : arg;
36
- if (cache.has(key)) return cache.get(key);
37
- const result = fn.call(this, arg);
38
- cache.set(key, result);
39
- return result;
40
- };
41
- memoizedFn.cache = cache;
42
- return memoizedFn;
43
- }
44
-
45
- //#endregion
46
30
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
47
31
  var require_picocolors = __commonJS({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
48
32
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -444,7 +428,6 @@ const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator
444
428
  //#region src/index.ts
445
429
  var import_picocolors = __toESM(require_picocolors());
446
430
  const NIL_UUID = "00000000-0000-0000-0000-000000000000";
447
- const memoizeLoadConfig = memoize(__hot_updater_plugin_core.loadConfigSync);
448
431
  const getBundleId = () => {
449
432
  const buildOutDir = process.env["BUILD_OUT_DIR"];
450
433
  if (!buildOutDir) return NIL_UUID;
@@ -457,35 +440,9 @@ const getBundleId = () => {
457
440
  }
458
441
  return bundleId;
459
442
  };
460
- const getFingerprintJson = () => {
461
- const { updateStrategy } = memoizeLoadConfig(null);
462
- if (updateStrategy === "appVersion") return null;
463
- const fingerprintPath = path.default.join((0, __hot_updater_plugin_core.getCwd)(), "fingerprint.json");
464
- if (!fs.default.existsSync(fingerprintPath)) throw new Error("Missing fingerprint.json. Since updateStrategy is set to 'fingerprint' in hot-updater.config, please run `hot-updater fingerprint create`.");
465
- try {
466
- const fingerprint = JSON.parse(fs.default.readFileSync(fingerprintPath, "utf-8"));
467
- return {
468
- iosHash: fingerprint.ios.hash,
469
- androidHash: fingerprint.android.hash
470
- };
471
- } catch {
472
- throw new Error("Invalid fingerprint.json. Since updateStrategy is set to 'fingerprint' in hot-updater.config, please run `hot-updater fingerprint create`.");
473
- }
474
- };
475
- const getOverTheAirChannel = () => {
476
- return process.env?.["HOT_UPDATER_CHANNEL"] ?? null;
477
- };
478
443
  var HotUpdaterPlugin = class {
479
444
  apply(compiler) {
480
- const fingerprint = getFingerprintJson();
481
- const { updateStrategy } = memoizeLoadConfig(null);
482
- new compiler.webpack.DefinePlugin({
483
- __HOT_UPDATER_BUNDLE_ID: JSON.stringify(getBundleId()),
484
- __HOT_UPDATER_CHANNEL: JSON.stringify(getOverTheAirChannel()),
485
- __HOT_UPDATER_FINGERPRINT_HASH_IOS: JSON.stringify(fingerprint?.iosHash ?? null),
486
- __HOT_UPDATER_FINGERPRINT_HASH_ANDROID: JSON.stringify(fingerprint?.androidHash ?? null),
487
- __HOT_UPDATER_UPDATE_STRATEGY: JSON.stringify(updateStrategy)
488
- }).apply(compiler);
445
+ new compiler.webpack.DefinePlugin({ __HOT_UPDATER_BUNDLE_ID: JSON.stringify(getBundleId()) }).apply(compiler);
489
446
  }
490
447
  };
491
448
 
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { getCwd, loadConfigSync } from "@hot-updater/plugin-core";
4
3
 
5
4
  //#region rolldown:runtime
6
5
  var __create = Object.create;
@@ -27,21 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
26
  enumerable: true
28
27
  }) : target, mod));
29
28
 
30
- //#endregion
31
- //#region ../../node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/memoize.mjs
32
- function memoize(fn, options = {}) {
33
- const { cache = /* @__PURE__ */ new Map(), getCacheKey } = options;
34
- const memoizedFn = function(arg) {
35
- const key = getCacheKey ? getCacheKey(arg) : arg;
36
- if (cache.has(key)) return cache.get(key);
37
- const result = fn.call(this, arg);
38
- cache.set(key, result);
39
- return result;
40
- };
41
- memoizedFn.cache = cache;
42
- return memoizedFn;
43
- }
44
-
45
29
  //#endregion
46
30
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
47
31
  var require_picocolors = __commonJS({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
@@ -444,7 +428,6 @@ const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator
444
428
  //#region src/index.ts
445
429
  var import_picocolors = __toESM(require_picocolors());
446
430
  const NIL_UUID = "00000000-0000-0000-0000-000000000000";
447
- const memoizeLoadConfig = memoize(loadConfigSync);
448
431
  const getBundleId = () => {
449
432
  const buildOutDir = process.env["BUILD_OUT_DIR"];
450
433
  if (!buildOutDir) return NIL_UUID;
@@ -457,35 +440,9 @@ const getBundleId = () => {
457
440
  }
458
441
  return bundleId;
459
442
  };
460
- const getFingerprintJson = () => {
461
- const { updateStrategy } = memoizeLoadConfig(null);
462
- if (updateStrategy === "appVersion") return null;
463
- const fingerprintPath = path.join(getCwd(), "fingerprint.json");
464
- if (!fs.existsSync(fingerprintPath)) throw new Error("Missing fingerprint.json. Since updateStrategy is set to 'fingerprint' in hot-updater.config, please run `hot-updater fingerprint create`.");
465
- try {
466
- const fingerprint = JSON.parse(fs.readFileSync(fingerprintPath, "utf-8"));
467
- return {
468
- iosHash: fingerprint.ios.hash,
469
- androidHash: fingerprint.android.hash
470
- };
471
- } catch {
472
- throw new Error("Invalid fingerprint.json. Since updateStrategy is set to 'fingerprint' in hot-updater.config, please run `hot-updater fingerprint create`.");
473
- }
474
- };
475
- const getOverTheAirChannel = () => {
476
- return process.env?.["HOT_UPDATER_CHANNEL"] ?? null;
477
- };
478
443
  var HotUpdaterPlugin = class {
479
444
  apply(compiler) {
480
- const fingerprint = getFingerprintJson();
481
- const { updateStrategy } = memoizeLoadConfig(null);
482
- new compiler.webpack.DefinePlugin({
483
- __HOT_UPDATER_BUNDLE_ID: JSON.stringify(getBundleId()),
484
- __HOT_UPDATER_CHANNEL: JSON.stringify(getOverTheAirChannel()),
485
- __HOT_UPDATER_FINGERPRINT_HASH_IOS: JSON.stringify(fingerprint?.iosHash ?? null),
486
- __HOT_UPDATER_FINGERPRINT_HASH_ANDROID: JSON.stringify(fingerprint?.androidHash ?? null),
487
- __HOT_UPDATER_UPDATE_STRATEGY: JSON.stringify(updateStrategy)
488
- }).apply(compiler);
445
+ new compiler.webpack.DefinePlugin({ __HOT_UPDATER_BUNDLE_ID: JSON.stringify(getBundleId()) }).apply(compiler);
489
446
  }
490
447
  };
491
448
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/repack",
3
3
  "type": "module",
4
- "version": "0.18.5",
4
+ "version": "0.19.1-rc.0",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "@callstack/repack": "*"
33
33
  },
34
34
  "dependencies": {
35
- "@hot-updater/plugin-core": "0.18.5"
35
+ "@hot-updater/plugin-core": "0.19.1-rc.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsdown",