@markuplint/ml-core 4.0.0-alpha.4 → 4.0.0-alpha.6

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2019 Yusuke Hirao
3
+ Copyright (c) 2017-2023 Yusuke Hirao
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,3 +1,3 @@
1
1
  import type { Config } from '@markuplint/ml-config';
2
- import Ruleset from './ruleset/index.js';
2
+ import { Ruleset } from './ruleset/index.js';
3
3
  export declare function convertRuleset(config?: Config): Ruleset;
@@ -1,4 +1,4 @@
1
- import Ruleset from './ruleset/index.js';
1
+ import { Ruleset } from './ruleset/index.js';
2
2
  export function convertRuleset(config = {}) {
3
3
  return new Ruleset(config);
4
4
  }
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';
2
2
  export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
3
- export { default as Ruleset } from './ruleset/index.js';
3
+ export { Ruleset } from './ruleset/index.js';
4
4
  export { enableDebug } from './debug.js';
5
5
  export { getIndent } from './ml-dom/helper/get-indent.js';
6
6
  export * from './configs.js';
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
2
- export { default as Ruleset } from './ruleset/index.js';
2
+ export { Ruleset } from './ruleset/index.js';
3
3
  export { enableDebug } from './debug.js';
4
4
  export { getIndent } from './ml-dom/helper/get-indent.js';
5
5
  export * from './configs.js';
