@unpackjs/plugin-react 3.1.3 → 3.2.1
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 +53 -61
- package/dist/index.js +48 -55
- package/dist/injectScript.js +5 -3
- package/dist-types/click-to-component/index.d.ts.map +1 -1
- package/package.json +3 -4
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.n = (module)=>{
|
|
5
5
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
@@ -23,17 +23,15 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
23
23
|
pluginReact: ()=>pluginReact,
|
|
24
24
|
PLUGIN_NAME: ()=>PLUGIN_NAME
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
27
27
|
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
28
|
-
|
|
28
|
+
const plugin_react_refresh_namespaceObject = require("@rspack/plugin-react-refresh");
|
|
29
29
|
var plugin_react_refresh_default = __webpack_require__.n(plugin_react_refresh_namespaceObject);
|
|
30
|
-
|
|
30
|
+
const core_namespaceObject = require("@unpackjs/core"), external_node_fs_namespaceObject = require("node:fs");
|
|
31
31
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
32
|
-
|
|
32
|
+
const external_node_http_namespaceObject = require("node:http");
|
|
33
33
|
var external_node_http_default = __webpack_require__.n(external_node_http_namespaceObject);
|
|
34
|
-
|
|
35
|
-
var external_launch_editor_default = __webpack_require__.n(external_launch_editor_namespaceObject);
|
|
36
|
-
let createServer = ()=>new Promise((resolve)=>{
|
|
34
|
+
const createServer = ()=>new Promise((resolve)=>{
|
|
37
35
|
let server = external_node_http_default().createServer((req, res)=>{
|
|
38
36
|
let params = new URLSearchParams(req.url.slice(1)), file = decodeURIComponent(params.get('file')), line = Number(params.get('line')), column = Number(params.get('column'));
|
|
39
37
|
res.writeHead(200, {
|
|
@@ -41,7 +39,7 @@ let createServer = ()=>new Promise((resolve)=>{
|
|
|
41
39
|
'Access-Control-Allow-Methods': '*',
|
|
42
40
|
'Access-Control-Allow-Headers': '*',
|
|
43
41
|
'Access-Control-Allow-Private-Network': 'true'
|
|
44
|
-
}), res.end('ok'),
|
|
42
|
+
}), res.end('ok'), (0, core_namespaceObject.launchEditor)(`${file}:${line}:${column}`);
|
|
45
43
|
});
|
|
46
44
|
(0, core_namespaceObject.getPort)().then((port)=>{
|
|
47
45
|
server.listen(port, ()=>{
|
|
@@ -49,7 +47,7 @@ let createServer = ()=>new Promise((resolve)=>{
|
|
|
49
47
|
port
|
|
50
48
|
});
|
|
51
49
|
});
|
|
52
|
-
}), core_namespaceObject.
|
|
50
|
+
}), (0, core_namespaceObject.addRestartCleaner)(()=>new Promise((resolve)=>server.close(()=>resolve())));
|
|
53
51
|
}), applyClickToComponentConfig = async ({ config, unpackConfig })=>{
|
|
54
52
|
let { port } = await createServer(), injectScript = external_node_fs_default().readFileSync(external_node_path_default().resolve(__dirname, './injectScript.js'), 'utf-8'), scriptTpl = `
|
|
55
53
|
if (!document.querySelector('#__click-to-component__')) {
|
|
@@ -76,56 +74,50 @@ import '${(0, core_namespaceObject.getPathInJs)(external_node_path_default().res
|
|
|
76
74
|
}
|
|
77
75
|
return config;
|
|
78
76
|
}, applyMpaConfig = ({ config, unpackConfig })=>{
|
|
79
|
-
let tempDirectory = external_node_path_default().join(core_namespaceObject.TEMP_DIR, 'mpa'), userOptions = (0, core_namespaceObject.isPlainObject)(unpackConfig.mpa) ? unpackConfig.mpa : {}, { entry, html } = (()=>{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let indexFilePath = external_node_path_default().join(dir, `index${extension}`);
|
|
89
|
-
if (external_node_fs_default().existsSync(indexFilePath)) return indexFilePath;
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
92
|
-
})(external_node_path_default().join(pagesRoot, filename));
|
|
93
|
-
if (indexFilePath) {
|
|
94
|
-
var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
|
|
95
|
-
let pageConfig = ((indexPath)=>{
|
|
96
|
-
let filePath = external_node_path_default().join(indexPath, '../config.json'), pageConfig = {};
|
|
97
|
-
return external_node_fs_default().existsSync(filePath) && (pageConfig = JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'))), pageConfig;
|
|
98
|
-
})(indexFilePath), entryName = !0 === userOptions.lowerCase ? filename.toLowerCase() : filename;
|
|
99
|
-
pageConfig.filename && (entryName = pageConfig.filename.slice(0, -5)), entry[entryName] = {
|
|
100
|
-
import: [
|
|
101
|
-
indexFilePath
|
|
102
|
-
]
|
|
103
|
-
}, pageConfig.template && (pageConfig.template = external_node_path_default().join(indexFilePath, '../', pageConfig.template)), html.push({
|
|
104
|
-
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
|
|
105
|
-
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : core_namespaceObject.TEMPLATE_CONTENT),
|
|
106
|
-
minify: !1,
|
|
107
|
-
filename: `${entryName}.html`,
|
|
108
|
-
chunks: [
|
|
109
|
-
entryName
|
|
110
|
-
],
|
|
111
|
-
...pageConfig,
|
|
112
|
-
templateParameters: {
|
|
113
|
-
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
114
|
-
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({
|
|
115
|
-
entryName
|
|
116
|
-
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
117
|
-
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
118
|
-
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
119
|
-
...pageConfig.templateParameters
|
|
120
|
-
}
|
|
121
|
-
});
|
|
77
|
+
let start, entry, html, pagesRoot, tempDirectory = external_node_path_default().join(core_namespaceObject.TEMP_DIR, 'mpa'), userOptions = (0, core_namespaceObject.isPlainObject)(unpackConfig.mpa) ? unpackConfig.mpa : {}, { entry: entry1, html: html1 } = (start = performance.now(), entry = {}, html = [], pagesRoot = external_node_path_default().join(unpackConfig.root, 'src', 'pages'), external_node_fs_default().readdirSync(pagesRoot).forEach((filename)=>{
|
|
78
|
+
if (filename.startsWith('.')) return;
|
|
79
|
+
let indexFilePath = ((dir)=>{
|
|
80
|
+
for (let extension of [
|
|
81
|
+
'.tsx',
|
|
82
|
+
'.jsx'
|
|
83
|
+
]){
|
|
84
|
+
let indexFilePath = external_node_path_default().join(dir, `index${extension}`);
|
|
85
|
+
if (external_node_fs_default().existsSync(indexFilePath)) return indexFilePath;
|
|
122
86
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
87
|
+
return null;
|
|
88
|
+
})(external_node_path_default().join(pagesRoot, filename));
|
|
89
|
+
if (indexFilePath) {
|
|
90
|
+
var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
|
|
91
|
+
let filePath, pageConfig, pageConfig1 = (filePath = external_node_path_default().join(indexFilePath, '../config.json'), pageConfig = {}, external_node_fs_default().existsSync(filePath) && (pageConfig = JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'))), pageConfig), entryName = !0 === userOptions.lowerCase ? filename.toLowerCase() : filename;
|
|
92
|
+
pageConfig1.filename && (entryName = pageConfig1.filename.slice(0, -5)), entry[entryName] = {
|
|
93
|
+
import: [
|
|
94
|
+
indexFilePath
|
|
95
|
+
]
|
|
96
|
+
}, pageConfig1.template && (pageConfig1.template = external_node_path_default().join(indexFilePath, '../', pageConfig1.template)), html.push({
|
|
97
|
+
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
|
|
98
|
+
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : core_namespaceObject.TEMPLATE_CONTENT),
|
|
99
|
+
minify: !1,
|
|
100
|
+
filename: `${entryName}.html`,
|
|
101
|
+
chunks: [
|
|
102
|
+
entryName
|
|
103
|
+
],
|
|
104
|
+
...pageConfig1,
|
|
105
|
+
templateParameters: {
|
|
106
|
+
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
107
|
+
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({
|
|
108
|
+
entryName
|
|
109
|
+
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
110
|
+
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
111
|
+
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
112
|
+
...pageConfig1.templateParameters
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}), (0, core_namespaceObject.isDevServer)() || core_namespaceObject.logger.info(`collect entries in ${(performance.now() - start).toFixed(2)}ms ${core_namespaceObject.colors.dim('[MPA]')}`), {
|
|
117
|
+
entry,
|
|
118
|
+
html
|
|
119
|
+
});
|
|
120
|
+
return (0, core_namespaceObject.mergeConfig)(config, {
|
|
129
121
|
entry: ((entry)=>{
|
|
130
122
|
var _userOptions_globalImport, _unpackConfig_html;
|
|
131
123
|
let root = unpackConfig.root;
|
|
@@ -143,8 +135,8 @@ ${renderer}
|
|
|
143
135
|
recursive: !0
|
|
144
136
|
}), external_node_fs_default().writeFileSync(filePath, tpl, 'utf-8'), entryConfig.import[0] = filePath;
|
|
145
137
|
}), entry;
|
|
146
|
-
})(
|
|
147
|
-
plugins:
|
|
138
|
+
})(entry1),
|
|
139
|
+
plugins: html1.map((h)=>new core_namespaceObject.rspack.HtmlRspackPlugin(h))
|
|
148
140
|
});
|
|
149
141
|
}, applySplitChunksConfig = ({ config })=>{
|
|
150
142
|
let currentConfig = config.optimization.splitChunks, extraGroups = {};
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,9 @@ import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
|
4
4
|
import { dirname as __webpack_dirname__ } from "node:path";
|
|
5
5
|
import node_path from "node:path";
|
|
6
6
|
import plugin_react_refresh from "@rspack/plugin-react-refresh";
|
|
7
|
-
import { TEMPLATE_CONTENT, TEMP_DIR, colors, esVersionToBrowserslist, getPathInJs, getPort, isDev, isDevServer, isFunction, isPlainObject, logger, mergeConfig as core_mergeConfig, removeDir,
|
|
7
|
+
import { TEMPLATE_CONTENT, TEMP_DIR, addRestartCleaner, colors, esVersionToBrowserslist, getPathInJs, getPort, isDev, isDevServer, isFunction, isPlainObject, launchEditor, logger, mergeConfig as core_mergeConfig, removeDir, rspack } from "@unpackjs/core";
|
|
8
8
|
import node_fs from "node:fs";
|
|
9
9
|
import node_http from "node:http";
|
|
10
|
-
import launch_editor from "launch-editor";
|
|
11
10
|
var click_to_component_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
12
11
|
let applyClickToComponentConfig = async ({ config, unpackConfig })=>{
|
|
13
12
|
let { port } = await new Promise((resolve)=>{
|
|
@@ -18,7 +17,7 @@ let applyClickToComponentConfig = async ({ config, unpackConfig })=>{
|
|
|
18
17
|
'Access-Control-Allow-Methods': '*',
|
|
19
18
|
'Access-Control-Allow-Headers': '*',
|
|
20
19
|
'Access-Control-Allow-Private-Network': 'true'
|
|
21
|
-
}), res.end('ok'),
|
|
20
|
+
}), res.end('ok'), launchEditor(`${file}:${line}:${column}`);
|
|
22
21
|
});
|
|
23
22
|
getPort().then((port)=>{
|
|
24
23
|
server.listen(port, ()=>{
|
|
@@ -26,7 +25,7 @@ let applyClickToComponentConfig = async ({ config, unpackConfig })=>{
|
|
|
26
25
|
port
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
|
-
}),
|
|
28
|
+
}), addRestartCleaner(()=>new Promise((resolve)=>server.close(()=>resolve())));
|
|
30
29
|
}), injectScript = node_fs.readFileSync(node_path.resolve(click_to_component_dirname, './injectScript.js'), 'utf-8'), scriptTpl = `
|
|
31
30
|
if (!document.querySelector('#__click-to-component__')) {
|
|
32
31
|
const script = document.createElement('script')
|
|
@@ -59,56 +58,50 @@ import '${getPathInJs(node_path.resolve(Object.values(config.entry)[0]))}'
|
|
|
59
58
|
var _unpackConfig_performance_chunkSplit, _unpackConfig_performance;
|
|
60
59
|
let config = originalConfig;
|
|
61
60
|
unpackConfig.mpa && (config = (({ config, unpackConfig })=>{
|
|
62
|
-
let tempDirectory = node_path.join(TEMP_DIR, 'mpa'), userOptions = isPlainObject(unpackConfig.mpa) ? unpackConfig.mpa : {}, { entry, html } = (()=>{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
let indexFilePath = node_path.join(dir, `index${extension}`);
|
|
72
|
-
if (node_fs.existsSync(indexFilePath)) return indexFilePath;
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
})(node_path.join(pagesRoot, filename));
|
|
76
|
-
if (indexFilePath) {
|
|
77
|
-
var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
|
|
78
|
-
let pageConfig = ((indexPath)=>{
|
|
79
|
-
let filePath = node_path.join(indexPath, '../config.json'), pageConfig = {};
|
|
80
|
-
return node_fs.existsSync(filePath) && (pageConfig = JSON.parse(node_fs.readFileSync(filePath, 'utf-8'))), pageConfig;
|
|
81
|
-
})(indexFilePath), entryName = !0 === userOptions.lowerCase ? filename.toLowerCase() : filename;
|
|
82
|
-
pageConfig.filename && (entryName = pageConfig.filename.slice(0, -5)), entry[entryName] = {
|
|
83
|
-
import: [
|
|
84
|
-
indexFilePath
|
|
85
|
-
]
|
|
86
|
-
}, pageConfig.template && (pageConfig.template = node_path.join(indexFilePath, '../', pageConfig.template)), html.push({
|
|
87
|
-
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
|
|
88
|
-
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : TEMPLATE_CONTENT),
|
|
89
|
-
minify: !1,
|
|
90
|
-
filename: `${entryName}.html`,
|
|
91
|
-
chunks: [
|
|
92
|
-
entryName
|
|
93
|
-
],
|
|
94
|
-
...pageConfig,
|
|
95
|
-
templateParameters: {
|
|
96
|
-
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
97
|
-
title: isFunction(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
|
|
98
|
-
entryName
|
|
99
|
-
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
100
|
-
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
101
|
-
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
102
|
-
...pageConfig.templateParameters
|
|
103
|
-
}
|
|
104
|
-
});
|
|
61
|
+
let start, entry, html, pagesRoot, tempDirectory = node_path.join(TEMP_DIR, 'mpa'), userOptions = isPlainObject(unpackConfig.mpa) ? unpackConfig.mpa : {}, { entry: entry1, html: html1 } = (start = performance.now(), entry = {}, html = [], pagesRoot = node_path.join(unpackConfig.root, 'src', 'pages'), node_fs.readdirSync(pagesRoot).forEach((filename)=>{
|
|
62
|
+
if (filename.startsWith('.')) return;
|
|
63
|
+
let indexFilePath = ((dir)=>{
|
|
64
|
+
for (let extension of [
|
|
65
|
+
'.tsx',
|
|
66
|
+
'.jsx'
|
|
67
|
+
]){
|
|
68
|
+
let indexFilePath = node_path.join(dir, `index${extension}`);
|
|
69
|
+
if (node_fs.existsSync(indexFilePath)) return indexFilePath;
|
|
105
70
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
71
|
+
return null;
|
|
72
|
+
})(node_path.join(pagesRoot, filename));
|
|
73
|
+
if (indexFilePath) {
|
|
74
|
+
var _unpackConfig_html, _unpackConfig_html1, _unpackConfig_html2, _unpackConfig_html3, _unpackConfig_html4, _unpackConfig_html5, _unpackConfig_html6, _unpackConfig_html7, _unpackConfig_html8;
|
|
75
|
+
let filePath, pageConfig, pageConfig1 = (filePath = node_path.join(indexFilePath, '../config.json'), pageConfig = {}, node_fs.existsSync(filePath) && (pageConfig = JSON.parse(node_fs.readFileSync(filePath, 'utf-8'))), pageConfig), entryName = !0 === userOptions.lowerCase ? filename.toLowerCase() : filename;
|
|
76
|
+
pageConfig1.filename && (entryName = pageConfig1.filename.slice(0, -5)), entry[entryName] = {
|
|
77
|
+
import: [
|
|
78
|
+
indexFilePath
|
|
79
|
+
]
|
|
80
|
+
}, pageConfig1.template && (pageConfig1.template = node_path.join(indexFilePath, '../', pageConfig1.template)), html.push({
|
|
81
|
+
template: (null == (_unpackConfig_html = unpackConfig.html) ? void 0 : _unpackConfig_html.template) || void 0,
|
|
82
|
+
templateContent: (null == (_unpackConfig_html1 = unpackConfig.html) ? void 0 : _unpackConfig_html1.templateContent) || ((null == (_unpackConfig_html2 = unpackConfig.html) ? void 0 : _unpackConfig_html2.template) ? void 0 : TEMPLATE_CONTENT),
|
|
83
|
+
minify: !1,
|
|
84
|
+
filename: `${entryName}.html`,
|
|
85
|
+
chunks: [
|
|
86
|
+
entryName
|
|
87
|
+
],
|
|
88
|
+
...pageConfig1,
|
|
89
|
+
templateParameters: {
|
|
90
|
+
mountId: null == (_unpackConfig_html3 = unpackConfig.html) ? void 0 : _unpackConfig_html3.mountId,
|
|
91
|
+
title: isFunction(null == (_unpackConfig_html4 = unpackConfig.html) ? void 0 : _unpackConfig_html4.title) ? null == (_unpackConfig_html5 = unpackConfig.html) ? void 0 : _unpackConfig_html5.title({
|
|
92
|
+
entryName
|
|
93
|
+
}) : (null == (_unpackConfig_html6 = unpackConfig.html) ? void 0 : _unpackConfig_html6.title) || '',
|
|
94
|
+
headTag: (null == (_unpackConfig_html7 = unpackConfig.html) ? void 0 : _unpackConfig_html7.headTag) || '',
|
|
95
|
+
...null == (_unpackConfig_html8 = unpackConfig.html) ? void 0 : _unpackConfig_html8.templateParameters,
|
|
96
|
+
...pageConfig1.templateParameters
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}), isDevServer() || logger.info(`collect entries in ${(performance.now() - start).toFixed(2)}ms ${colors.dim('[MPA]')}`), {
|
|
101
|
+
entry,
|
|
102
|
+
html
|
|
103
|
+
});
|
|
104
|
+
return core_mergeConfig(config, {
|
|
112
105
|
entry: ((entry)=>{
|
|
113
106
|
var _userOptions_globalImport, _unpackConfig_html;
|
|
114
107
|
let root = unpackConfig.root;
|
|
@@ -126,8 +119,8 @@ ${renderer}
|
|
|
126
119
|
recursive: !0
|
|
127
120
|
}), node_fs.writeFileSync(filePath, tpl, 'utf-8'), entryConfig.import[0] = filePath;
|
|
128
121
|
}), entry;
|
|
129
|
-
})(
|
|
130
|
-
plugins:
|
|
122
|
+
})(entry1),
|
|
123
|
+
plugins: html1.map((h)=>new rspack.HtmlRspackPlugin(h))
|
|
131
124
|
});
|
|
132
125
|
})({
|
|
133
126
|
config,
|
package/dist/injectScript.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
const COVER_ID = '__click-to-component__';
|
|
2
|
+
let cover = null, currentDebugSource = null, enabled = !1;
|
|
2
3
|
function debounce(fn, delay = 200) {
|
|
3
4
|
let timer = null;
|
|
4
5
|
return (...args)=>{
|
|
@@ -52,9 +53,10 @@ function getClosestNodeFromFiber(fiber) {
|
|
|
52
53
|
return fiber.stateNode ? fiber.stateNode : getClosestNodeFromFiber(fiber.return);
|
|
53
54
|
}
|
|
54
55
|
function openEditor() {
|
|
56
|
+
let xhr;
|
|
55
57
|
if (!currentDebugSource) return;
|
|
56
|
-
let port = window.CLICK_TO_COMPONENT.port, { fileName, lineNumber, columnNumber } = currentDebugSource, url = "http://localhost:" + port + "/?file=" + fileName + "&line=" + lineNumber + "&column=" + columnNumber
|
|
57
|
-
xhr.open('GET', url, !0), xhr.send(), xhr.addEventListener('error', ()=>{
|
|
58
|
+
let port = window.CLICK_TO_COMPONENT.port, { fileName, lineNumber, columnNumber } = currentDebugSource, url = "http://localhost:" + port + "/?file=" + fileName + "&line=" + lineNumber + "&column=" + columnNumber;
|
|
59
|
+
(xhr = new XMLHttpRequest()).open('GET', url, !0), xhr.send(), xhr.addEventListener('error', ()=>{
|
|
58
60
|
document.createElement('img').src = url;
|
|
59
61
|
});
|
|
60
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/click-to-component/index.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/click-to-component/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,oBAAoB,EAKzB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AA4BvB,eAAO,MAAM,2BAA2B,GAAU,2BAG/C;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,EAAE,YAAY,CAAA;CAC3B,KAAG,OAAO,CAAC,oBAAoB,CA+B/B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/plugin-react",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "React plugin for Unpack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -24,14 +24,13 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@rspack/plugin-react-refresh": "1.
|
|
27
|
+
"@rspack/plugin-react-refresh": "1.5.1",
|
|
28
28
|
"@svgr/webpack": "8.1.0",
|
|
29
29
|
"@swc/helpers": "0.5.17",
|
|
30
|
-
"launch-editor": "2.11.0",
|
|
31
30
|
"react-refresh": "0.17.0"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@unpackjs/core": "3.
|
|
33
|
+
"@unpackjs/core": "3.3.3"
|
|
35
34
|
},
|
|
36
35
|
"peerDependencies": {
|
|
37
36
|
"@unpackjs/core": "3.x"
|