@uniformdev/cli 19.201.1 → 19.202.1-alpha.9

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.
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // ../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.2_tsx@4.17.0_typescript@5.5.4/node_modules/tsup/assets/esm_shims.js
8
+ // ../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.43.2_postcss@8.4.47_tsx@4.19.2_typescript@5.6.3/node_modules/tsup/assets/esm_shims.js
9
9
  import { fileURLToPath } from "url";
10
10
  import path from "path";
11
11
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -65,14 +65,30 @@ function nodeFetchProxy(proxy, verbose) {
65
65
  console.log(`\u{1F991} Using proxy ${proxy}`);
66
66
  }
67
67
  const wrappedFetch = (input, init) => {
68
+ const handleFetchError = (e) => {
69
+ if (e instanceof Error) {
70
+ e.message = `Error fetching ${input.toString()}
71
+ ${e.message}`;
72
+ if (e.cause) {
73
+ let cause = "Root cause: " + e.cause.toString();
74
+ if (e.cause instanceof AggregateError) {
75
+ cause = "Root causes: \n" + e.cause.errors.map((err) => err.toString()).join("\n");
76
+ }
77
+ e.message = e.message + " \n" + cause;
78
+ }
79
+ }
80
+ throw e;
81
+ };
68
82
  if (proxy) {
69
83
  const wrappedInit = {
70
84
  ...init,
71
85
  dispatcher: new ProxyAgent(proxy)
72
86
  };
73
- return undiciFetch(input, wrappedInit);
87
+ return undiciFetch(input, wrappedInit).catch(handleFetchError);
74
88
  }
75
- return undiciFetch(input, init);
89
+ return undiciFetch(input, init).catch(
90
+ handleFetchError
91
+ );
76
92
  };
77
93
  if (verbose) {
78
94
  return async function fetchWithVerboseLogging(input, init) {
@@ -91,7 +107,7 @@ function nodeFetchProxy(proxy, verbose) {
91
107
  } else {
92
108
  message = responseText;
93
109
  }
94
- } catch (e) {
110
+ } catch {
95
111
  message = responseText;
96
112
  }
97
113
  } catch {
@@ -283,10 +299,10 @@ var getDirectoryOrFilename = ({
283
299
  defaultEntityFolderName = entityType
284
300
  }) => {
285
301
  if (config.entitiesConfig[entityType]?.[operation]?.directory) {
286
- return config.entitiesConfig[entityType]?.[operation]?.directory;
302
+ return config.entitiesConfig[entityType][operation].directory;
287
303
  }
288
304
  if (config.entitiesConfig[entityType]?.directory) {
289
- return config.entitiesConfig[entityType]?.directory;
305
+ return config.entitiesConfig[entityType].directory;
290
306
  }
291
307
  const isPackage = isPathAPackageFile(config.directory);
292
308
  if (isPackage) {
@@ -1,4 +1,4 @@
1
- import "./chunk-KSB3SFPP.mjs";
1
+ import "./chunk-KAJUBJZI.mjs";
2
2
 
3
3
  // src/sync/allSerializableEntitiesConfig.ts
4
4
  var allSerializableEntitiesConfig = {
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  withFormatOptions,
17
17
  withProjectOptions,
18
18
  withTeamOptions
19
- } from "./chunk-KSB3SFPP.mjs";
19
+ } from "./chunk-KAJUBJZI.mjs";
20
20
 
21
21
  // src/index.ts
22
22
  import * as dotenv from "dotenv";
@@ -320,7 +320,7 @@ async function syncEngine({
320
320
  });
321
321
  }
322
322
  };
323
- actions.push(process2(sourceObject, targetObject));
323
+ actions.push(() => process2(sourceObject, targetObject));
324
324
  }
325
325
  }
326
326
  ids.forEach((i) => targetItems.delete(i));
