@appstrata/dev 0.1.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.
Files changed (53) hide show
  1. package/README.md +164 -0
  2. package/dist/completion-notification.d.ts +22 -0
  3. package/dist/completion-notification.d.ts.map +1 -0
  4. package/dist/completion-notification.js +184 -0
  5. package/dist/completion-notification.js.map +1 -0
  6. package/dist/dev-overlay.css +450 -0
  7. package/dist/dev-overlay.d.ts +56 -0
  8. package/dist/dev-overlay.d.ts.map +1 -0
  9. package/dist/dev-overlay.js +371 -0
  10. package/dist/dev-overlay.js.map +1 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +22 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/intercepting-transport.d.ts +11 -0
  16. package/dist/intercepting-transport.d.ts.map +1 -0
  17. package/dist/intercepting-transport.js +31 -0
  18. package/dist/intercepting-transport.js.map +1 -0
  19. package/dist/load-config.d.ts +42 -0
  20. package/dist/load-config.d.ts.map +1 -0
  21. package/dist/load-config.js +87 -0
  22. package/dist/load-config.js.map +1 -0
  23. package/dist/logging-hmr.d.ts +20 -0
  24. package/dist/logging-hmr.d.ts.map +1 -0
  25. package/dist/logging-hmr.js +28 -0
  26. package/dist/logging-hmr.js.map +1 -0
  27. package/dist/mock-init.d.ts +9 -0
  28. package/dist/mock-init.d.ts.map +1 -0
  29. package/dist/mock-init.js +171 -0
  30. package/dist/mock-init.js.map +1 -0
  31. package/dist/mock-player.d.ts +117 -0
  32. package/dist/mock-player.d.ts.map +1 -0
  33. package/dist/mock-player.js +132 -0
  34. package/dist/mock-player.js.map +1 -0
  35. package/dist/mock-services.d.ts +32 -0
  36. package/dist/mock-services.d.ts.map +1 -0
  37. package/dist/mock-services.js +141 -0
  38. package/dist/mock-services.js.map +1 -0
  39. package/dist/player/index.html +22 -0
  40. package/dist/player/main.d.ts +10 -0
  41. package/dist/player/main.d.ts.map +1 -0
  42. package/dist/player/main.js +352 -0
  43. package/dist/player/main.js.map +1 -0
  44. package/dist/player/styles.css +80 -0
  45. package/dist/plugin.d.ts +103 -0
  46. package/dist/plugin.d.ts.map +1 -0
  47. package/dist/plugin.js +292 -0
  48. package/dist/plugin.js.map +1 -0
  49. package/dist/types.d.ts +376 -0
  50. package/dist/types.d.ts.map +1 -0
  51. package/dist/types.js +75 -0
  52. package/dist/types.js.map +1 -0
  53. package/package.json +50 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Logging HMR handler for AppStrata apps.
