From f578b085fb3416029a273e4bc0fa4e87d5f56bc7 Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Sat, 9 Mar 2024 04:29:02 -0500 Subject: [PATCH] feat(content): `Content` Signed-off-by: Lexus Drumgold --- .eslintrc.base.cjs | 2 +- src/content/__tests__/content.spec-d.ts | 60 +++++++++++++++++++++++++ src/content/content.ts | 13 ++++++ src/content/index.ts | 1 + tsconfig.json | 7 ++- tsconfig.typecheck.json | 3 +- 6 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 src/content/__tests__/content.spec-d.ts create mode 100644 src/content/content.ts diff --git a/.eslintrc.base.cjs b/.eslintrc.base.cjs index 05125aa..4cfe0c0 100644 --- a/.eslintrc.base.cjs +++ b/.eslintrc.base.cjs @@ -34,7 +34,7 @@ const config = { parser: '@typescript-eslint/parser', parserOptions: { extraFileExtensions: [], - project: ['**/tsconfig.json'], + project: ['**/tsconfig.json', '**/tsconfig.*.json'], tsconfigRootDir: process.cwd(), warnOnUnsupportedTypeScriptVersion: true }, diff --git a/src/content/__tests__/content.spec-d.ts b/src/content/__tests__/content.spec-d.ts new file mode 100644 index 0000000..f9f7e42 --- /dev/null +++ b/src/content/__tests__/content.spec-d.ts @@ -0,0 +1,60 @@ +/** + * @file Type Tests - Content + * @module esast/content/tests/unit-d/Content + */ + +import type { + Declaration, + ExportDeclaration, + Expression, + Heritage, + LiteralValue, + ModuleDeclaration, + Pattern, + Primitive, + RootChild, + Statement +} from '@flex-development/esast' +import type TestSubject from '../content' + +describe('unit-d:content/Content', () => { + it('should extract Declaration', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract ExportDeclaration', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract Expression', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract Heritage', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract LiteralValue', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract ModuleDeclaration', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract Pattern', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract Primitive', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract RootChild', () => { + expectTypeOf().extract().not.toBeNever() + }) + + it('should extract Statement', () => { + expectTypeOf().extract().not.toBeNever() + }) +}) diff --git a/src/content/content.ts b/src/content/content.ts new file mode 100644 index 0000000..38e4098 --- /dev/null +++ b/src/content/content.ts @@ -0,0 +1,13 @@ +/** + * @file Content - Content + * @module esast/content/Content + */ + +import type { Heritage, Pattern, RootChild } from '@flex-development/esast' + +/** + * Union of registered content model nodes. + */ +type Content = Heritage | Pattern | RootChild + +export type { Content as default } diff --git a/src/content/index.ts b/src/content/index.ts index 7e07bde..0838938 100644 --- a/src/content/index.ts +++ b/src/content/index.ts @@ -3,6 +3,7 @@ * @module esast/content */ +export type { default as Content } from './content' export type * from './declaration' export type * from './declaration-export' export type * from './declaration-module' diff --git a/tsconfig.json b/tsconfig.json index 118baf8..fb9197c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -51,7 +51,12 @@ "useUnknownInCatchVariables": true, "verbatimModuleSyntax": true }, - "exclude": ["**/coverage", "**/dist", "**/node_modules"], + "exclude": [ + "**/coverage", + "**/dist", + "**/node_modules", + "__tests__/setup/index.d.mts" + ], "include": [ "**/**/*.json", "**/**/*.mjs", diff --git a/tsconfig.typecheck.json b/tsconfig.typecheck.json index aeee7e6..4ce88cb 100644 --- a/tsconfig.typecheck.json +++ b/tsconfig.typecheck.json @@ -1,5 +1,6 @@ { "exclude": ["**/coverage", "**/dist", "**/node_modules"], "extends": "./tsconfig.json", - "include": ["**/**.ts", "**/.*.ts"] + "files": ["__tests__/setup/index.d.mts", "vitest-env.d.ts"], + "include": ["__tests__/**/**.ts", "src/**/**.ts", "src/**/.*.ts"] }