chore: add arguments logging to deprecated MacrosParser method warnings (#5429) Extends the #logDeprecated helper to accept and log the arguments passed to deprecated methods, providing better debugging context for migration. Updates all deprecated method calls (get, has, registerMacro, unregisterMacro) to forward their arguments to the deprecation logger.

ff4c6fa1bbdfe76c8c4ce6c41a9aa9033901cef2

Wolfsblvt <wolfsblvt@gmail.com>

Signed
1 files changed, +7 -6Ignore whitespace
public/scripts/macros.js+7 -6
@@ -58,10 +58,11 @@ export class MacrosParser {
5858 *
5959 * @param {string} method
6060 * @param {string} replacement
61+ * @param {IArguments} [methodArgs=null]
6162 * @returns {void}
6263 */
6364 static #logDeprecated(method, replacement, methodArgs = null) {
6465 console.warn(`[DEPRECATED] MacrosParser.${method} is deprecated and will be removed in a future version. Use ${replacement} instead. Arguments:`, (methodArgs ?? 'none'));
6566 }
6667
6768 /**
@@ -155,7 +156,7 @@ export class MacrosParser {
155156 * @returns {string|MacroFunction|undefined} The macro value
156157 */
157158 static get(key) {
158159 MacrosParser.#logDeprecated('get', 'macros.registry.getMacro (from scripts/macros/macro-system.js)', arguments);
159160 return MacrosParser.#macros.get(key);
160161 }
161162
@@ -165,7 +166,7 @@ export class MacrosParser {
165166 * @returns {boolean} True if the macro is registered, false otherwise
166167 */
167168 static has(key) {
168169 MacrosParser.#logDeprecated('has', 'macros.registry.hasMacro (from scripts/macros/macro-system.js)', arguments);
169170 if (power_user.experimental_macro_engine) {
170171 return macroSystem.registry.hasMacro(key);
171172 }
@@ -180,7 +181,7 @@ export class MacrosParser {
180181 * @param {string} [description] Optional description of the macro
181182 */
182183 static registerMacro(key, value, description = '') {
183184 MacrosParser.#logDeprecated('registerMacro', 'macros.registry.registerMacro (from scripts/macros/macro-system.js) or substituteParams({ dynamicMacros })', arguments);
184185 if (typeof key !== 'string') {
185186 throw new Error('Macro key must be a string');
186187 }
@@ -223,7 +224,7 @@ export class MacrosParser {
223224 * @param {string} key Macro name (key)
224225 */
225226 static unregisterMacro(key) {
226227 MacrosParser.#logDeprecated('unregisterMacro', 'macros.registry.unregisterMacro (from scripts/macros/macro-system.js)', arguments);
227228 if (typeof key !== 'string') {
228229 throw new Error('Macro key must be a string');
229230 }