@tanstack/cta-ui 0.29.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -11,8 +11,8 @@
11
11
  href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
12
12
  />
13
13
  <!-- PRELOAD-->
14
- <script type="module" crossorigin src="/assets/index-Bj0ULjhK.js"></script>
15
- <link rel="stylesheet" crossorigin href="/assets/index-rZsrUI6V.css">
14
+ <script type="module" crossorigin src="/assets/index-DheH_mx5.js"></script>
15
+ <link rel="stylesheet" crossorigin href="/assets/index-CQNNMRb1.css">
16
16
  </head>
17
17
  <body class="dark">
18
18
  <div id="root"></div>
@@ -129,7 +129,8 @@ export async function addToAppWrapper(
129
129
  writeConfigFileToEnvironment(environment, options)
130
130
  environment.finishRun()
131
131
 
132
- output.files = cleanUpFiles(output.files, projectPath)
132
+ // Preserve base64 content for WebContainer, FileViewer will display placeholders
133
+ output.files = cleanUpFiles(output.files, projectPath, true)
133
134
  output.deletedFiles = cleanUpFileArray(output.deletedFiles, projectPath)
134
135
  return output
135
136
  }
@@ -65,9 +65,11 @@ export async function createAppWrapper(
65
65
  starter,
66
66
  framework,
67
67
  chosenAddOns,
68
- addOnOptions: (!projectOptions.addOnOptions || Object.keys(projectOptions.addOnOptions).length === 0)
69
- ? populateAddOnOptionsDefaults(chosenAddOns)
70
- : projectOptions.addOnOptions,
68
+ addOnOptions:
69
+ !projectOptions.addOnOptions ||
70
+ Object.keys(projectOptions.addOnOptions).length === 0
71
+ ? populateAddOnOptionsDefaults(chosenAddOns)
72
+ : projectOptions.addOnOptions,
71
73
  }
72
74
 
