@wix/cli-app 1.0.68 → 1.0.70
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/build/index.js +141 -157
- package/build/index.js.map +1 -1
- package/client.d.ts +1 -0
- package/internal/hot-page.ts +41 -0
- package/package.json +7 -4
- package/tsconfig.app.json +2 -1
package/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
/// <reference types="vite/client" />
|
|
3
|
+
import type { ComponentType } from 'react';
|
|
4
|
+
import { useState, useRef, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
export function createHotPageWrapper(
|
|
7
|
+
OriginalPage: ComponentType<unknown>,
|
|
8
|
+
hotData: {
|
|
9
|
+
page?: ComponentType<unknown>;
|
|
10
|
+
setPage?: (NewPage: ComponentType<unknown>) => void;
|
|
11
|
+
}
|
|
12
|
+
) {
|
|
13
|
+
const Wrapper = import.meta.hot
|
|
14
|
+
? () => {
|
|
15
|
+
const [WrappedPage, setPage] = useState<ComponentType<unknown>>(
|
|
16
|
+
hotData.page ?? OriginalPage
|
|
17
|
+
);
|
|
18
|
+
const isMountedRef = useRef(false);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
hotData.setPage = (NewPage) => {
|
|
22
|
+
hotData.page = NewPage;
|
|
23
|
+
if (isMountedRef.current) {
|
|
24
|
+
setPage(NewPage);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, [setPage]);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
isMountedRef.current = true;
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
isMountedRef.current = false;
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return WrappedPage;
|
|
37
|
+
}
|
|
38
|
+
: OriginalPage;
|
|
39
|
+
|
|
40
|
+
return Wrapper;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/cli-app",
|
|
3
3
|
"description": "CLI tool for Wix apps",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.70",
|
|
5
5
|
"author": "Amit Dahan",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@vitejs/plugin-react-swc": "3.3.0",
|
|
8
|
-
"vite": "4.3.
|
|
8
|
+
"vite": "4.3.4"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@rollup/plugin-virtual": "^3.0.1",
|
|
@@ -56,13 +56,16 @@
|
|
|
56
56
|
"./client": {
|
|
57
57
|
"types": "./client.d.ts"
|
|
58
58
|
},
|
|
59
|
+
"./internal/hot-page": "./internal/hot-page.ts",
|
|
59
60
|
"./tsconfig.app.json": "./tsconfig.app.json",
|
|
60
61
|
"./package.json": "./package.json"
|
|
61
62
|
},
|
|
62
63
|
"files": [
|
|
63
64
|
"build",
|
|
64
65
|
"!build/**/*.d.ts",
|
|
65
|
-
"tsconfig.app.json"
|
|
66
|
+
"tsconfig.app.json",
|
|
67
|
+
"client.d.ts",
|
|
68
|
+
"internal"
|
|
66
69
|
],
|
|
67
70
|
"peerDependencies": {
|
|
68
71
|
"react": "^16.14 || ^17 || ^18",
|
|
@@ -105,5 +108,5 @@
|
|
|
105
108
|
]
|
|
106
109
|
}
|
|
107
110
|
},
|
|
108
|
-
"falconPackageHash": "
|
|
111
|
+
"falconPackageHash": "2eb5fd2643efc7e96e0c6b4ac5d898ab629a654483de2855da6c1548"
|
|
109
112
|
}
|