@vived/host 5.8.0 → 5.8.1

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.
@@ -4,6 +4,7 @@ exports.makeSandboxMounter = makeSandboxMounter;
4
4
  const core_1 = require("@vived/core");
5
5
  const AppSandboxEntity_1 = require("../../../AppSandbox/Entities/AppSandboxEntity");
6
6
  const HostDispatchEntity_1 = require("../../../Dispatcher/Entities/HostDispatchEntity");
7
+ const UCs_1 = require("../../../Dispatcher/UCs");
7
8
  const HostHandler_1 = require("../../../Handler/Entities/HostHandler");
8
9
  const AppEntity_1 = require("../../Entities/AppEntity");
9
10
  const MounterUC_1 = require("./MounterUC");
@@ -71,6 +72,26 @@ class SandboxMounterUC extends MounterUC_1.MounterUC {
71
72
  }
72
73
  return appVersion;
73
74
  }
75
+ /**
76
+ * Dispatches the App lifecycle teardown Requests, in order, while the App's
77
+ * handler is still registered.
78
+ */
79
+ dispatchTeardownToApp() {
80
+ const dispatchStopApp = UCs_1.DispatchStopAppUC.get(this.appObject);
81
+ if (dispatchStopApp) {
82
+ dispatchStopApp.doDispatch();
83
+ }
84
+ else {
85
+ this.error("Cannot find DispatchStopAppUC");
86
+ }
87
+ const dispatchDisposeApp = UCs_1.DispatchDisposeAppUC.get(this.appObject);
88
+ if (dispatchDisposeApp) {
89
+ dispatchDisposeApp.doDispatch();
90
+ }
91
+ else {
92
+ this.error("Cannot find DispatchDisposeAppUC");
93
+ }
94
+ }
74
95
  /**
75
96
  * Loads a script into the document.
76
97
  * This is a placeholder implementation for sandbox mounting.
@@ -166,12 +187,23 @@ class SandboxMounterUC extends MounterUC_1.MounterUC {
166
187
  };
167
188
  /**
168
189
  * Unmounts the app from the sandbox.
190
+ *
191
+ * Tells the App to tear itself down before the channel to it is severed:
192
+ * STOP_APP then DISPOSE_APP, matching the teardown order the asset-system
193
+ * plugin uses (CloseAssetSystemPluginUC). Ordering is load-bearing —
194
+ * clearAppHandler() unregisters the App's handler, after which a Request
195
+ * cannot reach the App at all.
196
+ *
197
+ * A missing dispatcher is reported but does not abort the unmount: leaving
198
+ * the Sandbox stuck in MOUNTED would be worse than an App that never heard
199
+ * it was being torn down.
169
200
  */
