total5 0.0.18-4 → 0.0.18

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/changelog.txt CHANGED
@@ -7,6 +7,7 @@
7
7
  - extended the `message.send(output, data, [clone_data], [check(from, to, output, input)])` method by adding `check` argument
8
8
  - extended `LDAP()` options by adding a new option `attributes = { thumbnailPhoto: 'buffer' }` for custom parsing data
9
9
  - fixed Flow error handling
10
+ - updated Total.js debug watcher to detect incomplete file writes
10
11
 
11
12
  ========================
12
13
  0.0.17
package/debug.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Debug module (Watcher)
2
2
  // The MIT License
3
- // Copyright 2012-2024 (c) Peter Širka <petersirka@gmail.com>
3
+ // Copyright 2012-2026 (c) Peter Širka <petersirka@gmail.com>
4
4
 
5
5
  'use strict';
6
6
 
@@ -143,6 +143,7 @@ function runwatching() {
143
143
 
144
144
  var WS = null;
145
145
  var files = {};
146
+ var sizes = {};
146
147
  var force = false;
147
148
  var changes = [];
148
149
  var app = null;
@@ -303,6 +304,19 @@ function runwatching() {
303
304
  var ticks = stat.mtime.getTime();
304
305
  if (files[filename] != null && files[filename] !== ticks) {
305
306
 
307
+ // Check filesize
308
+ let size = sizes[filename] || 0;
309
+ if (!size || size != stat.size) {
310
+
311
+ // This is because the file can only be copied slowly via the network.
312
+ if (size < stat.size) {
313
+ // Reload round for this file
314
+ sizes[filename] = stat.size;
315
+ next();
316
+ return;
317
+ }
318
+ }
319
+
306
320
  if (filename.endsWith('.bundle') && files[filename.replace(/\.bundle$/, '.url')]) {
307
321
  // Bundle from URL address
308
322
  files[filename] = ticks;
@@ -321,6 +335,7 @@ function runwatching() {
321
335
 
322
336
  var log = stamp.replace('#', files[filename] === 0 ? 'ADD' : 'UPD') + prefix + LIVERELOADCHANGE;
323
337
  if (files[filename]) {
338
+ delete sizes[filename];
324
339
  var tmp = isViewPublic(filename);
325
340
  if (tmp) {
326
341
  var skip = true;
@@ -550,4 +565,4 @@ function init() {
550
565
  setImmediate(runapp);
551
566
  }
552
567
 
553
- Meta.delay = setTimeout(init, 100);
568
+ Meta.delay = setTimeout(init, 100);
@@ -1914,9 +1914,9 @@ exports.client = function(flow, socket) {
1914
1914
 
1915
1915
  function MAKEFLOWSTREAM(meta) {
1916
1916
 
1917
- var flow = F.TFlowStream.create(meta.id, function(err, type, componentid) {
1917
+ var flow = F.TFlowStream.create(meta.id, function(err, type, componentid, instanceid) {
1918
1918
  if (isFLOWSTREAMWORKER) {
1919
- Parent.postMessage({ TYPE: 'stream/error', error: err.toString(), stack: err.stack, source: type, component: componentid });
1919
+ Parent.postMessage({ TYPE: 'stream/error', error: err.toString(), stack: err.stack, source: type, id: instanceid, component: componentid });
1920
1920
  } else {
1921
1921
  this.$instance.onerror(err, type, null, componentid, err.stack);
1922
1922
  }
package/flowstream.js CHANGED
@@ -1730,7 +1730,6 @@ function sendmessage(instance, message, event) {
1730
1730
  try {
1731
1731
 
1732
1732
  var is = false;
1733
-
1734
1733
  var key = 'message_' + message.input;
1735
1734
 
1736
1735
  if (instance[key]) {
@@ -1747,7 +1746,7 @@ function sendmessage(instance, message, event) {
1747
1746
  message.destroy();
1748
1747
 
1749
1748
  } catch (e) {
1750
- instance.main.error(e, 'instance_message', message.tocomponent);
1749
+ instance.main.error(e, 'instance_message', message.tocomponent, message.toid);
1751
1750
  message.destroy();
1752
1751
  }
1753
1752
  }
package/mail.js CHANGED
@@ -489,7 +489,6 @@ Mailer.send = function(opt, messages, callback) {
489
489
  const err = new Error('No SMTP server configuration.');
490
490
  let iscallback = false;
491
491
 
492
-
493
492
  if (callback) {
494
493
  iscallback = true;
495
494
  callback(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.18-4",
3
+ "version": "0.0.18",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/templates.js CHANGED
@@ -5,9 +5,9 @@
5
5
  exports.render = function(body, model, $) {
6
6
  return new Promise(function(resolve, reject) {
7
7
 
8
- var cache = F.temporary.templates;
9
- var id = 'Ttemplate' + HASH(body) + ($ ? $.language : '');
10
- var data = cache[id];
8
+ let cache = F.temporary.templates;
9
+ let id = 'Ttemplate' + HASH(body) + ($ ? $.language : '');
10
+ let data = cache[id];
11
11
 
12
12
  if (data) {
13
13
  try {
@@ -26,13 +26,13 @@ exports.render = function(body, model, $) {
26
26
  // URL address or filename
27
27
  data = cache[id];
28
28
 
29
- var start = body.substring(0, 7);
29
+ let start = body.substring(0, 7);
30
30
  // http://
31
31
  // https:/
32
32
 
33
33
  if (start === 'http://' || start === 'https:/') {
34
34
  // download template
35
- var opt = {};
35
+ let opt = {};
36
36
  opt.url = body;
37
37
  opt.method = 'GET';
38
38
  opt.callback = function(err, response) {
@@ -67,9 +67,11 @@ exports.render = function(body, model, $) {
67
67
  } else if (body[0] === '#') {
68
68
  // plugins
69
69
  body = PATH.plugins(body.substring(1));
70
+ if (!body.includes('.html'))
71
+ body += '.html';
70
72
  } else {
71
73
  body = F.path.templates(body);
72
- if (body.indexOf('.html') === -1)
74
+ if (!body.includes('.html'))
73
75
  body += '.html';
74
76
  }
75
77
 
@@ -120,11 +122,11 @@ function parse(body, $) {
120
122
  if ($ && $.language != null)
121
123
  body = F.translate($.language, body);
122
124
 
123
- var helpers = {};
124
- var model = EMPTYOBJECT;
125
- var strhelpers = '';
126
- var beg = body.indexOf('<scr' + 'ipt>');
127
- var end;
125
+ let helpers = {};
126
+ let model = EMPTYOBJECT;
127
+ let strhelpers = '';
128
+ let beg = body.indexOf('<scr' + 'ipt>');
129
+ let end;
128
130
 
129
131
  // helpers
130
132
  if (beg !== -1) {
@@ -144,7 +146,7 @@ function parse(body, $) {
144
146
  if (strhelpers)
145
147
  new Function('Thelpers', strhelpers)(helpers);
146
148
 
147
- var output = {};
149
+ let output = {};
148
150
  output.helpers = helpers;
149
151
  output.template = Tangular.compile(body);
150
152
  output.model = model;