Skip to content

Commit d24f645

Browse files
authored
feat(no-unsupported-features): Update to v21.6.1 of node (#180)
* chore: Update and split-up all supported node-modules * chore: Match up with original * chore: Add URL static methods * chore: Move to "node-modules" to "unsupported-features" * feat: Add timers.promises support See: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V21.md#2024-01-15-version-2160-current-rafaelgss * feat: Hook up updated builtins * fix: node:fs/promises only available in 14.0.0 * chore: Go through current no-unsupported node builtins tests * feat: Add a better error for unsupported builtins * feat: Add WebCrypto * feat: Add WebStream and StreamConsumer
1 parent 0e1160a commit d24f645

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2614
-1174
lines changed

lib/rules/no-unsupported-features/node-builtins.js

+5-322
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const {
1111
} = require("../../util/check-unsupported-builtins")
1212
const enumeratePropertyNames = require("../../util/enumerate-property-names")
1313
const getConfiguredNodeVersion = require("../../util/get-configured-node-version")
14-
const extendTrackMapWithNodePrefix = require("../../util/extend-trackmap-with-node-prefix")
14+
15+
const {
16+
NodeBuiltinModules,
17+
} = require("../../unsupported-features/node-builtins.js")
1518

1619
const trackMap = {
1720
globals: {
@@ -24,325 +27,7 @@ const trackMap = {
2427
},
2528
},
2629
},
27-
modules: {
28-
assert: {
29-
strict: {
30-
[READ]: { supported: ["9.9.0", "8.13.0"] },
31-
doesNotReject: { [READ]: { supported: ["10.0.0"] } },
32-
rejects: { [READ]: { supported: ["10.0.0"] } },
33-
},
34-
deepStrictEqual: { [READ]: { supported: ["4.0.0"] } },
35-
doesNotReject: { [READ]: { supported: ["10.0.0"] } },
36-
notDeepStrictEqual: { [READ]: { supported: ["4.0.0"] } },
37-
rejects: { [READ]: { supported: ["10.0.0"] } },
38-
CallTracker: {
39-
[READ]: { supported: null, experimental: "14.2.0" },
40-
},
41-
},
42-
async_hooks: {
43-
[READ]: { supported: ["8.0.0"] },
44-
createHook: { [READ]: { supported: ["8.1.0"] } },
45-
AsyncLocalStorage: {
46-
[READ]: { supported: ["13.10.0", "12.17.0"] },
47-
},
48-
},
49-
buffer: {
50-
Buffer: {
51-
alloc: { [READ]: { supported: ["4.5.0"] } },
52-
allocUnsafe: { [READ]: { supported: ["4.5.0"] } },
53-
allocUnsafeSlow: { [READ]: { supported: ["4.5.0"] } },
54-
from: { [READ]: { supported: ["4.5.0"] } },
55-
},
56-
kMaxLength: { [READ]: { supported: ["3.0.0"] } },
57-
transcode: { [READ]: { supported: ["7.1.0"] } },
58-
constants: { [READ]: { supported: ["8.2.0"] } },
59-
Blob: { [READ]: { supported: null, experimental: "15.7.0" } },
60-
},
61-
child_process: {
62-
ChildProcess: { [READ]: { supported: ["2.2.0"] } },
63-
},
64-
console: {
65-
clear: { [READ]: { supported: ["8.3.0", "6.13.0"] } },
66-
count: { [READ]: { supported: ["8.3.0", "6.13.0"] } },
67-
countReset: {
68-
[READ]: { supported: ["8.3.0", "6.13.0"] },
69-
},
70-
debug: { [READ]: { supported: ["8.0.0"] } },
71-
dirxml: { [READ]: { supported: ["8.0.0"] } },
72-
group: { [READ]: { supported: ["8.5.0"] } },
73-
groupCollapsed: { [READ]: { supported: ["8.5.0"] } },
74-
groupEnd: { [READ]: { supported: ["8.5.0"] } },
75-
table: { [READ]: { supported: ["10.0.0"] } },
76-
markTimeline: { [READ]: { supported: ["8.0.0"] } },
77-
profile: { [READ]: { supported: ["8.0.0"] } },
78-
profileEnd: { [READ]: { supported: ["8.0.0"] } },
79-
timeLog: { [READ]: { supported: ["10.7.0"] } },
80-
timeStamp: { [READ]: { supported: ["8.0.0"] } },
81-
timeline: { [READ]: { supported: ["8.0.0"] } },
82-
timelineEnd: { [READ]: { supported: ["8.0.0"] } },
83-
},
84-
crypto: {
85-
Certificate: {
86-
exportChallenge: { [READ]: { supported: ["9.0.0"] } },
87-
exportPublicKey: { [READ]: { supported: ["9.0.0"] } },
88-
verifySpkac: { [READ]: { supported: ["9.0.0"] } },
89-
},
90-
ECDH: { [READ]: { supported: ["8.8.0", "6.13.0"] } },
91-
KeyObject: { [READ]: { supported: ["11.6.0"] } },
92-
createPrivateKey: { [READ]: { supported: ["11.6.0"] } },
93-
createPublicKey: { [READ]: { supported: ["11.6.0"] } },
94-
createSecretKey: { [READ]: { supported: ["11.6.0"] } },
95-
constants: { [READ]: { supported: ["6.3.0"] } },
96-
fips: { [READ]: { supported: ["6.0.0"] } },
97-
generateKeyPair: { [READ]: { supported: ["10.12.0"] } },
98-
generateKeyPairSync: { [READ]: { supported: ["10.12.0"] } },
99-
getCurves: { [READ]: { supported: ["2.3.0"] } },
100-
getFips: { [READ]: { supported: ["10.0.0"] } },
101-
privateEncrypt: { [READ]: { supported: ["1.1.0"] } },
102-
publicDecrypt: { [READ]: { supported: ["1.1.0"] } },
103-
randomFillSync: {
104-
[READ]: { supported: ["7.10.0", "6.13.0"] },
105-
},
106-
randomFill: {
107-
[READ]: { supported: ["7.10.0", "6.13.0"] },
108-
},
109-
scrypt: { [READ]: { supported: ["10.5.0"] } },
110-
scryptSync: { [READ]: { supported: ["10.5.0"] } },
111-
setFips: { [READ]: { supported: ["10.0.0"] } },
112-
sign: { [READ]: { supported: ["12.0.0"] } },
113-
timingSafeEqual: { [READ]: { supported: ["6.6.0"] } },
114-
verify: { [READ]: { supported: ["12.0.0"] } },
115-
},
116-
dns: {
117-
Resolver: { [READ]: { supported: ["8.3.0"] } },
118-
resolvePtr: { [READ]: { supported: ["6.0.0"] } },
119-
promises: {
120-
[READ]: {
121-
supported: ["11.14.0", "10.17.0"],
122-
experimental: "10.6.0",
123-
},
124-
},
125-
},
126-
events: {
127-
EventEmitter: {
128-
once: {
129-
[READ]: { supported: ["11.13.0", "10.16.0"] },
130-
},
131-
},
132-
once: { [READ]: { supported: ["11.13.0", "10.16.0"] } },
133-
},
134-
fs: {
135-
Dirent: { [READ]: { supported: ["10.10.0"] } },
136-
copyFile: { [READ]: { supported: ["8.5.0"] } },
137-
copyFileSync: { [READ]: { supported: ["8.5.0"] } },
138-
mkdtemp: { [READ]: { supported: ["5.10.0"] } },
139-
mkdtempSync: { [READ]: { supported: ["5.10.0"] } },
140-
realpath: {
141-
native: { [READ]: { supported: ["9.2.0"] } },
142-
},
143-
realpathSync: {
144-
native: { [READ]: { supported: ["9.2.0"] } },
145-
},
146-
promises: {
147-
[READ]: {
148-
supported: ["11.14.0", "10.17.0"],
149-
experimental: "10.1.0",
150-
},
151-
},
152-
writev: { [READ]: { supported: ["12.9.0"] } },
153-
writevSync: { [READ]: { supported: ["12.9.0"] } },
154-
readv: {
155-
[READ]: { supported: ["13.13.0", "12.17.0"] },
156-
},
157-
readvSync: {
158-
[READ]: { supported: ["13.13.0", "12.17.0"] },
159-
},
160-
lutimes: {
161-
[READ]: { supported: ["14.5.0", "12.19.0"] },
162-
},
163-
lutimesSync: {
164-
[READ]: { supported: ["14.5.0", "12.19.0"] },
165-
},
166-
opendir: {
167-
[READ]: { supported: ["12.12.0"] },
168-
},
169-
opendirSync: {
170-
[READ]: { supported: ["12.12.0"] },
171-
},
172-
rm: {
173-
[READ]: { supported: ["14.14.0"] },
174-
},
175-
rmSync: {
176-
[READ]: { supported: ["14.14.0"] },
177-
},
178-
read: {
179-
[READ]: { supported: ["13.11.0", "12.17.0"] },
180-
},
181-
readSync: {
182-
[READ]: { supported: ["13.11.0", "12.17.0"] },
183-
},
184-
Dir: {
185-
[READ]: { supported: ["12.12.0"] },
186-
},
187-
StatWatcher: {
188-
[READ]: { supported: ["14.3.0", "12.20.0"] },
189-
},
190-
},
191-
"fs/promises": {
192-
[READ]: {
193-
supported: ["14.0.0"],
194-
},
195-
},
196-
http2: {
197-
[READ]: {
198-
supported: ["10.10.0", "8.13.0"],
199-
experimental: "8.4.0",
200-
},
201-
},
202-
inspector: {
203-
[READ]: { supported: null, experimental: "8.0.0" },
204-
},
205-
module: {
206-
Module: {
207-
builtinModules: {
208-
[READ]: {
209-
supported: ["9.3.0", "6.13.0", "8.10.0"],
210-
},
211-
},
212-
createRequireFromPath: { [READ]: { supported: ["10.12.0"] } },
213-
createRequire: { [READ]: { supported: ["12.2.0"] } },
214-
syncBuiltinESMExports: { [READ]: { supported: ["12.12.0"] } },
215-
},
216-
builtinModules: {
217-
[READ]: {
218-
supported: ["9.3.0", "6.13.0", "8.10.0"],
219-
},
220-
},
221-
createRequireFromPath: { [READ]: { supported: ["10.12.0"] } },
222-
createRequire: { [READ]: { supported: ["12.2.0"] } },
223-
syncBuiltinESMExports: { [READ]: { supported: ["12.12.0"] } },
224-
},
225-
os: {
226-
constants: {
227-
[READ]: { supported: ["6.3.0"] },
228-
priority: { [READ]: { supported: ["10.10.0"] } },
229-
},
230-
getPriority: { [READ]: { supported: ["10.10.0"] } },
231-
homedir: { [READ]: { supported: ["2.3.0"] } },
232-
setPriority: { [READ]: { supported: ["10.10.0"] } },
233-
userInfo: { [READ]: { supported: ["6.0.0"] } },
234-
},
235-
path: {
236-
toNamespacedPath: { [READ]: { supported: ["9.0.0"] } },
237-
},
238-
perf_hooks: {
239-
[READ]: { supported: ["8.5.0"] },
240-
monitorEventLoopDelay: { [READ]: { supported: ["11.10.0"] } },
241-
},
242-
process: {
243-
allowedNodeEnvironmentFlags: { [READ]: { supported: ["10.10.0"] } },
244-
argv0: { [READ]: { supported: ["6.4.0"] } },
245-
channel: { [READ]: { supported: ["7.1.0"] } },
246-
cpuUsage: { [READ]: { supported: ["6.1.0"] } },
247-
emitWarning: { [READ]: { supported: ["6.0.0"] } },
248-
getegid: { [READ]: { supported: ["2.0.0"] } },
249-
geteuid: { [READ]: { supported: ["2.0.0"] } },
250-
hasUncaughtExceptionCaptureCallback: {
251-
[READ]: { supported: ["9.3.0"] },
252-
},
253-
hrtime: {
254-
bigint: { [READ]: { supported: ["10.7.0"] } },
255-
},
256-
ppid: {
257-
[READ]: {
258-
supported: ["9.2.0", "6.13.0", "8.10.0"],
259-
},
260-
},
261-
release: { [READ]: { supported: ["3.0.0"] } },
262-
report: {
263-
[READ]: { supported: ["14.0.0"], experimental: "11.8.0" },
264-
},
265-
resourceUsage: { [READ]: { supported: ["12.6.0"] } },
266-
setegid: { [READ]: { supported: ["2.0.0"] } },
267-
seteuid: { [READ]: { supported: ["2.0.0"] } },
268-
setUncaughtExceptionCaptureCallback: {
269-
[READ]: { supported: ["9.3.0"] },
270-
},
271-
stdout: {
272-
getColorDepth: { [READ]: { supported: ["9.9.0"] } },
273-
hasColor: { [READ]: { supported: ["11.13.0"] } },
274-
},
275-
stderr: {
276-
getColorDepth: { [READ]: { supported: ["9.9.0"] } },
277-
hasColor: { [READ]: { supported: ["11.13.0"] } },
278-
},
279-
},
280-
stream: {
281-
Readable: {
282-
from: {
283-
[READ]: { supported: ["12.3.0", "10.17.0"] },
284-
},
285-
},
286-
finished: { [READ]: { supported: ["10.0.0"] } },
287-
pipeline: { [READ]: { supported: ["10.0.0"] } },
288-
},
289-
trace_events: {
290-
[READ]: { supported: ["10.0.0"] },
291-
},
292-
url: {
293-
URL: { [READ]: { supported: ["7.0.0", "6.13.0"] } },
294-
URLSearchParams: {
295-
[READ]: { supported: ["7.5.0", "6.13.0"] },
296-
},
297-
domainToASCII: { [READ]: { supported: ["7.4.0"] } },
298-
domainToUnicode: { [READ]: { supported: ["7.4.0"] } },
299-
},
300-
util: {
301-
callbackify: { [READ]: { supported: ["8.2.0"] } },
302-
formatWithOptions: { [READ]: { supported: ["10.0.0"] } },
303-
getSystemErrorName: {
304-
[READ]: { supported: ["9.7.0", "8.12.0"] },
305-
},
306-
inspect: {
307-
custom: { [READ]: { supported: ["6.6.0"] } },
308-
defaultOptions: { [READ]: { supported: ["6.4.0"] } },
309-
replDefaults: { [READ]: { supported: ["11.12.0"] } },
310-
},
311-
isDeepStrictEqual: { [READ]: { supported: ["9.0.0"] } },
312-
promisify: { [READ]: { supported: ["8.0.0"] } },
313-
TextDecoder: {
314-
[READ]: { supported: ["8.9.0"], experimental: "8.3.0" },
315-
},
316-
TextEncoder: {
317-
[READ]: { supported: ["8.9.0"], experimental: "8.3.0" },
318-
},
319-
types: {
320-
[READ]: { supported: ["10.0.0"] },
321-
isBoxedPrimitive: { [READ]: { supported: ["10.11.0"] } },
322-
},
323-
},
324-
v8: {
325-
[READ]: { supported: ["1.0.0"] },
326-
DefaultDeserializer: { [READ]: { supported: ["8.0.0"] } },
327-
DefaultSerializer: { [READ]: { supported: ["8.0.0"] } },
328-
Deserializer: { [READ]: { supported: ["8.0.0"] } },
329-
Serializer: { [READ]: { supported: ["8.0.0"] } },
330-
cachedDataVersionTag: { [READ]: { supported: ["8.0.0"] } },
331-
deserialize: { [READ]: { supported: ["8.0.0"] } },
332-
getHeapCodeStatistics: { [READ]: { supported: ["12.8.0"] } },
333-
getHeapSnapshot: { [READ]: { supported: ["11.13.0"] } },
334-
getHeapSpaceStatistics: { [READ]: { supported: ["6.0.0"] } },
335-
serialize: { [READ]: { supported: ["8.0.0"] } },
336-
writeHeapSnapshot: { [READ]: { supported: ["11.13.0"] } },
337-
},
338-
vm: {
339-
Module: { [READ]: { supported: ["9.6.0"] } },
340-
compileFunction: { [READ]: { supported: ["10.10.0"] } },
341-
},
342-
worker_threads: {
343-
[READ]: { supported: ["12.11.0"], experimental: "10.5.0" },
344-
},
345-
},
30+
modules: NodeBuiltinModules,
34631
}
34732
Object.assign(trackMap.globals, {
34833
Buffer: trackMap.modules.buffer.Buffer,
@@ -366,8 +51,6 @@ Object.assign(trackMap.globals, {
36651
process: trackMap.modules.process,
36752
})
36853

369-
trackMap.modules = extendTrackMapWithNodePrefix(trackMap.modules)
370-
37154
module.exports = {
37255
meta: {
37356
docs: {

0 commit comments

Comments
 (0)