73
75
  function createEnvironment() {
@@ -113,7 +115,8 @@ export async function createAppWrapper(
113
115
  } else {
114
116
  await createApp(environment, options)
115
117
 
116
- output.files = cleanUpFiles(output.files, targetDir)
118
+ // Preserve base64 content for WebContainer, FileViewer will display placeholders
119
+ output.files = cleanUpFiles(output.files, targetDir, true)
117
120
  output.deletedFiles = cleanUpFileArray(output.deletedFiles, targetDir)
118
121
 
119
122
  return output
@@ -5,11 +5,13 @@ import { CONFIG_FILE } from '@tanstack/cta-engine'
5
5
  export function cleanUpFiles(
6
6
  files: Record<string, string>,
7
7
  targetDir?: string,
8
+ preserveBase64 = false,
8
9
  ) {
9
10
  return Object.keys(files).reduce<Record<string, string>>((acc, file) => {
10
- const content = files[file].startsWith('base64::')
11
- ? '<binary file>'
12
- : files[file]
11
+ const content =
12
+ files[file].startsWith('base64::') && !preserveBase64
13
+ ? '<binary file>'
14
+ : files[file]
13
15
  if (basename(file) !== CONFIG_FILE) {
14
16
  acc[targetDir ? file.replace(targetDir, '.') : file] = content
15
17
  }
@@ -45,7 +45,11 @@ export async function generateInitialPayload() {
45
45
 
46
46
  const localFiles =
47
47
  applicationMode === 'add'
48
- ? await cleanUpFiles(await recursivelyGatherFiles(projectPath, false))
48
+ ? await cleanUpFiles(
49
+ await recursivelyGatherFiles(projectPath, false),
50
+ undefined,
51
+ true,
52
+ )
49
53
  : {}
50
54
 
51
55
  const forcedRouterMode = getForcedRouterMode()
@@ -72,7 +72,8 @@ export async function addToAppWrapper(addOns, opts) {
72
72
  });
73
73
  writeConfigFileToEnvironment(environment, options);
74
74
  environment.finishRun();
75
- output.files = cleanUpFiles(output.files, projectPath);
75
+ // Preserve base64 content for WebContainer, FileViewer will display placeholders
76
+ output.files = cleanUpFiles(output.files, projectPath, true);
76
77
  output.deletedFiles = cleanUpFileArray(output.deletedFiles, projectPath);
77
78
  return output;
78
79
  }
@@ -30,7 +30,8 @@ export async function createAppWrapper(projectOptions, opts) {
30
30
  starter,
31
31
  framework,
32
32
  chosenAddOns,
33
- addOnOptions: (!projectOptions.addOnOptions || Object.keys(projectOptions.addOnOptions).length === 0)
33
+ addOnOptions: !projectOptions.addOnOptions ||
34
+ Object.keys(projectOptions.addOnOptions).length === 0
34
35
  ? populateAddOnOptionsDefaults(chosenAddOns)
35
36
  : projectOptions.addOnOptions,
36
37
  };
@@ -69,7 +70,8 @@ export async function createAppWrapper(projectOptions, opts) {
69
70
  }
70
71
  else {
71
72
  await createApp(environment, options);
72
- output.files = cleanUpFiles(output.files, targetDir);
73
+ // Preserve base64 content for WebContainer, FileViewer will display placeholders
74
+ output.files = cleanUpFiles(output.files, targetDir, true);
73
75
  output.deletedFiles = cleanUpFileArray(output.deletedFiles, targetDir);
74
76
  return output;
75
77
  }
@@ -1,2 +1,2 @@
1
- export declare function cleanUpFiles(files: Record<string, string>, targetDir?: string): Record<string, string>;
1
+ export declare function cleanUpFiles(files: Record<string, string>, targetDir?: string, preserveBase64?: boolean): Record<string, string>;
2
2
  export declare function cleanUpFileArray(files: Array<string>, targetDir?: string): string[];
@@ -1,8 +1,8 @@
1
1
  import { basename } from 'node:path';
2
2
  import { CONFIG_FILE } from '@tanstack/cta-engine';
3
- export function cleanUpFiles(files, targetDir) {
3
+ export function cleanUpFiles(files, targetDir, preserveBase64 = false) {
4
4
  return Object.keys(files).reduce((acc, file) => {
5
- const content = files[file].startsWith('base64::')
5
+ const content = files[file].startsWith('base64::') && !preserveBase64
6
6
  ? '<binary file>'
7
7
  : files[file];
8
8
  if (basename(file) !== CONFIG_FILE) {
@@ -21,7 +21,7 @@ export async function generateInitialPayload() {
21
21
  const projectPath = getProjectPath();
22
22
  const applicationMode = getApplicationMode();
23
23
  const localFiles = applicationMode === 'add'
24
- ? await cleanUpFiles(await recursivelyGatherFiles(projectPath, false))
24
+ ? await cleanUpFiles(await recursivelyGatherFiles(projectPath, false), undefined, true)
25
25
  : {};
26
26
  const forcedRouterMode = getForcedRouterMode();
27
27
  async function getSerializedOptions() {
package/package.json CHANGED
@@ -17,8 +17,8 @@
17
17
  "tailwindcss": "^4.1.6",
18
18
  "tailwindcss-animate": "^1.0.7",
19
19
  "vite-tsconfig-paths": "^5.1.4",
20
- "@tanstack/cta-engine": "0.29.1",
21
- "@tanstack/cta-ui-base": "0.29.1"
20
+ "@tanstack/cta-ui-base": "0.30.0",
21
+ "@tanstack/cta-engine": "0.29.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@tailwindcss/typography": "^0.5.16",
@@ -37,6 +37,6 @@
37
37
  "vitest": "^3.0.5",
38
38
  "web-vitals": "^4.2.4"
39
39
  },
40
- "version": "0.29.1",
40
+ "version": "0.30.0",
41
41
  "scripts": {}
42
42
  }
package/vite.config.ts CHANGED
@@ -8,6 +8,10 @@ export default defineConfig({
8
8
  server: {
9
9
  open: true,
10
10
  port: 3000,
11
+ headers: {
12
+ 'Cross-Origin-Embedder-Policy': 'require-corp',
13
+ 'Cross-Origin-Opener-Policy': 'same-origin',
14
+ },
11
15
  },
12
16
  build: {
13
17
  outDir: 'dist',