@unpackjs/plugin-react 1.7.10 → 1.7.11
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.js +2 -2
- package/dist/index.js +2 -2
- package/dist/mpa.cjs +9 -9
- package/dist/mpa.js +9 -9
- package/package.json +11 -6
|
@@ -7,7 +7,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_http_2dc67212__ from "node:http";
|
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__ from "@unpackjs/core";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE_launch_editor_c6c8c971__ from "launch-editor";
|
|
10
|
-
var
|
|
10
|
+
var click_to_component_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
11
11
|
const createServer = ()=>new Promise((resolve)=>{
|
|
12
12
|
const server = __WEBPACK_EXTERNAL_MODULE_node_http_2dc67212__["default"].createServer((req, res)=>{
|
|
13
13
|
const params = new URLSearchParams(req.url.slice(1));
|
|
@@ -34,7 +34,7 @@ const createServer = ()=>new Promise((resolve)=>{
|
|
|
34
34
|
});
|
|
35
35
|
const applyClickToComponentConfig = async ({ config, unpackConfig })=>{
|
|
36
36
|
const { port } = await createServer();
|
|
37
|
-
const injectScript = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(
|
|
37
|
+
const injectScript = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(click_to_component_dirname, './injectScript.js'), 'utf-8');
|
|
38
38
|
const scriptTpl = `
|
|
39
39
|
if (!document.querySelector('#__click-to-component__')) {
|
|
40
40
|
const script = document.createElement('script')
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__ from "@unpackjs/
|
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__click_to_component_index_js_1f068bff__ from "./click-to-component/index.js";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE__mpa_js_c5cf22d9__ from "./mpa.js";
|
|
11
11
|
import * as __WEBPACK_EXTERNAL_MODULE__splitChunks_js_b23140d8__ from "./splitChunks.js";
|
|
12
|
-
var
|
|
12
|
+
var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
13
13
|
const PLUGIN_NAME = 'unpack:react';
|
|
14
14
|
const pluginReact = (options = {})=>{
|
|
15
15
|
const { clickToComponent, reactCompiler } = options;
|
|
@@ -88,7 +88,7 @@ const pluginReact = (options = {})=>{
|
|
|
88
88
|
})
|
|
89
89
|
},
|
|
90
90
|
reactCompiler && {
|
|
91
|
-
loader: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(
|
|
91
|
+
loader: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(src_dirname, './react-compiler-loader/index.cjs'),
|
|
92
92
|
options: {
|
|
93
93
|
target: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getUserDepVersion)(unpackConfig.root, 'react').split('.')[0]
|
|
94
94
|
}
|
package/dist/mpa.cjs
CHANGED
|
@@ -54,11 +54,11 @@ const applyMpaConfig = ({ config, unpackConfig, mergeConfig, HtmlPlugin })=>{
|
|
|
54
54
|
const createTempFile = (entry)=>{
|
|
55
55
|
var _userOptions_globalImport, _unpackConfig_html;
|
|
56
56
|
(0, core_namespaceObject.removeDir)(external_node_path_default().join(unpackConfig.root, tempDirectory));
|
|
57
|
-
const globalImport = (null
|
|
57
|
+
const globalImport = (null == (_userOptions_globalImport = userOptions.globalImport) ? void 0 : _userOptions_globalImport.reduce((acc, curr)=>`${acc}\nimport '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().resolve(unpackConfig.root, curr))}'`, '')) || '';
|
|
58
58
|
const { layout } = userOptions;
|
|
59
59
|
const layoutImport = layout ? `import Layout from '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().resolve(unpackConfig.root, layout))}'` : '';
|
|
60
60
|
const layoutJSX = layout ? '<Layout><App /></Layout>' : '<App />';
|
|
61
|
-
const rootElement = `document.getElementById('${null
|
|
61
|
+
const rootElement = `document.getElementById('${null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.mountId}')`;
|
|
62
62
|
const reactDOMSource = 'react-dom/client';
|
|
63
63
|
const renderer = `ReactDOM.createRoot(${rootElement}).render(${layoutJSX})`;
|
|
64
64
|
Object.entries(entry).forEach(([entryName, entryConfig])=>{
|
|
@@ -110,8 +110,8 @@ ${renderer}
|
|
|
110
110
|
};
|
|
111
111
|
if (pageConfig.template) pageConfig.template = external_node_path_default().join(indexFilePath, '../', pageConfig.template);
|
|
112
112
|
html.push({
|
|
113
|
-
template: (null
|
|
114
|
-
templateContent: (null
|
|
113
|
+
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || (isRspack ? void 0 : ''),
|
|
114
|
+
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? isRspack ? void 0 : false : core_namespaceObject.TEMPLATE_CONTENT),
|
|
115
115
|
minify: false,
|
|
116
116
|
filename: `${entryName}.html`,
|
|
117
117
|
chunks: [
|
|
@@ -119,12 +119,12 @@ ${renderer}
|
|
|
119
119
|
],
|
|
120
120
|
...pageConfig,
|
|
121
121
|
templateParameters: {
|
|
122
|
-
mountId: null
|
|
123
|
-
title: (0, core_namespaceObject.isFunction)(null
|
|
122
|
+
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
123
|
+
title: (0, core_namespaceObject.isFunction)(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
|
|
124
124
|
entryName
|
|
125
|
-
}) : (null
|
|
126
|
-
headTag: (null
|
|
127
|
-
...null
|
|
125
|
+
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
126
|
+
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
127
|
+
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
128
128
|
...pageConfig.templateParameters
|
|
129
129
|
}
|
|
130
130
|
});
|
package/dist/mpa.js
CHANGED
|
@@ -17,11 +17,11 @@ const applyMpaConfig = ({ config, unpackConfig, mergeConfig, HtmlPlugin })=>{
|
|
|
17
17
|
const createTempFile = (entry)=>{
|
|
18
18
|
var _userOptions_globalImport, _unpackConfig_html;
|
|
19
19
|
(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.removeDir)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(unpackConfig.root, tempDirectory));
|
|
20
|
-
const globalImport = (null
|
|
20
|
+
const globalImport = (null == (_userOptions_globalImport = userOptions.globalImport) ? void 0 : _userOptions_globalImport.reduce((acc, curr)=>`${acc}\nimport '${(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getPathInJs)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(unpackConfig.root, curr))}'`, '')) || '';
|
|
21
21
|
const { layout } = userOptions;
|
|
22
22
|
const layoutImport = layout ? `import Layout from '${(0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.getPathInJs)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(unpackConfig.root, layout))}'` : '';
|
|
23
23
|
const layoutJSX = layout ? '<Layout><App /></Layout>' : '<App />';
|
|
24
|
-
const rootElement = `document.getElementById('${null
|
|
24
|
+
const rootElement = `document.getElementById('${null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.mountId}')`;
|
|
25
25
|
const reactDOMSource = 'react-dom/client';
|
|
26
26
|
const renderer = `ReactDOM.createRoot(${rootElement}).render(${layoutJSX})`;
|
|
27
27
|
Object.entries(entry).forEach(([entryName, entryConfig])=>{
|
|
@@ -73,8 +73,8 @@ ${renderer}
|
|
|
73
73
|
};
|
|
74
74
|
if (pageConfig.template) pageConfig.template = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(indexFilePath, '../', pageConfig.template);
|
|
75
75
|
html.push({
|
|
76
|
-
template: (null
|
|
77
|
-
templateContent: (null
|
|
76
|
+
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || (isRspack ? void 0 : ''),
|
|
77
|
+
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? isRspack ? void 0 : false : __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.TEMPLATE_CONTENT),
|
|
78
78
|
minify: false,
|
|
79
79
|
filename: `${entryName}.html`,
|
|
80
80
|
chunks: [
|
|
@@ -82,12 +82,12 @@ ${renderer}
|
|
|
82
82
|
],
|
|
83
83
|
...pageConfig,
|
|
84
84
|
templateParameters: {
|
|
85
|
-
mountId: null
|
|
86
|
-
title: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isFunction)(null
|
|
85
|
+
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
86
|
+
title: (0, __WEBPACK_EXTERNAL_MODULE__unpackjs_core_a401ca19__.isFunction)(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
|
|
87
87
|
entryName
|
|
88
|
-
}) : (null
|
|
89
|
-
headTag: (null
|
|
90
|
-
...null
|
|
88
|
+
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
89
|
+
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
90
|
+
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
91
91
|
...pageConfig.templateParameters
|
|
92
92
|
}
|
|
93
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/plugin-react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -27,14 +27,19 @@
|
|
|
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.16",
|
|
30
|
-
"@rspack/plugin-react-refresh": "1.0
|
|
31
|
-
"@swc/core": "1.11.
|
|
32
|
-
"@swc/helpers": "0.5.
|
|
30
|
+
"@rspack/plugin-react-refresh": "1.2.0",
|
|
31
|
+
"@swc/core": "1.11.20",
|
|
32
|
+
"@swc/helpers": "0.5.17",
|
|
33
33
|
"babel-plugin-react-compiler": "latest",
|
|
34
34
|
"launch-editor": "2.10.0",
|
|
35
35
|
"react-refresh": "0.17.0",
|
|
36
|
-
"swc-loader": "0.2.6"
|
|
37
|
-
|
|
36
|
+
"swc-loader": "0.2.6"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@unpackjs/core": "1.7.11"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@unpackjs/core": "1.7.11"
|
|
38
43
|
},
|
|
39
44
|
"scripts": {
|
|
40
45
|
"dev": "rslib build --watch",
|