mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crashes with usages of @k8slens/core/common
- Only observable with extensions Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
5002b450fd
commit
7c18c2a23b
@ -20,7 +20,6 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
"./main": "./static/build/library/main.js",
|
"./main": "./static/build/library/main.js",
|
||||||
"./renderer": "./static/build/library/renderer.js",
|
"./renderer": "./static/build/library/renderer.js",
|
||||||
"./common": "./static/build/library/common.js",
|
|
||||||
"./styles": "./static/build/library/renderer.css"
|
"./styles": "./static/build/library/renderer.css"
|
||||||
},
|
},
|
||||||
"typesVersions": {
|
"typesVersions": {
|
||||||
@ -30,9 +29,6 @@
|
|||||||
],
|
],
|
||||||
"renderer": [
|
"renderer": [
|
||||||
"./static/build/library/src/renderer/library.d.ts"
|
"./static/build/library/src/renderer/library.d.ts"
|
||||||
],
|
|
||||||
"common": [
|
|
||||||
"./static/build/library/src/common/library.d.ts"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// @experimental
|
|
||||||
export { applicationInformationToken } from "./vars/application-information-token";
|
|
||||||
export type { ApplicationInformation } from "./vars/application-information-token";
|
|
||||||
export { bundledExtensionInjectionToken } from "../extensions/extension-discovery/bundled-extension-token";
|
|
||||||
|
|
||||||
export * as extensionApi from "../extensions/common-api";
|
|
||||||
@ -9,6 +9,11 @@ export { beforeApplicationIsLoadingInjectionToken } from "./start-main-applicati
|
|||||||
export { beforeElectronIsReadyInjectionToken } from "./start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
export { beforeElectronIsReadyInjectionToken } from "./start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||||
export { onLoadOfApplicationInjectionToken } from "./start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
export { onLoadOfApplicationInjectionToken } from "./start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||||
export { createApp } from "./create-app";
|
export { createApp } from "./create-app";
|
||||||
|
export { applicationInformationToken } from "../common/vars/application-information-token";
|
||||||
|
export type { ApplicationInformation } from "../common/vars/application-information-token";
|
||||||
|
export { bundledExtensionInjectionToken } from "../extensions/extension-discovery/bundled-extension-token";
|
||||||
|
|
||||||
export * as Mobx from "mobx";
|
export * as Mobx from "mobx";
|
||||||
export * as extensionApi from "../extensions/main-api";
|
|
||||||
export * as Pty from "node-pty";
|
export * as Pty from "node-pty";
|
||||||
|
export * as extensionApi from "../extensions/main-api";
|
||||||
|
export * as commonExtensionApi from "../extensions/common-api";
|
||||||
|
|||||||
@ -7,10 +7,16 @@ import React from "react";
|
|||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
|
|
||||||
// @experimental
|
// @experimental
|
||||||
|
export { createApp } from "./create-app";
|
||||||
|
export { applicationInformationToken } from "../common/vars/application-information-token";
|
||||||
|
export type { ApplicationInformation } from "../common/vars/application-information-token";
|
||||||
|
export { bundledExtensionInjectionToken } from "../extensions/extension-discovery/bundled-extension-token";
|
||||||
|
|
||||||
export { React, ReactDOM };
|
export { React, ReactDOM };
|
||||||
export * as Mobx from "mobx";
|
export * as Mobx from "mobx";
|
||||||
export * as MobxReact from "mobx-react";
|
export * as MobxReact from "mobx-react";
|
||||||
export * as ReactRouter from "react-router";
|
export * as ReactRouter from "react-router";
|
||||||
export * as ReactRouterDom from "react-router-dom";
|
export * as ReactRouterDom from "react-router-dom";
|
||||||
export * as extensionApi from "../extensions/renderer-api";
|
export * as extensionApi from "../extensions/renderer-api";
|
||||||
export { createApp } from "./create-app";
|
export * as commonExtensionApi from "../extensions/common-api";
|
||||||
|
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type webpack from "webpack";
|
|
||||||
import path from "path";
|
|
||||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
|
||||||
import webpackLensMain from "./main";
|
|
||||||
import { buildDir } from "./vars";
|
|
||||||
|
|
||||||
const webpackLensCommon = (): webpack.Configuration => {
|
|
||||||
const mainConfig = webpackLensMain();
|
|
||||||
|
|
||||||
return {
|
|
||||||
...mainConfig,
|
|
||||||
name: "lens-app-common",
|
|
||||||
entry: {
|
|
||||||
common: path.resolve(__dirname, "..", "src", "common", "library.ts"),
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
publicPath: "",
|
|
||||||
library: {
|
|
||||||
type: "commonjs2",
|
|
||||||
},
|
|
||||||
path: path.resolve(buildDir, "library"),
|
|
||||||
},
|
|
||||||
optimization: {
|
|
||||||
minimize: false,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new ForkTsCheckerPlugin({}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default webpackLensCommon;
|
|
||||||
@ -3,14 +3,12 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import webpackLensCommon from "./common";
|
import { webpackLensMain } from "./main";
|
||||||
import webpackLensMain from "./main";
|
|
||||||
import { webpackLensRenderer } from "./renderer";
|
import { webpackLensRenderer } from "./renderer";
|
||||||
|
|
||||||
const config = [
|
const config = [
|
||||||
webpackLensMain(),
|
webpackLensMain(),
|
||||||
webpackLensRenderer(),
|
webpackLensRenderer(),
|
||||||
webpackLensCommon(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@ -12,76 +12,72 @@ import { DefinePlugin } from "webpack";
|
|||||||
import { buildDir, isDevelopment } from "./vars";
|
import { buildDir, isDevelopment } from "./vars";
|
||||||
import { platform } from "process";
|
import { platform } from "process";
|
||||||
|
|
||||||
const webpackLensMain = (): webpack.Configuration => {
|
export const webpackLensMain = (): webpack.Configuration => ({
|
||||||
return {
|
name: "lens-app-main",
|
||||||
name: "lens-app-main",
|
context: __dirname,
|
||||||
context: __dirname,
|
target: "electron-main",
|
||||||
target: "electron-main",
|
mode: isDevelopment ? "development" : "production",
|
||||||
mode: isDevelopment ? "development" : "production",
|
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
||||||
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
cache: isDevelopment ? { type: "filesystem" } : false,
|
||||||
cache: isDevelopment ? { type: "filesystem" } : false,
|
entry: {
|
||||||
entry: {
|
main: path.resolve(__dirname, "..", "src", "main", "library.ts"),
|
||||||
main: path.resolve(__dirname, "..", "src", "main", "library.ts"),
|
},
|
||||||
|
output: {
|
||||||
|
library: {
|
||||||
|
type: "commonjs2",
|
||||||
},
|
},
|
||||||
output: {
|
path: path.resolve(buildDir, "library"),
|
||||||
library: {
|
},
|
||||||
type: "commonjs2",
|
optimization: {
|
||||||
|
minimize: false,
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: [".json", ".js", ".ts"],
|
||||||
|
},
|
||||||
|
externals: [
|
||||||
|
nodeExternals(),
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
parser: {
|
||||||
|
javascript: {
|
||||||
|
commonjsMagicComments: true,
|
||||||
},
|
},
|
||||||
path: path.resolve(buildDir, "library"),
|
|
||||||
},
|
},
|
||||||
optimization: {
|
rules: [
|
||||||
minimize: false,
|
{
|
||||||
},
|
test: /\.node$/,
|
||||||
resolve: {
|
use: "node-loader",
|
||||||
extensions: [".json", ".js", ".ts"],
|
|
||||||
},
|
|
||||||
externals: [
|
|
||||||
nodeExternals(),
|
|
||||||
],
|
|
||||||
module: {
|
|
||||||
parser: {
|
|
||||||
javascript: {
|
|
||||||
commonjsMagicComments: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
rules: [
|
{
|
||||||
{
|
test: /\.ts$/,
|
||||||
test: /\.node$/,
|
exclude: /node_modules/,
|
||||||
use: "node-loader",
|
use: {
|
||||||
},
|
loader: "ts-loader",
|
||||||
{
|
options: {
|
||||||
test: /\.ts$/,
|
transpileOnly: true,
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: "ts-loader",
|
|
||||||
options: {
|
|
||||||
transpileOnly: true,
|
|
||||||
compilerOptions: {
|
|
||||||
sourceMap: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...iconsAndImagesWebpackRules(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new DefinePlugin({
|
|
||||||
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable(\\.${platform})?\\.tsx?$/`,
|
|
||||||
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(main|common)\\/.+\\.injectable(\\.${platform})?\\.tsx?$/`,
|
|
||||||
}),
|
|
||||||
new ForkTsCheckerPlugin({
|
|
||||||
typescript: {
|
|
||||||
mode: "write-dts",
|
|
||||||
configOverwrite: {
|
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
declaration: true,
|
sourceMap: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
|
...iconsAndImagesWebpackRules(),
|
||||||
],
|
],
|
||||||
};
|
},
|
||||||
};
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
export default webpackLensMain;
|
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable(\\.${platform})?\\.tsx?$/`,
|
||||||
|
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(main|common)\\/.+\\.injectable(\\.${platform})?\\.tsx?$/`,
|
||||||
|
}),
|
||||||
|
new ForkTsCheckerPlugin({
|
||||||
|
typescript: {
|
||||||
|
mode: "write-dts",
|
||||||
|
configOverwrite: {
|
||||||
|
compilerOptions: {
|
||||||
|
declaration: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|||||||
@ -3,6 +3,5 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { extensionApi as Main } from "@k8slens/core/main";
|
export { extensionApi as Main, commonExtensionApi as Common } from "@k8slens/core/main";
|
||||||
export { extensionApi as Renderer } from "@k8slens/core/renderer";
|
export { extensionApi as Renderer } from "@k8slens/core/renderer";
|
||||||
export { extensionApi as Common } from "@k8slens/core/common";
|
|
||||||
|
|||||||
@ -35,7 +35,6 @@ export default function generateExtensionTypes(): webpack.Configuration {
|
|||||||
],
|
],
|
||||||
stats: "errors-warnings",
|
stats: "errors-warnings",
|
||||||
externals: [
|
externals: [
|
||||||
"@k8slens/core/common",
|
|
||||||
"@k8slens/core/main",
|
"@k8slens/core/main",
|
||||||
"@k8slens/core/renderer",
|
"@k8slens/core/renderer",
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { applicationInformationToken, ApplicationInformation } from "@k8slens/core/common";
|
import { applicationInformationToken, ApplicationInformation } from "@k8slens/core/main";
|
||||||
import packageJson from "../../package.json";
|
import packageJson from "../../package.json";
|
||||||
|
|
||||||
const applicationInformationInjectable = getInjectable({
|
const applicationInformationInjectable = getInjectable({
|
||||||
@ -1,8 +1,7 @@
|
|||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
import { createApp, extensionApi as Main } from "@k8slens/core/main";
|
import { createApp, extensionApi as Main, commonExtensionApi as Common } from "@k8slens/core/main";
|
||||||
import { extensionApi as Common } from "@k8slens/core/common";
|
|
||||||
|
|
||||||
const di = createContainer("main");
|
const di = createContainer("main");
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { applicationInformationToken, ApplicationInformation } from "@k8slens/core/renderer";
|
||||||
|
import packageJson from "../../package.json";
|
||||||
|
|
||||||
|
const applicationInformationInjectable = getInjectable({
|
||||||
|
id: "application-information",
|
||||||
|
injectionToken: applicationInformationToken,
|
||||||
|
instantiate: () => {
|
||||||
|
const { version, config, productName, build, copyright, description, name } = packageJson;
|
||||||
|
|
||||||
|
return { version, config, productName, build, copyright, description, name } as ApplicationInformation;
|
||||||
|
},
|
||||||
|
causesSideEffects: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default applicationInformationInjectable;
|
||||||
@ -1,8 +1,7 @@
|
|||||||
import "@k8slens/core/styles";
|
import "@k8slens/core/styles";
|
||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
import { createApp, extensionApi as Renderer } from "@k8slens/core/renderer";
|
import { createApp, extensionApi as Renderer, commonExtensionApi as Common } from "@k8slens/core/renderer";
|
||||||
import { extensionApi as Common } from "@k8slens/core/common";
|
|
||||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||||
|
|
||||||
const di = createContainer("renderer");
|
const di = createContainer("renderer");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user