@tooltify/integration-rspack 0.1.2 → 0.1.3
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.d.ts +5 -1
- package/dist/index.js +4 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { RspackPluginInstance } from '@rspack/core';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface StartOptions {
|
|
4
|
+
publicUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function rspackTooltify({ publicUrl }?: StartOptions): RspackPluginInstance;
|
|
4
8
|
|
|
5
9
|
export { rspackTooltify };
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,11 @@ import { fileURLToPath } from "url";
|
|
|
4
4
|
import { startServer } from "@tooltify/core";
|
|
5
5
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
var CUSTOM_JSX_RUNTIME = path.resolve(__dirname, "./helpers/react-transform-source");
|
|
7
|
-
function rspackTooltify() {
|
|
7
|
+
function rspackTooltify({ publicUrl } = {}) {
|
|
8
8
|
return {
|
|
9
9
|
apply(compiler) {
|
|
10
10
|
const { config, port, buildTracker, cleanDeps } = startServer();
|
|
11
|
+
const TOOLTIFY_URL = publicUrl ? publicUrl : `http://localhost:${port}`;
|
|
11
12
|
new compiler.rspack.NormalModuleReplacementPlugin(
|
|
12
13
|
/^react\/jsx-dev-runtime$/,
|
|
13
14
|
CUSTOM_JSX_RUNTIME
|
|
@@ -24,8 +25,8 @@ function rspackTooltify() {
|
|
|
24
25
|
const html = assets[name].source().toString();
|
|
25
26
|
const injected = html.replace(
|
|
26
27
|
"</head>",
|
|
27
|
-
`<script>window.__TOOLTIFY_URL__="
|
|
28
|
-
<script src="
|
|
28
|
+
`<script>window.__TOOLTIFY_URL__="${TOOLTIFY_URL}"</script>
|
|
29
|
+
<script src="${TOOLTIFY_URL}/tooltify.js" defer></script>
|
|
29
30
|
</head>`
|
|
30
31
|
);
|
|
31
32
|
compilation.updateAsset(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tooltify/integration-rspack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@rspack/core": "^1.7.8",
|
|
22
|
-
"@tooltify/core": "^0.1.
|
|
22
|
+
"@tooltify/core": "^0.1.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@tooltify/core": "*"
|