@unpackjs/plugin-react 2.1.1 → 2.2.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.cjs CHANGED
@@ -168,7 +168,7 @@ ${renderer}
168
168
  }
169
169
  }, config;
170
170
  }, PLUGIN_NAME = 'unpack:react', pluginReact = (options = {})=>{
171
- let { clickToComponent, reactCompiler } = options;
171
+ let { clickToComponent } = options;
172
172
  return {
173
173
  name: PLUGIN_NAME,
174
174
  bundlerConfig: async (originalConfig, { unpackConfig, mergeConfig })=>{
@@ -184,7 +184,7 @@ ${renderer}
184
184
  })), config = applySplitChunksConfig({
185
185
  config,
186
186
  unpackConfig
187
- }), reactCompiler && !(0, core_namespaceObject.getUserDepPath)(unpackConfig.root, 'react-compiler-runtime') && (core_namespaceObject.logger.error('dependency "react-compiler-runtime" not found, did you install it?'), process.exit(1));
187
+ });
188
188
  let jsExclude = [
189
189
  /node_modules[\\/](?!\.unpack)/
190
190
  ], swcLoader = isRspack ? 'builtin:swc-loader' : require.resolve('swc-loader'), ReactRefreshPlugin = isRspack ? plugin_react_refresh_default() : react_refresh_webpack_plugin_default(), getSwcOptions = ({ tsx })=>({
@@ -231,14 +231,8 @@ ${renderer}
231
231
  options: getSwcOptions({
232
232
  tsx: !0
233
233
  })
234
- },
235
- reactCompiler && {
236
- loader: external_node_path_default().resolve(__dirname, './reactCompilerLoader.mjs'),
237
- options: {
238
- target: (0, core_namespaceObject.getUserDepVersion)(unpackConfig.root, 'react').split('.')[0]
239
- }
240
234
  }
241
- ].filter(Boolean)
235
+ ]
242
236
  },
243
237
  {
244
238
  test: /\.svg$/i,
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { dirname as __webpack_dirname__ } from "node:path";
5
5
  import node_path from "node:path";
6
6
  import react_refresh_webpack_plugin from "@pmmmwh/react-refresh-webpack-plugin";
7
7
  import plugin_react_refresh from "@rspack/plugin-react-refresh";
8
- import { DEFAULT_BROWSERSLIST, HtmlWebpackPlugin, TEMPLATE_CONTENT, TEMP_DIR, colors, getPathInJs, getPort, getUserDepPath, getUserDepVersion, isDev, isDevServer, isFunction, isPlainObject, logger, removeDir, restartCleaners, rspack } from "@unpackjs/core";
8
+ import { DEFAULT_BROWSERSLIST, HtmlWebpackPlugin, TEMPLATE_CONTENT, TEMP_DIR, colors, getPathInJs, getPort, isDev, isDevServer, isFunction, isPlainObject, logger, removeDir, restartCleaners, rspack } from "@unpackjs/core";
9
9
  import node_fs from "node:fs";
10
10
  import node_http from "node:http";
11
11
  import launch_editor from "launch-editor";
@@ -52,10 +52,8 @@ import '${getPathInJs(node_path.resolve(Object.values(config.entry)[0]))}'
52
52
  };
53
53
  }
54
54
  return config;
55
- };
56
- var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
57
- let PLUGIN_NAME = 'unpack:react', pluginReact = (options = {})=>{
58
- let { clickToComponent, reactCompiler } = options;
55
+ }, PLUGIN_NAME = 'unpack:react', pluginReact = (options = {})=>{
56
+ let { clickToComponent } = options;
59
57
  return {
60
58
  name: PLUGIN_NAME,
61
59
  bundlerConfig: async (originalConfig, { unpackConfig, mergeConfig })=>{
@@ -161,7 +159,7 @@ ${renderer}
161
159
  })({
162
160
  config,
163
161
  unpackConfig
164
- }), reactCompiler && !getUserDepPath(unpackConfig.root, 'react-compiler-runtime') && (logger.error('dependency "react-compiler-runtime" not found, did you install it?'), process.exit(1));
162
+ });
165
163
  let jsExclude = [
166
164
  /node_modules[\\/](?!\.unpack)/
167
165
  ], swcLoader = isRspack ? 'builtin:swc-loader' : require.resolve('swc-loader'), getSwcOptions = ({ tsx })=>({
@@ -208,14 +206,8 @@ ${renderer}
208
206
  options: getSwcOptions({
209
207
  tsx: !0
210
208
  })
211
- },
212
- reactCompiler && {
213
- loader: node_path.resolve(src_dirname, './reactCompilerLoader.mjs'),
214
- options: {
215
- target: getUserDepVersion(unpackConfig.root, 'react').split('.')[0]
216
- }
217
209
  }
218
- ].filter(Boolean)
210
+ ]
219
211
  },
