harper.js 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.49.1"
8
+ "packageVersion": "7.49.2"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harper.js",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Elijah Potter",
6
6
  "description": "The grammar checker for developers.",
@@ -22,13 +22,13 @@
22
22
  "devDependencies": {
23
23
  "@microsoft/api-documenter": "^7.26.5",
24
24
  "@microsoft/api-extractor": "^7.49.1",
25
- "@vitest/browser": "^2.1.8",
25
+ "@vitest/browser": "^3.0.5",
26
26
  "playwright": "^1.49.1",
27
- "typescript": "~5.6.2",
28
- "vite": "^5.4.12",
27
+ "typescript": "~5.7.3",
28
+ "vite": "^6.1.0",
29
29
  "vite-plugin-dts": "^4.5.0",
30
30
  "vite-plugin-virtual": "^0.3.0",
31
- "vitest": "^2.1.8",
31
+ "vitest": "^3.0.5",
32
32
  "wasm": "link:../../harper-wasm/pkg"
33
33
  },
34
34
  "main": "dist/harper.js",
@@ -0,0 +1,31 @@
1
+ import { bench } from 'vitest';
2
+ import LocalLinter from './LocalLinter';
3
+ import WorkerLinter from './WorkerLinter';
4
+
5
+ const linters = {
6
+ WorkerLinter: WorkerLinter,
7
+ LocalLinter: LocalLinter
8
+ };
9
+
10
+ for (const [linterName, Linter] of Object.entries(linters)) {
11
+ const linter = new Linter();
12
+
13
+ // Prime caches
14
+ linter.setup();
15
+
16
+ const defaultConfig = await linter.getDefaultLintConfig();
17
+ const emptyIgnoreState = await linter.exportIgnoredLints();
18
+
19
+ bench(`${linterName} set lint configuration`, async () => {
20
+ await linter.setLintConfig(defaultConfig);
21
+ });
22
+
23
+ bench(`${linterName} get lint configuration`, async () => {
24
+ await linter.getLintConfig();
25
+ });
26
+
27
+ bench(`${linterName} reset ignore state`, async () => {
28
+ await linter.clearIgnoredLints();
29
+ await linter.importIgnoredLints(emptyIgnoreState);
30
+ });
31
+ }
@@ -20,6 +20,9 @@ export default class LocalLinter implements Linter {
20
20
  async setup(): Promise<void> {
21
21
  await this.initialize();
22
22
  this.inner!.lint('', Language.Plain);
23
+
24
+ const exported = await this.exportIgnoredLints();
25
+ await this.importIgnoredLints(exported);
23
26
  }
24
27
 
25
28
  async lint(text: string, options?: LintOptions): Promise<Lint[]> {
@@ -1,5 +1,5 @@
1
1
  /** This module aims to define the communication protocol between the main thread and the worker.
2
- * Note that most of the complication here comes from the fact that we can't serialize function calls or referenced WebAssembly memory.*/
2
+ * Note that much of the complication here comes from the fact that we can't serialize function calls or referenced WebAssembly memory.*/
3
3
 
4
4
  import loadWasm from '../loadWasm';
5
5