lc-test3 1.1.11 → 1.1.12

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.
Files changed (2) hide show
  1. package/p.js +8 -6
  2. package/package.json +1 -1
package/p.js CHANGED
@@ -42,14 +42,16 @@ const swcParserConfig = {
42
42
  dynamicImport: true,
43
43
  };
44
44
 
45
- const permissionCommentInJSXPattern = /\/\*\*[\s\S]*?RESOURCESTREE-START[\s\S]*?RESOURCESTREE-END[\s\S]*?\*\/(?=\s*<)/g;
45
+ const permissionCommentPattern = /\/\*\*[\s\S]*?RESOURCESTREE-START[\s\S]*?RESOURCESTREE-END[\s\S]*?\*\//g;
46
46
 
47
47
  function sanitizePermissionCommentsForJSX(code: string) {
48
- return code.replace(permissionCommentInJSXPattern, (comment) => {
49
- const inner = comment
50
- .replace(/^\/\*\*?/, '')
51
- .replace(/\*\/$/, '');
52
- return `{/*${inner}*/}`;
48
+ return code.replace(permissionCommentPattern, (comment, offset) => {
49
+ const rest = code.slice(offset + comment.length);
50
+ // SWC �� "return (/**...*/<JSX" �Ľ������ȶ���ֱ���Ƴ�������� JSX ��ʼ��ǩ��Ȩ��ע��
51
+ if (/^\s*</.test(rest)) {
52
+ return '';
53
+ }
54
+ return comment;
53
55
  });
54
56
  }
55
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lc-test3",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {