securemark 0.300.7 → 0.300.8

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.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.300.8
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.300.7
4
8
 
5
9
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.300.7 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.300.8 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -2785,7 +2785,7 @@ function* parse(source, opts = {}, options) {
2785
2785
  if (options.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
2786
2786
  if (options.host?.origin === 'null') throw new Error(`Invalid host: ${options.host.href}`);
2787
2787
  const output = new parser_1.Output();
2788
- for (const _ of (0, parser_1.run)(document_1.document, new context_1.Input(options, source), output)) yield;
2788
+ yield* (0, parser_1.run)(document_1.document, new context_1.Input(options, source), output);
2789
2789
  return output.peek().head.value;
2790
2790
  }
2791
2791
  exports.parse = parse;
@@ -6433,7 +6433,10 @@ class Input extends parser_1.Input {
6433
6433
  recursions: [
6434
6434
  // DOMの垂直的追加の繰り返しが加速的に異常に重くなる。
6435
6435
  // ブラウザの問題でありアルゴリズムの計算量は問題ない。
6436
- 10 || 0 /* Recursion.document */, 100 || 0 /* Recursion.block */, 100 || 0 /* Recursion.inline */, 100 || 0 /* Recursion.bracket */]
6436
+ // HTMLでなくDOMでレンダリングすること自体に限界があると思われる。
6437
+ 10 || 0 /* Recursion.document */,
6438
+ // スタックでも意外と低速化するため制限しておく。
6439
+ 100 || 0 /* Recursion.block */, 100 || 0 /* Recursion.inline */, 100 || 0 /* Recursion.bracket */]
6437
6440
  };
6438
6441
  this.segment = segment ?? 0 /* Segment.unknown */;
6439
6442
  this.header = header ?? true;
@@ -6734,9 +6737,8 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
6734
6737
  }
6735
6738
  const flag = i === 0 ? 0 /* Node.Flag.none */ : 2 /* Node.Flag.nested */;
6736
6739
  i === list.length ? list.unshift(new parser_1.Node(el, pos, flag)) : list.insert(new parser_1.Node(el, pos, flag), node?.next);
6737
- break;
6740
+ return new parser_1.List([new parser_1.Node(el)]);
6738
6741
  }
6739
- return new parser_1.List([new parser_1.Node(el)]);
6740
6742
  }, (nodes, input, output, prefix, postfix) => {
6741
6743
  for (let i = 0; i < prefix; ++i) {
6742
6744
  nodes.unshift(new parser_1.Node('('));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.300.7",
3
+ "version": "0.300.8",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
package/src/api/parse.ts CHANGED
@@ -29,7 +29,7 @@ export function* parse(source: string, opts: Opts = {}, options?: Options): Gene
29
29
  assert(output.labels[0] = opts.labels ?? output.labels[0]);
30
30
  assert(output.annotations[0] = opts.annotations ?? output.annotations[0]);
31
31
  assert(output.references[0] = opts.references ?? output.references[0]);
32
- for (const _ of run(document, new Input(options, source), output)) yield;
32
+ yield* run(document, new Input(options, source), output);
33
33
  assert(output.data.length === 1);
34
34
  assert(output.peek().length === 1);
35
35
  return output.peek().head!.value;
@@ -30,7 +30,9 @@ export class Input<M extends object = object> extends Ipt<M> {
30
30
  recursions: [
31
31
  // DOMの垂直的追加の繰り返しが加速的に異常に重くなる。
32
32
  // ブラウザの問題でありアルゴリズムの計算量は問題ない。
33
+ // HTMLでなくDOMでレンダリングすること自体に限界があると思われる。
33
34
  10 || Recursion.document,
35
+ // スタックでも意外と低速化するため制限しておく。
34
36
  100 || Recursion.block,
35
37
  100 || Recursion.inline,
36
38
  100 || Recursion.bracket,
@@ -59,9 +59,8 @@ export const annotation: AnnotationParser = lazy(() => constraint(State.annotati
59
59
  i === list.length
60
60
  ? list.unshift(new Node(el, pos, flag))
61
61
  : list.insert(new Node(el, pos, flag), node?.next);
62
- break;
62
+ return new List([new Node(el)]);
63
63
  }
64
- return new List([new Node(el)]);
65
64
  },
66
65
  (nodes, input, output, prefix, postfix) => {
67
66
  assert(postfix === 0);