ember-vite-hmr 2.2.0 → 2.2.2
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 +66 -70
- package/dist/lib/hmr.js +95 -14
- package/dist/setup-ember-hmr.js +35 -1
- package/dist/setup-ember-hmr.js.map +1 -1
- package/package.json +15 -15
package/dist/lib/babel-plugin.js
CHANGED
|
@@ -200,80 +200,71 @@ export default function hotReplaceAst(babel) {
|
|
|
200
200
|
const Service = util.import(programPath, '@ember/service', 'default');
|
|
201
201
|
const originalClassName = classIdentifier.name;
|
|
202
202
|
const proxyClassName = `${originalClassName}HmrProxy`;
|
|
203
|
-
const implVarName = `_${originalClassName}Impl`;
|
|
204
|
-
const proxyVarName = `_${originalClassName}Proxy`;
|
|
205
203
|
// Keep the original class as-is, just remove it from export
|
|
206
204
|
// We'll add it back as a non-exported class
|
|
205
|
+
const babelTemplate = babel.template;
|
|
206
|
+
// The live proxy instance and the latest accepted implementation must
|
|
207
|
+
// live on `import.meta.hot.data`, not in a module-scope `let`: Vite
|
|
208
|
+
// guarantees that object (and only that object) survives across a
|
|
209
|
+
// module's hot re-evaluations. A component's `@service` injection can
|
|
210
|
+
// end up constructing the proxy against a *later* re-evaluation of
|
|
211
|
+
// this module than the one whose `import.meta.hot.accept` closure
|
|
212
|
+
// captured a module-scope variable — the closure and the constructor
|
|
213
|
+
// would then silently operate on two disconnected variable bindings
|
|
214
|
+
// (a duplicate-module symptom), and the HMR swap would never reach
|
|
215
|
+
// the instance actually rendered.
|
|
216
|
+
const ctorBody = babelTemplate.statements(`
|
|
217
|
+
super(...args);
|
|
218
|
+
this._owner = args[0];
|
|
219
|
+
const Impl = (import.meta.hot && import.meta.hot.data._impl) || ${proxyClassName}.Impl;
|
|
220
|
+
this._delegate = new Impl(this._owner);
|
|
221
|
+
if (import.meta.hot) {
|
|
222
|
+
import.meta.hot.data._proxy = this;
|
|
223
|
+
}
|
|
224
|
+
return new Proxy(this, {
|
|
225
|
+
get(target, prop) {
|
|
226
|
+
if (prop === '_delegate') {
|
|
227
|
+
return target._delegate;
|
|
228
|
+
}
|
|
229
|
+
return target._delegate[prop];
|
|
230
|
+
},
|
|
231
|
+
set(target, prop, value) {
|
|
232
|
+
target._delegate[prop] = value;
|
|
233
|
+
return true;
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
`)();
|
|
237
|
+
const willDestroyBody = babelTemplate.statements(`
|
|
238
|
+
super.willDestroy();
|
|
239
|
+
this._delegate.willDestroy();
|
|
240
|
+
if (import.meta.hot && import.meta.hot.data._proxy === this) {
|
|
241
|
+
import.meta.hot.data._proxy = undefined;
|
|
242
|
+
}
|
|
243
|
+
`)();
|
|
207
244
|
// Create the HMR proxy service class
|
|
208
245
|
const proxyClass = t.classDeclaration(t.identifier(proxyClassName), Service, t.classBody([
|
|
209
246
|
// static Impl = OriginalService (reference to the original class)
|
|
210
247
|
t.classProperty(t.identifier('Impl'), t.identifier(originalClassName), null, null, false, true),
|
|
211
248
|
// @tracked _delegate
|
|
212
249
|
t.classProperty(t.identifier('_delegate'), null, null, [t.decorator(tracked)], false, false),
|
|
213
|
-
|
|
214
|
-
t.classMethod('
|
|
215
|
-
t.expressionStatement(t.callExpression(t.super(), [
|
|
216
|
-
t.spreadElement(t.identifier('args')),
|
|
217
|
-
])),
|
|
218
|
-
// Store owner for HMR reloads
|
|
219
|
-
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('_owner')), t.memberExpression(t.identifier('args'), t.numericLiteral(0), true))),
|
|
220
|
-
// Initialize delegate with owner
|
|
221
|
-
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('_delegate')), t.newExpression(t.identifier(implVarName), [
|
|
222
|
-
t.memberExpression(t.thisExpression(), t.identifier('_owner'))
|
|
223
|
-
]))),
|
|
224
|
-
t.ifStatement(t.unaryExpression('!', t.identifier(proxyVarName)), t.blockStatement([
|
|
225
|
-
t.expressionStatement(t.assignmentExpression('=', t.identifier(proxyVarName), t.thisExpression())),
|
|
226
|
-
])),
|
|
227
|
-
t.returnStatement(t.newExpression(t.identifier('Proxy'), [
|
|
228
|
-
t.thisExpression(),
|
|
229
|
-
t.objectExpression([
|
|
230
|
-
t.objectMethod('method', t.identifier('get'), [t.identifier('target'), t.identifier('prop')], t.blockStatement([
|
|
231
|
-
t.ifStatement(t.binaryExpression('===', t.identifier('prop'), t.stringLiteral('_delegate')), t.returnStatement(t.memberExpression(t.identifier('target'), t.identifier('_delegate')))),
|
|
232
|
-
t.returnStatement(t.memberExpression(t.memberExpression(t.identifier('target'), t.identifier('_delegate')), t.identifier('prop'), true)),
|
|
233
|
-
])),
|
|
234
|
-
t.objectMethod('method', t.identifier('set'), [
|
|
235
|
-
t.identifier('target'),
|
|
236
|
-
t.identifier('prop'),
|
|
237
|
-
t.identifier('value'),
|
|
238
|
-
], t.blockStatement([
|
|
239
|
-
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.memberExpression(t.identifier('target'), t.identifier('_delegate')), t.identifier('prop'), true), t.identifier('value'))),
|
|
240
|
-
t.returnStatement(t.booleanLiteral(true)),
|
|
241
|
-
])),
|
|
242
|
-
]),
|
|
243
|
-
])),
|
|
244
|
-
])),
|
|
245
|
-
// willDestroy
|
|
246
|
-
t.classMethod('method', t.identifier('willDestroy'), [], t.blockStatement([
|
|
247
|
-
t.expressionStatement(t.callExpression(t.memberExpression(t.super(), t.identifier('willDestroy')), [])),
|
|
248
|
-
t.expressionStatement(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('_delegate')), t.identifier('willDestroy')), [])),
|
|
249
|
-
])),
|
|
250
|
+
t.classMethod('constructor', t.identifier('constructor'), [t.restElement(t.identifier('args'))], t.blockStatement(ctorBody)),
|
|
251
|
+
t.classMethod('method', t.identifier('willDestroy'), [], t.blockStatement(willDestroyBody)),
|
|
250
252
|
]));
|
|
251
|
-
// Create variable declarations with unique names to avoid conflicts
|
|
252
|
-
const currentImplDeclaration = t.variableDeclaration('let', [
|
|
253
|
-
t.variableDeclarator(t.identifier(implVarName), t.identifier(originalClassName)),
|
|
254
|
-
]);
|
|
255
|
-
const currentProxyDeclaration = t.variableDeclaration('let', [
|
|
256
|
-
t.variableDeclarator(t.identifier(proxyVarName), t.nullLiteral()),
|
|
257
|
-
]);
|
|
258
253
|
// For Case 1 (inline class), we need to keep the class as non-exported
|
|
259
254
|
// For Case 2 (separate declaration), the class already exists, so we don't recreate it
|
|
260
255
|
if (declaration.type === 'ClassDeclaration') {
|
|
261
256
|
// Case 1: Inline class export - create a non-exported version
|
|
262
257
|
const originalClass = t.classDeclaration(classIdentifier, classDeclaration.superClass, classDeclaration.body, classDeclaration.decorators || []);
|
|
263
258
|
// Replace the export with all the necessary declarations
|
|
264
|
-
// IMPORTANT: Class must be declared BEFORE the
|
|
259
|
+
// IMPORTANT: Class must be declared BEFORE the proxy class that references it
|
|
265
260
|
path.replaceWithMultiple([
|
|
266
261
|
originalClass, // The original class (no longer exported) - MUST BE FIRST
|
|
267
|
-
currentImplDeclaration,
|
|
268
|
-
currentProxyDeclaration,
|
|
269
262
|
t.exportDefaultDeclaration(proxyClass), // Export the proxy class
|
|
270
263
|
]);
|
|
271
264
|
}
|
|
272
265
|
else {
|
|
273
266
|
// Case 2: Separate declaration - class already exists, just replace the export
|
|
274
267
|
path.replaceWithMultiple([
|
|
275
|
-
currentImplDeclaration,
|
|
276
|
-
currentProxyDeclaration,
|
|
277
268
|
t.exportDefaultDeclaration(proxyClass), // Export the proxy class
|
|
278
269
|
]);
|
|
279
270
|
}
|
|
@@ -282,23 +273,28 @@ export default function hotReplaceAst(babel) {
|
|
|
282
273
|
const hmrCode = `
|
|
283
274
|
if (import.meta.hot) {
|
|
284
275
|
import.meta.hot.accept((newModule) => {
|
|
285
|
-
|
|
286
|
-
|
|
276
|
+
const NewImpl = newModule?.default?.Impl;
|
|
277
|
+
if (!NewImpl) {
|
|
278
|
+
return;
|
|
287
279
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
//
|
|
292
|
-
|
|
293
|
-
|
|
280
|
+
|
|
281
|
+
// Remember the latest accepted implementation so a proxy
|
|
282
|
+
// constructed *after* this update (its instantiation raced
|
|
283
|
+
// behind the HMR swap) still picks up the new class instead
|
|
284
|
+
// of the stale one captured at module-evaluation time.
|
|
285
|
+
import.meta.hot.data._impl = NewImpl;
|
|
286
|
+
|
|
287
|
+
const proxy = import.meta.hot.data._proxy;
|
|
288
|
+
if (!proxy) {
|
|
289
|
+
// No instance has been created yet; the next construction
|
|
290
|
+
// will read import.meta.hot.data._impl above.
|
|
294
291
|
return;
|
|
295
292
|
}
|
|
296
|
-
|
|
297
|
-
const oldDelegate =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
293
|
+
|
|
294
|
+
const oldDelegate = proxy._delegate;
|
|
295
|
+
const newDelegate = new NewImpl(proxy._owner);
|
|
296
|
+
proxy._delegate = newDelegate;
|
|
297
|
+
|
|
302
298
|
// Sync state from old to new while keeping new implementation defaults
|
|
303
299
|
for (const key in oldDelegate) {
|
|
304
300
|
const descriptor =
|
|
@@ -307,17 +303,17 @@ export default function hotReplaceAst(babel) {
|
|
|
307
303
|
const hasOwnDefault = Object.prototype.hasOwnProperty.call(newDelegate, key);
|
|
308
304
|
const currentValue = newDelegate[key];
|
|
309
305
|
const previousValue = oldDelegate[key];
|
|
310
|
-
|
|
306
|
+
|
|
311
307
|
// Skip Service instances - they should not be synced
|
|
312
308
|
if (previousValue instanceof Service) {
|
|
313
309
|
continue;
|
|
314
310
|
}
|
|
315
|
-
|
|
311
|
+
|
|
316
312
|
// Skip Function properties - they should not be synced
|
|
317
313
|
if (typeof previousValue === 'function') {
|
|
318
314
|
continue;
|
|
319
315
|
}
|
|
320
|
-
|
|
316
|
+
|
|
321
317
|
const shouldSync =
|
|
322
318
|
!!descriptor &&
|
|
323
319
|
(descriptor.writable || descriptor.set || Object.prototype.hasOwnProperty.call(oldDelegate, key)) &&
|
|
@@ -333,11 +329,11 @@ export default function hotReplaceAst(babel) {
|
|
|
333
329
|
}
|
|
334
330
|
|
|
335
331
|
newDelegate._hmrAccepted?.(oldDelegate);
|
|
336
|
-
|
|
332
|
+
|
|
337
333
|
if (oldDelegate.willDestroy) {
|
|
338
334
|
oldDelegate.willDestroy();
|
|
339
335
|
}
|
|
340
|
-
};
|
|
336
|
+
});
|
|
341
337
|
}
|
|
342
338
|
`;
|
|
343
339
|
const template = babel.template.statements(hmrCode);
|
package/dist/lib/hmr.js
CHANGED
|
@@ -43,9 +43,10 @@ import { tracked } from "@glimmer/tracking";
|
|
|
43
43
|
import { createComputeRef } from "@glimmer/reference";
|
|
44
44
|
import { curry } from '@glimmer/runtime';
|
|
45
45
|
import { registerDestructor } from '@ember/destroyable';
|
|
46
|
+
import { getInternalComponentManager, setInternalComponentManager } from '@glimmer/manager';
|
|
46
47
|
|
|
47
48
|
function notAny(...yields) {
|
|
48
|
-
return !yields.some((y) => !!y);
|
|
49
|
+
return !yields.some((y) => !!y);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const hotCallbacks = new Set();
|
|
@@ -58,15 +59,26 @@ if (import.meta.hot) {
|
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
// Stack of CapturedArguments (see @glimmer/interfaces), pushed by the shadow
|
|
63
|
+
// component manager below right before it constructs a HotComponent instance,
|
|
64
|
+
// and peeked (not popped) here in the constructor. It is always non-empty at
|
|
65
|
+
// this point because HotComponent is only ever created through that manager.
|
|
66
|
+
const capturedArgsStack = [];
|
|
67
|
+
|
|
61
68
|
export default class HotComponent extends Component {
|
|
62
69
|
@tracked curried;
|
|
63
70
|
hot = {};
|
|
64
71
|
constructor(owner, args) {
|
|
65
72
|
super(owner, args);
|
|
73
|
+
const capturedArgs = capturedArgsStack[capturedArgsStack.length - 1];
|
|
66
74
|
const named = {};
|
|
67
75
|
const positional = [];
|
|
68
76
|
for (const name of Object.keys(args)) {
|
|
69
|
-
|
|
77
|
+
// Forward the caller's original, updatable reference (e.g. a path like
|
|
78
|
+
// "this.value") instead of wrapping the reified value in a fresh
|
|
79
|
+
// read-only compute ref. A read-only ref fails Ember's "You can only
|
|
80
|
+
// pass a path to mut" check, breaking {{mut @arg}} in wrapped components.
|
|
81
|
+
named[name] = capturedArgs?.named[name] ?? createComputeRef(() => args[name]);
|
|
70
82
|
}
|
|
71
83
|
const CurriedComponent = 0;
|
|
72
84
|
this.curried = curry(CurriedComponent, TargetComponent, owner, { positional, named});
|
|
@@ -85,6 +97,26 @@ export default class HotComponent extends Component {
|
|
|
85
97
|
${generateContent(yields)}
|
|
86
98
|
</template>
|
|
87
99
|
}
|
|
100
|
+
|
|
101
|
+
// HotComponent's own args (the reified values passed to its constructor
|
|
102
|
+
// above) only expose values, not the underlying VM references, so the raw
|
|
103
|
+
// references have to be captured one level down, in the internal component
|
|
104
|
+
// manager's create() hook, before Ember reifies them into that value-only
|
|
105
|
+
// proxy. Shadowing the manager (rather than patching the shared default
|
|
106
|
+
// manager's create()) scopes the capture to HotComponent only; getManager()
|
|
107
|
+
// walks the prototype chain and finds this before reaching @glimmer/component's
|
|
108
|
+
// default manager.
|
|
109
|
+
const defaultManager = getInternalComponentManager(Component);
|
|
110
|
+
const shadowManager = Object.create(defaultManager);
|
|
111
|
+
shadowManager.create = function (owner, definition, vmArgs) {
|
|
112
|
+
capturedArgsStack.push(vmArgs.capture());
|
|
113
|
+
try {
|
|
114
|
+
return defaultManager.create(owner, definition, vmArgs);
|
|
115
|
+
} finally {
|
|
116
|
+
capturedArgsStack.pop();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
setInternalComponentManager(shadowManager, HotComponent);
|
|
88
120
|
`;
|
|
89
121
|
const cachedYields = {};
|
|
90
122
|
function getYieldsFromFile(filename, content, noCache) {
|
|
@@ -126,17 +158,21 @@ const virtualPrefix = '/ember-vite-hmr/virtual/component:';
|
|
|
126
158
|
// internal literal (not a public export), so we mirror the string here.
|
|
127
159
|
const compatModulesSpecifier = '@embroider/virtual/compat-modules';
|
|
128
160
|
export function hmr(enableViteHmrForModes = ['development']) {
|
|
129
|
-
|
|
161
|
+
let base = '/';
|
|
130
162
|
let server;
|
|
131
163
|
return {
|
|
132
164
|
name: 'hmr-plugin',
|
|
133
165
|
enforce: 'post',
|
|
134
166
|
config(_config, env) {
|
|
135
|
-
// The per-component hot wrapper (see getHotComponent) imports
|
|
136
|
-
// it is generated/served on demand, so it is never
|
|
137
|
-
// module graph Vite's dependency scanner crawls on
|
|
138
|
-
//
|
|
139
|
-
//
|
|
167
|
+
// The per-component hot wrapper (see getHotComponent) imports the first
|
|
168
|
+
// four of these, but it is generated/served on demand, so it is never
|
|
169
|
+
// part of the static module graph Vite's dependency scanner crawls on
|
|
170
|
+
// the first pass. `@ember/component/template-only` has the same
|
|
171
|
+
// problem for a different reason: it's injected by the template
|
|
172
|
+
// compiler into a template-only component's compiled output, which the
|
|
173
|
+
// scanner (source-only) never sees either. Without pre-declaring them,
|
|
174
|
+
// the browser requests them on boot, Vite discovers "new" deps and
|
|
175
|
+
// triggers a re-optimize + full page reload.
|
|
140
176
|
//
|
|
141
177
|
// We must use the Embroider-rewritten `ember-source/...` subpaths: the
|
|
142
178
|
// bare `@glimmer/reference` etc. specifiers the wrapper writes cannot be
|
|
@@ -152,6 +188,8 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
152
188
|
'ember-source/@glimmer/reference/index.js',
|
|
153
189
|
'ember-source/@glimmer/runtime/index.js',
|
|
154
190
|
'ember-source/@ember/destroyable/index.js',
|
|
191
|
+
'ember-source/@glimmer/manager/index.js',
|
|
192
|
+
'ember-source/@ember/component/template-only.js',
|
|
155
193
|
],
|
|
156
194
|
},
|
|
157
195
|
};
|
|
@@ -160,7 +198,7 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
160
198
|
server = s;
|
|
161
199
|
},
|
|
162
200
|
configResolved(config) {
|
|
163
|
-
|
|
201
|
+
base = config.base;
|
|
164
202
|
process.env.EMBER_VITE_HMR_ENABLED = enableViteHmrForModes
|
|
165
203
|
.includes(config.mode)
|
|
166
204
|
.toString();
|
|
@@ -212,8 +250,36 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
212
250
|
}
|
|
213
251
|
const res = yield server.transformRequest(filename);
|
|
214
252
|
const content = res === null || res === void 0 ? void 0 : res.code;
|
|
215
|
-
|
|
216
|
-
|
|
253
|
+
// For a classic component with a separately resolved template (a colocated
|
|
254
|
+
// `.hbs` file next to a backing class, or a template-only component), the
|
|
255
|
+
// compiled backing module only *imports* its template (e.g. `import TEMPLATE
|
|
256
|
+
// from "./foo.hbs?import"`); it doesn't inline it. Any {{yield ... to="..."}}
|
|
257
|
+
// usage lives in that template file, so it has to be fetched and scanned
|
|
258
|
+
// separately, otherwise named blocks other than "default" are never detected
|
|
259
|
+
// and get silently dropped by the generated hot-reload wrapper.
|
|
260
|
+
let yieldSourceFilename = filename;
|
|
261
|
+
let yieldSourceContent = content;
|
|
262
|
+
const templateImportMatch = content === null || content === void 0 ? void 0 : content.match(/\bfrom\s*['"]([^'"]+\.hbs(?:\?[^'"]*)?)['"]/);
|
|
263
|
+
if (templateImportMatch) {
|
|
264
|
+
// The compiled backing class embeds the template import as a
|
|
265
|
+
// browser-facing URL (i.e. prefixed with the configured vite
|
|
266
|
+
// `base`), since that's what gets sent to the client. But
|
|
267
|
+
// `server.transformRequest` is an internal API keyed by root-
|
|
268
|
+
// relative ids, so the base has to be stripped back off before
|
|
269
|
+
// reusing that specifier here, or this 404s under a non-root base.
|
|
270
|
+
let templateSpecifier = templateImportMatch[1];
|
|
271
|
+
if (base !== '/' && templateSpecifier.startsWith(base)) {
|
|
272
|
+
templateSpecifier = `/${templateSpecifier.slice(base.length)}`;
|
|
273
|
+
}
|
|
274
|
+
const templateRes = yield server.transformRequest(templateSpecifier);
|
|
275
|
+
yieldSourceFilename = templateSpecifier;
|
|
276
|
+
yieldSourceContent = templateRes === null || templateRes === void 0 ? void 0 : templateRes.code;
|
|
277
|
+
}
|
|
278
|
+
const resId = yield this.resolve(yieldSourceFilename, path.resolve(process.cwd(), 'package.json'));
|
|
279
|
+
// Strip any query string so the cache key matches the plain file path that
|
|
280
|
+
// `hotUpdate` below receives when that template file is edited.
|
|
281
|
+
const cacheKey = resId.id.split('?')[0];
|
|
282
|
+
const cached = getYieldsFromFile(cacheKey, yieldSourceContent !== null && yieldSourceContent !== void 0 ? yieldSourceContent : '');
|
|
217
283
|
const yields = cached.yields;
|
|
218
284
|
cached.modules.push(id);
|
|
219
285
|
return getHotComponent(imp, specifier, [...yields].filter((y) => !!y));
|
|
@@ -224,7 +290,9 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
224
290
|
if (process.env.EMBER_VITE_HMR_ENABLED !== 'true') {
|
|
225
291
|
return html;
|
|
226
292
|
}
|
|
227
|
-
|
|
293
|
+
// this hook runs after vite's own html transform, so the configured
|
|
294
|
+
// `base` has to be prefixed manually (it always ends with a slash)
|
|
295
|
+
const fullPath = `${base}@ember-vite-hmr/setup-ember-hmr.js`;
|
|
228
296
|
return [
|
|
229
297
|
{
|
|
230
298
|
tag: 'script',
|
|
@@ -375,7 +443,10 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
375
443
|
// For named imports, use the imported name
|
|
376
444
|
// Handle both Identifier and StringLiteral types
|
|
377
445
|
const imported = specifier.imported;
|
|
378
|
-
specifierName =
|
|
446
|
+
specifierName =
|
|
447
|
+
imported.type === 'Identifier'
|
|
448
|
+
? imported.name
|
|
449
|
+
: imported.value;
|
|
379
450
|
}
|
|
380
451
|
else if (specifier.type === 'ImportNamespaceSpecifier') {
|
|
381
452
|
specifierName = '*';
|
|
@@ -407,7 +478,17 @@ export function hmr(enableViteHmrForModes = ['development']) {
|
|
|
407
478
|
hotReloadStatements.push(`
|
|
408
479
|
(async () => {
|
|
409
480
|
const GlimmerComponent = (await import('@glimmer/component')).default;
|
|
410
|
-
|
|
481
|
+
const { hasInternalComponentManager } = await import('@glimmer/manager');
|
|
482
|
+
// Class-based Glimmer components are functions, detected the cheap way
|
|
483
|
+
// via prototype chain. Template-only components (no backing class, e.g.
|
|
484
|
+
// a bare \`<template>\` export) are plain objects instead, so they have to
|
|
485
|
+
// be recognized by checking for a registered component manager - that
|
|
486
|
+
// also keeps helpers/modifiers (which use separate manager registries)
|
|
487
|
+
// out of this branch.
|
|
488
|
+
const isComponent = typeof ${imp.local} === 'function'
|
|
489
|
+
? ${imp.local}.prototype instanceof GlimmerComponent
|
|
490
|
+
: typeof ${imp.local} === 'object' && ${imp.local} !== null && hasInternalComponentManager(${imp.local});
|
|
491
|
+
if (isComponent) {
|
|
411
492
|
const c = await import('${virtualPath}');
|
|
412
493
|
${importVar}.${imp.local} = c.default;
|
|
413
494
|
import.meta.hot.accept('${virtualPath}', (c) => {
|
package/dist/setup-ember-hmr.js
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
// Matches the app/addon-relative portion of a path once it reaches one of
|
|
2
|
+
// the directories ember-vite-hmr hot-reloads, e.g. the `app/templates/...`
|
|
3
|
+
// in `/Users/me/project/app/templates/application.hbs`.
|
|
4
|
+
const APP_RELATIVE_ID = /(?:^|\/)((?:app|addon)\/(?:routes?|routers|controllers|templates|services)\/.*)$/;
|
|
5
|
+
function moduleIdFromUrl(moduleUrl) {
|
|
6
|
+
let id = moduleUrl.split('?')[0];
|
|
7
|
+
try {
|
|
8
|
+
// covers http/https and URLs without an explicit port
|
|
9
|
+
id = new URL(id).pathname;
|
|
10
|
+
} catch {
|
|
11
|
+
// not an absolute URL, keep as-is
|
|
12
|
+
}
|
|
13
|
+
// strip vite's `base` so ids are stable (`app/templates/...`) no matter
|
|
14
|
+
// what base the app is served under
|
|
15
|
+
const base = import.meta.env.BASE_URL || '/';
|
|
16
|
+
if (base !== '/' && id.startsWith(base)) {
|
|
17
|
+
id = id.slice(base.length);
|
|
18
|
+
}
|
|
19
|
+
id = id.replace(/^\//, '');
|
|
20
|
+
// Outside of vite's own dev server (e.g. a Node ESM loader running the
|
|
21
|
+
// app directly against on-disk `file://` URLs, with no server `base` to
|
|
22
|
+
// strip) `id` is still the full OS path up to the project root instead
|
|
23
|
+
// of a server-relative one. Re-anchor it to the nearest hot-reloadable
|
|
24
|
+
// directory so consumers that key off ids like `app/templates/...`
|
|
25
|
+
// (ViteHotReloadService's `startsWith('app/templates/')` check) keep
|
|
26
|
+
// working no matter where the checkout lives on disk.
|
|
27
|
+
const rooted = id.match(APP_RELATIVE_ID);
|
|
28
|
+
if (rooted) {
|
|
29
|
+
id = rooted[1];
|
|
30
|
+
}
|
|
31
|
+
return id;
|
|
32
|
+
}
|
|
1
33
|
if (import.meta.hot) {
|
|
2
34
|
const ModuleMap = new Map();
|
|
3
35
|
globalThis.emberHotReloadPlugin = {
|
|
@@ -34,7 +66,7 @@ if (import.meta.hot) {
|
|
|
34
66
|
const m = await this.__import(moduleUrl);
|
|
35
67
|
const module = {
|
|
36
68
|
exports: m,
|
|
37
|
-
id: moduleUrl
|
|
69
|
+
id: moduleIdFromUrl(moduleUrl),
|
|
38
70
|
version: 0
|
|
39
71
|
};
|
|
40
72
|
this._accepting -= 1;
|
|
@@ -78,4 +110,6 @@ if (import.meta.hot) {
|
|
|
78
110
|
}
|
|
79
111
|
};
|
|
80
112
|
}
|
|
113
|
+
|
|
114
|
+
export { moduleIdFromUrl };
|
|
81
115
|
//# sourceMappingURL=setup-ember-hmr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-ember-hmr.js","sources":["../src/setup-ember-hmr.ts"],"sourcesContent":["import 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: () => void) {\n dep = dep.replace(\n new RegExp(`^${globalThis.emberHotReloadPlugin.modulePrefix}/`),\n './',\n );\n this.moduleDepCallbacks[module.id]![dep] =\n this.moduleDepCallbacks[module.id]![dep] || ([] as (() => void)[]);\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, { default?: unknown }>,\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 globalThis.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.includes('/services/') ||\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 (\n Object.values(this.changed) as Array<{ old: Module; new: Module }>\n ).forEach((change) => {\n this.loadNew(change.old, change.new);\n this.subscribers.forEach(\n (fn: (oldModule: Module, newModule: Module) => void) =>\n fn(change.old, change.new),\n );\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":"AAEA,IAAIA,MAAM,CAACC,IAAI,CAACC,GAAG,EAAE;AACnB,EAAA,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE;EAE3BC,UAAU,CAACC,oBAAoB,GAAG;AAChCC,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;MACpB,IAAI,CAACH,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,GAAG,EAAE;IACzC,CAAC;AACDC,IAAAA,QAAQA,CAACF,MAAc,EAAEG,GAAW,EAAEC,QAAoB,EAAE;AAC1DD,MAAAA,GAAG,GAAGA,GAAG,CAACE,OAAO,CACf,IAAIC,MAAM,CAAC,CAAA,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G,CAAC9B,MAAM,CAACC,EAAE,CAAC;AAC7B+B,UAAAA,GAAG,EAAEhC;SACN;AACH,MAAA,CAAC,MAAM;QACLf,SAAS,CAAC0B,GAAG,CAACX,MAAM,CAACC,EAAE,EAAED,MAAM,CAAC;AAClC,MAAA;AACAA,MAAAA,MAAM,CAACL,OAAO,GAAG,IAAI,CAACA,OAAO;AAC7B,MAAA,OAAO,IAAI;IACb,CAAC;AACD+B,IAAAA,SAASA,GAAG;MACV,IAAI,CAAC/B,OAAO,IAAI,CAAC;MAEfkB,MAAM,CAACoB,MAAM,CAAC,IAAI,CAACxC,OAAO,CAAC,CAC3ByC,OAAO,CAAEC,MAAM,IAAK;QACpB,IAAI,CAAC3B,OAAO,CAAC2B,MAAM,CAACJ,GAAG,EAAEI,MAAM,CAACH,GAAG,CAAC;AACpC,QAAA,IAAI,CAACtC,WAAW,CAACwC,OAAO,CACrBE,EAAkD,IACjDA,EAAE,CAACD,MAAM,CAACJ,GAAG,EAAEI,MAAM,CAACH,GAAG,CAC7B,CAAC;AACH,MAAA,CAAC,CAAC;AACF,MAAA,IAAI,CAACvC,OAAO,GAAG,EAAE;IACnB,CAAC;IACD4C,SAASA,CAACD,EAAkD,EAAE;AAC5D,MAAA,IAAI,CAAC1C,WAAW,CAACa,IAAI,CAAC6B,EAAE,CAAC;IAC3B,CAAC;IACDE,WAAWA,CAACF,EAAkD,EAAE;MAC9D,MAAMG,GAAG,GAAG,IAAI,CAAC7C,WAAW,CAAC8C,OAAO,CAACJ,EAAE,CAAC;MACxC,IAAIG,GAAG,IAAI,CAAC,EAAE;QACZ,IAAI,CAAC7C,WAAW,CAAC+C,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC;AACjC,MAAA;AACF,IAAA;GACD;AACH"}
|
|
1
|
+
{"version":3,"file":"setup-ember-hmr.js","sources":["../src/setup-ember-hmr.ts"],"sourcesContent":["import type { Module } from '../types/global';\n\n// Matches the app/addon-relative portion of a path once it reaches one of\n// the directories ember-vite-hmr hot-reloads, e.g. the `app/templates/...`\n// in `/Users/me/project/app/templates/application.hbs`.\nconst APP_RELATIVE_ID =\n /(?:^|\\/)((?:app|addon)\\/(?:routes?|routers|controllers|templates|services)\\/.*)$/;\n\nexport function moduleIdFromUrl(moduleUrl: string) {\n let id = moduleUrl.split('?')[0]!;\n try {\n // covers http/https and URLs without an explicit port\n id = new URL(id).pathname;\n } catch {\n // not an absolute URL, keep as-is\n }\n // strip vite's `base` so ids are stable (`app/templates/...`) no matter\n // what base the app is served under\n const base = import.meta.env.BASE_URL || '/';\n if (base !== '/' && id.startsWith(base)) {\n id = id.slice(base.length);\n }\n id = id.replace(/^\\//, '');\n // Outside of vite's own dev server (e.g. a Node ESM loader running the\n // app directly against on-disk `file://` URLs, with no server `base` to\n // strip) `id` is still the full OS path up to the project root instead\n // of a server-relative one. Re-anchor it to the nearest hot-reloadable\n // directory so consumers that key off ids like `app/templates/...`\n // (ViteHotReloadService's `startsWith('app/templates/')` check) keep\n // working no matter where the checkout lives on disk.\n const rooted = id.match(APP_RELATIVE_ID);\n if (rooted) {\n id = rooted[1]!;\n }\n return id;\n}\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: () => void) {\n dep = dep.replace(\n new RegExp(`^${globalThis.emberHotReloadPlugin.modulePrefix}/`),\n './',\n );\n this.moduleDepCallbacks[module.id]![dep] =\n this.moduleDepCallbacks[module.id]![dep] || ([] as (() => void)[]);\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, { default?: unknown }>,\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: moduleIdFromUrl(moduleUrl),\n version: 0,\n };\n this._accepting -= 1;\n if (this._accepting === 0) {\n globalThis.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.includes('/services/') ||\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 (\n Object.values(this.changed) as Array<{ old: Module; new: Module }>\n ).forEach((change) => {\n this.loadNew(change.old, change.new);\n this.subscribers.forEach(\n (fn: (oldModule: Module, newModule: Module) => void) =>\n fn(change.old, change.new),\n );\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":["APP_RELATIVE_ID","moduleIdFromUrl","moduleUrl","id","split","URL","pathname","base","import","meta","env","BASE_URL","startsWith","slice","length","replace","rooted","match","hot","ModuleMap","Map","globalThis","emberHotReloadPlugin","modulePrefix","podModulePrefix","Resolver","_accepting","changed","subscribers","version","routerVersion","moduleDepCallbacks","versionMap","clear","module","register","dep","callback","RegExp","push","loadNew","oldModule","newModule","set","entry","Object","entries","explicitModules","find","_name","default","exports","__import","canAcceptNew","m","setTimeout","notifyNew","ok","includes","get","old","new","values","forEach","change","fn","subscribe","unsubscribe","idx","indexOf","splice"],"mappings":"AAEA;AACA;AACA;AACA,MAAMA,eAAe,GACnB,kFAAkF;AAE7E,SAASC,eAAeA,CAACC,SAAiB,EAAE;EACjD,IAAIC,EAAE,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE;EACjC,IAAI;AACF;AACAD,IAAAA,EAAE,GAAG,IAAIE,GAAG,CAACF,EAAE,CAAC,CAACG,QAAQ;AAC3B,EAAA,CAAC,CAAC,MAAM;AACN;AAAA,EAAA;AAEF;AACA;EACA,MAAMC,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACC,GAAG,CAACC,QAAQ,IAAI,GAAG;EAC5C,IAAIJ,IAAI,KAAK,GAAG,IAAIJ,EAAE,CAACS,UAAU,CAACL,IAAI,CAAC,EAAE;IACvCJ,EAAE,GAAGA,EAAE,CAACU,KAAK,CAACN,IAAI,CAACO,MAAM,CAAC;AAC5B,EAAA;EACAX,EAAE,GAAGA,EAAE,CAACY,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,MAAMC,MAAM,GAAGb,EAAE,CAACc,KAAK,CAACjB,eAAe,CAAC;AACxC,EAAA,IAAIgB,MAAM,EAAE;AACVb,IAAAA,EAAE,GAAGa,MAAM,CAAC,CAAC,CAAE;AACjB,EAAA;AACA,EAAA,OAAOb,EAAE;AACX;AAEA,IAAIK,MAAM,CAACC,IAAI,CAACS,GAAG,EAAE;AACnB,EAAA,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE;EAE3BC,UAAU,CAACC,oBAAoB,GAAG;AAChCC,IAAAA,YAAY,EAA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AACD,EAAkD,EAAE;AAC5D,MAAA,IAAI,CAACrC,WAAW,CAACW,IAAI,CAAC0B,EAAE,CAAC;IAC3B,CAAC;IACDE,WAAWA,CAACF,EAAkD,EAAE;MAC9D,MAAMG,GAAG,GAAG,IAAI,CAACxC,WAAW,CAACyC,OAAO,CAACJ,EAAE,CAAC;MACxC,IAAIG,GAAG,IAAI,CAAC,EAAE;QACZ,IAAI,CAACxC,WAAW,CAAC0C,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC;AACjC,MAAA;AACF,IAAA;GACD;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-vite-hmr",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "provides hmr support for ember apps",
|
|
6
6
|
"keywords": [
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"babel-import-util": "^3.0.0",
|
|
46
46
|
"babel-loader": "^10.1.1",
|
|
47
47
|
"babel-preset-env": "^1.7.0",
|
|
48
|
-
"semver": "^7.8.
|
|
48
|
+
"semver": "^7.8.5"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/eslint-parser": "^7.28.6",
|
|
52
52
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
53
53
|
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
54
54
|
"@babel/plugin-transform-class-static-block": "^7.28.6",
|
|
55
|
-
"@babel/runtime": "^
|
|
55
|
+
"@babel/runtime": "^8.0.0",
|
|
56
56
|
"@embroider/addon-dev": "^8.3.0",
|
|
57
57
|
"@embroider/compat": "^4.1.20",
|
|
58
|
-
"@embroider/core": "^4.6.
|
|
58
|
+
"@embroider/core": "^4.6.2",
|
|
59
59
|
"@eslint/js": "^9.39.4",
|
|
60
60
|
"@glimmer/component": "^2.0.0",
|
|
61
61
|
"@glint/core": "^1.2.0",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"@types/fs-extra": "^11.0.4",
|
|
72
72
|
"@types/lodash": "^4.17.24",
|
|
73
73
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^26.1.1",
|
|
75
75
|
"@types/rsvp": "^4.0.9",
|
|
76
76
|
"@types/semver": "^7.7.1",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
78
|
-
"@typescript-eslint/parser": "^8.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
|
78
|
+
"@typescript-eslint/parser": "^8.65.0",
|
|
79
79
|
"assert-never": "^1.4.0",
|
|
80
80
|
"babel-import-util": "^3.0.0",
|
|
81
81
|
"babel-plugin-ember-template-compilation": "^4.0.0",
|
|
@@ -83,22 +83,22 @@
|
|
|
83
83
|
"content-tag": "^4.0.0",
|
|
84
84
|
"ember-cli-htmlbars": "^6.3.0",
|
|
85
85
|
"ember-resolver": "^13.2.0",
|
|
86
|
-
"ember-source": "^7.
|
|
86
|
+
"ember-source": "^7.1.0",
|
|
87
87
|
"ember-template-lint": "^7.9.3",
|
|
88
88
|
"eslint": "^9.39.4",
|
|
89
89
|
"eslint-config-prettier": "^10.1.8",
|
|
90
|
-
"eslint-plugin-ember": "^13.
|
|
91
|
-
"eslint-plugin-n": "^18.
|
|
90
|
+
"eslint-plugin-ember": "^13.4.1",
|
|
91
|
+
"eslint-plugin-n": "^18.2.2",
|
|
92
92
|
"eslint-plugin-prettier": "^5.5.5",
|
|
93
93
|
"execa": "^9.6.1",
|
|
94
|
-
"fs-extra": "^11.3.
|
|
95
|
-
"globals": "^17.
|
|
94
|
+
"fs-extra": "^11.3.6",
|
|
95
|
+
"globals": "^17.7.0",
|
|
96
96
|
"playwright-chromium": "^1.59.1",
|
|
97
97
|
"prettier": "^3.8.4",
|
|
98
|
-
"prettier-plugin-ember-template-tag": "^2.1.
|
|
98
|
+
"prettier-plugin-ember-template-tag": "^2.1.7",
|
|
99
99
|
"puppeteer-chromium-resolver": "^24.0.2",
|
|
100
100
|
"release-plan": "^0.18.0",
|
|
101
|
-
"rollup": "^4.
|
|
101
|
+
"rollup": "^4.62.2",
|
|
102
102
|
"source-map-url": "^0.4.1",
|
|
103
103
|
"strip-ansi": "^7.2.0",
|
|
104
104
|
"style-loader": "^4.0.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"thread-loader": "^4.0.2",
|
|
108
108
|
"typescript": "^5.9.3",
|
|
109
109
|
"vite": "^8.0.16",
|
|
110
|
-
"vitest": "^4.1.
|
|
110
|
+
"vitest": "^4.1.10"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@embroider/compat": "*",
|