Skip to content

Commit

Permalink
fix boot
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Pircher <[email protected]>
  • Loading branch information
patricklx committed Mar 18, 2024
1 parent 047962d commit c6387af
Show file tree
Hide file tree
Showing 14 changed files with 1,950 additions and 1,120 deletions.
2 changes: 0 additions & 2 deletions carbon-components-ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"ember-cli-sass": "^11.0.1",
"ember-composable-helpers": "^5.0.0",
"ember-concurrency": "^3.0.0",
"ember-data": "^4.12.0",
"ember-get-config": "^2.1.1",
"ember-hbs-imports": "^0.5.39",
"ember-in-element-polyfill": "^1.0.1",
Expand Down Expand Up @@ -183,7 +182,6 @@
"sass-loader": "^13.3.2",
"typescript": "^5.0.4",
"typescript-plugin-css-modules": "^5.0.1",
"webpack": "^5.87.0",
"yui": "^3.18.1"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions carbon-components-ember/src/components/modal.gts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { guidFor } from '@ember/object/internals';
import { tracked } from '@glimmer/tracking';
import { cached, tracked } from '@glimmer/tracking';
import { defaultArgs, autoComputed } from '/utils/decorators.ts';

/** @documenter yuidoc */
Expand Down Expand Up @@ -35,7 +35,7 @@ export default class Modal extends Component<ModalComponentSignature> {
onClose: null,
});

@autoComputed()
@cached
get guid() {
return guidFor(this);
}
Expand Down
4 changes: 2 additions & 2 deletions carbon-components-ember/src/components/search-input.gts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { guidFor } from '@ember/object/internals';
import { tracked } from '@glimmer/tracking';
import { cached, tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency';
import { timeout, TaskInstance } from 'ember-concurrency';
import { autoComputed } from '/utils/decorators.ts';
Expand Down Expand Up @@ -34,7 +34,7 @@ export default class SearchComponent extends Component<SearchComponentSignature>
return !!this.value;
}

