Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Pages Plugins #222

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Pages Plugins #222

merged 1 commit into from
Apr 22, 2022

Conversation

GregBrimble
Copy link
Member

Adds the PagesPluginFunction type and the internal functionPath to Functions' context.

@changeset-bot
Copy link

changeset-bot bot commented Apr 21, 2022

🦋 Changeset detected

Latest commit: 9465a6b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/workers-types Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +19 to +28
type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
request: Request;
functionPath: string;
waitUntil: (promise: Promise<any>) => void;
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
env: Env & { ASSETS: { fetch: typeof fetch } };
params: Params<P>;
data: Data;
pluginArgs: PluginArgs;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about using an intersection type here?

Suggested change
type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
request: Request;
functionPath: string;
waitUntil: (promise: Promise<any>) => void;
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
env: Env & { ASSETS: { fetch: typeof fetch } };
params: Params<P>;
data: Data;
pluginArgs: PluginArgs;
};
type EventPluginContext<Env, P extends string, Data, PluginArgs> = EventContext<Env, P, Data> & {
pluginArgs: PluginArgs;
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, totally might. Just was keeping it separate whilst in development while we worked out the commonality.

When we merge the Plugin template and the Worker template, we'll probably make these an intersection :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🙂

@GregBrimble GregBrimble merged commit b96c23c into master Apr 22, 2022
@GregBrimble GregBrimble deleted the pages-plugins branch April 22, 2022 12:49
@github-actions github-actions bot mentioned this pull request Apr 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants