diff --git a/packages/_internal/pubspec.lock b/packages/_internal/pubspec.lock index 12961a07..3baf5204 100644 --- a/packages/_internal/pubspec.lock +++ b/packages/_internal/pubspec.lock @@ -5,95 +5,95 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77" + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" url: "https://pub.dev" source: hosted - version: "73.0.0" + version: "76.0.0" _macros: dependency: transitive description: dart source: sdk - version: "0.3.2" + version: "0.3.3" analyzer: dependency: transitive description: name: analyzer - sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a" + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" url: "https://pub.dev" source: hosted - version: "6.8.0" + version: "6.11.0" args: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.6.0" async: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" build: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" build_config: dependency: transitive description: name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" build_daemon: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "294a2edaf4814a378725bfe6358210196f5ea37af89ecd81bfa32960113d4948" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.3" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + sha256: "99d3980049739a985cf9b21f30881f46db3ebc62c5b8d5e60e27440876b1ba1e" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3" build_runner: dependency: "direct dev" description: name: build_runner - sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04 + sha256: "74691599a5bc750dc96a6b4bfd48f7d9d66453eab04c7f4063134800d6a5c573" url: "https://pub.dev" source: hosted - version: "2.4.12" + version: "2.4.14" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "8.0.0" built_collection: dependency: transitive description: @@ -106,10 +106,10 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" url: "https://pub.dev" source: hosted - version: "8.9.2" + version: "8.9.3" checked_yaml: dependency: transitive description: @@ -122,58 +122,58 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.10.1" collection: dependency: transitive description: name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.19.0" + version: "1.19.1" convert: dependency: transitive description: name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" crypto: dependency: transitive description: name: crypto - sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.6" dart_style: dependency: transitive description: name: dart_style - sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "2.3.7" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" fixnum: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" freezed: dependency: "direct dev" description: @@ -218,26 +218,26 @@ packages: dependency: transitive description: name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" http_parser: dependency: transitive description: name: http_parser - sha256: "40f592dd352890c3b60fec1b68e786cefb9603e05ff303dbc4dda49b304ecdf4" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.1.2" io: dependency: transitive description: name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" js: dependency: transitive description: @@ -258,58 +258,58 @@ packages: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" macros: dependency: transitive description: name: macros - sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" url: "https://pub.dev" source: hosted - version: "0.1.2-main.4" + version: "0.1.3-main.0" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.16.0" mime: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "2.0.0" package_config: dependency: transitive description: name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" pool: dependency: transitive description: @@ -322,18 +322,18 @@ packages: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" shelf: dependency: transitive description: @@ -346,10 +346,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" source_gen: dependency: transitive description: @@ -362,90 +362,90 @@ packages: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.10.1" stack_trace: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "4ac0537115a24d772c408a2520ecd0abb99bca2ea9c4e634ccbdbfae64fe17ec" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" stream_transform: dependency: transitive description: name: stream_transform - sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd url: "https://pub.dev" source: hosted - version: "0.7.3" + version: "0.7.4" timing: dependency: transitive description: name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" watcher: dependency: transitive description: name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" web: dependency: transitive description: name: web - sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.0" web_socket: dependency: transitive description: @@ -466,9 +466,9 @@ packages: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.3" sdks: - dart: ">=3.5.0-259.0.dev <4.0.0" + dart: ">=3.6.0 <4.0.0" diff --git a/packages/freezed/CHANGELOG.md b/packages/freezed/CHANGELOG.md index 215a080d..03017c1c 100644 --- a/packages/freezed/CHANGELOG.md +++ b/packages/freezed/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased path + +Support analyzer 7.0.0 + ## 2.5.7 - 2024-07-15 - `freezed_annotation` upgraded to `2.4.4` diff --git a/packages/freezed/analysis_options.yaml b/packages/freezed/analysis_options.yaml index b9ea55f1..1b5be40a 100644 --- a/packages/freezed/analysis_options.yaml +++ b/packages/freezed/analysis_options.yaml @@ -48,7 +48,6 @@ linter: - omit_local_variable_types - only_throw_errors - overridden_fields - - package_api_docs - package_names - package_prefixed_library_names - prefer_adjacent_string_concatenation diff --git a/packages/freezed/lib/builder.dart b/packages/freezed/lib/builder.dart index eaece8e7..883237ae 100644 --- a/packages/freezed/lib/builder.dart +++ b/packages/freezed/lib/builder.dart @@ -1,4 +1,5 @@ import 'package:build/build.dart'; +import 'package:dart_style/dart_style.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:source_gen/source_gen.dart'; @@ -8,7 +9,11 @@ import 'src/freezed_generator.dart'; Builder freezed(BuilderOptions options) { return PartBuilder( [FreezedGenerator(Freezed.fromJson(options.config))], - formatOutput: options.config['format'] == false ? (str) => str : null, + formatOutput: (str, version) { + if (options.config['format'] == false) return str; + + return DartFormatter(languageVersion: version).format(str); + }, '.freezed.dart', header: ''' // coverage:ignore-file diff --git a/packages/freezed/lib/src/ast.dart b/packages/freezed/lib/src/ast.dart index 9c3848b2..53d82866 100644 --- a/packages/freezed/lib/src/ast.dart +++ b/packages/freezed/lib/src/ast.dart @@ -57,7 +57,7 @@ extension ClassX on ClassDeclaration { extension ConstructorX on ConstructorDeclaration { String get fullName { // ignore: deprecated_member_use, latest analyzer with enclosingElement3 not available in stable channel - final classElement = declaredElement!.enclosingElement; + final classElement = declaredElement!.enclosingElement3; var generics = classElement.typeParameters.map((e) => '\$${e.name}').join(', '); @@ -66,14 +66,14 @@ extension ConstructorX on ConstructorDeclaration { } // ignore: deprecated_member_use, latest analyzer with enclosingElement3 not available in stable channel - final className = classElement.enclosingElement.name; + final className = classElement.enclosingElement3.name; return name == null ? '$className$generics' : '$className$generics.$name'; } String get escapedName { // ignore: deprecated_member_use, latest analyzer with enclosingElement3 not available in stable channel - final classElement = declaredElement!.enclosingElement; + final classElement = declaredElement!.enclosingElement3; var generics = classElement.typeParameters.map((e) => '\$${e.name}').join(', '); diff --git a/packages/freezed/lib/src/tools/recursive_import_locator.dart b/packages/freezed/lib/src/tools/recursive_import_locator.dart index e4f76298..10339f64 100644 --- a/packages/freezed/lib/src/tools/recursive_import_locator.dart +++ b/packages/freezed/lib/src/tools/recursive_import_locator.dart @@ -31,8 +31,14 @@ extension FindAllAvailableTopLevelElements on LibraryElement { yield* topLevelElements; final librariesToCheck = checkExports - ? libraryExports.map(_LibraryDirectives.fromExport).nonNulls - : libraryImports.map(_LibraryDirectives.fromImport).nonNulls; + ? units + .expand((e) => e.libraryExports) + .map(_LibraryDirectives.fromExport) + .nonNulls + : units + .expand((e) => e.libraryImports) + .map(_LibraryDirectives.fromImport) + .nonNulls; for (final directive in librariesToCheck) { if (!visitedLibraryPaths.add(directive.key)) { diff --git a/packages/freezed/lib/src/tools/type.dart b/packages/freezed/lib/src/tools/type.dart index 61444674..0ab008dc 100644 --- a/packages/freezed/lib/src/tools/type.dart +++ b/packages/freezed/lib/src/tools/type.dart @@ -41,15 +41,15 @@ String resolveFullTypeStringFrom( LibraryElement originLibrary, DartType type, ) { - final owner = originLibrary.prefixes.firstWhereOrNull( - (e) { - return e.imports.any((l) { - return l.importedLibrary!.anyTransitiveExport((library) { - return library.id == _getElementForType(type)?.library?.id; - }); + final owner = originLibrary.units + .expand((e) => e.libraryImportPrefixes) + .firstWhereOrNull((e) { + return e.imports.any((l) { + return l.importedLibrary!.anyTransitiveExport((library) { + return library.id == _getElementForType(type)?.library?.id; }); - }, - ); + }); + }); String? displayType = type.getDisplayString(); diff --git a/packages/freezed/pubspec.yaml b/packages/freezed/pubspec.yaml index 8dde2f23..09177e25 100644 --- a/packages/freezed/pubspec.yaml +++ b/packages/freezed/pubspec.yaml @@ -10,16 +10,15 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - analyzer: ">=6.5.0 <7.0.0" + analyzer: ">=7.0.0 <8.0.0" build: ^2.3.1 build_config: ^1.1.0 collection: ^1.15.0 meta: ^1.9.1 - source_gen: ^1.4.0 + source_gen: ^2.0.0 freezed_annotation: ^2.4.4 json_annotation: ^4.8.0 - # Indirect dependency, but fixes a compiler error when using `pub downgrade` - dart_style: ^2.3.6 + dart_style: ^3.0.1 dev_dependencies: json_serializable: ^6.3.2 @@ -28,4 +27,4 @@ dev_dependencies: test: ^1.21.0 matcher: ^0.12.14 source_gen_test: ^1.0.6 - expect_error: ^1.0.5 + expect_error: ^1.0.8 diff --git a/packages/freezed/test/integration/json.dart b/packages/freezed/test/integration/json.dart index e45e09e2..c2b2c6f1 100644 --- a/packages/freezed/test/integration/json.dart +++ b/packages/freezed/test/integration/json.dart @@ -38,10 +38,10 @@ const pUnionJson = _$PUnionJsonWithExtendsFromJson; class _PUnionJsonWithExtends extends Base with _$PUnionJsonWithExtends { _PUnionJsonWithExtends._(); - // ignore: unused_element + // ignore: unused_element, unused_element_parameter factory _PUnionJsonWithExtends.first({int? first}) = _PUnionJsonFirstWithExtends; - // ignore: unused_element + // ignore: unused_element, unused_element_parameter factory _PUnionJsonWithExtends.second({int? second}) = _PUnionJsonSecondWithExtends; diff --git a/packages/freezed_lint/example/pubspec.yaml b/packages/freezed_lint/example/pubspec.yaml index 5301394c..5379bf58 100644 --- a/packages/freezed_lint/example/pubspec.yaml +++ b/packages/freezed_lint/example/pubspec.yaml @@ -14,11 +14,5 @@ dev_dependencies: freezed_lint: any dependency_overrides: - freezed: - path: ../../freezed - freezed_annotation: - path: ../../freezed_annotation freezed_lint: path: ../ - -