Compare commits
1 Commits
vscode-1.4
...
hotswap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cbc753cbb |
File diff suppressed because it is too large
Load Diff
Submodule lib/vscode updated: db40434f56...17299e413d
@@ -2,12 +2,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script>
|
|
||||||
globalThis.MonacoPerformanceMarks = globalThis.MonacoPerformanceMarks || [];
|
|
||||||
globalThis.MonacoPerformanceMarks.push('renderer/started', Date.now());
|
|
||||||
</script>
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
|
<meta
|
||||||
|
http-equiv="Content-Security-Policy"
|
||||||
|
content="font-src 'self' data:; connect-src ws: wss: 'self' https:; default-src ws: wss: 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; img-src 'self' data: https:;"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Disable pinch zooming -->
|
<!-- Disable pinch zooming -->
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
@@ -69,7 +70,6 @@
|
|||||||
}
|
}
|
||||||
self.require = {
|
self.require = {
|
||||||
baseUrl: "{{CS_STATIC_BASE}}/lib/vscode/out",
|
baseUrl: "{{CS_STATIC_BASE}}/lib/vscode/out",
|
||||||
recordStats: true,
|
|
||||||
paths: {
|
paths: {
|
||||||
"vscode-textmate": `../node_modules/vscode-textmate/release/main`,
|
"vscode-textmate": `../node_modules/vscode-textmate/release/main`,
|
||||||
"vscode-oniguruma": `../node_modules/vscode-oniguruma/release/main`,
|
"vscode-oniguruma": `../node_modules/vscode-oniguruma/release/main`,
|
||||||
@@ -86,9 +86,6 @@
|
|||||||
</script>
|
</script>
|
||||||
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/dist/register.js"></script>
|
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/dist/register.js"></script>
|
||||||
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
|
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script>
|
||||||
<script>
|
|
||||||
globalThis.MonacoPerformanceMarks.push('willLoadWorkbenchMain', Date.now());
|
|
||||||
</script>
|
|
||||||
<!-- PROD_ONLY
|
<!-- PROD_ONLY
|
||||||
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.nls.js"></script>
|
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.nls.js"></script>
|
||||||
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.js"></script>
|
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.js"></script>
|
||||||
|
|||||||
@@ -125,11 +125,7 @@ const options: Options<Required<Args>> = {
|
|||||||
"extra-builtin-extensions-dir": { type: "string[]", path: true },
|
"extra-builtin-extensions-dir": { type: "string[]", path: true },
|
||||||
"list-extensions": { type: "boolean", description: "List installed VS Code extensions." },
|
"list-extensions": { type: "boolean", description: "List installed VS Code extensions." },
|
||||||
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
|
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
|
||||||
"install-extension": {
|
"install-extension": { type: "string[]", description: "Install or update a VS Code extension by id or vsix." },
|
||||||
type: "string[]",
|
|
||||||
description:
|
|
||||||
"Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.",
|
|
||||||
},
|
|
||||||
"uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." },
|
"uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." },
|
||||||
"show-versions": { type: "boolean", description: "Show VS Code extension versions." },
|
"show-versions": { type: "boolean", description: "Show VS Code extension versions." },
|
||||||
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
|
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class IpcMain {
|
|||||||
public readonly onMessage = this._onMessage.event
|
public readonly onMessage = this._onMessage.event
|
||||||
private readonly _onDispose = new Emitter<NodeJS.Signals | undefined>()
|
private readonly _onDispose = new Emitter<NodeJS.Signals | undefined>()
|
||||||
public readonly onDispose = this._onDispose.event
|
public readonly onDispose = this._onDispose.event
|
||||||
public readonly exit: (code?: number) => never
|
public readonly processExit: (code?: number) => never
|
||||||
|
|
||||||
public constructor(public readonly parentPid?: number) {
|
public constructor(public readonly parentPid?: number) {
|
||||||
process.on("SIGINT", () => this._onDispose.emit("SIGINT"))
|
process.on("SIGINT", () => this._onDispose.emit("SIGINT"))
|
||||||
@@ -40,7 +40,7 @@ export class IpcMain {
|
|||||||
process.on("exit", () => this._onDispose.emit(undefined))
|
process.on("exit", () => this._onDispose.emit(undefined))
|
||||||
|
|
||||||
// Ensure we control when the process exits.
|
// Ensure we control when the process exits.
|
||||||
this.exit = process.exit
|
this.processExit = process.exit
|
||||||
process.exit = function (code?: number) {
|
process.exit = function (code?: number) {
|
||||||
logger.warn(`process.exit() was prevented: ${code || "unknown code"}.`)
|
logger.warn(`process.exit() was prevented: ${code || "unknown code"}.`)
|
||||||
} as (code?: number) => never
|
} as (code?: number) => never
|
||||||
@@ -71,6 +71,14 @@ export class IpcMain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public exit(error?: number | ProcessError): never {
|
||||||
|
if (error && typeof error !== "number") {
|
||||||
|
this.processExit(typeof error.code === "number" ? error.code : 1)
|
||||||
|
} else {
|
||||||
|
this.processExit(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public handshake(child?: cp.ChildProcess): Promise<void> {
|
public handshake(child?: cp.ChildProcess): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const target = child || process
|
const target = child || process
|
||||||
@@ -161,28 +169,37 @@ export class WrapperProcess {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain().onMessage(async (message) => {
|
ipcMain().onMessage((message) => {
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case "relaunch":
|
case "relaunch":
|
||||||
logger.info(`Relaunching: ${this.currentVersion} -> ${message.version}`)
|
logger.info(`Relaunching: ${this.currentVersion} -> ${message.version}`)
|
||||||
this.currentVersion = message.version
|
this.currentVersion = message.version
|
||||||
this.started = undefined
|
this.relaunch()
|
||||||
if (this.process) {
|
|
||||||
this.process.removeAllListeners()
|
|
||||||
this.process.kill()
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await this.start()
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(error.message)
|
|
||||||
ipcMain().exit(typeof error.code === "number" ? error.code : 1)
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
logger.error(`Unrecognized message ${message}`)
|
logger.error(`Unrecognized message ${message}`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
process.on("SIGUSR1", async () => {
|
||||||
|
logger.info("Received SIGUSR1; hotswapping")
|
||||||
|
this.relaunch()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private async relaunch(): Promise<void> {
|
||||||
|
this.started = undefined
|
||||||
|
if (this.process) {
|
||||||
|
this.process.removeAllListeners()
|
||||||
|
this.process.kill()
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await this.start()
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error.message)
|
||||||
|
ipcMain().exit(typeof error.code === "number" ? error.code : 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public start(): Promise<void> {
|
public start(): Promise<void> {
|
||||||
@@ -244,13 +261,13 @@ export const wrap = (fn: () => Promise<void>): void => {
|
|||||||
.then(() => fn())
|
.then(() => fn())
|
||||||
.catch((error: ProcessError): void => {
|
.catch((error: ProcessError): void => {
|
||||||
logger.error(error.message)
|
logger.error(error.message)
|
||||||
ipcMain().exit(typeof error.code === "number" ? error.code : 1)
|
ipcMain().exit(error)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const wrapper = new WrapperProcess(require("../../package.json").version)
|
const wrapper = new WrapperProcess(require("../../package.json").version)
|
||||||
wrapper.start().catch((error) => {
|
wrapper.start().catch((error) => {
|
||||||
logger.error(error.message)
|
logger.error(error.message)
|
||||||
ipcMain().exit(typeof error.code === "number" ? error.code : 1)
|
ipcMain().exit(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user