@bhsd/codemirror-mediawiki 2.27.2 → 2.28.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/mwConfig.mjs CHANGED
@@ -58,8 +58,8 @@ var getParserConfig = (minConfig, mwConfig) => {
58
58
  };
59
59
  };
60
60
  var getVariants = (variants) => {
61
- var _a2;
62
- return (_a2 = variants == null ? void 0 : variants.map(({ code }) => code)) != null ? _a2 : [];
61
+ var _a;
62
+ return (_a = variants == null ? void 0 : variants.map(({ code }) => code)) != null ? _a : [];
63
63
  };
64
64
  var getKeywords = (magicwords, web) => ({
65
65
  img: Object.fromEntries(
@@ -107,18 +107,14 @@ var getStaticMwConfig = ({
107
107
  });
108
108
 
109
109
  // mw/config.ts
110
- var _a;
111
- var ALL_SETTINGS_CACHE = (_a = getObject("InPageEditMwConfig")) != null ? _a : {};
112
- var SITE_ID = typeof mw === "object" ? mw.config.get("wgServerName") + mw.config.get("wgScriptPath") : location.origin;
113
- var SITE_SETTINGS = ALL_SETTINGS_CACHE[SITE_ID];
114
- var VALID = Number(SITE_SETTINGS == null ? void 0 : SITE_SETTINGS.time) > Date.now() - 86400 * 1e3 * 30;
115
110
  var others = /* @__PURE__ */ new Set([...otherParserFunctions, "msgnw"]);
116
111
  var getConfigPair = (magicWords, rule) => [true, false].map((bool) => getConfig(magicWords, rule, bool));
117
112
  var setConfig = (config) => {
118
113
  mw.config.set("extCodeMirrorConfig", config);
119
114
  };
120
115
  var getMwConfig = async (modes) => {
121
- var _a2, _b;
116
+ var _a, _b, _c;
117
+ const ALL_SETTINGS_CACHE = (_a = getObject("InPageEditMwConfig")) != null ? _a : {}, SITE_ID = typeof mw === "object" ? mw.config.get("wgServerName") + mw.config.get("wgScriptPath") : location.origin, SITE_SETTINGS = ALL_SETTINGS_CACHE[SITE_ID], VALID = Number(SITE_SETTINGS == null ? void 0 : SITE_SETTINGS.time) > Date.now() - 86400 * 1e3 * 30;
122
118
  if (mw.loader.getState("ext.CodeMirror") !== null && !VALID) {
123
119
  await mw.loader.using(
124
120
  mw.loader.getState("ext.CodeMirror.data") ? "ext.CodeMirror.data" : "ext.CodeMirror"
@@ -179,8 +175,8 @@ var getMwConfig = async (modes) => {
179
175
  variants: getVariants(variants),
180
176
  urlProtocols: mw.config.get("wgUrlProtocols").replace(/\\:/gu, ":")
181
177
  });
182
- (_a2 = config.variableIDs) != null ? _a2 : config.variableIDs = variables;
183
- (_b = config.functionHooks) != null ? _b : config.functionHooks = functionhooks.map((s) => s.toLowerCase());
178
+ (_b = config.variableIDs) != null ? _b : config.variableIDs = variables;
179
+ (_c = config.functionHooks) != null ? _c : config.functionHooks = functionhooks.map((s) => s.toLowerCase());
184
180
  if (!config.functionHooks.includes("msgnw")) {
185
181
  config.functionHooks.push("msgnw");
186
182
  }