@rsbuild/plugin-preact 1.0.1-rc.5 → 1.0.2

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 CHANGED
@@ -1,71 +1,89 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- PLUGIN_PREACT_NAME: () => PLUGIN_PREACT_NAME,
24
- pluginPreact: () => pluginPreact
2
+ // The require scope
3
+ var __webpack_require__ = {};
4
+ /************************************************************************/ // webpack/runtime/define_property_getters
5
+ (()=>{
6
+ __webpack_require__.d = function(exports1, definition) {
7
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
8
+ enumerable: true,
9
+ get: definition[key]
10
+ });
11
+ };
12
+ })();
13
+ // webpack/runtime/has_own_property
14
+ (()=>{
15
+ __webpack_require__.o = function(obj, prop) {
16
+ return Object.prototype.hasOwnProperty.call(obj, prop);
17
+ };
18
+ })();
19
+ // webpack/runtime/make_namespace_object
20
+ (()=>{
21
+ // define __esModule on exports
22
+ __webpack_require__.r = function(exports1) {
23
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
24
+ value: 'Module'
25
+ });
26
+ Object.defineProperty(exports1, '__esModule', {
27
+ value: true
28
+ });
29
+ };
30
+ })();
31
+ /************************************************************************/ var __webpack_exports__ = {};
32
+ __webpack_require__.r(__webpack_exports__);
33
+ __webpack_require__.d(__webpack_exports__, {
34
+ PLUGIN_PREACT_NAME: function() {
35
+ return PLUGIN_PREACT_NAME;
36
+ },
37
+ pluginPreact: function() {
38
+ return pluginPreact;
39
+ }
25
40
  });
26
- module.exports = __toCommonJS(src_exports);
27
- var PLUGIN_PREACT_NAME = "rsbuild:preact";
28
- var pluginPreact = (options = {}) => ({
29
- name: PLUGIN_PREACT_NAME,
30
- setup(api) {
31
- const { reactAliasesEnabled = true } = options;
32
- api.modifyEnvironmentConfig((userConfig, { mergeEnvironmentConfig }) => {
33
- const reactOptions = {
34
- development: userConfig.mode === "development",
35
- runtime: "automatic",
36
- importSource: "preact"
37
- };
38
- const extraConfig = {
39
- tools: {
40
- swc: {
41
- jsc: {
42
- parser: {
43
- syntax: "typescript",
44
- // enable supports for JSX/TSX compilation
45
- tsx: true
46
- },
47
- transform: {
48
- react: reactOptions
49
- }
50
- }
51
- }
41
+ const PLUGIN_PREACT_NAME = 'rsbuild:preact';
42
+ const pluginPreact = function() {
43
+ let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
44
+ return {
45
+ name: PLUGIN_PREACT_NAME,
46
+ setup (api) {
47
+ const { reactAliasesEnabled = true } = options;
48
+ api.modifyEnvironmentConfig((userConfig, param)=>{
49
+ let { mergeEnvironmentConfig } = param;
50
+ const reactOptions = {
51
+ development: 'development' === userConfig.mode,
52
+ runtime: 'automatic',
53
+ importSource: 'preact'
54
+ };
55
+ const extraConfig = {
56
+ tools: {
57
+ swc: {
58
+ jsc: {
59
+ parser: {
60
+ syntax: 'typescript',
61
+ // enable supports for JSX/TSX compilation
62
+ tsx: true
63
+ },
64
+ transform: {
65
+ react: reactOptions
66
+ }
67
+ }
68
+ }
69
+ }
70
+ };
71
+ if (reactAliasesEnabled) {
72
+ extraConfig.source ||= {};
73
+ extraConfig.source.alias = {
74
+ react: 'preact/compat',
75
+ 'react-dom/test-utils': 'preact/test-utils',
76
+ 'react-dom': 'preact/compat',
77
+ 'react/jsx-runtime': 'preact/jsx-runtime'
78
+ };
79
+ }
80
+ return mergeEnvironmentConfig(extraConfig, userConfig);
81
+ });
52
82
  }
53
- };
54
- if (reactAliasesEnabled) {
55
- extraConfig.source ||= {};
56
- extraConfig.source.alias = {
57
- react: "preact/compat",
58
- "react-dom/test-utils": "preact/test-utils",
59
- "react-dom": "preact/compat",
60
- "react/jsx-runtime": "preact/jsx-runtime"
61
- };
62
- }
63
- return mergeEnvironmentConfig(extraConfig, userConfig);
64
- });
65
- }
66
- });
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- PLUGIN_PREACT_NAME,
70
- pluginPreact
83
+ };
84
+ };
85
+ var __webpack_export_target__ = exports;
86
+ for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
87
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
88
+ value: true
71
89
  });
