Skip to content

Commit ee9e13b

Browse files
authored
fix: change keyword plugin and import regexp (#3668)
* fix: change the and regexp match * feat: change unit test * chore: change desc
1 parent e20c295 commit ee9e13b

File tree

6 files changed

+15
-2
lines changed

6 files changed

+15
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.idea
77
*.iml
88
*.sublime-*
9+
.DS_Store
910

1011
# npm
1112
node_modules

packages/less/src/less/parser/parser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ const Parser = function Parser(context, imports, fileInfo) {
16841684
let features;
16851685
const index = parserInput.i;
16861686

1687-
const dir = parserInput.$re(/^@import?\s+/);
1687+
const dir = parserInput.$re(/^@import\s+/);
16881688

16891689
if (dir) {
16901690
const options = (dir ? this.importOptions() : null) || {};
@@ -1844,7 +1844,7 @@ const Parser = function Parser(context, imports, fileInfo) {
18441844
let args;
18451845
let options;
18461846
const index = parserInput.i;
1847-
const dir = parserInput.$re(/^@plugin?\s+/);
1847+
const dir = parserInput.$re(/^@plugin\s+/);
18481848

18491849
if (dir) {
18501850
args = this.pluginArgs();
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@plugi "plugi-typo-dont-parse-as-@plugin";
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// https://github.com/less/less.js/issues/3660
2+
// const dir = parserInput.$re(/^@import?\s+/);
3+
// correct regexp is /^@import\s+/
4+
// so follow code will change nothing, parse result is same with raw less code
5+
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// https://github.com/less/less.js/issues/3660
2+
// const dir = parserInput.$re(/^@plugin?\s+/);
3+
// correct regexp is /^@plugin\s+/
4+
// so follow code will change nothing, parse result is same with raw less code
5+
@plugi "plugi-typo-dont-parse-as-@plugin";

0 commit comments

Comments
 (0)