@appshell/react 1.0.0-alpha.14 → 1.0.0-alpha.17
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/README.md +36 -49
- package/dist/main.js +1 -1
- package/dist/types/config/src/axios.d.ts +0 -1
- package/dist/types/config/src/configmap.d.ts +0 -1
- package/dist/types/config/src/context.d.ts +3 -4
- package/dist/types/config/src/credentials.d.ts +0 -2
- package/dist/types/config/src/generate.manifest.d.ts +0 -1
- package/dist/types/config/src/index.d.ts +2 -7
- package/dist/types/config/src/mappers/appshell.config.d.ts +0 -1
- package/dist/types/config/src/outdated.d.ts +0 -1
- package/dist/types/config/src/publish.d.ts +3 -4
- package/dist/types/config/src/sync.d.ts +0 -1
- package/dist/types/config/src/types.d.ts +9 -15
- package/dist/types/config/src/utils/blur.d.ts +0 -1
- package/dist/types/config/src/utils/compare.d.ts +0 -1
- package/dist/types/config/src/utils/config.d.ts +0 -1
- package/dist/types/config/src/utils/copy.d.ts +0 -1
- package/dist/types/config/src/utils/index.d.ts +0 -4
- package/dist/types/config/src/utils/list.d.ts +0 -1
- package/dist/types/config/src/utils/load.d.ts +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
- package/dist/types/config/src/validators/index.d.ts +0 -3
- package/dist/types/loader/src/index.d.ts +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts +0 -1
- package/dist/types/loader/src/remoteLoader.d.ts +2 -4
- package/dist/types/loader/src/resolvers.d.ts +4 -12
- package/dist/types/loader/src/types.d.ts +0 -1
- package/dist/types/react/src/components/LoadingError.d.ts +0 -1
- package/dist/types/react/src/components/{AppshellComponent.d.ts → RemoteSlot.d.ts} +4 -21
- package/dist/types/react/src/contexts/RemoteContext.d.ts +0 -1
- package/dist/types/react/src/hooks/useRemote.d.ts +1 -2
- package/dist/types/react/src/index.d.ts +1 -9
- package/dist/types/react/src/resources/jsonResource.d.ts +0 -1
- package/dist/types/react/src/types.d.ts +0 -1
- package/dist/types/runtime/src/errors.d.ts +25 -0
- package/dist/types/runtime/src/index.d.ts +3 -0
- package/dist/types/runtime/src/store.d.ts +25 -0
- package/dist/types/runtime/src/types.d.ts +9 -0
- package/package.json +12 -3
- package/CHANGELOG.md +0 -231
- package/__tests__/AppshellComponent.spec.tsx +0 -53
- package/__tests__/LoadingError.spec.tsx +0 -14
- package/__tests__/ManifestContext.spec.tsx +0 -50
- package/__tests__/ReactHost.spec.tsx +0 -136
- package/__tests__/__snapshots__/AppshellComponent.spec.tsx.snap +0 -9
- package/__tests__/__snapshots__/LoadingError.spec.tsx.snap +0 -88
- package/__tests__/__snapshots__/ReactHost.spec.tsx.snap +0 -11
- package/__tests__/fixtures/Manifest.ts +0 -16
- package/__tests__/fixtures/TestComponent.tsx +0 -5
- package/__tests__/fixtures/TestGlobalConfig.ts +0 -8
- package/__tests__/jsonResource.spec.ts +0 -27
- package/__tests__/useRemote.spec.tsx +0 -36
- package/__tests__/utils/waitForResource.ts +0 -15
- package/dist/types/config/src/axios.d.ts.map +0 -1
- package/dist/types/config/src/configmap.d.ts.map +0 -1
- package/dist/types/config/src/context.d.ts.map +0 -1
- package/dist/types/config/src/credentials.d.ts.map +0 -1
- package/dist/types/config/src/deregister.d.ts +0 -3
- package/dist/types/config/src/deregister.d.ts.map +0 -1
- package/dist/types/config/src/generate.env.d.ts +0 -3
- package/dist/types/config/src/generate.env.d.ts.map +0 -1
- package/dist/types/config/src/generate.global-config.d.ts +0 -10
- package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
- package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
- package/dist/types/config/src/index.d.ts.map +0 -1
- package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
- package/dist/types/config/src/outdated.d.ts.map +0 -1
- package/dist/types/config/src/publish.d.ts.map +0 -1
- package/dist/types/config/src/register.d.ts +0 -4
- package/dist/types/config/src/register.d.ts.map +0 -1
- package/dist/types/config/src/sync.d.ts.map +0 -1
- package/dist/types/config/src/types.d.ts.map +0 -1
- package/dist/types/config/src/utils/blur.d.ts.map +0 -1
- package/dist/types/config/src/utils/compare.d.ts.map +0 -1
- package/dist/types/config/src/utils/config.d.ts.map +0 -1
- package/dist/types/config/src/utils/copy.d.ts.map +0 -1
- package/dist/types/config/src/utils/index.d.ts.map +0 -1
- package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
- package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
- package/dist/types/config/src/utils/list.d.ts.map +0 -1
- package/dist/types/config/src/utils/load.d.ts.map +0 -1
- package/dist/types/config/src/utils/loadJson.d.ts +0 -10
- package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
- package/dist/types/config/src/utils/merge.d.ts +0 -4
- package/dist/types/config/src/utils/merge.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/index.d.ts.map +0 -1
- package/dist/types/loader/src/index.d.ts.map +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts.map +0 -1
- package/dist/types/loader/src/remoteLoader.d.ts.map +0 -1
- package/dist/types/loader/src/resolvers.d.ts.map +0 -1
- package/dist/types/loader/src/types.d.ts.map +0 -1
- package/dist/types/react/src/components/AppshellComponent.d.ts.map +0 -1
- package/dist/types/react/src/components/LoadingError.d.ts.map +0 -1
- package/dist/types/react/src/components/ReactHost.d.ts +0 -9
- package/dist/types/react/src/components/ReactHost.d.ts.map +0 -1
- package/dist/types/react/src/contexts/GlobalConfigContext.d.ts +0 -11
- package/dist/types/react/src/contexts/GlobalConfigContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/ManifestContext.d.ts +0 -12
- package/dist/types/react/src/contexts/ManifestContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/MetadataContext.d.ts +0 -11
- package/dist/types/react/src/contexts/MetadataContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/RemoteContext.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useGlobalConfig.d.ts +0 -4
- package/dist/types/react/src/hooks/useGlobalConfig.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useManifest.d.ts +0 -4
- package/dist/types/react/src/hooks/useManifest.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useMetadata.d.ts +0 -4
- package/dist/types/react/src/hooks/useMetadata.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useRemote.d.ts.map +0 -1
- package/dist/types/react/src/index.d.ts.map +0 -1
- package/dist/types/react/src/resources/jsonResource.d.ts.map +0 -1
- package/dist/types/react/src/types.d.ts.map +0 -1
- package/src/components/AppshellComponent.tsx +0 -97
- package/src/components/LoadingError.tsx +0 -15
- package/src/components/ReactHost.tsx +0 -55
- package/src/contexts/GlobalConfigContext.tsx +0 -17
- package/src/contexts/ManifestContext.tsx +0 -40
- package/src/contexts/MetadataContext.tsx +0 -17
- package/src/contexts/RemoteContext.tsx +0 -22
- package/src/hooks/useGlobalConfig.ts +0 -7
- package/src/hooks/useManifest.ts +0 -7
- package/src/hooks/useMetadata.ts +0 -6
- package/src/hooks/useRemote.ts +0 -7
- package/src/index.ts +0 -11
- package/src/resources/jsonResource.ts +0 -35
- package/src/types.ts +0 -3
- package/tsconfig.json +0 -7
- package/webpack.config.js +0 -42
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/merge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;yBAU3B,OAAO,aAAa,eAAe,gBAAgB,OAAO,EAAE;AAA5E,wBAiBE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppshellGlobalConfigValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellGlobalConfigValidator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,eAAe,EAAE,MAAM,UAAU,CAAC;wBAO5D,eAAe;AALpB,wBAKqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppshellManifestValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellManifestValidator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,eAAe,EAAgB,MAAM,UAAU,CAAC;wBA0EtE,eAAe;AAtBpB,wBAsBqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppshellTemplateValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellTemplateValidator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;wBAyCxD,eAAe;AAlBpB,wBAkBqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../loader/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAExB,eAAe,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadAppshellComponent.d.ts","sourceRoot":"","sources":["../../../../../loader/src/loadAppshellComponent.ts"],"names":[],"mappings":"yBAyBsB,UAAU,SACvB,MAAM,UACL,MAAM,kBACE,MAAM;AAHxB,wBAwCE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../../loader/src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;KAC3C;CACF;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;iCAEsB,oBAAoB,YAAW,mBAAmB,MAY1D,UAAU,OAAO,MAAM;AAZvC,wBA4CE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../../../loader/src/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,kGAAkG;IAClG,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,iGAAiG;IACjG,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;AAQpF,wFAAwF;AACxF,eAAO,MAAM,cAAc,iBACV,mBAAmB,KAAG,cAUpC,CAAC;AAEJ,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,iBACZ,mBAAmB,sBAAgB,cAejD,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,sBAAsB,WAAY,oBAAoB,KAAG,cAoCrE,CAAC;AAEF,eAAO,MAAM,cAAc,iBACV,cAAc,EAAE,KAAG,cAUjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../loader/src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,CAAC,UAAU,GAAG,GAAG,IAAI,MAAM,CAC/C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAC7F,CAAC;AAEF,MAAM,WAAW,eAAe,CAAC,UAAU;IACzC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CAChE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppshellComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/AppshellComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAc,EAAiB,YAAY,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM3F,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,kBAAkB,EAAE,aAAa,CAAC;KACnC;CACF;AAED,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,IAAI;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,MAAM,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,iBAAiB;KAAI,MAAM,SAAS,aAAa,iCAIpD,sBAAsB,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;;;;CA2CvD,CAAC;AAMF,eAAe,iBAAiB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;KA3DJ,MAAM,SAAS,aAAa,iCAIpD,sBAAsB,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;;;;CAuDL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingError.d.ts","sourceRoot":"","sources":["../../../../../src/components/LoadingError.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,UAAU,CAKhC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactHost.d.ts","sourceRoot":"","sources":["../../../../../src/components/ReactHost.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAUxD,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CA8BA,CAAC;AAOF,eAAe,SAAS,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AppshellGlobalConfig } from 'packages/config/src/types';
|
|
2
|
-
import React, { FC, ReactNode } from 'react';
|
|
3
|
-
interface GlobalConfigProviderProps {
|
|
4
|
-
config: AppshellGlobalConfig;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const GlobalConfigContext: React.Context<AppshellGlobalConfig>;
|
|
8
|
-
export declare const GlobalConfigProvider: FC<GlobalConfigProviderProps>;
|
|
9
|
-
export declare const GlobalConfigConsumer: React.Consumer<AppshellGlobalConfig>;
|
|
10
|
-
export default GlobalConfigContext;
|
|
11
|
-
//# sourceMappingURL=GlobalConfigContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalConfigContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/GlobalConfigContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,EAAiB,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,UAAU,yBAAyB;IACjC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,mBAAmB,qCAAqD,CAAC;AAEtF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAE9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,sCAA+B,CAAC;AAEjE,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AppshellManifest } from '@appshell/config';
|
|
2
|
-
import type { FC, ReactNode } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
interface ManifestProviderProps {
|
|
5
|
-
manifest: AppshellManifest;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare const ManifestContext: React.Context<AppshellManifest>;
|
|
9
|
-
export declare const ManifestProvider: FC<ManifestProviderProps>;
|
|
10
|
-
export declare const ManifestConsumer: React.Consumer<AppshellManifest>;
|
|
11
|
-
export default ManifestContext;
|
|
12
|
-
//# sourceMappingURL=ManifestContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/ManifestContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,iCAI1B,CAAC;AAkBH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC;AAEF,eAAO,MAAM,gBAAgB,kCAA2B,CAAC;AAEzD,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Metadata } from '@appshell/config';
|
|
2
|
-
import React, { FC, ReactNode } from 'react';
|
|
3
|
-
interface MetadataProviderProps {
|
|
4
|
-
metata: Metadata;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export declare const MetadataContext: React.Context<Metadata>;
|
|
8
|
-
export declare const MetadataProvider: FC<MetadataProviderProps>;
|
|
9
|
-
export declare const MetadataConsumer: React.Consumer<Metadata>;
|
|
10
|
-
export default MetadataContext;
|
|
11
|
-
//# sourceMappingURL=MetadataContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/MetadataContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAiB,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,UAAU,qBAAqB;IAC7B,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,yBAA8B,CAAC;AAE3D,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAEtD,CAAC;AAEF,eAAO,MAAM,gBAAgB,0BAA2B,CAAC;AAEzD,eAAe,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/RemoteContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,2CAAuD,CAAC;AAElF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAElD,CAAC;AAMF,eAAO,MAAM,cAAc,4CAAyB,CAAC;AAErD,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalConfig.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useGlobalConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;8BAK9C,oBAAoB;AAAvC,wBAC8D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useManifest.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;8BAMjC,gBAAgB;AAAnC,wBAA2F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;8BAKzB,QAAQ;AAA3B,wBAA2E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRemote.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useRemote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,yFAAyF;8BACtE,cAAc,GAAG,SAAS;AAA7C,wBAAiF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonResource.d.ts","sourceRoot":"","sources":["../../../../../src/resources/jsonResource.ts"],"names":[],"mappings":"yBAAgB,SAAS,OAAO,MAAM;;;AAAtC,wBAkCE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,SAAS,GAAG,OAAO,IAAI;IAC1C,IAAI,IAAI,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;CACvC,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
-
import { AppshellIndex } from '@appshell/config';
|
|
3
|
-
import remoteLoader from '@appshell/loader';
|
|
4
|
-
import React, { ComponentType, ReactElement, ReactNode, useEffect, useState } from 'react';
|
|
5
|
-
import { ManifestProvider } from '../contexts/ManifestContext';
|
|
6
|
-
import { RemoteProvider } from '../contexts/RemoteContext';
|
|
7
|
-
import useGlobalConfig from '../hooks/useGlobalConfig';
|
|
8
|
-
import LoadingError from './LoadingError';
|
|
9
|
-
|
|
10
|
-
export type ExtendedProps = Record<string, unknown>;
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
interface Window {
|
|
14
|
-
__appshell_index__: AppshellIndex;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
18
|
-
export type AppshellComponentProps<TProps extends ExtendedProps = ExtendedProps> = {
|
|
19
|
-
remote: string;
|
|
20
|
-
fallback?: ReactNode;
|
|
21
|
-
} & TProps;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Loads a remote once and leaves it alone.
|
|
25
|
-
*
|
|
26
|
-
* Keeping a remote current while it is being developed is not this component's job.
|
|
27
|
-
* A remote served by a dev server ships webpack's HMR runtime and a dev-server client
|
|
28
|
-
* inside its own `remoteEntry`, so it applies its own edits in place and React Fast
|
|
29
|
-
* Refresh swaps the component implementations underneath this tree — no reload, and no
|
|
30
|
-
* remount that would discard state this component never owned.
|
|
31
|
-
*
|
|
32
|
-
* Watching the remote's socket from here and reloading the page was strictly worse: it
|
|
33
|
-
* raced the remote's own update, and it threw away the entire composed app to deliver a
|
|
34
|
-
* change to one subtree. When webpack genuinely cannot apply an update, the remote's own
|
|
35
|
-
* client still falls back to a full reload — which is the right place for that decision,
|
|
36
|
-
* because it is the only side that knows whether the update applied.
|
|
37
|
-
*/
|
|
38
|
-
const AppshellComponent = <TProps extends ExtendedProps>({
|
|
39
|
-
remote,
|
|
40
|
-
fallback,
|
|
41
|
-
...rest
|
|
42
|
-
}: AppshellComponentProps<TProps>): ReactElement<TProps> => {
|
|
43
|
-
const config = useGlobalConfig();
|
|
44
|
-
const [element, setElement] = useState<ReactElement>();
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
let disposed = false;
|
|
48
|
-
const loadComponent = remoteLoader(config);
|
|
49
|
-
|
|
50
|
-
async function load() {
|
|
51
|
-
try {
|
|
52
|
-
const [Component, manifest] = await loadComponent<ComponentType>(remote);
|
|
53
|
-
|
|
54
|
-
if (disposed || !Component) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setElement(
|
|
59
|
-
<ManifestProvider manifest={manifest}>
|
|
60
|
-
<RemoteProvider remote={manifest.remotes[remote]}>
|
|
61
|
-
<Component {...rest} />
|
|
62
|
-
</RemoteProvider>
|
|
63
|
-
</ManifestProvider>,
|
|
64
|
-
);
|
|
65
|
-
} catch (err) {
|
|
66
|
-
if (!disposed) {
|
|
67
|
-
setElement(<LoadingError remote={remote} reason={`${err}`} />);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
setElement(undefined);
|
|
73
|
-
load();
|
|
74
|
-
|
|
75
|
-
return () => {
|
|
76
|
-
disposed = true;
|
|
77
|
-
};
|
|
78
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
-
}, [remote, config, ...Object.values(rest)]);
|
|
80
|
-
|
|
81
|
-
// eslint-disable-next-line no-console
|
|
82
|
-
console.debug(`rendering AppshellComponent[${remote}], loading=${!element}`);
|
|
83
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
84
|
-
return <>{element || fallback}</>;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
AppshellComponent.defaultProps = {
|
|
88
|
-
fallback: undefined,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default AppshellComponent;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated This component is deprecated and will be removed in future versions.
|
|
95
|
-
* Please use AppshellComponent instead.
|
|
96
|
-
*/
|
|
97
|
-
export const FederatedComponent = AppshellComponent;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
type ErrorProps = {
|
|
4
|
-
remote: string;
|
|
5
|
-
reason: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const LoadingError: FC<ErrorProps> = ({ remote, reason }) => (
|
|
9
|
-
<div style={{ border: '3px solid red' }}>
|
|
10
|
-
<h5>{`Error loading Appshell component '${remote}.'`}</h5>
|
|
11
|
-
<span style={{ fontSize: '1rem' }}>{reason}</span>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export default LoadingError;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
2
|
-
import { AppshellGlobalConfig } from 'packages/config/src/types';
|
|
3
|
-
import React, { FC, ReactNode, useEffect } from 'react';
|
|
4
|
-
import { GlobalConfigProvider } from '../contexts/GlobalConfigContext';
|
|
5
|
-
import AppshellComponent from './AppshellComponent';
|
|
6
|
-
|
|
7
|
-
/** The registry inlines the composition, so a shell it served needs no config fetch. */
|
|
8
|
-
const inlinedConfig = (): AppshellGlobalConfig | undefined => {
|
|
9
|
-
const composition = typeof window === 'undefined' ? undefined : window.__appshell_config__;
|
|
10
|
-
return composition && { index: composition.index };
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const ReactHost: FC<{
|
|
14
|
-
configUrl?: string;
|
|
15
|
-
remote: string;
|
|
16
|
-
fallback?: ReactNode;
|
|
17
|
-
[x: string]: unknown;
|
|
18
|
-
}> = ({ configUrl, remote, fallback, ...rest }) => {
|
|
19
|
-
const [config, setGlobalConfig] = React.useState<AppshellGlobalConfig | undefined>(inlinedConfig);
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (config) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!configUrl) {
|
|
27
|
-
setGlobalConfig({ index: {} });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const fetchGlobalConfig = async () => {
|
|
32
|
-
const res = await fetch(configUrl);
|
|
33
|
-
setGlobalConfig(res.ok ? await res.json() : { index: {} });
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
fetchGlobalConfig();
|
|
37
|
-
}, [config, configUrl]);
|
|
38
|
-
|
|
39
|
-
if (!config) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<GlobalConfigProvider config={config}>
|
|
45
|
-
<AppshellComponent remote={remote} fallback={fallback} {...rest} />
|
|
46
|
-
</GlobalConfigProvider>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
ReactHost.defaultProps = {
|
|
51
|
-
configUrl: undefined,
|
|
52
|
-
fallback: undefined,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default ReactHost;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AppshellGlobalConfig } from 'packages/config/src/types';
|
|
2
|
-
import React, { createContext, FC, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface GlobalConfigProviderProps {
|
|
5
|
-
config: AppshellGlobalConfig;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const GlobalConfigContext = createContext<AppshellGlobalConfig>({ index: {} });
|
|
10
|
-
|
|
11
|
-
export const GlobalConfigProvider: FC<GlobalConfigProviderProps> = ({ config, children }) => (
|
|
12
|
-
<GlobalConfigContext.Provider value={config}>{children}</GlobalConfigContext.Provider>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export const GlobalConfigConsumer = GlobalConfigContext.Consumer;
|
|
16
|
-
|
|
17
|
-
export default GlobalConfigContext;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AppshellManifest } from '@appshell/config';
|
|
2
|
-
import type { FC, ReactNode } from 'react';
|
|
3
|
-
import React, { createContext, useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
interface ManifestProviderProps {
|
|
6
|
-
manifest: AppshellManifest;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const ManifestContext = createContext<AppshellManifest>({
|
|
11
|
-
remotes: {},
|
|
12
|
-
modules: {},
|
|
13
|
-
environment: {},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// `modules` is build-time webpack config that the browser has no use for, and it is
|
|
17
|
-
// the bulkiest field to inline. Warn for one release to find any consumer still on it.
|
|
18
|
-
const deprecateModules = (manifest: AppshellManifest): AppshellManifest =>
|
|
19
|
-
new Proxy(manifest, {
|
|
20
|
-
get(target, property, receiver) {
|
|
21
|
-
if (property === 'modules') {
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.warn(
|
|
24
|
-
'useManifest().modules is deprecated and will be removed. It is build-time webpack config; use useRemote() for what the browser needs. Please open an issue at github.com/appshell-org/appshell if you rely on it.',
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return Reflect.get(target, property, receiver);
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const ManifestProvider: FC<ManifestProviderProps> = ({ manifest, children }) => {
|
|
33
|
-
const value = useMemo(() => deprecateModules(manifest), [manifest]);
|
|
34
|
-
|
|
35
|
-
return <ManifestContext.Provider value={value}>{children}</ManifestContext.Provider>;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const ManifestConsumer = ManifestContext.Consumer;
|
|
39
|
-
|
|
40
|
-
export default ManifestContext;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Metadata } from '@appshell/config';
|
|
2
|
-
import React, { createContext, FC, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface MetadataProviderProps {
|
|
5
|
-
metata: Metadata;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const MetadataContext = createContext<Metadata>({});
|
|
10
|
-
|
|
11
|
-
export const MetadataProvider: FC<MetadataProviderProps> = ({ metata, children }) => (
|
|
12
|
-
<MetadataContext.Provider value={metata}>{children}</MetadataContext.Provider>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export const MetadataConsumer = MetadataContext.Consumer;
|
|
16
|
-
|
|
17
|
-
export default MetadataContext;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AppshellRemote } from '@appshell/config';
|
|
2
|
-
import type { FC, ReactNode } from 'react';
|
|
3
|
-
import React, { createContext } from 'react';
|
|
4
|
-
|
|
5
|
-
interface RemoteProviderProps {
|
|
6
|
-
remote?: AppshellRemote;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const RemoteContext = createContext<AppshellRemote | undefined>(undefined);
|
|
11
|
-
|
|
12
|
-
export const RemoteProvider: FC<RemoteProviderProps> = ({ remote, children }) => (
|
|
13
|
-
<RemoteContext.Provider value={remote}>{children}</RemoteContext.Provider>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
RemoteProvider.defaultProps = {
|
|
17
|
-
remote: undefined,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const RemoteConsumer = RemoteContext.Consumer;
|
|
21
|
-
|
|
22
|
-
export default RemoteContext;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AppshellGlobalConfig } from 'packages/config/src/types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
4
|
-
import GlobalConfigContext from '../contexts/GlobalConfigContext';
|
|
5
|
-
|
|
6
|
-
export default (): AppshellGlobalConfig =>
|
|
7
|
-
React.useContext<AppshellGlobalConfig>(GlobalConfigContext);
|
package/src/hooks/useManifest.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AppshellManifest } from '@appshell/config';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
5
|
-
import ManifestContext from '../contexts/ManifestContext';
|
|
6
|
-
|
|
7
|
-
export default (): AppshellManifest => React.useContext<AppshellManifest>(ManifestContext);
|
package/src/hooks/useMetadata.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Metadata } from '@appshell/config';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
4
|
-
import MetadataContext from '../contexts/MetadataContext';
|
|
5
|
-
|
|
6
|
-
export default (): Metadata => React.useContext<Metadata>(MetadataContext);
|
package/src/hooks/useRemote.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AppshellRemote } from '@appshell/config';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
4
|
-
import RemoteContext from '../contexts/RemoteContext';
|
|
5
|
-
|
|
6
|
-
/** The remote backing the nearest `AppshellComponent` — it already knows its own key. */
|
|
7
|
-
export default (): AppshellRemote | undefined => React.useContext(RemoteContext);
|
package/src/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as AppshellComponent, FederatedComponent } from './components/AppshellComponent';
|
|
2
|
-
export { default as ReactHost } from './components/ReactHost';
|
|
3
|
-
export { GlobalConfigProvider } from './contexts/GlobalConfigContext';
|
|
4
|
-
export { ManifestProvider } from './contexts/ManifestContext';
|
|
5
|
-
export { MetadataProvider } from './contexts/MetadataContext';
|
|
6
|
-
export { RemoteProvider } from './contexts/RemoteContext';
|
|
7
|
-
export { default as useGlobalConfig } from './hooks/useGlobalConfig';
|
|
8
|
-
export { default as useManifest } from './hooks/useManifest';
|
|
9
|
-
export { default as useMetadata } from './hooks/useMetadata';
|
|
10
|
-
export { default as useRemote } from './hooks/useRemote';
|
|
11
|
-
export { default as jsonResource } from './resources/jsonResource';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export default <TResource>(url: string) => {
|
|
2
|
-
let status = 'pending';
|
|
3
|
-
let result: TResource | Error;
|
|
4
|
-
const suspender = fetch(url, {
|
|
5
|
-
headers: {
|
|
6
|
-
'Content-Type': 'application/json',
|
|
7
|
-
Accept: 'application/json',
|
|
8
|
-
},
|
|
9
|
-
// eslint-disable-next-line consistent-return
|
|
10
|
-
}).then((response) => {
|
|
11
|
-
if (response.ok) {
|
|
12
|
-
return response.json().then((data) => {
|
|
13
|
-
status = 'success';
|
|
14
|
-
result = data;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
status = 'error';
|
|
18
|
-
result = new Error(`${response.status} ${response.statusText} ${response.url}`);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
read() {
|
|
23
|
-
if (status === 'pending') {
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
25
|
-
throw suspender as Promise<TResource>;
|
|
26
|
-
} else if (status === 'error') {
|
|
27
|
-
throw result as Error;
|
|
28
|
-
} else if (status === 'success') {
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return undefined;
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
};
|
package/src/types.ts
DELETED
package/tsconfig.json
DELETED
package/webpack.config.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
2
|
-
const Visualizer = require('webpack-visualizer-plugin2');
|
|
3
|
-
|
|
4
|
-
module.exports = (env, { mode }) => {
|
|
5
|
-
const isDevelopment = mode === 'development';
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
entry: './src/index',
|
|
9
|
-
mode,
|
|
10
|
-
devtool: isDevelopment ? 'eval-source-map' : false,
|
|
11
|
-
output: {
|
|
12
|
-
filename: '[name].js',
|
|
13
|
-
pathinfo: false,
|
|
14
|
-
libraryTarget: 'umd',
|
|
15
|
-
},
|
|
16
|
-
resolve: {
|
|
17
|
-
extensions: ['.js', '.ts', '.tsx'],
|
|
18
|
-
plugins: [new TsconfigPathsPlugin()],
|
|
19
|
-
},
|
|
20
|
-
module: {
|
|
21
|
-
rules: [
|
|
22
|
-
{
|
|
23
|
-
test: /\.tsx?$/,
|
|
24
|
-
exclude: /node_modules/,
|
|
25
|
-
use: [
|
|
26
|
-
{
|
|
27
|
-
loader: 'babel-loader',
|
|
28
|
-
options: {
|
|
29
|
-
presets: ['@babel/preset-react', '@babel/preset-typescript'],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
// plugins: [isDevelopment && new Visualizer()].filter(Boolean),
|
|
37
|
-
externals: {
|
|
38
|
-
react: 'react',
|
|
39
|
-
'react-dom': 'reactDOM',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
};
|