@vercel/remix
Advanced tools
Comparing version 1.1.7 to 1.2.3
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,2 +31,4 @@ exports.build = void 0; | ||
const nft_1 = require("@vercel/nft"); | ||
const url_1 = require("url"); | ||
const utils_1 = require("./utils"); | ||
// Name of the Remix runtime adapter npm package for Vercel | ||
@@ -109,29 +134,33 @@ const REMIX_RUNTIME_ADAPTER_NAME = '@remix-run/vercel'; | ||
let needsHandler = true; | ||
const remixConfigFile = (0, utils_1.findConfig)(entrypointFsDirname, 'remix.config'); | ||
try { | ||
const remixConfig = require((0, path_1.join)(entrypointFsDirname, 'remix.config')); | ||
// If `serverBuildTarget === 'vercel'` then Remix will output a handler | ||
// that is already in Vercel (req, res) format, so don't inject the handler | ||
if (remixConfig.serverBuildTarget) { | ||
if (remixConfig.serverBuildTarget !== 'vercel') { | ||
throw new Error(`\`serverBuildTarget\` in Remix config must be "vercel" (got "${remixConfig.serverBuildTarget}")`); | ||
if (remixConfigFile) { | ||
const remixConfigModule = await Promise.resolve().then(() => __importStar(require((0, url_1.pathToFileURL)(remixConfigFile).href))); | ||
const remixConfig = remixConfigModule?.default || {}; | ||
// If `serverBuildTarget === 'vercel'` then Remix will output a handler | ||
// that is already in Vercel (req, res) format, so don't inject the handler | ||
if (remixConfig.serverBuildTarget) { | ||
if (remixConfig.serverBuildTarget !== 'vercel') { | ||
throw new Error(`\`serverBuildTarget\` in Remix config must be "vercel" (got "${remixConfig.serverBuildTarget}")`); | ||
} | ||
serverBuildPath = 'api/index.js'; | ||
needsHandler = false; | ||
} | ||
serverBuildPath = 'api/index.js'; | ||
needsHandler = false; | ||
if (remixConfig.serverBuildPath) { | ||
// Explicit file path where the server output file will be | ||
serverBuildPath = remixConfig.serverBuildPath; | ||
} | ||
else if (remixConfig.serverBuildDirectory) { | ||
// Explicit directory path the server output will be | ||
serverBuildPath = (0, path_1.join)(remixConfig.serverBuildDirectory, 'index.js'); | ||
} | ||
// Also check for whether were in a monorepo. | ||
// If we are, prepend the app root directory from config onto the build path. | ||
// e.g. `/apps/my-remix-app/api/index.js` | ||
const isMonorepo = repoRootPath && repoRootPath !== workPath; | ||
if (isMonorepo) { | ||
const rootDirectory = (0, path_1.relative)(repoRootPath, workPath); | ||
serverBuildPath = (0, path_1.join)(rootDirectory, serverBuildPath); | ||
} | ||
} | ||
if (remixConfig.serverBuildPath) { | ||
// Explicit file path where the server output file will be | ||
serverBuildPath = remixConfig.serverBuildPath; | ||
} | ||
else if (remixConfig.serverBuildDirectory) { | ||
// Explicit directory path the server output will be | ||
serverBuildPath = (0, path_1.join)(remixConfig.serverBuildDirectory, 'index.js'); | ||
} | ||
// Also check for whether were in a monorepo. | ||
// If we are, prepend the app root directory from config onto the build path. | ||
// e.g. `/apps/my-remix-app/api/index.js` | ||
const isMonorepo = repoRootPath && repoRootPath !== workPath; | ||
if (isMonorepo) { | ||
const rootDirectory = (0, path_1.relative)(repoRootPath, workPath); | ||
serverBuildPath = (0, path_1.join)(rootDirectory, serverBuildPath); | ||
} | ||
} | ||
@@ -138,0 +167,0 @@ catch (err) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prepareCache = void 0; | ||
const path_1 = require("path"); | ||
const url_1 = require("url"); | ||
const build_utils_1 = require("@vercel/build-utils"); | ||
const utils_1 = require("./utils"); | ||
const prepareCache = async ({ entrypoint, repoRootPath, workPath, }) => { | ||
@@ -11,5 +36,9 @@ let cacheDirectory = '.cache'; | ||
try { | ||
const remixConfig = require((0, path_1.join)(entrypointFsDirname, 'remix.config')); | ||
if (remixConfig.cacheDirectory) { | ||
cacheDirectory = remixConfig.cacheDirectory; | ||
const remixConfigFile = (0, utils_1.findConfig)(entrypointFsDirname, 'remix.config'); | ||
if (remixConfigFile) { | ||
const remixConfigModule = await Promise.resolve().then(() => __importStar(require((0, url_1.pathToFileURL)(remixConfigFile).href))); | ||
const remixConfig = remixConfigModule?.default || {}; | ||
if (remixConfig.cacheDirectory) { | ||
cacheDirectory = remixConfig.cacheDirectory; | ||
} | ||
} | ||
@@ -16,0 +45,0 @@ } |
{ | ||
"name": "@vercel/remix", | ||
"version": "1.1.7", | ||
"version": "1.2.3", | ||
"license": "MIT", | ||
@@ -14,5 +14,5 @@ "main": "./dist/index.js", | ||
"build": "node build.js", | ||
"test-integration-once": "yarn test test/test.js", | ||
"test-integration-once": "pnpm test test/test.js", | ||
"test": "jest --env node --verbose --bail --runInBand", | ||
"test-unit": "yarn test test/build.test.ts" | ||
"test-unit": "pnpm test test/build.test.ts" | ||
}, | ||
@@ -29,6 +29,6 @@ "files": [ | ||
"@types/node": "14.18.33", | ||
"@vercel/build-utils": "5.7.5", | ||
"@vercel/build-utils": "workspace:5.8.2", | ||
"typescript": "4.6.4" | ||
}, | ||
"gitHead": "4c3bc0532216f21f354623ada76b2315ef8ba519" | ||
"gitHead": "e54da8a2e5504987a956e2baaad6d817028b597f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
35249
18
345
4