@blocklet/meta 1.8.22 → 1.8.24

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.
@@ -185,17 +185,18 @@ const doParseNavigation = (navigation, blocklet, prefix = '/', _level = 1) => {
185
185
  return result;
186
186
  };
187
187
 
188
- const markDuplicate = (navigation, urls = []) => {
188
+ const markDuplicate = (navigation, compares = []) => {
189
189
  navigation.forEach((item) => {
190
- if (item.link && urls.some((x) => isEqual(x, item.link))) {
190
+ const compare = { link: item.link, section: item.section || [] };
191
+ if (item.link && compares.some((x) => isEqual(x, compare))) {
191
192
  item.duplicate = true;
192
193
  }
193
194
  if (item.link) {
194
- urls.push(item.link);
195
+ compares.push(compare);
195
196
  }
196
197
 
197
198
  if (item.items) {
198
- markDuplicate(item.items, urls);
199
+ markDuplicate(item.items, compares);
199
200
  }
200
201
  });
201
202
 
package/lib/parse.js CHANGED
@@ -48,6 +48,8 @@ const parse = (
48
48
  } catch (err) {
49
49
  console.error(`parse_blocklet_meta from ${BLOCKLET_META_FILE_ALT} failed`, err);
50
50
  }
51
+ } else {
52
+ throw new Error(`no ${BLOCKLET_META_FILE} or ${BLOCKLET_META_FILE_ALT} found`);
51
53
  }
52
54
 
53
55
  // User Can override with extra meta attrs: useful for registry
package/lib/schema.js CHANGED
@@ -42,6 +42,7 @@ const titleSchema = Joi.string()
42
42
  return value;
43
43
  });
44
44
  const descriptionSchema = Joi.string().trim().min(3).max(160);
45
+ const mountPointSchema = Joi.string().trim().min(1);
45
46
 
46
47
  const blockletNameSchema = Joi.string()
47
48
  .custom((value) => {
@@ -172,7 +173,7 @@ const childrenSchema = Joi.object({
172
173
  name: blockletNameSchema.required(),
173
174
  title: titleSchema,
174
175
  description: descriptionSchema,
175
- mountPoint: Joi.string().trim().min(1), // added in 1.2.3
176
+ mountPoint: mountPointSchema, // added in 1.2.3
176
177
  services: Joi.array().items(serviceSchema).unique('name'), // added in 1.2.3
177
178
  source: Joi.alternatives().try(
178
179
  Joi.object({
@@ -514,4 +515,5 @@ module.exports = {
514
515
  descriptionSchema,
515
516
  navigationSchema,
516
517
  themeSchema,
518
+ mountPointSchema,
517
519
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.22",
6
+ "version": "1.8.24",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,8 +18,8 @@
18
18
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@abtnode/constant": "1.8.22",
22
- "@abtnode/util": "1.8.22",
21
+ "@abtnode/constant": "1.8.24",
22
+ "@abtnode/util": "1.8.24",
23
23
  "@arcblock/did": "1.17.19",
24
24
  "@arcblock/did-ext": "1.17.19",
25
25
  "@arcblock/did-util": "1.17.19",
@@ -53,5 +53,5 @@
53
53
  "express": "^4.18.1",
54
54
  "jest": "^27.5.1"
55
55
  },
56
- "gitHead": "b0b31c2a0d29de79b29591f020f577d6c3806248"
56
+ "gitHead": "2b955a638ca6177c04f3a722cc326770fba276f0"
57
57
  }