muon-ui 0.1.0 → 0.3.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/README.md +1 -1
- package/dist/{build-CCuZpajl.cjs → build-xwfaxosJ.cjs} +121 -28
- package/dist/build-xwfaxosJ.cjs.map +1 -0
- package/dist/cli.cjs +19 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native/linux64/muon-bootstrap +0 -0
- package/dist/native/linux64/muon-prepare +0 -0
- package/dist/native/linuxarm/muon-bootstrap +0 -0
- package/dist/native/linuxarm/muon-prepare +0 -0
- package/dist/native/linuxarm64/muon-bootstrap +0 -0
- package/dist/native/linuxarm64/muon-prepare +0 -0
- package/dist/native/windows32/muon-bootstrap.exe +0 -0
- package/dist/native/windows32/muon-prepare.exe +0 -0
- package/dist/native/windows64/muon-bootstrap.exe +0 -0
- package/dist/native/windows64/muon-prepare.exe +0 -0
- package/dist/runtime/{linuxarm64/THIRD_PARTY_NOTICES.md → linux64/LICENSE_muon} +156 -16
- package/dist/runtime/linux64/libmuon-ui.so +0 -0
- package/dist/runtime/linux64/muon-core +0 -0
- package/dist/runtime/{windows32/THIRD_PARTY_NOTICES.md → linuxarm/LICENSE_muon} +156 -16
- package/dist/runtime/linuxarm/libmuon-ui.so +0 -0
- package/dist/runtime/linuxarm/muon-core +0 -0
- package/dist/runtime/{linux64/THIRD_PARTY_NOTICES.md → linuxarm64/LICENSE_muon} +156 -16
- package/dist/runtime/linuxarm64/libmuon-ui.so +0 -0
- package/dist/runtime/linuxarm64/muon-core +0 -0
- package/dist/runtime/{linuxarm/THIRD_PARTY_NOTICES.md → windows32/LICENSE_muon} +156 -16
- package/dist/runtime/windows32/libcardio.dll +0 -0
- package/dist/runtime/windows32/libmuon-ui.dll +0 -0
- package/dist/runtime/windows32/muon-core.exe +0 -0
- package/dist/runtime/windows64/LICENSE_muon +363 -0
- package/dist/runtime/windows64/libcardio.dll +0 -0
- package/dist/runtime/windows64/libmuon-ui.dll +0 -0
- package/dist/runtime/windows64/muon-core.exe +0 -0
- package/dist/vite.cjs +90 -41
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +197 -72
- package/dist/vite.mjs.map +1 -1
- package/muon.d.ts +17 -0
- package/package.json +8 -8
- package/vite.d.ts +18 -2
- package/dist/build-CCuZpajl.cjs.map +0 -1
- package/dist/runtime/windows64/THIRD_PARTY_NOTICES.md +0 -223
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A multi-platform GUI application framework that uses CEF as its backend.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
[](https://www.repostatus.org/#wip)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: muon-ui
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.3.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: e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433
|
|
9
9
|
*/
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var __create = Object.create;
|
|
@@ -137,8 +137,38 @@ var runMuonPrepare = async (options) => {
|
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
//#endregion
|
|
140
|
-
//#region src/
|
|
141
|
-
var
|
|
140
|
+
//#region src/gitignore.ts
|
|
141
|
+
var muonGitignoreEntry = ".muon/";
|
|
142
|
+
var isMissingFileError = (error) => error instanceof Error && error.code === "ENOENT";
|
|
143
|
+
var hasMuonGitignoreEntry = (content) => content.split(/\r?\n/).map((line) => line.trim()).some((line) => line === muonGitignoreEntry || line === `/${muonGitignoreEntry}` || line === ".muon" || line === "/.muon");
|
|
144
|
+
/**
|
|
145
|
+
* Adds the Muon staging directory to a project .gitignore file.
|
|
146
|
+
*
|
|
147
|
+
* @param root Project root containing the .gitignore file.
|
|
148
|
+
* @returns Gitignore update result.
|
|
149
|
+
*/
|
|
150
|
+
var ensureMuonGitignoreEntry = async (root) => {
|
|
151
|
+
const gitignorePath = (0, node_path.join)(root, ".gitignore");
|
|
152
|
+
let content = "";
|
|
153
|
+
try {
|
|
154
|
+
content = await (0, node_fs_promises.readFile)(gitignorePath, "utf8");
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (!isMissingFileError(error)) throw error;
|
|
157
|
+
}
|
|
158
|
+
if (hasMuonGitignoreEntry(content)) return {
|
|
159
|
+
gitignorePath,
|
|
160
|
+
changed: false
|
|
161
|
+
};
|
|
162
|
+
const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
163
|
+
await (0, node_fs_promises.writeFile)(gitignorePath, `${content}${separator}${muonGitignoreEntry}\n`);
|
|
164
|
+
return {
|
|
165
|
+
gitignorePath,
|
|
166
|
+
changed: true
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region ../node_modules/json5/dist/index.js
|
|
171
|
+
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
142
172
|
(function(global, factory) {
|
|
143
173
|
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.JSON5 = factory();
|
|
144
174
|
})(exports, (function() {
|
|
@@ -1295,7 +1325,10 @@ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1295
1325
|
}
|
|
1296
1326
|
};
|
|
1297
1327
|
}));
|
|
1298
|
-
}))
|
|
1328
|
+
}));
|
|
1329
|
+
//#endregion
|
|
1330
|
+
//#region src/embed-config.ts
|
|
1331
|
+
var import_dist = require_dist();
|
|
1299
1332
|
/**
|
|
1300
1333
|
* Fixed byte size reserved in muon-core for an embedded muon.json payload.
|
|
1301
1334
|
*/
|
|
@@ -1790,8 +1823,9 @@ var defaultConfigFileNames = [
|
|
|
1790
1823
|
"muon.jsonc",
|
|
1791
1824
|
"muon.json"
|
|
1792
1825
|
];
|
|
1793
|
-
var
|
|
1826
|
+
var appConfigSourcePath = "./assets.zip";
|
|
1794
1827
|
var defaultAppName = "muon-app";
|
|
1828
|
+
var muonLicenseFileName = "LICENSE_muon";
|
|
1795
1829
|
var directoryMode = 493;
|
|
1796
1830
|
var executableMode = 493;
|
|
1797
1831
|
var assetSaltByteLength = 16;
|
|
@@ -1821,8 +1855,8 @@ var buildMuonApp = async (options = {}) => {
|
|
|
1821
1855
|
const targets = resolveBuildTargets(options);
|
|
1822
1856
|
const outputRoot = (0, node_path.resolve)(root, options.outputRoot ?? ".");
|
|
1823
1857
|
const appName = await resolveAppName(root, options.appName);
|
|
1824
|
-
const
|
|
1825
|
-
const
|
|
1858
|
+
const buildConfig = await readBuildConfig(root, options.configPath);
|
|
1859
|
+
const assetInput = resolveAssetInput(root, options.assetSourcePath, options.assetPrefix, buildConfig);
|
|
1826
1860
|
const salt = Buffer.from(options.assetSalt ?? (0, node_crypto.randomBytes)(assetSaltByteLength));
|
|
1827
1861
|
const results = [];
|
|
1828
1862
|
for (const target of targets) {
|
|
@@ -1832,7 +1866,7 @@ var buildMuonApp = async (options = {}) => {
|
|
|
1832
1866
|
appName,
|
|
1833
1867
|
target,
|
|
1834
1868
|
assetInput,
|
|
1835
|
-
sourceConfig,
|
|
1869
|
+
sourceConfig: buildConfig.config,
|
|
1836
1870
|
salt
|
|
1837
1871
|
});
|
|
1838
1872
|
results.push(result);
|
|
@@ -1852,9 +1886,10 @@ var resolveBuildTargets = (options) => {
|
|
|
1852
1886
|
if (options.targets !== void 0 && options.targets.length > 0) return [...new Set(options.targets.map((target) => normalizeMuonBuildTarget(target)))];
|
|
1853
1887
|
return [getDefaultMuonBuildTarget()];
|
|
1854
1888
|
};
|
|
1855
|
-
var resolveAssetInput = (root, assetSourcePath, assetPrefix) => {
|
|
1889
|
+
var resolveAssetInput = (root, assetSourcePath, assetPrefix, buildConfig) => {
|
|
1890
|
+
const configuredAssetSourcePath = assetSourcePath === void 0 ? readConfigAssetSourcePath(buildConfig.config) : void 0;
|
|
1856
1891
|
return {
|
|
1857
|
-
sourcePath: (0, node_path.resolve)(root, assetSourcePath
|
|
1892
|
+
sourcePath: assetSourcePath !== void 0 ? (0, node_path.resolve)(root, assetSourcePath) : configuredAssetSourcePath !== void 0 ? (0, node_path.resolve)(buildConfig.directory, configuredAssetSourcePath) : (0, node_path.resolve)(root, "assets"),
|
|
1858
1893
|
prefix: normalizeZipPrefix(assetPrefix ?? "")
|
|
1859
1894
|
};
|
|
1860
1895
|
};
|
|
@@ -1864,7 +1899,7 @@ var normalizeZipPrefix = (prefix) => {
|
|
|
1864
1899
|
};
|
|
1865
1900
|
var resolveAppName = async (root, appName) => {
|
|
1866
1901
|
if (appName !== void 0) return sanitizeAppName(appName);
|
|
1867
|
-
const packageJson = await readJsonObjectFile((0, node_path.join)(root, "package.json"));
|
|
1902
|
+
const packageJson = await readJsonObjectFile((0, node_path.join)(root, "package.json"), "package.json");
|
|
1868
1903
|
const packageName = typeof packageJson.name === "string" ? packageJson.name : defaultAppName;
|
|
1869
1904
|
return sanitizeAppName(packageName.startsWith("@") ? packageName.slice(packageName.indexOf("/") + 1) : packageName);
|
|
1870
1905
|
};
|
|
@@ -1874,8 +1909,23 @@ var sanitizeAppName = (name) => {
|
|
|
1874
1909
|
};
|
|
1875
1910
|
var readBuildConfig = async (root, configPath) => {
|
|
1876
1911
|
const resolvedConfigPath = await resolveConfigPath(root, configPath);
|
|
1877
|
-
if (resolvedConfigPath === void 0) return {
|
|
1878
|
-
|
|
1912
|
+
if (resolvedConfigPath === void 0) return {
|
|
1913
|
+
config: {},
|
|
1914
|
+
directory: root
|
|
1915
|
+
};
|
|
1916
|
+
return {
|
|
1917
|
+
config: await readJsonObjectFile(resolvedConfigPath, "Muon config file"),
|
|
1918
|
+
directory: (0, node_path.dirname)(resolvedConfigPath)
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
var readConfigAssetSourcePath = (sourceConfig) => {
|
|
1922
|
+
const sourceAsset = sourceConfig.asset;
|
|
1923
|
+
if (sourceAsset === void 0) return;
|
|
1924
|
+
if (!isJsonObject(sourceAsset)) throw new Error("muon.json asset must be an object when present.");
|
|
1925
|
+
const sourceAssetPath = sourceAsset.sourcePath;
|
|
1926
|
+
if (sourceAssetPath === void 0) return;
|
|
1927
|
+
if (typeof sourceAssetPath !== "string") throw new Error("muon.json asset.sourcePath must be a string when present.");
|
|
1928
|
+
return sourceAssetPath;
|
|
1879
1929
|
};
|
|
1880
1930
|
var resolveConfigPath = async (root, configPath) => {
|
|
1881
1931
|
if (configPath !== void 0) {
|
|
@@ -1888,9 +1938,20 @@ var resolveConfigPath = async (root, configPath) => {
|
|
|
1888
1938
|
if (await fileExists(candidatePath)) return candidatePath;
|
|
1889
1939
|
}
|
|
1890
1940
|
};
|
|
1891
|
-
var readJsonObjectFile = async (filePath) => {
|
|
1892
|
-
|
|
1893
|
-
|
|
1941
|
+
var readJsonObjectFile = async (filePath, label) => {
|
|
1942
|
+
let content;
|
|
1943
|
+
try {
|
|
1944
|
+
content = await (0, node_fs_promises.readFile)(filePath, "utf8");
|
|
1945
|
+
} catch (error) {
|
|
1946
|
+
throw new Error(`${label} could not be read: ${filePath}: ${getErrorMessage(error)}`);
|
|
1947
|
+
}
|
|
1948
|
+
let parsed;
|
|
1949
|
+
try {
|
|
1950
|
+
parsed = (0, import_dist.parse)(content);
|
|
1951
|
+
} catch (error) {
|
|
1952
|
+
throw new Error(`${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`);
|
|
1953
|
+
}
|
|
1954
|
+
if (!isJsonObject(parsed)) throw new Error(`${label} must contain a JSON object: ${filePath}`);
|
|
1894
1955
|
return parsed;
|
|
1895
1956
|
};
|
|
1896
1957
|
var buildMuonTarget = async (input) => {
|
|
@@ -1945,7 +2006,7 @@ var verifyTargetInputs = async (input) => {
|
|
|
1945
2006
|
await assertDirectory(input.sourceRuntimePath, `Muon runtime for ${input.target}`);
|
|
1946
2007
|
await assertFile(input.sourceBootstrapPath, `Muon bootstrap for ${input.target}`);
|
|
1947
2008
|
for (const fileName of input.descriptor.runtimeFiles) await assertFile((0, node_path.join)(input.sourceRuntimePath, fileName), `Muon runtime file ${fileName} for ${input.target}`);
|
|
1948
|
-
await assertFile((0, node_path.join)(input.sourceRuntimePath,
|
|
2009
|
+
await assertFile((0, node_path.join)(input.sourceRuntimePath, muonLicenseFileName), `Muon license file for ${input.target}`);
|
|
1949
2010
|
};
|
|
1950
2011
|
var getLauncherFileName = (appName, descriptor) => {
|
|
1951
2012
|
if (descriptor.launcherExtension.length > 0 && !appName.endsWith(descriptor.launcherExtension)) return `${appName}${descriptor.launcherExtension}`;
|
|
@@ -1953,21 +2014,33 @@ var getLauncherFileName = (appName, descriptor) => {
|
|
|
1953
2014
|
};
|
|
1954
2015
|
var copyRuntimeFiles = async (sourceRuntimePath, outputPath, descriptor) => {
|
|
1955
2016
|
for (const fileName of descriptor.runtimeFiles) await (0, node_fs_promises.copyFile)((0, node_path.join)(sourceRuntimePath, fileName), (0, node_path.join)(outputPath, fileName));
|
|
1956
|
-
await (0, node_fs_promises.copyFile)((0, node_path.join)(sourceRuntimePath,
|
|
2017
|
+
await (0, node_fs_promises.copyFile)((0, node_path.join)(sourceRuntimePath, muonLicenseFileName), (0, node_path.join)(outputPath, muonLicenseFileName));
|
|
1957
2018
|
};
|
|
1958
2019
|
var writeAssetArchive = async (input, outputPath, salt) => {
|
|
1959
|
-
await
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2020
|
+
const sourceStats = await statOrUndefined(input.sourcePath);
|
|
2021
|
+
if (sourceStats === void 0) throw new Error(`Muon asset source does not exist: ${input.sourcePath}`);
|
|
2022
|
+
const archive = sourceStats.isDirectory() ? await createAssetArchiveFromDirectory(input) : sourceStats.isFile() ? await (0, node_fs_promises.readFile)(input.sourcePath) : void 0;
|
|
2023
|
+
if (archive === void 0) throw new Error(`Muon asset source is not a directory or file: ${input.sourcePath}`);
|
|
1963
2024
|
await (0, node_fs_promises.writeFile)(outputPath, archive);
|
|
1964
2025
|
return {
|
|
1965
2026
|
path: outputPath,
|
|
1966
2027
|
signature: (0, node_crypto.createHash)("sha1").update(archive).update(salt).digest("hex"),
|
|
1967
2028
|
salt: salt.toString("hex"),
|
|
1968
|
-
entryCount:
|
|
2029
|
+
entryCount: sourceStats.isDirectory() ? readZipEntryCount(archive, outputPath) : readZipEntryCount(archive, input.sourcePath)
|
|
1969
2030
|
};
|
|
1970
2031
|
};
|
|
2032
|
+
var createAssetArchiveFromDirectory = async (input) => {
|
|
2033
|
+
const entries = await collectZipEntries(input.sourcePath, input.prefix);
|
|
2034
|
+
if (entries.length === 0) throw new Error(`Muon asset source has no files: ${input.sourcePath}`);
|
|
2035
|
+
return createZipArchive(entries);
|
|
2036
|
+
};
|
|
2037
|
+
var readZipEntryCount = (archive, sourcePath) => {
|
|
2038
|
+
const endSignature = 101010256;
|
|
2039
|
+
const lastPossibleOffset = archive.length - 22;
|
|
2040
|
+
const firstPossibleOffset = Math.max(0, lastPossibleOffset - 65535);
|
|
2041
|
+
for (let offset = lastPossibleOffset; offset >= firstPossibleOffset; offset -= 1) if (archive.readUInt32LE(offset) === endSignature) return archive.readUInt16LE(offset + 10);
|
|
2042
|
+
throw new Error(`Muon asset ZIP could not be read: ${sourcePath}`);
|
|
2043
|
+
};
|
|
1971
2044
|
var collectZipEntries = async (sourcePath, prefix) => {
|
|
1972
2045
|
const entries = [];
|
|
1973
2046
|
const walk = async (directoryPath) => {
|
|
@@ -2004,7 +2077,7 @@ var createEmbeddedConfig = (sourceConfig, asset) => {
|
|
|
2004
2077
|
...sourceConfig,
|
|
2005
2078
|
asset: {
|
|
2006
2079
|
...sourceAsset ?? {},
|
|
2007
|
-
|
|
2080
|
+
sourcePath: appConfigSourcePath,
|
|
2008
2081
|
signature: asset.signature,
|
|
2009
2082
|
salt: asset.salt
|
|
2010
2083
|
}
|
|
@@ -2024,13 +2097,20 @@ var withTemporaryConfig = async (config, callback) => {
|
|
|
2024
2097
|
}
|
|
2025
2098
|
};
|
|
2026
2099
|
var assertDirectory = async (path, label) => {
|
|
2027
|
-
const stats = await (
|
|
2100
|
+
const stats = await statOrUndefined(path);
|
|
2028
2101
|
if (stats === void 0 || !stats.isDirectory()) throw new Error(`${label} directory does not exist: ${path}`);
|
|
2029
2102
|
};
|
|
2030
2103
|
var assertFile = async (path, label) => {
|
|
2031
|
-
const stats = await (
|
|
2104
|
+
const stats = await statOrUndefined(path);
|
|
2032
2105
|
if (stats === void 0 || !stats.isFile()) throw new Error(`${label} file does not exist: ${path}`);
|
|
2033
2106
|
};
|
|
2107
|
+
var statOrUndefined = async (path) => {
|
|
2108
|
+
try {
|
|
2109
|
+
return await (0, node_fs_promises.stat)(path);
|
|
2110
|
+
} catch {
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2034
2114
|
var fileExists = async (path) => {
|
|
2035
2115
|
try {
|
|
2036
2116
|
await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
|
|
@@ -2042,6 +2122,7 @@ var fileExists = async (path) => {
|
|
|
2042
2122
|
var isJsonObject = (value) => {
|
|
2043
2123
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2044
2124
|
};
|
|
2125
|
+
var getErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
2045
2126
|
//#endregion
|
|
2046
2127
|
Object.defineProperty(exports, "buildMuonApp", {
|
|
2047
2128
|
enumerable: true,
|
|
@@ -2067,12 +2148,24 @@ Object.defineProperty(exports, "embedMuonConfigInRuntime", {
|
|
|
2067
2148
|
return embedMuonConfigInRuntime;
|
|
2068
2149
|
}
|
|
2069
2150
|
});
|
|
2151
|
+
Object.defineProperty(exports, "ensureMuonGitignoreEntry", {
|
|
2152
|
+
enumerable: true,
|
|
2153
|
+
get: function() {
|
|
2154
|
+
return ensureMuonGitignoreEntry;
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2070
2157
|
Object.defineProperty(exports, "getDefaultMuonPrepareTarget", {
|
|
2071
2158
|
enumerable: true,
|
|
2072
2159
|
get: function() {
|
|
2073
2160
|
return getDefaultMuonPrepareTarget;
|
|
2074
2161
|
}
|
|
2075
2162
|
});
|
|
2163
|
+
Object.defineProperty(exports, "require_dist", {
|
|
2164
|
+
enumerable: true,
|
|
2165
|
+
get: function() {
|
|
2166
|
+
return require_dist;
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2076
2169
|
Object.defineProperty(exports, "runMuonPrepare", {
|
|
2077
2170
|
enumerable: true,
|
|
2078
2171
|
get: function() {
|
|
@@ -2080,4 +2173,4 @@ Object.defineProperty(exports, "runMuonPrepare", {
|
|
|
2080
2173
|
}
|
|
2081
2174
|
});
|
|
2082
2175
|
|
|
2083
|
-
//# sourceMappingURL=build-
|
|
2176
|
+
//# sourceMappingURL=build-xwfaxosJ.cjs.map
|