@crowdedkingdoms/crowdyjs 8.22.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +66 -0
- package/README.md +111 -7
- package/dist/crowdy-client.d.ts +3 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +2 -0
- package/dist/domains/playerCodeProjects.d.ts +25 -0
- package/dist/domains/playerCodeProjects.d.ts.map +1 -0
- package/dist/domains/playerCodeProjects.js +299 -0
- package/dist/domains/playerCompute.d.ts +1 -1
- package/dist/domains/playerCompute.js +1 -1
- package/dist/generated/graphql.d.ts +792 -7
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +57 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/live-coding/assets/browser-authoring-index.json +1 -0
- package/dist/live-coding/assets/manifest.json +19 -0
- package/dist/live-coding/assets/tree-sitter-rust.wasm +0 -0
- package/dist/live-coding/assets/web-tree-sitter.wasm +0 -0
- package/dist/live-coding/browser-authoring-index.generated.d.ts +2 -0
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -0
- package/dist/live-coding/browser-authoring-index.generated.js +5127 -0
- package/dist/live-coding/lsp-protocol.d.ts +98 -0
- package/dist/live-coding/lsp-protocol.d.ts.map +1 -0
- package/dist/live-coding/lsp-protocol.js +70 -0
- package/dist/live-coding/monaco-services.d.ts +22 -0
- package/dist/live-coding/monaco-services.d.ts.map +1 -0
- package/dist/live-coding/monaco-services.js +69 -0
- package/dist/live-coding/platform-index.d.ts +29 -0
- package/dist/live-coding/platform-index.d.ts.map +1 -0
- package/dist/live-coding/platform-index.js +281 -0
- package/dist/live-coding/rust-analysis.d.ts +24 -0
- package/dist/live-coding/rust-analysis.d.ts.map +1 -0
- package/dist/live-coding/rust-analysis.js +375 -0
- package/dist/live-coding/rust-lsp-server.d.ts +43 -0
- package/dist/live-coding/rust-lsp-server.d.ts.map +1 -0
- package/dist/live-coding/rust-lsp-server.js +455 -0
- package/dist/live-coding/rust-lsp.worker.d.ts +2 -0
- package/dist/live-coding/rust-lsp.worker.d.ts.map +1 -0
- package/dist/live-coding/rust-lsp.worker.js +26 -0
- package/dist/live-coding/vfs.d.ts +41 -0
- package/dist/live-coding/vfs.d.ts.map +1 -0
- package/dist/live-coding/vfs.js +174 -0
- package/dist/live-coding/worker-transport.d.ts +63 -0
- package/dist/live-coding/worker-transport.d.ts.map +1 -0
- package/dist/live-coding/worker-transport.js +217 -0
- package/dist/mod-studio/controller.d.ts +188 -0
- package/dist/mod-studio/controller.d.ts.map +1 -0
- package/dist/mod-studio/controller.js +915 -0
- package/dist/mod-studio/diagnostics.d.ts +22 -0
- package/dist/mod-studio/diagnostics.d.ts.map +1 -0
- package/dist/mod-studio/diagnostics.js +141 -0
- package/dist/mod-studio/dom-shell.d.ts +55 -0
- package/dist/mod-studio/dom-shell.d.ts.map +1 -0
- package/dist/mod-studio/dom-shell.js +527 -0
- package/dist/mod-studio/editor.d.ts +17 -0
- package/dist/mod-studio/editor.d.ts.map +1 -0
- package/dist/mod-studio/editor.js +1 -0
- package/dist/mod-studio/index.d.ts +10 -0
- package/dist/mod-studio/index.d.ts.map +1 -0
- package/dist/mod-studio/index.js +9 -0
- package/dist/mod-studio/models.d.ts +149 -0
- package/dist/mod-studio/models.d.ts.map +1 -0
- package/dist/mod-studio/models.js +62 -0
- package/dist/mod-studio/monaco-editor.d.ts +16 -0
- package/dist/mod-studio/monaco-editor.d.ts.map +1 -0
- package/dist/mod-studio/monaco-editor.js +548 -0
- package/dist/mod-studio/mount.d.ts +17 -0
- package/dist/mod-studio/mount.d.ts.map +1 -0
- package/dist/mod-studio/mount.js +86 -0
- package/dist/mod-studio/starter-projects.d.ts +11 -0
- package/dist/mod-studio/starter-projects.d.ts.map +1 -0
- package/dist/mod-studio/starter-projects.js +102 -0
- package/dist/mod-studio/styles.d.ts +2 -0
- package/dist/mod-studio/styles.d.ts.map +1 -0
- package/dist/mod-studio/styles.js +14 -0
- package/dist/mod-studio/textarea-editor.d.ts +8 -0
- package/dist/mod-studio/textarea-editor.d.ts.map +1 -0
- package/dist/mod-studio/textarea-editor.js +71 -0
- package/package.json +18 -6
- package/dist/live-coding/ide.d.ts +0 -16
- package/dist/live-coding/ide.d.ts.map +0 -1
- package/dist/live-coding/ide.js +0 -399
- package/dist/live-coding/live-coding-controller.d.ts +0 -75
- package/dist/live-coding/live-coding-controller.d.ts.map +0 -1
- package/dist/live-coding/live-coding-controller.js +0 -141
- package/dist/live-coding/mount.d.ts +0 -26
- package/dist/live-coding/mount.d.ts.map +0 -1
- package/dist/live-coding/mount.js +0 -108
- package/dist/live-coding/templates.d.ts +0 -17
- package/dist/live-coding/templates.d.ts.map +0 -1
- package/dist/live-coding/templates.js +0 -59
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** Compile targets supported by player-authored projects. */
|
|
2
|
+
export type ModStudioTarget = 'SERVER' | 'CLIENT';
|
|
3
|
+
/** The target layout selected when a project is created. */
|
|
4
|
+
export type ModStudioProjectKind = 'SERVER' | 'CLIENT' | 'FULL_STACK';
|
|
5
|
+
/**
|
|
6
|
+
* Whether a full-stack server should advertise its client companion.
|
|
7
|
+
* `OPTIONAL` records author intent without creating a runtime requirement;
|
|
8
|
+
* `REQUIRED` is applied with `playerCompute.setRequires` after both targets
|
|
9
|
+
* compile successfully.
|
|
10
|
+
*/
|
|
11
|
+
export type ModStudioPairingPreference = 'NONE' | 'OPTIONAL' | 'REQUIRED';
|
|
12
|
+
/** A source file in one project target. Paths are relative to that target. */
|
|
13
|
+
export interface ModStudioProjectFile {
|
|
14
|
+
target: ModStudioTarget;
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
}
|
|
18
|
+
/** A read-only source file made available to the browser language worker. */
|
|
19
|
+
export interface ModStudioReferenceFile {
|
|
20
|
+
id: string;
|
|
21
|
+
source: 'PERSONAL_LIBRARY' | 'COMMON';
|
|
22
|
+
title: string;
|
|
23
|
+
/** Optional target fence. Omitted files are useful from either target. */
|
|
24
|
+
target?: ModStudioTarget;
|
|
25
|
+
path: string;
|
|
26
|
+
content: string;
|
|
27
|
+
tags?: string[];
|
|
28
|
+
updatedAt?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ModStudioProjectMetadata {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
serverModuleName?: string;
|
|
34
|
+
clientModuleName?: string;
|
|
35
|
+
pairingPreference: ModStudioPairingPreference;
|
|
36
|
+
}
|
|
37
|
+
/** Immutable revision identity returned by the cloud project service. */
|
|
38
|
+
export interface ModStudioProjectRevision {
|
|
39
|
+
id: string;
|
|
40
|
+
savedAt: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* One atomic cloud project snapshot. SERVER and CLIENT files intentionally
|
|
44
|
+
* share a project revision so a full-stack save cannot persist half a pair.
|
|
45
|
+
*/
|
|
46
|
+
export interface ModStudioProject {
|
|
47
|
+
projectId: string;
|
|
48
|
+
appId: string;
|
|
49
|
+
gridId: string;
|
|
50
|
+
kind: ModStudioProjectKind;
|
|
51
|
+
metadata: ModStudioProjectMetadata;
|
|
52
|
+
files: ModStudioProjectFile[];
|
|
53
|
+
sdkVersion: string;
|
|
54
|
+
abiVersion: number;
|
|
55
|
+
revision: ModStudioProjectRevision;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ModStudioProjectSummary {
|
|
60
|
+
projectId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
kind: ModStudioProjectKind;
|
|
63
|
+
revisionId: string;
|
|
64
|
+
serverModuleName?: string;
|
|
65
|
+
clientModuleName?: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
/** Explicit persistence state rendered by Mod Studio. */
|
|
69
|
+
export type ModStudioSaveState = 'SAVING' | 'SAVED' | 'CONFLICT' | 'OFFLINE';
|
|
70
|
+
export interface ModStudioFileRef {
|
|
71
|
+
source: 'PROJECT' | 'PERSONAL_LIBRARY' | 'COMMON';
|
|
72
|
+
target?: ModStudioTarget;
|
|
73
|
+
path: string;
|
|
74
|
+
referenceId?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CreateModStudioProjectInput {
|
|
77
|
+
appId: string;
|
|
78
|
+
gridId: string;
|
|
79
|
+
kind: ModStudioProjectKind;
|
|
80
|
+
metadata: ModStudioProjectMetadata;
|
|
81
|
+
files: ModStudioProjectFile[];
|
|
82
|
+
}
|
|
83
|
+
export interface SaveModStudioProjectInput {
|
|
84
|
+
appId: string;
|
|
85
|
+
gridId: string;
|
|
86
|
+
projectId: string;
|
|
87
|
+
/** Optimistic-concurrency precondition for the atomic project write. */
|
|
88
|
+
expectedRevisionId: string;
|
|
89
|
+
metadata: ModStudioProjectMetadata;
|
|
90
|
+
files: ModStudioProjectFile[];
|
|
91
|
+
}
|
|
92
|
+
export interface ModStudioProjectScope {
|
|
93
|
+
appId: string;
|
|
94
|
+
gridId: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ImportModStudioReferenceFileInput extends ModStudioProjectScope {
|
|
97
|
+
projectId: string;
|
|
98
|
+
expectedRevisionId: string;
|
|
99
|
+
source: 'PERSONAL_LIBRARY' | 'COMMON';
|
|
100
|
+
referenceId: string;
|
|
101
|
+
destinationPath?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface SaveModStudioLibraryFileInput extends ModStudioProjectScope {
|
|
104
|
+
title: string;
|
|
105
|
+
target: ModStudioTarget;
|
|
106
|
+
path: string;
|
|
107
|
+
content: string;
|
|
108
|
+
tags?: string[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Storage contract consumed by Mod Studio. It deliberately has no generated
|
|
112
|
+
* GraphQL types, JSON source maps, or transport-specific errors.
|
|
113
|
+
*/
|
|
114
|
+
export interface ModStudioProjectProvider {
|
|
115
|
+
listProjects(scope: ModStudioProjectScope): Promise<ModStudioProjectSummary[]>;
|
|
116
|
+
getProject(scope: ModStudioProjectScope & {
|
|
117
|
+
projectId: string;
|
|
118
|
+
}): Promise<ModStudioProject>;
|
|
119
|
+
createProject(input: CreateModStudioProjectInput): Promise<ModStudioProject>;
|
|
120
|
+
saveProject(input: SaveModStudioProjectInput): Promise<ModStudioProject>;
|
|
121
|
+
listPersonalLibraryFiles(scope: ModStudioProjectScope): Promise<ModStudioReferenceFile[]>;
|
|
122
|
+
listCommonFiles(scope: ModStudioProjectScope): Promise<ModStudioReferenceFile[]>;
|
|
123
|
+
importReferenceFile(input: ImportModStudioReferenceFileInput): Promise<ModStudioProject>;
|
|
124
|
+
savePersonalLibraryFile(input: SaveModStudioLibraryFileInput): Promise<ModStudioReferenceFile>;
|
|
125
|
+
}
|
|
126
|
+
/** Provider error indicating that the expected revision lost a save race. */
|
|
127
|
+
export declare class ModStudioRevisionConflictError extends Error {
|
|
128
|
+
readonly remoteProject?: ModStudioProject | undefined;
|
|
129
|
+
readonly code = "PROJECT_REVISION_CONFLICT";
|
|
130
|
+
constructor(message?: string, remoteProject?: ModStudioProject | undefined);
|
|
131
|
+
}
|
|
132
|
+
/** Provider error indicating that the write should be retried when online. */
|
|
133
|
+
export declare class ModStudioOfflineError extends Error {
|
|
134
|
+
readonly code = "PROJECT_OFFLINE";
|
|
135
|
+
readonly cause?: unknown;
|
|
136
|
+
constructor(message?: string, cause?: unknown);
|
|
137
|
+
}
|
|
138
|
+
/** Validate and normalize a target-relative project path. */
|
|
139
|
+
export declare function normalizeModStudioPath(path: string): string;
|
|
140
|
+
/** Stable key for maps, tabs, diagnostics, and tests. */
|
|
141
|
+
export declare function modStudioFileKey(target: ModStudioTarget, path: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* Target-prefixed URI used by Monaco and the browser VFS. Both targets can
|
|
144
|
+
* therefore load `Cargo.toml` and `src/lib.rs` at the same time.
|
|
145
|
+
*/
|
|
146
|
+
export declare function modStudioFileUri(workspaceUri: string, target: ModStudioTarget, path: string): string;
|
|
147
|
+
export declare function projectTargets(kind: ModStudioProjectKind): ModStudioTarget[];
|
|
148
|
+
export declare function cloneModStudioProject(project: ModStudioProject): ModStudioProject;
|
|
149
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/mod-studio/models.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,4DAA4D;AAC5D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1E,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,kBAAkB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CA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. */
|
|
2
|
+
export class ModStudioRevisionConflictError extends Error {
|
|
3
|
+
constructor(message = 'The project changed in another session', remoteProject) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.remoteProject = remoteProject;
|
|
6
|
+
this.code = 'PROJECT_REVISION_CONFLICT';
|
|
7
|
+
this.name = 'ModStudioRevisionConflictError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Provider error indicating that the write should be retried when online. */
|
|
11
|
+
export class ModStudioOfflineError extends Error {
|
|
12
|
+
constructor(message = 'The project service is offline', cause) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.code = 'PROJECT_OFFLINE';
|
|
15
|
+
this.name = 'ModStudioOfflineError';
|
|
16
|
+
this.cause = cause;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Validate and normalize a target-relative project path. */
|
|
20
|
+
export function normalizeModStudioPath(path) {
|
|
21
|
+
const normalized = path.trim().replace(/\\/gu, '/').replace(/^\.\/+/u, '');
|
|
22
|
+
if (normalized.length === 0 ||
|
|
23
|
+
normalized.length > 240 ||
|
|
24
|
+
normalized.startsWith('/') ||
|
|
25
|
+
normalized.endsWith('/') ||
|
|
26
|
+
normalized.split('/').some((part) => part === '' || part === '.' || part === '..') ||
|
|
27
|
+
/[\u0000-\u001f\u007f]/u.test(normalized)) {
|
|
28
|
+
throw new Error(`Invalid project file path: ${path}`);
|
|
29
|
+
}
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
/** Stable key for maps, tabs, diagnostics, and tests. */
|
|
33
|
+
export function modStudioFileKey(target, path) {
|
|
34
|
+
return `${target}:${normalizeModStudioPath(path)}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Target-prefixed URI used by Monaco and the browser VFS. Both targets can
|
|
38
|
+
* therefore load `Cargo.toml` and `src/lib.rs` at the same time.
|
|
39
|
+
*/
|
|
40
|
+
export function modStudioFileUri(workspaceUri, target, path) {
|
|
41
|
+
const root = workspaceUri.replace(/\/+$/u, '');
|
|
42
|
+
const encodedPath = normalizeModStudioPath(path)
|
|
43
|
+
.split('/')
|
|
44
|
+
.map(encodeURIComponent)
|
|
45
|
+
.join('/');
|
|
46
|
+
return `${root}/${target.toLowerCase()}/${encodedPath}`;
|
|
47
|
+
}
|
|
48
|
+
export function projectTargets(kind) {
|
|
49
|
+
if (kind === 'SERVER')
|
|
50
|
+
return ['SERVER'];
|
|
51
|
+
if (kind === 'CLIENT')
|
|
52
|
+
return ['CLIENT'];
|
|
53
|
+
return ['SERVER', 'CLIENT'];
|
|
54
|
+
}
|
|
55
|
+
export function cloneModStudioProject(project) {
|
|
56
|
+
return {
|
|
57
|
+
...project,
|
|
58
|
+
metadata: { ...project.metadata },
|
|
59
|
+
revision: { ...project.revision },
|
|
60
|
+
files: project.files.map((file) => ({ ...file })),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ModStudioEditorAdapter, ModStudioEditorCallbacks } from './editor.js';
|
|
2
|
+
import { type PlatformIndex } from '../live-coding/platform-index.js';
|
|
3
|
+
export interface MonacoModStudioEditorOptions {
|
|
4
|
+
editorWorkerFactory?: () => Worker;
|
|
5
|
+
languageWorkerFactory?: () => Worker;
|
|
6
|
+
platformIndex?: PlatformIndex | unknown;
|
|
7
|
+
languageRequestTimeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create the Monaco adapter backed by the browser-local Rust LSP worker. Every
|
|
11
|
+
* loaded project/reference file is opened in the worker; project URIs include
|
|
12
|
+
* `/server/` or `/client/`, so duplicate Cargo and lib paths never collide.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createMonacoModStudioEditor(host: HTMLElement, options: MonacoModStudioEditorOptions, callbacks: ModStudioEditorCallbacks): Promise<ModStudioEditorAdapter>;
|
|
15
|
+
export declare function isCurrentDiagnosticVersion(version: unknown, currentVersion: number): boolean;
|
|
16
|
+
//# sourceMappingURL=monaco-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-editor.d.ts","sourceRoot":"","sources":["../../src/mod-studio/monaco-editor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAerB,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,kCAAkC,CAAC;AAW1C,MAAM,WAAW,4BAA4B;IAC3C,mBAAmB,CAAC,EAAE,MAAM,MAAM,CAAC;IACnC,qBAAqB,CAAC,EAAE,MAAM,MAAM,CAAC;IACrC,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAmBD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,4BAA4B,EACrC,SAAS,EAAE,wBAAwB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAoXjC;AA6GD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAKT"}
|