Skip to content

Commit d27a16f

Browse files
authored
feat: support Unicode 12.1.0 (#256)
BREAKING CHANGE: upgrade Unicode data from v10.0.0 to v12.1.0
1 parent 8678060 commit d27a16f

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: node_js
22

33
node_js:
4-
- 4
54
- stable
65

76
before_install:
@@ -10,6 +9,9 @@ before_install:
109
script:
1110
- yarn run lint
1211
- yarn run test
12+
# yarn does not support node 4
13+
- nvm install 4
14+
- npm run test
1315

1416
after_script:
1517
- codecov

LICENSE-3RD-PARTY.txt renamed to ThirdPartyNoticeText.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
This project incorporates third party material from the projects listed below.
2+
The original copyright notice and the license under which we received such third
3+
party material are set forth below.
4+
5+
================================================================================
6+
17
https://github.com/mathiasbynens/node-unicode-data
28

39
Copyright Mathias Bynens <https://mathiasbynens.be/>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
"tslint-config-prettier": "1.18.0",
4949
"tslint-plugin-prettier": "2.0.1",
5050
"typescript": "2.9.2",
51-
"unicode-10.0.0": "0.7.5"
51+
"unicode-12.1.0": "0.8.0"
5252
},
5353
"engines": {
5454
"node": ">= 4"
5555
},
5656
"files": [
5757
"/lib/**/*",
58-
"/LICENSE-3RD-PARTY.txt"
58+
"/ThirdPartyNoticeText.txt"
5959
]
6060
}

scripts/generate.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import * as path from 'path';
55
import { format } from 'prettier';
66
import { Charset, CharsetDataUnit } from 'regexp-util';
77

8-
const data_id = 'unicode-10.0.0';
8+
const data_id = 'unicode-12.1.0';
9+
10+
const is_supported = (category: string) => category !== 'Sequence_Property';
911

1012
// tslint:disable-next-line:no-var-requires
1113
const category_maps: Record<string, string[]> = require(data_id);
@@ -18,6 +20,7 @@ fs.writeFileSync(
1820
types_filename,
1921
format(
2022
`// tslint:disable\nexport interface Category {${Object.keys(category_maps)
23+
.filter(is_supported)
2124
.map(category => {
2225
const sub_categories = category_maps[category];
2326
return `${JSON.stringify(category)}: Array<${
@@ -37,7 +40,7 @@ const data_dirname = path.join(src_dirname, 'data.generated');
3740
del.sync(data_dirname);
3841
mkdir.sync(data_dirname);
3942

40-
for (const category of Object.keys(category_maps)) {
43+
for (const category of Object.keys(category_maps).filter(is_supported)) {
4144
const sub_dirname = path.join(data_dirname, category);
4245
fs.mkdirSync(sub_dirname);
4346

@@ -55,8 +58,8 @@ for (const category of Object.keys(category_maps)) {
5558
fs.writeFileSync(
5659
`${filename}.json`,
5760
JSON.stringify(
58-
content.data.map(
59-
([start, end]) => (start === end ? start : [start, end]),
61+
content.data.map(([start, end]) =>
62+
start === end ? start : [start, end],
6063
),
6164
),
6265
);

yarn.lock

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,9 +3681,10 @@ uglify-js@^3.1.4:
36813681
commander "~2.20.0"
36823682
source-map "~0.6.1"
36833683

3684-
unicode-10.0.0@0.7.5:
3685-
version "0.7.5"
3686-
resolved "https://registry.yarnpkg.com/unicode-10.0.0/-/unicode-10.0.0-0.7.5.tgz#7f67a1fb5cb295db843e91180fe63aa6241b312c"
3684+
unicode-12.1.0@0.8.0:
3685+
version "0.8.0"
3686+
resolved "https://registry.yarnpkg.com/unicode-12.1.0/-/unicode-12.1.0-0.8.0.tgz#260f6dd899eefd42a8eae550bcbb62654c90c79d"
3687+
integrity sha512-OhxidkE3tKlMAouqWtdYtDP2RHVIo1lNdjEruNdVxLrACcbw79TaOcupYKxz6F7ldC1nx8CDygzN5kGmXAU60Q==
36873688

36883689
union-value@^1.0.0:
36893690
version "1.0.0"

0 commit comments

Comments
 (0)