@rsbuild/plugin-solid 0.7.10 → 1.0.0-alpha.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 +25 -23
- package/dist/index.d.ts +5 -76
- package/dist/index.js +28 -26
- package/dist/types.d.ts +68 -0
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -35,36 +35,38 @@ __export(src_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(src_exports);
|
|
37
37
|
var import_plugin_babel = require("@rsbuild/plugin-babel");
|
|
38
|
-
var import_shared = require("@rsbuild/shared");
|
|
39
38
|
var PLUGIN_SOLID_NAME = "rsbuild:solid";
|
|
40
39
|
function pluginSolid(options = {}) {
|
|
41
40
|
return {
|
|
42
41
|
name: PLUGIN_SOLID_NAME,
|
|
43
42
|
setup(api) {
|
|
44
|
-
api.modifyBundlerChain(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
babelOptions
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if ((0, import_shared.isUsingHMR)(rsbuildConfig, { isProd, target })) {
|
|
56
|
-
babelOptions.plugins ??= [];
|
|
57
|
-
babelOptions.plugins.push([
|
|
58
|
-
require.resolve("solid-refresh/babel")
|
|
43
|
+
api.modifyBundlerChain(
|
|
44
|
+
async (chain, { CHAIN_ID, environment, isProd, target }) => {
|
|
45
|
+
const environmentConfig = environment.config;
|
|
46
|
+
(0, import_plugin_babel.modifyBabelLoaderOptions)({
|
|
47
|
+
chain,
|
|
48
|
+
CHAIN_ID,
|
|
49
|
+
modifier: (babelOptions) => {
|
|
50
|
+
babelOptions.presets ??= [];
|
|
51
|
+
babelOptions.presets.push([
|
|
52
|
+
require.resolve("babel-preset-solid"),
|
|
53
|
+
options.solidPresetOptions || {}
|
|
59
54
|
]);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
const usingHMR = !isProd && environmentConfig.dev.hmr && target === "web";
|
|
56
|
+
if (usingHMR) {
|
|
57
|
+
babelOptions.plugins ??= [];
|
|
58
|
+
babelOptions.plugins.push([
|
|
59
|
+
require.resolve("solid-refresh/babel")
|
|
60
|
+
]);
|
|
61
|
+
chain.resolve.alias.merge({
|
|
62
|
+
"solid-refresh": require.resolve("solid-refresh/dist/solid-refresh.mjs")
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return babelOptions;
|
|
63
66
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
);
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
72
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,82 +1,11 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* babel-preset-solid options
|
|
5
|
-
*
|
|
6
|
-
* https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js
|
|
7
|
-
*
|
|
8
|
-
* https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions/README.md
|
|
9
|
-
*/
|
|
10
|
-
type SolidPresetOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* The name of the runtime module to import the methods from.
|
|
13
|
-
*/
|
|
14
|
-
moduleName?: string;
|
|
15
|
-
/**
|
|
16
|
-
* The output mode of the compiler. Can be "dom"(default), "ssr". "dom" is standard output. "ssr" is for server side rendering of strings.
|
|
17
|
-
* @default 'dom'
|
|
18
|
-
*/
|
|
19
|
-
generate?: 'dom' | 'ssr';
|
|
20
|
-
/**
|
|
21
|
-
* Indicate whether the output should contain hydratable markers.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
hydratable?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Boolean to indicate whether to enable automatic event delegation on camelCase.
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
delegateEvents?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Boolean indicates whether smart conditional detection should be used. This optimizes simple boolean expressions and ternaries in JSX.
|
|
32
|
-
* @default true
|
|
33
|
-
*/
|
|
34
|
-
wrapConditionals?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Boolean indicates whether to set current render context on Custom Elements and slots. Useful for seamless Context API with Web Components.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
contextToCustomElements?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* 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.
|
|
42
|
-
* @default string[]
|
|
43
|
-
*/
|
|
44
|
-
builtIns?: string[];
|
|
45
|
-
/**
|
|
46
|
-
* This plugin leverages a heuristic for reactive wrapping and lazy evaluation of JSX expressions.
|
|
47
|
-
* @default 'effect'
|
|
48
|
-
*/
|
|
49
|
-
effectWrapper?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Comment decorator string indicates the static expression, used to tell the compiler not to wrap them by effect function
|
|
52
|
-
* @default '@once'
|
|
53
|
-
*/
|
|
54
|
-
staticMarker?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Memos let you efficiently use a derived value in many reactive computations. This option indicates the memo function name
|
|
57
|
-
* @default 'memo'
|
|
58
|
-
*/
|
|
59
|
-
memoWrapper?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Checks for properly formed HTML by checking for elements that would not be allowed in certain parent elements.
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
validate?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Removes unnecessary closing tags from the template output.
|
|
67
|
-
* @default true
|
|
68
|
-
*/
|
|
69
|
-
omitNestedClosingTags?: boolean;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
type PluginSolidOptions = {
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { SolidPresetOptions } from './types';
|
|
3
|
+
export type PluginSolidOptions = {
|
|
73
4
|
/**
|
|
74
5
|
* Options passed to `babel-preset-solid`.
|
|
75
6
|
* @see https://www.npmjs.com/package/babel-preset-solid
|
|
76
7
|
*/
|
|
77
8
|
solidPresetOptions?: SolidPresetOptions;
|
|
78
9
|
};
|
|
79
|
-
declare const PLUGIN_SOLID_NAME = "rsbuild:solid";
|
|
80
|
-
declare function pluginSolid(options?: PluginSolidOptions): RsbuildPlugin;
|
|
81
|
-
|
|
82
|
-
export { PLUGIN_SOLID_NAME, type PluginSolidOptions, pluginSolid };
|
|
10
|
+
export declare const PLUGIN_SOLID_NAME = "rsbuild:solid";
|
|
11
|
+
export declare function pluginSolid(options?: PluginSolidOptions): RsbuildPlugin;
|
package/dist/index.js
CHANGED
|
@@ -9,44 +9,46 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
12
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.54.5_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
14
|
import path from "path";
|
|
15
15
|
|
|
16
16
|
// src/index.ts
|
|
17
17
|
import { modifyBabelLoaderOptions } from "@rsbuild/plugin-babel";
|
|
18
|
-
import { isUsingHMR } from "@rsbuild/shared";
|
|
19
18
|
var PLUGIN_SOLID_NAME = "rsbuild:solid";
|
|
20
19
|
function pluginSolid(options = {}) {
|
|
21
20
|
return {
|
|
22
21
|
name: PLUGIN_SOLID_NAME,
|
|
23
22
|
setup(api) {
|
|
24
|
-
api.modifyBundlerChain(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
babelOptions
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (isUsingHMR(rsbuildConfig, { isProd, target })) {
|
|
36
|
-
babelOptions.plugins ??= [];
|
|
37
|
-
babelOptions.plugins.push([
|
|
38
|
-
__require.resolve("solid-refresh/babel")
|
|
23
|
+
api.modifyBundlerChain(
|
|
24
|
+
async (chain, { CHAIN_ID, environment, isProd, target }) => {
|
|
25
|
+
const environmentConfig = environment.config;
|
|
26
|
+
modifyBabelLoaderOptions({
|
|
27
|
+
chain,
|
|
28
|
+
CHAIN_ID,
|
|
29
|
+
modifier: (babelOptions) => {
|
|
30
|
+
babelOptions.presets ??= [];
|
|
31
|
+
babelOptions.presets.push([
|
|
32
|
+
__require.resolve("babel-preset-solid"),
|
|
33
|
+
options.solidPresetOptions || {}
|
|
39
34
|
]);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
const usingHMR = !isProd && environmentConfig.dev.hmr && target === "web";
|
|
36
|
+
if (usingHMR) {
|
|
37
|
+
babelOptions.plugins ??= [];
|
|
38
|
+
babelOptions.plugins.push([
|
|
39
|
+
__require.resolve("solid-refresh/babel")
|
|
40
|
+
]);
|
|
41
|
+
chain.resolve.alias.merge({
|
|
42
|
+
"solid-refresh": __require.resolve(
|
|
43
|
+
"solid-refresh/dist/solid-refresh.mjs"
|
|
44
|
+
)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return babelOptions;
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
54
|
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* babel-preset-solid options
|
|
3
|
+
*
|
|
4
|
+
* https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js
|
|
5
|
+
*
|
|
6
|
+
* https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions/README.md
|
|
7
|
+
*/
|
|
8
|
+
export type SolidPresetOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* The name of the runtime module to import the methods from.
|
|
11
|
+
*/
|
|
12
|
+
moduleName?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The output mode of the compiler. Can be "dom"(default), "ssr". "dom" is standard output. "ssr" is for server side rendering of strings.
|
|
15
|
+
* @default 'dom'
|
|
16
|
+
*/
|
|
17
|
+
generate?: 'dom' | 'ssr';
|
|
18
|
+
/**
|
|
19
|
+
* Indicate whether the output should contain hydratable markers.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
hydratable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Boolean to indicate whether to enable automatic event delegation on camelCase.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
delegateEvents?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Boolean indicates whether smart conditional detection should be used. This optimizes simple boolean expressions and ternaries in JSX.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
wrapConditionals?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Boolean indicates whether to set current render context on Custom Elements and slots. Useful for seamless Context API with Web Components.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
contextToCustomElements?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 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.
|
|
40
|
+
* @default string[]
|
|
41
|
+
*/
|
|
42
|
+
builtIns?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* This plugin leverages a heuristic for reactive wrapping and lazy evaluation of JSX expressions.
|
|
45
|
+
* @default 'effect'
|
|
46
|
+
*/
|
|
47
|
+
effectWrapper?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Comment decorator string indicates the static expression, used to tell the compiler not to wrap them by effect function
|
|
50
|
+
* @default '@once'
|
|
51
|
+
*/
|
|
52
|
+
staticMarker?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Memos let you efficiently use a derived value in many reactive computations. This option indicates the memo function name
|
|
55
|
+
* @default 'memo'
|
|
56
|
+
*/
|
|
57
|
+
memoWrapper?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Checks for properly formed HTML by checking for elements that would not be allowed in certain parent elements.
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
validate?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Removes unnecessary closing tags from the template output.
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
omitNestedClosingTags?: boolean;
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "Solid plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -23,19 +23,18 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"babel-preset-solid": "^1.8.
|
|
26
|
+
"babel-preset-solid": "^1.8.18",
|
|
27
27
|
"solid-refresh": "0.6.3",
|
|
28
|
-
"@rsbuild/plugin-babel": "0.
|
|
29
|
-
"@rsbuild/shared": "0.7.10"
|
|
28
|
+
"@rsbuild/plugin-babel": "1.0.0-alpha.1"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@types/babel__core": "^7.20.5",
|
|
33
|
-
"typescript": "^5.
|
|
34
|
-
"@rsbuild/core": "0.
|
|
35
|
-
"@scripts/test-helper": "0.
|
|
32
|
+
"typescript": "^5.5.2",
|
|
33
|
+
"@rsbuild/core": "1.0.0-alpha.0",
|
|
34
|
+
"@scripts/test-helper": "1.0.0-alpha.1"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
|
-
"@rsbuild/core": "^0.
|
|
37
|
+
"@rsbuild/core": "^1.0.0-alpha.1"
|
|
39
38
|
},
|
|
40
39
|
"publishConfig": {
|
|
41
40
|
"access": "public",
|