@sanity/cli-test 0.0.2-alpha.7 → 0.0.2-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.
Files changed (107) hide show
  1. package/README.md +31 -31
  2. package/dist/index.d.ts +517 -9
  3. package/dist/index.js +4 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/test/constants.js +19 -6
  6. package/dist/test/constants.js.map +1 -1
  7. package/dist/test/createTestClient.js +2 -0
  8. package/dist/test/createTestClient.js.map +1 -1
  9. package/dist/test/createTestToken.js +8 -1
  10. package/dist/test/createTestToken.js.map +1 -1
  11. package/dist/test/mockApi.js +5 -3
  12. package/dist/test/mockApi.js.map +1 -1
  13. package/dist/test/mockSanityCommand.js +16 -0
  14. package/dist/test/mockSanityCommand.js.map +1 -1
  15. package/dist/test/mockTelemetry.js +22 -0
  16. package/dist/test/mockTelemetry.js.map +1 -0
  17. package/dist/test/{setupExamples.js → setupFixtures.js} +43 -35
  18. package/dist/test/setupFixtures.js.map +1 -0
  19. package/dist/test/snapshotSerializer.js +12 -0
  20. package/dist/test/snapshotSerializer.js.map +1 -0
  21. package/dist/test/testCommand.js +6 -1
  22. package/dist/test/testCommand.js.map +1 -1
  23. package/dist/test/{testExample.js → testFixture.js} +46 -27
  24. package/dist/test/testFixture.js.map +1 -0
  25. package/dist/test/testHook.js +23 -7
  26. package/dist/test/testHook.js.map +1 -1
  27. package/dist/utils/paths.js +43 -7
  28. package/dist/utils/paths.js.map +1 -1
  29. package/dist/vitest.d.ts +104 -8
  30. package/dist/vitest.js +3 -2
  31. package/dist/vitest.js.map +1 -1
  32. package/dist/vitestWorker.js +4 -0
  33. package/dist/vitestWorker.js.map +1 -1
  34. package/{examples → fixtures}/basic-app/package.json +5 -6
  35. package/{examples → fixtures}/basic-studio/package.json +5 -6
  36. package/{examples → fixtures}/multi-workspace-studio/package.json +5 -6
  37. package/fixtures/prebuilt-app/README.md +3 -0
  38. package/fixtures/prebuilt-app/dist/favicon.ico +0 -0
  39. package/fixtures/prebuilt-app/dist/index.html +102 -0
  40. package/fixtures/prebuilt-app/dist/static/sanity-CtOxKsdo.css +24 -0
  41. package/fixtures/prebuilt-app/dist/static/sanity-D4a4eOYZ.js +17 -0
  42. package/fixtures/prebuilt-app/package.json +26 -0
  43. package/fixtures/prebuilt-app/sanity.cli.ts +12 -0
  44. package/fixtures/prebuilt-app/src/App.css +20 -0
  45. package/fixtures/prebuilt-app/src/App.tsx +24 -0
  46. package/fixtures/prebuilt-app/tsconfig.json +17 -0
  47. package/fixtures/prebuilt-studio/README.md +3 -0
  48. package/fixtures/prebuilt-studio/dist/favicon.ico +0 -0
  49. package/fixtures/prebuilt-studio/dist/index.html +113 -0
  50. package/fixtures/prebuilt-studio/dist/static/sanity-DxH-rpFr.js +9 -0
  51. package/fixtures/prebuilt-studio/package.json +25 -0
  52. package/fixtures/prebuilt-studio/sanity.cli.ts +11 -0
  53. package/fixtures/prebuilt-studio/sanity.config.ts +11 -0
  54. package/fixtures/prebuilt-studio/tsconfig.json +17 -0
  55. package/{examples → fixtures}/worst-case-studio/package.json +7 -8
  56. package/package.json +22 -20
  57. package/dist/test/captureOutput.d.ts +0 -33
  58. package/dist/test/constants.d.ts +0 -2
  59. package/dist/test/createTestClient.d.ts +0 -44
  60. package/dist/test/createTestToken.d.ts +0 -1
  61. package/dist/test/mockApi.d.ts +0 -34
  62. package/dist/test/mockSanityCommand.d.ts +0 -45
  63. package/dist/test/setupExamples.d.ts +0 -60
  64. package/dist/test/setupExamples.js.map +0 -1
  65. package/dist/test/testCommand.d.ts +0 -21
  66. package/dist/test/testExample.d.ts +0 -46
  67. package/dist/test/testExample.js.map +0 -1
  68. package/dist/test/testHook.d.ts +0 -8
  69. package/dist/utils/fileExists.d.ts +0 -9
  70. package/dist/utils/paths.d.ts +0 -22
  71. package/dist/vitestWorker.d.ts +0 -23
  72. /package/{examples → fixtures}/basic-app/sanity.cli.ts +0 -0
  73. /package/{examples → fixtures}/basic-app/src/App.css +0 -0
  74. /package/{examples → fixtures}/basic-app/src/App.tsx +0 -0
  75. /package/{examples → fixtures}/basic-app/src/ExampleComponent.css +0 -0
  76. /package/{examples → fixtures}/basic-app/src/ExampleComponent.tsx +0 -0
  77. /package/{examples → fixtures}/basic-app/tsconfig.json +0 -0
  78. /package/{examples → fixtures}/basic-studio/sanity.cli.ts +0 -0
  79. /package/{examples → fixtures}/basic-studio/sanity.config.ts +0 -0
  80. /package/{examples → fixtures}/basic-studio/schemaTypes/author.ts +0 -0
  81. /package/{examples → fixtures}/basic-studio/schemaTypes/blockContent.ts +0 -0
  82. /package/{examples → fixtures}/basic-studio/schemaTypes/category.ts +0 -0
  83. /package/{examples → fixtures}/basic-studio/schemaTypes/index.ts +0 -0
  84. /package/{examples → fixtures}/basic-studio/schemaTypes/post.ts +0 -0
  85. /package/{examples → fixtures}/basic-studio/tsconfig.json +0 -0
  86. /package/{examples → fixtures}/multi-workspace-studio/sanity.cli.ts +0 -0
  87. /package/{examples → fixtures}/multi-workspace-studio/sanity.config.ts +0 -0
  88. /package/{examples → fixtures}/multi-workspace-studio/schemaTypes/author.ts +0 -0
  89. /package/{examples → fixtures}/multi-workspace-studio/schemaTypes/blockContent.ts +0 -0
  90. /package/{examples → fixtures}/multi-workspace-studio/schemaTypes/category.ts +0 -0
  91. /package/{examples → fixtures}/multi-workspace-studio/schemaTypes/index.ts +0 -0
  92. /package/{examples → fixtures}/multi-workspace-studio/schemaTypes/post.ts +0 -0
  93. /package/{examples → fixtures}/multi-workspace-studio/tsconfig.json +0 -0
  94. /package/{examples → fixtures}/worst-case-studio/README.md +0 -0
  95. /package/{examples → fixtures}/worst-case-studio/sanity.cli.ts +0 -0
  96. /package/{examples → fixtures}/worst-case-studio/sanity.config.tsx +0 -0
  97. /package/{examples → fixtures}/worst-case-studio/src/defines.ts +0 -0
  98. /package/{examples → fixtures}/worst-case-studio/src/descriptionIcon.svg +0 -0
  99. /package/{examples → fixtures}/worst-case-studio/src/descriptionInput.module.css +0 -0
  100. /package/{examples → fixtures}/worst-case-studio/src/descriptionInput.tsx +0 -0
  101. /package/{examples → fixtures}/worst-case-studio/src/schemaTypes/author.ts +0 -0
  102. /package/{examples → fixtures}/worst-case-studio/src/schemaTypes/blockContent.ts +0 -0
  103. /package/{examples → fixtures}/worst-case-studio/src/schemaTypes/category.ts +0 -0
  104. /package/{examples → fixtures}/worst-case-studio/src/schemaTypes/index.ts +0 -0
  105. /package/{examples → fixtures}/worst-case-studio/src/schemaTypes/post.ts +0 -0
  106. /package/{examples → fixtures}/worst-case-studio/src/typings.d.ts +0 -0
  107. /package/{examples → fixtures}/worst-case-studio/tsconfig.json +0 -0
