@tooltify/integration-rspack 0.1.3 → 0.1.5
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 +10 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// index.ts
|
|
2
|
+
import fs from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import { fileURLToPath } from "url";
|
|
4
|
-
import { startServer } from "@tooltify/core";
|
|
5
|
+
import { startServer, CLIENT_BUNDLE } from "@tooltify/core";
|
|
5
6
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
console.log(CLIENT_BUNDLE);
|
|
6
8
|
var CUSTOM_JSX_RUNTIME = path.resolve(__dirname, "./helpers/react-transform-source");
|
|
7
9
|
function rspackTooltify({ publicUrl } = {}) {
|
|
8
10
|
return {
|
|
@@ -20,13 +22,18 @@ function rspackTooltify({ publicUrl } = {}) {
|
|
|
20
22
|
compilation.hooks.processAssets.tap(
|
|
21
23
|
{ name: "tooltify", stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE },
|
|
22
24
|
(assets) => {
|
|
25
|
+
const clientCode = fs.readFileSync(CLIENT_BUNDLE);
|
|
26
|
+
compilation.emitAsset(
|
|
27
|
+
"tooltify.js",
|
|
28
|
+
new compiler.rspack.sources.RawSource(clientCode)
|
|
29
|
+
);
|
|
23
30
|
for (const name of Object.keys(assets)) {
|
|
24
31
|
if (name !== "index.html") continue;
|
|
25
32
|
const html = assets[name].source().toString();
|
|
26
33
|
const injected = html.replace(
|
|
27
34
|
"</head>",
|
|
28
|
-
`<script>window.__TOOLTIFY_URL__="${TOOLTIFY_URL}"
|
|
29
|
-
<script src="
|
|
35
|
+
`<script>window.__TOOLTIFY_URL__ = "${TOOLTIFY_URL}";</script>
|
|
36
|
+
<script src="/tooltify.js"></script>
|
|
30
37
|
</head>`
|
|
31
38
|
);
|
|
32
39
|
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.5",
|
|
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.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@tooltify/core": "*"
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"url": "https://github.com/franwerner/tooltify.git",
|
|
41
41
|
"directory": "integrations/rspack"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|