typespeed 2.3.6 → 2.4.2

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 (258) hide show
  1. package/app/src/config-development.json +3 -2
  2. package/app/src/test-socket.class.ts +56 -0
  3. package/app/src/views/socket.html +23 -0
  4. package/dist/introduction/decorator/example-import.class.js +17 -0
  5. package/dist/introduction/decorator/main-app.js +14 -0
  6. package/dist/introduction/decorator/main-decorator.js +127 -0
  7. package/dist/introduction/decorator/main-import.js +1 -0
  8. package/dist/introduction/decorator/main-reflect.js +38 -0
  9. package/dist/introduction/web-services/db-init.js +33 -0
  10. package/dist/introduction/web-services/db-singleton.js +49 -0
  11. package/dist/introduction/web-services/http-if.js +12 -0
  12. package/dist/introduction/web-services/http-init.js +7 -0
  13. package/dist/introduction/web-services/http-router.js +23 -0
  14. package/dist/{database.decorator.js → src/database.decorator.js} +2 -4
  15. package/dist/{default → src/default}/express-server.class.js +20 -5
  16. package/dist/{default → src/default}/rabbitmq.class.js +3 -3
  17. package/dist/{default → src/default}/redis.class.js +1 -1
  18. package/dist/src/default/socket-io.class.js +64 -0
  19. package/dist/{typespeed.js → src/typespeed.js} +6 -3
  20. package/dist/typespeed.d.ts +19 -1
  21. package/package.json +8 -8
  22. package/src/database.decorator.ts +2 -4
  23. package/src/default/express-server.class.ts +18 -7
  24. package/src/default/rabbitmq.class.ts +3 -3
  25. package/src/default/redis.class.ts +1 -1
  26. package/src/default/socket-io.class.ts +68 -0
  27. package/src/factory/server-factory.class.ts +1 -1
  28. package/src/typespeed.d.ts +19 -1
  29. package/src/typespeed.ts +7 -4
  30. package/test/socket.test.ts +60 -0
  31. package/tsconfig.json +2 -1
  32. package/app/node_modules/.package-lock.json +0 -134
  33. package/app/node_modules/@types/body-parser/LICENSE +0 -21
  34. package/app/node_modules/@types/body-parser/README.md +0 -16
  35. package/app/node_modules/@types/body-parser/index.d.ts +0 -107
  36. package/app/node_modules/@types/body-parser/package.json +0 -58
  37. package/app/node_modules/@types/connect/LICENSE +0 -21
  38. package/app/node_modules/@types/connect/README.md +0 -16
  39. package/app/node_modules/@types/connect/index.d.ts +0 -93
  40. package/app/node_modules/@types/connect/package.json +0 -32
  41. package/app/node_modules/@types/express/LICENSE +0 -21
  42. package/app/node_modules/@types/express/README.md +0 -16
  43. package/app/node_modules/@types/express/index.d.ts +0 -136
  44. package/app/node_modules/@types/express/package.json +0 -45
  45. package/app/node_modules/@types/express-serve-static-core/LICENSE +0 -21
  46. package/app/node_modules/@types/express-serve-static-core/README.md +0 -16
  47. package/app/node_modules/@types/express-serve-static-core/index.d.ts +0 -1281
  48. package/app/node_modules/@types/express-serve-static-core/package.json +0 -55
  49. package/app/node_modules/@types/mime/LICENSE +0 -21
  50. package/app/node_modules/@types/mime/Mime.d.ts +0 -10
  51. package/app/node_modules/@types/mime/README.md +0 -16
  52. package/app/node_modules/@types/mime/index.d.ts +0 -35
  53. package/app/node_modules/@types/mime/lite.d.ts +0 -7
  54. package/app/node_modules/@types/mime/package.json +0 -29
  55. package/app/node_modules/@types/node/LICENSE +0 -21
  56. package/app/node_modules/@types/node/README.md +0 -16
  57. package/app/node_modules/@types/node/assert/strict.d.ts +0 -8
  58. package/app/node_modules/@types/node/assert.d.ts +0 -961
  59. package/app/node_modules/@types/node/async_hooks.d.ts +0 -518
  60. package/app/node_modules/@types/node/buffer.d.ts +0 -2323
  61. package/app/node_modules/@types/node/child_process.d.ts +0 -1399
  62. package/app/node_modules/@types/node/cluster.d.ts +0 -410
  63. package/app/node_modules/@types/node/console.d.ts +0 -412
  64. package/app/node_modules/@types/node/constants.d.ts +0 -18
  65. package/app/node_modules/@types/node/crypto.d.ts +0 -3973
  66. package/app/node_modules/@types/node/dgram.d.ts +0 -545
  67. package/app/node_modules/@types/node/diagnostics_channel.d.ts +0 -192
  68. package/app/node_modules/@types/node/dns/promises.d.ts +0 -370
  69. package/app/node_modules/@types/node/dns.d.ts +0 -660
  70. package/app/node_modules/@types/node/dom-events.d.ts +0 -126
  71. package/app/node_modules/@types/node/domain.d.ts +0 -170
  72. package/app/node_modules/@types/node/events.d.ts +0 -682
  73. package/app/node_modules/@types/node/fs/promises.d.ts +0 -1159
  74. package/app/node_modules/@types/node/fs.d.ts +0 -3976
  75. package/app/node_modules/@types/node/globals.d.ts +0 -303
  76. package/app/node_modules/@types/node/globals.global.d.ts +0 -1
  77. package/app/node_modules/@types/node/http.d.ts +0 -1714
  78. package/app/node_modules/@types/node/http2.d.ts +0 -2133
  79. package/app/node_modules/@types/node/https.d.ts +0 -542
  80. package/app/node_modules/@types/node/index.d.ts +0 -134
  81. package/app/node_modules/@types/node/inspector.d.ts +0 -2741
  82. package/app/node_modules/@types/node/module.d.ts +0 -115
  83. package/app/node_modules/@types/node/net.d.ts +0 -883
  84. package/app/node_modules/@types/node/os.d.ts +0 -473
  85. package/app/node_modules/@types/node/package.json +0 -237
  86. package/app/node_modules/@types/node/path.d.ts +0 -191
  87. package/app/node_modules/@types/node/perf_hooks.d.ts +0 -625
  88. package/app/node_modules/@types/node/process.d.ts +0 -1488
  89. package/app/node_modules/@types/node/punycode.d.ts +0 -117
  90. package/app/node_modules/@types/node/querystring.d.ts +0 -131
  91. package/app/node_modules/@types/node/readline/promises.d.ts +0 -143
  92. package/app/node_modules/@types/node/readline.d.ts +0 -653
  93. package/app/node_modules/@types/node/repl.d.ts +0 -424
  94. package/app/node_modules/@types/node/stream/consumers.d.ts +0 -12
  95. package/app/node_modules/@types/node/stream/promises.d.ts +0 -42
  96. package/app/node_modules/@types/node/stream/web.d.ts +0 -330
  97. package/app/node_modules/@types/node/stream.d.ts +0 -1440
  98. package/app/node_modules/@types/node/string_decoder.d.ts +0 -67
  99. package/app/node_modules/@types/node/test.d.ts +0 -783
  100. package/app/node_modules/@types/node/timers/promises.d.ts +0 -93
  101. package/app/node_modules/@types/node/timers.d.ts +0 -101
  102. package/app/node_modules/@types/node/tls.d.ts +0 -1111
  103. package/app/node_modules/@types/node/trace_events.d.ts +0 -171
  104. package/app/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  105. package/app/node_modules/@types/node/ts4.8/assert.d.ts +0 -961
  106. package/app/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -518
  107. package/app/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2323
  108. package/app/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1399
  109. package/app/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
  110. package/app/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  111. package/app/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
  112. package/app/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3972
  113. package/app/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
  114. package/app/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -192
  115. package/app/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
  116. package/app/node_modules/@types/node/ts4.8/dns.d.ts +0 -660
  117. package/app/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
  118. package/app/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  119. package/app/node_modules/@types/node/ts4.8/events.d.ts +0 -682
  120. package/app/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1138
  121. package/app/node_modules/@types/node/ts4.8/fs.d.ts +0 -3875
  122. package/app/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
  123. package/app/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  124. package/app/node_modules/@types/node/ts4.8/http.d.ts +0 -1651
  125. package/app/node_modules/@types/node/ts4.8/http2.d.ts +0 -2133
  126. package/app/node_modules/@types/node/ts4.8/https.d.ts +0 -542
  127. package/app/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  128. package/app/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2741
  129. package/app/node_modules/@types/node/ts4.8/module.d.ts +0 -115
  130. package/app/node_modules/@types/node/ts4.8/net.d.ts +0 -883
  131. package/app/node_modules/@types/node/ts4.8/os.d.ts +0 -473
  132. package/app/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  133. package/app/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -625
  134. package/app/node_modules/@types/node/ts4.8/process.d.ts +0 -1488
  135. package/app/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  136. package/app/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
  137. package/app/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -143
  138. package/app/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
  139. package/app/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
  140. package/app/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  141. package/app/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
  142. package/app/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
  143. package/app/node_modules/@types/node/ts4.8/stream.d.ts +0 -1440
  144. package/app/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  145. package/app/node_modules/@types/node/ts4.8/test.d.ts +0 -784
  146. package/app/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  147. package/app/node_modules/@types/node/ts4.8/timers.d.ts +0 -94
  148. package/app/node_modules/@types/node/ts4.8/tls.d.ts +0 -1111
  149. package/app/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -171
  150. package/app/node_modules/@types/node/ts4.8/tty.d.ts +0 -206
  151. package/app/node_modules/@types/node/ts4.8/url.d.ts +0 -902
  152. package/app/node_modules/@types/node/ts4.8/util.d.ts +0 -2017
  153. package/app/node_modules/@types/node/ts4.8/v8.d.ts +0 -541
  154. package/app/node_modules/@types/node/ts4.8/vm.d.ts +0 -644
  155. package/app/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  156. package/app/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -695
  157. package/app/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  158. package/app/node_modules/@types/node/tty.d.ts +0 -206
  159. package/app/node_modules/@types/node/url.d.ts +0 -902
  160. package/app/node_modules/@types/node/util.d.ts +0 -2017
  161. package/app/node_modules/@types/node/v8.d.ts +0 -541
  162. package/app/node_modules/@types/node/vm.d.ts +0 -644
  163. package/app/node_modules/@types/node/wasi.d.ts +0 -158
  164. package/app/node_modules/@types/node/worker_threads.d.ts +0 -695
  165. package/app/node_modules/@types/node/zlib.d.ts +0 -517
  166. package/app/node_modules/@types/qs/LICENSE +0 -21
  167. package/app/node_modules/@types/qs/README.md +0 -16
  168. package/app/node_modules/@types/qs/index.d.ts +0 -62
  169. package/app/node_modules/@types/qs/package.json +0 -65
  170. package/app/node_modules/@types/range-parser/LICENSE +0 -21
  171. package/app/node_modules/@types/range-parser/README.md +0 -55
  172. package/app/node_modules/@types/range-parser/index.d.ts +0 -35
  173. package/app/node_modules/@types/range-parser/package.json +0 -25
  174. package/app/node_modules/@types/send/LICENSE +0 -21
  175. package/app/node_modules/@types/send/README.md +0 -16
  176. package/app/node_modules/@types/send/index.d.ts +0 -231
  177. package/app/node_modules/@types/send/package.json +0 -33
  178. package/app/node_modules/@types/serve-static/LICENSE +0 -21
  179. package/app/node_modules/@types/serve-static/README.md +0 -16
  180. package/app/node_modules/@types/serve-static/index.d.ts +0 -113
  181. package/app/node_modules/@types/serve-static/package.json +0 -38
  182. package/app/node_modules/colors/LICENSE +0 -25
  183. package/app/node_modules/colors/README.md +0 -221
  184. package/app/node_modules/colors/examples/normal-usage.js +0 -82
  185. package/app/node_modules/colors/examples/safe-string.js +0 -79
  186. package/app/node_modules/colors/index.d.ts +0 -136
  187. package/app/node_modules/colors/lib/colors.js +0 -211
  188. package/app/node_modules/colors/lib/custom/trap.js +0 -46
  189. package/app/node_modules/colors/lib/custom/zalgo.js +0 -110
  190. package/app/node_modules/colors/lib/extendStringPrototype.js +0 -110
  191. package/app/node_modules/colors/lib/index.js +0 -13
  192. package/app/node_modules/colors/lib/maps/america.js +0 -10
  193. package/app/node_modules/colors/lib/maps/rainbow.js +0 -12
  194. package/app/node_modules/colors/lib/maps/random.js +0 -11
  195. package/app/node_modules/colors/lib/maps/zebra.js +0 -5
  196. package/app/node_modules/colors/lib/styles.js +0 -95
  197. package/app/node_modules/colors/lib/system/has-flag.js +0 -35
  198. package/app/node_modules/colors/lib/system/supports-colors.js +0 -151
  199. package/app/node_modules/colors/package.json +0 -45
  200. package/app/node_modules/colors/safe.d.ts +0 -48
  201. package/app/node_modules/colors/safe.js +0 -10
  202. package/app/node_modules/colors/themes/generic-logging.js +0 -12
  203. package/app/node_modules/dateformat/LICENSE +0 -20
  204. package/app/node_modules/dateformat/Readme.md +0 -204
  205. package/app/node_modules/dateformat/lib/dateformat.js +0 -1
  206. package/app/node_modules/dateformat/package.json +0 -38
  207. package/app/node_modules/mkdirp/CHANGELOG.md +0 -15
  208. package/app/node_modules/mkdirp/LICENSE +0 -21
  209. package/app/node_modules/mkdirp/bin/cmd.js +0 -68
  210. package/app/node_modules/mkdirp/index.js +0 -31
  211. package/app/node_modules/mkdirp/lib/find-made.js +0 -29
  212. package/app/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
  213. package/app/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
  214. package/app/node_modules/mkdirp/lib/opts-arg.js +0 -23
  215. package/app/node_modules/mkdirp/lib/path-arg.js +0 -29
  216. package/app/node_modules/mkdirp/lib/use-native.js +0 -10
  217. package/app/node_modules/mkdirp/package.json +0 -44
  218. package/app/node_modules/mkdirp/readme.markdown +0 -266
  219. package/app/node_modules/tinytim/.travis.yml +0 -5
  220. package/app/node_modules/tinytim/README.md +0 -212
  221. package/app/node_modules/tinytim/index.js +0 -1
  222. package/app/node_modules/tinytim/lib/index.js +0 -55
  223. package/app/node_modules/tinytim/lib/tinytim.js +0 -50
  224. package/app/node_modules/tinytim/package.json +0 -24
  225. package/app/node_modules/tinytim/test/files/html.tim +0 -1
  226. package/app/node_modules/tinytim/test/files/string.tim +0 -1
  227. package/app/node_modules/tinytim/test/files/string2.tim +0 -1
  228. package/app/node_modules/tinytim/test/render-file-replace.js +0 -39
  229. package/app/node_modules/tinytim/test/render-replace.js +0 -94
  230. package/app/node_modules/tinytim/test/tim-replace.js +0 -95
  231. package/app/node_modules/tracer/README.md +0 -747
  232. package/app/node_modules/tracer/lib/color_console.js +0 -15
  233. package/app/node_modules/tracer/lib/console.js +0 -165
  234. package/app/node_modules/tracer/lib/dailyfile.js +0 -92
  235. package/app/node_modules/tracer/lib/index.js +0 -10
  236. package/app/node_modules/tracer/lib/settings.js +0 -25
  237. package/app/node_modules/tracer/lib/utils.js +0 -58
  238. package/app/node_modules/tracer/package.json +0 -53
  239. package/app/node_modules/tracer/types/index.d.ts +0 -189
  240. package/dist/scaffold/templates/front-page.class.ts.tpl +0 -12
  241. package/dist/scaffold/templates/main.ts.tpl +0 -13
  242. package/dist/scaffold/templates/nodemon.json.tpl +0 -7
  243. package/dist/scaffold/templates/package.json.tpl +0 -16
  244. package/dist/scaffold/templates/tsconfig.json.tpl +0 -20
  245. /package/dist/{core.decorator.js → src/core.decorator.js} +0 -0
  246. /package/dist/{default → src/default}/default-authentication.class.js +0 -0
  247. /package/dist/{default → src/default}/log-default.class.js +0 -0
  248. /package/dist/{default → src/default}/node-cache.class.js +0 -0
  249. /package/dist/{default → src/default}/pages/404.html +0 -0
  250. /package/dist/{default → src/default}/pages/500.html +0 -0
  251. /package/dist/{default → src/default}/read-write-db.class.js +0 -0
  252. /package/dist/{factory → src/factory}/authentication-factory.class.js +0 -0
  253. /package/dist/{factory → src/factory}/cache-factory.class.js +0 -0
  254. /package/dist/{factory → src/factory}/data-source-factory.class.js +0 -0
  255. /package/dist/{factory → src/factory}/log-factory.class.js +0 -0
  256. /package/dist/{factory → src/factory}/server-factory.class.js +0 -0
  257. /package/dist/{route.decorator.js → src/route.decorator.js} +0 -0
  258. /package/dist/{scaffold → src/scaffold}/command.js +0 -0
