@zengenti/contensis-react-base 3.0.0-beta.70 → 3.0.0-beta.73

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/esm/client.js CHANGED
@@ -8,8 +8,8 @@ import { loadableReady } from '@loadable/component';
8
8
  import * as queryString from 'query-string';
9
9
  import { CookiesProvider } from 'react-cookie';
10
10
  import { c as createStore, s as setVersionStatus } from './version-c7268214.js';
11
- import { d as deliveryApi, b as browserHistory, r as rootSaga, p as pickProject } from './App-d7b18a4f.js';
12
- export { A as ReactApp } from './App-d7b18a4f.js';
11
+ import { d as deliveryApi, b as browserHistory, r as rootSaga, p as pickProject } from './App-af0670fa.js';
12
+ export { A as ReactApp } from './App-af0670fa.js';
13
13
  import { s as setCurrentProject } from './actions-fcfc8704.js';
14
14
  import './selectors-337be432.js';
15
15
  import 'jsonpath-mapper';
@@ -1,7 +1,7 @@
1
1
  import { Op, Query } from 'contensis-core-api';
2
2
  import React from 'react';
3
3
  import { Provider } from 'react-redux';
4
- import { d as defaultExpressions, c as contentTypeIdExpression, f as filterExpressions, t as termExpressions, o as orderByExpression, a as customWhereExpressions } from './sagas-489c29ca.js';
4
+ import { d as defaultExpressions, c as contentTypeIdExpression, f as filterExpressions, t as termExpressions, o as orderByExpression, a as customWhereExpressions } from './sagas-1f2b2aa0.js';
5
5
  import mapJson from 'jsonpath-mapper';
6
6
  import 'reselect';
7
7
  import 'deepmerge';
@@ -9,8 +9,8 @@ import 'query-string';
9
9
  import 'immer';
10
10
  import 'deep-equal';
11
11
  import { s as setCachingHeaders } from './VersionInfo-f5403b09.js';
