├── .gitignore ├── AFNetWorking2.X源码阅读 ├── AFNetWorking2.X源码阅读.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── AFNetWorking2.X源码阅读.xcscheme │ │ └── xcschememanagement.plist ├── AFNetWorking2.X源码阅读 │ ├── AFNetworking2.x │ │ ├── AFNetworking │ │ │ ├── AFHTTPRequestOperation.h │ │ │ ├── AFHTTPRequestOperation.m │ │ │ ├── AFHTTPRequestOperationManager.h │ │ │ ├── AFHTTPRequestOperationManager.m │ │ │ ├── AFHTTPSessionManager.h │ │ │ ├── AFHTTPSessionManager.m │ │ │ ├── AFNetworkReachabilityManager.h │ │ │ ├── AFNetworkReachabilityManager.m │ │ │ ├── AFNetworking.h │ │ │ ├── AFSecurityPolicy.h │ │ │ ├── AFSecurityPolicy.m │ │ │ ├── AFURLConnectionOperation.h │ │ │ ├── AFURLConnectionOperation.m │ │ │ ├── AFURLRequestSerialization.h │ │ │ ├── AFURLRequestSerialization.m │ │ │ ├── AFURLResponseSerialization.h │ │ │ ├── AFURLResponseSerialization.m │ │ │ ├── AFURLSessionManager.h │ │ │ └── AFURLSessionManager.m │ │ └── UIKit+AFNetworking │ │ │ ├── AFNetworkActivityIndicatorManager.h │ │ │ ├── AFNetworkActivityIndicatorManager.m │ │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ │ ├── UIAlertView+AFNetworking.h │ │ │ ├── UIAlertView+AFNetworking.m │ │ │ ├── UIButton+AFNetworking.h │ │ │ ├── UIButton+AFNetworking.m │ │ │ ├── UIImageView+AFNetworking.h │ │ │ ├── UIImageView+AFNetworking.m │ │ │ ├── UIKit+AFNetworking.h │ │ │ ├── UIProgressView+AFNetworking.h │ │ │ ├── UIProgressView+AFNetworking.m │ │ │ ├── UIRefreshControl+AFNetworking.h │ │ │ ├── UIRefreshControl+AFNetworking.m │ │ │ ├── UIWebView+AFNetworking.h │ │ │ └── UIWebView+AFNetworking.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── SecondViewController.h │ ├── SecondViewController.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── AFNetWorking2.X源码阅读Tests │ ├── AFNetWorking2_X____Tests.m │ └── Info.plist ├── AFNetWorking2.X源码阅读UITests │ ├── AFNetWorking2_X____UITests.m │ └── Info.plist └── AFNetworking2.x │ ├── AFNetworking │ ├── AFHTTPRequestOperation.h │ ├── AFHTTPRequestOperation.m │ ├── AFHTTPRequestOperationManager.h │ ├── AFHTTPRequestOperationManager.m │ ├── AFHTTPSessionManager.h │ ├── AFHTTPSessionManager.m │ ├── AFNetworkReachabilityManager.h │ ├── AFNetworkReachabilityManager.m │ ├── AFNetworking.h │ ├── AFSecurityPolicy.h │ ├── AFSecurityPolicy.m │ ├── AFURLConnectionOperation.h │ ├── AFURLConnectionOperation.m │ ├── AFURLRequestSerialization.h │ ├── AFURLRequestSerialization.m │ ├── AFURLResponseSerialization.h │ ├── AFURLResponseSerialization.m │ ├── AFURLSessionManager.h │ └── AFURLSessionManager.m │ └── UIKit+AFNetworking │ ├── AFNetworkActivityIndicatorManager.h │ ├── AFNetworkActivityIndicatorManager.m │ ├── UIActivityIndicatorView+AFNetworking.h │ ├── UIActivityIndicatorView+AFNetworking.m │ ├── UIAlertView+AFNetworking.h │ ├── UIAlertView+AFNetworking.m │ ├── UIButton+AFNetworking.h │ ├── UIButton+AFNetworking.m │ ├── UIImageView+AFNetworking.h │ ├── UIImageView+AFNetworking.m │ ├── UIKit+AFNetworking.h │ ├── UIProgressView+AFNetworking.h │ ├── UIProgressView+AFNetworking.m │ ├── UIRefreshControl+AFNetworking.h │ ├── UIRefreshControl+AFNetworking.m │ ├── UIWebView+AFNetworking.h │ └── UIWebView+AFNetworking.m ├── AFNetWorking3.X源码阅读201704 ├── AFNetWorking3.X源码阅读.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── AFNetWorking3.X源码阅读.xcscheme │ │ └── xcschememanagement.plist ├── AFNetWorking3.X源码阅读 │ ├── 1.png │ ├── 12306.cer │ ├── AFHTTPSessionManagerViewController.h │ ├── AFHTTPSessionManagerViewController.m │ ├── AFNetworking │ │ ├── AFHTTPSessionManager.h │ │ ├── AFHTTPSessionManager.m │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFNetworkReachabilityManager.m │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFSecurityPolicy.m │ │ ├── AFURLRequestSerialization.h │ │ ├── AFURLRequestSerialization.m │ │ ├── AFURLResponseSerialization.h │ │ ├── AFURLResponseSerialization.m │ │ ├── AFURLSessionManager.h │ │ └── AFURLSessionManager.m │ ├── AFSecurityPolicyViewController.h │ ├── AFSecurityPolicyViewController.m │ ├── AFURLRequestSerializationViewController.h │ ├── AFURLRequestSerializationViewController.m │ ├── AFURLResponseSerializationViewController.h │ ├── AFURLResponseSerializationViewController.m │ ├── AFURLSessionManagerViewController.h │ ├── AFURLSessionManagerViewController.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── NSURLSessionViewController.h │ ├── NSURLSessionViewController.m │ ├── UIKit+AFNetworking │ │ ├── AFAutoPurgingImageCache.h │ │ ├── AFAutoPurgingImageCache.m │ │ ├── AFImageDownloader.h │ │ ├── AFImageDownloader.m │ │ ├── AFNetworkActivityIndicatorManager.h │ │ ├── AFNetworkActivityIndicatorManager.m │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ ├── UIButton+AFNetworking.h │ │ ├── UIButton+AFNetworking.m │ │ ├── UIImage+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.m │ │ ├── UIKit+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.m │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.m │ │ ├── UIWebView+AFNetworking.h │ │ └── UIWebView+AFNetworking.m │ ├── baidu.cer │ ├── main.m │ └── test.txt ├── AFNetWorking3.X源码阅读Tests │ ├── AFNetWorking3_X____Tests.m │ └── Info.plist └── AFNetWorking3.X源码阅读UITests │ ├── AFNetWorking3_X____UITests.m │ └── Info.plist ├── LICENSE ├── README.md ├── SDWebImage3.X源码阅读201603 ├── SDWebImageStudy.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ ├── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── yifan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── SDWebImageStudy.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── yifan.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── SDWebImageStudy.xcscheme │ │ └── xcschememanagement.plist ├── SDWebImageStudy │ ├── 123.gif │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── SDWebImage │ │ ├── MKAnnotationView+WebCache.h │ │ ├── MKAnnotationView+WebCache.m │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDecoder.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageManager.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImage+WebP.h │ │ ├── UIImage+WebP.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── SDWebImageStudyTests │ ├── Info.plist │ └── SDWebImageStudyTests.m ├── SDWebImage4.X源码阅读201704 ├── SDWebImage4.X源码阅读201704.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── SDWebImage4.X源码阅读201704.xcscheme │ │ └── xcschememanagement.plist └── SDWebImage4.X源码阅读201704 │ ├── 2.png │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Config.h │ ├── FLAnimatedImage │ ├── FLAnimatedImage.h │ ├── FLAnimatedImage.m │ ├── FLAnimatedImageView.h │ ├── FLAnimatedImageView.m │ └── Info.plist │ ├── Info.plist │ ├── MainViewController.h │ ├── MainViewController.m │ ├── SDImageCacheViewController.h │ ├── SDImageCacheViewController.m │ ├── SDWebImage │ ├── FLAnimatedImage │ │ ├── FLAnimatedImageView+WebCache.h │ │ └── FLAnimatedImageView+WebCache.m │ ├── MKAnnotationView+WebCache.h │ ├── MKAnnotationView+WebCache.m │ ├── NSData+ImageContentType.h │ ├── NSData+ImageContentType.m │ ├── NSImage+WebCache.h │ ├── NSImage+WebCache.m │ ├── SDImageCache.h │ ├── SDImageCache.m │ ├── SDImageCacheConfig.h │ ├── SDImageCacheConfig.m │ ├── SDWebImageCompat.h │ ├── SDWebImageCompat.m │ ├── SDWebImageDecoder.h │ ├── SDWebImageDecoder.m │ ├── SDWebImageDownloader.h │ ├── SDWebImageDownloader.m │ ├── SDWebImageDownloaderOperation.h │ ├── SDWebImageDownloaderOperation.m │ ├── SDWebImageManager.h │ ├── SDWebImageManager.m │ ├── SDWebImageOperation.h │ ├── SDWebImagePrefetcher.h │ ├── SDWebImagePrefetcher.m │ ├── UIButton+WebCache.h │ ├── UIButton+WebCache.m │ ├── UIImage+GIF.h │ ├── UIImage+GIF.m │ ├── UIImage+MultiFormat.h │ ├── UIImage+MultiFormat.m │ ├── UIImage+WebP.h │ ├── UIImage+WebP.m │ ├── UIImageView+HighlightedWebCache.h │ ├── UIImageView+HighlightedWebCache.m │ ├── UIImageView+WebCache.h │ ├── UIImageView+WebCache.m │ ├── UIView+WebCache.h │ ├── UIView+WebCache.m │ ├── UIView+WebCacheOperation.h │ └── UIView+WebCacheOperation.m │ ├── SDWebImageClassDiagram.png │ ├── SDWebImageDownLoaderViewController.h │ ├── SDWebImageDownLoaderViewController.m │ ├── SDWebImageManagerViewController.h │ ├── SDWebImageManagerViewController.m │ ├── SDWebImageSequenceDiagram.png │ ├── SDWebImage学习笔记.txt │ ├── main.m │ └── test-gifs │ └── rock.gif ├── Vue2.2.6源码阅读201711 ├── vue │ ├── .babelrc │ ├── .eslintignore │ ├── .eslintrc │ ├── .flowconfig │ ├── .gitignore │ ├── BACKERS.md │ ├── LICENSE │ ├── README.md │ ├── benchmarks │ │ ├── big-table │ │ │ ├── demo.css │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── dbmon │ │ │ ├── ENV.js │ │ │ ├── app.js │ │ │ ├── index.html │ │ │ └── lib │ │ │ │ ├── memory-stats.js │ │ │ │ ├── monitor.js │ │ │ │ └── styles.css │ │ ├── reorder-list │ │ │ └── index.html │ │ ├── ssr │ │ │ ├── README.md │ │ │ ├── common.js │ │ │ ├── renderToStream.js │ │ │ └── renderToString.js │ │ ├── svg │ │ │ └── index.html │ │ └── uptime │ │ │ └── index.html │ ├── build │ │ ├── .eslintrc │ │ ├── alias.js │ │ ├── build.js │ │ ├── ci.sh │ │ ├── config.js │ │ ├── get-weex-version.js │ │ ├── git-hooks │ │ │ └── pre-commit │ │ ├── karma.base.config.js │ │ ├── karma.cover.config.js │ │ ├── karma.dev.config.js │ │ ├── karma.sauce.config.js │ │ ├── karma.unit.config.js │ │ ├── nightwatch.config.js │ │ ├── release-weex.sh │ │ └── release.sh │ ├── circle.yml │ ├── dist │ │ ├── .gitignore │ │ ├── README.md │ │ ├── vue.common.js │ │ ├── vue.esm.js │ │ ├── vue.js │ │ ├── vue.min.js │ │ ├── vue.runtime.common.js │ │ ├── vue.runtime.esm.js │ │ ├── vue.runtime.js │ │ └── vue.runtime.min.js │ ├── examples │ │ ├── commits │ │ │ ├── app.js │ │ │ └── index.html │ │ ├── elastic-header │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── firebase │ │ │ ├── app.js │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── grid │ │ │ ├── grid.js │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── markdown │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── modal │ │ │ ├── index.html │ │ │ └── style.css │ │ ├── move-animations │ │ │ └── index.html │ │ ├── select2 │ │ │ └── index.html │ │ ├── svg │ │ │ ├── index.html │ │ │ ├── style.css │ │ │ └── svg.js │ │ ├── todomvc │ │ │ ├── app.js │ │ │ ├── index.html │ │ │ └── readme.md │ │ └── tree │ │ │ ├── index.html │ │ │ └── tree.js │ ├── flow │ │ ├── compiler.js │ │ ├── component.js │ │ ├── global-api.js │ │ ├── modules.js │ │ ├── options.js │ │ ├── ssr.js │ │ └── vnode.js │ ├── package.json │ ├── packages │ │ ├── vue-server-renderer │ │ │ ├── README.md │ │ │ ├── build.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── vue-template-compiler │ │ │ ├── README.md │ │ │ ├── build.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── weex-template-compiler │ │ │ ├── README.md │ │ │ ├── build.js │ │ │ ├── index.js │ │ │ └── package.json │ │ └── weex-vue-framework │ │ │ ├── README.md │ │ │ ├── factory.js │ │ │ ├── index.js │ │ │ └── package.json │ ├── src │ │ ├── compiler │ │ │ ├── codegen │ │ │ │ ├── events.js │ │ │ │ └── index.js │ │ │ ├── directives │ │ │ │ ├── bind.js │ │ │ │ ├── index.js │ │ │ │ └── model.js │ │ │ ├── error-detector.js │ │ │ ├── helpers.js │ │ │ ├── index.js │ │ │ ├── optimizer.js │ │ │ └── parser │ │ │ │ ├── entity-decoder.js │ │ │ │ ├── filter-parser.js │ │ │ │ ├── html-parser.js │ │ │ │ ├── index.js │ │ │ │ └── text-parser.js │ │ ├── core │ │ │ ├── components │ │ │ │ ├── index.js │ │ │ │ └── keep-alive.js │ │ │ ├── config.js │ │ │ ├── global-api │ │ │ │ ├── assets.js │ │ │ │ ├── extend.js │ │ │ │ ├── index.js │ │ │ │ ├── mixin.js │ │ │ │ └── use.js │ │ │ ├── index.js │ │ │ ├── instance │ │ │ │ ├── events.js │ │ │ │ ├── index.js │ │ │ │ ├── init.js │ │ │ │ ├── inject.js │ │ │ │ ├── lifecycle.js │ │ │ │ ├── proxy.js │ │ │ │ ├── render-helpers │ │ │ │ │ ├── bind-object-props.js │ │ │ │ │ ├── check-keycodes.js │ │ │ │ │ ├── render-list.js │ │ │ │ │ ├── render-slot.js │ │ │ │ │ ├── render-static.js │ │ │ │ │ ├── resolve-filter.js │ │ │ │ │ └── resolve-slots.js │ │ │ │ ├── render.js │ │ │ │ └── state.js │ │ │ ├── observer │ │ │ │ ├── array.js │ │ │ │ ├── dep.js │ │ │ │ ├── index.js │ │ │ │ ├── scheduler.js │ │ │ │ └── watcher.js │ │ │ ├── util │ │ │ │ ├── debug.js │ │ │ │ ├── env.js │ │ │ │ ├── error.js │ │ │ │ ├── index.js │ │ │ │ ├── lang.js │ │ │ │ ├── options.js │ │ │ │ ├── perf.js │ │ │ │ └── props.js │ │ │ └── vdom │ │ │ │ ├── create-component.js │ │ │ │ ├── create-element.js │ │ │ │ ├── create-functional-component.js │ │ │ │ ├── helpers │ │ │ │ ├── extract-props.js │ │ │ │ ├── get-first-component-child.js │ │ │ │ ├── index.js │ │ │ │ ├── merge-hook.js │ │ │ │ ├── normalize-children.js │ │ │ │ ├── resolve-async-component.js │ │ │ │ └── update-listeners.js │ │ │ │ ├── modules │ │ │ │ ├── directives.js │ │ │ │ ├── index.js │ │ │ │ └── ref.js │ │ │ │ ├── patch.js │ │ │ │ └── vnode.js │ │ ├── entries │ │ │ ├── web-compiler.js │ │ │ ├── web-runtime-with-compiler.js │ │ │ ├── web-runtime.js │ │ │ ├── web-server-renderer.js │ │ │ ├── weex-compiler.js │ │ │ ├── weex-factory.js │ │ │ └── weex-framework.js │ │ ├── platforms │ │ │ ├── web │ │ │ │ ├── compiler │ │ │ │ │ ├── directives │ │ │ │ │ │ ├── html.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ ├── model.js │ │ │ │ │ │ └── text.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── class.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── style.js │ │ │ │ │ └── util.js │ │ │ │ ├── runtime │ │ │ │ │ ├── class-util.js │ │ │ │ │ ├── components │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ ├── transition-group.js │ │ │ │ │ │ └── transition.js │ │ │ │ │ ├── directives │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ ├── model.js │ │ │ │ │ │ └── show.js │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── attrs.js │ │ │ │ │ │ ├── class.js │ │ │ │ │ │ ├── dom-props.js │ │ │ │ │ │ ├── events.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ ├── style.js │ │ │ │ │ │ └── transition.js │ │ │ │ │ ├── node-ops.js │ │ │ │ │ ├── patch.js │ │ │ │ │ └── transition-util.js │ │ │ │ ├── server │ │ │ │ │ ├── directives │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── show.js │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── attrs.js │ │ │ │ │ │ ├── class.js │ │ │ │ │ │ ├── dom-props.js │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── style.js │ │ │ │ │ └── util.js │ │ │ │ └── util │ │ │ │ │ ├── attrs.js │ │ │ │ │ ├── class.js │ │ │ │ │ ├── compat.js │ │ │ │ │ ├── element.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── style.js │ │ │ └── weex │ │ │ │ ├── compiler │ │ │ │ ├── directives │ │ │ │ │ ├── index.js │ │ │ │ │ └── model.js │ │ │ │ ├── index.js │ │ │ │ └── modules │ │ │ │ │ ├── append.js │ │ │ │ │ ├── class.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── props.js │ │ │ │ │ └── style.js │ │ │ │ ├── framework.js │ │ │ │ ├── runtime │ │ │ │ ├── components │ │ │ │ │ ├── index.js │ │ │ │ │ ├── transition-group.js │ │ │ │ │ └── transition.js │ │ │ │ ├── directives │ │ │ │ │ └── index.js │ │ │ │ ├── index.js │ │ │ │ ├── modules │ │ │ │ │ ├── attrs.js │ │ │ │ │ ├── class.js │ │ │ │ │ ├── events.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── style.js │ │ │ │ │ └── transition.js │ │ │ │ ├── node-ops.js │ │ │ │ ├── patch.js │ │ │ │ └── text-node.js │ │ │ │ └── util │ │ │ │ └── index.js │ │ ├── server │ │ │ ├── bundle-renderer │ │ │ │ ├── create-bundle-renderer.js │ │ │ │ ├── create-bundle-runner.js │ │ │ │ └── source-map-support.js │ │ │ ├── create-renderer.js │ │ │ ├── render-context.js │ │ │ ├── render-stream.js │ │ │ ├── render.js │ │ │ ├── template-renderer │ │ │ │ ├── create-async-file-mapper.js │ │ │ │ ├── index.js │ │ │ │ ├── parse-template.js │ │ │ │ └── template-stream.js │ │ │ └── write.js │ │ ├── sfc │ │ │ └── parser.js │ │ └── shared │ │ │ ├── constants.js │ │ │ └── util.js │ ├── test │ │ ├── e2e │ │ │ ├── .eslintrc │ │ │ ├── runner.js │ │ │ └── specs │ │ │ │ ├── commits.js │ │ │ │ ├── grid.js │ │ │ │ ├── markdown.js │ │ │ │ ├── modal.js │ │ │ │ ├── select2.js │ │ │ │ ├── svg.js │ │ │ │ ├── todomvc.js │ │ │ │ └── tree.js │ │ ├── helpers │ │ │ ├── .eslintrc │ │ │ ├── classlist.js │ │ │ ├── to-equal.js │ │ │ ├── to-have-been-warned.js │ │ │ ├── trigger-event.js │ │ │ ├── vdom.js │ │ │ └── wait-for-update.js │ │ ├── ssr │ │ │ ├── .eslintrc │ │ │ ├── compile-with-webpack.js │ │ │ ├── fixtures │ │ │ │ ├── app.js │ │ │ │ ├── async-bar.js │ │ │ │ ├── async-foo.js │ │ │ │ ├── cache.js │ │ │ │ ├── error.js │ │ │ │ ├── split.js │ │ │ │ ├── test.png │ │ │ │ └── test.woff2 │ │ │ ├── jasmine.json │ │ │ ├── ssr-bundle-render.spec.js │ │ │ ├── ssr-stream.spec.js │ │ │ ├── ssr-string.spec.js │ │ │ └── ssr-template.spec.js │ │ ├── unit │ │ │ ├── .eslintrc │ │ │ ├── features │ │ │ │ ├── component │ │ │ │ │ ├── component-async.spec.js │ │ │ │ │ ├── component-keep-alive.spec.js │ │ │ │ │ ├── component-scoped-slot.spec.js │ │ │ │ │ ├── component-slot.spec.js │ │ │ │ │ └── component.spec.js │ │ │ │ ├── directives │ │ │ │ │ ├── bind.spec.js │ │ │ │ │ ├── class.spec.js │ │ │ │ │ ├── cloak.spec.js │ │ │ │ │ ├── for.spec.js │ │ │ │ │ ├── html.spec.js │ │ │ │ │ ├── if.spec.js │ │ │ │ │ ├── model-checkbox.spec.js │ │ │ │ │ ├── model-component.spec.js │ │ │ │ │ ├── model-dynamic.spec.js │ │ │ │ │ ├── model-file.spec.js │ │ │ │ │ ├── model-parse.spec.js │ │ │ │ │ ├── model-radio.spec.js │ │ │ │ │ ├── model-select.spec.js │ │ │ │ │ ├── model-text.spec.js │ │ │ │ │ ├── on.spec.js │ │ │ │ │ ├── once.spec.js │ │ │ │ │ ├── pre.spec.js │ │ │ │ │ ├── show.spec.js │ │ │ │ │ ├── static-style-parser.spec.js │ │ │ │ │ ├── style.spec.js │ │ │ │ │ └── text.spec.js │ │ │ │ ├── error-handling.spec.js │ │ │ │ ├── filter │ │ │ │ │ └── filter.spec.js │ │ │ │ ├── global-api │ │ │ │ │ ├── assets.spec.js │ │ │ │ │ ├── compile.spec.js │ │ │ │ │ ├── config.spec.js │ │ │ │ │ ├── extend.spec.js │ │ │ │ │ ├── mixin.spec.js │ │ │ │ │ ├── set-delete.spec.js │ │ │ │ │ └── use.spec.js │ │ │ │ ├── instance │ │ │ │ │ ├── init.spec.js │ │ │ │ │ ├── methods-data.spec.js │ │ │ │ │ ├── methods-events.spec.js │ │ │ │ │ ├── methods-lifecycle.spec.js │ │ │ │ │ ├── properties.spec.js │ │ │ │ │ └── render-proxy.spec.js │ │ │ │ ├── options │ │ │ │ │ ├── _scopeId.spec.js │ │ │ │ │ ├── components.spec.js │ │ │ │ │ ├── computed.spec.js │ │ │ │ │ ├── data.spec.js │ │ │ │ │ ├── delimiters.spec.js │ │ │ │ │ ├── directives.spec.js │ │ │ │ │ ├── el.spec.js │ │ │ │ │ ├── extends.spec.js │ │ │ │ │ ├── functional.spec.js │ │ │ │ │ ├── inject.spec.js │ │ │ │ │ ├── lifecycle.spec.js │ │ │ │ │ ├── methods.spec.js │ │ │ │ │ ├── mixins.spec.js │ │ │ │ │ ├── name.spec.js │ │ │ │ │ ├── parent.spec.js │ │ │ │ │ ├── props.spec.js │ │ │ │ │ ├── propsData.spec.js │ │ │ │ │ ├── render.spec.js │ │ │ │ │ ├── renderError.spec.js │ │ │ │ │ ├── template.spec.js │ │ │ │ │ └── watch.spec.js │ │ │ │ ├── ref.spec.js │ │ │ │ └── transition │ │ │ │ │ ├── inject-styles.js │ │ │ │ │ ├── transition-group.spec.js │ │ │ │ │ ├── transition-mode.spec.js │ │ │ │ │ └── transition.spec.js │ │ │ ├── index.js │ │ │ └── modules │ │ │ │ ├── compiler │ │ │ │ ├── codegen.spec.js │ │ │ │ ├── compiler-options.spec.js │ │ │ │ ├── optimizer.spec.js │ │ │ │ └── parser.spec.js │ │ │ │ ├── observer │ │ │ │ ├── observer.spec.js │ │ │ │ ├── scheduler.spec.js │ │ │ │ └── watcher.spec.js │ │ │ │ ├── sfc │ │ │ │ └── sfc-parser.spec.js │ │ │ │ ├── util │ │ │ │ └── next-tick.spec.js │ │ │ │ └── vdom │ │ │ │ ├── create-component.spec.js │ │ │ │ ├── create-element.spec.js │ │ │ │ ├── modules │ │ │ │ ├── attrs.spec.js │ │ │ │ ├── class.spec.js │ │ │ │ ├── directive.spec.js │ │ │ │ ├── dom-props.spec.js │ │ │ │ ├── events.spec.js │ │ │ │ └── style.spec.js │ │ │ │ └── patch │ │ │ │ ├── children.spec.js │ │ │ │ ├── edge-cases.spec.js │ │ │ │ ├── element.spec.js │ │ │ │ ├── hooks.spec.js │ │ │ │ └── hydration.spec.js │ │ └── weex │ │ │ ├── .eslintrc │ │ │ ├── compiler │ │ │ ├── append.spec.js │ │ │ ├── class.spec.js │ │ │ ├── compile.spec.js │ │ │ ├── props.spec.js │ │ │ ├── style.spec.js │ │ │ └── v-model.spec.js │ │ │ ├── helpers │ │ │ └── index.js │ │ │ ├── jasmine.json │ │ │ └── runtime │ │ │ ├── attrs.spec.js │ │ │ ├── class.spec.js │ │ │ ├── events.spec.js │ │ │ ├── framework.spec.js │ │ │ ├── node.spec.js │ │ │ └── style.spec.js │ ├── types │ │ ├── index.d.ts │ │ ├── options.d.ts │ │ ├── plugin.d.ts │ │ ├── test │ │ │ ├── augmentation-test.ts │ │ │ ├── options-test.ts │ │ │ ├── plugin-test.ts │ │ │ ├── tsconfig.json │ │ │ └── vue-test.ts │ │ ├── typings.json │ │ ├── vnode.d.ts │ │ └── vue.d.ts │ └── yarn.lock └── vue2.2.6分析 │ ├── .gitattributes │ ├── .gitignore │ ├── AstElement.md │ ├── README.md │ ├── VNode.md │ ├── Vue-globals.md │ ├── Vue.extend.md │ ├── Vue实例属性.md │ ├── Vue源码目录结构整理.md │ ├── children的归一化处理.md │ ├── compile——优化静态内容.md │ ├── compile——生成ast.md │ ├── compile——生成render字符串.md │ ├── compile概述.md │ ├── directives概述.md │ ├── example │ ├── children.html │ ├── createComponent.html │ ├── data-observe.html │ ├── diff-without-key.html │ ├── directive.html │ ├── event.html │ ├── extend.html │ ├── functional.html │ ├── gen-render.html │ ├── inject-provide.html │ ├── js │ │ └── observer.js │ ├── keep-alive.html │ ├── observer-watcher.html │ ├── optimize-ast.html │ ├── parse-example.html │ ├── patch-1.html │ ├── slot.html │ ├── start.html │ ├── template-slot.html │ ├── test.html │ ├── transition.html │ ├── v-bind.html │ ├── v-cloak.html │ ├── v-for.html │ ├── v-html.html │ ├── v-if.html │ ├── v-model.html │ ├── v-once.html │ ├── v-pre.html │ ├── v-show.html │ ├── v-text.html │ ├── vnode-props.html │ └── vnode.html │ ├── keep-alive.md │ ├── patch——diff.md │ ├── patch——创建dom.md │ ├── patch——自定义组件的处理流程.md │ ├── slot和作用域插槽.md │ ├── transition.md │ ├── v-for.md │ ├── v-if.md │ ├── v-model.md │ ├── v-once.md │ ├── v-show.md │ ├── v-text、v-html、v-cloak、v-pre.md │ ├── vdom——VNode.md │ ├── vdom概述.md │ ├── 事件处理.md │ ├── 从一个小栗子查看Vue的生命周期.md │ ├── 从入口文件查看Vue源码.md │ ├── 双向数据绑定.md │ └── 自定义指令.md ├── WebViewJavascriptCore源码阅读201703 ├── WebViewJavascriptCore解析.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── WebViewJavascriptCore解析.xcscheme │ │ └── xcschememanagement.plist ├── WebViewJavascriptCore解析 │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── ExampleApp.html │ ├── ExampleWKWebViewController.h │ ├── ExampleWKWebViewController.m │ ├── Info.plist │ ├── WebViewJavascriptBridge │ │ ├── ExampleUIWebViewController.h │ │ ├── ExampleUIWebViewController.m │ │ ├── WKWebViewJavascriptBridge.h │ │ ├── WKWebViewJavascriptBridge.m │ │ ├── WebViewJavascriptBridge.h │ │ ├── WebViewJavascriptBridge.m │ │ ├── WebViewJavascriptBridgeBase.h │ │ ├── WebViewJavascriptBridgeBase.m │ │ ├── WebViewJavascriptBridge_JS.h │ │ ├── WebViewJavascriptBridge_JS.js │ │ └── WebViewJavascriptBridge_JS.m │ └── main.m ├── WebViewJavascriptCore解析Tests │ ├── Info.plist │ └── WebViewJavascriptCore__Tests.m └── WebViewJavascriptCore解析UITests │ ├── Info.plist │ └── WebViewJavascriptCore__UITests.m ├── YYModel1.0.4源码阅读201705 ├── YYModel1.0.4源码阅读201705.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── huangchengdu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── huangchengdu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── YYModel1.0.4源码阅读201705.xcscheme │ │ └── xcschememanagement.plist └── YYModel1.0.4源码阅读201705 │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Attributes.h │ ├── Attributes.m │ ├── Author.h │ ├── Author.m │ ├── BOOK1.h │ ├── BOOK1.m │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Book.h │ ├── Book.m │ ├── Info.plist │ ├── Model1.txt │ ├── Model2.txt │ ├── Model3.txt │ ├── Model4.txt │ ├── Model5.txt │ ├── Model6.txt │ ├── User.h │ ├── User.m │ ├── User1.h │ ├── User1.m │ ├── ViewController.h │ ├── ViewController.m │ ├── YYModel │ ├── NSObject+YYModel.h │ ├── NSObject+YYModel.m │ ├── YYClassInfo.h │ ├── YYClassInfo.m │ └── YYModel.h │ ├── YYShadow.h │ ├── YYShadow.m │ └── main.m └── picture └── picture.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Build and Release Folders 2 | bin/ 3 | bin-debug/ 4 | bin-release/ 5 | 6 | # Other files and folders 7 | .settings/ 8 | 9 | # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` 10 | # should NOT be excluded as they contain compiler settings and other important 11 | # information for Eclipse / Flash Builder. 12 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读.xcodeproj/xcuserdata/huangchengdu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFNetWorking2.X源码阅读.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4DCA5C041DC6D3D0004E14F3 16 | 17 | primary 18 | 19 | 20 | 4DCA5C1D1DC6D3D1004E14F3 21 | 22 | primary 23 | 24 | 25 | 4DCA5C281DC6D3D1004E14F3 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AFNetWorking2.X源码阅读 4 | // 5 | // Created by huangchengdu on 16/10/31. 6 | // Copyright © 2016年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // AFNetWorking2.X源码阅读 4 | // 5 | // Created by huangchengdu on 16/10/31. 6 | // Copyright © 2016年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AFNetWorking2.X源码阅读 4 | // 5 | // Created by huangchengdu on 16/10/31. 6 | // Copyright © 2016年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AFNetWorking2.X源码阅读 4 | // 5 | // Created by huangchengdu on 16/10/31. 6 | // Copyright © 2016年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读Tests/AFNetWorking2_X____Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetWorking2_X____Tests.m 3 | // AFNetWorking2.X源码阅读Tests 4 | // 5 | // Created by huangchengdu on 16/10/31. 6 | // Copyright © 2016年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFNetWorking2_X____Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AFNetWorking2_X____Tests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFNetWorking2.X源码阅读/AFNetWorking2.X源码阅读UITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读.xcodeproj/xcuserdata/huangchengdu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AFNetWorking3.X源码阅读.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4D65714E1E94D05E00EE7E8E 16 | 17 | primary 18 | 19 | 20 | 4D6571671E94D05E00EE7E8E 21 | 22 | primary 23 | 24 | 25 | 4D6571721E94D05E00EE7E8E 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/1.png -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/12306.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/12306.cer -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFHTTPSessionManagerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFSecurityPolicyViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/19. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFHTTPSessionManagerViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFSecurityPolicyViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFSecurityPolicyViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/25. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFSecurityPolicyViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFURLRequestSerializationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFURLRequestSerializationViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/22. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFURLRequestSerializationViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFURLResponseSerializationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFURLResponseSerializationViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/26. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFURLResponseSerializationViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFURLResponseSerializationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFURLResponseSerializationViewController.m 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/26. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import "AFURLResponseSerializationViewController.h" 10 | 11 | @interface AFURLResponseSerializationViewController () 12 | 13 | @end 14 | 15 | @implementation AFURLResponseSerializationViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | } 20 | 21 | - (IBAction)clickButton1:(id)sender { 22 | NSLog(@"呵呵"); 23 | } 24 | 25 | - (IBAction)clickButton2:(id)sender { 26 | 27 | } 28 | 29 | 30 | - (IBAction)clickButton3:(id)sender { 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AFURLSessionManagerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AFURLSessionManagerViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/15. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFURLSessionManagerViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/5. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/NSURLSessionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/5. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSURLSessionViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/baidu.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/baidu.cer -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AFNetWorking3.X源码阅读 4 | // 5 | // Created by huangchengdu on 17/4/5. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读/test.txt: -------------------------------------------------------------------------------- 1 | {"name":"huang","phone":"124"} 2 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读Tests/AFNetWorking3_X____Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AFNetWorking3_X____Tests.m 3 | // AFNetWorking3.X源码阅读Tests 4 | // 5 | // Created by huangchengdu on 17/4/5. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AFNetWorking3_X____Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AFNetWorking3_X____Tests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AFNetWorking3.X源码阅读201704/AFNetWorking3.X源码阅读UITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/project.xcworkspace/xcuserdata/yifan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/xcuserdata/huangchengdu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SDWebImageStudy.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4DF388C71BB74C9B0038D291 16 | 17 | primary 18 | 19 | 20 | 4DF388E01BB74C9B0038D291 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy.xcodeproj/xcuserdata/yifan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SDWebImageStudy.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4DF388C71BB74C9B0038D291 16 | 17 | primary 18 | 19 | 20 | 4DF388E01BB74C9B0038D291 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/123.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage3.X源码阅读201603/SDWebImageStudy/123.gif -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SDWebImageStudy 4 | // 5 | // Created by 黄成都 on 15/9/27. 6 | // Copyright (c) 2015年 黄成都. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSData (ImageContentType) 9 | 10 | /** 11 | * Compute the content type for an image data 12 | * 13 | * @param data the input data 14 | * 15 | * @return the content type as string (i.e. image/jpeg, image/gif) 16 | */ 17 | + (NSString *)sd_contentTypeForImageData:(NSData *)data; 18 | 19 | @end 20 | 21 | 22 | @interface NSData (ImageContentTypeDeprecated) 23 | 24 | + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ForceDecode) 15 | 16 | + (UIImage *)decodedImageWithImage:(UIImage *)image; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.h 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GIF) 12 | 13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name; 14 | 15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 16 | 17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (MultiFormat) 12 | 13 | + (UIImage *)sd_imageWithData:(NSData *)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/UIImage+WebP.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+WebP.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #ifdef SD_WEBP 10 | 11 | #import 12 | 13 | // Fix for issue #416 Undefined symbols for architecture armv7 since WebP introduction when deploying to device 14 | void WebPInitPremultiplyNEON(void); 15 | 16 | void WebPInitUpsamplersNEON(void); 17 | 18 | void VP8DspInitNEON(void); 19 | 20 | @interface UIImage (WebP) 21 | 22 | + (UIImage *)sd_imageWithWebPData:(NSData *)data; 23 | 24 | @end 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @interface UIView (WebCacheOperation) 13 | 14 | /** 15 | * Set the image load operation (storage in a UIView based dictionary) 16 | * 17 | * @param operation the operation 18 | * @param key key for storing the operation 19 | */ 20 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key; 21 | 22 | /** 23 | * Cancel all operations for the current UIView and key 24 | * 25 | * @param key key for identifying the operations 26 | */ 27 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key; 28 | 29 | /** 30 | * Just remove the operations corresponding to the current UIView and key without cancelling them 31 | * 32 | * @param key key for identifying the operations 33 | */ 34 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SDWebImageStudy 4 | // 5 | // Created by 黄成都 on 15/9/27. 6 | // Copyright (c) 2015年 黄成都. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudy/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SDWebImageStudy 4 | // 5 | // Created by 黄成都 on 15/9/27. 6 | // Copyright (c) 2015年 黄成都. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudyTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | ---.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SDWebImage3.X源码阅读201603/SDWebImageStudyTests/SDWebImageStudyTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageStudyTests.m 3 | // SDWebImageStudyTests 4 | // 5 | // Created by 黄成都 on 15/9/27. 6 | // Copyright (c) 2015年 黄成都. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SDWebImageStudyTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation SDWebImageStudyTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704.xcodeproj/project.xcworkspace/xcuserdata/huangchengdu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704.xcodeproj/xcuserdata/huangchengdu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SDWebImage4.X源码阅读201704.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4DE9D7B41EB0D9160038C4E8 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/2.png -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/26. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/Config.h: -------------------------------------------------------------------------------- 1 | // 2 | // Config.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/28. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #ifndef Config_h 10 | #define Config_h 11 | 12 | #define alert(msg) [[[UIAlertView alloc]initWithTitle:nil message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil] show]; 13 | 14 | #define showMessage(MESSAGE,QUVC) UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"弹出框" message:MESSAGE preferredStyle:UIAlertControllerStyleAlert];\ 15 | [alertController addAction:[UIAlertAction actionWithTitle:@"确定"style:UIAlertActionStyleDefault handler:nil]];\ 16 | [QUVC presentViewController:alertController animated:YES completion:nil]; 17 | 18 | #endif /* Config_h */ 19 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/FLAnimatedImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/27. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDImageCacheViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDImageCacheViewController.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/28. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SDImageCacheViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | 14 | /** 15 | 不同图片类型的枚举 16 | 17 | - SDImageFormatUndefined: 未知 18 | - SDImageFormatJPEG: JPG 19 | - SDImageFormatPNG: PNG 20 | - SDImageFormatGIF: GIF 21 | - SDImageFormatTIFF: TIFF 22 | - SDImageFormatWebP: WEBP 23 | */ 24 | typedef NS_ENUM(NSInteger, SDImageFormat) { 25 | SDImageFormatUndefined = -1, 26 | SDImageFormatJPEG = 0, 27 | SDImageFormatPNG, 28 | SDImageFormatGIF, 29 | SDImageFormatTIFF, 30 | SDImageFormatWebP 31 | }; 32 | #pragma mark 根据图片数据获取图片的类型 33 | 34 | /** 35 | 图片数据的第一个字节存储了图片的类型,我们取到第一个字节就可以获取图片类型 36 | */ 37 | @interface NSData (ImageContentType) 38 | 39 | /** 40 | * Return image format 41 | * 42 | * @param data the input image data 43 | * 44 | * @return the image format as `SDImageFormat` (enum) 45 | */ 46 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | return NO; 27 | } 28 | 29 | @end 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | 13 | /** 14 | 图片缓存策略记录。比如是否解压缩、是否允许iCloud、是否允许内存缓存、缓存时间等。 15 | */ 16 | @interface SDImageCacheConfig : NSObject 17 | 18 | /** 19 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 20 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 21 | */ 22 | @property (assign, nonatomic) BOOL shouldDecompressImages; 23 | 24 | /** 25 | * disable iCloud backup [defaults to YES] 26 | */ 27 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 28 | 29 | /** 30 | * use memory cache [defaults to YES] 31 | */ 32 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 33 | 34 | /** 35 | * The maximum length of time to keep an image in the cache, in seconds 36 | */ 37 | @property (assign, nonatomic) NSInteger maxCacheAge; 38 | 39 | /** 40 | * The maximum size of the cache, in bytes. 41 | */ 42 | @property (assign, nonatomic) NSUInteger maxCacheSize; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _maxCacheAge = kDefaultCacheMaxCacheAge; 21 | _maxCacheSize = 0; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) james 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | /** 14 | 把UIImage对象解压缩。 15 | */ 16 | @interface UIImage (ForceDecode) 17 | 18 | /** 19 | 解压缩图片 20 | 21 | @param image 原始图片 22 | @return 解压缩以后的图片 23 | */ 24 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 25 | 26 | /** 27 | 先把图片缩小然后再解压缩图片 28 | 29 | @param image 原始图片 30 | @return 解压缩以后的图片 31 | */ 32 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Compatibility method - creates an animated UIImage from an NSData, it will only contain the 1st frame image 16 | */ 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 18 | 19 | /** 20 | * Checks if an UIImage instance is a GIF. Will use the `images` array 21 | */ 22 | - (BOOL)isGIF; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | /** 14 | 根据image的data数据。生成对应的image对象 15 | 16 | @param data 图片的数据 17 | @return image对象 18 | */ 19 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 20 | - (nullable NSData *)sd_imageData; 21 | 22 | /** 23 | 根据指定的图片类型,把image对象转换为对应格式的data 24 | 25 | @param imageFormat 指定的image格式 26 | @return 返回data对象 27 | */ 28 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/UIImage+WebP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #ifdef SD_WEBP 10 | 11 | #import "SDWebImageCompat.h" 12 | 13 | @interface UIImage (WebP) 14 | 15 | + (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data; 16 | 17 | @end 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | @interface UIView (WebCacheOperation) 16 | 17 | /** 18 | * Set the image load operation (storage in a UIView based dictionary) 19 | * 20 | * @param operation the operation 21 | * @param key key for storing the operation 22 | */ 23 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 24 | 25 | /** 26 | * Cancel all operations for the current UIView and key 27 | * 28 | * @param key key for identifying the operations 29 | */ 30 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 31 | 32 | /** 33 | * Just remove the operations corresponding to the current UIView and key without cancelling them 34 | * 35 | * @param key key for identifying the operations 36 | */ 37 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageClassDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageClassDiagram.png -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageDownLoaderViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageDownLoaderViewController.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/5/2. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SDWebImageDownLoaderViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageManagerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageManagerViewController.h 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/29. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SDWebImageManagerViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageSequenceDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/SDWebImageSequenceDiagram.png -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SDWebImage4.X源码阅读201704 4 | // 5 | // Created by huangchengdu on 17/4/26. 6 | // Copyright © 2017年 huangchengdu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/test-gifs/rock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/SDWebImage4.X源码阅读201704/SDWebImage4.X源码阅读201704/test-gifs/rock.gif -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "flow-vue"], 3 | "plugins": ["transform-vue-jsx", "syntax-dynamic-import"], 4 | "ignore": [ 5 | "dist/*.js", 6 | "packages/**/*.js" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/.eslintignore: -------------------------------------------------------------------------------- 1 | flow 2 | dist 3 | packages 4 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "babel-eslint", 4 | "extends": "vue", 5 | "plugins": ["flowtype"], 6 | "globals": { 7 | "__WEEX__": true 8 | }, 9 | "rules": { 10 | "no-useless-escape": 0, 11 | "flowtype/define-flow-type": 1, 12 | "flowtype/use-flow-type": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/.* 3 | .*/test/.* 4 | .*/build/.* 5 | .*/examples/.* 6 | .*/benchmarks/.* 7 | 8 | [include] 9 | 10 | [libs] 11 | flow 12 | 13 | [options] 14 | unsafe.enable_getters_and_setters=true 15 | module.name_mapper='^compiler/\(.*\)$' -> '/src/compiler/\1' 16 | module.name_mapper='^core/\(.*\)$' -> '/src/core/\1' 17 | module.name_mapper='^shared/\(.*\)$' -> '/src/shared/\1' 18 | module.name_mapper='^web/\(.*\)$' -> '/src/platforms/web/\1' 19 | module.name_mapper='^weex/\(.*\)$' -> '/src/platforms/weex/\1' 20 | module.name_mapper='^server/\(.*\)$' -> '/src/server/\1' 21 | module.name_mapper='^entries/\(.*\)$' -> '/src/entries/\1' 22 | module.name_mapper='^sfc/\(.*\)$' -> '/src/sfc/\1' 23 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | *.log 4 | explorations 5 | TODOs.md 6 | dist/*.gz 7 | dist/*.map 8 | dist/vue.common.min.js 9 | test/e2e/reports 10 | test/e2e/screenshots 11 | coverage 12 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-present, Yuxi (Evan) You 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/big-table/demo.css: -------------------------------------------------------------------------------- 1 | form { 2 | margin-bottom: 15px; 3 | } 4 | 5 | td.hidden { 6 | color: #ccc; 7 | } 8 | 9 | table.filtered td.item { 10 | background-color: #FFFFBF; 11 | } 12 | 13 | table.filtered td.item.hidden { 14 | background-color: transparent; 15 | } 16 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/dbmon/app.js: -------------------------------------------------------------------------------- 1 | var app = new Vue({ 2 | el: '#app', 3 | data: { 4 | databases: [] 5 | } 6 | }) 7 | 8 | function loadSamples() { 9 | app.databases = Object.freeze(ENV.generateData().toArray()); 10 | Monitoring.renderRate.ping(); 11 | setTimeout(loadSamples, ENV.timeout); 12 | } 13 | 14 | loadSamples() 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/dbmon/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | dbmon (Vue) 7 | 8 | 9 |

