@blocklet/meta 1.8.28 → 1.8.29

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.
Files changed (2) hide show
  1. package/lib/util-meta.js +5 -4
  2. package/package.json +5 -5
package/lib/util-meta.js CHANGED
@@ -1,3 +1,4 @@
1
+ const { fileURLToPath } = require('url');
1
2
  const fs = require('fs');
2
3
  const axios = require('@abtnode/util/lib/axios');
3
4
  const any = require('promise.any');
@@ -10,11 +11,11 @@ const { validateMeta, fixAndValidateService } = require('./validate');
10
11
 
11
12
  const validateUrl = async (url, expectedHttpResTypes = ['application/json', 'text/plain']) => {
12
13
  const parsed = new URL(url);
13
- const { protocol, pathname } = parsed;
14
+ const { protocol } = parsed;
14
15
 
15
16
  // file
16
17
  if (protocol.startsWith('file')) {
17
- const decoded = decodeURIComponent(pathname);
18
+ const decoded = decodeURIComponent(fileURLToPath(url));
18
19
  if (!fs.existsSync(decoded)) {
19
20
  throw new Error(`File does not exist: ${decoded}`);
20
21
  }
@@ -50,10 +51,10 @@ const validateBlockletMeta = (meta, opts = {}) => {
50
51
  };
51
52
 
52
53
  const getBlockletMetaByUrl = async (url) => {
53
- const { protocol, pathname } = new URL(url);
54
+ const { protocol } = new URL(url);
54
55
 
55
56
  if (protocol.startsWith('file')) {
56
- const decoded = decodeURIComponent(pathname);
57
+ const decoded = decodeURIComponent(fileURLToPath(url));
57
58
  if (!fs.existsSync(decoded)) {
58
59
  throw new Error(`File does not exist: ${decoded}`);
59
60
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.28",
6
+ "version": "1.8.29",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,13 +18,13 @@
18
18
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@abtnode/constant": "1.8.28",
22
- "@abtnode/util": "1.8.28",
21
+ "@abtnode/constant": "1.8.29",
22
+ "@abtnode/util": "1.8.29",
23
23
  "@arcblock/did": "1.17.23",
24
24
  "@arcblock/did-ext": "1.17.23",
25
25
  "@arcblock/did-util": "1.17.23",
26
26
  "@arcblock/jwt": "1.17.23",
27
- "@blocklet/constant": "1.8.28",
27
+ "@blocklet/constant": "1.8.29",
28
28
  "@ocap/asset": "1.17.23",
29
29
  "@ocap/mcrypto": "1.17.23",
30
30
  "@ocap/util": "1.17.23",
@@ -54,5 +54,5 @@
54
54
  "express": "^4.18.2",
55
55
  "jest": "^27.5.1"
56
56
  },
57
- "gitHead": "af7aacf5507177600ae563ab597cb42d7223b113"
57
+ "gitHead": "ee52d838f0cf97e551d53a6509cb0da7e5f31978"
58
58
  }