@sanity/cli-core 1.3.0 â 1.3.2
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/dist/_exports/index.d.ts +207 -86
- package/dist/_exports/index.js +2 -0
- package/dist/_exports/index.js.map +1 -1
- package/dist/config/cli/schemas.js +50 -50
- package/dist/config/cli/schemas.js.map +1 -1
- package/dist/config/studio/readStudioConfig.js +11 -11
- package/dist/config/studio/readStudioConfig.js.map +1 -1
- package/dist/config/studio/readStudioConfig.worker.js +1 -1
- package/dist/config/studio/readStudioConfig.worker.js.map +1 -1
- package/dist/services/apiClient.js +2 -2
- package/dist/services/apiClient.js.map +1 -1
- package/dist/services/cliUserConfig.js +2 -2
- package/dist/services/cliUserConfig.js.map +1 -1
- package/dist/telemetry/getCliTelemetry.js +1 -1
- package/dist/telemetry/getCliTelemetry.js.map +1 -1
- package/dist/telemetry/noopTelemetry.js +23 -0
- package/dist/telemetry/noopTelemetry.js.map +1 -0
- package/dist/util/getLocalPackageVersion.js +55 -0
- package/dist/util/getLocalPackageVersion.js.map +1 -0
- package/dist/util/importModule.js +1 -1
- package/dist/util/importModule.js.map +1 -1
- package/dist/util/readPackageJson.js +17 -17
- package/dist/util/readPackageJson.js.map +1 -1
- package/package.json +16 -19
package/dist/_exports/index.d.ts
CHANGED
|
@@ -3,19 +3,17 @@ import { CLIError } from "@oclif/core/errors";
|
|
|
3
3
|
import { Command } from "@oclif/core";
|
|
4
4
|
import { CommandError } from "@oclif/core/interfaces";
|
|
5
5
|
import { ConfigEnv } from "vite";
|
|
6
|
-
import { ConsentStatus } from "@sanity/telemetry";
|
|
7
6
|
import debugIt from "debug";
|
|
8
7
|
import { InlineConfig } from "vite";
|
|
9
8
|
import { Interfaces } from "@oclif/core";
|
|
10
9
|
import { PluginOptions } from "babel-plugin-react-compiler";
|
|
11
10
|
import { SanityClient } from "sanity";
|
|
12
11
|
import { SanityClient as SanityClient_2 } from "@sanity/client";
|
|
13
|
-
import { TelemetryLogger } from "@sanity/telemetry";
|
|
14
12
|
import { URL as URL_2 } from "node:url";
|
|
15
13
|
import { Worker as Worker_2 } from "node:worker_threads";
|
|
16
14
|
import { WorkerOptions as WorkerOptions_2 } from "node:worker_threads";
|
|
17
15
|
import { Workspace } from "sanity";
|
|
18
|
-
import { z } from "zod";
|
|
16
|
+
import { z } from "zod/mini";
|
|
19
17
|
|
|
20
18
|
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
21
19
|
T["args"]
|
|
@@ -208,6 +206,14 @@ export declare type ConsentInformation =
|
|
|
208
206
|
status: Extract<ConsentStatus, "unset">;
|
|
209
207
|
};
|
|
210
208
|
|
|
209
|
+
/**
|
|
210
|
+
* 'unknown' - we don't know if the user has consented or not (e.g. something went wrong)
|
|
211
|
+
* 'unset' - the user has not yet been asked for consent
|
|
212
|
+
* 'granted' - the user has consented
|
|
213
|
+
* 'denied' - the user has denied consent
|
|
214
|
+
*/
|
|
215
|
+
declare type ConsentStatus = "undetermined" | "unset" | "granted" | "denied";
|
|
216
|
+
|
|
211
217
|
/**
|
|
212
218
|
* Creates a new worker for a studio worker task.
|
|
213
219
|
*
|
|
@@ -249,6 +255,46 @@ export declare function createStudioWorker(
|
|
|
249
255
|
declare const debug_2: debugIt.Debugger;
|
|
250
256
|
export { debug_2 as debug };
|
|
251
257
|
|
|
258
|
+
declare interface DeferredEvent<
|
|
259
|
+
Data = unknown,
|
|
260
|
+
Event extends DefinedTelemetryLog<Data> = DefinedTelemetryLog<Data>,
|
|
261
|
+
> {
|
|
262
|
+
createdAt: string;
|
|
263
|
+
event: Event;
|
|
264
|
+
data: Data;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare interface DefinedTelemetryLog<Schema> {
|
|
268
|
+
type: "log";
|
|
269
|
+
/** Unique name of the event */
|
|
270
|
+
name: string;
|
|
271
|
+
/** Event version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
|
|
272
|
+
version: number;
|
|
273
|
+
/** Description of log event */
|
|
274
|
+
description?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Max sample rate of this event.
|
|
277
|
+
* Calling telemetry.log(EventDefinition, data) repeatedly will submit at most one event every specified time interval (in milliseconds)
|
|
278
|
+
* */
|
|
279
|
+
maxSampleRate?: number;
|
|
280
|
+
/** Data schema. Will not be accessible at runtime */
|
|
281
|
+
schema: Schema;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare interface DefinedTelemetryTrace<Data = void, Context = void> {
|
|
285
|
+
type: "trace";
|
|
286
|
+
/** Unique name of the trace */
|
|
287
|
+
name: string;
|
|
288
|
+
/** Trace version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
|
|
289
|
+
version: number;
|
|
290
|
+
/** Description of trace */
|
|
291
|
+
description?: string;
|
|
292
|
+
/** Data schema. Will not be accessible at runtime */
|
|
293
|
+
schema: Data;
|
|
294
|
+
/** Contextual data schema. Will not be accessible at runtime */
|
|
295
|
+
context: Context;
|
|
296
|
+
}
|
|
297
|
+
|
|
252
298
|
/**
|
|
253
299
|
* This function is a replacement for built in dynamic import
|
|
254
300
|
* This handles the case for windows file paths especially for absolute paths.
|
|
@@ -404,6 +450,34 @@ export declare function getGlobalCliClient({
|
|
|
404
450
|
...config
|
|
405
451
|
}: GlobalCliClientOptions): Promise<SanityClient_2>;
|
|
406
452
|
|
|
453
|
+
/**
|
|
454
|
+
* Resolve the filesystem directory of a locally installed package using Node
|
|
455
|
+
* module resolution. Works correctly with hoisted packages in monorepos/workspaces,
|
|
456
|
+
* pnpm symlinks, and other non-standard node_modules layouts.
|
|
457
|
+
*
|
|
458
|
+
* @param moduleName - The name of the package in npm.
|
|
459
|
+
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
460
|
+
* @returns The absolute path to the package directory.
|
|
461
|
+
* @internal
|
|
462
|
+
*/
|
|
463
|
+
export declare function getLocalPackageDir(
|
|
464
|
+
moduleName: string,
|
|
465
|
+
workDir: string,
|
|
466
|
+
): string;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Get the version of a package installed locally.
|
|
470
|
+
*
|
|
471
|
+
* @param moduleName - The name of the package in npm.
|
|
472
|
+
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
473
|
+
* @returns The version of the package installed locally.
|
|
474
|
+
* @internal
|
|
475
|
+
*/
|
|
476
|
+
export declare function getLocalPackageVersion(
|
|
477
|
+
moduleName: string,
|
|
478
|
+
workDir: string,
|
|
479
|
+
): Promise<string | null>;
|
|
480
|
+
|
|
407
481
|
/**
|
|
408
482
|
* Create a "project" (scoped) Sanity API client.
|
|
409
483
|
*
|
|
@@ -641,6 +715,13 @@ export declare class NonInteractiveError extends CLIError {
|
|
|
641
715
|
constructor(promptName: string);
|
|
642
716
|
}
|
|
643
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Fallback logger used when telemetry has not been initialized.
|
|
720
|
+
* Exported for use in tests only â do not use in plugins or external code.
|
|
721
|
+
* @internal
|
|
722
|
+
*/
|
|
723
|
+
export declare const noopLogger: CLITelemetryStore;
|
|
724
|
+
|
|
644
725
|
/**
|
|
645
726
|
* Normalizes a path for cross-platform comparison by converting backslashes to forward slashes.
|
|
646
727
|
* Useful for converting windows paths to unix paths.
|
|
@@ -685,33 +766,45 @@ export declare type PackageJson = z.infer<typeof packageJsonSchema>;
|
|
|
685
766
|
* đ âšī¸ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE âšī¸đ
|
|
686
767
|
* đ âšī¸ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS âšī¸đ
|
|
687
768
|
*/
|
|
688
|
-
declare const packageJsonSchema: z.
|
|
769
|
+
declare const packageJsonSchema: z.ZodMiniObject<
|
|
689
770
|
{
|
|
690
|
-
name: z.
|
|
691
|
-
version: z.
|
|
692
|
-
dependencies: z.
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
771
|
+
name: z.ZodMiniString<string>;
|
|
772
|
+
version: z.ZodMiniString<string>;
|
|
773
|
+
dependencies: z.ZodMiniOptional<
|
|
774
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
|
|
775
|
+
>;
|
|
776
|
+
devDependencies: z.ZodMiniOptional<
|
|
777
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
|
|
778
|
+
>;
|
|
779
|
+
peerDependencies: z.ZodMiniOptional<
|
|
780
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
|
|
781
|
+
>;
|
|
782
|
+
exports: z.ZodMiniOptional<
|
|
783
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniAny>
|
|
784
|
+
>;
|
|
785
|
+
main: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
786
|
+
types: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
787
|
+
author: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
788
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
789
|
+
engines: z.ZodMiniOptional<
|
|
790
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
|
|
791
|
+
>;
|
|
792
|
+
license: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
793
|
+
private: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
794
|
+
repository: z.ZodMiniOptional<
|
|
795
|
+
z.ZodMiniObject<
|
|
705
796
|
{
|
|
706
|
-
type: z.
|
|
707
|
-
url: z.
|
|
797
|
+
type: z.ZodMiniString<string>;
|
|
798
|
+
url: z.ZodMiniString<string>;
|
|
708
799
|
},
|
|
709
800
|
z.core.$strip
|
|
710
801
|
>
|
|
711
802
|
>;
|
|
712
|
-
scripts: z.
|
|
713
|
-
|
|
714
|
-
|
|
803
|
+
scripts: z.ZodMiniOptional<
|
|
804
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>
|
|
805
|
+
>;
|
|
806
|
+
type: z.ZodMiniOptional<
|
|
807
|
+
z.ZodMiniEnum<{
|
|
715
808
|
module: "module";
|
|
716
809
|
commonjs: "commonjs";
|
|
717
810
|
}>
|
|
@@ -811,36 +904,38 @@ declare interface PromisifyWorkerOptions extends WorkerOptions_2 {
|
|
|
811
904
|
timeout?: number;
|
|
812
905
|
}
|
|
813
906
|
|
|
814
|
-
declare const rawConfigSchema: z.
|
|
907
|
+
declare const rawConfigSchema: z.ZodMiniUnion<
|
|
815
908
|
readonly [
|
|
816
|
-
z.
|
|
817
|
-
z.
|
|
909
|
+
z.ZodMiniArray<
|
|
910
|
+
z.ZodMiniObject<
|
|
818
911
|
{
|
|
819
|
-
basePath: z.
|
|
820
|
-
name: z.
|
|
821
|
-
plugins: z.
|
|
822
|
-
schema: z.
|
|
823
|
-
z.
|
|
912
|
+
basePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
913
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
914
|
+
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
915
|
+
schema: z.ZodMiniOptional<
|
|
916
|
+
z.ZodMiniObject<
|
|
824
917
|
{
|
|
825
|
-
name: z.
|
|
826
|
-
types: z.
|
|
918
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
919
|
+
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
827
920
|
},
|
|
828
921
|
z.core.$loose
|
|
829
922
|
>
|
|
830
923
|
>;
|
|
831
|
-
title: z.
|
|
832
|
-
unstable_sources: z.
|
|
833
|
-
z.
|
|
834
|
-
z.
|
|
924
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
925
|
+
unstable_sources: z.ZodMiniOptional<
|
|
926
|
+
z.ZodMiniArray<
|
|
927
|
+
z.ZodMiniObject<
|
|
835
928
|
{
|
|
836
|
-
dataset: z.
|
|
837
|
-
projectId: z.
|
|
838
|
-
schema: z.
|
|
929
|
+
dataset: z.ZodMiniString<string>;
|
|
930
|
+
projectId: z.ZodMiniString<string>;
|
|
931
|
+
schema: z.ZodMiniObject<
|
|
839
932
|
{
|
|
840
|
-
_original: z.
|
|
933
|
+
_original: z.ZodMiniObject<
|
|
841
934
|
{
|
|
842
|
-
name: z.
|
|
843
|
-
types: z.
|
|
935
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
936
|
+
types: z.ZodMiniArray<
|
|
937
|
+
z.ZodMiniObject<{}, z.core.$loose>
|
|
938
|
+
>;
|
|
844
939
|
},
|
|
845
940
|
z.core.$loose
|
|
846
941
|
>;
|
|
@@ -852,39 +947,41 @@ declare const rawConfigSchema: z.ZodUnion<
|
|
|
852
947
|
>
|
|
853
948
|
>
|
|
854
949
|
>;
|
|
855
|
-
dataset: z.
|
|
856
|
-
projectId: z.
|
|
950
|
+
dataset: z.ZodMiniString<string>;
|
|
951
|
+
projectId: z.ZodMiniString<string>;
|
|
857
952
|
},
|
|
858
953
|
z.core.$loose
|
|
859
954
|
>
|
|
860
955
|
>,
|
|
861
|
-
z.
|
|
956
|
+
z.ZodMiniObject<
|
|
862
957
|
{
|
|
863
|
-
basePath: z.
|
|
864
|
-
name: z.
|
|
865
|
-
plugins: z.
|
|
866
|
-
schema: z.
|
|
867
|
-
z.
|
|
958
|
+
basePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
959
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
960
|
+
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
961
|
+
schema: z.ZodMiniOptional<
|
|
962
|
+
z.ZodMiniObject<
|
|
868
963
|
{
|
|
869
|
-
name: z.
|
|
870
|
-
types: z.
|
|
964
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
965
|
+
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
871
966
|
},
|
|
872
967
|
z.core.$loose
|
|
873
968
|
>
|
|
874
969
|
>;
|
|
875
|
-
title: z.
|
|
876
|
-
unstable_sources: z.
|
|
877
|
-
z.
|
|
878
|
-
z.
|
|
970
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
971
|
+
unstable_sources: z.ZodMiniOptional<
|
|
972
|
+
z.ZodMiniArray<
|
|
973
|
+
z.ZodMiniObject<
|
|
879
974
|
{
|
|
880
|
-
dataset: z.
|
|
881
|
-
projectId: z.
|
|
882
|
-
schema: z.
|
|
975
|
+
dataset: z.ZodMiniString<string>;
|
|
976
|
+
projectId: z.ZodMiniString<string>;
|
|
977
|
+
schema: z.ZodMiniObject<
|
|
883
978
|
{
|
|
884
|
-
_original: z.
|
|
979
|
+
_original: z.ZodMiniObject<
|
|
885
980
|
{
|
|
886
|
-
name: z.
|
|
887
|
-
types: z.
|
|
981
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
982
|
+
types: z.ZodMiniArray<
|
|
983
|
+
z.ZodMiniObject<{}, z.core.$loose>
|
|
984
|
+
>;
|
|
888
985
|
},
|
|
889
986
|
z.core.$loose
|
|
890
987
|
>;
|
|
@@ -896,8 +993,8 @@ declare const rawConfigSchema: z.ZodUnion<
|
|
|
896
993
|
>
|
|
897
994
|
>
|
|
898
995
|
>;
|
|
899
|
-
dataset: z.
|
|
900
|
-
projectId: z.
|
|
996
|
+
dataset: z.ZodMiniString<string>;
|
|
997
|
+
projectId: z.ZodMiniString<string>;
|
|
901
998
|
},
|
|
902
999
|
z.core.$loose
|
|
903
1000
|
>,
|
|
@@ -940,24 +1037,24 @@ export declare interface ReadPackageJsonOptions {
|
|
|
940
1037
|
declare type RequireProps<T, K extends keyof T> = Omit<T, K> &
|
|
941
1038
|
Required<Pick<T, K>>;
|
|
942
1039
|
|
|
943
|
-
declare const resolvedConfigSchema: z.
|
|
944
|
-
z.
|
|
1040
|
+
declare const resolvedConfigSchema: z.ZodMiniArray<
|
|
1041
|
+
z.ZodMiniObject<
|
|
945
1042
|
{
|
|
946
|
-
basePath: z.
|
|
947
|
-
name: z.
|
|
948
|
-
plugins: z.
|
|
949
|
-
title: z.
|
|
950
|
-
unstable_sources: z.
|
|
951
|
-
z.
|
|
1043
|
+
basePath: z.ZodMiniString<string>;
|
|
1044
|
+
name: z.ZodMiniString<string>;
|
|
1045
|
+
plugins: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
1046
|
+
title: z.ZodMiniString<string>;
|
|
1047
|
+
unstable_sources: z.ZodMiniArray<
|
|
1048
|
+
z.ZodMiniObject<
|
|
952
1049
|
{
|
|
953
|
-
dataset: z.
|
|
954
|
-
projectId: z.
|
|
955
|
-
schema: z.
|
|
1050
|
+
dataset: z.ZodMiniString<string>;
|
|
1051
|
+
projectId: z.ZodMiniString<string>;
|
|
1052
|
+
schema: z.ZodMiniObject<
|
|
956
1053
|
{
|
|
957
|
-
_original: z.
|
|
1054
|
+
_original: z.ZodMiniObject<
|
|
958
1055
|
{
|
|
959
|
-
name: z.
|
|
960
|
-
types: z.
|
|
1056
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1057
|
+
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
961
1058
|
},
|
|
962
1059
|
z.core.$loose
|
|
963
1060
|
>;
|
|
@@ -968,14 +1065,14 @@ declare const resolvedConfigSchema: z.ZodArray<
|
|
|
968
1065
|
z.core.$loose
|
|
969
1066
|
>
|
|
970
1067
|
>;
|
|
971
|
-
dataset: z.
|
|
972
|
-
projectId: z.
|
|
973
|
-
schema: z.
|
|
1068
|
+
dataset: z.ZodMiniString<string>;
|
|
1069
|
+
projectId: z.ZodMiniString<string>;
|
|
1070
|
+
schema: z.ZodMiniObject<
|
|
974
1071
|
{
|
|
975
|
-
_original: z.
|
|
1072
|
+
_original: z.ZodMiniObject<
|
|
976
1073
|
{
|
|
977
|
-
name: z.
|
|
978
|
-
types: z.
|
|
1074
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1075
|
+
types: z.ZodMiniArray<z.ZodMiniObject<{}, z.core.$loose>>;
|
|
979
1076
|
},
|
|
980
1077
|
z.core.$loose
|
|
981
1078
|
>;
|
|
@@ -1282,6 +1379,30 @@ declare interface TelemetryBaseInfo {
|
|
|
1282
1379
|
hashedToken: string;
|
|
1283
1380
|
}
|
|
1284
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Note that `sessionId` is removed from the signature of these functions
|
|
1384
|
+
*/
|
|
1385
|
+
declare interface TelemetryLogger<UserProperties> {
|
|
1386
|
+
updateUserProperties(properties: UserProperties): void;
|
|
1387
|
+
resume(events: DeferredEvent[]): void;
|
|
1388
|
+
log<Data>(event: DefinedTelemetryLog<Data>, data: Data): void;
|
|
1389
|
+
log<Data extends void>(event: DefinedTelemetryLog<Data>): void;
|
|
1390
|
+
trace<Data>(
|
|
1391
|
+
event: DefinedTelemetryTrace<Data>,
|
|
1392
|
+
context?: unknown,
|
|
1393
|
+
): TelemetryTrace<UserProperties, Data>;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
declare interface TelemetryTrace<UserProperties, Data> {
|
|
1397
|
+
start(): void;
|
|
1398
|
+
log(data: Data): void;
|
|
1399
|
+
error(error: Error): void;
|
|
1400
|
+
complete(): void;
|
|
1401
|
+
newContext(name: string): TelemetryLogger<UserProperties>;
|
|
1402
|
+
await<P extends Promise<Data>>(promise: P): P;
|
|
1403
|
+
await<P extends Promise<unknown>>(promise: P, finalData: Data): P;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1285
1406
|
/**
|
|
1286
1407
|
* @public
|
|
1287
1408
|
*/
|
package/dist/_exports/index.js
CHANGED
|
@@ -20,8 +20,10 @@ export * from '../services/cliUserConfig.js';
|
|
|
20
20
|
export * from '../services/getCliToken.js';
|
|
21
21
|
export { clearCliTelemetry, CLI_TELEMETRY_SYMBOL, getCliTelemetry, setCliTelemetry } from '../telemetry/getCliTelemetry.js';
|
|
22
22
|
export { getTelemetryBaseInfo } from '../telemetry/getTelemetryBaseInfo.js';
|
|
23
|
+
export { noopLogger } from '../telemetry/noopTelemetry.js';
|
|
23
24
|
export { doImport } from '../util/doImport.js';
|
|
24
25
|
export * from '../util/environment/mockBrowserEnvironment.js';
|
|
26
|
+
export * from '../util/getLocalPackageVersion.js';
|
|
25
27
|
export * from '../util/getSanityEnvVar.js';
|
|
26
28
|
export * from '../util/getSanityUrl.js';
|
|
27
29
|
export * from '../util/importModule.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export * from '../config/cli/getCliConfig.js'\nexport * from '../config/cli/getCliConfigSync.js'\nexport {type CliConfig} from '../config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from '../config/cli/types/userViteConfig.js'\nexport * from '../config/findProjectRoot.js'\nexport * from '../config/findProjectRootSync.js'\nexport * from '../config/studio/getStudioConfig.js'\nexport * from '../config/studio/getStudioWorkspaces.js'\nexport * from '../config/studio/isStudioConfig.js'\nexport * from '../config/util/findConfigsPaths.js'\nexport * from '../config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from '../config/util/recursivelyResolveProjectRoot.js'\nexport * from '../debug.js'\nexport * from '../errors/NonInteractiveError.js'\nexport * from '../errors/NotFoundError.js'\nexport * from '../errors/ProjectRootNotFoundError.js'\nexport * from '../exitCodes.js'\nexport * from '../loaders/studio/studioWorkerTask.js'\nexport * from '../loaders/tsx/tsxWorkerTask.js'\nexport * from '../SanityCommand.js'\nexport * from '../services/apiClient.js'\nexport * from '../services/cliUserConfig.js'\nexport * from '../services/getCliToken.js'\nexport {\n clearCliTelemetry,\n CLI_TELEMETRY_SYMBOL,\n getCliTelemetry,\n setCliTelemetry,\n} from '../telemetry/getCliTelemetry.js'\nexport {getTelemetryBaseInfo} from '../telemetry/getTelemetryBaseInfo.js'\nexport {\n type CLITelemetryStore,\n type ConsentInformation,\n type TelemetryUserProperties,\n} from '../telemetry/types.js'\nexport {type Output, type SanityOrgUser} from '../types.js'\nexport {doImport} from '../util/doImport.js'\nexport * from '../util/environment/mockBrowserEnvironment.js'\nexport * from '../util/getSanityEnvVar.js'\nexport * from '../util/getSanityUrl.js'\nexport * from '../util/importModule.js'\nexport * from '../util/isCi.js'\nexport * from '../util/isInteractive.js'\nexport * from '../util/isStaging.js'\nexport * from '../util/normalizePath.js'\nexport * from '../util/promisifyWorker.js'\nexport * from '../util/readPackageJson.js'\nexport * from '../util/resolveLocalPackage.js'\nexport * from '../util/safeStructuredClone.js'\nexport * from '../ux/colorizeJson.js'\nexport * from '../ux/timer.js'\n"],"names":["clearCliTelemetry","CLI_TELEMETRY_SYMBOL","getCliTelemetry","setCliTelemetry","getTelemetryBaseInfo","doImport"],"mappings":"AAAA,cAAc,gCAA+B;AAC7C,cAAc,oCAAmC;AAGjD,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,cAAc,sCAAqC;AACnD,cAAc,0CAAyC;AACvD,cAAc,qCAAoC;AAClD,cAAc,qCAAoC;AAClD,cAAc,yCAAwC;AAEtD,cAAc,cAAa;AAC3B,cAAc,mCAAkC;AAChD,cAAc,6BAA4B;AAC1C,cAAc,wCAAuC;AACrD,cAAc,kBAAiB;AAC/B,cAAc,wCAAuC;AACrD,cAAc,kCAAiC;AAC/C,cAAc,sBAAqB;AACnC,cAAc,2BAA0B;AACxC,cAAc,+BAA8B;AAC5C,cAAc,6BAA4B;AAC1C,SACEA,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,eAAe,QACV,kCAAiC;AACxC,SAAQC,oBAAoB,QAAO,uCAAsC;
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export * from '../config/cli/getCliConfig.js'\nexport * from '../config/cli/getCliConfigSync.js'\nexport {type CliConfig} from '../config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from '../config/cli/types/userViteConfig.js'\nexport * from '../config/findProjectRoot.js'\nexport * from '../config/findProjectRootSync.js'\nexport * from '../config/studio/getStudioConfig.js'\nexport * from '../config/studio/getStudioWorkspaces.js'\nexport * from '../config/studio/isStudioConfig.js'\nexport * from '../config/util/findConfigsPaths.js'\nexport * from '../config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from '../config/util/recursivelyResolveProjectRoot.js'\nexport * from '../debug.js'\nexport * from '../errors/NonInteractiveError.js'\nexport * from '../errors/NotFoundError.js'\nexport * from '../errors/ProjectRootNotFoundError.js'\nexport * from '../exitCodes.js'\nexport * from '../loaders/studio/studioWorkerTask.js'\nexport * from '../loaders/tsx/tsxWorkerTask.js'\nexport * from '../SanityCommand.js'\nexport * from '../services/apiClient.js'\nexport * from '../services/cliUserConfig.js'\nexport * from '../services/getCliToken.js'\nexport {\n clearCliTelemetry,\n CLI_TELEMETRY_SYMBOL,\n getCliTelemetry,\n setCliTelemetry,\n} from '../telemetry/getCliTelemetry.js'\nexport {getTelemetryBaseInfo} from '../telemetry/getTelemetryBaseInfo.js'\nexport {noopLogger} from '../telemetry/noopTelemetry.js'\nexport {\n type CLITelemetryStore,\n type ConsentInformation,\n type TelemetryUserProperties,\n} from '../telemetry/types.js'\nexport {type Output, type SanityOrgUser} from '../types.js'\nexport {doImport} from '../util/doImport.js'\nexport * from '../util/environment/mockBrowserEnvironment.js'\nexport * from '../util/getLocalPackageVersion.js'\nexport * from '../util/getSanityEnvVar.js'\nexport * from '../util/getSanityUrl.js'\nexport * from '../util/importModule.js'\nexport * from '../util/isCi.js'\nexport * from '../util/isInteractive.js'\nexport * from '../util/isStaging.js'\nexport * from '../util/normalizePath.js'\nexport * from '../util/promisifyWorker.js'\nexport * from '../util/readPackageJson.js'\nexport * from '../util/resolveLocalPackage.js'\nexport * from '../util/safeStructuredClone.js'\nexport * from '../ux/colorizeJson.js'\nexport * from '../ux/timer.js'\n"],"names":["clearCliTelemetry","CLI_TELEMETRY_SYMBOL","getCliTelemetry","setCliTelemetry","getTelemetryBaseInfo","noopLogger","doImport"],"mappings":"AAAA,cAAc,gCAA+B;AAC7C,cAAc,oCAAmC;AAGjD,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,cAAc,sCAAqC;AACnD,cAAc,0CAAyC;AACvD,cAAc,qCAAoC;AAClD,cAAc,qCAAoC;AAClD,cAAc,yCAAwC;AAEtD,cAAc,cAAa;AAC3B,cAAc,mCAAkC;AAChD,cAAc,6BAA4B;AAC1C,cAAc,wCAAuC;AACrD,cAAc,kBAAiB;AAC/B,cAAc,wCAAuC;AACrD,cAAc,kCAAiC;AAC/C,cAAc,sBAAqB;AACnC,cAAc,2BAA0B;AACxC,cAAc,+BAA8B;AAC5C,cAAc,6BAA4B;AAC1C,SACEA,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,eAAe,QACV,kCAAiC;AACxC,SAAQC,oBAAoB,QAAO,uCAAsC;AACzE,SAAQC,UAAU,QAAO,gCAA+B;AAOxD,SAAQC,QAAQ,QAAO,sBAAqB;AAC5C,cAAc,gDAA+C;AAC7D,cAAc,oCAAmC;AACjD,cAAc,6BAA4B;AAC1C,cAAc,0BAAyB;AACvC,cAAc,0BAAyB;AACvC,cAAc,kBAAiB;AAC/B,cAAc,2BAA0B;AACxC,cAAc,uBAAsB;AACpC,cAAc,2BAA0B;AACxC,cAAc,6BAA4B;AAC1C,cAAc,6BAA4B;AAC1C,cAAc,iCAAgC;AAC9C,cAAc,iCAAgC;AAC9C,cAAc,wBAAuB;AACrC,cAAc,iBAAgB"}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
*/ export const cliConfigSchema = z.object({
|
|
5
|
-
api: z.object({
|
|
6
|
-
dataset: z.
|
|
7
|
-
projectId: z.
|
|
8
|
-
})
|
|
9
|
-
app: z.object({
|
|
10
|
-
entry: z.
|
|
11
|
-
icon: z.
|
|
12
|
-
id: z.
|
|
13
|
-
organizationId: z.
|
|
14
|
-
title: z.
|
|
15
|
-
})
|
|
16
|
-
autoUpdates: z.
|
|
17
|
-
deployment: z.object({
|
|
18
|
-
appId: z.
|
|
19
|
-
autoUpdates: z.
|
|
20
|
-
})
|
|
21
|
-
graphql: z.array(z.object({
|
|
22
|
-
filterSuffix: z.
|
|
23
|
-
generation: z.enum([
|
|
5
|
+
api: z.optional(z.object({
|
|
6
|
+
dataset: z.optional(z.string()),
|
|
7
|
+
projectId: z.optional(z.string())
|
|
8
|
+
})),
|
|
9
|
+
app: z.optional(z.object({
|
|
10
|
+
entry: z.optional(z.string()),
|
|
11
|
+
icon: z.optional(z.string()),
|
|
12
|
+
id: z.optional(z.string()),
|
|
13
|
+
organizationId: z.optional(z.string()),
|
|
14
|
+
title: z.optional(z.string())
|
|
15
|
+
})),
|
|
16
|
+
autoUpdates: z.optional(z.boolean()),
|
|
17
|
+
deployment: z.optional(z.object({
|
|
18
|
+
appId: z.optional(z.string()),
|
|
19
|
+
autoUpdates: z.optional(z.boolean())
|
|
20
|
+
})),
|
|
21
|
+
graphql: z.optional(z.array(z.object({
|
|
22
|
+
filterSuffix: z.optional(z.string()),
|
|
23
|
+
generation: z.optional(z.enum([
|
|
24
24
|
'gen1',
|
|
25
25
|
'gen2',
|
|
26
26
|
'gen3'
|
|
27
|
-
])
|
|
28
|
-
id: z.
|
|
29
|
-
nonNullDocumentFields: z.
|
|
30
|
-
playground: z.
|
|
31
|
-
source: z.
|
|
32
|
-
tag: z.
|
|
33
|
-
workspace: z.
|
|
34
|
-
}))
|
|
35
|
-
mediaLibrary: z.object({
|
|
36
|
-
aspectsPath: z.
|
|
37
|
-
})
|
|
38
|
-
project: z.object({
|
|
39
|
-
basePath: z.
|
|
40
|
-
})
|
|
41
|
-
reactCompiler: z.
|
|
42
|
-
reactStrictMode: z.
|
|
43
|
-
schemaExtraction: z.object({
|
|
44
|
-
enabled: z.
|
|
45
|
-
enforceRequiredFields: z.
|
|
46
|
-
path: z.
|
|
47
|
-
watchPatterns: z.array(z.string())
|
|
48
|
-
workspace: z.
|
|
49
|
-
})
|
|
50
|
-
server: z.object({
|
|
51
|
-
hostname: z.
|
|
52
|
-
port: z.
|
|
53
|
-
})
|
|
54
|
-
studioHost: z.
|
|
55
|
-
vite: z.
|
|
56
|
-
typegen: z.
|
|
27
|
+
])),
|
|
28
|
+
id: z.optional(z.string()),
|
|
29
|
+
nonNullDocumentFields: z.optional(z.boolean()),
|
|
30
|
+
playground: z.optional(z.boolean()),
|
|
31
|
+
source: z.optional(z.string()),
|
|
32
|
+
tag: z.optional(z.string()),
|
|
33
|
+
workspace: z.optional(z.string())
|
|
34
|
+
}))),
|
|
35
|
+
mediaLibrary: z.optional(z.object({
|
|
36
|
+
aspectsPath: z.optional(z.string())
|
|
37
|
+
})),
|
|
38
|
+
project: z.optional(z.object({
|
|
39
|
+
basePath: z.optional(z.string())
|
|
40
|
+
})),
|
|
41
|
+
reactCompiler: z.optional(z.custom()),
|
|
42
|
+
reactStrictMode: z.optional(z.boolean()),
|
|
43
|
+
schemaExtraction: z.optional(z.object({
|
|
44
|
+
enabled: z.optional(z.boolean()),
|
|
45
|
+
enforceRequiredFields: z.optional(z.boolean()),
|
|
46
|
+
path: z.optional(z.string()),
|
|
47
|
+
watchPatterns: z.optional(z.array(z.string())),
|
|
48
|
+
workspace: z.optional(z.string())
|
|
49
|
+
})),
|
|
50
|
+
server: z.optional(z.object({
|
|
51
|
+
hostname: z.optional(z.string()),
|
|
52
|
+
port: z.optional(z.number())
|
|
53
|
+
})),
|
|
54
|
+
studioHost: z.optional(z.string()),
|
|
55
|
+
vite: z.optional(z.custom()),
|
|
56
|
+
typegen: z.optional(z.custom())
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\nimport {z} from 'zod'\n\nimport {type CliConfig, type TypeGenConfig} from './types/cliConfig'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z\n .object({\n dataset: z.
|
|
1
|
+
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\nimport {z} from 'zod/mini'\n\nimport {type CliConfig, type TypeGenConfig} from './types/cliConfig'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z.optional(\n z.object({\n dataset: z.optional(z.string()),\n projectId: z.optional(z.string()),\n }),\n ),\n\n app: z.optional(\n z.object({\n entry: z.optional(z.string()),\n icon: z.optional(z.string()),\n id: z.optional(z.string()),\n organizationId: z.optional(z.string()),\n title: z.optional(z.string()),\n }),\n ),\n\n autoUpdates: z.optional(z.boolean()),\n\n deployment: z.optional(\n z.object({\n appId: z.optional(z.string()),\n autoUpdates: z.optional(z.boolean()),\n }),\n ),\n\n graphql: z.optional(\n z.array(\n z.object({\n filterSuffix: z.optional(z.string()),\n generation: z.optional(z.enum(['gen1', 'gen2', 'gen3'])),\n id: z.optional(z.string()),\n nonNullDocumentFields: z.optional(z.boolean()),\n playground: z.optional(z.boolean()),\n source: z.optional(z.string()),\n tag: z.optional(z.string()),\n workspace: z.optional(z.string()),\n }),\n ),\n ),\n\n mediaLibrary: z.optional(\n z.object({\n aspectsPath: z.optional(z.string()),\n }),\n ),\n\n project: z.optional(\n z.object({\n basePath: z.optional(z.string()),\n }),\n ),\n\n reactCompiler: z.optional(z.custom<ReactCompilerConfig>()),\n\n reactStrictMode: z.optional(z.boolean()),\n\n schemaExtraction: z.optional(\n z.object({\n enabled: z.optional(z.boolean()),\n enforceRequiredFields: z.optional(z.boolean()),\n path: z.optional(z.string()),\n watchPatterns: z.optional(z.array(z.string())),\n workspace: z.optional(z.string()),\n }),\n ),\n\n server: z.optional(\n z.object({\n hostname: z.optional(z.string()),\n port: z.optional(z.number()),\n }),\n ),\n\n studioHost: z.optional(z.string()),\n\n vite: z.optional(z.custom<UserViteConfig>()),\n\n typegen: z.optional(z.custom<Partial<TypeGenConfig> & {enabled?: boolean}>()),\n}) satisfies z.core.$ZodType<CliConfig>\n"],"names":["z","cliConfigSchema","object","api","optional","dataset","string","projectId","app","entry","icon","id","organizationId","title","autoUpdates","boolean","deployment","appId","graphql","array","filterSuffix","generation","enum","nonNullDocumentFields","playground","source","tag","workspace","mediaLibrary","aspectsPath","project","basePath","reactCompiler","custom","reactStrictMode","schemaExtraction","enabled","enforceRequiredFields","path","watchPatterns","server","hostname","port","number","studioHost","vite","typegen"],"mappings":"AACA,SAAQA,CAAC,QAAO,WAAU;AAK1B;;CAEC,GACD,OAAO,MAAMC,kBAAkBD,EAAEE,MAAM,CAAC;IACtCC,KAAKH,EAAEI,QAAQ,CACbJ,EAAEE,MAAM,CAAC;QACPG,SAASL,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QAC5BC,WAAWP,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAChC;IAGFE,KAAKR,EAAEI,QAAQ,CACbJ,EAAEE,MAAM,CAAC;QACPO,OAAOT,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QAC1BI,MAAMV,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACzBK,IAAIX,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACvBM,gBAAgBZ,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACnCO,OAAOb,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAC5B;IAGFQ,aAAad,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;IAEjCC,YAAYhB,EAAEI,QAAQ,CACpBJ,EAAEE,MAAM,CAAC;QACPe,OAAOjB,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QAC1BQ,aAAad,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;IACnC;IAGFG,SAASlB,EAAEI,QAAQ,CACjBJ,EAAEmB,KAAK,CACLnB,EAAEE,MAAM,CAAC;QACPkB,cAAcpB,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACjCe,YAAYrB,EAAEI,QAAQ,CAACJ,EAAEsB,IAAI,CAAC;YAAC;YAAQ;YAAQ;SAAO;QACtDX,IAAIX,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACvBiB,uBAAuBvB,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;QAC3CS,YAAYxB,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;QAChCU,QAAQzB,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QAC3BoB,KAAK1B,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACxBqB,WAAW3B,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAChC;IAIJsB,cAAc5B,EAAEI,QAAQ,CACtBJ,EAAEE,MAAM,CAAC;QACP2B,aAAa7B,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAClC;IAGFwB,SAAS9B,EAAEI,QAAQ,CACjBJ,EAAEE,MAAM,CAAC;QACP6B,UAAU/B,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAC/B;IAGF0B,eAAehC,EAAEI,QAAQ,CAACJ,EAAEiC,MAAM;IAElCC,iBAAiBlC,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;IAErCoB,kBAAkBnC,EAAEI,QAAQ,CAC1BJ,EAAEE,MAAM,CAAC;QACPkC,SAASpC,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;QAC7BsB,uBAAuBrC,EAAEI,QAAQ,CAACJ,EAAEe,OAAO;QAC3CuB,MAAMtC,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QACzBiC,eAAevC,EAAEI,QAAQ,CAACJ,EAAEmB,KAAK,CAACnB,EAAEM,MAAM;QAC1CqB,WAAW3B,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAChC;IAGFkC,QAAQxC,EAAEI,QAAQ,CAChBJ,EAAEE,MAAM,CAAC;QACPuC,UAAUzC,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;QAC7BoC,MAAM1C,EAAEI,QAAQ,CAACJ,EAAE2C,MAAM;IAC3B;IAGFC,YAAY5C,EAAEI,QAAQ,CAACJ,EAAEM,MAAM;IAE/BuC,MAAM7C,EAAEI,QAAQ,CAACJ,EAAEiC,MAAM;IAEzBa,SAAS9C,EAAEI,QAAQ,CAACJ,EAAEiC,MAAM;AAC9B,GAAuC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/mini';
|
|
3
3
|
import { studioWorkerTask } from '../../loaders/studio/studioWorkerTask.js';
|
|
4
4
|
const schemaSchema = z.looseObject({
|
|
5
|
-
name: z.
|
|
5
|
+
name: z.optional(z.string()),
|
|
6
6
|
types: z.array(z.looseObject({}))
|
|
7
7
|
});
|
|
8
8
|
const sourceSchema = z.looseObject({
|
|
@@ -15,19 +15,19 @@ const sourceSchema = z.looseObject({
|
|
|
15
15
|
// Raw workspace schema (resolvePlugins: false) - unstable_sources not yet populated
|
|
16
16
|
const rawWorkspaceSchema = z.looseObject({
|
|
17
17
|
...sourceSchema.shape,
|
|
18
|
-
basePath: z.
|
|
19
|
-
name: z.
|
|
20
|
-
plugins: z.array(z.unknown())
|
|
21
|
-
schema:
|
|
22
|
-
title: z.
|
|
23
|
-
unstable_sources: z.array(sourceSchema)
|
|
18
|
+
basePath: z.optional(z.string()),
|
|
19
|
+
name: z.optional(z.string()),
|
|
20
|
+
plugins: z.optional(z.array(z.unknown())),
|
|
21
|
+
schema: z.optional(schemaSchema),
|
|
22
|
+
title: z.optional(z.string()),
|
|
23
|
+
unstable_sources: z.optional(z.array(sourceSchema))
|
|
24
24
|
});
|
|
25
25
|
// Resolved config schema (resolvePlugins: true) - all fields required
|
|
26
26
|
const resolvedWorkspaceSchema = z.looseObject({
|
|
27
27
|
...sourceSchema.shape,
|
|
28
28
|
basePath: z.string(),
|
|
29
29
|
name: z.string(),
|
|
30
|
-
plugins: z.array(z.unknown())
|
|
30
|
+
plugins: z.optional(z.array(z.unknown())),
|
|
31
31
|
title: z.string(),
|
|
32
32
|
unstable_sources: z.array(sourceSchema)
|
|
33
33
|
});
|
|
@@ -48,8 +48,8 @@ export async function readStudioConfig(configPath, options) {
|
|
|
48
48
|
try {
|
|
49
49
|
return options.resolvePlugins ? resolvedConfigSchema.parse(result) : rawConfigSchema.parse(result);
|
|
50
50
|
} catch (err) {
|
|
51
|
-
if (err instanceof z.ZodError) {
|
|
52
|
-
throw new
|
|
51
|
+
if (err instanceof z.core.$ZodError) {
|
|
52
|
+
throw new TypeError(`Invalid studio config at ${configPath}:\n${formatZodIssues(err.issues)}`, {
|
|
53
53
|
cause: err
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/studio/readStudioConfig.ts"],"sourcesContent":["import {dirname} from 'node:path'\n\nimport {z} from 'zod'\n\nimport {studioWorkerTask} from '../../loaders/studio/studioWorkerTask.js'\n\nconst schemaSchema = z.looseObject({\n name: z.
|
|
1
|
+
{"version":3,"sources":["../../../src/config/studio/readStudioConfig.ts"],"sourcesContent":["import {dirname} from 'node:path'\n\nimport {z} from 'zod/mini'\n\nimport {studioWorkerTask} from '../../loaders/studio/studioWorkerTask.js'\n\nconst schemaSchema = z.looseObject({\n name: z.optional(z.string()),\n types: z.array(z.looseObject({})),\n})\n\nconst sourceSchema = z.looseObject({\n dataset: z.string(),\n projectId: z.string(),\n schema: z.looseObject({_original: schemaSchema}),\n})\n\n// Raw workspace schema (resolvePlugins: false) - unstable_sources not yet populated\nconst rawWorkspaceSchema = z.looseObject({\n ...sourceSchema.shape,\n basePath: z.optional(z.string()),\n name: z.optional(z.string()),\n plugins: z.optional(z.array(z.unknown())),\n schema: z.optional(schemaSchema),\n title: z.optional(z.string()),\n unstable_sources: z.optional(z.array(sourceSchema)),\n})\n\n// Resolved config schema (resolvePlugins: true) - all fields required\nconst resolvedWorkspaceSchema = z.looseObject({\n ...sourceSchema.shape,\n basePath: z.string(),\n name: z.string(),\n plugins: z.optional(z.array(z.unknown())),\n title: z.string(),\n unstable_sources: z.array(sourceSchema),\n})\n\nconst rawConfigSchema = z.union([z.array(rawWorkspaceSchema), rawWorkspaceSchema])\nconst resolvedConfigSchema = z.array(resolvedWorkspaceSchema)\n\nexport type RawStudioConfig = z.infer<typeof rawConfigSchema>\nexport type ResolvedStudioConfig = z.infer<typeof resolvedConfigSchema>\n\nexport interface ReadStudioConfigOptions {\n /**\n * Whether or not to resolve the plugins defined in the config.\n *\n * In some cases, you need this in order to have the full picture of what the studio\n * would \"see\". As an example, plugins can define schema types that are not explicitly\n * defined in the users' schema types. In order to get the full picture, you need to\n * resolve the plugins, which is an asyncronous operation.\n *\n * In other cases, it might be enough to only do a shallow pass. As an example, if you\n * only need to know about the defined workspace, or the user-defined schema types,\n * this can be set to `false` - which should resolve faster (and potentially \"safer\")\n * in terms of not triggering all kinds of browser behavior that may or may not be\n * loaded as the plugins are resolved.\n */\n resolvePlugins: boolean\n}\n\nexport async function readStudioConfig(\n configPath: string,\n options: {resolvePlugins: true},\n): Promise<ResolvedStudioConfig>\n\nexport async function readStudioConfig(\n configPath: string,\n options: {resolvePlugins: false},\n): Promise<RawStudioConfig>\n\nexport async function readStudioConfig(\n configPath: string,\n options: ReadStudioConfigOptions,\n): Promise<RawStudioConfig | ResolvedStudioConfig> {\n const result = await studioWorkerTask(new URL('readStudioConfig.worker.js', import.meta.url), {\n name: 'studioConfig',\n studioRootPath: dirname(configPath),\n workerData: {configPath, resolvePlugins: options.resolvePlugins},\n })\n\n try {\n return options.resolvePlugins\n ? resolvedConfigSchema.parse(result)\n : rawConfigSchema.parse(result)\n } catch (err) {\n if (err instanceof z.core.$ZodError) {\n throw new TypeError(\n `Invalid studio config at ${configPath}:\\n${formatZodIssues(err.issues)}`,\n {\n cause: err,\n },\n )\n }\n\n throw err\n }\n}\n\n/**\n * Recursively extracts leaf-level messages from Zod issues, including\n * those nested inside union errors. Note that `prettifyError` from Zod\n * only gives a high-level summary for union errors, so this function is\n * needed to get the full details of all validation issues in a readable format.\n *\n * @internal exported for testing only\n */\nexport function formatZodIssues(issues: z.core.$ZodIssue[], indent = 2): string {\n const lines: string[] = []\n const prefix = ' '.repeat(indent)\n\n for (const issue of issues) {\n if (issue.code === 'invalid_union' && 'errors' in issue && Array.isArray(issue.errors)) {\n for (const [i, unionIssues] of issue.errors.entries()) {\n lines.push(`${prefix}Union option ${i + 1}:`, formatZodIssues(unionIssues, indent + 2))\n }\n } else {\n const path = issue.path.length > 0 ? ` at \"${issue.path.join('.')}\"` : ''\n lines.push(`${prefix}- ${issue.message}${path}`)\n }\n }\n\n return lines.join('\\n')\n}\n"],"names":["dirname","z","studioWorkerTask","schemaSchema","looseObject","name","optional","string","types","array","sourceSchema","dataset","projectId","schema","_original","rawWorkspaceSchema","shape","basePath","plugins","unknown","title","unstable_sources","resolvedWorkspaceSchema","rawConfigSchema","union","resolvedConfigSchema","readStudioConfig","configPath","options","result","URL","url","studioRootPath","workerData","resolvePlugins","parse","err","core","$ZodError","TypeError","formatZodIssues","issues","cause","indent","lines","prefix","repeat","issue","code","Array","isArray","errors","i","unionIssues","entries","push","path","length","join","message"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isMainThread, parentPort, workerData } from 'node:worker_threads';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/mini';
|
|
3
3
|
import { subdebug } from '../../debug.js';
|
|
4
4
|
import { doImport } from '../../util/doImport.js';
|
|
5
5
|
import { safeStructuredClone } from '../../util/safeStructuredClone.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/studio/readStudioConfig.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {z} from 'zod'\n\nimport {subdebug} from '../../debug.js'\nimport {doImport} from '../../util/doImport.js'\nimport {safeStructuredClone} from '../../util/safeStructuredClone.js'\nimport {getStudioWorkspaces} from './getStudioWorkspaces.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst debug = subdebug('readStudioConfig.worker')\n\nconst {configPath, resolvePlugins} = z\n .object({configPath: z.string(), resolvePlugins: z.boolean()})\n .parse(workerData)\n\ndebug('Parsing config path %s', configPath)\n\nlet {default: config} = await doImport(configPath)\n\ndebug('Imported config %o', config)\n\nif (resolvePlugins) {\n debug('Resolving workspaces')\n config = await getStudioWorkspaces(configPath)\n debug('Resolved workspaces %o', config)\n}\n\nparentPort.postMessage(safeStructuredClone(config))\n"],"names":["isMainThread","parentPort","workerData","z","subdebug","doImport","safeStructuredClone","getStudioWorkspaces","Error","debug","configPath","resolvePlugins","object","string","boolean","parse","default","config","postMessage"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,CAAC,QAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/config/studio/readStudioConfig.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {z} from 'zod/mini'\n\nimport {subdebug} from '../../debug.js'\nimport {doImport} from '../../util/doImport.js'\nimport {safeStructuredClone} from '../../util/safeStructuredClone.js'\nimport {getStudioWorkspaces} from './getStudioWorkspaces.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst debug = subdebug('readStudioConfig.worker')\n\nconst {configPath, resolvePlugins} = z\n .object({configPath: z.string(), resolvePlugins: z.boolean()})\n .parse(workerData)\n\ndebug('Parsing config path %s', configPath)\n\nlet {default: config} = await doImport(configPath)\n\ndebug('Imported config %o', config)\n\nif (resolvePlugins) {\n debug('Resolving workspaces')\n config = await getStudioWorkspaces(configPath)\n debug('Resolved workspaces %o', config)\n}\n\nparentPort.postMessage(safeStructuredClone(config))\n"],"names":["isMainThread","parentPort","workerData","z","subdebug","doImport","safeStructuredClone","getStudioWorkspaces","Error","debug","configPath","resolvePlugins","object","string","boolean","parse","default","config","postMessage"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,CAAC,QAAO,WAAU;AAE1B,SAAQC,QAAQ,QAAO,iBAAgB;AACvC,SAAQC,QAAQ,QAAO,yBAAwB;AAC/C,SAAQC,mBAAmB,QAAO,oCAAmC;AACrE,SAAQC,mBAAmB,QAAO,2BAA0B;AAE5D,IAAIP,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAIO,MAAM;AAClB;AAEA,MAAMC,QAAQL,SAAS;AAEvB,MAAM,EAACM,UAAU,EAAEC,cAAc,EAAC,GAAGR,EAClCS,MAAM,CAAC;IAACF,YAAYP,EAAEU,MAAM;IAAIF,gBAAgBR,EAAEW,OAAO;AAAE,GAC3DC,KAAK,CAACb;AAETO,MAAM,0BAA0BC;AAEhC,IAAI,EAACM,SAASC,MAAM,EAAC,GAAG,MAAMZ,SAASK;AAEvCD,MAAM,sBAAsBQ;AAE5B,IAAIN,gBAAgB;IAClBF,MAAM;IACNQ,SAAS,MAAMV,oBAAoBG;IACnCD,MAAM,0BAA0BQ;AAClC;AAEAhB,WAAWiB,WAAW,CAACZ,oBAAoBW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { styleText } from 'node:util';
|
|
2
2
|
import { createClient, requester as defaultRequester, isHttpError } from '@sanity/client';
|
|
3
3
|
import { generateHelpUrl } from '../util/generateHelpUrl.js';
|
|
4
4
|
import { getCliToken } from './getCliToken.js';
|
|
@@ -84,7 +84,7 @@ const CLI_REQUEST_TAG_PREFIX = 'sanity.cli';
|
|
|
84
84
|
}
|
|
85
85
|
const statusCode = isHttpError(err) && err.response.body.statusCode;
|
|
86
86
|
if (statusCode === 401) {
|
|
87
|
-
err.message = `${err.message}. You may need to login again with ${
|
|
87
|
+
err.message = `${err.message}. You may need to login again with ${styleText('cyan', 'sanity login')}.\nFor more information, see ${generateHelpUrl('cli-errors')}.`;
|
|
88
88
|
}
|
|
89
89
|
return err;
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/apiClient.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/services/apiClient.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {\n type ClientConfig,\n type ClientError,\n createClient,\n requester as defaultRequester,\n isHttpError,\n type SanityClient,\n type ServerError,\n} from '@sanity/client'\n\nimport {generateHelpUrl} from '../util/generateHelpUrl.js'\nimport {getCliToken} from './getCliToken.js'\n\nconst apiHosts: Record<string, string | undefined> = {\n staging: 'https://api.sanity.work',\n}\n\nconst CLI_REQUEST_TAG_PREFIX = 'sanity.cli'\n\n/**\n * @public\n */\nexport interface GlobalCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n\n /**\n * Whether to skip reading the stored CLI token. When `true`, the client will\n * have no token unless one is explicitly provided.\n * Default: `false`.\n */\n unauthenticated?: boolean\n}\n\n/**\n * Create a \"global\" (unscoped) Sanity API client.\n *\n * @public\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getGlobalCliClient({\n requireUser,\n token: providedToken,\n unauthenticated,\n ...config\n}: GlobalCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n // Use the provided token if set, otherwise fall back to the stored CLI token (unless unauthenticated)\n const token = providedToken || (unauthenticated ? undefined : await getCliToken())\n\n // If the token is not set and requireUser is true, throw an error\n if (!token && requireUser) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n // Suppress browser token warning since we mock browser environment in workers\n ignoreBrowserTokenWarning: true,\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: false,\n ...config,\n })\n}\n\n/**\n * @public\n */\nexport interface ProjectCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * The project ID to use for this client.\n */\n projectId: string\n\n /**\n * The dataset to use for this client.\n */\n dataset?: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n}\n\n/**\n * Create a \"project\" (scoped) Sanity API client.\n *\n * @public\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getProjectCliClient({\n requireUser,\n token: providedToken,\n ...config\n}: ProjectCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n // Use the provided token if it is set, otherwise get the token from the config file\n const token = providedToken || (await getCliToken())\n\n // If the token is not set and requireUser is true, throw an error\n if (!token && requireUser) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n // Suppress browser token warning since we mock browser environment in workers\n ignoreBrowserTokenWarning: true,\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: true,\n ...config,\n })\n}\n\n/**\n * `get-it` middleware that checks for 401 authentication errors and extends the error with more\n * helpful guidance on what to do next.\n *\n * @returns get-it middleware with `onError` handler\n * @internal\n */\nfunction authErrors() {\n return {\n onError: (err: Error | null) => {\n if (!err || !isReqResError(err)) {\n return err\n }\n\n const statusCode = isHttpError(err) && err.response.body.statusCode\n if (statusCode === 401) {\n err.message = `${err.message}. You may need to login again with ${styleText('cyan', 'sanity login')}.\\nFor more information, see ${generateHelpUrl('cli-errors')}.`\n }\n\n return err\n },\n }\n}\n\nfunction isReqResError(err: Error): err is ClientError | ServerError {\n return Object.prototype.hasOwnProperty.call(err, 'response')\n}\n"],"names":["styleText","createClient","requester","defaultRequester","isHttpError","generateHelpUrl","getCliToken","apiHosts","staging","CLI_REQUEST_TAG_PREFIX","getGlobalCliClient","requireUser","token","providedToken","unauthenticated","config","clone","use","authErrors","sanityEnv","process","env","SANITY_INTERNAL_ENV","apiHost","undefined","Error","ignoreBrowserTokenWarning","requestTagPrefix","useCdn","useProjectHostname","getProjectCliClient","onError","err","isReqResError","statusCode","response","body","message","Object","prototype","hasOwnProperty","call"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,SAGEC,YAAY,EACZC,aAAaC,gBAAgB,EAC7BC,WAAW,QAGN,iBAAgB;AAEvB,SAAQC,eAAe,QAAO,6BAA4B;AAC1D,SAAQC,WAAW,QAAO,mBAAkB;AAE5C,MAAMC,WAA+C;IACnDC,SAAS;AACX;AAEA,MAAMC,yBAAyB;AA0B/B;;;;;;;CAOC,GACD,OAAO,eAAeC,mBAAmB,EACvCC,WAAW,EACXC,OAAOC,aAAa,EACpBC,eAAe,EACf,GAAGC,QACoB;IACvB,MAAMb,YAAYC,iBAAiBa,KAAK;IACxCd,UAAUe,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUhB,QAAQ,CAACY,UAAU;IAEnC,sGAAsG;IACtG,MAAMP,QAAQC,iBAAkBC,CAAAA,kBAAkBU,YAAY,MAAMlB,aAAY;IAEhF,kEAAkE;IAClE,IAAI,CAACM,SAASD,aAAa;QACzB,MAAM,IAAIc,MAAM;IAClB;IAEA,OAAOxB,aAAa;QAClB,GAAIsB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5B,8EAA8E;QAC9EG,2BAA2B;QAC3BxB;QACAyB,kBAAkBlB;QAClBG;QACAgB,QAAQ;QACRC,oBAAoB;QACpB,GAAGd,MAAM;IACX;AACF;AA6BA;;;;;;;CAOC,GACD,OAAO,eAAee,oBAAoB,EACxCnB,WAAW,EACXC,OAAOC,aAAa,EACpB,GAAGE,QACqB;IACxB,MAAMb,YAAYC,iBAAiBa,KAAK;IACxCd,UAAUe,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUhB,QAAQ,CAACY,UAAU;IAEnC,oFAAoF;IACpF,MAAMP,QAAQC,iBAAkB,MAAMP;IAEtC,kEAAkE;IAClE,IAAI,CAACM,SAASD,aAAa;QACzB,MAAM,IAAIc,MAAM;IAClB;IAEA,OAAOxB,aAAa;QAClB,GAAIsB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5B,8EAA8E;QAC9EG,2BAA2B;QAC3BxB;QACAyB,kBAAkBlB;QAClBG;QACAgB,QAAQ;QACRC,oBAAoB;QACpB,GAAGd,MAAM;IACX;AACF;AAEA;;;;;;CAMC,GACD,SAASG;IACP,OAAO;QACLa,SAAS,CAACC;YACR,IAAI,CAACA,OAAO,CAACC,cAAcD,MAAM;gBAC/B,OAAOA;YACT;YAEA,MAAME,aAAa9B,YAAY4B,QAAQA,IAAIG,QAAQ,CAACC,IAAI,CAACF,UAAU;YACnE,IAAIA,eAAe,KAAK;gBACtBF,IAAIK,OAAO,GAAG,GAAGL,IAAIK,OAAO,CAAC,mCAAmC,EAAErC,UAAU,QAAQ,gBAAgB,6BAA6B,EAAEK,gBAAgB,cAAc,CAAC,CAAC;YACrK;YAEA,OAAO2B;QACT;IACF;AACF;AAEA,SAASC,cAAcD,GAAU;IAC/B,OAAOM,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACT,KAAK;AACnD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { mkdirSync } from 'node:fs';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { dirname, join as joinPath } from 'node:path';
|
|
4
|
-
import { z } from 'zod';
|
|
4
|
+
import { z } from 'zod/mini';
|
|
5
5
|
import { debug } from '../debug.js';
|
|
6
6
|
import { readJsonFileSync } from '../util/readJsonFileSync.js';
|
|
7
7
|
import { writeJsonFileSync } from '../util/writeJsonFileSync.js';
|
|
8
8
|
import { clearCliTokenCache } from './cliTokenCache.js';
|
|
9
9
|
const cliUserConfigSchema = {
|
|
10
|
-
authToken: z.
|
|
10
|
+
authToken: z.optional(z.string())
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Set the config value for the given property.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/cliUserConfig.ts"],"sourcesContent":["import {mkdirSync} from 'node:fs'\nimport {homedir} from 'node:os'\nimport {dirname, join as joinPath} from 'node:path'\n\nimport {z} from 'zod'\n\nimport {debug} from '../debug.js'\nimport {readJsonFileSync} from '../util/readJsonFileSync.js'\nimport {writeJsonFileSync} from '../util/writeJsonFileSync.js'\nimport {clearCliTokenCache} from './cliTokenCache.js'\n\nconst cliUserConfigSchema = {\n authToken: z.
|
|
1
|
+
{"version":3,"sources":["../../src/services/cliUserConfig.ts"],"sourcesContent":["import {mkdirSync} from 'node:fs'\nimport {homedir} from 'node:os'\nimport {dirname, join as joinPath} from 'node:path'\n\nimport {z} from 'zod/mini'\n\nimport {debug} from '../debug.js'\nimport {readJsonFileSync} from '../util/readJsonFileSync.js'\nimport {writeJsonFileSync} from '../util/writeJsonFileSync.js'\nimport {clearCliTokenCache} from './cliTokenCache.js'\n\nconst cliUserConfigSchema = {\n authToken: z.optional(z.string()),\n}\n\n/**\n * Set the config value for the given property.\n * Validates that the passed value adheres to the defined CLI config schema.\n *\n * @param prop - The property to set the value for\n * @param value - The value to set\n * @internal\n */\nexport function setCliUserConfig(prop: 'authToken', value: string | undefined): void {\n const config = readConfig()\n const result = cliUserConfigSchema[prop].safeParse(value)\n if (!result.success) {\n const message = result.error.issues\n .map(({message, path}) => `[${path.join('.')}] ${message}`)\n .join('\\n')\n\n throw new Error(`Invalid value for config property \"${prop}\": ${message}`)\n }\n\n const configPath = getCliUserConfigPath()\n mkdirSync(dirname(configPath), {recursive: true})\n\n // When value is undefined, explicitly delete the key rather than relying\n // on JSON.stringify silently dropping undefined values.\n if (value === undefined) {\n const {[prop]: _, ...rest} = config\n writeJsonFileSync(configPath, rest, {pretty: true})\n } else {\n writeJsonFileSync(configPath, {...config, [prop]: value}, {pretty: true})\n }\n\n // Invalidate the in-process token cache so subsequent getCliToken() calls\n // pick up the new value from disk.\n clearCliTokenCache()\n}\n\n/**\n * Get the config value for the given property\n *\n * @param prop - The property to get the value for\n * @returns The value of the given property\n * @internal\n */\nexport function getCliUserConfig(prop: 'authToken'): string | undefined {\n const config = readConfig()\n const result = cliUserConfigSchema[prop].safeParse(config[prop])\n if (!result.success) {\n debug('Ignoring invalid stored value for \"%s\", returning undefined', prop)\n return undefined\n }\n\n return result.data\n}\n\n/**\n * A raw key-value store for CLI user configuration.\n * Unlike the typed `getCliUserConfig`/`setCliUserConfig`, this operates on\n * arbitrary keys without schema validation.\n *\n * @public\n */\nexport interface ConfigStore {\n /** Remove a key from the config file. */\n delete: (key: string) => void\n /** Read a value by key. Returns `undefined` if the key does not exist. */\n get: (key: string) => unknown\n /** Write a value by key, merging it into the existing config. */\n set: (key: string, value: unknown) => void\n}\n\n/**\n * Get a key-value store backed by the CLI user configuration file\n * (`~/.config/sanity/config.json`).\n *\n * Each call to `get`, `set`, or `delete` performs a full synchronous\n * read-modify-write cycle. This is intentional: sync I/O prevents\n * intra-process race conditions that occurred with the previous async\n * (configstore-backed) implementation.\n *\n * Note: there is no file-level locking, so concurrent writes from\n * separate CLI processes could still conflict. In practice this is\n * unlikely since CLI config writes are rare and user-initiated.\n *\n * @returns A {@link ConfigStore} for the CLI config file\n * @public\n */\nexport function getUserConfig(): ConfigStore {\n return {\n get(key: string): unknown {\n const config = readConfig()\n return config[key]\n },\n\n set(key: string, value: unknown): void {\n const config = readConfig()\n const configPath = getCliUserConfigPath()\n mkdirSync(dirname(configPath), {recursive: true})\n writeJsonFileSync(configPath, {...config, [key]: value}, {pretty: true})\n if (key === 'authToken') clearCliTokenCache()\n },\n\n // No mkdirSync needed: if readConfig() succeeded the directory already exists.\n delete(key: string): void {\n const config = readConfig()\n if (!(key in config)) return\n const {[key]: _, ...rest} = config\n writeJsonFileSync(getCliUserConfigPath(), rest, {pretty: true})\n if (key === 'authToken') clearCliTokenCache()\n },\n }\n}\n\n/**\n * Read the whole configuration from file system. If the file does not exist,\n * is corrupt, or otherwise unreadable, an empty object is returned. This is\n * intentional: the config only holds recoverable data (auth tokens, telemetry\n * consent) so silently resetting is preferable to blocking the user.\n *\n * @returns The whole CLI configuration.\n * @internal\n */\nfunction readConfig(): Record<string, unknown> {\n try {\n const config = readJsonFileSync(getCliUserConfigPath())\n if (!config || typeof config !== 'object' || Array.isArray(config)) {\n throw new Error('Invalid config file - expected an object')\n }\n return config\n } catch (err: unknown) {\n debug('Failed to read CLI config file: %s', err instanceof Error ? err.message : `${err}`)\n return {}\n }\n}\n\n/**\n * Get the file system location for the CLI user configuration file.\n * Takes into account the active environment (staging vs production).\n * The file is located in the user's home directory under the `.config` directory.\n *\n * @returns The path to the CLI configuration file.\n * @internal\n */\nfunction getCliUserConfigPath() {\n const sanityEnvSuffix = process.env.SANITY_INTERNAL_ENV === 'staging' ? '-staging' : ''\n const cliConfigPath =\n process.env.SANITY_CLI_CONFIG_PATH ||\n joinPath(homedir(), '.config', `sanity${sanityEnvSuffix}`, 'config.json')\n\n return cliConfigPath\n}\n"],"names":["mkdirSync","homedir","dirname","join","joinPath","z","debug","readJsonFileSync","writeJsonFileSync","clearCliTokenCache","cliUserConfigSchema","authToken","optional","string","setCliUserConfig","prop","value","config","readConfig","result","safeParse","success","message","error","issues","map","path","Error","configPath","getCliUserConfigPath","recursive","undefined","_","rest","pretty","getCliUserConfig","data","getUserConfig","get","key","set","delete","Array","isArray","err","sanityEnvSuffix","process","env","SANITY_INTERNAL_ENV","cliConfigPath","SANITY_CLI_CONFIG_PATH"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/telemetry/getCliTelemetry.ts"],"sourcesContent":["import {ux} from '@oclif/core'\nimport {noopLogger} from '
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/getCliTelemetry.ts"],"sourcesContent":["import {ux} from '@oclif/core'\n\nimport {noopLogger} from './noopTelemetry.js'\nimport {type CLITelemetryStore} from './types.js'\n\n/**\n * @public\n * Symbol used to store CLI telemetry state on globalThis.\n * Use the accessor functions instead of accessing this directly.\n */\nexport const CLI_TELEMETRY_SYMBOL = Symbol.for('sanity.cli.telemetry')\n\ntype TraceErrorReporter = (error: Error) => void\n\ninterface CliTelemetryState {\n logger: CLITelemetryStore\n\n reportTraceError?: TraceErrorReporter\n}\n\ntype GlobalWithTelemetry = typeof globalThis & {\n [CLI_TELEMETRY_SYMBOL]?: CliTelemetryState\n}\n\nfunction getState(): CliTelemetryState | undefined {\n return (globalThis as GlobalWithTelemetry)[CLI_TELEMETRY_SYMBOL]\n}\n\n/**\n * @public\n */\nexport function getCliTelemetry(): CLITelemetryStore {\n const state = getState()\n // This should never happen, but if it does, we return a noop logger to avoid errors.\n if (!state) {\n ux.warn('CLI telemetry not initialized, returning noop logger')\n return noopLogger\n }\n\n return state.logger\n}\n\n/**\n * Sets the global CLI telemetry state.\n * @internal\n */\nexport function setCliTelemetry(\n telemetry: CLITelemetryStore,\n options?: {reportTraceError?: TraceErrorReporter},\n): void {\n ;(globalThis as GlobalWithTelemetry)[CLI_TELEMETRY_SYMBOL] = {\n logger: telemetry,\n reportTraceError: options?.reportTraceError,\n }\n}\n\n/**\n * Reports an error to the CLI command trace. Called from SanityCommand.catch()\n * for real command errors (not user aborts).\n * @internal\n */\nexport function reportCliTraceError(error: Error): void {\n getState()?.reportTraceError?.(error)\n}\n\n/**\n * Clears the global CLI telemetry store.\n * @internal\n */\nexport function clearCliTelemetry(): void {\n const global = globalThis as GlobalWithTelemetry\n delete global[CLI_TELEMETRY_SYMBOL]\n}\n"],"names":["ux","noopLogger","CLI_TELEMETRY_SYMBOL","Symbol","for","getState","globalThis","getCliTelemetry","state","warn","logger","setCliTelemetry","telemetry","options","reportTraceError","reportCliTraceError","error","clearCliTelemetry","global"],"mappings":"AAAA,SAAQA,EAAE,QAAO,cAAa;AAE9B,SAAQC,UAAU,QAAO,qBAAoB;AAG7C;;;;CAIC,GACD,OAAO,MAAMC,uBAAuBC,OAAOC,GAAG,CAAC,wBAAuB;AActE,SAASC;IACP,OAAO,AAACC,UAAkC,CAACJ,qBAAqB;AAClE;AAEA;;CAEC,GACD,OAAO,SAASK;IACd,MAAMC,QAAQH;IACd,qFAAqF;IACrF,IAAI,CAACG,OAAO;QACVR,GAAGS,IAAI,CAAC;QACR,OAAOR;IACT;IAEA,OAAOO,MAAME,MAAM;AACrB;AAEA;;;CAGC,GACD,OAAO,SAASC,gBACdC,SAA4B,EAC5BC,OAAiD;;IAE/CP,UAAkC,CAACJ,qBAAqB,GAAG;QAC3DQ,QAAQE;QACRE,kBAAkBD,SAASC;IAC7B;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,oBAAoBC,KAAY;IAC9CX,YAAYS,mBAAmBE;AACjC;AAEA;;;CAGC,GACD,OAAO,SAASC;IACd,MAAMC,SAASZ;IACf,OAAOY,MAAM,CAAChB,qBAAqB;AACrC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Inline noop implementation â avoids a runtime dependency on @sanity/telemetry
|
|
2
|
+
// (types-only usage keeps it as a devDependency). Explicit types ensure this
|
|
3
|
+
// stays structurally in sync with TelemetryLogger/TelemetryTrace.
|
|
4
|
+
const noopTrace = {
|
|
5
|
+
await: (promise)=>promise,
|
|
6
|
+
complete: ()=>{},
|
|
7
|
+
error: ()=>{},
|
|
8
|
+
log: ()=>{},
|
|
9
|
+
newContext: ()=>noopLogger,
|
|
10
|
+
start: ()=>{}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Fallback logger used when telemetry has not been initialized.
|
|
14
|
+
* Exported for use in tests only â do not use in plugins or external code.
|
|
15
|
+
* @internal
|
|
16
|
+
*/ export const noopLogger = {
|
|
17
|
+
log: ()=>{},
|
|
18
|
+
resume: ()=>{},
|
|
19
|
+
trace: ()=>noopTrace,
|
|
20
|
+
updateUserProperties: ()=>{}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=noopTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/noopTelemetry.ts"],"sourcesContent":["import {type TelemetryTrace} from '@sanity/telemetry'\n\nimport {type CLITelemetryStore, type TelemetryUserProperties} from './types.js'\n\n// Inline noop implementation â avoids a runtime dependency on @sanity/telemetry\n// (types-only usage keeps it as a devDependency). Explicit types ensure this\n// stays structurally in sync with TelemetryLogger/TelemetryTrace.\nconst noopTrace: TelemetryTrace<TelemetryUserProperties, never> = {\n await: <P extends Promise<unknown>>(promise: P): P => promise,\n complete: () => {},\n error: () => {},\n log: () => {},\n newContext: (): CLITelemetryStore => noopLogger,\n start: () => {},\n}\n\n/**\n * Fallback logger used when telemetry has not been initialized.\n * Exported for use in tests only â do not use in plugins or external code.\n * @internal\n */\nexport const noopLogger: CLITelemetryStore = {\n log: () => {},\n resume: () => {},\n trace: () => noopTrace,\n updateUserProperties: () => {},\n}\n"],"names":["noopTrace","await","promise","complete","error","log","newContext","noopLogger","start","resume","trace","updateUserProperties"],"mappings":"AAIA,gFAAgF;AAChF,6EAA6E;AAC7E,kEAAkE;AAClE,MAAMA,YAA4D;IAChEC,OAAO,CAA6BC,UAAkBA;IACtDC,UAAU,KAAO;IACjBC,OAAO,KAAO;IACdC,KAAK,KAAO;IACZC,YAAY,IAAyBC;IACrCC,OAAO,KAAO;AAChB;AAEA;;;;CAIC,GACD,OAAO,MAAMD,aAAgC;IAC3CF,KAAK,KAAO;IACZI,QAAQ,KAAO;IACfC,OAAO,IAAMV;IACbW,sBAAsB,KAAO;AAC/B,EAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { dirname, join, normalize, resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
+
import { moduleResolve } from 'import-meta-resolve';
|
|
4
|
+
import { readPackageJson } from './readPackageJson.js';
|
|
5
|
+
/**
|
|
6
|
+
* Get the version of a package installed locally.
|
|
7
|
+
*
|
|
8
|
+
* @param moduleName - The name of the package in npm.
|
|
9
|
+
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
10
|
+
* @returns The version of the package installed locally.
|
|
11
|
+
* @internal
|
|
12
|
+
*/ export async function getLocalPackageVersion(moduleName, workDir) {
|
|
13
|
+
try {
|
|
14
|
+
const packageDir = getLocalPackageDir(moduleName, workDir);
|
|
15
|
+
return (await readPackageJson(join(packageDir, 'package.json'))).version;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the filesystem directory of a locally installed package using Node
|
|
22
|
+
* module resolution. Works correctly with hoisted packages in monorepos/workspaces,
|
|
23
|
+
* pnpm symlinks, and other non-standard node_modules layouts.
|
|
24
|
+
*
|
|
25
|
+
* @param moduleName - The name of the package in npm.
|
|
26
|
+
* @param workDir - The working directory to resolve the module from. (aka project root)
|
|
27
|
+
* @returns The absolute path to the package directory.
|
|
28
|
+
* @internal
|
|
29
|
+
*/ export function getLocalPackageDir(moduleName, workDir) {
|
|
30
|
+
// Handle import.meta.url being passed instead of a directory path
|
|
31
|
+
const dir = workDir.startsWith('file://') ? dirname(fileURLToPath(workDir)) : workDir;
|
|
32
|
+
const dirUrl = pathToFileURL(resolve(dir, 'noop.js'));
|
|
33
|
+
try {
|
|
34
|
+
const packageJsonUrl = moduleResolve(`${moduleName}/package.json`, dirUrl);
|
|
35
|
+
return dirname(fileURLToPath(packageJsonUrl));
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (!isErrPackagePathNotExported(err)) {
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Fallback: resolve main entry point and derive package root
|
|
42
|
+
const mainUrl = moduleResolve(moduleName, dirUrl);
|
|
43
|
+
const mainPath = fileURLToPath(mainUrl);
|
|
44
|
+
const normalizedName = normalize(moduleName);
|
|
45
|
+
const idx = mainPath.lastIndexOf(normalizedName);
|
|
46
|
+
if (idx === -1) {
|
|
47
|
+
throw new Error(`Could not determine package directory for '${moduleName}'`);
|
|
48
|
+
}
|
|
49
|
+
return mainPath.slice(0, idx + normalizedName.length);
|
|
50
|
+
}
|
|
51
|
+
function isErrPackagePathNotExported(err) {
|
|
52
|
+
return err instanceof Error && 'code' in err && err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=getLocalPackageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/getLocalPackageVersion.ts"],"sourcesContent":["import {dirname, join, normalize, resolve} from 'node:path'\nimport {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {moduleResolve} from 'import-meta-resolve'\n\nimport {readPackageJson} from './readPackageJson.js'\n\n/**\n * Get the version of a package installed locally.\n *\n * @param moduleName - The name of the package in npm.\n * @param workDir - The working directory to resolve the module from. (aka project root)\n * @returns The version of the package installed locally.\n * @internal\n */\nexport async function getLocalPackageVersion(\n moduleName: string,\n workDir: string,\n): Promise<string | null> {\n try {\n const packageDir = getLocalPackageDir(moduleName, workDir)\n return (await readPackageJson(join(packageDir, 'package.json'))).version\n } catch {\n return null\n }\n}\n\n/**\n * Resolve the filesystem directory of a locally installed package using Node\n * module resolution. Works correctly with hoisted packages in monorepos/workspaces,\n * pnpm symlinks, and other non-standard node_modules layouts.\n *\n * @param moduleName - The name of the package in npm.\n * @param workDir - The working directory to resolve the module from. (aka project root)\n * @returns The absolute path to the package directory.\n * @internal\n */\nexport function getLocalPackageDir(moduleName: string, workDir: string): string {\n // Handle import.meta.url being passed instead of a directory path\n const dir = workDir.startsWith('file://') ? dirname(fileURLToPath(workDir)) : workDir\n const dirUrl = pathToFileURL(resolve(dir, 'noop.js'))\n\n try {\n const packageJsonUrl = moduleResolve(`${moduleName}/package.json`, dirUrl)\n return dirname(fileURLToPath(packageJsonUrl))\n } catch (err: unknown) {\n if (!isErrPackagePathNotExported(err)) {\n throw err\n }\n }\n\n // Fallback: resolve main entry point and derive package root\n const mainUrl = moduleResolve(moduleName, dirUrl)\n const mainPath = fileURLToPath(mainUrl)\n const normalizedName = normalize(moduleName)\n const idx = mainPath.lastIndexOf(normalizedName)\n if (idx === -1) {\n throw new Error(`Could not determine package directory for '${moduleName}'`)\n }\n return mainPath.slice(0, idx + normalizedName.length)\n}\n\nfunction isErrPackagePathNotExported(err: unknown): boolean {\n return err instanceof Error && 'code' in err && err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED'\n}\n"],"names":["dirname","join","normalize","resolve","fileURLToPath","pathToFileURL","moduleResolve","readPackageJson","getLocalPackageVersion","moduleName","workDir","packageDir","getLocalPackageDir","version","dir","startsWith","dirUrl","packageJsonUrl","err","isErrPackagePathNotExported","mainUrl","mainPath","normalizedName","idx","lastIndexOf","Error","slice","length","code"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAO,YAAW;AAC3D,SAAQC,aAAa,EAAEC,aAAa,QAAO,WAAU;AAErD,SAAQC,aAAa,QAAO,sBAAqB;AAEjD,SAAQC,eAAe,QAAO,uBAAsB;AAEpD;;;;;;;CAOC,GACD,OAAO,eAAeC,uBACpBC,UAAkB,EAClBC,OAAe;IAEf,IAAI;QACF,MAAMC,aAAaC,mBAAmBH,YAAYC;QAClD,OAAO,AAAC,CAAA,MAAMH,gBAAgBN,KAAKU,YAAY,gBAAe,EAAGE,OAAO;IAC1E,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASD,mBAAmBH,UAAkB,EAAEC,OAAe;IACpE,kEAAkE;IAClE,MAAMI,MAAMJ,QAAQK,UAAU,CAAC,aAAaf,QAAQI,cAAcM,YAAYA;IAC9E,MAAMM,SAASX,cAAcF,QAAQW,KAAK;IAE1C,IAAI;QACF,MAAMG,iBAAiBX,cAAc,GAAGG,WAAW,aAAa,CAAC,EAAEO;QACnE,OAAOhB,QAAQI,cAAca;IAC/B,EAAE,OAAOC,KAAc;QACrB,IAAI,CAACC,4BAA4BD,MAAM;YACrC,MAAMA;QACR;IACF;IAEA,6DAA6D;IAC7D,MAAME,UAAUd,cAAcG,YAAYO;IAC1C,MAAMK,WAAWjB,cAAcgB;IAC/B,MAAME,iBAAiBpB,UAAUO;IACjC,MAAMc,MAAMF,SAASG,WAAW,CAACF;IACjC,IAAIC,QAAQ,CAAC,GAAG;QACd,MAAM,IAAIE,MAAM,CAAC,2CAA2C,EAAEhB,WAAW,CAAC,CAAC;IAC7E;IACA,OAAOY,SAASK,KAAK,CAAC,GAAGH,MAAMD,eAAeK,MAAM;AACtD;AAEA,SAASR,4BAA4BD,GAAY;IAC/C,OAAOA,eAAeO,SAAS,UAAUP,OAAOA,IAAIU,IAAI,KAAK;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/importModule.ts"],"sourcesContent":["import {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {createJiti, type JitiResolveOptions} from '
|
|
1
|
+
{"version":3,"sources":["../../src/util/importModule.ts"],"sourcesContent":["import {fileURLToPath, pathToFileURL} from 'node:url'\n\nimport {createJiti, type JitiResolveOptions} from 'jiti'\n\nimport {subdebug} from '../debug.js'\n\ninterface ImportModuleOptions {\n /**\n * Whether to return the default export of the module.\n * Default: true\n */\n default?: boolean\n\n /**\n * Path to the tsconfig file to use for the import. If not provided, the tsconfig\n * will be inferred from the nearest `tsconfig.json` file.\n */\n tsconfigPath?: string\n}\n\nconst debug = subdebug('importModule')\n\n/**\n * Imports a module using jiti and returns its exports.\n * This is a thin wrapper around tsx to allow swapping out the underlying implementation in the future if needed.\n *\n * @param filePath - Path to the module to import.\n * @param options - Options for the importModule function.\n * @returns The exported module.\n *\n * @internal\n */\nexport async function importModule<T = unknown>(\n filePath: string | URL,\n options: ImportModuleOptions = {},\n): Promise<T> {\n const {default: returnDefault = true, tsconfigPath} = options\n\n const jiti = createJiti(import.meta.url, {\n debug: debug.enabled,\n tsconfigPaths: typeof tsconfigPath === 'string' ? tsconfigPath : true,\n })\n\n const fileURL = typeof filePath === 'string' ? pathToFileURL(filePath) : filePath\n\n debug(`Loading module: ${fileURLToPath(fileURL)}`, {tsconfigPath})\n\n const jitiOptions: JitiResolveOptions & {default?: true} = {}\n\n // If the default option is true, add it to the jiti options\n if (returnDefault) {\n jitiOptions.default = true\n }\n\n return jiti.import<T>(fileURLToPath(fileURL), jitiOptions)\n}\n"],"names":["fileURLToPath","pathToFileURL","createJiti","subdebug","debug","importModule","filePath","options","default","returnDefault","tsconfigPath","jiti","url","enabled","tsconfigPaths","fileURL","jitiOptions","import"],"mappings":"AAAA,SAAQA,aAAa,EAAEC,aAAa,QAAO,WAAU;AAErD,SAAQC,UAAU,QAAgC,OAAM;AAExD,SAAQC,QAAQ,QAAO,cAAa;AAgBpC,MAAMC,QAAQD,SAAS;AAEvB;;;;;;;;;CASC,GACD,OAAO,eAAeE,aACpBC,QAAsB,EACtBC,UAA+B,CAAC,CAAC;IAEjC,MAAM,EAACC,SAASC,gBAAgB,IAAI,EAAEC,YAAY,EAAC,GAAGH;IAEtD,MAAMI,OAAOT,WAAW,YAAYU,GAAG,EAAE;QACvCR,OAAOA,MAAMS,OAAO;QACpBC,eAAe,OAAOJ,iBAAiB,WAAWA,eAAe;IACnE;IAEA,MAAMK,UAAU,OAAOT,aAAa,WAAWL,cAAcK,YAAYA;IAEzEF,MAAM,CAAC,gBAAgB,EAAEJ,cAAce,UAAU,EAAE;QAACL;IAAY;IAEhE,MAAMM,cAAqD,CAAC;IAE5D,4DAA4D;IAC5D,IAAIP,eAAe;QACjBO,YAAYR,OAAO,GAAG;IACxB;IAEA,OAAOG,KAAKM,MAAM,CAAIjB,cAAce,UAAUC;AAChD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import { z } from 'zod/mini';
|
|
3
3
|
/**
|
|
4
4
|
* Comprehensive package.json schema including all common properties.
|
|
5
5
|
* Feel free to add properties to this,
|
|
@@ -11,28 +11,28 @@ import { z } from 'zod';
|
|
|
11
11
|
name: z.string(),
|
|
12
12
|
version: z.string(),
|
|
13
13
|
// Dependencies (optional)
|
|
14
|
-
dependencies: z.record(z.string(), z.string())
|
|
15
|
-
devDependencies: z.record(z.string(), z.string())
|
|
16
|
-
peerDependencies: z.record(z.string(), z.string())
|
|
14
|
+
dependencies: z.optional(z.record(z.string(), z.string())),
|
|
15
|
+
devDependencies: z.optional(z.record(z.string(), z.string())),
|
|
16
|
+
peerDependencies: z.optional(z.record(z.string(), z.string())),
|
|
17
17
|
// Module structure (optional)
|
|
18
|
-
exports: z.record(z.string(), z.any())
|
|
19
|
-
main: z.
|
|
20
|
-
types: z.
|
|
18
|
+
exports: z.optional(z.record(z.string(), z.any())),
|
|
19
|
+
main: z.optional(z.string()),
|
|
20
|
+
types: z.optional(z.string()),
|
|
21
21
|
// Metadata (optional)
|
|
22
|
-
author: z.
|
|
23
|
-
description: z.
|
|
24
|
-
engines: z.record(z.string(), z.string())
|
|
25
|
-
license: z.
|
|
26
|
-
private: z.
|
|
27
|
-
repository: z.object({
|
|
22
|
+
author: z.optional(z.string()),
|
|
23
|
+
description: z.optional(z.string()),
|
|
24
|
+
engines: z.optional(z.record(z.string(), z.string())),
|
|
25
|
+
license: z.optional(z.string()),
|
|
26
|
+
private: z.optional(z.boolean()),
|
|
27
|
+
repository: z.optional(z.object({
|
|
28
28
|
type: z.string(),
|
|
29
29
|
url: z.string()
|
|
30
|
-
})
|
|
31
|
-
scripts: z.record(z.string(), z.string())
|
|
32
|
-
type: z.enum([
|
|
30
|
+
})),
|
|
31
|
+
scripts: z.optional(z.record(z.string(), z.string())),
|
|
32
|
+
type: z.optional(z.enum([
|
|
33
33
|
'module',
|
|
34
34
|
'commonjs'
|
|
35
|
-
])
|
|
35
|
+
]))
|
|
36
36
|
});
|
|
37
37
|
/**
|
|
38
38
|
* Read the `package.json` file at the given path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/readPackageJson.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\n\nimport {z} from 'zod'\n\n/**\n * Comprehensive package.json schema including all common properties.\n * Feel free to add properties to this,\n * đ âšī¸ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL âšī¸đ \n * đ âšī¸ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE âšī¸đ \n * đ âšī¸ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS âšī¸đ \n */\nconst packageJsonSchema = z.looseObject({\n // Required fields\n name: z.string(),\n version: z.string(),\n\n // Dependencies (optional)\n dependencies: z.record(z.string(), z.string())
|
|
1
|
+
{"version":3,"sources":["../../src/util/readPackageJson.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\n\nimport {z} from 'zod/mini'\n\n/**\n * Comprehensive package.json schema including all common properties.\n * Feel free to add properties to this,\n * đ âšī¸ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL âšī¸đ \n * đ âšī¸ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE âšī¸đ \n * đ âšī¸ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS âšī¸đ \n */\nconst packageJsonSchema = z.looseObject({\n // Required fields\n name: z.string(),\n version: z.string(),\n\n // Dependencies (optional)\n dependencies: z.optional(z.record(z.string(), z.string())),\n devDependencies: z.optional(z.record(z.string(), z.string())),\n peerDependencies: z.optional(z.record(z.string(), z.string())),\n\n // Module structure (optional)\n exports: z.optional(z.record(z.string(), z.any())),\n main: z.optional(z.string()),\n types: z.optional(z.string()),\n\n // Metadata (optional)\n author: z.optional(z.string()),\n description: z.optional(z.string()),\n engines: z.optional(z.record(z.string(), z.string())),\n license: z.optional(z.string()),\n private: z.optional(z.boolean()),\n repository: z.optional(\n z.object({\n type: z.string(),\n url: z.string(),\n }),\n ),\n scripts: z.optional(z.record(z.string(), z.string())),\n type: z.optional(z.enum(['module', 'commonjs'])),\n})\n\n/**\n * Comprehensive representation of a package.json file.\n * Consolidates all properties from previous type definitions.\n *\n * @public\n */\nexport type PackageJson = z.infer<typeof packageJsonSchema>\n\n/**\n * Options for reading package.json files\n *\n * @public\n */\nexport interface ReadPackageJsonOptions {\n /**\n * Default values to merge with the parsed package.json.\n * Parsed values take precedence over defaults.\n */\n defaults?: Partial<PackageJson>\n\n /**\n * Skip Zod schema validation. When true, the file is parsed but not validated.\n * Defaults to false.\n */\n skipSchemaValidation?: boolean\n}\n\n/**\n * Read the `package.json` file at the given path\n *\n * @param filePath - Path to package.json to read\n * @param options - Options object for controlling read behavior\n * @returns The parsed package.json\n * @public\n */\nexport async function readPackageJson(\n filePath: string | URL,\n options: ReadPackageJsonOptions = {},\n): Promise<PackageJson> {\n const {defaults = {}, skipSchemaValidation = false} = options\n\n // Read and parse the file\n let pkg: Record<string, unknown>\n try {\n pkg = JSON.parse(await readFile(filePath, 'utf8'))\n } catch (err: unknown) {\n throw new Error(`Failed to read \"${filePath}\"`, {cause: err})\n }\n\n // Merge with defaults (parsed values take precedence)\n const merged = {...defaults, ...pkg}\n\n // Validate with schema unless skipped\n let validated: PackageJson\n if (skipSchemaValidation) {\n validated = merged as PackageJson\n } else {\n const {data, error, success} = packageJsonSchema.safeParse(merged)\n if (!success) {\n throw new Error(\n `Invalid package.json at \"${filePath}\": ${error.issues.map((err) => err.message).join('\\n')}`,\n )\n }\n validated = data\n }\n\n return validated\n}\n"],"names":["readFile","z","packageJsonSchema","looseObject","name","string","version","dependencies","optional","record","devDependencies","peerDependencies","exports","any","main","types","author","description","engines","license","private","boolean","repository","object","type","url","scripts","enum","readPackageJson","filePath","options","defaults","skipSchemaValidation","pkg","JSON","parse","err","Error","cause","merged","validated","data","error","success","safeParse","issues","map","message","join"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AAEzC,SAAQC,CAAC,QAAO,WAAU;AAE1B;;;;;;CAMC,GACD,MAAMC,oBAAoBD,EAAEE,WAAW,CAAC;IACtC,kBAAkB;IAClBC,MAAMH,EAAEI,MAAM;IACdC,SAASL,EAAEI,MAAM;IAEjB,0BAA0B;IAC1BE,cAAcN,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEI,MAAM;IACtDK,iBAAiBT,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEI,MAAM;IACzDM,kBAAkBV,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEI,MAAM;IAE1D,8BAA8B;IAC9BO,SAASX,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEY,GAAG;IAC9CC,MAAMb,EAAEO,QAAQ,CAACP,EAAEI,MAAM;IACzBU,OAAOd,EAAEO,QAAQ,CAACP,EAAEI,MAAM;IAE1B,sBAAsB;IACtBW,QAAQf,EAAEO,QAAQ,CAACP,EAAEI,MAAM;IAC3BY,aAAahB,EAAEO,QAAQ,CAACP,EAAEI,MAAM;IAChCa,SAASjB,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEI,MAAM;IACjDc,SAASlB,EAAEO,QAAQ,CAACP,EAAEI,MAAM;IAC5Be,SAASnB,EAAEO,QAAQ,CAACP,EAAEoB,OAAO;IAC7BC,YAAYrB,EAAEO,QAAQ,CACpBP,EAAEsB,MAAM,CAAC;QACPC,MAAMvB,EAAEI,MAAM;QACdoB,KAAKxB,EAAEI,MAAM;IACf;IAEFqB,SAASzB,EAAEO,QAAQ,CAACP,EAAEQ,MAAM,CAACR,EAAEI,MAAM,IAAIJ,EAAEI,MAAM;IACjDmB,MAAMvB,EAAEO,QAAQ,CAACP,EAAE0B,IAAI,CAAC;QAAC;QAAU;KAAW;AAChD;AA6BA;;;;;;;CAOC,GACD,OAAO,eAAeC,gBACpBC,QAAsB,EACtBC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EAACC,WAAW,CAAC,CAAC,EAAEC,uBAAuB,KAAK,EAAC,GAAGF;IAEtD,0BAA0B;IAC1B,IAAIG;IACJ,IAAI;QACFA,MAAMC,KAAKC,KAAK,CAAC,MAAMnC,SAAS6B,UAAU;IAC5C,EAAE,OAAOO,KAAc;QACrB,MAAM,IAAIC,MAAM,CAAC,gBAAgB,EAAER,SAAS,CAAC,CAAC,EAAE;YAACS,OAAOF;QAAG;IAC7D;IAEA,sDAAsD;IACtD,MAAMG,SAAS;QAAC,GAAGR,QAAQ;QAAE,GAAGE,GAAG;IAAA;IAEnC,sCAAsC;IACtC,IAAIO;IACJ,IAAIR,sBAAsB;QACxBQ,YAAYD;IACd,OAAO;QACL,MAAM,EAACE,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAC,GAAGzC,kBAAkB0C,SAAS,CAACL;QAC3D,IAAI,CAACI,SAAS;YACZ,MAAM,IAAIN,MACR,CAAC,yBAAyB,EAAER,SAAS,GAAG,EAAEa,MAAMG,MAAM,CAACC,GAAG,CAAC,CAACV,MAAQA,IAAIW,OAAO,EAAEC,IAAI,CAAC,OAAO;QAEjG;QACAR,YAAYC;IACd;IAEA,OAAOD;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Sanity CLI core package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -52,46 +52,43 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@inquirer/prompts": "^8.3.0",
|
|
55
|
-
"@oclif/core": "^4.10.
|
|
56
|
-
"@
|
|
57
|
-
"@sanity/client": "^7.20.0",
|
|
55
|
+
"@oclif/core": "^4.10.6",
|
|
56
|
+
"@sanity/client": "^7.22.0",
|
|
58
57
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
59
58
|
"boxen": "^8.0.1",
|
|
60
59
|
"debug": "^4.4.3",
|
|
61
60
|
"get-it": "^8.7.0",
|
|
62
61
|
"get-tsconfig": "^4.13.7",
|
|
63
62
|
"import-meta-resolve": "^4.2.0",
|
|
64
|
-
"
|
|
63
|
+
"jiti": "^2.7.0",
|
|
64
|
+
"jsdom": "^29.0.2",
|
|
65
65
|
"json-lexer": "^1.2.0",
|
|
66
66
|
"log-symbols": "^7.0.1",
|
|
67
67
|
"ora": "^9.0.0",
|
|
68
68
|
"read-package-up": "^12.0.0",
|
|
69
69
|
"rxjs": "^7.8.2",
|
|
70
70
|
"tsx": "^4.21.0",
|
|
71
|
-
"vite": "^7.3.
|
|
71
|
+
"vite": "^7.3.2",
|
|
72
72
|
"vite-node": "^5.3.0",
|
|
73
73
|
"zod": "^4.3.6"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@eslint/compat": "^2.0.
|
|
77
|
-
"@sanity/pkg-utils": "^10.4.
|
|
76
|
+
"@eslint/compat": "^2.0.5",
|
|
77
|
+
"@sanity/pkg-utils": "^10.4.18",
|
|
78
78
|
"@sanity/telemetry": "^0.9.0",
|
|
79
|
-
"@swc/cli": "^0.8.
|
|
80
|
-
"@swc/core": "^1.15.
|
|
79
|
+
"@swc/cli": "^0.8.1",
|
|
80
|
+
"@swc/core": "^1.15.33",
|
|
81
81
|
"@types/debug": "^4.1.13",
|
|
82
82
|
"@types/jsdom": "^28.0.1",
|
|
83
|
-
"@types/node": "^20.19.
|
|
84
|
-
"eslint": "^10.1
|
|
83
|
+
"@types/node": "^20.19.39",
|
|
84
|
+
"eslint": "^10.2.1",
|
|
85
85
|
"publint": "^0.3.18",
|
|
86
|
-
"sanity": "^5.
|
|
86
|
+
"sanity": "^5.23.0",
|
|
87
87
|
"typescript": "^5.9.3",
|
|
88
|
-
"vitest": "^4.1.
|
|
88
|
+
"vitest": "^4.1.5",
|
|
89
|
+
"@repo/tsconfig": "3.70.0",
|
|
89
90
|
"@repo/package.config": "0.0.1",
|
|
90
|
-
"@sanity/eslint-config-cli": "1.1.
|
|
91
|
-
"@repo/tsconfig": "3.70.0"
|
|
92
|
-
},
|
|
93
|
-
"peerDependencies": {
|
|
94
|
-
"@sanity/telemetry": ">=0.9.0 <0.10.0"
|
|
91
|
+
"@sanity/eslint-config-cli": "1.1.1"
|
|
95
92
|
},
|
|
96
93
|
"engines": {
|
|
97
94
|
"node": ">=20.19.1 <22 || >=22.12"
|