10 | Reference: js-repaint-perfs 11 |

12 |
13 | 14 | 15 | 16 | 17 | 20 | 27 | 28 | 29 |
{{db.dbname}} 18 | {{db.lastSample.nbQueries}} 19 | 21 | {{q.formatElapsed}} 22 |
23 |
{{q.query}}
24 |
25 |
26 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/ssr/README.md: -------------------------------------------------------------------------------- 1 | # Vue.js SSR benchmark 2 | 3 | This benchmark renders a table of 1000 rows with 10 columns (10k components), with around 30k normal elements on the page. Note this is not something likely to be seen in a typical app. This benchmark is mostly for stress/regression testing and comparing between `renderToString` and `renderToStream`. 4 | 5 | To view the results follow the run section. Note that the overall completion time for the results are variable, this is due to other system related variants at run time (available memory, processing ect). In ideal circumstances both should finish within similar results. 6 | 7 | `renderToStream` pipes the content through a stream which provides considerable performance benefits (faster time-to-first-byte and non-event-loop-blocking) over renderToString. This can be observed through the benchmark. 8 | 9 | ### run 10 | 11 | ``` bash 12 | npm run bench:ssr 13 | ``` 14 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/ssr/renderToStream.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | 3 | 'use strict' 4 | 5 | process.env.NODE_ENV = 'production' 6 | 7 | const Vue = require('../../dist/vue.runtime.common.js') 8 | const createRenderer = require('../../packages/vue-server-renderer').createRenderer 9 | const renderToStream = createRenderer().renderToStream 10 | const gridComponent = require('./common.js') 11 | 12 | console.log('--- renderToStream --- ') 13 | const self = (global || root) 14 | const s = self.performance.now() 15 | 16 | const stream = renderToStream(new Vue(gridComponent)) 17 | let str = '' 18 | let first 19 | let complete 20 | stream.once('data', () => { 21 | first = self.performance.now() - s 22 | }) 23 | stream.on('data', chunk => { 24 | str += chunk 25 | }) 26 | stream.on('end', () => { 27 | complete = self.performance.now() - s 28 | console.log(`first chunk: ${first.toFixed(2)}ms`) 29 | console.log(`complete: ${complete.toFixed(2)}ms`) 30 | console.log() 31 | }) 32 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/benchmarks/ssr/renderToString.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | const Vue = require('../../dist/vue.runtime.common.js') 6 | const createRenderer = require('../../packages/vue-server-renderer').createRenderer 7 | const renderToString = createRenderer().renderToString 8 | const gridComponent = require('./common.js') 9 | 10 | console.log('--- renderToString --- ') 11 | const self = (global || root) 12 | self.s = self.performance.now() 13 | 14 | renderToString(new Vue(gridComponent), () => { 15 | console.log('Complete time: ' + (self.performance.now() - self.s).toFixed(2) + 'ms') 16 | console.log() 17 | }) 18 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "camelcase": 0 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/alias.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | vue: path.resolve(__dirname, '../src/entries/web-runtime-with-compiler'), 5 | compiler: path.resolve(__dirname, '../src/compiler'), 6 | core: path.resolve(__dirname, '../src/core'), 7 | shared: path.resolve(__dirname, '../src/shared'), 8 | web: path.resolve(__dirname, '../src/platforms/web'), 9 | weex: path.resolve(__dirname, '../src/platforms/weex'), 10 | server: path.resolve(__dirname, '../src/server'), 11 | entries: path.resolve(__dirname, '../src/entries'), 12 | sfc: path.resolve(__dirname, '../src/sfc') 13 | } 14 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/ci.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | npm test 3 | 4 | # report coverage stats for non-PRs 5 | if [[ -z $CI_PULL_REQUEST ]]; then 6 | cat ./coverage/lcov.info | ./node_modules/.bin/codecov 7 | fi 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/get-weex-version.js: -------------------------------------------------------------------------------- 1 | var coreVersion = require('../package.json').version 2 | var weexVersion = require('../packages/weex-vue-framework/package.json').version 3 | var weexBaseVersion = weexVersion.match(/^[\d.]+/)[0] 4 | var weexSubVersion = Number(weexVersion.match(/-weex\.(\d+)$/)[1]) 5 | 6 | if (weexBaseVersion === coreVersion) { 7 | // same core version, increment sub version 8 | weexSubVersion++ 9 | } else { 10 | // new core version, reset sub version 11 | weexBaseVersion = coreVersion 12 | weexSubVersion = 1 13 | } 14 | 15 | if (process.argv[2] === '-c') { 16 | console.log(weexVersion) 17 | } else { 18 | console.log(weexBaseVersion + '-weex.' + weexSubVersion) 19 | } 20 | 21 | module.exports = { 22 | base: weexBaseVersion, 23 | sub: weexSubVersion 24 | } 25 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/git-hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | files_to_lint=$(git diff --cached --name-only --diff-filter=ACM | grep '\.js$') 4 | 5 | if [ -n "$files_to_lint" ]; then 6 | NODE_ENV=production eslint --quiet $files_to_lint 7 | fi 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/karma.base.config.js: -------------------------------------------------------------------------------- 1 | var alias = require('./alias') 2 | var webpack = require('webpack') 3 | 4 | var webpackConfig = { 5 | resolve: { 6 | alias: alias 7 | }, 8 | module: { 9 | rules: [ 10 | { 11 | test: /\.js$/, 12 | loader: 'babel-loader', 13 | exclude: /node_modules/ 14 | } 15 | ] 16 | }, 17 | plugins: [ 18 | new webpack.DefinePlugin({ 19 | __WEEX__: false, 20 | 'process.env': { 21 | NODE_ENV: '"development"', 22 | TRANSITION_DURATION: 50, 23 | TRANSITION_BUFFER: 10 24 | } 25 | }) 26 | ], 27 | devtool: '#inline-source-map' 28 | } 29 | 30 | // shared config for all unit tests 31 | module.exports = { 32 | frameworks: ['jasmine'], 33 | files: [ 34 | '../test/unit/index.js' 35 | ], 36 | preprocessors: { 37 | '../test/unit/index.js': ['webpack', 'sourcemap'] 38 | }, 39 | webpack: webpackConfig, 40 | webpackMiddleware: { 41 | noInfo: true 42 | }, 43 | plugins: [ 44 | 'karma-jasmine', 45 | 'karma-mocha-reporter', 46 | 'karma-sourcemap-loader', 47 | 'karma-webpack' 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/karma.cover.config.js: -------------------------------------------------------------------------------- 1 | var base = require('./karma.base.config.js') 2 | 3 | module.exports = function (config) { 4 | var options = Object.assign(base, { 5 | browsers: ['PhantomJS'], 6 | reporters: ['mocha', 'coverage'], 7 | coverageReporter: { 8 | reporters: [ 9 | { type: 'lcov', dir: '../coverage', subdir: '.' }, 10 | { type: 'text-summary', dir: '../coverage', subdir: '.' } 11 | ] 12 | }, 13 | singleRun: true, 14 | plugins: base.plugins.concat([ 15 | 'karma-coverage', 16 | 'karma-phantomjs-launcher' 17 | ]) 18 | }) 19 | 20 | // add babel-plugin-istanbul for code intrumentation 21 | options.webpack.module.rules[0].options = { 22 | plugins: [['istanbul', { 23 | exclude: [ 24 | 'test/', 25 | 'src/compiler/parser/html-parser.js', 26 | 'src/core/instance/proxy.js', 27 | 'src/sfc/deindent.js' 28 | ] 29 | }]] 30 | } 31 | 32 | config.set(options) 33 | } 34 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/karma.dev.config.js: -------------------------------------------------------------------------------- 1 | var base = require('./karma.base.config.js') 2 | 3 | module.exports = function (config) { 4 | config.set(Object.assign(base, { 5 | browsers: ['Chrome'], 6 | reporters: ['progress'], 7 | plugins: base.plugins.concat([ 8 | 'karma-chrome-launcher' 9 | ]) 10 | })) 11 | } 12 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/karma.unit.config.js: -------------------------------------------------------------------------------- 1 | var base = require('./karma.base.config.js') 2 | 3 | module.exports = function (config) { 4 | config.set(Object.assign(base, { 5 | browsers: ['Chrome', 'Firefox', 'Safari'], 6 | reporters: ['progress'], 7 | singleRun: true, 8 | plugins: base.plugins.concat([ 9 | 'karma-chrome-launcher', 10 | 'karma-firefox-launcher', 11 | 'karma-safari-launcher' 12 | ]) 13 | })) 14 | } 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/release-weex.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | CUR_VERSION=`node build/get-weex-version.js -c` 3 | NEXT_VERSION=`node build/get-weex-version.js` 4 | 5 | echo "Current: $CUR_VERSION" 6 | read -p "Enter new version ($NEXT_VERSION): " -n 1 -r 7 | if ! [[ -z $REPLY ]]; then 8 | NEXT_VERSION=$REPLY 9 | fi 10 | 11 | read -p "Releasing weex-vue-framework@$NEXT_VERSION - are you sure? (y/n) " -n 1 -r 12 | echo 13 | if [[ $REPLY =~ ^[Yy]$ ]]; then 14 | echo "Releasing weex-vue-framework@$NEXT_VERSION ..." 15 | npm run lint 16 | npm run flow 17 | npm run test:weex 18 | 19 | # build 20 | WEEX_VERSION=$NEXT_VERSION npm run build:weex 21 | 22 | # update package 23 | cd packages/weex-vue-framework 24 | npm version $NEXT_VERSION 25 | npm publish 26 | cd - 27 | 28 | cd packages/weex-template-compiler 29 | npm version $NEXT_VERSION 30 | npm publish 31 | cd - 32 | 33 | # commit 34 | git add src/entries/weex* 35 | git add packages/weex* 36 | git commit -m "[release] weex-vue-framework@$NEXT_VERSION" 37 | fi 38 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/build/release.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | if [[ -z $1 ]]; then 4 | echo "Enter new version: " 5 | read VERSION 6 | else 7 | VERSION=$1 8 | fi 9 | 10 | read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r 11 | echo 12 | if [[ $REPLY =~ ^[Yy]$ ]]; then 13 | echo "Releasing $VERSION ..." 14 | 15 | npm run lint 16 | npm run flow 17 | npm run test:cover 18 | npm run test:e2e 19 | npm run test:ssr 20 | 21 | if [[ -z $SKIP_SAUCE ]]; then 22 | export SAUCE_BUILD_ID=$VERSION:`date +"%s"` 23 | npm run test:sauce 24 | fi 25 | 26 | # build 27 | VERSION=$VERSION npm run build 28 | 29 | # update packages 30 | cd packages/vue-template-compiler 31 | npm version $VERSION 32 | if [[ -z $RELEASE_TAG ]]; then 33 | npm publish 34 | else 35 | npm publish --tag $RELEASE_TAG 36 | fi 37 | cd - 38 | 39 | cd packages/vue-server-renderer 40 | npm version $VERSION 41 | if [[ -z $RELEASE_TAG ]]; then 42 | npm publish 43 | else 44 | npm publish --tag $RELEASE_TAG 45 | fi 46 | cd - 47 | 48 | # commit 49 | git add -A 50 | git commit -m "[build] $VERSION" 51 | npm version $VERSION --message "[release] $VERSION" 52 | 53 | # publish 54 | git push origin refs/tags/v$VERSION 55 | git push 56 | if [[ -z $RELEASE_TAG ]]; then 57 | npm publish 58 | else 59 | npm publish --tag $RELEASE_TAG 60 | fi 61 | fi 62 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | node: 3 | version: 6 4 | 5 | test: 6 | override: 7 | - bash build/ci.sh 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/dist/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.js 3 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/commits/app.js: -------------------------------------------------------------------------------- 1 | var apiURL = 'https://api.github.com/repos/vuejs/vue/commits?per_page=3&sha=' 2 | 3 | /** 4 | * Actual demo 5 | */ 6 | 7 | var demo = new Vue({ 8 | 9 | el: '#demo', 10 | 11 | data: { 12 | branches: ['master', 'dev'], 13 | currentBranch: 'master', 14 | commits: null 15 | }, 16 | 17 | created: function () { 18 | this.fetchData() 19 | }, 20 | 21 | watch: { 22 | currentBranch: 'fetchData' 23 | }, 24 | 25 | filters: { 26 | truncate: function (v) { 27 | var newline = v.indexOf('\n') 28 | return newline > 0 ? v.slice(0, newline) : v 29 | }, 30 | formatDate: function (v) { 31 | return v.replace(/T|Z/g, ' ') 32 | } 33 | }, 34 | 35 | methods: { 36 | fetchData: function () { 37 | var xhr = new XMLHttpRequest() 38 | var self = this 39 | xhr.open('GET', apiURL + self.currentBranch) 40 | xhr.onload = function () { 41 | self.commits = JSON.parse(xhr.responseText) 42 | console.log(self.commits[0].html_url) 43 | } 44 | xhr.send() 45 | } 46 | } 47 | }) 48 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/elastic-header/style.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-weight: 300; 3 | font-size: 1.8em; 4 | margin-top: 0; 5 | } 6 | a { 7 | color: #fff; 8 | } 9 | .draggable-header-view { 10 | background-color: #fff; 11 | box-shadow: 0 4px 16px rgba(0,0,0,.15); 12 | width: 320px; 13 | height: 560px; 14 | overflow: hidden; 15 | margin: 30px auto; 16 | position: relative; 17 | font-family: 'Roboto', Helvetica, Arial, sans-serif; 18 | color: #fff; 19 | font-size: 14px; 20 | font-weight: 300; 21 | -webkit-user-select: none; 22 | -moz-user-select: none; 23 | -ms-user-select: none; 24 | user-select: none; 25 | } 26 | .draggable-header-view .bg { 27 | position: absolute; 28 | top: 0; 29 | left: 0; 30 | z-index: 0; 31 | } 32 | .draggable-header-view .header, .draggable-header-view .content { 33 | position: relative; 34 | z-index: 1; 35 | padding: 30px; 36 | box-sizing: border-box; 37 | } 38 | .draggable-header-view .header { 39 | height: 160px; 40 | } 41 | .draggable-header-view .content { 42 | color: #333; 43 | line-height: 1.5em; 44 | } 45 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/firebase/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Vue.js firebase + validation example 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
    18 |
  • 19 | {{user.name}} - {{user.email}} 20 | 21 |
  • 22 |
