ember-vite-hmr 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/lib/hmr.js +18 -3
  2. package/package.json +6 -6
package/dist/lib/hmr.js CHANGED
@@ -43,11 +43,22 @@ import Component from "@glimmer/component";
43
43
  import { tracked } from "@glimmer/tracking";
44
44
  import { createComputeRef } from "@glimmer/reference";
45
45
  import { curry } from '@glimmer/runtime';
46
+ import { registerDestructor } from '@ember/destroyable';
46
47
 
47
48
  function notAny(...yields) {
48
49
  return !yields.some((y) => !!y);
49
50
  }
50
51
 
52
+ const hotCallbacks = new Set();
53
+
54
+ if (import.meta.hot) {
55
+ import.meta.hot.accept('${imp}', (module) => {
56
+ for (const callback of hotCallbacks) {
57
+ callback(module);
58
+ }
59
+ });
60
+ }
61
+
51
62
  export default class HotComponent extends Component {
52
63
  @tracked curried;
53
64
  hot = {};
@@ -61,12 +72,16 @@ export default class HotComponent extends Component {
61
72
  const CurriedComponent = 0;
62
73
  this.curried = curry(CurriedComponent, TargetComponent, owner, { positional, named});
63
74
  if (import.meta.hot) {
64
- // Rehydrate any saved state
65
- import.meta.hot.accept('${imp}', (module) => {
75
+ const callback = (module) => {
66
76
  this.curried = curry(CurriedComponent, module.default, owner, { positional, named});
67
- })
77
+ };
78
+ hotCallbacks.add(callback);
79
+ registerDestructor(this, () => {
80
+ hotCallbacks.delete(callback);
81
+ });
68
82
  }
69
83
  }
84
+
70
85
  <template>
71
86
  ${generateContent(yields)}
72
87
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@babel/core": "^7.28.5",
43
- "@babel/plugin-transform-typescript": "^7.28.5",
43
+ "@babel/plugin-transform-typescript": "^7.28.6",
44
44
  "@babel/traverse": "^7.29.0",
45
45
  "@babel/types": "^7.28.5",
46
46
  "@embroider/addon-shim": "^1.10.2",
@@ -49,13 +49,13 @@
49
49
  "babel-import-util": "^3.0.0",
50
50
  "babel-loader": "^10.1.1",
51
51
  "babel-preset-env": "^1.7.0",
52
- "semver": "^7.7.3"
52
+ "semver": "^7.7.4"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@babel/eslint-parser": "^7.28.5",
56
56
  "@babel/plugin-proposal-class-properties": "^7.16.7",
57
57
  "@babel/plugin-proposal-decorators": "^7.28.0",
58
- "@babel/plugin-transform-class-static-block": "^7.28.3",
58
+ "@babel/plugin-transform-class-static-block": "^7.28.6",
59
59
  "@babel/runtime": "^7.28.4",
60
60
  "@embroider/addon-dev": "^8.3.0",
61
61
  "@embroider/compat": "^4.1.17",
@@ -73,7 +73,7 @@
73
73
  "@types/csso": "^5.0.4",
74
74
  "@types/debug": "^4.1.13",
75
75
  "@types/fs-extra": "^11.0.4",
76
- "@types/lodash": "^4.17.21",
76
+ "@types/lodash": "^4.17.24",
77
77
  "@types/mini-css-extract-plugin": "^2.5.1",
78
78
  "@types/node": "^24.10.1",
79
79
  "@types/rsvp": "^4.0.9",
@@ -98,7 +98,7 @@
98
98
  "fs-extra": "^11.3.2",
99
99
  "globals": "^17.5.0",
100
100
  "playwright-chromium": "^1.59.1",
101
- "prettier": "^3.8.1",
101
+ "prettier": "^3.8.3",
102
102
  "prettier-plugin-ember-template-tag": "^2.1.3",
103
103
  "puppeteer-chromium-resolver": "^24.0.2",
104
104
  "rollup": "^4.53.3",