@unpackjs/plugin-react 3.4.0 → 4.0.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.js +5 -8
- package/dist-types/index.d.ts +1 -4
- package/dist-types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import __rslib_shim_module__ from
|
|
1
|
+
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
let require = __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
3
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
4
4
|
import node_path, { dirname as __rspack_dirname } from "node:path";
|
|
@@ -6,9 +6,7 @@ import node_fs from "node:fs";
|
|
|
6
6
|
import plugin_react_refresh from "@rspack/plugin-react-refresh";
|
|
7
7
|
import { JSX_REGEX, JS_REGEX, SCRIPT_REGEX, esVersionToBrowserslist, getHtmlTemplateOrContent, getPathInJs, injectToHead, isDevServer, isFunction, isPlainObject, launchEditor, mergeConfig as core_mergeConfig, removeDir, rspack } from "@unpackjs/core";
|
|
8
8
|
var src_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
9
|
-
let pluginReact = (
|
|
10
|
-
let { clickToComponent } = options;
|
|
11
|
-
return {
|
|
9
|
+
let pluginReact = ()=>({
|
|
12
10
|
name: 'unpack:react',
|
|
13
11
|
bundlerConfig: async (originalConfig, { unpackConfig, mergeConfig, cachePath })=>{
|
|
14
12
|
let config = originalConfig;
|
|
@@ -160,7 +158,7 @@ ${renderer}
|
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
160
|
},
|
|
163
|
-
setupMiddlewares: (middlewares)=>isDevServer()
|
|
161
|
+
setupMiddlewares: (middlewares)=>isDevServer() ? [
|
|
164
162
|
(req, res, next)=>{
|
|
165
163
|
if (!req.url) return void next();
|
|
166
164
|
let url = new URL(req.url, 'http://localhost');
|
|
@@ -173,10 +171,9 @@ ${renderer}
|
|
|
173
171
|
...middlewares
|
|
174
172
|
] : middlewares,
|
|
175
173
|
transformHtml: (html)=>{
|
|
176
|
-
if (!isDevServer()
|
|
174
|
+
if (!isDevServer()) return html;
|
|
177
175
|
let injectScriptPath = node_path.resolve(src_dirname, 'injectScript.js'), injectScript = node_fs.readFileSync(injectScriptPath, 'utf-8');
|
|
178
176
|
return injectToHead(html, `<script>${injectScript}</script>`);
|
|
179
177
|
}
|
|
180
|
-
};
|
|
181
|
-
};
|
|
178
|
+
});
|
|
182
179
|
export { pluginReact };
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { type UnpackPlugin } from '@unpackjs/core';
|
|
2
|
-
export
|
|
3
|
-
clickToComponent?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare const pluginReact: (options?: PluginReactOptions) => UnpackPlugin;
|
|
2
|
+
export declare const pluginReact: () => UnpackPlugin;
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAGvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAGvB,eAAO,MAAM,WAAW,QAAO,YAiH9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/plugin-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "React plugin for Unpack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rspack/plugin-react-refresh": "1.
|
|
25
|
+
"@rspack/plugin-react-refresh": "1.6.0",
|
|
26
26
|
"@svgr/webpack": "8.1.0",
|
|
27
27
|
"@swc/helpers": "0.5.18",
|
|
28
28
|
"react-refresh": "0.18.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@unpackjs/core": "
|
|
31
|
+
"@unpackjs/core": "4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@unpackjs/core": "
|
|
34
|
+
"@unpackjs/core": "4.x"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "rslib build --watch",
|