refactor: use node scheme imports in default_app (#38847)
This commit is contained in:
parent
a595044989
commit
6bd02bf181
3 changed files with 16 additions and 8 deletions
8
default_app/.eslintrc.json
Normal file
8
default_app/.eslintrc.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"unicorn"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"unicorn/prefer-node-protocol": "error"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import { shell } from 'electron/common';
|
import { shell } from 'electron/common';
|
||||||
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
|
||||||
import * as path from 'path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'url';
|
import * as url from 'node:url';
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow | null = null;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as electron from 'electron/main';
|
import * as electron from 'electron/main';
|
||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'path';
|
import * as path from 'node:path';
|
||||||
import * as url from 'url';
|
import * as url from 'node:url';
|
||||||
const { app, dialog } = electron;
|
const { app, dialog } = electron;
|
||||||
|
|
||||||
type DefaultAppOptions = {
|
type DefaultAppOptions = {
|
||||||
|
@ -15,7 +15,7 @@ type DefaultAppOptions = {
|
||||||
modules: string[];
|
modules: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const Module = require('module');
|
const Module = require('node:module');
|
||||||
|
|
||||||
// Parse command line options.
|
// Parse command line options.
|
||||||
const argv = process.argv.slice(1);
|
const argv = process.argv.slice(1);
|
||||||
|
@ -112,7 +112,7 @@ function loadApplicationPackage (packagePath: string) {
|
||||||
// Set v8 flags, deliberately lazy load so that apps that do not use this
|
// Set v8 flags, deliberately lazy load so that apps that do not use this
|
||||||
// feature do not pay the price
|
// feature do not pay the price
|
||||||
if (packageJson.v8Flags) {
|
if (packageJson.v8Flags) {
|
||||||
require('v8').setFlagsFromString(packageJson.v8Flags);
|
require('node:v8').setFlagsFromString(packageJson.v8Flags);
|
||||||
}
|
}
|
||||||
appPath = packagePath;
|
appPath = packagePath;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ function startRepl () {
|
||||||
Using: Node.js ${nodeVersion} and Electron.js ${electronVersion}
|
Using: Node.js ${nodeVersion} and Electron.js ${electronVersion}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const { REPLServer } = require('repl');
|
const { REPLServer } = require('node:repl');
|
||||||
const repl = new REPLServer({
|
const repl = new REPLServer({
|
||||||
prompt: '> '
|
prompt: '> '
|
||||||
}).on('exit', () => {
|
}).on('exit', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue