@vercel/remix-builder 5.2.0 → 5.2.2

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 (2) hide show
  1. package/dist/index.js +159 -136
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -2442,12 +2442,11 @@ var require_semver2 = __commonJS({
2442
2442
  }
2443
2443
  });
2444
2444
 
2445
- // ../../node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist/index.js
2445
+ // ../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js
2446
2446
  var require_dist = __commonJS({
2447
- "../../node_modules/.pnpm/path-to-regexp@6.2.1/node_modules/path-to-regexp/dist/index.js"(exports) {
2447
+ "../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports) {
2448
2448
  "use strict";
2449
2449
  Object.defineProperty(exports, "__esModule", { value: true });
2450
- exports.pathToRegexp = exports.tokensToRegexp = exports.regexpToFunction = exports.match = exports.tokensToFunction = exports.compile = exports.parse = void 0;
2451
2450
  function lexer(str) {
2452
2451
  var tokens = [];
2453
2452
  var i = 0;
@@ -2487,7 +2486,7 @@ var require_dist = __commonJS({
2487
2486
  break;
2488
2487
  }
2489
2488
  if (!name)
2490
- throw new TypeError("Missing parameter name at ".concat(i));
2489
+ throw new TypeError("Missing parameter name at " + i);
2491
2490
  tokens.push({ type: "NAME", index: i, value: name });
2492
2491
  i = j;
2493
2492
  continue;
@@ -2497,7 +2496,7 @@ var require_dist = __commonJS({
2497
2496
  var pattern = "";
2498
2497
  var j = i + 1;
2499
2498
  if (str[j] === "?") {
2500
- throw new TypeError('Pattern cannot start with "?" at '.concat(j));
2499
+ throw new TypeError('Pattern cannot start with "?" at ' + j);
2501
2500
  }
2502
2501
  while (j < str.length) {
2503
2502
  if (str[j] === "\\") {
@@ -2513,15 +2512,15 @@ var require_dist = __commonJS({
2513
2512
  } else if (str[j] === "(") {
2514
2513
  count++;
2515
2514
  if (str[j + 1] !== "?") {
2516
- throw new TypeError("Capturing groups are not allowed at ".concat(j));
2515
+ throw new TypeError("Capturing groups are not allowed at " + j);
2517
2516
  }
2518
2517
  }
2519
2518
  pattern += str[j++];
2520
2519
  }
2521
2520
  if (count)
2522
- throw new TypeError("Unbalanced pattern at ".concat(i));
2521
+ throw new TypeError("Unbalanced pattern at " + i);
2523
2522
  if (!pattern)
2524
- throw new TypeError("Missing pattern at ".concat(i));
2523
+ throw new TypeError("Missing pattern at " + i);
2525
2524
  tokens.push({ type: "PATTERN", index: i, value: pattern });
2526
2525
  i = j;
2527
2526
  continue;
@@ -2537,7 +2536,7 @@ var require_dist = __commonJS({
2537
2536
  }
2538
2537
  var tokens = lexer(str);
2539
2538
  var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
2540
- var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
2539
+ var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
2541
2540
  var result = [];
2542
2541
  var key = 0;
2543
2542
  var i = 0;
@@ -2551,7 +2550,7 @@ var require_dist = __commonJS({
2551
2550
  if (value2 !== void 0)
2552
2551
  return value2;
2553
2552
  var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
2554
- throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
2553
+ throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
2555
2554
  };
2556
2555
  var consumeText = function() {
2557
2556
  var result2 = "";
@@ -2628,7 +2627,7 @@ var require_dist = __commonJS({
2628
2627
  } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
2629
2628
  var matches = tokens.map(function(token) {
2630
2629
  if (typeof token === "object") {
2631
- return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
2630
+ return new RegExp("^(?:" + token.pattern + ")$", reFlags);
2632
2631
  }
2633
2632
  });
2634
2633
  return function(data) {
@@ -2644,17 +2643,17 @@ var require_dist = __commonJS({
2644
2643
  var repeat = token.modifier === "*" || token.modifier === "+";
2645
2644
  if (Array.isArray(value)) {
2646
2645
  if (!repeat) {
2647
- throw new TypeError('Expected "'.concat(token.name, '" to not repeat, but got an array'));
2646
+ throw new TypeError('Expected "' + token.name + '" to not repeat, but got an array');
2648
2647
  }
2649
2648
  if (value.length === 0) {
2650
2649
  if (optional)
2651
2650
  continue;
2652
- throw new TypeError('Expected "'.concat(token.name, '" to not be empty'));
2651
+ throw new TypeError('Expected "' + token.name + '" to not be empty');
2653
2652
  }
2654
2653
  for (var j = 0; j < value.length; j++) {
2655
2654
  var segment = encode(value[j], token);
2656
2655
  if (validate && !matches[i].test(segment)) {
2657
- throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
2656
+ throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
2658
2657
  }
2659
2658
  path += token.prefix + segment + token.suffix;
2660
2659
  }
@@ -2663,7 +2662,7 @@ var require_dist = __commonJS({
2663
2662
  if (typeof value === "string" || typeof value === "number") {
2664
2663
  var segment = encode(String(value), token);
2665
2664
  if (validate && !matches[i].test(segment)) {
2666
- throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
2665
+ throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
2667
2666
  }
2668
2667
  path += token.prefix + segment + token.suffix;
2669
2668
  continue;
@@ -2671,7 +2670,7 @@ var require_dist = __commonJS({
2671
2670
  if (optional)
2672
2671
  continue;
2673
2672
  var typeOfMessage = repeat ? "an array" : "a string";
2674
- throw new TypeError('Expected "'.concat(token.name, '" to be ').concat(typeOfMessage));
2673
+ throw new TypeError('Expected "' + token.name + '" to be ' + typeOfMessage);
2675
2674
  }
2676
2675
  return path;
2677
2676
  };
@@ -2724,19 +2723,17 @@ var require_dist = __commonJS({
2724
2723
  function regexpToRegexp(path, keys) {
2725
2724
  if (!keys)
2726
2725
  return path;
2727
- var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
2728
- var index = 0;
2729
- var execResult = groupsRegex.exec(path.source);
2730
- while (execResult) {
2731
- keys.push({
2732
- // Use parenthesized substring match if available, index otherwise
2733
- name: execResult[1] || index++,
2734
- prefix: "",
2735
- suffix: "",
2736
- modifier: "",
2737
- pattern: ""
2738
- });
2739
- execResult = groupsRegex.exec(path.source);
2726
+ var groups = path.source.match(/\((?!\?)/g);
2727
+ if (groups) {
2728
+ for (var i = 0; i < groups.length; i++) {
2729
+ keys.push({
2730
+ name: i,
2731
+ prefix: "",
2732
+ suffix: "",
2733
+ modifier: "",
2734
+ pattern: ""
2735
+ });
2736
+ }
2740
2737
  }
2741
2738
  return path;
2742
2739
  }
@@ -2744,7 +2741,7 @@ var require_dist = __commonJS({
2744
2741
  var parts = paths.map(function(path) {
2745
2742
  return pathToRegexp2(path, keys, options).source;
2746
2743
  });
2747
- return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
2744
+ return new RegExp("(?:" + parts.join("|") + ")", flags(options));
2748
2745
  }
2749
2746
  function stringToRegexp(path, keys, options) {
2750
2747
  return tokensToRegexp(parse(path, options), keys, options);
@@ -2755,9 +2752,9 @@ var require_dist = __commonJS({
2755
2752
  }
2756
2753
  var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
2757
2754
  return x;
2758
- } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
2759
- var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
2760
- var delimiterRe = "[".concat(escapeString(delimiter), "]");
2755
+ } : _d;
2756
+ var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
2757
+ var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
2761
2758
  var route = start ? "^" : "";
2762
2759
  for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
2763
2760
  var token = tokens_1[_i];
@@ -2772,34 +2769,33 @@ var require_dist = __commonJS({
2772
2769
  if (prefix || suffix) {
2773
2770
  if (token.modifier === "+" || token.modifier === "*") {
2774
2771
  var mod = token.modifier === "*" ? "?" : "";
2775
- route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
2772
+ route += "(?:" + prefix + "((?:" + token.pattern + ")(?:" + suffix + prefix + "(?:" + token.pattern + "))*)" + suffix + ")" + mod;
2776
2773
  } else {
2777
- route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
2774
+ route += "(?:" + prefix + "(" + token.pattern + ")" + suffix + ")" + token.modifier;
2778
2775
  }
2779
2776
  } else {
2780
- if (token.modifier === "+" || token.modifier === "*") {
2781
- route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
2782
- } else {
2783
- route += "(".concat(token.pattern, ")").concat(token.modifier);
2784
- }
2777
+ route += "(" + token.pattern + ")" + token.modifier;
2785
2778
  }
2786
2779
  } else {
2787
- route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
2780
+ route += "(?:" + prefix + suffix + ")" + token.modifier;
2788
2781
  }
2789
2782
  }
2790
2783
  }
2791
2784
  if (end) {
2792
2785
  if (!strict)
2793
- route += "".concat(delimiterRe, "?");
2794
- route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
2786
+ route += delimiter + "?";
2787
+ route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
2795
2788
  } else {
2796
2789
  var endToken = tokens[tokens.length - 1];
2797
- var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
2790
+ var isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : (
2791
+ // tslint:disable-next-line
2792
+ endToken === void 0
2793
+ );
2798
2794
  if (!strict) {
2799
- route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
2795
+ route += "(?:" + delimiter + "(?=" + endsWith + "))?";
2800
2796
  }
2801
2797
  if (!isEndDelimited) {
2802
- route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
2798
+ route += "(?=" + delimiter + "|" + endsWith + ")";
2803
2799
  }
2804
2800
  }
2805
2801
  return new RegExp(route, flags(options));
@@ -3206,6 +3202,66 @@ var require_dist2 = __commonJS({
3206
3202
  }
3207
3203
  });
3208
3204
 
3205
+ // ../../internals/path-to-regexp/dist/index.js
3206
+ var require_dist3 = __commonJS({
3207
+ "../../internals/path-to-regexp/dist/index.js"(exports) {
3208
+ "use strict";
3209
+ Object.defineProperty(exports, "__esModule", { value: true });
3210
+ exports.compile = exports.pathToRegexp = void 0;
3211
+ var path_to_regexp_1 = require_dist();
3212
+ Object.defineProperty(exports, "compile", { enumerable: true, get: function() {
3213
+ return path_to_regexp_1.compile;
3214
+ } });
3215
+ var path_to_regexp_updated_1 = require_dist2();
3216
+ function cloneKeys(keys) {
3217
+ if (typeof keys === "undefined") {
3218
+ return void 0;
3219
+ }
3220
+ return keys.slice(0);
3221
+ }
3222
+ function compareKeys(left, right) {
3223
+ const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
3224
+ const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
3225
+ return leftSerialized === rightSerialized;
3226
+ }
3227
+ function pathToRegexp2(callerId, path, keys, options) {
3228
+ const newKeys = cloneKeys(keys);
3229
+ const currentRegExp = (0, path_to_regexp_1.pathToRegexp)(path, keys, options);
3230
+ try {
3231
+ const currentKeys = keys;
3232
+ const newRegExp = (0, path_to_regexp_updated_1.pathToRegexp)(path, newKeys, options);
3233
+ const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
3234
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
3235
+ const message = JSON.stringify({
3236
+ path,
3237
+ currentRegExp: currentRegExp.toString(),
3238
+ newRegExp: newRegExp.toString()
3239
+ });
3240
+ console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
3241
+ }
3242
+ const isDiffKeys = !compareKeys(keys, newKeys);
3243
+ if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
3244
+ const message = JSON.stringify({
3245
+ isDiffKeys,
3246
+ currentKeys,
3247
+ newKeys
3248
+ });
3249
+ console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
3250
+ }
3251
+ } catch (err) {
3252
+ const error = err;
3253
+ const message = JSON.stringify({
3254
+ path,
3255
+ error: error.message
3256
+ });
3257
+ console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
3258
+ }
3259
+ return currentRegExp;
3260
+ }
3261
+ exports.pathToRegexp = pathToRegexp2;
3262
+ }
3263
+ });
3264
+
3209
3265
  // src/index.ts
3210
3266
  var src_exports = {};
3211
3267
  __export(src_exports, {
@@ -3226,41 +3282,10 @@ var import_build_utils3 = require("@vercel/build-utils");
3226
3282
  var import_semver = __toESM(require_semver2());
3227
3283
  var import_fs = require("fs");
3228
3284
  var import_path = require("path");
3229
- var import_path_to_regexp = __toESM(require_dist());
3230
- var import_path_to_regexp_updated = __toESM(require_dist2());
3285
+ var import_path_to_regexp = __toESM(require_dist3());
3231
3286
  var import_build_utils = require("@vercel/build-utils");
3232
3287
  var import_build_utils2 = require("@vercel/build-utils");
3233
3288
  var import_module = require("module");
3234
- function pathToRegexp(callerId, path, keys, options) {
3235
- const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path, keys, options);
3236
- try {
3237
- const currentKeys = keys;
3238
- const newKeys = [];
3239
- const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path, newKeys, options);
3240
- const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
3241
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
3242
- const message = JSON.stringify({
3243
- path,
3244
- currentRegExp: currentRegExp.toString(),
3245
- newRegExp: newRegExp.toString()
3246
- });
3247
- console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
3248
- }
3249
- const isDiffKeys = keys?.toString() !== newKeys?.toString();
3250
- if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
3251
- const message = JSON.stringify({
3252
- isDiffKeys,
3253
- currentKeys,
3254
- newKeys
3255
- });
3256
- console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
3257
- }
3258
- } catch (err) {
3259
- const error = err;
3260
- console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${error.message}`);
3261
- }
3262
- return currentRegExp;
3263
- }
3264
3289
  var require_ = (0, import_module.createRequire)(__filename);
3265
3290
  var SPLAT_PATH = "/:params*";
3266
3291
  var entryExts = [".js", ".jsx", ".ts", ".tsx"];
@@ -3371,7 +3396,7 @@ function getPathFromRoute(route, routes) {
3371
3396
  }
3372
3397
  function getRegExpFromPath(rePath) {
3373
3398
  const keys = [];
3374
- const re = pathToRegexp("923", rePath, keys);
3399
+ const re = (0, import_path_to_regexp.pathToRegexp)("923", rePath, keys);
3375
3400
  return keys.length > 0 ? re : false;
3376
3401
  }
3377
3402
  async function chdirAndReadConfig(remixRunDevPath, dir, packageJsonPath) {
@@ -3634,6 +3659,27 @@ function determineFrameworkSettings(workPath) {
3634
3659
  }
3635
3660
  return REMIX_FRAMEWORK_SETTINGS;
3636
3661
  }
3662
+ async function determineHandler({
3663
+ rootDir,
3664
+ serverBuildPath,
3665
+ serverEntryPoint,
3666
+ serverSourcePromise,
3667
+ sourceSearchValue
3668
+ }) {
3669
+ let handler = (0, import_path2.relative)(rootDir, serverBuildPath);
3670
+ let handlerPath = (0, import_path2.join)(rootDir, handler);
3671
+ if (!serverEntryPoint) {
3672
+ const baseServerBuildPath = (0, import_path2.basename)(serverBuildPath, ".js");
3673
+ handler = (0, import_path2.join)((0, import_path2.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3674
+ handlerPath = (0, import_path2.join)(rootDir, handler);
3675
+ const serverSource = await serverSourcePromise;
3676
+ await import_fs2.promises.writeFile(
3677
+ handlerPath,
3678
+ serverSource.replace(sourceSearchValue, `./${baseServerBuildPath}.js`)
3679
+ );
3680
+ }
3681
+ return { handler, handlerPath };
3682
+ }
3637
3683
  var build = async ({
3638
3684
  entrypoint,
3639
3685
  workPath,
@@ -3869,22 +3915,13 @@ var COMMON_NODE_FUNCTION_OPTIONS = {
3869
3915
  var COMMON_EDGE_FUNCTION_OPTIONS = { deploymentTarget: "v8-worker" };
3870
3916
  async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
3871
3917
  const isEdgeFunction = config.runtime === "edge";
3872
- const files = {};
3873
- let handler = (0, import_path2.relative)(rootDir, serverBuildPath);
3874
- let handlerPath = (0, import_path2.join)(rootDir, handler);
3875
- if (!serverEntryPoint) {
3876
- const baseServerBuildPath = (0, import_path2.basename)(serverBuildPath, ".js");
3877
- handler = (0, import_path2.join)((0, import_path2.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3878
- handlerPath = (0, import_path2.join)(rootDir, handler);
3879
- const reactRouterServerSrc = await reactRouterServerSrcPromise;
3880
- await import_fs2.promises.writeFile(
3881
- handlerPath,
3882
- reactRouterServerSrc.replace(
3883
- REACT_ROUTER_FRAMEWORK_SETTINGS.sourceSearchValue,
3884
- `./${baseServerBuildPath}.js`
3885
- )
3886
- );
3887
- }
3918
+ const { handler, handlerPath } = await determineHandler({
3919
+ rootDir,
3920
+ serverBuildPath,
3921
+ serverEntryPoint,
3922
+ serverSourcePromise: reactRouterServerSrcPromise,
3923
+ sourceSearchValue: REACT_ROUTER_FRAMEWORK_SETTINGS.sourceSearchValue
3924
+ });
3888
3925
  let conditions;
3889
3926
  let readFile;
3890
3927
  if (isEdgeFunction) {
@@ -3898,9 +3935,7 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
3898
3935
  readFile
3899
3936
  });
3900
3937
  logNftWarnings(trace.warnings, "react-router");
3901
- for (const file of trace.fileList) {
3902
- files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
3903
- }
3938
+ const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
3904
3939
  let fn;
3905
3940
  if (isEdgeFunction) {
3906
3941
  fn = new import_build_utils3.EdgeFunction({
@@ -3932,30 +3967,19 @@ async function createRenderReactRouterFunction(nodeVersion, entrypointDir, rootD
3932
3967
  return fn;
3933
3968
  }
3934
3969
  async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
3935
- const files = {};
3936
- let handler = (0, import_path2.relative)(rootDir, serverBuildPath);
3937
- let handlerPath = (0, import_path2.join)(rootDir, handler);
3938
- if (!serverEntryPoint) {
3939
- const baseServerBuildPath = (0, import_path2.basename)(serverBuildPath, ".js");
3940
- handler = (0, import_path2.join)((0, import_path2.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3941
- handlerPath = (0, import_path2.join)(rootDir, handler);
3942
- const nodeServerSrc = await nodeServerSrcPromise;
3943
- await import_fs2.promises.writeFile(
3944
- handlerPath,
3945
- nodeServerSrc.replace(
3946
- REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
3947
- `./${baseServerBuildPath}.js`
3948
- )
3949
- );
3950
- }
3970
+ const { handler, handlerPath } = await determineHandler({
3971
+ rootDir,
3972
+ serverBuildPath,
3973
+ serverEntryPoint,
3974
+ serverSourcePromise: nodeServerSrcPromise,
3975
+ sourceSearchValue: REMIX_FRAMEWORK_SETTINGS.sourceSearchValue
3976
+ });
3951
3977
  const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
3952
3978
  base: rootDir,
3953
3979
  processCwd: entrypointDir
3954
3980
  });
3955
3981
  logNftWarnings(trace.warnings, "@remix-run/node");
3956
- for (const file of trace.fileList) {
3957
- files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
3958
- }
3982
+ const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
3959
3983
  const fn = new import_build_utils3.NodejsLambda({
3960
3984
  ...COMMON_NODE_FUNCTION_OPTIONS,
3961
3985
  files,
@@ -3972,22 +3996,13 @@ async function createRenderNodeFunction(nodeVersion, entrypointDir, rootDir, ser
3972
3996
  return fn;
3973
3997
  }
3974
3998
  async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath, serverEntryPoint, frameworkVersion, config) {
3975
- const files = {};
3976
- let handler = (0, import_path2.relative)(rootDir, serverBuildPath);
3977
- let handlerPath = (0, import_path2.join)(rootDir, handler);
3978
- if (!serverEntryPoint) {
3979
- const baseServerBuildPath = (0, import_path2.basename)(serverBuildPath, ".js");
3980
- handler = (0, import_path2.join)((0, import_path2.dirname)(handler), `server-${baseServerBuildPath}.mjs`);
3981
- handlerPath = (0, import_path2.join)(rootDir, handler);
3982
- const edgeServerSrc = await edgeServerSrcPromise;
3983
- await import_fs2.promises.writeFile(
3984
- handlerPath,
3985
- edgeServerSrc.replace(
3986
- REMIX_FRAMEWORK_SETTINGS.sourceSearchValue,
3987
- `./${baseServerBuildPath}.js`
3988
- )
3989
- );
3990
- }
3999
+ const { handler, handlerPath } = await determineHandler({
4000
+ rootDir,
4001
+ serverBuildPath,
4002
+ serverEntryPoint,
4003
+ serverSourcePromise: edgeServerSrcPromise,
4004
+ sourceSearchValue: REMIX_FRAMEWORK_SETTINGS.sourceSearchValue
4005
+ });
3991
4006
  const trace = await (0, import_nft.nodeFileTrace)([handlerPath], {
3992
4007
  base: rootDir,
3993
4008
  processCwd: entrypointDir,
@@ -3995,9 +4010,7 @@ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath,
3995
4010
  readFile: edgeReadFile
3996
4011
  });
3997
4012
  logNftWarnings(trace.warnings, "@remix-run/server-runtime");
3998
- for (const file of trace.fileList) {
3999
- files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
4000
- }
4013
+ const files = await getFilesFromTrace({ fileList: trace.fileList, rootDir });
4001
4014
  const fn = new import_build_utils3.EdgeFunction({
4002
4015
  ...COMMON_EDGE_FUNCTION_OPTIONS,
4003
4016
  files,
@@ -4010,6 +4023,16 @@ async function createRenderEdgeFunction(entrypointDir, rootDir, serverBuildPath,
4010
4023
  });
4011
4024
  return fn;
4012
4025
  }
4026
+ async function getFilesFromTrace({
4027
+ fileList,
4028
+ rootDir
4029
+ }) {
4030
+ const files = {};
4031
+ for (const file of fileList) {
4032
+ files[file] = await import_build_utils3.FileFsRef.fromFsPath({ fsPath: (0, import_path2.join)(rootDir, file) });
4033
+ }
4034
+ return files;
4035
+ }
4013
4036
 
4014
4037
  // src/build-legacy.ts
4015
4038
  var import_ts_morph2 = require("ts-morph");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/remix-builder",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "homepage": "https://vercel.com/docs",
@@ -25,10 +25,9 @@
25
25
  "@types/node": "14.18.33",
26
26
  "@types/semver": "7.3.13",
27
27
  "@vercel/build-utils": "9.2.0",
28
+ "@vercel-internals/path-to-regexp": "1.0.0",
28
29
  "glob": "10.3.16",
29
30
  "jest-junit": "16.0.0",
30
- "path-to-regexp": "6.2.1",
31
- "path-to-regexp-updated": "npm:path-to-regexp@6.3.0",
32
31
  "semver": "7.5.2",
33
32
  "vitest": "2.0.1"
34
33
  },