@lukoweb/apitogo 0.1.88 → 0.1.90
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 +58 -21
- package/dist/declarations/cli/make-config/header-pricing-nav.d.ts +3 -0
- package/dist/declarations/lib/authentication/providers/dev-portal-constants.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/authentication/header-nav-filter.ts +2 -3
- package/src/lib/authentication/providers/dev-portal-constants.ts +1 -0
package/dist/cli/cli.js
CHANGED
|
@@ -96,19 +96,19 @@ var init_plugins = __esm({
|
|
|
96
96
|
|
|
97
97
|
// src/lib/core/transform-config.ts
|
|
98
98
|
import { isValidElement } from "react";
|
|
99
|
-
var
|
|
99
|
+
var isPlainObject2, mergeConfig, runPluginTransformConfig;
|
|
100
100
|
var init_transform_config = __esm({
|
|
101
101
|
"src/lib/core/transform-config.ts"() {
|
|
102
102
|
init_plugins();
|
|
103
|
-
|
|
103
|
+
isPlainObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
104
104
|
mergeConfig = (target, source) => {
|
|
105
105
|
const result = { ...target };
|
|
106
106
|
for (const key of Object.keys(source)) {
|
|
107
107
|
const sourceValue = source[key];
|
|
108
108
|
const targetValue = target[key];
|
|
109
|
-
if (isValidElement(sourceValue) || Array.isArray(sourceValue) || !
|
|
109
|
+
if (isValidElement(sourceValue) || Array.isArray(sourceValue) || !isPlainObject2(sourceValue)) {
|
|
110
110
|
result[key] = sourceValue;
|
|
111
|
-
} else if (
|
|
111
|
+
} else if (isPlainObject2(targetValue)) {
|
|
112
112
|
result[key] = mergeConfig(
|
|
113
113
|
targetValue,
|
|
114
114
|
sourceValue
|
|
@@ -5964,6 +5964,39 @@ import { existsSync } from "node:fs";
|
|
|
5964
5964
|
import { access, mkdir, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
5965
5965
|
import path2 from "node:path";
|
|
5966
5966
|
|
|
5967
|
+
// src/cli/make-config/header-pricing-nav.ts
|
|
5968
|
+
var HEADER_PRICING_PATH = "/pricing";
|
|
5969
|
+
var HEADER_PRICING_LABEL = "Pricing";
|
|
5970
|
+
function isPlainObject(value) {
|
|
5971
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5972
|
+
}
|
|
5973
|
+
function isPricingItem(item) {
|
|
5974
|
+
return isPlainObject(item) && item.to === HEADER_PRICING_PATH;
|
|
5975
|
+
}
|
|
5976
|
+
function docsInsertIndex(navigation) {
|
|
5977
|
+
return navigation.findIndex(
|
|
5978
|
+
(item) => item.to === "/introduction" || item.label === "Docs"
|
|
5979
|
+
);
|
|
5980
|
+
}
|
|
5981
|
+
function ensureHeaderPricingNavigation(config2) {
|
|
5982
|
+
const header = isPlainObject(config2.header) ? { ...config2.header } : {};
|
|
5983
|
+
const navigation = Array.isArray(header.navigation) ? [...header.navigation] : [];
|
|
5984
|
+
if (navigation.some(isPricingItem)) {
|
|
5985
|
+
return { ...config2, header: { ...header, navigation } };
|
|
5986
|
+
}
|
|
5987
|
+
const pricingItem = {
|
|
5988
|
+
label: HEADER_PRICING_LABEL,
|
|
5989
|
+
to: HEADER_PRICING_PATH
|
|
5990
|
+
};
|
|
5991
|
+
const insertAt = docsInsertIndex(navigation);
|
|
5992
|
+
if (insertAt >= 0) {
|
|
5993
|
+
navigation.splice(insertAt, 0, pricingItem);
|
|
5994
|
+
} else {
|
|
5995
|
+
navigation.push(pricingItem);
|
|
5996
|
+
}
|
|
5997
|
+
return { ...config2, header: { ...header, navigation } };
|
|
5998
|
+
}
|
|
5999
|
+
|
|
5967
6000
|
// src/cli/platform/helpers/dev-portal-landing.ts
|
|
5968
6001
|
function readLandingFromConfig(config2) {
|
|
5969
6002
|
const modules = config2.modules;
|
|
@@ -6038,6 +6071,10 @@ function applyPlansToUserPanel(config2, plans, pricingEnabled) {
|
|
|
6038
6071
|
modules.userPanel = userPanel;
|
|
6039
6072
|
config2.modules = modules;
|
|
6040
6073
|
delete config2.plans;
|
|
6074
|
+
if (plans.length > 0) {
|
|
6075
|
+
const withPricingNav = ensureHeaderPricingNavigation(config2);
|
|
6076
|
+
config2.header = withPricingNav.header;
|
|
6077
|
+
}
|
|
6041
6078
|
}
|
|
6042
6079
|
function applyPricingToUserPanel(config2, pricing) {
|
|
6043
6080
|
if (pricing?.enabled === void 0) {
|
|
@@ -12493,7 +12530,7 @@ import {
|
|
|
12493
12530
|
// package.json
|
|
12494
12531
|
var package_default = {
|
|
12495
12532
|
name: "@lukoweb/apitogo",
|
|
12496
|
-
version: "0.1.
|
|
12533
|
+
version: "0.1.90",
|
|
12497
12534
|
type: "module",
|
|
12498
12535
|
sideEffects: [
|
|
12499
12536
|
"**/*.css",
|
|
@@ -18944,14 +18981,14 @@ var APITOGO_JSON_FILENAME = "apitogo.config.json";
|
|
|
18944
18981
|
var DOCUMENTATION_NAV_LABEL2 = "Documentation";
|
|
18945
18982
|
var API_REFERENCE_PATH = "/api";
|
|
18946
18983
|
var API_REFERENCE_LABEL = "API Reference";
|
|
18947
|
-
function
|
|
18984
|
+
function isPlainObject3(value) {
|
|
18948
18985
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18949
18986
|
}
|
|
18950
18987
|
function deepMerge(target, source) {
|
|
18951
18988
|
const result = { ...target };
|
|
18952
18989
|
for (const [key, value] of Object.entries(source)) {
|
|
18953
18990
|
const existing = result[key];
|
|
18954
|
-
if (
|
|
18991
|
+
if (isPlainObject3(existing) && isPlainObject3(value)) {
|
|
18955
18992
|
result[key] = deepMerge(existing, value);
|
|
18956
18993
|
} else {
|
|
18957
18994
|
result[key] = value;
|
|
@@ -18969,7 +19006,7 @@ function parseJsonObjectFlag(raw, flagName) {
|
|
|
18969
19006
|
} catch {
|
|
18970
19007
|
throw new Error(`--${flagName} must be a JSON object.`);
|
|
18971
19008
|
}
|
|
18972
|
-
if (!
|
|
19009
|
+
if (!isPlainObject3(parsed)) {
|
|
18973
19010
|
throw new Error(`--${flagName} must be a JSON object.`);
|
|
18974
19011
|
}
|
|
18975
19012
|
return parsed;
|
|
@@ -19138,24 +19175,24 @@ function applyConfigPatches(config2, patches) {
|
|
|
19138
19175
|
let next = { ...config2 };
|
|
19139
19176
|
if (patches.site) {
|
|
19140
19177
|
next.site = deepMerge(
|
|
19141
|
-
|
|
19178
|
+
isPlainObject3(next.site) ? next.site : {},
|
|
19142
19179
|
patches.site
|
|
19143
19180
|
);
|
|
19144
19181
|
}
|
|
19145
19182
|
if (patches.theme) {
|
|
19146
19183
|
next.theme = deepMerge(
|
|
19147
|
-
|
|
19184
|
+
isPlainObject3(next.theme) ? next.theme : {},
|
|
19148
19185
|
patches.theme
|
|
19149
19186
|
);
|
|
19150
19187
|
}
|
|
19151
19188
|
if (patches.authentication) {
|
|
19152
19189
|
next.authentication = deepMerge(
|
|
19153
|
-
|
|
19190
|
+
isPlainObject3(next.authentication) ? next.authentication : {},
|
|
19154
19191
|
patches.authentication
|
|
19155
19192
|
);
|
|
19156
19193
|
}
|
|
19157
19194
|
if (patches.title?.trim()) {
|
|
19158
|
-
const site =
|
|
19195
|
+
const site = isPlainObject3(next.site) ? next.site : {};
|
|
19159
19196
|
next.site = { ...site, title: patches.title.trim() };
|
|
19160
19197
|
}
|
|
19161
19198
|
return next;
|
|
@@ -19334,9 +19371,9 @@ function applyPlansToJsonConfig(config2, planItems) {
|
|
|
19334
19371
|
if (planItems.length === 0) {
|
|
19335
19372
|
return config2;
|
|
19336
19373
|
}
|
|
19337
|
-
const modules =
|
|
19338
|
-
const userPanel =
|
|
19339
|
-
const plans =
|
|
19374
|
+
const modules = isPlainObject3(config2.modules) ? { ...config2.modules } : {};
|
|
19375
|
+
const userPanel = isPlainObject3(modules.userPanel) ? { ...modules.userPanel } : {};
|
|
19376
|
+
const plans = isPlainObject3(userPanel.plans) ? { ...userPanel.plans } : {};
|
|
19340
19377
|
const existing = Array.isArray(plans.items) ? [...plans.items] : [];
|
|
19341
19378
|
for (const item of planItems) {
|
|
19342
19379
|
const sku = item.sku;
|
|
@@ -19353,7 +19390,7 @@ function applyPlansToJsonConfig(config2, planItems) {
|
|
|
19353
19390
|
items: existing
|
|
19354
19391
|
};
|
|
19355
19392
|
modules.userPanel = userPanel;
|
|
19356
|
-
return { ...config2, modules };
|
|
19393
|
+
return ensureHeaderPricingNavigation({ ...config2, modules });
|
|
19357
19394
|
}
|
|
19358
19395
|
var BACKEND_RUNTIMES = ["dotnet", "nodejs", "python"];
|
|
19359
19396
|
var RUNTIME_VERSIONS_BY_RUNTIME = {
|
|
@@ -19383,7 +19420,7 @@ function parseRuntimeVersion(runtime, raw) {
|
|
|
19383
19420
|
return allowed.includes(value) ? value : null;
|
|
19384
19421
|
}
|
|
19385
19422
|
function applyBackendToJsonConfig(config2, backend) {
|
|
19386
|
-
const existing =
|
|
19423
|
+
const existing = isPlainObject3(config2.backend) ? config2.backend : {};
|
|
19387
19424
|
return {
|
|
19388
19425
|
...config2,
|
|
19389
19426
|
backend: {
|
|
@@ -19973,7 +20010,7 @@ var fileExists3 = async (filePath) => {
|
|
|
19973
20010
|
var readJsonConfig = async (filePath) => {
|
|
19974
20011
|
const raw = await readFile16(filePath, "utf8");
|
|
19975
20012
|
const parsed = JSON.parse(raw);
|
|
19976
|
-
if (!
|
|
20013
|
+
if (!isPlainObject3(parsed)) {
|
|
19977
20014
|
throw new Error(`${APITOGO_JSON_FILENAME} must be a JSON object.`);
|
|
19978
20015
|
}
|
|
19979
20016
|
return parsed;
|
|
@@ -20036,11 +20073,11 @@ function mergeBackendFlag(config2, backend) {
|
|
|
20036
20073
|
const { modules: modulesPatch, ...backendFields } = backend;
|
|
20037
20074
|
let next = { ...config2 };
|
|
20038
20075
|
if (Object.keys(backendFields).length > 0) {
|
|
20039
|
-
const existing =
|
|
20076
|
+
const existing = isPlainObject3(next.backend) ? next.backend : {};
|
|
20040
20077
|
next = { ...next, backend: deepMerge(existing, backendFields) };
|
|
20041
20078
|
}
|
|
20042
|
-
if (
|
|
20043
|
-
const existingModules =
|
|
20079
|
+
if (isPlainObject3(modulesPatch)) {
|
|
20080
|
+
const existingModules = isPlainObject3(next.modules) ? next.modules : {};
|
|
20044
20081
|
next = { ...next, modules: deepMerge(existingModules, modulesPatch) };
|
|
20045
20082
|
}
|
|
20046
20083
|
return next;
|
package/package.json
CHANGED
|
@@ -27,10 +27,9 @@ export function withoutPricingHeaderNavigation(
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/** Strip auth CTAs (Login/Signup) that have dedicated header buttons. Keep Pricing. */
|
|
30
31
|
export function withoutMarketingCtaHeaderNavigation(
|
|
31
32
|
navigation: HeaderNavigation,
|
|
32
33
|
): HeaderNavigation {
|
|
33
|
-
return
|
|
34
|
-
withoutAuthHeaderNavigation(navigation),
|
|
35
|
-
);
|
|
34
|
+
return withoutAuthHeaderNavigation(navigation);
|
|
36
35
|
}
|