@lukoweb/apitogo 0.1.66 → 0.1.68
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/cli.js +529 -379
- package/docs/components/playground.mdx +6 -8
- package/docs/components/slot.mdx +2 -2
- package/docs/concepts/auth-provider-api-identities.md +8 -12
- package/docs/configuration/ai-assistants.md +3 -3
- package/docs/configuration/api-catalog.md +4 -4
- package/docs/configuration/api-reference.md +11 -11
- package/docs/configuration/authentication-auth0.md +8 -1
- package/docs/configuration/authentication-azure-ad.md +8 -1
- package/docs/configuration/authentication-clerk.md +8 -1
- package/docs/configuration/authentication-firebase.md +8 -1
- package/docs/configuration/authentication-pingfederate.md +8 -1
- package/docs/configuration/authentication-supabase.md +10 -3
- package/docs/configuration/authentication.md +96 -195
- package/docs/configuration/build-configuration.mdx +2 -2
- package/docs/configuration/docs.md +10 -10
- package/docs/configuration/footer.mdx +84 -180
- package/docs/configuration/llms.md +1 -1
- package/docs/configuration/make-config.mdx +12 -5
- package/docs/configuration/manifest.md +4 -14
- package/docs/configuration/navigation.mdx +2 -2
- package/docs/configuration/overview.md +95 -310
- package/docs/configuration/protected-routes.md +3 -3
- package/docs/configuration/search.md +4 -3
- package/docs/configuration/site.md +5 -5
- package/docs/configuration/slots.mdx +1 -1
- package/docs/custom-plugins.md +1 -1
- package/docs/customization/colors-theme.mdx +8 -8
- package/docs/customization/fonts.md +4 -4
- package/docs/deploy/apitogo.md +18 -12
- package/docs/deploy/cloudflare-pages.md +0 -1
- package/docs/deploy/direct-upload.md +0 -1
- package/docs/deploy/github-pages.md +1 -2
- package/docs/deploy/vercel.md +2 -3
- package/docs/deployment.md +11 -10
- package/docs/extending/events.md +1 -1
- package/docs/guides/custom-pages.md +4 -8
- package/docs/guides/environment-variables.md +41 -49
- package/docs/guides/managing-api-keys-and-identities.md +40 -115
- package/docs/guides/navigation-rules.mdx +1 -1
- package/docs/guides/processors.mdx +2 -2
- package/docs/guides/transforming-examples.md +1 -1
- package/docs/markdown/code-blocks.md +2 -2
- package/docs/markdown/mdx.md +1 -1
- package/docs/mcp/go-live.md +100 -0
- package/docs/mcp/overview.md +76 -0
- package/docs/mcp/setup.md +173 -0
- package/docs/mcp/shape.md +76 -0
- package/docs/mcp/tools.md +102 -0
- package/docs/plugins.md +20 -1
- package/docs/quickstart.md +49 -54
- package/docs/writing.mdx +1 -1
- package/package.json +1 -1
- package/src/vite/plugin-config.ts +3 -0
- package/docs/guides/navigation-migration.md +0 -87
package/dist/cli/cli.js
CHANGED
|
@@ -10,18 +10,18 @@ var __export = (target, all) => {
|
|
|
10
10
|
|
|
11
11
|
// src/cli/common/package-json.ts
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
|
-
import
|
|
13
|
+
import path2 from "node:path";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
var getPackageJsonPath, getPackageJson, getZudokuPackageJson, getZudokuRootDir;
|
|
16
16
|
var init_package_json = __esm({
|
|
17
17
|
"src/cli/common/package-json.ts"() {
|
|
18
18
|
getPackageJsonPath = (pkg) => fileURLToPath(import.meta.resolve(`${pkg}/package.json`)).replaceAll(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
path2.sep,
|
|
20
|
+
path2.posix.sep
|
|
21
21
|
);
|
|
22
22
|
getPackageJson = (pkgPath) => JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
23
23
|
getZudokuPackageJson = () => getPackageJson(getPackageJsonPath("@lukoweb/apitogo"));
|
|
24
|
-
getZudokuRootDir = () =>
|
|
24
|
+
getZudokuRootDir = () => path2.dirname(getPackageJsonPath("@lukoweb/apitogo"));
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -664,12 +664,12 @@ var init_apitogo_config_core = __esm({
|
|
|
664
664
|
|
|
665
665
|
// src/config/apitogo-config-loader.node.ts
|
|
666
666
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
667
|
-
import
|
|
667
|
+
import path3 from "node:path";
|
|
668
668
|
function loadApitogoConfig(rootDir = process.cwd()) {
|
|
669
|
-
const configPath =
|
|
669
|
+
const configPath = path3.join(path3.resolve(rootDir), APITOGO_CONFIG_FILENAME);
|
|
670
670
|
if (!existsSync(configPath)) {
|
|
671
671
|
throw new Error(
|
|
672
|
-
`Missing ${APITOGO_CONFIG_FILENAME} in ${
|
|
672
|
+
`Missing ${APITOGO_CONFIG_FILENAME} in ${path3.resolve(rootDir)}`
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
675
|
const raw = readFileSync2(configPath, "utf8");
|
|
@@ -744,7 +744,7 @@ import { stat } from "node:fs/promises";
|
|
|
744
744
|
var fileExists;
|
|
745
745
|
var init_file_exists = __esm({
|
|
746
746
|
"src/config/file-exists.ts"() {
|
|
747
|
-
fileExists = (
|
|
747
|
+
fileExists = (path41) => stat(path41).then(() => true).catch(() => false);
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
750
|
|
|
@@ -986,7 +986,7 @@ var init_landing_manifest = __esm({
|
|
|
986
986
|
});
|
|
987
987
|
|
|
988
988
|
// src/config/local-manifest.ts
|
|
989
|
-
import
|
|
989
|
+
import path4 from "node:path";
|
|
990
990
|
import { z as z4 } from "zod";
|
|
991
991
|
function isPricingEnabled(manifest) {
|
|
992
992
|
return manifest?.pricing?.enabled === true;
|
|
@@ -1036,8 +1036,8 @@ function resolveManifestEnv(viteMode) {
|
|
|
1036
1036
|
return viteMode === "production" ? "production" : "development";
|
|
1037
1037
|
}
|
|
1038
1038
|
function manifestPathsForEnv(rootDir, _env) {
|
|
1039
|
-
const resolvedRoot =
|
|
1040
|
-
const configPath =
|
|
1039
|
+
const resolvedRoot = path4.resolve(rootDir);
|
|
1040
|
+
const configPath = path4.join(resolvedRoot, APITOGO_CONFIG_FILENAME);
|
|
1041
1041
|
return {
|
|
1042
1042
|
basePath: configPath,
|
|
1043
1043
|
overridePath: configPath,
|
|
@@ -1709,7 +1709,7 @@ var init_shadcn_registry = __esm({
|
|
|
1709
1709
|
|
|
1710
1710
|
// src/vite/plugin-theme.ts
|
|
1711
1711
|
import { createRequire } from "node:module";
|
|
1712
|
-
import
|
|
1712
|
+
import path5 from "node:path";
|
|
1713
1713
|
import { normalizeTheme } from "shiki";
|
|
1714
1714
|
var THEME_VARIABLES, uncamelize, processColorValue, generateCss, generateRegistryCss, processCustomCss, MAIN_REPLACE, DEFAULT_THEME_REPLACE, GOOGLE_FONTS, getGoogleFontUrl, processFont, processFontConfig, DEFAULT_FONT_SANS, DEFAULT_FONT_MONO, DEFAULT_FONT_HEADING, processFonts, MODULE_SOURCE_PACKAGES, resolveModuleSourceDirs, virtualModuleId, resolvedVirtualModuleId, viteThemePlugin;
|
|
1715
1715
|
var init_plugin_theme = __esm({
|
|
@@ -1888,7 +1888,7 @@ var init_plugin_theme = __esm({
|
|
|
1888
1888
|
resolveModuleSourceDirs = (config2) => {
|
|
1889
1889
|
if (config2.__meta.mode === "internal") {
|
|
1890
1890
|
return MODULE_SOURCE_PACKAGES.map(
|
|
1891
|
-
(pkg) =>
|
|
1891
|
+
(pkg) => path5.join(
|
|
1892
1892
|
config2.__meta.moduleDir,
|
|
1893
1893
|
"..",
|
|
1894
1894
|
pkg.replace("@lukoweb/apitogo-", ""),
|
|
@@ -1897,12 +1897,12 @@ var init_plugin_theme = __esm({
|
|
|
1897
1897
|
);
|
|
1898
1898
|
}
|
|
1899
1899
|
const require2 = createRequire(
|
|
1900
|
-
|
|
1900
|
+
path5.join(config2.__meta.rootDir, "package.json")
|
|
1901
1901
|
);
|
|
1902
1902
|
const dirs = [];
|
|
1903
1903
|
for (const pkg of MODULE_SOURCE_PACKAGES) {
|
|
1904
1904
|
try {
|
|
1905
|
-
dirs.push(
|
|
1905
|
+
dirs.push(path5.dirname(require2.resolve(pkg)));
|
|
1906
1906
|
} catch {
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
@@ -2028,7 +2028,7 @@ ${rootVars.join("\n")}
|
|
|
2028
2028
|
...config2.__meta.dependencies,
|
|
2029
2029
|
...config2.__pluginDirs ?? [],
|
|
2030
2030
|
...resolveModuleSourceDirs(config2)
|
|
2031
|
-
].map((file) =>
|
|
2031
|
+
].map((file) => path5.relative(path5.dirname(id), file))
|
|
2032
2032
|
);
|
|
2033
2033
|
const code = [...files].map((file) => `@source "${file}";`);
|
|
2034
2034
|
code.push("@theme inline {");
|
|
@@ -4319,7 +4319,7 @@ __export(ZudokuConfig_exports, {
|
|
|
4319
4319
|
ZudokuConfig: () => ZudokuConfig,
|
|
4320
4320
|
validateConfig: () => validateConfig
|
|
4321
4321
|
});
|
|
4322
|
-
import
|
|
4322
|
+
import colors2 from "picocolors";
|
|
4323
4323
|
import { isValidElement as isValidElement2 } from "react";
|
|
4324
4324
|
import { z as z9 } from "zod";
|
|
4325
4325
|
function validateConfig(config2, configPath) {
|
|
@@ -4331,8 +4331,8 @@ function validateConfig(config2, configPath) {
|
|
|
4331
4331
|
${z9.prettifyError(validationResult.error)}`
|
|
4332
4332
|
);
|
|
4333
4333
|
}
|
|
4334
|
-
console.log(
|
|
4335
|
-
console.log(
|
|
4334
|
+
console.log(colors2.yellow("Validation errors:"));
|
|
4335
|
+
console.log(colors2.yellow(z9.prettifyError(validationResult.error)));
|
|
4336
4336
|
}
|
|
4337
4337
|
}
|
|
4338
4338
|
var ThemeSchema, ApiCatalogCategorySchema, LanguageOption, AiAssistantCustomSchema, AiAssistantPresets, AiAssistantsSchema, ApiOptionsSchema, ApiConfigSchema, VersionConfigSchema, ApiSchema, ApiKeysSchema, LogoSchema, FooterSocialIcons, FooterSocialSchema, FooterSchema, SiteMapSchema, DEFAULT_DOCS_FILES, LlmsConfigSchema, DocsConfigSchema, Redirect, SearchSchema, AuthenticationSchema, MetadataSchema, FontConfigSchema, FontsConfigSchema, CssObject, ThemeConfigSchema, SiteSchema, PlacementPosition, HeaderConfigSchema, ApiCatalogSchema, CdnUrlSchema, BaseConfigSchema, ZudokuConfig;
|
|
@@ -4870,8 +4870,8 @@ var init_ZudokuConfig = __esm({
|
|
|
4870
4870
|
|
|
4871
4871
|
// src/config/loader.ts
|
|
4872
4872
|
import { stat as stat2 } from "node:fs/promises";
|
|
4873
|
-
import
|
|
4874
|
-
import
|
|
4873
|
+
import path6 from "node:path";
|
|
4874
|
+
import colors3 from "picocolors";
|
|
4875
4875
|
import {
|
|
4876
4876
|
runnerImport,
|
|
4877
4877
|
loadEnv as viteLoadEnv
|
|
@@ -4890,7 +4890,7 @@ function mergeJsonConfigWithRuntimeOverrides(fileConfig, importedConfig) {
|
|
|
4890
4890
|
}
|
|
4891
4891
|
async function getConfigFilePath(rootDir) {
|
|
4892
4892
|
for (const fileName of zudokuConfigFiles) {
|
|
4893
|
-
const filepath =
|
|
4893
|
+
const filepath = path6.join(rootDir, fileName);
|
|
4894
4894
|
if (await fileExists(filepath)) {
|
|
4895
4895
|
return filepath;
|
|
4896
4896
|
}
|
|
@@ -5053,7 +5053,7 @@ async function loadZudokuConfig(configEnv, rootDir) {
|
|
|
5053
5053
|
};
|
|
5054
5054
|
if (!process.env.APITOGO_JSON_ONLY) {
|
|
5055
5055
|
logger.info(
|
|
5056
|
-
|
|
5056
|
+
colors3.cyan(`loaded config file `) + colors3.dim(config.__meta.configPath),
|
|
5057
5057
|
{ timestamp: true }
|
|
5058
5058
|
);
|
|
5059
5059
|
}
|
|
@@ -5122,8 +5122,8 @@ __export(llms_exports, {
|
|
|
5122
5122
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
5123
5123
|
});
|
|
5124
5124
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
5125
|
-
import
|
|
5126
|
-
import
|
|
5125
|
+
import path28 from "node:path";
|
|
5126
|
+
import colors7 from "picocolors";
|
|
5127
5127
|
async function generateLlmsTxtFiles({
|
|
5128
5128
|
markdownFileInfos,
|
|
5129
5129
|
outputUrls,
|
|
@@ -5157,9 +5157,9 @@ async function generateLlmsTxtFiles({
|
|
|
5157
5157
|
}
|
|
5158
5158
|
}
|
|
5159
5159
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
5160
|
-
await writeFile4(
|
|
5160
|
+
await writeFile4(path28.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
5161
5161
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5162
|
-
console.log(
|
|
5162
|
+
console.log(colors7.blue("\u2713 generated llms.txt"));
|
|
5163
5163
|
}
|
|
5164
5164
|
}
|
|
5165
5165
|
if (llmsTxtFull) {
|
|
@@ -5185,12 +5185,12 @@ ${info.content}
|
|
|
5185
5185
|
}
|
|
5186
5186
|
const llmsFull = llmsFullParts.join("\n");
|
|
5187
5187
|
await writeFile4(
|
|
5188
|
-
|
|
5188
|
+
path28.join(baseOutputDir, "llms-full.txt"),
|
|
5189
5189
|
llmsFull,
|
|
5190
5190
|
"utf-8"
|
|
5191
5191
|
);
|
|
5192
5192
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5193
|
-
console.log(
|
|
5193
|
+
console.log(colors7.blue("\u2713 generated llms-full.txt"));
|
|
5194
5194
|
}
|
|
5195
5195
|
}
|
|
5196
5196
|
}
|
|
@@ -5205,12 +5205,299 @@ import * as Sentry2 from "@sentry/node";
|
|
|
5205
5205
|
import { hideBin } from "yargs/helpers";
|
|
5206
5206
|
import yargs from "yargs/yargs";
|
|
5207
5207
|
|
|
5208
|
+
// src/cli/common/analytics/lib.ts
|
|
5209
|
+
import { PostHog } from "posthog-node";
|
|
5210
|
+
|
|
5211
|
+
// src/cli/common/constants.ts
|
|
5212
|
+
var CLI_XDG_FOLDER_NAME = "apitogo";
|
|
5213
|
+
var VERSION_CHECK_FILE = "version.json";
|
|
5214
|
+
var SENTRY_DSN = void 0;
|
|
5215
|
+
var MAX_WAIT_PENDING_TIME_MS = 1e3;
|
|
5216
|
+
var POST_HOG_CAPTURE_KEY = void 0;
|
|
5217
|
+
var DEPLOY_SERVER_API_KEY = "qRVLTP22TFStdN6";
|
|
5218
|
+
|
|
5219
|
+
// src/cli/common/machine-id/lib.ts
|
|
5220
|
+
import { execSync } from "node:child_process";
|
|
5221
|
+
import { createHash } from "node:crypto";
|
|
5222
|
+
var win32RegBinPath = {
|
|
5223
|
+
skipped: "",
|
|
5224
|
+
native: "%windir%\\System32",
|
|
5225
|
+
mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32"
|
|
5226
|
+
};
|
|
5227
|
+
var guid = {
|
|
5228
|
+
darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
|
|
5229
|
+
win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,
|
|
5230
|
+
linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :"
|
|
5231
|
+
};
|
|
5232
|
+
function isWindowsProcessMixedOrNativeArchitecture() {
|
|
5233
|
+
if (process.platform !== "win32") {
|
|
5234
|
+
return "skipped";
|
|
5235
|
+
}
|
|
5236
|
+
if (process.arch === "ia32" && process.env.PROCESSOR_ARCHITEW6432) {
|
|
5237
|
+
return "mixed";
|
|
5238
|
+
}
|
|
5239
|
+
return "native";
|
|
5240
|
+
}
|
|
5241
|
+
function hash(guid2) {
|
|
5242
|
+
return createHash("sha256").update(guid2).digest("hex");
|
|
5243
|
+
}
|
|
5244
|
+
function expose(result) {
|
|
5245
|
+
switch (process.platform) {
|
|
5246
|
+
case "darwin":
|
|
5247
|
+
return result.split("IOPlatformUUID")[1].split("\n")[0].replace(/=|\s+]"/gi, "").toLowerCase();
|
|
5248
|
+
case "win32":
|
|
5249
|
+
return result.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
5250
|
+
case "linux":
|
|
5251
|
+
return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
5252
|
+
case "freebsd":
|
|
5253
|
+
return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
5254
|
+
default:
|
|
5255
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
function machineId() {
|
|
5259
|
+
switch (process.platform) {
|
|
5260
|
+
case "darwin":
|
|
5261
|
+
case "win32":
|
|
5262
|
+
case "linux":
|
|
5263
|
+
return hash(expose(execSync(guid[process.platform]).toString()));
|
|
5264
|
+
default:
|
|
5265
|
+
return "e16fc483-5593-4d71-b485-a6533693da9b";
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
|
|
5269
|
+
// src/cli/common/analytics/lib.ts
|
|
5270
|
+
var _postHog;
|
|
5271
|
+
function init() {
|
|
5272
|
+
if (process.env.ZUDOKU_DO_NOT_TRACK || !POST_HOG_CAPTURE_KEY) {
|
|
5273
|
+
return void 0;
|
|
5274
|
+
}
|
|
5275
|
+
_postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
|
|
5276
|
+
host: "https://app.posthog.com",
|
|
5277
|
+
flushAt: 1,
|
|
5278
|
+
flushInterval: 1
|
|
5279
|
+
});
|
|
5280
|
+
return _postHog;
|
|
5281
|
+
}
|
|
5282
|
+
async function captureEvent({
|
|
5283
|
+
event,
|
|
5284
|
+
properties,
|
|
5285
|
+
groups,
|
|
5286
|
+
sendFeatureFlags,
|
|
5287
|
+
timestamp,
|
|
5288
|
+
disableGeoip
|
|
5289
|
+
}) {
|
|
5290
|
+
if (_postHog === void 0) {
|
|
5291
|
+
init();
|
|
5292
|
+
}
|
|
5293
|
+
if (_postHog) {
|
|
5294
|
+
properties = properties ?? {};
|
|
5295
|
+
properties.$set_once = properties.$set_once ?? {};
|
|
5296
|
+
if (process.env.CI) {
|
|
5297
|
+
properties.ci = process.env.CI;
|
|
5298
|
+
}
|
|
5299
|
+
_postHog.capture({
|
|
5300
|
+
distinctId: machineId(),
|
|
5301
|
+
event,
|
|
5302
|
+
properties,
|
|
5303
|
+
groups,
|
|
5304
|
+
sendFeatureFlags,
|
|
5305
|
+
timestamp,
|
|
5306
|
+
disableGeoip
|
|
5307
|
+
});
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
5310
|
+
async function shutdownAnalytics() {
|
|
5311
|
+
return _postHog?.shutdown();
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5314
|
+
// src/cli/apply/handler.ts
|
|
5315
|
+
import { access } from "node:fs/promises";
|
|
5316
|
+
import { spawn } from "node:child_process";
|
|
5317
|
+
import path from "node:path";
|
|
5318
|
+
|
|
5319
|
+
// src/cli/common/output.ts
|
|
5320
|
+
import * as Sentry from "@sentry/node";
|
|
5321
|
+
import colors from "picocolors";
|
|
5322
|
+
function printDiagnosticsToConsole(message) {
|
|
5323
|
+
console.error(colors.bold(colors.blue(message)));
|
|
5324
|
+
}
|
|
5325
|
+
function printWarningToConsole(message) {
|
|
5326
|
+
console.error(message);
|
|
5327
|
+
}
|
|
5328
|
+
async function printCriticalFailureToConsoleAndExit(message) {
|
|
5329
|
+
console.error(colors.bold(colors.red(message)));
|
|
5330
|
+
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
5331
|
+
process.exit(1);
|
|
5332
|
+
});
|
|
5333
|
+
}
|
|
5334
|
+
function printJsonOnlyErrorAndExit(message) {
|
|
5335
|
+
console.log(JSON.stringify({ error: message }));
|
|
5336
|
+
process.exit(1);
|
|
5337
|
+
}
|
|
5338
|
+
function printResultToConsole(message) {
|
|
5339
|
+
console.log(colors.bold(colors.green(message)));
|
|
5340
|
+
}
|
|
5341
|
+
function textOrJson(text) {
|
|
5342
|
+
try {
|
|
5343
|
+
return JSON.parse(text);
|
|
5344
|
+
} catch {
|
|
5345
|
+
return text;
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
// src/cli/apply/handler.ts
|
|
5350
|
+
async function pathExists(candidate) {
|
|
5351
|
+
try {
|
|
5352
|
+
await access(candidate);
|
|
5353
|
+
return true;
|
|
5354
|
+
} catch {
|
|
5355
|
+
return false;
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
async function resolveApitogoApplyCommand() {
|
|
5359
|
+
const mcpPath = process.env.APITOGO_MCP_PATH?.trim();
|
|
5360
|
+
if (mcpPath) {
|
|
5361
|
+
const applyJs = path.join(mcpPath, "dist", "cli", "apply.js");
|
|
5362
|
+
if (await pathExists(applyJs)) {
|
|
5363
|
+
return {
|
|
5364
|
+
command: process.execPath,
|
|
5365
|
+
argsPrefix: [applyJs],
|
|
5366
|
+
note: `Using local apitogo-apply from APITOGO_MCP_PATH=${mcpPath}`
|
|
5367
|
+
};
|
|
5368
|
+
}
|
|
5369
|
+
throw new Error(
|
|
5370
|
+
`APITOGO_MCP_PATH is set (${mcpPath}) but dist/cli/apply.js was not found. Run npm run build in the MCP checkout.`
|
|
5371
|
+
);
|
|
5372
|
+
}
|
|
5373
|
+
return {
|
|
5374
|
+
command: "npx",
|
|
5375
|
+
argsPrefix: ["--yes", "--package=@lukoweb/apitogo-mcp", "apitogo-apply"],
|
|
5376
|
+
note: "Using npx @lukoweb/apitogo-mcp (set APITOGO_MCP_PATH for a local checkout)"
|
|
5377
|
+
};
|
|
5378
|
+
}
|
|
5379
|
+
function buildApplyArgs(argv) {
|
|
5380
|
+
const dir = path.resolve(process.cwd(), argv.dir);
|
|
5381
|
+
const args = [dir];
|
|
5382
|
+
if (argv.projectId?.trim()) {
|
|
5383
|
+
args.push("--project-id", argv.projectId.trim());
|
|
5384
|
+
}
|
|
5385
|
+
if (argv.projectName?.trim()) {
|
|
5386
|
+
args.push("--project-name", argv.projectName.trim());
|
|
5387
|
+
}
|
|
5388
|
+
if (argv.platformPlan?.trim()) {
|
|
5389
|
+
args.push("--platform-plan", argv.platformPlan.trim());
|
|
5390
|
+
}
|
|
5391
|
+
if (argv.skipBackend) {
|
|
5392
|
+
args.push("--skip-backend");
|
|
5393
|
+
}
|
|
5394
|
+
if (argv.forceBackendRedeploy) {
|
|
5395
|
+
args.push("--force-backend-redeploy");
|
|
5396
|
+
}
|
|
5397
|
+
if (argv.forceSiteRedeploy) {
|
|
5398
|
+
args.push("--force-site-redeploy");
|
|
5399
|
+
}
|
|
5400
|
+
if (argv.resumeFrom?.trim()) {
|
|
5401
|
+
args.push("--resume-from", argv.resumeFrom.trim());
|
|
5402
|
+
}
|
|
5403
|
+
if (argv.wait === false) {
|
|
5404
|
+
args.push("--no-wait");
|
|
5405
|
+
}
|
|
5406
|
+
if (argv.json) {
|
|
5407
|
+
args.push("--json");
|
|
5408
|
+
}
|
|
5409
|
+
return args;
|
|
5410
|
+
}
|
|
5411
|
+
async function apply(argv) {
|
|
5412
|
+
let resolved;
|
|
5413
|
+
try {
|
|
5414
|
+
resolved = await resolveApitogoApplyCommand();
|
|
5415
|
+
} catch (error) {
|
|
5416
|
+
printCriticalFailureToConsoleAndExit(
|
|
5417
|
+
error instanceof Error ? error.message : String(error)
|
|
5418
|
+
);
|
|
5419
|
+
return;
|
|
5420
|
+
}
|
|
5421
|
+
if (resolved.note && !argv.json) {
|
|
5422
|
+
printDiagnosticsToConsole(resolved.note);
|
|
5423
|
+
}
|
|
5424
|
+
const childArgs = [...resolved.argsPrefix, ...buildApplyArgs(argv)];
|
|
5425
|
+
const exitCode = await new Promise((resolvePromise) => {
|
|
5426
|
+
const child = spawn(resolved.command, childArgs, {
|
|
5427
|
+
stdio: "inherit",
|
|
5428
|
+
env: process.env,
|
|
5429
|
+
shell: process.platform === "win32"
|
|
5430
|
+
});
|
|
5431
|
+
child.on("error", (error) => {
|
|
5432
|
+
printCriticalFailureToConsoleAndExit(
|
|
5433
|
+
`Failed to start apitogo-apply: ${error.message}`
|
|
5434
|
+
);
|
|
5435
|
+
resolvePromise(1);
|
|
5436
|
+
});
|
|
5437
|
+
child.on("close", (code) => {
|
|
5438
|
+
resolvePromise(code ?? 1);
|
|
5439
|
+
});
|
|
5440
|
+
});
|
|
5441
|
+
if (exitCode !== 0) {
|
|
5442
|
+
process.exit(exitCode);
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
|
|
5446
|
+
// src/cli/cmds/apply.ts
|
|
5447
|
+
var apply_default = {
|
|
5448
|
+
desc: "Apply apitogo.config.json to the APItoGo platform (gateway, portal, backend, site)",
|
|
5449
|
+
command: "apply",
|
|
5450
|
+
builder: (yargs2) => yargs2.option("dir", {
|
|
5451
|
+
type: "string",
|
|
5452
|
+
describe: "Site directory containing apitogo.config.json",
|
|
5453
|
+
default: ".",
|
|
5454
|
+
normalize: true
|
|
5455
|
+
}).option("project-id", {
|
|
5456
|
+
type: "string",
|
|
5457
|
+
describe: "Override project GUID"
|
|
5458
|
+
}).option("project-name", {
|
|
5459
|
+
type: "string",
|
|
5460
|
+
describe: "Display name when creating a project"
|
|
5461
|
+
}).option("platform-plan", {
|
|
5462
|
+
type: "string",
|
|
5463
|
+
describe: "Platform hosting tier",
|
|
5464
|
+
choices: ["free", "starter", "professional"]
|
|
5465
|
+
}).option("skip-backend", {
|
|
5466
|
+
type: "boolean",
|
|
5467
|
+
describe: "Skip backend redeploy when healthy",
|
|
5468
|
+
default: false
|
|
5469
|
+
}).option("force-backend-redeploy", {
|
|
5470
|
+
type: "boolean",
|
|
5471
|
+
describe: "Force backend package + deploy",
|
|
5472
|
+
default: false
|
|
5473
|
+
}).option("force-site-redeploy", {
|
|
5474
|
+
type: "boolean",
|
|
5475
|
+
describe: "Force site build + deploy",
|
|
5476
|
+
default: false
|
|
5477
|
+
}).option("resume-from", {
|
|
5478
|
+
type: "string",
|
|
5479
|
+
describe: "Resume publish ledger from step id"
|
|
5480
|
+
}).option("wait", {
|
|
5481
|
+
type: "boolean",
|
|
5482
|
+
describe: "Wait for long-running jobs",
|
|
5483
|
+
default: true
|
|
5484
|
+
}).option("json", {
|
|
5485
|
+
type: "boolean",
|
|
5486
|
+
describe: "Print raw JSON result only",
|
|
5487
|
+
default: false
|
|
5488
|
+
}),
|
|
5489
|
+
handler: async (argv) => {
|
|
5490
|
+
await captureEvent({ argv, event: "apitogo apply" });
|
|
5491
|
+
await apply(argv);
|
|
5492
|
+
}
|
|
5493
|
+
};
|
|
5494
|
+
|
|
5208
5495
|
// src/cli/build/handler.ts
|
|
5209
|
-
import
|
|
5496
|
+
import path32 from "node:path";
|
|
5210
5497
|
|
|
5211
5498
|
// src/vite/build.ts
|
|
5212
5499
|
import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
5213
|
-
import
|
|
5500
|
+
import path30 from "node:path";
|
|
5214
5501
|
import { build as esbuild } from "esbuild";
|
|
5215
5502
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
5216
5503
|
|
|
@@ -5346,9 +5633,9 @@ init_invariant();
|
|
|
5346
5633
|
init_joinUrl();
|
|
5347
5634
|
|
|
5348
5635
|
// src/vite/config.ts
|
|
5349
|
-
import
|
|
5636
|
+
import path25 from "node:path";
|
|
5350
5637
|
import dotenv from "dotenv";
|
|
5351
|
-
import
|
|
5638
|
+
import colors5 from "picocolors";
|
|
5352
5639
|
import {
|
|
5353
5640
|
loadConfigFromFile,
|
|
5354
5641
|
mergeConfig as mergeConfig2
|
|
@@ -5357,7 +5644,7 @@ import {
|
|
|
5357
5644
|
// package.json
|
|
5358
5645
|
var package_default = {
|
|
5359
5646
|
name: "@lukoweb/apitogo",
|
|
5360
|
-
version: "0.1.
|
|
5647
|
+
version: "0.1.68",
|
|
5361
5648
|
type: "module",
|
|
5362
5649
|
sideEffects: [
|
|
5363
5650
|
"**/*.css",
|
|
@@ -5778,24 +6065,24 @@ async function loadDevPortalViteDefines(rootDir, mode) {
|
|
|
5778
6065
|
|
|
5779
6066
|
// src/vite/package-root.ts
|
|
5780
6067
|
init_file_exists();
|
|
5781
|
-
import
|
|
6068
|
+
import path7 from "node:path";
|
|
5782
6069
|
var findPackageRoot = async (startDir) => {
|
|
5783
6070
|
let dir = startDir;
|
|
5784
|
-
while (dir !==
|
|
5785
|
-
if (await fileExists(
|
|
5786
|
-
dir =
|
|
6071
|
+
while (dir !== path7.dirname(dir)) {
|
|
6072
|
+
if (await fileExists(path7.join(dir, "package.json"))) return dir;
|
|
6073
|
+
dir = path7.dirname(dir);
|
|
5787
6074
|
}
|
|
5788
6075
|
};
|
|
5789
6076
|
|
|
5790
6077
|
// src/vite/pagefind-dev-stub.ts
|
|
5791
6078
|
import fs from "node:fs/promises";
|
|
5792
|
-
import
|
|
6079
|
+
import path8 from "node:path";
|
|
5793
6080
|
var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
|
|
5794
6081
|
async function ensurePagefindDevStub(publicDir) {
|
|
5795
|
-
const pagefindPath =
|
|
6082
|
+
const pagefindPath = path8.join(publicDir, "pagefind/pagefind.js");
|
|
5796
6083
|
const exists = await fs.stat(pagefindPath).catch(() => false);
|
|
5797
6084
|
if (!exists) {
|
|
5798
|
-
await fs.mkdir(
|
|
6085
|
+
await fs.mkdir(path8.dirname(pagefindPath), { recursive: true });
|
|
5799
6086
|
await fs.writeFile(pagefindPath, NOT_BUILT_YET);
|
|
5800
6087
|
}
|
|
5801
6088
|
}
|
|
@@ -5807,7 +6094,7 @@ import react from "@vitejs/plugin-react";
|
|
|
5807
6094
|
// src/vite/css/plugin.ts
|
|
5808
6095
|
init_loader();
|
|
5809
6096
|
init_plugin_theme();
|
|
5810
|
-
import
|
|
6097
|
+
import path9 from "node:path";
|
|
5811
6098
|
import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
5812
6099
|
|
|
5813
6100
|
// src/vite/css/collect.ts
|
|
@@ -5842,7 +6129,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
|
5842
6129
|
function vitePluginSsrCss(pluginOpts) {
|
|
5843
6130
|
let server;
|
|
5844
6131
|
const config2 = getCurrentConfig();
|
|
5845
|
-
const virtualHref =
|
|
6132
|
+
const virtualHref = path9.join(
|
|
5846
6133
|
config2.basePath ?? "",
|
|
5847
6134
|
`/@id/__x00__${VIRTUAL_ENTRY}?direct`
|
|
5848
6135
|
);
|
|
@@ -5979,7 +6266,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
|
|
|
5979
6266
|
|
|
5980
6267
|
// src/vite/plugin-api.ts
|
|
5981
6268
|
import fs3 from "node:fs/promises";
|
|
5982
|
-
import
|
|
6269
|
+
import path15 from "node:path";
|
|
5983
6270
|
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
5984
6271
|
import { runnerImport as runnerImport3 } from "vite";
|
|
5985
6272
|
init_package_json();
|
|
@@ -5988,7 +6275,7 @@ init_loader();
|
|
|
5988
6275
|
// src/config/validators/BuildSchema.ts
|
|
5989
6276
|
init_file_exists();
|
|
5990
6277
|
init_loader();
|
|
5991
|
-
import
|
|
6278
|
+
import path10 from "node:path";
|
|
5992
6279
|
import { runnerImport as runnerImport2 } from "vite";
|
|
5993
6280
|
import { z as z10 } from "zod";
|
|
5994
6281
|
var BuildProcessorSchema = z10.custom((val) => typeof val === "function");
|
|
@@ -6017,7 +6304,7 @@ var buildConfigFiles = [
|
|
|
6017
6304
|
];
|
|
6018
6305
|
async function getBuildConfigFilePath(rootDir) {
|
|
6019
6306
|
for (const fileName of buildConfigFiles) {
|
|
6020
|
-
const filepath =
|
|
6307
|
+
const filepath = path10.join(rootDir, fileName);
|
|
6021
6308
|
if (await fileExists(filepath)) {
|
|
6022
6309
|
return filepath;
|
|
6023
6310
|
}
|
|
@@ -6126,14 +6413,14 @@ var flattenAllOf = (schema2) => {
|
|
|
6126
6413
|
};
|
|
6127
6414
|
|
|
6128
6415
|
// src/lib/util/traverse.ts
|
|
6129
|
-
var traverse = (specification, transform,
|
|
6130
|
-
const transformed = transform(specification,
|
|
6416
|
+
var traverse = (specification, transform, path41 = []) => {
|
|
6417
|
+
const transformed = transform(specification, path41);
|
|
6131
6418
|
if (typeof transformed !== "object" || transformed === null) {
|
|
6132
6419
|
return transformed;
|
|
6133
6420
|
}
|
|
6134
6421
|
const result = Array.isArray(transformed) ? [] : {};
|
|
6135
6422
|
for (const [key, value] of Object.entries(transformed)) {
|
|
6136
|
-
const currentPath = [...
|
|
6423
|
+
const currentPath = [...path41, key];
|
|
6137
6424
|
if (Array.isArray(value)) {
|
|
6138
6425
|
result[key] = value.map(
|
|
6139
6426
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -6161,9 +6448,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
6161
6448
|
if (schemaCache?.has(ref)) {
|
|
6162
6449
|
return schemaCache.get(ref);
|
|
6163
6450
|
}
|
|
6164
|
-
const
|
|
6451
|
+
const path41 = ref.split("/").slice(1);
|
|
6165
6452
|
let current = schema2;
|
|
6166
|
-
for (const segment of
|
|
6453
|
+
for (const segment of path41) {
|
|
6167
6454
|
if (!current || typeof current !== "object") {
|
|
6168
6455
|
current = null;
|
|
6169
6456
|
}
|
|
@@ -6182,7 +6469,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6182
6469
|
}
|
|
6183
6470
|
const cloned = structuredClone(schema2);
|
|
6184
6471
|
const visited = /* @__PURE__ */ new Set();
|
|
6185
|
-
const resolve = async (current,
|
|
6472
|
+
const resolve = async (current, path41) => {
|
|
6186
6473
|
if (isIndexableObject(current)) {
|
|
6187
6474
|
if (visited.has(current)) {
|
|
6188
6475
|
return CIRCULAR_REF;
|
|
@@ -6190,7 +6477,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6190
6477
|
visited.add(current);
|
|
6191
6478
|
if (Array.isArray(current)) {
|
|
6192
6479
|
for (let index = 0; index < current.length; index++) {
|
|
6193
|
-
current[index] = await resolve(current[index], `${
|
|
6480
|
+
current[index] = await resolve(current[index], `${path41}/${index}`);
|
|
6194
6481
|
}
|
|
6195
6482
|
} else {
|
|
6196
6483
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -6201,13 +6488,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6201
6488
|
for (const resolver of resolvers) {
|
|
6202
6489
|
const resolved = await resolver($ref);
|
|
6203
6490
|
if (resolved) {
|
|
6204
|
-
result2 = await resolve(resolved,
|
|
6491
|
+
result2 = await resolve(resolved, path41);
|
|
6205
6492
|
break;
|
|
6206
6493
|
}
|
|
6207
6494
|
}
|
|
6208
6495
|
if (result2 === void 0) {
|
|
6209
6496
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
6210
|
-
result2 = await resolve(resolved,
|
|
6497
|
+
result2 = await resolve(resolved, path41);
|
|
6211
6498
|
}
|
|
6212
6499
|
if (hasSiblings) {
|
|
6213
6500
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -6220,7 +6507,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6220
6507
|
return result2;
|
|
6221
6508
|
}
|
|
6222
6509
|
for (const key in current) {
|
|
6223
|
-
current[key] = await resolve(current[key], `${
|
|
6510
|
+
current[key] = await resolve(current[key], `${path41}/${key}`);
|
|
6224
6511
|
}
|
|
6225
6512
|
}
|
|
6226
6513
|
visited.delete(current);
|
|
@@ -6259,9 +6546,9 @@ var upgradeSchema = (schema2) => {
|
|
|
6259
6546
|
}
|
|
6260
6547
|
return sub;
|
|
6261
6548
|
});
|
|
6262
|
-
schema2 = traverse(schema2, (sub,
|
|
6549
|
+
schema2 = traverse(schema2, (sub, path41) => {
|
|
6263
6550
|
if (sub.example !== void 0) {
|
|
6264
|
-
if (isSchemaPath(
|
|
6551
|
+
if (isSchemaPath(path41 ?? [])) {
|
|
6265
6552
|
sub.examples = [sub.example];
|
|
6266
6553
|
} else {
|
|
6267
6554
|
sub.examples = {
|
|
@@ -6274,11 +6561,11 @@ var upgradeSchema = (schema2) => {
|
|
|
6274
6561
|
}
|
|
6275
6562
|
return sub;
|
|
6276
6563
|
});
|
|
6277
|
-
schema2 = traverse(schema2, (schema3,
|
|
6564
|
+
schema2 = traverse(schema2, (schema3, path41) => {
|
|
6278
6565
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
6279
|
-
const parentPath =
|
|
6566
|
+
const parentPath = path41?.slice(0, -1);
|
|
6280
6567
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
6281
|
-
return segment === "content" &&
|
|
6568
|
+
return segment === "content" && path41?.[index + 1] === "multipart/form-data";
|
|
6282
6569
|
});
|
|
6283
6570
|
if (isMultipart) {
|
|
6284
6571
|
const entries = Object.entries(schema3.properties);
|
|
@@ -6292,8 +6579,8 @@ var upgradeSchema = (schema2) => {
|
|
|
6292
6579
|
}
|
|
6293
6580
|
return schema3;
|
|
6294
6581
|
});
|
|
6295
|
-
schema2 = traverse(schema2, (schema3,
|
|
6296
|
-
if (
|
|
6582
|
+
schema2 = traverse(schema2, (schema3, path41) => {
|
|
6583
|
+
if (path41?.includes("content") && path41.includes("application/octet-stream")) {
|
|
6297
6584
|
return {};
|
|
6298
6585
|
}
|
|
6299
6586
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -6319,11 +6606,11 @@ var upgradeSchema = (schema2) => {
|
|
|
6319
6606
|
}
|
|
6320
6607
|
return sub;
|
|
6321
6608
|
});
|
|
6322
|
-
schema2 = traverse(schema2, (schema3,
|
|
6609
|
+
schema2 = traverse(schema2, (schema3, path41) => {
|
|
6323
6610
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
6324
|
-
const parentPath =
|
|
6611
|
+
const parentPath = path41?.slice(0, -1);
|
|
6325
6612
|
const contentMediaType = parentPath?.find(
|
|
6326
|
-
(_, index) =>
|
|
6613
|
+
(_, index) => path41?.[index - 1] === "content"
|
|
6327
6614
|
);
|
|
6328
6615
|
return {
|
|
6329
6616
|
type: "string",
|
|
@@ -6335,7 +6622,7 @@ var upgradeSchema = (schema2) => {
|
|
|
6335
6622
|
});
|
|
6336
6623
|
return schema2;
|
|
6337
6624
|
};
|
|
6338
|
-
function isSchemaPath(
|
|
6625
|
+
function isSchemaPath(path41) {
|
|
6339
6626
|
const schemaLocations = [
|
|
6340
6627
|
["components", "schemas"],
|
|
6341
6628
|
"properties",
|
|
@@ -6348,10 +6635,10 @@ function isSchemaPath(path40) {
|
|
|
6348
6635
|
];
|
|
6349
6636
|
return schemaLocations.some((location) => {
|
|
6350
6637
|
if (Array.isArray(location)) {
|
|
6351
|
-
return location.every((segment, index) =>
|
|
6638
|
+
return location.every((segment, index) => path41[index] === segment);
|
|
6352
6639
|
}
|
|
6353
|
-
return
|
|
6354
|
-
}) ||
|
|
6640
|
+
return path41.includes(location);
|
|
6641
|
+
}) || path41.includes("schema") || path41.some((segment) => segment.endsWith("Schema"));
|
|
6355
6642
|
}
|
|
6356
6643
|
|
|
6357
6644
|
// src/lib/oas/parser/index.ts
|
|
@@ -6433,13 +6720,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
6433
6720
|
"anyOf",
|
|
6434
6721
|
"oneOf"
|
|
6435
6722
|
]);
|
|
6436
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
6723
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path41 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
6437
6724
|
if (obj === null || typeof obj !== "object") return obj;
|
|
6438
6725
|
const refPath = obj.__$ref;
|
|
6439
6726
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
6440
6727
|
if (isCircular) {
|
|
6441
6728
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
6442
|
-
const circularProp =
|
|
6729
|
+
const circularProp = path41.find((p) => !OPENAPI_PROPS.has(p)) || path41[0];
|
|
6443
6730
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
6444
6731
|
}
|
|
6445
6732
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -6449,7 +6736,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
6449
6736
|
value,
|
|
6450
6737
|
currentPath,
|
|
6451
6738
|
refs,
|
|
6452
|
-
[...
|
|
6739
|
+
[...path41, key],
|
|
6453
6740
|
currentRefPaths
|
|
6454
6741
|
);
|
|
6455
6742
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -6484,7 +6771,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
6484
6771
|
var getAllTags = (schema2) => {
|
|
6485
6772
|
const rootTags = schema2.tags ?? [];
|
|
6486
6773
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
6487
|
-
(
|
|
6774
|
+
(path41) => HttpMethods.map((k) => path41?.[k]).filter((op) => op != null)
|
|
6488
6775
|
);
|
|
6489
6776
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
6490
6777
|
const hasUntaggedOperations = operations.some(
|
|
@@ -6539,7 +6826,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
6539
6826
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
6540
6827
|
var getAllOperations = (paths) => {
|
|
6541
6828
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
6542
|
-
([
|
|
6829
|
+
([path41, value]) => HttpMethods.flatMap((method) => {
|
|
6543
6830
|
if (!value?.[method]) return [];
|
|
6544
6831
|
const operation = value[method];
|
|
6545
6832
|
const pathParameters = value.parameters ?? [];
|
|
@@ -6559,7 +6846,7 @@ var getAllOperations = (paths) => {
|
|
|
6559
6846
|
return {
|
|
6560
6847
|
...operation,
|
|
6561
6848
|
method,
|
|
6562
|
-
path:
|
|
6849
|
+
path: path41,
|
|
6563
6850
|
parameters,
|
|
6564
6851
|
servers,
|
|
6565
6852
|
tags: operation.tags ?? []
|
|
@@ -6917,8 +7204,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
6917
7204
|
}),
|
|
6918
7205
|
paths: t.field({
|
|
6919
7206
|
type: [PathItem],
|
|
6920
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
6921
|
-
path:
|
|
7207
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path41, value]) => ({
|
|
7208
|
+
path: path41,
|
|
6922
7209
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
6923
7210
|
methods: Object.keys(value)
|
|
6924
7211
|
}))
|
|
@@ -7013,7 +7300,7 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
7013
7300
|
|
|
7014
7301
|
// src/vite/api/SchemaManager.ts
|
|
7015
7302
|
import fs2 from "node:fs/promises";
|
|
7016
|
-
import
|
|
7303
|
+
import path11 from "node:path";
|
|
7017
7304
|
import {
|
|
7018
7305
|
$RefParser as $RefParser2
|
|
7019
7306
|
} from "@apidevtools/json-schema-ref-parser";
|
|
@@ -7065,7 +7352,7 @@ init_joinUrl();
|
|
|
7065
7352
|
|
|
7066
7353
|
// src/vite/api/schema-codegen.ts
|
|
7067
7354
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
7068
|
-
var getSegmentsFromPath = (
|
|
7355
|
+
var getSegmentsFromPath = (path41) => path41.split("/").slice(1).map(unescapeJsonPointer);
|
|
7069
7356
|
var createLocalRefMap = (obj) => {
|
|
7070
7357
|
const refMap = /* @__PURE__ */ new Map();
|
|
7071
7358
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -7096,16 +7383,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
7096
7383
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
7097
7384
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
7098
7385
|
);
|
|
7099
|
-
var lookup = (schema2,
|
|
7100
|
-
const parts = getSegmentsFromPath(
|
|
7386
|
+
var lookup = (schema2, path41, filePath) => {
|
|
7387
|
+
const parts = getSegmentsFromPath(path41);
|
|
7101
7388
|
let val = schema2;
|
|
7102
7389
|
for (const part of parts) {
|
|
7103
7390
|
while (val.$ref?.startsWith("#/")) {
|
|
7104
|
-
val = val.$ref ===
|
|
7391
|
+
val = val.$ref === path41 ? val : lookup(schema2, val.$ref, filePath);
|
|
7105
7392
|
}
|
|
7106
7393
|
if (val[part] === void 0) {
|
|
7107
7394
|
throw new Error(
|
|
7108
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
7395
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path41}`
|
|
7109
7396
|
);
|
|
7110
7397
|
}
|
|
7111
7398
|
val = val[part];
|
|
@@ -7203,18 +7490,18 @@ var SchemaManager = class {
|
|
|
7203
7490
|
];
|
|
7204
7491
|
}
|
|
7205
7492
|
getPathForFile = (input, params) => {
|
|
7206
|
-
const filePath =
|
|
7493
|
+
const filePath = path11.resolve(this.config.__meta.rootDir, input);
|
|
7207
7494
|
const apis = ensureArray(this.config.apis ?? []);
|
|
7208
7495
|
for (const apiConfig of apis) {
|
|
7209
7496
|
if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
|
|
7210
7497
|
const match = normalizeInputs(apiConfig.input).some(
|
|
7211
|
-
(i) =>
|
|
7498
|
+
(i) => path11.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
|
|
7212
7499
|
);
|
|
7213
7500
|
if (match) return apiConfig.path;
|
|
7214
7501
|
}
|
|
7215
7502
|
};
|
|
7216
7503
|
processSchema = async (input) => {
|
|
7217
|
-
const filePath =
|
|
7504
|
+
const filePath = path11.resolve(this.config.__meta.rootDir, input.input);
|
|
7218
7505
|
const params = input.params;
|
|
7219
7506
|
const configuredPath = this.getPathForFile(input.input, params);
|
|
7220
7507
|
if (!configuredPath) {
|
|
@@ -7250,9 +7537,9 @@ var SchemaManager = class {
|
|
|
7250
7537
|
const processedTime = Date.now();
|
|
7251
7538
|
const code = generateCode(processedSchema, filePath);
|
|
7252
7539
|
const prefixPath = slugify(configuredPath);
|
|
7253
|
-
const processedFilePath =
|
|
7540
|
+
const processedFilePath = path11.posix.join(
|
|
7254
7541
|
this.storeDir,
|
|
7255
|
-
`${prefixPath}-${
|
|
7542
|
+
`${prefixPath}-${path11.basename(filePath)}${paramsSuffix(params)}.js`
|
|
7256
7543
|
);
|
|
7257
7544
|
const importKey = processedFilePath;
|
|
7258
7545
|
await fs2.writeFile(processedFilePath, code);
|
|
@@ -7301,7 +7588,7 @@ var SchemaManager = class {
|
|
|
7301
7588
|
};
|
|
7302
7589
|
getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
|
|
7303
7590
|
getFilesToReprocess = (changedFile) => {
|
|
7304
|
-
const resolvedPath =
|
|
7591
|
+
const resolvedPath = path11.resolve(this.config.__meta.rootDir, changedFile);
|
|
7305
7592
|
const referencedBy = this.referencedBy.get(resolvedPath);
|
|
7306
7593
|
if (!referencedBy) return [];
|
|
7307
7594
|
const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
|
|
@@ -7330,7 +7617,7 @@ var SchemaManager = class {
|
|
|
7330
7617
|
version: "",
|
|
7331
7618
|
path: input.path ?? "",
|
|
7332
7619
|
label: input.label,
|
|
7333
|
-
inputPath:
|
|
7620
|
+
inputPath: path11.resolve(this.config.__meta.rootDir, input.input),
|
|
7334
7621
|
params: input.params,
|
|
7335
7622
|
importKey: "",
|
|
7336
7623
|
downloadUrl: "",
|
|
@@ -7350,8 +7637,8 @@ var SchemaManager = class {
|
|
|
7350
7637
|
}
|
|
7351
7638
|
}
|
|
7352
7639
|
};
|
|
7353
|
-
getLatestSchema = (
|
|
7354
|
-
getSchemasForPath = (
|
|
7640
|
+
getLatestSchema = (path41) => this.processedSchemas[path41]?.at(0);
|
|
7641
|
+
getSchemasForPath = (path41) => this.processedSchemas[path41];
|
|
7355
7642
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
7356
7643
|
getUrlToFilePathMap = () => {
|
|
7357
7644
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -7373,7 +7660,7 @@ var SchemaManager = class {
|
|
|
7373
7660
|
};
|
|
7374
7661
|
createSchemaPath = (inputPath, versionPath, apiPath, params) => {
|
|
7375
7662
|
const suffix = paramsSuffix(params);
|
|
7376
|
-
const extension = suffix ? ".json" :
|
|
7663
|
+
const extension = suffix ? ".json" : path11.extname(inputPath);
|
|
7377
7664
|
return joinUrl(
|
|
7378
7665
|
this.config.basePath,
|
|
7379
7666
|
apiPath,
|
|
@@ -7396,8 +7683,8 @@ var SchemaManager = class {
|
|
|
7396
7683
|
// src/vite/plugin-config-reload.ts
|
|
7397
7684
|
init_logger();
|
|
7398
7685
|
init_loader();
|
|
7399
|
-
import
|
|
7400
|
-
import
|
|
7686
|
+
import path14 from "node:path";
|
|
7687
|
+
import colors4 from "picocolors";
|
|
7401
7688
|
|
|
7402
7689
|
// src/vite/plugin-navigation.ts
|
|
7403
7690
|
init_loader();
|
|
@@ -7406,7 +7693,7 @@ import { stringify as stringify3 } from "javascript-stringify";
|
|
|
7406
7693
|
import { isElement } from "react-is";
|
|
7407
7694
|
|
|
7408
7695
|
// src/config/validators/NavigationSchema.ts
|
|
7409
|
-
import
|
|
7696
|
+
import path12 from "node:path";
|
|
7410
7697
|
import { glob } from "glob";
|
|
7411
7698
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
7412
7699
|
import { mdxFromMarkdown } from "mdast-util-mdx";
|
|
@@ -7457,7 +7744,7 @@ var extractRichH1 = (content) => {
|
|
|
7457
7744
|
}
|
|
7458
7745
|
};
|
|
7459
7746
|
var isNavigationItem = (item) => item !== void 0;
|
|
7460
|
-
var toPosixPath = (filePath) => filePath.split(
|
|
7747
|
+
var toPosixPath = (filePath) => filePath.split(path12.win32.sep).join(path12.posix.sep);
|
|
7461
7748
|
var NavigationResolver = class {
|
|
7462
7749
|
rootDir;
|
|
7463
7750
|
globPatterns;
|
|
@@ -7590,13 +7877,13 @@ init_invariant();
|
|
|
7590
7877
|
|
|
7591
7878
|
// src/vite/debug.ts
|
|
7592
7879
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
7593
|
-
import
|
|
7880
|
+
import path13 from "node:path";
|
|
7594
7881
|
async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
|
|
7595
7882
|
if (process.env.ZUDOKU_BUILD_DEBUG) {
|
|
7596
|
-
const debugDir =
|
|
7883
|
+
const debugDir = path13.join(rootDir, "dist", "debug");
|
|
7597
7884
|
await mkdir(debugDir, { recursive: true });
|
|
7598
7885
|
await writeFile(
|
|
7599
|
-
|
|
7886
|
+
path13.join(debugDir, `${pluginName}.${extension}`),
|
|
7600
7887
|
typeof code === "string" ? code : code.join("\n")
|
|
7601
7888
|
);
|
|
7602
7889
|
}
|
|
@@ -7704,8 +7991,8 @@ var viteConfigReloadPlugin = () => ({
|
|
|
7704
7991
|
invalidate(server);
|
|
7705
7992
|
reload(server);
|
|
7706
7993
|
logger.info(
|
|
7707
|
-
|
|
7708
|
-
`Config ${
|
|
7994
|
+
colors4.blue(
|
|
7995
|
+
`Config ${path14.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
7709
7996
|
),
|
|
7710
7997
|
{ timestamp: true }
|
|
7711
7998
|
);
|
|
@@ -7719,11 +8006,11 @@ var viteApiPlugin = async () => {
|
|
|
7719
8006
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7720
8007
|
const initialConfig = getCurrentConfig();
|
|
7721
8008
|
const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
|
|
7722
|
-
|
|
8009
|
+
path15.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
|
|
7723
8010
|
).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
|
|
7724
8011
|
const buildConfig = await getBuildConfig();
|
|
7725
8012
|
const buildProcessors = buildConfig?.processors ?? [];
|
|
7726
|
-
const tmpStoreDir =
|
|
8013
|
+
const tmpStoreDir = path15.posix.join(
|
|
7727
8014
|
initialConfig.__meta.rootDir,
|
|
7728
8015
|
"node_modules/.apitogo/processed"
|
|
7729
8016
|
);
|
|
@@ -7751,7 +8038,7 @@ var viteApiPlugin = async () => {
|
|
|
7751
8038
|
const inputPath = pathMap.get(req.url);
|
|
7752
8039
|
if (!inputPath) return next();
|
|
7753
8040
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
7754
|
-
const mimeType =
|
|
8041
|
+
const mimeType = path15.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
|
|
7755
8042
|
res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
|
|
7756
8043
|
return res.end(content);
|
|
7757
8044
|
});
|
|
@@ -7939,8 +8226,8 @@ var viteApiPlugin = async () => {
|
|
|
7939
8226
|
if (process.env.NODE_ENV !== "production") return;
|
|
7940
8227
|
for (const [urlPath, inputPath] of pathMap) {
|
|
7941
8228
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
7942
|
-
const outputPath =
|
|
7943
|
-
await fs3.mkdir(
|
|
8229
|
+
const outputPath = path15.join(config2.__meta.rootDir, "dist", urlPath);
|
|
8230
|
+
await fs3.mkdir(path15.dirname(outputPath), { recursive: true });
|
|
7944
8231
|
await fs3.writeFile(outputPath, content, "utf-8");
|
|
7945
8232
|
}
|
|
7946
8233
|
}
|
|
@@ -7983,7 +8270,7 @@ var plugin_auth_default = viteAuthPlugin;
|
|
|
7983
8270
|
|
|
7984
8271
|
// src/vite/plugin-component.ts
|
|
7985
8272
|
init_loader();
|
|
7986
|
-
import
|
|
8273
|
+
import path16 from "node:path";
|
|
7987
8274
|
var viteAliasPlugin = () => {
|
|
7988
8275
|
return {
|
|
7989
8276
|
name: "zudoku-component-plugin",
|
|
@@ -8011,7 +8298,7 @@ var viteAliasPlugin = () => {
|
|
|
8011
8298
|
];
|
|
8012
8299
|
const aliases = replacements.map(([find, replacement]) => ({
|
|
8013
8300
|
find,
|
|
8014
|
-
replacement:
|
|
8301
|
+
replacement: path16.posix.join(config2.__meta.moduleDir, replacement)
|
|
8015
8302
|
}));
|
|
8016
8303
|
return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
|
|
8017
8304
|
}
|
|
@@ -8022,11 +8309,11 @@ var plugin_component_default = viteAliasPlugin;
|
|
|
8022
8309
|
// src/vite/plugin-config.ts
|
|
8023
8310
|
init_package_json();
|
|
8024
8311
|
init_loader();
|
|
8025
|
-
import
|
|
8312
|
+
import path17 from "node:path";
|
|
8026
8313
|
import { normalizePath } from "vite";
|
|
8027
8314
|
var virtualModuleId3 = "virtual:zudoku-config";
|
|
8028
8315
|
var resolvedVirtualModuleId3 = `\0${virtualModuleId3}`;
|
|
8029
|
-
var browserConfigLoaderPath =
|
|
8316
|
+
var browserConfigLoaderPath = path17.join(
|
|
8030
8317
|
getZudokuRootDir(),
|
|
8031
8318
|
"src/config/apitogo-config-loader.browser.ts"
|
|
8032
8319
|
);
|
|
@@ -8086,8 +8373,11 @@ import { runPluginTransformConfig } from "@lukoweb/apitogo/plugins";
|
|
|
8086
8373
|
|
|
8087
8374
|
const embeddedConfig = ${serializeClientConfig(loadedConfig)};
|
|
8088
8375
|
|
|
8376
|
+
// JSON embedding drops Symbol values (React element's $$typeof). Prefer live
|
|
8377
|
+
// navigation/plugins from the TSX module so custom-page elements stay valid.
|
|
8089
8378
|
const config = await runPluginTransformConfig({
|
|
8090
8379
|
...embeddedConfig,
|
|
8380
|
+
navigation: rawConfig?.navigation ?? embeddedConfig.navigation,
|
|
8091
8381
|
plugins: rawConfig?.plugins ?? embeddedConfig.plugins ?? [],
|
|
8092
8382
|
__meta: ${JSON.stringify(clientMeta)},
|
|
8093
8383
|
});
|
|
@@ -8193,7 +8483,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
8193
8483
|
|
|
8194
8484
|
// src/vite/plugin-docs.ts
|
|
8195
8485
|
init_loader();
|
|
8196
|
-
import
|
|
8486
|
+
import path18 from "node:path";
|
|
8197
8487
|
import { glob as glob3 } from "glob";
|
|
8198
8488
|
import globParent from "glob-parent";
|
|
8199
8489
|
init_ZudokuConfig();
|
|
@@ -8262,7 +8552,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
8262
8552
|
if (process.env.NODE_ENV !== "development") {
|
|
8263
8553
|
const draftStatuses = await Promise.all(
|
|
8264
8554
|
globbedFiles.map(async (file) => {
|
|
8265
|
-
const absolutePath =
|
|
8555
|
+
const absolutePath = path18.resolve(config2.__meta.rootDir, file);
|
|
8266
8556
|
const { data } = await readFrontmatter(absolutePath);
|
|
8267
8557
|
return { file, isDraft: data.draft === true };
|
|
8268
8558
|
})
|
|
@@ -8275,9 +8565,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
8275
8565
|
if (draftFiles.has(file)) {
|
|
8276
8566
|
continue;
|
|
8277
8567
|
}
|
|
8278
|
-
const relativePath =
|
|
8568
|
+
const relativePath = path18.posix.relative(parent, file);
|
|
8279
8569
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
8280
|
-
const filePath = options.absolute ?
|
|
8570
|
+
const filePath = options.absolute ? path18.resolve(config2.__meta.rootDir, file) : file;
|
|
8281
8571
|
fileMapping[routePath] = filePath;
|
|
8282
8572
|
}
|
|
8283
8573
|
}
|
|
@@ -8341,7 +8631,7 @@ var viteDocsPlugin = () => {
|
|
|
8341
8631
|
const globbedDocuments = {};
|
|
8342
8632
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
8343
8633
|
const importPath = ensureLeadingSlash(
|
|
8344
|
-
|
|
8634
|
+
path18.posix.join(globImportBasePath, file)
|
|
8345
8635
|
);
|
|
8346
8636
|
globbedDocuments[routePath] = importPath;
|
|
8347
8637
|
}
|
|
@@ -8367,7 +8657,7 @@ var plugin_docs_default = viteDocsPlugin;
|
|
|
8367
8657
|
// src/vite/plugin-local-manifest.ts
|
|
8368
8658
|
init_apitogo_config_loader();
|
|
8369
8659
|
init_local_manifest();
|
|
8370
|
-
import
|
|
8660
|
+
import path19 from "node:path";
|
|
8371
8661
|
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
8372
8662
|
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
8373
8663
|
var viteLocalManifestPlugin = () => {
|
|
@@ -8417,8 +8707,8 @@ var viteLocalManifestPlugin = () => {
|
|
|
8417
8707
|
server.watcher.add(watchPath);
|
|
8418
8708
|
}
|
|
8419
8709
|
server.watcher.on("change", async (changedPath) => {
|
|
8420
|
-
const resolvedChanged =
|
|
8421
|
-
if (!watchPaths.some((p) =>
|
|
8710
|
+
const resolvedChanged = path19.resolve(changedPath);
|
|
8711
|
+
if (!watchPaths.some((p) => path19.resolve(p) === resolvedChanged)) {
|
|
8422
8712
|
return;
|
|
8423
8713
|
}
|
|
8424
8714
|
const module = server.moduleGraph.getModuleById(
|
|
@@ -8445,7 +8735,7 @@ init_loader();
|
|
|
8445
8735
|
init_ProtectedRoutesSchema();
|
|
8446
8736
|
init_joinUrl();
|
|
8447
8737
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
8448
|
-
import
|
|
8738
|
+
import path20 from "node:path";
|
|
8449
8739
|
import { matchPath } from "react-router";
|
|
8450
8740
|
var processMarkdownFile = async (filePath) => {
|
|
8451
8741
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -8533,7 +8823,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
8533
8823
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
8534
8824
|
return;
|
|
8535
8825
|
}
|
|
8536
|
-
const distDir =
|
|
8826
|
+
const distDir = path20.join(
|
|
8537
8827
|
config2.__meta.rootDir,
|
|
8538
8828
|
"dist",
|
|
8539
8829
|
config2.basePath ?? ""
|
|
@@ -8554,15 +8844,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
8554
8844
|
content: finalMarkdown
|
|
8555
8845
|
});
|
|
8556
8846
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
8557
|
-
const outputPath = `${
|
|
8558
|
-
await mkdir2(
|
|
8847
|
+
const outputPath = `${path20.join(distDir, ...segments)}.md`;
|
|
8848
|
+
await mkdir2(path20.dirname(outputPath), { recursive: true });
|
|
8559
8849
|
await writeFile2(outputPath, finalMarkdown, "utf-8");
|
|
8560
8850
|
} catch (error) {
|
|
8561
8851
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
8562
8852
|
}
|
|
8563
8853
|
}
|
|
8564
8854
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
8565
|
-
const markdownInfoPath =
|
|
8855
|
+
const markdownInfoPath = path20.join(
|
|
8566
8856
|
config2.__meta.rootDir,
|
|
8567
8857
|
"node_modules/.apitogo/markdown-info.json"
|
|
8568
8858
|
);
|
|
@@ -8714,9 +9004,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
8714
9004
|
};
|
|
8715
9005
|
|
|
8716
9006
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
8717
|
-
import
|
|
9007
|
+
import path21 from "node:path";
|
|
8718
9008
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
8719
|
-
const relativePath =
|
|
9009
|
+
const relativePath = path21.relative(rootDir, vfile.path).split(path21.sep).join(path21.posix.sep);
|
|
8720
9010
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
8721
9011
|
};
|
|
8722
9012
|
|
|
@@ -8803,18 +9093,18 @@ var remarkLastModified = () => {
|
|
|
8803
9093
|
};
|
|
8804
9094
|
|
|
8805
9095
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
8806
|
-
import
|
|
9096
|
+
import path22 from "node:path";
|
|
8807
9097
|
import { visit as visit5 } from "unist-util-visit";
|
|
8808
9098
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
8809
9099
|
visit5(tree, "link", (node) => {
|
|
8810
9100
|
if (!node.url) return;
|
|
8811
9101
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
8812
9102
|
node.url = node.url.replace(/\\/g, "/");
|
|
8813
|
-
const base =
|
|
9103
|
+
const base = path22.posix.join(basePath);
|
|
8814
9104
|
if (basePath && node.url.startsWith(base)) {
|
|
8815
9105
|
node.url = node.url.slice(base.length);
|
|
8816
9106
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
8817
|
-
node.url =
|
|
9107
|
+
node.url = path22.posix.join("..", node.url);
|
|
8818
9108
|
}
|
|
8819
9109
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
8820
9110
|
});
|
|
@@ -9034,11 +9324,11 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
9034
9324
|
|
|
9035
9325
|
// src/vite/plugin-modules.ts
|
|
9036
9326
|
init_loader();
|
|
9037
|
-
import
|
|
9327
|
+
import path23 from "node:path";
|
|
9038
9328
|
import { normalizePath as normalizePath2 } from "vite";
|
|
9039
|
-
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
9040
|
-
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
9041
|
-
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(
|
|
9329
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path23.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
9330
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path23.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
9331
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path23.resolve(rootDir, pagePath));
|
|
9042
9332
|
var viteModulesPlugin = () => {
|
|
9043
9333
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
9044
9334
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -9173,7 +9463,7 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
9173
9463
|
|
|
9174
9464
|
// src/vite/plugin-search.ts
|
|
9175
9465
|
init_loader();
|
|
9176
|
-
import
|
|
9466
|
+
import path24 from "node:path";
|
|
9177
9467
|
var viteSearchPlugin = () => {
|
|
9178
9468
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
9179
9469
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -9191,7 +9481,7 @@ var viteSearchPlugin = () => {
|
|
|
9191
9481
|
return resolvedVirtualModuleId5;
|
|
9192
9482
|
}
|
|
9193
9483
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
9194
|
-
return
|
|
9484
|
+
return path24.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
9195
9485
|
}
|
|
9196
9486
|
},
|
|
9197
9487
|
async load(id) {
|
|
@@ -9330,17 +9620,17 @@ function vitePlugin() {
|
|
|
9330
9620
|
}
|
|
9331
9621
|
|
|
9332
9622
|
// src/vite/config.ts
|
|
9333
|
-
var browserConfigLoaderPath2 =
|
|
9623
|
+
var browserConfigLoaderPath2 = path25.join(
|
|
9334
9624
|
getZudokuRootDir(),
|
|
9335
9625
|
"src/config/apitogo-config-loader.browser.ts"
|
|
9336
9626
|
);
|
|
9337
9627
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
9338
9628
|
if (merged.publicDir === false) return void 0;
|
|
9339
9629
|
const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
9340
|
-
return
|
|
9630
|
+
return path25.resolve(rootDir, rel);
|
|
9341
9631
|
};
|
|
9342
|
-
var getAppClientEntryPath = () =>
|
|
9343
|
-
var getAppServerEntryPath = () =>
|
|
9632
|
+
var getAppClientEntryPath = () => path25.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
9633
|
+
var getAppServerEntryPath = () => path25.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
9344
9634
|
var hasLoggedCdnInfo = false;
|
|
9345
9635
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
9346
9636
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -9357,9 +9647,9 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9357
9647
|
const cdnUrl = CdnUrlSchema.parse(config2.cdnUrl);
|
|
9358
9648
|
const base = cdnUrl?.base ? joinUrl(cdnUrl.base, config2.basePath) : config2.basePath;
|
|
9359
9649
|
if (cdnUrl && !hasLoggedCdnInfo) {
|
|
9360
|
-
logger.info(
|
|
9361
|
-
logger.info(
|
|
9362
|
-
logger.info(
|
|
9650
|
+
logger.info(colors5.blue(`Using CDN URL:`));
|
|
9651
|
+
logger.info(colors5.blue(` base: `) + colors5.dim(cdnUrl.base));
|
|
9652
|
+
logger.info(colors5.blue(` media: `) + colors5.dim(cdnUrl.media));
|
|
9363
9653
|
hasLoggedCdnInfo = true;
|
|
9364
9654
|
}
|
|
9365
9655
|
const publicVarsProcessEnvDefine = Object.fromEntries(
|
|
@@ -9370,7 +9660,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9370
9660
|
);
|
|
9371
9661
|
if (ZuploEnv.isZuplo) {
|
|
9372
9662
|
dotenv.config({
|
|
9373
|
-
path:
|
|
9663
|
+
path: path25.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
9374
9664
|
quiet: true
|
|
9375
9665
|
});
|
|
9376
9666
|
}
|
|
@@ -9395,11 +9685,11 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9395
9685
|
client: {
|
|
9396
9686
|
resolve: {
|
|
9397
9687
|
alias: {
|
|
9398
|
-
[
|
|
9688
|
+
[path25.join(
|
|
9399
9689
|
getZudokuRootDir(),
|
|
9400
9690
|
"src/config/apitogo-config-loader.node.ts"
|
|
9401
9691
|
)]: browserConfigLoaderPath2,
|
|
9402
|
-
[
|
|
9692
|
+
[path25.join(
|
|
9403
9693
|
getZudokuRootDir(),
|
|
9404
9694
|
"src/config/apitogo-config-loader.node.js"
|
|
9405
9695
|
)]: browserConfigLoaderPath2
|
|
@@ -9445,8 +9735,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9445
9735
|
ssr: configEnv.isSsrBuild,
|
|
9446
9736
|
sourcemap: true,
|
|
9447
9737
|
target: "es2022",
|
|
9448
|
-
outDir:
|
|
9449
|
-
|
|
9738
|
+
outDir: path25.resolve(
|
|
9739
|
+
path25.join(
|
|
9450
9740
|
dir,
|
|
9451
9741
|
"dist",
|
|
9452
9742
|
config2.basePath ?? "",
|
|
@@ -9465,7 +9755,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9465
9755
|
},
|
|
9466
9756
|
experimental: {
|
|
9467
9757
|
renderBuiltUrl(filename) {
|
|
9468
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
9758
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path25.extname(filename))) {
|
|
9469
9759
|
return joinUrl(cdnUrl.base, filename);
|
|
9470
9760
|
}
|
|
9471
9761
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -9478,7 +9768,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9478
9768
|
esbuildOptions: {
|
|
9479
9769
|
target: "es2022"
|
|
9480
9770
|
},
|
|
9481
|
-
entries: [
|
|
9771
|
+
entries: [path25.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
9482
9772
|
exclude: [
|
|
9483
9773
|
"@lukoweb/apitogo",
|
|
9484
9774
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -9522,7 +9812,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
9522
9812
|
if (!loaded) continue;
|
|
9523
9813
|
mergedViteConfig = mergeConfig2(mergedViteConfig, loaded.config, true);
|
|
9524
9814
|
if (root === dir) {
|
|
9525
|
-
logger.info(
|
|
9815
|
+
logger.info(colors5.blue(`merged with custom user Vite config`), {
|
|
9526
9816
|
timestamp: true
|
|
9527
9817
|
});
|
|
9528
9818
|
}
|
|
@@ -9584,7 +9874,7 @@ init_package_json();
|
|
|
9584
9874
|
init_joinUrl();
|
|
9585
9875
|
import assert from "node:assert";
|
|
9586
9876
|
import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
9587
|
-
import
|
|
9877
|
+
import path26 from "node:path";
|
|
9588
9878
|
var pkgJson = getZudokuPackageJson();
|
|
9589
9879
|
function generateOutput({
|
|
9590
9880
|
config: config2,
|
|
@@ -9641,9 +9931,9 @@ async function writeOutput(dir, {
|
|
|
9641
9931
|
rewrites
|
|
9642
9932
|
}) {
|
|
9643
9933
|
const output = generateOutput({ config: config2, redirects, rewrites });
|
|
9644
|
-
const outputDir = process.env.VERCEL ?
|
|
9934
|
+
const outputDir = process.env.VERCEL ? path26.join(dir, ".vercel/output") : path26.join(dir, "dist/.output");
|
|
9645
9935
|
await mkdir3(outputDir, { recursive: true });
|
|
9646
|
-
const outputFile =
|
|
9936
|
+
const outputFile = path26.join(outputDir, "config.json");
|
|
9647
9937
|
await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
|
|
9648
9938
|
if (process.env.VERCEL) {
|
|
9649
9939
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -9655,10 +9945,10 @@ init_logger();
|
|
|
9655
9945
|
init_file_exists();
|
|
9656
9946
|
import { readFile as readFile2, rm } from "node:fs/promises";
|
|
9657
9947
|
import os from "node:os";
|
|
9658
|
-
import
|
|
9948
|
+
import path29 from "node:path";
|
|
9659
9949
|
import { pathToFileURL } from "node:url";
|
|
9660
9950
|
import { createIndex } from "pagefind";
|
|
9661
|
-
import
|
|
9951
|
+
import colors8 from "picocolors";
|
|
9662
9952
|
import PiscinaImport from "piscina";
|
|
9663
9953
|
init_transform_config();
|
|
9664
9954
|
init_invariant();
|
|
@@ -9697,8 +9987,8 @@ function throttle(fn) {
|
|
|
9697
9987
|
init_joinUrl();
|
|
9698
9988
|
import { createWriteStream, existsSync as existsSync2 } from "node:fs";
|
|
9699
9989
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
9700
|
-
import
|
|
9701
|
-
import
|
|
9990
|
+
import path27 from "node:path";
|
|
9991
|
+
import colors6 from "picocolors";
|
|
9702
9992
|
import { SitemapStream } from "sitemap";
|
|
9703
9993
|
async function generateSitemap({
|
|
9704
9994
|
outputUrls,
|
|
@@ -9711,11 +10001,11 @@ async function generateSitemap({
|
|
|
9711
10001
|
return;
|
|
9712
10002
|
}
|
|
9713
10003
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
9714
|
-
const outputDir =
|
|
10004
|
+
const outputDir = path27.resolve(baseOutputDir, config2.outDir ?? "");
|
|
9715
10005
|
if (!existsSync2(outputDir)) {
|
|
9716
10006
|
await mkdir4(outputDir, { recursive: true });
|
|
9717
10007
|
}
|
|
9718
|
-
const sitemapOutputPath =
|
|
10008
|
+
const sitemapOutputPath = path27.join(outputDir, "sitemap.xml");
|
|
9719
10009
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
9720
10010
|
sitemap.pipe(writeStream);
|
|
9721
10011
|
let lastmod;
|
|
@@ -9739,20 +10029,20 @@ async function generateSitemap({
|
|
|
9739
10029
|
writeStream.on("error", reject);
|
|
9740
10030
|
});
|
|
9741
10031
|
console.debug(
|
|
9742
|
-
|
|
10032
|
+
colors6.blue(`\u2713 wrote sitemap to ${colors6.bold(sitemapOutputPath)}`)
|
|
9743
10033
|
);
|
|
9744
10034
|
}
|
|
9745
10035
|
|
|
9746
10036
|
// src/vite/prerender/utils.ts
|
|
9747
10037
|
init_joinUrl();
|
|
9748
|
-
var resolveRoutePath = (
|
|
9749
|
-
const segments =
|
|
10038
|
+
var resolveRoutePath = (path41) => {
|
|
10039
|
+
const segments = path41.split("/");
|
|
9750
10040
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
9751
10041
|
return void 0;
|
|
9752
10042
|
}
|
|
9753
10043
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
9754
10044
|
};
|
|
9755
|
-
var isSkipped = (
|
|
10045
|
+
var isSkipped = (path41) => path41.includes("*") || /^\d+$/.test(path41);
|
|
9756
10046
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
9757
10047
|
if (route.path && isSkipped(route.path)) return [];
|
|
9758
10048
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -9801,12 +10091,12 @@ var prerender = async ({
|
|
|
9801
10091
|
serverConfigFilename,
|
|
9802
10092
|
writeRedirects = true
|
|
9803
10093
|
}) => {
|
|
9804
|
-
const distDir =
|
|
10094
|
+
const distDir = path29.join(dir, "dist", basePath);
|
|
9805
10095
|
const serverConfigPath = pathToFileURL(
|
|
9806
|
-
|
|
10096
|
+
path29.join(distDir, "server", serverConfigFilename)
|
|
9807
10097
|
).href;
|
|
9808
10098
|
const entryServerPath = pathToFileURL(
|
|
9809
|
-
|
|
10099
|
+
path29.join(distDir, "server/entry.server.js")
|
|
9810
10100
|
).href;
|
|
9811
10101
|
const rawConfig = await import(serverConfigPath).then(
|
|
9812
10102
|
(m) => m.default
|
|
@@ -9831,12 +10121,12 @@ var prerender = async ({
|
|
|
9831
10121
|
const writeProgress = throttle(
|
|
9832
10122
|
(count, total, urlPath) => {
|
|
9833
10123
|
if (quietDeployJson) return;
|
|
9834
|
-
writeLine(`prerendering (${count}/${total}) ${
|
|
10124
|
+
writeLine(`prerendering (${count}/${total}) ${colors8.dim(urlPath)}`);
|
|
9835
10125
|
}
|
|
9836
10126
|
);
|
|
9837
10127
|
if (!isTTY() && !quietDeployJson) {
|
|
9838
10128
|
logger.info(
|
|
9839
|
-
|
|
10129
|
+
colors8.dim(
|
|
9840
10130
|
`prerendering ${paths.length} routes using ${maxThreads} workers...`
|
|
9841
10131
|
)
|
|
9842
10132
|
);
|
|
@@ -9880,7 +10170,7 @@ var prerender = async ({
|
|
|
9880
10170
|
const now = performance.now();
|
|
9881
10171
|
if (now - lastLogTime >= LOG_INTERVAL_MS) {
|
|
9882
10172
|
logger.info(
|
|
9883
|
-
|
|
10173
|
+
colors8.blue(
|
|
9884
10174
|
`prerendered ${completedCount}/${paths.length} routes using ${maxThreads} workers`
|
|
9885
10175
|
)
|
|
9886
10176
|
);
|
|
@@ -9891,20 +10181,20 @@ var prerender = async ({
|
|
|
9891
10181
|
})
|
|
9892
10182
|
);
|
|
9893
10183
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
9894
|
-
outputPath:
|
|
10184
|
+
outputPath: path29.join(distDir, "pagefind")
|
|
9895
10185
|
});
|
|
9896
10186
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
9897
10187
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
9898
10188
|
if (!quietDeployJson) {
|
|
9899
10189
|
if (isTTY()) {
|
|
9900
|
-
writeLine(
|
|
10190
|
+
writeLine(colors8.blue(`${message}
|
|
9901
10191
|
`));
|
|
9902
10192
|
} else {
|
|
9903
|
-
logger.info(
|
|
10193
|
+
logger.info(colors8.blue(message));
|
|
9904
10194
|
}
|
|
9905
10195
|
if (pagefindWriteResult?.outputPath) {
|
|
9906
10196
|
logger.info(
|
|
9907
|
-
|
|
10197
|
+
colors8.blue(
|
|
9908
10198
|
`\u2713 pagefind index built: ${pagefindWriteResult.outputPath}`
|
|
9909
10199
|
)
|
|
9910
10200
|
);
|
|
@@ -9923,7 +10213,7 @@ var prerender = async ({
|
|
|
9923
10213
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
9924
10214
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
9925
10215
|
const llmsConfig = docsConfig.llms ?? {};
|
|
9926
|
-
const markdownInfoPath =
|
|
10216
|
+
const markdownInfoPath = path29.join(
|
|
9927
10217
|
dir,
|
|
9928
10218
|
"node_modules/.apitogo/markdown-info.json"
|
|
9929
10219
|
);
|
|
@@ -10014,7 +10304,7 @@ async function runBuild(options) {
|
|
|
10014
10304
|
html,
|
|
10015
10305
|
basePath: config2.basePath
|
|
10016
10306
|
});
|
|
10017
|
-
await rm2(
|
|
10307
|
+
await rm2(path30.join(clientOutDir, "index.html"), { force: true });
|
|
10018
10308
|
} else {
|
|
10019
10309
|
await runPrerender({
|
|
10020
10310
|
dir,
|
|
@@ -10038,7 +10328,7 @@ var runPrerender = async (options) => {
|
|
|
10038
10328
|
serverConfigFilename,
|
|
10039
10329
|
writeRedirects: process.env.VERCEL === void 0
|
|
10040
10330
|
});
|
|
10041
|
-
const indexHtml =
|
|
10331
|
+
const indexHtml = path30.join(clientOutDir, "index.html");
|
|
10042
10332
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
10043
10333
|
await writeFile5(indexHtml, html, "utf-8");
|
|
10044
10334
|
}
|
|
@@ -10048,15 +10338,15 @@ var runPrerender = async (options) => {
|
|
|
10048
10338
|
for (const statusPage of statusPages) {
|
|
10049
10339
|
await rename(
|
|
10050
10340
|
statusPage,
|
|
10051
|
-
|
|
10341
|
+
path30.join(dir, DIST_DIR, path30.basename(statusPage))
|
|
10052
10342
|
);
|
|
10053
10343
|
}
|
|
10054
10344
|
await rm2(serverOutDir, { recursive: true, force: true });
|
|
10055
10345
|
if (process.env.VERCEL) {
|
|
10056
|
-
await mkdir5(
|
|
10346
|
+
await mkdir5(path30.join(dir, ".vercel/output/static"), { recursive: true });
|
|
10057
10347
|
await rename(
|
|
10058
|
-
|
|
10059
|
-
|
|
10348
|
+
path30.join(dir, DIST_DIR),
|
|
10349
|
+
path30.join(dir, ".vercel/output/static")
|
|
10060
10350
|
);
|
|
10061
10351
|
}
|
|
10062
10352
|
await writeOutput(dir, {
|
|
@@ -10066,7 +10356,7 @@ var runPrerender = async (options) => {
|
|
|
10066
10356
|
});
|
|
10067
10357
|
if (ZuploEnv.isZuplo && issuer) {
|
|
10068
10358
|
await writeFile5(
|
|
10069
|
-
|
|
10359
|
+
path30.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
10070
10360
|
JSON.stringify({ issuer }, null, 2),
|
|
10071
10361
|
"utf-8"
|
|
10072
10362
|
);
|
|
@@ -10078,10 +10368,10 @@ var runPrerender = async (options) => {
|
|
|
10078
10368
|
};
|
|
10079
10369
|
var bundleSSREntry = async (options) => {
|
|
10080
10370
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
10081
|
-
const tempEntryPath =
|
|
10371
|
+
const tempEntryPath = path30.join(dir, "__ssr-entry.ts");
|
|
10082
10372
|
const packageRoot = getZudokuRootDir();
|
|
10083
10373
|
const templateContent = await readFile3(
|
|
10084
|
-
|
|
10374
|
+
path30.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
10085
10375
|
"utf-8"
|
|
10086
10376
|
);
|
|
10087
10377
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -10096,9 +10386,9 @@ var bundleSSREntry = async (options) => {
|
|
|
10096
10386
|
platform: adapter === "node" ? "node" : "neutral",
|
|
10097
10387
|
target: "es2022",
|
|
10098
10388
|
format: "esm",
|
|
10099
|
-
outfile:
|
|
10389
|
+
outfile: path30.join(serverOutDir, "entry.js"),
|
|
10100
10390
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
10101
|
-
nodePaths: [
|
|
10391
|
+
nodePaths: [path30.join(packageRoot, "node_modules")],
|
|
10102
10392
|
banner: { js: "// Bundled SSR entry" }
|
|
10103
10393
|
});
|
|
10104
10394
|
} finally {
|
|
@@ -10108,56 +10398,14 @@ var bundleSSREntry = async (options) => {
|
|
|
10108
10398
|
|
|
10109
10399
|
// src/cli/build/handler.ts
|
|
10110
10400
|
init_logger();
|
|
10111
|
-
|
|
10112
|
-
// src/cli/common/output.ts
|
|
10113
|
-
import * as Sentry from "@sentry/node";
|
|
10114
|
-
import colors8 from "picocolors";
|
|
10115
|
-
|
|
10116
|
-
// src/cli/common/constants.ts
|
|
10117
|
-
var CLI_XDG_FOLDER_NAME = "apitogo";
|
|
10118
|
-
var VERSION_CHECK_FILE = "version.json";
|
|
10119
|
-
var SENTRY_DSN = void 0;
|
|
10120
|
-
var MAX_WAIT_PENDING_TIME_MS = 1e3;
|
|
10121
|
-
var POST_HOG_CAPTURE_KEY = void 0;
|
|
10122
|
-
var DEPLOY_SERVER_API_KEY = "qRVLTP22TFStdN6";
|
|
10123
|
-
|
|
10124
|
-
// src/cli/common/output.ts
|
|
10125
|
-
function printDiagnosticsToConsole(message) {
|
|
10126
|
-
console.error(colors8.bold(colors8.blue(message)));
|
|
10127
|
-
}
|
|
10128
|
-
function printWarningToConsole(message) {
|
|
10129
|
-
console.error(message);
|
|
10130
|
-
}
|
|
10131
|
-
async function printCriticalFailureToConsoleAndExit(message) {
|
|
10132
|
-
console.error(colors8.bold(colors8.red(message)));
|
|
10133
|
-
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
10134
|
-
process.exit(1);
|
|
10135
|
-
});
|
|
10136
|
-
}
|
|
10137
|
-
function printJsonOnlyErrorAndExit(message) {
|
|
10138
|
-
console.log(JSON.stringify({ error: message }));
|
|
10139
|
-
process.exit(1);
|
|
10140
|
-
}
|
|
10141
|
-
function printResultToConsole(message) {
|
|
10142
|
-
console.log(colors8.bold(colors8.green(message)));
|
|
10143
|
-
}
|
|
10144
|
-
function textOrJson(text) {
|
|
10145
|
-
try {
|
|
10146
|
-
return JSON.parse(text);
|
|
10147
|
-
} catch {
|
|
10148
|
-
return text;
|
|
10149
|
-
}
|
|
10150
|
-
}
|
|
10151
|
-
|
|
10152
|
-
// src/cli/build/handler.ts
|
|
10153
10401
|
init_package_json();
|
|
10154
10402
|
|
|
10155
10403
|
// src/cli/preview/handler.ts
|
|
10156
|
-
import
|
|
10404
|
+
import path31 from "node:path";
|
|
10157
10405
|
import { preview as vitePreview } from "vite";
|
|
10158
10406
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
10159
10407
|
async function preview(argv) {
|
|
10160
|
-
const dir =
|
|
10408
|
+
const dir = path31.resolve(process.cwd(), argv.dir);
|
|
10161
10409
|
const viteConfig = await getViteConfig(dir, {
|
|
10162
10410
|
command: "serve",
|
|
10163
10411
|
mode: "production",
|
|
@@ -10198,7 +10446,7 @@ async function build(argv) {
|
|
|
10198
10446
|
printDiagnosticsToConsole("");
|
|
10199
10447
|
printDiagnosticsToConsole("");
|
|
10200
10448
|
}
|
|
10201
|
-
const dir =
|
|
10449
|
+
const dir = path32.resolve(process.cwd(), argv.dir);
|
|
10202
10450
|
try {
|
|
10203
10451
|
await runBuild({
|
|
10204
10452
|
dir,
|
|
@@ -10223,104 +10471,6 @@ async function build(argv) {
|
|
|
10223
10471
|
}
|
|
10224
10472
|
}
|
|
10225
10473
|
|
|
10226
|
-
// src/cli/common/analytics/lib.ts
|
|
10227
|
-
import { PostHog } from "posthog-node";
|
|
10228
|
-
|
|
10229
|
-
// src/cli/common/machine-id/lib.ts
|
|
10230
|
-
import { execSync } from "node:child_process";
|
|
10231
|
-
import { createHash } from "node:crypto";
|
|
10232
|
-
var win32RegBinPath = {
|
|
10233
|
-
skipped: "",
|
|
10234
|
-
native: "%windir%\\System32",
|
|
10235
|
-
mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32"
|
|
10236
|
-
};
|
|
10237
|
-
var guid = {
|
|
10238
|
-
darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
|
|
10239
|
-
win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,
|
|
10240
|
-
linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :"
|
|
10241
|
-
};
|
|
10242
|
-
function isWindowsProcessMixedOrNativeArchitecture() {
|
|
10243
|
-
if (process.platform !== "win32") {
|
|
10244
|
-
return "skipped";
|
|
10245
|
-
}
|
|
10246
|
-
if (process.arch === "ia32" && process.env.PROCESSOR_ARCHITEW6432) {
|
|
10247
|
-
return "mixed";
|
|
10248
|
-
}
|
|
10249
|
-
return "native";
|
|
10250
|
-
}
|
|
10251
|
-
function hash(guid2) {
|
|
10252
|
-
return createHash("sha256").update(guid2).digest("hex");
|
|
10253
|
-
}
|
|
10254
|
-
function expose(result) {
|
|
10255
|
-
switch (process.platform) {
|
|
10256
|
-
case "darwin":
|
|
10257
|
-
return result.split("IOPlatformUUID")[1].split("\n")[0].replace(/=|\s+]"/gi, "").toLowerCase();
|
|
10258
|
-
case "win32":
|
|
10259
|
-
return result.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
10260
|
-
case "linux":
|
|
10261
|
-
return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
10262
|
-
case "freebsd":
|
|
10263
|
-
return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
|
|
10264
|
-
default:
|
|
10265
|
-
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
10266
|
-
}
|
|
10267
|
-
}
|
|
10268
|
-
function machineId() {
|
|
10269
|
-
switch (process.platform) {
|
|
10270
|
-
case "darwin":
|
|
10271
|
-
case "win32":
|
|
10272
|
-
case "linux":
|
|
10273
|
-
return hash(expose(execSync(guid[process.platform]).toString()));
|
|
10274
|
-
default:
|
|
10275
|
-
return "e16fc483-5593-4d71-b485-a6533693da9b";
|
|
10276
|
-
}
|
|
10277
|
-
}
|
|
10278
|
-
|
|
10279
|
-
// src/cli/common/analytics/lib.ts
|
|
10280
|
-
var _postHog;
|
|
10281
|
-
function init() {
|
|
10282
|
-
if (process.env.ZUDOKU_DO_NOT_TRACK || !POST_HOG_CAPTURE_KEY) {
|
|
10283
|
-
return void 0;
|
|
10284
|
-
}
|
|
10285
|
-
_postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
|
|
10286
|
-
host: "https://app.posthog.com",
|
|
10287
|
-
flushAt: 1,
|
|
10288
|
-
flushInterval: 1
|
|
10289
|
-
});
|
|
10290
|
-
return _postHog;
|
|
10291
|
-
}
|
|
10292
|
-
async function captureEvent({
|
|
10293
|
-
event,
|
|
10294
|
-
properties,
|
|
10295
|
-
groups,
|
|
10296
|
-
sendFeatureFlags,
|
|
10297
|
-
timestamp,
|
|
10298
|
-
disableGeoip
|
|
10299
|
-
}) {
|
|
10300
|
-
if (_postHog === void 0) {
|
|
10301
|
-
init();
|
|
10302
|
-
}
|
|
10303
|
-
if (_postHog) {
|
|
10304
|
-
properties = properties ?? {};
|
|
10305
|
-
properties.$set_once = properties.$set_once ?? {};
|
|
10306
|
-
if (process.env.CI) {
|
|
10307
|
-
properties.ci = process.env.CI;
|
|
10308
|
-
}
|
|
10309
|
-
_postHog.capture({
|
|
10310
|
-
distinctId: machineId(),
|
|
10311
|
-
event,
|
|
10312
|
-
properties,
|
|
10313
|
-
groups,
|
|
10314
|
-
sendFeatureFlags,
|
|
10315
|
-
timestamp,
|
|
10316
|
-
disableGeoip
|
|
10317
|
-
});
|
|
10318
|
-
}
|
|
10319
|
-
}
|
|
10320
|
-
async function shutdownAnalytics() {
|
|
10321
|
-
return _postHog?.shutdown();
|
|
10322
|
-
}
|
|
10323
|
-
|
|
10324
10474
|
// src/cli/cmds/build.ts
|
|
10325
10475
|
var build_default = {
|
|
10326
10476
|
desc: "Build",
|
|
@@ -10357,8 +10507,8 @@ var build_default = {
|
|
|
10357
10507
|
|
|
10358
10508
|
// src/cli/configure-github-workflow/handler.ts
|
|
10359
10509
|
import { constants } from "node:fs";
|
|
10360
|
-
import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
10361
|
-
import
|
|
10510
|
+
import { access as access2, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
10511
|
+
import path33 from "node:path";
|
|
10362
10512
|
var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
|
|
10363
10513
|
|
|
10364
10514
|
on:
|
|
@@ -10469,12 +10619,12 @@ jobs:
|
|
|
10469
10619
|
run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
|
|
10470
10620
|
`;
|
|
10471
10621
|
async function configureGithubWorkflow(argv) {
|
|
10472
|
-
const dir =
|
|
10473
|
-
const workflowDir =
|
|
10474
|
-
const workflowPath =
|
|
10622
|
+
const dir = path33.resolve(process.cwd(), argv.dir);
|
|
10623
|
+
const workflowDir = path33.join(dir, ".github", "workflows");
|
|
10624
|
+
const workflowPath = path33.join(workflowDir, "apitogo-deploy.yml");
|
|
10475
10625
|
try {
|
|
10476
10626
|
try {
|
|
10477
|
-
await
|
|
10627
|
+
await access2(workflowPath, constants.F_OK);
|
|
10478
10628
|
if (!argv.force) {
|
|
10479
10629
|
await printCriticalFailureToConsoleAndExit(
|
|
10480
10630
|
`Workflow file already exists: ${workflowPath}. Pass --force to overwrite.`
|
|
@@ -10543,15 +10693,15 @@ function applyJsonOnlyDeployQuietMode() {
|
|
|
10543
10693
|
}
|
|
10544
10694
|
|
|
10545
10695
|
// src/cli/deploy/handler.ts
|
|
10546
|
-
import { access as
|
|
10547
|
-
import
|
|
10696
|
+
import { access as access3, readFile as readFile4 } from "node:fs/promises";
|
|
10697
|
+
import path34 from "node:path";
|
|
10548
10698
|
import { create as createTar } from "tar";
|
|
10549
10699
|
var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
|
|
10550
10700
|
var ARCHIVE_NAME = "dist.tgz";
|
|
10551
10701
|
var createDeploymentArchive = async (dir) => {
|
|
10552
|
-
const distDir =
|
|
10553
|
-
await
|
|
10554
|
-
const archivePath =
|
|
10702
|
+
const distDir = path34.join(dir, "dist");
|
|
10703
|
+
await access3(distDir);
|
|
10704
|
+
const archivePath = path34.join(dir, ARCHIVE_NAME);
|
|
10555
10705
|
await createTar(
|
|
10556
10706
|
{
|
|
10557
10707
|
cwd: dir,
|
|
@@ -10565,7 +10715,7 @@ var createDeploymentArchive = async (dir) => {
|
|
|
10565
10715
|
};
|
|
10566
10716
|
async function deploy(argv) {
|
|
10567
10717
|
await build({ ...argv, preview: void 0 });
|
|
10568
|
-
const dir =
|
|
10718
|
+
const dir = path34.resolve(process.cwd(), argv.dir);
|
|
10569
10719
|
const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
|
|
10570
10720
|
const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
|
|
10571
10721
|
try {
|
|
@@ -10578,7 +10728,7 @@ async function deploy(argv) {
|
|
|
10578
10728
|
const archivePath = await createDeploymentArchive(dir);
|
|
10579
10729
|
if (!isJsonOnlyDeployEnv()) {
|
|
10580
10730
|
printDiagnosticsToConsole(
|
|
10581
|
-
`Uploading ${
|
|
10731
|
+
`Uploading ${path34.basename(archivePath)} to ${env}...`
|
|
10582
10732
|
);
|
|
10583
10733
|
}
|
|
10584
10734
|
const archiveBuffer = await readFile4(archivePath);
|
|
@@ -10586,7 +10736,7 @@ async function deploy(argv) {
|
|
|
10586
10736
|
formData.append(
|
|
10587
10737
|
"file",
|
|
10588
10738
|
new Blob([archiveBuffer], { type: "application/gzip" }),
|
|
10589
|
-
|
|
10739
|
+
path34.basename(archivePath)
|
|
10590
10740
|
);
|
|
10591
10741
|
formData.append("deploymentToken", deploymentToken);
|
|
10592
10742
|
formData.append("env", env);
|
|
@@ -10671,14 +10821,14 @@ var deploy_default = {
|
|
|
10671
10821
|
|
|
10672
10822
|
// src/cli/dev/handler.ts
|
|
10673
10823
|
init_joinUrl();
|
|
10674
|
-
import
|
|
10824
|
+
import path37 from "node:path";
|
|
10675
10825
|
|
|
10676
10826
|
// src/vite/dev-server.ts
|
|
10677
10827
|
init_logger();
|
|
10678
10828
|
import fs4 from "node:fs/promises";
|
|
10679
10829
|
import http from "node:http";
|
|
10680
10830
|
import https from "node:https";
|
|
10681
|
-
import
|
|
10831
|
+
import path36 from "node:path";
|
|
10682
10832
|
import { createHttpTerminator } from "http-terminator";
|
|
10683
10833
|
import {
|
|
10684
10834
|
createServer as createViteServer,
|
|
@@ -10711,7 +10861,7 @@ init_loader();
|
|
|
10711
10861
|
// src/vite/pagefind-dev-index.ts
|
|
10712
10862
|
init_invariant();
|
|
10713
10863
|
init_joinUrl();
|
|
10714
|
-
import
|
|
10864
|
+
import path35 from "node:path";
|
|
10715
10865
|
import { createIndex as createIndex2 } from "pagefind";
|
|
10716
10866
|
import { isRunnableDevEnvironment } from "vite";
|
|
10717
10867
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -10764,7 +10914,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
10764
10914
|
path: urlPath
|
|
10765
10915
|
};
|
|
10766
10916
|
}
|
|
10767
|
-
const outputPath =
|
|
10917
|
+
const outputPath = path35.join(vite.config.publicDir, "pagefind");
|
|
10768
10918
|
await pagefindIndex.writeFiles({ outputPath });
|
|
10769
10919
|
yield { type: "complete", success: true, indexed };
|
|
10770
10920
|
}
|
|
@@ -10783,9 +10933,9 @@ var DevServer = class {
|
|
|
10783
10933
|
this.protocol = "https";
|
|
10784
10934
|
const { dir } = this.options;
|
|
10785
10935
|
const [key, cert, ca] = await Promise.all([
|
|
10786
|
-
fs4.readFile(
|
|
10787
|
-
fs4.readFile(
|
|
10788
|
-
config2.https.ca ? fs4.readFile(
|
|
10936
|
+
fs4.readFile(path36.resolve(dir, config2.https.key)),
|
|
10937
|
+
fs4.readFile(path36.resolve(dir, config2.https.cert)),
|
|
10938
|
+
config2.https.ca ? fs4.readFile(path36.resolve(dir, config2.https.ca)) : void 0
|
|
10789
10939
|
]);
|
|
10790
10940
|
return https.createServer({ key, cert, ca });
|
|
10791
10941
|
}
|
|
@@ -10802,7 +10952,7 @@ var DevServer = class {
|
|
|
10802
10952
|
);
|
|
10803
10953
|
const server = await this.createNodeServer(config2);
|
|
10804
10954
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
10805
|
-
const publicRoot =
|
|
10955
|
+
const publicRoot = path36.resolve(
|
|
10806
10956
|
this.options.dir,
|
|
10807
10957
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
10808
10958
|
);
|
|
@@ -10819,7 +10969,7 @@ var DevServer = class {
|
|
|
10819
10969
|
// built-in transform middleware which would treat the path as a static asset.
|
|
10820
10970
|
name: "apitogo:entry-client",
|
|
10821
10971
|
configureServer(server2) {
|
|
10822
|
-
const entryPath =
|
|
10972
|
+
const entryPath = path36.posix.join(
|
|
10823
10973
|
server2.config.base,
|
|
10824
10974
|
"/__z/entry.client.tsx"
|
|
10825
10975
|
);
|
|
@@ -10984,7 +11134,7 @@ init_package_json();
|
|
|
10984
11134
|
async function dev(argv) {
|
|
10985
11135
|
const packageJson2 = getZudokuPackageJson();
|
|
10986
11136
|
process.env.NODE_ENV = "development";
|
|
10987
|
-
const dir =
|
|
11137
|
+
const dir = path37.resolve(process.cwd(), argv.dir);
|
|
10988
11138
|
const server = new DevServer({
|
|
10989
11139
|
dir,
|
|
10990
11140
|
argPort: argv.port,
|
|
@@ -11068,15 +11218,15 @@ var dev_default = {
|
|
|
11068
11218
|
|
|
11069
11219
|
// src/cli/make-config/handler.ts
|
|
11070
11220
|
import { constants as constants3 } from "node:fs";
|
|
11071
|
-
import { access as
|
|
11072
|
-
import
|
|
11221
|
+
import { access as access5, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
|
|
11222
|
+
import path39 from "node:path";
|
|
11073
11223
|
import { glob as glob5 } from "glob";
|
|
11074
11224
|
|
|
11075
11225
|
// src/cli/make-config/scaffold-project.ts
|
|
11076
11226
|
init_package_json();
|
|
11077
11227
|
import { constants as constants2 } from "node:fs";
|
|
11078
|
-
import { access as
|
|
11079
|
-
import
|
|
11228
|
+
import { access as access4, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
|
|
11229
|
+
import path38 from "node:path";
|
|
11080
11230
|
import { glob as glob4 } from "glob";
|
|
11081
11231
|
var OPENAPI_GLOBS = [
|
|
11082
11232
|
"apis/openapi.json",
|
|
@@ -11136,9 +11286,9 @@ var findMatchingCurly = (source, startIndex) => {
|
|
|
11136
11286
|
}
|
|
11137
11287
|
throw new Error("Could not find matching closing brace for object.");
|
|
11138
11288
|
};
|
|
11139
|
-
var toPosix = (p) => p.split(
|
|
11289
|
+
var toPosix = (p) => p.split(path38.sep).join("/");
|
|
11140
11290
|
var sanitizePackageName = (dir) => {
|
|
11141
|
-
const base =
|
|
11291
|
+
const base = path38.basename(path38.resolve(dir));
|
|
11142
11292
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
11143
11293
|
return s || "apitogo-site";
|
|
11144
11294
|
};
|
|
@@ -11148,9 +11298,9 @@ var apitogoVersionRange = () => {
|
|
|
11148
11298
|
};
|
|
11149
11299
|
async function findOpenApiSpecPath(dir) {
|
|
11150
11300
|
for (const rel of OPENAPI_GLOBS) {
|
|
11151
|
-
const full =
|
|
11301
|
+
const full = path38.join(dir, rel);
|
|
11152
11302
|
try {
|
|
11153
|
-
await
|
|
11303
|
+
await access4(full, constants2.R_OK);
|
|
11154
11304
|
return toPosix(rel);
|
|
11155
11305
|
} catch {
|
|
11156
11306
|
}
|
|
@@ -11163,7 +11313,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
11163
11313
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
11164
11314
|
}
|
|
11165
11315
|
async function ensurePackageJson(dir) {
|
|
11166
|
-
const pkgPath =
|
|
11316
|
+
const pkgPath = path38.join(dir, "package.json");
|
|
11167
11317
|
const apitogoVer = apitogoVersionRange();
|
|
11168
11318
|
const baseDeps = {
|
|
11169
11319
|
react: ">=19.0.0",
|
|
@@ -11176,7 +11326,7 @@ async function ensurePackageJson(dir) {
|
|
|
11176
11326
|
preview: "apitogo preview"
|
|
11177
11327
|
};
|
|
11178
11328
|
try {
|
|
11179
|
-
await
|
|
11329
|
+
await access4(pkgPath, constants2.R_OK);
|
|
11180
11330
|
} catch (err) {
|
|
11181
11331
|
const code = err.code;
|
|
11182
11332
|
if (code !== "ENOENT") throw err;
|
|
@@ -11226,9 +11376,9 @@ async function ensurePackageJson(dir) {
|
|
|
11226
11376
|
return false;
|
|
11227
11377
|
}
|
|
11228
11378
|
async function ensureTsconfigJson(dir) {
|
|
11229
|
-
const tsPath =
|
|
11379
|
+
const tsPath = path38.join(dir, "tsconfig.json");
|
|
11230
11380
|
try {
|
|
11231
|
-
await
|
|
11381
|
+
await access4(tsPath, constants2.R_OK);
|
|
11232
11382
|
return false;
|
|
11233
11383
|
} catch {
|
|
11234
11384
|
const tsconfig = {
|
|
@@ -11308,7 +11458,7 @@ var CONFIG_FILENAMES = [
|
|
|
11308
11458
|
];
|
|
11309
11459
|
var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
|
|
11310
11460
|
var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
|
|
11311
|
-
var toPosixPath2 = (value) => value.split(
|
|
11461
|
+
var toPosixPath2 = (value) => value.split(path39.sep).join(path39.posix.sep);
|
|
11312
11462
|
var toRoutePath = (relativeFile, pagesDir) => {
|
|
11313
11463
|
const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
|
|
11314
11464
|
const withoutPagesPrefix = relativeNoExt.replace(
|
|
@@ -11553,24 +11703,24 @@ export default config;
|
|
|
11553
11703
|
`;
|
|
11554
11704
|
};
|
|
11555
11705
|
var ensureApitogoDeployWorkflow = async (dir) => {
|
|
11556
|
-
const workflowPath =
|
|
11706
|
+
const workflowPath = path39.join(
|
|
11557
11707
|
dir,
|
|
11558
11708
|
".github",
|
|
11559
11709
|
"workflows",
|
|
11560
11710
|
"apitogo-deploy.yml"
|
|
11561
11711
|
);
|
|
11562
11712
|
try {
|
|
11563
|
-
await
|
|
11713
|
+
await access5(workflowPath, constants3.F_OK);
|
|
11564
11714
|
return false;
|
|
11565
11715
|
} catch {
|
|
11566
11716
|
}
|
|
11567
|
-
await mkdir7(
|
|
11717
|
+
await mkdir7(path39.join(dir, ".github", "workflows"), { recursive: true });
|
|
11568
11718
|
await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
|
|
11569
11719
|
return true;
|
|
11570
11720
|
};
|
|
11571
11721
|
var findExistingConfigPath = async (dir) => {
|
|
11572
11722
|
for (const filename of CONFIG_FILENAMES) {
|
|
11573
|
-
const fullPath =
|
|
11723
|
+
const fullPath = path39.join(dir, filename);
|
|
11574
11724
|
try {
|
|
11575
11725
|
await readFile6(fullPath, "utf8");
|
|
11576
11726
|
return fullPath;
|
|
@@ -11580,7 +11730,7 @@ var findExistingConfigPath = async (dir) => {
|
|
|
11580
11730
|
return null;
|
|
11581
11731
|
};
|
|
11582
11732
|
async function makeConfig(argv) {
|
|
11583
|
-
const dir =
|
|
11733
|
+
const dir = path39.resolve(process.cwd(), argv.dir);
|
|
11584
11734
|
const pagesDir = toPosixPath2(
|
|
11585
11735
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
11586
11736
|
);
|
|
@@ -11599,7 +11749,7 @@ async function makeConfig(argv) {
|
|
|
11599
11749
|
let configPath = await findExistingConfigPath(dir);
|
|
11600
11750
|
let createdNew = false;
|
|
11601
11751
|
if (!configPath) {
|
|
11602
|
-
configPath =
|
|
11752
|
+
configPath = path39.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
|
|
11603
11753
|
await writeFile8(
|
|
11604
11754
|
configPath,
|
|
11605
11755
|
buildNewConfigContents(pagesDir, openApiSpecPath),
|
|
@@ -11640,7 +11790,7 @@ async function makeConfig(argv) {
|
|
|
11640
11790
|
await writeFile8(configPath, withRedirects, "utf8");
|
|
11641
11791
|
const action = createdNew ? "Initialized" : "Updated";
|
|
11642
11792
|
printResultToConsole(
|
|
11643
|
-
`${action} ${
|
|
11793
|
+
`${action} ${path39.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
|
|
11644
11794
|
);
|
|
11645
11795
|
const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
|
|
11646
11796
|
if (createdWorkflow) {
|
|
@@ -11833,12 +11983,12 @@ function box(message, {
|
|
|
11833
11983
|
|
|
11834
11984
|
// src/cli/common/xdg/lib.ts
|
|
11835
11985
|
import { homedir } from "node:os";
|
|
11836
|
-
import
|
|
11986
|
+
import path40 from "node:path";
|
|
11837
11987
|
function defineDirectoryWithFallback(xdgName, fallback) {
|
|
11838
11988
|
if (process.env[xdgName]) {
|
|
11839
11989
|
return process.env[xdgName];
|
|
11840
11990
|
} else {
|
|
11841
|
-
return
|
|
11991
|
+
return path40.join(homedir(), fallback);
|
|
11842
11992
|
}
|
|
11843
11993
|
}
|
|
11844
11994
|
var XDG_CONFIG_HOME = defineDirectoryWithFallback(
|
|
@@ -11853,15 +12003,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
|
|
|
11853
12003
|
"XDG_DATA_HOME",
|
|
11854
12004
|
".local/state"
|
|
11855
12005
|
);
|
|
11856
|
-
var ZUDOKU_XDG_CONFIG_HOME =
|
|
12006
|
+
var ZUDOKU_XDG_CONFIG_HOME = path40.join(
|
|
11857
12007
|
XDG_CONFIG_HOME,
|
|
11858
12008
|
CLI_XDG_FOLDER_NAME
|
|
11859
12009
|
);
|
|
11860
|
-
var ZUDOKU_XDG_DATA_HOME =
|
|
12010
|
+
var ZUDOKU_XDG_DATA_HOME = path40.join(
|
|
11861
12011
|
XDG_DATA_HOME,
|
|
11862
12012
|
CLI_XDG_FOLDER_NAME
|
|
11863
12013
|
);
|
|
11864
|
-
var ZUDOKU_XDG_STATE_HOME =
|
|
12014
|
+
var ZUDOKU_XDG_STATE_HOME = path40.join(
|
|
11865
12015
|
XDG_STATE_HOME,
|
|
11866
12016
|
CLI_XDG_FOLDER_NAME
|
|
11867
12017
|
);
|
|
@@ -12025,7 +12175,7 @@ var cli = yargs(hideBin(process.argv)).option("zuplo", {
|
|
|
12025
12175
|
process.env.ZUPLO = "1";
|
|
12026
12176
|
printDiagnosticsToConsole("Running in Zuplo mode");
|
|
12027
12177
|
}
|
|
12028
|
-
}).middleware(warnPackageVersionMismatch).command(build_default).command(configure_github_workflow_default).command(dev_default).command(deploy_default).command(remove_default).command(preview_default).command(make_config_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
12178
|
+
}).middleware(warnPackageVersionMismatch).command(apply_default).command(build_default).command(configure_github_workflow_default).command(dev_default).command(deploy_default).command(remove_default).command(preview_default).command(make_config_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
12029
12179
|
try {
|
|
12030
12180
|
void warnIfOutdatedVersion(packageJson?.version);
|
|
12031
12181
|
await cli.argv;
|