@savvy-web/rspress-builder 0.12.0 → 1.0.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 +21 -0
- package/README.md +10 -7
- package/{public/ecma.json → ecma.json} +3 -3
- package/index.d.ts +9 -1
- package/index.js +16 -1
- package/package.json +6 -6
- /package/{public/rspress-env.d.ts → rspress-env.d.ts} +0 -0
- /package/{public/tsconfig → tsconfig}/plugin.json +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Savvy Web Strategy, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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.1",
|
|
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.1",
|
|
34
|
+
"@savvy-web/tsdown-plugins": "1.0.1",
|
|
35
35
|
"@tsdown/css": "^0.22.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
File without changes
|
|
File without changes
|