@sanity/cli 8.3.0 → 8.4.1

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 (115) hide show
  1. package/dist/actions/build/buildApp.js +14 -7
  2. package/dist/actions/build/buildApp.js.map +1 -1
  3. package/dist/actions/build/buildStudio.js +3 -3
  4. package/dist/actions/build/buildStudio.js.map +1 -1
  5. package/dist/actions/deploy/deployApp.js +32 -25
  6. package/dist/actions/deploy/deployApp.js.map +1 -1
  7. package/dist/actions/deploy/deployStudio.js +2 -1
  8. package/dist/actions/deploy/deployStudio.js.map +1 -1
  9. package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js +2 -4
  10. package/dist/actions/deploy/deployStudioSchemasAndManifests.worker.js.map +1 -1
  11. package/dist/actions/deploy/deploymentPlan.js.map +1 -1
  12. package/dist/actions/dev/devAction.js +2 -2
  13. package/dist/actions/dev/devAction.js.map +1 -1
  14. package/dist/actions/dev/servers/getDevServerConfig.js +13 -6
  15. package/dist/actions/dev/servers/getDevServerConfig.js.map +1 -1
  16. package/dist/actions/dev/servers/startAppDevServer.js +4 -2
  17. package/dist/actions/dev/servers/startAppDevServer.js.map +1 -1
  18. package/dist/actions/graphql/gen1/generateTypeFilters.js +1 -2
  19. package/dist/actions/graphql/gen1/generateTypeFilters.js.map +1 -1
  20. package/dist/actions/graphql/resolveGraphQLApisFromWorkspaces.js +5 -2
  21. package/dist/actions/graphql/resolveGraphQLApisFromWorkspaces.js.map +1 -1
  22. package/dist/actions/init/templates/shopify.js +2 -1
  23. package/dist/actions/init/templates/shopify.js.map +1 -1
  24. package/dist/actions/manifest/extractManifest.js +5 -37
  25. package/dist/actions/manifest/extractManifest.js.map +1 -1
  26. package/dist/actions/manifest/extractStudioManifest.js +1 -1
  27. package/dist/actions/manifest/extractStudioManifest.js.map +1 -1
  28. package/dist/actions/preview/previewAction.js +1 -1
  29. package/dist/actions/preview/previewAction.js.map +1 -1
  30. package/dist/actions/schema/deleteSchemaAction.js +1 -1
  31. package/dist/actions/schema/deleteSchemaAction.js.map +1 -1
  32. package/dist/actions/schema/deploySchemas.js.map +1 -1
  33. package/dist/actions/schema/extractSanityWorkspace.worker.js +1 -1
  34. package/dist/actions/schema/extractSanityWorkspace.worker.js.map +1 -1
  35. package/dist/actions/schema/listSchemas.js +1 -1
  36. package/dist/actions/schema/listSchemas.js.map +1 -1
  37. package/dist/actions/schema/schemaTypeHelpers.js +5 -0
  38. package/dist/actions/schema/schemaTypeHelpers.js.map +1 -0
  39. package/dist/actions/schema/updateWorkspaceSchema.js +1 -1
  40. package/dist/actions/schema/updateWorkspaceSchema.js.map +1 -1
  41. package/dist/actions/schema/utils/schemaStoreValidation.js +2 -2
  42. package/dist/actions/schema/utils/schemaStoreValidation.js.map +1 -1
  43. package/dist/actions/schema/utils/workspaceSchemaId.js +1 -1
  44. package/dist/actions/schema/utils/workspaceSchemaId.js.map +1 -1
  45. package/dist/actions/versions/getFormatters.js +1 -2
  46. package/dist/actions/versions/getFormatters.js.map +1 -1
  47. package/dist/commands/documents/create.js +4 -4
  48. package/dist/commands/documents/create.js.map +1 -1
  49. package/dist/commands/hooks/logs.js +1 -2
  50. package/dist/commands/hooks/logs.js.map +1 -1
  51. package/dist/commands/projects/list.js +3 -5
  52. package/dist/commands/projects/list.js.map +1 -1
  53. package/dist/commands/undeploy.js +7 -5
  54. package/dist/commands/undeploy.js.map +1 -1
  55. package/dist/commands/users/list.js +3 -5
  56. package/dist/commands/users/list.js.map +1 -1
  57. package/dist/commands/versions.js +1 -2
  58. package/dist/commands/versions.js.map +1 -1
  59. package/dist/exports/_internal.d.ts +1 -67
  60. package/dist/exports/_internal.js +1 -1
  61. package/dist/exports/_internal.js.map +1 -1
  62. package/dist/exports/index.d.ts +2 -2
  63. package/dist/exports/index.js +2 -1
  64. package/dist/exports/index.js.map +1 -1
  65. package/dist/exports/runtime.d.ts +2 -2
  66. package/dist/exports/runtime.js +1 -1
  67. package/dist/exports/runtime.js.map +1 -1
  68. package/dist/generated/apiRoutes.js +4 -0
  69. package/dist/generated/apiRoutes.js.map +1 -1
  70. package/dist/prompts/selectMediaLibrary.js +2 -3
  71. package/dist/prompts/selectMediaLibrary.js.map +1 -1
  72. package/dist/services/mintProject.js +27 -14
  73. package/dist/services/mintProject.js.map +1 -1
  74. package/dist/services/schemas.js.map +1 -1
  75. package/dist/services/userApplications.js.map +1 -1
  76. package/dist/util/determineIsApp.js +1 -1
  77. package/dist/util/determineIsApp.js.map +1 -1
  78. package/dist/util/sortRowsByColumn.js +23 -0
  79. package/dist/util/sortRowsByColumn.js.map +1 -0
  80. package/oclif.manifest.json +253 -253
  81. package/package.json +6 -9
  82. package/dist/actions/manifest/blockTypeTransformer.js +0 -67
  83. package/dist/actions/manifest/blockTypeTransformer.js.map +0 -1
  84. package/dist/actions/manifest/extractCoreAppManifest.js +0 -111
  85. package/dist/actions/manifest/extractCoreAppManifest.js.map +0 -1
  86. package/dist/actions/manifest/extractManifest.worker.js +0 -30
  87. package/dist/actions/manifest/extractManifest.worker.js.map +0 -1
  88. package/dist/actions/manifest/extractWorkspaceManifest.js +0 -72
  89. package/dist/actions/manifest/extractWorkspaceManifest.js.map +0 -1
  90. package/dist/actions/manifest/iconResolver.js +0 -36
  91. package/dist/actions/manifest/iconResolver.js.map +0 -1
  92. package/dist/actions/manifest/purifyConfig.js +0 -307
  93. package/dist/actions/manifest/purifyConfig.js.map +0 -1
  94. package/dist/actions/manifest/referenceTransformer.js +0 -51
  95. package/dist/actions/manifest/referenceTransformer.js.map +0 -1
  96. package/dist/actions/manifest/resolveSchemaIcon.js +0 -43
  97. package/dist/actions/manifest/resolveSchemaIcon.js.map +0 -1
  98. package/dist/actions/manifest/sanitizeIcon.js +0 -13
  99. package/dist/actions/manifest/sanitizeIcon.js.map +0 -1
  100. package/dist/actions/manifest/schemaTypeHelpers.js +0 -110
  101. package/dist/actions/manifest/schemaTypeHelpers.js.map +0 -1
  102. package/dist/actions/manifest/schemaTypeTransformer.js +0 -169
  103. package/dist/actions/manifest/schemaTypeTransformer.js.map +0 -1
  104. package/dist/actions/manifest/transformerUtils.js +0 -40
  105. package/dist/actions/manifest/transformerUtils.js.map +0 -1
  106. package/dist/actions/manifest/types.js +0 -13
  107. package/dist/actions/manifest/types.js.map +0 -1
  108. package/dist/actions/manifest/validationTransformer.js +0 -84
  109. package/dist/actions/manifest/validationTransformer.js.map +0 -1
  110. package/dist/actions/manifest/writeManifestFile.js +0 -29
  111. package/dist/actions/manifest/writeManifestFile.js.map +0 -1
  112. package/dist/actions/manifest/writeWorkspaceFiles.js +0 -30
  113. package/dist/actions/manifest/writeWorkspaceFiles.js.map +0 -1
  114. package/dist/actions/schema/uploadSchemaToLexicon.js +0 -91
  115. package/dist/actions/schema/uploadSchemaToLexicon.js.map +0 -1
