@hubspot/cms-dev-server 1.2.82 → 1.2.84

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.
@@ -0,0 +1,438 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/validateFields.ts
4
+ import path3 from "path";
5
+ import fs2 from "fs/promises";
6
+ import {
7
+ createServer as createViteServer,
8
+ normalizePath as normalizePath2
9
+ } from "vite";
10
+ import { createRequire } from "module";
11
+ import { default as react } from "@vitejs/plugin-react";
12
+
13
+ // ../cms-js-internal/dist/types-C8bPIEz4.js
14
+ import path from "path";
15
+ import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
16
+ import { join } from "path/posix";
17
+ var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
18
+ var viteRoot;
19
+ var viteCommand;
20
+ function resolveIslandPlugin(islandsSet) {
21
+ return {
22
+ enforce: "pre",
23
+ name: "resolve-islands",
24
+ configResolved(config) {
25
+ viteRoot = config.root;
26
+ viteCommand = config.command;
27
+ },
28
+ load(id) {
29
+ if (id.endsWith("?island") || id.endsWith("?client")) {
30
+ const [idWithNoParam] = id.split("?");
31
+ const islandModuleImportPath = `${idWithNoParam}?client-entry`;
32
+ const componentExtension = path.extname(idWithNoParam);
33
+ const componentFilenameWithNoExtension = path.basename(
34
+ idWithNoParam,
35
+ componentExtension
36
+ );
37
+ const modulePath = path.relative(viteRoot, idWithNoParam);
38
+ const moduleId = (viteCommand === "serve" ? idWithNoParam : modulePath).concat("?client-entry");
39
+ if (islandsSet) {
40
+ islandsSet.add(moduleId);
41
+ }
42
+ return `
43
+ const moduleId = '${moduleId}';
44
+
45
+ const lazyComponent = () => import('${islandModuleImportPath}');
46
+ lazyComponent.moduleName = '${componentFilenameWithNoExtension}';
47
+ lazyComponent.moduleId = moduleId;
48
+
49
+ export default lazyComponent;
50
+ `;
51
+ }
52
+ return null;
53
+ }
54
+ };
55
+ }
56
+ var clientRenderIsland = "import type { RenderableIsland } from '@hubspot/cms-components';\nimport * as cmsComponents from '@hubspot/cms-components';\nimport { ClientRenderContextProvider } from '@hubspot/cms-components';\nimport { Suspense } from 'react';\nimport ReactDOMClient from 'react-dom/client';\n\nconst buildIslandIdentifierPrefix =\n cmsComponents.buildIslandIdentifierPrefix || ((id) => id);\n\nexport function clientRenderIsland(\n renderableIsland: RenderableIsland,\n Component: React.ComponentType<any>\n) {\n const {\n island,\n rootElement,\n postHydration,\n pageUrl,\n islands,\n basePath,\n WrapperModule,\n } = renderableIsland;\n let reactRoot: any;\n\n const rootOptions = {\n // Ensure useId is unique across island roots\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\n };\n\n let innerComponent = <Component islandId={island.id} {...island.props} />;\n if (WrapperModule) {\n innerComponent = <WrapperModule>{innerComponent}</WrapperModule>;\n }\n\n const elementsToHydrate = (\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\n <ClientRenderContextProvider\n pageUrl={pageUrl}\n islands={islands}\n onTopLevelHydrationFinish={postHydration}\n island={island}\n basePath={basePath}\n >\n {innerComponent}\n </ClientRenderContextProvider>\n </Suspense>\n );\n\n if (island.clientOnly) {\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\n reactRoot.render(elementsToHydrate);\n } else {\n reactRoot = ReactDOMClient.hydrateRoot(\n rootElement,\n elementsToHydrate,\n rootOptions\n );\n }\n return reactRoot;\n}\n";
57
+ var virtualClientRenderIslandModuleId = "virtual:clientRenderIsland.tsx";
58
+ function clientIslandEntryPlugin() {
59
+ return {
60
+ enforce: "pre",
61
+ name: "client-island-entry-plugin",
62
+ resolveId(id) {
63
+ if (id === virtualClientRenderIslandModuleId) {
64
+ return virtualClientRenderIslandModuleId;
65
+ }
66
+ return null;
67
+ },
68
+ load(id) {
69
+ if (id.endsWith("?client-entry")) {
70
+ const [idWithNoParam] = id.split("?");
71
+ return `
72
+ import { clientRenderIsland } from '${virtualClientRenderIslandModuleId}';
73
+ import Component from '${idWithNoParam}';
74
+
75
+ export function render(island) {
76
+ return clientRenderIsland(island, Component)
77
+ }
78
+
79
+ export default Component;
80
+ `;
81
+ }
82
+ if (id === virtualClientRenderIslandModuleId) {
83
+ return clientRenderIsland;
84
+ }
85
+ return null;
86
+ }
87
+ };
88
+ }
89
+ var getComponentExtension = (componentPath) => {
90
+ const filteredExtensions = COMPONENT_EXTENSIONS.filter(
91
+ (ext) => componentPath.endsWith(ext)
92
+ );
93
+ if (filteredExtensions.length === 1) {
94
+ return filteredExtensions[0];
95
+ }
96
+ return void 0;
97
+ };
98
+ var hasComponentExtension = (componentPath) => {
99
+ return !!getComponentExtension(componentPath);
100
+ };
101
+ var isStorybookStory = (componentPath) => {
102
+ return !!path.basename(componentPath, path.extname(componentPath)).endsWith(".stories");
103
+ };
104
+ var removeComponentExtension = (componentPath) => {
105
+ const ext = getComponentExtension(componentPath);
106
+ if (ext == null) {
107
+ return componentPath;
108
+ }
109
+ return componentPath.slice(0, -1 * ext.length);
110
+ };
111
+ var findAllComponentsIn = (webRoot, componentsFolder) => {
112
+ const fullComponentsFolderPath = join(webRoot, componentsFolder);
113
+ const componentsByName = {};
114
+ if (!existsSync(fullComponentsFolderPath)) {
115
+ return componentsByName;
116
+ }
117
+ readdirSync(fullComponentsFolderPath).forEach((fileOrFolderName) => {
118
+ const fullPath = join(fullComponentsFolderPath, fileOrFolderName);
119
+ const subdirPath = join(componentsFolder, fileOrFolderName);
120
+ const isDirectory = lstatSync(fullPath).isDirectory();
121
+ if (!isDirectory && hasComponentExtension(fileOrFolderName) && !isStorybookStory(fileOrFolderName)) {
122
+ const subdirPathNoExtension = removeComponentExtension(subdirPath);
123
+ componentsByName[subdirPathNoExtension] = subdirPath;
124
+ } else if (isDirectory) {
125
+ for (const potentialExtension of COMPONENT_EXTENSIONS) {
126
+ const potentialIndexModule = join(
127
+ subdirPath,
128
+ `index${potentialExtension}`
129
+ );
130
+ const fullPotentialPath = join(
131
+ fullPath,
132
+ `index${potentialExtension}`
133
+ );
134
+ if (existsSync(fullPotentialPath)) {
135
+ const moduleIndexPathNoExtension = removeComponentExtension(potentialIndexModule);
136
+ componentsByName[moduleIndexPathNoExtension] = potentialIndexModule;
137
+ break;
138
+ }
139
+ }
140
+ }
141
+ });
142
+ return componentsByName;
143
+ };
144
+ function findAllModulesInRoot(webRoot) {
145
+ const allModuleComponents = findAllComponentsIn(
146
+ webRoot,
147
+ "./components/modules"
148
+ );
149
+ const moduleNames = Object.keys(allModuleComponents).map(
150
+ (moduleSubpath) => moduleSubpath.replace("components/modules/", "").replace("/index", "")
151
+ );
152
+ const moduleSubpaths = Object.keys(allModuleComponents);
153
+ const moduleExtensions = Object.values(allModuleComponents).map((path22) => {
154
+ if (!path22)
155
+ return "";
156
+ const extension = path22.split(".").pop() || "";
157
+ return extension;
158
+ });
159
+ const moduleNamesWithExtension = Object.values(allModuleComponents).map(
160
+ (path22) => {
161
+ if (!path22)
162
+ return "";
163
+ const file = path22.replace("components/modules/", "");
164
+ return file.includes("/index.") ? file.split("/index.")[0] : file;
165
+ }
166
+ );
167
+ return {
168
+ moduleNames,
169
+ moduleSubpaths,
170
+ moduleNamesWithExtension,
171
+ moduleExtensions
172
+ };
173
+ }
174
+
175
+ // ../cms-js-internal/dist/index.js
176
+ import * as dotProp from "dot-prop";
177
+ import _traverse from "@babel/traverse";
178
+ import * as cmsComponents from "@hubspot/cms-components";
179
+ var { setProperty, getProperty, hasProperty } = dotProp;
180
+ function noncePlaceholderPlugin() {
181
+ const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === "true";
182
+ return {
183
+ name: "hs-nonce-placeholder",
184
+ enforce: "post",
185
+ apply() {
186
+ return HS_DEPLOYED;
187
+ },
188
+ transformIndexHtml(html) {
189
+ const regex = /<(style|script|link) (.*)>/gi;
190
+ const replacer = (_, p1, p2) => {
191
+ if (p1 === "style" || p1 === "script" || // if link, only nonce for stylesheet
192
+ p1 === "link" && p2.includes('rel="stylesheet"')) {
193
+ const noncePlaceholderValue = p1 === "script" ? "hs-random-nonce" : "hs-random-style-nonce";
194
+ p2 = `nonce="${noncePlaceholderValue}" ${p2}`;
195
+ }
196
+ return `<${p1} ${p2}>`;
197
+ };
198
+ return html.replace(regex, replacer);
199
+ }
200
+ };
201
+ }
202
+ var traverse = _traverse.default;
203
+ var {
204
+ createServerRenderContextV2: createServerRenderContextV22,
205
+ createServerRenderContext: createServerRenderContext2,
206
+ renderServerSidePropsWithAsyncLocalStoreContext
207
+ } = cmsComponents;
208
+
209
+ // src/validateFields.ts
210
+ import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
211
+
212
+ // src/lib/renderModuleFieldsJson.ts
213
+ import { join as joinPosix } from "path/posix";
214
+
215
+ // src/lib/packagePath.ts
216
+ import path2 from "path";
217
+ import url from "url";
218
+ import { normalizePath } from "vite";
219
+ function packagePath(metaUrl, projectPath) {
220
+ if (true) {
221
+ return normalizePath(
222
+ path2.resolve(path2.dirname(url.fileURLToPath(metaUrl)), projectPath)
223
+ );
224
+ }
225
+ const parentDirPath = normalizePath(path2.dirname(url.fileURLToPath(metaUrl)));
226
+ const subPath = parentDirPath.replace(/^.+cms-dev-server\/src\//, "");
227
+ const subPathParentDirs = subPath.split("/").map(() => "..");
228
+ return path2.resolve(
229
+ path2.dirname(url.fileURLToPath(metaUrl)),
230
+ path2.join(...subPathParentDirs, projectPath)
231
+ );
232
+ }
233
+
234
+ // src/lib/renderModuleFieldsJson.ts
235
+ var lookForModuleInFolder = async (modulePath, viteServer) => {
236
+ let componentModule;
237
+ const insideFolderPath = joinPosix(modulePath, "index");
238
+ try {
239
+ componentModule = await viteServer.ssrLoadModule(insideFolderPath);
240
+ } catch (e) {
241
+ if (!e.message.includes("Failed to load url")) {
242
+ throw e;
243
+ }
244
+ }
245
+ return [componentModule, insideFolderPath];
246
+ };
247
+ async function renderModuleFieldsJson(viteServer, requestedModulePath) {
248
+ let componentModule;
249
+ try {
250
+ if (!hasComponentExtension(requestedModulePath)) {
251
+ [componentModule] = await lookForModuleInFolder(
252
+ requestedModulePath,
253
+ viteServer
254
+ );
255
+ }
256
+ if (!componentModule) {
257
+ componentModule = await viteServer.ssrLoadModule(requestedModulePath);
258
+ }
259
+ } catch (error) {
260
+ throw new Error(
261
+ `Failed to load module ${requestedModulePath}: ${error.message}`
262
+ );
263
+ }
264
+ if (!componentModule) {
265
+ throw new Error(`Couldn't find module: ${requestedModulePath}`);
266
+ }
267
+ const internalSsrPath = packagePath(import.meta.url, "internalSsr");
268
+ const { renderFieldsToJson } = await viteServer.ssrLoadModule(internalSsrPath);
269
+ const fieldsJson = renderFieldsToJson(
270
+ componentModule.fields,
271
+ requestedModulePath
272
+ );
273
+ return fieldsJson;
274
+ }
275
+ var renderModuleFieldsJson_default = renderModuleFieldsJson;
276
+
277
+ // ../cms-js-internal/dist/buildFieldsTypes.js
278
+ var CMS_COMPONENTS = "@hubspot/cms-components";
279
+ var CMS_COMPONENTS_FIELD_TYPES = `${CMS_COMPONENTS}/fields`;
280
+
281
+ // src/lib/renderModule.ts
282
+ import * as cmsComponents2 from "@hubspot/cms-components";
283
+ var { filterToModuleDataDepsIncludedIn, getModuleDataDependecyTypeFrom } = cmsComponents2;
284
+
285
+ // src/validateFields.ts
286
+ async function generateAndWriteFieldsJson(absoluteModulePath, modulePath, viteServer) {
287
+ let fieldsJson;
288
+ try {
289
+ fieldsJson = await renderModuleFieldsJson_default(viteServer, absoluteModulePath);
290
+ } catch {
291
+ return {
292
+ severity: "FATAL",
293
+ errorType: "MODULE_BUILD_ERROR",
294
+ message: `Failed to SSR-load module at ${modulePath}`
295
+ };
296
+ }
297
+ if (!Array.isArray(fieldsJson)) {
298
+ return {
299
+ severity: "FATAL",
300
+ errorType: "INVALID_FIELDS",
301
+ message: `renderModuleFieldsJson returned non-array for ${modulePath}`
302
+ };
303
+ }
304
+ const fieldsJsonPath = path3.join(absoluteModulePath, "fields.json");
305
+ await fs2.writeFile(fieldsJsonPath, JSON.stringify(fieldsJson, null, 2));
306
+ return { fieldsJson, fieldsJsonPath };
307
+ }
308
+ async function generateSingleModule(modulePath, absoluteRoot, viteServer) {
309
+ const absoluteModulePath = path3.resolve(absoluteRoot, modulePath);
310
+ let files;
311
+ try {
312
+ files = await fs2.readdir(absoluteModulePath);
313
+ } catch {
314
+ return {
315
+ fieldsJsonPath: "",
316
+ fieldErrors: [
317
+ {
318
+ severity: "FATAL",
319
+ errorType: "MODULE_NOT_FOUND",
320
+ message: `Module directory does not exist: ${modulePath}`
321
+ }
322
+ ]
323
+ };
324
+ }
325
+ const indexFile = files.find((f) => f.startsWith("index."));
326
+ if (!indexFile) {
327
+ return {
328
+ fieldsJsonPath: "",
329
+ fieldErrors: [
330
+ {
331
+ severity: "FATAL",
332
+ errorType: "NO_INDEX_FILE",
333
+ message: `No index file found in ${modulePath}`
334
+ }
335
+ ]
336
+ };
337
+ }
338
+ const jsonResult = await generateAndWriteFieldsJson(
339
+ absoluteModulePath,
340
+ modulePath,
341
+ viteServer
342
+ );
343
+ if ("severity" in jsonResult) {
344
+ return { fieldsJsonPath: "", fieldErrors: [jsonResult] };
345
+ }
346
+ return {
347
+ fieldsJsonPath: jsonResult.fieldsJsonPath,
348
+ fieldErrors: [],
349
+ fieldsJson: jsonResult.fieldsJson,
350
+ indexFile
351
+ };
352
+ }
353
+ async function forEachModule(projectRoot, moduleName, run) {
354
+ const absoluteRoot = normalizePath2(path3.resolve(process.cwd(), projectRoot));
355
+ const moduleNames = moduleName ? [moduleName] : findAllModulesInRoot(absoluteRoot).moduleNames;
356
+ if (moduleNames.length === 0) {
357
+ throw new Error(
358
+ `No modules found in ${path3.join(absoluteRoot, "components/modules")}`
359
+ );
360
+ }
361
+ const require2 = createRequire(import.meta.url);
362
+ const viteServer = await createViteServer({
363
+ configFile: false,
364
+ logLevel: "silent",
365
+ appType: "custom",
366
+ root: absoluteRoot,
367
+ cacheDir: path3.join(absoluteRoot, "node_modules/.vite-validate-fields"),
368
+ server: { middlewareMode: true, hmr: false },
369
+ optimizeDeps: { noDiscovery: true, include: [] },
370
+ ssr: { noExternal: "@hubspot/cms-components" },
371
+ resolve: {
372
+ conditions: ["server"],
373
+ dedupe: ["react", "react-dom", "@hubspot/cms-components", "styled-jsx"]
374
+ },
375
+ plugins: [
376
+ react({
377
+ babel: {
378
+ plugins: [
379
+ require2.resolve("babel-plugin-styled-components"),
380
+ require2.resolve("styled-jsx/babel"),
381
+ require2.resolve("babel-plugin-macros")
382
+ ]
383
+ }
384
+ }),
385
+ clientIslandEntryPlugin(),
386
+ resolveIslandPlugin(),
387
+ viteCommonjs(),
388
+ noncePlaceholderPlugin()
389
+ ]
390
+ });
391
+ try {
392
+ return await Promise.all(
393
+ moduleNames.map(
394
+ (name) => run(`components/modules/${name}`, absoluteRoot, viteServer)
395
+ )
396
+ );
397
+ } finally {
398
+ await viteServer.close();
399
+ }
400
+ }
401
+ async function generateModuleFields(projectRoot, moduleName) {
402
+ const generated = await forEachModule(
403
+ projectRoot,
404
+ moduleName,
405
+ generateSingleModule
406
+ );
407
+ return generated.map(({ fieldsJsonPath, fieldsJson, fieldErrors }) => ({
408
+ fieldsJsonPath,
409
+ fieldsJson: fieldsJson ?? null,
410
+ fieldErrors
411
+ }));
412
+ }
413
+ async function runModuleFieldsCli(commandName, command) {
414
+ const projectPath = process.argv[2];
415
+ const moduleIdx = process.argv.indexOf("--module");
416
+ const moduleName = moduleIdx !== -1 ? process.argv[moduleIdx + 1] : void 0;
417
+ if (!projectPath) {
418
+ console.error(`Usage: ${commandName} <path> [--module <name>]`);
419
+ process.exitCode = 1;
420
+ return;
421
+ }
422
+ try {
423
+ const results = await command(projectPath, moduleName);
424
+ console.log(JSON.stringify(results, null, 2));
425
+ const hasErrors = results.some(
426
+ (r) => r.fieldErrors.length > 0 || (r.metaErrors ?? []).length > 0
427
+ );
428
+ process.exitCode = hasErrors ? 1 : 0;
429
+ } catch (error) {
430
+ console.error("An error occurred:", error);
431
+ process.exitCode = 1;
432
+ }
433
+ }
434
+
435
+ // src/generateFieldsCli.ts
436
+ runModuleFieldsCli("generate-fields", generateModuleFields).catch((error) => {
437
+ throw error;
438
+ });
package/dist/index.js CHANGED
@@ -1659,7 +1659,7 @@ function trackUsage(action) {
1659
1659
  eventName: EVENT_NAME,
1660
1660
  action,
1661
1661
  nodeVersion: getNodeVersionData(),
1662
- version: "1.2.82",
1662
+ version: "1.2.84",
1663
1663
  os: getPlatform()
1664
1664
  };
1665
1665
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -3903,6 +3903,7 @@ function getFieldEntries(fields) {
3903
3903
  // Choices are pair [value, label] but only the value is printed to the page, so flatten it.
3904
3904
  "choices" in field ? field.choices.map(([value, label]) => value) : void 0
3905
3905
  ),
3906
+ multiple: field.type === "choice" ? field.multiple === true : void 0,
3906
3907
  children: []
3907
3908
  };
