New:Socket for Asana Is Now Available.Learn more
Get Started

@shikijs/engine-javascript

Package Overview
Dependencies
Maintainers
3
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shikijs/engine-javascript - npm Package Compare versions

Comparing version
4.3.1
to
4.4.0
+63
dist/engine-compile-Bdn9ihA2.d.mts
import { ToRegExpOptions } from "oniguruma-to-es";
import { PatternScanner, RegexEngine, RegexEngineString } from "@shikijs/types";
import { IOnigMatch } from "@shikijs/vscode-textmate";
//#region src/scanner.d.ts
interface JavaScriptRegexScannerOptions {
/**
* Whether to allow invalid regex patterns.
*
* @default false
*/
forgiving?: boolean;
/**
* Cache for regex patterns.
*/
cache?: Map<string, RegExp | Error> | null;
/**
* Custom pattern to RegExp constructor.
*
* By default `oniguruma-to-es` is used.
*/
regexConstructor?: (pattern: string) => RegExp;
}
declare class JavaScriptScanner implements PatternScanner {
patterns: (string | RegExp)[];
options: JavaScriptRegexScannerOptions;
regexps: (RegExp | null)[];
constructor(patterns: (string | RegExp)[], options?: JavaScriptRegexScannerOptions);
findNextMatchSync(string: string | RegexEngineString, startPosition: number, _options: number): IOnigMatch | null;
}
//#endregion
//#region src/engine-compile.d.ts
interface JavaScriptRegexEngineOptions extends JavaScriptRegexScannerOptions {
/**
* The target ECMAScript version.
*
* Oniguruma-To-ES uses RegExp features from later versions of ECMAScript to add support for a
* few more grammars. If using target `ES2024` or later, the RegExp `v` flag is used which
* requires Node.js 20+ or Chrome 112+.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets
*
* For maximum compatibility, you can set it to `ES2018` which uses the RegExp `u` flag.
*
* Set to `auto` to automatically detect the latest version supported by the environment.
*
* @default 'auto'
*/
target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018';
}
/**
* The default regex constructor for the JavaScript RegExp engine.
*/
declare function defaultJavaScriptRegexConstructor(pattern: string, options?: ToRegExpOptions): RegExp;
/**
* Use the modern JavaScript RegExp engine to implement the OnigScanner.
*
* As Oniguruma supports some features that can't be emulated using native JavaScript regexes, some
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
*/
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
//#endregion
export { JavaScriptScanner as a, JavaScriptRegexScannerOptions as i, createJavaScriptRegexEngine as n, defaultJavaScriptRegexConstructor as r, JavaScriptRegexEngineOptions as t };
+1
-1

@@ -1,2 +0,2 @@

import { n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-CMRQUZTL.mjs";
import { n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-Bdn9ihA2.mjs";
export { JavaScriptRegexEngineOptions, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
import { RegexEngine } from "@shikijs/types";
//#region src/engine-raw.d.ts

@@ -4,0 +3,0 @@ /**

@@ -1,3 +0,3 @@

import { a as JavaScriptScanner, i as JavaScriptRegexScannerOptions, n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-CMRQUZTL.mjs";
import { a as JavaScriptScanner, i as JavaScriptRegexScannerOptions, n as createJavaScriptRegexEngine, r as defaultJavaScriptRegexConstructor, t as JavaScriptRegexEngineOptions } from "./engine-compile-Bdn9ihA2.mjs";
import { createJavaScriptRawEngine } from "./engine-raw.mjs";
export { JavaScriptRegexEngineOptions, JavaScriptRegexScannerOptions, JavaScriptScanner, createJavaScriptRawEngine, createJavaScriptRegexEngine, defaultJavaScriptRegexConstructor };
{
"name": "@shikijs/engine-javascript",
"type": "module",
"version": "4.3.1",
"version": "4.4.0",
"description": "Engine for Shiki using JavaScript's native RegExp",

@@ -36,3 +36,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"oniguruma-to-es": "^4.3.6",
"@shikijs/types": "4.3.1"
"@shikijs/types": "4.4.0"
},

@@ -39,0 +39,0 @@ "scripts": {

import { ToRegExpOptions } from "oniguruma-to-es";
import { PatternScanner, RegexEngine, RegexEngineString } from "@shikijs/types";
import { IOnigMatch } from "@shikijs/vscode-textmate";
//#region src/scanner.d.ts
interface JavaScriptRegexScannerOptions {
/**
* Whether to allow invalid regex patterns.
*
* @default false
*/
forgiving?: boolean;
/**
* Cache for regex patterns.
*/
cache?: Map<string, RegExp | Error> | null;
/**
* Custom pattern to RegExp constructor.
*
* By default `oniguruma-to-es` is used.
*/
regexConstructor?: (pattern: string) => RegExp;
}
declare class JavaScriptScanner implements PatternScanner {
patterns: (string | RegExp)[];
options: JavaScriptRegexScannerOptions;
regexps: (RegExp | null)[];
constructor(patterns: (string | RegExp)[], options?: JavaScriptRegexScannerOptions);
findNextMatchSync(string: string | RegexEngineString, startPosition: number, _options: number): IOnigMatch | null;
}
//#endregion
//#region src/engine-compile.d.ts
interface JavaScriptRegexEngineOptions extends JavaScriptRegexScannerOptions {
/**
* The target ECMAScript version.
*
* Oniguruma-To-ES uses RegExp features from later versions of ECMAScript to add support for a
* few more grammars. If using target `ES2024` or later, the RegExp `v` flag is used which
* requires Node.js 20+ or Chrome 112+.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets
*
* For maximum compatibility, you can set it to `ES2018` which uses the RegExp `u` flag.
*
* Set to `auto` to automatically detect the latest version supported by the environment.
*
* @default 'auto'
*/
target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018';
}
/**
* The default regex constructor for the JavaScript RegExp engine.
*/
declare function defaultJavaScriptRegexConstructor(pattern: string, options?: ToRegExpOptions): RegExp;
/**
* Use the modern JavaScript RegExp engine to implement the OnigScanner.
*
* As Oniguruma supports some features that can't be emulated using native JavaScript regexes, some
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
*/
declare function createJavaScriptRegexEngine(options?: JavaScriptRegexEngineOptions): RegexEngine;
//#endregion
export { JavaScriptScanner as a, JavaScriptRegexScannerOptions as i, createJavaScriptRegexEngine as n, defaultJavaScriptRegexConstructor as r, JavaScriptRegexEngineOptions as t };