Skip to content
Draft
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
22 changes: 9 additions & 13 deletions packages/base/field-component.gts
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,14 @@ export class CardContextConsumer extends Component<CardContextConsumerSignature>
};
}

<template>
{{yield this.context}}
</template>
<template>{{yield this.context}}</template>
}

export class CardCrudFunctionsConsumer extends Component<CardCrudFunctionsConsumerSignature> {
@consume(CardCrudFunctionsContextName)
declare cardCrudFunctions: CardCrudFunctions;

<template>
{{yield this.cardCrudFunctions}}
</template>
<template>{{yield this.cardCrudFunctions}}</template>
}

interface DefaultFormatConsumerSignature {
Expand All @@ -113,9 +109,7 @@ export class DefaultFormatsConsumer extends Component<DefaultFormatConsumerSigna
return this.defaultFormats ?? { cardDef: 'isolated', fieldDef: 'embedded' };
}

<template>
{{yield this.effectiveDefaultFormats}}
</template>
<template>{{yield this.effectiveDefaultFormats}}</template>
}

interface DefaultFormatsProviderSignature {
Expand All @@ -137,9 +131,7 @@ interface PermissionsConsumerSignature {
export class PermissionsConsumer extends Component<PermissionsConsumerSignature> {
@consume(PermissionsContextName) declare permissions: Permissions | undefined;

<template>
{{yield this.permissions}}
</template>
<template>{{yield this.permissions}}</template>
}

const componentCache = initSharedState(
Expand Down Expand Up @@ -527,7 +519,11 @@ function getFields(card: typeof CardDef): {
}
return [[maybeFieldName, maybeField]];
});
fields = { ...fields, ...Object.fromEntries(currentFields) };
fields = Object.assign(
Object.create(null),
fields,
Object.fromEntries(currentFields),
);
obj = Reflect.getPrototypeOf(obj);
}
return fields;
Expand Down
6 changes: 5 additions & 1 deletion packages/base/field-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ export function getFields(
}
return [[maybeFieldName, maybeField]];
});
fields = { ...fields, ...Object.fromEntries(currentFields) };
fields = Object.assign(
Object.create(null),
fields,
Object.fromEntries(currentFields),
);
obj = Reflect.getPrototypeOf(obj);
}
return fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!

import '@glint/environment-ember-loose';
import 'ember-source/types/stable';
import 'ember-source/types';

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';

export {};
6 changes: 4 additions & 2 deletions packages/boxel-ui/test-app/tests/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import config from 'test-app/config/environment';
import * as QUnit from 'qunit';
import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';
import { loadTests } from 'ember-qunit/test-loader';
import { start, setupEmberOnerrorValidation } from 'ember-qunit';
import {
setRunOptions,
setupConsoleLogger,
Expand All @@ -23,5 +24,6 @@ setRunOptions({
},
});
setupConsoleLogger();

setupEmberOnerrorValidation();
loadTests();
start();
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';

export {};
29 changes: 28 additions & 1 deletion packages/host/app/deprecation-workflow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';

setupDeprecationWorkflow();
setupDeprecationWorkflow({
workflow: [
{
handler: 'silence',
matchId: 'importing-inject-from-ember-service',
},
{
handler: 'silence',
matchId: 'deprecate-import--set-classic-decorator-from-ember',
},
{
handler: 'silence',
matchId: 'deprecate-import-view-utils-from-ember',
},
{
handler: 'silence',
matchId: 'deprecate-import-env-from-ember',
},
{
handler: 'silence',
matchId: 'deprecate-import-onerror-from-ember',
},
{
handler: 'silence',
matchId: 'deprecate-import-libraries-from-ember',
},
],
});
11 changes: 10 additions & 1 deletion packages/host/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
<div id="ember-basic-dropdown-wormhole"></div>
{{content-for "body"}}

<script>
globalThis.process = {
env: {},
version: '',
cwd() {
return '/';
},
};
</script>
<script type="module">
import * as ContentTag from '{{rootURL}}assets/content-tag/standalone.js';
globalThis.ContentTagGlobal = ContentTag;
Expand All @@ -45,4 +54,4 @@
{{content-for "body-footer"}}
</body>

