@shikijs/core 2.0.0 → 2.0.2

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/dist/index.d.mts CHANGED
@@ -87,7 +87,7 @@ declare function createSingletonShorthands<L extends string, T extends string>(c
87
87
  *
88
88
  * @see http://shiki.style/guide/bundles#fine-grained-bundle
89
89
  */
90
- declare function createHighlighterCore(options?: HighlighterCoreOptions): Promise<HighlighterCore>;
90
+ declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
91
91
  /**
92
92
  * Create a Shiki core highlighter instance, with no languages or themes bundled.
93
93
  * Wasm and each language and theme must be loaded manually.
@@ -96,22 +96,22 @@ declare function createHighlighterCore(options?: HighlighterCoreOptions): Promis
96
96
  *
97
97
  * @see http://shiki.style/guide/bundles#fine-grained-bundle
98
98
  */
99
- declare function createHighlighterCoreSync(options?: HighlighterCoreOptions<true>): HighlighterCore;
100
- declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options?: Partial<HighlighterCoreOptions>) => Promise<HighlighterCore>;
101
- declare const getSingletonHighlighterCore: (options?: Partial<HighlighterCoreOptions>) => Promise<HighlighterCore>;
99
+ declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
100
+ declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
101
+ declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
102
102
  /**
103
103
  * @deprecated Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.
104
104
  */
105
- declare function getHighlighterCore(options?: HighlighterCoreOptions): Promise<HighlighterCore>;
105
+ declare function getHighlighterCore(options: HighlighterCoreOptions): Promise<HighlighterCore>;
106
106
 
107
107
  /**
108
108
  * Get the minimal shiki context for rendering.
109
109
  */
110
- declare function createShikiInternal(options?: HighlighterCoreOptions): Promise<ShikiInternal>;
110
+ declare function createShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
111
111
  /**
112
112
  * @deprecated Use `createShikiInternal` instead.
113
113
  */
114
- declare function getShikiInternal(options?: HighlighterCoreOptions): Promise<ShikiInternal>;
114
+ declare function getShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
115
115
 
116
116
  /**
117
117
  * Get the minimal shiki context for rendering.
package/dist/index.d.ts CHANGED
@@ -87,7 +87,7 @@ declare function createSingletonShorthands<L extends string, T extends string>(c
87
87
  *
88
88
  * @see http://shiki.style/guide/bundles#fine-grained-bundle
89
89
  */
90
- declare function createHighlighterCore(options?: HighlighterCoreOptions): Promise<HighlighterCore>;
90
+ declare function createHighlighterCore(options: HighlighterCoreOptions<false>): Promise<HighlighterCore>;
91
91
  /**
92
92
  * Create a Shiki core highlighter instance, with no languages or themes bundled.
93
93
  * Wasm and each language and theme must be loaded manually.
@@ -96,22 +96,22 @@ declare function createHighlighterCore(options?: HighlighterCoreOptions): Promis
96
96
  *
97
97
  * @see http://shiki.style/guide/bundles#fine-grained-bundle
98
98
  */
