@shapeshift-labs/frontier-lang-compiler 0.2.28 → 0.2.30

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/README.md CHANGED
@@ -333,6 +333,8 @@ Use injected parser adapters when a real language parser is available but should
333
333
  import {
334
334
  createBabelNativeImporterAdapter,
335
335
  createClangAstNativeImporterAdapter,
336
+ createGoAstNativeImporterAdapter,
337
+ createJavaAstNativeImporterAdapter,
336
338
  createPythonAstNativeImporterAdapter,
337
339
  createRustSynNativeImporterAdapter,
338
340
  importNativeProject,
@@ -354,6 +356,15 @@ const clangAstAdapter = createClangAstNativeImporterAdapter({
354
356
  cStandard: 'c11',
355
357
  compileFlags: ['-std=c11']
356
358
  });
359
+ const goAstAdapter = createGoAstNativeImporterAdapter({
360
+ parserModule: hostGoAstParser,
361
+ goVersion: '1.22'
362
+ });
363
+ const javaAstAdapter = createJavaAstNativeImporterAdapter({
364
+ parserModule: hostJavaAstParser,
365
+ javaVersion: '21',
366
+ sourceLevel: '21'
367
+ });
357
368
 
358
369
  const imported = await runNativeImporterAdapter(babelAdapter, {
359
370
  sourcePath: 'src/todo.ts',
@@ -362,12 +373,14 @@ const imported = await runNativeImporterAdapter(babelAdapter, {
362
373
 
363
374
  const project = await importNativeProject({
364
375
  projectRoot: 'src',
365
- adapters: [babelAdapter, pythonAstAdapter, rustSynAdapter, clangAstAdapter],
376
+ adapters: [babelAdapter, pythonAstAdapter, rustSynAdapter, clangAstAdapter, goAstAdapter, javaAstAdapter],
366
377
  sources: [
367
378
  { language: 'typescript', adapter: babelAdapter.id, sourcePath: 'src/todo.ts', sourceText },
368
379
  { language: 'python', adapter: pythonAstAdapter.id, sourcePath: 'tools/todo.py', sourceText: pythonSource },
369
380
  { language: 'rust', adapter: rustSynAdapter.id, sourcePath: 'src/todo.rs', sourceText: rustSource },
370
- { language: 'c', adapter: clangAstAdapter.id, sourcePath: 'native/todo.c', sourceText: cSource }
381
+ { language: 'c', adapter: clangAstAdapter.id, sourcePath: 'native/todo.c', sourceText: cSource },
382
+ { language: 'go', adapter: goAstAdapter.id, sourcePath: 'cmd/todo/main.go', sourceText: goSource },
383
+ { language: 'java', adapter: javaAstAdapter.id, sourcePath: 'src/main/java/Todo.java', sourceText: javaSource }
371
384
  ]
372
385
  });
373
386
 
@@ -389,6 +402,8 @@ The built-in adapter factories are dependency-light wrappers for caller-owned pa
389
402
  - `createPythonAstNativeImporterAdapter`
390
403
  - `createRustSynNativeImporterAdapter`
391
404
  - `createClangAstNativeImporterAdapter`
405
+ - `createGoAstNativeImporterAdapter`
406
+ - `createJavaAstNativeImporterAdapter`
392
407
  - `createTreeSitterNativeImporterAdapter`
393
408
 
394
409
  Adapter summaries include a structured `coverage` record so merge queues can distinguish exact parser AST imports from declaration scans. The record declares exactness, parser token/trivia support, diagnostics support, source-range and generated-range support, and semantic coverage. Built-in wrappers normalize native AST/CST nodes and declaration-level semantic indexes; they do not claim resolved references, types, control flow, generated ranges, or token/trivia fidelity unless the host adapter supplies that evidence.
package/bench/smoke.mjs CHANGED
@@ -4,6 +4,8 @@ import {
4
4
  compileFrontierSource,
5
5
  createClangAstNativeImporterAdapter,
6
6
  createEstreeNativeImporterAdapter,
7
+ createGoAstNativeImporterAdapter,
8
+ createJavaAstNativeImporterAdapter,
7
9
  createNativeImportCoverageMatrix,
8
10
  createNativeParserAstFormatMatrix,
9
11
  createProjectionTargetLossMatrix,
@@ -80,7 +82,7 @@ const matrixDurationMs = performance.now() - matrixStart;
80
82
  const parserFormatMatrixStart = performance.now();
81
83
  const parserFormatMatrix = createNativeParserAstFormatMatrix({
82
84
  imports: nativeImportResults,
83
- adapters: [estreeAdapter, createPythonAstNativeImporterAdapter(), createRustSynNativeImporterAdapter(), createClangAstNativeImporterAdapter()]
85
+ adapters: [estreeAdapter, createPythonAstNativeImporterAdapter(), createRustSynNativeImporterAdapter(), createClangAstNativeImporterAdapter(), createGoAstNativeImporterAdapter(), createJavaAstNativeImporterAdapter()]
84
86
  });
85
87
  const parserFormatMatrixDurationMs = performance.now() - parserFormatMatrixStart;
86
88
 
package/dist/index.d.ts CHANGED
@@ -1435,6 +1435,68 @@ export interface ClangAstNativeImporterAdapterOptions {
1435
1435
  readonly maxNodes?: number;
1436
1436
  }
1437
1437
 
1438
+ export interface GoAstNativeImporterAdapterOptions {
1439
+ readonly id?: string;
1440
+ readonly language?: FrontierSourceLanguage;
1441
+ readonly parser?: string;
1442
+ readonly version?: string;
1443
+ readonly capabilities?: readonly string[];
1444
+ readonly coverage?: NativeImporterAdapterCoverageInput;
1445
+ readonly supportedExtensions?: readonly string[];
1446
+ readonly diagnostics?: readonly NativeImporterAdapterDiagnostic[];
1447
+ readonly ast?: unknown;
1448
+ readonly file?: unknown;
1449
+ readonly sourceFile?: unknown;
1450
+ readonly package?: unknown;
1451
+ readonly parse?: (sourceText: string, options: Record<string, unknown>) => unknown;
1452
+ readonly parserModule?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1453
+ readonly goAst?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1454
+ readonly goParser?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1455
+ readonly parserOptions?: Record<string, unknown>;
1456
+ readonly mode?: string | number;
1457
+ readonly goVersion?: string;
1458
+ readonly packageName?: string;
1459
+ readonly fileSet?: unknown;
1460
+ readonly fset?: unknown;
1461
+ readonly includeComments?: boolean;
1462
+ readonly buildTags?: readonly string[];
1463
+ readonly generated?: boolean;
1464
+ readonly typeEvidence?: unknown;
1465
+ readonly maxNodes?: number;
1466
+ }
1467
+
1468
+ export interface JavaAstNativeImporterAdapterOptions {
1469
+ readonly id?: string;
1470
+ readonly language?: FrontierSourceLanguage;
1471
+ readonly parser?: string;
1472
+ readonly version?: string;
1473
+ readonly capabilities?: readonly string[];
1474
+ readonly coverage?: NativeImporterAdapterCoverageInput;
1475
+ readonly supportedExtensions?: readonly string[];
1476
+ readonly diagnostics?: readonly NativeImporterAdapterDiagnostic[];
1477
+ readonly ast?: unknown;
1478
+ readonly compilationUnit?: unknown;
1479
+ readonly unit?: unknown;
1480
+ readonly sourceFile?: unknown;
1481
+ readonly parse?: (sourceText: string, options: Record<string, unknown>) => unknown;
1482
+ readonly parserModule?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1483
+ readonly javac?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1484
+ readonly jdt?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1485
+ readonly javaParser?: { readonly parse: (sourceText: string, options: Record<string, unknown>) => unknown };
1486
+ readonly parserOptions?: Record<string, unknown>;
1487
+ readonly javaVersion?: string;
1488
+ readonly sourceLevel?: string;
1489
+ readonly classPath?: readonly string[] | string | unknown;
1490
+ readonly modulePath?: readonly string[] | string | unknown;
1491
+ readonly generated?: boolean;
1492
+ readonly annotationProcessing?: unknown;
1493
+ readonly bindingEvidence?: unknown;
1494
+ readonly positionResolver?: (position: unknown) => unknown;
1495
+ readonly lineMap?: unknown;
1496
+ readonly includeAnnotations?: boolean;
1497
+ readonly maxNodes?: number;
1498
+ }
1499
+
1438
1500
  export interface TreeSitterNativeImporterAdapterOptions {
1439
1501
  readonly id?: string;
1440
1502
  readonly language?: FrontierSourceLanguage;
@@ -1807,6 +1869,8 @@ export declare function createTypeScriptCompilerNativeImporterAdapter(options?:
1807
1869
  export declare function createPythonAstNativeImporterAdapter(options?: PythonAstNativeImporterAdapterOptions): NativeImporterAdapter;
1808
1870
  export declare function createRustSynNativeImporterAdapter(options?: RustSynNativeImporterAdapterOptions): NativeImporterAdapter;
1809
1871
  export declare function createClangAstNativeImporterAdapter(options?: ClangAstNativeImporterAdapterOptions): NativeImporterAdapter;
1872
+ export declare function createGoAstNativeImporterAdapter(options?: GoAstNativeImporterAdapterOptions): NativeImporterAdapter;
1873
+ export declare function createJavaAstNativeImporterAdapter(options?: JavaAstNativeImporterAdapterOptions): NativeImporterAdapter;
1810
1874
  export declare function createTreeSitterNativeImporterAdapter(options?: TreeSitterNativeImporterAdapterOptions): NativeImporterAdapter;
1811
1875
  export declare function runNativeImporterAdapter(adapter: NativeImporterAdapter, input: RunNativeImporterAdapterOptions): Promise<NativeImporterAdapterImportResult>;
1812
1876
  export declare function runNativeTargetProjectionAdapter(adapter: NativeTargetProjectionAdapter, input: NativeTargetProjectionAdapterInput): NativeTargetProjectionResult;