@zuplo/cli 6.69.9 → 6.69.11

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 (200) hide show
  1. package/dist/__tests__/integration/jest-mocks-setup.js +3 -0
  2. package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
  3. package/dist/cli.js +4 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cmds/bucket/list.d.ts.map +1 -1
  6. package/dist/cmds/bucket/list.js +1 -8
  7. package/dist/cmds/bucket/list.js.map +1 -1
  8. package/dist/cmds/build.d.ts.map +1 -1
  9. package/dist/cmds/build.js +1 -2
  10. package/dist/cmds/build.js.map +1 -1
  11. package/dist/cmds/compile.d.ts.map +1 -1
  12. package/dist/cmds/compile.js +1 -2
  13. package/dist/cmds/compile.js.map +1 -1
  14. package/dist/cmds/custom-domain/create.d.ts.map +1 -1
  15. package/dist/cmds/custom-domain/create.js +1 -8
  16. package/dist/cmds/custom-domain/create.js.map +1 -1
  17. package/dist/cmds/custom-domain/delete.d.ts.map +1 -1
  18. package/dist/cmds/custom-domain/delete.js +1 -8
  19. package/dist/cmds/custom-domain/delete.js.map +1 -1
  20. package/dist/cmds/custom-domain/list.d.ts.map +1 -1
  21. package/dist/cmds/custom-domain/list.js +1 -8
  22. package/dist/cmds/custom-domain/list.js.map +1 -1
  23. package/dist/cmds/custom-domain/update.d.ts.map +1 -1
  24. package/dist/cmds/custom-domain/update.js +1 -8
  25. package/dist/cmds/custom-domain/update.js.map +1 -1
  26. package/dist/cmds/delete.d.ts.map +1 -1
  27. package/dist/cmds/delete.js +0 -2
  28. package/dist/cmds/delete.js.map +1 -1
  29. package/dist/cmds/deploy.d.ts.map +1 -1
  30. package/dist/cmds/deploy.js +0 -2
  31. package/dist/cmds/deploy.js.map +1 -1
  32. package/dist/cmds/dev.d.ts.map +1 -1
  33. package/dist/cmds/dev.js +1 -2
  34. package/dist/cmds/dev.js.map +1 -1
  35. package/dist/cmds/docs.d.ts.map +1 -1
  36. package/dist/cmds/docs.js +1 -2
  37. package/dist/cmds/docs.js.map +1 -1
  38. package/dist/cmds/editor.d.ts.map +1 -1
  39. package/dist/cmds/editor.js +1 -2
  40. package/dist/cmds/editor.js.map +1 -1
  41. package/dist/cmds/init.d.ts.map +1 -1
  42. package/dist/cmds/init.js +1 -3
  43. package/dist/cmds/init.js.map +1 -1
  44. package/dist/cmds/link.d.ts.map +1 -1
  45. package/dist/cmds/link.js +0 -2
  46. package/dist/cmds/link.js.map +1 -1
  47. package/dist/cmds/list.d.ts.map +1 -1
  48. package/dist/cmds/list.js +0 -2
  49. package/dist/cmds/list.js.map +1 -1
  50. package/dist/cmds/login.d.ts.map +1 -1
  51. package/dist/cmds/login.js +2 -2
  52. package/dist/cmds/login.js.map +1 -1
  53. package/dist/cmds/logout.d.ts.map +1 -1
  54. package/dist/cmds/logout.js +2 -3
  55. package/dist/cmds/logout.js.map +1 -1
  56. package/dist/cmds/mtls-certificates/create.d.ts.map +1 -1
  57. package/dist/cmds/mtls-certificates/create.js +0 -2
  58. package/dist/cmds/mtls-certificates/create.js.map +1 -1
  59. package/dist/cmds/mtls-certificates/delete.d.ts.map +1 -1
  60. package/dist/cmds/mtls-certificates/delete.js +0 -2
  61. package/dist/cmds/mtls-certificates/delete.js.map +1 -1
  62. package/dist/cmds/mtls-certificates/describe.d.ts.map +1 -1
  63. package/dist/cmds/mtls-certificates/describe.js +0 -2
  64. package/dist/cmds/mtls-certificates/describe.js.map +1 -1
  65. package/dist/cmds/mtls-certificates/disable.d.ts.map +1 -1
  66. package/dist/cmds/mtls-certificates/disable.js +0 -2
  67. package/dist/cmds/mtls-certificates/disable.js.map +1 -1
  68. package/dist/cmds/mtls-certificates/list.d.ts.map +1 -1
  69. package/dist/cmds/mtls-certificates/list.js +0 -2
  70. package/dist/cmds/mtls-certificates/list.js.map +1 -1
  71. package/dist/cmds/mtls-certificates/update.d.ts.map +1 -1
  72. package/dist/cmds/mtls-certificates/update.js +0 -2
  73. package/dist/cmds/mtls-certificates/update.js.map +1 -1
  74. package/dist/cmds/project/create.d.ts.map +1 -1
  75. package/dist/cmds/project/create.js +1 -8
  76. package/dist/cmds/project/create.js.map +1 -1
  77. package/dist/cmds/project/info.d.ts.map +1 -1
  78. package/dist/cmds/project/info.js +1 -2
  79. package/dist/cmds/project/info.js.map +1 -1
  80. package/dist/cmds/proxies/create.d.ts.map +1 -1
  81. package/dist/cmds/proxies/create.js +0 -2
  82. package/dist/cmds/proxies/create.js.map +1 -1
  83. package/dist/cmds/proxies/delete.d.ts.map +1 -1
  84. package/dist/cmds/proxies/delete.js +0 -2
  85. package/dist/cmds/proxies/delete.js.map +1 -1
  86. package/dist/cmds/proxies/describe.d.ts.map +1 -1
  87. package/dist/cmds/proxies/describe.js +0 -2
  88. package/dist/cmds/proxies/describe.js.map +1 -1
  89. package/dist/cmds/proxies/update.d.ts.map +1 -1
  90. package/dist/cmds/proxies/update.js +0 -2
  91. package/dist/cmds/proxies/update.js.map +1 -1
  92. package/dist/cmds/source/migrate.d.ts.map +1 -1
  93. package/dist/cmds/source/migrate.js +1 -2
  94. package/dist/cmds/source/migrate.js.map +1 -1
  95. package/dist/cmds/source/upgrade.d.ts.map +1 -1
  96. package/dist/cmds/source/upgrade.js +1 -2
  97. package/dist/cmds/source/upgrade.js.map +1 -1
  98. package/dist/cmds/test.d.ts.map +1 -1
  99. package/dist/cmds/test.js +1 -2
  100. package/dist/cmds/test.js.map +1 -1
  101. package/dist/cmds/tunnel/create.d.ts.map +1 -1
  102. package/dist/cmds/tunnel/create.js +1 -8
  103. package/dist/cmds/tunnel/create.js.map +1 -1
  104. package/dist/cmds/tunnel/delete.d.ts.map +1 -1
  105. package/dist/cmds/tunnel/delete.js +1 -8
  106. package/dist/cmds/tunnel/delete.js.map +1 -1
  107. package/dist/cmds/tunnel/describe.d.ts.map +1 -1
  108. package/dist/cmds/tunnel/describe.js +1 -8
  109. package/dist/cmds/tunnel/describe.js.map +1 -1
  110. package/dist/cmds/tunnel/list.d.ts.map +1 -1
  111. package/dist/cmds/tunnel/list.js +1 -8
  112. package/dist/cmds/tunnel/list.js.map +1 -1
  113. package/dist/cmds/tunnel/rotate-token.d.ts.map +1 -1
  114. package/dist/cmds/tunnel/rotate-token.js +1 -8
  115. package/dist/cmds/tunnel/rotate-token.js.map +1 -1
  116. package/dist/cmds/tunnel/services/describe.d.ts.map +1 -1
  117. package/dist/cmds/tunnel/services/describe.js +1 -8
  118. package/dist/cmds/tunnel/services/describe.js.map +1 -1
  119. package/dist/cmds/tunnel/services/update.d.ts.map +1 -1
  120. package/dist/cmds/tunnel/services/update.js +1 -8
  121. package/dist/cmds/tunnel/services/update.js.map +1 -1
  122. package/dist/cmds/variable/create.d.ts.map +1 -1
  123. package/dist/cmds/variable/create.js +0 -2
  124. package/dist/cmds/variable/create.js.map +1 -1
  125. package/dist/cmds/variable/update.d.ts.map +1 -1
  126. package/dist/cmds/variable/update.js +0 -2
  127. package/dist/cmds/variable/update.js.map +1 -1
  128. package/dist/cmds/whoami.d.ts.map +1 -1
  129. package/dist/cmds/whoami.js +1 -2
  130. package/dist/cmds/whoami.js.map +1 -1
  131. package/dist/common/middleware/check-pnpm-lifecycle.d.ts +17 -0
  132. package/dist/common/middleware/check-pnpm-lifecycle.d.ts.map +1 -0
  133. package/dist/common/middleware/check-pnpm-lifecycle.js +96 -0
  134. package/dist/common/middleware/check-pnpm-lifecycle.js.map +1 -0
  135. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +2 -0
  136. package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +1 -0
  137. package/dist/common/middleware/check-pnpm-lifecycle.test.js +125 -0
  138. package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +1 -0
  139. package/dist/common/utils/pnpm-lifecycle.d.ts +13 -0
  140. package/dist/common/utils/pnpm-lifecycle.d.ts.map +1 -0
  141. package/dist/common/utils/pnpm-lifecycle.js +100 -0
  142. package/dist/common/utils/pnpm-lifecycle.js.map +1 -0
  143. package/dist/common/utils/pnpm-lifecycle.test.d.ts +2 -0
  144. package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +1 -0
  145. package/dist/common/utils/pnpm-lifecycle.test.js +177 -0
  146. package/dist/common/utils/pnpm-lifecycle.test.js.map +1 -0
  147. package/dist/tsconfig.tsbuildinfo +1 -1
  148. package/node_modules/@types/node/README.md +1 -1
  149. package/node_modules/@types/node/http2.d.ts +80 -12
  150. package/node_modules/@types/node/package.json +2 -2
  151. package/node_modules/@zuplo/core/package.json +1 -1
  152. package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
  153. package/node_modules/@zuplo/graphql/out/types/index.d.ts +3 -0
  154. package/node_modules/@zuplo/graphql/package.json +1 -1
  155. package/node_modules/@zuplo/openapi-tools/package.json +2 -2
  156. package/node_modules/@zuplo/otel/package.json +1 -1
  157. package/node_modules/@zuplo/runtime/out/esm/index.js +94 -94
  158. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  159. package/node_modules/@zuplo/runtime/out/types/index.d.ts +72 -0
  160. package/node_modules/@zuplo/runtime/package.json +2 -2
  161. package/node_modules/brace-expansion/dist/commonjs/index.js +1 -1
  162. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  163. package/node_modules/brace-expansion/dist/esm/index.js +1 -1
  164. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  165. package/node_modules/brace-expansion/package.json +1 -1
  166. package/node_modules/get-east-asian-width/lookup-data.js +15 -12
  167. package/node_modules/get-east-asian-width/lookup.js +25 -22
  168. package/node_modules/get-east-asian-width/package.json +1 -1
  169. package/node_modules/pino-http/node_modules/thread-stream/.github/workflows/ci.yml +4 -4
  170. package/node_modules/pino-http/node_modules/thread-stream/README.md +4 -1
  171. package/node_modules/pino-http/node_modules/thread-stream/index.d.ts +7 -0
  172. package/node_modules/pino-http/node_modules/thread-stream/index.js +120 -21
  173. package/node_modules/pino-http/node_modules/thread-stream/lib/worker.js +101 -0
  174. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/LICENSE.md +21 -0
  175. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/README.md +51 -0
  176. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/package.json +38 -0
  177. package/node_modules/pino-http/node_modules/thread-stream/node_modules/real-require/src/index.js +14 -0
  178. package/node_modules/pino-http/node_modules/thread-stream/package.json +10 -12
  179. package/node_modules/pino-http/node_modules/thread-stream/test/flush-worker.js +68 -0
  180. package/node_modules/pino-http/node_modules/thread-stream/test/flush.test.js +112 -0
  181. package/node_modules/pino-http/node_modules/thread-stream/test/message-without-code.js +19 -0
  182. package/node_modules/pino-http/node_modules/thread-stream/test/report-thread-name.js +16 -0
  183. package/node_modules/pino-http/node_modules/thread-stream/test/thread-management.test.js +12 -0
  184. package/node_modules/pino-http/node_modules/thread-stream/test/watch-mode.test.js +30 -0
  185. package/node_modules/pino-http/node_modules/thread-stream/test/worker-name.test.js +43 -0
  186. package/node_modules/protobufjs/dist/light/protobuf.js +5 -3
  187. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  188. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  189. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  190. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  191. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  192. package/node_modules/protobufjs/dist/protobuf.js +5 -3
  193. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  194. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  195. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  196. package/node_modules/protobufjs/package.json +1 -1
  197. package/node_modules/protobufjs/src/namespace.js +3 -1
  198. package/package.json +7 -7
  199. package/node_modules/pino-http/node_modules/thread-stream/.husky/pre-commit +0 -4
  200. package/node_modules/pino-http/node_modules/thread-stream/CLAUDE.md +0 -53
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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AA;gBACtC,IAAI,CAAC,KAAK,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;oBACtC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { balanced } from 'balanced-match'\n\nconst escSlash = '\\0SLASH' + Math.random() + '\\0'\nconst escOpen = '\\0OPEN' + Math.random() + '\\0'\nconst escClose = '\\0CLOSE' + Math.random() + '\\0'\nconst escComma = '\\0COMMA' + Math.random() + '\\0'\nconst escPeriod = '\\0PERIOD' + Math.random() + '\\0'\nconst escSlashPattern = new RegExp(escSlash, 'g')\nconst escOpenPattern = new RegExp(escOpen, 'g')\nconst escClosePattern = new RegExp(escClose, 'g')\nconst escCommaPattern = new RegExp(escComma, 'g')\nconst escPeriodPattern = new RegExp(escPeriod, 'g')\nconst slashPattern = /\\\\\\\\/g\nconst openPattern = /\\\\{/g\nconst closePattern = /\\\\}/g\nconst commaPattern = /\\\\,/g\nconst periodPattern = /\\\\\\./g\n\nexport const EXPANSION_MAX = 100_000\n\nfunction numeric(str: string) {\n return !isNaN(str as any) ? parseInt(str, 10) : str.charCodeAt(0)\n}\n\nfunction escapeBraces(str: string) {\n return str\n .replace(slashPattern, escSlash)\n .replace(openPattern, escOpen)\n .replace(closePattern, escClose)\n .replace(commaPattern, escComma)\n .replace(periodPattern, escPeriod)\n}\n\nfunction unescapeBraces(str: string) {\n return str\n .replace(escSlashPattern, '\\\\')\n .replace(escOpenPattern, '{')\n .replace(escClosePattern, '}')\n .replace(escCommaPattern, ',')\n .replace(escPeriodPattern, '.')\n}\n\n/**\n * Basically just str.split(\",\"), but handling cases\n * where we have nested braced sections, which should be\n * treated as individual members, like {a,{b,c},d}\n */\nfunction parseCommaParts(str: string) {\n if (!str) {\n return ['']\n }\n\n const parts: string[] = []\n const m = balanced('{', '}', str)\n\n if (!m) {\n return str.split(',')\n }\n\n const { pre, body, post } = m\n const p = pre.split(',')\n\n p[p.length - 1] += '{' + body + '}'\n const postParts = parseCommaParts(post)\n if (post.length) {\n ;(p[p.length - 1] as string) += postParts.shift()\n p.push.apply(p, postParts)\n }\n\n parts.push.apply(parts, p)\n\n return parts\n}\n\nexport type BraceExpansionOptions = {\n max?: number\n}\n\nexport function expand(str: string, options: BraceExpansionOptions = {}) {\n if (!str) {\n return []\n }\n\n const { max = EXPANSION_MAX } = options\n\n // I don't know why Bash 4.3 does this, but it does.\n // Anything starting with {} will have the first two bytes preserved\n // but *only* at the top level, so {},a}b will not expand to anything,\n // but a{},b}c will be expanded to [a}c,abc].\n // One could argue that this is a bug in Bash, but since the goal of\n // this module is to match Bash's rules, we escape a leading {}\n if (str.slice(0, 2) === '{}') {\n str = '\\\\{\\\\}' + str.slice(2)\n }\n\n return expand_(escapeBraces(str), max, true).map(unescapeBraces)\n}\n\nfunction embrace(str: string) {\n return '{' + str + '}'\n}\n\nfunction isPadded(el: string) {\n return /^-?0\\d/.test(el)\n}\n\nfunction lte(i: number, y: number) {\n return i <= y\n}\n\nfunction gte(i: number, y: number) {\n return i >= y\n}\n\nfunction expand_(str: string, max: number, isTop: boolean): string[] {\n /** @type {string[]} */\n const expansions: string[] = []\n\n const m = balanced('{', '}', str)\n if (!m) return [str]\n\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = m.pre\n const post: string[] = m.post.length ? expand_(m.post, max, false) : ['']\n\n if (/\\$$/.test(m.pre)) {\n for (let k = 0; k < post.length && k < max; k++) {\n const expansion = pre + '{' + m.body + '}' + post[k]\n expansions.push(expansion)\n }\n } else {\n const isNumericSequence = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(m.body)\n const isAlphaSequence = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(\n m.body,\n )\n const isSequence = isNumericSequence || isAlphaSequence\n const isOptions = m.body.indexOf(',') >= 0\n if (!isSequence && !isOptions) {\n // {a},b}\n if (m.post.match(/,(?!,).*\\}/)) {\n str = m.pre + '{' + m.body + escClose + m.post\n return expand_(str, max, true)\n }\n return [str]\n }\n\n let n: string[]\n if (isSequence) {\n n = m.body.split(/\\.\\./)\n } else {\n n = parseCommaParts(m.body)\n if (n.length === 1 && n[0] !== undefined) {\n // x{{a,b}}y ==> x{a}y x{b}y\n n = expand_(n[0], max, false).map(embrace)\n //XXX is this necessary? Can't seem to hit it in tests.\n /* c8 ignore start */\n if (n.length === 1) {\n return post.map(p => m.pre + n[0] + p)\n }\n /* c8 ignore stop */\n }\n }\n\n // at this point, n is the parts, and we know it's not a comma set\n // with a single entry.\n let N: string[]\n\n if (isSequence && n[0] !== undefined && n[1] !== undefined) {\n const x = numeric(n[0])\n const y = numeric(n[1])\n const width = Math.max(n[0].length, n[1].length)\n let incr =\n n.length === 3 && n[2] !== undefined ?\n Math.max(Math.abs(numeric(n[2])), 1)\n : 1\n let test = lte\n const reverse = y < x\n if (reverse) {\n incr *= -1\n test = gte\n }\n const pad = n.some(isPadded)\n\n N = []\n\n for (let i = x; test(i, y); i += incr) {\n let c\n if (isAlphaSequence) {\n c = String.fromCharCode(i)\n if (c === '\\\\') {\n c = ''\n }\n } else {\n c = String(i)\n if (pad) {\n const need = width - c.length\n if (need > 0) {\n const z = new Array(need + 1).join('0')\n if (i < 0) {\n c = '-' + z + c.slice(1)\n } else {\n c = z + c\n }\n }\n }\n }\n N.push(c)\n }\n } else {\n N = []\n\n for (let j = 0; j < n.length; j++) {\n N.push.apply(N, expand_(n[j] as string, max, false))\n }\n }\n\n for (let j = 0; j < N.length; j++) {\n for (let k = 0; k < post.length && expansions.length < max; k++) {\n const expansion = pre + N[j] + post[k]\n if (!isTop || isSequence || expansion) {\n expansions.push(expansion)\n }\n }\n }\n }\n\n return expansions\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,g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AI,SAAS,EAAE,CAAC;oBACtC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { balanced } from 'balanced-match'\n\nconst escSlash = '\\0SLASH' + Math.random() + '\\0'\nconst escOpen = '\\0OPEN' + Math.random() + '\\0'\nconst escClose = '\\0CLOSE' + Math.random() + '\\0'\nconst escComma = '\\0COMMA' + Math.random() + '\\0'\nconst escPeriod = '\\0PERIOD' + Math.random() + '\\0'\nconst escSlashPattern = new RegExp(escSlash, 'g')\nconst escOpenPattern = new RegExp(escOpen, 'g')\nconst escClosePattern = new RegExp(escClose, 'g')\nconst escCommaPattern = new RegExp(escComma, 'g')\nconst escPeriodPattern = new RegExp(escPeriod, 'g')\nconst slashPattern = /\\\\\\\\/g\nconst openPattern = /\\\\{/g\nconst closePattern = /\\\\}/g\nconst commaPattern = /\\\\,/g\nconst periodPattern = /\\\\\\./g\n\nexport const EXPANSION_MAX = 100_000\n\nfunction numeric(str: string) {\n return !isNaN(str as any) ? parseInt(str, 10) : str.charCodeAt(0)\n}\n\nfunction escapeBraces(str: string) {\n return str\n .replace(slashPattern, escSlash)\n .replace(openPattern, escOpen)\n .replace(closePattern, escClose)\n .replace(commaPattern, escComma)\n .replace(periodPattern, escPeriod)\n}\n\nfunction unescapeBraces(str: string) {\n return str\n .replace(escSlashPattern, '\\\\')\n .replace(escOpenPattern, '{')\n .replace(escClosePattern, '}')\n .replace(escCommaPattern, ',')\n .replace(escPeriodPattern, '.')\n}\n\n/**\n * Basically just str.split(\",\"), but handling cases\n * where we have nested braced sections, which should be\n * treated as individual members, like {a,{b,c},d}\n */\nfunction parseCommaParts(str: string) {\n if (!str) {\n return ['']\n }\n\n const parts: string[] = []\n const m = balanced('{', '}', str)\n\n if (!m) {\n return str.split(',')\n }\n\n const { pre, body, post } = m\n const p = pre.split(',')\n\n p[p.length - 1] += '{' + body + '}'\n const postParts = parseCommaParts(post)\n if (post.length) {\n ;(p[p.length - 1] as string) += postParts.shift()\n p.push.apply(p, postParts)\n }\n\n parts.push.apply(parts, p)\n\n return parts\n}\n\nexport type BraceExpansionOptions = {\n max?: number\n}\n\nexport function expand(str: string, options: BraceExpansionOptions = {}) {\n if (!str) {\n return []\n }\n\n const { max = EXPANSION_MAX } = options\n\n // I don't know why Bash 4.3 does this, but it does.\n // Anything starting with {} will have the first two bytes preserved\n // but *only* at the top level, so {},a}b will not expand to anything,\n // but a{},b}c will be expanded to [a}c,abc].\n // One could argue that this is a bug in Bash, but since the goal of\n // this module is to match Bash's rules, we escape a leading {}\n if (str.slice(0, 2) === '{}') {\n str = '\\\\{\\\\}' + str.slice(2)\n }\n\n return expand_(escapeBraces(str), max, true).map(unescapeBraces)\n}\n\nfunction embrace(str: string) {\n return '{' + str + '}'\n}\n\nfunction isPadded(el: string) {\n return /^-?0\\d/.test(el)\n}\n\nfunction lte(i: number, y: number) {\n return i <= y\n}\n\nfunction gte(i: number, y: number) {\n return i >= y\n}\n\nfunction expand_(str: string, max: number, isTop: boolean): string[] {\n /** @type {string[]} */\n const expansions: string[] = []\n\n const m = balanced('{', '}', str)\n if (!m) return [str]\n\n // no need to expand pre, since it is guaranteed to be free of brace-sets\n const pre = m.pre\n const post: string[] = m.post.length ? expand_(m.post, max, false) : ['']\n\n if (/\\$$/.test(m.pre)) {\n for (let k = 0; k < post.length && k < max; k++) {\n const expansion = pre + '{' + m.body + '}' + post[k]\n expansions.push(expansion)\n }\n } else {\n const isNumericSequence = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(m.body)\n const isAlphaSequence = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(\n m.body,\n )\n const isSequence = isNumericSequence || isAlphaSequence\n const isOptions = m.body.indexOf(',') >= 0\n if (!isSequence && !isOptions) {\n // {a},b}\n if (m.post.match(/,(?!,).*\\}/)) {\n str = m.pre + '{' + m.body + escClose + m.post\n return expand_(str, max, true)\n }\n return [str]\n }\n\n let n: string[]\n if (isSequence) {\n n = m.body.split(/\\.\\./)\n } else {\n n = parseCommaParts(m.body)\n if (n.length === 1 && n[0] !== undefined) {\n // x{{a,b}}y ==> x{a}y x{b}y\n n = expand_(n[0], max, false).map(embrace)\n //XXX is this necessary? Can't seem to hit it in tests.\n /* c8 ignore start */\n if (n.length === 1) {\n return post.map(p => m.pre + n[0] + p)\n }\n /* c8 ignore stop */\n }\n }\n\n // at this point, n is the parts, and we know it's not a comma set\n // with a single entry.\n let N: string[]\n\n if (isSequence && n[0] !== undefined && n[1] !== undefined) {\n const x = numeric(n[0])\n const y = numeric(n[1])\n const width = Math.max(n[0].length, n[1].length)\n let incr =\n n.length === 3 && n[2] !== undefined ?\n Math.max(Math.abs(numeric(n[2])), 1)\n : 1\n let test = lte\n const reverse = y < x\n if (reverse) {\n incr *= -1\n test = gte\n }\n const pad = n.some(isPadded)\n\n N = []\n\n for (let i = x; test(i, y) && N.length < max; i += incr) {\n let c\n if (isAlphaSequence) {\n c = String.fromCharCode(i)\n if (c === '\\\\') {\n c = ''\n }\n } else {\n c = String(i)\n if (pad) {\n const need = width - c.length\n if (need > 0) {\n const z = new Array(need + 1).join('0')\n if (i < 0) {\n c = '-' + z + c.slice(1)\n } else {\n c = z + c\n }\n }\n }\n }\n N.push(c)\n }\n } else {\n N = []\n\n for (let j = 0; j < n.length; j++) {\n N.push.apply(N, expand_(n[j] as string, max, false))\n }\n }\n\n for (let j = 0; j < N.length; j++) {\n for (let k = 0; k < post.length && expansions.length < max; k++) {\n const expansion = pre + N[j] + post[k]\n if (!isTop || isSequence || expansion) {\n expansions.push(expansion)\n }\n }\n }\n }\n\n return expansions\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "brace-expansion",
3
3
  "description": "Brace expansion as known from sh/bash",
4
- "version": "5.0.5",
4
+ "version": "5.0.6",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -1,18 +1,21 @@
1
1
  // Generated by scripts/build.js
2
2
 
3
- // prettier-ignore
4
- const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
3
+ export const ambiguousMinimalCodePoint = 161;
4
+ export const ambiguousMaximumCodePoint = 1114109;
5
+ export const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
5
6
 
6
- // prettier-ignore
7
- const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
7
+ export const fullwidthMinimalCodePoint = 12288;
8
+ export const fullwidthMaximumCodePoint = 65510;
9
+ export const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
8
10
 
9
- // prettier-ignore
10
- const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
11
+ export const halfwidthMinimalCodePoint = 8361;
12
+ export const halfwidthMaximumCodePoint = 65518;
13
+ export const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
11
14
 
12
- // prettier-ignore
13
- const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
15
+ export const narrowMinimalCodePoint = 32;
16
+ export const narrowMaximumCodePoint = 10630;
17
+ export const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
14
18
 
15
- // prettier-ignore
16
- const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
17
-
18
- export {ambiguousRanges, fullwidthRanges, halfwidthRanges, narrowRanges, wideRanges};
19
+ export const wideMinimalCodePoint = 4352;
20
+ export const wideMaximumCodePoint = 262141;
21
+ export const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
@@ -1,25 +1,28 @@
1
1
  import {
2
+ ambiguousMinimalCodePoint,
3
+ ambiguousMaximumCodePoint,
2
4
  ambiguousRanges,
5
+
6
+ fullwidthMinimalCodePoint,
7
+ fullwidthMaximumCodePoint,
3
8
  fullwidthRanges,
9
+
10
+ halfwidthMinimalCodePoint,
11
+ halfwidthMaximumCodePoint,
4
12
  halfwidthRanges,
13
+
14
+ narrowMinimalCodePoint,
15
+ narrowMaximumCodePoint,
5
16
  narrowRanges,
17
+
18
+ wideMinimalCodePoint,
19
+ wideMaximumCodePoint,
6
20
  wideRanges,
7
21
  } from './lookup-data.js';
8
22
  import {isInRange} from './utilities.js';
9
23
 
10
- const minimumAmbiguousCodePoint = ambiguousRanges[0];
11
- const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
12
- const minimumFullWidthCodePoint = fullwidthRanges[0];
13
- const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
14
- const minimumHalfWidthCodePoint = halfwidthRanges[0];
15
- const maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
16
- const minimumNarrowCodePoint = narrowRanges[0];
17
- const maximumNarrowCodePoint = narrowRanges.at(-1);
18
- const minimumWideCodePoint = wideRanges[0];
19
- const maximumWideCodePoint = wideRanges.at(-1);
20
-
21
24
  const commonCjkCodePoint = 0x4E_00;
22
- const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
25
+ const [wideFastPathStart, wideFastPathEnd] = /* #__PURE__ */ findWideFastPathRange(wideRanges);
23
26
 
24
27
  // Use a hot-path range so common `isWide` calls can skip binary search.
25
28
  // The range containing U+4E00 covers common CJK ideographs;
@@ -50,8 +53,8 @@ function findWideFastPathRange(ranges) {
50
53
 
51
54
  export const isAmbiguous = codePoint => {
52
55
  if (
53
- codePoint < minimumAmbiguousCodePoint
54
- || codePoint > maximumAmbiguousCodePoint
56
+ codePoint < ambiguousMinimalCodePoint
57
+ || codePoint > ambiguousMaximumCodePoint
55
58
  ) {
56
59
  return false;
57
60
  }
@@ -61,8 +64,8 @@ export const isAmbiguous = codePoint => {
61
64
 
62
65
  export const isFullWidth = codePoint => {
63
66
  if (
64
- codePoint < minimumFullWidthCodePoint
65
- || codePoint > maximumFullWidthCodePoint
67
+ codePoint < fullwidthMinimalCodePoint
68
+ || codePoint > fullwidthMaximumCodePoint
66
69
  ) {
67
70
  return false;
68
71
  }
@@ -72,8 +75,8 @@ export const isFullWidth = codePoint => {
72
75
 
73
76
  const isHalfWidth = codePoint => {
74
77
  if (
75
- codePoint < minimumHalfWidthCodePoint
76
- || codePoint > maximumHalfWidthCodePoint
78
+ codePoint < halfwidthMinimalCodePoint
79
+ || codePoint > halfwidthMaximumCodePoint
77
80
  ) {
78
81
  return false;
79
82
  }
@@ -83,8 +86,8 @@ const isHalfWidth = codePoint => {
83
86
 
84
87
  const isNarrow = codePoint => {
85
88
  if (
86
- codePoint < minimumNarrowCodePoint
87
- || codePoint > maximumNarrowCodePoint
89
+ codePoint < narrowMinimalCodePoint
90
+ || codePoint > narrowMaximumCodePoint
88
91
  ) {
89
92
  return false;
90
93
  }
@@ -101,8 +104,8 @@ export const isWide = codePoint => {
101
104
  }
102
105
 
103
106
  if (
104
- codePoint < minimumWideCodePoint
105
- || codePoint > maximumWideCodePoint
107
+ codePoint < wideMinimalCodePoint
108
+ || codePoint > wideMaximumCodePoint
106
109
  ) {
107
110
  return false;
108
111
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "get-east-asian-width",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Determine the East Asian Width of a Unicode character",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/get-east-asian-width",
@@ -24,7 +24,7 @@ jobs:
24
24
  contents: read
25
25
  steps:
26
26
  - name: Check out repo
27
- uses: actions/checkout@v4
27
+ uses: actions/checkout@v6
28
28
  with:
29
29
  persist-credentials: false
30
30
 
@@ -38,17 +38,17 @@ jobs:
38
38
  contents: read
39
39
  strategy:
40
40
  matrix:
41
- node-version: [20, 22, 24]
41
+ node-version: [20, 22, 24, 26]
42
42
  os: [macos-latest, ubuntu-latest, windows-latest]
43
43
 
44
44
  steps:
45
45
  - name: Check out repo
46
- uses: actions/checkout@v4
46
+ uses: actions/checkout@v6
47
47
  with:
48
48
  persist-credentials: false
49
49
 
50
50
  - name: Setup Node ${{ matrix.node-version }}
51
- uses: actions/setup-node@v4
51
+ uses: actions/setup-node@v6
52
52
  with:
53
53
  node-version: ${{ matrix.node-version }}
54
54
 
@@ -39,6 +39,8 @@ stream.flush(function () {
39
39
  })
40
40
  ```
41
41
 
42
+ `flush(cb)` waits for the worker destination flush when supported (`flush`, `flushSync`, or pending `drain`).
43
+
42
44
  In `worker.js`:
43
45
 
44
46
  ```js
@@ -87,7 +89,8 @@ This module works with `yarn` in PnP (plug'n play) mode too!
87
89
  ### Emit events
88
90
 
89
91
  You can emit events on the ThreadStream from your worker using [`worker.parentPort.postMessage()`](https://nodejs.org/api/worker_threads.html#workerparentport).
90
- The message (JSON object) must have the following data structure:
92
+ Messages that do not carry a thread-stream protocol `code` are ignored.
93
+ For custom events, the message (JSON object) must have the following data structure:
91
94
 
92
95
  ```js
93
96
  parentPort.postMessage({
@@ -59,6 +59,13 @@ declare class ThreadStream extends EventEmitter {
59
59
  * Calling the {@link write()} method after calling {@link end()} will emit an error.
60
60
  */
61
61
  end(): void
62
+ /**
63
+ * Flush the stream asynchronously.
64
+ *
65
+ * The callback is invoked once data has been consumed by the worker and the
66
+ * worker destination has acknowledged the flush.
67
+ */
68
+ flush(cb?: (err?: Error) => void): void
62
69
  /**
63
70
  * Flush the stream synchronously.
64
71
  * This method should be called in the shutdown phase to make sure that all data has been flushed.
@@ -18,6 +18,8 @@ const kImpl = Symbol('kImpl')
18
18
  // V8 limit for string size
19
19
  const MAX_STRING = buffer.constants.MAX_STRING_LENGTH
20
20
 
21
+ function noop () {}
22
+
21
23
  class FakeWeakRef {
22
24
  constructor (value) {
23
25
  this._value = value
@@ -54,6 +56,7 @@ function createWorker (stream, opts) {
54
56
 
55
57
  const worker = new Worker(toExecute, {
56
58
  ...opts.workerOpts,
59
+ name: opts.workerOpts?.name || 'thread-stream',
57
60
  trackUnmanagedFds: false,
58
61
  workerData: {
59
62
  filename: filename.indexOf('file://') === 0
@@ -114,8 +117,8 @@ function nextFlush (stream) {
114
117
  write(stream, toWrite, nextFlush.bind(null, stream))
115
118
  } else {
116
119
  // multi-byte utf-8
117
- stream.flush(() => {
118
- // err is already handled in flush()
120
+ waitForRead(stream, () => {
121
+ // err is already handled in waitForRead()
119
122
  if (stream.destroyed) {
120
123
  return
121
124
  }
@@ -141,7 +144,7 @@ function nextFlush (stream) {
141
144
  // we had a flushSync in the meanwhile
142
145
  return
143
146
  }
144
- stream.flush(() => {
147
+ waitForRead(stream, () => {
145
148
  Atomics.store(stream[kImpl].state, READ_INDEX, 0)
146
149
  Atomics.store(stream[kImpl].state, WRITE_INDEX, 0)
147
150
  Atomics.notify(stream[kImpl].state, READ_INDEX)
@@ -162,13 +165,19 @@ function onWorkerMessage (msg) {
162
165
  return
163
166
  }
164
167
 
168
+ // Node.js watch mode may send internal worker messages that do not
169
+ // participate in thread-stream's worker protocol.
170
+ if (msg?.code == null) {
171
+ return
172
+ }
173
+
165
174
  switch (msg.code) {
166
175
  case 'READY':
167
176
  // Replace the FakeWeakRef with a
168
177
  // proper one.
169
178
  this.stream = new WeakRef(stream)
170
179
 
171
- stream.flush(() => {
180
+ waitForRead(stream, () => {
172
181
  stream[kImpl].ready = true
173
182
  stream.emit('ready')
174
183
  })
@@ -183,6 +192,19 @@ function onWorkerMessage (msg) {
183
192
  stream.emit(msg.name, msg.args)
184
193
  }
185
194
  break
195
+ case 'FLUSHED': {
196
+ if (msg.context !== 'thread-stream') {
197
+ destroy(stream, new Error('this should not happen: ' + msg.code))
198
+ break
199
+ }
200
+
201
+ const cb = stream[kImpl].flushCallbacks.get(msg.id)
202
+ if (cb) {
203
+ stream[kImpl].flushCallbacks.delete(msg.id)
204
+ process.nextTick(cb)
205
+ }
206
+ break
207
+ }
186
208
  case 'WARNING':
187
209
  process.emitWarning(msg.err)
188
210
  break
@@ -227,6 +249,8 @@ class ThreadStream extends EventEmitter {
227
249
  this[kImpl].errored = null
228
250
  this[kImpl].closed = false
229
251
  this[kImpl].buf = ''
252
+ this[kImpl].flushCallbacks = new Map()
253
+ this[kImpl].nextFlushId = 0
230
254
 
231
255
  // TODO (fix): Make private?
232
256
  this.worker = createWorker(this, opts) // TODO (fix): make private
@@ -287,28 +311,15 @@ class ThreadStream extends EventEmitter {
287
311
  }
288
312
 
289
313
  flush (cb) {
290
- if (this[kImpl].destroyed) {
291
- if (typeof cb === 'function') {
292
- process.nextTick(cb, new Error('the worker has exited'))
293
- }
294
- return
295
- }
314
+ cb = typeof cb === 'function' ? cb : noop
296
315
 
297
- // TODO write all .buf
298
- const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX)
299
- // process._rawDebug(`(flush) readIndex (${Atomics.load(this.state, READ_INDEX)}) writeIndex (${Atomics.load(this.state, WRITE_INDEX)})`)
300
- wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
316
+ flushBuffer(this, (err) => {
301
317
  if (err) {
302
- destroy(this, err)
303
318
  process.nextTick(cb, err)
304
319
  return
305
320
  }
306
- if (res === 'not-equal') {
307
- // TODO handle deadlock
308
- this.flush(cb)
309
- return
310
- }
311
- process.nextTick(cb)
321
+
322
+ requestWorkerFlush(this, cb)
312
323
  })
313
324
  }
314
325
 
@@ -366,6 +377,93 @@ class ThreadStream extends EventEmitter {
366
377
  }
367
378
  }
368
379
 
380
+ function flushBuffer (stream, cb) {
381
+ if (stream[kImpl].destroyed) {
382
+ process.nextTick(cb, new Error('the worker has exited'))
383
+ return
384
+ }
385
+
386
+ if (!stream[kImpl].sync && (stream[kImpl].flushing || stream[kImpl].buf.length > 0)) {
387
+ setImmediate(flushBuffer, stream, cb)
388
+ return
389
+ }
390
+
391
+ waitForRead(stream, cb)
392
+ }
393
+
394
+ function waitForRead (stream, cb) {
395
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX)
396
+ wait(stream[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
397
+ if (err) {
398
+ destroy(stream, err)
399
+ cb(err)
400
+ return
401
+ }
402
+
403
+ if (res !== 'ok') {
404
+ waitForRead(stream, cb)
405
+ return
406
+ }
407
+
408
+ cb()
409
+ })
410
+ }
411
+
412
+ function requestWorkerFlush (stream, cb) {
413
+ if (stream[kImpl].destroyed) {
414
+ process.nextTick(cb, new Error('the worker has exited'))
415
+ return
416
+ }
417
+
418
+ if (!stream[kImpl].ready) {
419
+ const onReady = () => {
420
+ cleanup()
421
+ requestWorkerFlush(stream, cb)
422
+ }
423
+ const onClose = () => {
424
+ cleanup()
425
+ process.nextTick(cb, new Error('the worker has exited'))
426
+ }
427
+ const cleanup = () => {
428
+ stream.off('ready', onReady)
429
+ stream.off('close', onClose)
430
+ }
431
+
432
+ stream.once('ready', onReady)
433
+ stream.once('close', onClose)
434
+ return
435
+ }
436
+
437
+ const id = ++stream[kImpl].nextFlushId
438
+ stream[kImpl].flushCallbacks.set(id, cb)
439
+
440
+ try {
441
+ stream.worker.postMessage({
442
+ code: 'FLUSH',
443
+ context: 'thread-stream',
444
+ id
445
+ })
446
+ } catch (err) {
447
+ stream[kImpl].flushCallbacks.delete(id)
448
+ destroy(stream, err)
449
+ process.nextTick(cb, err)
450
+ }
451
+ }
452
+
453
+ function failPendingFlushCallbacks (stream, err) {
454
+ const callbacks = stream[kImpl].flushCallbacks
455
+ if (callbacks.size === 0) {
456
+ return
457
+ }
458
+
459
+ const flushErr = err || new Error('the worker has exited')
460
+
461
+ for (const cb of callbacks.values()) {
462
+ process.nextTick(cb, flushErr)
463
+ }
464
+ callbacks.clear()
465
+ }
466
+
369
467
  function error (stream, err) {
370
468
  setImmediate(() => {
371
469
  stream.emit('error', err)
@@ -377,6 +475,7 @@ function destroy (stream, err) {
377
475
  return
378
476
  }
379
477
  stream[kImpl].destroyed = true
478
+ failPendingFlushCallbacks(stream, err)
380
479
 
381
480
  if (err) {
382
481
  stream[kImpl].errored = err
@@ -12,6 +12,8 @@ const {
12
12
  } = workerData
13
13
 
14
14
  let destination
15
+ const flushQueue = []
16
+ let flushing = false
15
17
 
16
18
  const state = new Int32Array(stateBuf)
17
19
  const data = Buffer.from(dataBuf)
@@ -19,6 +21,101 @@ const data = Buffer.from(dataBuf)
19
21
  // Keep the event loop alive - Atomics.waitAsync promises don't prevent worker exit
20
22
  const keepAlive = setInterval(() => {}, 60 * 60 * 1000)
21
23
 
24
+ function onParentPortMessage (msg) {
25
+ if (!msg || msg.code !== 'FLUSH' || msg.context !== 'thread-stream') {
26
+ return
27
+ }
28
+
29
+ flushQueue.push(msg.id)
30
+ processFlushQueue()
31
+ }
32
+
33
+ function processFlushQueue () {
34
+ if (flushing || !destination) {
35
+ return
36
+ }
37
+
38
+ const id = flushQueue.shift()
39
+ if (id === undefined) {
40
+ return
41
+ }
42
+
43
+ flushing = true
44
+ flushDestination((err) => {
45
+ flushing = false
46
+
47
+ if (err) {
48
+ parentPort.postMessage({
49
+ code: 'ERROR',
50
+ err
51
+ })
52
+ return
53
+ }
54
+
55
+ parentPort.postMessage({
56
+ code: 'FLUSHED',
57
+ context: 'thread-stream',
58
+ id
59
+ })
60
+
61
+ processFlushQueue()
62
+ })
63
+ }
64
+
65
+ function flushDestination (cb) {
66
+ if (typeof destination?.flush === 'function') {
67
+ if (destination.flush.length === 0) {
68
+ try {
69
+ const result = destination.flush()
70
+ if (result && typeof result.then === 'function') {
71
+ result.then(() => cb(), cb)
72
+ } else {
73
+ cb()
74
+ }
75
+ } catch (err) {
76
+ cb(err)
77
+ }
78
+ return
79
+ }
80
+
81
+ let done = false
82
+ const onDone = (err) => {
83
+ if (done) {
84
+ return
85
+ }
86
+ done = true
87
+ cb(err)
88
+ }
89
+
90
+ try {
91
+ const result = destination.flush(onDone)
92
+ if (result && typeof result.then === 'function') {
93
+ result.then(() => onDone(), onDone)
94
+ }
95
+ } catch (err) {
96
+ onDone(err)
97
+ }
98
+ return
99
+ }
100
+
101
+ if (typeof destination?.flushSync === 'function') {
102
+ try {
103
+ destination.flushSync()
104
+ cb()
105
+ } catch (err) {
106
+ cb(err)
107
+ }
108
+ return
109
+ }
110
+
111
+ if (destination?.writableNeedDrain && !destination?.writableEnded) {
112
+ destination.once('drain', cb)
113
+ return
114
+ }
115
+
116
+ cb()
117
+ }
118
+
22
119
  async function start () {
23
120
  let worker
24
121
  try {
@@ -93,12 +190,16 @@ async function start () {
93
190
  process.exit(0)
94
191
  })
95
192
  })
193
+
194
+ processFlushQueue()
96
195
  }
97
196
 
98
197
  // No .catch() handler,
99
198
  // in case there is an error it goes
100
199
  // to unhandledRejection
101
200
  start().then(function () {
201
+ parentPort.on('message', onParentPortMessage)
202
+
102
203
  parentPort.postMessage({
103
204
  code: 'READY'
104
205
  })
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Paolo Insogna and the real-require contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.