@compass-framework/plugin 1.0.0

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/.eslintignore ADDED
@@ -0,0 +1,10 @@
1
+ wasmer/output
2
+ esbuild
3
+ build
4
+ wasm
5
+
6
+ .eslintrc.js
7
+ jest.*.js
8
+
9
+ package.json
10
+ tsconfig.json
package/.eslintrc.js ADDED
@@ -0,0 +1,76 @@
1
+ const path = require('path');
2
+
3
+ const resolve = (url) => path.resolve(__dirname, url);
4
+
5
+ module.exports = {
6
+ "extends": [
7
+ 'airbnb-base',
8
+ 'airbnb-typescript/base'
9
+ ],
10
+ "env": {
11
+ "browser": true,
12
+ "es2021": true
13
+ },
14
+ "plugins": [
15
+ "unused-imports"
16
+ ],
17
+ "rules": {
18
+ "unused-imports/no-unused-imports": "error",
19
+
20
+ "@typescript-eslint/no-redeclare": "off",
21
+ "default-case-last": "off",
22
+ "no-return-assign": "off",
23
+ "operator-assignment": "off",
24
+ "no-fallthrough": "off",
25
+ "no-constant-condition": "off",
26
+ "function-call-argument-newline":"off",
27
+ "no-else-return" : "off",
28
+ "no-cond-assign": "off",
29
+ "prefer-regex-literals": "off",
30
+ "@typescript-eslint/no-empty-function": "off",
31
+ "no-restricted-globals": "off",
32
+ "prefer-object-spread": "off",
33
+ "guard-for-in":"off",
34
+ "no-multi-assign": "off",
35
+ "no-lonely-if": "off",
36
+ "@typescript-eslint/lines-between-class-members": "off",
37
+ "prefer-exponentiation-operator":"off",
38
+ "no-restricted-properties": "off",
39
+ "function-paren-newline": "off",
40
+ "no-labels": "off",
41
+ "@typescript-eslint/no-shadow": "off",
42
+ "no-nested-ternary": "off",
43
+ "no-debugger": "off",
44
+ "no-mixed-operators": "off",
45
+ "prefer-destructuring": "off",
46
+ "no-console": "off",
47
+ "import/export": "off",
48
+ "@typescript-eslint/quotes": "off",
49
+ "prefer-const": "off",
50
+ 'linebreak-style': ["off", "windows"],
51
+ "prefer-rest-params": "off",
52
+ "max-classes-per-file": "off",
53
+ "max-len": "off",
54
+ "new-parens": "off",
55
+ "no-continue": "off",
56
+ "no-plusplus": "off",
57
+ "import/prefer-default-export": "off",
58
+ "@typescript-eslint/naming-convention": "off",
59
+ "@typescript-eslint/no-unused-vars": "off",
60
+ "@typescript-eslint/no-use-before-define": "off",
61
+ "import/no-cycle": "off",
62
+ "no-bitwise": 'off',
63
+ "default-case": "off",
64
+ "no-param-reassign": "off",
65
+ "class-methods-use-this": "off",
66
+ "consistent-return": "off",
67
+ "no-underscore-dangle": "off",
68
+ "no-restricted-syntax": "off",
69
+ },
70
+ "parserOptions": {
71
+ "warnOnUnsupportedTypeScriptVersion": false,
72
+ "ecmaVersion": 12,
73
+ "sourceType": "module",
74
+ "project": resolve("tsconfig.json")
75
+ }
76
+ }
@@ -0,0 +1,11 @@
1
+ import { Context } from "@compass-framework/core";
2
+ import { EnvironmentProperty } from "./EnvironmentProperty";
3
+ import { Installer } from "./Installer";
4
+ import { ServiceDependency } from "./ServiceDependency";
5
+
6
+ export interface Environment<T = EnvironmentProperty> {
7
+ installer: Installer
8
+ property: T,
9
+ context: Context;
10
+ dependency: ServiceDependency;
11
+ }
@@ -0,0 +1,3 @@
1
+ export interface EnvironmentProperty {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ export interface Feature {
2
+
3
+ }
@@ -0,0 +1,7 @@
1
+ import { Plugin } from "./Plugin";
2
+
3
+ export declare class Installer {
4
+ public usePlugin(plugin: Plugin): void;
5
+
6
+ public unUsePlugin(plugin: Plugin): void;
7
+ }
@@ -0,0 +1,33 @@
1
+ import {
2
+ Consumer,
3
+ } from "@compass-framework/library";
4
+
5
+ import { Environment } from "./Environment";
6
+ import { Service } from "./Service";
7
+ import { PluginMainfest } from "./PluginMainfest";
8
+
9
+ export declare class Plugin<Feature = {}> {
10
+ protected constructor(mainfest: PluginMainfest);
11
+
12
+ public onInstall(environment: Environment, service: Consumer<Feature>): Promise<void>;
13
+
14
+ public isUsingGlobalContext(): boolean;
15
+
16
+ public onUninstall(): void;
17
+
18
+ public getPluginName(): string;
19
+
20
+ public getService<T>(index: number): Service<T>;
21
+
22
+ public getEnvironment<T>(): Environment<T>;
23
+
24
+ public getGroupId(): string;
25
+
26
+ public getVersion(): string;
27
+
28
+ public getArtifactId(): string;
29
+
30
+ public getDependence(): PluginMainfest.Dependence[];
31
+
32
+ public setUsingGlobalContext(using: boolean): void;
33
+ }
@@ -0,0 +1,17 @@
1
+ export type PluginMainfest = {
2
+ name: string,
3
+ artifactId: string,
4
+ version: string,
5
+ groupId: string,
6
+ dependencies?: PluginMainfest.Dependence[]
7
+ };
8
+
9
+ export namespace PluginMainfest {
10
+ export type Dependence = {
11
+ name?: string,
12
+ required?: boolean,
13
+ version: string,
14
+ groupId: string,
15
+ artifactId: string,
16
+ };
17
+ }
@@ -0,0 +1,18 @@
1
+ import { Context } from "@compass-framework/core";
2
+ import { Plugin } from "./Plugin";
3
+ import { EnvironmentProperty } from "./EnvironmentProperty";
4
+
5
+ export declare class PluginManager {
6
+ public constructor(context: Context, options: PluginManager.Options);
7
+
8
+ public usePlugin(plugin: Plugin): Promise<void>;
9
+
10
+ public unUsePlugin(plugin: Plugin): void;
11
+ }
12
+
13
+ export declare namespace PluginManager {
14
+ export interface Options {
15
+ repository: string;
16
+ property: EnvironmentProperty,
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ import { Feature } from "./Feature";
2
+
3
+ export declare class Service<T = Feature> {
4
+ public getFeatures(): T;
5
+
6
+ public getGroupId(): string;
7
+
8
+ public getVersion(): string;
9
+
10
+ public getArtifactId(): string;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { Service } from "./Service";
2
+
3
+ export declare class ServiceDependency {
4
+ public getService<T>(groupId: string, artifactId: string): Service<T>;
5
+ }
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from "./include/DependenceManager";
2
+ export * from "./include/Environment";
3
+ export * from "./include/EnvironmentProperty";
4
+ export * from "./include/Service";
5
+ export * from "./include/Feature";
6
+ export * from "./include/PluginManagerOptions";
7
+ export * from "./include/Plugin";
8
+ export * from "./include/PluginManager";
9
+ export * from "./include/PluginMainfest";
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@compass-framework/plugin",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "author": "",
6
+ "license": "ISC",
7
+ "types": "index.d.ts",
8
+ "scripts": {
9
+ "publish-plugin": "npm publish"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "dependencies": {
15
+ "@compass-framework/library": "1.0.0",
16
+ "@compass-framework/core": "1.0.0"
17
+ }
18
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "ES2015",
5
+ "allowJs": true,
6
+ "lib": [
7
+ "ScriptHost",
8
+ "DOM",
9
+ "ES2015",
10
+ "ES2016",
11
+ "ES2017",
12
+ "ES2018",
13
+ "ES2019",
14
+ "ES2020",
15
+ "ES2021",
16
+ "ESNext"
17
+ ],
18
+ "types": [
19
+ "@types/jest",
20
+ "jest",
21
+ "node"
22
+ ],
23
+ "typeRoots" : [
24
+ "./src/define"
25
+ ],
26
+ "experimentalDecorators": true,
27
+ "sourceMap": true,
28
+ "esModuleInterop": true,
29
+ "downlevelIteration": true
30
+ }
31
+ }