@xwiki/cristal-sharedworker-impl 0.21.1 → 0.22.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.
@@ -1,4 +1,7 @@
1
1
  import { Container } from 'inversify';
2
+ /**
3
+ * @beta
4
+ */
2
5
  export default class ComponentInit {
3
6
  constructor(container: Container);
4
7
  }
@@ -1,5 +1,5 @@
1
+ import { CristalApp, Logger, LoggerConfig, PageData, SkinManager, WikiConfig } from '@xwiki/cristal-api';
1
2
  import { Configurations } from '@xwiki/cristal-configuration-api';
2
- import { CristalApp as CristalApp, Logger, LoggerConfig, PageData, SkinManager, WikiConfig } from '@xwiki/cristal-api';
3
3
  import { Container } from 'inversify';
4
4
  import { App, Component } from 'vue';
5
5
  import { Router } from 'vue-router';
@@ -33,5 +33,4 @@ export declare class WorkerCristalApp implements CristalApp {
33
33
  getPage(): Promise<PageData>;
34
34
  getLogger(): Logger;
35
35
  getLoggerConfig(): LoggerConfig;
36
- renderContent(): Promise<string>;
37
36
  }
package/dist/index.es.js CHANGED
@@ -3,7 +3,7 @@ import * as i from "comlink";
3
3
  import { injectable as g, inject as c } from "inversify";
