Skip to content

Commit

Permalink
feat: add type field
Browse files Browse the repository at this point in the history
  • Loading branch information
braebo committed Dec 26, 2023
1 parent 77cc35a commit 3149539
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-cycles-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'extractinator': minor
---

feat: add `type` field to output
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Output:

````json
{
"type": "svelte",
"fileName": "Example.svelte",
"filePath": "playground/Example.svelte",
"comment": {
Expand Down
1 change: 1 addition & 0 deletions src/files/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function parseSvelteFile({
const component_class_node = file.getDefaultExportSymbol()?.getValueDeclaration()

return {
type: 'svelte',
fileName: file_name,
filePath: input_file_path,
comment: component_class_node
Expand Down
1 change: 1 addition & 0 deletions src/files/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function parseTSFile({
}

return {
type: 'ts',
fileName: file_name,
filePath: input_file_path,
exports: export_bits,
Expand Down
4 changes: 4 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ export interface BaseParsedFile {
}

export interface ParsedTSFile extends BaseParsedFile {
type: 'ts'

/**
* The exports from the ts file
*/
exports: ExportBit[]
}

export interface ParsedSvelteFile extends BaseParsedFile {
type: 'svelte'

/**
* The name of the component
*
Expand Down

0 comments on commit 3149539

Please sign in to comment.