Skip to content

Commit f49a627

Browse files
committed
stop requesting mappings over the network
for some reason we're requesting the mappings.json file on every initial page load (and not cached in the shoebox). This is in the application afterModel hook so there is no chance that we will ever not make this request, so it's worth just backing the json into the JS bundle to save a request
1 parent a937223 commit f49a627

File tree

4 files changed

+106
-102
lines changed

4 files changed

+106
-102
lines changed

app/services/legacy-module-mappings.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import fetch from 'fetch';
21
import Service from '@ember/service';
32
import { tracked } from '@glimmer/tracking';
43

4+
import mappings from 'ember-rfc176-data/mappings.json';
5+
56
const LOCALNAME_CONVERSIONS = {
67
Object: 'EmberObject',
78
Array: 'EmberArray',
@@ -13,8 +14,6 @@ export default class LegacyModuleMappingsService extends Service {
1314

1415
async initMappings() {
1516
try {
16-
let response = await this.fetch();
17-
let mappings = await response.json();
1817
let newMappings = this.buildMappings(mappings);
1918
this.mappings = newMappings;
2019
} catch (e) {
@@ -32,10 +31,6 @@ export default class LegacyModuleMappingsService extends Service {
3231
});
3332
}
3433

35-
fetch() {
36-
return fetch('/assets/mappings.json');
37-
}
38-
3934
getModule(name, documentedModule) {
4035
if (!this.mappings) {
4136
return '';

ember-cli-build.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

33
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
4-
const Funnel = require('broccoli-funnel');
5-
const mergeTrees = require('broccoli-merge-trees');
64
const envIsProduction = process.env.EMBER_ENV === 'production';
75
const premberUrls = require('./prember-urls');
86
const nodeSass = require('node-sass');
@@ -57,12 +55,6 @@ module.exports = function (defaults) {
5755
},
5856
});
5957

60-
let mappingsTree = new Funnel('node_modules/ember-rfc176-data/', {
61-
srcDir: '/',
62-
include: ['mappings.json'],
63-
destDir: '/assets/',
64-
});
65-
6658
const { Webpack } = require('@embroider/webpack');
6759
const appTree = require('@embroider/compat').compatBuild(app, Webpack, {
6860
staticAddonTrees: true,
@@ -72,5 +64,5 @@ module.exports = function (defaults) {
7264
staticComponents: true,
7365
});
7466

75-
return mergeTrees([require('prember').prerender(app, appTree), mappingsTree]);
67+
return require('prember').prerender(app, appTree);
7668
};

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"bourbon-neat": "^1.9.1",
6262
"broccoli-asset-rev": "^3.0.0",
6363
"broccoli-funnel": "^2.0.1",
64-
"broccoli-merge-trees": "^2.0.0",
6564
"ember-a11y-testing": "^0.5.4",
6665
"ember-anchor": "^1.0.3",
6766
"ember-auto-import": "^2.7.2",

0 commit comments

Comments
 (0)