4
4
  function w(e) {
5
5
  return new SharedWorker(
6
- "/assets/worker-D5o17ttR.js",
6
+ "/assets/worker-Cd03GOHu.js",
7
7
  {
8
8
  type: "module",
9
9
  name: e?.name
@@ -16,6 +16,11 @@ var h = Object.getOwnPropertyDescriptor, k = (e, r, t, n) => {
16
16
  return o;
17
17
  }, u = (e, r) => (t, n) => r(t, n, e);
18
18
  let s = class {
19
+ // TODO remove use of any
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ workerInstance;
22
+ cristalApp;
23
+ logger;
19
24
  constructor(e, r) {
20
25
  this.initialize(), this.logger = e, this.cristalApp = r;
21
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/components/defaultQueueWorker.ts","../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Worker } from \"./worker?sharedworker\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport * as Comlink from \"comlink\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type { MyWorker, QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport default class DefaultQueueWorker implements QueueWorker {\n // TODO remove use of any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private workerInstance: any;\n private cristalApp: CristalApp;\n private logger: Logger;\n\n public constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.initialize();\n this.logger = logger;\n this.cristalApp = cristalApp;\n }\n\n async pageLoaded(page: string): Promise<void> {\n try {\n this.logger.debug(\n \"Received callback that new document has been loaded\",\n page,\n );\n // We need to access the DocumentService lasily as otherwise the\n // internal pinia instance is initialized too early.\n const documentService = this.cristalApp\n .getContainer()\n .get<DocumentService>(documentServiceName);\n\n await documentService.refreshCurrentDocument();\n\n this.logger.debug(\n \"Done callback that new document has been loaded\",\n page,\n );\n } catch (e) {\n this.logger.error(\"Error calling loadPage\", e);\n }\n }\n\n public initialize(): void {\n try {\n if (this.workerInstance == null) {\n // this.workerInstance = new ComlinkWorker<typeof import('./worker')>(new URL('./worker',\n // import.meta.url), {/* normal Worker options*/})\n const sworker = new Worker({\n name: \"cristal-sharedworker\",\n });\n this.workerInstance = Comlink.wrap<MyWorker>(sworker.port);\n // TODO get rid of aliasing\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n\n this.workerInstance.setPageLoadedCallback(\n Comlink.proxy(async (page: string) => {\n await that.pageLoaded(page);\n }),\n );\n\n console.debug(\"Worker initialized\", this.workerInstance);\n } else {\n console.debug(\"Already initialized\");\n }\n } catch (e) {\n console.error(\"Failed to initialize shared worker\", e);\n }\n }\n\n public getStatus(): boolean {\n if (this.workerInstance != null) {\n console.log(\"workerInstance is ready\");\n return true;\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n return false;\n }\n }\n\n public async increment(): Promise<number> {\n if (this.workerInstance == null) {\n console.log(\"workerInstance is null. Cannot call\");\n return -1;\n } else {\n const result = await this.workerInstance.add(1);\n console.log(\"Results from shared worker: \", result);\n return result;\n }\n }\n\n public async addToQueue(page: string): Promise<void> {\n console.log(\"worker Calling addToQueue\", page);\n if (this.workerInstance != null) {\n await this.workerInstance.addToQueue(page);\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n }\n }\n\n public async getQueueSize(): Promise<number> {\n console.log(\"worker Calling getQueueSize\");\n if (this.workerInstance == null) {\n return -1;\n } else {\n return await this.workerInstance.getQueueSize();\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DefaultQueueWorker from \"./defaultQueueWorker\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\nimport type { Container } from \"inversify\";\n\nexport default class ComponentInit {\n constructor(container: Container) {\n container.bind<QueueWorker>(\"QueueWorker\").to(DefaultQueueWorker);\n }\n}\n"],"names":["DefaultQueueWorker","logger","cristalApp","page","documentServiceName","e","sworker","Worker","Comlink","that","result","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,IAAqBA,IAArB,MAA+D;AAAA,EAOtD,YACaC,GACIC,GACtB;AACA,SAAK,WAAA,GACL,KAAK,SAASD,GACd,KAAK,aAAaC;AAAA,EACpB;AAAA,EAEA,MAAM,WAAWC,GAA6B;AAC5C,QAAI;AACF,WAAK,OAAO;AAAA,QACV;AAAA,QACAA;AAAA,MAAA,GAQF,MAJwB,KAAK,WAC1B,aAAA,EACA,IAAqBC,CAAmB,EAErB,uBAAA,GAEtB,KAAK,OAAO;AAAA,QACV;AAAA,QACAD;AAAA,MAAA;AAAA,IAEJ,SAASE,GAAG;AACV,WAAK,OAAO,MAAM,0BAA0BA,CAAC;AAAA,IAC/C;AAAA,EACF;AAAA,EAEO,aAAmB;AACxB,QAAI;AACF,UAAI,KAAK,kBAAkB,MAAM;AAG/B,cAAMC,IAAU,IAAIC,EAAO;AAAA,UACzB,MAAM;AAAA,QAAA,CACP;AACD,aAAK,iBAAiBC,EAAQ,KAAeF,EAAQ,IAAI;AAGzD,cAAMG,IAAO;AAEb,aAAK,eAAe;AAAA,UAClBD,EAAQ,MAAM,OAAOL,MAAiB;AACpC,kBAAMM,EAAK,WAAWN,CAAI;AAAA,UAC5B,CAAC;AAAA,QAAA,GAGH,QAAQ,MAAM,sBAAsB,KAAK,cAAc;AAAA,MACzD;AACE,gBAAQ,MAAM,qBAAqB;AAAA,IAEvC,SAAS,GAAG;AACV,cAAQ,MAAM,sCAAsC,CAAC;AAAA,IACvD;AAAA,EACF;AAAA,EAEO,YAAqB;AAC1B,WAAI,KAAK,kBAAkB,QACzB,QAAQ,IAAI,yBAAyB,GAC9B,OAEP,QAAQ,IAAI,qCAAqC,GAC1C;AAAA,EAEX;AAAA,EAEA,MAAa,YAA6B;AACxC,QAAI,KAAK,kBAAkB;AACzB,qBAAQ,IAAI,qCAAqC,GAC1C;AACF;AACL,YAAMO,IAAS,MAAM,KAAK,eAAe,IAAI,CAAC;AAC9C,qBAAQ,IAAI,gCAAgCA,CAAM,GAC3CA;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAa,WAAWP,GAA6B;AACnD,YAAQ,IAAI,6BAA6BA,CAAI,GACzC,KAAK,kBAAkB,OACzB,MAAM,KAAK,eAAe,WAAWA,CAAI,IAEzC,QAAQ,IAAI,qCAAqC;AAAA,EAErD;AAAA,EAEA,MAAa,eAAgC;AAE3C,WADA,QAAQ,IAAI,6BAA6B,GACrC,KAAK,kBAAkB,OAClB,KAEA,MAAM,KAAK,eAAe,aAAA;AAAA,EAErC;AACF;AAzGqBH,IAArBW,EAAA;AAAA,EADCC,EAAA;AAAA,EASIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,GATHb,CAAA;ACLrB,MAAqBc,EAAc;AAAA,EACjC,YAAYC,GAAsB;AAChC,IAAAA,EAAU,KAAkB,aAAa,EAAE,GAAGf,CAAkB;AAAA,EAClE;AACF;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/components/defaultQueueWorker.ts","../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Worker } from \"./worker?sharedworker\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport * as Comlink from \"comlink\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type { MyWorker, QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport default class DefaultQueueWorker implements QueueWorker {\n // TODO remove use of any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private workerInstance: any;\n private cristalApp: CristalApp;\n private logger: Logger;\n\n public constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.initialize();\n this.logger = logger;\n this.cristalApp = cristalApp;\n }\n\n async pageLoaded(page: string): Promise<void> {\n try {\n this.logger.debug(\n \"Received callback that new document has been loaded\",\n page,\n );\n // We need to access the DocumentService lasily as otherwise the\n // internal pinia instance is initialized too early.\n const documentService = this.cristalApp\n .getContainer()\n .get<DocumentService>(documentServiceName);\n\n await documentService.refreshCurrentDocument();\n\n this.logger.debug(\n \"Done callback that new document has been loaded\",\n page,\n );\n } catch (e) {\n this.logger.error(\"Error calling loadPage\", e);\n }\n }\n\n public initialize(): void {\n try {\n if (this.workerInstance == null) {\n // this.workerInstance = new ComlinkWorker<typeof import('./worker')>(new URL('./worker',\n // import.meta.url), {/* normal Worker options*/})\n const sworker = new Worker({\n name: \"cristal-sharedworker\",\n });\n this.workerInstance = Comlink.wrap<MyWorker>(sworker.port);\n // TODO get rid of aliasing\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n\n this.workerInstance.setPageLoadedCallback(\n Comlink.proxy(async (page: string) => {\n await that.pageLoaded(page);\n }),\n );\n\n console.debug(\"Worker initialized\", this.workerInstance);\n } else {\n console.debug(\"Already initialized\");\n }\n } catch (e) {\n console.error(\"Failed to initialize shared worker\", e);\n }\n }\n\n public getStatus(): boolean {\n if (this.workerInstance != null) {\n console.log(\"workerInstance is ready\");\n return true;\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n return false;\n }\n }\n\n public async increment(): Promise<number> {\n if (this.workerInstance == null) {\n console.log(\"workerInstance is null. Cannot call\");\n return -1;\n } else {\n const result = await this.workerInstance.add(1);\n console.log(\"Results from shared worker: \", result);\n return result;\n }\n }\n\n public async addToQueue(page: string): Promise<void> {\n console.log(\"worker Calling addToQueue\", page);\n if (this.workerInstance != null) {\n await this.workerInstance.addToQueue(page);\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n }\n }\n\n public async getQueueSize(): Promise<number> {\n console.log(\"worker Calling getQueueSize\");\n if (this.workerInstance == null) {\n return -1;\n } else {\n return await this.workerInstance.getQueueSize();\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DefaultQueueWorker from \"./defaultQueueWorker\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nexport default class ComponentInit {\n constructor(container: Container) {\n container.bind<QueueWorker>(\"QueueWorker\").to(DefaultQueueWorker);\n }\n}\n"],"names":["DefaultQueueWorker","logger","cristalApp","page","documentServiceName","e","sworker","Worker","Comlink","that","result","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,IAAqBA,IAArB,MAA+D;AAAA;AAAA;AAAA,EAGrD;AAAA,EACA;AAAA,EACA;AAAA,EAED,YACaC,GACIC,GACtB;AACA,SAAK,WAAA,GACL,KAAK,SAASD,GACd,KAAK,aAAaC;AAAA,EACpB;AAAA,EAEA,MAAM,WAAWC,GAA6B;AAC5C,QAAI;AACF,WAAK,OAAO;AAAA,QACV;AAAA,QACAA;AAAA,MAAA,GAQF,MAJwB,KAAK,WAC1B,aAAA,EACA,IAAqBC,CAAmB,EAErB,uBAAA,GAEtB,KAAK,OAAO;AAAA,QACV;AAAA,QACAD;AAAA,MAAA;AAAA,IAEJ,SAASE,GAAG;AACV,WAAK,OAAO,MAAM,0BAA0BA,CAAC;AAAA,IAC/C;AAAA,EACF;AAAA,EAEO,aAAmB;AACxB,QAAI;AACF,UAAI,KAAK,kBAAkB,MAAM;AAG/B,cAAMC,IAAU,IAAIC,EAAO;AAAA,UACzB,MAAM;AAAA,QAAA,CACP;AACD,aAAK,iBAAiBC,EAAQ,KAAeF,EAAQ,IAAI;AAGzD,cAAMG,IAAO;AAEb,aAAK,eAAe;AAAA,UAClBD,EAAQ,MAAM,OAAOL,MAAiB;AACpC,kBAAMM,EAAK,WAAWN,CAAI;AAAA,UAC5B,CAAC;AAAA,QAAA,GAGH,QAAQ,MAAM,sBAAsB,KAAK,cAAc;AAAA,MACzD;AACE,gBAAQ,MAAM,qBAAqB;AAAA,IAEvC,SAAS,GAAG;AACV,cAAQ,MAAM,sCAAsC,CAAC;AAAA,IACvD;AAAA,EACF;AAAA,EAEO,YAAqB;AAC1B,WAAI,KAAK,kBAAkB,QACzB,QAAQ,IAAI,yBAAyB,GAC9B,OAEP,QAAQ,IAAI,qCAAqC,GAC1C;AAAA,EAEX;AAAA,EAEA,MAAa,YAA6B;AACxC,QAAI,KAAK,kBAAkB;AACzB,qBAAQ,IAAI,qCAAqC,GAC1C;AACF;AACL,YAAMO,IAAS,MAAM,KAAK,eAAe,IAAI,CAAC;AAC9C,qBAAQ,IAAI,gCAAgCA,CAAM,GAC3CA;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAa,WAAWP,GAA6B;AACnD,YAAQ,IAAI,6BAA6BA,CAAI,GACzC,KAAK,kBAAkB,OACzB,MAAM,KAAK,eAAe,WAAWA,CAAI,IAEzC,QAAQ,IAAI,qCAAqC;AAAA,EAErD;AAAA,EAEA,MAAa,eAAgC;AAE3C,WADA,QAAQ,IAAI,6BAA6B,GACrC,KAAK,kBAAkB,OAClB,KAEA,MAAM,KAAK,eAAe,aAAA;AAAA,EAErC;AACF;AAzGqBH,IAArBW,EAAA;AAAA,EADCC,EAAA;AAAA,EASIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,GATHb,CAAA;ACFrB,MAAqBc,EAAc;AAAA,EACjC,YAAYC,GAAsB;AAChC,IAAAA,EAAU,KAAkB,aAAa,EAAE,GAAGf,CAAkB;AAAA,EAClE;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@xwiki/cristal-document-api"),require("comlink"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-document-api","comlink","inversify"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.cristal_impl={},n.cristalDocumentApi,n.Comlink,n.inversify))})(this,function(n,i,w,s){"use strict";function k(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=k(w);function h(e){return new SharedWorker("/assets/worker-D5o17ttR.js",{type:"module",name:e?.name})}var f=Object.getOwnPropertyDescriptor,p=(e,t,r,o)=>{for(var a=o>1?void 0:o?f(t,r):t,c=e.length-1,g;c>=0;c--)(g=e[c])&&(a=g(a)||a);return a},d=(e,t)=>(r,o)=>t(r,o,e);let l=class{constructor(e,t){this.initialize(),this.logger=e,this.cristalApp=t}async pageLoaded(e){try{this.logger.debug("Received callback that new document has been loaded",e),await this.cristalApp.getContainer().get(i.name).refreshCurrentDocument(),this.logger.debug("Done callback that new document has been loaded",e)}catch(t){this.logger.error("Error calling loadPage",t)}}initialize(){try{if(this.workerInstance==null){const e=new h({name:"cristal-sharedworker"});this.workerInstance=u.wrap(e.port);const t=this;this.workerInstance.setPageLoadedCallback(u.proxy(async r=>{await t.pageLoaded(r)})),console.debug("Worker initialized",this.workerInstance)}else console.debug("Already initialized")}catch(e){console.error("Failed to initialize shared worker",e)}}getStatus(){return this.workerInstance!=null?(console.log("workerInstance is ready"),!0):(console.log("workerInstance is null. Cannot call"),!1)}async increment(){if(this.workerInstance==null)return console.log("workerInstance is null. Cannot call"),-1;{const e=await this.workerInstance.add(1);return console.log("Results from shared worker: ",e),e}}async addToQueue(e){console.log("worker Calling addToQueue",e),this.workerInstance!=null?await this.workerInstance.addToQueue(e):console.log("workerInstance is null. Cannot call")}async getQueueSize(){return console.log("worker Calling getQueueSize"),this.workerInstance==null?-1:await this.workerInstance.getQueueSize()}};l=p([s.injectable(),d(0,s.inject("Logger")),d(1,s.inject("CristalApp"))],l);class m{constructor(t){t.bind("QueueWorker").to(l)}}n.ComponentInit=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@xwiki/cristal-document-api"),require("comlink"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-document-api","comlink","inversify"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.cristal_impl={},n.cristalDocumentApi,n.Comlink,n.inversify))})(this,(function(n,i,w,s){"use strict";function k(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=k(w);function p(e){return new SharedWorker("/assets/worker-Cd03GOHu.js",{type:"module",name:e?.name})}var h=Object.getOwnPropertyDescriptor,f=(e,t,r,o)=>{for(var a=o>1?void 0:o?h(t,r):t,c=e.length-1,g;c>=0;c--)(g=e[c])&&(a=g(a)||a);return a},d=(e,t)=>(r,o)=>t(r,o,e);let l=class{workerInstance;cristalApp;logger;constructor(e,t){this.initialize(),this.logger=e,this.cristalApp=t}async pageLoaded(e){try{this.logger.debug("Received callback that new document has been loaded",e),await this.cristalApp.getContainer().get(i.name).refreshCurrentDocument(),this.logger.debug("Done callback that new document has been loaded",e)}catch(t){this.logger.error("Error calling loadPage",t)}}initialize(){try{if(this.workerInstance==null){const e=new p({name:"cristal-sharedworker"});this.workerInstance=u.wrap(e.port);const t=this;this.workerInstance.setPageLoadedCallback(u.proxy(async r=>{await t.pageLoaded(r)})),console.debug("Worker initialized",this.workerInstance)}else console.debug("Already initialized")}catch(e){console.error("Failed to initialize shared worker",e)}}getStatus(){return this.workerInstance!=null?(console.log("workerInstance is ready"),!0):(console.log("workerInstance is null. Cannot call"),!1)}async increment(){if(this.workerInstance==null)return console.log("workerInstance is null. Cannot call"),-1;{const e=await this.workerInstance.add(1);return console.log("Results from shared worker: ",e),e}}async addToQueue(e){console.log("worker Calling addToQueue",e),this.workerInstance!=null?await this.workerInstance.addToQueue(e):console.log("workerInstance is null. Cannot call")}async getQueueSize(){return console.log("worker Calling getQueueSize"),this.workerInstance==null?-1:await this.workerInstance.getQueueSize()}};l=f([s.injectable(),d(0,s.inject("Logger")),d(1,s.inject("CristalApp"))],l);class m{constructor(t){t.bind("QueueWorker").to(l)}}n.ComponentInit=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/components/defaultQueueWorker.ts","../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Worker } from \"./worker?sharedworker\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport * as Comlink from \"comlink\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type { MyWorker, QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport default class DefaultQueueWorker implements QueueWorker {\n // TODO remove use of any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private workerInstance: any;\n private cristalApp: CristalApp;\n private logger: Logger;\n\n public constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.initialize();\n this.logger = logger;\n this.cristalApp = cristalApp;\n }\n\n async pageLoaded(page: string): Promise<void> {\n try {\n this.logger.debug(\n \"Received callback that new document has been loaded\",\n page,\n );\n // We need to access the DocumentService lasily as otherwise the\n // internal pinia instance is initialized too early.\n const documentService = this.cristalApp\n .getContainer()\n .get<DocumentService>(documentServiceName);\n\n await documentService.refreshCurrentDocument();\n\n this.logger.debug(\n \"Done callback that new document has been loaded\",\n page,\n );\n } catch (e) {\n this.logger.error(\"Error calling loadPage\", e);\n }\n }\n\n public initialize(): void {\n try {\n if (this.workerInstance == null) {\n // this.workerInstance = new ComlinkWorker<typeof import('./worker')>(new URL('./worker',\n // import.meta.url), {/* normal Worker options*/})\n const sworker = new Worker({\n name: \"cristal-sharedworker\",\n });\n this.workerInstance = Comlink.wrap<MyWorker>(sworker.port);\n // TODO get rid of aliasing\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n\n this.workerInstance.setPageLoadedCallback(\n Comlink.proxy(async (page: string) => {\n await that.pageLoaded(page);\n }),\n );\n\n console.debug(\"Worker initialized\", this.workerInstance);\n } else {\n console.debug(\"Already initialized\");\n }\n } catch (e) {\n console.error(\"Failed to initialize shared worker\", e);\n }\n }\n\n public getStatus(): boolean {\n if (this.workerInstance != null) {\n console.log(\"workerInstance is ready\");\n return true;\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n return false;\n }\n }\n\n public async increment(): Promise<number> {\n if (this.workerInstance == null) {\n console.log(\"workerInstance is null. Cannot call\");\n return -1;\n } else {\n const result = await this.workerInstance.add(1);\n console.log(\"Results from shared worker: \", result);\n return result;\n }\n }\n\n public async addToQueue(page: string): Promise<void> {\n console.log(\"worker Calling addToQueue\", page);\n if (this.workerInstance != null) {\n await this.workerInstance.addToQueue(page);\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n }\n }\n\n public async getQueueSize(): Promise<number> {\n console.log(\"worker Calling getQueueSize\");\n if (this.workerInstance == null) {\n return -1;\n } else {\n return await this.workerInstance.getQueueSize();\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DefaultQueueWorker from \"./defaultQueueWorker\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\nimport type { Container } from \"inversify\";\n\nexport default class ComponentInit {\n constructor(container: Container) {\n container.bind<QueueWorker>(\"QueueWorker\").to(DefaultQueueWorker);\n }\n}\n"],"names":["DefaultQueueWorker","logger","cristalApp","page","documentServiceName","e","sworker","Worker","Comlink","that","result","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":"w7BA6BA,IAAqBA,EAArB,KAA+D,CAOtD,YACaC,EACIC,EACtB,CACA,KAAK,WAAA,EACL,KAAK,OAASD,EACd,KAAK,WAAaC,CACpB,CAEA,MAAM,WAAWC,EAA6B,CAC5C,GAAI,CACF,KAAK,OAAO,MACV,sDACAA,CAAA,EAQF,MAJwB,KAAK,WAC1B,aAAA,EACA,IAAqBC,MAAmB,EAErB,uBAAA,EAEtB,KAAK,OAAO,MACV,kDACAD,CAAA,CAEJ,OAASE,EAAG,CACV,KAAK,OAAO,MAAM,yBAA0BA,CAAC,CAC/C,CACF,CAEO,YAAmB,CACxB,GAAI,CACF,GAAI,KAAK,gBAAkB,KAAM,CAG/B,MAAMC,EAAU,IAAIC,EAAO,CACzB,KAAM,sBAAA,CACP,EACD,KAAK,eAAiBC,EAAQ,KAAeF,EAAQ,IAAI,EAGzD,MAAMG,EAAO,KAEb,KAAK,eAAe,sBAClBD,EAAQ,MAAM,MAAOL,GAAiB,CACpC,MAAMM,EAAK,WAAWN,CAAI,CAC5B,CAAC,CAAA,EAGH,QAAQ,MAAM,qBAAsB,KAAK,cAAc,CACzD,MACE,QAAQ,MAAM,qBAAqB,CAEvC,OAAS,EAAG,CACV,QAAQ,MAAM,qCAAsC,CAAC,CACvD,CACF,CAEO,WAAqB,CAC1B,OAAI,KAAK,gBAAkB,MACzB,QAAQ,IAAI,yBAAyB,EAC9B,KAEP,QAAQ,IAAI,qCAAqC,EAC1C,GAEX,CAEA,MAAa,WAA6B,CACxC,GAAI,KAAK,gBAAkB,KACzB,eAAQ,IAAI,qCAAqC,EAC1C,GACF,CACL,MAAMO,EAAS,MAAM,KAAK,eAAe,IAAI,CAAC,EAC9C,eAAQ,IAAI,+BAAgCA,CAAM,EAC3CA,CACT,CACF,CAEA,MAAa,WAAWP,EAA6B,CACnD,QAAQ,IAAI,4BAA6BA,CAAI,EACzC,KAAK,gBAAkB,KACzB,MAAM,KAAK,eAAe,WAAWA,CAAI,EAEzC,QAAQ,IAAI,qCAAqC,CAErD,CAEA,MAAa,cAAgC,CAE3C,OADA,QAAQ,IAAI,6BAA6B,EACrC,KAAK,gBAAkB,KAClB,GAEA,MAAM,KAAK,eAAe,aAAA,CAErC,CACF,EAzGqBH,EAArBW,EAAA,CADCC,aAAA,EASIC,aAAO,QAAQ,CAAA,EACfA,aAAO,YAAY,CAAA,CAAA,EATHb,CAAA,ECLrB,MAAqBc,CAAc,CACjC,YAAYC,EAAsB,CAChCA,EAAU,KAAkB,aAAa,EAAE,GAAGf,CAAkB,CAClE,CACF"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/components/defaultQueueWorker.ts","../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Worker } from \"./worker?sharedworker\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport * as Comlink from \"comlink\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type { MyWorker, QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport default class DefaultQueueWorker implements QueueWorker {\n // TODO remove use of any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private workerInstance: any;\n private cristalApp: CristalApp;\n private logger: Logger;\n\n public constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"CristalApp\") cristalApp: CristalApp,\n ) {\n this.initialize();\n this.logger = logger;\n this.cristalApp = cristalApp;\n }\n\n async pageLoaded(page: string): Promise<void> {\n try {\n this.logger.debug(\n \"Received callback that new document has been loaded\",\n page,\n );\n // We need to access the DocumentService lasily as otherwise the\n // internal pinia instance is initialized too early.\n const documentService = this.cristalApp\n .getContainer()\n .get<DocumentService>(documentServiceName);\n\n await documentService.refreshCurrentDocument();\n\n this.logger.debug(\n \"Done callback that new document has been loaded\",\n page,\n );\n } catch (e) {\n this.logger.error(\"Error calling loadPage\", e);\n }\n }\n\n public initialize(): void {\n try {\n if (this.workerInstance == null) {\n // this.workerInstance = new ComlinkWorker<typeof import('./worker')>(new URL('./worker',\n // import.meta.url), {/* normal Worker options*/})\n const sworker = new Worker({\n name: \"cristal-sharedworker\",\n });\n this.workerInstance = Comlink.wrap<MyWorker>(sworker.port);\n // TODO get rid of aliasing\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this;\n\n this.workerInstance.setPageLoadedCallback(\n Comlink.proxy(async (page: string) => {\n await that.pageLoaded(page);\n }),\n );\n\n console.debug(\"Worker initialized\", this.workerInstance);\n } else {\n console.debug(\"Already initialized\");\n }\n } catch (e) {\n console.error(\"Failed to initialize shared worker\", e);\n }\n }\n\n public getStatus(): boolean {\n if (this.workerInstance != null) {\n console.log(\"workerInstance is ready\");\n return true;\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n return false;\n }\n }\n\n public async increment(): Promise<number> {\n if (this.workerInstance == null) {\n console.log(\"workerInstance is null. Cannot call\");\n return -1;\n } else {\n const result = await this.workerInstance.add(1);\n console.log(\"Results from shared worker: \", result);\n return result;\n }\n }\n\n public async addToQueue(page: string): Promise<void> {\n console.log(\"worker Calling addToQueue\", page);\n if (this.workerInstance != null) {\n await this.workerInstance.addToQueue(page);\n } else {\n console.log(\"workerInstance is null. Cannot call\");\n }\n }\n\n public async getQueueSize(): Promise<number> {\n console.log(\"worker Calling getQueueSize\");\n if (this.workerInstance == null) {\n return -1;\n } else {\n return await this.workerInstance.getQueueSize();\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DefaultQueueWorker from \"./defaultQueueWorker\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nexport default class ComponentInit {\n constructor(container: Container) {\n container.bind<QueueWorker>(\"QueueWorker\").to(DefaultQueueWorker);\n }\n}\n"],"names":["DefaultQueueWorker","logger","cristalApp","page","documentServiceName","e","sworker","Worker","Comlink","that","result","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":"y7BA6BA,IAAqBA,EAArB,KAA+D,CAGrD,eACA,WACA,OAED,YACaC,EACIC,EACtB,CACA,KAAK,WAAA,EACL,KAAK,OAASD,EACd,KAAK,WAAaC,CACpB,CAEA,MAAM,WAAWC,EAA6B,CAC5C,GAAI,CACF,KAAK,OAAO,MACV,sDACAA,CAAA,EAQF,MAJwB,KAAK,WAC1B,aAAA,EACA,IAAqBC,MAAmB,EAErB,uBAAA,EAEtB,KAAK,OAAO,MACV,kDACAD,CAAA,CAEJ,OAASE,EAAG,CACV,KAAK,OAAO,MAAM,yBAA0BA,CAAC,CAC/C,CACF,CAEO,YAAmB,CACxB,GAAI,CACF,GAAI,KAAK,gBAAkB,KAAM,CAG/B,MAAMC,EAAU,IAAIC,EAAO,CACzB,KAAM,sBAAA,CACP,EACD,KAAK,eAAiBC,EAAQ,KAAeF,EAAQ,IAAI,EAGzD,MAAMG,EAAO,KAEb,KAAK,eAAe,sBAClBD,EAAQ,MAAM,MAAOL,GAAiB,CACpC,MAAMM,EAAK,WAAWN,CAAI,CAC5B,CAAC,CAAA,EAGH,QAAQ,MAAM,qBAAsB,KAAK,cAAc,CACzD,MACE,QAAQ,MAAM,qBAAqB,CAEvC,OAAS,EAAG,CACV,QAAQ,MAAM,qCAAsC,CAAC,CACvD,CACF,CAEO,WAAqB,CAC1B,OAAI,KAAK,gBAAkB,MACzB,QAAQ,IAAI,yBAAyB,EAC9B,KAEP,QAAQ,IAAI,qCAAqC,EAC1C,GAEX,CAEA,MAAa,WAA6B,CACxC,GAAI,KAAK,gBAAkB,KACzB,eAAQ,IAAI,qCAAqC,EAC1C,GACF,CACL,MAAMO,EAAS,MAAM,KAAK,eAAe,IAAI,CAAC,EAC9C,eAAQ,IAAI,+BAAgCA,CAAM,EAC3CA,CACT,CACF,CAEA,MAAa,WAAWP,EAA6B,CACnD,QAAQ,IAAI,4BAA6BA,CAAI,EACzC,KAAK,gBAAkB,KACzB,MAAM,KAAK,eAAe,WAAWA,CAAI,EAEzC,QAAQ,IAAI,qCAAqC,CAErD,CAEA,MAAa,cAAgC,CAE3C,OADA,QAAQ,IAAI,6BAA6B,EACrC,KAAK,gBAAkB,KAClB,GAEA,MAAM,KAAK,eAAe,aAAA,CAErC,CACF,EAzGqBH,EAArBW,EAAA,CADCC,aAAA,EASIC,aAAO,QAAQ,CAAA,EACfA,aAAO,YAAY,CAAA,CAAA,EATHb,CAAA,ECFrB,MAAqBc,CAAc,CACjC,YAAYC,EAAsB,CAChCA,EAAU,KAAkB,aAAa,EAAE,GAAGf,CAAkB,CAClE,CACF"}
@@ -0,0 +1,19 @@
1
+ ## API Report File for "@xwiki/cristal-sharedworker-impl"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Container } from 'inversify';
8
+ import { QueueWorker } from '@xwiki/cristal-sharedworker-api';
9
+
10
+ // @beta (undocumented)
11
+ export class ComponentInit {
12
+ constructor(container: Container);
13
+ }
14
+
15
+ export { QueueWorker }
16
+
17
+ // (No @packageDocumentation comment for this package)
18
+
19
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-sharedworker-impl",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -31,18 +31,18 @@
31
31
  "comlink": "4.4.2",
32
32
  "reflect-metadata": "0.2.2",
33
33
  "vue-router": "4.5.1",
34
- "@xwiki/cristal-alerts-default": "0.21.1",
35
- "@xwiki/cristal-authentication-default": "0.21.1",
36
- "@xwiki/cristal-backend-github": "0.21.1",
37
- "@xwiki/cristal-backend-nextcloud": "0.21.1",
38
- "@xwiki/cristal-api": "0.21.1",
39
- "@xwiki/cristal-configuration-api": "0.21.1",
40
- "@xwiki/cristal-backend-dexie": "0.21.1",
41
- "@xwiki/cristal-configuration-web": "0.21.1",
42
- "@xwiki/cristal-backend-xwiki": "0.21.1",
43
- "@xwiki/cristal-document-api": "0.21.1",
44
- "@xwiki/cristal-extension-manager": "0.21.1",
45
- "@xwiki/cristal-sharedworker-api": "0.21.1"
34
+ "@xwiki/cristal-alerts-default": "0.22.0",
35
+ "@xwiki/cristal-authentication-default": "0.22.0",
36
+ "@xwiki/cristal-backend-github": "0.22.0",
37
+ "@xwiki/cristal-backend-nextcloud": "0.22.0",
38
+ "@xwiki/cristal-api": "0.22.0",
39
+ "@xwiki/cristal-backend-dexie": "0.22.0",
40
+ "@xwiki/cristal-configuration-web": "0.22.0",
41
+ "@xwiki/cristal-backend-xwiki": "0.22.0",
42
+ "@xwiki/cristal-configuration-api": "0.22.0",
43
+ "@xwiki/cristal-document-api": "0.22.0",
44
+ "@xwiki/cristal-extension-manager": "0.22.0",
45
+ "@xwiki/cristal-sharedworker-api": "0.22.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "inversify": "7.x",
@@ -50,19 +50,19 @@
50
50
  "vue": "3.x"
51
51
  },
52
52
  "devDependencies": {
53
- "inversify": "7.7.0",
53
+ "@types/sharedworker": "0.0.180",
54
+ "inversify": "7.9.0",
54
55
  "typescript": "5.9.2",
55
- "vite": "7.0.6",
56
- "vite-plugin-comlink": "5.1.0",
57
- "vue": "3.5.18",
58
- "vue-tsc": "2.2.12",
59
- "@xwiki/cristal-dev-config": "0.21.1"
56
+ "vite": "7.1.5",
57
+ "vue": "3.5.20",
58
+ "@xwiki/cristal-dev-config": "0.22.0"
60
59
  },
61
60
  "scripts": {
62
- "build": "pnpm compile",
61
+ "api-extractor:local": "api-extractor run --local",
62
+ "build": "vite build",
63
63
  "clean": "rimraf dist",
64
- "compile": "vue-tsc --project tsconfig.json && vite build",
65
64
  "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
66
- "test": "vitest --run"
65
+ "test": "vitest --run",
66
+ "typecheck": "tsc"
67
67
  }
68
68
  }
