mol_plot_all 1.2.1174 → 1.2.1175
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 +138 -91
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +143 -16
- package/node.js.map +1 -1
- package/node.mjs +143 -16
- package/node.test.js +258 -96
- package/node.test.js.map +1 -1
- package/package.json +4 -1
- package/web.d.ts +90 -90
- package/web.deps.json +1 -1
package/node.js
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
|
})($ || ($ = {}));
|