Skip to content

Commit 047d6a0

Browse files
authored
breaking: remove builder.createEntries (#15509)
This PR removes the deprecated `builder.createEntries` API. Requires #15506 to be merged first to remove references to it in the adapters --- ### Please don't delete this checklist! Before submitting the PR, please make sure you do the following: - [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs - [ ] This message body should clearly illustrate what problems it solves. - [ ] Ideally, include a test that fails without this PR but passes with it. ### Tests - [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check` ### Changesets - [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`. ### Edits - [ ] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.
1 parent 20b75f4 commit 047d6a0

File tree

4 files changed

+9
-58
lines changed

4 files changed

+9
-58
lines changed

.changeset/eighty-paws-love.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': major
3+
---
4+
5+
breaking: remove `createEntries` from the `Builder` object passed to adapter functions

packages/kit/src/core/adapt/builder.js

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -103,58 +103,6 @@ export function create_builder({
103103
);
104104
},
105105

106-
async createEntries(fn) {
107-
const seen = new Set();
108-
109-
for (let i = 0; i < route_data.length; i += 1) {
110-
const route = route_data[i];
111-
if (prerender_map.get(route.id) === true) continue;
112-
const { id, filter, complete } = fn(routes[i]);
113-
114-
if (seen.has(id)) continue;
115-
seen.add(id);
116-
117-
const group = [route];
118-
119-
// figure out which lower priority routes should be considered fallbacks
120-
for (let j = i + 1; j < route_data.length; j += 1) {
121-
if (prerender_map.get(routes[j].id) === true) continue;
122-
if (filter(routes[j])) {
123-
group.push(route_data[j]);
124-
}
125-
}
126-
127-
const filtered = new Set(group);
128-
129-
// heuristic: if /foo/[bar] is included, /foo/[bar].json should
130-
// also be included, since the page likely needs the endpoint
131-
// TODO is this still necessary, given the new way of doing things?
132-
filtered.forEach((route) => {
133-
if (route.page) {
134-
const endpoint = route_data.find((candidate) => candidate.id === route.id + '.json');
135-
136-
if (endpoint) {
137-
filtered.add(endpoint);
138-
}
139-
}
140-
});
141-
142-
if (filtered.size > 0) {
143-
await complete({
144-
generateManifest: ({ relativePath }) =>
145-
generate_manifest({
146-
build_data,
147-
prerendered: [],
148-
relative_path: relativePath,
149-
routes: Array.from(filtered),
150-
remotes,
151-
root: vite_config.root
152-
})
153-
});
154-
}
155-
}
156-
},
157-
158106
findServerAssets(route_data) {
159107
return find_server_assets(
160108
build_data,

packages/kit/src/exports/public.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,12 @@ export interface Builder {
122122
/** An array of all routes (including prerendered) */
123123
routes: RouteDefinition[];
124124

125-
// TODO 3.0 remove this method
126125
/**
127126
* Create separate functions that map to one or more routes of your app.
128127
* @param fn A function that groups a set of routes into an entry point
129-
* @deprecated Use `builder.routes` instead
128+
* @deprecated removed in 3.0. Use `builder.routes` instead
130129
*/
131-
createEntries: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
130+
createEntries?: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
132131

133132
/**
134133
* Find all the assets imported by server files belonging to `routes`

packages/kit/types/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ declare module '@sveltejs/kit' {
9797
/** An array of all routes (including prerendered) */
9898
routes: RouteDefinition[];
9999

100-
// TODO 3.0 remove this method
101100
/**
102101
* Create separate functions that map to one or more routes of your app.
103102
* @param fn A function that groups a set of routes into an entry point
104-
* @deprecated Use `builder.routes` instead
103+
* @deprecated removed in 3.0. Use `builder.routes` instead
105104
*/
106-
createEntries: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
105+
createEntries?: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
107106

108107
/**
109108
* Find all the assets imported by server files belonging to `routes`

0 commit comments

Comments
 (0)