@autoComputed()
@cached
get guid() {
return guidFor(this);
}
Expand Down
4 changes: 2 additions & 2 deletions carbon-components-ember/src/components/tile.gts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { cached, tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { guidFor } from '@ember/object/internals';
import { autoComputed } from '/utils/decorators.ts';
Expand Down Expand Up @@ -31,7 +31,7 @@ export default class TileComponent extends Component<TileComponentSignature> {
@tracked selected = null;
@tracked expanded: boolean = false;

@autoComputed()
@cached
get guid() {
return guidFor(this);
}
Expand Down
9 changes: 0 additions & 9 deletions carbon-components-ember/src/utils/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,3 @@ export function defaultArgs(target, name, descriptor?) {

return descriptor;
}


export function autoComputed() {
// @ts-ignore
// eslint-disable-next-line no-undef
const dec = (instance, key, desc) => require('@ember/-internals/metal').autoComputed()(instance, key, desc);
// @ts-ignore
return Ember.autoComputed || dec;
}
4 changes: 3 additions & 1 deletion doc-app/app/app.js → doc-app/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'doc-app/config/environment';
import { RSVP } from '@ember/-internals/runtime';

define('doc-app/config/environment', () => config);
window.define('doc-app/config/environment', () => config);
window.define('rsvp', () => RSVP);

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
2 changes: 0 additions & 2 deletions doc-app/app/pods/docs/components/ui-shell/route.gts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Input from 'carbon-components-ember/components/form-input';
import Demo from 'ember-cli-addon-docs/components/docs-demo';
import set from 'carbon-components-ember/helpers/set';
import eq from 'ember-truth-helpers/helpers/equal';
import UiShell from 'carbon-components-ember/components/ui-shell';
import Icon from 'carbon-components-ember/components/icon';
import Menu from 'carbon-components-ember/components/menu';
Expand Down
9 changes: 8 additions & 1 deletion doc-app/app/pods/index/route.gts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Hero from 'ember-cli-addon-docs/components/docs-hero';
import Demo from 'ember-cli-addon-docs/components/docs-demo';
import Component from '@glimmer/component';
import Route from '@ember/routing/route';
import { service } from '@ember/service';
import RouteTemplate from 'ember-route-template/route';

class RouteComponent extends Component {

Expand Down Expand Up @@ -33,4 +35,9 @@ function RoutableComponent(Component) {
}
}

export default RouteTemplate(RouteComponent);
export default class extends RouteTemplate(RouteComponent) {
@service() router;
redirect() {
this.router.replaceWith('docs.getting-started.installation');
}
}
10 changes: 0 additions & 10 deletions doc-app/app/pods/index/route.js

This file was deleted.

1 change: 1 addition & 0 deletions doc-app/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module.exports = function (environment) {
const ENV = {
modulePrefix: 'doc-app',
podModulePrefix: 'doc-app/pods',
environment,
rootURL: '/',
locationType: 'history',
Expand Down
70 changes: 0 additions & 70 deletions doc-app/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,6 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { resolve } = require('path');
const { Resolver } = require('@embroider/core');

const componentTemplateCandidates =
Resolver.prototype.componentTemplateCandidates;
Resolver.prototype.componentTemplateCandidates = function () {
return [...componentTemplateCandidates.call(this)].concat([
{ prefix: '/', suffix: '/template' },
]);
};

const componentJSCandidates = Resolver.prototype.componentJSCandidates;
Resolver.prototype.componentJSCandidates = function () {
const extensions = ['.js', '.ts', '.gjs', '.gts'];
const result = [...componentJSCandidates.call(this)];
for (const ext of extensions) {
result.push(
...[
{ prefix: '/', suffix: ext },
{ prefix: '/', suffix: `/index${ext}` },
{ prefix: '/', suffix: `/component${ext}` },
]
);
}
return result;
};

const parseGlobalPath = Resolver.prototype.parseGlobalPath;
Resolver.prototype.parseGlobalPath = function (path, inEngine) {
if (path.includes('__hbs__import_')) {
const parts = path.replace('__hbs__import_', '').split('/');
let packageName = parts[0].startsWith('@')
? parts.slice(0, 2).join('/')
: parts[0];
try {
// packageName = this.packageCache.resolve(packageName, inEngine).root;
} catch (e) {
//
}
const memberName = parts.join('/').replace(packageName + '/', '');
return {
packageName,
memberName,
from: resolve(inEngine.root, 'package.json'),
};
}
return parseGlobalPath.call(this, path, inEngine);
};

const resolveHelper = Resolver.prototype.resolveHelper;
Resolver.prototype.resolveHelper = function (path, inEngine, request) {
if (path.includes('__hbs__import_')) {
let target = this.parseGlobalPath(path, inEngine);
return request
.alias(`${target.packageName}/${target.memberName}`)
.rehome((0, resolve)(inEngine.root, 'package.json'));
}
return resolveHelper.call(this, path, inEngine, request);
};

const resolveModifier = Resolver.prototype.resolveModifier;
Resolver.prototype.resolveModifier = function (path, inEngine, request) {
if (path.includes('__hbs__import_')) {
let target = this.parseGlobalPath(path, inEngine);
return request
.alias(`${target.packageName}/${target.memberName}`)
.rehome((0, resolve)(inEngine.root, 'package.json'));
}
return resolveModifier.call(this, path, inEngine, request);
};

module.exports = function (defaults) {
let app = new EmberApp(defaults, {
Expand Down
15 changes: 7 additions & 8 deletions doc-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.0",
"@embroider/compat": "^3.4.6-unstable.6d64eff",
"@embroider/core": "^3.4.6-unstable.6d64eff",
"@embroider/compat": "^3.4.6",
"@embroider/core": "^3.4.6",
"@embroider/test-setup": "^3.0.1",
"@embroider/vite": "^0.2.1-unstable.6d64eff",
"@embroider/webpack": "^3.2.3-unstable.6d64eff",
"@embroider/vite": "^0.2.0",
"@embroider/webpack": "^3.2.2",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"broccoli-asset-rev": "^3.0.0",
"carbon-components-ember": "workspace:*",
"concurrently": "^8.2.0",
"ember-auto-import": "^2.7.2",
"ember-cli": "~5.1.0",
"ember-cli": "~5.7.0",
"ember-cli-addon-docs": "^7.0.1",
"ember-cli-addon-docs-yuidoc": "^1.1.0",
"ember-svg-jar": "^2.4.9",
Expand All @@ -53,7 +52,7 @@
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-data": "~5.1.0",
"ember-data": "~5.3.3",
"ember-hbs-imports": "^1.0.5",
"ember-load-initializers": "^2.1.2",
"ember-modifier": "^4.1.0",
Expand All @@ -80,7 +79,7 @@
"stylelint-config-standard": "^33.0.0",
"stylelint-prettier": "^3.0.0",
"tracked-built-ins": "^3.1.1",
"webpack": "^5.88.1",
"webpack": "^5.90.3",
"ember-template-imports": "^4.1.0",
"ember-route-template": "https://github.com/patricklx/ember-route-template/releases/download/dist/ember-route-template-1.0.3-alpha1.tgz"
},
Expand Down
Loading

0 comments on commit c6387af

Please sign in to comment.