3908
3909
  if (fieldType === "GroupFieldType" && "children" in field) {
@@ -3940,7 +3941,8 @@ var buildTypeFromField = (field, additionalNode) => {
3940
3941
  ]);
3941
3942
  let finalType = field.isRequired ? requiredType : baseType;
3942
3943
  if (field.choices) {
3943
- finalType = createUnionTypeFromArray(field.choices);
3944
+ const choiceType = createUnionTypeFromArray(field.choices);
3945
+ finalType = field.multiple ? ts.factory.createTypeReferenceNode("Array", [choiceType]) : choiceType;
3944
3946
  }
3945
3947
  if (field.isRequired) {
3946
3948
  imports.push(REQUIRED_TYPE);
@@ -4277,39 +4279,34 @@ async function extractAndValidateFields(fieldsJson, metaJson, modulePath) {
4277
4279
  ]
4278
4280
  };
4279
4281
  }
4280
- async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4282
+ async function generateSingleModule(modulePath, absoluteRoot, viteServer) {
4281
4283
  const absoluteModulePath = path11.resolve(absoluteRoot, modulePath);
4282
- const moduleDir = path11.basename(modulePath);
4283
4284
  let files;
4284
4285
  try {
4285
4286
  files = await fs5.readdir(absoluteModulePath);
4286
4287
  } catch {
4287
4288
  return {
4288
4289
  fieldsJsonPath: "",
4289
- fieldsTypePath: "",
4290
4290
  fieldErrors: [
4291
4291
  {
4292
4292
  severity: "FATAL",
4293
4293
  errorType: "MODULE_NOT_FOUND",
4294
4294
  message: `Module directory does not exist: ${modulePath}`
4295
4295
  }
4296
- ],
4297
- metaErrors: []
4296
+ ]
4298
4297
  };
4299
4298
  }
