wapplr 1.0.49 → 1.0.50

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const tokens = {"log":"log_3MWuJ","logo":"log_36siB"};
6
- tokens._getCss = function () {return `/* imported from log.css */ .log_3MWuJ { display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 16px; width: 100%; height: 100%; position: absolute; } .log_36siB { height: 128px; max-width: 100%; } .log_3MWuJ > div { width: 100%; text-align: center; } `;};
5
+ const tokens = {"log":"log_22skC","logo":"log_1z5J7"};
6
+ tokens._getCss = function () {return `/* imported from log.css */ .log_22skC { display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 16px; width: 100%; height: 100%; position: absolute; } .log_1z5J7 { height: 128px; max-width: 100%; } .log_22skC > div { width: 100%; text-align: center; } `;};
7
7
  tokens._module = (typeof module !== "undefined") ? module : {id:"./common/log/log_css.js"};
8
8
  exports["default"] = tokens;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const tokens = {"logo":"logo_d_fdf","icon":"logo_1Trfm","svg":"logo_X5kuq"};
6
- tokens._getCss = function () {return `/* imported from logo.css */ .logo_d_fdf { height: 100%; width: auto; display: -ms-inline-flexbox; display: inline-flex; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; } .logo_1Trfm { height: 90%; width: auto; } .logo_X5kuq { height: 100%; width: auto; display: -ms-flexbox; display: flex; max-width: 100%; } .logo_X5kuq path{ fill: currentColor; } `;};
5
+ const tokens = {"logo":"logo_nn0MV","icon":"logo_1jj_J","svg":"logo_Kj3Lv"};
6
+ tokens._getCss = function () {return `/* imported from logo.css */ .logo_nn0MV { height: 100%; width: auto; display: -ms-inline-flexbox; display: inline-flex; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; } .logo_1jj_J { height: 90%; width: auto; } .logo_Kj3Lv { height: 100%; width: auto; display: -ms-flexbox; display: flex; max-width: 100%; } .logo_Kj3Lv path{ fill: currentColor; } `;};
7
7
  tokens._module = (typeof module !== "undefined") ? module : {id:"./common/logo/logo_css.js"};
8
8
  exports["default"] = tokens;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const tokens = {"app":"app_TgHI7"};
6
- tokens._getCss = function () {return `/* imported from app.css */ body { margin: 0; padding: 0; max-width: 100vw; overflow-x: hidden; } * { -webkit-box-sizing: border-box; box-sizing: border-box; } .app_TgHI7 { font-size: 14px; color: rgba(0,0,0,0.87); display: block; position: relative; overflow-x: hidden; } div.app_TgHI7 > * { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } @media (orientation: portrait) { .app_TgHI7 { max-width: 100vh; } } `;};
5
+ const tokens = {"app":"app_1jDDh"};
6
+ tokens._getCss = function () {return `/* imported from app.css */ body { margin: 0; padding: 0; max-width: 100vw; overflow-x: hidden; } * { -webkit-box-sizing: border-box; box-sizing: border-box; } .app_1jDDh { font-size: 14px; color: rgba(0,0,0,0.87); display: block; position: relative; overflow-x: hidden; } div.app_1jDDh > * { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } @media (orientation: portrait) { .app_1jDDh { max-width: 100vh; } } `;};
7
7
  tokens._module = (typeof module !== "undefined") ? module : {id:"./common/template/app_css.js"};
8
8
  exports["default"] = tokens;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const tokens = {"page":"template_3HXPB","header":"template_3ck2q","sticky":"template_2Nz4A","innerHeader":"template_3nJPj","logo":"template_rKBgA","content":"template_1zK-k","footer":"template_3Rlwa","menu":"template_1r1_q","button":"template_1iINl","copyright":"template_3y44t"};