@@ -1,111 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { relative, resolve } from 'node:path';
3
- import { doImport, getCliConfigUncached } from '@sanity/cli-core';
4
- import { getErrorMessage } from '@sanity/cli-core/errors';
5
- import { spinner } from '@sanity/cli-core/ux';
6
- import { isWorkbenchApp } from '@sanity/workbench-cli';
7
- import { coreAppManifestSchema } from './types.js';
8
- /**
9
- * The title change a deploy would sync from the manifest to the user
10
- * application, or null when the titles already match (or none is set).
11
- *
12
- * @internal
13
- */ export function resolveTitleUpdate(manifest, application) {
14
- if (manifest?.title === undefined || manifest.title === application.title) {
15
- return null;
16
- }
17
- return {
18
- from: application.title,
19
- to: manifest.title
20
- };
21
- }
22
- const sanitizeIconPath = new URL('sanitizeIcon.js', import.meta.url).href;
23
- /**
24
- * Lazy-load {@link sanitizeIconFn} so `isomorphic-dompurify` (and its jsdom
25
- * dependency) stays out of the CLI's eager import graph. The studio manifest
26
- * resolver lazy-loads its icon machinery for the same reason; this path runs in
27
- * the main process (not the manifest worker), so only an app deploy that
28
- * actually has an icon pays the cost.
29
- */ async function lazySanitizeIcon() {
30
- const mod = await doImport(sanitizeIconPath);
31
- return mod.sanitizeIcon;
32
- }
33
- /**
34
- * Resolves app.icon from config (a file path) to a sanitized SVG string. Used
35
- * both for the manifest and, on deploy, for the icon shipped to Brett — the
36
- * manifest expects the SVG inline, not a path.
37
- *
38
- * The file is sanitized through the same allowlist as the studio manifest's
39
- * icon resolver (see {@link lazySanitizeIcon}) so both manifest paths inline the
40
- * same trusted subset of SVG markup.
41
- * @internal
42
- */ export async function readIconFromPath(workDir, iconPath) {
43
- const resolvedPath = resolve(workDir, iconPath);
44
- const pathRelativeToWorkDir = relative(workDir, resolvedPath);
45
- if (pathRelativeToWorkDir.startsWith('..')) {
46
- throw new Error(`Icon path "${iconPath}" resolves outside the project directory and is not allowed.`);
47
- }
48
- let content;
49
- try {
50
- content = await readFile(resolvedPath, 'utf8');
51
- } catch (err) {
52
- const message = err instanceof Error ? err.message : String(err);
53
- throw new Error(`Could not read icon file at "${iconPath}" (resolved: ${resolvedPath}): ${message}`, {
54
- cause: err
55
- });
56
- }
57
- const trimmed = content.trim();
58
- if (!/<svg[\s>]/i.test(trimmed)) {
59
- throw new Error(`Icon file at "${iconPath}" does not contain an SVG element. App manifest icons must be SVG files.`);
60
- }
61
- const sanitizeIcon = await lazySanitizeIcon();
62
- return sanitizeIcon(trimmed);
63
- }
64
- /**
65
- * Unlike studio manifest extraction, skips schema/tool parsing. The config's
66
- * `app.icon` is a file path; its content is read and inlined in the manifest.
67
- */ export async function extractCoreAppManifest(options) {
68
- const { workDir } = options;
69
- const { app } = await getCliConfigUncached(workDir);
70
- if (!app) {
71
- return undefined;
72
- }
73
- const spin = spinner('Extracting manifest').start();
74
- try {
75
- let icon;
76
- if (app.icon) {
77
- icon = await readIconFromPath(workDir, app.icon);
78
- }
79
- if (!icon && !app.title) {
80
- spin.info('Manifest creation skipped: no icon or title found in app configuration');
81
- return undefined;
82
- }
83
- const workbench = isWorkbenchApp(app) ? app : undefined;
84
- const manifest = coreAppManifestSchema.parse({
85
- version: '1',
86
- ...icon ? {
87
- icon
88
- } : {},
89
- ...app.title ? {
90
- title: app.title
91
- } : {},
92
- ...workbench?.group ? {
93
- group: workbench.group
94
- } : {},
95
- ...workbench?.priority === undefined ? {} : {
96
- priority: workbench.priority
97
- },
98
- ...workbench?.slug ? {
99
- slug: workbench.slug
100
- } : {}
101
- });
102
- spin.succeed(`Extracted manifest`);
103
- return manifest;
104
- } catch (err) {
105
- const message = getErrorMessage(err);
106
- spin.fail(message);
107
- throw err;
108
- }
109
- }
110
-
111
- //# sourceMappingURL=extractCoreAppManifest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/extractCoreAppManifest.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport {relative, resolve} from 'node:path'\n\nimport {doImport, getCliConfigUncached} from '@sanity/cli-core'\nimport {getErrorMessage} from '@sanity/cli-core/errors'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {isWorkbenchApp} from '@sanity/workbench-cli'\n\nimport {type sanitizeIcon as sanitizeIconFn} from './sanitizeIcon.js'\nimport {type CoreAppManifest, coreAppManifestSchema} from './types.js'\n\ninterface ExtractCoreAppManifestOptions {\n workDir: string\n}\n\n/**\n * The title change a deploy would sync from the manifest to the user\n * application, or null when the titles already match (or none is set).\n *\n * @internal\n */\nexport function resolveTitleUpdate(\n manifest: CoreAppManifest | undefined,\n application: {title: string | null},\n): {from: string | null; to: string} | null {\n if (manifest?.title === undefined || manifest.title === application.title) {\n return null\n }\n return {from: application.title, to: manifest.title}\n}\n\nconst sanitizeIconPath = new URL('sanitizeIcon.js', import.meta.url).href\n\n/**\n * Lazy-load {@link sanitizeIconFn} so `isomorphic-dompurify` (and its jsdom\n * dependency) stays out of the CLI's eager import graph. The studio manifest\n * resolver lazy-loads its icon machinery for the same reason; this path runs in\n * the main process (not the manifest worker), so only an app deploy that\n * actually has an icon pays the cost.\n */\nasync function lazySanitizeIcon(): Promise<typeof sanitizeIconFn> {\n const mod = await doImport(sanitizeIconPath)\n return mod.sanitizeIcon\n}\n\n/**\n * Resolves app.icon from config (a file path) to a sanitized SVG string. Used\n * both for the manifest and, on deploy, for the icon shipped to Brett — the\n * manifest expects the SVG inline, not a path.\n *\n * The file is sanitized through the same allowlist as the studio manifest's\n * icon resolver (see {@link lazySanitizeIcon}) so both manifest paths inline the\n * same trusted subset of SVG markup.\n * @internal\n */\nexport async function readIconFromPath(workDir: string, iconPath: string): Promise<string> {\n const resolvedPath = resolve(workDir, iconPath)\n const pathRelativeToWorkDir = relative(workDir, resolvedPath)\n if (pathRelativeToWorkDir.startsWith('..')) {\n throw new Error(\n `Icon path \"${iconPath}\" resolves outside the project directory and is not allowed.`,\n )\n }\n\n let content: string\n try {\n content = await readFile(resolvedPath, 'utf8')\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(\n `Could not read icon file at \"${iconPath}\" (resolved: ${resolvedPath}): ${message}`,\n {cause: err},\n )\n }\n\n const trimmed = content.trim()\n if (!/<svg[\\s>]/i.test(trimmed)) {\n throw new Error(\n `Icon file at \"${iconPath}\" does not contain an SVG element. App manifest icons must be SVG files.`,\n )\n }\n\n const sanitizeIcon = await lazySanitizeIcon()\n return sanitizeIcon(trimmed)\n}\n\n/**\n * Unlike studio manifest extraction, skips schema/tool parsing. The config's\n * `app.icon` is a file path; its content is read and inlined in the manifest.\n */\nexport async function extractCoreAppManifest(\n options: ExtractCoreAppManifestOptions,\n): Promise<CoreAppManifest | undefined> {\n const {workDir} = options\n const {app} = await getCliConfigUncached(workDir)\n if (!app) {\n return undefined\n }\n\n const spin = spinner('Extracting manifest').start()\n\n try {\n let icon: string | undefined\n if (app.icon) {\n icon = await readIconFromPath(workDir, app.icon)\n }\n\n if (!icon && !app.title) {\n spin.info('Manifest creation skipped: no icon or title found in app configuration')\n return undefined\n }\n\n const workbench = isWorkbenchApp(app) ? app : undefined\n\n const manifest: CoreAppManifest = coreAppManifestSchema.parse({\n version: '1',\n ...(icon ? {icon} : {}),\n ...(app.title ? {title: app.title} : {}),\n ...(workbench?.group ? {group: workbench.group} : {}),\n ...(workbench?.priority === undefined ? {} : {priority: workbench.priority}),\n ...(workbench?.slug ? {slug: workbench.slug} : {}),\n })\n\n spin.succeed(`Extracted manifest`)\n\n return manifest\n } catch (err) {\n const message = getErrorMessage(err)\n spin.fail(message)\n throw err\n }\n}\n"],"names":["readFile","relative","resolve","doImport","getCliConfigUncached","getErrorMessage","spinner","isWorkbenchApp","coreAppManifestSchema","resolveTitleUpdate","manifest","application","title","undefined","from","to","sanitizeIconPath","URL","url","href","lazySanitizeIcon","mod","sanitizeIcon","readIconFromPath","workDir","iconPath","resolvedPath","pathRelativeToWorkDir","startsWith","Error","content","err","message","String","cause","trimmed","trim","test","extractCoreAppManifest","options","app","spin","start","icon","info","workbench","parse","version","group","priority","slug","succeed","fail"],"mappings":"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"}
@@ -1,30 +0,0 @@
1
- import { isMainThread, parentPort, workerData } from 'node:worker_threads';
2
- import { extractValidationFromSchemaError } from '@sanity/cli-build/_internal/extract';
3
- import { getStudioWorkspaces, subdebug } from '@sanity/cli-core';
4
- import { extractWorkspaceManifest } from './extractWorkspaceManifest.js';
5
- import { extractManifestWorkerData } from './types.js';
6
- if (isMainThread || !parentPort) {
7
- throw new Error('Should only be run in a worker!');
8
- }
9
- const debug = subdebug('extractManifest.worker');
10
- const { configPath, workDir } = extractManifestWorkerData.parse(workerData);
11
- try {
12
- debug('Extracting workspace manifests from config path %s', configPath);
13
- const workspaces = await getStudioWorkspaces(configPath);
14
- debug('Workspaces %o', workspaces);
15
- const workspaceManifests = await extractWorkspaceManifest(workspaces, workDir);
16
- parentPort.postMessage({
17
- type: 'success',
18
- workspaceManifests
19
- });
20
- } catch (error) {
21
- debug('Error extracting workspace manifests', error);
22
- const validation = await extractValidationFromSchemaError(error, workDir);
23
- parentPort.postMessage({
24
- error: error instanceof Error ? error.message : String(error),
25
- type: 'error',
26
- validation
27
- });
28
- }
29
-
30
- //# sourceMappingURL=extractManifest.worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/extractManifest.worker.ts"],"sourcesContent":["import {isMainThread, parentPort, workerData} from 'node:worker_threads'\n\nimport {extractValidationFromSchemaError} from '@sanity/cli-build/_internal/extract'\nimport {getStudioWorkspaces, subdebug} from '@sanity/cli-core'\n\nimport {extractWorkspaceManifest} from './extractWorkspaceManifest.js'\nimport {extractManifestWorkerData} from './types.js'\n\nif (isMainThread || !parentPort) {\n throw new Error('Should only be run in a worker!')\n}\n\nconst debug = subdebug('extractManifest.worker')\n\nconst {configPath, workDir} = extractManifestWorkerData.parse(workerData)\n\ntry {\n debug('Extracting workspace manifests from config path %s', configPath)\n const workspaces = await getStudioWorkspaces(configPath)\n debug('Workspaces %o', workspaces)\n const workspaceManifests = await extractWorkspaceManifest(workspaces, workDir)\n\n parentPort.postMessage({\n type: 'success',\n workspaceManifests,\n })\n} catch (error) {\n debug('Error extracting workspace manifests', error)\n const validation = await extractValidationFromSchemaError(error, workDir)\n parentPort.postMessage({\n error: error instanceof Error ? error.message : String(error),\n type: 'error',\n validation,\n })\n}\n"],"names":["isMainThread","parentPort","workerData","extractValidationFromSchemaError","getStudioWorkspaces","subdebug","extractWorkspaceManifest","extractManifestWorkerData","Error","debug","configPath","workDir","parse","workspaces","workspaceManifests","postMessage","type","error","validation","message","String"],"mappings":"AAAA,SAAQA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAO,sBAAqB;AAExE,SAAQC,gCAAgC,QAAO,sCAAqC;AACpF,SAAQC,mBAAmB,EAAEC,QAAQ,QAAO,mBAAkB;AAE9D,SAAQC,wBAAwB,QAAO,gCAA+B;AACtE,SAAQC,yBAAyB,QAAO,aAAY;AAEpD,IAAIP,gBAAgB,CAACC,YAAY;IAC/B,MAAM,IAAIO,MAAM;AAClB;AAEA,MAAMC,QAAQJ,SAAS;AAEvB,MAAM,EAACK,UAAU,EAAEC,OAAO,EAAC,GAAGJ,0BAA0BK,KAAK,CAACV;AAE9D,IAAI;IACFO,MAAM,sDAAsDC;IAC5D,MAAMG,aAAa,MAAMT,oBAAoBM;IAC7CD,MAAM,iBAAiBI;IACvB,MAAMC,qBAAqB,MAAMR,yBAAyBO,YAAYF;IAEtEV,WAAWc,WAAW,CAAC;QACrBC,MAAM;QACNF;IACF;AACF,EAAE,OAAOG,OAAO;IACdR,MAAM,wCAAwCQ;IAC9C,MAAMC,aAAa,MAAMf,iCAAiCc,OAAON;IACjEV,WAAWc,WAAW,CAAC;QACrBE,OAAOA,iBAAiBT,QAAQS,MAAME,OAAO,GAAGC,OAAOH;QACvDD,MAAM;QACNE;IACF;AACF"}
@@ -1,72 +0,0 @@
1
- import { doImport, resolveLocalPackage } from '@sanity/cli-core';
2
- import { transformType } from './schemaTypeTransformer.js';
3
- const iconResolverPath = new URL('iconResolver.js', import.meta.url).href;
4
- async function lazyResolveIcon() {
5
- const mod = await doImport(iconResolverPath);
6
- return mod.resolveIcon;
7
- }
8
- /**
9
- * Extracts manifest data from an array of workspaces
10
- */ export async function extractWorkspaceManifest(workspaces, workDir) {
11
- const resolveIcon = await lazyResolveIcon();
12
- return Promise.all(workspaces.map(async (workspace)=>{
13
- const [icon, serializedSchema, serializedTools] = await Promise.all([
14
- resolveIcon({
15
- icon: workspace.icon,
16
- subtitle: workspace.subtitle,
17
- title: workspace.title,
18
- workDir
19
- }),
20
- extractManifestSchemaTypes(workspace.schema, workDir),
21
- extractManifestTools(workspace.tools, workDir, resolveIcon)
22
- ]);
23
- return {
24
- basePath: workspace.basePath,
25
- dataset: workspace.dataset,
26
- icon,
27
- mediaLibrary: workspace.mediaLibrary,
28
- name: workspace.name,
29
- projectId: workspace.projectId,
30
- schema: serializedSchema,
31
- subtitle: workspace.subtitle,
32
- title: workspace.title,
33
- tools: serializedTools
34
- };
35
- }));
36
- }
37
- /**
38
- * Extracts all serializable properties from userland schema types,
39
- * so they best-effort can be used as definitions for Schema.compile.
40
- *
41
- * @internal
42
- */ export async function extractManifestSchemaTypes(schema, workDir) {
43
- const typeNames = schema.getTypeNames();
44
- const context = {
45
- schema
46
- };
47
- const { createSchema } = await resolveLocalPackage('sanity', workDir);
48
- const studioDefaultTypeNames = createSchema({
49
- name: 'default',
50
- types: []
51
- }).getTypeNames();
52
- return typeNames.filter((typeName)=>!studioDefaultTypeNames.includes(typeName)).map((typeName)=>schema.get(typeName)).filter((type)=>type !== undefined).map((type)=>transformType(type, context));
53
- }
54
- /**
55
- * Extracts tool information from workspace tools
56
- */ const extractManifestTools = async (tools, workDir, resolveIcon)=>{
57
- return Promise.all(tools.map(async (tool)=>{
58
- const { __internalApplicationType: type, icon, name, title } = tool;
59
- return {
60
- icon: await resolveIcon({
61
- icon: icon,
62
- title,
63
- workDir
64
- }),
65
- name,
66
- title,
67
- type: type || null
68
- };
69
- }));
70
- };
71
-
72
- //# sourceMappingURL=extractWorkspaceManifest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/extractWorkspaceManifest.ts"],"sourcesContent":["import {doImport, resolveLocalPackage} from '@sanity/cli-core'\nimport {type Schema} from '@sanity/types'\nimport {type Workspace} from 'sanity'\n\nimport {type resolveIcon as resolveIconFn} from './iconResolver.js'\nimport {type SchemaIconProps} from './resolveSchemaIcon.js'\nimport {transformType} from './schemaTypeTransformer.js'\nimport {type CreateWorkspaceManifest, type ManifestSchemaType, type ManifestTool} from './types.js'\n\nconst iconResolverPath = new URL('iconResolver.js', import.meta.url).href\n\nasync function lazyResolveIcon(): Promise<typeof resolveIconFn> {\n const mod = await doImport(iconResolverPath)\n return mod.resolveIcon\n}\n\n/**\n * Extracts manifest data from an array of workspaces\n */\nexport async function extractWorkspaceManifest(\n workspaces: Workspace[],\n workDir: string,\n): Promise<CreateWorkspaceManifest[]> {\n const resolveIcon = await lazyResolveIcon()\n return Promise.all(\n workspaces.map(async (workspace) => {\n const [icon, serializedSchema, serializedTools] = await Promise.all([\n resolveIcon({\n icon: workspace.icon,\n subtitle: workspace.subtitle,\n title: workspace.title,\n workDir,\n }),\n extractManifestSchemaTypes(workspace.schema as Schema, workDir),\n extractManifestTools(workspace.tools, workDir, resolveIcon),\n ])\n\n return {\n basePath: workspace.basePath,\n dataset: workspace.dataset,\n icon,\n mediaLibrary: workspace.mediaLibrary,\n name: workspace.name,\n projectId: workspace.projectId,\n schema: serializedSchema,\n subtitle: workspace.subtitle,\n title: workspace.title,\n tools: serializedTools,\n }\n }),\n )\n}\n\n/**\n * Extracts all serializable properties from userland schema types,\n * so they best-effort can be used as definitions for Schema.compile.\n *\n * @internal\n */\nexport async function extractManifestSchemaTypes(\n schema: Schema,\n workDir: string,\n): Promise<ManifestSchemaType[]> {\n const typeNames = schema.getTypeNames()\n const context = {schema}\n\n const {createSchema} = await resolveLocalPackage<typeof import('sanity')>('sanity', workDir)\n\n const studioDefaultTypeNames = createSchema({name: 'default', types: []}).getTypeNames()\n\n return typeNames\n .filter((typeName) => !studioDefaultTypeNames.includes(typeName))\n .map((typeName) => schema.get(typeName))\n .filter((type): type is NonNullable<typeof type> => type !== undefined)\n .map((type) => transformType(type, context))\n}\n\n/**\n * Extracts tool information from workspace tools\n */\nconst extractManifestTools = async (\n tools: Workspace['tools'],\n workDir: string,\n resolveIcon: typeof resolveIconFn,\n): Promise<ManifestTool[]> => {\n return Promise.all(\n tools.map(async (tool) => {\n const {\n __internalApplicationType: type,\n icon,\n name,\n title,\n } = tool as Workspace['tools'][number] & {__internalApplicationType: string}\n return {\n icon: await resolveIcon({\n icon: icon as SchemaIconProps['icon'],\n title,\n workDir,\n }),\n name,\n title,\n type: type || null,\n } satisfies ManifestTool\n }),\n )\n}\n"],"names":["doImport","resolveLocalPackage","transformType","iconResolverPath","URL","url","href","lazyResolveIcon","mod","resolveIcon","extractWorkspaceManifest","workspaces","workDir","Promise","all","map","workspace","icon","serializedSchema","serializedTools","subtitle","title","extractManifestSchemaTypes","schema","extractManifestTools","tools","basePath","dataset","mediaLibrary","name","projectId","typeNames","getTypeNames","context","createSchema","studioDefaultTypeNames","types","filter","typeName","includes","get","type","undefined","tool","__internalApplicationType"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,mBAAmB,QAAO,mBAAkB;AAM9D,SAAQC,aAAa,QAAO,6BAA4B;AAGxD,MAAMC,mBAAmB,IAAIC,IAAI,mBAAmB,YAAYC,GAAG,EAAEC,IAAI;AAEzE,eAAeC;IACb,MAAMC,MAAM,MAAMR,SAASG;IAC3B,OAAOK,IAAIC,WAAW;AACxB;AAEA;;CAEC,GACD,OAAO,eAAeC,yBACpBC,UAAuB,EACvBC,OAAe;IAEf,MAAMH,cAAc,MAAMF;IAC1B,OAAOM,QAAQC,GAAG,CAChBH,WAAWI,GAAG,CAAC,OAAOC;QACpB,MAAM,CAACC,MAAMC,kBAAkBC,gBAAgB,GAAG,MAAMN,QAAQC,GAAG,CAAC;YAClEL,YAAY;gBACVQ,MAAMD,UAAUC,IAAI;gBACpBG,UAAUJ,UAAUI,QAAQ;gBAC5BC,OAAOL,UAAUK,KAAK;gBACtBT;YACF;YACAU,2BAA2BN,UAAUO,MAAM,EAAYX;YACvDY,qBAAqBR,UAAUS,KAAK,EAAEb,SAASH;SAChD;QAED,OAAO;YACLiB,UAAUV,UAAUU,QAAQ;YAC5BC,SAASX,UAAUW,OAAO;YAC1BV;YACAW,cAAcZ,UAAUY,YAAY;YACpCC,MAAMb,UAAUa,IAAI;YACpBC,WAAWd,UAAUc,SAAS;YAC9BP,QAAQL;YACRE,UAAUJ,UAAUI,QAAQ;YAC5BC,OAAOL,UAAUK,KAAK;YACtBI,OAAON;QACT;IACF;AAEJ;AAEA;;;;;CAKC,GACD,OAAO,eAAeG,2BACpBC,MAAc,EACdX,OAAe;IAEf,MAAMmB,YAAYR,OAAOS,YAAY;IACrC,MAAMC,UAAU;QAACV;IAAM;IAEvB,MAAM,EAACW,YAAY,EAAC,GAAG,MAAMjC,oBAA6C,UAAUW;IAEpF,MAAMuB,yBAAyBD,aAAa;QAACL,MAAM;QAAWO,OAAO,EAAE;IAAA,GAAGJ,YAAY;IAEtF,OAAOD,UACJM,MAAM,CAAC,CAACC,WAAa,CAACH,uBAAuBI,QAAQ,CAACD,WACtDvB,GAAG,CAAC,CAACuB,WAAaf,OAAOiB,GAAG,CAACF,WAC7BD,MAAM,CAAC,CAACI,OAA2CA,SAASC,WAC5D3B,GAAG,CAAC,CAAC0B,OAASvC,cAAcuC,MAAMR;AACvC;AAEA;;CAEC,GACD,MAAMT,uBAAuB,OAC3BC,OACAb,SACAH;IAEA,OAAOI,QAAQC,GAAG,CAChBW,MAAMV,GAAG,CAAC,OAAO4B;QACf,MAAM,EACJC,2BAA2BH,IAAI,EAC/BxB,IAAI,EACJY,IAAI,EACJR,KAAK,EACN,GAAGsB;QACJ,OAAO;YACL1B,MAAM,MAAMR,YAAY;gBACtBQ,MAAMA;gBACNI;gBACAT;YACF;YACAiB;YACAR;YACAoB,MAAMA,QAAQ;QAChB;IACF;AAEJ"}
@@ -1,36 +0,0 @@
1
- import { resolveLocalPackage } from '@sanity/cli-core';
2
- import { manifestDebug } from './debug.js';
3
- import { resolveSchemaIcon } from './resolveSchemaIcon.js';
4
- import { sanitizeIcon } from './sanitizeIcon.js';
5
- /**
6
- * Resolves an icon to a sanitized HTML string.
7
- * Uses react-dom/server to capture styles during SSR.
8
- *
9
- * react-dom/server is resolved from the studio's working directory to ensure
10
- * the same React instance is used by both the server renderer and the studio's
11
- * components. Using the CLI's own react-dom/server would cause a dual-React
12
- * instance problem where the dispatcher set by one instance is invisible to the other.
13
- */ export const resolveIcon = async (props)=>{
14
- try {
15
- const [{ renderToReadableStream }, element] = await Promise.all([
16
- resolveLocalPackage('react-dom/server', props.workDir),
17
- resolveSchemaIcon(props)
18
- ]);
19
- const stream = await renderToReadableStream(element);
20
- await stream.allReady;
21
- const reader = stream.getReader();
22
- const chunks = [];
23
- while(true){
24
- const { done, value } = await reader.read();
25
- if (done) break;
26
- chunks.push(value);
27
- }
28
- const html = new TextDecoder().decode(Buffer.concat(chunks));
29
- return sanitizeIcon(html);
30
- } catch (error) {
31
- manifestDebug('Error resolving icon', error);
32
- return null;
33
- }
34
- };
35
-
36
- //# sourceMappingURL=iconResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/iconResolver.tsx"],"sourcesContent":["import {resolveLocalPackage} from '@sanity/cli-core'\n\nimport {manifestDebug} from './debug.js'\nimport {resolveSchemaIcon, type SchemaIconProps} from './resolveSchemaIcon.js'\nimport {sanitizeIcon} from './sanitizeIcon.js'\n\n/**\n * Resolves an icon to a sanitized HTML string.\n * Uses react-dom/server to capture styles during SSR.\n *\n * react-dom/server is resolved from the studio's working directory to ensure\n * the same React instance is used by both the server renderer and the studio's\n * components. Using the CLI's own react-dom/server would cause a dual-React\n * instance problem where the dispatcher set by one instance is invisible to the other.\n */\nexport const resolveIcon = async (props: SchemaIconProps): Promise<string | null> => {\n try {\n const [{renderToReadableStream}, element] = await Promise.all([\n resolveLocalPackage<typeof import('react-dom/server')>('react-dom/server', props.workDir),\n resolveSchemaIcon(props),\n ])\n const stream = await renderToReadableStream(element)\n await stream.allReady\n\n const reader = stream.getReader()\n const chunks: Uint8Array[] = []\n while (true) {\n const {done, value} = await reader.read()\n if (done) break\n chunks.push(value)\n }\n const html = new TextDecoder().decode(Buffer.concat(chunks))\n return sanitizeIcon(html)\n } catch (error) {\n manifestDebug('Error resolving icon', error)\n return null\n }\n}\n"],"names":["resolveLocalPackage","manifestDebug","resolveSchemaIcon","sanitizeIcon","resolveIcon","props","renderToReadableStream","element","Promise","all","workDir","stream","allReady","reader","getReader","chunks","done","value","read","push","html","TextDecoder","decode","Buffer","concat","error"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,mBAAkB;AAEpD,SAAQC,aAAa,QAAO,aAAY;AACxC,SAAQC,iBAAiB,QAA6B,yBAAwB;AAC9E,SAAQC,YAAY,QAAO,oBAAmB;AAE9C;;;;;;;;CAQC,GACD,OAAO,MAAMC,cAAc,OAAOC;IAChC,IAAI;QACF,MAAM,CAAC,EAACC,sBAAsB,EAAC,EAAEC,QAAQ,GAAG,MAAMC,QAAQC,GAAG,CAAC;YAC5DT,oBAAuD,oBAAoBK,MAAMK,OAAO;YACxFR,kBAAkBG;SACnB;QACD,MAAMM,SAAS,MAAML,uBAAuBC;QAC5C,MAAMI,OAAOC,QAAQ;QAErB,MAAMC,SAASF,OAAOG,SAAS;QAC/B,MAAMC,SAAuB,EAAE;QAC/B,MAAO,KAAM;YACX,MAAM,EAACC,IAAI,EAAEC,KAAK,EAAC,GAAG,MAAMJ,OAAOK,IAAI;YACvC,IAAIF,MAAM;YACVD,OAAOI,IAAI,CAACF;QACd;QACA,MAAMG,OAAO,IAAIC,cAAcC,MAAM,CAACC,OAAOC,MAAM,CAACT;QACpD,OAAOZ,aAAaiB;IACtB,EAAE,OAAOK,OAAO;QACdxB,cAAc,wBAAwBwB;QACtC,OAAO;IACT;AACF,EAAC"}
@@ -1,307 +0,0 @@
1
- /**
2
- * This file maintains our sanitization configuration for DOMPurify.
3
- * We use an allowlist for tags and attributes to ensure that only safe
4
- * elements and attributes are allowed.
5
- *
6
- * This is easier to loosen as specs develop & use-cases are discovered.
7
- */ ///////// Tags
8
- const HTML_TAGS = [
9
- 'img',
10
- 'style'
11
- ];
12
- const SVG_TAGS = [
13
- 'svg',
14
- 'a',
15
- 'altglyph',
16
- 'altglyphdef',
17
- 'altglyphitem',
18
- 'animatecolor',
19
- 'animatemotion',
20
- 'animatetransform',
21
- 'circle',
22
- 'clippath',
23
- 'defs',
24
- 'desc',
25
- 'ellipse',
26
- 'filter',
27
- 'font',
28
- 'g',
29
- 'glyph',
30
- 'glyphref',
31
- 'hkern',
32
- 'image',
33
- 'line',
34
- 'lineargradient',
35
- 'marker',
36
- 'mask',
37
- 'metadata',
38
- 'mpath',
39
- 'path',
40
- 'pattern',
41
- 'polygon',
42
- 'polyline',
43
- 'radialgradient',
44
- 'rect',
45
- 'stop',
46
- 'style',
47
- 'switch',
48
- 'symbol',
49
- 'text',
50
- 'textpath',
51
- 'title',
52
- 'tref',
53
- 'tspan',
54
- 'view',
55
- 'vkern'
56
- ];
57
- const SVG_FILTER_TAGS = [
58
- 'feBlend',
59
- 'feColorMatrix',
60
- 'feComponentTransfer',
61
- 'feComposite',
62
- 'feConvolveMatrix',
63
- 'feDiffuseLighting',
64
- 'feDisplacementMap',
65
- 'feDistantLight',
66
- 'feDropShadow',
67
- 'feFlood',
68
- 'feFuncA',
69
- 'feFuncB',
70
- 'feFuncG',
71
- 'feFuncR',
72
- 'feGaussianBlur',
73
- 'feImage',
74
- 'feMerge',
75
- 'feMergeNode',
76
- 'feMorphology',
77
- 'feOffset',
78
- 'fePointLight',
79
- 'feSpecularLighting',
80
- 'feSpotLight',
81
- 'feTile',
82
- 'feTurbulence'
83
- ];
84
- const ALLOWED_TAGS = [
85
- ...SVG_TAGS,
86
- ...HTML_TAGS,
87
- ...SVG_FILTER_TAGS
88
- ];
89
- ///////// Attributes
90
- const HTML_ATTRIBUTES = [
91
- 'alt',
92
- 'class',
93
- 'crossorigin',
94
- 'decoding',
95
- 'elementtiming',
96
- 'fetchpriority',
97
- 'height',
98
- 'loading',
99
- 'src',
100
- 'srcset',
101
- 'style',
102
- 'width'
103
- ];
104
- const SVG_ATTRIBUTES = [
105
- 'accent-height',
106
- 'accumulate',
107
- 'additive',
108
- 'alignment-baseline',
109
- 'amplitude',
110
- 'ascent',
111
- 'attributename',
112
- 'attributetype',
113
- 'azimuth',
114
- 'basefrequency',
115
- 'baseline-shift',
116
- 'begin',
117
- 'bias',
118
- 'by',
119
- 'class',
120
- 'clip',
121
- 'clippathunits',
122
- 'clip-path',
123
- 'clip-rule',
124
- 'color',
125
- 'color-interpolation',
126
- 'color-interpolation-filters',
127
- 'color-profile',
128
- 'color-rendering',
129
- 'cx',
130
- 'cy',
131
- 'd',
132
- 'dx',
133
- 'dy',
134
- 'diffuseconstant',
135
- 'direction',
136
- 'display',
137
- 'divisor',
138
- 'dur',
139
- 'edgemode',
140
- 'elevation',
141
- 'end',
142
- 'exponent',
143
- 'fill',
144
- 'fill-opacity',
145
- 'fill-rule',
146
- 'filter',
147
- 'filterunits',
148
- 'flood-color',
149
- 'flood-opacity',
150
- 'font-family',
151
- 'font-size',
152
- 'font-size-adjust',
153
- 'font-stretch',
154
- 'font-style',
155
- 'font-variant',
156
- 'font-weight',
157
- 'fx',
158
- 'fy',
159
- 'g1',
160
- 'g2',
161
- 'glyph-name',
162
- 'glyphref',
163
- 'gradientunits',
164
- 'gradienttransform',
165
- 'height',
166
- 'href',
167
- 'id',
168
- 'image-rendering',
169
- 'in',
170
- 'in2',
171
- 'intercept',
172
- 'k',
173
- 'k1',
174
- 'k2',
175
- 'k3',
176
- 'k4',
177
- 'kerning',
178
- 'keypoints',
179
- 'keysplines',
180
- 'keytimes',
181
- 'lang',
182
- 'lengthadjust',
183
- 'letter-spacing',
184
- 'kernelmatrix',
185
- 'kernelunitlength',
186
- 'lighting-color',
187
- 'local',
188
- 'marker-end',
189
- 'marker-mid',
190
- 'marker-start',
191
- 'markerheight',
192
- 'markerunits',
193
- 'markerwidth',
194
- 'maskcontentunits',
195
- 'maskunits',
196
- 'max',
197
- 'mask',
198
- 'media',
199
- 'method',
200
- 'mode',
201
- 'min',
202
- 'name',
203
- 'numoctaves',
204
- 'offset',
205
- 'operator',
206
- 'opacity',
207
- 'order',
208
- 'orient',
209
- 'orientation',
210
- 'origin',
211
- 'overflow',
212
- 'paint-order',
213
- 'path',
214
- 'pathlength',
215
- 'patterncontentunits',
216
- 'patterntransform',
217
- 'patternunits',
218
- 'points',
219
- 'preservealpha',
220
- 'preserveaspectratio',
221
- 'primitiveunits',
222
- 'r',
223
- 'rx',
224
- 'ry',
225
- 'radius',
226
- 'refx',
227
- 'refy',
228
- 'repeatcount',
229
- 'repeatdur',
230
- 'restart',
231
- 'result',
232
- 'rotate',
233
- 'scale',
234
- 'seed',
235
- 'shape-rendering',
236
- 'slope',
237
- 'specularconstant',
238
- 'specularexponent',
239
- 'spreadmethod',
240
- 'startoffset',
241
- 'stddeviation',
242
- 'stitchtiles',
243
- 'stop-color',
244
- 'stop-opacity',
245
- 'stroke-dasharray',
246
- 'stroke-dashoffset',
247
- 'stroke-linecap',
248
- 'stroke-linejoin',
249
- 'stroke-miterlimit',
250
- 'stroke-opacity',
251
- 'stroke',
252
- 'stroke-width',
253
- 'style',
254
- 'surfacescale',
255
- 'systemlanguage',
256
- 'tabindex',
257
- 'tablevalues',
258
- 'targetx',
259
- 'targety',
260
- 'transform',
261
- 'transform-origin',
262
- 'text-anchor',
263
- 'text-decoration',
264
- 'text-rendering',
265
- 'textlength',
266
- 'type',
267
- 'u1',
268
- 'u2',
269
- 'unicode',
270
- 'values',
271
- 'viewbox',
272
- 'visibility',
273
- 'version',
274
- 'vert-adv-y',
275
- 'vert-origin-x',
276
- 'vert-origin-y',
277
- 'width',
278
- 'word-spacing',
279
- 'wrap',
280
- 'writing-mode',
281
- 'xchannelselector',
282
- 'ychannelselector',
283
- 'x',
284
- 'x1',
285
- 'x2',
286
- 'xmlns',
287
- 'y',
288
- 'y1',
289
- 'y2',
290
- 'z',
291
- 'zoomandpan'
292
- ];
293
- const ALLOWED_ATTR = [
294
- ...SVG_ATTRIBUTES,
295
- ...HTML_ATTRIBUTES
296
- ];
297
- const config = {
298
- ALLOWED_ATTR,
299
- ALLOWED_TAGS,
300
- /**
301
- * Required to allow for the use of `style` tags,
302
- * namely rendering the style tags from `styled-components`
303
- */ FORCE_BODY: true
304
- };
305
- export { config };
306
-
307
- //# sourceMappingURL=purifyConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/actions/manifest/purifyConfig.ts"],"sourcesContent":["import {type Config} from 'isomorphic-dompurify'\n\n/**\n * This file maintains our sanitization configuration for DOMPurify.\n * We use an allowlist for tags and attributes to ensure that only safe\n * elements and attributes are allowed.\n *\n * This is easier to loosen as specs develop & use-cases are discovered.\n */\n\n///////// Tags\n\nconst HTML_TAGS = ['img', 'style']\n\nconst SVG_TAGS = [\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n] as const\n\nconst SVG_FILTER_TAGS = [\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n] as const\n\nconst ALLOWED_TAGS: Config['ALLOWED_TAGS'] = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS]\n\n///////// Attributes\n\nconst HTML_ATTRIBUTES = [\n 'alt',\n 'class',\n 'crossorigin',\n 'decoding',\n 'elementtiming',\n 'fetchpriority',\n 'height',\n 'loading',\n 'src',\n 'srcset',\n 'style',\n 'width',\n]\n\nconst SVG_ATTRIBUTES = [\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'amplitude',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'exponent',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'intercept',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'slope',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'tablevalues',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n] as const\n\nconst ALLOWED_ATTR: Config['ALLOWED_ATTR'] = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES]\n\nconst config = {\n ALLOWED_ATTR,\n ALLOWED_TAGS,\n /**\n * Required to allow for the use of `style` tags,\n * namely rendering the style tags from `styled-components`\n */\n FORCE_BODY: true,\n} satisfies Config\n\nexport {config}\n"],"names":["HTML_TAGS","SVG_TAGS","SVG_FILTER_TAGS","ALLOWED_TAGS","HTML_ATTRIBUTES","SVG_ATTRIBUTES","ALLOWED_ATTR","config","FORCE_BODY"],"mappings":"AAEA;;;;;;CAMC,GAED,cAAc;AAEd,MAAMA,YAAY;IAAC;IAAO;CAAQ;AAElC,MAAMC,WAAW;IACf;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAIF;OAAaD;OAAcE;CAAgB;AAE5F,oBAAoB;AAEpB,MAAME,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,iBAAiB;IACrB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,eAAuC;OAAID;OAAmBD;CAAgB;AAEpF,MAAMG,SAAS;IACbD;IACAH;IACA;;;GAGC,GACDK,YAAY;AACd;AAEA,SAAQD,MAAM,GAAC"}