ember-vite-hmr 1.4.2 → 1.4.4

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.
@@ -170,13 +170,13 @@ class HotAstProcessor {
170
170
  if (!original)
171
171
  return;
172
172
  const param = glimmer.builders.path(`${importVar}.${original}`);
173
- parent.params.splice(0, 1);
174
- parent.params.push(param);
173
+ parent.params.splice(0, 1, param);
174
+ importBindings.add(original);
175
175
  return;
176
176
  }
177
177
  if (importVar) {
178
178
  if (findImport(node.original)) {
179
- node.original = `${importVar}.${original}` + node.original.split('.').slice(1).join('.');
179
+ node.original = `${importVar}.${node.original}`;
180
180
  node.parts = node.original.split('.');
181
181
  importBindings.add(original);
182
182
  }
@@ -225,7 +225,8 @@ function hotReplaceAst({ types: t }) {
225
225
  for (const local of bindings) {
226
226
  klass.body.body.push(t.classProperty(t.identifier(local), t.identifier(local), null, [t.decorator(tracked)]));
227
227
  }
228
- const assign = t.assignmentExpression('=', t.identifier(exports.hotAstProcessor.meta.importVar), klass);
228
+ const newExp = t.newExpression(klass, []);
229
+ const assign = t.assignmentExpression('=', t.identifier(exports.hotAstProcessor.meta.importVar), newExp);
229
230
  const varDeclaration = path.node.body.findIndex((e) => e.type === 'VariableDeclaration' && e.declarations[0].id.name === exports.hotAstProcessor.meta.importVar) + 1;
230
231
  const lastImportIndex = path.node.body.findLastIndex((e) => e.type === 'ImportDeclaration') + 1;
231
232
  path.node.body.splice(Math.max(varDeclaration, lastImportIndex), 0, assign);
package/dist/lib/hmr.js CHANGED
@@ -25,12 +25,12 @@ function hmr(enableViteHmrForModes = ['development']) {
25
25
  if (id.startsWith('/@id/embroider_virtual:')) {
26
26
  return this.resolve(id.replace('/@id/', ''), path_1.default.join(process.cwd(), 'package.json'));
27
27
  }
28
- if (id === '/ember-vite-hmr/services/webpack-hot-reload') {
29
- return this.resolve('ember-vite-hmr/services/webpack-hot-reload', path_1.default.join(process.cwd(), 'package.json'));
28
+ if (id === '/ember-vite-hmr/services/vite-hot-reload') {
29
+ return this.resolve('ember-vite-hmr/services/vite-hot-reload', path_1.default.join(process.cwd(), 'package.json'));
30
30
  }
31
31
  },
32
32
  transformIndexHtml(html) {
33
- return (`<script type="module" src="/ember-vite-hmr/services/webpack-hot-reload" />` +
33
+ return (`<script type="module" src="/ember-vite-hmr/services/vite-hot-reload" />` +
34
34
  html);
35
35
  },
36
36
  handleHotUpdate(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],