@canopycanopycanopy/b-ber-grammar-renderer 3.0.8-next.61 → 3.0.8-next.97

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.
@@ -0,0 +1,21 @@
1
+ //#region src/index.d.ts
2
+ declare const renderer: ({
3
+ context,
4
+ render,
5
+ markerOpen,
6
+ markerClose
7
+ }: {
8
+ context?: {} | undefined;
9
+ render: any;
10
+ markerOpen: any;
11
+ markerClose: any;
12
+ }) => {
13
+ render: any;
14
+ marker: string;
15
+ minMarkers: number;
16
+ markerOpen: any;
17
+ markerClose: any;
18
+ validateOpen(params: any, line: any): boolean | undefined;
19
+ };
20
+ export = renderer;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";cAWM,QAAA;EAAY,OAAA;EAAA,MAAA;EAAA,UAAA;EAAA;AAAA"}
package/dist/index.js CHANGED
@@ -1,76 +1,62 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let _canopycanopycanopy_b_ber_lib = require("@canopycanopycanopy/b-ber-lib");
24
+ let _canopycanopycanopy_b_ber_logger = require("@canopycanopycanopy/b-ber-logger");
25
+ _canopycanopycanopy_b_ber_logger = __toESM(_canopycanopycanopy_b_ber_logger);
26
+ let _canopycanopycanopy_b_ber_shapes_directives = require("@canopycanopycanopy/b-ber-shapes-directives");
27
+ let lodash_isUndefined_js = require("lodash/isUndefined.js");
28
+ lodash_isUndefined_js = __toESM(lodash_isUndefined_js);
29
+ //#region src/index.ts
30
+ const renderer = ({ context = {}, render, markerOpen, markerClose }) => ({
31
+ render,
32
+ marker: _canopycanopycanopy_b_ber_shapes_directives.BLOCK_DIRECTIVE_MARKER,
33
+ minMarkers: _canopycanopycanopy_b_ber_shapes_directives.BLOCK_DIRECTIVE_MARKER_MIN_LENGTH,
34
+ markerOpen,
35
+ markerClose,
36
+ validateOpen(params, line) {
37
+ const match = params.trim().match(markerOpen);
38
+ if (!match || !match.length) return false;
39
+ const [, type, id] = match;
40
+ if ((0, lodash_isUndefined_js.default)(id)) {
41
+ _canopycanopycanopy_b_ber_logger.default.error(`Missing [id] for [${type}:start] at ${context.fileName}.md:${line}`);
42
+ return false;
43
+ }
44
+ const index = _canopycanopycanopy_b_ber_lib.State.indexOf("cursor", { id });
45
+ const isOpening = type && type !== "exit";
46
+ const isClosing = type && type === "exit";
47
+ const inStore = index > -1;
48
+ _canopycanopycanopy_b_ber_logger.default.debug(`id: ${id}; isOpening: ${isOpening}; isClosing: ${isClosing}; type: ${type}, inStore: ${inStore}`);
49
+ const location = `${context.fileName}.md:${line}`;
50
+ if (isOpening && inStore) _canopycanopycanopy_b_ber_logger.default.error(`Duplicate [id] [${id}]. [id] must be unique at [${location}]`);
51
+ else if (isClosing && !inStore) return false;
52
+ else if (isOpening && !inStore) {
53
+ _canopycanopycanopy_b_ber_lib.State.add("cursor", {
54
+ id,
55
+ type
56
+ });
57
+ return true;
58
+ } else if (isClosing && inStore) return true;
59
+ }
7
60
  });
