@ui5/webcomponents-tools 1.10.1 → 1.10.4-rc.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/CHANGELOG.md
CHANGED
@@ -3,6 +3,26 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.10.4-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.3...v1.10.4-rc.0) (2023-01-26)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.10.3](https://github.com/SAP/ui5-webcomponents/compare/v1.10.2...v1.10.3) (2023-01-25)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
## [1.10.2](https://github.com/SAP/ui5-webcomponents/compare/v1.10.1...v1.10.2) (2023-01-25)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package ui5-webcomponents
|
25
|
+
|
6
26
|
## [1.10.1](https://github.com/SAP/ui5-webcomponents/compare/v0.0.0-7b49a7ff1...v1.10.1) (2023-01-24)
|
7
27
|
|
8
28
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
@@ -120,8 +120,9 @@ const getScripts = (options) => {
|
|
120
120
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
121
121
|
},
|
122
122
|
generateAPI: {
|
123
|
-
default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup",
|
123
|
+
default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
|
124
124
|
prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
|
125
|
+
prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
|
125
126
|
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
|
126
127
|
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
|
127
128
|
cleanup: "rimraf jsdoc-dist/"
|
@@ -1,9 +1,12 @@
|
|
1
1
|
const fs = require("fs").promises;
|
2
|
+
const path = require("path");
|
2
3
|
// https://github.com/webcomponents/custom-elements-manifest/blob/main/schema.json
|
3
4
|
|
5
|
+
const inputDir = process.argv[2];
|
6
|
+
const outputDir = process.argv[3];
|
7
|
+
|
4
8
|
const camelToKebabMap = new Map();
|
5
9
|
const apiIndex = new Map();
|
6
|
-
const processedApiIndex = new Set();
|
7
10
|
const forbiddenAttributeTypes = ["object", "array"];
|
8
11
|
|
9
12
|
const camelToKebabCase = string => {
|
@@ -16,7 +19,7 @@ const camelToKebabCase = string => {
|
|
16
19
|
|
17
20
|
const generateJavaScriptExport = entity => {
|
18
21
|
return {
|
19
|
-
declaration: generateRefenrece(entity),
|
22
|
+
declaration: generateRefenrece(entity.name),
|
20
23
|
deprecated: !!entity.deprecated,
|
21
24
|
kind: "js",
|
22
25
|
name: "default",
|
@@ -226,8 +229,6 @@ const generateSlots = slots => {
|
|
226
229
|
};
|
227
230
|
|
228
231
|
const generateCustomElementDeclaration = entity => {
|
229
|
-
entity = generateFullComponentApi(entity);
|
230
|
-
|
231
232
|
let generatedCustomElementDeclaration = {
|
232
233
|
deprecated: !!entity.deprecated,
|
233
234
|
customElement: true,
|
@@ -265,107 +266,60 @@ const generateCustomElementDeclaration = entity => {
|
|
265
266
|
}
|
266
267
|
|
267
268
|
if (entity.extends && entity.extends !== "HTMLElement") {
|
268
|
-
generatedCustomElementDeclaration.superclass = generateRefenrece(
|
269
|
+
generatedCustomElementDeclaration.superclass = generateRefenrece(entity.extends);
|
269
270
|
}
|
270
271
|
|
271
272
|
return generatedCustomElementDeclaration;
|
272
273
|
};
|
273
274
|
|
274
|
-
const generateRefenrece = (
|
275
|
+
const generateRefenrece = (entityName) => {
|
275
276
|
let packageName;
|
277
|
+
let basename;
|
276
278
|
|
277
|
-
if (!
|
279
|
+
if (!entityName) {
|
278
280
|
throw new Error("JSDoc error: entity not found in api.json.");
|
279
281
|
}
|
280
282
|
|
281
|
-
if (
|
283
|
+
if (entityName.includes(".")) {
|
284
|
+
basename = entityName.split(".").pop();
|
285
|
+
} else {
|
286
|
+
basename = entityName
|
287
|
+
}
|
288
|
+
|
289
|
+
if (entityName.includes("sap.ui.webc.main")) {
|
282
290
|
packageName = "@ui5/webcomponents";
|
283
|
-
} else if (
|
291
|
+
} else if (entityName.includes("sap.ui.webc.fiori")) {
|
284
292
|
packageName = "@ui5/webcomponents-fiori";
|
285
|
-
} else if (
|
293
|
+
} else if (entityName.includes("sap.ui.webc.base")) {
|
286
294
|
packageName = "@ui5/webcomponents-base";
|
287
295
|
}
|
288
296
|
|
289
297
|
return {
|
290
|
-
module: `${
|
291
|
-
name: `${
|
298
|
+
module: `${basename}.js`,
|
299
|
+
name: `${basename}`,
|
292
300
|
package: packageName,
|
293
301
|
};
|
294
302
|
};
|
295
303
|
|
296
|
-
const generateFullComponentApi = entity => {
|
297
|
-
const componentProps = ["properties", "slots", "events", "methods"];
|
298
|
-
let parent = apiIndex.get(entity.extends);
|
299
|
-
|
300
|
-
if (!parent) {
|
301
|
-
processedApiIndex.add(entity.name);
|
302
|
-
|
303
|
-
return entity;
|
304
|
-
}
|
305
|
-
|
306
|
-
parent = processedApiIndex.has(entity.extends) ? apiIndex.get(entity.extends) : generateFullComponentApi(parent);
|
307
|
-
|
308
|
-
componentProps.forEach(prop => {
|
309
|
-
if (parent[prop] && parent[prop].length) {
|
310
|
-
if (entity[prop] && entity[prop].length) {
|
311
|
-
const uniqueParentState = parent[prop].filter(pSlot => {
|
312
|
-
return !entity[prop].some(eSlot => eSlot.name === pSlot.name);
|
313
|
-
});
|
314
|
-
|
315
|
-
entity[prop] = entity[prop].concat(uniqueParentState);
|
316
|
-
} else {
|
317
|
-
entity[prop] = [...parent[prop]];
|
318
|
-
}
|
319
|
-
}
|
320
|
-
});
|
321
|
-
|
322
|
-
processedApiIndex.add(entity.name);
|
323
|
-
|
324
|
-
return entity;
|
325
|
-
};
|
326
|
-
|
327
304
|
const filterPublicApi = array => {
|
328
305
|
return (array || []).filter(el => el.visibility === "public");
|
329
306
|
};
|
330
307
|
|
331
308
|
const generate = async () => {
|
332
|
-
const
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
let apiFiles = new Map();
|
339
|
-
|
340
|
-
await Promise.all(apiFilesPaths.map(async (apiFilePath) => {
|
341
|
-
const file = JSON.parse(await fs.readFile(apiFilePath));
|
342
|
-
|
343
|
-
apiFiles.set(apiFilePath, file);
|
344
|
-
|
345
|
-
file.symbols.forEach(symbol => {
|
346
|
-
apiIndex.set(symbol.name, symbol);
|
347
|
-
});
|
348
|
-
}));
|
309
|
+
const file = JSON.parse(await fs.readFile(path.join(inputDir, "api.json")));
|
310
|
+
let customElementsManifest = {
|
311
|
+
schemaVersion: "1.0.0",
|
312
|
+
readme: "",
|
313
|
+
modules: [],
|
314
|
+
};
|
349
315
|
|
350
|
-
|
351
|
-
if (
|
352
|
-
|
316
|
+
file.symbols.forEach(entity => {
|
317
|
+
if (entity.tagname) {
|
318
|
+
customElementsManifest.modules.push(generateJavaScriptModule(entity));
|
353
319
|
}
|
320
|
+
});
|
354
321
|
|
355
|
-
|
356
|
-
schemaVersion: "1.0.0",
|
357
|
-
readme: "",
|
358
|
-
modules: [],
|
359
|
-
};
|
360
|
-
|
361
|
-
apiFiles.get(apiFilePath).symbols.forEach(entity => {
|
362
|
-
if (entity.tagname) {
|
363
|
-
customElementsManifest.modules.push(generateJavaScriptModule(entity));
|
364
|
-
}
|
365
|
-
});
|
366
|
-
|
367
|
-
await fs.writeFile(apiFilePath.replace("api.json", "custom-elements.json"), JSON.stringify(customElementsManifest));
|
368
|
-
}));
|
322
|
+
await fs.writeFile(path.join(outputDir, "custom-elements.json"), JSON.stringify(customElementsManifest));
|
369
323
|
};
|
370
324
|
|
371
325
|
generate().then(() => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "1.10.
|
3
|
+
"version": "1.10.4-rc.0",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"devDependencies": {
|
73
73
|
"yargs": "^17.5.1"
|
74
74
|
},
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "b618aed1a969ce5a738b620cb8b2d7d796638d4c"
|
76
76
|
}
|