@rsbuild/plugin-solid 1.1.1 → 2.0.0-alpha.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/dist/index.cjs +31 -4
- package/dist/index.d.ts +26 -0
- package/dist/index.js +31 -4
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -20,10 +20,24 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
20
20
|
});
|
|
21
21
|
const external_node_module_namespaceObject = require("node:module"), plugin_babel_namespaceObject = require("@rsbuild/plugin-babel"), src_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), PLUGIN_SOLID_NAME = 'rsbuild:solid';
|
|
22
22
|
function pluginSolid(options = {}) {
|
|
23
|
+
let { dev, solid, solidPresetOptions, ssr } = options;
|
|
23
24
|
return {
|
|
24
25
|
name: PLUGIN_SOLID_NAME,
|
|
25
26
|
setup (api) {
|
|
26
|
-
api.
|
|
27
|
+
api.modifyEnvironmentConfig((config)=>{
|
|
28
|
+
let conditionNames = config.resolve.conditionNames ?? [
|
|
29
|
+
'...'
|
|
30
|
+
], useDevRuntime = dev ?? 'development' === config.mode;
|
|
31
|
+
config.resolve.conditionNames = [
|
|
32
|
+
...new Set([
|
|
33
|
+
'solid',
|
|
34
|
+
...useDevRuntime ? [
|
|
35
|
+
'development'
|
|
36
|
+
] : [],
|
|
37
|
+
...conditionNames
|
|
38
|
+
])
|
|
39
|
+
];
|
|
40
|
+
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isProd, target })=>{
|
|
27
41
|
let environmentConfig = environment.config;
|
|
28
42
|
(0, plugin_babel_namespaceObject.modifyBabelLoaderOptions)({
|
|
29
43
|
chain,
|
|
@@ -31,15 +45,28 @@ function pluginSolid(options = {}) {
|
|
|
31
45
|
modifier: (babelOptions)=>(babelOptions.presets = [
|
|
32
46
|
[
|
|
33
47
|
src_require.resolve('babel-preset-solid'),
|
|
34
|
-
|
|
48
|
+
{
|
|
49
|
+
...ssr ? 'node' === target ? {
|
|
50
|
+
generate: 'ssr',
|
|
51
|
+
hydratable: !0
|
|
52
|
+
} : {
|
|
53
|
+
generate: 'dom',
|
|
54
|
+
hydratable: !0
|
|
55
|
+
} : {},
|
|
56
|
+
...solidPresetOptions,
|
|
57
|
+
...solid
|
|
58
|
+
}
|
|
35
59
|
]
|
|
36
60
|
], babelOptions.parserOpts = {
|
|
37
61
|
plugins: [
|
|
38
62
|
'jsx',
|
|
39
63
|
"typescript"
|
|
40
64
|
]
|
|
41
|
-
}, !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
42
|
-
src_require.resolve('solid-refresh/babel')
|
|
65
|
+
}, options.refresh?.disabled !== !0 && !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
66
|
+
src_require.resolve('solid-refresh/babel'),
|
|
67
|
+
{
|
|
68
|
+
bundler: 'rspack-esm'
|
|
69
|
+
}
|
|
43
70
|
]), chain.resolve.alias.set('solid-refresh', src_require.resolve('solid-refresh/dist/solid-refresh.mjs'))), babelOptions)
|
|
44
71
|
});
|
|
45
72
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
import type { SolidPresetOptions } from './types.js';
|
|
3
3
|
export type PluginSolidOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to resolve Solid's development runtime.
|
|
6
|
+
* @default `true` in development mode, `false` in production mode
|
|
7
|
+
*/
|
|
8
|
+
dev?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to generate output for Solid SSR.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
ssr?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Configure Solid Refresh for HMR in development mode.
|
|
16
|
+
*/
|
|
17
|
+
refresh?: {
|
|
18
|
+
/**
|
|
19
|
+
* Whether to disable Solid Refresh while keeping Rsbuild HMR enabled.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
4
24
|
/**
|
|
5
25
|
* Options passed to `babel-preset-solid`.
|
|
6
26
|
* @see https://npmjs.com/package/babel-preset-solid
|
|
7
27
|
*/
|
|
28
|
+
solid?: SolidPresetOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Options passed to `babel-preset-solid`.
|
|
31
|
+
* If both `solid` and `solidPresetOptions` are set, `solid` takes precedence.
|
|
32
|
+
* @deprecated Use `solid` instead.
|
|
33
|
+
*/
|
|
8
34
|
solidPresetOptions?: SolidPresetOptions;
|
|
9
35
|
};
|
|
10
36
|
export declare const PLUGIN_SOLID_NAME = "rsbuild:solid";
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,24 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { modifyBabelLoaderOptions } from "@rsbuild/plugin-babel";
|
|
3
3
|
let src_require = createRequire(import.meta.url), PLUGIN_SOLID_NAME = 'rsbuild:solid';
|
|
4
4
|
function pluginSolid(options = {}) {
|
|
5
|
+
let { dev, solid, solidPresetOptions, ssr } = options;
|
|
5
6
|
return {
|
|
6
7
|
name: PLUGIN_SOLID_NAME,
|
|
7
8
|
setup (api) {
|
|
8
|
-
api.
|
|
9
|
+
api.modifyEnvironmentConfig((config)=>{
|
|
10
|
+
let conditionNames = config.resolve.conditionNames ?? [
|
|
11
|
+
'...'
|
|
12
|
+
], useDevRuntime = dev ?? 'development' === config.mode;
|
|
13
|
+
config.resolve.conditionNames = [
|
|
14
|
+
...new Set([
|
|
15
|
+
'solid',
|
|
16
|
+
...useDevRuntime ? [
|
|
17
|
+
'development'
|
|
18
|
+
] : [],
|
|
19
|
+
...conditionNames
|
|
20
|
+
])
|
|
21
|
+
];
|
|
22
|
+
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isProd, target })=>{
|
|
9
23
|
let environmentConfig = environment.config;
|
|
10
24
|
modifyBabelLoaderOptions({
|
|
11
25
|
chain,
|
|
@@ -13,15 +27,28 @@ function pluginSolid(options = {}) {
|
|
|
13
27
|
modifier: (babelOptions)=>(babelOptions.presets = [
|
|
14
28
|
[
|
|
15
29
|
src_require.resolve('babel-preset-solid'),
|
|
16
|
-
|
|
30
|
+
{
|
|
31
|
+
...ssr ? 'node' === target ? {
|
|
32
|
+
generate: 'ssr',
|
|
33
|
+
hydratable: !0
|
|
34
|
+
} : {
|
|
35
|
+
generate: 'dom',
|
|
36
|
+
hydratable: !0
|
|
37
|
+
} : {},
|
|
38
|
+
...solidPresetOptions,
|
|
39
|
+
...solid
|
|
40
|
+
}
|
|
17
41
|
]
|
|
18
42
|
], babelOptions.parserOpts = {
|
|
19
43
|
plugins: [
|
|
20
44
|
'jsx',
|
|
21
45
|
"typescript"
|
|
22
46
|
]
|
|
23
|
-
}, !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
24
|
-
src_require.resolve('solid-refresh/babel')
|
|
47
|
+
}, options.refresh?.disabled !== !0 && !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
48
|
+
src_require.resolve('solid-refresh/babel'),
|
|
49
|
+
{
|
|
50
|
+
bundler: 'rspack-esm'
|
|
51
|
+
}
|
|
25
52
|
]), chain.resolve.alias.set('solid-refresh', src_require.resolve('solid-refresh/dist/solid-refresh.mjs'))), babelOptions)
|
|
26
53
|
});
|
|
27
54
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-solid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"description": "Solid plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"repository": {
|
|
@@ -17,25 +17,26 @@
|
|
|
17
17
|
"require": "./dist/index.cjs"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"main": "./dist/index.cjs",
|
|
21
20
|
"types": "./dist/index.d.ts",
|
|
22
21
|
"files": [
|
|
23
22
|
"dist"
|
|
24
23
|
],
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"babel-preset-solid": "
|
|
27
|
-
"solid-refresh": "
|
|
25
|
+
"babel-preset-solid": ">=2.0.0-beta.0 <2.0.0-experimental.0",
|
|
26
|
+
"solid-refresh": ">=0.8.0-next.7 < 0.8.0",
|
|
28
27
|
"@rsbuild/plugin-babel": "1.1.2"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@rslib/core": "0.
|
|
30
|
+
"@rslib/core": "0.21.3",
|
|
32
31
|
"@types/babel__core": "^7.20.5",
|
|
33
|
-
"typescript": "^
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
32
|
+
"typescript": "^6.0.3",
|
|
33
|
+
"@scripts/test-helper": "1.0.0",
|
|
34
|
+
"@rsbuild/core": "2.0.3"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
|
-
"@rsbuild/core": "^1.0.0 || ^2.0.0-0"
|
|
37
|
+
"@rsbuild/core": "^1.0.0 || ^2.0.0-0",
|
|
38
|
+
"@solidjs/web": ">=2.0.0-beta.0 <2.0.0-experimental.0",
|
|
39
|
+
"solid-js": ">=2.0.0-beta.0 <2.0.0-experimental.0"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
42
|
"@rsbuild/core": {
|
|
@@ -47,8 +48,7 @@
|
|
|
47
48
|
"registry": "https://registry.npmjs.org/"
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
|
-
"build": "rslib
|
|
51
|
-
"dev": "rslib
|
|
52
|
-
"bump": "pnpx bumpp --no-tag"
|
|
51
|
+
"build": "rslib",
|
|
52
|
+
"dev": "rslib -w"
|
|
53
53
|
}
|
|
54
54
|
}
|