@markuplint/parser-utils 4.0.0-alpha.10 → 4.0.0-alpha.11

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/lib/debug.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { MLASTNode } from '@markuplint/ml-ast';
2
+ import debug from 'debug';
3
+ export declare const log: debug.Debugger;
4
+ export declare function domLog(nodeList: readonly (MLASTNode | null)[]): void;
package/lib/debug.js ADDED
@@ -0,0 +1,6 @@
1
+ import debug from 'debug';
2
+ import { nodeListToDebugMaps } from './debugger.js';
3
+ export const log = debug('ml-parser');
4
+ export function domLog(nodeList) {
5
+ log('Parse result: %O', nodeListToDebugMaps(nodeList, true));
6
+ }
package/lib/parser.js CHANGED
@@ -14,6 +14,7 @@ import { isVoidElement as detectVoidElement } from '@markuplint/ml-spec';
14
14
  import { v4 as uuid } from 'uuid';
15
15
  import { attrTokenizer } from './attr-tokenizer.js';
16
16
  import { defaultSpaces } from './const.js';
17
+ import { domLog } from './debug.js';
17
18
  import { detectElementType } from './detect-element-type.js';
18
19
  import { AttrState, TagState } from './enums.js';
19
20
  import { getCol, getEndCol, getEndLine, getLine } from './get-location.js';
@@ -140,6 +141,7 @@ export class Parser {
140
141
  }
141
142
  nodeList = [fmNode, ...newNodeList];
142
143
  }
144
+ domLog(nodeList);
143
145
  __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_reset).call(this);
144
146
  return {
145
147
  raw: rawCode,
@@ -1,5 +1,4 @@
1
1
  export declare function scriptParser(script: string): ScriptTokenType[];
2
- export declare function removeQuote(str: string): string;
3
2
  export type ScriptTokenType = {
4
3
  type: 'Identifier' | 'Boolean' | 'Numeric' | 'String' | 'Template' | 'Punctuator';
5
4
  value: string;
@@ -10,13 +10,3 @@ export function scriptParser(script) {
10
10
  value: token.value,
11
11
  }));
12
12
  }
13
- export function removeQuote(str) {
14
- const quote = str[0];
15
- if (quote !== '"' && quote !== "'" && quote !== '`') {
16
- return str;
17
- }
18
- if (str.at(-1) !== quote) {
19
- return str;
20
- }
21
- return str.slice(1, -1);
22
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/parser-utils",
3
- "version": "4.0.0-alpha.10",
3
+ "version": "4.0.0-alpha.11",
4
4
  "description": "Utility module for markuplint parser plugin",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -27,13 +27,14 @@
27
27
  "clean": "tsc --build --clean"
28
28
  },
29
29
  "dependencies": {
30
- "@markuplint/ml-ast": "4.0.0-alpha.10",
31
- "@markuplint/ml-spec": "4.0.0-alpha.10",
32
- "@markuplint/types": "4.0.0-alpha.10",
30
+ "@markuplint/ml-ast": "4.0.0-alpha.11",
31
+ "@markuplint/ml-spec": "4.0.0-alpha.11",
32
+ "@markuplint/types": "4.0.0-alpha.11",
33
33
  "@types/uuid": "^9.0.8",
34
+ "debug": "^4.3.4",
34
35
  "espree": "^10.0.0",
35
36
  "type-fest": "^4.10.1",
36
37
  "uuid": "^9.0.1"
37
38
  },
38
- "gitHead": "b41153ea665aa8f091daf6114a06047f4ccb8350"
39
+ "gitHead": "78ab1adaa4e178b4187f6c5f135bb8fc0c8f4b9e"
39
40
  }