Skip to content

Commit cf4f005

Browse files
authored
Merge pull request #204 from nomcopter/continue-dependency-update
Continue dependency update
2 parents 8bcf985 + 2d2d62a commit cf4f005

16 files changed

+718
-431
lines changed

.mocharc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require('jsdom-global/register');
2+
require('ts-node').register({
3+
transpileOnly: true,
4+
});
5+
6+
const mock = require('mock-require');
7+
mock('rdndmb-html5-to-touch', {});
8+
mock('react-dnd', {});
9+
mock('react-dnd-multi-backend', {});
10+
11+
module.exports = {
12+
spec: 'test/*.ts',
13+
};

demo/index.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { AppContainer } from 'react-hot-loader';
43
import { ExampleApp } from './ExampleApp';
54

65
const APP_ELEMENT = document.getElementById('app')!;
76
const render = (Component: React.ComponentClass<any>) => {
8-
ReactDOM.render(
9-
<AppContainer>
10-
<Component />
11-
</AppContainer>,
12-
APP_ELEMENT,
13-
);
7+
ReactDOM.render(<Component />, APP_ELEMENT);
148
};
159

1610
render(ExampleApp);
17-
18-
declare var module: any;
19-
if (module.hot) {
20-
module.hot.accept('./ExampleApp', () => {
21-
render(require('./ExampleApp').ExampleApp);
22-
});
23-
}

