@appshell/react 1.0.0-alpha.8 → 1.0.0-alpha.80

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 (141) hide show
  1. package/README.md +36 -49
  2. package/dist/main.js +1 -1
  3. package/dist/types/config/src/axios.d.ts +0 -1
  4. package/dist/types/config/src/configmap.d.ts +0 -1
  5. package/dist/types/config/src/context.d.ts +3 -4
  6. package/dist/types/config/src/credentials.d.ts +0 -2
  7. package/dist/types/config/src/generate.manifest.d.ts +30 -2
  8. package/dist/types/config/src/index.d.ts +7 -10
  9. package/dist/types/config/src/loader.d.ts +18 -0
  10. package/dist/types/config/src/mappers/appshell.config.d.ts +9 -3
  11. package/dist/types/config/src/outdated.d.ts +0 -1
  12. package/dist/types/config/src/publish.d.ts +79 -5
  13. package/dist/types/config/src/sync.d.ts +0 -1
  14. package/dist/types/config/src/tls.d.ts +23 -0
  15. package/dist/types/config/src/types.d.ts +164 -30
  16. package/dist/types/config/src/utils/blur.d.ts +0 -1
  17. package/dist/types/config/src/utils/compare.d.ts +0 -1
  18. package/dist/types/config/src/utils/config.d.ts +0 -1
  19. package/dist/types/config/src/utils/copy.d.ts +0 -1
  20. package/dist/types/config/src/utils/dump.d.ts +10 -0
  21. package/dist/types/config/src/utils/index.d.ts +1 -4
  22. package/dist/types/config/src/utils/list.d.ts +0 -1
  23. package/dist/types/config/src/utils/load.d.ts +0 -1
  24. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
  25. package/dist/types/config/src/validators/index.d.ts +0 -3
  26. package/dist/types/loader/src/index.d.ts +0 -1
  27. package/dist/types/loader/src/loadAppshellComponent.d.ts +13 -14
  28. package/dist/types/loader/src/remoteLoader.d.ts +2 -3
  29. package/dist/types/loader/src/resolvers.d.ts +4 -12
  30. package/dist/types/loader/src/types.d.ts +0 -1
  31. package/dist/types/react/src/components/LoadingError.d.ts +0 -1
  32. package/dist/types/react/src/components/RemoteSlot.d.ts +28 -0
  33. package/dist/types/react/src/contexts/RemoteContext.d.ts +2 -4
  34. package/dist/types/react/src/hooks/useRemote.d.ts +1 -2
  35. package/dist/types/react/src/index.d.ts +2 -9
  36. package/dist/types/react/src/resources/jsonResource.d.ts +0 -1
  37. package/dist/types/react/src/types.d.ts +0 -1
  38. package/dist/types/runtime/src/errors.d.ts +32 -0
  39. package/dist/types/runtime/src/identity.d.ts +47 -0
  40. package/dist/types/runtime/src/index.d.ts +6 -0
  41. package/dist/types/runtime/src/store.d.ts +25 -0
  42. package/dist/types/runtime/src/types.d.ts +9 -0
  43. package/dist/types/runtime/src/wire.d.ts +58 -0
  44. package/package.json +14 -4
  45. package/CHANGELOG.md +0 -203
  46. package/__tests__/AppshellComponent.spec.tsx +0 -53
  47. package/__tests__/LoadingError.spec.tsx +0 -14
  48. package/__tests__/ManifestContext.spec.tsx +0 -50
  49. package/__tests__/ReactHost.spec.tsx +0 -136
  50. package/__tests__/__snapshots__/AppshellComponent.spec.tsx.snap +0 -9
  51. package/__tests__/__snapshots__/LoadingError.spec.tsx.snap +0 -88
  52. package/__tests__/__snapshots__/ReactHost.spec.tsx.snap +0 -11
  53. package/__tests__/fixtures/Manifest.ts +0 -16
  54. package/__tests__/fixtures/TestComponent.tsx +0 -5
  55. package/__tests__/fixtures/TestGlobalConfig.ts +0 -8
  56. package/__tests__/jsonResource.spec.ts +0 -27
  57. package/__tests__/useRemote.spec.tsx +0 -36
  58. package/__tests__/utils/waitForResource.ts +0 -15
  59. package/dist/types/config/src/axios.d.ts.map +0 -1
  60. package/dist/types/config/src/configmap.d.ts.map +0 -1
  61. package/dist/types/config/src/context.d.ts.map +0 -1
  62. package/dist/types/config/src/credentials.d.ts.map +0 -1
  63. package/dist/types/config/src/deregister.d.ts +0 -3
  64. package/dist/types/config/src/deregister.d.ts.map +0 -1
  65. package/dist/types/config/src/generate.env.d.ts +0 -3
  66. package/dist/types/config/src/generate.env.d.ts.map +0 -1
  67. package/dist/types/config/src/generate.global-config.d.ts +0 -10
  68. package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
  69. package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
  70. package/dist/types/config/src/index.d.ts.map +0 -1
  71. package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
  72. package/dist/types/config/src/outdated.d.ts.map +0 -1
  73. package/dist/types/config/src/publish.d.ts.map +0 -1
  74. package/dist/types/config/src/register.d.ts +0 -4
  75. package/dist/types/config/src/register.d.ts.map +0 -1
  76. package/dist/types/config/src/sync.d.ts.map +0 -1
  77. package/dist/types/config/src/types.d.ts.map +0 -1
  78. package/dist/types/config/src/utils/blur.d.ts.map +0 -1
  79. package/dist/types/config/src/utils/compare.d.ts.map +0 -1
  80. package/dist/types/config/src/utils/config.d.ts.map +0 -1
  81. package/dist/types/config/src/utils/copy.d.ts.map +0 -1
  82. package/dist/types/config/src/utils/index.d.ts.map +0 -1
  83. package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
  84. package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
  85. package/dist/types/config/src/utils/list.d.ts.map +0 -1
  86. package/dist/types/config/src/utils/load.d.ts.map +0 -1
  87. package/dist/types/config/src/utils/loadJson.d.ts +0 -10
  88. package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
  89. package/dist/types/config/src/utils/merge.d.ts +0 -4
  90. package/dist/types/config/src/utils/merge.d.ts.map +0 -1
  91. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
  92. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
  93. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
  94. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
  95. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
  96. package/dist/types/config/src/validators/index.d.ts.map +0 -1
  97. package/dist/types/loader/src/fetchDynamicScript.d.ts +0 -3
  98. package/dist/types/loader/src/fetchDynamicScript.d.ts.map +0 -1
  99. package/dist/types/loader/src/index.d.ts.map +0 -1
  100. package/dist/types/loader/src/loadAppshellComponent.d.ts.map +0 -1
  101. package/dist/types/loader/src/remoteLoader.d.ts.map +0 -1
  102. package/dist/types/loader/src/resolvers.d.ts.map +0 -1
  103. package/dist/types/loader/src/types.d.ts.map +0 -1
  104. package/dist/types/react/src/components/AppshellComponent.d.ts +0 -30
  105. package/dist/types/react/src/components/AppshellComponent.d.ts.map +0 -1
  106. package/dist/types/react/src/components/LoadingError.d.ts.map +0 -1
  107. package/dist/types/react/src/components/ReactHost.d.ts +0 -9
  108. package/dist/types/react/src/components/ReactHost.d.ts.map +0 -1
  109. package/dist/types/react/src/contexts/GlobalConfigContext.d.ts +0 -11
  110. package/dist/types/react/src/contexts/GlobalConfigContext.d.ts.map +0 -1
  111. package/dist/types/react/src/contexts/ManifestContext.d.ts +0 -12
  112. package/dist/types/react/src/contexts/ManifestContext.d.ts.map +0 -1
  113. package/dist/types/react/src/contexts/MetadataContext.d.ts +0 -11
  114. package/dist/types/react/src/contexts/MetadataContext.d.ts.map +0 -1
  115. package/dist/types/react/src/contexts/RemoteContext.d.ts.map +0 -1
  116. package/dist/types/react/src/hooks/useGlobalConfig.d.ts +0 -4
  117. package/dist/types/react/src/hooks/useGlobalConfig.d.ts.map +0 -1
  118. package/dist/types/react/src/hooks/useManifest.d.ts +0 -4
  119. package/dist/types/react/src/hooks/useManifest.d.ts.map +0 -1
  120. package/dist/types/react/src/hooks/useMetadata.d.ts +0 -4
  121. package/dist/types/react/src/hooks/useMetadata.d.ts.map +0 -1
  122. package/dist/types/react/src/hooks/useRemote.d.ts.map +0 -1
  123. package/dist/types/react/src/index.d.ts.map +0 -1
  124. package/dist/types/react/src/resources/jsonResource.d.ts.map +0 -1
  125. package/dist/types/react/src/types.d.ts.map +0 -1
  126. package/src/components/AppshellComponent.tsx +0 -82
  127. package/src/components/LoadingError.tsx +0 -15
  128. package/src/components/ReactHost.tsx +0 -55
  129. package/src/contexts/GlobalConfigContext.tsx +0 -17
  130. package/src/contexts/ManifestContext.tsx +0 -40
  131. package/src/contexts/MetadataContext.tsx +0 -17
  132. package/src/contexts/RemoteContext.tsx +0 -22
  133. package/src/hooks/useGlobalConfig.ts +0 -7
  134. package/src/hooks/useManifest.ts +0 -7
  135. package/src/hooks/useMetadata.ts +0 -6
  136. package/src/hooks/useRemote.ts +0 -7
  137. package/src/index.ts +0 -11
  138. package/src/resources/jsonResource.ts +0 -35
  139. package/src/types.ts +0 -3
  140. package/tsconfig.json +0 -7
  141. package/webpack.config.js +0 -42
