wapplr 1.0.70 → 1.0.72

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.
@@ -61,6 +61,69 @@ function createServer() {
61
61
  _serverConfig$disable = serverConfig.disableUseDefaultMiddlewares,
62
62
  disableUseDefaultMiddlewares = _serverConfig$disable === void 0 ? false : _serverConfig$disable,
63
63
  rest = (0, _objectWithoutProperties2["default"])(serverConfig, _excluded);
64
+ var defaultCssToInlineStyle = Object.create(Object.prototype, {
65
+ loadCssToStyle: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
66
+ value: function value(a) {
67
+ if (Array.isArray(a) && a.length) {
68
+ var getThemeCss = function getThemeCss() {
69
+ var themeCss = [];
70
+
71
+ if (assets && assets.chunks) {
72
+ Object.keys(assets.chunks).forEach(function (key) {
73
+ if (key === 'client') {
74
+ var files = assets.chunks[key].sort();
75
+ files.forEach(function (style) {
76
+ if (style && style.match(".css") && a.indexOf(style) > -1 && !(themeCss.indexOf(style) > -1)) {
77
+ themeCss.push(style);
78
+ }
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
+ return themeCss;
85
+ };
86
+
87
+ var intersection = a.filter(function (x) {
88
+ return wapp.server.config.assets.cssToInlineStyle.css.includes(x);
89
+ });
90
+
91
+ if (intersection.length === a.length) {
92
+ return;
93
+ }
94
+
95
+ var themeCss = getThemeCss();
96
+ var text = "";
97
+ var css = [];
98
+ themeCss.forEach(function (cssPath) {
99
+ if (_nodeFs["default"].existsSync(_nodePath["default"].join(publicPath, cssPath))) {
100
+ var cssContent = _nodeFs["default"].readFileSync(_nodePath["default"].join(publicPath, cssPath));
101
+
102
+ if (cssContent) {
103
+ text = [text, cssContent].filter(function (t) {
104
+ return t;
105
+ }).join(" ");
106
+ css.push(cssPath);
107
+ }
108
+ }
109
+ });
110
+ wapp.server.config.assets.cssToInlineStyle.text = text;
111
+ wapp.server.config.assets.cssToInlineStyle.css = css;
112
+ }
113
+ }
114
+ }),
115
+ _getCss: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
116
+ value: function value() {
117
+ return wapp.server.config.assets.cssToInlineStyle.text || "";
118
+ }
119
+ }),
120
+ text: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
121
+ value: ''
122
+ }),
123
+ css: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
124
+ value: []
125
+ })
126
+ });
64
127
  var defaultAssets = Object.create(Object.prototype, {
65
128
  client: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
66
129
  value: assets["client.js"]
@@ -105,63 +168,10 @@ function createServer() {
105
168
  }),
106
169
  cssToInlineStyle: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
107
170
  enumerable: false,
108
- value: {
109
- loadCssToStyle: function loadCssToStyle(a) {
110
- if (Array.isArray(a) && a.length) {
111
- var getThemeCss = function getThemeCss() {
112
- var themeCss = [];
113
-
114
- if (assets && assets.chunks) {
115
- Object.keys(assets.chunks).forEach(function (key) {
116
- if (key === 'client') {
117
- var files = assets.chunks[key].sort();
118
- files.forEach(function (style) {
119
- if (style && style.match(".css") && a.indexOf(style) > -1 && !(themeCss.indexOf(style) > -1)) {
120
- themeCss.push(style);
121
- }
122
- });
123
- }
124
- });
125
- }
126
-
127
- return themeCss;
128
- };
129
-
130
- var intersection = a.filter(function (x) {
131
- return assets.cssToInlineStyle.css.includes(x);
132
- });
133
-
134
- if (intersection.length === a.length) {
135
- return;
136
- }
137
-
138
- var themeCss = getThemeCss();
139
- var text = "";
140
- var css = [];
141
- themeCss.forEach(function (cssPath) {
142
- if (_nodeFs["default"].existsSync(_nodePath["default"].join(publicPath, cssPath))) {
143
- var cssContent = _nodeFs["default"].readFileSync(_nodePath["default"].join(publicPath, cssPath));
144
-
145
- if (cssContent) {
146
- text = [text, cssContent].filter(function (t) {
147
- return t;
148
- }).join(" ");
149
- css.push(cssPath);
150
- }
151
- }
152
- });
153
- assets.cssToInlineStyle.text = text;
154
- assets.cssToInlineStyle.css = css;
155
- }
156
- },
157
- _getCss: function _getCss() {
158
- return assets.cssToInlineStyle.cssText || "";
159
- },
160
- text: '',
161
- css: []
162
- }
171
+ value: defaultCssToInlineStyle
163
172
  }),
164
- getCsStyles: {
173
+ getCsStyles: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
174
+ enumerable: false,
165
175
  value: function value() {
166
176
  var chunks = [];
167
177
 
@@ -170,9 +180,9 @@ function createServer() {
170
180
  if (key === 'client') {
171
181
  var files = assets.chunks[key].sort();
172
182
  files.forEach(function (style) {
173
- var _assets$cssToInlineSt;
183
+ var _wapp$server$config$a;
174
184
 
175
- if (style && style.match(".css") && chunks.indexOf(style) === -1 && !(((_assets$cssToInlineSt = assets.cssToInlineStyle.css) === null || _assets$cssToInlineSt === void 0 ? void 0 : _assets$cssToInlineSt.indexOf(style)) > -1)) {
185
+ if (style && style.match(".css") && chunks.indexOf(style) === -1 && !(((_wapp$server$config$a = wapp.server.config.assets.cssToInlineStyle.css) === null || _wapp$server$config$a === void 0 ? void 0 : _wapp$server$config$a.indexOf(style)) > -1)) {
176
186
  chunks.push(style);
177
187
  }
178
188
  });
@@ -185,9 +195,9 @@ function createServer() {
185
195
  if (assets) {
186
196
  Object.keys(assets).forEach(function (key) {
187
197
  if (key !== "chunks" && styles.indexOf(assets[key]) === -1) {
188
- var _assets$cssToInlineSt2;
198
+ var _wapp$server$config$a2;
189
199
 
190
- if (assets[key] && assets[key].match(".css") && !(((_assets$cssToInlineSt2 = assets.cssToInlineStyle.css) === null || _assets$cssToInlineSt2 === void 0 ? void 0 : _assets$cssToInlineSt2.indexOf(assets[key])) > -1)) {
200
+ if (assets[key] && assets[key].match(".css") && !(((_wapp$server$config$a2 = wapp.server.config.assets.cssToInlineStyle.css) === null || _wapp$server$config$a2 === void 0 ? void 0 : _wapp$server$config$a2.indexOf(assets[key])) > -1)) {
191
201
  styles.push(assets[key]);
192
202
  }
193
203
  }
@@ -196,7 +206,7 @@ function createServer() {
196
206
 
197
207
  return styles;
198
208
  }
199
- }
209
+ })
200
210
  });
201
211
  var defaultCredentials = Object.create(Object.prototype, {
202
212
  key: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _utils.defaultDescriptor), {}, {
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "files": [
23
23
  "dist/*"
24
24
  ],
25
- "version": "1.0.70",
25
+ "version": "1.0.72",
26
26
  "main": "dist/server",
27
27
  "browser": "dist/client",
28
28
  "repository": {