@@ -22,6 +22,9 @@ import DefaultQueueWorker from "./defaultQueueWorker";
22
22
  import type { QueueWorker } from "@xwiki/cristal-sharedworker-api";
23
23
  import type { Container } from "inversify";
24
24
 
25
+ /**
26
+ * @beta
27
+ */
25
28
  export default class ComponentInit {
26
29
  constructor(container: Container) {
27
30
  container.bind<QueueWorker>("QueueWorker").to(DefaultQueueWorker);
@@ -22,19 +22,22 @@ import "reflect-metadata";
22
22
  import { WorkerCristalApp } from "./workerCristalApp";
23
23
  import WorkerQueueWorker from "./workerQueueWorker";
24
24
  import { ComponentInit as AlertsDefaultComponentInit } from "@xwiki/cristal-alerts-default";
25
- import { CristalApp, WrappingStorage } from "@xwiki/cristal-api";
26
25
  import { ComponentInit as AuthenticationDefaultComponentInit } from "@xwiki/cristal-authentication-default";
27
26
  import { ComponentInit as DexieBackendComponentInit } from "@xwiki/cristal-backend-dexie";
28
27
  import { ComponentInit as GithubBackendComponentInit } from "@xwiki/cristal-backend-github";
29
28
  import { ComponentInit as NextcloudBackendComponentInit } from "@xwiki/cristal-backend-nextcloud";
30
29
  import { ComponentInit as XWikiBackendComponentInit } from "@xwiki/cristal-backend-xwiki";
31
- import {
30
+ import { CristalLoader } from "@xwiki/cristal-extension-manager";
31
+ import * as Comlink from "comlink";
32
+ import type {
33
+ CristalApp,
34
+ WikiConfig,
35
+ WrappingStorage,
36
+ } from "@xwiki/cristal-api";
37
+ import type {
32
38
  ConfigurationLoader,
33
39
  Configurations,
34
40
  } from "@xwiki/cristal-configuration-api";
35
- import { CristalLoader } from "@xwiki/cristal-extension-manager";
36
- import * as Comlink from "comlink";
37
- import type { WikiConfig } from "@xwiki/cristal-api";
38
41
  import type { MyWorker, QueueWorker } from "@xwiki/cristal-sharedworker-api";
39
42
  import type { Container } from "inversify";
40
43
 
@@ -264,10 +267,7 @@ export class Worker implements MyWorker {
264
267
  const worker = new Worker();
265
268
  worker.start();
266
269
 
267
- // @ts-expect-error ignore
268
- // TODO remove use of any
269
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
270
- onconnect = (e: any) => {
270
+ onconnect = (e) => {
271
271
  Comlink.expose(worker, e.ports[0]);
272
272
  };
273
273
  console.log("Worker code loaded");
@@ -19,16 +19,16 @@
19
19
  */
20
20
 
21
21
  import { DefaultLogger } from "@xwiki/cristal-api";
22
- import { Configurations } from "@xwiki/cristal-configuration-api";
23
22
  import { injectable } from "inversify";
24
23
  import type {
25
- CristalApp as CristalApp,
24
+ CristalApp,
26
25
  Logger,
27
26
  LoggerConfig,
28
27
  PageData,
29
28
  SkinManager,
30
29
  WikiConfig,
31
30
  } from "@xwiki/cristal-api";
31
+ import type { Configurations } from "@xwiki/cristal-configuration-api";
32
32
  import type { Container } from "inversify";
33
33
  import type { App, Component } from "vue";
34
34
  import type { Router } from "vue-router";
@@ -154,8 +154,4 @@ export class WorkerCristalApp implements CristalApp {
154
154
  getLoggerConfig(): LoggerConfig {
155
155
  throw new Error("Method not implemented.");
156
156
  }
157
-
158
- renderContent(): Promise<string> {
159
- throw new Error("Method not implemented.");
160
- }
161
157
  }
package/tsconfig.json CHANGED
@@ -4,7 +4,8 @@
4
4
  "outDir": "dist",
5
5
  "resolveJsonModule": true,
6
6
  "types": [
7
- "vite/client"
7
+ "vite/client",
8
+ "@types/sharedworker"
8
9
  ]
9
10
  },
10
11
  "extends": "./../../tsconfig.json",
package/vite.config.ts CHANGED
@@ -20,15 +20,12 @@
20
20
 
21
21
  import { generateConfig } from "../../vite.config";
22
22
  import { defineConfig, mergeConfig } from "vite";
23
- import comlink from "vite-plugin-comlink";
24
23
 
25
24
  export default mergeConfig(
26
25
  generateConfig(import.meta.url),
27
26
  defineConfig({
28
- plugins: [comlink()],
29
27
  worker: {
30
28
  format: "es",
31
- plugins: () => [comlink()],
32
29
  },
33
30
  }),
34
31
  );
package/vitest.config.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  import localConfig from "./vite.config";
22
+ import { vitestVue as defaultConfig } from "@xwiki/cristal-dev-config";
22
23
  import { mergeConfig } from "vitest/config";
23
- import defaultConfig from "@xwiki/cristal-dev-config/vitest-vue.config";
24
24
 
25
25
  export default mergeConfig(defaultConfig, localConfig);