-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.js
38 lines (32 loc) · 985 Bytes
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import fs from 'node:fs'
import path from 'node:path'
import {characterEntitiesLegacy} from 'character-entities-legacy'
import {characterEntities} from 'character-entities'
const entities = Object.keys(characterEntities)
/** @type {Array<string>} */
const conflict = []
let index = -1
while (++index < characterEntitiesLegacy.length) {
const left = characterEntitiesLegacy[index]
let offset = -1
while (++offset < entities.length) {
const right = entities[offset]
if (left !== right && right.slice(0, left.length) === left) {
conflict.push(left)
break
}
}
}
fs.writeFileSync(
path.join('lib', 'constant', 'dangerous.js'),
[
'/**',
' * List of legacy (that don’t need a trailing `;`) named references which could,',
' * depending on what follows them, turn into a different meaning',
' *',
' * @type {Array<string>}',
' */',
'export const dangerous = ' + JSON.stringify(conflict, null, 2),
''
].join('\n')
)