@@ -0,0 +1,58 @@
1
+ /**
2
+ * What the browser is told about a remote.
3
+ *
4
+ * These live here rather than in `@appshell/config` because config is build tooling — it
5
+ * carries yaml, lodash and axios — and a package that only wants to type a remote should
6
+ * not install a compiler to get it. This package is already the one every micro-frontend
7
+ * on the page shares, and it has no dependencies of its own to pass on.
8
+ *
9
+ * `AppshellManifest` deliberately stays in `@appshell/config`. It is a build artifact, and
10
+ * its `modules` field is Module Federation plugin options — build-time webpack
11
+ * configuration the browser never sees and this package should never drag in.
12
+ */
13
+ /** Arbitrary, application-defined description of a remote. Appshell never reads it. */
14
+ export type Metadata = Record<string, unknown>;
15
+ /**
16
+ * How a host loads a remote, named as one kind among possible kinds.
17
+ *
18
+ * scope, module and shareScope are Module Federation's vocabulary, and they used to sit
19
+ * at the top level of a remote where nothing said so — which is what would have made a
20
+ * second framework awkward, not the words themselves. Nested under a kind they are
21
+ * exactly correct, and something like single-spa slots beside them without reinterpreting
22
+ * anything already published.
23
+ *
24
+ * apiVersion follows the house style set by appshell.app.yaml, and the group is appshell's
25
+ * because appshell owns this schema: it decides which fields it stores, even though the
26
+ * fields describe federation concepts. If federation ever needs a different recipe that is
27
+ * a v2, and manifests published under v1 keep meaning what they meant — which matters,
28
+ * because they are immutable and hashed.
29
+ */
30
+ export type ModuleFederationLoader = {
31
+ apiVersion: 'federation.appshell.org/v1';
32
+ kind: 'ModuleFederation';
33
+ scope: string;
34
+ module: string;
35
+ shareScope?: string;
36
+ /** The entry file the build emits, conventionally remoteEntry.js. */
37
+ filename: string;
38
+ /**
39
+ * What built this, recorded as a fact rather than a constraint.
40
+ *
41
+ * Deliberately not a version range. A range is a claim about the environment, and a
42
+ * package cannot make it: it knows what built it and not what will load it, and the
43
+ * host is what registers the remote. Freezing one into an immutable artifact is the
44
+ * same mistake as freezing its origin.
45
+ */
46
+ builtWith?: string;
47
+ };
48
+ export type RemoteLoader = ModuleFederationLoader;
49
+ /** A remote the registry has already resolved, so the browser needs no manifest fetch. */
50
+ export type AppshellRemote<TMetadata = Metadata> = {
51
+ id: string;
52
+ manifestUrl: string;
53
+ remoteEntryUrl: string;
54
+ loader: RemoteLoader;
55
+ metadata: TMetadata;
56
+ };
57
+ /** Remote key to manifest url. */
58
+ export type AppshellIndex = Record<string, string>;
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@appshell/react",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.80",
4
4
  "description": "React utilities for building micro-frontends with Appshell and Module Federation",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/types/react/src/index.d.ts",
