mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
extensions-api -- loading extension modules -- part 2
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
b2414542b8
commit
e93c53ff0c
8 files changed
+20
-13
No files matched your search
@@ -1,9 +1,11 @@
|
||||
// import { LensExtension } from "@lens"; // fixme: provide runtime import
|
||||
// fixme: hook up generated types from extension-api.ts (tsc --declaration)
|
||||
// fixme: provide compile or runtime import
|
||||
import { LensExtension } from "@lens/extensions";
|
||||
|
||||
export default class ExampleExtension /*extends LensExtension*/ {
|
||||
export default class ExampleExtension extends LensExtension {
|
||||
async init(): Promise<any> {
|
||||
console.log('Example extension: init')
|
||||
// return super.init();
|
||||
return super.init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true
|
||||
},
|
||||
"files": [
|
||||
"include": [
|
||||
"./example-extension/example-extension.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// LensExtensions.api.js developer kit (Lens common components)
|
||||
// Should be published to npm (with types declarations) and also available as built-in dependency
|
||||
|
||||
export * from "./extension"
|
||||
@@ -5,9 +5,12 @@ import extensionManifest from "./example-extension/package.json"
|
||||
import logger from "../main/logger";
|
||||
|
||||
// TODO: extensions api
|
||||
// - figure out how to expose/inject lens apis to extension:
|
||||
// * figure out how to expose/inject lens apis to extension:
|
||||
// -- replace import "@lens" to real path to "build/Lens.js" or maybe "build/Lens-extensions.api.js"
|
||||
// -- load extension via NodeJS.require() / webContents.executeJavaScript()
|
||||
// * figure out how to re-use/provide-access from extension to its:
|
||||
// -- npm dependencies
|
||||
// -- folder assets/resources
|
||||
|
||||
export type ExtensionId = string;
|
||||
export type ExtensionVersion = string | number;
|
||||
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
// todo: re-export / expose more apis
|
||||
// todo: generate as Lens.d.js + add real runtime exports
|
||||
|
||||
declare module "@lens" {
|
||||
export { LensExtension, ExtensionId, ExtensionVersion } from "./extension";
|
||||
}
|
||||
Reference in new issue
Block a user