@canopycanopycanopy/b-ber-grammar-renderer 2.0.0 → 2.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -24
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,27 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
14
-
15
10
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
16
-
17
11
  var _lodash = _interopRequireDefault(require("lodash.isundefined"));
18
-
19
12
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
20
-
21
13
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
22
-
23
14
  var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
24
-
25
15
  // Assign a default object to the `context` argument, since we'll refer to
26
16
  // some of its properties during tests. the properties themselves don't
27
17
  // need to be defined, though
@@ -36,37 +26,33 @@ const renderer = ({
36
26
  minMarkers: _bBerShapesDirectives.BLOCK_DIRECTIVE_MARKER_MIN_LENGTH,
37
27
  markerOpen,
38
28
  markerClose,
39
-
40
29
  validateOpen(params, line) {
41
30
  // Check to see if we've hit an opening/exit token, i.e., `::: <name>:<id>`
42
31
  const match = (0, _trim.default)(params).call(params).match(markerOpen);
43
- if (!match || !match.length) return false; // It's a directive - check to see if it's well-formed.
32
+ if (!match || !match.length) return false;
44
33
 
34
+ // It's a directive - check to see if it's well-formed.
45
35
  const [, type, id] = match;
46
-
47
36
  if ((0, _lodash.default)(id)) {
48
37
  // The directive's missing an `id` attribute, so we extract the
49
38
  // fileName from `context` which we've stored in back in
50
39
  // `md/index.es6`, and passed into our `renderer`
51
- _bBerLogger.default.error(`Missing [id] for [${exports.default.name}:start] at ${context.fileName}.md:${line}`); // Let the parser know that this wasn't a match
52
-
40
+ _bBerLogger.default.error(`Missing [id] for [${exports.default.name}:start] at ${context.fileName}.md:${line}`);
53
41
 
42
+ // Let the parser know that this wasn't a match
54
43
  return false;
55
- } // Add the `id` to the global state so that we can verify that the
56
- // container is being properly closed in our `validateClose` method
57
-
44
+ }
58
45
 
46
+ // Add the `id` to the global state so that we can verify that the
47
+ // container is being properly closed in our `validateClose` method
59
48
  const index = (0, _indexOf.default)(_State.default).call(_State.default, 'cursor', {
60
49
  id
61
50
  });
62
51
  const isOpening = type && type !== 'exit';
63
52
  const isClosing = type && type === 'exit';
64
53
  const inStore = index > -1;
65
-
66
54
  _bBerLogger.default.debug(`id: ${id}; isOpening: ${isOpening}; isClosing: ${isClosing}; type: ${type}, inStore: ${inStore}`);
67
-
68
55
  const location = `${context.fileName}.md:${line}`;
69
-
70
56
  if (isOpening && inStore) {
71
57
  // It's a duplicate `id`
72
58
  _bBerLogger.default.error(`Duplicate [id] [${id}]. [id] must be unique at [${location}]`);
@@ -80,15 +66,12 @@ const renderer = ({
80
66
  id,
81
67
  type
82
68
  });
83
-
84
69
  return true;
85
70
  } else if (isClosing && inStore) {
86
71
  // It's the end of a directive, handle close in section.js
87
72
  return true;
88
73
  }
89
74
  }
90
-
91
75
  });
92
-
93
76
  var _default = renderer;
94
77
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-renderer",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -25,9 +25,9 @@
25
25
  "rimraf": "^2.7.1"
26
26
  },
27
27
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-lib": "2.0.0",
29
- "@canopycanopycanopy/b-ber-logger": "2.0.0",
30
- "@canopycanopycanopy/b-ber-shapes-directives": "2.0.0",
28
+ "@canopycanopycanopy/b-ber-lib": "2.0.2",
29
+ "@canopycanopycanopy/b-ber-logger": "2.0.2",
30
+ "@canopycanopycanopy/b-ber-shapes-directives": "2.0.2",
31
31
  "lodash": "^4.17.21",
32
32
  "lodash.isundefined": "^3.0.1",
33
33
  "tar": "^6.1.11"
@@ -49,5 +49,5 @@
49
49
  "url": "https://maxwellsimmer.com"
50
50
  }
51
51
  ],
52
- "gitHead": "dbeae192709705f5bc211195ff343cbd999f9caf"
52
+ "gitHead": "9b13185f21f602f8a2bf3a4cf503b1fd644d6432"
53
53
  }