isaacscript-common 51.9.1 → 51.9.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.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 51.9.1
3
+ isaacscript-common 51.9.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -53673,6 +53673,7 @@ return ____exports
53673
53673
  ["src.core.upgradeMod"] = function(...)
53674
53674
  local ____lualib = require("lualib_bundle")
53675
53675
  local __TS__Iterator = ____lualib.__TS__Iterator
53676
+ local Set = ____lualib.Set
53676
53677
  local __TS__New = ____lualib.__TS__New
53677
53678
  local ____exports = {}
53678
53679
  local initOptionalFeatures
@@ -53709,6 +53710,10 @@ function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThres
53709
53710
  error(("Failed to upgrade the mod due to one of the specified features being of type \"" .. featureType) .. "\". (All of the features should be numbers represented by the \"ISCFeature\" enum.)")
53710
53711
  end
53711
53712
  end
53713
+ local featureSet = __TS__New(Set, features)
53714
+ if featureSet.size ~= #features then
53715
+ error("Failed to upgrade the mod since there are two or more of the same features specified in the \"features\" array. When you pass the array of features to the \"upgradeMod\" function, all of the elements should be unique.")
53716
+ end
53712
53717
  patchErrorFunction(nil)
53713
53718
  local mod = __TS__New(ModUpgraded, modVanilla, ____debug, timeThreshold)
53714
53719
  applyShaderCrashFix(nil, mod)
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,uBAAuB,CAAC,CAAC,CAAC,CAkB5B"}
1
+ {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,uBAAuB,CAAC,CAAC,CAAC,CA0B5B"}
@@ -1,5 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Iterator = ____lualib.__TS__Iterator
3
+ local Set = ____lualib.Set
3
4
  local __TS__New = ____lualib.__TS__New
4
5
  local ____exports = {}
5
6
  local initOptionalFeatures
@@ -61,6 +62,10 @@ function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThres
61
62
  error(("Failed to upgrade the mod due to one of the specified features being of type \"" .. featureType) .. "\". (All of the features should be numbers represented by the \"ISCFeature\" enum.)")
62
63
  end
63
64
  end
65
+ local featureSet = __TS__New(Set, features)
66
+ if featureSet.size ~= #features then
67
+ error("Failed to upgrade the mod since there are two or more of the same features specified in the \"features\" array. When you pass the array of features to the \"upgradeMod\" function, all of the elements should be unique.")
68
+ end
64
69
  patchErrorFunction(nil)
65
70
  local mod = __TS__New(ModUpgraded, modVanilla, ____debug, timeThreshold)
66
71
  applyShaderCrashFix(nil, mod)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "51.9.1",
3
+ "version": "51.9.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -53,6 +53,14 @@ export function upgradeMod<T extends readonly ISCFeature[] = never[]>(
53
53
  }
54
54
  }
55
55
 
56
+ // Second, validate that all of the features are unique.
57
+ const featureSet = new Set(features as ISCFeature[]);
58
+ if (featureSet.size !== features.length) {
59
+ error(
60
+ 'Failed to upgrade the mod since there are two or more of the same features specified in the "features" array. When you pass the array of features to the "upgradeMod" function, all of the elements should be unique.',
61
+ );
62
+ }
63
+
56
64
  patchErrorFunction();
57
65
 
58
66
  const mod = new ModUpgraded(modVanilla, debug, timeThreshold);