@visulima/vis 1.0.0-alpha.13 → 1.0.0-alpha.14

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 (100) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.md +7242 -385
  3. package/dist/bin.js +1 -1
  4. package/dist/config/index.d.ts +493 -1
  5. package/dist/config/index.js +1 -1
  6. package/dist/packem_chunks/applyDefaults.js +2 -2
  7. package/dist/packem_chunks/bin.js +1134 -199
  8. package/dist/packem_chunks/doctor-probe.js +2 -2
  9. package/dist/packem_chunks/fix.js +11 -11
  10. package/dist/packem_chunks/handler.js +1 -1
  11. package/dist/packem_chunks/handler10.js +1 -1
  12. package/dist/packem_chunks/handler11.js +1 -1
  13. package/dist/packem_chunks/handler12.js +5 -5
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +20 -18
  16. package/dist/packem_chunks/handler15.js +1 -20
  17. package/dist/packem_chunks/handler16.js +1 -1
  18. package/dist/packem_chunks/handler17.js +1 -1
  19. package/dist/packem_chunks/handler18.js +1 -1
  20. package/dist/packem_chunks/handler19.js +5 -1
  21. package/dist/packem_chunks/handler2.js +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -5
  23. package/dist/packem_chunks/handler21.js +1 -1
  24. package/dist/packem_chunks/handler22.js +5 -1
  25. package/dist/packem_chunks/handler23.js +1 -5
  26. package/dist/packem_chunks/handler24.js +3 -1
  27. package/dist/packem_chunks/handler25.js +1 -3
  28. package/dist/packem_chunks/handler26.js +1 -1
  29. package/dist/packem_chunks/handler27.js +7 -1
  30. package/dist/packem_chunks/handler28.js +22 -6
  31. package/dist/packem_chunks/handler29.js +3 -23
  32. package/dist/packem_chunks/handler3.js +4 -4
  33. package/dist/packem_chunks/handler30.js +18 -3
  34. package/dist/packem_chunks/handler31.js +1 -1
  35. package/dist/packem_chunks/handler32.js +2 -2
  36. package/dist/packem_chunks/handler33.js +24 -24
  37. package/dist/packem_chunks/handler34.js +2 -2
  38. package/dist/packem_chunks/handler35.js +2 -2
  39. package/dist/packem_chunks/handler36.js +20 -20
  40. package/dist/packem_chunks/handler37.js +2 -2
  41. package/dist/packem_chunks/handler38.js +6 -22
  42. package/dist/packem_chunks/handler39.js +11 -11
  43. package/dist/packem_chunks/handler4.js +1 -1
  44. package/dist/packem_chunks/handler40.js +5 -22
  45. package/dist/packem_chunks/handler41.js +24 -6
  46. package/dist/packem_chunks/handler42.js +10 -5
  47. package/dist/packem_chunks/handler43.js +153 -10
  48. package/dist/packem_chunks/handler44.js +25 -153
  49. package/dist/packem_chunks/handler45.js +3 -25
  50. package/dist/packem_chunks/handler46.js +27 -3
  51. package/dist/packem_chunks/handler47.js +41 -26
  52. package/dist/packem_chunks/handler48.js +32 -40
  53. package/dist/packem_chunks/handler5.js +7 -7
  54. package/dist/packem_chunks/handler6.js +1 -1
  55. package/dist/packem_chunks/handler7.js +1 -1
  56. package/dist/packem_chunks/handler8.js +1 -1
  57. package/dist/packem_chunks/handler9.js +1 -1
  58. package/dist/packem_chunks/heal-accept.js +4 -4
  59. package/dist/packem_chunks/heal.js +3 -3
  60. package/dist/packem_chunks/help-command.js +18 -0
  61. package/dist/packem_chunks/index.js +4 -4
  62. package/dist/packem_chunks/loader.js +1 -1
  63. package/dist/packem_chunks/tar.js +1 -1
  64. package/dist/packem_shared/ai-analysis-Dzs_nUwM.js +68 -0
  65. package/dist/packem_shared/ai-cache-Dtvmbsru.js +1 -0
  66. package/dist/packem_shared/{ai-fix-nn4zOE95.js → ai-fix-BmLM72GS.js} +4 -4
  67. package/dist/packem_shared/cache-directory-xASJia6M.js +1 -0
  68. package/dist/packem_shared/dependency-scan-DmwPKwLy.js +2 -0
  69. package/dist/packem_shared/docker-CA-scYu0.js +2 -0
  70. package/dist/packem_shared/failure-log-fD4DiFb1.js +2 -0
  71. package/dist/packem_shared/flakiness-BIg1rwvp.js +1 -0
  72. package/dist/packem_shared/{giget-CcEy_Elm.js → giget-BX2ixMoa.js} +2 -2
  73. package/dist/packem_shared/index-OlP7U_t5.js +6 -0
  74. package/dist/packem_shared/lockfile-BXylopgH.js +1 -0
  75. package/dist/packem_shared/otelPlugin-y5hoCw4b.js +1 -0
  76. package/dist/packem_shared/registry-BHqKXiLb.js +2 -0
  77. package/dist/packem_shared/run-summary-utils-D39XBHWW.js +1 -0
  78. package/dist/packem_shared/runtime-check-BaKni2y1.js +1 -0
  79. package/dist/packem_shared/selectors-BvtUXWGY.js +3 -0
  80. package/dist/packem_shared/toolchain-B7sIiJxK.js +5 -0
  81. package/dist/packem_shared/typosquats-XkC1CnOa.js +1 -0
  82. package/dist/packem_shared/verify-BVTcVfoW.js +1 -0
  83. package/dist/packem_shared/{vis-update-app-D1jl0UZZ.js → vis-update-app-DR8c4OfG.js} +1 -1
  84. package/package.json +15 -30
  85. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +0 -67
  86. package/dist/packem_shared/ai-cache-DoiF80AR.js +0 -1
  87. package/dist/packem_shared/cache-directory-CwHlJhgx.js +0 -1
  88. package/dist/packem_shared/dependency-scan-COr5n63B.js +0 -2
  89. package/dist/packem_shared/docker-D6OGr5_S.js +0 -2
  90. package/dist/packem_shared/failure-log-iUVLf6ts.js +0 -2
  91. package/dist/packem_shared/flakiness-D9wf0t56.js +0 -1
  92. package/dist/packem_shared/otel-DxDUPJJH.js +0 -6
  93. package/dist/packem_shared/otelPlugin-CQq6poq8.js +0 -1
  94. package/dist/packem_shared/registry-CkubDdiY.js +0 -2
  95. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +0 -1
  96. package/dist/packem_shared/runtime-check-BXZ43CBW.js +0 -1
  97. package/dist/packem_shared/selectors-BylODRiM.js +0 -3
  98. package/dist/packem_shared/toolchain-BgBOUHII.js +0 -5
  99. package/dist/packem_shared/typosquats-CcZl99B1.js +0 -1
  100. package/dist/packem_shared/verify-Baj5mFJ7.js +0 -1
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import"@visulima/cerebro";import"@visulima/cerebro/command/completion";import"@visulima/cerebro/compile-cache";import"@visulima/cerebro/heap-tuning";import"@visulima/cerebro/plugins/error-handler";import"@visulima/fs";import"@visulima/package";import"@visulima/path";import"./packem_chunks/bin.js";
2
+ import"./packem_chunks/bin.js";import"@visulima/fs";import"./packem_shared/index-OlP7U_t5.js";
@@ -1,6 +1,5 @@
1
1
  import { TaskResult, Task, TargetConfiguration, ConstraintsConfig, NamedInputs, TaskRunnerOptions } from '@visulima/task-runner';
