yummies 4.2.4 → 4.2.6

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="assets/logo.png" align="right" width="176" alt="logo" />
1
+ <img src="assets/logo.png" align="right" width="156" alt="logo" />
2
2
 
3
3
  # yummies
4
4
 
package/imports.d.ts CHANGED
@@ -8,4 +8,8 @@
8
8
  * ```
9
9
  */
10
10
  export declare const fetchLazyModule: <T>(fetchModule: () => Promise<T>, attempts?: number, delay?: number) => Promise<T>;
11
+ export type PackedAsyncModule<T> = Promise<T | {
12
+ default: T;
13
+ }>;
14
+ export declare const unpackAsyncModule: <T>(maybeModule: T | PackedAsyncModule<T>) => Promise<T>;
11
15
  //# sourceMappingURL=imports.d.ts.map
package/imports.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EACrC,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,EAC7B,iBAAY,EACZ,cAAY,KACX,OAAO,CAAC,CAAC,CAkBX,CAAC"}
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,EACrC,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,EAC7B,iBAAY,EACZ,cAAY,KACX,OAAO,CAAC,CAAC,CAkBX,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB,GAAU,CAAC,EACvC,aAAa,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpC,OAAO,CAAC,CAAC,CAYX,CAAC"}
package/imports.js CHANGED
@@ -26,3 +26,15 @@ export const fetchLazyModule = async (fetchModule, attempts = 3, delay = 1000) =
26
26
  }
27
27
  throw lastError;
28
28
  };
29
+ export const unpackAsyncModule = async (maybeModule) => {
30
+ if (maybeModule instanceof Promise) {
31
+ const data = (await maybeModule);
32
+ if (data.default) {
33
+ return data.default;
34
+ }
35
+ else {
36
+ return data;
37
+ }
38
+ }
39
+ return maybeModule;
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yummies",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "keywords": [],
5
5
  "author": "js2me",
6
6
  "license": "MIT",