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

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-TWN6IBIL.mjs → chunk-ENS436YL.mjs} +2 -2
  8. package/dist/{chunk-IIKQBOGZ.mjs → chunk-MV5WATSI.mjs} +2 -2
  9. package/dist/{chunk-IIKQBOGZ.mjs.map → chunk-MV5WATSI.mjs.map} +1 -1
  10. package/dist/{chunk-S6FO7OXA.mjs → chunk-NN6KJF7I.mjs} +52 -7
  11. package/dist/chunk-NN6KJF7I.mjs.map +1 -0
  12. package/dist/{chunk-DKD7DGTE.mjs → chunk-OL7GH5ZC.mjs} +2 -2
  13. package/dist/{chunk-UGK7TW2V.mjs → chunk-P57PPOQL.mjs} +18 -6
  14. package/dist/chunk-P57PPOQL.mjs.map +1 -0
  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 +75 -11
  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 +58 -6
  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 +51 -6
  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 +68 -11
  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 +51 -6
  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-TWN6IBIL.mjs.map → chunk-ENS436YL.mjs.map} +0 -0
  57. /package/dist/{chunk-DKD7DGTE.mjs.map → chunk-OL7GH5ZC.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-OL7GH5ZC.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-ENS436YL.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-NN6KJF7I.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-MV5WATSI.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.76";
15815
15840
  }
15816
15841
  });
15817
15842
 
@@ -16173,6 +16198,7 @@ var init_renderer2 = __esm({
16173
16198
  fs4 = __toESM(require("fs"));
16174
16199
  path15 = __toESM(require("path"));
16175
16200
  init_utils();
16201
+ init_dev_styles();
16176
16202
  init_full_document();
16177
16203
  init_client_component();
16178
16204
  import_stream = require("stream");
@@ -16290,6 +16316,18 @@ var init_renderer2 = __esm({
16290
16316
  pageElement
16291
16317
  );
16292
16318
  }
16319
+ /// Stylesheets the app imported through JS (fontsource packages, component
16320
+ /// CSS) that the document must link alongside globals.css — see #658.
16321
+ collectDevStyleHrefs() {
16322
+ const graph = this.viteServer?.moduleGraph;
16323
+ if (!graph) return [];
16324
+ return collectDevStylesheetUrls(graph.idToModuleMap.values());
16325
+ }
16326
+ collectDevStyleLinks() {
16327
+ return this.collectDevStyleHrefs().map(
16328
+ (href) => `<link rel="stylesheet" href="${escapeHtmlAttribute2(href)}">`
16329
+ );
16330
+ }
16293
16331
  createLayoutBoundary(pattern, layoutElement) {
16294
16332
  return this.rendererRuntime.createElement(
16295
16333
  "div",
@@ -17504,7 +17542,11 @@ var init_renderer2 = __esm({
17504
17542
  {
17505
17543
  tag: "link",
17506
17544
  attrs: { rel: "stylesheet", href: "/src/app/globals.css" }
17507
- }
17545
+ },
17546
+ ...this.collectDevStyleHrefs().map((href) => ({
17547
+ tag: "link",
17548
+ attrs: { rel: "stylesheet", href }
17549
+ }))
17508
17550
  ]
17509
17551
  };
17510
17552
  for (const routeEntry of manifest.routes) {
@@ -17600,6 +17642,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17600
17642
  rendererHead,
17601
17643
  renderFarmFontDevHead(this.config.root || process.cwd()),
17602
17644
  `<link rel="stylesheet" href="/src/app/globals.css">`,
17645
+ ...this.collectDevStyleLinks(),
17603
17646
  `<script type="module" src="/@vite/client"></script>`,
17604
17647
  rendererHydrationScript,
17605
17648
  bootstrapScript
@@ -17618,7 +17661,8 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17618
17661
  ${documentTitleTag}${metaTags}${alternateTags}${rendererHead ? `
17619
17662
  ${rendererHead}` : ""}
17620
17663
  ${renderFarmFontDevHead(this.config.root || process.cwd())}
17621
- <link rel="stylesheet" href="/src/app/globals.css">
17664
+ <link rel="stylesheet" href="/src/app/globals.css">${this.collectDevStyleLinks().map((l) => `
17665
+ ${l}`).join("")}
17622
17666
  <script type="module" src="/@vite/client"></script>
17623
17667
  ${rendererHydrationScript}
17624
17668
  ${bootstrapScript}
@@ -17683,7 +17727,11 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17683
17727
  {
17684
17728
  tag: "link",
17685
17729
  attrs: { rel: "stylesheet", href: "/src/app/globals.css" }
17686
- }
17730
+ },
17731
+ ...this.collectDevStyleHrefs().map((href) => ({
17732
+ tag: "link",
17733
+ attrs: { rel: "stylesheet", href }
17734
+ }))
17687
17735
  ]
17688
17736
  };
17689
17737
  for (const routeEntry of manifest.routes) {
@@ -17770,6 +17818,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17770
17818
  { style: { display: "contents" } },
17771
17819
  element
17772
17820
  );
17821
+ const devStyleLinks = this.collectDevStyleLinks();
17773
17822
  const { pipe } = renderToPipeableStream2(streamRoot, {
17774
17823
  onShellReady() {
17775
17824
  const shellReadyMs = Date.now() - streamStartTime;
@@ -17791,7 +17840,8 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
17791
17840
  ${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
17792
17841
  <title>${title}</title>${metaTags}${i18nAlternateTags}
17793
17842
  ${fontHead}
17794
- <link rel="stylesheet" href="/src/app/globals.css" />
17843
+ <link rel="stylesheet" href="/src/app/globals.css" />${devStyleLinks.map((l) => `
17844
+ ${l}`).join("")}
17795
17845
  <script type="module" src="/@vite/client"></script>
17796
17846
  ${propsScript}
17797
17847
  ${hydrationClickQueueScript}
@@ -18018,6 +18068,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue2(i18nSnapshot)};
18018
18068
  alternateLinks,
18019
18069
  fontHead,
18020
18070
  `<link rel="stylesheet" href="/src/app/globals.css" />`,
18071
+ ...this.collectDevStyleLinks(),
18021
18072
  `<script type="module" src="/@vite/client"></script>`,
18022
18073
  rendererHydrationScript,
18023
18074
  integrationManifestScript
@@ -18035,7 +18086,8 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue2(i18nSnapshot)};
18035
18086
  <link rel="icon" href="data:,">
18036
18087
  <title>${escapeHtmlAttribute2(documentTitle)}</title>${alternateLinks}
18037
18088
  ${fontHead}
18038
- <link rel="stylesheet" href="/src/app/globals.css" />
18089
+ <link rel="stylesheet" href="/src/app/globals.css" />${this.collectDevStyleLinks().map((l) => `
18090
+ ${l}`).join("")}
18039
18091
  <script type="module" src="/@vite/client"></script>
18040
18092
  ${rendererHydrationScript}
18041
18093
  ${integrationManifestScript}