99
- declare function createHighlighterCoreSync(options?: HighlighterCoreOptions<true>): HighlighterCore;
100
- declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options?: Partial<HighlighterCoreOptions>) => Promise<HighlighterCore>;
101
- declare const getSingletonHighlighterCore: (options?: Partial<HighlighterCoreOptions>) => Promise<HighlighterCore>;
99
+ declare function createHighlighterCoreSync(options: HighlighterCoreOptions<true>): HighlighterCore;
100
+ declare function makeSingletonHighlighterCore(createHighlighter: typeof createHighlighterCore): (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
101
+ declare const getSingletonHighlighterCore: (options: HighlighterCoreOptions) => Promise<HighlighterCore>;
102
102
  /**
103
103
  * @deprecated Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.
104
104
  */
105
- declare function getHighlighterCore(options?: HighlighterCoreOptions): Promise<HighlighterCore>;
105
+ declare function getHighlighterCore(options: HighlighterCoreOptions): Promise<HighlighterCore>;
106
106
 
107
107
  /**
108
108
  * Get the minimal shiki context for rendering.
109
109
  */
110
- declare function createShikiInternal(options?: HighlighterCoreOptions): Promise<ShikiInternal>;
110
+ declare function createShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
111
111
  /**
112
112
  * @deprecated Use `createShikiInternal` instead.
113
113
  */
114
- declare function getShikiInternal(options?: HighlighterCoreOptions): Promise<ShikiInternal>;
114
+ declare function getShikiInternal(options: HighlighterCoreOptions): Promise<ShikiInternal>;
115
115
 
116
116
  /**
117
117
  * Get the minimal shiki context for rendering.
package/dist/index.mjs CHANGED
@@ -244,7 +244,7 @@ class GrammarState {
244
244
  lang: this.lang,
245
245
  theme: this.theme,
246
246
  themes: this.themes,
247
- scopes: this.scopes
247
+ scopes: this.getScopes()
248
248
  };
249
249
  }
250
250
  }
@@ -1771,10 +1771,13 @@ function createShikiInternalSync(options) {
1771
1771
  };
1772
1772
  }
1773
1773
 
1774
- async function createShikiInternal(options = {}) {
1774
+ async function createShikiInternal(options) {
1775
1775
  if (options.loadWasm) {
1776
1776
  warnDeprecated("`loadWasm` option is deprecated. Use `engine: createOnigurumaEngine(loadWasm)` instead.");
1777
1777
  }
1778
+ if (!options.engine) {
1779
+ throw new Error("`engine` option is required.");
1780
+ }
1778
1781
  const [
1779
1782
  themes,
1780
1783
  langs,
@@ -1792,12 +1795,12 @@ async function createShikiInternal(options = {}) {
1792
1795
  engine
1793
1796
  });
1794
1797
  }
1795
- function getShikiInternal(options = {}) {
1798
+ function getShikiInternal(options) {
1796
1799
  warnDeprecated("`getShikiInternal` is deprecated. Use `createShikiInternal` instead.");
1797
1800
  return createShikiInternal(options);
1798
1801
  }
1799
1802
 
1800
- async function createHighlighterCore(options = {}) {
1803
+ async function createHighlighterCore(options) {
1801
1804
  const internal = await createShikiInternal(options);
1802
1805
  return {
1803
1806
  getLastGrammarState: (...args) => getLastGrammarState(internal, ...args),
@@ -1810,7 +1813,7 @@ async function createHighlighterCore(options = {}) {
1810
1813
  getInternalContext: () => internal
1811
1814
  };
1812
1815
  }
1813
- function createHighlighterCoreSync(options = {}) {
1816
+ function createHighlighterCoreSync(options) {
1814
1817
  const internal = createShikiInternalSync(options);
1815
1818
  return {
1816
1819
  getLastGrammarState: (...args) => getLastGrammarState(internal, ...args),
@@ -1825,7 +1828,7 @@ function createHighlighterCoreSync(options = {}) {
1825
1828
  }
1826
1829
  function makeSingletonHighlighterCore(createHighlighter) {
1827
1830
  let _shiki;
1828
- async function getSingletonHighlighterCore2(options = {}) {
1831
+ async function getSingletonHighlighterCore2(options) {
1829
1832
  if (!_shiki) {
1830
1833
  _shiki = createHighlighter({
1831
1834
  ...options,
@@ -1845,7 +1848,7 @@ function makeSingletonHighlighterCore(createHighlighter) {
1845
1848
  return getSingletonHighlighterCore2;
1846
1849
  }
1847
1850
  const getSingletonHighlighterCore = /* @__PURE__ */ makeSingletonHighlighterCore(createHighlighterCore);
1848
- function getHighlighterCore(options = {}) {
1851
+ function getHighlighterCore(options) {
1849
1852
  warnDeprecated("`getHighlighterCore` is deprecated. Use `createHighlighterCore` or `getSingletonHighlighterCore` instead.");
1850
1853
  return createHighlighterCore(options);
1851
1854
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -63,9 +63,9 @@
63
63
  "@shikijs/vscode-textmate": "^10.0.1",
64
64
  "@types/hast": "^3.0.4",
65
65
  "hast-util-to-html": "^9.0.4",
66
- "@shikijs/engine-javascript": "2.0.0",
67
- "@shikijs/types": "2.0.0",
68
- "@shikijs/engine-oniguruma": "2.0.0"
66
+ "@shikijs/engine-javascript": "2.0.2",
67
+ "@shikijs/engine-oniguruma": "2.0.2",
68
+ "@shikijs/types": "2.0.2"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "unbuild",