@es-meta/unicode-gen 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, ESMeta
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # unicode-gen
2
+ A compressed data generator for unicode with specific properties.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ function onFatalError(error) {
4
+ process.exitCode = 2;
5
+ const { version } = require("../package.json");
6
+ console.error(`
7
+ [unicode-gen v${version}] Something went wrong! :(
8
+ ${error}`);
9
+ }
10
+
11
+ (async () => {
12
+ process.on("uncaughtException", onFatalError);
13
+ process.on("unhandledRejection", onFatalError);
14
+ process.exitCode = await require("../dist/index").execute(process.argv);
15
+ })().catch(onFatalError);
package/dist/args.js ADDED
@@ -0,0 +1 @@
1
+ const yargs=require("yargs"),hideBin=require("yargs/helpers")["hideBin"],runner=yargs.scriptName("unicode-gen").usage("Usage: $0 -p [property-name] -o [output-file]").example("$0 -u 14.0.0 -p ID_Start -o id_start.json").option("property",{alias:"p",describe:"The property name of Unicode",type:"string",nargs:1}).requiresArg("property").option("unicode-version",{alias:"u",describe:"The unicode version",type:"string",default:"14.0.0",nargs:1}).option("out",{alias:"o",describe:"The output filename",type:"string",nargs:1}).alias("help","h").version("1.0.0").alias("version","v").wrap(80);function error(e){console.error(`[ERROR] ${e}`),process.exit()}module.exports=function(e){const r=runner.parse(hideBin(e));var{property:o,unicodeVersion:i,out:e}=r;void 0===o&&error("Please input Unicode property with `-p`\n");const n=require("./data")["versions"];return-1===n.indexOf(i)&&(console.log("- possible Unicode version list:"),console.log(n),error(`Invalid unicode version: ${i}`)),void 0===e&&(r.out=`${o}.json`),r};
package/dist/data.js ADDED
@@ -0,0 +1 @@
1
+ const versions=["14.0.0","13.0.0","12.0.0","12.1.0","11.0.0","10.0.0","9.0.0","8.0.0","7.0.0","6.0.0","6.1.0","6.2.0","6.3.0","5.0.0","5.1.0","5.2.0","4.0.0","4.0.1","4.1.0","3.0.0","3.0.1","3.1.0","3.2.0","2.0.14","2.1.2","2.1.5","2.1.8","2.1.9","1.1.5"];module.exports={versions:versions};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ const fs=require("fs"),getArgv=require("./args");async function execute(e){const{property:o,out:r,unicodeVersion:t}=getArgv(e);e=function(e){let o=[],r,t=-1;for(var n of e)-1==t||t+1!=n?(r=[n,n],o.push(r)):r[1]=n,t=n;for(let e=0;e<o.length;e++){var c=o[e];c[0]==c[1]&&(o[e]=c[0])}return o}(function(e){e=`@unicode/unicode-${t}/Binary_Property/${e}/code-points.js`;try{return console.log(`Trying to load the unicode table from ${e}...`),require(e)}catch{console.error("[ERROR] invalid package name"),process.exit(1)}}(o)),e=JSON.stringify(e);return fs.writeFileSync(r,e),console.log(`Dumped compressed unicode table to ${r}.`),0}module.exports={execute:execute};
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@es-meta/unicode-gen",
3
+ "version": "1.0.0",
4
+ "description": "A compressed data generator for unicode with specific properties",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "gulp compress",
9
+ "start": "node dist/index.js",
10
+ "publish": "npm run build && npm publish --access=public"
11
+ },
12
+ "bin": {
13
+ "es-meta": "./bin/unicode-gen.js"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/es-meta/es-meta.git"
18
+ },
19
+ "keywords": [
20
+ "unicode"
21
+ ],
22
+ "author": "Jihyeok Park <jhpjhp0223@gmail.com> (https://park.jihyeok.site/)",
23
+ "license": "BSD-3-Clause",
24
+ "homepage": "https://github.com/es-meta/unicode-gen",
25
+ "dependencies": {
26
+ "@unicode/unicode-1.1.5": "^1.2.1",
27
+ "@unicode/unicode-10.0.0": "^1.2.1",
28
+ "@unicode/unicode-11.0.0": "^1.2.1",
29
+ "@unicode/unicode-12.0.0": "^1.2.1",
30
+ "@unicode/unicode-12.1.0": "^1.2.1",
31
+ "@unicode/unicode-13.0.0": "^1.2.1",
32
+ "@unicode/unicode-14.0.0": "^1.2.1",
33
+ "@unicode/unicode-2.0.14": "^1.2.1",
34
+ "@unicode/unicode-2.1.2": "^1.2.1",
35
+ "@unicode/unicode-2.1.5": "^1.2.1",
36
+ "@unicode/unicode-2.1.8": "^1.2.1",
37
+ "@unicode/unicode-2.1.9": "^1.2.1",
38
+ "@unicode/unicode-3.0.0": "^1.2.1",
39
+ "@unicode/unicode-3.0.1": "^1.2.1",
40
+ "@unicode/unicode-3.1.0": "^1.2.1",
41
+ "@unicode/unicode-3.2.0": "^1.2.1",
42
+ "@unicode/unicode-4.0.0": "^1.2.1",
43
+ "@unicode/unicode-4.0.1": "^1.2.1",
44
+ "@unicode/unicode-4.1.0": "^1.2.1",
45
+ "@unicode/unicode-5.0.0": "^1.2.1",
46
+ "@unicode/unicode-5.1.0": "^1.2.1",
47
+ "@unicode/unicode-5.2.0": "^1.2.1",
48
+ "@unicode/unicode-6.0.0": "^1.2.1",
49
+ "@unicode/unicode-6.1.0": "^1.2.1",
50
+ "@unicode/unicode-6.2.0": "^1.2.1",
51
+ "@unicode/unicode-6.3.0": "^1.2.1",
52
+ "@unicode/unicode-7.0.0": "^1.2.1",
53
+ "@unicode/unicode-8.0.0": "^1.2.1",
54
+ "@unicode/unicode-9.0.0": "^1.2.1",
55
+ "yargs": "^17.0.1"
56
+ },
57
+ "devDependencies": {
58
+ "assert": "^2.0.0",
59
+ "eslint": "^7.28.0",
60
+ "gulp": "^4.0.2",
61
+ "gulp-eslint": "^6.0.0",
62
+ "gulp-uglify": "^3.0.2",
63
+ "set-value": ">=4.0.1"
64
+ },
65
+ "files": [
66
+ "dist"
67
+ ]
68
+ }