@vnejs/core 0.2.9 → 0.2.11

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.
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Observer } from "@vnejs/observer";
2
2
  import { VNE, VNE_MODULES } from "@vnejs/shared";
3
- import { mergeFetchResult, toJSON } from "./utils.js";
3
+ import { toJson } from "@vnejs/helpers";
4
+ import { mergeFetchResult } from "./utils.js";
4
5
  export class VneCore {
5
6
  observer = new Observer();
6
7
  modules = {};
@@ -12,15 +13,14 @@ export class VneCore {
12
13
  init = async () => {
13
14
  const CONST = VNE.CONST;
14
15
  const ts = Math.round(new Date().getTime() / 1000 / 60 / 60);
15
- const mods = (await fetch(`${CONST.SYSTEM.HOST}/mods.json?ts=${ts}`).then(toJSON));
16
- const fetchResult = await Promise.all(mods.map((mod) => fetch(`${CONST.SYSTEM.HOST}/media.${mod}.json?ts=${ts}`).then(toJSON)));
16
+ const mods = (await fetch(`${CONST.SYSTEM.HOST}/mods.json?ts=${ts}`).then(toJson));
17
+ const fetchResult = await Promise.all(mods.map((mod) => fetch(`${CONST.SYSTEM.HOST}/media.${mod}.json?ts=${ts}`).then(toJson)));
17
18
  const media = fetchResult.reduce(mergeFetchResult, {});
18
19
  const injectArg = { observer: this.observer, state: this.state, shared: this.shared, media };
19
20
  Object.values(this.modules).forEach((module) => {
20
21
  module?.inject(injectArg);
21
22
  module?.subscribe();
22
23
  });
23
- console.log(8888888);
24
24
  window.uninitedModules = [];
25
25
  console.log("init modules start");
26
26
  await Promise.all(Object.values(this.modules).map(async (module) => {
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import type { ModuleMedia } from "./types.js";
2
- export declare const toJSON: (response: Response) => Promise<unknown>;
3
2
  export declare const mergeFetchResult: (acc: ModuleMedia, media: ModuleMedia) => ModuleMedia;
package/dist/utils.js CHANGED
@@ -1,4 +1,3 @@
1
- export const toJSON = (response) => response.json();
2
1
  export const mergeFetchResult = (acc, media) => {
3
2
  Object.keys(media).forEach((key) => {
4
3
  if (!acc[key])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/core",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,6 +24,7 @@
24
24
  "@capacitor/splash-screen": "5.0.8",
25
25
  "@capacitor/assets": "3.0.5",
26
26
  "@capacitor/cli": "5.0.2",
27
+ "@vnejs/constants": "~0.0.1",
27
28
  "@vnejs/shared": "~0.0.8",
28
29
  "@vnejs/semaphore": "~0.0.1",
29
30
  "@vnejs/build": "~0.0.19",