Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Implement new experimental JSON schema #157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Main Workflow

on: [push, pull_request]
on:
pull_request:
push:
branches:
- master

jobs:
run:
Expand Down
23 changes: 5 additions & 18 deletions src/analyze/stages/discover-declarations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SourceFile } from "typescript";
import { AnalyzerVisitContext } from "../analyzer-visit-context";
import { ComponentDeclaration } from "../types/component-declaration";
import { resolveSymbolDeclarations } from "../util/ast-util";
import { analyzeComponentDeclaration } from "./analyze-declaration";

/**
Expand All @@ -12,23 +11,11 @@ import { analyzeComponentDeclaration } from "./analyze-declaration";
export function discoverDeclarations(sourceFile: SourceFile, context: AnalyzerVisitContext): ComponentDeclaration[] {
const declarations: ComponentDeclaration[] = [];

const symbol = context.checker.getSymbolAtLocation(sourceFile);
if (symbol != null) {
// Get all exports in the source file
const exports = context.checker.getExportsOfModule(symbol);

// Find all class declarations in the source file
for (const symbol of exports) {
const node = symbol.valueDeclaration;

if (node != null) {
if (context.ts.isClassDeclaration(node) /* || context.ts.isInterfaceDeclaration(node)*/) {
const nodes = resolveSymbolDeclarations(symbol);
const decl = analyzeComponentDeclaration(nodes, context);
if (decl != null) {
declarations.push(decl);
}
}
for (const statement of sourceFile.statements) {
if (context.ts.isClassDeclaration(statement) /* || context.ts.isInterfaceDeclaration(node)*/) {
const decl = analyzeComponentDeclaration([statement], context);
if (decl != null) {
declarations.push(decl);
}
}
}
Expand Down