@proteinjs/reflection-build 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/src/codegen/writeGeneratedIndex.js +9 -0
- package/dist/src/codegen/writeGeneratedIndex.js.map +1 -1
- package/dist/test/examples/source-repository/a/generated/index.js +1 -1
- package/dist/test/examples/source-repository/a/generated/index.js.map +1 -1
- package/dist/test/examples/source-repository/b/generated/index.js +1 -1
- package/dist/test/examples/source-repository/b/generated/index.js.map +1 -1
- package/package.json +4 -5
- package/src/codegen/writeGeneratedIndex.ts +12 -0
- package/test/examples/source-repository/a/dist/codegen/writeGeneratedIndex.js +9 -0
- package/test/examples/source-repository/a/dist/codegen/writeGeneratedIndex.js.map +1 -1
- package/test/examples/source-repository/a/dist/generated/index.js +1 -1
- package/test/examples/source-repository/a/dist/generated/index.js.map +1 -1
- package/test/examples/source-repository/a/generated/index.ts +33 -38
- package/test/examples/source-repository/a/node_modules/.package-lock.json +59 -6
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.eslintrc.js +20 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.prettierignore +4 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.prettierrc +8 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/CHANGELOG.md +58 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.d.ts +5 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.js +18 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.d.ts +19 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js +555 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.d.ts +3 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.js +5 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.d.ts +45 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js +176 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.d.ts +11 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js +9 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.d.ts +13 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js +19 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.d.ts +221 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.js +234 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.js.map +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/index.ts +5 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/jest.config.js +9 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/package.json +42 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/FlattenedSourceGraph.ts +702 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/Loadable.ts +2 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/SourceRepository.ts +250 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/SourceRepositoryFilter.ts +15 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/sourceGraphTypes.ts +14 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/types.ts +236 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/tsconfig.json +19 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/types/@dagrejs/graphlib.d.ts +1 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/CHANGELOG.md +13 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/Fs.d.ts +23 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/Fs.js +67 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/Fs.js.map +1 -1
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/GitUtil.d.ts +297 -10
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/GitUtil.js +349 -112
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/GitUtil.js.map +1 -1
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/cmd.d.ts +10 -1
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/cmd.js +91 -48
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/dist/src/cmd.js.map +1 -1
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/package.json +2 -2
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/src/Fs.ts +75 -0
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/src/GitUtil.ts +248 -110
- package/test/examples/source-repository/a/node_modules/@proteinjs/util-node/src/cmd.ts +84 -59
- package/test/examples/source-repository/a/node_modules/bindings/LICENSE.md +22 -0
- package/test/examples/source-repository/a/node_modules/bindings/README.md +98 -0
- package/test/examples/source-repository/a/node_modules/bindings/bindings.js +221 -0
- package/test/examples/source-repository/a/node_modules/bindings/package.json +28 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/.travis.yml +30 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/History.md +21 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/LICENSE +20 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/README.md +74 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/index.d.ts +2 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/index.js +66 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/package.json +32 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/test/test.js +24 -0
- package/test/examples/source-repository/a/node_modules/file-uri-to-path/test/tests.json +13 -0
- package/test/examples/source-repository/a/node_modules/fsevents/LICENSE +22 -0
- package/test/examples/source-repository/a/node_modules/fsevents/README.md +89 -0
- package/test/examples/source-repository/a/node_modules/fsevents/fsevents.d.ts +46 -0
- package/test/examples/source-repository/a/node_modules/fsevents/fsevents.js +83 -0
- package/test/examples/source-repository/a/node_modules/fsevents/fsevents.node +0 -0
- package/test/examples/source-repository/a/node_modules/fsevents/package.json +62 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/.travis.yml +103 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/ISSUE_TEMPLATE.md +8 -0
- package/{LICENSE → test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/LICENSE} +6 -5
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/Readme.md +78 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/binding.gyp +21 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/.target.mk +53 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Makefile +352 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/.node.d +1 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/obj.target/fse/fsevents.o.d.raw +75 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.node +0 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/binding.Makefile +6 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/fse.target.mk +188 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/gyp-mac-tool +772 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/fsevents.cc +88 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/fsevents.js +106 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/install.js +13 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/package.json +34 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/async.cc +43 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/constants.cc +110 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/methods.cc +44 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/storage.cc +27 -0
- package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/thread.cc +71 -0
- package/test/examples/source-repository/a/node_modules/nan/CHANGELOG.md +557 -0
- package/test/examples/source-repository/a/node_modules/nan/CMakeLists.txt +138 -0
- package/test/examples/source-repository/a/node_modules/nan/LICENSE.md +9 -0
- package/test/examples/source-repository/a/node_modules/nan/README.md +456 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/asyncworker.md +146 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/buffers.md +54 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/callback.md +76 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/converters.md +41 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/errors.md +226 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/json.md +62 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/maybe_types.md +583 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/methods.md +672 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/new.md +147 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/node_misc.md +123 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/object_wrappers.md +263 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/persistent.md +296 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/scopes.md +73 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/script.md +58 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/string_bytes.md +62 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/v8_internals.md +199 -0
- package/test/examples/source-repository/a/node_modules/nan/doc/v8_misc.md +85 -0
- package/test/examples/source-repository/a/node_modules/nan/include_dirs.js +1 -0
- package/test/examples/source-repository/a/node_modules/nan/nan.h +2958 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_callbacks.h +92 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_callbacks_12_inl.h +520 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_callbacks_pre_12_inl.h +520 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_converters.h +72 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_converters_43_inl.h +68 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_converters_pre_43_inl.h +42 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_define_own_property_helper.h +29 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_implementation_12_inl.h +430 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_implementation_pre_12_inl.h +263 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_json.h +166 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_maybe_43_inl.h +356 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_maybe_pre_43_inl.h +268 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_new.h +340 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_object_wrap.h +156 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_persistent_12_inl.h +132 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_persistent_pre_12_inl.h +242 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_private.h +73 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_scriptorigin.h +76 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_string_bytes.h +305 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_typedarray_contents.h +96 -0
- package/test/examples/source-repository/a/node_modules/nan/nan_weak.h +437 -0
- package/test/examples/source-repository/a/node_modules/nan/package.json +38 -0
- package/test/examples/source-repository/a/node_modules/nan/tools/1to2.js +412 -0
- package/test/examples/source-repository/a/node_modules/nan/tools/README.md +14 -0
- package/test/examples/source-repository/a/node_modules/nan/tools/package.json +19 -0
- package/test/examples/source-repository/a/package-lock.json +8 -8
- package/test/examples/source-repository/a/package.json +3 -3
- package/test/examples/source-repository/b/dist/codegen/writeGeneratedIndex.js +9 -0
- package/test/examples/source-repository/b/dist/codegen/writeGeneratedIndex.js.map +1 -1
- package/test/examples/source-repository/b/dist/generated/index.js +1 -1
- package/test/examples/source-repository/b/dist/generated/index.js.map +1 -1
- package/test/examples/source-repository/b/generated/index.ts +11 -10
- package/test/examples/source-repository/b/node_modules/.package-lock.json +57 -4
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.eslintrc.js +20 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.prettierignore +4 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.prettierrc +8 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/CHANGELOG.md +58 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.d.ts +5 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.js +18 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.d.ts +19 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js +555 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.d.ts +3 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.js +5 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.d.ts +45 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js +176 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.d.ts +11 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js +9 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.d.ts +13 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js +19 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.d.ts +221 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.js +234 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.js.map +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/index.ts +5 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/jest.config.js +9 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/package.json +42 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/FlattenedSourceGraph.ts +702 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/Loadable.ts +2 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/SourceRepository.ts +250 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/SourceRepositoryFilter.ts +15 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/sourceGraphTypes.ts +14 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/types.ts +236 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/tsconfig.json +19 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/types/@dagrejs/graphlib.d.ts +1 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/CHANGELOG.md +13 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/Fs.d.ts +23 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/Fs.js +67 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/Fs.js.map +1 -1
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/GitUtil.d.ts +297 -10
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/GitUtil.js +349 -112
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/GitUtil.js.map +1 -1
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/cmd.d.ts +10 -1
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/cmd.js +91 -48
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/dist/src/cmd.js.map +1 -1
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/package.json +2 -2
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/src/Fs.ts +75 -0
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/src/GitUtil.ts +248 -110
- package/test/examples/source-repository/b/node_modules/@proteinjs/util-node/src/cmd.ts +84 -59
- package/test/examples/source-repository/b/node_modules/bindings/LICENSE.md +22 -0
- package/test/examples/source-repository/b/node_modules/bindings/README.md +98 -0
- package/test/examples/source-repository/b/node_modules/bindings/bindings.js +221 -0
- package/test/examples/source-repository/b/node_modules/bindings/package.json +28 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/.travis.yml +30 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/History.md +21 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/LICENSE +20 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/README.md +74 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/index.d.ts +2 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/index.js +66 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/package.json +32 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/test/test.js +24 -0
- package/test/examples/source-repository/b/node_modules/file-uri-to-path/test/tests.json +13 -0
- package/test/examples/source-repository/b/node_modules/fsevents/LICENSE +22 -0
- package/test/examples/source-repository/b/node_modules/fsevents/README.md +89 -0
- package/test/examples/source-repository/b/node_modules/fsevents/fsevents.d.ts +46 -0
- package/test/examples/source-repository/b/node_modules/fsevents/fsevents.js +83 -0
- package/test/examples/source-repository/b/node_modules/fsevents/fsevents.node +0 -0
- package/test/examples/source-repository/b/node_modules/fsevents/package.json +62 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/.travis.yml +103 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/ISSUE_TEMPLATE.md +8 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/LICENSE +22 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/Readme.md +78 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/binding.gyp +21 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/.target.mk +53 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Makefile +352 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/.node.d +1 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/obj.target/fse/fsevents.o.d.raw +75 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.node +0 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/binding.Makefile +6 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/fse.target.mk +188 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/gyp-mac-tool +772 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/fsevents.cc +88 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/fsevents.js +106 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/install.js +13 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/package.json +34 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/async.cc +43 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/constants.cc +110 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/methods.cc +44 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/storage.cc +27 -0
- package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/thread.cc +71 -0
- package/test/examples/source-repository/b/node_modules/nan/CHANGELOG.md +557 -0
- package/test/examples/source-repository/b/node_modules/nan/CMakeLists.txt +138 -0
- package/test/examples/source-repository/b/node_modules/nan/LICENSE.md +9 -0
- package/test/examples/source-repository/b/node_modules/nan/README.md +456 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/asyncworker.md +146 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/buffers.md +54 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/callback.md +76 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/converters.md +41 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/errors.md +226 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/json.md +62 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/maybe_types.md +583 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/methods.md +672 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/new.md +147 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/node_misc.md +123 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/object_wrappers.md +263 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/persistent.md +296 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/scopes.md +73 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/script.md +58 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/string_bytes.md +62 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/v8_internals.md +199 -0
- package/test/examples/source-repository/b/node_modules/nan/doc/v8_misc.md +85 -0
- package/test/examples/source-repository/b/node_modules/nan/include_dirs.js +1 -0
- package/test/examples/source-repository/b/node_modules/nan/nan.h +2958 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_callbacks.h +92 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_callbacks_12_inl.h +520 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_callbacks_pre_12_inl.h +520 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_converters.h +72 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_converters_43_inl.h +68 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_converters_pre_43_inl.h +42 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_define_own_property_helper.h +29 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_implementation_12_inl.h +430 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_implementation_pre_12_inl.h +263 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_json.h +166 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_maybe_43_inl.h +356 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_maybe_pre_43_inl.h +268 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_new.h +340 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_object_wrap.h +156 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_persistent_12_inl.h +132 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_persistent_pre_12_inl.h +242 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_private.h +73 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_scriptorigin.h +76 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_string_bytes.h +305 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_typedarray_contents.h +96 -0
- package/test/examples/source-repository/b/node_modules/nan/nan_weak.h +437 -0
- package/test/examples/source-repository/b/node_modules/nan/package.json +38 -0
- package/test/examples/source-repository/b/node_modules/nan/tools/1to2.js +412 -0
- package/test/examples/source-repository/b/node_modules/nan/tools/README.md +14 -0
- package/test/examples/source-repository/b/node_modules/nan/tools/package.json +19 -0
- package/test/examples/source-repository/b/package-lock.json +6 -6
- package/test/examples/source-repository/b/package.json +3 -3
|
@@ -1,93 +1,155 @@
|
|
|
1
1
|
import { cmd } from './cmd';
|
|
2
|
+
import type { LogOptions } from './cmd';
|
|
3
|
+
|
|
4
|
+
type LogPassThrough = { log?: LogOptions };
|
|
5
|
+
|
|
6
|
+
const DEFAULT_SILENT_LOG: LogOptions = {
|
|
7
|
+
omitLogs: {
|
|
8
|
+
stdout: { omit: true },
|
|
9
|
+
stderr: { omit: true },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
2
12
|
|
|
3
13
|
export class GitUtil {
|
|
4
|
-
static async cloneAppTemplatePackages(directory: string): Promise<void> {
|
|
5
|
-
const args = ['clone', 'https://github.com/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
envVars = { cwd: directory };
|
|
9
|
-
}
|
|
10
|
-
await cmd('git', args, envVars);
|
|
14
|
+
static async cloneAppTemplatePackages(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
15
|
+
const args = ['clone', 'https://github.com/proteinjs/app-template.git', directory];
|
|
16
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
17
|
+
await cmd('git', args, env, opts?.log);
|
|
11
18
|
}
|
|
12
19
|
|
|
13
|
-
static async init(directory: string): Promise<void> {
|
|
20
|
+
static async init(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
14
21
|
const args = ['init'];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
envVars = { cwd: directory };
|
|
18
|
-
}
|
|
19
|
-
await cmd('git', args, envVars);
|
|
22
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
23
|
+
await cmd('git', args, env, opts?.log);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
static async setRemote(directory: string, remote: string): Promise<void> {
|
|
26
|
+
static async setRemote(directory: string, remote: string, opts?: LogPassThrough): Promise<void> {
|
|
23
27
|
const args = ['remote', 'set-url', 'origin', remote];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
envVars = { cwd: directory };
|
|
27
|
-
}
|
|
28
|
-
await cmd('git', args, envVars);
|
|
28
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
29
|
+
await cmd('git', args, env, opts?.log);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
static async addRemote(directory: string, remote: string): Promise<void> {
|
|
32
|
+
static async addRemote(directory: string, remote: string, opts?: LogPassThrough): Promise<void> {
|
|
32
33
|
const args = ['remote', 'add', 'origin', remote];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
envVars = { cwd: directory };
|
|
36
|
-
}
|
|
37
|
-
await cmd('git', args, envVars);
|
|
34
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
35
|
+
await cmd('git', args, env, opts?.log);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
static async commit(directory: string, message: string): Promise<void> {
|
|
38
|
+
static async commit(directory: string, message: string, opts?: LogPassThrough): Promise<void> {
|
|
41
39
|
const args = ['commit', '-m', message];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
envVars = { cwd: directory };
|
|
45
|
-
}
|
|
46
|
-
await cmd('git', args, envVars);
|
|
40
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
41
|
+
await cmd('git', args, env, opts?.log);
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
static async pull(directory: string): Promise<void> {
|
|
44
|
+
static async pull(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
50
45
|
const args = ['pull'];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
envVars = { cwd: directory };
|
|
54
|
-
}
|
|
55
|
-
await cmd('git', args, envVars);
|
|
46
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
47
|
+
await cmd('git', args, env, opts?.log);
|
|
56
48
|
}
|
|
57
49
|
|
|
58
|
-
static async push(directory: string): Promise<void> {
|
|
50
|
+
static async push(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
59
51
|
const args = ['push'];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
envVars = { cwd: directory };
|
|
63
|
-
}
|
|
64
|
-
await cmd('git', args, envVars);
|
|
52
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
53
|
+
await cmd('git', args, env, opts?.log);
|
|
65
54
|
}
|
|
66
55
|
|
|
67
|
-
static async status(directory: string): Promise<void> {
|
|
56
|
+
static async status(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
68
57
|
const args = ['status'];
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
59
|
+
await cmd('git', args, env, opts?.log);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static async addAll(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
63
|
+
const args = ['add', '-A'];
|
|
64
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
65
|
+
await cmd('git', args, env, opts?.log);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static async sync(directory: string, opts?: LogPassThrough): Promise<void> {
|
|
69
|
+
await GitUtil.pull(directory, opts);
|
|
70
|
+
await GitUtil.push(directory, opts);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Return the current branch name. */
|
|
74
|
+
static async currentBranch(directory: string, opts?: LogPassThrough): Promise<string> {
|
|
75
|
+
const args = ['rev-parse', '--abbrev-ref', 'HEAD'];
|
|
76
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
77
|
+
const { stdout } = await cmd('git', args, env, opts?.log);
|
|
78
|
+
return String(stdout ?? '').trim();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Return the current HEAD SHA. */
|
|
82
|
+
static async headSha(directory: string, opts?: LogPassThrough): Promise<string> {
|
|
83
|
+
const args = ['rev-parse', 'HEAD'];
|
|
84
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
85
|
+
const { stdout } = await cmd('git', args, env, opts?.log);
|
|
86
|
+
return String(stdout ?? '').trim();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Create and switch to a new branch. */
|
|
90
|
+
static async createBranch(directory: string, name: string, opts?: LogPassThrough): Promise<void> {
|
|
91
|
+
const args = ['checkout', '-b', name];
|
|
92
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
93
|
+
await cmd('git', args, env, opts?.log);
|
|
74
94
|
}
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
/** Checkout an existing branch. */
|
|
97
|
+
static async checkout(directory: string, name: string, opts?: LogPassThrough): Promise<void> {
|
|
98
|
+
const args = ['checkout', name];
|
|
99
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
100
|
+
await cmd('git', args, env, opts?.log);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Return a binary-safe patch between two refs (from..to). Defaults to no logging. */
|
|
104
|
+
static async diffPatch(directory: string, fromRef: string, toRef: string, opts?: LogPassThrough): Promise<string> {
|
|
105
|
+
const args = ['diff', '--binary', `${fromRef}..${toRef}`];
|
|
106
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
107
|
+
const log = opts?.log ?? DEFAULT_SILENT_LOG;
|
|
108
|
+
const { stdout } = await cmd('git', args, env, log);
|
|
109
|
+
return String(stdout ?? '');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Apply a patch to the working tree (stdin piped). Defaults to no logging.
|
|
114
|
+
* When `staged` is true, applies to the index only; otherwise as unstaged changes.
|
|
115
|
+
* When `reverse` is true, applies the patch in reverse.
|
|
116
|
+
*/
|
|
117
|
+
static async applyPatch(
|
|
118
|
+
directory: string,
|
|
119
|
+
patch: string,
|
|
120
|
+
opts: { staged?: boolean; reverse?: boolean; log?: LogOptions } = {}
|
|
121
|
+
): Promise<void> {
|
|
122
|
+
const args = ['apply', '--whitespace=nowarn'];
|
|
123
|
+
if (opts.reverse) {
|
|
124
|
+
args.push('--reverse');
|
|
125
|
+
}
|
|
126
|
+
if (opts.staged) {
|
|
127
|
+
args.push('--cached');
|
|
81
128
|
}
|
|
82
|
-
|
|
129
|
+
args.push('-'); // read patch from stdin
|
|
130
|
+
const env = directory ? { cwd: directory } : undefined;
|
|
131
|
+
const baseLog = opts.log ?? DEFAULT_SILENT_LOG;
|
|
132
|
+
await cmd('git', args, env, { ...baseLog, stdin: patch });
|
|
83
133
|
}
|
|
84
134
|
|
|
85
|
-
static async
|
|
86
|
-
|
|
87
|
-
|
|
135
|
+
static async hasStagedChanges(directory: string, opts?: LogPassThrough): Promise<boolean> {
|
|
136
|
+
// exit 0 => no staged changes; non-zero => there are staged changes
|
|
137
|
+
try {
|
|
138
|
+
await cmd(
|
|
139
|
+
'git',
|
|
140
|
+
['diff', '--cached', '--quiet'],
|
|
141
|
+
directory ? { cwd: directory } : {},
|
|
142
|
+
opts?.log ?? DEFAULT_SILENT_LOG
|
|
143
|
+
);
|
|
144
|
+
return false;
|
|
145
|
+
} catch {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
88
148
|
}
|
|
89
149
|
}
|
|
90
150
|
|
|
151
|
+
/* ---------- exported function wrappers (unchanged public API) ---------- */
|
|
152
|
+
|
|
91
153
|
export const cloneAppTemplatePackagesFunctionName = 'cloneAppTemplatePackages';
|
|
92
154
|
export const cloneAppTemplatePackagesFunction = {
|
|
93
155
|
definition: {
|
|
@@ -96,10 +158,7 @@ export const cloneAppTemplatePackagesFunction = {
|
|
|
96
158
|
parameters: {
|
|
97
159
|
type: 'object',
|
|
98
160
|
properties: {
|
|
99
|
-
directory: {
|
|
100
|
-
type: 'string',
|
|
101
|
-
description: 'The directory to clone the packages to',
|
|
102
|
-
},
|
|
161
|
+
directory: { type: 'string', description: 'The directory to clone the packages to' },
|
|
103
162
|
},
|
|
104
163
|
required: ['directory'],
|
|
105
164
|
},
|
|
@@ -115,10 +174,7 @@ export const initFunction = {
|
|
|
115
174
|
parameters: {
|
|
116
175
|
type: 'object',
|
|
117
176
|
properties: {
|
|
118
|
-
directory: {
|
|
119
|
-
type: 'string',
|
|
120
|
-
description: 'The directory to initialize the git repository in',
|
|
121
|
-
},
|
|
177
|
+
directory: { type: 'string', description: 'The directory to initialize the git repository in' },
|
|
122
178
|
},
|
|
123
179
|
required: ['directory'],
|
|
124
180
|
},
|
|
@@ -134,14 +190,8 @@ export const setRemoteFunction = {
|
|
|
134
190
|
parameters: {
|
|
135
191
|
type: 'object',
|
|
136
192
|
properties: {
|
|
137
|
-
directory: {
|
|
138
|
-
|
|
139
|
-
description: 'The directory of the git repository',
|
|
140
|
-
},
|
|
141
|
-
remote: {
|
|
142
|
-
type: 'string',
|
|
143
|
-
description: 'The remote to set',
|
|
144
|
-
},
|
|
193
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
194
|
+
remote: { type: 'string', description: 'The remote to set' },
|
|
145
195
|
},
|
|
146
196
|
required: ['directory', 'remote'],
|
|
147
197
|
},
|
|
@@ -158,14 +208,8 @@ export const addRemoteFunction = {
|
|
|
158
208
|
parameters: {
|
|
159
209
|
type: 'object',
|
|
160
210
|
properties: {
|
|
161
|
-
directory: {
|
|
162
|
-
|
|
163
|
-
description: 'The directory of the git repository',
|
|
164
|
-
},
|
|
165
|
-
remote: {
|
|
166
|
-
type: 'string',
|
|
167
|
-
description: 'The remote to add',
|
|
168
|
-
},
|
|
211
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
212
|
+
remote: { type: 'string', description: 'The remote to add' },
|
|
169
213
|
},
|
|
170
214
|
required: ['directory', 'remote'],
|
|
171
215
|
},
|
|
@@ -182,14 +226,8 @@ export const commitFunction = {
|
|
|
182
226
|
parameters: {
|
|
183
227
|
type: 'object',
|
|
184
228
|
properties: {
|
|
185
|
-
directory: {
|
|
186
|
-
|
|
187
|
-
description: 'The directory of the git repository',
|
|
188
|
-
},
|
|
189
|
-
message: {
|
|
190
|
-
type: 'string',
|
|
191
|
-
description: 'The commit message',
|
|
192
|
-
},
|
|
229
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
230
|
+
message: { type: 'string', description: 'The commit message' },
|
|
193
231
|
},
|
|
194
232
|
required: ['directory', 'message'],
|
|
195
233
|
},
|
|
@@ -206,10 +244,7 @@ export const pullFunction = {
|
|
|
206
244
|
parameters: {
|
|
207
245
|
type: 'object',
|
|
208
246
|
properties: {
|
|
209
|
-
directory: {
|
|
210
|
-
type: 'string',
|
|
211
|
-
description: 'The directory of the git repository',
|
|
212
|
-
},
|
|
247
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
213
248
|
},
|
|
214
249
|
required: ['directory'],
|
|
215
250
|
},
|
|
@@ -225,10 +260,7 @@ export const pushFunction = {
|
|
|
225
260
|
parameters: {
|
|
226
261
|
type: 'object',
|
|
227
262
|
properties: {
|
|
228
|
-
directory: {
|
|
229
|
-
type: 'string',
|
|
230
|
-
description: 'The directory of the git repository',
|
|
231
|
-
},
|
|
263
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
232
264
|
},
|
|
233
265
|
required: ['directory'],
|
|
234
266
|
},
|
|
@@ -244,10 +276,7 @@ export const statusFunction = {
|
|
|
244
276
|
parameters: {
|
|
245
277
|
type: 'object',
|
|
246
278
|
properties: {
|
|
247
|
-
directory: {
|
|
248
|
-
type: 'string',
|
|
249
|
-
description: 'The directory of the git repository',
|
|
250
|
-
},
|
|
279
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
251
280
|
},
|
|
252
281
|
required: ['directory'],
|
|
253
282
|
},
|
|
@@ -263,10 +292,7 @@ export const addAllFunction = {
|
|
|
263
292
|
parameters: {
|
|
264
293
|
type: 'object',
|
|
265
294
|
properties: {
|
|
266
|
-
directory: {
|
|
267
|
-
type: 'string',
|
|
268
|
-
description: 'The directory of the git repository',
|
|
269
|
-
},
|
|
295
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
270
296
|
},
|
|
271
297
|
required: ['directory'],
|
|
272
298
|
},
|
|
@@ -282,10 +308,7 @@ export const syncFunction = {
|
|
|
282
308
|
parameters: {
|
|
283
309
|
type: 'object',
|
|
284
310
|
properties: {
|
|
285
|
-
directory: {
|
|
286
|
-
type: 'string',
|
|
287
|
-
description: 'The directory of the git repository',
|
|
288
|
-
},
|
|
311
|
+
directory: { type: 'string', description: 'The directory of the git repository' },
|
|
289
312
|
},
|
|
290
313
|
required: ['directory'],
|
|
291
314
|
},
|
|
@@ -293,6 +316,115 @@ export const syncFunction = {
|
|
|
293
316
|
call: async (params: { directory: string }) => await GitUtil.sync(params.directory),
|
|
294
317
|
};
|
|
295
318
|
|
|
319
|
+
export const currentBranchFunctionName = 'gitCurrentBranch';
|
|
320
|
+
export const currentBranchFunction = {
|
|
321
|
+
definition: {
|
|
322
|
+
name: currentBranchFunctionName,
|
|
323
|
+
description: 'Get the current branch name',
|
|
324
|
+
parameters: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
properties: {
|
|
327
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
328
|
+
},
|
|
329
|
+
required: ['directory'],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
call: async (params: { directory: string }) => await GitUtil.currentBranch(params.directory),
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export const headShaFunctionName = 'gitHeadSha';
|
|
336
|
+
export const headShaFunction = {
|
|
337
|
+
definition: {
|
|
338
|
+
name: headShaFunctionName,
|
|
339
|
+
description: 'Get the SHA of HEAD',
|
|
340
|
+
parameters: {
|
|
341
|
+
type: 'object',
|
|
342
|
+
properties: {
|
|
343
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
344
|
+
},
|
|
345
|
+
required: ['directory'],
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
call: async (params: { directory: string }) => await GitUtil.headSha(params.directory),
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export const createBranchFunctionName = 'gitCreateBranch';
|
|
352
|
+
export const createBranchFunction = {
|
|
353
|
+
definition: {
|
|
354
|
+
name: createBranchFunctionName,
|
|
355
|
+
description: 'Create and switch to a new branch',
|
|
356
|
+
parameters: {
|
|
357
|
+
type: 'object',
|
|
358
|
+
properties: {
|
|
359
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
360
|
+
name: { type: 'string', description: 'Branch name' },
|
|
361
|
+
},
|
|
362
|
+
required: ['directory', 'name'],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
call: async (params: { directory: string; name: string }) =>
|
|
366
|
+
await GitUtil.createBranch(params.directory, params.name),
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export const checkoutFunctionName = 'gitCheckout';
|
|
370
|
+
export const checkoutFunction = {
|
|
371
|
+
definition: {
|
|
372
|
+
name: checkoutFunctionName,
|
|
373
|
+
description: 'Checkout an existing branch',
|
|
374
|
+
parameters: {
|
|
375
|
+
type: 'object',
|
|
376
|
+
properties: {
|
|
377
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
378
|
+
name: { type: 'string', description: 'Branch name' },
|
|
379
|
+
},
|
|
380
|
+
required: ['directory', 'name'],
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
call: async (params: { directory: string; name: string }) => await GitUtil.checkout(params.directory, params.name),
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const diffPatchFunctionName = 'gitDiffPatch';
|
|
387
|
+
export const diffPatchFunction = {
|
|
388
|
+
definition: {
|
|
389
|
+
name: diffPatchFunctionName,
|
|
390
|
+
description: 'Return a binary-safe patch between two refs (from..to)',
|
|
391
|
+
parameters: {
|
|
392
|
+
type: 'object',
|
|
393
|
+
properties: {
|
|
394
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
395
|
+
from: { type: 'string', description: 'From ref' },
|
|
396
|
+
to: { type: 'string', description: 'To ref' },
|
|
397
|
+
},
|
|
398
|
+
required: ['directory', 'from', 'to'],
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
call: async (params: { directory: string; from: string; to: string }) =>
|
|
402
|
+
await GitUtil.diffPatch(params.directory, params.from, params.to),
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const applyPatchFunctionName = 'gitApplyPatch';
|
|
406
|
+
export const applyPatchFunction = {
|
|
407
|
+
definition: {
|
|
408
|
+
name: applyPatchFunctionName,
|
|
409
|
+
description: 'Apply a patch to the working tree',
|
|
410
|
+
parameters: {
|
|
411
|
+
type: 'object',
|
|
412
|
+
properties: {
|
|
413
|
+
directory: { type: 'string', description: 'Repository directory' },
|
|
414
|
+
patch: { type: 'string', description: 'Patch content' },
|
|
415
|
+
reverse: { type: 'boolean', description: 'Apply in reverse', default: false },
|
|
416
|
+
staged: { type: 'boolean', description: 'Apply to index/staged only', default: false },
|
|
417
|
+
},
|
|
418
|
+
required: ['directory', 'patch'],
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
call: async (params: { directory: string; patch: string; reverse?: boolean; staged?: boolean }) =>
|
|
422
|
+
await GitUtil.applyPatch(params.directory, params.patch, {
|
|
423
|
+
reverse: !!params.reverse,
|
|
424
|
+
staged: !!params.staged,
|
|
425
|
+
}),
|
|
426
|
+
};
|
|
427
|
+
|
|
296
428
|
export const gitFunctions = [
|
|
297
429
|
cloneAppTemplatePackagesFunction,
|
|
298
430
|
initFunction,
|
|
@@ -304,4 +436,10 @@ export const gitFunctions = [
|
|
|
304
436
|
statusFunction,
|
|
305
437
|
addAllFunction,
|
|
306
438
|
syncFunction,
|
|
439
|
+
currentBranchFunction,
|
|
440
|
+
headShaFunction,
|
|
441
|
+
createBranchFunction,
|
|
442
|
+
checkoutFunction,
|
|
443
|
+
diffPatchFunction,
|
|
444
|
+
applyPatchFunction,
|
|
307
445
|
];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as ChildProcess from 'child_process';
|
|
2
2
|
|
|
3
3
|
export type LogOptions = {
|
|
4
|
+
/** Prefix each printed line with this string (cosmetic only). */
|
|
4
5
|
logPrefix?: string;
|
|
6
|
+
/** Optional data to write to the child process stdin, then end() it. */
|
|
7
|
+
stdin?: string | Buffer;
|
|
5
8
|
omitLogs?: {
|
|
6
9
|
stdout?: {
|
|
7
10
|
omit?: boolean;
|
|
@@ -16,9 +19,15 @@ export type LogOptions = {
|
|
|
16
19
|
};
|
|
17
20
|
};
|
|
18
21
|
|
|
22
|
+
export type CmdResult = {
|
|
23
|
+
code: number;
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
19
28
|
export async function cmd(
|
|
20
29
|
command: string,
|
|
21
|
-
args
|
|
30
|
+
args: readonly string[] = [],
|
|
22
31
|
options:
|
|
23
32
|
| ChildProcess.SpawnOptionsWithoutStdio
|
|
24
33
|
| ChildProcess.SpawnOptionsWithStdioTuple<
|
|
@@ -27,72 +36,88 @@ export async function cmd(
|
|
|
27
36
|
ChildProcess.StdioPipe | ChildProcess.StdioNull
|
|
28
37
|
> = {},
|
|
29
38
|
logOptions?: LogOptions
|
|
30
|
-
) {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
cwd: process.cwd(),
|
|
37
|
-
},
|
|
38
|
-
options
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
p.stdout?.on('data', (x: any) => {
|
|
43
|
-
if (
|
|
44
|
-
logOptions?.omitLogs?.stdout?.omit ||
|
|
45
|
-
(logOptions?.omitLogs?.stdout?.shouldOmit && logOptions.omitLogs.stdout.shouldOmit())
|
|
46
|
-
) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
39
|
+
): Promise<CmdResult> {
|
|
40
|
+
const proc = ChildProcess.spawn(command, [...args], {
|
|
41
|
+
cwd: process.cwd(),
|
|
42
|
+
...options,
|
|
43
|
+
});
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
45
|
+
// Use Uint8Array[] to satisfy Buffer.concat's typings across Node versions.
|
|
46
|
+
const stdoutChunks: Uint8Array[] = [];
|
|
47
|
+
const stderrChunks: Uint8Array[] = [];
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(logOptions?.omitLogs?.stderr?.shouldOmit && logOptions.omitLogs.stderr.shouldOmit())
|
|
62
|
-
) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
49
|
+
const omitStdout = () =>
|
|
50
|
+
!!(
|
|
51
|
+
logOptions?.omitLogs?.stdout?.omit ||
|
|
52
|
+
(logOptions?.omitLogs?.stdout?.shouldOmit && logOptions.omitLogs.stdout.shouldOmit())
|
|
53
|
+
);
|
|
65
54
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
const omitStderr = () =>
|
|
56
|
+
!!(
|
|
57
|
+
logOptions?.omitLogs?.stderr?.omit ||
|
|
58
|
+
(logOptions?.omitLogs?.stderr?.shouldOmit && logOptions.omitLogs.stderr.shouldOmit())
|
|
59
|
+
);
|
|
71
60
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
(logOptions?.omitLogs?.stderr?.shouldOmit && logOptions.omitLogs.stderr.shouldOmit())
|
|
78
|
-
) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
61
|
+
// If caller provided stdin data, write it immediately then end().
|
|
62
|
+
if (logOptions?.stdin !== undefined && proc.stdin) {
|
|
63
|
+
proc.stdin.write(logOptions.stdin);
|
|
64
|
+
proc.stdin.end();
|
|
65
|
+
}
|
|
81
66
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
67
|
+
proc.stdout?.on('data', (chunk: Uint8Array) => {
|
|
68
|
+
stdoutChunks.push(chunk);
|
|
69
|
+
if (omitStdout()) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const raw = Buffer.from(chunk).toString();
|
|
73
|
+
const filtered = logOptions?.omitLogs?.stdout?.filter ? logOptions.omitLogs.stdout.filter(raw) : raw;
|
|
74
|
+
if (filtered) {
|
|
75
|
+
process.stdout.write(prefixLog(filtered, logOptions?.logPrefix));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
87
78
|
|
|
88
|
-
|
|
79
|
+
proc.stderr?.on('data', (chunk: Uint8Array) => {
|
|
80
|
+
stderrChunks.push(chunk);
|
|
81
|
+
if (omitStderr()) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const raw = Buffer.from(chunk).toString();
|
|
85
|
+
const filtered = logOptions?.omitLogs?.stderr?.filter ? logOptions.omitLogs.stderr.filter(raw) : raw;
|
|
86
|
+
if (filtered) {
|
|
87
|
+
process.stderr.write(prefixLog(filtered, logOptions?.logPrefix));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return await new Promise<CmdResult>((resolve, reject) => {
|
|
92
|
+
proc.once('error', (err) => {
|
|
93
|
+
const stderr = Buffer.concat(stderrChunks as readonly Uint8Array[]).toString();
|
|
94
|
+
const stdout = Buffer.concat(stdoutChunks as readonly Uint8Array[]).toString();
|
|
95
|
+
const e = new Error(`spawn error for '${command} ${args.join(' ')}': ${String(err)}`) as Error & {
|
|
96
|
+
stdout?: string;
|
|
97
|
+
stderr?: string;
|
|
98
|
+
};
|
|
99
|
+
e.stdout = stdout;
|
|
100
|
+
e.stderr = stderr;
|
|
101
|
+
reject(e);
|
|
89
102
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
|
|
104
|
+
// Use 'close' to ensure stdio is flushed
|
|
105
|
+
proc.once('close', (code, signal) => {
|
|
106
|
+
const stdout = Buffer.concat(stdoutChunks as readonly Uint8Array[]).toString();
|
|
107
|
+
const stderr = Buffer.concat(stderrChunks as readonly Uint8Array[]).toString();
|
|
108
|
+
const exitCode = typeof code === 'number' ? code : -1;
|
|
109
|
+
|
|
110
|
+
if (exitCode === 0) {
|
|
111
|
+
resolve({ code: exitCode, stdout, stderr });
|
|
94
112
|
} else {
|
|
95
|
-
|
|
113
|
+
const msg = signal
|
|
114
|
+
? `process '${command} ${args.join(' ')}' terminated by signal: ${signal}`
|
|
115
|
+
: `process '${command} ${args.join(' ')}' exited with code: ${exitCode}`;
|
|
116
|
+
const err = new Error(msg) as Error & { code: number; stdout: string; stderr: string };
|
|
117
|
+
err.code = exitCode;
|
|
118
|
+
err.stdout = stdout;
|
|
119
|
+
err.stderr = stderr;
|
|
120
|
+
reject(err);
|
|
96
121
|
}
|
|
97
122
|
});
|
|
98
123
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|