ember-vite-hmr 1.5.2 → 1.5.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.
@@ -4,6 +4,7 @@ import type * as Babel from '@babel/core';
4
4
  import * as glimmer from '@glimmer/syntax';
5
5
  interface ASTPluginEnvironment {
6
6
  locals: string[];
7
+ filename: string;
7
8
  }
8
9
  declare class HotAstProcessor {
9
10
  options: {
@@ -99,17 +99,22 @@ class HotAstProcessor {
99
99
  this.meta.importBindings = new Set();
100
100
  }
101
101
  transform(env) {
102
+ var _a;
102
103
  if (process.env['EMBER_VITE_HMR_ENABLED'] !== 'true') {
103
104
  return {
104
105
  visitor: {},
105
106
  };
106
107
  }
108
+ if ((_a = env.filename) === null || _a === void 0 ? void 0 : _a.includes('node_modules')) {
109
+ return {
110
+ visitor: {},
111
+ };
112
+ }
107
113
  const meta = this.meta;
108
- const importVar = meta.importVar ||
109
- env.meta.jsutils.bindExpression('null', null, {
110
- nameHint: 'template__imports__',
111
- });
112
- meta.importVar = importVar;
114
+ const importVar = env.meta.jsutils.bindExpression(meta.importVar || 'null', null, {
115
+ nameHint: 'template__imports__',
116
+ });
117
+ meta.importVar = meta.importVar || importVar;
113
118
  const findImport = function findImport(specifier) {
114
119
  return meta.babelProgram.body.find((b) => b.type === 'ImportDeclaration' &&
115
120
  b.specifiers.some((s) => s.local.name === specifier));
@@ -225,13 +230,16 @@ function hotReplaceAst(babel) {
225
230
  },
226
231
  visitor: {
227
232
  Program(path, state) {
228
- var _a, _b;
233
+ var _a, _b, _c;
229
234
  if (!exports.hotAstProcessor.meta.importVar) {
230
235
  return;
231
236
  }
232
237
  if (process.env['EMBER_VITE_HMR_ENABLED'] !== 'true') {
233
238
  return;
234
239
  }
240
+ if ((_a = state.filename) === null || _a === void 0 ? void 0 : _a.includes('node_modules')) {
241
+ return;
242
+ }
235
243
  const util = new babel_import_util_1.ImportUtil(babel, path);
236
244
  const tracked = util.import(path, '@glimmer/tracking', 'tracked');
237
245
  const GlimmerComponent = util.import(path, '@glimmer/component', 'default');
@@ -259,12 +267,12 @@ function hotReplaceAst(babel) {
259
267
  const importDeclaration = findImport(imp);
260
268
  const source = importDeclaration.source.value;
261
269
  const specifier = importDeclaration.specifiers.find((s) => s.local.name === imp);
262
- const specifierName = ((_a = specifier.imported) === null || _a === void 0 ? void 0 : _a.name) ||
263
- ((_b = specifier.imported) === null || _b === void 0 ? void 0 : _b.value) ||
270
+ const specifierName = ((_b = specifier.imported) === null || _b === void 0 ? void 0 : _b.name) ||
271
+ ((_c = specifier.imported) === null || _c === void 0 ? void 0 : _c.value) ||
264
272
  'default';
265
273
  const ast = (0, core_1.parse)(`
266
274
  (async () => {
267
- const c = await import('ember-vite-hmr/virtual/component:${source}:${specifierName}.gjs');
275
+ const c = await import('/ember-vite-hmr/virtual/component:${source}:${specifierName}.gjs');
268
276
  ${exports.hotAstProcessor.meta.importVar}.${imp} = c.default;
269
277
  })()
270
278
  import.meta.hot.accept('${source}');
package/dist/lib/hmr.js CHANGED
@@ -46,7 +46,7 @@ export default class HotComponent extends Component {
46
46
  </template>
47
47
  }
48
48
  `;
49
- const virtualPrefix = 'ember-vite-hmr/virtual/component:';
49
+ const virtualPrefix = '/ember-vite-hmr/virtual/component:';
50
50
  function hmr(enableViteHmrForModes = ['development']) {
51
51
  let conf;
52
52
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],
@@ -43,7 +43,7 @@
43
43
  "@babel/traverse": "^7.23.2",
44
44
  "@babel/types": "^7.24.0",
45
45
  "@embroider/addon-shim": "^1.8.9",
46
- "@glimmer/syntax": "^0.88.1",
46
+ "@glimmer/syntax": "^0.92.3",
47
47
  "@types/supports-color": "^8.1.0",
48
48
  "babel-import-util": "^3.0.0",
49
49
  "babel-loader": "^9.1.3",
@@ -72,19 +72,19 @@
72
72
  "@types/fs-extra": "^11.0.4",
73
73
  "@types/lodash": "^4.14.170",
74
74
  "@types/mini-css-extract-plugin": "^2.5.1",
75
- "@types/node": "^20.14.10",
75
+ "@types/node": "^22.5.5",
76
76
  "@types/rsvp": "^4.0.9",
77
77
  "@types/semver": "^7.3.6",
78
78
  "assert-never": "^1.2.1",
79
79
  "babel-import-util": "^3.0.0",
80
80
  "babel-plugin-ember-template-compilation": "^2.3.0",
81
- "concurrently": "^8.0.1",
81
+ "concurrently": "^9.0.1",
82
82
  "content-tag": "^2.0.1",
83
83
  "ember-cli-htmlbars": "^6.3.0",
84
- "ember-resolver": "^11.0.1",
84
+ "ember-resolver": "^13.0.1",
85
85
  "ember-source": "^5.10.1",
86
86
  "@glimmer/component": "^1.1.2",
87
- "ember-template-lint": "^5.11.2",
87
+ "ember-template-lint": "^6.0.0",
88
88
  "eslint": "^8.33.0",
89
89
  "eslint-config-prettier": "^9.0.0",
90
90
  "eslint-plugin-ember": "^12.2.0",