├── .clang-format ├── .clang-tidy ├── .github └── ISSUE_TEMPLATE │ └── release-issue-template.md ├── .gitignore ├── .gitmodules ├── .travis.yml ├── CHANGELOG.md ├── CMakeLists.txt ├── LICENSE ├── LICENSE.thirdparty ├── README.md ├── deps └── CMakeLists.txt ├── docs └── value.md ├── extras ├── CMakeLists.txt ├── googletest.cmake └── rapidjson.cmake ├── include ├── CMakeLists.txt └── mapbox │ ├── compatibility │ └── value.hpp │ ├── io │ └── io.hpp │ ├── platform.hpp │ ├── polyfills │ └── mbx │ │ └── expected.hpp │ ├── std │ └── weak.hpp │ └── util │ ├── expected.hpp │ └── type_wrapper.hpp ├── license-lock ├── scripts ├── check-license.sh ├── ci │ ├── install-tests.sh │ ├── run-syntax-check.sh │ └── run-tests.sh └── license-checker │ ├── .flowconfig │ ├── license-checker │ ├── main.js │ ├── package-lock.json │ └── package.json └── test ├── .gitignore ├── CMakeLists.txt ├── compatibility └── value.cpp ├── fixtures └── hello_world.txt ├── io ├── io.cpp ├── io_delete.cpp └── io_delete.hpp ├── std └── weak.cpp ├── test_defines.hpp.in └── util └── type_wrapper.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | AccessModifierOffset: -4 5 | IndentPPDirectives: AfterHash 6 | AllowShortFunctionsOnASingleLine: Inline 7 | ColumnLimit: 120 8 | IndentWidth: 4 9 | SpacesBeforeTrailingComments: 1 10 | ... 11 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: 'bugprone-*,cppcoreguidelines-*,clang-analyzer-*,google-*,misc-*,modernize-*,performance-*,readability-*,-google-runtime-int,-google-readability-todo,-readability-named-parameter,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-pointer-arithmetic' 2 | WarningsAsErrors: '*' 3 | HeaderFilterRegex: '.*' 4 | CheckOptions: 5 | - key: readability-identifier-naming.PrivateMemberSuffix 6 | value: '_' 7 | - key: readability-identifier-naming.ProtectedMemberSuffix 8 | value: '_' 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/release-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Make a release 3 | about: Checklist for a new release of mapbox-base 4 | title: "[release] Release " 5 | labels: release 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Release 11 | 12 | - Releaser: `@` 13 | 14 | ## ☑ Release checklist 15 | 16 | ### QA 17 | - [ ] Discuss with the team and stakeholders to make sure the release is good to go 18 | - [ ] Perform final testing to assure QA; make sure all bots are green 19 | 20 | ### Changelog 21 | - [ ] Update the changelog and merge it to master 22 | - Until the process is automated, do this by comparing the difference between the previous `` branch and what is on `master`, using this URL as a reference: `https://github.com/mapbox/mapbox-base/compare/...master` 23 | 24 | ### Create release branch 25 | - [ ] Create a branch off mapbox-base `master` with the same [branch protections](https://github.com/mapbox/mapbox-base/settings/branches) as `master` for this release. Name the branch: `release-v`) 26 | - The easiest way to cut the branch and apply branch protection is by using [`github-release-tools`](https://github.com/mapbox/github-release-tools/). Once you have installed this, you can cut the branch and apply the branch protections like so: 27 | 28 | ``` 29 | $ git checkout master && git pull origin master 30 | $ git checkout -b release-v && git push origin release-v 31 | $ branch-permissions release-v master 32 | ``` 33 | 34 | ### Create GitHub release 35 | - [ ] Create a GitHub release on https://github.com/mapbox/mapbox-base/releases 36 | - [ ] Create a git tag by giving the release a [version](https://semver.org/). Tag the release: `v`). 37 | - [ ] Target should point at the release-branch 38 | - [ ] Add the changelog entries for the release to the `Describe this release` section 39 | 40 | ### Patching the release 41 | Any changes made to the release branch **after** the release branch has been created *need to be cherry picked* into the release branch. This is the responsibility of the PR author. 42 | 43 | /cc @mapbox/cpp @mapbox/core-sdk @mapbox/gl-native @mapbox/navigation @mapbox/search-sdk @mapbox/vision-core 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # CMake build folder 35 | build/ 36 | 37 | # NPM modules 38 | node_modules 39 | 40 | *.user 41 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libs/geometry.hpp"] 2 | path = deps/geometry.hpp 3 | url = https://github.com/mapbox/geometry.hpp.git 4 | [submodule "libs/variant"] 5 | path = deps/variant 6 | url = https://github.com/mapbox/variant.git 7 | [submodule "libs/optional"] 8 | path = deps/optional 9 | url = https://github.com/mapbox/Optional.git 10 | [submodule "libs/args"] 11 | path = extras/args 12 | url = https://github.com/Taywee/args 13 | [submodule "libs/expected-lite"] 14 | path = extras/expected-lite 15 | url = https://github.com/martinmoene/expected-lite.git 16 | [submodule "libs/filesystem"] 17 | path = extras/filesystem 18 | url = https://github.com/gulrak/filesystem.git 19 | [submodule "libs/pixelmatch-cpp"] 20 | path = deps/pixelmatch-cpp 21 | url = https://github.com/mapbox/pixelmatch-cpp.git 22 | [submodule "libs/rapidjson"] 23 | path = extras/rapidjson 24 | url = https://github.com/Tencent/rapidjson.git 25 | [submodule "mapbox/jni.hpp"] 26 | path = deps/jni.hpp 27 | url = https://github.com/mapbox/jni.hpp.git 28 | [submodule "mapbox/geojson.hpp"] 29 | path = deps/geojson.hpp 30 | url = https://github.com/mapbox/geojson.hpp.git 31 | [submodule "mapbox/supercluster.hpp"] 32 | path = deps/supercluster.hpp 33 | url = https://github.com/mapbox/supercluster.hpp.git 34 | [submodule "extras/kdbush.hpp"] 35 | path = extras/kdbush.hpp 36 | url = https://github.com/mourner/kdbush.hpp.git 37 | [submodule "mapbox/cheap-ruler-cpp"] 38 | path = deps/cheap-ruler-cpp 39 | url = https://github.com/mapbox/cheap-ruler-cpp.git 40 | [submodule "mapbox/shelf-pack-cpp"] 41 | path = deps/shelf-pack-cpp 42 | url = https://github.com/mapbox/shelf-pack-cpp.git 43 | [submodule "mapbox/geojson-vt-cpp"] 44 | path = deps/geojson-vt-cpp 45 | url = https://github.com/mapbox/geojson-vt-cpp.git 46 | [submodule "extras/googletest"] 47 | path = extras/googletest 48 | url = https://github.com/google/googletest.git 49 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | # dist: bionic 3 | language: cpp 4 | 5 | # branches: 6 | # only: 7 | # - master 8 | 9 | env: 10 | global: 11 | - JOBS=4 12 | - PROJECT_NAME="mapbox-base" 13 | 14 | jobs: 15 | - &syntax-check 16 | stage: test 17 | os: linux 18 | language: cpp 19 | name: Syntax Check 20 | 21 | addons: &gcc6 22 | apt: 23 | sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8' ] 24 | packages: [ 'clang-3.8', 'clang-tidy' ] 25 | 26 | script: scripts/ci/run-syntax-check.sh 27 | 28 | - &license-check 29 | state: test 30 | os: linux 31 | language: node_js 32 | node_js: 33 | - 10 34 | name: License Check 35 | script: scripts/check-license.sh 36 | 37 | - &test 38 | stage: test 39 | os: linux 40 | language: cpp 41 | name: Test / gcc-6-release 42 | cache: 43 | ccache: true 44 | apt: true 45 | directories: 46 | - test/cache 47 | addons: &gcc6 48 | apt: 49 | sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8' ] 50 | packages: ['g++-6'] 51 | compiler: "gcc-6" 52 | env: "CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'" 53 | install: scripts/ci/install-tests.sh 54 | script: scripts/ci/run-tests.sh 55 | 56 | - <<: *test 57 | name: Test / gcc-6-debug 58 | addons: 59 | apt: 60 | sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8' ] 61 | packages: ['g++-6'] 62 | env: "CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug'" 63 | install: scripts/ci/install-tests.sh 64 | script: scripts/ci/run-tests.sh 65 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Mapbox Base 2 | 3 | ## v1.9.1 4 | 5 | ### 💫️ Other 6 | - [deps] Update ghc::filesystem to v1.5.10 7 | 8 | ## v1.9.0 9 | 10 | ### 💫️ Other 11 | - [deps] Update ghc::filesystem to v1.5.6 12 | 13 | ## v1.8.1 14 | 15 | ### 💫️ Other 16 | - [deps] Update geojson-vt-cpp to v6.6.5 17 | 18 | ## v1.8.0 19 | 20 | ### 💫️ Other 21 | - [deps] Update supercluster.hpp to v0.5.0 22 | 23 | ## v1.7.0 24 | 25 | ### 💫️ Other 26 | - [deps] Bump supercluster.hpp to v0.4.0 27 | 28 | ## v1.6.1 29 | 30 | ### 💫️ Other 31 | - [base] jni.hpp @ 57ca9ed4bbeb22ed8d20a55063dcaa217ba47f42 32 | 33 | ## v1.6.0 34 | 35 | ### 💫️ Other 36 | - [base] Update geojson.hpp to v5.1.0 37 | - [base] Update geojson-vt-cpp to v6.6.4 38 | - [ci] Rename master branch to main 39 | - [weak] Introduce WeakPtrFactory::invalidateWeakPtrs() 40 | - [weak] Fix possible WeakPtr locks after WeakPtrFactory gets invalid. 41 | 42 | ## v1.5.0 43 | 44 | ### 💫️ Other 45 | - [base] Update geojson.hpp to v0.5.0 46 | 47 | ## v1.4.0 48 | 49 | ### ✨ New features 50 | - [extras] Bump googletest to 1.10.0 51 | - Better gmock syntax. 52 | 53 | ### ⚠️ Breaking changes 54 | - [base] expected-lite @ v0.4.0 55 | 56 | ### 💫️ Other 57 | - [doc] Add documentation for `mapbox::base::Value` 58 | 59 | ## v1.3.0 60 | 61 | ### ✨ New features 62 | - [base] Add platform definitions 63 | 64 | ### ⚠️ Breaking changes 65 | - [base] jni.hpp @ e2bbae090005ac1ce2a88c51c0cff2d22d957545 66 | 67 | ### 💫️ Other 68 | - [build] Update LICENSE.thirdparty 69 | 70 | ## v1.2.1 71 | 72 | ### 💫️ Other 73 | - Add `MAPBOX_BASE_BUILD_TESTING` option for overriding building tests when building outside of mapbox-base project. 74 | 75 | ## v1.2.0 76 | 77 | ### ✨ New features 78 | - Update minimist dependency to v1.2.5 79 | - [base] Added GeoJSON VT and ShelfPack 80 | 81 | ### ⚠️ Breaking changes 82 | - Move mapbox-base-owned libraries to a single folder 83 | - [base] cheap-ruler-cpp @ 746044cfbb7d254f1d67929eb564a0dcaaa39cc1 84 | - [base] jni.hpp @ 385dede669c843144b9ad68bbb7af3989d76104e 85 | - [base] geometry.hpp @ a5571a3ace5853e0d1e8d5fbdc87163c824ebeb7 86 | 87 | ### 💫️ Other 88 | - Use googletest framework 89 | 90 | ## v1.1.0 91 | 92 | ### ✨ New features 93 | Extras: 94 | - extras/args @ 6.2.2-9-g401663c 95 | - extras/expected-lite @ v0.3.0-6-g6fad61b 96 | - extras/filesystem @ v1.2.4-7-g135015f 97 | - extras/kdbush.hpp @ v0.1.3-1-ge1e847b 98 | - extras/rapidjson @ v1.1.0-490-gd87b698d 99 | 100 | New libraries: 101 | - mapbox/io 102 | - mapbox/typewrapper 103 | - mapbox/value 104 | - mapbox/weak 105 | 106 | ### ⚠️ Breaking changes 107 | - mapbox/geojson.hpp @ v0.4.3 108 | - mapbox/geometry.hpp @ v1.0.0-8-gb3f4bd4 109 | - mapbox/jni.hpp @ v4.0.1 110 | - mapbox/optional @ f6249e7f 111 | - mapbox/supercluster.hpp @ v0.3.2-1-g03c026c 112 | - mapbox/variant @ v1.1.6 113 | 114 | ## v1.0.0 115 | 116 | ### ✨ New features 117 | - geometry.hpp @ v1.0.0 118 | - variant @ v1.1.6 119 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(TARGET mapbox-base) 2 | return() 3 | endif() 4 | 5 | cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) 6 | project(MAPBOX_BASE LANGUAGES CXX C) 7 | 8 | option(MAPBOX_BASE_BUILD_TESTING "Bypass project target check and enforce building tests" OFF) 9 | 10 | include(CTest) 11 | 12 | cmake_policy(SET CMP0063 NEW) 13 | 14 | if(NOT CMAKE_VERSION VERSION_LESS 3.13.0) 15 | # Required to allow mapbox-base to depend on libraries coming from /deps 16 | cmake_policy(SET CMP0079 NEW) 17 | endif() 18 | 19 | set(CMAKE_CXX_STANDARD 14) 20 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 21 | set(CMAKE_CXX_VISIBILITY_PRESET hidden) 22 | set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) 23 | 24 | add_subdirectory(${PROJECT_SOURCE_DIR}/extras) 25 | add_subdirectory(${PROJECT_SOURCE_DIR}/include) 26 | add_subdirectory(${PROJECT_SOURCE_DIR}/deps) 27 | 28 | if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MAPBOX_BASE_BUILD_TESTING) AND BUILD_TESTING) 29 | add_subdirectory(${PROJECT_SOURCE_DIR}/test) 30 | endif() 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) MapBox 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | - Redistributions in binary form must reproduce the above copyright notice, this 10 | list of conditions and the following disclaimer in the documentation and/or 11 | other materials provided with the distribution. 12 | - Neither the name "MapBox" nor the names of its contributors may be 13 | used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /LICENSE.thirdparty: -------------------------------------------------------------------------------- 1 | Mapbox Base uses portions of googletest 2 | 3 | Copyright 2008, Google Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following disclaimer 14 | in the documentation and/or other materials provided with the 15 | distribution. 16 | * Neither the name of Google Inc. nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | =========================================================================== 33 | 34 | Mapbox Base uses portions of kdbush.hpp 35 | 36 | Copyright (c) 2016, Vladimir Agafonkin 37 | 38 | Permission to use, copy, modify, and/or distribute this software for any 39 | purpose with or without fee is hereby granted, provided that the above 40 | copyright notice and this permission notice appear in all copies. 41 | 42 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 43 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 44 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 45 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 46 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 47 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 48 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 49 | 50 | =========================================================================== 51 | 52 | Mapbox Base uses portions of args 53 | 54 | Copyright (c) 2016-2017 Taylor C. Richberger and Pavel Belikov 55 | 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 60 | 61 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 62 | 63 | =========================================================================== 64 | 65 | Mapbox Base uses portions of expected-lite 66 | 67 | Boost Software License - Version 1.0 - August 17th, 2003 68 | 69 | Permission is hereby granted, free of charge, to any person or organization 70 | obtaining a copy of the software and accompanying documentation covered by 71 | this license (the "Software") to use, reproduce, display, distribute, 72 | execute, and transmit the Software, and to prepare derivative works of the 73 | Software, and to permit third-parties to whom the Software is furnished to 74 | do so, all subject to the following: 75 | 76 | The copyright notices in the Software and this entire statement, including 77 | the above license grant, this restriction and the following disclaimer, 78 | must be included in all copies of the Software, in whole or in part, and 79 | all derivative works of the Software, unless such copies or derivative 80 | works are solely in the form of machine-executable object code generated by 81 | a source language processor. 82 | 83 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 84 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 85 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 86 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 87 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 88 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 89 | DEALINGS IN THE SOFTWARE. 90 | 91 | =========================================================================== 92 | 93 | Mapbox Base uses portions of filesystem 94 | 95 | Copyright (c) 2018, Steffen Schümann 96 | 97 | Permission is hereby granted, free of charge, to any person obtaining a copy 98 | of this software and associated documentation files (the "Software"), to deal 99 | in the Software without restriction, including without limitation the rights 100 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 101 | copies of the Software, and to permit persons to whom the Software is 102 | furnished to do so, subject to the following conditions: 103 | 104 | The above copyright notice and this permission notice shall be included in all 105 | copies or substantial portions of the Software. 106 | 107 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 108 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 109 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 110 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 111 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 112 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 113 | SOFTWARE. 114 | 115 | =========================================================================== 116 | 117 | Mapbox Base uses portions of geometry.hpp 118 | 119 | Copyright (c) 2016, Mapbox 120 | 121 | Permission to use, copy, modify, and/or distribute this software for any 122 | purpose with or without fee is hereby granted, provided that the above 123 | copyright notice and this permission notice appear in all copies. 124 | 125 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 126 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 127 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 128 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 129 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 130 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 131 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 132 | =========================================================================== 133 | 134 | Mapbox Base uses portions of optional 135 | 136 | Boost Software License - Version 1.0 - August 17th, 2003 137 | 138 | Permission is hereby granted, free of charge, to any person or organization 139 | obtaining a copy of the software and accompanying documentation covered by 140 | this license (the "Software") to use, reproduce, display, distribute, 141 | execute, and transmit the Software, and to prepare derivative works of the 142 | Software, and to permit third-parties to whom the Software is furnished to 143 | do so, all subject to the following: 144 | 145 | The copyright notices in the Software and this entire statement, including 146 | the above license grant, this restriction and the following disclaimer, 147 | must be included in all copies of the Software, in whole or in part, and 148 | all derivative works of the Software, unless such copies or derivative 149 | works are solely in the form of machine-executable object code generated by 150 | a source language processor. 151 | 152 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 153 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 154 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 155 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 156 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 157 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 158 | DEALINGS IN THE SOFTWARE. 159 | 160 | =========================================================================== 161 | 162 | Mapbox Base uses portions of pixelmatch-cpp 163 | 164 | Copyright (c) 2015, Mapbox 165 | 166 | Permission to use, copy, modify, and/or distribute this software for any purpose 167 | with or without fee is hereby granted, provided that the above copyright notice 168 | and this permission notice appear in all copies. 169 | 170 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 171 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 172 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 173 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 174 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 175 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 176 | THIS SOFTWARE. 177 | 178 | =========================================================================== 179 | 180 | Mapbox Base uses portions of rapidjson 181 | 182 | Tencent is pleased to support the open source community by making RapidJSON available. 183 | 184 | Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 185 | 186 | If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License. 187 | If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license. 188 | A copy of the MIT License is included in this file. 189 | 190 | Other dependencies and licenses: 191 | 192 | Open Source Software Licensed Under the BSD License: 193 | -------------------------------------------------------------------- 194 | 195 | The msinttypes r29 196 | Copyright (c) 2006-2013 Alexander Chemeris 197 | All rights reserved. 198 | 199 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 200 | 201 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 202 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 203 | * Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 204 | 205 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 206 | 207 | Open Source Software Licensed Under the JSON License: 208 | -------------------------------------------------------------------- 209 | 210 | json.org 211 | Copyright (c) 2002 JSON.org 212 | All Rights Reserved. 213 | 214 | JSON_checker 215 | Copyright (c) 2002 JSON.org 216 | All Rights Reserved. 217 | 218 | 219 | Terms of the JSON License: 220 | --------------------------------------------------- 221 | 222 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 223 | 224 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 225 | 226 | The Software shall be used for Good, not Evil. 227 | 228 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 229 | 230 | 231 | Terms of the MIT License: 232 | -------------------------------------------------------------------- 233 | 234 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 235 | 236 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 237 | 238 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 239 | 240 | =========================================================================== 241 | 242 | Mapbox Base uses portions of variant 243 | 244 | Copyright (c) MapBox 245 | All rights reserved. 246 | 247 | Redistribution and use in source and binary forms, with or without modification, 248 | are permitted provided that the following conditions are met: 249 | 250 | - Redistributions of source code must retain the above copyright notice, this 251 | list of conditions and the following disclaimer. 252 | - Redistributions in binary form must reproduce the above copyright notice, this 253 | list of conditions and the following disclaimer in the documentation and/or 254 | other materials provided with the distribution. 255 | - Neither the name "MapBox" nor the names of its contributors may be 256 | used to endorse or promote products derived from this software without 257 | specific prior written permission. 258 | 259 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 260 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 261 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 262 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 263 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 264 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 265 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 266 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 267 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 268 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 269 | =========================================================================== 270 | 271 | Mapbox Base uses portions of cheap-ruler-cpp 272 | 273 | ISC License 274 | 275 | Copyright (c) 2017, Mapbox 276 | 277 | Permission to use, copy, modify, and/or distribute this software for any purpose 278 | with or without fee is hereby granted, provided that the above copyright notice 279 | and this permission notice appear in all copies. 280 | 281 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 282 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 283 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 284 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 285 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 286 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 287 | THIS SOFTWARE. 288 | 289 | =========================================================================== 290 | 291 | Mapbox Base uses portions of geojson-vt-cpp 292 | 293 | ISC License 294 | 295 | Copyright (c) 2015, Mapbox 296 | 297 | Permission to use, copy, modify, and/or distribute this software for any purpose 298 | with or without fee is hereby granted, provided that the above copyright notice 299 | and this permission notice appear in all copies. 300 | 301 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 302 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 303 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 304 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 305 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 306 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 307 | THIS SOFTWARE. 308 | 309 | =========================================================================== 310 | 311 | Mapbox Base uses portions of geojson.hpp 312 | 313 | Copyright (c) 2016, Mapbox 314 | 315 | Permission to use, copy, modify, and/or distribute this software for any 316 | purpose with or without fee is hereby granted, provided that the above 317 | copyright notice and this permission notice appear in all copies. 318 | 319 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 320 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 321 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 322 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 323 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 324 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 325 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 326 | 327 | =========================================================================== 328 | 329 | Mapbox Base uses portions of jni.hpp 330 | 331 | Copyright © 2016, Mapbox 332 | 333 | Permission to use, copy, modify, and/or distribute this software for any 334 | purpose with or without fee is hereby granted, provided that the above 335 | copyright notice and this permission notice appear in all copies. 336 | 337 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 338 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 339 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 340 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 341 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 342 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 343 | PERFORMANCE OF THIS SOFTWARE. 344 | 345 | 346 | The above license excludes the files test/android/jni.h and test/openjdk/jni.h, which are 347 | included for testing purposes and covered by their respective copyrights and licenses. 348 | 349 | =========================================================================== 350 | 351 | Mapbox Base uses portions of shelf-pack-cpp 352 | 353 | ISC License 354 | 355 | Copyright (c) 2017, Mapbox 356 | 357 | Permission to use, copy, modify, and/or distribute this software for any purpose 358 | with or without fee is hereby granted, provided that the above copyright notice 359 | and this permission notice appear in all copies. 360 | 361 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 362 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 363 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 364 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 365 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 366 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 367 | THIS SOFTWARE. 368 | 369 | =========================================================================== 370 | 371 | Mapbox Base uses portions of supercluster.hpp 372 | 373 | Copyright (c) 2016, Mapbox 374 | 375 | Permission to use, copy, modify, and/or distribute this software for any 376 | purpose with or without fee is hereby granted, provided that the above 377 | copyright notice and this permission notice appear in all copies. 378 | 379 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 380 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 381 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 382 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 383 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 384 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 385 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 386 | 387 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mapbox-base 2 | Mapbox Base C++ Libraries 3 | 4 | A collection of common static and header-only C++ libraries used among our native SDKs. 5 | -------------------------------------------------------------------------------- /deps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(mapbox_base_add_library name include_path) 2 | if(TARGET mapbox-base-${name}) 3 | return() 4 | endif() 5 | 6 | add_library(mapbox-base-${name} INTERFACE) 7 | add_library(Mapbox::Base::${name} ALIAS mapbox-base-${name}) 8 | 9 | target_include_directories(mapbox-base-${name} SYSTEM INTERFACE 10 | ${include_path} 11 | ) 12 | 13 | target_link_libraries(mapbox-base INTERFACE mapbox-base-${name}) 14 | endfunction() 15 | 16 | execute_process( 17 | COMMAND git submodule update --init . 18 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/deps 19 | ) 20 | 21 | mapbox_base_add_library(geojson-vt-cpp ${PROJECT_SOURCE_DIR}/deps/geojson-vt-cpp/include) 22 | mapbox_base_add_library(geojson.hpp ${PROJECT_SOURCE_DIR}/deps/geojson.hpp/include) 23 | mapbox_base_add_library(geometry.hpp ${PROJECT_SOURCE_DIR}/deps/geometry.hpp/include) 24 | mapbox_base_add_library(jni.hpp ${PROJECT_SOURCE_DIR}/deps/jni.hpp/include) 25 | mapbox_base_add_library(optional ${PROJECT_SOURCE_DIR}/deps/optional) 26 | mapbox_base_add_library(pixelmatch-cpp ${PROJECT_SOURCE_DIR}/deps/pixelmatch-cpp/include) 27 | mapbox_base_add_library(shelf-pack-cpp ${PROJECT_SOURCE_DIR}/deps/shelf-pack-cpp/include) 28 | mapbox_base_add_library(supercluster.hpp ${PROJECT_SOURCE_DIR}/deps/supercluster.hpp/include) 29 | mapbox_base_add_library(variant ${PROJECT_SOURCE_DIR}/deps/variant/include) 30 | mapbox_base_add_library(cheap-ruler-cpp ${PROJECT_SOURCE_DIR}/deps/cheap-ruler-cpp/include) 31 | -------------------------------------------------------------------------------- /docs/value.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # mapbox::base values 4 | 5 | *Value* offers a fast, flexible and uncomplicated way to build easy-to-use APIs where strong types are not required. 6 | 7 | A mapbox::base::Value holds a value of a type. Supported types are `int`, `uint`, `bool`, `double`, `array`, `object` and `string`. The type and the value of a mapbox::base::Value [can change](#Type). 8 | 9 | Values are used widely in Mapbox libraries, for instance when working with geometries or data in JSON format. They can be nested to create complex structures. 10 | 11 | - [mapbox::base::Value](#Value) 12 | - [mapbox::base::ValueArray](#ValueArray) 13 | - [mapbox::base::ValueObject](#ValueObject) 14 | - [Introspect Values](#Introspect-Values) 15 | - [Example](#A-real-world-example) 16 | 17 | ## Value 18 | 19 | ```C++ 20 | mapbox::base::Value num(-20); 21 | mapbox::base::Value pi(3.14159265359); 22 | mapbox::base::Value name("John Smith"); 23 | mapbox::base::Value codingIsFun(true); 24 | ``` 25 | 26 | ### get 27 | 28 | Use `get()` to get a copy. 29 | 30 | ```C++ 31 | double value = pi.get(); 32 | ``` 33 | 34 | It throws an exception if the type doesn't match the current type. 35 | 36 | ```C++ 37 | double value; 38 | try { 39 | value = pi.get(); 40 | } catch (const std::exception& e) { 41 | std::cout << "Error: " << e.what() << std::endl; 42 | } 43 | std::cout << value << std::endl; 44 | ``` 45 | 46 | If you don't want exceptions, use `get_unchecked()`: 47 | 48 | ```C++ 49 | pi.get_unchecked(); 50 | ``` 51 | 58 | 59 | Get a pointer: 60 | ```C++ 61 | double* value = pi.getDouble(); 62 | std::cout << *value << std::endl; 63 | ``` 64 | 65 | outputs 3.14159265359 66 | 67 | ### set, update 68 | 69 | ```C++ 70 | pi = 0.456; 71 | pi.set(0.123); 72 | 73 | std::cout << *pi.getDouble() << std::endl; 74 | ``` 75 | 76 | outputs 0.123 77 | 78 | ### Type 79 | 80 | Assigning a value of an allowed type changes the type of the [mapbox::base::Value](#Value). 81 | 82 | You can use `which()` to get the type index. 83 | 84 | ```C++ 85 | mapbox::base::Value val; 86 | 87 | val = "a string"; 88 | std::cout << val.which() << std::endl; 89 | 90 | val = 0.5; 91 | std::cout << val.which() << std::endl; 92 | ``` 93 | 94 | output: 95 | ``` 96 | 5 97 | 4 98 | ``` 99 | 100 | To ask for a specific type, use `is()`: 101 | 102 | ```C++ 103 | std::cout << "is double: " << val.is() << ", is string: " << val.is() << std::endl; 104 | ``` 105 | 106 | ``` 107 | is double: 1, is string: 0 108 | ``` 109 | 110 | Use `valid()` to see if the type index is within the allowed range. 111 | 112 | ## ValueArray 113 | 114 | The ValueArray can hold an arbitrary number of [values](#Value) and is based on a [std::vector](https://en.cppreference.com/w/cpp/container/vector). You can use all its methods to work with the array. 115 | 116 | ```C++ 117 | mapbox::base::ValueArray array = {num, pi, name, codingIsFun}; 118 | ``` 119 | 120 | or more programatically 121 | 122 | ```C++ 123 | array.push_back(num); 124 | array.push_back(pi); 125 | array.push_back(name); 126 | array.push_back(codingIsFun); 127 | ``` 128 | 129 | Our array is: [-20,3.14159265359,"John Smith",true] 130 | 131 | ### get an item 132 | 133 | ```C++ 134 | mapbox::base::Value myValue = array[1]; 135 | double piV = myValue.get(); 136 | 137 | std::cout << piV << std::endl;>> 138 | ``` 139 | 140 | ### and insert 141 | 142 | ```C++ 143 | auto it = array.begin() + 2; 144 | array.insert(it, "inserting a string"); 145 | ``` 146 | array is now [-20,3.14159265359,"inserting a string","John Smith",true] 147 | 148 | ### update an item 149 | 150 | ```C++ 151 | array[1].set(0.45); 152 | ``` 153 | array is now [-20,0.45,"inserting a string","John Smith",true]. Here we can also [change](#Type) the type and assign a value of a different type. 154 | 155 | ## ValueObject 156 | 157 | The ValueObject holds key-value pairs and can be used to model structures similar to json objects. 158 | It is based on an [std::unordered_map](https://de.cppreference.com/w/cpp/container/unordered_map). You can use their methods to work with ValueObject. 159 | 160 | ```C++ 161 | mapbox::base::ValueObject object; 162 | object.insert({"text-color", "yellow"}); 163 | ``` 164 | 165 | ### get an item: 166 | 167 | ```C++ 168 | mapbox::base::Value v = object["text-color"]; 169 | 170 | std::string color = *object["text-color"].getString(); 171 | std::cout << color << std::endl; 172 | ``` 173 | 174 | outputs yellow; 175 | 176 | ### update the value of an item: 177 | 178 | ```C++ 179 | object["text-color"].set("green"); 180 | 181 | std::cout << object["text-color"].get() << std::endl; 182 | ``` 183 | 184 | outputs green. 185 | 186 | ## Introspect Values 187 | 188 | Lets assume you get a value from a component and want to peek inside to see whats 'in the box'. 189 | 190 | We don't know beforehand how deep the value is nested. Therefor we want to recursively visit the values, and we can use `match()` for the types: 191 | 192 | ```C++ 193 | std::function visit = [&](const mapbox::base::Value& value) { 194 | 195 | value.match([&](const mapbox::base::NullValue) {}, 196 | [&](const std::string& str) {}, 197 | [&](bool b) {}, 198 | [&](uint64_t u64) {}, 199 | [&](int64_t i64) {}, 200 | [&](double f64) {}, 201 | [&](const mapbox::base::ValueArray& array) { 202 | for (const auto& v : array) { 203 | visit(v); 204 | } 205 | }, 206 | [&](const mapbox::base::ValueObject& object) { 207 | for (const auto& kv : object) { 208 | visit(kv.second) 209 | } 210 | }); 211 | 212 | }; 213 | 214 | visit(value); 215 | ``` 216 | 217 | And now with a bit of extra code to output the value in a json-like fashion: 218 | 219 | ```C++ 220 | std::string toString(const mapbox::base::Value& value) { 221 | std::stringstream buffer; 222 | 223 | std::function visit = [&](const mapbox::base::Value& value, int depth) { 224 | std::string indent = ""; 225 | for(int i = 0; i < depth; ++i) { 226 | indent += " "; 227 | } 228 | 229 | value.match([&](const mapbox::base::NullValue) { buffer << indent << "nullptr"; }, 230 | [&](const std::string& str) { buffer << "\"" << str << "\""; }, 231 | [&](bool b) { buffer << b; }, 232 | [&](uint64_t u64) { buffer << indent << u64; }, 233 | [&](int64_t i64) { buffer << i64; }, 234 | [&](double f64) { buffer << f64; }, 235 | [&](const mapbox::base::ValueArray& array) { 236 | buffer << indent << "[" << std::endl; 237 | for (const auto& v : array) { 238 | buffer << indent << " "; 239 | visit(v, depth+1); 240 | buffer << "," << std::endl; 241 | } 242 | if (array.size() > 1) buffer.seekp(-2, std::ios_base::end); 243 | buffer << std::endl << indent << "]" << std::endl; 244 | }, 245 | [&](const mapbox::base::ValueObject& object) { 246 | buffer << indent << "{" << std::endl; 247 | for (const auto& kv : object) { 248 | buffer << indent << " " << kv.first << ": "; 249 | visit(kv.second, depth+1); 250 | buffer << "," << std::endl; 251 | } 252 | if (object.size() > 1) buffer.seekp(-2, std::ios_base::end); 253 | buffer << std::endl << indent << "}" << std::endl; 254 | }); 255 | }; 256 | 257 | visit(value, 0); 258 | 259 | return buffer.str(); 260 | } 261 | 262 | //! lets add our array to our object to create a nested structure: 263 | object.insert({"list", array}); 264 | 265 | std::cout << toString(object) << std::endl; 266 | ``` 267 | 268 | outputs 269 | 270 | ```JSON 271 | { 272 | text-color: "green", 273 | list: [ 274 | -20, 275 | 0.45, 276 | "inserting a string", 277 | "John Smith", 278 | 1 279 | ] 280 | } 281 | ``` 282 | 283 | ## A real world example 284 | 285 | Let's assume you want to create a line gradient to be used in Mapbox GL-Native. We can programatically construct the data structure as we would do it if the data comes from a backend data source: 286 | 287 | ```C++ 288 | using A = mapbox::base::ValueArray; 289 | 290 | A lineGradient = {"interpolate", A{"linear"}, A{"line-progress"}}; 291 | 292 | lineGradient.push_back(0); 293 | lineGradient.push_back("blue"); 294 | 295 | lineGradient.push_back(0.1); 296 | lineGradient.push_back("royalblue"); 297 | 298 | lineGradient.push_back(0.3); 299 | lineGradient.push_back("cyan"); 300 | 301 | lineGradient.push_back(0.5); 302 | lineGradient.push_back("lime"); 303 | 304 | lineGradient.push_back(0.7); 305 | lineGradient.push_back("yellow"); 306 | 307 | lineGradient.push_back(1); 308 | lineGradient.push_back("red"); 309 | 310 | //! which we can now give to the map: 311 | map->setStyleLayerProperty("my-line", "line-gradient", lineGradient); 312 | 313 | std::cout << toString(lineGradient) << std::endl; 314 | ``` 315 | 316 | results in: 317 | 318 | ```JSON 319 | [ 320 | "interpolate", 321 | ["linear"], 322 | ["line-progress"], 323 | 0, 324 | "blue", 325 | 0.1, 326 | "royalblue", 327 | 0.3, 328 | "cyan", 329 | 0.5, 330 | "lime", 331 | 0.7, 332 | "yellow", 333 | 1, 334 | "red" 335 | ] 336 | ``` 337 | 338 | See https://docs.mapbox.com/mapbox-gl-js/example/line-gradient/ to learn more about line gradients in Mapbox SDKs. -------------------------------------------------------------------------------- /extras/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(TARGET mapbox-base-extras) 2 | return() 3 | endif() 4 | 5 | function(mapbox_base_extras_add_library name include_path) 6 | if(TARGET mapbox-base-extras-${name}) 7 | return() 8 | endif() 9 | 10 | add_library(mapbox-base-extras-${name} INTERFACE) 11 | add_library(Mapbox::Base::Extras::${name} ALIAS mapbox-base-extras-${name}) 12 | 13 | target_include_directories(mapbox-base-extras-${name} SYSTEM INTERFACE 14 | ${include_path} 15 | ) 16 | 17 | target_link_libraries(mapbox-base-extras INTERFACE mapbox-base-extras-${name}) 18 | endfunction() 19 | 20 | add_library(mapbox-base-extras INTERFACE) 21 | add_library(Mapbox::Base::Extras ALIAS mapbox-base-extras) 22 | 23 | execute_process( 24 | COMMAND git submodule update --init . 25 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/extras 26 | ) 27 | 28 | mapbox_base_extras_add_library(args ${PROJECT_SOURCE_DIR}/extras/args) 29 | mapbox_base_extras_add_library(expected-lite ${PROJECT_SOURCE_DIR}/extras/expected-lite/include) 30 | mapbox_base_extras_add_library(filesystem ${PROJECT_SOURCE_DIR}/extras/filesystem/include) 31 | mapbox_base_extras_add_library(kdbush.hpp ${PROJECT_SOURCE_DIR}/extras/kdbush.hpp/include) 32 | 33 | include(${PROJECT_SOURCE_DIR}/extras/rapidjson.cmake) 34 | -------------------------------------------------------------------------------- /extras/googletest.cmake: -------------------------------------------------------------------------------- 1 | add_library(gtest_all STATIC 2 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/src/gtest_main.cc 3 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/src/gtest-all.cc 4 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/src/gmock-all.cc 5 | ) 6 | 7 | target_include_directories(gtest_all PRIVATE 8 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest 9 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include 10 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock 11 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include 12 | ) 13 | 14 | target_include_directories(gtest_all SYSTEM INTERFACE 15 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googletest/include 16 | ${CMAKE_CURRENT_LIST_DIR}/googletest/googlemock/include 17 | ) 18 | -------------------------------------------------------------------------------- /extras/rapidjson.cmake: -------------------------------------------------------------------------------- 1 | mapbox_base_extras_add_library(rapidjson ${CMAKE_CURRENT_LIST_DIR}/rapidjson/include) 2 | 3 | target_compile_definitions(mapbox-base-extras-rapidjson INTERFACE 4 | RAPIDJSON_HAS_STDSTRING=1 5 | ) 6 | 7 | if(WIN32) 8 | target_compile_definitions(mapbox-base-extras-rapidjson INTERFACE 9 | RAPIDJSON_HAS_CXX11_RVALUE_REFS 10 | ) 11 | endif() 12 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(mapbox-base INTERFACE) 2 | add_library(Mapbox::Base ALIAS mapbox-base) 3 | 4 | target_include_directories(mapbox-base SYSTEM INTERFACE 5 | "${PROJECT_SOURCE_DIR}/include" 6 | "${PROJECT_SOURCE_DIR}/include/mapbox/polyfills" 7 | ) 8 | 9 | target_link_libraries(mapbox-base INTERFACE 10 | Mapbox::Base::Extras::expected-lite 11 | ) 12 | -------------------------------------------------------------------------------- /include/mapbox/compatibility/value.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace mapbox { 6 | namespace base { 7 | 8 | using Value = feature::value; 9 | using ValueArray = Value::array_type; 10 | using ValueObject = Value::object_type; 11 | using NullValue = feature::null_value_t; 12 | 13 | } // namespace base 14 | } // namespace mapbox 15 | -------------------------------------------------------------------------------- /include/mapbox/io/io.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "mapbox/util/expected.hpp" 8 | 9 | namespace mapbox { 10 | namespace base { 11 | namespace io { 12 | 13 | using ErrorType = std::string; 14 | 15 | inline expected readFile(const std::string& filename) { 16 | std::ifstream file(filename, std::ios::binary); 17 | if (!file.good()) { 18 | return make_unexpected(std::string("Failed to read file '") + filename + std::string("'")); 19 | } 20 | 21 | std::stringstream data; 22 | data << file.rdbuf(); 23 | return expected(data.str()); 24 | } 25 | 26 | inline expected writeFile(const std::string& filename, const std::string& data) { 27 | std::ofstream file(filename, std::ios::binary); 28 | if (!file.good()) { 29 | return make_unexpected(std::string("Failed to write file '") + filename + std::string("'")); 30 | } 31 | 32 | file << data; 33 | 34 | return expected(); 35 | } 36 | 37 | inline expected deleteFile(const std::string& filename) { 38 | const int ret = std::remove(filename.c_str()); 39 | if (ret != 0) { 40 | return make_unexpected(std::string("Failed to delete file '") + filename + std::string("'")); 41 | } 42 | 43 | return expected(); 44 | } 45 | 46 | inline expected copyFile(const std::string& sourcePath, const std::string& destinationPath) { 47 | auto contents = readFile(sourcePath); 48 | if (!contents) { 49 | return nonstd::make_unexpected(contents.error()); 50 | } 51 | 52 | return writeFile(destinationPath, *contents); 53 | } 54 | 55 | } // namespace io 56 | } // namespace base 57 | } // namespace mapbox 58 | -------------------------------------------------------------------------------- /include/mapbox/platform.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Determine compiler 4 | #define MB_COMPILER 0 5 | #define MB_COMPILER_GNU 1 6 | #define MB_COMPILER_CLANG 2 7 | #define MB_COMPILER_MSVC 3 8 | 9 | #if defined(__clang__) 10 | # define MB_COMPILER MB_COMPILER_CLANG 11 | #elif defined(__GNUC__) || defined(__GNUG__) // after clang, possible it also has the same defines (need to research) 12 | # define MB_COMPILER MB_COMPILER_GNU 13 | #elif defined(_MSC_VER) 14 | # define MB_COMPILER MB_COMPILER_MSVC 15 | #else 16 | # error "Unsupported compiler" 17 | #endif 18 | 19 | // Determine platform 20 | #define MB_PLATFORM 0 21 | #define MB_PLATFORM_WIN32 1 22 | #define MB_PLATFORM_LINUX 2 23 | #define MB_PLATFORM_MAC 3 24 | #define MB_PLATFORM_IOS_EMBEDDED 4 25 | #define MB_PLATFORM_IOS_SIMULATOR 5 26 | #define MB_PLATFORM_ANDROID 6 27 | #define MB_PLATFORM_QNX_NEUTRINO 7 28 | #define MB_PLATFORM_QNX_4 8 29 | 30 | #if (defined(__WIN32__) || defined(_WIN32)) && !defined(__ANDROID__) 31 | # define MB_PLATFORM MB_PLATFORM_WIN32 32 | #elif defined(__APPLE_CC__) 33 | # include "TargetConditionals.h" 34 | # if TARGET_OS_IOS && TARGET_OS_EMBEDDED 35 | # define MB_PLATFORM MB_PLATFORM_IOS_EMBEDDED 36 | # elif TARGET_OS_IOS && TARGET_OS_SIMULATOR 37 | # define MB_PLATFORM MB_PLATFORM_IOS_SIMULATOR 38 | # else 39 | # define MB_PLATFORM MB_PLATFORM_MAC 40 | # endif 41 | #elif defined(__ANDROID__) 42 | # define MB_PLATFORM MB_PLATFORM_ANDROID 43 | #elif defined(__QNX__) 44 | # if defined(__QNXNTO__) 45 | # define MB_PLATFORM MB_PLATFORM_QNX_NEUTRINO 46 | # else 47 | # define MB_PLATFORM MB_PLATFORM_QNX_4 48 | # endif 49 | #else // let all other platform right now is a linux platforms 50 | # define MB_PLATFORM MB_PLATFORM_LINUX 51 | #endif 52 | 53 | #define MB_PLATFORM_IS_WIN32 (MB_PLATFORM == MB_PLATFORM_WIN32) 54 | #define MB_PLATFORM_IS_LINUX (MB_PLATFORM == MB_PLATFORM_LINUX) 55 | #define MB_PLATFORM_IS_MAC (MB_PLATFORM == MB_PLATFORM_MAC) 56 | #define MB_PLATFORM_IS_IOS_EMBEDDED (MB_PLATFORM == MB_PLATFORM_IOS_EMBEDDED) 57 | #define MB_PLATFORM_IS_IOS_SIMULATOR (MB_PLATFORM == MB_PLATFORM_IOS_SIMULATOR) 58 | #define MB_PLATFORM_IS_IOS (MB_PLATFORM_IS_IOS_EMBEDDED || MB_PLATFORM_IS_IOS_SIMULATOR) 59 | #define MB_PLATFORM_IS_ANDROID (MB_PLATFORM == MB_PLATFORM_ANDROID) 60 | #define MB_PLATFORM_IS_QNX_NEUTRINO (MB_PLATFORM == MB_PLATFORM_QNX_NEUTRINO) 61 | #define MB_PLATFORM_IS_QNX_4 (MB_PLATFORM == MB_PLATFORM_QNX_4) 62 | #define MB_PLATFORM_IS_QNX (MB_PLATFORM_IS_QNX_NEUTRINO || MB_PLATFORM_IS_QNX_4) 63 | 64 | #define MB_PLATFORM_IS_DESKTOP (MB_PLATFORM_IS_LINUX || MB_PLATFORM_IS_MAC || MB_PLATFORM_IS_WIN32) 65 | 66 | #ifdef NDEBUG 67 | # define MB_IS_DEBUG 0 68 | #else 69 | # define MB_IS_DEBUG 1 70 | #endif 71 | -------------------------------------------------------------------------------- /include/mapbox/polyfills/mbx/expected.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace mbx { 6 | 7 | template 8 | using expected = nonstd::expected; 9 | 10 | template 11 | auto make_unexpected(E&& value) { 12 | return nonstd::make_unexpected(std::forward(value)); 13 | } 14 | 15 | } // namespace mbx 16 | -------------------------------------------------------------------------------- /include/mapbox/std/weak.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace mapbox { 13 | namespace base { 14 | 15 | /// @cond internal 16 | namespace internal { 17 | 18 | class WeakPtrSharedData { 19 | public: 20 | WeakPtrSharedData() = default; 21 | 22 | void sharedLock() { 23 | std::size_t noLocks = sharedLocks_; 24 | std::size_t incremented; 25 | do { 26 | if (noLocks == kInvalidValue) return; 27 | incremented = noLocks + 1; 28 | // `compare_exchange_weak()` is invoked in a cycle to handle the case, 29 | // if another thread has just modified `sharedLocks_` (so that it is not 30 | // equal to `noLocks` any more). We early return, if `sharedLocks_` became 31 | // equal to `kInvalidValue`. 32 | } while (!sharedLocks_.compare_exchange_weak(noLocks, incremented)); 33 | } 34 | 35 | void sharedUnlock() { 36 | std::size_t noLocks = sharedLocks_; 37 | std::size_t decremented; 38 | do { 39 | if (noLocks == kInvalidValue) return; 40 | assert(noLocks > 0u); 41 | decremented = noLocks - 1; 42 | } while (!sharedLocks_.compare_exchange_weak(noLocks, decremented)); 43 | } 44 | 45 | void invalidate() { 46 | assert(valid()); 47 | std::size_t noLocks = 0u; 48 | while (!sharedLocks_.compare_exchange_weak(noLocks, kInvalidValue)) { 49 | assert(noLocks != kInvalidValue); 50 | noLocks = 0u; 51 | } 52 | assert(!valid()); 53 | } 54 | 55 | bool valid() const { return sharedLocks_ != kInvalidValue; } 56 | 57 | private: 58 | static constexpr size_t kInvalidValue = std::numeric_limits::max(); 59 | std::atomic_size_t sharedLocks_{0u}; 60 | }; 61 | 62 | using StrongRef = std::shared_ptr; 63 | using WeakRef = std::weak_ptr; 64 | 65 | template 66 | class WeakPtrBase; 67 | 68 | } // namespace internal 69 | /// @endcond 70 | 71 | /** 72 | * @brief Scope guard for the WeakPtr-wrapped object 73 | * 74 | * The WeakPtr-wrapped object is guaranteed not to be deleted while 75 | * a WeakPtrGuard instance is present in the scope. 76 | */ 77 | class WeakPtrGuard { 78 | public: 79 | /** 80 | * @brief Default move constructor 81 | */ 82 | WeakPtrGuard(WeakPtrGuard&&) noexcept = default; 83 | ~WeakPtrGuard() { 84 | if (strong_) { 85 | strong_->sharedUnlock(); 86 | } 87 | } 88 | 89 | private: 90 | explicit WeakPtrGuard(internal::StrongRef strong) : strong_(std::move(strong)) { 91 | assert(!strong_ || strong_->valid()); 92 | } 93 | internal::StrongRef strong_; 94 | 95 | template 96 | friend class internal::WeakPtrBase; 97 | }; 98 | 99 | namespace internal { 100 | 101 | /** 102 | * @brief Base type for \c WeakPtr class. 103 | * 104 | * Contains the generic API for weak pointer classes. 105 | * 106 | * This class helps to create a \c WeakPtr template specialization for a 107 | * certain type, enabling the type-specific semantics. 108 | * 109 | * \sa WeakPtr 110 | * 111 | * @tparam T the managed object type 112 | */ 113 | template 114 | class WeakPtrBase { 115 | public: 116 | /** 117 | * Gets a lock that protects the managed object, giving 118 | * the guarantee that it will not be deleted (if not 119 | * deleted yet). 120 | * 121 | * Note that it won't make the managed object thread-safe, but 122 | * rather make sure it exists (or not) when the lock 123 | * is being held. 124 | * 125 | * Note: there *MUST* be only one instance of the 126 | * guard referring to the same \a WeakPtrFactory 127 | * available in the scope at a time. 128 | */ 129 | WeakPtrGuard lock() const { 130 | if (StrongRef strong = weak_.lock()) { 131 | strong->sharedLock(); 132 | if (strong->valid()) { 133 | return WeakPtrGuard(std::move(strong)); 134 | } 135 | strong->sharedUnlock(); 136 | } 137 | return WeakPtrGuard(nullptr); 138 | } 139 | 140 | /** 141 | * @brief Quick nonblocking check that the managed object still exists. 142 | * 143 | * Checks if the weak pointer is still pointing to a valid 144 | * object. Note that if the WeakPtrFactory lives in a different 145 | * thread, a `false` result cannot be guaranteed to be 146 | * correct since there is an implicit race condition, 147 | * but a `true` result is always correct. 148 | * 149 | * @return given the thread restrictions, true if expired, 150 | * false otherwise. 151 | */ 152 | bool expired() const { 153 | if (StrongRef strong = weak_.lock()) { 154 | return !strong->valid(); 155 | } 156 | return true; 157 | } 158 | 159 | /** 160 | * @brief Quick nonblocking check that the managed object still exists. 161 | * 162 | * \sa expired() 163 | * 164 | * @return given the thread restrictions, true if the object exists, 165 | * false otherwise. 166 | */ 167 | explicit operator bool() const { return !expired(); } 168 | 169 | /** 170 | * Get a raw pointer to the managed object. 171 | * 172 | * In multi-threaded environment, the caller *MUST* call 173 | * lock() and keep locker, before using it. 174 | * 175 | * Usage should be as brief as possible, because it might 176 | * potentially block the thread where the managed object lives. 177 | * 178 | * @return pointer to the object, nullptr if expired. 179 | */ 180 | T* get() const { 181 | if (StrongRef strong = weak_.lock()) { 182 | if (strong->valid()) { 183 | return ptr_; 184 | } 185 | } 186 | return nullptr; 187 | } 188 | 189 | protected: 190 | /// @cond internal 191 | WeakPtrBase() = default; 192 | WeakPtrBase(WeakPtrBase&&) noexcept = default; 193 | WeakPtrBase(const WeakPtrBase&) noexcept = default; 194 | template // NOLINTNEXTLINE 195 | WeakPtrBase(WeakPtrBase&& other) noexcept : weak_(std::move(other.weak_)), ptr_(static_cast(other.ptr_)) {} 196 | explicit WeakPtrBase(WeakRef weak, T* ptr) : weak_(std::move(weak)), ptr_(ptr) { assert(ptr_); } 197 | WeakPtrBase& operator=(WeakPtrBase&& other) noexcept = default; 198 | WeakPtrBase& operator=(const WeakPtrBase& other) = default; 199 | 200 | ~WeakPtrBase() = default; 201 | 202 | private: 203 | WeakRef weak_; 204 | T* ptr_{}; 205 | template 206 | friend class WeakPtrBase; 207 | /// @endcond 208 | }; 209 | 210 | } // namespace internal 211 | 212 | /** 213 | * @brief Default implementation of a weak pointer to an object. 214 | * 215 | * Weak pointers are safe to access even if the 216 | * pointer outlives the object, which this class wraps. 217 | * 218 | * This class will manage only object lifetime 219 | * but will not deal with thread-safeness of the 220 | * objects it is wrapping. 221 | */ 222 | template 223 | class WeakPtr final : public internal::WeakPtrBase { 224 | public: 225 | /** 226 | * @brief Default constructor. 227 | * 228 | * Constructs empty \c WeakPtr. 229 | */ 230 | WeakPtr() = default; 231 | 232 | /** 233 | * @brief Converting move constructor 234 | * 235 | * \a other becomes empty after the call. 236 | * 237 | * @tparam U a type, which \c T is convertible to 238 | * @param other \c WeakPtr instance 239 | */ 240 | template // NOLINTNEXTLINE 241 | WeakPtr(WeakPtr&& other) noexcept : internal::WeakPtrBase(std::move(other)) {} 242 | 243 | /** 244 | * @brief Default move constructor. 245 | */ 246 | WeakPtr(WeakPtr&&) noexcept = default; 247 | 248 | /** 249 | * @brief Default copy constructor. 250 | */ 251 | WeakPtr(const WeakPtr&) noexcept = default; 252 | 253 | /** 254 | * @brief Replaces the managed object with the one managed by \a other. 255 | * 256 | * \a other becomes empty after the call. 257 | * 258 | * @param other 259 | * @return WeakPtr& \c *this 260 | */ 261 | WeakPtr& operator=(WeakPtr&& other) noexcept = default; 262 | 263 | /** 264 | * @brief Replaces the managed object with the one managed by \a other. 265 | * 266 | * @param other 267 | * @return WeakPtr& \c *this 268 | */ 269 | WeakPtr& operator=(const WeakPtr& other) = default; 270 | 271 | /** 272 | * @brief Dereferences the stored pointer. 273 | * 274 | * Must not be called on empty \c WeakPtr. 275 | * 276 | * @return T* the stored pointer. 277 | */ 278 | T* operator->() const { 279 | T* ptr = this->get(); 280 | assert(ptr); 281 | return ptr; 282 | } 283 | 284 | private: 285 | explicit WeakPtr(internal::WeakRef weak, T* object) : internal::WeakPtrBase(std::move(weak), object) {} 286 | 287 | template 288 | friend class WeakPtrFactory; 289 | }; 290 | 291 | /** 292 | * @brief T wrapper that can create weak pointers. 293 | * 294 | * WARNING: the WeakPtrFactory should all be at the bottom of 295 | * the list of member of the class, making it the first to 296 | * be destroyed and the last to be initialized. 297 | */ 298 | template 299 | class WeakPtrFactory final { 300 | public: 301 | WeakPtrFactory(const WeakPtrFactory&) = delete; 302 | WeakPtrFactory& operator=(const WeakPtrFactory&) = delete; 303 | 304 | /** 305 | * @brief Construct a new \c WeakPtrFactory object. 306 | * 307 | * @param obj an \c T instance to wrap. 308 | */ 309 | explicit WeakPtrFactory(T* obj) : strong_(std::make_shared()), obj_(obj) {} 310 | 311 | /** 312 | * Destroys the factory, invalidating all the 313 | * weak pointers to this object, i.e. makes them empty. 314 | */ 315 | ~WeakPtrFactory() { invalidateWeakPtrs(); } 316 | 317 | /** 318 | * Make a weak pointer for this WeakPtrFactory. Weak pointer 319 | * can be used for safely accessing the T object and not worry 320 | * about lifetime. 321 | * 322 | * @return a weak pointer. 323 | */ 324 | WeakPtr makeWeakPtr() { return WeakPtr{strong_, obj_}; } 325 | 326 | /** 327 | * @brief Makes a weak wrapper for calling a method on the wrapped 328 | * \c T instance. 329 | * 330 | * While the wrapped \c T instance exists, calling the returned wrapper is 331 | * equivalent to invoking \a method on the instance. Note that the instance deletion 332 | * is blocked during the wrapper call. 333 | * 334 | * If the wrapped \c T instance does not exist, calling the returned wrapper 335 | * is ignored. 336 | * 337 | * The example below illustrates creating an \c std::function instance from the 338 | * returned wrapper. 339 | * 340 | * \code 341 | * class T { 342 | * void foo(int); 343 | * std::function makeWeakFoo() { 344 | * return weakFactory.makeWeakMethod(&T::foo); 345 | * } 346 | * mapbox::base::WeakPtrFactory weakFactory{this}; 347 | * }; 348 | * \endcode 349 | * 350 | * @param method Pointer to an \c T class method. 351 | * @return auto Callable object 352 | */ 353 | template 354 | auto makeWeakMethod(Method method) { 355 | return [weakPtr = makeWeakPtr(), method](auto&&... params) mutable { 356 | WeakPtrGuard guard = weakPtr.lock(); 357 | if (T* obj = weakPtr.get()) { 358 | (obj->*method)(std::forward(params)...); 359 | } 360 | }; 361 | } 362 | 363 | /** 364 | * @brief Invalidates all existing weak pointers. 365 | * 366 | * This method is particularly useful, when \c T class has a user-defined destructor, 367 | * that makes the wrapped instance invalid even before entering the \c WeakPtrFactory 368 | * destructor. 369 | * In this case, clients *MUST* explicitly call \c invalidateWeakPtrs() before freeing any resources. 370 | * 371 | * Note: After \c invalidateWeakPtrs() is called, \c makeWeakPtr() returns empty weak pointers. 372 | */ 373 | void invalidateWeakPtrs() { 374 | if (strong_) strong_->invalidate(); 375 | strong_.reset(); 376 | } 377 | 378 | private: 379 | internal::StrongRef strong_; 380 | T* obj_; 381 | }; 382 | 383 | } // namespace base 384 | } // namespace mapbox 385 | -------------------------------------------------------------------------------- /include/mapbox/util/expected.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace mapbox { 6 | namespace base { 7 | 8 | template 9 | using expected = nonstd::expected; 10 | 11 | template 12 | auto make_unexpected(E&& value) { 13 | return nonstd::make_unexpected(std::move(value)); 14 | } 15 | 16 | } // namespace base 17 | } // namespace mapbox 18 | -------------------------------------------------------------------------------- /include/mapbox/util/type_wrapper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace mapbox { 8 | namespace base { 9 | 10 | class TypeWrapper { 11 | public: 12 | TypeWrapper() noexcept : storage_(nullptr, noop_deleter) {} 13 | TypeWrapper(TypeWrapper&&) noexcept = default; 14 | TypeWrapper& operator=(TypeWrapper&&) noexcept = default; 15 | 16 | template // NOLINTNEXTLINE misc-forwarding-reference-overload 17 | TypeWrapper(T&& value) noexcept 18 | : storage_(new std::decay_t(std::forward(value)), cast_deleter>) { 19 | static_assert(!std::is_same>::value, "TypeWrapper must not wrap itself."); 20 | } 21 | 22 | bool has_value() const noexcept { return static_cast(storage_); } 23 | 24 | template 25 | T& get() noexcept { // NOLINTNEXTLINE cppcoreguidelines-pro-type-reinterpret-cast 26 | return *reinterpret_cast(storage_.get()); 27 | } 28 | 29 | private: 30 | template 31 | static void cast_deleter(void* ptr) noexcept { 32 | delete reinterpret_cast(ptr); // NOLINT cppcoreguidelines-pro-type-reinterpret-cast 33 | } 34 | static void noop_deleter(void*) noexcept {} 35 | 36 | using storage_t = std::unique_ptr; 37 | storage_t storage_; 38 | }; 39 | 40 | } // namespace base 41 | } // namespace mapbox 42 | -------------------------------------------------------------------------------- /license-lock: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "extras/googletest", 4 | "licenseFile": "LICENSE", 5 | "hash": "9702de7e4117a8e2b20dafab11ffda58c198aede066406496bef670d40a22138", 6 | "action": "file" 7 | }, 8 | { 9 | "path": "extras/kdbush.hpp", 10 | "licenseFile": "LICENSE", 11 | "hash": "eeb9c9d04d930512cec46a5d7c08f418af9fbc50ebf481f09fcebcdf3fbb941c", 12 | "action": "file" 13 | }, 14 | { 15 | "path": "extras/args", 16 | "licenseFile": "LICENSE", 17 | "hash": "e0c9f11d6dfec641f099a0a153358b8b9954a86a61c64c89db3a75d5d282852a", 18 | "action": "file" 19 | }, 20 | { 21 | "path": "extras/expected-lite", 22 | "licenseFile": "LICENSE.txt", 23 | "hash": "c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566", 24 | "action": "file" 25 | }, 26 | { 27 | "path": "extras/filesystem", 28 | "licenseFile": "LICENSE", 29 | "hash": "1b265537c97cfb422ffb52492c96979943f54fab8746a6dd38d8329953d487cc", 30 | "action": "file" 31 | }, 32 | { 33 | "path": "deps/geometry.hpp", 34 | "licenseFile": "LICENSE", 35 | "hash": "44b7f71c4d7f3da85e5e6a5d0cfa6942055d326a24f4d60a3728ebed26ea2b9d", 36 | "action": "file" 37 | }, 38 | { 39 | "path": "deps/optional", 40 | "licenseFile": "LICENSE", 41 | "hash": "c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566", 42 | "action": "file" 43 | }, 44 | { 45 | "path": "deps/pixelmatch-cpp", 46 | "licenseFile": "LICENSE.txt", 47 | "hash": "6c7e3e75cd5368e6a552a2e94db1a50080c0b2972d1d2364144227b047a6e18c", 48 | "action": "file" 49 | }, 50 | { 51 | "path": "extras/rapidjson", 52 | "licenseFile": "license.txt", 53 | "hash": "a140e5d46fe734a1c78f1a3c3ef207871dd75648be71fdda8e309b23ab8b1f32", 54 | "action": "file" 55 | }, 56 | { 57 | "path": "deps/variant", 58 | "licenseFile": "LICENSE", 59 | "hash": "7686f81e580cd6774f609a2d8a41b2cebdf79bc30e6b46c3efff5a656158981c", 60 | "action": "file" 61 | }, 62 | { 63 | "path": "deps/cheap-ruler-cpp", 64 | "licenseFile": "LICENSE", 65 | "hash": "27043d1a6a0e1985fde12660decbbd3b23c67de900b00609c90d4f0aa492f425", 66 | "action": "file" 67 | }, 68 | { 69 | "path": "deps/geojson-vt-cpp", 70 | "licenseFile": "LICENSE", 71 | "hash": "828f2aed51b6526881a236758ec9b08cd69928fbfc70346d9d44a0b3a3444fe1", 72 | "action": "file" 73 | }, 74 | { 75 | "path": "deps/geojson.hpp", 76 | "licenseFile": "LICENSE", 77 | "hash": "e2bf3affd357261f7451bb19108281c1bde54746bfa2beb0c1c34ab042b21700", 78 | "action": "file" 79 | }, 80 | { 81 | "path": "deps/jni.hpp", 82 | "licenseFile": "LICENSE.txt", 83 | "hash": "640f62b4b6e940645b96d12416e6db84ed191ebcfd10c3a0ccc9a1338f222726", 84 | "action": "file" 85 | }, 86 | { 87 | "path": "deps/shelf-pack-cpp", 88 | "licenseFile": "LICENSE.md", 89 | "hash": "27043d1a6a0e1985fde12660decbbd3b23c67de900b00609c90d4f0aa492f425", 90 | "action": "file" 91 | }, 92 | { 93 | "path": "deps/supercluster.hpp", 94 | "licenseFile": "LICENSE", 95 | "hash": "e2bf3affd357261f7451bb19108281c1bde54746bfa2beb0c1c34ab042b21700", 96 | "action": "file" 97 | } 98 | ] 99 | -------------------------------------------------------------------------------- /scripts/check-license.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | ROOT_PATH=$PWD 6 | LICENSE_CHECKER_PATH=$PWD/scripts/license-checker 7 | 8 | cd $LICENSE_CHECKER_PATH 9 | npm ci 10 | ./license-checker generate $ROOT_PATH > $ROOT_PATH/license-lock && git diff --exit-code 11 | ./license-checker license "Mapbox Base" $ROOT_PATH > $ROOT_PATH/LICENSE.thirdparty && git diff --exit-code 12 | -------------------------------------------------------------------------------- /scripts/ci/install-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | mkdir build && pushd build 6 | export CC=${CCOMPILER} CXX=${CXXCOMPILER} 7 | cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_TESTING=ON 8 | echo "travis_fold:start:MAKE" 9 | make --jobs=${JOBS} 10 | echo "travis_fold:end:MAKE" 11 | ccache -s 12 | popd 13 | -------------------------------------------------------------------------------- /scripts/ci/run-syntax-check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | clang-format -i $(git ls-files *.hpp *.cpp |xargs -L1 -i find {} -type f -maxdepth 0) && git diff --exit-code -------------------------------------------------------------------------------- /scripts/ci/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | # All tests assume to be run from the build directory 6 | pushd build/test 7 | echo "travis_fold:start:TEST" 8 | ctest --verbose 9 | echo "travis_fold:end:TEST" 10 | popd 11 | 12 | -------------------------------------------------------------------------------- /scripts/license-checker/.flowconfig: -------------------------------------------------------------------------------- 1 | [version] 2 | 0.93.0 3 | -------------------------------------------------------------------------------- /scripts/license-checker/license-checker: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = require('path'); 4 | const include = path.dirname(require.resolve('./main')); 5 | 6 | require('@mapbox/flow-remove-types/register')({include}); 7 | require('esm')(module)('./main'); 8 | -------------------------------------------------------------------------------- /scripts/license-checker/main.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import crypto from 'crypto'; 4 | import fs from 'fs'; 5 | import path from 'path'; 6 | 7 | const Git = require('nodegit'); 8 | const yargs = require('yargs'); 9 | 10 | type Action = 11 | | 'file' 12 | | 'text' 13 | | 'ignore'; 14 | 15 | type Entry = {| 16 | name: ?string, 17 | path: string, 18 | hash: string, 19 | licenseFile: string, 20 | licenseText: ?string, 21 | action: Action 22 | |}; 23 | 24 | type LockFile = Array; 25 | 26 | function hashFile(path): ?string { 27 | let hash = crypto.createHash('sha256'); 28 | 29 | try { 30 | const data = fs.readFileSync(path); 31 | hash.update(data); 32 | return hash.digest('hex'); 33 | } catch (err) { 34 | return undefined; 35 | } 36 | } 37 | 38 | function loadLockFile(repoPath): Promise { 39 | try { 40 | const file = fs.readFileSync(path.join(repoPath, "license-lock")); 41 | return Promise.resolve(JSON.parse(file.toString())); 42 | } catch (err) { 43 | if (err.code === 'ENOENT') { 44 | return Promise.resolve([]); 45 | } 46 | return Promise.reject(err); 47 | } 48 | } 49 | 50 | function saveLockFile(lockFile, repoPath) { 51 | fs.writeFileSync(path.join(repoPath, "license-lock"), JSON.stringify(lockFile, null, 2)); 52 | } 53 | 54 | function generateLockFileForRepo(repoPath): Promise { 55 | function findLicenseFile(repoPath) { 56 | const fileNames = [ 57 | 'LICENSE.md', 58 | 'LICENSE.txt', 59 | 'LICENSE', 60 | 'license.txt', 61 | 'LICENSE_1_0.txt', 62 | 'UNLICENSE' 63 | ]; 64 | 65 | for (let i = 0; i < fileNames.length; i++) { 66 | if (fs.existsSync(path.join(repoPath, fileNames[i]))) { 67 | return fileNames[i]; 68 | } 69 | } 70 | return undefined; 71 | } 72 | 73 | return Git.Repository.open(repoPath) 74 | .then((repo) => { 75 | var paths = [] 76 | return Git.Submodule.foreach(repo, (sub) => { 77 | paths.push(sub.path()); 78 | }).then((_) => { 79 | return paths; 80 | }) 81 | }).then((paths) => { 82 | const lockFile = paths.map((p) => { 83 | const submodulePath = path.join(repoPath, p); 84 | const licenseFile = findLicenseFile(submodulePath); 85 | return { 86 | path: p, 87 | licenseFile: licenseFile, 88 | hash: licenseFile ? hashFile(path.join(submodulePath, licenseFile)) : undefined, 89 | action: 'file' 90 | }; 91 | }) 92 | return Promise.resolve(lockFile); 93 | }); 94 | } 95 | 96 | function lockFileToString(lockFile) { 97 | return JSON.stringify(lockFile, null, 2); 98 | } 99 | 100 | 101 | function checkLicenses(repoPath) { 102 | Promise.all([loadLockFile(repoPath), generateLockFileForRepo(repoPath)]) 103 | .then((lockFiles) => { 104 | const lockFile = lockFiles[0]; 105 | const newLockFile = lockFiles[1]; 106 | 107 | lockFile.forEach((entry) => { 108 | if (entry.hash === undefined || entry.licenseFile === undefined) { 109 | console.error(`License information missing for submodule ${entry.path}`); 110 | process.exit(1); 111 | } 112 | const hash = hashFile(path.join(repoPath, entry.path, entry.licenseFile)) || ""; 113 | if (hash !== entry.hash) { 114 | console.error(`License for submodule ${entry.path} changed!`); 115 | console.error(` old hash: ${entry.hash}`); 116 | console.error(` new hash: ${hash}`); 117 | process.exit(1); 118 | } 119 | if (entry.action === 'text' && !entry.licenseText) { 120 | console.error(`Submodule ${entry.path} has action \'text\' but licenseText is not defined`); 121 | process.exit(1); 122 | } 123 | }); 124 | 125 | newLockFile.forEach((newEntry) => { 126 | const oldEntry = lockFile.find((e) => e.path === newEntry.path); 127 | if (oldEntry === undefined) { 128 | console.error(`No license entry for submodule ${newEntry.path}`); 129 | process.exit(1); 130 | } 131 | }); 132 | }) 133 | .catch((err) => { 134 | console.error(err); 135 | process.exit(1); 136 | }); 137 | } 138 | 139 | function licenseText(projName, repoPath) { 140 | loadLockFile(repoPath) 141 | .then((lf) => { 142 | const license = lf.filter((e) => e.action !== 'ignore').map((entry) => { 143 | const text = entry.action === 'text' 144 | ? entry.licenseText 145 | : fs.readFileSync(path.join(repoPath, entry.path, entry.licenseFile)); 146 | 147 | const name = entry.name || path.basename(entry.path); 148 | 149 | return [ 150 | `${projName} uses portions of ${name}`, 151 | '', 152 | text 153 | ].join('\n'); 154 | }).join('\n===========================================================================\n\n'); 155 | 156 | console.log(license); 157 | }) 158 | .catch((err) => { 159 | console.log(err); 160 | process.exit(1); 161 | }); 162 | } 163 | 164 | 165 | yargs 166 | .command('generate [path]', 167 | 'automatically generate a new lock file for repository', 168 | (yargs) => yargs.positional('path', {describe: 'path to git repository', default: './'}), 169 | (argv) => generateLockFileForRepo(argv.path).then((lf) => console.log(lockFileToString(lf)))) 170 | .command('check [path]', 171 | 'check licenses against repository\'s lock file', 172 | (yargs) => yargs.positional('path', {describe: 'path to git repository', default: './'}), 173 | (argv) => checkLicenses(argv.path)) 174 | .command('license [path]', 175 | 'write a license file to standard output', 176 | (yargs) => yargs 177 | .positional('name', {describe: 'project name used in the license file'}) 178 | .positional('path', {describe: 'path to git repository', default: './'}), 179 | (argv) => licenseText(argv.name , argv.path)) 180 | .argv; 181 | -------------------------------------------------------------------------------- /scripts/license-checker/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "license-checker", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@mapbox/flow-remove-types": { 8 | "version": "1.3.0-await.upstream.2", 9 | "resolved": "https://registry.npmjs.org/@mapbox/flow-remove-types/-/flow-remove-types-1.3.0-await.upstream.2.tgz", 10 | "integrity": "sha512-OYVWXwkluP+9Jz2uenNSeum7U2Hp6RncPAS8iz3qnJ37kE/acae5dD1207BFqWsJ2JsBqULG8g2wB+hUQzPeYg==", 11 | "requires": { 12 | "babylon": "^7.0.0-beta.41", 13 | "node-modules-regexp": "^1.0.0", 14 | "pirates": "^3.0.2", 15 | "vlq": "^0.2.1" 16 | } 17 | }, 18 | "abbrev": { 19 | "version": "1.1.1", 20 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", 21 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" 22 | }, 23 | "ajv": { 24 | "version": "6.10.2", 25 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", 26 | "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", 27 | "requires": { 28 | "fast-deep-equal": "^2.0.1", 29 | "fast-json-stable-stringify": "^2.0.0", 30 | "json-schema-traverse": "^0.4.1", 31 | "uri-js": "^4.2.2" 32 | } 33 | }, 34 | "ansi-regex": { 35 | "version": "2.1.1", 36 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 37 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" 38 | }, 39 | "ansi-styles": { 40 | "version": "3.2.1", 41 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 42 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 43 | "requires": { 44 | "color-convert": "^1.9.0" 45 | } 46 | }, 47 | "aproba": { 48 | "version": "1.2.0", 49 | "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", 50 | "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" 51 | }, 52 | "are-we-there-yet": { 53 | "version": "1.1.5", 54 | "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", 55 | "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", 56 | "requires": { 57 | "delegates": "^1.0.0", 58 | "readable-stream": "^2.0.6" 59 | } 60 | }, 61 | "asap": { 62 | "version": "2.0.6", 63 | "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", 64 | "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" 65 | }, 66 | "asn1": { 67 | "version": "0.2.4", 68 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 69 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 70 | "requires": { 71 | "safer-buffer": "~2.1.0" 72 | } 73 | }, 74 | "assert-plus": { 75 | "version": "1.0.0", 76 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 77 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 78 | }, 79 | "asynckit": { 80 | "version": "0.4.0", 81 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 82 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 83 | }, 84 | "aws-sign2": { 85 | "version": "0.7.0", 86 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 87 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 88 | }, 89 | "aws4": { 90 | "version": "1.8.0", 91 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", 92 | "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" 93 | }, 94 | "babylon": { 95 | "version": "7.0.0-beta.47", 96 | "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.47.tgz", 97 | "integrity": "sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ==" 98 | }, 99 | "balanced-match": { 100 | "version": "1.0.0", 101 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 102 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 103 | }, 104 | "bcrypt-pbkdf": { 105 | "version": "1.0.2", 106 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 107 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 108 | "requires": { 109 | "tweetnacl": "^0.14.3" 110 | } 111 | }, 112 | "bl": { 113 | "version": "1.2.2", 114 | "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", 115 | "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", 116 | "requires": { 117 | "readable-stream": "^2.3.5", 118 | "safe-buffer": "^5.1.1" 119 | } 120 | }, 121 | "brace-expansion": { 122 | "version": "1.1.11", 123 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 124 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 125 | "requires": { 126 | "balanced-match": "^1.0.0", 127 | "concat-map": "0.0.1" 128 | } 129 | }, 130 | "buffer-alloc": { 131 | "version": "1.2.0", 132 | "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", 133 | "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", 134 | "requires": { 135 | "buffer-alloc-unsafe": "^1.1.0", 136 | "buffer-fill": "^1.0.0" 137 | } 138 | }, 139 | "buffer-alloc-unsafe": { 140 | "version": "1.1.0", 141 | "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", 142 | "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" 143 | }, 144 | "buffer-fill": { 145 | "version": "1.0.0", 146 | "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", 147 | "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" 148 | }, 149 | "camelcase": { 150 | "version": "5.3.1", 151 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 152 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" 153 | }, 154 | "caseless": { 155 | "version": "0.12.0", 156 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 157 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 158 | }, 159 | "chownr": { 160 | "version": "1.1.2", 161 | "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", 162 | "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==" 163 | }, 164 | "cliui": { 165 | "version": "5.0.0", 166 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", 167 | "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", 168 | "requires": { 169 | "string-width": "^3.1.0", 170 | "strip-ansi": "^5.2.0", 171 | "wrap-ansi": "^5.1.0" 172 | }, 173 | "dependencies": { 174 | "ansi-regex": { 175 | "version": "4.1.0", 176 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 177 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" 178 | }, 179 | "is-fullwidth-code-point": { 180 | "version": "2.0.0", 181 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 182 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" 183 | }, 184 | "string-width": { 185 | "version": "3.1.0", 186 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 187 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 188 | "requires": { 189 | "emoji-regex": "^7.0.1", 190 | "is-fullwidth-code-point": "^2.0.0", 191 | "strip-ansi": "^5.1.0" 192 | } 193 | }, 194 | "strip-ansi": { 195 | "version": "5.2.0", 196 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 197 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 198 | "requires": { 199 | "ansi-regex": "^4.1.0" 200 | } 201 | } 202 | } 203 | }, 204 | "code-point-at": { 205 | "version": "1.1.0", 206 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", 207 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" 208 | }, 209 | "color-convert": { 210 | "version": "1.9.3", 211 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 212 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 213 | "requires": { 214 | "color-name": "1.1.3" 215 | } 216 | }, 217 | "color-name": { 218 | "version": "1.1.3", 219 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 220 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" 221 | }, 222 | "combined-stream": { 223 | "version": "1.0.8", 224 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 225 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 226 | "requires": { 227 | "delayed-stream": "~1.0.0" 228 | } 229 | }, 230 | "concat-map": { 231 | "version": "0.0.1", 232 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 233 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 234 | }, 235 | "console-control-strings": { 236 | "version": "1.1.0", 237 | "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", 238 | "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" 239 | }, 240 | "core-util-is": { 241 | "version": "1.0.2", 242 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 243 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 244 | }, 245 | "dashdash": { 246 | "version": "1.14.1", 247 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 248 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 249 | "requires": { 250 | "assert-plus": "^1.0.0" 251 | } 252 | }, 253 | "debug": { 254 | "version": "3.2.6", 255 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 256 | "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", 257 | "requires": { 258 | "ms": "^2.1.1" 259 | } 260 | }, 261 | "decamelize": { 262 | "version": "1.2.0", 263 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 264 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" 265 | }, 266 | "deep-extend": { 267 | "version": "0.6.0", 268 | "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", 269 | "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" 270 | }, 271 | "delayed-stream": { 272 | "version": "1.0.0", 273 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 274 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 275 | }, 276 | "delegates": { 277 | "version": "1.0.0", 278 | "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", 279 | "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" 280 | }, 281 | "detect-libc": { 282 | "version": "1.0.3", 283 | "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", 284 | "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" 285 | }, 286 | "ecc-jsbn": { 287 | "version": "0.1.2", 288 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 289 | "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", 290 | "requires": { 291 | "jsbn": "~0.1.0", 292 | "safer-buffer": "^2.1.0" 293 | } 294 | }, 295 | "emoji-regex": { 296 | "version": "7.0.3", 297 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 298 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" 299 | }, 300 | "end-of-stream": { 301 | "version": "1.4.1", 302 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", 303 | "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", 304 | "requires": { 305 | "once": "^1.4.0" 306 | } 307 | }, 308 | "esm": { 309 | "version": "3.2.25", 310 | "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", 311 | "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" 312 | }, 313 | "extend": { 314 | "version": "3.0.2", 315 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 316 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 317 | }, 318 | "extsprintf": { 319 | "version": "1.3.0", 320 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 321 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 322 | }, 323 | "fast-deep-equal": { 324 | "version": "2.0.1", 325 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", 326 | "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" 327 | }, 328 | "fast-json-stable-stringify": { 329 | "version": "2.0.0", 330 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", 331 | "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" 332 | }, 333 | "find-up": { 334 | "version": "3.0.0", 335 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", 336 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", 337 | "requires": { 338 | "locate-path": "^3.0.0" 339 | } 340 | }, 341 | "flow-bin": { 342 | "version": "0.93.0", 343 | "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.93.0.tgz", 344 | "integrity": "sha512-p8yq4ocOlpyJgOEBEj0v0GzCP25c9WP0ilFQ8hXSbrTR7RPKuR+Whr+OitlVyp8ocdX0j1MrIwQ8x28dacy1pg==", 345 | "dev": true 346 | }, 347 | "forever-agent": { 348 | "version": "0.6.1", 349 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 350 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 351 | }, 352 | "form-data": { 353 | "version": "2.3.3", 354 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 355 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 356 | "requires": { 357 | "asynckit": "^0.4.0", 358 | "combined-stream": "^1.0.6", 359 | "mime-types": "^2.1.12" 360 | } 361 | }, 362 | "fs-constants": { 363 | "version": "1.0.0", 364 | "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", 365 | "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" 366 | }, 367 | "fs-extra": { 368 | "version": "7.0.1", 369 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", 370 | "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", 371 | "requires": { 372 | "graceful-fs": "^4.1.2", 373 | "jsonfile": "^4.0.0", 374 | "universalify": "^0.1.0" 375 | } 376 | }, 377 | "fs-minipass": { 378 | "version": "1.2.6", 379 | "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", 380 | "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", 381 | "requires": { 382 | "minipass": "^2.2.1" 383 | } 384 | }, 385 | "fs.realpath": { 386 | "version": "1.0.0", 387 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 388 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 389 | }, 390 | "gauge": { 391 | "version": "2.7.4", 392 | "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", 393 | "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", 394 | "requires": { 395 | "aproba": "^1.0.3", 396 | "console-control-strings": "^1.0.0", 397 | "has-unicode": "^2.0.0", 398 | "object-assign": "^4.1.0", 399 | "signal-exit": "^3.0.0", 400 | "string-width": "^1.0.1", 401 | "strip-ansi": "^3.0.1", 402 | "wide-align": "^1.1.0" 403 | } 404 | }, 405 | "get-caller-file": { 406 | "version": "2.0.5", 407 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 408 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" 409 | }, 410 | "getpass": { 411 | "version": "0.1.7", 412 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 413 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 414 | "requires": { 415 | "assert-plus": "^1.0.0" 416 | } 417 | }, 418 | "glob": { 419 | "version": "7.1.4", 420 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", 421 | "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", 422 | "requires": { 423 | "fs.realpath": "^1.0.0", 424 | "inflight": "^1.0.4", 425 | "inherits": "2", 426 | "minimatch": "^3.0.4", 427 | "once": "^1.3.0", 428 | "path-is-absolute": "^1.0.0" 429 | } 430 | }, 431 | "graceful-fs": { 432 | "version": "4.2.0", 433 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz", 434 | "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg==" 435 | }, 436 | "har-schema": { 437 | "version": "2.0.0", 438 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 439 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 440 | }, 441 | "har-validator": { 442 | "version": "5.1.3", 443 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", 444 | "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", 445 | "requires": { 446 | "ajv": "^6.5.5", 447 | "har-schema": "^2.0.0" 448 | } 449 | }, 450 | "has-unicode": { 451 | "version": "2.0.1", 452 | "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", 453 | "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" 454 | }, 455 | "http-signature": { 456 | "version": "1.2.0", 457 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 458 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 459 | "requires": { 460 | "assert-plus": "^1.0.0", 461 | "jsprim": "^1.2.2", 462 | "sshpk": "^1.7.0" 463 | } 464 | }, 465 | "iconv-lite": { 466 | "version": "0.4.24", 467 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 468 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 469 | "requires": { 470 | "safer-buffer": ">= 2.1.2 < 3" 471 | } 472 | }, 473 | "ignore-walk": { 474 | "version": "3.0.1", 475 | "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", 476 | "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", 477 | "requires": { 478 | "minimatch": "^3.0.4" 479 | } 480 | }, 481 | "inflight": { 482 | "version": "1.0.6", 483 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 484 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 485 | "requires": { 486 | "once": "^1.3.0", 487 | "wrappy": "1" 488 | } 489 | }, 490 | "inherits": { 491 | "version": "2.0.4", 492 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 493 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 494 | }, 495 | "ini": { 496 | "version": "1.3.5", 497 | "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", 498 | "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" 499 | }, 500 | "is-fullwidth-code-point": { 501 | "version": "1.0.0", 502 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 503 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 504 | "requires": { 505 | "number-is-nan": "^1.0.0" 506 | } 507 | }, 508 | "is-typedarray": { 509 | "version": "1.0.0", 510 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 511 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 512 | }, 513 | "isarray": { 514 | "version": "1.0.0", 515 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 516 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 517 | }, 518 | "isexe": { 519 | "version": "2.0.0", 520 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 521 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" 522 | }, 523 | "isstream": { 524 | "version": "0.1.2", 525 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 526 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 527 | }, 528 | "jsbn": { 529 | "version": "0.1.1", 530 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 531 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" 532 | }, 533 | "json-schema": { 534 | "version": "0.2.3", 535 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 536 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" 537 | }, 538 | "json-schema-traverse": { 539 | "version": "0.4.1", 540 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 541 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" 542 | }, 543 | "json-stringify-safe": { 544 | "version": "5.0.1", 545 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 546 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 547 | }, 548 | "json5": { 549 | "version": "2.1.0", 550 | "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", 551 | "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", 552 | "requires": { 553 | "minimist": "^1.2.0" 554 | } 555 | }, 556 | "jsonfile": { 557 | "version": "4.0.0", 558 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", 559 | "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", 560 | "requires": { 561 | "graceful-fs": "^4.1.6" 562 | } 563 | }, 564 | "jsprim": { 565 | "version": "1.4.1", 566 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 567 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 568 | "requires": { 569 | "assert-plus": "1.0.0", 570 | "extsprintf": "1.3.0", 571 | "json-schema": "0.2.3", 572 | "verror": "1.10.0" 573 | } 574 | }, 575 | "locate-path": { 576 | "version": "3.0.0", 577 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", 578 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", 579 | "requires": { 580 | "p-locate": "^3.0.0", 581 | "path-exists": "^3.0.0" 582 | } 583 | }, 584 | "lodash": { 585 | "version": "4.17.14", 586 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", 587 | "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==" 588 | }, 589 | "mime-db": { 590 | "version": "1.40.0", 591 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 592 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 593 | }, 594 | "mime-types": { 595 | "version": "2.1.24", 596 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 597 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 598 | "requires": { 599 | "mime-db": "1.40.0" 600 | } 601 | }, 602 | "minimatch": { 603 | "version": "3.0.4", 604 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 605 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 606 | "requires": { 607 | "brace-expansion": "^1.1.7" 608 | } 609 | }, 610 | "minimist": { 611 | "version": "1.2.5", 612 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 613 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" 614 | }, 615 | "minipass": { 616 | "version": "2.3.5", 617 | "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", 618 | "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", 619 | "requires": { 620 | "safe-buffer": "^5.1.2", 621 | "yallist": "^3.0.0" 622 | } 623 | }, 624 | "minizlib": { 625 | "version": "1.2.1", 626 | "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", 627 | "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", 628 | "requires": { 629 | "minipass": "^2.2.1" 630 | } 631 | }, 632 | "mkdirp": { 633 | "version": "0.5.1", 634 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 635 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 636 | "requires": { 637 | "minimist": "0.0.8" 638 | }, 639 | "dependencies": { 640 | "minimist": { 641 | "version": "0.0.8", 642 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 643 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" 644 | } 645 | } 646 | }, 647 | "ms": { 648 | "version": "2.1.2", 649 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 650 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 651 | }, 652 | "nan": { 653 | "version": "2.14.0", 654 | "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", 655 | "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" 656 | }, 657 | "needle": { 658 | "version": "2.4.0", 659 | "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", 660 | "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", 661 | "requires": { 662 | "debug": "^3.2.6", 663 | "iconv-lite": "^0.4.4", 664 | "sax": "^1.2.4" 665 | } 666 | }, 667 | "node-gyp": { 668 | "version": "4.0.0", 669 | "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-4.0.0.tgz", 670 | "integrity": "sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA==", 671 | "requires": { 672 | "glob": "^7.0.3", 673 | "graceful-fs": "^4.1.2", 674 | "mkdirp": "^0.5.0", 675 | "nopt": "2 || 3", 676 | "npmlog": "0 || 1 || 2 || 3 || 4", 677 | "osenv": "0", 678 | "request": "^2.87.0", 679 | "rimraf": "2", 680 | "semver": "~5.3.0", 681 | "tar": "^4.4.8", 682 | "which": "1" 683 | } 684 | }, 685 | "node-modules-regexp": { 686 | "version": "1.0.0", 687 | "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", 688 | "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=" 689 | }, 690 | "node-pre-gyp": { 691 | "version": "0.11.0", 692 | "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", 693 | "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", 694 | "requires": { 695 | "detect-libc": "^1.0.2", 696 | "mkdirp": "^0.5.1", 697 | "needle": "^2.2.1", 698 | "nopt": "^4.0.1", 699 | "npm-packlist": "^1.1.6", 700 | "npmlog": "^4.0.2", 701 | "rc": "^1.2.7", 702 | "rimraf": "^2.6.1", 703 | "semver": "^5.3.0", 704 | "tar": "^4" 705 | }, 706 | "dependencies": { 707 | "nopt": { 708 | "version": "4.0.1", 709 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", 710 | "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", 711 | "requires": { 712 | "abbrev": "1", 713 | "osenv": "^0.1.4" 714 | } 715 | } 716 | } 717 | }, 718 | "nodegit": { 719 | "version": "0.24.3", 720 | "resolved": "https://registry.npmjs.org/nodegit/-/nodegit-0.24.3.tgz", 721 | "integrity": "sha512-F9XpC5xzpoBgJXmdIRaD2z5DVG+iMttxFlzyCqmOu3y5y/DFuxBpzQtRND75oUOxJZh8sSlReVnXFV3PEyzvIw==", 722 | "requires": { 723 | "fs-extra": "^7.0.0", 724 | "json5": "^2.1.0", 725 | "lodash": "^4.17.11", 726 | "nan": "^2.11.1", 727 | "node-gyp": "^4.0.0", 728 | "node-pre-gyp": "^0.11.0", 729 | "promisify-node": "~0.3.0", 730 | "ramda": "^0.25.0", 731 | "request-promise-native": "^1.0.5", 732 | "tar-fs": "^1.16.3" 733 | } 734 | }, 735 | "nodegit-promise": { 736 | "version": "4.0.0", 737 | "resolved": "https://registry.npmjs.org/nodegit-promise/-/nodegit-promise-4.0.0.tgz", 738 | "integrity": "sha1-VyKxhPLfcycWEGSnkdLoQskWezQ=", 739 | "requires": { 740 | "asap": "~2.0.3" 741 | } 742 | }, 743 | "nopt": { 744 | "version": "3.0.6", 745 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", 746 | "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", 747 | "requires": { 748 | "abbrev": "1" 749 | } 750 | }, 751 | "npm-bundled": { 752 | "version": "1.0.6", 753 | "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", 754 | "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==" 755 | }, 756 | "npm-packlist": { 757 | "version": "1.4.4", 758 | "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.4.tgz", 759 | "integrity": "sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw==", 760 | "requires": { 761 | "ignore-walk": "^3.0.1", 762 | "npm-bundled": "^1.0.1" 763 | } 764 | }, 765 | "npmlog": { 766 | "version": "4.1.2", 767 | "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", 768 | "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", 769 | "requires": { 770 | "are-we-there-yet": "~1.1.2", 771 | "console-control-strings": "~1.1.0", 772 | "gauge": "~2.7.3", 773 | "set-blocking": "~2.0.0" 774 | } 775 | }, 776 | "number-is-nan": { 777 | "version": "1.0.1", 778 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 779 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" 780 | }, 781 | "oauth-sign": { 782 | "version": "0.9.0", 783 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", 784 | "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" 785 | }, 786 | "object-assign": { 787 | "version": "4.1.1", 788 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 789 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 790 | }, 791 | "once": { 792 | "version": "1.4.0", 793 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 794 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 795 | "requires": { 796 | "wrappy": "1" 797 | } 798 | }, 799 | "os-homedir": { 800 | "version": "1.0.2", 801 | "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", 802 | "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" 803 | }, 804 | "os-tmpdir": { 805 | "version": "1.0.2", 806 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 807 | "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" 808 | }, 809 | "osenv": { 810 | "version": "0.1.5", 811 | "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", 812 | "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", 813 | "requires": { 814 | "os-homedir": "^1.0.0", 815 | "os-tmpdir": "^1.0.0" 816 | } 817 | }, 818 | "p-limit": { 819 | "version": "2.2.0", 820 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", 821 | "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", 822 | "requires": { 823 | "p-try": "^2.0.0" 824 | } 825 | }, 826 | "p-locate": { 827 | "version": "3.0.0", 828 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", 829 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", 830 | "requires": { 831 | "p-limit": "^2.0.0" 832 | } 833 | }, 834 | "p-try": { 835 | "version": "2.2.0", 836 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 837 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" 838 | }, 839 | "path-exists": { 840 | "version": "3.0.0", 841 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", 842 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" 843 | }, 844 | "path-is-absolute": { 845 | "version": "1.0.1", 846 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 847 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 848 | }, 849 | "performance-now": { 850 | "version": "2.1.0", 851 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 852 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 853 | }, 854 | "pirates": { 855 | "version": "3.0.2", 856 | "resolved": "https://registry.npmjs.org/pirates/-/pirates-3.0.2.tgz", 857 | "integrity": "sha512-c5CgUJq6H2k6MJz72Ak1F5sN9n9wlSlJyEnwvpm9/y3WB4E3pHBDT2c6PEiS1vyJvq2bUxUAIu0EGf8Cx4Ic7Q==", 858 | "requires": { 859 | "node-modules-regexp": "^1.0.0" 860 | } 861 | }, 862 | "process-nextick-args": { 863 | "version": "2.0.1", 864 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 865 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 866 | }, 867 | "promisify-node": { 868 | "version": "0.3.0", 869 | "resolved": "https://registry.npmjs.org/promisify-node/-/promisify-node-0.3.0.tgz", 870 | "integrity": "sha1-tLVaz5D6p9K4uQyjlomQhsAwYM8=", 871 | "requires": { 872 | "nodegit-promise": "~4.0.0" 873 | } 874 | }, 875 | "psl": { 876 | "version": "1.2.0", 877 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz", 878 | "integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==" 879 | }, 880 | "pump": { 881 | "version": "1.0.3", 882 | "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", 883 | "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", 884 | "requires": { 885 | "end-of-stream": "^1.1.0", 886 | "once": "^1.3.1" 887 | } 888 | }, 889 | "punycode": { 890 | "version": "2.1.1", 891 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 892 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 893 | }, 894 | "qs": { 895 | "version": "6.5.2", 896 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 897 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 898 | }, 899 | "ramda": { 900 | "version": "0.25.0", 901 | "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", 902 | "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==" 903 | }, 904 | "rc": { 905 | "version": "1.2.8", 906 | "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", 907 | "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", 908 | "requires": { 909 | "deep-extend": "^0.6.0", 910 | "ini": "~1.3.0", 911 | "minimist": "^1.2.0", 912 | "strip-json-comments": "~2.0.1" 913 | } 914 | }, 915 | "readable-stream": { 916 | "version": "2.3.6", 917 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", 918 | "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", 919 | "requires": { 920 | "core-util-is": "~1.0.0", 921 | "inherits": "~2.0.3", 922 | "isarray": "~1.0.0", 923 | "process-nextick-args": "~2.0.0", 924 | "safe-buffer": "~5.1.1", 925 | "string_decoder": "~1.1.1", 926 | "util-deprecate": "~1.0.1" 927 | } 928 | }, 929 | "request": { 930 | "version": "2.88.0", 931 | "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", 932 | "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", 933 | "requires": { 934 | "aws-sign2": "~0.7.0", 935 | "aws4": "^1.8.0", 936 | "caseless": "~0.12.0", 937 | "combined-stream": "~1.0.6", 938 | "extend": "~3.0.2", 939 | "forever-agent": "~0.6.1", 940 | "form-data": "~2.3.2", 941 | "har-validator": "~5.1.0", 942 | "http-signature": "~1.2.0", 943 | "is-typedarray": "~1.0.0", 944 | "isstream": "~0.1.2", 945 | "json-stringify-safe": "~5.0.1", 946 | "mime-types": "~2.1.19", 947 | "oauth-sign": "~0.9.0", 948 | "performance-now": "^2.1.0", 949 | "qs": "~6.5.2", 950 | "safe-buffer": "^5.1.2", 951 | "tough-cookie": "~2.4.3", 952 | "tunnel-agent": "^0.6.0", 953 | "uuid": "^3.3.2" 954 | } 955 | }, 956 | "request-promise-core": { 957 | "version": "1.1.2", 958 | "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", 959 | "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", 960 | "requires": { 961 | "lodash": "^4.17.11" 962 | } 963 | }, 964 | "request-promise-native": { 965 | "version": "1.0.7", 966 | "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", 967 | "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", 968 | "requires": { 969 | "request-promise-core": "1.1.2", 970 | "stealthy-require": "^1.1.1", 971 | "tough-cookie": "^2.3.3" 972 | } 973 | }, 974 | "require-directory": { 975 | "version": "2.1.1", 976 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 977 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" 978 | }, 979 | "require-main-filename": { 980 | "version": "2.0.0", 981 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", 982 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" 983 | }, 984 | "rimraf": { 985 | "version": "2.6.3", 986 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", 987 | "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", 988 | "requires": { 989 | "glob": "^7.1.3" 990 | } 991 | }, 992 | "safe-buffer": { 993 | "version": "5.1.2", 994 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 995 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 996 | }, 997 | "safer-buffer": { 998 | "version": "2.1.2", 999 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1000 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1001 | }, 1002 | "sax": { 1003 | "version": "1.2.4", 1004 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 1005 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 1006 | }, 1007 | "semver": { 1008 | "version": "5.3.0", 1009 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", 1010 | "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" 1011 | }, 1012 | "set-blocking": { 1013 | "version": "2.0.0", 1014 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 1015 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" 1016 | }, 1017 | "signal-exit": { 1018 | "version": "3.0.2", 1019 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", 1020 | "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" 1021 | }, 1022 | "sshpk": { 1023 | "version": "1.16.1", 1024 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", 1025 | "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", 1026 | "requires": { 1027 | "asn1": "~0.2.3", 1028 | "assert-plus": "^1.0.0", 1029 | "bcrypt-pbkdf": "^1.0.0", 1030 | "dashdash": "^1.12.0", 1031 | "ecc-jsbn": "~0.1.1", 1032 | "getpass": "^0.1.1", 1033 | "jsbn": "~0.1.0", 1034 | "safer-buffer": "^2.0.2", 1035 | "tweetnacl": "~0.14.0" 1036 | } 1037 | }, 1038 | "stealthy-require": { 1039 | "version": "1.1.1", 1040 | "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", 1041 | "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" 1042 | }, 1043 | "string-width": { 1044 | "version": "1.0.2", 1045 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", 1046 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", 1047 | "requires": { 1048 | "code-point-at": "^1.0.0", 1049 | "is-fullwidth-code-point": "^1.0.0", 1050 | "strip-ansi": "^3.0.0" 1051 | } 1052 | }, 1053 | "string_decoder": { 1054 | "version": "1.1.1", 1055 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 1056 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 1057 | "requires": { 1058 | "safe-buffer": "~5.1.0" 1059 | } 1060 | }, 1061 | "strip-ansi": { 1062 | "version": "3.0.1", 1063 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 1064 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 1065 | "requires": { 1066 | "ansi-regex": "^2.0.0" 1067 | } 1068 | }, 1069 | "strip-json-comments": { 1070 | "version": "2.0.1", 1071 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 1072 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" 1073 | }, 1074 | "tar": { 1075 | "version": "4.4.10", 1076 | "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", 1077 | "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", 1078 | "requires": { 1079 | "chownr": "^1.1.1", 1080 | "fs-minipass": "^1.2.5", 1081 | "minipass": "^2.3.5", 1082 | "minizlib": "^1.2.1", 1083 | "mkdirp": "^0.5.0", 1084 | "safe-buffer": "^5.1.2", 1085 | "yallist": "^3.0.3" 1086 | } 1087 | }, 1088 | "tar-fs": { 1089 | "version": "1.16.3", 1090 | "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", 1091 | "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", 1092 | "requires": { 1093 | "chownr": "^1.0.1", 1094 | "mkdirp": "^0.5.1", 1095 | "pump": "^1.0.0", 1096 | "tar-stream": "^1.1.2" 1097 | } 1098 | }, 1099 | "tar-stream": { 1100 | "version": "1.6.2", 1101 | "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", 1102 | "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", 1103 | "requires": { 1104 | "bl": "^1.0.0", 1105 | "buffer-alloc": "^1.2.0", 1106 | "end-of-stream": "^1.0.0", 1107 | "fs-constants": "^1.0.0", 1108 | "readable-stream": "^2.3.0", 1109 | "to-buffer": "^1.1.1", 1110 | "xtend": "^4.0.0" 1111 | } 1112 | }, 1113 | "to-buffer": { 1114 | "version": "1.1.1", 1115 | "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", 1116 | "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" 1117 | }, 1118 | "tough-cookie": { 1119 | "version": "2.4.3", 1120 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", 1121 | "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", 1122 | "requires": { 1123 | "psl": "^1.1.24", 1124 | "punycode": "^1.4.1" 1125 | }, 1126 | "dependencies": { 1127 | "punycode": { 1128 | "version": "1.4.1", 1129 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", 1130 | "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" 1131 | } 1132 | } 1133 | }, 1134 | "tunnel-agent": { 1135 | "version": "0.6.0", 1136 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 1137 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 1138 | "requires": { 1139 | "safe-buffer": "^5.0.1" 1140 | } 1141 | }, 1142 | "tweetnacl": { 1143 | "version": "0.14.5", 1144 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 1145 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" 1146 | }, 1147 | "universalify": { 1148 | "version": "0.1.2", 1149 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", 1150 | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" 1151 | }, 1152 | "uri-js": { 1153 | "version": "4.2.2", 1154 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", 1155 | "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", 1156 | "requires": { 1157 | "punycode": "^2.1.0" 1158 | } 1159 | }, 1160 | "util-deprecate": { 1161 | "version": "1.0.2", 1162 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1163 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 1164 | }, 1165 | "uuid": { 1166 | "version": "3.3.2", 1167 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", 1168 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" 1169 | }, 1170 | "verror": { 1171 | "version": "1.10.0", 1172 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 1173 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 1174 | "requires": { 1175 | "assert-plus": "^1.0.0", 1176 | "core-util-is": "1.0.2", 1177 | "extsprintf": "^1.2.0" 1178 | } 1179 | }, 1180 | "vlq": { 1181 | "version": "0.2.3", 1182 | "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", 1183 | "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==" 1184 | }, 1185 | "which": { 1186 | "version": "1.3.1", 1187 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 1188 | "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 1189 | "requires": { 1190 | "isexe": "^2.0.0" 1191 | } 1192 | }, 1193 | "which-module": { 1194 | "version": "2.0.0", 1195 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 1196 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" 1197 | }, 1198 | "wide-align": { 1199 | "version": "1.1.3", 1200 | "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", 1201 | "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", 1202 | "requires": { 1203 | "string-width": "^1.0.2 || 2" 1204 | } 1205 | }, 1206 | "wrap-ansi": { 1207 | "version": "5.1.0", 1208 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", 1209 | "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", 1210 | "requires": { 1211 | "ansi-styles": "^3.2.0", 1212 | "string-width": "^3.0.0", 1213 | "strip-ansi": "^5.0.0" 1214 | }, 1215 | "dependencies": { 1216 | "ansi-regex": { 1217 | "version": "4.1.0", 1218 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 1219 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" 1220 | }, 1221 | "is-fullwidth-code-point": { 1222 | "version": "2.0.0", 1223 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 1224 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" 1225 | }, 1226 | "string-width": { 1227 | "version": "3.1.0", 1228 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1229 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1230 | "requires": { 1231 | "emoji-regex": "^7.0.1", 1232 | "is-fullwidth-code-point": "^2.0.0", 1233 | "strip-ansi": "^5.1.0" 1234 | } 1235 | }, 1236 | "strip-ansi": { 1237 | "version": "5.2.0", 1238 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1239 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1240 | "requires": { 1241 | "ansi-regex": "^4.1.0" 1242 | } 1243 | } 1244 | } 1245 | }, 1246 | "wrappy": { 1247 | "version": "1.0.2", 1248 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1249 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1250 | }, 1251 | "xtend": { 1252 | "version": "4.0.2", 1253 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 1254 | "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" 1255 | }, 1256 | "y18n": { 1257 | "version": "4.0.0", 1258 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", 1259 | "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" 1260 | }, 1261 | "yallist": { 1262 | "version": "3.0.3", 1263 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", 1264 | "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" 1265 | }, 1266 | "yargs": { 1267 | "version": "13.3.0", 1268 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", 1269 | "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", 1270 | "requires": { 1271 | "cliui": "^5.0.0", 1272 | "find-up": "^3.0.0", 1273 | "get-caller-file": "^2.0.1", 1274 | "require-directory": "^2.1.1", 1275 | "require-main-filename": "^2.0.0", 1276 | "set-blocking": "^2.0.0", 1277 | "string-width": "^3.0.0", 1278 | "which-module": "^2.0.0", 1279 | "y18n": "^4.0.0", 1280 | "yargs-parser": "^13.1.1" 1281 | }, 1282 | "dependencies": { 1283 | "ansi-regex": { 1284 | "version": "4.1.0", 1285 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 1286 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" 1287 | }, 1288 | "is-fullwidth-code-point": { 1289 | "version": "2.0.0", 1290 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 1291 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" 1292 | }, 1293 | "string-width": { 1294 | "version": "3.1.0", 1295 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 1296 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 1297 | "requires": { 1298 | "emoji-regex": "^7.0.1", 1299 | "is-fullwidth-code-point": "^2.0.0", 1300 | "strip-ansi": "^5.1.0" 1301 | } 1302 | }, 1303 | "strip-ansi": { 1304 | "version": "5.2.0", 1305 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1306 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1307 | "requires": { 1308 | "ansi-regex": "^4.1.0" 1309 | } 1310 | } 1311 | } 1312 | }, 1313 | "yargs-parser": { 1314 | "version": "13.1.1", 1315 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", 1316 | "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", 1317 | "requires": { 1318 | "camelcase": "^5.0.0", 1319 | "decamelize": "^1.2.0" 1320 | } 1321 | } 1322 | } 1323 | } 1324 | -------------------------------------------------------------------------------- /scripts/license-checker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "license-checker", 3 | "version": "0.0.1", 4 | "description": "Tool for generating a LICENSE file and checking for changes", 5 | "bin": "license-checker", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "flow": "flow" 9 | }, 10 | "author": "", 11 | "license": "SEE LICENSE IN ../../LICENSE.md", 12 | "dependencies": { 13 | "@mapbox/flow-remove-types": "^1.3.0-await.upstream.2", 14 | "esm": "^3.2.25", 15 | "nodegit": "^0.24.3", 16 | "yargs": "^13.3.0" 17 | }, 18 | "devDependencies": { 19 | "flow-bin": "0.93.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | test_defines.hpp -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${PROJECT_SOURCE_DIR}/extras/googletest.cmake) 2 | 3 | set(TEST_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR}) 4 | configure_file(${PROJECT_SOURCE_DIR}/test/test_defines.hpp.in ${PROJECT_BINARY_DIR}/test_defines.hpp) 5 | 6 | function(create_test folder_name) 7 | set (target_name "test_${folder_name}") 8 | set (curr_folder "${PROJECT_SOURCE_DIR}/test/${folder_name}") 9 | 10 | file (GLOB_RECURSE test_files "${curr_folder}/*.cpp" "${curr_folder}/*.hpp") 11 | message (STATUS "Adding test ${target_name}") 12 | 13 | add_executable(${target_name} ${test_files}) 14 | target_link_libraries(${target_name} PRIVATE 15 | Mapbox::Base 16 | gtest_all 17 | pthread 18 | ) 19 | 20 | target_include_directories(${target_name} PRIVATE 21 | ${curr_folder} 22 | ${PROJECT_BINARY_DIR} 23 | ) 24 | 25 | add_test(NAME ${target_name} COMMAND ${target_name} ${TEST_ARGUMENTS}) 26 | endfunction() 27 | 28 | create_test("compatibility") 29 | create_test("io") 30 | create_test("std") 31 | create_test("util") 32 | -------------------------------------------------------------------------------- /test/compatibility/value.cpp: -------------------------------------------------------------------------------- 1 | #include "mapbox/compatibility/value.hpp" 2 | 3 | #include 4 | 5 | template 6 | void unused(T&&) {} 7 | 8 | TEST(Compatibility, Dummy) { 9 | mapbox::base::Value v; 10 | EXPECT_FALSE(bool(v)); 11 | 12 | mapbox::base::ValueArray va; 13 | EXPECT_EQ(va.size(), 0); 14 | 15 | mapbox::base::ValueObject vo; 16 | EXPECT_EQ(vo.size(), 0); 17 | 18 | mapbox::base::NullValue nv; 19 | unused(nv); 20 | } 21 | -------------------------------------------------------------------------------- /test/fixtures/hello_world.txt: -------------------------------------------------------------------------------- 1 | Hello, World! 2 | -------------------------------------------------------------------------------- /test/io/io.cpp: -------------------------------------------------------------------------------- 1 | #include "mapbox/io/io.hpp" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "io_delete.hpp" 9 | #include "mapbox/util/expected.hpp" 10 | #include "test_defines.hpp" 11 | 12 | TEST(io, ReadWriteFiles) { 13 | const std::string path(std::string(TEST_BINARY_PATH) + "/foo.txt"); 14 | const std::string copyPath(std::string(TEST_BINARY_PATH) + "/bar.txt"); 15 | const std::string invalidPath("invalid"); 16 | const std::string unauthorizedPath("/root/unauthorized"); 17 | const std::string bar("bar"); 18 | 19 | mapbox::base::expected voidExpected = mapbox::base::io::writeFile(path, bar); 20 | EXPECT_TRUE(voidExpected); 21 | 22 | voidExpected = mapbox::base::io::writeFile(unauthorizedPath, bar); 23 | EXPECT_FALSE(voidExpected); 24 | EXPECT_EQ(voidExpected.error(), std::string("Failed to write file '/root/unauthorized'")); 25 | 26 | nonstd::expected stringExpected = mapbox::base::io::readFile(path); 27 | EXPECT_TRUE(stringExpected); 28 | EXPECT_EQ(*stringExpected, bar); 29 | 30 | stringExpected = mapbox::base::io::readFile(invalidPath); 31 | EXPECT_FALSE(stringExpected); 32 | EXPECT_EQ(stringExpected.error(), std::string("Failed to read file 'invalid'")); 33 | 34 | voidExpected = mapbox::base::io::copyFile(path, copyPath); 35 | EXPECT_TRUE(voidExpected); 36 | 37 | stringExpected = mapbox::base::io::readFile(copyPath); 38 | EXPECT_EQ(*stringExpected, bar); 39 | 40 | voidExpected = mapbox::base::io::copyFile(path, unauthorizedPath); 41 | EXPECT_FALSE(voidExpected); 42 | EXPECT_EQ(voidExpected.error(), std::string("Failed to write file '/root/unauthorized'")); 43 | 44 | voidExpected = mapbox::base::io::copyFile(invalidPath, path); 45 | EXPECT_FALSE(voidExpected); 46 | EXPECT_EQ(voidExpected.error(), std::string("Failed to read file 'invalid'")); 47 | 48 | deleteTests(path, copyPath, invalidPath); 49 | } 50 | -------------------------------------------------------------------------------- /test/io/io_delete.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "io_delete.hpp" 6 | 7 | #include 8 | #include 9 | 10 | void deleteTests(const std::string& path, const std::string& copyPath, const std::string& invalidPath) { 11 | nonstd::expected voidExpected; 12 | 13 | voidExpected = mapbox::base::io::deleteFile(path); 14 | EXPECT_TRUE(voidExpected); 15 | 16 | voidExpected = mapbox::base::io::deleteFile(copyPath); 17 | EXPECT_TRUE(voidExpected); 18 | 19 | voidExpected = mapbox::base::io::deleteFile(invalidPath); 20 | EXPECT_FALSE(voidExpected); 21 | EXPECT_EQ(voidExpected.error(), std::string("Failed to delete file 'invalid'")); 22 | } 23 | -------------------------------------------------------------------------------- /test/io/io_delete.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void deleteTests(const std::string& path, const std::string& copyPath, const std::string& invalidPath); 6 | -------------------------------------------------------------------------------- /test/std/weak.cpp: -------------------------------------------------------------------------------- 1 | #include "mapbox/std/weak.hpp" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | TEST(WeakPtr, Lock) { 13 | using namespace std::chrono_literals; 14 | static std::atomic_int g_i; 15 | struct TestLock { 16 | void inc() { ++g_i; } 17 | mapbox::base::WeakPtrFactory factory_{this}; 18 | }; 19 | 20 | auto t = std::make_unique(); 21 | auto weak1 = t->factory_.makeWeakPtr(); 22 | auto weak2 = t->factory_.makeWeakPtr(); 23 | auto weak3 = weak2; 24 | 25 | std::thread thread1([&] { 26 | auto guard = weak1.lock(); 27 | std::this_thread::sleep_for(150ms); 28 | weak1->inc(); 29 | }); 30 | std::thread thread2([&] { 31 | auto guard = weak2.lock(); 32 | std::this_thread::sleep_for(200ms); 33 | weak2->inc(); 34 | }); 35 | { 36 | auto guard = weak3.lock(); 37 | std::this_thread::sleep_for(50ms); 38 | weak3->inc(); 39 | } 40 | 41 | EXPECT_FALSE(weak1.expired()); 42 | EXPECT_FALSE(weak2.expired()); 43 | EXPECT_TRUE(weak1); 44 | EXPECT_TRUE(weak2); 45 | ASSERT_NO_THROW(t.reset()); // Should not crash. 46 | thread1.join(); 47 | thread2.join(); 48 | 49 | EXPECT_TRUE(weak1.expired()); 50 | EXPECT_TRUE(weak2.expired()); 51 | EXPECT_FALSE(weak1); 52 | EXPECT_FALSE(weak2); 53 | EXPECT_EQ(g_i, 3); 54 | } 55 | 56 | TEST(WeakPtr, InvalidateWeakPtrs) { 57 | using namespace std::chrono_literals; 58 | static std::atomic_int g_i; 59 | struct TestLock { 60 | void inc() { ++g_i; } 61 | mapbox::base::WeakPtrFactory factory_{this}; 62 | }; 63 | 64 | auto t = std::make_unique(); 65 | auto weak1 = t->factory_.makeWeakPtr(); 66 | auto weak2 = t->factory_.makeWeakPtr(); 67 | auto weak3 = weak2; 68 | 69 | std::thread thread1([&] { 70 | auto guard = weak1.lock(); 71 | std::this_thread::sleep_for(150ms); 72 | weak1->inc(); 73 | }); 74 | std::thread thread2([&] { 75 | auto guard = weak2.lock(); 76 | std::this_thread::sleep_for(200ms); 77 | weak2->inc(); 78 | }); 79 | { 80 | auto guard = weak3.lock(); 81 | std::this_thread::sleep_for(50ms); 82 | weak3->inc(); 83 | } 84 | 85 | EXPECT_TRUE(weak1); 86 | EXPECT_TRUE(weak2); 87 | EXPECT_TRUE(weak3); 88 | t->factory_.invalidateWeakPtrs(); 89 | 90 | // All the existing weak pointer have expired. 91 | EXPECT_FALSE(weak3); 92 | 93 | thread1.join(); 94 | thread2.join(); 95 | 96 | EXPECT_FALSE(weak1); 97 | EXPECT_FALSE(weak2); 98 | EXPECT_EQ(g_i, 3); 99 | 100 | // The newly created one is empty. 101 | auto weak4 = t->factory_.makeWeakPtr(); 102 | EXPECT_FALSE(weak4); 103 | } 104 | 105 | TEST(WeakPtr, MultipleLock) { 106 | using namespace std::chrono_literals; 107 | using std::chrono::system_clock; 108 | 109 | static std::atomic_int g_i; 110 | struct TestLock { 111 | void inc() { ++g_i; } 112 | mapbox::base::WeakPtrFactory factory_{this}; 113 | }; 114 | 115 | std::time_t now = system_clock::to_time_t(system_clock::now()); 116 | 117 | struct std::tm* tm = std::localtime(&now); 118 | ++tm->tm_sec; // Wait for the next second. 119 | auto nextSecond = system_clock::from_time_t(mktime(tm)); 120 | 121 | auto t = std::make_unique(); 122 | 123 | const size_t threadsCount = 50u; 124 | 125 | std::vector threads; 126 | threads.reserve(threadsCount); 127 | 128 | for (size_t i = 0; i < threadsCount; ++i) { 129 | std::thread thread([nextSecond, weak = t->factory_.makeWeakPtr()] { 130 | auto guard = weak.lock(); 131 | std::this_thread::sleep_until(nextSecond); 132 | weak->inc(); 133 | }); 134 | threads.emplace_back(std::move(thread)); 135 | } 136 | 137 | t.reset(); 138 | for (auto& thread : threads) { 139 | thread.join(); 140 | } 141 | EXPECT_EQ(g_i, threadsCount); 142 | } 143 | 144 | TEST(WeakPtr, WeakMethod) { 145 | using namespace std::chrono_literals; 146 | static std::atomic_int g_i; 147 | class Test { 148 | public: 149 | void increaseGlobal(int delta) { g_i += delta; } 150 | std::function makeWeakIncreaseGlobal() { return factory_.makeWeakMethod(&Test::increaseGlobal); } 151 | 152 | private: 153 | mapbox::base::WeakPtrFactory factory_{this}; 154 | }; 155 | 156 | auto t = std::make_unique(); 157 | std::function weak1 = t->makeWeakIncreaseGlobal(); 158 | std::function weak2 = t->makeWeakIncreaseGlobal(); 159 | std::function weak3 = weak2; 160 | 161 | std::thread thread1([&] { weak1(1); }); 162 | std::thread thread2([&] { weak2(10); }); 163 | std::this_thread::sleep_for(50ms); 164 | weak3(100); 165 | 166 | t.reset(); // Should not crash. 167 | // The following calls are ignored. 168 | weak1(1); 169 | weak2(2); 170 | weak3(3); 171 | thread1.join(); 172 | thread2.join(); 173 | 174 | EXPECT_EQ(g_i, 111); 175 | } 176 | 177 | TEST(WeakPtr, WeakMethodBlock) { 178 | // NOLINTNEXTLINE(google-build-using-namespace) 179 | using namespace std::chrono; 180 | using namespace std::chrono_literals; 181 | static std::atomic_bool g_call_finished{false}; 182 | struct Test { 183 | void block(decltype(1ms) duration) { 184 | std::this_thread::sleep_for(duration); 185 | g_call_finished = true; 186 | } 187 | mapbox::base::WeakPtrFactory factory_{this}; 188 | }; 189 | 190 | auto t = std::make_unique(); 191 | auto weak = t->factory_.makeWeakMethod(&Test::block); 192 | auto first = high_resolution_clock::now(); 193 | 194 | std::thread thread([&] { weak(100ms); }); 195 | std::this_thread::sleep_for(10ms); 196 | t.reset(); // Deletion is blocked until weak(100ms) call returns. 197 | thread.join(); 198 | auto totalTime = duration_cast(high_resolution_clock::now() - first); 199 | 200 | EXPECT_TRUE(g_call_finished); 201 | EXPECT_GE(totalTime, 100ms); 202 | } 203 | -------------------------------------------------------------------------------- /test/test_defines.hpp.in: -------------------------------------------------------------------------------- 1 | #define TEST_BINARY_PATH "${TEST_BINARY_PATH}" -------------------------------------------------------------------------------- /test/util/type_wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include "mapbox/util/type_wrapper.hpp" 2 | 3 | #include 4 | 5 | using mapbox::base::TypeWrapper; 6 | 7 | namespace { 8 | 9 | class TestType { 10 | public: 11 | TestType() { str[0] = 'a'; } 12 | 13 | // Detect moves 14 | TestType(TestType&& t) noexcept : i1(t.i1 + 1), i2(t.i2 + 2) { str[0] = t.str[0] + 1; } 15 | 16 | TestType(const TestType&) = delete; 17 | TestType& operator=(const TestType&) = delete; 18 | 19 | int i1 = 0; 20 | int i2 = 1; 21 | char str[256] = {}; 22 | }; 23 | 24 | } // namespace 25 | 26 | TEST(TypeWrapper, Empty) { 27 | EXPECT_FALSE(TypeWrapper().has_value()); 28 | } 29 | 30 | TEST(TypeWrapper, BasicTypes) { 31 | TypeWrapper i = 3; 32 | EXPECT_TRUE(i.has_value()); 33 | EXPECT_EQ(i.get(), 3); 34 | 35 | auto iValue = i.get(); 36 | EXPECT_EQ(iValue, 3); 37 | 38 | EXPECT_TRUE(TypeWrapper(4).has_value()); 39 | EXPECT_EQ(TypeWrapper(4).get(), 4); 40 | 41 | TypeWrapper f = 6.2f; 42 | EXPECT_TRUE(f.has_value()); 43 | EXPECT_EQ(f.get(), 6.2f); 44 | 45 | const float fValue = f.get(); 46 | EXPECT_EQ(fValue, 6.2f); 47 | 48 | EXPECT_TRUE(TypeWrapper(1.0f).has_value()); 49 | EXPECT_EQ(TypeWrapper(1.0f).get(), 1.0f); 50 | 51 | TypeWrapper c = 'z'; 52 | EXPECT_TRUE(c.has_value()); 53 | EXPECT_EQ(c.get(), 'z'); 54 | 55 | EXPECT_TRUE(TypeWrapper('z').has_value()); 56 | EXPECT_EQ(TypeWrapper('z').get(), 'z'); 57 | } 58 | 59 | TEST(TypeWrapper, TypesMove) { 60 | TypeWrapper i = 3; 61 | EXPECT_TRUE(i.has_value()); 62 | 63 | TypeWrapper f = 6.2f; 64 | EXPECT_TRUE(f.has_value()); 65 | 66 | f = std::move(i); 67 | EXPECT_FALSE(i.has_value()); // NOLINT(bugprone-use-after-move) 68 | 69 | EXPECT_TRUE(f.has_value()); 70 | EXPECT_EQ(f.get(), 3); 71 | } 72 | 73 | TEST(TypeWrapper, SmallType) { 74 | struct T { 75 | explicit T(int32_t* p_) : p(p_) { (*p)++; } 76 | 77 | T(T&& t) noexcept : p(t.p) { (*p)++; } 78 | 79 | ~T() { (*p)--; } 80 | 81 | T(const T&) = delete; 82 | T& operator=(const T&) = delete; 83 | 84 | int32_t* p; 85 | }; 86 | 87 | int32_t p = 0; 88 | 89 | { 90 | TypeWrapper u1 = TypeWrapper(T(&p)); 91 | EXPECT_EQ(p, 1); 92 | 93 | auto u2(std::move(u1)); 94 | EXPECT_EQ(p, 1); 95 | } 96 | 97 | EXPECT_EQ(p, 0); 98 | } 99 | 100 | TEST(TypeWrapper, LargeType) { 101 | TestType t1; 102 | TypeWrapper u1 = TypeWrapper(std::move(t1)); 103 | EXPECT_TRUE(u1.has_value()); 104 | 105 | // TestType should be moved into owning TypeWrapper 106 | EXPECT_EQ(u1.get().i1, 1); 107 | 108 | auto u2(std::move(u1)); 109 | EXPECT_FALSE(u1.has_value()); // NOLINT(bugprone-use-after-move) 110 | 111 | // TestType should not be moved when owning TypeWrapper is moved; 112 | EXPECT_EQ(u2.get().i1, 1); 113 | 114 | // TestType should not be moved out of owning TypeWrapper 115 | auto& t2 = u2.get(); 116 | EXPECT_TRUE(u2.has_value()); 117 | EXPECT_EQ(t2.i1, 1); 118 | } 119 | 120 | TEST(TypeWrapper, Pointer) { 121 | auto* t1 = new TestType(); // NOLINT cppcoreguidelines-owning-memory 122 | 123 | auto u1 = TypeWrapper(t1); 124 | EXPECT_TRUE(u1.has_value()); 125 | 126 | // Only the pointer should be moved 127 | TestType* t2 = u1.get(); // NOLINT cppcoreguidelines-owning-memory 128 | EXPECT_EQ(t2->i1, 0); 129 | 130 | TypeWrapper u2(4); 131 | std::swap(u2, u1); 132 | 133 | EXPECT_TRUE(u1.has_value()); 134 | EXPECT_TRUE(u2.has_value()); 135 | 136 | t2 = u2.get(); 137 | EXPECT_EQ(t2->i1, 0); 138 | delete t2; // NOLINT cppcoreguidelines-owning-memory 139 | } 140 | 141 | TEST(TypeWrapper, UniquePtr) { 142 | auto t1 = std::make_unique(); 143 | auto u1 = TypeWrapper(std::move(t1)); 144 | 145 | EXPECT_EQ(t1, nullptr); 146 | EXPECT_TRUE(u1.has_value()); 147 | 148 | u1 = TypeWrapper(); 149 | EXPECT_FALSE(u1.has_value()); 150 | 151 | TypeWrapper u2; 152 | auto* t3 = new TestType(); // NOLINT cppcoreguidelines-owning-memory 153 | u2 = std::unique_ptr(t3); 154 | EXPECT_TRUE(u2.has_value()); 155 | } 156 | 157 | TEST(TypeWrapper, SharedPtr) { 158 | std::shared_ptr shared(new int(3)); 159 | std::weak_ptr weak = shared; 160 | TypeWrapper u1 = 0; 161 | 162 | EXPECT_EQ(weak.use_count(), 1); 163 | TypeWrapper u2 = shared; 164 | EXPECT_EQ(weak.use_count(), 2); 165 | 166 | u1 = std::move(u2); 167 | EXPECT_EQ(weak.use_count(), 2); 168 | std::swap(u2, u1); 169 | EXPECT_EQ(weak.use_count(), 2); 170 | u2 = 0; 171 | EXPECT_EQ(weak.use_count(), 1); 172 | shared = nullptr; 173 | EXPECT_EQ(weak.use_count(), 0); 174 | } 175 | --------------------------------------------------------------------------------