@shopify/ui-extensions-server-kit 5.4.0 → 5.4.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 (227) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +3 -5
  4. package/dist/ExtensionServerClient/server-types.d.ts +31 -7
  5. package/dist/_virtual/jsx-runtime.cjs.js +1 -0
  6. package/dist/_virtual/jsx-runtime.cjs2.js +1 -0
  7. package/dist/_virtual/jsx-runtime.es.js +5 -0
  8. package/dist/_virtual/jsx-runtime.es2.js +4 -0
  9. package/dist/_virtual/react-jsx-runtime.development.cjs.js +1 -0
  10. package/dist/_virtual/react-jsx-runtime.development.es.js +4 -0
  11. package/dist/_virtual/react-jsx-runtime.production.min.cjs.js +1 -0
  12. package/dist/_virtual/react-jsx-runtime.production.min.es.js +4 -0
  13. package/dist/i18n.d.ts +2 -8
  14. package/dist/index.cjs.js +1 -1
  15. package/dist/index.cjs2.js +1 -1
  16. package/dist/index.es.js +18 -18
  17. package/dist/index.es2.js +3 -3
  18. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +22 -0
  19. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.es.js +604 -0
  20. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js +9 -0
  21. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +28 -0
  22. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs.js +1 -0
  23. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.es.js +10 -0
  24. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -0
  25. package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/ExtensionServerClient.es.js +21 -18
  26. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.cjs.js +1 -0
  27. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.es.js +30 -0
  28. package/dist/{context → packages/ui-extensions-server-kit/src/context}/constants.cjs.js +1 -1
  29. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.cjs.js +1 -0
  30. package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerContext.es.js +3 -2
  31. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.cjs.js +1 -0
  32. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.es.js +25 -0
  33. package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.cjs.js +1 -0
  34. package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/isUIExtension.es.js +3 -2
  35. package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/isValidSurface.cjs.js +1 -1
  36. package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.es.js +7 -0
  37. package/dist/types.d.ts +11 -8
  38. package/dist/utilities/isUIExtension.d.ts +1 -1
  39. package/dist/utilities/isValidSurface.d.ts +1 -1
  40. package/dist/utilities/set.d.ts +1 -1
  41. package/node_modules/{@shopify/react-testing/LICENSE.md → @testing-library/react/LICENSE} +2 -3
  42. package/node_modules/@testing-library/react/README.md +692 -0
  43. package/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js +537 -0
  44. package/node_modules/@testing-library/react/dist/@testing-library/react.esm.js +497 -0
  45. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js +501 -0
  46. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js +461 -0
  47. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js +502 -0
  48. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map +1 -0
  49. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js +2 -0
  50. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map +1 -0
  51. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js +538 -0
  52. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map +1 -0
  53. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js +2 -0
  54. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map +1 -0
  55. package/node_modules/@testing-library/react/dist/act-compat.js +80 -0
  56. package/node_modules/@testing-library/react/dist/config.js +33 -0
  57. package/node_modules/@testing-library/react/dist/fire-event.js +70 -0
  58. package/node_modules/@testing-library/react/dist/index.js +52 -0
  59. package/node_modules/@testing-library/react/dist/pure.js +356 -0
  60. package/node_modules/@testing-library/react/dont-cleanup-after-each.js +1 -0
  61. package/node_modules/@testing-library/react/package.json +116 -0
  62. package/node_modules/@testing-library/react/pure.d.ts +1 -0
  63. package/node_modules/@testing-library/react/pure.js +2 -0
  64. package/node_modules/@testing-library/react/types/index.d.ts +287 -0
  65. package/node_modules/@testing-library/react/types/pure.d.ts +1 -0
  66. package/node_modules/@vitejs/plugin-react/README.md +159 -0
  67. package/node_modules/@vitejs/plugin-react/dist/index.d.ts +75 -0
  68. package/node_modules/@vitejs/plugin-react/dist/index.js +401 -0
  69. package/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js +663 -0
  70. package/node_modules/@vitejs/plugin-react/package.json +77 -0
  71. package/node_modules/@vitejs/plugin-react/types/preamble.d.ts +1 -0
  72. package/package.json +8 -9
  73. package/project.json +1 -1
  74. package/src/ExtensionServerClient/ExtensionServerClient.test.ts +6 -5
  75. package/src/ExtensionServerClient/ExtensionServerClient.ts +27 -19
  76. package/src/ExtensionServerClient/server-types.ts +17 -7
  77. package/src/ExtensionServerClient/types.ts +0 -2
  78. package/src/context/ExtensionServerProvider.test.tsx +55 -73
  79. package/src/context/ExtensionServerProvider.tsx +1 -0
  80. package/src/i18n.ts +2 -5
  81. package/src/state/reducers/extensionServerReducer.test.ts +2 -2
  82. package/src/types.ts +11 -6
  83. package/src/utilities/assetToString.ts +0 -1
  84. package/src/utilities/isUIExtension.ts +5 -4
  85. package/src/utilities/isValidSurface.ts +2 -3
  86. package/src/utilities/replaceUpdated.ts +0 -2
  87. package/src/utilities/set.ts +10 -5
  88. package/tests/setup.ts +1 -4
  89. package/vite.config.mts +57 -0
  90. package/dist/ExtensionServerClient/ExtensionServerClient.cjs.js +0 -1
  91. package/dist/context/ExtensionServerProvider.cjs.js +0 -1
  92. package/dist/context/ExtensionServerProvider.es.js +0 -29
  93. package/dist/hooks/useExtensionServerContext.cjs.js +0 -1
  94. package/dist/testing/MockExtensionServerProvider.cjs.js +0 -1
  95. package/dist/testing/MockExtensionServerProvider.es.js +0 -24
  96. package/dist/utilities/isUIExtension.cjs.js +0 -1
  97. package/dist/utilities/isValidSurface.es.js +0 -7
  98. package/node_modules/@shopify/react-testing/README.md +0 -711
  99. package/node_modules/@shopify/react-testing/build/cjs/TestWrapper.js +0 -52
  100. package/node_modules/@shopify/react-testing/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -47
  101. package/node_modules/@shopify/react-testing/build/cjs/compat.js +0 -14
  102. package/node_modules/@shopify/react-testing/build/cjs/destroy.js +0 -13
  103. package/node_modules/@shopify/react-testing/build/cjs/element.js +0 -225
  104. package/node_modules/@shopify/react-testing/build/cjs/index.js +0 -21
  105. package/node_modules/@shopify/react-testing/build/cjs/matchers/components.js +0 -46
  106. package/node_modules/@shopify/react-testing/build/cjs/matchers/context.js +0 -25
  107. package/node_modules/@shopify/react-testing/build/cjs/matchers/index.js +0 -16
  108. package/node_modules/@shopify/react-testing/build/cjs/matchers/props.js +0 -38
  109. package/node_modules/@shopify/react-testing/build/cjs/matchers/strings.js +0 -42
  110. package/node_modules/@shopify/react-testing/build/cjs/matchers/utilities.js +0 -110
  111. package/node_modules/@shopify/react-testing/build/cjs/mount.js +0 -76
  112. package/node_modules/@shopify/react-testing/build/cjs/root.js +0 -284
  113. package/node_modules/@shopify/react-testing/build/cjs/toReactString.js +0 -86
  114. package/node_modules/@shopify/react-testing/build/cjs/types.js +0 -28
  115. package/node_modules/@shopify/react-testing/build/esm/TestWrapper.mjs +0 -44
  116. package/node_modules/@shopify/react-testing/build/esm/_virtual/_rollupPluginBabelHelpers.mjs +0 -42
  117. package/node_modules/@shopify/react-testing/build/esm/compat.mjs +0 -10
  118. package/node_modules/@shopify/react-testing/build/esm/destroy.mjs +0 -9
  119. package/node_modules/@shopify/react-testing/build/esm/element.mjs +0 -221
  120. package/node_modules/@shopify/react-testing/build/esm/index.mjs +0 -5
  121. package/node_modules/@shopify/react-testing/build/esm/matchers/components.mjs +0 -41
  122. package/node_modules/@shopify/react-testing/build/esm/matchers/context.mjs +0 -21
  123. package/node_modules/@shopify/react-testing/build/esm/matchers/index.mjs +0 -14
  124. package/node_modules/@shopify/react-testing/build/esm/matchers/props.mjs +0 -33
  125. package/node_modules/@shopify/react-testing/build/esm/matchers/strings.mjs +0 -37
  126. package/node_modules/@shopify/react-testing/build/esm/matchers/utilities.mjs +0 -101
  127. package/node_modules/@shopify/react-testing/build/esm/mount.mjs +0 -70
  128. package/node_modules/@shopify/react-testing/build/esm/root.mjs +0 -275
  129. package/node_modules/@shopify/react-testing/build/esm/toReactString.mjs +0 -80
  130. package/node_modules/@shopify/react-testing/build/esm/types.mjs +0 -26
  131. package/node_modules/@shopify/react-testing/build/esnext/TestWrapper.esnext +0 -44
  132. package/node_modules/@shopify/react-testing/build/esnext/compat.esnext +0 -10
  133. package/node_modules/@shopify/react-testing/build/esnext/destroy.esnext +0 -9
  134. package/node_modules/@shopify/react-testing/build/esnext/element.esnext +0 -221
  135. package/node_modules/@shopify/react-testing/build/esnext/index.esnext +0 -5
  136. package/node_modules/@shopify/react-testing/build/esnext/matchers/components.esnext +0 -41
  137. package/node_modules/@shopify/react-testing/build/esnext/matchers/context.esnext +0 -21
  138. package/node_modules/@shopify/react-testing/build/esnext/matchers/index.esnext +0 -14
  139. package/node_modules/@shopify/react-testing/build/esnext/matchers/props.esnext +0 -33
  140. package/node_modules/@shopify/react-testing/build/esnext/matchers/strings.esnext +0 -37
  141. package/node_modules/@shopify/react-testing/build/esnext/matchers/utilities.esnext +0 -99
  142. package/node_modules/@shopify/react-testing/build/esnext/mount.esnext +0 -71
  143. package/node_modules/@shopify/react-testing/build/esnext/root.esnext +0 -275
  144. package/node_modules/@shopify/react-testing/build/esnext/toReactString.esnext +0 -80
  145. package/node_modules/@shopify/react-testing/build/esnext/types.esnext +0 -26
  146. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts +0 -17
  147. package/node_modules/@shopify/react-testing/build/ts/TestWrapper.d.ts.map +0 -1
  148. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts +0 -3
  149. package/node_modules/@shopify/react-testing/build/ts/compat.d.ts.map +0 -1
  150. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts +0 -2
  151. package/node_modules/@shopify/react-testing/build/ts/destroy.d.ts.map +0 -1
  152. package/node_modules/@shopify/react-testing/build/ts/element.d.ts +0 -42
  153. package/node_modules/@shopify/react-testing/build/ts/element.d.ts.map +0 -1
  154. package/node_modules/@shopify/react-testing/build/ts/index.d.ts +0 -7
  155. package/node_modules/@shopify/react-testing/build/ts/index.d.ts.map +0 -1
  156. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts +0 -12
  157. package/node_modules/@shopify/react-testing/build/ts/matchers/components.d.ts.map +0 -1
  158. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts +0 -8
  159. package/node_modules/@shopify/react-testing/build/ts/matchers/context.d.ts.map +0 -1
  160. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts +0 -20
  161. package/node_modules/@shopify/react-testing/build/ts/matchers/index.d.ts.map +0 -1
  162. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts +0 -10
  163. package/node_modules/@shopify/react-testing/build/ts/matchers/props.d.ts.map +0 -1
  164. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts +0 -11
  165. package/node_modules/@shopify/react-testing/build/ts/matchers/strings.d.ts.map +0 -1
  166. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts +0 -17
  167. package/node_modules/@shopify/react-testing/build/ts/matchers/utilities.d.ts.map +0 -1
  168. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts +0 -39
  169. package/node_modules/@shopify/react-testing/build/ts/mount.d.ts.map +0 -1
  170. package/node_modules/@shopify/react-testing/build/ts/root.d.ts +0 -55
  171. package/node_modules/@shopify/react-testing/build/ts/root.d.ts.map +0 -1
  172. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts +0 -5
  173. package/node_modules/@shopify/react-testing/build/ts/toReactString.d.ts.map +0 -1
  174. package/node_modules/@shopify/react-testing/build/ts/types.d.ts +0 -89
  175. package/node_modules/@shopify/react-testing/build/ts/types.d.ts.map +0 -1
  176. package/node_modules/@shopify/react-testing/index.esnext +0 -1
  177. package/node_modules/@shopify/react-testing/index.js +0 -1
  178. package/node_modules/@shopify/react-testing/index.mjs +0 -1
  179. package/node_modules/@shopify/react-testing/matchers.esnext +0 -1
  180. package/node_modules/@shopify/react-testing/matchers.js +0 -1
  181. package/node_modules/@shopify/react-testing/matchers.mjs +0 -1
  182. package/node_modules/@shopify/react-testing/package.json +0 -69
  183. package/node_modules/@shopify/ui-extensions-test-utils/CHANGELOG.md +0 -66
  184. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.d.ts +0 -3
  185. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.js +0 -3
  186. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.d.ts +0 -2
  187. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.js +0 -5
  188. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.d.ts +0 -17
  189. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.js +0 -20
  190. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.d.ts +0 -9
  191. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.js +0 -7
  192. package/node_modules/@shopify/ui-extensions-test-utils/package.json +0 -40
  193. package/node_modules/@shopify/ui-extensions-test-utils/project.json +0 -39
  194. package/node_modules/@vitejs/plugin-react-refresh/README.md +0 -73
  195. package/node_modules/@vitejs/plugin-react-refresh/index.d.ts +0 -14
  196. package/node_modules/@vitejs/plugin-react-refresh/index.js +0 -239
  197. package/node_modules/@vitejs/plugin-react-refresh/package.json +0 -35
  198. /package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/types.cjs.js +0 -0
  199. /package/dist/{ExtensionServerClient → packages/ui-extensions-server-kit/src/ExtensionServerClient}/types.es.js +0 -0
  200. /package/dist/{context → packages/ui-extensions-server-kit/src/context}/constants.es.js +0 -0
  201. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerState.cjs.js +0 -0
  202. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useExtensionServerState.es.js +0 -0
  203. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useIsomorphicLayoutEffect.cjs.js +0 -0
  204. /package/dist/{hooks → packages/ui-extensions-server-kit/src/hooks}/useIsomorphicLayoutEffect.es.js +0 -0
  205. /package/dist/{i18n.cjs.js → packages/ui-extensions-server-kit/src/i18n.cjs.js} +0 -0
  206. /package/dist/{i18n.es.js → packages/ui-extensions-server-kit/src/i18n.es.js} +0 -0
  207. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/actions/actions.cjs.js +0 -0
  208. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/actions/actions.es.js +0 -0
  209. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/constants.cjs.js +0 -0
  210. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/constants.es.js +0 -0
  211. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/extensionServerReducer.cjs.js +0 -0
  212. /package/dist/{state → packages/ui-extensions-server-kit/src/state}/reducers/extensionServerReducer.es.js +0 -0
  213. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/app.cjs.js +0 -0
  214. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/app.es.js +0 -0
  215. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/extensions.cjs.js +0 -0
  216. /package/dist/{testing → packages/ui-extensions-server-kit/src/testing}/extensions.es.js +0 -0
  217. /package/dist/{types.cjs.js → packages/ui-extensions-server-kit/src/types.cjs.js} +0 -0
  218. /package/dist/{types.es.js → packages/ui-extensions-server-kit/src/types.es.js} +0 -0
  219. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/assetToString.cjs.js +0 -0
  220. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/assetToString.es.js +0 -0
  221. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/noop.cjs.js +0 -0
  222. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/noop.es.js +0 -0
  223. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/replaceUpdated.cjs.js +0 -0
  224. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/replaceUpdated.es.js +0 -0
  225. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/set.cjs.js +0 -0
  226. /package/dist/{utilities → packages/ui-extensions-server-kit/src/utilities}/set.es.js +0 -0
  227. /package/node_modules/@vitejs/{plugin-react-refresh → plugin-react}/LICENSE +0 -0