7
- "repository": "https://github.com/appshell-org/appshell.git",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/appshellhq/appshell.git"
10
+ },
8
11
  "author": "Robert Hamilton <rh@navaris.com>",
9
12
  "publishConfig": {
10
13
  "access": "public",
@@ -15,8 +18,12 @@
15
18
  "build:types": "tsc --emitDeclarationOnly",
16
19
  "clean": "rm -rf dist",
17
20
  "start": "webpack --watch --mode development --stats-error-details",
18
- "stats": "webpack --json > stats.json"
21
+ "stats": "webpack --json > stats.json",
22
+ "typecheck": "tsc --noEmit"
19
23
  },
24
+ "files": [
25
+ "dist"
26
+ ],
20
27
  "keywords": [
21
28
  "module federation",
22
29
  "micro-frontends",
@@ -27,5 +34,8 @@
27
34
  "react": "^18.2.0",
28
35
  "react-dom": "^18.2.0"
29
36
  },
30
- "gitHead": "ced8839a7c8423ad723fb32f9388e0e3d15951eb"
37
+ "gitHead": "17dbb8bbb3910247a14952dc8b6870927cba63b9",
38
+ "dependencies": {
39
+ "@appshell/runtime": "^1.0.0-alpha.80"
40
+ }
31
41
  }
