isaacscript-common 21.5.0 → 21.5.1
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.d.ts → index.rollup.d.ts} +3683 -94
- package/dist/isaacscript-common.lua +2 -16
- package/dist/src/core/upgradeMod.d.ts +34 -0
- package/dist/src/core/upgradeMod.d.ts.map +1 -1
- package/dist/src/core/upgradeMod.lua +2 -43
- package/package.json +2 -2
- package/src/core/upgradeMod.ts +1 -49
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 21.5.
|
|
3
|
+
isaacscript-common 21.5.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -50507,8 +50507,8 @@ return ____exports
|
|
|
50507
50507
|
end,
|
|
50508
50508
|
["src.core.upgradeMod"] = function(...)
|
|
50509
50509
|
local ____lualib = require("lualib_bundle")
|
|
50510
|
-
local __TS__New = ____lualib.__TS__New
|
|
50511
50510
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
50511
|
+
local __TS__New = ____lualib.__TS__New
|
|
50512
50512
|
local ____exports = {}
|
|
50513
50513
|
local initOptionalFeatures
|
|
50514
50514
|
local ____ModUpgraded = require("src.classes.ModUpgraded")
|
|
@@ -50528,20 +50528,6 @@ function initOptionalFeatures(self, mod, features)
|
|
|
50528
50528
|
end
|
|
50529
50529
|
end
|
|
50530
50530
|
end
|
|
50531
|
-
local function upgradeModDocumentation(self, modVanilla, features, ____debug, timeThreshold)
|
|
50532
|
-
if features == nil then
|
|
50533
|
-
features = {}
|
|
50534
|
-
end
|
|
50535
|
-
if ____debug == nil then
|
|
50536
|
-
____debug = false
|
|
50537
|
-
end
|
|
50538
|
-
print(modVanilla)
|
|
50539
|
-
print(features)
|
|
50540
|
-
print(____debug)
|
|
50541
|
-
print(timeThreshold)
|
|
50542
|
-
local mod = RegisterMod("", 1)
|
|
50543
|
-
return __TS__New(ModUpgraded, mod, false)
|
|
50544
|
-
end
|
|
50545
50531
|
function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThreshold)
|
|
50546
50532
|
if features == nil then
|
|
50547
50533
|
features = {}
|
|
@@ -1,2 +1,36 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
import { ISCFeature } from "../enums/ISCFeature";
|
|
4
|
+
import { ModUpgradedWithFeatures } from "../types/private/ModUpgradedWithFeatures";
|
|
5
|
+
type ISCFeatureTuple<T extends readonly ISCFeature[]> = ISCFeature extends T["length"] ? 'The list of features must be a tuple. Use the "as const" assertion when declaring the array.' : T;
|
|
6
|
+
/**
|
|
7
|
+
* Use this function to enable the custom callbacks and other optional features provided by
|
|
8
|
+
* `isaacscript-common`.
|
|
9
|
+
*
|
|
10
|
+
* For example:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const modVanilla = RegisterMod("My Mod", 1);
|
|
14
|
+
* const mod = upgradeMod(modVanilla);
|
|
15
|
+
*
|
|
16
|
+
* // Subscribe to vanilla callbacks.
|
|
17
|
+
* mod.AddCallback(ModCallback.POST_UPDATE, postUpdate);
|
|
18
|
+
*
|
|
19
|
+
* // Subscribe to custom callbacks.
|
|
20
|
+
* mod.AddCallbackCustom(ModCallbackCustom.POST_ITEM_PICKUP, postItemPickup);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
24
|
+
* @param features Optional. An array containing the optional standard library features that you
|
|
25
|
+
* want to enable, if any. Default is an empty array.
|
|
26
|
+
* @param debug Optional. Whether to log additional output when a callback is fired. Default is
|
|
27
|
+
* false.
|
|
28
|
+
* @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
|
|
29
|
+
* specified number of seconds (if the "--luadebug" launch flag is turned on)
|
|
30
|
+
* or milliseconds (if the "--luadebug" launch flag is turned off).
|
|
31
|
+
* @returns The upgraded mod object.
|
|
32
|
+
* @beta A dummy field used to hide this function from `api-extractor`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, debug?: boolean, timeThreshold?: float): ModUpgradedWithFeatures<T>;
|
|
1
35
|
export {};
|
|
2
36
|
//# sourceMappingURL=upgradeMod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;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,6 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__New = ____lualib.__TS__New
|
|
3
2
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local initOptionalFeatures
|
|
6
6
|
local ____ModUpgraded = require("src.classes.ModUpgraded")
|
|
@@ -45,48 +45,7 @@ end
|
|
|
45
45
|
-- specified number of seconds (if the "--luadebug" launch flag is turned on)
|
|
46
46
|
-- or milliseconds (if the "--luadebug" launch flag is turned off).
|
|
47
47
|
-- @returns The upgraded mod object.
|
|
48
|
-
-- @
|
|
49
|
-
-- @rename upgradeMod
|
|
50
|
-
local function upgradeModDocumentation(self, modVanilla, features, ____debug, timeThreshold)
|
|
51
|
-
if features == nil then
|
|
52
|
-
features = {}
|
|
53
|
-
end
|
|
54
|
-
if ____debug == nil then
|
|
55
|
-
____debug = false
|
|
56
|
-
end
|
|
57
|
-
print(modVanilla)
|
|
58
|
-
print(features)
|
|
59
|
-
print(____debug)
|
|
60
|
-
print(timeThreshold)
|
|
61
|
-
local mod = RegisterMod("", 1)
|
|
62
|
-
return __TS__New(ModUpgraded, mod, false)
|
|
63
|
-
end
|
|
64
|
-
--- Use this function to enable the custom callbacks and other optional features provided by
|
|
65
|
-
-- `isaacscript-common`.
|
|
66
|
-
--
|
|
67
|
-
-- For example:
|
|
68
|
-
--
|
|
69
|
-
-- ```ts
|
|
70
|
-
-- const modVanilla = RegisterMod("My Mod", 1);
|
|
71
|
-
-- const mod = upgradeMod(modVanilla);
|
|
72
|
-
--
|
|
73
|
-
-- // Subscribe to vanilla callbacks.
|
|
74
|
-
-- mod.AddCallback(ModCallback.POST_UPDATE, postUpdate);
|
|
75
|
-
--
|
|
76
|
-
-- // Subscribe to custom callbacks.
|
|
77
|
-
-- mod.AddCallbackCustom(ModCallbackCustom.POST_ITEM_PICKUP, postItemPickup);
|
|
78
|
-
-- ```
|
|
79
|
-
--
|
|
80
|
-
-- @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
81
|
-
-- @param features Optional. An array containing the optional standard library features that you
|
|
82
|
-
-- want to enable, if any. Default is an empty array.
|
|
83
|
-
-- @param debug Optional. Whether to log additional output when a callback is fired. Default is
|
|
84
|
-
-- false.
|
|
85
|
-
-- @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
|
|
86
|
-
-- specified number of seconds (if the "--luadebug" launch flag is turned on)
|
|
87
|
-
-- or milliseconds (if the "--luadebug" launch flag is turned off).
|
|
88
|
-
-- @returns The upgraded mod object.
|
|
89
|
-
-- @internal
|
|
48
|
+
-- @beta A dummy field used to hide this function from `api-extractor`.
|
|
90
49
|
function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThreshold)
|
|
91
50
|
if features == nil then
|
|
92
51
|
features = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "21.5.
|
|
3
|
+
"version": "21.5.1",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Zamiell",
|
|
21
21
|
"type": "commonjs",
|
|
22
22
|
"main": "dist/src/index",
|
|
23
|
-
"types": "dist/
|
|
23
|
+
"types": "dist/index.rollup.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"isaac-typescript-definitions": "^11.1.1"
|
|
26
26
|
}
|
package/src/core/upgradeMod.ts
CHANGED
|
@@ -36,56 +36,8 @@ type ISCFeatureTuple<T extends readonly ISCFeature[]> =
|
|
|
36
36
|
* specified number of seconds (if the "--luadebug" launch flag is turned on)
|
|
37
37
|
* or milliseconds (if the "--luadebug" launch flag is turned off).
|
|
38
38
|
* @returns The upgraded mod object.
|
|
39
|
-
* @
|
|
40
|
-
* @rename upgradeMod
|
|
39
|
+
* @beta A dummy field used to hide this function from `api-extractor`.
|
|
41
40
|
*/
|
|
42
|
-
// We duplicate the definition for `upgradeMod` because the original one has to be marked internal.
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
-
function upgradeModDocumentation(
|
|
45
|
-
modVanilla: Mod,
|
|
46
|
-
features: ISCFeature[] = [],
|
|
47
|
-
debug = false,
|
|
48
|
-
timeThreshold?: float,
|
|
49
|
-
): ModUpgraded {
|
|
50
|
-
print(modVanilla);
|
|
51
|
-
print(features);
|
|
52
|
-
print(debug);
|
|
53
|
-
print(timeThreshold);
|
|
54
|
-
|
|
55
|
-
const mod = RegisterMod("", 1);
|
|
56
|
-
return new ModUpgraded(mod, false);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Use this function to enable the custom callbacks and other optional features provided by
|
|
61
|
-
* `isaacscript-common`.
|
|
62
|
-
*
|
|
63
|
-
* For example:
|
|
64
|
-
*
|
|
65
|
-
* ```ts
|
|
66
|
-
* const modVanilla = RegisterMod("My Mod", 1);
|
|
67
|
-
* const mod = upgradeMod(modVanilla);
|
|
68
|
-
*
|
|
69
|
-
* // Subscribe to vanilla callbacks.
|
|
70
|
-
* mod.AddCallback(ModCallback.POST_UPDATE, postUpdate);
|
|
71
|
-
*
|
|
72
|
-
* // Subscribe to custom callbacks.
|
|
73
|
-
* mod.AddCallbackCustom(ModCallbackCustom.POST_ITEM_PICKUP, postItemPickup);
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
77
|
-
* @param features Optional. An array containing the optional standard library features that you
|
|
78
|
-
* want to enable, if any. Default is an empty array.
|
|
79
|
-
* @param debug Optional. Whether to log additional output when a callback is fired. Default is
|
|
80
|
-
* false.
|
|
81
|
-
* @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
|
|
82
|
-
* specified number of seconds (if the "--luadebug" launch flag is turned on)
|
|
83
|
-
* or milliseconds (if the "--luadebug" launch flag is turned off).
|
|
84
|
-
* @returns The upgraded mod object.
|
|
85
|
-
* @internal
|
|
86
|
-
*/
|
|
87
|
-
// This has to be marked internal or else it will cause all of the feature classes to be included in
|
|
88
|
-
// the output of `api-extractor`.
|
|
89
41
|
export function upgradeMod<T extends readonly ISCFeature[] = never[]>(
|
|
90
42
|
modVanilla: Mod,
|
|
91
43
|
features: ISCFeatureTuple<T> = [] as unknown as ISCFeatureTuple<T>,
|