@rsbuild/plugin-solid 1.1.1 → 1.2.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/dist/index.cjs +39 -9
- package/dist/index.d.ts +25 -5
- package/dist/index.js +31 -4
- package/dist/types.d.ts +53 -68
- package/package.json +8 -10
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_require__ = {};
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get"), define(values, "value");
|
|
9
12
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
10
13
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
11
14
|
value: 'Module'
|
|
@@ -20,10 +23,24 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
20
23
|
});
|
|
21
24
|
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
25
|
function pluginSolid(options = {}) {
|
|
26
|
+
let { dev, solid, solidPresetOptions, ssr } = options;
|
|
23
27
|
return {
|
|
24
28
|
name: PLUGIN_SOLID_NAME,
|
|
25
29
|
setup (api) {
|
|
26
|
-
api.
|
|
30
|
+
api.modifyEnvironmentConfig((config)=>{
|
|
31
|
+
let conditionNames = config.resolve.conditionNames ?? [
|
|
32
|
+
'...'
|
|
33
|
+
], useDevRuntime = dev ?? 'development' === config.mode;
|
|
34
|
+
config.resolve.conditionNames = [
|
|
35
|
+
...new Set([
|
|
36
|
+
'solid',
|
|
37
|
+
...useDevRuntime ? [
|
|
38
|
+
'development'
|
|
39
|
+
] : [],
|
|
40
|
+
...conditionNames
|
|
41
|
+
])
|
|
42
|
+
];
|
|
43
|
+
}), api.modifyBundlerChain((chain, { CHAIN_ID, environment, isProd, target })=>{
|
|
27
44
|
let environmentConfig = environment.config;
|
|
28
45
|
(0, plugin_babel_namespaceObject.modifyBabelLoaderOptions)({
|
|
29
46
|
chain,
|
|
@@ -31,15 +48,28 @@ function pluginSolid(options = {}) {
|
|
|
31
48
|
modifier: (babelOptions)=>(babelOptions.presets = [
|
|
32
49
|
[
|
|
33
50
|
src_require.resolve('babel-preset-solid'),
|
|
34
|
-
|
|
51
|
+
{
|
|
52
|
+
...ssr ? 'node' === target ? {
|
|
53
|
+
generate: 'ssr',
|
|
54
|
+
hydratable: !0
|
|
55
|
+
} : {
|
|
56
|
+
generate: 'dom',
|
|
57
|
+
hydratable: !0
|
|
58
|
+
} : {},
|
|
59
|
+
...solidPresetOptions,
|
|
60
|
+
...solid
|
|
61
|
+
}
|
|
35
62
|
]
|
|
36
63
|
], babelOptions.parserOpts = {
|
|
37
64
|
plugins: [
|
|
38
65
|
'jsx',
|
|
39
66
|
"typescript"
|
|
40
67
|
]
|
|
41
|
-
}, !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
42
|
-
src_require.resolve('solid-refresh/babel')
|
|
68
|
+
}, options.refresh?.disabled !== !0 && !isProd && environmentConfig.dev.hmr && 'web' === target && (babelOptions.plugins ??= [], babelOptions.plugins.push([
|
|
69
|
+
src_require.resolve('solid-refresh/babel'),
|
|
70
|
+
{
|
|
71
|
+
bundler: 'rspack-esm'
|
|
72
|
+
}
|
|
43
73
|
]), chain.resolve.alias.set('solid-refresh', src_require.resolve('solid-refresh/dist/solid-refresh.mjs'))), babelOptions)
|
|
44
74
|
});
|
|
45
75
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,30 @@ import type { RsbuildPlugin } from '@rsbuild/core';
|
|
|
2
2
|
import type { SolidPresetOptions } from './types.js';
|
|
3
3
|
export type PluginSolidOptions = {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Whether to resolve Solid's development runtime.
|
|
6
|
+
* @default `true` in development mode, `false` in production mode
|
|
7
|
+
*/ dev?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to generate output for Solid SSR.
|
|
10
|
+
* @default false
|
|
11
|
+
*/ ssr?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Configure Solid Refresh for HMR in development mode.
|
|
14
|
+
*/ refresh?: {
|
|
15
|
+
/**
|
|
16
|
+
* Whether to disable Solid Refresh while keeping Rsbuild HMR enabled.
|
|
17
|
+
* @default false
|
|
18
|
+
*/ disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Options passed to `babel-preset-solid`.
|
|
22
|
+
* @see https://npmjs.com/package/babel-preset-solid
|
|
23
|
+
*/ solid?: SolidPresetOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Options passed to `babel-preset-solid`.
|
|
26
|
+
* If both `solid` and `solidPresetOptions` are set, `solid` takes precedence.
|
|
27
|
+
* @deprecated Use `solid` instead.
|
|
28
|
+
*/ solidPresetOptions?: SolidPresetOptions;
|
|
9
29
|
};
|
|
10
|
-
export declare const PLUGIN_SOLID_NAME =
|
|
30
|
+
export declare const PLUGIN_SOLID_NAME = 'rsbuild:solid';
|
|
11
31
|
export declare function pluginSolid(options?: PluginSolidOptions): RsbuildPlugin;
|
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/dist/types.d.ts
CHANGED
|
@@ -4,86 +4,71 @@
|
|
|
4
4
|
* https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js
|
|
5
5
|
*
|
|
6
6
|
* https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions/README.md
|
|
7
|
-
*/
|
|
8
|
-
export type SolidPresetOptions = {
|
|
7
|
+
*/ export type SolidPresetOptions = {
|
|
9
8
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
moduleName?: string;
|
|
9
|
+
* The name of the runtime module to import the methods from.
|
|
10
|
+
*/ moduleName?: string;
|
|
13
11
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
generate?: 'ssr' | 'dom' | 'universal';
|
|
12
|
+
* The output mode of the compiler.
|
|
13
|
+
* Can be:
|
|
14
|
+
* - "dom" is standard output
|
|
15
|
+
* - "ssr" is for server side rendering of strings.
|
|
16
|
+
* - "universal" is for using custom renderers from solid-js/universal
|
|
17
|
+
*
|
|
18
|
+
* @default "dom"
|
|
19
|
+
*/ generate?: 'ssr' | 'dom' | 'universal';
|
|
23
20
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
hydratable?: boolean;
|
|
21
|
+
* Indicate whether the output should contain hydratable markers.
|
|
22
|
+
* @default false
|
|
23
|
+
*/ hydratable?: boolean;
|
|
28
24
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
delegateEvents?: boolean;
|
|
25
|
+
* Boolean to indicate whether to enable automatic event delegation on camelCase.
|
|
26
|
+
* @default true
|
|
27
|
+
*/ delegateEvents?: boolean;
|
|
33
28
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
wrapConditionals?: boolean;
|
|
29
|
+
* Boolean indicates whether smart conditional detection should be used. This optimizes simple boolean expressions and ternaries in JSX.
|
|
30
|
+
* @default true
|
|
31
|
+
*/ wrapConditionals?: boolean;
|
|
38
32
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
contextToCustomElements?: boolean;
|
|
33
|
+
* Boolean indicates whether to set current render context on Custom Elements and slots. Useful for seamless Context API with Web Components.
|
|
34
|
+
* @default false
|
|
35
|
+
*/ contextToCustomElements?: boolean;
|
|
43
36
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
builtIns?: string[];
|
|
37
|
+
* Array of Component exports from module, that aren't included by default with the library. This plugin will automatically import them if it comes across them in the JSX.
|
|
38
|
+
* @default string[]
|
|
39
|
+
*/ builtIns?: string[];
|
|
48
40
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
effectWrapper?: string;
|
|
41
|
+
* This plugin leverages a heuristic for reactive wrapping and lazy evaluation of JSX expressions.
|
|
42
|
+
* @default 'effect'
|
|
43
|
+
*/ effectWrapper?: string;
|
|
53
44
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
staticMarker?: string;
|
|
45
|
+
* Comment decorator string indicates the static expression, used to tell the compiler not to wrap them by effect function
|
|
46
|
+
* @default '@once'
|
|
47
|
+
*/ staticMarker?: string;
|
|
58
48
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
memoWrapper?: string;
|
|
49
|
+
* Memos let you efficiently use a derived value in many reactive computations. This option indicates the memo function name
|
|
50
|
+
* @default 'memo'
|
|
51
|
+
*/ memoWrapper?: string;
|
|
63
52
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
validate?: boolean;
|
|
53
|
+
* Checks for properly formed HTML by checking for elements that would not be allowed in certain parent elements.
|
|
54
|
+
* @default true
|
|
55
|
+
*/ validate?: boolean;
|
|
68
56
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
omitNestedClosingTags?: boolean;
|
|
57
|
+
* Remove unnecessary closing tags from template strings. More info here:
|
|
58
|
+
* https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/ omitNestedClosingTags?: boolean;
|
|
75
62
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
omitLastClosingTag?: boolean;
|
|
63
|
+
* Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.
|
|
64
|
+
* Can be disabled for compatibility for some browser-like environments.
|
|
65
|
+
*
|
|
66
|
+
* @default true
|
|
67
|
+
*/ omitLastClosingTag?: boolean;
|
|
82
68
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
omitQuotes?: boolean;
|
|
69
|
+
* Remove unnecessary quotes from template strings.
|
|
70
|
+
* Can be disabled for compatibility for some browser-like environments.
|
|
71
|
+
*
|
|
72
|
+
* @default true
|
|
73
|
+
*/ omitQuotes?: boolean;
|
|
89
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-solid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Solid plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"repository": {
|
|
@@ -17,21 +17,20 @@
|
|
|
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": "^1.9.
|
|
25
|
+
"babel-preset-solid": "^1.9.12",
|
|
27
26
|
"solid-refresh": "^0.7.8",
|
|
28
|
-
"@rsbuild/plugin-babel": "1.1
|
|
27
|
+
"@rsbuild/plugin-babel": "1.2.1"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@rslib/core": "0.
|
|
30
|
+
"@rslib/core": "0.22.0",
|
|
32
31
|
"@types/babel__core": "^7.20.5",
|
|
33
|
-
"typescript": "^
|
|
34
|
-
"@rsbuild/core": "2.0.
|
|
32
|
+
"typescript": "^6.0.3",
|
|
33
|
+
"@rsbuild/core": "2.0.9",
|
|
35
34
|
"@scripts/test-helper": "1.0.0"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
@@ -47,8 +46,7 @@
|
|
|
47
46
|
"registry": "https://registry.npmjs.org/"
|
|
48
47
|
},
|
|
49
48
|
"scripts": {
|
|
50
|
-
"build": "rslib
|
|
51
|
-
"dev": "rslib
|
|
52
|
-
"bump": "pnpx bumpp --no-tag"
|
|
49
|
+
"build": "rslib",
|
|
50
|
+
"dev": "rslib -w"
|
|
53
51
|
}
|
|
54
52
|
}
|