build: enable JS semicolons (#22783)
This commit is contained in:
parent
24e21467b9
commit
5d657dece4
354 changed files with 21512 additions and 21510 deletions
|
@ -1,10 +1,10 @@
|
|||
import * as util from 'util'
|
||||
import * as util from 'util';
|
||||
|
||||
import { electronBindingSetup } from '@electron/internal/common/electron-binding-setup'
|
||||
import { electronBindingSetup } from '@electron/internal/common/electron-binding-setup';
|
||||
|
||||
const timers = require('timers')
|
||||
const timers = require('timers');
|
||||
|
||||
process.electronBinding = electronBindingSetup(process._linkedBinding, process.type)
|
||||
process.electronBinding = electronBindingSetup(process._linkedBinding, process.type);
|
||||
|
||||
type AnyFn = (...args: any[]) => any
|
||||
|
||||
|
@ -17,11 +17,11 @@ type AnyFn = (...args: any[]) => any
|
|||
const wrapWithActivateUvLoop = function <T extends AnyFn> (func: T): T {
|
||||
return wrap(func, function (func) {
|
||||
return function (this: any, ...args: any[]) {
|
||||
process.activateUvLoop()
|
||||
return func.apply(this, args)
|
||||
}
|
||||
}) as T
|
||||
}
|
||||
process.activateUvLoop();
|
||||
return func.apply(this, args);
|
||||
};
|
||||
}) as T;
|
||||
};
|
||||
|
||||
/**
|
||||
* Casts to any below for func are due to Typescript not supporting symbols
|
||||
|
@ -30,41 +30,41 @@ const wrapWithActivateUvLoop = function <T extends AnyFn> (func: T): T {
|
|||
* Refs: https://github.com/Microsoft/TypeScript/issues/1863
|
||||
*/
|
||||
function wrap <T extends AnyFn> (func: T, wrapper: (fn: AnyFn) => T) {
|
||||
const wrapped = wrapper(func)
|
||||
const wrapped = wrapper(func);
|
||||
if ((func as any)[util.promisify.custom]) {
|
||||
(wrapped as any)[util.promisify.custom] = wrapper((func as any)[util.promisify.custom])
|
||||
(wrapped as any)[util.promisify.custom] = wrapper((func as any)[util.promisify.custom]);
|
||||
}
|
||||
return wrapped
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
process.nextTick = wrapWithActivateUvLoop(process.nextTick)
|
||||
process.nextTick = wrapWithActivateUvLoop(process.nextTick);
|
||||
|
||||
global.setImmediate = timers.setImmediate = wrapWithActivateUvLoop(timers.setImmediate)
|
||||
global.clearImmediate = timers.clearImmediate
|
||||
global.setImmediate = timers.setImmediate = wrapWithActivateUvLoop(timers.setImmediate);
|
||||
global.clearImmediate = timers.clearImmediate;
|
||||
|
||||
// setTimeout needs to update the polling timeout of the event loop, when
|
||||
// called under Chromium's event loop the node's event loop won't get a chance
|
||||
// to update the timeout, so we have to force the node's event loop to
|
||||
// recalculate the timeout in browser process.
|
||||
timers.setTimeout = wrapWithActivateUvLoop(timers.setTimeout)
|
||||
timers.setInterval = wrapWithActivateUvLoop(timers.setInterval)
|
||||
timers.setTimeout = wrapWithActivateUvLoop(timers.setTimeout);
|
||||
timers.setInterval = wrapWithActivateUvLoop(timers.setInterval);
|
||||
|
||||
// Only override the global setTimeout/setInterval impls in the browser process
|
||||
if (process.type === 'browser') {
|
||||
global.setTimeout = timers.setTimeout
|
||||
global.setInterval = timers.setInterval
|
||||
global.setTimeout = timers.setTimeout;
|
||||
global.setInterval = timers.setInterval;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Always returns EOF for stdin stream.
|
||||
const { Readable } = require('stream')
|
||||
const stdin = new Readable()
|
||||
stdin.push(null)
|
||||
const { Readable } = require('stream');
|
||||
const stdin = new Readable();
|
||||
stdin.push(null);
|
||||
Object.defineProperty(process, 'stdin', {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
get () {
|
||||
return stdin
|
||||
return stdin;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue