@hubspot/cms-dev-server 1.2.78 → 1.2.79
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/index.js +2 -112
- package/dist/island-runtime.js +4 -0
- package/dist/run.js +8 -2114
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,113 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
-
};
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// ../node_modules/@inquirer/select/dist/esm/index.mjs
|
|
12
|
-
var esm_exports = {};
|
|
13
|
-
__export(esm_exports, {
|
|
14
|
-
Separator: () => Separator,
|
|
15
|
-
default: () => esm_default
|
|
16
|
-
});
|
|
17
|
-
import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, makeTheme } from "@inquirer/core";
|
|
18
|
-
import chalk from "chalk";
|
|
19
|
-
import figures from "figures";
|
|
20
|
-
import ansiEscapes from "ansi-escapes";
|
|
21
|
-
function isSelectable(item) {
|
|
22
|
-
return !Separator.isSeparator(item) && !item.disabled;
|
|
23
|
-
}
|
|
24
|
-
var selectTheme, esm_default;
|
|
25
|
-
var init_esm = __esm({
|
|
26
|
-
"../node_modules/@inquirer/select/dist/esm/index.mjs"() {
|
|
27
|
-
selectTheme = {
|
|
28
|
-
icon: { cursor: figures.pointer },
|
|
29
|
-
style: { disabled: (text) => chalk.dim(`- ${text}`) }
|
|
30
|
-
};
|
|
31
|
-
esm_default = createPrompt((config, done) => {
|
|
32
|
-
const { choices: items, loop = true, pageSize = 7 } = config;
|
|
33
|
-
const firstRender = useRef(true);
|
|
34
|
-
const theme = makeTheme(selectTheme, config.theme);
|
|
35
|
-
const prefix = usePrefix({ theme });
|
|
36
|
-
const [status, setStatus] = useState("pending");
|
|
37
|
-
const bounds = useMemo(() => {
|
|
38
|
-
const first = items.findIndex(isSelectable);
|
|
39
|
-
const last = items.length - 1 - [...items].reverse().findIndex(isSelectable);
|
|
40
|
-
if (first < 0)
|
|
41
|
-
throw new Error("[select prompt] No selectable choices. All choices are disabled.");
|
|
42
|
-
return { first, last };
|
|
43
|
-
}, [items]);
|
|
44
|
-
const defaultItemIndex = useMemo(() => {
|
|
45
|
-
if (!("default" in config))
|
|
46
|
-
return -1;
|
|
47
|
-
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
|
|
48
|
-
}, [config.default, items]);
|
|
49
|
-
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
50
|
-
const selectedChoice = items[active];
|
|
51
|
-
useKeypress((key) => {
|
|
52
|
-
if (isEnterKey(key)) {
|
|
53
|
-
setStatus("done");
|
|
54
|
-
done(selectedChoice.value);
|
|
55
|
-
} else if (isUpKey(key) || isDownKey(key)) {
|
|
56
|
-
if (loop || isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
|
|
57
|
-
const offset = isUpKey(key) ? -1 : 1;
|
|
58
|
-
let next = active;
|
|
59
|
-
do {
|
|
60
|
-
next = (next + offset + items.length) % items.length;
|
|
61
|
-
} while (!isSelectable(items[next]));
|
|
62
|
-
setActive(next);
|
|
63
|
-
}
|
|
64
|
-
} else if (isNumberKey(key)) {
|
|
65
|
-
const position = Number(key.name) - 1;
|
|
66
|
-
const item = items[position];
|
|
67
|
-
if (item != null && isSelectable(item)) {
|
|
68
|
-
setActive(position);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const message = theme.style.message(config.message);
|
|
73
|
-
let helpTip;
|
|
74
|
-
if (firstRender.current && items.length <= pageSize) {
|
|
75
|
-
firstRender.current = false;
|
|
76
|
-
helpTip = theme.style.help("(Use arrow keys)");
|
|
77
|
-
}
|
|
78
|
-
const page = usePagination({
|
|
79
|
-
items,
|
|
80
|
-
active,
|
|
81
|
-
renderItem({ item, isActive }) {
|
|
82
|
-
if (Separator.isSeparator(item)) {
|
|
83
|
-
return ` ${item.separator}`;
|
|
84
|
-
}
|
|
85
|
-
const line = item.name || item.value;
|
|
86
|
-
if (item.disabled) {
|
|
87
|
-
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
88
|
-
return theme.style.disabled(`${line} ${disabledLabel}`);
|
|
89
|
-
}
|
|
90
|
-
const color = isActive ? theme.style.highlight : (x) => x;
|
|
91
|
-
const cursor = isActive ? theme.icon.cursor : ` `;
|
|
92
|
-
return color(`${cursor} ${line}`);
|
|
93
|
-
},
|
|
94
|
-
pageSize,
|
|
95
|
-
loop,
|
|
96
|
-
theme
|
|
97
|
-
});
|
|
98
|
-
if (status === "done") {
|
|
99
|
-
const answer = selectedChoice.name || // TODO: Could we enforce that at the type level? Name should be defined for non-string values.
|
|
100
|
-
String(selectedChoice.value);
|
|
101
|
-
return `${prefix} ${message} ${theme.style.answer(answer)}`;
|
|
102
|
-
}
|
|
103
|
-
const choiceDescription = selectedChoice.description ? `
|
|
104
|
-
${selectedChoice.description}` : ``;
|
|
105
|
-
return `${[prefix, message, helpTip].filter(Boolean).join(" ")}
|
|
106
|
-
${page}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
1
|
// src/createViteDevServer.ts
|
|
112
2
|
import { createServer as createViteServer } from "vite";
|
|
113
3
|
import { createRequire } from "module";
|
|
@@ -1767,7 +1657,7 @@ function trackUsage(action) {
|
|
|
1767
1657
|
eventName: EVENT_NAME,
|
|
1768
1658
|
action,
|
|
1769
1659
|
nodeVersion: getNodeVersionData(),
|
|
1770
|
-
version: "1.2.
|
|
1660
|
+
version: "1.2.79",
|
|
1771
1661
|
os: getPlatform()
|
|
1772
1662
|
};
|
|
1773
1663
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -5548,7 +5438,7 @@ async function validateHSPlatform(projectConfigPath, portalId, deferSelection) {
|
|
|
5548
5438
|
}
|
|
5549
5439
|
if (platformVersion === void 0 || !platformVersionResult.activePlatformVersions.includes(platformVersion)) {
|
|
5550
5440
|
const promptAndWrite = async () => {
|
|
5551
|
-
const { default: select } = await
|
|
5441
|
+
const { default: select } = await import("@inquirer/select");
|
|
5552
5442
|
const answer = await select({
|
|
5553
5443
|
message: 'Your local "hsproject.json" does not have a valid platform version, please select a valid platform version. You can read more about Platform Versioning here https://developers.hubspot.com/docs/platform/platform-versioning',
|
|
5554
5444
|
choices: platformVersionResult.activePlatformVersions.map(
|
package/dist/island-runtime.js
CHANGED
|
@@ -44,10 +44,14 @@ function isValidHostname(hostname) {
|
|
|
44
44
|
(label) => label.length >= 1 && label.length <= 63 && !label.startsWith("-") && !label.endsWith("-")
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
+
var LOCAL_DEV_HOSTNAMES = ["localhost", "127.0.0.1", "0.0.0.0", "[::1]"];
|
|
47
48
|
function getSecureOverrideUrl(path) {
|
|
48
49
|
const currentUrl = new URL(window.location.toString());
|
|
49
50
|
const overrideHost = currentUrl.searchParams.get("hsDebugOverridePublicHost");
|
|
50
51
|
try {
|
|
52
|
+
if (!LOCAL_DEV_HOSTNAMES.includes(currentUrl.hostname)) {
|
|
53
|
+
throw new Error("Override host is only allowed in local development");
|
|
54
|
+
}
|
|
51
55
|
if (!overrideHost) {
|
|
52
56
|
throw new Error("No override host provided");
|
|
53
57
|
}
|