@unpackjs/plugin-react 1.7.4 → 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.
- package/dist/click-to-component/index.cjs +99 -88
- package/dist/click-to-component/index.d.ts.map +1 -1
- package/dist/click-to-component/index.js +55 -70
- package/dist/click-to-component/injectScript.js +103 -121
- package/dist/index.cjs +153 -126
- package/dist/index.js +109 -111
- package/dist/mpa.cjs +144 -138
- package/dist/mpa.js +99 -126
- package/dist/react-compiler-loader/index.cjs +95 -63
- package/dist/react-compiler-loader/index.js +48 -44
- package/dist/splitChunks.cjs +55 -52
- package/dist/splitChunks.js +25 -42
- package/package.json +6 -6
|
@@ -1,67 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
const
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 };
|
package/dist/splitChunks.cjs
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
});
|
package/dist/splitChunks.js
CHANGED
|
@@ -1,44 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
37
|
+
"@unpackjs/core": "^1.7.6"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"dev": "
|
|
41
|
-
"build": "
|
|
40
|
+
"dev": "rslib build --watch",
|
|
41
|
+
"build": "rslib build"
|
|
42
42
|
}
|
|
43
43
|
}
|