@oniroproject/core 0.17.0 → 0.18.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 +11 -0
- package/dist/index.cjs +484 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +196 -2
- package/dist/index.d.ts +196 -2
- package/dist/index.js +468 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -392,6 +392,17 @@ Adapted in part from deveco-cli's `faultlog/` module (MIT); see `src/faultlog/NO
|
|
|
392
392
|
| `resolveApiSdk` / `installedApiLevels` / `getApiIndexCacheDir` | — | The SDK to read (`sdkDir`, else `<sdk home>/<api>`, else the enclosing project's `compileSdkVersion`, else the newest installed); the installed API levels; the `cacheDir` config key (default `~/.oniro/cache`). |
|
|
393
393
|
| `serializeApiIndex` / `deserializeApiIndex` / `apiIndexCachePath` / `parseDocBlock` / `mergeDocBlocks` | — | The compact stored form, the cache file of an SDK, and the doc-comment tag reader. |
|
|
394
394
|
|
|
395
|
+
### Documentation search
|
|
396
|
+
|
|
397
|
+
| Export | Signature | Description |
|
|
398
|
+
| --- | --- | --- |
|
|
399
|
+
| `syncDocs` | `(SyncDocsOptions) => Promise<SyncDocsResult>` | Clone or update one release of the OpenHarmony documentation (`oniro-app docs sync`): a partial (`--filter=blob:none`), depth-1, sparse clone of `en/application-dev` without its figures (about 100 MB), or on an existing clone a fetch of the branch head and a reset to it. Needs `git`. Returns `dir`, `ref`, `files`, `updated`, `commit`. |
|
|
400
|
+
| `docsRefFor` / `readSdkRelease` | `({ api?, version? }) => string` / `(sdkDir) => { api?, version? }` | The release branch for an SDK: from its version (`6.1.0.31` → `OpenHarmony-6.1-Release`, `5.1.0.107` → `OpenHarmony-5.1.0-Release`), else from the API level (18 → 5.1.0, 20 → 6.0, 23 → 6.1, 26 → 7.0), else `master`; and the SDK's `{ api, version }` from `ets/oh-uni-package.json`. |
|
|
401
|
+
| `getDocsRootDir` / `docsDirFor` / `docsTree` | — | The `docsDir` config key (default `<sdkRootDir>/docs`); `<docs root>/<ref>`; the `en/application-dev` tree of a clone, or null when it is not synced. |
|
|
402
|
+
| `DocsIndex.load` | `(tree) => DocsIndex` | The index of a tree, built on the first call of a process (titles, headings, an inverted word index over the words of each file and its path; identifiers also by their dotted parts and without a trailing API-level suffix) and kept; `DocsIndex.forget(tree)` after a sync. |
|
|
403
|
+
| `DocsIndex#search` | `(query, { limit?, section? }) => DocSearchResult` | Documents containing every query word (any when none does), scored by where the words occur (title, headings, path, body); the parts of camelCase and dotted identifiers count less and are not required; exact-title and whole-phrase bonuses; the API reference slightly, system-API pages and tables of contents strongly demoted. Each hit: `path`, `title`, `score`, the matching `headings` `[{ line, text }]`, `snippet`. |
|
|
404
|
+
| `DocsIndex#show` | `(path, { heading?, maxLines? }) => DocShowResult` | One document or one section (from the heading that matches, exactly else by substring, to the next of the same or a higher level), image lines and inline HTML dropped, cut at `maxLines` (default 250); `found: false` with `suggestions` (close paths, or the headings) on a miss. Paths stay inside the tree. |
|
|
405
|
+
|
|
395
406
|
### Tests
|
|
396
407
|
|
|
397
408
|
| Export | Signature | Description |
|