{"_id":"@amoursun/version-check-prompt","_rev":"7-1eeb5c837938cc0f942414ede0e67c5e","name":"@amoursun/version-check-prompt","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@amoursun/version-check-prompt","version":"1.0.1","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.1","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"d8451f1870a408f03d1b1645cf32f7602727454c","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.1.tgz","fileCount":40,"integrity":"sha512-JQ4yRLVXpzM6mg0fVcuQ7Wos7R63tqFWuLU+bhSaqPr1djDHZHTkJCJ78GnIu3KQ58+XrUmF9Wjk/WsERWUWhA==","signatures":[{"sig":"MEUCID2bqO2VwFDgucfMfcbznW2nqDRaAVw5nM7o1gB2V5VpAiEApiHvj6RX1sWwkWdAVP4Y43i3AgkiMh3O+/ncRW2+p0s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":288064},"main":"./dist/cjs/index.js","type":"module","types":"./dist/types/index.d.ts","unpkg":"./dist/umd/index.min.js","module":"./dist/esm/index.js","browser":"./dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"}},"gitHead":"0648281953965f82832dffefd452108c2fa9da2f","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","changeset":"changeset","build:package":"zx script/package-config.js","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.1_1745220072367_0.075408298166588","host":"s3://npm-registry-packages-npm-production"}},"1.0.1-alpha.0":{"name":"@amoursun/version-check-prompt","version":"1.0.1-alpha.0","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.1-alpha.0","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"d05e4134dd1854e20513eb4d6e2f27a8ccc4e6af","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.1-alpha.0.tgz","fileCount":40,"integrity":"sha512-SG6QYqToydV/26xfmiS1Vb9fv0FaK/GgQJyIHyTOai5b6IyrgSobDjO1/bHKqN6RtW1xhcAUmpn+e0EZILor3Q==","signatures":[{"sig":"MEYCIQCHRFPwO0+PBY6HaOMsfsUXWdVOQz6bxTT8B0X49yiHjgIhAK8z+dwQTRsw6pSbJcuUwLwE/S1+KV10UxUr8FW7PAvT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":290029},"main":"./dist/cjs/index.js","type":"module","types":"./dist/types/index.d.ts","unpkg":"./dist/umd/index.min.js","module":"./dist/esm/index.js","browser":"./dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"}},"gitHead":"a8ef464c8ba4bb11c8509ab9383952122c191c21","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","publish":"npm publish --access public --registry=https://registry.npmjs.org","changeset":"changeset","build:package":"zx script/package-config.js","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.1-alpha.0_1745220954210_0.8198050949999276","host":"s3://npm-registry-packages-npm-production"}},"1.0.1-alpha.1":{"name":"@amoursun/version-check-prompt","version":"1.0.1-alpha.1","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.1-alpha.1","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"948bd72db139c2e0afda43534458fccda8bb1bf6","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.1-alpha.1.tgz","fileCount":40,"integrity":"sha512-tbX/Pdv+VMqlQ4iWtODL5Yrxj4p2aMNP2HBLQXJ6qwArLxciqY3yKSaWuKNWzFErNxZK8QD6OzVQmZUTpZG2hQ==","signatures":[{"sig":"MEUCIQC/m1PTYD70OWpPanesijyc4ZOsLcotk82UgjNkBiBLJQIgantq5aFADfIXoS8x2c5TXWrHqRgRX0o0lakgnd6LgIU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":290077},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","unpkg":"dist/umd/index.min.js","module":"dist/esm/index.js","browser":"dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"},"./types":{"types":"./dist/types/index.d.ts"}},"gitHead":"63615193b81b66a810715ba4f64b56d6be88e884","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","changeset":"changeset","build:package":"zx script/package-config.js","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.1-alpha.1_1745236631100_0.7427061387788996","host":"s3://npm-registry-packages-npm-production"}},"1.0.1-alpha.2":{"name":"@amoursun/version-check-prompt","version":"1.0.1-alpha.2","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.1-alpha.2","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"1ce3ff66d66e0c1c9dd580eab7c5d7da24a35cae","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.1-alpha.2.tgz","fileCount":36,"integrity":"sha512-6tomOn5f7frUyDWOb5tunxrj7J6cMq9gr4cVSXpYX1gO2cAnx9ISUDdMzUPctXJE9a6h0r21wWdiEGn3PPHqMg==","signatures":[{"sig":"MEQCID9ozA3XzmclzwP5RjCAG1d21A3pn61Www970eg23iC7AiAUcuXrwBQmAtB1gQ0YR9Bmi5XT/4UzL53JxIbS/XgoNA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":294505},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","unpkg":"dist/umd/index.min.js","module":"dist/esm/index.js","browser":"dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"},"./types":{"types":"./dist/types/index.d.ts"}},"gitHead":"d9534989e3a46f585913e8dd068982570b8b6e52","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","test:run":"vitest run","changeset":"changeset","build:package":"zx script/package-config.js","test:coverage":"vitest run --coverage","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.1-alpha.2_1745299991188_0.6908880358632392","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amoursun/version-check-prompt","version":"1.0.2","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.2","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"b1842a5bf29c54aa46817f3ab1bc66d351d13f48","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.2.tgz","fileCount":36,"integrity":"sha512-wFt2i185CD1ZBzyFK76f9m8XdgXc5zGwpN2eisx6GKh3vYjS7/VKRLpIdfG5sInL7VeZnGFXvWmRMjDbvTlhqQ==","signatures":[{"sig":"MEUCIBOZMnLdciXJOX0+dIIQOKi4jy2LKHEvFidEw6zvZqcsAiEAhwWIuKrqDvqUdeB6RR7W+3LKKGXg+gxBU2VmBXRf/o8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":305781},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","unpkg":"dist/umd/index.min.js","module":"dist/esm/index.js","browser":"dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"},"./types":{"types":"./dist/types/index.d.ts"},"./custom-version":{"require":"./dist/scripts/generate-version.cjs"}},"gitHead":"e0835b5d78133310f31dd2cf30595a7b1d3572f3","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","test:run":"vitest run","changeset":"changeset","build:package":"zx script/package-config.js","test:coverage":"vitest run --coverage","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.2_1745327302846_0.38404338020847373","host":"s3://npm-registry-packages-npm-production"}},"1.0.2-beta.0":{"name":"@amoursun/version-check-prompt","version":"1.0.2-beta.0","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","_id":"@amoursun/version-check-prompt@1.0.2-beta.0","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"dist":{"shasum":"f526481051d23e0323182855e015b8ce48708fef","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.2-beta.0.tgz","fileCount":36,"integrity":"sha512-wi3JqGhpJSmC8AzN8GaIjA4YIMTOW+QRbIaH9KQEtdRC8KoZbrfJbRnaRyQ3inQlOj4CLpwzAc1gBb3eRckczw==","signatures":[{"sig":"MEYCIQCzKf0ytkufQrfnwXqzWvNDLTibp6D0Uldvwnj4YNvndAIhAJIUmcEjlI9sPt+A77VSwj2nAQ7PY7rJMuhqKfYRb9qh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":305779},"main":"dist/cjs/index.js","type":"module","types":"dist/types/index.d.ts","unpkg":"dist/umd/index.min.js","module":"dist/esm/index.js","browser":"dist/umd/index.js","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/umd/index.min.js","require":"./dist/cjs/index.js"},"./types":{"types":"./dist/types/index.d.ts"},"./custom-version":"./dist/scripts/custom-version.cjs"},"gitHead":"cdb451e82e0609ccac4960cf0fb09f391ec6cd9d","private":false,"scripts":{"dev":"rslib build --watch","test":"vitest","build":"pnpm run clean && rslib build","clean":"rimraf dist","prepare":"pnpm run build","test:run":"vitest run","changeset":"changeset","build:package":"zx script/package-config.js","test:coverage":"vitest run --coverage","build:test:version":"zx scripts/generate-version.js -o dest/json"},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"repository":{"url":"git+https://github.com/amoursun/version-check-prompt.git","type":"git"},"_npmVersion":"9.5.1","description":"前端资源更新检查提示","directories":{},"_nodeVersion":"18.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.0.0","devDependencies":{"zx":"^8.5.2","jsdom":"^26.1.0","rimraf":"^6.0.1","vitest":"^3.1.1","shelljs":"^0.9.2","prettier":"^3.5.3","typescript":"^5.8.3","@rslib/core":"^0.6.2","@types/node":"^22.14.1","@biomejs/biome":"^1.9.4","@types/shelljs":"^0.8.15","@changesets/cli":"^2.28.1","rsbuild-plugin-dts":"^0.6.3","@vitest/coverage-v8":"3.1.1","@testing-library/jest-dom":"^6.6.3"},"_npmOperationalInternal":{"tmp":"tmp/version-check-prompt_1.0.2-beta.0_1745374023088_0.8708753988313263","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amoursun/version-check-prompt","version":"1.0.3","description":"前端资源更新检查提示","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"homepage":"https://github.com/amoursun/version-check-prompt","bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"repository":{"type":"git","url":"git+https://github.com/amoursun/version-check-prompt.git"},"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","type":"module","private":false,"exports":{".":{"types":"./dist/types/index.d.ts","browser":"./dist/umd/index.min.js","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./types":{"types":"./dist/types/index.d.ts"}},"main":"dist/cjs/index.js","module":"dist/esm/index.js","browser":"dist/umd/index.js","unpkg":"dist/umd/index.min.js","types":"dist/types/index.d.ts","scripts":{"build":"pnpm run clean && rslib build","dev":"rslib build --watch","clean":"rimraf dist","changeset":"changeset","build:package":"zx script/package-config.js","build:test:version":"zx script/custom-version.js -o dest/json","prepare":"pnpm run build","test":"vitest","test:run":"vitest run","test:coverage":"vitest run --coverage"},"devDependencies":{"@biomejs/biome":"^1.9.4","@changesets/cli":"^2.28.1","@rslib/core":"^0.6.2","@testing-library/jest-dom":"^6.6.3","@types/node":"^22.14.1","@types/shelljs":"^0.8.15","@vitest/coverage-v8":"3.1.1","jsdom":"^26.1.0","prettier":"^3.5.3","rimraf":"^6.0.1","rsbuild-plugin-dts":"^0.6.3","shelljs":"^0.9.2","typescript":"^5.8.3","vitest":"^3.1.1","zx":"^8.5.2"},"packageManager":"pnpm@9.0.0","engines":{"node":">=18.0.0","pnpm":">=9.0.0"},"gitHead":"a1a77abf22127882df700dfee428e554be8c3fbb","_id":"@amoursun/version-check-prompt@1.0.3","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-x32WW11lNsCd37CV053ZsazNz98eEhbXn7GodAZZKG3XOVLXFJAL9yQ4FM7cIHODW4Isx63fR9AFB4zP6oGGYQ==","shasum":"454bbbe9cf3fabf1585465c78ae82e71a79b4197","tarball":"https://registry.npmjs.org/@amoursun/version-check-prompt/-/version-check-prompt-1.0.3.tgz","fileCount":35,"unpackedSize":300707,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDNx2tCS4g82HgwFUt8vhmzKblc1/yzuSDXUwr/kvv7nAIhAP37uFsbRY2KyVt12vDdVvwiK8I8hqHUARFDr1g/FpxA"}]},"_npmUser":{"name":"amoursun","email":"yanlingan_web@163.com"},"directories":{},"maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/version-check-prompt_1.0.3_1745374602540_0.08386283446965548"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-21T07:21:12.274Z","modified":"2025-04-23T02:16:42.929Z","1.0.1":"2025-04-21T07:21:12.537Z","1.0.1-alpha.0":"2025-04-21T07:35:54.401Z","1.0.1-alpha.1":"2025-04-21T11:57:11.308Z","1.0.1-alpha.2":"2025-04-22T05:33:11.397Z","1.0.2":"2025-04-22T13:08:23.083Z","1.0.2-beta.0":"2025-04-23T02:07:03.297Z","1.0.3":"2025-04-23T02:16:42.741Z"},"bugs":{"url":"https://github.com/amoursun/version-check-prompt/issues"},"author":{"name":"amoursun","email":"gylssm@126.com"},"license":"MIT","homepage":"https://github.com/amoursun/version-check-prompt","keywords":["version","chunk","update","upgrade","check","polling","prompt"],"repository":{"type":"git","url":"git+https://github.com/amoursun/version-check-prompt.git"},"description":"前端资源更新检查提示","maintainers":[{"name":"amoursun","email":"yanlingan_web@163.com"}],"readme":"# version-check-prompt\n\n> 一个用于检测网页版本更新并提示用户刷新的轻量级库。\n\n## 功能特点\n\n- 针对前端 web 单页应用（SPA）而设计\n- 纯前端技术实现，使用简单无需后端支持\n- 支持多种版本检测模式：ETag、Chunk、JSON\n- 支持 Web Worker 和 setInterval 两种轮询方式\n  - 默认使用 Web Worker, 可以设置Web Worker 和 setInterval 的切换策略\n  - Worker不支持降级到 setInterval\n- 支持页面可见性检测，自动暂停/恢复轮询\n- 支持浏览器活跃状态检测\n- 支持空闲任务队列，在浏览器空闲时执行版本检查\n- 支持自定义轮询时间、检测类型等配置\n- 支持 TypeScript\n\n## 安装\n\n```bash\nnpm install @amoursun/version-check-prompt\n\n\n```\n\n## 使用方法\n\n```typescript\nimport { createVersionCheckPrompt, IVersionModeEnum } from '@amoursun/version-check-prompt';\n\nconst versionCheck = createVersionCheckPrompt({\n  mode: IVersionModeEnum.ETAG,\n  htmlUrl: 'https://example.com', // 默认使用当前页面 URL\n  onUpdate: (self) => {\n    if (confirm('发现新版本，是否更新？')) {\n      self.refresh();\n    }\n  },\n  onError: (error) => {\n    console.error('版本检查出错：', error);\n  },\n  activityOption: {\n    usable: true,\n    duration: 4 * 60 * 60 * 1000, // 4小时\n    onInactivityPrompt: (self) => {\n      if (confirm('您已长时间未操作，是否刷新页面？')) {\n        self.refresh();\n      }\n    },\n  },\n});\n```\n\n## 配置选项\n\n### 主要配置\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| usable | boolean | true | 是否启用版本检查，可用于开发环境禁用 |\n| usePollingType | IPollingTypeEnum | 'worker' | 使用检查模式 web worker 还是直接setInterval |\n| mode | IVersionModeEnum | 'etag' | 版本检测模式：etag/chunk/json |\n| htmlUrl | string | location.href | HTML 文件 URL |\n| jsonUrl | string | - | JSON 文件 URL（JSON 模式需要） |\n| pollingTime | number | 5 * 60 * 1000 | 轮询间隔时间（毫秒） |\n| forbiddenPolling | boolean | false | 是否禁用轮询 |\n| visibilityUsable | boolean | false | 是否启用页面可见性检测 |\n| chunkCheckTypes | IChunkCheckTypesEnum[] | ['script_src'] | Chunk 模式下检测的文件类型 |\n\n### 活跃状态配置\n\n| 参数 | 类型 | 默认值 | 说明 |\n|------|------|--------|------|\n| usable | boolean | false | 是否启用活跃状态检测 |\n| duration | number | 4 * 60 * 60 * 1000 | 检测时间间隔（毫秒） |\n| eventNames | string[] | ['click', 'mousemove', 'keydown', 'scroll', 'touchstart'] | 监听的事件名 |\n| onInactivityPrompt | function | - | 超时回调函数 |\n\n## API\n\n### 主实例方法\n\n| 方法 | 说明 |\n|------|------|\n| refresh() | 刷新当前页面 |\n| reset() | 重置检测 |\n| check() | 手动触发检测 |\n| stop() | 停止检测并忽略更新提示 |\n| dispose() | 销毁实例 |\n\n### 活跃状态实例方法\n\n| 方法 | 说明 |\n|------|------|\n| refresh() | 刷新当前页面 |\n| reset() | 重置检测 |\n| stop() | 停止检测并忽略更新提示 |\n| dispose() | 销毁实例 |\n\n## 版本检测模式\n\n### ETag 模式\n\n通过比较 HTML 文件的 ETag 头来检测版本更新。\n- 使用`HTTP ETag`作为版本标识符来判断应用是否有更新\n- HTTP ETag`说明：每次请求`index.html`文件时，HTTP 响应头上会有一个 [ETag](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/ETag) 字段，\n- 格式类似`ETag: W/\"0815\"`该字段的值是服务器资源的唯一标识符，通过比较前后两次请求的 Etag 字段值，可以判断资源是否发生变化，以这个为依据判断是否有更新。  \n- 缺点是`HTTP ETag`是由服务器生成的，前端不可控。\n  \n1. 使用`Web Worker`API 在浏览器后台**轮询**请求`index.html`文件，不会影响主线程运行。(或者 `setInterval`直接轮询)\n2. 请求`index.html`文件，对比本地和请求响应头的 ETag 的字段值。\n3. 如果 ETag 字段值不一致，说明有更新，则弹出更新提示，并引导用户手动**刷新页面**（例如弹窗提示），完成应用更新。\n4. 当页面不可见时（例如切换标签页或最小化窗口），停止实时检测任务；再次可见时（例如切换回标签页或还原窗口），恢复实时检测任务。\n\n\n### Chunk 模式\n\n通过检测指定的资源文件（如 JS、CSS）的更新来检测版本更新。\n- 使用`chunkHash`作为版本标识符来判断应用是否有更新。  \n- `chunk`说明：因为前端 spa 项目都是打包后再部署，这里以 vite 为例，打包产物 index.html 文件内容中会存在一个 script 标签，格式类似`<script type=\"module\" crossorigin src=\"/assets/index.065a65a6.js\"></script>`，`/assets/index.065a65a6.js`等是否有差异新增变化, 判断以这个为依据判断是否有更新。\n\n1. 使用`Web Worker`API 在浏览器后台**轮询**请求`index.html`文件，不会影响主线程运行。\n2. 请求`index.html`文件，对比当前文件和最新文件中的`chunk`的值。\n3. 如果`chunk`值不一致，说明有更新，则弹出更新提示，并引导用户手动**刷新页面**（例如弹窗提示），完成应用更新。\n4. 其他逻辑和方式一保持一致。\n\n### JSON 模式\n\n通过比较 JSON 文件内容来检测版本更新。\n- 使用 `version.json` 文件管理版本内容，由开发者手动控制应用版本更新。\n- 缺点是需要开发者手动维护 `version.json` 文件\n\n1. 使用`Web Worker`API 在浏览器后台**轮询**请求`version.json`文件，不会影响主线程运行。\n2. 请求`version.json`文件，对比当前文件和最新文件中的 version 字段值。\n3. 版本号比较如果变化版本则弹出更新提示，并引导用户手动**刷新页面**（例如弹窗提示），完成应用更新。\n4. 其他逻辑和方式一保持一致。\n   \ncustom-version.js\n```js\n// 引入文件系统模块中的读取和写入功能\nconst { readFileSync, writeFileSync, mkdirSync, existsSync } = require('node:fs');\n// 解析路径模块，用于处理文件路径\nconst path = require('node:path');\n\nfunction getRootDir() {\n    // 优先从环境变量读取\n    if (process.env.PROJECT_ROOT) {\n        return path.resolve(process.env.PROJECT_ROOT);\n    }\n    // 动态查找 package.json\n    let currentDir = __dirname;\n    while (currentDir !== path.parse(currentDir).root) {\n        if (fs.existsSync(path.join(currentDir, 'package.json'))) {\n            return currentDir;\n        }\n        currentDir = path.dirname(currentDir);\n    }\n    throw new Error('未找到项目根目录（需存在 package.json）');\n}\nconst rootDir = getRootDir();\n\n// [\n//     '/Users/xxx/.nvm/versions/node/v18.16.0/bin/node',\n//     '/Users/xxx/Desktop/github/version-check-prompt/script/config-version.cjs',\n//     // zx 执行命令 时，会传入以下参数 script/config-version.js, node 执行命令则没有\n//     '-o',\n//     '你要输出的目录',\n// ]\nconst args = process.argv.slice(2); // 去掉前两个默认参数(node路径和脚本路径)\nlet outputDir = ''; // 默认值\n\n// 解析 -o 参数, node / zx 等输出结果不同, node -o(2), zx -o(3)\n// node script/config-version.cjs -o 输出目录 => -o(2) 输出目录(3)\n// zx script/config-version.cjs -o 输出目录 => -o(3) 输出目录(4)\nconst oIndex = args.indexOf('-o');\nif (oIndex !== -1 && args[oIndex + 1]) {\n    outputDir = args[oIndex + 1];\n}\nif (outputDir.includes('..')) {\n    throw new Error('输出目录路径不能包含上级目录引用（如 \"..\"）');\n}\nelse if (!outputDir.trim()) {\n    throw new Error('输出目录路径不能为空');\n}\nconsole.log('输出目录:', outputDir);\n\nconst basePathFold = path.join(rootDir, outputDir);\nconst versionFilePath = path.join(basePathFold, 'version.json');\n\n// 确保目录存在\nif (!existsSync(basePathFold)) {\n    mkdirSync(basePathFold, { recursive: true });\n}\n\nfunction formatTime(date) {\n    /**\n     * hour12: false: 强制使用24小时制, 避免输出 PM/AM\n     * replace(/\\//g, '-'): 默认中文环境下日期分隔符是 /, 替换为 -\n     * replace(/,/g, ''): 移除日期和时间之间的逗号（如 2025/04/17, 19:48:03 → 2025-04-17 19:48:03）\n     * en-US: 04-17-2025 19:51:34\n     * zh-CN: 2025-04-17 19:51:34\n     */\n    return new Intl.DateTimeFormat('zh-CN', {\n        year: 'numeric',\n        month: '2-digit',\n        day: '2-digit',\n        hour: '2-digit',\n        minute: '2-digit',\n        second: '2-digit',\n        hour12: false\n    })\n    .format(date)\n    .replace(/\\//g, '-')\n    .replace(/,/g, '');\n}\n// // 初始化版本文件\n// if (!existsSync(versionFilePath)) {\n//     writeFileSync(versionFilePath, JSON.stringify({\n//     }, 'utf-8', 4));\n// }\n\n// 获取当前时间戳和格式化时间\nfunction getCurrentVersionInfo() {\n    const now = new Date();\n    return {\n        version: now.toISOString().replace(/[-:T.]/g, '').slice(0, 14), // YYYYMMDDHHmmss\n        timestamp: now.getTime(),\n        formattedTime: formatTime(now)\n    };\n}\n\n// 更新版本\nfunction updateVersion() {\n    const newInfo = getCurrentVersionInfo();\n    \n    \n    writeFileSync(\n        versionFilePath,\n        JSON.stringify(newInfo, 'utf-8', 4)\n    );\n    console.log('版本已更新:', newInfo);\n}\n\nfunction main() {\n    // 执行更新操作\n    updateVersion();\n}\n\nmain();\n\n```\n```json\n\"scripts\": {\n    \"build:test:version\": \"zx scripts/custom-version.js -o dest/json\",\n    \"build:test:version2\": \"node scripts/custom-version.js -o dest/json\",\n},\n```\n\n## 浏览器兼容性\n\n适用于支持原生 ES Modules 的浏览器\n\n```yaml title=\".browserslistrc\"\nchrome >= 87\nedge >= 88\nfirefox >= 78\nsafari >= 14\n```\n\n## 开发\n\n```bash\n# 安装依赖\nnpm install\n\n# 运行测试\nnpm test\n\n# 构建\nnpm run build\n```\n\n## 发布\n```bash\nnpm publish --access public --registry https://registry.npmjs.org\nnpm pack --dry-run # 检查打包文件结构\n\n```\n\n## 许可证\n\nMIT\n\n\n## 测试命令\n```sh\n# 交互式测试模式\nnpm test\n\n# 单次运行测试\nnpm run test:run\n\n# 运行测试并生成覆盖率报告\nnpm run test:coverage\n\n# 运行特定测试文件\nnpx vitest src/utils/util-polling.test.ts\n\n# 运行匹配特定名称的测试\nnpx vitest -t \"checkUpdated\"\n\n# 设置测试超时时间为 10 秒\nnpx vitest --testTimeout 10000\n\n# 使用 JSON 报告格式\nnpx vitest --reporter json\n\n# 想要测试 src/utils 和 src/polling 文件夹，并生成覆盖率报告\nnpx vitest run --coverage src/utils src/polling\n\n# 监视模式\nnpx vitest --watch\n\n# 生成覆盖率报告\nnpx vitest --coverage\n\n# 测试所有 utils 文件夹下的文件\nnpx vitest \"src/**/utils/**/*.test.ts\"\n\n# 测试所有以 .test.ts 结尾的文件\nnpx vitest \"**/*.test.ts\"\n","readmeFilename":"README.md"}