@rsbuild/plugin-preact 1.3.0-alpha.0 → 1.3.0-beta.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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://rsbuild.dev" target="blank"><img src="https://github.com/web-infra-dev/rsbuild/assets/7237365/84abc13e-b620-468f-a90b-dbf28e7e9427" alt="Rsbuild Logo" /></a>
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
- __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
32
- pluginPreact: ()=>pluginPreact,
33
- PLUGIN_PREACT_NAME: ()=>PLUGIN_PREACT_NAME
34
- });
35
- let external_node_module_namespaceObject = require("node:module"), src_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), PLUGIN_PREACT_NAME = 'rsbuild:preact', pluginPreact = (userOptions = {})=>({
36
- name: PLUGIN_PREACT_NAME,
37
- setup (api) {
38
- let options = {
39
- include: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
40
- exclude: /[\\/]node_modules[\\/]/,
41
- prefreshEnabled: !0,
42
- reactAliasesEnabled: !0,
43
- ...userOptions
44
- };
45
- 'win32' === process.platform && (options.prefreshEnabled = !1), api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
46
- let usePrefresh = 'development' === config.mode && options.prefreshEnabled && config.dev.hmr && 'web' === config.output.target, reactOptions = {
47
- development: 'development' === config.mode,
48
- refresh: usePrefresh,
49
- runtime: 'automatic',
50
- importSource: 'preact'
51
- }, extraConfig = {
52
- tools: {
53
- swc: {
54
- jsc: {
55
- experimental: {
56
- plugins: usePrefresh ? [
57
- [
58
- src_require.resolve('@swc/plugin-prefresh'),
59
- {}
60
- ]
61
- ] : void 0
62
- },
63
- parser: {
64
- syntax: 'typescript',
65
- tsx: !0
66
- },
67
- transform: {
68
- react: reactOptions
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
- return extraConfig.source ||= {}, extraConfig.resolve ||= {}, usePrefresh && (extraConfig.source.include = [
75
- /node_modules[\\/]@prefresh[\\/](core|utils)/
76
- ]), options.reactAliasesEnabled && (extraConfig.resolve.alias = {
77
- react: 'preact/compat',
78
- 'react-dom/test-utils': 'preact/test-utils',
79
- 'react-dom': 'preact/compat',
80
- 'react/jsx-runtime': 'preact/jsx-runtime'
81
- }), mergeEnvironmentConfig(extraConfig, config);
82
- }), api.modifyBundlerChain(async (chain, { isDev, target })=>{
83
- let config = api.getNormalizedConfig();
84
- if (!(isDev && options.prefreshEnabled && config.dev.hmr && 'web' === target)) return;
85
- let { default: PreactRefreshPlugin } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@rspack/plugin-preact-refresh")), preactPath = src_require.resolve('preact', {
86
- paths: [
87
- api.context.rootPath
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
- chain.plugin('preact-refresh').use(PreactRefreshPlugin, [
91
- {
92
- include: options.include,
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 __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
2
- let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url), PLUGIN_PREACT_NAME = 'rsbuild:preact', pluginPreact = (userOptions = {})=>({
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: 'typescript',
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-alpha.0",
3
+ "version": "1.3.0-beta.0",
4
4
  "description": "Preact plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,11 +28,11 @@
28
28
  "@swc/plugin-prefresh": "^6.0.2"
29
29
  },
30
30
  "devDependencies": {
31
- "@rslib/core": "0.2.2",
32
- "@types/node": "^22.10.2",
31
+ "@rslib/core": "0.3.0",
32
+ "@types/node": "^22.10.5",
33
33
  "preact": "^10.25.4",
34
34
  "typescript": "^5.7.2",
35
- "@rsbuild/core": "1.2.0-alpha.0"
35
+ "@rsbuild/core": "1.2.0-beta.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@rsbuild/core": "1.x"