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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
"@embroider/compat": "patches/@embroider__compat.patch",
"ember-eslint-parser": "patches/ember-eslint-parser.patch",
"openai": "patches/openai.patch",
"postcss@8.5.6": "patches/postcss@8.5.6.patch",
"matrix-js-sdk@38.3.0": "patches/matrix-js-sdk@38.3.0.patch",
"@embroider/webpack": "patches/@embroider__webpack.patch",
"ember-source": "patches/ember-source.patch"
"ember-source": "patches/ember-source.patch",
"object-inspect": "patches/object-inspect.patch"
},
"onlyBuiltDependencies": [
"@percy/core",
Expand Down
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
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 {};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'ember-source/types';
import 'ember-source/types/preview';

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import PowerCalendarRange from 'ember-power-calendar/components/power-calendar-range';
import 'ember-power-calendar/styles';
import { type TPowerCalendarRangeOnSelect } from 'ember-power-calendar/components/power-calendar-range';
import powerCalendarFormatDate from 'ember-power-calendar/helpers/power-calendar-format-date';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
Select,
} from 'ember-power-select/components/power-select';
import BeforeOptions from 'ember-power-select/components/power-select/before-options';
import 'ember-power-select/styles';
import PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';

import { cn } from '../../helpers.ts';
Expand Down
1 change: 1 addition & 0 deletions packages/boxel-ui/addon/src/components/select/index.gts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import PowerSelect, {
type PowerSelectArgs,
} from 'ember-power-select/components/power-select';
import BeforeOptions from 'ember-power-select/components/power-select/before-options';
import 'ember-power-select/styles';
import PowerSelectOptions from 'ember-power-select/components/power-select/options';

import cn from '../../helpers/cn.ts';
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 {};
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: 1 addition & 0 deletions packages/host/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = {
'./config/**/*.js',
'./lib/**/*.js',
'./server/**/*.js',
'./babel.config.cjs',
],
parserOptions: {
sourceType: 'script',
Expand Down
2 changes: 2 additions & 0 deletions packages/host/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/tmp/

# compiled output
/dist/
/declarations/
Expand Down
9 changes: 5 additions & 4 deletions packages/host/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import './deprecation-workflow';
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from '@cardstack/host/config/environment';
import './lib/glint-embroider-workaround';
import config from './config/environment';
import '@cardstack/boxel-ui/styles/global.css';
import '@cardstack/boxel-ui/styles/fonts.css';
import '@cardstack/boxel-ui/styles/variables.css';

import compatModules from '@embroider/virtual/compat-modules';

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
Resolver = Resolver.withModules(compatModules);
}

loadInitializers(App, config.modulePrefix);
loadInitializers(App, config.modulePrefix, compatModules);
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
export default config;
import { assert } from '@ember/debug';
import loadConfigFromMeta from '@embroider/config-meta-loader';

/**
* Type declarations for
* import config from 'my-app/config/environment'
*/
declare const config: {
const config = loadConfigFromMeta('@cardstack/host') as unknown;

assert(
'config is not an object',
typeof config === 'object' && config !== null,
);
assert(
'modulePrefix was not detected on your config',
'modulePrefix' in config && typeof config.modulePrefix === 'string',
);
assert(
'locationType was not detected on your config',
'locationType' in config && typeof config.locationType === 'string',
);
assert(
'rootURL was not detected on your config',
'rootURL' in config && typeof config.rootURL === 'string',
);
assert(
'APP was not detected on your config',
'APP' in config && typeof config.APP === 'object',
);

export default config as {
environment: string;
modulePrefix: string;
podModulePrefix: string;
Expand Down Expand Up @@ -36,10 +56,10 @@ declare const config: {
SHOW_ASK_AI?: boolean;
AI_PATCHING_CORRECTNESS_CHECKS?: boolean;
};
publishedRealmDomainOverrides: string;
publishedRealmBoxelSpaceDomain: string;
publishedRealmBoxelSiteDomain: string;
publishedRealmDomainOverrides: string;
defaultSystemCardId: string;
cardSizeLimitBytes: number;
fileSizeLimitBytes: number;
};
defaultSystemCardId: string;
} & Record<string, unknown>;
21 changes: 20 additions & 1 deletion packages/host/app/deprecation-workflow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
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',
},
],
});
48 changes: 0 additions & 48 deletions packages/host/app/index.html

This file was deleted.

12 changes: 0 additions & 12 deletions packages/host/app/lib/glint-embroider-workaround.js

This file was deleted.

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
6 changes: 0 additions & 6 deletions packages/host/app/lib/public-path.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
import config from '@cardstack/host/config/environment';

(globalThis as any).__bootStart = performance.now();
const { hostsOwnAssets, assetsURL } = config;

// @ts-expect-error this is consumed by webpack to set the public asset path at runtime
__webpack_public_path__ = hostsOwnAssets ? '/' : assetsURL;
1 change: 0 additions & 1 deletion packages/host/app/modifiers/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import * as MonacoSDK from 'monaco-editor';
import config from '@cardstack/host/config/environment';
import type MonacoService from '@cardstack/host/services/monaco-service';
import { createMonacoWaiterManager } from '@cardstack/host/utils/editor/monaco-test-waiter';
import '@cardstack/requirejs-monaco-ember-polyfill';

interface Signature {
Args: {
Expand Down
32 changes: 30 additions & 2 deletions packages/host/app/services/monaco-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import { task } from 'ember-concurrency';

import merge from 'lodash/merge';

// The worker suffix here is a vite feature that builds them into standalone
// worker scripts, which will be outside the main bundle in prod.
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js?worker';
import CSSWorker from 'monaco-editor/esm/vs/language/css/css.worker.js?worker';
import HTMLWorker from 'monaco-editor/esm/vs/language/html/html.worker.js?worker';
import JSONWorker from 'monaco-editor/esm/vs/language/json/json.worker.js?worker';
import TSWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker.js?worker';

import type { SingleCardDocument } from '@cardstack/runtime-common';

import config from '@cardstack/host/config/environment';
Expand All @@ -27,6 +35,28 @@ export type MonacoSDK = typeof _MonacoSDK;
export type IStandaloneCodeEditor = _MonacoSDK.editor.IStandaloneCodeEditor;

const { serverEchoDebounceMs } = config;
(
globalThis as unknown as { MonacoEnvironment: _MonacoSDK.Environment }
).MonacoEnvironment = {
getWorker: function (_workerId, label) {
switch (label) {
case 'json':
return new JSONWorker();
case 'css':
case 'scss':
case 'less':
return new CSSWorker();
case 'typescript':
case 'javascript':
return new TSWorker();
case 'html':
case 'handlebars':
return new HTMLWorker();
default:
return new EditorWorker();
}
},
};

export default class MonacoService extends Service {
#ready: Promise<MonacoSDK>;
Expand All @@ -44,8 +74,6 @@ export default class MonacoService extends Service {
}

private loadMonacoSDK = task(async () => {
// @ts-expect-error: dynamic import without types
await import('@cardstack/requirejs-monaco-ember-polyfill');
const monaco = await import('monaco-editor');
monaco.languages.typescript.javascriptDefaults.setCompilerOptions(
this.defaultCompilerOptions(monaco),
Expand Down
Loading
Loading