noshift.js 0.6.0 → 0.8.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/README-ja.md CHANGED
@@ -99,6 +99,7 @@ nsc init
99
99
  | `^8` | `(` | | `^,` | `<` |
100
100
  | `^9` | `)` | | `^.` | `>` |
101
101
  | `^-` | `=` | | `^/` | `?` |
102
+ | `^0` | `^` (XOR) | | | |
102
103
 
103
104
  テンプレート式: `^4^[` → `${`
104
105
 
@@ -109,7 +110,7 @@ nsc init
109
110
  ### Hello World
110
111
 
111
112
  ```nsjs
112
- console.log^8^2Hello, World!^2^9;
113
+ console.log^8^2^3hello, ^3world!^2^9;
113
114
  ```
114
115
 
115
116
  ```js
@@ -174,10 +175,10 @@ console.log(result); // 8
174
175
 
175
176
  ```nsjs
176
177
  // ダブルクォート文字列
177
- const s1 ^- ^2Hello^2;
178
+ const s1 ^- ^2^3hello^2;
178
179
 
179
180
  // シングルクォート文字列
180
- const s2 ^- ^7World^7;
181
+ const s2 ^- ^7^3world^7;
181
182
 
182
183
  // テンプレートリテラル
183
184
  const s3 ^- ^@^4^[s1^] ^4^[s2^]^@;
@@ -189,7 +190,7 @@ const s4 ^- ^2quote: \^2^2;
189
190
  ```js
190
191
  const s1 = "Hello";
191
192
  const s2 = 'World';
192
- const s3 = `Hello World`;
193
+ const s3 = `${s1} ${s2}`;
193
194
  const s4 = "quote: ^2";
194
195
  ```
195
196
 
@@ -228,7 +229,7 @@ class ^3animal ^[
228
229
  ^]
229
230
  ^]
230
231
 
231
- const dog ^- new ^3animal^8^2Dog^2^9;
232
+ const dog ^- new ^3animal^8^2^3dog^2^9;
232
233
  dog.speak^8^9;
