{"_id":"@aurouscia/signalr-comment-fixer","_rev":"2-b6f6c766cdabecbedbfbafb1f3766267","name":"@aurouscia/signalr-comment-fixer","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"@aurouscia/signalr-comment-fixer","version":"0.0.0","author":{"name":"Au"},"license":"Apache-2.0","_id":"@aurouscia/signalr-comment-fixer@0.0.0","maintainers":[{"name":"aurouscia","email":"18971501210@189.cn"}],"dist":{"shasum":"ce5b7e89074069c63a59b89855e5ed0ab204fa10","tarball":"https://registry.npmjs.org/@aurouscia/signalr-comment-fixer/-/signalr-comment-fixer-0.0.0.tgz","fileCount":5,"integrity":"sha512-nO9Sn0HtoBHmAMXd96HChZfZ/0LeXXE9wotPfinXPP5jLtU3KGuuLlxck5+c4c9coka9dRd3EGb7RR4Q9VbbYg==","signatures":[{"sig":"MEQCIDUYQuD1+D4uR6Wvw0PIbEgPgSNyox3FXcHI5St74qc9AiAXZPPokj+GJSteTgHF63mPnoF8l7qlILutb3bjQScpUw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4431},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","module":"dist/index.js","gitHead":"2bfc88ef36d6f905f5ff689c291ab1d4ddf0b0d0","scripts":{"test":"vitest","build":"vite build","prepack":"npm run build","build-demo":"vite build --config vite.config.demo.ts"},"_npmUser":{"name":"aurouscia","email":"18971501210@189.cn"},"repository":{"url":"https://gitee.com/au114514/au-npm-pkgs","type":"git","directory":"packages/signalr-comment-fixer"},"_npmVersion":"11.14.1","description":"一个 Vite 插件，用于消除构建 `@microsoft/signalr` 时出现的 `/*#__PURE__*/` 注释警告。","directories":{},"_nodeVersion":"24.13.0","dependencies":{"@microsoft/signalr":"^10.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.1","vitest":"^4.0.18","typescript":"^5.9.3","vite-plugin-dts":"^4.5.4"},"_npmOperationalInternal":{"tmp":"tmp/signalr-comment-fixer_0.0.0_1782631539939_0.4234701431370984","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@aurouscia/signalr-comment-fixer","version":"1.0.0","type":"module","license":"Apache-2.0","author":{"name":"Au"},"main":"dist/index.js","module":"dist/index.js","types":"./dist/index.d.ts","repository":{"type":"git","url":"https://gitee.com/au114514/au-npm-pkgs","directory":"packages/signalr-comment-fixer"},"scripts":{"test":"vitest","build":"vite build","build-demo":"vite build --config vite.config.demo.ts","prepack":"npm run build"},"devDependencies":{"@microsoft/signalr":"^10.0.0","typescript":"^5.9.3","vite":"^7.3.1","vite-plugin-dts":"^4.5.4","vitest":"^4.0.18"},"gitHead":"2fec376859242dbb12d8de0e59bb254f665a5d2d","_id":"@aurouscia/signalr-comment-fixer@1.0.0","description":"一个 Vite 插件，用于消除构建 `@microsoft/signalr` 时出现的 `/*#__PURE__*/` 注释警告。","_nodeVersion":"24.13.0","_npmVersion":"11.14.1","dist":{"integrity":"sha512-/9IU82/aA4mgUOgYTk52kDceiHZyhY6n+Qi5PBUBioAqVnMF9CczqqsPY9dymZ3M4RrrQ4QzC4K6tjV3pmZDig==","shasum":"9e76d45e83c0cb50719d38c087d100c3bdc32c56","tarball":"https://registry.npmjs.org/@aurouscia/signalr-comment-fixer/-/signalr-comment-fixer-1.0.0.tgz","fileCount":5,"unpackedSize":4407,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEZ7kLixmtys0ERHNVWly66HXpJr1qWt3CmuR6l2kVl/AiAb3A6dbvv1TjTGlpln1uuZW4ba34zLnfGifqV11Ckh8A=="}]},"_npmUser":{"name":"aurouscia","email":"18971501210@189.cn"},"directories":{},"maintainers":[{"name":"aurouscia","email":"18971501210@189.cn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/signalr-comment-fixer_1.0.0_1782632407321_0.6666410638353419"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-28T07:25:39.792Z","modified":"2026-06-28T07:40:07.536Z","0.0.0":"2026-06-28T07:25:40.059Z","1.0.0":"2026-06-28T07:40:07.445Z"},"author":{"name":"Au"},"license":"Apache-2.0","repository":{"type":"git","url":"https://gitee.com/au114514/au-npm-pkgs","directory":"packages/signalr-comment-fixer"},"description":"一个 Vite 插件，用于消除构建 `@microsoft/signalr` 时出现的 `/*#__PURE__*/` 注释警告。","maintainers":[{"name":"aurouscia","email":"18971501210@189.cn"}],"readme":"# signalr-comment-fixer\n\n一个 Vite 插件，用于消除构建 `@microsoft/signalr` 时出现的 `/*#__PURE__*/` 注释警告。\n\n## 安装\n\n```bash\nnpm install @aurouscia/signalr-comment-fixer --save-dev\n```\n\n```bash\npnpm add -D @aurouscia/signalr-comment-fixer\n```\n\n## 问题背景\n\n使用 Vite/Rollup 构建依赖 `@microsoft/signalr` 的项目时，可能会遇到如下警告：\n\n```text\nA comment \"/*#__PURE__*/\" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.\n```\n\n该警告不会影响构建结果，但会在每次构建时刷屏。其原因是 `@microsoft/signalr` 的部分代码把 `/*#__PURE__*/` 注释放在了函数声明之前，而 Rollup 无法识别这种位置的注解。\n\n本插件会在 transform 阶段自动处理 `@microsoft/signalr` 模块，移除函数声明前的 `/*#__PURE__*/` 注释，从而避免警告。\n\n## 使用\n\n在 `vite.config.ts` 中引入并注册插件：\n\n```typescript\nimport { defineConfig } from 'vite'\nimport { signalrCommentFixerPlugin } from '@aurouscia/signalr-comment-fixer'\n\nexport default defineConfig({\n  plugins: [\n    signalrCommentFixerPlugin()\n  ]\n})\n```\n\n## API 参考\n\n### `signalrCommentFixerPlugin()`\n\n返回一个 Vite 插件对象。\n\n```typescript\nfunction signalrCommentFixerPlugin(): Plugin\n```\n\n| 属性 | 值 | 说明 |\n|------|-----|------|\n| `name` | `'signalr-comment-fixer'` | 插件名称 |\n| `enforce` | `'pre'` | 确保插件尽早执行 |\n\n## 实现细节\n\n- 插件通过 `transform` 钩子处理模块代码。\n- 仅对路径中包含 `@microsoft/signalr` 的模块生效。\n- 使用正则表达式移除函数声明前的 `/*#__PURE__*/` 注释，不影响其他代码或注释。\n\n## 注意事项\n\n- 本插件仅用于消除构建警告，不会修改 `@microsoft/signalr` 的运行时行为。\n- 如果 `@microsoft/signalr` 在后续版本中修复了该注释位置问题，可以移除本插件。\n","readmeFilename":"README.md"}