mol_dump_lib 0.0.492 → 0.0.494
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/node.d.ts +100 -63
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +143 -42
- package/node.js.map +1 -1
- package/node.mjs +143 -42
- package/node.test.js +258 -96
- package/node.test.js.map +1 -1
- package/package.json +4 -2
- package/web.d.ts +52 -52
- package/web.deps.json +1 -1
package/node.mjs
CHANGED
|
@@ -2034,6 +2034,36 @@ require = (req => Object.assign(function require(name) {
|
|
|
2034
2034
|
return $node[name];
|
|
2035
2035
|
}, req))(require);
|
|
2036
2036
|
|
|
2037
|
+
;
|
|
2038
|
+
"use strict";
|
|
2039
|
+
var $;
|
|
2040
|
+
(function ($) {
|
|
2041
|
+
class $mol_error_mix extends AggregateError {
|
|
2042
|
+
cause;
|
|
2043
|
+
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
|
2044
|
+
constructor(message, cause = {}, ...errors) {
|
|
2045
|
+
super(errors, message, { cause });
|
|
2046
|
+
this.cause = cause;
|
|
2047
|
+
const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
|
|
2048
|
+
Object.defineProperty(this, 'stack', {
|
|
2049
|
+
get: () => (stack_get.call(this) ?? this.message) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
|
|
2050
|
+
.replace(/at /gm, ' at ')
|
|
2051
|
+
.replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
static [Symbol.toPrimitive]() {
|
|
2055
|
+
return this.toString();
|
|
2056
|
+
}
|
|
2057
|
+
static toString() {
|
|
2058
|
+
return $$.$mol_func_name(this);
|
|
2059
|
+
}
|
|
2060
|
+
static make(...params) {
|
|
2061
|
+
return new this(...params);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
$.$mol_error_mix = $mol_error_mix;
|
|
2065
|
+
})($ || ($ = {}));
|
|
2066
|
+
|
|
2037
2067
|
;
|
|
2038
2068
|
"use strict";
|
|
2039
2069
|
var $;
|
|
@@ -2057,26 +2087,123 @@ var $;
|
|
|
2057
2087
|
"use strict";
|
|
2058
2088
|
var $;
|
|
2059
2089
|
(function ($) {
|
|
2060
|
-
function $
|
|
2061
|
-
|
|
2062
|
-
|
|
2090
|
+
function $mol_wire_sync(obj) {
|
|
2091
|
+
return new Proxy(obj, {
|
|
2092
|
+
get(obj, field) {
|
|
2093
|
+
const val = obj[field];
|
|
2094
|
+
if (typeof val !== 'function')
|
|
2095
|
+
return val;
|
|
2096
|
+
const temp = $mol_wire_task.getter(val);
|
|
2097
|
+
return function $mol_wire_sync(...args) {
|
|
2098
|
+
const fiber = temp(obj, args);
|
|
2099
|
+
return fiber.sync();
|
|
2100
|
+
};
|
|
2101
|
+
},
|
|
2102
|
+
apply(obj, self, args) {
|
|
2103
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2104
|
+
const fiber = temp(self, args);
|
|
2105
|
+
return fiber.sync();
|
|
2106
|
+
},
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
2110
|
+
})($ || ($ = {}));
|
|
2111
|
+
|
|
2112
|
+
;
|
|
2113
|
+
"use strict";
|
|
2114
|
+
var $;
|
|
2115
|
+
(function ($) {
|
|
2116
|
+
class $mol_run_error extends $mol_error_mix {
|
|
2117
|
+
}
|
|
2118
|
+
$.$mol_run_error = $mol_run_error;
|
|
2119
|
+
const child_process = $node['child_process'];
|
|
2120
|
+
$.$mol_run_spawn = child_process.spawn.bind(child_process);
|
|
2121
|
+
function $mol_run_async({ dir, timeout, command, env }) {
|
|
2122
|
+
const args_raw = typeof command === 'string' ? command.split(' ') : command;
|
|
2123
|
+
const [app, ...args] = args_raw;
|
|
2124
|
+
const sub = this.$mol_run_spawn(app, args, {
|
|
2125
|
+
shell: true,
|
|
2126
|
+
cwd: dir,
|
|
2127
|
+
env
|
|
2128
|
+
});
|
|
2063
2129
|
this.$mol_log3_come({
|
|
2064
|
-
place: '$
|
|
2065
|
-
|
|
2130
|
+
place: '$mol_run_async',
|
|
2131
|
+
pid: sub.pid,
|
|
2066
2132
|
message: 'Run',
|
|
2067
|
-
command:
|
|
2133
|
+
command: args_raw.join(' '),
|
|
2134
|
+
dir: $node.path.relative('', dir),
|
|
2068
2135
|
});
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2136
|
+
let killed = false;
|
|
2137
|
+
let timer;
|
|
2138
|
+
const std_data = [];
|
|
2139
|
+
const error_data = [];
|
|
2140
|
+
const add = (std_chunk, error_chunk) => {
|
|
2141
|
+
if (std_chunk)
|
|
2142
|
+
std_data.push(std_chunk);
|
|
2143
|
+
if (error_chunk)
|
|
2144
|
+
error_data.push(error_chunk);
|
|
2145
|
+
if (!timeout)
|
|
2146
|
+
return;
|
|
2147
|
+
clearTimeout(timer);
|
|
2148
|
+
timer = setTimeout(() => {
|
|
2149
|
+
const signal = killed ? 'SIGKILL' : 'SIGTERM';
|
|
2150
|
+
killed = true;
|
|
2151
|
+
add();
|
|
2152
|
+
sub.kill(signal);
|
|
2153
|
+
}, timeout);
|
|
2154
|
+
};
|
|
2155
|
+
add();
|
|
2156
|
+
sub.stdout?.on('data', data => add(data));
|
|
2157
|
+
sub.stderr?.on('data', data => add(undefined, data));
|
|
2158
|
+
const promise = new Promise((done, fail) => {
|
|
2159
|
+
const close = (error, status = null, signal = null) => {
|
|
2160
|
+
if (!timer && timeout)
|
|
2161
|
+
return;
|
|
2162
|
+
clearTimeout(timer);
|
|
2163
|
+
timer = undefined;
|
|
2164
|
+
const res = {
|
|
2165
|
+
pid: sub.pid,
|
|
2166
|
+
status,
|
|
2167
|
+
signal,
|
|
2168
|
+
get stdout() { return Buffer.concat(std_data); },
|
|
2169
|
+
get stderr() { return Buffer.concat(error_data); }
|
|
2170
|
+
};
|
|
2171
|
+
this.$mol_log3_done({
|
|
2172
|
+
place: '$mol_run_async',
|
|
2173
|
+
pid: sub.pid,
|
|
2174
|
+
message: 'Run',
|
|
2175
|
+
status,
|
|
2176
|
+
command: args_raw.join(' '),
|
|
2177
|
+
dir: $node.path.relative('', dir),
|
|
2178
|
+
});
|
|
2179
|
+
if (error || status || killed)
|
|
2180
|
+
return fail(new $mol_run_error((res.stderr.toString() || res.stdout.toString() || 'Run error') + (killed ? ', timeout' : ''), { signal, timeout: killed }, ...error ? [error] : []));
|
|
2181
|
+
done(res);
|
|
2182
|
+
};
|
|
2183
|
+
sub.on('disconnect', () => close(new Error('Disconnected')));
|
|
2184
|
+
sub.on('error', err => close(err));
|
|
2185
|
+
sub.on('exit', (status, signal) => close(null, status, signal));
|
|
2073
2186
|
});
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2187
|
+
return Object.assign(promise, { destructor: () => {
|
|
2188
|
+
clearTimeout(timer);
|
|
2189
|
+
sub.kill('SIGKILL');
|
|
2190
|
+
} });
|
|
2191
|
+
}
|
|
2192
|
+
$.$mol_run_async = $mol_run_async;
|
|
2193
|
+
function $mol_run(options) {
|
|
2194
|
+
if (!options.env)
|
|
2195
|
+
options = { ...options, env: this.$mol_env() };
|
|
2196
|
+
return $mol_wire_sync(this).$mol_run_async(options);
|
|
2197
|
+
}
|
|
2198
|
+
$.$mol_run = $mol_run;
|
|
2199
|
+
})($ || ($ = {}));
|
|
2200
|
+
|
|
2201
|
+
;
|
|
2202
|
+
"use strict";
|
|
2203
|
+
var $;
|
|
2204
|
+
(function ($) {
|
|
2205
|
+
function $mol_exec(dir, command, ...args) {
|
|
2206
|
+
return this.$mol_run({ command: [command, ...args], dir });
|
|
2080
2207
|
}
|
|
2081
2208
|
$.$mol_exec = $mol_exec;
|
|
2082
2209
|
})($ || ($ = {}));
|
|
@@ -5018,32 +5145,6 @@ var $;
|
|
|
5018
5145
|
$.$mol_html_encode = $mol_html_encode;
|
|
5019
5146
|
})($ || ($ = {}));
|
|
5020
5147
|
|
|
5021
|
-
;
|
|
5022
|
-
"use strict";
|
|
5023
|
-
var $;
|
|
5024
|
-
(function ($) {
|
|
5025
|
-
function $mol_wire_sync(obj) {
|
|
5026
|
-
return new Proxy(obj, {
|
|
5027
|
-
get(obj, field) {
|
|
5028
|
-
const val = obj[field];
|
|
5029
|
-
if (typeof val !== 'function')
|
|
5030
|
-
return val;
|
|
5031
|
-
const temp = $mol_wire_task.getter(val);
|
|
5032
|
-
return function $mol_wire_sync(...args) {
|
|
5033
|
-
const fiber = temp(obj, args);
|
|
5034
|
-
return fiber.sync();
|
|
5035
|
-
};
|
|
5036
|
-
},
|
|
5037
|
-
apply(obj, self, args) {
|
|
5038
|
-
const temp = $mol_wire_task.getter(obj);
|
|
5039
|
-
const fiber = temp(self, args);
|
|
5040
|
-
return fiber.sync();
|
|
5041
|
-
},
|
|
5042
|
-
});
|
|
5043
|
-
}
|
|
5044
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
5045
|
-
})($ || ($ = {}));
|
|
5046
|
-
|
|
5047
5148
|
;
|
|
5048
5149
|
"use strict";
|
|
5049
5150
|
|
package/node.test.js
CHANGED
|
@@ -2025,6 +2025,36 @@ require = (req => Object.assign(function require(name) {
|
|
|
2025
2025
|
return $node[name];
|
|
2026
2026
|
}, req))(require);
|
|
2027
2027
|
|
|
2028
|
+
;
|
|
2029
|
+
"use strict";
|
|
2030
|
+
var $;
|
|
2031
|
+
(function ($) {
|
|
2032
|
+
class $mol_error_mix extends AggregateError {
|
|
2033
|
+
cause;
|
|
2034
|
+
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
|
2035
|
+
constructor(message, cause = {}, ...errors) {
|
|
2036
|
+
super(errors, message, { cause });
|
|
2037
|
+
this.cause = cause;
|
|
2038
|
+
const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
|
|
2039
|
+
Object.defineProperty(this, 'stack', {
|
|
2040
|
+
get: () => (stack_get.call(this) ?? this.message) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
|
|
2041
|
+
.replace(/at /gm, ' at ')
|
|
2042
|
+
.replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
static [Symbol.toPrimitive]() {
|
|
2046
|
+
return this.toString();
|
|
2047
|
+
}
|
|
2048
|
+
static toString() {
|
|
2049
|
+
return $$.$mol_func_name(this);
|
|
2050
|
+
}
|
|
2051
|
+
static make(...params) {
|
|
2052
|
+
return new this(...params);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
$.$mol_error_mix = $mol_error_mix;
|
|
2056
|
+
})($ || ($ = {}));
|
|
2057
|
+
|
|
2028
2058
|
;
|
|
2029
2059
|
"use strict";
|
|
2030
2060
|
var $;
|
|
@@ -2048,26 +2078,123 @@ var $;
|
|
|
2048
2078
|
"use strict";
|
|
2049
2079
|
var $;
|
|
2050
2080
|
(function ($) {
|
|
2051
|
-
function $
|
|
2052
|
-
|
|
2053
|
-
|
|
2081
|
+
function $mol_wire_sync(obj) {
|
|
2082
|
+
return new Proxy(obj, {
|
|
2083
|
+
get(obj, field) {
|
|
2084
|
+
const val = obj[field];
|
|
2085
|
+
if (typeof val !== 'function')
|
|
2086
|
+
return val;
|
|
2087
|
+
const temp = $mol_wire_task.getter(val);
|
|
2088
|
+
return function $mol_wire_sync(...args) {
|
|
2089
|
+
const fiber = temp(obj, args);
|
|
2090
|
+
return fiber.sync();
|
|
2091
|
+
};
|
|
2092
|
+
},
|
|
2093
|
+
apply(obj, self, args) {
|
|
2094
|
+
const temp = $mol_wire_task.getter(obj);
|
|
2095
|
+
const fiber = temp(self, args);
|
|
2096
|
+
return fiber.sync();
|
|
2097
|
+
},
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
2101
|
+
})($ || ($ = {}));
|
|
2102
|
+
|
|
2103
|
+
;
|
|
2104
|
+
"use strict";
|
|
2105
|
+
var $;
|
|
2106
|
+
(function ($) {
|
|
2107
|
+
class $mol_run_error extends $mol_error_mix {
|
|
2108
|
+
}
|
|
2109
|
+
$.$mol_run_error = $mol_run_error;
|
|
2110
|
+
const child_process = $node['child_process'];
|
|
2111
|
+
$.$mol_run_spawn = child_process.spawn.bind(child_process);
|
|
2112
|
+
function $mol_run_async({ dir, timeout, command, env }) {
|
|
2113
|
+
const args_raw = typeof command === 'string' ? command.split(' ') : command;
|
|
2114
|
+
const [app, ...args] = args_raw;
|
|
2115
|
+
const sub = this.$mol_run_spawn(app, args, {
|
|
2116
|
+
shell: true,
|
|
2117
|
+
cwd: dir,
|
|
2118
|
+
env
|
|
2119
|
+
});
|
|
2054
2120
|
this.$mol_log3_come({
|
|
2055
|
-
place: '$
|
|
2056
|
-
|
|
2121
|
+
place: '$mol_run_async',
|
|
2122
|
+
pid: sub.pid,
|
|
2057
2123
|
message: 'Run',
|
|
2058
|
-
command:
|
|
2124
|
+
command: args_raw.join(' '),
|
|
2125
|
+
dir: $node.path.relative('', dir),
|
|
2059
2126
|
});
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2127
|
+
let killed = false;
|
|
2128
|
+
let timer;
|
|
2129
|
+
const std_data = [];
|
|
2130
|
+
const error_data = [];
|
|
2131
|
+
const add = (std_chunk, error_chunk) => {
|
|
2132
|
+
if (std_chunk)
|
|
2133
|
+
std_data.push(std_chunk);
|
|
2134
|
+
if (error_chunk)
|
|
2135
|
+
error_data.push(error_chunk);
|
|
2136
|
+
if (!timeout)
|
|
2137
|
+
return;
|
|
2138
|
+
clearTimeout(timer);
|
|
2139
|
+
timer = setTimeout(() => {
|
|
2140
|
+
const signal = killed ? 'SIGKILL' : 'SIGTERM';
|
|
2141
|
+
killed = true;
|
|
2142
|
+
add();
|
|
2143
|
+
sub.kill(signal);
|
|
2144
|
+
}, timeout);
|
|
2145
|
+
};
|
|
2146
|
+
add();
|
|
2147
|
+
sub.stdout?.on('data', data => add(data));
|
|
2148
|
+
sub.stderr?.on('data', data => add(undefined, data));
|
|
2149
|
+
const promise = new Promise((done, fail) => {
|
|
2150
|
+
const close = (error, status = null, signal = null) => {
|
|
2151
|
+
if (!timer && timeout)
|
|
2152
|
+
return;
|
|
2153
|
+
clearTimeout(timer);
|
|
2154
|
+
timer = undefined;
|
|
2155
|
+
const res = {
|
|
2156
|
+
pid: sub.pid,
|
|
2157
|
+
status,
|
|
2158
|
+
signal,
|
|
2159
|
+
get stdout() { return Buffer.concat(std_data); },
|
|
2160
|
+
get stderr() { return Buffer.concat(error_data); }
|
|
2161
|
+
};
|
|
2162
|
+
this.$mol_log3_done({
|
|
2163
|
+
place: '$mol_run_async',
|
|
2164
|
+
pid: sub.pid,
|
|
2165
|
+
message: 'Run',
|
|
2166
|
+
status,
|
|
2167
|
+
command: args_raw.join(' '),
|
|
2168
|
+
dir: $node.path.relative('', dir),
|
|
2169
|
+
});
|
|
2170
|
+
if (error || status || killed)
|
|
2171
|
+
return fail(new $mol_run_error((res.stderr.toString() || res.stdout.toString() || 'Run error') + (killed ? ', timeout' : ''), { signal, timeout: killed }, ...error ? [error] : []));
|
|
2172
|
+
done(res);
|
|
2173
|
+
};
|
|
2174
|
+
sub.on('disconnect', () => close(new Error('Disconnected')));
|
|
2175
|
+
sub.on('error', err => close(err));
|
|
2176
|
+
sub.on('exit', (status, signal) => close(null, status, signal));
|
|
2064
2177
|
});
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2178
|
+
return Object.assign(promise, { destructor: () => {
|
|
2179
|
+
clearTimeout(timer);
|
|
2180
|
+
sub.kill('SIGKILL');
|
|
2181
|
+
} });
|
|
2182
|
+
}
|
|
2183
|
+
$.$mol_run_async = $mol_run_async;
|
|
2184
|
+
function $mol_run(options) {
|
|
2185
|
+
if (!options.env)
|
|
2186
|
+
options = { ...options, env: this.$mol_env() };
|
|
2187
|
+
return $mol_wire_sync(this).$mol_run_async(options);
|
|
2188
|
+
}
|
|
2189
|
+
$.$mol_run = $mol_run;
|
|
2190
|
+
})($ || ($ = {}));
|
|
2191
|
+
|
|
2192
|
+
;
|
|
2193
|
+
"use strict";
|
|
2194
|
+
var $;
|
|
2195
|
+
(function ($) {
|
|
2196
|
+
function $mol_exec(dir, command, ...args) {
|
|
2197
|
+
return this.$mol_run({ command: [command, ...args], dir });
|
|
2071
2198
|
}
|
|
2072
2199
|
$.$mol_exec = $mol_exec;
|
|
2073
2200
|
})($ || ($ = {}));
|
|
@@ -5009,32 +5136,6 @@ var $;
|
|
|
5009
5136
|
$.$mol_html_encode = $mol_html_encode;
|
|
5010
5137
|
})($ || ($ = {}));
|
|
5011
5138
|
|
|
5012
|
-
;
|
|
5013
|
-
"use strict";
|
|
5014
|
-
var $;
|
|
5015
|
-
(function ($) {
|
|
5016
|
-
function $mol_wire_sync(obj) {
|
|
5017
|
-
return new Proxy(obj, {
|
|
5018
|
-
get(obj, field) {
|
|
5019
|
-
const val = obj[field];
|
|
5020
|
-
if (typeof val !== 'function')
|
|
5021
|
-
return val;
|
|
5022
|
-
const temp = $mol_wire_task.getter(val);
|
|
5023
|
-
return function $mol_wire_sync(...args) {
|
|
5024
|
-
const fiber = temp(obj, args);
|
|
5025
|
-
return fiber.sync();
|
|
5026
|
-
};
|
|
5027
|
-
},
|
|
5028
|
-
apply(obj, self, args) {
|
|
5029
|
-
const temp = $mol_wire_task.getter(obj);
|
|
5030
|
-
const fiber = temp(self, args);
|
|
5031
|
-
return fiber.sync();
|
|
5032
|
-
},
|
|
5033
|
-
});
|
|
5034
|
-
}
|
|
5035
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
5036
|
-
})($ || ($ = {}));
|
|
5037
|
-
|
|
5038
5139
|
;
|
|
5039
5140
|
"use strict";
|
|
5040
5141
|
|
|
@@ -6574,20 +6675,6 @@ var $;
|
|
|
6574
6675
|
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
6575
6676
|
})($ || ($ = {}));
|
|
6576
6677
|
|
|
6577
|
-
;
|
|
6578
|
-
"use strict";
|
|
6579
|
-
var $;
|
|
6580
|
-
(function ($_1) {
|
|
6581
|
-
$mol_test_mocks.push($ => {
|
|
6582
|
-
$.$mol_log3_come = () => { };
|
|
6583
|
-
$.$mol_log3_done = () => { };
|
|
6584
|
-
$.$mol_log3_fail = () => { };
|
|
6585
|
-
$.$mol_log3_warn = () => { };
|
|
6586
|
-
$.$mol_log3_rise = () => { };
|
|
6587
|
-
$.$mol_log3_area = () => () => { };
|
|
6588
|
-
});
|
|
6589
|
-
})($ || ($ = {}));
|
|
6590
|
-
|
|
6591
6678
|
;
|
|
6592
6679
|
"use strict";
|
|
6593
6680
|
|
|
@@ -7350,6 +7437,20 @@ var $;
|
|
|
7350
7437
|
});
|
|
7351
7438
|
})($ || ($ = {}));
|
|
7352
7439
|
|
|
7440
|
+
;
|
|
7441
|
+
"use strict";
|
|
7442
|
+
var $;
|
|
7443
|
+
(function ($_1) {
|
|
7444
|
+
$mol_test_mocks.push($ => {
|
|
7445
|
+
$.$mol_log3_come = () => { };
|
|
7446
|
+
$.$mol_log3_done = () => { };
|
|
7447
|
+
$.$mol_log3_fail = () => { };
|
|
7448
|
+
$.$mol_log3_warn = () => { };
|
|
7449
|
+
$.$mol_log3_rise = () => { };
|
|
7450
|
+
$.$mol_log3_area = () => () => { };
|
|
7451
|
+
});
|
|
7452
|
+
})($ || ($ = {}));
|
|
7453
|
+
|
|
7353
7454
|
;
|
|
7354
7455
|
"use strict";
|
|
7355
7456
|
var $;
|
|
@@ -7364,6 +7465,85 @@ var $;
|
|
|
7364
7465
|
});
|
|
7365
7466
|
})($ || ($ = {}));
|
|
7366
7467
|
|
|
7468
|
+
;
|
|
7469
|
+
"use strict";
|
|
7470
|
+
var $;
|
|
7471
|
+
(function ($) {
|
|
7472
|
+
$mol_test({
|
|
7473
|
+
'auto name'() {
|
|
7474
|
+
class Invalid extends $mol_error_mix {
|
|
7475
|
+
}
|
|
7476
|
+
const mix = new Invalid('foo');
|
|
7477
|
+
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
7478
|
+
},
|
|
7479
|
+
'simpe mix'() {
|
|
7480
|
+
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
|
|
7481
|
+
$mol_assert_equal(mix.message, 'foo');
|
|
7482
|
+
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
7483
|
+
},
|
|
7484
|
+
'provide additional info'() {
|
|
7485
|
+
class Invalid extends $mol_error_mix {
|
|
7486
|
+
}
|
|
7487
|
+
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
7488
|
+
const hints = [];
|
|
7489
|
+
if (mix instanceof $mol_error_mix) {
|
|
7490
|
+
for (const er of mix.errors) {
|
|
7491
|
+
if (er instanceof Invalid) {
|
|
7492
|
+
hints.push(er.cause?.hint ?? '');
|
|
7493
|
+
}
|
|
7494
|
+
}
|
|
7495
|
+
}
|
|
7496
|
+
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
7497
|
+
},
|
|
7498
|
+
});
|
|
7499
|
+
})($ || ($ = {}));
|
|
7500
|
+
|
|
7501
|
+
;
|
|
7502
|
+
"use strict";
|
|
7503
|
+
var $;
|
|
7504
|
+
(function ($_1) {
|
|
7505
|
+
$mol_test({
|
|
7506
|
+
'test types'($) {
|
|
7507
|
+
class A {
|
|
7508
|
+
static a() {
|
|
7509
|
+
return Promise.resolve('');
|
|
7510
|
+
}
|
|
7511
|
+
static b() {
|
|
7512
|
+
return $mol_wire_sync(this).a();
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
},
|
|
7516
|
+
});
|
|
7517
|
+
})($ || ($ = {}));
|
|
7518
|
+
|
|
7519
|
+
;
|
|
7520
|
+
"use strict";
|
|
7521
|
+
var $;
|
|
7522
|
+
(function ($_1) {
|
|
7523
|
+
$mol_test({
|
|
7524
|
+
async 'exec timeout auto kill child process'($) {
|
|
7525
|
+
let close_mock = () => { };
|
|
7526
|
+
const context_mock = $.$mol_ambient({
|
|
7527
|
+
$mol_run_spawn: () => ({
|
|
7528
|
+
on(name, cb) {
|
|
7529
|
+
if (name === 'exit')
|
|
7530
|
+
close_mock = cb;
|
|
7531
|
+
},
|
|
7532
|
+
kill() { close_mock(); }
|
|
7533
|
+
})
|
|
7534
|
+
});
|
|
7535
|
+
let message = '';
|
|
7536
|
+
try {
|
|
7537
|
+
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10 });
|
|
7538
|
+
}
|
|
7539
|
+
catch (e) {
|
|
7540
|
+
message = e.message;
|
|
7541
|
+
}
|
|
7542
|
+
$mol_assert_equal(message, 'Run error, timeout');
|
|
7543
|
+
}
|
|
7544
|
+
});
|
|
7545
|
+
})($ || ($ = {}));
|
|
7546
|
+
|
|
7367
7547
|
;
|
|
7368
7548
|
"use strict";
|
|
7369
7549
|
var $;
|
|
@@ -7611,25 +7791,6 @@ var $;
|
|
|
7611
7791
|
});
|
|
7612
7792
|
})($ || ($ = {}));
|
|
7613
7793
|
|
|
7614
|
-
;
|
|
7615
|
-
"use strict";
|
|
7616
|
-
var $;
|
|
7617
|
-
(function ($) {
|
|
7618
|
-
$mol_test({
|
|
7619
|
-
'init with overload'() {
|
|
7620
|
-
class X extends $mol_object {
|
|
7621
|
-
foo() {
|
|
7622
|
-
return 1;
|
|
7623
|
-
}
|
|
7624
|
-
}
|
|
7625
|
-
var x = X.make({
|
|
7626
|
-
foo: () => 2,
|
|
7627
|
-
});
|
|
7628
|
-
$mol_assert_equal(x.foo(), 2);
|
|
7629
|
-
},
|
|
7630
|
-
});
|
|
7631
|
-
})($ || ($ = {}));
|
|
7632
|
-
|
|
7633
7794
|
;
|
|
7634
7795
|
"use strict";
|
|
7635
7796
|
var $;
|
|
@@ -7817,9 +7978,6 @@ var $;
|
|
|
7817
7978
|
});
|
|
7818
7979
|
})($ || ($ = {}));
|
|
7819
7980
|
|
|
7820
|
-
;
|
|
7821
|
-
"use strict";
|
|
7822
|
-
|
|
7823
7981
|
;
|
|
7824
7982
|
"use strict";
|
|
7825
7983
|
var $;
|
|
@@ -7848,24 +8006,6 @@ var $;
|
|
|
7848
8006
|
});
|
|
7849
8007
|
})($ || ($ = {}));
|
|
7850
8008
|
|
|
7851
|
-
;
|
|
7852
|
-
"use strict";
|
|
7853
|
-
var $;
|
|
7854
|
-
(function ($_1) {
|
|
7855
|
-
$mol_test({
|
|
7856
|
-
'test types'($) {
|
|
7857
|
-
class A {
|
|
7858
|
-
static a() {
|
|
7859
|
-
return Promise.resolve('');
|
|
7860
|
-
}
|
|
7861
|
-
static b() {
|
|
7862
|
-
return $mol_wire_sync(this).a();
|
|
7863
|
-
}
|
|
7864
|
-
}
|
|
7865
|
-
},
|
|
7866
|
-
});
|
|
7867
|
-
})($ || ($ = {}));
|
|
7868
|
-
|
|
7869
8009
|
;
|
|
7870
8010
|
"use strict";
|
|
7871
8011
|
var $;
|
|
@@ -7937,6 +8077,28 @@ var $;
|
|
|
7937
8077
|
});
|
|
7938
8078
|
})($ || ($ = {}));
|
|
7939
8079
|
|
|
8080
|
+
;
|
|
8081
|
+
"use strict";
|
|
8082
|
+
var $;
|
|
8083
|
+
(function ($) {
|
|
8084
|
+
$mol_test({
|
|
8085
|
+
'init with overload'() {
|
|
8086
|
+
class X extends $mol_object {
|
|
8087
|
+
foo() {
|
|
8088
|
+
return 1;
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
8091
|
+
var x = X.make({
|
|
8092
|
+
foo: () => 2,
|
|
8093
|
+
});
|
|
8094
|
+
$mol_assert_equal(x.foo(), 2);
|
|
8095
|
+
},
|
|
8096
|
+
});
|
|
8097
|
+
})($ || ($ = {}));
|
|
8098
|
+
|
|
8099
|
+
;
|
|
8100
|
+
"use strict";
|
|
8101
|
+
|
|
7940
8102
|
;
|
|
7941
8103
|
"use strict";
|
|
7942
8104
|
var $;
|