@dr.pogodin/react-utils 1.25.5 → 1.26.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/babel.config.js +3 -1
- package/bin/build.js +25 -5
- package/build/development/client/getInj.js +9 -8
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/client/index.js +6 -3
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +4 -0
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +168 -42
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +13 -13
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/index.js +16 -24
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +56 -44
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +9 -5
- package/build/development/server/server.js.map +1 -1
- package/build/development/server/utils/errors.js +12 -9
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/server/utils/index.js +2 -2
- package/build/development/server/utils/index.js.map +1 -1
- package/build/development/shared/components/Button/index.js +8 -7
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +25 -28
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/Dropdown/index.js +25 -19
- package/build/development/shared/components/Dropdown/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +44 -37
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +8 -9
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +10 -9
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +22 -18
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +17 -18
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +10 -9
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +17 -20
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/ScalableRect/index.js +27 -7
- package/build/development/shared/components/ScalableRect/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +14 -23
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +20 -24
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +11 -11
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +16 -15
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/index.js +2 -2
- package/build/development/shared/components/index.js.map +1 -1
- package/build/development/shared/utils/config.js +1 -2
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/globalState.js +15 -0
- package/build/development/shared/utils/globalState.js.map +1 -0
- package/build/development/shared/utils/index.js +13 -11
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js +7 -3
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js +2 -4
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/isomorphy/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +35 -28
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/global.js +17 -0
- package/build/development/shared/utils/jest/global.js.map +1 -0
- package/build/development/shared/utils/jest/index.js +18 -11
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +25 -34
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +16 -13
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/shared/utils/webpack.js +3 -3
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/development/web.bundle.js +92 -82
- package/build/production/client/getInj.js +1 -1
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/client/index.js +4 -4
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +3 -1
- 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/Cache.js +7 -8
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/index.js +5 -4
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +32 -30
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +7 -5
- package/build/production/server/server.js.map +1 -1
- package/build/production/server/utils/errors.js +9 -10
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/server/utils/index.js +1 -1
- package/build/production/server/utils/index.js.map +1 -1
- package/build/production/shared/components/Button/index.js +4 -4
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +12 -12
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/Dropdown/index.js +11 -11
- package/build/production/shared/components/Dropdown/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +25 -20
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +7 -7
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js +2 -2
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/MetaTags.js +10 -10
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +2 -2
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js +1 -1
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +2 -2
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/ScalableRect/index.js +7 -3
- package/build/production/shared/components/ScalableRect/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +2 -2
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +13 -13
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +3 -3
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +7 -7
- package/build/production/shared/components/YouTubeVideo/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 +1 -1
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/globalState.js +3 -0
- package/build/production/shared/utils/globalState.js.map +1 -0
- package/build/production/shared/utils/index.js +3 -3
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js +7 -4
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js +2 -2
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/isomorphy/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +9 -9
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/global.js +2 -0
- package/build/production/shared/utils/jest/global.js.map +1 -0
- package/build/production/shared/utils/jest/index.js +6 -6
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +16 -16
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +12 -8
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/shared/utils/webpack.js +3 -3
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/client/getInj.d.ts +3 -0
- package/build/types-code/client/index.d.ts +11 -0
- package/build/types-code/client/init.d.ts +9 -0
- package/build/types-code/index.d.ts +10 -0
- package/build/types-code/server/Cache.d.ts +37 -0
- package/build/types-code/server/index.d.ts +145 -0
- package/build/types-code/server/renderer.d.ts +106 -0
- package/build/types-code/server/server.d.ts +41 -0
- package/build/types-code/server/utils/errors.d.ts +104 -0
- package/build/types-code/server/utils/index.d.ts +1 -0
- package/build/types-code/shared/components/Button/index.d.ts +27 -0
- package/build/types-code/shared/components/Checkbox/index.d.ts +21 -0
- package/build/types-code/shared/components/Dropdown/index.d.ts +23 -0
- package/build/types-code/shared/components/GenericLink/index.d.ts +61 -0
- package/build/types-code/shared/components/Input/index.d.ts +11 -0
- package/build/types-code/shared/components/Link.d.ts +12 -0
- package/build/types-code/shared/components/MetaTags.d.ts +68 -0
- package/build/types-code/shared/components/Modal/index.d.ts +26 -0
- package/build/types-code/shared/components/NavLink.d.ts +5 -0
- package/build/types-code/shared/components/PageLayout/index.d.ts +16 -0
- package/build/types-code/shared/components/ScalableRect/index.d.ts +19 -0
- package/build/types-code/shared/components/Throbber/index.d.ts +9 -0
- package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +23 -0
- package/build/types-code/shared/components/WithTooltip/index.d.ts +17 -0
- package/build/types-code/shared/components/YouTubeVideo/index.d.ts +13 -0
- package/build/types-code/shared/components/index.d.ts +16 -0
- package/build/types-code/shared/utils/config.d.ts +2 -0
- package/build/types-code/shared/utils/globalState.d.ts +20 -0
- package/build/types-code/shared/utils/index.d.ts +52 -0
- package/build/types-code/shared/utils/isomorphy/buildInfo.d.ts +23 -0
- package/build/types-code/shared/utils/isomorphy/environment-check.d.ts +11 -0
- package/build/types-code/shared/utils/isomorphy/index.d.ts +20 -0
- package/build/types-code/shared/utils/jest/E2eSsrEnv.d.ts +31 -0
- package/build/types-code/shared/utils/jest/global.d.ts +12 -0
- package/build/types-code/shared/utils/jest/index.d.ts +85 -0
- package/build/types-code/shared/utils/splitComponent.d.ts +41 -0
- package/build/types-code/shared/utils/time.d.ts +62 -0
- package/build/types-code/shared/utils/webpack.d.ts +18 -0
- package/build/types-scss/__tests__/js/config/publicPath support/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/components/NavLink/styles.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/publicPath support/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/components/NavLink/styles.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
- package/build/types-scss/src/shared/components/Button/style.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Checkbox/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Dropdown/theme.scss.d.ts +9 -0
- package/build/types-scss/src/shared/components/GenericLink/style.scss.d.ts +1 -0
- package/build/types-scss/src/shared/components/Input/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Modal/base-theme.scss.d.ts +5 -0
- package/build/types-scss/src/shared/components/PageLayout/base-theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/ScalableRect/style.scss.d.ts +2 -0
- package/build/types-scss/src/shared/components/Throbber/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/WithTooltip/default-theme.scss.d.ts +7 -0
- package/build/types-scss/src/shared/components/YouTubeVideo/base.scss.d.ts +5 -0
- package/build/types-scss/src/shared/components/YouTubeVideo/throbber.scss.d.ts +4 -0
- package/config/eslint/jest.json +3 -2
- package/config/eslint/typescript.js +34 -0
- package/config/jest/default.js +3 -3
- package/package.json +75 -33
- package/src/client/getInj.ts +43 -0
- package/src/client/index.tsx +40 -0
- package/src/client/init.ts +47 -0
- package/src/index.ts +58 -0
- package/src/server/Cache.ts +68 -0
- package/src/server/index.ts +230 -0
- package/src/server/renderer.tsx +604 -0
- package/src/server/server.ts +309 -0
- package/src/server/utils/errors.ts +135 -0
- package/src/server/utils/index.ts +3 -0
- package/src/shared/components/Button/index.tsx +146 -0
- package/src/shared/components/Button/style.scss +53 -0
- package/src/shared/components/Checkbox/index.tsx +71 -0
- package/src/shared/components/Checkbox/theme.scss +43 -0
- package/src/shared/components/Dropdown/index.tsx +144 -0
- package/src/shared/components/Dropdown/theme.scss +63 -0
- package/src/shared/components/GenericLink/index.tsx +157 -0
- package/src/shared/components/GenericLink/style.scss +3 -0
- package/src/shared/components/Input/index.tsx +59 -0
- package/src/shared/components/Input/theme.scss +27 -0
- package/src/shared/components/Link.tsx +21 -0
- package/src/shared/components/MetaTags.tsx +170 -0
- package/src/shared/components/Modal/base-theme.scss +38 -0
- package/src/shared/components/Modal/index.tsx +144 -0
- package/src/shared/components/Modal/styles.scss +5 -0
- package/src/shared/components/NavLink.tsx +13 -0
- package/src/shared/components/PageLayout/base-theme.scss +30 -0
- package/src/shared/components/PageLayout/index.tsx +76 -0
- package/src/shared/components/ScalableRect/index.tsx +84 -0
- package/src/shared/components/ScalableRect/style.scss +10 -0
- package/src/shared/components/Throbber/index.tsx +43 -0
- package/src/shared/components/Throbber/theme.scss +26 -0
- package/src/shared/components/WithTooltip/Tooltip.tsx +353 -0
- package/src/shared/components/WithTooltip/default-theme.scss +36 -0
- package/src/shared/components/WithTooltip/index.tsx +204 -0
- package/src/shared/components/YouTubeVideo/base.scss +13 -0
- package/src/shared/components/YouTubeVideo/index.tsx +96 -0
- package/src/shared/components/YouTubeVideo/throbber.scss +11 -0
- package/src/shared/components/index.ts +17 -0
- package/src/shared/utils/config.ts +21 -0
- package/src/shared/utils/globalState.ts +29 -0
- package/src/shared/utils/index.ts +105 -0
- package/src/shared/utils/isomorphy/buildInfo.ts +54 -0
- package/src/shared/utils/isomorphy/environment-check.ts +18 -0
- package/src/shared/utils/isomorphy/index.ts +38 -0
- package/src/shared/utils/jest/E2eSsrEnv.ts +250 -0
- package/src/shared/utils/jest/global.ts +19 -0
- package/src/shared/utils/jest/index.tsx +157 -0
- package/src/shared/utils/splitComponent.tsx +255 -0
- package/src/shared/utils/time.ts +118 -0
- package/src/shared/utils/webpack.ts +45 -0
- package/src/styles/_global/reset.css +52 -0
- package/src/styles/global.scss +11 -0
- package/tsconfig.configs.json +18 -0
- package/tsconfig.json +27 -0
- package/tsconfig.types.json +53 -0
- package/typed-scss-modules.config.ts +9 -0
- package/types.d.ts +37 -0
- package/{webpack.config.js → webpack.config.ts} +7 -3
- package/config/babel/node-ssr.js +0 -85
- package/config/babel/webpack.js +0 -122
- package/config/webpack/app-base.js +0 -330
- package/config/webpack/app-development.js +0 -80
- package/config/webpack/app-production.js +0 -60
- package/config/webpack/lib-base.js +0 -155
- package/config/webpack/lib-development.js +0 -45
- package/config/webpack/lib-production.js +0 -44
package/babel.config.js
CHANGED
package/bin/build.js
CHANGED
|
@@ -8,9 +8,18 @@ const path = require('path');
|
|
|
8
8
|
|
|
9
9
|
const { isFunction, mapValues, merge } = require('lodash');
|
|
10
10
|
const { program } = require('commander');
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// TODO: Disabled, because ESLint still does not support "exports" declarations
|
|
13
|
+
// in "package.json", and "rimraf" does not declare fallback entrance.
|
|
14
|
+
// See: https://github.com/import-js/eslint-plugin-import/issues/1810
|
|
15
|
+
// and update, once that issue is resolved.
|
|
16
|
+
// eslint-disable-next-line import/no-unresolved
|
|
17
|
+
const { rimraf } = require('rimraf');
|
|
12
18
|
|
|
13
19
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
20
|
+
// To support TS configs for Webpack.
|
|
21
|
+
const register = require('@babel/register/experimental-worker');
|
|
22
|
+
|
|
14
23
|
const webpack = require('webpack');
|
|
15
24
|
/* eslint-enable import/no-extraneous-dependencies */
|
|
16
25
|
|
|
@@ -85,7 +94,14 @@ fs.mkdirSync(outDir, { recursive: true });
|
|
|
85
94
|
/* ************************************************************************** */
|
|
86
95
|
/* Webpack compilation of isomorphic library bundle. */
|
|
87
96
|
|
|
97
|
+
register({
|
|
98
|
+
envName: 'production',
|
|
99
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],
|
|
100
|
+
root: process.cwd(),
|
|
101
|
+
});
|
|
102
|
+
|
|
88
103
|
let webpackConfig = require(path.resolve(cwd, cmdLineArgs.webpackConfig));
|
|
104
|
+
if ('default' in webpackConfig) webpackConfig = webpackConfig.default;
|
|
89
105
|
if (isFunction(webpackConfig)) webpackConfig = webpackConfig(buildType);
|
|
90
106
|
|
|
91
107
|
let webpackOutDir = outDir;
|
|
@@ -152,13 +168,16 @@ if (cmdLineArgs.watch) {
|
|
|
152
168
|
/* ************************************************************************** */
|
|
153
169
|
/* Babel compilation of JS, JSX, and SVG files. */
|
|
154
170
|
|
|
171
|
+
// TODO: It needs an option to build TS project, and use TypeScript in that case
|
|
172
|
+
// to do TypeScript build with "tsc".
|
|
173
|
+
|
|
155
174
|
const BABEL_EXEC_OPTIONS = {
|
|
156
175
|
env: { ...process.env, BABEL_ENV: buildType },
|
|
157
176
|
};
|
|
158
177
|
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
if (buildType === BUILD_TYPES.PRODUCTION)
|
|
178
|
+
let BABEL_CMD_BASE = `${cwd}/node_modules/.bin/babel`;
|
|
179
|
+
BABEL_CMD_BASE += ` ${inDir} --out-dir ${outDir} --source-maps`;
|
|
180
|
+
if (buildType === BUILD_TYPES.PRODUCTION) BABEL_CMD_BASE += ' --minified';
|
|
162
181
|
|
|
163
182
|
/* TODO: The watch is deactivated for Babel compilation because of SVG files:
|
|
164
183
|
* currently there is no way to tell Babel that SVG files should be compiled
|
|
@@ -171,7 +190,8 @@ if (buildType === BUILD_TYPES.PRODUCTION) BABEL_CMD_JS += ' --minified';
|
|
|
171
190
|
if (cmdLineArgs.watch) BABEL_CMD_JS += ' --watch';
|
|
172
191
|
*/
|
|
173
192
|
|
|
174
|
-
const
|
|
193
|
+
const BABEL_CMD_JS = `${BABEL_CMD_BASE} -x .js,.jsx,.ts,.tsx`;
|
|
194
|
+
const BABEL_CMD_SVG = `${BABEL_CMD_BASE} --extensions ".svg" --keep-file-extension`;
|
|
175
195
|
|
|
176
196
|
async function babelBuild() {
|
|
177
197
|
await exec(BABEL_CMD_JS, BABEL_EXEC_OPTIONS);
|
|
@@ -18,21 +18,22 @@ var _buildInfo = require("../shared/utils/isomorphy/buildInfo");
|
|
|
18
18
|
// Safeguard is needed here, because the server-side version of Docusaurus docs
|
|
19
19
|
// is compiled (at least now) with settings suggesting it is a client-side
|
|
20
20
|
// environment, but there is no document.
|
|
21
|
-
let inj =
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
let inj = {};
|
|
22
|
+
const metaElement = typeof document !== 'undefined' ? document.querySelector('meta[itemprop="drpruinj"]') : null;
|
|
23
|
+
if (metaElement) {
|
|
24
|
+
metaElement.remove();
|
|
25
|
+
let data = _forge.default.util.decode64(metaElement.content);
|
|
24
26
|
const {
|
|
25
27
|
key
|
|
26
28
|
} = (0, _buildInfo.getBuildInfo)();
|
|
27
|
-
inj = _forge.default.util.decode64(inj.content);
|
|
28
29
|
const d = _forge.default.cipher.createDecipher('AES-CBC', key);
|
|
29
30
|
d.start({
|
|
30
|
-
iv:
|
|
31
|
+
iv: data.slice(0, key.length)
|
|
31
32
|
});
|
|
32
|
-
d.update(_forge.default.util.createBuffer(
|
|
33
|
+
d.update(_forge.default.util.createBuffer(data.slice(key.length)));
|
|
33
34
|
d.finish();
|
|
34
|
-
|
|
35
|
-
inj = eval(`(${
|
|
35
|
+
data = _forge.default.util.decodeUtf8(d.output.data);
|
|
36
|
+
inj = eval(`(${data})`); // eslint-disable-line no-eval
|
|
36
37
|
} else {
|
|
37
38
|
// Otherwise, a bunch of dependent stuff will easily fail in non-standard
|
|
38
39
|
// environments, where no client-side initialization is performed. Like tests,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInj.js","names":["_forge","_interopRequireDefault","require","_buildInfo","inj","document","querySelector","remove","
|
|
1
|
+
{"version":3,"file":"getInj.js","names":["_forge","_interopRequireDefault","require","_buildInfo","inj","metaElement","document","querySelector","remove","data","forge","util","decode64","content","key","getBuildInfo","d","cipher","createDecipher","start","iv","slice","length","update","createBuffer","finish","decodeUtf8","output","eval","getInj"],"sources":["../../../src/client/getInj.ts"],"sourcesContent":["// Encapsulates retrieval of server-side data injection into HTML template.\n\n/* global document */\n\n// Note: this way, only required part of \"node-forge\": AES, and some utils,\n// is bundled into client-side code.\nimport forge from 'node-forge/lib/forge';\nimport 'node-forge/lib/aes';\n\nimport type { InjT } from 'utils/globalState';\n\nimport { getBuildInfo } from 'utils/isomorphy/buildInfo';\n\n// Safeguard is needed here, because the server-side version of Docusaurus docs\n// is compiled (at least now) with settings suggesting it is a client-side\n// environment, but there is no document.\nlet inj: InjT = {};\n\nconst metaElement: HTMLMetaElement | null = typeof document !== 'undefined'\n ? document.querySelector('meta[itemprop=\"drpruinj\"]') : null;\n\nif (metaElement) {\n metaElement.remove();\n let data = forge.util.decode64(metaElement.content);\n\n const { key } = getBuildInfo();\n const d = forge.cipher.createDecipher('AES-CBC', key);\n d.start({ iv: data.slice(0, key.length) });\n d.update(forge.util.createBuffer(data.slice(key.length)));\n d.finish();\n\n data = forge.util.decodeUtf8(d.output.data);\n inj = eval(`(${data})`); // eslint-disable-line no-eval\n} else {\n // Otherwise, a bunch of dependent stuff will easily fail in non-standard\n // environments, where no client-side initialization is performed. Like tests,\n // Docusaurus examples, etc.\n inj = {};\n}\n\nexport default function getInj(): InjT {\n return inj;\n}\n"],"mappings":";;;;;;;AAMA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACAA,OAAA;AAIA,IAAAC,UAAA,GAAAD,OAAA;AAXA;;AAEA;;AAEA;AACA;;AAQA;AACA;AACA;AACA,IAAIE,GAAS,GAAG,CAAC,CAAC;AAElB,MAAMC,WAAmC,GAAG,OAAOC,QAAQ,KAAK,WAAW,GACvEA,QAAQ,CAACC,aAAa,CAAC,2BAA2B,CAAC,GAAG,IAAI;AAE9D,IAAIF,WAAW,EAAE;EACfA,WAAW,CAACG,MAAM,CAAC,CAAC;EACpB,IAAIC,IAAI,GAAGC,cAAK,CAACC,IAAI,CAACC,QAAQ,CAACP,WAAW,CAACQ,OAAO,CAAC;EAEnD,MAAM;IAAEC;EAAI,CAAC,GAAG,IAAAC,uBAAY,EAAC,CAAC;EAC9B,MAAMC,CAAC,GAAGN,cAAK,CAACO,MAAM,CAACC,cAAc,CAAC,SAAS,EAAEJ,GAAG,CAAC;EACrDE,CAAC,CAACG,KAAK,CAAC;IAAEC,EAAE,EAAEX,IAAI,CAACY,KAAK,CAAC,CAAC,EAAEP,GAAG,CAACQ,MAAM;EAAE,CAAC,CAAC;EAC1CN,CAAC,CAACO,MAAM,CAACb,cAAK,CAACC,IAAI,CAACa,YAAY,CAACf,IAAI,CAACY,KAAK,CAACP,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC;EACzDN,CAAC,CAACS,MAAM,CAAC,CAAC;EAEVhB,IAAI,GAAGC,cAAK,CAACC,IAAI,CAACe,UAAU,CAACV,CAAC,CAACW,MAAM,CAAClB,IAAI,CAAC;EAC3CL,GAAG,GAAGwB,IAAI,CAAE,IAAGnB,IAAK,GAAE,CAAC,CAAC,CAAC;AAC3B,CAAC,MAAM;EACL;EACA;EACA;EACAL,GAAG,GAAG,CAAC,CAAC;AACV;AAEe,SAASyB,MAAMA,CAAA,EAAS;EACrC,OAAOzB,GAAG;AACZ"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = Launch;
|
|
8
|
+
require("react");
|
|
8
9
|
var _reactGlobalState = require("@dr.pogodin/react-global-state");
|
|
9
10
|
var _client = require("react-dom/client");
|
|
10
11
|
var _reactRouterDom = require("react-router-dom");
|
|
@@ -15,11 +16,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Prepares and launches the app at client side.
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
*/
|
|
19
|
+
* @param Application Root application component
|
|
20
|
+
* @param [options={}] Optional. Additional settings.
|
|
21
|
+
*/
|
|
22
|
+
function Launch(Application) {
|
|
21
23
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
22
24
|
const container = document.getElementById('react-view');
|
|
25
|
+
if (!container) throw Error('Failed to find container for React app');
|
|
23
26
|
const scene = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactGlobalState.GlobalStateProvider, {
|
|
24
27
|
initialState: (0, _getInj.default)().ISTATE,
|
|
25
28
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.BrowserRouter, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["require","_reactGlobalState","_client","_reactRouterDom","_getInj","_interopRequireDefault","_jsxRuntime","Launch","Application","options","arguments","length","undefined","container","document","getElementById","Error","scene","jsx","GlobalStateProvider","initialState","getInj","ISTATE","children","BrowserRouter","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.tsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document */\n\nimport { type ComponentType } from 'react';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\nimport getInj from './getInj';\n\ntype OptionsT = {\n dontHydrate?: boolean;\n};\n\n/**\n * Prepares and launches the app at client side.\n * @param Application Root application component\n * @param [options={}] Optional. Additional settings.\n */\nexport default function Launch(\n Application: ComponentType,\n options: OptionsT = {},\n) {\n const container = document.getElementById('react-view');\n if (!container) throw Error('Failed to find container for React app');\n const scene = (\n <GlobalStateProvider initialState={getInj().ISTATE}>\n <BrowserRouter>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":";;;;;;;AAGAA,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,IAAAM,WAAA,GAAAN,OAAA;AAV9B;AACA;;AAeA;AACA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,WAA0B,EAE1B;EAAA,IADAC,OAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEtB,MAAMG,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,YAAY,CAAC;EACvD,IAAI,CAACF,SAAS,EAAE,MAAMG,KAAK,CAAC,wCAAwC,CAAC;EACrE,MAAMC,KAAK,gBACT,IAAAX,WAAA,CAAAY,GAAA,EAACjB,iBAAA,CAAAkB,mBAAmB;IAACC,YAAY,EAAE,IAAAC,eAAM,EAAC,CAAC,CAACC,MAAO;IAAAC,QAAA,eACjD,IAAAjB,WAAA,CAAAY,GAAA,EAACf,eAAA,CAAAqB,aAAa;MAAAD,QAAA,eACZ,IAAAjB,WAAA,CAAAY,GAAA,EAACV,WAAW,IAAE;IAAC,CACF;EAAC,CACG,CACtB;EAED,IAAIC,OAAO,CAACgB,WAAW,EAAE;IACvB,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACd,SAAS,CAAC;IAClCa,IAAI,CAACE,MAAM,CAACX,KAAK,CAAC;EACpB,CAAC,MAAM,IAAAY,mBAAW,EAAChB,SAAS,EAAEI,KAAK,CAAC;AACtC"}
|
|
@@ -8,7 +8,11 @@ var _buildInfo = require("../shared/utils/isomorphy/buildInfo");
|
|
|
8
8
|
/* global BUILD_INFO, window */
|
|
9
9
|
|
|
10
10
|
const buildInfo = (0, _buildInfo.getBuildInfo)();
|
|
11
|
+
|
|
12
|
+
// TODO: Should be moved into buildInfo module?
|
|
13
|
+
|
|
11
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
12
16
|
console.warn('Dev mode: "BUILD_INFO" attached to the global "window"');
|
|
13
17
|
// eslint-disable-next-line no-underscore-dangle
|
|
14
18
|
window.__DEV_BUILD_INFO__ = BUILD_INFO;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":["_buildInfo","require","buildInfo","getBuildInfo","process","env","NODE_ENV","console","warn","window","__DEV_BUILD_INFO__","BUILD_INFO","useServiceWorker","navigator","addEventListener","reg","serviceWorker","register","log","err"],"sources":["../../../src/client/init.
|
|
1
|
+
{"version":3,"file":"init.js","names":["_buildInfo","require","buildInfo","getBuildInfo","process","env","NODE_ENV","console","warn","window","__DEV_BUILD_INFO__","BUILD_INFO","useServiceWorker","navigator","addEventListener","reg","serviceWorker","register","log","err"],"sources":["../../../src/client/init.ts"],"sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, window */\n\nimport { type BuildInfoT, getBuildInfo } from 'utils/isomorphy/buildInfo';\n\nconst buildInfo = getBuildInfo();\n\n// TODO: Should be moved into buildInfo module?\ndeclare global {\n interface Window {\n // eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle\n __DEV_BUILD_INFO__: BuildInfoT | undefined;\n }\n}\n\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('Dev mode: \"BUILD_INFO\" attached to the global \"window\"');\n // eslint-disable-next-line no-underscore-dangle\n window.__DEV_BUILD_INFO__ = BUILD_INFO;\n}\n\n/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */\n/* eslint-disable no-console */\nconst { useServiceWorker } = buildInfo;\nif (useServiceWorker) {\n const { navigator } = window;\n if ('serviceWorker' in navigator) {\n window.addEventListener('load', async () => {\n try {\n // Note: no matter the \"publicPath\", we want to serve the service worker\n // from the web app root, to allow it control any and all pages of the\n // web app (otherwise, it will be restricted to the scope of its path).\n // The server takes it into account.\n const reg = await navigator\n .serviceWorker.register('/__service-worker.js');\n console.log('SW registered:', reg);\n } catch (err) {\n console.log('SW registration failed:', err);\n }\n });\n }\n}\n/* eslint-enable no-console */\n"],"mappings":";;AAMA,IAAAA,UAAA,GAAAC,OAAA;AANA;AACA;AACA;;AAEA;;AAIA,MAAMC,SAAS,GAAG,IAAAC,uBAAY,EAAC,CAAC;;AAEhC;;AAQA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzC;EACAC,OAAO,CAACC,IAAI,CAAC,wDAAwD,CAAC;EACtE;EACAC,MAAM,CAACC,kBAAkB,GAAGC,UAAU;AACxC;;AAEA;AACA;AACA,MAAM;EAAEC;AAAiB,CAAC,GAAGV,SAAS;AACtC,IAAIU,gBAAgB,EAAE;EACpB,MAAM;IAAEC;EAAU,CAAC,GAAGJ,MAAM;EAC5B,IAAI,eAAe,IAAII,SAAS,EAAE;IAChCJ,MAAM,CAACK,gBAAgB,CAAC,MAAM,EAAE,YAAY;MAC1C,IAAI;QACF;QACA;QACA;QACA;QACA,MAAMC,GAAG,GAAG,MAAMF,SAAS,CACxBG,aAAa,CAACC,QAAQ,CAAC,sBAAsB,CAAC;QACjDV,OAAO,CAACW,GAAG,CAAC,gBAAgB,EAAEH,GAAG,CAAC;MACpC,CAAC,CAAC,OAAOI,GAAG,EAAE;QACZZ,OAAO,CAACW,GAAG,CAAC,yBAAyB,EAAEC,GAAG,CAAC;MAC7C;IACF,CAAC,CAAC;EACJ;AACF;AACA"}
|
|
@@ -4,25 +4,133 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
7
|
+
Object.defineProperty(exports, "Barrier", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _utils.Barrier;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "BaseModal", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _components.BaseModal;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "Button", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _components.Button;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _components.Checkbox;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "Dropdown", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _components.Dropdown;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "Emitter", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _utils.Emitter;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
19
43
|
Object.defineProperty(exports, "GlobalStateProvider", {
|
|
20
44
|
enumerable: true,
|
|
21
45
|
get: function () {
|
|
22
46
|
return _reactGlobalState.GlobalStateProvider;
|
|
23
47
|
}
|
|
24
48
|
});
|
|
49
|
+
Object.defineProperty(exports, "Input", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _components.Input;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "JU", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _utils.JU;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "Link", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return _components.Link;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "MetaTags", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _components.MetaTags;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "Modal", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _components.Modal;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "NavLink", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _components.NavLink;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
25
85
|
exports.PT = void 0;
|
|
86
|
+
Object.defineProperty(exports, "PageLayout", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return _components.PageLayout;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "Rgs", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () {
|
|
95
|
+
return _reactGlobalState.default;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "ScalableRect", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _components.ScalableRect;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "Semaphore", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () {
|
|
107
|
+
return _utils.Semaphore;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "ThemeProvider", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () {
|
|
113
|
+
return _utils.ThemeProvider;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "Throbber", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _components.Throbber;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "WithTooltip", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () {
|
|
125
|
+
return _components.WithTooltip;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, "YouTubeVideo", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () {
|
|
131
|
+
return _components.YouTubeVideo;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
26
134
|
Object.defineProperty(exports, "api", {
|
|
27
135
|
enumerable: true,
|
|
28
136
|
get: function () {
|
|
@@ -30,6 +138,12 @@ Object.defineProperty(exports, "api", {
|
|
|
30
138
|
}
|
|
31
139
|
});
|
|
32
140
|
exports.client = void 0;
|
|
141
|
+
Object.defineProperty(exports, "config", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () {
|
|
144
|
+
return _utils.config;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
33
147
|
Object.defineProperty(exports, "getGlobalState", {
|
|
34
148
|
enumerable: true,
|
|
35
149
|
get: function () {
|
|
@@ -39,10 +153,34 @@ Object.defineProperty(exports, "getGlobalState", {
|
|
|
39
153
|
Object.defineProperty(exports, "getSsrContext", {
|
|
40
154
|
enumerable: true,
|
|
41
155
|
get: function () {
|
|
42
|
-
return
|
|
156
|
+
return _utils.getSsrContext;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "isomorphy", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () {
|
|
162
|
+
return _utils.isomorphy;
|
|
43
163
|
}
|
|
44
164
|
});
|
|
45
165
|
exports.server = void 0;
|
|
166
|
+
Object.defineProperty(exports, "splitComponent", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () {
|
|
169
|
+
return _utils.splitComponent;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(exports, "themed", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () {
|
|
175
|
+
return _utils.themed;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, "time", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function () {
|
|
181
|
+
return _utils.time;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
46
184
|
Object.defineProperty(exports, "useAsyncCollection", {
|
|
47
185
|
enumerable: true,
|
|
48
186
|
get: function () {
|
|
@@ -61,38 +199,26 @@ Object.defineProperty(exports, "useGlobalState", {
|
|
|
61
199
|
return _reactGlobalState.useGlobalState;
|
|
62
200
|
}
|
|
63
201
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
202
|
+
Object.defineProperty(exports, "webpack", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function () {
|
|
205
|
+
return _utils.webpack;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(exports, "withRetries", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () {
|
|
211
|
+
return _utils.withRetries;
|
|
212
|
+
}
|
|
75
213
|
});
|
|
214
|
+
var _utils = require("./shared/utils");
|
|
76
215
|
var _axios = _interopRequireDefault(require("axios"));
|
|
77
216
|
var _PT = _interopRequireWildcard(require("prop-types"));
|
|
78
217
|
exports.PT = _PT;
|
|
79
|
-
var _reactGlobalState = require("@dr.pogodin/react-global-state");
|
|
218
|
+
var _reactGlobalState = _interopRequireWildcard(require("@dr.pogodin/react-global-state"));
|
|
80
219
|
var _components = require("./shared/components");
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Object.defineProperty(exports, key, {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function () {
|
|
88
|
-
return _components[key];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
93
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
94
|
-
const server = _utils.webpack.requireWeak("./server", __dirname);
|
|
95
|
-
exports.server = server;
|
|
96
|
-
const client = server ? undefined : require("./client").default;
|
|
97
|
-
exports.client = client;
|
|
220
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
221
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
222
|
+
const server = exports.server = _utils.webpack.requireWeak("./server", __dirname);
|
|
223
|
+
const client = exports.client = server ? undefined : require("./client").default;
|
|
98
224
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_utils","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_utils","require","_axios","_interopRequireDefault","_PT","_interopRequireWildcard","exports","PT","_reactGlobalState","_components","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","server","webpack","requireWeak","__dirname","client","undefined"],"sources":["../../src/index.ts"],"sourcesContent":["import 'styles/global.scss';\n\nimport { webpack } from 'utils';\n\nimport type ServerT from './server';\n\nconst server = webpack.requireWeak('./server', __dirname) as (typeof ServerT) | null;\n\nconst client = server ? undefined : require('./client').default;\n\nexport { default as api } from 'axios';\nexport * as PT from 'prop-types';\n\nexport {\n default as Rgs,\n type API as RgsApi,\n getGlobalState,\n GlobalStateProvider,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n} from '@dr.pogodin/react-global-state';\n\nexport {\n BaseModal,\n Button,\n Checkbox,\n Dropdown,\n Input,\n Link,\n PageLayout,\n MetaTags,\n Modal,\n NavLink,\n ScalableRect,\n Throbber,\n WithTooltip,\n YouTubeVideo,\n} from 'components';\n\nexport {\n type Theme,\n config,\n Barrier,\n Emitter,\n isomorphy,\n getSsrContext,\n JU,\n Semaphore,\n splitComponent,\n themed,\n ThemeProvider,\n time,\n webpack,\n withRetries,\n} from 'utils';\n\nexport { client, server };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,IAAAG,GAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAAAK,OAAA,CAAAC,EAAA,GAAAH,GAAA;AAGvC,IAAAI,iBAAA,GAAAH,uBAAA,CAAAJ,OAAA;AAUA,IAAAQ,WAAA,GAAAR,OAAA;AAeoB,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAhCpB,MAAMY,MAAM,GAAAzB,OAAA,CAAAyB,MAAA,GAAGC,cAAO,CAACC,WAAW,aAAaC,SAAS,CAA4B;AAEpF,MAAMC,MAAM,GAAA7B,OAAA,CAAA6B,MAAA,GAAGJ,MAAM,GAAGK,SAAS,GAAGnC,OAAO,WAAW,CAAC,CAACe,OAAO"}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Implements the static cache.
|
|
9
|
-
* @ignore
|
|
10
9
|
*/
|
|
11
10
|
class Cache {
|
|
12
11
|
constructor(maxSize) {
|
|
@@ -19,11 +18,10 @@ class Cache {
|
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Cache lookup.
|
|
22
|
-
* @
|
|
23
|
-
* @param
|
|
24
|
-
* @param {number} [maxage=Number.MAX_VALUE] Optional. The maximum age of
|
|
21
|
+
* @param key Item key to look for.
|
|
22
|
+
* @param [maxage=Number.MAX_VALUE] Optional. The maximum age of
|
|
25
23
|
* cached item to serve. Default to infinite.
|
|
26
|
-
* @returns
|
|
24
|
+
* @returns Cached item, or null if the item is absent in cache,
|
|
27
25
|
* or stale.
|
|
28
26
|
*/
|
|
29
27
|
get({
|
|
@@ -37,25 +35,27 @@ class Cache {
|
|
|
37
35
|
/**
|
|
38
36
|
* Adds item to cache.
|
|
39
37
|
* @ignore
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
38
|
+
* @param data Item to add.
|
|
39
|
+
* @param key Key to store the item at.
|
|
40
|
+
* @param size Byte size of the item.
|
|
42
41
|
*/
|
|
43
|
-
add(data, key) {
|
|
42
|
+
add(data, key, size) {
|
|
44
43
|
const p = this.private;
|
|
45
44
|
const old = p.items[key];
|
|
46
|
-
if (old) p.size -= old.
|
|
45
|
+
if (old) p.size -= old.size;
|
|
47
46
|
p.items[key] = {
|
|
48
47
|
data,
|
|
48
|
+
size,
|
|
49
49
|
timestamp: Date.now()
|
|
50
50
|
};
|
|
51
|
-
p.size +=
|
|
51
|
+
p.size += size;
|
|
52
52
|
if (p.size > p.maxSize) {
|
|
53
53
|
const items = Object.entries(p.items);
|
|
54
54
|
items.sort((a, b) => a[1].timestamp - b[1].timestamp);
|
|
55
55
|
for (let i = 0; i < items.length; ++i) {
|
|
56
|
-
const item = items[i];
|
|
57
|
-
delete p.items[
|
|
58
|
-
p.size -= item
|
|
56
|
+
const [itemKey, item] = items[i];
|
|
57
|
+
delete p.items[itemKey];
|
|
58
|
+
p.size -= item.size;
|
|
59
59
|
if (p.size < p.maxSize / 2) break;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.js","names":["Cache","constructor","maxSize","private","items","size","get","key","maxage","Number","MAX_VALUE","item","Date","now","timestamp","data","add","p","old","
|
|
1
|
+
{"version":3,"file":"Cache.js","names":["Cache","constructor","maxSize","private","items","size","get","key","maxage","Number","MAX_VALUE","item","Date","now","timestamp","data","add","p","old","Object","entries","sort","a","b","i","length","itemKey","exports","default"],"sources":["../../../src/server/Cache.ts"],"sourcesContent":["/**\n * Implements the static cache.\n */\nexport default class Cache<DatumT> {\n private: {\n items: {\n [key: string]: {\n data: DatumT;\n size: number;\n timestamp: number;\n }\n };\n maxSize: number;\n size: number;\n };\n\n constructor(maxSize: number) {\n this.private = {\n items: {},\n maxSize,\n size: 0,\n };\n }\n\n /**\n * Cache lookup.\n * @param key Item key to look for.\n * @param [maxage=Number.MAX_VALUE] Optional. The maximum age of\n * cached item to serve. Default to infinite.\n * @returns Cached item, or null if the item is absent in cache,\n * or stale.\n */\n get({\n key,\n maxage = Number.MAX_VALUE,\n }: {\n key: string;\n maxage?: number;\n }): DatumT | null {\n const item = this.private.items[key];\n return item && Date.now() - item.timestamp < maxage ? item.data : null;\n }\n\n /**\n * Adds item to cache.\n * @ignore\n * @param data Item to add.\n * @param key Key to store the item at.\n * @param size Byte size of the item.\n */\n add(data: DatumT, key: string, size: number) {\n const p = this.private;\n const old = p.items[key];\n if (old) p.size -= old.size;\n p.items[key] = { data, size, timestamp: Date.now() };\n p.size += size;\n if (p.size > p.maxSize) {\n const items = Object.entries(p.items);\n items.sort((a, b) => a[1].timestamp - b[1].timestamp);\n for (let i = 0; i < items.length; ++i) {\n const [itemKey, item] = items[i];\n delete p.items[itemKey];\n p.size -= item.size;\n if (p.size < p.maxSize / 2) break;\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACe,MAAMA,KAAK,CAAS;EAajCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,IAAI,CAACC,OAAO,GAAG;MACbC,KAAK,EAAE,CAAC,CAAC;MACTF,OAAO;MACPG,IAAI,EAAE;IACR,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAGA,CAAC;IACFC,GAAG;IACHC,MAAM,GAAGC,MAAM,CAACC;EAIlB,CAAC,EAAiB;IAChB,MAAMC,IAAI,GAAG,IAAI,CAACR,OAAO,CAACC,KAAK,CAACG,GAAG,CAAC;IACpC,OAAOI,IAAI,IAAIC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,IAAI,CAACG,SAAS,GAAGN,MAAM,GAAGG,IAAI,CAACI,IAAI,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,GAAGA,CAACD,IAAY,EAAER,GAAW,EAAEF,IAAY,EAAE;IAC3C,MAAMY,CAAC,GAAG,IAAI,CAACd,OAAO;IACtB,MAAMe,GAAG,GAAGD,CAAC,CAACb,KAAK,CAACG,GAAG,CAAC;IACxB,IAAIW,GAAG,EAAED,CAAC,CAACZ,IAAI,IAAIa,GAAG,CAACb,IAAI;IAC3BY,CAAC,CAACb,KAAK,CAACG,GAAG,CAAC,GAAG;MAAEQ,IAAI;MAAEV,IAAI;MAAES,SAAS,EAAEF,IAAI,CAACC,GAAG,CAAC;IAAE,CAAC;IACpDI,CAAC,CAACZ,IAAI,IAAIA,IAAI;IACd,IAAIY,CAAC,CAACZ,IAAI,GAAGY,CAAC,CAACf,OAAO,EAAE;MACtB,MAAME,KAAK,GAAGe,MAAM,CAACC,OAAO,CAACH,CAAC,CAACb,KAAK,CAAC;MACrCA,KAAK,CAACiB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACR,SAAS,GAAGS,CAAC,CAAC,CAAC,CAAC,CAACT,SAAS,CAAC;MACrD,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGpB,KAAK,CAACqB,MAAM,EAAE,EAAED,CAAC,EAAE;QACrC,MAAM,CAACE,OAAO,EAAEf,IAAI,CAAC,GAAGP,KAAK,CAACoB,CAAC,CAAC;QAChC,OAAOP,CAAC,CAACb,KAAK,CAACsB,OAAO,CAAC;QACvBT,CAAC,CAACZ,IAAI,IAAIM,IAAI,CAACN,IAAI;QACnB,IAAIY,CAAC,CAACZ,IAAI,GAAGY,CAAC,CAACf,OAAO,GAAG,CAAC,EAAE;MAC9B;IACF;EACF;AACF;AAACyB,OAAA,CAAAC,OAAA,GAAA5B,KAAA"}
|