Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: add missing static analysis tools (#4551)

Elijah Potterf9f62d692918
diff --git a/justfile b/justfile
index 6665903dd..cad622706 100644
--- a/justfile
+++ b/justfile
@@ -478,6 +478,12 @@ check-js: build-harperjs build-lint-framework build-components build-harper-edit
cd "{{justfile_directory()}}/packages/chrome-plugin"
pnpm check
+ cd "{{justfile_directory()}}/packages/obsidian-plugin"
+ pnpm check
+
+ cd "{{justfile_directory()}}/packages/wordpress-plugin"
+ pnpm check
+
cd "{{justfile_directory()}}/packages/components"
pnpm check
diff --git a/packages/chrome-plugin/tests/googleDocs.d.ts b/packages/chrome-plugin/tests/googleDocs.d.ts
new file mode 100644
index 000000000..0a583f1d9
--- /dev/null
+++ b/packages/chrome-plugin/tests/googleDocs.d.ts
@@ -0,0 +1,11 @@
+/** The Google Docs annotated-text API used by the live integration tests. */
+interface GoogleDocsAnnotatedText {
+ getText(): string;
+ setSelection(start: number, end: number): void;
+ getSelection?: () => Record<string, unknown>[];
+}
+
+interface Window {
+ /** Google Docs installs this API asynchronously when its editor loads. */
+ _docs_annotate_getAnnotatedText?: (extensionId?: string) => Promise<GoogleDocsAnnotatedText>;
+}
diff --git a/packages/chrome-plugin/tests/googleDocsTestUtils.ts b/packages/chrome-plugin/tests/googleDocsTestUtils.ts
index 83e3c6b90..a084a23e5 100644
--- a/packages/chrome-plugin/tests/googleDocsTestUtils.ts
+++ b/packages/chrome-plugin/tests/googleDocsTestUtils.ts
@@ -45,7 +45,7 @@ export async function openLiveGoogleDoc(page: Page) {
try {
const annotated = await window._docs_annotate_getAnnotatedText();
return Boolean(
- annotated?.getText &&
+ typeof annotated?.getText === 'function' &&
document.querySelector('#harper-google-docs-target') &&
document.querySelector('#harper-google-docs-main-world-bridge'),
);
@@ -93,7 +93,8 @@ export async function moveGoogleDocsCursorToEnd(page: Page) {
async function getGoogleDocsRenderedState(page: Page): Promise<GoogleDocsRenderedState> {
return await page.evaluate(async () => {
- const annotated = await window._docs_annotate_getAnnotatedText();
+ const annotated = await window._docs_annotate_getAnnotatedText?.();
+ if (!annotated) throw new Error('Google Docs annotated-text API is unavailable');
const rects = Array.from(
document.querySelectorAll<SVGRectElement>('.kix-appview-editor rect[aria-label]'),
);
@@ -322,7 +323,8 @@ export async function replaceGoogleDocsDocumentText(page: Page, text: string) {
async function selectGoogleDocsRange(page: Page, start: number, end: number) {
await page.evaluate(
async ({ selectionStart, selectionEnd }) => {
- const annotated = await window._docs_annotate_getAnnotatedText();
+ const annotated = await window._docs_annotate_getAnnotatedText?.();
+ if (!annotated) throw new Error('Google Docs annotated-text API is unavailable');
annotated.setSelection(selectionStart, selectionEnd);
},
{
@@ -336,7 +338,8 @@ async function selectGoogleDocsRange(page: Page, start: number, end: number) {
export async function selectGoogleDocsText(page: Page, text: string, occurrence = 0) {
const selection = await page.evaluate(
async ({ needle, targetOccurrence }) => {
- const annotated = await window._docs_annotate_getAnnotatedText();
+ const annotated = await window._docs_annotate_getAnnotatedText?.();
+ if (!annotated) throw new Error('Google Docs annotated-text API is unavailable');
const source = annotated.getText();
let start = -1;
let fromIndex = 0;
@@ -366,7 +369,8 @@ export async function selectGoogleDocsText(page: Page, text: string, occurrence
export async function selectGoogleDocsFromTextToEnd(page: Page, text: string) {
const selection = await page.evaluate(async (needle) => {
- const annotated = await window._docs_annotate_getAnnotatedText();
+ const annotated = await window._docs_annotate_getAnnotatedText?.();
+ if (!annotated) throw new Error('Google Docs annotated-text API is unavailable');
const source = annotated.getText();
const start = source.indexOf(needle);
if (start < 0) {
diff --git a/packages/chrome-plugin/tsconfig.node.json b/packages/chrome-plugin/tsconfig.node.json
index b0bf7ed56..1157a9e76 100644
--- a/packages/chrome-plugin/tsconfig.node.json
+++ b/packages/chrome-plugin/tsconfig.node.json
@@ -5,7 +5,9 @@
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
- "skipLibCheck": true
+ "skipLibCheck": true,
+ "strict": true,
+ "types": ["node", "chrome"]
},
- "include": ["vite.config.ts", "src/manifest.ts"]
+ "include": ["vite.config.ts", "playwright.config.ts", "src/manifest.ts", "tests/**/*.ts"]
}
diff --git a/packages/harper.js/tsconfig.json b/packages/harper.js/tsconfig.json
index e718fc402..0f04e1e76 100644
--- a/packages/harper.js/tsconfig.json
+++ b/packages/harper.js/tsconfig.json
@@ -21,5 +21,5 @@
"harper-wasm": ["../../harper-wasm/pkg"]
}
},
- "include": ["src"]
+ "include": ["src", "vite.config.ts"]
}
diff --git a/packages/harper.js/vite.config.ts b/packages/harper.js/vite.config.ts
index 677c6abf9..f7f29e591 100644
--- a/packages/harper.js/vite.config.ts
+++ b/packages/harper.js/vite.config.ts
@@ -1,7 +1,7 @@
-/// <reference types="vitest" />
import { playwright } from '@vitest/browser-playwright';
-import { defineConfig, type Plugin } from 'vite';
+import type { Plugin } from 'vite';
import dts from 'vite-plugin-dts';
+import { defineConfig } from 'vitest/config';
import apiExtractorConfig from './api-extractor.json';
function removeAssetsPlugin(options: { test: RegExp }): Plugin {
@@ -48,6 +48,7 @@ export default defineConfig({
...apiExtractorConfig,
rollupTypes: true,
tsconfigPath: './tsconfig.json',
+ include: ['src'],
}),
],
worker: {
diff --git a/packages/lint-framework/tsconfig.json b/packages/lint-framework/tsconfig.json
index 12671b09e..7e9b9a11f 100644
--- a/packages/lint-framework/tsconfig.json
+++ b/packages/lint-framework/tsconfig.json
@@ -18,5 +18,5 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
- "include": ["src"]
+ "include": ["src", "vite.config.ts"]
}
diff --git a/packages/lint-framework/vite.config.ts b/packages/lint-framework/vite.config.ts
index dbc681ea9..816cda21d 100644
--- a/packages/lint-framework/vite.config.ts
+++ b/packages/lint-framework/vite.config.ts
@@ -27,6 +27,7 @@ export default defineConfig({
dts({
rollupTypes: true,
tsconfigPath: './tsconfig.json',
+ include: ['src'],
}),
],
});
diff --git a/packages/obsidian-plugin/package.json b/packages/obsidian-plugin/package.json
index 8279e0280..7fa3df4ee 100644
--- a/packages/obsidian-plugin/package.json
+++ b/packages/obsidian-plugin/package.json
@@ -7,16 +7,21 @@
"@playwright/test": "1.60.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@types/lodash-es": "^4.17.12",
+ "@types/node": "catalog:",
+ "@types/rollup-plugin-peer-deps-external": "^2.2.6",
"@vitest/browser": "^4.0.16",
"@vitest/browser-playwright": "^4.0.16",
"obsidian": "^1.7.2",
+ "rollup": "4.35.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-svg-import": "^3.0.0",
+ "typescript": "catalog:",
"vite": "^6.3.5",
"vitest": "^4.0.16"
},
"scripts": {
"build": "vite build -l warn",
+ "check": "tsc --noEmit",
"dev": "vite build --watch",
"test": "vitest run"
},
diff --git a/packages/obsidian-plugin/src/HarperSettingTab.ts b/packages/obsidian-plugin/src/HarperSettingTab.ts
index 875efb605..95c217281 100644
--- a/packages/obsidian-plugin/src/HarperSettingTab.ts
+++ b/packages/obsidian-plugin/src/HarperSettingTab.ts
@@ -129,9 +129,9 @@ export class HarperSettingTab extends PluginSettingTab {
'Use a straight underline with a background color instead of the default squiggly underline.',
)
.addToggle((toggle) =>
- toggle.setValue(this.settings.useWebStyleLints ?? false).onChange(async (value) => {
- this.settings.useWebStyleLints = value;
- await this.state?.initializeFromSettings(this.settings);
+ toggle.setValue(settings.useWebStyleLints ?? false).onChange(async (value) => {
+ settings.useWebStyleLints = value;
+ await this.state?.initializeFromSettings(settings);
}),
);
@@ -585,10 +585,13 @@ export class HarperSettingTab extends PluginSettingTab {
.addOption('disable', offLabel)
.setValue(effective ? 'enable' : 'disable')
.onChange(async (v) => {
+ const settings = this.settings;
+ if (!settings) return;
+
// The structured config only organizes rules for display.
// Persist changes through the flat lint config keyed by rule name.
- this.settings.lintSettings[setting] = v === 'enable';
- await this.state?.initializeFromSettings(this.settings);
+ settings.lintSettings[setting] = v === 'enable';
+ await this.state?.initializeFromSettings(settings);
this.settings = await this.state?.getSettings();
this.renderLintSettingsToId(this.currentRuleSearchQuery, LintSettingId);
this.updateToggleAllRulesButton();
@@ -618,13 +621,16 @@ export class HarperSettingTab extends PluginSettingTab {
}
dropdown.setValue(currentName).onChange(async (selected) => {
+ const settings = this.settings;
+ if (!settings) return;
+
// The structured config only organizes rules for display.
// Persist changes through the flat lint config keyed by rule name.
for (const name of setting.names) {
- this.settings.lintSettings[name] = name === selected;
+ settings.lintSettings[name] = name === selected;
}
- await this.state?.initializeFromSettings(this.settings);
+ await this.state?.initializeFromSettings(settings);
this.settings = await this.state?.getSettings();
this.renderLintSettingsToId(this.currentRuleSearchQuery, LintSettingId);
this.updateToggleAllRulesButton();
diff --git a/packages/obsidian-plugin/src/SidebarView.ts b/packages/obsidian-plugin/src/SidebarView.ts
index 5ce14ea28..ce8d5fba9 100644
--- a/packages/obsidian-plugin/src/SidebarView.ts
+++ b/packages/obsidian-plugin/src/SidebarView.ts
@@ -1,5 +1,7 @@
+import type { EditorView } from '@codemirror/view';
import { type IconName, ItemView, Menu, setIcon, type WorkspaceLeaf } from 'obsidian';
import type HarperPlugin from './index';
+import type { Diagnostic } from './lint';
import { LINT_KIND_COLORS } from './lintKindColor';
export class SidebarView extends ItemView {
@@ -48,7 +50,7 @@ export class SidebarView extends ItemView {
container.appendChild(listContainer);
this.registerEvent(
- this.app.workspace.on('harper:lint-updated', (errors: any[], editorView: any) => {
+ this.app.workspace.on('harper:lint-updated', (errors, editorView) => {
listContainer.innerHTML = '';
if (!errors || errors.length === 0) {
@@ -89,7 +91,7 @@ function createTitle(text: string, color?: string): HTMLSpanElement {
return title;
}
-function getSeverityColor(error: any) {
+function getSeverityColor(error: Diagnostic) {
// find card color
let severityColor = '';
@@ -99,15 +101,15 @@ function getSeverityColor(error: any) {
const harperClass = classes.find((c: string) => c.startsWith('harper-lintRange-'));
if (harperClass) {
const lintKind = harperClass.replace('harper-lintRange-', '');
- if (LINT_KIND_COLORS?.[lintKind]) {
- severityColor = LINT_KIND_COLORS[lintKind];
+ if (lintKind in LINT_KIND_COLORS) {
+ severityColor = LINT_KIND_COLORS[lintKind as keyof typeof LINT_KIND_COLORS];
}
}
}
return severityColor;
}
-function createTitleDiv(error: any): HTMLDivElement {
+function createTitleDiv(error: Diagnostic): HTMLDivElement {
const titleDiv = document.createElement('div');
titleDiv.style.display = 'flex';
titleDiv.style.flexWrap = 'wrap';
@@ -144,7 +146,7 @@ function createTitleDiv(error: any): HTMLDivElement {
.setTitle('Ignore Diagnostic')
.setIcon('eye-off')
.onClick(() => {
- error.ignore();
+ error.ignore?.();
});
});
}
@@ -154,7 +156,7 @@ function createTitleDiv(error: any): HTMLDivElement {
.setTitle('Disable Rule')
.setIcon('ban')
.onClick(() => {
- error.disable();
+ error.disable?.();
});
});
}
@@ -168,7 +170,7 @@ function createTitleDiv(error: any): HTMLDivElement {
return titleDiv;
}
-function getWordsArroundError(error: any, editorView: any) {
+function getWordsArroundError(error: Diagnostic, editorView: EditorView) {
const doc = editorView.state.doc;
const problemText = doc.sliceString(error.from, error.to);
@@ -211,7 +213,7 @@ function getWordsArroundError(error: any, editorView: any) {
return textContainer;
}
-function getErrorActions(error: any, editorView: any): HTMLDivElement {
+function getErrorActions(error: Diagnostic, editorView: EditorView): HTMLDivElement {
if (error.actions && error.actions.length > 0) {
const actionConst = document.createElement('div');
actionConst.style.display = 'flex';
@@ -219,7 +221,7 @@ function getErrorActions(error: any, editorView: any): HTMLDivElement {
actionConst.style.gap = '6px';
actionConst.style.marginTop = '4px';
- error.actions.forEach((action: any) => {
+ error.actions.forEach((action) => {
const btn = document.createElement('button');
btn.textContent = action.name;
btn.title = action.title;
@@ -238,7 +240,7 @@ function getErrorActions(error: any, editorView: any): HTMLDivElement {
return document.createElement('div');
}
-function createErrorCard(error: any, editorView: any, listContainer: HTMLDivElement) {
+function createErrorCard(error: Diagnostic, editorView: EditorView, listContainer: HTMLDivElement) {
try {
const card = createCard();
diff --git a/packages/obsidian-plugin/src/State.ts b/packages/obsidian-plugin/src/State.ts
index ad2caa94c..268f3f470 100644
--- a/packages/obsidian-plugin/src/State.ts
+++ b/packages/obsidian-plugin/src/State.ts
@@ -3,8 +3,8 @@ import type { Lint, LintConfig, Linter, StructuredLintConfig, Suggestion } from
import { type Dialect, LocalLinter, SuggestionKind, WorkerLinter } from 'harper.js';
import { slimBinaryInlined } from 'harper.js/slimBinaryInlined';
import { minimatch } from 'minimatch';
-import type { MarkdownFileInfo, Workspace } from 'obsidian';
-import { linter } from './lint';
+import type { MarkdownFileInfo } from 'obsidian';
+import { type Action, linter } from './lint';
import { lintKindClass } from './lintKindColor';
export type Settings = {
@@ -28,7 +28,6 @@ export default class State {
private harper: Linter;
private saveData: (data: any) => Promise<void>;
private delay: number;
- private workspace: Workspace;
private onExtensionChange: () => void;
private ignoredGlobs?: string[];
private editorInfoField?: StateField<MarkdownFileInfo>;
@@ -145,7 +144,7 @@ export default class State {
lints.map((lint) => {
const span = lint.span();
- const actions = lint.suggestions().map((sug) => {
+ const actions: Action[] = lint.suggestions().map((sug): Action => {
return {
kind: 'suggestion' as const,
name:
@@ -220,6 +219,7 @@ export default class State {
severity: 'error',
markClass: `${lintKindClass(lint.lint_kind())} ${this.useWebStyleLints ? 'harper-web-style' : 'harper-squiggly-style'}`,
title: lint.lint_kind_pretty(),
+ message: lint.message(),
renderMessage: (_view) => {
const node = document.createElement('template');
node.innerHTML = lint.message_html();
@@ -395,12 +395,13 @@ export default class State {
}
}
-function suggestionToLabel(sug: Suggestion) {
- if (sug.kind() === SuggestionKind.Remove) {
- return 'Remove';
- } else if (sug.kind() === SuggestionKind.Replace) {
- return `Replace with “${sug.get_replacement_text()}”`;
- } else if (sug.kind() === SuggestionKind.InsertAfter) {
- return `Insert “${sug.get_replacement_text()}” after this.`;
+function suggestionToLabel(sug: Suggestion): string {
+ switch (sug.kind()) {
+ case SuggestionKind.Remove:
+ return 'Remove';
+ case SuggestionKind.Replace:
+ return `Replace with “${sug.get_replacement_text()}”`;
+ case SuggestionKind.InsertAfter:
+ return `Insert “${sug.get_replacement_text()}” after this.`;
}
}
diff --git a/packages/obsidian-plugin/src/index.ts b/packages/obsidian-plugin/src/index.ts
index 16d17866c..1484f9ade 100644
--- a/packages/obsidian-plugin/src/index.ts
+++ b/packages/obsidian-plugin/src/index.ts
@@ -58,6 +58,7 @@ export default class HarperPlugin extends Plugin {
return;
}
const leaf = this.app.workspace.getRightLeaf(false);
+ if (leaf == null) return;
await leaf.setViewState({
type: 'harper-sidebar-view',
active: true,
@@ -118,6 +119,9 @@ export default class HarperPlugin extends Plugin {
}
private setupStatusBar() {
+ const state = this.state;
+ if (state == null) return;
+
const statusBarItem: HTMLElement = this.addStatusBarItem();
statusBarItem.className += ' mod-clickable';
@@ -127,14 +131,14 @@ export default class HarperPlugin extends Plugin {
const logo = document.createElement('span');
logo.style.width = '24px';
- logo.innerHTML = this.state.hasEditorLinter() ? logoSvg : logoSvgDisabled;
+ logo.innerHTML = state.hasEditorLinter() ? logoSvg : logoSvgDisabled;
this.logo = logo;
button.appendChild(logo);
const dialect = document.createElement('span');
this.dialectSpan = dialect;
- this.state.getSettings().then((settings) => {
+ state.getSettings().then((settings) => {
const dialectNum = settings.dialect ?? Dialect.American;
this.updateStatusBar(dialectNum);
button.appendChild(dialect);
@@ -145,7 +149,7 @@ export default class HarperPlugin extends Plugin {
menu.addItem((item) =>
item
- .setTitle(`${this.state.hasEditorLinter() ? 'Disable' : 'Enable'} automatic checking`)
+ .setTitle(`${state.hasEditorLinter() ? 'Disable' : 'Enable'} automatic checking`)
.setIcon('documents')
.onClick(() => {
this.toggleAutoLint();
@@ -169,7 +173,7 @@ export default class HarperPlugin extends Plugin {
/** Preferred over directly calling `this.state.toggleAutoLint()` */
private toggleAutoLint() {
- this.state.toggleAutoLint();
+ this.state?.toggleAutoLint();
this.updateStatusBar();
}
@@ -181,7 +185,7 @@ export default class HarperPlugin extends Plugin {
});
} else {
await this.activateSidebarView();
- await this.state.reinitialize();
+ await this.state?.reinitialize();
}
}
@@ -292,17 +296,20 @@ export default class HarperPlugin extends Plugin {
/** Trigger the flow for ignoring all files in a document, including a confirmation modal. */
public async doIgnoreAllFlow() {
+ const state = this.state;
+ if (state == null) return;
+
const file = this.app.workspace.getActiveFile();
if (file != null) {
const text = await this.app.vault.read(file);
- const lints = await this.state.getLinter().lint(text);
+ const lints = await state.getLinter().lint(text);
const confirmation = confirm(
`Are you sure you want to ignore ${lints.length} errors from Harper?`,
);
if (confirmation) {
- await this.state.ignoreLints(text, lints);
+ await state.ignoreLints(text, lints);
}
} else {
new Notice('No file currently open.');
@@ -310,7 +317,7 @@ export default class HarperPlugin extends Plugin {
}
public updateStatusBar(dialect?: Dialect) {
- if (this.logo != null) {
+ if (this.logo != null && this.state != null) {
this.logo.innerHTML = this.state.hasEditorLinter() ? logoSvg : logoSvgDisabled;
}
if (typeof dialect !== 'undefined') {
diff --git a/packages/obsidian-plugin/src/lint.ts b/packages/obsidian-plugin/src/lint.ts
index f718bbf99..f88c86d40 100644
--- a/packages/obsidian-plugin/src/lint.ts
+++ b/packages/obsidian-plugin/src/lint.ts
@@ -300,7 +300,7 @@ export type LintSource = (
const lintPlugin = ViewPlugin.fromClass(
class {
lintTime: number;
- timeout = -1;
+ timeout: ReturnType<typeof setTimeout>;
set = true;
constructor(readonly view: EditorView) {
@@ -474,7 +474,7 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
'div',
{
class: 'cm-diagnosticIgnore',
- onclick: (e) => {
+ onclick: (e: MouseEvent) => {
e.preventDefault();
if (diagnostic.ignore) {
diagnostic.ignore();
@@ -488,7 +488,7 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
'div',
{
class: 'cm-diagnosticDisable',
- onclick: (e) => {
+ onclick: (e: MouseEvent) => {
e.preventDefault();
if (diagnostic.disable) {
diagnostic.disable();
diff --git a/packages/obsidian-plugin/src/obsidian.d.ts b/packages/obsidian-plugin/src/obsidian.d.ts
new file mode 100644
index 000000000..e65e00dab
--- /dev/null
+++ b/packages/obsidian-plugin/src/obsidian.d.ts
@@ -0,0 +1,14 @@
+import type { EditorView } from '@codemirror/view';
+import type { EventRef } from 'obsidian';
+import type { Diagnostic } from './lint';
+
+declare module 'obsidian' {
+ interface Workspace {
+ /** Harper's CodeMirror linter emits this event to update the sidebar. */
+ on(
+ name: 'harper:lint-updated',
+ callback: (diagnostics: readonly Diagnostic[], editorView: EditorView) => void,
+ ctx?: unknown,
+ ): EventRef;
+ }
+}
diff --git a/packages/obsidian-plugin/tsconfig.json b/packages/obsidian-plugin/tsconfig.json
new file mode 100644
index 000000000..fae5b37a5
--- /dev/null
+++ b/packages/obsidian-plugin/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "types": ["vite/client", "node", "vitest"]
+ },
+ "include": ["src", "vite.config.ts"]
+}
diff --git a/packages/obsidian-plugin/vite.config.ts b/packages/obsidian-plugin/vite.config.ts
index 78f75e3c9..151f2ec09 100644
--- a/packages/obsidian-plugin/vite.config.ts
+++ b/packages/obsidian-plugin/vite.config.ts
@@ -1,7 +1,7 @@
import { playwright } from '@vitest/browser-playwright';
import external from 'rollup-plugin-peer-deps-external';
import svg from 'rollup-plugin-svg-import';
-import { defineConfig } from 'vite';
+import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [svg({ stringify: true }), external()],
diff --git a/packages/wordpress-plugin/package.json b/packages/wordpress-plugin/package.json
index acd04a68f..9424a2018 100644
--- a/packages/wordpress-plugin/package.json
+++ b/packages/wordpress-plugin/package.json
@@ -6,11 +6,16 @@
"main": "build/index.js",
"scripts": {
"build": "wp-scripts build --webpack-copy-php",
+ "check": "tsc --noEmit",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "zip harper.zip build harper.php screenshot.png -r",
"start": "wp-scripts start --webpack-copy-php"
},
"devDependencies": {
+ "@types/lodash-es": "^4.17.12",
+ "@types/react": "^18.3.0",
+ "@types/react-dom": "^18.3.0",
+ "@types/wordpress__edit-post": "^8.4.2",
"@wordpress/scripts": "^30.9.0",
"@wp-now/wp-now": "^0.1.74",
"typescript": "catalog:"
@@ -20,6 +25,7 @@
"@wordpress/data": "^10.15.1",
"@wordpress/edit-post": "^8.16.0",
"@wordpress/editor": "^14.20.0",
+ "@wordpress/plugins": "^7.20.0",
"@wordpress/preferences-persistence": "^2.17.0",
"harper.js": "workspace:*",
"lodash-es": "^4.17.21",
diff --git a/packages/wordpress-plugin/src/harper/DataBlock.ts b/packages/wordpress-plugin/src/harper/DataBlock.ts
index 5938f3065..0dfb628a6 100644
--- a/packages/wordpress-plugin/src/harper/DataBlock.ts
+++ b/packages/wordpress-plugin/src/harper/DataBlock.ts
@@ -23,7 +23,10 @@ export default class DataBlock {
return containers.map(
(cont) =>
new RichText(cont, this, async (newContent: string) => {
- const { updateBlockAttributes } = dispatch('core/block-editor');
+ // Named Gutenberg stores do not expose their action types.
+ const { updateBlockAttributes } = dispatch('core/block-editor') as {
+ updateBlockAttributes(clientId: string, attributes: Record<string, string>): unknown;
+ };
const attributeName = cont.getAttribute('data-wp-block-attribute-key') ?? 'content';
@@ -36,6 +39,7 @@ export default class DataBlock {
public static getAllDataBlocks(): DataBlock[] {
const container = this.getContainer();
+ if (container === null) return [];
const targetNodes = [...getNodesFromQuerySelector(container, '[data-block]')];
@@ -61,11 +65,11 @@ export default class DataBlock {
});
}
- public static getContainer(): Element {
- const iframe = document.querySelector('iframe[name="editor-canvas"]');
- const iframeDocument = iframe?.contentDocument || iframe?.contentWindow.document;
- const container =
- iframeDocument?.body || document.querySelector('.edit-post-visual-editor > div');
- return container;
+ /** Find the current editor container, or return null while it loads or changes layouts. */
+ public static getContainer(): Element | null {
+ const iframe = document.querySelector<HTMLIFrameElement>('iframe[name="editor-canvas"]');
+ return (
+ iframe?.contentDocument?.body || document.querySelector('.edit-post-visual-editor > div')
+ );
}
}
diff --git a/packages/wordpress-plugin/src/harper/Highlighter.tsx b/packages/wordpress-plugin/src/harper/Highlighter.tsx
index 7ee63f9d5..eb6d0700d 100644
--- a/packages/wordpress-plugin/src/harper/Highlighter.tsx
+++ b/packages/wordpress-plugin/src/harper/Highlighter.tsx
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
-import type { LintBox } from './Box';
+import type { IgnorableLintBox } from './Box';
import type RichText from './RichText';
import SuggestionControl from './SuggestionControl';
@@ -13,15 +13,15 @@ export default function Highlighter({
lintBoxes,
richText,
}: {
- lintBoxes: LintBox[];
+ lintBoxes: IgnorableLintBox[];
richText: RichText;
}) {
// Disable browser spellchecking in favor of ours
useEffect(() => {
- richText.getTargetElement().spellcheck = false;
+ (richText.getTargetElement() as HTMLElement).spellcheck = false;
return () => {
- richText.getTargetElement().spellcheck = true;
+ (richText.getTargetElement() as HTMLElement).spellcheck = true;
};
}, [richText]);
diff --git a/packages/wordpress-plugin/src/harper/LintSettingRow.tsx b/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
index eed9e7520..beee36735 100644
--- a/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
+++ b/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
@@ -11,9 +11,9 @@ export default function LintSettingRow({
}: {
name: string;
description: string;
- value: boolean | undefined;
+ value: boolean | null;
defaultValue: boolean;
- setValue: (newValue: boolean | undefined) => void;
+ setValue: (newValue: boolean | null) => void;
}) {
const linter = useLinter();
diff --git a/packages/wordpress-plugin/src/harper/RichText.ts b/packages/wordpress-plugin/src/harper/RichText.ts
index 92eab4f35..f4c546b85 100644
--- a/packages/wordpress-plugin/src/harper/RichText.ts
+++ b/packages/wordpress-plugin/src/harper/RichText.ts
@@ -30,6 +30,9 @@ export default class RichText {
}
public computeLintBox(lint: Lint): LintBox[] {
+ const container = DataBlock.getContainer();
+ if (container === null) return [];
+
const text = this.targetElement.textContent;
const span = lint.span();
const range = getRangeForTextSpan(this.targetElement, span);
@@ -42,7 +45,6 @@ export default class RichText {
}
const targetRects = range.getClientRects();
- const container = DataBlock.getContainer();
const contRect = container.getBoundingClientRect();
const boxes: LintBox[] = [];
diff --git a/packages/wordpress-plugin/src/harper/SidebarControl.tsx b/packages/wordpress-plugin/src/harper/SidebarControl.tsx
index 75698bd7d..b58ac967c 100644
--- a/packages/wordpress-plugin/src/harper/SidebarControl.tsx
+++ b/packages/wordpress-plugin/src/harper/SidebarControl.tsx
@@ -6,15 +6,43 @@ import SidebarTabContainer from './SidebarTabContainer';
import useLintBoxes from './useLintBoxes';
export default function SidebarControl() {
- const documentContainer = useMemo<Element>(() => DataBlock.getContainer(), []);
+ const [documentContainer, setDocumentContainer] = useState<Element | null>(() =>
+ DataBlock.getContainer(),
+ );
- const [blocks, setBlocks] = useState<DataBlock[]>(DataBlock.getTerminalDataBlocks());
+ const [blocks, setBlocks] = useState<DataBlock[]>(() => DataBlock.getTerminalDataBlocks());
const updateBlocks = useCallback(() => setBlocks(DataBlock.getTerminalDataBlocks()), []);
- useEffect(updateBlocks, [updateBlocks]);
+ useEffect(() => {
+ /**
+ * Rediscover loaded or replaced editor containers. Iframe document mutations do not
+ * reach the parent observer, so iframe navigation also needs a captured load event.
+ */
+ function syncContainer() {
+ setDocumentContainer(DataBlock.getContainer());
+ }
+
+ const observer = new MutationObserver(syncContainer);
+ observer.observe(document.documentElement, {
+ childList: true,
+ subtree: true,
+ attributes: true,
+ attributeFilter: ['class', 'name'],
+ });
+ document.addEventListener('load', syncContainer, true);
+ syncContainer();
+
+ return () => {
+ observer.disconnect();
+ document.removeEventListener('load', syncContainer, true);
+ };
+ }, []);
useEffect(() => {
+ updateBlocks();
+ if (documentContainer === null) return;
+
const observer = new MutationObserver(updateBlocks);
observer.observe(documentContainer, {
diff --git a/packages/wordpress-plugin/src/harper/preferencesStoreTypes.ts b/packages/wordpress-plugin/src/harper/preferencesStoreTypes.ts
new file mode 100644
index 000000000..e544cdf20
--- /dev/null
+++ b/packages/wordpress-plugin/src/harper/preferencesStoreTypes.ts
@@ -0,0 +1,25 @@
+import type { Dialect, LintConfig } from 'harper.js';
+
+type HarperPreferences = {
+ dialect: Dialect;
+ lintConfig: LintConfig;
+ ignoredLints: string;
+ personalDictionary: string[];
+};
+
+/** Selector types for Harper's keys in Gutenberg's legacy named preferences store. */
+export type PreferencesSelectors = {
+ get<K extends keyof HarperPreferences>(
+ scope: 'harper-wp',
+ key: K,
+ ): HarperPreferences[K] | undefined;
+};
+
+/** Action types for Harper's keys in Gutenberg's legacy named preferences store. */
+export type PreferencesActions = {
+ set<K extends keyof HarperPreferences>(
+ scope: 'harper-wp',
+ key: K,
+ value: HarperPreferences[K],
+ ): void;
+};
diff --git a/packages/wordpress-plugin/src/harper/useDialect.ts b/packages/wordpress-plugin/src/harper/useDialect.ts
index bbb521846..45744c127 100644
--- a/packages/wordpress-plugin/src/harper/useDialect.ts
+++ b/packages/wordpress-plugin/src/harper/useDialect.ts
@@ -1,15 +1,19 @@
import { useDispatch, useSelect } from '@wordpress/data';
import { Dialect } from 'harper.js';
import { useCallback, useMemo } from 'react';
+import type { PreferencesActions, PreferencesSelectors } from './preferencesStoreTypes';
const KEY = 'dialect';
export default function useDialect(): [Dialect, (newState: Dialect) => void] {
- const dialect = useSelect((select) => select('core/preferences').get('harper-wp', KEY), []);
+ const dialect = useSelect(
+ (select) => (select('core/preferences') as PreferencesSelectors).get('harper-wp', KEY),
+ [],
+ );
- const { set } = useDispatch('core/preferences');
+ const { set } = useDispatch('core/preferences') as PreferencesActions;
- const setConfig = useCallback((newValue) => {
+ const setConfig = useCallback((newValue: Dialect) => {
set('harper-wp', KEY, newValue);
}, []);
diff --git a/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts b/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
index 4576134f9..5bdee6e87 100644
--- a/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
+++ b/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
@@ -2,35 +2,36 @@ import { useDispatch, useSelect } from '@wordpress/data';
import type { Lint } from 'harper.js';
import { useCallback } from 'react';
import { useLinter } from './LinterProvider';
+import type { PreferencesActions, PreferencesSelectors } from './preferencesStoreTypes';
const KEY = 'ignoredLints';
export default function useIgnoredLintState(): [string | undefined, (newState: string) => void] {
const ignoredLintState = useSelect(
- (select) => select('core/preferences').get('harper-wp', KEY),
+ (select) => (select('core/preferences') as PreferencesSelectors).get('harper-wp', KEY),
[],
);
- const { set } = useDispatch('core/preferences');
+ const { set } = useDispatch('core/preferences') as PreferencesActions;
const updateState = useCallback((newValue: string) => set('harper-wp', KEY, newValue), [set]);
return [ignoredLintState, updateState];
}
-/** Get a callback that adds a lint to the global ignored lint state. */
-export function useIgnoreLint(): (lint: Lint) => Promise<void> {
+/** Ignore a lint using the exact source text that produced its spans and context. */
+export function useIgnoreLint(): (source: string, lint: Lint) => Promise<void> {
const linter = useLinter();
const [ignoredLintState, setIgnoredLintState] = useIgnoredLintState();
- return async (lint) => {
+ return async (source, lint) => {
await linter.clearIgnoredLints();
if (ignoredLintState) {
await linter.importIgnoredLints(ignoredLintState);
}
- await linter.ignoreLint(lint);
+ await linter.ignoreLint(source, lint);
setIgnoredLintState(await linter.exportIgnoredLints());
};
}
diff --git a/packages/wordpress-plugin/src/harper/useLintBoxes.ts b/packages/wordpress-plugin/src/harper/useLintBoxes.ts
index 285a286ea..d7d278c74 100644
--- a/packages/wordpress-plugin/src/harper/useLintBoxes.ts
+++ b/packages/wordpress-plugin/src/harper/useLintBoxes.ts
@@ -8,6 +8,13 @@ import useIgnoredLintState, { useIgnoreLint } from './useIgnoredLintState';
import useLintConfig from './useLintConfig';
import usePersonalDictionary from './usePersonalDictionary';
+/** Keep lints paired with their target and original source, even if the editor changes. */
+type LintResult = {
+ target: Element;
+ source: string;
+ lints: Lint[];
+};
+
/**
* Lint given elements and return the resulting error targets.
* Provides a loading state as well.
@@ -22,7 +29,7 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
const ignoreLint = useIgnoreLint();
const [targetBoxes, setTargetBoxes] = useState<IgnorableLintBox[][]>([]);
- const [lints, setLints] = useState<Lint[][]>([]);
+ const [lintResults, setLintResults] = useState<LintResult[]>([]);
const [loading, setLoading] = useState(true);
const updateLints = useCallback(async () => {
@@ -46,17 +53,16 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
await linter.importIgnoredLints(ignoreState);
}
- // We assume that a given index always refers to the same rich text field.
const newLints = await Promise.all(
richTexts.map(async (richText) => {
- const contents = richText.getTextContent();
+ const source = richText.getTextContent();
- return await linter.lint(contents);
+ return { target: richText.getTargetElement(), source, lints: await linter.lint(source) };
}),
);
setLoading(false);
- setLints(newLints);
+ setLintResults(newLints);
}, [richTexts, linter, config, ignoreState, personalDictionary, dialect]);
useEffect(() => {
@@ -88,14 +94,22 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
let running = true;
function onFrame() {
- const lintBoxes = lints.map((lintForText, index) => {
- const richText = richTexts[index];
- return lintForText
+ if (!running) return;
+
+ const lintBoxes = richTexts.map((richText, index) => {
+ const result = lintResults[index];
+ if (
+ result?.target !== richText.getTargetElement() ||
+ result.source !== richText.getTextContent()
+ )
+ return [];
+
+ return result.lints
.flatMap((lint) => richText.computeLintBox(lint))
.map((box) => {
return {
...box,
- ignoreLint: () => ignoreLint(box.lint),
+ ignoreLint: () => ignoreLint(result.source, box.lint),
};
});
});
@@ -112,7 +126,7 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
return () => {
running = false;
};
- }, [lints, richTexts, ignoreLint]);
+ }, [lintResults, richTexts, ignoreLint]);
return [targetBoxes, loading];
}
diff --git a/packages/wordpress-plugin/src/harper/useLintConfig.ts b/packages/wordpress-plugin/src/harper/useLintConfig.ts
index c40d2eb6e..ef72ba18c 100644
--- a/packages/wordpress-plugin/src/harper/useLintConfig.ts
+++ b/packages/wordpress-plugin/src/harper/useLintConfig.ts
@@ -3,16 +3,20 @@ import type { LintConfig } from 'harper.js';
import { merge } from 'lodash-es';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useLinter } from './LinterProvider';
+import type { PreferencesActions, PreferencesSelectors } from './preferencesStoreTypes';
const KEY = 'lintConfig';
export default function useLintConfig(): [LintConfig, (newState: LintConfig) => void] {
const defaultConfig = useDefaultLintConfig();
- const lintConfig = useSelect((select) => select('core/preferences').get('harper-wp', KEY), []);
+ const lintConfig = useSelect(
+ (select) => (select('core/preferences') as PreferencesSelectors).get('harper-wp', KEY),
+ [],
+ );
- const { set } = useDispatch('core/preferences');
+ const { set } = useDispatch('core/preferences') as PreferencesActions;
- const setConfig = useCallback((newValue) => {
+ const setConfig = useCallback((newValue: LintConfig) => {
set('harper-wp', KEY, newValue);
}, []);
diff --git a/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts b/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
index c0563e400..70be99b1a 100644
--- a/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
+++ b/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
@@ -1,5 +1,6 @@
import { useDispatch, useSelect } from '@wordpress/data';
import { useCallback } from 'react';
+import type { PreferencesActions, PreferencesSelectors } from './preferencesStoreTypes';
const KEY = 'personalDictionary';
@@ -9,11 +10,11 @@ export default function usePersonalDictionary(): [
(updatedDictionary: string[]) => void,
] {
const personalDictionary = useSelect(
- (select) => select('core/preferences').get('harper-wp', KEY),
+ (select) => (select('core/preferences') as PreferencesSelectors).get('harper-wp', KEY),
[],
);
- const { set } = useDispatch('core/preferences');
+ const { set } = useDispatch('core/preferences') as PreferencesActions;
const updateState = useCallback(
(updatedDictionary: string[]) => set('harper-wp', KEY, updatedDictionary),
diff --git a/packages/wordpress-plugin/tsconfig.json b/packages/wordpress-plugin/tsconfig.json
new file mode 100644
index 000000000..6e3df873d
--- /dev/null
+++ b/packages/wordpress-plugin/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "jsx": "react-jsx",
+ "allowJs": true,
+ "checkJs": true,
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "resolveJsonModule": true
+ },
+ "include": ["src"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5bde27dc2..e35b1afb0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -444,10 +444,16 @@ importers:
version: 1.60.0
'@rollup/plugin-node-resolve':
specifier: ^16.0.0
- version: 16.0.1([email protected])
+ version: 16.0.1([email protected])
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
+ '@types/node':
+ specifier: 'catalog:'
+ version: 22.13.10
+ '@types/rollup-plugin-peer-deps-external':
+ specifier: ^2.2.6
+ version: 2.2.6([email protected])
'@vitest/browser':
specifier: ^4.0.16
@@ -457,12 +463,18 @@ importers:
obsidian:
specifier: ^1.7.2
version: 1.8.7(@codemirror/[email protected])(@codemirror/[email protected])
+ rollup:
+ specifier: 4.35.0
+ version: 4.35.0
rollup-plugin-peer-deps-external:
specifier: ^2.2.4
- version: 2.2.4([email protected])
+ version: 2.2.4([email protected])
rollup-plugin-svg-import:
specifier: ^3.0.0
- version: 3.0.0([email protected])
+ version: 3.0.0([email protected])
+ typescript:
+ specifier: 'catalog:'
+ version: 5.9.3
vite:
specifier: ^6.3.5
@@ -630,6 +642,9 @@ importers:
'@wordpress/editor':
specifier: ^14.20.0
+ '@wordpress/plugins':
+ specifier: ^7.20.0
'@wordpress/preferences-persistence':
specifier: ^2.17.0
version: 2.20.0
@@ -646,6 +661,18 @@ importers:
specifier: ^18.0.0
version: 18.3.1([email protected])
devDependencies:
+ '@types/lodash-es':
+ specifier: ^4.17.12
+ version: 4.17.12
+ '@types/react':
+ specifier: ^18.3.0
+ version: 18.3.18
+ '@types/react-dom':
+ specifier: ^18.3.0
+ version: 18.3.5(@types/[email protected])
+ '@types/wordpress__edit-post':
+ specifier: ^8.4.2
'@wordpress/scripts':
specifier: ^30.9.0
@@ -4320,6 +4347,11 @@ packages:
resolution: {integrity: sha512-+8OFb1RlB69dZT1laNDq+xDSGrPY/VYARSSTxSC/rMl8s9X+W4dr7gHmoKRR9yu20JU8gvp18g9SVxvouk7SiQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-rR0p2+VZ5+RTyTA+MemzE7RQs3vkGNsYsEZIl+RahwrJOtEDEg+a5RCnigSwPkBtu4H7dyVHXyUZfiZU2dwjdw==}
+ peerDependencies:
+ rollup: '*'
+
resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==}
@@ -4383,6 +4415,9 @@ packages:
resolution: {integrity: sha512-u6kMFSBM9HcoTpUXnL6mt2HSzftqb3JgYV6oxIgL2dl6sX6aCa5k6SOkzv5DuZjBTPUE/dJltKtwwuqrkZHpfw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-rH+ut+I4eedDTvwXnJOrH9jEyi+PhJZQ+KZ31k3BYb8Cmd1qdRK2hJ+kdZu0QJp4XP3HA0/Q6troqYfpkF8B+A==}
+
resolution: {integrity: sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==}
@@ -4863,6 +4898,13 @@ packages:
react: ^18.0.0
react-dom: ^18.0.0
+ '@wordpress/[email protected]':
+ resolution: {integrity: sha512-JaGcXYtFCvHqa62dtxMAMhu6afvefFOuwfUTNiLYg60CA4UDITt6gf+qhpvKNOzVg4qQRw10o/nryrOMoMAEEg==}
+ engines: {node: '>=18.12.0', npm: '>=8.19.2'}
+ peerDependencies:
+ react: ^18.0.0
+ react-dom: ^18.0.0
+
'@wordpress/[email protected]':
resolution: {integrity: sha512-kk9GxGnoGBqHz0S4gT2UJHQBwudE1AgTPOc3v3k72kZkDaT88ZayBd/4/gHsa659zImgrwXZ6SjQ6Nczt80Bgg==}
engines: {node: '>=18.12.0', npm: '>=8.19.2'}
@@ -15972,16 +16014,6 @@ snapshots:
optionalDependencies:
rollup: 4.35.0
- dependencies:
- '@rollup/pluginutils': 5.1.4([email protected])
- '@types/resolve': 1.20.2
- deepmerge: 4.3.1
- is-module: 1.0.0
- resolve: 1.22.10
- optionalDependencies:
- rollup: 4.53.3
-
dependencies:
'@rollup/pluginutils': 3.1.0([email protected])
@@ -17145,6 +17177,10 @@ snapshots:
'@types/[email protected]': {}
+ dependencies:
+ rollup: 4.35.0
+
'@types/[email protected]': {}
@@ -17219,6 +17255,25 @@ snapshots:
anymatch: 3.1.3
source-map: 0.6.1
+ dependencies:
+ '@types/react': 18.3.18
+ '@wordpress/components': 28.13.0(@emotion/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@wordpress/data': 10.20.0([email protected])
+ '@wordpress/element': 6.20.0
+ transitivePeerDependencies:
+ - '@babel/core'
+ - '@emotion/is-prop-valid'
+ - '@types/react-dom'
+ - bufferutil
+ - react
+ - react-dom
+ - supports-color
+ - utf-8-validate
+ - webpack
+ - webpack-virtual-modules
+
dependencies:
'@types/node': 22.13.10
@@ -18065,6 +18120,60 @@ snapshots:
- '@types/react-dom'
- supports-color
+ dependencies:
+ '@babel/runtime': 7.25.7
+ '@emotion/cache': 11.14.0
+ '@emotion/css': 11.13.5
+ '@emotion/react': 11.14.0(@types/[email protected])([email protected])
+ '@emotion/serialize': 1.3.3
+ '@emotion/styled': 11.14.0(@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
+ '@emotion/utils': 1.4.2
+ '@floating-ui/react-dom': 2.1.2([email protected]([email protected]))([email protected])
+ '@types/gradient-parser': 0.1.3
+ '@types/highlight-words-core': 1.2.1
+ '@use-gesture/react': 10.3.1([email protected])
+ '@wordpress/a11y': 4.20.0
+ '@wordpress/compose': 7.20.0([email protected])
+ '@wordpress/date': 5.20.0
+ '@wordpress/deprecated': 4.20.0
+ '@wordpress/dom': 4.20.0
+ '@wordpress/element': 6.20.0
+ '@wordpress/escape-html': 3.20.0
+ '@wordpress/hooks': 4.20.0
+ '@wordpress/html-entities': 4.20.0
+ '@wordpress/i18n': 5.20.0
+ '@wordpress/icons': 10.20.0([email protected])
+ '@wordpress/is-shallow-equal': 5.20.0
+ '@wordpress/keycodes': 4.20.0
+ '@wordpress/primitives': 4.20.0([email protected])
+ '@wordpress/private-apis': 1.20.0
+ '@wordpress/rich-text': 7.20.0([email protected])
+ '@wordpress/warning': 3.20.0
+ change-case: 4.1.2
+ clsx: 2.1.1
+ colord: 2.9.3
+ date-fns: 3.6.0
+ deepmerge: 4.3.1
+ fast-deep-equal: 3.1.3
+ gradient-parser: 0.1.5
+ highlight-words-core: 1.2.3
+ is-plain-object: 5.0.0
+ memize: 2.1.0
+ path-to-regexp: 6.3.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ remove-accents: 0.5.0
+ uuid: 9.0.1
+ transitivePeerDependencies:
+ - '@emotion/is-prop-valid'
+ - '@types/react'
+ - supports-color
+
dependencies:
@@ -25374,14 +25483,14 @@ snapshots:
globby: 10.0.1
is-plain-object: 3.0.1
dependencies:
- rollup: 4.53.3
+ rollup: 4.35.0
dependencies:
- '@rollup/pluginutils': 5.1.4([email protected])
- rollup: 4.53.3
+ '@rollup/pluginutils': 5.1.4([email protected])
+ rollup: 4.35.0
optionalDependencies: