arche-highlight 0.7.1 → 0.8.1

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.
@@ -219,7 +219,7 @@ function parseJavaScript(text) {
219
219
  parsedElements.push(c)
220
220
  term = ""
221
221
  index += 1
222
- } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "for" || term == "while" || term == "of" || term == "from") {
222
+ } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "if" || term == "for" || term == "while" || term == "of" || term == "from") {
223
223
  parsedElements.push(Span({ class: "keyword" }, term))
224
224
  parsedElements.push(c)
225
225
  term = ""
@@ -268,6 +268,9 @@ function parseJavaScript(text) {
268
268
  }
269
269
  term = ""
270
270
  } else if (c === "(") {
271
+ if (isFunctionDeclaration) {
272
+ isFunctionDeclaration = false
273
+ }
271
274
  if (term === "") {
272
275
  // skip
273
276
  } else if (term == "require" || term == "isNaN") {
package/ArcheHighlight.js CHANGED
@@ -2,11 +2,6 @@
2
2
  * ArcheHighlight may be freely distributed under the CFOSS license.
3
3
  */
4
4
 
5
- (function (root, ArcheHighlight) {
6
- if (typeof module == 'object') (module.exports = ArcheHighlight) // CommonJS
7
- else (root.ArcheHighlight = ArcheHighlight) // Browser
8
- }(typeof globalThis == 'object' ? globalThis : this, (function () { 'use strict'
9
-
10
5
  function testOperatorSymbol(c) {
11
6
  return c === "+" || c === "-" || c === "*" || c === "/" || c === "=" || c === "&" || c === "|" || c === "<" || c === ">" || c === "~" || c === "^" || c === "!" || c === "?" || c === ":"
12
7
  }
@@ -224,7 +219,7 @@ function parseJavaScript(text) {
224
219
  parsedElements.push(c)
225
220
  term = ""
226
221
  index += 1
227
- } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "for" || term == "while" || term == "of" || term == "from") {
222
+ } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "if" || term == "for" || term == "while" || term == "of" || term == "from") {
228
223
  parsedElements.push(Span({ class: "keyword" }, term))
229
224
  parsedElements.push(c)
230
225
  term = ""
@@ -273,6 +268,9 @@ function parseJavaScript(text) {
273
268
  }
274
269
  term = ""
275
270
  } else if (c === "(") {
271
+ if (isFunctionDeclaration) {
272
+ isFunctionDeclaration = false
273
+ }
276
274
  if (term === "") {
277
275
  // skip
278
276
  } else if (term == "require" || term == "isNaN") {
@@ -359,5 +357,8 @@ const ArcheHighlight = {
359
357
  parseJavaScript,
360
358
  }
361
359
 
362
- return ArcheHighlight
363
- }())))
360
+ if (typeof module == "object") {
361
+ module.exports = ArcheHighlight
362
+ } else {
363
+ globalThis.ArcheHighlight = ArcheHighlight
364
+ }
@@ -219,7 +219,7 @@ function parseJavaScript(text) {
219
219
  parsedElements.push(c)
220
220
  term = ""
221
221
  index += 1
222
- } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "for" || term == "while" || term == "of" || term == "from") {
222
+ } else if (term == "import" || term == "new" || term == "async" || term == "await" || term == "if" || term == "for" || term == "while" || term == "of" || term == "from") {
223
223
  parsedElements.push(Span({ class: "keyword" }, term))
224
224
  parsedElements.push(c)
225
225
  term = ""
@@ -268,6 +268,9 @@ function parseJavaScript(text) {
268
268
  }
269
269
  term = ""
270
270
  } else if (c === "(") {
271
+ if (isFunctionDeclaration) {
272
+ isFunctionDeclaration = false
273
+ }
271
274
  if (term === "") {
272
275
  // skip
273
276
  } else if (term == "require" || term == "isNaN") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arche-highlight",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "Syntax highlighting for vanilla microfrontends",
5
5
  "author": "Richard Tong",
6
6
  "license": "CFOSS",