@c8y/devkit 1023.71.1 → 1023.76.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/dist/src/webpack/config/plugin.js +2 -0
- package/dist/src/webpack/config/plugin.js.map +1 -1
- package/dist/src/webpack/loaders/agent-to-json-loader.js +6 -1
- package/dist/src/webpack/loaders/agent-to-json-loader.js.map +1 -1
- package/dist/src/webpack/loaders/schema-loader.js +30 -6
- package/dist/src/webpack/loaders/schema-loader.js.map +1 -1
- package/dist/src/webpack/plugin/plugin.d.ts +15 -15
- package/dist/src/webpack/plugin/schema-aggregation-plugin.d.ts +35 -0
- package/dist/src/webpack/plugin/schema-aggregation-plugin.js +101 -0
- package/dist/src/webpack/plugin/schema-aggregation-plugin.js.map +1 -0
- package/package.json +7 -8
|
@@ -7,6 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const webpack_1 = require("../utils/webpack");
|
|
8
8
|
const plugin_1 = require("../plugin/plugin");
|
|
9
9
|
const translation_aggregation_plugin_1 = require("../plugin/translation-aggregation-plugin");
|
|
10
|
+
const schema_aggregation_plugin_1 = require("../plugin/schema-aggregation-plugin");
|
|
10
11
|
const federation_1 = require("./federation");
|
|
11
12
|
const translation_1 = require("./translation");
|
|
12
13
|
const import_maps_1 = require("./import-maps");
|
|
@@ -93,6 +94,7 @@ function config(options, configuration, projectRootPath) {
|
|
|
93
94
|
return {
|
|
94
95
|
plugins: [
|
|
95
96
|
new translation_aggregation_plugin_1.TranslationAggregationPlugin(),
|
|
97
|
+
new schema_aggregation_plugin_1.SchemaAggregationPlugin(),
|
|
96
98
|
(0, translation_1.getLocalesContextReplacePlugin)(options),
|
|
97
99
|
new webpack_1.webpack.DefinePlugin({
|
|
98
100
|
__WEBPACK__: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/webpack/config/plugin.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"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C;SACzB,CAAC,MAAM,CAAC,OAAO,CAAC;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -14,10 +14,15 @@ function agentToJsonLoader(source) {
|
|
|
14
14
|
}
|
|
15
15
|
const { config } = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
16
16
|
const parsed = ts.parseJsonConfigFileContent(config, ts.sys, path.dirname(configPath));
|
|
17
|
+
// TS 5.6+ respects .mjs extension and refuses to emit CommonJS for it.
|
|
18
|
+
// Override with .ts so transpile always produces CommonJS output.
|
|
19
|
+
const transpileFileName = filePath.endsWith('.mjs')
|
|
20
|
+
? filePath.replace(/\.mjs$/, '.ts')
|
|
21
|
+
: filePath;
|
|
17
22
|
const jsOutputText = ts.transpile(source, {
|
|
18
23
|
...parsed.options,
|
|
19
24
|
module: ts.ModuleKind.CommonJS
|
|
20
|
-
},
|
|
25
|
+
}, transpileFileName);
|
|
21
26
|
try {
|
|
22
27
|
const moduleObj = { exports: {} };
|
|
23
28
|
const exportsObj = moduleObj.exports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-to-json-loader.js","sourceRoot":"","sources":["../../../../src/webpack/loaders/agent-to-json-loader.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"agent-to-json-loader.js","sourceRoot":"","sources":["../../../../src/webpack/loaders/agent-to-json-loader.ts"],"names":[],"mappings":";;AAIA,oCAqDC;AAzDD,iCAAiC;AACjC,6BAA6B;AAG7B,SAAwB,iBAAiB,CAA8B,MAAc;IACnF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;IAEnC,+CAA+C;IAC/C,MAAM,UAAU,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC/E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,QAAQ,CA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AC,OAAO,CAAC;QAC5F,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnE,MAAM,cAAc,GAAG,UAAU,SAAS,OAAO,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,WAAW,CACd,IAAI,KAAK,CACP;;iBAEU,GAAa,CAAC,OAAO,EAAE,CAClC,CACF,CAAC;QACF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.default = schemaLoader;
|
|
|
4
4
|
const typescript_json_schema_1 = require("typescript-json-schema");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const schema_aggregation_plugin_1 = require("../plugin/schema-aggregation-plugin");
|
|
7
8
|
const compilerOptions = {
|
|
8
9
|
strictNullChecks: true
|
|
9
10
|
};
|
|
@@ -12,10 +13,12 @@ function schemaLoader(_) {
|
|
|
12
13
|
try {
|
|
13
14
|
const request = this.request;
|
|
14
15
|
let interfaceName = null;
|
|
16
|
+
let type = null;
|
|
15
17
|
// Extract interface name from options or query
|
|
16
18
|
if (this.getOptions) {
|
|
17
19
|
const options = this.getOptions();
|
|
18
20
|
interfaceName = options.interfaceName || null;
|
|
21
|
+
type = options.type || null;
|
|
19
22
|
}
|
|
20
23
|
if (!interfaceName && request) {
|
|
21
24
|
const match = request.match(/[?&]interfaceName=([^!&]+)/);
|
|
@@ -23,10 +26,20 @@ function schemaLoader(_) {
|
|
|
23
26
|
interfaceName = match[1];
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
if (!type && request) {
|
|
30
|
+
const match = request.match(/[?&]type=([^!&]+)/);
|
|
31
|
+
if (match) {
|
|
32
|
+
type = match[1];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
26
35
|
if (!interfaceName && this.resourceQuery) {
|
|
27
36
|
const queryParams = new URLSearchParams(this.resourceQuery.substring(1));
|
|
28
37
|
interfaceName = queryParams.get('interfaceName');
|
|
29
38
|
}
|
|
39
|
+
if (!type && this.resourceQuery) {
|
|
40
|
+
const queryParams = new URLSearchParams(this.resourceQuery.substring(1));
|
|
41
|
+
type = queryParams.get('type');
|
|
42
|
+
}
|
|
30
43
|
if (!interfaceName) {
|
|
31
44
|
console.error('Debug information:');
|
|
32
45
|
console.error('- Request:', request);
|
|
@@ -38,11 +51,11 @@ function schemaLoader(_) {
|
|
|
38
51
|
// Check if we're working with a compiled file from node_modules
|
|
39
52
|
const isNodeModuleFile = filePath.includes('node_modules') && (filePath.endsWith('.mjs') || filePath.endsWith('.js'));
|
|
40
53
|
if (isNodeModuleFile) {
|
|
41
|
-
processNodeModuleFile.call(this, filePath, interfaceName, callback);
|
|
54
|
+
processNodeModuleFile.call(this, filePath, interfaceName, type, callback);
|
|
42
55
|
}
|
|
43
56
|
else {
|
|
44
57
|
// Regular case - monorepo
|
|
45
|
-
processSourceFile.call(this, filePath, interfaceName, callback);
|
|
58
|
+
processSourceFile.call(this, filePath, interfaceName, type, callback);
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
catch (err) {
|
|
@@ -50,7 +63,7 @@ function schemaLoader(_) {
|
|
|
50
63
|
callback(err);
|
|
51
64
|
}
|
|
52
65
|
}
|
|
53
|
-
async function processNodeModuleFile(filePath, interfaceName, callback) {
|
|
66
|
+
async function processNodeModuleFile(filePath, interfaceName, type, callback) {
|
|
54
67
|
try {
|
|
55
68
|
// Start with the directory containing the file
|
|
56
69
|
let currentDir = path.dirname(filePath);
|
|
@@ -83,7 +96,7 @@ async function processNodeModuleFile(filePath, interfaceName, callback) {
|
|
|
83
96
|
? exportConfig.types.substring(2)
|
|
84
97
|
: exportConfig.types);
|
|
85
98
|
if (fs.existsSync(typesPath)) {
|
|
86
|
-
return processSourceFile.call(this, typesPath, interfaceName, callback);
|
|
99
|
+
return processSourceFile.call(this, typesPath, interfaceName, type, callback);
|
|
87
100
|
}
|
|
88
101
|
}
|
|
89
102
|
}
|
|
@@ -103,7 +116,7 @@ async function processNodeModuleFile(filePath, interfaceName, callback) {
|
|
|
103
116
|
if (content.includes(`interface ${interfaceName}`) ||
|
|
104
117
|
content.includes(`class ${interfaceName}`) ||
|
|
105
118
|
content.includes(`type ${interfaceName}`)) {
|
|
106
|
-
return processSourceFile.call(this, typesPath, interfaceName, callback);
|
|
119
|
+
return processSourceFile.call(this, typesPath, interfaceName, type, callback);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
109
122
|
}
|
|
@@ -118,7 +131,7 @@ async function processNodeModuleFile(filePath, interfaceName, callback) {
|
|
|
118
131
|
callback(err);
|
|
119
132
|
}
|
|
120
133
|
}
|
|
121
|
-
function processSourceFile(filePath, interfaceName, callback) {
|
|
134
|
+
function processSourceFile(filePath, interfaceName, type, callback) {
|
|
122
135
|
try {
|
|
123
136
|
const program = (0, typescript_json_schema_1.getProgramFromFiles)([filePath], compilerOptions);
|
|
124
137
|
const settings = {
|
|
@@ -135,9 +148,20 @@ function processSourceFile(filePath, interfaceName, callback) {
|
|
|
135
148
|
if (!schema) {
|
|
136
149
|
throw Error(`No schema generated for ${interfaceName} in ${filePath}. Make sure the interface exists and is exported.`);
|
|
137
150
|
}
|
|
151
|
+
// Register schema for aggregation by SchemaAggregationPlugin
|
|
152
|
+
const compilation = this._compilation;
|
|
153
|
+
if (compilation) {
|
|
154
|
+
(0, schema_aggregation_plugin_1.registerSchema)(compilation, `${interfaceName}:${filePath}`, {
|
|
155
|
+
interfaceName,
|
|
156
|
+
filePath,
|
|
157
|
+
schema: schema,
|
|
158
|
+
type: type || 'unknown'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
138
161
|
callback(null, `export const schema = ${JSON.stringify(schema)};`);
|
|
139
162
|
}
|
|
140
163
|
catch (err) {
|
|
164
|
+
// eslint-disable-next-line no-console
|
|
141
165
|
console.error(`Error processing source file ${filePath}:`, err);
|
|
142
166
|
callback(err);
|
|
143
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-loader.js","sourceRoot":"","sources":["../../../../src/webpack/loaders/schema-loader.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"schema-loader.js","sourceRoot":"","sources":["../../../../src/webpack/loaders/schema-loader.ts"],"names":[],"mappings":";;AAWA,+BA+DC;AA1ED,mEAAkG;AAGlG,yBAAyB;AACzB,6BAA6B;AAC7B,mFAAqE;AAErE,MAAM,eAAe,GAAoB;IACvC,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF,SAAwB,YAAY,CAA2B,CAAS;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,aAAa,GAAkB,IAAI,CAAC;QACxC,IAAI,IAAI,GAAkB,IAAI,CAAC;QAE/B,+CAA+C;QAC/C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC;YAC9C,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,aAAa,IAAI,OAAO,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAC1D,IAAI,KAAK,EAAE,CAAC;gBACV,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC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ature?: boolean | undefined;
|
|
67
|
-
dynamicOptionsUrl?:
|
|
67
|
+
dynamicOptionsUrl?: string | boolean | undefined;
|
|
68
68
|
faviconUrl?: string | undefined;
|
|
69
69
|
brandingUrl?: string | undefined;
|
|
70
70
|
brandingPreview?: boolean | undefined;
|
|
@@ -80,7 +80,7 @@ export declare class CumulocityPlugin {
|
|
|
80
80
|
hidePowered?: boolean | undefined;
|
|
81
81
|
hideHeader?: boolean | undefined;
|
|
82
82
|
hidePlatformInformation?: boolean | undefined;
|
|
83
|
-
supportUrl?:
|
|
83
|
+
supportUrl?: boolean | string | undefined;
|
|
84
84
|
supportUserString?: string | undefined;
|
|
85
85
|
mapWidgetRealtimeDisabled?: boolean | undefined;
|
|
86
86
|
mapWidgetPageSize?: number | undefined;
|
|
@@ -106,14 +106,14 @@ export declare class CumulocityPlugin {
|
|
|
106
106
|
remotes?: import("@c8y/options").RemotePlugins | undefined;
|
|
107
107
|
forceUrlRemotes?: boolean | undefined;
|
|
108
108
|
isPackage?: boolean | undefined;
|
|
109
|
-
package?:
|
|
109
|
+
package?: "plugin" | "blueprint" | undefined;
|
|
110
110
|
blueprintDeploymentOptions?: {
|
|
111
111
|
name?: string;
|
|
112
112
|
contextPath?: string;
|
|
113
113
|
key?: string;
|
|
114
114
|
} | undefined;
|
|
115
115
|
source?: (string | number | import("packages/client/lib").IApplication) | undefined;
|
|
116
|
-
contextHelp?:
|
|
116
|
+
contextHelp?: boolean | string | undefined;
|
|
117
117
|
disableOnlyRootsQuery?: boolean | undefined;
|
|
118
118
|
forceSetup?: boolean | undefined;
|
|
119
119
|
isSetup?: boolean | undefined;
|
|
@@ -128,7 +128,7 @@ export declare class CumulocityPlugin {
|
|
|
128
128
|
hideTypeDashboardForAssets?: boolean | undefined;
|
|
129
129
|
versioningMatrix?: import("packages/client/lib").VersioningMatrix | undefined;
|
|
130
130
|
label?: string | undefined;
|
|
131
|
-
alarmsRefreshType?:
|
|
131
|
+
alarmsRefreshType?: "interval" | "realtime" | undefined;
|
|
132
132
|
importMap?: {
|
|
133
133
|
[key: string]: string;
|
|
134
134
|
} | undefined;
|
|
@@ -155,7 +155,7 @@ export declare class CumulocityPlugin {
|
|
|
155
155
|
upgrade?: boolean | undefined;
|
|
156
156
|
enableAllPreviewFeatures?: boolean | undefined;
|
|
157
157
|
hidePreviewFeature?: boolean | undefined;
|
|
158
|
-
dynamicOptionsUrl?:
|
|
158
|
+
dynamicOptionsUrl?: string | boolean | undefined;
|
|
159
159
|
faviconUrl?: string | undefined;
|
|
160
160
|
brandingUrl?: string | undefined;
|
|
161
161
|
brandingPreview?: boolean | undefined;
|
|
@@ -170,7 +170,7 @@ export declare class CumulocityPlugin {
|
|
|
170
170
|
hidePowered?: boolean | undefined;
|
|
171
171
|
hideHeader?: boolean | undefined;
|
|
172
172
|
hidePlatformInformation?: boolean | undefined;
|
|
173
|
-
supportUrl?:
|
|
173
|
+
supportUrl?: boolean | string | undefined;
|
|
174
174
|
supportUserString?: string | undefined;
|
|
175
175
|
mapWidgetRealtimeDisabled?: boolean | undefined;
|
|
176
176
|
mapWidgetPageSize?: number | undefined;
|
|
@@ -196,14 +196,14 @@ export declare class CumulocityPlugin {
|
|
|
196
196
|
remotes?: import("@c8y/options").RemotePlugins | undefined;
|
|
197
197
|
forceUrlRemotes?: boolean | undefined;
|
|
198
198
|
isPackage?: boolean | undefined;
|
|
199
|
-
package?:
|
|
199
|
+
package?: "plugin" | "blueprint" | undefined;
|
|
200
200
|
blueprintDeploymentOptions?: {
|
|
201
201
|
name?: string;
|
|
202
202
|
contextPath?: string;
|
|
203
203
|
key?: string;
|
|
204
204
|
} | undefined;
|
|
205
205
|
source?: (string | number | import("packages/client/lib").IApplication) | undefined;
|
|
206
|
-
contextHelp?:
|
|
206
|
+
contextHelp?: boolean | string | undefined;
|
|
207
207
|
disableOnlyRootsQuery?: boolean | undefined;
|
|
208
208
|
forceSetup?: boolean | undefined;
|
|
209
209
|
isSetup?: boolean | undefined;
|
|
@@ -218,7 +218,7 @@ export declare class CumulocityPlugin {
|
|
|
218
218
|
hideTypeDashboardForAssets?: boolean | undefined;
|
|
219
219
|
versioningMatrix?: import("packages/client/lib").VersioningMatrix | undefined;
|
|
220
220
|
label?: string | undefined;
|
|
221
|
-
alarmsRefreshType?:
|
|
221
|
+
alarmsRefreshType?: "interval" | "realtime" | undefined;
|
|
222
222
|
importMap?: {
|
|
223
223
|
[key: string]: string;
|
|
224
224
|
} | undefined;
|
|
@@ -248,7 +248,7 @@ export declare class CumulocityPlugin {
|
|
|
248
248
|
upgrade?: boolean | undefined;
|
|
249
249
|
enableAllPreviewFeatures?: boolean | undefined;
|
|
250
250
|
hidePreviewFeature?: boolean | undefined;
|
|
251
|
-
dynamicOptionsUrl?:
|
|
251
|
+
dynamicOptionsUrl?: string | boolean | undefined;
|
|
252
252
|
faviconUrl?: string | undefined;
|
|
253
253
|
brandingUrl?: string | undefined;
|
|
254
254
|
brandingPreview?: boolean | undefined;
|
|
@@ -264,7 +264,7 @@ export declare class CumulocityPlugin {
|
|
|
264
264
|
hidePowered?: boolean | undefined;
|
|
265
265
|
hideHeader?: boolean | undefined;
|
|
266
266
|
hidePlatformInformation?: boolean | undefined;
|
|
267
|
-
supportUrl?:
|
|
267
|
+
supportUrl?: boolean | string | undefined;
|
|
268
268
|
supportUserString?: string | undefined;
|
|
269
269
|
mapWidgetRealtimeDisabled?: boolean | undefined;
|
|
270
270
|
mapWidgetPageSize?: number | undefined;
|
|
@@ -290,14 +290,14 @@ export declare class CumulocityPlugin {
|
|
|
290
290
|
remotes?: import("@c8y/options").RemotePlugins | undefined;
|
|
291
291
|
forceUrlRemotes?: boolean | undefined;
|
|
292
292
|
isPackage?: boolean | undefined;
|
|
293
|
-
package?:
|
|
293
|
+
package?: "plugin" | "blueprint" | undefined;
|
|
294
294
|
blueprintDeploymentOptions?: {
|
|
295
295
|
name?: string;
|
|
296
296
|
contextPath?: string;
|
|
297
297
|
key?: string;
|
|
298
298
|
} | undefined;
|
|
299
299
|
source?: (string | number | import("packages/client/lib").IApplication) | undefined;
|
|
300
|
-
contextHelp?:
|
|
300
|
+
contextHelp?: boolean | string | undefined;
|
|
301
301
|
disableOnlyRootsQuery?: boolean | undefined;
|
|
302
302
|
forceSetup?: boolean | undefined;
|
|
303
303
|
isSetup?: boolean | undefined;
|
|
@@ -312,7 +312,7 @@ export declare class CumulocityPlugin {
|
|
|
312
312
|
hideTypeDashboardForAssets?: boolean | undefined;
|
|
313
313
|
versioningMatrix?: import("packages/client/lib").VersioningMatrix | undefined;
|
|
314
314
|
label?: string | undefined;
|
|
315
|
-
alarmsRefreshType?:
|
|
315
|
+
alarmsRefreshType?: "interval" | "realtime" | undefined;
|
|
316
316
|
importMap?: {
|
|
317
317
|
[key: string]: string;
|
|
318
318
|
} | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Compilation, Compiler } from 'webpack';
|
|
2
|
+
export interface SchemaData {
|
|
3
|
+
interfaceName: string;
|
|
4
|
+
filePath: string;
|
|
5
|
+
schema: Record<string, unknown>;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Called by schema-loader to register a schema for the current compilation.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerSchema(compilation: Compilation, key: string, data: SchemaData): void;
|
|
12
|
+
/**
|
|
13
|
+
* SchemaAggregationPlugin is a Webpack plugin that aggregates all JSON schemas
|
|
14
|
+
* generated by the schema-loader into a single file.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SchemaAggregationPlugin {
|
|
17
|
+
/**
|
|
18
|
+
* The `apply` method is called by Webpack when this plugin is used.
|
|
19
|
+
* @param compiler - The Webpack compiler instance.
|
|
20
|
+
*/
|
|
21
|
+
apply(compiler: Compiler): void;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a single JSON file containing all schemas and adds it to the compilation.
|
|
24
|
+
* The asset is generated as c8y-schemas.json and included in the production bundle.
|
|
25
|
+
*
|
|
26
|
+
* Schemas from the current build are collected via the WeakMap (populated by the
|
|
27
|
+
* schema-loader). They are merged with the persistent cache snapshot from previous
|
|
28
|
+
* builds, so that schemas from webpack-cached (unchanged) modules are not lost on
|
|
29
|
+
* incremental rebuilds when the loader is not re-invoked.
|
|
30
|
+
*
|
|
31
|
+
* @param compilation - The Webpack compilation object.
|
|
32
|
+
*/
|
|
33
|
+
private createSchemaAsset;
|
|
34
|
+
}
|
|
35
|
+
export default SchemaAggregationPlugin;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaAggregationPlugin = void 0;
|
|
4
|
+
exports.registerSchema = registerSchema;
|
|
5
|
+
const webpack_1 = require("../utils/webpack");
|
|
6
|
+
const PLUGIN_NAME = 'SchemaAggregationPlugin';
|
|
7
|
+
/**
|
|
8
|
+
* Per-compilation schema registry, keyed by the Compilation instance.
|
|
9
|
+
* This ensures schemas written by the loader are read by the exact same
|
|
10
|
+
* compilation's finishModules hook, even when Angular CLI runs multiple
|
|
11
|
+
* webpack compilations in the same build.
|
|
12
|
+
*/
|
|
13
|
+
const compilationSchemas = new WeakMap();
|
|
14
|
+
/**
|
|
15
|
+
* Called by schema-loader to register a schema for the current compilation.
|
|
16
|
+
*/
|
|
17
|
+
function registerSchema(compilation, key, data) {
|
|
18
|
+
const map = compilationSchemas.get(compilation);
|
|
19
|
+
if (!map) {
|
|
20
|
+
// compilation not managed by this plugin instance — silently skip
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
map.set(key, data);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* SchemaAggregationPlugin is a Webpack plugin that aggregates all JSON schemas
|
|
27
|
+
* generated by the schema-loader into a single file.
|
|
28
|
+
*/
|
|
29
|
+
class SchemaAggregationPlugin {
|
|
30
|
+
/**
|
|
31
|
+
* The `apply` method is called by Webpack when this plugin is used.
|
|
32
|
+
* @param compiler - The Webpack compiler instance.
|
|
33
|
+
*/
|
|
34
|
+
apply(compiler) {
|
|
35
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
36
|
+
// Initialise an empty map scoped to this compilation instance
|
|
37
|
+
compilationSchemas.set(compilation, new Map());
|
|
38
|
+
// After all modules are finished, create the aggregated schema asset
|
|
39
|
+
compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async () => {
|
|
40
|
+
await this.createSchemaAsset(compilation);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a single JSON file containing all schemas and adds it to the compilation.
|
|
46
|
+
* The asset is generated as c8y-schemas.json and included in the production bundle.
|
|
47
|
+
*
|
|
48
|
+
* Schemas from the current build are collected via the WeakMap (populated by the
|
|
49
|
+
* schema-loader). They are merged with the persistent cache snapshot from previous
|
|
50
|
+
* builds, so that schemas from webpack-cached (unchanged) modules are not lost on
|
|
51
|
+
* incremental rebuilds when the loader is not re-invoked.
|
|
52
|
+
*
|
|
53
|
+
* @param compilation - The Webpack compilation object.
|
|
54
|
+
*/
|
|
55
|
+
async createSchemaAsset(compilation) {
|
|
56
|
+
try {
|
|
57
|
+
const cache = compilation.getCache(PLUGIN_NAME);
|
|
58
|
+
const freshSchemas = compilationSchemas.get(compilation);
|
|
59
|
+
const hasFreshSchemas = !!freshSchemas?.size;
|
|
60
|
+
// Load the schema snapshot persisted from the previous build (may be null on first run)
|
|
61
|
+
const previousSnapshot = await cache.getPromise('snapshot', null);
|
|
62
|
+
let merged;
|
|
63
|
+
if (hasFreshSchemas && freshSchemas) {
|
|
64
|
+
// Merge: previous snapshot + schemas freshly processed by the loader this build.
|
|
65
|
+
// Overlay order ensures changed files replace their stale snapshot entries.
|
|
66
|
+
merged = { ...(previousSnapshot ?? {}) };
|
|
67
|
+
for (const [key, data] of freshSchemas) {
|
|
68
|
+
merged[key] = data;
|
|
69
|
+
}
|
|
70
|
+
// Only write back when something actually changed — avoids a disk round-trip
|
|
71
|
+
// on fully-cached incremental builds and on the second Angular CLI compilation.
|
|
72
|
+
await cache.storePromise('snapshot', null, merged);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Nothing ran through the loader — snapshot is already up to date, reuse as-is.
|
|
76
|
+
merged = previousSnapshot ?? {};
|
|
77
|
+
}
|
|
78
|
+
if (!Object.keys(merged).length) {
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.warn('No schemas found to aggregate.');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const { assets } = compilation;
|
|
84
|
+
// Convert the schemas map to an array of objects
|
|
85
|
+
const relevantDataOnly = Object.values(merged).map(({ interfaceName, schema, type }) => ({
|
|
86
|
+
interfaceName,
|
|
87
|
+
schema,
|
|
88
|
+
type
|
|
89
|
+
}));
|
|
90
|
+
// Add a new asset for the schemas with the JSON content
|
|
91
|
+
assets['c8y-schemas.json'] = new webpack_1.webpack.sources.RawSource(JSON.stringify(relevantDataOnly, null, 2));
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// eslint-disable-next-line no-console
|
|
95
|
+
console.error('Error creating schema asset:', e);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.SchemaAggregationPlugin = SchemaAggregationPlugin;
|
|
100
|
+
exports.default = SchemaAggregationPlugin;
|
|
101
|
+
//# sourceMappingURL=schema-aggregation-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-aggregation-plugin.js","sourceRoot":"","sources":["../../../../src/webpack/plugin/schema-aggregation-plugin.ts"],"names":[],"mappings":";;;AAuBA,wCAOC;AA7BD,8CAA2C;AAE3C,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAS9C;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAwC,CAAC;AAE/E;;GAEG;AACH,SAAgB,cAAc,CAAC,WAAwB,EAAE,GAAW,EAAE,IAA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"@c8y/devkit",
|
|
3
|
-
"version": "1023.
|
|
3
|
+
"version": "1023.76.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Cumulocity",
|
|
6
6
|
"description": "Cumulocity Webpack Build Facade",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
49
49
|
"@babel/plugin-transform-async-to-generator": "^7.18.6",
|
|
50
50
|
"@babel/preset-env": "^7.28.3",
|
|
51
|
-
"@c8y/client": "1023.
|
|
52
|
-
"@c8y/options": "1023.
|
|
53
|
-
"@c8y/toolkit": "1023.
|
|
51
|
+
"@c8y/client": "1023.76.0",
|
|
52
|
+
"@c8y/options": "1023.76.0",
|
|
53
|
+
"@c8y/toolkit": "1023.76.0",
|
|
54
54
|
"@inquirer/prompts": "7.7.1",
|
|
55
55
|
"@schematics/angular": "^20.3.23",
|
|
56
56
|
"JSONPath": "0.11.2",
|
|
@@ -75,10 +75,11 @@
|
|
|
75
75
|
"mini-css-extract-plugin": "2.9.4",
|
|
76
76
|
"pofile": "1.0.11",
|
|
77
77
|
"postcss-loader": "8.1.1",
|
|
78
|
+
"rimraf": "2.6.2",
|
|
78
79
|
"style-loader": "4.0.0",
|
|
79
80
|
"terser-webpack-plugin": "^5.3.17",
|
|
80
81
|
"tslib": "^2.6.3",
|
|
81
|
-
"typescript": "5.
|
|
82
|
+
"typescript": "5.9.3",
|
|
82
83
|
"typescript-json-schema": "^0.65.1",
|
|
83
84
|
"webpack-dev-middleware": "7.4.2",
|
|
84
85
|
"webpack-hot-middleware": "2.26.1",
|
|
@@ -90,9 +91,7 @@
|
|
|
90
91
|
],
|
|
91
92
|
"devDependencies": {
|
|
92
93
|
"@types/lodash": "^4.17.20",
|
|
93
|
-
"@types/node": "18"
|
|
94
|
-
"@types/webpack": "^5.28.5",
|
|
95
|
-
"@types/webpack-dev-server": "^4.3.1"
|
|
94
|
+
"@types/node": "18"
|
|
96
95
|
},
|
|
97
96
|
"peerDependencies": {
|
|
98
97
|
"@angular-devkit/schematics": "^20.3.23"
|