lc-test3 1.1.12 → 1.1.13

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 +548 -753
  2. package/package.json +1 -1
package/p.js CHANGED
@@ -1,753 +1,548 @@
1
- /**
2
- * SWC ��������װ
3
- *
4
- * SWC ���� Rust ��д�ij��� JavaScript/TypeScript ������
5
- * �� Babel �� 20-70 ��
6
- *
7
- * ��ģ���ṩ��
8
- * 1. SWC WASM ��ʼ��
9
- * 2. SWC AST �� Babel AST ��ת��
10
- * 3. ���˵� Babel �ļ��ݻ���
11
- */
12
-
13
- import * as t from '@babel/types';
14
- import { parse as babelParse, ParserOptions } from '@babel/parser';
15
-
16
- // SWC WASM �
17
- let swcModule: typeof import('@swc/wasm-web') | null = null;
18
- let swcInitPromise: Promise<void> | null = null;
19
- let swcAvailable = false;
20
-
21
- // Babel �������ã������ã�
22
- const babelParserConfig: ParserOptions = {
23
- sourceType: 'module',
24
- plugins: [
25
- 'jsx',
26
- 'doExpressions',
27
- 'objectRestSpread',
28
- 'decorators-legacy',
29
- 'classProperties',
30
- 'asyncGenerators',
31
- 'functionBind',
32
- 'dynamicImport',
33
- 'optionalChaining',
34
- ],
35
- };
36
-
37
- // SWC ��������
38
- const swcParserConfig = {
39
- syntax: 'typescript' as const,
40
- tsx: true,
41
- decorators: true,
42
- dynamicImport: true,
43
- };
44
-
45
- const permissionCommentPattern = /\/\*\*[\s\S]*?RESOURCESTREE-START[\s\S]*?RESOURCESTREE-END[\s\S]*?\*\//g;
46
-
47
- function sanitizePermissionCommentsForJSX(code: string) {
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;
55
- });
56
- }
57
-
58
- // ����ͳ��
59
- const swcStats = {
60
- swcParseCount: 0,
61
- swcTotalTime: 0,
62
- babelFallbackCount: 0,
63
- babelTotalTime: 0,
64
- conversionCount: 0,
65
- conversionTotalTime: 0,
66
- };
67
-
68
- /**
69
- * ��ʼ�� SWC WASM ģ��
70
- */
71
- export async function initSWC(): Promise<boolean> {
72
- if (swcAvailable) return true;
73
- if (swcInitPromise) {
74
- await swcInitPromise;
75
- return swcAvailable;
76
- }
77
-
78
- swcInitPromise = (async () => {
79
- try {
80
- // ��̬���� SWC WASM
81
- const swc = await import('@swc/wasm-web');
82
-
83
- // ��ʼ�� WASM����Ҫ���� .wasm �ļ���
84
- await swc.default();
85
-
86
- swcModule = swc;
87
- swcAvailable = true;
88
- console.log('%c[SWC] ? WASM ģ���ʼ���ɹ�', 'color: #4CAF50; font-weight: bold;');
89
- } catch (error) {
90
- console.warn('[SWC] ?? WASM ģ�����ʧ�ܣ���ʹ�� Babel ��Ϊ����:', error);
91
- swcAvailable = false;
92
- }
93
- })();
94
-
95
- await swcInitPromise;
96
- return swcAvailable;
97
- }
98
-
99
- /**
100
- * ��� SWC �Ƿ����
101
- */
102
- export function isSWCAvailable(): boolean {
103
- return swcAvailable;
104
- }
105
-
106
- /**
107
- * SWC AST �ڵ�����ӳ�䵽 Babel ����
108
- */
109
- const SWC_TO_BABEL_TYPE: Record<string, string> = {
110
- 'Module': 'File',
111
- 'Script': 'File',
112
- 'ImportDeclaration': 'ImportDeclaration',
113
- 'ExportDeclaration': 'ExportDeclaration',
114
- 'ExportDefaultDeclaration': 'ExportDefaultDeclaration',
115
- 'ExportDefaultExpression': 'ExportDefaultDeclaration',
116
- 'ExportNamedDeclaration': 'ExportNamedDeclaration',
117
- 'ExportAllDeclaration': 'ExportAllDeclaration',
118
- 'VariableDeclaration': 'VariableDeclaration',
119
- 'VariableDeclarator': 'VariableDeclarator',
120
- 'FunctionDeclaration': 'FunctionDeclaration',
121
- 'FunctionExpression': 'FunctionExpression',
122
- 'ArrowFunctionExpression': 'ArrowFunctionExpression',
123
- 'ClassDeclaration': 'ClassDeclaration',
124
- 'ClassExpression': 'ClassExpression',
125
- 'ClassMethod': 'ClassMethod',
126
- 'ClassPrivateMethod': 'ClassPrivateMethod',
127
- 'ClassProperty': 'ClassProperty',
128
- 'ClassPrivateProperty': 'ClassPrivateProperty',
129
- 'Constructor': 'ClassMethod',
130
- 'PrivateName': 'PrivateName',
131
- 'Identifier': 'Identifier',
132
- 'StringLiteral': 'StringLiteral',
133
- 'NumericLiteral': 'NumericLiteral',
134
- 'BooleanLiteral': 'BooleanLiteral',
135
- 'NullLiteral': 'NullLiteral',
136
- 'RegExpLiteral': 'RegExpLiteral',
137
- 'TemplateLiteral': 'TemplateLiteral',
138
- 'ArrayExpression': 'ArrayExpression',
139
- 'ObjectExpression': 'ObjectExpression',
140
- 'CallExpression': 'CallExpression',
141
- 'MemberExpression': 'MemberExpression',
142
- 'BinaryExpression': 'BinaryExpression',
143
- 'UnaryExpression': 'UnaryExpression',
144
- 'ConditionalExpression': 'ConditionalExpression',
145
- 'AssignmentExpression': 'AssignmentExpression',
146
- 'LogicalExpression': 'LogicalExpression',
147
- 'SequenceExpression': 'SequenceExpression',
148
- 'NewExpression': 'NewExpression',
149
- 'ThisExpression': 'ThisExpression',
150
- 'SpreadElement': 'SpreadElement',
151
- 'RestElement': 'RestElement',
152
- 'ObjectPattern': 'ObjectPattern',
153
- 'ArrayPattern': 'ArrayPattern',
154
- 'AssignmentPattern': 'AssignmentPattern',
155
- 'BlockStatement': 'BlockStatement',
156
- 'ReturnStatement': 'ReturnStatement',
157
- 'IfStatement': 'IfStatement',
158
- 'SwitchStatement': 'SwitchStatement',
159
- 'SwitchCase': 'SwitchCase',
160
- 'ForStatement': 'ForStatement',
161
- 'ForInStatement': 'ForInStatement',
162
- 'ForOfStatement': 'ForOfStatement',
163
- 'WhileStatement': 'WhileStatement',
164
- 'DoWhileStatement': 'DoWhileStatement',
165
- 'TryStatement': 'TryStatement',
166
- 'CatchClause': 'CatchClause',
167
- 'ThrowStatement': 'ThrowStatement',
168
- 'BreakStatement': 'BreakStatement',
169
- 'ContinueStatement': 'ContinueStatement',
170
- 'ExpressionStatement': 'ExpressionStatement',
171
- 'EmptyStatement': 'EmptyStatement',
172
- 'DebuggerStatement': 'DebuggerStatement',
173
- 'LabeledStatement': 'LabeledStatement',
174
- 'WithStatement': 'WithStatement',
175
- // JSX
176
- 'JSXElement': 'JSXElement',
177
- 'JSXFragment': 'JSXFragment',
178
- 'JSXOpeningElement': 'JSXOpeningElement',
179
- 'JSXClosingElement': 'JSXClosingElement',
180
- 'JSXOpeningFragment': 'JSXOpeningFragment',
181
- 'JSXClosingFragment': 'JSXClosingFragment',
182
- 'JSXAttribute': 'JSXAttribute',
183
- 'JSXSpreadAttribute': 'JSXSpreadAttribute',
184
- 'JSXExpressionContainer': 'JSXExpressionContainer',
185
- 'JSXText': 'JSXText',
186
- 'JSXIdentifier': 'JSXIdentifier',
187
- 'JSXMemberExpression': 'JSXMemberExpression',
188
- 'JSXNamespacedName': 'JSXNamespacedName',
189
- 'JSXEmptyExpression': 'JSXEmptyExpression',
190
- // ����
191
- 'AwaitExpression': 'AwaitExpression',
192
- 'YieldExpression': 'YieldExpression',
193
- 'TaggedTemplateExpression': 'TaggedTemplateExpression',
194
- 'TemplateElement': 'TemplateElement',
195
- 'OptionalMemberExpression': 'OptionalMemberExpression',
196
- 'OptionalCallExpression': 'OptionalCallExpression',
197
- 'ParenthesisExpression': 'ParenthesizedExpression',
198
- // Property ������Ҫ���⴦��
199
- 'KeyValueProperty': 'ObjectProperty',
200
- 'AssignmentProperty': 'ObjectProperty',
201
- 'GetterProperty': 'ObjectMethod',
202
- 'SetterProperty': 'ObjectMethod',
203
- 'MethodProperty': 'ObjectMethod',
204
- 'SpreadProperty': 'SpreadElement',
205
- 'ShorthandProperty': 'ObjectProperty',
206
- // Import/Export specifiers
207
- 'ImportDefaultSpecifier': 'ImportDefaultSpecifier',
208
- 'ImportSpecifier': 'ImportSpecifier',
209
- 'ImportNamespaceSpecifier': 'ImportNamespaceSpecifier',
210
- 'ExportSpecifier': 'ExportSpecifier',
211
- 'ExportDefaultSpecifier': 'ExportDefaultSpecifier',
212
- 'ExportNamespaceSpecifier': 'ExportNamespaceSpecifier',
213
- 'Computed': 'Computed',
214
- 'SuperPropExpression': 'MemberExpression',
215
- 'AssignmentPatternProperty': 'ObjectProperty',
216
- };
217
-
218
- /**
219
- * �淶�����������б�
220
- */
221
- function normalizeParams(params: any): any[] {
222
- if (Array.isArray(params)) {
223
- return params.map((p) => p?.pat || p);
224
- }
225
- if (params && Array.isArray(params.params)) {
226
- return params.params.map((p: any) => p?.pat || p);
227
- }
228
- return [];
229
- }
230
-
231
- /**
232
- * �淶����Ա���ԣ����� MemberExpression.property Ϊ MemberExpression ��������ʧ��
233
- */
234
- function normalizeMemberProperty(prop: any, computedFlag?: boolean): { property: any; computed: boolean } {
235
- if (!prop) {
236
- return { property: prop, computed: Boolean(computedFlag) };
237
- }
238
-
239
- if (prop.type === 'Computed') {
240
- return { property: convertSWCNode(prop.expression), computed: true };
241
- }
242
-
243
- const converted = convertSWCNode(prop);
244
- const needsComputed = converted?.type === 'MemberExpression';
245
- return { property: converted, computed: Boolean(computedFlag) || needsComputed };
246
- }
247
-
248
- /**
249
- * �ݹ�ת�� SWC AST �ڵ㵽 Babel AST ��ʽ
250
- */
251
- function convertSWCNode(node: any): any {
252
- if (!node || typeof node !== 'object') {
253
- return node;
254
- }
255
-
256
- // ��������
257
- if (Array.isArray(node)) {
258
- return node.map(convertSWCNode);
259
- }
260
-
261
- // ��ȡ�ڵ�����
262
- const swcType = node.type;
263
- if (!swcType) {
264
- // ���� SWC ExprOrSpread �ṹ��{ spread: null|{...}, expression: {...} }
265
- if ('expression' in node && 'spread' in node) {
266
- if (node.spread) {
267
- return {
268
- type: 'SpreadElement',
269
- argument: convertSWCNode(node.expression),
270
- };
271
- }
272
- return convertSWCNode(node.expression);
273
- }
274
- // ������ AST �ڵ�Ķ���
275
- const result: any = {};
276
- for (const key of Object.keys(node)) {
277
- result[key] = convertSWCNode(node[key]);
278
- }
279
- return result;
280
- }
281
-
282
- // ӳ������
283
- const babelType = SWC_TO_BABEL_TYPE[swcType] || swcType;
284
-
285
- // �����½ڵ�
286
- const babelNode: any = {
287
- type: babelType,
288
- };
289
-
290
- // �����������
291
- switch (swcType) {
292
- case 'SuperPropExpression':
293
- const superProp = normalizeMemberProperty(node.property, node.computed);
294
- return {
295
- type: 'MemberExpression',
296
- object: { type: 'Super' },
297
- property: superProp.property,
298
- computed: superProp.computed,
299
- };
300
-
301
- case 'AssignmentPatternProperty':
302
- return {
303
- type: 'ObjectProperty',
304
- key: convertSWCNode(node.key),
305
- value: convertSWCNode(node.value),
306
- computed: node.key?.type === 'Computed' || node.computed || false,
307
- shorthand: false,
308
- };
309
- case 'SuperPropExpression':
310
- return {
311
- type: 'MemberExpression',
312
- object: { type: 'Super' },
313
- property: convertSWCNode(node.property),
314
- computed: node.property?.type === 'Computed' || node.computed || false,
315
- };
316
-
317
- case 'AssignmentPatternProperty':
318
- return {
319
- type: 'ObjectProperty',
320
- key: convertSWCNode(node.key),
321
- value: convertSWCNode(node.value),
322
- computed: node.key?.type === 'Computed' || node.computed || false,
323
- shorthand: false,
324
- };
325
- case 'Computed':
326
- // SWC computed property wrapper
327
- return convertSWCNode(node.expression);
328
- case 'Program':
329
- return {
330
- type: 'Program',
331
- sourceType: node.sourceType || 'module',
332
- body: convertSWCNode(node.body || node.stmts || []),
333
- directives: [],
334
- };
335
- case 'Module':
336
- case 'Script':
337
- // ת��Ϊ Babel �� File �ṹ
338
- return {
339
- type: 'File',
340
- program: {
341
- type: 'Program',
342
- sourceType: 'module',
343
- body: convertSWCNode(node.body || node.stmts || []),
344
- directives: [],
345
- },
346
- };
347
-
348
- case 'ExportDefaultExpression':
349
- return {
350
- type: 'ExportDefaultDeclaration',
351
- declaration: convertSWCNode(node.expression || node.expr || node.decl),
352
- };
353
-
354
- case 'StringLiteral':
355
- babelNode.value = node.value;
356
- babelNode.raw = node.raw;
357
- break;
358
-
359
- case 'TemplateLiteral':
360
- babelNode.expressions = convertSWCNode(node.expressions || node.exprs || []);
361
- babelNode.quasis = convertSWCNode(node.quasis || []);
362
- if (!babelNode.quasis || babelNode.quasis.length === 0) {
363
- babelNode.quasis = [
364
- {
365
- type: 'TemplateElement',
366
- value: { raw: '', cooked: '' },
367
- tail: true,
368
- },
369
- ];
370
- }
371
- if (Array.isArray(babelNode.quasis) && Array.isArray(babelNode.expressions)) {
372
- if (babelNode.quasis.length === babelNode.expressions.length) {
373
- babelNode.quasis.push({
374
- type: 'TemplateElement',
375
- value: { raw: '', cooked: '' },
376
- tail: true,
377
- });
378
- }
379
- const last = babelNode.quasis[babelNode.quasis.length - 1];
380
- if (last) last.tail = true;
381
- }
382
- break;
383
-
384
- case 'NumericLiteral':
385
- babelNode.value = node.value;
386
- babelNode.raw = String(node.value);
387
- break;
388
-
389
- case 'BooleanLiteral':
390
- babelNode.value = node.value;
391
- break;
392
-
393
- case 'Identifier':
394
- babelNode.name = node.value;
395
- break;
396
-
397
- case 'PrivateName':
398
- return {
399
- type: 'PrivateName',
400
- id: convertSWCNode(node.id || { type: 'Identifier', value: node.name }),
401
- };
402
-
403
- case 'KeyValueProperty':
404
- case 'ShorthandProperty':
405
- babelNode.type = 'ObjectProperty';
406
- const keyNode = node.key;
407
- const isComputedKey = keyNode?.type === 'Computed';
408
- const normalizedKey = normalizeMemberProperty(isComputedKey ? keyNode.expression : keyNode, node.computed);
409
- babelNode.key = normalizedKey.property;
410
- babelNode.value = convertSWCNode(node.value);
411
- babelNode.computed = normalizedKey.computed || isComputedKey || node.computed || false;
412
- babelNode.shorthand = swcType === 'ShorthandProperty';
413
- babelNode.method = false;
414
- break;
415
-
416
- case 'GetterProperty':
417
- case 'SetterProperty':
418
- case 'MethodProperty':
419
- babelNode.type = 'ObjectMethod';
420
- const objMethodKey = node.key;
421
- const objMethodComputed = objMethodKey?.type === 'Computed';
422
- const normalizedObjMethodKey = normalizeMemberProperty(objMethodComputed ? objMethodKey.expression : objMethodKey, node.computed);
423
- babelNode.key = normalizedObjMethodKey.property;
424
- babelNode.kind = swcType === 'GetterProperty' ? 'get' :
425
- swcType === 'SetterProperty' ? 'set' : 'method';
426
- babelNode.params = convertSWCNode(normalizeParams(node.params));
427
- babelNode.body = convertSWCNode(node.body);
428
- babelNode.computed = normalizedObjMethodKey.computed || objMethodComputed || node.computed || false;
429
- babelNode.generator = node.generator || false;
430
- babelNode.async = node.async || false;
431
- break;
432
-
433
- case 'ImportDeclaration':
434
- babelNode.source = convertSWCNode(node.source);
435
- babelNode.specifiers = convertSWCNode(node.specifiers || []);
436
- babelNode.importKind = node.typeOnly ? 'type' : 'value';
437
- break;
438
- case 'BlockStatement':
439
- babelNode.body = convertSWCNode(node.body || node.stmts || []);
440
- break;
441
-
442
- case 'ReturnStatement':
443
- babelNode.argument = convertSWCNode(node.argument ?? node.value ?? node.expr ?? null);
444
- break;
445
-
446
- case 'ExpressionStatement':
447
- babelNode.expression = convertSWCNode(node.expression ?? node.expr);
448
- break;
449
-
450
- case 'ImportSpecifier':
451
- babelNode.imported = convertSWCNode(node.imported || node.local);
452
- babelNode.local = convertSWCNode(node.local);
453
- break;
454
-
455
- case 'ImportDefaultSpecifier':
456
- babelNode.local = convertSWCNode(node.local);
457
- break;
458
-
459
- case 'ImportNamespaceSpecifier':
460
- babelNode.local = convertSWCNode(node.local);
461
- break;
462
-
463
- case 'ExportNamedDeclaration':
464
- babelNode.declaration = convertSWCNode(node.declaration);
465
- babelNode.specifiers = convertSWCNode(node.specifiers || []);
466
- babelNode.source = convertSWCNode(node.source);
467
- break;
468
-
469
- case 'ExportDefaultDeclaration':
470
- babelNode.declaration = convertSWCNode(node.decl || node.declaration);
471
- break;
472
-
473
- case 'VariableDeclaration':
474
- babelNode.kind = node.kind;
475
- babelNode.declarations = convertSWCNode(node.declarations);
476
- break;
477
-
478
- case 'VariableDeclarator':
479
- babelNode.id = convertSWCNode(node.id);
480
- babelNode.init = convertSWCNode(node.init);
481
- break;
482
-
483
- case 'FunctionDeclaration':
484
- case 'FunctionExpression':
485
- babelNode.id = convertSWCNode(node.identifier);
486
- babelNode.params = convertSWCNode(normalizeParams(node.params));
487
- babelNode.body = convertSWCNode(node.body);
488
- babelNode.generator = node.generator || false;
489
- babelNode.async = node.async || false;
490
- break;
491
-
492
- case 'ArrowFunctionExpression':
493
- babelNode.params = convertSWCNode(normalizeParams(node.params));
494
- babelNode.body = convertSWCNode(node.body);
495
- babelNode.async = node.async || false;
496
- babelNode.expression = node.body?.type !== 'BlockStatement';
497
- break;
498
-
499
- case 'ClassDeclaration':
500
- case 'ClassExpression':
501
- babelNode.id = convertSWCNode(node.identifier || node.id);
502
- babelNode.superClass = convertSWCNode(node.superClass);
503
- babelNode.decorators = convertSWCNode(node.decorators || []);
504
- babelNode.body = {
505
- type: 'ClassBody',
506
- body: convertSWCNode(node.body?.body || node.body || []),
507
- };
508
- break;
509
-
510
- case 'ClassMethod':
511
- case 'ClassPrivateMethod':
512
- case 'Constructor':
513
- const classMethodKey = node.key;
514
- const classMethodComputed = classMethodKey?.type === 'Computed';
515
- const normalizedClassMethodKey = normalizeMemberProperty(classMethodComputed ? classMethodKey.expression : classMethodKey, node.computed);
516
- babelNode.key = normalizedClassMethodKey.property;
517
- babelNode.kind = swcType === 'Constructor' ? 'constructor' : (node.kind || 'method');
518
- babelNode.params = convertSWCNode(normalizeParams(node.function?.params || node.params));
519
- babelNode.body = convertSWCNode(node.function?.body || node.body);
520
- babelNode.computed = normalizedClassMethodKey.computed || classMethodComputed || node.computed || false;
521
- babelNode.static = node.isStatic || node.static || false;
522
- babelNode.async = node.function?.isAsync || node.async || false;
523
- babelNode.generator = node.function?.isGenerator || node.generator || false;
524
- break;
525
-
526
- case 'ClassProperty':
527
- case 'ClassPrivateProperty':
528
- const classPropKey = node.key;
529
- const classPropComputed = classPropKey?.type === 'Computed';
530
- const normalizedClassPropKey = normalizeMemberProperty(classPropComputed ? classPropKey.expression : classPropKey, node.computed);
531
- babelNode.key = normalizedClassPropKey.property;
532
- babelNode.value = convertSWCNode(node.value);
533
- babelNode.computed = normalizedClassPropKey.computed || classPropComputed || node.computed || false;
534
- babelNode.static = node.isStatic || node.static || false;
535
- break;
536
-
537
- case 'CallExpression':
538
- babelNode.callee = convertSWCNode(node.callee);
539
- babelNode.arguments = convertSWCNode(node.arguments || []);
540
- break;
541
-
542
- case 'OptionalChainingExpression': {
543
- const base = node.base || node.expression || node.expr || node.argument;
544
- const converted = convertSWCNode(base);
545
-
546
- if (converted && (converted.type === 'MemberExpression' || converted.type === 'OptionalMemberExpression')) {
547
- converted.type = 'OptionalMemberExpression';
548
- converted.optional = true;
549
- }
550
-
551
- if (converted && (converted.type === 'CallExpression' || converted.type === 'OptionalCallExpression')) {
552
- converted.type = 'OptionalCallExpression';
553
- converted.optional = true;
554
- }
555
-
556
- return converted;
557
- }
558
-
559
- case 'MemberExpression':
560
- babelNode.object = convertSWCNode(node.object);
561
- const memberProp = normalizeMemberProperty(node.property, node.computed);
562
- babelNode.property = memberProp.property;
563
- babelNode.computed = memberProp.computed;
564
- babelNode.optional = node.optional || false;
565
- break;
566
- case 'NewExpression':
567
- babelNode.callee = convertSWCNode(node.callee);
568
- babelNode.arguments = convertSWCNode(node.arguments || []);
569
- break;
570
- case 'OptionalCallExpression':
571
- babelNode.callee = convertSWCNode(node.callee);
572
- babelNode.arguments = convertSWCNode(node.arguments || []);
573
- babelNode.optional = true;
574
- break;
575
-
576
- case 'JSXElement':
577
- babelNode.openingElement = convertSWCNode(node.opening);
578
- babelNode.closingElement = convertSWCNode(node.closing);
579
- babelNode.children = convertSWCNode(node.children || []);
580
- babelNode.selfClosing = !node.closing;
581
- break;
582
-
583
- case 'JSXOpeningElement':
584
- babelNode.name = convertSWCNode(node.name);
585
- babelNode.attributes = convertSWCNode(node.attributes || []);
586
- babelNode.selfClosing = node.selfClosing || false;
587
- break;
588
-
589
- case 'JSXClosingElement':
590
- babelNode.name = convertSWCNode(node.name);
591
- break;
592
-
593
- case 'JSXAttribute':
594
- babelNode.name = convertSWCNode(node.name);
595
- babelNode.value = convertSWCNode(node.value);
596
- break;
597
-
598
- case 'JSXIdentifier':
599
- babelNode.name = node.value;
600
- break;
601
-
602
- case 'JSXText':
603
- babelNode.value = node.value;
604
- babelNode.raw = node.raw || node.value;
605
- break;
606
-
607
- case 'TemplateElement':
608
- return {
609
- type: 'TemplateElement',
610
- value: {
611
- raw: node.raw ?? node.value?.raw ?? node.cooked ?? '',
612
- cooked: node.cooked ?? node.value?.cooked ?? node.raw ?? '',
613
- },
614
- tail: node.tail ?? false,
615
- };
616
-
617
- case 'JSXExpressionContainer':
618
- babelNode.expression = convertSWCNode(node.expression);
619
- break;
620
-
621
- case 'JSXFragment':
622
- babelNode.openingFragment = { type: 'JSXOpeningFragment' };
623
- babelNode.closingFragment = { type: 'JSXClosingFragment' };
624
- babelNode.children = convertSWCNode(node.children || []);
625
- break;
626
-
627
- default:
628
- // ͨ�ô������ݹ�ת����������
629
- for (const key of Object.keys(node)) {
630
- if (key === 'type' || key === 'span' || key === 'ctxt') continue;
631
- babelNode[key] = convertSWCNode(node[key]);
632
- }
633
- }
634
-
635
- return babelNode;
636
- }
637
-
638
- /**
639
- * �� SWC AST ת��Ϊ Babel ���ݸ�ʽ
640
- */
641
- export function convertSWCToBabel(swcAst: any): t.File {
642
- const startTime = performance.now();
643
- const result = convertSWCNode(swcAst) as t.File;
644
- const duration = performance.now() - startTime;
645
-
646
- swcStats.conversionCount++;
647
- swcStats.conversionTotalTime += duration;
648
-
649
- return result;
650
- }
651
-
652
- /**
653
- * ʹ�� SWC ��������
654
- * ��� SWC �����ã����˵� Babel
655
- */
656
- export function parseWithSWC(code: string): t.File {
657
- const safeCode = sanitizePermissionCommentsForJSX(code);
658
- if (!swcAvailable || !swcModule) {
659
- // ���˵� Babel
660
- const startTime = performance.now();
661
- const ast = babelParse(safeCode, babelParserConfig);
662
- swcStats.babelFallbackCount++;
663
- swcStats.babelTotalTime += performance.now() - startTime;
664
- return ast;
665
- }
666
-
667
- try {
668
- // ʹ�� SWC ����
669
- const startTime = performance.now();
670
- const swcAst = swcModule.parseSync(safeCode, swcParserConfig);
671
- const parseTime = performance.now() - startTime;
672
-
673
- swcStats.swcParseCount++;
674
- swcStats.swcTotalTime += parseTime;
675
-
676
- // ת��Ϊ Babel ��ʽ
677
- return convertSWCToBabel(swcAst);
678
- } catch (error) {
679
- // ����ʧ�ܣ����˵� Babel
680
- console.warn('[SWC] ����ʧ�ܣ����˵� Babel:', error);
681
- const startTime = performance.now();
682
- const ast = babelParse(safeCode, babelParserConfig);
683
- swcStats.babelFallbackCount++;
684
- swcStats.babelTotalTime += performance.now() - startTime;
685
- return ast;
686
- }
687
- }
688
-
689
- /**
690
- * �첽ʹ�� SWC ��������
691
- */
692
- export async function parseWithSWCAsync(code: string): Promise<t.File> {
693
- // ȷ�� SWC �ѳ�ʼ��
694
- await initSWC();
695
- return parseWithSWC(code);
696
- }
697
-
698
- /**
699
- * ��ȡ SWC ����ͳ��
700
- */
701
- export function getSWCStats() {
702
- return {
703
- ...swcStats,
704
- swcAvailable,
705
- swcAverageParseTime: swcStats.swcParseCount > 0
706
- ? swcStats.swcTotalTime / swcStats.swcParseCount
707
- : 0,
708
- babelAverageTime: swcStats.babelFallbackCount > 0
709
- ? swcStats.babelTotalTime / swcStats.babelFallbackCount
710
- : 0,
711
- conversionAverageTime: swcStats.conversionCount > 0
712
- ? swcStats.conversionTotalTime / swcStats.conversionCount
713
- : 0,
714
- speedup: swcStats.babelFallbackCount > 0 && swcStats.swcParseCount > 0
715
- ? (swcStats.babelTotalTime / swcStats.babelFallbackCount) /
716
- ((swcStats.swcTotalTime + swcStats.conversionTotalTime) / swcStats.swcParseCount)
717
- : 0,
718
- };
719
- }
720
-
721
- /**
722
- * ��ӡ SWC ���ܱ���
723
- */
724
- export function printSWCReport(): void {
725
- const stats = getSWCStats();
726
-
727
- console.log('%c=== SWC Parser Report ===', 'color: #FF5722; font-weight: bold;');
728
- console.log(`SWC ����: ${stats.swcAvailable ? '?' : '?'}`);
729
- console.log(`%cSWC ��������: ${stats.swcParseCount}`, 'color: #4CAF50;');
730
- console.log(`%cSWC �ܺ�ʱ: ${stats.swcTotalTime.toFixed(2)}ms`, 'color: #4CAF50;');
731
- console.log(`%cSWC ƽ����ʱ: ${stats.swcAverageParseTime.toFixed(2)}ms`, 'color: #4CAF50;');
732
- console.log(`%cBabel ���˴���: ${stats.babelFallbackCount}`, 'color: #FF9800;');
733
- console.log(`%cBabel �ܺ�ʱ: ${stats.babelTotalTime.toFixed(2)}ms`, 'color: #FF9800;');
734
- console.log(`%cBabel ƽ����ʱ: ${stats.babelAverageTime.toFixed(2)}ms`, 'color: #FF9800;');
735
- console.log(`AST ת������: ${stats.conversionCount}`);
736
- console.log(`AST ת��ƽ����ʱ: ${stats.conversionAverageTime.toFixed(2)}ms`);
737
- if (stats.speedup > 0) {
738
- console.log(`%c���ٱ�: ${stats.speedup.toFixed(1)}x`, 'color: #E91E63; font-weight: bold;');
739
- }
740
- console.log('%c=========================', 'color: #FF5722; font-weight: bold;');
741
- }
742
-
743
- // ��¶��ȫ�֣��������
744
- if (typeof window !== 'undefined') {
745
- (window as any).__SWC_PARSER__ = {
746
- initSWC,
747
- isSWCAvailable,
748
- parseWithSWC,
749
- parseWithSWCAsync,
750
- getSWCStats,
751
- printSWCReport,
752
- };
753
- }
1
+ [ASTCache] Parse miss (SWC) - /src/pages/Login/index.js (1.50ms)
2
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/Home.js (1.40ms)
3
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/TaskPending.js (2.00ms)
4
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/TaskCompleted.js (1.90ms)
5
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/CirculatePending.js (1.90ms)
6
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/CirculateCompleted.js (2.20ms)
7
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/MyProcess.js (1.80ms)
8
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/SyncProcess.js (5.70ms)
9
+ swc-parser.ts:680 [SWC] ����ʧ�ܣ����˵� Babel:
10
+ x Unexpected token `Page`. Expected jsx identifier
11
+ ,-[1:1]
12
+ 1 | import React from "react";import { definePage } from "@loview/lowcode-react-boot";import { Page, QueryPage, FForm, FFormItem, FFormFooter, FSubmit, FReset, Table } from "@loview/lowcode-react-antd";class App extends React.Component {render() {return (<Page data-dnd="%2Fsrc%2Fpages%2FImportRecord.js:Page:paged4ad" onMount={() => {$function.importRecord.fetchRecord();}} access={{ relatedInterfaces: [{ label: "�����¼�б��ӿ�", value: "/los/${appName}.pageImportApply" }] }}>
13
+ :  ^^^^
14
+ 2 |
15
+ 3 |
16
+ `----
17
+
18
+
19
+ Caused by:
20
+ 0: failed to parse code
21
+ 1: Syntax Error
22
+ parseWithSWC @ swc-parser.ts:680
23
+ parseCode @ ast-cache.ts:740
24
+ parseSync @ ast-cache.ts:933
25
+ code2astWithCache @ ast-cache.ts:1277
26
+ code2astCached @ parse.ts:112
27
+ get @ light-module.ts:91
28
+ get @ light-module.ts:107
29
+ trackDerivedFunction @ mobx.esm.js:1842
30
+ computeValue_ @ mobx.esm.js:1636
31
+ trackAndCompute @ mobx.esm.js:1613
32
+ get @ mobx.esm.js:1582
33
+ getObservablePropValue_ @ mobx.esm.js:4744
34
+ get @ mobx.esm.js:5243
35
+ hasModelDiff @ workspace.ts:3262
36
+ (anonymous) @ useFolder.tsx:71
37
+ makeFileTree @ useFolder.tsx:64
38
+ useFolder @ useFolder.tsx:303
39
+ (anonymous) @ index.tsx:65
40
+ (anonymous) @ observer.js:44
41
+ (anonymous) @ useObserver.js:80
42
+ trackDerivedFunction @ mobx.esm.js:1842
43
+ track @ mobx.esm.js:2360
44
+ useObserver @ useObserver.js:78
45
+ (anonymous) @ observer.js:44
46
+ renderWithHooks @ react-dom.development.js:15015
47
+ updateFunctionComponent @ react-dom.development.js:17386
48
+ updateSimpleMemoComponent @ react-dom.development.js:17245
49
+ beginWork @ react-dom.development.js:19170
50
+ beginWork$1 @ react-dom.development.js:23970
51
+ performUnitOfWork @ react-dom.development.js:22809
52
+ workLoopSync @ react-dom.development.js:22737
53
+ renderRootSync @ react-dom.development.js:22700
54
+ performSyncWorkOnRoot @ react-dom.development.js:22323
55
+ (anonymous) @ react-dom.development.js:11357
56
+ unstable_runWithPriority @ react.development.js:2764
57
+ runWithPriority$1 @ react-dom.development.js:11306
58
+ flushSyncCallbackQueueImpl @ react-dom.development.js:11352
59
+ flushSyncCallbackQueue @ react-dom.development.js:11339
60
+ discreteUpdates$1 @ react-dom.development.js:22450
61
+ discreteUpdates @ react-dom.development.js:3753
62
+ dispatchDiscreteEvent @ react-dom.development.js:5919
63
+ light-module.ts:99 SyntaxError: Unexpected token (43:732) (at index.js:363:1)
64
+ at constructor (index.js:363:1)
65
+ at JSXParserMixin.raise (index.js:6609:1)
66
+ at JSXParserMixin.unexpected (index.js:6629:1)
67
+ at JSXParserMixin.parseExprAtom (index.js:11378:1)
68
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
69
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
70
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
71
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
72
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
73
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
74
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
75
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
76
+ at index.js:10734:1
77
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
78
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
79
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
80
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
81
+ at JSXParserMixin.parsePropertyDefinition (index.js:11850:1)
82
+ at JSXParserMixin.parseObjectLike (index.js:11765:1)
83
+ at JSXParserMixin.parseExprAtom (index.js:11270:1)
84
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
85
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
86
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
87
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
88
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
89
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
90
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
91
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
92
+ at index.js:10734:1
93
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
94
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
95
+ at JSXParserMixin.parseParenAndDistinguishExpression (index.js:11608:1)
96
+ at JSXParserMixin.parseExprAtom (index.js:11262:1)
97
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
98
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
99
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
100
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
101
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
102
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
103
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
104
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
105
+ at index.js:10734:1
106
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
107
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
108
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
109
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
110
+ at JSXParserMixin.parsePropertyDefinition (index.js:11850:1)
111
+ at JSXParserMixin.parseObjectLike (index.js:11765:1)
112
+ at JSXParserMixin.parseExprAtom (index.js:11270:1)
113
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
114
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/PositionMgt.js (2.00ms)
115
+ swc-parser.ts:680 [SWC] ����ʧ�ܣ����˵� Babel:
116
+ x Unexpected token `Page`. Expected jsx identifier
117
+ ,-[1:1]
118
+ 1 | import React from "react";import { definePage } from "@loview/lowcode-react-boot";import { Page, Tree, Row, Col, Button, Descriptions, Block, Dropdown } from "@loview/lowcode-react-antd";import Modal894 from "./DepartmentMgtModals/Modal894.js";class App extends React.Component {render() {return (<Page data-dnd="%2Fsrc%2Fpages%2FDepartmentMgt.js:Page:page367f" onMount={() => {$function.department?.getDepartmentTree?.();$function.department.getDepartmentListUser();}} access={{ relatedInterfaces: [{ label: "��ȡ�������ӿ�", value: "/los/${appName}.listDepartmentTree" }, { label: "��ѯ��Ա�ӿ�", value: "/los/${appName}.listUser" }] }} className="deptMgt-page">
119
+ :  ^^^^
120
+ 2 |
121
+ 3 |
122
+ `----
123
+
124
+
125
+ Caused by:
126
+ 0: failed to parse code
127
+ 1: Syntax Error
128
+ parseWithSWC @ swc-parser.ts:680
129
+ parseCode @ ast-cache.ts:740
130
+ parseSync @ ast-cache.ts:933
131
+ code2astWithCache @ ast-cache.ts:1277
132
+ code2astCached @ parse.ts:112
133
+ get @ light-module.ts:91
134
+ get @ light-module.ts:107
135
+ trackDerivedFunction @ mobx.esm.js:1842
136
+ computeValue_ @ mobx.esm.js:1636
137
+ trackAndCompute @ mobx.esm.js:1613
138
+ get @ mobx.esm.js:1582
139
+ getObservablePropValue_ @ mobx.esm.js:4744
140
+ get @ mobx.esm.js:5243
141
+ hasModelDiff @ workspace.ts:3262
142
+ (anonymous) @ useFolder.tsx:71
143
+ makeFileTree @ useFolder.tsx:64
144
+ useFolder @ useFolder.tsx:303
145
+ (anonymous) @ index.tsx:65
146
+ (anonymous) @ observer.js:44
147
+ (anonymous) @ useObserver.js:80
148
+ trackDerivedFunction @ mobx.esm.js:1842
149
+ track @ mobx.esm.js:2360
150
+ useObserver @ useObserver.js:78
151
+ (anonymous) @ observer.js:44
152
+ renderWithHooks @ react-dom.development.js:15015
153
+ updateFunctionComponent @ react-dom.development.js:17386
154
+ updateSimpleMemoComponent @ react-dom.development.js:17245
155
+ beginWork @ react-dom.development.js:19170
156
+ beginWork$1 @ react-dom.development.js:23970
157
+ performUnitOfWork @ react-dom.development.js:22809
158
+ workLoopSync @ react-dom.development.js:22737
159
+ renderRootSync @ react-dom.development.js:22700
160
+ performSyncWorkOnRoot @ react-dom.development.js:22323
161
+ (anonymous) @ react-dom.development.js:11357
162
+ unstable_runWithPriority @ react.development.js:2764
163
+ runWithPriority$1 @ react-dom.development.js:11306
164
+ flushSyncCallbackQueueImpl @ react-dom.development.js:11352
165
+ flushSyncCallbackQueue @ react-dom.development.js:11339
166
+ discreteUpdates$1 @ react-dom.development.js:22450
167
+ discreteUpdates @ react-dom.development.js:3753
168
+ dispatchDiscreteEvent @ react-dom.development.js:5919
169
+ light-module.ts:99 SyntaxError: Unexpected token (13:233) (at index.js:363:1)
170
+ at constructor (index.js:363:1)
171
+ at JSXParserMixin.raise (index.js:6609:1)
172
+ at JSXParserMixin.unexpected (index.js:6629:1)
173
+ at JSXParserMixin.parseExprAtom (index.js:11378:1)
174
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
175
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
176
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
177
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
178
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
179
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
180
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
181
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
182
+ at index.js:10734:1
183
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
184
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
185
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
186
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
187
+ at JSXParserMixin.parsePropertyDefinition (index.js:11850:1)
188
+ at JSXParserMixin.parseObjectLike (index.js:11765:1)
189
+ at JSXParserMixin.parseExprAtom (index.js:11270:1)
190
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
191
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
192
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
193
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
194
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
195
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
196
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
197
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
198
+ at index.js:10734:1
199
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
200
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
201
+ at JSXParserMixin.parseParenAndDistinguishExpression (index.js:11608:1)
202
+ at JSXParserMixin.parseExprAtom (index.js:11262:1)
203
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
204
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
205
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
206
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
207
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
208
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
209
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
210
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
211
+ at JSXParserMixin.parseExpressionBase (index.js:10718:1)
212
+ at index.js:10714:1
213
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
214
+ at JSXParserMixin.parseExpression (index.js:10714:1)
215
+ at JSXParserMixin.jsxParseExpressionContainer (index.js:4644:1)
216
+ at JSXParserMixin.jsxParseAttributeValue (index.js:4616:1)
217
+ at JSXParserMixin.jsxParseAttribute (index.js:4665:1)
218
+ at JSXParserMixin.jsxParseOpeningElementAfterName (index.js:4679:1)
219
+ at JSXParserMixin.jsxParseOpeningElementAt (index.js:4674:1)
220
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/UserMgt.js (3.00ms)
221
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/ResourceMgt.js (1.00ms)
222
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/createItem.js (6.10ms)
223
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/traceTask.js (5.80ms)
224
+ swc-parser.ts:680 [SWC] ����ʧ�ܣ����˵� Babel:
225
+ x Unexpected token `}`. Expected yield, an identifier, [ or {
226
+ ,-[1:1]
227
+ 1 | import React from "react";import { definePage } from "@loview/lowcode-react-boot";import { Page } from "@loview/lowcode-react-antd";import WorkFlowProcessConfigPage from "../components/WorkFlowProcessTrace/index.js";class App extends React.Component {render() {const { match: } = this.props;const id = match.params?.id;return (<Page data-dnd="%2Fsrc%2Fpages%2FTraceProcess.js:Page:pagefa71" onMount={() => {$function.process.fetchInitProcessTrace(id);}} access={{ relatedInterfaces: [{ label: "����׷�ٽӿ�", value: "/los/${appName}.traceProcess" }, { label: "����׷��-�����������־���ӿ�", value: "/los/${appName}.listComments" }, { label: "����׷��-����ʵ������ӿ�", value: "/los/${appName}.processInstanceDetail" }] }}>
228
+ :  ^
229
+ 2 |
230
+ 3 |
231
+ `----
232
+
233
+
234
+ Caused by:
235
+ 0: failed to parse code
236
+ 1: Syntax Error
237
+ parseWithSWC @ swc-parser.ts:680
238
+ parseCode @ ast-cache.ts:740
239
+ parseSync @ ast-cache.ts:933
240
+ code2astWithCache @ ast-cache.ts:1277
241
+ code2astCached @ parse.ts:112
242
+ get @ light-module.ts:91
243
+ get @ light-module.ts:107
244
+ trackDerivedFunction @ mobx.esm.js:1842
245
+ computeValue_ @ mobx.esm.js:1636
246
+ trackAndCompute @ mobx.esm.js:1613
247
+ get @ mobx.esm.js:1582
248
+ getObservablePropValue_ @ mobx.esm.js:4744
249
+ get @ mobx.esm.js:5243
250
+ hasModelDiff @ workspace.ts:3262
251
+ (anonymous) @ useFolder.tsx:71
252
+ makeFileTree @ useFolder.tsx:64
253
+ useFolder @ useFolder.tsx:303
254
+ (anonymous) @ index.tsx:65
255
+ (anonymous) @ observer.js:44
256
+ (anonymous) @ useObserver.js:80
257
+ trackDerivedFunction @ mobx.esm.js:1842
258
+ track @ mobx.esm.js:2360
259
+ useObserver @ useObserver.js:78
260
+ (anonymous) @ observer.js:44
261
+ renderWithHooks @ react-dom.development.js:15015
262
+ updateFunctionComponent @ react-dom.development.js:17386
263
+ updateSimpleMemoComponent @ react-dom.development.js:17245
264
+ beginWork @ react-dom.development.js:19170
265
+ beginWork$1 @ react-dom.development.js:23970
266
+ performUnitOfWork @ react-dom.development.js:22809
267
+ workLoopSync @ react-dom.development.js:22737
268
+ renderRootSync @ react-dom.development.js:22700
269
+ performSyncWorkOnRoot @ react-dom.development.js:22323
270
+ (anonymous) @ react-dom.development.js:11357
271
+ unstable_runWithPriority @ react.development.js:2764
272
+ runWithPriority$1 @ react-dom.development.js:11306
273
+ flushSyncCallbackQueueImpl @ react-dom.development.js:11352
274
+ flushSyncCallbackQueue @ react-dom.development.js:11339
275
+ discreteUpdates$1 @ react-dom.development.js:22450
276
+ discreteUpdates @ react-dom.development.js:3753
277
+ dispatchDiscreteEvent @ react-dom.development.js:5919
278
+ light-module.ts:99 SyntaxError: Unexpected token (1:276) (at index.js:363:1)
279
+ at constructor (index.js:363:1)
280
+ at JSXParserMixin.raise (index.js:6609:1)
281
+ at JSXParserMixin.unexpected (index.js:6629:1)
282
+ at JSXParserMixin.parseIdentifierName (index.js:12138:1)
283
+ at JSXParserMixin.parseIdentifier (index.js:12116:1)
284
+ at JSXParserMixin.parseBindingAtom (index.js:7345:1)
285
+ at JSXParserMixin.parseMaybeDefault (index.js:7428:1)
286
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
287
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
288
+ at JSXParserMixin.parseBindingProperty (index.js:7409:1)
289
+ at JSXParserMixin.parseObjectLike (index.js:11763:1)
290
+ at JSXParserMixin.parseBindingAtom (index.js:7343:1)
291
+ at JSXParserMixin.parseVarId (index.js:13321:1)
292
+ at JSXParserMixin.parseVar (index.js:13302:1)
293
+ at JSXParserMixin.parseVarStatement (index.js:13149:1)
294
+ at JSXParserMixin.parseStatementContent (index.js:12770:1)
295
+ at JSXParserMixin.parseStatementLike (index.js:12685:1)
296
+ at JSXParserMixin.parseStatementListItem (index.js:12665:1)
297
+ at JSXParserMixin.parseBlockOrModuleBlockBody (index.js:13235:1)
298
+ at JSXParserMixin.parseBlockBody (index.js:13228:1)
299
+ at JSXParserMixin.parseBlock (index.js:13216:1)
300
+ at JSXParserMixin.parseFunctionBody (index.js:12035:1)
301
+ at JSXParserMixin.parseFunctionBodyAndFinish (index.js:12021:1)
302
+ at JSXParserMixin.parseMethod (index.js:11979:1)
303
+ at JSXParserMixin.pushClassMethod (index.js:13642:1)
304
+ at JSXParserMixin.parseClassMemberWithIsStatic (index.js:13530:1)
305
+ at JSXParserMixin.parseClassMember (index.js:13478:1)
306
+ at index.js:13432:1
307
+ at JSXParserMixin.withSmartMixTopicForbiddingContext (index.js:12338:1)
308
+ at JSXParserMixin.parseClassBody (index.js:13414:1)
309
+ at JSXParserMixin.parseClass (index.js:13389:1)
310
+ at JSXParserMixin.parseStatementContent (index.js:12712:1)
311
+ at JSXParserMixin.parseStatementLike (index.js:12685:1)
312
+ at JSXParserMixin.parseModuleItem (index.js:12662:1)
313
+ at JSXParserMixin.parseBlockOrModuleBlockBody (index.js:13235:1)
314
+ at JSXParserMixin.parseBlockBody (index.js:13228:1)
315
+ at JSXParserMixin.parseProgram (index.js:12541:1)
316
+ at JSXParserMixin.parseTopLevel (index.js:12531:1)
317
+ at JSXParserMixin.parse (index.js:14410:1)
318
+ at parse (index.js:14444:1)
319
+ at parseWithSWC (swc-parser.ts:682:1)
320
+ at ASTCache.parseCode (ast-cache.ts:740:1)
321
+ at ASTCache.parseSync (ast-cache.ts:933:1)
322
+ at code2astWithCache (ast-cache.ts:1277:1)
323
+ at code2astCached (parse.ts:112:1)
324
+ at LowCodeLightModule.get (light-module.ts:91:1)
325
+ at LowCodeLightModule.get (light-module.ts:107:1)
326
+ at trackDerivedFunction (mobx.esm.js:1842:1)
327
+ at ComputedValue.computeValue_ (mobx.esm.js:1636:1)
328
+ at ComputedValue.trackAndCompute (mobx.esm.js:1613:1)
329
+ swc-parser.ts:680 [SWC] ����ʧ�ܣ����˵� Babel:
330
+ x Unexpected token `,`. Expected yield, an identifier, [ or {
331
+ ,-[1:1]
332
+ 1 | import React from "react";import { definePage } from "@loview/lowcode-react-boot";import { getParamsFromRoute } from "../utils";import { Page, Button, Row, Section, Space, Table, Block } from "@loview/lowcode-react-antd";import Modal390 from "./ImportDetailModals/modal390.js";import Modal922 from "./ImportDetailModals/modal922.js";import Modal178 from "./ImportDetailModals/modal178.js";import Modal210 from "./ImportDetailModals/modal210.js";import Modal889 from "./ImportDetailModals/modal889.js";class App extends React.Component {render() {const { location: , match: } = this.props;const id = match.params?.id;const searchParams = getParamsFromRoute(location.search);const readonly = searchParams?.readonly === "true";return (<Page data-dnd="%2Fsrc%2Fpages%2FImportDetail.js:Page:page7312" onMount={() => {$function.userConflict.fetchUserTree();$function.deptConflict.fetchDeptTree();$function.roleConflict.fetchRoleList();$function.importRecord.fetchDetail(id);}} access={{ relatedInterfaces: [{ label: "��������ӿ�", value: "/los/${appName}.importProcessDetail" }, { label: "��������-���ź���Ա���ӿ�", value: "/los/${appName}.workflowDepartmentTree" }, { label: "��������-��ѯ��ɫ�ӿ�", value: "/los/${appName}.listRole" }, { label: "ȷ�ϵ���ӿ�", value: "/los/${appName}.importProcess" }, { label: "��������-��������ӿ�", value: "/los/${appName}.discardApply" }, { label: "��������-���õ�������ӿ�", value: "/los/${appName}.resetApplyStatus" }, { label: "��������-����û���ͻ�ӿ�", value: "/los/${appName}.resolveUser" }, { label: "��������-�����ɫ��ͻ�ӿ�", value: "/los/${appName}.resolveRole" }, { label: "��������-������̳�ͻ�ӿ�", value: "/los/${appName}.resolveProcess" }, { label: "��������-������ų�ͻ�ӿ�", value: "/los/${appName}.resolveDepartment" }, { label: "��������-�������key�ظ��ӿ�", value: "/los/${appName}.checkProcessKeyDuplicated" }] }}>
333
+ :  ^
334
+ 2 |
335
+ 3 |
336
+ `----
337
+
338
+
339
+ Caused by:
340
+ 0: failed to parse code
341
+ 1: Syntax Error
342
+ parseWithSWC @ swc-parser.ts:680
343
+ parseCode @ ast-cache.ts:740
344
+ parseSync @ ast-cache.ts:933
345
+ code2astWithCache @ ast-cache.ts:1277
346
+ code2astCached @ parse.ts:112
347
+ get @ light-module.ts:91
348
+ get @ light-module.ts:107
349
+ trackDerivedFunction @ mobx.esm.js:1842
350
+ computeValue_ @ mobx.esm.js:1636
351
+ trackAndCompute @ mobx.esm.js:1613
352
+ get @ mobx.esm.js:1582
353
+ getObservablePropValue_ @ mobx.esm.js:4744
354
+ get @ mobx.esm.js:5243
355
+ hasModelDiff @ workspace.ts:3262
356
+ (anonymous) @ useFolder.tsx:71
357
+ makeFileTree @ useFolder.tsx:64
358
+ useFolder @ useFolder.tsx:303
359
+ (anonymous) @ index.tsx:65
360
+ (anonymous) @ observer.js:44
361
+ (anonymous) @ useObserver.js:80
362
+ trackDerivedFunction @ mobx.esm.js:1842
363
+ track @ mobx.esm.js:2360
364
+ useObserver @ useObserver.js:78
365
+ (anonymous) @ observer.js:44
366
+ renderWithHooks @ react-dom.development.js:15015
367
+ updateFunctionComponent @ react-dom.development.js:17386
368
+ updateSimpleMemoComponent @ react-dom.development.js:17245
369
+ beginWork @ react-dom.development.js:19170
370
+ beginWork$1 @ react-dom.development.js:23970
371
+ performUnitOfWork @ react-dom.development.js:22809
372
+ workLoopSync @ react-dom.development.js:22737
373
+ renderRootSync @ react-dom.development.js:22700
374
+ performSyncWorkOnRoot @ react-dom.development.js:22323
375
+ (anonymous) @ react-dom.development.js:11357
376
+ unstable_runWithPriority @ react.development.js:2764
377
+ runWithPriority$1 @ react-dom.development.js:11306
378
+ flushSyncCallbackQueueImpl @ react-dom.development.js:11352
379
+ flushSyncCallbackQueue @ react-dom.development.js:11339
380
+ discreteUpdates$1 @ react-dom.development.js:22450
381
+ discreteUpdates @ react-dom.development.js:3753
382
+ dispatchDiscreteEvent @ react-dom.development.js:5919
383
+ light-module.ts:99 SyntaxError: Unexpected token (1:564) (at index.js:363:1)
384
+ at constructor (index.js:363:1)
385
+ at JSXParserMixin.raise (index.js:6609:1)
386
+ at JSXParserMixin.unexpected (index.js:6629:1)
387
+ at JSXParserMixin.parseIdentifierName (index.js:12138:1)
388
+ at JSXParserMixin.parseIdentifier (index.js:12116:1)
389
+ at JSXParserMixin.parseBindingAtom (index.js:7345:1)
390
+ at JSXParserMixin.parseMaybeDefault (index.js:7428:1)
391
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
392
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
393
+ at JSXParserMixin.parseBindingProperty (index.js:7409:1)
394
+ at JSXParserMixin.parseObjectLike (index.js:11763:1)
395
+ at JSXParserMixin.parseBindingAtom (index.js:7343:1)
396
+ at JSXParserMixin.parseVarId (index.js:13321:1)
397
+ at JSXParserMixin.parseVar (index.js:13302:1)
398
+ at JSXParserMixin.parseVarStatement (index.js:13149:1)
399
+ at JSXParserMixin.parseStatementContent (index.js:12770:1)
400
+ at JSXParserMixin.parseStatementLike (index.js:12685:1)
401
+ at JSXParserMixin.parseStatementListItem (index.js:12665:1)
402
+ at JSXParserMixin.parseBlockOrModuleBlockBody (index.js:13235:1)
403
+ at JSXParserMixin.parseBlockBody (index.js:13228:1)
404
+ at JSXParserMixin.parseBlock (index.js:13216:1)
405
+ at JSXParserMixin.parseFunctionBody (index.js:12035:1)
406
+ at JSXParserMixin.parseFunctionBodyAndFinish (index.js:12021:1)
407
+ at JSXParserMixin.parseMethod (index.js:11979:1)
408
+ at JSXParserMixin.pushClassMethod (index.js:13642:1)
409
+ at JSXParserMixin.parseClassMemberWithIsStatic (index.js:13530:1)
410
+ at JSXParserMixin.parseClassMember (index.js:13478:1)
411
+ at index.js:13432:1
412
+ at JSXParserMixin.withSmartMixTopicForbiddingContext (index.js:12338:1)
413
+ at JSXParserMixin.parseClassBody (index.js:13414:1)
414
+ at JSXParserMixin.parseClass (index.js:13389:1)
415
+ at JSXParserMixin.parseStatementContent (index.js:12712:1)
416
+ at JSXParserMixin.parseStatementLike (index.js:12685:1)
417
+ at JSXParserMixin.parseModuleItem (index.js:12662:1)
418
+ at JSXParserMixin.parseBlockOrModuleBlockBody (index.js:13235:1)
419
+ at JSXParserMixin.parseBlockBody (index.js:13228:1)
420
+ at JSXParserMixin.parseProgram (index.js:12541:1)
421
+ at JSXParserMixin.parseTopLevel (index.js:12531:1)
422
+ at JSXParserMixin.parse (index.js:14410:1)
423
+ at parse (index.js:14444:1)
424
+ at parseWithSWC (swc-parser.ts:682:1)
425
+ at ASTCache.parseCode (ast-cache.ts:740:1)
426
+ at ASTCache.parseSync (ast-cache.ts:933:1)
427
+ at code2astWithCache (ast-cache.ts:1277:1)
428
+ at code2astCached (parse.ts:112:1)
429
+ at LowCodeLightModule.get (light-module.ts:91:1)
430
+ at LowCodeLightModule.get (light-module.ts:107:1)
431
+ at trackDerivedFunction (mobx.esm.js:1842:1)
432
+ at ComputedValue.computeValue_ (mobx.esm.js:1636:1)
433
+ at ComputedValue.trackAndCompute (mobx.esm.js:1613:1)
434
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/UpdatePwd.js (1.30ms)
435
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/getTechItem.js (8.50ms)
436
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/createDemo.js (3.20ms)
437
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/createTechRequirement.js (10.30ms)
438
+ swc-parser.ts:680 [SWC] ����ʧ�ܣ����˵� Babel:
439
+ x Unexpected token `Page`. Expected jsx identifier
440
+ ,-[1:1]
441
+ 1 | import React from "react";import { definePage } from "@loview/lowcode-react-boot";import { Page, QueryPage, Section, Row, Col, FForm, FFormItem, FFormFooter, FReset, FSubmit, Space, Button, Table, Descriptions } from "@loview/lowcode-react-antd";import ReadModal from "./techReqDemoModals/ReadModal.js";import CreateModal from "./techReqDemoModals/CreateModal.js";import UpdateModal from "./techReqDemoModals/UpdateModal.js";class App extends React.Component {render() {return (<Page data-dnd="%2Fsrc%2Fpages%2FtechReqDemo.js:Page:page09a2">
442
+ :  ^^^^
443
+ 2 |
444
+ 3 | <div data-dnd="%2Fsrc%2Fpages%2FtechReqDemo.js:div:techRequirementd428" data-meta="TechRequirement" tid="techRequirementd428" data-name="TechRequirement" data-tag="MetaContext">
445
+ `----
446
+
447
+
448
+ Caused by:
449
+ 0: failed to parse code
450
+ 1: Syntax Error
451
+ parseWithSWC @ swc-parser.ts:680
452
+ parseCode @ ast-cache.ts:740
453
+ parseSync @ ast-cache.ts:933
454
+ code2astWithCache @ ast-cache.ts:1277
455
+ code2astCached @ parse.ts:112
456
+ get @ light-module.ts:91
457
+ get @ light-module.ts:107
458
+ trackDerivedFunction @ mobx.esm.js:1842
459
+ computeValue_ @ mobx.esm.js:1636
460
+ trackAndCompute @ mobx.esm.js:1613
461
+ get @ mobx.esm.js:1582
462
+ getObservablePropValue_ @ mobx.esm.js:4744
463
+ get @ mobx.esm.js:5243
464
+ hasDiff @ workspace.ts:3245
465
+ (anonymous) @ useFolder.tsx:71
466
+ makeFileTree @ useFolder.tsx:64
467
+ useFolder @ useFolder.tsx:303
468
+ (anonymous) @ index.tsx:65
469
+ (anonymous) @ observer.js:44
470
+ (anonymous) @ useObserver.js:80
471
+ trackDerivedFunction @ mobx.esm.js:1842
472
+ track @ mobx.esm.js:2360
473
+ useObserver @ useObserver.js:78
474
+ (anonymous) @ observer.js:44
475
+ renderWithHooks @ react-dom.development.js:15015
476
+ updateFunctionComponent @ react-dom.development.js:17386
477
+ updateSimpleMemoComponent @ react-dom.development.js:17245
478
+ beginWork @ react-dom.development.js:19170
479
+ beginWork$1 @ react-dom.development.js:23970
480
+ performUnitOfWork @ react-dom.development.js:22809
481
+ workLoopSync @ react-dom.development.js:22737
482
+ renderRootSync @ react-dom.development.js:22700
483
+ performSyncWorkOnRoot @ react-dom.development.js:22323
484
+ (anonymous) @ react-dom.development.js:11357
485
+ unstable_runWithPriority @ react.development.js:2764
486
+ runWithPriority$1 @ react-dom.development.js:11306
487
+ flushSyncCallbackQueueImpl @ react-dom.development.js:11352
488
+ flushSyncCallbackQueue @ react-dom.development.js:11339
489
+ discreteUpdates$1 @ react-dom.development.js:22450
490
+ discreteUpdates @ react-dom.development.js:3753
491
+ dispatchDiscreteEvent @ react-dom.development.js:5919
492
+ light-module.ts:99 SyntaxError: Unexpected token (289:4498) (at index.js:363:1)
493
+ at constructor (index.js:363:1)
494
+ at JSXParserMixin.raise (index.js:6609:1)
495
+ at JSXParserMixin.unexpected (index.js:6629:1)
496
+ at JSXParserMixin.parseExprAtom (index.js:11378:1)
497
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
498
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
499
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
500
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
501
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
502
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
503
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
504
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
505
+ at index.js:10734:1
506
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
507
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
508
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
509
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
510
+ at JSXParserMixin.parsePropertyDefinition (index.js:11850:1)
511
+ at JSXParserMixin.parseObjectLike (index.js:11765:1)
512
+ at JSXParserMixin.parseExprAtom (index.js:11270:1)
513
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
514
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
515
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
516
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
517
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
518
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
519
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
520
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
521
+ at index.js:10734:1
522
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
523
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
524
+ at JSXParserMixin.parseParenAndDistinguishExpression (index.js:11608:1)
525
+ at JSXParserMixin.parseExprAtom (index.js:11262:1)
526
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
527
+ at JSXParserMixin.parseExprSubscripts (index.js:11012:1)
528
+ at JSXParserMixin.parseUpdate (index.js:10997:1)
529
+ at JSXParserMixin.parseMaybeUnary (index.js:10977:1)
530
+ at JSXParserMixin.parseMaybeUnaryOrPrivate (index.js:10830:1)
531
+ at JSXParserMixin.parseExprOps (index.js:10835:1)
532
+ at JSXParserMixin.parseMaybeConditional (index.js:10812:1)
533
+ at JSXParserMixin.parseMaybeAssign (index.js:10765:1)
534
+ at index.js:10734:1
535
+ at JSXParserMixin.allowInAnd (index.js:12361:1)
536
+ at JSXParserMixin.parseMaybeAssignAllowIn (index.js:10734:1)
537
+ at JSXParserMixin.parseObjectProperty (index.js:11885:1)
538
+ at JSXParserMixin.parseObjPropValue (index.js:11913:1)
539
+ at JSXParserMixin.parsePropertyDefinition (index.js:11850:1)
540
+ at JSXParserMixin.parseObjectLike (index.js:11765:1)
541
+ at JSXParserMixin.parseExprAtom (index.js:11270:1)
542
+ at JSXParserMixin.parseExprAtom (index.js:4776:1)
543
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/techReqCreateDemo.js (20.10ms)
544
+ ast-cache.ts:944 [ASTCache] Parse miss (SWC) - /src/pages/techReqDetail.js (3.70ms)
545
+ sandbox.tsx:193 [useSandbox] Setting eventHandlers to sandboxProps, count: 13
546
+ index.tsx:92 [CodeSandbox] eventHandlers comparison: {changed: false, prevKeys: Array(13), nextKeys: Array(13), iframeReady: true}
547
+ sandbox.tsx:193 [useSandbox] Setting eventHandlers to sandboxProps, count: 13
548
+ index.tsx:92 [CodeSandbox] eventHandlers comparison: {changed: false, prevKeys: Array(13), nextKeys: Array(13), iframeReady: true}