4300
4299
  const indexFile = files.find((f) => f.startsWith("index."));
4301
4300
  if (!indexFile) {
4302
4301
  return {
4303
4302
  fieldsJsonPath: "",
4304
- fieldsTypePath: "",
4305
4303
  fieldErrors: [
4306
4304
  {
4307
4305
  severity: "FATAL",
4308
4306
  errorType: "NO_INDEX_FILE",
4309
4307
  message: `No index file found in ${modulePath}`
4310
4308
  }
4311
- ],
4312
- metaErrors: []
4309
+ ]
4313
4310
  };
4314
4311
  }
4315
4312
  const jsonResult = await generateAndWriteFieldsJson(
@@ -4318,27 +4315,36 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4318
4315
  viteServer
4319
4316
  );
4320
4317
  if ("severity" in jsonResult) {
4321
- return {
4322
- fieldsJsonPath: "",
4323
- fieldsTypePath: "",
4324
- fieldErrors: [jsonResult],
4325
- metaErrors: []
4326
- };
4318
+ return { fieldsJsonPath: "", fieldErrors: [jsonResult] };
4319
+ }
4320
+ return {
4321
+ fieldsJsonPath: jsonResult.fieldsJsonPath,
4322
+ fieldErrors: [],
4323
+ fieldsJson: jsonResult.fieldsJson,
4324
+ indexFile
4325
+ };
4326
+ }
4327
+ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4328
+ const { fieldsJsonPath, fieldErrors, fieldsJson, indexFile } = await generateSingleModule(modulePath, absoluteRoot, viteServer);
4329
+ if (!fieldsJson || !indexFile) {
4330
+ return { fieldsJsonPath, fieldsTypePath: "", fieldErrors, metaErrors: [] };
4327
4331
  }
