@uniformdev/cli 19.86.1-alpha.12 → 19.86.1-alpha.15

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/dist/index.mjs +20 -6
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -705,10 +705,18 @@ var findUrlMatchingPartialPathname = (source, pathname) => {
705
705
  }
706
706
  return null;
707
707
  };
708
+ var urlToFileExtension = (url) => {
709
+ try {
710
+ const urlObject = new URL(url);
711
+ const fileNameChunks = urlObject.pathname.split(".");
712
+ return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
713
+ } catch {
714
+ return null;
715
+ }
716
+ };
708
717
  var urlToFileName = (url, hash) => {
709
718
  const fileName = hash ?? urlToHash(url);
710
- const fileNameChunks = url.split(".");
711
- const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
719
+ const fileExtension = urlToFileExtension(url);
712
720
  return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
713
721
  };
714
722
  var getFilesDirectory = (directory) => {
@@ -939,16 +947,22 @@ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, op
939
947
  return JSON.parse(sourceObjectAsString);
940
948
  };
941
949
  var updateAssetFileIdBasedOnUrl = async (asset, options) => {
942
- var _a, _b, _c;
943
- const fileUrl = (_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
944
- if (!fileUrl || !((_c = asset.asset.fields) == null ? void 0 : _c.file)) {
950
+ var _a;
951
+ if (!asset.asset.fields) {
952
+ return asset;
953
+ }
954
+ const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
955
+ if (!fileUrl) {
945
956
  return asset;
946
957
  }
947
958
  const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
948
959
  if (!file) {
949
960
  return asset;
950
961
  }
951
- asset.asset.fields.file.value = file.id;
962
+ asset.asset.fields.file = {
963
+ type: "file",
964
+ value: file.id
965
+ };
952
966
  return asset;
953
967
  };
954
968
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.86.1-alpha.12+269e1d3d8",
3
+ "version": "19.86.1-alpha.15+d0028b600",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@thi.ng/mime": "^2.2.23",
20
- "@uniformdev/assets": "19.86.1-alpha.12+269e1d3d8",
21
- "@uniformdev/canvas": "19.86.1-alpha.12+269e1d3d8",
22
- "@uniformdev/context": "19.86.1-alpha.12+269e1d3d8",
23
- "@uniformdev/files": "19.86.1-alpha.12+269e1d3d8",
24
- "@uniformdev/project-map": "19.86.1-alpha.12+269e1d3d8",
25
- "@uniformdev/redirect": "19.86.1-alpha.12+269e1d3d8",
20
+ "@uniformdev/assets": "19.86.1-alpha.15+d0028b600",
21
+ "@uniformdev/canvas": "19.86.1-alpha.15+d0028b600",
22
+ "@uniformdev/context": "19.86.1-alpha.15+d0028b600",
23
+ "@uniformdev/files": "19.86.1-alpha.15+d0028b600",
24
+ "@uniformdev/project-map": "19.86.1-alpha.15+d0028b600",
25
+ "@uniformdev/redirect": "19.86.1-alpha.15+d0028b600",
26
26
  "call-bind": "^1.0.2",
27
27
  "colorette": "2.0.20",
28
28
  "cosmiconfig": "8.3.6",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "269e1d3d882fbfbef93721434d142475c32a5891"
72
+ "gitHead": "d0028b60072915cdc68eb415b9dd066d6a3ffff7"
73
73
  }