@@ -1,3 +0,0 @@
1
- export * from './render';
2
- export * from './renderHook';
3
- export * from './withProviders';
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare function render<TProps, TProviderProps>(element: React.ReactElement<TProps>, Providers?: React.ComponentType<React.PropsWithChildren<TProviderProps>>, options?: Omit<TProviderProps, 'children'>): import("@shopify/react-testing").Root<any>;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { mount } from '@shopify/react-testing';
3
- export function render(element, Providers = ({ children }) => React.createElement(React.Fragment, null, children), options = {}) {
4
- return mount(React.createElement(Providers, { ...options }, element));
5
- }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- export interface HookWrapper<T> {
3
- result: T;
4
- /**
5
- * Use to wrap calls to stateful hook methods:
6
- *
7
- * ```ts
8
- * const hook = testHook(() => useToggle(false))
9
- * expect(hook.result.value).toBe(false)
10
- * hook.act(() => hook.result.toggle())
11
- * expect(hook.result.value).toBe(true)
12
- * ```
13
- **/
14
- act<TR>(callback: (currentResult: T) => TR): TR;
15
- forceUpdate(): void;
16
- }
17
- export declare function renderHook<T, TP>(hook: () => T, Providers?: React.ComponentType<React.PropsWithChildren<TP>>, options?: Omit<TP, 'children'>): HookWrapper<T>;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { mount } from '@shopify/react-testing';
3
- function MountHook({ callback }) {
4
- callback();
5
- return null;
6
- }
7
- export function renderHook(hook, Providers = ({ children }) => React.createElement(React.Fragment, null, children), options = {}) {
8
- const hookResult = {};
9
- const wrapper = mount(React.createElement(Providers, { ...options },
10
- React.createElement(MountHook, { callback: () => (hookResult.result = hook()) })));
11
- return Object.assign(hookResult, {
12
- result: hookResult.result,
13
- forceUpdate() {
14
- return wrapper.forceUpdate();
15
- },
16
- act(callback) {
17
- return wrapper.act(() => callback(hookResult.result));
18
- },
19
- });
20
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export type ProviderComponent<TProps = any> = React.ComponentType<React.PropsWithChildren<TProps>>;
3
- export type Tail<T extends any[]> = T extends [head: any, ...tail: infer TRest] ? TRest : never;
4
- export type PropUnion<TProviders extends any[], TProps extends {
5
- [k: string]: any;
6
- } = Empty> = TProviders[0] extends React.ComponentType<any> ? React.ComponentPropsWithoutRef<TProviders[0]> & PropUnion<Tail<TProviders>> : TProps;
7
- export interface Empty {
8
- }
9
- export declare function withProviders<T extends ProviderComponent[]>(...providers: T): ProviderComponent<PropUnion<T>>;
@@ -1,7 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-empty-interface */
2
- import React from 'react';
3
- export function withProviders(...providers) {
4
- return function Providers({ children, ...props }) {
5
- return providers.reduceRight((childTree, Provider) => React.createElement(Provider, props, childTree), children);
6
- };
7
- }
@@ -1,40 +0,0 @@
1
- {
2
- "name": "@shopify/ui-extensions-test-utils",
3
- "version": "3.26.0",
4
- "packageManager": "pnpm@10.11.1",
5
- "private": true,
6
- "license": "MIT",
7
- "main": "dist/index",
8
- "types": "dist/index",
9
- "scripts": {
10
- "build": "nx build",
11
- "clean": "nx clean",
12
- "lint": "nx lint",
13
- "lint:fix": "nx lint:fix"
14
- },
15
- "eslintConfig": {
16
- "extends": [
17
- "../../.eslintrc.cjs"
18
- ],
19
- "rules": {
20
- "@typescript-eslint/no-explicit-any": "off",
21
- "import/extensions": [
22
- "error",
23
- "never",
24
- {
25
- "ignorePackages": true
26
- }
27
- ]
28
- }
29
- },
30
- "devDependencies": {
31
- "@shopify/react-testing": "^3.0.0",
32
- "@types/react": "16.14.0",
33
- "@types/react-dom": "^16.9.11",
34
- "react": "^17.0.2",
35
- "react-dom": "^17.0.2"
36
- },
37
- "peerDependencies": {
38
- "react": "^17.0.2"
39
- }
40
- }
@@ -1,39 +0,0 @@
1
- {
2
- "name": "ui-extensions-test-utils",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/ui-extensions-test-utils/src",
5
- "projectType": "library",
6
- "tags": ["scope:feature", "scope:ui-extensions"],
7
- "targets": {
8
- "clean": {
9
- "executor": "nx:run-commands",
10
- "options": {
11
- "command": "pnpm rimraf dist/",
12
- "cwd": "packages/ui-extensions-test-utils"
13
- }
14
- },
15
- "build": {
16
- "executor": "nx:run-commands",
17
- "outputs": ["{workspaceRoot}/dist"],
18
- "inputs": ["{projectRoot}/src/**/*"],
19
- "options": {
20
- "command": "pnpm tsc",
21
- "cwd": "packages/ui-extensions-test-utils"
22
- }
23
- },
24
- "lint": {
25
- "executor": "nx:run-commands",
26
- "options": {
27
- "command": "pnpm eslint src",
28
- "cwd": "packages/ui-extensions-test-utils"
29
- }
30
- },
31
- "lint:fix": {
32
- "executor": "nx:run-commands",
33
- "options": {
34
- "command": "pnpm eslint src --fix",
35
- "cwd": "packages/ui-extensions-test-utils"
36
- }
37
- }
38
- }
39
- }
@@ -1,73 +0,0 @@
1
- # @vitejs/plugin-react-refresh [![npm](https://img.shields.io/npm/v/@vitejs/plugin-react-refresh.svg)](https://npmjs.com/package/@vitejs/plugin-react-refresh)
2
-
3
- Provides [React Refresh](https://www.npmjs.com/package/react-refresh) support for Vite.
4
-
5
- ```js
6
- // vite.config.js
7
- import reactRefresh from '@vitejs/plugin-react-refresh'
8
-
9
- export default {
10
- plugins: [reactRefresh()]
11
- }
12
- ```
13
-
14
- ## Specifying Additional Parser Plugins
15
-
16
- If you are using ES syntax that are still in proposal status (e.g. class properties), you can selectively enable them via the `parserPlugins` option:
17
-
18
- ```js
19
- export default {
20
- plugins: [
21
- reactRefresh({
22
- parserPlugins: ['classProperties', 'classPrivateProperties']
23
- })
24
- ]
25
- }
26
- ```
27
-
28
- [Full list of Babel parser plugins](https://babeljs.io/docs/en/babel-parser#ecmascript-proposalshttpsgithubcombabelproposals).
29
-
30
- ## Specifying files to include or exclude from refreshing
31
-
32
- By default, @vite/plugin-react-refresh will process files ending with `.js`, `.jsx`, `.ts`, and `.tsx`, and excludes all files in `node_modules`.
33
-
34
- In some situations you may not want a file to act as an HMR boundary, instead preferring that the changes propagate higher in the stack before being handled. In these cases, you can provide an `include` and/or `exclude` option, which can be regex or a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or array of either. Files must match include and not exclude to be processed. Note, when using either `include`, or `exclude`, the defaults will not be merged in, so re-apply them if necessary.
35
-
36
- ```js
37
- export default {
38
- plugins: [
39
- reactRefresh({
40
- // Exclude storybook stories and node_modules
41
- exclude: [/\.stories\.(t|j)sx?$/, /node_modules/],
42
- // Only .tsx files
43
- include: '**/*.tsx'
44
- })
45
- ]
46
- }
47
- ```
48
-
49
- ### Notes
50
-
51
- - If using TSX, any TS-supported syntax will already be transpiled away so you won't need to specify them here.
52
-
53
- - This option only enables the plugin to parse these syntax - it does not perform any transpilation since this plugin is dev-only.
54
-
55
- - If you wish to transpile the syntax for production, you will need to configure the transform separately using [@rollup/plugin-babel](https://github.com/rollup/plugins/tree/master/packages/babel) as a build-only plugin.
56
-
57
- ## Middleware Mode Notes
58
-
59
- When Vite is launched in **Middleware Mode**, you need to make sure your entry `index.html` file is transformed with `ViteDevServer.transformIndexHtml`. Otherwise, you may get an error prompting `Uncaught Error: @vitejs/plugin-react-refresh can't detect preamble. Something is wrong.`
60
-
61
- To mitigate this issue, you can explicitly transform your `index.html` like this when configuring your express server:
62
-
63
- ```js
64
- app.get('/', async (req, res, next) => {
65
- try {
66
- let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')
67
- html = await viteServer.transformIndexHtml(req.url, html)
68
- res.send(html)
69
- } catch (e) {
70
- return next(e)
71
- }
72
- })
73
- ```
@@ -1,14 +0,0 @@
1
- import { Plugin } from 'vite'
2
- import { ParserOptions } from '@babel/core'
3
-
4
- type PluginFactory = (options?: Options) => Plugin
5
-
6
- declare const createPlugin: PluginFactory & { preambleCode: string }
7
-
8
- export interface Options {
9
- parserPlugins?: ParserOptions['plugins']
10
- include?: string | RegExp | Array<string | RegExp>
11
- exclude?: string | RegExp | Array<string | RegExp>
12
- }
13
-
14
- export default createPlugin
@@ -1,239 +0,0 @@
1
- // @ts-check
2
- const fs = require('fs')
3
- const { transformSync, ParserOptions } = require('@babel/core')
4
- const { createFilter } = require('@rollup/pluginutils')
5
- const runtimePublicPath = '/@react-refresh'
6
- const runtimeFilePath = require.resolve(
7
- 'react-refresh/cjs/react-refresh-runtime.development.js'
8
- )
9
-
10
- const runtimeCode = `
11
- const exports = {}
12
- ${fs.readFileSync(runtimeFilePath, 'utf-8')}
13
- function debounce(fn, delay) {
14
- let handle
15
- return () => {
16
- clearTimeout(handle)
17
- handle = setTimeout(fn, delay)
18
- }
19
- }
20
- exports.performReactRefresh = debounce(exports.performReactRefresh, 16)
21
- export default exports
22
- `
23
-
24
- const preambleCode = `
25
- import RefreshRuntime from "__BASE__${runtimePublicPath.slice(1)}"
26
- RefreshRuntime.injectIntoGlobalHook(window)
27
- window.$RefreshReg$ = () => {}
28
- window.$RefreshSig$ = () => (type) => type
29
- window.__vite_plugin_react_preamble_installed__ = true
30
- `
31
-
32
- /**
33
- * Transform plugin for transforming and injecting per-file refresh code.
34
- *
35
- * @type {import('.').default}
36
- */
37
- function reactRefreshPlugin(opts) {
38
- let shouldSkip = false
39
- let base = '/'
40
- const filter = createFilter(
41
- (opts && opts.include) || /\.(t|j)sx?$/,
42
- (opts && opts.exclude) || /node_modules/
43
- )
44
-
45
- return {
46
- name: 'react-refresh',
47
-
48
- enforce: 'pre',
49
-
50
- configResolved(config) {
51
- shouldSkip = config.command === 'build' || config.isProduction
52
- base = config.base
53
- },
54
-
55
- resolveId(id) {
56
- if (id === runtimePublicPath) {
57
- return id
58
- }
59
- },
60
-
61
- load(id) {
62
- if (id === runtimePublicPath) {
63
- return runtimeCode
64
- }
65
- },
66
-
67
- transform(code, id, ssr) {
68
- if (shouldSkip || ssr) {
69
- return
70
- }
71
-
72
- if (!filter(id)) {
73
- return
74
- }
75
-
76
- // plain js/ts files can't use React without importing it, so skip
77
- // them whenever possible
78
- if (!id.endsWith('x') && !code.includes('react')) {
79
- return
80
- }
81
-
82
- /**
83
- * @type ParserOptions["plugins"]
84
- */
85
- const parserPlugins = [
86
- 'jsx',
87
- 'importMeta',
88
- // since the plugin now applies before esbuild transforms the code,
89
- // we need to enable some stage 3 syntax since they are supported in
90
- // TS and some environments already.
91
- 'topLevelAwait',
92
- 'classProperties',
93
- 'classPrivateProperties',
94
- 'classPrivateMethods'
95
- ]
96
- if (/\.tsx?$/.test(id)) {
97
- // it's a typescript file
98
- // TODO: maybe we need to read tsconfig to determine parser plugins to
99
- // enable here, but allowing decorators by default since it's very
100
- // commonly used with TS.
101
- parserPlugins.push('typescript', 'decorators-legacy')
102
- }
103
- if (opts && opts.parserPlugins) {
104
- parserPlugins.push(...opts.parserPlugins)
105
- }
106
-
107
- const isReasonReact = id.endsWith('.bs.js')
108
- const result = transformSync(code, {
109
- babelrc: false,
110
- configFile: false,
111
- filename: id,
112
- parserOpts: {
113
- sourceType: 'module',
114
- allowAwaitOutsideFunction: true,
115
- plugins: parserPlugins
116
- },
117
- generatorOpts: {
118
- decoratorsBeforeExport: true
119
- },
120
- plugins: [
121
- require('@babel/plugin-transform-react-jsx-self'),
122
- require('@babel/plugin-transform-react-jsx-source'),
123
- [require('react-refresh/babel'), { skipEnvCheck: true }]
124
- ],
125
- ast: !isReasonReact,
126
- sourceMaps: true,
127
- sourceFileName: id
128
- })
129
-
130
- if (!/\$RefreshReg\$\(/.test(result.code)) {
131
- // no component detected in the file
132
- return code
133
- }
134
-
135
- const header = `
136
- import RefreshRuntime from "${runtimePublicPath}";
137
-
138
- let prevRefreshReg;
139
- let prevRefreshSig;
140
-
141
- if (!window.__vite_plugin_react_preamble_installed__) {
142
- throw new Error(
143
- "@vitejs/plugin-react-refresh can't detect preamble. Something is wrong. " +
144
- "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
145
- );
146
- }
147
-
148
- if (import.meta.hot) {
149
- prevRefreshReg = window.$RefreshReg$;
150
- prevRefreshSig = window.$RefreshSig$;
151
- window.$RefreshReg$ = (type, id) => {
152
- RefreshRuntime.register(type, ${JSON.stringify(id)} + " " + id)
153
- };
154
- window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
155
- }`.replace(/[\n]+/gm, '')
156
-
157
- const footer = `
158
- if (import.meta.hot) {
159
- window.$RefreshReg$ = prevRefreshReg;
160
- window.$RefreshSig$ = prevRefreshSig;
161
-
162
- ${
163
- isReasonReact || isRefreshBoundary(result.ast)
164
- ? `import.meta.hot.accept();`
165
- : ``
166
- }
167
- if (!window.__vite_plugin_react_timeout) {
168
- window.__vite_plugin_react_timeout = setTimeout(() => {
169
- window.__vite_plugin_react_timeout = 0;
170
- RefreshRuntime.performReactRefresh();
171
- }, 30);
172
- }
173
- }`
174
-
175
- return {
176
- code: `${header}${result.code}${footer}`,
177
- map: result.map
178
- }
179
- },
180
-
181
- transformIndexHtml() {
182
- if (shouldSkip) {
183
- return
184
- }
185
-
186
- return [
187
- {
188
- tag: 'script',
189
- attrs: { type: 'module' },
190
- children: preambleCode.replace(`__BASE__`, base)
191
- }
192
- ]
193
- }
194
- }
195
- }
196
-
197
- /**
198
- * @param {import('@babel/core').BabelFileResult['ast']} ast
199
- */
200
- function isRefreshBoundary(ast) {
201
- // Every export must be a React component.
202
- return ast.program.body.every((node) => {
203
- if (node.type !== 'ExportNamedDeclaration') {
204
- return true
205
- }
206
- const { declaration, specifiers } = node
207
- if (declaration) {
208
- if (declaration.type === 'VariableDeclaration') {
209
- return declaration.declarations.every((variable) =>
210
- isComponentLikeIdentifier(variable.id)
211
- )
212
- }
213
- if (declaration.type === 'FunctionDeclaration') {
214
- return isComponentLikeIdentifier(declaration.id)
215
- }
216
- }
217
- return specifiers.every((spec) => {
218
- return isComponentLikeIdentifier(spec.exported)
219
- })
220
- })
221
- }
222
-
223
- /**
224
- * @param {import('@babel/types').Node} node
225
- */
226
- function isComponentLikeIdentifier(node) {
227
- return node.type === 'Identifier' && isComponentLikeName(node.name)
228
- }
229
-
230
- /**
231
- * @param {string} name
232
- */
233
- function isComponentLikeName(name) {
234
- return typeof name === 'string' && name[0] >= 'A' && name[0] <= 'Z'
235
- }
236
-
237
- module.exports = reactRefreshPlugin
238
- reactRefreshPlugin['default'] = reactRefreshPlugin
239
- reactRefreshPlugin.preambleCode = preambleCode
@@ -1,35 +0,0 @@
1
- {
2
- "name": "@vitejs/plugin-react-refresh",
3
- "version": "1.3.6",
4
- "license": "MIT",
5
- "author": "Evan You",
6
- "files": [
7
- "index.js",
8
- "index.d.ts"
9
- ],
10
- "main": "index.js",
11
- "types": "index.d.ts",
12
- "scripts": {
13
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react-refresh",
14
- "release": "node ../../scripts/release.js --skipBuild"
15
- },
16
- "engines": {
17
- "node": ">=12.0.0"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/vitejs/vite.git",
22
- "directory": "packages/plugin-react-refresh"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/vitejs/vite/issues"
26
- },
27
- "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react-refresh#readme",
28
- "dependencies": {
29
- "@babel/core": "^7.14.8",
30
- "@babel/plugin-transform-react-jsx-self": "^7.14.5",
31
- "@babel/plugin-transform-react-jsx-source": "^7.14.5",
32
- "@rollup/pluginutils": "^4.1.1",
33
- "react-refresh": "^0.10.0"
34
- }
35
- }