4332
+ const absoluteModulePath = path11.resolve(absoluteRoot, modulePath);
4328
4333
  const typeResult = await generateAndWriteFieldsType(
4329
4334
  absoluteModulePath,
4330
4335
  modulePath,
4331
- moduleDir,
4332
- jsonResult.fieldsJson
4336
+ path11.basename(modulePath),
4337
+ fieldsJson
4333
4338
  );
4334
4339
  if ("severity" in typeResult) {
4335
4340
  return {
4336
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4341
+ fieldsJsonPath,
4337
4342
  fieldsTypePath: "",
4338
4343
  fieldErrors: [typeResult],
4339
4344
  metaErrors: []
4340
4345
  };
4341
4346
  }
4347
+ const { fieldsTypePath } = typeResult;
4342
4348
  let mod;
4343
4349
  try {
4344
4350
  mod = await viteServer.ssrLoadModule(
@@ -4346,8 +4352,8 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4346
4352
  );
4347
4353
  } catch {
4348
4354
  return {
4349
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4350
- fieldsTypePath: typeResult.fieldsTypePath,
4355
+ fieldsJsonPath,
4356
+ fieldsTypePath,
4351
4357
  fieldErrors: [
4352
4358
  {
4353
4359
  severity: "FATAL",
@@ -4358,17 +4364,12 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4358
4364
  metaErrors: []
4359
4365
  };
4360
4366
  }
4361
- const { fieldErrors, metaErrors } = await extractAndValidateFields(
4362
- jsonResult.fieldsJson,
4367
+ const validation = await extractAndValidateFields(
4368
+ fieldsJson,
4363
4369
  mod.meta,
4364
4370
  modulePath
4365
4371
  );
4366
- return {
4367
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4368
- fieldsTypePath: typeResult.fieldsTypePath,
4369
- fieldErrors,
4370
- metaErrors
4371
- };
4372
+ return { fieldsJsonPath, fieldsTypePath, ...validation };
4372
4373
  }
4373
4374
 
4374
4375
  // src/routes/moduleValidateFields.ts
package/dist/run.js CHANGED
@@ -2258,7 +2258,7 @@ function trackUsage(action) {
2258
2258
  eventName: EVENT_NAME,
2259
2259
  action,
2260
2260
  nodeVersion: getNodeVersionData(),
2261
- version: "1.2.82",
2261
+ version: "1.2.84",
2262
2262
  os: getPlatform()
2263
2263
  };
2264
2264
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -4502,6 +4502,7 @@ function getFieldEntries(fields) {
4502
4502
  // Choices are pair [value, label] but only the value is printed to the page, so flatten it.
4503
4503
  "choices" in field ? field.choices.map(([value, label]) => value) : void 0
4504
4504
  ),
4505
+ multiple: field.type === "choice" ? field.multiple === true : void 0,
4505
4506
  children: []
4506
4507
  };
4507
4508
  if (fieldType === "GroupFieldType" && "children" in field) {
@@ -4539,7 +4540,8 @@ var buildTypeFromField = (field, additionalNode) => {
4539
4540
  ]);
4540
4541
  let finalType = field.isRequired ? requiredType : baseType;
4541
4542
  if (field.choices) {
4542
- finalType = createUnionTypeFromArray(field.choices);
4543
+ const choiceType = createUnionTypeFromArray(field.choices);
4544
+ finalType = field.multiple ? ts.factory.createTypeReferenceNode("Array", [choiceType]) : choiceType;
4543
4545
  }
4544
4546
  if (field.isRequired) {
4545
4547
  imports.push(REQUIRED_TYPE);
@@ -4876,39 +4878,34 @@ async function extractAndValidateFields(fieldsJson, metaJson, modulePath) {
4876
4878
  ]
4877
4879
  };
4878
4880
  }
