@farm.js/core 0.1.0-beta.75 → 0.1.0-beta.77

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.
Files changed (57) hide show
  1. package/dist/agent-runtime.cjs +7 -0
  2. package/dist/agent-runtime.cjs.map +1 -1
  3. package/dist/agent-runtime.mjs +7 -0
  4. package/dist/agent-runtime.mjs.map +1 -1
  5. package/dist/{app-BkCh7H09.d.mts → app-Bq-Tr90H.d.mts} +2 -0
  6. package/dist/{app-CZIEOZIa.d.ts → app-CQ6uhLEj.d.ts} +2 -0
  7. package/dist/{chunk-S6FO7OXA.mjs → chunk-BF47GPQF.mjs} +59 -8
  8. package/dist/chunk-BF47GPQF.mjs.map +1 -0
  9. package/dist/{chunk-DKD7DGTE.mjs → chunk-KDKXMAIQ.mjs} +2 -2
  10. package/dist/{chunk-UGK7TW2V.mjs → chunk-P57PPOQL.mjs} +18 -6
  11. package/dist/chunk-P57PPOQL.mjs.map +1 -0
  12. package/dist/{chunk-IIKQBOGZ.mjs → chunk-PZLBMD63.mjs} +2 -2
  13. package/dist/{chunk-IIKQBOGZ.mjs.map → chunk-PZLBMD63.mjs.map} +1 -1
  14. package/dist/{chunk-TWN6IBIL.mjs → chunk-UBDJMY7B.mjs} +2 -2
  15. package/dist/client/lifecycle.mjs +2 -2
  16. package/dist/client-plugins.cjs +1 -1
  17. package/dist/client-plugins.cjs.map +1 -1
  18. package/dist/client-plugins.mjs +2 -2
  19. package/dist/client.cjs +1 -1
  20. package/dist/client.cjs.map +1 -1
  21. package/dist/client.mjs +2 -2
  22. package/dist/index.cjs +82 -12
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.mts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.mjs +5 -5
  27. package/dist/internal/build-runtime.cjs +65 -7
  28. package/dist/internal/build-runtime.cjs.map +1 -1
  29. package/dist/internal/build-runtime.mjs +3 -3
  30. package/dist/internal/client-runtime.cjs +1 -1
  31. package/dist/internal/client-runtime.cjs.map +1 -1
  32. package/dist/internal/client-runtime.mjs +2 -2
  33. package/dist/internal/product-telemetry-runtime.cjs +1 -1
  34. package/dist/internal/product-telemetry-runtime.cjs.map +1 -1
  35. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  36. package/dist/plugin.cjs +58 -7
  37. package/dist/plugin.cjs.map +1 -1
  38. package/dist/plugin.mjs +2 -2
  39. package/dist/server-plugins.cjs +17 -5
  40. package/dist/server-plugins.cjs.map +1 -1
  41. package/dist/server-plugins.mjs +1 -1
  42. package/dist/server.cjs +75 -12
  43. package/dist/server.cjs.map +1 -1
  44. package/dist/server.d.mts +1 -1
  45. package/dist/server.d.ts +1 -1
  46. package/dist/server.mjs +3 -3
  47. package/dist/version.cjs +1 -1
  48. package/dist/version.cjs.map +1 -1
  49. package/dist/version.mjs +1 -1
  50. package/dist/vite.cjs +58 -7
  51. package/dist/vite.cjs.map +1 -1
  52. package/dist/vite.mjs +2 -2
  53. package/package.json +1 -1
  54. package/dist/chunk-S6FO7OXA.mjs.map +0 -1
  55. package/dist/chunk-UGK7TW2V.mjs.map +0 -1
  56. /package/dist/{chunk-DKD7DGTE.mjs.map → chunk-KDKXMAIQ.mjs.map} +0 -0
  57. /package/dist/{chunk-TWN6IBIL.mjs.map → chunk-UBDJMY7B.mjs.map} +0 -0
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ export { FarmRenderer, FarmRendererCapabilities, FarmRendererCapabilitiesInput,
4
4
  export { f as fileExists, g as globFiles, l as logger, m as matchRoute, a as matchRoutePrefix, p as parseRoutePath, d as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, b as toPosixPath, t as toRootRelativeUrlPath, c as toViteModuleId } from './utils-CebML94V.mjs';
5
5
  export { createFarmStorage, createStorageClient, databaseStorage, defineStorageClient, disposeStorage, driverStorage, getStorage, initStorage, libsqlStorage, localStorage, memoryStorage, mongodbStorage, mysql2Storage, mysqlStorage, netlifyBlobsStorage, pgStorage, pgliteStorage, planetscaleStorage, postgresStorage, redisStorage, resolveStorageRuntimeClient, s3Storage, sqliteStorage, upstashStorage, vercelBlobStorage, vercelKVStorage } from './storage.mjs';
6
6
  export { D as DEFAULT_FARM_API_BASE_PATH, l as FarmAPIConfig, j as FarmAPIConfigResolverContext, k as FarmAPIConfigValue, F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes, R as ResolvedFarmAPIConfig, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint, o as getFarmAPIBaseURL, m as normalizeFarmAPIBasePath, n as normalizeFarmAPIConfig, r as resolveFarmAPIConfig, p as resolveFarmAPIRequestURL } from './config-C0N_7HJ6.mjs';
7
- export { c as createFarmApp } from './app-BkCh7H09.mjs';
7
+ export { c as createFarmApp } from './app-Bq-Tr90H.mjs';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import { ReactNode } from 'react';
10
10
  export { ComponentType, FC, PropsWithChildren, ReactElement, ReactNode } from 'react';
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { FarmRenderer, FarmRendererCapabilities, FarmRendererCapabilitiesInput,
4
4
  export { f as fileExists, g as globFiles, l as logger, m as matchRoute, a as matchRoutePrefix, p as parseRoutePath, d as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, b as toPosixPath, t as toRootRelativeUrlPath, c as toViteModuleId } from './utils-DVGmTVdc.js';
5
5
  export { createFarmStorage, createStorageClient, databaseStorage, defineStorageClient, disposeStorage, driverStorage, getStorage, initStorage, libsqlStorage, localStorage, memoryStorage, mongodbStorage, mysql2Storage, mysqlStorage, netlifyBlobsStorage, pgStorage, pgliteStorage, planetscaleStorage, postgresStorage, redisStorage, resolveStorageRuntimeClient, s3Storage, sqliteStorage, upstashStorage, vercelBlobStorage, vercelKVStorage } from './storage.js';
6
6
  export { D as DEFAULT_FARM_API_BASE_PATH, l as FarmAPIConfig, j as FarmAPIConfigResolverContext, k as FarmAPIConfigValue, F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes, R as ResolvedFarmAPIConfig, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint, o as getFarmAPIBaseURL, m as normalizeFarmAPIBasePath, n as normalizeFarmAPIConfig, r as resolveFarmAPIConfig, p as resolveFarmAPIRequestURL } from './config-B6GcJfNA.js';
7
- export { c as createFarmApp } from './app-CZIEOZIa.js';
7
+ export { c as createFarmApp } from './app-CQ6uhLEj.js';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import { ReactNode } from 'react';
10
10
  export { ComponentType, FC, PropsWithChildren, ReactElement, ReactNode } from 'react';
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-HEOT63FC.mjs";
10
10
  import {
11
11
  build
12
- } from "./chunk-DKD7DGTE.mjs";
12
+ } from "./chunk-KDKXMAIQ.mjs";
13
13
  import "./chunk-SL6HTIOK.mjs";
14
14
  import "./chunk-4S3ORGFA.mjs";
15
15
  import {
@@ -208,7 +208,7 @@ import {
208
208
  createClientPluginManager,
209
209
  installChunkErrorRecovery,
210
210
  isChunkLoadError
211
- } from "./chunk-TWN6IBIL.mjs";
211
+ } from "./chunk-UBDJMY7B.mjs";
212
212
  import {
213
213
  analyzeStaticRouteCandidate,
214
214
  collectSSGPages,
@@ -227,7 +227,7 @@ import {
227
227
  parseRouteRenderingDirective,
228
228
  resolveRouteRenderingConfig,
229
229
  resolveRouteRenderingConfigFromFile
230
- } from "./chunk-S6FO7OXA.mjs";
230
+ } from "./chunk-BF47GPQF.mjs";
231
231
  import {
232
232
  APITypeGenerator
233
233
  } from "./chunk-4RDYOSFE.mjs";
@@ -570,14 +570,14 @@ import {
570
570
  runWithFarmSpan
571
571
  } from "./chunk-ZRBCBOEX.mjs";
572
572
  import "./chunk-FXG2PS27.mjs";
573
- import "./chunk-IIKQBOGZ.mjs";
573
+ import "./chunk-PZLBMD63.mjs";
574
574
  import {
575
575
  createCompressionPlugin,
576
576
  createEnvPlugin,
577
577
  createHeadersPlugin,
578
578
  createLoggerPlugin,
579
579
  createRedirectsPlugin
580
- } from "./chunk-UGK7TW2V.mjs";
580
+ } from "./chunk-P57PPOQL.mjs";
581
581
  import {
582
582
  createRewritesPlugin
583
583
  } from "./chunk-I3FMD5VJ.mjs";
