@common-stack/client-react 0.6.1-alpha.4 → 1.0.1-alpha.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/__tests__/fill-register-test.js +16 -41
- package/lib/__tests__/fill-register-test.js.map +1 -1
- package/lib/__tests__/helpers/sample-menu.js +1 -4
- package/lib/__tests__/helpers/sample-menu.js.map +1 -1
- package/lib/__tests__/integrated-routes.test.js +17 -44
- package/lib/__tests__/integrated-routes.test.js.map +1 -1
- package/lib/__tests__/router-render.test.js +14 -57
- package/lib/__tests__/router-render.test.js.map +1 -1
- package/lib/connector/base-connector.d.ts +53 -0
- package/lib/connector/base-connector.js +129 -0
- package/lib/connector/base-connector.js.map +1 -0
- package/lib/connector/connector.d.ts +9 -0
- package/lib/connector/connector.js +14 -0
- package/lib/connector/connector.js.map +1 -0
- package/lib/connector/connector.native.d.ts +9 -0
- package/lib/connector/connector.native.js +15 -0
- package/lib/connector/connector.native.js.map +1 -0
- package/lib/connector/connector.test.js +11 -0
- package/lib/connector/connector.test.js.map +1 -0
- package/lib/connector/index.d.ts +1 -0
- package/lib/connector/index.js +2 -0
- package/lib/connector/index.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +10 -29
- package/lib/index.js.map +1 -1
- package/lib/index.native.d.ts +1 -1
- package/lib/index.native.js +10 -28
- package/lib/index.native.js.map +1 -1
- package/lib/interfaces/extended-feature.d.ts +50 -0
- package/lib/interfaces/extended-feature.js +1 -56
- package/lib/interfaces/extended-feature.js.map +1 -1
- package/lib/interfaces/feature.d.ts +13 -0
- package/lib/interfaces/feature.js +2 -0
- package/lib/interfaces/feature.js.map +1 -0
- package/lib/interfaces/index.d.ts +2 -0
- package/lib/interfaces/index.js +5 -20
- package/lib/interfaces/index.js.map +1 -1
- package/lib/interfaces/menu.js +2 -5
- package/lib/interfaces/menu.js.map +1 -1
- package/lib/interfaces/new-router.js +1 -2
- package/lib/interfaces/router.js +1 -2
- package/lib/inversify/InversifyContext.d.ts +3 -3
- package/lib/inversify/InversifyContext.js +6 -34
- package/lib/inversify/InversifyContext.js.map +1 -1
- package/lib/inversify/index.js +1 -17
- package/lib/inversify/index.js.map +1 -1
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js +13 -38
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/plugin-area/base-plugin-area.js +18 -39
- package/lib/plugin-area/base-plugin-area.js.map +1 -1
- package/lib/plugin-area/higher-order-component-util.js +3 -7
- package/lib/plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/plugin-area/index.js +5 -35
- package/lib/plugin-area/index.js.map +1 -1
- package/lib/plugin-area/index.native.js +7 -37
- package/lib/plugin-area/index.native.js.map +1 -1
- package/lib/plugin-area/plugin-api.js +15 -18
- package/lib/plugin-area/plugin-api.js.map +1 -1
- package/lib/plugin-area/plugin-context.js +5 -32
- package/lib/plugin-area/plugin-context.js.map +1 -1
- package/lib/route/__tests__/admin-new-routes.test.js +11 -45
- package/lib/route/__tests__/admin-new-routes.test.js.map +1 -1
- package/lib/route/__tests__/getFlatMenus.test.js +5 -7
- package/lib/route/__tests__/getFlatMenus.test.js.map +1 -1
- package/lib/route/__tests__/render-routes-config.test.js +6 -18
- package/lib/route/__tests__/render-routes-config.test.js.map +1 -1
- package/lib/route/__tests__/route-type.test.js +1 -2
- package/lib/route/__tests__/route-type.test.js.map +1 -1
- package/lib/route/get-routes.js +22 -29
- package/lib/route/get-routes.js.map +1 -1
- package/lib/route/get-routes.test.js +6 -17
- package/lib/route/get-routes.test.js.map +1 -1
- package/lib/route/index.js +2 -18
- package/lib/route/index.js.map +1 -1
- package/lib/route/index.native.js +1 -17
- package/lib/route/index.native.js.map +1 -1
- package/lib/route/old/__tests__/config-sidebar-menu.test.d.ts +1 -0
- package/lib/route/old/__tests__/config-sidebar-menu.test.js +199 -198
- package/lib/route/old/__tests__/config-sidebar-menu.test.js.map +1 -1
- package/lib/route/old/get-menus.js +14 -21
- package/lib/route/old/get-menus.js.map +1 -1
- package/lib/route/old/get-routes-notused.js +14 -12
- package/lib/route/old/get-routes-notused.js.map +1 -1
- package/lib/route/old/render.js +4 -31
- package/lib/route/old/render.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.js +35 -40
- package/lib/route/react-navigation/get-navigation-utils.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.test.js +19 -21
- package/lib/route/react-navigation/get-navigation-utils.test.js.map +1 -1
- package/lib/route/react-navigation/index.js +2 -18
- package/lib/route/react-navigation/index.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample.test.js +8 -22
- package/lib/route/react-navigation/react-native.sample.test.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample1.test.js +14 -48
- package/lib/route/react-navigation/react-native.sample1.test.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.js +16 -31
- package/lib/route/react-navigation/react-navigation-render.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.test.js +23 -37
- package/lib/route/react-navigation/react-navigation-render.test.js.map +1 -1
- package/lib/route/react-navigation/root-navigation.js +5 -9
- package/lib/route/react-navigation/root-navigation.js.map +1 -1
- package/lib/route/react-navigation/routes.js +1 -2
- package/lib/route/react-navigation/types.js +1 -5
- package/lib/route/react-navigation/types.js.map +1 -1
- package/lib/route/render-routes.js +33 -66
- package/lib/route/render-routes.js.map +1 -1
- package/lib/route/render-routes.native.js +33 -66
- package/lib/route/render-routes.native.js.map +1 -1
- package/lib/route/render-routes.test.js +112 -126
- package/lib/route/render-routes.test.js.map +1 -1
- package/lib/route/root-navigation.js +3 -7
- package/lib/route/root-navigation.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js +13 -38
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/route-based-plugin-area/higher-order-component-util.js +3 -7
- package/lib/route-based-plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/route-based-plugin-area/index.js +2 -18
- package/lib/route-based-plugin-area/index.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-api.js +15 -18
- package/lib/route-based-plugin-area/plugin-api.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-context.js +5 -32
- package/lib/route-based-plugin-area/plugin-context.js.map +1 -1
- package/lib/route-based-plugin-area/route-based-plugin-area.js +12 -39
- package/lib/route-based-plugin-area/route-based-plugin-area.js.map +1 -1
- package/lib/router-factory/index.d.ts +1 -1
- package/lib/router-factory/index.js +6 -32
- package/lib/router-factory/index.js.map +1 -1
- package/lib/router-factory/index.native.d.ts +1 -1
- package/lib/router-factory/index.native.js +6 -32
- package/lib/router-factory/index.native.js.map +1 -1
- package/lib/utils/before-ssr.d.ts +5 -0
- package/lib/utils/before-ssr.js +9 -0
- package/lib/utils/before-ssr.js.map +1 -0
- package/lib/utils/combine.d.ts +1 -0
- package/lib/utils/combine.js +3 -0
- package/lib/utils/combine.js.map +1 -0
- package/lib/utils/hydrate.d.ts +4 -0
- package/lib/utils/hydrate.js +14 -0
- package/lib/utils/hydrate.js.map +1 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +5 -18
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/sort-keys.js +3 -10
- package/lib/utils/sort-keys.js.map +1 -1
- package/lib/utils/sort-keys.test.js +2 -4
- package/lib/utils/sort-keys.test.js.map +1 -1
- package/lib/utils/utils.js +1 -5
- package/lib/utils/utils.js.map +1 -1
- package/package.json +6 -5
- package/lib/application/__tests__/react-client.test.d.ts +0 -1
- package/lib/application/__tests__/react-client.test.js +0 -23
- package/lib/application/__tests__/react-client.test.js.map +0 -1
- package/lib/application/base-apollo-client.d.ts +0 -21
- package/lib/application/base-apollo-client.js +0 -161
- package/lib/application/base-apollo-client.js.map +0 -1
- package/lib/application/base-redux-config.d.ts +0 -22
- package/lib/application/base-redux-config.js +0 -58
- package/lib/application/base-redux-config.js.map +0 -1
- package/lib/application/config.d.ts +0 -4
- package/lib/application/config.js +0 -38
- package/lib/application/config.js.map +0 -1
- package/lib/application/react-client.d.ts +0 -7
- package/lib/application/react-client.js +0 -152
- package/lib/application/react-client.js.map +0 -1
- package/lib/connector/base-react-client-feature.d.ts +0 -31
- package/lib/connector/base-react-client-feature.js +0 -102
- package/lib/connector/base-react-client-feature.js.map +0 -1
- package/lib/connector/monaco-connector.d.ts +0 -19
- package/lib/connector/monaco-connector.js +0 -76
- package/lib/connector/monaco-connector.js.map +0 -1
- package/lib/connector/react-client-feature.d.ts +0 -7
- package/lib/connector/react-client-feature.js +0 -15
- package/lib/connector/react-client-feature.js.map +0 -1
- package/lib/connector/react-client-feature.native.d.ts +0 -7
- package/lib/connector/react-client-feature.native.js +0 -18
- package/lib/connector/react-client-feature.native.js.map +0 -1
- package/lib/connector/react-client-feature.test.js +0 -10
- package/lib/connector/react-client-feature.test.js.map +0 -1
- package/lib/interfaces/monaco-feature.d.ts +0 -46
- package/lib/interfaces/monaco-feature.js +0 -3
- package/lib/interfaces/monaco-feature.js.map +0 -1
- package/lib/interfaces/react-client-feature.d.ts +0 -77
- package/lib/interfaces/react-client-feature.js +0 -3
- package/lib/interfaces/react-client-feature.js.map +0 -1
- /package/lib/connector/{react-client-feature.test.d.ts → connector.test.d.ts} +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createHigherOrderComponent = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
1
|
+
import { camelCase, upperFirst } from 'lodash-es';
|
|
5
2
|
/**
|
|
6
3
|
* Given a function mapping a component to an enhanced component and modifier
|
|
7
4
|
* name, returns the enhanced component augmented with a generated displayName.
|
|
@@ -11,13 +8,12 @@ const lodash_1 = require("lodash");
|
|
|
11
8
|
*
|
|
12
9
|
* @return Component class with generated display name assigned.
|
|
13
10
|
*/
|
|
14
|
-
function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) {
|
|
11
|
+
export function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) {
|
|
15
12
|
return (OriginalComponent) => {
|
|
16
13
|
const EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent);
|
|
17
14
|
const { displayName = OriginalComponent.name || 'Component', } = OriginalComponent;
|
|
18
|
-
EnhancedComponent.displayName = `${
|
|
15
|
+
EnhancedComponent.displayName = `${upperFirst(camelCase(modifierName))}(${displayName})`;
|
|
19
16
|
return EnhancedComponent;
|
|
20
17
|
};
|
|
21
18
|
}
|
|
22
|
-
exports.createHigherOrderComponent = createHigherOrderComponent;
|
|
23
19
|
//# sourceMappingURL=higher-order-component-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"higher-order-component-util.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/higher-order-component-util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"higher-order-component-util.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/higher-order-component-util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CACtC,+BAA+B,EAC/B,YAAY;IAEZ,OAAO,CAAE,iBAAiB,EAAG,EAAE;QAC3B,MAAM,iBAAiB,GAAG,+BAA+B,CACrD,iBAAiB,CACpB,CAAC;QACF,MAAM,EACF,WAAW,GAAG,iBAAiB,CAAC,IAAI,IAAI,WAAW,GACtD,GAAG,iBAAiB,CAAC;QACtB,iBAAiB,CAAC,WAAW,GAAG,GAAI,UAAU,CAC1C,SAAS,CAAC,YAAY,CAAC,CAC1B,IAAI,WAAW,GAAG,CAAC;QAEpB,OAAO,iBAAiB,CAAC;IAC7B,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./route-based-plugin-area"), exports);
|
|
18
|
-
__exportStar(require("./plugin-api"), exports);
|
|
1
|
+
export * from './route-based-plugin-area';
|
|
2
|
+
export * from './plugin-api';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getRouteBasePlugins = exports.getRouteBasePlugin = exports.unregisterRouteBasePlugin = exports.registerRouteBasePlugin = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const hooks_1 = require("@wordpress/hooks");
|
|
1
|
+
import { isFunction } from 'lodash-es';
|
|
2
|
+
import { applyFilters, doAction } from '@wordpress/hooks';
|
|
6
3
|
/**
|
|
7
4
|
* Plugin definitions keyed by plugin name.
|
|
8
5
|
*/
|
|
@@ -13,7 +10,7 @@ const plugins = {};
|
|
|
13
10
|
* @param name A string identifying the plugin. Must be unique across all registered plugins.
|
|
14
11
|
* @param settings The settings for this plugin.
|
|
15
12
|
*/
|
|
16
|
-
function registerRouteBasePlugin(name, settings) {
|
|
13
|
+
export function registerRouteBasePlugin(name, settings) {
|
|
17
14
|
if (typeof settings !== 'object') {
|
|
18
15
|
console.error('No settings object provided!');
|
|
19
16
|
return null;
|
|
@@ -29,33 +26,35 @@ function registerRouteBasePlugin(name, settings) {
|
|
|
29
26
|
if (plugins[name]) {
|
|
30
27
|
console.error(`Plugin "${name}" is alread registered.`);
|
|
31
28
|
}
|
|
32
|
-
settings =
|
|
33
|
-
if (!
|
|
29
|
+
settings = applyFilters('plugins.registerPlugin', settings, name);
|
|
30
|
+
if (!isFunction(settings.render)) {
|
|
34
31
|
console.error('The "render" property must be specified and must be a valid function.');
|
|
35
32
|
return null;
|
|
36
33
|
}
|
|
37
|
-
plugins[name] =
|
|
38
|
-
|
|
34
|
+
plugins[name] = {
|
|
35
|
+
name,
|
|
36
|
+
icon: 'admin-plugins',
|
|
37
|
+
...settings,
|
|
38
|
+
};
|
|
39
|
+
doAction('plugins.pluginRegistered', settings, name);
|
|
39
40
|
return settings;
|
|
40
41
|
}
|
|
41
|
-
exports.registerRouteBasePlugin = registerRouteBasePlugin;
|
|
42
42
|
/**
|
|
43
43
|
* Unregisteres a plugin by name.
|
|
44
44
|
* @param name Plugin name.
|
|
45
45
|
*
|
|
46
46
|
* @return The previous plugin settings object, if it has been successfully unregistered; otherwise `undefined`.
|
|
47
47
|
*/
|
|
48
|
-
function unregisterRouteBasePlugin(name) {
|
|
48
|
+
export function unregisterRouteBasePlugin(name) {
|
|
49
49
|
if (!plugins[name]) {
|
|
50
50
|
console.error('Plugin "' + name + '" is not registered.');
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
const oldPlugin = plugins[name];
|
|
54
54
|
delete plugins[name];
|
|
55
|
-
|
|
55
|
+
doAction('plugin.pluginUnregistered', oldPlugin, name);
|
|
56
56
|
return oldPlugin;
|
|
57
57
|
}
|
|
58
|
-
exports.unregisterRouteBasePlugin = unregisterRouteBasePlugin;
|
|
59
58
|
/**
|
|
60
59
|
* Returns a registered plugin settings.
|
|
61
60
|
*
|
|
@@ -63,17 +62,15 @@ exports.unregisterRouteBasePlugin = unregisterRouteBasePlugin;
|
|
|
63
62
|
*
|
|
64
63
|
* @returns Plugin setting.
|
|
65
64
|
*/
|
|
66
|
-
function getRouteBasePlugin(name) {
|
|
65
|
+
export function getRouteBasePlugin(name) {
|
|
67
66
|
return plugins[name];
|
|
68
67
|
}
|
|
69
|
-
exports.getRouteBasePlugin = getRouteBasePlugin;
|
|
70
68
|
/**
|
|
71
69
|
* Return all registered plugins.
|
|
72
70
|
*
|
|
73
71
|
* @return Plugin settings.
|
|
74
72
|
*/
|
|
75
|
-
function getRouteBasePlugins() {
|
|
73
|
+
export function getRouteBasePlugins() {
|
|
76
74
|
return Object.values(plugins);
|
|
77
75
|
}
|
|
78
|
-
exports.getRouteBasePlugins = getRouteBasePlugins;
|
|
79
76
|
//# sourceMappingURL=plugin-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-api.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/plugin-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-api.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/plugin-api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgB1D;;GAEG;AACH,MAAM,OAAO,GAAyC,EAAE,CAAC;AAEzD;;;;;GAKG;AACH,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AAC,IAAI,CAAC,CAAC;IAErB,QAAQ,CAAC,2BAA2B,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAEvD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAI;IACnC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.withPluginContext = exports.PluginContextProvider = void 0;
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const higher_order_component_util_1 = require("./higher-order-component-util");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createHigherOrderComponent } from './higher-order-component-util';
|
|
29
3
|
const { createContext } = React;
|
|
30
4
|
const { Consumer, Provider } = createContext({
|
|
31
5
|
name: null,
|
|
32
6
|
icon: null,
|
|
33
7
|
});
|
|
34
|
-
|
|
8
|
+
export { Provider as PluginContextProvider };
|
|
35
9
|
/**
|
|
36
10
|
* A Higher Order Component used to inject Plugin context to the
|
|
37
11
|
* wrapped component.
|
|
@@ -41,8 +15,7 @@ exports.PluginContextProvider = Provider;
|
|
|
41
15
|
*
|
|
42
16
|
* @return Enhanced component with injected context as props.
|
|
43
17
|
*/
|
|
44
|
-
const withPluginContext = (mapContextToProps) =>
|
|
45
|
-
return (props) => (React.createElement(Consumer, null, (context) => (React.createElement(OriginalComponent,
|
|
18
|
+
export const withPluginContext = (mapContextToProps) => createHigherOrderComponent((OriginalComponent) => {
|
|
19
|
+
return (props) => (React.createElement(Consumer, null, (context) => (React.createElement(OriginalComponent, { ...props, ...mapContextToProps(context, props) }))));
|
|
46
20
|
}, 'withPluginContext');
|
|
47
|
-
exports.withPluginContext = withPluginContext;
|
|
48
21
|
//# sourceMappingURL=plugin-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-context.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/plugin-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-context.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/plugin-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,MAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;AACjC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;IACzC,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,CAAC;AAG7C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,iBAAiB,EAAE,EAAE,CACnD,0BAA0B,CAAC,CAAC,iBAAiB,EAAE,EAAE;IAC7C,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACd,oBAAC,QAAQ,QACJ,CAAC,OAAO,EAAE,EAAE,CAAC,CACV,oBAAC,iBAAiB,OACV,KAAK,KACL,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,GACvC,CACL,CACM,CACd,CAAC;AACN,CAAC,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RouteBasedPluginArea = void 0;
|
|
27
|
-
const lodash_1 = require("lodash");
|
|
28
|
-
const React = __importStar(require("react"));
|
|
29
|
-
const hooks_1 = require("@wordpress/hooks");
|
|
30
|
-
const plugin_context_1 = require("./plugin-context");
|
|
31
|
-
const plugin_api_1 = require("./plugin-api");
|
|
1
|
+
import { map } from 'lodash-es';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { addAction, removeAction } from '@wordpress/hooks';
|
|
4
|
+
import { PluginContextProvider } from './plugin-context';
|
|
5
|
+
import { getRouteBasePlugins } from './plugin-api';
|
|
32
6
|
/**
|
|
33
7
|
* A component that renders all plugin fills in a hidden div.
|
|
34
8
|
*/
|
|
35
|
-
class RouteBasedPluginArea extends React.Component {
|
|
9
|
+
export class RouteBasedPluginArea extends React.Component {
|
|
36
10
|
constructor(args) {
|
|
37
11
|
super(args);
|
|
38
12
|
this.setPlugins = this.setPlugins.bind(this);
|
|
@@ -40,7 +14,7 @@ class RouteBasedPluginArea extends React.Component {
|
|
|
40
14
|
}
|
|
41
15
|
getCurrentPluginsState() {
|
|
42
16
|
return {
|
|
43
|
-
plugins:
|
|
17
|
+
plugins: map(getRouteBasePlugins(), ({ icon, name, render }) => {
|
|
44
18
|
return {
|
|
45
19
|
Plugin: render,
|
|
46
20
|
context: {
|
|
@@ -52,21 +26,20 @@ class RouteBasedPluginArea extends React.Component {
|
|
|
52
26
|
};
|
|
53
27
|
}
|
|
54
28
|
componentDidMount() {
|
|
55
|
-
|
|
56
|
-
|
|
29
|
+
addAction('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins);
|
|
30
|
+
addAction('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins);
|
|
57
31
|
this.setPlugins();
|
|
58
32
|
}
|
|
59
33
|
componentWillUnMount() {
|
|
60
|
-
|
|
61
|
-
|
|
34
|
+
removeAction('plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered');
|
|
35
|
+
removeAction('plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered');
|
|
62
36
|
}
|
|
63
37
|
setPlugins() {
|
|
64
38
|
this.setState(this.getCurrentPluginsState);
|
|
65
39
|
}
|
|
66
40
|
render() {
|
|
67
|
-
return (React.createElement("div", { style: { display: 'none' } },
|
|
41
|
+
return (React.createElement("div", { style: { display: 'none' } }, map(this.state.plugins, ({ context, Plugin }) => (React.createElement(PluginContextProvider, { key: context.name, value: context },
|
|
68
42
|
React.createElement(Plugin, null))))));
|
|
69
43
|
}
|
|
70
44
|
}
|
|
71
|
-
exports.RouteBasedPluginArea = RouteBasedPluginArea;
|
|
72
45
|
//# sourceMappingURL=route-based-plugin-area.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-based-plugin-area.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/route-based-plugin-area.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route-based-plugin-area.js","sourceRoot":"","sources":["../../src/route-based-plugin-area/route-based-plugin-area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AAEH,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAgD;IAE5F,YAAY,IAAI;QACZ,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,EAAC,OAAO,EAAE,EAAE,EAAC,CAAC;IAC/B,CAAC;IAEM,sBAAsB;QACzB,OAAO;YACH,O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|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.FeatureWithRouterFactory = void 0;
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const react_router_1 = require("react-router");
|
|
29
|
-
const react_client_feature_1 = require("../connector/react-client-feature");
|
|
30
|
-
const routerFactoryIn = [(routes) => React.createElement(react_router_1.Switch, null, routes)];
|
|
31
|
-
exports.FeatureWithRouterFactory = new react_client_feature_1.ReactClientFeature({
|
|
32
|
-
routerFactoryIn,
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Switch } from 'react-router';
|
|
3
|
+
import { Feature } from '../connector';
|
|
4
|
+
const routerFactory = (routes) => React.createElement(Switch, null, routes);
|
|
5
|
+
export const FeatureWithRouterFactory = new Feature({
|
|
6
|
+
routerFactory,
|
|
33
7
|
});
|
|
34
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router-factory/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router-factory/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAC,MAAM,QAAE,MAAM,CAAU,CAAC;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,OAAO,CAAC;IAChD,aAAa;CACC,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Feature } from '../connector/connector.native';
|
|
2
2
|
export declare const FeatureWithRouterFactory: Feature;
|
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.FeatureWithRouterFactory = void 0;
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const react_router_1 = require("react-router");
|
|
29
|
-
const react_client_feature_native_1 = require("../connector/react-client-feature.native");
|
|
30
|
-
const routerFactoryIn = [(routes) => React.createElement(react_router_1.Switch, null, routes)];
|
|
31
|
-
exports.FeatureWithRouterFactory = new react_client_feature_native_1.ReactClientFeature({
|
|
32
|
-
routerFactoryIn,
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Switch } from 'react-router';
|
|
3
|
+
import { Feature } from '../connector/connector.native';
|
|
4
|
+
const routerFactory = (routes) => React.createElement(Switch, null, routes);
|
|
5
|
+
export const FeatureWithRouterFactory = new Feature({
|
|
6
|
+
routerFactory,
|
|
33
7
|
});
|
|
34
8
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/router-factory/index.native.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/router-factory/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAGxD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAC,MAAM,QAAE,MAAM,CAAU,CAAC;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,OAAO,CAAC;IAChD,aAAa;CACC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { logger } from '@common-stack/client-core';
|
|
2
|
+
export const beforeSSR = (handlers) => async (options) => {
|
|
3
|
+
await Promise.all(handlers.map((cb) => {
|
|
4
|
+
if (typeof cb !== 'function')
|
|
5
|
+
return Promise.resolve();
|
|
6
|
+
return cb(options).catch(logger.error);
|
|
7
|
+
})).catch(logger.error);
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=before-ssr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"before-ssr.js","sourceRoot":"","sources":["../../src/utils/before-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAKnD,MAAM,CAAC,MAAM,SAAS,GAClB,CAAC,QAAuB,EAAe,EAAE,CACzC,KAAK,EAAE,OAAgB,EAAE,EAAE;IACvB,MAAM,OAAO,CAAC,GAAG,CACb,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAChB,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CACL,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const combine: (features: any, extractor: any) => any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../src/utils/combine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { logger } from '@common-stack/client-core';
|
|
2
|
+
export const hydrate = (handlers) => (container, state) => {
|
|
3
|
+
handlers.forEach((cb) => {
|
|
4
|
+
if (typeof cb !== 'function')
|
|
5
|
+
return;
|
|
6
|
+
try {
|
|
7
|
+
cb(container, state);
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
logger.error('Error occurred in hydrate', e);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=hydrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../src/utils/hydrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD,MAAM,CAAC,MAAM,OAAO,GAChB,CAAC,QAAuB,EAAe,EAAE,CACzC,CAAC,SAAoB,EAAE,KAAK,EAAE,EAAE;IAC5B,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACpB,IAAI,OAAO,EAAE,KAAK,UAAU;YAAE,OAAO;QACrC,IAAI;YACA,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC;SAChD;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./sort-keys"), exports);
|
|
18
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from './sort-keys';
|
|
2
|
+
export * from './utils';
|
|
3
|
+
export * from './combine';
|
|
4
|
+
export * from './hydrate';
|
|
5
|
+
export * from './before-ssr';
|
|
19
6
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/lib/utils/sort-keys.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sortKeys = void 0;
|
|
7
|
-
const sort_keys_1 = __importDefault(require("sort-keys"));
|
|
8
|
-
function sortKeys(routeData) {
|
|
9
|
-
return (0, sort_keys_1.default)(routeData, { compare });
|
|
1
|
+
import defaultSortKeys from 'sort-keys';
|
|
2
|
+
export function sortKeys(routeData) {
|
|
3
|
+
return defaultSortKeys(routeData, { compare });
|
|
10
4
|
}
|
|
11
|
-
exports.sortKeys = sortKeys;
|
|
12
5
|
const compare = ((a, b) => {
|
|
13
6
|
const aStr = String(a).toLowerCase();
|
|
14
7
|
const bStr = String(b).toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-keys.js","sourceRoot":"","sources":["../../src/utils/sort-keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sort-keys.js","sourceRoot":"","sources":["../../src/utils/sort-keys.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,WAAW,CAAC;AAExC,MAAM,UAAU,QAAQ,CAAC,SAAS;IAChC,OAAO,eAAe,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrC,qEAAqE;IACrE,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,eAAe,GAAG,eAAe,KAAK,CAAC,CAAC,EAAE;QAC5C,IAAI,eAAe,GAAG,eAAe,GAAG,CAAC,EAAE;YACzC,IAAI,eAAe,KAAK,eAAe,EAAE;gBACvC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;aACjC;YACD,OAAO,eAAe,GAAG,eAAe,CAAC;SAC1C;QACD,IAAI,eAAe,GAAG,CAAC,EAAE;YACvB,OAAO,CAAC,CAAC,CAAC;SACX;aAAM,IAAI,eAAe,GAAG,CAAC,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;KACF;IAED,4DAA4D;IAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACvB,wEAAwE;IACxE,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,OAAO,IAAI,GAAG,IAAI,CAAC;QACnB,8CAA8C;KAC/C;SAAM,IAAI,IAAI,EAAE;QACf,OAAO,CAAC,CAAC,CAAC;QACV,8CAA8C;KAC/C;SAAM,IAAI,IAAI,EAAE;QACf,OAAO,CAAC,CAAC;KACV;IAED,mDAAmD;IACnD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,GAAG;IAC5B,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,CAAC,CAAC,CAAC;KACX;IACD,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACrB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,CAAC,EAAE,EAAE;QACV,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,IAAI,GAAG,KAAK,GAAG,EAAE,EAAE,wCAAwC;gBACzD,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;aACnB;iBAAM;gBACL,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;aACnB;SACF;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE;YACvB,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;SACnB;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE;YACvB,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;SACnB;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const sort_keys_1 = require("./sort-keys");
|
|
1
|
+
import { sortKeys } from './sort-keys';
|
|
4
2
|
function MyComponent(props) {
|
|
5
3
|
return {};
|
|
6
4
|
}
|
|
@@ -23,7 +21,7 @@ describe('utility with basic routes', () => {
|
|
|
23
21
|
["/o/orgname"]: { exact: false, component: MyComponent },
|
|
24
22
|
};
|
|
25
23
|
it('sort will have `root` at the top', () => {
|
|
26
|
-
const sortedRoutes =
|
|
24
|
+
const sortedRoutes = sortKeys(routerConfig);
|
|
27
25
|
const keys = Object.keys(sortedRoutes)[0];
|
|
28
26
|
// expect(keys).toEqual('/')
|
|
29
27
|
expect(keys).toMatchSnapshot();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-keys.test.js","sourceRoot":"","sources":["../../src/utils/sort-keys.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sort-keys.test.js","sourceRoot":"","sources":["../../src/utils/sort-keys.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,SAAS,WAAW,CAAC,KAAK;IACtB,OAAO,EAAE,CAAC;AACd,CAAC;AACD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAGvC,MAAM,YAAY,GAAG;QACjB,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;QACnD,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;QACnD,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;QACtD,CAAC,2BAA2B,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;QACtE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE;QAC/C,CAAC,4BAA4B,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;QACvE,CAAC,qBAAqB,CAAC,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
|
|
3
|
-
exports.formatSlash = void 0;
|
|
4
1
|
const startWithMoreThanOneSlash = /^(\/)\1+/; // for exame `//abc, ///abc, ...`
|
|
5
|
-
const formatSlash = (route) => {
|
|
2
|
+
export const formatSlash = (route) => {
|
|
6
3
|
// replaced `//` with `/` in the routes.
|
|
7
4
|
return {
|
|
8
5
|
path: route.replace(startWithMoreThanOneSlash, '/'),
|
|
9
6
|
_pathPrefix: (route.match(/^\/(\/{1,})/) || ['', ''])[1],
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
exports.formatSlash = formatSlash;
|
|
13
9
|
//# sourceMappingURL=utils.js.map
|
package/lib/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAEA,MAAM,yBAAyB,GAAG,UAAU,CAAC,CAAC,iCAAiC;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE;IACnC,wCAAwC;IACxC,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,yBAAyB,EAAE,GAAG,CAAC;QACnD,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;KACzD,CAAA;AACH,CAAC,CAAA"}
|