@breadstone-tools/cem-plugin 0.0.12-beta.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/Index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export type { PluginContext as Context, IAnalyzePhaseParams, ICollectPhaseParams, IInitializeParams, IModuleLinkPhaseParams, IPackageLinkPhaseParams, IPlugin } from './Plugin.js';
2
+ //# sourceMappingURL=Index.d.ts.map
package/Index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,IAAI,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/Index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Index.js.map
package/Index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.js","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":""}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Breadstone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Plugin.d.ts ADDED
@@ -0,0 +1,169 @@
1
+ import type { ILogger } from '@breadstone-infrastructure/utilities';
2
+ import type { Module, Package } from '@breadstone-tools/cem-infrastructure';
3
+ import type ts from 'typescript';
4
+ /**
5
+ * Plugin Execution Context
6
+ *
7
+ * This context serves as a shared data environment for all plugins. It facilitates
8
+ * the exchange of arbitrary data among plugins and contains essential information
9
+ * about the current execution environment along with a collection of dynamic properties.
10
+ *
11
+ * The context includes:
12
+ *
13
+ * 1. **Execution Environment Information**:
14
+ * - Details about the current runtime environment, including system configurations and settings.
15
+ * - Relevant environmental variables that influence plugin behavior.
16
+ *
17
+ * 2. **Dynamic Properties**:
18
+ * - A versatile collection of properties accessible and modifiable by all plugins.
19
+ * - Can store various data types, such as user inputs, intermediate processing results, and configuration settings.
20
+ *
21
+ * 3. **Data Sharing Capabilities**:
22
+ * - Enables seamless data sharing between plugins to ensure coordinated operations.
23
+ * - Maintains consistency and integrity of shared data across different plugin processes.
24
+ *
25
+ * This context is crucial for preserving the state of plugin operations and supporting efficient plugin interactions within the system.
26
+ *
27
+ * @public
28
+ */
29
+ export type PluginContext = {
30
+ program: ts.Program;
31
+ typeChecker: ts.TypeChecker;
32
+ debug: boolean;
33
+ verbose: boolean;
34
+ quiet: boolean;
35
+ logger: ILogger;
36
+ } & Record<string, unknown>;
37
+ /**
38
+ * Parameters for the initialize phase of the plugin.
39
+ *
40
+ * @public
41
+ */
42
+ export interface IInitializeParams {
43
+ /**
44
+ * TypeScript API
45
+ */
46
+ ts: typeof ts;
47
+ /**
48
+ * The newly initialized manifest.
49
+ */
50
+ customElementsManifest: Package;
51
+ /**
52
+ * Plugin execution context. Pass arbitrary data here.
53
+ */
54
+ context: PluginContext;
55
+ }
56
+ /**
57
+ * Parameters for the package link phase of the plugin.
58
+ *
59
+ * @public
60
+ */
61
+ export interface IPackageLinkPhaseParams {
62
+ /**
63
+ * TypeScript API
64
+ */
65
+ ts: typeof ts;
66
+ /**
67
+ * The newly initialized manifest.
68
+ */
69
+ customElementsManifest: Package;
70
+ /**
71
+ * Plugin execution context. Pass arbitrary data here.
72
+ */
73
+ context: PluginContext;
74
+ }
75
+ /**
76
+ * Parameters for the collect phase of the plugin.
77
+ *
78
+ * @public
79
+ */
80
+ export interface ICollectPhaseParams {
81
+ /**
82
+ * TypeScript API
83
+ */
84
+ ts: typeof ts;
85
+ /**
86
+ * The current TypeScript AST Node
87
+ */
88
+ node: ts.Node;
89
+ /**
90
+ * Plugin execution context. Pass arbitrary data here.
91
+ */
92
+ context: PluginContext;
93
+ }
94
+ /**
95
+ * Parameters for the analyze phase of the plugin.
96
+ *
97
+ * @public
98
+ */
99
+ export interface IAnalyzePhaseParams {
100
+ /**
101
+ * TypeScript API
102
+ */
103
+ ts: typeof ts;
104
+ /**
105
+ * The current TypeScript AST Node
106
+ */
107
+ node: ts.Node;
108
+ /**
109
+ * The current state of the current module's manifest
110
+ */
111
+ moduleDoc: Partial<Module>;
112
+ /**
113
+ * Plugin execution context. Pass arbitrary data here.
114
+ */
115
+ context: PluginContext;
116
+ }
117
+ /**
118
+ * Parameters for the module link phase of the plugin.
119
+ *
120
+ * @public
121
+ */
122
+ export interface IModuleLinkPhaseParams {
123
+ /**
124
+ * The completed moduleDoc, i.e. the output of the analyze phase
125
+ */
126
+ moduleDoc: Module;
127
+ /**
128
+ * Plugin execution context. Pass arbitrary data here.
129
+ */
130
+ context: PluginContext;
131
+ }
132
+ /**
133
+ * A Custom Elements Manifest Analyzer plugin.
134
+ *
135
+ * @public
136
+ */
137
+ export interface IPlugin {
138
+ /**
139
+ * The name of the plugin.
140
+ */
141
+ readonly name: string;
142
+ /**
143
+ * The plugin `init` hook that runs once for each plugin.
144
+ */
145
+ onInit?(params: IInitializeParams): void;
146
+ /**
147
+ * The plugin `collect` hook that runs in the collect phase.
148
+ * Runs for all modules in a project, before continuing to the `analyze` hook.
149
+ */
150
+ onCollect?(params: ICollectPhaseParams): void;
151
+ /**
152
+ * The plugin `analyze` hook that runs in the analyze phase.
153
+ * Runs for each AST node in each module.
154
+ * You can use this phase to access a module's AST nodes and mutate the manifest.
155
+ */
156
+ onAnalyze?(params: IAnalyzePhaseParams): void;
157
+ /**
158
+ * The plugin `moduleLink` hook that runs in the module link phase.
159
+ * Post-processing hook that runs for each module, after analyzing.
160
+ * All information about your module should now be available.
161
+ */
162
+ onModuleLink?(params: IModuleLinkPhaseParams): void;
163
+ /**
164
+ * The plugin `packageLink` hook that runs in the package link phase.
165
+ * Runs once per package, after modules have been parsed and after per-module post-processing.
166
+ */
167
+ onPackageLink?(params: IPackageLinkPhaseParams): void;
168
+ }
169
+ //# sourceMappingURL=Plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,CAAC,MAAM,EAAE,OA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,SAAS,CAAC,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAEpD;;;OAGG;IACH,aAAa,CAAC,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAEzD"}
package/Plugin.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=Plugin.js.map
package/Plugin.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@breadstone-tools/cem-plugin",
3
+ "description": "Custom Elements Manifest Plugin Library",
4
+ "version": "0.0.12-beta.0",
5
+ "license": "MIT",
6
+ "author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
7
+ "repository": {
8
+ "url": "git+ssh://git@github.com/RueDeRennes/mosaik.git"
9
+ },
10
+ "type": "commonjs",
11
+ "main": "./Index.js",
12
+ "commonjs": "./Index.js",
13
+ "module": "./Index.js",
14
+ "types": "./Index.d.ts",
15
+ "dependencies": {
16
+ "@breadstone-infrastructure/utilities": "^0.0.12-beta.0",
17
+ "@breadstone-tools/cem-infrastructure": "^0.0.12-beta.0",
18
+ "comment-parser": "^1.4.1",
19
+ "typescript": "^5.8.3"
20
+ }
21
+ }