4879
- async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4881
+ async function generateSingleModule(modulePath, absoluteRoot, viteServer) {
4880
4882
  const absoluteModulePath = path13.resolve(absoluteRoot, modulePath);
4881
- const moduleDir = path13.basename(modulePath);
4882
4883
  let files;
4883
4884
  try {
4884
4885
  files = await fs7.readdir(absoluteModulePath);
4885
4886
  } catch {
4886
4887
  return {
4887
4888
  fieldsJsonPath: "",
4888
- fieldsTypePath: "",
4889
4889
  fieldErrors: [
4890
4890
  {
4891
4891
  severity: "FATAL",
4892
4892
  errorType: "MODULE_NOT_FOUND",
4893
4893
  message: `Module directory does not exist: ${modulePath}`
4894
4894
  }
4895
- ],
4896
- metaErrors: []
4895
+ ]
4897
4896
  };
4898
4897
  }
4899
4898
  const indexFile = files.find((f) => f.startsWith("index."));
4900
4899
  if (!indexFile) {
4901
4900
  return {
4902
4901
  fieldsJsonPath: "",
4903
- fieldsTypePath: "",
4904
4902
  fieldErrors: [
4905
4903
  {
4906
4904
  severity: "FATAL",
4907
4905
  errorType: "NO_INDEX_FILE",
4908
4906
  message: `No index file found in ${modulePath}`
4909
4907
  }
4910
- ],
4911
- metaErrors: []
4908
+ ]
4912
4909
  };
4913
4910
  }
4914
4911
  const jsonResult = await generateAndWriteFieldsJson(
@@ -4917,27 +4914,36 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4917
4914
  viteServer
4918
4915
  );
4919
4916
  if ("severity" in jsonResult) {
4920
- return {
4921
- fieldsJsonPath: "",
4922
- fieldsTypePath: "",
4923
- fieldErrors: [jsonResult],
4924
- metaErrors: []
4925
- };
4917
+ return { fieldsJsonPath: "", fieldErrors: [jsonResult] };
4918
+ }
4919
+ return {
4920
+ fieldsJsonPath: jsonResult.fieldsJsonPath,
4921
+ fieldErrors: [],
4922
+ fieldsJson: jsonResult.fieldsJson,
4923
+ indexFile
4924
+ };
4925
+ }
4926
+ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4927
+ const { fieldsJsonPath, fieldErrors, fieldsJson, indexFile } = await generateSingleModule(modulePath, absoluteRoot, viteServer);
4928
+ if (!fieldsJson || !indexFile) {
4929
+ return { fieldsJsonPath, fieldsTypePath: "", fieldErrors, metaErrors: [] };
4926
4930
  }
