Bladeren bron

feat: update userutils to 9.3.0

Sv443 1 maand geleden
bovenliggende
commit
14d873db71
5 gewijzigde bestanden met toevoegingen van 16 en 17 verwijderingen
  1. 1 1
      package.json
  2. 5 5
      pnpm-lock.yaml
  3. 3 3
      src/config.ts
  4. 3 4
      src/constants.ts
  5. 4 4
      src/interface.ts

+ 1 - 1
package.json

@@ -63,7 +63,7 @@
     "openuserjs": "https://openuserjs.org/scripts/Sv443/BetterYTM"
   },
   "dependencies": {
-    "@sv443-network/userutils": "^9.2.1",
+    "@sv443-network/userutils": "^9.3.0",
     "compare-versions": "^6.1.1",
     "dompurify": "^3.2.4",
     "marked": "^12.0.2",

+ 5 - 5
pnpm-lock.yaml

@@ -9,8 +9,8 @@ importers:
   .:
     dependencies:
       '@sv443-network/userutils':
-        specifier: ^9.2.1
-        version: 9.2.1
+        specifier: ^9.3.0
+        version: 9.3.0
       compare-versions:
         specifier: ^6.1.1
         version: 6.1.1
@@ -877,8 +877,8 @@ packages:
     peerDependencies:
       storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0
 
-  '@sv443-network/userutils@9.2.1':
-    resolution: {integrity: sha512-d1efzZnm5Jnrfm6dMqnv14KbyHaoRv31mPRaTfoIZUiKyisSd5TrALbe/FXAedgD4up6GUptevNjS94Xly1UOg==}
+  '@sv443-network/userutils@9.3.0':
+    resolution: {integrity: sha512-r/rKMYTRkj4Tu4LYT9BtQF1QElqRNcLCYBinZBg79l3fM3I3poSE+cDLDRwbZNJMVqN15iuCe/08+2deJwoNgg==}
 
   '@testing-library/[email protected]':
     resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==}
@@ -3091,7 +3091,7 @@ snapshots:
     dependencies:
       storybook: 8.6.4([email protected])
 
-  '@sv443-network/userutils@9.2.1':
+  '@sv443-network/userutils@9.3.0':
     dependencies:
       nanoevents: 9.1.0
 

+ 3 - 3
src/config.ts

@@ -1,6 +1,6 @@
-import { DataStore, compress, type DataMigrationsDict, decompress, type LooseUnion, clamp } from "@sv443-network/userutils";
+import { DataStore, compress, type DataMigrationsDict, decompress, type LooseUnion, clamp, purifyObj } from "@sv443-network/userutils";
 import { enableDiscardBeforeUnload, featInfo } from "./features/index.js";
-import { compressionSupported, error, getVideoTime, info, log, pureObj, reloadTab, t, type TrLocale } from "./utils/index.js";
+import { compressionSupported, error, getVideoTime, info, log, reloadTab, t, type TrLocale } from "./utils/index.js";
 import { emitSiteEvent } from "./siteEvents.js";
 import { compressionFormat } from "./constants.js";
 import { emitInterface } from "./interface.js";
@@ -11,7 +11,7 @@ import { showPrompt } from "./dialogs/prompt.js";
 /** If this number is incremented, the features object data will be migrated to the new format */
 export const formatVersion = 10;
 
