@dr.pogodin/react-utils 1.34.1 → 1.35.1
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/development/index.js +0 -7
- package/build/development/index.js.map +1 -1
- package/build/development/shared/utils/index.js +0 -11
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +6 -2
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/web.bundle.js +2 -2
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/shared/utils/index.js +1 -4
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/index.d.ts +1 -1
- package/build/types-code/shared/utils/index.d.ts +1 -3
- package/build/types-code/shared/utils/jest/index.d.ts +2 -2
- package/build/types-code/shared/utils/splitComponent.d.ts +1 -0
- package/jest.d.ts +1 -0
- package/package.json +11 -10
- package/src/index.ts +0 -1
- package/src/shared/utils/index.ts +0 -17
- package/src/shared/utils/jest/index.tsx +8 -3
|
@@ -6,5 +6,5 @@ export { default as api } from 'axios';
|
|
|
6
6
|
export * as PT from 'prop-types';
|
|
7
7
|
export { type AsyncCollectionLoaderT, type AsyncDataEnvelopeT, type AsyncDataLoaderT, type ForceT, type UseAsyncDataOptionsT, type UseAsyncDataResT, type UseGlobalStateResT, type ValueOrInitializerT, getGlobalState, GlobalStateProvider, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, withGlobalStateType, } from '@dr.pogodin/react-global-state';
|
|
8
8
|
export * from './shared/components';
|
|
9
|
-
export { type Theme, config, Barrier, Emitter, isomorphy, getSsrContext,
|
|
9
|
+
export { type Theme, config, Barrier, Emitter, isomorphy, getSsrContext, Semaphore, splitComponent, themed, ThemeProvider, time, webpack, withRetries, } from './shared/utils';
|
|
10
10
|
export { client, server };
|
|
@@ -3,7 +3,6 @@ import config from './config';
|
|
|
3
3
|
import * as isomorphy from './isomorphy';
|
|
4
4
|
import time from './time';
|
|
5
5
|
import * as webpack from './webpack';
|
|
6
|
-
import type * as JuT from './jest';
|
|
7
6
|
export { Barrier, Emitter, Semaphore, withRetries, } from '@dr.pogodin/js-utils';
|
|
8
7
|
export { getSsrContext } from './globalState';
|
|
9
8
|
export { default as splitComponent } from './splitComponent';
|
|
@@ -12,5 +11,4 @@ type ThemedT = typeof themedImpl & {
|
|
|
12
11
|
PRIORITY: typeof PRIORITY;
|
|
13
12
|
};
|
|
14
13
|
declare const themed: ThemedT;
|
|
15
|
-
|
|
16
|
-
export { type Theme, config, isomorphy, JU, themed, ThemeProvider, time, webpack, };
|
|
14
|
+
export { type Theme, config, isomorphy, themed, ThemeProvider, time, webpack, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="trusted-types" />
|
|
2
1
|
import { type ReactNode, act } from 'react';
|
|
2
|
+
import { type RenderResult } from '@testing-library/react';
|
|
3
3
|
/**
|
|
4
4
|
* An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)
|
|
5
5
|
* from `react`.
|
|
@@ -42,4 +42,4 @@ export type MountedSceneT = HTMLElement & {
|
|
|
42
42
|
* attached.
|
|
43
43
|
*/
|
|
44
44
|
export declare function mount(scene: ReactNode): MountedSceneT;
|
|
45
|
-
export declare function snapshot(element: React.ReactElement):
|
|
45
|
+
export declare function snapshot(element: React.ReactElement): RenderResult;
|
package/jest.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './build/types-code/shared/utils/jest/index';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.35.1",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"react": "^18.3.1",
|
|
37
37
|
"react-dom": "^18.3.1",
|
|
38
38
|
"react-helmet": "^6.1.0",
|
|
39
|
-
"react-router-dom": "^6.23.
|
|
39
|
+
"react-router-dom": "^6.23.1",
|
|
40
40
|
"request-ip": "^3.3.0",
|
|
41
|
-
"rimraf": "^5.0.
|
|
41
|
+
"rimraf": "^5.0.7",
|
|
42
42
|
"serialize-javascript": "^6.0.2",
|
|
43
43
|
"serve-favicon": "^2.5.0",
|
|
44
44
|
"source-map-support": "^0.5.21",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@dr.pogodin/babel-preset-svgr": "^1.8.0",
|
|
62
62
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
|
|
63
63
|
"@testing-library/dom": "^10.1.0",
|
|
64
|
-
"@testing-library/react": "^15.0.
|
|
64
|
+
"@testing-library/react": "^15.0.7",
|
|
65
65
|
"@testing-library/user-event": "^14.5.2",
|
|
66
66
|
"@tsconfig/recommended": "^1.0.6",
|
|
67
67
|
"@tsd/typescript": "^5.4.5",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/morgan": "^1.9.9",
|
|
77
77
|
"@types/node-forge": "^1.3.11",
|
|
78
78
|
"@types/pretty": "^2.0.3",
|
|
79
|
-
"@types/react": "^18.3.
|
|
79
|
+
"@types/react": "^18.3.2",
|
|
80
80
|
"@types/react-dom": "^18.3.0",
|
|
81
81
|
"@types/react-helmet": "^6.1.11",
|
|
82
82
|
"@types/request-ip": "^0.0.41",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"babel-jest": "^29.7.0",
|
|
90
90
|
"babel-loader": "^9.1.3",
|
|
91
91
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
92
|
-
"core-js": "^3.37.
|
|
92
|
+
"core-js": "^3.37.1",
|
|
93
93
|
"css-loader": "^7.1.1",
|
|
94
|
-
"css-minimizer-webpack-plugin": "^
|
|
94
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
95
95
|
"eslint": "^8.57.0",
|
|
96
96
|
"eslint-config-airbnb": "^19.0.4",
|
|
97
97
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
@@ -115,16 +115,16 @@
|
|
|
115
115
|
"react-refresh": "^0.14.2",
|
|
116
116
|
"regenerator-runtime": "^0.14.1",
|
|
117
117
|
"resolve-url-loader": "^5.0.0",
|
|
118
|
-
"sass": "^1.
|
|
118
|
+
"sass": "^1.77.1",
|
|
119
119
|
"sass-loader": "^14.2.1",
|
|
120
120
|
"sitemap": "^7.1.1",
|
|
121
121
|
"stylelint": "^16.5.0",
|
|
122
122
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
123
123
|
"supertest": "^7.0.0",
|
|
124
|
-
"tsc-alias": "^1.8.
|
|
124
|
+
"tsc-alias": "^1.8.10",
|
|
125
125
|
"typed-scss-modules": "^8.0.1",
|
|
126
126
|
"typescript": "^5.4.5",
|
|
127
|
-
"typescript-eslint": "^7.
|
|
127
|
+
"typescript-eslint": "^7.9.0",
|
|
128
128
|
"webpack": "^5.91.0",
|
|
129
129
|
"webpack-dev-middleware": "^7.2.1",
|
|
130
130
|
"webpack-hot-middleware": "^2.26.1",
|
|
@@ -154,6 +154,7 @@
|
|
|
154
154
|
"react-native": "./node-entry.js"
|
|
155
155
|
},
|
|
156
156
|
"./config/*": "./config/*.js",
|
|
157
|
+
"./jest": "./build/production/shared/utils/jest/index.js",
|
|
157
158
|
"./mixins": "./src/styles/mixins.scss",
|
|
158
159
|
"./dev-styles": {
|
|
159
160
|
"node": "./null.js",
|
package/src/index.ts
CHANGED
|
@@ -10,8 +10,6 @@ import * as isomorphy from './isomorphy';
|
|
|
10
10
|
import time from './time';
|
|
11
11
|
import * as webpack from './webpack';
|
|
12
12
|
|
|
13
|
-
import type * as JuT from './jest';
|
|
14
|
-
|
|
15
13
|
export {
|
|
16
14
|
Barrier,
|
|
17
15
|
Emitter,
|
|
@@ -32,25 +30,10 @@ const themed: ThemedT = themedImpl as ThemedT;
|
|
|
32
30
|
themed.COMPOSE = COMPOSE;
|
|
33
31
|
themed.PRIORITY = PRIORITY;
|
|
34
32
|
|
|
35
|
-
// Note: it should be done this way, as in some environments
|
|
36
|
-
// "process" might not exist, and process.env.NODE_CONFIG_ENV
|
|
37
|
-
// not injected by Webpack.
|
|
38
|
-
let NODE_CONFIG_ENV;
|
|
39
|
-
try {
|
|
40
|
-
NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;
|
|
41
|
-
} catch { /* noop */ }
|
|
42
|
-
|
|
43
|
-
const env = NODE_CONFIG_ENV || process.env.NODE_ENV;
|
|
44
|
-
|
|
45
|
-
const JU: typeof JuT | null = env !== 'production'
|
|
46
|
-
? webpack.requireWeak('./jest', __dirname) as typeof JuT | null
|
|
47
|
-
: null;
|
|
48
|
-
|
|
49
33
|
export {
|
|
50
34
|
type Theme,
|
|
51
35
|
config,
|
|
52
36
|
isomorphy,
|
|
53
|
-
JU,
|
|
54
37
|
themed,
|
|
55
38
|
ThemeProvider,
|
|
56
39
|
time,
|
|
@@ -5,7 +5,7 @@ import mockdate from 'mockdate';
|
|
|
5
5
|
import { type ReactNode, act } from 'react';
|
|
6
6
|
import { type Root, createRoot } from 'react-dom/client';
|
|
7
7
|
|
|
8
|
-
import { render } from '@testing-library/react';
|
|
8
|
+
import { type RenderResult, render } from '@testing-library/react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)
|
|
@@ -101,7 +101,12 @@ export function mount(scene: ReactNode): MountedSceneT {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export function snapshot(element: React.ReactElement) {
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
let res: RenderResult | undefined;
|
|
105
|
+
act(() => {
|
|
106
|
+
res = render(element);
|
|
107
|
+
});
|
|
108
|
+
if (res === undefined) throw Error('Render failed');
|
|
109
|
+
|
|
110
|
+
expect(res.asFragment().firstChild).toMatchSnapshot();
|
|
106
111
|
return res;
|
|
107
112
|
}
|