@payloadcms/figma 0.1.0-alpha.1 → 0.1.0-alpha.3

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 (153) hide show
  1. package/dist/api/control-plane.d.ts +1 -1
  2. package/dist/api/control-plane.js +1 -1
  3. package/dist/cli.d.ts +30 -0
  4. package/dist/cli.js +33 -33
  5. package/dist/commands/deploy.d.ts +2 -0
  6. package/dist/commands/deploy.js +22 -12
  7. package/dist/db-content-api/index.d.ts +1 -1
  8. package/dist/db-content-api/index.js +70 -40
  9. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  10. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  11. package/dist/exports/client.d.ts +2 -0
  12. package/dist/exports/client.js +2 -0
  13. package/dist/plugin/build-config.js +39 -4
  14. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +9 -0
  15. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +78 -0
  16. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +51 -0
  17. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +7 -0
  18. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +169 -0
  19. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +2 -0
  20. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  21. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +9 -0
  22. package/dist/plugin/cloud-limits/SlugTracker/index.js +23 -0
  23. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -0
  24. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  25. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  26. package/dist/plugin/cloud-limits/shared.js +27 -0
  27. package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
  28. package/dist/plugin/sandbox-upload-fetch.js +53 -0
  29. package/dist/translations/ar.d.ts +12 -0
  30. package/dist/translations/ar.js +12 -0
  31. package/dist/translations/az.d.ts +12 -0
  32. package/dist/translations/az.js +12 -0
  33. package/dist/translations/bg.d.ts +12 -0
  34. package/dist/translations/bg.js +12 -0
  35. package/dist/translations/bnBd.d.ts +12 -0
  36. package/dist/translations/bnBd.js +12 -0
  37. package/dist/translations/bnIn.d.ts +12 -0
  38. package/dist/translations/bnIn.js +12 -0
  39. package/dist/translations/ca.d.ts +12 -0
  40. package/dist/translations/ca.js +12 -0
  41. package/dist/translations/cs.d.ts +12 -0
  42. package/dist/translations/cs.js +12 -0
  43. package/dist/translations/da.d.ts +12 -0
  44. package/dist/translations/da.js +12 -0
  45. package/dist/translations/de.d.ts +12 -0
  46. package/dist/translations/de.js +12 -0
  47. package/dist/translations/en.d.ts +12 -0
  48. package/dist/translations/en.js +12 -0
  49. package/dist/translations/es.d.ts +12 -0
  50. package/dist/translations/es.js +12 -0
  51. package/dist/translations/et.d.ts +12 -0
  52. package/dist/translations/et.js +12 -0
  53. package/dist/translations/fa.d.ts +12 -0
  54. package/dist/translations/fa.js +12 -0
  55. package/dist/translations/fr.d.ts +12 -0
  56. package/dist/translations/fr.js +12 -0
  57. package/dist/translations/he.d.ts +12 -0
  58. package/dist/translations/he.js +12 -0
  59. package/dist/translations/hr.d.ts +12 -0
  60. package/dist/translations/hr.js +12 -0
  61. package/dist/translations/hu.d.ts +12 -0
  62. package/dist/translations/hu.js +12 -0
  63. package/dist/translations/hy.d.ts +12 -0
  64. package/dist/translations/hy.js +12 -0
  65. package/dist/translations/id.d.ts +12 -0
  66. package/dist/translations/id.js +12 -0
  67. package/dist/translations/index.d.ts +533 -0
  68. package/dist/translations/index.js +90 -0
  69. package/dist/translations/is.d.ts +12 -0
  70. package/dist/translations/is.js +12 -0
  71. package/dist/translations/it.d.ts +12 -0
  72. package/dist/translations/it.js +12 -0
  73. package/dist/translations/ja.d.ts +12 -0
  74. package/dist/translations/ja.js +12 -0
  75. package/dist/translations/ko.d.ts +12 -0
  76. package/dist/translations/ko.js +12 -0
  77. package/dist/translations/lt.d.ts +12 -0
  78. package/dist/translations/lt.js +12 -0
  79. package/dist/translations/lv.d.ts +12 -0
  80. package/dist/translations/lv.js +12 -0
  81. package/dist/translations/my.d.ts +12 -0
  82. package/dist/translations/my.js +12 -0
  83. package/dist/translations/nb.d.ts +12 -0
  84. package/dist/translations/nb.js +12 -0
  85. package/dist/translations/nl.d.ts +12 -0
  86. package/dist/translations/nl.js +12 -0
  87. package/dist/translations/pl.d.ts +12 -0
  88. package/dist/translations/pl.js +12 -0
  89. package/dist/translations/pt.d.ts +12 -0
  90. package/dist/translations/pt.js +12 -0
  91. package/dist/translations/ro.d.ts +12 -0
  92. package/dist/translations/ro.js +12 -0
  93. package/dist/translations/rs.d.ts +12 -0
  94. package/dist/translations/rs.js +12 -0
  95. package/dist/translations/rsLatin.d.ts +12 -0
  96. package/dist/translations/rsLatin.js +12 -0
  97. package/dist/translations/ru.d.ts +12 -0
  98. package/dist/translations/ru.js +12 -0
  99. package/dist/translations/sk.d.ts +12 -0
  100. package/dist/translations/sk.js +12 -0
  101. package/dist/translations/sl.d.ts +12 -0
  102. package/dist/translations/sl.js +12 -0
  103. package/dist/translations/sv.d.ts +12 -0
  104. package/dist/translations/sv.js +12 -0
  105. package/dist/translations/ta.d.ts +12 -0
  106. package/dist/translations/ta.js +12 -0
  107. package/dist/translations/th.d.ts +12 -0
  108. package/dist/translations/th.js +12 -0
  109. package/dist/translations/tr.d.ts +12 -0
  110. package/dist/translations/tr.js +12 -0
  111. package/dist/translations/uk.d.ts +12 -0
  112. package/dist/translations/uk.js +12 -0
  113. package/dist/translations/vi.d.ts +12 -0
  114. package/dist/translations/vi.js +12 -0
  115. package/dist/translations/zh.d.ts +12 -0
  116. package/dist/translations/zh.js +12 -0
  117. package/dist/translations/zhTw.d.ts +12 -0
  118. package/dist/translations/zhTw.js +12 -0
  119. package/dist/types.d.ts +2 -0
  120. package/dist/utils/adapters/nextjs.d.ts +3 -3
  121. package/dist/utils/adapters/nextjs.js +9 -7
  122. package/dist/utils/adapters/nitro.d.ts +3 -3
  123. package/dist/utils/adapters/nitro.js +73 -77
  124. package/dist/utils/adapters/vite.d.ts +1 -1
  125. package/dist/utils/adapters/vite.js +8 -7
  126. package/dist/utils/assert-never.d.ts +1 -0
  127. package/dist/utils/assert-never.js +3 -0
  128. package/dist/utils/asset-collection.d.ts +2 -2
  129. package/dist/utils/asset-collection.js +10 -15
  130. package/dist/utils/build-detection.d.ts +6 -1
  131. package/dist/utils/build-detection.js +68 -89
  132. package/dist/utils/build-lambda-zip.d.ts +5 -6
  133. package/dist/utils/build-lambda-zip.js +31 -48
  134. package/dist/utils/deploy-adapter.d.ts +4 -4
  135. package/dist/utils/deploy-adapter.js +12 -8
  136. package/dist/utils/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
  137. package/dist/utils/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
  138. package/dist/utils/deploy-output/inspectNextjsOutput.d.ts +12 -0
  139. package/dist/utils/deploy-output/inspectNextjsOutput.js +28 -0
  140. package/dist/utils/deploy-output/inspectNitroOutput.d.ts +9 -0
  141. package/dist/utils/deploy-output/inspectNitroOutput.js +13 -0
  142. package/dist/utils/deploy-output/isFile.d.ts +1 -0
  143. package/dist/utils/deploy-output/isFile.js +4 -0
  144. package/dist/utils/deploy-output/readJson.d.ts +1 -0
  145. package/dist/utils/deploy-output/readJson.js +9 -0
  146. package/dist/utils/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
  147. package/dist/utils/deploy-output/resolveNitroOutputLayout.js +16 -0
  148. package/dist/utils/deploy-output/resolveOutputPath.d.ts +2 -0
  149. package/dist/utils/deploy-output/resolveOutputPath.js +9 -0
  150. package/dist/utils/deploy-output/resolveWithin.d.ts +1 -0
  151. package/dist/utils/deploy-output/resolveWithin.js +12 -0
  152. package/dist/utils/messages.js +2 -0
  153. package/package.json +6 -5
