catalyst-core 0.0.1-beta.2
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/.prettierignore +2 -0
- package/.prettierrc.json +7 -0
- package/LICENSE +9 -0
- package/README.md +132 -0
- package/babel.config.json +24 -0
- package/bin/catalyst.js +41 -0
- package/caching.js +16 -0
- package/checkVersion.js +3 -0
- package/config/config.js +24 -0
- package/config.json +8 -0
- package/index.js +16 -0
- package/logger/index.js +96 -0
- package/package.json +87 -0
- package/packages/create-framework-app/node_modules/.package-lock.json +249 -0
- package/packages/create-framework-app/templates/redux-js/node_modules/@babel/core/lib/config/caching.js +261 -0
- package/packages/create-framework-app/templates/redux-js/node_modules/@remix-run/router/dist/router.js +4327 -0
- package/packages/create-framework-app/templates/redux-js/node_modules/catalyst/router.js +15 -0
- package/packages/create-framework-app/templates/redux-js/node_modules/http-proxy-middleware/dist/router.js +46 -0
- package/reducer/index.js +88 -0
- package/reducer/loadableConfigReducer.js +19 -0
- package/router/ClientRouter.js +15 -0
- package/router/ServerRouter.js +28 -0
- package/router/index.js +32 -0
- package/router.js +16 -0
- package/scripts/build.js +27 -0
- package/scripts/loadEnvironmentVariables.js +37 -0
- package/scripts/loadScriptsBeforeServerStarts.js +55 -0
- package/scripts/prepare.js +19 -0
- package/scripts/registerAliases.js +30 -0
- package/scripts/serve.js +27 -0
- package/scripts/start.js +28 -0
- package/scripts/validator.js +99 -0
- package/server/mainIndex.js +65 -0
- package/server/mainServer.js +70 -0
- package/server/renderer/document/Body.js +37 -0
- package/server/renderer/document/Head.js +44 -0
- package/server/renderer/document/index.js +25 -0
- package/server/renderer/extract.js +86 -0
- package/server/renderer/handler.js +228 -0
- package/server/renderer/index.js +13 -0
- package/server/renderer/render.js +71 -0
- package/server/renderer/userAgentUtil.js +55 -0
- package/server/utils/validator.js +98 -0
- package/store/index.dev.js +73 -0
- package/store/index.js +25 -0
- package/store/index.prod.js +66 -0
- package/tsconfig.json +110 -0
- package/types/caching.d.ts +1 -0
- package/types/config/config.d.ts +19 -0
- package/types/index.d.ts +1 -0
- package/types/logger/index.d.ts +14 -0
- package/types/reducer/index.d.ts +22 -0
- package/types/reducer/loadableConfigReducer.d.ts +9 -0
- package/types/router/ClientRouter.d.ts +5 -0
- package/types/router/ServerRouter.d.ts +7 -0
- package/types/router/index.d.ts +8 -0
- package/types/router.d.ts +1 -0
- package/types/scripts/build.d.ts +1 -0
- package/types/scripts/loadEnvironmentVariables.d.ts +5 -0
- package/types/scripts/loadScriptsBeforeServerStarts.d.ts +1 -0
- package/types/scripts/prepare.d.ts +1 -0
- package/types/scripts/registerAliases.d.ts +1 -0
- package/types/scripts/serve.d.ts +1 -0
- package/types/scripts/start.d.ts +1 -0
- package/types/scripts/validator.d.ts +9 -0
- package/types/scripts/verifyConfig.d.ts +1 -0
- package/types/server/mainIndex.d.ts +1 -0
- package/types/server/mainServer.d.ts +2 -0
- package/types/server/renderer/document/Body.d.ts +11 -0
- package/types/server/renderer/document/Head.d.ts +11 -0
- package/types/server/renderer/document/index.d.ts +2 -0
- package/types/server/renderer/extract.d.ts +18 -0
- package/types/server/renderer/handler.d.ts +6 -0
- package/types/server/renderer/index.d.ts +2 -0
- package/types/server/renderer/render.d.ts +38 -0
- package/types/server/renderer/userAgentUtil.d.ts +1 -0
- package/types/store/index.d.ts +11 -0
- package/types/store/index.dev.d.ts +8 -0
- package/types/store/index.prod.d.ts +8 -0
- package/types/webpack/babel-plugins/remove-client.plugin.d.ts +10 -0
- package/types/webpack/babel-plugins/remove-ssr.plugin.d.ts +10 -0
- package/types/webpack/babel.config.client.d.ts +21 -0
- package/types/webpack/babel.config.d.ts +16 -0
- package/types/webpack/babel.config.ssr.d.ts +21 -0
- package/types/webpack/base.babel.d.ts +184 -0
- package/types/webpack/development.client.babel.d.ts +1 -0
- package/types/webpack/plugins/mime-types.d.ts +78 -0
- package/types/webpack/plugins/route-manifest-plugin.d.ts +1 -0
- package/types/webpack/plugins/upload-assets-plugin.d.ts +1 -0
- package/types/webpack/production.client.babel.d.ts +174 -0
- package/types/webpack/production.ssr.babel.d.ts +2 -0
- package/types/webpack/scssParams.d.ts +2 -0
- package/webpack/babel-plugins/remove-client.plugin.js +31 -0
- package/webpack/babel-plugins/remove-ssr.plugin.js +21 -0
- package/webpack/babel.config.client.js +24 -0
- package/webpack/babel.config.js +20 -0
- package/webpack/babel.config.ssr.js +24 -0
- package/webpack/base.babel.js +174 -0
- package/webpack/development.client.babel.js +82 -0
- package/webpack/plugins/mime-types.js +82 -0
- package/webpack/plugins/route-manifest-copy.js +122 -0
- package/webpack/plugins/route-manifest-plugin.js +122 -0
- package/webpack/plugins/upload-assets-plugin.js +181 -0
- package/webpack/production.client.babel.js +79 -0
- package/webpack/production.ssr.babel.js +61 -0
- package/webpack/scssParams.js +31 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const pc = require("picocolors");
|
|
4
|
+
const handleError = e => {
|
|
5
|
+
console.log(pc.red("Failed to start server: "), e);
|
|
6
|
+
};
|
|
7
|
+
const validatePreInitServer = fn => {
|
|
8
|
+
try {
|
|
9
|
+
if (!fn) throw new Error("preServerInit named function should be defined in server/index.js");
|
|
10
|
+
if (typeof fn !== 'function') throw new Error("preServerInit should be function present in server/index.js");
|
|
11
|
+
return true;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
handleError(e);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const validateMiddleware = fn => {
|
|
17
|
+
try {
|
|
18
|
+
if (!fn) throw new Error("addMiddlewares named function not found in server/server.js");
|
|
19
|
+
if (typeof fn !== 'function') throw new Error("addMiddlewares should be function present in server/server.js");
|
|
20
|
+
return true;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
handleError(e);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const validateReducerFunction = fn => {
|
|
26
|
+
try {
|
|
27
|
+
if (!fn) throw new Error("reducer not found in src/js/containers/App/reducer");
|
|
28
|
+
if (typeof fn !== 'function') throw new Error("reducer should present in src/js/containers/App/reducer");
|
|
29
|
+
return true;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
handleError(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const validateConfigFile = obj => {
|
|
35
|
+
try {
|
|
36
|
+
if (!obj) throw new Error("config not found in config folder");
|
|
37
|
+
if (typeof obj !== 'object') throw new Error("config object should be exported from config folder inside your project root directory");
|
|
38
|
+
return true;
|
|
39
|
+
} catch (e) {
|
|
40
|
+
handleError(e);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const validatePackageJson = obj => {
|
|
44
|
+
try {
|
|
45
|
+
if (!obj) throw new Error("package.json not found in the project");
|
|
46
|
+
if (typeof obj !== 'object') throw new Error("package.json should be defined in project root directory");
|
|
47
|
+
return true;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
handleError(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const validateModuleAlias = obj => {
|
|
53
|
+
try {
|
|
54
|
+
if (!obj) throw new Error("moduleAliases not found in package.json file present in root directory.");
|
|
55
|
+
if (typeof obj !== 'object') throw new Error("moduleAliases named object should be exported from package.json");
|
|
56
|
+
return true;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
handleError(e);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const validateConfigureStore = fn => {
|
|
62
|
+
try {
|
|
63
|
+
if (!fn) throw new Error("configureStore not found in file src/js/store/index.js");
|
|
64
|
+
if (typeof fn !== 'function') throw new Error("configureStore should be function exported from src/js/store/index.js");
|
|
65
|
+
return true;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
handleError(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const validateGetRoutes = fn => {
|
|
71
|
+
try {
|
|
72
|
+
if (!fn) throw new Error("getRoutes not found in file src/js/routers/index.js");
|
|
73
|
+
if (typeof fn !== 'function') throw new Error("getRoutes should be function exported from src/js/routers/index.js");
|
|
74
|
+
return true;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
handleError(e);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const validateCustomDocument = fn => {
|
|
80
|
+
try {
|
|
81
|
+
if (!fn) throw new Error("document not found in file server/document.js");
|
|
82
|
+
if (typeof fn !== 'function') throw new Error("document should be a react component exported from server/document.js");
|
|
83
|
+
return true;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
handleError(e);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
module.exports = {
|
|
89
|
+
validateConfigFile,
|
|
90
|
+
validateConfigureStore,
|
|
91
|
+
validateCustomDocument,
|
|
92
|
+
validateGetRoutes,
|
|
93
|
+
validatePackageJson,
|
|
94
|
+
validateReducerFunction,
|
|
95
|
+
validateModuleAlias,
|
|
96
|
+
validatePreInitServer,
|
|
97
|
+
validateMiddleware
|
|
98
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = configureStore;
|
|
7
|
+
var _redux = require("redux");
|
|
8
|
+
var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
|
|
9
|
+
var _reduxLogger = require("redux-logger");
|
|
10
|
+
var _index = _interopRequireDefault(require("../reducer/index.js"));
|
|
11
|
+
var _api = require("@lib/api.js");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
/**
|
|
14
|
+
* Function that initializes the store with the initialstate and adds middlewares that can be used during action dispatch
|
|
15
|
+
* @param {object} initialState Default state
|
|
16
|
+
* @param {object} cookies additional headers if needed
|
|
17
|
+
* @param {object} requestObj additional information
|
|
18
|
+
* @return {object} the store itself
|
|
19
|
+
*/
|
|
20
|
+
function configureStore(initialState, cookies, requestObj, customHeaders) {
|
|
21
|
+
// The variable defined below acts as a flag when the store is initialized on the client side
|
|
22
|
+
// Reason being that for the first time we need to actually need to forcefully set the reducer for which we have the initial data
|
|
23
|
+
let initializeClient = true;
|
|
24
|
+
const reducerManager = (0, _index.default)();
|
|
25
|
+
const api = (0, _api.directAxiosInstance)(cookies, requestObj, customHeaders);
|
|
26
|
+
const labsApi = (0, _api.labsAxiosInstance)(cookies, requestObj, customHeaders);
|
|
27
|
+
|
|
28
|
+
// FRAMEWORK COMMENT. This should be exposed to user.
|
|
29
|
+
|
|
30
|
+
// disable redux-logger in server - https://github.com/LogRocket/redux-logger/issues/6
|
|
31
|
+
const reduxLogger = (0, _reduxLogger.createLogger)({
|
|
32
|
+
predicate: () => typeof window !== "undefined"
|
|
33
|
+
});
|
|
34
|
+
const addReducer = reducer => {
|
|
35
|
+
// Only executed once when for the first run in client - side
|
|
36
|
+
if (initializeClient) {
|
|
37
|
+
initializeClient = false;
|
|
38
|
+
return store.replaceReducer(reducerManager.add(reducer));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// This blocks check if the reducer is already added or not in store
|
|
42
|
+
// If not then it only add the missing reducers
|
|
43
|
+
// And if the required reducers are already present then we simply return without performing any change
|
|
44
|
+
let reducerToAdd = {};
|
|
45
|
+
const currentState = store.getState();
|
|
46
|
+
for (let key in reducer) {
|
|
47
|
+
if (!currentState[key]) {
|
|
48
|
+
reducerToAdd[key] = reducer[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (Object.keys(reducerToAdd).length > 0) {
|
|
52
|
+
return store.replaceReducer(reducerManager.add(reducerToAdd));
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
};
|
|
56
|
+
let middleware = [_reduxThunk.default.withExtraArgument({
|
|
57
|
+
addReducer,
|
|
58
|
+
api,
|
|
59
|
+
labsApi
|
|
60
|
+
}), reduxLogger];
|
|
61
|
+
|
|
62
|
+
// Add universal enhancers here
|
|
63
|
+
let enhancers = [];
|
|
64
|
+
const composeEnhancers = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _redux.compose;
|
|
65
|
+
const enhancer = composeEnhancers(...[(0, _redux.applyMiddleware)(...middleware), ...enhancers]);
|
|
66
|
+
|
|
67
|
+
// create store with enhancers, middleware, reducers, and initialState
|
|
68
|
+
// When the store is initialized on the client side, we are passing a function that just returns the initial State from the server
|
|
69
|
+
// This is way we are able to maintain the initial state from the server on the client side and then add the relevant reducers
|
|
70
|
+
// Which then consumes the initial state
|
|
71
|
+
const store = (0, _redux.createStore)(Object.keys(initialState).length === 0 ? reducerManager.getReducerMap() : () => initialState, initialState, enhancer);
|
|
72
|
+
return store;
|
|
73
|
+
}
|
package/store/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _indexProd = _interopRequireDefault(require("./index.prod.js"));
|
|
8
|
+
var _indexDev = _interopRequireDefault(require("./index.dev.js"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
/**
|
|
11
|
+
* Function that initializes the store with the initialstate and adds middlewares that can be used during action dispatch
|
|
12
|
+
* It returns different store based on NODE_ENV for eg: production store and development store.
|
|
13
|
+
* @param {object} initialState Default state
|
|
14
|
+
* @param {object} cookies additional headers if needed
|
|
15
|
+
* @param {object} requestObj additional information
|
|
16
|
+
* @param {object} customHeaders custom headers which needs to be used in axios instance
|
|
17
|
+
* @return {object} redux configured store
|
|
18
|
+
*/
|
|
19
|
+
const configureStore = (initialState, cookies, requestObj, customHeaders) => {
|
|
20
|
+
if (process.env.NODE_ENV === "production") {
|
|
21
|
+
return (0, _indexProd.default)(initialState, cookies, requestObj, customHeaders);
|
|
22
|
+
}
|
|
23
|
+
return (0, _indexDev.default)(initialState, cookies, requestObj, customHeaders);
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = configureStore;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = configureStore;
|
|
7
|
+
var _redux = require("redux");
|
|
8
|
+
var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
|
|
9
|
+
var _index = _interopRequireDefault(require("../reducer/index.js"));
|
|
10
|
+
var _api = require("@lib/api.js");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
/**
|
|
13
|
+
* Function that initializes the store with the initialstate and adds middlewares that can be used during action dispatch
|
|
14
|
+
* @param {object} initialState Default state
|
|
15
|
+
* @param {object} cookies additional headers if needed
|
|
16
|
+
* @param {object} requestObj additional information
|
|
17
|
+
* @return {object} the store itself
|
|
18
|
+
*/
|
|
19
|
+
function configureStore(initialState, cookies, requestObj, customHeaders) {
|
|
20
|
+
// The variable defined below acts as a flag when the store is initialized on the client side
|
|
21
|
+
// Reason being that for the first time we need to actually need to forcefully set the reducer for which we have the initial data
|
|
22
|
+
let initializeClient = true;
|
|
23
|
+
const reducerManager = (0, _index.default)();
|
|
24
|
+
// FRAMEWORK COMMENT. This should be exposed to user.
|
|
25
|
+
const api = (0, _api.directAxiosInstance)(cookies, requestObj, customHeaders);
|
|
26
|
+
const labsApi = (0, _api.labsAxiosInstance)(cookies, requestObj, customHeaders);
|
|
27
|
+
const addReducer = reducer => {
|
|
28
|
+
// Only executed once when for the first run in client - side
|
|
29
|
+
if (initializeClient) {
|
|
30
|
+
initializeClient = false;
|
|
31
|
+
return store.replaceReducer(reducerManager.add(reducer));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// This blocks check if the reducer is already added or not in store
|
|
35
|
+
// If not then it only add the missing reducers
|
|
36
|
+
// And if the required reducers are already present then we simply return without performing any change
|
|
37
|
+
let reducerToAdd = {};
|
|
38
|
+
const currentState = store.getState();
|
|
39
|
+
for (let key in reducer) {
|
|
40
|
+
if (!currentState[key]) {
|
|
41
|
+
reducerToAdd[key] = reducer[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (Object.keys(reducerToAdd).length > 0) {
|
|
45
|
+
return store.replaceReducer(reducerManager.add(reducerToAdd));
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
};
|
|
49
|
+
// FRAMEWORK COMMENT THIS WILL NOT BE PART OF FRAMEWORK. NEED TO GENERALISE IT
|
|
50
|
+
let middleware = [_reduxThunk.default.withExtraArgument({
|
|
51
|
+
api,
|
|
52
|
+
labsApi,
|
|
53
|
+
addReducer
|
|
54
|
+
})];
|
|
55
|
+
|
|
56
|
+
// Add universal enhancers here
|
|
57
|
+
let enhancers = [];
|
|
58
|
+
const enhancer = (0, _redux.compose)(...[(0, _redux.applyMiddleware)(...middleware), ...enhancers]);
|
|
59
|
+
|
|
60
|
+
// create store with enhancers, middleware, reducers, and initialState
|
|
61
|
+
// When the store is initialized on the client side, we are passing a function that just returns the initial State from the server
|
|
62
|
+
// This is way we are able to maintain the initial state from the server on the client side and then add the relevant reducers
|
|
63
|
+
// Which then consumes the initial state
|
|
64
|
+
const store = (0, _redux.createStore)(Object.keys(initialState).length === 0 ? reducerManager.getReducerMap() : () => initialState, initialState, enhancer);
|
|
65
|
+
return store;
|
|
66
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
"jsx": "react" /* Specify what JSX code is generated. */,
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
+
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
|
|
48
|
+
"checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
|
|
51
|
+
/* Emit */
|
|
52
|
+
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
53
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
+
"emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */,
|
|
55
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
"outDir": "./types" /* Specify an output folder for all emitted files. */,
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
+
|
|
76
|
+
/* Interop Constraints */
|
|
77
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
81
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
83
|
+
|
|
84
|
+
/* Type Checking */
|
|
85
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
86
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
+
|
|
105
|
+
/* Completeness */
|
|
106
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
+
},
|
|
109
|
+
"include": ["src"]
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let S3_BUCKET: string;
|
|
3
|
+
let S3_FOLDER: string;
|
|
4
|
+
let CDN_ASSET_PATH: string;
|
|
5
|
+
let APPLICATION_PORT: string;
|
|
6
|
+
let APPLICATION_BASE_URL: string;
|
|
7
|
+
let SERVER_PATH: string;
|
|
8
|
+
let OUTPUT_PATH: string;
|
|
9
|
+
let PUBLIC_OUTPUT_PATH: string;
|
|
10
|
+
let PUBLIC_ASSET_PATH: string;
|
|
11
|
+
let LOCAL_ASSET_PATH: string;
|
|
12
|
+
let EXTERNAL_BASE_URL: string;
|
|
13
|
+
let DEV_SERVER_PORT: number;
|
|
14
|
+
let DEV_SERVER_HOSTNAME: string;
|
|
15
|
+
let DEV_SERVER_HOST_URL: string;
|
|
16
|
+
let ENV_NAME: string;
|
|
17
|
+
let BUILD_ENV: string;
|
|
18
|
+
}
|
|
19
|
+
export default _default;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./server/renderer/document/index";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Logger library with rotational strategy. Creates a logs folder in root.
|
|
3
|
+
* With debug, error and info log directories with their respective log files.
|
|
4
|
+
*
|
|
5
|
+
* @format Logstash with timestamp
|
|
6
|
+
* @param config { @enableDebugLogs: Bool // default: true }
|
|
7
|
+
* @returns loggerInstance
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export function configureLogger(config?: any): {
|
|
11
|
+
debug: () => void;
|
|
12
|
+
error: (msg: any) => void;
|
|
13
|
+
info: (msg: any) => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default createReducerManager;
|
|
2
|
+
/**
|
|
3
|
+
* @description A 'Reducer Manager' object, which keeps track of all the registered reducers and exposes a reduce() function. For detailed info :- https://redux.js.org/usage/code-splitting#using-a-reducer-manager
|
|
4
|
+
*/
|
|
5
|
+
declare function createReducerManager(): {
|
|
6
|
+
getReducerMap: () => import("redux").Reducer<import("redux").CombinedState<{
|
|
7
|
+
shellReducer: unknown;
|
|
8
|
+
loadableConfigReducer: never;
|
|
9
|
+
}>, import("redux").Action<any>>;
|
|
10
|
+
reduce: (state: any, action: any) => import("redux").CombinedState<{
|
|
11
|
+
shellReducer: unknown;
|
|
12
|
+
loadableConfigReducer: never;
|
|
13
|
+
}>;
|
|
14
|
+
add: (reducer: any) => import("redux").Reducer<import("redux").CombinedState<{
|
|
15
|
+
shellReducer: unknown;
|
|
16
|
+
loadableConfigReducer: never;
|
|
17
|
+
}>, import("redux").Action<any>> | undefined;
|
|
18
|
+
remove: (key: any) => import("redux").Reducer<import("redux").CombinedState<{
|
|
19
|
+
shellReducer: unknown;
|
|
20
|
+
loadableConfigReducer: never;
|
|
21
|
+
}>, import("redux").Action<any>> | undefined;
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default loadableConfigReducer;
|
|
2
|
+
/** loads loadable config reducer
|
|
3
|
+
* @param {object} defaultState - default state in reducer
|
|
4
|
+
* @return {object} reducer default state
|
|
5
|
+
*/
|
|
6
|
+
declare function loadableConfigReducer(state?: {
|
|
7
|
+
SERVER_SIDE_RENDER: boolean;
|
|
8
|
+
CLIENT_ONLY_RENDER: boolean;
|
|
9
|
+
}): object;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default ServerRouter;
|
|
2
|
+
/**
|
|
3
|
+
* @description return
|
|
4
|
+
* @param {object} reduxData - redux data
|
|
5
|
+
* @returns returns server routes
|
|
6
|
+
*/
|
|
7
|
+
declare function ServerRouter(reduxData: object): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function preparedRoutes(): any;
|
|
2
|
+
export default getRoutes;
|
|
3
|
+
/**
|
|
4
|
+
* @description prepares routes from routes defined inside template.
|
|
5
|
+
* Adds path and element key inside each route.
|
|
6
|
+
* @returns returns routes list after modifiing template routes
|
|
7
|
+
*/
|
|
8
|
+
declare const getRoutes: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@tata1mg/router";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function validatePreInitServer(fn: any): true | undefined;
|
|
2
|
+
export function validateMiddleware(fn: any): true | undefined;
|
|
3
|
+
export function validateReducerFunction(fn: any): true | undefined;
|
|
4
|
+
export function validateConfigFile(obj: any): true | undefined;
|
|
5
|
+
export function validatePackageJson(obj: any): true | undefined;
|
|
6
|
+
export function validateModuleAlias(obj: any): true | undefined;
|
|
7
|
+
export function validateConfigureStore(fn: any): true | undefined;
|
|
8
|
+
export function validateGetRoutes(fn: any): true | undefined;
|
|
9
|
+
export function validateCustomDocument(fn: any): true | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body component which will be used in page component
|
|
3
|
+
* @param {object} initialState - redux store state
|
|
4
|
+
* @param {object} statusCode - api config present in cache list
|
|
5
|
+
* @param {object} firstFoldCss - user defined components for meta tags input
|
|
6
|
+
* @param {object} firstFoldJS - user defined components for meta tags input
|
|
7
|
+
* @param {object} jsx - user defined components for meta tags input
|
|
8
|
+
* @param {object} fetcherData - router fetched data
|
|
9
|
+
*/
|
|
10
|
+
export function Body(props: any): React.JSX.Element;
|
|
11
|
+
import React from "react";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Head component which will be used in page rendering
|
|
3
|
+
* @param {string} pageCss - includes all styles for page css
|
|
4
|
+
* @param {object} pageJS - async scripts for loading chunks
|
|
5
|
+
* @param {function} metaTagFunction - user defined function which returns meta tags in array
|
|
6
|
+
* @param {boolean} isBot - checks if request is made by bot
|
|
7
|
+
* @param {string} publicAssetPath - public asset path for assets
|
|
8
|
+
* @param {object} fetcherData - router fetched data
|
|
9
|
+
*/
|
|
10
|
+
export function Head(props: any): React.JSX.Element;
|
|
11
|
+
import React from "react";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores css chunks styles into cache in string format
|
|
3
|
+
* @param {string} key - router path
|
|
4
|
+
* @param {object} data - css elements array extracted through loadable chunk extracter
|
|
5
|
+
*/
|
|
6
|
+
export function cacheCSS(key: string, data: object): void;
|
|
7
|
+
/**
|
|
8
|
+
* Stores javascript into cache
|
|
9
|
+
* @param {string} key - router path
|
|
10
|
+
* @param {object} data - js elements array extracted through loadable chunk extracter
|
|
11
|
+
*/
|
|
12
|
+
export function cacheJS(key: string, data: object): void;
|
|
13
|
+
/**
|
|
14
|
+
* stores css and js in cache
|
|
15
|
+
* @param {object} res - response object
|
|
16
|
+
* @param {string} route - route path
|
|
17
|
+
*/
|
|
18
|
+
export default function _default(res: object, route: string): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { renderStart };
|
|
3
|
+
export { renderEnd };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
/**
|
|
7
|
+
* returns data which will be used in head component for page rendering
|
|
8
|
+
* @param {string} pageCss - includes all styles for page css
|
|
9
|
+
* @param {string} pageJS - async scripts for loading chunks
|
|
10
|
+
* @param {function} metaTagFunction - user defined function which returns meta tags in array
|
|
11
|
+
* @param {boolean} isBot - checks if request is made by bot
|
|
12
|
+
* @param {object} fetcherData - router fetched data
|
|
13
|
+
*/
|
|
14
|
+
declare function renderStart(pageCss: string, pageJS: string, metaTagFunction: Function, isBot: boolean, fetcherData: object): {
|
|
15
|
+
pageCss: string;
|
|
16
|
+
pageJS: string;
|
|
17
|
+
metaTagFunction: Function;
|
|
18
|
+
isBot: boolean;
|
|
19
|
+
publicAssetPath: string;
|
|
20
|
+
fetcherData: object;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* returns data which will be used in body component for page rendering
|
|
24
|
+
* @param {object} webExtractor - loadable object which holds chunking function
|
|
25
|
+
* @param {string} initialState - reducer initial state
|
|
26
|
+
* @param {function} res - response object
|
|
27
|
+
* @param {boolean} jsx - jsx which needs to be render on server side
|
|
28
|
+
* @param {string|number|null} errorCode - error code
|
|
29
|
+
* @param {object} fetcherData - router fetched data
|
|
30
|
+
*/
|
|
31
|
+
declare function renderEnd(webExtractor: object, initialState: string | undefined, res: Function, jsx: boolean, errorCode: string | number | null, fetcherData: object): {
|
|
32
|
+
initialState: string;
|
|
33
|
+
firstFoldCss: string;
|
|
34
|
+
firstFoldJS: string;
|
|
35
|
+
jsx: boolean;
|
|
36
|
+
errorCode: string | number | null;
|
|
37
|
+
fetcherData: object;
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getUserAgentDetails(ua: string): object;
|