@jackens/nnn 2024.1.2 → 2024.1.16

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/nanolightJs.js CHANGED
@@ -6,16 +6,16 @@ import { nanolight } from './nanolight.js'
6
6
  */
7
7
  // @ts-ignore
8
8
  export const nanolightJs = nanolight.bind(0,
9
- /('.*?'|".*?"|`[\s\S]*?`)|(\/\/.*?\n|\/\*[\s\S]*?\*\/)|(break|case|catch|const|continue|debugger|default|delete|do|else|eval|export\s+type|export|extends|false|finally|for|from|function|goto|if|import|in|instanceof|is|keyof|let|NaN|new|null|package|return|super|switch|this|throw|true|try|typeof|undefined|var|void|while|with|yield)(?!\w)|([<>=.?:&|!~*/%+-])|(0x[\dabcdef]+|0o[01234567]+|0b[01]+|\d+(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?)|([$\w]+)(?=\()|([$\wąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+)/,
9
+ /('.*?'|".*?"|`[\s\S]*?`)|(\/\/.*?\n|\/\*[\s\S]*?\*\/)|(any|bigint|break|boolean|case|catch|const|continue|debugger|default|delete|do|else|eval|export|extends|false|finally|for|from|function|goto|if|import|in|instanceof|is|keyof|let|NaN|new|number|null|package|return|string|super|switch|symbol|this|throw|true|try|type|typeof|undefined|unknown|var|void|while|with|yield)(?!\w)|([<>=.?:&|!~*/%+-])|(0x[\dabcdef]+|0o[01234567]+|0b[01]+|\d+(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?)|([$\w]+)(?=\()|([$\wąćęłńóśżźĄĆĘŁŃÓŚŻŹ]+)/,
10
10
  [
11
- chunk => chunk, // no match
12
- chunk => ['u', chunk], // string literals
13
- chunk => ['em', chunk], // comments
14
- chunk => ['b', chunk], // keywords
15
- chunk => ['b', chunk], // operators
16
- chunk => ['u', chunk], // number literals
17
- chunk => ['ins', chunk], // function calls
18
- chunk => ['i', chunk] // literals
11
+ chunk => chunk,
12
+ chunk => ['span', { class: 'string' }, chunk],
13
+ chunk => ['span', { class: 'comment' }, chunk],
14
+ chunk => ['span', { class: 'keyword' }, chunk],
15
+ chunk => ['span', { class: 'operator' }, chunk],
16
+ chunk => ['span', { class: 'number' }, chunk],
17
+ chunk => ['span', { class: 'function' }, chunk],
18
+ chunk => ['span', { class: 'literal' }, chunk]
19
19
  ]
20
20
  )
21
21
 
@@ -24,6 +24,6 @@ export const tests = {
24
24
  const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
25
25
 
26
26
  console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
27
- '<pre><code><b>const</b> <i>answerToLifeTheUniverseAndEverything</i> <b>=</b> <u>42</u></code></pre>')
27
+ '<pre><code><span class="keyword">const</span> <span class="literal">answerToLifeTheUniverseAndEverything</span> <span class="operator">=</span> <span class="number">42</span></code></pre>')
28
28
  }
29
29
  }
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "types": "nnn.d.ts",
41
41
  "name": "@jackens/nnn",
42
42
  "type": "module",
43
- "version": "2024.1.2"
43
+ "version": "2024.1.16"
44
44
  }
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Jackens’ JavaScript helpers.
4
4
 
5
- <sub>Version: <code class="version">2024.1.2</code></sub>
5
+ <sub>Version: <code class="version">2024.1.16</code></sub>
6
6
 
7
7
  ## Installation
8
8
 
@@ -764,7 +764,7 @@ A helper for highlighting JavaScript.
764
764
  const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
765
765
 
766
766
  console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
767
- '<pre><code><b>const</b> <i>answerToLifeTheUniverseAndEverything</i> <b>=</b> <u>42</u></code></pre>')
767
+ '<pre><code><span class="keyword">const</span> <span class="literal">answerToLifeTheUniverseAndEverything</span> <span class="operator">=</span> <span class="number">42</span></code></pre>')
768
768
  ```
769
769
 
770
770
  ### plUral