@shikijs/core 1.15.0 → 1.15.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.
Files changed (2) hide show
  1. package/dist/index.mjs +11 -3
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -6019,6 +6019,9 @@ function construct(pattern, options = {}) {
6019
6019
  );
6020
6020
  }
6021
6021
  const flagSet = new Set(Array.isArray(flags) ? flags : flags.split(""));
6022
+ if (options.ignoreContiguousAnchors) {
6023
+ pattern = pattern.replace(/\\G/g, "");
6024
+ }
6022
6025
  pattern = pattern.replace(/\\A/g, "^").replace(/\\x\{([^}]*)\}/g, (m, hex) => `\\u${hex.padStart(4, "0")}`).replace(/\(\?(-)?(\w+):/g, (_, neg, flagStr) => {
6023
6026
  if (neg) {
6024
6027
  for (const flag of flagStr)
@@ -6069,8 +6072,8 @@ function onigurumaToRegexp(pattern, options = {}) {
6069
6072
  });
6070
6073
  return construct(converted, {
6071
6074
  original: pattern,
6072
- flags,
6073
- ...options
6075
+ ...options,
6076
+ flags: [.../* @__PURE__ */ new Set([...flags, ...options.flags || []])].join("")
6074
6077
  });
6075
6078
  }
6076
6079
 
@@ -6096,8 +6099,13 @@ class JavaScriptScanner {
6096
6099
  }
6097
6100
  try {
6098
6101
  const regex = onigurumaToRegexp(p
6102
+ .replace(/\|\\G(\||\))/g, '$1')
6103
+ .replace(/(\(|\|)\\G\|/g, '$1')
6099
6104
  // YAML specific handling; TODO: move to tm-grammars
6100
- .replaceAll('[^\\s[-?:,\\[\\]{}#&*!|>\'"%@`]]', '[^\\s\\-?:,\\[\\]{}#&*!|>\'"%@`]'), { flags: 'dg' });
6105
+ .replaceAll('[^\\s[-?:,\\[\\]{}#&*!|>\'"%@`]]', '[^\\s\\-?:,\\[\\]{}#&*!|>\'"%@`]'), {
6106
+ flags: 'dgm',
6107
+ ignoreContiguousAnchors: true,
6108
+ });
6101
6109
  cache?.set(p, regex);
6102
6110
  return regex;
6103
6111
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "1.15.0",
4
+ "version": "1.15.1",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "devDependencies": {
66
66
  "hast-util-to-html": "^9.0.2",
67
- "oniguruma-to-js": "^0.2.3",
67
+ "oniguruma-to-js": "^0.2.4",
68
68
  "vscode-oniguruma": "^1.7.0"
69
69
  },
70
70
  "scripts": {