yavascript 0.0.13 → 0.14.1

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.
@@ -757,6 +757,9 @@ _export(exports, {
757
757
  ChildProcessOptions: function () {
758
758
  return _ChildProcess.ChildProcessOptions;
759
759
  },
760
+ ChildProcessState: function () {
761
+ return _ChildProcess.ChildProcessState;
762
+ },
760
763
  exec: function () {
761
764
  return _exec.exec;
762
765
  }
@@ -1933,9 +1936,18 @@ const _types = _kame_require_("src/api/types/index.ts");
1933
1936
  const _assert = _kame_require_("src/api/assert/index.ts");
1934
1937
  const _path = _kame_require_("src/api/path/index.ts");
1935
1938
  class ChildProcess {
1936
- /** returns pid */start() {
1939
+ get state() {
1940
+ this._updateState();
1941
+ return this._state;
1942
+ }
1943
+ get pid() {
1944
+ this._updateState();
1945
+ return this._getPidRaw();
1946
+ }
1947
+ /** returns pid */
1948
+ start() {
1937
1949
  this._logging.trace.call(null, "ChildProcess.start:", this.args);
1938
- this.pid = _quickjsos.exec(this.args, {
1950
+ const pid = _quickjsos.exec(this.args, {
1939
1951
  block: false,
1940
1952
  cwd: this.cwd.toString(),
1941
1953
  env: this.env,
@@ -1943,33 +1955,123 @@ class ChildProcess {
1943
1955
  stdout: this.stdio.out.fileno(),
1944
1956
  stderr: this.stdio.err.fileno()
1945
1957
  });
1946
- return this.pid;
1958
+ this._state = {
1959
+ id: "STARTED",
1960
+ pid
1961
+ };
1962
+ return pid;
1947
1963
  }
1948
- waitUntilComplete() {
1949
- const pid = this.pid;
1950
- if (pid == null) {
1951
- throw new Error("Cannot wait for a child process that hasn't yet been started");
1964
+ _getPidRaw() {
1965
+ const state = this._state;
1966
+ switch (state.id) {
1967
+ case "UNSTARTED":
1968
+ return null;
1969
+ case "STARTED":
1970
+ case "STOPPED":
1971
+ case "CONTINUED":
1972
+ return state.pid;
1973
+ case "EXITED":
1974
+ case "SIGNALED":
1975
+ return state.oldPid;
1976
+ default:
1977
+ {
1978
+ const here = state;
1979
+ throw new Error(`Unhandled ChildProcessStateKind: ${state.id}`);
1980
+ }
1952
1981
  }
1953
- while (true) {
1954
- const [ret, status] = _quickjsos.waitpid(pid);
1955
- if (ret == pid) {
1956
- if (_quickjsos.WIFEXITED(status)) {
1957
- const ret = {
1958
- status: _quickjsos.WEXITSTATUS(status),
1959
- signal: undefined
1960
- };
1961
- this._logging.trace.call(null, "ChildProcess result:", this.args, "->", ret);
1962
- return ret;
1963
- } else if (_quickjsos.WIFSIGNALED(status)) {
1964
- const ret = {
1965
- status: undefined,
1966
- signal: _quickjsos.WTERMSIG(status)
1967
- };
1968
- this._logging.trace.call(null, "ChildProcess result:", this.args, "->");
1969
- return ret;
1982
+ }
1983
+ _updateState() {
1984
+ switch (this._state.id) {
1985
+ case "UNSTARTED":
1986
+ case "EXITED":
1987
+ case "SIGNALED":
1988
+ return;
1989
+ case "STARTED":
1990
+ case "STOPPED":
1991
+ case "CONTINUED":
1992
+ this._waitpid(false);
1993
+ break;
1994
+ default:
1995
+ {
1996
+ const here = this._state;
1997
+ throw new Error(`Unhandled ChildProcessStateKind: ${this._state.id}`);
1970
1998
  }
1999
+ }
2000
+ }
2001
+ _waitpid(block) {
2002
+ const pid = this._getPidRaw();
2003
+ if (!pid) {
2004
+ return;
2005
+ }
2006
+ const flags = block ? 0 : _quickjsos.WNOHANG;
2007
+ const [ret, status] = _quickjsos.waitpid(pid, flags);
2008
+ if (ret === pid) {
2009
+ if (_quickjsos.WIFEXITED(status)) {
2010
+ this._state = {
2011
+ id: "EXITED",
2012
+ oldPid: pid,
2013
+ status: _quickjsos.WEXITSTATUS(status)
2014
+ };
2015
+ this._logging.trace.call(null, "ChildProcess result:", this.args, "->", this._state);
2016
+ } else if (_quickjsos.WIFSIGNALED(status)) {
2017
+ this._state = {
2018
+ id: "SIGNALED",
2019
+ oldPid: pid,
2020
+ signal: _quickjsos.WTERMSIG(status)
2021
+ };
2022
+ this._logging.trace.call(null, "ChildProcess result:", this.args, "->", this._state);
2023
+ } else if (_quickjsos.WIFSTOPPED(status)) {
2024
+ this._state = {
2025
+ id: "STOPPED",
2026
+ pid
2027
+ };
2028
+ this._logging.trace.call(null, "ChildProcess stopped:", this.args);
2029
+ } else if (_quickjsos.WIFCONTINUED(status)) {
2030
+ this._state = {
2031
+ id: "CONTINUED",
2032
+ pid
2033
+ };
2034
+ this._logging.trace.call(null, "ChildProcess continued:", this.args);
1971
2035
  }
1972
2036
  }
2037
+ return false;
2038
+ }
2039
+ waitUntilComplete() {
2040
+ do {
2041
+ const rawState = this._state;
2042
+ idSwitch: switch (rawState.id) {
2043
+ case "UNSTARTED":
2044
+ {
2045
+ throw new Error("The ChildProcess hasn't yet started. Call ChildProcess's start() method before calling waitUntilComplete().");
2046
+ }
2047
+ case "EXITED":
2048
+ {
2049
+ return {
2050
+ status: rawState.status,
2051
+ signal: undefined
2052
+ };
2053
+ }
2054
+ case "SIGNALED":
2055
+ {
2056
+ return {
2057
+ status: undefined,
2058
+ signal: rawState.signal
2059
+ };
2060
+ }
2061
+ case "STARTED":
2062
+ case "CONTINUED":
2063
+ case "STOPPED":
2064
+ {
2065
+ this._waitpid(true);
2066
+ break idSwitch;
2067
+ }
2068
+ default:
2069
+ {
2070
+ const here = rawState;
2071
+ throw new Error(`Unhandled ChildProcessStateKind: ${rawState.id}`);
2072
+ }
2073
+ }
2074
+ } while (true);
1973
2075
  }
1974
2076
  constructor(args, options = {}) {
1975
2077
  _define_property._(this, "args", void 0);
@@ -1977,7 +2079,9 @@ class ChildProcess {
1977
2079
  _define_property._(this, "env", void 0);
1978
2080
  _define_property._(this, "stdio", void 0);
1979
2081
  _define_property._(this, "_logging", void 0);
1980
- _define_property._(this, "pid", null);
2082
+ _define_property._(this, "_state", {
2083
+ id: "UNSTARTED"
2084
+ });
1981
2085
  // type of `args` gets checked in `toArgv`
1982
2086
  this.args = (0, _toargv.toArgv)(args);
1983
2087
  const cwd = options.cwd;
@@ -2821,17 +2925,23 @@ class Path {
2821
2925
  return this.replaceLast([]);
2822
2926
  }
2823
2927
  startsWith(value) {
2824
- value = new Path(value);
2928
+ if (!(0, _is.is)(value, _types.types.Path)) {
2929
+ value = new Path(value);
2930
+ }
2825
2931
  return value.segments.every((segment, index) => this.segments[index] === segment);
2826
2932
  }
2827
2933
  endsWith(value) {
2828
- value = new Path(value);
2934
+ if (!(0, _is.is)(value, _types.types.Path)) {
2935
+ value = new Path(value);
2936
+ }
2829
2937
  const valueSegmentsReversed = [...value.segments].reverse();
2830
2938
  const ownSegmentsReversed = [...this.segments].reverse();
2831
2939
  return valueSegmentsReversed.every((segment, index) => ownSegmentsReversed[index] === segment);
2832
2940
  }
2833
2941
  indexOf(value, fromIndex = 0) {
2834
- value = new Path(value);
2942
+ if (!(0, _is.is)(value, _types.types.Path)) {
2943
+ value = new Path(value);
2944
+ }
2835
2945
  const ownSegmentsLength = this.segments.length;
2836
2946
  for (let i = fromIndex; i < ownSegmentsLength; i++) {
2837
2947
  if (value.segments.every((valueSegment, valueIndex) => {
@@ -2846,8 +2956,12 @@ class Path {
2846
2956
  return this.indexOf(value, fromIndex) !== -1;
2847
2957
  }
2848
2958
  replace(value, replacement) {
2849
- value = new Path(value);
2850
- replacement = new Path(replacement);
2959
+ if (!(0, _is.is)(value, _types.types.Path)) {
2960
+ value = new Path(value);
2961
+ }
2962
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2963
+ replacement = new Path(replacement);
2964
+ }
2851
2965
  const matchIndex = this.indexOf(value);
2852
2966
  if (matchIndex === -1) {
2853
2967
  return this.clone();
@@ -2857,7 +2971,9 @@ class Path {
2857
2971
  }
2858
2972
  }
2859
2973
  replaceAll(value, replacement) {
2860
- replacement = new Path(replacement);
2974
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2975
+ replacement = new Path(replacement);
2976
+ }
2861
2977
  let searchIndex = 0;
2862
2978
  let currentPath = this;
2863
2979
  const ownLength = this.segments.length;
@@ -2873,12 +2989,28 @@ class Path {
2873
2989
  return currentPath;
2874
2990
  }
2875
2991
  replaceLast(replacement) {
2876
- replacement = new Path(replacement);
2992
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2993
+ replacement = new Path(replacement);
2994
+ }
2877
2995
  const segments = [...this.segments];
2878
2996
  segments.pop();
2879
2997
  segments.push(...replacement.segments);
2880
2998
  return Path.fromRaw(segments, this.separator);
2881
2999
  }
3000
+ equals(other) {
3001
+ if (!(0, _is.is)(other, _types.types.Path)) {
3002
+ other = new Path(other);
3003
+ }
3004
+ return other.separator === this.separator && this.hasEqualSegments(other);
3005
+ }
3006
+ hasEqualSegments(other) {
3007
+ if (!(0, _is.is)(other, _types.types.Path)) {
3008
+ other = new Path(other);
3009
+ }
3010
+ return this.segments.length === other.segments.length && this.segments.every((segment, index) => {
3011
+ return segment === other.segments[index];
3012
+ });
3013
+ }
2882
3014
  [_inspect_custom](inputs) {
2883
3015
  if (typeof this.segments === "undefined" || typeof this.separator === "undefined") {
2884
3016
  // inspecting Path.prototype, or a Path someone messed up
@@ -4610,7 +4742,7 @@ function readModule(modulePath) {
4610
4742
  /* --- src/hardcoded/compile-time.js?evalAtBuildTime --- */
4611
4743
  "src/hardcoded/compile-time.js?evalAtBuildTime": (function (exports, _kame_require_, module, __filename, __dirname, _kame_dynamic_import_) {
4612
4744
  module.exports = {
4613
- "version": "v0.0.13",
4745
+ "version": "v0.14.1",
4614
4746
  "arch": "arm64"
4615
4747
  };
4616
4748
  }),
@@ -10108,13 +10240,15 @@ function startRepl(handle_cmd, {
10108
10240
  history_add(cmd);
10109
10241
  return -1;
10110
10242
  }
10243
+ let last_history_line = null;
10111
10244
  function history_add(str) {
10112
- if (str) {
10245
+ if (str && str !== last_history_line) {
10113
10246
  history.push(str);
10114
10247
  if (history_file) {
10115
10248
  history_file.append(str);
10116
10249
  }
10117
10250
  }
10251
+ last_history_line = str;
10118
10252
  history_index = history.length;
10119
10253
  }
10120
10254
  function previous_history() {
@@ -32543,7 +32677,7 @@ function expand(str, isTop) {
32543
32677
  var isOptions = m.body.indexOf(',') >= 0;
32544
32678
  if (!isSequence && !isOptions) {
32545
32679
  // {a},b}
32546
- if (m.post.match(/,.*\}/)) {
32680
+ if (m.post.match(/,(?!,).*\}/)) {
32547
32681
  str = m.pre + '{' + m.body + escClose + m.post;
32548
32682
  return expand(str);
32549
32683
  }
@@ -36276,11 +36410,13 @@ function startRepl(lang) {
36276
36410
  history_add(cmd);
36277
36411
  return -1;
36278
36412
  }
36413
+ let last_history_line = null;
36279
36414
  function history_add(str) {
36280
- if (str) {
36415
+ if (str && str !== last_history_line) {
36281
36416
  history.push(str);
36282
36417
  historyFile.append(str);
36283
36418
  }
36419
+ last_history_line = str;
36284
36420
  history_index = history.length;
36285
36421
  }
36286
36422
  function previous_history() {
@@ -92253,7 +92389,7 @@ var __kame__ = {
92253
92389
  },
92254
92390
 
92255
92391
  chunkUrls: {
92256
- "external:node:fs": "9a6a54a4ea1d6a8292f46bf60bfc0005.js"
92392
+ "external:node:fs": "3bb801181133a92adaa3fcceda50fa5a.js"
92257
92393
  },
92258
92394
  loadChunk: function loadChunk(id) {
92259
92395
  var resolve, reject;
@@ -92301,7 +92437,7 @@ var __kame__ = {
92301
92437
  modules: modules,
92302
92438
  };
92303
92439
 
92304
- global.__kame_instances__ = global.__kame_instances__ || {}; global.__kame_instances__["2bb27833f0d1749108048618"] = __kame__;
92440
+ global.__kame_instances__ = global.__kame_instances__ || {}; global.__kame_instances__["b1f20ef10f91754074773070"] = __kame__;
92305
92441
 
92306
92442
  return __kame__.runModule("src/primordials.ts", true);
92307
92443
  }
@@ -757,6 +757,9 @@ _export(exports, {
757
757
  ChildProcessOptions: function () {
758
758
  return _ChildProcess.ChildProcessOptions;
759
759
  },
760
+ ChildProcessState: function () {
761
+ return _ChildProcess.ChildProcessState;
762
+ },
760
763
  exec: function () {
761
764
  return _exec.exec;
762
765
  }
@@ -1933,9 +1936,18 @@ const _types = _kame_require_("src/api/types/index.ts");
1933
1936
  const _assert = _kame_require_("src/api/assert/index.ts");
1934
1937
  const _path = _kame_require_("src/api/path/index.ts");
1935
1938
  class ChildProcess {
1936
- /** returns pid */start() {
1939
+ get state() {
1940
+ this._updateState();
1941
+ return this._state;
1942
+ }
1943
+ get pid() {
1944
+ this._updateState();
1945
+ return this._getPidRaw();
1946
+ }
1947
+ /** returns pid */
1948
+ start() {
1937
1949
  this._logging.trace.call(null, "ChildProcess.start:", this.args);
1938
- this.pid = _quickjsos.exec(this.args, {
1950
+ const pid = _quickjsos.exec(this.args, {
1939
1951
  block: false,
1940
1952
  cwd: this.cwd.toString(),
1941
1953
  env: this.env,
@@ -1943,33 +1955,123 @@ class ChildProcess {
1943
1955
  stdout: this.stdio.out.fileno(),
1944
1956
  stderr: this.stdio.err.fileno()
1945
1957
  });
1946
- return this.pid;
1958
+ this._state = {
1959
+ id: "STARTED",
1960
+ pid
1961
+ };
1962
+ return pid;
1947
1963
  }
1948
- waitUntilComplete() {
1949
- const pid = this.pid;
1950
- if (pid == null) {
1951
- throw new Error("Cannot wait for a child process that hasn't yet been started");
1964
+ _getPidRaw() {
1965
+ const state = this._state;
1966
+ switch (state.id) {
1967
+ case "UNSTARTED":
1968
+ return null;
1969
+ case "STARTED":
1970
+ case "STOPPED":
1971
+ case "CONTINUED":
1972
+ return state.pid;
1973
+ case "EXITED":
1974
+ case "SIGNALED":
1975
+ return state.oldPid;
1976
+ default:
1977
+ {
1978
+ const here = state;
1979
+ throw new Error(`Unhandled ChildProcessStateKind: ${state.id}`);
1980
+ }
1952
1981
  }
1953
- while (true) {
1954
- const [ret, status] = _quickjsos.waitpid(pid);
1955
- if (ret == pid) {
1956
- if (_quickjsos.WIFEXITED(status)) {
1957
- const ret = {
1958
- status: _quickjsos.WEXITSTATUS(status),
1959
- signal: undefined
1960
- };
1961
- this._logging.trace.call(null, "ChildProcess result:", this.args, "->", ret);
1962
- return ret;
1963
- } else if (_quickjsos.WIFSIGNALED(status)) {
1964
- const ret = {
1965
- status: undefined,
1966
- signal: _quickjsos.WTERMSIG(status)
1967
- };
1968
- this._logging.trace.call(null, "ChildProcess result:", this.args, "->");
1969
- return ret;
1982
+ }
1983
+ _updateState() {
1984
+ switch (this._state.id) {
1985
+ case "UNSTARTED":
1986
+ case "EXITED":
1987
+ case "SIGNALED":
1988
+ return;
1989
+ case "STARTED":
1990
+ case "STOPPED":
1991
+ case "CONTINUED":
1992
+ this._waitpid(false);
1993
+ break;
1994
+ default:
1995
+ {
1996
+ const here = this._state;
1997
+ throw new Error(`Unhandled ChildProcessStateKind: ${this._state.id}`);
1970
1998
  }
1999
+ }
2000
+ }
2001
+ _waitpid(block) {
2002
+ const pid = this._getPidRaw();
2003
+ if (!pid) {
2004
+ return;
2005
+ }
2006
+ const flags = block ? 0 : _quickjsos.WNOHANG;
2007
+ const [ret, status] = _quickjsos.waitpid(pid, flags);
2008
+ if (ret === pid) {
2009
+ if (_quickjsos.WIFEXITED(status)) {
2010
+ this._state = {
2011
+ id: "EXITED",
2012
+ oldPid: pid,
2013
+ status: _quickjsos.WEXITSTATUS(status)
2014
+ };
2015
+ this._logging.trace.call(null, "ChildProcess result:", this.args, "->", this._state);
2016
+ } else if (_quickjsos.WIFSIGNALED(status)) {
2017
+ this._state = {
2018
+ id: "SIGNALED",
2019
+ oldPid: pid,
2020
+ signal: _quickjsos.WTERMSIG(status)
2021
+ };
2022
+ this._logging.trace.call(null, "ChildProcess result:", this.args, "->", this._state);
2023
+ } else if (_quickjsos.WIFSTOPPED(status)) {
2024
+ this._state = {
2025
+ id: "STOPPED",
2026
+ pid
2027
+ };
2028
+ this._logging.trace.call(null, "ChildProcess stopped:", this.args);
2029
+ } else if (_quickjsos.WIFCONTINUED(status)) {
2030
+ this._state = {
2031
+ id: "CONTINUED",
2032
+ pid
2033
+ };
2034
+ this._logging.trace.call(null, "ChildProcess continued:", this.args);
1971
2035
  }
1972
2036
  }
2037
+ return false;
2038
+ }
2039
+ waitUntilComplete() {
2040
+ do {
2041
+ const rawState = this._state;
2042
+ idSwitch: switch (rawState.id) {
2043
+ case "UNSTARTED":
2044
+ {
2045
+ throw new Error("The ChildProcess hasn't yet started. Call ChildProcess's start() method before calling waitUntilComplete().");
2046
+ }
2047
+ case "EXITED":
2048
+ {
2049
+ return {
2050
+ status: rawState.status,
2051
+ signal: undefined
2052
+ };
2053
+ }
2054
+ case "SIGNALED":
2055
+ {
2056
+ return {
2057
+ status: undefined,
2058
+ signal: rawState.signal
2059
+ };
2060
+ }
2061
+ case "STARTED":
2062
+ case "CONTINUED":
2063
+ case "STOPPED":
2064
+ {
2065
+ this._waitpid(true);
2066
+ break idSwitch;
2067
+ }
2068
+ default:
2069
+ {
2070
+ const here = rawState;
2071
+ throw new Error(`Unhandled ChildProcessStateKind: ${rawState.id}`);
2072
+ }
2073
+ }
2074
+ } while (true);
1973
2075
  }
1974
2076
  constructor(args, options = {}) {
1975
2077
  _define_property._(this, "args", void 0);
@@ -1977,7 +2079,9 @@ class ChildProcess {
1977
2079
  _define_property._(this, "env", void 0);
1978
2080
  _define_property._(this, "stdio", void 0);
1979
2081
  _define_property._(this, "_logging", void 0);
1980
- _define_property._(this, "pid", null);
2082
+ _define_property._(this, "_state", {
2083
+ id: "UNSTARTED"
2084
+ });
1981
2085
  // type of `args` gets checked in `toArgv`
1982
2086
  this.args = (0, _toargv.toArgv)(args);
1983
2087
  const cwd = options.cwd;
@@ -2821,17 +2925,23 @@ class Path {
2821
2925
  return this.replaceLast([]);
2822
2926
  }
2823
2927
  startsWith(value) {
2824
- value = new Path(value);
2928
+ if (!(0, _is.is)(value, _types.types.Path)) {
2929
+ value = new Path(value);
2930
+ }
2825
2931
  return value.segments.every((segment, index) => this.segments[index] === segment);
2826
2932
  }
2827
2933
  endsWith(value) {
2828
- value = new Path(value);
2934
+ if (!(0, _is.is)(value, _types.types.Path)) {
2935
+ value = new Path(value);
2936
+ }
2829
2937
  const valueSegmentsReversed = [...value.segments].reverse();
2830
2938
  const ownSegmentsReversed = [...this.segments].reverse();
2831
2939
  return valueSegmentsReversed.every((segment, index) => ownSegmentsReversed[index] === segment);
2832
2940
  }
2833
2941
  indexOf(value, fromIndex = 0) {
2834
- value = new Path(value);
2942
+ if (!(0, _is.is)(value, _types.types.Path)) {
2943
+ value = new Path(value);
2944
+ }
2835
2945
  const ownSegmentsLength = this.segments.length;
2836
2946
  for (let i = fromIndex; i < ownSegmentsLength; i++) {
2837
2947
  if (value.segments.every((valueSegment, valueIndex) => {
@@ -2846,8 +2956,12 @@ class Path {
2846
2956
  return this.indexOf(value, fromIndex) !== -1;
2847
2957
  }
2848
2958
  replace(value, replacement) {
2849
- value = new Path(value);
2850
- replacement = new Path(replacement);
2959
+ if (!(0, _is.is)(value, _types.types.Path)) {
2960
+ value = new Path(value);
2961
+ }
2962
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2963
+ replacement = new Path(replacement);
2964
+ }
2851
2965
  const matchIndex = this.indexOf(value);
2852
2966
  if (matchIndex === -1) {
2853
2967
  return this.clone();
@@ -2857,7 +2971,9 @@ class Path {
2857
2971
  }
2858
2972
  }
2859
2973
  replaceAll(value, replacement) {
2860
- replacement = new Path(replacement);
2974
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2975
+ replacement = new Path(replacement);
2976
+ }
2861
2977
  let searchIndex = 0;
2862
2978
  let currentPath = this;
2863
2979
  const ownLength = this.segments.length;
@@ -2873,12 +2989,28 @@ class Path {
2873
2989
  return currentPath;
2874
2990
  }
2875
2991
  replaceLast(replacement) {
2876
- replacement = new Path(replacement);
2992
+ if (!(0, _is.is)(replacement, _types.types.Path)) {
2993
+ replacement = new Path(replacement);
2994
+ }
2877
2995
  const segments = [...this.segments];
2878
2996
  segments.pop();
2879
2997
  segments.push(...replacement.segments);
2880
2998
  return Path.fromRaw(segments, this.separator);
2881
2999
  }
3000
+ equals(other) {
3001
+ if (!(0, _is.is)(other, _types.types.Path)) {
3002
+ other = new Path(other);
3003
+ }
3004
+ return other.separator === this.separator && this.hasEqualSegments(other);
3005
+ }
3006
+ hasEqualSegments(other) {
3007
+ if (!(0, _is.is)(other, _types.types.Path)) {
3008
+ other = new Path(other);
3009
+ }
3010
+ return this.segments.length === other.segments.length && this.segments.every((segment, index) => {
3011
+ return segment === other.segments[index];
3012
+ });
3013
+ }
2882
3014
  [_inspect_custom](inputs) {
2883
3015
  if (typeof this.segments === "undefined" || typeof this.separator === "undefined") {
2884
3016
  // inspecting Path.prototype, or a Path someone messed up
@@ -4610,7 +4742,7 @@ function readModule(modulePath) {
4610
4742
  /* --- src/hardcoded/compile-time.js?evalAtBuildTime --- */
4611
4743
  "src/hardcoded/compile-time.js?evalAtBuildTime": (function (exports, _kame_require_, module, __filename, __dirname, _kame_dynamic_import_) {
4612
4744
  module.exports = {
4613
- "version": "v0.0.13",
4745
+ "version": "v0.14.1",
4614
4746
  "arch": "x86_64"
4615
4747
  };
4616
4748
  }),
@@ -10108,13 +10240,15 @@ function startRepl(handle_cmd, {
10108
10240
  history_add(cmd);
10109
10241
  return -1;
10110
10242
  }
10243
+ let last_history_line = null;
10111
10244
  function history_add(str) {
10112
- if (str) {
10245
+ if (str && str !== last_history_line) {
10113
10246
  history.push(str);
10114
10247
  if (history_file) {
10115
10248
  history_file.append(str);
10116
10249
  }
10117
10250
  }
10251
+ last_history_line = str;
10118
10252
  history_index = history.length;
10119
10253
  }
10120
10254
  function previous_history() {
@@ -32543,7 +32677,7 @@ function expand(str, isTop) {
32543
32677
  var isOptions = m.body.indexOf(',') >= 0;
32544
32678
  if (!isSequence && !isOptions) {
32545
32679
  // {a},b}
32546
- if (m.post.match(/,.*\}/)) {
32680
+ if (m.post.match(/,(?!,).*\}/)) {
32547
32681
  str = m.pre + '{' + m.body + escClose + m.post;
32548
32682
  return expand(str);
32549
32683
  }
@@ -36276,11 +36410,13 @@ function startRepl(lang) {
36276
36410
  history_add(cmd);
36277
36411
  return -1;
36278
36412
  }
36413
+ let last_history_line = null;
36279
36414
  function history_add(str) {
36280
- if (str) {
36415
+ if (str && str !== last_history_line) {
36281
36416
  history.push(str);
36282
36417
  historyFile.append(str);
36283
36418
  }
36419
+ last_history_line = str;
36284
36420
  history_index = history.length;
36285
36421
  }
36286
36422
  function previous_history() {
@@ -92253,7 +92389,7 @@ var __kame__ = {
92253
92389
  },
92254
92390
 
92255
92391
  chunkUrls: {
92256
- "external:node:fs": "a415e82313f4069558924d5cf0df0a57.js"
92392
+ "external:node:fs": "46567d986364f3f5dc3de6d742886e7c.js"
92257
92393
  },
92258
92394
  loadChunk: function loadChunk(id) {
92259
92395
  var resolve, reject;
@@ -92301,7 +92437,7 @@ var __kame__ = {
92301
92437
  modules: modules,
92302
92438
  };
92303
92439
 
92304
- global.__kame_instances__ = global.__kame_instances__ || {}; global.__kame_instances__["98a6cb5a4631749108049619"] = __kame__;
92440
+ global.__kame_instances__ = global.__kame_instances__ || {}; global.__kame_instances__["094c62d9fe61754074774557"] = __kame__;
92305
92441
 
92306
92442
  return __kame__.runModule("src/primordials.ts", true);
92307
92443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yavascript",
3
- "version": "0.0.13",
3
+ "version": "0.14.1",
4
4
  "main": "lib/index.js",
5
5
  "bin": "lib/cli.js",
6
6
  "types": "yavascript.d.ts",