package/dist/index.js CHANGED
@@ -1,53 +1,45 @@
1
- import { createRequire } from 'module';
2
- var require = createRequire(import.meta['url']);
3
-
4
-
5
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.58.3_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
6
- import path from "path";
7
- import { fileURLToPath } from "url";
8
-
9
- // src/index.ts
10
- var PLUGIN_PREACT_NAME = "rsbuild:preact";
11
- var pluginPreact = (options = {}) => ({
12
- name: PLUGIN_PREACT_NAME,
13
- setup(api) {
14
- const { reactAliasesEnabled = true } = options;
15
- api.modifyEnvironmentConfig((userConfig, { mergeEnvironmentConfig }) => {
16
- const reactOptions = {
17
- development: userConfig.mode === "development",
18
- runtime: "automatic",
19
- importSource: "preact"
20
- };
21
- const extraConfig = {
22
- tools: {
23
- swc: {
24
- jsc: {
25
- parser: {
26
- syntax: "typescript",
27
- // enable supports for JSX/TSX compilation
28
- tsx: true
29
- },
30
- transform: {
31
- react: reactOptions
32
- }
33
- }
34
- }
1
+ const PLUGIN_PREACT_NAME = 'rsbuild:preact';
2
+ const pluginPreact = function() {
3
+ let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
4
+ return {
5
+ name: PLUGIN_PREACT_NAME,
6
+ setup (api) {
7
+ const { reactAliasesEnabled = true } = options;
8
+ api.modifyEnvironmentConfig((userConfig, param)=>{
9
+ let { mergeEnvironmentConfig } = param;
10
+ const reactOptions = {
11
+ development: 'development' === userConfig.mode,
12
+ runtime: 'automatic',
13
+ importSource: 'preact'
14
+ };
15
+ const extraConfig = {
16
+ tools: {
17
+ swc: {
18
+ jsc: {
19
+ parser: {
20
+ syntax: 'typescript',
21
+ // enable supports for JSX/TSX compilation
22
+ tsx: true
23
+ },
24
+ transform: {
25
+ react: reactOptions
26
+ }
27
+ }
28
+ }
29
+ }
30
+ };
31
+ if (reactAliasesEnabled) {
32
+ extraConfig.source ||= {};
33
+ extraConfig.source.alias = {
34
+ react: 'preact/compat',
35
+ 'react-dom/test-utils': 'preact/test-utils',
36
+ 'react-dom': 'preact/compat',
37
+ 'react/jsx-runtime': 'preact/jsx-runtime'
38
+ };
39
+ }
40
+ return mergeEnvironmentConfig(extraConfig, userConfig);
41
+ });
35
42
  }
36
- };
37
- if (reactAliasesEnabled) {
38
- extraConfig.source ||= {};
39
- extraConfig.source.alias = {
40
- react: "preact/compat",
41
- "react-dom/test-utils": "preact/test-utils",
42
- "react-dom": "preact/compat",
43
- "react/jsx-runtime": "preact/jsx-runtime"
44
- };
45
- }
46
- return mergeEnvironmentConfig(extraConfig, userConfig);
47
- });
48
- }
49
- });
50
- export {
51
- PLUGIN_PREACT_NAME,
52
- pluginPreact
43
+ };
53
44
  };
45
+ export { PLUGIN_PREACT_NAME, pluginPreact };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-preact",
3
- "version": "1.0.1-rc.5",
3
+ "version": "1.0.2",
4
4
  "description": "Preact plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,24 +11,23 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./dist-types/index.d.ts",
14
+ "types": "./dist/index.d.ts",
15
15
  "import": "./dist/index.js",
16
16
  "require": "./dist/index.cjs"
17
17
  }
18
18
  },
19
19
  "main": "./dist/index.cjs",
20
- "types": "./dist-types/index.d.ts",
20
+ "types": "./dist/index.d.ts",
21
21
  "files": [
22
- "dist",
23
- "dist-types"
22
+ "dist"
24
23
  ],
25
24
  "devDependencies": {
26
25
  "@types/node": "18.x",
27
26
  "typescript": "^5.5.2",
28
- "@rsbuild/core": "1.0.1-rc.5"
27
+ "@rsbuild/core": "1.0.8"
29
28
  },
30
29
  "peerDependencies": {
31
- "@rsbuild/core": "^1.0.1-rc.4"
30
+ "@rsbuild/core": "1.x || ^1.0.1-rc.0"
32
31
  },
33
32
  "publishConfig": {
34
33
  "access": "public",
@@ -36,7 +35,7 @@
36
35
  "registry": "https://registry.npmjs.org/"
37
36
  },
38
37
  "scripts": {
39
- "build": "modern build",
40
- "dev": "modern build --watch"
38
+ "build": "rslib build",
39
+ "dev": "rslib build --watch"
41
40
  }
42
41
  }
@@ -1 +0,0 @@
1
- {"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
File without changes