@storm-software/unbuild 0.37.20 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.37.19-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.38.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/bin/unbuild.cjs CHANGED
@@ -1568,8 +1568,9 @@ var import_defu3 = __toESM(require("defu"), 1);
1568
1568
  var import_glob4 = require("glob");
1569
1569
  var import_node_fs6 = require("fs");
1570
1570
  var import_promises6 = require("fs/promises");
1571
- var import_node_path6 = require("path");
1571
+ var import_node_path5 = require("path");
1572
1572
  var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
1573
+ var import_pkg_types = require("pkg-types");
1573
1574
  var import_unbuild = require("unbuild");
1574
1575
 
1575
1576
  // src/clean.ts
@@ -1685,37 +1686,6 @@ var tscPlugin = /* @__PURE__ */ __name(async (options) => {
1685
1686
  });
1686
1687
  }, "tscPlugin");
1687
1688
 
1688
- // src/plugins/type-definitions.ts
1689
- var import_node_path5 = require("path");
1690
- function typeDefinitionsPlugin(options) {
1691
- return {
1692
- name: "storm:dts-bundle",
1693
- async generateBundle(_opts, bundle) {
1694
- for (const file of Object.values(bundle)) {
1695
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
1696
- continue;
1697
- }
1698
- const hasDefaultExport = file.exports.includes("default");
1699
- const entrySourceFileName = (0, import_node_path5.relative)(options.projectRoot, file.facadeModuleId);
1700
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
1701
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
1702
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
1703
- const dtsFileSource = hasDefaultExport ? `
1704
- export * from ${relativeSourceDtsName};
1705
- export { default } from ${relativeSourceDtsName};
1706
- ` : `export * from ${relativeSourceDtsName};
1707
- `;
1708
- this.emitFile({
1709
- type: "asset",
1710
- fileName: dtsFileName,
1711
- source: dtsFileSource
1712
- });
1713
- }
1714
- }
1715
- };
1716
- }
1717
- __name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
1718
-
1719
1689
  // src/build.ts
