diff --git a/packages/core/src/CommandChain.ts b/packages/core/src/CommandChain.ts index 8f3fe41..b7b276f 100644 --- a/packages/core/src/CommandChain.ts +++ b/packages/core/src/CommandChain.ts @@ -1,6 +1,6 @@ import type { EditorState, TransactionSpec } from "@codemirror/state"; -import type { ChainedCommands, Command, CommandContext } from "./types/commands.ts"; -import type { Editor } from "./Editor.ts"; +import type { ChainedCommands, Command, CommandContext } from "~/types/commands.ts"; +import type { Editor } from "~/Editor.ts"; /** One collected chain step: a command impl and the args to call it with. */ type CommandStep = { diff --git a/packages/core/src/Editor.spec.ts b/packages/core/src/Editor.spec.ts index 96db589..6155614 100644 --- a/packages/core/src/Editor.spec.ts +++ b/packages/core/src/Editor.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from "vite-plus/test"; -import { Editor } from "./Editor.ts"; +import { Editor } from "~/Editor.ts"; import { EditorState } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index c0faf5e..89b6aed 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -1,11 +1,11 @@ import { EditorState, Text } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; import { EventEmitter } from "./EventEmitter.ts"; -import type { EditorEvents, EditorOptions } from "./types/editor.ts"; +import type { EditorEvents, EditorOptions } from "~/types/editor.ts"; import { ExtensionManager } from "./ExtensionManager.ts"; -import type { ChainedCommands, SingleCommands } from "./types/commands.ts"; +import type { ChainedCommands, SingleCommands } from "~/types/commands.ts"; import { CommandChain } from "./CommandChain.ts"; -import { CommandsExtension } from "./extensions/commands.ts"; +import { CommandsExtension } from "~/extensions/commands.ts"; export class Editor extends EventEmitter { private _te: TextEncoder = new TextEncoder(); diff --git a/packages/core/src/EventEmitter.spec.ts b/packages/core/src/EventEmitter.spec.ts index 77e5aaf..94f41fd 100644 --- a/packages/core/src/EventEmitter.spec.ts +++ b/packages/core/src/EventEmitter.spec.ts @@ -1,5 +1,5 @@ import { describe, it, vi, expect } from "vite-plus/test"; -import { EventEmitter } from "./EventEmitter.ts"; +import { EventEmitter } from "~/EventEmitter.ts"; describe("EventEmitter", () => { it("creates listeners and triggers callbacks", () => { diff --git a/packages/core/src/ExtensionManager.spec.ts b/packages/core/src/ExtensionManager.spec.ts index 63ce813..4dfe8ed 100644 --- a/packages/core/src/ExtensionManager.spec.ts +++ b/packages/core/src/ExtensionManager.spec.ts @@ -2,8 +2,8 @@ import { EditorState, StateField } from "@codemirror/state"; import { keymap } from "@codemirror/view"; import { describe, expect, it } from "vite-plus/test"; import { ExtensionManager } from "./ExtensionManager.ts"; -import type { InkwellExtension } from "./types/extensions.ts"; -import type { Editor } from "./Editor.ts"; +import type { InkwellExtension } from "~/types/extensions.ts"; +import type { Editor } from "~/Editor.ts"; describe("ExtensionManager", () => { const editor = {} as Editor; diff --git a/packages/core/src/ExtensionManager.ts b/packages/core/src/ExtensionManager.ts index 82af491..4fdc5c7 100644 --- a/packages/core/src/ExtensionManager.ts +++ b/packages/core/src/ExtensionManager.ts @@ -1,9 +1,9 @@ import type { Extension as CMExtension } from "@codemirror/state"; import { type KeyBinding, keymap } from "@codemirror/view"; -import type { Editor } from "./Editor.ts"; -import type { InkwellExtension } from "./types/extensions.ts"; -import type { CommandRegistry } from "./CommandChain.ts"; -import { resolveExtensionsOnEditor } from "./helpers/resolveExtensionsOnEditor.ts"; +import type { Editor } from "~/Editor.ts"; +import type { InkwellExtension } from "~/types/extensions.ts"; +import type { CommandRegistry } from "~/CommandChain.ts"; +import { resolveExtensionsOnEditor } from "~/helpers/resolveExtensionsOnEditor.ts"; /** * Manages and resolves extensions so the editor receives one complete CodeMirror setup. diff --git a/packages/core/src/commands/cutContent.ts b/packages/core/src/commands/cutContent.ts index ed4553a..9fe8a23 100644 --- a/packages/core/src/commands/cutContent.ts +++ b/packages/core/src/commands/cutContent.ts @@ -1,4 +1,4 @@ -import type { NamedCommand } from "../types/commands.ts"; +import type { NamedCommand } from "~/types/commands.ts"; declare module "@inkwell/core" { interface Commands { diff --git a/packages/core/src/commands/insertContent.ts b/packages/core/src/commands/insertContent.ts index d3822f1..965bde7 100644 --- a/packages/core/src/commands/insertContent.ts +++ b/packages/core/src/commands/insertContent.ts @@ -1,4 +1,4 @@ -import type { NamedCommand } from "../types/commands.ts"; +import type { NamedCommand } from "~/types/commands.ts"; declare module "@inkwell/core" { interface Commands { diff --git a/packages/core/src/commands/setContent.ts b/packages/core/src/commands/setContent.ts index 5323cc6..f9c5af3 100644 --- a/packages/core/src/commands/setContent.ts +++ b/packages/core/src/commands/setContent.ts @@ -1,4 +1,4 @@ -import type { NamedCommand } from "../types/commands.ts"; +import type { NamedCommand } from "~/types/commands.ts"; import { insertContent } from "./insertContent.ts"; declare module "@inkwell/core" { diff --git a/packages/core/src/extensions/commands.ts b/packages/core/src/extensions/commands.ts index dc7f0db..1334775 100644 --- a/packages/core/src/extensions/commands.ts +++ b/packages/core/src/extensions/commands.ts @@ -1,5 +1,5 @@ -import * as commands from "../commands/index.ts"; -import type { InkwellExtension } from "../types/extensions.ts"; +import * as commands from "~/commands/index.ts"; +import type { InkwellExtension } from "~/types/extensions.ts"; /** Built-in commands shipped with core. Registered by default. */ export const CommandsExtension: InkwellExtension = { diff --git a/packages/core/src/helpers/resolveExtensionsOnEditor.spec.ts b/packages/core/src/helpers/resolveExtensionsOnEditor.spec.ts index 8d8d0b4..aca1eab 100644 --- a/packages/core/src/helpers/resolveExtensionsOnEditor.spec.ts +++ b/packages/core/src/helpers/resolveExtensionsOnEditor.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from "vite-plus/test"; import { resolveExtensionsOnEditor } from "./resolveExtensionsOnEditor.ts"; -import type { Editor } from "../Editor.ts"; -import type { InkwellExtension } from "../types/extensions.ts"; +import type { Editor } from "~/Editor.ts"; +import type { InkwellExtension } from "~/types/extensions.ts"; describe("resolveExtensionsOnEditor", () => { const editor = {} as Editor; diff --git a/packages/core/src/helpers/resolveExtensionsOnEditor.ts b/packages/core/src/helpers/resolveExtensionsOnEditor.ts index 06d3df5..a93bc89 100644 --- a/packages/core/src/helpers/resolveExtensionsOnEditor.ts +++ b/packages/core/src/helpers/resolveExtensionsOnEditor.ts @@ -1,5 +1,5 @@ -import type { Editor } from "../Editor.ts"; -import type { InkwellExtension } from "../types/extensions.ts"; +import type { Editor } from "~/Editor.ts"; +import type { InkwellExtension } from "~/types/extensions.ts"; /** * Resolves the extensions by resolving child extensions and returning a flat list of all extensions + deduplicating by name. diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 6e699a3..10bbb1e 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,9 +1,9 @@ -export * from "./commands/index.ts"; -export * from "./types/index.ts"; +export * from "~/commands/index.ts"; +export * from "~/types/index.ts"; -export * from "./CommandChain.ts"; -export * from "./EventEmitter.ts"; -export * from "./ExtensionManager.ts"; -export * from "./Editor.ts"; +export * from "~/CommandChain.ts"; +export * from "~/EventEmitter.ts"; +export * from "~/ExtensionManager.ts"; +export * from "~/Editor.ts"; -export { Editor as default } from "./Editor.ts"; +export { Editor as default } from "~/Editor.ts"; diff --git a/packages/core/src/types/commands.ts b/packages/core/src/types/commands.ts index 74604d0..8715909 100644 --- a/packages/core/src/types/commands.ts +++ b/packages/core/src/types/commands.ts @@ -1,5 +1,5 @@ import type { EditorState, TransactionSpec } from "@codemirror/state"; -import type { Editor } from "../Editor.ts"; +import type { Editor } from "~/Editor.ts"; import type { EditorView } from "@codemirror/view"; /** diff --git a/packages/core/src/types/editor.ts b/packages/core/src/types/editor.ts index c7dfd46..6bc5600 100644 --- a/packages/core/src/types/editor.ts +++ b/packages/core/src/types/editor.ts @@ -1,6 +1,6 @@ import type { EditorSelection, Transaction } from "@codemirror/state"; import type { InkwellExtension } from "./extensions.ts"; -import type { Editor } from "../Editor.ts"; +import type { Editor } from "~/Editor.ts"; export type EditorOptions = { element: HTMLElement; diff --git a/packages/core/src/types/extensions.ts b/packages/core/src/types/extensions.ts index 3abf159..22991b3 100644 --- a/packages/core/src/types/extensions.ts +++ b/packages/core/src/types/extensions.ts @@ -1,6 +1,6 @@ import type { Extension as CMExtension } from "@codemirror/state"; import type { KeyBinding } from "@codemirror/view"; -import type { Editor } from "../Editor.ts"; +import type { Editor } from "~/Editor.ts"; import type { EditorEvents } from "./editor.ts"; import type { Command } from "./commands.ts"; diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index b01e22f..b47621d 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -17,6 +17,7 @@ "verbatimModuleSyntax": true, "skipLibCheck": true, "paths": { + "~/*": ["./src/*"], "@inkwell/core": ["./src/index.ts"] } } diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts index 4c7b197..6da9e55 100644 --- a/packages/core/vite.config.ts +++ b/packages/core/vite.config.ts @@ -1,6 +1,9 @@ import { defineConfig } from "vite-plus"; export default defineConfig({ + resolve: { + alias: { "~": "/src" }, + }, pack: { dts: { tsgo: true,