Skip to content

Releases: Julien-R44/hot-hook

Throw if boundary file not dynamicaly imported

Choose a tag to compare

@Julien-R44 Julien-R44 released this 29 Sep 14:27

0.3.0

Minor Changes

  • 64b51ed: Now Hot-Hook will throw an error when a file marked as "boundary" is not dynamically imported.

    In AdonisJS, we had a few users complaining about having to restart the server to see the changes applied. Generally, the cause of this was a controller file not dynamically imported:

    import PostsController from './app/controllers/posts_controller.js'
    router.get('/posts', [PostsController, 'index'])

    Before this new version, this code did not throw an error, but it did not work either. You had to reload the server to see the changes. Now Hot-Hook will throw an error for this kind of case.

    Suggesting to reread the readme if you want to understand why a dynamic import is necessary for Hot-Hook to work correctly.

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/@hot-hook/dump-viewer@0.2.0...hot-hook@0.3.0

Ignore vite.config.ts-timestamp* files

Choose a tag to compare

@Julien-R44 Julien-R44 released this 14 May 17:20

0.2.6

Patch Changes

  • f81b32f: Vite has a bug that causes a vite.config.js.timestamp-* file to be created and persisted under certain conditions. When Hot-Hook is used with Vite, this bug can sometimes cause the server to restart indefinitely. Consequently, this commit adds these files by default to Hot-Hook's ignore config.

Support Node.js <= 20.9

Choose a tag to compare

@Julien-R44 Julien-R44 released this 01 May 19:12

Changes

89c2a60: Add support for Node.js 20. We removed the direct usage of importAttributes that was only introduced in Node.js 20.9. Hot-hook should now works fine with Node.js 20.0.0 and above.

What's Changed

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/hot-hook@0.2.4...hot-hook@0.2.5

Restart files and bugfixes

Choose a tag to compare

@Julien-R44 Julien-R44 released this 27 Apr 11:16

0.2.4

Patch Changes

  • 7d4a8bc: Fix: should use default values when configured through --import=hot-hook/register

  • 07cadde: The HMR was a bit broken in some situations due to a change introduced by 117f9c1. This has been fixed and tests have been added to prevent it happening again.

  • 0ade4eb: One of the problems we encountered was that Hot Hook didn't send a full reload message when a .env file was changed, for example. This is because .env files are not javascript modules, and so are not processed by Hot Hook nor added to the dependency graph.

    As a result, this commit introduces a restart property in the config that allows you to specify which files should trigger a full reload. By default, restart will be equal to ['.env'].

    // package.json
    {
      "hotHook": {
        "restart": [".env", "./config/foo.yaml"]
      }
    }

Bug fix

Choose a tag to compare

@Julien-R44 Julien-R44 released this 25 Apr 10:23

0.2.2

Patch Changes

What's Changed

  • Replace all references of reloading with replacement in hmr by @thetutlage in #7

New Contributors

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/hot-hook@0.2.1...hot-hook@0.2.2

hot-hook@0.2.1

Choose a tag to compare

@Julien-R44 Julien-R44 released this 21 Apr 23:39

What's Changed

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/hot-hook@0.2.0...hot-hook@0.2.1

Configuration Breaking Change

Choose a tag to compare

@Julien-R44 Julien-R44 released this 17 Apr 21:01

Breaking Changes

  • c0defa6: From this commit, if you are using --import=hot-hook/register for using hot-hook, the package.json's directory will be used for resolving glob patterns in the boundaries config.

    That means, if you had a package.json with the following content, and a root entrypoint in ./src/start.ts, glob patterns were resolved from ./src/start.ts file :

    {
      "name": "my-package",
      "version": "1.0.0",
      "hot-hook": {
        "boundaries": ["./controllers/**/*"]
      }
    }

    This configuration was matching all files in the ./src/controllers directory.

    To achieve the same result, you should now use the following configuration:

     {
       "name": "my-package",
       "version": "1.0.0",
       "hot-hook": {
         "boundaries": ["./src/controllers/**/*"]
       }
     }

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/hot-hook@0.1.10...hot-hook@0.2.0

Bugfix

Choose a tag to compare

@Julien-R44 Julien-R44 released this 14 Apr 20:32

0.1.10

Patch Changes

  • c26292d: Don't throw when a dependent file node is missing. This can happen when a file has been deleted

Full Changelog: https://github.com/Julien-R44/hot-hook/compare/hot-hook@0.1.7...hot-hook@0.1.9

hot-hook@0.1.7

Choose a tag to compare

@Julien-R44 Julien-R44 released this 09 Apr 21:50

--import usage

See fa6ed2e : add a new way of configuring hot-hook. This allows you to configure hot-hook without having to modify your codebase.

We introduce a new hot-hook/register entrypoint that can be used with Node.JS's --import flag. By using this method, the Hot Hook hook will be loaded at application startup without you needing to use hot.init in your codebase. It can be used as follows:

node --import=hot-hook/register ./src/index.js

Be careful if you also use a loader to transpile to TS (ts-node or tsx), hot-hook must be placed in the second position, after the TS loader :

node --import=tsx --import=hot-hook/register ./src/index.ts

To configure boundaries and other files, you'll need to use your application's package.json file, in the hot-hook key. For example:

// package.json
{
  "hot-hook": {
    "boundaries": ["./src/controllers/**/*.tsx"],
  },
}

@hot-hook/dump-viewer@0.2.0

Choose a tag to compare

Dump Viewer

The dump viewer is a small frontend app built with Vis.js that lets you view Hot Hook's dependency graph. This lets you quickly see which files are hot reloadable and which aren't, and why.

image

To use it, you can add it to your application as follows:

fastify.get('/dump-viewer', async (request, reply) => {
  const { dumpViewer } = await import('@hot-hook/dump-viewer')

  reply.header('Content-Type', 'text/html; charset=utf-8')
  return dumpViewer()
})

then access your dev server at /dump-viewer.