lc-test3 1.1.11 → 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 -751
  2. package/package.json +1 -1
package/p.js CHANGED
@@ -1,751 +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 permissionCommentInJSXPattern = /\/\*\*[\s\S]*?RESOURCESTREE-START[\s\S]*?RESOURCESTREE-END[\s\S]*?\*\/(?=\s*<)/g;
46
-
47
- function sanitizePermissionCommentsForJSX(code: string) {
48
- return code.replace(permissionCommentInJSXPattern, (comment) => {
49
- const inner = comment
50
- .replace(/^\/\*\*?/, '')
51
- .replace(/\*\/$/, '');
52
- return `{/*${inner}*/}`;
53
- });
54
- }
55
-
56
- // ����ͳ��
57
- const swcStats = {
58
- swcParseCount: 0,
59
- swcTotalTime: 0,
60
- babelFallbackCount: 0,
61
- babelTotalTime: 0,
62
- conversionCount: 0,
63
- conversionTotalTime: 0,
64
- };
65
-
66
- /**
67
- * ��ʼ�� SWC WASM ģ��
68
- */
69
- export async function initSWC(): Promise<boolean> {
70
- if (swcAvailable) return true;
71
- if (swcInitPromise) {
72
- await swcInitPromise;
73
- return swcAvailable;
74
- }
75
-
76
- swcInitPromise = (async () => {
77
- try {
78
- // ��̬���� SWC WASM
79
- const swc = await import('@swc/wasm-web');
80
-
81
- // ��ʼ�� WASM����Ҫ���� .wasm �ļ���
82
- await swc.default();
83
-
84
- swcModule = swc;
85
- swcAvailable = true;
86
- console.log('%c[SWC] ? WASM ģ���ʼ���ɹ�', 'color: #4CAF50; font-weight: bold;');
87
- } catch (error) {
88
- console.warn('[SWC] ?? WASM ģ�����ʧ�ܣ���ʹ�� Babel ��Ϊ����:', error);
89
- swcAvailable = false;
90
- }
91
- })();
92
-
93
- await swcInitPromise;
94
- return swcAvailable;
95
- }
96
-
97
- /**
98
- * ��� SWC �Ƿ����
99
- */
100
- export function isSWCAvailable(): boolean {
101
- return swcAvailable;
102
- }
103
-
104
- /**
105
- * SWC AST �ڵ�����ӳ�䵽 Babel ����
106
- */
107
- const SWC_TO_BABEL_TYPE: Record<string, string> = {
108
- 'Module': 'File',
109
- 'Script': 'File',
110
- 'ImportDeclaration': 'ImportDeclaration',
111
- 'ExportDeclaration': 'ExportDeclaration',
112
- 'ExportDefaultDeclaration': 'ExportDefaultDeclaration',
113
- 'ExportDefaultExpression': 'ExportDefaultDeclaration',
114
- 'ExportNamedDeclaration': 'ExportNamedDeclaration',
115
- 'ExportAllDeclaration': 'ExportAllDeclaration',
116
- 'VariableDeclaration': 'VariableDeclaration',
117
- 'VariableDeclarator': 'VariableDeclarator',
118
- 'FunctionDeclaration': 'FunctionDeclaration',
119
- 'FunctionExpression': 'FunctionExpression',
120
- 'ArrowFunctionExpression': 'ArrowFunctionExpression',
121
- 'ClassDeclaration': 'ClassDeclaration',
122
- 'ClassExpression': 'ClassExpression',
123
- 'ClassMethod': 'ClassMethod',
124
- 'ClassPrivateMethod': 'ClassPrivateMethod',
125
- 'ClassProperty': 'ClassProperty',
126
- 'ClassPrivateProperty': 'ClassPrivateProperty',
127
- 'Constructor': 'ClassMethod',
128
- 'PrivateName': 'PrivateName',
129
- 'Identifier': 'Identifier',
130
- 'StringLiteral': 'StringLiteral',
131
- 'NumericLiteral': 'NumericLiteral',
132
- 'BooleanLiteral': 'BooleanLiteral',
133
- 'NullLiteral': 'NullLiteral',
134
- 'RegExpLiteral': 'RegExpLiteral',
135
- 'TemplateLiteral': 'TemplateLiteral',
136
- 'ArrayExpression': 'ArrayExpression',
137
- 'ObjectExpression': 'ObjectExpression',
138
- 'CallExpression': 'CallExpression',
139
- 'MemberExpression': 'MemberExpression',
140
- 'BinaryExpression': 'BinaryExpression',
141
- 'UnaryExpression': 'UnaryExpression',
142
- 'ConditionalExpression': 'ConditionalExpression',
143
- 'AssignmentExpression': 'AssignmentExpression',
144
- 'LogicalExpression': 'LogicalExpression',
145
- 'SequenceExpression': 'SequenceExpression',
146
- 'NewExpression': 'NewExpression',
147
- 'ThisExpression': 'ThisExpression',
148
- 'SpreadElement': 'SpreadElement',
149
- 'RestElement': 'RestElement',
150
- 'ObjectPattern': 'ObjectPattern',
151
- 'ArrayPattern': 'ArrayPattern',
152
- 'AssignmentPattern': 'AssignmentPattern',
153
- 'BlockStatement': 'BlockStatement',
154
- 'ReturnStatement': 'ReturnStatement',
155
- 'IfStatement': 'IfStatement',
156
- 'SwitchStatement': 'SwitchStatement',
157
- 'SwitchCase': 'SwitchCase',
158
- 'ForStatement': 'ForStatement',
159
- 'ForInStatement': 'ForInStatement',
160
- 'ForOfStatement': 'ForOfStatement',
161
- 'WhileStatement': 'WhileStatement',
162
- 'DoWhileStatement': 'DoWhileStatement',
163
- 'TryStatement': 'TryStatement',
164
- 'CatchClause': 'CatchClause',
165
- 'ThrowStatement': 'ThrowStatement',
166
- 'BreakStatement': 'BreakStatement',
167
- 'ContinueStatement': 'ContinueStatement',
168
- 'ExpressionStatement': 'ExpressionStatement',
169
- 'EmptyStatement': 'EmptyStatement',
170
- 'DebuggerStatement': 'DebuggerStatement',
171
- 'LabeledStatement': 'LabeledStatement',
172
- 'WithStatement': 'WithStatement',
173
- // JSX
174
- 'JSXElement': 'JSXElement',
175
- 'JSXFragment': 'JSXFragment',
176
- 'JSXOpeningElement': 'JSXOpeningElement',
177
- 'JSXClosingElement': 'JSXClosingElement',
178
- 'JSXOpeningFragment': 'JSXOpeningFragment',
179
- 'JSXClosingFragment': 'JSXClosingFragment',
180
- 'JSXAttribute': 'JSXAttribute',
181
- 'JSXSpreadAttribute': 'JSXSpreadAttribute',
182
- 'JSXExpressionContainer': 'JSXExpressionContainer',
183
- 'JSXText': 'JSXText',
184
- 'JSXIdentifier': 'JSXIdentifier',
185
- 'JSXMemberExpression': 'JSXMemberExpression',
186
- 'JSXNamespacedName': 'JSXNamespacedName',
187
- 'JSXEmptyExpression': 'JSXEmptyExpression',
188
- // ����
189
- 'AwaitExpression': 'AwaitExpression',
190
- 'YieldExpression': 'YieldExpression',
191
- 'TaggedTemplateExpression': 'TaggedTemplateExpression',
192
- 'TemplateElement': 'TemplateElement',
193
- 'OptionalMemberExpression': 'OptionalMemberExpression',
194
- 'OptionalCallExpression': 'OptionalCallExpression',
195
- 'ParenthesisExpression': 'ParenthesizedExpression',
196
- // Property ������Ҫ���⴦��
197
- 'KeyValueProperty': 'ObjectProperty',
198
- 'AssignmentProperty': 'ObjectProperty',
199
- 'GetterProperty': 'ObjectMethod',
200
- 'SetterProperty': 'ObjectMethod',
201
- 'MethodProperty': 'ObjectMethod',
202
- 'SpreadProperty': 'SpreadElement',
203
- 'ShorthandProperty': 'ObjectProperty',
204
- // Import/Export specifiers
205
- 'ImportDefaultSpecifier': 'ImportDefaultSpecifier',
206
- 'ImportSpecifier': 'ImportSpecifier',
207
- 'ImportNamespaceSpecifier': 'ImportNamespaceSpecifier',
208
- 'ExportSpecifier': 'ExportSpecifier',
209
- 'ExportDefaultSpecifier': 'ExportDefaultSpecifier',
210
- 'ExportNamespaceSpecifier': 'ExportNamespaceSpecifier',
211
- 'Computed': 'Computed',
212
- 'SuperPropExpression': 'MemberExpression',
213
- 'AssignmentPatternProperty': 'ObjectProperty',
214
- };
215
-
216
- /**
217
- * �淶�����������б�
218
- */
219
- function normalizeParams(params: any): any[] {
220
- if (Array.isArray(params)) {
221
- return params.map((p) => p?.pat || p);
222
- }
223
- if (params && Array.isArray(params.params)) {
224
- return params.params.map((p: any) => p?.pat || p);
225
- }
226
- return [];
227
- }
228
-
229
- /**
230
- * �淶����Ա���ԣ����� MemberExpression.property Ϊ MemberExpression ��������ʧ��
231
- */
232
- function normalizeMemberProperty(prop: any, computedFlag?: boolean): { property: any; computed: boolean } {
233
- if (!prop) {
234
- return { property: prop, computed: Boolean(computedFlag) };
235
- }
236
-
237
- if (prop.type === 'Computed') {
238
- return { property: convertSWCNode(prop.expression), computed: true };
239
- }
240
-
241
- const converted = convertSWCNode(prop);
242
- const needsComputed = converted?.type === 'MemberExpression';
243
- return { property: converted, computed: Boolean(computedFlag) || needsComputed };
244
- }
245
-
246
- /**
247
- * �ݹ�ת�� SWC AST �ڵ㵽 Babel AST ��ʽ
248
- */
249
- function convertSWCNode(node: any): any {
250
- if (!node || typeof node !== 'object') {
251
- return node;
252
- }
253
-
254
- // ��������
255
- if (Array.isArray(node)) {
256
- return node.map(convertSWCNode);
257
- }
258
-
259
- // ��ȡ�ڵ�����
260
- const swcType = node.type;
261
- if (!swcType) {
262
- // ���� SWC ExprOrSpread �ṹ��{ spread: null|{...}, expression: {...} }
263
- if ('expression' in node && 'spread' in node) {
264
- if (node.spread) {
265
- return {
266
- type: 'SpreadElement',
267
- argument: convertSWCNode(node.expression),
268
- };
269
- }
270
- return convertSWCNode(node.expression);
271
- }
272
- // ������ AST �ڵ�Ķ���
273
- const result: any = {};
274
- for (const key of Object.keys(node)) {
275
- result[key] = convertSWCNode(node[key]);
276
- }
277
- return result;
278
- }
279
-
280
- // ӳ������
281
- const babelType = SWC_TO_BABEL_TYPE[swcType] || swcType;
282
-
283
- // �����½ڵ�
284
- const babelNode: any = {
285
- type: babelType,
286
- };
287
-
288
- // �����������
289
- switch (swcType) {
290
- case 'SuperPropExpression':
291
- const superProp = normalizeMemberProperty(node.property, node.computed);
292
- return {
293
- type: 'MemberExpression',
294
- object: { type: 'Super' },
295
- property: superProp.property,
296
- computed: superProp.computed,
297
- };
298
-
299
- case 'AssignmentPatternProperty':
300
- return {
301
- type: 'ObjectProperty',
302
- key: convertSWCNode(node.key),
303
- value: convertSWCNode(node.value),
304
- computed: node.key?.type === 'Computed' || node.computed || false,
305
- shorthand: false,
306
- };
307
- case 'SuperPropExpression':
308
- return {
309
- type: 'MemberExpression',
310
- object: { type: 'Super' },
311
- property: convertSWCNode(node.property),
312
- computed: node.property?.type === 'Computed' || node.computed || false,
313
- };
314
-
315
- case 'AssignmentPatternProperty':
316
- return {
317
- type: 'ObjectProperty',
318
- key: convertSWCNode(node.key),
319
- value: convertSWCNode(node.value),
320
- computed: node.key?.type === 'Computed' || node.computed || false,
321
- shorthand: false,
322
- };
323
- case 'Computed':
324
- // SWC computed property wrapper
325
- return convertSWCNode(node.expression);
326
- case 'Program':
327
- return {
328
- type: 'Program',
329
- sourceType: node.sourceType || 'module',
330
- body: convertSWCNode(node.body || node.stmts || []),
331
- directives: [],
332
- };
333
- case 'Module':
334
- case 'Script':
335
- // ת��Ϊ Babel �� File �ṹ
336
- return {
337
- type: 'File',
338
- program: {
339
- type: 'Program',
340
- sourceType: 'module',
341
- body: convertSWCNode(node.body || node.stmts || []),
342
- directives: [],
343
- },
344
- };
345
-
346
- case 'ExportDefaultExpression':
347
- return {
348
- type: 'ExportDefaultDeclaration',
349
- declaration: convertSWCNode(node.expression || node.expr || node.decl),
350
- };
351
-
352
- case 'StringLiteral':
353
- babelNode.value = node.value;
354
- babelNode.raw = node.raw;
355
- break;
356
-
357
- case 'TemplateLiteral':
358
- babelNode.expressions = convertSWCNode(node.expressions || node.exprs || []);
359
- babelNode.quasis = convertSWCNode(node.quasis || []);
360
- if (!babelNode.quasis || babelNode.quasis.length === 0) {
361
- babelNode.quasis = [
362
- {
363
- type: 'TemplateElement',
364
- value: { raw: '', cooked: '' },
365
- tail: true,
366
- },
367
- ];
368
- }
369
- if (Array.isArray(babelNode.quasis) && Array.isArray(babelNode.expressions)) {
370
- if (babelNode.quasis.length === babelNode.expressions.length) {
371
- babelNode.quasis.push({
372
- type: 'TemplateElement',
373
- value: { raw: '', cooked: '' },
374
- tail: true,
375
- });
376
- }
377
- const last = babelNode.quasis[babelNode.quasis.length - 1];
378
- if (last) last.tail = true;
379
- }
380
- break;
381
-
382
- case 'NumericLiteral':
383
- babelNode.value = node.value;
384
- babelNode.raw = String(node.value);
385
- break;
386
-
387
- case 'BooleanLiteral':
388
- babelNode.value = node.value;
389
- break;
390
-
391
- case 'Identifier':
392
- babelNode.name = node.value;
393
- break;
394
-
395
- case 'PrivateName':
396
- return {
397
- type: 'PrivateName',
398
- id: convertSWCNode(node.id || { type: 'Identifier', value: node.name }),
399
- };
400
-
401
- case 'KeyValueProperty':
402
- case 'ShorthandProperty':
403
- babelNode.type = 'ObjectProperty';
404
- const keyNode = node.key;
405
- const isComputedKey = keyNode?.type === 'Computed';
406
- const normalizedKey = normalizeMemberProperty(isComputedKey ? keyNode.expression : keyNode, node.computed);
407
- babelNode.key = normalizedKey.property;
408
- babelNode.value = convertSWCNode(node.value);
409
- babelNode.computed = normalizedKey.computed || isComputedKey || node.computed || false;
410
- babelNode.shorthand = swcType === 'ShorthandProperty';
411
- babelNode.method = false;
412
- break;
413
-
414
- case 'GetterProperty':
415
- case 'SetterProperty':
416
- case 'MethodProperty':
417
- babelNode.type = 'ObjectMethod';
418
- const objMethodKey = node.key;
419
- const objMethodComputed = objMethodKey?.type === 'Computed';
420
- const normalizedObjMethodKey = normalizeMemberProperty(objMethodComputed ? objMethodKey.expression : objMethodKey, node.computed);
421
- babelNode.key = normalizedObjMethodKey.property;
422
- babelNode.kind = swcType === 'GetterProperty' ? 'get' :
423
- swcType === 'SetterProperty' ? 'set' : 'method';
424
- babelNode.params = convertSWCNode(normalizeParams(node.params));
425
- babelNode.body = convertSWCNode(node.body);
426
- babelNode.computed = normalizedObjMethodKey.computed || objMethodComputed || node.computed || false;
427
- babelNode.generator = node.generator || false;
428
- babelNode.async = node.async || false;
429
- break;
430
-
431
- case 'ImportDeclaration':
432
- babelNode.source = convertSWCNode(node.source);
433
- babelNode.specifiers = convertSWCNode(node.specifiers || []);
434
- babelNode.importKind = node.typeOnly ? 'type' : 'value';
435
- break;
436
- case 'BlockStatement':
437
- babelNode.body = convertSWCNode(node.body || node.stmts || []);
438
- break;
439
-
440
- case 'ReturnStatement':
441
- babelNode.argument = convertSWCNode(node.argument ?? node.value ?? node.expr ?? null);
442
- break;
443
-
444
- case 'ExpressionStatement':
445
- babelNode.expression = convertSWCNode(node.expression ?? node.expr);
446
- break;
447
-
448
- case 'ImportSpecifier':
449
- babelNode.imported = convertSWCNode(node.imported || node.local);
450
- babelNode.local = convertSWCNode(node.local);
451
- break;
452
-
453
- case 'ImportDefaultSpecifier':
454
- babelNode.local = convertSWCNode(node.local);
455
- break;
456
-
457
- case 'ImportNamespaceSpecifier':
458
- babelNode.local = convertSWCNode(node.local);
459
- break;
460
-
461
- case 'ExportNamedDeclaration':
462
- babelNode.declaration = convertSWCNode(node.declaration);
463
- babelNode.specifiers = convertSWCNode(node.specifiers || []);
464
- babelNode.source = convertSWCNode(node.source);
465
- break;
466
-
467
- case 'ExportDefaultDeclaration':
468
- babelNode.declaration = convertSWCNode(node.decl || node.declaration);
469
- break;
470
-
471
- case 'VariableDeclaration':
472
- babelNode.kind = node.kind;
473
- babelNode.declarations = convertSWCNode(node.declarations);
474
- break;
475
-
476
- case 'VariableDeclarator':
477
- babelNode.id = convertSWCNode(node.id);
478
- babelNode.init = convertSWCNode(node.init);
479
- break;
480
-
481
- case 'FunctionDeclaration':
482
- case 'FunctionExpression':
483
- babelNode.id = convertSWCNode(node.identifier);
484
- babelNode.params = convertSWCNode(normalizeParams(node.params));
485
- babelNode.body = convertSWCNode(node.body);
486
- babelNode.generator = node.generator || false;
487
- babelNode.async = node.async || false;
488
- break;
489
-
490
- case 'ArrowFunctionExpression':
491
- babelNode.params = convertSWCNode(normalizeParams(node.params));
492
- babelNode.body = convertSWCNode(node.body);
493
- babelNode.async = node.async || false;
494
- babelNode.expression = node.body?.type !== 'BlockStatement';
495
- break;
496
-
497
- case 'ClassDeclaration':
498
- case 'ClassExpression':
499
- babelNode.id = convertSWCNode(node.identifier || node.id);
500
- babelNode.superClass = convertSWCNode(node.superClass);
501
- babelNode.decorators = convertSWCNode(node.decorators || []);
502
- babelNode.body = {
503
- type: 'ClassBody',
504
- body: convertSWCNode(node.body?.body || node.body || []),
505
- };
506
- break;
507
-
508
- case 'ClassMethod':
509
- case 'ClassPrivateMethod':
510
- case 'Constructor':
511
- const classMethodKey = node.key;
512
- const classMethodComputed = classMethodKey?.type === 'Computed';
513
- const normalizedClassMethodKey = normalizeMemberProperty(classMethodComputed ? classMethodKey.expression : classMethodKey, node.computed);
514
- babelNode.key = normalizedClassMethodKey.property;
515
- babelNode.kind = swcType === 'Constructor' ? 'constructor' : (node.kind || 'method');
516
- babelNode.params = convertSWCNode(normalizeParams(node.function?.params || node.params));
517
- babelNode.body = convertSWCNode(node.function?.body || node.body);
518
- babelNode.computed = normalizedClassMethodKey.computed || classMethodComputed || node.computed || false;
519
- babelNode.static = node.isStatic || node.static || false;
520
- babelNode.async = node.function?.isAsync || node.async || false;
521
- babelNode.generator = node.function?.isGenerator || node.generator || false;
522
- break;
523
-
524
- case 'ClassProperty':
525
- case 'ClassPrivateProperty':
526
- const classPropKey = node.key;
527
- const classPropComputed = classPropKey?.type === 'Computed';
528
- const normalizedClassPropKey = normalizeMemberProperty(classPropComputed ? classPropKey.expression : classPropKey, node.computed);
529
- babelNode.key = normalizedClassPropKey.property;
530
- babelNode.value = convertSWCNode(node.value);
531
- babelNode.computed = normalizedClassPropKey.computed || classPropComputed || node.computed || false;
532
- babelNode.static = node.isStatic || node.static || false;
533
- break;
534
-
535
- case 'CallExpression':
536
- babelNode.callee = convertSWCNode(node.callee);
537
- babelNode.arguments = convertSWCNode(node.arguments || []);
538
- break;
539
-
540
- case 'OptionalChainingExpression': {
541
- const base = node.base || node.expression || node.expr || node.argument;
542
- const converted = convertSWCNode(base);
543
-
544
- if (converted && (converted.type === 'MemberExpression' || converted.type === 'OptionalMemberExpression')) {
545
- converted.type = 'OptionalMemberExpression';
546
- converted.optional = true;
547
- }
548
-
549
- if (converted && (converted.type === 'CallExpression' || converted.type === 'OptionalCallExpression')) {
550
- converted.type = 'OptionalCallExpression';
551
- converted.optional = true;
552
- }
553
-
554
- return converted;
555
- }
556
-
557
- case 'MemberExpression':
558
- babelNode.object = convertSWCNode(node.object);
559
- const memberProp = normalizeMemberProperty(node.property, node.computed);
560
- babelNode.property = memberProp.property;
561
- babelNode.computed = memberProp.computed;
562
- babelNode.optional = node.optional || false;
563
- break;
564
- case 'NewExpression':
565
- babelNode.callee = convertSWCNode(node.callee);
566
- babelNode.arguments = convertSWCNode(node.arguments || []);
567
- break;
568
- case 'OptionalCallExpression':
569
- babelNode.callee = convertSWCNode(node.callee);
570
- babelNode.arguments = convertSWCNode(node.arguments || []);
571
- babelNode.optional = true;
572
- break;
573
-
574
- case 'JSXElement':
575
- babelNode.openingElement = convertSWCNode(node.opening);
576
- babelNode.closingElement = convertSWCNode(node.closing);
577
- babelNode.children = convertSWCNode(node.children || []);
578
- babelNode.selfClosing = !node.closing;
579
- break;
580
-
581
- case 'JSXOpeningElement':
582
- babelNode.name = convertSWCNode(node.name);
583
- babelNode.attributes = convertSWCNode(node.attributes || []);
584
- babelNode.selfClosing = node.selfClosing || false;
585
- break;
586
-
587
- case 'JSXClosingElement':
588
- babelNode.name = convertSWCNode(node.name);
589
- break;
590
-
591
- case 'JSXAttribute':
592
- babelNode.name = convertSWCNode(node.name);
593
- babelNode.value = convertSWCNode(node.value);
594
- break;
595
-
596
- case 'JSXIdentifier':
597
- babelNode.name = node.value;
598
- break;
599
-
600
- case 'JSXText':
601
- babelNode.value = node.value;
602
- babelNode.raw = node.raw || node.value;
603
- break;
604
-
605
- case 'TemplateElement':
606
- return {
607
- type: 'TemplateElement',
608
- value: {
609
- raw: node.raw ?? node.value?.raw ?? node.cooked ?? '',
610
- cooked: node.cooked ?? node.value?.cooked ?? node.raw ?? '',
611
- },
612
- tail: node.tail ?? false,
613
- };
614
-
615
- case 'JSXExpressionContainer':
616
- babelNode.expression = convertSWCNode(node.expression);
617
- break;
618
-
619
- case 'JSXFragment':
620
- babelNode.openingFragment = { type: 'JSXOpeningFragment' };
621
- babelNode.closingFragment = { type: 'JSXClosingFragment' };
622
- babelNode.children = convertSWCNode(node.children || []);
623
- break;
624
-
625
- default:
626
- // ͨ�ô������ݹ�ת����������
627
- for (const key of Object.keys(node)) {
628
- if (key === 'type' || key === 'span' || key === 'ctxt') continue;
629
- babelNode[key] = convertSWCNode(node[key]);
630
- }
631
- }
632
-
633
- return babelNode;
634
- }
635
-
636
- /**
637
- * �� SWC AST ת��Ϊ Babel ���ݸ�ʽ
638
- */
639
- export function convertSWCToBabel(swcAst: any): t.File {
640
- const startTime = performance.now();
641
- const result = convertSWCNode(swcAst) as t.File;
642
- const duration = performance.now() - startTime;
643
-
644
- swcStats.conversionCount++;
645
- swcStats.conversionTotalTime += duration;
646
-
647
- return result;
648
- }
649
-
650
- /**
651
- * ʹ�� SWC ��������
652
- * ��� SWC �����ã����˵� Babel
653
- */
654
- export function parseWithSWC(code: string): t.File {
655
- const safeCode = sanitizePermissionCommentsForJSX(code);
656
- if (!swcAvailable || !swcModule) {
657
- // ���˵� Babel
658
- const startTime = performance.now();
659
- const ast = babelParse(safeCode, babelParserConfig);
660
- swcStats.babelFallbackCount++;
661
- swcStats.babelTotalTime += performance.now() - startTime;
662
- return ast;
663
- }
664
-
665
- try {
666
- // ʹ�� SWC ����
667
- const startTime = performance.now();
668
- const swcAst = swcModule.parseSync(safeCode, swcParserConfig);
669
- const parseTime = performance.now() - startTime;
670
-
671
- swcStats.swcParseCount++;
672
- swcStats.swcTotalTime += parseTime;
673
-
674
- // ת��Ϊ Babel ��ʽ
675
- return convertSWCToBabel(swcAst);
676
- } catch (error) {
677
- // ����ʧ�ܣ����˵� Babel
678
- console.warn('[SWC] ����ʧ�ܣ����˵� Babel:', error);
679
- const startTime = performance.now();
680
- const ast = babelParse(safeCode, babelParserConfig);
681
- swcStats.babelFallbackCount++;
682
- swcStats.babelTotalTime += performance.now() - startTime;
683
- return ast;
684
- }
685
- }
686
-
687
- /**
688
- * �첽ʹ�� SWC ��������
689
- */
690
- export async function parseWithSWCAsync(code: string): Promise<t.File> {
691
- // ȷ�� SWC �ѳ�ʼ��
692
- await initSWC();
693
- return parseWithSWC(code);
694
- }
695
-
696
- /**
697
- * ��ȡ SWC ����ͳ��
698
- */
699
- export function getSWCStats() {
700
- return {
701
- ...swcStats,
702
- swcAvailable,
703
- swcAverageParseTime: swcStats.swcParseCount > 0
704
- ? swcStats.swcTotalTime / swcStats.swcParseCount
705
- : 0,
706
- babelAverageTime: swcStats.babelFallbackCount > 0
707
- ? swcStats.babelTotalTime / swcStats.babelFallbackCount
708
- : 0,
709
- conversionAverageTime: swcStats.conversionCount > 0
710
- ? swcStats.conversionTotalTime / swcStats.conversionCount
711
- : 0,
712
- speedup: swcStats.babelFallbackCount > 0 && swcStats.swcParseCount > 0
713
- ? (swcStats.babelTotalTime / swcStats.babelFallbackCount) /
714
- ((swcStats.swcTotalTime + swcStats.conversionTotalTime) / swcStats.swcParseCount)
715
- : 0,
716
- };
717
- }
718
-
719
- /**
720
- * ��ӡ SWC ���ܱ���
721
- */
722
- export function printSWCReport(): void {
723
- const stats = getSWCStats();
724
-
725
- console.log('%c=== SWC Parser Report ===', 'color: #FF5722; font-weight: bold;');
726
- console.log(`SWC ����: ${stats.swcAvailable ? '?' : '?'}`);
727
- console.log(`%cSWC ��������: ${stats.swcParseCount}`, 'color: #4CAF50;');
728
- console.log(`%cSWC �ܺ�ʱ: ${stats.swcTotalTime.toFixed(2)}ms`, 'color: #4CAF50;');
729
- console.log(`%cSWC ƽ����ʱ: ${stats.swcAverageParseTime.toFixed(2)}ms`, 'color: #4CAF50;');
730
- console.log(`%cBabel ���˴���: ${stats.babelFallbackCount}`, 'color: #FF9800;');
731
- console.log(`%cBabel �ܺ�ʱ: ${stats.babelTotalTime.toFixed(2)}ms`, 'color: #FF9800;');
732
- console.log(`%cBabel ƽ����ʱ: ${stats.babelAverageTime.toFixed(2)}ms`, 'color: #FF9800;');
733
- console.log(`AST ת������: ${stats.conversionCount}`);
734
- console.log(`AST ת��ƽ����ʱ: ${stats.conversionAverageTime.toFixed(2)}ms`);
735
- if (stats.speedup > 0) {
736
- console.log(`%c���ٱ�: ${stats.speedup.toFixed(1)}x`, 'color: #E91E63; font-weight: bold;');
737
- }
738
- console.log('%c=========================', 'color: #FF5722; font-weight: bold;');
739
- }
740
-
741
- // ��¶��ȫ�֣��������
742
- if (typeof window !== 'undefined') {
743
- (window as any).__SWC_PARSER__ = {
744
- initSWC,
745
- isSWCAvailable,
746
- parseWithSWC,
747
- parseWithSWCAsync,
748
- getSWCStats,
749
- printSWCReport,
750
- };
751
- }
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}