@vuepress/plugin-shiki 2.0.0-beta.9 → 2.0.0-rc.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-present, Yuxi (Evan) You
3
+ Copyright (c) 2018-present, VuePress Community
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,3 +1,3 @@
1
- import { shikiPlugin } from './shikiPlugin';
2
- export * from './shikiPlugin';
1
+ import { shikiPlugin } from './shikiPlugin.js';
2
+ export * from './shikiPlugin.js';
3
3
  export default shikiPlugin;
package/lib/node/index.js CHANGED
@@ -1,15 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- const shikiPlugin_1 = require("./shikiPlugin");
14
- __exportStar(require("./shikiPlugin"), exports);
15
- exports.default = shikiPlugin_1.shikiPlugin;
1
+ import { shikiPlugin } from './shikiPlugin.js';
2
+ export * from './shikiPlugin.js';
3
+ export default shikiPlugin;
@@ -1,7 +1,34 @@
1
- import type { Plugin } from '@vuepress/core';
2
- import type { HighlighterOptions } from 'shiki';
1
+ import type { BundledLanguage, BundledTheme, LanguageInput, SpecialLanguage, StringLiteralUnion, ThemeRegistration, ThemeRegistrationRaw } from 'shikiji';
2
+ import type { Plugin } from 'vuepress/core';
3
+ export type ShikiLang = LanguageInput | StringLiteralUnion<BundledLanguage> | SpecialLanguage;
4
+ export type ShikiTheme = ThemeRegistration | ThemeRegistrationRaw | StringLiteralUnion<BundledTheme>;
3
5
  /**
4
6
  * Options of @vuepress/plugin-shiki
5
7
  */
6
- export declare type ShikiPluginOptions = Pick<HighlighterOptions, 'theme' | 'langs'>;
7
- export declare const shikiPlugin: Plugin<ShikiPluginOptions>;
8
+ export interface ShikiPluginOptions {
9
+ /**
10
+ * Languages to be loaded.
11
+ *
12
+ * Shikiji does not preload any languages to avoid extra overhead. So you need
13
+ * to specify the languages you want to use.
14
+ *
15
+ * @see https://shikiji.netlify.app/languages
16
+ */
17
+ langs?: ShikiLang[];
18
+ /**
19
+ * The single theme to use
20
+ *
21
+ * @see https://shikiji.netlify.app/themes
22
+ */
23
+ theme?: ShikiTheme;
24
+ /**
25
+ * The dark and light themes to use
26
+ *
27
+ * @see https://shikiji.netlify.app/themes
28
+ */
29
+ themes?: {
30
+ dark: ShikiTheme;
31
+ light: ShikiTheme;
32
+ };
33
+ }
34
+ export declare const shikiPlugin: ({ langs, theme, themes, }?: ShikiPluginOptions) => Plugin;
@@ -1,15 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shikiPlugin = void 0;
4
- const shiki_1 = require("shiki");
5
- const shikiPlugin = ({ theme = 'nord', langs = [], }) => ({
1
+ import { getHighlighter } from 'shikiji';
2
+ export const shikiPlugin = ({ langs, theme = 'nord', themes, } = {}) => ({
6
3
  name: '@vuepress/plugin-shiki',
7
- async extendsMarkdown(md) {
8
- const highlighter = await shiki_1.getHighlighter({
9
- theme,
4
+ extendsMarkdown: async (md) => {
5
+ const highlighter = await getHighlighter({
10
6
  langs,
7
+ themes: themes ? [themes.dark, themes.light] : [theme],
8
+ });
9
+ md.options.highlight = (code, lang) => highlighter.codeToHtml(code, {
10
+ lang,
11
+ ...(themes ? { themes } : { theme }),
11
12
  });
12
- md.options.highlight = (code, lang) => highlighter.codeToHtml(code, lang);
13
13
  },
14
14
  });
15
- exports.shikiPlugin = shikiPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/plugin-shiki",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0-rc.1",
4
4
  "description": "VuePress plugin - shiki",
5
5
  "keywords": [
6
6
  "vuepress-plugin",
@@ -11,16 +11,21 @@
11
11
  ],
12
12
  "homepage": "https://github.com/vuepress",
13
13
  "bugs": {
14
- "url": "https://github.com/vuepress/vuepress-next/issues"
14
+ "url": "https://github.com/vuepress/ecosystem/issues"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/vuepress/vuepress-next.git"
18
+ "url": "git+https://github.com/vuepress/ecosystem.git"
19
19
  },
20
20
  "license": "MIT",
21
21
  "author": "meteorlxy",
22
- "main": "lib/node/index.js",
23
- "types": "lib/node/index.d.ts",
22
+ "type": "module",
23
+ "exports": {
24
+ ".": "./lib/node/index.js",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "main": "./lib/node/index.js",
28
+ "types": "./lib/node/index.d.ts",
24
29
  "files": [
25
30
  "lib"
26
31
  ],
@@ -29,11 +34,13 @@
29
34
  "clean": "rimraf lib *.tsbuildinfo"
30
35
  },
31
36
  "dependencies": {
32
- "@vuepress/core": "2.0.0-beta.9",
33
- "shiki": "^0.9.3"
37
+ "shikiji": "^0.10.1"
38
+ },
39
+ "peerDependencies": {
40
+ "vuepress": "2.0.0-rc.2"
34
41
  },
35
42
  "publishConfig": {
36
43
  "access": "public"
37
44
  },
38
- "gitHead": "edccb16372fabcf160d45ae6207a871e66c81974"
45
+ "gitHead": "1de7fea6963c3dd6c89df21eca4accc2d31204a4"
39
46
  }
package/CHANGELOG.md DELETED
@@ -1,51 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [2.0.0-beta.9](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.8...v2.0.0-beta.9) (2021-04-21)
7
-
8
- **Note:** Version bump only for package @vuepress/plugin-shiki
9
-
10
-
11
-
12
-
13
-
14
- # [2.0.0-beta.8](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.7...v2.0.0-beta.8) (2021-04-11)
15
-
16
-
17
- ### Code Refactoring
18
-
19
- * normalize themes and plugins structure ([7781172](https://github.com/vuepress/vuepress-next/commit/77811722401bf1ed1fec44c64158ab0cd1ab3179))
20
-
21
-
22
- ### BREAKING CHANGES
23
-
24
- * client API that provided by plugins should be imported from `plugin-foo/lib/client`
25
-
26
-
27
-
28
-
29
-
30
- # [2.0.0-beta.7](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.6...v2.0.0-beta.7) (2021-04-09)
31
-
32
- **Note:** Version bump only for package @vuepress/plugin-shiki
33
-
34
-
35
-
36
-
37
-
38
- # [2.0.0-beta.6](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.5...v2.0.0-beta.6) (2021-03-26)
39
-
40
- **Note:** Version bump only for package @vuepress/plugin-shiki
41
-
42
-
43
-
44
-
45
-
46
- # [2.0.0-beta.5](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.4...v2.0.0-beta.5) (2021-03-26)
47
-
48
-
49
- ### Features
50
-
51
- * **plugin-shiki:** add shiki plugin ([66bbcbd](https://github.com/vuepress/vuepress-next/commit/66bbcbde497cca525fc585b4046b11784e8d61bc))