@moostjs/vite 0.5.15 → 0.5.17

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/index.cjs CHANGED
@@ -104,38 +104,42 @@ function getLogger() {
104
104
  function moostRestartCleanup(adapters, onEject, cleanupInstances) {
105
105
  const logger = getLogger();
106
106
  const infact = moost.getMoostInfact();
107
- const { registry } = infact;
107
+ const { registry, scopes } = infact;
108
+ const registries = [registry, ...Object.values(scopes)];
108
109
  infact._cleanup();
109
110
  const mate = moost.getMoostMate();
110
111
  if (cleanupInstances) {
111
- for (const key of Object.getOwnPropertySymbols(registry)) {
112
- const instance = registry[key];
113
- const viteId = mate.read(instance)?.__vite_id;
114
- if (viteId && cleanupInstances.has(viteId)) {
115
- logger.debug(`🔃 Replacing "${constructorName(instance)}"`);
116
- delete registry[key];
117
- }
118
- }
119
- for (const key of Object.getOwnPropertySymbols(registry)) {
120
- const instance = registry[key];
121
- scanParams(instance, (type) => {
122
- if ((type === moost.Moost || type instanceof moost.Moost || type.prototype instanceof moost.Moost) &&
123
- (!onEject || onEject(instance, type))) {
124
- delete registry[key];
125
- logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "Moost")`);
126
- return true;
112
+ for (const reg of registries) {
113
+ for (const key of Object.getOwnPropertySymbols(reg)) {
114
+ const instance = reg[key];
115
+ const viteId = mate.read(instance)?.__vite_id;
116
+ if (viteId && cleanupInstances.has(viteId)) {
117
+ logger.debug(`🔃 Replacing "${constructorName(instance)}"`);
118
+ delete reg[key];
127
119
  }
128
- for (const adapter of adapters) {
129
- if (adapter.compare(type) && (!onEject || onEject(instance, type))) {
130
- delete registry[key];
131
- logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "${adapter.constructor.name}")`);
120
+ }
121
+ for (const key of Object.getOwnPropertySymbols(reg)) {
122
+ const instance = reg[key];
123
+ scanParams(instance, (type) => {
124
+ if ((type === moost.Moost || type instanceof moost.Moost || type.prototype instanceof moost.Moost) &&
125
+ (!onEject || onEject(instance, type))) {
126
+ delete reg[key];
127
+ logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "Moost")`);
132
128
  return true;
133
129
  }
134
- }
135
- });
130
+ for (const adapter of adapters) {
131
+ if (adapter.compare(type) && (!onEject || onEject(instance, type))) {
132
+ delete reg[key];
133
+ logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "${adapter.constructor.name}")`);
134
+ return true;
135
+ }
136
+ }
137
+ });
138
+ }
139
+ clearDependantRegistry(reg, onEject);
136
140
  }
137
- clearDependantRegistry(registry, onEject);
138
141
  infact.registry = registry;
142
+ infact.scopes = scopes;
139
143
  }
140
144
  moost.getMoostMate()._cleanup();
141
145
  moost.clearGlobalWooks();
package/dist/index.mjs CHANGED
@@ -102,38 +102,42 @@ function getLogger() {
102
102
  function moostRestartCleanup(adapters, onEject, cleanupInstances) {
103
103
  const logger = getLogger();
104
104
  const infact = getMoostInfact();
105
- const { registry } = infact;
105
+ const { registry, scopes } = infact;
106
+ const registries = [registry, ...Object.values(scopes)];
106
107
  infact._cleanup();
107
108
  const mate = getMoostMate();
108
109
  if (cleanupInstances) {
109
- for (const key of Object.getOwnPropertySymbols(registry)) {
110
- const instance = registry[key];
111
- const viteId = mate.read(instance)?.__vite_id;
112
- if (viteId && cleanupInstances.has(viteId)) {
113
- logger.debug(`🔃 Replacing "${constructorName(instance)}"`);
114
- delete registry[key];
115
- }
116
- }
117
- for (const key of Object.getOwnPropertySymbols(registry)) {
118
- const instance = registry[key];
119
- scanParams(instance, (type) => {
120
- if ((type === Moost || type instanceof Moost || type.prototype instanceof Moost) &&
121
- (!onEject || onEject(instance, type))) {
122
- delete registry[key];
123
- logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "Moost")`);
124
- return true;
110
+ for (const reg of registries) {
111
+ for (const key of Object.getOwnPropertySymbols(reg)) {
112
+ const instance = reg[key];
113
+ const viteId = mate.read(instance)?.__vite_id;
114
+ if (viteId && cleanupInstances.has(viteId)) {
115
+ logger.debug(`🔃 Replacing "${constructorName(instance)}"`);
116
+ delete reg[key];
125
117
  }
126
- for (const adapter of adapters) {
127
- if (adapter.compare(type) && (!onEject || onEject(instance, type))) {
128
- delete registry[key];
129
- logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "${adapter.constructor.name}")`);
118
+ }
119
+ for (const key of Object.getOwnPropertySymbols(reg)) {
120
+ const instance = reg[key];
121
+ scanParams(instance, (type) => {
122
+ if ((type === Moost || type instanceof Moost || type.prototype instanceof Moost) &&
123
+ (!onEject || onEject(instance, type))) {
124
+ delete reg[key];
125
+ logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "Moost")`);
130
126
  return true;
131
127
  }
132
- }
133
- });
128
+ for (const adapter of adapters) {
129
+ if (adapter.compare(type) && (!onEject || onEject(instance, type))) {
130
+ delete reg[key];
131
+ logger.debug(`✖️ Ejecting "${constructorName(instance)}" (depends on re-instantiated "${adapter.constructor.name}")`);
132
+ return true;
133
+ }
134
+ }
135
+ });
136
+ }
137
+ clearDependantRegistry(reg, onEject);
134
138
  }
135
- clearDependantRegistry(registry, onEject);
136
139
  infact.registry = registry;
140
+ infact.scopes = scopes;
137
141
  }
138
142
  getMoostMate()._cleanup();
139
143
  clearGlobalWooks();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/vite",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "Vite Dev plugin for moostjs",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/vite#readme",
40
40
  "peerDependencies": {
41
- "moost": "0.5.15",
42
- "@moostjs/event-http": "0.5.15",
41
+ "moost": "0.5.17",
42
+ "@moostjs/event-http": "0.5.17",
43
43
  "vite": "^6.0.5"
44
44
  }
45
45
  }