@uniflowed/vite 0.0.0-alpha.27 → 0.0.0-alpha.29

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.
@@ -74,6 +74,9 @@ export const UNSUPPORTED_SEGMENTS = Object.freeze([
74
74
  */
75
75
  export const LAYOUT_PROP_NAMES = Object.freeze(["children", "params"]);
76
76
 
77
+ /** Template spellings that look conventional elsewhere but uf will not open. */
78
+ const UNSUPPORTED_TEMPLATE_FILES = Object.freeze(["template.js", "_uf.template.js"]);
79
+
77
80
  /** Extensions a page or layout may use; `.mdx` is a page written as content. */
78
81
  const PAGE_EXTENSIONS = [".js", ".jsx", ".mdx"];
79
82
  const MODULE_EXTENSIONS = [".js", ".jsx"];
@@ -328,6 +331,8 @@ export function scanRoutes(appRoot, options = {}) {
328
331
  a.name < b.name ? -1 : a.name > b.name ? 1 : 0,
329
332
  );
330
333
 
334
+ refuseUnsupportedTemplateFiles(directory, entries);
335
+
331
336
  // A `$default.js` answers one question — what a slot renders when the
332
337
  // URL says nothing about it — and this walk is everywhere a slot is not,
333
338
  // so one found here is a file nothing would ever open.
@@ -626,6 +631,8 @@ function scanSlot(parent, directoryName, name, segments, ownLayout, above, targe
626
631
  a.name < b.name ? -1 : a.name > b.name ? 1 : 0,
627
632
  );
628
633
 
634
+ refuseUnsupportedTemplateFiles(current, entries);
635
+
629
636
  let nestedSlots = [];
630
637
  for (const entry of entries) {
631
638
  if (!entry.isDirectory()) continue;
@@ -715,6 +722,24 @@ function findModule(directory, stem, extensions, target = "web") {
715
722
  return null;
716
723
  }
717
724
 
725
+ function refuseUnsupportedTemplateFiles(directory, entries) {
726
+ for (const entry of entries) {
727
+ if (!entry.isFile() || !UNSUPPORTED_TEMPLATE_FILES.includes(entry.name)) {
728
+ continue;
729
+ }
730
+ const file = path.join(directory, entry.name);
731
+ throw new Error(`${file}: ${unsupportedTemplateFileReason(entry.name)}`);
732
+ }
733
+ }
734
+
735
+ function unsupportedTemplateFileReason(fileName) {
736
+ return (
737
+ `\`${fileName}\` looks like a route template, but uf's route template file is ` +
738
+ "`$template.js`. This file would be ignored rather than remounting the route, so it is " +
739
+ "refused; rename it to `$template.js`. https://github.com/ubugeeei-prod/uf/issues/267"
740
+ );
741
+ }
742
+
718
743
  /**
719
744
  * What one directory name means to the route path.
720
745
  *
package/internal/rsc.js CHANGED
@@ -92,6 +92,14 @@ function clientModules(manifest) {
92
92
  module.environment === "client" || module.proximity === "reaches-boundary",
93
93
  );
94
94
  }
95
+ for (const boundary of manifest.clientBoundaries ?? []) {
96
+ if (boundary == null || typeof boundary.importer !== "string") continue;
97
+ modules.set(boundary.importer, true);
98
+ }
99
+ for (const root of manifest.clientBundleRoots ?? []) {
100
+ if (root == null || root.kind !== "module" || typeof root.path !== "string") continue;
101
+ modules.set(root.path, true);
102
+ }
95
103
  return modules;
96
104
  }
97
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniflowed/vite",
3
- "version": "0.0.0-alpha.27",
3
+ "version": "0.0.0-alpha.29",
4
4
  "description": "Vite, driven by uf.config.js: every Flow module through `uf transform`, MDX, the file-system router and static rendering as Vite plugins.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  "dependencies": {
35
35
  "@mdx-js/rollup": "^3.1.1",
36
36
  "@shikijs/rehype": "^3.23.0",
37
- "@uniflowed/host": "0.0.0-alpha.27",
38
- "@uniflowed/router": "0.0.0-alpha.27",
39
- "@uniflowed/server": "0.0.0-alpha.27",
40
- "@uniflowed/validator": "0.0.0-alpha.27",
37
+ "@uniflowed/host": "0.0.0-alpha.29",
38
+ "@uniflowed/router": "0.0.0-alpha.29",
39
+ "@uniflowed/server": "0.0.0-alpha.29",
40
+ "@uniflowed/validator": "0.0.0-alpha.29",
41
41
  "rehype-slug": "^6.0.0",
42
42
  "remark-frontmatter": "^5.0.0",
43
43
  "remark-gfm": "^4.0.1",