package/CHANGELOG.md DELETED
@@ -1,203 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [1.0.0-alpha.8](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2026-08-19)
7
-
8
- **Note:** Version bump only for package @appshell/react
9
-
10
- # [1.0.0-alpha.7](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2026-08-18)
11
-
12
- **Note:** Version bump only for package @appshell/react
13
-
14
- **Note:** Version bump only for package @appshell/react
15
-
16
- # [1.0.0-alpha.6](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2026-08-18)
17
-
18
- **Note:** Version bump only for package @appshell/react
19
-
20
- # [1.0.0-alpha.5](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2026-08-18)
21
-
22
- **Note:** Version bump only for package @appshell/react
23
-
24
- **Note:** Version bump only for package @appshell/react
25
-
26
- # [1.0.0-alpha.4](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2026-08-18)
27
-
28
- **Note:** Version bump only for package @appshell/react
29
-
30
- **Note:** Version bump only for package @appshell/react
31
-
32
- # [1.0.0-alpha.3](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2026-08-18)
33
-
34
- **Note:** Version bump only for package @appshell/react
35
-
36
- # 0.12.0-alpha.0 (2026-04-20)
37
-
38
- ### Bug Fixes
39
-
40
- - appshell loader override check ([aedda4a](https://github.com/appshell-org/appshell/commit/aedda4abf81560297dce03df09fba68e8785242f))
41
- - capture direct dependencies passed to FederatedComponent for re-render ([3621879](https://github.com/appshell-org/appshell/commit/36218793a5cb47f74bd8d1ce93deffdb1b85cd1c))
42
- - rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/appshell-org/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
43
- - update repository URLs from navaris/appshell to appshell-org/appshell ([506a90d](https://github.com/appshell-org/appshell/commit/506a90d94a6f6e10f463987d408550f48624bfd0))
44
-
45
- ### Features
46
-
47
- - api key support ([9cdcbee](https://github.com/appshell-org/appshell/commit/9cdcbee36e44b8a179b49768d74a25767f1cc5f2))
48
- - AppshellComponent impl ([2b82621](https://github.com/appshell-org/appshell/commit/2b82621c13302f790a8e1c457f9a82f39903fc1f))
49
- - consolidate runtime artifacts ([#26](https://github.com/appshell-org/appshell/issues/26)) ([a29479a](https://github.com/appshell-org/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
50
-
51
- ## [0.4.1-alpha.0](https://github.com/appshell-org/appshell/compare/@appshell/react@0.4.0...@appshell/react@0.4.1-alpha.0) (2026-04-20)
52
-
53
- ### Bug Fixes
54
-
55
- - update repository URLs from navaris/appshell to appshell-org/appshell ([506a90d](https://github.com/appshell-org/appshell/commit/506a90d94a6f6e10f463987d408550f48624bfd0))
56
-
57
- # [0.4.0](https://github.com/navaris/appshell/compare/@appshell/react@0.3.0...@appshell/react@0.4.0) (2024-09-24)
58
-
59
- ### Features
60
-
61
- - api key support ([9cdcbee](https://github.com/navaris/appshell/commit/9cdcbee36e44b8a179b49768d74a25767f1cc5f2))
62
-
63
- # [0.4.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react@0.3.1-alpha.0...@appshell/react@0.4.0-alpha.0) (2024-09-05)
64
-
65
- ### Features
66
-
67
- - api key support ([8c91e62](https://github.com/navaris/appshell/commit/8c91e6240b3d879af9bdd5949924865da0e0f8a1))
68
-
69
- ## [0.3.1-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react@0.3.0...@appshell/react@0.3.1-alpha.0) (2024-08-31)
70
-
71
- ### Bug Fixes
72
-
73
- - bump pipeline ([8bb63bc](https://github.com/navaris/appshell/commit/8bb63bcae1928c01bb6bc853d88010939e686af5))
74
-
75
- # [0.3.0](https://github.com/navaris/appshell/compare/@appshell/react@0.2.2...@appshell/react@0.3.0) (2024-01-25)
76
-
77
- ### Features
78
-
79
- - AppshellComponent impl ([2b82621](https://github.com/navaris/appshell/commit/2b82621c13302f790a8e1c457f9a82f39903fc1f))
80
-
81
- ## [0.2.2](https://github.com/navaris/appshell/compare/@appshell/react@0.2.1...@appshell/react@0.2.2) (2024-01-04)
82
-
83
- ### Bug Fixes
84
-
85
- - capture direct dependencies passed to FederatedComponent for re-render ([3621879](https://github.com/navaris/appshell/commit/36218793a5cb47f74bd8d1ce93deffdb1b85cd1c))
86
-
87
- ## [0.2.1](https://github.com/navaris/appshell/compare/@appshell/react@0.2.0...@appshell/react@0.2.1) (2023-08-29)
88
-
89
- ### Bug Fixes
90
-
91
- - appshell loader override check ([aedda4a](https://github.com/navaris/appshell/commit/aedda4abf81560297dce03df09fba68e8785242f))
92
-
93
- # [0.2.0](https://github.com/navaris/appshell/compare/@appshell/react@0.2.0-alpha.0...@appshell/react@0.2.0) (2023-08-28)
94
-
95
- **Note:** Version bump only for package @appshell/react
96
-
97
- # [0.2.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react@0.1.0...@appshell/react@0.2.0-alpha.0) (2023-08-23)
98
-
99
- ### Features
100
-
101
- - consolidate runtime artifacts ([#26](https://github.com/navaris/appshell/issues/26)) ([a29479a](https://github.com/navaris/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
102
-
103
- # [0.1.0](https://github.com/navaris/appshell/compare/@appshell/react@0.1.0-alpha.6...@appshell/react@0.1.0) (2023-07-11)
104
-
105
- **Note:** Version bump only for package @appshell/react
106
-
107
- # 0.1.0-alpha.6 (2023-07-10)
108
-
109
- ### Bug Fixes
110
-
111
- - rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/navaris/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
112
-
113
- # [0.1.0-alpha.5](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.1.0-alpha.4...@appshell/react-federated-component@0.1.0-alpha.5) (2023-07-10)
114
-
115
- ### Bug Fixes
116
-
117
- - registry projection, enable env overwrite, refactor docker workflow, consolidate env names ([33a28fe](https://github.com/navaris/appshell/commit/33a28fe76b58e05c5b6b6b33d4b402e52bb29e70))
118
-
119
- # [0.1.0-alpha.4](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.1.0-alpha.3...@appshell/react-federated-component@0.1.0-alpha.4) (2023-07-06)
120
-
121
- ### Bug Fixes
122
-
123
- - metadata urls ([efcce1c](https://github.com/navaris/appshell/commit/efcce1ce4cb1745afa83661cae1414a73f837483))
124
-
125
- # [0.1.0-alpha.3](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.1.0-alpha.2...@appshell/react-federated-component@0.1.0-alpha.3) (2023-07-06)
126
-
127
- ### Bug Fixes
128
-
129
- - support metadata generation ([4df202f](https://github.com/navaris/appshell/commit/4df202f0fd3b9ca6c660975b75eb0ac9b60225c2))
130
-
131
- # [0.1.0-alpha.2](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.1.0-alpha.1...@appshell/react-federated-component@0.1.0-alpha.2) (2023-07-06)
132
-
133
- ### Bug Fixes
134
-
135
- - lint ([a4861ab](https://github.com/navaris/appshell/commit/a4861abfe82d1e0ab815aaa62cdf7907229d0136))
136
-
137
- ### Features
138
-
139
- - appshell start, cleanup dev workflow ([74fd2e5](https://github.com/navaris/appshell/commit/74fd2e5a5acd2415482268175c7f3f16cd7c93ec))
140
-
141
- # [0.1.0-alpha.1](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.3...@appshell/react-federated-component@0.1.0-alpha.1) (2023-07-05)
142
-
143
- ### Features
144
-
145
- - foundation refactor wip ([339b930](https://github.com/navaris/appshell/commit/339b9306accaa9aba1712f3a0dee6c4cab7ed273))
146
-
147
- # [0.1.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.3...@appshell/react-federated-component@0.1.0-alpha.0) (2023-07-05)
148
-
149
- ### Features
150
-
151
- - registry index ([8e6ee0a](https://github.com/navaris/appshell/commit/8e6ee0a6a377584efa2ee702168025f46108b8c5))
152
-
153
- ## [0.0.3](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.3-alpha.2...@appshell/react-federated-component@0.0.3) (2023-06-29)
154
-
155
- **Note:** Version bump only for package @appshell/react-federated-component
156
-
157
- ## [0.0.3-alpha.2](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.2...@appshell/react-federated-component@0.0.3-alpha.2) (2023-06-29)
158
-
159
- **Note:** Version bump only for package @appshell/react-federated-component
160
-
161
- ## [0.0.3-alpha.1](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.3-alpha.0...@appshell/react-federated-component@0.0.3-alpha.1) (2023-06-29)
162
-
163
- ### Bug Fixes
164
-
165
- - update npm package visibility ([1ef4119](https://github.com/navaris/appshell/commit/1ef411903dd038dfc781e8ce0700811e5460c903))
166
-
167
- ## [0.0.3-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.2-alpha.1...@appshell/react-federated-component@0.0.3-alpha.0) (2023-06-29)
168
-
169
- **Note:** Version bump only for package @appshell/react-federated-component
170
-
171
- ## [0.0.2](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.2-alpha.1...@appshell/react-federated-component@0.0.2) (2023-06-29)
172
-
173
- **Note:** Version bump only for package @appshell/react-federated-component
174
-
175
- ## [0.0.2-alpha.1](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.2-alpha.0...@appshell/react-federated-component@0.0.2-alpha.1) (2023-06-24)
176
-
177
- ### Bug Fixes
178
-
179
- - add useEffect dependencies for federated component ([616039e](https://github.com/navaris/appshell/commit/616039ebb3f46f34db0b82acfb6ee5438a6b4731))
180
-
181
- ## [0.0.2-alpha.0](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.1...@appshell/react-federated-component@0.0.2-alpha.0) (2023-06-15)
182
-
183
- ### Bug Fixes
184
-
185
- - hot module replacement support, example updates ([a67d230](https://github.com/navaris/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
186
-
187
- ## 0.0.1 (2023-06-15)
188
-
189
- **Note:** Version bump only for package @appshell/react-federated-component
190
-
191
- ## [0.0.1-alpha.2](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.1-alpha.1...@appshell/react-federated-component@0.0.1-alpha.2) (2023-06-15)
192
-
193
- ### Bug Fixes
194
-
195
- - hot module replacement support, example updates ([a67d230](https://github.com/navaris/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
196
-
197
- ## [0.0.1-alpha.1](https://github.com/navaris/appshell/compare/@appshell/react-federated-component@0.0.1-alpha.0...@appshell/react-federated-component@0.0.1-alpha.1) (2023-03-19)
198
-
199
- **Note:** Version bump only for package @appshell/react-federated-component
200
-
201
- ## 0.0.1-alpha.0 (2023-03-19)
202
-
203
- **Note:** Version bump only for package @appshell/react-federated-component
@@ -1,53 +0,0 @@
1
- /** @jest-environment jsdom */
2
- import * as remoteLoader from '@appshell/loader';
3
- import '@testing-library/jest-dom';
4
- import { act, render, screen } from '@testing-library/react';
5
- import React from 'react';
6
- import AppshellComponent from '../src/components/AppshellComponent';
7
- import * as useGlobalConfig from '../src/hooks/useGlobalConfig';
8
- import manifest from './fixtures/Manifest';
9
- import TestComponent from './fixtures/TestComponent';
10
- import config from './fixtures/TestGlobalConfig';
11
-
12
- jest.mock('../src/hooks/useGlobalConfig');
13
-
14
- const TestFallback = () => <div>loading...</div>;
15
-
16
- describe('AppshellComponent', () => {
17
- it('should match snapshot', async () => {
18
- jest.spyOn(useGlobalConfig, 'default').mockReturnValue(config);
19
- jest.spyOn(remoteLoader, 'default').mockReturnValueOnce(async () => [TestComponent, manifest]);
20
-
21
- const { container, findByText } = await act(() =>
22
- render(<AppshellComponent remote="TestModule/TestComponent" />),
23
- );
24
- const view = await findByText(/test component/i);
25
-
26
- expect(view).toBeInTheDocument();
27
- expect(container).toMatchSnapshot();
28
- });
29
-
30
- it('should render fallback while resource is pending', async () => {
31
- jest.spyOn(useGlobalConfig, 'default').mockReturnValue(config);
32
- jest.spyOn(remoteLoader, 'default').mockReturnValueOnce(() => [null, null]);
33
-
34
- await act(() =>
35
- render(<AppshellComponent remote="TestModule/TestComponent" fallback={<TestFallback />} />),
36
- );
37
-
38
- expect(screen.getByText(/loading/i)).toBeInTheDocument();
39
- });
40
-
41
- it('should render error when resource fails', async () => {
42
- jest.spyOn(useGlobalConfig, 'default').mockReturnValue(config);
43
- jest
44
- .spyOn(remoteLoader, 'default')
45
- .mockImplementationOnce(() => new Error('Failed to get resource'));
46
-
47
- await act(() =>
48
- render(<AppshellComponent remote="TestModule/TestComponent" fallback={<TestFallback />} />),
49
- );
50
-
51
- expect(screen.getByText(/Error loading Appshell component/i)).toBeInTheDocument();
52
- });
53
- });
@@ -1,14 +0,0 @@
1
- /** @jest-environment jsdom */
2
- import { render } from '@testing-library/react';
3
- import React from 'react';
4
- import LoadingError from '../src/components/LoadingError';
5
-
6
- describe('LoadingError', () => {
7
- it('should match snapshot', () => {
8
- const view = render(
9
- <LoadingError remote="TestModule/TestComponent" reason="Could not find component" />,
10
- );
11
-
12
- expect(view).toMatchSnapshot();
13
- });
14
- });
@@ -1,50 +0,0 @@
1
- /** @jest-environment jsdom */
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import React from 'react';
5
- import { ManifestProvider } from '../src/contexts/ManifestContext';
6
- import useManifest from '../src/hooks/useManifest';
7
- import manifest from './fixtures/Manifest';
8
- import TestComponent from './fixtures/TestComponent';
9
-
10
- const ComponentUsingManifest = () => {
11
- const res = useManifest();
12
-
13
- return <div>{JSON.stringify(res.remotes)}</div>;
14
- };
15
-
16
- describe('ManifestProvider', () => {
17
- it('should render children', async () => {
18
- render(
19
- <ManifestProvider manifest={manifest}>
20
- <TestComponent />
21
- </ManifestProvider>,
22
- );
23
-
24
- await expect(screen.getByText(/test component/i)).toBeInTheDocument();
25
- });
26
-
27
- it('should make the manifest context available', async () => {
28
- render(
29
- <ManifestProvider manifest={manifest}>
30
- <ComponentUsingManifest />
31
- </ManifestProvider>,
32
- );
33
-
34
- await expect(screen.getByText(/TestModule\/TestComponent/i)).toBeInTheDocument();
35
- });
36
-
37
- it('should warn when a consumer reads the deprecated modules field', () => {
38
- const warn = jest.spyOn(console, 'warn').mockImplementation(() => {});
39
- const ComponentUsingModules = () => <div>{Object.keys(useManifest().modules).length}</div>;
40
-
41
- render(
42
- <ManifestProvider manifest={manifest}>
43
- <ComponentUsingModules />
44
- </ManifestProvider>,
45
- );
46
-
47
- expect(warn).toHaveBeenCalledWith(expect.stringMatching(/modules is deprecated/i));
48
- warn.mockRestore();
49
- });
50
- });
@@ -1,136 +0,0 @@
1
- /** @jest-environment jsdom */
2
- import '@testing-library/jest-dom';
3
- import { act, render, screen } from '@testing-library/react';
4
- import fetch, { enableFetchMocks } from 'jest-fetch-mock';
5
- import React from 'react';
6
- import * as AppshellComponent from '../src/components/AppshellComponent';
7
- import ReactHost from '../src/components/ReactHost';
8
-
9
- enableFetchMocks();
10
-
11
- jest.mock('@appshell/core', () => ({
12
- APPSHELL_ENV: {
13
- APPSHELL_REGISTRY: 'appshell_registry',
14
- APPSHELL_PUBLIC_URL: 'http://test.com',
15
- APPSHELL_ROOT: 'TestModule/TestComponent',
16
- APPSHELL_ROOT_PROPS: '{"foo":"bar"}',
17
- },
18
- }));
19
-
20
- jest.mock('../src/components/AppshellComponent', () => ({
21
- __esModule: true,
22
- default: () => <div>test component</div>,
23
- }));
24
-
25
- describe('RenderHost', () => {
26
- const configUrl = 'http://test.com/appshell.config.json';
27
- const remote = 'TestModule/TestComponent';
28
-
29
- let useState: jest.SpyInstance;
30
- const mockUseState = (val) => {
31
- useState.mockImplementationOnce(() => [val, () => {}]);
32
- };
33
-
34
- beforeEach(() => {
35
- useState = jest.spyOn(React, 'useState');
36
- fetch.mockIf(
37
- (req) => req.url === 'http://test.com/appshell.config.json',
38
- () => Promise.resolve({ ok: true, body: JSON.stringify({ test: 'data' }) }),
39
- );
40
- });
41
-
42
- afterEach(() => {
43
- useState.mockReset();
44
- });
45
-
46
- it('should match snapshot', async () => {
47
- mockUseState({ config: 'foo' });
48
- const { container } = await act(() =>
49
- render(<ReactHost configUrl={configUrl} remote={remote} fallback="Loading" />),
50
- );
51
-
52
- expect(container).toMatchSnapshot();
53
- });
54
-
55
- it('should render empty when config is pending', async () => {
56
- mockUseState(undefined);
57
- const { container } = render(
58
- <ReactHost configUrl={configUrl} remote={remote} fallback="Loading" />,
59
- );
60
-
61
- expect(container).toMatchSnapshot();
62
- });
63
-
64
- it('should render component when config is available', async () => {
65
- mockUseState({ config: 'foo' });
66
- await act(() => render(<ReactHost configUrl={configUrl} remote={remote} fallback="Loading" />));
67
-
68
- expect(screen.getByText(/test component/i)).toBeInTheDocument();
69
- });
70
-
71
- it('should pass props to Appshell component when available', async () => {
72
- mockUseState({ config: 'foo' });
73
- const appshellComponentSpy = jest.spyOn(AppshellComponent, 'default');
74
- await act(() =>
75
- render(<ReactHost configUrl={configUrl} remote={remote} foo="bar" fallback="Loading" />),
76
- );
77
-
78
- expect(screen.getByText(/test component/i)).toBeInTheDocument();
79
-
80
- expect(appshellComponentSpy).toHaveBeenCalledWith(
81
- { fallback: 'Loading', foo: 'bar', remote: 'TestModule/TestComponent' },
82
- {},
83
- );
84
- });
85
-
86
- describe('when the registry inlined the composition', () => {
87
- afterEach(() => {
88
- delete window.__appshell_config__;
89
- });
90
-
91
- const inline = (index = { 'TestModule/TestComponent': 'http://test.com/manifest.json' }) => {
92
- window.__appshell_config__ = {
93
- environmentId: 'acme/prod',
94
- revision: 1,
95
- root: remote,
96
- rootProps: {},
97
- index,
98
- remotes: {},
99
- environment: {},
100
- };
101
- };
102
-
103
- it('should render without fetching a config', async () => {
104
- inline();
105
- useState.mockRestore();
106
- fetch.resetMocks();
107
-
108
- await act(() => render(<ReactHost remote={remote} fallback="Loading" />));
109
-
110
- expect(screen.getByText(/test component/i)).toBeInTheDocument();
111
- expect(fetch).not.toHaveBeenCalled();
112
- });
113
-
114
- it('should prefer the inlined config over a configUrl', async () => {
115
- inline();
116
- useState.mockRestore();
117
- fetch.resetMocks();
118
-
119
- await act(() =>
120
- render(<ReactHost configUrl={configUrl} remote={remote} fallback="Loading" />),
121
- );
122
-
123
- expect(fetch).not.toHaveBeenCalled();
124
- });
125
- });
126
-
127
- it('should render with an empty index when neither a config nor a url is available', async () => {
128
- useState.mockRestore();
129
- fetch.resetMocks();
130
-
131
- await act(() => render(<ReactHost remote={remote} fallback="Loading" />));
132
-
133
- expect(screen.getByText(/test component/i)).toBeInTheDocument();
134
- expect(fetch).not.toHaveBeenCalled();
135
- });
136
- });
@@ -1,9 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AppshellComponent should match snapshot 1`] = `
4
- <div>
5
- <div>
6
- test component
7
- </div>
8
- </div>
9
- `;
@@ -1,88 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`LoadingError should match snapshot 1`] = `
4
- {
5
- "asFragment": [Function],
6
- "baseElement": <body>
7
- <div>
8
- <div
9
- style="border: 3px solid red;"
10
- >
11
- <h5>
12
- Error loading Appshell component 'TestModule/TestComponent.'
13
- </h5>
14
- <span
15
- style="font-size: 1rem;"
16
- >
17
- Could not find component
18
- </span>
19
- </div>
20
- </div>
21
- </body>,
22
- "container": <div>
23
- <div
24
- style="border: 3px solid red;"
25
- >
26
- <h5>
27
- Error loading Appshell component 'TestModule/TestComponent.'
28
- </h5>
29
- <span
30
- style="font-size: 1rem;"
31
- >
32
- Could not find component
33
- </span>
34
- </div>
35
- </div>,
36
- "debug": [Function],
37
- "findAllByAltText": [Function],
38
- "findAllByDisplayValue": [Function],
39
- "findAllByLabelText": [Function],
40
- "findAllByPlaceholderText": [Function],
41
- "findAllByRole": [Function],
42
- "findAllByTestId": [Function],
43
- "findAllByText": [Function],
44
- "findAllByTitle": [Function],
45
- "findByAltText": [Function],
46
- "findByDisplayValue": [Function],
47
- "findByLabelText": [Function],
48
- "findByPlaceholderText": [Function],
49
- "findByRole": [Function],
50
- "findByTestId": [Function],
51
- "findByText": [Function],
52
- "findByTitle": [Function],
53
- "getAllByAltText": [Function],
54
- "getAllByDisplayValue": [Function],
55
- "getAllByLabelText": [Function],
56
- "getAllByPlaceholderText": [Function],
57
- "getAllByRole": [Function],
58
- "getAllByTestId": [Function],
59
- "getAllByText": [Function],
60
- "getAllByTitle": [Function],
61
- "getByAltText": [Function],
62
- "getByDisplayValue": [Function],
63
- "getByLabelText": [Function],
64
- "getByPlaceholderText": [Function],
65
- "getByRole": [Function],
66
- "getByTestId": [Function],
67
- "getByText": [Function],
68
- "getByTitle": [Function],
69
- "queryAllByAltText": [Function],
70
- "queryAllByDisplayValue": [Function],
71
- "queryAllByLabelText": [Function],
72
- "queryAllByPlaceholderText": [Function],
73
- "queryAllByRole": [Function],
74
- "queryAllByTestId": [Function],
75
- "queryAllByText": [Function],
76
- "queryAllByTitle": [Function],
77
- "queryByAltText": [Function],
78
- "queryByDisplayValue": [Function],
79
- "queryByLabelText": [Function],
80
- "queryByPlaceholderText": [Function],
81
- "queryByRole": [Function],
82
- "queryByTestId": [Function],
83
- "queryByText": [Function],
84
- "queryByTitle": [Function],
85
- "rerender": [Function],
86
- "unmount": [Function],
87
- }
88
- `;
@@ -1,11 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`RenderHost should match snapshot 1`] = `
4
- <div>
5
- <div>
6
- test component
7
- </div>
8
- </div>
9
- `;
10
-
11
- exports[`RenderHost should render empty when config is pending 1`] = `<div />`;