4931
+ const absoluteModulePath = path13.resolve(absoluteRoot, modulePath);
4927
4932
  const typeResult = await generateAndWriteFieldsType(
4928
4933
  absoluteModulePath,
4929
4934
  modulePath,
4930
- moduleDir,
4931
- jsonResult.fieldsJson
4935
+ path13.basename(modulePath),
4936
+ fieldsJson
4932
4937
  );
4933
4938
  if ("severity" in typeResult) {
4934
4939
  return {
4935
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4940
+ fieldsJsonPath,
4936
4941
  fieldsTypePath: "",
4937
4942
  fieldErrors: [typeResult],
4938
4943
  metaErrors: []
4939
4944
  };
4940
4945
  }
4946
+ const { fieldsTypePath } = typeResult;
4941
4947
  let mod;
4942
4948
  try {
4943
4949
  mod = await viteServer.ssrLoadModule(
@@ -4945,8 +4951,8 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4945
4951
  );
4946
4952
  } catch {
4947
4953
  return {
4948
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4949
- fieldsTypePath: typeResult.fieldsTypePath,
4954
+ fieldsJsonPath,
4955
+ fieldsTypePath,
4950
4956
  fieldErrors: [
4951
4957
  {
4952
4958
  severity: "FATAL",
@@ -4957,17 +4963,12 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
4957
4963
  metaErrors: []
4958
4964
  };
4959
4965
  }
4960
- const { fieldErrors, metaErrors } = await extractAndValidateFields(
4961
- jsonResult.fieldsJson,
4966
+ const validation = await extractAndValidateFields(
4967
+ fieldsJson,
4962
4968
  mod.meta,
4963
4969
  modulePath
4964
4970
  );
4965
- return {
4966
- fieldsJsonPath: jsonResult.fieldsJsonPath,
4967
- fieldsTypePath: typeResult.fieldsTypePath,
4968
- fieldErrors,
4969
- metaErrors
4970
- };
4971
+ return { fieldsJsonPath, fieldsTypePath, ...validation };
4971
4972
  }
4972
4973
 
4973
4974
  // src/routes/moduleValidateFields.ts
@@ -3,7 +3,10 @@
3
3
  // src/validateFields.ts
4
4
  import path3 from "path";
5
5
  import fs3 from "fs/promises";
6
- import { createServer as createViteServer, normalizePath as normalizePath2 } from "vite";
6
+ import {
7
+ createServer as createViteServer,
8
+ normalizePath as normalizePath2
9
+ } from "vite";
7
10
  import { createRequire } from "module";
8
11
  import { default as react } from "@vitejs/plugin-react";
9
12
 
@@ -341,6 +344,7 @@ function getFieldEntries(fields) {
341
344
  // Choices are pair [value, label] but only the value is printed to the page, so flatten it.
342
345
  "choices" in field ? field.choices.map(([value, label]) => value) : void 0
343
346
  ),
347
+ multiple: field.type === "choice" ? field.multiple === true : void 0,
344
348
  children: []
345
349
  };
346
350
  if (fieldType === "GroupFieldType" && "children" in field) {
@@ -378,7 +382,8 @@ var buildTypeFromField = (field, additionalNode) => {
378
382
  ]);
379
383
  let finalType = field.isRequired ? requiredType : baseType;
380
384
  if (field.choices) {
381
- finalType = createUnionTypeFromArray(field.choices);
385
+ const choiceType = createUnionTypeFromArray(field.choices);
386
+ finalType = field.multiple ? ts.factory.createTypeReferenceNode("Array", [choiceType]) : choiceType;
382
387
  }
383
388
  if (field.isRequired) {
384
389
  imports.push(REQUIRED_TYPE);
@@ -630,39 +635,34 @@ async function extractAndValidateFields(fieldsJson, metaJson, modulePath) {
630
635
  ]
631
636
  };
632
637
  }
633
- async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
638
+ async function generateSingleModule(modulePath, absoluteRoot, viteServer) {
634
639
  const absoluteModulePath = path3.resolve(absoluteRoot, modulePath);
635
- const moduleDir = path3.basename(modulePath);
636
640
  let files;
637
641
  try {
638
642
  files = await fs3.readdir(absoluteModulePath);
639
643
  } catch {
640
644
  return {
641
645
  fieldsJsonPath: "",
642
- fieldsTypePath: "",
643
646
  fieldErrors: [
644
647
  {
645
648
  severity: "FATAL",
646
649
  errorType: "MODULE_NOT_FOUND",
647
650
  message: `Module directory does not exist: ${modulePath}`
648
651
  }
649
- ],
650
- metaErrors: []
652
+ ]
651
653
  };
652
654
  }
653
655
  const indexFile = files.find((f) => f.startsWith("index."));
654
656
  if (!indexFile) {
655
657
  return {
656
658
  fieldsJsonPath: "",
657
- fieldsTypePath: "",
658
659
  fieldErrors: [
659
660
  {
660
661
  severity: "FATAL",
661
662
  errorType: "NO_INDEX_FILE",
662
663
  message: `No index file found in ${modulePath}`
663
664
  }
664
- ],
665
- metaErrors: []
665
+ ]
666
666
  };
667
667
  }
668
668
  const jsonResult = await generateAndWriteFieldsJson(
@@ -671,27 +671,36 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
671
671
  viteServer
672
672
  );
673
673
  if ("severity" in jsonResult) {
674
- return {
675
- fieldsJsonPath: "",
676
- fieldsTypePath: "",
677
- fieldErrors: [jsonResult],
678
- metaErrors: []
679
- };
674
+ return { fieldsJsonPath: "", fieldErrors: [jsonResult] };
680
675
  }
