From dd72f0183babf14a2ae08c55e81ba2c25b64df0b Mon Sep 17 00:00:00 2001
From: nod_ <nod_@598310.no-reply.drupal.org>
Date: Mon, 7 Oct 2024 16:29:23 +0200
Subject: [PATCH] Issue #3473014 by tom konda: Prefer to add "node:" prefix to
 require() which imports Node.js built-in module

---
 .../tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js     | 6 +++---
 core/modules/ckeditor5/webpack.config.js                    | 4 ++--
 core/scripts/css/changeOrAdded.js                           | 2 +-
 core/scripts/css/check.js                                   | 2 +-
 core/scripts/css/compile.js                                 | 2 +-
 core/scripts/css/postcss-watch.js                           | 4 ++--
 core/scripts/js/assets/process/jqueryui.js                  | 2 +-
 core/scripts/js/ckeditor5-check-plugins.js                  | 4 ++--
 core/scripts/js/ckeditor5-types-documentation.js            | 2 +-
 core/scripts/js/vendor-update.js                            | 4 ++--
 core/tests/Drupal/Nightwatch/Commands/drupalInstall.js      | 4 ++--
 core/tests/Drupal/Nightwatch/Commands/drupalLoginAsAdmin.js | 2 +-
 core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js    | 2 +-
 core/tests/Drupal/Nightwatch/globals.js                     | 4 ++--
 core/tests/Drupal/Nightwatch/nightwatch.conf.js             | 2 +-
 15 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js b/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js
index f4f8f3bd13a9..5db672324dcb 100644
--- a/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js
+++ b/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js
@@ -1,6 +1,6 @@
-const assert = require('assert');
-const fs = require('fs');
-const path = require('path');
+const assert = require('node:assert');
+const fs = require('node:fs');
+const path = require('node:path');
 // eslint-disable-next-line import/no-extraneous-dependencies
 const { JSDOM } = require('jsdom');
 
diff --git a/core/modules/ckeditor5/webpack.config.js b/core/modules/ckeditor5/webpack.config.js
index 52b849cbc917..7d506e09abf4 100644
--- a/core/modules/ckeditor5/webpack.config.js
+++ b/core/modules/ckeditor5/webpack.config.js
@@ -1,5 +1,5 @@
-const path = require('path');
-const fs = require('fs');
+const path = require('node:path');
+const fs = require('node:fs');
 const webpack = require('webpack');
 const TerserPlugin = require('terser-webpack-plugin');
 
diff --git a/core/scripts/css/changeOrAdded.js b/core/scripts/css/changeOrAdded.js
index 53c586e2e66a..9f2767ba8402 100644
--- a/core/scripts/css/changeOrAdded.js
+++ b/core/scripts/css/changeOrAdded.js
@@ -1,4 +1,4 @@
-const fs = require('fs');
+const fs = require('node:fs');
 const log = require('./log');
 const compile = require('./compile');
 
diff --git a/core/scripts/css/check.js b/core/scripts/css/check.js
index 7ed236573c61..a2878e90ed88 100644
--- a/core/scripts/css/check.js
+++ b/core/scripts/css/check.js
@@ -1,4 +1,4 @@
-const fs = require('fs');
+const fs = require('node:fs');
 const log = require('./log');
 const compile = require('./compile');
 
diff --git a/core/scripts/css/compile.js b/core/scripts/css/compile.js
index e3a03396a128..5c9426747e85 100644
--- a/core/scripts/css/compile.js
+++ b/core/scripts/css/compile.js
@@ -1,5 +1,5 @@
 const log = require('./log');
-const fs = require('fs');
+const fs = require('node:fs');
 const postcss = require('postcss');
 const postcssImport = require('postcss-import');
 const postcssHeader = require('postcss-header');
diff --git a/core/scripts/css/postcss-watch.js b/core/scripts/css/postcss-watch.js
index d241c5b798e5..472c4a944b44 100644
--- a/core/scripts/css/postcss-watch.js
+++ b/core/scripts/css/postcss-watch.js
@@ -9,8 +9,8 @@
 
 'use strict';
 
-const fs = require('fs');
-const path = require('path');
+const fs = require('node:fs');
+const path = require('node:path');
 const chokidar = require('chokidar');
 
 const changeOrAdded = require('./changeOrAdded');
diff --git a/core/scripts/js/assets/process/jqueryui.js b/core/scripts/js/assets/process/jqueryui.js
index 449bb2aa8ff6..601fbbecc16e 100644
--- a/core/scripts/js/assets/process/jqueryui.js
+++ b/core/scripts/js/assets/process/jqueryui.js
@@ -1,5 +1,5 @@
 const Terser = require('terser');
