muon-ui 0.6.0 → 0.7.0
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/cli.cjs +368 -15
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native/{linux64 → linux-amd64}/muon-bootstrap +0 -0
- package/dist/native/{linux64 → linux-amd64}/muon-prepare +0 -0
- package/dist/native/{linuxarm64 → linux-arm64}/muon-bootstrap +0 -0
- package/dist/native/{linuxarm64 → linux-arm64}/muon-prepare +0 -0
- package/dist/native/{linuxarm → linux-armhf}/muon-bootstrap +0 -0
- package/dist/native/{linuxarm → linux-armhf}/muon-prepare +0 -0
- package/dist/native/{windows64 → windows-amd64}/muon-bootstrap.exe +0 -0
- package/dist/native/{windows64 → windows-amd64}/muon-prepare.exe +0 -0
- package/dist/native/{windows32/muon-prepare.exe → windows-i686/muon-bootstrap.exe} +0 -0
- package/dist/native/{windows32/muon-bootstrap.exe → windows-i686/muon-prepare.exe} +0 -0
- package/dist/runtime/{linux64 → linux-amd64}/CREDITS.md +0 -97
- package/dist/runtime/{linux64 → linux-amd64}/libmuon-ui.so +0 -0
- package/dist/runtime/linux-amd64/muon-core +0 -0
- package/dist/runtime/{linuxarm → linux-arm64}/CREDITS.md +0 -97
- package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-arm64/muon-core +0 -0
- package/dist/runtime/{windows32 → linux-armhf}/CREDITS.md +0 -97
- package/dist/runtime/{linuxarm → linux-armhf}/libmuon-ui.so +0 -0
- package/dist/runtime/linux-armhf/muon-core +0 -0
- package/dist/runtime/{linuxarm64 → windows-amd64}/CREDITS.md +0 -97
- package/dist/runtime/{windows64 → windows-amd64}/libcardio.dll +0 -0
- package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
- package/dist/runtime/{windows64 → windows-amd64}/muon-core.exe +0 -0
- package/dist/runtime/windows-i686/CREDITS.md +266 -0
- package/dist/runtime/{windows32 → windows-i686}/libcardio.dll +0 -0
- package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
- package/dist/runtime/{windows32 → windows-i686}/muon-core.exe +0 -0
- package/dist/{vite-options-KNDVcH-e.cjs → vite-options-FFh0NWUa.cjs} +227 -136
- package/dist/vite-options-FFh0NWUa.cjs.map +1 -0
- package/dist/vite.cjs +23 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +233 -134
- package/dist/vite.mjs.map +1 -1
- package/images/muon-120.png +0 -0
- package/muon.d.ts +33 -0
- package/package.json +7 -7
- package/vite.d.ts +9 -4
- package/dist/runtime/linux64/muon-core +0 -0
- package/dist/runtime/linuxarm/muon-core +0 -0
- package/dist/runtime/linuxarm64/libmuon-ui.so +0 -0
- package/dist/runtime/linuxarm64/muon-core +0 -0
- package/dist/runtime/windows32/libmuon-ui.dll +0 -0
- package/dist/runtime/windows64/CREDITS.md +0 -363
- package/dist/runtime/windows64/libmuon-ui.dll +0 -0
- package/dist/vite-options-KNDVcH-e.cjs.map +0 -1
- /package/dist/runtime/{linux64 → linux-amd64}/libcardio.so +0 -0
- /package/dist/runtime/{linuxarm64 → linux-arm64}/libcardio.so +0 -0
- /package/dist/runtime/{linuxarm → linux-armhf}/libcardio.so +0 -0
- /package/dist/runtime/{windows64 → windows-amd64}/libgcc_s_seh-1.dll +0 -0
- /package/dist/runtime/{windows64 → windows-amd64}/libstdc++-6.dll +0 -0
- /package/dist/runtime/{windows32 → windows-i686}/libgcc_s_dw2-1.dll +0 -0
- /package/dist/runtime/{windows32 → windows-i686}/libstdc++-6.dll +0 -0
package/dist/vite.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: muon-ui
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.7.0
|
|
4
4
|
* description: A multi-platform GUI application framework that uses CEF as its backend
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/muon-ui.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: fe80718aaa617c0c0ea5c816bbe38d22bf2e8402
|
|
9
9
|
*/
|
|
10
10
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
11
11
|
import { constants, writeFileSync } from "node:fs";
|
|
@@ -1554,6 +1554,144 @@ var embedMuonConfigInRuntime = async ({ runtimePath, configPath, outputRuntimePa
|
|
|
1554
1554
|
});
|
|
1555
1555
|
};
|
|
1556
1556
|
//#endregion
|
|
1557
|
+
//#region src/targets.ts
|
|
1558
|
+
/**
|
|
1559
|
+
* Supported public Muon targets in deterministic build order.
|
|
1560
|
+
*/
|
|
1561
|
+
var allMuonTargets = [
|
|
1562
|
+
"linux-amd64",
|
|
1563
|
+
"linux-armhf",
|
|
1564
|
+
"linux-arm64",
|
|
1565
|
+
"windows-i686",
|
|
1566
|
+
"windows-amd64"
|
|
1567
|
+
];
|
|
1568
|
+
var targetDescriptors = {
|
|
1569
|
+
"linux-amd64": {
|
|
1570
|
+
id: "linux-amd64",
|
|
1571
|
+
cefTarget: "linux64",
|
|
1572
|
+
os: "linux",
|
|
1573
|
+
arch: "amd64",
|
|
1574
|
+
distributionDirectoryName: "dist-muon-linux-amd64",
|
|
1575
|
+
runtimeExecutableName: "muon-core",
|
|
1576
|
+
bootstrapExecutableName: "muon-bootstrap",
|
|
1577
|
+
launcherExtension: "",
|
|
1578
|
+
runtimeFiles: [
|
|
1579
|
+
"muon-core",
|
|
1580
|
+
"libmuon-ui.so",
|
|
1581
|
+
"libcardio.so"
|
|
1582
|
+
]
|
|
1583
|
+
},
|
|
1584
|
+
"linux-armhf": {
|
|
1585
|
+
id: "linux-armhf",
|
|
1586
|
+
cefTarget: "linuxarm",
|
|
1587
|
+
os: "linux",
|
|
1588
|
+
arch: "armhf",
|
|
1589
|
+
distributionDirectoryName: "dist-muon-linux-armhf",
|
|
1590
|
+
runtimeExecutableName: "muon-core",
|
|
1591
|
+
bootstrapExecutableName: "muon-bootstrap",
|
|
1592
|
+
launcherExtension: "",
|
|
1593
|
+
runtimeFiles: [
|
|
1594
|
+
"muon-core",
|
|
1595
|
+
"libmuon-ui.so",
|
|
1596
|
+
"libcardio.so"
|
|
1597
|
+
]
|
|
1598
|
+
},
|
|
1599
|
+
"linux-arm64": {
|
|
1600
|
+
id: "linux-arm64",
|
|
1601
|
+
cefTarget: "linuxarm64",
|
|
1602
|
+
os: "linux",
|
|
1603
|
+
arch: "arm64",
|
|
1604
|
+
distributionDirectoryName: "dist-muon-linux-arm64",
|
|
1605
|
+
runtimeExecutableName: "muon-core",
|
|
1606
|
+
bootstrapExecutableName: "muon-bootstrap",
|
|
1607
|
+
launcherExtension: "",
|
|
1608
|
+
runtimeFiles: [
|
|
1609
|
+
"muon-core",
|
|
1610
|
+
"libmuon-ui.so",
|
|
1611
|
+
"libcardio.so"
|
|
1612
|
+
]
|
|
1613
|
+
},
|
|
1614
|
+
"windows-i686": {
|
|
1615
|
+
id: "windows-i686",
|
|
1616
|
+
cefTarget: "windows32",
|
|
1617
|
+
os: "windows",
|
|
1618
|
+
arch: "i686",
|
|
1619
|
+
distributionDirectoryName: "dist-muon-windows-i686",
|
|
1620
|
+
runtimeExecutableName: "muon-core.exe",
|
|
1621
|
+
bootstrapExecutableName: "muon-bootstrap.exe",
|
|
1622
|
+
launcherExtension: ".exe",
|
|
1623
|
+
runtimeFiles: [
|
|
1624
|
+
"muon-core.exe",
|
|
1625
|
+
"libmuon-ui.dll",
|
|
1626
|
+
"libcardio.dll"
|
|
1627
|
+
],
|
|
1628
|
+
optionalRuntimeFilePatterns: [
|
|
1629
|
+
/^libgcc_s_.*-1\.dll$/,
|
|
1630
|
+
/^libstdc\+\+-6\.dll$/,
|
|
1631
|
+
/^libwinpthread-1\.dll$/
|
|
1632
|
+
]
|
|
1633
|
+
},
|
|
1634
|
+
"windows-amd64": {
|
|
1635
|
+
id: "windows-amd64",
|
|
1636
|
+
cefTarget: "windows64",
|
|
1637
|
+
os: "windows",
|
|
1638
|
+
arch: "amd64",
|
|
1639
|
+
distributionDirectoryName: "dist-muon-windows-amd64",
|
|
1640
|
+
runtimeExecutableName: "muon-core.exe",
|
|
1641
|
+
bootstrapExecutableName: "muon-bootstrap.exe",
|
|
1642
|
+
launcherExtension: ".exe",
|
|
1643
|
+
runtimeFiles: [
|
|
1644
|
+
"muon-core.exe",
|
|
1645
|
+
"libmuon-ui.dll",
|
|
1646
|
+
"libcardio.dll"
|
|
1647
|
+
],
|
|
1648
|
+
optionalRuntimeFilePatterns: [
|
|
1649
|
+
/^libgcc_s_.*-1\.dll$/,
|
|
1650
|
+
/^libstdc\+\+-6\.dll$/,
|
|
1651
|
+
/^libwinpthread-1\.dll$/
|
|
1652
|
+
]
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
Object.fromEntries(allMuonTargets.map((target) => [targetDescriptors[target].cefTarget, target]));
|
|
1656
|
+
/**
|
|
1657
|
+
* Returns metadata for a public Muon target.
|
|
1658
|
+
*
|
|
1659
|
+
* @param target Public Muon target.
|
|
1660
|
+
* @returns Target descriptor.
|
|
1661
|
+
*/
|
|
1662
|
+
var getMuonTargetDescriptor = (target) => targetDescriptors[target];
|
|
1663
|
+
/**
|
|
1664
|
+
* Normalizes a user supplied public Muon target.
|
|
1665
|
+
*
|
|
1666
|
+
* @param target Target value supplied by the user.
|
|
1667
|
+
* @param label Error label used in diagnostics.
|
|
1668
|
+
* @returns Public Muon target.
|
|
1669
|
+
*/
|
|
1670
|
+
var normalizeMuonTarget = (target, label = "Muon target") => {
|
|
1671
|
+
const normalized = target.trim().toLowerCase();
|
|
1672
|
+
if (allMuonTargets.includes(normalized)) return normalized;
|
|
1673
|
+
throw new Error(`Unsupported ${label}: ${target}`);
|
|
1674
|
+
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Resolves a Node platform and architecture pair to a public Muon target.
|
|
1677
|
+
*
|
|
1678
|
+
* @param platform Node platform.
|
|
1679
|
+
* @param architecture Node architecture.
|
|
1680
|
+
* @returns Public Muon target.
|
|
1681
|
+
*/
|
|
1682
|
+
var getDefaultMuonTarget = (platform, architecture) => {
|
|
1683
|
+
if (platform === "win32") {
|
|
1684
|
+
if (architecture === "ia32") return "windows-i686";
|
|
1685
|
+
if (architecture === "x64") return "windows-amd64";
|
|
1686
|
+
}
|
|
1687
|
+
if (platform === "linux") {
|
|
1688
|
+
if (architecture === "x64") return "linux-amd64";
|
|
1689
|
+
if (architecture === "arm") return "linux-armhf";
|
|
1690
|
+
if (architecture === "arm64") return "linux-arm64";
|
|
1691
|
+
}
|
|
1692
|
+
throw new Error(`Unsupported Muon target: platform=${platform}, arch=${architecture}`);
|
|
1693
|
+
};
|
|
1694
|
+
//#endregion
|
|
1557
1695
|
//#region src/prepare.ts
|
|
1558
1696
|
/**
|
|
1559
1697
|
* Returns the default Muon prepare target for a Node platform and architecture.
|
|
@@ -1563,16 +1701,11 @@ var embedMuonConfigInRuntime = async ({ runtimePath, configPath, outputRuntimePa
|
|
|
1563
1701
|
* @returns Muon prepare target name.
|
|
1564
1702
|
*/
|
|
1565
1703
|
var getDefaultMuonPrepareTarget = (platform, architecture) => {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
if (platform === "linux") {
|
|
1571
|
-
if (architecture === "x64") return "linux64";
|
|
1572
|
-
if (architecture === "arm") return "linuxarm";
|
|
1573
|
-
if (architecture === "arm64") return "linuxarm64";
|
|
1704
|
+
try {
|
|
1705
|
+
return getDefaultMuonTarget(platform, architecture);
|
|
1706
|
+
} catch {
|
|
1707
|
+
throw new Error(`Unsupported Muon prepare target: platform=${platform}, arch=${architecture}`);
|
|
1574
1708
|
}
|
|
1575
|
-
throw new Error(`Unsupported Muon prepare target: platform=${platform}, arch=${architecture}`);
|
|
1576
1709
|
};
|
|
1577
1710
|
var getPrepareExecutableName = (platform) => platform === "win32" ? "muon-prepare.exe" : "muon-prepare";
|
|
1578
1711
|
var moduleDirectory$2 = typeof __dirname === "string" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
@@ -1602,7 +1735,7 @@ var createMuonPrepareArguments = (options) => {
|
|
|
1602
1735
|
];
|
|
1603
1736
|
if (options.cefPath !== void 0) args.push("--cef-path", options.cefPath);
|
|
1604
1737
|
if (options.stageDir !== void 0) args.push("--stage-dir", options.stageDir);
|
|
1605
|
-
if (options.target !== void 0) args.push("--target", options.target);
|
|
1738
|
+
if (options.target !== void 0) args.push("--target", normalizeMuonTarget(options.target, "Muon prepare target"));
|
|
1606
1739
|
if (options.cacheDir !== void 0) args.push("--cache-dir", options.cacheDir);
|
|
1607
1740
|
if (options.force) args.push("--force");
|
|
1608
1741
|
if (options.quiet) args.push("--quiet");
|
|
@@ -1673,107 +1806,6 @@ function __resolveDefaultExport(module, isESM) {
|
|
|
1673
1806
|
}
|
|
1674
1807
|
return hasDefault ? resolvedDefault ?? module : module;
|
|
1675
1808
|
}
|
|
1676
|
-
var allTargets = [
|
|
1677
|
-
"linux64",
|
|
1678
|
-
"linuxarm",
|
|
1679
|
-
"linuxarm64",
|
|
1680
|
-
"windows32",
|
|
1681
|
-
"windows64"
|
|
1682
|
-
];
|
|
1683
|
-
var targetAliases = {
|
|
1684
|
-
linux64: "linux64",
|
|
1685
|
-
"linux-amd64": "linux64",
|
|
1686
|
-
"linux-x64": "linux64",
|
|
1687
|
-
amd64: "linux64",
|
|
1688
|
-
x64: "linux64",
|
|
1689
|
-
linuxarm: "linuxarm",
|
|
1690
|
-
"linux-arm": "linuxarm",
|
|
1691
|
-
"linux-armv7l": "linuxarm",
|
|
1692
|
-
arm: "linuxarm",
|
|
1693
|
-
armv7l: "linuxarm",
|
|
1694
|
-
linuxarm64: "linuxarm64",
|
|
1695
|
-
"linux-arm64": "linuxarm64",
|
|
1696
|
-
"linux-aarch64": "linuxarm64",
|
|
1697
|
-
arm64: "linuxarm64",
|
|
1698
|
-
aarch64: "linuxarm64",
|
|
1699
|
-
windows32: "windows32",
|
|
1700
|
-
"windows-i686": "windows32",
|
|
1701
|
-
"windows-ia32": "windows32",
|
|
1702
|
-
win32: "windows32",
|
|
1703
|
-
i686: "windows32",
|
|
1704
|
-
ia32: "windows32",
|
|
1705
|
-
windows64: "windows64",
|
|
1706
|
-
"windows-amd64": "windows64",
|
|
1707
|
-
"windows-x64": "windows64",
|
|
1708
|
-
win64: "windows64"
|
|
1709
|
-
};
|
|
1710
|
-
var targetDescriptors = {
|
|
1711
|
-
linux64: {
|
|
1712
|
-
distributionDirectoryName: "dist-linux-amd64",
|
|
1713
|
-
runtimeExecutableName: "muon-core",
|
|
1714
|
-
bootstrapExecutableName: "muon-bootstrap",
|
|
1715
|
-
launcherExtension: "",
|
|
1716
|
-
runtimeFiles: [
|
|
1717
|
-
"muon-core",
|
|
1718
|
-
"libmuon-ui.so",
|
|
1719
|
-
"libcardio.so"
|
|
1720
|
-
]
|
|
1721
|
-
},
|
|
1722
|
-
linuxarm: {
|
|
1723
|
-
distributionDirectoryName: "dist-linux-armv7l",
|
|
1724
|
-
runtimeExecutableName: "muon-core",
|
|
1725
|
-
bootstrapExecutableName: "muon-bootstrap",
|
|
1726
|
-
launcherExtension: "",
|
|
1727
|
-
runtimeFiles: [
|
|
1728
|
-
"muon-core",
|
|
1729
|
-
"libmuon-ui.so",
|
|
1730
|
-
"libcardio.so"
|
|
1731
|
-
]
|
|
1732
|
-
},
|
|
1733
|
-
linuxarm64: {
|
|
1734
|
-
distributionDirectoryName: "dist-linux-arm64",
|
|
1735
|
-
runtimeExecutableName: "muon-core",
|
|
1736
|
-
bootstrapExecutableName: "muon-bootstrap",
|
|
1737
|
-
launcherExtension: "",
|
|
1738
|
-
runtimeFiles: [
|
|
1739
|
-
"muon-core",
|
|
1740
|
-
"libmuon-ui.so",
|
|
1741
|
-
"libcardio.so"
|
|
1742
|
-
]
|
|
1743
|
-
},
|
|
1744
|
-
windows32: {
|
|
1745
|
-
distributionDirectoryName: "dist-windows-i686",
|
|
1746
|
-
runtimeExecutableName: "muon-core.exe",
|
|
1747
|
-
bootstrapExecutableName: "muon-bootstrap.exe",
|
|
1748
|
-
launcherExtension: ".exe",
|
|
1749
|
-
runtimeFiles: [
|
|
1750
|
-
"muon-core.exe",
|
|
1751
|
-
"libmuon-ui.dll",
|
|
1752
|
-
"libcardio.dll"
|
|
1753
|
-
],
|
|
1754
|
-
optionalRuntimeFilePatterns: [
|
|
1755
|
-
/^libgcc_s_.*-1\.dll$/,
|
|
1756
|
-
/^libstdc\+\+-6\.dll$/,
|
|
1757
|
-
/^libwinpthread-1\.dll$/
|
|
1758
|
-
]
|
|
1759
|
-
},
|
|
1760
|
-
windows64: {
|
|
1761
|
-
distributionDirectoryName: "dist-windows-amd64",
|
|
1762
|
-
runtimeExecutableName: "muon-core.exe",
|
|
1763
|
-
bootstrapExecutableName: "muon-bootstrap.exe",
|
|
1764
|
-
launcherExtension: ".exe",
|
|
1765
|
-
runtimeFiles: [
|
|
1766
|
-
"muon-core.exe",
|
|
1767
|
-
"libmuon-ui.dll",
|
|
1768
|
-
"libcardio.dll"
|
|
1769
|
-
],
|
|
1770
|
-
optionalRuntimeFilePatterns: [
|
|
1771
|
-
/^libgcc_s_.*-1\.dll$/,
|
|
1772
|
-
/^libstdc\+\+-6\.dll$/,
|
|
1773
|
-
/^libwinpthread-1\.dll$/
|
|
1774
|
-
]
|
|
1775
|
-
}
|
|
1776
|
-
};
|
|
1777
1809
|
var defaultConfigFileNames = [
|
|
1778
1810
|
"muon.json5",
|
|
1779
1811
|
"muon.jsonc",
|
|
@@ -1781,6 +1813,7 @@ var defaultConfigFileNames = [
|
|
|
1781
1813
|
];
|
|
1782
1814
|
var appConfigSourcePath = "./assets.zip";
|
|
1783
1815
|
var defaultAppName = "muon-app";
|
|
1816
|
+
var defaultAppId = "muon-app";
|
|
1784
1817
|
var muonLicenseFileName = "CREDITS.md";
|
|
1785
1818
|
var directoryMode = 493;
|
|
1786
1819
|
var executableMode = 493;
|
|
@@ -1790,17 +1823,13 @@ var moduleDirectory$1 = typeof __dirname === "string" ? __dirname : dirname(file
|
|
|
1790
1823
|
* Returns the host target used by muon build when no explicit target is passed.
|
|
1791
1824
|
*/
|
|
1792
1825
|
var getDefaultMuonBuildTarget = () => {
|
|
1793
|
-
return
|
|
1826
|
+
return getDefaultMuonPrepareTarget(process.platform, process.arch);
|
|
1794
1827
|
};
|
|
1795
1828
|
/**
|
|
1796
|
-
* Normalizes a user-facing
|
|
1829
|
+
* Normalizes a user-facing public target identifier.
|
|
1797
1830
|
*/
|
|
1798
1831
|
var normalizeMuonBuildTarget = (target) => {
|
|
1799
|
-
|
|
1800
|
-
if (normalized === "linux-i686" || normalized === "linux-ia32") throw new Error("Linux i686 is not supported by muon build.");
|
|
1801
|
-
const resolvedTarget = targetAliases[normalized];
|
|
1802
|
-
if (resolvedTarget === void 0) throw new Error(`Unsupported muon build target: ${target}`);
|
|
1803
|
-
return resolvedTarget;
|
|
1832
|
+
return normalizeMuonTarget(target, "muon build target");
|
|
1804
1833
|
};
|
|
1805
1834
|
/**
|
|
1806
1835
|
* Builds CEF-free Muon app distribution directories for one or more targets.
|
|
@@ -1810,7 +1839,9 @@ var buildMuonApp = async (options = {}) => {
|
|
|
1810
1839
|
const packageDirectory = resolvePackageDirectory(options.packageDirectory);
|
|
1811
1840
|
const targets = resolveBuildTargets(options);
|
|
1812
1841
|
const outputRoot = resolve(root, options.outputRoot ?? ".");
|
|
1813
|
-
const
|
|
1842
|
+
const packageJson = await readPackageJson(root);
|
|
1843
|
+
const appName = resolveAppName(packageJson, options.appName);
|
|
1844
|
+
const appId = resolveAppId(packageJson, options.appId);
|
|
1814
1845
|
const buildConfig = await readBuildConfig(root, options.configPath);
|
|
1815
1846
|
const assetInput = resolveAssetInput(root, options.assetSourcePath, options.assetPrefix, buildConfig);
|
|
1816
1847
|
const salt = Buffer.from(options.assetSalt ?? randomBytes(assetSaltByteLength));
|
|
@@ -1820,6 +1851,7 @@ var buildMuonApp = async (options = {}) => {
|
|
|
1820
1851
|
packageDirectory,
|
|
1821
1852
|
outputRoot,
|
|
1822
1853
|
appName,
|
|
1854
|
+
appId,
|
|
1823
1855
|
target,
|
|
1824
1856
|
assetInput,
|
|
1825
1857
|
sourceConfig: buildConfig.config,
|
|
@@ -1830,6 +1862,7 @@ var buildMuonApp = async (options = {}) => {
|
|
|
1830
1862
|
return {
|
|
1831
1863
|
root,
|
|
1832
1864
|
appName,
|
|
1865
|
+
appId,
|
|
1833
1866
|
targets: results
|
|
1834
1867
|
};
|
|
1835
1868
|
};
|
|
@@ -1838,9 +1871,9 @@ var resolvePackageDirectory = (packageDirectory) => {
|
|
|
1838
1871
|
return moduleDirectory$1;
|
|
1839
1872
|
};
|
|
1840
1873
|
var resolveBuildTargets = (options) => {
|
|
1841
|
-
if (options.allTargets === true) return [...
|
|
1874
|
+
if (options.allTargets === true) return [...allMuonTargets];
|
|
1842
1875
|
if (options.targets !== void 0 && options.targets.length > 0) return [...new Set(options.targets.map((target) => normalizeMuonBuildTarget(target)))];
|
|
1843
|
-
if (options.allTargets !== false) return [...
|
|
1876
|
+
if (options.allTargets !== false) return [...allMuonTargets];
|
|
1844
1877
|
return [getDefaultMuonBuildTarget()];
|
|
1845
1878
|
};
|
|
1846
1879
|
var resolveAssetInput = (root, assetSourcePath, assetPrefix, buildConfig) => {
|
|
@@ -1854,16 +1887,31 @@ var normalizeZipPrefix = (prefix) => {
|
|
|
1854
1887
|
const normalized = prefix.replaceAll("\\", "/").split("/").filter((part) => part.length > 0).join("/");
|
|
1855
1888
|
return normalized.length > 0 ? `${normalized}/` : "";
|
|
1856
1889
|
};
|
|
1857
|
-
var
|
|
1890
|
+
var readPackageJson = async (root) => {
|
|
1891
|
+
const packageJsonPath = join(root, "package.json");
|
|
1892
|
+
if (!await fileExists$1(packageJsonPath)) return {};
|
|
1893
|
+
return await readJsonObjectFile(packageJsonPath, "package.json");
|
|
1894
|
+
};
|
|
1895
|
+
var resolvePackageName = (packageJson) => {
|
|
1896
|
+
return typeof packageJson.name === "string" ? packageJson.name : defaultAppName;
|
|
1897
|
+
};
|
|
1898
|
+
var resolveAppName = (packageJson, appName) => {
|
|
1858
1899
|
if (appName !== void 0) return sanitizeAppName(appName);
|
|
1859
|
-
const
|
|
1860
|
-
const packageName = typeof packageJson.name === "string" ? packageJson.name : defaultAppName;
|
|
1900
|
+
const packageName = resolvePackageName(packageJson);
|
|
1861
1901
|
return sanitizeAppName(packageName.startsWith("@") ? packageName.slice(packageName.indexOf("/") + 1) : packageName);
|
|
1862
1902
|
};
|
|
1863
1903
|
var sanitizeAppName = (name) => {
|
|
1864
1904
|
const sanitized = name.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[.-]+/g, "").replace(/[.-]+$/g, "");
|
|
1865
1905
|
return sanitized.length > 0 ? sanitized : defaultAppName;
|
|
1866
1906
|
};
|
|
1907
|
+
var resolveAppId = (packageJson, appId) => {
|
|
1908
|
+
if (appId !== void 0) return sanitizeAppId(appId);
|
|
1909
|
+
return sanitizeAppId(resolvePackageName(packageJson));
|
|
1910
|
+
};
|
|
1911
|
+
var sanitizeAppId = (value) => {
|
|
1912
|
+
const sanitized = (value.startsWith("@") ? value.slice(1) : value).trim().toLowerCase().replace("/", ".").replace(/[^a-z0-9._-]+/g, ".").replace(/^[.]+/g, "").replace(/[.]+$/g, "");
|
|
1913
|
+
return sanitized.length > 0 ? sanitized : defaultAppId;
|
|
1914
|
+
};
|
|
1867
1915
|
var readBuildConfig = async (root, configPath) => {
|
|
1868
1916
|
const resolvedConfigPath = await resolveConfigPath(root, configPath);
|
|
1869
1917
|
if (resolvedConfigPath === void 0) return {
|
|
@@ -1912,7 +1960,7 @@ var readJsonObjectFile = async (filePath, label) => {
|
|
|
1912
1960
|
return parsed;
|
|
1913
1961
|
};
|
|
1914
1962
|
var buildMuonTarget = async (input) => {
|
|
1915
|
-
const descriptor =
|
|
1963
|
+
const descriptor = getMuonTargetDescriptor(input.target);
|
|
1916
1964
|
const sourceRuntimePath = join(input.packageDirectory, "runtime", input.target);
|
|
1917
1965
|
const sourceBootstrapPath = join(input.packageDirectory, "native", input.target, descriptor.bootstrapExecutableName);
|
|
1918
1966
|
const outputPath = join(input.outputRoot, descriptor.distributionDirectoryName);
|
|
@@ -1937,7 +1985,7 @@ var buildMuonTarget = async (input) => {
|
|
|
1937
1985
|
await copyFile(sourceBootstrapPath, launcherPath);
|
|
1938
1986
|
await chmod(launcherPath, executableMode);
|
|
1939
1987
|
const asset = await writeAssetArchive(input.assetInput, assetZipPath, input.salt);
|
|
1940
|
-
const embeddedConfig = createEmbeddedConfig(input.sourceConfig, asset);
|
|
1988
|
+
const embeddedConfig = createEmbeddedConfig(input.sourceConfig, asset, input.appId);
|
|
1941
1989
|
await withTemporaryConfig(embeddedConfig, async (configPath) => {
|
|
1942
1990
|
await embedMuonConfigInRuntime({
|
|
1943
1991
|
runtimePath: outputPath,
|
|
@@ -2031,9 +2079,11 @@ var createZipArchive = (entries) => {
|
|
|
2031
2079
|
for (const entry of entries) zip.addFile(entry.name, entry.data);
|
|
2032
2080
|
return zip.toBuffer();
|
|
2033
2081
|
};
|
|
2034
|
-
var createEmbeddedConfig = (sourceConfig, asset) => {
|
|
2082
|
+
var createEmbeddedConfig = (sourceConfig, asset, appId) => {
|
|
2035
2083
|
const sourceAsset = sourceConfig.asset;
|
|
2036
2084
|
if (sourceAsset !== void 0 && !isJsonObject$1(sourceAsset)) throw new Error("muon.json asset must be an object when present.");
|
|
2085
|
+
const sourceBootstrap = sourceConfig.bootstrap;
|
|
2086
|
+
if (sourceBootstrap !== void 0 && !isJsonObject$1(sourceBootstrap)) throw new Error("muon.json bootstrap must be an object when present.");
|
|
2037
2087
|
return {
|
|
2038
2088
|
...sourceConfig,
|
|
2039
2089
|
asset: {
|
|
@@ -2041,6 +2091,10 @@ var createEmbeddedConfig = (sourceConfig, asset) => {
|
|
|
2041
2091
|
sourcePath: appConfigSourcePath,
|
|
2042
2092
|
signature: asset.signature,
|
|
2043
2093
|
salt: asset.salt
|
|
2094
|
+
},
|
|
2095
|
+
bootstrap: {
|
|
2096
|
+
...sourceBootstrap ?? {},
|
|
2097
|
+
appId
|
|
2044
2098
|
}
|
|
2045
2099
|
};
|
|
2046
2100
|
};
|
|
@@ -2086,11 +2140,35 @@ var isJsonObject$1 = (value) => {
|
|
|
2086
2140
|
var getErrorMessage$1 = (error) => error instanceof Error ? error.message : String(error);
|
|
2087
2141
|
//#endregion
|
|
2088
2142
|
//#region src/gitignore.ts
|
|
2089
|
-
var
|
|
2143
|
+
var muonGitignoreEntries = [
|
|
2144
|
+
".muon/",
|
|
2145
|
+
"dist-muon-*/",
|
|
2146
|
+
"artifacts/"
|
|
2147
|
+
];
|
|
2148
|
+
var muonGitignoreEntryAliases = {
|
|
2149
|
+
".muon/": [
|
|
2150
|
+
".muon/",
|
|
2151
|
+
"/.muon/",
|
|
2152
|
+
".muon",
|
|
2153
|
+
"/.muon"
|
|
2154
|
+
],
|
|
2155
|
+
"dist-muon-*/": [
|
|
2156
|
+
"dist-muon-*/",
|
|
2157
|
+
"/dist-muon-*/",
|
|
2158
|
+
"dist-muon-*",
|
|
2159
|
+
"/dist-muon-*"
|
|
2160
|
+
],
|
|
2161
|
+
"artifacts/": [
|
|
2162
|
+
"artifacts/",
|
|
2163
|
+
"/artifacts/",
|
|
2164
|
+
"artifacts",
|
|
2165
|
+
"/artifacts"
|
|
2166
|
+
]
|
|
2167
|
+
};
|
|
2090
2168
|
var isMissingFileError = (error) => error instanceof Error && error.code === "ENOENT";
|
|
2091
|
-
var hasMuonGitignoreEntry = (content) => content.split(/\r?\n/).map((line) => line.trim()).some((line) =>
|
|
2169
|
+
var hasMuonGitignoreEntry = (content, entry) => content.split(/\r?\n/).map((line) => line.trim()).some((line) => muonGitignoreEntryAliases[entry].includes(line));
|
|
2092
2170
|
/**
|
|
2093
|
-
* Adds
|
|
2171
|
+
* Adds Muon generated directories to a project .gitignore file.
|
|
2094
2172
|
*
|
|
2095
2173
|
* @param root Project root containing the .gitignore file.
|
|
2096
2174
|
* @returns Gitignore update result.
|
|
@@ -2103,12 +2181,13 @@ var ensureMuonGitignoreEntry = async (root) => {
|
|
|
2103
2181
|
} catch (error) {
|
|
2104
2182
|
if (!isMissingFileError(error)) throw error;
|
|
2105
2183
|
}
|
|
2106
|
-
|
|
2184
|
+
const missingEntries = muonGitignoreEntries.filter((entry) => !hasMuonGitignoreEntry(content, entry));
|
|
2185
|
+
if (missingEntries.length === 0) return {
|
|
2107
2186
|
gitignorePath,
|
|
2108
2187
|
changed: false
|
|
2109
2188
|
};
|
|
2110
2189
|
const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
2111
|
-
await writeFile(gitignorePath, `${content}${separator}${
|
|
2190
|
+
await writeFile(gitignorePath, `${content}${separator}${missingEntries.join("\n")}\n`);
|
|
2112
2191
|
return {
|
|
2113
2192
|
gitignorePath,
|
|
2114
2193
|
changed: true
|
|
@@ -2377,6 +2456,7 @@ var attachMuonVitePluginOptions = (plugin, options) => {
|
|
|
2377
2456
|
};
|
|
2378
2457
|
//#endregion
|
|
2379
2458
|
//#region src/vite.ts
|
|
2459
|
+
var suppressViteMuonBuildEnvironmentKey = "MUON_SUPPRESS_VITE_MUON_BUILD";
|
|
2380
2460
|
/**
|
|
2381
2461
|
* Creates a Vite plugin that launches Muon during Vite dev startup.
|
|
2382
2462
|
*
|
|
@@ -2387,6 +2467,10 @@ var muon = (options = {}) => {
|
|
|
2387
2467
|
let resolvedConfig = void 0;
|
|
2388
2468
|
return attachMuonVitePluginOptions({
|
|
2389
2469
|
name: "muon",
|
|
2470
|
+
config: (config) => {
|
|
2471
|
+
if (config.server?.watch === null) return null;
|
|
2472
|
+
return { server: { watch: createMuonWatchOptions(config.server?.watch) } };
|
|
2473
|
+
},
|
|
2390
2474
|
configResolved: (config) => {
|
|
2391
2475
|
resolvedConfig = config;
|
|
2392
2476
|
},
|
|
@@ -2401,12 +2485,26 @@ var muon = (options = {}) => {
|
|
|
2401
2485
|
},
|
|
2402
2486
|
closeBundle: async () => {
|
|
2403
2487
|
if (resolvedConfig === void 0 || resolvedConfig.command !== "build") return;
|
|
2488
|
+
if (process.env[suppressViteMuonBuildEnvironmentKey] === "1") return;
|
|
2404
2489
|
if (options.build === false) return;
|
|
2405
2490
|
const buildOptions = typeof options.build === "object" ? options.build : {};
|
|
2406
2491
|
await buildMuonApp(createMuonBuildOptions(resolvedConfig, buildOptions));
|
|
2407
2492
|
}
|
|
2408
2493
|
}, options);
|
|
2409
2494
|
};
|
|
2495
|
+
var isMuonStagingWatchPath = (path) => {
|
|
2496
|
+
const normalized = path.replaceAll("\\", "/");
|
|
2497
|
+
return normalized === ".muon" || normalized.startsWith(".muon/") || normalized.endsWith("/.muon") || normalized.includes("/.muon/");
|
|
2498
|
+
};
|
|
2499
|
+
var mergeMuonWatchIgnored = (ignored) => {
|
|
2500
|
+
const muonIgnored = (path) => isMuonStagingWatchPath(path);
|
|
2501
|
+
if (ignored === void 0) return muonIgnored;
|
|
2502
|
+
return Array.isArray(ignored) ? [...ignored, muonIgnored] : [ignored, muonIgnored];
|
|
2503
|
+
};
|
|
2504
|
+
var createMuonWatchOptions = (watch) => ({
|
|
2505
|
+
...watch ?? {},
|
|
2506
|
+
ignored: mergeMuonWatchIgnored(watch?.ignored)
|
|
2507
|
+
});
|
|
2410
2508
|
var createMuonBuildOptions = (config, buildOptions) => {
|
|
2411
2509
|
const outDir = isAbsolute(config.build.outDir) ? config.build.outDir : resolve(config.root, config.build.outDir);
|
|
2412
2510
|
const options = {
|
|
@@ -2417,6 +2515,7 @@ var createMuonBuildOptions = (config, buildOptions) => {
|
|
|
2417
2515
|
if (buildOptions.allTargets !== void 0) options.allTargets = buildOptions.allTargets;
|
|
2418
2516
|
if (buildOptions.targets !== void 0) options.targets = buildOptions.targets;
|
|
2419
2517
|
if (buildOptions.appName !== void 0) options.appName = buildOptions.appName;
|
|
2518
|
+
if (buildOptions.appId !== void 0) options.appId = buildOptions.appId;
|
|
2420
2519
|
if (buildOptions.outputRoot !== void 0) options.outputRoot = buildOptions.outputRoot;
|
|
2421
2520
|
if (buildOptions.configPath !== void 0) options.configPath = buildOptions.configPath;
|
|
2422
2521
|
if (buildOptions.packageDirectory !== void 0) options.packageDirectory = buildOptions.packageDirectory;
|