@spawndotfamily/sdk 0.2.7

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.
Files changed (52) hide show
  1. package/AGENTS.md +55 -0
  2. package/CHANGELOG.md +67 -0
  3. package/LICENSE +21 -0
  4. package/README.md +77 -0
  5. package/dist/cli/api.d.ts +19 -0
  6. package/dist/cli/api.js +187 -0
  7. package/dist/cli/files.d.ts +4 -0
  8. package/dist/cli/files.js +40 -0
  9. package/dist/cli/index.d.ts +61 -0
  10. package/dist/cli/index.js +503 -0
  11. package/dist/cli/listing.d.ts +14 -0
  12. package/dist/cli/listing.js +155 -0
  13. package/dist/cli/run.d.ts +2 -0
  14. package/dist/cli/run.js +18 -0
  15. package/dist/cli/upload-client.d.ts +84 -0
  16. package/dist/cli/upload-client.js +737 -0
  17. package/dist/dev/economy.d.ts +29 -0
  18. package/dist/dev/economy.js +49 -0
  19. package/dist/dev/host.d.ts +1 -0
  20. package/dist/dev/host.js +225 -0
  21. package/dist/dev/panel.d.ts +6 -0
  22. package/dist/dev/panel.js +63 -0
  23. package/dist/dev/run.d.ts +2 -0
  24. package/dist/dev/run.js +19 -0
  25. package/dist/dev/server.d.ts +5 -0
  26. package/dist/dev/server.js +188 -0
  27. package/dist/dev/shell.d.ts +1 -0
  28. package/dist/dev/shell.js +18 -0
  29. package/dist/dev/state.d.ts +33 -0
  30. package/dist/dev/state.js +77 -0
  31. package/dist/dev/styles.d.ts +1 -0
  32. package/dist/dev/styles.js +25 -0
  33. package/dist/index.d.ts +53 -0
  34. package/dist/index.js +403 -0
  35. package/dist/multiplayer.d.ts +17 -0
  36. package/dist/multiplayer.js +174 -0
  37. package/dist/server.d.ts +31 -0
  38. package/dist/server.js +112 -0
  39. package/dist/startup.d.ts +21 -0
  40. package/dist/startup.js +85 -0
  41. package/docs/creator-checklist.md +62 -0
  42. package/docs/integration.md +69 -0
  43. package/docs/multiplayer.md +89 -0
  44. package/docs/publishing.md +115 -0
  45. package/docs/security.md +83 -0
  46. package/docs/startup.md +35 -0
  47. package/docs/testing.md +90 -0
  48. package/examples/creator-server.js +16 -0
  49. package/examples/github-browser-build.yml +28 -0
  50. package/examples/multiplayer-game.js +38 -0
  51. package/examples/preview-game.js +13 -0
  52. package/package.json +69 -0
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
3
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
4
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
5
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
6
+ });
7
+ }
8
+ return path;
9
+ };
10
+ // The local npm script executes the TypeScript source directly; the packaged
11
+ // bin executes the JavaScript emitted by tsc.
12
+ const entry = import.meta.url.endsWith('/run.ts') ? './index.ts' : './index.js';
13
+ const { main } = await import(__rewriteRelativeImportExtension(entry));
14
+ const processValue = globalThis.process;
15
+ if (!processValue)
16
+ throw new Error('The publishing CLI requires Node.js.');
17
+ processValue.exitCode = await main();
18
+ export {};
@@ -0,0 +1,84 @@
1
+ import type { FetchLike, PublishConfig } from './api.ts';
2
+ /** The worker contract fixes every upload chunk at eight mebibytes. */
3
+ export declare const CHUNK_BYTES = 8388608;
4
+ /** Safety ceiling for client-side inspection; the platform's default admission is 1 GB. */
5
+ export declare const STREAM_MAX_TOTAL_BYTES = 8000000000;
6
+ export declare const STREAM_MAX_FILE_BYTES = 8000000000;
7
+ export declare const STREAM_MAX_HTML_BYTES = 1000000;
8
+ export declare const STREAM_MAX_FILES = 1000;
9
+ export declare const STREAM_MAX_TRAVERSED_ENTRIES = 10000;
10
+ export declare const STREAM_MAX_DIRECTORY_DEPTH = 64;
11
+ export declare const STREAM_MAX_RETRIES = 3;
12
+ type NodeStat = {
13
+ ino: number;
14
+ dev: number;
15
+ size: number;
16
+ mtimeMs?: number;
17
+ ctimeMs?: number;
18
+ isDirectory(): boolean;
19
+ isFile(): boolean;
20
+ isSymbolicLink(): boolean;
21
+ };
22
+ type NodeFileHandle = {
23
+ fd: number;
24
+ read(buffer: Uint8Array, offset: number, length: number, position: number | null): Promise<{
25
+ bytesRead: number;
26
+ }>;
27
+ stat(): Promise<NodeStat>;
28
+ close(): Promise<void>;
29
+ };
30
+ export type StreamingBuildFile = {
31
+ path: string;
32
+ bytes: number;
33
+ sha256: string;
34
+ };
35
+ export type StreamingBuildManifest = {
36
+ entry: 'index.html';
37
+ files: StreamingBuildFile[];
38
+ sourceCommit?: string;
39
+ };
40
+ export type StreamingBuild = StreamingBuildManifest & {
41
+ bytes: number;
42
+ };
43
+ export type UploadProgress = Record<string, unknown>;
44
+ export type StreamingPublishOptions = {
45
+ sourceCommit?: string;
46
+ onProgress?: (progress: UploadProgress) => void;
47
+ retries?: number;
48
+ retryDelayMs?: number;
49
+ sleep?: (milliseconds: number) => Promise<void>;
50
+ };
51
+ type FileSnapshot = {
52
+ ino: number;
53
+ dev: number;
54
+ size: number;
55
+ mtimeMs?: number;
56
+ ctimeMs?: number;
57
+ };
58
+ type PreparedBuildFile = StreamingBuildFile & {
59
+ absolutePath: string;
60
+ snapshot: FileSnapshot;
61
+ chunkSha256: string[];
62
+ };
63
+ type PreparedBuild = StreamingBuild & {
64
+ root: string;
65
+ rootSnapshot: FileSnapshot;
66
+ preparedFiles: PreparedBuildFile[];
67
+ };
68
+ export declare function inspectBrowserBuild(directory: string, sourceCommit?: string): Promise<StreamingBuild>;
69
+ /**
70
+ * Prepare a local build once for the development launcher. The returned
71
+ * descriptors retain the canonical root and inspection snapshots so serving
72
+ * can reopen and verify the same files without rebuilding paths from the
73
+ * caller's input directory.
74
+ */
75
+ export declare function inspectBrowserBuildForLocal(directory: string, sourceCommit?: string): Promise<PreparedBuild>;
76
+ /** Derive the only worker origin accepted when credentials omit an explicit one. */
77
+ export declare function deriveUploadOrigin(platformOrigin: string): string;
78
+ /** Reopen a prepared local file and verify its retained root, metadata, and digest before serving it. */
79
+ export declare function openValidatedBuildFile(build: PreparedBuild, file: PreparedBuildFile, cache?: {
80
+ snapshot?: FileSnapshot;
81
+ validation?: Promise<void>;
82
+ }): Promise<NodeFileHandle>;
83
+ export declare function publishBrowserDirectory(config: PublishConfig, directory: string, sourceCommit?: string, fetchImplementation?: FetchLike, options?: StreamingPublishOptions): Promise<Record<string, unknown>>;
84
+ export {};