@rspress/shared 0.0.9 → 0.0.11
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.ts +60 -5
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +64 -0
- package/dist/logger.mjs +29 -0
- package/package.json +19 -5
package/dist/index.d.ts
CHANGED
@@ -2,6 +2,52 @@ import { BuilderConfig } from '@modern-js/builder-rspack-provider';
|
|
2
2
|
import { PluggableList } from 'unified';
|
3
3
|
import { BuilderPlugin } from '@modern-js/builder';
|
4
4
|
|
5
|
+
interface ZoomOptions {
|
6
|
+
/**
|
7
|
+
* The space outside the zoomed image.
|
8
|
+
*
|
9
|
+
* @default 0
|
10
|
+
*/
|
11
|
+
margin?: number
|
12
|
+
|
13
|
+
/**
|
14
|
+
* The background of the overlay.
|
15
|
+
*
|
16
|
+
* @default '#fff'
|
17
|
+
*/
|
18
|
+
background?: string
|
19
|
+
|
20
|
+
/**
|
21
|
+
* The number of pixels to scroll to close the zoom.
|
22
|
+
*
|
23
|
+
* @default 40
|
24
|
+
*/
|
25
|
+
scrollOffset?: number
|
26
|
+
|
27
|
+
/**
|
28
|
+
* The viewport to render the zoom in.
|
29
|
+
*
|
30
|
+
* @default null
|
31
|
+
*/
|
32
|
+
container?: string | HTMLElement | ZoomContainer
|
33
|
+
|
34
|
+
/**
|
35
|
+
* The template element to display on zoom.
|
36
|
+
*
|
37
|
+
* @default null
|
38
|
+
*/
|
39
|
+
template?: string | HTMLTemplateElement
|
40
|
+
}
|
41
|
+
|
42
|
+
interface ZoomContainer {
|
43
|
+
width?: number
|
44
|
+
height?: number
|
45
|
+
top?: number
|
46
|
+
bottom?: number
|
47
|
+
right?: number
|
48
|
+
left?: number
|
49
|
+
}
|
50
|
+
|
5
51
|
interface Config$1 {
|
6
52
|
/**
|
7
53
|
* Whether to enable dark mode.
|
@@ -105,7 +151,7 @@ interface LocaleConfig {
|
|
105
151
|
nextPageText?: string;
|
106
152
|
langRoutePrefix?: string;
|
107
153
|
}
|
108
|
-
type NavItem = NavItemWithLink | NavItemWithChildren;
|
154
|
+
type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
|
109
155
|
type NavItemWithLink = {
|
110
156
|
text: string;
|
111
157
|
link: string;
|
@@ -116,7 +162,15 @@ type NavItemWithLink = {
|
|
116
162
|
interface NavItemWithChildren {
|
117
163
|
text?: string;
|
118
164
|
tag?: string;
|
119
|
-
items:
|
165
|
+
items: NavItem[];
|
166
|
+
position?: 'left' | 'right';
|
167
|
+
}
|
168
|
+
interface NavItemWithLinkAndChildren {
|
169
|
+
text: string;
|
170
|
+
link: string;
|
171
|
+
items: NavItem[];
|
172
|
+
tag?: string;
|
173
|
+
activeMatch?: string;
|
120
174
|
position?: 'left' | 'right';
|
121
175
|
}
|
122
176
|
type Image = string | {
|
@@ -230,7 +284,7 @@ interface RspressPlugin {
|
|
230
284
|
/**
|
231
285
|
* Inject global components.
|
232
286
|
*/
|
233
|
-
globalUIComponents?: string[];
|
287
|
+
globalUIComponents?: (string | [string, object])[];
|
234
288
|
/**
|
235
289
|
* Modify doc config.
|
236
290
|
*/
|
@@ -381,7 +435,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
381
435
|
/**
|
382
436
|
* Global components
|
383
437
|
*/
|
384
|
-
globalUIComponents?: string[];
|
438
|
+
globalUIComponents?: (string | [string, object])[];
|
385
439
|
/**
|
386
440
|
* Global styles, is a Absolute path
|
387
441
|
*/
|
@@ -395,6 +449,7 @@ interface UserConfig<ThemeConfig = Config$1> {
|
|
395
449
|
*/
|
396
450
|
mediumZoom?: boolean | {
|
397
451
|
selector?: string;
|
452
|
+
options?: ZoomOptions;
|
398
453
|
};
|
399
454
|
/**
|
400
455
|
* Add some extra builder plugins
|
@@ -577,4 +632,4 @@ declare function removeBase(url: string, base: string): string;
|
|
577
632
|
declare function withoutHash(url: string): string;
|
578
633
|
declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
|
579
634
|
|
580
|
-
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, slash, withBase, withoutBase, withoutHash, withoutLang };
|
635
|
+
export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeLeadingSlash, removeTrailingSlash, replaceLang, slash, withBase, withoutBase, withoutHash, withoutLang };
|
package/dist/logger.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
declare const rspressMark: string;
|
2
|
+
interface Logger {
|
3
|
+
info: (msg: string) => void;
|
4
|
+
error: (msg: string) => void;
|
5
|
+
warn: (msg: string) => void;
|
6
|
+
success: (msg: string) => void;
|
7
|
+
debug: (msg: string) => void;
|
8
|
+
log: (msg: string) => void;
|
9
|
+
}
|
10
|
+
declare const logger: Logger;
|
11
|
+
|
12
|
+
export { Logger, logger, rspressMark };
|
package/dist/logger.js
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
|
29
|
+
// src/logger.ts
|
30
|
+
var logger_exports = {};
|
31
|
+
__export(logger_exports, {
|
32
|
+
logger: () => logger,
|
33
|
+
rspressMark: () => rspressMark
|
34
|
+
});
|
35
|
+
module.exports = __toCommonJS(logger_exports);
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
37
|
+
var rspressMark = import_chalk.default.cyan("[Rspress]");
|
38
|
+
var logger = {
|
39
|
+
info(msg) {
|
40
|
+
console.log(`${import_chalk.default.cyan.bold("[info]")} ${msg}`);
|
41
|
+
},
|
42
|
+
error(msg) {
|
43
|
+
console.log(`${import_chalk.default.red("[error]")} ${msg}`);
|
44
|
+
},
|
45
|
+
warn(msg) {
|
46
|
+
console.log(`${import_chalk.default.yellow("[warn]")} ${msg}`);
|
47
|
+
},
|
48
|
+
success(msg) {
|
49
|
+
console.log(`${import_chalk.default.green("[success]")} ${msg}`);
|
50
|
+
},
|
51
|
+
debug(msg) {
|
52
|
+
if (process.env.DEBUG) {
|
53
|
+
console.log(`${import_chalk.default.gray("[rspress:debug]")} ${msg}`);
|
54
|
+
}
|
55
|
+
},
|
56
|
+
log(msg) {
|
57
|
+
console.log(`${import_chalk.default.cyan("[rspress]")} ${msg}`);
|
58
|
+
}
|
59
|
+
};
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
61
|
+
0 && (module.exports = {
|
62
|
+
logger,
|
63
|
+
rspressMark
|
64
|
+
});
|
package/dist/logger.mjs
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
// src/logger.ts
|
2
|
+
import chalk from "chalk";
|
3
|
+
var rspressMark = chalk.cyan("[Rspress]");
|
4
|
+
var logger = {
|
5
|
+
info(msg) {
|
6
|
+
console.log(`${chalk.cyan.bold("[info]")} ${msg}`);
|
7
|
+
},
|
8
|
+
error(msg) {
|
9
|
+
console.log(`${chalk.red("[error]")} ${msg}`);
|
10
|
+
},
|
11
|
+
warn(msg) {
|
12
|
+
console.log(`${chalk.yellow("[warn]")} ${msg}`);
|
13
|
+
},
|
14
|
+
success(msg) {
|
15
|
+
console.log(`${chalk.green("[success]")} ${msg}`);
|
16
|
+
},
|
17
|
+
debug(msg) {
|
18
|
+
if (process.env.DEBUG) {
|
19
|
+
console.log(`${chalk.gray("[rspress:debug]")} ${msg}`);
|
20
|
+
}
|
21
|
+
},
|
22
|
+
log(msg) {
|
23
|
+
console.log(`${chalk.cyan("[rspress]")} ${msg}`);
|
24
|
+
}
|
25
|
+
};
|
26
|
+
export {
|
27
|
+
logger,
|
28
|
+
rspressMark
|
29
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/shared",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.11",
|
4
4
|
"types": "./dist/index.d.ts",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.mjs",
|
@@ -9,10 +9,23 @@
|
|
9
9
|
"url": "https://github.com/web-infra-dev/rspress",
|
10
10
|
"directory": "packages/shared"
|
11
11
|
},
|
12
|
+
"exports": {
|
13
|
+
".": {
|
14
|
+
"import": "./dist/index.mjs",
|
15
|
+
"require": "./dist/index.js",
|
16
|
+
"types": "./dist/index.d.ts"
|
17
|
+
},
|
18
|
+
"./logger": {
|
19
|
+
"import": "./dist/logger.mjs",
|
20
|
+
"require": "./dist/logger.js",
|
21
|
+
"types": "./dist/logger.d.ts"
|
22
|
+
}
|
23
|
+
},
|
12
24
|
"dependencies": {
|
13
|
-
"@modern-js/builder": "2.
|
14
|
-
"@modern-js/builder-rspack-provider": "2.
|
15
|
-
"unified": "10.1.2"
|
25
|
+
"@modern-js/builder": "2.34.0",
|
26
|
+
"@modern-js/builder-rspack-provider": "2.34.0",
|
27
|
+
"unified": "10.1.2",
|
28
|
+
"chalk": "4.1.2"
|
16
29
|
},
|
17
30
|
"devDependencies": {
|
18
31
|
"lodash-es": "^4.17.21",
|
@@ -25,7 +38,8 @@
|
|
25
38
|
"@types/rechoir": "^0.6.1",
|
26
39
|
"rimraf": "~3.0.2",
|
27
40
|
"ts-node": "^10.9.1",
|
28
|
-
"typescript": "~5.0.4"
|
41
|
+
"typescript": "~5.0.4",
|
42
|
+
"medium-zoom": "1.0.8"
|
29
43
|
},
|
30
44
|
"sideEffects": [],
|
31
45
|
"publishConfig": {
|