@storybook/types 8.0.0-alpha.7 → 8.0.0-alpha.9

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ReactElement, FC, ReactNode, PropsWithChildren } from 'react';
2
2
  import { FileSystemCache } from 'file-system-cache';
3
- import { TransformOptions } from '@babel/core';
4
3
  import { Router } from 'express';
5
4
  import { Server } from 'http';
6
5
  import { Channel as Channel$1 } from '@storybook/channels';
@@ -1478,1886 +1477,6 @@ declare class Channel {
1478
1477
  private onceListener;
1479
1478
  }
1480
1479
 
1481
- interface Plugin {
1482
- (module: Program): Program;
1483
- }
1484
- type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
1485
- interface JsMinifyOptions {
1486
- compress?: TerserCompressOptions | boolean;
1487
- format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
1488
- mangle?: TerserMangleOptions | boolean;
1489
- ecma?: TerserEcmaVersion;
1490
- keep_classnames?: boolean;
1491
- keep_fnames?: boolean;
1492
- module?: boolean;
1493
- safari10?: boolean;
1494
- toplevel?: boolean;
1495
- sourceMap?: boolean;
1496
- outputPath?: string;
1497
- inlineSourcesContent?: boolean;
1498
- }
1499
- /**
1500
- * @example ToSnakeCase<'indentLevel'> == 'indent_level'
1501
- */
1502
- type ToSnakeCase<T extends string> = T extends `${infer A}${infer B}` ? `${A extends Lowercase<A> ? A : `_${Lowercase<A>}`}${ToSnakeCase<B>}` : T;
1503
- /**
1504
- * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3}
1505
- */
1506
- type ToSnakeCaseProperties<T> = {
1507
- [K in keyof T as K extends string ? ToSnakeCase<K> : K]: T[K];
1508
- };
1509
- /**
1510
- * These properties are mostly not implemented yet,
1511
- * but it exists to support passing terser config to swc minify
1512
- * without modification.
1513
- */
1514
- interface JsFormatOptions {
1515
- /**
1516
- * Currently noop.
1517
- * @default false
1518
- * @alias ascii_only
1519
- */
1520
- asciiOnly?: boolean;
1521
- /**
1522
- * Currently noop.
1523
- * @default false
1524
- */
1525
- beautify?: boolean;
1526
- /**
1527
- * Currently noop.
1528
- * @default false
1529
- */
1530
- braces?: boolean;
1531
- /**
1532
- * - `false`: removes all comments
1533
- * - `'some'`: preserves some comments
1534
- * - `'all'`: preserves all comments
1535
- * @default false
1536
- */
1537
- comments?: false | "some" | "all";
1538
- /**
1539
- * Currently noop.
1540
- * @default 5
1541
- */
1542
- ecma?: TerserEcmaVersion;
1543
- /**
1544
- * Currently noop.
1545
- * @alias indent_level
1546
- */
1547
- indentLevel?: number;
1548
- /**
1549
- * Currently noop.
1550
- * @alias indent_start
1551
- */
1552
- indentStart?: number;
1553
- /**
1554
- * Currently noop.
1555
- * @alias inline_script
1556
- */
1557
- inlineScript?: number;
1558
- /**
1559
- * Currently noop.
1560
- * @alias keep_numbers
1561
- */
1562
- keepNumbers?: number;
1563
- /**
1564
- * Currently noop.
1565
- * @alias keep_quoted_props
1566
- */
1567
- keepQuotedProps?: boolean;
1568
- /**
1569
- * Currently noop.
1570
- * @alias max_line_len
1571
- */
1572
- maxLineLen?: number | false;
1573
- /**
1574
- * Currently noop.
1575
- */
1576
- preamble?: string;
1577
- /**
1578
- * Currently noop.
1579
- * @alias quote_keys
1580
- */
1581
- quoteKeys?: boolean;
1582
- /**
1583
- * Currently noop.
1584
- * @alias quote_style
1585
- */
1586
- quoteStyle?: boolean;
1587
- /**
1588
- * Currently noop.
1589
- * @alias preserve_annotations
1590
- */
1591
- preserveAnnotations?: boolean;
1592
- /**
1593
- * Currently noop.
1594
- */
1595
- safari10?: boolean;
1596
- /**
1597
- * Currently noop.
1598
- */
1599
- semicolons?: boolean;
1600
- /**
1601
- * Currently noop.
1602
- */
1603
- shebang?: boolean;
1604
- /**
1605
- * Currently noop.
1606
- */
1607
- webkit?: boolean;
1608
- /**
1609
- * Currently noop.
1610
- * @alias wrap_iife
1611
- */
1612
- wrapIife?: boolean;
1613
- /**
1614
- * Currently noop.
1615
- * @alias wrap_func_args
1616
- */
1617
- wrapFuncArgs?: boolean;
1618
- }
1619
- interface TerserCompressOptions {
1620
- arguments?: boolean;
1621
- arrows?: boolean;
1622
- booleans?: boolean;
1623
- booleans_as_integers?: boolean;
1624
- collapse_vars?: boolean;
1625
- comparisons?: boolean;
1626
- computed_props?: boolean;
1627
- conditionals?: boolean;
1628
- dead_code?: boolean;
1629
- defaults?: boolean;
1630
- directives?: boolean;
1631
- drop_console?: boolean;
1632
- drop_debugger?: boolean;
1633
- ecma?: TerserEcmaVersion;
1634
- evaluate?: boolean;
1635
- expression?: boolean;
1636
- global_defs?: any;
1637
- hoist_funs?: boolean;
1638
- hoist_props?: boolean;
1639
- hoist_vars?: boolean;
1640
- ie8?: boolean;
1641
- if_return?: boolean;
1642
- inline?: 0 | 1 | 2 | 3;
1643
- join_vars?: boolean;
1644
- keep_classnames?: boolean;
1645
- keep_fargs?: boolean;
1646
- keep_fnames?: boolean;
1647
- keep_infinity?: boolean;
1648
- loops?: boolean;
1649
- negate_iife?: boolean;
1650
- passes?: number;
1651
- properties?: boolean;
1652
- pure_getters?: any;
1653
- pure_funcs?: string[];
1654
- reduce_funcs?: boolean;
1655
- reduce_vars?: boolean;
1656
- sequences?: any;
1657
- side_effects?: boolean;
1658
- switches?: boolean;
1659
- top_retain?: any;
1660
- toplevel?: any;
1661
- typeofs?: boolean;
1662
- unsafe?: boolean;
1663
- unsafe_passes?: boolean;
1664
- unsafe_arrows?: boolean;
1665
- unsafe_comps?: boolean;
1666
- unsafe_function?: boolean;
1667
- unsafe_math?: boolean;
1668
- unsafe_symbols?: boolean;
1669
- unsafe_methods?: boolean;
1670
- unsafe_proto?: boolean;
1671
- unsafe_regexp?: boolean;
1672
- unsafe_undefined?: boolean;
1673
- unused?: boolean;
1674
- const_to_let?: boolean;
1675
- module?: boolean;
1676
- }
1677
- interface TerserMangleOptions {
1678
- props?: TerserManglePropertiesOptions;
1679
- toplevel?: boolean;
1680
- keep_classnames?: boolean;
1681
- keep_fnames?: boolean;
1682
- keep_private_props?: boolean;
1683
- ie8?: boolean;
1684
- safari10?: boolean;
1685
- reserved?: string[];
1686
- }
1687
- interface TerserManglePropertiesOptions {
1688
- }
1689
- /**
1690
- * Programmatic options.
1691
- */
1692
- interface Options$2 extends Config {
1693
- /**
1694
- * If true, a file is parsed as a script instead of module.
1695
- */
1696
- script?: boolean;
1697
- /**
1698
- * The working directory that all paths in the programmatic
1699
- * options will be resolved relative to.
1700
- *
1701
- * Defaults to `process.cwd()`.
1702
- */
1703
- cwd?: string;
1704
- caller?: CallerOptions;
1705
- /** The filename associated with the code currently being compiled,
1706
- * if there is one. The filename is optional, but not all of Swc's
1707
- * functionality is available when the filename is unknown, because a
1708
- * subset of options rely on the filename for their functionality.
1709
- *
1710
- * The three primary cases users could run into are:
1711
- *
1712
- * - The filename is exposed to plugins. Some plugins may require the
1713
- * presence of the filename.
1714
- * - Options like "test", "exclude", and "ignore" require the filename
1715
- * for string/RegExp matching.
1716
- * - .swcrc files are loaded relative to the file being compiled.
1717
- * If this option is omitted, Swc will behave as if swcrc: false has been set.
1718
- */
1719
- filename?: string;
1720
- /**
1721
- * The initial path that will be processed based on the "rootMode" to
1722
- * determine the conceptual root folder for the current Swc project.
1723
- * This is used in two primary cases:
1724
- *
1725
- * - The base directory when checking for the default "configFile" value
1726
- * - The default value for "swcrcRoots".
1727
- *
1728
- * Defaults to `opts.cwd`
1729
- */
1730
- root?: string;
1731
- /**
1732
- * This option, combined with the "root" value, defines how Swc chooses
1733
- * its project root. The different modes define different ways that Swc
1734
- * can process the "root" value to get the final project root.
1735
- *
1736
- * "root" - Passes the "root" value through as unchanged.
1737
- * "upward" - Walks upward from the "root" directory, looking for a directory
1738
- * containing a swc.config.js file, and throws an error if a swc.config.js
1739
- * is not found.
1740
- * "upward-optional" - Walk upward from the "root" directory, looking for
1741
- * a directory containing a swc.config.js file, and falls back to "root"
1742
- * if a swc.config.js is not found.
1743
- *
1744
- *
1745
- * "root" is the default mode because it avoids the risk that Swc
1746
- * will accidentally load a swc.config.js that is entirely outside
1747
- * of the current project folder. If you use "upward-optional",
1748
- * be aware that it will walk up the directory structure all the
1749
- * way to the filesystem root, and it is always possible that someone
1750
- * will have a forgotten swc.config.js in their home directory,
1751
- * which could cause unexpected errors in your builds.
1752
- *
1753
- *
1754
- * Users with monorepo project structures that run builds/tests on a
1755
- * per-package basis may well want to use "upward" since monorepos
1756
- * often have a swc.config.js in the project root. Running Swc
1757
- * in a monorepo subdirectory without "upward", will cause Swc
1758
- * to skip loading any swc.config.js files in the project root,
1759
- * which can lead to unexpected errors and compilation failure.
1760
- */
1761
- rootMode?: "root" | "upward" | "upward-optional";
1762
- /**
1763
- * The current active environment used during configuration loading.
1764
- * This value is used as the key when resolving "env" configs,
1765
- * and is also available inside configuration functions, plugins,
1766
- * and presets, via the api.env() function.
1767
- *
1768
- * Defaults to `process.env.SWC_ENV || process.env.NODE_ENV || "development"`
1769
- */
1770
- envName?: string;
1771
- /**
1772
- * Defaults to searching for a default `.swcrc` file, but can
1773
- * be passed the path of any JS or JSON5 config file.
1774
- *
1775
- *
1776
- * NOTE: This option does not affect loading of .swcrc files,
1777
- * so while it may be tempting to do configFile: "./foo/.swcrc",
1778
- * it is not recommended. If the given .swcrc is loaded via the
1779
- * standard file-relative logic, you'll end up loading the same
1780
- * config file twice, merging it with itself. If you are linking
1781
- * a specific config file, it is recommended to stick with a
1782
- * naming scheme that is independent of the "swcrc" name.
1783
- *
1784
- * Defaults to `path.resolve(opts.root, ".swcrc")`
1785
- */
1786
- configFile?: string | boolean;
1787
- /**
1788
- * true will enable searching for configuration files relative to the "filename" provided to Swc.
1789
- *
1790
- * A swcrc value passed in the programmatic options will override one set within a configuration file.
1791
- *
1792
- * Note: .swcrc files are only loaded if the current "filename" is inside of
1793
- * a package that matches one of the "swcrcRoots" packages.
1794
- *
1795
- *
1796
- * Defaults to true as long as the filename option has been specified
1797
- */
1798
- swcrc?: boolean;
1799
- /**
1800
- * By default, Babel will only search for .babelrc files within the "root" package
1801
- * because otherwise Babel cannot know if a given .babelrc is meant to be loaded,
1802
- * or if it's "plugins" and "presets" have even been installed, since the file
1803
- * being compiled could be inside node_modules, or have been symlinked into the project.
1804
- *
1805
- *
1806
- * This option allows users to provide a list of other packages that should be
1807
- * considered "root" packages when considering whether to load .babelrc files.
1808
- *
1809
- *
1810
- * For example, a monorepo setup that wishes to allow individual packages
1811
- * to have their own configs might want to do
1812
- *
1813
- *
1814
- *
1815
- * Defaults to `opts.root`
1816
- */
1817
- swcrcRoots?: boolean | MatchPattern | MatchPattern[];
1818
- /**
1819
- * `true` will attempt to load an input sourcemap from the file itself, if it
1820
- * contains a //# sourceMappingURL=... comment. If no map is found, or the
1821
- * map fails to load and parse, it will be silently discarded.
1822
- *
1823
- * If an object is provided, it will be treated as the source map object itself.
1824
- *
1825
- * Defaults to `true`.
1826
- */
1827
- inputSourceMap?: boolean | string;
1828
- /**
1829
- * The name to use for the file inside the source map object.
1830
- *
1831
- * Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`.
1832
- */
1833
- sourceFileName?: string;
1834
- /**
1835
- * The sourceRoot fields to set in the generated source map, if one is desired.
1836
- */
1837
- sourceRoot?: string;
1838
- plugin?: Plugin;
1839
- isModule?: boolean | "unknown";
1840
- /**
1841
- * Destination path. Note that this value is used only to fix source path
1842
- * of source map files and swc does not write output to this path.
1843
- */
1844
- outputPath?: string;
1845
- }
1846
- interface CallerOptions {
1847
- name: string;
1848
- [key: string]: any;
1849
- }
1850
- /**
1851
- * .swcrc
1852
- */
1853
- interface Config {
1854
- /**
1855
- * Note: The type is string because it follows rust's regex syntax.
1856
- */
1857
- test?: string | string[];
1858
- /**
1859
- * Note: The type is string because it follows rust's regex syntax.
1860
- */
1861
- exclude?: string | string[];
1862
- env?: EnvConfig;
1863
- jsc?: JscConfig;
1864
- module?: ModuleConfig;
1865
- minify?: boolean;
1866
- /**
1867
- * - true to generate a sourcemap for the code and include it in the result object.
1868
- * - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object.
1869
- *
1870
- * `swc-cli` overloads some of these to also affect how maps are written to disk:
1871
- *
1872
- * - true will write the map to a .map file on disk
1873
- * - "inline" will write the file directly, so it will have a data: containing the map
1874
- * - Note: These options are bit weird, so it may make the most sense to just use true
1875
- * and handle the rest in your own code, depending on your use case.
1876
- */
1877
- sourceMaps?: boolean | "inline";
1878
- inlineSourcesContent?: boolean;
1879
- }
1880
- /**
1881
- * Configuration ported from babel-preset-env
1882
- */
1883
- interface EnvConfig {
1884
- mode?: "usage" | "entry";
1885
- debug?: boolean;
1886
- dynamicImport?: boolean;
1887
- loose?: boolean;
1888
- skip?: string[];
1889
- include?: string[];
1890
- exclude?: string[];
1891
- /**
1892
- * The version of the used core js.
1893
- *
1894
- */
1895
- coreJs?: string;
1896
- targets?: any;
1897
- path?: string;
1898
- shippedProposals?: boolean;
1899
- /**
1900
- * Enable all transforms
1901
- */
1902
- forceAllTransforms?: boolean;
1903
- }
1904
- interface JscConfig {
1905
- loose?: boolean;
1906
- /**
1907
- * Defaults to EsParserConfig
1908
- */
1909
- parser?: ParserConfig;
1910
- transform?: TransformConfig;
1911
- /**
1912
- * Use `@swc/helpers` instead of inline helpers.
1913
- */
1914
- externalHelpers?: boolean;
1915
- /**
1916
- * Defaults to `es3` (which enabled **all** pass).
1917
- */
1918
- target?: JscTarget;
1919
- /**
1920
- * Keep class names.
1921
- */
1922
- keepClassNames?: boolean;
1923
- /**
1924
- * This is experimental, and can be removed without a major version bump.
1925
- */
1926
- experimental?: {
1927
- optimizeHygiene?: boolean;
1928
- /**
1929
- * Preserve `with` in imports and exports.
1930
- */
1931
- keepImportAttributes?: boolean;
1932
- /**
1933
- * Use `assert` instead of `with` for imports and exports.
1934
- * This option only works when `keepImportAttributes` is `true`.
1935
- */
1936
- emitAssertForImportAttributes?: boolean;
1937
- /**
1938
- * Specify the location where SWC stores its intermediate cache files.
1939
- * Currently only transform plugin uses this. If not specified, SWC will
1940
- * create `.swc` directories.
1941
- */
1942
- cacheRoot?: string;
1943
- /**
1944
- * List of custom transform plugins written in WebAssembly.
1945
- * First parameter of tuple indicates the name of the plugin - it can be either
1946
- * a name of the npm package can be resolved, or absolute path to .wasm binary.
1947
- *
1948
- * Second parameter of tuple is JSON based configuration for the plugin.
1949
- */
1950
- plugins?: Array<[string, Record<string, any>]>;
1951
- /**
1952
- * Disable builtin transforms. If enabled, only Wasm plugins are used.
1953
- */
1954
- disableBuiltinTransformsForInternalTesting?: boolean;
1955
- };
1956
- baseUrl?: string;
1957
- paths?: {
1958
- [from: string]: string[];
1959
- };
1960
- minify?: JsMinifyOptions;
1961
- preserveAllComments?: boolean;
1962
- }
1963
- type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
1964
- type ParserConfig = TsParserConfig | EsParserConfig;
1965
- interface TsParserConfig {
1966
- syntax: "typescript";
1967
- /**
1968
- * Defaults to `false`.
1969
- */
1970
- tsx?: boolean;
1971
- /**
1972
- * Defaults to `false`.
1973
- */
1974
- decorators?: boolean;
1975
- /**
1976
- * Defaults to `false`
1977
- */
1978
- dynamicImport?: boolean;
1979
- }
1980
- interface EsParserConfig {
1981
- syntax: "ecmascript";
1982
- /**
1983
- * Defaults to false.
1984
- */
1985
- jsx?: boolean;
1986
- /**
1987
- * @deprecated Always true because it's in ecmascript spec.
1988
- */
1989
- numericSeparator?: boolean;
1990
- /**
1991
- * @deprecated Always true because it's in ecmascript spec.
1992
- */
1993
- classPrivateProperty?: boolean;
1994
- /**
1995
- * @deprecated Always true because it's in ecmascript spec.
1996
- */
1997
- privateMethod?: boolean;
1998
- /**
1999
- * @deprecated Always true because it's in ecmascript spec.
2000
- */
2001
- classProperty?: boolean;
2002
- /**
2003
- * Defaults to `false`
2004
- */
2005
- functionBind?: boolean;
2006
- /**
2007
- * Defaults to `false`
2008
- */
2009
- decorators?: boolean;
2010
- /**
2011
- * Defaults to `false`
2012
- */
2013
- decoratorsBeforeExport?: boolean;
2014
- /**
2015
- * Defaults to `false`
2016
- */
2017
- exportDefaultFrom?: boolean;
2018
- /**
2019
- * @deprecated Always true because it's in ecmascript spec.
2020
- */
2021
- exportNamespaceFrom?: boolean;
2022
- /**
2023
- * @deprecated Always true because it's in ecmascript spec.
2024
- */
2025
- dynamicImport?: boolean;
2026
- /**
2027
- * @deprecated Always true because it's in ecmascript spec.
2028
- */
2029
- nullishCoalescing?: boolean;
2030
- /**
2031
- * @deprecated Always true because it's in ecmascript spec.
2032
- */
2033
- optionalChaining?: boolean;
2034
- /**
2035
- * @deprecated Always true because it's in ecmascript spec.
2036
- */
2037
- importMeta?: boolean;
2038
- /**
2039
- * @deprecated Always true because it's in ecmascript spec.
2040
- */
2041
- topLevelAwait?: boolean;
2042
- /**
2043
- * Defaults to `false`
2044
- */
2045
- importAssertions?: boolean;
2046
- }
2047
- /**
2048
- * Options for transform.
2049
- */
2050
- interface TransformConfig {
2051
- /**
2052
- * Effective only if `syntax` supports ƒ.
2053
- */
2054
- react?: ReactConfig;
2055
- constModules?: ConstModulesConfig;
2056
- /**
2057
- * Defaults to null, which skips optimizer pass.
2058
- */
2059
- optimizer?: OptimizerConfig;
2060
- /**
2061
- * https://swc.rs/docs/configuring-swc.html#jsctransformlegacydecorator
2062
- */
2063
- legacyDecorator?: boolean;
2064
- /**
2065
- * https://swc.rs/docs/configuring-swc.html#jsctransformdecoratormetadata
2066
- */
2067
- decoratorMetadata?: boolean;
2068
- treatConstEnumAsEnum?: boolean;
2069
- useDefineForClassFields?: boolean;
2070
- }
2071
- interface ReactConfig {
2072
- /**
2073
- * Replace the function used when compiling JSX expressions.
2074
- *
2075
- * Defaults to `React.createElement`.
2076
- */
2077
- pragma?: string;
2078
- /**
2079
- * Replace the component used when compiling JSX fragments.
2080
- *
2081
- * Defaults to `React.Fragment`
2082
- */
2083
- pragmaFrag?: string;
2084
- /**
2085
- * Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:
2086
- * `<f:image />`
2087
- *
2088
- * Though the JSX spec allows this, it is disabled by default since React's
2089
- * JSX does not currently have support for it.
2090
- *
2091
- */
2092
- throwIfNamespace?: boolean;
2093
- /**
2094
- * Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self
2095
- * and @swc/plugin-transform-react-jsx-source.
2096
- *
2097
- * Defaults to `false`,
2098
- *
2099
- */
2100
- development?: boolean;
2101
- /**
2102
- * Use `Object.assign()` instead of `_extends`. Defaults to false.
2103
- * @deprecated
2104
- */
2105
- useBuiltins?: boolean;
2106
- /**
2107
- * Enable fast refresh feature for React app
2108
- */
2109
- refresh?: boolean;
2110
- /**
2111
- * jsx runtime
2112
- */
2113
- runtime?: "automatic" | "classic";
2114
- /**
2115
- * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
2116
- */
2117
- importSource?: string;
2118
- }
2119
- /**
2120
- * - `import { DEBUG } from '@ember/env-flags';`
2121
- * - `import { FEATURE_A, FEATURE_B } from '@ember/features';`
2122
- *
2123
- * See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558
2124
- */
2125
- interface ConstModulesConfig {
2126
- globals?: {
2127
- [module: string]: {
2128
- [name: string]: string;
2129
- };
2130
- };
2131
- }
2132
- interface OptimizerConfig {
2133
- simplify?: boolean;
2134
- globals?: GlobalPassOption;
2135
- jsonify?: {
2136
- minCost: number;
2137
- };
2138
- }
2139
- /**
2140
- * Options for inline-global pass.
2141
- */
2142
- interface GlobalPassOption {
2143
- /**
2144
- * Global variables that should be inlined with passed value.
2145
- *
2146
- * e.g. `{ __DEBUG__: true }`
2147
- */
2148
- vars?: Record<string, string>;
2149
- /**
2150
- * Names of environment variables that should be inlined with the value of corresponding env during build.
2151
- *
2152
- * Defaults to `["NODE_ENV", "SWC_ENV"]`
2153
- */
2154
- envs?: string[];
2155
- /**
2156
- * Replaces typeof calls for passed variables with corresponding value
2157
- *
2158
- * e.g. `{ window: 'object' }`
2159
- */
2160
- typeofs?: Record<string, string>;
2161
- }
2162
- type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
2163
- interface BaseModuleConfig {
2164
- /**
2165
- * By default, when using exports with babel a non-enumerable `__esModule`
2166
- * property is exported. In some cases this property is used to determine
2167
- * if the import is the default export or if it contains the default export.
2168
- *
2169
- * In order to prevent the __esModule property from being exported, you
2170
- * can set the strict option to true.
2171
- *
2172
- * Defaults to `false`.
2173
- */
2174
- strict?: boolean;
2175
- /**
2176
- * Emits 'use strict' directive.
2177
- *
2178
- * Defaults to `true`.
2179
- */
2180
- strictMode?: boolean;
2181
- /**
2182
- * Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.
2183
- *
2184
- * This can improve initial load time of your module because evaluating dependencies up
2185
- * front is sometimes entirely un-necessary. This is especially the case when implementing
2186
- * a library module.
2187
- *
2188
- *
2189
- * The value of `lazy` has a few possible effects:
2190
- *
2191
- * - `false` - No lazy initialization of any imported module.
2192
- * - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies.
2193
- *
2194
- * Local paths are much more likely to have circular dependencies, which may break if loaded lazily,
2195
- * so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical.
2196
- *
2197
- * - `Array<string>` - Lazy-initialize all imports with source matching one of the given strings.
2198
- *
2199
- * -----
2200
- *
2201
- * The two cases where imports can never be lazy are:
2202
- *
2203
- * - `import "foo";`
2204
- *
2205
- * Side-effect imports are automatically non-lazy since their very existence means
2206
- * that there is no binding to later kick off initialization.
2207
- *
2208
- * - `export * from "foo"`
2209
- *
2210
- * Re-exporting all names requires up-front execution because otherwise there is no
2211
- * way to know what names need to be exported.
2212
- *
2213
- * Defaults to `false`.
2214
- */
2215
- lazy?: boolean | string[];
2216
- /**
2217
- * @deprecated Use the `importInterop` option instead.
2218
- *
2219
- * By default, when using exports with swc a non-enumerable __esModule property is exported.
2220
- * This property is then used to determine if the import is the default export or if
2221
- * it contains the default export.
2222
- *
2223
- * In cases where the auto-unwrapping of default is not needed, you can set the noInterop option
2224
- * to true to avoid the usage of the interopRequireDefault helper (shown in inline form above).
2225
- *
2226
- * Defaults to `false`.
2227
- */
2228
- noInterop?: boolean;
2229
- /**
2230
- * Defaults to `swc`.
2231
- *
2232
- * CommonJS modules and ECMAScript modules are not fully compatible.
2233
- * However, compilers, bundlers and JavaScript runtimes developed different strategies
2234
- * to make them work together as well as possible.
2235
- *
2236
- * - `swc` (alias: `babel`)
2237
- *
2238
- * When using exports with `swc` a non-enumerable `__esModule` property is exported
2239
- * This property is then used to determine if the import is the default export
2240
- * or if it contains the default export.
2241
- *
2242
- * ```javascript
2243
- * import foo from "foo";
2244
- * import { bar } from "bar";
2245
- * foo;
2246
- * bar;
2247
- *
2248
- * // Is compiled to ...
2249
- *
2250
- * "use strict";
2251
- *
2252
- * function _interop_require_default(obj) {
2253
- * return obj && obj.__esModule ? obj : { default: obj };
2254
- * }
2255
- *
2256
- * var _foo = _interop_require_default(require("foo"));
2257
- * var _bar = require("bar");
2258
- *
2259
- * _foo.default;
2260
- * _bar.bar;
2261
- * ```
2262
- *
2263
- * When this import interop is used, if both the imported and the importer module are compiled
2264
- * with swc they behave as if none of them was compiled.
2265
- *
2266
- * This is the default behavior.
2267
- *
2268
- * - `node`
2269
- *
2270
- * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
2271
- * Node.js always binds the `default` export to the value of `module.exports`.
2272
- *
2273
- * ```javascript
2274
- * import foo from "foo";
2275
- * import { bar } from "bar";
2276
- * foo;
2277
- * bar;
2278
- *
2279
- * // Is compiled to ...
2280
- *
2281
- * "use strict";
2282
- *
2283
- * var _foo = require("foo");
2284
- * var _bar = require("bar");
2285
- *
2286
- * _foo;
2287
- * _bar.bar;
2288
- * ```
2289
- * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
2290
- * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
2291
- * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
2292
- *
2293
- * - `none`
2294
- *
2295
- * If you know that the imported file has been transformed with a compiler that stores the `default` export on
2296
- * `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
2297
- *
2298
- * ```javascript
2299
- * import foo from "foo";
2300
- * import { bar } from "bar";
2301
- * foo;
2302
- * bar;
2303
- *
2304
- * // Is compiled to ...
2305
- *
2306
- * "use strict";
2307
- *
2308
- * var _foo = require("foo");
2309
- * var _bar = require("bar");
2310
- *
2311
- * _foo.default;
2312
- * _bar.bar;
2313
- * ```
2314
- */
2315
- importInterop?: "swc" | "babel" | "node" | "none";
2316
- /**
2317
- * Emits `cjs-module-lexer` annotation
2318
- * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
2319
- * swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
2320
- *
2321
- * Defaults to `true` if import_interop is Node, else `false`
2322
- */
2323
- exportInteropAnnotation?: boolean;
2324
- /**
2325
- * If set to true, dynamic imports will be preserved.
2326
- */
2327
- ignoreDynamic?: boolean;
2328
- allowTopLevelThis?: boolean;
2329
- preserveImportMeta?: boolean;
2330
- }
2331
- interface Es6Config extends BaseModuleConfig {
2332
- type: "es6";
2333
- }
2334
- interface NodeNextConfig extends BaseModuleConfig {
2335
- type: "nodenext";
2336
- }
2337
- interface CommonJsConfig extends BaseModuleConfig {
2338
- type: "commonjs";
2339
- }
2340
- interface UmdConfig extends BaseModuleConfig {
2341
- type: "umd";
2342
- globals?: {
2343
- [key: string]: string;
2344
- };
2345
- }
2346
- interface AmdConfig extends BaseModuleConfig {
2347
- type: "amd";
2348
- moduleId?: string;
2349
- }
2350
- interface SystemjsConfig {
2351
- type: "systemjs";
2352
- allowTopLevelThis?: boolean;
2353
- }
2354
- interface MatchPattern {
2355
- }
2356
- interface Span {
2357
- start: number;
2358
- end: number;
2359
- ctxt: number;
2360
- }
2361
- interface Node {
2362
- type: string;
2363
- }
2364
- interface HasSpan {
2365
- span: Span;
2366
- }
2367
- interface HasDecorator {
2368
- decorators?: Decorator[];
2369
- }
2370
- interface Class extends HasSpan, HasDecorator {
2371
- body: ClassMember[];
2372
- superClass?: Expression;
2373
- isAbstract: boolean;
2374
- typeParams?: TsTypeParameterDeclaration;
2375
- superTypeParams?: TsTypeParameterInstantiation;
2376
- implements: TsExpressionWithTypeArguments[];
2377
- }
2378
- type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature | EmptyStatement | StaticBlock;
2379
- interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
2380
- value?: Expression;
2381
- typeAnnotation?: TsTypeAnnotation;
2382
- isStatic: boolean;
2383
- accessibility?: Accessibility;
2384
- isOptional: boolean;
2385
- isOverride: boolean;
2386
- readonly: boolean;
2387
- definite: boolean;
2388
- }
2389
- interface ClassProperty extends ClassPropertyBase {
2390
- type: "ClassProperty";
2391
- key: PropertyName;
2392
- isAbstract: boolean;
2393
- declare: boolean;
2394
- }
2395
- interface PrivateProperty extends ClassPropertyBase {
2396
- type: "PrivateProperty";
2397
- key: PrivateName;
2398
- }
2399
- interface Param extends Node, HasSpan, HasDecorator {
2400
- type: "Parameter";
2401
- pat: Pattern;
2402
- }
2403
- interface Constructor extends Node, HasSpan {
2404
- type: "Constructor";
2405
- key: PropertyName;
2406
- params: (TsParameterProperty | Param)[];
2407
- body?: BlockStatement;
2408
- accessibility?: Accessibility;
2409
- isOptional: boolean;
2410
- }
2411
- interface ClassMethodBase extends Node, HasSpan {
2412
- function: Fn;
2413
- kind: MethodKind;
2414
- isStatic: boolean;
2415
- accessibility?: Accessibility;
2416
- isAbstract: boolean;
2417
- isOptional: boolean;
2418
- isOverride: boolean;
2419
- }
2420
- interface ClassMethod extends ClassMethodBase {
2421
- type: "ClassMethod";
2422
- key: PropertyName;
2423
- }
2424
- interface PrivateMethod extends ClassMethodBase {
2425
- type: "PrivateMethod";
2426
- key: PrivateName;
2427
- }
2428
- interface StaticBlock extends Node, HasSpan {
2429
- type: "StaticBlock";
2430
- body: BlockStatement;
2431
- }
2432
- interface Decorator extends Node, HasSpan {
2433
- type: "Decorator";
2434
- expression: Expression;
2435
- }
2436
- type MethodKind = "method" | "getter" | "setter";
2437
- type Declaration = ClassDeclaration | FunctionDeclaration | VariableDeclaration | TsInterfaceDeclaration | TsTypeAliasDeclaration | TsEnumDeclaration | TsModuleDeclaration;
2438
- interface FunctionDeclaration extends Fn {
2439
- type: "FunctionDeclaration";
2440
- identifier: Identifier;
2441
- declare: boolean;
2442
- }
2443
- interface ClassDeclaration extends Class, Node {
2444
- type: "ClassDeclaration";
2445
- identifier: Identifier;
2446
- declare: boolean;
2447
- }
2448
- interface VariableDeclaration extends Node, HasSpan {
2449
- type: "VariableDeclaration";
2450
- kind: VariableDeclarationKind;
2451
- declare: boolean;
2452
- declarations: VariableDeclarator[];
2453
- }
2454
- type VariableDeclarationKind = "var" | "let" | "const";
2455
- interface VariableDeclarator extends Node, HasSpan {
2456
- type: "VariableDeclarator";
2457
- id: Pattern;
2458
- init?: Expression;
2459
- definite: boolean;
2460
- }
2461
- type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | TsSatisfiesExpression | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
2462
- interface ExpressionBase extends Node, HasSpan {
2463
- }
2464
- interface Identifier extends ExpressionBase {
2465
- type: "Identifier";
2466
- value: string;
2467
- optional: boolean;
2468
- }
2469
- interface OptionalChainingExpression extends ExpressionBase {
2470
- type: "OptionalChainingExpression";
2471
- questionDotToken: Span;
2472
- /**
2473
- * Call expression or member expression.
2474
- */
2475
- base: MemberExpression | OptionalChainingCall;
2476
- }
2477
- interface OptionalChainingCall extends ExpressionBase {
2478
- type: "CallExpression";
2479
- callee: Expression;
2480
- arguments: ExprOrSpread[];
2481
- typeArguments?: TsTypeParameterInstantiation;
2482
- }
2483
- interface ThisExpression extends ExpressionBase {
2484
- type: "ThisExpression";
2485
- }
2486
- interface ArrayExpression extends ExpressionBase {
2487
- type: "ArrayExpression";
2488
- elements: (ExprOrSpread | undefined)[];
2489
- }
2490
- interface ExprOrSpread {
2491
- spread?: Span;
2492
- expression: Expression;
2493
- }
2494
- interface ObjectExpression extends ExpressionBase {
2495
- type: "ObjectExpression";
2496
- properties: (SpreadElement | Property)[];
2497
- }
2498
- interface Argument {
2499
- spread?: Span;
2500
- expression: Expression;
2501
- }
2502
- interface SpreadElement extends Node {
2503
- type: "SpreadElement";
2504
- spread: Span;
2505
- arguments: Expression;
2506
- }
2507
- interface UnaryExpression extends ExpressionBase {
2508
- type: "UnaryExpression";
2509
- operator: UnaryOperator;
2510
- argument: Expression;
2511
- }
2512
- interface UpdateExpression extends ExpressionBase {
2513
- type: "UpdateExpression";
2514
- operator: UpdateOperator;
2515
- prefix: boolean;
2516
- argument: Expression;
2517
- }
2518
- interface BinaryExpression extends ExpressionBase {
2519
- type: "BinaryExpression";
2520
- operator: BinaryOperator;
2521
- left: Expression;
2522
- right: Expression;
2523
- }
2524
- interface FunctionExpression extends Fn, ExpressionBase {
2525
- type: "FunctionExpression";
2526
- identifier?: Identifier;
2527
- }
2528
- interface ClassExpression extends Class, ExpressionBase {
2529
- type: "ClassExpression";
2530
- identifier?: Identifier;
2531
- }
2532
- interface AssignmentExpression extends ExpressionBase {
2533
- type: "AssignmentExpression";
2534
- operator: AssignmentOperator;
2535
- left: Expression | Pattern;
2536
- right: Expression;
2537
- }
2538
- interface MemberExpression extends ExpressionBase {
2539
- type: "MemberExpression";
2540
- object: Expression;
2541
- property: Identifier | PrivateName | ComputedPropName;
2542
- }
2543
- interface SuperPropExpression extends ExpressionBase {
2544
- type: "SuperPropExpression";
2545
- obj: Super;
2546
- property: Identifier | ComputedPropName;
2547
- }
2548
- interface ConditionalExpression extends ExpressionBase {
2549
- type: "ConditionalExpression";
2550
- test: Expression;
2551
- consequent: Expression;
2552
- alternate: Expression;
2553
- }
2554
- interface Super extends Node, HasSpan {
2555
- type: "Super";
2556
- }
2557
- interface Import extends Node, HasSpan {
2558
- type: "Import";
2559
- }
2560
- interface CallExpression extends ExpressionBase {
2561
- type: "CallExpression";
2562
- callee: Super | Import | Expression;
2563
- arguments: Argument[];
2564
- typeArguments?: TsTypeParameterInstantiation;
2565
- }
2566
- interface NewExpression extends ExpressionBase {
2567
- type: "NewExpression";
2568
- callee: Expression;
2569
- arguments?: Argument[];
2570
- typeArguments?: TsTypeParameterInstantiation;
2571
- }
2572
- interface SequenceExpression extends ExpressionBase {
2573
- type: "SequenceExpression";
2574
- expressions: Expression[];
2575
- }
2576
- interface ArrowFunctionExpression extends ExpressionBase {
2577
- type: "ArrowFunctionExpression";
2578
- params: Pattern[];
2579
- body: BlockStatement | Expression;
2580
- async: boolean;
2581
- generator: boolean;
2582
- typeParameters?: TsTypeParameterDeclaration;
2583
- returnType?: TsTypeAnnotation;
2584
- }
2585
- interface YieldExpression extends ExpressionBase {
2586
- type: "YieldExpression";
2587
- argument?: Expression;
2588
- delegate: boolean;
2589
- }
2590
- interface MetaProperty extends Node, HasSpan {
2591
- type: "MetaProperty";
2592
- kind: "new.target" | "import.meta";
2593
- }
2594
- interface AwaitExpression extends ExpressionBase {
2595
- type: "AwaitExpression";
2596
- argument: Expression;
2597
- }
2598
- interface TemplateLiteral extends ExpressionBase {
2599
- type: "TemplateLiteral";
2600
- expressions: Expression[];
2601
- quasis: TemplateElement[];
2602
- }
2603
- interface TaggedTemplateExpression extends ExpressionBase {
2604
- type: "TaggedTemplateExpression";
2605
- tag: Expression;
2606
- typeParameters?: TsTypeParameterInstantiation;
2607
- template: TemplateLiteral;
2608
- }
2609
- interface TemplateElement extends ExpressionBase {
2610
- type: "TemplateElement";
2611
- tail: boolean;
2612
- cooked?: string;
2613
- raw: string;
2614
- }
2615
- interface ParenthesisExpression extends ExpressionBase {
2616
- type: "ParenthesisExpression";
2617
- expression: Expression;
2618
- }
2619
- interface Fn extends HasSpan, HasDecorator {
2620
- params: Param[];
2621
- body?: BlockStatement;
2622
- generator: boolean;
2623
- async: boolean;
2624
- typeParameters?: TsTypeParameterDeclaration;
2625
- returnType?: TsTypeAnnotation;
2626
- }
2627
- interface PatternBase extends Node, HasSpan {
2628
- typeAnnotation?: TsTypeAnnotation;
2629
- }
2630
- interface PrivateName extends ExpressionBase {
2631
- type: "PrivateName";
2632
- id: Identifier;
2633
- }
2634
- type JSXObject = JSXMemberExpression | Identifier;
2635
- interface JSXMemberExpression extends Node {
2636
- type: "JSXMemberExpression";
2637
- object: JSXObject;
2638
- property: Identifier;
2639
- }
2640
- /**
2641
- * XML-based namespace syntax:
2642
- */
2643
- interface JSXNamespacedName extends Node {
2644
- type: "JSXNamespacedName";
2645
- namespace: Identifier;
2646
- name: Identifier;
2647
- }
2648
- interface JSXEmptyExpression extends Node, HasSpan {
2649
- type: "JSXEmptyExpression";
2650
- }
2651
- interface JSXExpressionContainer extends Node, HasSpan {
2652
- type: "JSXExpressionContainer";
2653
- expression: JSXExpression;
2654
- }
2655
- type JSXExpression = JSXEmptyExpression | Expression;
2656
- interface JSXSpreadChild extends Node, HasSpan {
2657
- type: "JSXSpreadChild";
2658
- expression: Expression;
2659
- }
2660
- type JSXElementName = Identifier | JSXMemberExpression | JSXNamespacedName;
2661
- interface JSXOpeningElement extends Node, HasSpan {
2662
- type: "JSXOpeningElement";
2663
- name: JSXElementName;
2664
- attributes: JSXAttributeOrSpread[];
2665
- selfClosing: boolean;
2666
- typeArguments?: TsTypeParameterInstantiation;
2667
- }
2668
- type JSXAttributeOrSpread = JSXAttribute | SpreadElement;
2669
- interface JSXClosingElement extends Node, HasSpan {
2670
- type: "JSXClosingElement";
2671
- name: JSXElementName;
2672
- }
2673
- interface JSXAttribute extends Node, HasSpan {
2674
- type: "JSXAttribute";
2675
- name: JSXAttributeName;
2676
- value?: JSXAttrValue;
2677
- }
2678
- type JSXAttributeName = Identifier | JSXNamespacedName;
2679
- type JSXAttrValue = Literal | JSXExpressionContainer | JSXElement | JSXFragment;
2680
- interface JSXText extends Node, HasSpan {
2681
- type: "JSXText";
2682
- value: string;
2683
- raw: string;
2684
- }
2685
- interface JSXElement extends Node, HasSpan {
2686
- type: "JSXElement";
2687
- opening: JSXOpeningElement;
2688
- children: JSXElementChild[];
2689
- closing?: JSXClosingElement;
2690
- }
2691
- type JSXElementChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
2692
- interface JSXFragment extends Node, HasSpan {
2693
- type: "JSXFragment";
2694
- opening: JSXOpeningFragment;
2695
- children: JSXElementChild[];
2696
- closing: JSXClosingFragment;
2697
- }
2698
- interface JSXOpeningFragment extends Node, HasSpan {
2699
- type: "JSXOpeningFragment";
2700
- }
2701
- interface JSXClosingFragment extends Node, HasSpan {
2702
- type: "JSXClosingFragment";
2703
- }
2704
- type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | JSXText;
2705
- interface StringLiteral extends Node, HasSpan {
2706
- type: "StringLiteral";
2707
- value: string;
2708
- raw?: string;
2709
- }
2710
- interface BooleanLiteral extends Node, HasSpan {
2711
- type: "BooleanLiteral";
2712
- value: boolean;
2713
- }
2714
- interface NullLiteral extends Node, HasSpan {
2715
- type: "NullLiteral";
2716
- }
2717
- interface RegExpLiteral extends Node, HasSpan {
2718
- type: "RegExpLiteral";
2719
- pattern: string;
2720
- flags: string;
2721
- }
2722
- interface NumericLiteral extends Node, HasSpan {
2723
- type: "NumericLiteral";
2724
- value: number;
2725
- raw?: string;
2726
- }
2727
- interface BigIntLiteral extends Node, HasSpan {
2728
- type: "BigIntLiteral";
2729
- value: bigint;
2730
- raw?: string;
2731
- }
2732
- type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
2733
- interface ExportDefaultExpression extends Node, HasSpan {
2734
- type: "ExportDefaultExpression";
2735
- expression: Expression;
2736
- }
2737
- interface ExportDeclaration extends Node, HasSpan {
2738
- type: "ExportDeclaration";
2739
- declaration: Declaration;
2740
- }
2741
- interface ImportDeclaration extends Node, HasSpan {
2742
- type: "ImportDeclaration";
2743
- specifiers: ImportSpecifier[];
2744
- source: StringLiteral;
2745
- typeOnly: boolean;
2746
- asserts?: ObjectExpression;
2747
- }
2748
- interface ExportAllDeclaration extends Node, HasSpan {
2749
- type: "ExportAllDeclaration";
2750
- source: StringLiteral;
2751
- asserts?: ObjectExpression;
2752
- }
2753
- /**
2754
- * - `export { foo } from 'mod'`
2755
- * - `export { foo as bar } from 'mod'`
2756
- */
2757
- interface ExportNamedDeclaration extends Node, HasSpan {
2758
- type: "ExportNamedDeclaration";
2759
- specifiers: ExportSpecifier[];
2760
- source?: StringLiteral;
2761
- typeOnly: boolean;
2762
- asserts?: ObjectExpression;
2763
- }
2764
- interface ExportDefaultDeclaration extends Node, HasSpan {
2765
- type: "ExportDefaultDeclaration";
2766
- decl: DefaultDecl;
2767
- }
2768
- type DefaultDecl = ClassExpression | FunctionExpression | TsInterfaceDeclaration;
2769
- type ImportSpecifier = NamedImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
2770
- /**
2771
- * e.g. `import foo from 'mod.js'`
2772
- */
2773
- interface ImportDefaultSpecifier extends Node, HasSpan {
2774
- type: "ImportDefaultSpecifier";
2775
- local: Identifier;
2776
- }
2777
- /**
2778
- * e.g. `import * as foo from 'mod.js'`.
2779
- */
2780
- interface ImportNamespaceSpecifier extends Node, HasSpan {
2781
- type: "ImportNamespaceSpecifier";
2782
- local: Identifier;
2783
- }
2784
- /**
2785
- * e.g. - `import { foo } from 'mod.js'`
2786
- *
2787
- * local = foo, imported = None
2788
- *
2789
- * e.g. `import { foo as bar } from 'mod.js'`
2790
- *
2791
- * local = bar, imported = Some(foo) for
2792
- */
2793
- interface NamedImportSpecifier extends Node, HasSpan {
2794
- type: "ImportSpecifier";
2795
- local: Identifier;
2796
- imported?: ModuleExportName;
2797
- isTypeOnly: boolean;
2798
- }
2799
- type ModuleExportName = Identifier | StringLiteral;
2800
- type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
2801
- /**
2802
- * `export * as foo from 'src';`
2803
- */
2804
- interface ExportNamespaceSpecifier extends Node, HasSpan {
2805
- type: "ExportNamespaceSpecifier";
2806
- name: ModuleExportName;
2807
- }
2808
- interface ExportDefaultSpecifier extends Node, HasSpan {
2809
- type: "ExportDefaultSpecifier";
2810
- exported: Identifier;
2811
- }
2812
- interface NamedExportSpecifier extends Node, HasSpan {
2813
- type: "ExportSpecifier";
2814
- orig: ModuleExportName;
2815
- /**
2816
- * `Some(bar)` in `export { foo as bar }`
2817
- */
2818
- exported?: ModuleExportName;
2819
- isTypeOnly: boolean;
2820
- }
2821
- interface HasInterpreter {
2822
- /**
2823
- * e.g. `/usr/bin/node` for `#!/usr/bin/node`
2824
- */
2825
- interpreter: string;
2826
- }
2827
- type Program = Module | Script;
2828
- interface Module extends Node, HasSpan, HasInterpreter {
2829
- type: "Module";
2830
- body: ModuleItem[];
2831
- }
2832
- interface Script extends Node, HasSpan, HasInterpreter {
2833
- type: "Script";
2834
- body: Statement[];
2835
- }
2836
- type ModuleItem = ModuleDeclaration | Statement;
2837
- type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "||" | "&&" | "in" | "instanceof" | "**" | "??";
2838
- type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "&&=" | "||=" | "??=";
2839
- type UpdateOperator = "++" | "--";
2840
- type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
2841
- type Pattern = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern | AssignmentPattern | Invalid | Expression;
2842
- interface BindingIdentifier extends PatternBase {
2843
- type: "Identifier";
2844
- value: string;
2845
- optional: boolean;
2846
- }
2847
- interface ArrayPattern extends PatternBase {
2848
- type: "ArrayPattern";
2849
- elements: (Pattern | undefined)[];
2850
- optional: boolean;
2851
- }
2852
- interface ObjectPattern extends PatternBase {
2853
- type: "ObjectPattern";
2854
- properties: ObjectPatternProperty[];
2855
- optional: boolean;
2856
- }
2857
- interface AssignmentPattern extends PatternBase {
2858
- type: "AssignmentPattern";
2859
- left: Pattern;
2860
- right: Expression;
2861
- }
2862
- interface RestElement extends PatternBase {
2863
- type: "RestElement";
2864
- rest: Span;
2865
- argument: Pattern;
2866
- }
2867
- type ObjectPatternProperty = KeyValuePatternProperty | AssignmentPatternProperty | RestElement;
2868
- /**
2869
- * `{key: value}`
2870
- */
2871
- interface KeyValuePatternProperty extends Node {
2872
- type: "KeyValuePatternProperty";
2873
- key: PropertyName;
2874
- value: Pattern;
2875
- }
2876
- /**
2877
- * `{key}` or `{key = value}`
2878
- */
2879
- interface AssignmentPatternProperty extends Node, HasSpan {
2880
- type: "AssignmentPatternProperty";
2881
- key: Identifier;
2882
- value?: Expression;
2883
- }
2884
- /** Identifier is `a` in `{ a, }` */
2885
- type Property = Identifier | KeyValueProperty | AssignmentProperty | GetterProperty | SetterProperty | MethodProperty;
2886
- interface PropBase extends Node {
2887
- key: PropertyName;
2888
- }
2889
- interface KeyValueProperty extends PropBase {
2890
- type: "KeyValueProperty";
2891
- value: Expression;
2892
- }
2893
- interface AssignmentProperty extends Node {
2894
- type: "AssignmentProperty";
2895
- key: Identifier;
2896
- value: Expression;
2897
- }
2898
- interface GetterProperty extends PropBase, HasSpan {
2899
- type: "GetterProperty";
2900
- typeAnnotation?: TsTypeAnnotation;
2901
- body?: BlockStatement;
2902
- }
2903
- interface SetterProperty extends PropBase, HasSpan {
2904
- type: "SetterProperty";
2905
- param: Pattern;
2906
- body?: BlockStatement;
2907
- }
2908
- interface MethodProperty extends PropBase, Fn {
2909
- type: "MethodProperty";
2910
- }
2911
- type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName | BigIntLiteral;
2912
- interface ComputedPropName extends Node, HasSpan {
2913
- type: "Computed";
2914
- expression: Expression;
2915
- }
2916
- interface BlockStatement extends Node, HasSpan {
2917
- type: "BlockStatement";
2918
- stmts: Statement[];
2919
- }
2920
- interface ExpressionStatement extends Node, HasSpan {
2921
- type: "ExpressionStatement";
2922
- expression: Expression;
2923
- }
2924
- type Statement = BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration | ExpressionStatement;
2925
- interface EmptyStatement extends Node, HasSpan {
2926
- type: "EmptyStatement";
2927
- }
2928
- interface DebuggerStatement extends Node, HasSpan {
2929
- type: "DebuggerStatement";
2930
- }
2931
- interface WithStatement extends Node, HasSpan {
2932
- type: "WithStatement";
2933
- object: Expression;
2934
- body: Statement;
2935
- }
2936
- interface ReturnStatement extends Node, HasSpan {
2937
- type: "ReturnStatement";
2938
- argument?: Expression;
2939
- }
2940
- interface LabeledStatement extends Node, HasSpan {
2941
- type: "LabeledStatement";
2942
- label: Identifier;
2943
- body: Statement;
2944
- }
2945
- interface BreakStatement extends Node, HasSpan {
2946
- type: "BreakStatement";
2947
- label?: Identifier;
2948
- }
2949
- interface ContinueStatement extends Node, HasSpan {
2950
- type: "ContinueStatement";
2951
- label?: Identifier;
2952
- }
2953
- interface IfStatement extends Node, HasSpan {
2954
- type: "IfStatement";
2955
- test: Expression;
2956
- consequent: Statement;
2957
- alternate?: Statement;
2958
- }
2959
- interface SwitchStatement extends Node, HasSpan {
2960
- type: "SwitchStatement";
2961
- discriminant: Expression;
2962
- cases: SwitchCase[];
2963
- }
2964
- interface ThrowStatement extends Node, HasSpan {
2965
- type: "ThrowStatement";
2966
- argument: Expression;
2967
- }
2968
- interface TryStatement extends Node, HasSpan {
2969
- type: "TryStatement";
2970
- block: BlockStatement;
2971
- handler?: CatchClause;
2972
- finalizer?: BlockStatement;
2973
- }
2974
- interface WhileStatement extends Node, HasSpan {
2975
- type: "WhileStatement";
2976
- test: Expression;
2977
- body: Statement;
2978
- }
2979
- interface DoWhileStatement extends Node, HasSpan {
2980
- type: "DoWhileStatement";
2981
- test: Expression;
2982
- body: Statement;
2983
- }
2984
- interface ForStatement extends Node, HasSpan {
2985
- type: "ForStatement";
2986
- init?: VariableDeclaration | Expression;
2987
- test?: Expression;
2988
- update?: Expression;
2989
- body: Statement;
2990
- }
2991
- interface ForInStatement extends Node, HasSpan {
2992
- type: "ForInStatement";
2993
- left: VariableDeclaration | Pattern;
2994
- right: Expression;
2995
- body: Statement;
2996
- }
2997
- interface ForOfStatement extends Node, HasSpan {
2998
- type: "ForOfStatement";
2999
- /**
3000
- * Span of the await token.
3001
- *
3002
- * es2018 for-await-of statements, e.g., `for await (const x of xs) {`
3003
- */
3004
- await?: Span;
3005
- left: VariableDeclaration | Pattern;
3006
- right: Expression;
3007
- body: Statement;
3008
- }
3009
- interface SwitchCase extends Node, HasSpan {
3010
- type: "SwitchCase";
3011
- /**
3012
- * Undefined for default case
3013
- */
3014
- test?: Expression;
3015
- consequent: Statement[];
3016
- }
3017
- interface CatchClause extends Node, HasSpan {
3018
- type: "CatchClause";
3019
- /**
3020
- * The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}`
3021
- */
3022
- param?: Pattern;
3023
- body: BlockStatement;
3024
- }
3025
- interface TsTypeAnnotation extends Node, HasSpan {
3026
- type: "TsTypeAnnotation";
3027
- typeAnnotation: TsType;
3028
- }
3029
- interface TsTypeParameterDeclaration extends Node, HasSpan {
3030
- type: "TsTypeParameterDeclaration";
3031
- parameters: TsTypeParameter[];
3032
- }
3033
- interface TsTypeParameter extends Node, HasSpan {
3034
- type: "TsTypeParameter";
3035
- name: Identifier;
3036
- in: boolean;
3037
- out: boolean;
3038
- constraint?: TsType;
3039
- default?: TsType;
3040
- }
3041
- interface TsTypeParameterInstantiation extends Node, HasSpan {
3042
- type: "TsTypeParameterInstantiation";
3043
- params: TsType[];
3044
- }
3045
- interface TsParameterProperty extends Node, HasSpan, HasDecorator {
3046
- type: "TsParameterProperty";
3047
- accessibility?: Accessibility;
3048
- override: boolean;
3049
- readonly: boolean;
3050
- param: TsParameterPropertyParameter;
3051
- }
3052
- type TsParameterPropertyParameter = BindingIdentifier | AssignmentPattern;
3053
- interface TsQualifiedName extends Node {
3054
- type: "TsQualifiedName";
3055
- left: TsEntityName;
3056
- right: Identifier;
3057
- }
3058
- type TsEntityName = TsQualifiedName | Identifier;
3059
- type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsGetterSignature | TsSetterSignature | TsMethodSignature | TsIndexSignature;
3060
- interface TsCallSignatureDeclaration extends Node, HasSpan {
3061
- type: "TsCallSignatureDeclaration";
3062
- params: TsFnParameter[];
3063
- typeAnnotation?: TsTypeAnnotation;
3064
- typeParams?: TsTypeParameterDeclaration;
3065
- }
3066
- interface TsConstructSignatureDeclaration extends Node, HasSpan {
3067
- type: "TsConstructSignatureDeclaration";
3068
- params: TsFnParameter[];
3069
- typeAnnotation?: TsTypeAnnotation;
3070
- typeParams?: TsTypeParameterDeclaration;
3071
- }
3072
- interface TsPropertySignature extends Node, HasSpan {
3073
- type: "TsPropertySignature";
3074
- readonly: boolean;
3075
- key: Expression;
3076
- computed: boolean;
3077
- optional: boolean;
3078
- init?: Expression;
3079
- params: TsFnParameter[];
3080
- typeAnnotation?: TsTypeAnnotation;
3081
- typeParams?: TsTypeParameterDeclaration;
3082
- }
3083
- interface TsGetterSignature extends Node, HasSpan {
3084
- type: "TsGetterSignature";
3085
- readonly: boolean;
3086
- key: Expression;
3087
- computed: boolean;
3088
- optional: boolean;
3089
- typeAnnotation?: TsTypeAnnotation;
3090
- }
3091
- interface TsSetterSignature extends Node, HasSpan {
3092
- type: "TsSetterSignature";
3093
- readonly: boolean;
3094
- key: Expression;
3095
- computed: boolean;
3096
- optional: boolean;
3097
- param: TsFnParameter;
3098
- }
3099
- interface TsMethodSignature extends Node, HasSpan {
3100
- type: "TsMethodSignature";
3101
- readonly: boolean;
3102
- key: Expression;
3103
- computed: boolean;
3104
- optional: boolean;
3105
- params: TsFnParameter[];
3106
- typeAnn?: TsTypeAnnotation;
3107
- typeParams?: TsTypeParameterDeclaration;
3108
- }
3109
- interface TsIndexSignature extends Node, HasSpan {
3110
- type: "TsIndexSignature";
3111
- params: TsFnParameter[];
3112
- typeAnnotation?: TsTypeAnnotation;
3113
- readonly: boolean;
3114
- static: boolean;
3115
- }
3116
- type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType | TsTypePredicate | TsImportType;
3117
- type TsFnOrConstructorType = TsFunctionType | TsConstructorType;
3118
- interface TsKeywordType extends Node, HasSpan {
3119
- type: "TsKeywordType";
3120
- kind: TsKeywordTypeKind;
3121
- }
3122
- type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never" | "intrinsic";
3123
- interface TsThisType extends Node, HasSpan {
3124
- type: "TsThisType";
3125
- }
3126
- type TsFnParameter = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern;
3127
- interface TsFunctionType extends Node, HasSpan {
3128
- type: "TsFunctionType";
3129
- params: TsFnParameter[];
3130
- typeParams?: TsTypeParameterDeclaration;
3131
- typeAnnotation: TsTypeAnnotation;
3132
- }
3133
- interface TsConstructorType extends Node, HasSpan {
3134
- type: "TsConstructorType";
3135
- params: TsFnParameter[];
3136
- typeParams?: TsTypeParameterDeclaration;
3137
- typeAnnotation: TsTypeAnnotation;
3138
- isAbstract: boolean;
3139
- }
3140
- interface TsTypeReference extends Node, HasSpan {
3141
- type: "TsTypeReference";
3142
- typeName: TsEntityName;
3143
- typeParams?: TsTypeParameterInstantiation;
3144
- }
3145
- interface TsTypePredicate extends Node, HasSpan {
3146
- type: "TsTypePredicate";
3147
- asserts: boolean;
3148
- paramName: TsThisTypeOrIdent;
3149
- typeAnnotation?: TsTypeAnnotation;
3150
- }
3151
- type TsThisTypeOrIdent = TsThisType | Identifier;
3152
- interface TsImportType extends Node, HasSpan {
3153
- type: "TsImportType";
3154
- argument: StringLiteral;
3155
- qualifier?: TsEntityName;
3156
- typeArguments?: TsTypeParameterInstantiation;
3157
- }
3158
- /**
3159
- * `typeof` operator
3160
- */
3161
- interface TsTypeQuery extends Node, HasSpan {
3162
- type: "TsTypeQuery";
3163
- exprName: TsTypeQueryExpr;
3164
- typeArguments?: TsTypeParameterInstantiation;
3165
- }
3166
- type TsTypeQueryExpr = TsEntityName | TsImportType;
3167
- interface TsTypeLiteral extends Node, HasSpan {
3168
- type: "TsTypeLiteral";
3169
- members: TsTypeElement[];
3170
- }
3171
- interface TsArrayType extends Node, HasSpan {
3172
- type: "TsArrayType";
3173
- elemType: TsType;
3174
- }
3175
- interface TsTupleType extends Node, HasSpan {
3176
- type: "TsTupleType";
3177
- elemTypes: TsTupleElement[];
3178
- }
3179
- interface TsTupleElement extends Node, HasSpan {
3180
- type: "TsTupleElement";
3181
- label?: Pattern;
3182
- ty: TsType;
3183
- }
3184
- interface TsOptionalType extends Node, HasSpan {
3185
- type: "TsOptionalType";
3186
- typeAnnotation: TsType;
3187
- }
3188
- interface TsRestType extends Node, HasSpan {
3189
- type: "TsRestType";
3190
- typeAnnotation: TsType;
3191
- }
3192
- type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType;
3193
- interface TsUnionType extends Node, HasSpan {
3194
- type: "TsUnionType";
3195
- types: TsType[];
3196
- }
3197
- interface TsIntersectionType extends Node, HasSpan {
3198
- type: "TsIntersectionType";
3199
- types: TsType[];
3200
- }
3201
- interface TsConditionalType extends Node, HasSpan {
3202
- type: "TsConditionalType";
3203
- checkType: TsType;
3204
- extendsType: TsType;
3205
- trueType: TsType;
3206
- falseType: TsType;
3207
- }
3208
- interface TsInferType extends Node, HasSpan {
3209
- type: "TsInferType";
3210
- typeParam: TsTypeParameter;
3211
- }
3212
- interface TsParenthesizedType extends Node, HasSpan {
3213
- type: "TsParenthesizedType";
3214
- typeAnnotation: TsType;
3215
- }
3216
- interface TsTypeOperator extends Node, HasSpan {
3217
- type: "TsTypeOperator";
3218
- op: TsTypeOperatorOp;
3219
- typeAnnotation: TsType;
3220
- }
3221
- type TsTypeOperatorOp = "keyof" | "unique" | "readonly";
3222
- interface TsIndexedAccessType extends Node, HasSpan {
3223
- type: "TsIndexedAccessType";
3224
- readonly: boolean;
3225
- objectType: TsType;
3226
- indexType: TsType;
3227
- }
3228
- type TruePlusMinus = true | "+" | "-";
3229
- interface TsMappedType extends Node, HasSpan {
3230
- type: "TsMappedType";
3231
- readonly?: TruePlusMinus;
3232
- typeParam: TsTypeParameter;
3233
- nameType?: TsType;
3234
- optional?: TruePlusMinus;
3235
- typeAnnotation?: TsType;
3236
- }
3237
- interface TsLiteralType extends Node, HasSpan {
3238
- type: "TsLiteralType";
3239
- literal: TsLiteral;
3240
- }
3241
- type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TsTemplateLiteralType;
3242
- interface TsTemplateLiteralType extends Node, HasSpan {
3243
- type: "TemplateLiteral";
3244
- types: TsType[];
3245
- quasis: TemplateElement[];
3246
- }
3247
- interface TsInterfaceDeclaration extends Node, HasSpan {
3248
- type: "TsInterfaceDeclaration";
3249
- id: Identifier;
3250
- declare: boolean;
3251
- typeParams?: TsTypeParameterDeclaration;
3252
- extends: TsExpressionWithTypeArguments[];
3253
- body: TsInterfaceBody;
3254
- }
3255
- interface TsInterfaceBody extends Node, HasSpan {
3256
- type: "TsInterfaceBody";
3257
- body: TsTypeElement[];
3258
- }
3259
- interface TsExpressionWithTypeArguments extends Node, HasSpan {
3260
- type: "TsExpressionWithTypeArguments";
3261
- expression: Expression;
3262
- typeArguments?: TsTypeParameterInstantiation;
3263
- }
3264
- interface TsTypeAliasDeclaration extends Node, HasSpan {
3265
- type: "TsTypeAliasDeclaration";
3266
- declare: boolean;
3267
- id: Identifier;
3268
- typeParams?: TsTypeParameterDeclaration;
3269
- typeAnnotation: TsType;
3270
- }
3271
- interface TsEnumDeclaration extends Node, HasSpan {
3272
- type: "TsEnumDeclaration";
3273
- declare: boolean;
3274
- isConst: boolean;
3275
- id: Identifier;
3276
- members: TsEnumMember[];
3277
- }
3278
- interface TsEnumMember extends Node, HasSpan {
3279
- type: "TsEnumMember";
3280
- id: TsEnumMemberId;
3281
- init?: Expression;
3282
- }
3283
- type TsEnumMemberId = Identifier | StringLiteral;
3284
- interface TsModuleDeclaration extends Node, HasSpan {
3285
- type: "TsModuleDeclaration";
3286
- declare: boolean;
3287
- global: boolean;
3288
- id: TsModuleName;
3289
- body?: TsNamespaceBody;
3290
- }
3291
- /**
3292
- * `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body.
3293
- */
3294
- type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration;
3295
- interface TsModuleBlock extends Node, HasSpan {
3296
- type: "TsModuleBlock";
3297
- body: ModuleItem[];
3298
- }
3299
- interface TsNamespaceDeclaration extends Node, HasSpan {
3300
- type: "TsNamespaceDeclaration";
3301
- declare: boolean;
3302
- global: boolean;
3303
- id: Identifier;
3304
- body: TsNamespaceBody;
3305
- }
3306
- type TsModuleName = Identifier | StringLiteral;
3307
- interface TsImportEqualsDeclaration extends Node, HasSpan {
3308
- type: "TsImportEqualsDeclaration";
3309
- declare: boolean;
3310
- isExport: boolean;
3311
- isTypeOnly: boolean;
3312
- id: Identifier;
3313
- moduleRef: TsModuleReference;
3314
- }
3315
- type TsModuleReference = TsEntityName | TsExternalModuleReference;
3316
- interface TsExternalModuleReference extends Node, HasSpan {
3317
- type: "TsExternalModuleReference";
3318
- expression: StringLiteral;
3319
- }
3320
- interface TsExportAssignment extends Node, HasSpan {
3321
- type: "TsExportAssignment";
3322
- expression: Expression;
3323
- }
3324
- interface TsNamespaceExportDeclaration extends Node, HasSpan {
3325
- type: "TsNamespaceExportDeclaration";
3326
- id: Identifier;
3327
- }
3328
- interface TsAsExpression extends ExpressionBase {
3329
- type: "TsAsExpression";
3330
- expression: Expression;
3331
- typeAnnotation: TsType;
3332
- }
3333
- interface TsSatisfiesExpression extends ExpressionBase {
3334
- type: "TsSatisfiesExpression";
3335
- expression: Expression;
3336
- typeAnnotation: TsType;
3337
- }
3338
- interface TsInstantiation extends Node, HasSpan {
3339
- type: "TsInstantiation";
3340
- expression: Expression;
3341
- typeArguments: TsTypeParameterInstantiation;
3342
- }
3343
- interface TsTypeAssertion extends ExpressionBase {
3344
- type: "TsTypeAssertion";
3345
- expression: Expression;
3346
- typeAnnotation: TsType;
3347
- }
3348
- interface TsConstAssertion extends ExpressionBase {
3349
- type: "TsConstAssertion";
3350
- expression: Expression;
3351
- }
3352
- interface TsNonNullExpression extends ExpressionBase {
3353
- type: "TsNonNullExpression";
3354
- expression: Expression;
3355
- }
3356
- type Accessibility = "public" | "protected" | "private";
3357
- interface Invalid extends Node, HasSpan {
3358
- type: "Invalid";
3359
- }
3360
-
3361
1480
  interface Options$1 {
3362
1481
  allowRegExp: boolean;
3363
1482
  allowFunction: boolean;
@@ -3431,19 +1550,7 @@ type Indexer = BaseIndexer & {
3431
1550
  * @returns A promise that resolves to an array of {@link IndexInput} objects.
3432
1551
  */
3433
1552
  createIndex: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>;
3434
- /**
3435
- * @deprecated Use {@link index} instead
3436
- */
3437
- indexer?: never;
3438
1553
  };
3439
- type DeprecatedIndexer = BaseIndexer & {
3440
- indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
3441
- createIndex?: never;
3442
- };
3443
- /**
3444
- * @deprecated Use {@link Indexer} instead
3445
- */
3446
- type StoryIndexer = Indexer | DeprecatedIndexer;
3447
1554
  interface BaseIndexEntry {
3448
1555
  id: StoryId;
3449
1556
  name: StoryName;
@@ -3571,8 +1678,8 @@ interface DirectoryMapping {
3571
1678
  interface Presets {
3572
1679
  apply(extension: 'typescript', config: TypescriptOptions, args?: Options): Promise<TypescriptOptions>;
3573
1680
  apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
3574
- apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
3575
- apply(extension: 'swc', config?: {}, args?: any): Promise<Options$2>;
1681
+ apply(extension: 'babel', config?: {}, args?: any): Promise<any>;
1682
+ apply(extension: 'swc', config?: {}, args?: any): Promise<any>;
3576
1683
  apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
3577
1684
  apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
3578
1685
  apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
@@ -3635,10 +1742,6 @@ interface CLIOptions {
3635
1742
  host?: string;
3636
1743
  initialPath?: string;
3637
1744
  exactPort?: boolean;
3638
- /**
3639
- * @deprecated Use 'staticDirs' Storybook Configuration option instead
3640
- */
3641
- staticDir?: string[];
3642
1745
  configDir?: string;
3643
1746
  https?: boolean;
3644
1747
  sslCa?: string[];
@@ -3707,14 +1810,7 @@ interface TypescriptOptions {
3707
1810
  */
3708
1811
  check: boolean;
3709
1812
  /**
3710
- * Disable parsing typescript files through babel.
3711
- *
3712
- * @default `false`
3713
- * @deprecated use `skipCompiler` instead
3714
- */
3715
- skipBabel: boolean;
3716
- /**
3717
- * Disable parsing typescript files through compiler.
1813
+ * Disable parsing TypeScript files through compiler.
3718
1814
  *
3719
1815
  * @default `false`
3720
1816
  */
@@ -3804,19 +1900,6 @@ interface StorybookConfigRaw {
3804
1900
  staticDirs?: (DirectoryMapping | string)[];
3805
1901
  logLevel?: string;
3806
1902
  features?: {
3807
- /**
3808
- * Build stories.json automatically on start/build
3809
- */
3810
- buildStoriesJson?: boolean;
3811
- /**
3812
- * Activate on demand story store
3813
- */
3814
- storyStoreV7?: boolean;
3815
- /**
3816
- * Do not throw errors if using `.mdx` files in SSv7
3817
- * (for internal use in sandboxes)
3818
- */
3819
- storyStoreV7MdxErrors?: boolean;
3820
1903
  /**
3821
1904
  * Filter args with a "target" on the type from the render function (EXPERIMENTAL)
3822
1905
  */
@@ -3845,13 +1928,12 @@ interface StorybookConfigRaw {
3845
1928
  framework?: Preset;
3846
1929
  typescript?: Partial<TypescriptOptions>;
3847
1930
  refs?: CoreCommon_StorybookRefs;
3848
- babel?: TransformOptions;
3849
- swc?: Options$2;
1931
+ babel?: any;
1932
+ swc?: any;
3850
1933
  env?: Record<string, string>;
3851
- babelDefault?: TransformOptions;
1934
+ babelDefault?: any;
3852
1935
  config?: Entry[];
3853
1936
  previewAnnotations?: Entry[];
3854
- storyIndexers?: StoryIndexer[];
3855
1937
  experimental_indexers?: Indexer[];
3856
1938
  docs?: DocsOptions;
3857
1939
  previewHead?: string;
@@ -3925,11 +2007,6 @@ interface StorybookConfig {
3925
2007
  * Add additional scripts to run in the preview a la `.storybook/preview.js`
3926
2008
  */
3927
2009
  previewAnnotations?: PresetValue<StorybookConfigRaw['previewAnnotations']>;
3928
- /**
3929
- * Process CSF files for the story index.
3930
- * @deprecated use {@link experimental_indexers} instead
3931
- */
3932
- storyIndexers?: PresetValue<StorybookConfigRaw['storyIndexers']>;
3933
2010
  /**
3934
2011
  * Process CSF files for the story index.
3935
2012
  */
@@ -4550,11 +2627,6 @@ type Addon_BaseStoryFn<TArgs, StoryFnReturnType> = {
4550
2627
  type BaseStory<TArgs, StoryFnReturnType> = Addon_BaseStoryFn<TArgs, StoryFnReturnType> | Addon_BaseStoryObject<TArgs, StoryFnReturnType>;
4551
2628
  interface Addon_RenderOptions {
4552
2629
  active: boolean;
4553
- /**
4554
- * @deprecated You should not use key anymore as of Storybook 7.2 this render method is invoked as a React component.
4555
- * This property will be removed in 8.0.
4556
- * */
4557
- key?: unknown;
4558
2630
  }
4559
2631
  type Addon_Type = Addon_BaseType | Addon_PageType | Addon_WrapperType | Addon_SidebarBottomType | Addon_SidebarTopType;
4560
2632
  interface Addon_BaseType {
@@ -4749,11 +2821,7 @@ declare enum Addon_TypesEnum {
4749
2821
  * This adds items in the top of the sidebar.
4750
2822
  * @unstable This will get replaced with a new API in 8.0, use at your own risk.
4751
2823
  */
4752
- experimental_SIDEBAR_TOP = "sidebar-top",
4753
- /**
4754
- * @deprecated This property does nothing, and will be removed in Storybook 8.0.
4755
- */
4756
- NOTES_ELEMENT = "notes-element"
2824
+ experimental_SIDEBAR_TOP = "sidebar-top"
4757
2825
  }
4758
2826
 
4759
2827
  type OrString<T extends string> = T | (string & {});
@@ -4977,4 +3045,4 @@ interface ComposeStoryFn<TRenderer extends Renderer = Renderer, TArgs extends Ar
4977
3045
  (storyAnnotations: AnnotatedStoryFn<TRenderer, TArgs> | StoryAnnotations<TRenderer, TArgs>, componentAnnotations: ComponentAnnotations<TRenderer, TArgs>, projectAnnotations: ProjectAnnotations<TRenderer>, exportsName?: string): ComposedStoryFn;
4978
3046
  }
4979
3047
 
4980
- export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_FilterFunction, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedIndexEntry, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_StatusObject, API_StatusState, API_StatusUpdate, API_StatusValue, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_BaseType, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PageType, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_SidebarBottomType, Addon_SidebarTopType, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_TypesMapping, Addon_WrapperSettings, Addon_WrapperType, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseIndexInput, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStoryFn, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DeprecatedIndexer, DocsContextProps, DocsIndexEntry, DocsIndexInput, DocsOptions, DocsPreparedPayload, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexInput, IndexedCSFFile, IndexedStory, Indexer, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialArgsStoryFn, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, Ref, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexInput, StoryIndexV2, StoryIndexV3, StoryIndexer, StoryKind, StoryName, StoryPreparedPayload, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookConfigRaw, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TestBuildConfig, TestBuildFlags, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };
3048
+ export { API_ActiveTabsType, API_Addon, API_BaseEntry, API_Collection, API_ComponentEntry, API_ComposedRef, API_ComposedRefUpdate, API_DocsEntry, API_FilterFunction, API_Group, API_GroupEntry, API_HashEntry, API_IframeRenderer, API_IndexHash, API_Layout, API_LeafEntry, API_LoadedRefData, API_MatchOptions, API_Notification, API_OptionsData, API_PanelPositions, API_Panels, API_PreparedIndexEntry, API_PreparedStoryIndex, API_Provider, API_ProviderData, API_RefId, API_RefUrl, API_Refs, API_ReleaseNotes, API_RenderOptions, API_Root, API_RootEntry, API_RouteOptions, API_SetRefData, API_Settings, API_SidebarOptions, API_StateMerger, API_StatusObject, API_StatusState, API_StatusUpdate, API_StatusValue, API_Story, API_StoryEntry, API_StoryMapper, API_UI, API_UIOptions, API_UnknownEntries, API_Version, API_Versions$1 as API_Versions, API_ViewMode, Addon_AddStoryArgs, Addon_Annotations, Addon_ArgType, Addon_ArgsStoryFn, Addon_BaseAnnotations, Addon_BaseDecorators, Addon_BaseMeta, Addon_BaseStoryFn, Addon_BaseStoryObject, Addon_BaseType, Addon_ClientApiAddon, Addon_ClientApiAddons, Addon_ClientApiReturnFn, Addon_ClientStoryApi, Addon_Collection, Addon_Comparator, Addon_Config, Addon_DecoratorFunction, Addon_Elements, Addon_LegacyStoryFn, Addon_LoadFn, Addon_Loadable, Addon_Loader, Addon_LoaderFunction, Addon_Loaders, Addon_MakeDecoratorResult, Addon_OptionsParameter, Addon_OptionsParameterV7, Addon_PageType, Addon_PartialStoryFn, Addon_RenderOptions, Addon_RequireContext, Addon_SidebarBottomType, Addon_SidebarTopType, Addon_StoryApi, Addon_StoryContext, Addon_StoryContextUpdate, Addon_StoryFn, Addon_StorySortComparator, Addon_StorySortComparatorV7, Addon_StorySortMethod, Addon_StorySortObjectParameter, Addon_StorySortParameter, Addon_StorySortParameterV7, Addon_StoryWrapper, Addon_ToolbarConfig, Addon_Type, Addon_Types, Addon_TypesEnum, Addon_TypesMapping, Addon_WrapperSettings, Addon_WrapperType, Addons_ArgTypes, AnnotatedStoryFn, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BaseIndexEntry, BaseIndexInput, BaseStory, BoundStory, Builder, BuilderName, BuilderOptions, BuilderResult, BuilderStats, Builder_EnvsRaw, Builder_Unpromise, Builder_WithRequiredProperty, CLIOptions, CSFFile, ComponentAnnotations, ComponentId, ComponentTitle, ComposeStoryFn, ComposedStoryFn, ComposedStoryPlayContext, ComposedStoryPlayFn, Conditional, CoreCommon_AddonEntry, CoreCommon_AddonInfo, CoreCommon_OptionsEntry, CoreCommon_ResolvedAddonPreset, CoreCommon_ResolvedAddonVirtual, CoreCommon_StorybookInfo, CoreConfig, DecoratorApplicator, DecoratorFunction, DocsContextProps, DocsIndexEntry, DocsIndexInput, DocsOptions, DocsPreparedPayload, DocsRenderFunction, Entry, GlobalTypes, Globals, IncludeExcludeOptions, IndexEntry, IndexEntryLegacy, IndexInput, IndexedCSFFile, IndexedStory, Indexer, IndexerOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoadOptions, LoadedPreset, LoaderFunction, ModuleExport, ModuleExports, ModuleImportFn, NormalizedComponentAnnotations, NormalizedProjectAnnotations, NormalizedStoriesSpecifier, NormalizedStoryAnnotations, Options, PackageJson, Parameters, PartialArgsStoryFn, PartialStoryFn, Path, PlayFunction, PlayFunctionContext, PreparedMeta, PreparedStory, Preset, PresetConfig, PresetProperty, PresetPropertyFn, PresetValue, Presets, PreviewAnnotation, ProjectAnnotations, Ref, RenderContext, RenderContextCallbacks, RenderToCanvas, Renderer, RendererName, ResolvedModuleExport, ResolvedModuleExportFromType, ResolvedModuleExportType, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, SetGlobalsPayload, SetStoriesPayload, SetStoriesStory, SetStoriesStoryData, Stats, StepFunction, StepLabel, StepRunner, Store_CSFExports, StoriesEntry, StoriesWithPartialProps, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryIndex, StoryIndexEntry, StoryIndexInput, StoryIndexV2, StoryIndexV3, StoryKind, StoryName, StoryPreparedPayload, StoryRenderOptions, StorybookConfig, StorybookConfigOptions, StorybookConfigRaw, StorybookInternalParameters, StorybookParameters, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, Tag, TeardownRenderToCanvas, TestBuildConfig, TestBuildFlags, TypescriptOptions, V3CompatIndexEntry, VersionCheck, ViewMode, WebRenderer };