require the use of node prefix on native imports

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-01-25 13:47:32 +01:00
parent 4ad63b8d9f
commit 7455dae884
444 changed files with 749 additions and 634 deletions
+2 -2
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
const { join: joinPath } = require('path');
const { join: joinPath } = require('node:path');
/**
* Creates a ESLint configuration that extends the base Backstage configuration.
@@ -235,7 +235,7 @@ function createConfigForRole(dir, role, extraConfig = {}) {
name: '@mui/material',
message: "Please import '@mui/material/...' instead.",
},
...require('module').builtinModules,
...require('node:module').builtinModules,
...(extraConfig.restrictedImports ?? []),
],
// https://mui.com/material-ui/guides/minimizing-bundle-size/
+3 -3
View File
@@ -15,9 +15,9 @@
*/
const fs = require('fs-extra');
const path = require('path');
const crypto = require('crypto');
const glob = require('util').promisify(require('glob'));
const path = require('node:path');
const crypto = require('node:crypto');
const glob = require('node:util').promisify(require('glob'));
const { version } = require('../package.json');
const paths = require('@backstage/cli-common').findPaths(process.cwd());
const {
+1 -1
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
const path = require('path');
const path = require('node:path');
module.exports = {
process(src, filename) {
@@ -14,8 +14,8 @@
* limitations under the License.
*/
const http = require('http');
const https = require('https');
const http = require('node:http');
const https = require('node:https');
const errorMessage = 'Network requests are not allowed in tests';
+1 -1
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
const { createHash } = require('crypto');
const { createHash } = require('node:crypto');
const { transform } = require('sucrase');
const sucrasePkg = require('sucrase/package.json');
+1 -1
View File
@@ -15,7 +15,7 @@
*/
const yaml = require('yaml');
const crypto = require('crypto');
const crypto = require('node:crypto');
function createTransformer(config) {
const process = source => {
+3 -3
View File
@@ -14,15 +14,15 @@
* limitations under the License.
*/
const { pathToFileURL } = require('url');
const { pathToFileURL } = require('node:url');
const { transformSync } = require('@swc/core');
const { addHook } = require('pirates');
const { Module } = require('module');
const { Module } = require('node:module');
// This hooks into module resolution and overrides imports of packages that
// exist in the linked workspace to instead be resolved from the linked workspace.
if (process.env.BACKSTAGE_CLI_LINKED_WORKSPACE) {
const { join: joinPath } = require('path');
const { join: joinPath } = require('node:path');
const { getPackagesSync } = require('@manypkg/get-packages');
const { packages: linkedPackages, root: linkedRoot } = getPackagesSync(
process.env.BACKSTAGE_CLI_LINKED_WORKSPACE,
+4 -4
View File
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { dirname, extname, resolve as resolvePath } from 'path';
import { fileURLToPath } from 'url';
import { dirname, extname, resolve as resolvePath } from 'node:path';
import { fileURLToPath } from 'node:url';
import { transformFile } from '@swc/core';
import { isBuiltin } from 'node:module';
import { readFile } from 'fs/promises';
import { existsSync } from 'fs';
import { readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
// @ts-check