@vite-hub/bundle 0.5.0 → 0.5.1

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.
@@ -1,5 +1,4 @@
1
1
  import "nostics";
2
- //#region ../internal/src/host-credentials.d.ts
3
2
  interface HostCliRunResult {
4
3
  exitCode: number | null;
5
4
  stdout: string;
@@ -11,8 +10,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
11
10
  env: NodeJS.ProcessEnv;
12
11
  signal?: AbortSignal;
13
12
  }) => Promise<HostCliRunResult>;
14
- //#endregion
15
- //#region ../internal/src/provision.d.ts
16
13
  type ProvisionProvider = "cloudflare" | "vercel";
17
14
  interface ProvisionLogger {
18
15
  log: (message: string) => void;
@@ -64,8 +61,6 @@ interface ProvisionStep {
64
61
  /** Describes the Provision State this step records. Runs without network access, also without credentials. */
65
62
  recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
66
63
  }
67
- //#endregion
68
- //#region ../internal/src/cli.d.ts
69
64
  interface ViteHubCliStreams {
70
65
  stderr: {
71
66
  write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
@@ -160,5 +155,4 @@ interface ViteHubCliPluginMetadata {
160
155
  cli?: ViteHubCliContributor | ViteHubCliContributorFactory;
161
156
  }
162
157
  type StdoutWriteCallback = (error?: Error | null) => void;
163
- //#endregion
164
158
  export { ViteHubCliPluginMetadata as n, ViteHubCliContributor as t };
@@ -1,9 +1,9 @@
1
- import { a as explainBundleRoute, f as readBundleReportRoot, i as explainBundle, n as readSavedBundleReport, p as readEnvironmentReports, r as createBundleReport, t as compareBundleReports, u as formatBytes } from "./compare-CHsAWnIP.js";
1
+ import { a as explainBundleRoute, f as readBundleReportRoot, i as explainBundle, n as readSavedBundleReport, p as readEnvironmentReports, r as createBundleReport, t as compareBundleReports, u as formatBytes } from "./compare-3VnwI84U.js";
2
2
  import { statSync } from "node:fs";
3
3
  import { basename, dirname, parse, resolve } from "node:path";
4
4
  import { tmpdir } from "node:os";
5
5
  import "node:url";
6
- //#region ../internal/src/build/vite.ts
6
+ // ../internal/src/build/vite.ts
7
7
  const projectRootDirectoryMarkers = [
8
8
  ["server", "agents"],
9
9
  ["server", "channels"],
@@ -70,8 +70,7 @@ function isMissingProjectMarker(error) {
70
70
  const code = error.code;
71
71
  return code === "ENOENT" || code === "ENOTDIR";
72
72
  }
73
- //#endregion
74
- //#region src/cli.ts
73
+ // src/cli.ts
75
74
  const reportUsage = "vitehub bundle [--against <report>] [--json]";
76
75
  const whyUsage = "vitehub bundle why <package|file|/route> [--json]";
77
76
  const missingReport = "No bundle report in .vitehub/bundle/. Set `bundle: true` in vitehub() (vite.config.ts) or in `vitehub` (nuxt.config.ts), then run a production build.\n";
@@ -332,5 +331,4 @@ const bundleCliContributor = { namespaces: [{
332
331
  }],
333
332
  name: "bundle"
334
333
  }] };
335
- //#endregion
336
334
  export { resolveViteHubProjectRoot as n, bundleCliContributor as t };
package/dist/cli.d.ts CHANGED
@@ -1,9 +1,5 @@
1
- import { t as ViteHubCliContributor } from "./cli-NCtitmny.js";
2
- //#region src/bytes.d.ts
1
+ import { t as ViteHubCliContributor } from "./cli-C5pAfY4x.js";
3
2
  /** `1234567` becomes `1.23 MB`, like Vite's build output. */
4
3
  export declare function formatBytes(bytes: number): string;
5
- //#endregion
6
- //#region src/cli.d.ts
7
4
  /** The `vitehub bundle` commands. They read `.vitehub/bundle/` and need no dev server. */
8
- export declare const bundleCliContributor: ViteHubCliContributor;
9
- //#endregion
5
+ export declare const bundleCliContributor: ViteHubCliContributor;
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
- import { u as formatBytes } from "./compare-CHsAWnIP.js";
2
- import { t as bundleCliContributor } from "./cli-DMNhyWe9.js";
1
+ import { u as formatBytes } from "./compare-3VnwI84U.js";
2
+ import { t as bundleCliContributor } from "./cli-CfA0FvGh.js";
3
3
  export { bundleCliContributor, formatBytes };
@@ -1,9 +1,8 @@
1
- import { t as isRecord } from "./object-Da1zyPCR.js";
1
+ import { t as isRecord } from "./object-CAK6UYR5.js";
2
2
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join, posix, relative, resolve } from "node:path";
4
4
  import { createConsoleReporter, defineDiagnostics } from "nostics";
5
- //#endregion
6
- //#region src/files.ts
5
+ // src/files.ts
7
6
  /** Folder of the environment reports, relative to the project root. */
8
7
  const bundleReportDir = ".vitehub/bundle";
9
8
  const bundleReportRootFile = ".vitehub/bundle-root.json";
@@ -53,8 +52,7 @@ function writeEnvironmentReport(root, report) {
53
52
  for (const old of readEnvironmentReports(root)) if (old.build !== report.build) rmSync(join(dir, `${old.environment}.json`), { force: true });
54
53
  writeFileSync(join(dir, `${report.environment}.json`), `${JSON.stringify(report)}\n`);
55
54
  }
56
- //#endregion
57
- //#region src/bytes.ts
55
+ // src/bytes.ts
58
56
  /** Splits file bytes proportionally, carrying rounding between shares so their sum stays exact. */
59
57
  function allocateBytes(weights, bytes) {
60
58
  const total = weights.reduce((sum, weight) => sum + weight, 0);
@@ -74,8 +72,7 @@ function formatBytes(bytes) {
74
72
  if (bytes >= 1e3) return `${(bytes / 1e3).toFixed(1)} kB`;
75
73
  return `${bytes} B`;
76
74
  }
77
- //#endregion
78
- //#region src/diagnostics.ts
75
+ // src/diagnostics.ts
79
76
  const cloudflareWorkerSizeLimit = 67108864;
80
77
  const bundleDiagnostics = /*#__PURE__*/ defineDiagnostics({
81
78
  docsBase: "https://vitehub.dev/docs/bundle/diagnostics",
@@ -90,8 +87,7 @@ const bundleDiagnostics = /*#__PURE__*/ defineDiagnostics({
90
87
  }
91
88
  }
92
89
  });
93
- //#endregion
94
- //#region src/groups.ts
90
+ // src/groups.ts
95
91
  const frameworkPackages = /* @__PURE__ */ new Set([
96
92
  "@unhead/vue",
97
93
  "nuxt-nightly",
@@ -204,8 +200,7 @@ function moduleGroup(id) {
204
200
  kind: "app"
205
201
  };
206
202
  }
207
- //#endregion
208
- //#region src/checks.ts
203
+ // src/checks.ts
209
204
  function finding(code, diagnostic, rest) {
210
205
  return {
211
206
  code,
@@ -282,79 +277,78 @@ function checkBundle(reports, server, host, explain) {
282
277
  return [...hostSizeLimit(server, host, explain), ...startupUnused(server, uniqueRules(reports).filter((rule) => exclusivelyOwned(reports, rule)), explain)];
283
278
  }
284
279
  /**
285
- * @vue/shared v3.5.44
280
+ * @vue/shared v3.5.46
286
281
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
287
282
  * @license MIT
288
283
  **/
289
284
  /**
290
- * @vue/shared v3.5.44
285
+ * @vue/shared v3.5.46
291
286
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
292
287
  * @license MIT
293
288
  **/
294
289
  /**
295
- * @vue/compiler-core v3.5.44
290
+ * @vue/compiler-core v3.5.46
296
291
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
297
292
  * @license MIT
298
293
  **/
299
294
  /**
300
- * @vue/compiler-core v3.5.44
295
+ * @vue/compiler-core v3.5.46
301
296
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
302
297
  * @license MIT
303
298
  **/
304
299
  /**
305
- * @vue/compiler-dom v3.5.44
300
+ * @vue/compiler-dom v3.5.46
306
301
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
307
302
  * @license MIT
308
303
  **/
309
304
  /**
310
- * @vue/compiler-dom v3.5.44
305
+ * @vue/compiler-dom v3.5.46
311
306
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
312
307
  * @license MIT
313
308
  **/
314
309
  /**
315
- * @vue/reactivity v3.5.44
310
+ * @vue/reactivity v3.5.46
316
311
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
317
312
  * @license MIT
318
313
  **/
319
314
  /**
320
- * @vue/reactivity v3.5.44
315
+ * @vue/reactivity v3.5.46
321
316
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
322
317
  * @license MIT
323
318
  **/
324
319
  /**
325
- * @vue/runtime-core v3.5.44
320
+ * @vue/runtime-core v3.5.46
326
321
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
327
322
  * @license MIT
328
323
  **/
329
324
  /**
330
- * @vue/runtime-core v3.5.44
325
+ * @vue/runtime-core v3.5.46
331
326
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
332
327
  * @license MIT
333
328
  **/
334
329
  /**
335
- * @vue/runtime-dom v3.5.44
330
+ * @vue/runtime-dom v3.5.46
336
331
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
337
332
  * @license MIT
338
333
  **/
339
334
  /**
340
- * @vue/runtime-dom v3.5.44
335
+ * @vue/runtime-dom v3.5.46
341
336
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
342
337
  * @license MIT
343
338
  **/
344
339
  /**
345
- * vue v3.5.44
340
+ * vue v3.5.46
346
341
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
347
342
  * @license MIT
348
343
  **/
349
344
  /**
350
- * vue v3.5.44
345
+ * vue v3.5.46
351
346
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
352
347
  * @license MIT
353
348
  **/
354
- //#endregion
355
- //#region ../../node_modules/.pnpm/vue-router@5.4.0_@voidzero-dev+vite-plus-core@0.3.3_@types+node@24.19.1_esbuild@0.28.2__771eab81e2fd06a479763e79bcb19884/node_modules/vue-router/dist/useApi-CUWMwLLw.js
349
+ // ../../node_modules/.pnpm/vue-router@5.5.1_@voidzero-dev+vite-plus-core@8.3.8000_@types+node@24.19.2_@volar+types_99e0e228147a3ec8c7594d93201c6498/node_modules/vue-router/dist/useApi-SF8tY_yo.js
356
350
  /*!
357
- * vue-router v5.4.0
351
+ * vue-router v5.5.1
358
352
  * (c) 2026 Eduardo San Martin Morote
359
353
  * @license MIT
360
354
  */
@@ -454,10 +448,34 @@ const diagnostics = /*#__PURE__*/ defineDiagnostics({
454
448
  why: (p) => `The optional path param "${p.param}" is being removed with ${p.value}.`,
455
449
  fix: "Use null to remove an optional path param."
456
450
  },
451
+ VUE_ROUTER_R0124: {
452
+ why: (p) => `The repeatable param "${p.param}" cannot be empty.`,
453
+ fix: "Pass at least one value, or make the param optional."
454
+ },
455
+ VUE_ROUTER_R0123: {
456
+ why: (p) => `The query value of "${p.key}" is ignored because a param already sets this key.`,
457
+ fix: (p) => `Pass the value in \`params\` instead of \`query\`, or omit "${p.key}" from \`query\`.`
458
+ },
459
+ VUE_ROUTER_R0126: {
460
+ why: (p) => `An error was thrown while matching "${p.path}" against the route "${p.name}". The route is skipped.`,
461
+ fix: "Return null from match() to skip a route, or call miss() in a param parser. Fix the thrown error if it is a bug."
462
+ },
463
+ VUE_ROUTER_R0129: {
464
+ why: (p) => `Cannot resolve a relative location without a "name": there is no current location, or the current location has no route. This crashes in production.\nLocation: ${stringifyRoute(p.location)}`,
465
+ fix: "Pass the location it is relative to as the second argument of resolve(), or use a location with a \"name\" or an absolute \"path\"."
466
+ },
467
+ VUE_ROUTER_R0125: {
468
+ why: (p) => `The params, query, or hash do not match the route "${p.name}".`,
469
+ fix: "Pass params, query, and hash values that the route matchers accept."
470
+ },
457
471
  VUE_ROUTER_D0001: {
458
472
  why: (p) => `Route "${p.name}" uses beforeEnter, which is deprecated in the experimental router.`,
459
473
  fix: "Move the condition to the route meta field and check to.meta in router.beforeEach()."
460
474
  },
475
+ VUE_ROUTER_R0130: {
476
+ why: (p) => `Cannot resolve a relative location before the initial navigation: there is no current route yet. This crashes in production.\nLocation: ${stringifyRoute(p.location)}`,
477
+ fix: "Use a location with a \"name\" or an absolute \"path\", await router.isReady() before mounting the app, or render the <RouterLink> inside a page component so it only renders after the initial navigation."
478
+ },
461
479
  VUE_ROUTER_D0002: {
462
480
  why: (p) => `The query value of "${p.key}" is not an array (${p.value}). Non array query values are deprecated in the experimental router.`,
463
481
  fix: (p) => `Wrap the value in an array: \`{ ${JSON.stringify(p.key)}: [${p.value}] }\`. Use undefined to remove the key.`
@@ -645,6 +663,10 @@ const diagnostics = /*#__PURE__*/ defineDiagnostics({
645
663
  why: (p) => `Finding ancestor route "${p.ancestor}" failed for "${p.record}"`,
646
664
  fix: "Report a reproduction at https://github.com/vuejs/router/issues/new/choose."
647
665
  },
666
+ VUE_ROUTER_R0106: {
667
+ why: (p) => `Repeatable param "${p.name}" was provided without an array.`,
668
+ fix: (p) => `Pass it as an array, even when it has one item: { ${JSON.stringify(p.name)}: [value] }. If the param is optional (e.g. ":${p.name}*"), pass an empty array or null to remove it.`
669
+ },
648
670
  VUE_ROUTER_R0110: {
649
671
  why: `A hash base must end with a "#"`,
650
672
  fix: (p) => `Append "#" to the "base" argument passed to "createWebHashHistory()": "${p.base}" should be "${p.suggestion}".`
@@ -658,6 +680,16 @@ const diagnostics = /*#__PURE__*/ defineDiagnostics({
658
680
  fix: "Merge the router's state into your own when calling it manually: `history.replaceState({ ...history.state, ...yourState }, '', url)`.",
659
681
  docs: "https://router.vuejs.org/guide/migration.html#Usage-of-history-state"
660
682
  },
683
+ VUE_ROUTER_R0127: {
684
+ why: "The page is loaded from a file:// URL. createWebHistory() cannot reliably change the path of file:// URLs.",
685
+ fix: "Use createWebHashHistory() instead.",
686
+ docs: "https://router.vuejs.org/guide/essentials/history-mode.html#hash-mode"
687
+ },
688
+ VUE_ROUTER_R0128: {
689
+ why: "The page is loaded in an about: URL (e.g. an iframe with srcdoc). Browsers do not let the web and hash histories change this URL.",
690
+ fix: "Use createMemoryHistory() instead.",
691
+ docs: "https://router.vuejs.org/guide/essentials/history-mode.html#memory-mode"
692
+ },
661
693
  VUE_ROUTER_R1001: {
662
694
  why: (p) => `Data loader "${String(p.key)}" has a different parent than the current context. This shouldn't be happening.`,
663
695
  fix: "Report a bug with a minimal reproduction at https://github.com/vuejs/router/."
@@ -708,20 +740,18 @@ Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
708
740
  Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
709
741
  Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
710
742
  Symbol(process.env.NODE_ENV !== "production" ? "router view on route rendered" : "");
711
- //#endregion
712
- //#region ../../node_modules/.pnpm/vue-router@5.4.0_@voidzero-dev+vite-plus-core@0.3.3_@types+node@24.19.1_esbuild@0.28.2__771eab81e2fd06a479763e79bcb19884/node_modules/vue-router/dist/devtools-CxgSYwGp.js
743
+ // ../../node_modules/.pnpm/vue-router@5.5.1_@voidzero-dev+vite-plus-core@8.3.8000_@types+node@24.19.2_@volar+types_99e0e228147a3ec8c7594d93201c6498/node_modules/vue-router/dist/devtools-RytpElE1.js
713
744
  /*!
714
- * vue-router v5.4.0
745
+ * vue-router v5.5.1
715
746
  * (c) 2026 Eduardo San Martin Morote
716
747
  * @license MIT
717
748
  */
718
749
  function isRouteName(name) {
719
750
  return typeof name === "string" || typeof name === "symbol";
720
751
  }
721
- //#endregion
722
- //#region ../../node_modules/.pnpm/vue-router@5.4.0_@voidzero-dev+vite-plus-core@0.3.3_@types+node@24.19.1_esbuild@0.28.2__771eab81e2fd06a479763e79bcb19884/node_modules/vue-router/dist/vue-router.js
752
+ // ../../node_modules/.pnpm/vue-router@5.5.1_@voidzero-dev+vite-plus-core@8.3.8000_@types+node@24.19.2_@volar+types_99e0e228147a3ec8c7594d93201c6498/node_modules/vue-router/dist/vue-router.js
723
753
  /*!
724
- * vue-router v5.4.0
754
+ * vue-router v5.5.1
725
755
  * (c) 2026 Eduardo San Martin Morote
726
756
  * @license MIT
727
757
  */
@@ -825,7 +855,7 @@ const BASE_PATH_PARSER_OPTIONS = {
825
855
  start: true,
826
856
  end: true
827
857
  };
828
- const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
858
+ const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\|]/g;
829
859
  /**
830
860
  * Creates a path parser from an array of Segments (a segment is an array of Tokens)
831
861
  *
@@ -838,6 +868,7 @@ function tokensToParser(segments, extraOptions) {
838
868
  const score = [];
839
869
  let pattern = options.start ? "^" : "";
840
870
  const keys = [];
871
+ const hasBackreference = segments.some((segment) => segment.some((token) => token.type === 1 && /\\[1-9k]/.test(token.regexp || "")));
841
872
  for (const segment of segments) {
842
873
  const segmentScores = segment.length ? [] : [90];
843
874
  if (options.strict && !segment.length) pattern += "/";
@@ -864,7 +895,10 @@ function tokensToParser(segments, extraOptions) {
864
895
  throw new Error(`Invalid custom RegExp for param "${value}" (${re}): ` + err.message);
865
896
  }
866
897
  }
867
- let subPattern = repeatable ? `((?:${re})(?:/(?:${re}))*)` : `(${re})`;
898
+ let subPattern = repeatable && re !== ".+" && re !== ".*" ? `((?:${re})(?:/(?:${re}))*)` : `(${re})`;
899
+ const next = segment[tokenIndex + 1];
900
+ const afterNext = segment[tokenIndex + 2];
901
+ if (!hasBackreference && !regexp && !repeatable && afterNext && afterNext.type === 1 && !afterNext.regexp && next.type === 0) subPattern = `([^/](?:(?!${next.value.replace(REGEX_CHARS_RE, "\\$&")})[^/])*)`;
868
902
  if (!tokenIndex) subPattern = optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
869
903
  if (optional) subPattern += "?";
870
904
  pattern += subPattern;
@@ -1116,6 +1150,7 @@ function createRouterMatcher(routes, globalOptions) {
1116
1150
  inherited: isInherited ? ` If you are using a catch-all route with a named redirect, pass an empty \`params\` object: \`redirect: { name: '...', params: {} }\`.` : ""
1117
1151
  });
1118
1152
  }
1153
+ checkParamValues(matcher, location.params);
1119
1154
  }
1120
1155
  name = matcher.record.name;
1121
1156
  params = assign(pickParams(currentLocation.params, matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name)), location.params && pickParams(location.params, matcher.keys.map((k) => k.name)));
@@ -1137,6 +1172,7 @@ function createRouterMatcher(routes, globalOptions) {
1137
1172
  location,
1138
1173
  currentLocation
1139
1174
  });
1175
+ if (process.env.NODE_ENV !== "production") checkParamValues(matcher, location.params);
1140
1176
  name = matcher.record.name;
1141
1177
  params = assign({}, currentLocation.params, location.params);
1142
1178
  path = matcher.stringify(params);
@@ -1275,6 +1311,23 @@ function checkChildMissingNameWithEmptyPath(mainNormalizedRecord, parent) {
1275
1311
  function checkSameNameAsAncestor(record, parent) {
1276
1312
  for (let ancestor = parent; ancestor; ancestor = ancestor.parent) if (ancestor.record.name === record.name) throw new Error(`A route named "${String(record.name)}" has been added as a ${parent === ancestor ? "child" : "descendant"} of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.`);
1277
1313
  }
1314
+ /**
1315
+ * Warns about explicit param values that are probably mistakes.
1316
+ *
1317
+ * @param matcher - matcher of the resolved location
1318
+ * @param params - params explicitly passed in the location
1319
+ */
1320
+ function checkParamValues(matcher, params) {
1321
+ if (!params) return;
1322
+ for (const key of matcher.keys) {
1323
+ const value = params[key.name];
1324
+ if (key.optional && value === "") diagnostics.VUE_ROUTER_R0122({
1325
+ param: key.name,
1326
+ value: "an empty string"
1327
+ });
1328
+ else if (key.repeatable && value != null && !Array.isArray(value)) diagnostics.VUE_ROUTER_R0106({ name: key.name });
1329
+ }
1330
+ }
1278
1331
  function checkMissingParamsInAbsolutePath(record, parent) {
1279
1332
  for (const key of parent.keys) if (!record.keys.find(isSameParam.bind(null, key))) {
1280
1333
  diagnostics.VUE_ROUTER_R0104({
@@ -1326,8 +1379,7 @@ function getInsertionAncestor(matcher) {
1326
1379
  function isMatchable({ record }) {
1327
1380
  return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
1328
1381
  }
1329
- //#endregion
1330
- //#region src/routes.ts
1382
+ // src/routes.ts
1331
1383
  function joinPath(parent, path) {
1332
1384
  if (path.startsWith("/")) return path;
1333
1385
  if (!path) return parent;
@@ -1447,8 +1499,7 @@ function explainRoute(report, target) {
1447
1499
  })) ?? []).sort((left, right) => right.bytes - left.bytes || left.id.localeCompare(right.id))
1448
1500
  };
1449
1501
  }
1450
- //#endregion
1451
- //#region src/report.ts
1502
+ // src/report.ts
1452
1503
  /** The reports of the newest build. Reports that an older build left behind are ignored. */
1453
1504
  function latestBuild(reports) {
1454
1505
  const build = reports.map((report) => report.build).sort().at(-1);
@@ -1667,8 +1718,7 @@ function explainBundleRoute(reports, target) {
1667
1718
  if (explanation) return explanation;
1668
1719
  }
1669
1720
  }
1670
- //#endregion
1671
- //#region src/compare.ts
1721
+ // src/compare.ts
1672
1722
  function totals(side) {
1673
1723
  return side ? {
1674
1724
  bytes: side.bytes,
@@ -1786,5 +1836,4 @@ function readSavedBundleReport(path) {
1786
1836
  return;
1787
1837
  }
1788
1838
  }
1789
- //#endregion
1790
1839
  export { explainBundleRoute as a, moduleId as c, bundleReportDir as d, readBundleReportRoot as f, writeEnvironmentReport as h, explainBundle as i, allocateBytes as l, writeBundleReportRoot as m, readSavedBundleReport as n, nuxtPageRoutes as o, readEnvironmentReports as p, createBundleReport as r, moduleGroup as s, compareBundleReports as t, formatBytes as u };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { C as BundleStartupRule, S as BundleSideComparison, _ as BundleRouteFile, a as BundleExplanation, b as BundleRouteSource, c as BundleFindingCode, d as BundleGroupKind, f as BundleGroupSize, g as BundleRouteExplanation, h as BundleRoute, i as BundleEnvironmentReport, l as BundleGroup, m as BundleReport, n as BundleChunk, o as BundleFile, p as BundleModule, r as BundleComparison, s as BundleFinding, t as BundleChainStep, u as BundleGroupChange, v as BundleRouteModule, w as BundleTotals, x as BundleSide, y as BundleRouteOptions } from "./types-DBa_sXqC.js";
2
- //#region src/compare.d.ts
1
+ import { C as BundleStartupRule, S as BundleSideComparison, _ as BundleRouteFile, a as BundleExplanation, b as BundleRouteSource, c as BundleFindingCode, d as BundleGroupKind, f as BundleGroupSize, g as BundleRouteExplanation, h as BundleRoute, i as BundleEnvironmentReport, l as BundleGroup, m as BundleReport, n as BundleChunk, o as BundleFile, p as BundleModule, r as BundleComparison, s as BundleFinding, t as BundleChainStep, u as BundleGroupChange, v as BundleRouteModule, w as BundleTotals, x as BundleSide, y as BundleRouteOptions } from "./types-D4oYDFpA.js";
3
2
  /** What changed from `before` to `after`: the bytes of each side and of its startup code, and each group that changed. */
4
3
  export declare function compareBundleReports(before: BundleReport, after: BundleReport): BundleComparison;
5
4
  /**
@@ -8,21 +7,15 @@ export declare function compareBundleReports(before: BundleReport, after: Bundle
8
7
  * `path` holds no report.
9
8
  */
10
9
  export declare function readSavedBundleReport(path: string): BundleReport | undefined;
11
- //#endregion
12
- //#region src/files.d.ts
13
10
  /** Folder of the environment reports, relative to the project root. */
14
11
  export declare const bundleReportDir = ".vitehub/bundle";
15
12
  /** Reads every environment report in `.vitehub/bundle/`. A file that is not a report is skipped. */
16
13
  export declare function readEnvironmentReports(root: string): BundleEnvironmentReport[];
17
- //#endregion
18
- //#region src/groups.d.ts
19
14
  /** Names the group of a root-relative module id. */
20
15
  export declare function moduleGroup(id: string): {
21
16
  name: string;
22
17
  kind: BundleGroupKind;
23
18
  };
24
- //#endregion
25
- //#region src/report.d.ts
26
19
  /** Joins the environment reports of one build into the report of the app. */
27
20
  export declare function createBundleReport(reports: readonly BundleEnvironmentReport[]): BundleReport | undefined;
28
21
  /**
@@ -35,13 +28,10 @@ export declare function explainBundle(reports: readonly BundleEnvironmentReport[
35
28
  * route's layout and pages, and the modules that the route adds. `undefined` when no route of the last build matches.
36
29
  */
37
30
  export declare function explainBundleRoute(reports: readonly BundleEnvironmentReport[], target: string): BundleRouteExplanation | undefined;
38
- //#endregion
39
- //#region src/index.d.ts
40
31
  /** The report of the last build with `bundle` on, or `undefined` when there is none. */
41
32
  export declare function readBundleReport(root: string): BundleReport | undefined;
42
33
  /** Why `target` (a package, a file, or a group) is in the last build. Empty when the build does not contain it. */
43
34
  export declare function explainBundleTarget(root: string, target: string): BundleExplanation[];
44
35
  /** What the browser loads on a first visit to the page route that renders `path`, such as `/docs/kv`. */
45
36
  export declare function explainBundleRouteTarget(root: string, path: string): BundleRouteExplanation | undefined;
46
- //#endregion
47
37
  export type { BundleChainStep, BundleChunk, BundleComparison, BundleEnvironmentReport, BundleExplanation, BundleFile, BundleFinding, BundleFindingCode, BundleGroup, BundleGroupChange, BundleGroupKind, BundleGroupSize, BundleModule, BundleReport, BundleRoute, BundleRouteExplanation, BundleRouteFile, BundleRouteModule, BundleRouteOptions, BundleRouteSource, BundleSide, BundleSideComparison, BundleStartupRule, BundleTotals };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as explainBundleRoute, d as bundleReportDir, i as explainBundle, n as readSavedBundleReport, p as readEnvironmentReports, r as createBundleReport, s as moduleGroup, t as compareBundleReports } from "./compare-CHsAWnIP.js";
2
- //#region src/index.ts
1
+ import { a as explainBundleRoute, d as bundleReportDir, i as explainBundle, n as readSavedBundleReport, p as readEnvironmentReports, r as createBundleReport, s as moduleGroup, t as compareBundleReports } from "./compare-3VnwI84U.js";
2
+ // src/index.ts
3
3
  /** The report of the last build with `bundle` on, or `undefined` when there is none. */
4
4
  function readBundleReport(root) {
5
5
  return createBundleReport(readEnvironmentReports(root));
@@ -12,5 +12,4 @@ function explainBundleTarget(root, target) {
12
12
  function explainBundleRouteTarget(root, path) {
13
13
  return explainBundleRoute(readEnvironmentReports(root), path);
14
14
  }
15
- //#endregion
16
15
  export { bundleReportDir, compareBundleReports, createBundleReport, explainBundle, explainBundleRoute, explainBundleRouteTarget, explainBundleTarget, moduleGroup, readBundleReport, readEnvironmentReports, readSavedBundleReport };
@@ -1,4 +1,4 @@
1
- //#region ../internal/src/object.ts
1
+ // ../internal/src/object.ts
2
2
  /** A non-null object that is not an array. Functions do not pass. */
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -7,5 +7,4 @@ function isRecord(value) {
7
7
  function isRecordOrFunction(value) {
8
8
  return Object(value) === value && !Array.isArray(value);
9
9
  }
10
- //#endregion
11
10
  export { isRecordOrFunction as n, isRecord as t };
@@ -1,4 +1,3 @@
1
- //#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
2
1
  /** The Standard Typed interface. This is a base type extended by other specs. */
3
2
  interface StandardTypedV1<Input = unknown, Output = Input> {
4
3
  /** The Standard properties. */
@@ -74,8 +73,6 @@ declare namespace StandardSchemaV1 {
74
73
  /** Infers the output type of a Standard. */
75
74
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
76
75
  }
77
- //#endregion
78
- //#region ../internal/src/operation-definition.d.ts
79
76
  /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
80
77
  type OperationKind = "read" | "write" | "destructive";
81
78
  /** The signed-in user of a call. */
@@ -241,5 +238,4 @@ interface OperationContributionEntry {
241
238
  /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
242
239
  runtime?: false;
243
240
  }
244
- //#endregion
245
241
  export { OperationContributionEntry as n, AnyOperation as t };
@@ -1,6 +1,5 @@
1
- import { a as BundleExplanation, g as BundleRouteExplanation } from "./types-DBa_sXqC.js";
2
- import { t as AnyOperation } from "./operation-definition-CI2PJGqu.js";
3
- //#region src/operations.d.ts
1
+ import { t as AnyOperation } from "./operation-definition-CqZkx1Rm.js";
2
+ import { a as BundleExplanation, g as BundleRouteExplanation } from "./types-D4oYDFpA.js";
4
3
  /** What `bundle.why` returns. `vitehub bundle why --json` prints the same object. */
5
4
  export type BundleWhyResult = BundleRouteExplanation | {
6
5
  target: string;
@@ -10,5 +9,4 @@ export type BundleWhyResult = BundleRouteExplanation | {
10
9
  explanations: BundleExplanation[];
11
10
  };
12
11
  /** The `bundle.*` operations. The Console and the ViteHub MCP call them on a dev server. `vitehub bundle` reads the same files. */
13
- export declare const bundleOperations: readonly AnyOperation[];
14
- //#endregion
12
+ export declare const bundleOperations: readonly AnyOperation[];
@@ -1,8 +1,8 @@
1
- import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
1
+ import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
2
2
  import { defineDiagnostics } from "nostics";
3
3
  import { toJsonSchema } from "@valibot/to-json-schema";
4
4
  import * as v from "valibot";
5
- //#region ../internal/src/error-diagnostics.ts
5
+ // ../internal/src/error-diagnostics.ts
6
6
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
7
7
  const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
8
8
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
@@ -259,6 +259,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
259
259
  why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
260
260
  fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
261
261
  },
262
+ INTERNAL_SITE_TOKEN_TOO_LONG: {
263
+ why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
264
+ fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
265
+ },
262
266
  INTERNAL_SQLITE_ARGUMENT_INVALID: {
263
267
  why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
264
268
  fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
@@ -273,8 +277,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
273
277
  }
274
278
  }
275
279
  });
276
- //#endregion
277
- //#region ../internal/src/standard-schema.ts
280
+ // ../internal/src/standard-schema.ts
278
281
  function readOwn(value, key) {
279
282
  if (value === null || Object(value) !== value) return;
280
283
  try {
@@ -303,8 +306,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
303
306
  return;
304
307
  }
305
308
  }
306
- //#endregion
307
- //#region ../internal/src/valibot.ts
309
+ // ../internal/src/valibot.ts
308
310
  const valibotTargets = /* @__PURE__ */ new Set([
309
311
  "draft-07",
310
312
  "draft-2020-12",
@@ -345,8 +347,7 @@ function withValibotJsonSchema(schema, options = {}) {
345
347
  }
346
348
  };
347
349
  }
348
- //#endregion
349
- //#region ../internal/src/operation-definition.ts
350
+ // ../internal/src/operation-definition.ts
350
351
  const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
351
352
  const kinds = /* @__PURE__ */ new Set([
352
353
  "read",
@@ -406,8 +407,7 @@ function isSectionId(section) {
406
407
  function operationInputJsonSchema(operation) {
407
408
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
408
409
  }
409
- //#endregion
410
- //#region src/operations.ts
410
+ // src/operations.ts
411
411
  const bundleOperationDiagnostics = /*#__PURE__*/ defineDiagnostics({
412
412
  docsBase: "https://vitehub.dev/docs/bundle/diagnostics",
413
413
  codes: {
@@ -474,5 +474,4 @@ const bundleOperations = [defineBundleOperation({
474
474
  };
475
475
  }
476
476
  })];
477
- //#endregion
478
477
  export { bundleOperations };
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  /** What put a module in the output. */
3
2
  type BundleGroupKind = "app" | "dependency" | "framework" | "generated" | "vitehub";
4
3
  /** One source module in one output chunk. */
@@ -235,5 +234,4 @@ interface BundleComparison {
235
234
  client?: BundleSideComparison;
236
235
  server?: BundleSideComparison;
237
236
  }
238
- //#endregion
239
237
  export { BundleStartupRule as C, BundleSideComparison as S, BundleRouteFile as _, BundleExplanation as a, BundleRouteSource as b, BundleFindingCode as c, BundleGroupKind as d, BundleGroupSize as f, BundleRouteExplanation as g, BundleRoute as h, BundleEnvironmentReport as i, BundleGroup as l, BundleReport as m, BundleChunk as n, BundleFile as o, BundleModule as p, BundleComparison as r, BundleFinding as s, BundleChainStep as t, BundleGroupChange as u, BundleRouteModule as v, BundleTotals as w, BundleSide as x, BundleRouteOptions as y };
package/dist/vite.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { n as ViteHubCliPluginMetadata } from "./cli-NCtitmny.js";
2
- import { C as BundleStartupRule, y as BundleRouteOptions } from "./types-DBa_sXqC.js";
3
- import { n as OperationContributionEntry } from "./operation-definition-CI2PJGqu.js";
1
+ import { n as ViteHubCliPluginMetadata } from "./cli-C5pAfY4x.js";
2
+ import { n as OperationContributionEntry } from "./operation-definition-CqZkx1Rm.js";
3
+ import { C as BundleStartupRule, y as BundleRouteOptions } from "./types-D4oYDFpA.js";
4
4
  import { Plugin } from "vite";
5
- //#region src/routes.d.ts
6
5
  /** A page route with the absolute files of the components that render it, outermost first. */
7
6
  interface PageRoute {
8
7
  path: string;
@@ -37,8 +36,6 @@ interface NuxtPageLike {
37
36
  export declare function nuxtPageRoutes(pages: readonly NuxtPageLike[], layouts?: Readonly<Record<string, {
38
37
  file: string;
39
38
  }>>, layoutComponent?: string): PageRoute[];
40
- //#endregion
41
- //#region src/vite.d.ts
42
39
  interface BundlerConfig {
43
40
  plugins?: unknown;
44
41
  }
@@ -82,5 +79,4 @@ export interface BundleViteOptions {
82
79
  * report for the app. Builds without the plugin write nothing.
83
80
  */
84
81
  export declare function hubBundle(options?: BundleViteOptions): BundleVitePlugin;
85
- //#endregion
86
82
  export type { NuxtPageLike, PageRoute };
package/dist/vite.js CHANGED
@@ -1,12 +1,12 @@
1
- import { c as moduleId, h as writeEnvironmentReport, l as allocateBytes, m as writeBundleReportRoot, o as nuxtPageRoutes } from "./compare-CHsAWnIP.js";
2
- import { n as resolveViteHubProjectRoot, t as bundleCliContributor } from "./cli-DMNhyWe9.js";
1
+ import { n as resolveViteHubProjectRoot, t as bundleCliContributor } from "./cli-CfA0FvGh.js";
2
+ import { c as moduleId, h as writeEnvironmentReport, l as allocateBytes, m as writeBundleReportRoot, o as nuxtPageRoutes } from "./compare-3VnwI84U.js";
3
3
  import { existsSync } from "node:fs";
4
4
  import { dirname, resolve } from "node:path";
5
5
  import { defineDiagnostics } from "nostics";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { gzipSync } from "node:zlib";
9
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
9
+ // ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
10
10
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
11
11
  function normalizeWindowsPath(input = "") {
12
12
  if (!input) return input;
@@ -90,8 +90,7 @@ const dirname$1 = function(p) {
90
90
  if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
91
91
  return segments.join("/") || (isAbsolute(p) ? "/" : ".");
92
92
  };
93
- //#endregion
94
- //#region ../internal/src/invariant.ts
93
+ // ../internal/src/invariant.ts
95
94
  const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
96
95
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
97
96
  codes: { INTERNAL_INVARIANT_FAILED: {
@@ -110,8 +109,7 @@ function invariantError(what) {
110
109
  function invariant(condition, what) {
111
110
  if (!condition) throw invariantError(what);
112
111
  }
113
- //#endregion
114
- //#region ../internal/src/build/paths.ts
112
+ // ../internal/src/build/paths.ts
115
113
  function resolveRuntimeModule(packageDir, modulePath) {
116
114
  const distFile = resolve$1(packageDir, "dist", `${modulePath}.js`);
117
115
  return existsSync(distFile) ? distFile : resolve$1(packageDir, "src", `${modulePath}.ts`);
@@ -138,8 +136,7 @@ function findPackageDir(file) {
138
136
  function ownModule(importMetaUrl, modulePath) {
139
137
  return resolveRuntimeModule(findPackageDir(fileURLToPath(importMetaUrl)), modulePath);
140
138
  }
141
- //#endregion
142
- //#region src/collect.ts
139
+ // src/collect.ts
143
140
  function isChunk(output) {
144
141
  return typeof output === "object" && output !== null && Reflect.get(output, "type") === "chunk";
145
142
  }
@@ -286,8 +283,7 @@ function collectEnvironmentReport(bundle, options) {
286
283
  ...client && routeOptions ? { routeOptions } : {}
287
284
  };
288
285
  }
289
- //#endregion
290
- //#region src/vite.ts
286
+ // src/vite.ts
291
287
  const outputsKey = Symbol.for("vitehub.bundle.outputs");
292
288
  function writtenOutputs() {
293
289
  const outputs = Reflect.get(globalThis, outputsKey) ?? /* @__PURE__ */ new WeakMap();
@@ -422,5 +418,4 @@ function hubBundle(options = {}) {
422
418
  }
423
419
  };
424
420
  }
425
- //#endregion
426
421
  export { hubBundle, nuxtPageRoutes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/bundle",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Bundle reports for ViteHub apps: client and server size, startup cost, and why each package is in the output.",
5
5
  "keywords": [
6
6
  "bundle",
@@ -49,16 +49,16 @@
49
49
  "@valibot/to-json-schema": "^1.8.0",
50
50
  "nostics": "1.4.0",
51
51
  "valibot": "^1.5.0",
52
- "vue-router": "^5.4.0"
52
+ "vue-router": "^5.5.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/node": "^24.19.1",
55
+ "@types/node": "^24.19.2",
56
56
  "@vite-hub/internal": "0.0.1",
57
57
  "publint": "^0.3.25",
58
58
  "typescript": "^6.0.3",
59
- "vite": "^8.2.2",
60
- "vite-plus": "^0.3.3",
61
- "vitest": "^4.1.11"
59
+ "vite": "^8.3.8",
60
+ "vite-plus": "^1.7.0",
61
+ "vitest": "5.1.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "vite": ">=8.0.0"