projen 0.91.16 → 0.91.18

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 (493) hide show
  1. package/.jsii +62 -18
  2. package/lib/awscdk/auto-discover.js +5 -5
  3. package/lib/awscdk/awscdk-app-java.js +1 -1
  4. package/lib/awscdk/awscdk-app-py.js +1 -1
  5. package/lib/awscdk/awscdk-app-ts.js +1 -1
  6. package/lib/awscdk/awscdk-construct.js +2 -2
  7. package/lib/awscdk/awscdk-deps-java.js +1 -1
  8. package/lib/awscdk/awscdk-deps-js.js +1 -1
  9. package/lib/awscdk/awscdk-deps-py.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-extension.js +1 -1
  15. package/lib/awscdk/lambda-function.js +2 -2
  16. package/lib/build/build-workflow.js +1 -1
  17. package/lib/cdk/auto-discover-base.js +2 -2
  18. package/lib/cdk/construct-lib.js +1 -1
  19. package/lib/cdk/integration-test-base.js +1 -1
  20. package/lib/cdk/jsii-docgen.js +1 -1
  21. package/lib/cdk/jsii-project.js +1 -1
  22. package/lib/cdk8s/auto-discover.js +2 -2
  23. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  24. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  25. package/lib/cdk8s/cdk8s-construct.js +1 -1
  26. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps.js +1 -1
  28. package/lib/cdk8s/integration-test.js +1 -1
  29. package/lib/cdktf/cdktf-construct.js +1 -1
  30. package/lib/circleci/circleci.js +1 -1
  31. package/lib/component.js +1 -1
  32. package/lib/dependencies.js +1 -1
  33. package/lib/dev-env.js +1 -1
  34. package/lib/docker-compose/docker-compose-service.js +1 -1
  35. package/lib/docker-compose/docker-compose.js +1 -1
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/actions-provider.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/auto-queue.js +1 -1
  42. package/lib/github/dependabot.js +1 -1
  43. package/lib/github/github-credentials.js +1 -1
  44. package/lib/github/github-project.js +1 -1
  45. package/lib/github/github.js +1 -1
  46. package/lib/github/merge-queue.js +1 -1
  47. package/lib/github/mergify.js +1 -1
  48. package/lib/github/pr-template.js +1 -1
  49. package/lib/github/pull-request-backport.js +1 -1
  50. package/lib/github/pull-request-lint.js +1 -1
  51. package/lib/github/stale.js +1 -1
  52. package/lib/github/task-workflow-job.js +1 -1
  53. package/lib/github/task-workflow.js +1 -1
  54. package/lib/github/workflow-actions.js +1 -1
  55. package/lib/github/workflow-jobs.js +1 -1
  56. package/lib/github/workflow-steps.js +1 -1
  57. package/lib/github/workflows.d.ts +10 -0
  58. package/lib/github/workflows.js +4 -2
  59. package/lib/gitlab/configuration.js +1 -1
  60. package/lib/gitlab/gitlab-configuration.js +1 -1
  61. package/lib/gitlab/nested-configuration.js +1 -1
  62. package/lib/gitpod.js +1 -1
  63. package/lib/ignore-file.js +1 -1
  64. package/lib/ini.js +1 -1
  65. package/lib/java/java-project.js +1 -1
  66. package/lib/java/junit.js +1 -1
  67. package/lib/java/maven-compile.js +1 -1
  68. package/lib/java/maven-packaging.js +1 -1
  69. package/lib/java/maven-sample.js +1 -1
  70. package/lib/java/pom.js +2 -2
  71. package/lib/java/projenrc.js +1 -1
  72. package/lib/javascript/bundler.js +1 -1
  73. package/lib/javascript/eslint.js +1 -1
  74. package/lib/javascript/jest.js +4 -4
  75. package/lib/javascript/license-checker.js +1 -1
  76. package/lib/javascript/node-package.js +1 -1
  77. package/lib/javascript/node-project.js +1 -1
  78. package/lib/javascript/npm-config.js +1 -1
  79. package/lib/javascript/prettier.js +1 -1
  80. package/lib/javascript/projenrc.js +1 -1
  81. package/lib/javascript/typescript-config.js +2 -2
  82. package/lib/javascript/upgrade-dependencies.js +2 -2
  83. package/lib/javascript/yarnrc.js +1 -1
  84. package/lib/json-patch.js +1 -1
  85. package/lib/json.js +1 -1
  86. package/lib/license.js +1 -1
  87. package/lib/logger.js +1 -1
  88. package/lib/makefile.js +1 -1
  89. package/lib/object-file.js +1 -1
  90. package/lib/project-build.js +1 -1
  91. package/lib/project-tree.js +1 -1
  92. package/lib/project.js +1 -1
  93. package/lib/projects.js +1 -1
  94. package/lib/projenrc-json.js +2 -2
  95. package/lib/projenrc.js +1 -1
  96. package/lib/python/pip.js +1 -1
  97. package/lib/python/poetry.js +2 -2
  98. package/lib/python/projenrc.js +1 -1
  99. package/lib/python/pytest-sample.js +1 -1
  100. package/lib/python/pytest.js +1 -1
  101. package/lib/python/python-project.js +1 -1
  102. package/lib/python/python-sample.js +1 -1
  103. package/lib/python/requirements-file.js +1 -1
  104. package/lib/python/setuppy.js +1 -1
  105. package/lib/python/setuptools.js +1 -1
  106. package/lib/python/venv.js +1 -1
  107. package/lib/readme.js +1 -1
  108. package/lib/release/publisher.js +1 -1
  109. package/lib/release/release-trigger.js +1 -1
  110. package/lib/release/release.js +1 -1
  111. package/lib/renovatebot.js +1 -1
  112. package/lib/sample-file.js +2 -2
  113. package/lib/semver.js +1 -1
  114. package/lib/source-code.js +1 -1
  115. package/lib/task-runtime.js +1 -1
  116. package/lib/task.js +1 -1
  117. package/lib/tasks.js +1 -1
  118. package/lib/testing.js +1 -1
  119. package/lib/textfile.js +1 -1
  120. package/lib/toml.js +1 -1
  121. package/lib/typescript/projenrc-ts.js +1 -1
  122. package/lib/typescript/projenrc.js +1 -1
  123. package/lib/typescript/typescript-typedoc.js +1 -1
  124. package/lib/typescript/typescript.js +6 -6
  125. package/lib/version.js +2 -2
  126. package/lib/vscode/devcontainer.js +1 -1
  127. package/lib/vscode/extensions.js +1 -1
  128. package/lib/vscode/launch-config.js +1 -1
  129. package/lib/vscode/settings.js +1 -1
  130. package/lib/vscode/vscode.js +1 -1
  131. package/lib/web/next.js +3 -3
  132. package/lib/web/postcss.js +1 -1
  133. package/lib/web/react.js +4 -4
  134. package/lib/web/tailwind.js +1 -1
  135. package/lib/xmlfile.js +1 -1
  136. package/lib/yaml.js +1 -1
  137. package/node_modules/{minimatch/node_modules/brace-expansion → @nodelib/fs.scandir}/LICENSE +2 -2
  138. package/node_modules/@nodelib/fs.scandir/README.md +171 -0
  139. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  140. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +19 -0
  141. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +4 -0
  142. package/node_modules/@nodelib/fs.scandir/out/constants.js +17 -0
  143. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +12 -0
  144. package/node_modules/@nodelib/fs.scandir/out/index.js +26 -0
  145. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  146. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +104 -0
  147. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +1 -0
  148. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +13 -0
  149. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +5 -0
  150. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +54 -0
  151. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  152. package/node_modules/@nodelib/fs.scandir/out/settings.js +24 -0
  153. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  154. package/node_modules/@nodelib/fs.scandir/out/types/index.js +2 -0
  155. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +2 -0
  156. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +19 -0
  157. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +2 -0
  158. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +5 -0
  159. package/node_modules/@nodelib/fs.scandir/package.json +44 -0
  160. package/node_modules/@nodelib/fs.stat/LICENSE +21 -0
  161. package/node_modules/@nodelib/fs.stat/README.md +126 -0
  162. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  163. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +17 -0
  164. package/node_modules/@nodelib/fs.stat/out/index.d.ts +12 -0
  165. package/node_modules/@nodelib/fs.stat/out/index.js +26 -0
  166. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  167. package/node_modules/@nodelib/fs.stat/out/providers/async.js +36 -0
  168. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +3 -0
  169. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +23 -0
  170. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +16 -0
  171. package/node_modules/@nodelib/fs.stat/out/settings.js +16 -0
  172. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  173. package/node_modules/@nodelib/fs.stat/out/types/index.js +2 -0
  174. package/node_modules/@nodelib/fs.stat/package.json +37 -0
  175. package/node_modules/@nodelib/fs.walk/LICENSE +21 -0
  176. package/node_modules/@nodelib/fs.walk/README.md +215 -0
  177. package/node_modules/@nodelib/fs.walk/out/index.d.ts +14 -0
  178. package/node_modules/@nodelib/fs.walk/out/index.js +34 -0
  179. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  180. package/node_modules/@nodelib/fs.walk/out/providers/async.js +30 -0
  181. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +4 -0
  182. package/node_modules/@nodelib/fs.walk/out/providers/index.js +9 -0
  183. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +12 -0
  184. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +34 -0
  185. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +10 -0
  186. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +14 -0
  187. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  188. package/node_modules/@nodelib/fs.walk/out/readers/async.js +97 -0
  189. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +7 -0
  190. package/node_modules/@nodelib/fs.walk/out/readers/common.js +31 -0
  191. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  192. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +11 -0
  193. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +15 -0
  194. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +59 -0
  195. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +30 -0
  196. package/node_modules/@nodelib/fs.walk/out/settings.js +26 -0
  197. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  198. package/node_modules/@nodelib/fs.walk/out/types/index.js +2 -0
  199. package/node_modules/@nodelib/fs.walk/package.json +44 -0
  200. package/node_modules/braces/LICENSE +21 -0
  201. package/node_modules/braces/README.md +586 -0
  202. package/node_modules/braces/index.js +170 -0
  203. package/node_modules/braces/lib/compile.js +60 -0
  204. package/node_modules/braces/lib/constants.js +57 -0
  205. package/node_modules/braces/lib/expand.js +113 -0
  206. package/node_modules/braces/lib/parse.js +331 -0
  207. package/node_modules/braces/lib/stringify.js +32 -0
  208. package/node_modules/braces/lib/utils.js +122 -0
  209. package/node_modules/braces/package.json +77 -0
  210. package/node_modules/end-of-stream/LICENSE +21 -0
  211. package/node_modules/end-of-stream/README.md +54 -0
  212. package/node_modules/end-of-stream/index.js +94 -0
  213. package/node_modules/end-of-stream/package.json +37 -0
  214. package/node_modules/execa/index.js +361 -0
  215. package/node_modules/execa/lib/errname.js +39 -0
  216. package/node_modules/execa/lib/stdio.js +41 -0
  217. package/node_modules/execa/license +9 -0
  218. package/node_modules/execa/node_modules/cross-spawn/LICENSE +21 -0
  219. package/node_modules/execa/node_modules/cross-spawn/README.md +94 -0
  220. package/node_modules/execa/node_modules/cross-spawn/index.js +39 -0
  221. package/node_modules/execa/node_modules/cross-spawn/lib/enoent.js +59 -0
  222. package/node_modules/execa/node_modules/cross-spawn/lib/parse.js +125 -0
  223. package/node_modules/execa/node_modules/cross-spawn/lib/util/escape.js +47 -0
  224. package/node_modules/execa/node_modules/cross-spawn/lib/util/readShebang.js +32 -0
  225. package/node_modules/execa/node_modules/cross-spawn/lib/util/resolveCommand.js +51 -0
  226. package/node_modules/execa/node_modules/cross-spawn/package.json +75 -0
  227. package/node_modules/execa/node_modules/semver/README.md +412 -0
  228. package/node_modules/execa/node_modules/semver/bin/semver +160 -0
  229. package/node_modules/execa/node_modules/semver/package.json +38 -0
  230. package/node_modules/execa/node_modules/semver/range.bnf +16 -0
  231. package/node_modules/execa/node_modules/semver/semver.js +1525 -0
  232. package/node_modules/execa/node_modules/shebang-command/index.js +19 -0
  233. package/node_modules/execa/node_modules/shebang-command/license +21 -0
  234. package/node_modules/execa/node_modules/shebang-command/package.json +39 -0
  235. package/node_modules/execa/node_modules/shebang-command/readme.md +39 -0
  236. package/node_modules/execa/node_modules/shebang-regex/index.js +2 -0
  237. package/node_modules/execa/node_modules/shebang-regex/package.json +32 -0
  238. package/node_modules/execa/node_modules/shebang-regex/readme.md +29 -0
  239. package/node_modules/{shelljs/node_modules/glob → execa/node_modules/which}/LICENSE +0 -6
  240. package/node_modules/execa/node_modules/which/README.md +51 -0
  241. package/node_modules/execa/node_modules/which/bin/which +52 -0
  242. package/node_modules/execa/node_modules/which/package.json +30 -0
  243. package/node_modules/execa/node_modules/which/which.js +135 -0
  244. package/node_modules/execa/package.json +69 -0
  245. package/node_modules/execa/readme.md +327 -0
  246. package/node_modules/fast-glob/LICENSE +21 -0
  247. package/node_modules/fast-glob/README.md +830 -0
  248. package/node_modules/fast-glob/node_modules/glob-parent/LICENSE +15 -0
  249. package/node_modules/fast-glob/node_modules/glob-parent/README.md +137 -0
  250. package/node_modules/fast-glob/node_modules/glob-parent/index.js +42 -0
  251. package/node_modules/fast-glob/node_modules/glob-parent/package.json +48 -0
  252. package/node_modules/fast-glob/out/index.d.ts +40 -0
  253. package/node_modules/fast-glob/out/index.js +102 -0
  254. package/node_modules/fast-glob/out/managers/tasks.d.ts +22 -0
  255. package/node_modules/fast-glob/out/managers/tasks.js +110 -0
  256. package/node_modules/fast-glob/out/providers/async.d.ts +9 -0
  257. package/node_modules/fast-glob/out/providers/async.js +23 -0
  258. package/node_modules/fast-glob/out/providers/filters/deep.d.ts +16 -0
  259. package/node_modules/fast-glob/out/providers/filters/deep.js +62 -0
  260. package/node_modules/fast-glob/out/providers/filters/entry.d.ts +17 -0
  261. package/node_modules/fast-glob/out/providers/filters/entry.js +85 -0
  262. package/node_modules/fast-glob/out/providers/filters/error.d.ts +8 -0
  263. package/node_modules/fast-glob/out/providers/filters/error.js +15 -0
  264. package/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +33 -0
  265. package/node_modules/fast-glob/out/providers/matchers/matcher.js +45 -0
  266. package/node_modules/fast-glob/out/providers/matchers/partial.d.ts +4 -0
  267. package/node_modules/fast-glob/out/providers/matchers/partial.js +38 -0
  268. package/node_modules/fast-glob/out/providers/provider.d.ts +19 -0
  269. package/node_modules/fast-glob/out/providers/provider.js +48 -0
  270. package/node_modules/fast-glob/out/providers/stream.d.ts +11 -0
  271. package/node_modules/fast-glob/out/providers/stream.js +31 -0
  272. package/node_modules/fast-glob/out/providers/sync.d.ts +9 -0
  273. package/node_modules/fast-glob/out/providers/sync.js +23 -0
  274. package/node_modules/fast-glob/out/providers/transformers/entry.d.ts +8 -0
  275. package/node_modules/fast-glob/out/providers/transformers/entry.js +26 -0
  276. package/node_modules/fast-glob/out/readers/async.d.ts +10 -0
  277. package/node_modules/fast-glob/out/readers/async.js +35 -0
  278. package/node_modules/fast-glob/out/readers/reader.d.ts +15 -0
  279. package/node_modules/fast-glob/out/readers/reader.js +33 -0
  280. package/node_modules/fast-glob/out/readers/stream.d.ts +14 -0
  281. package/node_modules/fast-glob/out/readers/stream.js +55 -0
  282. package/node_modules/fast-glob/out/readers/sync.d.ts +12 -0
  283. package/node_modules/fast-glob/out/readers/sync.js +43 -0
  284. package/node_modules/fast-glob/out/settings.d.ts +164 -0
  285. package/node_modules/fast-glob/out/settings.js +59 -0
  286. package/node_modules/fast-glob/out/types/index.d.ts +31 -0
  287. package/node_modules/fast-glob/out/types/index.js +2 -0
  288. package/node_modules/fast-glob/out/utils/array.d.ts +2 -0
  289. package/node_modules/fast-glob/out/utils/array.js +22 -0
  290. package/node_modules/fast-glob/out/utils/errno.d.ts +2 -0
  291. package/node_modules/fast-glob/out/utils/errno.js +7 -0
  292. package/node_modules/fast-glob/out/utils/fs.d.ts +4 -0
  293. package/node_modules/fast-glob/out/utils/fs.js +19 -0
  294. package/node_modules/fast-glob/out/utils/index.d.ts +8 -0
  295. package/node_modules/fast-glob/out/utils/index.js +17 -0
  296. package/node_modules/fast-glob/out/utils/path.d.ts +13 -0
  297. package/node_modules/fast-glob/out/utils/path.js +68 -0
  298. package/node_modules/fast-glob/out/utils/pattern.d.ts +49 -0
  299. package/node_modules/fast-glob/out/utils/pattern.js +206 -0
  300. package/node_modules/fast-glob/out/utils/stream.d.ts +4 -0
  301. package/node_modules/fast-glob/out/utils/stream.js +17 -0
  302. package/node_modules/fast-glob/out/utils/string.d.ts +2 -0
  303. package/node_modules/fast-glob/out/utils/string.js +11 -0
  304. package/node_modules/fast-glob/package.json +81 -0
  305. package/node_modules/fastq/.github/dependabot.yml +11 -0
  306. package/node_modules/fastq/.github/workflows/ci.yml +75 -0
  307. package/node_modules/fastq/LICENSE +13 -0
  308. package/node_modules/fastq/README.md +312 -0
  309. package/node_modules/fastq/SECURITY.md +15 -0
  310. package/node_modules/fastq/bench.js +66 -0
  311. package/node_modules/fastq/example.js +14 -0
  312. package/node_modules/fastq/example.mjs +11 -0
  313. package/node_modules/fastq/index.d.ts +57 -0
  314. package/node_modules/fastq/package.json +53 -0
  315. package/node_modules/fastq/queue.js +311 -0
  316. package/node_modules/fastq/test/example.ts +83 -0
  317. package/node_modules/fastq/test/promise.js +291 -0
  318. package/node_modules/fastq/test/test.js +653 -0
  319. package/node_modules/fastq/test/tsconfig.json +11 -0
  320. package/node_modules/fill-range/LICENSE +21 -0
  321. package/node_modules/fill-range/README.md +237 -0
  322. package/node_modules/fill-range/index.js +248 -0
  323. package/node_modules/fill-range/package.json +74 -0
  324. package/node_modules/get-stream/buffer-stream.js +51 -0
  325. package/node_modules/get-stream/index.js +50 -0
  326. package/node_modules/get-stream/license +9 -0
  327. package/node_modules/get-stream/package.json +46 -0
  328. package/node_modules/get-stream/readme.md +123 -0
  329. package/node_modules/is-extglob/LICENSE +21 -0
  330. package/node_modules/is-extglob/README.md +107 -0
  331. package/node_modules/is-extglob/index.js +20 -0
  332. package/node_modules/is-extglob/package.json +69 -0
  333. package/node_modules/is-glob/LICENSE +21 -0
  334. package/node_modules/is-glob/README.md +206 -0
  335. package/node_modules/is-glob/index.js +150 -0
  336. package/node_modules/is-glob/package.json +81 -0
  337. package/node_modules/is-number/LICENSE +21 -0
  338. package/node_modules/is-number/README.md +187 -0
  339. package/node_modules/is-number/index.js +18 -0
  340. package/node_modules/is-number/package.json +82 -0
  341. package/node_modules/is-stream/index.js +21 -0
  342. package/node_modules/is-stream/license +21 -0
  343. package/node_modules/is-stream/package.json +38 -0
  344. package/node_modules/is-stream/readme.md +42 -0
  345. package/node_modules/isexe/.npmignore +2 -0
  346. package/node_modules/isexe/LICENSE +15 -0
  347. package/node_modules/isexe/README.md +51 -0
  348. package/node_modules/isexe/index.js +57 -0
  349. package/node_modules/isexe/mode.js +41 -0
  350. package/node_modules/isexe/package.json +31 -0
  351. package/node_modules/isexe/test/basic.js +221 -0
  352. package/node_modules/isexe/windows.js +42 -0
  353. package/node_modules/merge2/LICENSE +21 -0
  354. package/node_modules/merge2/README.md +144 -0
  355. package/node_modules/merge2/index.js +144 -0
  356. package/node_modules/merge2/package.json +43 -0
  357. package/node_modules/micromatch/LICENSE +21 -0
  358. package/node_modules/micromatch/README.md +1024 -0
  359. package/node_modules/micromatch/index.js +474 -0
  360. package/node_modules/micromatch/package.json +119 -0
  361. package/node_modules/nice-try/LICENSE +21 -0
  362. package/node_modules/nice-try/README.md +32 -0
  363. package/node_modules/nice-try/package.json +33 -0
  364. package/node_modules/nice-try/src/index.js +12 -0
  365. package/node_modules/npm-run-path/index.js +39 -0
  366. package/node_modules/npm-run-path/license +21 -0
  367. package/node_modules/npm-run-path/package.json +45 -0
  368. package/node_modules/npm-run-path/readme.md +81 -0
  369. package/node_modules/p-finally/index.js +15 -0
  370. package/node_modules/p-finally/license +21 -0
  371. package/node_modules/p-finally/package.json +42 -0
  372. package/node_modules/p-finally/readme.md +47 -0
  373. package/node_modules/path-key/index.js +13 -0
  374. package/node_modules/path-key/license +21 -0
  375. package/node_modules/path-key/package.json +39 -0
  376. package/node_modules/path-key/readme.md +51 -0
  377. package/node_modules/picomatch/LICENSE +21 -0
  378. package/node_modules/picomatch/README.md +708 -0
  379. package/node_modules/picomatch/index.js +3 -0
  380. package/node_modules/picomatch/lib/constants.js +179 -0
  381. package/node_modules/picomatch/lib/parse.js +1091 -0
  382. package/node_modules/picomatch/lib/picomatch.js +342 -0
  383. package/node_modules/picomatch/lib/scan.js +391 -0
  384. package/node_modules/picomatch/lib/utils.js +64 -0
  385. package/node_modules/picomatch/package.json +81 -0
  386. package/node_modules/pump/.github/FUNDING.yml +2 -0
  387. package/node_modules/pump/.travis.yml +5 -0
  388. package/node_modules/pump/LICENSE +21 -0
  389. package/node_modules/pump/README.md +74 -0
  390. package/node_modules/pump/SECURITY.md +5 -0
  391. package/node_modules/pump/index.js +86 -0
  392. package/node_modules/pump/package.json +24 -0
  393. package/node_modules/pump/test-browser.js +66 -0
  394. package/node_modules/pump/test-node.js +53 -0
  395. package/node_modules/{concat-map → queue-microtask}/LICENSE +3 -1
  396. package/node_modules/queue-microtask/README.md +90 -0
  397. package/node_modules/queue-microtask/index.d.ts +2 -0
  398. package/node_modules/queue-microtask/index.js +9 -0
  399. package/node_modules/queue-microtask/package.json +55 -0
  400. package/node_modules/reusify/.github/dependabot.yml +7 -0
  401. package/node_modules/reusify/.github/workflows/ci.yml +96 -0
  402. package/node_modules/reusify/LICENSE +22 -0
  403. package/node_modules/reusify/README.md +139 -0
  404. package/node_modules/reusify/SECURITY.md +15 -0
  405. package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
  406. package/node_modules/reusify/benchmarks/fib.js +13 -0
  407. package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
  408. package/node_modules/reusify/eslint.config.js +14 -0
  409. package/node_modules/reusify/package.json +50 -0
  410. package/node_modules/reusify/reusify.d.ts +14 -0
  411. package/node_modules/reusify/reusify.js +33 -0
  412. package/node_modules/reusify/test.js +66 -0
  413. package/node_modules/reusify/tsconfig.json +11 -0
  414. package/node_modules/run-parallel/LICENSE +20 -0
  415. package/node_modules/run-parallel/README.md +85 -0
  416. package/node_modules/run-parallel/index.js +51 -0
  417. package/node_modules/run-parallel/package.json +58 -0
  418. package/node_modules/shelljs/LICENSE +23 -20
  419. package/node_modules/shelljs/README.md +173 -65
  420. package/node_modules/shelljs/package.json +38 -22
  421. package/node_modules/shelljs/plugin.js +1 -1
  422. package/node_modules/shelljs/shell.js +70 -12
  423. package/node_modules/shelljs/src/cat.js +3 -3
  424. package/node_modules/shelljs/src/cd.js +2 -1
  425. package/node_modules/shelljs/src/chmod.js +17 -11
  426. package/node_modules/shelljs/src/cmd.js +122 -0
  427. package/node_modules/shelljs/src/common.js +103 -29
  428. package/node_modules/shelljs/src/cp.js +24 -14
  429. package/node_modules/shelljs/src/dirs.js +7 -9
  430. package/node_modules/shelljs/src/echo.js +1 -2
  431. package/node_modules/shelljs/src/errorCode.js +10 -0
  432. package/node_modules/shelljs/src/exec-child.js +60 -28
  433. package/node_modules/shelljs/src/exec.js +39 -10
  434. package/node_modules/shelljs/src/find.js +8 -3
  435. package/node_modules/shelljs/src/grep.js +15 -4
  436. package/node_modules/shelljs/src/head.js +1 -1
  437. package/node_modules/shelljs/src/ln.js +3 -1
  438. package/node_modules/shelljs/src/ls.js +29 -15
  439. package/node_modules/shelljs/src/mkdir.js +13 -11
  440. package/node_modules/shelljs/src/mv.js +4 -3
  441. package/node_modules/shelljs/src/pwd.js +1 -1
  442. package/node_modules/shelljs/src/rm.js +11 -11
  443. package/node_modules/shelljs/src/sed.js +12 -4
  444. package/node_modules/shelljs/src/set.js +0 -1
  445. package/node_modules/shelljs/src/sort.js +3 -2
  446. package/node_modules/shelljs/src/tail.js +12 -2
  447. package/node_modules/shelljs/src/test.js +3 -2
  448. package/node_modules/shelljs/src/to.js +2 -1
  449. package/node_modules/shelljs/src/toEnd.js +2 -1
  450. package/node_modules/shelljs/src/touch.js +13 -7
  451. package/node_modules/shelljs/src/uniq.js +5 -4
  452. package/node_modules/shelljs/src/which.js +5 -4
  453. package/node_modules/shx/README.md +27 -15
  454. package/node_modules/shx/lib/help.js +1 -1
  455. package/node_modules/shx/lib/shx.js +13 -8
  456. package/node_modules/shx/package.json +17 -25
  457. package/node_modules/signal-exit/LICENSE.txt +16 -0
  458. package/node_modules/signal-exit/README.md +39 -0
  459. package/node_modules/signal-exit/index.js +202 -0
  460. package/node_modules/signal-exit/package.json +38 -0
  461. package/node_modules/signal-exit/signals.js +53 -0
  462. package/node_modules/strip-eof/index.js +15 -0
  463. package/node_modules/strip-eof/license +21 -0
  464. package/node_modules/strip-eof/package.json +39 -0
  465. package/node_modules/strip-eof/readme.md +28 -0
  466. package/node_modules/to-regex-range/LICENSE +21 -0
  467. package/node_modules/to-regex-range/README.md +305 -0
  468. package/node_modules/to-regex-range/index.js +288 -0
  469. package/node_modules/to-regex-range/package.json +88 -0
  470. package/package.json +2 -2
  471. package/node_modules/concat-map/.travis.yml +0 -4
  472. package/node_modules/concat-map/README.markdown +0 -62
  473. package/node_modules/concat-map/example/map.js +0 -6
  474. package/node_modules/concat-map/index.js +0 -13
  475. package/node_modules/concat-map/package.json +0 -43
  476. package/node_modules/concat-map/test/map.js +0 -39
  477. package/node_modules/minimatch/README.md +0 -230
  478. package/node_modules/minimatch/minimatch.js +0 -947
  479. package/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -129
  480. package/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -201
  481. package/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -47
  482. package/node_modules/minimatch/package.json +0 -33
  483. package/node_modules/path-is-absolute/index.js +0 -20
  484. package/node_modules/path-is-absolute/package.json +0 -43
  485. package/node_modules/path-is-absolute/readme.md +0 -59
  486. package/node_modules/shelljs/commands.js +0 -29
  487. package/node_modules/shelljs/node_modules/glob/README.md +0 -378
  488. package/node_modules/shelljs/node_modules/glob/common.js +0 -238
  489. package/node_modules/shelljs/node_modules/glob/glob.js +0 -790
  490. package/node_modules/shelljs/node_modules/glob/package.json +0 -55
  491. package/node_modules/shelljs/node_modules/glob/sync.js +0 -486
  492. /package/node_modules/{minimatch → execa/node_modules/semver}/LICENSE +0 -0
  493. /package/node_modules/{path-is-absolute → execa/node_modules/shebang-regex}/license +0 -0