220
212
  {
221
213
  test: /\.svg$/i,
@@ -2,7 +2,6 @@ import { type UnpackPlugin } from '@unpackjs/core';
2
2
  export declare const PLUGIN_NAME = "unpack:react";
3
3
  export type PluginReactOptions = {
4
4
  clickToComponent?: boolean;
5
- reactCompiler?: boolean;
6
5
  };
7
6
  export declare const pluginReact: (options?: PluginReactOptions) => UnpackPlugin;
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,WAAW,iBAAiB,CAAA;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AACD,eAAO,MAAM,WAAW,GAAI,UAAS,kBAAuB,KAAG,YAqG9D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,WAAW,iBAAiB,CAAA;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AACD,eAAO,MAAM,WAAW,GAAI,UAAS,kBAAuB,KAAG,YA0F9D,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/plugin-react",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,21 +24,17 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@babel/core": "7.28.0",
28
- "@babel/plugin-proposal-decorators": "7.28.0",
29
- "@babel/plugin-transform-class-properties": "7.27.1",
30
27
  "@pmmmwh/react-refresh-webpack-plugin": "0.6.1",
31
28
  "@rspack/plugin-react-refresh": "1.4.3",
32
29
  "@svgr/webpack": "8.1.0",
33
30
  "@swc/core": "1.12.9",
34
31
  "@swc/helpers": "0.5.17",
35
- "babel-plugin-react-compiler": "latest",
36
32
  "launch-editor": "2.10.0",
37
33
  "react-refresh": "0.17.0",
38
34
  "swc-loader": "0.2.6"
39
35
  },
40
36
  "devDependencies": {
41
- "@unpackjs/core": "2.4.2"
37
+ "@unpackjs/core": "2.4.3"
42
38
  },
43
39
  "peerDependencies": {
44
40
  "@unpackjs/core": "2.x"
@@ -1,48 +0,0 @@
1
- import { transformAsync } from "@babel/core";
2
- import plugin_proposal_decorators from "@babel/plugin-proposal-decorators";
3
- import plugin_transform_class_properties from "@babel/plugin-transform-class-properties";
4
- import babel_plugin_react_compiler from "babel-plugin-react-compiler";
5
- let defaultBabelParsePlugins = [
6
- 'jsx',
7
- "typescript"
8
- ];
9
- async function reactCompilerLoader(input, _inputSourceMap) {
10
- let callback = this.async();
11
- try {
12
- let options = this.getOptions(), result = await transformAsync(input, {
13
- sourceFileName: this.resourcePath,
14
- filename: this.resourcePath,
15
- cloneInputAst: !1,
16
- plugins: [
17
- [
18
- babel_plugin_react_compiler,
19
- options
20
- ],
21
- [
22
- plugin_proposal_decorators,
23
- {
24
- legacy: !0
25
- }
26
- ],
27
- [
28
- plugin_transform_class_properties
29
- ]
30
- ],
31
- parserOpts: {
32
- plugins: [
33
- ...defaultBabelParsePlugins
34
- ]
35
- },
36
- ast: !1,
37
- sourceMaps: !0,
38
- configFile: !1,
39
- babelrc: !1
40
- });
41
- if (!result) throw TypeError('babel.transformAsync with react compiler plugin returns null');
42
- let { code, map } = result;
43
- callback(null, code ?? void 0, map ?? void 0);
44
- } catch (e) {
45
- callback(e);
46
- }
47
- }
48
- export { reactCompilerLoader as default };
@@ -1,5 +0,0 @@
1
- export type ReactCompilerLoaderOption = {
2
- target: '17' | '18' | '19';
3
- };
4
- export default function reactCompilerLoader(this: any, input: string, _inputSourceMap: any): Promise<void>;
5
- //# sourceMappingURL=reactCompilerLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactCompilerLoader.d.ts","sourceRoot":"","sources":["../src/reactCompilerLoader.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC3B,CAAA;AAMD,wBAA8B,mBAAmB,CAAC,IAAI,KAAA,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,iBAiC1F"}