@@ -12242,6 +12242,31 @@ var init_route_manager = __esm({
12242
12242
  }
12243
12243
  });
12244
12244
 
12245
+ // src/server/dev-styles.ts
12246
+ function collectDevStylesheetUrls(modules) {
12247
+ const seen = /* @__PURE__ */ new Set();
12248
+ for (const mod of modules) {
12249
+ const id = mod.id ?? mod.file ?? "";
12250
+ if (!STYLE_EXTENSIONS.test(id)) continue;
12251
+ if (id.includes(".module.")) continue;
12252
+ const url = mod.url;
12253
+ if (!url || !url.startsWith("/")) continue;
12254
+ const bare = url.split("?")[0];
12255
+ if (bare === ALREADY_LINKED) continue;
12256
+ seen.add(bare);
12257
+ }
12258
+ return [...seen].sort();
12259
+ }
12260
+ var STYLE_EXTENSIONS, ALREADY_LINKED;
12261
+ var init_dev_styles = __esm({
12262
+ "src/server/dev-styles.ts"() {
12263
+ "use strict";
12264
+ STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
12265
+ ALREADY_LINKED = "/src/app/globals.css";
12266
+ __name(collectDevStylesheetUrls, "collectDevStylesheetUrls");
12267
+ }
12268
+ });
12269
+
12245
12270
  // src/server/full-document.ts
