@bablr/cli 0.2.1 → 0.3.0
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.
- package/bin/index.js +8 -8
- package/lib/syntax.js +6 -6
- package/package.json +8 -8
package/bin/index.js
CHANGED
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { program } from 'commander';
|
|
6
6
|
import { streamParse } from 'bablr';
|
|
7
|
-
import {
|
|
8
|
-
embeddedSourceFromReadStream,
|
|
9
|
-
sourceFromReadStream,
|
|
10
|
-
stripTrailingNewline,
|
|
11
|
-
} from '@bablr/helpers/source';
|
|
7
|
+
import { embeddedSourceFrom, readFromStream, stripTrailingNewline } from '@bablr/helpers/source';
|
|
12
8
|
import { debugEnhancers } from '@bablr/helpers/enhancers';
|
|
13
9
|
import colorSupport from 'color-support';
|
|
14
10
|
import { evaluateIO } from '@bablr/io-vm-node';
|
|
@@ -57,11 +53,15 @@ await evaluateIO(
|
|
|
57
53
|
language,
|
|
58
54
|
options.production,
|
|
59
55
|
options.embedded
|
|
60
|
-
?
|
|
61
|
-
: stripTrailingNewline(
|
|
56
|
+
? embeddedSourceFrom(readFromStream(rawStream))
|
|
57
|
+
: stripTrailingNewline(readFromStream(rawStream)),
|
|
62
58
|
{},
|
|
63
59
|
{ enhancers, emitEffects: true },
|
|
64
60
|
).tokens,
|
|
65
|
-
|
|
61
|
+
{
|
|
62
|
+
emitEffects: !!options.verbose,
|
|
63
|
+
color: options.color,
|
|
64
|
+
format: options.format,
|
|
65
|
+
},
|
|
66
66
|
),
|
|
67
67
|
);
|
package/lib/syntax.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* global process Promise */
|
|
2
2
|
|
|
3
|
-
import * as cstml from '@bablr/language-cstml';
|
|
4
|
-
import * as verboseOutput from '@bablr/language-bablr-cli-verbose-output';
|
|
3
|
+
import * as cstml from '@bablr/language-en-cstml';
|
|
4
|
+
import * as verboseOutput from '@bablr/language-en-bablr-cli-verbose-output';
|
|
5
5
|
import { streamParse } from 'bablr/enhanceable';
|
|
6
6
|
import { Coroutine } from '@bablr/coroutine';
|
|
7
7
|
import {
|
|
@@ -98,15 +98,15 @@ export const higlightStrategy = (context, tokens) => {
|
|
|
98
98
|
export const createPrintCSTMLStrategy =
|
|
99
99
|
(tokens, options = {}) =>
|
|
100
100
|
() => {
|
|
101
|
-
const
|
|
101
|
+
const strategyOptions = { emitEffects: options.emitEffects, inline: false };
|
|
102
102
|
const outputInstructions = options.format
|
|
103
|
-
? generatePrettyCSTMLStrategy(tokens,
|
|
104
|
-
: generatePlainCSTMLStrategy(tokens,
|
|
103
|
+
? generatePrettyCSTMLStrategy(tokens, strategyOptions)
|
|
104
|
+
: generatePlainCSTMLStrategy(tokens, strategyOptions);
|
|
105
105
|
|
|
106
106
|
if (options.color) {
|
|
107
107
|
const input = generateAllOutput(outputInstructions);
|
|
108
108
|
|
|
109
|
-
const { context, tokens } = options.
|
|
109
|
+
const { context, tokens } = options.emitEffects
|
|
110
110
|
? streamParse(verboseOutput, 'Output', input)
|
|
111
111
|
: streamParse(cstml, 'Document', input);
|
|
112
112
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/cli",
|
|
3
3
|
"description": "CLI for running BABLR parsers",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@bablr/agast-helpers": "0.
|
|
21
|
-
"@bablr/io-vm-node": "0.2.
|
|
22
|
-
"@bablr/boot": "0.
|
|
20
|
+
"@bablr/agast-helpers": "0.2.0",
|
|
21
|
+
"@bablr/io-vm-node": "0.2.1",
|
|
22
|
+
"@bablr/boot": "0.3.0",
|
|
23
23
|
"@bablr/coroutine": "0.1.0",
|
|
24
|
-
"@bablr/helpers": "0.
|
|
25
|
-
"@bablr/language-cstml": "0.
|
|
26
|
-
"@bablr/language-bablr-cli-verbose-output": "0.
|
|
27
|
-
"bablr": "0.
|
|
24
|
+
"@bablr/helpers": "0.17.0",
|
|
25
|
+
"@bablr/language-en-cstml": "0.4.0",
|
|
26
|
+
"@bablr/language-en-bablr-cli-verbose-output": "0.2.0",
|
|
27
|
+
"bablr": "0.3.0",
|
|
28
28
|
"color-support": "1.1.3",
|
|
29
29
|
"commander": "12.0.0"
|
|
30
30
|
},
|