12
- import { c as cachedSearch, h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-d7b18a4f.js';
13
- export { A as ReactApp } from './App-d7b18a4f.js';
12
+ import { c as cachedSearch, h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-af0670fa.js';
13
+ export { A as ReactApp } from './App-af0670fa.js';
14
14
  import 'isomorphic-fetch';
15
15
  import express from 'express';
16
16
  import httpProxy from 'http-proxy';
@@ -3758,7 +3758,7 @@ const loadableBundleData = ({
3758
3758
  const bundle = {};
3759
3759
 
3760
3760
  try {
3761
- bundle.stats = JSON.parse(readFileSync(stats.replace('/target', build ? `/${build}` : '')));
3761
+ bundle.stats = stats ? JSON.parse(readFileSync(stats.replace('/target', build ? `/${build}` : ''))) : null;
3762
3762
  } catch (ex) {
3763
3763
  // console.info(ex);
3764
3764
  bundle.stats = null;
@@ -3778,31 +3778,51 @@ const loadableBundleData = ({
3778
3778
  return bundle;
3779
3779
  };
3780
3780
  const loadableChunkExtractors = () => {
3781
+ const commonLoadableExtractor = new ChunkExtractor({
3782
+ stats: {}
3783
+ });
3784
+
3781
3785
  try {
3782
- const modern = new ChunkExtractor({
3783
- entrypoints: ['app'],
3784
- namespace: 'modern',
3785
- statsFile: path.resolve('dist/modern/loadable-stats.json')
3786
- });
3787
- const legacy = new ChunkExtractor({
3788
- entrypoints: ['app'],
3789
- namespace: 'legacy',
3790
- statsFile: path.resolve('dist/legacy/loadable-stats.json')
3791
- });
3792
- const commonLoadableExtractor = {
3793
- addChunk(chunk) {
3794
- modern.addChunk(chunk);
3795
- if (typeof legacy.stats.assetsByChunkName[chunk] !== 'undefined') legacy.addChunk(chunk);
3796
- }
3786
+ let modern;
3787
+ let legacy;
3788
+
3789
+ try {
3790
+ modern = new ChunkExtractor({
3791
+ entrypoints: ['app'],
3792
+ namespace: 'modern',
3793
+ statsFile: path.resolve('dist/modern/loadable-stats.json')
3794
+ });
3795
+ } catch (e) {
3796
+ console.info('@loadable/server modern ChunkExtractor not available');
3797
+ }
3798
+
3799
+ try {
3800
+ legacy = new ChunkExtractor({
3801
+ entrypoints: ['app'],
3802
+ namespace: 'legacy',
3803
+ statsFile: path.resolve('dist/legacy/loadable-stats.json')
3804
+ });
3805
+ } catch (e) {
3806
+ console.info('@loadable/server legacy ChunkExtractor not available');
3807
+ }
3808
+
3809
+ commonLoadableExtractor.addChunk = chunk => {
3810
+ var _modern, _legacy, _legacy2;
3797
3811
 
3812
+ (_modern = modern) === null || _modern === void 0 ? void 0 : _modern.addChunk(chunk);
3813
+ if (typeof ((_legacy = legacy) === null || _legacy === void 0 ? void 0 : _legacy.stats.assetsByChunkName[chunk]) !== 'undefined') (_legacy2 = legacy) === null || _legacy2 === void 0 ? void 0 : _legacy2.addChunk(chunk);
3798
3814
  };
3815
+
3799
3816
  return {
3800
3817
  commonLoadableExtractor,
3801
3818
  modern,
3802
3819
  legacy
3803
3820
  };
3804
3821
  } catch (e) {
3805
- console.info('@loadable/server ChunkExtractor not available');
3822
+ console.info('@loadable/server no ChunkExtractor available');
3823
+ return {
3824
+ commonLoadableExtractor
3825
+ };
3806
3826
  }
3807
3827
  };
3808
3828
  const getBundleData = (config, staticRoutePath) => {
@@ -3813,17 +3833,46 @@ const getBundleData = (config, staticRoutePath) => {
3813
3833
  };
3814
3834
  if (!bundleData.default || bundleData.default === {}) bundleData.default = bundleData.legacy || bundleData.modern;
3815
3835
  return bundleData;
3816
- };
3836
+ }; // export const buildBundleTags = (
3837
+ // bundles,
3838
+ // differentialBundles = false,
3839
+ // staticRoutePath = 'static',
3840
+ // attributes = ''
3841
+ // ) => {
3842
+ // // Take the bundles returned from Loadable.Capture
3843
+ // const bundleTags = bundles
3844
+ // .filter(b => b)
3845
+ // .map(bundle => {
3846
+ // if (bundle.publicPath.includes('/modern/'))
3847
+ // return differentialBundles
3848
+ // ? `<script ${attributes} type="module" src="${replaceStaticPath(
3849
+ // bundle.publicPath,
3850
+ // staticRoutePath
3851
+ // )}"></script>`
3852
+ // : null;
3853
+ // return `<script ${attributes}${
3854
+ // differentialBundles ? ' nomodule' : ''
3855
+ // } src="${replaceStaticPath(
3856
+ // bundle.publicPath,
3857
+ // staticRoutePath
3858
+ // )}"></script>`;
3859
+ // })
3860
+ // .filter(f => f);
3861
+ // return bundleTags;
3862
+ // };
3863
+
3817
3864
  const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') => {
3818
3865
  let startupTag = ''; // Add the static startup script to the bundleTags
3819
3866
 
3820
3867
  if (scripts !== null && scripts !== void 0 && scripts.startup) startupTag = `<script ${stringifyAttributes(scripts.attributes)} src="/${staticRoutePath}/${scripts.startup}"></script>`; // Get the script tags from their respective extractor instances
3821
3868
 
3822
3869
  if (loadableExtractor) {
3823
- const legacyScriptTags = loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.legacy.getScriptTags({
3870
+ var _loadableExtractor$le, _loadableExtractor$mo;
3871
+
3872
+ const legacyScriptTags = (_loadableExtractor$le = loadableExtractor.legacy) === null || _loadableExtractor$le === void 0 ? void 0 : _loadableExtractor$le.getScriptTags({
3824
3873
  nomodule: 'nomodule'
3825
3874
  });
3826
- const modernScriptTags = loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.modern.getScriptTags({
3875
+ const modernScriptTags = (_loadableExtractor$mo = loadableExtractor.modern) === null || _loadableExtractor$mo === void 0 ? void 0 : _loadableExtractor$mo.getScriptTags({
3827
3876
  type: 'module'
3828
3877
  });
3829
3878
  const scriptTags = `${startupTag}${legacyScriptTags || ''}${modernScriptTags || ''}`.replace(/"\/static\//g, `"/${staticRoutePath}/`);
@@ -3952,7 +4001,7 @@ const webApp = (app, ReactApp, config) => {
3952
4001
  store.dispatch(setCurrentProject(project, groups, request.hostname));
3953
4002
  const loadableExtractor = loadableChunkExtractors();
3954
4003
  const jsx = /*#__PURE__*/React.createElement(ChunkExtractorManager, {
3955
- extractor: loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.commonLoadableExtractor
4004
+ extractor: loadableExtractor.commonLoadableExtractor
3956
4005
  }, /*#__PURE__*/React.createElement(CookiesProvider, {
3957
4006
  cookies: cookies
3958
4007
  }, /*#__PURE__*/React.createElement(Provider, {
@@ -3965,9 +4014,9 @@ const webApp = (app, ReactApp, config) => {
3965
4014
  withEvents: withEvents
3966
4015
  })))));
3967
4016
  const {
3968
- templateHTML,
3969
- templateHTMLFragment,
3970
- templateHTMLStatic
4017
+ templateHTML = '',
4018
+ templateHTMLFragment = '',
4019
+ templateHTMLStatic = ''
3971
4020
  } = bundleData.default.templates || bundleData.legacy.templates || {}; // Serve a blank HTML page with client scripts to load the app in the browser
3972
4021
 
3973
4022
  if (accessMethod.DYNAMIC) {