@podlite/schema 0.0.83 → 0.0.84
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/CHANGELOG.podlite +16 -0
- package/esm/ast-inerator.js +1 -3
- package/esm/ast-inerator.js.map +1 -1
- package/esm/grammar.js +531 -416
- package/esm/grammar.js.map +1 -1
- package/esm/helpers/flatten-deep.d.ts +2 -0
- package/esm/helpers/flatten-deep.js +32 -0
- package/esm/helpers/flatten-deep.js.map +1 -0
- package/esm/helpers/makeInterator.js +3 -6
- package/esm/helpers/makeInterator.js.map +1 -1
- package/esm/helpers/makeTransformer.js +1 -3
- package/esm/helpers/makeTransformer.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/pluggableParser.js +9 -4
- package/esm/pluggableParser.js.map +1 -1
- package/esm/plugin-group-items.d.ts +4 -1
- package/esm/plugin-group-items.js +41 -7
- package/esm/plugin-group-items.js.map +1 -1
- package/esm/plugin-tables.js +33 -10
- package/esm/plugin-tables.js.map +1 -1
- package/esm/types.d.ts +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/ast-inerator.js +2 -4
- package/lib/grammar.js +531 -416
- package/lib/helpers/flatten-deep.d.ts +2 -0
- package/lib/helpers/flatten-deep.js +35 -0
- package/lib/helpers/makeInterator.js +3 -6
- package/lib/helpers/makeTransformer.js +2 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -2
- package/lib/pluggableParser.js +9 -4
- package/lib/plugin-group-items.d.ts +4 -1
- package/lib/plugin-group-items.js +42 -7
- package/lib/plugin-tables.js +37 -14
- package/lib/types.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/schema/AstTree.json +1 -0
- package/schema/PodliteDocument.json +1 -0
package/lib/ast-inerator.js
CHANGED
|
@@ -3,15 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeInterator = void 0;
|
|
4
4
|
exports.isSemanticBlock = isSemanticBlock;
|
|
5
5
|
const makeQuery_1 = require("./helpers/makeQuery");
|
|
6
|
+
const flatten_deep_1 = require("./helpers/flatten-deep");
|
|
6
7
|
// skip warnings for semantic blocks
|
|
7
8
|
function isSemanticBlock(node) {
|
|
8
9
|
const name = node.name || '';
|
|
9
10
|
const isTypeBlock = (node.type || '') === 'block';
|
|
10
11
|
return isTypeBlock && name === name.toUpperCase();
|
|
11
12
|
}
|
|
12
|
-
function flattenDeep(arr) {
|
|
13
|
-
return arr.reduce((acc, val) => (Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val)), []);
|
|
14
|
-
}
|
|
15
13
|
const makeInterator = rule => {
|
|
16
14
|
let rules = [];
|
|
17
15
|
function use(key, fn) {
|
|
@@ -30,7 +28,7 @@ const makeInterator = rule => {
|
|
|
30
28
|
}
|
|
31
29
|
function visiter(node, context = {}) {
|
|
32
30
|
if (node instanceof Array) {
|
|
33
|
-
return flattenDeep(node.map(item => visiter(item, context))).filter(Boolean);
|
|
31
|
+
return (0, flatten_deep_1.flattenDeep)(node.map(item => visiter(item, context))).filter(Boolean);
|
|
34
32
|
}
|
|
35
33
|
if ('string' === typeof node) {
|
|
36
34
|
// convert string to lex node with type
|