mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-10-22 11:46:18 +00:00
build: accept every node: builtin as an import
The import check allowed twelve hand-listed node: modules and reported any other builtin, node:http among them, as missing from package.json dependencies. A builtin is never a dependency; the list now comes from node:module.
This commit is contained in:
1 parent
bda5292877
commit
f0ba63750f
1 file changed
+4
-2
@@ -4,6 +4,7 @@
|
||||
|
||||
import JSON5 from 'json5';
|
||||
import fs from 'node:fs';
|
||||
import { builtinModules } from 'node:module';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import ts from 'typescript';
|
||||
@@ -32,8 +33,9 @@ const TARGET_TSES = ts.ScriptTarget.ES2022;
|
||||
const TARGET_NODE = '>=18';
|
||||
|
||||
const IGNORE_IMPORTS = [
|
||||
// node (new-style)
|
||||
...['assert', 'child_process', 'crypto', 'fs', 'module', 'os', 'path', 'process', 'readline', 'test', 'url', 'util'].map((m) => `node:${m}`),
|
||||
// node (new-style): every builtin, none of them is a package.json dependency.
|
||||
// Some are listed with the prefix already (node:test, node:sqlite).
|
||||
...builtinModules.map((m) => m.startsWith('node:') ? m : `node:${m}`),
|
||||
// other
|
||||
'@testing-library/react',
|
||||
'react', 'react-native', 'styled-components'
|
||||
|
||||
Reference in new issue
Block a user