Skip to content

Commit 5f00182

Browse files
Merge pull request #364 from preactjs/size-optimizations
Size & Build Optimizations
2 parents 61671b3 + 33b16c3 commit 5f00182

25 files changed

+10928
-7123
lines changed

.babelrc

-9
This file was deleted.

.eslintrc

-66
This file was deleted.

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/dist
2+
/coverage
23
/node_modules
34
/npm-debug.log
4-
/match.js
5-
/*.d.ts
65
.DS_Store
6+
/match/*.js

src/index.d.ts index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ declare module 'preact' {
6868
export interface Attributes extends RoutableProps {}
6969
}
7070

71-
export default Router;
71+
export default Router;

karma.conf.js

-37
This file was deleted.

src/match.d.ts match/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as preact from 'preact';
22

3-
import { Link as StaticLink, RoutableProps } from './';
3+
import { Link as StaticLink, RoutableProps } from '..';
44

55
export class Match extends preact.Component<RoutableProps, {}> {
66
render(): preact.VNode;
@@ -13,4 +13,4 @@ export interface LinkProps extends preact.JSX.HTMLAttributes {
1313

1414
export function Link(props: LinkProps): preact.VNode;
1515

16-
export default Match;
16+
export default Match;

match/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "index",
3+
"module": "./index.es.js",
4+
"main": "./index.js",
5+
"types": "./index.d.ts",
6+
"scripts": {
7+
"build": "microbundle src/index.js -f es -o . --no-sourcemap && microbundle src/cjs.js -f cjs -o . --no-sourcemap"
8+
},
9+
"peerDependencies": {
10+
"preact": "*",
11+
"preact-router": "*"
12+
}
13+
}

match/src/cjs.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { Match, Link } from './index';
2+
3+
Match.Link = Link;
4+
export default Match;

src/match.js match/src/index.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { h, Component } from 'preact';
22
import { subscribers, getCurrentUrl, Link as StaticLink, exec } from 'preact-router';
33

44
export class Match extends Component {
5-
update = url => {
6-
this.nextUrl = url;
7-
this.setState({});
8-
};
95
componentDidMount() {
6+
this.update = url => {
7+
this.nextUrl = url;
8+
this.setState({});
9+
};
1010
subscribers.push(this.update);
1111
}
1212
componentWillUnmount() {
@@ -33,4 +33,3 @@ export const Link = ({ activeClassName, path, ...props }) => (
3333
);
3434

3535
export default Match;
36-
Match.Link = Link;

0 commit comments

Comments
 (0)