@@ -22,6 +22,7 @@ import { UserError } from "../errors";
2222import { logger } from "../logger" ;
2323import { getSourceMappedString } from "../sourcemap" ;
2424import { updateCheck } from "../update-check" ;
25+ import { getClassNamesWhichUseSQLite } from "./validate-dev-props" ;
2526import type { ServiceFetch } from "../api" ;
2627import type { Config } from "../config" ;
2728import type {
@@ -676,55 +677,6 @@ export function buildMiniflareBindingOptions(config: MiniflareBindingsConfig): {
676677 } ;
677678}
678679
679- function getClassNamesWhichUseSQLite (
680- migrations : Config [ "migrations" ] | undefined
681- ) {
682- const classNameToUseSQLite = new Map < string , boolean > ( ) ;
683- ( migrations || [ ] ) . forEach ( ( migration ) => {
684- migration . deleted_classes ?. forEach ( ( deleted_class ) => {
685- if ( ! classNameToUseSQLite . delete ( deleted_class ) ) {
686- throw new UserError (
687- `Cannot apply deleted_classes migration to non-existent class ${ deleted_class } `
688- ) ;
689- }
690- } ) ;
691-
692- migration . renamed_classes ?. forEach ( ( { from, to } ) => {
693- const useSQLite = classNameToUseSQLite . get ( from ) ;
694- if ( useSQLite === undefined ) {
695- throw new UserError (
696- `Cannot apply renamed_classes migration to non-existent class ${ from } `
697- ) ;
698- } else {
699- classNameToUseSQLite . delete ( from ) ;
700- classNameToUseSQLite . set ( to , useSQLite ) ;
701- }
702- } ) ;
703-
704- migration . new_classes ?. forEach ( ( new_class ) => {
705- if ( classNameToUseSQLite . has ( new_class ) ) {
706- throw new UserError (
707- `Cannot apply new_classes migration to existing class ${ new_class } `
708- ) ;
709- } else {
710- classNameToUseSQLite . set ( new_class , false ) ;
711- }
712- } ) ;
713-
714- migration . new_sqlite_classes ?. forEach ( ( new_class ) => {
715- if ( classNameToUseSQLite . has ( new_class ) ) {
716- throw new UserError (
717- `Cannot apply new_sqlite_classes migration to existing class ${ new_class } `
718- ) ;
719- } else {
720- classNameToUseSQLite . set ( new_class , true ) ;
721- }
722- } ) ;
723- } ) ;
724-
725- return classNameToUseSQLite ;
726- }
727-
728680type PickTemplate < T , K extends string > = {
729681 [ P in keyof T & K ] : T [ P ] ;
730682} ;
0 commit comments