233
234
  ```
234
235
 
package/README.md CHANGED
@@ -100,6 +100,7 @@ Generated automatically by `nsc init` or `nsc create`.
100
100
  | `^8` | `(` | | `^,` | `<` |
101
101
  | `^9` | `)` | | `^.` | `>` |
102
102
  | `^-` | `=` | | `^/` | `?` |
103
+ | `^0` | `^` (XOR) | | | |
103
104
 
104
105
  Template expression: `^4^[` → `${`
105
106
 
@@ -110,7 +111,7 @@ Template expression: `^4^[` → `${`
110
111
  ### Hello World
111
112
 
112
113
  ```nsjs
113
- console.log^8^2Hello, World!^2^9;
114
+ console.log^8^2^3hello, ^3world!^2^9;
114
115
  ```
115
116
 
116
117
  ```js
@@ -175,10 +176,10 @@ console.log(result); // 8
175
176
 
176
177
  ```nsjs
177
178
  // Double-quote string
178
- const s1 ^- ^2Hello^2;
179
+ const s1 ^- ^2^3hello^2;
179
180
 
180
181
  // Single-quote string
181
- const s2 ^- ^7World^7;
182
+ const s2 ^- ^7^3world^7;
182
183
 
183
184
  // Template literal
184
185
  const s3 ^- ^@^4^[s1^] ^4^[s2^]^@;
@@ -190,7 +191,7 @@ const s4 ^- ^2quote: \^2^2;
190
191
  ```js
191
192
  const s1 = "Hello";
192
193
  const s2 = 'World';
193
- const s3 = `Hello World`;
194
+ const s3 = `${s1} ${s2}`;
194
195
  const s4 = "quote: ^2";
195
196
  ```
196
197
 
@@ -229,7 +230,7 @@ class ^3animal ^[
229
230
  ^]
230
231
  ^]
231
232
 
232
- const dog ^- new ^3animal^8^2Dog^2^9;
233
+ const dog ^- new ^3animal^8^2^3dog^2^9;
233
234
  dog.speak^8^9;
234
235
  ```
235
236
 
@@ -43,8 +43,8 @@ export default async function create(projectNameArg, options = {}) {
43
43
  const pkgPath = path.join(projectPath, "package.json");
44
44
  const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
45
45
  pkg.scripts = pkg.scripts ?? {};
46
- pkg.scripts.compile = "nsc compile";
47
- pkg.scripts.dev = "nsc dev";
46
+ pkg.scripts.compile = "nsc";
47
+ pkg.scripts.dev = "nsc watch";
48
48
  if (usePrettier) {
49
49
  pkg.scripts.format = "prettier --write ./src";
50
50
  }
@@ -90,14 +90,14 @@ export default async function create(projectNameArg, options = {}) {
90
90
 
91
91
  // Install noshift.js
92
92
  logger.step("Installing noshift.js ...");
93
- execSync("npm install noshift.js", { stdio: "ignore" });
93
+ execSync("npm install --save-dev noshift.js", { stdio: "ignore" });
94
94
 
95
95
  // Create project files
96
96
  logger.step("Creating project files ...");
97
97
  await fs.mkdir("src", { recursive: true });
98
98
  await fs.writeFile(
99
99
  "src/index.nsjs",
100
- "console.log^8^2^3hello, ^3world^1^2^9;\n",
100
+ "console.log^8^2^3hello, ^3world!^2^9;\n",
101
101
  );
102
102
 
103
103
  // .gitignore
@@ -111,13 +111,13 @@ A [NoShift.js](https://github.com/otoneko1102/NoShift.js) project.
111
111
  ## Compile
112
112
 
113
113
  \`\`\`bash
114
- npm run compile
114
+ nsc
115
115
  \`\`\`
116
116
 
117
117
  ## Dev (watch mode)
118
118
 
119
119
  \`\`\`bash
120
- npm run dev
120
+ nsc watch
121
121
  \`\`\`
122
122
  `;
123
123
 
@@ -129,6 +129,6 @@ npm run dev
129
129
  console.log("");
130
130
  logger.info("Next steps:");
131
131
  console.log(` ${logger.highlight(`cd ${projectName}`)}`);
132
- console.log(` ${logger.highlight("npm run compile")}`);
132
+ console.log(` ${logger.highlight("nsc")}`);
133
133
  console.log("");
134
134
  }
package/commands/init.js CHANGED
@@ -36,9 +36,7 @@ const PLUGIN_NAME = "prettier-plugin-noshift.js";
36
36
  */
37
37
  async function addPluginToExistingConfig(filePath) {
38
38
  const basename = path.basename(filePath);
39
- const isJson =
40
- basename === ".prettierrc" ||
41
- basename === ".prettierrc.json";
39
+ const isJson = basename === ".prettierrc" || basename === ".prettierrc.json";
42
40
 
43
41
  if (!isJson) {
44
42
  logger.warn(
@@ -77,7 +75,10 @@ async function createPrettierConfig() {
77
75
  trailingComma: "es5",
78
76
  plugins: [PLUGIN_NAME],
79
77
  };
80
- await writeFile(".prettierrc", JSON.stringify(prettierConfig, null, 2) + "\n");
78
+ await writeFile(
79
+ ".prettierrc",
80
+ JSON.stringify(prettierConfig, null, 2) + "\n",
81
+ );
81
82
  logger.success("Created .prettierrc");
82
83
  }
83
84
 
@@ -109,10 +110,7 @@ export default async function init() {
109
110
  logger.success("Overwritten nsjsconfig.json");
110
111
  }
111
112
  } else {
112
- await writeFile(
113
- configPath,
114
- JSON.stringify(DEFAULT_CONFIG, null, 2) + "\n",
115
- );
113
+ await writeFile(configPath, JSON.stringify(DEFAULT_CONFIG, null, 2) + "\n");
116
114
  logger.success("Created nsjsconfig.json");
117
115
  }
118
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noshift.js",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Joke language.",
5
5
  "bin": {
6
6
  "nsc": "./bin/cli.js"
@@ -18,14 +18,16 @@
18
18
  "keywords": [
19
19
  "noshift",
20
20
  "nsjs",
21
- "joke"
21
+ "joke",
22
+ "language",
23
+ "lang"
22
24
  ],
23
25
  "author": "otoneko.",
24
26
  "license": "MIT",
25
27
  "bugs": {
26
28
  "url": "https://github.com/otoneko1102/NoShift.js/issues"
27
29
  },
28
- "homepage": "https://otoneko1102.github.io/NoShift.js/",
30
+ "homepage": "https://noshift.js.org",
29
31
  "dependencies": {
30
32
  "commander": "^14.0.3"
31
33
  },
package/src/convert.js CHANGED
@@ -4,6 +4,7 @@
4
4
  const noShiftMap = {
5
5
  // "^@^@^@": "```", // マルチバックチック
6
6
  "^4^[": "${", // テンプレート式展開開始
7
+ "^0": "^",
7
8
  "^1": "!",
8
9
  "^2": '"',
9
10
  "^4": "$",