🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@sunmi/max-print

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sunmi/max-print - npm Package Compare versions

Comparing version
1.0.6
to
1.0.7
+2
-8
package.json
{
"name": "@sunmi/max-print",
"version": "1.0.6",
"version": "1.0.7",
"type": "module",

@@ -18,6 +18,2 @@ "description": "Max print utility package",

"default": "./convertTemplate.mjs"
},
"./release-meta": {
"import": "./releaseMeta.mjs",
"default": "./releaseMeta.mjs"
}

@@ -29,5 +25,3 @@ },

"convertTemplate.mjs",
"convertTemplate.d.ts",
"release-registry.json",
"releaseMeta.mjs"
"convertTemplate.d.ts"
],

@@ -34,0 +28,0 @@ "scripts": {

{
"ossKeyPrefix": "npm-releases/sunmi__max-print",
"slug": "sunmi__max-print",
"description": "与 CI 上传到 OSS 的路径一致。完整 latest 地址 = {ossPublicBaseUrl}/{ossKeyPrefix}/latest.json(ossPublicBaseUrl 不含末尾 /,例如 https://bucket.oss-cn-hangzhou.aliyuncs.com)"
}
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const dir = dirname(fileURLToPath(import.meta.url));
/** @returns {{ ossKeyPrefix: string; slug: string; description?: string }} */
export function getReleaseRegistry() {
const raw = readFileSync(join(dir, 'release-registry.json'), 'utf8');
return JSON.parse(raw);
}
/**
* 拉取当前包在 OSS 上的 latest 元数据(需 Bucket 对 latest.json 可读或通过 CDN 暴露)。
* @param {string} ossPublicBaseUrl 例:https://my-bucket.oss-cn-hangzhou.aliyuncs.com
* @returns {Promise<{ version: string; manifestUrl: string; tgzUrl: string; githubReleaseUrl?: string; filesCdnBase?: string | null; packageFiles: string[]; packageFileCount: number; packageFileUrls?: { path: string; ossKey: string; url: string }[]; publishedAt: string }>}
*/
export async function fetchLatestReleaseMeta(ossPublicBaseUrl) {
const { ossKeyPrefix } = getReleaseRegistry();
const base = ossPublicBaseUrl.replace(/\/$/, '');
const url = `${base}/${ossKeyPrefix}/latest.json`;
const res = await fetch(url);
if (!res.ok) {
throw new Error(`fetchLatestReleaseMeta: ${res.status} ${url}`);
}
return res.json();
}