@@ -2,20 +2,20 @@ import { resolve } from 'node:path';
2
2
  // Capture the initial working directory before any tests change it
3
3
  const INITIAL_CWD = process.cwd();
4
4
  /**
5
- * Gets the path to the examples directory bundled with this package.
5
+ * Gets the path to the fixtures directory bundled with this package.
6
6
  *
7
- * The examples are copied during build and bundled with the published package.
7
+ * The fixtures are copied during build and bundled with the published package.
8
8
  * This function works the same whether the package is used in a monorepo
9
9
  * or installed from npm.
10
10
  *
11
- * @returns Absolute path to the examples directory
11
+ * @returns Absolute path to the fixtures directory
12
12
  * @internal
13
- */ export function getExamplesPath() {
14
- // From dist/utils/paths.js -> ../../examples
15
- return resolve(import.meta.dirname, '../../examples');
13
+ */ export function getFixturesPath() {
14
+ // From dist/utils/paths.js -> ../../fixtures
15
+ return resolve(import.meta.dirname, '../../fixtures');
16
16
  }
17
17
  /**
18
- * Gets the path to the temporary directory for test examples.
18
+ * Gets the path to the temporary directory for test fixtures.
19
19
  *
20
20
  * Uses the initial working directory captured when this module was first loaded,
21
21
  * not process.cwd() which may change during test execution.
@@ -26,5 +26,41 @@ const INITIAL_CWD = process.cwd();
26
26
  */ export function getTempPath(customTempDir) {
27
27
  return customTempDir || resolve(INITIAL_CWD, 'tmp');
28
28
  }
29
+ /**
30
+ * Gets the current Windows drive letter from process.cwd().
31
+ * Falls back to 'C:\\' if detection fails.
32
+ *
33
+ * @returns Drive letter with backslash (e.g., 'C:\\', 'D:\\') or empty string on Unix
34
+ * @internal
35
+ */ export function getCurrentDrive() {
36
+ if (process.platform !== 'win32') {
37
+ return '';
38
+ }
39
+ const cwd = process.cwd();
40
+ const match = cwd.match(/^([A-Z]:)[\\/]/);
41
+ return match ? match[1] + '\\' : 'C:\\';
42
+ }
43
+ /**
44
+ * Converts Unix-style paths to platform-appropriate paths.
45
+ * On Windows:
46
+ * - Absolute paths starting with '/': adds drive letter and converts to backslashes
47
+ * - Relative/partial paths: converts forward slashes to backslashes
48
+ * On Unix: keeps paths as-is.
49
+ *
50
+ * @param pathStr - Unix-style path (e.g., '/test/path' or '.config/file.json')
51
+ * @returns Platform-appropriate path
52
+ * @internal
53
+ */ export function convertToSystemPath(pathStr) {
54
+ if (process.platform === 'win32') {
55
+ if (pathStr.startsWith('/')) {
56
+ // Absolute Unix path - add drive letter
57
+ const drive = getCurrentDrive();
58
+ return `${drive}${pathStr.slice(1).replaceAll('/', '\\')}`;
59
+ }
60
+ // Relative/partial path - just convert separators
61
+ return pathStr.replaceAll('/', '\\');
62
+ }
63
+ return pathStr;
64
+ }
29
65
 
30
66
  //# sourceMappingURL=paths.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/paths.ts"],"sourcesContent":["import {resolve} from 'node:path'\n\n// Capture the initial working directory before any tests change it\nconst INITIAL_CWD = process.cwd()\n\n/**\n * Gets the path to the examples directory bundled with this package.\n *\n * The examples are copied during build and bundled with the published package.\n * This function works the same whether the package is used in a monorepo\n * or installed from npm.\n *\n * @returns Absolute path to the examples directory\n * @internal\n */\nexport function getExamplesPath(): string {\n // From dist/utils/paths.js -> ../../examples\n return resolve(import.meta.dirname, '../../examples')\n}\n\n/**\n * Gets the path to the temporary directory for test examples.\n *\n * Uses the initial working directory captured when this module was first loaded,\n * not process.cwd() which may change during test execution.\n *\n * @param customTempDir - Optional custom temp directory path\n * @returns Absolute path to temp directory (default: initial cwd/tmp)\n * @internal\n */\nexport function getTempPath(customTempDir?: string): string {\n return customTempDir || resolve(INITIAL_CWD, 'tmp')\n}\n"],"names":["resolve","INITIAL_CWD","process","cwd","getExamplesPath","dirname","getTempPath","customTempDir"],"mappings":"AAAA,SAAQA,OAAO,QAAO,YAAW;AAEjC,mEAAmE;AACnE,MAAMC,cAAcC,QAAQC,GAAG;AAE/B;;;;;;;;;CASC,GACD,OAAO,SAASC;IACd,6CAA6C;IAC7C,OAAOJ,QAAQ,YAAYK,OAAO,EAAE;AACtC;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,YAAYC,aAAsB;IAChD,OAAOA,iBAAiBP,QAAQC,aAAa;AAC/C"}
1
+ {"version":3,"sources":["../../src/utils/paths.ts"],"sourcesContent":["import {resolve} from 'node:path'\n\n// Capture the initial working directory before any tests change it\nconst INITIAL_CWD = process.cwd()\n\n/**\n * Gets the path to the fixtures directory bundled with this package.\n *\n * The fixtures are copied during build and bundled with the published package.\n * This function works the same whether the package is used in a monorepo\n * or installed from npm.\n *\n * @returns Absolute path to the fixtures directory\n * @internal\n */\nexport function getFixturesPath(): string {\n // From dist/utils/paths.js -> ../../fixtures\n return resolve(import.meta.dirname, '../../fixtures')\n}\n\n/**\n * Gets the path to the temporary directory for test fixtures.\n *\n * Uses the initial working directory captured when this module was first loaded,\n * not process.cwd() which may change during test execution.\n *\n * @param customTempDir - Optional custom temp directory path\n * @returns Absolute path to temp directory (default: initial cwd/tmp)\n * @internal\n */\nexport function getTempPath(customTempDir?: string): string {\n return customTempDir || resolve(INITIAL_CWD, 'tmp')\n}\n\n/**\n * Gets the current Windows drive letter from process.cwd().\n * Falls back to 'C:\\\\' if detection fails.\n *\n * @returns Drive letter with backslash (e.g., 'C:\\\\', 'D:\\\\') or empty string on Unix\n * @internal\n */\nexport function getCurrentDrive(): string {\n if (process.platform !== 'win32') {\n return ''\n }\n const cwd = process.cwd()\n const match = cwd.match(/^([A-Z]:)[\\\\/]/)\n return match ? match[1] + '\\\\' : 'C:\\\\'\n}\n\n/**\n * Converts Unix-style paths to platform-appropriate paths.\n * On Windows:\n * - Absolute paths starting with '/': adds drive letter and converts to backslashes\n * - Relative/partial paths: converts forward slashes to backslashes\n * On Unix: keeps paths as-is.\n *\n * @param pathStr - Unix-style path (e.g., '/test/path' or '.config/file.json')\n * @returns Platform-appropriate path\n * @internal\n */\nexport function convertToSystemPath(pathStr: string): string {\n if (process.platform === 'win32') {\n if (pathStr.startsWith('/')) {\n // Absolute Unix path - add drive letter\n const drive = getCurrentDrive()\n return `${drive}${pathStr.slice(1).replaceAll('/', '\\\\')}`\n }\n // Relative/partial path - just convert separators\n return pathStr.replaceAll('/', '\\\\')\n }\n return pathStr\n}\n"],"names":["resolve","INITIAL_CWD","process","cwd","getFixturesPath","dirname","getTempPath","customTempDir","getCurrentDrive","platform","match","convertToSystemPath","pathStr","startsWith","drive","slice","replaceAll"],"mappings":"AAAA,SAAQA,OAAO,QAAO,YAAW;AAEjC,mEAAmE;AACnE,MAAMC,cAAcC,QAAQC,GAAG;AAE/B;;;;;;;;;CASC,GACD,OAAO,SAASC;IACd,6CAA6C;IAC7C,OAAOJ,QAAQ,YAAYK,OAAO,EAAE;AACtC;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,YAAYC,aAAsB;IAChD,OAAOA,iBAAiBP,QAAQC,aAAa;AAC/C;AAEA;;;;;;CAMC,GACD,OAAO,SAASO;IACd,IAAIN,QAAQO,QAAQ,KAAK,SAAS;QAChC,OAAO;IACT;IACA,MAAMN,MAAMD,QAAQC,GAAG;IACvB,MAAMO,QAAQP,IAAIO,KAAK,CAAC;IACxB,OAAOA,QAAQA,KAAK,CAAC,EAAE,GAAG,OAAO;AACnC;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASC,oBAAoBC,OAAe;IACjD,IAAIV,QAAQO,QAAQ,KAAK,SAAS;QAChC,IAAIG,QAAQC,UAAU,CAAC,MAAM;YAC3B,wCAAwC;YACxC,MAAMC,QAAQN;YACd,OAAO,GAAGM,QAAQF,QAAQG,KAAK,CAAC,GAAGC,UAAU,CAAC,KAAK,OAAO;QAC5D;QACA,kDAAkD;QAClD,OAAOJ,QAAQI,UAAU,CAAC,KAAK;IACjC;IACA,OAAOJ;AACT"}
package/dist/vitest.d.ts CHANGED
@@ -1,14 +1,22 @@
1
+ import {TestProject} from 'vitest/node'
2
+
1
3
  /**
2
- * Vitest global setup entry point.
4
+ * Global setup function for initializing test fixtures.
3
5
  *
4
- * Import this in your vitest.config.ts globalSetup array for automatic
5
- * test example setup and teardown.
6
+ * Copies fixtures from the bundled location to a temp directory
7
+ * and installs dependencies.
6
8
  *
9
+ * Note: Fixtures are NOT built during setup. Tests that need built
10
+ * fixtures should build them as part of the test.
11
+ *
12
+ * This function is designed to be used with vitest globalSetup.
13
+ *
14
+ * @public
15
+ *
16
+ * @param options - Configuration options
7
17
  * @example
8
18
  * ```typescript
9
- * // vitest.config.ts
10
- * import {defineConfig} from 'vitest/config'
11
- *
19
+ * // In vitest.config.ts
12
20
  * export default defineConfig({
13
21
  * test: {
14
22
  * globalSetup: ['@sanity/cli-test/vitest']
@@ -16,5 +24,93 @@
16
24
  * })
17
25
  * ```
18
26
  */
19
- export { setup, teardown } from './test/setupExamples.js';
20
- export { setupWorkerBuild, teardownWorkerBuild } from './vitestWorker.js';
27
+ export declare function setup(_: TestProject, options?: SetupTestFixturesOptions): Promise<void>
28
+
29
+ /**
30
+ * Options for setupTestFixtures
31
+ *
32
+ * @public
33
+ */
34
+ declare interface SetupTestFixturesOptions {
35
+ /**
36
+ * Glob patterns for additional fixture directories to set up.
37
+ *
38
+ * Each pattern is matched against directories in the current working directory.
39
+ * Only directories containing a `package.json` file are included.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * ['fixtures/*', 'dev/*']
44
+ * ```
45
+ */
46
+ additionalFixtures?: string[]
47
+ /**
48
+ * Custom temp directory path. Defaults to process.cwd()/tmp
49
+ */
50
+ tempDir?: string
51
+ }
52
+
53
+ /**
54
+ * Setup function to build the worker files with esbuild.
55
+ *
56
+ * Bundles the worker files with esbuild and sets up watch mode if in watch mode.
57
+ * All npm packages are automatically marked as external (loaded from node_modules at runtime).
58
+ * Only internal project code is bundled inline.
59
+ *
60
+ * @public
61
+ *
62
+ * @param filePaths - The paths to the worker files to build
63
+ * @returns A promise that resolves when the worker build is setup
64
+ * @throws If the worker files cannot be bundled
65
+ * @throws If the watcher cannot be set up
66
+ */
67
+ export declare function setupWorkerBuild(filePaths: string[]): Promise<void>
68
+
69
+ /**
70
+ * Serializer for snapshot tests to normalize line endings and Windows ^ to Unix `\`
71
+ * @public
72
+ */
73
+ export declare const snapshotSerializer: {
74
+ serialize: (val: string) => string
75
+ test: (val: unknown) => val is string
76
+ }
77
+
78
+ /**
79
+ * Teardown function to clean up test fixtures.
80
+ *
81
+ * Removes the temp directory created by setupTestFixtures.
82
+ *
83
+ * This function is designed to be used with vitest globalSetup.
84
+ *
85
+ * @public
86
+ *
87
+ * @param options - Configuration options
88
+ */
89
+ export declare function teardown(options?: TeardownTestFixturesOptions): Promise<void>
90
+
91
+ /**
92
+ * Options for teardownTestFixtures
93
+ *
94
+ * @public
95
+ */
96
+ declare interface TeardownTestFixturesOptions {
97
+ /**
98
+ * Custom temp directory path. Defaults to process.cwd()/tmp
99
+ */
100
+ tempDir?: string
101
+ }
102
+
103
+ /**
104
+ * Teardown function to clean up the worker build.
105
+ *
106
+ * Closes all build contexts and deletes the compiled JavaScript files.
107
+ *
108
+ * @public
109
+ *
110
+ * @returns A promise that resolves when the worker build is teared down
111
+ * @throws If the build contexts cannot be disposed
112
+ * @throws If the compiled JavaScript files cannot be deleted
113
+ */
114
+ export declare function teardownWorkerBuild(): Promise<void>
115
+
116
+ export {}
package/dist/vitest.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Vitest global setup entry point.
3
3
  *
4
4
  * Import this in your vitest.config.ts globalSetup array for automatic
5
- * test example setup and teardown.
5
+ * test fixture setup and teardown.
6
6
  *
7
7
  * @example
8
8
  * ```typescript
@@ -15,7 +15,8 @@
15
15
  * }
16
16
  * })
17
17
  * ```
18
- */ export { setup, teardown } from './test/setupExamples.js';
18
+ */ export { setup, teardown } from './test/setupFixtures.js';
19
+ export { snapshotSerializer } from './test/snapshotSerializer.js';
19
20
  export { setupWorkerBuild, teardownWorkerBuild } from './vitestWorker.js';
20
21
 
21
22
  //# sourceMappingURL=vitest.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest global setup entry point.\n *\n * Import this in your vitest.config.ts globalSetup array for automatic\n * test example setup and teardown.\n *\n * @example\n * ```typescript\n * // vitest.config.ts\n * import {defineConfig} from 'vitest/config'\n *\n * export default defineConfig({\n * test: {\n * globalSetup: ['@sanity/cli-test/vitest']\n * }\n * })\n * ```\n */\nexport {setup, teardown} from './test/setupExamples.js'\nexport {setupWorkerBuild, teardownWorkerBuild} from './vitestWorker.js'\n"],"names":["setup","teardown","setupWorkerBuild","teardownWorkerBuild"],"mappings":"AAAA;;;;;;;;;;;;;;;;;CAiBC,GACD,SAAQA,KAAK,EAAEC,QAAQ,QAAO,0BAAyB;AACvD,SAAQC,gBAAgB,EAAEC,mBAAmB,QAAO,oBAAmB"}
1
+ {"version":3,"sources":["../src/vitest.ts"],"sourcesContent":["/**\n * Vitest global setup entry point.\n *\n * Import this in your vitest.config.ts globalSetup array for automatic\n * test fixture setup and teardown.\n *\n * @example\n * ```typescript\n * // vitest.config.ts\n * import {defineConfig} from 'vitest/config'\n *\n * export default defineConfig({\n * test: {\n * globalSetup: ['@sanity/cli-test/vitest']\n * }\n * })\n * ```\n */\nexport {setup, teardown} from './test/setupFixtures.js'\nexport {snapshotSerializer} from './test/snapshotSerializer.js'\n\nexport {setupWorkerBuild, teardownWorkerBuild} from './vitestWorker.js'\n"],"names":["setup","teardown","snapshotSerializer","setupWorkerBuild","teardownWorkerBuild"],"mappings":"AAAA;;;;;;;;;;;;;;;;;CAiBC,GACD,SAAQA,KAAK,EAAEC,QAAQ,QAAO,0BAAyB;AACvD,SAAQC,kBAAkB,QAAO,+BAA8B;AAE/D,SAAQC,gBAAgB,EAAEC,mBAAmB,QAAO,oBAAmB"}
@@ -93,6 +93,8 @@ let buildContexts = [];
93
93
  * All npm packages are automatically marked as external (loaded from node_modules at runtime).
94
94
  * Only internal project code is bundled inline.
95
95
  *
96
+ * @public
97
+ *
96
98
  * @param filePaths - The paths to the worker files to build
97
99
  * @returns A promise that resolves when the worker build is setup
98
100
  * @throws If the worker files cannot be bundled
@@ -106,6 +108,8 @@ let buildContexts = [];
106
108
  *
107
109
  * Closes all build contexts and deletes the compiled JavaScript files.
108
110
  *
111
+ * @public
112
+ *
109
113
  * @returns A promise that resolves when the worker build is teared down
110
114
  * @throws If the build contexts cannot be disposed
111
115
  * @throws If the compiled JavaScript files cannot be deleted
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vitestWorker.ts"],"sourcesContent":["/**\n * Vitest worker setup for the Sanity CLI.\n *\n * This builds the worker TS files into JS files using esbuild bundling.\n * All internal dependencies are bundled inline, while npm packages remain external.\n */\nimport {unlink} from 'node:fs/promises'\n\nimport {build, type BuildContext, type BuildOptions, context} from 'esbuild'\n\nconst compiledFiles: Set<string> = new Set()\nlet buildContexts: BuildContext[] = []\n\n/**\n * Generate esbuild configuration for bundling worker files.\n *\n * @param filePath - The worker file path to bundle\n * @param outputFile - The output file path for the bundled worker\n * @returns esbuild configuration object\n */\nfunction esbuildOptions(filePath: string, outputFile: string): BuildOptions {\n return {\n bundle: true,\n conditions: ['node', 'import'],\n entryPoints: [filePath],\n // Marks cli-core as external to avoid bundling it inline\n // this is mostly necessary for the monorepo.\n external: ['@sanity/cli-core'],\n format: 'esm',\n loader: {'.json': 'json'},\n logLevel: 'warning',\n mainFields: ['module', 'main'],\n outfile: outputFile,\n packages: 'external',\n platform: 'node',\n sourcemap: false,\n target: 'node20',\n }\n}\n\n/**\n * Bundle a single worker file with esbuild.\n *\n * @param filePath - The worker file path to bundle\n * @param external - Array of package names to keep external\n * @returns The output file path\n */\nasync function bundleWorkerFile(filePath: string): Promise<string> {\n const outputFile = filePath.replace(/\\.ts$/, '.js')\n\n await build(esbuildOptions(filePath, outputFile))\n\n compiledFiles.add(outputFile)\n return outputFile\n}\n\n/**\n * Bundle all worker files with esbuild (non-watch mode).\n *\n * @param filePaths - Array of worker file paths to bundle\n */\nasync function setupBundling(filePaths: string[]) {\n console.log(`Found ${filePaths.length} worker files to bundle`)\n\n for (const workerFile of filePaths) {\n try {\n await bundleWorkerFile(workerFile)\n console.log(`✓ Bundled ${workerFile}`)\n } catch (error) {\n console.error(`✗ Failed to bundle ${workerFile}:`, error)\n throw error\n }\n }\n}\n\n/**\n * Set up watch mode for worker files using esbuild's native watch API.\n *\n * @param files - Array of worker file paths to watch\n */\nasync function setupWatchMode(files: string[]) {\n for (const filePath of files) {\n const outputFile = filePath.replace(/\\.ts$/, '.js')\n\n const ctx = await context(esbuildOptions(filePath, outputFile))\n\n await ctx.watch()\n buildContexts.push(ctx)\n compiledFiles.add(outputFile)\n\n console.log(`👀 Watching ${filePath}`)\n }\n}\n\n/**\n * Setup function to build the worker files with esbuild.\n *\n * Bundles the worker files with esbuild and sets up watch mode if in watch mode.\n * All npm packages are automatically marked as external (loaded from node_modules at runtime).\n * Only internal project code is bundled inline.\n *\n * @param filePaths - The paths to the worker files to build\n * @returns A promise that resolves when the worker build is setup\n * @throws If the worker files cannot be bundled\n * @throws If the watcher cannot be set up\n */\nexport async function setupWorkerBuild(filePaths: string[]) {\n const isWatchMode =\n (process.env.VITEST_WATCH === 'true' || !process.argv.includes('run')) &&\n process.env.CI !== 'true'\n\n await (isWatchMode ? setupWatchMode(filePaths) : setupBundling(filePaths))\n}\n\n/**\n * Teardown function to clean up the worker build.\n *\n * Closes all build contexts and deletes the compiled JavaScript files.\n *\n * @returns A promise that resolves when the worker build is teared down\n * @throws If the build contexts cannot be disposed\n * @throws If the compiled JavaScript files cannot be deleted\n */\nexport async function teardownWorkerBuild(): Promise<void> {\n // Dispose all build contexts (for watch mode)\n for (const ctx of buildContexts) {\n await ctx.dispose()\n }\n buildContexts = []\n\n // Clean up compiled JavaScript files\n console.log('Cleaning up compiled JavaScript files...')\n for (const filePath of compiledFiles) {\n try {\n await unlink(filePath)\n console.log(`✓ Deleted ${filePath}`)\n } catch (error) {\n console.error(`Failed to delete ${filePath}:`, error)\n }\n }\n compiledFiles.clear()\n}\n"],"names":["unlink","build","context","compiledFiles","Set","buildContexts","esbuildOptions","filePath","outputFile","bundle","conditions","entryPoints","external","format","loader","logLevel","mainFields","outfile","packages","platform","sourcemap","target","bundleWorkerFile","replace","add","setupBundling","filePaths","console","log","length","workerFile","error","setupWatchMode","files","ctx","watch","push","setupWorkerBuild","isWatchMode","process","env","VITEST_WATCH","argv","includes","CI","teardownWorkerBuild","dispose","clear"],"mappings":"AAAA;;;;;CAKC,GACD,SAAQA,MAAM,QAAO,mBAAkB;AAEvC,SAAQC,KAAK,EAAwCC,OAAO,QAAO,UAAS;AAE5E,MAAMC,gBAA6B,IAAIC;AACvC,IAAIC,gBAAgC,EAAE;AAEtC;;;;;;CAMC,GACD,SAASC,eAAeC,QAAgB,EAAEC,UAAkB;IAC1D,OAAO;QACLC,QAAQ;QACRC,YAAY;YAAC;YAAQ;SAAS;QAC9BC,aAAa;YAACJ;SAAS;QACvB,yDAAyD;QACzD,6CAA6C;QAC7CK,UAAU;YAAC;SAAmB;QAC9BC,QAAQ;QACRC,QAAQ;YAAC,SAAS;QAAM;QACxBC,UAAU;QACVC,YAAY;YAAC;YAAU;SAAO;QAC9BC,SAAST;QACTU,UAAU;QACVC,UAAU;QACVC,WAAW;QACXC,QAAQ;IACV;AACF;AAEA;;;;;;CAMC,GACD,eAAeC,iBAAiBf,QAAgB;IAC9C,MAAMC,aAAaD,SAASgB,OAAO,CAAC,SAAS;IAE7C,MAAMtB,MAAMK,eAAeC,UAAUC;IAErCL,cAAcqB,GAAG,CAAChB;IAClB,OAAOA;AACT;AAEA;;;;CAIC,GACD,eAAeiB,cAAcC,SAAmB;IAC9CC,QAAQC,GAAG,CAAC,CAAC,MAAM,EAAEF,UAAUG,MAAM,CAAC,uBAAuB,CAAC;IAE9D,KAAK,MAAMC,cAAcJ,UAAW;QAClC,IAAI;YACF,MAAMJ,iBAAiBQ;YACvBH,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEE,YAAY;QACvC,EAAE,OAAOC,OAAO;YACdJ,QAAQI,KAAK,CAAC,CAAC,mBAAmB,EAAED,WAAW,CAAC,CAAC,EAAEC;YACnD,MAAMA;QACR;IACF;AACF;AAEA;;;;CAIC,GACD,eAAeC,eAAeC,KAAe;IAC3C,KAAK,MAAM1B,YAAY0B,MAAO;QAC5B,MAAMzB,aAAaD,SAASgB,OAAO,CAAC,SAAS;QAE7C,MAAMW,MAAM,MAAMhC,QAAQI,eAAeC,UAAUC;QAEnD,MAAM0B,IAAIC,KAAK;QACf9B,cAAc+B,IAAI,CAACF;QACnB/B,cAAcqB,GAAG,CAAChB;QAElBmB,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAErB,UAAU;IACvC;AACF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,eAAe8B,iBAAiBX,SAAmB;IACxD,MAAMY,cACJ,AAACC,CAAAA,QAAQC,GAAG,CAACC,YAAY,KAAK,UAAU,CAACF,QAAQG,IAAI,CAACC,QAAQ,CAAC,MAAK,KACpEJ,QAAQC,GAAG,CAACI,EAAE,KAAK;IAErB,MAAON,CAAAA,cAAcN,eAAeN,aAAaD,cAAcC,UAAS;AAC1E;AAEA;;;;;;;;CAQC,GACD,OAAO,eAAemB;IACpB,8CAA8C;IAC9C,KAAK,MAAMX,OAAO7B,cAAe;QAC/B,MAAM6B,IAAIY,OAAO;IACnB;IACAzC,gBAAgB,EAAE;IAElB,qCAAqC;IACrCsB,QAAQC,GAAG,CAAC;IACZ,KAAK,MAAMrB,YAAYJ,cAAe;QACpC,IAAI;YACF,MAAMH,OAAOO;YACboB,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAErB,UAAU;QACrC,EAAE,OAAOwB,OAAO;YACdJ,QAAQI,KAAK,CAAC,CAAC,iBAAiB,EAAExB,SAAS,CAAC,CAAC,EAAEwB;QACjD;IACF;IACA5B,cAAc4C,KAAK;AACrB"}
1
+ {"version":3,"sources":["../src/vitestWorker.ts"],"sourcesContent":["/**\n * Vitest worker setup for the Sanity CLI.\n *\n * This builds the worker TS files into JS files using esbuild bundling.\n * All internal dependencies are bundled inline, while npm packages remain external.\n */\nimport {unlink} from 'node:fs/promises'\n\nimport {build, type BuildContext, type BuildOptions, context} from 'esbuild'\n\nconst compiledFiles: Set<string> = new Set()\nlet buildContexts: BuildContext[] = []\n\n/**\n * Generate esbuild configuration for bundling worker files.\n *\n * @param filePath - The worker file path to bundle\n * @param outputFile - The output file path for the bundled worker\n * @returns esbuild configuration object\n */\nfunction esbuildOptions(filePath: string, outputFile: string): BuildOptions {\n return {\n bundle: true,\n conditions: ['node', 'import'],\n entryPoints: [filePath],\n // Marks cli-core as external to avoid bundling it inline\n // this is mostly necessary for the monorepo.\n external: ['@sanity/cli-core'],\n format: 'esm',\n loader: {'.json': 'json'},\n logLevel: 'warning',\n mainFields: ['module', 'main'],\n outfile: outputFile,\n packages: 'external',\n platform: 'node',\n sourcemap: false,\n target: 'node20',\n }\n}\n\n/**\n * Bundle a single worker file with esbuild.\n *\n * @param filePath - The worker file path to bundle\n * @param external - Array of package names to keep external\n * @returns The output file path\n */\nasync function bundleWorkerFile(filePath: string): Promise<string> {\n const outputFile = filePath.replace(/\\.ts$/, '.js')\n\n await build(esbuildOptions(filePath, outputFile))\n\n compiledFiles.add(outputFile)\n return outputFile\n}\n\n/**\n * Bundle all worker files with esbuild (non-watch mode).\n *\n * @param filePaths - Array of worker file paths to bundle\n */\nasync function setupBundling(filePaths: string[]) {\n console.log(`Found ${filePaths.length} worker files to bundle`)\n\n for (const workerFile of filePaths) {\n try {\n await bundleWorkerFile(workerFile)\n console.log(`✓ Bundled ${workerFile}`)\n } catch (error) {\n console.error(`✗ Failed to bundle ${workerFile}:`, error)\n throw error\n }\n }\n}\n\n/**\n * Set up watch mode for worker files using esbuild's native watch API.\n *\n * @param files - Array of worker file paths to watch\n */\nasync function setupWatchMode(files: string[]) {\n for (const filePath of files) {\n const outputFile = filePath.replace(/\\.ts$/, '.js')\n\n const ctx = await context(esbuildOptions(filePath, outputFile))\n\n await ctx.watch()\n buildContexts.push(ctx)\n compiledFiles.add(outputFile)\n\n console.log(`👀 Watching ${filePath}`)\n }\n}\n\n/**\n * Setup function to build the worker files with esbuild.\n *\n * Bundles the worker files with esbuild and sets up watch mode if in watch mode.\n * All npm packages are automatically marked as external (loaded from node_modules at runtime).\n * Only internal project code is bundled inline.\n *\n * @public\n *\n * @param filePaths - The paths to the worker files to build\n * @returns A promise that resolves when the worker build is setup\n * @throws If the worker files cannot be bundled\n * @throws If the watcher cannot be set up\n */\nexport async function setupWorkerBuild(filePaths: string[]) {\n const isWatchMode =\n (process.env.VITEST_WATCH === 'true' || !process.argv.includes('run')) &&\n process.env.CI !== 'true'\n\n await (isWatchMode ? setupWatchMode(filePaths) : setupBundling(filePaths))\n}\n\n/**\n * Teardown function to clean up the worker build.\n *\n * Closes all build contexts and deletes the compiled JavaScript files.\n *\n * @public\n *\n * @returns A promise that resolves when the worker build is teared down\n * @throws If the build contexts cannot be disposed\n * @throws If the compiled JavaScript files cannot be deleted\n */\nexport async function teardownWorkerBuild(): Promise<void> {\n // Dispose all build contexts (for watch mode)\n for (const ctx of buildContexts) {\n await ctx.dispose()\n }\n buildContexts = []\n\n // Clean up compiled JavaScript files\n console.log('Cleaning up compiled JavaScript files...')\n for (const filePath of compiledFiles) {\n try {\n await unlink(filePath)\n console.log(`✓ Deleted ${filePath}`)\n } catch (error) {\n console.error(`Failed to delete ${filePath}:`, error)\n }\n }\n compiledFiles.clear()\n}\n"],"names":["unlink","build","context","compiledFiles","Set","buildContexts","esbuildOptions","filePath","outputFile","bundle","conditions","entryPoints","external","format","loader","logLevel","mainFields","outfile","packages","platform","sourcemap","target","bundleWorkerFile","replace","add","setupBundling","filePaths","console","log","length","workerFile","error","setupWatchMode","files","ctx","watch","push","setupWorkerBuild","isWatchMode","process","env","VITEST_WATCH","argv","includes","CI","teardownWorkerBuild","dispose","clear"],"mappings":"AAAA;;;;;CAKC,GACD,SAAQA,MAAM,QAAO,mBAAkB;AAEvC,SAAQC,KAAK,EAAwCC,OAAO,QAAO,UAAS;AAE5E,MAAMC,gBAA6B,IAAIC;AACvC,IAAIC,gBAAgC,EAAE;AAEtC;;;;;;CAMC,GACD,SAASC,eAAeC,QAAgB,EAAEC,UAAkB;IAC1D,OAAO;QACLC,QAAQ;QACRC,YAAY;YAAC;YAAQ;SAAS;QAC9BC,aAAa;YAACJ;SAAS;QACvB,yDAAyD;QACzD,6CAA6C;QAC7CK,UAAU;YAAC;SAAmB;QAC9BC,QAAQ;QACRC,QAAQ;YAAC,SAAS;QAAM;QACxBC,UAAU;QACVC,YAAY;YAAC;YAAU;SAAO;QAC9BC,SAAST;QACTU,UAAU;QACVC,UAAU;QACVC,WAAW;QACXC,QAAQ;IACV;AACF;AAEA;;;;;;CAMC,GACD,eAAeC,iBAAiBf,QAAgB;IAC9C,MAAMC,aAAaD,SAASgB,OAAO,CAAC,SAAS;IAE7C,MAAMtB,MAAMK,eAAeC,UAAUC;IAErCL,cAAcqB,GAAG,CAAChB;IAClB,OAAOA;AACT;AAEA;;;;CAIC,GACD,eAAeiB,cAAcC,SAAmB;IAC9CC,QAAQC,GAAG,CAAC,CAAC,MAAM,EAAEF,UAAUG,MAAM,CAAC,uBAAuB,CAAC;IAE9D,KAAK,MAAMC,cAAcJ,UAAW;QAClC,IAAI;YACF,MAAMJ,iBAAiBQ;YACvBH,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAEE,YAAY;QACvC,EAAE,OAAOC,OAAO;YACdJ,QAAQI,KAAK,CAAC,CAAC,mBAAmB,EAAED,WAAW,CAAC,CAAC,EAAEC;YACnD,MAAMA;QACR;IACF;AACF;AAEA;;;;CAIC,GACD,eAAeC,eAAeC,KAAe;IAC3C,KAAK,MAAM1B,YAAY0B,MAAO;QAC5B,MAAMzB,aAAaD,SAASgB,OAAO,CAAC,SAAS;QAE7C,MAAMW,MAAM,MAAMhC,QAAQI,eAAeC,UAAUC;QAEnD,MAAM0B,IAAIC,KAAK;QACf9B,cAAc+B,IAAI,CAACF;QACnB/B,cAAcqB,GAAG,CAAChB;QAElBmB,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAErB,UAAU;IACvC;AACF;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,eAAe8B,iBAAiBX,SAAmB;IACxD,MAAMY,cACJ,AAACC,CAAAA,QAAQC,GAAG,CAACC,YAAY,KAAK,UAAU,CAACF,QAAQG,IAAI,CAACC,QAAQ,CAAC,MAAK,KACpEJ,QAAQC,GAAG,CAACI,EAAE,KAAK;IAErB,MAAON,CAAAA,cAAcN,eAAeN,aAAaD,cAAcC,UAAS;AAC1E;AAEA;;;;;;;;;;CAUC,GACD,OAAO,eAAemB;IACpB,8CAA8C;IAC9C,KAAK,MAAMX,OAAO7B,cAAe;QAC/B,MAAM6B,IAAIY,OAAO;IACnB;IACAzC,gBAAgB,EAAE;IAElB,qCAAqC;IACrCsB,QAAQC,GAAG,CAAC;IACZ,KAAK,MAAMrB,YAAYJ,cAAe;QACpC,IAAI;YACF,MAAMH,OAAOO;YACboB,QAAQC,GAAG,CAAC,CAAC,UAAU,EAAErB,UAAU;QACrC,EAAE,OAAOwB,OAAO;YACdJ,QAAQI,KAAK,CAAC,CAAC,iBAAiB,EAAExB,SAAS,CAAC,CAAC,EAAEwB;QACjD;IACF;IACA5B,cAAc4C,KAAK;AACrB"}
@@ -8,20 +8,19 @@
8
8
  "license": "UNLICENSED",
9
9
  "main": "package.json",
10
10
  "scripts": {
11
- "build": "sanity build",
12
11
  "dev": "sanity dev",
13
12
  "start": "sanity start"
14
13
  },
15
14
  "dependencies": {
16
- "@sanity/sdk": "^2.5.0",
17
- "@sanity/sdk-react": "^2.5.0",
15
+ "@sanity/sdk": "^2.6.0",
16
+ "@sanity/sdk-react": "^2.6.0",
18
17
  "react": "^19.2.3",
19
18
  "react-dom": "^19.2.3",
20
- "sanity": "^5.6.0"
19
+ "sanity": "^5.8.1"
21
20
  },
22
21
  "devDependencies": {
23
- "@types/react": "^19.2.8",
24
- "sanity": "^5.6.0",
22
+ "@types/react": "^19.2.9",
23
+ "sanity": "^5.8.1",
25
24
  "typescript": "^5.9.3"
26
25
  }
27
26
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "@sanity/basic-studio",
2
+ "name": "basic-studio",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "keywords": [
@@ -9,21 +9,20 @@
9
9
  "type": "module",
10
10
  "main": "package.json",
11
11
  "scripts": {
12
- "build": "sanity build",
13
12
  "deploy": "sanity deploy",
14
13
  "deploy-graphql": "sanity graphql deploy",
15
14
  "dev": "sanity dev",
16
15
  "start": "sanity start"
17
16
  },
18
17
  "dependencies": {
19
- "@sanity/vision": "^5.6.0",
18
+ "@sanity/vision": "^5.8.1",
20
19
  "react": "^19.2.3",
21
20
  "react-dom": "^19.2.3",
22
- "sanity": "^5.6.0",
23
- "styled-components": "^6.3.5"
21
+ "sanity": "^5.8.1",
22
+ "styled-components": "^6.3.8"
24
23
  },
25
24
  "devDependencies": {
26
- "@types/react": "^19.2.8",
25
+ "@types/react": "^19.2.9",
27
26
  "typescript": "^5.9.3"
28
27
  }
29
28
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "@sanity/multi-workspace-studio",
2
+ "name": "multi-workspace-studio",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "keywords": [
@@ -9,21 +9,20 @@
9
9
  "type": "module",
10
10
  "main": "package.json",
11
11
  "scripts": {
12
- "build": "sanity build",
13
12
  "deploy": "sanity deploy",
14
13
  "deploy-graphql": "sanity graphql deploy",
15
14
  "dev": "sanity dev",
16
15
  "start": "sanity start"
17
16
  },
18
17
  "dependencies": {
19
- "@sanity/vision": "^5.6.0",
18
+ "@sanity/vision": "^5.8.1",
20
19
  "react": "^19.2.3",
21
20
  "react-dom": "^19.2.3",
22
- "sanity": "^5.6.0",
23
- "styled-components": "^6.3.5"
21
+ "sanity": "^5.8.1",
22
+ "styled-components": "^6.3.8"
24
23
  },
25
24
  "devDependencies": {
26
- "@types/react": "^19.2.8",
25
+ "@types/react": "^19.2.9",
27
26
  "typescript": "^5.9.3"
28
27
  }
29
28
  }
@@ -0,0 +1,3 @@
1
+ This is a partial fixture - the built app does not actually _work_.
2
+
3
+ It is provided to test serving of a built application, which does not need a fully valid, compiled application - only something that appears to be an app.
@@ -0,0 +1,102 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport" />
6
+ <meta content="noindex" name="robots" />
7
+ <meta content="same-origin" name="referrer" />
8
+ <title>Sanity CORE App</title>
9
+ <link href="/static/sanity-CtOxKsdo.css" rel="stylesheet" />
10
+ <script type="application/json" id="__imports">
11
+ {
12
+ "imports": {
13
+ "react": "/vendor/react/index-CVS62ceT.mjs",
14
+ "react/compiler-runtime": "/vendor/react/compiler-runtime-DFvlMPQC.mjs",
15
+ "react/jsx-dev-runtime": "/vendor/react/jsx-dev-runtime-DYLplPiq.mjs",
16
+ "react/jsx-runtime": "/vendor/react/jsx-runtime-CInpRuN4.mjs",
17
+ "react/package.json": "/vendor/react/package.json-B3Sv_Ots.mjs",
18
+ "react-dom": "/vendor/react-dom/index-B3pchmCn.mjs",
19
+ "react-dom/client": "/vendor/react-dom/client-BptInOSw.mjs",
20
+ "react-dom/package.json": "/vendor/react-dom/package.json-CNqBlmzA.mjs",
21
+ "react-dom/server": "/vendor/react-dom/server-FfCSsckh.mjs",
22
+ "react-dom/static": "/vendor/react-dom/static-CN1Myo0a.mjs",
23
+ "styled-components": "/vendor/styled-components/index-X329-4Jb.mjs",
24
+ "styled-components/package.json": "/vendor/styled-components/package.json-DqoIBjAO.mjs",
25
+ "react-dom/server.browser": "/vendor/react-dom/server.browser-BzpYnHww.mjs",
26
+ "react-dom/static.browser": "/vendor/react-dom/static.browser-BCHXHC4T.mjs",
27
+ "@sanity/sdk": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk",
28
+ "@sanity/sdk/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk/",
29
+ "@sanity/sdk-react": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk-react",
30
+ "@sanity/sdk-react/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk-react/",
31
+ "sanity": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E5.7.0/sanity",
32
+ "sanity/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E5.7.0/sanity/"
33
+ }
34
+ }
35
+ </script>
36
+ <script>
37
+ // auto-generated script to add import map with timestamp
38
+ const importsJson = document.getElementById('__imports')?.textContent
39
+ const {imports = {}, ...rest} = importsJson ? JSON.parse(importsJson) : {}
40
+ const importMapEl = document.createElement('script')
41
+ importMapEl.type = 'importmap'
42
+ const newTimestamp = `/t${Math.floor(Date.now() / 1000)}`
43
+ importMapEl.textContent = JSON.stringify({
44
+ imports: Object.fromEntries(
45
+ Object.entries(imports).map(([specifier, path]) => {
46
+ try {
47
+ const url = new URL(path)
48
+ if (/^sanity-cdn\.[a-zA-Z]+$/.test(url.hostname)) {
49
+ url.pathname = url.pathname.replace(/\/t\d+/, newTimestamp)
50
+ }
51
+ return [specifier, url.toString()]
52
+ } catch {
53
+ return [specifier, path]
54
+ }
55
+ }),
56
+ ),
57
+ ...rest,
58
+ })
59
+ document.head.appendChild(importMapEl)
60
+ </script>
61
+ <script
62
+ src="https://core.sanity-cdn.com/bridge.js"
63
+ async
64
+ type="module"
65
+ data-sanity-core
66
+ ></script>
67
+ </head>
68
+ <body>
69
+ <div id="root"></div>
70
+ <script src="/static/sanity-D4a4eOYZ.js" type="module"></script>
71
+ <noscript
72
+ ><div class="sanity-app-no-js__root">
73
+ <div class="sanity-app-no-js__content">
74
+ <style type="text/css">
75
+ .sanity-app-no-js__root {
76
+ position: absolute;
77
+ top: 0;
78
+ right: 0;
79
+ left: 0;
80
+ bottom: 0;
81
+ background: #fff;
82
+ }
83
+
84
+ .sanity-app-no-js__content {
85
+ position: absolute;
86
+ top: 50%;
87
+ left: 50%;
88
+ transform: translate(-50%, -50%);
89
+ text-align: center;
90
+ font-family: helvetica, arial, sans-serif;
91
+ }
92
+ </style>
93
+ <h1>JavaScript disabled</h1>
94
+ <p>
95
+ Please <a href="https://www.enable-javascript.com/">enable JavaScript</a> in your
96
+ browser and reload the page to proceed.
97
+ </p>
98
+ </div>
99
+ </div></noscript
100
+ >
101
+ </body>
102
+ </html>
@@ -0,0 +1,24 @@
1
+ .app-container {
2
+ max-width: 1200px;
3
+ margin: 0 auto;
4
+ padding: 2rem;
5
+ font-family:
6
+ -apple-system,
7
+ BlinkMacSystemFont,
8
+ Segoe UI,
9
+ Roboto,
10
+ Oxygen,
11
+ Ubuntu,
12
+ Cantarell,
13
+ Open Sans,
14
+ Helvetica Neue,
15
+ sans-serif;
16
+ }
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+ body {
21
+ margin: 0;
22
+ padding: 0;
23
+ background-color: #f9f9f9;
24
+ }
@@ -0,0 +1,17 @@
1
+ import {createRoot as e} from 'react-dom/client'
2
+ import {createElement as o} from 'react'
3
+ import {jsx as t} from 'react/jsx-runtime'
4
+ import {SanityApp as n} from '@sanity/sdk-react'
5
+ function r() {
6
+ return t('div', {
7
+ className: 'app-container',
8
+ children: t(n, {
9
+ config: [{dataset: 'dataset-name', projectId: 'project-id'}],
10
+ fallback: t('div', {children: 'Loading...'}),
11
+ children: t('div', {}),
12
+ }),
13
+ })
14
+ }
15
+ const i = e(document.getElementById('root')),
16
+ a = o(r)
17
+ i.render(a)
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "prebuilt-app",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "keywords": [
6
+ "sanity"
7
+ ],
8
+ "license": "UNLICENSED",
9
+ "main": "package.json",
10
+ "scripts": {
11
+ "dev": "sanity dev",
12
+ "preview": "sanity preview"
13
+ },
14
+ "dependencies": {
15
+ "@sanity/sdk": "^2.6.0",
16
+ "@sanity/sdk-react": "^2.6.0",
17
+ "react": "^19.2.3",
18
+ "react-dom": "^19.2.3",
19
+ "sanity": "^5.8.1"
20
+ },
21
+ "devDependencies": {
22
+ "@types/react": "^19.2.9",
23
+ "sanity": "^5.8.1",
24
+ "typescript": "^5.9.3"
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ import {defineCliConfig} from 'sanity/cli'
2
+
3
+ export default defineCliConfig({
4
+ app: {
5
+ entry: './src/App.tsx',
6
+ organizationId: 'org-id',
7
+ },
8
+ deployment: {
9
+ appId: 'app-id',
10
+ autoUpdates: true,
11
+ },
12
+ })
@@ -0,0 +1,20 @@
1
+ /* Container styling for the app */
2
+ .app-container {
3
+ max-width: 1200px;
4
+ margin: 0 auto;
5
+ padding: 2rem;
6
+ font-family:
7
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
8
+ 'Helvetica Neue', sans-serif;
9
+ }
10
+
11
+ /* Basic reset */
12
+ * {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ margin: 0;
18
+ padding: 0;
19
+ background-color: #f9f9f9;
20
+ }
@@ -0,0 +1,24 @@
1
+ import {type SanityConfig} from '@sanity/sdk'
2
+ import {SanityApp} from '@sanity/sdk-react'
3
+
4
+ import './App.css'
5
+
6
+ function App() {
7
+ // apps can access many different projects or other sources of data
8
+ const sanityConfigs: SanityConfig[] = [
9
+ {
10
+ dataset: 'dataset-name',
11
+ projectId: 'project-id',
12
+ },
13
+ ]
14
+
15
+ return (
16
+ <div className="app-container">
17
+ <SanityApp config={sanityConfigs} fallback={<div>Loading...</div>}>
18
+ <div />
19
+ </SanityApp>
20
+ </div>
21
+ )
22
+ }
23
+
24
+ export default App
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "module": "Preserve",
10
+ "moduleDetection": "force",
11
+ "isolatedModules": true,
12
+ "jsx": "preserve",
13
+ "incremental": true
14
+ },
15
+ "include": ["**/*.ts", "**/*.tsx"],
16
+ "exclude": ["node_modules"]
17
+ }
@@ -0,0 +1,3 @@
1
+ This is a partial fixture - the built studio does not actually _work_.
2
+
3
+ It is provided to test serving of a built studio, which does not need a fully valid, compiled studio - only something that appears to be a studio.