refactor: 包名改为 @wishesl/dsh-lan-access
与 GitHub 仓库归属 wishedl 对齐(原 @sutong 不是发布身份,npm 发布会 403)。 同时把包名改为单一来源:scripts/build-client.mjs 与 scripts/test-client.mjs 都从 package.json 读取,避免产物 id 与清单漂移。LICENSE 版权主体同步为 wishesl。 顺带修正 src/panel.js 里「Plugins 内页」的过时注释(面板早已是 Settings 顶层入口)。
This commit is contained in:
@@ -17,6 +17,9 @@ import { fileURLToPath } from 'node:url'
|
||||
const here = dirname(fileURLToPath(import.meta.url))
|
||||
const root = join(here, '..')
|
||||
|
||||
/** The browser module id must equal the package name; read it, never restate it. */
|
||||
const packageName = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).name
|
||||
|
||||
/** Read a source file and turn its ESM exports into plain declarations. */
|
||||
function inline(relativePath) {
|
||||
const source = readFileSync(join(root, relativePath), 'utf8')
|
||||
@@ -30,12 +33,12 @@ const qrcode = inline('src/qrcode.js')
|
||||
const panel = inline('src/panel.js')
|
||||
|
||||
const artifact = `/**
|
||||
* @sutong/dsh-lan-access — browser half (generated by scripts/build-client.mjs).
|
||||
* ${packageName} — browser half (generated by scripts/build-client.mjs).
|
||||
*
|
||||
* Do not edit this file: change src/panel.js or src/qrcode.js and rebuild.
|
||||
*/
|
||||
window.__ModuleLoader__.load({
|
||||
id: "@sutong/dsh-lan-access",
|
||||
id: ${JSON.stringify(packageName)},
|
||||
factory: function (require) {
|
||||
"use strict";
|
||||
var React = require("react");
|
||||
|
||||
@@ -17,6 +17,7 @@ import { SUMMARY_PATH } from '../index.js'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const source = readFileSync(join(root, 'client.js'), 'utf8')
|
||||
const packageName = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).name
|
||||
|
||||
const results = []
|
||||
function check(label, condition, detail) {
|
||||
@@ -37,7 +38,7 @@ vm.createContext(sandbox)
|
||||
vm.runInContext(source, sandbox)
|
||||
|
||||
check('artifact registers exactly once', captured !== undefined)
|
||||
check('module id equals the package name', captured?.id === '@sutong/dsh-lan-access', captured?.id)
|
||||
check('module id equals the package name', captured?.id === packageName, captured?.id)
|
||||
check('factory is a function', typeof captured?.factory === 'function')
|
||||
|
||||
// ── stub React ──────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user