@vercel/remix-builder 5.4.6 → 5.4.8

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 +28 -8
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -2730,14 +2730,34 @@ async function ensureSymlink(target, nodeModulesDir, pkgName) {
2730
2730
  await import_fs.promises.symlink(relativeTarget, symlinkPath);
2731
2731
  (0, import_build_utils.debug)(`Created symlink for "${pkgName}"`);
2732
2732
  }
2733
- function isESM(path) {
2734
- let isESM2 = false;
2735
- try {
2736
- require_(path);
2737
- } catch (err) {
2738
- isESM2 = err.code === "ERR_REQUIRE_ESM";
2733
+ async function isESM(remixConfigPath) {
2734
+ switch ((0, import_path.extname)(remixConfigPath)) {
2735
+ case ".mjs": {
2736
+ return true;
2737
+ }
2738
+ case ".cjs": {
2739
+ return false;
2740
+ }
2741
+ default: {
2742
+ if (import_semver.default.gte(process.version, "20.19.0")) {
2743
+ const { type } = JSON.parse(
2744
+ await import_fs.promises.readFile(
2745
+ (0, import_path.join)((0, import_path.dirname)(remixConfigPath), "package.json"),
2746
+ "utf8"
2747
+ )
2748
+ );
2749
+ if (type === "module") {
2750
+ return true;
2751
+ }
2752
+ }
2753
+ try {
2754
+ require_(remixConfigPath);
2755
+ return false;
2756
+ } catch (err) {
2757
+ return err.code === "ERR_REQUIRE_ESM";
2758
+ }
2759
+ }
2739
2760
  }
2740
- return isESM2;
2741
2761
  }
2742
2762
  function hasScript(scriptName, pkg) {
2743
2763
  const scripts = pkg?.scripts || {};
@@ -3623,7 +3643,7 @@ var build2 = async ({
3623
3643
  if (!isHydrogen2 && remixConfigPath && renamedRemixConfigPath) {
3624
3644
  await import_fs3.promises.rename(remixConfigPath, renamedRemixConfigPath);
3625
3645
  let patchedConfig;
3626
- if (isESM(renamedRemixConfigPath)) {
3646
+ if (await isESM(renamedRemixConfigPath)) {
3627
3647
  patchedConfig = `import config from './${(0, import_path4.basename)(
3628
3648
  renamedRemixConfigPath
3629
3649
  )}';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/remix-builder",
3
- "version": "5.4.6",
3
+ "version": "5.4.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "homepage": "https://vercel.com/docs",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@vercel/error-utils": "2.0.3",
19
19
  "@vercel/nft": "0.29.2",
20
- "@vercel/static-config": "3.0.0",
20
+ "@vercel/static-config": "3.1.0",
21
21
  "path-to-regexp-updated": "npm:path-to-regexp@6.3.0",
22
22
  "path-to-regexp": "6.1.0",
23
23
  "ts-morph": "12.0.0"
@@ -26,7 +26,7 @@
26
26
  "@types/jest": "27.5.1",
27
27
  "@types/node": "14.18.33",
28
28
  "@types/semver": "7.3.13",
29
- "@vercel/build-utils": "10.5.1",
29
+ "@vercel/build-utils": "10.6.0",
30
30
  "glob": "10.3.16",
31
31
  "jest-junit": "16.0.0",
32
32
  "semver": "7.5.2",