676
+ return {
677
+ fieldsJsonPath: jsonResult.fieldsJsonPath,
678
+ fieldErrors: [],
679
+ fieldsJson: jsonResult.fieldsJson,
680
+ indexFile
681
+ };
682
+ }
683
+ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
684
+ const { fieldsJsonPath, fieldErrors, fieldsJson, indexFile } = await generateSingleModule(modulePath, absoluteRoot, viteServer);
685
+ if (!fieldsJson || !indexFile) {
686
+ return { fieldsJsonPath, fieldsTypePath: "", fieldErrors, metaErrors: [] };
687
+ }
688
+ const absoluteModulePath = path3.resolve(absoluteRoot, modulePath);
681
689
  const typeResult = await generateAndWriteFieldsType(
682
690
  absoluteModulePath,
683
691
  modulePath,
684
- moduleDir,
685
- jsonResult.fieldsJson
692
+ path3.basename(modulePath),
693
+ fieldsJson
686
694
  );
687
695
  if ("severity" in typeResult) {
688
696
  return {
689
- fieldsJsonPath: jsonResult.fieldsJsonPath,
697
+ fieldsJsonPath,
690
698
  fieldsTypePath: "",
691
699
  fieldErrors: [typeResult],
692
700
  metaErrors: []
693
701
  };
694
702
  }
703
+ const { fieldsTypePath } = typeResult;
695
704
  let mod;
