securemark 0.232.1 → 0.232.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.232.2
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.232.1
4
8
 
5
9
  - Refactoring.
package/design.md CHANGED
@@ -293,3 +293,7 @@ MarkdownはGFMのように最初から高機能で完成度の高い拡張不要
293
293
  ### トランスクルージョン
294
294
 
295
295
  分散的に管理される情報のトランスクルージョンは権利関係の不明瞭さおよびリンク先の消失によりリンク元の情報に欠損が生じるなどの脆さから壊れやすいウェブ上の情報を扱う方法として既存の方法より劣っておりWikipediaのように中央集権的管理を実施できる場合にのみ有用となる。
296
+
297
+ ### Data URI
298
+
299
+ Data URIは保存および転送容量削減ならびに集約的管理のためサポートしない。
@@ -1,4 +1,4 @@
1
- /*! securemark v0.232.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.232.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) {
@@ -427,7 +427,7 @@ require = function () {
427
427
  this.indexes = {
428
428
  LRU: new invlist_1.List(),
429
429
  LFU: new invlist_1.List(),
430
- OVF: new invlist_1.List()
430
+ OVL: new invlist_1.List()
431
431
  };
432
432
  this.stats = {
433
433
  LRU: (0, tuple_1.tuple)(0, 0),
@@ -470,7 +470,7 @@ require = function () {
470
470
  callback && (callback = !!this.settings.disposer);
471
471
  record = callback ? record !== null && record !== void 0 ? record : this.memory.get(index.key) : record;
472
472
  node.delete();
473
- (_a = node.value.overflow) === null || _a === void 0 ? void 0 : _a.delete();
473
+ (_a = node.value.overlap) === null || _a === void 0 ? void 0 : _a.delete();
474
474
  this.memory.delete(index.key);
475
475
  this.SIZE -= index.size;
476
476
  callback && ((_c = (_b = this.settings).disposer) === null || _c === void 0 ? void 0 : _c.call(_b, record.value, index.key));
@@ -484,25 +484,30 @@ require = function () {
484
484
  let size = (_a = skip === null || skip === void 0 ? void 0 : skip.value.size) !== null && _a !== void 0 ? _a : 0;
485
485
  if (margin - size <= 0)
486
486
  return;
487
- const {LRU, LFU, OVF} = this.indexes;
487
+ const {LRU, LFU, OVL} = this.indexes;
488
488
  while (this.length === this.capacity || this.size + margin - size > this.space) {
489
- const lastNode = (_b = OVF.last) !== null && _b !== void 0 ? _b : LFU.last;
489
+ const lastNode = (_b = OVL.last) !== null && _b !== void 0 ? _b : LFU.last;
490
490
  const lastIndex = lastNode === null || lastNode === void 0 ? void 0 : lastNode.value;
491
491
  let target;
492
492
  switch (true) {
493
493
  case lastIndex && lastIndex.clock < this.clock - this.life:
494
494
  case lastIndex && lastIndex.expiry !== global_1.Infinity && lastIndex.expiry < (0, clock_1.now)():
495
- target = lastNode.list === OVF ? lastNode.value.parent : lastNode;
495
+ target = lastNode.list === OVL ? lastNode.value.node : lastNode;
496
496
  break;
497
497
  case LRU.length === 0:
498
498
  target = LFU.last !== skip ? LFU.last : LFU.last.prev;
499
499
  break;
500
500
  case LFU.length > this.capacity * this.ratio / 100:
501
- LRU.unshiftNode(LFU.last);
502
- LRU.head.value.parent = LRU.head;
503
- LRU.head.value.overflow = OVF.unshift(LRU.head.value);
501
+ target = LFU.last !== skip ? LFU.last : LFU.length >= 2 ? LFU.last.prev : skip;
502
+ if (target !== skip) {
503
+ if (this.ratio > 50)
504
+ break;
505
+ LRU.unshiftNode(target);
506
+ LRU.head.value.node = LRU.head;
507
+ LRU.head.value.overlap = OVL.unshift(LRU.head.value);
508
+ }
504
509
  default:
505
- target = LRU.last !== skip ? LRU.last : LRU.last.prev !== skip ? LRU.last.prev : LFU.last;
510
+ target = LRU.last !== skip ? LRU.last : LRU.length >= 2 ? LRU.last.prev : LFU.last;
506
511
  }
507
512
  this.evict(target, void 0, true);
508
513
  skip = (skip === null || skip === void 0 ? void 0 : skip.list) && skip;
@@ -593,7 +598,7 @@ require = function () {
593
598
  this.stats.clear();
594
599
  this.indexes.LRU.clear();
595
600
  this.indexes.LFU.clear();
596
- this.indexes.OVF.clear();
601
+ this.indexes.OVL.clear();
597
602
  if (!this.settings.disposer || !this.settings.capture.clear)
598
603
  return void this.memory.clear();
599
604
  const memory = this.memory;
@@ -620,7 +625,7 @@ require = function () {
620
625
  return;
621
626
  const lenR = indexes.LRU.length;
622
627
  const lenF = indexes.LFU.length;
623
- const lenV = indexes.OVF.length;
628
+ const lenV = indexes.OVL.length;
624
629
  const r = (lenF + lenV) * 1000 / (lenR + lenF) | 0;
625
630
  const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * (1 + r);
626
631
  const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1001 - r);
@@ -643,14 +648,14 @@ require = function () {
643
648
  const index = node.value;
644
649
  const {LRU, LFU} = this.indexes;
645
650
  ++this.stats[index.region][0];
646
- if (!index.overflow && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
651
+ if (!index.overlap && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
647
652
  index.clock = ++this.clockR;
648
653
  node.moveToHead();
649
654
  return true;
650
655
  }
651
656
  index.clock = ++this.clock;
652
657
  index.region = 'LFU';
653
- (_a = index.overflow) === null || _a === void 0 ? void 0 : _a.delete();
658
+ (_a = index.overlap) === null || _a === void 0 ? void 0 : _a.delete();
654
659
  LFU.unshiftNode(node);
655
660
  return true;
656
661
  }
@@ -3651,6 +3656,7 @@ require = function () {
3651
3656
  const global_1 = _dereq_('spica/global');
3652
3657
  const parser_1 = _dereq_('../../data/parser');
3653
3658
  const fmap_1 = _dereq_('../monad/fmap');
3659
+ const resource_1 = _dereq_('./resource');
3654
3660
  const array_1 = _dereq_('spica/array');
3655
3661
  function surround(opener, parser, closer, optional = false, f, g) {
3656
3662
  switch (typeof opener) {
@@ -3698,18 +3704,18 @@ require = function () {
3698
3704
  function match(pattern) {
3699
3705
  switch (typeof pattern) {
3700
3706
  case 'string':
3701
- return source => source.slice(0, pattern.length) === pattern ? [
3707
+ return (0, resource_1.creator)(source => source.slice(0, pattern.length) === pattern ? [
3702
3708
  [],
3703
3709
  source.slice(pattern.length)
3704
- ] : global_1.undefined;
3710
+ ] : global_1.undefined);
3705
3711
  case 'object':
3706
- return source => {
3712
+ return (0, resource_1.creator)(source => {
3707
3713
  const m = source.match(pattern);
3708
3714
  return m ? [
3709
3715
  [],
3710
3716
  source.slice(m[0].length)
3711
3717
  ] : global_1.undefined;
3712
- };
3718
+ });
3713
3719
  }
3714
3720
  }
3715
3721
  function open(opener, parser, optional = false) {
@@ -3728,6 +3734,7 @@ require = function () {
3728
3734
  {
3729
3735
  '../../data/parser': 47,
3730
3736
  '../monad/fmap': 46,
3737
+ './resource': 40,
3731
3738
  'spica/array': 6,
3732
3739
  'spica/global': 15
3733
3740
  }
@@ -7607,6 +7614,15 @@ require = function () {
7607
7614
  switch (uri.protocol) {
7608
7615
  case 'http:':
7609
7616
  case 'https:':
7617
+ if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7618
+ (0, typed_dom_1.define)(target, {
7619
+ class: void target.classList.add('invalid'),
7620
+ 'data-invalid-syntax': 'media',
7621
+ 'data-invalid-type': 'argument',
7622
+ 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7623
+ });
7624
+ return false;
7625
+ }
7610
7626
  break;
7611
7627
  default:
7612
7628
  (0, typed_dom_1.define)(target, {
@@ -7617,15 +7633,6 @@ require = function () {
7617
7633
  });
7618
7634
  return false;
7619
7635
  }
7620
- if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7621
- (0, typed_dom_1.define)(target, {
7622
- class: void target.classList.add('invalid'),
7623
- 'data-invalid-syntax': 'media',
7624
- 'data-invalid-type': 'argument',
7625
- 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7626
- });
7627
- return false;
7628
- }
7629
7636
  if (alt.includes('\0')) {
7630
7637
  (0, typed_dom_1.define)(target, {
7631
7638
  class: void target.classList.add('invalid'),
@@ -8075,7 +8082,7 @@ require = function () {
8075
8082
  !(0, label_1.isFixed)(label) && numbers.set(group, number);
8076
8083
  opts.id !== '' && def.setAttribute('id', `label:${ opts.id ? `${ opts.id }:` : '' }${ label }`);
8077
8084
  const figindex = group === '$' ? `(${ number })` : `${ capitalize(group) }${ group === 'fig' ? '.' : '' } ${ number }`;
8078
- (0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }: `);
8085
+ (0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }. `);
8079
8086
  for (const ref of refs.take(label, global_1.Infinity)) {
8080
8087
  if (ref.hash.slice(1) === def.id && ref.innerText === figindex)
8081
8088
  continue;