23 |
24 | 25 | 26 | 27 |
28 |
    29 |
  • Name cannot be empty.
  • 30 |
  • Please provide a valid email address.
  • 31 |
32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/firebase/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica, Arial, sans-serif; 3 | } 4 | 5 | ul { 6 | padding: 0; 7 | } 8 | 9 | .user { 10 | height: 30px; 11 | line-height: 30px; 12 | padding: 10px; 13 | border-top: 1px solid #eee; 14 | overflow: hidden; 15 | transition: all .25s ease; 16 | } 17 | 18 | .user:last-child { 19 | border-bottom: 1px solid #eee; 20 | } 21 | 22 | .v-enter, .v-leave-to { 23 | height: 0; 24 | padding-top: 0; 25 | padding-bottom: 0; 26 | border-top-width: 0; 27 | border-bottom-width: 0; 28 | } 29 | 30 | .errors { 31 | color: #f00; 32 | } 33 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/grid/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica Neue, Arial, sans-serif; 3 | font-size: 14px; 4 | color: #444; 5 | } 6 | 7 | table { 8 | border: 2px solid #42b983; 9 | border-radius: 3px; 10 | background-color: #fff; 11 | } 12 | 13 | th { 14 | background-color: #42b983; 15 | color: rgba(255,255,255,0.66); 16 | cursor: pointer; 17 | -webkit-user-select: none; 18 | -moz-user-select: none; 19 | -ms-user-select: none; 20 | user-select: none; 21 | } 22 | 23 | td { 24 | background-color: #f9f9f9; 25 | } 26 | 27 | th, td { 28 | min-width: 120px; 29 | padding: 10px 20px; 30 | } 31 | 32 | th.active { 33 | color: #fff; 34 | } 35 | 36 | th.active .arrow { 37 | opacity: 1; 38 | } 39 | 40 | .arrow { 41 | display: inline-block; 42 | vertical-align: middle; 43 | width: 0; 44 | height: 0; 45 | margin-left: 5px; 46 | opacity: 0.66; 47 | } 48 | 49 | .arrow.asc { 50 | border-left: 4px solid transparent; 51 | border-right: 4px solid transparent; 52 | border-bottom: 4px solid #fff; 53 | } 54 | 55 | .arrow.dsc { 56 | border-left: 4px solid transparent; 57 | border-right: 4px solid transparent; 58 | border-top: 4px solid #fff; 59 | } 60 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/markdown/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Vue.js markdown editor example 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 |
18 | 19 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/markdown/style.css: -------------------------------------------------------------------------------- 1 | html, body, #editor { 2 | margin: 0; 3 | height: 100%; 4 | font-family: 'Helvetica Neue', Arial, sans-serif; 5 | color: #333; 6 | } 7 | 8 | textarea, #editor div { 9 | display: inline-block; 10 | width: 49%; 11 | height: 100%; 12 | vertical-align: top; 13 | -webkit-box-sizing: border-box; 14 | -moz-box-sizing: border-box; 15 | box-sizing: border-box; 16 | padding: 0 20px; 17 | } 18 | 19 | textarea { 20 | border: none; 21 | border-right: 1px solid #ccc; 22 | resize: none; 23 | outline: none; 24 | background-color: #f6f6f6; 25 | font-size: 14px; 26 | font-family: 'Monaco', courier, monospace; 27 | padding: 20px; 28 | } 29 | 30 | code { 31 | color: #f66; 32 | } -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/modal/style.css: -------------------------------------------------------------------------------- 1 | .modal-mask { 2 | position: fixed; 3 | z-index: 9998; 4 | top: 0; 5 | left: 0; 6 | width: 100%; 7 | height: 100%; 8 | background-color: rgba(0, 0, 0, .5); 9 | display: table; 10 | transition: opacity .3s ease; 11 | } 12 | 13 | .modal-wrapper { 14 | display: table-cell; 15 | vertical-align: middle; 16 | } 17 | 18 | .modal-container { 19 | width: 300px; 20 | margin: 0px auto; 21 | padding: 20px 30px; 22 | background-color: #fff; 23 | border-radius: 2px; 24 | box-shadow: 0 2px 8px rgba(0, 0, 0, .33); 25 | transition: all .3s ease; 26 | font-family: Helvetica, Arial, sans-serif; 27 | } 28 | 29 | .modal-header h3 { 30 | margin-top: 0; 31 | color: #42b983; 32 | } 33 | 34 | .modal-body { 35 | margin: 20px 0; 36 | } 37 | 38 | .modal-default-button { 39 | float: right; 40 | } 41 | 42 | /* 43 | * The following styles are auto-applied to elements with 44 | * transition="modal" when their visibility is toggled 45 | * by Vue.js. 46 | * 47 | * You can easily play with the modal transition by editing 48 | * these styles. 49 | */ 50 | 51 | .modal-enter { 52 | opacity: 0; 53 | } 54 | 55 | .modal-leave-to { 56 | opacity: 0; 57 | } 58 | 59 | .modal-enter .modal-container, 60 | .modal-leave-to .modal-container { 61 | -webkit-transform: scale(1.1); 62 | transform: scale(1.1); 63 | } 64 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/svg/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Helvetica Neue, Arial, sans-serif; 3 | } 4 | 5 | polygon { 6 | fill: #42b983; 7 | opacity: .75; 8 | } 9 | 10 | circle { 11 | fill: transparent; 12 | stroke: #999; 13 | } 14 | 15 | text { 16 | font-family: Helvetica Neue, Arial, sans-serif; 17 | font-size: 10px; 18 | fill: #666; 19 | } 20 | 21 | label { 22 | display: inline-block; 23 | margin-left: 10px; 24 | width: 20px; 25 | } 26 | 27 | #raw { 28 | position: absolute; 29 | top: 0; 30 | left: 300px; 31 | } -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/examples/todomvc/readme.md: -------------------------------------------------------------------------------- 1 | # Vue.js TodoMVC Example 2 | 3 | > Vue.js is a library for building interactive web interfaces. 4 | It provides data-driven, nestable view components with a simple and flexible API. 5 | 6 | > _[Vue.js - vuejs.org](https://vuejs.org)_ 7 | 8 | ## Learning Vue.js 9 | The [Vue.js website](https://vuejs.org/) is a great resource to get started. 10 | 11 | Here are some links you may find helpful: 12 | 13 | * [Official Guide](https://vuejs.org/guide/) 14 | * [API Reference](https://vuejs.org/api/) 15 | * [Examples](https://vuejs.org/examples/) 16 | 17 | Get help from other Vue.js users: 18 | 19 | * [Vue.js official forum](http://forum.vuejs.org) 20 | * [Vue.js on Twitter](https://twitter.com/vuejs) 21 | * [Vue.js on Gitter](https://gitter.im/vuejs/vue) 22 | 23 | _If you have other helpful links to share, or find any of the links above no longer work, please [let us know](https://github.com/tastejs/todomvc/issues)._ 24 | 25 | ## Credit 26 | 27 | This TodoMVC application was created by [Evan You](http://evanyou.me). 28 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/flow/global-api.js: -------------------------------------------------------------------------------- 1 | declare interface GlobalAPI { 2 | cid: number; 3 | options: Object; 4 | config: Config; 5 | util: Object; 6 | 7 | extend: (options: Object) => Function; 8 | set: (target: Object | Array, key: string | number, value: T) => T; 9 | delete: (target: Object| Array, key: string | number) => void; 10 | nextTick: (fn: Function, context?: Object) => void; 11 | use: (plugin: Function | Object) => void; 12 | mixin: (mixin: Object) => void; 13 | compile: (template: string) => { render: Function, staticRenderFns: Array }; 14 | 15 | directive: (id: string, def?: Function | Object) => Function | Object | void; 16 | component: (id: string, def?: Class | Object) => Class; 17 | filter: (id: string, def?: Function) => Function | void; 18 | 19 | // allow dynamic method registration 20 | [key: string]: any 21 | } 22 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/flow/modules.js: -------------------------------------------------------------------------------- 1 | declare module 'he' { 2 | declare function escape(html: string): string; 3 | declare function decode(html: string): string; 4 | } 5 | 6 | declare module 'source-map' { 7 | declare class SourceMapGenerator { 8 | setSourceContent(filename: string, content: string): void; 9 | addMapping(mapping: Object): void; 10 | toString(): string; 11 | } 12 | declare class SourceMapConsumer { 13 | originalPositionFor(position: { line: number; column: number; }): { 14 | source: ?string; 15 | line: ?number; 16 | column: ?number; 17 | }; 18 | } 19 | } 20 | 21 | declare module 'lru-cache' { 22 | declare var exports: { 23 | (): any 24 | } 25 | } 26 | 27 | declare module 'de-indent' { 28 | declare var exports: { 29 | (input: string): string 30 | } 31 | } 32 | 33 | declare module 'serialize-javascript' { 34 | declare var exports: { 35 | (input: string, options: { isJSON: boolean }): string 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/flow/ssr.js: -------------------------------------------------------------------------------- 1 | declare type ComponentWithCacheContext = { 2 | type: 'ComponentWithCache'; 3 | bufferIndex: number; 4 | buffer: Array; 5 | key: string; 6 | } 7 | 8 | declare type ElementContext = { 9 | type: 'Element'; 10 | children: Array; 11 | rendered: number; 12 | endTag: string; 13 | total: number; 14 | } 15 | 16 | declare type ComponentContext = { 17 | type: 'Component'; 18 | prevActive: Component; 19 | } 20 | 21 | declare type RenderState = ComponentContext | ComponentWithCacheContext | ElementContext 22 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/vue-server-renderer/index.js: -------------------------------------------------------------------------------- 1 | try { 2 | var vueVersion = require('vue').version 3 | } catch (e) {} 4 | 5 | var packageName = require('./package.json').name 6 | var packageVersion = require('./package.json').version 7 | if (vueVersion && vueVersion !== packageVersion) { 8 | throw new Error( 9 | '\n\nVue packages version mismatch:\n\n' + 10 | '- vue@' + vueVersion + '\n' + 11 | '- ' + packageName + '@' + packageVersion + '\n\n' + 12 | 'This may cause things to work incorrectly. Make sure to use the same version for both.\n' 13 | ) 14 | } 15 | 16 | module.exports = require('./build') 17 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/vue-server-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-server-renderer", 3 | "version": "2.2.6", 4 | "description": "server renderer for Vue 2.0", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vuejs/vue.git" 9 | }, 10 | "keywords": [ 11 | "vue", 12 | "server", 13 | "ssr" 14 | ], 15 | "author": "Evan You", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/vuejs/vue/issues" 19 | }, 20 | "dependencies": { 21 | "he": "^1.1.0", 22 | "de-indent": "^1.0.2", 23 | "resolve": "^1.2.0", 24 | "source-map": "0.5.6", 25 | "serialize-javascript": "^1.3.0" 26 | }, 27 | "homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer#readme" 28 | } 29 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/vue-template-compiler/index.js: -------------------------------------------------------------------------------- 1 | try { 2 | var vueVersion = require('vue').version 3 | } catch (e) {} 4 | 5 | var packageName = require('./package.json').name 6 | var packageVersion = require('./package.json').version 7 | if (vueVersion && vueVersion !== packageVersion) { 8 | throw new Error( 9 | '\n\nVue packages version mismatch:\n\n' + 10 | '- vue@' + vueVersion + '\n' + 11 | '- ' + packageName + '@' + packageVersion + '\n\n' + 12 | 'This may cause things to work incorrectly. Make sure to use the same version for both.\n' + 13 | 'If you are using vue-loader@>=10.0, simply update vue-template-compiler.\n' + 14 | 'If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump ' + packageName + ' to the latest.\n' 15 | ) 16 | } 17 | 18 | module.exports = require('./build') 19 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/vue-template-compiler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-template-compiler", 3 | "version": "2.2.6", 4 | "description": "template compiler for Vue 2.0", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vuejs/vue.git" 9 | }, 10 | "keywords": [ 11 | "vue", 12 | "compiler" 13 | ], 14 | "author": "Evan You", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/vuejs/vue/issues" 18 | }, 19 | "homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#readme", 20 | "dependencies": { 21 | "he": "^1.1.0", 22 | "de-indent": "^1.0.2" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/weex-template-compiler/README.md: -------------------------------------------------------------------------------- 1 | # weex-template-compiler 2 | 3 | > This package is auto-generated. For pull requests please see [src/entries/weex-compiler.js](https://github.com/vuejs/vue/blob/dev/src/entries/weex-compiler.js). 4 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/weex-template-compiler/index.js: -------------------------------------------------------------------------------- 1 | try { 2 | var vueVersion = require('weex-vue-framework').version 3 | } catch (e) {} 4 | 5 | var packageName = require('./package.json').name 6 | var packageVersion = require('./package.json').version 7 | if (vueVersion && vueVersion !== packageVersion) { 8 | throw new Error( 9 | '\n\nVue packages version mismatch:\n\n' + 10 | '- vue@' + vueVersion + '\n' + 11 | '- ' + packageName + '@' + packageVersion + '\n\n' + 12 | 'This may cause things to work incorrectly. Make sure to use the same version for both.\n' + 13 | 'If you are using weex-vue-loader, re-installing them should bump ' + packageName + ' to the latest.\n' 14 | ) 15 | } 16 | 17 | module.exports = require('./build') 18 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/weex-template-compiler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weex-template-compiler", 3 | "version": "2.1.9-weex.1", 4 | "description": "Weex template compiler for Vue 2.0", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vuejs/vue.git" 9 | }, 10 | "keywords": [ 11 | "vue", 12 | "compiler" 13 | ], 14 | "author": "Evan You", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/vuejs/vue/issues" 18 | }, 19 | "homepage": "https://github.com/vuejs/vue/tree/dev/packages/weex-template-compiler#readme", 20 | "dependencies": { 21 | "he": "^1.1.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/weex-vue-framework/README.md: -------------------------------------------------------------------------------- 1 | # weex-vue-framework 2 | 3 | > This package is auto-generated. For pull requests please see [src/entries/weex-framework.js](https://github.com/vuejs/vue/blob/dev/src/entries/weex-framework.js). 4 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/packages/weex-vue-framework/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weex-vue-framework", 3 | "version": "2.1.9-weex.1", 4 | "description": "Vue 2.0 Framework for Weex", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vuejs/vue.git" 9 | }, 10 | "keywords": [ 11 | "vue", 12 | "compiler" 13 | ], 14 | "author": "Evan You", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/vuejs/vue/issues" 18 | }, 19 | "homepage": "https://github.com/vuejs/vue/tree/dev/packages/weex-vue-framework#readme" 20 | } 21 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/compiler/directives/bind.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export default function bind (el: ASTElement, dir: ASTDirective) { 4 | el.wrapData = (code: string) => { 5 | return `_b(${code},'${el.tag}',${dir.value}${ 6 | dir.modifiers && dir.modifiers.prop ? ',true' : '' 7 | })` 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/compiler/directives/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import bind from './bind' 4 | import { noop } from 'shared/util' 5 | 6 | export default { 7 | bind, 8 | cloak: noop 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/compiler/parser/entity-decoder.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | let decoder 4 | 5 | export function decode (html: string): string { 6 | decoder = decoder || document.createElement('div') 7 | decoder.innerHTML = html 8 | return decoder.textContent 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/compiler/parser/text-parser.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { cached } from 'shared/util' 4 | import { parseFilters } from './filter-parser' 5 | 6 | const defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g 7 | const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g 8 | 9 | const buildRegex = cached(delimiters => { 10 | const open = delimiters[0].replace(regexEscapeRE, '\\$&') 11 | const close = delimiters[1].replace(regexEscapeRE, '\\$&') 12 | return new RegExp(open + '((?:.|\\n)+?)' + close, 'g') 13 | }) 14 | 15 | export function parseText ( 16 | text: string, 17 | delimiters?: [string, string] 18 | ): string | void { 19 | const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE 20 | if (!tagRE.test(text)) { 21 | return 22 | } 23 | const tokens = [] 24 | let lastIndex = tagRE.lastIndex = 0 25 | let match, index 26 | while ((match = tagRE.exec(text))) { 27 | index = match.index 28 | // push text token 29 | if (index > lastIndex) { 30 | tokens.push(JSON.stringify(text.slice(lastIndex, index))) 31 | } 32 | // tag token 33 | const exp = parseFilters(match[1].trim()) 34 | tokens.push(`_s(${exp})`) 35 | lastIndex = index + match[0].length 36 | } 37 | if (lastIndex < text.length) { 38 | tokens.push(JSON.stringify(text.slice(lastIndex))) 39 | } 40 | return tokens.join('+') 41 | } 42 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/components/index.js: -------------------------------------------------------------------------------- 1 | import KeepAlive from './keep-alive' 2 | 3 | export default { 4 | KeepAlive 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/global-api/assets.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import config from '../config' 4 | import { ASSET_TYPES } from 'shared/constants' 5 | import { warn, isPlainObject } from '../util/index' 6 | 7 | export function initAssetRegisters (Vue: GlobalAPI) { 8 | /** 9 | * Create asset registration methods. 10 | */ 11 | ASSET_TYPES.forEach(type => { 12 | Vue[type] = function ( 13 | id: string, 14 | definition: Function | Object 15 | ): Function | Object | void { 16 | if (!definition) { 17 | return this.options[type + 's'][id] 18 | } else { 19 | /* istanbul ignore if */ 20 | if (process.env.NODE_ENV !== 'production') { 21 | if (type === 'component' && config.isReservedTag(id)) { 22 | warn( 23 | 'Do not use built-in or reserved HTML elements as component ' + 24 | 'id: ' + id 25 | ) 26 | } 27 | } 28 | if (type === 'component' && isPlainObject(definition)) { 29 | definition.name = definition.name || id 30 | definition = this.options._base.extend(definition) 31 | } 32 | if (type === 'directive' && typeof definition === 'function') { 33 | definition = { bind: definition, update: definition } 34 | } 35 | this.options[type + 's'][id] = definition 36 | return definition 37 | } 38 | } 39 | }) 40 | } 41 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/global-api/mixin.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { mergeOptions } from '../util/index' 4 | 5 | export function initMixin (Vue: GlobalAPI) { 6 | Vue.mixin = function (mixin: Object) { 7 | this.options = mergeOptions(this.options, mixin) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/global-api/use.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { toArray } from '../util/index' 4 | 5 | export function initUse (Vue: GlobalAPI) { 6 | Vue.use = function (plugin: Function | Object) { 7 | /* istanbul ignore if */ 8 | if (plugin.installed) { 9 | return 10 | } 11 | // additional parameters 12 | const args = toArray(arguments, 1) 13 | args.unshift(this) 14 | if (typeof plugin.install === 'function') { 15 | plugin.install.apply(plugin, args) 16 | } else if (typeof plugin === 'function') { 17 | plugin.apply(null, args) 18 | } 19 | plugin.installed = true 20 | return this 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/index.js: -------------------------------------------------------------------------------- 1 | import Vue from './instance/index' 2 | import { initGlobalAPI } from './global-api/index' 3 | import { isServerRendering } from 'core/util/env' 4 | 5 | initGlobalAPI(Vue) 6 | 7 | Object.defineProperty(Vue.prototype, '$isServer', { 8 | get: isServerRendering 9 | }) 10 | 11 | Vue.version = '__VERSION__' 12 | 13 | export default Vue 14 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/index.js: -------------------------------------------------------------------------------- 1 | import { initMixin } from './init' 2 | import { stateMixin } from './state' 3 | import { renderMixin } from './render' 4 | import { eventsMixin } from './events' 5 | import { lifecycleMixin } from './lifecycle' 6 | import { warn } from '../util/index' 7 | 8 | function Vue (options) { 9 | if (process.env.NODE_ENV !== 'production' && 10 | !(this instanceof Vue)) { 11 | warn('Vue is a constructor and should be called with the `new` keyword') 12 | } 13 | this._init(options) 14 | } 15 | 16 | initMixin(Vue) 17 | stateMixin(Vue) 18 | eventsMixin(Vue) 19 | lifecycleMixin(Vue) 20 | renderMixin(Vue) 21 | 22 | export default Vue 23 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/render-helpers/bind-object-props.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import config from 'core/config' 4 | import { isObject, warn, toObject } from 'core/util/index' 5 | 6 | /** 7 | * Runtime helper for merging v-bind="object" into a VNode's data. 8 | */ 9 | export function bindObjectProps ( 10 | data: any, 11 | tag: string, 12 | value: any, 13 | asProp?: boolean 14 | ): VNodeData { 15 | if (value) { 16 | if (!isObject(value)) { 17 | process.env.NODE_ENV !== 'production' && warn( 18 | 'v-bind without argument expects an Object or Array value', 19 | this 20 | ) 21 | } else { 22 | if (Array.isArray(value)) { 23 | value = toObject(value) 24 | } 25 | let hash 26 | for (const key in value) { 27 | if (key === 'class' || key === 'style') { 28 | hash = data 29 | } else { 30 | const type = data.attrs && data.attrs.type 31 | hash = asProp || config.mustUseProp(tag, type, key) 32 | ? data.domProps || (data.domProps = {}) 33 | : data.attrs || (data.attrs = {}) 34 | } 35 | if (!(key in hash)) { 36 | hash[key] = value[key] 37 | } 38 | } 39 | } 40 | } 41 | return data 42 | } 43 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/render-helpers/check-keycodes.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import config from 'core/config' 4 | 5 | /** 6 | * Runtime helper for checking keyCodes from config. 7 | */ 8 | export function checkKeyCodes ( 9 | eventKeyCode: number, 10 | key: string, 11 | builtInAlias: number | Array | void 12 | ): boolean { 13 | const keyCodes = config.keyCodes[key] || builtInAlias 14 | if (Array.isArray(keyCodes)) { 15 | return keyCodes.indexOf(eventKeyCode) === -1 16 | } else { 17 | return keyCodes !== eventKeyCode 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/render-helpers/render-list.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { isObject } from 'core/util/index' 4 | 5 | /** 6 | * Runtime helper for rendering v-for lists. 7 | */ 8 | export function renderList ( 9 | val: any, 10 | render: () => VNode 11 | ): ?Array { 12 | let ret: ?Array, i, l, keys, key 13 | if (Array.isArray(val) || typeof val === 'string') { 14 | ret = new Array(val.length) 15 | for (i = 0, l = val.length; i < l; i++) { 16 | ret[i] = render(val[i], i) 17 | } 18 | } else if (typeof val === 'number') { 19 | ret = new Array(val) 20 | for (i = 0; i < val; i++) { 21 | ret[i] = render(i + 1, i) 22 | } 23 | } else if (isObject(val)) { 24 | keys = Object.keys(val) 25 | ret = new Array(keys.length) 26 | for (i = 0, l = keys.length; i < l; i++) { 27 | key = keys[i] 28 | ret[i] = render(val[key], key, i) 29 | } 30 | } 31 | return ret 32 | } 33 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/render-helpers/render-slot.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { extend, warn } from 'core/util/index' 4 | 5 | /** 6 | * Runtime helper for rendering 7 | */ 8 | export function renderSlot ( 9 | name: string, 10 | fallback: ?Array, 11 | props: ?Object, 12 | bindObject: ?Object 13 | ): ?Array { 14 | const scopedSlotFn = this.$scopedSlots[name] 15 | if (scopedSlotFn) { // scoped slot 16 | props = props || {} 17 | if (bindObject) { 18 | extend(props, bindObject) 19 | } 20 | return scopedSlotFn(props) || fallback 21 | } else { 22 | const slotNodes = this.$slots[name] 23 | // warn duplicate slot usage 24 | if (slotNodes && process.env.NODE_ENV !== 'production') { 25 | slotNodes._rendered && warn( 26 | `Duplicate presence of slot "${name}" found in the same render tree ` + 27 | `- this will likely cause render errors.`, 28 | this 29 | ) 30 | slotNodes._rendered = true 31 | } 32 | return slotNodes || fallback 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/instance/render-helpers/resolve-filter.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { identity, resolveAsset } from 'core/util/index' 4 | 5 | /** 6 | * Runtime helper for resolving filters 7 | */ 8 | export function resolveFilter (id: string): Function { 9 | return resolveAsset(this.$options, 'filters', id, true) || identity 10 | } 11 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/observer/array.js: -------------------------------------------------------------------------------- 1 | /* 2 | * not type checking this file because flow doesn't play well with 3 | * dynamically accessing methods on Array prototype 4 | */ 5 | 6 | import { def } from '../util/index' 7 | 8 | const arrayProto = Array.prototype 9 | export const arrayMethods = Object.create(arrayProto) 10 | 11 | /** 12 | * Intercept mutating methods and emit events 13 | */ 14 | ;[ 15 | 'push', 16 | 'pop', 17 | 'shift', 18 | 'unshift', 19 | 'splice', 20 | 'sort', 21 | 'reverse' 22 | ] 23 | .forEach(function (method) { 24 | // cache original method 25 | const original = arrayProto[method] 26 | def(arrayMethods, method, function mutator () { 27 | // avoid leaking arguments: 28 | // http://jsperf.com/closure-with-arguments 29 | let i = arguments.length 30 | const args = new Array(i) 31 | while (i--) { 32 | args[i] = arguments[i] 33 | } 34 | const result = original.apply(this, args) 35 | const ob = this.__ob__ 36 | let inserted 37 | switch (method) { 38 | case 'push': 39 | inserted = args 40 | break 41 | case 'unshift': 42 | inserted = args 43 | break 44 | case 'splice': 45 | inserted = args.slice(2) 46 | break 47 | } 48 | if (inserted) ob.observeArray(inserted) 49 | // notify change 50 | ob.dep.notify() 51 | return result 52 | }) 53 | }) 54 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/observer/dep.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import type Watcher from './watcher' 4 | import { remove } from '../util/index' 5 | 6 | let uid = 0 7 | 8 | /** 9 | * A dep is an observable that can have multiple 10 | * directives subscribing to it. 11 | */ 12 | export default class Dep { 13 | static target: ?Watcher; 14 | id: number; 15 | subs: Array; 16 | 17 | constructor () { 18 | this.id = uid++ 19 | this.subs = [] 20 | } 21 | 22 | addSub (sub: Watcher) { 23 | this.subs.push(sub) 24 | } 25 | 26 | removeSub (sub: Watcher) { 27 | remove(this.subs, sub) 28 | } 29 | 30 | depend () { 31 | if (Dep.target) { 32 | Dep.target.addDep(this) 33 | } 34 | } 35 | 36 | notify () { 37 | // stabilize the subscriber list first 38 | const subs = this.subs.slice() 39 | for (let i = 0, l = subs.length; i < l; i++) { 40 | subs[i].update() 41 | } 42 | } 43 | } 44 | 45 | // the current target watcher being evaluated. 46 | // this is globally unique because there could be only one 47 | // watcher being evaluated at any time. 48 | Dep.target = null 49 | const targetStack = [] 50 | 51 | export function pushTarget (_target: Watcher) { 52 | if (Dep.target) targetStack.push(Dep.target) 53 | Dep.target = _target 54 | } 55 | 56 | export function popTarget () { 57 | Dep.target = targetStack.pop() 58 | } 59 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/util/error.js: -------------------------------------------------------------------------------- 1 | import config from '../config' 2 | import { warn } from './debug' 3 | import { inBrowser } from './env' 4 | 5 | export function handleError (err, vm, info) { 6 | if (config.errorHandler) { 7 | config.errorHandler.call(null, err, vm, info) 8 | } else { 9 | if (process.env.NODE_ENV !== 'production') { 10 | warn(`Error in ${info}: "${err.toString()}"`, vm) 11 | } 12 | /* istanbul ignore else */ 13 | if (inBrowser && typeof console !== 'undefined') { 14 | console.error(err) 15 | } else { 16 | throw err 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/util/index.js: -------------------------------------------------------------------------------- 1 | export * from 'shared/util' 2 | export * from './lang' 3 | export * from './env' 4 | export * from './options' 5 | export * from './debug' 6 | export * from './props' 7 | export * from './error' 8 | export { defineReactive } from '../observer/index' 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/util/lang.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export const emptyObject = Object.freeze({}) 4 | 5 | /** 6 | * Check if a string starts with $ or _ 7 | */ 8 | export function isReserved (str: string): boolean { 9 | const c = (str + '').charCodeAt(0) 10 | return c === 0x24 || c === 0x5F 11 | } 12 | 13 | /** 14 | * Define a property. 15 | */ 16 | export function def (obj: Object, key: string, val: any, enumerable?: boolean) { 17 | Object.defineProperty(obj, key, { 18 | value: val, 19 | enumerable: !!enumerable, 20 | writable: true, 21 | configurable: true 22 | }) 23 | } 24 | 25 | /** 26 | * Parse simple path. 27 | */ 28 | const bailRE = /[^\w.$]/ 29 | export function parsePath (path: string): any { 30 | if (bailRE.test(path)) { 31 | return 32 | } 33 | const segments = path.split('.') 34 | return function (obj) { 35 | for (let i = 0; i < segments.length; i++) { 36 | if (!obj) return 37 | obj = obj[segments[i]] 38 | } 39 | return obj 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/util/perf.js: -------------------------------------------------------------------------------- 1 | import { inBrowser } from './env' 2 | 3 | export let mark 4 | export let measure 5 | 6 | if (process.env.NODE_ENV !== 'production') { 7 | const perf = inBrowser && window.performance 8 | /* istanbul ignore if */ 9 | if ( 10 | perf && 11 | perf.mark && 12 | perf.measure && 13 | perf.clearMarks && 14 | perf.clearMeasures 15 | ) { 16 | mark = tag => perf.mark(tag) 17 | measure = (name, startTag, endTag) => { 18 | perf.measure(name, startTag, endTag) 19 | perf.clearMarks(startTag) 20 | perf.clearMarks(endTag) 21 | perf.clearMeasures(name) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/vdom/helpers/get-first-component-child.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { isDef } from 'shared/util' 4 | 5 | export function getFirstComponentChild (children: ?Array): ?VNode { 6 | if (Array.isArray(children)) { 7 | for (let i = 0; i < children.length; i++) { 8 | const c = children[i] 9 | if (isDef(c) && isDef(c.componentOptions)) { 10 | return c 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/vdom/helpers/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export * from './merge-hook' 4 | export * from './extract-props' 5 | export * from './update-listeners' 6 | export * from './normalize-children' 7 | export * from './resolve-async-component' 8 | export * from './get-first-component-child' 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/vdom/helpers/merge-hook.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { createFnInvoker } from './update-listeners' 4 | import { remove, isDef, isUndef, isTrue } from 'shared/util' 5 | 6 | export function mergeVNodeHook (def: Object, hookKey: string, hook: Function) { 7 | let invoker 8 | const oldHook = def[hookKey] 9 | 10 | function wrappedHook () { 11 | hook.apply(this, arguments) 12 | // important: remove merged hook to ensure it's called only once 13 | // and prevent memory leak 14 | remove(invoker.fns, wrappedHook) 15 | } 16 | 17 | if (isUndef(oldHook)) { 18 | // no existing hook 19 | invoker = createFnInvoker([wrappedHook]) 20 | } else { 21 | /* istanbul ignore if */ 22 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { 23 | // already a merged invoker 24 | invoker = oldHook 25 | invoker.fns.push(wrappedHook) 26 | } else { 27 | // existing plain hook 28 | invoker = createFnInvoker([oldHook, wrappedHook]) 29 | } 30 | } 31 | 32 | invoker.merged = true 33 | def[hookKey] = invoker 34 | } 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/vdom/modules/index.js: -------------------------------------------------------------------------------- 1 | import directives from './directives' 2 | import ref from './ref' 3 | 4 | export default [ 5 | ref, 6 | directives 7 | ] 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/core/vdom/modules/ref.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { remove } from 'shared/util' 4 | 5 | export default { 6 | create (_: any, vnode: VNodeWithData) { 7 | registerRef(vnode) 8 | }, 9 | update (oldVnode: VNodeWithData, vnode: VNodeWithData) { 10 | if (oldVnode.data.ref !== vnode.data.ref) { 11 | registerRef(oldVnode, true) 12 | registerRef(vnode) 13 | } 14 | }, 15 | destroy (vnode: VNodeWithData) { 16 | registerRef(vnode, true) 17 | } 18 | } 19 | 20 | export function registerRef (vnode: VNodeWithData, isRemoval: ?boolean) { 21 | const key = vnode.data.ref 22 | if (!key) return 23 | 24 | const vm = vnode.context 25 | const ref = vnode.componentInstance || vnode.elm 26 | const refs = vm.$refs 27 | if (isRemoval) { 28 | if (Array.isArray(refs[key])) { 29 | remove(refs[key], ref) 30 | } else if (refs[key] === ref) { 31 | refs[key] = undefined 32 | } 33 | } else { 34 | if (vnode.data.refInFor) { 35 | if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) { 36 | refs[key].push(ref) 37 | } else { 38 | refs[key] = [ref] 39 | } 40 | } else { 41 | refs[key] = ref 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/entries/web-compiler.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export { parseComponent } from 'sfc/parser' 4 | export { compile, compileToFunctions } from 'web/compiler/index' 5 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/entries/web-server-renderer.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | process.env.VUE_ENV = 'server' 4 | 5 | import { createRenderer as _createRenderer } from 'server/create-renderer' 6 | import { createBundleRendererCreator } from 'server/bundle-renderer/create-bundle-renderer' 7 | import { isUnaryTag, canBeLeftOpenTag } from 'web/compiler/util' 8 | import modules from 'web/server/modules/index' 9 | import baseDirectives from 'web/server/directives/index' 10 | 11 | export function createRenderer (options?: Object = {}): { 12 | renderToString: Function, 13 | renderToStream: Function 14 | } { 15 | return _createRenderer(Object.assign({}, options, { 16 | isUnaryTag, 17 | canBeLeftOpenTag, 18 | modules, 19 | // user can provide server-side implementations for custom directives 20 | // when creating the renderer. 21 | directives: Object.assign(baseDirectives, options.directives) 22 | })) 23 | } 24 | 25 | export const createBundleRenderer = createBundleRendererCreator(createRenderer) 26 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/entries/weex-compiler.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export { compile } from 'weex/compiler/index' 4 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/entries/weex-factory.js: -------------------------------------------------------------------------------- 1 | // this entry is built and wrapped with a factory function 2 | // used to generate a fresh copy of Vue for every Weex instance. 3 | 4 | import Vue from 'weex/runtime/index' 5 | 6 | exports.Vue = Vue 7 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/entries/weex-framework.js: -------------------------------------------------------------------------------- 1 | export * from 'weex/framework' 2 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/directives/html.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { addProp } from 'compiler/helpers' 4 | 5 | export default function html (el: ASTElement, dir: ASTDirective) { 6 | if (dir.value) { 7 | addProp(el, 'innerHTML', `_s(${dir.value})`) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/directives/index.js: -------------------------------------------------------------------------------- 1 | import model from './model' 2 | import text from './text' 3 | import html from './html' 4 | 5 | export default { 6 | model, 7 | text, 8 | html 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/directives/text.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { addProp } from 'compiler/helpers' 4 | 5 | export default function text (el: ASTElement, dir: ASTDirective) { 6 | if (dir.value) { 7 | addProp(el, 'textContent', `_s(${dir.value})`) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { isUnaryTag, canBeLeftOpenTag } from './util' 4 | import { genStaticKeys } from 'shared/util' 5 | import { createCompiler } from 'compiler/index' 6 | 7 | import modules from './modules/index' 8 | import directives from './directives/index' 9 | 10 | import { 11 | isPreTag, 12 | mustUseProp, 13 | isReservedTag, 14 | getTagNamespace 15 | } from '../util/index' 16 | 17 | export const baseOptions: CompilerOptions = { 18 | expectHTML: true, 19 | modules, 20 | directives, 21 | isPreTag, 22 | isUnaryTag, 23 | mustUseProp, 24 | canBeLeftOpenTag, 25 | isReservedTag, 26 | getTagNamespace, 27 | staticKeys: genStaticKeys(modules) 28 | } 29 | 30 | const { compile, compileToFunctions } = createCompiler(baseOptions) 31 | export { compile, compileToFunctions } 32 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/modules/index.js: -------------------------------------------------------------------------------- 1 | import klass from './class' 2 | import style from './style' 3 | 4 | export default [ 5 | klass, 6 | style 7 | ] 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/compiler/util.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { makeMap } from 'shared/util' 4 | 5 | export const isUnaryTag = makeMap( 6 | 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 7 | 'link,meta,param,source,track,wbr' 8 | ) 9 | 10 | // Elements that you can, intentionally, leave open 11 | // (and which close themselves) 12 | export const canBeLeftOpenTag = makeMap( 13 | 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source' 14 | ) 15 | 16 | // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 17 | // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content 18 | export const isNonPhrasingTag = makeMap( 19 | 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 20 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 21 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 22 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 23 | 'title,tr,track' 24 | ) 25 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/runtime/components/index.js: -------------------------------------------------------------------------------- 1 | import Transition from './transition' 2 | import TransitionGroup from './transition-group' 3 | 4 | export default { 5 | Transition, 6 | TransitionGroup 7 | } 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/runtime/directives/index.js: -------------------------------------------------------------------------------- 1 | import model from './model' 2 | import show from './show' 3 | 4 | export default { 5 | model, 6 | show 7 | } 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/runtime/modules/class.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { 4 | isDef, 5 | isUndef 6 | } from 'shared/util' 7 | 8 | import { 9 | concat, 10 | stringifyClass, 11 | genClassForVnode 12 | } from 'web/util/index' 13 | 14 | function updateClass (oldVnode: any, vnode: any) { 15 | const el = vnode.elm 16 | const data: VNodeData = vnode.data 17 | const oldData: VNodeData = oldVnode.data 18 | if ( 19 | isUndef(data.staticClass) && 20 | isUndef(data.class) && ( 21 | isUndef(oldData) || ( 22 | isUndef(oldData.staticClass) && 23 | isUndef(oldData.class) 24 | ) 25 | ) 26 | ) { 27 | return 28 | } 29 | 30 | let cls = genClassForVnode(vnode) 31 | 32 | // handle transition classes 33 | const transitionClass = el._transitionClasses 34 | if (isDef(transitionClass)) { 35 | cls = concat(cls, stringifyClass(transitionClass)) 36 | } 37 | 38 | // set the class 39 | if (cls !== el._prevClass) { 40 | el.setAttribute('class', cls) 41 | el._prevClass = cls 42 | } 43 | } 44 | 45 | export default { 46 | create: updateClass, 47 | update: updateClass 48 | } 49 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/runtime/modules/index.js: -------------------------------------------------------------------------------- 1 | import attrs from './attrs' 2 | import klass from './class' 3 | import events from './events' 4 | import domProps from './dom-props' 5 | import style from './style' 6 | import transition from './transition' 7 | 8 | export default [ 9 | attrs, 10 | klass, 11 | events, 12 | domProps, 13 | style, 14 | transition 15 | ] 16 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/runtime/patch.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import * as nodeOps from 'web/runtime/node-ops' 4 | import { createPatchFunction } from 'core/vdom/patch' 5 | import baseModules from 'core/vdom/modules/index' 6 | import platformModules from 'web/runtime/modules/index' 7 | 8 | // the directive module should be applied last, after all 9 | // built-in modules have been applied. 10 | const modules = platformModules.concat(baseModules) 11 | 12 | export const patch: Function = createPatchFunction({ nodeOps, modules }) 13 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/server/directives/index.js: -------------------------------------------------------------------------------- 1 | import show from './show' 2 | 3 | export default { 4 | show 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/server/directives/show.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export default function show (node: VNodeWithData, dir: VNodeDirective) { 4 | if (!dir.value) { 5 | const style: any = node.data.style || (node.data.style = {}) 6 | style.display = 'none' 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/server/modules/class.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { escape } from 'he' 4 | import { genClassForVnode } from 'web/util/index' 5 | 6 | export default function renderClass (node: VNodeWithData): ?string { 7 | const classList = genClassForVnode(node) 8 | if (classList !== '') { 9 | return ` class="${escape(classList)}"` 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/server/modules/index.js: -------------------------------------------------------------------------------- 1 | import attrs from './attrs' 2 | import domProps from './dom-props' 3 | import klass from './class' 4 | import style from './style' 5 | 6 | export default [ 7 | attrs, 8 | domProps, 9 | klass, 10 | style 11 | ] 12 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/server/modules/style.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { escape } from 'he' 4 | import { hyphenate } from 'shared/util' 5 | import { getStyle } from 'web/util/style' 6 | 7 | function genStyleText (vnode: VNode): string { 8 | let styleText = '' 9 | const style = getStyle(vnode, false) 10 | for (const key in style) { 11 | styleText += `${hyphenate(key)}:${style[key]};` 12 | } 13 | return styleText 14 | } 15 | 16 | export default function renderStyle (vnode: VNodeWithData): ?string { 17 | const styleText = genStyleText(vnode) 18 | if (styleText !== '') { 19 | return ` style=${JSON.stringify(escape(styleText))}` 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/util/compat.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { inBrowser } from 'core/util/index' 4 | 5 | // check whether current browser encodes a char inside attribute values 6 | function shouldDecode (content: string, encoded: string): boolean { 7 | const div = document.createElement('div') 8 | div.innerHTML = `
` 9 | return div.innerHTML.indexOf(encoded) > 0 10 | } 11 | 12 | // #3663 13 | // IE encodes newlines inside attribute values while other browsers don't 14 | export const shouldDecodeNewlines = inBrowser ? shouldDecode('\n', ' ') : false 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/web/util/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { warn } from 'core/util/index' 4 | 5 | export * from './attrs' 6 | export * from './class' 7 | export * from './element' 8 | 9 | /** 10 | * Query an element selector if it's not an element already. 11 | */ 12 | export function query (el: string | Element): Element { 13 | if (typeof el === 'string') { 14 | const selected = document.querySelector(el) 15 | if (!selected) { 16 | process.env.NODE_ENV !== 'production' && warn( 17 | 'Cannot find element: ' + el 18 | ) 19 | return document.createElement('div') 20 | } 21 | return selected 22 | } else { 23 | return el 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/directives/index.js: -------------------------------------------------------------------------------- 1 | import model from './model' 2 | 3 | export default { 4 | model 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/directives/model.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { addHandler, addAttr } from 'compiler/helpers' 4 | import { genComponentModel, genAssignmentCode } from 'compiler/directives/model' 5 | 6 | export default function model ( 7 | el: ASTElement, 8 | dir: ASTDirective, 9 | _warn: Function 10 | ): ?boolean { 11 | if (el.tag === 'input' || el.tag === 'textarea') { 12 | genDefaultModel(el, dir.value, dir.modifiers) 13 | } else { 14 | genComponentModel(el, dir.value, dir.modifiers) 15 | } 16 | } 17 | 18 | function genDefaultModel ( 19 | el: ASTElement, 20 | value: string, 21 | modifiers: ?ASTModifiers 22 | ): ?boolean { 23 | const { lazy, trim, number } = modifiers || {} 24 | const event = lazy ? 'change' : 'input' 25 | 26 | let valueExpression = `$event.target.attr.value${trim ? '.trim()' : ''}` 27 | if (number) { 28 | valueExpression = `_n(${valueExpression})` 29 | } 30 | 31 | const code = genAssignmentCode(value, valueExpression) 32 | addAttr(el, 'value', `(${value})`) 33 | addHandler(el, event, code, null, true) 34 | } 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { genStaticKeys } from 'shared/util' 4 | import { createCompiler } from 'compiler/index' 5 | 6 | import modules from './modules/index' 7 | import directives from './directives/index' 8 | 9 | import { 10 | isUnaryTag, 11 | mustUseProp, 12 | isReservedTag, 13 | canBeLeftOpenTag, 14 | getTagNamespace 15 | } from '../util/index' 16 | 17 | export const baseOptions: CompilerOptions = { 18 | modules, 19 | directives, 20 | isUnaryTag, 21 | mustUseProp, 22 | canBeLeftOpenTag, 23 | isReservedTag, 24 | getTagNamespace, 25 | preserveWhitespace: false, 26 | staticKeys: genStaticKeys(modules) 27 | } 28 | 29 | const { compile, compileToFunctions } = createCompiler(baseOptions) 30 | export { compile, compileToFunctions } 31 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/modules/append.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function preTransformNode (el: ASTElement, options: CompilerOptions) { 4 | if (el.tag === 'cell' && !el.attrsList.some(item => item.name === 'append')) { 5 | el.attrsMap.append = 'tree' 6 | el.attrsList.push({ name: 'append', value: 'tree' }) 7 | } 8 | if (el.attrsMap.append === 'tree') { 9 | el.appendAsTree = true 10 | } 11 | } 12 | 13 | function genData (el: ASTElement): string { 14 | return el.appendAsTree ? `appendAsTree:true,` : '' 15 | } 16 | 17 | export default { 18 | staticKeys: ['appendAsTree'], 19 | preTransformNode, 20 | genData 21 | } 22 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/modules/index.js: -------------------------------------------------------------------------------- 1 | import klass from './class' 2 | import style from './style' 3 | import props from './props' 4 | import append from './append' 5 | 6 | export default [ 7 | klass, 8 | style, 9 | props, 10 | append 11 | ] 12 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/compiler/modules/props.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { cached, camelize } from 'shared/util' 4 | 5 | const normalize = cached(camelize) 6 | 7 | function normalizeKeyName (str: string) : string { 8 | if (str.match(/^v\-/)) { 9 | return str.replace(/(v-[a-z\-]+\:)([a-z\-]+)$/i, ($, directive, prop) => { 10 | return directive + normalize(prop) 11 | }) 12 | } 13 | return normalize(str) 14 | } 15 | 16 | function transformNode (el: ASTElement, options: CompilerOptions) { 17 | if (Array.isArray(el.attrsList)) { 18 | el.attrsList.forEach(attr => { 19 | if (attr.name && attr.name.match(/\-/)) { 20 | const realName = normalizeKeyName(attr.name) 21 | if (el.attrsMap) { 22 | el.attrsMap[realName] = el.attrsMap[attr.name] 23 | delete el.attrsMap[attr.name] 24 | } 25 | attr.name = realName 26 | } 27 | }) 28 | } 29 | } 30 | export default { 31 | transformNode 32 | } 33 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/components/index.js: -------------------------------------------------------------------------------- 1 | import Transition from './transition' 2 | import TransitionGroup from './transition-group' 3 | 4 | export default { 5 | Transition, 6 | TransitionGroup 7 | } 8 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/components/transition.js: -------------------------------------------------------------------------------- 1 | // reuse same transition component logic from web 2 | export { 3 | transitionProps, 4 | extractTransitionData 5 | } from 'web/runtime/components/transition' 6 | 7 | import Transition from 'web/runtime/components/transition' 8 | 9 | export default Transition 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/directives/index.js: -------------------------------------------------------------------------------- 1 | export default { 2 | } 3 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import Vue from 'core/index' 4 | import { patch } from 'weex/runtime/patch' 5 | import { mountComponent } from 'core/instance/lifecycle' 6 | import platformDirectives from 'weex/runtime/directives/index' 7 | import platformComponents from 'weex/runtime/components/index' 8 | 9 | import { 10 | query, 11 | mustUseProp, 12 | isReservedTag, 13 | isUnknownElement 14 | } from 'weex/util/index' 15 | 16 | // install platform specific utils 17 | Vue.config.mustUseProp = mustUseProp 18 | Vue.config.isReservedTag = isReservedTag 19 | Vue.config.isUnknownElement = isUnknownElement 20 | 21 | // install platform runtime directives and components 22 | Vue.options.directives = platformDirectives 23 | Vue.options.components = platformComponents 24 | 25 | // install platform patch function 26 | Vue.prototype.__patch__ = patch 27 | 28 | // wrap mount 29 | Vue.prototype.$mount = function ( 30 | el?: any, 31 | hydrating?: boolean 32 | ): Component { 33 | return mountComponent( 34 | this, 35 | el && query(el, this.$document), 36 | hydrating 37 | ) 38 | } 39 | 40 | export default Vue 41 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/modules/attrs.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import { extend } from 'shared/util' 4 | 5 | function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) { 6 | if (!oldVnode.data.attrs && !vnode.data.attrs) { 7 | return 8 | } 9 | let key, cur, old 10 | const elm = vnode.elm 11 | const oldAttrs = oldVnode.data.attrs || {} 12 | let attrs = vnode.data.attrs || {} 13 | // clone observed objects, as the user probably wants to mutate it 14 | if (attrs.__ob__) { 15 | attrs = vnode.data.attrs = extend({}, attrs) 16 | } 17 | 18 | for (key in attrs) { 19 | cur = attrs[key] 20 | old = oldAttrs[key] 21 | if (old !== cur) { 22 | elm.setAttr(key, cur) 23 | } 24 | } 25 | for (key in oldAttrs) { 26 | if (attrs[key] == null) { 27 | elm.setAttr(key) 28 | } 29 | } 30 | } 31 | 32 | export default { 33 | create: updateAttrs, 34 | update: updateAttrs 35 | } 36 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/modules/index.js: -------------------------------------------------------------------------------- 1 | import attrs from './attrs' 2 | import klass from './class' 3 | import events from './events' 4 | import style from './style' 5 | import transition from './transition' 6 | 7 | export default [ 8 | attrs, 9 | klass, 10 | events, 11 | style, 12 | transition 13 | ] 14 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/patch.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import * as nodeOps from 'weex/runtime/node-ops' 4 | import { createPatchFunction } from 'core/vdom/patch' 5 | import baseModules from 'core/vdom/modules/index' 6 | import platformModules from 'weex/runtime/modules/index' 7 | 8 | // the directive module should be applied last, after all 9 | // built-in modules have been applied. 10 | const modules = platformModules.concat(baseModules) 11 | 12 | export const patch: Function = createPatchFunction({ 13 | nodeOps, 14 | modules, 15 | LONG_LIST_THRESHOLD: 10 16 | }) 17 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/platforms/weex/runtime/text-node.js: -------------------------------------------------------------------------------- 1 | let latestNodeId = 1 2 | 3 | export default function TextNode (text) { 4 | this.instanceId = '' 5 | this.nodeId = latestNodeId++ 6 | this.parentNode = null 7 | this.nodeType = 3 8 | this.text = text 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/server/template-renderer/parse-template.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export type ParsedTemplate = { 4 | head: string; 5 | neck: string; 6 | tail: string; 7 | }; 8 | 9 | export function parseTemplate ( 10 | template: string, 11 | contentPlaceholder?: string = '' 12 | ): ParsedTemplate { 13 | if (typeof template === 'object') { 14 | return template 15 | } 16 | 17 | let i = template.indexOf('') 18 | const j = template.indexOf(contentPlaceholder) 19 | 20 | if (j < 0) { 21 | throw new Error(`Content placeholder not found in template.`) 22 | } 23 | 24 | if (i < 0) { 25 | i = template.indexOf('') 26 | if (i < 0) { 27 | i = j 28 | } 29 | } 30 | 31 | return { 32 | head: template.slice(0, i), 33 | neck: template.slice(i, j), 34 | tail: template.slice(j + contentPlaceholder.length) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/server/write.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | const MAX_STACK_DEPTH = 1000 4 | 5 | export function createWriteFunction ( 6 | write: (text: string, next: Function) => boolean, 7 | onError: Function 8 | ): Function { 9 | let stackDepth = 0 10 | const cachedWrite = (text, next) => { 11 | if (text && cachedWrite.caching) { 12 | cachedWrite.cacheBuffer[cachedWrite.cacheBuffer.length - 1] += text 13 | } 14 | const waitForNext = write(text, next) 15 | if (waitForNext !== true) { 16 | if (stackDepth >= MAX_STACK_DEPTH) { 17 | process.nextTick(() => { 18 | try { next() } catch (e) { 19 | onError(e) 20 | } 21 | }) 22 | } else { 23 | stackDepth++ 24 | next() 25 | stackDepth-- 26 | } 27 | } 28 | } 29 | cachedWrite.caching = false 30 | cachedWrite.cacheBuffer = [] 31 | return cachedWrite 32 | } 33 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/src/shared/constants.js: -------------------------------------------------------------------------------- 1 | export const SSR_ATTR = 'data-server-rendered' 2 | 3 | export const ASSET_TYPES = [ 4 | 'component', 5 | 'directive', 6 | 'filter' 7 | ] 8 | 9 | export const LIFECYCLE_HOOKS = [ 10 | 'beforeCreate', 11 | 'created', 12 | 'beforeMount', 13 | 'mounted', 14 | 'beforeUpdate', 15 | 'updated', 16 | 'beforeDestroy', 17 | 'destroyed', 18 | 'activated', 19 | 'deactivated' 20 | ] 21 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/e2e/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indent": 0 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var spawn = require('cross-spawn') 3 | var httpServer = require('http-server') 4 | var server = httpServer.createServer({ 5 | root: path.resolve(__dirname, '../../') 6 | }) 7 | 8 | server.listen(8080) 9 | 10 | var args = process.argv.slice(2) 11 | if (args.indexOf('--config') === -1) { 12 | args = args.concat(['--config', 'build/nightwatch.config.js']) 13 | } 14 | if (args.indexOf('--env') === -1) { 15 | args = args.concat(['--env', 'chrome,phantomjs']) 16 | } 17 | var i = args.indexOf('--test') 18 | if (i > -1) { 19 | args[i + 1] = 'test/e2e/specs/' + args[i + 1] + '.js' 20 | } 21 | 22 | var runner = spawn('./node_modules/.bin/nightwatch', args, { 23 | stdio: 'inherit' 24 | }) 25 | 26 | runner.on('exit', function (code) { 27 | server.close() 28 | process.exit(code) 29 | }) 30 | 31 | runner.on('error', function (err) { 32 | server.close() 33 | throw err 34 | }) 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/e2e/specs/commits.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'commits': function (browser) { 3 | browser 4 | .url('http://localhost:8080/examples/commits/') 5 | .waitForElementVisible('li', 5000) 6 | .assert.count('input', 2) 7 | .assert.count('label', 2) 8 | .assert.containsText('label[for="master"]', 'master') 9 | .assert.containsText('label[for="dev"]', 'dev') 10 | .assert.checked('#master') 11 | .assert.checked('#dev', false) 12 | .assert.containsText('p', 'vuejs/vue@master') 13 | .assert.count('li', 3) 14 | .assert.count('li .commit', 3) 15 | .assert.count('li .message', 3) 16 | .click('#dev') 17 | .assert.containsText('p', 'vuejs/vue@dev') 18 | .assert.count('li', 3) 19 | .assert.count('li .commit', 3) 20 | .assert.count('li .message', 3) 21 | .end() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/e2e/specs/markdown.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'markdown': function (browser) { 3 | browser 4 | .url('http://localhost:8080/examples/markdown/') 5 | .waitForElementVisible('#editor', 1000) 6 | .assert.value('textarea', '# hello') 7 | .assert.hasHTML('#editor div', '

hello

') 8 | .setValue('textarea', '\n## foo\n\n- bar\n- baz') 9 | // assert the output is not updated yet because of debounce 10 | .assert.hasHTML('#editor div', '

hello

') 11 | .waitFor(500) 12 | .assert.hasHTML('#editor div', 13 | '

hello

\n' + 14 | '

foo

\n' + 15 | '
    \n
  • bar
  • \n
  • baz
  • \n
' 16 | ) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/e2e/specs/modal.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'modal': function (browser) { 3 | browser 4 | .url('http://localhost:8080/examples/modal/') 5 | .waitForElementVisible('#app', 1000) 6 | .assert.elementNotPresent('.modal-mask') 7 | .click('#show-modal') 8 | .assert.elementPresent('.modal-mask') 9 | .assert.elementPresent('.modal-wrapper') 10 | .assert.elementPresent('.modal-container') 11 | .waitFor(50) 12 | .assert.cssClassPresent('.modal-mask', 'modal-enter-active') 13 | .waitFor(300) 14 | .assert.cssClassNotPresent('.modal-mask', 'modal-enter-active') 15 | .assert.containsText('.modal-header h3', 'custom header') 16 | .assert.containsText('.modal-body', 'default body') 17 | .assert.containsText('.modal-footer', 'default footer') 18 | .click('.modal-default-button') 19 | // should have transition 20 | .assert.elementPresent('.modal-mask') 21 | .waitFor(50) 22 | .assert.cssClassPresent('.modal-mask', 'modal-leave-active') 23 | .waitFor(300) 24 | .assert.elementNotPresent('.modal-mask') 25 | .end() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/helpers/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jasmine": true 4 | }, 5 | "globals": { 6 | "waitForUpdate": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/helpers/classlist.js: -------------------------------------------------------------------------------- 1 | beforeEach(() => { 2 | jasmine.addMatchers({ 3 | // since classList may not be supported in all browsers 4 | toHaveClass: () => { 5 | return { 6 | compare: (el, cls) => { 7 | const pass = el.classList 8 | ? el.classList.contains(cls) 9 | : el.getAttribute('class').split(/\s+/g).indexOf(cls) > -1 10 | return { 11 | pass, 12 | message: `Expected element${pass ? ' ' : ' not '}to have class ${cls}` 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/helpers/to-equal.js: -------------------------------------------------------------------------------- 1 | import { isEqual } from 'lodash' 2 | 3 | beforeEach(() => { 4 | jasmine.addMatchers({ 5 | // override built-in toEqual because it behaves incorrectly 6 | // on Vue-observed arrays in Safari 7 | toEqual: () => { 8 | return { 9 | compare: (a, b) => { 10 | const pass = isEqual(a, b) 11 | return { 12 | pass, 13 | message: `Expected ${a} to equal ${b}` 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/helpers/trigger-event.js: -------------------------------------------------------------------------------- 1 | window.triggerEvent = function triggerEvent (target, event, process) { 2 | var e = document.createEvent('HTMLEvents') 3 | e.initEvent(event, true, true) 4 | if (process) process(e) 5 | target.dispatchEvent(e) 6 | } 7 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/helpers/vdom.js: -------------------------------------------------------------------------------- 1 | import VNode from 'core/vdom/vnode' 2 | 3 | window.createTextVNode = function (text) { 4 | return new VNode(undefined, undefined, undefined, text) 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jasmine": true 4 | }, 5 | "plugins": ["jasmine"], 6 | "rules": { 7 | "jasmine/no-focused-tests": 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/compile-with-webpack.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import webpack from 'webpack' 3 | import MemoeryFS from 'memory-fs' 4 | 5 | export function compileWithWebpack (file, extraConfig, cb) { 6 | const config = Object.assign({ 7 | entry: path.resolve(__dirname, 'fixtures', file), 8 | module: { 9 | rules: [ 10 | { 11 | test: /\.js$/, 12 | loader: 'babel-loader' 13 | }, 14 | { 15 | test: /\.(png|woff2)$/, 16 | loader: 'file-loader', 17 | options: { 18 | name: '[name].[ext]' 19 | } 20 | } 21 | ] 22 | } 23 | }, extraConfig) 24 | 25 | const compiler = webpack(config) 26 | const fs = new MemoeryFS() 27 | compiler.outputFileSystem = fs 28 | 29 | compiler.run((err, stats) => { 30 | expect(err).toBeFalsy() 31 | expect(stats.errors).toBeFalsy() 32 | cb(fs) 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/app.js: -------------------------------------------------------------------------------- 1 | import Vue from '../../../dist/vue.runtime.common.js' 2 | 3 | export default context => { 4 | return new Promise(resolve => { 5 | context.msg = 'hello' 6 | resolve(new Vue({ 7 | render (h) { 8 | return h('div', context.url) 9 | } 10 | })) 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/async-bar.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | render (h) { 3 | return h('div', 'async bar') 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/async-foo.js: -------------------------------------------------------------------------------- 1 | // import image and font 2 | import font from './test.woff2' 3 | import image from './test.png' 4 | 5 | module.exports = { 6 | render (h) { 7 | return h('div', `async ${font} ${image}`) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/cache.js: -------------------------------------------------------------------------------- 1 | import Vue from '../../../dist/vue.runtime.common.js' 2 | 3 | const app = { 4 | name: 'app', 5 | props: ['id'], 6 | serverCacheKey: props => props.id, 7 | render (h) { 8 | return h('div', '/test') 9 | } 10 | } 11 | 12 | export default () => { 13 | return Promise.resolve(new Vue({ 14 | render: h => h(app, { props: { id: 1 }}) 15 | })) 16 | } 17 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/error.js: -------------------------------------------------------------------------------- 1 | throw new Error('foo') 2 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/split.js: -------------------------------------------------------------------------------- 1 | import Vue from '../../../dist/vue.runtime.common.js' 2 | 3 | // async component! 4 | const Foo = () => import('./async-foo') 5 | const Bar = () => import('./async-bar') // eslint-disable-line 6 | 7 | export default context => { 8 | return new Promise(resolve => { 9 | context.msg = 'hello' 10 | const vm = new Vue({ 11 | render (h) { 12 | return h('div', [ 13 | context.url, 14 | h(Foo) 15 | ]) 16 | } 17 | }) 18 | 19 | // simulate router.onReady 20 | Foo().then(comp => { 21 | // resolve now to make the render sync 22 | Foo.resolved = Vue.extend(comp) 23 | resolve(vm) 24 | }) 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/test.png -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/test.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huang303513/SourceCodeResearchAndExploration/b63ca9be30b25ec4caa546b991f87d069d9e3753/Vue2.2.6源码阅读201711/vue/test/ssr/fixtures/test.woff2 -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/ssr/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "test/ssr", 3 | "spec_files": [ 4 | "*.spec.js" 5 | ], 6 | "helpers": [ 7 | "../../node_modules/babel-register/lib/node.js" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jasmine": true 4 | }, 5 | "globals": { 6 | "waitForUpdate": true, 7 | "triggerEvent": true, 8 | "createTextVNode": true 9 | }, 10 | "plugins": ["jasmine"], 11 | "rules": { 12 | "jasmine/no-focused-tests": 2 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/directives/cloak.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Directive v-cloak', () => { 4 | it('should be removed after compile', () => { 5 | const el = document.createElement('div') 6 | el.setAttribute('v-cloak', '') 7 | const vm = new Vue({ el }) 8 | expect(vm.$el.hasAttribute('v-cloak')).toBe(false) 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/directives/model-dynamic.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Directive v-model dynamic input type', () => { 4 | it('should warn', function () { 5 | new Vue({ 6 | data: { 7 | type: 'text', 8 | text: 'hi' 9 | }, 10 | template: `` 11 | }).$mount() 12 | expect(`v-model does not support dynamic input types`).toHaveBeenWarned() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/directives/model-file.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Directive v-model file', () => { 4 | it('warn to use @change instead', () => { 5 | new Vue({ 6 | data: { 7 | file: '' 8 | }, 9 | template: '' 10 | }).$mount() 11 | expect('Use a v-on:change listener instead').toHaveBeenWarned() 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/directives/model-parse.spec.js: -------------------------------------------------------------------------------- 1 | import { parseModel } from 'compiler/directives/model' 2 | 3 | describe('model expression parser', () => { 4 | it('parse object dot notation', () => { 5 | const res = parseModel('a.b.c') 6 | expect(res.exp).toBe('a.b.c') 7 | expect(res.idx).toBe(null) 8 | }) 9 | 10 | it('parse string in brackets', () => { 11 | const res = parseModel('a["b"][c]') 12 | expect(res.exp).toBe('a["b"]') 13 | expect(res.idx).toBe('c') 14 | }) 15 | 16 | it('parse brackets with object dot notation', () => { 17 | const res = parseModel('a["b"][c].xxx') 18 | expect(res.exp).toBe('a["b"][c].xxx') 19 | expect(res.idx).toBe(null) 20 | }) 21 | 22 | it('parse nested brackets', () => { 23 | const res = parseModel('a[i[c]]') 24 | expect(res.exp).toBe('a') 25 | expect(res.idx).toBe('i[c]') 26 | }) 27 | 28 | it('combined', () => { 29 | const res = parseModel('test.xxx.a["asa"][test1[idx]]') 30 | expect(res.exp).toBe('test.xxx.a["asa"]') 31 | expect(res.idx).toBe('test1[idx]') 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/directives/pre.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Directive v-pre', function () { 4 | it('should not compile inner content', function () { 5 | const vm = new Vue({ 6 | template: `
7 |
{{ a }}
8 |
{{ a }}
9 |
10 | 11 |
12 |
`, 13 | data: { 14 | a: 123 15 | } 16 | }) 17 | vm.$mount() 18 | expect(vm.$el.firstChild.textContent).toBe('{{ a }}') 19 | expect(vm.$el.children[1].textContent).toBe('123') 20 | expect(vm.$el.lastChild.innerHTML).toBe('') 21 | }) 22 | 23 | it('should not compile on root node', function () { 24 | const vm = new Vue({ 25 | template: '
{{ a }}
', 26 | replace: true, 27 | data: { 28 | a: 123 29 | } 30 | }) 31 | vm.$mount() 32 | expect(vm.$el.firstChild.textContent).toBe('{{ a }}') 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/global-api/compile.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Global API: compile', () => { 4 | it('should compile render functions', () => { 5 | const res = Vue.compile('
{{ msg }}
') 6 | const vm = new Vue({ 7 | data: { 8 | msg: 'hello' 9 | }, 10 | render: res.render, 11 | staticRenderFns: res.staticRenderFns 12 | }).$mount() 13 | expect(vm.$el.innerHTML).toContain('hello') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/global-api/use.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Global API: use', () => { 4 | const def = {} 5 | const options = {} 6 | const pluginStub = { 7 | install: (Vue, opts) => { 8 | Vue.directive('plugin-test', def) 9 | expect(opts).toBe(options) 10 | } 11 | } 12 | 13 | it('should apply Object plugin', () => { 14 | Vue.use(pluginStub, options) 15 | expect(Vue.options.directives['plugin-test']).toBe(def) 16 | delete Vue.options.directives['plugin-test'] 17 | }) 18 | 19 | it('should apply Function plugin', () => { 20 | Vue.use(pluginStub.install, options) 21 | expect(Vue.options.directives['plugin-test']).toBe(def) 22 | delete Vue.options.directives['plugin-test'] 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/instance/init.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Initialization', () => { 4 | it('without new', () => { 5 | try { Vue() } catch (e) {} 6 | expect('Vue is a constructor and should be called with the `new` keyword').toHaveBeenWarned() 7 | }) 8 | 9 | it('with new', () => { 10 | expect(new Vue() instanceof Vue).toBe(true) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/instance/render-proxy.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | if (typeof Proxy !== 'undefined') { 4 | describe('render proxy', () => { 5 | it('should warn missing property in render fns with `with`', () => { 6 | new Vue({ 7 | template: `
{{ a }}
` 8 | }).$mount() 9 | expect(`Property or method "a" is not defined`).toHaveBeenWarned() 10 | }) 11 | 12 | it('should warn missing property in render fns without `with`', () => { 13 | const render = function (h) { 14 | return h('div', [this.a]) 15 | } 16 | render._withStripped = true 17 | new Vue({ 18 | render 19 | }).$mount() 20 | expect(`Property or method "a" is not defined`).toHaveBeenWarned() 21 | }) 22 | 23 | it('should not warn for hand-written render functions', () => { 24 | new Vue({ 25 | render (h) { 26 | return h('div', [this.a]) 27 | } 28 | }).$mount() 29 | expect(`Property or method "a" is not defined`).not.toHaveBeenWarned() 30 | }) 31 | }) 32 | } 33 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/extends.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Options extends', () => { 4 | it('should work on objects', () => { 5 | const A = { 6 | data () { 7 | return { a: 1 } 8 | } 9 | } 10 | const B = { 11 | extends: A, 12 | data () { 13 | return { b: 2 } 14 | } 15 | } 16 | const vm = new Vue({ 17 | extends: B, 18 | data: { 19 | c: 3 20 | } 21 | }) 22 | expect(vm.a).toBe(1) 23 | expect(vm.b).toBe(2) 24 | expect(vm.c).toBe(3) 25 | }) 26 | 27 | it('should work on extended constructors', () => { 28 | const A = Vue.extend({ 29 | data () { 30 | return { a: 1 } 31 | } 32 | }) 33 | const B = Vue.extend({ 34 | extends: A, 35 | data () { 36 | return { b: 2 } 37 | } 38 | }) 39 | const vm = new Vue({ 40 | extends: B, 41 | data: { 42 | c: 3 43 | } 44 | }) 45 | expect(vm.a).toBe(1) 46 | expect(vm.b).toBe(2) 47 | expect(vm.c).toBe(3) 48 | }) 49 | }) 50 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/methods.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Options methods', () => { 4 | it('should have correct context', () => { 5 | const vm = new Vue({ 6 | data: { 7 | a: 1 8 | }, 9 | methods: { 10 | plus () { 11 | this.a++ 12 | } 13 | } 14 | }) 15 | vm.plus() 16 | expect(vm.a).toBe(2) 17 | }) 18 | 19 | it('should warn undefined methods', () => { 20 | new Vue({ 21 | methods: { 22 | hello: undefined 23 | } 24 | }) 25 | expect(`method "hello" has an undefined value in the component definition`).toHaveBeenWarned() 26 | }) 27 | }) 28 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/parent.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Options parent', () => { 4 | it('should work', () => { 5 | const parent = new Vue({ 6 | render () {} 7 | }).$mount() 8 | 9 | const child = new Vue({ 10 | parent: parent, 11 | render () {} 12 | }).$mount() 13 | 14 | // this option is straight-forward 15 | // it should register 'parent' as a $parent for 'child' 16 | // and push 'child' to $children array on 'parent' 17 | expect(child.$options.parent).toBeDefined() 18 | expect(child.$options.parent).toEqual(parent) 19 | expect(child.$parent).toBeDefined() 20 | expect(child.$parent).toEqual(parent) 21 | expect(parent.$children).toContain(child) 22 | 23 | // destroy 'child' and check if it was removed from 'parent' $children 24 | child.$destroy() 25 | expect(parent.$children.length).toEqual(0) 26 | parent.$destroy() 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/propsData.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Options propsData', () => { 4 | it('should work', done => { 5 | const A = Vue.extend({ 6 | props: ['a'], 7 | template: '
{{ a }}
' 8 | }) 9 | const vm = new A({ 10 | propsData: { 11 | a: 123 12 | } 13 | }).$mount() 14 | expect(vm.a).toBe(123) 15 | expect(vm.$el.textContent).toBe('123') 16 | vm.a = 234 17 | waitForUpdate(() => { 18 | expect(vm.$el.textContent).toBe('234') 19 | }).then(done) 20 | }) 21 | 22 | it('warn non instantiation usage', () => { 23 | Vue.extend({ 24 | propsData: { 25 | a: 123 26 | } 27 | }) 28 | expect('option "propsData" can only be used during instance creation').toHaveBeenWarned() 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/render.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'entries/web-runtime' 2 | 3 | describe('Options render', () => { 4 | it('basic usage', () => { 5 | const vm = new Vue({ 6 | render (h) { 7 | const children = [] 8 | for (let i = 0; i < this.items.length; i++) { 9 | children.push(h('li', { staticClass: 'task' }, [this.items[i].name])) 10 | } 11 | return h('ul', { staticClass: 'tasks' }, children) 12 | }, 13 | data: { 14 | items: [{ id: 1, name: 'task1' }, { id: 2, name: 'task2' }] 15 | } 16 | }).$mount() 17 | expect(vm.$el.tagName).toBe('UL') 18 | for (let i = 0; i < vm.$el.children.length; i++) { 19 | const li = vm.$el.children[i] 20 | expect(li.tagName).toBe('LI') 21 | expect(li.textContent).toBe(vm.items[i].name) 22 | } 23 | }) 24 | 25 | it('allow null data', () => { 26 | const vm = new Vue({ 27 | render (h) { 28 | return h('div', null, 'hello' /* string as children*/) 29 | } 30 | }).$mount() 31 | expect(vm.$el.tagName).toBe('DIV') 32 | expect(vm.$el.textContent).toBe('hello') 33 | }) 34 | 35 | it('should warn non `render` option and non `template` option', () => { 36 | new Vue().$mount() 37 | expect('Failed to mount component: template or render function not defined.').toHaveBeenWarned() 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/features/options/renderError.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | describe('Options renderError', () => { 4 | it('should be used on render errors', done => { 5 | Vue.config.errorHandler = () => {} 6 | const vm = new Vue({ 7 | data: { 8 | ok: true 9 | }, 10 | render (h) { 11 | if (this.ok) { 12 | return h('div', 'ok') 13 | } else { 14 | throw new Error('no') 15 | } 16 | }, 17 | renderError (h, err) { 18 | return h('div', err.toString()) 19 | } 20 | }).$mount() 21 | expect(vm.$el.textContent).toBe('ok') 22 | vm.ok = false 23 | waitForUpdate(() => { 24 | expect(vm.$el.textContent).toBe('Error: no') 25 | Vue.config.errorHandler = null 26 | }).then(done) 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/index.js: -------------------------------------------------------------------------------- 1 | require('es6-promise/auto') 2 | 3 | // import all helpers 4 | const helpersContext = require.context('../helpers', true) 5 | helpersContext.keys().forEach(helpersContext) 6 | 7 | // require all test files 8 | const testsContext = require.context('./', true, /\.spec$/) 9 | testsContext.keys().forEach(testsContext) 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/modules/util/next-tick.spec.js: -------------------------------------------------------------------------------- 1 | import { nextTick } from 'core/util/env' 2 | 3 | describe('nextTick', () => { 4 | it('accepts a callback', done => { 5 | nextTick(done) 6 | }) 7 | 8 | it('returns undefined when passed a callback', () => { 9 | expect(nextTick(() => {})).toBeUndefined() 10 | }) 11 | 12 | if (typeof Promise !== 'undefined') { 13 | it('returns a Promise when provided no callback', done => { 14 | nextTick().then(done) 15 | }) 16 | 17 | it('returns a Promise with a context argument when provided a falsy callback and an object', done => { 18 | const obj = {} 19 | nextTick(undefined, obj).then(ctx => { 20 | expect(ctx).toBe(obj) 21 | done() 22 | }) 23 | }) 24 | 25 | it('returned Promise should resolve correctly vs callback', done => { 26 | const spy = jasmine.createSpy() 27 | nextTick(spy) 28 | nextTick().then(() => { 29 | expect(spy).toHaveBeenCalled() 30 | done() 31 | }) 32 | }) 33 | } 34 | }) 35 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/unit/modules/vdom/modules/directive.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { patch } from 'web/runtime/patch' 3 | import VNode from 'core/vdom/vnode' 4 | 5 | describe('vdom directive module', () => { 6 | it('should work', () => { 7 | const directive1 = { 8 | bind: jasmine.createSpy('bind'), 9 | update: jasmine.createSpy('update'), 10 | unbind: jasmine.createSpy('unbind') 11 | } 12 | const vm = new Vue({ directives: { directive1 }}) 13 | // create 14 | const vnode1 = new VNode('div', {}, [ 15 | new VNode('p', { 16 | directives: [{ 17 | name: 'directive1', value: 'hello', arg: 'arg1', modifiers: { modifire1: true } 18 | }] 19 | }, undefined, 'hello world', undefined, vm) 20 | ]) 21 | patch(null, vnode1) 22 | expect(directive1.bind).toHaveBeenCalled() 23 | // update 24 | const vnode2 = new VNode('div', {}, [ 25 | new VNode('p', { 26 | directives: [{ 27 | name: 'directive1', value: 'world', arg: 'arg1', modifiers: { modifire1: true } 28 | }] 29 | }, undefined, 'hello world', undefined, vm) 30 | ]) 31 | patch(vnode1, vnode2) 32 | expect(directive1.update).toHaveBeenCalled() 33 | // destroy 34 | const vnode3 = new VNode('div') 35 | patch(vnode2, vnode3) 36 | expect(directive1.unbind).toHaveBeenCalled() 37 | }) 38 | }) 39 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/weex/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jasmine": true 4 | }, 5 | "plugins": ["jasmine"], 6 | "rules": { 7 | "jasmine/no-focused-tests": 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/weex/compiler/append.spec.js: -------------------------------------------------------------------------------- 1 | import { compile } from '../../../packages/weex-template-compiler' 2 | import { strToRegExp } from '../helpers/index' 3 | 4 | describe('append props', () => { 5 | it('append="tree"', () => { 6 | const { render, staticRenderFns, errors } = compile(``) 7 | expect(render).not.toBeUndefined() 8 | expect(staticRenderFns).not.toBeUndefined() 9 | expect(staticRenderFns.length).toEqual(1) 10 | expect(staticRenderFns).toMatch(strToRegExp(`appendAsTree:true`)) 11 | expect(staticRenderFns).toMatch(strToRegExp(`attrs:{"append":"tree"}`)) 12 | expect(errors).toEqual([]) 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/weex/compiler/props.spec.js: -------------------------------------------------------------------------------- 1 | import { compile } from '../../../packages/weex-template-compiler' 2 | import { strToRegExp } from '../helpers/index' 3 | 4 | describe('compile props', () => { 5 | it('custom props', () => { 6 | const { render, staticRenderFns, errors } = compile(`
`) 7 | expect(render).not.toBeUndefined() 8 | expect(staticRenderFns).not.toBeUndefined() 9 | expect(staticRenderFns.length).toEqual(0) 10 | expect(render).toMatch(strToRegExp(`attrs:{"custom":"whatever"}`)) 11 | expect(errors).toEqual([]) 12 | }) 13 | 14 | it('camelize props', () => { 15 | const { render, staticRenderFns, errors } = compile(`
`) 16 | expect(render).not.toBeUndefined() 17 | expect(staticRenderFns).not.toBeUndefined() 18 | expect(staticRenderFns.length).toEqual(0) 19 | expect(render).toMatch(strToRegExp(`attrs:{"kebabCase":"whatever"}`)) 20 | expect(errors).toEqual([]) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/test/weex/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "test/weex", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "../../node_modules/babel-register/lib/node.js" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/types/plugin.d.ts: -------------------------------------------------------------------------------- 1 | import { Vue as _Vue } from "./vue"; 2 | 3 | export type PluginFunction = (Vue: typeof _Vue, options?: T) => void; 4 | 5 | export interface PluginObject { 6 | install: PluginFunction; 7 | [key: string]: any; 8 | } 9 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/types/test/augmentation-test.ts: -------------------------------------------------------------------------------- 1 | import Vue = require("../index"); 2 | 3 | declare module "../vue" { 4 | // add instance property and method 5 | interface Vue { 6 | $instanceProperty: string; 7 | $instanceMethod(): void; 8 | } 9 | 10 | // add static property and method 11 | namespace Vue { 12 | const staticProperty: string; 13 | function staticMethod(): void; 14 | } 15 | } 16 | 17 | // augment ComponentOptions 18 | declare module "../options" { 19 | interface ComponentOptions { 20 | foo?: string; 21 | } 22 | } 23 | 24 | const vm = new Vue({ 25 | data: { 26 | a: true 27 | }, 28 | foo: "foo" 29 | }); 30 | 31 | vm.$instanceProperty; 32 | vm.$instanceMethod(); 33 | 34 | Vue.staticProperty; 35 | Vue.staticMethod(); 36 | -------------------------------------------------------------------------------- /Vue2.2.6源码阅读201711/vue/types/test/plugin-test.ts: -------------------------------------------------------------------------------- 1 | import Vue = require("../index"); 2 | import { PluginFunction, PluginObject } from "../index"; 3 | 4 | class Option { 5 | prefix: string; 6 | suffix: string; 7 | } 8 | 9 | const plugin: PluginObject