@@ -352,15 +352,15 @@ async function syncEngine({
352
352
  [...invalidTargetObjects, targetObject].forEach((o) => {
353
353
  (Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
354
354
  });
355
- const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map(async (io) => {
356
- await processDelete(io);
355
+ const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map((io) => {
356
+ return () => processDelete(io);
357
357
  });
358
358
  if (targetObject) {
359
- deletes.push(processDelete(targetObject));
359
+ deletes.push(() => processDelete(targetObject));
360
360
  }
361
- actions.push(Promise.all(deletes).then(() => process2(sourceObject, ids[0])));
361
+ actions.push(() => Promise.all(deletes.map((d) => d())).then(() => process2(sourceObject, ids[0])));
362
362
  } else {
363
- actions.push(process2(sourceObject, ids[0]));
363
+ actions.push(() => process2(sourceObject, ids[0]));
364
364
  }
365
365
  }
366
366
  }
@@ -371,12 +371,12 @@ async function syncEngine({
371
371
  );
372
372
  }
373
373
  const deletes = [];
374
- targetItems.forEach(async (object) => {
375
- deletes.push(processDelete(object));
374
+ targetItems.forEach((object) => {
375
+ deletes.push(() => processDelete(object));
376
376
  });
377
- await Promise.all(deletes);
377
+ await Promise.all(deletes.map((d) => d()));
378
378
  }
379
- await Promise.all(actions);
379
+ await Promise.all(actions.map((a) => a()));
380
380
  await Promise.all([source.onSyncComplete?.(false), target.onSyncComplete?.(true)]);
381
381
  }
382
382
  var SyncEngineError = class _SyncEngineError extends Error {
@@ -481,6 +481,7 @@ import { UncachedFileClient } from "@uniformdev/files";
481
481
  import { preferredType } from "@thi.ng/mime";
482
482
  import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
483
483
  import { createHash } from "crypto";
484
+ import { fileTypeFromBuffer } from "file-type";
484
485
  import fsj from "fs-jetpack";
485
486
  import sizeOf from "image-size";
486
487
  import PQueue from "p-queue";
@@ -505,7 +506,9 @@ var hashToPartialPathname = (hash) => {
505
506
  };
506
507
  var findUrlMatchingPartialPathname = (source, pathname) => {
507
508
  const escapedPathname = escapeRegExp(pathname);
508
- const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
509
+ const regex = new RegExp(
510
+ `"(https://([^"]*?)?(img|files).uniform.(rocks|global)${escapedPathname}([^"]*?))"`
511
+ );
509
512
  const match = source.match(regex);
510
513
  if (match && match[1]) {
511
514
  return match[1];
@@ -536,7 +539,7 @@ var getFilesDirectory = (directory) => {
536
539
  );
537
540
  };
538
541
  var getUniformFileUrlMatches = (string) => {
539
- return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
542
+ return string.matchAll(/"(https:\/\/([^"]*?)?(img|files)\.uniform\.(rocks|global)\/([^"]*?))"/g);
540
543
  };
541
544
  var deleteDownloadedFileByUrl = async (url, options) => {
542
545
  const writeDirectory = getFilesDirectory(options.directory);
@@ -641,7 +644,20 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
641
644
  return;
642
645
  }
643
646
  const fileName = getFileNameFromUrl(url);
647
+ let mimeType = expectedFilePath.endsWith(".svg") ? "image/svg+xml" : (await fileTypeFromBuffer(fileBuffer))?.mime;
648
+ if (!mimeType) {
649
+ mimeType = preferredType(url.split(".").at(-1) ?? "");
650
+ }
651
+ if (mimeType === "audio/x-flac") {
652
+ mimeType = "audio/flac";
653
+ }
644
654
  const { width, height } = (() => {
655
+ if (!mimeType.startsWith("image/")) {
656
+ return {
657
+ width: void 0,
658
+ height: void 0
659
+ };
660
+ }
645
661
  try {
646
662
  return sizeOf(fileBuffer);
647
663
  } catch {
@@ -651,7 +667,6 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
651
667
  };
652
668
  }
653
669
  })();
654
- const mimeType = preferredType(url.split(".").at(-1) ?? "");
655
670
  const { id, method, uploadUrl } = await options.fileClient.insert({
656
671
  name: fileName,
657
672
  mediaType: mimeType,
@@ -8378,7 +8393,7 @@ import { PostHog } from "posthog-node";
8378
8393
  // package.json
8379
8394
  var package_default = {
8380
8395
  name: "@uniformdev/cli",
8381
- version: "19.201.1",
8396
+ version: "19.207.0",
8382
8397
  description: "Uniform command line interface tool",
8383
8398
  license: "SEE LICENSE IN LICENSE.txt",
8384
8399
  main: "./cli.js",
@@ -8418,6 +8433,7 @@ var package_default = {
8418
8433
  diff: "^5.0.0",
8419
8434
  dotenv: "^16.0.3",
8420
8435
  execa: "5.1.1",
8436
+ "file-type": "^19.6.0",
8421
8437
  "fs-jetpack": "5.1.0",
8422
8438
  graphql: "16.9.0",
8423
8439
  "graphql-request": "6.1.0",
@@ -8434,7 +8450,7 @@ var package_default = {
8434
8450
  "registry-auth-token": "^5.0.0",
8435
8451
  "registry-url": "^6.0.0",
8436
8452
  slugify: "1.6.6",
8437
- undici: "^6.10.1",
8453
+ undici: "^6.20.1",
8438
8454
  yargs: "^17.6.2",
8439
8455
  zod: "3.23.8"
8440
8456
  },
@@ -8444,7 +8460,7 @@ var package_default = {
8444
8460
  "@types/js-yaml": "4.0.9",
8445
8461
  "@types/jsonwebtoken": "9.0.5",
8446
8462
  "@types/lodash.isequalwith": "4.4.9",
8447
- "@types/node": "20.10.6",
8463
+ "@types/node": "22.7.8",
8448
8464
  "@types/yargs": "17.0.32"
8449
8465
  },
8450
8466
  bin: {
@@ -8597,8 +8613,7 @@ var makeApiKey = (teamId, projectId, name, permissions) => ({
8597
8613
  {
8598
8614
  projectId,
8599
8615
  permissions,
8600
- roles: [],
8601
- useCustom: true
8616
+ roles: []
8602
8617
  }
8603
8618
  ],
8604
8619
  email: "",
@@ -10599,7 +10614,6 @@ var SyncPullModule = {
10599
10614
  contentType: ContentTypePullModule,
10600
10615
  previewUrl: PreviewUrlPullModule,
10601
10616
  previewViewport: PreviewViewportPullModule
10602
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10603
10617
  }).filter(([entityType]) => {
10604
10618
  return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.pull?.disabled !== true;
10605
10619
  });
@@ -10636,7 +10650,7 @@ var SyncPullModule = {
10636
10650
  }
10637
10651
  }
10638
10652
  );
10639
- } catch (e) {
10653
+ } catch {
10640
10654
  process.exit(1);
10641
10655
  }
10642
10656
  }
@@ -10698,7 +10712,6 @@ var SyncPushModule = {
10698
10712
  entryPattern: EntryPatternPushModule,
10699
10713
  previewUrl: PreviewUrlPushModule,
10700
10714
  previewViewport: PreviewViewportPushModule
10701
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10702
10715
  }).filter(([entityType]) => {
10703
10716
  return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.push?.disabled !== true;
10704
10717
  });
@@ -10731,7 +10744,7 @@ var SyncPushModule = {
10731
10744
  }
10732
10745
  }
10733
10746
  );
10734
- } catch (e) {
10747
+ } catch {
10735
10748
  process.exit(1);
10736
10749
  }