</html>
</html>
10 changes: 3 additions & 7 deletions packages/host/app/lib/html-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { setComponentManager } from '@ember/component';
import { capabilities } from '@ember/component';
import { setComponentTemplate } from '@ember/component';

import templateOnly from '@ember/component/template-only';
import { htmlSafe, type SafeString } from '@ember/template';
import { precompileTemplate } from '@ember/template-compilation';

import { modifier } from 'ember-modifier';
import { template } from '@ember/template-compiler/runtime';

import { compiler } from '@cardstack/runtime-common/etc';
import { modifier } from 'ember-modifier';

import type { ComponentLike } from '@glint/template';

Expand Down Expand Up @@ -72,10 +71,7 @@ export function htmlComponent(
if (cache.has(source)) {
component = cache.get(source)!;
} else {
component = setComponentTemplate(
compiler.compile(source, { strictMode: true }),
templateOnly(),
) as TopElement;
component = template(source) as TopElement;
cache.set(source, component);
}

Expand Down
31 changes: 9 additions & 22 deletions packages/host/app/lib/isolated-render.gts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type Owner from '@ember/owner';
import { createConstRef } from '@glimmer/reference';
// @ts-expect-error
import { renderMain, inTransaction } from '@glimmer/runtime';
// @ts-expect-error
import { resetTracking } from '@glimmer/validator';

import { CardError } from '@cardstack/runtime-common/error';

Expand Down Expand Up @@ -33,40 +35,25 @@ export function render(
// clear any previous render work
removeChildren(element);

let { _runtime, _context, _owner, _builder } = owner.lookup(
'renderer:-dom',
) as any;
let {
state: { owner: _owner, builder: _builder, context: _context },
} = owner.lookup('renderer:-dom') as any;
let self = createConstRef({}, 'this');
let layout = (getComponentTemplate as any)(root)(_owner).asLayout();

let iterator = renderMain(
_runtime,
_context,
_owner,
self,
_builder(_runtime.env, { element }),
_builder(_context.env, { element }),
layout,
);
let vm = (iterator as any).vm;

try {
inTransaction(_runtime.env, () => vm._execute());
inTransaction(_context.env, () => vm._execute());
} catch (err: any) {
// This is to compensate for the commitCacheGroup op code that is not called because
// of the error being thrown here. we do this so we can keep the TRANSACTION_STACK
// balanced (which would otherwise cause consumed tags to leak into subsequent frames).
// I'm not adding this to a "finally" because when there is no error, the VM will
// process an op code that will do this organically. It's only when there is an error
// that we need to step in and do this by hand. Within the vm[STACKS] is a the stack
// for the cache group. We need to call a commit for each item in this stack.
let vmSymbols = Object.fromEntries(
Object.getOwnPropertySymbols(vm).map((s) => [s.toString(), s]),
);
let stacks = vm[vmSymbols['Symbol(STACKS)']];
let stackSize = stacks.cache.stack.length;
for (let i = 0; i < stackSize; i++) {
vm.commitCacheGroup();
}

resetTracking();
let error = new CardError(
`Encountered error rendering HTML for card: ${err.message}`,
);
Expand Down
6 changes: 3 additions & 3 deletions packages/host/app/lib/matrix-classes/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ export class Message implements RoomMessageInterface {
@tracked _isCanceled?: boolean;
@tracked hasContinuation?: boolean;
@tracked continuedInMessage?: Message | null;
continuationOf?: string | null;
@tracked continuationOf?: string | null;

attachedCardIds?: string[] | null;
attachedFiles?: FileDef[];
attachedCardsAsFiles?: FileDef[];
attachedSkillCardIds?: string[] | null;
index?: number;
transactionId?: string | null;
errorMessage?: string;
@tracked errorMessage?: string;
clientGeneratedId?: string;
isDebugMessage?: boolean;
isCodePatchCorrectness?: boolean;

author: RoomMember;
status: EventStatus | null;
_updated: Date;
@tracked _updated: Date;
eventId: string;
roomId: string;
agentId?: string;
Expand Down
10 changes: 9 additions & 1 deletion packages/host/app/resources/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,15 @@ export class RoomResource extends Resource<Args> {
let effectiveEventId = this.getEffectiveEventId(event);
event = this.getAggregatedReplacement(event);

let message = this._messageCache.get(effectiveEventId);
let clientGeneratedId =
'clientGeneratedId' in event.content
? event.content.clientGeneratedId
: undefined;
let message =
this._messageCache.get(effectiveEventId) ??
(clientGeneratedId
? this._messageCache.get(clientGeneratedId)
: undefined);
if (!message?.isStreamingOfEventFinished) {
let author = this.upsertRoomMember({
roomId,
Expand Down
3 changes: 0 additions & 3 deletions packages/host/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ module.exports = function (defaults) {
plugins: [
new GlimmerScopedCSSWebpackPlugin(),
new MonacoWebpackPlugin(),
new webpack.ProvidePlugin({
process: 'process',
}),
new webpack.IgnorePlugin({
resourceRegExp: /^https:\/\/cardstack\.com\/base/,
}),
Expand Down
14 changes: 7 additions & 7 deletions packages/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"@cardstack/runtime-common": "workspace:*",
"@cardstack/view-transitions": "catalog:",
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.1",
"@ember/string": "^4.0.0",
"@ember/test-helpers": "^5.4.1",
"@ember/test-waiters": "catalog:",
"@embroider/compat": "^3.5.5",
"@embroider/core": "^3.4.15",
Expand Down Expand Up @@ -101,7 +101,7 @@
"ember-async-data": "^1.0.3",
"ember-auto-import": "^2.7.2",
"ember-basic-dropdown": "8.0.4",
"ember-cli": "~5.4.1",
"ember-cli": "~6.10.0",
"ember-cli-app-version": "^6.0.1",
"ember-cli-babel": "^8.2.0",
"ember-cli-clean-css": "^3.0.0",
Expand All @@ -127,12 +127,12 @@
"ember-freestyle": "^0.20.0",
"ember-keyboard": "^8.2.1",
"ember-lifeline": "^7.0.0",
"ember-load-initializers": "^2.1.2",
"ember-load-initializers": "^3.0.0",
"ember-modifier": "^4.1.0",
"ember-page-title": "^8.2.3",
"ember-provide-consume-context": "^0.7.0",
"ember-page-title": "^9.0.3",
"ember-provide-consume-context": "^0.8.0",
"ember-qunit": "catalog:",
"ember-resolver": "^11.0.1",
"ember-resolver": "^13.0.0",
"ember-resources": "catalog:",
"ember-route-template": "^1.0.3",
"ember-source": "catalog:",
Expand Down
9 changes: 9 additions & 0 deletions packages/host/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
</div>

<div id="ember-basic-dropdown-wormhole"></div>
<script>
globalThis.process = {
env: {},
version: '',
cwd() {
return '/';
},
};
</script>

<script type="module">
import * as ContentTag from '{{rootURL}}assets/content-tag/standalone.js';
Expand Down
1 change: 0 additions & 1 deletion packages/host/types/@cardstack/host/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';

export {};
1 change: 0 additions & 1 deletion packages/local-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'ember-source/types';
import 'ember-source/types/preview';
import * as ContentTag from 'content-tag';

declare global {
Expand Down
1 change: 0 additions & 1 deletion packages/matrix/types/@cardstack/matrix/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';

export {};
2 changes: 1 addition & 1 deletion packages/runtime-common/etc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ts-ignore no types are available
import * as etc from 'ember-source/dist/ember-template-compiler';
import * as etc from 'ember-source/dist/ember-template-compiler.js';

//@ts-ignore breaks esbuild for VS Code extension
import type { EmberTemplateCompiler } from 'babel-plugin-ember-template-compilation/src/ember-template-compiler';
Expand Down
Loading
Loading