@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 +10 -10
- package/package.json +1 -1
- package/readme.md +2 -2
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
|
|
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,
|
|
12
|
-
chunk => ['
|
|
13
|
-
chunk => ['
|
|
14
|
-
chunk => ['
|
|
15
|
-
chunk => ['
|
|
16
|
-
chunk => ['
|
|
17
|
-
chunk => ['
|
|
18
|
-
chunk => ['
|
|
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><
|
|
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
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.
|
|
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><
|
|
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
|