obsidian-typings 5.22.0 → 5.24.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![NPM downloads](https://img.shields.io/npm/v/obsidian-typings?color=red&label=Version%3A&logo=npm&logoColor=white&labelColor=red)](https://www.npmjs.com/package/obsidian-typings)
4
4
  [![NPM downloads](https://img.shields.io/npm/dw/obsidian-typings?style=flat&label=Downloads)](https://www.npmjs.com/package/obsidian-typings)
5
- [![GitHub Repo stars](https://img.shields.io/github/stars/fevol/obsidian-typings?color=yellow&label=Stargazers%3A&logo=OpenTelemetry&logoColor=yellow)](https://github.com/Fevol/obsidian-typings/stargazers)
5
+ [![GitHub Repo stars](https://img.shields.io/github/stars/obsidian-typings/obsidian-typings?color=yellow&label=Stargazers%3A&logo=OpenTelemetry&logoColor=yellow)](https://github.com/obsidian-typings/obsidian-typings/stargazers)
6
6
 
7
7
  **Obsidian Typings** provides **TypeScript definitions** for Obsidian’s **undocumented and internal APIs**.
8
8
 
@@ -36,8 +36,8 @@ To make it easier to adapt to these differences, this package provides typings f
36
36
 
37
37
  Typings for each `Obsidian` version can be found in their own git branches: namely `release/obsidian-public/*` and `release/obsidian-catalyst/*`:
38
38
 
39
- - Latest `public` release: [`release/obsidian-public/1.12.7`](https://github.com/Fevol/obsidian-typings/tree/release/obsidian-public/1.12.7)
40
- - Latest `catalyst` release: [`release/obsidian-catalyst/1.12.6`](https://github.com/Fevol/obsidian-typings/tree/release/obsidian-catalyst/1.12.6)
39
+ - Latest `public` release: [`release/obsidian-public/1.12.7`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-public/1.12.7) | [`@obsidian-typings/obsidian-public-1.12.7`](https://www.npmjs.com/package/@obsidian-typings/obsidian-public-1.12.7)
40
+ - Latest `catalyst` release: [`release/obsidian-catalyst/1.12.6`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-catalyst/1.12.6) | [`@obsidian-typings/obsidian-catalyst-1.12.6`](https://www.npmjs.com/package/@obsidian-typings/obsidian-catalyst-1.12.6)
41
41
 
42
42
  Older versions of the package are available, but support for them is limited.
43
43
  In most cases, we recommend to always use the latest release.
@@ -47,28 +47,14 @@ In most cases, we recommend to always use the latest release.
47
47
  ### 1. Install via `npm`
48
48
 
49
49
  - Latest `public` release (recommended):
50
+ - `npm install --save-dev @obsidian-typings/obsidian-public-latest`
51
+ - Latest `catalyst` (`beta`) release:
52
+ - `npm install --save-dev @obsidian-typings/obsidian-catalyst-latest`
53
+ - Specific Obsidian version (should match `minAppVersion` in your plugin's `manifest.json`):
54
+ - `npm install --save-dev @obsidian-typings/obsidian-public-1.12.7`
55
+ - `npm install --save-dev @obsidian-typings/obsidian-catalyst-1.12.6`
56
+ - Legacy package name (alias for `@obsidian-typings/obsidian-public-latest`):
50
57
  - `npm install --save-dev obsidian-typings`
51
- - Explicitly install latest `public` release:
52
- - `npm pkg set "dependencies.obsidian-typings=obsidian-public-latest" && npm install`
53
- - Install the latest `catalyst` (`beta`) release:
54
- - `npm pkg set "dependencies.obsidian-typings=obsidian-catalyst-latest" && npm install`
55
- - Install a specific release (should match `minAppVersion` in your plugin's `manifest.json`):
56
- - `npm pkg set "dependencies.obsidian-typings=obsidian-public-1.8.10" && npm install`
57
- - `npm pkg set "dependencies.obsidian-typings=obsidian-catalyst-1.9.9" && npm install`
58
-
59
- > [!IMPORTANT]
60
- >
61
- > If you installed library using `npm pkg set` approach, you will have to update it using `npm update obsidian-typings` command.
62
- >
63
- > If you run `npm install obsidian-typings` instead, the most likely, the library will not get updated.
64
-
65
-  
66
-
67
- > [!WARNING]
68
- >
69
- > The package installs several libraries that trigger `npm audit` warnings.
70
- >
71
- > Those packages cannot be updated because they should match the exact versions Obsidian uses internally.
72
58
 
73
59
  <!-- markdownlint-disable MD033 -->
74
60
 
@@ -76,14 +62,14 @@ In most cases, we recommend to always use the latest release.
76
62
 
77
63
  <!-- markdownlint-enable MD033 -->
78
64
 
79
- Add `obsidian-typings` to the `types` array of your `tsconfig.json` to make all extended typings available globally without explicit importing them:
65
+ Add the package to the `types` array of your `tsconfig.json` to make all extended typings available globally without explicit importing them:
80
66
 
81
67
  ```json
82
68
  {
83
69
  "compilerOptions": {
84
70
  "...": "...",
85
71
  "types": [
86
- "obsidian-typings"
72
+ "@obsidian-typings/obsidian-public-latest"
87
73
  ]
88
74
  }
89
75
  }
@@ -91,14 +77,14 @@ Add `obsidian-typings` to the `types` array of your `tsconfig.json` to make all
91
77
 
92
78
  > [!WARNING]
93
79
  >
94
- > If other `@types/*` packages stop being recognized after adding `obsidian-typings` to the `types`, you may need to re-add them to the `types` list.
80
+ > If other `@types/*` packages stop being recognized after adding the typings to the `types`, you may need to re-add them to the `types` list.
95
81
  >
96
82
  > ```json
97
83
  > {
98
84
  > "compilerOptions": {
99
85
  > "...": "...",
100
86
  > "types": [
101
- > "obsidian-typings",
87
+ > "@obsidian-typings/obsidian-public-latest",
102
88
  > "some-package-name"
103
89
  > ]
104
90
  > }
@@ -106,10 +92,10 @@ Add `obsidian-typings` to the `types` array of your `tsconfig.json` to make all
106
92
 
107
93
  ### 3. Importing explicitly (alternative)
108
94
 
109
- Instead of adding `obsidian-typings` to your `types`, you can also import the package directly:
95
+ Instead of adding the package to your `types`, you can also import it directly:
110
96
 
111
97
  ```ts
112
- import type {} from 'obsidian-typings';
98
+ import type {} from '@obsidian-typings/obsidian-public-latest';
113
99
  ```
114
100
 
115
101
  ## Usage
@@ -126,33 +112,33 @@ function printInternalPlugins(app: App): void {
126
112
  }
127
113
  ```
128
114
 
129
- ### `obsidian-typings` additional interfaces
115
+ ### Additional interfaces
130
116
 
131
117
  Additional interfaces added by this package (which do not exist in the official API), can be imported as:
132
118
 
133
119
  ```ts
134
- import type { InternalPlugins } from 'obsidian-typings';
120
+ import type { InternalPlugins } from '@obsidian-typings/obsidian-public-latest';
135
121
 
136
122
  function getInternalPlugins(app: App): InternalPlugins {
137
123
  return app.internalPlugins;
138
124
  }
139
125
  ```
140
126
 
141
- ### `obsidian-typings/implementations`
127
+ ### Implementations
142
128
 
143
- Additional helper functions/types/... added by this package can be used by importing from `obsidian-typings/implementations`:
129
+ Additional helper functions/types/... added by this package can be used by importing from the `/implementations` subpath:
144
130
 
145
131
  ```ts
146
- import { InternalPluginName } from 'obsidian-typings/implementations';
132
+ import { InternalPluginName } from '@obsidian-typings/obsidian-public-latest/implementations';
147
133
 
148
134
  // If you forget the `/implementations` part:
149
- // import { InternalPluginName } from 'obsidian-typings';
135
+ // import { InternalPluginName } from '@obsidian-typings/obsidian-public-latest';
150
136
  // You will not be able to use the runtime values and the code below will not compile.
151
137
 
152
138
  this.app.internalPlugins.getEnabledPluginById(InternalPluginName.FileExplorer);
153
139
  ```
154
140
 
155
- The list of all available implementations can be found in the `src/obsidian/implementations` folder in the corresponding release branch ([example for `1.9.10 public`](https://github.com/Fevol/obsidian-typings/tree/release/obsidian-public/1.9.10/src/obsidian/implementations)).
141
+ The list of all available implementations can be found in the `src/obsidian/implementations` folder in the corresponding release branch ([example for `1.9.10 public`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-public/1.9.10/src/obsidian/implementations)).
156
142
 
157
143
  ### Extend with your own typings
158
144
 
@@ -160,7 +146,7 @@ If you need to extend the typings provided by this package, add the following to
160
146
 
161
147
  ```ts
162
148
  export {}; // This line is required. If there are no top-level `import/export` statements, your typings will work not as expected.
163
- declare module 'obsidian-typings' {
149
+ declare module '@obsidian-typings/obsidian-public-latest' {
164
150
  interface PluginsPluginsRecord {
165
151
  ['my-plugin-id']: MyPlugin;
166
152
  }
@@ -198,7 +184,7 @@ Always verify that your code behaves as expected, both in terms of types and run
198
184
 
199
185
  > [!TIP]
200
186
  >
201
- > If you find any issues with the typings or documentation, please feel free to [open an issue](https://github.com/Fevol/obsidian-typings/issues) or submit a pull request.
187
+ > If you find any issues with the typings or documentation, please feel free to [open an issue](https://github.com/obsidian-typings/obsidian-typings/issues) or submit a pull request.
202
188
 
203
189
  With these scary disclaimers out of the way, hopefully these typings will help you in removing 90% of the `@ts-ignore`/`@ts-expect-error` you have in your codebase, or discover solutions that didn't seem possible before.
204
190
 
@@ -211,10 +197,10 @@ With these scary disclaimers out of the way, hopefully these typings will help y
211
197
 
212
198
  ## Migration
213
199
 
214
- If you were using a `1.x.x` version of this package, see the [Migration guide](https://github.com/Fevol/obsidian-typings/blob/main/MIGRATION.md) for upgrading to `2.0.0` or newer.
200
+ If you were using a `1.x.x` version of this package, see the [Migration guide](https://github.com/obsidian-typings/obsidian-typings/blob/main/MIGRATION.md) for upgrading to `2.0.0` or newer.
215
201
 
216
202
  ## Contributing
217
203
 
218
204
  Feel free to start typing any part of the Obsidian API that is not yet typed, or fixing/adding additional descriptions to existing typings. If you are unsure about anything, don't hesitate to open an issue.
219
205
 
220
- A brief tutorial is available on how you can get started with adding new typings, or fixing existing ones, see: [CONTRIBUTING.md](https://github.com/Fevol/obsidian-typings/blob/main/CONTRIBUTING.md).
206
+ A brief tutorial is available on how you can get started with adding new typings, or fixing existing ones, see: [CONTRIBUTING.md](https://github.com/obsidian-typings/obsidian-typings/blob/main/CONTRIBUTING.md).
@@ -0,0 +1 @@
1
+ module.exports = require("@obsidian-typings/obsidian-public-latest/implementations");
@@ -0,0 +1 @@
1
+ export type * from "@obsidian-typings/obsidian-public-latest/implementations";
@@ -0,0 +1 @@
1
+ export type * from "@obsidian-typings/obsidian-public-latest/implementations";
@@ -0,0 +1 @@
1
+ export * from "@obsidian-typings/obsidian-public-latest/implementations";
package/package.json CHANGED
@@ -1,135 +1,32 @@
1
1
  {
2
- "name": "obsidian-typings",
3
- "version": "5.22.0",
4
- "description": "Extended type definitions for the Obsidian API (https://obsidian.md)",
5
- "keywords": [
6
- "obsdmd",
7
- "obsidian",
8
- "typings",
9
- "API"
10
- ],
11
- "homepage": "https://github.com/obsidian-typings/obsidian-typings#readme",
12
- "bugs": {
13
- "url": "https://github.com/obsidian-typings/obsidian-typings/issues"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/obsidian-typings/obsidian-typings.git"
2
+ "dependencies": {
3
+ "@obsidian-typings/obsidian-public-latest": "^5.24.0"
18
4
  },
19
- "license": "MIT",
20
- "author": {
21
- "name": "Fevol",
22
- "email": "fevolmail@gmail.com",
23
- "url": "https://github.com/fevol"
24
- },
25
- "contributors": [
26
- {
27
- "name": "Michael Naumov",
28
- "email": "mnaoumov@gmail.com",
29
- "url": "https://github.com/mnaoumov"
30
- }
31
- ],
32
- "type": "module",
5
+ "description": "TypeScript type definitions for Obsidian's internal/unofficial APIs. Wrapper for @obsidian-typings/obsidian-public-latest.",
33
6
  "exports": {
34
7
  ".": {
35
- "require": {
36
- "types": "./dist/cjs/types.d.cts"
37
- },
38
8
  "import": {
39
- "types": "./dist/esm/types.d.mts"
9
+ "types": "./types.d.mts"
10
+ },
11
+ "require": {
12
+ "types": "./types.d.cts"
40
13
  }
41
14
  },
42
15
  "./implementations": {
43
- "require": {
44
- "types": "./dist/cjs/implementations.d.cts",
45
- "default": "./dist/cjs/implementations.cjs"
46
- },
47
16
  "import": {
48
- "types": "./dist/esm/implementations.d.mts",
49
- "default": "./dist/esm/implementations.mjs"
17
+ "default": "./implementations.mjs",
18
+ "types": "./implementations.d.mts"
19
+ },
20
+ "require": {
21
+ "default": "./implementations.cjs",
22
+ "types": "./implementations.d.cts"
50
23
  }
51
24
  }
52
25
  },
26
+ "license": "MIT",
53
27
  "main": "",
54
- "module": "",
55
- "types": "./dist/cjs/types.d.cts",
56
- "files": [
57
- "dist/",
58
- "implementations/",
59
- "CHANGELOG.md",
60
- "LICENSE",
61
- "README.md",
62
- "package.json"
63
- ],
64
- "scripts": {
65
- "build": "jiti scripts/build.ts",
66
- "build:bundle-types": "jiti scripts/build-bundle-types.ts",
67
- "build:clean": "jiti scripts/build-clean.ts",
68
- "build:compile": "jiti scripts/build-compile.ts",
69
- "build:extract-api": "jiti scripts/build-extract-api.ts",
70
- "build:fix-bundle-types": "jiti scripts/build-fix-bundle-types.ts",
71
- "build:fix-implementations-bundle-types": "jiti scripts/build-fix-implementations-bundle-types.ts",
72
- "build:generate-index": "jiti scripts/build-generate-index.ts",
73
- "build:implementations": "jiti scripts/build-implementations.ts",
74
- "build:implementations:bundle-types": "jiti scripts/build-implementations-bundle-types.ts",
75
- "build:implementations:generate-types": "jiti scripts/build-implementations-generate-types.ts",
76
- "build:static": "jiti scripts/build-static.ts",
77
- "commit": "jiti scripts/commit.ts",
78
- "format": "jiti scripts/format.ts",
79
- "format:check": "jiti scripts/format-check.ts",
80
- "lint": "jiti scripts/lint.ts",
81
- "lint:fix": "jiti scripts/lint-fix.ts",
82
- "lint:md": "jiti scripts/lint-md.ts",
83
- "lint:md:fix": "jiti scripts/lint-md-fix.ts",
84
- "prepare": "jiti scripts/prepare.ts",
85
- "release": "jiti scripts/release.ts",
86
- "release:beta": "jiti scripts/release-beta.ts",
87
- "spellcheck": "jiti scripts/spellcheck.ts"
88
- },
89
- "overrides": {
90
- "eslint-plugin-import": "$eslint-plugin-import-x",
91
- "typescript": "$typescript"
92
- },
93
- "devDependencies": {
94
- "@commitlint/cli": "^21.0.1",
95
- "@commitlint/config-conventional": "^21.0.1",
96
- "@commitlint/types": "^21.0.1",
97
- "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
98
- "@eslint/compat": "^2.1.0",
99
- "@eslint/config-helpers": "^0.6.0",
100
- "@eslint/js": "^10.0.1",
101
- "@microsoft/api-extractor": "^7.58.7",
102
- "@stylistic/eslint-plugin": "^5.10.0",
103
- "@total-typescript/ts-reset": "^0.6.1",
104
- "@tsconfig/strictest": "^2.0.8",
105
- "@types/markdown-it": "^14.1.2",
106
- "@types/node": "^25.8.0",
107
- "@typescript-eslint/utils": "^8.59.3",
108
- "better-typescript-lib": "^2.12.0",
109
- "builtin-modules": "^5.2.0",
110
- "bun": "^1.3.14",
111
- "cspell": "^10.0.0",
112
- "czg": "^1.13.1",
113
- "dprint": "^0.54.0",
114
- "dts-bundle-generator": "^9.5.1",
115
- "esbuild": "^0.28.0",
116
- "eslint": "^10.4.0",
117
- "eslint-import-resolver-typescript": "^4.4.4",
118
- "eslint-plugin-import-x": "^4.16.2",
119
- "eslint-plugin-jsdoc": "^62.9.0",
120
- "eslint-plugin-perfectionist": "^5.9.0",
121
- "eslint-plugin-tsdoc": "^0.5.2",
122
- "husky": "^9.1.7",
123
- "jiti": "^2.7.0",
124
- "markdownlint": "^0.40.0",
125
- "markdownlint-cli2": "^0.22.1",
126
- "markdownlint-rule-relative-links": "^5.1.0",
127
- "nano-staged": "^1.0.2",
128
- "obsidian": "1.12.3",
129
- "semver": "^7.8.0",
130
- "ts-morph": "^28.0.0",
131
- "type-fest": "^5.6.0",
132
- "typescript": "^6.0.3",
133
- "typescript-eslint": "^8.59.3"
134
- }
28
+ "name": "obsidian-typings",
29
+ "type": "module",
30
+ "types": "./types.d.cts",
31
+ "version": "5.24.0"
135
32
  }
package/types.d.cts ADDED
@@ -0,0 +1 @@
1
+ export type * from "@obsidian-typings/obsidian-public-latest";
package/types.d.mts ADDED
@@ -0,0 +1 @@
1
+ export type * from "@obsidian-typings/obsidian-public-latest";
package/CHANGELOG.md DELETED
@@ -1,3 +0,0 @@
1
- # CHANGELOG
2
-
3
- See <https://github.com/obsidian-typings/obsidian-typings/blob/main/CHANGELOG.md>
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Fevol
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.