8
- exports.default = void 0;
9
- var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
10
- var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
11
- var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
12
- var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
13
- var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
14
- var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
15
- // Assign a default object to the `context` argument, since we'll refer to
16
- // some of its properties during tests. the properties themselves don't
17
- // need to be defined, though
18
- const renderer = ({
19
- context = {},
20
- render,
21
- markerOpen,
22
- markerClose
23
- }) => ({
24
- render,
25
- marker: _bBerShapesDirectives.BLOCK_DIRECTIVE_MARKER,
26
- minMarkers: _bBerShapesDirectives.BLOCK_DIRECTIVE_MARKER_MIN_LENGTH,
27
- markerOpen,
28
- markerClose,
29
- validateOpen(params, line) {
30
- // Check to see if we've hit an opening/exit token, i.e., `::: <name>:<id>`
31
- const match = (0, _trim.default)(params).call(params).match(markerOpen);
32
- if (!match || !match.length) return false;
33
-
34
- // It's a directive - check to see if it's well-formed.
35
- const [, type, id] = match;
36
- if ((0, _isUndefined.default)(id)) {
37
- // The directive's missing an `id` attribute, so we extract the
38
- // fileName from `context` which we've stored in back in
39
- // `md/index.es6`, and passed into our `renderer`
40
- _bBerLogger.default.error(`Missing [id] for [${type}:start] at ${context.fileName}.md:${line}`);
41
-
42
- // Let the parser know that this wasn't a match
43
- return false;
44
- }
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
48
- const index = (0, _indexOf.default)(_State.default).call(_State.default, 'cursor', {
49
- id
50
- });
51
- const isOpening = type && type !== 'exit';
52
- const isClosing = type && type === 'exit';
53
- const inStore = index > -1;
54
- _bBerLogger.default.debug(`id: ${id}; isOpening: ${isOpening}; isClosing: ${isClosing}; type: ${type}, inStore: ${inStore}`);
55
- const location = `${context.fileName}.md:${line}`;
56
- if (isOpening && inStore) {
57
- // It's a duplicate `id`
58
- _bBerLogger.default.error(`Duplicate [id] [${id}]. [id] must be unique at [${location}]`);
59
- } else if (isClosing && !inStore) {
60
- // Trying to close an un-opened directive, but it might belong to a
61
- // different directive type
62
- return false;
63
- } else if (isOpening && !inStore) {
64
- // It's a new directive
65
- _State.default.add('cursor', {
66
- id,
67
- type
68
- });
69
- return true;
70
- } else if (isClosing && inStore) {
71
- // It's the end of a directive, handle close in section.js
72
- return true;
73
- }
74
- }
75
- });
76
- var _default = exports.default = renderer;
61
+ //#endregion
62
+ module.exports = renderer;
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-grammar-renderer",
3
- "version": "3.0.8-next.61+2bbec564",
3
+ "version": "3.0.8-next.97+2e9748e6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "prepare:dist": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --ignore **/__tests__/**",
8
- "clean": "rimraf dist",
9
- "prepare": "npm run clean && npm run prepare:dist",
10
- "build": "npm run prepare",
11
- "watch": "BABEL_ENV=production babel --config-file ../../babel.config.js -d dist/ src/ --watch src",
7
+ "build": "tsdown",
8
+ "typecheck": "tsc --noEmit",
12
9
  "test": "jest"
13
10
  },
14
11
  "author": "Triple Canopy <b-ber@canopycanopycanopy.com> (https://triplecanopy.github.io/)",
@@ -17,17 +14,17 @@
17
14
  "access": "public"
18
15
  },
19
16
  "devDependencies": {
20
- "@babel/cli": "^7.10.5",
21
- "@babel/core": "^7.10.5",
22
- "@babel/preset-env": "^7.10.4",
23
- "browserslist": "^4.17.4",
24
- "jest": "^26.6.3",
25
- "rimraf": "^2.7.1"
17
+ "@swc/core": "^1.15.40",
18
+ "@swc/jest": "^0.2.39",
19
+ "jest": "^29.7.0",
20
+ "rimraf": "^2.7.1",
21
+ "tsdown": "^0.22.1",
22
+ "typescript": "^6.0.3"
26
23
  },
27
24
  "dependencies": {
28
- "@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
29
- "@canopycanopycanopy/b-ber-logger": "3.0.8-next.61+2bbec564",
30
- "@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-next.61+2bbec564",
25
+ "@canopycanopycanopy/b-ber-lib": "3.0.8-next.97+2e9748e6",
26
+ "@canopycanopycanopy/b-ber-logger": "3.0.8-next.97+2e9748e6",
27
+ "@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-next.97+2e9748e6",
31
28
  "lodash": "^4.17.21"
32
29
  },
33
30
  "files": [
@@ -47,5 +44,6 @@
47
44
  "url": "https://maxwellsimmer.com"
48
45
  }
49
46
  ],
50
- "gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
47
+ "gitHead": "2e9748e6f00446cd35dc8f933e049d8200fc24dd",
48
+ "types": "dist/index.d.ts"
51
49
  }