Skip to content

Return list of prerendered files from adapter utils #3099

Closed

Description

@geoffrich

Describe the problem

#2675 updated the prerender function to return a list of prerendered files. However, this list was not returned from the prerender function called from the adapter utils. See the code below: the internal prerender is called, but its return value is not used. This means the adapter can't access it.

async prerender({ all = false, dest, fallback }) {
await prerender({
out: dest,
all,
cwd,
config,
build_data,
fallback,
log
});
}

I think this was missed since #2674 did return the list of copied files from the adapter utils, but let me know if it was intentional.

Describe the proposed solution

Return the list of prerendered files from the adapter utils. This will allow adapter authors to know what files have been prerendered.

Alternatives considered

No response

Importance

nice to have

Additional Information

I maintain the Azure SWA adapter, and want to know if index.html was prerendered or not.

Activity

  1. geoffrich commented on Jan 6, 2022

    @geoffrich
    MemberAuthor

    Looks like this was fixed in the adapter API overhaul in #2931.

    async prerender({ all = false, dest, fallback }) {
    if (generated_manifest) {
    throw new Error(
    'Adapters must call prerender(...) before createEntries(...) or generateManifest(...)'
    );
    }
    const prerendered = await prerender({
    out: dest,
    all,
    cwd,
    config,
    build_data,
    fallback,
    log
    });
    prerendered.paths.forEach((path) => {
    prerendered_paths.add(path);
    prerendered_paths.add(path + '/');
    });
    return prerendered;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    adapters - generalSupport for functionality general to all adapters

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions