ember-vite-hmr 1.4.3 → 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.
- package/dist/lib/babel-plugin.js +5 -4
- package/package.json +1 -1
package/dist/lib/babel-plugin.js
CHANGED
|
@@ -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
|
-
|
|
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}.${
|
|
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
|
|
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);
|