node-taglib-sharp-extend
Advanced tools
Comparing version
@@ -153,3 +153,4 @@ import { | ||
frameFactory_default | ||
} from "./chunk-SS7NR7YX.js"; | ||
} from "./chunk-BSDQCDRB.js"; | ||
import "./chunk-BG6MEPCE.js"; | ||
export { | ||
@@ -156,0 +157,0 @@ AacFile, |
@@ -1,2 +0,2 @@ | ||
import { IPicture, PictureType, File } from 'node-taglib-sharp-memory/src'; | ||
import { c as IPicture, g as PictureType, F as File } from './file-oxeNrhGc.js'; | ||
@@ -3,0 +3,0 @@ type AudioQualityType = 'HQ' | 'Hi-Res' | 'SQ'; |
@@ -6,5 +6,8 @@ import { | ||
Picture | ||
} from "./chunk-SS7NR7YX.js"; | ||
} from "./chunk-BSDQCDRB.js"; | ||
import { | ||
__async | ||
} from "./chunk-BG6MEPCE.js"; | ||
// src/utils.ts | ||
// __src/utils.ts | ||
var AudioTagMap = { | ||
@@ -82,25 +85,27 @@ title: "title", | ||
} | ||
async function checkWebWorkerSupport() { | ||
const inner = () => !!globalThis.crypto.getRandomValues; | ||
if ("importScripts" in globalThis) { | ||
return inner(); | ||
} | ||
try { | ||
const url = URL.createObjectURL(new Blob([`postMessage((${inner})())`])); | ||
const worker = new Worker(url); | ||
const result = await new Promise((resolve) => { | ||
worker.onmessage = ({ data }) => { | ||
resolve(data); | ||
}; | ||
worker.onerror = (err) => { | ||
err.preventDefault(); | ||
resolve(false); | ||
}; | ||
}); | ||
worker.terminate(); | ||
URL.revokeObjectURL(url); | ||
return result; | ||
} catch { | ||
return false; | ||
} | ||
function checkWebWorkerSupport() { | ||
return __async(this, null, function* () { | ||
const inner = () => !!globalThis.crypto.getRandomValues; | ||
if ("importScripts" in globalThis) { | ||
return inner(); | ||
} | ||
try { | ||
const url = URL.createObjectURL(new Blob([`postMessage((${inner})())`])); | ||
const worker = new Worker(url); | ||
const result = yield new Promise((resolve) => { | ||
worker.onmessage = ({ data }) => { | ||
resolve(data); | ||
}; | ||
worker.onerror = (err) => { | ||
err.preventDefault(); | ||
resolve(false); | ||
}; | ||
}); | ||
worker.terminate(); | ||
URL.revokeObjectURL(url); | ||
return result; | ||
} catch (e) { | ||
return false; | ||
} | ||
}); | ||
} | ||
@@ -128,11 +133,13 @@ function getFileFromBuffer(fileName, buffer) { | ||
} | ||
async function getPictureBase64(picture) { | ||
let reader = new FileReader(); | ||
let promise = new Promise( | ||
(resolve) => reader.onload = () => resolve(reader.result) | ||
); | ||
let type = "application/octet-stream"; | ||
let blob = new Blob([picture.data.buffer], { type }); | ||
reader.readAsDataURL(blob); | ||
return (await promise).replace(type, picture.mimeType); | ||
function getPictureBase64(picture) { | ||
return __async(this, null, function* () { | ||
let reader = new FileReader(); | ||
let promise = new Promise( | ||
(resolve) => reader.onload = () => resolve(reader.result) | ||
); | ||
let type = "application/octet-stream"; | ||
let blob = new Blob([picture.data.buffer], { type }); | ||
reader.readAsDataURL(blob); | ||
return (yield promise).replace(type, picture.mimeType); | ||
}); | ||
} | ||
@@ -139,0 +146,0 @@ export { |
@@ -1,2 +0,8 @@ | ||
// src/vite.ts | ||
import { | ||
__objRest, | ||
__spreadProps, | ||
__spreadValues | ||
} from "./chunk-BG6MEPCE.js"; | ||
// __src/vite.ts | ||
import MagicString from "magic-string"; | ||
@@ -12,8 +18,11 @@ import { nodePolyfills } from "vite-plugin-node-polyfills"; | ||
function polyfillTaglib(extraOptions = {}) { | ||
const { | ||
const _a = extraOptions, { | ||
isBuild, | ||
include = [], | ||
globals: extraGlobals, | ||
...rest | ||
} = extraOptions; | ||
globals: extraGlobals | ||
} = _a, rest = __objRest(_a, [ | ||
"isBuild", | ||
"include", | ||
"globals" | ||
]); | ||
include.push("buffer", "string_decoder"); | ||
@@ -51,7 +60,6 @@ !isBuild && include.push(...DEV_POLYFILL_MODULES); | ||
}, | ||
nodePolyfills({ | ||
...rest, | ||
globals: { ...extraGlobals, Buffer: true }, | ||
nodePolyfills(__spreadProps(__spreadValues({}, rest), { | ||
globals: __spreadProps(__spreadValues({}, extraGlobals), { Buffer: true }), | ||
include | ||
}) | ||
})) | ||
]; | ||
@@ -58,0 +66,0 @@ } |
{ | ||
"name": "node-taglib-sharp-extend", | ||
"type": "module", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "read and write audio file metadata in nodejs / browser(memory)", | ||
@@ -42,2 +42,5 @@ "author": "subframe7536", | ||
], | ||
"engines": { | ||
"node": ">=16.7.0" | ||
}, | ||
"scripts": { | ||
@@ -47,3 +50,3 @@ "lint": "tsc --noEmit && eslint . --max-warnings 0", | ||
"dev": "tsup --watch", | ||
"build": "tsup", | ||
"build": "node build.mjs", | ||
"release": "pnpm test && pnpm run build && bumpp --all && npm publish", | ||
@@ -84,2 +87,5 @@ "test": "vitest --run", | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"iconv-lite@0.6.3": "patches/iconv-lite@0.6.3.patch" | ||
}, | ||
"overrides": { | ||
@@ -86,0 +92,0 @@ "assert": "npm:@nolyfill/assert@latest", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4080744
28.6%19
18.75%105575
12.47%0
-100%8
33.33%