3
+ *
4
+ * Injected by the Vite plugin during `serve` for both "embedded" and "none"
5
+ * player modes. Keeps the app's logging configuration in sync when
6
+ * `app.logging` or `dev.logging` changes in `appstrata.config.ts`.
7
+ *
8
+ * This is a standalone concern — separate from the Dev Player — because
9
+ * logging configuration is owned by the plugin (which injects the logging
10
+ * IIFE and profiles JSON tag), not by the player.
11
+ *
12
+ * Note on `dev.logging`: this module reconfigures both `app.logging`
13
+ * (profiles) and `dev.logging` (active preset), but the `dev.logging`
14
+ * path is only meaningful for the embedded player. In standalone mode,
15
+ * `dev.logging` is delivered via URL params on the iframe src, and the
16
+ * standalone player handles changes by reloading the iframe with updated
17
+ * params — so this module's `dev.logging` update is redundant in that case.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=logging-hmr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-hmr.d.ts","sourceRoot":"","sources":["../src/logging-hmr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Logging HMR handler for AppStrata apps.
3
+ *
4
+ * Injected by the Vite plugin during `serve` for both "embedded" and "none"
5
+ * player modes. Keeps the app's logging configuration in sync when
6
+ * `app.logging` or `dev.logging` changes in `appstrata.config.ts`.
7
+ *
8
+ * This is a standalone concern — separate from the Dev Player — because
9
+ * logging configuration is owned by the plugin (which injects the logging
10
+ * IIFE and profiles JSON tag), not by the player.
11
+ *
12
+ * Note on `dev.logging`: this module reconfigures both `app.logging`
13
+ * (profiles) and `dev.logging` (active preset), but the `dev.logging`
14
+ * path is only meaningful for the embedded player. In standalone mode,
15
+ * `dev.logging` is delivered via URL params on the iframe src, and the
16
+ * standalone player handles changes by reloading the iframe with updated
17
+ * params — so this module's `dev.logging` update is redundant in that case.
18
+ */
19
+ /// <reference types="vite/client" />
20
+ import { configureLogging } from "@appstrata/core";
21
+ import { buildLoggingConfig } from "@appstrata/utils";
22
+ import { CONFIG_CHANGE_EVENT } from "./types.js";
23
+ if (import.meta.hot) {
24
+ import.meta.hot.on(CONFIG_CHANGE_EVENT, (data) => {
25
+ configureLogging(buildLoggingConfig({ profiles: data.app?.logging, preset: data.dev?.logging }));
26
+ });
27
+ }
28
+ //# sourceMappingURL=logging-hmr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-hmr.js","sourceRoot":"","sources":["../src/logging-hmr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qCAAqC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,IAA4H,EAAE,EAAE;QACvK,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Mock Player Initialization for AppStrata Development.
3
+ *
4
+ * This module is loaded as a virtual module by the Vite plugin.
5
+ * It fetches mock context from the dev server and initializes a mock player
6
+ * using createAppHost from @appstrata/player-lib.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=mock-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-init.d.ts","sourceRoot":"","sources":["../src/mock-init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Mock Player Initialization for AppStrata Development.
3
+ *
4
+ * This module is loaded as a virtual module by the Vite plugin.
5
+ * It fetches mock context from the dev server and initializes a mock player
6
+ * using createAppHost from @appstrata/player-lib.
7
+ */
8
+ /// <reference types="vite/client" />
9
+ import { createMockPlayer, buildAppContext, buildCapabilityServices, resolveCapabilities, } from "./mock-player.js";
10
+ import { showCompletionNotification } from "./completion-notification.js";
11
+ import { createDevOverlay } from "./dev-overlay.js";
12
+ import { createInterceptingTransport } from "./intercepting-transport.js";
13
+ import { createPostMessageTransport } from "@appstrata/protocol";
14
+ import { createLogger } from "@appstrata/core";
15
+ import { scaleToFit, setDocumentResolution } from "@appstrata/utils";
16
+ import { CONFIG_CHANGE_EVENT } from "./types.js";
17
+ if (window.parent !== window) {
18
+ throw new Error("[AppStrata] The embedded dev player cannot run inside an iframe. " +
19
+ "This usually means the standalone dev player loaded an app that has the " +
20
+ "appstrata() Vite plugin enabled in embedded mode. To fix, set " +
21
+ '`player: "none"` in the appstrata() plugin config when using the standalone player.');
22
+ }
23
+ const logger = createLogger("EmbeddedDevPlayer");
24
+ logger.info("Initializing the development mock player...");
25
+ // Fetch configuration from dev server
26
+ const response = await fetch("/__appstrata__/context");
27
+ const { context: contextConfig, capabilities: capabilityConfig, lifecycle, app, dev: devConfig } = (await response.json());
28
+ const overlay = createDevOverlay({
29
+ container: document.body,
30
+ measureElement: document.documentElement,
31
+ context: { ...contextConfig, autoZoom: app?.autoZoom },
32
+ dropLogMessages: !(devConfig?.messages?.showLogMessages ?? false),
33
+ });
34
+ // Create transport with interceptor so the overlay can track messages
35
+ const rawTransport = createPostMessageTransport({ targetWindow: window });
36
+ const transport = createInterceptingTransport(rawTransport, (msg, dir) => {
37
+ overlay.logMessage(dir, msg);
38
+ });
39
+ // Create mock player
40
+ const host = createMockPlayer({
41
+ capabilities: capabilityConfig,
42
+ transport,
43
+ notifyComplete: () => {
44
+ logger.info("App called notifyComplete()");
45
+ const hideDelay = lifecycle?.hideDelay ?? 100;
46
+ const stopDelay = lifecycle?.stopDelay ?? 50;
47
+ setTimeout(() => {
48
+ logger.debug("fireHide");
49
+ host.fireHide();
50
+ }, hideDelay);
51
+ setTimeout(() => {
52
+ logger.debug("fireStop");
53
+ host.fireStop();
54
+ }, hideDelay + stopDelay);
55
+ },
56
+ notifyEstimatedEnd: (expectedFinishTime) => {
57
+ const secsUntil = Math.round((expectedFinishTime - Date.now()) / 1000);
58
+ logger.info(`App called notifyEstimatedEnd() — finishes in ~${secsUntil}s (${new Date(expectedFinishTime).toISOString()})`);
59
+ },
60
+ notifyNoContent: (options) => {
61
+ const parts = ["App called notifyNoContent()"];
62
+ if (options?.reason)
63
+ parts.push(`reason="${options.reason}"`);
64
+ if (options?.retryNotBefore) {
65
+ const secsUntil = Math.round((options.retryNotBefore - Date.now()) / 1000);
66
+ parts.push(`retry in ~${secsUntil}s`);
67
+ }
68
+ logger.info(parts.join(" — "));
69
+ const hideDelay = lifecycle?.hideDelay ?? 100;
70
+ const stopDelay = lifecycle?.stopDelay ?? 50;
71
+ setTimeout(() => {
72
+ logger.debug("fireHide");
73
+ host.fireHide();
74
+ }, hideDelay);
75
+ setTimeout(() => {
76
+ logger.debug("fireStop");
77
+ host.fireStop();
78
+ }, hideDelay + stopDelay);
79
+ },
80
+ log: (level, message, data) => {
81
+ console[level](`[Embedded Dev Player Log Service] ${message}`, data !== undefined ? data : "");
82
+ },
83
+ });
84
+ host.player.onStop(() => {
85
+ overlay.setCompleted();
86
+ showCompletionNotification();
87
+ });
88
+ // Build initial AppContext
89
+ const capabilities = resolveCapabilities(capabilityConfig);
90
+ const appContext = buildAppContext(contextConfig, capabilities);
91
+ // Fire lifecycle events with configured timing
92
+ const initDelay = lifecycle.initDelay ?? 0;
93
+ const showDelay = lifecycle.showDelay ?? 50;
94
+ const startDelay = lifecycle.startDelay ?? 50;
95
+ setTimeout(() => {
96
+ logger.debug("fireInit");
97
+ host.fireInit(appContext);
98
+ }, initDelay);
99
+ setTimeout(() => {
100
+ logger.debug("fireShow");
101
+ host.fireShow();
102
+ }, initDelay + showDelay);
103
+ setTimeout(() => {
104
+ logger.debug("fireStart");
105
+ host.fireStart();
106
+ }, initDelay + showDelay + startDelay);
107
+ let autoZoomCleanup = null;
108
+ function applyAutoZoom(mode, targetWidth, targetHeight) {
109
+ if (autoZoomCleanup) {
110
+ autoZoomCleanup();
111
+ autoZoomCleanup = null;
112
+ }
113
+ if (!mode || mode === 'none')
114
+ return;
115
+ const el = document.documentElement;
116
+ let apply;
117
+ let reset;
118
+ switch (mode) {
119
+ case 'contain':
120
+ case 'cover':
121
+ apply = () => scaleToFit(el, el.clientWidth, el.clientHeight, targetWidth, targetHeight, mode);
122
+ reset = () => scaleToFit(el);
123
+ break;
124
+ case 'auto-width': {
125
+ apply = () => {
126
+ const portrait = el.clientWidth < el.clientHeight;
127
+ const designPortrait = targetWidth < targetHeight;
128
+ const [tw, th] = (portrait !== designPortrait)
129
+ ? [targetHeight, targetWidth]
130
+ : [targetWidth, targetHeight];
131
+ setDocumentResolution(tw, th, 'width');
132
+ };
133
+ reset = () => setDocumentResolution();
134
+ break;
135
+ }
136
+ default:
137
+ apply = () => setDocumentResolution(targetWidth, targetHeight, mode);
138
+ reset = () => setDocumentResolution();
139
+ break;
140
+ }
141
+ apply();
142
+ window.addEventListener("resize", apply);
143
+ autoZoomCleanup = () => {
144
+ window.removeEventListener("resize", apply);
145
+ reset();
146
+ };
147
+ }
148
+ applyAutoZoom(app?.autoZoom, contextConfig.viewportWidth || 1920, contextConfig.viewportHeight || 1080);
149
+ window.addEventListener("resize", () => overlay.flashResizeToast());
150
+ // Listen for HMR context changes
151
+ if (import.meta.hot) {
152
+ import.meta.hot.on(CONFIG_CHANGE_EVENT, (data) => {
153
+ // console.info (not logger) so E2E tests can always detect HMR events
154
+ // regardless of the active log level.
155
+ console.log(">> [EmbeddedDevPlayer] Config changed via HMR");
156
+ // Resolve new capabilities and hot-swap services
157
+ const newCapabilities = resolveCapabilities(data.capabilities);
158
+ const newServices = buildCapabilityServices(newCapabilities);
159
+ host.updateServices(newServices);
160
+ // Build new context and update
161
+ const newContext = buildAppContext(data.context, newCapabilities);
162
+ host.updateContext(newContext);
163
+ overlay.updateContext({ ...data.context, autoZoom: data.app?.autoZoom });
164
+ overlay.setDropLogMessages(!(data.dev?.messages?.showLogMessages ?? false));
165
+ applyAutoZoom(data.app?.autoZoom, data.context.viewportWidth || 1920, data.context.viewportHeight || 1080);
166
+ });
167
+ }
168
+ logger.info("Mock player ready");
169
+ logger.debug("Context", appContext);
170
+ logger.debug("Capabilities", capabilities);
171
+ //# sourceMappingURL=mock-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-init.js","sourceRoot":"","sources":["../src/mock-init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qCAAqC;AAErC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YA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,mBAAmB,EAAE,CAAC,IAAkG,EAAE,EAAE;QAC7I,sEAAsE;QACtE,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAE7D,iDAAiD;QACjD,MAAM,eAAe,GAAG,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/D,MAAM,WAAW,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAEjC,+BAA+B;QAC/B,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAClE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAE/B,OAAO,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,eAAe,IAAI,KAAK,CAAC,CAAC,CAAC;QAE5E,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACjC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACpC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Mock player creation for development mode.
3
+ *
4
+ * Uses createAppHost from @appstrata/player-lib with mock services.
5
+ * Provides composable helpers for building mock contexts and capabilities.
6
+ */
7
+ import type { AppContext, DeviceInfo, Capability, LogLevel } from "@appstrata/core";
8
+ import { type AppHost, type CapabilityServices } from "@appstrata/player-lib";
9
+ import type { Transport } from "@appstrata/protocol";
10
+ import type { DevContextConfig, LifecycleConfig } from "./types.js";
11
+ /**
12
+ * Configuration for creating a mock player.
13
+ */
14
+ export interface MockPlayerConfig {
15
+ /**
16
+ * Enabled capabilities.
17
+ * @default ["storage", "proxy"]
18
+ */
19
+ capabilities?: string[];
20
+ /**
21
+ * Lifecycle timing configuration.
22
+ */
23
+ lifecycle?: LifecycleConfig;
24
+ /**
25
+ * Target window for communication.
26
+ * @default window
27
+ */
28
+ target?: Window;
29
+ /**
30
+ * Target origin for postMessage transport.
31
+ * @default "*"
32
+ */
33
+ targetOrigin?: string;
34
+ /**
35
+ * Pre-created transport to use instead of the default postMessage transport.
36
+ * When provided, `target` and `targetOrigin` are ignored for transport creation.
37
+ */
38
+ transport?: Transport;
39
+ /**
40
+ * Callback when app calls notifyComplete().
41
+ */
42
+ notifyComplete: () => void;
43
+ /**
44
+ * Callback when app calls notifyEstimatedEnd().
45
+ */
46
+ notifyEstimatedEnd: (expectedFinishTime: number) => void;
47
+ /**
48
+ * Callback when app calls notifyNoContent().
49
+ */
50
+ notifyNoContent: (options?: {
51
+ retryNotBefore?: number;
52
+ reason?: string;
53
+ }) => void;
54
+ /**
55
+ * Callback for app logging.
56
+ */
57
+ log: (level: LogLevel, message: string, data?: unknown) => void;
58
+ }
59
+ /**
60
+ * Build device info by merging defaults with user config.
61
+ *
62
+ * @param deviceConfig - Partial device configuration from user
63
+ * @returns Complete DeviceInfo object
64
+ */
65
+ export declare function buildDevice(deviceConfig?: Partial<DeviceInfo>): DeviceInfo;
66
+ /**
67
+ * Resolve capabilities from config into a list of enabled capabilities.
68
+ *
69
+ * @param capabilities - Capability config (can be undefined, ["all"], or specific list)
70
+ * @returns Array of enabled capability names
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * resolveCapabilities(["all"]) // => ["storage", "proxy", "mediaCache", "static"]
75
+ * resolveCapabilities(["storage"]) // => ["storage"]
76
+ * resolveCapabilities() // => ["storage", "proxy"] (default)
77
+ * ```
78
+ */
79
+ export declare function resolveCapabilities(capabilities?: string[]): Capability[];
80
+ /**
81
+ * Create capability services based on enabled capabilities.
82
+ *
83
+ * @param capabilities - List of capabilities to enable
84
+ * @returns Object with initialized service APIs
85
+ */
86
+ export declare function buildCapabilityServices(capabilities: Capability[]): CapabilityServices;
87
+ /**
88
+ * Build AppContext from dev configuration and capabilities.
89
+ *
90
+ * @param config - Context configuration from appstrata.config.ts
91
+ * @param capabilities - List of enabled capabilities
92
+ * @returns Complete AppContext object
93
+ *
94
+ */
95
+ export declare function buildAppContext(config: DevContextConfig, capabilities: Capability[]): AppContext;
96
+ /**
97
+ * Create a mock player for development.
98
+ *
99
+ * This creates an AppHost using the player-lib factory with mock services.
100
+ * The AppHost can be used to fire lifecycle events and update context.
101
+ *
102
+ * @param config - Mock player configuration
103
+ * @returns AppHost instance
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const host = createMockPlayer({
108
+ * target: iframe.contentWindow,
109
+ * targetOrigin: "http://localhost:3000",
110
+ * capabilities: ["storage", "proxy"],
111
+ * notifyComplete: () => {},
112
+ * log: (level, msg) => console.log(msg),
113
+ * });
114
+ * ```
115
+ */
116
+ export declare function createMockPlayer(config: MockPlayerConfig): AppHost;
117
+ //# sourceMappingURL=mock-player.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-player.d.ts","sourceRoot":"","sources":["../src/mock-player.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAiB,KAAK,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB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AE,gBAAgB,GAAG,OAAO,CA6BlE"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Mock player creation for development mode.
3
+ *
4
+ * Uses createAppHost from @appstrata/player-lib with mock services.
5
+ * Provides composable helpers for building mock contexts and capabilities.
6
+ */
7
+ import { createAppHost } from "@appstrata/player-lib";
8
+ import { createMockStorage, createMockProxy, createMockMediaCache, createMockStatic, } from "./mock-services.js";
9
+ /**
10
+ * Default device info for development.
11
+ */
12
+ const DEFAULT_DEVICE = {
13
+ id: "dev-player",
14
+ name: "Development Player",
15
+ type: "web-player",
16
+ platformName: "AppStrata Dev",
17
+ locale: "en-US",
18
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
19
+ };
20
+ /**
21
+ * Build device info by merging defaults with user config.
22
+ *
23
+ * @param deviceConfig - Partial device configuration from user
24
+ * @returns Complete DeviceInfo object
25
+ */
26
+ export function buildDevice(deviceConfig) {
27
+ return {
28
+ ...DEFAULT_DEVICE,
29
+ ...deviceConfig,
30
+ // Ensure required fields are present
31
+ locale: deviceConfig?.locale || DEFAULT_DEVICE.locale,
32
+ timezone: deviceConfig?.timezone || DEFAULT_DEVICE.timezone,
33
+ };
34
+ }
35
+ /**
36
+ * Resolve capabilities from config into a list of enabled capabilities.
37
+ *
38
+ * @param capabilities - Capability config (can be undefined, ["all"], or specific list)
39
+ * @returns Array of enabled capability names
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * resolveCapabilities(["all"]) // => ["storage", "proxy", "mediaCache", "static"]
44
+ * resolveCapabilities(["storage"]) // => ["storage"]
45
+ * resolveCapabilities() // => ["storage", "proxy"] (default)
46
+ * ```
47
+ */
48
+ export function resolveCapabilities(capabilities) {
49
+ if (!capabilities || capabilities.length === 0) {
50
+ // Default: enable storage and proxy
51
+ return ["storage", "proxy"];
52
+ }
53
+ if (capabilities.includes("all")) {
54
+ return ["storage", "proxy", "mediaCache", "static"];
55
+ }
56
+ return capabilities;
57
+ }
58
+ /**
59
+ * Create capability services based on enabled capabilities.
60
+ *
61
+ * @param capabilities - List of capabilities to enable
62
+ * @returns Object with initialized service APIs
63
+ */
64
+ export function buildCapabilityServices(capabilities) {
65
+ const services = {};
66
+ if (capabilities.includes("storage")) {
67
+ services.storage = createMockStorage();
68
+ }
69
+ if (capabilities.includes("proxy")) {
70
+ services.proxy = createMockProxy();
71
+ }
72
+ if (capabilities.includes("mediaCache")) {
73
+ services.mediaCache = createMockMediaCache();
74
+ }
75
+ if (capabilities.includes("static")) {
76
+ services.static = createMockStatic();
77
+ }
78
+ return services;
79
+ }
80
+ /**
81
+ * Build AppContext from dev configuration and capabilities.
82
+ *
83
+ * @param config - Context configuration from appstrata.config.ts
84
+ * @param capabilities - List of enabled capabilities
85
+ * @returns Complete AppContext object
86
+ *
87
+ */
88
+ export function buildAppContext(config, capabilities) {
89
+ return {
90
+ ...config,
91
+ hasCapability: (cap) => capabilities.includes(cap),
92
+ };
93
+ }
94
+ /**
95
+ * Create a mock player for development.
96
+ *
97
+ * This creates an AppHost using the player-lib factory with mock services.
98
+ * The AppHost can be used to fire lifecycle events and update context.
99
+ *
100
+ * @param config - Mock player configuration
101
+ * @returns AppHost instance
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const host = createMockPlayer({
106
+ * target: iframe.contentWindow,
107
+ * targetOrigin: "http://localhost:3000",
108
+ * capabilities: ["storage", "proxy"],
109
+ * notifyComplete: () => {},
110
+ * log: (level, msg) => console.log(msg),
111
+ * });
112
+ * ```
113
+ */
114
+ export function createMockPlayer(config) {
115
+ const { capabilities, target = window, targetOrigin, transport, notifyComplete, notifyEstimatedEnd, notifyNoContent, log, } = config;
116
+ // Resolve capabilities and create services
117
+ const enabledCapabilities = resolveCapabilities(capabilities);
118
+ const services = buildCapabilityServices(enabledCapabilities);
119
+ // Create the AppHost (same factory used by real players)
120
+ const host = createAppHost({
121
+ services,
122
+ target,
123
+ notifyComplete,
124
+ notifyEstimatedEnd,
125
+ notifyNoContent,
126
+ log,
127
+ ...(transport !== undefined && { transport }),
128
+ ...(targetOrigin !== undefined && { targetOrigin }),
129
+ });
130
+ return host;
131
+ }
132
+ //# sourceMappingURL=mock-player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-player.js","sourceRoot":"","sources":["../src/mock-player.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAyC,MAAM,uBAAuB,CAAC;AAG7F,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAyD5B;;GAEG;AACH,MAAM,cAAc,GAAe;IACjC,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,eAAe;IAC7B,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;CAC3D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,YAAkC;IAC5D,OAAO;QACL,GAAG,cAAc;QACjB,GAAG,YAAY;QACf,qCAAqC;QACrC,MAAM,EAAE,YAAY,EAAE,MAAM,IAAI,cAAc,CAAC,MAAM;QACrD,QAAQ,EAAE,YAAY,EAAE,QAAQ,IAAI,cAAc,CAAC,QAAQ;KAC5D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAuB;IACzD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/C,oCAAoC;QACpC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,YAA4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IAAI,GAAG,aAAa,CAAC;QACzB,QAAQ;QACR,MAAM;QACN,cAAc;QACd,kBAAkB;QAClB,eAAe;QACf,GAAG;QACH,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7C,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;KACpD,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Mock implementations of capability services for development.
3
+ */
4
+ import type { StorageApi, ProxyApi, MediaCacheApi, StaticApi } from "@appstrata/core";
5
+ /**
6
+ * Create an in-memory mock storage service.
7
+ *
8
+ * Data is stored in a Map and persists only for the current page session.
9
+ * Refreshing the page clears all storage.
10
+ */
11
+ export declare function createMockStorage(): StorageApi;
12
+ /**
13
+ * Create a passthrough mock proxy service.
14
+ *
15
+ * Uses native fetch directly. In dev mode, Vite's dev server can be configured
16
+ * to proxy API requests if CORS is an issue.
17
+ */
18
+ export declare function createMockProxy(): ProxyApi;
19
+ /**
20
+ * Create a mock media cache service.
21
+ *
22
+ * In dev mode, media files are not actually cached locally.
23
+ * This mock returns the original URLs as "local paths".
24
+ */
25
+ export declare function createMockMediaCache(): MediaCacheApi;
26
+ /**
27
+ * Create a mock static API service.
28
+ *
29
+ * In dev mode, static optimization is disabled (no screenshots taken).
30
+ */
31
+ export declare function createMockStatic(): StaticApi;
32
+ //# sourceMappingURL=mock-services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-services.d.ts","sourceRoot":"","sources":["../src/mock-services.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EAGR,aAAa,EAGb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAwB9C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,QAAQ,CA8C1C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,CAgDpD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,CAW5C"}