plusui-native-bindgen 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -0
- package/src/advanced-bindgen.js +550 -0
- package/src/index.js +153 -0
- package/src/test-interface-regex.js +44 -0
- package/src/test-regex.js +35 -0
- package/src/typescript-first-bindgen.js +743 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Test interface regex
|
|
2
|
+
|
|
3
|
+
console.log('Testing interface regex...\n');
|
|
4
|
+
|
|
5
|
+
const interfaceRegex = /export\s+interface\s+(\w+)\s*\{([^}]+(?:\{[^}]*\}[^}]*)*)\}/g;
|
|
6
|
+
|
|
7
|
+
const testContent = `
|
|
8
|
+
/**
|
|
9
|
+
* Application management API
|
|
10
|
+
*/
|
|
11
|
+
export interface AppAPI {
|
|
12
|
+
/**
|
|
13
|
+
* Get application information
|
|
14
|
+
*/
|
|
15
|
+
getInfo(): Promise<{ name: string; version: string }>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Quit the application
|
|
19
|
+
*/
|
|
20
|
+
quit(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
console.log('Test content:');
|
|
25
|
+
console.log(testContent);
|
|
26
|
+
|
|
27
|
+
let match;
|
|
28
|
+
while ((match = interfaceRegex.exec(testContent)) !== null) {
|
|
29
|
+
const name = match[1];
|
|
30
|
+
const body = match[2];
|
|
31
|
+
|
|
32
|
+
console.log('\n=== Interface Found ===');
|
|
33
|
+
console.log('Name:', name);
|
|
34
|
+
console.log('\nBody captured:');
|
|
35
|
+
console.log('---START---');
|
|
36
|
+
console.log(body);
|
|
37
|
+
console.log('---END---');
|
|
38
|
+
console.log('\nBody length:', body.length);
|
|
39
|
+
|
|
40
|
+
// Now test if both methods are in the body
|
|
41
|
+
console.log('\nSearching for methods in body...');
|
|
42
|
+
console.log('Contains "getInfo":', body.includes('getInfo'));
|
|
43
|
+
console.log('Contains "quit":', body.includes('quit'));
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Test to demonstrate parser bugs
|
|
2
|
+
|
|
3
|
+
console.log('Testing method regex...\n');
|
|
4
|
+
|
|
5
|
+
const methodRegex = /(\w+)\s*\(([^)]*)\)\s*:\s*Promise<([^>]+)>|(\w+)\s*\(([^)]*)\)\s*:\s*([^;]+)/g;
|
|
6
|
+
|
|
7
|
+
const testBody = `
|
|
8
|
+
/**
|
|
9
|
+
* Get application information
|
|
10
|
+
*/
|
|
11
|
+
getInfo(): Promise<{ name: string; version: string }>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Quit the application
|
|
15
|
+
*/
|
|
16
|
+
quit(): Promise<void>;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
console.log('Test body:');
|
|
20
|
+
console.log(testBody);
|
|
21
|
+
console.log('\nMatches found:');
|
|
22
|
+
|
|
23
|
+
let match;
|
|
24
|
+
let count = 0;
|
|
25
|
+
while ((match = methodRegex.exec(testBody)) !== null) {
|
|
26
|
+
count++;
|
|
27
|
+
console.log(`\nMatch ${count}:`);
|
|
28
|
+
console.log(' Full match:', match[0]);
|
|
29
|
+
console.log(' Method name:', match[1] || match[4]);
|
|
30
|
+
console.log(' Return type:', match[3] || match[6]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log(`\nTotal matches: ${count}`);
|
|
34
|
+
console.log('Expected: 2 (getInfo and quit)');
|
|
35
|
+
console.log('Actual:', count);
|