@@ -1,31 +0,0 @@
1
- const optsArg = require('./lib/opts-arg.js')
2
- const pathArg = require('./lib/path-arg.js')
3
-
4
- const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
5
- const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
6
- const {useNative, useNativeSync} = require('./lib/use-native.js')
7
-
8
-
9
- const mkdirp = (path, opts) => {
10
- path = pathArg(path)
11
- opts = optsArg(opts)
12
- return useNative(opts)
13
- ? mkdirpNative(path, opts)
14
- : mkdirpManual(path, opts)
15
- }
16
-
17
- const mkdirpSync = (path, opts) => {
18
- path = pathArg(path)
19
- opts = optsArg(opts)
20
- return useNativeSync(opts)
21
- ? mkdirpNativeSync(path, opts)
22
- : mkdirpManualSync(path, opts)
23
- }
24
-
25
- mkdirp.sync = mkdirpSync
26
- mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
27
- mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
28
- mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
29
- mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
30
-
31
- module.exports = mkdirp
@@ -1,29 +0,0 @@
1
- const {dirname} = require('path')
2
-
3
- const findMade = (opts, parent, path = undefined) => {
4
- // we never want the 'made' return value to be a root directory
5
- if (path === parent)
6
- return Promise.resolve()
7
-
8
- return opts.statAsync(parent).then(
9
- st => st.isDirectory() ? path : undefined, // will fail later
10
- er => er.code === 'ENOENT'
11
- ? findMade(opts, dirname(parent), parent)
12
- : undefined
13
- )
14
- }
15
-
16
- const findMadeSync = (opts, parent, path = undefined) => {
17
- if (path === parent)
18
- return undefined
19
-
20
- try {
21
- return opts.statSync(parent).isDirectory() ? path : undefined
22
- } catch (er) {
23
- return er.code === 'ENOENT'
24
- ? findMadeSync(opts, dirname(parent), parent)
25
- : undefined
26
- }
27
- }
28
-
29
- module.exports = {findMade, findMadeSync}
@@ -1,64 +0,0 @@
1
- const {dirname} = require('path')
2
-
3
- const mkdirpManual = (path, opts, made) => {
4
- opts.recursive = false
5
- const parent = dirname(path)
6
- if (parent === path) {
7
- return opts.mkdirAsync(path, opts).catch(er => {
8
- // swallowed by recursive implementation on posix systems
9
- // any other error is a failure
10
- if (er.code !== 'EISDIR')
11
- throw er
12
- })
13
- }
14
-
15
- return opts.mkdirAsync(path, opts).then(() => made || path, er => {
16
- if (er.code === 'ENOENT')
17
- return mkdirpManual(parent, opts)
18
- .then(made => mkdirpManual(path, opts, made))
19
- if (er.code !== 'EEXIST' && er.code !== 'EROFS')
20
- throw er
21
- return opts.statAsync(path).then(st => {
22
- if (st.isDirectory())
23
- return made
24
- else
25
- throw er
26
- }, () => { throw er })
27
- })
28
- }
29
-
30
- const mkdirpManualSync = (path, opts, made) => {
31
- const parent = dirname(path)
32
- opts.recursive = false
33
-
34
- if (parent === path) {
35
- try {
36
- return opts.mkdirSync(path, opts)
37
- } catch (er) {
38
- // swallowed by recursive implementation on posix systems
39
- // any other error is a failure
40
- if (er.code !== 'EISDIR')
41
- throw er
42
- else
43
- return
44
- }
45
- }
46
-
47
- try {
48
- opts.mkdirSync(path, opts)
49
- return made || path
50
- } catch (er) {
51
- if (er.code === 'ENOENT')
52
- return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
53
- if (er.code !== 'EEXIST' && er.code !== 'EROFS')
54
- throw er
55
- try {
56
- if (!opts.statSync(path).isDirectory())
57
- throw er
58
- } catch (_) {
59
- throw er
60
- }
61
- }
62
- }
63
-
64
- module.exports = {mkdirpManual, mkdirpManualSync}
@@ -1,39 +0,0 @@
1
- const {dirname} = require('path')
2
- const {findMade, findMadeSync} = require('./find-made.js')
3
- const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
4
-
5
- const mkdirpNative = (path, opts) => {
6
- opts.recursive = true
7
- const parent = dirname(path)
8
- if (parent === path)
9
- return opts.mkdirAsync(path, opts)
10
-
11
- return findMade(opts, path).then(made =>
12
- opts.mkdirAsync(path, opts).then(() => made)
13
- .catch(er => {
14
- if (er.code === 'ENOENT')
15
- return mkdirpManual(path, opts)
16
- else
17
- throw er
18
- }))
19
- }
20
-
21
- const mkdirpNativeSync = (path, opts) => {
22
- opts.recursive = true
23
- const parent = dirname(path)
24
- if (parent === path)
25
- return opts.mkdirSync(path, opts)
26
-
27
- const made = findMadeSync(opts, path)
28
- try {
29
- opts.mkdirSync(path, opts)
30
- return made
31
- } catch (er) {
32
- if (er.code === 'ENOENT')
33
- return mkdirpManualSync(path, opts)
34
- else
35
- throw er
36
- }
37
- }
38
-
39
- module.exports = {mkdirpNative, mkdirpNativeSync}
@@ -1,23 +0,0 @@
1
- const { promisify } = require('util')
2
- const fs = require('fs')
3
- const optsArg = opts => {
4
- if (!opts)
5
- opts = { mode: 0o777, fs }
6
- else if (typeof opts === 'object')
7
- opts = { mode: 0o777, fs, ...opts }
8
- else if (typeof opts === 'number')
9
- opts = { mode: opts, fs }
10
- else if (typeof opts === 'string')
11
- opts = { mode: parseInt(opts, 8), fs }
12
- else
13
- throw new TypeError('invalid options argument')
14
-
15
- opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
16
- opts.mkdirAsync = promisify(opts.mkdir)
17
- opts.stat = opts.stat || opts.fs.stat || fs.stat
18
- opts.statAsync = promisify(opts.stat)
19
- opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
20
- opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
21
- return opts
22
- }
23
- module.exports = optsArg
@@ -1,29 +0,0 @@
1
- const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
2
- const { resolve, parse } = require('path')
3
- const pathArg = path => {
4
- if (/\0/.test(path)) {
5
- // simulate same failure that node raises
6
- throw Object.assign(
7
- new TypeError('path must be a string without null bytes'),
8
- {
9
- path,
10
- code: 'ERR_INVALID_ARG_VALUE',
11
- }
12
- )
13
- }
14
-
15
- path = resolve(path)
16
- if (platform === 'win32') {
17
- const badWinChars = /[*|"<>?:]/
18
- const {root} = parse(path)
19
- if (badWinChars.test(path.substr(root.length))) {
20
- throw Object.assign(new Error('Illegal characters in path.'), {
21
- path,
22
- code: 'EINVAL',
23
- })
24
- }
25
- }
26
-
27
- return path
28
- }
29
- module.exports = pathArg
@@ -1,10 +0,0 @@
1
- const fs = require('fs')
2
-
3
- const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
4
- const versArr = version.replace(/^v/, '').split('.')
5
- const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
6
-
7
- const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
8
- const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
9
-
10
- module.exports = {useNative, useNativeSync}
@@ -1,44 +0,0 @@
1
- {
2
- "name": "mkdirp",
3
- "description": "Recursively mkdir, like `mkdir -p`",
4
- "version": "1.0.4",
5
- "main": "index.js",
6
- "keywords": [
7
- "mkdir",
8
- "directory",
9
- "make dir",
10
- "make",
11
- "dir",
12
- "recursive",
13
- "native"
14
- ],
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/isaacs/node-mkdirp.git"
18
- },
19
- "scripts": {
20
- "test": "tap",
21
- "snap": "tap",
22
- "preversion": "npm test",
23
- "postversion": "npm publish",
24
- "postpublish": "git push origin --follow-tags"
25
- },
26
- "tap": {
27
- "check-coverage": true,
28
- "coverage-map": "map.js"
29
- },
30
- "devDependencies": {
31
- "require-inject": "^1.4.4",
32
- "tap": "^14.10.7"
33
- },
34
- "bin": "bin/cmd.js",
35
- "license": "MIT",
36
- "engines": {
37
- "node": ">=10"
38
- },
39
- "files": [
40
- "bin",
41
- "lib",
42
- "index.js"
43
- ]
44
- }
@@ -1,266 +0,0 @@
1
- # mkdirp
2
-
3
- Like `mkdir -p`, but in Node.js!
4
-
5
- Now with a modern API and no\* bugs!
6
-
7
- <small>\* may contain some bugs</small>
8
-
9
- # example
10
-
11
- ## pow.js
12
-
13
- ```js
14
- const mkdirp = require('mkdirp')
15
-
16
- // return value is a Promise resolving to the first directory created
17
- mkdirp('/tmp/foo/bar/baz').then(made =>
18
- console.log(`made directories, starting with ${made}`))
19
- ```
20
-
21
- Output (where `/tmp/foo` already exists)
22
-
23
- ```
24
- made directories, starting with /tmp/foo/bar
25
- ```
26
-
27
- Or, if you don't have time to wait around for promises:
28
-
29
- ```js
30
- const mkdirp = require('mkdirp')
31
-
32
- // return value is the first directory created
33
- const made = mkdirp.sync('/tmp/foo/bar/baz')
34
- console.log(`made directories, starting with ${made}`)
35
- ```
36
-
37
- And now /tmp/foo/bar/baz exists, huzzah!
38
-
39
- # methods
40
-
41
- ```js
42
- const mkdirp = require('mkdirp')
43
- ```
44
-
45
- ## mkdirp(dir, [opts]) -> Promise<String | undefined>
46
-
47
- Create a new directory and any necessary subdirectories at `dir` with octal
48
- permission string `opts.mode`. If `opts` is a string or number, it will be
49
- treated as the `opts.mode`.
50
-
51
- If `opts.mode` isn't specified, it defaults to `0o777 &
52
- (~process.umask())`.
53
-
54
- Promise resolves to first directory `made` that had to be created, or
55
- `undefined` if everything already exists. Promise rejects if any errors
56
- are encountered. Note that, in the case of promise rejection, some
57
- directories _may_ have been created, as recursive directory creation is not
58
- an atomic operation.
59
-
60
- You can optionally pass in an alternate `fs` implementation by passing in
61
- `opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
62
- and `opts.fs.stat(path, cb)`.
63
-
64
- You can also override just one or the other of `mkdir` and `stat` by
65
- passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
66
- only overrides one of these.
67
-
68
- ## mkdirp.sync(dir, opts) -> String|null
69
-
70
- Synchronously create a new directory and any necessary subdirectories at
71
- `dir` with octal permission string `opts.mode`. If `opts` is a string or
72
- number, it will be treated as the `opts.mode`.
73
-
74
- If `opts.mode` isn't specified, it defaults to `0o777 &
75
- (~process.umask())`.
76
-
77
- Returns the first directory that had to be created, or undefined if
78
- everything already exists.
79
-
80
- You can optionally pass in an alternate `fs` implementation by passing in
81
- `opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
82
- and `opts.fs.statSync(path)`.
83
-
84
- You can also override just one or the other of `mkdirSync` and `statSync`
85
- by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
86
- option that only overrides one of these.
87
-
88
- ## mkdirp.manual, mkdirp.manualSync
89
-
90
- Use the manual implementation (not the native one). This is the default
91
- when the native implementation is not available or the stat/mkdir
92
- implementation is overridden.
93
-
94
- ## mkdirp.native, mkdirp.nativeSync
95
-
96
- Use the native implementation (not the manual one). This is the default
97
- when the native implementation is available and stat/mkdir are not
98
- overridden.
99
-
100
- # implementation
101
-
102
- On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
103
- {recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
104
- overridden by an option.
105
-
106
- ## native implementation
107
-
108
- - If the path is a root directory, then pass it to the underlying
109
- implementation and return the result/error. (In this case, it'll either
110
- succeed or fail, but we aren't actually creating any dirs.)
111
- - Walk up the path statting each directory, to find the first path that
112
- will be created, `made`.
113
- - Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
114
- - If error, raise it to the caller.
115
- - Return `made`.
116
-
117
- ## manual implementation
118
-
119
- - Call underlying `fs.mkdir` implementation, with `recursive: false`
120
- - If error:
121
- - If path is a root directory, raise to the caller and do not handle it
122
- - If ENOENT, mkdirp parent dir, store result as `made`
123
- - stat(path)
124
- - If error, raise original `mkdir` error
125
- - If directory, return `made`
126
- - Else, raise original `mkdir` error
127
- - else
128
- - return `undefined` if a root dir, or `made` if set, or `path`
129
-
130
- ## windows vs unix caveat
131
-
132
- On Windows file systems, attempts to create a root directory (ie, a drive
133
- letter or root UNC path) will fail. If the root directory exists, then it
134
- will fail with `EPERM`. If the root directory does not exist, then it will
135
- fail with `ENOENT`.
136
-
137
- On posix file systems, attempts to create a root directory (in recursive
138
- mode) will succeed silently, as it is treated like just another directory
139
- that already exists. (In non-recursive mode, of course, it fails with
140
- `EEXIST`.)
141
-
142
- In order to preserve this system-specific behavior (and because it's not as
143
- if we can create the parent of a root directory anyway), attempts to create
144
- a root directory are passed directly to the `fs` implementation, and any
145
- errors encountered are not handled.
146
-
147
- ## native error caveat
148
-
149
- The native implementation (as of at least Node.js v13.4.0) does not provide
150
- appropriate errors in some cases (see
151
- [nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
152
- [nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
153
-
154
- In order to work around this issue, the native implementation will fall
155
- back to the manual implementation if an `ENOENT` error is encountered.
156
-
157
- # choosing a recursive mkdir implementation
158
-
159
- There are a few to choose from! Use the one that suits your needs best :D
160
-
161
- ## use `fs.mkdir(path, {recursive: true}, cb)` if:
162
-
163
- - You wish to optimize performance even at the expense of other factors.
164
- - You don't need to know the first dir created.
165
- - You are ok with getting `ENOENT` as the error when some other problem is
166
- the actual cause.
167
- - You can limit your platforms to Node.js v10.12 and above.
168
- - You're ok with using callbacks instead of promises.
169
- - You don't need/want a CLI.
170
- - You don't need to override the `fs` methods in use.
171
-
172
- ## use this module (mkdirp 1.x) if:
173
-
174
- - You need to know the first directory that was created.
175
- - You wish to use the native implementation if available, but fall back
176
- when it's not.
177
- - You prefer promise-returning APIs to callback-taking APIs.
178
- - You want more useful error messages than the native recursive mkdir
179
- provides (at least as of Node.js v13.4), and are ok with re-trying on
180
- `ENOENT` to achieve this.
181
- - You need (or at least, are ok with) a CLI.
182
- - You need to override the `fs` methods in use.
183
-
184
- ## use [`make-dir`](http://npm.im/make-dir) if:
185
-
186
- - You do not need to know the first dir created (and wish to save a few
187
- `stat` calls when using the native implementation for this reason).
188
- - You wish to use the native implementation if available, but fall back
189
- when it's not.
190
- - You prefer promise-returning APIs to callback-taking APIs.
191
- - You are ok with occasionally getting `ENOENT` errors for failures that
192
- are actually related to something other than a missing file system entry.
193
- - You don't need/want a CLI.
194
- - You need to override the `fs` methods in use.
195
-
196
- ## use mkdirp 0.x if:
197
-
198
- - You need to know the first directory that was created.
199
- - You need (or at least, are ok with) a CLI.
200
- - You need to override the `fs` methods in use.
201
- - You're ok with using callbacks instead of promises.
202
- - You are not running on Windows, where the root-level ENOENT errors can
203
- lead to infinite regress.
204
- - You think vinyl just sounds warmer and richer for some weird reason.
205
- - You are supporting truly ancient Node.js versions, before even the advent
206
- of a `Promise` language primitive. (Please don't. You deserve better.)
207
-
208
- # cli
209
-
210
- This package also ships with a `mkdirp` command.
211
-
212
- ```
213
- $ mkdirp -h
214
-
215
- usage: mkdirp [DIR1,DIR2..] {OPTIONS}
216
-
217
- Create each supplied directory including any necessary parent directories
218
- that don't yet exist.
219
-
220
- If the directory already exists, do nothing.
221
-
222
- OPTIONS are:
223
-
224
- -m<mode> If a directory needs to be created, set the mode as an octal
225
- --mode=<mode> permission string.
226
-
227
- -v --version Print the mkdirp version number
228
-
229
- -h --help Print this helpful banner
230
-
231
- -p --print Print the first directories created for each path provided
232
-
233
- --manual Use manual implementation, even if native is available
234
- ```
235
-
236
- # install
237
-
238
- With [npm](http://npmjs.org) do:
239
-
240
- ```
241
- npm install mkdirp
242
- ```
243
-
244
- to get the library locally, or
245
-
246
- ```
247
- npm install -g mkdirp
248
- ```
249
-
250
- to get the command everywhere, or
251
-
252
- ```
253
- npx mkdirp ...
254
- ```
255
-
256
- to run the command without installing it globally.
257
-
258
- # platform support
259
-
260
- This module works on node v8, but only v10 and above are officially
261
- supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
262
- the past, as of this writing.
263
-
264
- # license
265
-
266
- MIT
@@ -1,5 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 0.6
4
- - 0.9
5
- - 0.10