@dr.pogodin/react-utils 1.23.2 → 1.23.5
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/build/development/client/getInj.js +45 -0
- package/build/development/client/getInj.js.map +1 -0
- package/build/development/client/index.js +4 -2
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +4 -47
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +4 -0
- package/build/development/index.js.map +1 -1
- package/build/development/server/renderer.js +3 -8
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/shared/components/CodeSplit/index.js +13 -7
- package/build/development/shared/components/CodeSplit/index.js.map +1 -1
- package/build/development/shared/components/index.js +0 -7
- package/build/development/shared/components/index.js.map +1 -1
- package/build/development/shared/utils/config.js +11 -4
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js +45 -0
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -0
- package/build/development/shared/utils/isomorphy/environment-check.js +20 -0
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -0
- package/build/development/shared/utils/{isomorphy.js → isomorphy/index.js} +22 -26
- package/build/development/shared/utils/isomorphy/index.js.map +1 -0
- package/build/development/web.bundle.js +164 -13
- package/build/production/client/getInj.js +12 -0
- package/build/production/client/getInj.js.map +1 -0
- package/build/production/client/index.js +3 -3
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +3 -10
- package/build/production/client/init.js.map +1 -1
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/renderer.js +3 -9
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/shared/components/CodeSplit/index.js +5 -4
- package/build/production/shared/components/CodeSplit/index.js.map +1 -1
- package/build/production/shared/components/index.js +1 -1
- package/build/production/shared/components/index.js.map +1 -1
- package/build/production/shared/utils/config.js +3 -1
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js +17 -0
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -0
- package/build/production/shared/utils/isomorphy/environment-check.js +7 -0
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -0
- package/build/production/shared/utils/isomorphy/index.js +16 -0
- package/build/production/shared/utils/isomorphy/index.js.map +1 -0
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/package.json +20 -20
- package/build/development/shared/utils/isomorphy.js.map +0 -1
- package/build/production/shared/utils/isomorphy.js +0 -23
- package/build/production/shared/utils/isomorphy.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBuildInfo = getBuildInfo;
|
|
7
|
+
exports.setBuildInfo = setBuildInfo;
|
|
8
|
+
// Encapsulates access to "Build Info" data.
|
|
9
|
+
|
|
10
|
+
/* global BUILD_INFO */
|
|
11
|
+
|
|
12
|
+
let buildInfo;
|
|
13
|
+
|
|
14
|
+
// On the client side "BUILD_INFO" should be injected by Webpack. Note, however,
|
|
15
|
+
// that in test environment we may need situations were environment is mocked as
|
|
16
|
+
// client-side, although no proper Webpack compilation is executed, thus no info
|
|
17
|
+
// injected; because of this we don't do a hard environment check here.
|
|
18
|
+
if (typeof BUILD_INFO !== 'undefined') buildInfo = BUILD_INFO;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* In scenarious where "BUILD_INFO" is not injected by Webpack (server-side,
|
|
22
|
+
* tests, etc.) we expect the host codebase to explicitly set it before it is
|
|
23
|
+
* ever requested. As a precaution, this function throws if build info has been
|
|
24
|
+
* set already, unless `force` flag is explicitly set.
|
|
25
|
+
* @param {object} info
|
|
26
|
+
* @param {boolean} [force=false]
|
|
27
|
+
*/
|
|
28
|
+
function setBuildInfo(info, force = false) {
|
|
29
|
+
if (buildInfo !== undefined && !force) {
|
|
30
|
+
throw Error('"Build Info" is already initialized');
|
|
31
|
+
}
|
|
32
|
+
buildInfo = info;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns "Build Info" object; throws if it has not been initialized yet.
|
|
37
|
+
* @returns {object}
|
|
38
|
+
*/
|
|
39
|
+
function getBuildInfo() {
|
|
40
|
+
if (buildInfo === undefined) {
|
|
41
|
+
throw Error('"Build Info" has not been initialized yet');
|
|
42
|
+
}
|
|
43
|
+
return buildInfo;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=buildInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildInfo.js","names":["buildInfo","BUILD_INFO","setBuildInfo","info","force","undefined","Error","getBuildInfo"],"sources":["../../../../../src/shared/utils/isomorphy/buildInfo.js"],"sourcesContent":["// Encapsulates access to \"Build Info\" data.\n\n/* global BUILD_INFO */\n\nlet buildInfo;\n\n// On the client side \"BUILD_INFO\" should be injected by Webpack. Note, however,\n// that in test environment we may need situations were environment is mocked as\n// client-side, although no proper Webpack compilation is executed, thus no info\n// injected; because of this we don't do a hard environment check here.\nif (typeof BUILD_INFO !== 'undefined') buildInfo = BUILD_INFO;\n\n/**\n * In scenarious where \"BUILD_INFO\" is not injected by Webpack (server-side,\n * tests, etc.) we expect the host codebase to explicitly set it before it is\n * ever requested. As a precaution, this function throws if build info has been\n * set already, unless `force` flag is explicitly set.\n * @param {object} info\n * @param {boolean} [force=false]\n */\nexport function setBuildInfo(info, force = false) {\n if (buildInfo !== undefined && !force) {\n throw Error('\"Build Info\" is already initialized');\n }\n buildInfo = info;\n}\n\n/**\n * Returns \"Build Info\" object; throws if it has not been initialized yet.\n * @returns {object}\n */\nexport function getBuildInfo() {\n if (buildInfo === undefined) {\n throw Error('\"Build Info\" has not been initialized yet');\n }\n return buildInfo;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,IAAIA,SAAS;;AAEb;AACA;AACA;AACA;AACA,IAAI,OAAOC,UAAU,KAAK,WAAW,EAAED,SAAS,GAAGC,UAAU;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,IAAI,EAAEC,KAAK,GAAG,KAAK,EAAE;EAChD,IAAIJ,SAAS,KAAKK,SAAS,IAAI,CAACD,KAAK,EAAE;IACrC,MAAME,KAAK,CAAC,qCAAqC,CAAC;EACpD;EACAN,SAAS,GAAGG,IAAI;AAClB;;AAEA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAAA,EAAG;EAC7B,IAAIP,SAAS,KAAKK,SAAS,EAAE;IAC3B,MAAMC,KAAK,CAAC,2CAA2C,CAAC;EAC1D;EACA,OAAON,SAAS;AAClB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.IS_SERVER_SIDE = exports.IS_CLIENT_SIDE = void 0;
|
|
7
|
+
// Checks for client- vs. server-side environment detection.
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `true` within client-side environment (browser), `false` at server-side.
|
|
11
|
+
*/
|
|
12
|
+
const IS_CLIENT_SIDE = typeof process !== 'object' || !process.versions || !process.versions.node || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `true` within the server-side environment (node), `false` at client-side.
|
|
16
|
+
*/
|
|
17
|
+
exports.IS_CLIENT_SIDE = IS_CLIENT_SIDE;
|
|
18
|
+
const IS_SERVER_SIDE = !IS_CLIENT_SIDE;
|
|
19
|
+
exports.IS_SERVER_SIDE = IS_SERVER_SIDE;
|
|
20
|
+
//# sourceMappingURL=environment-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-check.js","names":["IS_CLIENT_SIDE","process","versions","node","global","REACT_UTILS_FORCE_CLIENT_SIDE","exports","IS_SERVER_SIDE"],"sources":["../../../../../src/shared/utils/isomorphy/environment-check.js"],"sourcesContent":["// Checks for client- vs. server-side environment detection.\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nexport const IS_CLIENT_SIDE = typeof process !== 'object'\n || !process.versions || !process.versions.node\n || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\nexport const IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n"],"mappings":";;;;;;AAAA;;AAEA;AACA;AACA;AACO,MAAMA,cAAc,GAAG,OAAOC,OAAO,KAAK,QAAQ,IACpD,CAACA,OAAO,CAACC,QAAQ,IAAI,CAACD,OAAO,CAACC,QAAQ,CAACC,IAAI,IAC3C,CAAC,CAACC,MAAM,CAACC,6BAA6B;;AAE3C;AACA;AACA;AAFAC,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAGO,MAAMO,cAAc,GAAG,CAACP,cAAc;AAACM,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
|
|
@@ -3,29 +3,33 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
Object.defineProperty(exports, "IS_CLIENT_SIDE", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _environmentCheck.IS_CLIENT_SIDE;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "IS_SERVER_SIDE", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _environmentCheck.IS_SERVER_SIDE;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
7
18
|
exports.buildTimestamp = buildTimestamp;
|
|
8
|
-
exports
|
|
19
|
+
Object.defineProperty(exports, "getBuildInfo", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _buildInfo.getBuildInfo;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
9
25
|
exports.isDevBuild = isDevBuild;
|
|
10
26
|
exports.isProdBuild = isProdBuild;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* `true` within client-side environment (browser), `false` at server-side.
|
|
15
|
-
*/
|
|
16
|
-
const IS_CLIENT_SIDE = typeof process !== 'object' || !process.versions || !process.versions.node || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* `true` within the server-side environment (node), `false` at client-side.
|
|
20
|
-
*/
|
|
21
|
-
exports.IS_CLIENT_SIDE = IS_CLIENT_SIDE;
|
|
22
|
-
const IS_SERVER_SIDE = !IS_CLIENT_SIDE;
|
|
23
|
-
|
|
27
|
+
var _buildInfo = require("./buildInfo");
|
|
28
|
+
var _environmentCheck = require("./environment-check");
|
|
24
29
|
/**
|
|
25
30
|
* @ignore
|
|
26
31
|
* @return {string} Code mode: "development" or "production".
|
|
27
32
|
*/
|
|
28
|
-
exports.IS_SERVER_SIDE = IS_SERVER_SIDE;
|
|
29
33
|
function getMode() {
|
|
30
34
|
return process.env.NODE_ENV;
|
|
31
35
|
}
|
|
@@ -48,19 +52,11 @@ function isProdBuild() {
|
|
|
48
52
|
return getMode() === 'production';
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
/**
|
|
52
|
-
* Returns build info object.
|
|
53
|
-
* @returns {object}
|
|
54
|
-
*/
|
|
55
|
-
function getBuildInfo() {
|
|
56
|
-
return (IS_CLIENT_SIDE ? window : global).TRU_BUILD_INFO;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
55
|
/**
|
|
60
56
|
* Returns build timestamp of the front-end JS bundle.
|
|
61
57
|
* @return {string} ISO date/time string.
|
|
62
58
|
*/
|
|
63
59
|
function buildTimestamp() {
|
|
64
|
-
return getBuildInfo().timestamp;
|
|
60
|
+
return (0, _buildInfo.getBuildInfo)().timestamp;
|
|
65
61
|
}
|
|
66
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildInfo","require","_environmentCheck","getMode","process","env","NODE_ENV","isDevBuild","isProdBuild","buildTimestamp","getBuildInfo","timestamp"],"sources":["../../../../../src/shared/utils/isomorphy/index.js"],"sourcesContent":["import { getBuildInfo } from './buildInfo';\nimport { IS_CLIENT_SIDE, IS_SERVER_SIDE } from './environment-check';\n\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\nfunction getMode() {\n return process.env.NODE_ENV;\n}\n\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isDevBuild() {\n return getMode() === 'development';\n}\n\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isProdBuild() {\n return getMode() === 'production';\n}\n\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\nexport function buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n\nexport { IS_CLIENT_SIDE, IS_SERVER_SIDE, getBuildInfo };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA,SAASE,OAAOA,CAAA,EAAG;EACjB,OAAOC,OAAO,CAACC,GAAG,CAACC,QAAQ;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAAA,EAAG;EAC3B,OAAOJ,OAAO,EAAE,KAAK,aAAa;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CAAA,EAAG;EAC5B,OAAOL,OAAO,EAAE,KAAK,YAAY;AACnC;;AAEA;AACA;AACA;AACA;AACO,SAASM,cAAcA,CAAA,EAAG;EAC/B,OAAO,IAAAC,uBAAY,GAAE,CAACC,SAAS;AACjC"}
|