Skip to content

Merge main into website redesign #926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
mansona committed Jul 23, 2024
commit 7438dbcc25116a80a715c515ed50fa92634fa25d
20 changes: 7 additions & 13 deletions app/routes/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ export default class ClassRoute extends Route {
legacyModuleMappings;

model(params) {
return this.legacyModuleMappings
.fetch()
.then((response) => response.json())
.then((mappings) => {
let ret = {
mappings: this.legacyModuleMappings.buildMappings(mappings),
className: params['class'].substr(
0,
params['class'].lastIndexOf('.')
),
};
return ret;
});
let ret = {
mappings: this.legacyModuleMappings.buildMappings(
this.legacyModuleMappings.legacyMappings
),
className: params['class'].substr(0, params['class'].lastIndexOf('.')),
};
return ret;
}

redirect(model) {
Expand Down
18 changes: 6 additions & 12 deletions app/routes/data-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ export default class DataClassRoute extends Route {
legacyModuleMappings;

model(params) {
return this.legacyModuleMappings
.fetch()
.then((response) => response.json())
.then((mappings) => {
return {
mappings: this.legacyModuleMappings.buildMappings(mappings),
className: params['class'].substr(
0,
params['class'].lastIndexOf('.')
),
};
});
return {
mappings: this.legacyModuleMappings.buildMappings(
this.legacyModuleMappings.legacyMappings
),
className: params['class'].substr(0, params['class'].lastIndexOf('.')),
};
}

redirect(model) {
Expand Down
15 changes: 6 additions & 9 deletions app/routes/data-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ export default class DataModuleRoute extends Route {
legacyModuleMappings;

model(params) {
return this.legacyModuleMappings
.fetch()
.then((response) => response.json())
.then((mappings) => {
return {
moduleName: params.module.substr(0, params.module.lastIndexOf('.')),
mappings: this.legacyModuleMappings.buildMappings(mappings),
};
});
return {
moduleName: params.module.substr(0, params.module.lastIndexOf('.')),
mappings: this.legacyModuleMappings.buildMappings(
this.legacyModuleMappings.legacyMappings
),
};
}

redirect(model) {
Expand Down
15 changes: 6 additions & 9 deletions app/routes/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ export default class ModuleRoute extends Route {
legacyModuleMappings;

model(params) {
return this.legacyModuleMappings
.fetch()
.then((response) => response.json())
.then((mappings) => {
return {
moduleName: params.module.substr(0, params.module.lastIndexOf('.')),
mappings: this.legacyModuleMappings.buildMappings(mappings),
};
});
return {
moduleName: params.module.substr(0, params.module.lastIndexOf('.')),
mappings: this.legacyModuleMappings.buildMappings(
this.legacyModuleMappings.legacyMappings
),
};
}

redirect(model) {
Expand Down
12 changes: 4 additions & 8 deletions app/services/legacy-module-mappings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fetch from 'fetch';
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';

import legacyMappings from 'ember-rfc176-data/mappings.json';

const LOCALNAME_CONVERSIONS = {
Object: 'EmberObject',
Array: 'EmberArray',
Expand All @@ -10,12 +11,11 @@ const LOCALNAME_CONVERSIONS = {

export default class LegacyModuleMappingsService extends Service {
@tracked mappings;
legacyMappings = legacyMappings;

async initMappings() {
try {
let response = await this.fetch();
let mappings = await response.json();
let newMappings = this.buildMappings(mappings);
let newMappings = this.buildMappings(legacyMappings);
this.mappings = newMappings;
} catch (e) {
this.mappings = [];
Expand All @@ -32,10 +32,6 @@ export default class LegacyModuleMappingsService extends Service {
});
}

fetch() {
return fetch('/assets/mappings.json');
}

getModule(name, documentedModule) {
if (!this.mappings) {
return '';
Expand Down
10 changes: 1 addition & 9 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const envIsProduction = process.env.EMBER_ENV === 'production';
const premberUrls = require('./prember-urls');
const nodeSass = require('node-sass');
Expand Down Expand Up @@ -57,12 +55,6 @@ module.exports = function (defaults) {
},
});

let mappingsTree = new Funnel('node_modules/ember-rfc176-data/', {
srcDir: '/',
include: ['mappings.json'],
destDir: '/assets/',
});

const { Webpack } = require('@embroider/webpack');
const appTree = require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTrees: true,
Expand All @@ -72,5 +64,5 @@ module.exports = function (defaults) {
staticComponents: true,
});

return mergeTrees([require('prember').prerender(app, appTree), mappingsTree]);
return require('prember').prerender(app, appTree);
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"bourbon-neat": "^1.9.1",
"broccoli-asset-rev": "^3.0.0",
"broccoli-funnel": "^2.0.1",
"broccoli-merge-trees": "^2.0.0",
"ember-a11y-testing": "^5.2.1",
"ember-anchor": "^1.0.3",
"ember-auto-import": "^2.7.2",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.