12246
12271
  function stripContentsWrappers(markup) {
12247
12272
  let out = markup.replace(/^\s+/, "");
@@ -15811,7 +15836,7 @@ var init_server3 = __esm({
15811
15836
  var version;
15812
15837
  var init_package = __esm({
15813
15838
  "package.json"() {
15814
- version = "0.1.0-beta.75";
15839
+ version = "0.1.0-beta.77";
15815
15840
  }
15816
15841
  });
15817
15842
 
@@ -15976,6 +16001,11 @@ var init_server4 = __esm({
15976
16001
  });
15977
16002
 
15978
16003
  // src/server/renderer.ts
16004
+ function shouldServePrerenderedPage(nodeEnv, method) {
16005
+ if (nodeEnv !== "production") return false;
16006
+ const normalizedMethod = (method || "GET").toUpperCase();
16007
+ return normalizedMethod === "GET" || normalizedMethod === "HEAD";
16008
+ }
15979
16009
  function formatSSGManifestError(error) {
15980
16010
  return error instanceof Error ? error.message : String(error);
15981
16011
  }
@@ -16173,6 +16203,7 @@ var init_renderer2 = __esm({
16173
16203
  fs4 = __toESM(require("fs"));
16174
16204
  path15 = __toESM(require("path"));
16175
16205
  init_utils();
16206
+ init_dev_styles();
16176
16207
  init_full_document();
16177
16208
  init_client_component();
16178
16209
  import_stream = require("stream");
@@ -16209,6 +16240,7 @@ var init_renderer2 = __esm({
16209
16240
  init_error_diagnostics();
16210
16241
  cachedClerkProvider = null;
16211
16242
  importRuntimeModule = new Function("specifier", "return import(specifier);");
16243
+ __name(shouldServePrerenderedPage, "shouldServePrerenderedPage");
16212
16244
  __name(formatSSGManifestError, "formatSSGManifestError");
16213
16245
  __name(parseSSGManifest, "parseSSGManifest");
16214
16246
  warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
@@ -16290,6 +16322,18 @@ var init_renderer2 = __esm({
16290
16322
  pageElement
16291
16323
  );
16292
16324
  }
16325
+ /// Stylesheets the app imported through JS (fontsource packages, component
16326
+ /// CSS) that the document must link alongside globals.css — see #658.
16327
+ collectDevStyleHrefs() {
16328
+ const graph = this.viteServer?.moduleGraph;
16329
+ if (!graph) return [];
16330
+ return collectDevStylesheetUrls(graph.idToModuleMap.values());
16331
+ }
16332
+ collectDevStyleLinks() {
16333
+ return this.collectDevStyleHrefs().map(
16334
+ (href) => `<link rel="stylesheet" href="${escapeHtmlAttribute2(href)}">`
16335
+ );
16336
+ }
16293
16337
  createLayoutBoundary(pattern, layoutElement) {
16294
16338
  return this.rendererRuntime.createElement(
16295
16339
  "div",
@@ -16722,7 +16766,7 @@ var init_renderer2 = __esm({
16722
16766
  return;
16723
16767
  }
16724
16768
  }
16725
- if (process.env.NODE_ENV === "production") {
16769
+ if (shouldServePrerenderedPage(process.env.NODE_ENV, req.method)) {
16726
16770
  const ssgPage = await this.shouldServeSSG(pathname);
16727
16771
  if (ssgPage) {
16728
16772
  const served = await this.serveSSGPage(req, res, ssgPage);
@@ -17504,7 +17548,11 @@ var init_renderer2 = __esm({
17504
17548
  {
17505
17549
  tag: "link",
17506
17550
  attrs: { rel: "stylesheet", href: "/src/app/globals.css" }
17507
- }
17551
+ },
17552
+ ...this.collectDevStyleHrefs().map((href) => ({
17553
+ tag: "link",
17554
+ attrs: { rel: "stylesheet", href }
17555
+ }))
17508
17556
  ]
17509
17557
  };
17510
17558
  for (const routeEntry of manifest.routes) {
@@ -17600,6 +17648,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17600
17648
  rendererHead,
17601
17649
  renderFarmFontDevHead(this.config.root || process.cwd()),
17602
17650
  `<link rel="stylesheet" href="/src/app/globals.css">`,
17651
+ ...this.collectDevStyleLinks(),
17603
17652
  `<script type="module" src="/@vite/client"></script>`,
17604
17653
  rendererHydrationScript,
17605
17654
  bootstrapScript
@@ -17618,7 +17667,8 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17618
17667
  ${documentTitleTag}${metaTags}${alternateTags}${rendererHead ? `
17619
17668
  ${rendererHead}` : ""}
17620
17669
  ${renderFarmFontDevHead(this.config.root || process.cwd())}
17621
- <link rel="stylesheet" href="/src/app/globals.css">
17670
+ <link rel="stylesheet" href="/src/app/globals.css">${this.collectDevStyleLinks().map((l) => `
17671
+ ${l}`).join("")}
17622
17672
  <script type="module" src="/@vite/client"></script>
17623
17673
  ${rendererHydrationScript}
17624
17674
  ${bootstrapScript}
@@ -17683,7 +17733,11 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17683
17733
  {
17684
17734
  tag: "link",
17685
17735
  attrs: { rel: "stylesheet", href: "/src/app/globals.css" }
17686
- }
17736
+ },
17737
+ ...this.collectDevStyleHrefs().map((href) => ({
17738
+ tag: "link",
17739
+ attrs: { rel: "stylesheet", href }
17740
+ }))
17687
17741
  ]
17688
17742
  };
17689
17743
  for (const routeEntry of manifest.routes) {
@@ -17770,6 +17824,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17770
17824
  { style: { display: "contents" } },
17771
17825
  element
17772
17826
  );
17827
+ const devStyleLinks = this.collectDevStyleLinks();
17773
17828
  const { pipe } = renderToPipeableStream2(streamRoot, {
17774
17829
  onShellReady() {
17775
17830
  const shellReadyMs = Date.now() - streamStartTime;
@@ -17791,7 +17846,8 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17791
17846
  ${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
17792
17847
  <title>${title}</title>${metaTags}${i18nAlternateTags}
17793
17848
  ${fontHead}
17794
- <link rel="stylesheet" href="/src/app/globals.css" />
17849
+ <link rel="stylesheet" href="/src/app/globals.css" />${devStyleLinks.map((l) => `
17850
+ ${l}`).join("")}
17795
17851
  <script type="module" src="/@vite/client"></script>
17796
17852
  ${propsScript}
17797
17853
  ${hydrationClickQueueScript}
@@ -18018,6 +18074,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue2(i18nSnapshot)};
18018
18074
  alternateLinks,
18019
18075
  fontHead,
18020
18076
  `<link rel="stylesheet" href="/src/app/globals.css" />`,
18077
+ ...this.collectDevStyleLinks(),
18021
18078
  `<script type="module" src="/@vite/client"></script>`,
18022
18079
  rendererHydrationScript,
18023
18080
  integrationManifestScript
@@ -18035,7 +18092,8 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue2(i18nSnapshot)};
18035
18092
  <link rel="icon" href="data:,">
18036
18093
  <title>${escapeHtmlAttribute2(documentTitle)}</title>${alternateLinks}
18037
18094
  ${fontHead}
18038
- <link rel="stylesheet" href="/src/app/globals.css" />
18095
+ <link rel="stylesheet" href="/src/app/globals.css" />${this.collectDevStyleLinks().map((l) => `
18096
+ ${l}`).join("")}
18039
18097
  <script type="module" src="/@vite/client"></script>
18040
18098
  ${rendererHydrationScript}
18041
18099
  ${integrationManifestScript}