@proteinjs/reflection-build 1.4.6 → 1.4.7

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.
Files changed (275) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/{test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/LICENSE → LICENSE} +5 -6
  3. package/dist/src/runWatch.js +3 -30
  4. package/dist/src/runWatch.js.map +1 -1
  5. package/dist/src/watch.d.ts +1 -1
  6. package/dist/src/watch.js +39 -28
  7. package/dist/src/watch.js.map +1 -1
  8. package/dist/test/examples/source-repository/a/generated/index.js +1 -1
  9. package/dist/test/examples/source-repository/a/generated/index.js.map +1 -1
  10. package/dist/test/examples/source-repository/b/generated/index.js +1 -1
  11. package/dist/test/examples/source-repository/b/generated/index.js.map +1 -1
  12. package/package.json +4 -3
  13. package/src/runWatch.ts +3 -8
  14. package/src/watch.ts +44 -35
  15. package/test/examples/source-repository/a/dist/generated/index.js +1 -1
  16. package/test/examples/source-repository/a/dist/generated/index.js.map +1 -1
  17. package/test/examples/source-repository/a/generated/index.ts +38 -33
  18. package/test/examples/source-repository/a/node_modules/.package-lock.json +0 -57
  19. package/test/examples/source-repository/a/package-lock.json +0 -4
  20. package/test/examples/source-repository/a/package.json +1 -1
  21. package/test/examples/source-repository/b/dist/generated/index.js +1 -1
  22. package/test/examples/source-repository/b/dist/generated/index.js.map +1 -1
  23. package/test/examples/source-repository/b/generated/index.ts +10 -11
  24. package/test/examples/source-repository/b/node_modules/.package-lock.json +0 -57
  25. package/test/examples/source-repository/b/package-lock.json +0 -4
  26. package/test/examples/source-repository/b/package.json +1 -1
  27. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.eslintrc.js +0 -20
  28. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.prettierignore +0 -4
  29. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/.prettierrc +0 -8
  30. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/CHANGELOG.md +0 -58
  31. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.d.ts +0 -5
  32. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.js +0 -18
  33. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/index.js.map +0 -1
  34. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.d.ts +0 -19
  35. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js +0 -555
  36. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js.map +0 -1
  37. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.d.ts +0 -3
  38. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.js +0 -5
  39. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/Loadable.js.map +0 -1
  40. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.d.ts +0 -45
  41. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js +0 -176
  42. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js.map +0 -1
  43. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.d.ts +0 -11
  44. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js +0 -9
  45. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js.map +0 -1
  46. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.d.ts +0 -13
  47. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js +0 -19
  48. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js.map +0 -1
  49. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.d.ts +0 -221
  50. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.js +0 -234
  51. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/dist/src/types.js.map +0 -1
  52. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/index.ts +0 -5
  53. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/jest.config.js +0 -9
  54. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/package.json +0 -42
  55. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/FlattenedSourceGraph.ts +0 -702
  56. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/Loadable.ts +0 -2
  57. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/SourceRepository.ts +0 -250
  58. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/SourceRepositoryFilter.ts +0 -15
  59. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/sourceGraphTypes.ts +0 -14
  60. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/src/types.ts +0 -236
  61. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/tsconfig.json +0 -19
  62. package/test/examples/source-repository/a/node_modules/@proteinjs/reflection/types/@dagrejs/graphlib.d.ts +0 -1
  63. package/test/examples/source-repository/a/node_modules/bindings/LICENSE.md +0 -22
  64. package/test/examples/source-repository/a/node_modules/bindings/README.md +0 -98
  65. package/test/examples/source-repository/a/node_modules/bindings/bindings.js +0 -221
  66. package/test/examples/source-repository/a/node_modules/bindings/package.json +0 -28
  67. package/test/examples/source-repository/a/node_modules/file-uri-to-path/.travis.yml +0 -30
  68. package/test/examples/source-repository/a/node_modules/file-uri-to-path/History.md +0 -21
  69. package/test/examples/source-repository/a/node_modules/file-uri-to-path/LICENSE +0 -20
  70. package/test/examples/source-repository/a/node_modules/file-uri-to-path/README.md +0 -74
  71. package/test/examples/source-repository/a/node_modules/file-uri-to-path/index.d.ts +0 -2
  72. package/test/examples/source-repository/a/node_modules/file-uri-to-path/index.js +0 -66
  73. package/test/examples/source-repository/a/node_modules/file-uri-to-path/package.json +0 -32
  74. package/test/examples/source-repository/a/node_modules/file-uri-to-path/test/test.js +0 -24
  75. package/test/examples/source-repository/a/node_modules/file-uri-to-path/test/tests.json +0 -13
  76. package/test/examples/source-repository/a/node_modules/fsevents/LICENSE +0 -22
  77. package/test/examples/source-repository/a/node_modules/fsevents/README.md +0 -89
  78. package/test/examples/source-repository/a/node_modules/fsevents/fsevents.d.ts +0 -46
  79. package/test/examples/source-repository/a/node_modules/fsevents/fsevents.js +0 -83
  80. package/test/examples/source-repository/a/node_modules/fsevents/fsevents.node +0 -0
  81. package/test/examples/source-repository/a/node_modules/fsevents/package.json +0 -62
  82. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/.travis.yml +0 -103
  83. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/ISSUE_TEMPLATE.md +0 -8
  84. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/Readme.md +0 -78
  85. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/binding.gyp +0 -21
  86. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/.target.mk +0 -53
  87. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Makefile +0 -352
  88. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/.node.d +0 -1
  89. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/obj.target/fse/fsevents.o.d.raw +0 -79
  90. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/Release/.node +0 -0
  91. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/binding.Makefile +0 -6
  92. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/fse.target.mk +0 -191
  93. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/build/gyp-mac-tool +0 -766
  94. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/fsevents.cc +0 -88
  95. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/fsevents.js +0 -106
  96. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/install.js +0 -13
  97. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/package.json +0 -34
  98. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/async.cc +0 -43
  99. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/constants.cc +0 -110
  100. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/methods.cc +0 -44
  101. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/storage.cc +0 -27
  102. package/test/examples/source-repository/a/node_modules/glob-watcher/node_modules/fsevents/src/thread.cc +0 -71
  103. package/test/examples/source-repository/a/node_modules/nan/CHANGELOG.md +0 -557
  104. package/test/examples/source-repository/a/node_modules/nan/CMakeLists.txt +0 -138
  105. package/test/examples/source-repository/a/node_modules/nan/LICENSE.md +0 -9
  106. package/test/examples/source-repository/a/node_modules/nan/README.md +0 -456
  107. package/test/examples/source-repository/a/node_modules/nan/doc/asyncworker.md +0 -146
  108. package/test/examples/source-repository/a/node_modules/nan/doc/buffers.md +0 -54
  109. package/test/examples/source-repository/a/node_modules/nan/doc/callback.md +0 -76
  110. package/test/examples/source-repository/a/node_modules/nan/doc/converters.md +0 -41
  111. package/test/examples/source-repository/a/node_modules/nan/doc/errors.md +0 -226
  112. package/test/examples/source-repository/a/node_modules/nan/doc/json.md +0 -62
  113. package/test/examples/source-repository/a/node_modules/nan/doc/maybe_types.md +0 -583
  114. package/test/examples/source-repository/a/node_modules/nan/doc/methods.md +0 -672
  115. package/test/examples/source-repository/a/node_modules/nan/doc/new.md +0 -147
  116. package/test/examples/source-repository/a/node_modules/nan/doc/node_misc.md +0 -123
  117. package/test/examples/source-repository/a/node_modules/nan/doc/object_wrappers.md +0 -263
  118. package/test/examples/source-repository/a/node_modules/nan/doc/persistent.md +0 -296
  119. package/test/examples/source-repository/a/node_modules/nan/doc/scopes.md +0 -73
  120. package/test/examples/source-repository/a/node_modules/nan/doc/script.md +0 -58
  121. package/test/examples/source-repository/a/node_modules/nan/doc/string_bytes.md +0 -62
  122. package/test/examples/source-repository/a/node_modules/nan/doc/v8_internals.md +0 -199
  123. package/test/examples/source-repository/a/node_modules/nan/doc/v8_misc.md +0 -85
  124. package/test/examples/source-repository/a/node_modules/nan/include_dirs.js +0 -1
  125. package/test/examples/source-repository/a/node_modules/nan/nan.h +0 -2958
  126. package/test/examples/source-repository/a/node_modules/nan/nan_callbacks.h +0 -92
  127. package/test/examples/source-repository/a/node_modules/nan/nan_callbacks_12_inl.h +0 -520
  128. package/test/examples/source-repository/a/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  129. package/test/examples/source-repository/a/node_modules/nan/nan_converters.h +0 -72
  130. package/test/examples/source-repository/a/node_modules/nan/nan_converters_43_inl.h +0 -68
  131. package/test/examples/source-repository/a/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  132. package/test/examples/source-repository/a/node_modules/nan/nan_define_own_property_helper.h +0 -29
  133. package/test/examples/source-repository/a/node_modules/nan/nan_implementation_12_inl.h +0 -430
  134. package/test/examples/source-repository/a/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  135. package/test/examples/source-repository/a/node_modules/nan/nan_json.h +0 -166
  136. package/test/examples/source-repository/a/node_modules/nan/nan_maybe_43_inl.h +0 -356
  137. package/test/examples/source-repository/a/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  138. package/test/examples/source-repository/a/node_modules/nan/nan_new.h +0 -340
  139. package/test/examples/source-repository/a/node_modules/nan/nan_object_wrap.h +0 -156
  140. package/test/examples/source-repository/a/node_modules/nan/nan_persistent_12_inl.h +0 -132
  141. package/test/examples/source-repository/a/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  142. package/test/examples/source-repository/a/node_modules/nan/nan_private.h +0 -73
  143. package/test/examples/source-repository/a/node_modules/nan/nan_scriptorigin.h +0 -76
  144. package/test/examples/source-repository/a/node_modules/nan/nan_string_bytes.h +0 -305
  145. package/test/examples/source-repository/a/node_modules/nan/nan_typedarray_contents.h +0 -96
  146. package/test/examples/source-repository/a/node_modules/nan/nan_weak.h +0 -437
  147. package/test/examples/source-repository/a/node_modules/nan/package.json +0 -38
  148. package/test/examples/source-repository/a/node_modules/nan/tools/1to2.js +0 -412
  149. package/test/examples/source-repository/a/node_modules/nan/tools/README.md +0 -14
  150. package/test/examples/source-repository/a/node_modules/nan/tools/package.json +0 -19
  151. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.eslintrc.js +0 -20
  152. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.prettierignore +0 -4
  153. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/.prettierrc +0 -8
  154. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/CHANGELOG.md +0 -58
  155. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.d.ts +0 -5
  156. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.js +0 -18
  157. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/index.js.map +0 -1
  158. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.d.ts +0 -19
  159. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js +0 -555
  160. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/FlattenedSourceGraph.js.map +0 -1
  161. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.d.ts +0 -3
  162. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.js +0 -5
  163. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/Loadable.js.map +0 -1
  164. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.d.ts +0 -45
  165. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js +0 -176
  166. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepository.js.map +0 -1
  167. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.d.ts +0 -11
  168. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js +0 -9
  169. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/SourceRepositoryFilter.js.map +0 -1
  170. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.d.ts +0 -13
  171. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js +0 -19
  172. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/sourceGraphTypes.js.map +0 -1
  173. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.d.ts +0 -221
  174. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.js +0 -234
  175. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/dist/src/types.js.map +0 -1
  176. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/index.ts +0 -5
  177. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/jest.config.js +0 -9
  178. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/package.json +0 -42
  179. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/FlattenedSourceGraph.ts +0 -702
  180. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/Loadable.ts +0 -2
  181. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/SourceRepository.ts +0 -250
  182. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/SourceRepositoryFilter.ts +0 -15
  183. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/sourceGraphTypes.ts +0 -14
  184. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/src/types.ts +0 -236
  185. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/tsconfig.json +0 -19
  186. package/test/examples/source-repository/b/node_modules/@proteinjs/reflection/types/@dagrejs/graphlib.d.ts +0 -1
  187. package/test/examples/source-repository/b/node_modules/bindings/LICENSE.md +0 -22
  188. package/test/examples/source-repository/b/node_modules/bindings/README.md +0 -98
  189. package/test/examples/source-repository/b/node_modules/bindings/bindings.js +0 -221
  190. package/test/examples/source-repository/b/node_modules/bindings/package.json +0 -28
  191. package/test/examples/source-repository/b/node_modules/file-uri-to-path/.travis.yml +0 -30
  192. package/test/examples/source-repository/b/node_modules/file-uri-to-path/History.md +0 -21
  193. package/test/examples/source-repository/b/node_modules/file-uri-to-path/LICENSE +0 -20
  194. package/test/examples/source-repository/b/node_modules/file-uri-to-path/README.md +0 -74
  195. package/test/examples/source-repository/b/node_modules/file-uri-to-path/index.d.ts +0 -2
  196. package/test/examples/source-repository/b/node_modules/file-uri-to-path/index.js +0 -66
  197. package/test/examples/source-repository/b/node_modules/file-uri-to-path/package.json +0 -32
  198. package/test/examples/source-repository/b/node_modules/file-uri-to-path/test/test.js +0 -24
  199. package/test/examples/source-repository/b/node_modules/file-uri-to-path/test/tests.json +0 -13
  200. package/test/examples/source-repository/b/node_modules/fsevents/LICENSE +0 -22
  201. package/test/examples/source-repository/b/node_modules/fsevents/README.md +0 -89
  202. package/test/examples/source-repository/b/node_modules/fsevents/fsevents.d.ts +0 -46
  203. package/test/examples/source-repository/b/node_modules/fsevents/fsevents.js +0 -83
  204. package/test/examples/source-repository/b/node_modules/fsevents/fsevents.node +0 -0
  205. package/test/examples/source-repository/b/node_modules/fsevents/package.json +0 -62
  206. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/.travis.yml +0 -103
  207. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/ISSUE_TEMPLATE.md +0 -8
  208. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/LICENSE +0 -22
  209. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/Readme.md +0 -78
  210. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/binding.gyp +0 -21
  211. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/.target.mk +0 -53
  212. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Makefile +0 -352
  213. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/.node.d +0 -1
  214. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.deps/Release/obj.target/fse/fsevents.o.d.raw +0 -79
  215. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/Release/.node +0 -0
  216. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/binding.Makefile +0 -6
  217. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/fse.target.mk +0 -191
  218. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/build/gyp-mac-tool +0 -766
  219. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/fsevents.cc +0 -88
  220. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/fsevents.js +0 -106
  221. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/install.js +0 -13
  222. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/package.json +0 -34
  223. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/async.cc +0 -43
  224. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/constants.cc +0 -110
  225. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/methods.cc +0 -44
  226. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/storage.cc +0 -27
  227. package/test/examples/source-repository/b/node_modules/glob-watcher/node_modules/fsevents/src/thread.cc +0 -71
  228. package/test/examples/source-repository/b/node_modules/nan/CHANGELOG.md +0 -557
  229. package/test/examples/source-repository/b/node_modules/nan/CMakeLists.txt +0 -138
  230. package/test/examples/source-repository/b/node_modules/nan/LICENSE.md +0 -9
  231. package/test/examples/source-repository/b/node_modules/nan/README.md +0 -456
  232. package/test/examples/source-repository/b/node_modules/nan/doc/asyncworker.md +0 -146
  233. package/test/examples/source-repository/b/node_modules/nan/doc/buffers.md +0 -54
  234. package/test/examples/source-repository/b/node_modules/nan/doc/callback.md +0 -76
  235. package/test/examples/source-repository/b/node_modules/nan/doc/converters.md +0 -41
  236. package/test/examples/source-repository/b/node_modules/nan/doc/errors.md +0 -226
  237. package/test/examples/source-repository/b/node_modules/nan/doc/json.md +0 -62
  238. package/test/examples/source-repository/b/node_modules/nan/doc/maybe_types.md +0 -583
  239. package/test/examples/source-repository/b/node_modules/nan/doc/methods.md +0 -672
  240. package/test/examples/source-repository/b/node_modules/nan/doc/new.md +0 -147
  241. package/test/examples/source-repository/b/node_modules/nan/doc/node_misc.md +0 -123
  242. package/test/examples/source-repository/b/node_modules/nan/doc/object_wrappers.md +0 -263
  243. package/test/examples/source-repository/b/node_modules/nan/doc/persistent.md +0 -296
  244. package/test/examples/source-repository/b/node_modules/nan/doc/scopes.md +0 -73
  245. package/test/examples/source-repository/b/node_modules/nan/doc/script.md +0 -58
  246. package/test/examples/source-repository/b/node_modules/nan/doc/string_bytes.md +0 -62
  247. package/test/examples/source-repository/b/node_modules/nan/doc/v8_internals.md +0 -199
  248. package/test/examples/source-repository/b/node_modules/nan/doc/v8_misc.md +0 -85
  249. package/test/examples/source-repository/b/node_modules/nan/include_dirs.js +0 -1
  250. package/test/examples/source-repository/b/node_modules/nan/nan.h +0 -2958
  251. package/test/examples/source-repository/b/node_modules/nan/nan_callbacks.h +0 -92
  252. package/test/examples/source-repository/b/node_modules/nan/nan_callbacks_12_inl.h +0 -520
  253. package/test/examples/source-repository/b/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  254. package/test/examples/source-repository/b/node_modules/nan/nan_converters.h +0 -72
  255. package/test/examples/source-repository/b/node_modules/nan/nan_converters_43_inl.h +0 -68
  256. package/test/examples/source-repository/b/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  257. package/test/examples/source-repository/b/node_modules/nan/nan_define_own_property_helper.h +0 -29
  258. package/test/examples/source-repository/b/node_modules/nan/nan_implementation_12_inl.h +0 -430
  259. package/test/examples/source-repository/b/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  260. package/test/examples/source-repository/b/node_modules/nan/nan_json.h +0 -166
  261. package/test/examples/source-repository/b/node_modules/nan/nan_maybe_43_inl.h +0 -356
  262. package/test/examples/source-repository/b/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  263. package/test/examples/source-repository/b/node_modules/nan/nan_new.h +0 -340
  264. package/test/examples/source-repository/b/node_modules/nan/nan_object_wrap.h +0 -156
  265. package/test/examples/source-repository/b/node_modules/nan/nan_persistent_12_inl.h +0 -132
  266. package/test/examples/source-repository/b/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  267. package/test/examples/source-repository/b/node_modules/nan/nan_private.h +0 -73
  268. package/test/examples/source-repository/b/node_modules/nan/nan_scriptorigin.h +0 -76
  269. package/test/examples/source-repository/b/node_modules/nan/nan_string_bytes.h +0 -305
  270. package/test/examples/source-repository/b/node_modules/nan/nan_typedarray_contents.h +0 -96
  271. package/test/examples/source-repository/b/node_modules/nan/nan_weak.h +0 -437
  272. package/test/examples/source-repository/b/node_modules/nan/package.json +0 -38
  273. package/test/examples/source-repository/b/node_modules/nan/tools/1to2.js +0 -412
  274. package/test/examples/source-repository/b/node_modules/nan/tools/README.md +0 -14
  275. package/test/examples/source-repository/b/node_modules/nan/tools/package.json +0 -19