@@ -2,6 +2,8 @@ import archiver from 'archiver';
2
2
  import { createWriteStream } from 'fs';
3
3
  import fs from 'fs/promises';
4
4
  import path from 'path';
5
+ import { inspectNextjsOutput } from './deploy-output/inspectNextjsOutput.js';
6
+ import { resolveOutputPath } from './deploy-output/resolveOutputPath.js';
5
7
  import { getDirectorySize } from './fs-utils.js';
6
8
  /**
7
9
  * AWS Lambda's hard limit on unzipped deployment code size (250 MB). The unzipped
@@ -14,66 +16,43 @@ import { getDirectorySize } from './fs-utils.js';
14
16
  * Build Lambda deployment zip using pure Node.js
15
17
  *
16
18
  * Cross-platform replacement for build_for_lambda.sh:
17
- * 1. Copies .next/static to .next/standalone/.next/static
18
- * 2. Copies run.sh to .next/standalone/run.sh
19
- * 3. Creates lambda.zip from .next/standalone/
19
+ * 1. Adds a generated run.sh directly to the archive
20
+ * 2. Creates lambda.zip from the standalone output
20
21
  *
21
- * Note: public/ is NOT included in the zip those files are uploaded
22
- * as static assets and served via CDN, not from the Lambda function.
22
+ * The output's static/ and the project's public/ directories are not copied into the zip. Those
23
+ * files are uploaded separately and served by Gatekeeper, not the Lambda function.
23
24
  *
24
25
  * @param projectPath - Path to project root
25
26
  * @returns The built bundle: its unzipped byte size and the absolute zip path.
26
27
  * @throws Error if standalone directory missing or zip creation fails
27
- */ export async function buildLambdaZip(projectPath) {
28
- const standalonePath = path.join(projectPath, '.next', 'standalone');
29
- const staticPath = path.join(projectPath, '.next', 'static');
30
- const runShPath = path.join(projectPath, 'run.sh');
31
- const zipPath = path.join(projectPath, 'lambda.zip');
32
- if (!await isDirectory(standalonePath)) {
33
- throw new Error('Standalone build not found at .next/standalone. ' + 'Ensure next.config has output: "standalone" and run build first.');
34
- }
35
- if (await isDirectory(staticPath)) {
36
- const destStatic = path.join(standalonePath, '.next', 'static');
37
- await copyDirectory(staticPath, destStatic);
38
- }
39
- try {
40
- await fs.copyFile(runShPath, path.join(standalonePath, 'run.sh'));
41
- } catch {
42
- // run.sh may not exist in all setups
28
+ */ export async function buildLambdaZip(projectPath, output) {
29
+ const outputPath = resolveOutputPath(projectPath, 'nextjs', output);
30
+ const layout = await inspectNextjsOutput(outputPath);
31
+ if (!layout) {
32
+ throw new Error(`Standalone build not found at ${outputPath}`);
43
33
  }
44
- const unzippedBytes = await getDirectorySize(standalonePath);
45
- await createZip(standalonePath, zipPath);
34
+ const serverEntry = path.relative(layout.standalonePath, layout.serverEntryPath).split(path.sep).join('/');
35
+ const runScript = createRunScript(serverEntry);
36
+ const zipPath = path.join(projectPath, 'lambda.zip');
37
+ const existingRunScriptBytes = await getFileSize(path.join(layout.standalonePath, 'run.sh'));
38
+ const unzippedBytes = await getDirectorySize(layout.standalonePath) - existingRunScriptBytes + Buffer.byteLength(runScript);
39
+ await createZip(layout.standalonePath, zipPath, runScript);
46
40
  return {
47
41
  unzippedBytes,
48
42
  zipPath
49
43
  };
50
44
  }
51
- async function isDirectory(dirPath) {
52
- try {
53
- const stats = await fs.stat(dirPath);
54
- return stats.isDirectory();
55
- } catch {
56
- return false;
57
- }
45
+ function createRunScript(serverEntry) {
46
+ const escapedEntry = serverEntry.replaceAll("'", "'\\''");
47
+ return `#!/bin/bash -x
48
+ [ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
49
+ NODE_ENV=production exec node '${escapedEntry}'
50
+ `;
58
51
  }
59
- async function copyDirectory(src, dest) {
60
- await fs.mkdir(dest, {
61
- recursive: true
62
- });
63
- const entries = await fs.readdir(src, {
64
- withFileTypes: true
65
- });
66
- for (const entry of entries){
67
- const srcPath = path.join(src, entry.name);
68
- const destPath = path.join(dest, entry.name);
69
- if (entry.isDirectory()) {
70
- await copyDirectory(srcPath, destPath);
71
- } else {
72
- await fs.copyFile(srcPath, destPath);
73
- }
74
- }
52
+ async function getFileSize(filePath) {
53
+ return fs.stat(filePath).then((stat)=>stat.isFile() ? stat.size : 0).catch(()=>0);
75
54
  }
76
- function createZip(sourceDir, zipPath) {
55
+ function createZip(sourceDir, zipPath, runScript) {
77
56
  return new Promise((resolve, reject)=>{
78
57
  const output = createWriteStream(zipPath);
79
58
  const archive = archiver('zip', {
@@ -84,7 +63,11 @@ function createZip(sourceDir, zipPath) {
84
63
  output.on('close', ()=>resolve());
85
64
  archive.on('error', (err)=>reject(err));
86
65
  archive.pipe(output);
87
- archive.directory(sourceDir, false);
66
+ archive.directory(sourceDir, false, (entry)=>entry.name === 'run.sh' ? false : entry);
67
+ archive.append(runScript, {
68
+ name: 'run.sh',
69
+ mode: 0o755
70
+ });
88
71
  void archive.finalize();
89
72
  });
90
73
  }
@@ -24,13 +24,13 @@ export interface LambdaBundle {
24
24
  zipPath: string;
25
25
  }
26
26
  export interface DeployAdapter {
27
- collectAssets(projectPath: string): Promise<AssetCollection>;
28
- collectPages(projectPath: string): Promise<PageCollection>;
27
+ collectAssets(projectPath: string, output?: string): Promise<AssetCollection>;
28
+ collectPages(projectPath: string, output?: string): Promise<PageCollection>;
29
29
  /** SPA fallback path (e.g., "/index.html"). Undefined for SSR/SSG apps. */
30
30
  fallback?: string;
31
31
  name: AdapterName;
32
32
  /** Assembles and zips the server bundle. Returns the bundle, or null if no server (e.g., Vite SPA). */
33
- prepareLambdaBundle(projectPath: string): Promise<LambdaBundle | null>;
33
+ prepareLambdaBundle(projectPath: string, output?: string): Promise<LambdaBundle | null>;
34
34
  }
35
35
  /**
36
36
  * Auto-detect the framework adapter based on build output.
@@ -42,4 +42,4 @@ export interface DeployAdapter {
42
42
  * @param projectPath - Path to project root
43
43
  * @param override - Explicit adapter name from --adapter flag
44
44
  */
45
- export declare function detectAdapter(projectPath: string, override?: AdapterName): Promise<DeployAdapter>;
45
+ export declare function detectAdapter(projectPath: string, override?: AdapterName, output?: string): Promise<DeployAdapter>;
@@ -1,5 +1,8 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
+ import { inspectNextjsOutput } from './deploy-output/inspectNextjsOutput.js';
4
+ import { inspectNitroOutput } from './deploy-output/inspectNitroOutput.js';
5
+ import { resolveOutputPath } from './deploy-output/resolveOutputPath.js';
3
6
  /**
4
7
  * Auto-detect the framework adapter based on build output.
5
8
  *
@@ -9,23 +12,24 @@ import path from 'path';
9
12
  *
10
13
  * @param projectPath - Path to project root
11
14
  * @param override - Explicit adapter name from --adapter flag
12
- */ export async function detectAdapter(projectPath, override) {
15
+ */ export async function detectAdapter(projectPath, override, output) {
13
16
  if (override) {
14
17
  return loadAdapter(override);
15
18
  }
16
- const hasNext = await exists(path.join(projectPath, '.next'));
17
- const hasNitro = await exists(path.join(projectPath, '.output', 'nitro.json'));
18
- const hasViteDist = await exists(path.join(projectPath, 'dist', 'index.html'));
19
- if (hasNext) {
19
+ const nextOutput = resolveOutputPath(projectPath, 'nextjs', output);
20
+ if (await inspectNextjsOutput(nextOutput)) {
20
21
  return loadAdapter('nextjs');
21
22
  }
22
- if (hasNitro) {
23
+ const nitroOutput = resolveOutputPath(projectPath, 'nitro', output);
24
+ if (await inspectNitroOutput(nitroOutput)) {
23
25
  return loadAdapter('nitro');
24
26
  }
25
- if (hasViteDist) {
27
+ const viteOutput = resolveOutputPath(projectPath, 'vite', output);
28
+ if (await exists(path.join(viteOutput, 'index.html'))) {
26
29
  return loadAdapter('vite');
27
30
  }
28
- throw new Error('Could not detect framework. Expected .next/ (NextJS), .output/nitro.json (Nitro), or dist/index.html (Vite). ' + 'Use --adapter to specify explicitly.');
31
+ const location = output ? ` in ${path.resolve(projectPath, output)}` : '';
32
+ throw new Error(`Could not detect framework${location}. Expected Next.js BUILD_ID + standalone server, ` + 'Nitro server entry, or Vite index.html. ' + 'Use --adapter to specify explicitly.');
29
33
  }
30
34
  async function loadAdapter(name) {
31
35
  switch(name){
@@ -0,0 +1 @@
1
+ export declare function getNextRelativeAppDir(manifest: null | Record<string, unknown>): null | string;
@@ -0,0 +1,15 @@
1
+ import path from 'path';
2
+ export function getNextRelativeAppDir(manifest) {
3
+ if (typeof manifest?.relativeAppDir === 'string') {
4
+ return manifest.relativeAppDir;
5
+ }
6
+ if (typeof manifest?.appDir !== 'string') {
7
+ return null;
8
+ }
9
+ const config = manifest.config;
10
+ if (config === null || typeof config !== 'object' || Array.isArray(config)) {
11
+ return null;
12
+ }
13
+ const tracingRoot = config.outputFileTracingRoot;
14
+ return typeof tracingRoot === 'string' ? path.relative(tracingRoot, manifest.appDir) : null;
15
+ }
@@ -0,0 +1,12 @@
1
+ interface NextjsOutputLayout {
2
+ buildId: string;
3
+ outputPath: string;
4
+ serverEntryPath: string;
5
+ standalonePath: string;
6
+ }
7
+ /**
8
+ * Inspects a resolved Next.js output directory, typically `<project>/.next`.
9
+ * Returns its build ID and standalone paths, or null when required files are missing.
10
+ */
11
+ export declare function inspectNextjsOutput(outputPath: string): Promise<NextjsOutputLayout | null>;
12
+ export {};
@@ -0,0 +1,28 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { getNextRelativeAppDir } from './inspectNextjsOutput/getNextRelativeAppDir.js';
4
+ import { isFile } from './isFile.js';
5
+ import { readJson } from './readJson.js';
6
+ import { resolveWithin } from './resolveWithin.js';
7
+ /**
8
+ * Inspects a resolved Next.js output directory, typically `<project>/.next`.
9
+ * Returns its build ID and standalone paths, or null when required files are missing.
10
+ */ export async function inspectNextjsOutput(outputPath) {
11
+ const buildId = await fs.readFile(path.join(outputPath, 'BUILD_ID'), 'utf8').then((value)=>value.trim()).catch(()=>null);
12
+ if (!buildId) {
13
+ return null;
14
+ }
15
+ const standalonePath = path.join(outputPath, 'standalone');
16
+ const manifest = await readJson(path.join(outputPath, 'required-server-files.json'));
17
+ const relativeAppDir = getNextRelativeAppDir(manifest);
18
+ const serverEntryPath = relativeAppDir === null ? path.join(standalonePath, 'server.js') : resolveWithin(standalonePath, path.join(relativeAppDir, 'server.js'), 'relativeAppDir');
19
+ if (!await isFile(serverEntryPath)) {
20
+ return null;
21
+ }
22
+ return {
23
+ buildId,
24
+ outputPath,
25
+ serverEntryPath,
26
+ standalonePath
27
+ };
28
+ }
@@ -0,0 +1,9 @@
1
+ import { resolveNitroOutputLayout } from './resolveNitroOutputLayout.js';
2
+ type NitroOutputLayout = Awaited<ReturnType<typeof resolveNitroOutputLayout>>;
3
+ /**
4
+ * Inspects a resolved Nitro output directory, typically `<project>/.output`.
5
+ * Returns its server and public paths, or null when the server entry is missing. The build ID is
6
+ * Nitro's manifest date when available; legacy outputs without a manifest omit it.
7
+ */
8
+ export declare function inspectNitroOutput(outputPath: string): Promise<NitroOutputLayout | null>;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ import { isFile } from './isFile.js';
2
+ import { resolveNitroOutputLayout } from './resolveNitroOutputLayout.js';
3
+ /**
4
+ * Inspects a resolved Nitro output directory, typically `<project>/.output`.
5
+ * Returns its server and public paths, or null when the server entry is missing. The build ID is
6
+ * Nitro's manifest date when available; legacy outputs without a manifest omit it.
7
+ */ export async function inspectNitroOutput(outputPath) {
8
+ const layout = await resolveNitroOutputLayout(outputPath);
9
+ if (!await isFile(layout.serverEntryPath)) {
10
+ return null;
11
+ }
12
+ return layout;
13
+ }
@@ -0,0 +1 @@
1
+ export declare function isFile(filePath: string): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import fs from 'fs/promises';
2
+ export async function isFile(filePath) {
3
+ return fs.stat(filePath).then((stat)=>stat.isFile()).catch(()=>false);
4
+ }
@@ -0,0 +1 @@
1
+ export declare function readJson(filePath: string): Promise<null | Record<string, unknown>>;
@@ -0,0 +1,9 @@
1
+ import fs from 'fs/promises';
2
+ export async function readJson(filePath) {
3
+ try {
4
+ const value = JSON.parse(await fs.readFile(filePath, 'utf8'));
5
+ return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : null;
6
+ } catch {
7
+ return null;
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ interface NitroOutputLayout {
2
+ buildId?: string;
3
+ outputPath: string;
4
+ publicPath: string;
5
+ serverEntryPath: string;
6
+ }
7
+ export declare function resolveNitroOutputLayout(outputPath: string): Promise<NitroOutputLayout>;
8
+ export {};
@@ -0,0 +1,16 @@
1
+ import path from 'path';
2
+ import { readJson } from './readJson.js';
3
+ import { resolveWithin } from './resolveWithin.js';
4
+ const DEFAULT_PUBLIC_DIR = 'public';
5
+ const DEFAULT_SERVER_ENTRY = 'server/index.mjs';
6
+ export async function resolveNitroOutputLayout(outputPath) {
7
+ const manifest = await readJson(path.join(outputPath, 'nitro.json'));
8
+ const serverEntry = typeof manifest?.serverEntry === 'string' ? manifest.serverEntry : DEFAULT_SERVER_ENTRY;
9
+ const publicDir = typeof manifest?.publicDir === 'string' ? manifest.publicDir : DEFAULT_PUBLIC_DIR;
10
+ return {
11
+ buildId: typeof manifest?.date === 'string' ? manifest.date : undefined,
12
+ outputPath,
13
+ publicPath: resolveWithin(outputPath, publicDir, 'publicDir'),
14
+ serverEntryPath: resolveWithin(outputPath, serverEntry, 'serverEntry')
15
+ };
16
+ }
@@ -0,0 +1,2 @@
1
+ import type { AdapterName } from '../deploy-adapter.js';
2
+ export declare function resolveOutputPath(projectPath: string, adapter: AdapterName, output?: string): string;
@@ -0,0 +1,9 @@
1
+ import path from 'path';
2
+ const DEFAULT_OUTPUT_DIRS = {
3
+ nextjs: '.next',
4
+ nitro: '.output',
5
+ vite: 'dist'
6
+ };
7
+ export function resolveOutputPath(projectPath, adapter, output) {
8
+ return output ? path.resolve(projectPath, output) : path.join(projectPath, DEFAULT_OUTPUT_DIRS[adapter]);
9
+ }
@@ -0,0 +1 @@
1
+ export declare function resolveWithin(outputPath: string, relativePath: string, field: string): string;
@@ -0,0 +1,12 @@
1
+ import path from 'path';
2
+ export function resolveWithin(outputPath, relativePath, field) {
3
+ if (path.isAbsolute(relativePath)) {
4
+ throw new Error(`${field} must be relative to output root`);
5
+ }
6
+ const resolved = path.resolve(outputPath, relativePath);
7
+ const relative = path.relative(outputPath, resolved);
8
+ if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
9
+ throw new Error(`${field} escapes output root`);
10
+ }
11
+ return resolved;
12
+ }
@@ -63,6 +63,8 @@ export function helpMessage() {
63
63
  ${pc.dim('--yes, -y')} Skip confirmation prompts
64
64
  ${pc.dim('--skip-build')} Skip building and use existing build
65
65
  ${pc.dim('--skip-size-check')} Skip the client-side bundle size check
66
+ ${pc.dim('--adapter <nextjs|nitro|vite>')} Override framework detection
67
+ ${pc.dim('--output <path>')} Exact framework build output root
66
68
 
67
69
  ${pc.bold('UPGRADE COMMAND')}
68
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/figma",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@payloadcms/eslint-config": "3.28.0",
51
51
  "@payloadcms/eslint-plugin": "3.28.0",
52
- "@payloadcms/next": "4.0.0-canary.20",
52
+ "@payloadcms/next": "4.0.0-canary.24",
53
53
  "@swc/cli": "0.7.7",
54
54
  "@types/archiver": "7.0.0",
55
55
  "@types/cross-spawn": "6.0.6",
@@ -66,9 +66,9 @@
66
66
  "vitest": "4.0.15"
67
67
  },
68
68
  "peerDependencies": {
69
- "@payloadcms/plugin-cloud-storage": ">=4.0.0-canary.20 <4.0.0-internal",
70
- "@payloadcms/richtext-lexical": ">=4.0.0-canary.20 <4.0.0-internal",
71
- "payload": ">=4.0.0-canary.20 <4.0.0-internal"
69
+ "@payloadcms/plugin-cloud-storage": ">=4.0.0-canary.24 <4.0.0-internal",
70
+ "@payloadcms/richtext-lexical": ">=4.0.0-canary.24 <4.0.0-internal",
71
+ "payload": ">=4.0.0-canary.24 <4.0.0-internal"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@payloadcms/plugin-cloud-storage": {
@@ -97,6 +97,7 @@
97
97
  "generate:types": "tsx scripts/generate-types.ts",
98
98
  "lint": "eslint .",
99
99
  "lint:fix": "eslint . --fix",
100
+ "payload:cli": "tsx scripts/payload-cli.ts",
100
101
  "start": "pnpm build && node ./bin/cli.js",
101
102
  "test": "TEST_UNIT=true vitest run",
102
103
  "test:int": "TEST_INT=true vitest run --config vitest.config.int.ts",