@holo-js/cli 0.2.6 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/holo.mjs +417 -109
- package/dist/{broadcast-JBQWQZSO.mjs → broadcast-PJLFVZH4.mjs} +12 -12
- package/dist/cache-KR4ACOYD.mjs +137 -0
- package/dist/{cache-migrations-77TLXIVG.mjs → cache-migrations-J34RE4WH.mjs} +13 -13
- package/dist/{chunk-LXGQCG56.mjs → chunk-2XXJ76YC.mjs} +1 -1
- package/dist/chunk-3ICVWL2M.mjs +491 -0
- package/dist/{chunk-YEFJBN56.mjs → chunk-4VYR2ARA.mjs} +11 -8
- package/dist/{chunk-VP2E62DF.mjs → chunk-7KZVFDSI.mjs} +49 -349
- package/dist/chunk-AZ6NVJAP.mjs +360 -0
- package/dist/chunk-CT23GSEC.mjs +156 -0
- package/dist/{chunk-7B2RVYLL.mjs → chunk-FFTJKBQF.mjs} +293 -399
- package/dist/{chunk-KS5TWO75.mjs → chunk-I3RRWDLV.mjs} +7 -7
- package/dist/{chunk-J76GH2DR.mjs → chunk-L3YATEQY.mjs} +129 -86
- package/dist/{chunk-4K4CWMMP.mjs → chunk-L6FF22IV.mjs} +76 -61
- package/dist/{chunk-ILU426CF.mjs → chunk-PVVGQSUP.mjs} +482 -2
- package/dist/chunk-XBOVM6LO.mjs +41 -0
- package/dist/{chunk-I7QBCEV7.mjs → chunk-Y355VYRN.mjs} +5 -3
- package/dist/{chunk-VRGB6DIS.mjs → chunk-YJWHIQ45.mjs} +2 -0
- package/dist/{config-MD27U4FM.mjs → config-XVPV6DJW.mjs} +3 -3
- package/dist/{dev-L4Y2GU2E.mjs → dev-NTQTEY5B.mjs} +9 -8
- package/dist/{discovery-GWTBF5RZ.mjs → discovery-TMPUQQHI.mjs} +8 -6
- package/dist/{generators-VCYISHWO.mjs → generators-3FDCCJDC.mjs} +16 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +419 -111
- package/dist/{media-migrations-BNVAPYEM.mjs → media-migrations-UJ6BMUSZ.mjs} +12 -12
- package/dist/plugins-USHY6SPF.mjs +24 -0
- package/dist/{queue-5BXSDFCO.mjs → queue-6U7JU4T6.mjs} +53 -17
- package/dist/{queue-D4LSWNS2.mjs → queue-VJEFD6SE.mjs} +55 -19
- package/dist/{queue-migrations-EF4AMMSY.mjs → queue-migrations-6YUUOKMH.mjs} +17 -14
- package/dist/{runtime-RPMZMTD4.mjs → runtime-FVRB4O2M.mjs} +8 -8
- package/dist/{runtime-GSXF4NB3.mjs → runtime-P5R7H3B4.mjs} +1 -1
- package/dist/runtime-worker.mjs +7 -1
- package/dist/{scaffold-NJ5VH73M.mjs → scaffold-F3AZDNPG.mjs} +9 -4
- package/dist/{security-K5PZS3E3.mjs → security-X4274RHX.mjs} +8 -7
- package/package.json +35 -8
- package/dist/broadcast-YGJFCEPP.mjs +0 -204
- package/dist/cache-HUGRWOHQ.mjs +0 -66
- package/dist/cache-OSJ4PD52.mjs +0 -66
- package/dist/cache-migrations-FKAHRP24.mjs +0 -173
- package/dist/chunk-AJLRAC5M.mjs +0 -497
- package/dist/chunk-C624G3R2.mjs +0 -3306
- package/dist/chunk-D7O4SU6N.mjs +0 -2
- package/dist/chunk-FGQ2I2YH.mjs +0 -22
- package/dist/chunk-LBJAJLKU.mjs +0 -25
- package/dist/dev-YPBQBEOE.mjs +0 -44
- package/dist/generators-H4NTV4DB.mjs +0 -520
- package/dist/media-migrations-NNB3DAQR.mjs +0 -106
- package/dist/queue-migrations-LXEWXJYT.mjs +0 -168
- package/dist/runtime-UKBJQFXM.mjs +0 -57
- package/dist/scaffold-VV3KTYGO.mjs +0 -139
- package/dist/security-JR4P7L2C.mjs +0 -71
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fileExists
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
prepareProjectDiscovery
|
|
6
|
-
} from "./chunk-VP2E62DF.mjs";
|
|
3
|
+
} from "./chunk-FFTJKBQF.mjs";
|
|
7
4
|
import {
|
|
8
5
|
loadProjectConfig,
|
|
9
6
|
resolveGeneratedSchemaPath
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4VYR2ARA.mjs";
|
|
8
|
+
import {
|
|
9
|
+
prepareProjectDiscovery
|
|
10
|
+
} from "./chunk-7KZVFDSI.mjs";
|
|
11
11
|
import {
|
|
12
12
|
loadGeneratedProjectRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-L3YATEQY.mjs";
|
|
14
14
|
import {
|
|
15
15
|
CLI_RUNTIME_ROOT,
|
|
16
16
|
GENERATED_SCHEMA_RUNTIME_PATH,
|
|
17
17
|
bundleProjectModule
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
19
19
|
|
|
20
20
|
// src/runtime.ts
|
|
21
21
|
import { spawn } from "child_process";
|
|
@@ -29,11 +29,12 @@ import {
|
|
|
29
29
|
GENERATED_SVELTE_SERVER_HOOKS_PATH,
|
|
30
30
|
GENERATED_TSCONFIG_PATH,
|
|
31
31
|
SUPPORTED_CONFIG_EXTENSIONS,
|
|
32
|
+
getFrameworkDescriptor,
|
|
32
33
|
importProjectModule,
|
|
33
34
|
isRecord,
|
|
34
35
|
makeProjectRelativePath,
|
|
35
36
|
normalizeScaffoldOptionalPackages
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
37
38
|
|
|
38
39
|
// src/templates.ts
|
|
39
40
|
import { dirname, relative, resolve } from "path";
|
|
@@ -888,13 +889,9 @@ function renderSveltePage(projectName) {
|
|
|
888
889
|
}
|
|
889
890
|
function renderSvelteHoloHelper() {
|
|
890
891
|
return [
|
|
891
|
-
"import { dirname, resolve } from 'node:path'",
|
|
892
|
-
"import { fileURLToPath } from 'node:url'",
|
|
893
892
|
"import { createSvelteKitHoloHelpers } from '@holo-js/adapter-sveltekit'",
|
|
894
893
|
"",
|
|
895
|
-
"const
|
|
896
|
-
"",
|
|
897
|
-
"export const holo = createSvelteKitHoloHelpers({ projectRoot })",
|
|
894
|
+
"export const holo = createSvelteKitHoloHelpers()",
|
|
898
895
|
""
|
|
899
896
|
].join("\n");
|
|
900
897
|
}
|
|
@@ -956,71 +953,117 @@ function renderSvelteHostedAuthRouteFiles(provider) {
|
|
|
956
953
|
{ path: `src/routes/api/auth/${provider}/logout/+server.ts`, contents: renderSvelteHostedAuthLogoutRoute(spec) }
|
|
957
954
|
];
|
|
958
955
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
956
|
+
var FRAMEWORK_RENDERERS = {
|
|
957
|
+
nuxt: {
|
|
958
|
+
authProviderRouteFiles: renderNuxtHostedAuthRouteFiles,
|
|
959
|
+
authRouteFiles: () => [
|
|
960
|
+
{ path: "server/api/auth/user.get.ts", contents: renderNuxtCurrentAuthRoute() }
|
|
961
|
+
],
|
|
962
|
+
managedHostedAuthRouteFiles: () => [],
|
|
963
|
+
broadcastInstallFiles: () => [],
|
|
964
|
+
broadcastAuthSupportFiles: () => [],
|
|
965
|
+
frameworkFiles: (options) => {
|
|
966
|
+
const optionalPackages = normalizeScaffoldOptionalPackages(options.optionalPackages);
|
|
967
|
+
const authEnabled = optionalPackages.includes("auth");
|
|
968
|
+
return [
|
|
969
|
+
{ path: "app/app.vue", contents: renderNuxtAppVue(options.projectName) },
|
|
970
|
+
{ path: "nuxt.config.ts", contents: renderNuxtConfig() },
|
|
971
|
+
{ path: "shared/.gitkeep", contents: "" },
|
|
972
|
+
...authEnabled ? renderAuthRouteFiles("nuxt") : []
|
|
973
|
+
];
|
|
966
974
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
if (framework === "next") {
|
|
972
|
-
return [
|
|
975
|
+
},
|
|
976
|
+
next: {
|
|
977
|
+
authProviderRouteFiles: renderNextHostedAuthRouteFiles,
|
|
978
|
+
authRouteFiles: () => [
|
|
973
979
|
{ path: "app/api/auth/user/route.ts", contents: renderNextCurrentAuthRoute() },
|
|
974
980
|
{ path: ".holo-js/generated/next/holo.ts", contents: renderNextHoloHelper() },
|
|
975
981
|
{ path: ".holo-js/generated/next/bootstrap.mjs", contents: renderNextRuntimeBootstrap() }
|
|
976
|
-
]
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
{ path: "
|
|
981
|
-
|
|
982
|
+
],
|
|
983
|
+
managedHostedAuthRouteFiles: renderNextManagedHostedAuthRouteFiles,
|
|
984
|
+
broadcastInstallFiles: () => [
|
|
985
|
+
{ path: ".holo-js/generated/next/holo.ts", contents: renderNextHoloHelper() },
|
|
986
|
+
{ path: "app/broadcasting/config/route.ts", contents: renderNextBroadcastConfigRoute() },
|
|
987
|
+
{ path: ".holo-js/generated/next/broadcast-config-route.ts", contents: renderNextGeneratedBroadcastConfigRoute() }
|
|
988
|
+
],
|
|
989
|
+
broadcastAuthSupportFiles: () => [
|
|
990
|
+
{ path: "app/broadcasting/auth/route.ts", contents: renderNextBroadcastAuthRoute() },
|
|
991
|
+
{ path: ".holo-js/generated/next/holo.ts", contents: renderNextHoloHelper() },
|
|
992
|
+
{ path: ".holo-js/generated/next/broadcast-auth-route.ts", contents: renderNextGeneratedBroadcastAuthRoute() }
|
|
993
|
+
],
|
|
994
|
+
frameworkFiles: (options) => {
|
|
995
|
+
const optionalPackages = normalizeScaffoldOptionalPackages(options.optionalPackages);
|
|
996
|
+
const storageEnabled = optionalPackages.includes("storage");
|
|
997
|
+
const authEnabled = optionalPackages.includes("auth");
|
|
998
|
+
const broadcastEnabled = optionalPackages.includes("broadcast");
|
|
999
|
+
const realtimeEnabled = optionalPackages.includes("realtime");
|
|
1000
|
+
return [
|
|
1001
|
+
{ path: "next.config.ts", contents: renderNextConfig() },
|
|
1002
|
+
{ path: "next-env.d.ts", contents: renderNextEnvDts() },
|
|
1003
|
+
{ path: "app/layout.tsx", contents: renderNextLayout(options.projectName) },
|
|
1004
|
+
{ path: "app/page.tsx", contents: renderNextPage(options.projectName) },
|
|
1005
|
+
...authEnabled ? [{ path: "app/api/auth/user/route.ts", contents: renderNextCurrentAuthRoute() }] : [],
|
|
1006
|
+
...storageEnabled ? [{ path: "app/storage/[[...path]]/route.ts", contents: renderNextStorageRoute() }] : [],
|
|
1007
|
+
...broadcastEnabled ? [{ path: "app/broadcasting/config/route.ts", contents: renderNextBroadcastConfigRoute() }] : [],
|
|
1008
|
+
...renderNextManagedRouteFiles({ authEnabled, broadcastEnabled, storageEnabled, realtimeEnabled })
|
|
1009
|
+
];
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
sveltekit: {
|
|
1013
|
+
authProviderRouteFiles: renderSvelteHostedAuthRouteFiles,
|
|
1014
|
+
authRouteFiles: () => [],
|
|
1015
|
+
managedHostedAuthRouteFiles: () => [],
|
|
1016
|
+
broadcastInstallFiles: () => [
|
|
1017
|
+
{ path: ".holo-js/generated/sveltekit/holo.ts", contents: renderSvelteHoloHelper() }
|
|
1018
|
+
],
|
|
1019
|
+
broadcastAuthSupportFiles: () => [
|
|
1020
|
+
{ path: ".holo-js/generated/sveltekit/holo.ts", contents: renderSvelteHoloHelper() }
|
|
1021
|
+
],
|
|
1022
|
+
frameworkFiles: (options) => {
|
|
1023
|
+
const optionalPackages = normalizeScaffoldOptionalPackages(options.optionalPackages);
|
|
1024
|
+
const storageEnabled = optionalPackages.includes("storage");
|
|
1025
|
+
const authEnabled = optionalPackages.includes("auth");
|
|
1026
|
+
const realtimeEnabled = optionalPackages.includes("realtime");
|
|
1027
|
+
return [
|
|
1028
|
+
{ path: "svelte.config.js", contents: renderSvelteConfig() },
|
|
1029
|
+
{ path: "vite.config.ts", contents: renderSvelteViteConfig(storageEnabled, realtimeEnabled) },
|
|
1030
|
+
{ path: "src/hooks.ts", contents: renderSvelteUserHooks() },
|
|
1031
|
+
{ path: "src/hooks.server.ts", contents: renderSvelteServerUserHooks() },
|
|
1032
|
+
{ path: "src/app.html", contents: renderSvelteAppHtml() },
|
|
1033
|
+
{ path: "src/routes/+page.svelte", contents: renderSveltePage(options.projectName) },
|
|
1034
|
+
...authEnabled ? renderAuthRouteFiles("sveltekit") : [],
|
|
1035
|
+
...renderSvelteManagedRuntimeFiles()
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
982
1038
|
}
|
|
983
|
-
|
|
1039
|
+
};
|
|
1040
|
+
function getFrameworkRenderer(framework) {
|
|
1041
|
+
return FRAMEWORK_RENDERERS[framework];
|
|
1042
|
+
}
|
|
1043
|
+
function renderAuthProviderRouteFiles(framework, features) {
|
|
1044
|
+
const renderer = getFrameworkRenderer(framework);
|
|
1045
|
+
return getRequestedHostedAuthProviders(features).flatMap((provider) => renderer.authProviderRouteFiles(provider));
|
|
1046
|
+
}
|
|
1047
|
+
function renderAuthRouteFiles(framework) {
|
|
1048
|
+
return getFrameworkRenderer(framework).authRouteFiles();
|
|
1049
|
+
}
|
|
1050
|
+
function renderManagedHostedAuthRouteFiles(framework, features) {
|
|
1051
|
+
return getFrameworkRenderer(framework).managedHostedAuthRouteFiles(features);
|
|
1052
|
+
}
|
|
1053
|
+
function renderBroadcastInstallFrameworkFiles(framework) {
|
|
1054
|
+
return getFrameworkRenderer(framework).broadcastInstallFiles();
|
|
1055
|
+
}
|
|
1056
|
+
function renderBroadcastAuthSupportFrameworkFiles(framework) {
|
|
1057
|
+
return getFrameworkRenderer(framework).broadcastAuthSupportFiles();
|
|
984
1058
|
}
|
|
985
1059
|
function renderFrameworkFiles(options) {
|
|
986
|
-
|
|
987
|
-
const storageEnabled = optionalPackages.includes("storage");
|
|
988
|
-
const authEnabled = optionalPackages.includes("auth");
|
|
989
|
-
const broadcastEnabled = optionalPackages.includes("broadcast");
|
|
990
|
-
const realtimeEnabled = optionalPackages.includes("realtime");
|
|
991
|
-
if (options.framework === "nuxt") {
|
|
992
|
-
return [
|
|
993
|
-
{ path: "app/app.vue", contents: renderNuxtAppVue(options.projectName) },
|
|
994
|
-
{ path: "nuxt.config.ts", contents: renderNuxtConfig() },
|
|
995
|
-
{ path: "shared/.gitkeep", contents: "" },
|
|
996
|
-
...authEnabled ? renderAuthRouteFiles("nuxt") : []
|
|
997
|
-
];
|
|
998
|
-
}
|
|
999
|
-
if (options.framework === "next") {
|
|
1000
|
-
return [
|
|
1001
|
-
{ path: "next.config.ts", contents: renderNextConfig() },
|
|
1002
|
-
{ path: "next-env.d.ts", contents: renderNextEnvDts() },
|
|
1003
|
-
{ path: "app/layout.tsx", contents: renderNextLayout(options.projectName) },
|
|
1004
|
-
{ path: "app/page.tsx", contents: renderNextPage(options.projectName) },
|
|
1005
|
-
...authEnabled ? [{ path: "app/api/auth/user/route.ts", contents: renderNextCurrentAuthRoute() }] : [],
|
|
1006
|
-
...storageEnabled ? [{ path: "app/storage/[[...path]]/route.ts", contents: renderNextStorageRoute() }] : [],
|
|
1007
|
-
...broadcastEnabled ? [{ path: "app/broadcasting/config/route.ts", contents: renderNextBroadcastConfigRoute() }] : [],
|
|
1008
|
-
...renderNextManagedRouteFiles({ authEnabled, broadcastEnabled, storageEnabled, realtimeEnabled })
|
|
1009
|
-
];
|
|
1010
|
-
}
|
|
1011
|
-
return [
|
|
1012
|
-
{ path: "svelte.config.js", contents: renderSvelteConfig() },
|
|
1013
|
-
{ path: "vite.config.ts", contents: renderSvelteViteConfig(storageEnabled, realtimeEnabled) },
|
|
1014
|
-
{ path: "src/hooks.ts", contents: renderSvelteUserHooks() },
|
|
1015
|
-
{ path: "src/hooks.server.ts", contents: renderSvelteServerUserHooks() },
|
|
1016
|
-
{ path: "src/app.html", contents: renderSvelteAppHtml() },
|
|
1017
|
-
{ path: "src/routes/+page.svelte", contents: renderSveltePage(options.projectName) },
|
|
1018
|
-
...authEnabled ? renderAuthRouteFiles("sveltekit") : [],
|
|
1019
|
-
...renderSvelteManagedRuntimeFiles()
|
|
1020
|
-
];
|
|
1060
|
+
return getFrameworkRenderer(options.framework).frameworkFiles(options);
|
|
1021
1061
|
}
|
|
1022
1062
|
function renderFrameworkRunner(options) {
|
|
1023
|
-
|
|
1063
|
+
return renderFrameworkRunnerForDescriptor(getFrameworkDescriptor(options.framework));
|
|
1064
|
+
}
|
|
1065
|
+
function renderFrameworkRunnerForDescriptor(descriptor) {
|
|
1066
|
+
const runner = descriptor.runner;
|
|
1024
1067
|
return [
|
|
1025
1068
|
"import { existsSync, readFileSync, readlinkSync } from 'node:fs'",
|
|
1026
1069
|
"import { dirname, resolve } from 'node:path'",
|
|
@@ -1034,7 +1077,8 @@ function renderFrameworkRunner(options) {
|
|
|
1034
1077
|
"const nextRuntimeBootstrapPath = resolve(projectRoot, '.holo-js/generated/next/bootstrap.mjs')",
|
|
1035
1078
|
"const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))",
|
|
1036
1079
|
"const framework = String(manifest.framework ?? '')",
|
|
1037
|
-
`const
|
|
1080
|
+
`const runner = ${JSON.stringify(runner)}`,
|
|
1081
|
+
`const commandName = ${JSON.stringify(runner.commandName)}`,
|
|
1038
1082
|
"const passthroughArgs = process.argv.slice(3)",
|
|
1039
1083
|
"const binaryPath = resolve(",
|
|
1040
1084
|
" projectRoot,",
|
|
@@ -1043,27 +1087,26 @@ function renderFrameworkRunner(options) {
|
|
|
1043
1087
|
" process.platform === 'win32' ? `${commandName}.cmd` : commandName,",
|
|
1044
1088
|
")",
|
|
1045
1089
|
"",
|
|
1090
|
+
"function resolveProjectPath(value) {",
|
|
1091
|
+
" return resolve(projectRoot, value)",
|
|
1092
|
+
"}",
|
|
1093
|
+
"",
|
|
1046
1094
|
"function resolveCommandInvocation() {",
|
|
1047
1095
|
" if (mode === 'dev') {",
|
|
1048
1096
|
" return { command: binaryPath, args: ['dev'] }",
|
|
1049
1097
|
" }",
|
|
1050
1098
|
"",
|
|
1051
1099
|
" if (mode === 'build') {",
|
|
1052
|
-
" return { command: binaryPath, args:
|
|
1100
|
+
" return { command: binaryPath, args: [...runner.buildArgs] }",
|
|
1053
1101
|
" }",
|
|
1054
1102
|
"",
|
|
1055
1103
|
" if (mode === 'start') {",
|
|
1056
|
-
" if (
|
|
1057
|
-
" return { command: binaryPath, args: [
|
|
1058
|
-
" }",
|
|
1059
|
-
"",
|
|
1060
|
-
" if (framework === 'nuxt') {",
|
|
1061
|
-
" return { command: process.execPath, args: [resolve(projectRoot, '.output/server/index.mjs'), ...passthroughArgs] }",
|
|
1104
|
+
" if (runner.startUsesFrameworkBinary) {",
|
|
1105
|
+
" return { command: binaryPath, args: [...runner.start, ...passthroughArgs] }",
|
|
1062
1106
|
" }",
|
|
1063
1107
|
"",
|
|
1064
|
-
"
|
|
1065
|
-
"
|
|
1066
|
-
" }",
|
|
1108
|
+
" const [entry, ...args] = runner.start",
|
|
1109
|
+
" return { command: process.execPath, args: [resolveProjectPath(entry), ...args, ...passthroughArgs] }",
|
|
1067
1110
|
" }",
|
|
1068
1111
|
"",
|
|
1069
1112
|
" return undefined",
|
|
@@ -1076,7 +1119,7 @@ function renderFrameworkRunner(options) {
|
|
|
1076
1119
|
" process.exit(1)",
|
|
1077
1120
|
"}",
|
|
1078
1121
|
"",
|
|
1079
|
-
"const suppressedOutput =
|
|
1122
|
+
"const suppressedOutput = runner.suppressSvelteKitOutput",
|
|
1080
1123
|
" ? new Set([",
|
|
1081
1124
|
` '"try_get_request_store" is imported from external module "@sveltejs/kit/internal/server" but never used in ".svelte-kit/adapter-node/index.js".',`,
|
|
1082
1125
|
" ])",
|
|
@@ -1087,7 +1130,7 @@ function renderFrameworkRunner(options) {
|
|
|
1087
1130
|
" return true",
|
|
1088
1131
|
" }",
|
|
1089
1132
|
"",
|
|
1090
|
-
" return
|
|
1133
|
+
" return runner.suppressSvelteKitOutput",
|
|
1091
1134
|
" && line.startsWith('Circular dependency: ')",
|
|
1092
1135
|
" && line.includes('/node_modules/semver/')",
|
|
1093
1136
|
"}",
|
|
@@ -1121,7 +1164,7 @@ function renderFrameworkRunner(options) {
|
|
|
1121
1164
|
"}",
|
|
1122
1165
|
"",
|
|
1123
1166
|
"function extractNextConflictInfo(lines) {",
|
|
1124
|
-
" if (
|
|
1167
|
+
" if (!runner.nextDevServerConflictHandling || mode !== 'dev') {",
|
|
1125
1168
|
" return undefined",
|
|
1126
1169
|
" }",
|
|
1127
1170
|
"",
|
|
@@ -1232,12 +1275,12 @@ function renderFrameworkRunner(options) {
|
|
|
1232
1275
|
" return waitForProcessExit(pid)",
|
|
1233
1276
|
"}",
|
|
1234
1277
|
"",
|
|
1235
|
-
"if ((mode !== 'start' ||
|
|
1278
|
+
"if ((mode !== 'start' || runner.startUsesFrameworkBinary) && !existsSync(binaryPath)) {",
|
|
1236
1279
|
' console.error(`[holo] Missing framework binary "${commandName}" for "${framework}". Run your package manager install first.`)',
|
|
1237
1280
|
" process.exit(1)",
|
|
1238
1281
|
"}",
|
|
1239
1282
|
"",
|
|
1240
|
-
"if (mode === 'start' &&
|
|
1283
|
+
"if (mode === 'start' && !runner.startUsesFrameworkBinary && !existsSync(commandInvocation.args[0])) {",
|
|
1241
1284
|
' console.error(`[holo] Missing production server entry "${commandInvocation.args[0]}". Run "holo build" before "holo start".`)',
|
|
1242
1285
|
" process.exit(1)",
|
|
1243
1286
|
"}",
|
|
@@ -1283,7 +1326,7 @@ function renderFrameworkRunner(options) {
|
|
|
1283
1326
|
" childEnv.HOLO_INTERNAL_FRAMEWORK_BUILD = '1'",
|
|
1284
1327
|
" }",
|
|
1285
1328
|
" const preloads = [runtimeSchemaPath]",
|
|
1286
|
-
" if (
|
|
1329
|
+
" if (runner.preloadNextRuntime) {",
|
|
1287
1330
|
" preloads.push(nextRuntimeBootstrapPath)",
|
|
1288
1331
|
" }",
|
|
1289
1332
|
" const preloadOptions = preloads",
|
|
@@ -1356,7 +1399,8 @@ import { constants as fsConstants } from "fs";
|
|
|
1356
1399
|
import { access, mkdir as mkdir2, readFile as readFile2, readdir as readdir2, writeFile as writeFile2 } from "fs/promises";
|
|
1357
1400
|
import { dirname as dirname3, extname as extname2, join, resolve as resolve3 } from "path";
|
|
1358
1401
|
import { loadConfigDirectory } from "@holo-js/config";
|
|
1359
|
-
import {
|
|
1402
|
+
import { renderGeneratedSchemaRuntimeModule } from "@holo-js/db";
|
|
1403
|
+
import { DEFAULT_HOLO_PROJECT_PATHS } from "@holo-js/kernel";
|
|
1360
1404
|
|
|
1361
1405
|
// src/project/registry-svelte.ts
|
|
1362
1406
|
import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
@@ -1873,7 +1917,7 @@ async function removeLegacyManagedHoloHelper(path, managedContents) {
|
|
|
1873
1917
|
const trimmedContents = contents?.trim();
|
|
1874
1918
|
const trimmedManagedContents = managedContents.trim();
|
|
1875
1919
|
const isLegacyManagedHelper = trimmedContents === [
|
|
1876
|
-
"import { createNextHoloHelpers } from '@holo-js/adapter-next'",
|
|
1920
|
+
"import { createNextHoloHelpers } from '@holo-js/adapter-next/runtime'",
|
|
1877
1921
|
"",
|
|
1878
1922
|
"export const holo = createNextHoloHelpers()"
|
|
1879
1923
|
].join("\n") || trimmedContents === [
|
|
@@ -2825,18 +2869,17 @@ export {
|
|
|
2825
2869
|
resolveArtifactPath,
|
|
2826
2870
|
renderNextHoloHelper,
|
|
2827
2871
|
renderNextRuntimeBootstrap,
|
|
2828
|
-
renderNextBroadcastAuthRoute,
|
|
2829
2872
|
renderNextBroadcastConfigRoute,
|
|
2830
|
-
renderNextGeneratedBroadcastConfigRoute,
|
|
2831
|
-
renderNextGeneratedBroadcastAuthRoute,
|
|
2832
2873
|
renderNextGeneratedRealtimeDefinitions,
|
|
2833
|
-
renderNextManagedHostedAuthRouteFiles,
|
|
2834
2874
|
renderSvelteViteConfig,
|
|
2835
|
-
renderSvelteHoloHelper,
|
|
2836
2875
|
renderAuthProviderRouteFiles,
|
|
2837
2876
|
renderAuthRouteFiles,
|
|
2877
|
+
renderManagedHostedAuthRouteFiles,
|
|
2878
|
+
renderBroadcastInstallFrameworkFiles,
|
|
2879
|
+
renderBroadcastAuthSupportFrameworkFiles,
|
|
2838
2880
|
renderFrameworkFiles,
|
|
2839
2881
|
renderFrameworkRunner,
|
|
2882
|
+
renderFrameworkRunnerForDescriptor,
|
|
2840
2883
|
renderGeneratedModelTypes,
|
|
2841
2884
|
writeGeneratedProjectRegistry,
|
|
2842
2885
|
loadGeneratedProjectRegistry
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasProjectDependency
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
prepareProjectDiscovery
|
|
6
|
-
} from "./chunk-VP2E62DF.mjs";
|
|
3
|
+
} from "./chunk-CT23GSEC.mjs";
|
|
7
4
|
import {
|
|
8
5
|
syncManagedDriverDependencies
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FFTJKBQF.mjs";
|
|
10
7
|
import {
|
|
11
8
|
ensureGeneratedSchemaPlaceholder,
|
|
12
9
|
ensureProjectConfig
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4VYR2ARA.mjs";
|
|
11
|
+
import {
|
|
12
|
+
prepareProjectDiscovery
|
|
13
|
+
} from "./chunk-7KZVFDSI.mjs";
|
|
14
|
+
import {
|
|
15
|
+
renderFrameworkRunnerForDescriptor
|
|
16
|
+
} from "./chunk-L3YATEQY.mjs";
|
|
14
17
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
loadProjectPluginFrameworkDescriptors
|
|
19
|
+
} from "./chunk-3ICVWL2M.mjs";
|
|
17
20
|
import {
|
|
21
|
+
getFrameworkDescriptorByIdFrom,
|
|
22
|
+
getFrameworkDescriptorsWith,
|
|
18
23
|
readTextFile,
|
|
19
24
|
writeTextFile
|
|
20
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-PVVGQSUP.mjs";
|
|
21
26
|
|
|
22
27
|
// src/dev.ts
|
|
23
28
|
import { spawnSync, spawn } from "child_process";
|
|
@@ -120,54 +125,45 @@ async function runProjectStartServer(io, projectRoot, spawnProcess = spawn, pass
|
|
|
120
125
|
throw new Error(`Project production server failed with exit code ${result.code ?? "unknown"}.`);
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
|
-
async function runProjectDependencyInstall(io, projectRoot,
|
|
128
|
+
async function runProjectDependencyInstall(io, projectRoot, spawnProcess = spawn) {
|
|
124
129
|
const invocation = await resolvePackageManagerInstallInvocation(projectRoot);
|
|
125
|
-
const
|
|
130
|
+
const child = spawnProcess(invocation.command, [...invocation.args], {
|
|
126
131
|
cwd: projectRoot,
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
env: process.env,
|
|
133
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
129
134
|
});
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
let stdout = "";
|
|
136
|
+
let stderr = "";
|
|
137
|
+
child.stdout?.on("data", (chunk) => stdout += String(chunk));
|
|
138
|
+
child.stderr?.on("data", (chunk) => stderr += String(chunk));
|
|
139
|
+
const result = await new Promise((resolvePromise) => {
|
|
140
|
+
child.on("error", (error) => resolvePromise({ kind: "error", error }));
|
|
141
|
+
child.on("close", (code) => resolvePromise({ kind: "close", code }));
|
|
142
|
+
});
|
|
143
|
+
if (result.kind === "error") {
|
|
144
|
+
throw result.error;
|
|
132
145
|
}
|
|
133
|
-
if (
|
|
134
|
-
io.
|
|
146
|
+
if (stdout) {
|
|
147
|
+
io.stdout.write(stdout);
|
|
135
148
|
}
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
if (stderr) {
|
|
150
|
+
io.stderr.write(stderr);
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
{
|
|
142
|
-
framework: "nuxt",
|
|
143
|
-
commands: {
|
|
144
|
-
bun: ["bun", "x", "nuxt", "prepare"],
|
|
145
|
-
npm: ["npm", "exec", "--", "nuxt", "prepare"],
|
|
146
|
-
pnpm: ["pnpm", "exec", "nuxt", "prepare"],
|
|
147
|
-
yarn: ["yarn", "run", "nuxt", "prepare"]
|
|
148
|
-
},
|
|
149
|
-
errorLabel: "nuxt prepare"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
framework: "sveltekit",
|
|
153
|
-
commands: {
|
|
154
|
-
bun: ["bun", "x", "svelte-kit", "sync"],
|
|
155
|
-
npm: ["npm", "exec", "--", "svelte-kit", "sync"],
|
|
156
|
-
pnpm: ["pnpm", "exec", "svelte-kit", "sync"],
|
|
157
|
-
yarn: ["yarn", "run", "svelte-kit", "sync"]
|
|
158
|
-
},
|
|
159
|
-
errorLabel: "svelte-kit sync"
|
|
152
|
+
if (result.code !== 0) {
|
|
153
|
+
throw new Error(stderr.trim() || stdout.trim() || "Project dependency installation failed.");
|
|
160
154
|
}
|
|
161
|
-
|
|
155
|
+
}
|
|
162
156
|
async function runProjectPrepare(projectRoot, io, options = {}) {
|
|
163
157
|
const project = await ensureProjectConfig(projectRoot);
|
|
164
158
|
await ensureGeneratedSchemaPlaceholder(projectRoot, project.config);
|
|
165
159
|
await prepareProjectDiscovery(projectRoot, project.config);
|
|
166
160
|
await refreshFrameworkRunner(projectRoot);
|
|
167
161
|
const syncFramework = options.syncFramework ?? true;
|
|
162
|
+
const syncDefinitions = syncFramework ? await resolveProjectFrameworkSyncDefinitions(projectRoot) : [];
|
|
168
163
|
if (syncFramework) {
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
for (const definition of syncDefinitions) {
|
|
165
|
+
await runFrameworkSync(projectRoot, definition);
|
|
166
|
+
}
|
|
171
167
|
}
|
|
172
168
|
const updatedDependencies = await syncManagedDriverDependencies(projectRoot);
|
|
173
169
|
if (updatedDependencies && io) {
|
|
@@ -175,8 +171,9 @@ async function runProjectPrepare(projectRoot, io, options = {}) {
|
|
|
175
171
|
await prepareProjectDiscovery(projectRoot, project.config);
|
|
176
172
|
await refreshFrameworkRunner(projectRoot);
|
|
177
173
|
if (syncFramework) {
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
for (const definition of syncDefinitions) {
|
|
175
|
+
await runFrameworkSync(projectRoot, definition);
|
|
176
|
+
}
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
179
|
}
|
|
@@ -186,35 +183,53 @@ async function runProjectHotPrepare(projectRoot, io) {
|
|
|
186
183
|
async function refreshFrameworkRunner(projectRoot) {
|
|
187
184
|
const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
|
|
188
185
|
const frameworkRunnerPath = resolve(projectRoot, ".holo-js/framework/run.mjs");
|
|
189
|
-
const
|
|
190
|
-
if (!
|
|
186
|
+
const descriptor = await resolveProjectFramework(projectRoot, frameworkProjectPath);
|
|
187
|
+
if (!descriptor) {
|
|
191
188
|
return;
|
|
192
189
|
}
|
|
193
|
-
await writeTextFile(frameworkProjectPath, `${JSON.stringify({ framework }, null, 2)}
|
|
190
|
+
await writeTextFile(frameworkProjectPath, `${JSON.stringify({ framework: descriptor.id }, null, 2)}
|
|
194
191
|
`);
|
|
195
|
-
await writeTextFile(frameworkRunnerPath,
|
|
192
|
+
await writeTextFile(frameworkRunnerPath, renderFrameworkRunnerForDescriptor(descriptor));
|
|
196
193
|
}
|
|
197
194
|
async function resolveProjectFramework(projectRoot, frameworkProjectPath) {
|
|
195
|
+
const pluginDescriptors = await loadProjectPluginFrameworkDescriptors(projectRoot);
|
|
198
196
|
try {
|
|
199
197
|
const content = await readFile(frameworkProjectPath, "utf8");
|
|
200
198
|
const manifest = JSON.parse(content);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
return manifest.framework;
|
|
199
|
+
const descriptor = typeof manifest.framework === "string" ? getFrameworkDescriptorByIdFrom(manifest.framework, pluginDescriptors) : void 0;
|
|
200
|
+
return descriptor ?? resolveProjectFrameworkFromDependencies(projectRoot, pluginDescriptors);
|
|
205
201
|
} catch {
|
|
202
|
+
return resolveProjectFrameworkFromDependencies(projectRoot, pluginDescriptors);
|
|
206
203
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
}
|
|
205
|
+
async function resolveProjectFrameworkFromDependencies(projectRoot, pluginDescriptors = []) {
|
|
206
|
+
for (const descriptor of getFrameworkDescriptorsWith(pluginDescriptors)) {
|
|
207
|
+
const matches = await Promise.all(
|
|
208
|
+
descriptor.detectPackages.map((packageName) => hasProjectDependency(projectRoot, packageName))
|
|
209
|
+
);
|
|
210
|
+
if (matches.some(Boolean)) {
|
|
211
|
+
return descriptor;
|
|
212
|
+
}
|
|
215
213
|
}
|
|
216
214
|
return void 0;
|
|
217
215
|
}
|
|
216
|
+
async function resolveProjectFrameworkSyncDefinitions(projectRoot) {
|
|
217
|
+
const pluginDescriptors = await loadProjectPluginFrameworkDescriptors(projectRoot);
|
|
218
|
+
const seen = /* @__PURE__ */ new Set();
|
|
219
|
+
const definitions = [];
|
|
220
|
+
for (const descriptor of getFrameworkDescriptorsWith(pluginDescriptors)) {
|
|
221
|
+
if (!descriptor.sync || seen.has(descriptor.id)) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
seen.add(descriptor.id);
|
|
225
|
+
definitions.push({
|
|
226
|
+
framework: descriptor.id,
|
|
227
|
+
commands: descriptor.sync.commands,
|
|
228
|
+
errorLabel: descriptor.sync.errorLabel
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return Object.freeze(definitions);
|
|
232
|
+
}
|
|
218
233
|
async function runFrameworkSync(projectRoot, definition) {
|
|
219
234
|
const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
|
|
220
235
|
try {
|