@mittwald/ext-bridge 1.5.0-next.9 → 1.6.0-next.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.
@@ -6,17 +6,22 @@ import { extractHostConfig } from "./config/extractHostConfig.mjs";
6
6
  //#region src/readiness.ts
7
7
  var timeoutMs = 7500;
8
8
  var [readiness, resolveReadiness] = controllablePromise();
9
- var [timoutPromise, , rejectOnTimeout] = controllablePromise();
10
- var startTimeout = () => {
11
- setTimeout(() => {
12
- rejectOnTimeout(new ExtBridgeError(`Ext Bridge not ready after ${timeoutMs}ms`));
13
- }, timeoutMs);
14
- return timoutPromise;
15
- };
16
9
  var readinessApi = {
17
10
  isReady: async () => {
18
11
  assertBrowserEnv();
19
- await Promise.race([readiness, startTimeout()]);
12
+ let timeoutId;
13
+ try {
14
+ await Promise.race([readiness, new Promise((_, reject) => {
15
+ timeoutId = setTimeout(() => {
16
+ reject(new ExtBridgeError(`Ext Bridge not ready after ${timeoutMs}ms`));
17
+ }, timeoutMs);
18
+ })]);
19
+ } catch (error) {
20
+ if (mwExtBridge.connection === void 0) throw new ExtBridgeError(`Ext Bridge not ready after ${timeoutMs}ms: the host never connected. Make sure the extension renders <RemoteRoot> and runs inside mStudio.`);
21
+ throw error;
22
+ } finally {
23
+ if (timeoutId !== void 0) clearTimeout(timeoutId);
24
+ }
20
25
  },
21
26
  setIsReady: async () => {
22
27
  const config = await mwExtBridge.connection.getConfig();
@@ -1 +1 @@
1
- {"version":3,"file":"readiness.mjs","names":[],"sources":["../../src/readiness.ts"],"sourcesContent":["import { parseConfig } from \"@/config/parse\";\nimport { ExtBridgeError } from \"@/error\";\nimport { assertBrowserEnv } from \"@/lib/assertBrowserEnv\";\nimport { controllablePromise } from \"@/lib/controllablePromise\";\nimport { extractHostConfig } from \"./config/extractHostConfig\";\n\nconst timeoutMs = 7500;\n\nconst [readiness, resolveReadiness] = controllablePromise();\nconst [timoutPromise, , rejectOnTimeout] = controllablePromise();\n\nconst startTimeout = () => {\n setTimeout(() => {\n rejectOnTimeout(\n new ExtBridgeError(`Ext Bridge not ready after ${timeoutMs}ms`),\n );\n }, timeoutMs);\n return timoutPromise;\n};\n\nexport const readinessApi = {\n isReady: async () => {\n assertBrowserEnv();\n await Promise.race([readiness, startTimeout()]);\n },\n setIsReady: async () => {\n const config = await mwExtBridge.connection.getConfig();\n\n const parsedConfig = parseConfig(config);\n const hostConfig = extractHostConfig(config);\n mwExtBridge.config = {\n ...parsedConfig,\n ...hostConfig,\n };\n\n resolveReadiness();\n },\n} as const;\n"],"mappings":";;;;;;AAMA,IAAM,YAAY;AAElB,IAAM,CAAC,WAAW,oBAAoB,oBAAoB;AAC1D,IAAM,CAAC,iBAAiB,mBAAmB,oBAAoB;AAE/D,IAAM,qBAAqB;CACzB,iBAAiB;EACf,gBACE,IAAI,eAAe,8BAA8B,UAAU,GAAG,CAChE;CACF,GAAG,SAAS;CACZ,OAAO;AACT;AAEA,IAAa,eAAe;CAC1B,SAAS,YAAY;EACnB,iBAAiB;EACjB,MAAM,QAAQ,KAAK,CAAC,WAAW,aAAa,CAAC,CAAC;CAChD;CACA,YAAY,YAAY;EACtB,MAAM,SAAS,MAAM,YAAY,WAAW,UAAU;EAEtD,MAAM,eAAe,YAAY,MAAM;EACvC,MAAM,aAAa,kBAAkB,MAAM;EAC3C,YAAY,SAAS;GACnB,GAAG;GACH,GAAG;EACL;EAEA,iBAAiB;CACnB;AACF"}
1
+ {"version":3,"file":"readiness.mjs","names":[],"sources":["../../src/readiness.ts"],"sourcesContent":["import { parseConfig } from \"@/config/parse\";\nimport { ExtBridgeError } from \"@/error\";\nimport { assertBrowserEnv } from \"@/lib/assertBrowserEnv\";\nimport { controllablePromise } from \"@/lib/controllablePromise\";\nimport { extractHostConfig } from \"./config/extractHostConfig\";\n\nconst timeoutMs = 7500;\n\nconst [readiness, resolveReadiness] = controllablePromise();\n\nexport const readinessApi = {\n isReady: async () => {\n assertBrowserEnv();\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n readiness,\n new Promise((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(\n new ExtBridgeError(`Ext Bridge not ready after ${timeoutMs}ms`),\n );\n }, timeoutMs);\n }),\n ]);\n } catch (error) {\n if (mwExtBridge.connection === undefined) {\n throw new ExtBridgeError(\n `Ext Bridge not ready after ${timeoutMs}ms: the host never connected. ` +\n \"Make sure the extension renders <RemoteRoot> and runs inside mStudio.\",\n );\n }\n throw error;\n } finally {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId);\n }\n }\n },\n setIsReady: async () => {\n const config = await mwExtBridge.connection.getConfig();\n\n const parsedConfig = parseConfig(config);\n const hostConfig = extractHostConfig(config);\n mwExtBridge.config = {\n ...parsedConfig,\n ...hostConfig,\n };\n\n resolveReadiness();\n },\n} as const;\n"],"mappings":";;;;;;AAMA,IAAM,YAAY;AAElB,IAAM,CAAC,WAAW,oBAAoB,oBAAoB;AAE1D,IAAa,eAAe;CAC1B,SAAS,YAAY;EACnB,iBAAiB;EACjB,IAAI;EACJ,IAAI;GACF,MAAM,QAAQ,KAAK,CACjB,WACA,IAAI,SAAS,GAAG,WAAW;IACzB,YAAY,iBAAiB;KAC3B,OACE,IAAI,eAAe,8BAA8B,UAAU,GAAG,CAChE;IACF,GAAG,SAAS;GACd,CAAC,CACH,CAAC;EACH,SAAS,OAAO;GACd,IAAI,YAAY,eAAe,KAAA,GAC7B,MAAM,IAAI,eACR,8BAA8B,UAAU,oGAE1C;GAEF,MAAM;EACR,UAAU;GACR,IAAI,cAAc,KAAA,GAChB,aAAa,SAAS;EAE1B;CACF;CACA,YAAY,YAAY;EACtB,MAAM,SAAS,MAAM,YAAY,WAAW,UAAU;EAEtD,MAAM,eAAe,YAAY,MAAM;EACvC,MAAM,aAAa,kBAAkB,MAAM;EAC3C,YAAY,SAAS;GACnB,GAAG;GACH,GAAG;EACL;EAEA,iBAAiB;CACnB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/ext-bridge",
3
- "version": "1.5.0-next.9",
3
+ "version": "1.6.0-next.0",
4
4
  "type": "module",
5
5
  "description": "Bridge for mStudio embedded frontend extensions",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -41,15 +41,15 @@
41
41
  "test:compile": "tsc --noEmit && tsc --noEmit -p tsconfig.vite.json"
42
42
  },
43
43
  "dependencies": {
44
- "@mittwald/react-use-promise": "~4.2.2",
44
+ "@mittwald/react-use-promise": "^4.2.2",
45
45
  "axios": "^1.19.0",
46
46
  "jose": "^6.2.10",
47
47
  "std-env": "^4.1.0",
48
48
  "zod": "^4.4.3"
49
49
  },
50
50
  "devDependencies": {
51
- "@mittwald/flow-core": "1.5.0-next.9",
52
- "@mittwald/typescript-config": "1.5.0-next.9",
51
+ "@mittwald/flow-core": "1.6.0-next.0",
52
+ "@mittwald/typescript-config": "1.6.0-next.0",
53
53
  "@types/node": "^25.9.3",
54
54
  "@types/react": "^19.2",
55
55
  "@types/react-dom": "^19.2",
@@ -80,5 +80,5 @@
80
80
  "optional": true
81
81
  }
82
82
  },
83
- "gitHead": "0e23e83976d053838f8d02fd9b42093ad5c9bf14"
83
+ "gitHead": "4d4ae3528f61e94bce048c1a0ad4701092838e5b"
84
84
  }
@@ -1 +0,0 @@
1
- export {};