170
201
  this.unmount = () => {
171
202
  if (!this.sandbox || !this.hostDispatcher) {
172
203
  this.error("Missing Components");
173
204
  return;
174
205
  }
206
+ this.dispatchTeardownToApp();
175
207
  this.hostDispatcher.clearAppHandler();
176
208
  this.sandbox.state = AppSandboxEntity_1.SandboxState.UNMOUNTED;
177
209
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxMounterUC.js","sourceRoot":"","sources":["../../../../../src/Apps/UCs/Mounters/SandboxMounterUC.ts"],"names":[],"mappings":";;AAmBA,gDAEC;AArBD,sCAA6D;AAC7D,oFAGuD;AACvD,wFAAqF;AACrF,uEAA0E;AAC1E,wDAA+D;AAC/D,2CAAwC;AAExC;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,SAAoB;IACrD,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,gBAAiB,SAAQ,qBAAS;IACtC;;OAEG;IACH,IAAY,SAAS;QACnB,OAAO,IAAI,CAAC,uBAAuB,CAAY,qBAAS,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,IAAY,cAAc;QACxB,OAAO,IAAI,CAAC,uBAAuB,CACjC,uCAAkB,CAAC,IAAI,CACxB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,uBAAuB,CACjC,+BAAiB,CAAC,IAAI,CACvB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAY,OAAO;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAmB,mCAAgB,CAAC,IAAI,CAAC,CAAC;IAC1E,CAAC;IAwED;;;;;;OAMG;IACK,aAAa,CAAC,KAAa,EAAE,KAAa;QAChD,IAAI,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AC;YAED,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAChE,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;YAEnD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAE7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC7B,MAAM,YAAY,GAAG,GAAG,EAAE;oBACxB,IAAI,GAAG,CAAC,KAAK,KAAK,oBAAQ,CAAC,KAAK,EAAE,CAAC;wBACjC,OAAO,CAAC,KAAK,GAAG,+BAAY,CAAC,OAAO,CAAC;wBACrC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;wBACvC,OAAO,EAAE,CAAC;oBACZ,CAAC;gBACH,CAAC,CAAC;gBAEF,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBACpC,YAAY,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAiCF;;WAEG;QACH,YAAO,GAAG,GAAS,EAAE;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;YAEtC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,+BAAY,CAAC,SAAS,CAAC;QAC9C,CAAC,CAAC;IA8CF,CAAC;CACF","sourcesContent":["import { AppObject, Version, VIVEDApp_3 } from \"@vived/core\";\r\nimport {\r\n AppSandboxEntity,\r\n SandboxState\r\n} from \"../../../AppSandbox/Entities/AppSandboxEntity\";\r\nimport { HostDispatchEntity } from \"../../../Dispatcher/Entities/HostDispatchEntity\";\r\nimport { HostHandlerEntity } from \"../../../Handler/Entities/HostHandler\";\r\nimport { AppEntity, AppState } from \"../../Entities/AppEntity\";\r\nimport { MounterUC } from \"./MounterUC\";\r\n\r\n/**\r\n * Factory function to create a sandbox mounter for apps.\r\n *\r\n * The sandbox mounter is designed to mount apps in a sandboxed environment,\r\n * providing isolation and security for app execution.\r\n *\r\n * @param appObject - The app object to attach the mounter to\r\n * @returns A new SandboxMounterUC instance\r\n */\r\nexport function makeSandboxMounter(appObject: AppObject): MounterUC {\r\n return new SandboxMounterUC(appObject);\r\n}\r\n\r\n/**\r\n * Implementation of MounterUC for mounting apps in a sandbox environment.\r\n *\r\n * The SandboxMounterUC is responsible for safely loading and initializing apps\r\n * in a sandboxed context, handling app lifecycle events, and managing the\r\n * communication between the host and app.\r\n */\r\nclass SandboxMounterUC extends MounterUC {\r\n /**\r\n * Gets the app entity representing the app being mounted\r\n */\r\n private get appEntity() {\r\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Gets the host dispatcher entity for sending messages to apps\r\n */\r\n private get hostDispatcher() {\r\n return this.getCachedLocalComponent<HostDispatchEntity>(\r\n HostDispatchEntity.type\r\n );\r\n }\r\n\r\n /**\r\n * Gets the host handler entity for receiving messages from apps\r\n */\r\n private get hostHandler() {\r\n return this.getCachedLocalComponent<HostHandlerEntity>(\r\n HostHandlerEntity.type\r\n );\r\n }\r\n\r\n /**\r\n * Gets the sandbox entity that manages the sandbox state\r\n */\r\n private get sandbox() {\r\n return this.getCachedSingleton<AppSandboxEntity>(AppSandboxEntity.type);\r\n }\r\n\r\n /**\r\n * Mounts the latest version of the app.\r\n *\r\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\r\n */\r\n mountLatestVersion = (): Promise<void> => {\r\n if (!this.appEntity) {\r\n this.error(\"Missing Components\");\r\n return Promise.reject();\r\n }\r\n\r\n const version = this.appEntity.latestVersion;\r\n if (!version) {\r\n this.error(\"No Version\");\r\n return Promise.reject();\r\n }\r\n\r\n return this.mount(version.major, version.minor);\r\n };\r\n\r\n /**\r\n * Mounts a specific version of the app.\r\n *\r\n * @param majorVersion - The major version number\r\n * @param minorVersion - The minor version number\r\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\r\n */\r\n mount = (majorVersion: number, minorVersion: number): Promise<void> => {\r\n if (\r\n !this.appEntity ||\r\n !this.hostDispatcher ||\r\n !this.hostHandler ||\r\n !this.sandbox\r\n ) {\r\n this.error(\"Missing Components\");\r\n return Promise.reject();\r\n }\r\n\r\n const version = this.getAppVersion(majorVersion, minorVersion);\r\n if (!version) {\r\n this.error(\"No Version\");\r\n return Promise.reject();\r\n }\r\n\r\n const appInterface = this.getAppInterface(version);\r\n if (!appInterface) {\r\n this.error(\"No App Interface\");\r\n return Promise.reject();\r\n }\r\n\r\n const appHandler = appInterface.mount(this.hostHandler.handler);\r\n this.hostDispatcher.registerAppHandler(appHandler);\r\n\r\n const app = this.appEntity;\r\n const sandbox = this.sandbox;\r\n\r\n return new Promise((resolve) => {\r\n const waitForReady = () => {\r\n if (app.state === AppState.READY) {\r\n sandbox.state = SandboxState.MOUNTED;\r\n app.removeChangeObserver(waitForReady);\r\n resolve();\r\n }\r\n };\r\n\r\n app.addChangeObserver(waitForReady);\r\n waitForReady();\r\n });\r\n };\r\n\r\n /**\r\n * Helper method to find a specific version of the app.\r\n *\r\n * @param major - Major version number\r\n * @param minor - Minor version number\r\n * @returns The Version object or undefined if not found\r\n */\r\n private getAppVersion(major: number, minor: number): Version | undefined {\r\n if (!this.appEntity) {\r\n return;\r\n }\r\n\r\n let appVersion = Version.GetLatestWithMajorMinor(\r\n this.appEntity.versions,\r\n major,\r\n minor\r\n );\r\n\r\n if (!appVersion) {\r\n appVersion = Version.GetLatestWithMajor(this.appEntity.versions, major);\r\n }\r\n\r\n if (!appVersion) {\r\n this.error(\r\n `Unable to find version ${major}.${minor}.X for App ${this.appEntity.name}`\r\n );\r\n }\r\n\r\n return appVersion;\r\n }\r\n\r\n /**\r\n * Unmounts the app from the sandbox.\r\n */\r\n unmount = (): void => {\r\n if (!this.sandbox || !this.hostDispatcher) {\r\n this.error(\"Missing Components\");\r\n return;\r\n }\r\n\r\n this.hostDispatcher.clearAppHandler();\r\n\r\n this.sandbox.state = SandboxState.UNMOUNTED;\r\n };\r\n\r\n /**\r\n * Loads a script into the document.\r\n * This is a placeholder implementation for sandbox mounting.\r\n *\r\n * @param scriptURL - URL of the script to load\r\n * @param appIDWithVersion - Versioned ID of the app\r\n * @returns A promise that resolves when the script is loaded\r\n */\r\n loadScriptIntoDocument(\r\n scriptURL: string,\r\n appIDWithVersion: string\r\n ): Promise<void> {\r\n // Unused during dev\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Gets the app interface for a specific version.\r\n *\r\n * @param version - The version to get the interface for\r\n * @returns The app interface or undefined if not found\r\n */\r\n getAppInterface(version: Version): VIVEDApp_3 | undefined {\r\n const modifiedVersion = version.baseVersionString.split(\".\").join(\"_\");\r\n const idWithVersion = `${this.appObject.id}-${modifiedVersion}`;\r\n const appInterface = (window as any)[idWithVersion] as VIVEDApp_3;\r\n if (!appInterface) {\r\n this.appObjects.submitFatal(\r\n \"LocalMounterUC\",\r\n \"Unable to find App Interface\"\r\n );\r\n return;\r\n }\r\n\r\n return appInterface;\r\n }\r\n\r\n /**\r\n * Creates a new SandboxMounterUC instance.\r\n *\r\n * @param appObject - The app object to attach to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, MounterUC.type);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SandboxMounterUC.js","sourceRoot":"","sources":["../../../../../src/Apps/UCs/Mounters/SandboxMounterUC.ts"],"names":[],"mappings":";;AAuBA,gDAEC;AAzBD,sCAA6D;AAC7D,oFAGuD;AACvD,wFAAqF;AACrF,iDAGiC;AACjC,uEAA0E;AAC1E,wDAA+D;AAC/D,2CAAwC;AAExC;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,SAAoB;IACrD,O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IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;YAEnD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAE7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC7B,MAAM,YAAY,GAAG,GAAG,EAAE;oBACxB,IAAI,GAAG,CAAC,KAAK,KAAK,oBAAQ,CAAC,KAAK,EAAE,CAAC;wBACjC,OAAO,CAAC,KAAK,GAAG,+BAAY,CAAC,OAAO,CAAC;wBACrC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;wBACvC,OAAO,EAAE,CAAC;oBACZ,CAAC;gBACH,CAAC,CAAC;gBAEF,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBACpC,YAAY,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAiCF;;;;;;;;;;;;WAYG;QACH,YAAO,GAAG,GAAS,EAAE;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAE7B,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;YAEtC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,+BAAY,CAAC,SAAS,CAAC;QAC9C,CAAC,CAAC;IAkEF,CAAC;CACF","sourcesContent":["import { AppObject, Version, VIVEDApp_3 } from \"@vived/core\";\nimport {\n AppSandboxEntity,\n SandboxState\n} from \"../../../AppSandbox/Entities/AppSandboxEntity\";\nimport { HostDispatchEntity } from \"../../../Dispatcher/Entities/HostDispatchEntity\";\nimport {\n DispatchDisposeAppUC,\n DispatchStopAppUC\n} from \"../../../Dispatcher/UCs\";\nimport { HostHandlerEntity } from \"../../../Handler/Entities/HostHandler\";\nimport { AppEntity, AppState } from \"../../Entities/AppEntity\";\nimport { MounterUC } from \"./MounterUC\";\n\n/**\n * Factory function to create a sandbox mounter for apps.\n *\n * The sandbox mounter is designed to mount apps in a sandboxed environment,\n * providing isolation and security for app execution.\n *\n * @param appObject - The app object to attach the mounter to\n * @returns A new SandboxMounterUC instance\n */\nexport function makeSandboxMounter(appObject: AppObject): MounterUC {\n return new SandboxMounterUC(appObject);\n}\n\n/**\n * Implementation of MounterUC for mounting apps in a sandbox environment.\n *\n * The SandboxMounterUC is responsible for safely loading and initializing apps\n * in a sandboxed context, handling app lifecycle events, and managing the\n * communication between the host and app.\n */\nclass SandboxMounterUC extends MounterUC {\n /**\n * Gets the app entity representing the app being mounted\n */\n private get appEntity() {\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\n }\n\n /**\n * Gets the host dispatcher entity for sending messages to apps\n */\n private get hostDispatcher() {\n return this.getCachedLocalComponent<HostDispatchEntity>(\n HostDispatchEntity.type\n );\n }\n\n /**\n * Gets the host handler entity for receiving messages from apps\n */\n private get hostHandler() {\n return this.getCachedLocalComponent<HostHandlerEntity>(\n HostHandlerEntity.type\n );\n }\n\n /**\n * Gets the sandbox entity that manages the sandbox state\n */\n private get sandbox() {\n return this.getCachedSingleton<AppSandboxEntity>(AppSandboxEntity.type);\n }\n\n /**\n * Mounts the latest version of the app.\n *\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\n */\n mountLatestVersion = (): Promise<void> => {\n if (!this.appEntity) {\n this.error(\"Missing Components\");\n return Promise.reject();\n }\n\n const version = this.appEntity.latestVersion;\n if (!version) {\n this.error(\"No Version\");\n return Promise.reject();\n }\n\n return this.mount(version.major, version.minor);\n };\n\n /**\n * Mounts a specific version of the app.\n *\n * @param majorVersion - The major version number\n * @param minorVersion - The minor version number\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\n */\n mount = (majorVersion: number, minorVersion: number): Promise<void> => {\n if (\n !this.appEntity ||\n !this.hostDispatcher ||\n !this.hostHandler ||\n !this.sandbox\n ) {\n this.error(\"Missing Components\");\n return Promise.reject();\n }\n\n const version = this.getAppVersion(majorVersion, minorVersion);\n if (!version) {\n this.error(\"No Version\");\n return Promise.reject();\n }\n\n const appInterface = this.getAppInterface(version);\n if (!appInterface) {\n this.error(\"No App Interface\");\n return Promise.reject();\n }\n\n const appHandler = appInterface.mount(this.hostHandler.handler);\n this.hostDispatcher.registerAppHandler(appHandler);\n\n const app = this.appEntity;\n const sandbox = this.sandbox;\n\n return new Promise((resolve) => {\n const waitForReady = () => {\n if (app.state === AppState.READY) {\n sandbox.state = SandboxState.MOUNTED;\n app.removeChangeObserver(waitForReady);\n resolve();\n }\n };\n\n app.addChangeObserver(waitForReady);\n waitForReady();\n });\n };\n\n /**\n * Helper method to find a specific version of the app.\n *\n * @param major - Major version number\n * @param minor - Minor version number\n * @returns The Version object or undefined if not found\n */\n private getAppVersion(major: number, minor: number): Version | undefined {\n if (!this.appEntity) {\n return;\n }\n\n let appVersion = Version.GetLatestWithMajorMinor(\n this.appEntity.versions,\n major,\n minor\n );\n\n if (!appVersion) {\n appVersion = Version.GetLatestWithMajor(this.appEntity.versions, major);\n }\n\n if (!appVersion) {\n this.error(\n `Unable to find version ${major}.${minor}.X for App ${this.appEntity.name}`\n );\n }\n\n return appVersion;\n }\n\n /**\n * Unmounts the app from the sandbox.\n *\n * Tells the App to tear itself down before the channel to it is severed:\n * STOP_APP then DISPOSE_APP, matching the teardown order the asset-system\n * plugin uses (CloseAssetSystemPluginUC). Ordering is load-bearing —\n * clearAppHandler() unregisters the App's handler, after which a Request\n * cannot reach the App at all.\n *\n * A missing dispatcher is reported but does not abort the unmount: leaving\n * the Sandbox stuck in MOUNTED would be worse than an App that never heard\n * it was being torn down.\n */\n unmount = (): void => {\n if (!this.sandbox || !this.hostDispatcher) {\n this.error(\"Missing Components\");\n return;\n }\n\n this.dispatchTeardownToApp();\n\n this.hostDispatcher.clearAppHandler();\n\n this.sandbox.state = SandboxState.UNMOUNTED;\n };\n\n /**\n * Dispatches the App lifecycle teardown Requests, in order, while the App's\n * handler is still registered.\n */\n private dispatchTeardownToApp(): void {\n const dispatchStopApp = DispatchStopAppUC.get(this.appObject);\n if (dispatchStopApp) {\n dispatchStopApp.doDispatch();\n } else {\n this.error(\"Cannot find DispatchStopAppUC\");\n }\n\n const dispatchDisposeApp = DispatchDisposeAppUC.get(this.appObject);\n if (dispatchDisposeApp) {\n dispatchDisposeApp.doDispatch();\n } else {\n this.error(\"Cannot find DispatchDisposeAppUC\");\n }\n }\n\n /**\n * Loads a script into the document.\n * This is a placeholder implementation for sandbox mounting.\n *\n * @param scriptURL - URL of the script to load\n * @param appIDWithVersion - Versioned ID of the app\n * @returns A promise that resolves when the script is loaded\n */\n loadScriptIntoDocument(\n scriptURL: string,\n appIDWithVersion: string\n ): Promise<void> {\n // Unused during dev\n return Promise.resolve();\n }\n\n /**\n * Gets the app interface for a specific version.\n *\n * @param version - The version to get the interface for\n * @returns The app interface or undefined if not found\n */\n getAppInterface(version: Version): VIVEDApp_3 | undefined {\n const modifiedVersion = version.baseVersionString.split(\".\").join(\"_\");\n const idWithVersion = `${this.appObject.id}-${modifiedVersion}`;\n const appInterface = (window as any)[idWithVersion] as VIVEDApp_3;\n if (!appInterface) {\n this.appObjects.submitFatal(\n \"LocalMounterUC\",\n \"Unable to find App Interface\"\n );\n return;\n }\n\n return appInterface;\n }\n\n /**\n * Creates a new SandboxMounterUC instance.\n *\n * @param appObject - The app object to attach to\n */\n constructor(appObject: AppObject) {\n super(appObject, MounterUC.type);\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Version } from "@vived/core";
2
2
  import { AppSandboxEntity, SandboxState } from "../../../AppSandbox/Entities/AppSandboxEntity";
3
3
  import { HostDispatchEntity } from "../../../Dispatcher/Entities/HostDispatchEntity";
4
+ import { DispatchDisposeAppUC, DispatchStopAppUC } from "../../../Dispatcher/UCs";
4
5
  import { HostHandlerEntity } from "../../../Handler/Entities/HostHandler";
5
6
  import { AppEntity, AppState } from "../../Entities/AppEntity";
6
7
  import { MounterUC } from "./MounterUC";
@@ -68,6 +69,26 @@ class SandboxMounterUC extends MounterUC {
68
69
  }
69
70
  return appVersion;
70
71
  }
72
+ /**
73
+ * Dispatches the App lifecycle teardown Requests, in order, while the App's
74
+ * handler is still registered.
75
+ */
76
+ dispatchTeardownToApp() {
77
+ const dispatchStopApp = DispatchStopAppUC.get(this.appObject);
78
+ if (dispatchStopApp) {
79
+ dispatchStopApp.doDispatch();
80
+ }
81
+ else {
82
+ this.error("Cannot find DispatchStopAppUC");
83
+ }
84
+ const dispatchDisposeApp = DispatchDisposeAppUC.get(this.appObject);
85
+ if (dispatchDisposeApp) {
86
+ dispatchDisposeApp.doDispatch();
87
+ }
88
+ else {
89
+ this.error("Cannot find DispatchDisposeAppUC");
90
+ }
91
+ }
71
92
  /**
72
93
  * Loads a script into the document.
73
94
  * This is a placeholder implementation for sandbox mounting.
@@ -163,12 +184,23 @@ class SandboxMounterUC extends MounterUC {
163
184
  };
164
185
  /**
165
186
  * Unmounts the app from the sandbox.
187
+ *
188
+ * Tells the App to tear itself down before the channel to it is severed:
189
+ * STOP_APP then DISPOSE_APP, matching the teardown order the asset-system
190
+ * plugin uses (CloseAssetSystemPluginUC). Ordering is load-bearing —
191
+ * clearAppHandler() unregisters the App's handler, after which a Request
192
+ * cannot reach the App at all.
193
+ *
194
+ * A missing dispatcher is reported but does not abort the unmount: leaving
195
+ * the Sandbox stuck in MOUNTED would be worse than an App that never heard
196
+ * it was being torn down.
166
197
  */
167
198
  this.unmount = () => {
168
199
  if (!this.sandbox || !this.hostDispatcher) {
169
200
  this.error("Missing Components");
170
201
  return;
171
202
  }
203
+ this.dispatchTeardownToApp();
172
204
  this.hostDispatcher.clearAppHandler();
173
205
  this.sandbox.state = SandboxState.UNMOUNTED;
174
206
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxMounterUC.js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AC,CAAC;YAEnD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAE7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC7B,MAAM,YAAY,GAAG,GAAG,EAAE;oBACxB,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;wBACjC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC;wBACrC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;wBACvC,OAAO,EAAE,CAAC;oBACZ,CAAC;gBACH,CAAC,CAAC;gBAEF,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBACpC,YAAY,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAiCF;;WAEG;QACH,YAAO,GAAG,GAAS,EAAE;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;YAEtC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC;QAC9C,CAAC,CAAC;IA8CF,CAAC;CACF","sourcesContent":["import { AppObject, Version, VIVEDApp_3 } from \"@vived/core\";\r\nimport {\r\n AppSandboxEntity,\r\n SandboxState\r\n} from \"../../../AppSandbox/Entities/AppSandboxEntity\";\r\nimport { HostDispatchEntity } from \"../../../Dispatcher/Entities/HostDispatchEntity\";\r\nimport { HostHandlerEntity } from \"../../../Handler/Entities/HostHandler\";\r\nimport { AppEntity, AppState } from \"../../Entities/AppEntity\";\r\nimport { MounterUC } from \"./MounterUC\";\r\n\r\n/**\r\n * Factory function to create a sandbox mounter for apps.\r\n *\r\n * The sandbox mounter is designed to mount apps in a sandboxed environment,\r\n * providing isolation and security for app execution.\r\n *\r\n * @param appObject - The app object to attach the mounter to\r\n * @returns A new SandboxMounterUC instance\r\n */\r\nexport function makeSandboxMounter(appObject: AppObject): MounterUC {\r\n return new SandboxMounterUC(appObject);\r\n}\r\n\r\n/**\r\n * Implementation of MounterUC for mounting apps in a sandbox environment.\r\n *\r\n * The SandboxMounterUC is responsible for safely loading and initializing apps\r\n * in a sandboxed context, handling app lifecycle events, and managing the\r\n * communication between the host and app.\r\n */\r\nclass SandboxMounterUC extends MounterUC {\r\n /**\r\n * Gets the app entity representing the app being mounted\r\n */\r\n private get appEntity() {\r\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Gets the host dispatcher entity for sending messages to apps\r\n */\r\n private get hostDispatcher() {\r\n return this.getCachedLocalComponent<HostDispatchEntity>(\r\n HostDispatchEntity.type\r\n );\r\n }\r\n\r\n /**\r\n * Gets the host handler entity for receiving messages from apps\r\n */\r\n private get hostHandler() {\r\n return this.getCachedLocalComponent<HostHandlerEntity>(\r\n HostHandlerEntity.type\r\n );\r\n }\r\n\r\n /**\r\n * Gets the sandbox entity that manages the sandbox state\r\n */\r\n private get sandbox() {\r\n return this.getCachedSingleton<AppSandboxEntity>(AppSandboxEntity.type);\r\n }\r\n\r\n /**\r\n * Mounts the latest version of the app.\r\n *\r\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\r\n */\r\n mountLatestVersion = (): Promise<void> => {\r\n if (!this.appEntity) {\r\n this.error(\"Missing Components\");\r\n return Promise.reject();\r\n }\r\n\r\n const version = this.appEntity.latestVersion;\r\n if (!version) {\r\n this.error(\"No Version\");\r\n return Promise.reject();\r\n }\r\n\r\n return this.mount(version.major, version.minor);\r\n };\r\n\r\n /**\r\n * Mounts a specific version of the app.\r\n *\r\n * @param majorVersion - The major version number\r\n * @param minorVersion - The minor version number\r\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\r\n */\r\n mount = (majorVersion: number, minorVersion: number): Promise<void> => {\r\n if (\r\n !this.appEntity ||\r\n !this.hostDispatcher ||\r\n !this.hostHandler ||\r\n !this.sandbox\r\n ) {\r\n this.error(\"Missing Components\");\r\n return Promise.reject();\r\n }\r\n\r\n const version = this.getAppVersion(majorVersion, minorVersion);\r\n if (!version) {\r\n this.error(\"No Version\");\r\n return Promise.reject();\r\n }\r\n\r\n const appInterface = this.getAppInterface(version);\r\n if (!appInterface) {\r\n this.error(\"No App Interface\");\r\n return Promise.reject();\r\n }\r\n\r\n const appHandler = appInterface.mount(this.hostHandler.handler);\r\n this.hostDispatcher.registerAppHandler(appHandler);\r\n\r\n const app = this.appEntity;\r\n const sandbox = this.sandbox;\r\n\r\n return new Promise((resolve) => {\r\n const waitForReady = () => {\r\n if (app.state === AppState.READY) {\r\n sandbox.state = SandboxState.MOUNTED;\r\n app.removeChangeObserver(waitForReady);\r\n resolve();\r\n }\r\n };\r\n\r\n app.addChangeObserver(waitForReady);\r\n waitForReady();\r\n });\r\n };\r\n\r\n /**\r\n * Helper method to find a specific version of the app.\r\n *\r\n * @param major - Major version number\r\n * @param minor - Minor version number\r\n * @returns The Version object or undefined if not found\r\n */\r\n private getAppVersion(major: number, minor: number): Version | undefined {\r\n if (!this.appEntity) {\r\n return;\r\n }\r\n\r\n let appVersion = Version.GetLatestWithMajorMinor(\r\n this.appEntity.versions,\r\n major,\r\n minor\r\n );\r\n\r\n if (!appVersion) {\r\n appVersion = Version.GetLatestWithMajor(this.appEntity.versions, major);\r\n }\r\n\r\n if (!appVersion) {\r\n this.error(\r\n `Unable to find version ${major}.${minor}.X for App ${this.appEntity.name}`\r\n );\r\n }\r\n\r\n return appVersion;\r\n }\r\n\r\n /**\r\n * Unmounts the app from the sandbox.\r\n */\r\n unmount = (): void => {\r\n if (!this.sandbox || !this.hostDispatcher) {\r\n this.error(\"Missing Components\");\r\n return;\r\n }\r\n\r\n this.hostDispatcher.clearAppHandler();\r\n\r\n this.sandbox.state = SandboxState.UNMOUNTED;\r\n };\r\n\r\n /**\r\n * Loads a script into the document.\r\n * This is a placeholder implementation for sandbox mounting.\r\n *\r\n * @param scriptURL - URL of the script to load\r\n * @param appIDWithVersion - Versioned ID of the app\r\n * @returns A promise that resolves when the script is loaded\r\n */\r\n loadScriptIntoDocument(\r\n scriptURL: string,\r\n appIDWithVersion: string\r\n ): Promise<void> {\r\n // Unused during dev\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Gets the app interface for a specific version.\r\n *\r\n * @param version - The version to get the interface for\r\n * @returns The app interface or undefined if not found\r\n */\r\n getAppInterface(version: Version): VIVEDApp_3 | undefined {\r\n const modifiedVersion = version.baseVersionString.split(\".\").join(\"_\");\r\n const idWithVersion = `${this.appObject.id}-${modifiedVersion}`;\r\n const appInterface = (window as any)[idWithVersion] as VIVEDApp_3;\r\n if (!appInterface) {\r\n this.appObjects.submitFatal(\r\n \"LocalMounterUC\",\r\n \"Unable to find App Interface\"\r\n );\r\n return;\r\n }\r\n\r\n return appInterface;\r\n }\r\n\r\n /**\r\n * Creates a new SandboxMounterUC instance.\r\n *\r\n * @param appObject - The app object to attach to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, MounterUC.type);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SandboxMounterUC.js","sourceRoot":"","sources":["../../../../../src/Apps/UCs/Mounters/SandboxMounterUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAc,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,YAAY,EACb,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAA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SandboxEntity\";\nimport { HostDispatchEntity } from \"../../../Dispatcher/Entities/HostDispatchEntity\";\nimport {\n DispatchDisposeAppUC,\n DispatchStopAppUC\n} from \"../../../Dispatcher/UCs\";\nimport { HostHandlerEntity } from \"../../../Handler/Entities/HostHandler\";\nimport { AppEntity, AppState } from \"../../Entities/AppEntity\";\nimport { MounterUC } from \"./MounterUC\";\n\n/**\n * Factory function to create a sandbox mounter for apps.\n *\n * The sandbox mounter is designed to mount apps in a sandboxed environment,\n * providing isolation and security for app execution.\n *\n * @param appObject - The app object to attach the mounter to\n * @returns A new SandboxMounterUC instance\n */\nexport function makeSandboxMounter(appObject: AppObject): MounterUC {\n return new SandboxMounterUC(appObject);\n}\n\n/**\n * Implementation of MounterUC for mounting apps in a sandbox environment.\n *\n * The SandboxMounterUC is responsible for safely loading and initializing apps\n * in a sandboxed context, handling app lifecycle events, and managing the\n * communication between the host and app.\n */\nclass SandboxMounterUC extends MounterUC {\n /**\n * Gets the app entity representing the app being mounted\n */\n private get appEntity() {\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\n }\n\n /**\n * Gets the host dispatcher entity for sending messages to apps\n */\n private get hostDispatcher() {\n return this.getCachedLocalComponent<HostDispatchEntity>(\n HostDispatchEntity.type\n );\n }\n\n /**\n * Gets the host handler entity for receiving messages from apps\n */\n private get hostHandler() {\n return this.getCachedLocalComponent<HostHandlerEntity>(\n HostHandlerEntity.type\n );\n }\n\n /**\n * Gets the sandbox entity that manages the sandbox state\n */\n private get sandbox() {\n return this.getCachedSingleton<AppSandboxEntity>(AppSandboxEntity.type);\n }\n\n /**\n * Mounts the latest version of the app.\n *\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\n */\n mountLatestVersion = (): Promise<void> => {\n if (!this.appEntity) {\n this.error(\"Missing Components\");\n return Promise.reject();\n }\n\n const version = this.appEntity.latestVersion;\n if (!version) {\n this.error(\"No Version\");\n return Promise.reject();\n }\n\n return this.mount(version.major, version.minor);\n };\n\n /**\n * Mounts a specific version of the app.\n *\n * @param majorVersion - The major version number\n * @param minorVersion - The minor version number\n * @returns A promise that resolves when the app is mounted or rejects if an error occurs\n */\n mount = (majorVersion: number, minorVersion: number): Promise<void> => {\n if (\n !this.appEntity ||\n !this.hostDispatcher ||\n !this.hostHandler ||\n !this.sandbox\n ) {\n this.error(\"Missing Components\");\n return Promise.reject();\n }\n\n const version = this.getAppVersion(majorVersion, minorVersion);\n if (!version) {\n this.error(\"No Version\");\n return Promise.reject();\n }\n\n const appInterface = this.getAppInterface(version);\n if (!appInterface) {\n this.error(\"No App Interface\");\n return Promise.reject();\n }\n\n const appHandler = appInterface.mount(this.hostHandler.handler);\n this.hostDispatcher.registerAppHandler(appHandler);\n\n const app = this.appEntity;\n const sandbox = this.sandbox;\n\n return new Promise((resolve) => {\n const waitForReady = () => {\n if (app.state === AppState.READY) {\n sandbox.state = SandboxState.MOUNTED;\n app.removeChangeObserver(waitForReady);\n resolve();\n }\n };\n\n app.addChangeObserver(waitForReady);\n waitForReady();\n });\n };\n\n /**\n * Helper method to find a specific version of the app.\n *\n * @param major - Major version number\n * @param minor - Minor version number\n * @returns The Version object or undefined if not found\n */\n private getAppVersion(major: number, minor: number): Version | undefined {\n if (!this.appEntity) {\n return;\n }\n\n let appVersion = Version.GetLatestWithMajorMinor(\n this.appEntity.versions,\n major,\n minor\n );\n\n if (!appVersion) {\n appVersion = Version.GetLatestWithMajor(this.appEntity.versions, major);\n }\n\n if (!appVersion) {\n this.error(\n `Unable to find version ${major}.${minor}.X for App ${this.appEntity.name}`\n );\n }\n\n return appVersion;\n }\n\n /**\n * Unmounts the app from the sandbox.\n *\n * Tells the App to tear itself down before the channel to it is severed:\n * STOP_APP then DISPOSE_APP, matching the teardown order the asset-system\n * plugin uses (CloseAssetSystemPluginUC). Ordering is load-bearing —\n * clearAppHandler() unregisters the App's handler, after which a Request\n * cannot reach the App at all.\n *\n * A missing dispatcher is reported but does not abort the unmount: leaving\n * the Sandbox stuck in MOUNTED would be worse than an App that never heard\n * it was being torn down.\n */\n unmount = (): void => {\n if (!this.sandbox || !this.hostDispatcher) {\n this.error(\"Missing Components\");\n return;\n }\n\n this.dispatchTeardownToApp();\n\n this.hostDispatcher.clearAppHandler();\n\n this.sandbox.state = SandboxState.UNMOUNTED;\n };\n\n /**\n * Dispatches the App lifecycle teardown Requests, in order, while the App's\n * handler is still registered.\n */\n private dispatchTeardownToApp(): void {\n const dispatchStopApp = DispatchStopAppUC.get(this.appObject);\n if (dispatchStopApp) {\n dispatchStopApp.doDispatch();\n } else {\n this.error(\"Cannot find DispatchStopAppUC\");\n }\n\n const dispatchDisposeApp = DispatchDisposeAppUC.get(this.appObject);\n if (dispatchDisposeApp) {\n dispatchDisposeApp.doDispatch();\n } else {\n this.error(\"Cannot find DispatchDisposeAppUC\");\n }\n }\n\n /**\n * Loads a script into the document.\n * This is a placeholder implementation for sandbox mounting.\n *\n * @param scriptURL - URL of the script to load\n * @param appIDWithVersion - Versioned ID of the app\n * @returns A promise that resolves when the script is loaded\n */\n loadScriptIntoDocument(\n scriptURL: string,\n appIDWithVersion: string\n ): Promise<void> {\n // Unused during dev\n return Promise.resolve();\n }\n\n /**\n * Gets the app interface for a specific version.\n *\n * @param version - The version to get the interface for\n * @returns The app interface or undefined if not found\n */\n getAppInterface(version: Version): VIVEDApp_3 | undefined {\n const modifiedVersion = version.baseVersionString.split(\".\").join(\"_\");\n const idWithVersion = `${this.appObject.id}-${modifiedVersion}`;\n const appInterface = (window as any)[idWithVersion] as VIVEDApp_3;\n if (!appInterface) {\n this.appObjects.submitFatal(\n \"LocalMounterUC\",\n \"Unable to find App Interface\"\n );\n return;\n }\n\n return appInterface;\n }\n\n /**\n * Creates a new SandboxMounterUC instance.\n *\n * @param appObject - The app object to attach to\n */\n constructor(appObject: AppObject) {\n super(appObject, MounterUC.type);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxMounterUC.d.ts","sourceRoot":"","sources":["../../../../../src/Apps/UCs/Mounters/SandboxMounterUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAQ7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAElE"}
1
+ {"version":3,"file":"SandboxMounterUC.d.ts","sourceRoot":"","sources":["../../../../../src/Apps/UCs/Mounters/SandboxMounterUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAY7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAElE"}
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
- {
2
- "name": "@vived/host",
3
- "version": "5.8.0",
4
- "description": "Public Host package for the VIVED Learning App system",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.js",
7
- "types": "./dist/types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/esm/index.js",
11
- "require": "./dist/cjs/index.js",
12
- "types": "./dist/types/index.d.ts"
13
- }
14
- },
15
- "scripts": {
16
- "test": "jest --watch --config jestconfig.json",
17
- "test:once": "jest --config jestconfig.json",
18
- "test:unit": "jest --config jestconfig.json --testMatch \"**/?(*.)+(test).+(ts|tsx|js)\" --watch",
19
- "test:unit:once": "jest --config jestconfig.json --testMatch \"**/?(*.)+(test).+(ts|tsx|js)\"",
20
- "test:integration": "jest --config jestconfig.json --testMatch \"**/__tests__/integration/**/*.+(ts|tsx|js)\" --watch",
21
- "test:integration:once": "jest --config jestconfig.json --testMatch \"**/__tests__/integration/**/*.+(ts|tsx|js)\"",
22
- "build": "npm run build:esm && npm run build:cjs",
23
- "build:esm": "tsc",
24
- "build:cjs": "tsc -p tsconfig.cjs.json",
25
- "format": "prettier --write",
26
- "format:all": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
27
- "lint": "tslint -p tsconfig.json",
28
- "prepare": "npm run build",
29
- "prepublishOnly": "npm run test:once && npm run test:integration:once && npm run lint",
30
- "preversion": "npm run lint",
31
- "version": "npm run format && git add -A src",
32
- "postversion": "git push && git push --tags"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "git+https://bitbucket.org/cyberscience3d/vivedlearning_host.git"
37
- },
38
- "keywords": [
39
- "VIVED"
40
- ],
41
- "author": "Amos Patrick",
42
- "license": "ISC",
43
- "homepage": "https://bitbucket.org/cyberscience3d/vivedlearning_host#readme",
44
- "devDependencies": {
45
- "@types/jest": "^29.5.14",
46
- "jest": "^29.7.0",
47
- "jest-environment-jsdom": "^29.7.0",
48
- "jsdom": "^26.0.0",
49
- "prettier": "^3.5.3",
50
- "ts-jest": "^29.2.6",
51
- "tslint": "^6.1.3",
52
- "tslint-config-prettier": "^1.18.0",
53
- "typescript": "^5.8.2"
54
- },
55
- "files": [
56
- "dist"
57
- ],
58
- "publishConfig": {
59
- "access": "public"
60
- },
61
- "dependencies": {
62
- "@types/webxr": "^0.5.20"
63
- },
64
- "peerDependencies": {
65
- "@vived/core": "^2.0.1"
66
- }
67
- }
1
+ {
2
+ "name": "@vived/host",
3
+ "version": "5.8.1",
4
+ "description": "Public Host package for the VIVED Learning App system",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/esm/index.js",
11
+ "require": "./dist/cjs/index.js",
12
+ "types": "./dist/types/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "test": "jest --watch --config jestconfig.json",
17
+ "test:once": "jest --config jestconfig.json",
18
+ "test:unit": "jest --config jestconfig.json --testMatch \"**/?(*.)+(test).+(ts|tsx|js)\" --watch",
19
+ "test:unit:once": "jest --config jestconfig.json --testMatch \"**/?(*.)+(test).+(ts|tsx|js)\"",
20
+ "test:integration": "jest --config jestconfig.json --testMatch \"**/__tests__/integration/**/*.+(ts|tsx|js)\" --watch",
21
+ "test:integration:once": "jest --config jestconfig.json --testMatch \"**/__tests__/integration/**/*.+(ts|tsx|js)\"",
22
+ "build": "npm run build:esm && npm run build:cjs",
23
+ "build:esm": "tsc",
24
+ "build:cjs": "tsc -p tsconfig.cjs.json",
25
+ "format": "prettier --write",
26
+ "format:all": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
27
+ "lint": "tslint -p tsconfig.json",
28
+ "prepare": "npm run build",
29
+ "prepublishOnly": "npm run test:once && npm run test:integration:once && npm run lint",
30
+ "preversion": "npm run lint",
31
+ "version": "npm run format && git add -A src",
32
+ "postversion": "git push && git push --tags"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://bitbucket.org/cyberscience3d/vivedlearning_host.git"
37
+ },
38
+ "keywords": [
39
+ "VIVED"
40
+ ],
41
+ "author": "Amos Patrick",
42
+ "license": "ISC",
43
+ "homepage": "https://bitbucket.org/cyberscience3d/vivedlearning_host#readme",
44
+ "devDependencies": {
45
+ "@types/jest": "^29.5.14",
46
+ "jest": "^29.7.0",
47
+ "jest-environment-jsdom": "^29.7.0",
48
+ "jsdom": "^26.0.0",
49
+ "prettier": "^3.5.3",
50
+ "ts-jest": "^29.2.6",
51
+ "tslint": "^6.1.3",
52
+ "tslint-config-prettier": "^1.18.0",
53
+ "typescript": "^5.8.2"
54
+ },
55
+ "files": [
56
+ "dist"
57
+ ],
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "dependencies": {
62
+ "@types/webxr": "^0.5.20"
63
+ },
64
+ "peerDependencies": {
65
+ "@vived/core": "^2.0.1"
66
+ }
67
+ }