Fix resolution logic & tree-shaking

This commit is contained in:
Starbeamrainbowlabs 2019-04-28 21:19:30 +01:00
parent 77c7ad2548
commit be37afb750
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
7 changed files with 12 additions and 3 deletions

5
.npmignore Normal file
View File

@ -0,0 +1,5 @@
lantern-build-engine/
docs/
.tern-project
logo.piskel
logo-large.png

2
Client.mjs Normal file
View File

@ -0,0 +1,2 @@
import ClientRouter from './Client/Router.mjs';
export default ClientRouter;

View File

@ -58,7 +58,7 @@ class ClientRouter extends EventEmitter {
add_page(routespec, callback) { add_page(routespec, callback) {
this.routes.push({ this.routes.push({
spec: routespec, spec: routespec,
match: pathspec instanceof RegExp ? { regex: routespec, tokens: [] } : pathspec_to_regex(routespec), match: routespec instanceof RegExp ? { regex: routespec, tokens: [] } : pathspec_to_regex(routespec),
callback callback
}); });
} }

View File

@ -36,7 +36,7 @@ Syntax | Meaning
Initialise a new router like this: Initialise a new router like this:
```js ```js
import { ClientRouter } from 'powahroot'; import ClientRouter from 'powahroot/Client.mjs';
// .... // ....
@ -51,7 +51,7 @@ const router = new ClientRouter({
The server router works slightly differently, to account for the different environment it's designed for. Here's how to use it: The server router works slightly differently, to account for the different environment it's designed for. Here's how to use it:
```js ```js
import { ServerRouter } from 'powahroot'; import ServerRouter from 'powahroot/Server.mjs';
// .... // ....

2
Server.mjs Normal file
View File

@ -0,0 +1,2 @@
import ServerRouter from './Server/Router.mjs';
export default ServerRouter;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 317 B

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 234 B