2
2
  import { Hookable } from 'hookable';
3
- import { Tracer } from '@opentelemetry/api';
4
3
  /**
5
4
  * Typed hook surface exposed to vis plugins.
6
5
  *
@@ -1570,6 +1569,499 @@ interface VisConfig {
1570
1569
  */
1571
1570
  versionConstraint?: string;
1572
1571
  }
1572
+ /**
1573
+ * @since 1.0.0
1574
+ */
1575
+ interface Context {
1576
+ /**
1577
+ * Get a value from the context.
1578
+ *
1579
+ * @param key key which identifies a context value
1580
+ */
1581
+ getValue(key: symbol): unknown;
1582
+ /**
1583
+ * Create a new context which inherits from this context and has
1584
+ * the given key set to the given value.
1585
+ *
1586
+ * @param key context key for which to set the value
1587
+ * @param value value to set for the given key
1588
+ */
1589
+ setValue(key: symbol, value: unknown): Context;
1590
+ /**
1591
+ * Return a new context which inherits from this context but does
1592
+ * not contain a value for the given key.
1593
+ *
1594
+ * @param key context key for which to clear a value
1595
+ */
1596
+ deleteValue(key: symbol): Context;
1597
+ }
1598
+ /**
1599
+ * Attributes is a map from string to attribute values.
1600
+ *
1601
+ * Note: only the own enumerable keys are counted as valid attribute keys.
1602
+ *
1603
+ * @since 1.3.0
1604
+ */
1605
+ interface Attributes {
1606
+ [attributeKey: string]: AttributeValue | undefined;
1607
+ }
1608
+ /**
1609
+ * Attribute values may be any non-nullish primitive value except an object.
1610
+ *
1611
+ * null or undefined attribute values are invalid and will result in undefined behavior.
1612
+ *
1613
+ * @since 1.3.0
1614
+ */
1615
+ type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
1616
+ interface ExceptionWithCode {
1617
+ code: string | number;
1618
+ name?: string;
1619
+ message?: string;
1620
+ stack?: string;
1621
+ }
1622
+ interface ExceptionWithMessage {
1623
+ code?: string | number;
1624
+ message: string;
1625
+ name?: string;
1626
+ stack?: string;
1627
+ }
1628
+ interface ExceptionWithName {
1629
+ code?: string | number;
1630
+ message?: string;
1631
+ name: string;
1632
+ stack?: string;
1633
+ }
1634
+ /**
1635
+ * Defines Exception.
1636
+ *
1637
+ * string or an object with one of (message or name or code) and optional stack
1638
+ *
1639
+ * @since 1.0.0
1640
+ */
1641
+ type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
1642
+ /**
1643
+ * Defines High-Resolution Time.
1644
+ *
1645
+ * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
1646
+ * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
1647
+ * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
1648
+ * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
1649
+ * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
1650
+ * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
1651
+ * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
1652
+ * This is represented in HrTime format as [1609504210, 150000000].
1653
+ *
1654
+ * @since 1.0.0
1655
+ */
1656
+ type HrTime = [number, number];
1657
+ /**
1658
+ * Defines TimeInput.
1659
+ *
1660
+ * hrtime, epoch milliseconds, performance.now() or Date
1661
+ *
1662
+ * @since 1.0.0
1663
+ */
1664
+ type TimeInput = HrTime | number | Date;
1665
+ /**
1666
+ * @deprecated please use {@link Attributes}
1667
+ * @since 1.0.0
1668
+ */
1669
+ type SpanAttributes = Attributes;
1670
+ /**
1671
+ * @deprecated please use {@link AttributeValue}
1672
+ * @since 1.0.0
1673
+ */
1674
+ type SpanAttributeValue = AttributeValue;
1675
+ /**
1676
+ * @since 1.0.0
1677
+ */
1678
+ interface TraceState {
1679
+ /**
1680
+ * Create a new TraceState which inherits from this TraceState and has the
1681
+ * given key set.
1682
+ * The new entry will always be added in the front of the list of states.
1683
+ *
1684
+ * @param key key of the TraceState entry.
1685
+ * @param value value of the TraceState entry.
1686
+ */
1687
+ set(key: string, value: string): TraceState;
1688
+ /**
1689
+ * Return a new TraceState which inherits from this TraceState but does not
1690
+ * contain the given key.
1691
+ *
1692
+ * @param key the key for the TraceState entry to be removed.
1693
+ */
1694
+ unset(key: string): TraceState;
1695
+ /**
1696
+ * Returns the value to which the specified key is mapped, or `undefined` if
1697
+ * this map contains no mapping for the key.
1698
+ *
1699
+ * @param key with which the specified value is to be associated.
1700
+ * @returns the value to which the specified key is mapped, or `undefined` if
1701
+ * this map contains no mapping for the key.
1702
+ */
1703
+ get(key: string): string | undefined;
1704
+ /**
1705
+ * Serializes the TraceState to a `list` as defined below. The `list` is a
1706
+ * series of `list-members` separated by commas `,`, and a list-member is a
1707
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
1708
+ * surrounding `list-members` are ignored. There can be a maximum of 32
1709
+ * `list-members` in a `list`.
1710
+ *
1711
+ * @returns the serialized string.
1712
+ */
1713
+ serialize(): string;
1714
+ }
1715
+ /**
1716
+ * A SpanContext represents the portion of a {@link Span} which must be
1717
+ * serialized and propagated along side of a {@link Baggage}.
1718
+ *
1719
+ * @since 1.0.0
1720
+ */
1721
+ interface SpanContext {
1722
+ /**
1723
+ * The ID of the trace that this span belongs to. It is worldwide unique
1724
+ * with practically sufficient probability by being made as 16 randomly
1725
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
1726
+ * 128 bits.
1727
+ */
1728
+ traceId: string;
1729
+ /**
1730
+ * The ID of the Span. It is globally unique with practically sufficient
1731
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
1732
+ * lowercase hex characters corresponding to 64 bits.
1733
+ */
1734
+ spanId: string;
1735
+ /**
1736
+ * Only true if the SpanContext was propagated from a remote parent.
1737
+ */
1738
+ isRemote?: boolean;
1739
+ /**
1740
+ * Trace flags to propagate.
1741
+ *
1742
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
1743
+ * sampled or not. When set, the least significant bit documents that the
1744
+ * caller may have recorded trace data. A caller who does not record trace
1745
+ * data out-of-band leaves this flag unset.
1746
+ *
1747
+ * see {@link TraceFlags} for valid flag values.
1748
+ */
1749
+ traceFlags: number;
1750
+ /**
1751
+ * Tracing-system-specific info to propagate.
1752
+ *
1753
+ * The tracestate field value is a `list` as defined below. The `list` is a
1754
+ * series of `list-members` separated by commas `,`, and a list-member is a
1755
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
1756
+ * surrounding `list-members` are ignored. There can be a maximum of 32
1757
+ * `list-members` in a `list`.
1758
+ * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
1759
+ *
1760
+ * Examples:
1761
+ * Single tracing system (generic format):
1762
+ * tracestate: rojo=00f067aa0ba902b7
1763
+ * Multiple tracing systems (with different formatting):
1764
+ * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
1765
+ */
1766
+ traceState?: TraceState;
1767
+ }
1768
+ /**
1769
+ * @since 1.0.0
1770
+ */
1771
+ interface SpanStatus {
1772
+ /** The status code of this message. */
1773
+ code: SpanStatusCode;
1774
+ /** A developer-facing error message. */
1775
+ message?: string;
1776
+ }
1777
+ /**
1778
+ * An enumeration of status codes.
1779
+ *
1780
+ * @since 1.0.0
1781
+ */
1782
+ declare enum SpanStatusCode {
1783
+ /**
1784
+ * The default status.
1785
+ */
1786
+ UNSET = 0,
1787
+ /**
1788
+ * The operation has been validated by an Application developer or
1789
+ * Operator to have completed successfully.
1790
+ */
1791
+ OK = 1,
1792
+ /**
1793
+ * The operation contains an error.
1794
+ */
1795
+ ERROR = 2,
1796
+ }
1797
+ /**
1798
+ * A pointer from the current {@link Span} to another span in the same trace or
1799
+ * in a different trace.
1800
+ * Few examples of Link usage.
1801
+ * 1. Batch Processing: A batch of elements may contain elements associated
1802
+ * with one or more traces/spans. Since there can only be one parent
1803
+ * SpanContext, Link is used to keep reference to SpanContext of all
1804
+ * elements in the batch.
1805
+ * 2. Public Endpoint: A SpanContext in incoming client request on a public
1806
+ * endpoint is untrusted from service provider perspective. In such case it
1807
+ * is advisable to start a new trace with appropriate sampling decision.
1808
+ * However, it is desirable to associate incoming SpanContext to new trace
1809
+ * initiated on service provider side so two traces (from Client and from
1810
+ * Service Provider) can be correlated.
1811
+ *
1812
+ * @since 1.0.0
1813
+ */
1814
+ interface Link {
1815
+ /** The {@link SpanContext} of a linked span. */
1816
+ context: SpanContext;
1817
+ /** A set of {@link SpanAttributes} on the link. */
1818
+ attributes?: SpanAttributes;
1819
+ /** Count of attributes of the link that were dropped due to collection limits */
1820
+ droppedAttributesCount?: number;
1821
+ }
1822
+ /**
1823
+ * An interface that represents a span. A span represents a single operation
1824
+ * within a trace. Examples of span might include remote procedure calls or a
1825
+ * in-process function calls to sub-components. A Trace has a single, top-level
1826
+ * "root" Span that in turn may have zero or more child Spans, which in turn
1827
+ * may have children.
1828
+ *
1829
+ * Spans are created by the {@link Tracer.startSpan} method.
1830
+ *
1831
+ * @since 1.0.0
1832
+ */
1833
+ interface Span {
1834
+ /**
1835
+ * Returns the {@link SpanContext} object associated with this Span.
1836
+ *
1837
+ * Get an immutable, serializable identifier for this span that can be used
1838
+ * to create new child spans. Returned SpanContext is usable even after the
1839
+ * span ends.
1840
+ *
1841
+ * @returns the SpanContext object associated with this Span.
1842
+ */
1843
+ spanContext(): SpanContext;
1844
+ /**
1845
+ * Sets an attribute to the span.
1846
+ *
1847
+ * Sets a single Attribute with the key and value passed as arguments.
1848
+ *
1849
+ * @param key the key for this attribute.
1850
+ * @param value the value for this attribute. Setting a value null or
1851
+ * undefined is invalid and will result in undefined behavior.
1852
+ */
1853
+ setAttribute(key: string, value: SpanAttributeValue): this;
1854
+ /**
1855
+ * Sets attributes to the span.
1856
+ *
1857
+ * @param attributes the attributes that will be added.
1858
+ * null or undefined attribute values
1859
+ * are invalid and will result in undefined behavior.
1860
+ */
1861
+ setAttributes(attributes: SpanAttributes): this;
1862
+ /**
1863
+ * Adds an event to the Span.
1864
+ *
1865
+ * @param name the name of the event.
1866
+ * @param [attributesOrStartTime] the attributes that will be added; these are
1867
+ * associated with this event. Can be also a start time
1868
+ * if type is {@type TimeInput} and 3rd param is undefined
1869
+ * @param [startTime] start time of the event.
1870
+ */
1871
+ addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this;
1872
+ /**
1873
+ * Adds a single link to the span.
1874
+ *
1875
+ * Links added after the creation will not affect the sampling decision.
1876
+ * It is preferred span links be added at span creation.
1877
+ *
1878
+ * @param link the link to add.
1879
+ */
1880
+ addLink(link: Link): this;
1881
+ /**
1882
+ * Adds multiple links to the span.
1883
+ *
1884
+ * Links added after the creation will not affect the sampling decision.
1885
+ * It is preferred span links be added at span creation.
1886
+ *
1887
+ * @param links the links to add.
1888
+ */
1889
+ addLinks(links: Link[]): this;
1890
+ /**
1891
+ * Sets the status of the span.
1892
+ *
1893
+ * By default, a span has status {@link SpanStatusCode.UNSET}.
1894
+ * Calling this method overrides that default.
1895
+ *
1896
+ * The status codes have a total order: `OK > ERROR > UNSET`.
1897
+ *
1898
+ * - Once {@link SpanStatusCode.OK} is set, any further attempts to change
1899
+ * the status are ignored.
1900
+ * - Any attempt to set {@link SpanStatusCode.UNSET} is always ignored.
1901
+ *
1902
+ * The `message` field is only used when {@link SpanStatusCode.ERROR} is set.
1903
+ * For all other status codes, `message` is ignored.
1904
+ *
1905
+ * @param status The {@link SpanStatus} to set.
1906
+ */
1907
+ setStatus(status: SpanStatus): this;
1908
+ /**
1909
+ * Updates the Span name.
1910
+ *
1911
+ * This will override the name provided via {@link Tracer.startSpan}.
1912
+ *
1913
+ * Upon this update, any sampling behavior based on Span name will depend on
1914
+ * the implementation.
1915
+ *
1916
+ * @param name the Span name.
1917
+ */
1918
+ updateName(name: string): this;
1919
+ /**
1920
+ * Marks the end of Span execution.
1921
+ *
1922
+ * Call to End of a Span MUST not have any effects on child spans. Those may
1923
+ * still be running and can be ended later.
1924
+ *
1925
+ * Do not return `this`. The Span generally should not be used after it
1926
+ * is ended so chaining is not desired in this context.
1927
+ *
1928
+ * @param [endTime] the time to set as Span's end time. If not provided,
1929
+ * use the current time as the span's end time.
1930
+ */
1931
+ end(endTime?: TimeInput): void;
1932
+ /**
1933
+ * Returns the flag whether this span will be recorded.
1934
+ *
1935
+ * @returns true if this Span is active and recording information like events
1936
+ * with the `AddEvent` operation and attributes using `setAttributes`.
1937
+ */
1938
+ isRecording(): boolean;
1939
+ /**
1940
+ * Sets exception as a span event
1941
+ * @param exception the exception the only accepted values are string or Error
1942
+ * @param [time] the time to set as Span's event time. If not provided,
1943
+ * use the current time.
1944
+ */
1945
+ recordException(exception: Exception, time?: TimeInput): void;
1946
+ }
1947
+ /**
1948
+ * @since 1.0.0
1949
+ */
1950
+ declare enum SpanKind {
1951
+ /** Default value. Indicates that the span is used internally. */
1952
+ INTERNAL = 0,
1953
+ /**
1954
+ * Indicates that the span covers server-side handling of an RPC or other
1955
+ * remote request.
1956
+ */
1957
+ SERVER = 1,
1958
+ /**
1959
+ * Indicates that the span covers the client-side wrapper around an RPC or
1960
+ * other remote request.
1961
+ */
1962
+ CLIENT = 2,
1963
+ /**
1964
+ * Indicates that the span describes producer sending a message to a
1965
+ * broker. Unlike client and server, there is no direct critical path latency
1966
+ * relationship between producer and consumer spans.
1967
+ */
1968
+ PRODUCER = 3,
1969
+ /**
1970
+ * Indicates that the span describes consumer receiving a message from a
1971
+ * broker. Unlike client and server, there is no direct critical path latency
1972
+ * relationship between producer and consumer spans.
1973
+ */
1974
+ CONSUMER = 4,
1975
+ }
1976
+ /**
1977
+ * Options needed for span creation
1978
+ *
1979
+ * @since 1.0.0
1980
+ */
1981
+ interface SpanOptions {
1982
+ /**
1983
+ * The SpanKind of a span
1984
+ * @default {@link SpanKind.INTERNAL}
1985
+ */
1986
+ kind?: SpanKind;
1987
+ /** A span's attributes */
1988
+ attributes?: Attributes;
1989
+ /** {@link Link}s span to other spans */
1990
+ links?: Link[];
1991
+ /** A manually specified start time for the created `Span` object. */
1992
+ startTime?: TimeInput;
1993
+ /** The new span should be a root span. (Ignore parent from context). */
1994
+ root?: boolean;
1995
+ }
1996
+ /**
1997
+ * Tracer provides an interface for creating {@link Span}s.
1998
+ *
1999
+ * @since 1.0.0
2000
+ */
2001
+ interface Tracer {
2002
+ /**
2003
+ * Starts a new {@link Span}. Start the span without setting it on context.
2004
+ *
2005
+ * This method do NOT modify the current Context.
2006
+ *
2007
+ * @param name The name of the span
2008
+ * @param [options] SpanOptions used for span creation
2009
+ * @param [context] Context to use to extract parent
2010
+ * @returns Span The newly created span
2011
+ * @example
2012
+ * const span = tracer.startSpan('op');
2013
+ * span.setAttribute('key', 'value');
2014
+ * span.end();
2015
+ */
2016
+ startSpan(name: string, options?: SpanOptions, context?: Context): Span;
2017
+ /**
2018
+ * Starts a new {@link Span} and calls the given function passing it the
2019
+ * created span as first argument.
2020
+ * Additionally the new span gets set in context and this context is activated
2021
+ * for the duration of the function call.
2022
+ *
2023
+ * @param name The name of the span
2024
+ * @param [options] SpanOptions used for span creation
2025
+ * @param [context] Context to use to extract parent
2026
+ * @param fn function called in the context of the span and receives the newly created span as an argument
2027
+ * @returns return value of fn
2028
+ * @example
2029
+ * const something = tracer.startActiveSpan('op', span => {
2030
+ * try {
2031
+ * do some work
2032
+ * span.setStatus({code: SpanStatusCode.OK});
2033
+ * return something;
2034
+ * } catch (err) {
2035
+ * span.setStatus({
2036
+ * code: SpanStatusCode.ERROR,
2037
+ * message: err.message,
2038
+ * });
2039
+ * throw err;
2040
+ * } finally {
2041
+ * span.end();
2042
+ * }
2043
+ * });
2044
+ *
2045
+ * @example
2046
+ * const span = tracer.startActiveSpan('op', span => {
2047
+ * try {
2048
+ * do some work
2049
+ * return span;
2050
+ * } catch (err) {
2051
+ * span.setStatus({
2052
+ * code: SpanStatusCode.ERROR,
2053
+ * message: err.message,
2054
+ * });
2055
+ * throw err;
2056
+ * }
2057
+ * });
2058
+ * do some more work
2059
+ * span.end();
2060
+ */
2061
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
2062
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
2063
+ startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
2064
+ }
1573
2065
  interface OtelPluginOptions {
1574
2066
  /**
1575
2067
  * Rename incoming `project:target` IDs before they become OTel
@@ -1 +1 @@
1
- import{CONFIG_FILES as o,SECURITY_DEFAULTS as n,TASK_CONFIG_FILES as e,applyDefaults as l,defineConfig as s,definePlugin as C,defineTaskConfig as a,findVisConfigFile as g,findVisTaskConfigFile as d,loadVisConfig as F,loadVisTaskConfig as T}from"../packem_chunks/applyDefaults.js";import{o as S}from"../packem_shared/otel-DxDUPJJH.js";export{o as CONFIG_FILES,n as SECURITY_DEFAULTS,e as TASK_CONFIG_FILES,l as applyDefaults,s as defineConfig,C as definePlugin,a as defineTaskConfig,g as findVisConfigFile,d as findVisTaskConfigFile,F as loadVisConfig,T as loadVisTaskConfig,S as otelPlugin};
1
+ import{CONFIG_FILES as o,SECURITY_DEFAULTS as n,TASK_CONFIG_FILES as e,applyDefaults as l,defineConfig as s,definePlugin as C,defineTaskConfig as a,findVisConfigFile as g,findVisTaskConfigFile as d,loadVisConfig as F,loadVisTaskConfig as T}from"../packem_chunks/applyDefaults.js";import{o as S}from"../packem_shared/index-OlP7U_t5.js";export{o as CONFIG_FILES,n as SECURITY_DEFAULTS,e as TASK_CONFIG_FILES,l as applyDefaults,s as defineConfig,C as definePlugin,a as defineTaskConfig,g as findVisConfigFile,d as findVisTaskConfigFile,F as loadVisConfig,T as loadVisTaskConfig,S as otelPlugin};
@@ -1,2 +1,2 @@
1
- var R=Object.defineProperty;var C=(e,t)=>R(e,"name",{value:t,configurable:!0});import{createRequire as A}from"node:module";import{findCacheDirSync as V}from"@visulima/find-cache-dir";import{isAccessibleSync as d,ensureDirSync as y,readJsonSync as T,writeJsonSync as b}from"@visulima/fs";import{join as c,isAbsolute as x,dirname as w}from"@visulima/path";import{createJiti as P}from"jiti";import{V as M,m as U,a as j,b as m}from"../packem_shared/otel-DxDUPJJH.js";import{o as je}from"../packem_shared/otel-DxDUPJJH.js";const I=A(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=C(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(e)}return I(e)},"__cjs_getBuiltinModule"),{createHash:_}=p("node:crypto"),{readdirSync:D,readFileSync:$,copyFileSync:q,unlinkSync:N}=p("node:fs"),{createRequire:B}=p("node:module"),{tmpdir:L}=p("node:os");var W=Object.defineProperty,o=C((e,t)=>W(e,"name",{value:t,configurable:!0}),"r");const F=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],z=new Set(F),G=["vis.task.ts","vis.task.mts","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.cjs"],J=new Set(G),H={blockExoticSubdeps:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade",trustPolicyIgnoreAfter:43200},K=o(e=>({...H,...e}),"mergeSecurityDefaults"),k=o(e=>({...e,security:K(e.security),update:{security:!0,target:"minor",...e.update}}),"applyDefaults"),Y=o(e=>{let t;try{t=D(e)}catch{return}const s=new Set(t.filter(i=>z.has(i)));for(const i of F)if(s.has(i))return c(e,i)},"findVisConfigFile"),Q=o(e=>{let t;try{t=D(e)}catch{return}const s=new Set(t.filter(i=>J.has(i)));for(const i of G)if(s.has(i))return c(e,i)},"findVisTaskConfigFile"),v=o(e=>_("sha256").update($(e)).digest("hex"),"hashFileContents"),X=o(e=>{const t=_("sha256"),s=[...e].sort();for(const i of s)t.update(i),t.update(":"),t.update(v(i)),t.update(`
2
- `);return t.digest("hex")},"hashConfigChain"),Z=o(e=>{const t=c(e,"node_modules");if(d(t)){const i=c(t,".cache","vis");return y(i),c(i,"vis-config-cache.json")}const s=V("vis",{create:!0,cwd:e});return s?c(s,"vis-config-cache.json"):void 0},"getConfigCachePath"),ee=o((e,t)=>{if(d(e))try{const s=T(e);if(s.hash===t)return s.config}catch{}},"readConfigCache"),te=o((e,t,s)=>{try{y(w(e)),b(e,{config:s,hash:t})}catch{}},"writeConfigCache"),se=o(e=>e===void 0?[]:Array.isArray(e)?e:[e],"normalizeExtends"),ie=o((e,t,s)=>{if(x(e))throw new m(e,[...s,t],["Absolute paths in `extends` are not supported. Use a relative path or an npm package name."]);const i=[];if(e.startsWith("./")||e.startsWith("../")){const r=w(t),n=c(r,e);if(i.push(n),d(n))return n;throw new m(e,[...s,t],i)}try{return B(t).resolve(e)}catch{throw i.push(`require.resolve("${e}") from ${t}`),new m(e,[...s,t],i)}},"resolveExtendsSpecifier"),O=o(async(e,t,s)=>{const i=v(t),r=t.slice(t.lastIndexOf(".")),n=c(L(),`vis-config-${i}${r}`);q(t,n);let a;try{a=await e.import(n,{default:!0,try:!0})??{}}catch(f){throw new j(t,s,f)}finally{try{N(n)}catch{}}try{return(typeof a=="function"?await a()??{}:a)??{}}catch(f){throw new j(t,s,f)}},"loadRawConfig"),ne=o((e,t)=>{const s={...e,...t};if(e.targetDefaults||t.targetDefaults){const i=new Set([...Object.keys(e.targetDefaults??{}),...Object.keys(t.targetDefaults??{})]),r={};for(const n of i)r[n]=U(e.targetDefaults?.[n],t.targetDefaults?.[n]);s.targetDefaults=r}return(e.taskDefaults||t.taskDefaults)&&(s.taskDefaults=[...e.taskDefaults??[],...t.taskDefaults??[]]),(e.fileGroups||t.fileGroups)&&(s.fileGroups={...e.fileGroups,...t.fileGroups}),(e.taskGroups||t.taskGroups)&&(s.taskGroups={...e.taskGroups,...t.taskGroups}),(e.security||t.security)&&(s.security={...e.security,...t.security}),(e.update||t.update)&&(s.update={...e.update,...t.update}),(e.taskRunnerOptions||t.taskRunnerOptions)&&(s.taskRunnerOptions={...e.taskRunnerOptions,...t.taskRunnerOptions}),delete s.extends,s},"mergeVisConfigs"),E=o(async(e,t,s,i,r,n)=>{if(i.has(t))throw new M(t,s);if(!r.has(t)){i.add(t);try{const a=await O(e,t,s),f=se(a.extends);for(const u of f){const g=ie(u,t,s);await E(e,g,[...s,t],i,r,n)}r.set(t,a),n.push(t)}finally{i.delete(t)}}},"resolveConfigChain"),ye=o(async(e,t)=>{let s;if(t?.explicitConfigPath){const l=x(t.explicitConfigPath)?t.explicitConfigPath:c(e,t.explicitConfigPath);if(!d(l))throw new Error(`Cannot find config file at ${l}`);s=l}else s=Y(e);if(!s)return k({});const i=P(e,{fsCache:!1,moduleCache:!1}),r=new Set,n=new Map,a=[];await E(i,s,[],r,n,a);const f=X(a),u=Z(e);if(u){const l=ee(u,f);if(l)return l}let g={};for(const l of a)g=ne(g,n.get(l));const S=k(g);return u&&te(u,f,S),S},"loadVisConfig"),oe=o(e=>e.replaceAll(/[^\w.-]+/g,"_"),"sanitizeProjectName"),re=o((e,t)=>{const s=c(e,"node_modules"),i=oe(t);if(d(s)){const n=c(s,".cache","vis","task-configs");return y(n),c(n,`${i}.json`)}const r=V("vis",{create:!0,cwd:e});return r?c(r,"task-configs",`${i}.json`):void 0},"getVisTaskCachePath"),ae=o((e,t)=>{if(d(e))try{const s=T(e);if(s.hash===t)return s.config}catch{}},"readVisTaskCache"),ce=o((e,t,s)=>{try{y(w(e)),b(e,{config:s,hash:t})}catch{}},"writeVisTaskCache"),Ce=o(async(e,t,s)=>{const i=Q(t);if(!i)return;const r=v(i),n=re(e,s);if(n){const u=ae(n,r);if(u)return u}const a=P(t,{fsCache:!1,moduleCache:!1}),f=await O(a,i,[]);return n&&ce(n,r,f),f},"loadVisTaskConfig"),me=o(e=>e,"defineTaskConfig"),ke=o(e=>k(e),"defineConfig"),we=o(e=>e,"definePlugin");export{F as CONFIG_FILES,H as SECURITY_DEFAULTS,G as TASK_CONFIG_FILES,k as applyDefaults,ke as defineConfig,we as definePlugin,me as defineTaskConfig,Y as findVisConfigFile,Q as findVisTaskConfigFile,ye as loadVisConfig,Ce as loadVisTaskConfig,je as otelPlugin};
1
+ var R=Object.defineProperty;var C=(e,t)=>R(e,"name",{value:t,configurable:!0});import{createRequire as I}from"node:module";import{findCacheDirSync as V}from"@visulima/find-cache-dir";import{isAccessibleSync as d,ensureDirSync as y,readJsonSync as T,writeJsonSync as x}from"@visulima/fs";import{M as c,O as P,V as K,m as L,K as w,a as j,b as k}from"../packem_shared/index-OlP7U_t5.js";import{o as Se}from"../packem_shared/index-OlP7U_t5.js";import{createJiti as b}from"jiti";const $=I(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=C(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(e)}return $(e)},"__cjs_getBuiltinModule"),{createHash:_}=p("node:crypto"),{readdirSync:D,readFileSync:A,copyFileSync:M,unlinkSync:q}=p("node:fs"),{createRequire:N}=p("node:module"),{tmpdir:B}=p("node:os");var U=Object.defineProperty,a=C((e,t)=>U(e,"name",{value:t,configurable:!0}),"r");const O=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],W=new Set(O),F=["vis.task.ts","vis.task.mts","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.cjs"],z=new Set(F),J={blockExoticSubdeps:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade",trustPolicyIgnoreAfter:43200},H=a(e=>({...J,...e}),"mergeSecurityDefaults"),m=a(e=>({...e,security:H(e.security),update:{security:!0,target:"minor",...e.update}}),"applyDefaults"),Y=a(e=>{let t;try{t=D(e)}catch{return}const s=new Set(t.filter(i=>W.has(i)));for(const i of O)if(s.has(i))return c(e,i)},"findVisConfigFile"),Q=a(e=>{let t;try{t=D(e)}catch{return}const s=new Set(t.filter(i=>z.has(i)));for(const i of F)if(s.has(i))return c(e,i)},"findVisTaskConfigFile"),v=a(e=>_("sha256").update(A(e)).digest("hex"),"hashFileContents"),X=a(e=>{const t=_("sha256"),s=[...e].sort();for(const i of s)t.update(i),t.update(":"),t.update(v(i)),t.update(`
2
+ `);return t.digest("hex")},"hashConfigChain"),Z=a(e=>{const t=c(e,"node_modules");if(d(t)){const i=c(t,".cache","vis");return y(i),c(i,"vis-config-cache.json")}const s=V("vis",{create:!0,cwd:e});return s?c(s,"vis-config-cache.json"):void 0},"getConfigCachePath"),ee=a((e,t)=>{if(d(e))try{const s=T(e);if(s.hash===t)return s.config}catch{}},"readConfigCache"),te=a((e,t,s)=>{try{y(w(e)),x(e,{config:s,hash:t})}catch{}},"writeConfigCache"),se=a(e=>e===void 0?[]:Array.isArray(e)?e:[e],"normalizeExtends"),ie=a((e,t,s)=>{if(P(e))throw new k(e,[...s,t],["Absolute paths in `extends` are not supported. Use a relative path or an npm package name."]);const i=[];if(e.startsWith("./")||e.startsWith("../")){const o=w(t),n=c(o,e);if(i.push(n),d(n))return n;throw new k(e,[...s,t],i)}try{return N(t).resolve(e)}catch{throw i.push(`require.resolve("${e}") from ${t}`),new k(e,[...s,t],i)}},"resolveExtendsSpecifier"),G=a(async(e,t,s)=>{const i=v(t),o=t.slice(t.lastIndexOf(".")),n=c(B(),`vis-config-${i}${o}`);M(t,n);let r;try{r=await e.import(n,{default:!0,try:!0})??{}}catch(f){throw new j(t,s,f)}finally{try{q(n)}catch{}}try{return(typeof r=="function"?await r()??{}:r)??{}}catch(f){throw new j(t,s,f)}},"loadRawConfig"),ne=a((e,t)=>{const s={...e,...t};if(e.targetDefaults||t.targetDefaults){const i=new Set([...Object.keys(e.targetDefaults??{}),...Object.keys(t.targetDefaults??{})]),o={};for(const n of i)o[n]=L(e.targetDefaults?.[n],t.targetDefaults?.[n]);s.targetDefaults=o}return(e.taskDefaults||t.taskDefaults)&&(s.taskDefaults=[...e.taskDefaults??[],...t.taskDefaults??[]]),(e.fileGroups||t.fileGroups)&&(s.fileGroups={...e.fileGroups,...t.fileGroups}),(e.taskGroups||t.taskGroups)&&(s.taskGroups={...e.taskGroups,...t.taskGroups}),(e.security||t.security)&&(s.security={...e.security,...t.security}),(e.update||t.update)&&(s.update={...e.update,...t.update}),(e.taskRunnerOptions||t.taskRunnerOptions)&&(s.taskRunnerOptions={...e.taskRunnerOptions,...t.taskRunnerOptions}),delete s.extends,s},"mergeVisConfigs"),E=a(async(e,t,s,i,o,n)=>{if(i.has(t))throw new K(t,s);if(!o.has(t)){i.add(t);try{const r=await G(e,t,s),f=se(r.extends);for(const u of f){const g=ie(u,t,s);await E(e,g,[...s,t],i,o,n)}o.set(t,r),n.push(t)}finally{i.delete(t)}}},"resolveConfigChain"),pe=a(async(e,t)=>{let s;if(t?.explicitConfigPath){const l=P(t.explicitConfigPath)?t.explicitConfigPath:c(e,t.explicitConfigPath);if(!d(l))throw new Error(`Cannot find config file at ${l}`);s=l}else s=Y(e);if(!s)return m({});const i=b(e,{fsCache:!1,moduleCache:!1}),o=new Set,n=new Map,r=[];await E(i,s,[],o,n,r);const f=X(r),u=Z(e);if(u){const l=ee(u,f);if(l)return l}let g={};for(const l of r)g=ne(g,n.get(l));const S=m(g);return u&&te(u,f,S),S},"loadVisConfig"),ae=a(e=>e.replaceAll(/[^\w.-]+/g,"_"),"sanitizeProjectName"),oe=a((e,t)=>{const s=c(e,"node_modules"),i=ae(t);if(d(s)){const n=c(s,".cache","vis","task-configs");return y(n),c(n,`${i}.json`)}const o=V("vis",{create:!0,cwd:e});return o?c(o,"task-configs",`${i}.json`):void 0},"getVisTaskCachePath"),re=a((e,t)=>{if(d(e))try{const s=T(e);if(s.hash===t)return s.config}catch{}},"readVisTaskCache"),ce=a((e,t,s)=>{try{y(w(e)),x(e,{config:s,hash:t})}catch{}},"writeVisTaskCache"),ye=a(async(e,t,s)=>{const i=Q(t);if(!i)return;const o=v(i),n=oe(e,s);if(n){const u=re(n,o);if(u)return u}const r=b(t,{fsCache:!1,moduleCache:!1}),f=await G(r,i,[]);return n&&ce(n,o,f),f},"loadVisTaskConfig"),Ce=a(e=>e,"defineTaskConfig"),ke=a(e=>m(e),"defineConfig"),me=a(e=>e,"definePlugin");export{O as CONFIG_FILES,J as SECURITY_DEFAULTS,F as TASK_CONFIG_FILES,m as applyDefaults,ke as defineConfig,me as definePlugin,Ce as defineTaskConfig,Y as findVisConfigFile,Q as findVisTaskConfigFile,pe as loadVisConfig,ye as loadVisTaskConfig,Se as otelPlugin};