From 626f46f75a848cf9641ae40f0c82aa1a81d64e64 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 17 Jul 2023 10:30:53 +0200 Subject: [PATCH] refactor: use node scheme imports in docs/fiddles (#39110) --- docs/fiddles/features/dark-mode/main.js | 2 +- docs/fiddles/features/drag-and-drop/main.js | 6 +++--- docs/fiddles/features/offscreen-rendering/main.js | 4 ++-- docs/fiddles/features/recent-documents/main.js | 4 ++-- docs/fiddles/features/represented-file/main.js | 2 +- docs/fiddles/features/web-bluetooth/main.js | 2 +- docs/fiddles/ipc/pattern-1/main.js | 2 +- docs/fiddles/ipc/pattern-2/main.js | 2 +- docs/fiddles/ipc/pattern-3/main.js | 2 +- docs/fiddles/ipc/webview-new-window/main.js | 2 +- docs/fiddles/media/screenshot/take-screenshot/renderer.js | 6 +++--- .../path-in-file-manager/renderer.js | 2 +- .../native-ui/external-links-file-manager/renderer.js | 2 +- docs/fiddles/quick-start/main.js | 2 +- docs/fiddles/system/clipboard/copy/main.js | 2 +- docs/fiddles/system/clipboard/paste/main.js | 2 +- .../launch-app-from-URL-in-another-app/main.js | 2 +- docs/fiddles/tutorial-preload/main.js | 2 +- 18 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/fiddles/features/dark-mode/main.js b/docs/fiddles/features/dark-mode/main.js index 34c0211a4328..f28419afd54f 100644 --- a/docs/fiddles/features/dark-mode/main.js +++ b/docs/fiddles/features/dark-mode/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron') -const path = require('path') +const path = require('node:path') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/drag-and-drop/main.js b/docs/fiddles/features/drag-and-drop/main.js index db617ba27d8a..9ee443196158 100644 --- a/docs/fiddles/features/drag-and-drop/main.js +++ b/docs/fiddles/features/drag-and-drop/main.js @@ -1,7 +1,7 @@ const { app, BrowserWindow, ipcMain } = require('electron') -const path = require('path') -const fs = require('fs') -const https = require('https') +const path = require('node:path') +const fs = require('node:fs') +const https = require('node:https') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/offscreen-rendering/main.js b/docs/fiddles/features/offscreen-rendering/main.js index e4a25a47cda5..daf4306b8c57 100644 --- a/docs/fiddles/features/offscreen-rendering/main.js +++ b/docs/fiddles/features/offscreen-rendering/main.js @@ -1,6 +1,6 @@ const { app, BrowserWindow } = require('electron') -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') app.disableHardwareAcceleration() diff --git a/docs/fiddles/features/recent-documents/main.js b/docs/fiddles/features/recent-documents/main.js index d11a5bcc6705..628f01f0e016 100644 --- a/docs/fiddles/features/recent-documents/main.js +++ b/docs/fiddles/features/recent-documents/main.js @@ -1,6 +1,6 @@ const { app, BrowserWindow } = require('electron') -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/represented-file/main.js b/docs/fiddles/features/represented-file/main.js index 387047b5d0a7..9b107a09db0b 100644 --- a/docs/fiddles/features/represented-file/main.js +++ b/docs/fiddles/features/represented-file/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow } = require('electron') -const os = require('os') +const os = require('node:os') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/web-bluetooth/main.js b/docs/fiddles/features/web-bluetooth/main.js index a8ed8f5720d0..0821de287e18 100644 --- a/docs/fiddles/features/web-bluetooth/main.js +++ b/docs/fiddles/features/web-bluetooth/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain } = require('electron') -const path = require('path') +const path = require('node:path') let bluetoothPinCallback let selectBluetoothCallback diff --git a/docs/fiddles/ipc/pattern-1/main.js b/docs/fiddles/ipc/pattern-1/main.js index 567baf40290c..c43937edab60 100644 --- a/docs/fiddles/ipc/pattern-1/main.js +++ b/docs/fiddles/ipc/pattern-1/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain } = require('electron') -const path = require('path') +const path = require('node:path') function createWindow () { const mainWindow = new BrowserWindow({ diff --git a/docs/fiddles/ipc/pattern-2/main.js b/docs/fiddles/ipc/pattern-2/main.js index 4cf3aab440a9..187a6d83b5d2 100644 --- a/docs/fiddles/ipc/pattern-2/main.js +++ b/docs/fiddles/ipc/pattern-2/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron') -const path = require('path') +const path = require('node:path') async function handleFileOpen () { const { canceled, filePaths } = await dialog.showOpenDialog() diff --git a/docs/fiddles/ipc/pattern-3/main.js b/docs/fiddles/ipc/pattern-3/main.js index 4c2334dfb082..91c0c1a64666 100644 --- a/docs/fiddles/ipc/pattern-3/main.js +++ b/docs/fiddles/ipc/pattern-3/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, Menu, ipcMain } = require('electron') -const path = require('path') +const path = require('node:path') function createWindow () { const mainWindow = new BrowserWindow({ diff --git a/docs/fiddles/ipc/webview-new-window/main.js b/docs/fiddles/ipc/webview-new-window/main.js index cab3b1ec1b65..a76c1434c49a 100644 --- a/docs/fiddles/ipc/webview-new-window/main.js +++ b/docs/fiddles/ipc/webview-new-window/main.js @@ -1,6 +1,6 @@ // Modules to control application life and create native browser window const { app, BrowserWindow } = require('electron') -const path = require('path') +const path = require('node:path') function createWindow () { // Create the browser window. diff --git a/docs/fiddles/media/screenshot/take-screenshot/renderer.js b/docs/fiddles/media/screenshot/take-screenshot/renderer.js index e7988f5067d1..ab07d1ceaca0 100644 --- a/docs/fiddles/media/screenshot/take-screenshot/renderer.js +++ b/docs/fiddles/media/screenshot/take-screenshot/renderer.js @@ -1,8 +1,8 @@ const { desktopCapturer, shell, ipcRenderer } = require('electron') -const fs = require('fs') -const os = require('os') -const path = require('path') +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') const screenshot = document.getElementById('screen-shot') const screenshotMsg = document.getElementById('screenshot-path') diff --git a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js b/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js index d49754cdb731..600045d1e047 100644 --- a/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js +++ b/docs/fiddles/native-ui/external-links-file-manager/path-in-file-manager/renderer.js @@ -1,5 +1,5 @@ const { shell } = require('electron') -const os = require('os') +const os = require('node:os') const fileManagerBtn = document.getElementById('open-file-manager') diff --git a/docs/fiddles/native-ui/external-links-file-manager/renderer.js b/docs/fiddles/native-ui/external-links-file-manager/renderer.js index a534d80635e2..e557679162bb 100644 --- a/docs/fiddles/native-ui/external-links-file-manager/renderer.js +++ b/docs/fiddles/native-ui/external-links-file-manager/renderer.js @@ -1,5 +1,5 @@ const { shell } = require('electron') -const os = require('os') +const os = require('node:os') const exLinksBtn = document.getElementById('open-ex-links') const fileManagerBtn = document.getElementById('open-file-manager') diff --git a/docs/fiddles/quick-start/main.js b/docs/fiddles/quick-start/main.js index ba8a65d05d7b..6fda959b7ee4 100644 --- a/docs/fiddles/quick-start/main.js +++ b/docs/fiddles/quick-start/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow } = require('electron') -const path = require('path') +const path = require('node:path') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/system/clipboard/copy/main.js b/docs/fiddles/system/clipboard/copy/main.js index 8d565f33f6d5..c68becbd8e98 100644 --- a/docs/fiddles/system/clipboard/copy/main.js +++ b/docs/fiddles/system/clipboard/copy/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain, clipboard } = require('electron') -const path = require('path') +const path = require('node:path') let mainWindow = null diff --git a/docs/fiddles/system/clipboard/paste/main.js b/docs/fiddles/system/clipboard/paste/main.js index ac8ee073c17d..43f73a14c880 100644 --- a/docs/fiddles/system/clipboard/paste/main.js +++ b/docs/fiddles/system/clipboard/paste/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow, ipcMain, clipboard } = require('electron') -const path = require('path') +const path = require('node:path') let mainWindow = null diff --git a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js index 154ba3802030..6459985a1730 100644 --- a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js +++ b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js @@ -1,6 +1,6 @@ // Modules to control application life and create native browser window const { app, BrowserWindow, ipcMain, shell, dialog } = require('electron') -const path = require('path') +const path = require('node:path') let mainWindow diff --git a/docs/fiddles/tutorial-preload/main.js b/docs/fiddles/tutorial-preload/main.js index 7b854f5ec2a1..32e5c10d4257 100644 --- a/docs/fiddles/tutorial-preload/main.js +++ b/docs/fiddles/tutorial-preload/main.js @@ -1,5 +1,5 @@ const { app, BrowserWindow } = require('electron') -const path = require('path') +const path = require('node:path') const createWindow = () => { const win = new BrowserWindow({