From 9f5518000fbdbffe87003f8a3f69fd95102e5f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=B9?= Date: Tue, 28 Jan 2025 12:13:36 +0900 Subject: [PATCH] refactor: prefix node:* (#1769) * refactor: prefix node:* to path * refactor: prefix node:* to os * refactor: prefix node:* to fs * refactor: prefix node:* to util --- lib/Adb.js | 2 +- lib/AndroidManifest.js | 2 +- lib/AndroidProject.js | 4 ++-- lib/Api.js | 2 +- lib/build.js | 4 ++-- lib/builders/ProjectBuilder.js | 2 +- lib/check_reqs.js | 2 +- lib/config/CordovaGradleConfigParser.js | 2 +- lib/config/GradlePropertiesParser.js | 4 ++-- lib/create.js | 2 +- lib/emulator.js | 2 +- lib/env/java.js | 2 +- lib/pluginHandlers.js | 2 +- lib/prepare.js | 2 +- lib/target.js | 2 +- lib/utils.js | 2 +- spec/e2e/e2e.spec.js | 4 ++-- spec/unit/AndroidManifest.spec.js | 6 +++--- spec/unit/AndroidProject.spec.js | 2 +- spec/unit/Api.spec.js | 4 ++-- spec/unit/android_sdk.spec.js | 4 ++-- spec/unit/builders/ProjectBuilder.spec.js | 2 +- spec/unit/check_reqs.spec.js | 2 +- spec/unit/create.spec.js | 2 +- spec/unit/emulator.spec.js | 2 +- spec/unit/java.spec.js | 2 +- spec/unit/pluginHandlers/common.spec.js | 4 ++-- spec/unit/pluginHandlers/handlers.spec.js | 4 ++-- spec/unit/prepare.spec.js | 2 +- test/run_java_unit_tests.js | 2 +- 30 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/Adb.js b/lib/Adb.js index 2d0b2837..897ef5cb 100644 --- a/lib/Adb.js +++ b/lib/Adb.js @@ -17,7 +17,7 @@ under the License. */ -const os = require('os'); +const os = require('node:os'); const execa = require('execa'); const events = require('cordova-common').events; const CordovaError = require('cordova-common').CordovaError; diff --git a/lib/AndroidManifest.js b/lib/AndroidManifest.js index f8ab241c..2006d6ee 100644 --- a/lib/AndroidManifest.js +++ b/lib/AndroidManifest.js @@ -17,7 +17,7 @@ under the License. */ -const fs = require('fs'); +const fs = require('node:fs'); const xml = require('cordova-common').xmlHelpers; const DEFAULT_ORIENTATION = 'default'; diff --git a/lib/AndroidProject.js b/lib/AndroidProject.js index d0b0ad09..85f8ee53 100644 --- a/lib/AndroidProject.js +++ b/lib/AndroidProject.js @@ -17,8 +17,8 @@ under the License. */ -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const properties_parser = require('properties-parser'); const pluginHandlers = require('./pluginHandlers'); const CordovaGradleConfigParserFactory = require('./config/CordovaGradleConfigParserFactory'); diff --git a/lib/Api.js b/lib/Api.js index 4a99fe8f..03527268 100644 --- a/lib/Api.js +++ b/lib/Api.js @@ -17,7 +17,7 @@ under the License. */ -const path = require('path'); +const path = require('node:path'); const AndroidProject = require('./AndroidProject'); const PluginManager = require('cordova-common').PluginManager; diff --git a/lib/build.js b/lib/build.js index 7e42f280..a0674f5b 100644 --- a/lib/build.js +++ b/lib/build.js @@ -17,8 +17,8 @@ under the License. */ -const path = require('path'); -const fs = require('fs'); +const path = require('node:path'); +const fs = require('node:fs'); const nopt = require('nopt'); const untildify = require('untildify'); const { parseArgsStringToArgv } = require('string-argv'); diff --git a/lib/builders/ProjectBuilder.js b/lib/builders/ProjectBuilder.js index 024a0221..8cdc97e2 100644 --- a/lib/builders/ProjectBuilder.js +++ b/lib/builders/ProjectBuilder.js @@ -18,7 +18,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const execa = require('execa'); const glob = require('fast-glob'); const events = require('cordova-common').events; diff --git a/lib/check_reqs.js b/lib/check_reqs.js index 29159a85..63ebe881 100644 --- a/lib/check_reqs.js +++ b/lib/check_reqs.js @@ -18,7 +18,7 @@ */ const execa = require('execa'); -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); const { forgivingWhichSync, isWindows, isDarwin } = require('./utils'); const java = require('./env/java'); diff --git a/lib/config/CordovaGradleConfigParser.js b/lib/config/CordovaGradleConfigParser.js index f6f5d18e..15b5e755 100644 --- a/lib/config/CordovaGradleConfigParser.js +++ b/lib/config/CordovaGradleConfigParser.js @@ -18,7 +18,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const events = require('cordova-common').events; class CordovaGradleConfigParser { diff --git a/lib/config/GradlePropertiesParser.js b/lib/config/GradlePropertiesParser.js index 9189a91b..d4447b01 100644 --- a/lib/config/GradlePropertiesParser.js +++ b/lib/config/GradlePropertiesParser.js @@ -17,8 +17,8 @@ under the License. */ -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const propertiesParser = require('properties-parser'); const events = require('cordova-common').events; diff --git a/lib/create.js b/lib/create.js index 303ced12..9c6155f7 100755 --- a/lib/create.js +++ b/lib/create.js @@ -17,7 +17,7 @@ under the License. */ -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); const utils = require('./utils'); const check_reqs = require('./check_reqs'); diff --git a/lib/emulator.js b/lib/emulator.js index c67e325d..77460128 100644 --- a/lib/emulator.js +++ b/lib/emulator.js @@ -20,7 +20,7 @@ const execa = require('execa'); const fs = require('fs-extra'); const android_versions = require('android-versions'); -const path = require('path'); +const path = require('node:path'); const Adb = require('./Adb'); const events = require('cordova-common').events; const CordovaError = require('cordova-common').CordovaError; diff --git a/lib/env/java.js b/lib/env/java.js index 4c0f86ec..f5f3c434 100644 --- a/lib/env/java.js +++ b/lib/env/java.js @@ -19,7 +19,7 @@ const execa = require('execa'); const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const glob = require('fast-glob'); const { CordovaError, events } = require('cordova-common'); const utils = require('../utils'); diff --git a/lib/pluginHandlers.js b/lib/pluginHandlers.js index 694088d1..2a031d6e 100644 --- a/lib/pluginHandlers.js +++ b/lib/pluginHandlers.js @@ -15,7 +15,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const isPathInside = require('is-path-inside'); const events = require('cordova-common').events; const CordovaError = require('cordova-common').CordovaError; diff --git a/lib/prepare.js b/lib/prepare.js index 284904c4..22920b0c 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -18,7 +18,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const nopt = require('nopt'); const glob = require('fast-glob'); const dedent = require('dedent'); diff --git a/lib/target.js b/lib/target.js index 69066db9..fcdc79fc 100644 --- a/lib/target.js +++ b/lib/target.js @@ -17,7 +17,7 @@ under the License. */ -const { inspect } = require('util'); +const { inspect } = require('node:util'); const execa = require('execa'); const Adb = require('./Adb'); const build = require('./build'); diff --git a/lib/utils.js b/lib/utils.js index 28f17d92..30398a2f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -25,7 +25,7 @@ const fs = require('fs-extra'); const which = require('which'); -const os = require('os'); +const os = require('node:os'); /** * Reads, searches, and replaces the found occurences with replacementString and then writes the file back out. diff --git a/spec/e2e/e2e.spec.js b/spec/e2e/e2e.spec.js index 8136c943..df0ffa8b 100644 --- a/spec/e2e/e2e.spec.js +++ b/spec/e2e/e2e.spec.js @@ -17,9 +17,9 @@ under the License. */ -const os = require('os'); +const os = require('node:os'); const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const { EventEmitter } = require('events'); const { ConfigParser, PluginInfoProvider } = require('cordova-common'); const Api = require('../../lib/Api'); diff --git a/spec/unit/AndroidManifest.spec.js b/spec/unit/AndroidManifest.spec.js index e156efdc..8c511b8f 100644 --- a/spec/unit/AndroidManifest.spec.js +++ b/spec/unit/AndroidManifest.spec.js @@ -17,9 +17,9 @@ under the License. */ -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 rewire = require('rewire'); describe('AndroidManifest', () => { diff --git a/spec/unit/AndroidProject.spec.js b/spec/unit/AndroidProject.spec.js index 79d57f2f..c865630d 100644 --- a/spec/unit/AndroidProject.spec.js +++ b/spec/unit/AndroidProject.spec.js @@ -17,7 +17,7 @@ under the License. */ -const path = require('path'); +const path = require('node:path'); const rewire = require('rewire'); const MockCordovaGradleConfigParser = require('./mocks/config/MockCordovaGradleConfigParser'); const CordovaGradleConfigParserFactory = require('../../lib/config/CordovaGradleConfigParserFactory'); diff --git a/spec/unit/Api.spec.js b/spec/unit/Api.spec.js index ca3754f5..ca8b5be4 100644 --- a/spec/unit/Api.spec.js +++ b/spec/unit/Api.spec.js @@ -17,8 +17,8 @@ under the License. */ -const os = require('os'); -const path = require('path'); +const os = require('node:os'); +const path = require('node:path'); const common = require('cordova-common'); const EventEmitter = require('events'); diff --git a/spec/unit/android_sdk.spec.js b/spec/unit/android_sdk.spec.js index 67c0cbf8..4e12be15 100644 --- a/spec/unit/android_sdk.spec.js +++ b/spec/unit/android_sdk.spec.js @@ -17,8 +17,8 @@ under the License. */ -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const rewire = require('rewire'); describe('android_sdk', () => { diff --git a/spec/unit/builders/ProjectBuilder.spec.js b/spec/unit/builders/ProjectBuilder.spec.js index 388beab5..a96df231 100644 --- a/spec/unit/builders/ProjectBuilder.spec.js +++ b/spec/unit/builders/ProjectBuilder.spec.js @@ -18,7 +18,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const rewire = require('rewire'); const { isWindows } = require('../../../lib/utils'); diff --git a/spec/unit/check_reqs.spec.js b/spec/unit/check_reqs.spec.js index d5c1d409..12cb6903 100644 --- a/spec/unit/check_reqs.spec.js +++ b/spec/unit/check_reqs.spec.js @@ -20,7 +20,7 @@ const rewire = require('rewire'); const android_sdk = require('../../lib/android_sdk'); const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const events = require('cordova-common').events; const which = require('which'); diff --git a/spec/unit/create.spec.js b/spec/unit/create.spec.js index 8c9c4304..15e32b65 100644 --- a/spec/unit/create.spec.js +++ b/spec/unit/create.spec.js @@ -22,7 +22,7 @@ const utils = require('../../lib/utils'); const create = rewire('../../lib/create'); const check_reqs = require('../../lib/check_reqs'); const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const MockCordovaGradleConfigParser = require('./mocks/config/MockCordovaGradleConfigParser'); const CordovaGradleConfigParserFactory = require('../../lib/config/CordovaGradleConfigParserFactory'); diff --git a/spec/unit/emulator.spec.js b/spec/unit/emulator.spec.js index 43815040..426e559c 100644 --- a/spec/unit/emulator.spec.js +++ b/spec/unit/emulator.spec.js @@ -18,7 +18,7 @@ */ const fs = require('fs-extra'); -const path = require('path'); +const path = require('node:path'); const rewire = require('rewire'); const which = require('which'); diff --git a/spec/unit/java.spec.js b/spec/unit/java.spec.js index 74680090..04c57cd0 100644 --- a/spec/unit/java.spec.js +++ b/spec/unit/java.spec.js @@ -17,7 +17,7 @@ under the License. */ -const path = require('path'); +const path = require('node:path'); const rewire = require('rewire'); const { CordovaError } = require('cordova-common'); const utils = require('../../lib/utils'); diff --git a/spec/unit/pluginHandlers/common.spec.js b/spec/unit/pluginHandlers/common.spec.js index d9938a17..90001fdc 100644 --- a/spec/unit/pluginHandlers/common.spec.js +++ b/spec/unit/pluginHandlers/common.spec.js @@ -18,9 +18,9 @@ const rewire = require('rewire'); const common = rewire('../../../lib/pluginHandlers'); -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); -const osenv = require('os'); +const osenv = require('node:os'); const test_dir = path.join(osenv.tmpdir(), 'test_plugman'); const project_dir = path.join(test_dir, 'project'); diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 33e8b266..cefb269a 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -20,9 +20,9 @@ const rewire = require('rewire'); const common = rewire('../../../lib/pluginHandlers'); const android = common.__get__('handlers'); -const path = require('path'); +const path = require('node:path'); const fs = require('fs-extra'); -const os = require('os'); +const os = require('node:os'); const temp = path.join(os.tmpdir(), 'plugman'); const plugins_dir = path.join(temp, 'cordova/plugins'); const dummyplugin = path.join(__dirname, '../../fixtures/org.test.plugins.dummyplugin'); diff --git a/spec/unit/prepare.spec.js b/spec/unit/prepare.spec.js index bdc65b4f..eb900573 100644 --- a/spec/unit/prepare.spec.js +++ b/spec/unit/prepare.spec.js @@ -18,7 +18,7 @@ */ const rewire = require('rewire'); -const path = require('path'); +const path = require('node:path'); const CordovaError = require('cordova-common').CordovaError; const GradlePropertiesParser = require('../../lib/config/GradlePropertiesParser'); const utils = require('../../lib/utils'); diff --git a/test/run_java_unit_tests.js b/test/run_java_unit_tests.js index 816ab6b0..5d48ea92 100644 --- a/test/run_java_unit_tests.js +++ b/test/run_java_unit_tests.js @@ -19,7 +19,7 @@ under the License. */ -const path = require('path'); +const path = require('node:path'); const execa = require('execa'); const fs = require('fs-extra'); const ProjectBuilder = require('../lib/builders/ProjectBuilder');