securemark 0.233.1 → 0.233.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.233.2
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.233.1
4
8
 
5
9
  - Refactoring.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.233.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.233.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -4467,22 +4467,19 @@ require = function () {
4467
4467
  const typed_dom_1 = _dereq_('typed-dom');
4468
4468
  const url_1 = _dereq_('spica/url');
4469
4469
  function parse(source, opts = {}, context) {
4470
- var _a, _b, _c, _d, _e, _f, _g, _h;
4470
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4471
4471
  if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE))
4472
4472
  throw new Error(`Too large input over ${ segment_1.MAX_SEGMENT_SIZE.toLocaleString('en') } bytes.`);
4473
4473
  const url = (_b = (_a = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))) === null || _a === void 0 ? void 0 : _a.slice(4).trim()) !== null && _b !== void 0 ? _b : '';
4474
4474
  source = !context ? (0, normalize_1.normalize)(source) : source;
4475
- context = context && url === '' && context.id === opts.id ? context : (0, alias_1.ObjectAssign)({
4476
- ...context,
4477
- ...opts
4478
- }, {
4475
+ context = context && url === '' && context.id === opts.id ? context : (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(context !== null && context !== void 0 ? context : {}), opts, {
4479
4476
  host: (_d = (_c = opts.host) !== null && _c !== void 0 ? _c : context === null || context === void 0 ? void 0 : context.host) !== null && _d !== void 0 ? _d : new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
4480
4477
  url: url ? new url_1.ReadonlyURL(url) : context === null || context === void 0 ? void 0 : context.url,
4481
4478
  id: (_e = opts.id) !== null && _e !== void 0 ? _e : context === null || context === void 0 ? void 0 : context.id,
4482
4479
  footnotes: global_1.undefined,
4483
4480
  test: global_1.undefined
4484
4481
  });
4485
- if (((_f = context.host) === null || _f === void 0 ? void 0 : _f.origin) === 'null')
4482
+ if (((_g = context.host) === null || _g === void 0 ? void 0 : _g.origin) === 'null')
4486
4483
  throw new Error(`Invalid host: ${ context.host.href }`);
4487
4484
  const node = (0, typed_dom_1.frag)();
4488
4485
  let index = 0;
@@ -5625,7 +5622,7 @@ require = function () {
5625
5622
  } = {}
5626
5623
  }) => {
5627
5624
  var _a;
5628
- return [delim.length === 2 && closer && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(`\n${ body }`)) === null || _a === void 0 ? void 0 : _a.cloneNode(true)) || (0, typed_dom_1.html)('div', {
5625
+ return [delim.length === 2 && closer && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(`${ delim }\n${ body }${ delim }`)) === null || _a === void 0 ? void 0 : _a.cloneNode(true)) || (0, typed_dom_1.html)('div', {
5629
5626
  class: 'math',
5630
5627
  translate: 'no'
5631
5628
  }, `${ delim }\n${ body }${ delim }`) : (0, typed_dom_1.html)('pre', {
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.233.1",
3
+ "version": "0.233.2",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -3030,9 +3030,9 @@
3030
3030
  "dev": true
3031
3031
  },
3032
3032
  "electron-to-chromium": {
3033
- "version": "1.4.93",
3034
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.93.tgz",
3035
- "integrity": "sha512-ywq9Pc5Gwwpv7NG767CtoU8xF3aAUQJjH9//Wy3MBCg4w5JSLbJUq2L8IsCdzPMjvSgxuue9WcVaTOyyxCL0aQ==",
3033
+ "version": "1.4.94",
3034
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.94.tgz",
3035
+ "integrity": "sha512-CoOKsuACoa0PAG3hQXxbh/XDiFcjGuSyGKUi09cjMHOt6RCi7/EXgXhaFF3I+aC89Omudqmkzd0YOQKxwtf/Bg==",
3036
3036
  "dev": true
3037
3037
  },
3038
3038
  "elliptic": {
@@ -6359,9 +6359,9 @@
6359
6359
  "dev": true
6360
6360
  },
6361
6361
  "isbinaryfile": {
6362
- "version": "4.0.9",
6363
- "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.9.tgz",
6364
- "integrity": "sha512-GhwgwhMeEkMF/PmVpA+zRGCxoQvJ7PONqsKI+eq+ivgYolKe7AQdlqLFiSEBSTrO3YsQ2jvgwT2Gd6Z1TDcoaw==",
6362
+ "version": "4.0.10",
6363
+ "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz",
6364
+ "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==",
6365
6365
  "dev": true
6366
6366
  },
6367
6367
  "isexe": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.233.1",
3
+ "version": "0.233.2",
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",
@@ -1,5 +1,5 @@
1
1
  import { undefined, location } from 'spica/global';
2
- import { ObjectAssign } from 'spica/alias';
2
+ import { ObjectAssign, ObjectCreate } from 'spica/alias';
3
3
  import { ParserOptions } from '../../..';
4
4
  import { MarkdownParser } from '../../../markdown';
5
5
  import { eval } from '../../combinator/data/parser';
@@ -24,13 +24,14 @@ export function parse(source: string, opts: Options = {}, context?: MarkdownPars
24
24
  assert(!context?.delimiters);
25
25
  context = context && url === '' && context.id === opts.id
26
26
  ? context
27
- : ObjectAssign({ ...context, ...opts }, {
27
+ : ObjectAssign(ObjectCreate(context ?? {}), opts, {
28
28
  host: opts.host ?? context?.host ?? new ReadonlyURL(location.pathname, location.origin),
29
29
  url: url ? new ReadonlyURL(url as ':') : context?.url,
30
30
  id: opts.id ?? context?.id,
31
31
  footnotes: undefined,
32
32
  test: undefined,
33
33
  });
34
+ assert(context.caches === arguments[2]?.caches);
34
35
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
35
36
  const node = frag();
36
37
  let index = 0;
@@ -16,7 +16,7 @@ export const mathblock: MathBlockParser = block(validate('$$', fmap(
16
16
  // Bug: Type mismatch between outer and inner.
17
17
  ([body, closer, opener, delim, param]: string[], _, { caches: { math: cache = undefined } = {} }) => [
18
18
  delim.length === 2 && closer && param.trimStart() === ''
19
- ? cache?.get(`\n${body}`)?.cloneNode(true) as HTMLDivElement ||
19
+ ? cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) as HTMLDivElement ||
20
20
  html('div', { class: 'math', translate: 'no' }, `${delim}\n${body}${delim}`)
21
21
  : html('pre', {
22
22
  class: 'invalid',