<script lang="ts" setup>
import type { Ref } from 'vue';
import { useAppTheme } from '../theme/themes';
import { useTheme } from './c-input-text.theme';
import { generateRandomId } from '@/utils/random';
import { type UseValidationRule, useValidation } from '@/composable/validation';

const props = withDefaults(
  defineProps<{
    value?: string
    id?: string
    placeholder?: string
    label?: string
    readonly?: boolean
    disabled?: boolean
    validationRules?: UseValidationRule<string>[]
    validationWatch?: Ref<unknown>[]
    validation?: ReturnType<typeof useValidation>
    labelPosition?: 'top' | 'left'
    labelWidth?: string
    labelAlign?: 'left' | 'right'
    clearable?: boolean
    testId?: string
    autocapitalize?: 'none' | 'sentences' | 'words' | 'characters' | 'on' | 'off' | string
    autocomplete?: 'on' | 'off' | string
    autocorrect?: 'on' | 'off' | string
    spellcheck?: 'true' | 'false' | boolean
    rawText?: boolean
    type?: 'text' | 'password'
    multiline?: boolean
    rows?: number | string
    autosize?: boolean
  }>(),
  {
    value: '',
    id: generateRandomId,
    placeholder: 'Input text',
    label: undefined,
    readonly: false,
    disabled: false,
    validationRules: () => [],
    validationWatch: undefined,
    validation: undefined,
    labelPosition: 'top',
    labelWidth: 'auto',
    labelAlign: 'left',
    clearable: false,
    testId: undefined,
    autocapitalize: undefined,
    autocomplete: undefined,
    autocorrect: undefined,
    spellcheck: undefined,
    rawText: false,
    type: 'text',
    multiline: false,
    rows: 3,
    autosize: false,
  },
);
const emit = defineEmits(['update:value']);
const value = useVModel(props, 'value', emit);
const showPassword = ref(false);

const { id, placeholder, label, validationRules, labelPosition, labelWidth, labelAlign, autosize } = toRefs(props);

const validation
  = props.validation
  ?? useValidation({
    rules: validationRules,
    source: value,
    watch: props.validationWatch,
  });

const theme = useTheme();
const appTheme = useAppTheme();

const textareaRef = ref<HTMLTextAreaElement>();
const inputWrapperRef = ref<HTMLElement>();

defineExpose({
  inputWrapperRef,
});

watch(
  value,
  () => {
    if (props.multiline && autosize.value) {
      resizeTextarea();
    }
  },
  { immediate: true },
);

function resizeTextarea() {
  if (!textareaRef.value || !inputWrapperRef.value) {
    return;
  }

  const { scrollHeight } = textareaRef.value;

  inputWrapperRef.value.style.height = `${scrollHeight + 2}px`;
}

const htmlInputType = computed(() => {
  if (props.type === 'password' && !showPassword.value) {
    return 'password';
  }

  return 'text';
});
</script>

<template>
  <div
    class="c-input-text"
    :class="{ disabled, 'error': !validation.isValid, 'label-left': labelPosition === 'left', multiline }"
  >
    <label v-if="label" :for="id" class="label"> {{ label }} </label>

    <div class="feedback-wrapper">
      <div ref="inputWrapperRef" class="input-wrapper">
        <slot name="prefix" />

        <textarea
          v-if="multiline"
          :id="id"
          ref="textareaRef"
          v-model="value"
          class="input"
          :placeholder="placeholder"
          :readonly="readonly"
          :disabled="disabled"
          :data-test-id="testId"
          :autocapitalize="autocapitalize ?? (rawText ? 'off' : undefined)"
          :autocomplete="autocomplete ?? (rawText ? 'off' : undefined)"
          :autocorrect="autocorrect ?? (rawText ? 'off' : undefined)"
          :spellcheck="spellcheck ?? (rawText ? false : undefined)"
          :rows="rows"
        />

        <input
          v-else
          :id="id"
          v-model="value"
          :type="htmlInputType"
          class="input"
          size="1"
          :placeholder="placeholder"
          :readonly="readonly"
          :disabled="disabled"
          :data-test-id="testId"
          :autocapitalize="autocapitalize ?? (rawText ? 'off' : undefined)"
          :autocomplete="autocomplete ?? (rawText ? 'off' : undefined)"
          :autocorrect="autocorrect ?? (rawText ? 'off' : undefined)"
          :spellcheck="spellcheck ?? (rawText ? false : undefined)"
        >

        <c-button v-if="clearable && value" variant="text" circle size="small" @click="value = ''">
          <icon-mdi-close />
        </c-button>

        <c-button v-if="type === 'password'" variant="text" circle size="small" @click="showPassword = !showPassword">
          <icon-mdi-eye v-if="!showPassword" />
          <icon-mdi-eye-off v-if="showPassword" />
        </c-button>
        <slot name="suffix" />
      </div>
      <span v-if="!validation.isValid" class="feedback"> {{ validation.message }} </span>
    </div>
  </div>
