Skip to content
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

Vite #920

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Vite #920

Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { inject as service } from '@ember/service';
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import fetch from 'fetch';
import { pluralize } from 'ember-inflector';
import { isBlank } from '@ember/utils';

Expand Down
10 changes: 9 additions & 1 deletion app/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Application from '@ember/application';
import compatModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'ember-api-docs/config/environment';
import config from './config/environment';

import './deprecation-workflow';
let d = window.define;

for (const [name, module] of Object.entries(compatModules)) {
d(name, function () {
return module;
});
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
3 changes: 3 additions & 0 deletions app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from '@embroider/config-meta-loader';

export default loadConfigFromMeta('ember-api-docs');
26 changes: 0 additions & 26 deletions app/index.html

This file was deleted.

1 change: 1 addition & 0 deletions app/instance-initializers/ember-meta-store.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { isPresent } from '@ember/utils';

export function initialize(appInstance) {
return;
const metaStore = appInstance.lookup('service:meta-store');

Check failure on line 5 in app/instance-initializers/ember-meta-store.js

View workflow job for this annotation

GitHub Actions / Lint files

Unreachable code
const fastBootService = appInstance.lookup('service:fastboot');

const shoebox = fastBootService.get('shoebox');
Expand Down
4 changes: 4 additions & 0 deletions app/services/fastboot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Service from '@ember/service';

export default class FakeFastbootService extends Service {

Check failure on line 3 in app/services/fastboot.js

View workflow job for this annotation

GitHub Actions / Lint files

Delete `⏎`
}
4 changes: 2 additions & 2 deletions app/utils/create-excerpt.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sanitizeHtml from 'sanitize-html';
import HtmlSanitizer from '@jitbit/htmlsanitizer';

export default function createExcerpt(string, maxLength = 300) {
// Stop at first code example
string = string.split('<table')[0];

let excerpt = sanitizeHtml(string, { allowedTags: [] })
let excerpt = HtmlSanitizer.SanitizeHtml(string, { allowedTags: [] })
// Remove tabs and line breaks
.replace(/\t/g, '')
.replace(/\n/g, ' ')
Expand Down
17 changes: 17 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let config;

// TODO - remove this once we have the better solution for injecting stage1 babel config into a real config file
// this is needed because there are things (like ember-composible-helpers) that are now finding our babel config during
// their stage1 build and historically they will never (99% of the time) have found any babel config.
// we might need to keep something like this so that prebuild will never apply babel configs during stage1 i.e. a util
// function that wraps your whole babel config
if (
process.env.EMBROIDER_PREBUILD ||
process.env.EMBROIDER_TEST_SETUP_FORCE === 'classic'
) {
config = {};
} else {
config = require('./node_modules/.embroider/_babel_config_');
}

module.exports = config;
15 changes: 2 additions & 13 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const envIsProduction = process.env.EMBER_ENV === 'production';
const premberUrls = require('./prember-urls');

Check failure on line 5 in ember-cli-build.js

View workflow job for this annotation

GitHub Actions / Lint files

'premberUrls' is assigned a value but never used
const nodeSass = require('node-sass');
const { maybeEmbroider } = require('@embroider/test-setup');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {
prember: {
urls: premberUrls(),
},
fingerprint: {
extensions: [
'js',
Expand Down Expand Up @@ -55,14 +53,5 @@
},
});

const { Webpack } = require('@embroider/webpack');
const appTree = require('@embroider/compat').compatBuild(app, Webpack, {
staticAddonTrees: true,
staticAddonTestSupportTrees: true,
staticHelpers: true,
staticModifiers: true,
staticComponents: true,
});

return require('prember').prerender(app, appTree);
return maybeEmbroider(app);
};
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AppTemplate</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="/@embroider/core/vendor.css">
<link integrity="" rel="stylesheet" href="/assets/ember-api-docs.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600" rel="stylesheet">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="/@embroider/core/vendor.js"></script>
<script type="module">
import Application from './app/app';
import environment from './app/config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
</html>
85 changes: 48 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
{
"name": "ember-api-docs",
"version": "0.1.0",
"version": "0.0.0",
"private": true,
"description": "Small description for ember-api-docs goes here",
"repository": {
"type": "git",
"url": "https://github.com/ember-learn/ember-api-docs.git"
},
"repository": "",
"license": "MIT",
"author": "Ember Learning Team and contributors",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"clone": "rm -rf ember-api-docs-data && git clone --depth=1 https://github.com/ember-learn/ember-api-docs-data.git",
"build": "ember build --environment=production",
"build": "vite build",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"start:local": "API_HOST=http://localhost:5050 ember serve",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"start": "vite",
"test:browserstack": "node run-tests.js",
"test:ember": "ember test"
},
"devDependencies": {
"@ember-data/adapter": "~3.28.0",
"@ember-data/model": "~3.28.0",
"@ember-data/serializer": "~3.28.0",
"@ember-decorators/component": "^6.1.1",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@embroider/compat": "^3.4.3",
"@embroider/core": "^3.4.3",
"@embroider/compat": "3.6.2-unstable.a691d39",
"@embroider/config-meta-loader": "0.0.1-unstable.a691d39",
"@embroider/core": "3.4.16-unstable.a691d39",
"@embroider/test-setup": "4.0.1-unstable.a691d39",
"@embroider/vite": "0.2.1-unstable.a691d39",
"@embroider/webpack": "^3.2.1",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@glint/core": "^0.9.7",
"@glint/environment-ember-loose": "^0.9.7",
"@jitbit/htmlsanitizer": "^2.0.2",
"@percy/cli": "^1.28.7",
"@percy/ember": "^4.2.0",
"@percy/sdk-utils": "1.28.7",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^1.0.1",
"@types/ember": "^4.0.2",
"@types/ember-qunit": "^5.0.2",
Expand All @@ -59,42 +66,34 @@
"bootstrap": "^4.6.2",
"bourbon": "5.1.0",
"bourbon-neat": "^1.9.1",
"broccoli-asset-rev": "^3.0.0",
"broccoli-funnel": "^2.0.1",
"ember-a11y-testing": "^5.2.1",
"ember-anchor": "^1.0.3",
"ember-auto-import": "^2.7.2",
"ember-cli": "~3.28.6",
"ember-cli-app-version": "^5.0.0",
"ember-cli-autoprefixer": "^1.0.0",
"ember-cli-babel": "^7.26.10",
"ember-cli-bourbon": "^2.0.1",
"ember-cli-browserstack": "^1.0.1",
"ember-cli-clipboard": "^1.1.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-deploy": "^1.0.1",
"ember-cli-deploy-build": "^1.1.0",
"ember-cli-deploy-gzip": "^1.0.0",
"ember-cli-deprecation-workflow": "^3.0.1",
"ember-cli-document-title-northm": "^1.0.3",
"ember-cli-fastboot": "^4.1.5",
"ember-cli-htmlbars": "^6.1.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-meta-tags": "^7.0.0",
"ember-cli-sass": "^10.0.1",
"ember-cli-showdown": "^9.0.1",
"ember-cli-terser": "^4.0.2",
"ember-composable-helpers": "^3.1.1",
"ember-concurrency": "^2.3.7",
"ember-data": "~3.28.6",
"ember-data-fastboot": "https://github.com/cardstack/ember-data-fastboot#6e6fb8bbf0b405ae174160cc1e4833c5582f68cd",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.1.1",
"ember-inflector": "^4.0.3",
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-metrics": "^1.5.2",
"ember-page-title": "^6.2.2",
"ember-page-title": "^8.2.3",
"ember-power-select": "^7.2.0",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
Expand Down Expand Up @@ -132,44 +131,56 @@
"node-sass": "^9.0.0",
"normalize.css": "^8.0.1",
"npm-run-all": "^4.1.5",
"prember": "^2.1.0",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
"qunit-dom": "^1.6.0",
"sanitize-html": "^2.3.2",
"semver": "^7.5.4",
"semver-compare": "^1.0.0",
"showdown": "^2.1.0",
"sinon": "7.5.0",
"spawndamnit": "2.0.0",
"testem": "^3.10.0",
"typescript": "^4.9.3",
"vite": "^5.4.3",
"webpack": "^5.90.0"
},
"packageManager": "pnpm@9.5.0",
"engines": {
"node": "16.* || 18.* || 20.*",
"npm": "7 || 8 || >= 9"
},
"cacheDirectories": [
"node_modules"
],
"pnpm": {
"overrides": {
"ember-get-config": "github:mansona/ember-get-config#config-meta-loader",
"ember-truth-helpers": "^4.0.0",
"node-sass": "^9.0.0"
},
"patchedDependencies": {
"@ember-data/store@3.28.13": "patches/@ember-data__store@3.28.13.patch",
"ember-source@3.28.12": "patches/ember-source@3.28.12.patch",
"postcss@8.4.45": "patches/postcss@8.4.45.patch",
"@jitbit/htmlsanitizer@2.0.2": "patches/@jitbit__htmlsanitizer@2.0.2.patch"
}
},
"ember": {
"edition": "octane"
},
"fastbootDependencies": [
"algoliasearch",
"node-fetch",
"abortcontroller-polyfill",
"abortcontroller-polyfill/dist/cjs-ponyfill"
],
"ember-addon": {
"paths": [
"lib/api-docs-data"
]
],
"type": "app",
"version": 2
},
"pnpm": {
"overrides": {
"node-sass": "^9.0.0",
"ember-truth-helpers": "^4.0.0"
}
"exports": {
"./tests/*": "./tests/*",
"./*": "./app/*"
},
"packageManager": "pnpm@9.5.0"
"fastbootDependencies": [
"algoliasearch",
"node-fetch",
"abortcontroller-polyfill",
"abortcontroller-polyfill/dist/cjs-ponyfill"
]
}
52 changes: 52 additions & 0 deletions patches/@ember-data__store@3.28.13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/addon/-private/system/backburner.js b/addon/-private/system/backburner.js
index 6aa30ddf1a6c5151f68ec7a1e2b30e34fae64716..28cc2bad6367c2a41a0b589c7e788bf6bcb19ec5 100644
--- a/addon/-private/system/backburner.js
+++ b/addon/-private/system/backburner.js
@@ -2,7 +2,6 @@
@module @ember-data/store
*/

-import { registerWaiter } from '@ember/test';
import { DEBUG } from '@glimmer/env';
import Ember from 'ember';

@@ -17,9 +16,7 @@ import Ember from 'ember';
const backburner = new Ember._Backburner(['coalesce', 'sync', 'notify']);

if (DEBUG) {
- registerWaiter(() => {
- return !backburner.currentInstance && !backburner.hasTimers();
- });
+
}

export default backburner;
diff --git a/addon/-private/system/core-store.ts b/addon/-private/system/core-store.ts
index f7eb8b96bd70abb8b8ebf5beb8a755853e38adc6..319c72e5beb6474a3111b1c5be9b4537797d5b27 100644
--- a/addon/-private/system/core-store.ts
+++ b/addon/-private/system/core-store.ts
@@ -8,7 +8,6 @@ import { computed, defineProperty, get, set } from '@ember/object';
import { assign } from '@ember/polyfills';
import { _backburner as emberBackburner } from '@ember/runloop';
import Service from '@ember/service';
-import { registerWaiter, unregisterWaiter } from '@ember/test';
import { isNone, isPresent, typeOf } from '@ember/utils';
import { DEBUG } from '@glimmer/env';
import Ember from 'ember';
@@ -414,8 +413,6 @@ abstract class CoreStore extends Service {

return shouldTrack !== true || isSettled;
};
-
- registerWaiter(this.__asyncWaiter);
}
}

@@ -3690,7 +3687,6 @@ abstract class CoreStore extends Service {
this.unloadAll();

if (DEBUG) {
- unregisterWaiter(this.__asyncWaiter);
let shouldTrack = this.shouldTrackAsyncRequests;
let tracked = this._trackedAsyncRequests;
let isSettled = tracked.length === 0;
Loading
Loading