@unpackjs/plugin-react 1.7.5 → 1.7.6

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.
@@ -1,67 +1,99 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var react_compiler_loader_exports = {};
29
- __export(react_compiler_loader_exports, {
30
- default: () => reactCompilerLoader
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = function(module) {
5
+ var getter = module && module.__esModule ? function() {
6
+ return module['default'];
7
+ } : function() {
8
+ return module;
9
+ };
10
+ __webpack_require__.d(getter, {
11
+ a: getter
12
+ });
13
+ return getter;
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = function(exports1, definition) {
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = function(obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+ })();
29
+ (()=>{
30
+ __webpack_require__.r = function(exports1) {
31
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ });
34
+ Object.defineProperty(exports1, '__esModule', {
35
+ value: true
36
+ });
37
+ };
38
+ })();
39
+ var __webpack_exports__ = {};
40
+ __webpack_require__.r(__webpack_exports__);
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ default: ()=>reactCompilerLoader
31
43
  });
32
- module.exports = __toCommonJS(react_compiler_loader_exports);
33
- var babel = __toESM(require("@babel/core"));
34
- var import_plugin_proposal_decorators = __toESM(require("@babel/plugin-proposal-decorators"));
35
- var import_plugin_transform_class_properties = __toESM(require("@babel/plugin-transform-class-properties"));
36
- var import_babel_plugin_react_compiler = __toESM(require("babel-plugin-react-compiler"));
37
- const defaultBabelParsePlugins = ["jsx", "typescript"];
44
+ const core_namespaceObject = require("@babel/core");
45
+ const plugin_proposal_decorators_namespaceObject = require("@babel/plugin-proposal-decorators");
46
+ var plugin_proposal_decorators_default = /*#__PURE__*/ __webpack_require__.n(plugin_proposal_decorators_namespaceObject);
47
+ const plugin_transform_class_properties_namespaceObject = require("@babel/plugin-transform-class-properties");
48
+ var plugin_transform_class_properties_default = /*#__PURE__*/ __webpack_require__.n(plugin_transform_class_properties_namespaceObject);
49
+ const external_babel_plugin_react_compiler_namespaceObject = require("babel-plugin-react-compiler");
50
+ var external_babel_plugin_react_compiler_default = /*#__PURE__*/ __webpack_require__.n(external_babel_plugin_react_compiler_namespaceObject);
51
+ const defaultBabelParsePlugins = [
52
+ 'jsx',
53
+ "typescript"
54
+ ];
38
55
  async function reactCompilerLoader(input, _inputSourceMap) {
39
- const callback = this.async();
40
- try {
41
- const options = this.getOptions();
42
- const result = await babel.transformAsync(input, {
43
- sourceFileName: this.resourcePath,
44
- filename: this.resourcePath,
45
- cloneInputAst: false,
46
- plugins: [
47
- [import_babel_plugin_react_compiler.default, options],
48
- [import_plugin_proposal_decorators.default, { legacy: true }],
49
- [import_plugin_transform_class_properties.default]
50
- ],
51
- parserOpts: {
52
- plugins: [...defaultBabelParsePlugins]
53
- },
54
- ast: false,
55
- sourceMaps: true,
56
- configFile: false,
57
- babelrc: false
58
- });
59
- if (!result) {
60
- throw new TypeError("babel.transformAsync with react compiler plugin returns null");
56
+ const callback = this.async();
57
+ try {
58
+ const options = this.getOptions();
59
+ const result = await core_namespaceObject.transformAsync(input, {
60
+ sourceFileName: this.resourcePath,
61
+ filename: this.resourcePath,
62
+ cloneInputAst: false,
63
+ plugins: [
64
+ [
65
+ external_babel_plugin_react_compiler_default(),
66
+ options
67
+ ],
68
+ [
69
+ plugin_proposal_decorators_default(),
70
+ {
71
+ legacy: true
72
+ }
73
+ ],
74
+ [
75
+ plugin_transform_class_properties_default()
76
+ ]
77
+ ],
78
+ parserOpts: {
79
+ plugins: [
80
+ ...defaultBabelParsePlugins
81
+ ]
82
+ },
83
+ ast: false,
84
+ sourceMaps: true,
85
+ configFile: false,
86
+ babelrc: false
87
+ });
88
+ if (!result) throw new TypeError('babel.transformAsync with react compiler plugin returns null');
89
+ const { code, map } = result;
90
+ callback(null, code ?? void 0, map ?? void 0);
91
+ } catch (e) {
92
+ callback(e);
61
93
  }
62
- const { code, map } = result;
63
- callback(null, code ?? void 0, map ?? void 0);
64
- } catch (e) {
65
- callback(e);
66
- }
67
94
  }
95
+ var __webpack_export_target__ = exports;
96
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
97
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
98
+ value: true
99
+ });
@@ -1,47 +1,51 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import * as babel from "@babel/core";
11
- import PluginProposalDecorators from "@babel/plugin-proposal-decorators";
12
- import PluginTransformClassProperties from "@babel/plugin-transform-class-properties";
13
- import BabelPluginReactCompiler from "babel-plugin-react-compiler";
14
- const defaultBabelParsePlugins = ["jsx", "typescript"];
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE__babel_core_1832d21b__ from "@babel/core";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__babel_plugin_proposal_decorators_ac6ac103__ from "@babel/plugin-proposal-decorators";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__babel_plugin_transform_class_properties_a153ae05__ from "@babel/plugin-transform-class-properties";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_babel_plugin_react_compiler_4f9bef75__ from "babel-plugin-react-compiler";
7
+ const defaultBabelParsePlugins = [
8
+ 'jsx',
9
+ "typescript"
10
+ ];
15
11
  async function reactCompilerLoader(input, _inputSourceMap) {
16
- const callback = this.async();
17
- try {
18
- const options = this.getOptions();
19
- const result = await babel.transformAsync(input, {
20
- sourceFileName: this.resourcePath,
21
- filename: this.resourcePath,
22
- cloneInputAst: false,
23
- plugins: [
24
- [BabelPluginReactCompiler, options],
25
- [PluginProposalDecorators, { legacy: true }],
26
- [PluginTransformClassProperties]
27
- ],
28
- parserOpts: {
29
- plugins: [...defaultBabelParsePlugins]
30
- },
31
- ast: false,
32
- sourceMaps: true,
33
- configFile: false,
34
- babelrc: false
35
- });
36
- if (!result) {
37
- throw new TypeError("babel.transformAsync with react compiler plugin returns null");
12
+ const callback = this.async();
13
+ try {
14
+ const options = this.getOptions();
15
+ const result = await __WEBPACK_EXTERNAL_MODULE__babel_core_1832d21b__.transformAsync(input, {
16
+ sourceFileName: this.resourcePath,
17
+ filename: this.resourcePath,
18
+ cloneInputAst: false,
19
+ plugins: [
20
+ [
21
+ __WEBPACK_EXTERNAL_MODULE_babel_plugin_react_compiler_4f9bef75__["default"],
22
+ options
23
+ ],
24
+ [
25
+ __WEBPACK_EXTERNAL_MODULE__babel_plugin_proposal_decorators_ac6ac103__["default"],
26
+ {
27
+ legacy: true
28
+ }
29
+ ],
30
+ [
31
+ __WEBPACK_EXTERNAL_MODULE__babel_plugin_transform_class_properties_a153ae05__["default"]
32
+ ]
33
+ ],
34
+ parserOpts: {
35
+ plugins: [
36
+ ...defaultBabelParsePlugins
37
+ ]
38
+ },
39
+ ast: false,
40
+ sourceMaps: true,
41
+ configFile: false,
42
+ babelrc: false
43
+ });
44
+ if (!result) throw new TypeError('babel.transformAsync with react compiler plugin returns null');
45
+ const { code, map } = result;
46
+ callback(null, code ?? void 0, map ?? void 0);
47
+ } catch (e) {
48
+ callback(e);
38
49
  }
39
- const { code, map } = result;
40
- callback(null, code ?? void 0, map ?? void 0);
41
- } catch (e) {
42
- callback(e);
43
- }
44
50
  }
45
- export {
46
- reactCompilerLoader as default
47
- };
51
+ export { reactCompilerLoader as default };
@@ -1,56 +1,59 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var splitChunks_exports = {};
19
- __export(splitChunks_exports, {
20
- applySplitChunksConfig: () => applySplitChunksConfig
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = function(exports1, definition) {
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = function(obj, prop) {
13
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.r = function(exports1) {
18
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
+ value: 'Module'
20
+ });
21
+ Object.defineProperty(exports1, '__esModule', {
22
+ value: true
23
+ });
24
+ };
25
+ })();
26
+ var __webpack_exports__ = {};
27
+ __webpack_require__.r(__webpack_exports__);
28
+ __webpack_require__.d(__webpack_exports__, {
29
+ applySplitChunksConfig: ()=>applySplitChunksConfig
21
30
  });
22
- module.exports = __toCommonJS(splitChunks_exports);
23
- var import_core = require("@unpackjs/core");
24
- const applySplitChunksConfig = ({
25
- config,
26
- unpackConfig
27
- }) => {
28
- if (unpackConfig.performance.chunkSplit.strategy !== "split-by-experience") {
31
+ const core_namespaceObject = require("@unpackjs/core");
32
+ const applySplitChunksConfig = ({ config, unpackConfig })=>{
33
+ if ('split-by-experience' !== unpackConfig.performance.chunkSplit.strategy) return config;
34
+ const currentConfig = config.optimization.splitChunks;
35
+ const extraGroups = {};
36
+ extraGroups.react = {
37
+ name: 'lib-react',
38
+ test: (0, core_namespaceObject.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
39
+ priority: 0
40
+ };
41
+ extraGroups.router = {
42
+ name: 'lib-router',
43
+ test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
44
+ priority: 0
45
+ };
46
+ config.optimization.splitChunks = {
47
+ ...currentConfig,
48
+ cacheGroups: {
49
+ ...extraGroups,
50
+ ...currentConfig.cacheGroups
51
+ }
52
+ };
29
53
  return config;
30
- }
31
- const currentConfig = config.optimization.splitChunks;
32
- const extraGroups = {};
33
- extraGroups.react = {
34
- name: "lib-react",
35
- test: !(0, import_core.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
36
- priority: 0
37
- };
38
- extraGroups.router = {
39
- name: "lib-router",
40
- test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
41
- priority: 0
42
- };
43
- config.optimization.splitChunks = {
44
- ...currentConfig,
45
- cacheGroups: {
46
- ...extraGroups,
47
- // @ts-expect-error
48
- ...currentConfig.cacheGroups
49
- }
50
- };
51
- return config;
52
54
  };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- applySplitChunksConfig
55
+ var __webpack_export_target__ = exports;
56
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
57
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
58
+ value: true
56
59
  });
@@ -1,44 +1,27 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
- var __filename = /* @__PURE__ */ getFilename();
10
- import {
11
- isDevServer
12
- } from "@unpackjs/core";
13
- const applySplitChunksConfig = ({
14
- config,
15
- unpackConfig
16
- }) => {
17
- if (unpackConfig.performance.chunkSplit.strategy !== "split-by-experience") {
1
+ import __rslib_shim_module__ from 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import * as __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__ from "@unpackjs/core";
4
+ const applySplitChunksConfig = ({ config, unpackConfig })=>{
5
+ if ('split-by-experience' !== unpackConfig.performance.chunkSplit.strategy) return config;
6
+ const currentConfig = config.optimization.splitChunks;
7
+ const extraGroups = {};
8
+ extraGroups.react = {
9
+ name: 'lib-react',
10
+ test: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isDevServer)() ? /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/,
11
+ priority: 0
12
+ };
13
+ extraGroups.router = {
14
+ name: 'lib-router',
15
+ test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
16
+ priority: 0
17
+ };
18
+ config.optimization.splitChunks = {
19
+ ...currentConfig,
20
+ cacheGroups: {
21
+ ...extraGroups,
22
+ ...currentConfig.cacheGroups
23
+ }
24
+ };
18
25
  return config;
19
- }
20
- const currentConfig = config.optimization.splitChunks;
21
- const extraGroups = {};
22
- extraGroups.react = {
23
- name: "lib-react",
24
- test: !isDevServer() ? /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
25
- priority: 0
26
- };
27
- extraGroups.router = {
28
- name: "lib-router",
29
- test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
30
- priority: 0
31
- };
32
- config.optimization.splitChunks = {
33
- ...currentConfig,
34
- cacheGroups: {
35
- ...extraGroups,
36
- // @ts-expect-error
37
- ...currentConfig.cacheGroups
38
- }
39
- };
40
- return config;
41
- };
42
- export {
43
- applySplitChunksConfig
44
26
  };
27
+ export { applySplitChunksConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unpackjs/plugin-react",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,21 +23,21 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@babel/core": "7.26.0",
26
+ "@babel/core": "7.26.8",
27
27
  "@babel/plugin-proposal-decorators": "7.25.9",
28
28
  "@babel/plugin-transform-class-properties": "7.25.9",
29
29
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
30
30
  "@rspack/plugin-react-refresh": "1.0.1",
31
- "@swc/core": "1.10.4",
31
+ "@swc/core": "1.10.15",
32
32
  "@swc/helpers": "0.5.15",
33
33
  "babel-plugin-react-compiler": "latest",
34
34
  "launch-editor": "2.9.1",
35
35
  "react-refresh": "0.16.0",
36
36
  "swc-loader": "0.2.6",
37
- "@unpackjs/core": "^1.7.5"
37
+ "@unpackjs/core": "^1.7.6"
38
38
  },
39
39
  "scripts": {
40
- "dev": "modern build --watch",
41
- "build": "modern build"
40
+ "dev": "rslib build --watch",
41
+ "build": "rslib build"
42
42
  }
43
43
  }