@appshell/loader 1.0.0-alpha.0 → 1.0.0-alpha.100

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 (95) hide show
  1. package/README.md +19 -21
  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 +26 -0
  6. package/dist/types/config/src/credentials.d.ts +48 -0
  7. package/dist/types/config/src/generate.manifest.d.ts +30 -2
  8. package/dist/types/config/src/index.d.ts +12 -9
  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/package-name.d.ts +20 -0
  13. package/dist/types/config/src/publish.d.ts +93 -8
  14. package/dist/types/config/src/sync.d.ts +0 -1
  15. package/dist/types/config/src/tls.d.ts +11 -0
  16. package/dist/types/config/src/types.d.ts +184 -31
  17. package/dist/types/config/src/utils/blur.d.ts +0 -1
  18. package/dist/types/config/src/utils/compare.d.ts +0 -1
  19. package/dist/types/config/src/utils/config.d.ts +15 -1
  20. package/dist/types/config/src/utils/copy.d.ts +0 -1
  21. package/dist/types/config/src/utils/dump.d.ts +10 -0
  22. package/dist/types/config/src/utils/index.d.ts +2 -5
  23. package/dist/types/config/src/utils/list.d.ts +0 -1
  24. package/dist/types/config/src/utils/load.d.ts +0 -1
  25. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
  26. package/dist/types/config/src/validators/index.d.ts +0 -3
  27. package/dist/types/loader/src/index.d.ts +0 -1
  28. package/dist/types/loader/src/loadAppshellComponent.d.ts +13 -14
  29. package/dist/types/loader/src/remoteLoader.d.ts +2 -3
  30. package/dist/types/loader/src/resolvers.d.ts +4 -12
  31. package/dist/types/loader/src/types.d.ts +0 -1
  32. package/dist/types/runtime/src/errors.d.ts +32 -0
  33. package/dist/types/runtime/src/identity.d.ts +47 -0
  34. package/dist/types/runtime/src/index.d.ts +6 -0
  35. package/dist/types/runtime/src/store.d.ts +25 -0
  36. package/dist/types/runtime/src/types.d.ts +9 -0
  37. package/dist/types/runtime/src/wire.d.ts +58 -0
  38. package/package.json +15 -4
  39. package/CHANGELOG.md +0 -184
  40. package/__tests__/fetchDynamicScript.spec.ts +0 -44
  41. package/__tests__/fixtures/TestComponent.ts +0 -3
  42. package/__tests__/loadAppshellComponent.spec.ts +0 -102
  43. package/__tests__/remoteLoader.spec.ts +0 -144
  44. package/__tests__/resolvers.spec.ts +0 -128
  45. package/dist/types/config/src/axios.d.ts.map +0 -1
  46. package/dist/types/config/src/configmap.d.ts.map +0 -1
  47. package/dist/types/config/src/deregister.d.ts +0 -3
  48. package/dist/types/config/src/deregister.d.ts.map +0 -1
  49. package/dist/types/config/src/generate.env.d.ts +0 -3
  50. package/dist/types/config/src/generate.env.d.ts.map +0 -1
  51. package/dist/types/config/src/generate.global-config.d.ts +0 -10
  52. package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
  53. package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
  54. package/dist/types/config/src/index.d.ts.map +0 -1
  55. package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
  56. package/dist/types/config/src/outdated.d.ts.map +0 -1
  57. package/dist/types/config/src/publish.d.ts.map +0 -1
  58. package/dist/types/config/src/register.d.ts +0 -4
  59. package/dist/types/config/src/register.d.ts.map +0 -1
  60. package/dist/types/config/src/sync.d.ts.map +0 -1
  61. package/dist/types/config/src/types.d.ts.map +0 -1
  62. package/dist/types/config/src/utils/blur.d.ts.map +0 -1
  63. package/dist/types/config/src/utils/compare.d.ts.map +0 -1
  64. package/dist/types/config/src/utils/config.d.ts.map +0 -1
  65. package/dist/types/config/src/utils/copy.d.ts.map +0 -1
  66. package/dist/types/config/src/utils/index.d.ts.map +0 -1
  67. package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
  68. package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
  69. package/dist/types/config/src/utils/list.d.ts.map +0 -1
  70. package/dist/types/config/src/utils/load.d.ts.map +0 -1
  71. package/dist/types/config/src/utils/loadJson.d.ts +0 -10
  72. package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
  73. package/dist/types/config/src/utils/merge.d.ts +0 -4
  74. package/dist/types/config/src/utils/merge.d.ts.map +0 -1
  75. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
  76. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
  77. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
  78. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
  79. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
  80. package/dist/types/config/src/validators/index.d.ts.map +0 -1
  81. package/dist/types/loader/src/fetchDynamicScript.d.ts +0 -3
  82. package/dist/types/loader/src/fetchDynamicScript.d.ts.map +0 -1
  83. package/dist/types/loader/src/index.d.ts.map +0 -1
  84. package/dist/types/loader/src/loadAppshellComponent.d.ts.map +0 -1
  85. package/dist/types/loader/src/remoteLoader.d.ts.map +0 -1
  86. package/dist/types/loader/src/resolvers.d.ts.map +0 -1
  87. package/dist/types/loader/src/types.d.ts.map +0 -1
  88. package/src/fetchDynamicScript.ts +0 -40
  89. package/src/index.ts +0 -7
  90. package/src/loadAppshellComponent.ts +0 -48
  91. package/src/remoteLoader.ts +0 -80
  92. package/src/resolvers.ts +0 -110
  93. package/src/types.ts +0 -10
  94. package/tsconfig.json +0 -7
  95. package/webpack.config.js +0 -37
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.env.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.env.ts"],"names":[],"mappings":";AAGA,wBAuBK"}
@@ -1,10 +0,0 @@
1
- import { AppshellGlobalConfig } from './types';
2
- type GenerateGlobalConfigOptions = {
3
- insecure: boolean;
4
- apiKey?: string;
5
- apiKeyHeader?: string;
6
- proxyUrl?: string;
7
- };
8
- declare const _default: (registries: string[], options?: GenerateGlobalConfigOptions) => Promise<AppshellGlobalConfig>;
9
- export default _default;
10
- //# sourceMappingURL=generate.global-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.global-config.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.global-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;qCAGY,MAAM,EAAE,YACX,2BAA2B,KACnC,OAAO,CAAC,oBAAoB,CAAC;AAHhC,wBA8CE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.manifest.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.manifest.ts"],"names":[],"mappings":"AAOA;;;;GAIG;yBACmB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,MAAM;AAArF,wBAaE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../config/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,WAAW,EACX,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"appshell.config.d.ts","sourceRoot":"","sources":["../../../../../../config/src/mappers/appshell.config.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,gBAAgB,EAEhB,gBAAgB,EAChB,SAAS,EACV,MAAM,UAAU,CAAC;AAiElB,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAChE,gBAAgB,QACpB,SAAS,gCAQhB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"outdated.d.ts","sourceRoot":"","sources":["../../../../../config/src/outdated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;sCAGrB,WAAW,oBAAoB,gBAAgB;AAAlF,wBAYE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../../config/src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAmBF;;;GAGG;AACH,eAAO,MAAM,OAAO,wEAQjB,cAAc,KAAG,OAAO,CAAC,aAAa,CAYxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,aACT,MAAM,eACH,MAAM,SACZ,MAAM,UACL,MAAM,KACb,OAAO,CAAC,IAAI,CAgBd,CAAC"}
@@ -1,4 +0,0 @@
1
- import { AppshellManifest } from './types';
2
- declare const _default: (manifest: AppshellManifest, registryPathOrUrl: string, allowOverrides?: boolean) => Promise<void>;
3
- export default _default;
4
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../../config/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,gBAAgB,EAAmB,MAAM,SAAS,CAAC;mCAetE,gBAAgB,qBACP,MAAM;AAF3B,wBA2CE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../../config/src/sync.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,C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IAEd;;OAEG;IACH,UAAU,CAAC,EACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,KAAK,GACL,aAAa,GACb,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,eAAe,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC;IAErD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC;CACnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/blur.ts"],"names":[],"mappings":";AAAA,wBAA8F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/compare.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,mBAAmB,iBAAkB,gBAAgB,uCAMpB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,gBACf,MAAM,gBACL,MAAM,iBACL,MAAM,GAAG,SAAS,kBACjB,MAAM,mBACL,MAAM,GAAG,SAAS,WAC1B,iBAAiB,sBAiD3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,gBAAgB,YAAY,gBAAgB,sBAYrF,CAAC;AAEJ,eAAO,MAAM,yBAAyB,gBACvB,WAAW,gBACV,gBAAgB,sBAoB/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,eACnB,gBAAgB,gBACd,gBAAgB,sBAY/B,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,iBAAiB,SAsBtD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,eAAO,MAAM,UAAU,eAAgB,MAAM,cAkB5C,CAAC;AAEF,eAAO,MAAM,WAAW,eAAgB,MAAM,UAAU,SAAS,SAchE,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAAY,SAAS,QAAQ,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAe7F,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/copy.ts"],"names":[],"mappings":"AAGA;;;;GAIG;kCACsB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AAArD,wBAOE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: (urlString: string) => boolean;
2
- export default _default;
3
- //# sourceMappingURL=isValidUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidUrl.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/isValidUrl.ts"],"names":[],"mappings":"oCAA2B,MAAM;AAAjC,wBAME"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/list.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,YAAa,MAAM,2BAAqB,MAAM,GAAG,MAAM,aAMhE,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/load.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,IAAI,GAAI,OAAO,cAAc,MAAM,KAAG,OAU3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,MAAM,EAAE,KAAG,OAAO,EAAqC,CAAC;AAEnG,eAAe,IAAI,CAAC"}
@@ -1,10 +0,0 @@
1
- type LoadJsonOptions = {
2
- insecure: boolean;
3
- target: string | RegExp;
4
- apiKey?: string;
5
- apiKeyHeader?: string;
6
- proxyUrl?: string;
7
- };
8
- declare const _default: <T = Record<string, unknown>>(jsonPathOrUrl: string, options?: LoadJsonOptions) => Promise<T[]>;
9
- export default _default;
10
- //# sourceMappingURL=loadJson.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadJson.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/loadJson.ts"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;yBAsDoB,CAAC,2CACN,MAAM,YACZ,eAAe,KAOvB,OAAO,CAAC,CAAC,EAAE,CAAC;AATf,wBAqBE"}
@@ -1,4 +0,0 @@
1
- import { ConfigValidator } from '../types';
2
- declare const _default: <TSchema>(validator: ConfigValidator, ...documents: TSchema[]) => TSchema;
3
- export default _default;
4
- //# sourceMappingURL=merge.d.ts.map
@@ -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,4 +0,0 @@
1
- import { ConfigValidator } from '../types';
2
- declare const _default: ConfigValidator;
3
- export default _default;
4
- //# sourceMappingURL=AppshellGlobalConfigValidator.d.ts.map
@@ -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,4 +0,0 @@
1
- import { ConfigValidator } from '../types';
2
- declare const _default: ConfigValidator;
3
- export default _default;
4
- //# sourceMappingURL=AppshellManifestValidator.d.ts.map
@@ -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,3 +0,0 @@
1
- declare const _default: (url: string) => Promise<boolean>;
2
- export default _default;
3
- //# sourceMappingURL=fetchDynamicScript.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchDynamicScript.d.ts","sourceRoot":"","sources":["../../../../src/fetchDynamicScript.ts"],"names":[],"mappings":"8BAE2B,MAAM;AAAjC,wBAqCE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../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":["../../../../src/loadAppshellComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,CAAC,MAAM,CAAC;IACb,SAAS,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,MAAM,wBAAwB,EAAE;QAAE,OAAO,EAAE,UAAU,CAAA;KAAE,CAAC;IACxD,UAAU,MAAM;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;KACtD;CACF;yBAIqB,UAAU,SAAS,MAAM,UAAU,MAAM;AAA/D,wBAgCE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGlF,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,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,wBAqDE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../../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":["../../../../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,40 +0,0 @@
1
- const urlCache = new Set<string>();
2
-
3
- export default async (url: string) => {
4
- const element = document.createElement('script');
5
-
6
- const cleanup = (): void => {
7
- if (document.head.contains(element)) {
8
- document.head.removeChild(element);
9
- }
10
- };
11
-
12
- return new Promise<boolean>((resolve, reject) => {
13
- if (urlCache.has(url)) {
14
- resolve(false);
15
- } else {
16
- urlCache.add(url);
17
-
18
- element.src = url;
19
- element.type = 'text/javascript';
20
- element.async = true;
21
-
22
- element.onload = () => {
23
- // eslint-disable-next-line no-console
24
- console.debug(`Remote entry fetched from '${url}'.`);
25
-
26
- resolve(true);
27
- };
28
-
29
- element.onerror = () => {
30
- const message = `Failed to fetch remote entry from '${url}'.`;
31
- // eslint-disable-next-line no-console
32
- console.error(message);
33
- urlCache.delete(url);
34
- reject(message);
35
- };
36
-
37
- document.head.appendChild(element);
38
- }
39
- }).finally(cleanup);
40
- };
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- import remoteLoader from './remoteLoader';
2
-
3
- export type { RemoteLoaderOptions } from './remoteLoader';
4
- export * from './resolvers';
5
- export * from './types';
6
-
7
- export default remoteLoader;
@@ -1,48 +0,0 @@
1
- import { ModuleContainer, ShareScope } from './types';
2
-
3
- /* eslint-disable @typescript-eslint/naming-convention */
4
- declare global {
5
- function __webpack_init_sharing__(id: string): Promise<void>;
6
- // eslint-disable-next-line no-underscore-dangle
7
- const __webpack_share_scopes__: { default: ShareScope };
8
- interface Window {
9
- [key: string]: unknown;
10
- __webpack_share_scopes__: Record<string, ShareScope>;
11
- }
12
- }
13
-
14
- type ShareScopes = keyof typeof __webpack_share_scopes__;
15
-
16
- export default async <TComponent>(scope: string, module: string, shareScope = 'default') => {
17
- // eslint-disable-next-line no-console
18
- console.debug(
19
- `loading Appshell component: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`,
20
- );
21
-
22
- // Initializes the share scope. This fills it with known provided modules from this build and all remotes
23
- await __webpack_init_sharing__(shareScope);
24
- const container = window[scope] as ModuleContainer<TComponent>;
25
-
26
- if (!container) {
27
- throw new Error(`Failed to find module container ${scope}`);
28
- }
29
-
30
- // Initialize the container, it may provide shared modules
31
- await container.init(__webpack_share_scopes__[shareScope as ShareScopes]);
32
- const factory = await container.get(module);
33
-
34
- if (!factory) {
35
- throw new Error(`Invalid factory produced by container for module ${module}.`);
36
- }
37
-
38
- const Module = factory();
39
-
40
- // eslint-disable-next-line no-console
41
- console.debug(
42
- `Appshell component loaded: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`,
43
- );
44
-
45
- const Component = Module.default;
46
-
47
- return Component;
48
- };
@@ -1,80 +0,0 @@
1
- /* eslint-disable no-underscore-dangle */
2
- import type { AppshellComposition, AppshellGlobalConfig } from '@appshell/config';
3
- import fetchDynamicScript from './fetchDynamicScript';
4
- import loadAppshellComponent from './loadAppshellComponent';
5
- import {
6
- chainResolvers,
7
- inlineResolver,
8
- legacyManifestResolver,
9
- registryResolver,
10
- type RemoteResolver,
11
- } from './resolvers';
12
-
13
- const fetchedScriptCache = new Set<string>();
14
-
15
- declare global {
16
- interface Window {
17
- __appshell_config__?: AppshellComposition;
18
- }
19
- }
20
-
21
- export type RemoteLoaderOptions = {
22
- composition?: AppshellComposition;
23
- /** Replaces the resolver chain outright; a seam for tests and embedders. */
24
- resolver?: RemoteResolver;
25
- };
26
-
27
- export default (config: AppshellGlobalConfig, options: RemoteLoaderOptions = {}) => {
28
- const composition =
29
- options.composition ?? (typeof window === 'undefined' ? undefined : window.__appshell_config__);
30
-
31
- const resolve =
32
- options.resolver ??
33
- chainResolvers(
34
- inlineResolver(composition),
35
- registryResolver(composition),
36
- legacyManifestResolver(config),
37
- );
38
-
39
- return async <TComponent>(key: string) => {
40
- const failed = (err: unknown) =>
41
- new Error(`Failed to load component '${key}'. ${err?.toString()}`);
42
-
43
- let resolution;
44
- try {
45
- resolution = await resolve(key);
46
- } catch (err) {
47
- throw failed(err);
48
- }
49
-
50
- if (!resolution) {
51
- throw new Error(`Remote resource not found in registry. Expected: ${key}`);
52
- }
53
-
54
- const { remote, environment, manifest } = resolution;
55
-
56
- try {
57
- window[`__appshell_env__${remote.scope}`] = environment;
58
-
59
- const loaded =
60
- fetchedScriptCache.has(remote.remoteEntryUrl) ||
61
- (await fetchDynamicScript(remote.remoteEntryUrl));
62
-
63
- if (!loaded) {
64
- return [null, null] as const;
65
- }
66
-
67
- fetchedScriptCache.add(remote.remoteEntryUrl);
68
-
69
- const Component = await loadAppshellComponent<TComponent>(
70
- remote.scope,
71
- remote.module,
72
- remote.shareScope,
73
- );
74
-
75
- return [Component, manifest] as const;
76
- } catch (err) {
77
- throw failed(err);
78
- }
79
- };
80
- };
package/src/resolvers.ts DELETED
@@ -1,110 +0,0 @@
1
- import type {
2
- AppshellComposition,
3
- AppshellGlobalConfig,
4
- AppshellManifest,
5
- ResolvedRemote,
6
- } from '@appshell/config';
7
-
8
- export type RemoteResolution = {
9
- remote: ResolvedRemote;
10
- /** Already merged with the environment's overrides — nothing left for the browser to layer on. */
11
- environment: Record<string, string | number | undefined>;
12
- /** Back-compat payload for `ManifestProvider`; synthesized when the source was a composition. */
13
- manifest: AppshellManifest;
14
- };
15
-
16
- export type RemoteResolver = (key: string) => Promise<RemoteResolution | undefined>;
17
-
18
- const manifestOf = (composition: AppshellComposition, remotes: AppshellManifest['remotes']) => ({
19
- remotes,
20
- environment: composition.environment,
21
- modules: {},
22
- });
23
-
24
- /** The registry inlined the composition into the page, so no network call is needed. */
25
- export const inlineResolver =
26
- (composition?: AppshellComposition): RemoteResolver =>
27
- async (key) => {
28
- const remote = composition?.remotes[key];
29
- if (!composition || !remote) return undefined;
30
-
31
- return {
32
- remote,
33
- environment: composition.environment[remote.scope] ?? {},
34
- manifest: manifestOf(composition, composition.remotes),
35
- };
36
- };
37
-
38
- /** Fetch-on-miss: covers an app activated after this page was served. */
39
- export const registryResolver =
40
- (composition?: AppshellComposition, origin = ''): RemoteResolver =>
41
- async (key) => {
42
- if (!composition) return undefined;
43
-
44
- const url = `${origin}/v1/environments/${composition.environmentId}/remotes/${key}`;
45
- const response = await fetch(url, { credentials: 'include' });
46
- if (!response.ok) return undefined;
47
-
48
- const remote: ResolvedRemote = await response.json();
49
-
50
- return {
51
- remote,
52
- environment: composition.environment[remote.scope] ?? {},
53
- manifest: manifestOf(composition, { [key]: remote }),
54
- };
55
- };
56
-
57
- /**
58
- * Pre-registry hosts: follow `index[key]` to the app's own manifest. The override
59
- * merge stays here because in this mode no server has done it.
60
- */
61
- export const legacyManifestResolver = (config: AppshellGlobalConfig): RemoteResolver => {
62
- const cache = new Map<string, Promise<AppshellManifest>>();
63
-
64
- const fetchManifest = (url: string) => {
65
- const cached = cache.get(url);
66
- if (cached) return cached;
67
-
68
- const pending = fetch(url, { credentials: 'include' }).then(async (response) => {
69
- if (!response.ok) {
70
- throw new Error(`Failed to get manifest from ${url}. ${await response.text()}`);
71
- }
72
- return response.json() as Promise<AppshellManifest>;
73
- });
74
-
75
- cache.set(url, pending);
76
-
77
- return pending;
78
- };
79
-
80
- return async (key) => {
81
- const manifestUrl = config.index?.[key];
82
- if (!manifestUrl) return undefined;
83
-
84
- const manifest = await fetchManifest(manifestUrl);
85
- const remote = manifest?.remotes[key];
86
- if (!remote) return undefined;
87
-
88
- return {
89
- remote,
90
- environment: {
91
- ...(manifest.environment[remote.scope] ?? {}),
92
- ...(config.overrides?.environment?.[remote.scope] ?? {}),
93
- },
94
- manifest,
95
- };
96
- };
97
- };
98
-
99
- export const chainResolvers =
100
- (...resolvers: RemoteResolver[]): RemoteResolver =>
101
- async (key) => {
102
- // eslint-disable-next-line no-restricted-syntax
103
- for (const resolve of resolvers) {
104
- // eslint-disable-next-line no-await-in-loop
105
- const resolution = await resolve(key);
106
- if (resolution) return resolution;
107
- }
108
-
109
- return undefined;
110
- };
package/src/types.ts DELETED
@@ -1,10 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- export type ShareScope<TComponent = any> = Record<
3
- string,
4
- Record<string, { loaded?: 1; get: () => Promise<TComponent>; from: string; eager: boolean }>
5
- >;
6
-
7
- export interface ModuleContainer<TComponent> {
8
- init(shareScope: ShareScope<TComponent>): Promise<void>;
9
- get(module: string): Promise<() => Record<string, TComponent>>;
10
- }
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig",
3
- "compilerOptions": {
4
- "declarationDir": "./dist/types"
5
- },
6
- "include": ["./src"]
7
- }
package/webpack.config.js DELETED
@@ -1,37 +0,0 @@
1
- const path = require('path');
2
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
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'],
18
- plugins: [new TsconfigPathsPlugin()],
19
- },
20
- module: {
21
- rules: [
22
- {
23
- test: /\.ts$/,
24
- exclude: /node_modules/,
25
- use: [
26
- {
27
- loader: 'babel-loader',
28
- options: {
29
- presets: ['@babel/preset-typescript'],
30
- },
31
- },
32
- ],
33
- },
34
- ],
35
- },
36
- };
37
- };