web-extend-plugin-vue2 0.3.3 → 0.3.5

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/index.d.ts CHANGED
@@ -36,7 +36,56 @@ export type AdaptRouteDeclarationsFn = (ctx: {
36
36
  declarations: ReadonlyArray<RouteDeclaration>
37
37
  }) => VueRouteConfig[]
38
38
 
39
- export type HostContext = Readonly<Record<string, unknown>>
39
+ export type HostExposeMeta = {
40
+ title?: string
41
+ description?: string
42
+ }
43
+
44
+ export type HostComponentMeta = HostExposeMeta
45
+
46
+ export type HostComponentEntry = HostComponentMeta & {
47
+ component: unknown
48
+ }
49
+
50
+ export type HostComponentRegistry =
51
+ | Record<string, unknown | HostComponentEntry>
52
+ | Array<(HostComponentEntry & { name: string })>
53
+
54
+ export type HostModuleMeta = HostExposeMeta
55
+
56
+ export type HostModuleEntry = HostModuleMeta & {
57
+ module: unknown
58
+ }
59
+
60
+ export type HostModuleRegistry =
61
+ | Record<string, unknown | HostModuleEntry>
62
+ | Array<(HostModuleEntry & { name: string })>
63
+
64
+ export type RegisterVueGlobalComponentsOptions = {
65
+ source?: Record<string, unknown>
66
+ include?: (name: string, component: unknown) => boolean
67
+ mapName?: (name: string, component: unknown) => string | null | undefined
68
+ meta?: HostComponentMeta | ((name: string, component: unknown) => HostComponentMeta | undefined)
69
+ }
70
+
71
+ export type HostUiCapability = {
72
+ framework?: string
73
+ componentLibrary?: string
74
+ }
75
+
76
+ export type HostCapabilities = Readonly<
77
+ Record<string, unknown> & {
78
+ ui?: HostUiCapability
79
+ modules?: Readonly<Record<string, HostModuleMeta>>
80
+ components?: Readonly<Record<string, HostComponentMeta>>
81
+ }
82
+ >
83
+
84
+ export type HostContext = Readonly<
85
+ Record<string, unknown> & {
86
+ capabilities?: HostCapabilities
87
+ }
88
+ >
40
89
 
41
90
  export type OnBeforePluginActivateFn = (ctx: {
42
91
  pluginId: string
@@ -75,6 +124,24 @@ export type HostKitOptions = {
75
124
  hostContext?: HostContext
76
125
  }
77
126
 
127
+ export type PluginManifestHostCapabilities = Readonly<
128
+ Record<string, unknown> & {
129
+ modules?: string[]
130
+ components?: string[]
131
+ ui?: Record<string, unknown>
132
+ }
133
+ >
134
+
135
+ export type WebExtendPluginManifestRecord = Readonly<
136
+ Record<string, unknown> & {
137
+ id: string
138
+ priority?: unknown
139
+ entryUrl?: string
140
+ engines?: { host?: string }
141
+ hostCapabilities?: PluginManifestHostCapabilities
142
+ }
143
+ >
144
+
78
145
  export type WebExtendPluginRuntimeOptions = HostKitOptions &
79
146
  Record<string, unknown> & {
80
147
  manifestBase?: string
@@ -101,6 +168,7 @@ export type WebExtendPluginRuntimeOptions = HostKitOptions &
101
168
  bootstrapSummary?: boolean
102
169
  fetchManifest?: ManifestFetchFn
103
170
  hostContext?: Record<string, unknown>
171
+ hostCapabilities?: HostCapabilities
104
172
  onBeforePluginActivate?: OnBeforePluginActivateFn
105
173
  onAfterPluginActivate?: OnAfterPluginActivateFn
106
174
  onPluginActivateError?: OnPluginActivateErrorFn
@@ -118,6 +186,10 @@ export interface HostApi {
118
186
  registerScriptUrls(urls?: string[]): void
119
187
  registerSanitizedHtmlSnippet(): void
120
188
  getContributedRoutes(): PluginRouteSnapshot[]
189
+ getHostModule(name: string): unknown
190
+ getHostModuleMeta(name: string): HostModuleMeta | undefined
191
+ getHostComponent(name: string): unknown
192
+ getHostComponentMeta(name: string): HostComponentMeta | undefined
121
193
  getBridge(): {
122
194
  request(path: string, init?: RequestInit): Promise<Response>
123
195
  }
@@ -175,6 +247,18 @@ export function createHostApi(pluginId: string, router: unknown, hostKit?: HostK
175
247
 
176
248
  export function disposeWebPlugin(pluginId: string): void
177
249
  export const registries: unknown
250
+ export function registerHostModules(input: HostModuleRegistry): Readonly<Record<string, HostModuleMeta>>
251
+ export function registerHostComponents(input: HostComponentRegistry): Readonly<Record<string, HostComponentMeta>>
252
+ export function registerVueGlobalComponents(
253
+ VueRuntime: unknown,
254
+ options?: RegisterVueGlobalComponentsOptions
255
+ ): Readonly<Record<string, HostComponentMeta>>
256
+ export function getHostModule(name: string): unknown
257
+ export function getHostModuleMeta(name: string): HostModuleMeta | undefined
258
+ export function getAllHostModuleMeta(): Readonly<Record<string, HostModuleMeta>>
259
+ export function getHostComponent(name: string): unknown
260
+ export function getHostComponentMeta(name: string): HostComponentMeta | undefined
261
+ export function getAllHostComponentMeta(): Readonly<Record<string, HostComponentMeta>>
178
262
 
179
263
  export function createRequestBridge(config?: {
180
264
  allowedPathPrefixes?: string[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-extend-plugin-vue2",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,14 +43,18 @@
43
43
  "prepublishOnly": "npm run build"
44
44
  },
45
45
  "license": "Apache-2.0",
46
- "repository": {
47
- "type": "git",
48
- "url": "",
49
- "directory": "web-extend-plugin-vue2"
50
- },
51
- "keywords": [
52
- "vue2",
53
- "plugin",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/xtemplus/extend-plugin-framework.git",
49
+ "directory": "web-extend-plugin-vue2"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/xtemplus/extend-plugin-framework/issues"
53
+ },
54
+ "homepage": "https://github.com/xtemplus/extend-plugin-framework/tree/master/web-extend-plugin-vue2#readme",
55
+ "keywords": [
56
+ "vue2",
57
+ "plugin",
54
58
  "extension"
55
59
  ]
56
60
  }