@gunshi/resources 0.26.3

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,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 kazuya kawaguchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # @gunshi/resources
2
+
3
+ > built-in localization resources for gunshi
4
+
5
+ This package provides multilingual resources for gunshi.
6
+ っkw
7
+
8
+ ## 💿 Installation
9
+
10
+ ```sh
11
+ # npm
12
+ npm install --save @gunshi/resources
13
+
14
+ # pnpm
15
+ pnpm add @gunshi/resources
16
+
17
+ # yarn
18
+ yarn add @gunshi/resources
19
+
20
+ # deno
21
+ deno add jsr:@gunshi/resources
22
+
23
+ # bun
24
+ bun add @gunshi/resources
25
+ ```
26
+
27
+ ## 🚀 Usage
28
+
29
+ ### Import all locales
30
+
31
+ ```ts
32
+ import resources from '@gunshi/resources'
33
+
34
+ console.log(resources['en-US']) // display en-US reousrces
35
+ console.log(resources['ja-JP']) // display ja-JP resources
36
+ ```
37
+
38
+ ### Import specific locale
39
+
40
+ You can import via sub paths.
41
+
42
+ ```ts
43
+ // English resources
44
+ import enUS from '@gunshi/resources/en-US' with { type: 'json' }
45
+
46
+ // Japanese resources
47
+ import jaJP from '@gunshi/resources/ja-JP' with { type: 'json' }
48
+ ```
49
+
50
+ ## ✨ Built-in Keys
51
+
52
+ Keys for built-in functionalities are handled by Gunshi's default locales. The complete list includes:
53
+
54
+ - `USAGE` - Usage section header
55
+ - `OPTIONS` - Options section header
56
+ - `ARGUMENTS` - Arguments section header
57
+ - `COMMANDS` - Commands section header
58
+ - `EXAMPLES` - Examples section header
59
+ - `FORMORE` - Footer text for additional help
60
+ - `NEGATABLE` - Prefix for negatable options (e.g., "Negatable of --verbose")
61
+ - `DEFAULT` - Prefix for default values (e.g., "default: 5")
62
+ - `CHOICES` - Prefix for available choices (e.g., "choices: red, green, blue")
63
+ - `help` - Description for the help option ("Display this help message")
64
+ - `version` - Description for the version option ("Display this version")
65
+ The following keys are provided for each locale:
66
+
67
+ ## 🌍 Supported Locales
68
+
69
+ - `en-US` - English (United States)
70
+ - `ja-JP` - Japanese (Japan)
71
+
72
+ ## 🧩 Usage in i18n plugin
73
+
74
+ This package is internally used by gunshi plugins, particularly `@gunshi/plugin-i18n` and `@gunshi/plugin-renderer`.
75
+
76
+ ### Example with @gunshi/plugin-i18n
77
+
78
+ ```ts
79
+ import i18n from '@gunshi/plugin-i18n'
80
+ import resources from '@gunshi/resources'
81
+ import { cli } from 'gunshi'
82
+
83
+ await cli(
84
+ args,
85
+ {
86
+ /* your entry command */
87
+ },
88
+ {
89
+ plugins: [
90
+ i18n({
91
+ locale: 'ja-JP',
92
+ resources // Use @gunshi/resources directly
93
+ })
94
+ ]
95
+ }
96
+ )
97
+ ```
98
+
99
+ ### Integration with Custom Resources
100
+
101
+ ```ts
102
+ import resources from '@gunshi/resources'
103
+
104
+ // Extend built-in resources
105
+ const customResources = {
106
+ 'en-US': {
107
+ ...resources['en-US'],
108
+ // Add custom keys
109
+ MY_CUSTOM_KEY: 'My custom message'
110
+ },
111
+ 'ja-JP': {
112
+ ...resources['ja-JP'],
113
+ // Add custom keys
114
+ MY_CUSTOM_KEY: '私のカスタムメッセージ'
115
+ }
116
+ }
117
+ ```
118
+
119
+ ## ©️ License
120
+
121
+ [MIT](http://opensource.org/licenses/MIT)
package/lib/index.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ //#region src/index.d.ts
2
+ /**
3
+ * @author kazuya kawaguchi (a.k.a. kazupon)
4
+ * @license MIT
5
+ */
6
+ declare const _default: {
7
+ 'en-US': {
8
+ COMMAND: string;
9
+ COMMANDS: string;
10
+ SUBCOMMAND: string;
11
+ USAGE: string;
12
+ ARGUMENTS: string;
13
+ OPTIONS: string;
14
+ EXAMPLES: string;
15
+ FORMORE: string;
16
+ NEGATABLE: string;
17
+ DEFAULT: string;
18
+ CHOICES: string;
19
+ help: string;
20
+ version: string;
21
+ };
22
+ 'ja-JP': {
23
+ COMMAND: string;
24
+ COMMANDS: string;
25
+ SUBCOMMAND: string;
26
+ USAGE: string;
27
+ ARGUMENTS: string;
28
+ OPTIONS: string;
29
+ EXAMPLES: string;
30
+ FORMORE: string;
31
+ NEGATABLE: string;
32
+ DEFAULT: string;
33
+ CHOICES: string;
34
+ help: string;
35
+ version: string;
36
+ };
37
+ }; //#endregion
38
+ export { _default as default };
package/lib/index.js ADDED
@@ -0,0 +1,70 @@
1
+ //#region locales/en-US.json
2
+ var COMMAND$1 = "COMMAND";
3
+ var COMMANDS$1 = "COMMANDS";
4
+ var SUBCOMMAND$1 = "SUBCOMMAND";
5
+ var USAGE$1 = "USAGE";
6
+ var ARGUMENTS$1 = "ARGUMENTS";
7
+ var OPTIONS$1 = "OPTIONS";
8
+ var EXAMPLES$1 = "EXAMPLES";
9
+ var FORMORE$1 = "For more info, run any command with the `--help` flag";
10
+ var NEGATABLE$1 = "Negatable of";
11
+ var DEFAULT$1 = "default";
12
+ var CHOICES$1 = "choices";
13
+ var help$1 = "Display this help message";
14
+ var version$1 = "Display this version";
15
+ var en_US_default = {
16
+ COMMAND: COMMAND$1,
17
+ COMMANDS: COMMANDS$1,
18
+ SUBCOMMAND: SUBCOMMAND$1,
19
+ USAGE: USAGE$1,
20
+ ARGUMENTS: ARGUMENTS$1,
21
+ OPTIONS: OPTIONS$1,
22
+ EXAMPLES: EXAMPLES$1,
23
+ FORMORE: FORMORE$1,
24
+ NEGATABLE: NEGATABLE$1,
25
+ DEFAULT: DEFAULT$1,
26
+ CHOICES: CHOICES$1,
27
+ help: help$1,
28
+ version: version$1
29
+ };
30
+
31
+ //#endregion
32
+ //#region locales/ja-JP.json
33
+ var COMMAND = "コマンド";
34
+ var COMMANDS = "コマンド";
35
+ var SUBCOMMAND = "サブコマンド";
36
+ var USAGE = "使い方";
37
+ var ARGUMENTS = "引数";
38
+ var OPTIONS = "オプション";
39
+ var EXAMPLES = "例";
40
+ var FORMORE = "詳細は、コマンドと`--help`フラグを実行してください";
41
+ var NEGATABLE = "否定可能な";
42
+ var DEFAULT = "デフォルト";
43
+ var CHOICES = "選択肢";
44
+ var help = "このヘルプメッセージを表示";
45
+ var version = "このバージョンを表示";
46
+ var ja_JP_default = {
47
+ COMMAND,
48
+ COMMANDS,
49
+ SUBCOMMAND,
50
+ USAGE,
51
+ ARGUMENTS,
52
+ OPTIONS,
53
+ EXAMPLES,
54
+ FORMORE,
55
+ NEGATABLE,
56
+ DEFAULT,
57
+ CHOICES,
58
+ help,
59
+ version
60
+ };
61
+
62
+ //#endregion
63
+ //#region src/index.ts
64
+ var src_default = {
65
+ "en-US": en_US_default,
66
+ "ja-JP": ja_JP_default
67
+ };
68
+
69
+ //#endregion
70
+ export { src_default as default };
@@ -0,0 +1,15 @@
1
+ {
2
+ "COMMAND": "COMMAND",
3
+ "COMMANDS": "COMMANDS",
4
+ "SUBCOMMAND": "SUBCOMMAND",
5
+ "USAGE": "USAGE",
6
+ "ARGUMENTS": "ARGUMENTS",
7
+ "OPTIONS": "OPTIONS",
8
+ "EXAMPLES": "EXAMPLES",
9
+ "FORMORE": "For more info, run any command with the `--help` flag",
10
+ "NEGATABLE": "Negatable of",
11
+ "DEFAULT": "default",
12
+ "CHOICES": "choices",
13
+ "help": "Display this help message",
14
+ "version": "Display this version"
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "COMMAND": "コマンド",
3
+ "COMMANDS": "コマンド",
4
+ "SUBCOMMAND": "サブコマンド",
5
+ "USAGE": "使い方",
6
+ "ARGUMENTS": "引数",
7
+ "OPTIONS": "オプション",
8
+ "EXAMPLES": "例",
9
+ "FORMORE": "詳細は、コマンドと`--help`フラグを実行してください",
10
+ "NEGATABLE": "否定可能な",
11
+ "DEFAULT": "デフォルト",
12
+ "CHOICES": "選択肢",
13
+ "help": "このヘルプメッセージを表示",
14
+ "version": "このバージョンを表示"
15
+ }
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@gunshi/resources",
3
+ "description": "built-in localization resources for gunshi",
4
+ "version": "0.26.3",
5
+ "author": {
6
+ "name": "kazuya kawaguchi",
7
+ "email": "kawakazu80@gmail.com"
8
+ },
9
+ "license": "MIT",
10
+ "funding": "https://github.com/sponsors/kazupon",
11
+ "bugs": {
12
+ "url": "https://github.com/kazupon/gunshi/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/kazupon/gunshi.git",
17
+ "directory": "packages/resources"
18
+ },
19
+ "keywords": [
20
+ "gunshi",
21
+ "l10n",
22
+ "localization",
23
+ "cli"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "engines": {
29
+ "node": ">= 20"
30
+ },
31
+ "type": "module",
32
+ "files": [
33
+ "lib",
34
+ "locales"
35
+ ],
36
+ "module": "lib/index.js",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./lib/index.d.ts",
40
+ "import": "./lib/index.js",
41
+ "require": "./lib/index.js",
42
+ "default": "./lib/index.js"
43
+ },
44
+ "./en-US": {
45
+ "import": "./locales/en-US.json",
46
+ "require": "./locales/en-US.json",
47
+ "default": "./locales/en-US.json"
48
+ },
49
+ "./ja-JP": {
50
+ "import": "./locales/ja-JP.json",
51
+ "require": "./locales/ja-JP.json",
52
+ "default": "./locales/ja-JP.json"
53
+ },
54
+ "./package.json": "./package.json"
55
+ },
56
+ "types": "lib/index.d.ts",
57
+ "typesVersions": {
58
+ "*": {
59
+ "*": [
60
+ "./lib/*",
61
+ "./*"
62
+ ]
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "^22.15.29",
67
+ "deno": "^2.3.3",
68
+ "jsr": "^0.13.4",
69
+ "jsr-exports-lint": "^0.4.1",
70
+ "publint": "^0.3.12",
71
+ "tsdown": "^0.12.3"
72
+ },
73
+ "scripts": {
74
+ "build": "tsdown",
75
+ "lint:jsr": "jsr publish --dry-run --allow-dirty",
76
+ "typecheck:deno": "deno check ./src"
77
+ }
78
+ }