ddb4c8175f
packages/embed-loader:手写零依赖加载器(esbuild bundle+minify→dist/v1/loader.js, IIFE target es2018 4.7KB)。自发现 EMBED_ORIGIN(currentScript 兜底扫描)、 data-slot 必填缺失静默 no-op、__photoliveEmbedV1 标记去重+同槽去重、 窄屏 <480px 强制 sm+默认收起、postMessage 双向白名单(source+origin 严格 校验,resize 夹取 60-640)、sessionStorage 收起记忆、零全局零 console 全静默。sync 脚本携 sha256 校验拷贝至 viewer publicDir(两份产物入库); src/params.js 为 loader/单测共用参数源(11 vitest 用例)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
19 lines
880 B
JSON
19 lines
880 B
JSON
{
|
||
"name": "@photo/embed-loader",
|
||
"version": "1.0.0",
|
||
"private": true,
|
||
"type": "module",
|
||
"description": "PhotoLive embeddable widget loader (versioned artifact /embed/v1/loader.js served by viewer static; handwritten zero-dependency JS, bundled+minified via esbuild)",
|
||
"//": "发布物即 dist/v1/loader.js 文件本身(viewer publicDir 携带,不走 npm)——故 private。src/params.js 是 loader 与单测共用的唯一参数源,esbuild 打包时内联。无 TS:typecheck 任务不存在即被 turbo 干净跳过,lint 由根 flat config 覆盖 .js。",
|
||
"scripts": {
|
||
"build": "esbuild src/loader.js --bundle --minify --format=iife --target=es2018 --outfile=dist/v1/loader.js",
|
||
"sync": "node sync-to-viewer.js",
|
||
"test": "vitest run",
|
||
"lint": "eslint ."
|
||
},
|
||
"devDependencies": {
|
||
"esbuild": "^0.21.5",
|
||
"vitest": "^2.1.0"
|
||
}
|
||
}
|