@tramvai/module-child-app 4.23.0 → 4.24.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/browser.js +2 -1
- package/lib/export.browser.js +11 -0
- package/lib/export.d.ts +51 -0
- package/lib/export.es.js +11 -0
- package/lib/export.js +22 -0
- package/lib/server.es.js +2 -1
- package/lib/server.js +3 -1
- package/package.json +11 -11
package/lib/browser.js
CHANGED
|
@@ -2,8 +2,9 @@ import { __decorate } from 'tslib';
|
|
|
2
2
|
import { Module } from '@tramvai/core';
|
|
3
3
|
import { sharedProviders } from './shared/providers.browser.js';
|
|
4
4
|
import { browserProviders } from './browser/providers.browser.js';
|
|
5
|
-
export
|
|
5
|
+
export { Assert } from './export.browser.js';
|
|
6
6
|
export { ChildApp } from './shared/react/component.browser.js';
|
|
7
|
+
export * from '@tramvai/tokens-child-app';
|
|
7
8
|
|
|
8
9
|
let ChildAppModule = class ChildAppModule {
|
|
9
10
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '@tramvai/tokens-child-app';
|
|
2
|
+
export { ChildApp } from './shared/react/component.browser.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* only for type-checking, simple way to fail application build if contracts are not valid
|
|
6
|
+
*
|
|
7
|
+
* @example `Assert({} as ContractsValidation)`
|
|
8
|
+
*/
|
|
9
|
+
const Assert = (t) => { };
|
|
10
|
+
|
|
11
|
+
export { Assert };
|
package/lib/export.d.ts
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
import type { TokenInterface } from '@tinkoff/dippy';
|
|
1
2
|
export * from '@tramvai/tokens-child-app';
|
|
2
3
|
export { ChildApp } from './shared/react/component';
|
|
4
|
+
export interface TypedContractsRequired {
|
|
5
|
+
}
|
|
6
|
+
export interface TypedContractsProvided {
|
|
7
|
+
}
|
|
8
|
+
export interface TypedContracts {
|
|
9
|
+
required: TypedContractsRequired;
|
|
10
|
+
provided: TypedContractsProvided;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* opaque types for unknown symbols will not be expanded (in error message)
|
|
14
|
+
*/
|
|
15
|
+
declare const errorTag: unique symbol;
|
|
16
|
+
export type TypesError<T> = {
|
|
17
|
+
[errorTag]: T;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* expand generic types one level down (in error message)
|
|
21
|
+
*/
|
|
22
|
+
type Prettify<T> = T extends Record<string, any> ? {} & {
|
|
23
|
+
[P in keyof T]: T[P];
|
|
24
|
+
} : {} & T;
|
|
25
|
+
/**
|
|
26
|
+
* exclude keys with `never` value from records
|
|
27
|
+
*/
|
|
28
|
+
type OmitNever<T> = {
|
|
29
|
+
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* validate required and provided contracts, `TypesError` returns on failure
|
|
33
|
+
*/
|
|
34
|
+
export type ContractsValidation = TypedContracts extends {
|
|
35
|
+
required: TypedContractsRequired;
|
|
36
|
+
provided: TypedContractsRequired;
|
|
37
|
+
} ? TypedContracts : TypesError<Prettify<OmitNever<{
|
|
38
|
+
[key in keyof Omit<TypedContracts['required'], keyof TypedContracts['provided']>]: {
|
|
39
|
+
message: `Contract is not provided`;
|
|
40
|
+
};
|
|
41
|
+
}> & OmitNever<{
|
|
42
|
+
[key in keyof TypedContracts['provided']]: TypedContracts['provided'][key] extends TypedContracts['required'][key] ? never : {
|
|
43
|
+
message: `Contract is incompatible`;
|
|
44
|
+
expected: TypedContracts['required'][key] extends TokenInterface<infer T> ? T : TypedContracts['required'][key];
|
|
45
|
+
actual: TypedContracts['provided'][key] extends TokenInterface<infer T> ? T : TypedContracts['provided'][key];
|
|
46
|
+
};
|
|
47
|
+
}>>>;
|
|
48
|
+
/**
|
|
49
|
+
* only for type-checking, simple way to fail application build if contracts are not valid
|
|
50
|
+
*
|
|
51
|
+
* @example `Assert({} as ContractsValidation)`
|
|
52
|
+
*/
|
|
53
|
+
export declare const Assert: <T>(t: T extends TypesError<any> ? never : T) => void;
|
|
3
54
|
//# sourceMappingURL=export.d.ts.map
|
package/lib/export.es.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '@tramvai/tokens-child-app';
|
|
2
|
+
export { ChildApp } from './shared/react/component.es.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* only for type-checking, simple way to fail application build if contracts are not valid
|
|
6
|
+
*
|
|
7
|
+
* @example `Assert({} as ContractsValidation)`
|
|
8
|
+
*/
|
|
9
|
+
const Assert = (t) => { };
|
|
10
|
+
|
|
11
|
+
export { Assert };
|
package/lib/export.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tokensChildApp = require('@tramvai/tokens-child-app');
|
|
6
|
+
var component = require('./shared/react/component.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* only for type-checking, simple way to fail application build if contracts are not valid
|
|
10
|
+
*
|
|
11
|
+
* @example `Assert({} as ContractsValidation)`
|
|
12
|
+
*/
|
|
13
|
+
const Assert = (t) => { };
|
|
14
|
+
|
|
15
|
+
exports.ChildApp = component.ChildApp;
|
|
16
|
+
exports.Assert = Assert;
|
|
17
|
+
Object.keys(tokensChildApp).forEach(function (k) {
|
|
18
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return tokensChildApp[k]; }
|
|
21
|
+
});
|
|
22
|
+
});
|
package/lib/server.es.js
CHANGED
|
@@ -2,8 +2,9 @@ import { __decorate } from 'tslib';
|
|
|
2
2
|
import { Module } from '@tramvai/core';
|
|
3
3
|
import { sharedProviders } from './shared/providers.es.js';
|
|
4
4
|
import { serverProviders } from './server/providers.es.js';
|
|
5
|
-
export
|
|
5
|
+
export { Assert } from './export.es.js';
|
|
6
6
|
export { ChildApp } from './shared/react/component.es.js';
|
|
7
|
+
export * from '@tramvai/tokens-child-app';
|
|
7
8
|
|
|
8
9
|
let ChildAppModule = class ChildAppModule {
|
|
9
10
|
};
|
package/lib/server.js
CHANGED
|
@@ -6,8 +6,9 @@ var tslib = require('tslib');
|
|
|
6
6
|
var core = require('@tramvai/core');
|
|
7
7
|
var providers = require('./shared/providers.js');
|
|
8
8
|
var providers$1 = require('./server/providers.js');
|
|
9
|
-
var
|
|
9
|
+
var _export = require('./export.js');
|
|
10
10
|
var component = require('./shared/react/component.js');
|
|
11
|
+
var tokensChildApp = require('@tramvai/tokens-child-app');
|
|
11
12
|
|
|
12
13
|
exports.ChildAppModule = class ChildAppModule {
|
|
13
14
|
};
|
|
@@ -18,6 +19,7 @@ exports.ChildAppModule = tslib.__decorate([
|
|
|
18
19
|
})
|
|
19
20
|
], exports.ChildAppModule);
|
|
20
21
|
|
|
22
|
+
exports.Assert = _export.Assert;
|
|
21
23
|
exports.ChildApp = component.ChildApp;
|
|
22
24
|
Object.keys(tokensChildApp).forEach(function (k) {
|
|
23
25
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-child-app",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.0",
|
|
4
4
|
"description": "Module for child apps",
|
|
5
5
|
"browser": {
|
|
6
6
|
"./lib/server.js": "./lib/browser.js",
|
|
@@ -33,23 +33,23 @@
|
|
|
33
33
|
"@tinkoff/env-validators": "0.3.1",
|
|
34
34
|
"@tinkoff/module-loader-client": "0.6.3",
|
|
35
35
|
"@tinkoff/module-loader-server": "0.7.2",
|
|
36
|
-
"@tramvai/module-common": "4.
|
|
36
|
+
"@tramvai/module-common": "4.24.0",
|
|
37
37
|
"@tinkoff/url": "0.10.1",
|
|
38
|
-
"@tramvai/child-app-core": "4.
|
|
38
|
+
"@tramvai/child-app-core": "4.24.0",
|
|
39
39
|
"@tramvai/safe-strings": "0.7.2",
|
|
40
|
-
"@tramvai/tokens-child-app": "4.
|
|
40
|
+
"@tramvai/tokens-child-app": "4.24.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@tinkoff/dippy": "0.10.8",
|
|
45
|
-
"@tinkoff/router": "0.4.
|
|
45
|
+
"@tinkoff/router": "0.4.77",
|
|
46
46
|
"@tinkoff/utils": "^2.1.2",
|
|
47
|
-
"@tramvai/core": "4.
|
|
48
|
-
"@tramvai/state": "4.
|
|
49
|
-
"@tramvai/react": "4.
|
|
50
|
-
"@tramvai/tokens-common": "4.
|
|
51
|
-
"@tramvai/tokens-render": "4.
|
|
52
|
-
"@tramvai/tokens-router": "4.
|
|
47
|
+
"@tramvai/core": "4.24.0",
|
|
48
|
+
"@tramvai/state": "4.24.0",
|
|
49
|
+
"@tramvai/react": "4.24.0",
|
|
50
|
+
"@tramvai/tokens-common": "4.24.0",
|
|
51
|
+
"@tramvai/tokens-render": "4.24.0",
|
|
52
|
+
"@tramvai/tokens-router": "4.24.0",
|
|
53
53
|
"react": ">=16.14.0",
|
|
54
54
|
"react-dom": ">=16.14.0",
|
|
55
55
|
"object-assign": "^4.1.1",
|