@lvce-editor/main-process 6.31.0 → 6.32.1
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/README.md +8 -0
- package/dist/mainProcessMain.js +18 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,3 +15,11 @@ npx electron --wait src/profile.js
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
This will create a `profile.cpuprofile` file, which can be loaded inside the chrome devtools performance panel.
|
|
18
|
+
|
|
19
|
+
## Benchmarking application startup
|
|
20
|
+
|
|
21
|
+
Use `--wait-10-seconds` to keep the application attached to the terminal and quit it after 10 seconds:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
time lvce --wait-10-seconds
|
|
25
|
+
```
|
package/dist/mainProcessMain.js
CHANGED
|
@@ -3680,6 +3680,7 @@ const isPackagedDeb = () => {
|
|
|
3680
3680
|
const Version = 'version';
|
|
3681
3681
|
const Help = 'help';
|
|
3682
3682
|
const Wait = 'wait';
|
|
3683
|
+
const Wait10Seconds = 'wait-10-seconds';
|
|
3683
3684
|
const BuiltinSelfTest = 'built-in-self-test';
|
|
3684
3685
|
const Web = 'web';
|
|
3685
3686
|
const SandBox = 'sandbox';
|
|
@@ -4044,7 +4045,7 @@ const parseCliArgs = argv => {
|
|
|
4044
4045
|
alias: {
|
|
4045
4046
|
version: 'v'
|
|
4046
4047
|
},
|
|
4047
|
-
boolean: [Version, Help, Wait, BuiltinSelfTest, Web, SandBox],
|
|
4048
|
+
boolean: [Version, Help, Wait, Wait10Seconds, BuiltinSelfTest, Web, SandBox],
|
|
4048
4049
|
default: {
|
|
4049
4050
|
sandbox: true
|
|
4050
4051
|
},
|
|
@@ -4218,6 +4219,15 @@ const requestSingleInstanceLock = argv => {
|
|
|
4218
4219
|
return app.requestSingleInstanceLock(argv);
|
|
4219
4220
|
};
|
|
4220
4221
|
|
|
4222
|
+
const exitDelay = 10_000;
|
|
4223
|
+
const schedule = parsedCliArgs => {
|
|
4224
|
+
if (!parsedCliArgs[Wait10Seconds]) {
|
|
4225
|
+
return false;
|
|
4226
|
+
}
|
|
4227
|
+
setTimeout(exit, exitDelay);
|
|
4228
|
+
return true;
|
|
4229
|
+
};
|
|
4230
|
+
|
|
4221
4231
|
// TODO maybe handle critical (first render) request via ipcMain
|
|
4222
4232
|
// and spawn shared process when page is idle/loaded
|
|
4223
4233
|
// currently launching shared process takes 170ms
|
|
@@ -4254,9 +4264,10 @@ const hydrate = async argv => {
|
|
|
4254
4264
|
return;
|
|
4255
4265
|
}
|
|
4256
4266
|
}
|
|
4267
|
+
const hasTimedExit = schedule(parsedCliArgs);
|
|
4257
4268
|
|
|
4258
4269
|
// TODO tree shake out the .env.DEV check: reading from env variables is expensive
|
|
4259
|
-
if (process.stdout.isTTY && !parsedCliArgs.wait && !isPromptMode$1 && !process.env.DEV) {
|
|
4270
|
+
if (process.stdout.isTTY && !parsedCliArgs.wait && !hasTimedExit && !isPromptMode$1 && !process.env.DEV) {
|
|
4260
4271
|
spawn(execPath, argv.slice(1), {
|
|
4261
4272
|
detached: true,
|
|
4262
4273
|
stdio: 'ignore'
|
|
@@ -5782,24 +5793,11 @@ const showMessageBox = async ({
|
|
|
5782
5793
|
|
|
5783
5794
|
const getJson = async url => {
|
|
5784
5795
|
string(url);
|
|
5785
|
-
const
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
await new Promise(resolve => {
|
|
5791
|
-
request.on('response', response => {
|
|
5792
|
-
response.on('data', chunk => {
|
|
5793
|
-
body += chunk.toString();
|
|
5794
|
-
});
|
|
5795
|
-
response.on('end', () => {
|
|
5796
|
-
resolve(undefined);
|
|
5797
|
-
});
|
|
5798
|
-
});
|
|
5799
|
-
request.end();
|
|
5800
|
-
});
|
|
5801
|
-
const json = JSON.parse(body);
|
|
5802
|
-
return json;
|
|
5796
|
+
const response = await net.fetch(url);
|
|
5797
|
+
if (!response.ok) {
|
|
5798
|
+
throw new Error(`Failed to fetch JSON: ${response.status} ${response.statusText}`);
|
|
5799
|
+
}
|
|
5800
|
+
return response.json();
|
|
5803
5801
|
};
|
|
5804
5802
|
|
|
5805
5803
|
const startLogging = async path => {
|