6
- tokens._getCss = function () {return `/* imported from template.css */ .template_3HXPB { display: block; position: relative; overflow-x: hidden; overflow-y: hidden; min-height: 100vh; max-width: 100vw; } .template_3ck2q { display: block; position: fixed; width: 100%; height: 64px; padding: 6px; background: white; z-index: 1; -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; -o-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; } .template_3ck2q.template_2Nz4A { -webkit-box-shadow: 0 2px 3px rgba(62, 62, 62, 0.15); box-shadow: 0 2px 3px rgba(62, 62, 62, 0.15); } .template_3nJPj { display: block; width: 100%; height: 100%; position: relative; overflow: hidden; } .template_3ck2q .template_rKBgA { height: 52px; -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; -o-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; margin-top: 100%; } .template_3ck2q.template_2Nz4A .template_rKBgA { margin-top: 0; } .template_1zK-k { min-height: 100vh; position: relative; padding-top: 64px; } .template_3Rlwa { display: -ms-flexbox; display: flex; min-height: 128px; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; } .template_1r1_q { } .template_1r1_q > div { } .template_3Rlwa .template_1r1_q { -ms-flex-pack: center; justify-content: center; display: -ms-flexbox; display: flex; } .template_3Rlwa .template_1r1_q > div { display: inline-block; } .template_1iINl { color: rgba(0, 0, 0, 0.87); padding: 6px 16px; font-size: 14px; font-size: 0.875rem; min-width: 64px; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; -o-transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; line-height: 1.75; border-radius: 4px; letter-spacing: 0.02857em; text-transform: uppercase; font-weight: bold; border: 0; cursor: pointer; margin: 0; display: -ms-inline-flexbox; display: inline-flex; outline: 0; position: relative; -ms-flex-align: center; align-items: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; vertical-align: middle; -ms-flex-pack: center; justify-content: center; text-decoration: none; background-color: transparent; text-align: center; } a.template_1iINl { text-decoration: none; } .template_3y44t { font-size: 12px; margin: 24px; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } `;};
5
+ const tokens = {"page":"template_2Xa8-","header":"template_3YAtu","sticky":"template_3VZZR","innerHeader":"template_368k6","logo":"template_K8VJE","content":"template_2Fgqj","footer":"template_21lie","menu":"template_1BoA5","button":"template_3ZxC8","copyright":"template_3bU4k"};
6
+ tokens._getCss = function () {return `/* imported from template.css */ .template_2Xa8- { display: block; position: relative; overflow-x: hidden; overflow-y: hidden; min-height: 100vh; max-width: 100vw; } .template_3YAtu { display: block; position: fixed; width: 100%; height: 64px; padding: 6px; background: white; z-index: 1; -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; -o-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; } .template_3YAtu.template_3VZZR { -webkit-box-shadow: 0 2px 3px rgba(62, 62, 62, 0.15); box-shadow: 0 2px 3px rgba(62, 62, 62, 0.15); } .template_368k6 { display: block; width: 100%; height: 100%; position: relative; overflow: hidden; } .template_3YAtu .template_K8VJE { height: 52px; -webkit-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; -o-transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; margin-top: 100%; } .template_3YAtu.template_3VZZR .template_K8VJE { margin-top: 0; } .template_2Fgqj { min-height: 100vh; position: relative; padding-top: 64px; } .template_21lie { display: -ms-flexbox; display: flex; min-height: 128px; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; } .template_1BoA5 { } .template_1BoA5 > div { } .template_21lie .template_1BoA5 { -ms-flex-pack: center; justify-content: center; display: -ms-flexbox; display: flex; } .template_21lie .template_1BoA5 > div { display: inline-block; } .template_3ZxC8 { color: rgba(0, 0, 0, 0.87); padding: 6px 16px; font-size: 14px; font-size: 0.875rem; min-width: 64px; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; -o-transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,-webkit-box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; line-height: 1.75; border-radius: 4px; letter-spacing: 0.02857em; text-transform: uppercase; font-weight: bold; border: 0; cursor: pointer; margin: 0; display: -ms-inline-flexbox; display: inline-flex; outline: 0; position: relative; -ms-flex-align: center; align-items: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; vertical-align: middle; -ms-flex-pack: center; justify-content: center; text-decoration: none; background-color: transparent; text-align: center; } a.template_3ZxC8 { text-decoration: none; } .template_3bU4k { font-size: 12px; margin: 24px; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } `;};
7
7
  tokens._module = (typeof module !== "undefined") ? module : {id:"./common/template/template_css.js"};
8
8
  exports["default"] = tokens;
@@ -9,6 +9,82 @@ var fs = require("fs");
9
9
 
