hot-updater 0.16.0 → 0.16.2

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
@@ -13600,30 +13600,31 @@ var __webpack_exports__ = {};
13600
13600
  async function getBundleZipTargets(basePath, files) {
13601
13601
  const bundleCandidates = {};
13602
13602
  const targets = [];
13603
+ const normalizeToPosix = (filePath)=>filePath.split(external_path_default().sep).join("/");
13604
+ const normalizedBase = normalizeToPosix(external_path_default().normalize(basePath));
13603
13605
  const getRelative = (file)=>{
13604
- if (file.startsWith(basePath)) {
13605
- const sliceIndex = basePath.endsWith("/") ? basePath.length : basePath.length + 1;
13606
- return file.slice(sliceIndex);
13607
- }
13608
- return file;
13606
+ const normalizedFile = normalizeToPosix(external_path_default().normalize(file));
13607
+ if (normalizedFile.startsWith(`${normalizedBase}/`)) return normalizedFile.slice(normalizedBase.length + 1);
13608
+ return normalizedFile;
13609
13609
  };
13610
13610
  for (const file of files){
13611
- if (file.endsWith(".map")) continue;
13612
- const relative = getRelative(file);
13611
+ const normalizedFile = normalizeToPosix(external_path_default().normalize(file));
13612
+ if (normalizedFile.endsWith(".map")) continue;
13613
+ const relative = getRelative(normalizedFile);
13613
13614
  if (relative.endsWith(".bundle") || relative.endsWith(".bundle.hbc")) {
13614
13615
  let bundleBase = relative;
13615
13616
  if (relative.endsWith(".bundle.hbc")) bundleBase = relative.slice(0, -4);
13616
13617
  if (bundleCandidates[bundleBase]) {
13617
- if (!bundleCandidates[bundleBase]?.endsWith(".hbc") && file.endsWith(".hbc")) bundleCandidates[bundleBase] = file;
13618
- } else bundleCandidates[bundleBase] = file;
13618
+ if (!bundleCandidates[bundleBase]?.endsWith(".hbc") && normalizedFile.endsWith(".hbc")) bundleCandidates[bundleBase] = normalizedFile;
13619
+ } else bundleCandidates[bundleBase] = normalizedFile;
13619
13620
  } else targets.push({
13620
13621
  path: file,
13621
- name: relative
13622
+ name: relative.replace(/\\/g, "/")
13622
13623
  });
13623
13624
  }
13624
13625
  for(const bundleBase in bundleCandidates)if (!!bundleCandidates[bundleBase]) targets.push({
13625
13626
  path: bundleCandidates[bundleBase],
13626
- name: bundleBase
13627
+ name: bundleBase.replace(/\\/g, "/")
13627
13628
  });
13628
13629
  return targets;
13629
13630
  }
package/dist/index.js CHANGED
@@ -13561,30 +13561,31 @@ const getPlatform = async (message)=>{
13561
13561
  async function getBundleZipTargets(basePath, files) {
13562
13562
  const bundleCandidates = {};
13563
13563
  const targets = [];
13564
+ const normalizeToPosix = (filePath)=>filePath.split(external_path_["default"].sep).join("/");
13565
+ const normalizedBase = normalizeToPosix(external_path_["default"].normalize(basePath));
13564
13566
  const getRelative = (file)=>{
13565
- if (file.startsWith(basePath)) {
13566
- const sliceIndex = basePath.endsWith("/") ? basePath.length : basePath.length + 1;
13567
- return file.slice(sliceIndex);
13568
- }
13569
- return file;
13567
+ const normalizedFile = normalizeToPosix(external_path_["default"].normalize(file));
13568
+ if (normalizedFile.startsWith(`${normalizedBase}/`)) return normalizedFile.slice(normalizedBase.length + 1);
13569
+ return normalizedFile;
13570
13570
  };
13571
13571
  for (const file of files){
13572
- if (file.endsWith(".map")) continue;
13573
- const relative = getRelative(file);
13572
+ const normalizedFile = normalizeToPosix(external_path_["default"].normalize(file));
13573
+ if (normalizedFile.endsWith(".map")) continue;
13574
+ const relative = getRelative(normalizedFile);
13574
13575
  if (relative.endsWith(".bundle") || relative.endsWith(".bundle.hbc")) {
13575
13576
  let bundleBase = relative;
13576
13577
  if (relative.endsWith(".bundle.hbc")) bundleBase = relative.slice(0, -4);
13577
13578
  if (bundleCandidates[bundleBase]) {
13578
- if (!bundleCandidates[bundleBase]?.endsWith(".hbc") && file.endsWith(".hbc")) bundleCandidates[bundleBase] = file;
13579
- } else bundleCandidates[bundleBase] = file;
13579
+ if (!bundleCandidates[bundleBase]?.endsWith(".hbc") && normalizedFile.endsWith(".hbc")) bundleCandidates[bundleBase] = normalizedFile;
13580
+ } else bundleCandidates[bundleBase] = normalizedFile;
13580
13581
  } else targets.push({
13581
13582
  path: file,
13582
- name: relative
13583
+ name: relative.replace(/\\/g, "/")
13583
13584
  });
13584
13585
  }
13585
13586
  for(const bundleBase in bundleCandidates)if (!!bundleCandidates[bundleBase]) targets.push({
13586
13587
  path: bundleCandidates[bundleBase],
13587
- name: bundleBase
13588
+ name: bundleBase.replace(/\\/g, "/")
13588
13589
  });
13589
13590
  return targets;
13590
13591
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.16.0",
4
+ "version": "0.16.2",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -49,9 +49,9 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@clack/prompts": "^0.10.0",
52
- "@hot-updater/console": "0.16.0",
53
- "@hot-updater/core": "0.16.0",
54
- "@hot-updater/plugin-core": "0.16.0",
52
+ "@hot-updater/console": "0.16.2",
53
+ "@hot-updater/core": "0.16.2",
54
+ "@hot-updater/plugin-core": "0.16.2",
55
55
  "commander": "^11.1.0",
56
56
  "cosmiconfig": "^9.0.0",
57
57
  "cosmiconfig-typescript-loader": "^5.0.0",