@@ -26,7 +26,7 @@ node) {
26
26
  if (node.isRawTextElementContent()) {
27
27
  return null;
28
28
  }
29
- const matched = node.raw.match(/^(\s*(?:\r?\n)+\s*)\S+/);
29
+ const matched = node.raw.match(/^([\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*)\S+/);
30
30
  if (matched) {
31
31
  const spaces = matched[1];
32
32
  if (spaces) {
@@ -1,4 +1,4 @@
1
- import UnexpectedCallError from '../node/unexpected-call-error.js';
1
+ import { UnexpectedCallError } from '../node/unexpected-call-error.js';
2
2
  /**
3
3
  *
4
4
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-before%E2%91%A0
@@ -14,7 +14,7 @@ import { resolveNamespace } from '@markuplint/ml-spec';
14
14
  import { MLToken } from '../token/token.js';
15
15
  import { MLDomTokenList } from './dom-token-list.js';
16
16
  import { MLNode } from './node.js';
17
- import UnexpectedCallError from './unexpected-call-error.js';
17
+ import { UnexpectedCallError } from './unexpected-call-error.js';
18
18
  export class MLAttr extends MLNode {
19
19
  constructor(
20
20
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -54,7 +54,7 @@ export class MLAttr extends MLNode {
54
54
  this.isDirective = this._astToken.isDirective;
55
55
  this.candidate = this._astToken.candidate;
56
56
  __classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName ?? this.nameNode?.raw ?? '', "f");
57
- __classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.value.raw ?? '', "f");
57
+ __classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.potentialValue ?? this.valueNode?.raw ?? '', "f");
58
58
  }
59
59
  else {
60
60
  this.valueType = this._astToken.valueType;
@@ -1,6 +1,6 @@
1
1
  import { after, before, nextElementSibling, previousElementSibling, remove, replaceWith, } from '../manipulations/child-node-methods.js';
2
2
  import { MLNode } from './node.js';
3
- import UnexpectedCallError from './unexpected-call-error.js';
3
+ import { UnexpectedCallError } from './unexpected-call-error.js';
4
4
  export class MLCharacterData extends MLNode {
5
5
  /**
6
6
  * @implements DOM API: `CharacterData`
@@ -1,5 +1,5 @@
1
1
  import { MLParentNode } from './parent-node.js';
2
- import UnexpectedCallError from './unexpected-call-error.js';
2
+ import { UnexpectedCallError } from './unexpected-call-error.js';
3
3
  export class MLDocumentFragment extends MLParentNode {
4
4
  /**
5
5
  * Returns a string appropriate for the type of node as `DocumentFragment`
@@ -6,7 +6,7 @@ import type { MLNode } from './node.js';
6
6
  import type { MLText } from './text.js';
7
7
  import type { AccessibilityProperties, DocumentNodeType } from './types.js';
8
8
  import type { MLRule } from '../../ml-rule/index.js';
9
- import type Ruleset from '../../ruleset/index.js';
9
+ import type { Ruleset } from '../../ruleset/index.js';
10
10
  import type { MLSchema } from '../../types.js';
11
11
  import type { Walker } from '../helper/walkers.js';
12
12
  import type { MLToken } from '../token/token.js';
@@ -21,7 +21,7 @@ import { sequentialWalker, syncWalk } from '../helper/walkers.js';
21
21
  import { nodeListToHTMLCollection } from './node-list.js';
22
22
  import { MLParentNode } from './parent-node.js';
23
23
  import { RuleMapper } from './rule-mapper.js';
24
- import UnexpectedCallError from './unexpected-call-error.js';
24
+ import { UnexpectedCallError } from './unexpected-call-error.js';
25
25
  const log = coreLog.extend('ml-dom');
26
26
  const docLog = log.extend('document');
27
27
  const ruleLog = docLog.extend('rule');
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _MLDomTokenList_origin, _MLDomTokenList_ownerAttrs, _MLDomTokenList_set;
13
13
  import { getCol, getLine } from '@markuplint/parser-utils';
14
- import UnexpectedCallError from './unexpected-call-error.js';
14
+ import { UnexpectedCallError } from './unexpected-call-error.js';
15
15
  export class MLDomTokenList extends Array {
16
16
  constructor(tokens,
17
17
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -114,7 +114,7 @@ export class MLDomTokenList extends Array {
114
114
  throw new UnexpectedCallError('Not supported "toggle" method');
115
115
  }
116
116
  _pick(token, _offset = 0) {
117
- token = token.trim().split(/\s+/g)[0] ?? '';
117
+ token = token.trim().split(/\s+/)[0] ?? '';
118
118
  if (!token) {
119
119
  return null;
120
120
  }
@@ -22,7 +22,7 @@ import { MLDomTokenList } from './dom-token-list.js';
22
22
  import { toNamedNodeMap } from './named-node-map.js';
23
23
  import { toHTMLCollection } from './node-list.js';
24
24
  import { MLParentNode } from './parent-node.js';
25
- import UnexpectedCallError from './unexpected-call-error.js';
25
+ import { UnexpectedCallError } from './unexpected-call-error.js';
26
26
  const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
27
27
  export class MLElement extends MLParentNode {
28
28
  constructor(
@@ -1,4 +1,4 @@
1
- import UnexpectedCallError from './unexpected-call-error.js';
1
+ import { UnexpectedCallError } from './unexpected-call-error.js';
2
2
  export class MLNamedNodeMap extends Array {
3
3
  getNamedItem(qualifiedName) {
4
4
  return this.find(attr => attr.name === qualifiedName) ?? null;
@@ -14,7 +14,7 @@ import { MLToken } from '../token/token.js';
14
14
  import { isChildNode } from './child-node.js';
15
15
  import { toNodeList } from './node-list.js';
16
16
  import { nodeStore } from './node-store.js';
17
- import UnexpectedCallError from './unexpected-call-error.js';
17
+ import { UnexpectedCallError } from './unexpected-call-error.js';
18
18
  export class MLNode extends MLToken {
19
19
  constructor(astNode,
20
20
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -14,7 +14,7 @@ import { syncWalk } from '../helper/walkers.js';
14
14
  import { getChildren } from '../manipulations/get-children.js';
15
15
  import { toNodeList } from './node-list.js';
16
16
  import { MLNode } from './node.js';
17
- import UnexpectedCallError from './unexpected-call-error.js';
17
+ import { UnexpectedCallError } from './unexpected-call-error.js';
18
18
  /**
19
19
  *
20
20
  * @see https://dom.spec.whatwg.org/#interface-parentnode
@@ -1,5 +1,5 @@
1
1
  import { MLCharacterData } from './character-data.js';
2
- import UnexpectedCallError from './unexpected-call-error.js';
2
+ import { UnexpectedCallError } from './unexpected-call-error.js';
3
3
  /**
4
4
  * Raw text elements
5
5
  *
@@ -1,2 +1,2 @@
1
- export default class UnexpectedCallError extends Error {
1
+ export declare class UnexpectedCallError extends Error {
2
2
  }
@@ -1,2 +1,2 @@
1
- export default class UnexpectedCallError extends Error {
1
+ export class UnexpectedCallError extends Error {
2
2
  }
@@ -1,6 +1,6 @@
1
1
  import type { RuleSeed } from './types.js';
2
2
  import type { MLDocument } from '../ml-dom/node/document.js';
3
- import type Ruleset from '../ruleset/index.js';
3
+ import type { Ruleset } from '../ruleset/index.js';
4
4
  import type { LocaleSet } from '@markuplint/i18n';
5
5
  import type { GlobalRuleInfo, PlainData, Rule, RuleConfigValue, RuleInfo, Severity, Violation } from '@markuplint/ml-config';
6
6
  export declare class MLRule<T extends RuleConfigValue, O extends PlainData = undefined> {
@@ -1,5 +1,5 @@
1
1
  import type { ChildNodeRule, Config, NodeRule, Rules } from '@markuplint/ml-config';
2
- export default class Ruleset {
2
+ export declare class Ruleset {
3
3
  readonly childNodeRules: readonly ChildNodeRule[];
4
4
  readonly nodeRules: readonly NodeRule[];
5
5
  readonly rules: Rules;
@@ -1,4 +1,4 @@
1
- export default class Ruleset {
1
+ export class Ruleset {
2
2
  constructor(config) {
3
3
  this.rules = config.rules ?? {};
4
4
  this.nodeRules = config.nodeRules ?? [];
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AnyMLRule } from './ml-rule/index.js';
2
- import type Ruleset from './ruleset/index.js';
2
+ import type { Ruleset } from './ruleset/index.js';
3
3
  import type { LocaleSet } from '@markuplint/i18n';
4
4
  import type { MLMarkupLanguageParser, ParserOptions } from '@markuplint/ml-ast';
5
5
  import type { Pretender } from '@markuplint/ml-config';
@@ -1,5 +1,5 @@
1
1
  export function getLocationFromChars(searches, text, currentLine, currentCol) {
2
- const lines = text.split(/\r?\n/g);
2
+ const lines = text.split(/\r?\n/);
3
3
  const foundLocations = [];
4
4
  for (const [i, lineText] of lines.entries()) {
5
5
  let offset = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.6",
4
4
  "description": "The core module of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -28,19 +28,19 @@
28
28
  "./lib/configs.js": "./lib/configs.browser.js"
29
29
  },
30
30
  "dependencies": {
31
- "@markuplint/config-presets": "4.0.0-alpha.4",
32
- "@markuplint/html-parser": "4.0.0-alpha.4",
33
- "@markuplint/html-spec": "4.0.0-alpha.4",
34
- "@markuplint/i18n": "4.0.0-alpha.4",
35
- "@markuplint/ml-ast": "4.0.0-alpha.4",
36
- "@markuplint/ml-config": "4.0.0-alpha.4",
37
- "@markuplint/ml-spec": "4.0.0-alpha.4",
38
- "@markuplint/parser-utils": "4.0.0-alpha.4",
39
- "@markuplint/selector": "4.0.0-alpha.4",
40
- "@types/debug": "^4.1.10",
31
+ "@markuplint/config-presets": "4.0.0-alpha.6",
32
+ "@markuplint/html-parser": "4.0.0-alpha.6",
33
+ "@markuplint/html-spec": "4.0.0-alpha.6",
34
+ "@markuplint/i18n": "4.0.0-alpha.6",
35
+ "@markuplint/ml-ast": "4.0.0-alpha.6",
36
+ "@markuplint/ml-config": "4.0.0-alpha.6",
37
+ "@markuplint/ml-spec": "4.0.0-alpha.6",
38
+ "@markuplint/parser-utils": "4.0.0-alpha.6",
39
+ "@markuplint/selector": "4.0.0-alpha.6",
40
+ "@types/debug": "^4.1.12",
41
41
  "debug": "^4.3.4",
42
42
  "is-plain-object": "^5.0.0",
43
- "type-fest": "^4.5.0"
43
+ "type-fest": "^4.8.2"
44
44
  },
45
- "gitHead": "991b3aef77fde42c79343ee8c807257a35c589d7"
45
+ "gitHead": "06e1242d274c72cf08a10a572b06ac35d1b924a4"
46
46
  }