Skip to content

Commit

Permalink
BREAKING CHANGE: Switch to named exports only (fixes #386)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdubroy committed Nov 6, 2022
1 parent 13c8991 commit bea0be9
Show file tree
Hide file tree
Showing 38 changed files with 872 additions and 843 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ packages/ohm-js/dist/ohm-grammar.js.*
packages/ohm-js/dist/*.old
packages/ohm-js/dist/browserify-cache.json
packages/ohm-js/dist/test-typings.js
packages/packaging-tests/test-ts.js
node_modules
npm-debug.log
yarn-error.log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import {readFileSync} from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import {exit} from 'process';

const {raw} = String;
Expand Down
2 changes: 1 addition & 1 deletion examples/ecmascript/src/es6.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import test from 'ava';

import es5 from './es5.js';
Expand Down
2 changes: 1 addition & 1 deletion examples/ecmascript/test/es2015.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import test from 'ava';
import fastGlob from 'fast-glob';
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import path from 'path';
import {fileURLToPath} from 'url';

Expand Down
2 changes: 1 addition & 1 deletion examples/markdown/markdown.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

const H1 = content => ({type: 'H1', content});
const H2 = content => ({type: 'H2', content});
Expand Down
2 changes: 1 addition & 1 deletion examples/operators/operator-example.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// An experiment in representing an expression language four different ways in Ohm.

import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

// The expression language is the classic arithmetic operators over integer literals
// and identifiers, which, in EBNF, is:
Expand Down
2 changes: 1 addition & 1 deletion examples/prettyPrint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import fs from 'fs';
import * as url from 'url';

import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

/*
Usage: prettyPrint.js <filename>
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-lisp/src/simple-lisp.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

export const grammar = ohm.grammar(`
Lisp {
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/src/arithmetic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

/*
In ../package.json, there is a 'generate' script that uses the Ohm command
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/generateBundles/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fastGlob from 'fast-glob';
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import path from 'path';

import {generateTypes} from '../../helpers/generateTypes.js';
Expand Down Expand Up @@ -69,7 +69,7 @@ function generateRecipe(grammarPath, grammars, writer, isEsm) {
const isSingleGrammar = Object.keys(grammars).length === 1;

let output = isEsm ?
"import ohm from 'ohm-js';" :
"import * as ohm from 'ohm-js';" :
"'use strict';const ohm=require('ohm-js');";

// If it's a single-grammar source file, the default export is the grammar.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import assert from 'assert';
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import path from 'path';

function match(inputPath, opts) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/helpers/generateTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import test from 'ava';
import fs from 'fs';
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';
import {dedent} from 'ts-dedent';
import {Project} from 'ts-morph';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/helpers/getNodeTypes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ohm from 'ohm-js';
import * as ohm from 'ohm-js';

const {pexprs} = ohm;

Expand Down
Loading

0 comments on commit bea0be9

Please sign in to comment.