@merkur/plugin-router 0.32.0 → 0.33.0
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/lib/index.cjs +5 -8
- package/lib/index.es9.cjs +1 -4
- package/lib/index.es9.mjs +2 -5
- package/lib/index.js +5 -8
- package/lib/index.mjs +6 -9
- package/package.json +5 -5
package/lib/index.cjs
CHANGED
|
@@ -22,10 +22,7 @@ function createRouter(widget, routes, options) {
|
|
|
22
22
|
function routerPlugin() {
|
|
23
23
|
return {
|
|
24
24
|
async setup(widget) {
|
|
25
|
-
widget
|
|
26
|
-
...routerAPI(),
|
|
27
|
-
...widget,
|
|
28
|
-
};
|
|
25
|
+
core.assignMissingKeys(widget, routerAPI());
|
|
29
26
|
|
|
30
27
|
widget.$in.router = {
|
|
31
28
|
route: null,
|
|
@@ -43,13 +40,13 @@ function routerPlugin() {
|
|
|
43
40
|
if (ENV === DEV) {
|
|
44
41
|
if (!widget.$in.component) {
|
|
45
42
|
throw new Error(
|
|
46
|
-
'You must install missing plugin: npm i @merkur/plugin-component'
|
|
43
|
+
'You must install missing plugin: npm i @merkur/plugin-component',
|
|
47
44
|
);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
if (!widget.$in.eventEmitter) {
|
|
51
48
|
throw new Error(
|
|
52
|
-
'You must install missing plugin: npm i @merkur/plugin-event-emitter'
|
|
49
|
+
'You must install missing plugin: npm i @merkur/plugin-event-emitter',
|
|
53
50
|
);
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -57,7 +54,7 @@ function routerPlugin() {
|
|
|
57
54
|
widget.$in.component.lifeCycle = core.setDefaultValueForUndefined(
|
|
58
55
|
widget.$in.component.lifeCycle,
|
|
59
56
|
['load'],
|
|
60
|
-
() => {}
|
|
57
|
+
() => {},
|
|
61
58
|
);
|
|
62
59
|
core.hookMethod(widget, '$in.component.lifeCycle.load', loadHook);
|
|
63
60
|
core.hookMethod(widget, 'bootstrap', bootstrapHook);
|
|
@@ -192,7 +189,7 @@ async function resolveRoute(widget) {
|
|
|
192
189
|
|
|
193
190
|
if (!widget.$dependencies.router) {
|
|
194
191
|
throw new Error(
|
|
195
|
-
'You must add calling of createRouter(widget, routes, options) to widget.setup method.'
|
|
192
|
+
'You must add calling of createRouter(widget, routes, options) to widget.setup method.',
|
|
196
193
|
);
|
|
197
194
|
}
|
|
198
195
|
}
|
package/lib/index.es9.cjs
CHANGED
|
@@ -15,10 +15,7 @@ function createRouter(widget, routes, options) {
|
|
|
15
15
|
function routerPlugin() {
|
|
16
16
|
return {
|
|
17
17
|
async setup(widget) {
|
|
18
|
-
widget
|
|
19
|
-
...routerAPI(),
|
|
20
|
-
...widget
|
|
21
|
-
};
|
|
18
|
+
core.assignMissingKeys(widget, routerAPI());
|
|
22
19
|
widget.$in.router = {
|
|
23
20
|
route: null,
|
|
24
21
|
pathname: null,
|
package/lib/index.es9.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bindWidgetToFunctions, setDefaultValueForUndefined, hookMethod, isFunction } from '@merkur/core';
|
|
1
|
+
import { assignMissingKeys, bindWidgetToFunctions, setDefaultValueForUndefined, hookMethod, isFunction } from '@merkur/core';
|
|
2
2
|
import UniversalRouter from 'universal-router';
|
|
3
3
|
import generateUrls from 'universal-router/generateUrls';
|
|
4
4
|
var RouterEvents = Object.freeze({
|
|
@@ -13,10 +13,7 @@ function createRouter(widget, routes, options) {
|
|
|
13
13
|
function routerPlugin() {
|
|
14
14
|
return {
|
|
15
15
|
async setup(widget) {
|
|
16
|
-
widget
|
|
17
|
-
...routerAPI(),
|
|
18
|
-
...widget
|
|
19
|
-
};
|
|
16
|
+
assignMissingKeys(widget, routerAPI());
|
|
20
17
|
widget.$in.router = {
|
|
21
18
|
route: null,
|
|
22
19
|
pathname: null,
|
package/lib/index.js
CHANGED
|
@@ -22,10 +22,7 @@ function createRouter(widget, routes, options) {
|
|
|
22
22
|
function routerPlugin() {
|
|
23
23
|
return {
|
|
24
24
|
async setup(widget) {
|
|
25
|
-
widget
|
|
26
|
-
...routerAPI(),
|
|
27
|
-
...widget,
|
|
28
|
-
};
|
|
25
|
+
core.assignMissingKeys(widget, routerAPI());
|
|
29
26
|
|
|
30
27
|
widget.$in.router = {
|
|
31
28
|
route: null,
|
|
@@ -43,13 +40,13 @@ function routerPlugin() {
|
|
|
43
40
|
if (ENV === DEV) {
|
|
44
41
|
if (!widget.$in.component) {
|
|
45
42
|
throw new Error(
|
|
46
|
-
'You must install missing plugin: npm i @merkur/plugin-component'
|
|
43
|
+
'You must install missing plugin: npm i @merkur/plugin-component',
|
|
47
44
|
);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
if (!widget.$in.eventEmitter) {
|
|
51
48
|
throw new Error(
|
|
52
|
-
'You must install missing plugin: npm i @merkur/plugin-event-emitter'
|
|
49
|
+
'You must install missing plugin: npm i @merkur/plugin-event-emitter',
|
|
53
50
|
);
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -57,7 +54,7 @@ function routerPlugin() {
|
|
|
57
54
|
widget.$in.component.lifeCycle = core.setDefaultValueForUndefined(
|
|
58
55
|
widget.$in.component.lifeCycle,
|
|
59
56
|
['load'],
|
|
60
|
-
() => {}
|
|
57
|
+
() => {},
|
|
61
58
|
);
|
|
62
59
|
core.hookMethod(widget, '$in.component.lifeCycle.load', loadHook);
|
|
63
60
|
core.hookMethod(widget, 'bootstrap', bootstrapHook);
|
|
@@ -192,7 +189,7 @@ async function resolveRoute(widget) {
|
|
|
192
189
|
|
|
193
190
|
if (!widget.$dependencies.router) {
|
|
194
191
|
throw new Error(
|
|
195
|
-
'You must add calling of createRouter(widget, routes, options) to widget.setup method.'
|
|
192
|
+
'You must add calling of createRouter(widget, routes, options) to widget.setup method.',
|
|
196
193
|
);
|
|
197
194
|
}
|
|
198
195
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bindWidgetToFunctions, setDefaultValueForUndefined, hookMethod, isFunction } from '@merkur/core';
|
|
1
|
+
import { assignMissingKeys, bindWidgetToFunctions, setDefaultValueForUndefined, hookMethod, isFunction } from '@merkur/core';
|
|
2
2
|
import UniversalRouter from 'universal-router';
|
|
3
3
|
import generateUrls from 'universal-router/generateUrls';
|
|
4
4
|
|
|
@@ -20,10 +20,7 @@ function createRouter(widget, routes, options) {
|
|
|
20
20
|
function routerPlugin() {
|
|
21
21
|
return {
|
|
22
22
|
async setup(widget) {
|
|
23
|
-
widget
|
|
24
|
-
...routerAPI(),
|
|
25
|
-
...widget,
|
|
26
|
-
};
|
|
23
|
+
assignMissingKeys(widget, routerAPI());
|
|
27
24
|
|
|
28
25
|
widget.$in.router = {
|
|
29
26
|
route: null,
|
|
@@ -41,13 +38,13 @@ function routerPlugin() {
|
|
|
41
38
|
if (ENV === DEV) {
|
|
42
39
|
if (!widget.$in.component) {
|
|
43
40
|
throw new Error(
|
|
44
|
-
'You must install missing plugin: npm i @merkur/plugin-component'
|
|
41
|
+
'You must install missing plugin: npm i @merkur/plugin-component',
|
|
45
42
|
);
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
if (!widget.$in.eventEmitter) {
|
|
49
46
|
throw new Error(
|
|
50
|
-
'You must install missing plugin: npm i @merkur/plugin-event-emitter'
|
|
47
|
+
'You must install missing plugin: npm i @merkur/plugin-event-emitter',
|
|
51
48
|
);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
@@ -55,7 +52,7 @@ function routerPlugin() {
|
|
|
55
52
|
widget.$in.component.lifeCycle = setDefaultValueForUndefined(
|
|
56
53
|
widget.$in.component.lifeCycle,
|
|
57
54
|
['load'],
|
|
58
|
-
() => {}
|
|
55
|
+
() => {},
|
|
59
56
|
);
|
|
60
57
|
hookMethod(widget, '$in.component.lifeCycle.load', loadHook);
|
|
61
58
|
hookMethod(widget, 'bootstrap', bootstrapHook);
|
|
@@ -190,7 +187,7 @@ async function resolveRoute(widget) {
|
|
|
190
187
|
|
|
191
188
|
if (!widget.$dependencies.router) {
|
|
192
189
|
throw new Error(
|
|
193
|
-
'You must add calling of createRouter(widget, routes, options) to widget.setup method.'
|
|
190
|
+
'You must add calling of createRouter(widget, routes, options) to widget.setup method.',
|
|
194
191
|
);
|
|
195
192
|
}
|
|
196
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/plugin-router",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Merkur router plugin.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://merkur.js.org/",
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@merkur/core": "^0.
|
|
60
|
-
"@merkur/plugin-component": "^0.
|
|
61
|
-
"@merkur/plugin-event-emitter": "^0.
|
|
59
|
+
"@merkur/core": "^0.33.0",
|
|
60
|
+
"@merkur/plugin-component": "^0.33.0",
|
|
61
|
+
"@merkur/plugin-event-emitter": "^0.33.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@merkur/core": "*",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"universal-router": "^9.1.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "3e88b57abfad267ac3f3b20b2ae6bf50f93f5375"
|
|
72
72
|
}
|