696
705
  try {
697
706
  mod = await viteServer.ssrLoadModule(
@@ -699,8 +708,8 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
699
708
  );
700
709
  } catch {
701
710
  return {
702
- fieldsJsonPath: jsonResult.fieldsJsonPath,
703
- fieldsTypePath: typeResult.fieldsTypePath,
711
+ fieldsJsonPath,
712
+ fieldsTypePath,
704
713
  fieldErrors: [
705
714
  {
706
715
  severity: "FATAL",
@@ -711,20 +720,21 @@ async function validateSingleModule(modulePath, absoluteRoot, viteServer) {
711
720
  metaErrors: []
712
721
  };
713
722
  }
714
- const { fieldErrors, metaErrors } = await extractAndValidateFields(
715
- jsonResult.fieldsJson,
723
+ const validation = await extractAndValidateFields(
724
+ fieldsJson,
716
725
  mod.meta,
717
726
  modulePath
718
727
  );
719
- return {
720
- fieldsJsonPath: jsonResult.fieldsJsonPath,
721
- fieldsTypePath: typeResult.fieldsTypePath,
722
- fieldErrors,
723
- metaErrors
724
- };
728
+ return { fieldsJsonPath, fieldsTypePath, ...validation };
725
729
  }
726
- async function validateModuleFields(projectRoot, moduleName) {
730
+ async function forEachModule(projectRoot, moduleName, run) {
727
731
  const absoluteRoot = normalizePath2(path3.resolve(process.cwd(), projectRoot));
732
+ const moduleNames = moduleName ? [moduleName] : findAllModulesInRoot(absoluteRoot).moduleNames;
733
+ if (moduleNames.length === 0) {
734
+ throw new Error(
735
+ `No modules found in ${path3.join(absoluteRoot, "components/modules")}`
736
+ );
737
+ }
728
738
  const require2 = createRequire(import.meta.url);
729
739
  const viteServer = await createViteServer({
730
740
  configFile: false,
@@ -756,53 +766,41 @@ async function validateModuleFields(projectRoot, moduleName) {
756
766
  ]
757
767
  });
758
768
  try {
759
- if (moduleName) {
760
- return [
761
- await validateSingleModule(
762
- `components/modules/${moduleName}`,
763
- absoluteRoot,
764
- viteServer
765
- )
766
- ];
767
- }
768
- const { moduleNames } = findAllModulesInRoot(absoluteRoot);
769
- const modulePaths = moduleNames.map(
770
- (name) => `components/modules/${name}`
771
- );
772
769
  return await Promise.all(
773
- modulePaths.map(
774
- (mp) => validateSingleModule(mp, absoluteRoot, viteServer)
770
+ moduleNames.map(
771
+ (name) => run(`components/modules/${name}`, absoluteRoot, viteServer)
775
772
  )
776
773
  );
777
774
  } finally {
778
775
  await viteServer.close();
779
776
  }
780
777
  }
781
-
782
- // src/validateFieldsCli.ts
783
- function parseCommandArgs() {
778
+ function validateModuleFields(projectRoot, moduleName) {
779
+ return forEachModule(projectRoot, moduleName, validateSingleModule);
780
+ }
781
+ async function runModuleFieldsCli(commandName, command) {
784
782
  const projectPath = process.argv[2];
785
783
  const moduleIdx = process.argv.indexOf("--module");
786
784
  const moduleName = moduleIdx !== -1 ? process.argv[moduleIdx + 1] : void 0;
787
785
  if (!projectPath) {
788
- console.error("Usage: validate-fields <path> [--module <name>]");
789
- process.exit(1);
786
+ console.error(`Usage: ${commandName} <path> [--module <name>]`);
787
+ process.exitCode = 1;
788
+ return;
790
789
  }
791
- return { projectPath, moduleName };
792
- }
793
- (async () => {
794
790
  try {
795
- const { projectPath, moduleName } = parseCommandArgs();
796
- const results = await validateModuleFields(projectPath, moduleName);
791
+ const results = await command(projectPath, moduleName);
797
792
  console.log(JSON.stringify(results, null, 2));
798
793
  const hasErrors = results.some(
799
- (r) => r.fieldErrors.length > 0 || r.metaErrors.length > 0
794
+ (r) => r.fieldErrors.length > 0 || (r.metaErrors ?? []).length > 0
800
795
  );
801
796
  process.exitCode = hasErrors ? 1 : 0;
802
797
  } catch (error) {
803
798
  console.error("An error occurred:", error);
804
799
  process.exitCode = 1;
805
800
  }
806
- })().catch((error) => {
801
+ }
802
+
803
+ // src/validateFieldsCli.ts
804
+ runModuleFieldsCli("validate-fields", validateModuleFields).catch((error) => {
807
805
  throw error;
808
806
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.82",
3
+ "version": "1.2.84",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,8 +29,8 @@
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.82",
33
- "@hubspot/local-dev-lib": "5.10.1",
32
+ "@hubspot/cms-components": "^1.2.84",
33
+ "@hubspot/local-dev-lib": "5.15.0",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
36
36
  "@radix-ui/react-dialog": "^1.1.2",
@@ -49,9 +49,11 @@
49
49
  "@storybook/test": "^8.6.15",
50
50
  "@vitejs/plugin-react": "^4.2.1",
51
51
  "ansi-to-html": "0.7.x",
52
+ "axios": "1.21.0",
52
53
  "babel-plugin-macros": "^3.1.0",
53
54
  "babel-plugin-styled-components": "^2.1.4",
54
55
  "chalk": "^5.3.0",
56
+ "chokidar": "^3.6.0",
55
57
  "class-variance-authority": "^0.7.0",
56
58
  "cli-progress": "^3.12.0",
57
59
  "clsx": "^2.1.1",
@@ -59,6 +61,7 @@
59
61
  "debug": "^4.3.4",
60
62
  "dot-prop": "^9.0.0",
61
63
  "express": "^4.17.3",
64
+ "findup-sync": "5.0.0",
62
65
  "html-escaper": "^3.0.3",
63
66
  "http-proxy-middleware": "^2.0.6",
64
67
  "inquirer": "^9.0.0",
@@ -111,6 +114,7 @@
111
114
  "bin": {
112
115
  "hs-cms-dev-server": "./dist/run.js",
113
116
  "jsx-module-fields-to-fields-json": "./dist/generateJsonFromJsx.js",
117
+ "generate-fields": "./dist/generateFieldsCli.js",
114
118
  "validate-fields": "./dist/validateFieldsCli.js"
115
119
  },
116
120
  "files": [
@@ -5,12 +5,35 @@ declare type ModuleFieldError = {
5
5
  message: string;
6
6
  fieldPath?: string;
7
7
  };
8
- declare type ValidateFieldsOutput = {
8
+ declare type GenerateFieldsOutput = {
9
9
  fieldsJsonPath: string;
10
- fieldsTypePath: string;
11
10
  fieldErrors: ModuleFieldError[];
11
+ };
12
+ declare type ValidateFieldsOutput = GenerateFieldsOutput & {
13
+ fieldsTypePath: string;
12
14
  metaErrors: ModuleFieldError[];
13
15
  };
16
+ /**
17
+ * Writes a module's `fields.json`, regenerates its `fields.type.ts` when that
18
+ * file has the auto-generated comment, then validates its fields and meta with
19
+ * HubSpot.
20
+ */
14
21
  export declare function validateSingleModule(modulePath: string, absoluteRoot: string, viteServer: ViteDevServer): Promise<ValidateFieldsOutput>;
22
+ /** `validate-fields`: generates each module's fields files and validates them with HubSpot. */
15
23
  export declare function validateModuleFields(projectRoot: string, moduleName?: string): Promise<ValidateFieldsOutput[]>;
24
+ /**
25
+ * `generate-fields`: writes each module's `fields.json`, without validating
26
+ * it. Each result includes the written JSON as `fieldsJson` (`null` when
27
+ * generation failed).
28
+ */
29
+ export declare function generateModuleFields(projectRoot: string, moduleName?: string): Promise<Array<GenerateFieldsOutput & {
30
+ fieldsJson: any[] | null;
31
+ }>>;
32
+ /**
33
+ * Runs `command` from a CLI: `<command> <path> [--module <name>]`. Prints the
34
+ * results as JSON and exits with 1 when any module has errors.
35
+ */
36
+ export declare function runModuleFieldsCli(commandName: string, command: (projectRoot: string, moduleName?: string) => Promise<Array<GenerateFieldsOutput & {
37
+ metaErrors?: ModuleFieldError[];
38
+ }>>): Promise<void>;
16
39
  export {};
@@ -1,8 +0,0 @@
1
- export declare function debugAuthContext(
2
- authedPortalId: number,
3
- cookieValue: string
4
- ): Promise<void>;
5
- export declare function compareUrls(
6
- originalUrl: string,
7
- signedUrl: string
8
- ): void;
@@ -1,2 +0,0 @@
1
- export declare function getLocalComponentsPath(): string;
2
- export declare function shouldUseLocalComponents(): boolean;
@@ -1,18 +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(
6
- html: string,
7
- viteServer: ViteDevServer
8
- ): Promise<string>;
9
- /**
10
- * Vite plugin to handle remote assets
11
- */
12
- export declare function remoteAssetsPlugin(): {
13
- name: string;
14
- apply: 'serve';
15
- configResolved(config: any): void;
16
- resolveId(id: string): string;
17
- load(id: string): Promise<string>;
18
- };
@@ -1,2 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export declare function hubspotStaticAssetsPlugin(): Plugin;
@@ -1,10 +0,0 @@
1
- import { ViteDevServer, Plugin } from 'vite';
2
- /**
3
- * Create a self-contained plugin with proper caching
4
- */
5
- export declare function remoteAssetsPlugin(): Plugin & {
6
- processRemoteAssets: (
7
- html: string,
8
- viteServer: ViteDevServer
9
- ) => Promise<string>;
10
- };
@@ -1,6 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- /**
3
- * Plugin that provides URL signing capabilities
4
- * Uses internal signing mechanisms when available, with fallback for public environments
5
- */
6
- export default function requestSigningPlugin(): Plugin;
@@ -1,13 +0,0 @@
1
- import { Request, Response, NextFunction } from 'express';
2
- export declare function handleGetModulePages(
3
- req: Request,
4
- res: Response,
5
- next: NextFunction
6
- ): Promise<Response<any, Record<string, any>>>;
7
- export declare function handleOpenFile(
8
- req: Request,
9
- res: Response,
10
- next: NextFunction
11
- ): Response<any, Record<string, any>>;
12
- export declare function createAppServerRoutes(): import('express-serve-static-core').Router;
13
- export default createAppServerRoutes;
@@ -1,7 +0,0 @@
1
- import { Request, Response } from 'express';
2
- declare const homeRouteHandler: (
3
- request: Request,
4
- response: Response,
5
- next: Function
6
- ) => Promise<void>;
7
- export default homeRouteHandler;