@tooltify/integration-rspack 0.1.10 → 0.2.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.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { RspackPluginInstance } from '@rspack/core';
2
- import { StartOptions } from '@tooltify/integration-shared';
2
+ import { BaseStartOptions } from '@tooltify/integration-shared';
3
3
 
4
- declare function rspackTooltify({ publicUrl }?: StartOptions): RspackPluginInstance;
4
+ interface RspackStartOptions extends BaseStartOptions {
5
+ }
6
+
7
+ declare function rspackTooltify({ publicUrl, react }?: RspackStartOptions): RspackPluginInstance;
5
8
 
6
9
  export { rspackTooltify };
package/dist/index.js CHANGED
@@ -1,21 +1,17 @@
1
1
  // index.ts
2
2
  import fs from "fs";
3
- import { createRequire } from "module";
4
3
  import { startServer, CLIENT_BUNDLE } from "@tooltify/core";
5
- var _require = createRequire(import.meta.url);
6
- var CUSTOM_JSX_RUNTIME = _require.resolve("@tooltify/integration-shared/source-transformers/react");
7
- function rspackTooltify({ publicUrl } = {}) {
4
+ import { createReactJsxRuntimeFile } from "@tooltify/integration-shared";
5
+ function rspackTooltify({ publicUrl, react } = {}) {
8
6
  return {
9
7
  apply(compiler) {
10
8
  const { config, port, buildTracker, cleanDeps } = startServer();
11
9
  const TOOLTIFY_URL = publicUrl ? publicUrl : `http://localhost:${port}`;
10
+ const content = createReactJsxRuntimeFile(config.packagesDir, react?.shouldInjectSource);
12
11
  new compiler.rspack.NormalModuleReplacementPlugin(
13
12
  /^react\/jsx-dev-runtime$/,
14
- CUSTOM_JSX_RUNTIME
13
+ `data:text/javascript,${encodeURIComponent(content)}`
15
14
  ).apply(compiler);
16
- new compiler.rspack.DefinePlugin({
17
- __TOOLTIFY_PACKAGES_DIR__: JSON.stringify(config.packagesDir)
18
- }).apply(compiler);
19
15
  compiler.hooks.compilation.tap("tooltify", (compilation) => {
20
16
  compilation.hooks.processAssets.tap(
21
17
  { name: "tooltify", stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooltify/integration-rspack",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,12 +18,16 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "@tooltify/core": "*",
22
- "@tooltify/integration-shared": "*"
21
+ "@tooltify/core": "latest",
22
+ "@tooltify/integration-shared": "latest"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@rspack/core": "^1.7.8"
26
26
  },
27
+ "devDependencies": {
28
+ "@tooltify/core": "*",
29
+ "@tooltify/integration-shared": "*"
30
+ },
27
31
  "files": [
28
32
  "dist"
29
33
  ],