From 6e59b4fe68f1152ff0522a1a3718cf07dba1cb22 Mon Sep 17 00:00:00 2001 From: Cosmin Popovici Date: Thu, 25 Jul 2024 19:27:30 +0300 Subject: [PATCH] refactor: types --- package-lock.json | 2 + package.json | 1 + types/build.d.ts | 6 +- types/components.d.ts | 195 ----------------------------------------- types/config.d.ts | 4 +- types/expressions.d.ts | 100 --------------------- types/posthtml.d.ts | 6 +- 7 files changed, 11 insertions(+), 303 deletions(-) delete mode 100644 types/components.d.ts delete mode 100644 types/expressions.d.ts diff --git a/package-lock.json b/package-lock.json index 9c3e9149..878df78c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "posthtml-base-url": "^3.1.4", "posthtml-component": "^2.0.0", "posthtml-content": "^2.1.0", + "posthtml-expressions": "^1.11.4", "posthtml-extra-attributes": "^3.1.0", "posthtml-fetch": "^4.0.0", "posthtml-markdownit": "^3.1.0", @@ -322,6 +323,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 8fe6444b..07a0b28c 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "posthtml-base-url": "^3.1.4", "posthtml-component": "^2.0.0", "posthtml-content": "^2.1.0", + "posthtml-expressions": "^1.11.4", "posthtml-extra-attributes": "^3.1.0", "posthtml-fetch": "^4.0.0", "posthtml-markdownit": "^3.1.0", diff --git a/types/build.d.ts b/types/build.d.ts index ecce3dbc..12f4f6a5 100644 --- a/types/build.d.ts +++ b/types/build.d.ts @@ -1,5 +1,5 @@ import type { SpinnerName } from 'cli-spinners'; -import type ExpressionsConfig from './expressions'; +import type { PostHTMLExpressions } from 'posthtml-expressions'; export default interface BuildConfig { /** @@ -19,9 +19,9 @@ export default interface BuildConfig { content?: string[]; /** - Configure expressions. + Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options. */ - expressions?: ExpressionsConfig; + expressions?: PostHTMLExpressions; /** * Define the output path for compiled Templates, and what file extension they should use. diff --git a/types/components.d.ts b/types/components.d.ts deleted file mode 100644 index 9dbb5994..00000000 --- a/types/components.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -import type ExpressionsConfig from './expressions'; -import type { Options as PostHTMLParserOptions } from 'posthtml-parser'; - -interface AnyObject { - [key: string]: string | AnyObject; -} - -export default interface ComponentsConfig { - /** - * Root path where to look for folders containing component files. - * - * @default './' - */ - root?: string; - - /** - * Paths where to look for component files. Must be relative to `root`. - * - * @default ['src/components', 'src/layouts', 'src/templates'] - */ - folders?: string[]; - - /** - * Prefix to use for component tags. - * - * @default 'x-' - */ - tagPrefix?: string; - - /** - * Tag name to be used in HTML when using a component. - * - * @default 'component' - */ - tag?: string; - - /** - * Attribute name to be used when referencing a component via its path. - * - * @default 'src' - */ - attribute?: string; - - /** - * File extension that component files must use. - * Any other files will be ignored and not be made available as components. - * - * @default 'html' - */ - fileExtension?: string; - - /** - * Name of the tag that will be replaced with the content that is passed to the component. - * - * @default 'yield' - */ - yield?: string; - - /** - * Name of the slot tag, where the content will be injected. - * - * @default 'slot' - */ - slot?: string; - - /** - * Name of the fill tag, where the content to be injected is defined. - * - * @default 'fill' - */ - fill?: string; - - /** - * String to use as a separator between the slot tag and its name. - * - * @default ':' - */ - slotSeparator?: string; - - /** - * Tag name for pushing content to a stack. - * - * @default 'push' - */ - push?: string; - - /** - * Tag name for popping (rendering) content from a stack. - * - * @default 'stack' - */ - stack?: string; - - /** - * Name of the props attribute to use in the `