@tanstack/router-plugin 1.39.4 → 1.39.9

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.
Files changed (41) hide show
  1. package/dist/cjs/code-splitter.cjs +10 -6
  2. package/dist/cjs/code-splitter.cjs.map +1 -1
  3. package/dist/cjs/code-splitter.d.cts +1 -19
  4. package/dist/cjs/composed.cjs +16 -0
  5. package/dist/cjs/composed.cjs.map +1 -0
  6. package/dist/cjs/composed.d.cts +4 -0
  7. package/dist/cjs/index.cjs +2 -2
  8. package/dist/cjs/index.d.cts +2 -2
  9. package/dist/cjs/router-generator.cjs +10 -4
  10. package/dist/cjs/router-generator.cjs.map +1 -1
  11. package/dist/cjs/router-generator.d.cts +4 -18
  12. package/dist/cjs/rspack.cjs +20 -0
  13. package/dist/cjs/rspack.cjs.map +1 -0
  14. package/dist/cjs/rspack.d.cts +107 -0
  15. package/dist/cjs/vite.cjs +11 -9
  16. package/dist/cjs/vite.cjs.map +1 -1
  17. package/dist/cjs/vite.d.cts +48 -4
  18. package/dist/esm/code-splitter.d.ts +1 -19
  19. package/dist/esm/code-splitter.js +10 -6
  20. package/dist/esm/code-splitter.js.map +1 -1
  21. package/dist/esm/composed.d.ts +4 -0
  22. package/dist/esm/composed.js +16 -0
  23. package/dist/esm/composed.js.map +1 -0
  24. package/dist/esm/index.d.ts +2 -2
  25. package/dist/esm/index.js +4 -4
  26. package/dist/esm/router-generator.d.ts +4 -18
  27. package/dist/esm/router-generator.js +10 -4
  28. package/dist/esm/router-generator.js.map +1 -1
  29. package/dist/esm/rspack.d.ts +107 -0
  30. package/dist/esm/rspack.js +20 -0
  31. package/dist/esm/rspack.js.map +1 -0
  32. package/dist/esm/vite.d.ts +48 -4
  33. package/dist/esm/vite.js +13 -11
  34. package/dist/esm/vite.js.map +1 -1
  35. package/package.json +16 -2
  36. package/src/code-splitter.ts +27 -14
  37. package/src/composed.ts +30 -0
  38. package/src/index.ts +2 -2
  39. package/src/router-generator.ts +15 -8
  40. package/src/rspack.ts +74 -0
  41. package/src/vite.ts +40 -11
package/src/rspack.ts ADDED
@@ -0,0 +1,74 @@
1
+ import { createRspackPlugin } from 'unplugin'
2
+ import { unpluginRouterCodeSplitterFactory } from './code-splitter'
3
+ import { configSchema } from './config'
4
+ import { unpluginRouterGeneratorFactory } from './router-generator'
5
+ import { unpluginRouterComposedFactory } from './composed'
6
+ import type { Config } from './config'
7
+
8
+ /**
9
+ * @example
10
+ * ```ts
11
+ * export default defineConfig({
12
+ * // ...
13
+ * tools: {
14
+ * rspack: {
15
+ * plugins: [TanStackRouterGeneratorRspack()],
16
+ * },
17
+ * },
18
+ * })
19
+ * ```
20
+ */
21
+ const TanStackRouterGeneratorRspack = /* #__PURE__ */ createRspackPlugin(
22
+ unpluginRouterGeneratorFactory,
23
+ )
24
+
25
+ /**
26
+ * @experimental Do not use this plugin yet
27
+ *
28
+ * Unplugin's Rspack integration doesn't support the `resolveId` and `transform` hooks.
29
+ * The code-splitter won't work with Rspack and will probably break your dev and build.
30
+ *
31
+ * If you're familiar with Rspack and know how to overcome our `resolveId` and `transform`
32
+ * limitations, please let us know.
33
+ * We'd love to support it, but we're not sure how to do it yet 😅.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * export default defineConfig({
38
+ * // ...
39
+ * tools: {
40
+ * rspack: {
41
+ * plugins: [unstable_TanStackRouterCodeSplitterRspack()],
42
+ * },
43
+ * },
44
+ * })
45
+ * ```
46
+ */
47
+ const unstable_TanStackRouterCodeSplitterRspack =
48
+ /* #__PURE__ */ createRspackPlugin(unpluginRouterCodeSplitterFactory)
49
+
50
+ /**
51
+ * @example
52
+ * ```ts
53
+ * export default defineConfig({
54
+ * // ...
55
+ * tools: {
56
+ * rspack: {
57
+ * plugins: [TanStackRouterRspack()],
58
+ * },
59
+ * },
60
+ * })
61
+ * ```
62
+ */
63
+ const TanStackRouterRspack = /* #__PURE__ */ createRspackPlugin(
64
+ unpluginRouterComposedFactory,
65
+ )
66
+
67
+ export default TanStackRouterRspack
68
+ export {
69
+ configSchema,
70
+ TanStackRouterRspack,
71
+ TanStackRouterGeneratorRspack,
72
+ unstable_TanStackRouterCodeSplitterRspack,
73
+ }
74
+ export type { Config }
package/src/vite.ts CHANGED
@@ -1,20 +1,49 @@
1
- import { unpluginRouterCodeSplitter } from './code-splitter'
1
+ import { createVitePlugin } from 'unplugin'
2
+ import { unpluginRouterCodeSplitterFactory } from './code-splitter'
2
3
  import { configSchema } from './config'
3
- import { unpluginRouterGenerator } from './router-generator'
4
+ import { unpluginRouterGeneratorFactory } from './router-generator'
5
+ import { unpluginRouterComposedFactory } from './composed'
4
6
 
5
7
  import type { Config } from './config'
6
- import type { VitePlugin } from 'unplugin'
7
8
 
8
- const TanStackRouterGeneratorVite = unpluginRouterGenerator.vite
9
- const TanStackRouterCodeSplitterVite = unpluginRouterCodeSplitter.vite
9
+ /**
10
+ * @example
11
+ * ```ts
12
+ * export default defineConfig({
13
+ * plugins: [TanStackRouterGeneratorVite()],
14
+ * // ...
15
+ * })
16
+ * ```
17
+ */
18
+ const TanStackRouterGeneratorVite = createVitePlugin(
19
+ unpluginRouterGeneratorFactory,
20
+ )
10
21
 
11
- function TanStackRouterVite(inlineConfig?: Partial<Config>): Array<VitePlugin> {
12
- return [
13
- TanStackRouterGeneratorVite(inlineConfig) as VitePlugin,
14
- TanStackRouterCodeSplitterVite(inlineConfig) as VitePlugin,
15
- ]
16
- }
22
+ /**
23
+ * @example
24
+ * ```ts
25
+ * export default defineConfig({
26
+ * plugins: [TanStackRouterCodeSplitterVite()],
27
+ * // ...
28
+ * })
29
+ * ```
30
+ */
31
+ const TanStackRouterCodeSplitterVite = createVitePlugin(
32
+ unpluginRouterCodeSplitterFactory,
33
+ )
34
+
35
+ /**
36
+ * @example
37
+ * ```ts
38
+ * export default defineConfig({
39
+ * plugins: [TanStackRouterVite()],
40
+ * // ...
41
+ * })
42
+ * ```
43
+ */
44
+ const TanStackRouterVite = createVitePlugin(unpluginRouterComposedFactory)
17
45
 
46
+ export default TanStackRouterVite
18
47
  export {
19
48
  configSchema,
20
49
  TanStackRouterGeneratorVite,