package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"license": "Apache-2.0",
66
"main": "lib/index.js",
77
"style": "lib/react-mosaic.css",
8+
"type": "commonjs",
89
"typings": "lib/index.d.ts",
910
"repository": {
1011
"type": "git",
@@ -32,15 +33,15 @@
3233
"prettier:run": "prettier 'styles/*.less' '*.md' '{,.}*.yml' '.circleci/*.yml'",
3334
"test": "npm-run-all build -lp test:**",
3435
"test:lint": "tslint -c tslint.yml -p tsconfig.json -e test",
35-
"test:unit": "mocha --opts test/mocha.opts 'test/*.ts'",
36+
"test:unit": "mocha",
3637
"test:format": "yarn run prettier:run --list-different",
3738
"fix": "npm-run-all -lp fix:**",
3839
"fix:format": "yarn run prettier:run --write",
3940
"fix:lint": "yarn run test:lint --fix",
4041
"version": "npm-run-all test bundle && git add -A docs/"
4142
},
4243
"dependencies": {
43-
"classnames": "^2.3.1",
44+
"classnames": "^2.3.2",
4445
"immutability-helper": "^3.1.1",
4546
"lodash": "^4.17.21",
4647
"prop-types": "^15.8.1",
@@ -52,50 +53,50 @@
5253
"uuid": "^9.0.0"
5354
},
5455
"devDependencies": {
55-
"@blueprintjs/core": "^4.7.0",
56-
"@blueprintjs/icons": "^4.4.0",
56+
"@blueprintjs/core": "^4.15.1",
57+
"@blueprintjs/icons": "^4.13.1",
58+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
5759
"@types/chai": "^4.3.0",
5860
"@types/classnames": "^2.3.1",
5961
"@types/dom4": "^2.0.2",
60-
"@types/lodash": "^4.14.180",
61-
"@types/mocha": "^5.2.7",
62-
"@types/prop-types": "^15.7.4",
63-
"@types/react": "^18.0.15",
64-
"@types/react-dom": "^18.0.6",
65-
"@types/react-hot-loader": "^4.1.1",
66-
"@types/uuid": "^3.4.10",
62+
"@types/lodash": "^4.14.191",
63+
"@types/mocha": "^7.0.2",
64+
"@types/prop-types": "^15.7.5",
65+
"@types/react": "^18.0.28",
66+
"@types/react-dom": "^18.0.10",
67+
"@types/uuid": "^9.0.0",
6768
"@types/webpack": "^5.28.0",
6869
"chai": "^4.3.6",
6970
"css-loader": "^6.7.3",
7071
"dnd-core": "16.0.1",
71-
"file-loader": "^6.2.0",
7272
"html-loader": "^4.2.0",
7373
"html-webpack-plugin": "^5.5.0",
7474
"jsdom": "^15.2.1",
7575
"jsdom-global": "^3.0.2",
7676
"less": "^3.13.1",
7777
"less-loader": "^11.1.0",
7878
"less-plugin-autoprefix": "^2.0.0",
79-
"mocha": "^7.2.0",
79+
"mocha": "^6.2.3",
8080
"mocha-junit-reporter": "^1.23.3",
81+
"mock-require": "^3.0.3",
8182
"npm-run-all": "^4.1.5",
82-
"prettier": "^2.6.1",
83+
"prettier": "^2.8.4",
8384
"react": "^18.2.0",
8485
"react-dom": "^18.2.0",
85-
"react-hot-loader": "^4.13.1",
86+
"react-refresh": "^0.14.0",
8687
"source-map-loader": "^4.0.1",
8788
"style-loader": "^3.3.1",
8889
"ts-loader": "^9.4.2",
89-
"ts-node": "^8.10.2",
90+
"ts-node": "^10.9.1",
9091
"tslint": "^6.1.3",
9192
"tslint-config-prettier": "^1.18.0",
9293
"tslint-plugin-prettier": "^2.3.0",
9394
"tslint-react": "^5.0.0",
94-
"typescript": "^4.6.3",
95+
"typescript": "^4.9.5",
9596
"webpack": "^5.75.0",
9697
"webpack-cli": "^5.0.1",
9798
"webpack-dev-server": "^4.11.1",
98-
"yarn-deduplicate": "^3.1.0"
99+
"yarn-deduplicate": "^6.0.1"
99100
},
100101
"peerDependencies": {
101102
"react": "16 - 18"

src/MosaicDropTarget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function MosaicDropTarget({ path, position }: MosaicDropTargetProps) {
1515
const { mosaicId } = useContext(MosaicContext);
1616
const [{ isOver, draggedMosaicId }, connectDropTarget] = useDrop({
1717
accept: MosaicDragType.WINDOW,
18-
drop: (item: MosaicDragItem, _monitor): MosaicDropData => {
19-
if (mosaicId === (item || {}).mosaicId) {
18+
drop: (item: MosaicDragItem | undefined, _monitor): MosaicDropData => {
19+
if (mosaicId === item?.mosaicId) {
2020
return { path, position };
2121
} else {
2222
return {};

src/MosaicWindow.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ function ConnectedInternalMosaicWindow<T extends MosaicKey = string>(props: Inte
258258
// The defer is necessary as the element must be present on start for HTML DnD to not cry
259259
const hideTimer = defer(() => mosaicActions.hide(props.path));
260260
return {
261-
mosaicId: mosaicId,
261+
mosaicId,
262262
hideTimer,
263263
};
264264
},
@@ -296,12 +296,10 @@ function ConnectedInternalMosaicWindow<T extends MosaicKey = string>(props: Inte
296296

297297
const [{ isOver, draggedMosaicId }, connectDropTarget] = useDrop({
298298
accept: MosaicDragType.WINDOW,
299-
collect(monitor: DropTargetMonitor<MosaicDragItem>) {
300-
return {
301-
isOver: monitor.isOver(),
302-
draggedMosaicId: (monitor.getItem() || {}).mosaicId,
303-
};
304-
},
299+
collect: (monitor: DropTargetMonitor<MosaicDragItem>) => ({
300+
isOver: monitor.isOver(),
301+
draggedMosaicId: monitor.getItem()?.mosaicId,
302+
}),
305303
});
306304
return (
307305
<InternalMosaicWindow

src/RootDropTargets.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { MosaicDragType } from './types';
1010
export const RootDropTargets = React.memo(() => {
1111
const [{ isDragging }] = useDrop({
1212
accept: MosaicDragType.WINDOW,
13-
collect(monitor) {
14-
return { isDragging: monitor.getItem() !== null && monitor.getItemType() === MosaicDragType.WINDOW };
15-
},
13+
collect: (monitor) => ({
14+
isDragging: monitor.getItem() !== null && monitor.getItemType() === MosaicDragType.WINDOW,
15+
}),
1616
});
1717
const delayedIsDragging = useDelayedTrue(isDragging, 0);
1818
return (

src/Split.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export class Split extends React.PureComponent<SplitProps> {
109109

110110
private onMouseMove = (event: MouseEvent | TouchEvent) => {
111111
event.preventDefault();
112-
event.stopPropagation();
113112

114113
this.throttledUpdatePercentage(event);
115114
};

src/util/OptionalBlueprint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export namespace OptionalBlueprint {
2424
};
2525

2626
type BlueprintClass = {
27-
[K in keyof typeof Classes]: typeof Classes[K] extends string ? K : never;
27+
[K in keyof typeof Classes]: (typeof Classes)[K] extends string ? K : never;
2828
}[keyof typeof Classes];
2929

3030
export function getClasses(blueprintNamespace: string, ...names: BlueprintClass[]): string {

test/mocha.opts

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/registerTsNode.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

tsconfig.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"forceConsistentCasingInFileNames": true,
88
"jsx": "react",
99
"lib": ["dom", "es5", "scripthost", "es2015.promise"],
10+
"moduleResolution": "node",
11+
"module": "commonjs",
1012
"noEmit": true,
1113
"noFallthroughCasesInSwitch": true,
1214
"noImplicitReturns": true,
@@ -17,9 +19,5 @@
1719
"sourceMap": true,
1820
"strict": true
1921
},
20-
"exclude": [
21-
"docs",
22-
"lib",
23-
"node_modules"
24-
]
22+
"exclude": ["docs", "lib", "node_modules"],
2523
}

webpack/base.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
22
import webpack from 'webpack';
33
import { CONSTANTS } from './constants';
44

5-
// tslint:disable-next-line no-var-requires
6-
const VENDOR_LIBS = Object.keys(require('../package.json').dependencies);
7-
85
const config: webpack.Configuration = {
9-
entry: {
10-
app: CONSTANTS.APP_ENTRY,
11-
vendor: VENDOR_LIBS,
12-
},
6+
entry: CONSTANTS.APP_ENTRY,
137
output: {
148
filename: '[name].js',
159
path: CONSTANTS.DOCS_DIR,
@@ -19,7 +13,7 @@ const config: webpack.Configuration = {
1913
extensions: ['.webpack.js', '.web.js', '.json', '.ts', '.js', '.tsx'],
2014
},
2115
optimization: {
22-
moduleIds: 'named'
16+
moduleIds: 'named',
2317
},
2418
module: {
2519
rules: [
@@ -58,7 +52,7 @@ const config: webpack.Configuration = {
5852
},
5953
{
6054
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff2?$|\.ttf$|\.eot$/,
61-
loader: 'file-loader',
55+
type: 'asset/resource',
6256
},
6357
{
6458
test: /\.less/,

webpack/bundle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import config from './base';
33

44
const bundleConfig: webpack.Configuration = {
55
...config,
6+
mode: 'production',
67
optimization: {
78
...config.optimization,
89
minimize: true,

webpack/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ export const CONSTANTS = {
66
HTML_TEMPLATE: path.join(__dirname, 'index-template.html'),
77
DOCS_DIR: path.join(__dirname, '..', 'docs/'),
88
DEV_SERVER_PORT: 8092,
9+
PUBLIC_PATH: '/public/',
910
};

webpack/hot.ts

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,12 @@
1+
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
12
import webpack from 'webpack';
3+
import 'webpack-dev-server';
24
import config from './base';
35
import { CONSTANTS } from './constants';
4-
import 'webpack-dev-server';
5-
6-
const baseEntry = config.entry as webpack.EntryObject;
7-
const entry = {
8-
...baseEntry,
9-
app: [
10-
// activate HMR for React
11-
'react-hot-loader/patch',
12-
13-
// bundle the client for webpack-dev-server
14-
// and connect to the provided endpoint
15-
'webpack-dev-server/client?http://localhost:' + CONSTANTS.DEV_SERVER_PORT,
16-
17-
// bundle the client for hot reloading
18-
// only- means to only hot reload for successful updates
19-
'webpack/hot/only-dev-server',
20-
baseEntry.app as string,
21-
],
22-
};
23-
24-
const rules = (config.module as webpack.ModuleOptions).rules?.map((loaderConf: any) => {
25-
if (loaderConf.test.test('test.ts')) {
26-
return {
27-
...loaderConf,
28-
use: [
29-
{
30-
loader: 'react-hot-loader/webpack',
31-
},
32-
...loaderConf.use,
33-
],
34-
};
35-
} else {
36-
return loaderConf;
37-
}
38-
});
39-
const module = {
40-
...config.module,
41-
rules,
42-
};
436

447
const hotConfig: webpack.Configuration = {
458
...config,
469
mode: 'development',
47-
entry,
48-
module,
4910
devtool: 'cheap-module-source-map',
5011
stats: 'minimal',
5112
optimization: {
@@ -57,8 +18,8 @@ const hotConfig: webpack.Configuration = {
5718
hot: true,
5819
host: '0.0.0.0',
5920
port: CONSTANTS.DEV_SERVER_PORT,
60-
open: true,
6121
},
22+
plugins: [...(config.plugins || []), new ReactRefreshWebpackPlugin()],
6223
};
6324

6425
// tslint:disable-next-line no-default-export

0 commit comments

Comments
 (0)