@hot-updater/console 0.36.7 → 1.0.0-rc.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/.output/nitro.json +1 -1
- package/.output/public/assets/BundleIdDisplay-D4ErdU5_.js +1 -0
- package/.output/public/assets/InsightsCapabilityContext-B42VqvP6.js +1 -0
- package/.output/public/assets/api-keys-api-DGVTTvTJ.js +1 -0
- package/.output/public/assets/api-keys-z16OZIP4.js +1 -0
- package/.output/public/assets/badge-Br_KDO0J.js +1 -0
- package/.output/public/assets/card-DzuEXvyJ.js +1 -0
- package/.output/public/assets/chart-no-axes-combined-FaYMGmQS.js +1 -0
- package/.output/public/assets/createServerFn-gM2-LFBy.js +3 -0
- package/.output/public/assets/dialog-BeAENgez.js +1 -0
- package/.output/public/assets/dist-Bssh_cv0.js +1 -0
- package/.output/public/assets/field-Buq148-A.js +1 -0
- package/.output/public/assets/index-uOpQAIC4.js +10 -0
- package/.output/public/assets/input-group-B3p5UpyW.js +1 -0
- package/.output/public/assets/insights-DJTr7Ozn.js +1 -0
- package/.output/public/assets/insights-api-DVMOoRMS.js +1 -0
- package/.output/public/assets/installations-BY64iIAK.js +2 -0
- package/.output/public/assets/installations-D5v9i3AL.js +1 -0
- package/.output/public/assets/lazyRouteComponent-DKYu5cZJ.js +1 -0
- package/.output/public/assets/preload-helper-CQ36nxok.js +1 -0
- package/.output/public/assets/refresh-cw-BkbfZ62O.js +1 -0
- package/.output/public/assets/routes-BuoI5-Cr.js +2 -0
- package/.output/public/assets/routes-C8fvgETO.js +1 -0
- package/.output/public/assets/search-qsIDvS2I.js +1 -0
- package/.output/public/assets/shield-check-DE_hVuHu.js +1 -0
- package/.output/public/assets/signing-mJD88Y4C.js +1 -0
- package/.output/public/assets/styles-BZIG7t42.css +2 -0
- package/.output/public/assets/table-RamFEclP.js +1 -0
- package/.output/public/assets/useCompositeListItem-ChzDqdpc.js +42 -0
- package/.output/public/assets/useMutation-JsGVjQMY.js +1 -0
- package/.output/public/assets/useOpenInteractionType-Dwfy-SpA.js +1 -0
- package/.output/server/__23tanstack-start-server-fn-resolver-Dftxlm2E.mjs +146 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +16124 -0
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +41 -10
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +132 -0
- package/.output/server/_libs/d3-array.mjs +231 -0
- package/.output/server/_libs/d3-color.mjs +330 -0
- package/.output/server/_libs/d3-format.mjs +252 -0
- package/.output/server/_libs/d3-interpolate.mjs +207 -0
- package/.output/server/_libs/d3-path.mjs +77 -0
- package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
- package/.output/server/_libs/d3-shape.mjs +818 -0
- package/.output/server/_libs/decimal.js-light.mjs +884 -0
- package/.output/server/_libs/es-toolkit.mjs +1134 -0
- package/.output/server/_libs/eventemitter3.mjs +236 -0
- package/.output/server/_libs/immer.mjs +532 -0
- package/.output/server/_libs/lucide-react.mjs +141 -13
- package/.output/server/_libs/next-themes.mjs +2 -2
- package/.output/server/_libs/react-redux+[...].mjs +205 -0
- package/.output/server/_libs/recharts+[...].mjs +14117 -0
- package/.output/server/_libs/sonner.mjs +2 -2
- package/.output/server/_libs/tanstack__query-core.mjs +114 -1
- package/.output/server/_libs/tanstack__react-query.mjs +3 -4
- package/.output/server/_runtime.mjs +10 -1
- package/.output/server/_ssr/BundleActivityChart-CWcdPuUn.mjs +288 -0
- package/.output/server/_ssr/BundleIdDisplay-BEvB3MvA.mjs +13 -0
- package/.output/server/_ssr/InsightsCapabilityContext-Cx8fjm2s.mjs +15 -0
- package/.output/server/_ssr/api-keys-CpBqHpuC.mjs +300 -0
- package/.output/server/_ssr/api-keys-api-Czkp57UV.mjs +60 -0
- package/.output/server/_ssr/api-keys-rpc-BTtMDSoR.mjs +136 -0
- package/.output/server/_ssr/api-rpc-BEX8ISai.mjs +1468 -0
- package/.output/server/_ssr/auth-BF8mbAgF.mjs +21 -0
- package/.output/server/_ssr/auth-rpc-BFMEC-TT.mjs +24 -0
- package/.output/server/_ssr/auth.server-DW71WzsD.mjs +47 -0
- package/.output/server/_ssr/badge-CpWXQwyF.mjs +26 -0
- package/.output/server/_ssr/bundle-signing-rpc-BbCFUQSu.mjs +16 -0
- package/.output/server/_ssr/bundle-signing.server-C4NW5mWx.mjs +12 -0
- package/.output/server/_ssr/card-Bsc8mRis.mjs +86 -0
- package/.output/server/_ssr/config-Dv8qLDZ0.mjs +13 -0
- package/.output/server/_ssr/config.server-DQYEr_5X.mjs +361 -0
- package/.output/server/_ssr/{createServerFn-DzU0k62V.mjs → createServerFn-B2hcXoPM.mjs} +1 -1
- package/.output/server/_ssr/createServerRpc-DB29C_5p.mjs +12 -0
- package/.output/server/_ssr/{sidebar-Cv_H0_Jv.mjs → createSsrRpc-DhfrxEjg.mjs} +68 -50
- package/.output/server/_ssr/databaseRows-QlCYLi0H.mjs +166 -0
- package/.output/server/_ssr/deleteBundle-Cu_XOMt0.mjs +66 -0
- package/.output/server/_ssr/dialog-C0vKUp8R.mjs +170 -0
- package/.output/server/_ssr/dist-BVSLTpoP.mjs +250 -0
- package/.output/server/_ssr/downloadBundle-CNnYxYO2.mjs +24 -0
- package/.output/server/_ssr/{empty-plugin-adapters-B4HCzgmM.mjs → empty-plugin-adapters-B5QvGpEl.mjs} +1 -1
- package/.output/server/_ssr/field-DASCh-5d.mjs +74 -0
- package/.output/server/_ssr/{getBundleChildren-CVtSiH5t.mjs → getBundleChildren-BcRMFoDF.mjs} +10 -18
- package/.output/server/_ssr/input-group-etIsBUqv.mjs +288 -0
- package/.output/server/_ssr/insights-api-C1F7UreR.mjs +71 -0
- package/.output/server/_ssr/insights-input-9fEJF-ZG.mjs +96 -0
- package/.output/server/_ssr/insights-rpc-C-8R6kED.mjs +155 -0
- package/.output/server/_ssr/insights-ygT_aIfo.mjs +858 -0
- package/.output/server/_ssr/installations-DqRT1QTd.mjs +535 -0
- package/.output/server/_ssr/installations-K8TCYTYh.mjs +19 -0
- package/.output/server/_ssr/router-BxBEvtF1.mjs +513 -0
- package/.output/server/_ssr/routes-BC7rn-tf.mjs +37 -0
- package/.output/server/_ssr/routes-CM5KAwpB.mjs +2285 -0
- package/.output/server/_ssr/runtime.server-la7TRAH_.mjs +527 -0
- package/.output/server/_ssr/server-CpzW--lT.mjs +7468 -0
- package/.output/server/_ssr/signing-jk4HANnl.mjs +134 -0
- package/.output/server/_ssr/ssr.mjs +4 -5740
- package/.output/server/_ssr/start-DpViQGnt.mjs +4 -0
- package/.output/server/_ssr/table-CU58HeI7.mjs +53 -0
- package/.output/server/_ssr/uuidv7-CaKuKXrV.mjs +31 -0
- package/.output/server/_tanstack-start-manifest_v-Mz9MmSlD.mjs +103 -0
- package/.output/server/index.mjs +229 -47
- package/README.md +29 -8
- package/lib/index.d.mts +35 -0
- package/lib/index.mjs +4 -0
- package/lib/vite-internal.mjs +127 -0
- package/lib/vite.d.mts +10 -0
- package/lib/vite.mjs +5 -0
- package/package.json +51 -29
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/logo.svg +1 -0
- package/public/manifest.json +30 -0
- package/public/robots.txt +3 -0
- package/src/components/AppSidebar.tsx +159 -0
- package/src/components/BundleIdDisplay.tsx +18 -0
- package/src/components/ChannelBadge.tsx +31 -0
- package/src/components/ConsoleAccessPage.tsx +122 -0
- package/src/components/EnabledStatusIcon.tsx +54 -0
- package/src/components/HashValueDisplay.tsx +85 -0
- package/src/components/HotUpdaterLogo.tsx +30 -0
- package/src/components/NotFoundPage.tsx +33 -0
- package/src/components/PlatformIcon.tsx +39 -0
- package/src/components/RolloutPercentageBadge.tsx +28 -0
- package/src/components/ThemeProvider.tsx +116 -0
- package/src/components/TimestampDisplay.tsx +41 -0
- package/src/components/features/api-keys/ApiKeysPage.tsx +377 -0
- package/src/components/features/bundles/BundleActivityChart.tsx +193 -0
- package/src/components/features/bundles/BundleChildrenPanel.tsx +201 -0
- package/src/components/features/bundles/BundleInsightsSummary.tsx +123 -0
- package/src/components/features/bundles/BundleMetadata.tsx +136 -0
- package/src/components/features/bundles/RolloutCohortsDialog.tsx +201 -0
- package/src/components/features/channels/ChannelManagementDialog.tsx +228 -0
- package/src/components/features/insights/ActivityChart.tsx +150 -0
- package/src/components/features/insights/BundleDistribution.tsx +133 -0
- package/src/components/features/insights/BundleSelector.tsx +114 -0
- package/src/components/features/insights/InsightsCapabilityContext.tsx +24 -0
- package/src/components/features/insights/InsightsControls.tsx +115 -0
- package/src/components/features/insights/InsightsErrorAlert.tsx +21 -0
- package/src/components/features/insights/InsightsOverview.tsx +208 -0
- package/src/components/features/insights/InstallationHistoryCard.tsx +248 -0
- package/src/components/features/insights/InstallationMatchesCard.tsx +132 -0
- package/src/components/features/insights/InstallationPageHeader.tsx +138 -0
- package/src/components/features/insights/InstallationPagination.tsx +48 -0
- package/src/components/features/insights/InstallationSearch.tsx +230 -0
- package/src/components/features/insights/UpdateOutcomes.tsx +147 -0
- package/src/components/features/releases/ReleaseEditorSheet.tsx +879 -0
- package/src/components/features/releases/ReleaseStateBadge.tsx +20 -0
- package/src/components/features/signing/BundleSigningPage.tsx +139 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +76 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +89 -0
- package/src/components/ui/chart.tsx +371 -0
- package/src/components/ui/combobox.tsx +303 -0
- package/src/components/ui/dialog.tsx +156 -0
- package/src/components/ui/dropdown-menu.tsx +270 -0
- package/src/components/ui/field.tsx +235 -0
- package/src/components/ui/input-group.tsx +147 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +25 -0
- package/src/components/ui/progress.tsx +84 -0
- package/src/components/ui/select.tsx +205 -0
- package/src/components/ui/separator.tsx +23 -0
- package/src/components/ui/sheet.tsx +132 -0
- package/src/components/ui/sidebar.tsx +779 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +56 -0
- package/src/components/ui/sonner.tsx +45 -0
- package/src/components/ui/switch.tsx +25 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle-group.tsx +89 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +66 -0
- package/src/hooks/use-mobile.ts +30 -0
- package/src/index.ts +47 -0
- package/src/lib/api-keys-api.ts +69 -0
- package/src/lib/api-keys-rpc.ts +87 -0
- package/src/lib/api-rpc.ts +478 -0
- package/src/lib/api.ts +444 -0
- package/src/lib/auth-rpc.ts +16 -0
- package/src/lib/bundle-signing-api.ts +14 -0
- package/src/lib/bundle-signing-rpc.ts +16 -0
- package/src/lib/constants.ts +1 -0
- package/src/lib/git.ts +51 -0
- package/src/lib/insights-api.ts +144 -0
- package/src/lib/insights-error.ts +19 -0
- package/src/lib/insights-input.ts +187 -0
- package/src/lib/insights-overview.ts +170 -0
- package/src/lib/insights-rpc.ts +218 -0
- package/src/lib/server/auth.server.ts +43 -0
- package/src/lib/server/bundle-signing.server.ts +23 -0
- package/src/lib/server/config.server.ts +109 -0
- package/src/lib/server/console-runtime.server.ts +61 -0
- package/src/lib/server/deleteBundle.ts +145 -0
- package/src/lib/server/downloadBundle.ts +46 -0
- package/src/lib/server/getBundleChildren.ts +130 -0
- package/src/lib/server/listReleases.ts +61 -0
- package/src/lib/server/releaseActivity.ts +27 -0
- package/src/lib/server/releaseReachability.ts +95 -0
- package/src/lib/server/runtime.server.ts +172 -0
- package/src/lib/utils.ts +9 -0
- package/src/logo.svg +1 -0
- package/src/routeTree.gen.ts +199 -0
- package/src/router.tsx +21 -0
- package/src/routes/-installations-search.ts +19 -0
- package/src/routes/-releases-search.ts +74 -0
- package/src/routes/__root.tsx +174 -0
- package/src/routes/api/auth/$.ts +19 -0
- package/src/routes/api/bundles/$bundleId/download.ts +17 -0
- package/src/routes/api-keys.tsx +37 -0
- package/src/routes/index.tsx +982 -0
- package/src/routes/insights.tsx +139 -0
- package/src/routes/installations.tsx +194 -0
- package/src/routes/signing.tsx +37 -0
- package/src/styles.css +152 -0
- package/src/virtual-modules.d.ts +21 -0
- package/src/vite-env.d.ts +1 -0
- package/src/vite-internal.ts +195 -0
- package/src/vite.ts +12 -0
- package/.output/public/assets/dist-DJX53faP.js +0 -3
- package/.output/public/assets/index-Iylis5kY.js +0 -10
- package/.output/public/assets/routes-HT21hs0C.js +0 -54
- package/.output/public/assets/styles-C0Re4quB.css +0 -2
- package/.output/server/__23tanstack-start-server-fn-resolver-CgwgZ0-i.mjs +0 -66
- package/.output/server/_libs/@floating-ui/core+[...].mjs +0 -698
- package/.output/server/_libs/@floating-ui/dom+[...].mjs +0 -644
- package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +0 -839
- package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +0 -2138
- package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +0 -308
- package/.output/server/_libs/@radix-ui/react-select+[...].mjs +0 -1038
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
- package/.output/server/_libs/@tanstack/form-core+[...].mjs +0 -3228
- package/.output/server/_libs/@tanstack/react-form+[...].mjs +0 -430
- package/.output/server/_libs/@tanstack/react-table+[...].mjs +0 -2382
- package/.output/server/_libs/radix-ui__number.mjs +0 -6
- package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
- package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
- package/.output/server/_libs/radix-ui__react-collection.mjs +0 -78
- package/.output/server/_libs/radix-ui__react-direction.mjs +0 -13
- package/.output/server/_libs/radix-ui__react-label.mjs +0 -22
- package/.output/server/_libs/radix-ui__react-separator.mjs +0 -30
- package/.output/server/_libs/radix-ui__react-slider.mjs +0 -510
- package/.output/server/_libs/radix-ui__react-switch.mjs +0 -157
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -493
- package/.output/server/_ssr/api-rpc-BIbDUKSz.mjs +0 -292
- package/.output/server/_ssr/config.server-BSS366KT.mjs +0 -41
- package/.output/server/_ssr/deleteBundle-BgbZTtpW.mjs +0 -141
- package/.output/server/_ssr/dist-KboydRVk.mjs +0 -120
- package/.output/server/_ssr/router-C3hqEy3k.mjs +0 -307
- package/.output/server/_ssr/routes-B0lQvvlC.mjs +0 -3048
- package/.output/server/_ssr/start-02sLteYG.mjs +0 -4
- package/.output/server/_ssr/storageProfile-FVkjPoGb.mjs +0 -9
- package/.output/server/_tanstack-start-manifest_v-Bpx52WOU.mjs +0 -20
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -9
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
+
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
|
6
|
+
import viteReact from "@vitejs/plugin-react";
|
|
7
|
+
import { nitro } from "nitro/vite";
|
|
8
|
+
import type { Plugin, PluginOption, UserConfig } from "vite";
|
|
9
|
+
|
|
10
|
+
import type { HotUpdaterConsolePluginOptions } from "./vite";
|
|
11
|
+
|
|
12
|
+
const virtualAuthModuleId = "virtual:hot-updater-console/auth";
|
|
13
|
+
const virtualConfigModuleId = "virtual:hot-updater-console/config";
|
|
14
|
+
const virtualPackageRouterModuleId =
|
|
15
|
+
"virtual:hot-updater-console/package-router";
|
|
16
|
+
const virtualRouteTreeModuleId = "virtual:hot-updater-console/route-tree";
|
|
17
|
+
|
|
18
|
+
const resolvedVirtualAuthModuleId = `\0${virtualAuthModuleId}`;
|
|
19
|
+
const resolvedVirtualConfigModuleId = `\0${virtualConfigModuleId}`;
|
|
20
|
+
const resolvedVirtualPackageRouterModuleId = `\0${virtualPackageRouterModuleId}`;
|
|
21
|
+
|
|
22
|
+
const packageRoot = path.resolve(import.meta.dirname, "..");
|
|
23
|
+
const packagePublicDirectory = path.join(packageRoot, "public");
|
|
24
|
+
const packageRouterFile = path.join(packageRoot, "src/router.tsx");
|
|
25
|
+
const packageRoutesDirectory = path.join(packageRoot, "src/routes");
|
|
26
|
+
const packageSourceDirectory = path.join(packageRoot, "src");
|
|
27
|
+
const localRouteTreeFile = path.join(
|
|
28
|
+
packageSourceDirectory,
|
|
29
|
+
"routeTree.gen.ts",
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
type ConsoleModuleMode =
|
|
33
|
+
| {
|
|
34
|
+
readonly type: "hosted";
|
|
35
|
+
readonly options: HotUpdaterConsolePluginOptions;
|
|
36
|
+
}
|
|
37
|
+
| { readonly type: "local" };
|
|
38
|
+
|
|
39
|
+
const resolveFromRoot = (root: string, file: string) =>
|
|
40
|
+
path.isAbsolute(file) ? file : path.resolve(root, file);
|
|
41
|
+
|
|
42
|
+
const toImportPath = (file: string) => file.split(path.sep).join("/");
|
|
43
|
+
|
|
44
|
+
const writeFileIfChanged = (file: string, contents: string) => {
|
|
45
|
+
if (existsSync(file) && readFileSync(file, "utf8") === contents) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
50
|
+
writeFileSync(file, contents);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const createConsoleModulesPlugin = (mode: ConsoleModuleMode): Plugin => {
|
|
54
|
+
let authFile = "";
|
|
55
|
+
let configFile = "";
|
|
56
|
+
let generatedRouteTreeFile = localRouteTreeFile;
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
name: `hot-updater-console:${mode.type}-modules`,
|
|
60
|
+
enforce: "pre",
|
|
61
|
+
config(userConfig, configEnvironment) {
|
|
62
|
+
const root = path.resolve(process.cwd(), userConfig.root ?? ".");
|
|
63
|
+
|
|
64
|
+
if (mode.type === "hosted") {
|
|
65
|
+
const cacheDirectory = path.join(root, ".hot-updater/console");
|
|
66
|
+
generatedRouteTreeFile = path.join(cacheDirectory, "routeTree.gen.ts");
|
|
67
|
+
authFile = resolveFromRoot(
|
|
68
|
+
root,
|
|
69
|
+
mode.options.auth ?? "console.auth.ts",
|
|
70
|
+
);
|
|
71
|
+
configFile = resolveFromRoot(
|
|
72
|
+
root,
|
|
73
|
+
mode.options.config ?? "hot-updater.config.ts",
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
writeFileIfChanged(
|
|
77
|
+
path.join(cacheDirectory, "router.ts"),
|
|
78
|
+
[
|
|
79
|
+
`export { getRouter } from ${JSON.stringify(virtualPackageRouterModuleId)};`,
|
|
80
|
+
"",
|
|
81
|
+
].join("\n"),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
assetsInclude: ["**/*.node"],
|
|
87
|
+
oxc: {
|
|
88
|
+
jsx: {
|
|
89
|
+
development: configEnvironment.command === "serve",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
resolve: {
|
|
93
|
+
alias: [
|
|
94
|
+
{
|
|
95
|
+
find: /^@\//,
|
|
96
|
+
replacement: `${toImportPath(packageSourceDirectory)}/`,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
dedupe: [
|
|
100
|
+
"react",
|
|
101
|
+
"react-dom",
|
|
102
|
+
"@tanstack/react-query",
|
|
103
|
+
"@tanstack/react-router",
|
|
104
|
+
"@tanstack/react-start",
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
} satisfies UserConfig;
|
|
108
|
+
},
|
|
109
|
+
resolveId(id) {
|
|
110
|
+
if (id === virtualAuthModuleId) {
|
|
111
|
+
return resolvedVirtualAuthModuleId;
|
|
112
|
+
}
|
|
113
|
+
if (id === virtualConfigModuleId) {
|
|
114
|
+
return resolvedVirtualConfigModuleId;
|
|
115
|
+
}
|
|
116
|
+
if (id === virtualPackageRouterModuleId) {
|
|
117
|
+
return resolvedVirtualPackageRouterModuleId;
|
|
118
|
+
}
|
|
119
|
+
if (id === virtualRouteTreeModuleId) {
|
|
120
|
+
return generatedRouteTreeFile;
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
},
|
|
124
|
+
load(id) {
|
|
125
|
+
if (id === resolvedVirtualPackageRouterModuleId) {
|
|
126
|
+
return `export { getRouter } from ${JSON.stringify(toImportPath(packageRouterFile))};`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (id === resolvedVirtualConfigModuleId) {
|
|
130
|
+
if (mode.type === "local") {
|
|
131
|
+
return [
|
|
132
|
+
'import { loadConfig } from "@hot-updater/cli-tools";',
|
|
133
|
+
"export default async () => {",
|
|
134
|
+
" const config = await loadConfig(null);",
|
|
135
|
+
" return {",
|
|
136
|
+
" console: { gitUrl: config.console.gitUrl },",
|
|
137
|
+
" database: config.database,",
|
|
138
|
+
" signing: config.signing,",
|
|
139
|
+
" storage: config.storage,",
|
|
140
|
+
" };",
|
|
141
|
+
"};",
|
|
142
|
+
].join("\n");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.addWatchFile(configFile);
|
|
146
|
+
return `export { default } from ${JSON.stringify(toImportPath(configFile))};`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (id === resolvedVirtualAuthModuleId) {
|
|
150
|
+
if (mode.type === "local") {
|
|
151
|
+
return [
|
|
152
|
+
'const principal = { email: "local@hot-updater.dev", name: "Local Console" };',
|
|
153
|
+
"export default {",
|
|
154
|
+
" async handle() {",
|
|
155
|
+
' return new Response("Not Found", { status: 404 });',
|
|
156
|
+
" },",
|
|
157
|
+
" async getAccess() {",
|
|
158
|
+
' return { status: "authorized", principal };',
|
|
159
|
+
" },",
|
|
160
|
+
" async getProviders() {",
|
|
161
|
+
" return [];",
|
|
162
|
+
" },",
|
|
163
|
+
"};",
|
|
164
|
+
].join("\n");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this.addWatchFile(authFile);
|
|
168
|
+
return `export { default } from ${JSON.stringify(toImportPath(authFile))};`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return undefined;
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const createHostedConsolePlugins = (
|
|
177
|
+
options: HotUpdaterConsolePluginOptions,
|
|
178
|
+
): PluginOption[] => [
|
|
179
|
+
createConsoleModulesPlugin({ type: "hosted", options }),
|
|
180
|
+
nitro({
|
|
181
|
+
publicAssets: [{ dir: packagePublicDirectory, maxAge: 60 * 60 * 24 }],
|
|
182
|
+
}),
|
|
183
|
+
tailwindcss(),
|
|
184
|
+
tanstackStart({
|
|
185
|
+
srcDirectory: ".hot-updater/console",
|
|
186
|
+
router: {
|
|
187
|
+
generatedRouteTree: "routeTree.gen.ts",
|
|
188
|
+
routesDirectory: packageRoutesDirectory,
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
viteReact(),
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
export const createLocalConsoleModulesPlugin = (): Plugin =>
|
|
195
|
+
createConsoleModulesPlugin({ type: "local" });
|
package/src/vite.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PluginOption } from "vite";
|
|
2
|
+
|
|
3
|
+
import { createHostedConsolePlugins } from "./vite-internal";
|
|
4
|
+
|
|
5
|
+
export interface HotUpdaterConsolePluginOptions {
|
|
6
|
+
readonly auth?: string;
|
|
7
|
+
readonly config?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const hotUpdaterConsole = (
|
|
11
|
+
options: HotUpdaterConsolePluginOptions = {},
|
|
12
|
+
): PluginOption[] => createHostedConsolePlugins(options);
|