{"_id":"@remix-run/component-hmr","_rev":"4-dc04744f69dfeddf2c1d2229f8000c2e","name":"@remix-run/component-hmr","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0-stage":{"name":"@remix-run/component-hmr","version":"0.0.0-stage","_id":"@remix-run/component-hmr@0.0.0-stage","stub":true,"maintainers":[{"name":"mjackson","email":"mjijackson+npm@gmail.com"}],"dist":{"shasum":"562173097af3f604a27d4d2800feb0c7806b1def","tarball":"https://registry.npmjs.org/@remix-run/component-hmr/-/component-hmr-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-5V1SnSiTIWhE4bFhsHbw37MGgOZzLE8LJBPYrBAplf8V+zwziJ3QgAm8g02cwuhMAj1eruQbLorvV8pirHnnCw==","signatures":[{"sig":"MEQCIHL2GRqf1z7sWtdEWzis1PVTDtPn/tEPAiLxKuh3h39WAiAhqQ0o8gkV9CJIR6oUCCL/boDBN28M0O+5Bu/YbwHh/w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":346},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"0.0.0":{"name":"@remix-run/component-hmr","version":"0.0.0","license":"MIT","_id":"@remix-run/component-hmr@0.0.0","maintainers":[{"name":"mjackson","email":"mjijackson+npm@gmail.com"}],"homepage":"https://github.com/remix-run/remix#readme","bugs":{"url":"https://github.com/remix-run/remix/issues"},"dist":{"shasum":"623f9cf86f69cf292ddd1a47eab56214b3fdc001","tarball":"https://registry.npmjs.org/@remix-run/component-hmr/-/component-hmr-0.0.0.tgz","fileCount":2,"integrity":"sha512-UwGOpFwdWaD9GYrvYK/NL6kfIhde6cwPIwNJ3Y0fbbWeeSqqLTrsTuaTo2/8EknnzMGWX2ivBzoHkSbSgklkpQ==","signatures":[{"sig":"MEQCIFaq3gWh9U2pc5fvcOAu3GlWX3j+Vwnf42k2OQjElBAyAiBgZmmNxA0oQc0tf4RqAjUt2E2SVnq7w49T4JsZUVzLUw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCxoSjguL2wMIxB3YKE5ibJ43ael7SbOSVaZowJOxG1GgIgUvT9VZS5yIjOfE+jakU0mABbQsHh1QDml60zi1krrOo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":473},"_npmUser":{"name":"mjackson","email":"mjijackson+npm@gmail.com"},"repository":{"url":"git+https://github.com/remix-run/remix.git","type":"git","directory":"packages/component-hmr"},"_npmVersion":"12.0.2","description":"Placeholder package for Remix CI/OIDC setup","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/component-hmr_0.0.0_1790873308517_0.6736361791883201","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@remix-run/component-hmr","version":"0.1.0","keywords":["remix","component","hmr","transform"],"author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","_id":"@remix-run/component-hmr@0.1.0","maintainers":[{"name":"mjackson","email":"mjijackson+npm@gmail.com"}],"homepage":"https://github.com/remix-run/remix/tree/main/packages/component-hmr#readme","bugs":{"url":"https://github.com/remix-run/remix/issues"},"dist":{"shasum":"0158202ff9369e6eb0003658b189e3adb6c425ff","tarball":"https://registry.npmjs.org/@remix-run/component-hmr/-/component-hmr-0.1.0.tgz","fileCount":39,"integrity":"sha512-hp4Fvwake4meRJagmZ/P2v8QbFPLYStdY+Ktr4f7y/AoqFrjRxCYZCal2MpRvN/PHL4r5/AV2Fw/7SOD7FCz7Q==","signatures":[{"sig":"MEUCIQCuAseOaGajcMaPl5QNYPHxlGQ4siEHisxLYXE3JXHpaAIgR9AYWc1jIrxyWkgIlSkwCk4eui3dnyMKRd45F4IovWk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDxaayUsH4byVLIEKx9slyDphI5oUh4prX7jDzuzeP0xwIgMXXbLbAdAN7zZtHPJ2A4c0pP0pz+6HzOwgXFnYLPr3A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@remix-run%2fcomponent-hmr@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":137661},"type":"module","_from":"file:/tmp/remix-publish-component-hmr-UfpVao/remix-run-component-hmr-0.1.0.tgz","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","default":"./dist/node.js"},"./assets":{"types":"./dist/assets.d.ts","default":"./dist/assets.js"},"./package.json":"./package.json","./runtime/server":{"types":"./dist/runtime/server.d.ts","default":"./dist/runtime/server.js"},"./runtime/browser":{"types":"./dist/runtime/browser.d.ts","default":"./dist/runtime/browser.js"}},"scripts":{"test":"remix test","build":"tsc -p tsconfig.build.json","clean":"git clean -fdX","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"308b2b82-5b02-4963-83f8-c9db3c9d09d4"}},"_resolved":"/tmp/remix-publish-component-hmr-UfpVao/remix-run-component-hmr-0.1.0.tgz","_integrity":"sha512-hp4Fvwake4meRJagmZ/P2v8QbFPLYStdY+Ktr4f7y/AoqFrjRxCYZCal2MpRvN/PHL4r5/AV2Fw/7SOD7FCz7Q==","repository":{"url":"git+https://github.com/remix-run/remix.git","type":"git","directory":"packages/component-hmr"},"_npmVersion":"11.19.0","description":"Hot module replacement runtime and transforms for Remix components","directories":{},"sideEffects":["./src/node.ts","./dist/node.js"],"_nodeVersion":"24.21.0","dependencies":{"oxc-parser":"^0.121.0","magic-string":"^0.30.21","source-map-js":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{"chokidar":"^5.0.0","playwright":"^1.60.0","typescript":"^7.0.2","@types/node":"^24.6.0","@remix-run/test":"0.6.2","@remix-run/assert":"0.3.1","@remix-run/assets":"^0.8.0","@remix-run/node-hmr":"^0.2.1","@remix-run/node-tsx":"^0.1.2","@remix-run/response":"^0.3.10","@remix-run/component":"^0.8.0","@types/dom-navigation":"^1.0.7","@remix-run/fetch-proxy":"0.9.0","@remix-run/node-fetch-server":"0.14.2"},"_npmOperationalInternal":{"tmp":"tmp/component-hmr_0.1.0_1790874535898_0.5711047189712792","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"_id":"@remix-run/component-hmr@1.0.0","bugs":{"url":"https://github.com/remix-run/remix/issues"},"dist":{"shasum":"101fa3e9a09d353ddd4318cce628acea743659ab","tarball":"https://registry.npmjs.org/@remix-run/component-hmr/-/component-hmr-1.0.0.tgz","fileCount":39,"integrity":"sha512-L/bXKK51q1qPKaRAB/c66lI4bvw/O6wZidCCLSUfOUv2hCFYsUmDuuvan5ZLRLRGri+Gd0vA0TQRVFw/QzmKew==","signatures":[{"sig":"MEYCIQC8N0Dybg4MjGZe2W7MMLNea5bD2+jVOldgaeVtfpc0/wIhAL2mdMdFaGumGwHriVfNs2g1BV1vnaUbY5SDp/b8eedY","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF0li2WOADQ6WPRkLka290U2LyhHBam0NdhxJx17IjU0AiEA/sOKUN05zGc2Dv5rgNcrdFjM5Cqmh5om/qd9781i6t4="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@remix-run%2fcomponent-hmr@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":137659},"name":"@remix-run/component-hmr","type":"module","_from":"file:/tmp/remix-publish-component-hmr-fHZwy5/remix-run-component-hmr-1.0.0.tgz","author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","default":"./dist/node.js"},"./assets":{"types":"./dist/assets.d.ts","default":"./dist/assets.js"},"./package.json":"./package.json","./runtime/server":{"types":"./dist/runtime/server.d.ts","default":"./dist/runtime/server.js"},"./runtime/browser":{"types":"./dist/runtime/browser.d.ts","default":"./dist/runtime/browser.js"}},"license":"MIT","scripts":{"test":"remix test","build":"tsc -p tsconfig.build.json","clean":"git clean -fdX","typecheck":"tsc --noEmit"},"version":"1.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"308b2b82-5b02-4963-83f8-c9db3c9d09d4"}},"homepage":"https://github.com/remix-run/remix/tree/main/packages/component-hmr#readme","keywords":["remix","component","hmr","transform"],"_resolved":"/tmp/remix-publish-component-hmr-fHZwy5/remix-run-component-hmr-1.0.0.tgz","_integrity":"sha512-L/bXKK51q1qPKaRAB/c66lI4bvw/O6wZidCCLSUfOUv2hCFYsUmDuuvan5ZLRLRGri+Gd0vA0TQRVFw/QzmKew==","repository":{"url":"git+https://github.com/remix-run/remix.git","type":"git","directory":"packages/component-hmr"},"_npmVersion":"11.19.0","description":"Hot module replacement runtime and transforms for Remix components","directories":{},"maintainers":[{"name":"mjackson","email":"mjijackson+npm@gmail.com"}],"sideEffects":["./src/node.ts","./dist/node.js"],"_nodeVersion":"24.21.0","dependencies":{"oxc-parser":"^0.121.0","magic-string":"^0.30.21","source-map-js":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{"chokidar":"^5.0.0","playwright":"^1.60.0","typescript":"^7.0.2","@types/node":"^24.6.0","@remix-run/test":"1.0.0","@remix-run/assert":"1.0.0","@remix-run/assets":"^1.0.0","@remix-run/node-hmr":"^1.0.0","@remix-run/node-tsx":"^1.0.0","@remix-run/response":"^1.0.0","@remix-run/component":"^1.0.0","@types/dom-navigation":"^1.0.7","@remix-run/fetch-proxy":"1.0.0","@remix-run/node-fetch-server":"1.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/component-hmr_1.0.0_1790895323802_0.15349952187404647"}}},"time":{"created":"2026-10-01T16:46:22.999Z","modified":"2026-10-01T22:55:24.203Z","0.0.0-stage":"2026-10-01T16:46:22.999Z","0.0.0":"2026-10-01T16:48:28.597Z","0.1.0":"2026-10-01T17:08:55.992Z","1.0.0":"2026-10-01T22:55:23.880Z"},"bugs":{"url":"https://github.com/remix-run/remix/issues"},"author":{"name":"Michael Jackson","email":"mjijackson@gmail.com"},"license":"MIT","homepage":"https://github.com/remix-run/remix/tree/main/packages/component-hmr#readme","keywords":["remix","component","hmr","transform"],"repository":{"url":"git+https://github.com/remix-run/remix.git","type":"git","directory":"packages/component-hmr"},"description":"Hot module replacement runtime and transforms for Remix components","maintainers":[{"name":"mjackson","email":"mjijackson+npm@gmail.com"}],"readme":"# component-hmr\n\nHot module replacement transforms for Remix components, with integrations for Node and `remix/assets`.\n\n`component-hmr` rewrites supported Remix component modules so they can use the standard `import.meta.hot` APIs provided by packages like [`assets`](https://github.com/remix-run/remix/tree/main/packages/assets) and [`node-hmr`](https://github.com/remix-run/remix/tree/main/packages/node-hmr).\n\n## Features\n\n- **Stable Components** - Keep component identity stable while swapping implementations\n- **Remount Fallbacks** - Mark components stale when their setup scope changes\n- **Node Module Hooks** - Transform server component modules through Node's module customization hooks API\n- **Assets Loader** - Transform component modules for the browser through `remix/assets`\n\n## Installation\n\n```sh\nnpm i remix\n```\n\n## Usage\n\nUse `remix/component-hmr/node` as a Node import hook for server modules:\n\n```sh\nnode --import remix/node-tsx --import remix/component-hmr/node ./server.ts\n```\n\nUse `componentHmr()` from `remix/component-hmr/assets` with `remix/assets` for browser modules:\n\n```ts\nimport { createAssetServer } from 'remix/assets'\nimport { componentHmr } from 'remix/component-hmr/assets'\n\nlet isDevelopment = process.env.NODE_ENV === 'development'\n\nlet assetServer = createAssetServer({\n  basePath: '/assets',\n  allowFiles: ['app/routes.ts', 'app/**/public/**'],\n  allowPackages: ['remix'],\n  denyFiles: ['app/**/*.test.*'],\n  hmr: isDevelopment\n    ? {\n        channel: async () => (await import('remix/node-hmr/runtime')).createBrowserHmrChannel(),\n        moduleImporter: 'remix/multiple-import-maps-polyfill',\n      }\n    : undefined,\n  scripts: {\n    loaders: isDevelopment ? [componentHmr()] : undefined,\n  },\n  watch: isDevelopment,\n})\n```\n\nHMR appends mappings for updated modules to the document in additional `<script type=\"importmap\">` elements. The module importer allows browsers without native support for multiple import maps to load these updates.\n\n## Direct Transforms\n\nUse the direct transform APIs when you are writing your own loader, Node module hooks, or build integration.\n\n```ts\nimport { transformComponentsForBrowser } from 'remix/component-hmr'\n\nlet result = transformComponentsForBrowser(source, {\n  importSource: 'remix',\n  moduleUrl: '/assets/app/routes.tsx',\n})\n\nif (result.transformed) {\n  console.log(result.componentNames)\n}\n```\n\n`transformComponentsForBrowser(source, options)` rewrites browser component modules and emits `import.meta.hot.accept()` code for browser updates. The direct transform uses `importSource` to derive imports for the component refresh runtime and browser HMR runtime.\n\n```ts\nimport { transformComponentsForServer } from 'remix/component-hmr'\n\nlet result = transformComponentsForServer(source, {\n  importSource: 'remix',\n  moduleUrl: 'file:///app/routes.tsx',\n})\n```\n\n`transformComponentsForServer(source, options)` rewrites server component modules and registers updated component implementations for the current module URL. The direct transform uses `importSource` to derive imports for the server HMR runtime.\n\nBoth transforms return:\n\n```ts\ntype ComponentsHmrTransformResult = {\n  code: string\n  componentNames: string[]\n  map: string | null\n  transformed: boolean\n}\n```\n\nPass `sourceMap: true` to generate a source map.\n\nUse `importSource` to define where injected imports come from, typically either `remix` or `@remix-run`:\n\n```ts\ntransformComponentsForBrowser(source, {\n  importSource: 'remix',\n  moduleUrl: '/assets/app/routes.tsx',\n})\n\ntransformComponentsForServer(source, {\n  importSource: 'remix',\n  moduleUrl: 'file:///app/routes.tsx',\n})\n```\n\n`importSource: 'remix'` generates imports from `remix/component` and `remix/component-hmr`. `importSource: '@remix-run'` generates imports from `@remix-run/component` and `@remix-run/component-hmr`. Custom import sources follow the same nested import layout.\n\n## Related Packages\n\n- [`assets`](https://github.com/remix-run/remix/tree/main/packages/assets) - Runs loaders while compiling assets\n- [`node-hmr`](https://github.com/remix-run/remix/tree/main/packages/node-hmr) - Provides the server-side `import.meta.hot` runtime\n- [`component`](https://github.com/remix-run/remix/tree/main/packages/component) - Component APIs transformed by `component-hmr`\n\n## License\n\nSee [LICENSE](https://github.com/remix-run/remix/blob/main/LICENSE)\n","readmeFilename":"README.md"}