10737
10750
  }
@@ -10976,7 +10989,7 @@ async function tryReadJSON(path4, missingValue = null) {
10976
10989
  try {
10977
10990
  const stat = await fs6.stat(path4);
10978
10991
  return stat.isFile() ? await readJSON(path4) : missingValue;
10979
- } catch (e) {
10992
+ } catch {
10980
10993
  return missingValue;
10981
10994
  }
10982
10995
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.201.1",
3
+ "version": "19.202.1-alpha.9+63c059770a",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "19.201.1",
31
- "@uniformdev/canvas": "19.201.1",
32
- "@uniformdev/context": "19.201.1",
33
- "@uniformdev/files": "19.201.1",
34
- "@uniformdev/project-map": "19.201.1",
35
- "@uniformdev/redirect": "19.201.1",
30
+ "@uniformdev/assets": "19.202.1-alpha.9+63c059770a",
31
+ "@uniformdev/canvas": "19.202.1-alpha.9+63c059770a",
32
+ "@uniformdev/context": "19.202.1-alpha.9+63c059770a",
33
+ "@uniformdev/files": "19.202.1-alpha.9+63c059770a",
34
+ "@uniformdev/project-map": "19.202.1-alpha.9+63c059770a",
35
+ "@uniformdev/redirect": "19.202.1-alpha.9+63c059770a",
36
36
  "call-bind": "^1.0.2",
37
37
  "colorette": "2.0.20",
38
38
  "cosmiconfig": "9.0.0",
@@ -40,6 +40,7 @@
40
40
  "diff": "^5.0.0",
41
41
  "dotenv": "^16.0.3",
42
42
  "execa": "5.1.1",
43
+ "file-type": "^19.6.0",
43
44
  "fs-jetpack": "5.1.0",
44
45
  "graphql": "16.9.0",
45
46
  "graphql-request": "6.1.0",
@@ -56,7 +57,7 @@
56
57
  "registry-auth-token": "^5.0.0",
57
58
  "registry-url": "^6.0.0",
58
59
  "slugify": "1.6.6",
59
- "undici": "^6.10.1",
60
+ "undici": "^6.20.1",
60
61
  "yargs": "^17.6.2",
61
62
  "zod": "3.23.8"
62
63
  },
@@ -66,7 +67,7 @@
66
67
  "@types/js-yaml": "4.0.9",
67
68
  "@types/jsonwebtoken": "9.0.5",
68
69
  "@types/lodash.isequalwith": "4.4.9",
69
- "@types/node": "20.10.6",
70
+ "@types/node": "22.7.8",
70
71
  "@types/yargs": "17.0.32"
71
72
  },
72
73
  "bin": {
@@ -78,5 +79,5 @@
78
79
  "publishConfig": {
79
80
  "access": "public"
80
81
  },
81
- "gitHead": "2e20dee3fc5ce005f6d73eddf939cc89cbad83de"
82
+ "gitHead": "63c059770a54fc063a12af0f74eba059143e8074"
82
83
  }