@hubspot/cms-dev-server 1.2.40 → 1.2.42
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 +1 -1
- package/dist/island-runtime.js +51 -51
- package/dist/run.js +1 -1
- package/package.json +3 -3
- package/dist/.DS_Store +0 -0
- package/types/lib/debugAuth.d.ts +0 -2
- package/types/lib/localComponentsLoader.d.ts +0 -2
- package/types/lib/viteAssetHandler.d.ts +0 -15
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +0 -2
- package/types/plugins/remoteAssetsPlugin.d.ts +0 -7
- package/types/plugins/requestSigningPlugin.d.ts +0 -6
- package/types/routes/createAppServerRoutes.d.ts +0 -5
- package/types/routes/homeRouteHandler.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -1642,7 +1642,7 @@ function trackUsage(action) {
|
|
|
1642
1642
|
eventName: EVENT_NAME,
|
|
1643
1643
|
action,
|
|
1644
1644
|
nodeVersion: getNodeVersionData(),
|
|
1645
|
-
version: "1.2.
|
|
1645
|
+
version: "1.2.42",
|
|
1646
1646
|
os: getPlatform()
|
|
1647
1647
|
};
|
|
1648
1648
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
package/dist/island-runtime.js
CHANGED
|
@@ -73,40 +73,24 @@ var startHydratingIdleRootsTimeout;
|
|
|
73
73
|
var shouldForceSeparateJsForAllIslands = /(&|\?)forceSeparateIslandJs=true/.test(window.location.search);
|
|
74
74
|
var scheduledHydrationIndexCtr = 1;
|
|
75
75
|
var rootsById = /* @__PURE__ */ new Map();
|
|
76
|
-
var scheduledElements = /* @__PURE__ */ new WeakSet();
|
|
77
76
|
var typedWindow = window;
|
|
78
|
-
|
|
79
|
-
if (typeof CSS !== "undefined" && CSS.escape) {
|
|
80
|
-
return Array.from(
|
|
81
|
-
document.querySelectorAll(
|
|
82
|
-
`[data-hs-island][id="${CSS.escape(islandId)}"]`
|
|
83
|
-
)
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
return Array.from(
|
|
87
|
-
document.querySelectorAll("[data-hs-island]")
|
|
88
|
-
).filter((el) => el.id === islandId);
|
|
89
|
-
}
|
|
90
|
-
function prepareAndScheduleRoot(root) {
|
|
91
|
-
root.hydrationStatus = "HYDRATION_PREPARING";
|
|
92
|
-
waitThenLoadAndHydrateIfNeeded(
|
|
93
|
-
root,
|
|
94
|
-
getLoadableModuleFor(root),
|
|
95
|
-
root.wrapperUrl ? getLoadableModuleFor({
|
|
96
|
-
url: root.wrapperUrl,
|
|
97
|
-
id: `${root.id}-wrapper`,
|
|
98
|
-
moduleName: `${root.moduleName}-wrapper`
|
|
99
|
-
}) : void 0
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
function startHydratingIdleRoots() {
|
|
77
|
+
var startHydratingIdleRoots = () => {
|
|
103
78
|
hydrationTypesToAccept.add("idle");
|
|
104
79
|
for (const root of rootsToProcess) {
|
|
105
80
|
if (root.hydrationStatus === "HYDRATION_WAITING" && hydrationTypesToAccept.has(root.hydrateOn)) {
|
|
106
|
-
|
|
81
|
+
root.hydrationStatus = "HYDRATION_PREPARING";
|
|
82
|
+
waitThenLoadAndHydrateIfNeeded(
|
|
83
|
+
root,
|
|
84
|
+
getLoadableModuleFor(root),
|
|
85
|
+
root.wrapperUrl ? getLoadableModuleFor({
|
|
86
|
+
url: root.wrapperUrl,
|
|
87
|
+
id: `${root.id}-wrapper`,
|
|
88
|
+
moduleName: `${root.moduleName}-wrapper`
|
|
89
|
+
}) : void 0
|
|
90
|
+
);
|
|
107
91
|
}
|
|
108
92
|
}
|
|
109
|
-
}
|
|
93
|
+
};
|
|
110
94
|
function setupIdleCallbackIfNeeded() {
|
|
111
95
|
if (!startHydratingIdleRootsTimeout) {
|
|
112
96
|
if (!window.requestIdleCallback) {
|
|
@@ -121,9 +105,9 @@ function setupIdleCallbackIfNeeded() {
|
|
|
121
105
|
);
|
|
122
106
|
}
|
|
123
107
|
}
|
|
124
|
-
function finishHydratingRootAndScheduleNext(
|
|
125
|
-
|
|
126
|
-
hydrationQueue = hydrationQueue.filter((x) => x !==
|
|
108
|
+
function finishHydratingRootAndScheduleNext(rootAndExtraInfo) {
|
|
109
|
+
rootAndExtraInfo.root.hydrationStatus = "HYDRATED";
|
|
110
|
+
hydrationQueue = hydrationQueue.filter((x) => x !== rootAndExtraInfo);
|
|
127
111
|
const hasOtherRootsToHydrate = hydrationQueue.length > 0;
|
|
128
112
|
if (hasOtherRootsToHydrate) {
|
|
129
113
|
setTimeout(() => hydrateRoot(hydrationQueue[0]), 0);
|
|
@@ -131,13 +115,13 @@ function finishHydratingRootAndScheduleNext(entry) {
|
|
|
131
115
|
setupIdleCallbackIfNeeded();
|
|
132
116
|
}
|
|
133
117
|
}
|
|
134
|
-
function hydrateRoot(
|
|
135
|
-
const { rootEl, root, IslandModule, WrapperModule } =
|
|
118
|
+
function hydrateRoot(rootAndExtraInfo) {
|
|
119
|
+
const { rootEl, root, IslandModule, WrapperModule } = rootAndExtraInfo;
|
|
136
120
|
if (window.location.search.includes("hsDebug=")) {
|
|
137
121
|
console.log("Hydrating root", root.id, root.hydrateOn);
|
|
138
122
|
}
|
|
139
123
|
const postHydration = () => {
|
|
140
|
-
finishHydratingRootAndScheduleNext(
|
|
124
|
+
finishHydratingRootAndScheduleNext(rootAndExtraInfo);
|
|
141
125
|
};
|
|
142
126
|
const renderableIsland = {
|
|
143
127
|
rootElement: rootEl,
|
|
@@ -147,17 +131,17 @@ function hydrateRoot(entry) {
|
|
|
147
131
|
postHydration,
|
|
148
132
|
island: root,
|
|
149
133
|
WrapperModule: WrapperModule ? WrapperModule.default : void 0,
|
|
150
|
-
index:
|
|
134
|
+
index: rootAndExtraInfo.islandScheduledIndex
|
|
151
135
|
};
|
|
152
136
|
const reactRoot = IslandModule.render(renderableIsland);
|
|
153
137
|
const existingRoots = rootsById.get(root.id) || [];
|
|
154
138
|
rootsById.set(root.id, [...existingRoots, reactRoot]);
|
|
155
139
|
}
|
|
156
|
-
function pushToHydrationQueue(
|
|
157
|
-
|
|
158
|
-
hydrationQueue.push(
|
|
140
|
+
function pushToHydrationQueue(rootAndExtraInfo) {
|
|
141
|
+
rootAndExtraInfo.root.hydrationStatus = "HYDRATION_QUEUED";
|
|
142
|
+
hydrationQueue.push(rootAndExtraInfo);
|
|
159
143
|
if (hydrationQueue.length === 1) {
|
|
160
|
-
hydrateRoot(
|
|
144
|
+
hydrateRoot(rootAndExtraInfo);
|
|
161
145
|
}
|
|
162
146
|
}
|
|
163
147
|
function loadThenHydrate(root, LoadableIslandModule, LoadableWrapperModule, rootEl, islandScheduledIndex) {
|
|
@@ -177,16 +161,22 @@ function loadThenHydrate(root, LoadableIslandModule, LoadableWrapperModule, root
|
|
|
177
161
|
).catch((error) => {
|
|
178
162
|
console.error(`Failed to load module for island: ${root.id}`);
|
|
179
163
|
console.error(error);
|
|
180
|
-
scheduledElements.delete(rootEl);
|
|
181
164
|
});
|
|
182
165
|
}
|
|
183
166
|
function waitThenLoadAndHydrateIfNeeded(root, LoadableIslandModule, LoadableWrapperModule) {
|
|
184
|
-
|
|
167
|
+
let rootEls;
|
|
168
|
+
if (typeof CSS !== "undefined" && CSS.escape) {
|
|
169
|
+
rootEls = Array.from(
|
|
170
|
+
document.querySelectorAll(
|
|
171
|
+
`[data-hs-island][id="${CSS.escape(root.id)}"]`
|
|
172
|
+
)
|
|
173
|
+
);
|
|
174
|
+
} else {
|
|
175
|
+
rootEls = Array.from(
|
|
176
|
+
document.querySelectorAll("[data-hs-island]")
|
|
177
|
+
).filter((el) => el.id === root.id);
|
|
178
|
+
}
|
|
185
179
|
rootEls.forEach((rootEl) => {
|
|
186
|
-
if (scheduledElements.has(rootEl)) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
scheduledElements.add(rootEl);
|
|
190
180
|
const rootClone = { ...root };
|
|
191
181
|
const islandScheduledIndex = scheduledHydrationIndexCtr;
|
|
192
182
|
scheduledHydrationIndexCtr += 1;
|
|
@@ -221,10 +211,14 @@ function getLoadableModuleFor(root) {
|
|
|
221
211
|
if (shouldForceSeparateJsForAllIslands) {
|
|
222
212
|
url = `${root.url}?cacheBust=${Date.now()}-${root.id}`;
|
|
223
213
|
}
|
|
224
|
-
|
|
214
|
+
const LoadableIslandModule = () => import(
|
|
225
215
|
/* @vite-ignore */
|
|
226
216
|
url
|
|
227
217
|
);
|
|
218
|
+
if (!LoadableIslandModule) {
|
|
219
|
+
throw new Error(`Missing island component for ${root.moduleName}`);
|
|
220
|
+
}
|
|
221
|
+
return LoadableIslandModule;
|
|
228
222
|
}
|
|
229
223
|
function hydrateIslandRoots() {
|
|
230
224
|
if (rootsToProcess === void 0) {
|
|
@@ -239,11 +233,19 @@ function hydrateIslandRoots() {
|
|
|
239
233
|
let encounteredAnyNonIdleIslands = false;
|
|
240
234
|
for (const root of rootsToProcess) {
|
|
241
235
|
if (!root.hydrationStatus) {
|
|
236
|
+
root.hydrationStatus = root.hydrationStatus || "HYDRATION_WAITING";
|
|
242
237
|
if (hydrationTypesToAccept.has(root.hydrateOn)) {
|
|
243
238
|
encounteredAnyNonIdleIslands = true;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
239
|
+
root.hydrationStatus = "HYDRATION_PREPARING";
|
|
240
|
+
waitThenLoadAndHydrateIfNeeded(
|
|
241
|
+
root,
|
|
242
|
+
getLoadableModuleFor(root),
|
|
243
|
+
root.wrapperUrl ? getLoadableModuleFor({
|
|
244
|
+
url: root.wrapperUrl,
|
|
245
|
+
id: `${root.id}-wrapper`,
|
|
246
|
+
moduleName: `${root.moduleName}-wrapper`
|
|
247
|
+
}) : void 0
|
|
248
|
+
);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
}
|
|
@@ -269,8 +271,6 @@ function unmountIsland(islandId) {
|
|
|
269
271
|
const islandIndex = rootsToProcess.indexOf(islandToUnmount);
|
|
270
272
|
rootsToProcess.splice(islandIndex, 1);
|
|
271
273
|
rootsById.delete(islandId);
|
|
272
|
-
const islandEls = findIslandElements(islandId);
|
|
273
|
-
islandEls.forEach((el) => scheduledElements.delete(el));
|
|
274
274
|
console.log("Unmounting island:", islandId);
|
|
275
275
|
for (const reactRoot of reactRoots) {
|
|
276
276
|
reactRoot.unmount();
|
package/dist/run.js
CHANGED
|
@@ -2249,7 +2249,7 @@ function trackUsage(action) {
|
|
|
2249
2249
|
eventName: EVENT_NAME,
|
|
2250
2250
|
action,
|
|
2251
2251
|
nodeVersion: getNodeVersionData(),
|
|
2252
|
-
version: "1.2.
|
|
2252
|
+
version: "1.2.42",
|
|
2253
2253
|
os: getPlatform()
|
|
2254
2254
|
};
|
|
2255
2255
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.42",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/parser": "^7.25.3",
|
|
30
30
|
"@babel/traverse": "^7.25.3",
|
|
31
31
|
"@babel/types": "^7.25.2",
|
|
32
|
-
"@hubspot/cms-components": "^1.2.
|
|
32
|
+
"@hubspot/cms-components": "^1.2.42",
|
|
33
33
|
"@hubspot/local-dev-lib": "5.8.2",
|
|
34
34
|
"@inquirer/select": "^2.0.0",
|
|
35
35
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "41c0d54621457b4b7937a35bcbe045da4e4ced95"
|
|
137
137
|
}
|
package/dist/.DS_Store
DELETED
|
Binary file
|
package/types/lib/debugAuth.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ViteDevServer } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Processes HTML to find remote assets and replace with Vite-managed URLs
|
|
4
|
-
*/
|
|
5
|
-
export declare function processRemoteAssets(html: string, viteServer: ViteDevServer): Promise<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Vite plugin to handle remote assets
|
|
8
|
-
*/
|
|
9
|
-
export declare function remoteAssetsPlugin(): {
|
|
10
|
-
name: string;
|
|
11
|
-
apply: "serve";
|
|
12
|
-
configResolved(config: any): void;
|
|
13
|
-
resolveId(id: string): string;
|
|
14
|
-
load(id: string): Promise<string>;
|
|
15
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
-
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
|
|
4
|
-
export declare function createAppServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
-
export default createAppServerRoutes;
|