From ef5a76cf801df3b79ae154f0bfceb0a1370c9ba3 Mon Sep 17 00:00:00 2001 From: "N. V. Lang" Date: Sun, 30 Jun 2024 08:34:46 +0200 Subject: [PATCH] ci(publish): try to fix publish actions, attempt 4 --- .github/workflows/nodejs.yml | 2 +- deno.jsonc | 14 ++++++++++- package.json | 2 +- src/base/Sveltex.ts | 2 +- src/base/defaults.ts | 10 ++++---- src/handlers/CodeHandler.ts | 2 +- src/handlers/MarkdownHandler.ts | 9 +++++++- src/handlers/MathHandler.ts | 14 +++++++---- src/handlers/TexHandler.ts | 6 ++++- src/handlers/VerbatimHandler.ts | 4 ++-- src/typeGuards/code.ts | 8 +++---- src/typeGuards/frontmatter.ts | 2 +- src/typeGuards/verbatim.ts | 2 +- src/types/handlers/Handler.ts | 11 +++------ src/types/handlers/Tex.ts | 14 +++++------ src/types/handlers/Verbatim.ts | 12 +++++----- src/types/utils/Frontmatter.ts | 17 ++++++++------ src/types/utils/PopplerOptions.ts | 2 +- src/utils/TexComponent.ts | 23 +++++++++++-------- src/utils/cache.ts | 4 ++-- src/utils/cdn.ts | 2 +- .../verbatimEnvironmentConfiguration.ts | 2 +- src/utils/escape.ts | 22 +++++++++--------- src/utils/frontmatter.ts | 2 +- src/utils/parseComponent.ts | 2 +- .../base/Sveltex/sveltex.commonmark.test.ts | 2 +- tests/unit/base/Sveltex/sveltex.real.test.ts | 2 +- .../unit/base/Sveltex/sveltex.script.test.ts | 6 ++--- tests/unit/base/defaults.test.ts | 8 +++---- tests/unit/handlers/CodeHandler.test.ts | 2 +- .../MathHandler.katex.errors.test.ts | 2 +- .../MathHandler/MathHandler.katex.test.ts | 4 ++-- .../MathHandler/MathHandler.mathjax.test.ts | 6 ++--- tests/unit/handlers/TexHandler.test.ts | 2 +- tests/unit/utils/TexComponent.test.ts | 6 ++--- tests/unit/utils/ast.test.ts | 2 +- .../verbatimEnvironmentConfiguration.test.ts | 2 +- tests/unit/utils/env.test.ts | 2 +- tests/unit/utils/escape.test.ts | 2 +- tests/unit/utils/frontmatter.test.ts | 6 ++--- 40 files changed, 138 insertions(+), 106 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index b27f633..355b25d 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -42,6 +42,6 @@ jobs: run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV - - run: pnpm publish --provenance + - run: pnpm publish --provenance --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/deno.jsonc b/deno.jsonc index b991615..281cd42 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,11 +1,22 @@ { "$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json", "name": "@nvl/sveltex", - "version": "0.1.0-beta.4", + "version": "0.1.0-beta.5", "exports": { // Default entry point, which can be imported as `@nvl/sveltex` ".": "./src/mod.ts" }, + "lint": { + "include": ["src/**"], + "exclude": [ + "**/node_modules/**", + "**/dist/**", + "**/docs/**", + "**/.github/**", + "**/.vscode/**", + "**/.svelte-kit/**" + ] + }, "publish": { "include": [ // Source files @@ -19,6 +30,7 @@ "tsconfig.json", "jsr.jsonc" ], + "exclude": [ // Unit and E2E tests "**/tests/**", diff --git a/package.json b/package.json index d9baf08..cc8e2bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nvl/sveltex", - "version": "0.1.0-beta.4", + "version": "0.1.0-beta.5", "description": "Svelte + Markdown + LaTeX", "type": "module", "author": { diff --git a/src/base/Sveltex.ts b/src/base/Sveltex.ts index 556c29c..d20ad73 100644 --- a/src/base/Sveltex.ts +++ b/src/base/Sveltex.ts @@ -454,7 +454,7 @@ export class Sveltex< * ⚠ **Warning**: Mutating this object will have no effect on the Sveltex * instance. */ - get configuration() { + get configuration(): FullSveltexConfiguration { const clone = deepClone(this._configuration); const { markdown, code, math, verbatim } = this._configuration; diff --git a/src/base/defaults.ts b/src/base/defaults.ts index ca89f10..8bcdbf5 100644 --- a/src/base/defaults.ts +++ b/src/base/defaults.ts @@ -31,11 +31,11 @@ import { isPresentAndDefined, isString, } from '$typeGuards/utils.js'; -import { +import type { CleanPopplerSvgOptions, PopplerSvgOptions, } from '$types/utils/PopplerOptions.js'; -import { PropertiesDefined } from '$types/utils/utility-types.js'; +import type { PropertiesDefined } from '$types/utils/utility-types.js'; import { interpretAttributes } from '$utils/parseComponent.js'; // External dependencies @@ -159,7 +159,9 @@ export function getDefaultMathConfiguration< } } -const cacheDir = findCacheDirectory({ name: '@nvl/sveltex' }); +const cacheDir: string | undefined = findCacheDirectory({ + name: '@nvl/sveltex', +}); /** * The default cache directory for SvelTeX. @@ -169,7 +171,7 @@ const cacheDir = findCacheDirectory({ name: '@nvl/sveltex' }); * 'node_modules/.cache/@nvl/sveltex' * ``` */ -export const defaultCacheDirectory = cacheDir +export const defaultCacheDirectory: string = cacheDir ? relative(process.cwd(), cacheDir) : resolve( process.env['XDG_CACHE_HOME'] ?? join(homedir(), '.cache'), diff --git a/src/handlers/CodeHandler.ts b/src/handlers/CodeHandler.ts index 734b1cc..b1316e9 100644 --- a/src/handlers/CodeHandler.ts +++ b/src/handlers/CodeHandler.ts @@ -33,7 +33,7 @@ import { applyTransformations } from '$utils/transformers.js'; import { type StarryNightLanguage, starryNightLanguages, - StarryNightScope, + type StarryNightScope, } from '$data/code.js'; // External dependencies diff --git a/src/handlers/MarkdownHandler.ts b/src/handlers/MarkdownHandler.ts index b0a81bf..a2fa9e8 100644 --- a/src/handlers/MarkdownHandler.ts +++ b/src/handlers/MarkdownHandler.ts @@ -9,6 +9,7 @@ import type { MarkdownProcessOptions, MarkdownProcessor, } from '$types/handlers/Markdown.js'; +import type { UnescapeOptions } from '$types/utils/Escape.js'; // Internal dependencies import { missingDeps } from '$utils/env.js'; @@ -53,7 +54,13 @@ export class MarkdownHandler extends Handler< }; } - override get process() { + override get process(): ( + content: string, + options: MarkdownProcessOptions, + ) => Promise<{ + processed: string; + unescapeOptions: UnescapeOptions; + }> { return async (content: string, options: MarkdownProcessOptions) => { let unescapeTags: (str: string) => string = (str) => str; if (!this._configuration.strict) { diff --git a/src/handlers/MathHandler.ts b/src/handlers/MathHandler.ts index 41589b3..e14e37e 100644 --- a/src/handlers/MathHandler.ts +++ b/src/handlers/MathHandler.ts @@ -8,6 +8,7 @@ import type { MathProcessFn, MathProcessOptions, } from '$types/handlers/Math.js'; +import type { ProcessedSnippet } from '$types/utils/Escape.js'; // Internal dependencies import { getDefaultMathConfiguration } from '$base/defaults.js'; @@ -33,7 +34,10 @@ export class MathHandler extends Handler< FullMathConfiguration, MathHandler > { - override get process() { + override get process(): ( + tex: string, + options?: MathProcessOptions, + ) => Promise { return async (tex: string, options?: MathProcessOptions) => { await this.handleCss(); @@ -65,7 +69,7 @@ export class MathHandler extends Handler< private _handleCss: (mathHandler: this) => Promise = () => Promise.resolve(); - get handleCss() { + get handleCss(): () => Promise { return async () => { if (this._handledCss) { return; @@ -98,7 +102,7 @@ export class MathHandler extends Handler< /* v8 ignore next 2 (unreachable code) */ private _updateCss: (mathHandler: this) => void = () => undefined; - get updateCss() { + get updateCss(): () => void { return () => { if ( this.backend === 'mathjax' && @@ -119,7 +123,7 @@ export class MathHandler extends Handler< * handler is being used on. */ private _headLines: string[] = []; - get headLines() { + get headLines(): string[] { return this._headLines; } @@ -133,7 +137,7 @@ export class MathHandler extends Handler< * of the page. */ private _scriptLines: string[] = []; - get scriptLines() { + get scriptLines(): string[] { return this._scriptLines; } diff --git a/src/handlers/TexHandler.ts b/src/handlers/TexHandler.ts index 10d0645..b3c17b4 100644 --- a/src/handlers/TexHandler.ts +++ b/src/handlers/TexHandler.ts @@ -18,6 +18,7 @@ import { SveltexCache } from '$utils/cache.js'; import { Handler } from '$handlers/Handler.js'; import { pathExists } from '$utils/fs.js'; import { mergeConfigs } from '$utils/merge.js'; +import type { ProcessedSnippet } from '$types/utils/Escape.js'; export class TexHandler extends Handler< TexBackend, @@ -45,7 +46,10 @@ export class TexHandler extends Handler< * @param options - Options to pass to the processor. * @returns The processed content, or promise resolving to it. */ - override get process() { + override get process(): ( + content: string, + options: TexProcessOptions, + ) => ProcessedSnippet | Promise { return (content: string, options: TexProcessOptions) => { return super.process(content, options); }; diff --git a/src/handlers/VerbatimHandler.ts b/src/handlers/VerbatimHandler.ts index db8013f..d8dfebc 100644 --- a/src/handlers/VerbatimHandler.ts +++ b/src/handlers/VerbatimHandler.ts @@ -22,8 +22,8 @@ import type { ProcessedSnippet, UnescapeOptions } from '$types/utils/Escape.js'; // Internal dependencies import { getDefaultVerbEnvConfig } from '$base/defaults.js'; -import { TexHandler } from '$handlers/TexHandler.js'; -import { CodeHandler } from '$handlers/CodeHandler.js'; +import type { TexHandler } from '$handlers/TexHandler.js'; +import type { CodeHandler } from '$handlers/CodeHandler.js'; import { Handler } from '$handlers/Handler.js'; import { log } from '$utils/debug.js'; import { diagnoseVerbEnvConfig } from '$utils/diagnosers/verbatimEnvironmentConfiguration.js'; diff --git a/src/typeGuards/code.ts b/src/typeGuards/code.ts index 491979a..795f3a8 100644 --- a/src/typeGuards/code.ts +++ b/src/typeGuards/code.ts @@ -6,11 +6,11 @@ import type { Equals, Extends } from '$deps.js'; // Internal dependencies import { isOneOf, isString } from '$typeGuards/utils.js'; -import { CodeBackend, CodeBackendWithCss } from '$types/handlers/Code.js'; -import { SupportedCdn } from '$types/handlers/Css.js'; +import type { CodeBackend, CodeBackendWithCss } from '$types/handlers/Code.js'; +import type { SupportedCdn } from '$types/handlers/Css.js'; import { - HighlightJsThemeName, - StarryNightThemeName, + type HighlightJsThemeName, + type StarryNightThemeName, highlightJsThemeNames, starryNightThemeNames, } from '$data/code.js'; diff --git a/src/typeGuards/frontmatter.ts b/src/typeGuards/frontmatter.ts index 00e0608..de3d0c7 100644 --- a/src/typeGuards/frontmatter.ts +++ b/src/typeGuards/frontmatter.ts @@ -1,7 +1,7 @@ // File description: // Types -import { Equals, typeAssert } from '$deps.js'; +import { type Equals, typeAssert } from '$deps.js'; import type { MetaHttpEquiv, MetaName } from '$types/utils/Frontmatter.js'; export function isMetaName(name: string): name is MetaName { diff --git a/src/typeGuards/verbatim.ts b/src/typeGuards/verbatim.ts index 4a900bb..00f8fdd 100644 --- a/src/typeGuards/verbatim.ts +++ b/src/typeGuards/verbatim.ts @@ -20,7 +20,7 @@ import { } from '$typeGuards/utils.js'; // External dependencies -import { Equals, typeAssert } from '$deps.js'; +import { type Equals, typeAssert } from '$deps.js'; export const supportedTexEngines = [ 'lualatex', diff --git a/src/types/handlers/Handler.ts b/src/types/handlers/Handler.ts index 4ca231e..6704a58 100644 --- a/src/types/handlers/Handler.ts +++ b/src/types/handlers/Handler.ts @@ -1,12 +1,7 @@ // File description: Types related to the `Handler` class. /* eslint-disable tsdoc/syntax */ -import { ProcessedSnippet } from '$types/utils/Escape.js'; - -// For TSDoc comments -/* eslint-disable @typescript-eslint/no-unused-vars */ -import type { Handler } from '$handlers/Handler.js'; -/* eslint-enable @typescript-eslint/no-unused-vars */ +import type { ProcessedSnippet } from '$types/utils/Escape.js'; /** * A transformer. Two types of transformers are supported: @@ -26,8 +21,8 @@ import type { Handler } from '$handlers/Handler.js'; * * @typeParam Options - The type of the options object that may be passed to the * transformation functions. Generally speaking, this should be or extend the - * `ProcessOptions` type parameter of the {@link Handler | `Handler`} class in - * which the transformer is being called. + * `ProcessOptions` type parameter of the `Handler` class in which the + * transformer is being called. */ export type Transformer = | [RegExp | string, string] diff --git a/src/types/handlers/Tex.ts b/src/types/handlers/Tex.ts index 6b13ea1..61b668c 100644 --- a/src/types/handlers/Tex.ts +++ b/src/types/handlers/Tex.ts @@ -24,8 +24,8 @@ import type { TexComponent } from '$utils/TexComponent.js'; // For IntelliSense /* eslint-disable @typescript-eslint/no-unused-vars */ -import type { DvisvgmSvgOutputOptions } from '$types/utils/DvisvgmOptions.js'; -import type { TexLogSeverity } from '$data/tex.js'; +import type { DvisvgmSvgOutputOptions as _DvisvgmSvgOutputOptions } from '$types/utils/DvisvgmOptions.js'; +import type { TexLogSeverity as _TexLogSeverity } from '$data/tex.js'; /* eslint-enable @typescript-eslint/no-unused-vars */ /** @@ -433,7 +433,7 @@ interface OptimizationOptions { * @remarks * `dvisvgm` already includes options to achieve the behavior that this * property aims to achieve (namely, the - * {@link DvisvgmSvgOutputOptions.currentColor | `DvisvgmOptions.svg.currentColor`}). + * {@link _DvisvgmSvgOutputOptions.currentColor | `DvisvgmOptions.svg.currentColor`}). * However, this present option can still be useful to take care of any * potential edge cases that `dvisvgm`'s `currentColor` option might not * cover. @@ -522,7 +522,7 @@ interface DebugOptions { * ``` */ verbosity?: - | ('all' | TexLogSeverity | 'none' | undefined) + | ('all' | _TexLogSeverity | 'none' | undefined) | { /** * Lowest severity level of messages from LaTeX log to print upon @@ -546,7 +546,7 @@ interface DebugOptions { * 'box' * ``` */ - onFailure?: 'all' | TexLogSeverity | 'none' | undefined; + onFailure?: 'all' | _TexLogSeverity | 'none' | undefined; /** * Lowest severity level of messages from LaTeX log to print upon @@ -570,7 +570,7 @@ interface DebugOptions { * 'box' * ``` */ - onSuccess?: 'all' | TexLogSeverity | 'none' | undefined; + onSuccess?: 'all' | _TexLogSeverity | 'none' | undefined; } | undefined; } @@ -668,5 +668,5 @@ export interface Problem { message: string; line: number; col?: number | undefined; - severity: TexLogSeverity; + severity: _TexLogSeverity; } diff --git a/src/types/handlers/Verbatim.ts b/src/types/handlers/Verbatim.ts index 03bf59c..bb0e495 100644 --- a/src/types/handlers/Verbatim.ts +++ b/src/types/handlers/Verbatim.ts @@ -15,8 +15,8 @@ import type { TexComponent } from '$utils/TexComponent.js'; // For TSDoc comments /* eslint-disable @typescript-eslint/no-unused-vars */ -import type { CompilationOptions } from '$types/handlers/Tex.js'; -import type { SveltexConfiguration } from '$types/SveltexConfiguration.js'; +import type { CompilationOptions as _CompilationOptions } from '$types/handlers/Tex.js'; +import type { SveltexConfiguration as _SveltexConfiguration } from '$types/SveltexConfiguration.js'; /* eslint-enable @typescript-eslint/no-unused-vars */ export interface VerbatimProcessOptions { @@ -607,7 +607,7 @@ interface TikzPreset { /** * This library provides capabilities for automatic graph drawing. It * requires that the document is typeset using LuaTeX (i.e., - * {@link CompilationOptions.engine | `engine`} set to `lualatex` or + * {@link _CompilationOptions.engine | `engine`} set to `lualatex` or * `lualatexmk`). This package should work with LuaTeX 0.54 or higher. * * @see https://tikz.dev/gd-usage-tikz#pgf.graphdrawing @@ -869,7 +869,7 @@ interface TikzPreset { * such annotations with this library. * * @remarks - * {@link CompilationOptions.intermediateFiletype | `intermediateFiletype`} + * {@link _CompilationOptions.intermediateFiletype | `intermediateFiletype`} * must be set to `'dvi'` for this library to work. * * @see https://tikz.dev/library-rdf @@ -1114,7 +1114,7 @@ export interface VerbEnvConfigTex extends VerbEnvConfigBase { * * @remarks * Sveltex will automatically add the class option `dvisvgm` if - * {@link CompilationOptions.intermediateFiletype | `intermediateFiletype`} + * {@link _CompilationOptions.intermediateFiletype | `intermediateFiletype`} * is set to `'dvi'`. See https://tikz.dev/drivers. */ options?: string[] | undefined; @@ -1123,7 +1123,7 @@ export interface VerbEnvConfigTex extends VerbEnvConfigBase { /** * Override any part of the default TeX configuration inherited - * from the {@link SveltexConfiguration.tex | `tex`} + * from the {@link _SveltexConfiguration.tex | `tex`} * property of the Sveltex configuration. */ overrides?: TexConfiguration | undefined; diff --git a/src/types/utils/Frontmatter.ts b/src/types/utils/Frontmatter.ts index ad71e6e..d4b50fb 100644 --- a/src/types/utils/Frontmatter.ts +++ b/src/types/utils/Frontmatter.ts @@ -1,6 +1,6 @@ // File description: Types related to SvelTeX's handling of frontmatter. -import { MdastLiteral } from '$deps.js'; +import type { MdastLiteral } from '$deps.js'; export type MetaName = | 'charset' @@ -133,9 +133,12 @@ export interface MdastJson extends MdastLiteral { type: 'json'; } -declare module 'mdast' { - interface FrontmatterContentMap { - toml: MdastToml; - json: MdastJson; - } -} +// JSR doesn't like this +// (see https://jsr.io/docs/about-slow-types#global-augmentation) + +// declare module 'mdast' { +// interface FrontmatterContentMap { +// toml: MdastToml; +// json: MdastJson; +// } +// } diff --git a/src/types/utils/PopplerOptions.ts b/src/types/utils/PopplerOptions.ts index 16a95dd..0c38eee 100644 --- a/src/types/utils/PopplerOptions.ts +++ b/src/types/utils/PopplerOptions.ts @@ -1,7 +1,7 @@ // File description: Types describing the options that can be passed to // `node-poppler`'s `Poppler.pdfToCairo` instance method via SvelTeX. -import { PropertiesDefinedNotNull } from '$types/utils/utility-types.js'; +import type { PropertiesDefinedNotNull } from '$types/utils/utility-types.js'; export type CleanPopplerSvgOptions = PropertiesDefinedNotNull; diff --git a/src/utils/TexComponent.ts b/src/utils/TexComponent.ts index 5236621..ee42d5a 100644 --- a/src/utils/TexComponent.ts +++ b/src/utils/TexComponent.ts @@ -15,7 +15,7 @@ import type { VerbEnvConfigTex, } from '$types/handlers/Verbatim.js'; import type { CliInstruction } from '$types/utils/CliInstruction.js'; -import type { KeyPath } from '$utils/cache.js'; +import type { KeyPath, SveltexCache } from '$utils/cache.js'; // Internal dependencies import { @@ -30,7 +30,7 @@ import { type TexLogSeverity, } from '$data/tex.js'; import { isArray, isObject, isString } from '$typeGuards/utils.js'; -import { InterpretedAttributes } from '$types/utils/Escape.js'; +import type { InterpretedAttributes } from '$types/utils/Escape.js'; import { spawnCliInstruction } from '$utils/cli.js'; import { escapeCssColorVars, @@ -102,7 +102,7 @@ export class TexComponent { * 'Sveltex_tikz_myfig' * */ - get id() { + get id(): string { return TexComponent.id({ name: this.tag, ref: this.ref, @@ -134,7 +134,7 @@ export class TexComponent { /** */ - get svgComponentTag() { + get svgComponentTag(): string { return TexComponent.svgComponentTag({ ref: this.ref, name: this.tag, @@ -143,7 +143,7 @@ export class TexComponent { /** */ - get outputString() { + get outputString(): string { return this.configuration.postprocess(this.svgComponentTag, this); } @@ -211,11 +211,11 @@ export class TexComponent { * created this component. * */ - get cache() { + get cache(): SveltexCache { return this.texHandler.cache; } - get texConfig() { + get texConfig(): FullTexConfiguration { return mergeConfigs( this.texHandler.configuration, this._configuration.overrides, @@ -473,7 +473,12 @@ export class TexComponent { * returned by the previous step. * */ - get handleAttributes() { + get handleAttributes(): ( + attributes: Record< + string, + string | number | boolean | null | undefined + >, + ) => Record { return ( attributes: Record< string, @@ -528,7 +533,7 @@ export class TexComponent { * files' directory relative to the cache directory. * */ - get keyPath() { + get keyPath(): KeyPath { return join(this.tag, this.ref) as KeyPath; } diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 0d025c5..09c9fe8 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -110,9 +110,9 @@ export class SveltexCache { * that if anyone tries to serialize a `SvelteCache` object (which Vite * will), we exclude the `cacheDirGlob` property. */ - toJSON() { + toJSON(): object { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { cacheDirGlob, ...otherProps } = this; + const { cacheDirGlob: _cacheDirGlob, ...otherProps } = this; return otherProps; } diff --git a/src/utils/cdn.ts b/src/utils/cdn.ts index 9b810e8..c73a887 100644 --- a/src/utils/cdn.ts +++ b/src/utils/cdn.ts @@ -1,7 +1,7 @@ // File description: Get CDN URLs and fetch from them. // Types -import { SupportedCdn } from '$types/handlers/Css.js'; +import type { SupportedCdn } from '$types/handlers/Css.js'; // Internal dependencies import { cdnPrefixes } from '$data/cdn.js'; diff --git a/src/utils/diagnosers/verbatimEnvironmentConfiguration.ts b/src/utils/diagnosers/verbatimEnvironmentConfiguration.ts index 6a62394..7ea13a5 100644 --- a/src/utils/diagnosers/verbatimEnvironmentConfiguration.ts +++ b/src/utils/diagnosers/verbatimEnvironmentConfiguration.ts @@ -21,7 +21,7 @@ import { Diagnoser, insteadGot } from '$utils/diagnosers/Diagnoser.js'; import { log } from '$utils/debug.js'; import { diagnoseTexConfig } from '$utils/diagnosers/texConfiguration.js'; import { getDefaultVerbEnvConfig } from '$base/defaults.js'; -import { VerbatimType } from '$types/handlers/Verbatim.js'; +import type { VerbatimType } from '$types/handlers/Verbatim.js'; /** * Diagnose whether a given object is a valid verbatim environment diff --git a/src/utils/escape.ts b/src/utils/escape.ts index 8d5bbcf..9f26c1d 100644 --- a/src/utils/escape.ts +++ b/src/utils/escape.ts @@ -21,13 +21,13 @@ import { parseComponent } from '$utils/parseComponent.js'; // External dependencies import { MagicString, - MdastCodeNode, - MdastInlineCodeNode, - MdastInlineMathNode, - MdastMathNode, - MdastMdxFlowExpressionNode, - MdastMdxTextExpressionNode, - MdastRoot, + type MdastCodeNode, + type MdastInlineCodeNode, + type MdastInlineMathNode, + type MdastMathNode, + type MdastMdxFlowExpressionNode, + type MdastMdxTextExpressionNode, + type MdastRoot, XRegExp, typeAssert, getProperty, @@ -43,15 +43,15 @@ import { micromarkFrontmatter, micromarkDirective, mdastFrontmatterFromMarkdown, - MdastYaml, + type MdastYaml, inspect, type UnistPosition, directiveFromMarkdown, } from '$deps.js'; import { micromarkSkip } from '$utils/micromark/syntax.js'; -import { MdastJson, MdastToml } from '$types/utils/Frontmatter.js'; -import { VerbatimHandler } from '$handlers/VerbatimHandler.js'; -import { CodeBackend, getDefaultMathConfiguration } from '$mod.js'; +import type { MdastJson, MdastToml } from '$types/utils/Frontmatter.js'; +import type { VerbatimHandler } from '$handlers/VerbatimHandler.js'; +import { type CodeBackend, getDefaultMathConfiguration } from '$mod.js'; import { log, prettifyError } from '$utils/debug.js'; import type { WithFullDelims } from '$types/handlers/Math.js'; diff --git a/src/utils/frontmatter.ts b/src/utils/frontmatter.ts index 1b9fd1c..b5dfe41 100644 --- a/src/utils/frontmatter.ts +++ b/src/utils/frontmatter.ts @@ -13,7 +13,7 @@ import { log, prettifyError } from '$utils/debug.js'; // External dependencies import { parseYaml, parseToml } from '$deps.js'; -import { ProcessableSnippet } from '$types/utils/Escape.js'; +import type { ProcessableSnippet } from '$types/utils/Escape.js'; import { isArray, isNonNullObject, diff --git a/src/utils/parseComponent.ts b/src/utils/parseComponent.ts index c01001a..70d9250 100644 --- a/src/utils/parseComponent.ts +++ b/src/utils/parseComponent.ts @@ -4,7 +4,7 @@ // Internal dependencies import { is, typeAssert } from '$deps.js'; import { isBoolean, isNumber, isString } from '$typeGuards/utils.js'; -import { InterpretedAttributes, ParsedComponent } from '$types/utils/Escape.js'; +import type { InterpretedAttributes, ParsedComponent } from '$types/utils/Escape.js'; import { escapeWhitespace } from '$utils/debug.js'; import { re } from '$utils/misc.js'; diff --git a/tests/unit/base/Sveltex/sveltex.commonmark.test.ts b/tests/unit/base/Sveltex/sveltex.commonmark.test.ts index f75b7ce..b9337ab 100644 --- a/tests/unit/base/Sveltex/sveltex.commonmark.test.ts +++ b/tests/unit/base/Sveltex/sveltex.commonmark.test.ts @@ -5,7 +5,7 @@ import { codeBackends, markdownBackends, } from '$utils/diagnosers/backendChoices.js'; -import { MarkdownBackend } from '$types/handlers/Markdown.js'; +import type { MarkdownBackend } from '$types/handlers/Markdown.js'; import { nodeAssert } from '$deps.js'; import { commonMarkSpec } from '$tests/unit/base/Sveltex/commonmark.js'; diff --git a/tests/unit/base/Sveltex/sveltex.real.test.ts b/tests/unit/base/Sveltex/sveltex.real.test.ts index 0a8f113..bc7b0ae 100644 --- a/tests/unit/base/Sveltex/sveltex.real.test.ts +++ b/tests/unit/base/Sveltex/sveltex.real.test.ts @@ -8,7 +8,7 @@ import type { } from '$types/handlers/Markdown.js'; import type { MathBackend } from '$types/handlers/Math.js'; -import { Sveltex, sveltex } from '$base/Sveltex.js'; +import { type Sveltex, sveltex } from '$base/Sveltex.js'; import { spy } from '$tests/unit/fixtures.js'; import { isArray, isString } from '$typeGuards/utils.js'; import { re } from '$utils/misc.js'; diff --git a/tests/unit/base/Sveltex/sveltex.script.test.ts b/tests/unit/base/Sveltex/sveltex.script.test.ts index 0f47c20..3af544f 100644 --- a/tests/unit/base/Sveltex/sveltex.script.test.ts +++ b/tests/unit/base/Sveltex/sveltex.script.test.ts @@ -1,9 +1,9 @@ -import { Sveltex, sveltex } from '$base/Sveltex.js'; +import { type Sveltex, sveltex } from '$base/Sveltex.js'; import { spy } from '$tests/unit/fixtures.js'; import { mockFs } from '$dev_deps.js'; -import { Processed } from 'svelte/compiler'; +import type { Processed } from 'svelte/compiler'; import { - MockInstance, + type MockInstance, afterAll, beforeAll, beforeEach, diff --git a/tests/unit/base/defaults.test.ts b/tests/unit/base/defaults.test.ts index f94d762..1c056dd 100644 --- a/tests/unit/base/defaults.test.ts +++ b/tests/unit/base/defaults.test.ts @@ -7,7 +7,7 @@ import { beforeEach, afterEach, beforeAll, - MockInstance, + type MockInstance, } from 'vitest'; import { getDefaultCodeConfig, @@ -23,7 +23,7 @@ import { TexHandler } from '$handlers/TexHandler.js'; import { verbatimTypes } from '$typeGuards/verbatim.js'; import { spy } from '$tests/unit/fixtures.js'; import { diagnoseVerbEnvConfig } from '$utils/diagnosers/verbatimEnvironmentConfiguration.js'; -import { +import type { FullVerbEnvConfigTex, VerbatimType, } from '$types/handlers/Verbatim.js'; @@ -34,11 +34,11 @@ import { markdownBackends, } from '$utils/diagnosers/backendChoices.js'; import { is, typeAssert } from '$deps.js'; -import { +import type { CleanPopplerSvgOptions, PopplerSvgOptions, } from '$types/utils/PopplerOptions.js'; -import { PropertiesDefined } from '$types/utils/utility-types.js'; +import type { PropertiesDefined } from '$types/utils/utility-types.js'; import { fc, fuzzyTest } from '$dev_deps.js'; import { TexComponent } from '$utils/TexComponent.js'; diff --git a/tests/unit/handlers/CodeHandler.test.ts b/tests/unit/handlers/CodeHandler.test.ts index 1deeb85..e58f9de 100644 --- a/tests/unit/handlers/CodeHandler.test.ts +++ b/tests/unit/handlers/CodeHandler.test.ts @@ -10,7 +10,7 @@ import { } from 'vitest'; import { CodeHandler } from '$handlers/CodeHandler.js'; import { consoles } from '$utils/debug.js'; -import { CodeBackend, CodeConfiguration } from '$types/handlers/Code.js'; +import type { CodeBackend, CodeConfiguration } from '$types/handlers/Code.js'; import { codeBackends } from '$utils/diagnosers/backendChoices.js'; import { getDefaultCodeConfig } from '$base/defaults.js'; import { nodeAssert, uuid } from '$deps.js'; diff --git a/tests/unit/handlers/MathHandler/MathHandler.katex.errors.test.ts b/tests/unit/handlers/MathHandler/MathHandler.katex.errors.test.ts index b00efaf..a7b8357 100644 --- a/tests/unit/handlers/MathHandler/MathHandler.katex.errors.test.ts +++ b/tests/unit/handlers/MathHandler/MathHandler.katex.errors.test.ts @@ -6,7 +6,7 @@ import { vi, beforeEach, beforeAll, - MockInstance, + type MockInstance, } from 'vitest'; import { MathHandler } from '$handlers/MathHandler.js'; import { spy } from '$tests/unit/fixtures.js'; diff --git a/tests/unit/handlers/MathHandler/MathHandler.katex.test.ts b/tests/unit/handlers/MathHandler/MathHandler.katex.test.ts index 0f004db..1cbf80b 100644 --- a/tests/unit/handlers/MathHandler/MathHandler.katex.test.ts +++ b/tests/unit/handlers/MathHandler/MathHandler.katex.test.ts @@ -6,12 +6,12 @@ import { vi, beforeEach, beforeAll, - MockInstance, + type MockInstance, } from 'vitest'; import { MathHandler } from '$handlers/MathHandler.js'; import { spy } from '$tests/unit/fixtures.js'; import { v4 as uuid } from 'uuid'; -import { MathConfiguration } from '$types/handlers/Math.js'; +import type { MathConfiguration } from '$types/handlers/Math.js'; function fixture() { beforeEach(() => { diff --git a/tests/unit/handlers/MathHandler/MathHandler.mathjax.test.ts b/tests/unit/handlers/MathHandler/MathHandler.mathjax.test.ts index b1e496f..e94c65c 100644 --- a/tests/unit/handlers/MathHandler/MathHandler.mathjax.test.ts +++ b/tests/unit/handlers/MathHandler/MathHandler.mathjax.test.ts @@ -6,14 +6,14 @@ import { vi, beforeEach, beforeAll, - MockInstance, + type MockInstance, } from 'vitest'; import { MathHandler } from '$handlers/MathHandler.js'; import { spy } from '$tests/unit/fixtures.js'; import { v4 as uuid } from 'uuid'; import { consoles } from '$utils/debug.js'; -import { SupportedCdn } from '$types/handlers/Css.js'; -import { PossibleMathCssApproach } from '$types/handlers/Math.js'; +import type { SupportedCdn } from '$types/handlers/Css.js'; +import type { PossibleMathCssApproach } from '$types/handlers/Math.js'; import { sveltex } from '$base/Sveltex.js'; function fixture() { diff --git a/tests/unit/handlers/TexHandler.test.ts b/tests/unit/handlers/TexHandler.test.ts index 60523da..7dab12b 100644 --- a/tests/unit/handlers/TexHandler.test.ts +++ b/tests/unit/handlers/TexHandler.test.ts @@ -14,7 +14,7 @@ import { vi, } from 'vitest'; import { sha256 } from '$utils/misc.js'; -import { TexConfiguration } from '$mod.js'; +import type { TexConfiguration } from '$mod.js'; import { getDefaultVerbEnvConfig } from '$base/defaults.js'; /** diff --git a/tests/unit/utils/TexComponent.test.ts b/tests/unit/utils/TexComponent.test.ts index ff313ff..e5107a2 100644 --- a/tests/unit/utils/TexComponent.test.ts +++ b/tests/unit/utils/TexComponent.test.ts @@ -18,8 +18,8 @@ import { cartesianProduct } from '$tests/unit/utils.js'; import { supportedTexEngines } from '$typeGuards/verbatim.js'; import type { SupportedTexEngine } from '$types/SveltexConfiguration.js'; import type { Problem } from '$types/handlers/Tex.js'; -import { VerbEnvConfigTex } from '$types/handlers/Verbatim.js'; -import { CliInstruction } from '$types/utils/CliInstruction.js'; +import type { VerbEnvConfigTex } from '$types/handlers/Verbatim.js'; +import type { CliInstruction } from '$types/utils/CliInstruction.js'; import { TexComponent, enactPresets, @@ -336,7 +336,7 @@ describe('compile(): catches errors', () => { if (!custom) { readFile.mockResolvedValueOnce('test-pdf'); spawnCliInstructionMock.mockImplementation( - async (instr: CliInstruction) => { + (instr: CliInstruction) => { if (instr.command === 'dvisvgm') { return Promise.resolve({ code: 1, diff --git a/tests/unit/utils/ast.test.ts b/tests/unit/utils/ast.test.ts index ccd040b..bc485ca 100644 --- a/tests/unit/utils/ast.test.ts +++ b/tests/unit/utils/ast.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'; import { getLocationUnist, lineColToLocation } from '$utils/ast.js'; import type { UnistNode } from '$deps.js'; import { cartesianProduct, range } from '$tests/unit/utils.js'; -import { LineColumn, Offsets } from '$types/utils/Ast.js'; +import type { LineColumn, Offsets } from '$types/utils/Ast.js'; describe('getLocationUnist', () => { describe('core functionality', () => { diff --git a/tests/unit/utils/diagnosers/verbatimEnvironmentConfiguration.test.ts b/tests/unit/utils/diagnosers/verbatimEnvironmentConfiguration.test.ts index 2f9dd61..07ba23a 100644 --- a/tests/unit/utils/diagnosers/verbatimEnvironmentConfiguration.test.ts +++ b/tests/unit/utils/diagnosers/verbatimEnvironmentConfiguration.test.ts @@ -1,7 +1,7 @@ import { getDefaultVerbEnvConfig } from '$base/defaults.js'; import { spy } from '$tests/unit/fixtures.js'; import { isArray } from '$typeGuards/utils.js'; -import { VerbEnvConfigBase } from '$types/handlers/Verbatim.js'; +import type { VerbEnvConfigBase } from '$types/handlers/Verbatim.js'; import { diagnoseVerbEnvConfig } from '$utils/diagnosers/verbatimEnvironmentConfiguration.js'; import { it, diff --git a/tests/unit/utils/env.test.ts b/tests/unit/utils/env.test.ts index 02bd1d9..3bbd5e2 100644 --- a/tests/unit/utils/env.test.ts +++ b/tests/unit/utils/env.test.ts @@ -1,5 +1,5 @@ import { - MockInstance, + type MockInstance, afterEach, beforeAll, beforeEach, diff --git a/tests/unit/utils/escape.test.ts b/tests/unit/utils/escape.test.ts index e5ec592..14fab6d 100644 --- a/tests/unit/utils/escape.test.ts +++ b/tests/unit/utils/escape.test.ts @@ -25,7 +25,7 @@ import { } from '$utils/escape.js'; import { cartesianProduct, range, uuidV4Regexp } from '$tests/unit/utils.js'; import { typeAssert, is } from '$deps.js'; -import { +import type { EscapableSnippet, EscapedSnippet, ProcessedSnippet, diff --git a/tests/unit/utils/frontmatter.test.ts b/tests/unit/utils/frontmatter.test.ts index 9016779..a2f80d9 100644 --- a/tests/unit/utils/frontmatter.test.ts +++ b/tests/unit/utils/frontmatter.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect, - MockInstance, + type MockInstance, beforeAll, afterAll, vi, @@ -13,10 +13,10 @@ import { interpretFrontmatter, parseFrontmatter, } from '$utils/frontmatter.js'; -import { Frontmatter } from '$types/utils/Frontmatter.js'; +import type { Frontmatter } from '$types/utils/Frontmatter.js'; import { spy } from '$tests/unit/fixtures.js'; import { isString } from '$typeGuards/utils.js'; -import { ProcessableSnippet } from '$types/utils/Escape.js'; +import type { ProcessableSnippet } from '$types/utils/Escape.js'; let log: MockInstance; beforeAll(async () => {