@ecopages/react 0.2.0-alpha.9 → 0.2.1

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 (43) hide show
  1. package/CHANGELOG.md +13 -11
  2. package/README.md +10 -0
  3. package/package.json +6 -6
  4. package/src/react-hmr-strategy.d.ts +4 -2
  5. package/src/react-hmr-strategy.js +36 -3
  6. package/src/react-renderer.d.ts +25 -37
  7. package/src/react-renderer.js +190 -142
  8. package/src/react.plugin.d.ts +0 -12
  9. package/src/react.plugin.js +2 -13
  10. package/src/services/react-bundle.service.d.ts +3 -1
  11. package/src/services/react-bundle.service.js +20 -2
  12. package/src/services/react-hmr-page-metadata-cache.d.ts +9 -0
  13. package/src/services/react-hmr-page-metadata-cache.js +18 -2
  14. package/src/services/react-hydration-asset.service.d.ts +7 -6
  15. package/src/services/react-hydration-asset.service.js +26 -14
  16. package/src/services/react-page-module.service.js +5 -2
  17. package/src/services/react-runtime-bundle.service.d.ts +2 -0
  18. package/src/services/react-runtime-bundle.service.js +5 -0
  19. package/src/utils/client-graph-boundary-plugin.js +2 -2
  20. package/src/utils/declared-modules.js +4 -1
  21. package/src/utils/hydration-scripts.d.ts +1 -3
  22. package/src/utils/hydration-scripts.js +31 -19
  23. package/src/react-hmr-strategy.ts +0 -386
  24. package/src/react-renderer.ts +0 -803
  25. package/src/react.plugin.ts +0 -276
  26. package/src/router-adapter.ts +0 -95
  27. package/src/services/react-bundle.service.ts +0 -108
  28. package/src/services/react-hmr-page-metadata-cache.ts +0 -24
  29. package/src/services/react-hydration-asset.service.ts +0 -263
  30. package/src/services/react-page-module.service.ts +0 -224
  31. package/src/services/react-runtime-bundle.service.ts +0 -172
  32. package/src/utils/client-graph-boundary-plugin.ts +0 -831
  33. package/src/utils/client-only.ts +0 -27
  34. package/src/utils/declared-modules.ts +0 -99
  35. package/src/utils/dynamic.ts +0 -27
  36. package/src/utils/hmr-scripts.ts +0 -47
  37. package/src/utils/html-boundary.ts +0 -66
  38. package/src/utils/hydration-scripts.ts +0 -459
  39. package/src/utils/reachability-analyzer.ts +0 -593
  40. package/src/utils/react-dom-runtime-interop-plugin.ts +0 -33
  41. package/src/utils/react-mdx-loader-plugin.ts +0 -63
  42. package/src/utils/react-runtime-specifier-map.ts +0 -45
  43. package/src/utils/use-sync-external-store-shim-plugin.ts +0 -45
@@ -1,45 +0,0 @@
1
- import type { ReactRouterAdapter } from '../router-adapter.ts';
2
- import type { ReactRuntimeImports } from '../services/react-runtime-bundle.service.ts';
3
-
4
- export const REACT_RUNTIME_SPECIFIERS = [
5
- 'react',
6
- 'react-dom',
7
- 'react/jsx-runtime',
8
- 'react/jsx-dev-runtime',
9
- 'react-dom/client',
10
- ] as const;
11
-
12
- export function buildReactRuntimeSpecifierMap(
13
- runtimeImports: ReactRuntimeImports,
14
- routerAdapter?: ReactRouterAdapter,
15
- ): Record<string, string> {
16
- const map: Record<string, string> = {
17
- react: runtimeImports.react,
18
- 'react/jsx-runtime': runtimeImports.reactJsxRuntime,
19
- 'react/jsx-dev-runtime': runtimeImports.reactJsxDevRuntime,
20
- 'react-dom': runtimeImports.reactDom,
21
- 'react-dom/client': runtimeImports.reactDomClient,
22
- };
23
-
24
- if (routerAdapter && runtimeImports.router) {
25
- map[routerAdapter.importMapKey] = runtimeImports.router;
26
- }
27
-
28
- return map;
29
- }
30
-
31
- export function getReactRuntimeExternalSpecifiers(): string[] {
32
- return [...REACT_RUNTIME_SPECIFIERS];
33
- }
34
-
35
- export function getReactClientGraphAllowSpecifiers(
36
- runtimeSpecifiers: Iterable<string>,
37
- routerAdapter?: ReactRouterAdapter,
38
- ): string[] {
39
- return [
40
- '@ecopages/core',
41
- ...REACT_RUNTIME_SPECIFIERS,
42
- ...(routerAdapter ? [routerAdapter.importMapKey] : []),
43
- ...Array.from(runtimeSpecifiers),
44
- ];
45
- }
@@ -1,45 +0,0 @@
1
- import type { EcoBuildPlugin } from '@ecopages/core/build/build-types';
2
-
3
- export function createUseSyncExternalStoreShimPlugin(options?: { name?: string; namespace?: string }): EcoBuildPlugin {
4
- const namespace = options?.namespace ?? 'ecopages-react-use-sync-external-store-shim';
5
-
6
- return {
7
- name: options?.name ?? 'react-use-sync-external-store-shim',
8
- setup(build) {
9
- build.onResolve({ filter: /^use-sync-external-store\/shim(?:\/index\.js)?$/ }, () => ({
10
- path: 'use-sync-external-store/shim',
11
- namespace,
12
- }));
13
-
14
- build.onLoad({ filter: /^use-sync-external-store\/shim$/, namespace }, () => ({
15
- contents: "export { useSyncExternalStore } from 'react';",
16
- loader: 'js',
17
- }));
18
-
19
- build.onLoad({ filter: /[\\/]use-sync-external-store[\\/]shim[\\/]index\.js$/ }, () => ({
20
- contents: "export { useSyncExternalStore } from 'react';",
21
- loader: 'js',
22
- }));
23
-
24
- build.onLoad(
25
- {
26
- filter: /[\\/]use-sync-external-store[\\/]cjs[\\/]use-sync-external-store-shim\.development\.js$/,
27
- },
28
- () => ({
29
- contents: "export { useSyncExternalStore } from 'react';",
30
- loader: 'js',
31
- }),
32
- );
33
-
34
- build.onLoad(
35
- {
36
- filter: /[\\/]use-sync-external-store[\\/]cjs[\\/]use-sync-external-store-shim\.production\.js$/,
37
- },
38
- () => ({
39
- contents: "export { useSyncExternalStore } from 'react';",
40
- loader: 'js',
41
- }),
42
- );
43
- },
44
- };
45
- }