@mdream/js 2.0.1 → 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.
@@ -58,12 +58,15 @@ function processPluginsForEvent(event, plugins, state, processEvent) {
58
58
  const element = event.node;
59
59
  for (let index = 0; index < plugins.length; index++) {
60
60
  const plugin = plugins[index];
61
+ if (plugin === void 0) throw new TypeError("Plugin arrays must not contain undefined entries.");
61
62
  if (plugin.processAttributes) plugin.processAttributes(element, state);
62
63
  }
63
64
  }
64
65
  let shouldSkip = false;
65
66
  for (let index = 0; index < plugins.length; index++) {
66
- const res = plugins[index].beforeNodeProcess?.(event, state);
67
+ const plugin = plugins[index];
68
+ if (plugin === void 0) throw new TypeError("Plugin arrays must not contain undefined entries.");
69
+ const res = plugin.beforeNodeProcess?.(event, state);
67
70
  if (typeof res === "object") shouldSkip = res.skip;
68
71
  }
69
72
  if (shouldSkip) return true;
@@ -73,6 +76,7 @@ function processPluginsForEvent(event, plugins, state, processEvent) {
73
76
  let pluginOutputs;
74
77
  for (let index = 0; index < plugins.length; index++) {
75
78
  const plugin = plugins[index];
79
+ if (plugin === void 0) throw new TypeError("Plugin arrays must not contain undefined entries.");
76
80
  if (plugin[fn]) {
77
81
  const result = plugin[fn](element, state);
78
82
  if (result) (pluginOutputs ??= []).push(result);
@@ -83,6 +87,7 @@ function processPluginsForEvent(event, plugins, state, processEvent) {
83
87
  const textNode = event.node;
84
88
  for (let index = 0; index < plugins.length; index++) {
85
89
  const plugin = plugins[index];
90
+ if (plugin === void 0) throw new TypeError("Plugin arrays must not contain undefined entries.");
86
91
  if (plugin.processTextNode) {
87
92
  const result = plugin.processTextNode(textNode, state);
88
93
  if (result) {
@@ -98,7 +103,11 @@ function processPluginsForEvent(event, plugins, state, processEvent) {
98
103
  }
99
104
  function endPlugins(plugins, state) {
100
105
  if (!plugins) return;
101
- for (let index = 0; index < plugins.length; index++) plugins[index].onDocumentEnd?.(state);
106
+ for (let index = 0; index < plugins.length; index++) {
107
+ const plugin = plugins[index];
108
+ if (plugin === void 0) throw new TypeError("Plugin arrays must not contain undefined entries.");
109
+ plugin.onDocumentEnd?.(state);
110
+ }
102
111
  }
103
112
  function buildTagOverrideHandlers(overrides, tagHandlers) {
104
113
  const result = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mdream/js",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "description": "Tree-shakable JavaScript converters and plugins for mdream.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",