Skip to content

Commit 68d158d

Browse files
committed
Refactor build script
1 parent 82e1b84 commit 68d158d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

build.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// Based on:
22
// <https://github.com/babel/babel/blob/main/packages/babel-helper-validator-identifier/scripts/generate-identifier-regex.js>
33

4-
import fs from 'node:fs'
5-
import path from 'node:path'
4+
import fs from 'node:fs/promises'
65
import regenerate from 'regenerate'
76
// @ts-expect-error untyped.
87
import idStart_ from '@unicode/unicode-15.0.0/Binary_Property/ID_Start/code-points.js'
9-
/** @type {Array<number>} */
108
// @ts-expect-error untyped.
119
import idCont_ from '@unicode/unicode-15.0.0/Binary_Property/ID_Continue/code-points.js'
1210

@@ -19,8 +17,8 @@ const cont = [0x20_0c, 0x20_0d].concat(idCont.filter((d) => bmp(d)))
1917
const startRe = regenerate().add(start).toRegExp()
2018
const contRe = regenerate().add(cont).remove(start).toRegExp()
2119

22-
fs.writeFileSync(
23-
path.join('lib', 'regex.js'),
20+
await fs.writeFile(
21+
new URL('lib/regex.js', import.meta.url),
2422
[
2523
'// This module is generated by `build.js`.',
2624
'export const start = ' + startRe,

0 commit comments

Comments
 (0)