@savvy-web/rspress-builder 0.12.0 → 1.0.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
|
@@ -17,19 +17,20 @@ pnpm add -D @savvy-web/rspress-builder
|
|
|
17
17
|
|
|
18
18
|
## Quick start
|
|
19
19
|
|
|
20
|
-
Add a `savvy.build.ts` to the plugin package root
|
|
20
|
+
Add a `savvy.build.ts` to the plugin package root and call `build()` — it derives `cwd` and `argv` from `process` and applies the `definePlugin` preset automatically:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
// savvy.build.ts
|
|
24
|
-
import {
|
|
24
|
+
import { build } from "@savvy-web/rspress-builder";
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
await build();
|
|
27
|
+
```
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
Pass options to tune the preset — for example, to bundle `@rspress/core` declarations into the output types or disable the runtime bundle for a plugin with no browser component:
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
```ts
|
|
32
|
+
await build({ dtsBundledPackages: ["@rspress/core"] });
|
|
33
|
+
await build({ runtime: false });
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
Wire the build targets into `package.json` scripts and run them with Node's native TypeScript support:
|
|
@@ -45,6 +46,8 @@ Wire the build targets into `package.json` scripts and run them with Node's nati
|
|
|
45
46
|
|
|
46
47
|
The plugin entry (`.`) builds for Node with `@rspress/core` externalized. The runtime entry (`./runtime`) builds for the browser, bundleless, with CSS modules enabled and React, `@rspress/core` and `@theme` externalized so RSPress provides them at site build time.
|
|
47
48
|
|
|
49
|
+
For advanced use, `definePlugin` and `runBuild` remain exported as primitives.
|
|
50
|
+
|
|
48
51
|
## Configuration
|
|
49
52
|
|
|
50
53
|
`definePlugin` keeps a small surface because RSPress plugins have a fixed shape:
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"declarationMap": false,
|
|
9
9
|
"emitDeclarationOnly": false,
|
|
10
10
|
"esModuleInterop": true,
|
|
11
|
+
"exactOptionalPropertyTypes": true,
|
|
11
12
|
"explainFiles": false,
|
|
12
13
|
"forceConsistentCasingInFileNames": true,
|
|
13
14
|
"incremental": true,
|
|
14
15
|
"isolatedDeclarations": false,
|
|
15
16
|
"isolatedModules": true,
|
|
16
|
-
"exactOptionalPropertyTypes": true,
|
|
17
17
|
"jsx": "preserve",
|
|
18
18
|
"lib": ["esnext"],
|
|
19
19
|
"module": "nodenext",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"target": "es2025",
|
|
29
29
|
"tsBuildInfoFile": "${configDir}/dist/.tsbuildinfo.lib",
|
|
30
30
|
"typeRoots": ["${configDir}/node_modules/@types", "${configDir}/types"],
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"types": ["node"],
|
|
32
|
+
"verbatimModuleSyntax": true
|
|
33
33
|
},
|
|
34
34
|
"exclude": ["${configDir}/node_modules", "${configDir}/dist/**/*"],
|
|
35
35
|
"include": [
|
package/index.d.ts
CHANGED
|
@@ -48,6 +48,14 @@ interface RspressPluginOptions {
|
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
50
|
declare function definePlugin(options?: RspressPluginOptions): BuildConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Front door for building an RSPress plugin. Applies the {@link definePlugin} preset
|
|
53
|
+
* and runs the build, deriving `cwd` and `argv` from `process.argv`. For advanced use,
|
|
54
|
+
* {@link definePlugin} and `runBuild` remain exported.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
declare function build(options?: RspressPluginOptions, overrides?: Partial<RunOptions>): Promise<void>;
|
|
51
59
|
//#endregion
|
|
52
|
-
export { RspressBundleOptions, RspressPluginOptions, type RunOptions, definePlugin, runBuild };
|
|
60
|
+
export { RspressBundleOptions, RspressPluginOptions, type RunOptions, build, definePlugin, runBuild };
|
|
53
61
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dirname } from "node:path";
|
|
1
2
|
import { defineBuild, runBuild } from "@savvy-web/bundler";
|
|
2
3
|
|
|
3
4
|
//#region src/index.ts
|
|
@@ -50,6 +51,20 @@ function definePlugin(options = {}) {
|
|
|
50
51
|
...overrides.length > 0 ? { overrides } : {}
|
|
51
52
|
});
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Front door for building an RSPress plugin. Applies the {@link definePlugin} preset
|
|
56
|
+
* and runs the build, deriving `cwd` and `argv` from `process.argv`. For advanced use,
|
|
57
|
+
* {@link definePlugin} and `runBuild` remain exported.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
async function build(options = {}, overrides = {}) {
|
|
62
|
+
return runBuild(definePlugin(options), {
|
|
63
|
+
cwd: process.argv[1] ? dirname(process.argv[1]) : process.cwd(),
|
|
64
|
+
argv: process.argv.slice(2),
|
|
65
|
+
...overrides
|
|
66
|
+
});
|
|
67
|
+
}
|
|
53
68
|
|
|
54
69
|
//#endregion
|
|
55
|
-
export { definePlugin, runBuild };
|
|
70
|
+
export { build, definePlugin, runBuild };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/rspress-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSPress plugin builder for the Silk Suite, built on @savvy-web/bundler",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/rspress-builder",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"types": "./index.d.ts",
|
|
25
25
|
"import": "./index.js"
|
|
26
26
|
},
|
|
27
|
-
"./rspress-env.d.ts": "./
|
|
28
|
-
"./tsconfig/ecma.json": "./
|
|
29
|
-
"./tsconfig/plugin.json": "./
|
|
27
|
+
"./rspress-env.d.ts": "./rspress-env.d.ts",
|
|
28
|
+
"./tsconfig/ecma.json": "./ecma.json",
|
|
29
|
+
"./tsconfig/plugin.json": "./tsconfig/plugin.json",
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@savvy-web/bundler": "0.
|
|
34
|
-
"@savvy-web/tsdown-plugins": "0.
|
|
33
|
+
"@savvy-web/bundler": "1.0.0",
|
|
34
|
+
"@savvy-web/tsdown-plugins": "1.0.0",
|
|
35
35
|
"@tsdown/css": "^0.22.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
File without changes
|
|
File without changes
|