@rsbuild/plugin-preact 0.3.10 → 0.4.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.js CHANGED
@@ -23,11 +23,9 @@ __export(src_exports, {
23
23
  pluginPreact: () => pluginPreact
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
- var import_core = require("@rsbuild/core");
27
26
  var import_shared = require("@rsbuild/shared");
28
27
  var pluginPreact = (options = {}) => ({
29
28
  name: "rsbuild:preact",
30
- pre: [import_core.PLUGIN_SWC_NAME],
31
29
  setup(api) {
32
30
  const { reactAliasesEnabled = true } = options;
33
31
  api.modifyBundlerChain(async (chain, { isDev }) => {
@@ -46,14 +44,15 @@ var pluginPreact = (options = {}) => ({
46
44
  };
47
45
  (0, import_shared.modifySwcLoaderOptions)({
48
46
  chain,
49
- modifier: (options2) => {
50
- return (0, import_shared.deepmerge)(options2, {
51
- jsc: {
52
- transform: {
53
- react: reactOptions
54
- }
55
- }
56
- });
47
+ modifier: (opts) => {
48
+ var _a;
49
+ opts.jsc ?? (opts.jsc = {});
50
+ (_a = opts.jsc).transform ?? (_a.transform = {});
51
+ opts.jsc.transform.react = {
52
+ ...opts.jsc.transform.react,
53
+ ...reactOptions
54
+ };
55
+ return opts;
57
56
  }
58
57
  });
59
58
  });
package/dist/index.mjs CHANGED
@@ -7,14 +7,9 @@ import { fileURLToPath } from "url";
7
7
  import path from "path";
8
8
 
9
9
  // src/index.ts
10
- import { PLUGIN_SWC_NAME } from "@rsbuild/core";
11
- import {
12
- deepmerge,
13
- modifySwcLoaderOptions
14
- } from "@rsbuild/shared";
10
+ import { modifySwcLoaderOptions } from "@rsbuild/shared";
15
11
  var pluginPreact = (options = {}) => ({
16
12
  name: "rsbuild:preact",
17
- pre: [PLUGIN_SWC_NAME],
18
13
  setup(api) {
19
14
  const { reactAliasesEnabled = true } = options;
20
15
  api.modifyBundlerChain(async (chain, { isDev }) => {
@@ -33,14 +28,15 @@ var pluginPreact = (options = {}) => ({
33
28
  };
34
29
  modifySwcLoaderOptions({
35
30
  chain,
36
- modifier: (options2) => {
37
- return deepmerge(options2, {
38
- jsc: {
39
- transform: {
40
- react: reactOptions
41
- }
42
- }
43
- });
31
+ modifier: (opts) => {
32
+ var _a;
33
+ opts.jsc ?? (opts.jsc = {});
34
+ (_a = opts.jsc).transform ?? (_a.transform = {});
35
+ opts.jsc.transform.react = {
36
+ ...opts.jsc.transform.react,
37
+ ...reactOptions
38
+ };
39
+ return opts;
44
40
  }
45
41
  });
46
42
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-preact",
3
- "version": "0.3.10",
3
+ "version": "0.4.0",
4
4
  "description": "Preact plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,16 +22,16 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@rsbuild/shared": "0.3.10"
25
+ "@rsbuild/shared": "0.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "16.x",
29
29
  "typescript": "^5.3.0",
30
- "@rsbuild/core": "0.3.10",
31
- "@scripts/test-helper": "0.3.10"
30
+ "@rsbuild/core": "0.4.0",
31
+ "@scripts/test-helper": "0.4.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@rsbuild/core": "^0.3.10"
34
+ "@rsbuild/core": "^0.4.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public",