1720
1690
  async function resolveOptions(options, config) {
1721
1691
  writeDebug(" \u2699\uFE0F Resolving build options", config);
@@ -1743,11 +1713,15 @@ async function resolveOptions(options, config) {
1743
1713
  const packageJson = JSON.parse(packageJsonContent);
1744
1714
  let tsconfig = options.tsconfig;
1745
1715
  if (!tsconfig) {
1746
- tsconfig = joinPaths(config.workspaceRoot, options.projectRoot, "tsconfig.json");
1716
+ tsconfig = joinPaths(options.projectRoot, "tsconfig.json");
1717
+ }
1718
+ if (!tsconfig.startsWith(config.workspaceRoot)) {
1719
+ tsconfig = joinPaths(config.workspaceRoot, tsconfig);
1747
1720
  }
1748
1721
  if (!(0, import_node_fs6.existsSync)(tsconfig)) {
1749
1722
  throw new Error("Cannot find tsconfig.json configuration");
1750
1723
  }
1724
+ const tsconfigFile = await (0, import_pkg_types.readTSConfig)(tsconfig);
1751
1725
  let sourceRoot = projectJson.sourceRoot;
1752
1726
  if (!sourceRoot) {
1753
1727
  sourceRoot = joinPaths(options.projectRoot, "src");
@@ -1774,10 +1748,9 @@ async function resolveOptions(options, config) {
1774
1748
  sourceRoot,
1775
1749
  projectName,
1776
1750
  tsconfig,
1777
- platform: options.platform ?? "neutral",
1751
+ platform: options.platform || "neutral",
1778
1752
  generatePackageJson: true,
1779
1753
  clean: false,
1780
- env: {},
1781
1754
  entries: entries.reduce((ret, entry) => {
1782
1755
  let entryPath = entry.replace(options.projectRoot, "");
1783
1756
  while (entryPath.startsWith(".")) {
@@ -1786,23 +1759,32 @@ async function resolveOptions(options, config) {
1786
1759
  while (entryPath.startsWith("/")) {
1787
1760
  entryPath = entryPath.substring(1);
1788
1761
  }
1789
- const outDir = joinPaths((0, import_node_path6.relative)(joinPaths(config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
1762
+ const outDir = joinPaths((0, import_node_path5.relative)(joinPaths(config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
1790
1763
  ret.push({
1791
1764
  name: `${name}-esm`,
1792
1765
  builder: "mkdist",
1793
1766
  input: `./${entryPath}`,
1794
1767
  outDir,
1795
- declaration: options.emitTypes !== false ? "compatible" : false,
1796
- format: "esm"
1768
+ declaration: options.emitTypes !== false,
1769
+ addRelativeDeclarationExtensions: true,
1770
+ format: "esm",
1771
+ ext: "mjs",
1772
+ typescript: {
1773
+ compilerOptions: tsconfigFile.compilerOptions
1774
+ }
1797
1775
  });
1798
1776
  ret.push({
1799
1777
  name: `${name}-cjs`,
1800
1778
  builder: "mkdist",
1801
1779
  input: `./${entryPath}`,
1802
1780
  outDir,
1803
- declaration: options.emitTypes !== false ? "compatible" : false,
1781
+ declaration: options.emitTypes !== false,
1782
+ addRelativeDeclarationExtensions: true,
1804
1783
  format: "cjs",
1805
- ext: "cjs"
1784
+ ext: "cjs",
1785
+ typescript: {
1786
+ compilerOptions: tsconfigFile.compilerOptions
1787
+ }
1806
1788
  });
1807
1789
  return ret;
1808
1790
  }, []),
@@ -1811,11 +1793,7 @@ async function resolveOptions(options, config) {
1811
1793
  sourcemap: options.sourcemap ?? !!options.debug,
1812
1794
  outDir: outputPath,
1813
1795
  parallel: true,
1814
- stub: false,
1815
- stubOptions: {
1816
- jiti: {}
1817
- },
1818
- externals: options.external ?? [],
1796
+ externals: options.external,
1819
1797
  dependencies: [],
1820
1798
  peerDependencies: [],
1821
1799
  devDependencies: [],
@@ -1844,12 +1822,15 @@ async function resolveOptions(options, config) {
1844
1822
  resolve: {
1845
1823
  preferBuiltins: true,
1846
1824
  extensions: [
1825
+ ".tsx",
1826
+ ".ts",
1827
+ ".cts",
1828
+ ".mts",
1829
+ ".jsx",
1830
+ ".js",
1847
1831
  ".cjs",
1848
1832
  ".mjs",
1849
- ".js",
1850
- ".jsx",
1851
- ".ts",
1852
- ".tsx",
1833
+ ".css",
1853
1834
  ".json"
1854
1835
  ]
1855
1836
  },
@@ -1858,7 +1839,7 @@ async function resolveOptions(options, config) {
1858
1839
  sourceMap: options.sourcemap ?? !!options.debug,
1859
1840
  splitting: options.splitting !== false,
1860
1841
  treeShaking: options.treeShaking !== false,
1861
- platform: options.platform ?? "neutral",
1842
+ platform: options.platform || "neutral",
1862
1843
  color: true,
1863
1844
  logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
1864
1845
  }
@@ -1895,7 +1876,6 @@ async function resolveOptions(options, config) {
1895
1876
  writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1896
1877
  opts.plugins = await Promise.all([
1897
1878
  analyzePlugin(resolvedOptions),
1898
- typeDefinitionsPlugin(resolvedOptions),
1899
1879
  tscPlugin(resolvedOptions),
1900
1880
  onErrorPlugin(resolvedOptions)
1901
1881
  ]);
@@ -1936,15 +1916,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1936
1916
  }
1937
1917
  return {
1938
1918
  import: {
1939
- types: `./dist/${entry}.d.ts`,
1919
+ types: `./dist/${entry}.d.mts`,
1940
1920
  default: `./dist/${entry}.mjs`
1941
1921
  },
1942
1922
  require: {
1943
- types: `./dist/${entry}.d.ts`,
1923
+ types: `./dist/${entry}.d.cts`,
1944
1924
  default: `./dist/${entry}.cjs`
1945
1925
  },
1946
1926
  default: {
1947
- types: `./dist/${entry}.d.ts`,
1927
+ types: `./dist/${entry}.d.mts`,
1948
1928
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1949
1929
  }
1950
1930
  };
package/bin/unbuild.js CHANGED
@@ -1547,8 +1547,9 @@ import defu3 from "defu";
1547
1547
  import { Glob as Glob2 } from "glob";
1548
1548
  import { existsSync as existsSync5 } from "node:fs";
1549
1549
  import { readFile as readFile5 } from "node:fs/promises";
1550
- import { relative as relative3 } from "node:path";
1550
+ import { relative as relative2 } from "node:path";
1551
1551
  import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
1552
+ import { readTSConfig } from "pkg-types";
1552
1553
  import { build as unbuild } from "unbuild";
1553
1554
 
1554
1555
  // src/clean.ts
@@ -1664,37 +1665,6 @@ var tscPlugin = /* @__PURE__ */ __name(async (options) => {
1664
1665
  });
1665
1666
  }, "tscPlugin");
1666
1667
 
1667
- // src/plugins/type-definitions.ts
1668
- import { relative as relative2 } from "node:path";
1669
- function typeDefinitionsPlugin(options) {
1670
- return {
1671
- name: "storm:dts-bundle",
1672
- async generateBundle(_opts, bundle) {
1673
- for (const file of Object.values(bundle)) {
1674
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
1675
- continue;
1676
- }
1677
- const hasDefaultExport = file.exports.includes("default");
1678
- const entrySourceFileName = relative2(options.projectRoot, file.facadeModuleId);
1679
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
1680
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
1681
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
1682
- const dtsFileSource = hasDefaultExport ? `
1683
- export * from ${relativeSourceDtsName};
1684
- export { default } from ${relativeSourceDtsName};
1685
- ` : `export * from ${relativeSourceDtsName};
1686
- `;
1687
- this.emitFile({
1688
- type: "asset",
1689
- fileName: dtsFileName,
1690
- source: dtsFileSource
1691
- });
1692
- }
1693
- }
1694
- };
1695
- }
1696
- __name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
1697
-
1698
1668
  // src/build.ts
1699
1669
  async function resolveOptions(options, config) {
1700
1670
  writeDebug(" \u2699\uFE0F Resolving build options", config);
@@ -1722,11 +1692,15 @@ async function resolveOptions(options, config) {
1722
1692
  const packageJson = JSON.parse(packageJsonContent);
1723
1693
  let tsconfig = options.tsconfig;
1724
1694
  if (!tsconfig) {
1725
- tsconfig = joinPaths(config.workspaceRoot, options.projectRoot, "tsconfig.json");
1695
+ tsconfig = joinPaths(options.projectRoot, "tsconfig.json");
1696
+ }
1697
+ if (!tsconfig.startsWith(config.workspaceRoot)) {
1698
+ tsconfig = joinPaths(config.workspaceRoot, tsconfig);
1726
1699
  }
1727
1700
  if (!existsSync5(tsconfig)) {
1728
1701
  throw new Error("Cannot find tsconfig.json configuration");
1729
1702
  }
1703
+ const tsconfigFile = await readTSConfig(tsconfig);
1730
1704
  let sourceRoot = projectJson.sourceRoot;
1731
1705
  if (!sourceRoot) {
1732
1706
  sourceRoot = joinPaths(options.projectRoot, "src");
@@ -1753,10 +1727,9 @@ async function resolveOptions(options, config) {
1753
1727
  sourceRoot,
1754
1728
  projectName,
1755
1729
  tsconfig,
1756
- platform: options.platform ?? "neutral",
1730
+ platform: options.platform || "neutral",
1757
1731
  generatePackageJson: true,
1758
1732
  clean: false,
1759
- env: {},
1760
1733
  entries: entries.reduce((ret, entry) => {
1761
1734
  let entryPath = entry.replace(options.projectRoot, "");
1762
1735
  while (entryPath.startsWith(".")) {
@@ -1765,23 +1738,32 @@ async function resolveOptions(options, config) {
1765
1738
  while (entryPath.startsWith("/")) {
1766
1739
  entryPath = entryPath.substring(1);
1767
1740
  }
1768
- const outDir = joinPaths(relative3(joinPaths(config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
1741
+ const outDir = joinPaths(relative2(joinPaths(config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
1769
1742
  ret.push({
1770
1743
  name: `${name}-esm`,
1771
1744
  builder: "mkdist",
1772
1745
  input: `./${entryPath}`,
1773
1746
  outDir,
1774
- declaration: options.emitTypes !== false ? "compatible" : false,
1775
- format: "esm"
1747
+ declaration: options.emitTypes !== false,
1748
+ addRelativeDeclarationExtensions: true,
1749
+ format: "esm",
1750
+ ext: "mjs",
1751
+ typescript: {
1752
+ compilerOptions: tsconfigFile.compilerOptions
1753
+ }
1776
1754
  });
1777
1755
  ret.push({
1778
1756
  name: `${name}-cjs`,
1779
1757
  builder: "mkdist",
1780
1758
  input: `./${entryPath}`,
1781
1759
  outDir,
1782
- declaration: options.emitTypes !== false ? "compatible" : false,
1760
+ declaration: options.emitTypes !== false,
1761
+ addRelativeDeclarationExtensions: true,
1783
1762
  format: "cjs",
1784
- ext: "cjs"
1763
+ ext: "cjs",
1764
+ typescript: {
1765
+ compilerOptions: tsconfigFile.compilerOptions
1766
+ }
1785
1767
  });
1786
1768
  return ret;
1787
1769
  }, []),
@@ -1790,11 +1772,7 @@ async function resolveOptions(options, config) {
1790
1772
  sourcemap: options.sourcemap ?? !!options.debug,
1791
1773
  outDir: outputPath,
1792
1774
  parallel: true,
1793
- stub: false,
1794
- stubOptions: {
1795
- jiti: {}
1796
- },
1797
- externals: options.external ?? [],
1775
+ externals: options.external,
1798
1776
  dependencies: [],
1799
1777
  peerDependencies: [],
1800
1778
  devDependencies: [],
@@ -1823,12 +1801,15 @@ async function resolveOptions(options, config) {
1823
1801
  resolve: {
1824
1802
  preferBuiltins: true,
1825
1803
  extensions: [
1804
+ ".tsx",
1805
+ ".ts",
1806
+ ".cts",
1807
+ ".mts",
1808
+ ".jsx",
1809
+ ".js",
1826
1810
  ".cjs",
1827
1811
  ".mjs",
1828
- ".js",
1829
- ".jsx",
1830
- ".ts",
1831
- ".tsx",
1812
+ ".css",
1832
1813
  ".json"
1833
1814
  ]
1834
1815
  },
@@ -1837,7 +1818,7 @@ async function resolveOptions(options, config) {
1837
1818
  sourceMap: options.sourcemap ?? !!options.debug,
1838
1819
  splitting: options.splitting !== false,
1839
1820
  treeShaking: options.treeShaking !== false,
1840
- platform: options.platform ?? "neutral",
1821
+ platform: options.platform || "neutral",
1841
1822
  color: true,
1842
1823
  logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
1843
1824
  }
@@ -1874,7 +1855,6 @@ async function resolveOptions(options, config) {
1874
1855
  writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1875
1856
  opts.plugins = await Promise.all([
1876
1857
  analyzePlugin(resolvedOptions),
1877
- typeDefinitionsPlugin(resolvedOptions),
1878
1858
  tscPlugin(resolvedOptions),
1879
1859
  onErrorPlugin(resolvedOptions)
1880
1860
  ]);
@@ -1915,15 +1895,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1915
1895
  }
1916
1896
  return {
1917
1897
  import: {
1918
- types: `./dist/${entry}.d.ts`,
1898
+ types: `./dist/${entry}.d.mts`,
1919
1899
  default: `./dist/${entry}.mjs`
1920
1900
  },
1921
1901
  require: {
1922
- types: `./dist/${entry}.d.ts`,
1902
+ types: `./dist/${entry}.d.cts`,
1923
1903
  default: `./dist/${entry}.cjs`
1924
1904
  },
1925
1905
  default: {
1926
- types: `./dist/${entry}.d.ts`,
1906
+ types: `./dist/${entry}.d.mts`,
1927
1907
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1928
1908
  }
1929
1909
  };
package/dist/build.cjs CHANGED
@@ -5,8 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkSOHZAEOHcjs = require('./chunk-SOHZAEOH.cjs');
9
- require('./chunk-OD3ULBE3.cjs');
8
+ var _chunkYUFE3NLGcjs = require('./chunk-YUFE3NLG.cjs');
10
9
  require('./chunk-WGGER7UI.cjs');
11
10
  require('./chunk-OOFPXPRC.cjs');
12
11
  require('./chunk-X25DCA4T.cjs');
@@ -20,4 +19,4 @@ require('./chunk-BGYQAVKQ.cjs');
20
19
 
21
20
 
22
21
 
23
- exports.build = _chunkSOHZAEOHcjs.build; exports.cleanOutputPath = _chunkSOHZAEOHcjs.cleanOutputPath; exports.copyBuildAssets = _chunkSOHZAEOHcjs.copyBuildAssets; exports.executeUnbuild = _chunkSOHZAEOHcjs.executeUnbuild; exports.generatePackageJson = _chunkSOHZAEOHcjs.generatePackageJson; exports.resolveOptions = _chunkSOHZAEOHcjs.resolveOptions;
22
+ exports.build = _chunkYUFE3NLGcjs.build; exports.cleanOutputPath = _chunkYUFE3NLGcjs.cleanOutputPath; exports.copyBuildAssets = _chunkYUFE3NLGcjs.copyBuildAssets; exports.executeUnbuild = _chunkYUFE3NLGcjs.executeUnbuild; exports.generatePackageJson = _chunkYUFE3NLGcjs.generatePackageJson; exports.resolveOptions = _chunkYUFE3NLGcjs.resolveOptions;
package/dist/build.js CHANGED
@@ -5,8 +5,7 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-JJ5QDPA6.js";
9
- import "./chunk-RBYYB7X2.js";
8
+ } from "./chunk-HIBMLCH5.js";
10
9
  import "./chunk-JLKMLDBA.js";
11
10
  import "./chunk-5XTPDLOE.js";
12
11
  import "./chunk-2FX3WQNK.js";
@@ -1,6 +1,3 @@
1
- import {
2
- typeDefinitionsPlugin
3
- } from "./chunk-RBYYB7X2.js";
4
1
  import {
5
2
  cleanDirectories
6
3
  } from "./chunk-JLKMLDBA.js";
@@ -815,6 +812,7 @@ import { existsSync as existsSync3 } from "node:fs";
815
812
  import { readFile as readFile4 } from "node:fs/promises";
816
813
  import { relative as relative2 } from "node:path";
817
814
  import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
815
+ import { readTSConfig } from "pkg-types";
818
816
  import { build as unbuild } from "unbuild";
819
817
  async function resolveOptions(options, config) {
820
818
  writeDebug(" \u2699\uFE0F Resolving build options", config);
@@ -842,11 +840,15 @@ async function resolveOptions(options, config) {
842
840
  const packageJson = JSON.parse(packageJsonContent);
843
841
  let tsconfig = options.tsconfig;
844
842
  if (!tsconfig) {
845
- tsconfig = joinPaths(config.workspaceRoot, options.projectRoot, "tsconfig.json");
843
+ tsconfig = joinPaths(options.projectRoot, "tsconfig.json");
844
+ }
845
+ if (!tsconfig.startsWith(config.workspaceRoot)) {
846
+ tsconfig = joinPaths(config.workspaceRoot, tsconfig);
846
847
  }
847
848
  if (!existsSync3(tsconfig)) {
848
849
  throw new Error("Cannot find tsconfig.json configuration");
849
850
  }
851
+ const tsconfigFile = await readTSConfig(tsconfig);
850
852
  let sourceRoot = projectJson.sourceRoot;
851
853
  if (!sourceRoot) {
852
854
  sourceRoot = joinPaths(options.projectRoot, "src");
@@ -873,10 +875,9 @@ async function resolveOptions(options, config) {
873
875
  sourceRoot,
874
876
  projectName,
875
877
  tsconfig,
876
- platform: options.platform ?? "neutral",
878
+ platform: options.platform || "neutral",
877
879
  generatePackageJson: true,
878
880
  clean: false,
879
- env: {},
880
881
  entries: entries.reduce((ret, entry) => {
881
882
  let entryPath = entry.replace(options.projectRoot, "");
882
883
  while (entryPath.startsWith(".")) {
@@ -891,17 +892,26 @@ async function resolveOptions(options, config) {
891
892
  builder: "mkdist",
892
893
  input: `./${entryPath}`,
893
894
  outDir,
894
- declaration: options.emitTypes !== false ? "compatible" : false,
895
- format: "esm"
895
+ declaration: options.emitTypes !== false,
896
+ addRelativeDeclarationExtensions: true,
897
+ format: "esm",
898
+ ext: "mjs",
899
+ typescript: {
900
+ compilerOptions: tsconfigFile.compilerOptions
901
+ }
896
902
  });
897
903
  ret.push({
898
904
  name: `${name}-cjs`,
899
905
  builder: "mkdist",
900
906
  input: `./${entryPath}`,
901
907
  outDir,
902
- declaration: options.emitTypes !== false ? "compatible" : false,
908
+ declaration: options.emitTypes !== false,
909
+ addRelativeDeclarationExtensions: true,
903
910
  format: "cjs",
904
- ext: "cjs"
911
+ ext: "cjs",
912
+ typescript: {
913
+ compilerOptions: tsconfigFile.compilerOptions
914
+ }
905
915
  });
906
916
  return ret;
907
917
  }, []),
@@ -910,11 +920,7 @@ async function resolveOptions(options, config) {
910
920
  sourcemap: options.sourcemap ?? !!options.debug,
911
921
  outDir: outputPath,
912
922
  parallel: true,
913
- stub: false,
914
- stubOptions: {
915
- jiti: {}
916
- },
917
- externals: options.external ?? [],
923
+ externals: options.external,
918
924
  dependencies: [],
919
925
  peerDependencies: [],
920
926
  devDependencies: [],
@@ -943,12 +949,15 @@ async function resolveOptions(options, config) {
943
949
  resolve: {
944
950
  preferBuiltins: true,
945
951
  extensions: [
952
+ ".tsx",
953
+ ".ts",
954
+ ".cts",
955
+ ".mts",
956
+ ".jsx",
957
+ ".js",
946
958
  ".cjs",
947
959
  ".mjs",
948
- ".js",
949
- ".jsx",
950
- ".ts",
951
- ".tsx",
960
+ ".css",
952
961
  ".json"
953
962
  ]
954
963
  },
@@ -957,7 +966,7 @@ async function resolveOptions(options, config) {
957
966
  sourceMap: options.sourcemap ?? !!options.debug,
958
967
  splitting: options.splitting !== false,
959
968
  treeShaking: options.treeShaking !== false,
960
- platform: options.platform ?? "neutral",
969
+ platform: options.platform || "neutral",
961
970
  color: true,
962
971
  logLevel: config.logLevel === LogLevelLabel.FATAL ? LogLevelLabel.ERROR : isVerbose() ? "verbose" : config.logLevel
963
972
  }
@@ -994,7 +1003,6 @@ async function resolveOptions(options, config) {
994
1003
  writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
995
1004
  opts.plugins = await Promise.all([
996
1005
  analyzePlugin(resolvedOptions),
997
- typeDefinitionsPlugin(resolvedOptions),
998
1006
  tscPlugin(resolvedOptions),
999
1007
  onErrorPlugin(resolvedOptions)
1000
1008
  ]);
@@ -1035,15 +1043,15 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1035
1043
  }
1036
1044
  return {
1037
1045
  import: {
1038
- types: `./dist/${entry}.d.ts`,
1046
+ types: `./dist/${entry}.d.mts`,
1039
1047
  default: `./dist/${entry}.mjs`
1040
1048
  },
1041
1049
  require: {
1042
- types: `./dist/${entry}.d.ts`,
1050
+ types: `./dist/${entry}.d.cts`,
1043
1051
  default: `./dist/${entry}.cjs`
1044
1052
  },
1045
1053
  default: {
1046
- types: `./dist/${entry}.d.ts`,
1054
+ types: `./dist/${entry}.d.mts`,
1047
1055
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1048
1056
  }
1049
1057
  };
@@ -1,8 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkOD3ULBE3cjs = require('./chunk-OD3ULBE3.cjs');
4
-
5
-
6
3
  var _chunkWGGER7UIcjs = require('./chunk-WGGER7UI.cjs');
7
4
 
8
5
 
@@ -815,6 +812,7 @@ var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
815
812
 
816
813
 
817
814
  var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
815
+ var _pkgtypes = require('pkg-types');
818
816
  var _unbuild = require('unbuild');
819
817
  async function resolveOptions(options, config) {
820
818
  _chunkK5SEKFQAcjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
@@ -842,11 +840,15 @@ async function resolveOptions(options, config) {
842
840
  const packageJson = JSON.parse(packageJsonContent);
843
841
  let tsconfig = options.tsconfig;
844
842
  if (!tsconfig) {
845
- tsconfig = _chunkK5SEKFQAcjs.joinPaths.call(void 0, config.workspaceRoot, options.projectRoot, "tsconfig.json");
843
+ tsconfig = _chunkK5SEKFQAcjs.joinPaths.call(void 0, options.projectRoot, "tsconfig.json");
844
+ }
845
+ if (!tsconfig.startsWith(config.workspaceRoot)) {
846
+ tsconfig = _chunkK5SEKFQAcjs.joinPaths.call(void 0, config.workspaceRoot, tsconfig);
846
847
  }
847
848
  if (!_fs.existsSync.call(void 0, tsconfig)) {
848
849
  throw new Error("Cannot find tsconfig.json configuration");
849
850
  }
851
+ const tsconfigFile = await _pkgtypes.readTSConfig.call(void 0, tsconfig);
850
852
  let sourceRoot = projectJson.sourceRoot;
851
853
  if (!sourceRoot) {
852
854
  sourceRoot = _chunkK5SEKFQAcjs.joinPaths.call(void 0, options.projectRoot, "src");
@@ -873,10 +875,9 @@ async function resolveOptions(options, config) {
873
875
  sourceRoot,
874
876
  projectName,
875
877
  tsconfig,
876
- platform: _nullishCoalesce(options.platform, () => ( "neutral")),
878
+ platform: options.platform || "neutral",
877
879
  generatePackageJson: true,
878
880
  clean: false,
879
- env: {},
880
881
  entries: entries.reduce((ret, entry) => {
881
882
  let entryPath = entry.replace(options.projectRoot, "");
882
883
  while (entryPath.startsWith(".")) {
@@ -891,17 +892,26 @@ async function resolveOptions(options, config) {
891
892
  builder: "mkdist",
892
893
  input: `./${entryPath}`,
893
894
  outDir,
894
- declaration: options.emitTypes !== false ? "compatible" : false,
895
- format: "esm"
895
+ declaration: options.emitTypes !== false,
896
+ addRelativeDeclarationExtensions: true,
897
+ format: "esm",
898
+ ext: "mjs",
899
+ typescript: {
900
+ compilerOptions: tsconfigFile.compilerOptions
901
+ }
896
902
  });
897
903
  ret.push({
898
904
  name: `${name}-cjs`,
899
905
  builder: "mkdist",
900
906
  input: `./${entryPath}`,
901
907
  outDir,
902
- declaration: options.emitTypes !== false ? "compatible" : false,
908
+ declaration: options.emitTypes !== false,
909
+ addRelativeDeclarationExtensions: true,
903
910
  format: "cjs",
904
- ext: "cjs"
911
+ ext: "cjs",
912
+ typescript: {
913
+ compilerOptions: tsconfigFile.compilerOptions
914
+ }
905
915
  });
906
916
  return ret;
907
917
  }, []),
@@ -910,11 +920,7 @@ async function resolveOptions(options, config) {
910
920
  sourcemap: _nullishCoalesce(options.sourcemap, () => ( !!options.debug)),
911
921
  outDir: outputPath,
912
922
  parallel: true,
913
- stub: false,
914
- stubOptions: {
915
- jiti: {}
916
- },
917
- externals: _nullishCoalesce(options.external, () => ( [])),
923
+ externals: options.external,
918
924
  dependencies: [],
919
925
  peerDependencies: [],
920
926
  devDependencies: [],
@@ -943,12 +949,15 @@ async function resolveOptions(options, config) {
943
949
  resolve: {
944
950
  preferBuiltins: true,
945
951
  extensions: [
952
+ ".tsx",
953
+ ".ts",
954
+ ".cts",
955
+ ".mts",
956
+ ".jsx",
957
+ ".js",
946
958
  ".cjs",
947
959
  ".mjs",
948
- ".js",
949
- ".jsx",
950
- ".ts",
951
- ".tsx",
960
+ ".css",
952
961
  ".json"
953
962
  ]
954
963
  },
@@ -957,7 +966,7 @@ async function resolveOptions(options, config) {
957
966
  sourceMap: _nullishCoalesce(options.sourcemap, () => ( !!options.debug)),
958
967
  splitting: options.splitting !== false,
959
968
  treeShaking: options.treeShaking !== false,
960
- platform: _nullishCoalesce(options.platform, () => ( "neutral")),
969
+ platform: options.platform || "neutral",
961
970
  color: true,
962
971
  logLevel: config.logLevel === _chunkK5SEKFQAcjs.LogLevelLabel.FATAL ? _chunkK5SEKFQAcjs.LogLevelLabel.ERROR : _chunkK5SEKFQAcjs.isVerbose.call(void 0, ) ? "verbose" : config.logLevel
963
972
  }
@@ -994,7 +1003,6 @@ async function resolveOptions(options, config) {
994
1003
  _chunkK5SEKFQAcjs.writeDebug.call(void 0, ` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
995
1004
  opts.plugins = await Promise.all([
996
1005
  _chunkOOFPXPRCcjs.analyzePlugin.call(void 0, resolvedOptions),
997
- _chunkOD3ULBE3cjs.typeDefinitionsPlugin.call(void 0, resolvedOptions),
998
1006
  _chunkVPCO2H3Gcjs.tscPlugin.call(void 0, resolvedOptions),
999
1007
  _chunkX25DCA4Tcjs.onErrorPlugin.call(void 0, resolvedOptions)
1000
1008
  ]);
@@ -1035,15 +1043,15 @@ var addPackageJsonExport = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0,
1035
1043
  }
1036
1044
  return {
1037
1045
  import: {
1038
- types: `./dist/${entry}.d.ts`,
1046
+ types: `./dist/${entry}.d.mts`,
1039
1047
  default: `./dist/${entry}.mjs`
1040
1048
  },
1041
1049
  require: {
1042
- types: `./dist/${entry}.d.ts`,
1050
+ types: `./dist/${entry}.d.cts`,
1043
1051
  default: `./dist/${entry}.cjs`
1044
1052
  },
1045
1053
  default: {
1046
- types: `./dist/${entry}.d.ts`,
1054
+ types: `./dist/${entry}.d.mts`,
1047
1055
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1048
1056
  }
1049
1057
  };
package/dist/index.cjs CHANGED
@@ -5,8 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkSOHZAEOHcjs = require('./chunk-SOHZAEOH.cjs');
9
- require('./chunk-OD3ULBE3.cjs');
8
+ var _chunkYUFE3NLGcjs = require('./chunk-YUFE3NLG.cjs');
10
9
 
11
10
 
12
11
 
@@ -31,4 +30,4 @@ require('./chunk-BGYQAVKQ.cjs');
31
30
 
32
31
 
33
32
 
34
- exports.build = _chunkSOHZAEOHcjs.build; exports.clean = _chunkWGGER7UIcjs.clean; exports.cleanDirectories = _chunkWGGER7UIcjs.cleanDirectories; exports.cleanOutputPath = _chunkSOHZAEOHcjs.cleanOutputPath; exports.copyBuildAssets = _chunkSOHZAEOHcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkVPCO2H3Gcjs.createTsCompilerOptions; exports.executeUnbuild = _chunkSOHZAEOHcjs.executeUnbuild; exports.generatePackageJson = _chunkSOHZAEOHcjs.generatePackageJson; exports.loadConfig = _chunkVPCO2H3Gcjs.loadConfig; exports.resolveOptions = _chunkSOHZAEOHcjs.resolveOptions;
33
+ exports.build = _chunkYUFE3NLGcjs.build; exports.clean = _chunkWGGER7UIcjs.clean; exports.cleanDirectories = _chunkWGGER7UIcjs.cleanDirectories; exports.cleanOutputPath = _chunkYUFE3NLGcjs.cleanOutputPath; exports.copyBuildAssets = _chunkYUFE3NLGcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkVPCO2H3Gcjs.createTsCompilerOptions; exports.executeUnbuild = _chunkYUFE3NLGcjs.executeUnbuild; exports.generatePackageJson = _chunkYUFE3NLGcjs.generatePackageJson; exports.loadConfig = _chunkVPCO2H3Gcjs.loadConfig; exports.resolveOptions = _chunkYUFE3NLGcjs.resolveOptions;
package/dist/index.js CHANGED
@@ -5,8 +5,7 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-JJ5QDPA6.js";
9
- import "./chunk-RBYYB7X2.js";
8
+ } from "./chunk-HIBMLCH5.js";
10
9
  import {
11
10
  clean,
12
11
  cleanDirectories
@@ -1,7 +1,37 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOD3ULBE3cjs = require('../chunk-OD3ULBE3.cjs');
4
- require('../chunk-BGYQAVKQ.cjs');
3
+ var _chunkBGYQAVKQcjs = require('../chunk-BGYQAVKQ.cjs');
5
4
 
5
+ // src/plugins/type-definitions.ts
6
+ var _path = require('path');
7
+ function typeDefinitionsPlugin(options) {
8
+ return {
9
+ name: "storm:dts-bundle",
10
+ async generateBundle(_opts, bundle) {
11
+ for (const file of Object.values(bundle)) {
12
+ if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
13
+ continue;
14
+ }
15
+ const hasDefaultExport = file.exports.includes("default");
16
+ const entrySourceFileName = _path.relative.call(void 0, options.projectRoot, file.facadeModuleId);
17
+ const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
18
+ const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
19
+ const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
20
+ const dtsFileSource = hasDefaultExport ? `
21
+ export * from ${relativeSourceDtsName};
22
+ export { default } from ${relativeSourceDtsName};
23
+ ` : `export * from ${relativeSourceDtsName};
24
+ `;
25
+ this.emitFile({
26
+ type: "asset",
27
+ fileName: dtsFileName,
28
+ source: dtsFileSource
29
+ });
30
+ }
31
+ }
32
+ };
33
+ }
34
+ _chunkBGYQAVKQcjs.__name.call(void 0, typeDefinitionsPlugin, "typeDefinitionsPlugin");
6
35
 
7
- exports.typeDefinitionsPlugin = _chunkOD3ULBE3cjs.typeDefinitionsPlugin;
36
+
37
+ exports.typeDefinitionsPlugin = typeDefinitionsPlugin;
@@ -1,7 +1,37 @@
1
1
  import {
2
- typeDefinitionsPlugin
3
- } from "../chunk-RBYYB7X2.js";
4
- import "../chunk-3GQAWCBQ.js";
2
+ __name
3
+ } from "../chunk-3GQAWCBQ.js";
4
+
5
+ // src/plugins/type-definitions.ts
6
+ import { relative } from "node:path";
7
+ function typeDefinitionsPlugin(options) {
8
+ return {
9
+ name: "storm:dts-bundle",
10
+ async generateBundle(_opts, bundle) {
11
+ for (const file of Object.values(bundle)) {
12
+ if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
13
+ continue;
14
+ }
15
+ const hasDefaultExport = file.exports.includes("default");
16
+ const entrySourceFileName = relative(options.projectRoot, file.facadeModuleId);
17
+ const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
18
+ const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
19
+ const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
20
+ const dtsFileSource = hasDefaultExport ? `
21
+ export * from ${relativeSourceDtsName};
22
+ export { default } from ${relativeSourceDtsName};
23
+ ` : `export * from ${relativeSourceDtsName};
24
+ `;
25
+ this.emitFile({
26
+ type: "asset",
27
+ fileName: dtsFileName,
28
+ source: dtsFileSource
29
+ });
30
+ }
31
+ }
32
+ };
33
+ }
34
+ __name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
5
35
  export {
6
36
  typeDefinitionsPlugin
7
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/unbuild",
3
- "version": "0.37.20",
3
+ "version": "0.38.1",
4
4
  "type": "module",
5
5
  "description": "A package containing `unbuild` utilities for building Storm Software libraries and applications",
6
6
  "repository": {
@@ -138,6 +138,7 @@
138
138
  "@storm-software/build-tools": "workspace:*",
139
139
  "@storm-software/config": "workspace:*",
140
140
  "@storm-software/config-tools": "workspace:*",
141
+ "@swc/core": "1.7.26",
141
142
  "nx": "20.6.0",
142
143
  "rollup": "^4.29.1",
143
144
  "typescript": "^5.7.2"
@@ -148,24 +149,19 @@
148
149
  "@storm-software/build-tools": { "optional": false },
149
150
  "@storm-software/config": { "optional": false },
150
151
  "@storm-software/config-tools": { "optional": false },
152
+ "@swc/core": { "optional": true },
151
153
  "nx": { "optional": true },
152
154
  "rollup": { "optional": false },
153
155
  "typescript": { "optional": false }
154
156
  },
155
157
  "dependencies": {
156
- "@rollup/plugin-alias": "^5.1.1",
157
- "@rollup/plugin-commonjs": "^28.0.2",
158
- "@rollup/plugin-json": "^6.1.0",
159
- "@rollup/plugin-node-resolve": "^16.0.0",
160
- "@rollup/plugin-replace": "^6.0.2",
161
- "@rollup/pluginutils": "^5.1.4",
162
- "@swc/core": "1.7.26",
163
158
  "commander": "^12.1.0",
164
159
  "defu": "6.1.4",
165
160
  "esbuild": "^0.25.0",
166
161
  "glob": "^11.0.1",
167
162
  "jiti": "^2.4.2",
168
163
  "mkdist": "^2.2.0",
164
+ "pkg-types": "^1.3.1",
169
165
  "rollup": "^4.29.1",
170
166
  "rollup-plugin-typescript2": "0.36.0",
171
167
  "unbuild": "^3.2.0"
@@ -1,38 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
4
-
5
- // src/plugins/type-definitions.ts
6
- var _path = require('path');
7
- function typeDefinitionsPlugin(options) {
8
- return {
9
- name: "storm:dts-bundle",
10
- async generateBundle(_opts, bundle) {
11
- for (const file of Object.values(bundle)) {
12
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
13
- continue;
14
- }
15
- const hasDefaultExport = file.exports.includes("default");
16
- const entrySourceFileName = _path.relative.call(void 0, options.projectRoot, file.facadeModuleId);
17
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
18
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
19
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
20
- const dtsFileSource = hasDefaultExport ? `
21
- export * from ${relativeSourceDtsName};
22
- export { default } from ${relativeSourceDtsName};
23
- ` : `export * from ${relativeSourceDtsName};
24
- `;
25
- this.emitFile({
26
- type: "asset",
27
- fileName: dtsFileName,
28
- source: dtsFileSource
29
- });
30
- }
31
- }
32
- };
33
- }
34
- _chunkBGYQAVKQcjs.__name.call(void 0, typeDefinitionsPlugin, "typeDefinitionsPlugin");
35
-
36
-
37
-
38
- exports.typeDefinitionsPlugin = typeDefinitionsPlugin;
@@ -1,38 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-3GQAWCBQ.js";
4
-
5
- // src/plugins/type-definitions.ts
6
- import { relative } from "node:path";
7
- function typeDefinitionsPlugin(options) {
8
- return {
9
- name: "storm:dts-bundle",
10
- async generateBundle(_opts, bundle) {
11
- for (const file of Object.values(bundle)) {
12
- if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
13
- continue;
14
- }
15
- const hasDefaultExport = file.exports.includes("default");
16
- const entrySourceFileName = relative(options.projectRoot, file.facadeModuleId);
17
- const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
18
- const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
19
- const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
20
- const dtsFileSource = hasDefaultExport ? `
21
- export * from ${relativeSourceDtsName};
22
- export { default } from ${relativeSourceDtsName};
23
- ` : `export * from ${relativeSourceDtsName};
24
- `;
25
- this.emitFile({
26
- type: "asset",
27
- fileName: dtsFileName,
28
- source: dtsFileSource
29
- });
30
- }
31
- }
32
- };
33
- }
34
- __name(typeDefinitionsPlugin, "typeDefinitionsPlugin");
35
-
36
- export {
37
- typeDefinitionsPlugin
38
- };