6
6
7
7
"use strict" ;
8
8
9
- const fs = require ( "fs " ) ;
10
- const path = require ( "path" ) ;
11
- const util = require ( "util" ) ;
12
- const exec = util . promisify ( require ( "child_process" ) . exec ) ;
9
+ const fs = require ( "node:fs/promises " ) ;
10
+ const path = require ( "node: path" ) ;
11
+ const util = require ( "node: util" ) ;
12
+ const exec = util . promisify ( require ( "node: child_process" ) . exec ) ;
13
13
const rollup = require ( "rollup" ) ;
14
14
const excludedFromSlim = require ( "./lib/slim-exclude" ) ;
15
15
const rollupFileOverrides = require ( "./lib/rollup-plugin-file-overrides" ) ;
@@ -38,7 +38,7 @@ const removeWith = {
38
38
} ;
39
39
40
40
async function read ( filename ) {
41
- return fs . promises . readFile ( path . join ( srcFolder , filename ) , "utf8" ) ;
41
+ return fs . readFile ( path . join ( srcFolder , filename ) , "utf8" ) ;
42
42
}
43
43
44
44
// Remove the src folder and file extension
@@ -54,7 +54,7 @@ function moduleName( filename ) {
54
54
async function readdirRecursive ( dir , all = [ ] ) {
55
55
let files ;
56
56
try {
57
- files = await fs . promises . readdir ( path . join ( srcFolder , dir ) , {
57
+ files = await fs . readdir ( path . join ( srcFolder , dir ) , {
58
58
withFileTypes : true
59
59
} ) ;
60
60
} catch ( e ) {
@@ -151,7 +151,7 @@ async function writeCompiled( { code, dir, filename, version } ) {
151
151
// yyyy-mm-ddThh:mmZ
152
152
. replace ( / @ D A T E / g, new Date ( ) . toISOString ( ) . replace ( / : \d + \. \d + Z $ / , "Z" ) ) ;
153
153
154
- await fs . promises . writeFile ( path . join ( dir , filename ) , compiledContents ) ;
154
+ await fs . writeFile ( path . join ( dir , filename ) , compiledContents ) ;
155
155
console . log ( `[${ getTimestamp ( ) } ] ${ filename } v${ version } created.` ) ;
156
156
}
157
157
@@ -194,7 +194,7 @@ async function build( {
194
194
version += "+slim" ;
195
195
}
196
196
197
- await fs . promises . mkdir ( dir , { recursive : true } ) ;
197
+ await fs . mkdir ( dir , { recursive : true } ) ;
198
198
199
199
// Exclude slim modules when slim is true
200
200
const [ excluded , included ] = await checkExclude (
@@ -343,7 +343,7 @@ async function build( {
343
343
// We normally process for dist during minification to save
344
344
// file reads. However, some files are not minified and then
345
345
// we need to do it separately.
346
- const contents = await fs . promises . readFile (
346
+ const contents = await fs . readFile (
347
347
path . join ( dir , filename ) ,
348
348
"utf8"
349
349
) ;
0 commit comments