-const path = require('path');
+const path = require('node:path');
 
 /**
  * Process jQuery UI source files.
diff --git a/core/scripts/js/ckeditor5-check-plugins.js b/core/scripts/js/ckeditor5-check-plugins.js
index 982d665e19d8..c858ab30e49a 100644
--- a/core/scripts/js/ckeditor5-check-plugins.js
+++ b/core/scripts/js/ckeditor5-check-plugins.js
@@ -14,8 +14,8 @@
 
 const { globSync } = require("glob");
 const log = require("./log");
-const fs = require("fs").promises;
-const child_process = require("child_process");
+const fs = require("node:fs").promises;
+const child_process = require("node:child_process");
 
 async function getContents(files) {
   return Object.fromEntries(
diff --git a/core/scripts/js/ckeditor5-types-documentation.js b/core/scripts/js/ckeditor5-types-documentation.js
index 29fcb68ce54b..a443f6101c5b 100644
--- a/core/scripts/js/ckeditor5-types-documentation.js
+++ b/core/scripts/js/ckeditor5-types-documentation.js
@@ -14,7 +14,7 @@
 
 const { globSync } = require('glob');
 const log = require('./log');
-const fs = require('fs');
+const fs = require('node:fs');
 
 /**
  * A list of regex used to alias CKEditor 5 types.
diff --git a/core/scripts/js/vendor-update.js b/core/scripts/js/vendor-update.js
index 379117b686ae..db7e8a36670b 100644
--- a/core/scripts/js/vendor-update.js
+++ b/core/scripts/js/vendor-update.js
@@ -7,8 +7,8 @@
  * build step.
  */
 
-const path = require('path');
-const { copyFile, writeFile, readFile, chmod, mkdir } = require('fs').promises;
+const path = require('node:path');
+const { copyFile, writeFile, readFile, chmod, mkdir } = require('node:fs').promises;
 const ckeditor5Files = require('./assets/ckeditor5Files');
 const jQueryUIProcess = require('./assets/process/jqueryui');
 const mapProcess = require('./assets/process/map');
diff --git a/core/tests/Drupal/Nightwatch/Commands/drupalInstall.js b/core/tests/Drupal/Nightwatch/Commands/drupalInstall.js
index c38b21ccdf2d..9022592467ed 100644
--- a/core/tests/Drupal/Nightwatch/Commands/drupalInstall.js
+++ b/core/tests/Drupal/Nightwatch/Commands/drupalInstall.js
@@ -1,5 +1,5 @@
-const { execSync } = require('child_process');
-const { URL } = require('url');
+const { execSync } = require('node:child_process');
+const { URL } = require('node:url');
 const { commandAsWebserver } = require('../globals');
 
 /**
diff --git a/core/tests/Drupal/Nightwatch/Commands/drupalLoginAsAdmin.js b/core/tests/Drupal/Nightwatch/Commands/drupalLoginAsAdmin.js
index e475026b16e6..28b1a3468bd5 100644
--- a/core/tests/Drupal/Nightwatch/Commands/drupalLoginAsAdmin.js
+++ b/core/tests/Drupal/Nightwatch/Commands/drupalLoginAsAdmin.js
@@ -1,4 +1,4 @@
-const { execSync } = require('child_process');
+const { execSync } = require('node:child_process');
 const { commandAsWebserver } = require('../globals');
 
 /**
diff --git a/core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js b/core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js
index d904f494ebf1..0ad21d00b9fe 100644
--- a/core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js
+++ b/core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js
@@ -1,4 +1,4 @@
-const { execSync } = require('child_process');
+const { execSync } = require('node:child_process');
 const { commandAsWebserver } = require('../globals');
 
 /**
diff --git a/core/tests/Drupal/Nightwatch/globals.js b/core/tests/Drupal/Nightwatch/globals.js
index ca43a26af46d..5d79d60e8e92 100644
--- a/core/tests/Drupal/Nightwatch/globals.js
+++ b/core/tests/Drupal/Nightwatch/globals.js
@@ -1,5 +1,5 @@
-const path = require('path');
-const fs = require('fs');
+const path = require('node:path');
+const fs = require('node:fs');
 const mkdirp = require('mkdirp');
 const nightwatchSettings = require('./nightwatch.conf');
 
diff --git a/core/tests/Drupal/Nightwatch/nightwatch.conf.js b/core/tests/Drupal/Nightwatch/nightwatch.conf.js
index f0950fc228c3..a0d46e010f47 100644
--- a/core/tests/Drupal/Nightwatch/nightwatch.conf.js
+++ b/core/tests/Drupal/Nightwatch/nightwatch.conf.js
@@ -1,5 +1,5 @@
 // cspell:ignore testcases
-const path = require('path');
+const path = require('node:path');
 const { globSync } = require('glob');
 
 // Find directories which have Nightwatch tests in them.
-- 
GitLab