Skip to content

Commit 97fb479

Browse files
habdelraclaude
andcommitted
Extract SupportedMimeType to decorator-free runtime-common subpath
Move SupportedMimeType enum from router.ts to a standalone supported-mime-type.ts in @cardstack/runtime-common. This subpath has no transitive imports of decorator-using modules, making it safe for Playwright's TypeScript loader which doesn't support experimentalDecorators. - Add packages/runtime-common/supported-mime-type.ts - Remove packages/software-factory/src/mime-types.ts (local copy) - All software-factory files import from @cardstack/runtime-common/supported-mime-type - Barrel re-export and router.ts updated to use the new source Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d94e30 commit 97fb479

28 files changed

Lines changed: 46 additions & 73 deletions

packages/runtime-common/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export const isNode =
309309
Object.prototype.toString.call((globalThis as any).process) ===
310310
'[object process]';
311311

312-
export { SupportedMimeType } from './router';
312+
export { SupportedMimeType } from './supported-mime-type';
313313
export {
314314
isUrlLike,
315315
VirtualNetwork,

packages/runtime-common/router.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,7 @@ function formatUnknownError(error: unknown): string {
4747

4848
export type Method = 'GET' | 'QUERY' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD';
4949

50-
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
51-
export enum SupportedMimeType {
52-
CardJson = 'application/vnd.card+json',
53-
CardSource = 'application/vnd.card+source',
54-
FileMeta = 'application/vnd.card.file-meta+json',
55-
DirectoryListing = 'application/vnd.api+json',
56-
RealmInfo = 'application/vnd.api+json',
57-
Mtimes = 'application/vnd.api+json',
58-
Permissions = 'application/vnd.api+json',
59-
Session = 'application/json',
60-
EventStream = 'text/event-stream',
61-
HTML = 'text/html',
62-
JSONAPI = 'application/vnd.api+json',
63-
JSON = 'application/json',
64-
CardDependencies = 'application/json',
65-
CardTypeSummary = 'application/json',
66-
OctetStream = 'application/octet-stream',
67-
All = '*/*',
68-
}
69-
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */
50+
export { SupportedMimeType } from './supported-mime-type';
7051

7152
function isHTTPMethod(method: unknown): method is Method {
7253
if (typeof method !== 'string') {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
2+
export enum SupportedMimeType {
3+
CardJson = 'application/vnd.card+json',
4+
CardSource = 'application/vnd.card+source',
5+
FileMeta = 'application/vnd.card.file-meta+json',
6+
DirectoryListing = 'application/vnd.api+json',
7+
RealmInfo = 'application/vnd.api+json',
8+
Mtimes = 'application/vnd.api+json',
9+
Permissions = 'application/vnd.api+json',
10+
Session = 'application/json',
11+
EventStream = 'text/event-stream',
12+
HTML = 'text/html',
13+
JSONAPI = 'application/vnd.api+json',
14+
JSON = 'application/json',
15+
CardDependencies = 'application/json',
16+
CardTypeSummary = 'application/json',
17+
OctetStream = 'application/octet-stream',
18+
All = '*/*',
19+
}
20+
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */

packages/software-factory/scripts/factory-tools-smoke.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* pnpm factory:tools-smoke
99
*/
1010

11-
import { SupportedMimeType } from '../src/mime-types';
11+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
1212

1313
import type { AgentAction } from './lib/factory-agent';
1414
import {

packages/software-factory/scripts/lib/factory-agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SupportedMimeType } from '../../src/mime-types';
1+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
22

33
import { createBoxelRealmFetch } from '../../src/realm-auth';
44

packages/software-factory/scripts/lib/factory-tool-executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { spawn } from 'node:child_process';
22
import { resolve } from 'node:path';
33

4-
import { SupportedMimeType } from '../../src/mime-types';
4+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
55
import {
66
iconURLFor,
77
getRandomBackgroundURL,

packages/software-factory/scripts/lib/realm-operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
getRandomBackgroundURL,
1616
} from '@cardstack/runtime-common/realm-display-defaults';
1717

18-
import { SupportedMimeType } from '../../src/mime-types';
18+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
1919

2020
export { SupportedMimeType };
2121

packages/software-factory/src/factory-bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SupportedMimeType } from './mime-types';
1+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
22

33
import type { FactoryBrief } from './factory-brief';
44
import { formatErrorResponse, formatUnknownError } from './error-format';

packages/software-factory/src/factory-brief.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { LooseSingleCardDocument } from '@cardstack/runtime-common';
22

3-
import { SupportedMimeType } from './mime-types';
3+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
44

55
const markdownLinkPattern = /\[([^\]]+)\]\([^)]+\)/g;
66
const wikiLinkPattern = /\[\[([^[\]]+)\]\]/g;

packages/software-factory/src/factory-target-realm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
iconURLFor,
55
getRandomBackgroundURL,
66
} from '@cardstack/runtime-common/realm-display-defaults';
7-
import { SupportedMimeType } from '@cardstack/runtime-common/router';
7+
import { SupportedMimeType } from '@cardstack/runtime-common/supported-mime-type';
88

99
import {
1010
getAccessibleRealmTokens,

0 commit comments

Comments
 (0)