</template>

<style lang="less" scoped>
.c-input-text {
  display: inline-flex;
  flex-direction: column;
  width: 100%;

  &.label-left {
    flex-direction: row;
    align-items: baseline;
  }

  &.error {
    & > .input {
      border-color: v-bind('appTheme.error.color');
      &:hover,
      &:focus {
        border-color: v-bind('appTheme.error.color');
      }

      &:focus {
        background-color: v-bind('appTheme.error.color + 22');
      }
    }

    & .feedback {
      color: v-bind('appTheme.error.color');
    }
  }

  & > .label {
    flex-shrink: 0;
    margin-bottom: 5px;
    flex: 0 0 v-bind('labelWidth');
    text-align: v-bind('labelAlign');
    padding-right: 12px;
  }

  .feedback-wrapper {
    flex: 1 1 0;
    min-width: 0;
  }
  .input-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: v-bind('theme.backgroundColor');
    color: transparent;
    border: 1px solid v-bind('theme.borderColor');
    border-radius: 4px;
    padding: 0 4px 0 12px;
    transition: border-color 0.2s ease-in-out;

    .multiline& {
      resize: vertical;
      overflow: hidden;

      & > textarea {
        height: 100%;
        resize: none;
        word-break: break-word;
        white-space: pre-wrap;
        overflow-wrap: break-word;
        border: none;
        outline: none;
        font-family: inherit;
        font-size: inherit;
        color: v-bind('appTheme.text.baseColor');

        &::placeholder {
          color: v-bind('appTheme.text.mutedColor');
        }
      }
    }

    & > .input {
      flex: 1 1 0;
      min-width: 0;

      padding: 8px 0;
      outline: none;
      background-color: transparent;
      background-image: none;
      -webkit-box-shadow: none;
      -moz-box-shadow: none;
      box-shadow: none;
      background-color: transparent;
      border: none;
      color: v-bind('appTheme.text.baseColor');

      &::placeholder {
        color: v-bind('appTheme.text.mutedColor');
      }
    }

    &:hover {
      border-color: v-bind('appTheme.primary.color');
    }

    &:focus-within {
      border-color: v-bind('appTheme.primary.color');

      background-color: v-bind('theme.focus.backgroundColor');
    }
  }

  &.error .input-wrapper {
    border-color: v-bind('appTheme.error.color');

    &:hover,
    &:focus-within {
      border-color: v-bind('appTheme.error.color');
    }

    &:focus-within {
      background-color: v-bind('appTheme.error.color + 22');
    }
  }

  &.disabled .input-wrapper {
    opacity: 0.5;

    &:hover,
    &:focus-within {
      border-color: v-bind('theme.borderColor');
    }

    & > .input {
      cursor: not-allowed;
    }
  }
}
</style>
/fix-blob-slice-test'>jarred/fix-blob-slice-test</option>
<option value='jarred/fix-bunbun-on-wsl'>jarred/fix-bunbun-on-wsl</option>
<option value='jarred/fix-crash'>jarred/fix-crash</option>
<option value='jarred/fix-http-compression'>jarred/fix-http-compression</option>
<option value='jarred/fix-issue-with-tsconfig-run'>jarred/fix-issue-with-tsconfig-run</option>
<option value='jarred/fix-proxy-regression'>jarred/fix-proxy-regression</option>
<option value='jarred/fixes-3129'>jarred/fixes-3129</option>
<option value='jarred/gen'>jarred/gen</option>
<option value='jarred/htmlrewriter'>jarred/htmlrewriter</option>
<option value='jarred/improve-testing'>jarred/improve-testing</option>
<option value='jarred/inquirer'>jarred/inquirer</option>
<option value='jarred/isolation'>jarred/isolation</option>
<option value='jarred/jsc'>jarred/jsc</option>
<option value='jarred/land'>jarred/land</option>
<option value='jarred/landing'>jarred/landing</option>
<option value='jarred/linux'>jarred/linux</option>
<option value='jarred/live-bindings'>jarred/live-bindings</option>
<option value='jarred/make-strings-better'>jarred/make-strings-better</option>
<option value='jarred/mdx-thrwawy'>jarred/mdx-thrwawy</option>
<option value='jarred/move'>jarred/move</option>
<option value='jarred/napi'>jarred/napi</option>
<option value='jarred/new-bund'>jarred/new-bund</option>
<option value='jarred/new-bund-ressurected-branch'>jarred/new-bund-ressurected-branch</option>
<option value='jarred/new-http'>jarred/new-http</option>
<option value='jarred/no-more-npm'>jarred/no-more-npm</option>
<option value='jarred/package-mapper'>jarred/package-mapper</option>
<option value='jarred/pg'>jarred/pg</option>
<option value='jarred/port'>jarred/port</option>
<option value='jarred/possibly-2732'>jarred/possibly-2732</option>
<option value='jarred/postgresql'>jarred/postgresql</option>
<option value='jarred/precompile-linux-dependencies'>jarred/precompile-linux-dependencies</option>
<option value='jarred/prepare-for-libuv'>jarred/prepare-for-libuv</option>
<option value='jarred/profiled-call'>jarred/profiled-call</option>
<option value='jarred/read-tsconfig-jsx'>jarred/read-tsconfig-jsx</option>
<option value='jarred/redo-evaluation-order'>jarred/redo-evaluation-order</option>
<option value='jarred/redo-zigstring-for-utf16'>jarred/redo-zigstring-for-utf16</option>
<option value='jarred/relay'>jarred/relay</option>
<option value='jarred/rename'>jarred/rename</option>
<option value='jarred/repl'>jarred/repl</option>
<option value='jarred/request-finalizer'>jarred/request-finalizer</option>
<option value='jarred/rewrite-router'>jarred/rewrite-router</option>
<option value='jarred/run'>jarred/run</option>
<option value='jarred/simdjson'>jarred/simdjson</option>
<option value='jarred/simplify'>jarred/simplify</option>
<option value='jarred/some-fixes-for-eventsource'>jarred/some-fixes-for-eventsource</option>
<option value='jarred/standalone-repro1'>jarred/standalone-repro1</option>
<option value='jarred/start'>jarred/start</option>
<option value='jarred/strong'>jarred/strong</option>
<option value='jarred/subprocess'>jarred/subprocess</option>
<option value='jarred/support-tee'>jarred/support-tee</option>
<option value='jarred/tcc'>jarred/tcc</option>
<option value='jarred/throw-if'>jarred/throw-if</option>
<option value='jarred/update-install-stuff'>jarred/update-install-stuff</option>
<option value='jarred/update-zig1'>jarred/update-zig1</option>
<option value='jarred/upgrade-zig-2'>jarred/upgrade-zig-2</option>
<option value='jarred/uws'>jarred/uws</option>
<option value='jarred/webkit-upgrade-may-17'>jarred/webkit-upgrade-may-17</option>
<option value='jarred/wip-more-reliable'>jarred/wip-more-reliable</option>
<option value='jarred/workers'>jarred/workers</option>
<option value='jarred/zlib'>jarred/zlib</option>
<option value='jarred/zls'>jarred/zls</option>
<option value='lithdew/picohttp-mimalloc'>lithdew/picohttp-mimalloc</option>
<option value='main'>main</option>
<option value='move-templates'>move-templates</option>
<option value='nestjs-guide'>nestjs-guide</option>
<option value='next-cleanup'>next-cleanup</option>
<option value='origin/main'>origin/main</option>
<option value='plugin/plugindata'>plugin/plugindata</option>
<option value='plugin/resolvedir'>plugin/resolvedir</option>
<option value='postinstall_3'>postinstall_3</option>
<option value='repl'>repl</option>
<option value='request-body-stream'>request-body-stream</option>
<option value='reserve-commands'>reserve-commands</option>
<option value='revert-5167-dylan/decode-regex-if-needed'>revert-5167-dylan/decode-regex-if-needed</option>
<option value='rfc/bun-bundler-api'>rfc/bun-bundler-api</option>
<option value='rfc/bunfig-overhaul'>rfc/bunfig-overhaul</option>
<option value='save-in-update'>save-in-update</option>
<option value='sdl'>sdl</option>
<option value='test/action'>test/action</option>
<option value='types/mock'>types/mock</option>
<option value='types/readable-stream-default'>types/readable-stream-default</option>
<option value='types/tty'>types/tty</option>
<option value='u/vjpr/zig-0.10'>u/vjpr/zig-0.10</option>
<option value='xHyroM/types/expose-Bun-Env'>xHyroM/types/expose-Bun-Env</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Unnamed repository; edit this file 'description' to name the repository.</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/ansg191/bun/about/?h=ciro/spawn-abort-signal-rebased'>about</a><a href='/ansg191/bun/?h=ciro/spawn-abort-signal-rebased'>summary</a><a href='/ansg191/bun/refs/?h=ciro/spawn-abort-signal-rebased'>refs</a><a class='active' href='/ansg191/bun/log/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;showmsg=1&amp;follow=1'>log</a><a href='/ansg191/bun/tree/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased'>tree</a><a href='/ansg191/bun/commit/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;follow=1'>commit</a><a href='/ansg191/bun/diff/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;follow=1'>diff</a></td><td class='form'><form class='right' method='get' action='/ansg191/bun/log/misctools/publish-examples.js'>
<input type='hidden' name='h' value='ciro/spawn-abort-signal-rebased'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ansg191/bun/log/?h=ciro/spawn-abort-signal-rebased&amp;showmsg=1&amp;follow=1'>root</a>/<a href='/ansg191/bun/log/misctools?h=ciro/spawn-abort-signal-rebased&amp;showmsg=1&amp;follow=1'>misctools</a>/<a href='/ansg191/bun/log/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;showmsg=1&amp;follow=1'>publish-examples.js</a> (<a href='/ansg191/bun/log/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;showmsg=1'>unfollow</a>)</div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/ansg191/bun/log/misctools/publish-examples.js?h=ciro/spawn-abort-signal-rebased&amp;follow=1'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr class='logheader'><td><span title='2023-03-02 19:02:10 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/snippets/type-only-imports.ts?h=ciro/spawn-abort-signal-rebased&amp;id=9388b3f8257bc2e580deaece4cd2677928104fc6&amp;follow=1'>Add a zig fmt action (#2277)</a></td><td><img src='//www.gravatar.com/avatar/764ea52180f7f5236744034dd5e1a3c0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>117</td><td><span class='deletions'>-4295</span>/<span class='insertions'>+1764</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* Add a zig fmt action

* add failing file

* Setup prettier better

* Update prettier-fmt.yml

* Fail on error

* Update prettier-fmt.yml

* boop

* boop2

* tar.gz

* Update zig-fmt.yml

* Update zig-fmt.yml

* Update zig-fmt.yml

* Update zig-fmt.yml

* Update zig-fmt.yml

* boop

* Update prettier-fmt.yml

* tag

* newlines

* multiline

* fixup

* Update zig-fmt.yml

* update it

* fixup

* both

* w

* Update prettier-fmt.yml

* prettier all the things

* Update package.json

* zig fmt

* ❌ ✅

* bump

* .

* quotes

* fix prettier ignore

* once more

* Update prettier-fmt.yml

* Update fallback.ts

* consistentcy

---------

Co-authored-by: Jarred Sumner &lt;709451+Jarred-Sumner@users.noreply.github.com&gt;

</td></tr>
<tr class='logheader'><td><span title='2023-03-02 17:36:47 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/gc.ts?h=ciro/spawn-abort-signal-rebased&amp;id=b469e5035161286abeb1a7726518d1afcc163a51&amp;follow=1'>Add fs/promises tests and migrate fs.test.js to TypeScript (#2279)</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>7</td><td><span class='deletions'>-42</span>/<span class='insertions'>+103</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 17:33:25 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/os.test.js?h=ciro/spawn-abort-signal-rebased&amp;id=27c35791185bd85337e312e12c87d5c22d7f3a52&amp;follow=1'>fix(os.tmpdir()) strip trailing slash on *unix machines (#2276)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>2</td><td><span class='deletions'>-100</span>/<span class='insertions'>+83</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* fix(os.tmpdir()) strip trailing slash on *unix machines

* make use of strings.withoutTrailingSlash(dir);

</td></tr>
<tr class='logheader'><td><span title='2023-03-02 15:34:36 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/.vscode/settings.json?h=ciro/spawn-abort-signal-rebased&amp;id=3852a52601757d45a17a4a26fb3f6361e4b1bac4&amp;follow=1'>Add separate bun-types release CI (#2275)</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>3</td><td><span class='deletions'>-43</span>/<span class='insertions'>+99</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* Release on every commit

* Remove bun-types publish from bun-release-canary

* Undo formatting changes

</td></tr>
<tr class='logheader'><td><span title='2023-03-02 15:12:00 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/snippets/package.json?h=ciro/spawn-abort-signal-rebased&amp;id=1ba007831dd6d3fd5ee02fab33b09d552107884d&amp;follow=1'>Ensure prettier knows where to look</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>6</td><td><span class='deletions'>-5</span>/<span class='insertions'>+24</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 13:30:20 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/install/moo-0.1.0.tgz?h=ciro/spawn-abort-signal-rebased&amp;id=c0a49e405efbd5c773f2ca83041ff5df4b22d012&amp;follow=1'>add tests for scoped dependency aliasing (#2271)</a></td><td><img src='//www.gravatar.com/avatar/e38c5ad2cb13f012227c5b00f1763175?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Alex Lam S.L
</td><td>3</td><td><span class='deletions'>-15</span>/<span class='insertions'>+111</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 12:54:59 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/fetch.test.js?h=ciro/spawn-abort-signal-rebased&amp;id=78762e830557e42e5aa9ec2d3878de3c7b1567e7&amp;follow=1'>fix tmp dir in fetch.tests.js (#2270)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 12:24:43 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/packages/bun-types/tests/ffi.test-d.ts?h=ciro/spawn-abort-signal-rebased&amp;id=57fcf8f9bacce688bed4cfe5c38bc5dff5e71ae0&amp;follow=1'>Remake typings for FFI dlopen/linkSymbols + introduce Pointer type (#2227)</a></td><td><img src='//www.gravatar.com/avatar/52d0cd0aabfb9d917cfb6a9b60cb9fab?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> u9g
</td><td>4</td><td><span class='deletions'>-28</span>/<span class='insertions'>+222</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* Give dlopen &amp; linkSymbols typings for exported functions

* Fix lookup table

* Fully change over to Pointer + fix examples

* add back header for typings

* Fix tsc errors

* Run formatter on ffi.d.ts

* Revert args/return type change

* Add type tests for ffi

---------

Co-authored-by: Colin McDonnell &lt;colinmcd94@gmail.com&gt;

</td></tr>
<tr class='logheader'><td><span title='2023-03-02 11:49:32 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/webcore/response.zig?h=ciro/spawn-abort-signal-rebased&amp;id=c81043bf5eb1ad39c9e193c17febe9ba24c21271&amp;follow=1'>put AbortSignal in WebCore namespace (#2267)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>9</td><td><span class='deletions'>-69</span>/<span class='insertions'>+70</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 11:48:11 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/webcore/streams.zig?h=ciro/spawn-abort-signal-rebased&amp;id=156c1d4bec17338e791b99a792f2458643a1d84c&amp;follow=1'>only free sink after promises solves (#2268)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>2</td><td><span class='deletions'>-10</span>/<span class='insertions'>+10</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-02 09:00:20 -0800'>2023-03-02</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/sleepSync.test.ts?h=ciro/spawn-abort-signal-rebased&amp;id=20930849ce0bcfe685e8042a4a53d9c9dd67343b&amp;follow=1'>Fix `Bun.sleepSync` to actually use milliseconds (#2242)</a></td><td><img src='//www.gravatar.com/avatar/f0e663bea0dc46c4ee7299ad50898599?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Justin Whear
</td><td>3</td><td><span class='deletions'>-5</span>/<span class='insertions'>+57</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* Fix Bun.sleep/sleepSync to actually use milliseconds

`Bun.sleepSync` was accidentally treating its argument as seconds rather than milliseconds as the docs stated.  This is a breaking change in that the function now behaves as documented.  Fixed relevant tests.

* sleepSync: add more argument checking, tests

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 22:41:20 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/bindings/bindings.zig?h=ciro/spawn-abort-signal-rebased&amp;id=efdf64746076c4ed09da87e41d7de81c2b659dab&amp;follow=1'>fix(bindings): mark `JSCInitialize` (#2265)</a></td><td><img src='//www.gravatar.com/avatar/b71ccf38c38e65b7dcb0aea91898f819?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Derrick Farris
</td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 21:45:49 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/nav.ts?h=ciro/spawn-abort-signal-rebased&amp;id=167de9091a6308366b0c16d1095fe14ee3923fc9&amp;follow=1'>Add page descriptions (#2260)</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-46</span>/<span class='insertions'>+132</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* Add page descriptions

* Update bun install

* Description tweaks

* Tweaks

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 21:40:11 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/fetch.test.js?h=ciro/spawn-abort-signal-rebased&amp;id=1be834b073420f4a00a8bb9aaf0de575eb39525d&amp;follow=1'>fix bun server segfault with abortsignal (#2261)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>3</td><td><span class='deletions'>-133</span>/<span class='insertions'>+79</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* removed redundant tests, fixed server segfault

* fix onRejectStream, safer unassign signal

* fix abort Bun.serve signal.addEventListener on async

* move ctx.signal null check up

* keep original behavior of streams onAborted

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 21:28:21 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/node-http.test.ts?h=ciro/spawn-abort-signal-rebased&amp;id=b9137dbdc81591f8b30cf95a4d27514bfb1ae71c&amp;follow=1'>fix(node:http): match Node `http.request()` GET/HEAD w/ body (#2262)</a></td><td><img src='//www.gravatar.com/avatar/b71ccf38c38e65b7dcb0aea91898f819?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Derrick Farris
</td><td>2</td><td><span class='deletions'>-2</span>/<span class='insertions'>+31</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 19:31:16 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/node-http.test.ts?h=ciro/spawn-abort-signal-rebased&amp;id=706a3e8169ae27b1b5c3694d46b593f220c41b80&amp;follow=1'>Add a test for https request in node:http</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>2</td><td><span class='deletions'>-17</span>/<span class='insertions'>+28</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 18:11:38 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/node-http.test.ts?h=ciro/spawn-abort-signal-rebased&amp;id=7c81d97684e39e1fb37bef7f39ea13c936f6b99a&amp;follow=1'>fix(node:http/https): fix passing `URL` objs to `http.request`(#2253) (#2258)</a></td><td><img src='//www.gravatar.com/avatar/b71ccf38c38e65b7dcb0aea91898f819?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Derrick Farris
</td><td>2</td><td><span class='deletions'>-43</span>/<span class='insertions'>+63</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* fix(node:http/https): fix passing `URL` objs to `http.request`(#2253)

* fix(node:http): hoist debug env var

* fix(node:http): make body `undefined` when falsy

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 16:17:47 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=ciro/spawn-abort-signal-rebased&amp;id=6bc075e377a1f4dcb49ea27c9224117c6cbada70&amp;follow=1'>Revert "Update clap (#2238)"</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>16</td><td><span class='deletions'>-290</span>/<span class='insertions'>+1840</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
This reverts commit 7b9a17f9d7106ffd8e553a5192aba60d14ea5e9c.


</td></tr>
<tr class='logheader'><td><span title='2023-03-01 16:15:55 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=ciro/spawn-abort-signal-rebased&amp;id=ba0706939d1c3b26121d7e39edf0c1a7a3f3a4da&amp;follow=1'>Revert "Add `-D`, `--dev` flags for bun install (#2240)"</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-9</span>/<span class='insertions'>+9</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
This reverts commit ec20fae57f96a835562b154730957ecc4015ba31.


</td></tr>
<tr class='logheader'><td><span title='2023-03-01 16:07:27 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/.github/workflows/bun-linux-aarch64.yml?h=ciro/spawn-abort-signal-rebased&amp;id=6e512eda0d0d0362f5f5ba0afc66ac215d26d08f&amp;follow=1'>Use GitHub action ID instead of SHA for test workflow</a></td><td><img src='//www.gravatar.com/avatar/882f2dfc408f3f96e6e745e36d5d1d80?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ashcon Partovi
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 15:47:04 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/api/server.zig?h=ciro/spawn-abort-signal-rebased&amp;id=1227a7b995d02980634ded567a4a233c1ddd26a2&amp;follow=1'>avoids segfault after aborted onReject in Bun.serve streams (#2256)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>1</td><td><span class='deletions'>-7</span>/<span class='insertions'>+8</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* avoids segfault after aborted on reject

* silence err on handleRejectStream after aborted

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 14:31:56 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/packages/bun-test/src/runner.ts?h=ciro/spawn-abort-signal-rebased&amp;id=ef569610071e37e763579b2408e549e09cf1119a&amp;follow=1'>Run tests in CI for bun-linux-aarch64</a></td><td><img src='//www.gravatar.com/avatar/882f2dfc408f3f96e6e745e36d5d1d80?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ashcon Partovi
</td><td>2</td><td><span class='deletions'>-1</span>/<span class='insertions'>+30</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 14:12:59 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/api/bun/subprocess.zig?h=ciro/spawn-abort-signal-rebased&amp;id=ff51a253e2897fd7a622ffa0f31e17e1e408caec&amp;follow=1'>Revert spawnSync change</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
cc @FireTheFox


</td></tr>
<tr class='logheader'><td><span title='2023-03-01 14:12:59 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/bindings/bindings.zig?h=ciro/spawn-abort-signal-rebased&amp;id=ee6f54180a9b9f9f72ce6e9f754b3bfb83ef7af6&amp;follow=1'>Update bindings.zig</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+3</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-03-01 13:15:52 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/bun-server.test.ts?h=ciro/spawn-abort-signal-rebased&amp;id=cf8568ccff4ba5f6e54e8e3b552468069b68bc9e&amp;follow=1'>fix deinit behavior when connection is aborted using ResponseStream and ↵</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>3</td><td><span class='deletions'>-34</span>/<span class='insertions'>+174</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
abort event behavior (#2252)

* fix deinit behavior when connection is aborted using ResponseStream

* fix abort handling on stream, and get better tests

* avoid segfault by trying to deinit 2x when aborted

* make tests more reliable

* more reliable onResolveStream after aborted

* add test case for not firing the abort signal

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 13:07:21 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/bun.js/emptyFile?h=ciro/spawn-abort-signal-rebased&amp;id=56ca48ece88c0de854ec20c5e71a639fee6ccb0f&amp;follow=1'>fix Bun.file.arrayBuffer() segmentation fault on empty file #2248 (#2249)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>3</td><td><span class='deletions'>-7</span>/<span class='insertions'>+23</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* fix Bun.file.arrayBuffer() segmentation fault on empty file #2248

* cleanner this.iotask check

</td></tr>
<tr class='logheader'><td><span title='2023-03-01 12:27:14 -0800'>2023-03-01</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/api/sqlite.md?h=ciro/spawn-abort-signal-rebased&amp;id=530cf4caf8abe4960d833efc6cce71188dea40b2&amp;follow=1'>Fix async in sqlite</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 23:35:04 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/Makefile?h=ciro/spawn-abort-signal-rebased&amp;id=9a7333dd5e9d34d26aa94a771f7d3c142809f054&amp;follow=1'>Forces a specific libdir for c-ares (#2241)</a></td><td><img src='//www.gravatar.com/avatar/f0e663bea0dc46c4ee7299ad50898599?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Justin Whear
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+5</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
The c-ares build expects lib/libcares.a to exist after cmake, but on my system it was being generated in lib64.  This simply sets the cmake variable so that the target ends up where we expect.

</td></tr>
<tr class='logheader'><td><span title='2023-02-28 21:56:28 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/bindings/bindings.cpp?h=ciro/spawn-abort-signal-rebased&amp;id=88b5cda1097779d5a9346ea989a5a29fd5462d95&amp;follow=1'>Make Bun.gc(true) more aggressive</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+3</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 21:56:28 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/http.zig?h=ciro/spawn-abort-signal-rebased&amp;id=45704a55dcee86c2b0f623dce55215ad21737d68&amp;follow=1'>Expose JSC::Options via `BUN_JSC_` prefix</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>6</td><td><span class='deletions'>-8</span>/<span class='insertions'>+47</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
Example usage:

BUN_JSC_logGC=1 bun file.js


</td></tr>
<tr class='logheader'><td><span title='2023-02-28 21:56:28 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/sha.zig?h=ciro/spawn-abort-signal-rebased&amp;id=714b8d10e021a03ed75738459f02ab25239d7dcd&amp;follow=1'>fixup</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 19:47:46 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/tsconfig.json?h=ciro/spawn-abort-signal-rebased&amp;id=931f23d360f86ace209391db3278e4e636f2c83c&amp;follow=1'>Fix typecheck</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>2</td><td><span class='deletions'>-1</span>/<span class='insertions'>+4</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 17:55:18 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/ecosystem/nodejs.md?h=ciro/spawn-abort-signal-rebased&amp;id=1da8045ce45bb155ec05acc1789eff97b4227307&amp;follow=1'>Fix incorrect Bun version in docs (#2236)</a></td><td><img src='//www.gravatar.com/avatar/b71ccf38c38e65b7dcb0aea91898f819?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Derrick Farris
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 16:56:12 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/packages/bun-types/globals.d.ts?h=ciro/spawn-abort-signal-rebased&amp;id=e512be8c18e2933febec00f69bc91f4632c6d12d&amp;follow=1'>just some comments fix (#2237)</a></td><td><img src='//www.gravatar.com/avatar/209348ae1158d8f3be635b721db356e2?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Ciro Spaciari
</td><td>1</td><td><span class='deletions'>-4</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-02-28 16:39:06 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=ciro/spawn-abort-signal-rebased&amp;id=ec20fae57f96a835562b154730957ecc4015ba31&amp;follow=1'>Add `-D`, `--dev` flags for bun install (#2240)</a></td><td><img src='//www.gravatar.com/avatar/f0e663bea0dc46c4ee7299ad50898599?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Justin Whear
</td><td>1</td><td><span class='deletions'>-9</span>/<span class='insertions'>+9</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* remove vendored clap

* Update to latest zig-clap

Major changes:
* Instead of vendoring zig-clap and adding changes, this uses Hejsil/zig-clap directly as a submodule
* `cli.zig` and related files have been updated to use new API (no more `flag()` or `option()`)
* A workaround for the Run and Auto commands has been implemented that allows us to use the official upstream

Minor change:
* `-i` now has the long option `--install-fallback`; I didn't spend much time thinking about this name, so suggestions weclome.

* add --development and --optional to bun install

* Add support for `-D`, `--dev` in bun install, fix `--save`

</td></tr>
<tr class='logheader'><td><span title='2023-02-28 16:10:51 -0800'>2023-02-28</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/ecosystem/react.md?h=ciro/spawn-abort-signal-rebased&amp;id=fd19d01583aace00925dbe80f1cad4696efeb569&amp;follow=1'>Document punning</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+18</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