@@ -1,147 +0,0 @@
1
- ## New
2
-
3
- NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8.
4
-
5
- - <a href="#api_nan_new"><b><code>Nan::New()</code></b></a>
6
- - <a href="#api_nan_undefined"><b><code>Nan::Undefined()</code></b></a>
7
- - <a href="#api_nan_null"><b><code>Nan::Null()</code></b></a>
8
- - <a href="#api_nan_true"><b><code>Nan::True()</code></b></a>
9
- - <a href="#api_nan_false"><b><code>Nan::False()</code></b></a>
10
- - <a href="#api_nan_empty_string"><b><code>Nan::EmptyString()</code></b></a>
11
-
12
-
13
- <a name="api_nan_new"></a>
14
- ### Nan::New()
15
-
16
- `Nan::New()` should be used to instantiate new JavaScript objects.
17
-
18
- Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation.
19
-
20
- Signatures:
21
-
22
- Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local<T>`. The following types will be contained within a `Nan::MaybeLocal<T>`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`.
23
-
24
- Empty objects:
25
-
26
- ```c++
27
- Nan::New<T>();
28
- ```
29
-
30
- Generic single and multiple-argument:
31
-
32
- ```c++
33
- Nan::New<T>(A0 arg0);
34
- Nan::New<T>(A0 arg0, A1 arg1);
35
- Nan::New<T>(A0 arg0, A1 arg1, A2 arg2);
36
- Nan::New<T>(A0 arg0, A1 arg1, A2 arg2, A3 arg3);
37
- ```
38
-
39
- For creating `v8::FunctionTemplate` and `v8::Function` objects:
40
-
41
- _The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._
42
-
43
- ```c++
44
- Nan::New<T>(Nan::FunctionCallback callback,
45
- v8::Local<v8::Value> data = v8::Local<v8::Value>());
46
- Nan::New<T>(Nan::FunctionCallback callback,
47
- v8::Local<v8::Value> data = v8::Local<v8::Value>(),
48
- A2 a2 = A2());
49
- ```
50
-
51
- Native number types:
52
-
53
- ```c++
54
- v8::Local<v8::Boolean> Nan::New<T>(bool value);
55
- v8::Local<v8::Int32> Nan::New<T>(int32_t value);
56
- v8::Local<v8::Uint32> Nan::New<T>(uint32_t value);
57
- v8::Local<v8::Number> Nan::New<T>(double value);
58
- ```
59
-
60
- String types:
61
-
62
- ```c++
63
- Nan::MaybeLocal<v8::String> Nan::New<T>(std::string const& value);
64
- Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value, int length);
65
- Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value);
66
- Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value);
67
- Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value, int length);
68
- ```
69
-
70
- Specialized types:
71
-
72
- ```c++
73
- v8::Local<v8::String> Nan::New<T>(v8::String::ExternalStringResource * value);
74
- v8::Local<v8::String> Nan::New<T>(Nan::ExternalOneByteStringResource * value);
75
- v8::Local<v8::RegExp> Nan::New<T>(v8::Local<v8::String> pattern, v8::RegExp::Flags flags);
76
- ```
77
-
78
- Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.16/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8.
79
-
80
-
81
- <a name="api_nan_undefined"></a>
82
- ### Nan::Undefined()
83
-
84
- A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8.
85
-
86
- Signature:
87
-
88
- ```c++
89
- v8::Local<v8::Primitive> Nan::Undefined()
90
- ```
91
-
92
- <a name="api_nan_null"></a>
93
- ### Nan::Null()
94
-
95
- A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8.
96
-
97
- Signature:
98
-
99
- ```c++
100
- v8::Local<v8::Primitive> Nan::Null()
101
- ```
102
-
103
- <a name="api_nan_true"></a>
104
- ### Nan::True()
105
-
106
- A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8.
107
-
108
- Signature:
109
-
110
- ```c++
111
- v8::Local<v8::Boolean> Nan::True()
112
- ```
113
-
114
- <a name="api_nan_false"></a>
115
- ### Nan::False()
116
-
117
- A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8.
118
-
119
- Signature:
120
-
121
- ```c++
122
- v8::Local<v8::Boolean> Nan::False()
123
- ```
124
-
125
- <a name="api_nan_empty_string"></a>
126
- ### Nan::EmptyString()
127
-
128
- Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8.
129
-
130
- Signature:
131
-
132
- ```c++
133
- v8::Local<v8::String> Nan::EmptyString()
134
- ```
135
-
136
-
137
- <a name="api_nan_new_one_byte_string"></a>
138
- ### Nan::NewOneByteString()
139
-
140
- An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data.
141
-
142
- Signature:
143
-
144
- ```c++
145
- Nan::MaybeLocal<v8::String> Nan::NewOneByteString(const uint8_t * value,
146
- int length = -1)
147
- ```
@@ -1,123 +0,0 @@
1
- ## Miscellaneous Node Helpers
2
-
3
- - <a href="#api_nan_asyncresource"><b><code>Nan::AsyncResource</code></b></a>
4
- - <a href="#api_nan_make_callback"><b><code>Nan::MakeCallback()</code></b></a>
5
- - <a href="#api_nan_module_init"><b><code>NAN_MODULE_INIT()</code></b></a>
6
- - <a href="#api_nan_export"><b><code>Nan::Export()</code></b></a>
7
-
8
- <a name="api_nan_asyncresource"></a>
9
- ### Nan::AsyncResource
10
-
11
- This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API.
12
-
13
- When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track
14
- async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`,
15
- and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or
16
- `v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms
17
- such as domains and [async_hooks][] function correctly.
18
-
19
- Definition:
20
-
21
- ```c++
22
- class AsyncResource {
23
- public:
24
- AsyncResource(v8::Local<v8::String> name,
25
- v8::Local<v8::Object> resource = New<v8::Object>());
26
- AsyncResource(const char* name,
27
- v8::Local<v8::Object> resource = New<v8::Object>());
28
- ~AsyncResource();
29
-
30
- v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
31
- v8::Local<v8::Function> func,
32
- int argc,
33
- v8::Local<v8::Value>* argv);
34
- v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
35
- v8::Local<v8::String> symbol,
36
- int argc,
37
- v8::Local<v8::Value>* argv);
38
- v8::MaybeLocal<v8::Value> runInAsyncScope(v8::Local<v8::Object> target,
39
- const char* method,
40
- int argc,
41
- v8::Local<v8::Value>* argv);
42
- };
43
- ```
44
-
45
- * `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][]
46
- API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend
47
- that the name include the name of the owning module as a prefix. For example `mysql` module could use something like
48
- `mysql:batch-db-query-resource`.
49
- * `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][]
50
- `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically.
51
- * When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the
52
- correct async execution context.
53
- * `AsyncDestroy` is automatically called when an AsyncResource object is destroyed.
54
-
55
- For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the
56
- [N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory.
57
-
58
- <a name="api_nan_make_callback"></a>
59
- ### Nan::MakeCallback()
60
-
61
- Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+
62
- has deprecated these legacy APIs as they do not provide a mechanism to preserve
63
- async context.
64
-
65
- We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or
66
- `v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution
67
- context – something that is essential for functionality like domains, async_hooks and async debugging.
68
-
69
- Signatures:
70
-
71
- ```c++
72
- NAN_DEPRECATED
73
- v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
74
- v8::Local<v8::Function> func,
75
- int argc,
76
- v8::Local<v8::Value>* argv);
77
- NAN_DEPRECATED
78
- v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
79
- v8::Local<v8::String> symbol,
80
- int argc,
81
- v8::Local<v8::Value>* argv);
82
- NAN_DEPRECATED
83
- v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object> target,
84
- const char* method,
85
- int argc,
86
- v8::Local<v8::Value>* argv);
87
- ```
88
-
89
-
90
- <a name="api_nan_module_init"></a>
91
- ### NAN_MODULE_INIT()
92
-
93
- Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object.
94
-
95
- See example below.
96
-
97
- <a name="api_nan_export"></a>
98
- ### Nan::Export()
99
-
100
- A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript.
101
-
102
- Signature:
103
-
104
- ```c++
105
- void Export(v8::Local<v8::Object> target, const char *name, Nan::FunctionCallback f)
106
- ```
107
-
108
- Also available as the shortcut `NAN_EXPORT` macro.
109
-
110
- Example:
111
-
112
- ```c++
113
- NAN_METHOD(Foo) {
114
- ...
115
- }
116
-
117
- NAN_MODULE_INIT(Init) {
118
- NAN_EXPORT(target, Foo);
119
- }
120
- ```
121
-
122
- [async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html
123
- [napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations
@@ -1,263 +0,0 @@
1
- ## Object Wrappers
2
-
3
- The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects.
4
-
5
- - <a href="#api_nan_object_wrap"><b><code>Nan::ObjectWrap</code></b></a>
6
-
7
-
8
- <a name="api_nan_object_wrap"></a>
9
- ### Nan::ObjectWrap()
10
-
11
- A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency.
12
-
13
- Definition:
14
-
15
- ```c++
16
- class ObjectWrap {
17
- public:
18
- ObjectWrap();
19
-
20
- virtual ~ObjectWrap();
21
-
22
- template <class T>
23
- static inline T* Unwrap(v8::Local<v8::Object> handle);
24
-
25
- inline v8::Local<v8::Object> handle();
26
-
27
- inline Nan::Persistent<v8::Object>& persistent();
28
-
29
- protected:
30
- inline void Wrap(v8::Local<v8::Object> handle);
31
-
32
- inline void MakeWeak();
33
-
34
- /* Ref() marks the object as being attached to an event loop.
35
- * Refed objects will not be garbage collected, even if
36
- * all references are lost.
37
- */
38
- virtual void Ref();
39
-
40
- /* Unref() marks an object as detached from the event loop. This is its
41
- * default state. When an object with a "weak" reference changes from
42
- * attached to detached state it will be freed. Be careful not to access
43
- * the object after making this call as it might be gone!
44
- * (A "weak reference" means an object that only has a
45
- * persistent handle.)
46
- *
47
- * DO NOT CALL THIS FROM DESTRUCTOR
48
- */
49
- virtual void Unref();
50
-
51
- int refs_; // ro
52
- };
53
- ```
54
-
55
- See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details.
56
-
57
- ### This vs. Holder
58
-
59
- When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class.
60
- The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance.
61
- In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected.
62
- However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain.
63
- In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption.
64
-
65
- On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype.
66
- So either define your accessors on the instance template,
67
- or use `This()` after verifying that it is indeed a valid object.
68
-
69
- ### Examples
70
-
71
- #### Basic
72
-
73
- ```c++
74
- class MyObject : public Nan::ObjectWrap {
75
- public:
76
- static NAN_MODULE_INIT(Init) {
77
- v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
78
- tpl->SetClassName(Nan::New("MyObject").ToLocalChecked());
79
- tpl->InstanceTemplate()->SetInternalFieldCount(1);
80
-
81
- Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle);
82
- Nan::SetPrototypeMethod(tpl, "getValue", GetValue);
83
-
84
- constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
85
- Nan::Set(target, Nan::New("MyObject").ToLocalChecked(),
86
- Nan::GetFunction(tpl).ToLocalChecked());
87
- }
88
-
89
- private:
90
- explicit MyObject(double value = 0) : value_(value) {}
91
- ~MyObject() {}
92
-
93
- static NAN_METHOD(New) {
94
- if (info.IsConstructCall()) {
95
- double value = info[0]->IsUndefined() ? 0 : Nan::To<double>(info[0]).FromJust();
96
- MyObject *obj = new MyObject(value);
97
- obj->Wrap(info.This());
98
- info.GetReturnValue().Set(info.This());
99
- } else {
100
- const int argc = 1;
101
- v8::Local<v8::Value> argv[argc] = {info[0]};
102
- v8::Local<v8::Function> cons = Nan::New(constructor());
103
- info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
104
- }
105
- }
106
-
107
- static NAN_METHOD(GetHandle) {
108
- MyObject* obj = Nan::ObjectWrap::Unwrap<MyObject>(info.Holder());
109
- info.GetReturnValue().Set(obj->handle());
110
- }
111
-
112
- static NAN_METHOD(GetValue) {
113
- MyObject* obj = Nan::ObjectWrap::Unwrap<MyObject>(info.Holder());
114
- info.GetReturnValue().Set(obj->value_);
115
- }
116
-
117
- static inline Nan::Persistent<v8::Function> & constructor() {
118
- static Nan::Persistent<v8::Function> my_constructor;
119
- return my_constructor;
120
- }
121
-
122
- double value_;
123
- };
124
-
125
- NODE_MODULE(objectwrapper, MyObject::Init)
126
- ```
127
-
128
- To use in Javascript:
129
-
130
- ```Javascript
131
- var objectwrapper = require('bindings')('objectwrapper');
132
-
133
- var obj = new objectwrapper.MyObject(5);
134
- console.log('Should be 5: ' + obj.getValue());
135
- ```
136
-
137
- #### Factory of wrapped objects
138
-
139
- ```c++
140
- class MyFactoryObject : public Nan::ObjectWrap {
141
- public:
142
- static NAN_MODULE_INIT(Init) {
143
- v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
144
- tpl->InstanceTemplate()->SetInternalFieldCount(1);
145
-
146
- Nan::SetPrototypeMethod(tpl, "getValue", GetValue);
147
-
148
- constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
149
- }
150
-
151
- static NAN_METHOD(NewInstance) {
152
- v8::Local<v8::Function> cons = Nan::New(constructor());
153
- double value = info[0]->IsNumber() ? Nan::To<double>(info[0]).FromJust() : 0;
154
- const int argc = 1;
155
- v8::Local<v8::Value> argv[1] = {Nan::New(value)};
156
- info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
157
- }
158
-
159
- // Needed for the next example:
160
- inline double value() const {
161
- return value_;
162
- }
163
-
164
- private:
165
- explicit MyFactoryObject(double value = 0) : value_(value) {}
166
- ~MyFactoryObject() {}
167
-
168
- static NAN_METHOD(New) {
169
- if (info.IsConstructCall()) {
170
- double value = info[0]->IsNumber() ? Nan::To<double>(info[0]).FromJust() : 0;
171
- MyFactoryObject * obj = new MyFactoryObject(value);
172
- obj->Wrap(info.This());
173
- info.GetReturnValue().Set(info.This());
174
- } else {
175
- const int argc = 1;
176
- v8::Local<v8::Value> argv[argc] = {info[0]};
177
- v8::Local<v8::Function> cons = Nan::New(constructor());
178
- info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked());
179
- }
180
- }
181
-
182
- static NAN_METHOD(GetValue) {
183
- MyFactoryObject* obj = ObjectWrap::Unwrap<MyFactoryObject>(info.Holder());
184
- info.GetReturnValue().Set(obj->value_);
185
- }
186
-
187
- static inline Nan::Persistent<v8::Function> & constructor() {
188
- static Nan::Persistent<v8::Function> my_constructor;
189
- return my_constructor;
190
- }
191
-
192
- double value_;
193
- };
194
-
195
- NAN_MODULE_INIT(Init) {
196
- MyFactoryObject::Init(target);
197
- Nan::Set(target,
198
- Nan::New<v8::String>("newFactoryObjectInstance").ToLocalChecked(),
199
- Nan::GetFunction(
200
- Nan::New<v8::FunctionTemplate>(MyFactoryObject::NewInstance)).ToLocalChecked()
201
- );
202
- }
203
-
204
- NODE_MODULE(wrappedobjectfactory, Init)
205
- ```
206
-
207
- To use in Javascript:
208
-
209
- ```Javascript
210
- var wrappedobjectfactory = require('bindings')('wrappedobjectfactory');
211
-
212
- var obj = wrappedobjectfactory.newFactoryObjectInstance(10);
213
- console.log('Should be 10: ' + obj.getValue());
214
- ```
215
-
216
- #### Passing wrapped objects around
217
-
218
- Use the `MyFactoryObject` class above along with the following:
219
-
220
- ```c++
221
- static NAN_METHOD(Sum) {
222
- Nan::MaybeLocal<v8::Object> maybe1 = Nan::To<v8::Object>(info[0]);
223
- Nan::MaybeLocal<v8::Object> maybe2 = Nan::To<v8::Object>(info[1]);
224
-
225
- // Quick check:
226
- if (maybe1.IsEmpty() || maybe2.IsEmpty()) {
227
- // return value is undefined by default
228
- return;
229
- }
230
-
231
- MyFactoryObject* obj1 =
232
- Nan::ObjectWrap::Unwrap<MyFactoryObject>(maybe1.ToLocalChecked());
233
- MyFactoryObject* obj2 =
234
- Nan::ObjectWrap::Unwrap<MyFactoryObject>(maybe2.ToLocalChecked());
235
-
236
- info.GetReturnValue().Set(Nan::New<v8::Number>(obj1->value() + obj2->value()));
237
- }
238
-
239
- NAN_MODULE_INIT(Init) {
240
- MyFactoryObject::Init(target);
241
- Nan::Set(target,
242
- Nan::New<v8::String>("newFactoryObjectInstance").ToLocalChecked(),
243
- Nan::GetFunction(
244
- Nan::New<v8::FunctionTemplate>(MyFactoryObject::NewInstance)).ToLocalChecked()
245
- );
246
- Nan::Set(target,
247
- Nan::New<v8::String>("sum").ToLocalChecked(),
248
- Nan::GetFunction(Nan::New<v8::FunctionTemplate>(Sum)).ToLocalChecked()
249
- );
250
- }
251
-
252
- NODE_MODULE(myaddon, Init)
253
- ```
254
-
255
- To use in Javascript:
256
-
257
- ```Javascript
258
- var myaddon = require('bindings')('myaddon');
259
-
260
- var obj1 = myaddon.newFactoryObjectInstance(5);
261
- var obj2 = myaddon.newFactoryObjectInstance(10);
262
- console.log('sum of object values: ' + myaddon.sum(obj1, obj2));
263
- ```