Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ debug: clean
OHM_DEBUG=1 make

.PHONY: bench
bench: all scripts/bench.js build/es5.wasm build/json.wasm build/liquid-html.wasm
$(NODE) --expose-gc $(NODE_COMMON_FLAGS) scripts/bench.js
bench: all scripts/bench.ts build/es5.wasm build/json.wasm build/liquid-html.wasm
$(NODE) --expose-gc $(NODE_COMMON_FLAGS) scripts/bench.ts

.PHONY: dist-js
dist-js: build/ohmRuntime.wasm_sections.ts build/ohm-grammar-wasm.ts $(SRC_TS_FILES)
Expand Down
5 changes: 5 additions & 0 deletions packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@
},
"peerDependencies": {
"ohm-js": "workspace:^"
},
"ava": {
"extensions": {
"ts": "module"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {run, bench, group, summary} from 'mitata';
import * as ohm from 'ohm-js';

import * as es5js from '../../../examples/ecmascript/index.js';
import {legacyGrammarToWasm} from '../test/_helpers.js';
import {legacyGrammarToWasm} from '../test/_helpers.ts';

const __dirname = dirname(fileURLToPath(import.meta.url));
const datadir = join(__dirname, '../test/data');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {Bench} from 'tinybench';

import {Grammar} from 'ohm-js';
import {compileGrammars} from '../src/api.ts';
import {unparse} from '../test/_helpers.js';
import {unparse} from '../test/_helpers.ts';
import {createReader} from '../../runtime/src/cstReader.ts';

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as ohm from 'ohm-js-legacy';

import {Grammar} from 'ohm-js';
import {compile} from '../src/api.ts';
import {unparse} from '../test/_helpers.js';
import {unparse} from '../test/_helpers.ts';

const __dirname = dirname(fileURLToPath(import.meta.url));
const datadir = join(__dirname, '../test/data');
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line ava/no-ignored-test-files -- dynamically imported from test-wasm.js
import test from 'ava';
import {compileAndLoad} from './_helpers.js';
import {compileAndLoad} from './_helpers.ts';

test('nested matching with `using`', async t => {
const g = await compileAndLoad('G { Start = letter+ | digit+ }');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Snapshot report for `test/test-wasm.js`
# Snapshot report for `test/test-wasm.ts`

The actual snapshot is saved in `test-wasm.js.snap`.
The actual snapshot is saved in `test-wasm.ts.snap`.

Generated by [AVA](https://avajs.dev).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const execPromise = promisify(exec);

test('benchmark smoke tests', async t => {
const {stdout} = await execPromise(
"node scripts/parseLiquid.js --small-size 'test/data/*.liquid'"
"node scripts/parseLiquid.ts --small-size 'test/data/*.liquid'"
);
t.is(stdout.slice(0, 9), 'JS parse:');
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {readFileSync} from 'node:fs';
import * as ohm from 'ohm-js-legacy';
import {grammar as v18Grammar, grammars as v18Grammars} from 'ohm-js-legacy/v18';

import {matchWithInput, scriptRel, legacyGrammarToWasm} from './_helpers.js';
import {matchWithInput, scriptRel, legacyGrammarToWasm} from './_helpers.ts';

// --- Serializer: reduces a CST node to a plain JSON "shape" ---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';

import {getMatchStats} from 'ohm-js/unstableDebug';
import {compileAndLoad} from './_helpers.js';
import {compileAndLoad} from './_helpers.ts';

test('getMatchStats basic', async t => {
const g = await compileAndLoad('G { start = "a" "b" }');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {performance} from 'node:perf_hooks';
import {fileURLToPath} from 'node:url';

import * as es5js from '../../../examples/ecmascript/index.js';
import {compileAndLoadAll, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.js';
import {compileAndLoadAll, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.ts';

const __dirname = dirname(fileURLToPath(import.meta.url));
const datadir = join(__dirname, 'data');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fc from 'fast-check';
import {readFileSync} from 'node:fs';
import {grammars, grammar} from 'ohm-js-legacy/v18';

import {scriptRel, legacyGrammarToWasm} from './_helpers.js';
import {scriptRel, legacyGrammarToWasm} from './_helpers.ts';

const grammarSource = readFileSync(scriptRel('data/liquid-html.ohm'), 'utf8');
const ns = grammars(grammarSource);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'node:fs';
import * as ohm from 'ohm-js-legacy';
import {performance} from 'perf_hooks';

import {compileAndLoadAll, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.js';
import {compileAndLoadAll, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.ts';

const scriptRel = relPath => new URL(relPath, import.meta.url);
const grammarSource = fs.readFileSync(scriptRel('data/liquid-html.ohm'), 'utf8');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {readFileSync} from 'node:fs';
import {toAST} from 'ohm-js-legacy/extras';
import {grammar as v18Grammar} from 'ohm-js-legacy/v18';

import {compileAndLoad, scriptRel, legacyGrammarToWasm} from './_helpers.js';
import {compileAndLoad, scriptRel, legacyGrammarToWasm} from './_helpers.ts';
import {createToAst} from '@ohm-js/to-ast-compat';

const arithmeticSrc = readFileSync(scriptRel('../../ohm-js/test/data/arithmetic.ohm'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as ohm from 'ohm-js-legacy';
import {performance} from 'perf_hooks';

import {Compiler} from '../src/Compiler.ts';
import {compileAndLoad, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.js';
import {compileAndLoad, matchWithInput, unparse, legacyGrammarToWasm} from './_helpers.ts';

const SIZEOF_UINT32 = 4;

Expand Down Expand Up @@ -1291,7 +1291,7 @@ test('unmanaged MatchResult throws', async t => {
// eslint-disable-next-line no-undef
const nodeMajor = Number(process.versions.node.split('.')[0]);
if (nodeMajor >= 24) {
await import('./_test-v24.js');
await import('./_test-v24.ts');
}

test('nested matching with use()', async t => {
Expand Down
Loading