@react-router/dev 0.0.0-experimental-1fcc8eb1d → 0.0.0-experimental-d82b9430b

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.
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @react-router/dev v0.0.0-experimental-1fcc8eb1d
3
+ * @react-router/dev v0.0.0-experimental-d82b9430b
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
@@ -928,7 +928,7 @@ function generateRoutes(ctx) {
928
928
  lineages.set(route.id, lineage2);
929
929
  const fullpath2 = fullpath(lineage2);
930
930
  if (!fullpath2) continue;
931
- const pages = explodeOptionalSegments(fullpath2);
931
+ const pages = expand(fullpath2);
932
932
  pages.forEach((page) => allPages.add(page));
933
933
  lineage2.forEach(({ id }) => {
934
934
  let routePages = routeToPages.get(id);
@@ -1157,28 +1157,27 @@ function paramsType(path8) {
1157
1157
  })
1158
1158
  );
1159
1159
  }
1160
- function explodeOptionalSegments(path8) {
1161
- let segments = path8.split("/");
1162
- if (segments.length === 0) return [];
1163
- let [first, ...rest] = segments;
1164
- let isOptional = first.endsWith("?");
1165
- let required = first.replace(/\?$/, "");
1166
- if (rest.length === 0) {
1167
- return isOptional ? [required, ""] : [required];
1168
- }
1169
- let restExploded = explodeOptionalSegments(rest.join("/"));
1170
- let result = [];
1171
- result.push(
1172
- ...restExploded.map(
1173
- (subpath) => subpath === "" ? required : [required, subpath].join("/")
1174
- )
1175
- );
1176
- if (isOptional) {
1177
- result.push(...restExploded);
1178
- }
1179
- return result.map(
1180
- (exploded) => path8.startsWith("/") && exploded === "" ? "/" : exploded
1181
- );
1160
+ function expand(fullpath2) {
1161
+ function recurse(segments2, index) {
1162
+ if (index === segments2.length) return [""];
1163
+ const segment = segments2[index];
1164
+ const isOptional = segment.endsWith("?");
1165
+ const isDynamic = segment.startsWith(":");
1166
+ const required = segment.replace(/\?$/, "");
1167
+ const keep = !isOptional || isDynamic;
1168
+ const kept = isDynamic ? segment : required;
1169
+ const withoutSegment = recurse(segments2, index + 1);
1170
+ const withSegment = withoutSegment.map((rest) => [kept, rest].join("/"));
1171
+ if (keep) return withSegment;
1172
+ return [...withoutSegment, ...withSegment];
1173
+ }
1174
+ const segments = fullpath2.split("/");
1175
+ const expanded = /* @__PURE__ */ new Set();
1176
+ for (let result of recurse(segments, 0)) {
1177
+ if (result !== "/") result = result.replace(/\/$/, "");
1178
+ expanded.add(result);
1179
+ }
1180
+ return expanded;
1182
1181
  }
1183
1182
  var import_dedent, Path3, Pathe, t2;
1184
1183
  var init_generate = __esm({
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-1fcc8eb1d
2
+ * @react-router/dev v0.0.0-experimental-d82b9430b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-1fcc8eb1d
2
+ * @react-router/dev v0.0.0-experimental-d82b9430b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { UNSAFE_MiddlewareEnabled, unstable_InitialContext, AppLoadContext } from 'react-router';
2
2
  import { Plugin } from 'vite';
3
- import { PlatformProxy, GetPlatformProxyOptions } from 'wrangler';
3
+ import { GetPlatformProxyOptions, PlatformProxy } from 'wrangler';
4
4
 
5
5
  type MaybePromise<T> = T | Promise<T>;
6
6
  type CfProperties = Record<string, unknown>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-1fcc8eb1d
2
+ * @react-router/dev v0.0.0-experimental-d82b9430b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-1fcc8eb1d
2
+ * @react-router/dev v0.0.0-experimental-d82b9430b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -915,7 +915,7 @@ function generateRoutes(ctx) {
915
915
  lineages.set(route.id, lineage2);
916
916
  const fullpath2 = fullpath(lineage2);
917
917
  if (!fullpath2) continue;
918
- const pages = explodeOptionalSegments(fullpath2);
918
+ const pages = expand(fullpath2);
919
919
  pages.forEach((page) => allPages.add(page));
920
920
  lineage2.forEach(({ id }) => {
921
921
  let routePages = routeToPages.get(id);
@@ -1144,28 +1144,27 @@ function paramsType(path6) {
1144
1144
  })
1145
1145
  );
1146
1146
  }
1147
- function explodeOptionalSegments(path6) {
1148
- let segments = path6.split("/");
1149
- if (segments.length === 0) return [];
1150
- let [first, ...rest] = segments;
1151
- let isOptional = first.endsWith("?");
1152
- let required = first.replace(/\?$/, "");
1153
- if (rest.length === 0) {
1154
- return isOptional ? [required, ""] : [required];
1147
+ function expand(fullpath2) {
1148
+ function recurse(segments2, index) {
1149
+ if (index === segments2.length) return [""];
1150
+ const segment = segments2[index];
1151
+ const isOptional = segment.endsWith("?");
1152
+ const isDynamic = segment.startsWith(":");
1153
+ const required = segment.replace(/\?$/, "");
1154
+ const keep = !isOptional || isDynamic;
1155
+ const kept = isDynamic ? segment : required;
1156
+ const withoutSegment = recurse(segments2, index + 1);
1157
+ const withSegment = withoutSegment.map((rest) => [kept, rest].join("/"));
1158
+ if (keep) return withSegment;
1159
+ return [...withoutSegment, ...withSegment];
1155
1160
  }
1156
- let restExploded = explodeOptionalSegments(rest.join("/"));
1157
- let result = [];
1158
- result.push(
1159
- ...restExploded.map(
1160
- (subpath) => subpath === "" ? required : [required, subpath].join("/")
1161
- )
1162
- );
1163
- if (isOptional) {
1164
- result.push(...restExploded);
1161
+ const segments = fullpath2.split("/");
1162
+ const expanded = /* @__PURE__ */ new Set();
1163
+ for (let result of recurse(segments, 0)) {
1164
+ if (result !== "/") result = result.replace(/\/$/, "");
1165
+ expanded.add(result);
1165
1166
  }
1166
- return result.map(
1167
- (exploded) => path6.startsWith("/") && exploded === "" ? "/" : exploded
1168
- );
1167
+ return expanded;
1169
1168
  }
1170
1169
 
1171
1170
  // typegen/index.ts
@@ -3271,7 +3270,7 @@ var reactRouterVitePlugin = () => {
3271
3270
  if (ctx.reactRouterConfig.future.unstable_viteEnvironmentApi) {
3272
3271
  viteDevServer.middlewares.use(async (req, res, next) => {
3273
3272
  let [reqPathname, reqSearch] = (req.url ?? "").split("?");
3274
- if (reqPathname === `${ctx.publicPath}@react-router/critical.css`) {
3273
+ if (reqPathname.endsWith("/@react-router/critical.css")) {
3275
3274
  let pathname = new URLSearchParams(reqSearch).get("pathname");
3276
3275
  if (!pathname) {
3277
3276
  return next("No pathname provided");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "0.0.0-experimental-1fcc8eb1d",
3
+ "version": "0.0.0-experimental-d82b9430b",
4
4
  "description": "Dev tools and CLI for React Router",
5
5
  "homepage": "https://reactrouter.com",
6
6
  "bugs": {
@@ -86,7 +86,7 @@
86
86
  "set-cookie-parser": "^2.6.0",
87
87
  "valibot": "^0.41.0",
88
88
  "vite-node": "^3.1.4",
89
- "@react-router/node": "0.0.0-experimental-1fcc8eb1d"
89
+ "@react-router/node": "0.0.0-experimental-d82b9430b"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/babel__core": "^7.20.5",
@@ -110,15 +110,15 @@
110
110
  "vite": "^6.1.0",
111
111
  "wireit": "0.14.9",
112
112
  "wrangler": "^4.2.0",
113
- "@react-router/serve": "0.0.0-experimental-1fcc8eb1d",
114
- "react-router": "^0.0.0-experimental-1fcc8eb1d"
113
+ "react-router": "^0.0.0-experimental-d82b9430b",
114
+ "@react-router/serve": "0.0.0-experimental-d82b9430b"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "typescript": "^5.1.0",
118
118
  "vite": "^5.1.0 || ^6.0.0",
119
119
  "wrangler": "^3.28.2 || ^4.0.0",
120
- "@react-router/serve": "^0.0.0-experimental-1fcc8eb1d",
121
- "react-router": "^0.0.0-experimental-1fcc8eb1d"
120
+ "@react-router/serve": "^0.0.0-experimental-d82b9430b",
121
+ "react-router": "^0.0.0-experimental-d82b9430b"
122
122
  },
123
123
  "peerDependenciesMeta": {
124
124
  "@react-router/serve": {