ember-vite-hmr 2.0.5 → 2.0.7

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.
@@ -1,5 +1,5 @@
1
-
2
1
  import Route from '@ember/routing/route';
2
+ import Service from '@ember/service';
3
3
  import Component from '@glimmer/component';
4
4
  import { getInternalComponentManager } from '@glimmer/manager';
5
5
 
@@ -19,7 +19,7 @@ function getState(component, skip) {
19
19
  for (const key in component) {
20
20
  if (skip.includes(key)) continue;
21
21
  const entry = findPropertyDescriptor(component, key);
22
- if (entry) {
22
+ if (entry && !(component[key] instanceof Service)) {
23
23
  if (entry.writable && !Object.prototype.toString.call(entry.value).includes('Function')) {
24
24
  state[key] = component[key];
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setup-hmr-manager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"setup-hmr-manager.js","sources":["../../src/instance-initializers/setup-hmr-manager.ts"],"sourcesContent":["import Route from '@ember/routing/route';\nimport Controller from '@ember/controller';\nimport Service from '@ember/service';\nimport Component from '@glimmer/component';\n// @ts-ignore\nimport { getInternalComponentManager } from '@glimmer/manager';\n\ninterface HotComponent extends Component<{ __hot__?: any }> {\n __get_hot_state__?: () => Record<string, any>;\n}\n\ntype Mutable<T> = {\n -readonly [P in keyof T]: any;\n};\n\nfunction findPropertyDescriptor(component: Object, key: string) {\n let proto = component;\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, key);\n if (desc) return desc;\n proto = Object.getPrototypeOf(proto);\n }\n}\n\nfunction getState(component: HotComponent, skip: string[]) {\n const state: Record<string, any> = {};\n if (!component) {\n return state;\n }\n for (const key in component) {\n if (skip.includes(key)) continue;\n const entry = findPropertyDescriptor(component, key);\n if (entry && !(component[key as keyof Component] instanceof Service)) {\n if (\n entry.writable &&\n !Object.prototype.toString.call(entry.value).includes('Function')\n ) {\n state[key] = component[key as keyof Component];\n }\n if (entry.set) {\n state[key] = component[key as keyof Component];\n }\n }\n }\n return state;\n}\n\nfunction syncState(instance: Mutable<HotComponent>) {\n if (instance.args.__hot__) {\n const state =\n instance.__get_hot_state__?.() || instance.args.__hot__.getState?.();\n for (const k in state) {\n instance[k as keyof HotComponent] = state[k];\n }\n instance.args.__hot__.getState = () => getState(instance, ['args']);\n }\n}\n\nexport function initialize() {\n const ComponentManager = getInternalComponentManager(Component);\n const proto = Object.getPrototypeOf(ComponentManager);\n const create = proto.create;\n proto.create = function (...args: any[]) {\n const instance = create.call(this, ...args);\n syncState(instance.component);\n return instance;\n };\n\n const setupController = Route.prototype.setupController;\n\n const StateCache: Record<string, any> = {};\n\n Route.prototype.setupController = function (...args: any[]) {\n const controller = args[0];\n // @ts-ignore\n const r = setupController.call(this, ...args);\n const fullRouteName = this.fullRouteName;\n const state = StateCache[fullRouteName] || {};\n const skip = ['_qpDelegate', 'target', 'queryParams'];\n const routerState = getState(state.router, skip);\n const controllerState = getState(state.controller, skip);\n for (const k in routerState) {\n (this as any)[k] = routerState[k];\n }\n for (const k in controllerState) {\n controller[k] = controllerState[k];\n }\n StateCache[fullRouteName] = {\n route: this,\n controller,\n };\n return r;\n };\n}\n\nexport default {\n initialize,\n};\n"],"names":["findPropertyDescriptor","component","key","proto","desc","Object","getOwnPropertyDescriptor","getPrototypeOf","getState","skip","state","includes","entry","Service","writable","prototype","toString","call","value","set","syncState","instance","args","__hot__","__get_hot_state__","k","initialize","ComponentManager","getInternalComponentManager","Component","create","setupController","Route","StateCache","controller","r","fullRouteName","routerState","router","controllerState","route"],"mappings":";;;;;AAeA,SAASA,sBAAsBA,CAACC,SAAiB,EAAEC,GAAW,EAAE;EAC9D,IAAIC,KAAK,GAAGF,SAAS;AACrB,EAAA,OAAOE,KAAK,EAAE;IACZ,MAAMC,IAAI,GAAGC,MAAM,CAACC,wBAAwB,CAACH,KAAK,EAAED,GAAG,CAAC;IACxD,IAAIE,IAAI,EAAE,OAAOA,IAAI;AACrBD,IAAAA,KAAK,GAAG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CAACwB,UAAU,EAAEzB,IAAI,CAAC;AACxD,IAAA,KAAK,MAAMgB,CAAC,IAAIY,WAAW,EAAE;AAC1B,MAAA,IAAI,CAASZ,CAAC,CAAC,GAAGY,WAAW,CAACZ,CAAC,CAAC;AACnC,IAAA;AACA,IAAA,KAAK,MAAMA,CAAC,IAAIc,eAAe,EAAE;AAC/BL,MAAAA,UAAU,CAACT,CAAC,CAAC,GAAGc,eAAe,CAACd,CAAC,CAAC;AACpC,IAAA;IACAQ,UAAU,CAACG,aAAa,CAAC,GAAG;AAC1BI,MAAAA,KAAK,EAAE,IAAI;AACXN,MAAAA;KACD;AACD,IAAA,OAAOC,CAAC;EACV,CAAC;AACH;AAEA,sBAAe;AACbT,EAAAA;AACF,CAAC;;;;"}
@@ -1,6 +1,7 @@
1
-
2
1
  import { debounce, next } from '@ember/runloop';
3
2
 
3
+ /// <reference types="../../types/global" />
4
+
4
5
  function patchResolver(application) {
5
6
  application.__container__.lookup('service:vite-hot-reload');
6
7
  const resolver = application.__registry__.resolver?._fallback || (application.__registry__.fallback?.resolver)._fallback || application.__registry__.fallback?.resolver || application.__registry__.resolver;
@@ -11,7 +12,7 @@ function patchResolver(application) {
11
12
  };
12
13
  }
13
14
  function supportErrorRecovery(appInstance) {
14
- const bodyHtml = window.document.body.cloneNode(true);
15
+ const bodyHtml = globalThis.document.body.cloneNode(true);
15
16
  const renderer = appInstance.__container__.lookup('renderer:-dom');
16
17
  const router = appInstance.__container__.lookup('service:router');
17
18
  const warn = console.warn;
@@ -23,13 +24,15 @@ function supportErrorRecovery(appInstance) {
23
24
  applicationRouter._router._toplevelView.destroy();
24
25
  applicationRouter._router._toplevelView = null;
25
26
  renderer._clearAllRoots();
26
- window.document.body = bodyHtml.cloneNode(true);
27
+ globalThis.document.body = bodyHtml.cloneNode(true);
27
28
  next(() => {
28
29
  const transition = router.refresh();
29
30
  applicationRouter.setup(applicationRouter.context, transition);
30
31
  });
31
32
  }
32
- import.meta.hot?.on('vite:beforeUpdate', () => debounce(rerender, 100));
33
+ if (import.meta.hot) {
34
+ import.meta.hot.on('vite:beforeUpdate', () => debounce(rerender, 100));
35
+ }
33
36
  console.warn = function (...args) {
34
37
  if (args[0].includes('Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.')) {
35
38
  scheduleRerender = true;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-hot-reload.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"vite-hot-reload.js","sources":["../../src/instance-initializers/vite-hot-reload.ts"],"sourcesContent":["/// <reference types=\"../../types/global\" />\n\nimport ApplicationInstance from '@ember/application/instance';\nimport { debounce, next } from '@ember/runloop';\nimport RouterService from '@ember/routing/router-service';\nimport { Renderer } from '@ember/-internals/glimmer/lib/renderer';\n\nfunction patchResolver(application: ApplicationInstance) {\n application.__container__.lookup('service:vite-hot-reload');\n const resolver =\n (application.__registry__.resolver as any)?._fallback ||\n (application.__registry__.fallback?.resolver as any)._fallback ||\n (application.__registry__.fallback?.resolver as any) ||\n application.__registry__.resolver;\n const resolverResolve = resolver.resolve;\n resolver.resolve = function (name: string) {\n name = name.replace(/--hot-version--.*$/, '');\n return resolverResolve.call(this, name);\n };\n}\n\nfunction supportErrorRecovery(appInstance: ApplicationInstance) {\n const bodyHtml = globalThis.document.body.cloneNode(true);\n const renderer = appInstance.__container__.lookup(\n 'renderer:-dom',\n ) as Renderer;\n const router = appInstance.__container__.lookup(\n 'service:router',\n ) as RouterService;\n const warn = console.warn;\n let scheduleRerender = false;\n async function rerender() {\n if (!scheduleRerender) return;\n scheduleRerender = false;\n const applicationRouter = appInstance.__container__.lookup(\n 'route:application',\n ) as any;\n applicationRouter._router._toplevelView.destroy();\n applicationRouter._router._toplevelView = null;\n (renderer as any)._clearAllRoots();\n globalThis.document.body = bodyHtml.cloneNode(true) as any;\n next(() => {\n const transition = router.refresh();\n applicationRouter.setup(applicationRouter.context, transition);\n });\n }\n if (import.meta.hot) {\n import.meta.hot.on('vite:beforeUpdate', () => debounce(rerender, 100));\n }\n console.warn = function (...args) {\n if (\n args[0].includes(\n 'Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.',\n )\n ) {\n scheduleRerender = true;\n }\n warn.call(console, ...args);\n };\n}\n\nexport function initialize(application: ApplicationInstance) {\n patchResolver(application);\n supportErrorRecovery(application);\n}\n\nexport default {\n initialize,\n};"],"names":["patchResolver","application","__container__","lookup","resolver","__registry__","_fallback","fallback","resolverResolve","resolve","name","replace","call","supportErrorRecovery","appInstance","bodyHtml","globalThis","document","body","cloneNode","renderer","router","warn","console","scheduleRerender","rerender","applicationRouter","_router","_toplevelView","destroy","_clearAllRoots","next","transition","refresh","setup","context","import","meta","hot","on","debounce","args","includes","initialize"],"mappings":";;AAAA;;AAOA,SAASA,aAAaA,CAACC,WAAgC,EAAE;AACvDA,EAAAA,WAAW,CAACC,aAAa,CAACC,MAAM,CAAC,yBAAyB,CAAC;AAC3D,EAAA,MAAMC,QAAQ,GACXH,WAAW,CAACI,YAAY,CAACD,QAAQ,EAAUE,SAAS,IACrD,CAACL,WAAW,CAACI,YAAY,CAACE,QAAQ,EAAEH,QAAQ,EAASE,SAAS,IAC7DL,WAAW,CAACI,YAAY,CAACE,QAAQ,EAAEH,QAAgB,IACpDH,WAAW,CAACI,YAAY,CAACD,QAAQ;AACnC,EAAA,MAAMI,eAAe,GAAGJ,QAAQ,CAACK,OAAO;AACxCL,EAAAA,QAAQ,CAACK,OAAO,GAAG,UAAUC,IAAY,EAAE;IACzCA,IAAI,GAAGA,IAAI,CAACC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;AAC7C,IAAA,OAAOH,eAAe,CAACI,IAAI,CAAC,IAAI,EAAEF,IAAI,CAAC;EACzC,CAAC;AACH;AAEA,SAASG,oBAAoBA,CAACC,WAAgC,EAAE;EAC9D,MAAMC,QAAQ,GAAGC,UAAU,CAACC,QAAQ,CAACC,IAAI,CAACC,S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AAG,IAAI;AACzB,IAAA;AACAF,IAAAA,IAAI,CAACV,IAAI,CAACW,OAAO,EAAE,GAAGkB,IAAI,CAAC;EAC7B,CAAC;AACH;AAEO,SAASE,UAAUA,CAAC1C,WAAgC,EAAE;EAC3DD,aAAa,CAACC,WAAW,CAAC;EAC1BY,oBAAoB,CAACZ,WAAW,CAAC;AACnC;AAEA,oBAAe;AACb0C,EAAAA;AACF,CAAC;;;;"}
@@ -266,7 +266,7 @@ function hotReplaceAst(babel) {
266
266
  exports.hotAstProcessor.meta.importVar) + 1;
267
267
  const lastImportIndex = // @ts-ignore
268
268
  path.node.body.findLastIndex((e) => e.type === 'ImportDeclaration') + 1;
269
- path.node.body.splice(Math.max(varDeclaration, lastImportIndex), 0, assign);
269
+ path.node.body.splice(Math.max(varDeclaration, lastImportIndex), 0, t.expressionStatement(assign));
270
270
  // Export metadata about tracked imports for hmr.ts to use
271
271
  const importMetadata = t.variableDeclaration('const', [
272
272
  t.variableDeclarator(t.identifier('__hmr_import_metadata__'), t.objectExpression([
package/dist/lib/hmr.js CHANGED
@@ -249,7 +249,7 @@ function hmr(enableViteHmrForModes = ['development']) {
249
249
  import.meta.hot.accept('@embroider/virtual/compat-modules', (m) => {
250
250
  for (const [name, module] of Object.entries(m.default)) {
251
251
  if (name.includes('initializers') && prevCompatModules[name]?.default !== module.default) {
252
- window.location.reload();
252
+ globalThis.location.reload();
253
253
  }
254
254
  }
255
255
  prevCompatModules = m.default;
@@ -394,8 +394,8 @@ ${hotReloadStatements.join('\n')}
394
394
  return source;
395
395
  }
396
396
  return `${source}
397
- if (import.meta.hot && window.emberHotReloadPlugin) {
398
- const result = window.emberHotReloadPlugin.canAcceptNew(import.meta.url);
397
+ if (import.meta.hot && globalThis.emberHotReloadPlugin) {
398
+ const result = globalThis.emberHotReloadPlugin.canAcceptNew(import.meta.url);
399
399
  result.then(() => {
400
400
  if (!result) {
401
401
  import.meta.hot.decline();
@@ -1,4 +1,3 @@
1
-
2
1
  import Service, { service } from '@ember/service';
3
2
  import { getOwner } from '@ember/owner';
4
3
  import Route from '@ember/routing/route';
@@ -36,17 +35,17 @@ let ViteHotReloadService = (_dec = service(), _class = class ViteHotReloadServic
36
35
  }
37
36
  init(args) {
38
37
  super.init(args);
39
- if (!window.emberHotReloadPlugin) return;
38
+ if (!globalThis.emberHotReloadPlugin) return;
40
39
  const app = getOwner(this).application;
41
- window.emberHotReloadPlugin.Resolver = app.Resolver;
42
- window.emberHotReloadPlugin.modulePrefix = app.modulePrefix;
43
- window.emberHotReloadPlugin.podModulePrefix = app.podModulePrefix;
40
+ globalThis.emberHotReloadPlugin.Resolver = app.Resolver;
41
+ globalThis.emberHotReloadPlugin.modulePrefix = app.modulePrefix;
42
+ globalThis.emberHotReloadPlugin.podModulePrefix = app.podModulePrefix;
44
43
  this.router._router;
45
44
  Object.defineProperty(this.router._router, '_routerMicrolib', {
46
45
  set(v) {
47
46
  const getRoute = v.getRoute;
48
47
  v.getRoute = function (name) {
49
- const route = getRoute.call(this, `${name}--hot-version--${window.emberHotReloadPlugin.routerVersion}`);
48
+ const route = getRoute.call(this, `${name}--hot-version--${globalThis.emberHotReloadPlugin.routerVersion}`);
50
49
  route.fullRouteName = `${name}`.replace(/--hot-version--.*$/, '');
51
50
  return route;
52
51
  };
@@ -57,7 +56,7 @@ let ViteHotReloadService = (_dec = service(), _class = class ViteHotReloadServic
57
56
  }
58
57
  });
59
58
  this.container = getOwner(this)?.__container__;
60
- window.emberHotReloadPlugin.subscribe((oldModule, newModule) => {
59
+ globalThis.emberHotReloadPlugin.subscribe((oldModule, newModule) => {
61
60
  let changed = false;
62
61
  if (oldModule.exports.default?.prototype && oldModule.exports.default.prototype instanceof Route) {
63
62
  changed = true;
@@ -68,33 +67,33 @@ let ViteHotReloadService = (_dec = service(), _class = class ViteHotReloadServic
68
67
  if (oldModule.id.startsWith('app/templates/') && !oldModule.id.startsWith('app/templates/components/')) {
69
68
  changed = true;
70
69
  }
71
- if (oldModule.id.startsWith(`./${window.emberHotReloadPlugin.podModulePrefix}/`)) {
70
+ if (oldModule.id.startsWith(`./${globalThis.emberHotReloadPlugin.podModulePrefix}/`)) {
72
71
  changed = true;
73
72
  }
74
73
  if (!changed) return;
75
- window.emberHotReloadPlugin.routerVersion += 1;
74
+ globalThis.emberHotReloadPlugin.routerVersion += 1;
76
75
  const types = ['route', 'controller', 'template', 'modifier', 'helper', 'component'];
77
76
  Object.keys(this.container.cache).forEach(k => {
78
77
  if (types.some(t => k.startsWith(`${t}:`))) {
79
78
  delete this.container.cache[k];
80
79
  }
81
80
  });
82
- Object.keys(this.container.factoryManagerCache).forEach(k => {
81
+ Object.keys(this.container.factoryManagerCache || {}).forEach(k => {
83
82
  if (types.some(t => k.startsWith(`${t}:`))) {
84
83
  delete this.container.factoryManagerCache[k];
85
84
  }
86
85
  });
87
- Object.keys(this.container.registry._resolveCache).forEach(k => {
86
+ Object.keys(this.container.registry._resolveCache || {}).forEach(k => {
88
87
  if (types.some(t => k.startsWith(`${t}:`))) {
89
88
  delete this.container.registry._resolveCache[k];
90
89
  }
91
90
  });
92
- Object.keys(this.container.validationCache).forEach(k => {
91
+ Object.keys(this.container.validationCache || {}).forEach(k => {
93
92
  if (types.some(t => k.startsWith(`${t}:`))) {
94
93
  delete this.container.validationCache[k];
95
94
  }
96
95
  });
97
- Object.keys(this.container.registry.registrations).forEach(k => {
96
+ Object.keys(this.container.registry.registrations || {}).forEach(k => {
98
97
  if (types.some(t => k.startsWith(`${t}:`))) {
99
98
  delete this.container.registry.registrations[k];
100
99
  }
@@ -108,7 +107,7 @@ let ViteHotReloadService = (_dec = service(), _class = class ViteHotReloadServic
108
107
  if (oldModule.id.startsWith('app/templates/') && !oldModule.id.startsWith('app/templates/components/')) {
109
108
  this.router.refresh();
110
109
  }
111
- if (oldModule.id.startsWith(`./${window.emberHotReloadPlugin.podModulePrefix}/`)) {
110
+ if (oldModule.id.startsWith(`./${globalThis.emberHotReloadPlugin.podModulePrefix}/`)) {
112
111
  this.router.refresh();
113
112
  }
114
113
  });
@@ -1 +1 @@
1
- {"version":3,"file":"vite-hot-reload.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"vite-hot-reload.js","sources":["../../src/services/vite-hot-reload.ts"],"sourcesContent":["import Service, { service } from '@ember/service';\nimport { getOwner } from '@ember/owner';\nimport RouterService from '@ember/routing/router-service';\nimport Router from '@ember/routing/route';\nimport Controller from '@ember/controller';\nimport ApplicationInstance from '@ember/application/instance';\n\nconst ChangeMap = new WeakMap();\n\nfunction getLatestChange(obj: any) {\n while (ChangeMap.has(obj)) {\n obj = ChangeMap.get(obj);\n }\n return obj;\n}\n\nexport default class ViteHotReloadService extends Service {\n declare container: any;\n @service() router!: RouterService;\n\n init(args: any) {\n super.init(args);\n if (!globalThis.emberHotReloadPlugin) return;\n const app = (getOwner(this) as ApplicationInstance)!.application as any;\n globalThis.emberHotReloadPlugin.Resolver = app.Resolver;\n globalThis.emberHotReloadPlugin.modulePrefix = app.modulePrefix;\n globalThis.emberHotReloadPlugin.podModulePrefix = app.podModulePrefix;\n this.router._router;\n Object.defineProperty(this.router._router, '_routerMicrolib', {\n set(v) {\n const getRoute = v.getRoute;\n v.getRoute = function (name: string) {\n const route = getRoute.call(\n this,\n `${name}--hot-version--${globalThis.emberHotReloadPlugin.routerVersion}`,\n );\n route.fullRouteName = `${name}`.replace(\n /--hot-version--.*$/,\n '',\n );\n return route;\n };\n this.___routerMicrolib = v;\n },\n get() {\n return this.___routerMicrolib;\n },\n });\n this.container = (getOwner(this) as any)?.__container__;\n globalThis.emberHotReloadPlugin.subscribe((oldModule: any, newModule: any) => {\n let changed = false;\n if (\n oldModule.exports.default?.prototype &&\n oldModule.exports.default.prototype instanceof Router\n ) {\n changed = true;\n }\n if (\n oldModule.exports.default?.prototype &&\n oldModule.exports.default.prototype instanceof Controller\n ) {\n changed = true;\n }\n if (\n oldModule.id.startsWith('app/templates/') &&\n !oldModule.id.startsWith('app/templates/components/')\n ) {\n changed = true;\n }\n if (oldModule.id.startsWith(`./${globalThis.emberHotReloadPlugin.podModulePrefix}/`)) {\n changed = true;\n }\n if (!changed) return;\n globalThis.emberHotReloadPlugin.routerVersion += 1;\n const types = [\n 'route',\n 'controller',\n 'template',\n 'modifier',\n 'helper',\n 'component',\n ];\n Object.keys(this.container.cache).forEach((k) => {\n if (types.some((t) => k.startsWith(`${t}:`))) {\n delete this.container.cache[k];\n }\n });\n Object.keys(this.container.factoryManagerCache || {}).forEach((k) => {\n if (types.some((t) => k.startsWith(`${t}:`))) {\n delete this.container.factoryManagerCache[k];\n }\n });\n Object.keys(this.container.registry._resolveCache || {}).forEach((k) => {\n if (types.some((t) => k.startsWith(`${t}:`))) {\n delete this.container.registry._resolveCache[k];\n }\n });\n Object.keys(this.container.validationCache || {}).forEach((k) => {\n if (types.some((t) => k.startsWith(`${t}:`))) {\n delete this.container.validationCache[k];\n }\n });\n Object.keys(this.container.registry.registrations || {}).forEach((k) => {\n if (types.some((t) => k.startsWith(`${t}:`))) {\n delete this.container.registry.registrations[k];\n }\n });\n if (\n oldModule.exports.default?.prototype &&\n oldModule.exports.default.prototype instanceof Router\n ) {\n this.router.refresh();\n }\n if (\n oldModule.exports.default?.prototype &&\n oldModule.exports.default.prototype instanceof Controller\n ) {\n this.router.refresh();\n }\n if (\n oldModule.id.startsWith('app/templates/') &&\n !oldModule.id.startsWith('app/templates/components/')\n ) {\n this.router.refresh();\n }\n if (oldModule.id.startsWith(`./${globalThis.emberHotReloadPlugin.podModulePrefix}/`)) {\n this.router.refresh();\n }\n });\n }\n getLatestChange(obj: any) {\n return getLatestChange(obj);\n }\n}\n\n// Don't remove this declaration: this is what enables TypeScript to resolve\n// this service using `Owner.lookup('service:hot-reload')`, as well\n// as to check when you pass the service name as an argument to the decorator,\n// like `@service('hot-reload') declare altName: HotReloadService;`.\ndeclare module '@ember/service' {\n interface Registry {\n 'hot-reload': ViteHotReloadService;\n }\n}\n"],"names":["ChangeMap","WeakMap","getLatestChange","obj","has","get","ViteHotReloadService","_dec","service","_class","Service","constructor","args","_initializerDefineProperty","_descriptor","init","globalThis","emberHotReloadPlugin","app","getOwner","application","Resolver","modulePrefix","podModulePrefix","router","_router","Object","defineProperty","set","v","getRoute","name","route","call","routerVersion","fullRouteName","replace","___routerMicrolib","container","__container__","subscribe","oldModule","newModule","changed","exports","default","prototype","Router","Controller","id","startsWith","types","keys","cache","forEach","k","some","t","factoryManagerCache","registry","_resolveCache","validationCache","registrations","refresh","_applyDecoratedDescriptor","configurable","enumerable","writable","initializer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,SAAS,GAAG,IAAIC,OAAO,EAAE;AAE/B,SAASC,eAAeA,CAACC,GAAQ,EAAE;AACjC,EAAA,OAAOH,SAAS,CAACI,GAAG,CAACD,GAAG,CAAC,EAAE;AACzBA,IAAAA,GAAG,GAAGH,SAAS,CAACK,GAAG,CAACF,GAAG,CAAC;AAC1B,EAAA;AACA,EAAA,OAAOA,GAAG;AACZ;AAAC,IAEoBG,oBAAoB,IAAAC,IAAA,GAEtCC,OAAO,EAAE,EAAAC,MAAA,GAFG,MAAMH,oBAAoB,SAASI,OAAO,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;AAAAC,IAAAA,0BAAA,iBAAAC,WAAA,EAAA,IAAA,CAAA;AAAA,EAAA;EAIxDC,IAAIA,CAACH,IAAS,EAAE;AACd,IAAA,KAAK,CAACG,IAAI,CAACH,IAAI,CAAC;AAChB,IAAA,IAAI,CAACI,UAAU,CAACC,oBAAoB,EAAE;AACtC,IAAA,MAAMC,GAAG,GAAIC,QAAQ,CAAC,IAAI,CAAC,CAA0BC,WAAkB;AACvEJ,IAAAA,UAAU,CAACC,oBAAoB,CAACI,QAAQ,GAAGH,GAAG,CAACG,QAAQ;AACvDL,IAAAA,UAAU,CAACC,oBAAoB,CAACK,YAAY,GAAGJ,GAAG,CA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reference types="../types/global" />
1
2
 
2
3
  if (import.meta.hot) {
3
4
  const ModuleMap = new Map();
4
- window.emberHotReloadPlugin = {
5
+ globalThis.emberHotReloadPlugin = {
5
6
  modulePrefix: '',
6
7
  podModulePrefix: '',
7
8
  Resolver: null,
@@ -16,7 +17,7 @@ if (import.meta.hot) {
16
17
  this.moduleDepCallbacks[module.id] = {};
17
18
  },
18
19
  register(module, dep, callback) {
19
- dep = dep.replace(new RegExp(`^${window.emberHotReloadPlugin.modulePrefix}/`), './');
20
+ dep = dep.replace(new RegExp(`^${globalThis.emberHotReloadPlugin.modulePrefix}/`), './');
20
21
  this.moduleDepCallbacks[module.id][dep] = this.moduleDepCallbacks[module.id][dep] || [];
21
22
  this.moduleDepCallbacks[module.id][dep].push(callback);
22
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"setup-ember-hmr.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"setup-ember-hmr.js","sources":["../src/setup-ember-hmr.ts"],"sourcesContent":["/// <reference types=\"../types/global\" />\n\nimport type { Module } from '../types/global';\n\nif (import.meta.hot) {\n const ModuleMap = new Map();\n\n globalThis.emberHotReloadPlugin = {\n modulePrefix: '',\n podModulePrefix: '',\n Resolver: null,\n _accepting: 0,\n changed: {} as Record<string, { old: Module; new: Module }>,\n subscribers: [],\n version: 1,\n routerVersion: 1,\n moduleDepCallbacks: {},\n versionMap: {},\n\n clear(module: Module) {\n this.moduleDepCallbacks[module.id] = {};\n },\n register(module: Module, dep: string, callback: Function) {\n dep = dep.replace(new RegExp(`^${globalThis.emberHotReloadPlugin.modulePrefix}/`), './');\n this.moduleDepCallbacks[module.id]![dep] =\n this.moduleDepCallbacks[module.id]![dep] || ([] as Function[]);\n this.moduleDepCallbacks[module.id]![dep]!.push(callback);\n },\n loadNew(oldModule: Module, newModule: Module) {\n ModuleMap.set(newModule.id, newModule);\n this.versionMap[newModule.id] = newModule.version;\n const entry = Object.entries(\n this.Resolver.explicitModules as Record<string, any>,\n ).find(([name, module]) => module.default === oldModule.exports.default);\n if (!entry) return;\n this.Resolver.explicitModules[entry[0]] = newModule.exports;\n },\n\n __import(moduleUrl: string) {\n return import(/* @vite-ignore */ moduleUrl);\n },\n\n async canAcceptNew(moduleUrl: string) {\n this._accepting += 1;\n const m = await this.__import(moduleUrl);\n const module: Module = {\n exports: m,\n id: moduleUrl.split('?')[0]!.replace(/http:\\/\\/.*:[^\\/]*\\//, ''),\n version: 0,\n };\n this._accepting -= 1;\n if (this._accepting === 0) {\n setTimeout(() => this.notifyNew(), 0);\n }\n let ok =\n module.id.includes('/routes/') ||\n module.id.includes('/routers/') ||\n module.id.includes('/controllers/') ||\n module.id.includes('/templates/') ||\n module.id.match(/controller\\.(js|ts)$/) ||\n module.id.match(/route\\.(js|ts|gts)$/);\n if (!ok) {\n return false;\n }\n\n if (module.id.includes('templates') && module.id.includes('components')) {\n return false;\n }\n\n if (ModuleMap.get(module.id)) {\n this.changed[module.id] = {\n old: ModuleMap.get(module.id),\n new: module,\n };\n } else {\n ModuleMap.set(module.id, module);\n }\n module.version = this.version;\n return true;\n },\n notifyNew() {\n this.version += 1;\n (Object.values(this.changed) as Array<{ old: Module; new: Module }>).forEach((change) => {\n this.loadNew(change.old, change.new);\n this.subscribers.forEach((fn: any) => fn(change.old, change.new));\n });\n this.changed = {};\n },\n subscribe(fn: (oldModule: Module, newModule: Module) => void) {\n this.subscribers.push(fn);\n },\n unsubscribe(fn: (oldModule: Module, newModule: Module) => void) {\n const idx = this.subscribers.indexOf(fn);\n if (idx >= 0) {\n this.subscribers.splice(idx, 1);\n }\n },\n };\n}\n"],"names":["import","meta","hot","ModuleMap","Map","globalThis","emberHotReloadPlugin","modulePrefix","podModulePrefix","Resolver","_accepting","changed","subscribers","version","routerVersion","moduleDepCallbacks","versionMap","clear","module","id","register","dep","callback","replace","RegExp","push","loadNew","oldModule","newModule","set","entry","Object","entries","explicitModules","find","name","default","exports","__import","moduleUrl","canAcceptNew","m","split","setTimeout","notifyNew","ok","includes","match","get","old","new","values","forEach","change","fn","subscribe","unsubscribe","idx","indexOf","splice"],"mappings":"AAAA;;AAIA,IAAIA,MAAM,CAACC,IAAI,CAACC,GAAG,EAAE;AACjB,EAAA,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE;EAE3BC,UAAU,CAACC,oBAAoB,GAAG;AAC9BC,IAAAA,YAAY,EAAE,EAAE;AAChBC,IAAAA,eAAe,EAAE,EAAE;AACnBC,IAAAA,QAAQ,EAAE,IAAI;AACdC,IAAAA,UAAU,EAAE,CAAC;IACbC,OAAO,EAAE,EAAkD;AAC3DC,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,OAAO,EAAE,CAAC;AACVC,IAAAA,aAAa,EAAE,CAAC;IAChBC,kBAAkB,EAAE,EAAE;IACtBC,UAAU,EAAE,EAAE;IAEdC,KAAKA,CAACC,MAAc,EAAE;MAClB,IAAI,CAACH,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,GAAG,EAAE;IAC3C,CAAC;AACDC,IAAAA,QAAQA,CAACF,MAAc,EAAEG,GAAW,EAAEC,QAAkB,EAAE;AACtDD,MAAAA,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAIC,MAAM,CAAC,CAAA,CAAA,EAAInB,UAAU,CAACC,oBAAoB,CAACC,YAAY,GAAG,CAAC,EAAE,IAAI,CAAC;MACxF,IAAI,CAACQ,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,CAAEE,GAAG,CAAC,GACpC,IAAI,CAACN,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,CAAEE,GAAG,CAAC,IAAK,EAAiB;AAClE,MAAA,IAAI,CAACN,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,CAAEE,GAAG,CAAC,CAAEI,IAAI,CAACH,QAAQ,CAAC;IAC5D,CAAC;AACDI,IAAAA,OAAOA,CAACC,SAAiB,EAAEC,SAAiB,EAAE;MAC1CzB,SAAS,CAAC0B,GAAG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AACtC,WAAW,CAACwC,OAAO,CAAEE,EAAO,IAAKA,EAAE,CAACD,MAAM,CAACJ,GAAG,EAAEI,MAAM,CAACH,GAAG,CAAC,CAAC;AACrE,MAAA,CAAC,CAAC;AACF,MAAA,IAAI,CAACvC,OAAO,GAAG,EAAE;IACrB,CAAC;IACD4C,SAASA,CAACD,EAAkD,EAAE;AAC1D,MAAA,IAAI,CAAC1C,WAAW,CAACa,IAAI,CAAC6B,EAAE,CAAC;IAC7B,CAAC;IACDE,WAAWA,CAACF,EAAkD,EAAE;MAC5D,MAAMG,GAAG,GAAG,IAAI,CAAC7C,WAAW,CAAC8C,OAAO,CAACJ,EAAE,CAAC;MACxC,IAAIG,GAAG,IAAI,CAAC,EAAE;QACV,IAAI,CAAC7C,WAAW,CAAC+C,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC;AACnC,MAAA;AACJ,IAAA;GACH;AACL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],
@@ -39,7 +39,7 @@
39
39
  "prepack": "pnpm build || echo 'its okay'"
40
40
  },
41
41
  "dependencies": {
42
- "@babel/core": "^7.28.0",
42
+ "@babel/core": "^7.28.5",
43
43
  "@babel/plugin-transform-typescript": "^7.28.5",
44
44
  "@babel/traverse": "^7.28.5",
45
45
  "@babel/types": "^7.28.5",
@@ -47,7 +47,7 @@
47
47
  "@glimmer/syntax": "^0.95.0",
48
48
  "@types/supports-color": "^10.0.0",
49
49
  "babel-import-util": "^3.0.0",
50
- "babel-loader": "^10.0.0",
50
+ "babel-loader": "^10.1.1",
51
51
  "babel-preset-env": "^1.7.0",
52
52
  "semver": "^7.7.3"
53
53
  },
@@ -57,21 +57,21 @@
57
57
  "@babel/plugin-proposal-decorators": "^7.28.0",
58
58
  "@babel/plugin-transform-class-static-block": "^7.28.3",
59
59
  "@babel/runtime": "^7.28.4",
60
- "@embroider/addon-dev": "^8.1.0",
61
- "@embroider/compat": "^4.1.8",
62
- "@embroider/core": "^4.2.7",
60
+ "@embroider/addon-dev": "^8.3.0",
61
+ "@embroider/compat": "^4.1.17",
62
+ "@embroider/core": "^4.4.7",
63
63
  "@glint/core": "^1.2.0",
64
64
  "@glint/environment-ember-loose": "^1.5.2",
65
65
  "@glint/environment-ember-template-imports": "^1.5.2",
66
- "@glint/template": "^1.7.0",
67
- "@rollup/plugin-babel": "^6.1.0",
68
- "@tsconfig/ember": "^3.0.11",
66
+ "@glint/template": "^1.7.3",
67
+ "@rollup/plugin-babel": "^7.0.0",
68
+ "@tsconfig/ember": "^3.0.12",
69
69
  "@types/babel__core": "^7.20.3",
70
70
  "@types/babel__traverse": "^7.28.0",
71
71
  "@types/csso": "^5.0.4",
72
72
  "@types/debug": "^4.1.5",
73
73
  "@types/fs-extra": "^11.0.4",
74
- "@types/lodash": "^4.17.20",
74
+ "@types/lodash": "^4.17.21",
75
75
  "@types/mini-css-extract-plugin": "^2.5.1",
76
76
  "@types/node": "^24.10.1",
77
77
  "@types/rsvp": "^4.0.9",
@@ -80,33 +80,33 @@
80
80
  "babel-import-util": "^3.0.0",
81
81
  "babel-plugin-ember-template-compilation": "^3.0.1",
82
82
  "concurrently": "^9.2.1",
83
- "content-tag": "^2.0.1",
83
+ "content-tag": "^4.0.0",
84
84
  "ember-cli-htmlbars": "^6.3.0",
85
85
  "ember-resolver": "^13.1.1",
86
- "ember-source": "^6.8.1",
86
+ "ember-source": "^6.12.0",
87
87
  "@glimmer/component": "^2.0.0",
88
88
  "ember-template-lint": "^7.9.3",
89
89
  "eslint": "^9.38.0",
90
90
  "eslint-config-prettier": "^10.1.8",
91
- "eslint-plugin-ember": "^12.7.4",
91
+ "eslint-plugin-ember": "^12.7.5",
92
92
  "eslint-plugin-n": "^17.23.1",
93
- "eslint-plugin-prettier": "^5.5.4",
94
- "execa": "^9.6.0",
93
+ "eslint-plugin-prettier": "^5.5.5",
94
+ "execa": "^9.6.1",
95
95
  "fs-extra": "^11.3.2",
96
- "playwright-chromium": "^1.56.1",
97
- "prettier": "^3.6.2",
98
- "prettier-plugin-ember-template-tag": "^2.1.0",
96
+ "playwright-chromium": "^1.59.1",
97
+ "prettier": "^3.8.1",
98
+ "prettier-plugin-ember-template-tag": "^2.1.2",
99
99
  "puppeteer-chromium-resolver": "^24.0.2",
100
- "rollup": "^4.53.2",
100
+ "rollup": "^4.53.3",
101
101
  "source-map-url": "^0.4.1",
102
102
  "strip-ansi": "^7.1.2",
103
103
  "style-loader": "^4.0.0",
104
104
  "supports-color": "^10.2.2",
105
- "terser": "^5.44.1",
105
+ "terser": "^5.46.1",
106
106
  "thread-loader": "^4.0.2",
107
107
  "typescript": "^5.9.3",
108
- "vite": "^7.2.2",
109
- "vitest": "^4.0.8"
108
+ "vite": "^7.2.6",
109
+ "vitest": "^4.1.2"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "@embroider/compat": "*",