-export const defaultData = pureObj(
+export const defaultData = purifyObj(
   (Object.keys(featInfo) as (keyof typeof featInfo)[])
     // @ts-ignore
     .filter((ftKey) => featInfo?.[ftKey]?.default !== undefined)

+ 3 - 4
src/constants.ts

@@ -1,6 +1,5 @@
-import { randomId } from "@sv443-network/userutils";
+import { purifyObj, randomId } from "@sv443-network/userutils";
 import { LogLevel } from "./types.js";
-import { pureObj } from "./utils/misc.js";
 
 type ConstTypes = {
   mode: "production" | "development";
@@ -48,7 +47,7 @@ export const changelogUrl = `https://raw.githubusercontent.com/${repo}/${buildNu
 export const initialParams = new URL(location.href).searchParams;
 
 /** Names of platforms by key of {@linkcode host} */
-export const platformNames = pureObj({
+export const platformNames = purifyObj({
   github: "GitHub",
   greasyfork: "GreasyFork",
   openuserjs: "OpenUserJS",
@@ -79,7 +78,7 @@ export const sessionStorageAvailable =
 export const defaultLogLevel: LogLevel = mode === "production" ? LogLevel.Info : LogLevel.Debug;
 
 /** Info about the userscript, parsed from the userscript header (tools/post-build.js) */
-export const scriptInfo = pureObj({
+export const scriptInfo = purifyObj({
   name: GM.info.script.name,
   version: GM.info.script.version,
   namespace: GM.info.script.namespace,

+ 4 - 4
src/interface.ts

@@ -1,7 +1,7 @@
 import * as UserUtils from "@sv443-network/userutils";
 import * as compareVersions from "compare-versions";
 import { mode, branch, host, buildNumber, compressionFormat, scriptInfo, initialParams, sessionStorageAvailable } from "./constants.js";
-import { getDomain, waitVideoElementReady, getResourceUrl, getSessionId, getVideoTime, log, setLocale, getLocale, hasKey, hasKeyFor, t, tp, type TrLocale, info, error, onInteraction, getThumbnailUrl, getBestThumbnailUrl, fetchVideoVotes, setInnerHtml, getCurrentMediaType, tl, tlp, PluginError, formatNumber, reloadTab, getVideoElement, getVideoSelector, pureObj } from "./utils/index.js";
+import { getDomain, waitVideoElementReady, getResourceUrl, getSessionId, getVideoTime, log, setLocale, getLocale, hasKey, hasKeyFor, t, tp, type TrLocale, info, error, onInteraction, getThumbnailUrl, getBestThumbnailUrl, fetchVideoVotes, setInnerHtml, getCurrentMediaType, tl, tlp, PluginError, formatNumber, reloadTab, getVideoElement, getVideoSelector } from "./utils/index.js";
 import { addSelectorListener } from "./observers.js";
 import { defaultData, getFeatures, setFeatures } from "./config.js";
 import { autoLikeStore, featInfo, fetchLyricsUrlTop, getLyricsCacheEntry, sanitizeArtists, sanitizeSong } from "./features/index.js";
@@ -17,7 +17,7 @@ import { showIconToast, showToast } from "./components/toast.js";
 import { ExImDialog } from "./components/ExImDialog.js";
 import { MarkdownDialog } from "./components/MarkdownDialog.js";
 
-const { autoPlural, getUnsafeWindow, randomId, NanoEmitter } = UserUtils;
+const { autoPlural, getUnsafeWindow, purifyObj, randomId, NanoEmitter } = UserUtils;
 
 //#region interface globals
 
@@ -108,7 +108,7 @@ export const allInterfaceEvents = [
  * All functions that can be called on the BYTM interface using `unsafeWindow.BYTM.functionName();` (or `const { functionName } = unsafeWindow.BYTM;`)  
  * If prefixed with /\*🔒\*\/, the function is authenticated and requires a token to be passed as the first argument.
  */
-const globalFuncs: InterfaceFunctions = pureObj({
+const globalFuncs: InterfaceFunctions = purifyObj({
   // meta:
   /*🔒*/ getPluginInfo,
 
@@ -211,7 +211,7 @@ export function setGlobalProp<
   const win = getUnsafeWindow();
 
   if(typeof win.BYTM !== "object")
-    win.BYTM = pureObj({}) as BytmObject;
+    win.BYTM = purifyObj({}) as BytmObject;
 
   win.BYTM[key] = value;
 }