create-krispya 0.10.0 → 0.12.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/cli.cjs +73 -51
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +65 -43
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +1 -1
- package/dist/shared/{create-krispya.to8NBxeJ.d.ts → create-krispya.CcQTepKu.d.cts} +2 -1
- package/dist/shared/{create-krispya.to8NBxeJ.d.cts → create-krispya.CcQTepKu.d.mts} +2 -1
- package/dist/shared/{create-krispya.to8NBxeJ.d.mts → create-krispya.CcQTepKu.d.ts} +2 -1
- package/dist/shared/{create-krispya.DKKVmsqH.mjs → create-krispya.DZWMfM2v.mjs} +135 -67
- package/dist/shared/{create-krispya.DTHeUlq4.cjs → create-krispya.FNrYi_5V.cjs} +137 -66
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FormatterMetaConfig, L as LinterMetaConfig, V as VirtualFileMap, C as CodeInjectionLocation, P as ProjectType, a as ConfigStrategy, E as EngineSpec, b as PackageVersions, c as Linter, d as Formatter, T as Testing, e as LibraryBundler, I as Ide, f as PackageManagerSpec, g as ProjectPlanInput, h as ProjectOptions, A as AiPlatform, W as WorkspacePlanInput } from './shared/create-krispya.
|
|
2
|
-
export { i as AiAgentsMetaConfig, B as BaseTemplate, D as DependencyVersionOptions, j as EditorMetaConfig, k as EngineName, l as FeatureSelections, m as FileRenderer, n as LibraryBundlerMetaConfig, o as PackageManagerMetaConfig, p as PackageManagerName, q as PlanBuilder, r as PlanDreiOptions, s as PlanFiberOptions, t as PlanGithubPagesOptions, u as PlanHandleOptions, v as PlanKootaOptions, w as PlanLevaOptions, x as PlanOffscreenOptions, y as PlanPostprocessingOptions, z as PlanRapierOptions, G as PlanTriplexOptions, H as PlanUikitOptions, J as PlanViverseOptions, K as PlanXrOptions, M as PlanZustandOptions, N as ProjectMetaConfig, O as ProjectPlanContext, Q as Template, R as TestingMetaConfig, S as ToolConfig, U as TypeScriptMetaConfig, X as VersionRangePrefix, Y as VirtualFile, Z as WorkspacePlanContext, _ as getBaseTemplate, $ as getLanguageFromTemplate } from './shared/create-krispya.
|
|
1
|
+
import { F as FormatterMetaConfig, L as LinterMetaConfig, V as VirtualFileMap, C as CodeInjectionLocation, P as ProjectType, a as ConfigStrategy, E as EngineSpec, b as PackageVersions, c as Linter, d as Formatter, T as Testing, e as LibraryBundler, I as Ide, f as PackageManagerSpec, g as ProjectPlanInput, h as ProjectOptions, A as AiPlatform, W as WorkspacePlanInput } from './shared/create-krispya.CcQTepKu.mjs';
|
|
2
|
+
export { i as AiAgentsMetaConfig, B as BaseTemplate, D as DependencyVersionOptions, j as EditorMetaConfig, k as EngineName, l as FeatureSelections, m as FileRenderer, n as LibraryBundlerMetaConfig, o as PackageManagerMetaConfig, p as PackageManagerName, q as PlanBuilder, r as PlanDreiOptions, s as PlanFiberOptions, t as PlanGithubPagesOptions, u as PlanHandleOptions, v as PlanKootaOptions, w as PlanLevaOptions, x as PlanOffscreenOptions, y as PlanPostprocessingOptions, z as PlanRapierOptions, G as PlanTriplexOptions, H as PlanUikitOptions, J as PlanViverseOptions, K as PlanXrOptions, M as PlanZustandOptions, N as ProjectMetaConfig, O as ProjectPlanContext, Q as Template, R as TestingMetaConfig, S as ToolConfig, U as TypeScriptMetaConfig, X as VersionRangePrefix, Y as VirtualFile, Z as WorkspacePlanContext, _ as getBaseTemplate, $ as getLanguageFromTemplate, a0 as shouldEnableReactCompiler } from './shared/create-krispya.CcQTepKu.mjs';
|
|
3
3
|
|
|
4
4
|
type MetaConfig = {
|
|
5
5
|
formatter: FormatterMetaConfig;
|
|
@@ -118,6 +118,10 @@ declare function getLatestNpmVersion(packageName: string, fallback: string): Pro
|
|
|
118
118
|
* Fetches the latest npm version within a specific major version.
|
|
119
119
|
*/
|
|
120
120
|
declare function getLatestNpmMajorVersion(packageName: string, majorVersion: string, fallback: string): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetches the latest npm version within the requested major, falling back to lower majors.
|
|
123
|
+
*/
|
|
124
|
+
declare function getLatestNpmMajorVersionAtOrBelow(packageName: string, majorVersion: string, fallback: string): Promise<string>;
|
|
121
125
|
declare function getLatestPnpmVersion(): Promise<string>;
|
|
122
126
|
declare function getLatestYarnVersion(): Promise<string>;
|
|
123
127
|
declare function getLatestNpmCliVersion(): Promise<string>;
|
|
@@ -125,5 +129,5 @@ declare function getLatestNodeVersion(): Promise<string>;
|
|
|
125
129
|
|
|
126
130
|
declare function parseWorkspaceYamlContent(content: string): string[];
|
|
127
131
|
|
|
128
|
-
export { AiPlatform, CodeInjectionLocation, ConfigStrategy, EngineSpec, Formatter, FormatterMetaConfig, Ide, LibraryBundler, Linter, LinterMetaConfig, PackageManagerSpec, PackageVersions, ProjectOptions, ProjectPlanInput, ProjectType, Testing, VirtualFileMap, WorkspacePlanInput, detectTooling, generateRandomName, getLatestNodeVersion, getLatestNpmCliVersion, getLatestNpmMajorVersion, getLatestNpmVersion, getLatestPnpmVersion, getLatestYarnVersion, merge, mergePartialPlans, parseWorkspaceYamlContent, planProject, planWorkspace, projectPlanInputToOptions, resolveProjectPlanInput, resolveWorkspacePlanInput, unique, validatePackageName, workspacePlanInputToMonorepoParams };
|
|
132
|
+
export { AiPlatform, CodeInjectionLocation, ConfigStrategy, EngineSpec, Formatter, FormatterMetaConfig, Ide, LibraryBundler, Linter, LinterMetaConfig, PackageManagerSpec, PackageVersions, ProjectOptions, ProjectPlanInput, ProjectType, Testing, VirtualFileMap, WorkspacePlanInput, detectTooling, generateRandomName, getLatestNodeVersion, getLatestNpmCliVersion, getLatestNpmMajorVersion, getLatestNpmMajorVersionAtOrBelow, getLatestNpmVersion, getLatestPnpmVersion, getLatestYarnVersion, merge, mergePartialPlans, parseWorkspaceYamlContent, planProject, planWorkspace, projectPlanInputToOptions, resolveProjectPlanInput, resolveWorkspacePlanInput, unique, validatePackageName, workspacePlanInputToMonorepoParams };
|
|
129
133
|
export type { DetectedTooling, MetaConfig, PartialPlan, ProjectContext, ProjectPlan, ToolSelections };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FormatterMetaConfig, L as LinterMetaConfig, V as VirtualFileMap, C as CodeInjectionLocation, P as ProjectType, a as ConfigStrategy, E as EngineSpec, b as PackageVersions, c as Linter, d as Formatter, T as Testing, e as LibraryBundler, I as Ide, f as PackageManagerSpec, g as ProjectPlanInput, h as ProjectOptions, A as AiPlatform, W as WorkspacePlanInput } from './shared/create-krispya.
|
|
2
|
-
export { i as AiAgentsMetaConfig, B as BaseTemplate, D as DependencyVersionOptions, j as EditorMetaConfig, k as EngineName, l as FeatureSelections, m as FileRenderer, n as LibraryBundlerMetaConfig, o as PackageManagerMetaConfig, p as PackageManagerName, q as PlanBuilder, r as PlanDreiOptions, s as PlanFiberOptions, t as PlanGithubPagesOptions, u as PlanHandleOptions, v as PlanKootaOptions, w as PlanLevaOptions, x as PlanOffscreenOptions, y as PlanPostprocessingOptions, z as PlanRapierOptions, G as PlanTriplexOptions, H as PlanUikitOptions, J as PlanViverseOptions, K as PlanXrOptions, M as PlanZustandOptions, N as ProjectMetaConfig, O as ProjectPlanContext, Q as Template, R as TestingMetaConfig, S as ToolConfig, U as TypeScriptMetaConfig, X as VersionRangePrefix, Y as VirtualFile, Z as WorkspacePlanContext, _ as getBaseTemplate, $ as getLanguageFromTemplate } from './shared/create-krispya.
|
|
1
|
+
import { F as FormatterMetaConfig, L as LinterMetaConfig, V as VirtualFileMap, C as CodeInjectionLocation, P as ProjectType, a as ConfigStrategy, E as EngineSpec, b as PackageVersions, c as Linter, d as Formatter, T as Testing, e as LibraryBundler, I as Ide, f as PackageManagerSpec, g as ProjectPlanInput, h as ProjectOptions, A as AiPlatform, W as WorkspacePlanInput } from './shared/create-krispya.CcQTepKu.js';
|
|
2
|
+
export { i as AiAgentsMetaConfig, B as BaseTemplate, D as DependencyVersionOptions, j as EditorMetaConfig, k as EngineName, l as FeatureSelections, m as FileRenderer, n as LibraryBundlerMetaConfig, o as PackageManagerMetaConfig, p as PackageManagerName, q as PlanBuilder, r as PlanDreiOptions, s as PlanFiberOptions, t as PlanGithubPagesOptions, u as PlanHandleOptions, v as PlanKootaOptions, w as PlanLevaOptions, x as PlanOffscreenOptions, y as PlanPostprocessingOptions, z as PlanRapierOptions, G as PlanTriplexOptions, H as PlanUikitOptions, J as PlanViverseOptions, K as PlanXrOptions, M as PlanZustandOptions, N as ProjectMetaConfig, O as ProjectPlanContext, Q as Template, R as TestingMetaConfig, S as ToolConfig, U as TypeScriptMetaConfig, X as VersionRangePrefix, Y as VirtualFile, Z as WorkspacePlanContext, _ as getBaseTemplate, $ as getLanguageFromTemplate, a0 as shouldEnableReactCompiler } from './shared/create-krispya.CcQTepKu.js';
|
|
3
3
|
|
|
4
4
|
type MetaConfig = {
|
|
5
5
|
formatter: FormatterMetaConfig;
|
|
@@ -118,6 +118,10 @@ declare function getLatestNpmVersion(packageName: string, fallback: string): Pro
|
|
|
118
118
|
* Fetches the latest npm version within a specific major version.
|
|
119
119
|
*/
|
|
120
120
|
declare function getLatestNpmMajorVersion(packageName: string, majorVersion: string, fallback: string): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetches the latest npm version within the requested major, falling back to lower majors.
|
|
123
|
+
*/
|
|
124
|
+
declare function getLatestNpmMajorVersionAtOrBelow(packageName: string, majorVersion: string, fallback: string): Promise<string>;
|
|
121
125
|
declare function getLatestPnpmVersion(): Promise<string>;
|
|
122
126
|
declare function getLatestYarnVersion(): Promise<string>;
|
|
123
127
|
declare function getLatestNpmCliVersion(): Promise<string>;
|
|
@@ -125,5 +129,5 @@ declare function getLatestNodeVersion(): Promise<string>;
|
|
|
125
129
|
|
|
126
130
|
declare function parseWorkspaceYamlContent(content: string): string[];
|
|
127
131
|
|
|
128
|
-
export { AiPlatform, CodeInjectionLocation, ConfigStrategy, EngineSpec, Formatter, FormatterMetaConfig, Ide, LibraryBundler, Linter, LinterMetaConfig, PackageManagerSpec, PackageVersions, ProjectOptions, ProjectPlanInput, ProjectType, Testing, VirtualFileMap, WorkspacePlanInput, detectTooling, generateRandomName, getLatestNodeVersion, getLatestNpmCliVersion, getLatestNpmMajorVersion, getLatestNpmVersion, getLatestPnpmVersion, getLatestYarnVersion, merge, mergePartialPlans, parseWorkspaceYamlContent, planProject, planWorkspace, projectPlanInputToOptions, resolveProjectPlanInput, resolveWorkspacePlanInput, unique, validatePackageName, workspacePlanInputToMonorepoParams };
|
|
132
|
+
export { AiPlatform, CodeInjectionLocation, ConfigStrategy, EngineSpec, Formatter, FormatterMetaConfig, Ide, LibraryBundler, Linter, LinterMetaConfig, PackageManagerSpec, PackageVersions, ProjectOptions, ProjectPlanInput, ProjectType, Testing, VirtualFileMap, WorkspacePlanInput, detectTooling, generateRandomName, getLatestNodeVersion, getLatestNpmCliVersion, getLatestNpmMajorVersion, getLatestNpmMajorVersionAtOrBelow, getLatestNpmVersion, getLatestPnpmVersion, getLatestYarnVersion, merge, mergePartialPlans, parseWorkspaceYamlContent, planProject, planWorkspace, projectPlanInputToOptions, resolveProjectPlanInput, resolveWorkspacePlanInput, unique, validatePackageName, workspacePlanInputToMonorepoParams };
|
|
129
133
|
export type { DetectedTooling, MetaConfig, PartialPlan, ProjectContext, ProjectPlan, ToolSelections };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as detectTooling, g as generateRandomName, a as getBaseTemplate, b as getLanguageFromTemplate, c as getLatestNodeVersion, e as getLatestNpmCliVersion, f as getLatestNpmMajorVersion, h as
|
|
1
|
+
export { d as detectTooling, g as generateRandomName, a as getBaseTemplate, b as getLanguageFromTemplate, c as getLatestNodeVersion, e as getLatestNpmCliVersion, f as getLatestNpmMajorVersion, h as getLatestNpmMajorVersionAtOrBelow, i as getLatestNpmVersion, j as getLatestPnpmVersion, k as getLatestYarnVersion, m as merge, p as parseWorkspaceYamlContent, l as planProject, n as planWorkspace, o as projectPlanInputToOptions, r as resolveProjectPlanInput, q as resolveWorkspacePlanInput, s as shouldEnableReactCompiler, u as unique, v as validatePackageName, w as workspacePlanInputToMonorepoParams } from './shared/create-krispya.DZWMfM2v.mjs';
|
|
2
2
|
import 'fs/promises';
|
|
3
3
|
import 'fs';
|
|
4
4
|
import 'path';
|
|
@@ -232,6 +232,7 @@ type PlanBuilder = {
|
|
|
232
232
|
};
|
|
233
233
|
declare function getLanguageFromTemplate(template: Template): 'javascript' | 'typescript';
|
|
234
234
|
declare function getBaseTemplate(template: Template): BaseTemplate;
|
|
235
|
+
declare function shouldEnableReactCompiler(options: Pick<ProjectOptions, 'projectType' | 'template'>): boolean;
|
|
235
236
|
|
|
236
|
-
export { getLanguageFromTemplate as $, getBaseTemplate as _ };
|
|
237
|
+
export { getLanguageFromTemplate as $, getBaseTemplate as _, shouldEnableReactCompiler as a0 };
|
|
237
238
|
export type { AiPlatform as A, BaseTemplate as B, CodeInjectionLocation as C, DependencyVersionOptions as D, EngineSpec as E, FormatterMetaConfig as F, PlanTriplexOptions as G, PlanUikitOptions as H, Ide as I, PlanViverseOptions as J, PlanXrOptions as K, LinterMetaConfig as L, PlanZustandOptions as M, ProjectMetaConfig as N, ProjectPlanContext as O, ProjectType as P, Template as Q, TestingMetaConfig as R, ToolConfig as S, Testing as T, TypeScriptMetaConfig as U, VirtualFileMap as V, WorkspacePlanInput as W, VersionRangePrefix as X, VirtualFile as Y, WorkspacePlanContext as Z, ConfigStrategy as a, PackageVersions as b, Linter as c, Formatter as d, LibraryBundler as e, PackageManagerSpec as f, ProjectPlanInput as g, ProjectOptions as h, AiAgentsMetaConfig as i, EditorMetaConfig as j, EngineName as k, FeatureSelections as l, FileRenderer as m, LibraryBundlerMetaConfig as n, PackageManagerMetaConfig as o, PackageManagerName as p, PlanBuilder as q, PlanDreiOptions as r, PlanFiberOptions as s, PlanGithubPagesOptions as t, PlanHandleOptions as u, PlanKootaOptions as v, PlanLevaOptions as w, PlanOffscreenOptions as x, PlanPostprocessingOptions as y, PlanRapierOptions as z };
|
|
@@ -232,6 +232,7 @@ type PlanBuilder = {
|
|
|
232
232
|
};
|
|
233
233
|
declare function getLanguageFromTemplate(template: Template): 'javascript' | 'typescript';
|
|
234
234
|
declare function getBaseTemplate(template: Template): BaseTemplate;
|
|
235
|
+
declare function shouldEnableReactCompiler(options: Pick<ProjectOptions, 'projectType' | 'template'>): boolean;
|
|
235
236
|
|
|
236
|
-
export { getLanguageFromTemplate as $, getBaseTemplate as _ };
|
|
237
|
+
export { getLanguageFromTemplate as $, getBaseTemplate as _, shouldEnableReactCompiler as a0 };
|
|
237
238
|
export type { AiPlatform as A, BaseTemplate as B, CodeInjectionLocation as C, DependencyVersionOptions as D, EngineSpec as E, FormatterMetaConfig as F, PlanTriplexOptions as G, PlanUikitOptions as H, Ide as I, PlanViverseOptions as J, PlanXrOptions as K, LinterMetaConfig as L, PlanZustandOptions as M, ProjectMetaConfig as N, ProjectPlanContext as O, ProjectType as P, Template as Q, TestingMetaConfig as R, ToolConfig as S, Testing as T, TypeScriptMetaConfig as U, VirtualFileMap as V, WorkspacePlanInput as W, VersionRangePrefix as X, VirtualFile as Y, WorkspacePlanContext as Z, ConfigStrategy as a, PackageVersions as b, Linter as c, Formatter as d, LibraryBundler as e, PackageManagerSpec as f, ProjectPlanInput as g, ProjectOptions as h, AiAgentsMetaConfig as i, EditorMetaConfig as j, EngineName as k, FeatureSelections as l, FileRenderer as m, LibraryBundlerMetaConfig as n, PackageManagerMetaConfig as o, PackageManagerName as p, PlanBuilder as q, PlanDreiOptions as r, PlanFiberOptions as s, PlanGithubPagesOptions as t, PlanHandleOptions as u, PlanKootaOptions as v, PlanLevaOptions as w, PlanOffscreenOptions as x, PlanPostprocessingOptions as y, PlanRapierOptions as z };
|
|
@@ -232,6 +232,7 @@ type PlanBuilder = {
|
|
|
232
232
|
};
|
|
233
233
|
declare function getLanguageFromTemplate(template: Template): 'javascript' | 'typescript';
|
|
234
234
|
declare function getBaseTemplate(template: Template): BaseTemplate;
|
|
235
|
+
declare function shouldEnableReactCompiler(options: Pick<ProjectOptions, 'projectType' | 'template'>): boolean;
|
|
235
236
|
|
|
236
|
-
export { getLanguageFromTemplate as $, getBaseTemplate as _ };
|
|
237
|
+
export { getLanguageFromTemplate as $, getBaseTemplate as _, shouldEnableReactCompiler as a0 };
|
|
237
238
|
export type { AiPlatform as A, BaseTemplate as B, CodeInjectionLocation as C, DependencyVersionOptions as D, EngineSpec as E, FormatterMetaConfig as F, PlanTriplexOptions as G, PlanUikitOptions as H, Ide as I, PlanViverseOptions as J, PlanXrOptions as K, LinterMetaConfig as L, PlanZustandOptions as M, ProjectMetaConfig as N, ProjectPlanContext as O, ProjectType as P, Template as Q, TestingMetaConfig as R, ToolConfig as S, Testing as T, TypeScriptMetaConfig as U, VirtualFileMap as V, WorkspacePlanInput as W, VersionRangePrefix as X, VirtualFile as Y, WorkspacePlanContext as Z, ConfigStrategy as a, PackageVersions as b, Linter as c, Formatter as d, LibraryBundler as e, PackageManagerSpec as f, ProjectPlanInput as g, ProjectOptions as h, AiAgentsMetaConfig as i, EditorMetaConfig as j, EngineName as k, FeatureSelections as l, FileRenderer as m, LibraryBundlerMetaConfig as n, PackageManagerMetaConfig as o, PackageManagerName as p, PlanBuilder as q, PlanDreiOptions as r, PlanFiberOptions as s, PlanGithubPagesOptions as t, PlanHandleOptions as u, PlanKootaOptions as v, PlanLevaOptions as w, PlanOffscreenOptions as x, PlanPostprocessingOptions as y, PlanRapierOptions as z };
|
|
@@ -177,6 +177,10 @@ function getLanguageFromTemplate(template) {
|
|
|
177
177
|
function getBaseTemplate(template) {
|
|
178
178
|
return template.replace("-js", "");
|
|
179
179
|
}
|
|
180
|
+
function shouldEnableReactCompiler(options) {
|
|
181
|
+
const template = options.template ?? "vanilla";
|
|
182
|
+
return getBaseTemplate(template) === "react" && (options.projectType ?? "app") === "app";
|
|
183
|
+
}
|
|
180
184
|
|
|
181
185
|
function unique(...array) {
|
|
182
186
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -192,9 +196,7 @@ function merge(target, modification) {
|
|
|
192
196
|
const targetLabel = JSON.stringify(target);
|
|
193
197
|
const modificationLabel = JSON.stringify(modification);
|
|
194
198
|
if (modification == null) {
|
|
195
|
-
throw new Error(
|
|
196
|
-
`Cannot merge "${modificationLabel}" modification into target "${targetLabel}"`
|
|
197
|
-
);
|
|
199
|
+
throw new Error(`Cannot merge "${modificationLabel}" modification into target "${targetLabel}"`);
|
|
198
200
|
}
|
|
199
201
|
if (target == null) {
|
|
200
202
|
return modification;
|
|
@@ -441,16 +443,41 @@ function compareNumericSemver(a, b) {
|
|
|
441
443
|
}
|
|
442
444
|
return 0;
|
|
443
445
|
}
|
|
446
|
+
function getLatestMatchingMajorVersion(versions, majorVersion) {
|
|
447
|
+
return [...versions].filter((version) => version.split(".")[0] === majorVersion).sort((a, b) => compareNumericSemver(b, a))[0];
|
|
448
|
+
}
|
|
444
449
|
async function getLatestNpmMajorVersion(packageName, majorVersion, fallback) {
|
|
445
450
|
try {
|
|
446
451
|
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
447
452
|
const data = await response.json();
|
|
448
|
-
const latestMatchingVersion =
|
|
453
|
+
const latestMatchingVersion = getLatestMatchingMajorVersion(
|
|
454
|
+
Object.keys(data.versions ?? {}),
|
|
455
|
+
majorVersion
|
|
456
|
+
);
|
|
449
457
|
return latestMatchingVersion ?? fallback;
|
|
450
458
|
} catch {
|
|
451
459
|
return fallback;
|
|
452
460
|
}
|
|
453
461
|
}
|
|
462
|
+
async function getLatestNpmMajorVersionAtOrBelow(packageName, majorVersion, fallback) {
|
|
463
|
+
try {
|
|
464
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
465
|
+
const data = await response.json();
|
|
466
|
+
const versions = Object.keys(data.versions ?? {});
|
|
467
|
+
const requestedMajor = Number.parseInt(majorVersion, 10);
|
|
468
|
+
if (Number.isFinite(requestedMajor)) {
|
|
469
|
+
for (let major = requestedMajor; major >= 0; major -= 1) {
|
|
470
|
+
const latestMatchingVersion = getLatestMatchingMajorVersion(versions, String(major));
|
|
471
|
+
if (latestMatchingVersion != null) {
|
|
472
|
+
return latestMatchingVersion;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return fallback;
|
|
477
|
+
} catch {
|
|
478
|
+
return fallback;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
454
481
|
async function getLatestPnpmVersion() {
|
|
455
482
|
return getLatestNpmVersion("pnpm", "10.11.0");
|
|
456
483
|
}
|
|
@@ -497,6 +524,7 @@ function parseWorkspaceYamlContent(content) {
|
|
|
497
524
|
}
|
|
498
525
|
|
|
499
526
|
const PACKAGE_VERSION_DEFINITIONS = {
|
|
527
|
+
"@babel/core": { fallbackVersion: "7.29.0" },
|
|
500
528
|
"@biomejs/biome": { fallbackVersion: "2.0.0" },
|
|
501
529
|
"@react-three/drei": { fallbackVersion: "10.0.0" },
|
|
502
530
|
"@react-three/fiber": { fallbackVersion: "9.0.0" },
|
|
@@ -506,16 +534,20 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
506
534
|
"@react-three/rapier": { fallbackVersion: "2.1.0" },
|
|
507
535
|
"@react-three/uikit": { fallbackVersion: "0.8.15" },
|
|
508
536
|
"@react-three/xr": { fallbackVersion: "6.6.16" },
|
|
537
|
+
"@rolldown/plugin-babel": { fallbackVersion: "0.2.3" },
|
|
509
538
|
"@testing-library/dom": { fallbackVersion: "10.4.0" },
|
|
510
539
|
"@testing-library/react": { fallbackVersion: "16.2.0" },
|
|
540
|
+
"@types/babel__core": { fallbackVersion: "7.20.5" },
|
|
541
|
+
"@types/node": { fallbackVersion: "25.3.5" },
|
|
511
542
|
"@types/react": { fallbackVersion: "19.0.0" },
|
|
512
543
|
"@types/react-dom": { fallbackVersion: "19.0.0" },
|
|
513
544
|
"@types/three": { fallbackVersion: "0.175.0", prefix: "~" },
|
|
514
545
|
"@vitejs/plugin-basic-ssl": { fallbackVersion: "2.0.0" },
|
|
515
|
-
"@vitejs/plugin-react": { fallbackVersion: "
|
|
546
|
+
"@vitejs/plugin-react": { fallbackVersion: "6.0.1" },
|
|
516
547
|
"@viverse/cli": { fallbackVersion: "0.9.5-beta.8" },
|
|
517
548
|
eslint: { fallbackVersion: "9.17.0" },
|
|
518
549
|
"eslint-plugin-react-hooks": { fallbackVersion: "5.1.0" },
|
|
550
|
+
"babel-plugin-react-compiler": { fallbackVersion: "1.0.0" },
|
|
519
551
|
jsdom: { fallbackVersion: "26.0.0" },
|
|
520
552
|
koota: { fallbackVersion: "0.4.0" },
|
|
521
553
|
leva: { fallbackVersion: "0.10.0" },
|
|
@@ -530,7 +562,7 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
530
562
|
typescript: { fallbackVersion: "5.9.3" },
|
|
531
563
|
"typescript-eslint": { fallbackVersion: "8.18.0" },
|
|
532
564
|
unbuild: { fallbackVersion: "3.5.0" },
|
|
533
|
-
vite: { fallbackVersion: "
|
|
565
|
+
vite: { fallbackVersion: "8.0.12" },
|
|
534
566
|
vitest: { fallbackVersion: "4.0.0" },
|
|
535
567
|
zustand: { fallbackVersion: "5.0.3" }
|
|
536
568
|
};
|
|
@@ -624,17 +656,12 @@ async function resolveEngine(options) {
|
|
|
624
656
|
}
|
|
625
657
|
return engine;
|
|
626
658
|
}
|
|
627
|
-
function formatNodeTypesVersion(versions = {},
|
|
659
|
+
function formatNodeTypesVersion(versions = {}, _engine) {
|
|
628
660
|
const resolvedVersion = versions["@types/node"];
|
|
629
661
|
if (resolvedVersion != null) {
|
|
630
662
|
return `^${resolvedVersion}`;
|
|
631
663
|
}
|
|
632
|
-
|
|
633
|
-
if (engineSpec.name === "node" && engineSpec.version) {
|
|
634
|
-
const majorVersion = engineSpec.version.split(".")[0];
|
|
635
|
-
return `^${majorVersion}.0.0`;
|
|
636
|
-
}
|
|
637
|
-
return "^22.0.0";
|
|
664
|
+
return formatResolvedPackageVersion(versions, "@types/node");
|
|
638
665
|
}
|
|
639
666
|
async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
640
667
|
if (versions["@types/node"] != null) {
|
|
@@ -646,7 +673,11 @@ async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
|
646
673
|
}
|
|
647
674
|
const nodeVersion = engineSpec.version ?? await getLatestNodeVersion();
|
|
648
675
|
const majorVersion = nodeVersion.split(".")[0];
|
|
649
|
-
return
|
|
676
|
+
return getLatestNpmMajorVersionAtOrBelow(
|
|
677
|
+
"@types/node",
|
|
678
|
+
majorVersion,
|
|
679
|
+
getPackageFallbackVersion("@types/node")
|
|
680
|
+
);
|
|
650
681
|
}
|
|
651
682
|
async function resolvePackageVersions(packageNames, existingVersions = {}) {
|
|
652
683
|
const versions = { ...existingVersions };
|
|
@@ -701,6 +732,7 @@ function collectProjectPackageNames(options) {
|
|
|
701
732
|
const isReact = baseTemplate === "react" || baseTemplate === "r3f";
|
|
702
733
|
const isR3f = baseTemplate === "r3f";
|
|
703
734
|
const isTypescript = language === "typescript";
|
|
735
|
+
const useReactCompiler = shouldEnableReactCompiler(options);
|
|
704
736
|
const inWorkspace = options.workspaceRoot != null;
|
|
705
737
|
const testing = options.testing ?? (isLibrary ? "vitest" : "none");
|
|
706
738
|
const linter = options.linter ?? "oxlint";
|
|
@@ -722,10 +754,18 @@ function collectProjectPackageNames(options) {
|
|
|
722
754
|
addPackageName(packageNames, explicitVersions, "react");
|
|
723
755
|
addPackageName(packageNames, explicitVersions, "react-dom");
|
|
724
756
|
addPackageName(packageNames, explicitVersions, "@vitejs/plugin-react");
|
|
757
|
+
if (useReactCompiler) {
|
|
758
|
+
addPackageName(packageNames, explicitVersions, "@babel/core");
|
|
759
|
+
addPackageName(packageNames, explicitVersions, "@rolldown/plugin-babel");
|
|
760
|
+
addPackageName(packageNames, explicitVersions, "babel-plugin-react-compiler");
|
|
761
|
+
}
|
|
725
762
|
}
|
|
726
763
|
if (isTypescript) {
|
|
727
764
|
addPackageName(packageNames, explicitVersions, "@types/react");
|
|
728
765
|
addPackageName(packageNames, explicitVersions, "@types/react-dom");
|
|
766
|
+
if (useReactCompiler) {
|
|
767
|
+
addPackageName(packageNames, explicitVersions, "@types/babel__core");
|
|
768
|
+
}
|
|
729
769
|
}
|
|
730
770
|
}
|
|
731
771
|
if (isR3f) {
|
|
@@ -842,7 +882,7 @@ function renderTypescriptConfig(baseTemplateOrParams) {
|
|
|
842
882
|
const devDependencies = {};
|
|
843
883
|
assignResolvedPackageVersion(devDependencies, versions, "typescript");
|
|
844
884
|
if (getEngineName(engine) === "node") {
|
|
845
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
885
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
846
886
|
} else {
|
|
847
887
|
devDependencies["@types/node"] = "^22.0.0";
|
|
848
888
|
}
|
|
@@ -874,10 +914,7 @@ function renderTypescriptConfig(baseTemplateOrParams) {
|
|
|
874
914
|
const tsConfig = {
|
|
875
915
|
$schema: "https://json.schemastore.org/tsconfig",
|
|
876
916
|
files: [],
|
|
877
|
-
references: [
|
|
878
|
-
{ path: "./.config/tsconfig.app.json" },
|
|
879
|
-
{ path: "./.config/tsconfig.node.json" }
|
|
880
|
-
]
|
|
917
|
+
references: [{ path: "./.config/tsconfig.app.json" }, { path: "./.config/tsconfig.node.json" }]
|
|
881
918
|
};
|
|
882
919
|
files["tsconfig.json"] = {
|
|
883
920
|
type: "text",
|
|
@@ -1141,10 +1178,7 @@ function renderPackageJson(params) {
|
|
|
1141
1178
|
const allDevDependencies = { ...devDependencies };
|
|
1142
1179
|
const engine = getEngineSpec(options.engine);
|
|
1143
1180
|
if (getEngineName(engine) === "node" && engine.version) {
|
|
1144
|
-
allDevDependencies["@types/node"] ??= formatNodeTypesVersion(
|
|
1145
|
-
options.versions,
|
|
1146
|
-
options.engine
|
|
1147
|
-
);
|
|
1181
|
+
allDevDependencies["@types/node"] ??= formatNodeTypesVersion(options.versions, options.engine);
|
|
1148
1182
|
}
|
|
1149
1183
|
packageJson.scripts = resolvedScripts;
|
|
1150
1184
|
packageJson.dependencies = sortKeys(allDependencies);
|
|
@@ -1245,13 +1279,14 @@ function renderReadme(params) {
|
|
|
1245
1279
|
} else if (isReact) {
|
|
1246
1280
|
architectureDesc = [
|
|
1247
1281
|
`- \`src/app.${jsxExt}\` defines the main application component`,
|
|
1248
|
-
`- \`src/
|
|
1282
|
+
`- \`src/main.${jsxExt}\` renders the React app into the DOM`,
|
|
1249
1283
|
`- \`tests/\` contains your test files`,
|
|
1250
1284
|
`- Static assets can be placed in the \`public\` folder`
|
|
1251
1285
|
];
|
|
1252
1286
|
} else {
|
|
1253
1287
|
architectureDesc = [
|
|
1254
|
-
`- \`app.${jsxExt}\` defines the main application component containing your 3D content`,
|
|
1288
|
+
`- \`src/app.${jsxExt}\` defines the main application component containing your 3D content`,
|
|
1289
|
+
`- \`src/main.${jsxExt}\` renders the React app into the DOM`,
|
|
1255
1290
|
`- Modify the content inside the \`<Canvas>\` component to change what is visible on screen`,
|
|
1256
1291
|
`- \`tests/\` contains your test files`,
|
|
1257
1292
|
`- Static assets can be placed in the \`public\` folder`
|
|
@@ -1289,9 +1324,9 @@ const htmlContent = `<!DOCTYPE html>
|
|
|
1289
1324
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1290
1325
|
<title>$title</title>
|
|
1291
1326
|
</head>
|
|
1292
|
-
<body
|
|
1327
|
+
<body>
|
|
1328
|
+
<div id="root"></div>
|
|
1293
1329
|
<script type="module" src="$indexPath"><\/script>
|
|
1294
|
-
<div style="width: 100dvw; height: 100dvh; overflow: hidden;" id="root"></div>
|
|
1295
1330
|
</body>
|
|
1296
1331
|
</html>`;
|
|
1297
1332
|
const viteHtmlContent = `<!DOCTYPE html>
|
|
@@ -1308,6 +1343,7 @@ const viteHtmlContent = `<!DOCTYPE html>
|
|
|
1308
1343
|
</html>`;
|
|
1309
1344
|
const indexContent = `import { StrictMode } from 'react'
|
|
1310
1345
|
import { createRoot } from 'react-dom/client'
|
|
1346
|
+
import './index.css'
|
|
1311
1347
|
import { App } from './app.js'
|
|
1312
1348
|
|
|
1313
1349
|
createRoot(document.getElementById('root')!).render(
|
|
@@ -1315,28 +1351,31 @@ createRoot(document.getElementById('root')!).render(
|
|
|
1315
1351
|
<App />
|
|
1316
1352
|
</StrictMode>,
|
|
1317
1353
|
)`;
|
|
1318
|
-
const viteIndexContent = `import './
|
|
1354
|
+
const viteIndexContent = `import './index.css'
|
|
1319
1355
|
|
|
1320
1356
|
document.querySelector('#app')!.innerHTML = \`
|
|
1321
1357
|
<h1>Hello Vite!</h1>
|
|
1322
1358
|
<p>Edit src/main.ts and save to see HMR in action.</p>
|
|
1323
1359
|
\``;
|
|
1324
|
-
const viteStyleContent =
|
|
1325
|
-
font-family:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1360
|
+
const viteStyleContent = `:root {
|
|
1361
|
+
font-family:
|
|
1362
|
+
system-ui,
|
|
1363
|
+
-apple-system,
|
|
1364
|
+
sans-serif;
|
|
1365
|
+
line-height: 1.5;
|
|
1366
|
+
font-weight: 400;
|
|
1331
1367
|
}
|
|
1332
1368
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1369
|
+
*,
|
|
1370
|
+
*::before,
|
|
1371
|
+
*::after {
|
|
1372
|
+
box-sizing: border-box;
|
|
1335
1373
|
}
|
|
1336
1374
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1375
|
+
body {
|
|
1376
|
+
margin: 0;
|
|
1339
1377
|
}`;
|
|
1378
|
+
const viteEnvContent = `/// <reference types="vite/client" />`;
|
|
1340
1379
|
|
|
1341
1380
|
function renderSourceFiles(params) {
|
|
1342
1381
|
const { name, baseTemplate, language, isLibrary, codeSnippets, replacements } = params;
|
|
@@ -1346,6 +1385,9 @@ function renderSourceFiles(params) {
|
|
|
1346
1385
|
const isVanilla = baseTemplate === "vanilla";
|
|
1347
1386
|
const isReact = baseTemplate === "react";
|
|
1348
1387
|
const isR3f = baseTemplate === "r3f";
|
|
1388
|
+
if (!isLibrary && language === "typescript") {
|
|
1389
|
+
files["src/vite-env.d.ts"] = { type: "text", content: viteEnvContent };
|
|
1390
|
+
}
|
|
1349
1391
|
if (isLibrary) {
|
|
1350
1392
|
const libExt = isReact || isR3f ? jsxExt : ext;
|
|
1351
1393
|
let libContent;
|
|
@@ -1379,12 +1421,19 @@ function renderSourceFiles(params) {
|
|
|
1379
1421
|
files[`src/index.${libExt}`] = { type: "text", content: libContent };
|
|
1380
1422
|
} else if (isVanilla) {
|
|
1381
1423
|
files[`src/main.${ext}`] = { type: "text", content: viteIndexContent };
|
|
1382
|
-
files["src/
|
|
1424
|
+
files["src/index.css"] = { type: "text", content: viteStyleContent };
|
|
1383
1425
|
const indexHtml = viteHtmlContent.replace("$indexPath", `./src/main.${ext}`).replace("$title", name);
|
|
1384
1426
|
files["index.html"] = { type: "text", content: indexHtml };
|
|
1385
1427
|
} else {
|
|
1386
|
-
files[`src/
|
|
1387
|
-
|
|
1428
|
+
files[`src/main.${jsxExt}`] = {
|
|
1429
|
+
type: "text",
|
|
1430
|
+
content: language === "typescript" ? indexContent : indexContent.replace(
|
|
1431
|
+
"document.getElementById('root')!",
|
|
1432
|
+
"document.getElementById('root')"
|
|
1433
|
+
)
|
|
1434
|
+
};
|
|
1435
|
+
files["src/index.css"] = { type: "text", content: viteStyleContent };
|
|
1436
|
+
const indexHtml = htmlContent.replace("$indexPath", `./src/main.${jsxExt}`).replace("$title", name);
|
|
1388
1437
|
files["index.html"] = { type: "text", content: indexHtml };
|
|
1389
1438
|
codeSnippets["dom-end"]?.reverse();
|
|
1390
1439
|
codeSnippets["global-end"]?.reverse();
|
|
@@ -1426,7 +1475,7 @@ function renderSourceFiles(params) {
|
|
|
1426
1475
|
for (const { search, replace } of replacements) {
|
|
1427
1476
|
appCode = appCode.replace(search, replace);
|
|
1428
1477
|
}
|
|
1429
|
-
files[`src/app
|
|
1478
|
+
files[`src/app.${jsxExt}`] = { type: "text", content: appCode };
|
|
1430
1479
|
}
|
|
1431
1480
|
return files;
|
|
1432
1481
|
}
|
|
@@ -1750,7 +1799,7 @@ function formatValue(value, indent) {
|
|
|
1750
1799
|
if (value.startsWith("$raw:")) {
|
|
1751
1800
|
return value.slice(5);
|
|
1752
1801
|
}
|
|
1753
|
-
return
|
|
1802
|
+
return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
1754
1803
|
}
|
|
1755
1804
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
1756
1805
|
return String(value);
|
|
@@ -1758,8 +1807,17 @@ function formatValue(value, indent) {
|
|
|
1758
1807
|
if (value === null) {
|
|
1759
1808
|
return "null";
|
|
1760
1809
|
}
|
|
1810
|
+
if (value === void 0) {
|
|
1811
|
+
return "undefined";
|
|
1812
|
+
}
|
|
1813
|
+
if (typeof value === "bigint") {
|
|
1814
|
+
return value.toString();
|
|
1815
|
+
}
|
|
1761
1816
|
if (Array.isArray(value)) {
|
|
1762
1817
|
if (value.length === 0) return "[]";
|
|
1818
|
+
if (value.every((item) => item == null || typeof item !== "object")) {
|
|
1819
|
+
return `[${value.map((item) => formatValue(item, indent + 1)).join(", ")}]`;
|
|
1820
|
+
}
|
|
1763
1821
|
const items = value.map((v) => `${innerSpaces}${formatValue(v, indent + 1)}`);
|
|
1764
1822
|
return `[
|
|
1765
1823
|
${items.join(",\n")}
|
|
@@ -1769,22 +1827,22 @@ ${spaces}]`;
|
|
|
1769
1827
|
const entries = Object.entries(value);
|
|
1770
1828
|
if (entries.length === 0) return "{}";
|
|
1771
1829
|
const props = entries.map(
|
|
1772
|
-
([key, val]) => `${innerSpaces}${key}: ${formatValue(val, indent + 1)}
|
|
1830
|
+
([key, val]) => `${innerSpaces}${key}: ${formatValue(val, indent + 1)},`
|
|
1773
1831
|
);
|
|
1774
1832
|
return `{
|
|
1775
|
-
${props.join("
|
|
1833
|
+
${props.join("\n")}
|
|
1776
1834
|
${spaces}}`;
|
|
1777
1835
|
}
|
|
1778
|
-
|
|
1836
|
+
throw new TypeError(`Unsupported vite config value type: ${typeof value}`);
|
|
1779
1837
|
}
|
|
1780
1838
|
function renderViteConfig(params) {
|
|
1781
1839
|
const { viteConfig, codeSnippets } = params;
|
|
1782
1840
|
const configBody = formatValue(viteConfig, 0);
|
|
1783
1841
|
const viteConfigContent = [
|
|
1784
|
-
`import { defineConfig } from
|
|
1842
|
+
`import { defineConfig } from 'vite';`,
|
|
1785
1843
|
...codeSnippets["vite-config-import"] ?? [],
|
|
1786
1844
|
``,
|
|
1787
|
-
`export default defineConfig(${configBody})
|
|
1845
|
+
`export default defineConfig(${configBody});`,
|
|
1788
1846
|
``
|
|
1789
1847
|
].join("\n");
|
|
1790
1848
|
return { type: "text", content: viteConfigContent };
|
|
@@ -2258,7 +2316,7 @@ function renderMonorepo(params) {
|
|
|
2258
2316
|
const isPnpm = packageManager.name === "pnpm";
|
|
2259
2317
|
const devDependencies = {};
|
|
2260
2318
|
if (engine?.name === "node" && engine.version) {
|
|
2261
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
2319
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
2262
2320
|
} else {
|
|
2263
2321
|
devDependencies["@types/node"] = "^22.0.0";
|
|
2264
2322
|
}
|
|
@@ -2993,16 +3051,10 @@ function generateProvidersModule(builder) {
|
|
|
2993
3051
|
const resolvedProviders = providers.map((provider) => providerDefs[provider]);
|
|
2994
3052
|
const providerProps = resolvedProviders.flatMap((provider) => provider.props || []);
|
|
2995
3053
|
const providerImports = resolvedProviders.flatMap((provider) => provider.import);
|
|
2996
|
-
const wrappedComponents = resolvedProviders.filter(
|
|
2997
|
-
|
|
2998
|
-
);
|
|
2999
|
-
const
|
|
3000
|
-
(provider) => provider.type === "inline-jsx"
|
|
3001
|
-
);
|
|
3002
|
-
const layoutEffects = resolvedProviders.filter(
|
|
3003
|
-
(provider) => provider.type === "layout-effect"
|
|
3004
|
-
);
|
|
3005
|
-
const declaredProps = providerProps.map((prop) => `${prop.declaredPropName} = ${prop.declaredPropDefaultValue}`).join(", ");
|
|
3054
|
+
const wrappedComponents = resolvedProviders.filter((provider) => provider.type === "wrapped-jsx");
|
|
3055
|
+
const inlineComponents = resolvedProviders.filter((provider) => provider.type === "inline-jsx");
|
|
3056
|
+
const layoutEffects = resolvedProviders.filter((provider) => provider.type === "layout-effect");
|
|
3057
|
+
const declaredProps = providerProps.map((prop) => `${prop.declaredPropName} = ${String(prop.declaredPropDefaultValue)}`).join(", ");
|
|
3006
3058
|
const declaredTypes = providerProps.map((prop) => `${prop.declaredPropName}?: ${prop.declaredPropType}`).join("; ");
|
|
3007
3059
|
const reactImports = ["type ReactNode"];
|
|
3008
3060
|
if (layoutEffects.length) {
|
|
@@ -3019,11 +3071,11 @@ ${jsdoc.split("\n").map((line) => ` * ${line}`).join("\n")}
|
|
|
3019
3071
|
${layoutEffects.length ? `
|
|
3020
3072
|
useLayoutEffect(() => {
|
|
3021
3073
|
${layoutEffects.map((effect) => effect.code).join("\n")}
|
|
3022
|
-
}, [${layoutEffects.map((effect) => effect.props?.[0]?.propValue)}]);
|
|
3074
|
+
}, [${layoutEffects.map((effect) => effect.props?.[0]?.propValue).join(", ")}]);
|
|
3023
3075
|
` : ""}
|
|
3024
3076
|
return (
|
|
3025
3077
|
<>
|
|
3026
|
-
${inlineComponents.map((provider) => provider.code)}
|
|
3078
|
+
${inlineComponents.map((provider) => provider.code).join("\n")}
|
|
3027
3079
|
${wrappedComponents.reduce((acc, provider) => {
|
|
3028
3080
|
const props = provider.props?.map((prop) => `${prop.propName}={${prop.propValue}}`).join(" ");
|
|
3029
3081
|
return `<${provider.component} ${props}>${acc}</${provider.component}>`;
|
|
@@ -3282,7 +3334,7 @@ function planXr(builder, options) {
|
|
|
3282
3334
|
);
|
|
3283
3335
|
builder.inject("scene-start", "<XR store={store}>");
|
|
3284
3336
|
builder.inject("scene-end", "</XR>");
|
|
3285
|
-
builder.inject("vite-config-import", "import basicSsl from '@vitejs/plugin-basic-ssl'");
|
|
3337
|
+
builder.inject("vite-config-import", "import basicSsl from '@vitejs/plugin-basic-ssl';");
|
|
3286
3338
|
builder.configureVite({
|
|
3287
3339
|
server: {
|
|
3288
3340
|
host: true
|
|
@@ -3549,6 +3601,7 @@ function createProjectPlan(planInput) {
|
|
|
3549
3601
|
const isReact = baseTemplate === "react";
|
|
3550
3602
|
const isR3f = baseTemplate === "r3f";
|
|
3551
3603
|
const isLibrary = clonedOptions.projectType === "library";
|
|
3604
|
+
const useReactCompiler = shouldEnableReactCompiler(clonedOptions);
|
|
3552
3605
|
const libraryBundler = planInput.libraryBundler.tool;
|
|
3553
3606
|
const ide = planInput.ide.tool;
|
|
3554
3607
|
const files = {
|
|
@@ -3572,6 +3625,11 @@ function createProjectPlan(planInput) {
|
|
|
3572
3625
|
assignResolvedPackageVersion(dependencies, versions, "react");
|
|
3573
3626
|
assignResolvedPackageVersion(dependencies, versions, "react-dom");
|
|
3574
3627
|
assignResolvedPackageVersion(devDependencies, versions, "@vitejs/plugin-react");
|
|
3628
|
+
if (useReactCompiler) {
|
|
3629
|
+
assignResolvedPackageVersion(devDependencies, versions, "@babel/core");
|
|
3630
|
+
assignResolvedPackageVersion(devDependencies, versions, "@rolldown/plugin-babel");
|
|
3631
|
+
assignResolvedPackageVersion(devDependencies, versions, "babel-plugin-react-compiler");
|
|
3632
|
+
}
|
|
3575
3633
|
}
|
|
3576
3634
|
}
|
|
3577
3635
|
if (isR3f) {
|
|
@@ -3593,12 +3651,20 @@ function createProjectPlan(planInput) {
|
|
|
3593
3651
|
});
|
|
3594
3652
|
Object.assign(files, tsResult.files);
|
|
3595
3653
|
Object.assign(devDependencies, tsResult.devDependencies);
|
|
3654
|
+
if (useReactCompiler) {
|
|
3655
|
+
assignResolvedPackageVersion(devDependencies, versions, "@types/babel__core");
|
|
3656
|
+
}
|
|
3596
3657
|
}
|
|
3597
3658
|
const codeSnippets = {};
|
|
3598
3659
|
const vscodeSettings = {};
|
|
3599
3660
|
const scripts = {};
|
|
3600
3661
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3601
|
-
codeSnippets["vite-config-import"] = [
|
|
3662
|
+
codeSnippets["vite-config-import"] = [
|
|
3663
|
+
useReactCompiler ? "import react, { reactCompilerPreset } from '@vitejs/plugin-react';" : "import react from '@vitejs/plugin-react';"
|
|
3664
|
+
];
|
|
3665
|
+
if (useReactCompiler) {
|
|
3666
|
+
codeSnippets["vite-config-import"].push("import babel from '@rolldown/plugin-babel';");
|
|
3667
|
+
}
|
|
3602
3668
|
}
|
|
3603
3669
|
if (!isLibrary && isR3f) {
|
|
3604
3670
|
codeSnippets["import"] = [`import { Canvas } from "@react-three/fiber"`];
|
|
@@ -3609,7 +3675,7 @@ function createProjectPlan(planInput) {
|
|
|
3609
3675
|
base: "./"
|
|
3610
3676
|
};
|
|
3611
3677
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3612
|
-
viteConfig.plugins = ["$raw:react()"];
|
|
3678
|
+
viteConfig.plugins = useReactCompiler ? ["$raw:react()", "$raw:babel({ presets: [reactCompilerPreset()] })"] : ["$raw:react()"];
|
|
3613
3679
|
}
|
|
3614
3680
|
if (!isLibrary && isR3f) {
|
|
3615
3681
|
viteConfig.resolve = { dedupe: ["three"] };
|
|
@@ -3714,7 +3780,9 @@ function createProjectPlan(planInput) {
|
|
|
3714
3780
|
} else if (planInput.formatter.tool === "oxfmt") {
|
|
3715
3781
|
planOxfmt(builder, planInput.formatter);
|
|
3716
3782
|
} else if (planInput.formatter.tool === "biome" && planInput.linter.tool !== "biome") {
|
|
3717
|
-
planBiome(builder, {
|
|
3783
|
+
planBiome(builder, {
|
|
3784
|
+
formatter: planInput.formatter
|
|
3785
|
+
});
|
|
3718
3786
|
}
|
|
3719
3787
|
for (const { code, location } of clonedOptions.injections ?? []) {
|
|
3720
3788
|
builder.inject(location, code);
|
|
@@ -3840,4 +3908,4 @@ async function planWorkspace(input) {
|
|
|
3840
3908
|
};
|
|
3841
3909
|
}
|
|
3842
3910
|
|
|
3843
|
-
export { ALL_AI_PLATFORMS as A,
|
|
3911
|
+
export { ALL_AI_PLATFORMS as A, parsePackageManager as B, parseEngine as C, renderTypescriptConfigPackage as D, renderOxlintConfigPackage as E, renderEslintConfigPackage as F, renderOxfmtConfigPackage as G, renderPrettierConfigPackage as H, resolveMonorepoRootPackageVersions as I, getResolvedPackageVersion as J, renderVscodeFiles as K, renderAiFiles as L, renderVscodeFiles$1 as M, renderEditorConfig as N, renderGitignore as O, toPrettierIgnoreContent as P, mergePackageJsonScripts as Q, renderViteConfig as R, packageJsonScripts as S, resolveDefaultPackageJsonScripts as T, formatResolvedPackageVersion as U, renderOxlintConfig as V, getBaseTemplate as a, getLanguageFromTemplate as b, getLatestNodeVersion as c, detectTooling as d, getLatestNpmCliVersion as e, getLatestNpmMajorVersion as f, generateRandomName as g, getLatestNpmMajorVersionAtOrBelow as h, getLatestNpmVersion as i, getLatestPnpmVersion as j, getLatestYarnVersion as k, planProject as l, merge as m, planWorkspace as n, projectPlanInputToOptions as o, parseWorkspaceYamlContent as p, resolveWorkspacePlanInput as q, resolveProjectPlanInput as r, shouldEnableReactCompiler as s, getEngineName as t, unique as u, validatePackageName as v, workspacePlanInputToMonorepoParams as w, getPackageManagerName as x, AI_PLATFORM_LABELS as y, AI_PLATFORM_HINTS as z };
|