@rsbuild/plugin-preact 1.3.0-alpha.0 → 1.3.0-beta.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/README.md +1 -1
- package/dist/index.cjs +67 -65
- package/dist/index.js +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://rsbuild.dev" target="blank"><img src="https://
|
|
2
|
+
<a href="https://rsbuild.dev" target="blank"><img src="https://assets.rspack.dev/rsbuild/rsbuild-banner.png" alt="Rsbuild Logo" /></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# Rsbuild
|
package/dist/index.cjs
CHANGED
|
@@ -28,75 +28,77 @@ __webpack_require__.d = function(exports1, definition) {
|
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
var __webpack_exports__ = {};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
[
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
31
|
+
(()=>{
|
|
32
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
33
|
+
pluginPreact: ()=>pluginPreact,
|
|
34
|
+
PLUGIN_PREACT_NAME: ()=>PLUGIN_PREACT_NAME
|
|
35
|
+
});
|
|
36
|
+
let src_require = (0, require("node:module").createRequire)(__rslib_import_meta_url__), PLUGIN_PREACT_NAME = 'rsbuild:preact', pluginPreact = (userOptions = {})=>({
|
|
37
|
+
name: PLUGIN_PREACT_NAME,
|
|
38
|
+
setup (api) {
|
|
39
|
+
let options = {
|
|
40
|
+
include: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
|
|
41
|
+
exclude: /[\\/]node_modules[\\/]/,
|
|
42
|
+
prefreshEnabled: !0,
|
|
43
|
+
reactAliasesEnabled: !0,
|
|
44
|
+
...userOptions
|
|
45
|
+
};
|
|
46
|
+
'win32' === process.platform && (options.prefreshEnabled = !1), api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
|
|
47
|
+
let usePrefresh = 'development' === config.mode && options.prefreshEnabled && config.dev.hmr && 'web' === config.output.target, reactOptions = {
|
|
48
|
+
development: 'development' === config.mode,
|
|
49
|
+
refresh: usePrefresh,
|
|
50
|
+
runtime: 'automatic',
|
|
51
|
+
importSource: 'preact'
|
|
52
|
+
}, extraConfig = {
|
|
53
|
+
tools: {
|
|
54
|
+
swc: {
|
|
55
|
+
jsc: {
|
|
56
|
+
experimental: {
|
|
57
|
+
plugins: usePrefresh ? [
|
|
58
|
+
[
|
|
59
|
+
src_require.resolve('@swc/plugin-prefresh'),
|
|
60
|
+
{}
|
|
61
|
+
]
|
|
62
|
+
] : void 0
|
|
63
|
+
},
|
|
64
|
+
parser: {
|
|
65
|
+
syntax: "typescript",
|
|
66
|
+
tsx: !0
|
|
67
|
+
},
|
|
68
|
+
transform: {
|
|
69
|
+
react: reactOptions
|
|
70
|
+
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
};
|
|
75
|
+
return extraConfig.source ||= {}, extraConfig.resolve ||= {}, usePrefresh && (extraConfig.source.include = [
|
|
76
|
+
/node_modules[\\/]@prefresh[\\/](core|utils)/
|
|
77
|
+
]), options.reactAliasesEnabled && (extraConfig.resolve.alias = {
|
|
78
|
+
react: 'preact/compat',
|
|
79
|
+
'react-dom/test-utils': 'preact/test-utils',
|
|
80
|
+
'react-dom': 'preact/compat',
|
|
81
|
+
'react/jsx-runtime': 'preact/jsx-runtime'
|
|
82
|
+
}), mergeEnvironmentConfig(extraConfig, config);
|
|
83
|
+
}), api.modifyBundlerChain(async (chain, { isDev, target })=>{
|
|
84
|
+
let config = api.getNormalizedConfig();
|
|
85
|
+
if (!(isDev && options.prefreshEnabled && config.dev.hmr && 'web' === target)) return;
|
|
86
|
+
let { default: PreactRefreshPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@rspack/plugin-preact-refresh")), preactPath = src_require.resolve('preact', {
|
|
87
|
+
paths: [
|
|
88
|
+
api.context.rootPath
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
chain.plugin('preact-refresh').use(PreactRefreshPlugin, [
|
|
92
|
+
{
|
|
93
|
+
include: options.include,
|
|
94
|
+
exclude: options.exclude,
|
|
95
|
+
preactPath
|
|
96
|
+
}
|
|
97
|
+
]);
|
|
89
98
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
exclude: options.exclude,
|
|
94
|
-
preactPath
|
|
95
|
-
}
|
|
96
|
-
]);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
})();
|
|
100
102
|
var __webpack_export_target__ = exports;
|
|
101
103
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
102
104
|
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
let src_require = (0,
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
2
|
+
let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url), PLUGIN_PREACT_NAME = 'rsbuild:preact', pluginPreact = (userOptions = {})=>({
|
|
3
3
|
name: PLUGIN_PREACT_NAME,
|
|
4
4
|
setup (api) {
|
|
5
5
|
let options = {
|
|
@@ -28,7 +28,7 @@ let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(imp
|
|
|
28
28
|
] : void 0
|
|
29
29
|
},
|
|
30
30
|
parser: {
|
|
31
|
-
syntax:
|
|
31
|
+
syntax: "typescript",
|
|
32
32
|
tsx: !0
|
|
33
33
|
},
|
|
34
34
|
transform: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-preact",
|
|
3
|
-
"version": "1.3.0-
|
|
3
|
+
"version": "1.3.0-beta.1",
|
|
4
4
|
"description": "Preact plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"@prefresh/core": "^1.5.3",
|
|
26
26
|
"@prefresh/utils": "^1.2.0",
|
|
27
27
|
"@rspack/plugin-preact-refresh": "^1.1.2",
|
|
28
|
-
"@swc/plugin-prefresh": "^6.0.
|
|
28
|
+
"@swc/plugin-prefresh": "^6.0.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@rslib/core": "0.
|
|
32
|
-
"@types/node": "^22.10.
|
|
31
|
+
"@rslib/core": "0.3.1",
|
|
32
|
+
"@types/node": "^22.10.5",
|
|
33
33
|
"preact": "^10.25.4",
|
|
34
|
-
"typescript": "^5.7.
|
|
35
|
-
"@rsbuild/core": "1.2.0-
|
|
34
|
+
"typescript": "^5.7.3",
|
|
35
|
+
"@rsbuild/core": "1.2.0-beta.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@rsbuild/core": "1.x"
|