10
10
  var path = require("path");
11
11
 
12
+ function destroy(stream) {
13
+ if (!(stream !== null && stream !== void 0 && stream.__destroyed)) {
14
+ stream.destroy();
15
+ stream.__destroyed = true;
16
+
17
+ if (typeof stream.close === "function") {
18
+ stream.on("open", function onOpenClose() {
19
+ if (typeof this.fd === "number") {
20
+ this.close();
21
+ }
22
+ });
23
+ }
24
+ }
25
+
26
+ return stream;
27
+ }
28
+
29
+ function endStream(req, res, stream) {
30
+ if (req.__onFinishedRemoveListener) {
31
+ req.__onFinishedRemoveListener();
32
+
33
+ req.__onFinishedRemoveListener = null;
34
+ }
35
+
36
+ if (res.__onFinishedRemoveListener) {
37
+ res.__onFinishedRemoveListener();
38
+
39
+ res.__onFinishedRemoveListener = null;
40
+ }
41
+
42
+ destroy(stream);
43
+ }
44
+
45
+ function onFinished(req, res, callback) {
46
+ function isFinishedResponse() {
47
+ var socket = res.socket;
48
+
49
+ if (typeof res.finished === "boolean") {
50
+ return Boolean(res.finished || socket && !socket.writable);
51
+ }
52
+ }
53
+
54
+ function isFinishedRequest() {
55
+ var socket = req.socket;
56
+
57
+ if (typeof req.complete === "boolean") {
58
+ return Boolean(req.upgrade || !socket || !socket.readable || req.complete && !req.readable);
59
+ }
60
+ }
61
+
62
+ function removeListener() {
63
+ if (req.__onFinishedInterval) {
64
+ console.log("remove listener", req.path);
65
+ clearInterval(req.__onFinishedInterval);
66
+ req.__onFinishedInterval = 0;
67
+ }
68
+
69
+ if (res.__onFinishedInterval) {
70
+ clearInterval(res.__onFinishedInterval);
71
+ res.__onFinishedInterval = 0;
72
+ }
73
+ }
74
+
75
+ function listener() {
76
+ var result = isFinishedRequest() || isFinishedResponse();
77
+
78
+ if (result) {
79
+ removeListener();
80
+ callback();
81
+ }
82
+ }
83
+
84
+ req.__onFinishedInterval = res.__onFinishedInterval = setInterval(listener, 100);
85
+ req.__onFinishedRemoveListener = res.__onFinishedRemoveListener = removeListener;
86
+ }
87
+
12
88
  function serveStatic(publicPath) {
13
89
  return function staticMiddleware(req, res, next) {
14
90
  var parsedUrl = {
@@ -28,6 +104,8 @@ function serveStatic(publicPath) {
28
104
  return next();
29
105
  }
30
106
 
107
+ var stream;
108
+
31
109
  try {
32
110
  var data = fs.readFileSync(pathname);
33
111
  var stats = fs.statSync(pathname);
@@ -37,8 +115,15 @@ function serveStatic(publicPath) {
37
115
  stats: stats,
38
116
  parsedPath: paredSanitizePath
39
117
  };
40
- var stream = fs.createReadStream(pathname);
118
+ stream = fs.createReadStream(pathname);
119
+ onFinished(req, res, function () {
120
+ endStream(req, res, stream);
121
+ });
122
+ stream.on("close", function onopen() {
123
+ endStream(req, res, stream);
124
+ });
41
125
  stream.on("error", function onerror(err) {
126
+ endStream(req, res, stream);
42
127
  res.wappResponse.status(err.statusCode || 500, err);
43
128
  res.wapp.log(err, req, res);
44
129
  next(err);
@@ -50,6 +135,7 @@ function serveStatic(publicPath) {
50
135
  });
51
136
  });
52
137
  } catch (err) {
138
+ endStream(req, res, stream);
53
139
  res.wappResponse.status(err.statusCode || 500, err);
54
140
  res.wapp.log(err, req, res);
55
141
  next(err);
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "files": [
23
23
  "dist/*"
24
24
  ],
25
- "version": "1.0.49",
25
+ "version": "1.0.50",
26
26
  "main": "dist/server",
27
27
  "browser": "dist/client",
28
28
  "repository": {