@taro-minify-pack/react-lazy-enhanced 0.0.5-alpha.6 → 0.0.5-alpha.7
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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -4
- package/src/index.tsx +1 -1
- package/tsconfig.json +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ interface Result<T> {
|
|
|
3
3
|
default: T;
|
|
4
4
|
}
|
|
5
5
|
type Factory<T extends ComponentType<any>> = () => Promise<Result<T>>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const lazyEnhanced: <T extends ComponentType<any>>(factory: Factory<T>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<React.ComponentPropsWithoutRef<T>> & React.RefAttributes<React.ComponentRef<T>>>;
|
|
7
7
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var Status;
|
|
|
6
6
|
Status["Resolved"] = "resolved";
|
|
7
7
|
Status["Rejected"] = "rejected";
|
|
8
8
|
})(Status || (Status = {}));
|
|
9
|
-
export const
|
|
9
|
+
export const lazyEnhanced = (factory) => {
|
|
10
10
|
const LazyComponent = React.lazy(factory);
|
|
11
11
|
const loadData = { status: Status.Uninitialized };
|
|
12
12
|
const load = () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,IAAK,MAKJ;AALD,WAAK,MAAM;IACP,yCAA+B,CAAA;IAC/B,6BAAmB,CAAA;IACnB,+BAAqB,CAAA;IACrB,+BAAqB,CAAA;AACzB,CAAC,EALI,MAAM,KAAN,MAAM,QAKV;AAcD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.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C,OAAO,GAAG,SAAS,CAAA;IAC9B,CAAC,CAAA;IAED,OAAO,KAAK,CAAC,UAAU,CAA+C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACnF,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,aAAa;YAAE,IAAI,EAAE,CAAA;QAEpD,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO;YAAE,MAAM,QAAQ,CAAC,OAAO,CAAA;QAE9D,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ;YAAE,MAAM,QAAQ,CAAC,MAAM,CAAA;QAE9D,SAAS,CAAC,GAAG,EAAE;YACb,OAAO,aAAa,EAAE,CAAA;QACxB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO,oBAAC,aAAa,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC/C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taro-minify-pack/react-lazy-enhanced",
|
|
3
|
-
"version": "0.0.5-alpha.
|
|
3
|
+
"version": "0.0.5-alpha.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
"react": ">=16"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^18.19.130",
|
|
22
21
|
"@types/react": "^18.3.27",
|
|
23
|
-
"@types/webpack-sources": "^3.2.3",
|
|
24
22
|
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
25
23
|
"@typescript-eslint/parser": "^8.26.1",
|
|
26
24
|
"eslint": "^8.19.0",
|
|
@@ -28,7 +26,6 @@
|
|
|
28
26
|
"eslint-plugin-import": "^2.26.0",
|
|
29
27
|
"eslint-plugin-n": "^15.2.3",
|
|
30
28
|
"eslint-plugin-promise": "^6.0.0",
|
|
31
|
-
"react": "^18.3.1",
|
|
32
29
|
"typescript": "^5.8.2"
|
|
33
30
|
},
|
|
34
31
|
"scripts": {
|
package/src/index.tsx
CHANGED
|
@@ -25,7 +25,7 @@ interface LoadData<T> {
|
|
|
25
25
|
|
|
26
26
|
type Factory<T extends ComponentType<any>> = () => Promise<Result<T>>;
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const lazyEnhanced = <T extends ComponentType<any>>(factory: Factory<T>) => {
|
|
29
29
|
const LazyComponent = React.lazy(factory) as ForwardRefExoticComponent<any>
|
|
30
30
|
const loadData: LoadData<T> = { status: Status.Uninitialized }
|
|
31
31
|
|