@@ -16,7 +16,7 @@ common.register('popd', _popd, {
16
16
  var _dirStack = [];
17
17
 
18
18
  function _isStackIndex(index) {
19
- return (/^[\-+]\d+$/).test(index);
19
+ return (/^[-+]\d+$/).test(index);
20
20
  }
21
21
 
22
22
  function _parseStackIndex(index) {
@@ -40,7 +40,7 @@ function _actualDirStack() {
40
40
  //@ Available options:
41
41
  //@
42
42
  //@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
43
- //@ + `-q`: Supresses output to the console.
43
+ //@ + `-q`: Suppresses output to the console.
44
44
  //@
45
45
  //@ Arguments:
46
46
  //@
@@ -81,12 +81,10 @@ function _pushd(options, dir) {
81
81
  } else if (_isStackIndex(dir)) {
82
82
  var n = _parseStackIndex(dir);
83
83
  dirs = dirs.slice(n).concat(dirs.slice(0, n));
84
+ } else if (options['no-cd']) {
85
+ dirs.splice(1, 0, dir);
84
86
  } else {
85
- if (options['no-cd']) {
86
- dirs.splice(1, 0, dir);
87
- } else {
88
- dirs.unshift(dir);
89
- }
87
+ dirs.unshift(dir);
90
88
  }
91
89
 
92
90
  if (options['no-cd']) {
@@ -108,7 +106,7 @@ exports.pushd = _pushd;
108
106
  //@ Available options:
109
107
  //@
110
108
  //@ + `-n`: Suppress the normal directory change when removing directories from the stack, so that only the stack is manipulated.
111
- //@ + `-q`: Supresses output to the console.
109
+ //@ + `-q`: Suppresses output to the console.
112
110
  //@
113
111
  //@ Arguments:
114
112
  //@
@@ -162,7 +160,7 @@ exports.popd = _popd;
162
160
  //@ Available options:
163
161
  //@
164
162
  //@ + `-c`: Clears the directory stack by deleting all of the elements.
165
- //@ + `-q`: Supresses output to the console.
163
+ //@ + `-q`: Suppresses output to the console.
166
164
  //@
167
165
  //@ Arguments:
168
166
  //@
@@ -22,8 +22,7 @@ common.register('echo', _echo, {
22
22
  //@ echo('-n', 'no newline at end');
23
23
  //@ ```
24
24
  //@
25
- //@ Prints `string` to stdout, and returns string with additional utility methods
26
- //@ like `.to()`.
25
+ //@ Prints `string` to stdout, and returns a [ShellString](#shellstringstr).
27
26
  function _echo(opts) {
28
27
  // allow strings starting with '-', see issue #20
29
28
  var messages = [].slice.call(arguments, opts ? 0 : 1);
@@ -0,0 +1,10 @@
1
+ var common = require('./common');
2
+
3
+ //@
4
+ //@ ### errorCode()
5
+ //@
6
+ //@ Returns the error code from the last command.
7
+ function errorCode() {
8
+ return common.state.errorCode;
9
+ }
10
+ module.exports = errorCode;
@@ -1,39 +1,71 @@
1
- if (require.main !== module) {
2
- throw new Error('This file should not be required');
3
- }
4
-
5
1
  var childProcess = require('child_process');
6
2
  var fs = require('fs');
7
3
 
8
- var paramFilePath = process.argv[2];
4
+ function main() {
5
+ var paramFilePath = process.argv[2];
6
+
7
+ var serializedParams = fs.readFileSync(paramFilePath, 'utf8');
8
+ var params = JSON.parse(serializedParams);
9
+
10
+ var cmd = params.command;
11
+ var execOptions = params.execOptions;
12
+ var pipe = params.pipe;
13
+ var stdoutFile = params.stdoutFile;
14
+ var stderrFile = params.stderrFile;
9
15
 
10
- var serializedParams = fs.readFileSync(paramFilePath, 'utf8');
11
- var params = JSON.parse(serializedParams);
16
+ function isMaxBufferError(err) {
17
+ var maxBufferErrorPattern = /^.*\bmaxBuffer\b.*exceeded.*$/;
18
+ if (err instanceof Error && err.message &&
19
+ err.message.match(maxBufferErrorPattern)) {
20
+ // < v10
21
+ // Error: stdout maxBuffer exceeded
22
+ return true;
23
+ } else if (err instanceof RangeError && err.message &&
24
+ err.message.match(maxBufferErrorPattern)) {
25
+ // >= v10
26
+ // RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length
27
+ // exceeded
28
+ return true;
29
+ }
30
+ return false;
31
+ }
12
32
 
13
- var cmd = params.command;
14
- var execOptions = params.execOptions;
15
- var pipe = params.pipe;
16
- var stdoutFile = params.stdoutFile;
17
- var stderrFile = params.stderrFile;
33
+ var stdoutStream = fs.createWriteStream(stdoutFile);
34
+ var stderrStream = fs.createWriteStream(stderrFile);
18
35
 
19
- var c = childProcess.exec(cmd, execOptions, function (err) {
20
- if (!err) {
21
- process.exitCode = 0;
22
- } else if (err.code === undefined) {
23
- process.exitCode = 1;
24
- } else {
25
- process.exitCode = err.code;
36
+ function appendError(message, code) {
37
+ stderrStream.write(message);
38
+ process.exitCode = code;
26
39
  }
27
- });
28
40
 
29
- var stdoutStream = fs.createWriteStream(stdoutFile);
30
- var stderrStream = fs.createWriteStream(stderrFile);
41
+ var c = childProcess.exec(cmd, execOptions, function (err) {
42
+ if (!err) {
43
+ process.exitCode = 0;
44
+ } else if (isMaxBufferError(err)) {
45
+ appendError('maxBuffer exceeded', 1);
46
+ } else if (err.code === undefined && err.message) {
47
+ /* istanbul ignore next */
48
+ appendError(err.message, 1);
49
+ } else if (err.code === undefined) {
50
+ /* istanbul ignore next */
51
+ appendError('Unknown issue', 1);
52
+ } else {
53
+ process.exitCode = err.code;
54
+ }
55
+ });
56
+
57
+ c.stdout.pipe(stdoutStream);
58
+ c.stderr.pipe(stderrStream);
59
+ c.stdout.pipe(process.stdout);
60
+ c.stderr.pipe(process.stderr);
31
61
 
32
- c.stdout.pipe(stdoutStream);
33
- c.stderr.pipe(stderrStream);
34
- c.stdout.pipe(process.stdout);
35
- c.stderr.pipe(process.stderr);
62
+ if (pipe) {
63
+ c.stdin.end(pipe);
64
+ }
65
+ }
36
66
 
37
- if (pipe) {
38
- c.stdin.end(pipe);
67
+ // This file should only be executed. This module does not export anything.
68
+ /* istanbul ignore else */
69
+ if (require.main === module) {
70
+ main();
39
71
  }
@@ -12,22 +12,32 @@ common.register('exec', _exec, {
12
12
  unix: false,
13
13
  canReceivePipe: true,
14
14
  wrapOutput: false,
15
+ handlesFatalDynamically: true,
15
16
  });
16
17
 
17
18
  // We use this function to run `exec` synchronously while also providing realtime
18
19
  // output.
19
20
  function execSync(cmd, opts, pipe) {
20
21
  if (!common.config.execPath) {
21
- common.error('Unable to find a path to the node binary. Please manually set config.execPath');
22
+ try {
23
+ common.error('Unable to find a path to the node binary. Please manually set config.execPath');
24
+ } catch (e) {
25
+ if (opts.fatal) {
26
+ throw e;
27
+ }
28
+
29
+ return;
30
+ }
22
31
  }
23
32
 
24
33
  var tempDir = _tempDir();
25
- var paramsFile = path.resolve(tempDir + '/' + common.randomFileName());
26
- var stderrFile = path.resolve(tempDir + '/' + common.randomFileName());
27
- var stdoutFile = path.resolve(tempDir + '/' + common.randomFileName());
34
+ var paramsFile = path.join(tempDir, common.randomFileName());
35
+ var stderrFile = path.join(tempDir, common.randomFileName());
36
+ var stdoutFile = path.join(tempDir, common.randomFileName());
28
37
 
29
38
  opts = common.extend({
30
39
  silent: common.config.silent,
40
+ fatal: common.config.fatal, // TODO(nfischer): this and the line above are probably unnecessary
31
41
  cwd: _pwd().toString(),
32
42
  env: process.env,
33
43
  maxBuffer: DEFAULT_MAXBUFFER_SIZE,
@@ -117,7 +127,7 @@ function execSync(cmd, opts, pipe) {
117
127
  // Note: `silent` should be unconditionally true to avoid double-printing
118
128
  // the command's stderr, and to avoid printing any stderr when the user has
119
129
  // set `shell.config.silent`.
120
- common.error(stderr, code, { continue: true, silent: true });
130
+ common.error(stderr, code, { continue: true, silent: true, fatal: opts.fatal });
121
131
  }
122
132
  var obj = common.ShellString(stdout, stderr, code);
123
133
  return obj;
@@ -127,6 +137,7 @@ function execSync(cmd, opts, pipe) {
127
137
  function execAsync(cmd, opts, pipe, callback) {
128
138
  opts = common.extend({
129
139
  silent: common.config.silent,
140
+ fatal: common.config.fatal, // TODO(nfischer): this and the line above are probably unnecessary
130
141
  cwd: _pwd().toString(),
131
142
  env: process.env,
132
143
  maxBuffer: DEFAULT_MAXBUFFER_SIZE,
@@ -164,6 +175,7 @@ function execAsync(cmd, opts, pipe, callback) {
164
175
  //@
165
176
  //@ + `async`: Asynchronous execution. If a callback is provided, it will be set to
166
177
  //@ `true`, regardless of the passed value (default: `false`).
178
+ //@ + `fatal`: Exit upon error (default: `false`).
167
179
  //@ + `silent`: Do not echo program output to console (default: `false`).
168
180
  //@ + `encoding`: Character encoding to use. Affects the values returned to stdout and stderr, and
169
181
  //@ what is written to stdout and stderr when not in silent mode (default: `'utf8'`).
@@ -187,17 +199,21 @@ function execAsync(cmd, opts, pipe, callback) {
187
199
  //@ });
188
200
  //@ ```
189
201
  //@
190
- //@ Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous
191
- //@ mode, this returns a `ShellString` (compatible with ShellJS v0.6.x, which returns an object
192
- //@ of the form `{ code:..., stdout:... , stderr:... }`). Otherwise, this returns the child process
193
- //@ object, and the `callback` receives the arguments `(code, stdout, stderr)`.
202
+ //@ Executes the given `command` _synchronously_, unless otherwise specified.
203
+ //@ When in synchronous mode, this returns a [ShellString](#shellstringstr).
204
+ //@ Otherwise, this returns the child process object, and the `callback`
205
+ //@ receives the arguments `(code, stdout, stderr)`.
194
206
  //@
195
207
  //@ Not seeing the behavior you want? `exec()` runs everything through `sh`
196
208
  //@ by default (or `cmd.exe` on Windows), which differs from `bash`. If you
197
209
  //@ need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
210
+ //@
211
+ //@ **Security note:** as `shell.exec()` executes an arbitrary string in the
212
+ //@ system shell, it is **critical** to properly sanitize user input to avoid
213
+ //@ **command injection**. For more context, consult the [Security
214
+ //@ Guidelines](https://github.com/shelljs/shelljs/wiki/Security-guidelines).
198
215
  function _exec(command, options, callback) {
199
216
  options = options || {};
200
- if (!command) common.error('must specify command');
201
217
 
202
218
  var pipe = common.readFromPipe();
203
219
 
@@ -214,9 +230,22 @@ function _exec(command, options, callback) {
214
230
 
215
231
  options = common.extend({
216
232
  silent: common.config.silent,
233
+ fatal: common.config.fatal,
217
234
  async: false,
218
235
  }, options);
219
236
 
237
+ if (!command) {
238
+ try {
239
+ common.error('must specify command');
240
+ } catch (e) {
241
+ if (options.fatal) {
242
+ throw e;
243
+ }
244
+
245
+ return;
246
+ }
247
+ }
248
+
220
249
  if (options.async) {
221
250
  return execAsync(command, options, pipe, callback);
222
251
  } else {
@@ -2,7 +2,11 @@ var path = require('path');
2
2
  var common = require('./common');
3
3
  var _ls = require('./ls');
4
4
 
5
- common.register('find', _find, {});
5
+ common.register('find', _find, {
6
+ cmdOptions: {
7
+ 'L': 'link',
8
+ },
9
+ });
6
10
 
7
11
  //@
8
12
  //@ ### find(path [, path ...])
@@ -16,7 +20,8 @@ common.register('find', _find, {});
16
20
  //@ find('.').filter(function(file) { return file.match(/\.js$/); });
17
21
  //@ ```
18
22
  //@
19
- //@ Returns array of all files (however deep) in the given paths.
23
+ //@ Returns a [ShellString](#shellstringstr) (with array-like properties) of all
24
+ //@ files (however deep) in the given paths.
20
25
  //@
21
26
  //@ The main difference from `ls('-R', path)` is that the resulting file names
22
27
  //@ include the base directories (e.g., `lib/resources/file1` instead of just `file1`).
@@ -50,7 +55,7 @@ function _find(options, paths) {
50
55
  pushFile(file);
51
56
 
52
57
  if (stat.isDirectory()) {
53
- _ls({ recursive: true, all: true }, file).forEach(function (subfile) {
58
+ _ls({ recursive: true, all: true, link: options.link }, file).forEach(function (subfile) {
54
59
  pushFile(path.join(file, subfile));
55
60
  });
56
61
  }
@@ -8,6 +8,7 @@ common.register('grep', _grep, {
8
8
  'v': 'inverse',
9
9
  'l': 'nameOnly',
10
10
  'i': 'ignoreCase',
11
+ 'n': 'lineNumber',
11
12
  },
12
13
  });
13
14
 
@@ -20,6 +21,7 @@ common.register('grep', _grep, {
20
21
  //@ + `-v`: Invert `regex_filter` (only print non-matching lines).
21
22
  //@ + `-l`: Print only filenames of matching files.
22
23
  //@ + `-i`: Ignore case.
24
+ //@ + `-n`: Print line numbers.
23
25
  //@
24
26
  //@ Examples:
25
27
  //@
@@ -28,8 +30,9 @@ common.register('grep', _grep, {
28
30
  //@ grep('GLOBAL_VARIABLE', '*.js');
29
31
  //@ ```
30
32
  //@
31
- //@ Reads input string from given files and returns a string containing all lines of the
32
- //@ file that match the given `regex_filter`.
33
+ //@ Reads input string from given files and returns a
34
+ //@ [ShellString](#shellstringstr) containing all lines of the @ file that match
35
+ //@ the given `regex_filter`.
33
36
  function _grep(options, regex, files) {
34
37
  // Check if this is coming from a pipe
35
38
  var pipe = common.readFromPipe();
@@ -59,15 +62,23 @@ function _grep(options, regex, files) {
59
62
  }
60
63
  } else {
61
64
  var lines = contents.split('\n');
62
- lines.forEach(function (line) {
65
+ lines.forEach(function (line, index) {
63
66
  var matched = line.match(regex);
64
67
  if ((options.inverse && !matched) || (!options.inverse && matched)) {
65
- grep.push(line);
68
+ var result = line;
69
+ if (options.lineNumber) {
70
+ result = '' + (index + 1) + ':' + line;
71
+ }
72
+ grep.push(result);
66
73
  }
67
74
  });
68
75
  }
69
76
  });
70
77
 
78
+ if (grep.length === 0 && common.state.errorCode !== 2) {
79
+ // We didn't hit the error above, but pattern didn't match
80
+ common.error('', { silent: true });
81
+ }
71
82
  return grep.join('\n') + '\n';
72
83
  }
73
84
  module.exports = _grep;
@@ -46,7 +46,7 @@ function readSomeLines(file, numLines) {
46
46
  //@ var str = head(['file1', 'file2']); // same as above
47
47
  //@ ```
48
48
  //@
49
- //@ Read the start of a file.
49
+ //@ Read the start of a `file`. Returns a [ShellString](#shellstringstr).
50
50
  function _head(options, files) {
51
51
  var head = [];
52
52
  var pipe = common.readFromPipe();
@@ -24,7 +24,9 @@ common.register('ln', _ln, {
24
24
  //@ ln('-sf', 'file', 'existing');
25
25
  //@ ```
26
26
  //@
27
- //@ Links `source` to `dest`. Use `-f` to force the link, should `dest` already exist.
27
+ //@ Links `source` to `dest`. Use `-f` to force the link, should `dest` already
28
+ //@ exist. Returns a [ShellString](#shellstringstr) indicating success or
29
+ //@ failure.
28
30
  function _ln(options, source, dest) {
29
31
  if (!source || !dest) {
30
32
  common.error('Missing <source> and/or <dest>');
@@ -1,9 +1,10 @@
1
1
  var path = require('path');
2
2
  var fs = require('fs');
3
3
  var common = require('./common');
4
- var glob = require('glob');
4
+ var glob = require('fast-glob');
5
5
 
6
- var globPatternRecursive = path.sep + '**';
6
+ // glob patterns use the UNIX path seperator
7
+ var globPatternRecursive = '/**';
7
8
 
8
9
  common.register('ls', _ls, {
9
10
  cmdOptions: {
@@ -26,22 +27,28 @@ common.register('ls', _ls, {
26
27
  //@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
27
28
  //@ + `-L`: follow symlinks
28
29
  //@ + `-d`: list directories themselves, not their contents
29
- //@ + `-l`: list objects representing each file, each with fields containing `ls
30
- //@ -l` output fields. See
31
- //@ [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
32
- //@ for more info
30
+ //@ + `-l`: provides more details for each file. Specifically, each file is
31
+ //@ represented by a structured object with separate fields for file
32
+ //@ metadata (see
33
+ //@ [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)). The
34
+ //@ return value also overrides `.toString()` to resemble `ls -l`'s
35
+ //@ output format for human readability, but programmatic usage should
36
+ //@ depend on the stable object format rather than the `.toString()`
37
+ //@ representation.
33
38
  //@
34
39
  //@ Examples:
35
40
  //@
36
41
  //@ ```javascript
37
42
  //@ ls('projs/*.js');
43
+ //@ ls('projs/**/*.js'); // Find all js files recursively in projs
38
44
  //@ ls('-R', '/users/me', '/tmp');
39
45
  //@ ls('-R', ['/users/me', '/tmp']); // same as above
40
46
  //@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
41
47
  //@ ```
42
48
  //@
43
- //@ Returns array of files in the given `path`, or files in
44
- //@ the current directory if no `path` is provided.
49
+ //@ Returns a [ShellString](#shellstringstr) (with array-like properties) of all
50
+ //@ the files in the given `path`, or files in the current directory if no
51
+ //@ `path` is provided.
45
52
  function _ls(options, paths) {
46
53
  if (options.all_deprecated) {
47
54
  // We won't support the -a option as it's hard to image why it's useful
@@ -99,13 +106,20 @@ function _ls(options, paths) {
99
106
  if (stat.isDirectory() && !options.directory) {
100
107
  if (options.recursive) {
101
108
  // use glob, because it's simple
102
- glob.sync(p + globPatternRecursive, { dot: options.all, follow: options.link })
103
- .forEach(function (item) {
104
- // Glob pattern returns the directory itself and needs to be filtered out.
105
- if (path.relative(p, item)) {
106
- pushFile(item, path.relative(p, item));
107
- }
108
- });
109
+ glob.sync(p + globPatternRecursive, {
110
+ // These options are just to make fast-glob be compatible with POSIX
111
+ // (bash) wildcard behavior.
112
+ onlyFiles: false,
113
+
114
+ // These options depend on the cmdOptions provided to ls.
115
+ dot: options.all,
116
+ followSymbolicLinks: options.link,
117
+ }).forEach(function (item) {
118
+ // Glob pattern returns the directory itself and needs to be filtered out.
119
+ if (path.relative(p, item)) {
120
+ pushFile(item, path.relative(p, item));
121
+ }
122
+ });
109
123
  } else if (options.all) {
110
124
  // use fs.readdirSync, because it's fast
111
125
  fs.readdirSync(p).forEach(function (item) {
@@ -19,17 +19,18 @@ function mkdirSyncRecursive(dir) {
19
19
  common.error('dirname() failed: [' + dir + ']');
20
20
  }
21
21
 
22
- // Base dir exists, no recursion necessary
23
- if (fs.existsSync(baseDir)) {
24
- fs.mkdirSync(dir, parseInt('0777', 8));
25
- return;
26
- }
27
-
28
22
  // Base dir does not exist, go recursive
29
- mkdirSyncRecursive(baseDir);
23
+ if (!fs.existsSync(baseDir)) {
24
+ mkdirSyncRecursive(baseDir);
25
+ }
30
26
 
31
- // Base dir created, can create dir
32
- fs.mkdirSync(dir, parseInt('0777', 8));
27
+ try {
28
+ // Base dir created, can create dir
29
+ fs.mkdirSync(dir, parseInt('0777', 8));
30
+ } catch (e) {
31
+ // swallow error if dir already exists
32
+ if (e.code !== 'EEXIST' || common.statNoFollowLinks(dir).isFile()) { throw e; }
33
+ }
33
34
  }
34
35
 
35
36
  //@
@@ -47,7 +48,8 @@ function mkdirSyncRecursive(dir) {
47
48
  //@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
48
49
  //@ ```
49
50
  //@
50
- //@ Creates directories.
51
+ //@ Creates directories. Returns a [ShellString](#shellstringstr) indicating
52
+ //@ success or failure.
51
53
  function _mkdir(options, dirs) {
52
54
  if (!dirs) common.error('no paths given');
53
55
 
@@ -96,5 +98,5 @@ function _mkdir(options, dirs) {
96
98
  }
97
99
  });
98
100
  return '';
99
- } // mkdir
101
+ } // man arraykdir
100
102
  module.exports = _mkdir;
@@ -36,7 +36,8 @@ function checkRecentCreated(sources, index) {
36
36
  //@ mv(['file1', 'file2'], 'dir/'); // same as above
37
37
  //@ ```
38
38
  //@
39
- //@ Moves `source` file(s) to `dest`.
39
+ //@ Moves `source` file(s) to `dest`. Returns a [ShellString](#shellstringstr)
40
+ //@ indicating success or failure.
40
41
  function _mv(options, sources, dest) {
41
42
  // Get sources, dest
42
43
  if (arguments.length < 3) {
@@ -108,8 +109,8 @@ function _mv(options, sources, dest) {
108
109
  // to perform a copy and then clean up the original file. If either the
109
110
  // copy or the rm fails with an exception, we should allow this
110
111
  // exception to pass up to the top level.
111
- cp('-r', src, thisDest);
112
- rm('-rf', src);
112
+ cp({ recursive: true }, src, thisDest);
113
+ rm({ recursive: true, force: true }, src);
113
114
  }
114
115
  }
115
116
  }); // forEach(src)
@@ -8,7 +8,7 @@ common.register('pwd', _pwd, {
8
8
  //@
9
9
  //@ ### pwd()
10
10
  //@
11
- //@ Returns the current directory.
11
+ //@ Returns the current directory as a [ShellString](#shellstringstr).
12
12
  function _pwd() {
13
13
  var pwd = path.resolve(process.cwd());
14
14
  return pwd;
@@ -29,16 +29,15 @@ function rmdirSyncRecursive(dir, force, fromSymlink) {
29
29
 
30
30
  if (currFile.isDirectory()) { // Recursive function back to the beginning
31
31
  rmdirSyncRecursive(file, force);
32
- } else { // Assume it's a file - perhaps a try/catch belongs here?
33
- if (force || isWriteable(file)) {
34
- try {
35
- common.unlinkSync(file);
36
- } catch (e) {
37
- /* istanbul ignore next */
38
- common.error('could not remove file (code ' + e.code + '): ' + file, {
39
- continue: true,
40
- });
41
- }
32
+ } else if (force || isWriteable(file)) {
33
+ // Assume it's a file - perhaps a try/catch belongs here?
34
+ try {
35
+ common.unlinkSync(file);
36
+ } catch (e) {
37
+ /* istanbul ignore next */
38
+ common.error('could not remove file (code ' + e.code + '): ' + file, {
39
+ continue: true,
40
+ });
42
41
  }
43
42
  }
44
43
  }
@@ -163,7 +162,8 @@ function handleFIFO(file) {
163
162
  //@ rm(['some_file.txt', 'another_file.txt']); // same as above
164
163
  //@ ```
165
164
  //@
166
- //@ Removes files.
165
+ //@ Removes files. Returns a [ShellString](#shellstringstr) indicating success
166
+ //@ or failure.
167
167
  function _rm(options, files) {
168
168
  if (!files) common.error('no paths given');
169
169
 
@@ -21,11 +21,11 @@ common.register('sed', _sed, {
21
21
  //@
22
22
  //@ ```javascript
23
23
  //@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
24
- //@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
25
24
  //@ ```
26
25
  //@
27
- //@ Reads an input string from `file`s, and performs a JavaScript `replace()` on the input
28
- //@ using the given `search_regex` and `replacement` string or function. Returns the new string after replacement.
26
+ //@ Reads an input string from `file`s, line by line, and performs a JavaScript `replace()` on
27
+ //@ each of the lines from the input string using the given `search_regex` and `replacement` string or
28
+ //@ function. Returns the new [ShellString](#shellstringstr) after replacement.
29
29
  //@
30
30
  //@ Note:
31
31
  //@
@@ -35,6 +35,10 @@ common.register('sed', _sed, {
35
35
  //@ ```javascript
36
36
  //@ sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
37
37
  //@ ```
38
+ //@
39
+ //@ Also, like unix `sed`, ShellJS `sed` runs replacements on each line from the input file
40
+ //@ (split by '\n') separately, so `search_regex`es that span more than one line (or include '\n')
41
+ //@ will not match anything and nothing will be replaced.
38
42
  function _sed(options, regex, replacement, files) {
39
43
  // Check if this is coming from a pipe
40
44
  var pipe = common.readFromPipe();
@@ -82,6 +86,10 @@ function _sed(options, regex, replacement, files) {
82
86
  }
83
87
  });
84
88
 
85
- return sed.join('\n');
89
+ if (options.inplace) {
90
+ return '';
91
+ } else {
92
+ return sed.join('\n');
93
+ }
86
94
  }
87
95
  module.exports = _sed;
@@ -51,6 +51,5 @@ function _set(options) {
51
51
  common.config[key] = options[key];
52
52
  }
53
53
  });
54
- return;
55
54
  }
56
55
  module.exports = _set;
@@ -54,8 +54,9 @@ function numericalCmp(a, b) {
54
54
  //@ sort('-r', 'foo.txt');
55
55
  //@ ```
56
56
  //@
57
- //@ Return the contents of the `file`s, sorted line-by-line. Sorting multiple
58
- //@ files mixes their content (just as unix `sort` does).
57
+ //@ Return the contents of the `file`s, sorted line-by-line as a
58
+ //@ [ShellString](#shellstringstr). Sorting multiple files mixes their content
59
+ //@ (just as unix `sort` does).
59
60
  function _sort(options, files) {
60
61
  // Check if this is coming from a pipe
61
62
  var pipe = common.readFromPipe();