Skip to content

Commit

Permalink
rebase a ronis
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jun 23, 2024
1 parent dedc65c commit 2e9ace0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function greenwoodSyncApiRoutesOutputPath(compilation) {
if (bundle[key].exports?.find(exp => exp === 'handler')) {
const ext = bundle[key].facadeModuleId.split('.').pop();
const relativeFacade = new URL(`file://${bundle[key].facadeModuleId}`).pathname.replace(apisDir.pathname, `${basePath}/`).replace(`.${ext}`, '');
const route = `/api${relativeFacade}`; // ew URL(`file://${bundle[key].facadeModuleId}`).pathname.replace(apisDir.pathname, `${basePath}/`).replace(`.${ext}`, '');
const route = `/api${relativeFacade}`;

if (compilation.manifest.apis.has(route)) {
const api = compilation.manifest.apis.get(route);
Expand Down Expand Up @@ -457,14 +457,14 @@ const getRollupConfigForScriptResources = async (compilation) => {
};

const getRollupConfigForApis = async (compilation) => {
const { outputDir, pagesDir } = compilation.context;
const { outputDir, pagesDir, apisDir } = compilation.context;

return [...compilation.manifest.apis.values()]
.map(api => normalizePathnameForWindows(new URL(`.${api.path}`, pagesDir)))
.map((filepath) => {
// account for windows pathname shenanigans by "casting" filepath to a URL first
const ext = filepath.split('.').pop();
const entryName = new URL(`file://${filepath}`).pathname.replace(pagesDir.pathname, '').replace('/', '-').replace(`.${ext}`, '');
const entryName = new URL(`file://${filepath}`).pathname.replace(apisDir.pathname, '').replace(/\//g, '-').replace(`.${ext}`, '');

return {
input: filepath,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-adapter-vercel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function vercelAdapter(compilation) {
const api = apiRoutes.get(key);
const { outputPath } = api;
const id = key.replace(`${basePath}/api/`, '').replace(/\//g, '-');
const outputRoot = new URL(`./${basePath}/api/${id}.func/`, adapterOutputUrl);
const outputRoot = new URL(`.${basePath}/api/${id}.func/`, adapterOutputUrl);
const { assets = [] } = value;

await setupFunctionBuildFolder(id, outputType, outputRoot);
Expand Down

0 comments on commit 2e9ace0

Please sign in to comment.