create-krispya 0.11.0 → 0.13.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 +30 -4
- 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 +30 -4
- 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.DblF9gKc.mjs → create-krispya.B2px1YOh.mjs} +108 -19
- 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.8KaGuRpu.cjs → create-krispya.CiGwBdQ3.cjs} +109 -18
- package/package.json +14 -14
package/dist/cli.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const node_module = require('node:module');
|
|
|
9
9
|
const node_path = require('node:path');
|
|
10
10
|
const node_process = require('node:process');
|
|
11
11
|
const undici = require('undici');
|
|
12
|
-
const workspace = require('./shared/create-krispya.
|
|
12
|
+
const workspace = require('./shared/create-krispya.CiGwBdQ3.cjs');
|
|
13
13
|
const Conf = require('conf');
|
|
14
14
|
const promises = require('fs/promises');
|
|
15
15
|
const fs = require('fs');
|
|
@@ -51,7 +51,9 @@ function formatConfigSummary(options, inherited) {
|
|
|
51
51
|
const projectType = options.projectType ?? "app";
|
|
52
52
|
const baseTemplate = options.template ? workspace.getBaseTemplate(options.template) : "vanilla";
|
|
53
53
|
if (baseTemplate === "react") {
|
|
54
|
-
lines.push(
|
|
54
|
+
lines.push(
|
|
55
|
+
formatRow("Framework", workspace.shouldEnableReactCompiler(options) ? "React + compiler" : "React")
|
|
56
|
+
);
|
|
55
57
|
} else if (baseTemplate === "r3f") {
|
|
56
58
|
lines.push(formatRow("Framework", "React Three Fiber"));
|
|
57
59
|
}
|
|
@@ -1259,12 +1261,18 @@ function detectViteTemplate(pkg) {
|
|
|
1259
1261
|
}
|
|
1260
1262
|
function renderExpectedViteConfig(template) {
|
|
1261
1263
|
const isReact = template === "react" || template === "r3f";
|
|
1262
|
-
const
|
|
1264
|
+
const useReactCompiler = template === "react";
|
|
1265
|
+
const codeSnippets = isReact ? {
|
|
1266
|
+
"vite-config-import": [
|
|
1267
|
+
useReactCompiler ? "import react, { reactCompilerPreset } from '@vitejs/plugin-react';" : "import react from '@vitejs/plugin-react';",
|
|
1268
|
+
...useReactCompiler ? ["import babel from '@rolldown/plugin-babel';"] : []
|
|
1269
|
+
]
|
|
1270
|
+
} : {};
|
|
1263
1271
|
const viteConfig = {
|
|
1264
1272
|
base: "./"
|
|
1265
1273
|
};
|
|
1266
1274
|
if (isReact) {
|
|
1267
|
-
viteConfig.plugins = ["$raw:react()"];
|
|
1275
|
+
viteConfig.plugins = useReactCompiler ? ["$raw:react()", "$raw:babel({ presets: [reactCompilerPreset()] })"] : ["$raw:react()"];
|
|
1268
1276
|
}
|
|
1269
1277
|
if (template === "r3f") {
|
|
1270
1278
|
viteConfig.resolve = { dedupe: ["three"] };
|
|
@@ -1610,6 +1618,11 @@ function hasPackage(pkg, name) {
|
|
|
1610
1618
|
function sortPackageMap(packageMap) {
|
|
1611
1619
|
return Object.fromEntries(Object.entries(packageMap).sort(([a], [b]) => a.localeCompare(b)));
|
|
1612
1620
|
}
|
|
1621
|
+
function addMissingDevDependency(pkg, devDependencies, name) {
|
|
1622
|
+
if (!hasPackage(pkg, name)) {
|
|
1623
|
+
devDependencies[name] = workspace.formatResolvedPackageVersion({}, name);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1613
1626
|
async function detectTypeScriptPackage(root, pkg) {
|
|
1614
1627
|
if (hasPackage(pkg, "typescript")) return true;
|
|
1615
1628
|
return await fileExists(path.join(root, "tsconfig.json")) || await fileExists(path.join(root, "tsconfig.app.json")) || await fileExists(path.join(root, ".config/tsconfig.app.json"));
|
|
@@ -1672,6 +1685,17 @@ async function getExpectedPackageDevDependencies(root, config, pkg) {
|
|
|
1672
1685
|
if (shouldAddOxlintTypeAwareBackend) {
|
|
1673
1686
|
nextDevDependencies["oxlint-tsgolint"] = workspace.formatResolvedPackageVersion({}, "oxlint-tsgolint");
|
|
1674
1687
|
}
|
|
1688
|
+
if (!config.isMonorepo && config.viteTemplate === "react") {
|
|
1689
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@babel/core");
|
|
1690
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@rolldown/plugin-babel");
|
|
1691
|
+
addMissingDevDependency(pkg, nextDevDependencies, "babel-plugin-react-compiler");
|
|
1692
|
+
if (config.linter === "oxlint") {
|
|
1693
|
+
addMissingDevDependency(pkg, nextDevDependencies, "eslint-plugin-react-hooks");
|
|
1694
|
+
}
|
|
1695
|
+
if (await detectTypeScriptPackage(root, pkg)) {
|
|
1696
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@types/babel__core");
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1675
1699
|
return sortPackageMap(nextDevDependencies);
|
|
1676
1700
|
}
|
|
1677
1701
|
async function getPackageJsonScriptUpdates(root, config) {
|
|
@@ -1722,6 +1746,8 @@ function planSinglePackageOxlintConfig(config) {
|
|
|
1722
1746
|
const path = isStealth ? ".config/oxlint.json" : "oxlint.json";
|
|
1723
1747
|
const oxlintConfig = workspace.renderOxlintConfig({
|
|
1724
1748
|
schemaPath: isStealth ? "../node_modules/oxlint/configuration_schema.json" : "./node_modules/oxlint/configuration_schema.json",
|
|
1749
|
+
react: config.viteTemplate === "react" || config.viteTemplate === "r3f",
|
|
1750
|
+
reactCompiler: config.viteTemplate === "react",
|
|
1725
1751
|
typescript: true
|
|
1726
1752
|
});
|
|
1727
1753
|
return {
|
package/dist/cli.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.
|
|
2
|
+
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.CcQTepKu.cjs';
|
|
3
3
|
|
|
4
4
|
interface CliOptions {
|
|
5
5
|
type?: ProjectType;
|
package/dist/cli.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.
|
|
2
|
+
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.CcQTepKu.mjs';
|
|
3
3
|
|
|
4
4
|
interface CliOptions {
|
|
5
5
|
type?: ProjectType;
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.
|
|
2
|
+
import { P as ProjectType, e as LibraryBundler, Q as Template, p as PackageManagerName, I as Ide } from './shared/create-krispya.CcQTepKu.js';
|
|
3
3
|
|
|
4
4
|
interface CliOptions {
|
|
5
5
|
type?: ProjectType;
|
package/dist/cli.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { createRequire } from 'node:module';
|
|
|
7
7
|
import { resolve, join as join$1, dirname } from 'node:path';
|
|
8
8
|
import { cwd } from 'node:process';
|
|
9
9
|
import { fetch } from 'undici';
|
|
10
|
-
import {
|
|
10
|
+
import { t as getEngineName, a as getBaseTemplate, s as shouldEnableReactCompiler, b as getLanguageFromTemplate, x as getPackageManagerName, g as generateRandomName, A as ALL_AI_PLATFORMS, y as AI_PLATFORM_LABELS, z as AI_PLATFORM_HINTS, d as detectTooling, B as parsePackageManager, C as parseEngine, p as parseWorkspaceYamlContent, D as renderTypescriptConfigPackage, E as renderOxlintConfigPackage, F as renderEslintConfigPackage, G as renderOxfmtConfigPackage, H as renderPrettierConfigPackage, I as resolveMonorepoRootPackageVersions, J as getResolvedPackageVersion, K as renderVscodeFiles, L as renderAiFiles, M as renderVscodeFiles$1, N as renderEditorConfig, O as renderGitignore, P as toPrettierIgnoreContent, Q as mergePackageJsonScripts, R as renderViteConfig, S as packageJsonScripts, T as resolveDefaultPackageJsonScripts, U as formatResolvedPackageVersion, V as renderOxlintConfig, l as planProject, r as resolveProjectPlanInput, v as validatePackageName, q as resolveWorkspacePlanInput, n as planWorkspace } from './shared/create-krispya.B2px1YOh.mjs';
|
|
11
11
|
import Conf from 'conf';
|
|
12
12
|
import { access, constants, readFile as readFile$1, mkdir as mkdir$1, writeFile as writeFile$1 } from 'fs/promises';
|
|
13
13
|
import { constants as constants$2 } from 'fs';
|
|
@@ -30,7 +30,9 @@ function formatConfigSummary(options, inherited) {
|
|
|
30
30
|
const projectType = options.projectType ?? "app";
|
|
31
31
|
const baseTemplate = options.template ? getBaseTemplate(options.template) : "vanilla";
|
|
32
32
|
if (baseTemplate === "react") {
|
|
33
|
-
lines.push(
|
|
33
|
+
lines.push(
|
|
34
|
+
formatRow("Framework", shouldEnableReactCompiler(options) ? "React + compiler" : "React")
|
|
35
|
+
);
|
|
34
36
|
} else if (baseTemplate === "r3f") {
|
|
35
37
|
lines.push(formatRow("Framework", "React Three Fiber"));
|
|
36
38
|
}
|
|
@@ -1238,12 +1240,18 @@ function detectViteTemplate(pkg) {
|
|
|
1238
1240
|
}
|
|
1239
1241
|
function renderExpectedViteConfig(template) {
|
|
1240
1242
|
const isReact = template === "react" || template === "r3f";
|
|
1241
|
-
const
|
|
1243
|
+
const useReactCompiler = template === "react";
|
|
1244
|
+
const codeSnippets = isReact ? {
|
|
1245
|
+
"vite-config-import": [
|
|
1246
|
+
useReactCompiler ? "import react, { reactCompilerPreset } from '@vitejs/plugin-react';" : "import react from '@vitejs/plugin-react';",
|
|
1247
|
+
...useReactCompiler ? ["import babel from '@rolldown/plugin-babel';"] : []
|
|
1248
|
+
]
|
|
1249
|
+
} : {};
|
|
1242
1250
|
const viteConfig = {
|
|
1243
1251
|
base: "./"
|
|
1244
1252
|
};
|
|
1245
1253
|
if (isReact) {
|
|
1246
|
-
viteConfig.plugins = ["$raw:react()"];
|
|
1254
|
+
viteConfig.plugins = useReactCompiler ? ["$raw:react()", "$raw:babel({ presets: [reactCompilerPreset()] })"] : ["$raw:react()"];
|
|
1247
1255
|
}
|
|
1248
1256
|
if (template === "r3f") {
|
|
1249
1257
|
viteConfig.resolve = { dedupe: ["three"] };
|
|
@@ -1589,6 +1597,11 @@ function hasPackage(pkg, name) {
|
|
|
1589
1597
|
function sortPackageMap(packageMap) {
|
|
1590
1598
|
return Object.fromEntries(Object.entries(packageMap).sort(([a], [b]) => a.localeCompare(b)));
|
|
1591
1599
|
}
|
|
1600
|
+
function addMissingDevDependency(pkg, devDependencies, name) {
|
|
1601
|
+
if (!hasPackage(pkg, name)) {
|
|
1602
|
+
devDependencies[name] = formatResolvedPackageVersion({}, name);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1592
1605
|
async function detectTypeScriptPackage(root, pkg) {
|
|
1593
1606
|
if (hasPackage(pkg, "typescript")) return true;
|
|
1594
1607
|
return await fileExists(join(root, "tsconfig.json")) || await fileExists(join(root, "tsconfig.app.json")) || await fileExists(join(root, ".config/tsconfig.app.json"));
|
|
@@ -1651,6 +1664,17 @@ async function getExpectedPackageDevDependencies(root, config, pkg) {
|
|
|
1651
1664
|
if (shouldAddOxlintTypeAwareBackend) {
|
|
1652
1665
|
nextDevDependencies["oxlint-tsgolint"] = formatResolvedPackageVersion({}, "oxlint-tsgolint");
|
|
1653
1666
|
}
|
|
1667
|
+
if (!config.isMonorepo && config.viteTemplate === "react") {
|
|
1668
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@babel/core");
|
|
1669
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@rolldown/plugin-babel");
|
|
1670
|
+
addMissingDevDependency(pkg, nextDevDependencies, "babel-plugin-react-compiler");
|
|
1671
|
+
if (config.linter === "oxlint") {
|
|
1672
|
+
addMissingDevDependency(pkg, nextDevDependencies, "eslint-plugin-react-hooks");
|
|
1673
|
+
}
|
|
1674
|
+
if (await detectTypeScriptPackage(root, pkg)) {
|
|
1675
|
+
addMissingDevDependency(pkg, nextDevDependencies, "@types/babel__core");
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1654
1678
|
return sortPackageMap(nextDevDependencies);
|
|
1655
1679
|
}
|
|
1656
1680
|
async function getPackageJsonScriptUpdates(root, config) {
|
|
@@ -1701,6 +1725,8 @@ function planSinglePackageOxlintConfig(config) {
|
|
|
1701
1725
|
const path = isStealth ? ".config/oxlint.json" : "oxlint.json";
|
|
1702
1726
|
const oxlintConfig = renderOxlintConfig({
|
|
1703
1727
|
schemaPath: isStealth ? "../node_modules/oxlint/configuration_schema.json" : "./node_modules/oxlint/configuration_schema.json",
|
|
1728
|
+
react: config.viteTemplate === "react" || config.viteTemplate === "r3f",
|
|
1729
|
+
reactCompiler: config.viteTemplate === "react",
|
|
1704
1730
|
typescript: true
|
|
1705
1731
|
});
|
|
1706
1732
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const workspace = require('./shared/create-krispya.
|
|
3
|
+
const workspace = require('./shared/create-krispya.CiGwBdQ3.cjs');
|
|
4
4
|
require('fs/promises');
|
|
5
5
|
require('fs');
|
|
6
6
|
require('path');
|
|
@@ -44,6 +44,7 @@ exports.getLanguageFromTemplate = workspace.getLanguageFromTemplate;
|
|
|
44
44
|
exports.getLatestNodeVersion = workspace.getLatestNodeVersion;
|
|
45
45
|
exports.getLatestNpmCliVersion = workspace.getLatestNpmCliVersion;
|
|
46
46
|
exports.getLatestNpmMajorVersion = workspace.getLatestNpmMajorVersion;
|
|
47
|
+
exports.getLatestNpmMajorVersionAtOrBelow = workspace.getLatestNpmMajorVersionAtOrBelow;
|
|
47
48
|
exports.getLatestNpmVersion = workspace.getLatestNpmVersion;
|
|
48
49
|
exports.getLatestPnpmVersion = workspace.getLatestPnpmVersion;
|
|
49
50
|
exports.getLatestYarnVersion = workspace.getLatestYarnVersion;
|
|
@@ -54,6 +55,7 @@ exports.planWorkspace = workspace.planWorkspace;
|
|
|
54
55
|
exports.projectPlanInputToOptions = workspace.projectPlanInputToOptions;
|
|
55
56
|
exports.resolveProjectPlanInput = workspace.resolveProjectPlanInput;
|
|
56
57
|
exports.resolveWorkspacePlanInput = workspace.resolveWorkspacePlanInput;
|
|
58
|
+
exports.shouldEnableReactCompiler = workspace.shouldEnableReactCompiler;
|
|
57
59
|
exports.unique = workspace.unique;
|
|
58
60
|
exports.validatePackageName = workspace.validatePackageName;
|
|
59
61
|
exports.workspacePlanInputToMonorepoParams = workspace.workspacePlanInputToMonorepoParams;
|
package/dist/index.d.cts
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.cjs';
|
|
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.cjs';
|
|
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.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.B2px1YOh.mjs';
|
|
2
2
|
import 'fs/promises';
|
|
3
3
|
import 'fs';
|
|
4
4
|
import 'path';
|
|
@@ -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();
|
|
@@ -439,16 +443,41 @@ function compareNumericSemver(a, b) {
|
|
|
439
443
|
}
|
|
440
444
|
return 0;
|
|
441
445
|
}
|
|
446
|
+
function getLatestMatchingMajorVersion(versions, majorVersion) {
|
|
447
|
+
return [...versions].filter((version) => version.split(".")[0] === majorVersion).sort((a, b) => compareNumericSemver(b, a))[0];
|
|
448
|
+
}
|
|
442
449
|
async function getLatestNpmMajorVersion(packageName, majorVersion, fallback) {
|
|
443
450
|
try {
|
|
444
451
|
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
445
452
|
const data = await response.json();
|
|
446
|
-
const latestMatchingVersion =
|
|
453
|
+
const latestMatchingVersion = getLatestMatchingMajorVersion(
|
|
454
|
+
Object.keys(data.versions ?? {}),
|
|
455
|
+
majorVersion
|
|
456
|
+
);
|
|
447
457
|
return latestMatchingVersion ?? fallback;
|
|
448
458
|
} catch {
|
|
449
459
|
return fallback;
|
|
450
460
|
}
|
|
451
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
|
+
}
|
|
452
481
|
async function getLatestPnpmVersion() {
|
|
453
482
|
return getLatestNpmVersion("pnpm", "10.11.0");
|
|
454
483
|
}
|
|
@@ -495,6 +524,7 @@ function parseWorkspaceYamlContent(content) {
|
|
|
495
524
|
}
|
|
496
525
|
|
|
497
526
|
const PACKAGE_VERSION_DEFINITIONS = {
|
|
527
|
+
"@babel/core": { fallbackVersion: "7.29.0" },
|
|
498
528
|
"@biomejs/biome": { fallbackVersion: "2.0.0" },
|
|
499
529
|
"@react-three/drei": { fallbackVersion: "10.0.0" },
|
|
500
530
|
"@react-three/fiber": { fallbackVersion: "9.0.0" },
|
|
@@ -504,16 +534,20 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
504
534
|
"@react-three/rapier": { fallbackVersion: "2.1.0" },
|
|
505
535
|
"@react-three/uikit": { fallbackVersion: "0.8.15" },
|
|
506
536
|
"@react-three/xr": { fallbackVersion: "6.6.16" },
|
|
537
|
+
"@rolldown/plugin-babel": { fallbackVersion: "0.2.3" },
|
|
507
538
|
"@testing-library/dom": { fallbackVersion: "10.4.0" },
|
|
508
539
|
"@testing-library/react": { fallbackVersion: "16.2.0" },
|
|
540
|
+
"@types/babel__core": { fallbackVersion: "7.20.5" },
|
|
541
|
+
"@types/node": { fallbackVersion: "25.3.5" },
|
|
509
542
|
"@types/react": { fallbackVersion: "19.0.0" },
|
|
510
543
|
"@types/react-dom": { fallbackVersion: "19.0.0" },
|
|
511
544
|
"@types/three": { fallbackVersion: "0.175.0", prefix: "~" },
|
|
512
545
|
"@vitejs/plugin-basic-ssl": { fallbackVersion: "2.0.0" },
|
|
513
|
-
"@vitejs/plugin-react": { fallbackVersion: "
|
|
546
|
+
"@vitejs/plugin-react": { fallbackVersion: "6.0.1" },
|
|
514
547
|
"@viverse/cli": { fallbackVersion: "0.9.5-beta.8" },
|
|
515
548
|
eslint: { fallbackVersion: "9.17.0" },
|
|
516
|
-
"eslint-plugin-react-hooks": { fallbackVersion: "
|
|
549
|
+
"eslint-plugin-react-hooks": { fallbackVersion: "7.1.1" },
|
|
550
|
+
"babel-plugin-react-compiler": { fallbackVersion: "1.0.0" },
|
|
517
551
|
jsdom: { fallbackVersion: "26.0.0" },
|
|
518
552
|
koota: { fallbackVersion: "0.4.0" },
|
|
519
553
|
leva: { fallbackVersion: "0.10.0" },
|
|
@@ -528,7 +562,7 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
528
562
|
typescript: { fallbackVersion: "5.9.3" },
|
|
529
563
|
"typescript-eslint": { fallbackVersion: "8.18.0" },
|
|
530
564
|
unbuild: { fallbackVersion: "3.5.0" },
|
|
531
|
-
vite: { fallbackVersion: "
|
|
565
|
+
vite: { fallbackVersion: "8.0.12" },
|
|
532
566
|
vitest: { fallbackVersion: "4.0.0" },
|
|
533
567
|
zustand: { fallbackVersion: "5.0.3" }
|
|
534
568
|
};
|
|
@@ -622,17 +656,12 @@ async function resolveEngine(options) {
|
|
|
622
656
|
}
|
|
623
657
|
return engine;
|
|
624
658
|
}
|
|
625
|
-
function formatNodeTypesVersion(versions = {},
|
|
659
|
+
function formatNodeTypesVersion(versions = {}, _engine) {
|
|
626
660
|
const resolvedVersion = versions["@types/node"];
|
|
627
661
|
if (resolvedVersion != null) {
|
|
628
662
|
return `^${resolvedVersion}`;
|
|
629
663
|
}
|
|
630
|
-
|
|
631
|
-
if (engineSpec.name === "node" && engineSpec.version) {
|
|
632
|
-
const majorVersion = engineSpec.version.split(".")[0];
|
|
633
|
-
return `^${majorVersion}.0.0`;
|
|
634
|
-
}
|
|
635
|
-
return "^22.0.0";
|
|
664
|
+
return formatResolvedPackageVersion(versions, "@types/node");
|
|
636
665
|
}
|
|
637
666
|
async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
638
667
|
if (versions["@types/node"] != null) {
|
|
@@ -644,7 +673,11 @@ async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
|
644
673
|
}
|
|
645
674
|
const nodeVersion = engineSpec.version ?? await getLatestNodeVersion();
|
|
646
675
|
const majorVersion = nodeVersion.split(".")[0];
|
|
647
|
-
return
|
|
676
|
+
return getLatestNpmMajorVersionAtOrBelow(
|
|
677
|
+
"@types/node",
|
|
678
|
+
majorVersion,
|
|
679
|
+
getPackageFallbackVersion("@types/node")
|
|
680
|
+
);
|
|
648
681
|
}
|
|
649
682
|
async function resolvePackageVersions(packageNames, existingVersions = {}) {
|
|
650
683
|
const versions = { ...existingVersions };
|
|
@@ -699,6 +732,7 @@ function collectProjectPackageNames(options) {
|
|
|
699
732
|
const isReact = baseTemplate === "react" || baseTemplate === "r3f";
|
|
700
733
|
const isR3f = baseTemplate === "r3f";
|
|
701
734
|
const isTypescript = language === "typescript";
|
|
735
|
+
const useReactCompiler = shouldEnableReactCompiler(options);
|
|
702
736
|
const inWorkspace = options.workspaceRoot != null;
|
|
703
737
|
const testing = options.testing ?? (isLibrary ? "vitest" : "none");
|
|
704
738
|
const linter = options.linter ?? "oxlint";
|
|
@@ -720,10 +754,18 @@ function collectProjectPackageNames(options) {
|
|
|
720
754
|
addPackageName(packageNames, explicitVersions, "react");
|
|
721
755
|
addPackageName(packageNames, explicitVersions, "react-dom");
|
|
722
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
|
+
}
|
|
723
762
|
}
|
|
724
763
|
if (isTypescript) {
|
|
725
764
|
addPackageName(packageNames, explicitVersions, "@types/react");
|
|
726
765
|
addPackageName(packageNames, explicitVersions, "@types/react-dom");
|
|
766
|
+
if (useReactCompiler) {
|
|
767
|
+
addPackageName(packageNames, explicitVersions, "@types/babel__core");
|
|
768
|
+
}
|
|
727
769
|
}
|
|
728
770
|
}
|
|
729
771
|
if (isR3f) {
|
|
@@ -791,6 +833,9 @@ function collectProjectPackageNames(options) {
|
|
|
791
833
|
if (isTypescript) {
|
|
792
834
|
addPackageName(packageNames, explicitVersions, "oxlint-tsgolint");
|
|
793
835
|
}
|
|
836
|
+
if (useReactCompiler) {
|
|
837
|
+
addPackageName(packageNames, explicitVersions, "eslint-plugin-react-hooks");
|
|
838
|
+
}
|
|
794
839
|
}
|
|
795
840
|
} else if (linter === "biome") {
|
|
796
841
|
addPackageName(packageNames, explicitVersions, "@biomejs/biome");
|
|
@@ -840,7 +885,7 @@ function renderTypescriptConfig(baseTemplateOrParams) {
|
|
|
840
885
|
const devDependencies = {};
|
|
841
886
|
assignResolvedPackageVersion(devDependencies, versions, "typescript");
|
|
842
887
|
if (getEngineName(engine) === "node") {
|
|
843
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
888
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
844
889
|
} else {
|
|
845
890
|
devDependencies["@types/node"] = "^22.0.0";
|
|
846
891
|
}
|
|
@@ -1862,6 +1907,27 @@ const defaultLinterMetaConfig = {
|
|
|
1862
1907
|
}
|
|
1863
1908
|
};
|
|
1864
1909
|
|
|
1910
|
+
const REACT_HOOKS_JS_PLUGIN = {
|
|
1911
|
+
name: "react-hooks-js",
|
|
1912
|
+
specifier: "eslint-plugin-react-hooks"
|
|
1913
|
+
};
|
|
1914
|
+
const REACT_COMPILER_RULES = {
|
|
1915
|
+
"react-hooks-js/component-hook-factories": "error",
|
|
1916
|
+
"react-hooks-js/config": "error",
|
|
1917
|
+
"react-hooks-js/error-boundaries": "error",
|
|
1918
|
+
"react-hooks-js/gating": "error",
|
|
1919
|
+
"react-hooks-js/globals": "error",
|
|
1920
|
+
"react-hooks-js/immutability": "error",
|
|
1921
|
+
"react-hooks-js/incompatible-library": "warn",
|
|
1922
|
+
"react-hooks-js/preserve-manual-memoization": "warn",
|
|
1923
|
+
"react-hooks-js/purity": "error",
|
|
1924
|
+
"react-hooks-js/refs": "error",
|
|
1925
|
+
"react-hooks-js/set-state-in-effect": "error",
|
|
1926
|
+
"react-hooks-js/set-state-in-render": "error",
|
|
1927
|
+
"react-hooks-js/static-components": "error",
|
|
1928
|
+
"react-hooks-js/unsupported-syntax": "warn",
|
|
1929
|
+
"react-hooks-js/use-memo": "error"
|
|
1930
|
+
};
|
|
1865
1931
|
function renderOxlintConfig(params) {
|
|
1866
1932
|
const config = params.config ?? defaultLinterMetaConfig;
|
|
1867
1933
|
const { rules } = config;
|
|
@@ -1872,6 +1938,7 @@ function renderOxlintConfig(params) {
|
|
|
1872
1938
|
return {
|
|
1873
1939
|
$schema: params.schemaPath,
|
|
1874
1940
|
plugins,
|
|
1941
|
+
...params.reactCompiler === true ? { jsPlugins: [REACT_HOOKS_JS_PLUGIN] } : {},
|
|
1875
1942
|
...params.typescript === true ? { options: { typeAware: true } } : {},
|
|
1876
1943
|
rules: {
|
|
1877
1944
|
"no-unused-vars": [
|
|
@@ -1886,7 +1953,8 @@ function renderOxlintConfig(params) {
|
|
|
1886
1953
|
"no-unused-expressions": [
|
|
1887
1954
|
rules.noUnusedExpressions.level,
|
|
1888
1955
|
{ allowShortCircuit: rules.noUnusedExpressions.allowShortCircuit }
|
|
1889
|
-
]
|
|
1956
|
+
],
|
|
1957
|
+
...params.reactCompiler === true ? REACT_COMPILER_RULES : {}
|
|
1890
1958
|
},
|
|
1891
1959
|
ignorePatterns: config.ignorePatterns
|
|
1892
1960
|
};
|
|
@@ -2274,7 +2342,7 @@ function renderMonorepo(params) {
|
|
|
2274
2342
|
const isPnpm = packageManager.name === "pnpm";
|
|
2275
2343
|
const devDependencies = {};
|
|
2276
2344
|
if (engine?.name === "node" && engine.version) {
|
|
2277
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
2345
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
2278
2346
|
} else {
|
|
2279
2347
|
devDependencies["@types/node"] = "^22.0.0";
|
|
2280
2348
|
}
|
|
@@ -2830,6 +2898,7 @@ function planOxlint(builder, options) {
|
|
|
2830
2898
|
const baseTemplate = getBaseTemplate(template);
|
|
2831
2899
|
const isTypescript = getLanguageFromTemplate(template) === "typescript";
|
|
2832
2900
|
const isReact = baseTemplate === "react" || baseTemplate === "r3f";
|
|
2901
|
+
const useReactCompiler = shouldEnableReactCompiler(builder.options);
|
|
2833
2902
|
const isMonorepo = builder.options.workspaceRoot != null;
|
|
2834
2903
|
if (isMonorepo) {
|
|
2835
2904
|
builder.addDevDependency("@config/oxlint", { version: "workspace:*" });
|
|
@@ -2840,10 +2909,14 @@ function planOxlint(builder, options) {
|
|
|
2840
2909
|
if (isTypescript) {
|
|
2841
2910
|
builder.addDevDependency("oxlint-tsgolint");
|
|
2842
2911
|
}
|
|
2912
|
+
if (useReactCompiler) {
|
|
2913
|
+
builder.addDevDependency("eslint-plugin-react-hooks");
|
|
2914
|
+
}
|
|
2843
2915
|
const isStealth = builder.isStealthConfig();
|
|
2844
2916
|
const oxlintConfig = renderOxlintConfig({
|
|
2845
2917
|
schemaPath: isStealth ? "../node_modules/oxlint/configuration_schema.json" : "./node_modules/oxlint/configuration_schema.json",
|
|
2846
2918
|
react: isReact,
|
|
2919
|
+
reactCompiler: useReactCompiler,
|
|
2847
2920
|
typescript: isTypescript,
|
|
2848
2921
|
config: options.config
|
|
2849
2922
|
});
|
|
@@ -3559,6 +3632,7 @@ function createProjectPlan(planInput) {
|
|
|
3559
3632
|
const isReact = baseTemplate === "react";
|
|
3560
3633
|
const isR3f = baseTemplate === "r3f";
|
|
3561
3634
|
const isLibrary = clonedOptions.projectType === "library";
|
|
3635
|
+
const useReactCompiler = shouldEnableReactCompiler(clonedOptions);
|
|
3562
3636
|
const libraryBundler = planInput.libraryBundler.tool;
|
|
3563
3637
|
const ide = planInput.ide.tool;
|
|
3564
3638
|
const files = {
|
|
@@ -3582,6 +3656,11 @@ function createProjectPlan(planInput) {
|
|
|
3582
3656
|
assignResolvedPackageVersion(dependencies, versions, "react");
|
|
3583
3657
|
assignResolvedPackageVersion(dependencies, versions, "react-dom");
|
|
3584
3658
|
assignResolvedPackageVersion(devDependencies, versions, "@vitejs/plugin-react");
|
|
3659
|
+
if (useReactCompiler) {
|
|
3660
|
+
assignResolvedPackageVersion(devDependencies, versions, "@babel/core");
|
|
3661
|
+
assignResolvedPackageVersion(devDependencies, versions, "@rolldown/plugin-babel");
|
|
3662
|
+
assignResolvedPackageVersion(devDependencies, versions, "babel-plugin-react-compiler");
|
|
3663
|
+
}
|
|
3585
3664
|
}
|
|
3586
3665
|
}
|
|
3587
3666
|
if (isR3f) {
|
|
@@ -3603,12 +3682,20 @@ function createProjectPlan(planInput) {
|
|
|
3603
3682
|
});
|
|
3604
3683
|
Object.assign(files, tsResult.files);
|
|
3605
3684
|
Object.assign(devDependencies, tsResult.devDependencies);
|
|
3685
|
+
if (useReactCompiler) {
|
|
3686
|
+
assignResolvedPackageVersion(devDependencies, versions, "@types/babel__core");
|
|
3687
|
+
}
|
|
3606
3688
|
}
|
|
3607
3689
|
const codeSnippets = {};
|
|
3608
3690
|
const vscodeSettings = {};
|
|
3609
3691
|
const scripts = {};
|
|
3610
3692
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3611
|
-
codeSnippets["vite-config-import"] = [
|
|
3693
|
+
codeSnippets["vite-config-import"] = [
|
|
3694
|
+
useReactCompiler ? "import react, { reactCompilerPreset } from '@vitejs/plugin-react';" : "import react from '@vitejs/plugin-react';"
|
|
3695
|
+
];
|
|
3696
|
+
if (useReactCompiler) {
|
|
3697
|
+
codeSnippets["vite-config-import"].push("import babel from '@rolldown/plugin-babel';");
|
|
3698
|
+
}
|
|
3612
3699
|
}
|
|
3613
3700
|
if (!isLibrary && isR3f) {
|
|
3614
3701
|
codeSnippets["import"] = [`import { Canvas } from "@react-three/fiber"`];
|
|
@@ -3619,7 +3706,7 @@ function createProjectPlan(planInput) {
|
|
|
3619
3706
|
base: "./"
|
|
3620
3707
|
};
|
|
3621
3708
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3622
|
-
viteConfig.plugins = ["$raw:react()"];
|
|
3709
|
+
viteConfig.plugins = useReactCompiler ? ["$raw:react()", "$raw:babel({ presets: [reactCompilerPreset()] })"] : ["$raw:react()"];
|
|
3623
3710
|
}
|
|
3624
3711
|
if (!isLibrary && isR3f) {
|
|
3625
3712
|
viteConfig.resolve = { dedupe: ["three"] };
|
|
@@ -3724,7 +3811,9 @@ function createProjectPlan(planInput) {
|
|
|
3724
3811
|
} else if (planInput.formatter.tool === "oxfmt") {
|
|
3725
3812
|
planOxfmt(builder, planInput.formatter);
|
|
3726
3813
|
} else if (planInput.formatter.tool === "biome" && planInput.linter.tool !== "biome") {
|
|
3727
|
-
planBiome(builder, {
|
|
3814
|
+
planBiome(builder, {
|
|
3815
|
+
formatter: planInput.formatter
|
|
3816
|
+
});
|
|
3728
3817
|
}
|
|
3729
3818
|
for (const { code, location } of clonedOptions.injections ?? []) {
|
|
3730
3819
|
builder.inject(location, code);
|
|
@@ -3850,4 +3939,4 @@ async function planWorkspace(input) {
|
|
|
3850
3939
|
};
|
|
3851
3940
|
}
|
|
3852
3941
|
|
|
3853
|
-
export { ALL_AI_PLATFORMS as A,
|
|
3942
|
+
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 };
|
|
@@ -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 };
|
|
@@ -183,6 +183,10 @@ function getLanguageFromTemplate(template) {
|
|
|
183
183
|
function getBaseTemplate(template) {
|
|
184
184
|
return template.replace("-js", "");
|
|
185
185
|
}
|
|
186
|
+
function shouldEnableReactCompiler(options) {
|
|
187
|
+
const template = options.template ?? "vanilla";
|
|
188
|
+
return getBaseTemplate(template) === "react" && (options.projectType ?? "app") === "app";
|
|
189
|
+
}
|
|
186
190
|
|
|
187
191
|
function unique(...array) {
|
|
188
192
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -445,16 +449,41 @@ function compareNumericSemver(a, b) {
|
|
|
445
449
|
}
|
|
446
450
|
return 0;
|
|
447
451
|
}
|
|
452
|
+
function getLatestMatchingMajorVersion(versions, majorVersion) {
|
|
453
|
+
return [...versions].filter((version) => version.split(".")[0] === majorVersion).sort((a, b) => compareNumericSemver(b, a))[0];
|
|
454
|
+
}
|
|
448
455
|
async function getLatestNpmMajorVersion(packageName, majorVersion, fallback) {
|
|
449
456
|
try {
|
|
450
457
|
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
451
458
|
const data = await response.json();
|
|
452
|
-
const latestMatchingVersion =
|
|
459
|
+
const latestMatchingVersion = getLatestMatchingMajorVersion(
|
|
460
|
+
Object.keys(data.versions ?? {}),
|
|
461
|
+
majorVersion
|
|
462
|
+
);
|
|
453
463
|
return latestMatchingVersion ?? fallback;
|
|
454
464
|
} catch {
|
|
455
465
|
return fallback;
|
|
456
466
|
}
|
|
457
467
|
}
|
|
468
|
+
async function getLatestNpmMajorVersionAtOrBelow(packageName, majorVersion, fallback) {
|
|
469
|
+
try {
|
|
470
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}`);
|
|
471
|
+
const data = await response.json();
|
|
472
|
+
const versions = Object.keys(data.versions ?? {});
|
|
473
|
+
const requestedMajor = Number.parseInt(majorVersion, 10);
|
|
474
|
+
if (Number.isFinite(requestedMajor)) {
|
|
475
|
+
for (let major = requestedMajor; major >= 0; major -= 1) {
|
|
476
|
+
const latestMatchingVersion = getLatestMatchingMajorVersion(versions, String(major));
|
|
477
|
+
if (latestMatchingVersion != null) {
|
|
478
|
+
return latestMatchingVersion;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return fallback;
|
|
483
|
+
} catch {
|
|
484
|
+
return fallback;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
458
487
|
async function getLatestPnpmVersion() {
|
|
459
488
|
return getLatestNpmVersion("pnpm", "10.11.0");
|
|
460
489
|
}
|
|
@@ -501,6 +530,7 @@ function parseWorkspaceYamlContent(content) {
|
|
|
501
530
|
}
|
|
502
531
|
|
|
503
532
|
const PACKAGE_VERSION_DEFINITIONS = {
|
|
533
|
+
"@babel/core": { fallbackVersion: "7.29.0" },
|
|
504
534
|
"@biomejs/biome": { fallbackVersion: "2.0.0" },
|
|
505
535
|
"@react-three/drei": { fallbackVersion: "10.0.0" },
|
|
506
536
|
"@react-three/fiber": { fallbackVersion: "9.0.0" },
|
|
@@ -510,16 +540,20 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
510
540
|
"@react-three/rapier": { fallbackVersion: "2.1.0" },
|
|
511
541
|
"@react-three/uikit": { fallbackVersion: "0.8.15" },
|
|
512
542
|
"@react-three/xr": { fallbackVersion: "6.6.16" },
|
|
543
|
+
"@rolldown/plugin-babel": { fallbackVersion: "0.2.3" },
|
|
513
544
|
"@testing-library/dom": { fallbackVersion: "10.4.0" },
|
|
514
545
|
"@testing-library/react": { fallbackVersion: "16.2.0" },
|
|
546
|
+
"@types/babel__core": { fallbackVersion: "7.20.5" },
|
|
547
|
+
"@types/node": { fallbackVersion: "25.3.5" },
|
|
515
548
|
"@types/react": { fallbackVersion: "19.0.0" },
|
|
516
549
|
"@types/react-dom": { fallbackVersion: "19.0.0" },
|
|
517
550
|
"@types/three": { fallbackVersion: "0.175.0", prefix: "~" },
|
|
518
551
|
"@vitejs/plugin-basic-ssl": { fallbackVersion: "2.0.0" },
|
|
519
|
-
"@vitejs/plugin-react": { fallbackVersion: "
|
|
552
|
+
"@vitejs/plugin-react": { fallbackVersion: "6.0.1" },
|
|
520
553
|
"@viverse/cli": { fallbackVersion: "0.9.5-beta.8" },
|
|
521
554
|
eslint: { fallbackVersion: "9.17.0" },
|
|
522
|
-
"eslint-plugin-react-hooks": { fallbackVersion: "
|
|
555
|
+
"eslint-plugin-react-hooks": { fallbackVersion: "7.1.1" },
|
|
556
|
+
"babel-plugin-react-compiler": { fallbackVersion: "1.0.0" },
|
|
523
557
|
jsdom: { fallbackVersion: "26.0.0" },
|
|
524
558
|
koota: { fallbackVersion: "0.4.0" },
|
|
525
559
|
leva: { fallbackVersion: "0.10.0" },
|
|
@@ -534,7 +568,7 @@ const PACKAGE_VERSION_DEFINITIONS = {
|
|
|
534
568
|
typescript: { fallbackVersion: "5.9.3" },
|
|
535
569
|
"typescript-eslint": { fallbackVersion: "8.18.0" },
|
|
536
570
|
unbuild: { fallbackVersion: "3.5.0" },
|
|
537
|
-
vite: { fallbackVersion: "
|
|
571
|
+
vite: { fallbackVersion: "8.0.12" },
|
|
538
572
|
vitest: { fallbackVersion: "4.0.0" },
|
|
539
573
|
zustand: { fallbackVersion: "5.0.3" }
|
|
540
574
|
};
|
|
@@ -628,17 +662,12 @@ async function resolveEngine(options) {
|
|
|
628
662
|
}
|
|
629
663
|
return engine;
|
|
630
664
|
}
|
|
631
|
-
function formatNodeTypesVersion(versions = {},
|
|
665
|
+
function formatNodeTypesVersion(versions = {}, _engine) {
|
|
632
666
|
const resolvedVersion = versions["@types/node"];
|
|
633
667
|
if (resolvedVersion != null) {
|
|
634
668
|
return `^${resolvedVersion}`;
|
|
635
669
|
}
|
|
636
|
-
|
|
637
|
-
if (engineSpec.name === "node" && engineSpec.version) {
|
|
638
|
-
const majorVersion = engineSpec.version.split(".")[0];
|
|
639
|
-
return `^${majorVersion}.0.0`;
|
|
640
|
-
}
|
|
641
|
-
return "^22.0.0";
|
|
670
|
+
return formatResolvedPackageVersion(versions, "@types/node");
|
|
642
671
|
}
|
|
643
672
|
async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
644
673
|
if (versions["@types/node"] != null) {
|
|
@@ -650,7 +679,11 @@ async function resolveNodeTypesVersion(engine, versions = {}) {
|
|
|
650
679
|
}
|
|
651
680
|
const nodeVersion = engineSpec.version ?? await getLatestNodeVersion();
|
|
652
681
|
const majorVersion = nodeVersion.split(".")[0];
|
|
653
|
-
return
|
|
682
|
+
return getLatestNpmMajorVersionAtOrBelow(
|
|
683
|
+
"@types/node",
|
|
684
|
+
majorVersion,
|
|
685
|
+
getPackageFallbackVersion("@types/node")
|
|
686
|
+
);
|
|
654
687
|
}
|
|
655
688
|
async function resolvePackageVersions(packageNames, existingVersions = {}) {
|
|
656
689
|
const versions = { ...existingVersions };
|
|
@@ -705,6 +738,7 @@ function collectProjectPackageNames(options) {
|
|
|
705
738
|
const isReact = baseTemplate === "react" || baseTemplate === "r3f";
|
|
706
739
|
const isR3f = baseTemplate === "r3f";
|
|
707
740
|
const isTypescript = language === "typescript";
|
|
741
|
+
const useReactCompiler = shouldEnableReactCompiler(options);
|
|
708
742
|
const inWorkspace = options.workspaceRoot != null;
|
|
709
743
|
const testing = options.testing ?? (isLibrary ? "vitest" : "none");
|
|
710
744
|
const linter = options.linter ?? "oxlint";
|
|
@@ -726,10 +760,18 @@ function collectProjectPackageNames(options) {
|
|
|
726
760
|
addPackageName(packageNames, explicitVersions, "react");
|
|
727
761
|
addPackageName(packageNames, explicitVersions, "react-dom");
|
|
728
762
|
addPackageName(packageNames, explicitVersions, "@vitejs/plugin-react");
|
|
763
|
+
if (useReactCompiler) {
|
|
764
|
+
addPackageName(packageNames, explicitVersions, "@babel/core");
|
|
765
|
+
addPackageName(packageNames, explicitVersions, "@rolldown/plugin-babel");
|
|
766
|
+
addPackageName(packageNames, explicitVersions, "babel-plugin-react-compiler");
|
|
767
|
+
}
|
|
729
768
|
}
|
|
730
769
|
if (isTypescript) {
|
|
731
770
|
addPackageName(packageNames, explicitVersions, "@types/react");
|
|
732
771
|
addPackageName(packageNames, explicitVersions, "@types/react-dom");
|
|
772
|
+
if (useReactCompiler) {
|
|
773
|
+
addPackageName(packageNames, explicitVersions, "@types/babel__core");
|
|
774
|
+
}
|
|
733
775
|
}
|
|
734
776
|
}
|
|
735
777
|
if (isR3f) {
|
|
@@ -797,6 +839,9 @@ function collectProjectPackageNames(options) {
|
|
|
797
839
|
if (isTypescript) {
|
|
798
840
|
addPackageName(packageNames, explicitVersions, "oxlint-tsgolint");
|
|
799
841
|
}
|
|
842
|
+
if (useReactCompiler) {
|
|
843
|
+
addPackageName(packageNames, explicitVersions, "eslint-plugin-react-hooks");
|
|
844
|
+
}
|
|
800
845
|
}
|
|
801
846
|
} else if (linter === "biome") {
|
|
802
847
|
addPackageName(packageNames, explicitVersions, "@biomejs/biome");
|
|
@@ -846,7 +891,7 @@ function renderTypescriptConfig(baseTemplateOrParams) {
|
|
|
846
891
|
const devDependencies = {};
|
|
847
892
|
assignResolvedPackageVersion(devDependencies, versions, "typescript");
|
|
848
893
|
if (getEngineName(engine) === "node") {
|
|
849
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
894
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
850
895
|
} else {
|
|
851
896
|
devDependencies["@types/node"] = "^22.0.0";
|
|
852
897
|
}
|
|
@@ -1868,6 +1913,27 @@ const defaultLinterMetaConfig = {
|
|
|
1868
1913
|
}
|
|
1869
1914
|
};
|
|
1870
1915
|
|
|
1916
|
+
const REACT_HOOKS_JS_PLUGIN = {
|
|
1917
|
+
name: "react-hooks-js",
|
|
1918
|
+
specifier: "eslint-plugin-react-hooks"
|
|
1919
|
+
};
|
|
1920
|
+
const REACT_COMPILER_RULES = {
|
|
1921
|
+
"react-hooks-js/component-hook-factories": "error",
|
|
1922
|
+
"react-hooks-js/config": "error",
|
|
1923
|
+
"react-hooks-js/error-boundaries": "error",
|
|
1924
|
+
"react-hooks-js/gating": "error",
|
|
1925
|
+
"react-hooks-js/globals": "error",
|
|
1926
|
+
"react-hooks-js/immutability": "error",
|
|
1927
|
+
"react-hooks-js/incompatible-library": "warn",
|
|
1928
|
+
"react-hooks-js/preserve-manual-memoization": "warn",
|
|
1929
|
+
"react-hooks-js/purity": "error",
|
|
1930
|
+
"react-hooks-js/refs": "error",
|
|
1931
|
+
"react-hooks-js/set-state-in-effect": "error",
|
|
1932
|
+
"react-hooks-js/set-state-in-render": "error",
|
|
1933
|
+
"react-hooks-js/static-components": "error",
|
|
1934
|
+
"react-hooks-js/unsupported-syntax": "warn",
|
|
1935
|
+
"react-hooks-js/use-memo": "error"
|
|
1936
|
+
};
|
|
1871
1937
|
function renderOxlintConfig(params) {
|
|
1872
1938
|
const config = params.config ?? defaultLinterMetaConfig;
|
|
1873
1939
|
const { rules } = config;
|
|
@@ -1878,6 +1944,7 @@ function renderOxlintConfig(params) {
|
|
|
1878
1944
|
return {
|
|
1879
1945
|
$schema: params.schemaPath,
|
|
1880
1946
|
plugins,
|
|
1947
|
+
...params.reactCompiler === true ? { jsPlugins: [REACT_HOOKS_JS_PLUGIN] } : {},
|
|
1881
1948
|
...params.typescript === true ? { options: { typeAware: true } } : {},
|
|
1882
1949
|
rules: {
|
|
1883
1950
|
"no-unused-vars": [
|
|
@@ -1892,7 +1959,8 @@ function renderOxlintConfig(params) {
|
|
|
1892
1959
|
"no-unused-expressions": [
|
|
1893
1960
|
rules.noUnusedExpressions.level,
|
|
1894
1961
|
{ allowShortCircuit: rules.noUnusedExpressions.allowShortCircuit }
|
|
1895
|
-
]
|
|
1962
|
+
],
|
|
1963
|
+
...params.reactCompiler === true ? REACT_COMPILER_RULES : {}
|
|
1896
1964
|
},
|
|
1897
1965
|
ignorePatterns: config.ignorePatterns
|
|
1898
1966
|
};
|
|
@@ -2280,7 +2348,7 @@ function renderMonorepo(params) {
|
|
|
2280
2348
|
const isPnpm = packageManager.name === "pnpm";
|
|
2281
2349
|
const devDependencies = {};
|
|
2282
2350
|
if (engine?.name === "node" && engine.version) {
|
|
2283
|
-
devDependencies["@types/node"] = formatNodeTypesVersion(versions
|
|
2351
|
+
devDependencies["@types/node"] = formatNodeTypesVersion(versions);
|
|
2284
2352
|
} else {
|
|
2285
2353
|
devDependencies["@types/node"] = "^22.0.0";
|
|
2286
2354
|
}
|
|
@@ -2836,6 +2904,7 @@ function planOxlint(builder, options) {
|
|
|
2836
2904
|
const baseTemplate = getBaseTemplate(template);
|
|
2837
2905
|
const isTypescript = getLanguageFromTemplate(template) === "typescript";
|
|
2838
2906
|
const isReact = baseTemplate === "react" || baseTemplate === "r3f";
|
|
2907
|
+
const useReactCompiler = shouldEnableReactCompiler(builder.options);
|
|
2839
2908
|
const isMonorepo = builder.options.workspaceRoot != null;
|
|
2840
2909
|
if (isMonorepo) {
|
|
2841
2910
|
builder.addDevDependency("@config/oxlint", { version: "workspace:*" });
|
|
@@ -2846,10 +2915,14 @@ function planOxlint(builder, options) {
|
|
|
2846
2915
|
if (isTypescript) {
|
|
2847
2916
|
builder.addDevDependency("oxlint-tsgolint");
|
|
2848
2917
|
}
|
|
2918
|
+
if (useReactCompiler) {
|
|
2919
|
+
builder.addDevDependency("eslint-plugin-react-hooks");
|
|
2920
|
+
}
|
|
2849
2921
|
const isStealth = builder.isStealthConfig();
|
|
2850
2922
|
const oxlintConfig = renderOxlintConfig({
|
|
2851
2923
|
schemaPath: isStealth ? "../node_modules/oxlint/configuration_schema.json" : "./node_modules/oxlint/configuration_schema.json",
|
|
2852
2924
|
react: isReact,
|
|
2925
|
+
reactCompiler: useReactCompiler,
|
|
2853
2926
|
typescript: isTypescript,
|
|
2854
2927
|
config: options.config
|
|
2855
2928
|
});
|
|
@@ -3565,6 +3638,7 @@ function createProjectPlan(planInput) {
|
|
|
3565
3638
|
const isReact = baseTemplate === "react";
|
|
3566
3639
|
const isR3f = baseTemplate === "r3f";
|
|
3567
3640
|
const isLibrary = clonedOptions.projectType === "library";
|
|
3641
|
+
const useReactCompiler = shouldEnableReactCompiler(clonedOptions);
|
|
3568
3642
|
const libraryBundler = planInput.libraryBundler.tool;
|
|
3569
3643
|
const ide = planInput.ide.tool;
|
|
3570
3644
|
const files = {
|
|
@@ -3588,6 +3662,11 @@ function createProjectPlan(planInput) {
|
|
|
3588
3662
|
assignResolvedPackageVersion(dependencies, versions, "react");
|
|
3589
3663
|
assignResolvedPackageVersion(dependencies, versions, "react-dom");
|
|
3590
3664
|
assignResolvedPackageVersion(devDependencies, versions, "@vitejs/plugin-react");
|
|
3665
|
+
if (useReactCompiler) {
|
|
3666
|
+
assignResolvedPackageVersion(devDependencies, versions, "@babel/core");
|
|
3667
|
+
assignResolvedPackageVersion(devDependencies, versions, "@rolldown/plugin-babel");
|
|
3668
|
+
assignResolvedPackageVersion(devDependencies, versions, "babel-plugin-react-compiler");
|
|
3669
|
+
}
|
|
3591
3670
|
}
|
|
3592
3671
|
}
|
|
3593
3672
|
if (isR3f) {
|
|
@@ -3609,12 +3688,20 @@ function createProjectPlan(planInput) {
|
|
|
3609
3688
|
});
|
|
3610
3689
|
Object.assign(files, tsResult.files);
|
|
3611
3690
|
Object.assign(devDependencies, tsResult.devDependencies);
|
|
3691
|
+
if (useReactCompiler) {
|
|
3692
|
+
assignResolvedPackageVersion(devDependencies, versions, "@types/babel__core");
|
|
3693
|
+
}
|
|
3612
3694
|
}
|
|
3613
3695
|
const codeSnippets = {};
|
|
3614
3696
|
const vscodeSettings = {};
|
|
3615
3697
|
const scripts = {};
|
|
3616
3698
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3617
|
-
codeSnippets["vite-config-import"] = [
|
|
3699
|
+
codeSnippets["vite-config-import"] = [
|
|
3700
|
+
useReactCompiler ? "import react, { reactCompilerPreset } from '@vitejs/plugin-react';" : "import react from '@vitejs/plugin-react';"
|
|
3701
|
+
];
|
|
3702
|
+
if (useReactCompiler) {
|
|
3703
|
+
codeSnippets["vite-config-import"].push("import babel from '@rolldown/plugin-babel';");
|
|
3704
|
+
}
|
|
3618
3705
|
}
|
|
3619
3706
|
if (!isLibrary && isR3f) {
|
|
3620
3707
|
codeSnippets["import"] = [`import { Canvas } from "@react-three/fiber"`];
|
|
@@ -3625,7 +3712,7 @@ function createProjectPlan(planInput) {
|
|
|
3625
3712
|
base: "./"
|
|
3626
3713
|
};
|
|
3627
3714
|
if (!isLibrary && (isReact || isR3f)) {
|
|
3628
|
-
viteConfig.plugins = ["$raw:react()"];
|
|
3715
|
+
viteConfig.plugins = useReactCompiler ? ["$raw:react()", "$raw:babel({ presets: [reactCompilerPreset()] })"] : ["$raw:react()"];
|
|
3629
3716
|
}
|
|
3630
3717
|
if (!isLibrary && isR3f) {
|
|
3631
3718
|
viteConfig.resolve = { dedupe: ["three"] };
|
|
@@ -3730,7 +3817,9 @@ function createProjectPlan(planInput) {
|
|
|
3730
3817
|
} else if (planInput.formatter.tool === "oxfmt") {
|
|
3731
3818
|
planOxfmt(builder, planInput.formatter);
|
|
3732
3819
|
} else if (planInput.formatter.tool === "biome" && planInput.linter.tool !== "biome") {
|
|
3733
|
-
planBiome(builder, {
|
|
3820
|
+
planBiome(builder, {
|
|
3821
|
+
formatter: planInput.formatter
|
|
3822
|
+
});
|
|
3734
3823
|
}
|
|
3735
3824
|
for (const { code, location } of clonedOptions.injections ?? []) {
|
|
3736
3825
|
builder.inject(location, code);
|
|
@@ -3868,6 +3957,7 @@ exports.getLanguageFromTemplate = getLanguageFromTemplate;
|
|
|
3868
3957
|
exports.getLatestNodeVersion = getLatestNodeVersion;
|
|
3869
3958
|
exports.getLatestNpmCliVersion = getLatestNpmCliVersion;
|
|
3870
3959
|
exports.getLatestNpmMajorVersion = getLatestNpmMajorVersion;
|
|
3960
|
+
exports.getLatestNpmMajorVersionAtOrBelow = getLatestNpmMajorVersionAtOrBelow;
|
|
3871
3961
|
exports.getLatestNpmVersion = getLatestNpmVersion;
|
|
3872
3962
|
exports.getLatestPnpmVersion = getLatestPnpmVersion;
|
|
3873
3963
|
exports.getLatestYarnVersion = getLatestYarnVersion;
|
|
@@ -3898,6 +3988,7 @@ exports.resolveDefaultPackageJsonScripts = resolveDefaultPackageJsonScripts;
|
|
|
3898
3988
|
exports.resolveMonorepoRootPackageVersions = resolveMonorepoRootPackageVersions;
|
|
3899
3989
|
exports.resolveProjectPlanInput = resolveProjectPlanInput;
|
|
3900
3990
|
exports.resolveWorkspacePlanInput = resolveWorkspacePlanInput;
|
|
3991
|
+
exports.shouldEnableReactCompiler = shouldEnableReactCompiler;
|
|
3901
3992
|
exports.toPrettierIgnoreContent = toPrettierIgnoreContent;
|
|
3902
3993
|
exports.unique = unique;
|
|
3903
3994
|
exports.validatePackageName = validatePackageName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-krispya",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "🌹 CLI for creating web projects with (my) sensible defaults",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -28,26 +28,26 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@clack/prompts": "^
|
|
32
|
-
"chalk": "^5.
|
|
33
|
-
"commander": "^
|
|
34
|
-
"conf": "^
|
|
35
|
-
"ora": "^
|
|
36
|
-
"undici": "^
|
|
31
|
+
"@clack/prompts": "^1.4.0",
|
|
32
|
+
"chalk": "^5.6.2",
|
|
33
|
+
"commander": "^14.0.3",
|
|
34
|
+
"conf": "^15.1.0",
|
|
35
|
+
"ora": "^9.4.0",
|
|
36
|
+
"undici": "^8.2.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^25.
|
|
40
|
-
"oxlint": "^1.
|
|
39
|
+
"@types/node": "^25.7.0",
|
|
40
|
+
"oxlint": "^1.64.0",
|
|
41
41
|
"oxlint-tsgolint": "^0.22.1",
|
|
42
|
-
"prettier": "^3.8.
|
|
42
|
+
"prettier": "^3.8.3",
|
|
43
43
|
"tsx": "^4.21.0",
|
|
44
|
-
"typescript": "^
|
|
45
|
-
"unbuild": "^3.
|
|
46
|
-
"vitest": "^4.
|
|
44
|
+
"typescript": "^6.0.3",
|
|
45
|
+
"unbuild": "^3.6.1",
|
|
46
|
+
"vitest": "^4.1.6"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"pnpm": ">=10.0.0",
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=26.0.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"dev": "tsx src/cli.ts",
|