ember-vite-hmr 0.6.9 → 1.1.0

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/addon-main.cjs CHANGED
@@ -43,6 +43,6 @@ Object.assign(module.exports, {
43
43
  },
44
44
 
45
45
  _buildPlugin() {
46
- return require('./dist/lib/babel-plugin').hotAstProcessor;
46
+ return require('./dist/lib/babel-plugin').hotAstProcessor.transform;
47
47
  },
48
48
  });
@@ -84,37 +84,45 @@ class HotAstProcessor {
84
84
  };
85
85
  this.counter = 0;
86
86
  this.meta = {
87
- usedImports: new Set(),
87
+ locals: new Set(),
88
88
  importVar: null,
89
+ babelProgram: null,
90
+ importBindings: new Set(),
89
91
  };
92
+ this.didCreateImportClass = false;
90
93
  this.transform = this.transform.bind(this);
91
94
  }
95
+ reset() {
96
+ this.meta.importVar = null;
97
+ this.meta.babelProgram = null;
98
+ this.meta.importBindings = new Set();
99
+ }
92
100
  transform(env) {
93
- if (!this.meta.importVar)
101
+ if (process.env['EMBER_VITE_HMR_ENABLED'] !== 'true') {
94
102
  return {
95
- visitor: {},
96
- };
97
- const meta = this.meta;
98
- meta.usedImports = new Set();
99
- const usedImports = this.meta.usedImports;
100
- const imports = [...env.locals];
101
- if (!meta.importVar) {
102
- return {
103
- visitor: {},
103
+ visitor: {}
104
104
  };
105
105
  }
106
- const importVar = meta.importVar.name;
107
- env.locals.length = 0;
108
- env.locals.push(importVar);
106
+ const meta = this.meta;
107
+ const importVar = meta.importVar || env.meta.jsutils.bindExpression('null', null, { nameHint: 'template__imports__' });
108
+ meta.importVar = importVar;
109
+ const findImport = function findImport(specifier) {
110
+ return meta.babelProgram.body.find(b => b.type === 'ImportDeclaration' && b.specifiers.some(s => s.local.name === specifier));
111
+ };
109
112
  return {
110
- visitor: this.buildVisitor({
111
- importVar,
112
- imports,
113
- usedImports,
114
- }),
113
+ visitor: {
114
+ ...this.buildVisitor({
115
+ importVar,
116
+ importBindings: meta.importBindings,
117
+ babelProgram: meta.babelProgram
118
+ }),
119
+ },
115
120
  };
116
121
  }
117
- buildVisitor({ importVar, imports, usedImports }) {
122
+ buildVisitor({ importVar, importBindings, babelProgram }) {
123
+ const findImport = function findImport(specifier) {
124
+ return babelProgram.body.find(b => b.type === 'ImportDeclaration' && b.specifiers.some(s => s.local.name === specifier));
125
+ };
118
126
  const findBlockParams = function (expression, p) {
119
127
  if (p.node &&
120
128
  p.node.type === 'BlockStatement' &&
@@ -131,8 +139,9 @@ class HotAstProcessor {
131
139
  };
132
140
  const visitor = {
133
141
  PathExpression: (node, p) => {
134
- if ((p.parentNode?.type === 'SubExpression' ||
135
- p.parentNode?.type === 'MustacheStatement') &&
142
+ var _a, _b;
143
+ if ((((_a = p.parentNode) === null || _a === void 0 ? void 0 : _a.type) === 'SubExpression' ||
144
+ ((_b = p.parentNode) === null || _b === void 0 ? void 0 : _b.type) === 'MustacheStatement') &&
136
145
  p.parentNode.params.includes(node)) {
137
146
  return;
138
147
  }
@@ -155,250 +164,88 @@ class HotAstProcessor {
155
164
  if (original &&
156
165
  findBlockParams(original, p))
157
166
  return;
158
- if (original?.includes('.'))
167
+ if (original === null || original === void 0 ? void 0 : original.includes('.'))
159
168
  return;
160
169
  if (!original)
161
170
  return;
162
171
  const param = glimmer.builders.path(`${importVar}.${original}`);
163
172
  parent.params.splice(0, 1);
164
173
  parent.params.push(param);
165
- usedImports.add(original);
166
174
  return;
167
175
  }
168
176
  if (importVar) {
169
- if (imports.includes(node.original)) {
170
- usedImports.add(node.original);
177
+ if (findImport(node.original)) {
171
178
  node.original = `${importVar}.${original}` + node.original.split('.').slice(1).join('.');
172
179
  node.parts = node.original.split('.');
180
+ importBindings.add(original);
173
181
  }
174
182
  return;
175
183
  }
176
184
  },
177
185
  ElementNode: (element, p) => {
178
- if (findBlockParams(element.tag.split('.')[0], p))
186
+ const original = element.tag.split('.')[0];
187
+ if (findBlockParams(original, p))
179
188
  return;
180
189
  if (importVar) {
181
- if (imports.includes(element.tag)) {
182
- usedImports.add(element.tag);
183
- element.tag = `${importVar}.${element.tag}`;
190
+ if (findImport(original)) {
191
+ element.tag = `${importVar}.${original}`;
192
+ importBindings.add(original);
184
193
  }
185
194
  return;
186
195
  }
187
196
  },
188
- Program: {
189
- exit(program) { },
190
- },
191
197
  };
192
198
  return visitor;
193
199
  }
194
- replaceInAst(ast, importVar, imports) {
195
- const usedImports = new Set();
196
- const hotReplaced = {
197
- components: new Set(),
198
- helpers: new Set(),
199
- modifiers: new Set(),
200
- others: new Set(),
201
- info: {
202
- components: {},
203
- helpers: {},
204
- modifiers: {},
205
- },
206
- };
207
- const visitor = this.buildVisitor({
208
- importVar,
209
- imports,
210
- usedImports,
211
- });
212
- glimmer.traverse(ast, visitor);
213
- return usedImports;
214
- }
215
- processAst(contents, importVar, imports) {
216
- const ast = glimmer.preprocess(contents);
217
- this.counter = 0;
218
- this.usedImports = this.replaceInAst(ast, importVar, imports);
219
- return glimmer.print(ast);
220
- }
221
200
  }
222
201
  exports.hotAstProcessor = new HotAstProcessor();
223
202
  function hotReplaceAst({ types: t }) {
224
203
  let imports = [];
225
204
  let importMap = {};
226
- let tracked;
227
- let importVar;
228
- let importsKlass;
229
- let templateImportSpecifier = '';
230
- importMap = {};
231
- imports = [];
232
205
  return {
233
- name: 'hot-reload-imports',
206
+ name: 'a-hot-reload-imports',
234
207
  pre(file) {
235
- for (let statement of file.ast.program.body) {
236
- if (statement.type === 'ImportDeclaration') {
237
- for (let specifier of statement.specifiers) {
238
- imports.push(specifier.local.name);
239
- importMap[specifier.local.name] = {
240
- source: statement.source.value,
241
- specifiers: statement.specifiers,
242
- };
243
- }
244
- }
245
- }
208
+ exports.hotAstProcessor.reset();
209
+ exports.hotAstProcessor.meta.babelProgram = file.ast.program;
246
210
  },
247
211
  visitor: {
248
- Program: {
249
- enter(path, state) {
250
- state.importUtil = new babel_import_util_1.ImportUtil(t, path);
251
- templateImportSpecifier = '';
252
- importVar = null;
253
- tracked = null;
254
- exports.hotAstProcessor.meta.usedImports = [];
255
- exports.hotAstProcessor.meta.importVar = null;
256
- const filename = path.hub.file.opts.filename.split('?')[0];
257
- if (!filename.endsWith('.hbs') &&
258
- !filename.endsWith('.gts') &&
259
- !filename.endsWith('.gjs')) {
260
- return;
261
- }
262
- if (!filename.includes('rewritten-app')) {
263
- return;
264
- }
265
- const node = path.node;
266
- const templateImport = node.body.find((i) => i.type === 'ImportDeclaration' &&
267
- i.source.value === '@ember/template-compiler');
268
- if (templateImport && templateImport.type === 'ImportDeclaration') {
269
- const def = templateImport.specifiers[0];
270
- templateImportSpecifier = def.local.name;
271
- }
272
- tracked = path.scope.generateUidIdentifier('tracked');
273
- importVar = t.identifier('imports_templates__');
274
- exports.hotAstProcessor.meta.importVar = importVar;
275
- node.body.splice(0, 0, t.importDeclaration([t.importSpecifier(tracked, t.identifier('tracked'))], t.stringLiteral('@glimmer/tracking')));
276
- let usedImports = new Set();
277
- path.traverse({
278
- CallExpression(path) {
279
- const call = path.node;
280
- if (templateImportSpecifier &&
281
- call.callee.name ===
282
- templateImportSpecifier &&
283
- (call.arguments[0]?.type === 'StringLiteral' ||
284
- call.arguments[0]?.type === 'TemplateLiteral')) {
285
- if (call.arguments[0].type === 'StringLiteral') {
286
- call.arguments[0].value = exports.hotAstProcessor.processAst(call.arguments[0].value, importVar.name, imports);
287
- exports.hotAstProcessor.usedImports.forEach(usedImports.add, usedImports);
288
- }
289
- if (call.arguments[0].type === 'TemplateLiteral' &&
290
- call.arguments[0].quasis[0]) {
291
- call.arguments[0].quasis[0].value.raw =
292
- exports.hotAstProcessor.processAst(call.arguments[0].quasis[0].value.raw, importVar.name, imports);
293
- exports.hotAstProcessor.usedImports.forEach(usedImports.add, usedImports);
294
- }
295
- }
296
- },
297
- });
298
- const lastImport = [...node.body]
299
- .reverse()
300
- .find((x) => x.type === 'ImportDeclaration');
301
- const idx = node.body.indexOf(lastImport);
302
- const importsVar = t.variableDeclaration('let', [
303
- t.variableDeclarator(importVar),
304
- ]);
305
- importsKlass = t.classExpression(path.scope.generateUidIdentifier('Imports'), null, t.classBody([...usedImports].map((i) => {
306
- const { source, specifiers } = importMap[i];
307
- const specifier = specifiers.find((s) => s.local.name === i);
308
- const specifierName = specifier.imported?.name ||
309
- specifier.imported?.value ||
310
- 'default';
311
- const x = state.importUtil.import(path, source, specifierName);
312
- return t.classProperty(t.identifier(i), x, null, [
313
- t.decorator(tracked),
314
- ]);
315
- })));
316
- const assignment = t.expressionStatement(t.assignmentExpression('=', importVar, t.newExpression(importsKlass, [])));
317
- const hotAccepts = [];
318
- for (const imp of [...usedImports]) {
319
- const { source, specifiers } = importMap[imp];
320
- const specifier = specifiers.find((s) => s.local.name === imp);
321
- const specifierName = specifier.imported?.name ||
322
- specifier.imported?.value ||
323
- 'default';
324
- const ast = (0, core_1.parse)(`import.meta.hot.accept('${source}', (module) => (${importVar.name}.${imp}=module['${specifierName}']))`);
325
- const impHot = ast?.program.body[0];
326
- hotAccepts.push(impHot);
327
- }
328
- const ifHot = t.ifStatement(t.memberExpression(t.metaProperty(t.identifier('import'), t.identifier('meta')), t.identifier('hot')), t.blockStatement([assignment, ...hotAccepts]));
329
- node.body.splice(0, 0, importsVar);
330
- node.body.push(ifHot);
331
- },
332
- exit(path, state) {
333
- const filename = path.hub.file.opts.filename.split('?')[0];
334
- if (!filename.includes('rewritten-app')) {
335
- return;
336
- }
337
- if (!filename.endsWith('.hbs')) {
338
- return;
339
- }
340
- path.traverse({
341
- ImportDeclaration: function (path) {
342
- path.node.specifiers.forEach(function (s) {
343
- imports.push(s.local.name);
344
- importMap[s.local.name] = {
345
- source: path.node.source.value,
346
- specifiers: path.node.specifiers,
347
- };
348
- });
349
- },
350
- });
351
- const node = path.node;
352
- const usedImports = exports.hotAstProcessor.meta.usedImports;
353
- if (usedImports || exports.hotAstProcessor.usedImports) {
354
- const lastImport = [...node.body]
355
- .reverse()
356
- .find((x) => x.type === 'ImportDeclaration');
357
- const idx = node.body.indexOf(lastImport);
358
- const assignment = node.body.slice(-1)[0];
359
- node.body.splice(-1, 1);
360
- node.body.splice(idx, 0, assignment);
361
- const hotAccepts = [];
362
- const handled = new Set();
363
- for (const imp of [...usedImports, ...exports.hotAstProcessor.meta.usedImports]) {
364
- const { source, specifiers } = importMap[imp];
365
- const specifier = specifiers.find((s) => s.local.name === imp);
366
- const specifierName = specifier.imported?.name ||
367
- specifier.imported?.value ||
368
- 'default';
369
- if (handled.has(imp)) {
370
- continue;
371
- }
372
- handled.add(imp);
373
- state.importUtil.import(path, source, specifierName);
374
- const ast = (0, core_1.parse)(`import.meta.hot.accept('${source}', (module) => (${importVar.name}.${imp}=module['${specifierName}']))`);
375
- const impHot = ast?.program.body[0];
376
- hotAccepts.push(impHot);
377
- }
378
- const ifHot = t.ifStatement(t.memberExpression(t.metaProperty(t.identifier('import'), t.identifier('meta')), t.identifier('hot')), t.blockStatement([...hotAccepts]));
379
- node.body.push(ifHot);
380
- importsKlass.body.body.length = 0;
381
- }
382
- },
383
- },
384
- CallExpression: {
385
- exit(path, state) {
386
- const filename = path.hub.file.opts.filename.split('?')[0];
387
- if (filename.endsWith('.hbs')) {
388
- const usedImports = exports.hotAstProcessor.meta.usedImports;
389
- [...usedImports].map((i) => {
390
- if (importsKlass.body.body.find((b) => b.key.name === i)) {
391
- return;
392
- }
393
- const x = t.identifier(i);
394
- const klassProp = t.classProperty(t.identifier(i), x, null, [
395
- t.decorator(tracked),
396
- ]);
397
- importsKlass.body.body.push(klassProp);
398
- });
399
- }
400
- },
401
- },
212
+ Program(path, state) {
213
+ var _a, _b;
214
+ if (!exports.hotAstProcessor.meta.importVar) {
215
+ return;
216
+ }
217
+ if (process.env['EMBER_VITE_HMR_ENABLED'] !== 'true') {
218
+ return;
219
+ }
220
+ const util = new babel_import_util_1.ImportUtil(t, path);
221
+ const tracked = util.import(path, '@glimmer/tracking', 'tracked');
222
+ const klass = t.classExpression(path.scope.generateUidIdentifier('Imports'), null, t.classBody([]));
223
+ const bindings = [...exports.hotAstProcessor.meta.importBindings].sort();
224
+ for (const local of bindings) {
225
+ klass.body.body.push(t.classProperty(t.identifier(local), t.identifier(local), null, [t.decorator(tracked)]));
226
+ }
227
+ const assign = t.assignmentExpression('=', t.identifier(exports.hotAstProcessor.meta.importVar), klass);
228
+ const varDeclaration = path.node.body.findIndex((e) => e.type === 'VariableDeclaration' && e.declarations[0].id.name === exports.hotAstProcessor.meta.importVar) + 1;
229
+ const lastImportIndex = path.node.body.findLastIndex((e) => e.type === 'ImportDeclaration') + 1;
230
+ path.node.body.splice(Math.max(varDeclaration, lastImportIndex), 0, assign);
231
+ const findImport = function findImport(specifier) {
232
+ return path.node.body.find(b => b.type === 'ImportDeclaration' && b.specifiers.some(s => s.local.name === specifier));
233
+ };
234
+ const hotAccepts = [];
235
+ for (const imp of bindings) {
236
+ const importDeclaration = findImport(imp);
237
+ const source = importDeclaration.source.value;
238
+ const specifier = importDeclaration.specifiers.find((s) => s.local.name === imp);
239
+ const specifierName = ((_a = specifier.imported) === null || _a === void 0 ? void 0 : _a.name) ||
240
+ ((_b = specifier.imported) === null || _b === void 0 ? void 0 : _b.value) ||
241
+ 'default';
242
+ const ast = (0, core_1.parse)(`import.meta.hot.accept('${source}', (module) => (${exports.hotAstProcessor.meta.importVar}.${imp}=module['${specifierName}']))`);
243
+ const impHot = ast === null || ast === void 0 ? void 0 : ast.program.body[0];
244
+ hotAccepts.push(impHot);
245
+ }
246
+ const ifHot = t.ifStatement(t.memberExpression(t.metaProperty(t.identifier('import'), t.identifier('meta')), t.identifier('hot')), t.blockStatement([...hotAccepts]));
247
+ path.node.body.push(ifHot);
248
+ }
402
249
  },
403
250
  };
404
251
  }
package/dist/lib/hmr.d.ts CHANGED
@@ -1,8 +1,2 @@
1
- export declare function hmr(): {
2
- name: string;
3
- enforce: string;
4
- resolveId(id: any): any;
5
- transformIndexHtml(html: any): string;
6
- handleHotUpdate(ctx: any): any;
7
- transform(source: any, id: any): Promise<any>;
8
- };
1
+ import { Plugin } from 'vite';
2
+ export declare function hmr(enableViteHmrForModes?: string[]): Plugin;
package/dist/lib/hmr.js CHANGED
@@ -5,10 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.hmr = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- function hmr() {
8
+ function hmr(enableViteHmrForModes = ['development']) {
9
9
  return {
10
10
  name: 'hmr-plugin',
11
11
  enforce: 'post',
12
+ configResolved(config) {
13
+ process.env['EMBER_VITE_HMR_ENABLED'] = enableViteHmrForModes.includes(config.mode).toString();
14
+ },
12
15
  resolveId(id) {
13
16
  if (id.startsWith('/@id/embroider_virtual:')) {
14
17
  return this.resolve(id.replace('/@id/', ''), path_1.default.join(process.cwd(), 'package.json'));
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "ember-vite-hmr",
3
- "version": "0.6.9",
3
+ "version": "1.1.0",
4
4
  "keywords": [
5
5
  "ember-addon"
6
6
  ],
7
7
  "private": false,
8
- "description": "Builds EmberJS apps with Webpack Dev Server and Hot Reload",
8
+ "description": "provides hmr support for ember apps",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/patricklx/ember-vite-hmr"
@@ -84,7 +84,8 @@
84
84
  "@types/mini-css-extract-plugin": "^1.4.3",
85
85
  "@types/node": "^15.12.2",
86
86
  "@types/semver": "^7.3.6",
87
- "babel-plugin-ember-template-compilation": "^2.2.1",
87
+ "babel-plugin-ember-template-compilation": "^2.2.2",
88
+ "babel-import-util": "2.0.3",
88
89
  "concurrently": "^8.0.1",
89
90
  "ember-resolver": "^11.0.1",
90
91
  "ember-source": "^5.3.0",
@@ -100,7 +101,9 @@
100
101
  "typescript": "^5.1.6"
101
102
  },
102
103
  "peerDependencies": {
103
- "@embroider/compat": "*"
104
+ "@embroider/compat": "*",
105
+ "babel-plugin-ember-template-compilation": "^2.2.2",
106
+ "babel-import-util": "2.0.3"
104
107
  },
105
108
  "engines": {
106
109
  "node": "12.* || 14.* || >= 16"
@@ -113,8 +116,8 @@
113
116
  "type": "addon",
114
117
  "main": "addon-main.cjs",
115
118
  "app-js": {
116
- "./initializers/webpack-hot-reload.js": "./dist/_app_/initializers/webpack-hot-reload.js",
117
- "./services/webpack-hot-reload.js": "./dist/_app_/services/webpack-hot-reload.js"
119
+ "./initializers/vite-hot-reload.js": "./dist/_app_/initializers/vite-hot-reload.js",
120
+ "./services/vite-hot-reload.js": "./dist/_app_/services/vite-hot-reload.js"
118
121
  }
119
122
  },
120
123
  "exports": {
@@ -1 +0,0 @@
1
- export { default } from "ember-vite-hmr/initializers/webpack-hot-reload";
@@ -1 +0,0 @@
1
- export { default } from "ember-vite-hmr/services/webpack-hot-reload";
@@ -1,15 +0,0 @@
1
- function initialize(application) {
2
- application.__container__.lookup('service:webpack-hot-reload');
3
- const resolver = application.__registry__.resolver._fallback || application.__registry__.resolver;
4
- const resolverResolve = resolver.resolve;
5
- resolver.resolve = function (name) {
6
- name = name.replace(/--hot-version--.*$/, '');
7
- return resolverResolve.call(this, name);
8
- };
9
- }
10
- var webpackHotReload = {
11
- initialize
12
- };
13
-
14
- export { webpackHotReload as default, initialize };
15
- //# sourceMappingURL=webpack-hot-reload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-hot-reload.js","sources":["../../src/initializers/webpack-hot-reload.ts"],"sourcesContent":["export function initialize(application) {\n application.__container__.lookup('service:webpack-hot-reload');\n const resolver =\n application.__registry__.resolver._fallback ||\n application.__registry__.resolver;\n const resolverResolve = resolver.resolve;\n resolver.resolve = function (name) {\n name = name.replace(/--hot-version--.*$/, '');\n return resolverResolve.call(this, name);\n };\n}\n\nexport default {\n initialize,\n};\n"],"names":["initialize","application","__container__","lookup","resolver","__registry__","_fallback","resolverResolve","resolve","name","replace","call"],"mappings":"AAAO,SAASA,UAAUA,CAACC,WAAW,EAAE;AACtCA,EAAAA,WAAW,CAACC,aAAa,CAACC,MAAM,CAAC,4BAA4B,CAAC,CAAA;AAC9D,EAAA,MAAMC,QAAQ,GACZH,WAAW,CAACI,YAAY,CAACD,QAAQ,CAACE,SAAS,IAC3CL,WAAW,CAACI,YAAY,CAACD,QAAQ,CAAA;AACnC,EAAA,MAAMG,eAAe,GAAGH,QAAQ,CAACI,OAAO,CAAA;AACxCJ,EAAAA,QAAQ,CAACI,OAAO,GAAG,UAAUC,IAAI,EAAE;IACjCA,IAAI,GAAGA,IAAI,CAACC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;AAC7C,IAAA,OAAOH,eAAe,CAACI,IAAI,CAAC,IAAI,EAAEF,IAAI,CAAC,CAAA;GACxC,CAAA;AACH,CAAA;AAEA,uBAAe;AACbT,EAAAA,UAAAA;AACF,CAAC;;;;"}
@@ -1,34 +0,0 @@
1
- import { PluginObj } from '@babel/core';
2
- import type * as BabelTypesNamespace from '@babel/types';
3
- import * as glimmer from '@glimmer/syntax';
4
- export type BabelTypes = typeof BabelTypesNamespace;
5
- interface ASTPluginEnvironment {
6
- locals: string[];
7
- }
8
- declare class HotAstProcessor {
9
- options: {
10
- itsStatic: boolean;
11
- };
12
- counter: number;
13
- meta: {
14
- usedImports: Set<string>;
15
- importVar: any;
16
- };
17
- usedImports: Set<any>;
18
- constructor();
19
- transform(env: ASTPluginEnvironment): {
20
- visitor: glimmer.NodeVisitor;
21
- };
22
- buildVisitor({ importVar, imports, usedImports }: {
23
- importVar: any;
24
- imports: any;
25
- usedImports: any;
26
- }): glimmer.NodeVisitor;
27
- replaceInAst(ast: glimmer.ASTv1.Template, importVar?: string, imports?: string[]): Set<unknown>;
28
- processAst(contents: string, importVar?: string, imports?: string[]): string;
29
- }
30
- export declare const hotAstProcessor: HotAstProcessor;
31
- export default function hotReplaceAst({ types: t }: {
32
- types: BabelTypes;
33
- }): PluginObj<import("@babel/core").PluginPass>;
34
- export {};
@@ -1,207 +0,0 @@
1
- import Service, { service } from '@ember/service';
2
- import { getOwner } from '@ember/owner';
3
- import Router from '@ember/routing/route';
4
- import Controller from '@ember/controller';
5
-
6
- function _initializerDefineProperty(target, property, descriptor, context) {
7
- if (!descriptor) return;
8
- Object.defineProperty(target, property, {
9
- enumerable: descriptor.enumerable,
10
- configurable: descriptor.configurable,
11
- writable: descriptor.writable,
12
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
13
- });
14
- }
15
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
16
- var desc = {};
17
- Object.keys(descriptor).forEach(function (key) {
18
- desc[key] = descriptor[key];
19
- });
20
- desc.enumerable = !!desc.enumerable;
21
- desc.configurable = !!desc.configurable;
22
- if ('value' in desc || desc.initializer) {
23
- desc.writable = true;
24
- }
25
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
26
- return decorator(target, property, desc) || desc;
27
- }, desc);
28
- if (context && desc.initializer !== void 0) {
29
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
30
- desc.initializer = undefined;
31
- }
32
- if (desc.initializer === void 0) {
33
- Object.defineProperty(target, property, desc);
34
- desc = null;
35
- }
36
- return desc;
37
- }
38
-
39
- var _dec, _class, _descriptor;
40
- const ChangeMap = new WeakMap();
41
- function getLatestChange(obj) {
42
- while (ChangeMap.has(obj)) {
43
- obj = ChangeMap.get(obj);
44
- }
45
- return obj;
46
- }
47
- let modulePrefix;
48
- let podModulePrefix;
49
- if (import.meta.hot) {
50
- const ModuleMap = new Map();
51
- window.emberHotReloadPlugin = {
52
- _accepting: 0,
53
- changed: {},
54
- subscribers: [],
55
- version: 1,
56
- moduleDepCallbacks: {},
57
- versionMap: {},
58
- clear(module) {
59
- this.moduleDepCallbacks[module.id] = {};
60
- },
61
- register(module, dep, callback) {
62
- dep = dep.replace(new RegExp(`^${modulePrefix}/`), './');
63
- this.moduleDepCallbacks[module.id][dep] = this.moduleDepCallbacks[module.id][dep] || [];
64
- this.moduleDepCallbacks[module.id][dep].push(callback);
65
- },
66
- loadNew(oldModule, newModule) {
67
- this.versionMap[newModule.id] = newModule.version;
68
- const entry = Object.values(requirejs.entries).find(module => module.module.exports.default === oldModule.exports.default);
69
- if (!entry) return;
70
- entry.module = {
71
- exports: newModule.exports
72
- };
73
- },
74
- __import(moduleUrl) {
75
- return import( /* @vite-ignore */moduleUrl);
76
- },
77
- async canAcceptNew(moduleUrl) {
78
- this._accepting += 1;
79
- const m = await this.__import(moduleUrl);
80
- const module = {
81
- exports: m,
82
- id: moduleUrl.split('?')[0]
83
- };
84
- this._accepting -= 1;
85
- if (this._accepting === 0) {
86
- setTimeout(() => this.notifyNew(), 0);
87
- }
88
- let ok = module.id.includes('/routes/') || module.id.includes('/routers/') || module.id.includes('/controllers/') || module.id.match(/controller\.(js|ts)$/) || module.id.match(/route\.(js|ts|gts)$/);
89
- if (!ok) {
90
- return false;
91
- }
92
- if (ModuleMap.get(module.id)) {
93
- this.changed[module.id] = {
94
- old: ModuleMap.get(module.id),
95
- new: module
96
- };
97
- }
98
- module.version = this.version;
99
- ModuleMap.set(module.id, module);
100
- return true;
101
- },
102
- notifyNew() {
103
- this.version += 1;
104
- Object.values(this.changed).forEach(change => {
105
- this.loadNew(change.old, change.new);
106
- this.subscribers.forEach(fn => fn(change.old, change.new));
107
- });
108
- this.changed = {};
109
- },
110
- subscribe(fn) {
111
- this.subscribers.push(fn);
112
- },
113
- unsubscribe(fn) {
114
- const idx = this.subscribers.indexOf(fn);
115
- if (idx >= 0) {
116
- this.subscribers.splice(idx, 1);
117
- }
118
- }
119
- };
120
- }
121
- let WebpackHotReloadService = (_dec = service(), (_class = class WebpackHotReloadService extends Service {
122
- constructor(...args) {
123
- super(...args);
124
- _initializerDefineProperty(this, "router", _descriptor, this);
125
- }
126
- init() {
127
- super.init();
128
- if (!window.emberHotReloadPlugin) return;
129
- modulePrefix = getOwner(this).application.modulePrefix;
130
- podModulePrefix = getOwner(this).application.podModulePrefix;
131
- if (import.meta.hot) {
132
- import.meta.hot.on('vite:beforeUpdate', options => {
133
- options.updates = options.updates.filter(u => !u.path.startsWith(`/assets/${modulePrefix}.js`));
134
- });
135
- }
136
- this.router._router;
137
- Object.defineProperty(this.router._router, '_routerMicrolib', {
138
- set(v) {
139
- const getRoute = v.getRoute;
140
- v.getRoute = function (name) {
141
- const route = getRoute.call(this, `${name}--hot-version--${window.emberHotReloadPlugin.version}`);
142
- route.fullRouteName = route.fullRouteName.replace(/--hot-version--.*$/, '');
143
- return route;
144
- };
145
- this.___routerMicrolib = v;
146
- },
147
- get() {
148
- return this.___routerMicrolib;
149
- }
150
- });
151
- this.container = getOwner(this)?.__container__;
152
- window.emberHotReloadPlugin.subscribe((oldModule, newModule) => {
153
- const types = ['route', 'controller', 'template', 'modifier', 'helper', 'component'];
154
- Object.keys(this.container.cache).forEach(k => {
155
- if (types.some(t => k.startsWith(`${t}:`))) {
156
- delete this.container.cache[k];
157
- }
158
- });
159
- Object.keys(this.container.factoryManagerCache).forEach(k => {
160
- if (types.some(t => k.startsWith(`${t}:`))) {
161
- delete this.container.factoryManagerCache[k];
162
- }
163
- });
164
- Object.keys(this.container.registry._resolveCache).forEach(k => {
165
- if (types.some(t => k.startsWith(`${t}:`))) {
166
- delete this.container.registry._resolveCache[k];
167
- }
168
- });
169
- Object.keys(this.container.validationCache).forEach(k => {
170
- if (types.some(t => k.startsWith(`${t}:`))) {
171
- delete this.container.validationCache[k];
172
- }
173
- });
174
- Object.keys(this.container.registry.registrations).forEach(k => {
175
- if (types.some(t => k.startsWith(`${t}:`))) {
176
- delete this.container.registry.registrations[k];
177
- }
178
- });
179
- if (oldModule.exports.default?.prototype && oldModule.exports.default.prototype instanceof Router) {
180
- this.router.refresh();
181
- }
182
- if (oldModule.exports.default?.prototype && oldModule.exports.default.prototype instanceof Controller) {
183
- this.router.refresh();
184
- }
185
- if (oldModule.id.startsWith('./templates/') && !oldModule.id.startsWith('./templates/components/')) {
186
- this.router.refresh();
187
- }
188
- if (oldModule.id.startsWith(`./${podModulePrefix}/`)) {
189
- this.router.refresh();
190
- }
191
- });
192
- }
193
- getLatestChange(obj) {
194
- return getLatestChange(obj);
195
- }
196
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "router", [_dec], {
197
- configurable: true,
198
- enumerable: true,
199
- writable: true,
200
- initializer: null
201
- })), _class));
202
- // this service using `Owner.lookup('service:hot-reload')`, as well
203
- // as to check when you pass the service name as an argument to the decorator,
204
- // like `@service('hot-reload') declare altName: HotReloadService;`.
205
-
206
- export { WebpackHotReloadService as default };
207
- //# sourceMappingURL=webpack-hot-reload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-hot-reload.js","sources":["../../src/services/webpack-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';\n\nconst ChangeMap = new WeakMap();\n\nfunction getLatestChange(obj) {\n while (ChangeMap.has(obj)) {\n obj = ChangeMap.get(obj);\n }\n return obj;\n}\n\nlet modulePrefix!: string;\nlet podModulePrefix!: string;\nif (import.meta.hot) {\n const ModuleMap = new Map();\n\n window.emberHotReloadPlugin = {\n _accepting: 0,\n changed: {},\n subscribers: [],\n version: 1,\n moduleDepCallbacks: {},\n versionMap: {},\n clear(module) {\n this.moduleDepCallbacks[module.id] = {};\n },\n register(module, dep, callback) {\n dep = dep.replace(new RegExp(`^${modulePrefix}/`), './');\n this.moduleDepCallbacks[module.id][dep] =\n this.moduleDepCallbacks[module.id][dep] || [];\n this.moduleDepCallbacks[module.id][dep].push(callback);\n },\n loadNew(oldModule, newModule) {\n this.versionMap[newModule.id] = newModule.version;\n const entry = Object.values(requirejs.entries).find(\n (module) => module.module.exports.default === oldModule.exports.default,\n );\n if (!entry) return;\n entry.module = {\n exports: newModule.exports,\n };\n },\n\n __import(moduleUrl) {\n return import(/* @vite-ignore */ moduleUrl);\n },\n\n async canAcceptNew(moduleUrl) {\n this._accepting += 1;\n const m = await this.__import(moduleUrl);\n const module = {\n exports: m,\n id: moduleUrl.split('?')[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.match(/controller\\.(js|ts)$/) ||\n module.id.match(/route\\.(js|ts|gts)$/);\n if (!ok) {\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 }\n module.version = this.version;\n ModuleMap.set(module.id, module);\n return true;\n },\n notifyNew() {\n this.version += 1;\n Object.values(this.changed).forEach((change) => {\n this.loadNew(change.old, change.new);\n this.subscribers.forEach((fn) => fn(change.old, change.new));\n });\n this.changed = {};\n },\n subscribe(fn) {\n this.subscribers.push(fn);\n },\n unsubscribe(fn) {\n const idx = this.subscribers.indexOf(fn);\n if (idx >= 0) {\n this.subscribers.splice(idx, 1);\n }\n },\n };\n}\n\nexport default class WebpackHotReloadService extends Service {\n declare container: any;\n @service() router!: RouterService;\n\n init() {\n super.init();\n if (!window.emberHotReloadPlugin) return;\n modulePrefix = getOwner(this)!.application.modulePrefix;\n podModulePrefix = getOwner(this)!.application.podModulePrefix;\n if (import.meta.hot) {\n import.meta.hot.on('vite:beforeUpdate', (options) => {\n options.updates = options.updates.filter(\n (u) => !u.path.startsWith(`/assets/${modulePrefix}.js`),\n );\n });\n }\n this.router._router;\n Object.defineProperty(this.router._router, '_routerMicrolib', {\n set(v) {\n const getRoute = v.getRoute;\n v.getRoute = function (name) {\n const route = getRoute.call(\n this,\n `${name}--hot-version--${window.emberHotReloadPlugin.version}`,\n );\n route.fullRouteName = route.fullRouteName.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)?.__container__;\n window.emberHotReloadPlugin.subscribe((oldModule, newModule) => {\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('./templates/') &&\n !oldModule.id.startsWith('./templates/components/')\n ) {\n this.router.refresh();\n }\n if (oldModule.id.startsWith(`./${podModulePrefix}/`)) {\n this.router.refresh();\n }\n });\n }\n getLatestChange(obj) {\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': WebpackHotReloadService;\n }\n}"],"names":["ChangeMap","WeakMap","getLatestChange","obj","has","get","modulePrefix","podModulePrefix","import","meta","hot","ModuleMap","Map","window","emberHotReloadPlugin","_accepting","changed","subscribers","version","moduleDepCallbacks","versionMap","clear","module","id","register","dep","callback","replace","RegExp","push","loadNew","oldModule","newModule","entry","Object","values","requirejs","entries","find","exports","default","__import","moduleUrl","canAcceptNew","m","split","setTimeout","notifyNew","ok","includes","match","old","new","set","forEach","change","fn","subscribe","unsubscribe","idx","indexOf","splice","WebpackHotReloadService","_dec","service","_class","Service","constructor","args","_initializerDefineProperty","_descriptor","init","getOwner","application","on","options","updates","filter","u","path","startsWith","router","_router","defineProperty","v","getRoute","name","route","call","fullRouteName","___routerMicrolib","container","__container__","types","keys","cache","k","some","t","factoryManagerCache","registry","_resolveCache","validationCache","registrations","prototype","Router","refresh","Controller","_applyDecoratedDescriptor","configurable","enumerable","writable","initializer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,SAAS,GAAG,IAAIC,OAAO,EAAE,CAAA;AAE/B,SAASC,eAAeA,CAACC,GAAG,EAAE;AAC5B,EAAA,OAAOH,SAAS,CAACI,GAAG,CAACD,GAAG,CAAC,EAAE;AACzBA,IAAAA,GAAG,GAAGH,SAAS,CAACK,GAAG,CAACF,GAAG,CAAC,CAAA;AAC1B,GAAA;AACA,EAAA,OAAOA,GAAG,CAAA;AACZ,CAAA;AAEA,IAAIG,YAAqB,CAAA;AACzB,IAAIC,eAAwB,CAAA;AAC5B,IAAIC,MAAM,CAACC,IAAI,CAACC,GAAG,EAAE;AACnB,EAAA,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE,CAAA;EAE3BC,MAAM,CAACC,oBAAoB,GAAG;AAC5BC,IAAAA,UAAU,EAAE,CAAC;IACbC,OAAO,EAAE,EAAE;AACXC,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,OAAO,EAAE,CAAC;IACVC,kBAAkB,EAAE,EAAE;IACtBC,UAAU,EAAE,EAAE;IACdC,KAAKA,CAACC,MAAM,EAAE;MACZ,IAAI,CAACH,kBAAkB,CAACG,MAAM,CAACC,EAAE,CAAC,GAAG,EAAE,CAAA;KACxC;AACDC,IAAAA,QAAQA,CAACF,MAAM,EAAEG,GAAG,EAAEC,QAAQ,EAAE;AAC9BD,MAAAA,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAIC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,cAAc,CAAC,IACvC,CAACjD,SAAS,CAACR,EAAE,CAACyD,UAAU,CAAC,yBAAyB,CAAC,EACnD;AACA,QAAA,IAAI,CAACC,MAAM,CAACyB,OAAO,EAAE,CAAA;AACvB,OAAA;MACA,IAAI3E,SAAS,CAACR,EAAE,CAACyD,UAAU,CAAE,CAAIzE,EAAAA,EAAAA,eAAgB,CAAE,CAAA,CAAA,CAAC,EAAE;AACpD,QAAA,IAAI,CAAC0E,MAAM,CAACyB,OAAO,EAAE,CAAA;AACvB,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;EACAxG,eAAeA,CAACC,GAAG,EAAE;IACnB,OAAOD,eAAe,CAACC,GAAG,CAAC,CAAA;AAC7B,GAAA;AACF,CAAC,GAAAmE,WAAA,GAAAsC,yBAAA,CAAA3C,MAAA,CAAAuC,SAAA,EAAA,QAAA,EAAA,CAAAzC,IAAA,CAAA,EAAA;EAAA8C,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,GAAA/C,MAAA,CAAA,EAAA;AAGD;AACA;AACA;;;;"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=template-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}