Skip to content

RedCMD/oniguruma-parser-cjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oniguruma-parser-cjs

CommonJS wrapper for oniguruma-parser.

Installation

npm install oniguruma-parser-cjs

Usage

// CommonJS
const { toOnigurumaAst } = require('oniguruma-parser-cjs');
const ast = toOnigurumaAst('A.*');
console.log(ast);

// Optimizer
const { optimize } = require('oniguruma-parser-cjs/optimizer');
const optimized = optimize('[aa]', {
	rules: {
		// `vscode-oniguruma` enables this Oniguruma option by default
		captureGroup: true,
		allowOrphanBackrefs: true,
	},
}).pattern;
console.log(optimized); // a

Development

Setup

# Install dependencies
pnpm install

Building and Testing

# Clean build artifacts
pnpm clean

# Build the package
pnpm build

# Run tests
pnpm test

# Development workflow (clean, build, test)
pnpm dev

Why

The original oniguruma-parser package is ESM-only, which can cause compatibility issues in CommonJS projects. This package provides a pre-built CommonJS version that can be used in any Node.js environment without the need for special configuration.

License

MIT

About

CommonJS wrapper for oniguruma-parser

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published