@yozora/tokenizer-indented-code 2.0.0 → 2.0.1
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/cjs/index.js +16 -3
- package/lib/esm/index.js +16 -3
- package/package.json +5 -5
package/lib/cjs/index.js
CHANGED
|
@@ -77,10 +77,23 @@ const parse = function (api) {
|
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
const contents = coreTokenizer.mergeContentLinesFaithfully(lines, startLineIndex, endLineIndex);
|
|
80
|
-
|
|
80
|
+
let value = character.calcStringFromNodePoints(contents);
|
|
81
|
+
if (!/\n$/.test(value))
|
|
82
|
+
value += '\n';
|
|
81
83
|
const node = api.shouldReservePosition
|
|
82
|
-
? {
|
|
83
|
-
|
|
84
|
+
? {
|
|
85
|
+
type: ast.CodeType,
|
|
86
|
+
position: token.position,
|
|
87
|
+
lang: null,
|
|
88
|
+
meta: null,
|
|
89
|
+
value,
|
|
90
|
+
}
|
|
91
|
+
: {
|
|
92
|
+
type: ast.CodeType,
|
|
93
|
+
lang: null,
|
|
94
|
+
meta: null,
|
|
95
|
+
value,
|
|
96
|
+
};
|
|
84
97
|
return node;
|
|
85
98
|
}),
|
|
86
99
|
};
|
package/lib/esm/index.js
CHANGED
|
@@ -73,10 +73,23 @@ const parse = function (api) {
|
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
const contents = mergeContentLinesFaithfully(lines, startLineIndex, endLineIndex);
|
|
76
|
-
|
|
76
|
+
let value = calcStringFromNodePoints(contents);
|
|
77
|
+
if (!/\n$/.test(value))
|
|
78
|
+
value += '\n';
|
|
77
79
|
const node = api.shouldReservePosition
|
|
78
|
-
? {
|
|
79
|
-
|
|
80
|
+
? {
|
|
81
|
+
type: CodeType,
|
|
82
|
+
position: token.position,
|
|
83
|
+
lang: null,
|
|
84
|
+
meta: null,
|
|
85
|
+
value,
|
|
86
|
+
}
|
|
87
|
+
: {
|
|
88
|
+
type: CodeType,
|
|
89
|
+
lang: null,
|
|
90
|
+
meta: null,
|
|
91
|
+
value,
|
|
92
|
+
};
|
|
80
93
|
return node;
|
|
81
94
|
}),
|
|
82
95
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-indented-code",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^2.0.
|
|
39
|
-
"@yozora/character": "^2.0.
|
|
40
|
-
"@yozora/core-tokenizer": "^2.0.
|
|
38
|
+
"@yozora/ast": "^2.0.1",
|
|
39
|
+
"@yozora/character": "^2.0.1",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "3aea33091e402bd6c7754d91d549e8d648475073"
|
|
43
43
|
}
|