muon-ui 0.7.0 → 0.9.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 +9 -12
- package/dist/cli.cjs +291 -126
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native/linux-amd64/muon-bootstrap +0 -0
- package/dist/native/linux-amd64/muon-builder +0 -0
- package/dist/native/linux-arm64/muon-bootstrap +0 -0
- package/dist/native/linux-arm64/{muon-prepare → muon-builder} +0 -0
- package/dist/native/linux-armhf/muon-bootstrap +0 -0
- package/dist/native/linux-armhf/{muon-prepare → muon-builder} +0 -0
- package/dist/native/muon-256.png +0 -0
- package/dist/native/windows-amd64/muon-bootstrap.exe +0 -0
- package/dist/native/windows-amd64/muon-builder.exe +0 -0
- package/dist/native/windows-i686/muon-bootstrap.exe +0 -0
- package/dist/native/windows-i686/muon-builder.exe +0 -0
- package/dist/runtime/linux-amd64/CREDITS.md +24 -0
- package/dist/runtime/linux-amd64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-amd64/muon-core +0 -0
- package/dist/runtime/linux-arm64/CREDITS.md +24 -0
- package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-arm64/muon-core +0 -0
- package/dist/runtime/linux-armhf/CREDITS.md +24 -0
- package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
- package/dist/runtime/linux-armhf/muon-core +0 -0
- package/dist/runtime/windows-amd64/CREDITS.md +24 -0
- package/dist/runtime/windows-amd64/libcardio.dll +0 -0
- package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-amd64/muon-core.exe +0 -0
- package/dist/runtime/windows-i686/CREDITS.md +24 -0
- package/dist/runtime/windows-i686/libcardio.dll +0 -0
- package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-i686/muon-core.exe +0 -0
- package/dist/{vite-options-FFh0NWUa.cjs → vite-internals-HXgH7b5M.cjs} +1460 -121
- package/dist/vite-internals-HXgH7b5M.cjs.map +1 -0
- package/dist/vite.cjs +452 -10
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +1552 -92
- package/dist/vite.mjs.map +1 -1
- package/muon.d.ts +141 -27
- package/package.json +14 -10
- package/vite.d.ts +276 -14
- package/dist/native/linux-amd64/muon-prepare +0 -0
- package/dist/native/windows-amd64/muon-prepare.exe +0 -0
- package/dist/native/windows-i686/muon-prepare.exe +0 -0
- package/dist/vite-options-FFh0NWUa.cjs.map +0 -1
package/dist/vite.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.cjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport type { Plugin, ResolvedConfig, UserConfig, WatchOptions } from \"vite\";\nimport { isAbsolute, resolve } from \"node:path\";\n\nimport { buildMuonApp, type MuonBuildOptions } from \"./build.js\";\nimport { startMuonViteBrowserBridge } from \"./vite-internals.js\";\nimport { attachMuonVitePluginOptions } from \"./vite-options.js\";\n\nconst suppressViteMuonBuildEnvironmentKey = \"MUON_SUPPRESS_VITE_MUON_BUILD\";\n\ntype MuonWatchIgnored = NonNullable<WatchOptions[\"ignored\"]>;\n\n/**\n * Options for generating Muon app distributions after Vite build.\n */\nexport interface MuonViteBuildOptions {\n /**\n * Public target identifiers to build.\n */\n targets?: readonly string[];\n\n /**\n * Build every supported target from the installed package.\n *\n * @remarks Defaults to true when targets is omitted. Set false to build only\n * the host target.\n */\n allTargets?: boolean;\n\n /**\n * File name used for the app launcher.\n *\n * @remarks The .exe suffix is added automatically for Windows targets.\n */\n appName?: string;\n\n /**\n * Stable application identifier used for portable runtime state.\n */\n appId?: string;\n\n /**\n * Parent directory that receives dist-muon-linux-amd64/ style outputs.\n */\n outputRoot?: string;\n\n /**\n * Muon config path to embed.\n */\n configPath?: string;\n\n /**\n * Directory containing package runtime/ and native/ folders.\n *\n * @remarks This defaults to the installed muon package dist directory.\n */\n packageDirectory?: string;\n\n /**\n * Asset salt override for deterministic tests.\n *\n * @remarks Production builds should omit this option.\n */\n assetSalt?: Uint8Array;\n}\n\n/**\n * Options for the Muon Vite development plugin.\n */\nexport interface MuonVitePluginOptions {\n /**\n * Directory containing muon-core runtime files such as muon-core and plugins.\n *\n * @remarks Relative paths are resolved from the Vite project root. When omitted,\n * the packaged runtime at dist/runtime/<public-target> is used.\n */\n muonPath?: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n *\n * @remarks Relative paths are resolved from the Vite project root. When omitted,\n * muon-prepare downloads and caches the tested CEF artifact from muonPath.\n */\n cefPath?: string;\n\n /**\n * Runtime staging directory used for development startup.\n *\n * @remarks Relative paths are resolved from the Vite project root. Defaults to\n * .muon/<public-target>.\n */\n stagePath?: string;\n\n /**\n * Launch Muon automatically during Vite dev startup.\n *\n * @remarks Defaults to true. This is independent from Vite's server.open\n * browser startup option. Vite build ignores this option.\n */\n open?: boolean;\n\n /**\n * Enable the Muon debugger defaults during Vite dev startup.\n *\n * @remarks Defaults to true. When enabled, the generated development config\n * enables CDP and binds DevTools to F12. Vite build ignores this option.\n */\n enableDebugger?: boolean;\n\n /**\n * Build app distributions from Vite output.\n *\n * @remarks Defaults to true during Vite build. Set false to disable the build\n * hook while keeping the development bridge enabled.\n */\n build?: boolean | MuonViteBuildOptions;\n}\n\n/**\n * Creates a Vite plugin that launches Muon during Vite dev startup.\n *\n * @param options Muon plugin options used for development startup and build.\n * @returns Vite plugin instance.\n */\nconst muon = (options: MuonVitePluginOptions = {}): Plugin => {\n let resolvedConfig: ResolvedConfig | undefined = undefined;\n\n const plugin: Plugin = {\n name: \"muon\",\n config: (config): Omit<UserConfig, \"plugins\"> | null => {\n if (config.server?.watch === null) {\n return null;\n }\n\n return {\n server: {\n watch: createMuonWatchOptions(config.server?.watch),\n },\n };\n },\n configResolved: (config) => {\n resolvedConfig = config;\n },\n configureServer: async (server) => {\n await startMuonViteBrowserBridge({\n server,\n pluginOptions: options,\n platform: process.platform,\n architecture: process.arch,\n environment: process.env,\n });\n },\n closeBundle: async () => {\n if (resolvedConfig === undefined || resolvedConfig.command !== \"build\") {\n return;\n }\n if (process.env[suppressViteMuonBuildEnvironmentKey] === \"1\") {\n return;\n }\n if (options.build === false) {\n return;\n }\n\n const buildOptions =\n typeof options.build === \"object\" ? options.build : {};\n await buildMuonApp(createMuonBuildOptions(resolvedConfig, buildOptions));\n },\n };\n\n return attachMuonVitePluginOptions(plugin, options);\n};\n\nconst isMuonStagingWatchPath = (path: string): boolean => {\n const normalized = path.replaceAll(\"\\\\\", \"/\");\n return (\n normalized === \".muon\" ||\n normalized.startsWith(\".muon/\") ||\n normalized.endsWith(\"/.muon\") ||\n normalized.includes(\"/.muon/\")\n );\n};\n\nconst mergeMuonWatchIgnored = (\n ignored: WatchOptions[\"ignored\"] | undefined,\n): MuonWatchIgnored => {\n const muonIgnored = (path: string): boolean => isMuonStagingWatchPath(path);\n if (ignored === undefined) {\n return muonIgnored;\n }\n return Array.isArray(ignored)\n ? [...ignored, muonIgnored]\n : [ignored, muonIgnored];\n};\n\nconst createMuonWatchOptions = (\n watch: WatchOptions | undefined,\n): WatchOptions => ({\n ...(watch ?? {}),\n ignored: mergeMuonWatchIgnored(watch?.ignored),\n});\n\nconst createMuonBuildOptions = (\n config: ResolvedConfig,\n buildOptions: MuonViteBuildOptions,\n): MuonBuildOptions => {\n const outDir = isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir);\n const options: MuonBuildOptions = {\n root: config.root,\n assetSourcePath: outDir,\n assetPrefix: \"main\",\n };\n\n if (buildOptions.allTargets !== undefined) {\n options.allTargets = buildOptions.allTargets;\n }\n if (buildOptions.targets !== undefined) {\n options.targets = buildOptions.targets;\n }\n if (buildOptions.appName !== undefined) {\n options.appName = buildOptions.appName;\n }\n if (buildOptions.appId !== undefined) {\n options.appId = buildOptions.appId;\n }\n if (buildOptions.outputRoot !== undefined) {\n options.outputRoot = buildOptions.outputRoot;\n }\n if (buildOptions.configPath !== undefined) {\n options.configPath = buildOptions.configPath;\n }\n if (buildOptions.packageDirectory !== undefined) {\n options.packageDirectory = buildOptions.packageDirectory;\n }\n if (buildOptions.assetSalt !== undefined) {\n options.assetSalt = buildOptions.assetSalt;\n }\n\n return options;\n};\n\nexport default muon;\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,sCAAsC;;;;;;;AAqH5C,IAAM,QAAQ,UAAiC,CAAC,MAAc;CAC5D,IAAI,iBAA6C,KAAA;CA4CjD,OAAO,qBAAA,4BAA4B;EAzCjC,MAAM;EACN,SAAS,WAA+C;GACtD,IAAI,OAAO,QAAQ,UAAU,MAC3B,OAAO;GAGT,OAAO,EACL,QAAQ,EACN,OAAO,uBAAuB,OAAO,QAAQ,KAAK,EACpD,EACF;EACF;EACA,iBAAiB,WAAW;GAC1B,iBAAiB;EACnB;EACA,iBAAiB,OAAO,WAAW;GACjC,MAAM,qBAAA,2BAA2B;IAC/B;IACA,eAAe;IACf,UAAU,QAAQ;IAClB,cAAc,QAAQ;IACtB,aAAa,QAAQ;GACvB,CAAC;EACH;EACA,aAAa,YAAY;GACvB,IAAI,mBAAmB,KAAA,KAAa,eAAe,YAAY,SAC7D;GAEF,IAAI,QAAQ,IAAI,yCAAyC,KACvD;GAEF,IAAI,QAAQ,UAAU,OACpB;GAGF,MAAM,eACJ,OAAO,QAAQ,UAAU,WAAW,QAAQ,QAAQ,CAAC;GACvD,MAAM,qBAAA,aAAa,uBAAuB,gBAAgB,YAAY,CAAC;EACzE;CAGiC,GAAQ,OAAO;AACpD;AAEA,IAAM,0BAA0B,SAA0B;CACxD,MAAM,aAAa,KAAK,WAAW,MAAM,GAAG;CAC5C,OACE,eAAe,WACf,WAAW,WAAW,QAAQ,KAC9B,WAAW,SAAS,QAAQ,KAC5B,WAAW,SAAS,SAAS;AAEjC;AAEA,IAAM,yBACJ,YACqB;CACrB,MAAM,eAAe,SAA0B,uBAAuB,IAAI;CAC1E,IAAI,YAAY,KAAA,GACd,OAAO;CAET,OAAO,MAAM,QAAQ,OAAO,IACxB,CAAC,GAAG,SAAS,WAAW,IACxB,CAAC,SAAS,WAAW;AAC3B;AAEA,IAAM,0BACJ,WACkB;CAClB,GAAI,SAAS,CAAC;CACd,SAAS,sBAAsB,OAAO,OAAO;AAC/C;AAEA,IAAM,0BACJ,QACA,iBACqB;CACrB,MAAM,UAAA,GAAA,UAAA,YAAoB,OAAO,MAAM,MAAM,IACzC,OAAO,MAAM,UAAA,GAAA,UAAA,SACL,OAAO,MAAM,OAAO,MAAM,MAAM;CAC5C,MAAM,UAA4B;EAChC,MAAM,OAAO;EACb,iBAAiB;EACjB,aAAa;CACf;CAEA,IAAI,aAAa,eAAe,KAAA,GAC9B,QAAQ,aAAa,aAAa;CAEpC,IAAI,aAAa,YAAY,KAAA,GAC3B,QAAQ,UAAU,aAAa;CAEjC,IAAI,aAAa,YAAY,KAAA,GAC3B,QAAQ,UAAU,aAAa;CAEjC,IAAI,aAAa,UAAU,KAAA,GACzB,QAAQ,QAAQ,aAAa;CAE/B,IAAI,aAAa,eAAe,KAAA,GAC9B,QAAQ,aAAa,aAAa;CAEpC,IAAI,aAAa,eAAe,KAAA,GAC9B,QAAQ,aAAa,aAAa;CAEpC,IAAI,aAAa,qBAAqB,KAAA,GACpC,QAAQ,mBAAmB,aAAa;CAE1C,IAAI,aAAa,cAAc,KAAA,GAC7B,QAAQ,YAAY,aAAa;CAGnC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"vite.cjs","names":[],"sources":["../src/capability.ts","../src/plugin-access.ts","../src/vite.ts"],"sourcesContent":["// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\n\n/**\n * Import-side capability rule for Muon plugin virtual modules.\n */\nexport interface MuonCapabilityImportOptions {\n /**\n * Importer path globs relative to the bundler project root.\n */\n sources?: readonly string[];\n /**\n * NPM package names allowed to import the virtual module.\n */\n packages?: readonly string[];\n /**\n * Plugin function path globs allowed for matching importers.\n */\n allow: readonly string[];\n /**\n * Plugin entry name that supplied this rule.\n *\n * @internal\n */\n pluginName?: string;\n}\n\n/**\n * Capability import configuration shared by bundler integrations.\n */\nexport interface MuonCapabilityOptions {\n /**\n * Capability imports allowed by importer path.\n */\n imports?: readonly MuonCapabilityImportOptions[];\n}\n\n/**\n * Runtime capability policy generated for muon-core.\n */\nexport interface MuonCapabilityRuntimeEntry {\n /**\n * Opaque capability id embedded into generated virtual modules.\n */\n id: string;\n /**\n * Plugin function path globs allowed for this capability.\n */\n allow: readonly string[];\n}\n\n/**\n * Runtime plugin entry generated for muon-core config overlays.\n */\nexport interface MuonRuntimePluginEntryConfig {\n /**\n * Plugin entry name.\n */\n name: string;\n /**\n * Optional expected SHA-1 signature for the external plugin library.\n */\n signature?: string;\n /**\n * Optional hexadecimal salt appended before checking the plugin signature.\n */\n salt?: string;\n /**\n * Plugin function path globs allowed for this plugin entry.\n */\n allow: readonly string[];\n}\n\n/**\n * Runtime plugin configuration generated for validate mode.\n */\nexport interface MuonCapabilityRuntimePluginConfig {\n /**\n * Plugin exposure mode.\n */\n mode: \"validate\";\n /**\n * Plugin bridge page URL allowlist.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n /**\n * Capability policies consumed by muon-core.\n */\n capabilities: readonly MuonCapabilityRuntimeEntry[];\n}\n\n/**\n * Runtime plugin configuration for simple window-global exposure.\n */\nexport interface MuonSimpleRuntimePluginConfig {\n /**\n * Plugin exposure mode.\n */\n mode: \"simple\";\n /**\n * Plugin bridge page URL allowlist.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n}\n\n/**\n * Runtime plugin configuration generated by a build integration.\n */\nexport type MuonRuntimePluginConfig =\n | MuonCapabilityRuntimePluginConfig\n | MuonSimpleRuntimePluginConfig;\n\n/**\n * Resolved virtual module.\n */\nexport interface MuonResolvedCapabilityModule {\n /**\n * Bundler-internal virtual id.\n */\n id: string;\n}\n\n/**\n * Bundler-independent virtual module resolver.\n */\nexport interface MuonCapabilityModuleResolver {\n /**\n * Resolves a Muon virtual module specifier for one importer.\n */\n resolveId: (\n source: string,\n importer: string | undefined,\n ) => MuonResolvedCapabilityModule | undefined;\n /**\n * Loads the generated source for a resolved virtual module id.\n */\n load: (id: string) => string | undefined;\n /**\n * Returns runtime plugin config generated from all capability rules.\n */\n getRuntimePluginConfig: () => MuonCapabilityRuntimePluginConfig;\n}\n\ninterface ParsedCapabilitySpecifier {\n moduleName: string;\n namespace: string;\n}\n\ninterface ResolvedRule {\n index: number;\n id: string;\n rule: MuonCapabilityImportOptions;\n namespace: string;\n moduleName: string;\n}\n\nconst virtualModulePrefix = \"\\0muon-capability:\";\nconst moduleNamePattern =\n /^[A-Za-z_$][A-Za-z0-9_$]*:[A-Za-z_$][A-Za-z0-9_$]*(?:\\.[A-Za-z_$][A-Za-z0-9_$]*)*$/u;\nconst jsIdentifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/u;\n\nconst normalizePath = (path: string): string =>\n (path.split(\"?\")[0] ?? \"\").replaceAll(\"\\\\\", \"/\");\n\nconst hashCapabilityRule = (\n index: number,\n rule: MuonCapabilityImportOptions,\n): string =>\n `cap-${createHash(\"sha1\")\n .update(\n JSON.stringify({\n index,\n pluginName: rule.pluginName,\n sources: [...(rule.sources ?? [])],\n packages: [...(rule.packages ?? [])],\n allow: [...rule.allow],\n }),\n )\n .digest(\"hex\")\n .slice(0, 16)}`;\n\nconst parseCapabilitySpecifier = (\n source: string,\n): ParsedCapabilitySpecifier | undefined => {\n if (!moduleNamePattern.test(source)) {\n return undefined;\n }\n const separator = source.indexOf(\":\");\n const namespace = `${source.slice(0, separator)}.${source.slice(separator + 1)}`;\n return {\n moduleName: source,\n namespace,\n };\n};\n\nconst escapeRegExp = (source: string): string =>\n source.replace(/[\\\\^$+?.()|[\\]{}]/gu, \"\\\\$&\");\n\nconst globToRegExp = (glob: string, separator: string): RegExp => {\n let source = \"^\";\n for (let index = 0; index < glob.length; index += 1) {\n const current = glob[index] ?? \"\";\n const next = glob[index + 1];\n if (current === \"*\" && next === \"*\") {\n source += \".*\";\n index += 1;\n continue;\n }\n if (current === \"*\") {\n source += `[^${escapeRegExp(separator)}]*`;\n continue;\n }\n source += escapeRegExp(current);\n }\n source += \"$\";\n return new RegExp(source, \"u\");\n};\n\nconst isGlobMatch = (glob: string, value: string, separator: string): boolean =>\n globToRegExp(glob, separator).test(value);\n\nconst toRootRelativeImporter = (root: string, importer: string): string =>\n normalizePath(relative(root, importer));\n\nconst readPackageName = (packageJsonPath: string): string | undefined => {\n try {\n const parsed = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as unknown;\n return typeof parsed === \"object\" &&\n parsed !== null &&\n !Array.isArray(parsed) &&\n typeof (parsed as { name?: unknown }).name === \"string\"\n ? (parsed as { name: string }).name\n : undefined;\n } catch {\n return undefined;\n }\n};\n\nconst getImporterPackageName = (\n root: string,\n importer: string,\n): string | undefined => {\n const normalizedRoot = normalizePath(root);\n const rootPackageJsonPath = join(root, \"package.json\");\n let directory = dirname(normalizePath(importer));\n for (;;) {\n const packageJsonPath = join(directory, \"package.json\");\n if (\n packageJsonPath !== rootPackageJsonPath &&\n existsSync(packageJsonPath)\n ) {\n return readPackageName(packageJsonPath);\n }\n if (normalizePath(directory) === normalizedRoot) {\n return undefined;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n return undefined;\n }\n directory = parent;\n }\n};\n\nconst matchesCapabilityRuleImporter = (\n rule: MuonCapabilityImportOptions,\n root: string,\n importer: string,\n): boolean => {\n const relativeImporter = toRootRelativeImporter(root, importer);\n const sourceMatched =\n rule.sources?.some((pattern) =>\n isGlobMatch(normalizePath(pattern), relativeImporter, \"/\"),\n ) ?? false;\n if (sourceMatched) {\n return true;\n }\n\n const packageName = getImporterPackageName(root, importer);\n return packageName === undefined\n ? false\n : (rule.packages?.includes(packageName) ?? false);\n};\n\nconst hasNamespaceFunctionAllow = (\n namespace: string,\n allow: readonly string[],\n): boolean =>\n allow.some((entry) => {\n if (entry.startsWith(`${namespace}.`)) {\n return true;\n }\n return isGlobMatch(entry, `${namespace}.placeholder`, \".\");\n });\n\nconst getExactExportName = (\n namespace: string,\n functionPath: string,\n): string | undefined => {\n const prefix = `${namespace}.`;\n if (!functionPath.startsWith(prefix)) {\n return undefined;\n }\n const name = functionPath.slice(prefix.length);\n if (!jsIdentifierPattern.test(name)) {\n return undefined;\n }\n return name;\n};\n\nconst getExportedFunctions = (\n namespace: string,\n allow: readonly string[],\n): [string, string][] =>\n allow.flatMap((functionPath) => {\n const exportName = getExactExportName(namespace, functionPath);\n return exportName === undefined ? [] : [[exportName, functionPath]];\n });\n\nconst createRuleRuntimeEntry = (\n rule: MuonCapabilityImportOptions,\n index: number,\n): MuonCapabilityRuntimeEntry => ({\n id: hashCapabilityRule(index, rule),\n allow: [...rule.allow],\n});\n\nconst validateCapabilityRule = (rule: MuonCapabilityImportOptions): void => {\n if (\n (rule.sources === undefined || rule.sources.length === 0) &&\n (rule.packages === undefined || rule.packages.length === 0)\n ) {\n throw new Error(\n \"Muon capability import rule requires sources or packages.\",\n );\n }\n};\n\nconst createModuleVirtualId = (rule: ResolvedRule): string =>\n `${virtualModulePrefix}${rule.index}:${rule.moduleName}`;\n\nconst parseModuleVirtualId = (\n id: string,\n): { index: number; moduleName: string } | undefined => {\n if (!id.startsWith(virtualModulePrefix)) {\n return undefined;\n }\n const payload = id.slice(virtualModulePrefix.length);\n const separator = payload.indexOf(\":\");\n if (separator <= 0) {\n return undefined;\n }\n const index = Number.parseInt(payload.slice(0, separator), 10);\n if (!Number.isInteger(index) || index < 0) {\n return undefined;\n }\n return {\n index,\n moduleName: payload.slice(separator + 1),\n };\n};\n\nconst createExecutorSpawnExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const spawn = async (options = {}) => {\n const source = await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [JSON.stringify(options ?? {})]);\n return JSON.parse(source);\n};`;\n\nconst createGenericFunctionExport = (\n exportName: string,\n capabilityId: string,\n functionPath: string,\n): string => `export const ${exportName} = async (...args) =>\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, args);`;\n\nconst createModuleSource = (rule: ResolvedRule): string => {\n const exportedFunctions = getExportedFunctions(\n rule.namespace,\n rule.rule.allow,\n );\n if (exportedFunctions.length === 0) {\n throw new Error(\n `Muon capability import has no exact function exports: ${rule.moduleName}`,\n );\n }\n\n const exports = exportedFunctions.map(([exportName, functionPath]) =>\n rule.namespace === \"muon.executor\" && exportName === \"spawn\"\n ? createExecutorSpawnExport(rule.id, functionPath)\n : createGenericFunctionExport(exportName, rule.id, functionPath),\n );\n return `const __muonCall = globalThis.__muon_plugin_call;\nif (typeof __muonCall !== \"function\") {\n throw new Error(\"Muon plugin capability bridge is not available.\");\n}\n\n${exports.join(\"\\n\\n\")}\n`;\n};\n\n/**\n * Creates a capability virtual module resolver for a bundler adapter.\n *\n * @param root Bundler project root.\n * @param options Capability import options.\n */\nexport const createMuonCapabilityModuleResolver = (\n root: string,\n options: MuonCapabilityOptions | undefined,\n): MuonCapabilityModuleResolver => {\n const rules = [...(options?.imports ?? [])];\n for (const rule of rules) {\n validateCapabilityRule(rule);\n }\n const runtimeEntries = rules.map((rule, index) =>\n createRuleRuntimeEntry(rule, index),\n );\n\n const resolveRule = (\n source: string,\n importer: string | undefined,\n ): ResolvedRule | undefined => {\n const parsed = parseCapabilitySpecifier(source);\n if (parsed === undefined) {\n return undefined;\n }\n const namespaceConfigured = rules.some((rule) =>\n hasNamespaceFunctionAllow(parsed.namespace, rule.allow),\n );\n if (!namespaceConfigured) {\n return undefined;\n }\n if (importer === undefined) {\n throw new Error(\n `Muon capability import is not allowed without an importer: ${source}`,\n );\n }\n\n const relativeImporter = toRootRelativeImporter(root, importer);\n for (let index = 0; index < rules.length; index += 1) {\n const rule = rules[index];\n if (\n rule === undefined ||\n !matchesCapabilityRuleImporter(rule, root, importer) ||\n !hasNamespaceFunctionAllow(parsed.namespace, rule.allow)\n ) {\n continue;\n }\n return {\n index,\n id: runtimeEntries[index]?.id ?? hashCapabilityRule(index, rule),\n rule,\n namespace: parsed.namespace,\n moduleName: parsed.moduleName,\n };\n }\n\n throw new Error(\n `Muon capability import is not allowed: ${source} from ${relativeImporter}`,\n );\n };\n\n return {\n resolveId: (source, importer) => {\n const rule = resolveRule(source, importer);\n return rule === undefined\n ? undefined\n : {\n id: createModuleVirtualId(rule),\n };\n },\n load: (id) => {\n const parsed = parseModuleVirtualId(id);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parseCapabilitySpecifier(parsed.moduleName);\n const rule = rules[parsed.index];\n const runtimeEntry = runtimeEntries[parsed.index];\n if (\n source === undefined ||\n rule === undefined ||\n runtimeEntry === undefined\n ) {\n return undefined;\n }\n return createModuleSource({\n index: parsed.index,\n id: runtimeEntry.id,\n rule,\n namespace: source.namespace,\n moduleName: source.moduleName,\n });\n },\n getRuntimePluginConfig: () => ({\n mode: \"validate\",\n capabilities: runtimeEntries,\n }),\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\n\nimport { parse } from \"json5\";\n\nimport type {\n MuonCapabilityImportOptions,\n MuonCapabilityOptions,\n MuonRuntimePluginEntryConfig,\n} from \"./capability.js\";\n\n/**\n * Plugin JavaScript exposure mode.\n */\nexport type MuonPluginAccessMode = \"simple\" | \"validate\";\n\n/**\n * Import-side capability rule from public Muon plugin access config.\n */\nexport interface MuonPluginAccessImportOptions {\n /**\n * Importer source globs relative to the bundler project root.\n */\n sources?: readonly string[];\n /**\n * NPM package names allowed to import the virtual module.\n */\n packages?: readonly string[];\n /**\n * Plugin function paths allowed for this import rule.\n *\n * @remarks Required in validate mode. Simple mode does not use import rules.\n */\n allow?: readonly string[];\n}\n\n/**\n * Plugin entry from public Muon plugin access config.\n */\nexport interface MuonPluginAccessEntryOptions {\n /**\n * Plugin entry name.\n */\n name: string;\n /**\n * Optional expected SHA-1 signature for the external plugin library.\n */\n signature?: string;\n /**\n * Optional hexadecimal salt appended before checking the plugin signature.\n */\n salt?: string;\n /**\n * Plugin function path globs allowed by the runtime plugin policy.\n *\n * @remarks Required in simple mode. Validate mode derives the runtime\n * allowlist from `imports[].allow` and rejects this field in public config.\n */\n allow?: readonly string[];\n /**\n * Validate-mode import rules for this plugin entry.\n */\n imports?: readonly MuonPluginAccessImportOptions[];\n}\n\n/**\n * Public plugin access config shared by muon.json and the Vite option.\n */\nexport interface MuonPluginAccessOptions {\n /**\n * External plugin directory override.\n */\n path?: string;\n /**\n * Plugin exposure mode.\n */\n mode?: MuonPluginAccessMode;\n /**\n * Page URL patterns where the plugin bridge is exposed.\n */\n pages?: readonly string[];\n /**\n * Runtime plugin entries and validate-mode import rules.\n */\n plugins?: readonly MuonPluginAccessEntryOptions[];\n}\n\n/**\n * Resolved plugin access config used by bundler integrations.\n */\nexport interface MuonResolvedPluginAccessOptions {\n /**\n * Effective plugin exposure mode.\n */\n mode: MuonPluginAccessMode;\n /**\n * Effective page URL allowlist.\n */\n pages: readonly string[];\n /**\n * Capability resolver inputs generated from plugin imports.\n */\n capabilityOptions: MuonCapabilityOptions;\n /**\n * Runtime config fields added around generated capability policies.\n */\n runtimeOverlay: MuonPluginAccessRuntimeOverlay;\n}\n\n/**\n * Runtime plugin config fields that are not derived from capability IDs.\n */\nexport interface MuonPluginAccessRuntimeOverlay {\n /**\n * Page URL allowlist to write into generated runtime config.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n}\n\nexport interface ResolveMuonPluginAccessOptionsInput {\n /**\n * Bundler project root.\n */\n root: string;\n /**\n * Optional muon.json path relative to root.\n */\n configPath: string | undefined;\n /**\n * Vite plugin access override.\n */\n pluginAccess: false | MuonPluginAccessOptions | undefined;\n /**\n * Handles project config read failures. When omitted, read failures are\n * reported as errors.\n */\n onConfigReadError?: (error: unknown) => void;\n}\n\ntype JsonObject = Record<string, unknown>;\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultPluginPages = [\"asset://main/**\"];\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isSha1HexString = (value: string): boolean =>\n value.length === 40 && /^[0-9a-fA-F]+$/.test(value);\n\nconst isHexByteString = (value: string): boolean =>\n value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst resolveMuonConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`Muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n path: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(path, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${path}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${path}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${path}`);\n }\n return parsed;\n};\n\nconst readOptionalStringArray = (\n object: JsonObject,\n key: string,\n configPath: string,\n): readonly string[] | undefined => {\n const value = object[key];\n if (value === undefined) {\n return undefined;\n }\n if (!isStringArray(value)) {\n throw new Error(`muon.json ${configPath} must be an array of strings.`);\n }\n return value;\n};\n\nconst readPluginAccessImportOptions = (\n value: unknown,\n configPath: string,\n): MuonPluginAccessImportOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n\n const sources = readOptionalStringArray(\n value,\n \"sources\",\n `${configPath}.sources`,\n );\n const packages = readOptionalStringArray(\n value,\n \"packages\",\n `${configPath}.packages`,\n );\n const allow = readOptionalStringArray(value, \"allow\", `${configPath}.allow`);\n const options: MuonPluginAccessImportOptions = {};\n if (sources !== undefined) {\n options.sources = sources;\n }\n if (packages !== undefined) {\n options.packages = packages;\n }\n if (allow !== undefined) {\n options.allow = allow;\n }\n return options;\n};\n\nconst readPluginAccessEntryOptions = (\n value: unknown,\n index: number,\n): MuonPluginAccessEntryOptions => {\n const configPath = `plugin.plugins[${index}]`;\n if (!isJsonObject(value)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n if (typeof value.name !== \"string\") {\n throw new Error(`muon.json ${configPath}.name must be a string.`);\n }\n if (value.signature !== undefined) {\n if (typeof value.signature !== \"string\") {\n throw new Error(`muon.json ${configPath}.signature must be a string.`);\n }\n if (!isSha1HexString(value.signature)) {\n throw new Error(\n `muon.json ${configPath}.signature must be a 40-character SHA-1 hex string.`,\n );\n }\n }\n if (value.salt !== undefined) {\n if (typeof value.salt !== \"string\") {\n throw new Error(`muon.json ${configPath}.salt must be a string.`);\n }\n if (!isHexByteString(value.salt)) {\n throw new Error(\n `muon.json ${configPath}.salt must be a hexadecimal byte string.`,\n );\n }\n }\n const allow = readOptionalStringArray(value, \"allow\", `${configPath}.allow`);\n\n const rawImports = value.imports;\n if (rawImports !== undefined && !Array.isArray(rawImports)) {\n throw new Error(`muon.json ${configPath}.imports must be an array.`);\n }\n const imports =\n rawImports === undefined\n ? undefined\n : rawImports.map((entry, importIndex) =>\n readPluginAccessImportOptions(\n entry,\n `${configPath}.imports[${importIndex}]`,\n ),\n );\n const options: MuonPluginAccessEntryOptions = {\n name: value.name,\n };\n if (value.signature !== undefined) {\n options.signature = value.signature;\n }\n if (value.salt !== undefined) {\n options.salt = value.salt;\n }\n if (allow !== undefined) {\n options.allow = allow;\n }\n if (imports !== undefined) {\n options.imports = imports;\n }\n return options;\n};\n\nconst readPluginAccessOptions = (\n config: JsonObject,\n): MuonPluginAccessOptions => {\n const browser = config.browser;\n if (isJsonObject(browser) && browser.plugin !== undefined) {\n throw new Error(\n \"muon.json browser.plugin is no longer supported; use plugin.mode and plugin.pages instead.\",\n );\n }\n\n const plugin = config.plugin;\n if (plugin === undefined) {\n return {};\n }\n if (!isJsonObject(plugin)) {\n throw new Error(\"muon.json plugin must be an object.\");\n }\n\n const options: MuonPluginAccessOptions = {};\n if (plugin.path !== undefined) {\n if (typeof plugin.path !== \"string\") {\n throw new Error(\"muon.json plugin.path must be a string.\");\n }\n if (plugin.path.length === 0) {\n throw new Error(\"muon.json plugin.path must not be empty.\");\n }\n options.path = plugin.path;\n }\n if (plugin.mode !== undefined) {\n if (typeof plugin.mode !== \"string\") {\n throw new Error(\"muon.json plugin.mode must be a string.\");\n }\n if (plugin.mode.length === 0) {\n throw new Error(\"muon.json plugin.mode must not be empty.\");\n }\n if (plugin.mode !== \"simple\" && plugin.mode !== \"validate\") {\n throw new Error(\"muon.json plugin.mode has unknown value.\");\n }\n options.mode = plugin.mode;\n }\n const pages = readOptionalStringArray(plugin, \"pages\", \"plugin.pages\");\n if (pages !== undefined) {\n options.pages = pages;\n }\n\n const rawPlugins = plugin.plugins;\n if (rawPlugins !== undefined) {\n if (!Array.isArray(rawPlugins)) {\n throw new Error(\"muon.json plugin.plugins must be an array.\");\n }\n options.plugins = rawPlugins.map((entry, index) =>\n readPluginAccessEntryOptions(entry, index),\n );\n }\n return options;\n};\n\ntype EffectivePluginAccessOptions = Required<\n Pick<MuonPluginAccessOptions, \"mode\" | \"pages\" | \"plugins\">\n> &\n Pick<MuonPluginAccessOptions, \"path\">;\n\nconst hasImportSourceSelector = (\n entry: MuonPluginAccessImportOptions,\n): boolean =>\n (entry.sources !== undefined && entry.sources.length > 0) ||\n (entry.packages !== undefined && entry.packages.length > 0);\n\nconst validatePluginAccessOptions = (\n resolved: EffectivePluginAccessOptions,\n): EffectivePluginAccessOptions => {\n for (const [pluginIndex, plugin] of resolved.plugins.entries()) {\n const pluginPath = `plugin.plugins[${pluginIndex}]`;\n if (plugin.name === \"internal\" && plugin.signature !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.signature is not supported for internal plugins.`,\n );\n }\n if (plugin.name === \"internal\" && plugin.salt !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.salt is not supported for internal plugins.`,\n );\n }\n if (plugin.signature !== undefined && plugin.salt === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.signature requires ${pluginPath}.salt.`,\n );\n }\n if (resolved.mode === \"validate\") {\n if (plugin.allow !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.allow is only supported in simple mode; use ${pluginPath}.imports[].allow in validate mode.`,\n );\n }\n if (plugin.imports === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.imports is required in validate mode.`,\n );\n }\n if (plugin.imports.length === 0) {\n throw new Error(\n `muon.json ${pluginPath}.imports must not be empty in validate mode.`,\n );\n }\n\n for (const [importIndex, entry] of plugin.imports.entries()) {\n const importPath = `${pluginPath}.imports[${importIndex}]`;\n if (!hasImportSourceSelector(entry)) {\n throw new Error(\n `muon.json ${importPath} requires sources or packages.`,\n );\n }\n if (entry.allow === undefined) {\n throw new Error(\n `muon.json ${importPath}.allow is required in validate mode.`,\n );\n }\n if (entry.allow.length === 0) {\n throw new Error(\n `muon.json ${importPath}.allow must not be empty in validate mode.`,\n );\n }\n }\n continue;\n }\n\n if (plugin.allow === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.allow is required in simple mode.`,\n );\n }\n if (plugin.imports !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.imports is only supported in validate mode.`,\n );\n }\n }\n return resolved;\n};\n\nconst getValidateImportAllow = (\n entry: MuonPluginAccessImportOptions,\n pluginIndex: number,\n importIndex: number,\n): readonly string[] => {\n if (entry.allow === undefined || entry.allow.length === 0) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].imports[${importIndex}].allow is required in validate mode.`,\n );\n }\n return entry.allow;\n};\n\nconst getSimplePluginAllow = (\n plugin: MuonPluginAccessEntryOptions,\n pluginIndex: number,\n): readonly string[] => {\n if (plugin.allow === undefined) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].allow is required in simple mode.`,\n );\n }\n return plugin.allow;\n};\n\nconst toCapabilityImports = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonCapabilityImportOptions[] =>\n plugins.flatMap((plugin, pluginIndex) =>\n (plugin.imports ?? []).map((entry, importIndex) => {\n if (!hasImportSourceSelector(entry)) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].imports[${importIndex}] requires sources or packages.`,\n );\n }\n\n const rule: MuonCapabilityImportOptions = {\n allow: getValidateImportAllow(entry, pluginIndex, importIndex),\n pluginName: plugin.name,\n };\n if (entry.sources !== undefined) {\n rule.sources = entry.sources;\n }\n if (entry.packages !== undefined) {\n rule.packages = entry.packages;\n }\n return rule;\n }),\n );\n\nconst toValidateRuntimePluginEntries = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonRuntimePluginEntryConfig[] =>\n plugins.map((plugin, pluginIndex) => {\n const allow: string[] = [];\n const seenAllow = new Set<string>();\n for (const [importIndex, entry] of (plugin.imports ?? []).entries()) {\n for (const functionPath of getValidateImportAllow(\n entry,\n pluginIndex,\n importIndex,\n )) {\n if (!seenAllow.has(functionPath)) {\n seenAllow.add(functionPath);\n allow.push(functionPath);\n }\n }\n }\n return {\n name: plugin.name,\n ...(plugin.signature === undefined\n ? {}\n : { signature: plugin.signature }),\n ...(plugin.salt === undefined ? {} : { salt: plugin.salt }),\n allow,\n };\n });\n\nconst toSimpleRuntimePluginEntries = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonRuntimePluginEntryConfig[] =>\n plugins.map((plugin, pluginIndex) => ({\n name: plugin.name,\n ...(plugin.signature === undefined ? {} : { signature: plugin.signature }),\n ...(plugin.salt === undefined ? {} : { salt: plugin.salt }),\n allow: [...getSimplePluginAllow(plugin, pluginIndex)],\n }));\n\nconst shouldOverlayRuntimePlugins = (\n resolved: EffectivePluginAccessOptions,\n override: false | MuonPluginAccessOptions | undefined,\n): boolean =>\n override !== false &&\n (override?.plugins !== undefined ||\n (resolved.mode === \"validate\" && resolved.plugins.length > 0));\n\nconst toRuntimePluginEntries = (\n resolved: EffectivePluginAccessOptions,\n): readonly MuonRuntimePluginEntryConfig[] =>\n resolved.mode === \"validate\"\n ? toValidateRuntimePluginEntries(resolved.plugins)\n : toSimpleRuntimePluginEntries(resolved.plugins);\n\nconst mergePluginAccessOptions = (\n base: MuonPluginAccessOptions,\n override: MuonPluginAccessOptions | undefined,\n): EffectivePluginAccessOptions => ({\n ...(override?.path === undefined ? {} : { path: override.path }),\n mode: override?.mode ?? base.mode ?? \"validate\",\n pages: override?.pages ?? base.pages ?? defaultPluginPages,\n plugins: override?.plugins ?? base.plugins ?? [],\n});\n\nconst createRuntimeOverlay = (\n root: string,\n resolved: EffectivePluginAccessOptions,\n override: false | MuonPluginAccessOptions | undefined,\n): MuonPluginAccessRuntimeOverlay => {\n if (override === false) {\n return {};\n }\n\n const path =\n override?.path !== undefined ? resolve(root, override.path) : undefined;\n const plugins = shouldOverlayRuntimePlugins(resolved, override)\n ? toRuntimePluginEntries(resolved)\n : undefined;\n\n return {\n pages: resolved.pages,\n ...(path === undefined ? {} : { path }),\n ...(plugins === undefined ? {} : { plugins }),\n };\n};\n\n/**\n * Resolves public plugin access config from muon.json and Vite overrides.\n *\n * @param input Resolution inputs.\n * @returns Effective plugin access config for bundler integrations.\n */\nexport const resolveMuonPluginAccessOptions = async ({\n root,\n configPath,\n pluginAccess,\n onConfigReadError,\n}: ResolveMuonPluginAccessOptionsInput): Promise<MuonResolvedPluginAccessOptions> => {\n const resolvedConfigPath = await resolveMuonConfigPath(root, configPath);\n let base: MuonPluginAccessOptions = {};\n if (resolvedConfigPath !== undefined) {\n try {\n base = readPluginAccessOptions(\n await readJsonObjectFile(resolvedConfigPath, \"Muon config file\"),\n );\n } catch (error) {\n if (onConfigReadError === undefined) {\n throw error;\n }\n onConfigReadError(error);\n }\n }\n\n if (pluginAccess === false) {\n const resolved = validatePluginAccessOptions(\n mergePluginAccessOptions(base, { mode: \"simple\" }),\n );\n return {\n mode: \"simple\",\n pages: resolved.pages,\n capabilityOptions: { imports: [] },\n runtimeOverlay: createRuntimeOverlay(root, resolved, pluginAccess),\n };\n }\n\n const resolved = validatePluginAccessOptions(\n mergePluginAccessOptions(base, pluginAccess),\n );\n const capabilityOptions: MuonCapabilityOptions = {\n imports:\n resolved.mode === \"validate\" ? toCapabilityImports(resolved.plugins) : [],\n };\n return {\n mode: resolved.mode,\n pages: resolved.pages,\n capabilityOptions,\n runtimeOverlay: createRuntimeOverlay(root, resolved, pluginAccess),\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport type { Plugin, ResolvedConfig, UserConfig, WatchOptions } from \"vite\";\nimport { isAbsolute, resolve } from \"node:path\";\n\nimport { buildMuonApp, type MuonBuildOptions } from \"./build.js\";\nimport {\n createMuonCapabilityModuleResolver,\n type MuonCapabilityModuleResolver,\n type MuonRuntimePluginConfig,\n} from \"./capability.js\";\nimport {\n resolveMuonPluginAccessOptions,\n type MuonPluginAccessEntryOptions,\n type MuonPluginAccessImportOptions,\n type MuonPluginAccessOptions,\n type MuonResolvedPluginAccessOptions,\n} from \"./plugin-access.js\";\nimport { startMuonViteBrowserBridge } from \"./vite-internals.js\";\nimport { attachMuonVitePluginOptions } from \"./vite-options.js\";\nimport { muonBuildSequenceSuppressViteBuildEnvironmentKey } from \"./build-sequence.js\";\n\ntype MuonWatchIgnored = NonNullable<WatchOptions[\"ignored\"]>;\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n/**\n * Windows PE and NSIS resource metadata options.\n */\nexport interface MuonWindowsResourceOptions {\n /**\n * Windows-specific icon PNG file path override.\n *\n * @remarks Only `.png` files are accepted as app inputs. Muon generates the\n * required Windows `.ico` file automatically when updating PE resources or\n * creating NSIS installers. Use top-level `iconPath` for a shared static\n * application icon. Relative paths are resolved from the source that supplied\n * the option.\n * @defaultValue Uses top-level `iconPath`, then the packaged `muon-256.png`\n * icon.\n */\n iconPath?: string;\n\n /**\n * Product name written to the Windows version resource.\n *\n * @defaultValue Uses `windows.resource.productName`, `project.json`,\n * `package.json`, then the Muon launcher name.\n */\n productName?: string;\n\n /**\n * File description written to the Windows version resource.\n *\n * @defaultValue Uses `windows.resource.fileDescription`, `project.json`,\n * `package.json.description`, then the product name.\n */\n fileDescription?: string;\n\n /**\n * Company name written to the Windows version resource.\n *\n * @defaultValue Uses `windows.resource.companyName`, `project.json`,\n * `package.json.author`, then `\"Unknown\"`.\n */\n companyName?: string;\n\n /**\n * Product and file version string.\n *\n * @remarks PE fixed version fields are normalized to four numeric parts, so\n * `1.2.3` becomes `1.2.3.0`. String fields keep the original value.\n * @defaultValue Uses `windows.resource.version`, `project.json.version`,\n * `package.json.version`, then `\"0.0.0\"`.\n */\n version?: string;\n\n /**\n * Legal copyright written to the Windows version resource.\n *\n * @defaultValue Uses `windows.resource.copyright`, `project.json`, then\n * `package.json.copyright` when available.\n */\n copyright?: string;\n\n /**\n * Windows resource language identifier.\n *\n * @defaultValue `1033` (`en-US`).\n */\n language?: number;\n\n /**\n * Windows version resource code page.\n *\n * @defaultValue `1200` (`UTF-16LE`).\n */\n codePage?: number;\n}\n\n/**\n * Linux desktop entry metadata options.\n */\nexport interface MuonLinuxDesktopOptions {\n /**\n * Desktop entry identifier without the `.desktop` suffix.\n *\n * @defaultValue Uses the resolved Muon `appId`.\n */\n desktopId?: string;\n\n /**\n * Application display name.\n *\n * @defaultValue Uses `linux.desktop.name`, then `package.json` name.\n */\n name?: string;\n\n /**\n * Desktop entry comment.\n *\n * @defaultValue Uses `linux.desktop.comment`, then `package.json`\n * description.\n */\n comment?: string;\n\n /**\n * Linux-specific desktop icon PNG file path override.\n *\n * @remarks Only `.png` files are accepted as app inputs. Relative paths are\n * resolved from the source that supplied the option. Use top-level\n * `iconPath` for a shared static application icon.\n * @defaultValue Uses top-level `iconPath`, then the packaged `muon-256.png`\n * icon when available.\n */\n iconPath?: string;\n\n /**\n * Desktop menu categories.\n *\n * @defaultValue `[\"Utility\"]`.\n */\n categories?: readonly string[];\n\n /**\n * Whether desktop startup notification is requested.\n *\n * @defaultValue `true`.\n */\n startupNotify?: boolean;\n}\n\n/**\n * Options for generating Muon app distributions after Vite build.\n */\nexport interface MuonViteBuildOptions {\n /**\n * Public target identifiers to build.\n *\n * @defaultValue Uses every supported target unless `allTargets` is `false`,\n * then the host target is used.\n */\n targets?: readonly string[];\n\n /**\n * Build every supported target from the installed package.\n *\n * @remarks Set false to build only the host target when `targets` is omitted.\n * @defaultValue `true` when `targets` is omitted.\n */\n allTargets?: boolean;\n\n /**\n * File name used for the app launcher.\n *\n * @remarks The .exe suffix is added automatically for Windows targets.\n * @defaultValue The sanitized package name, or `\"muon-app\"` when unavailable.\n */\n appName?: string;\n\n /**\n * Stable base application identifier used for portable runtime state.\n *\n * @remarks Windows target distributions embed `<appId>.<arch>` as their\n * runtime app identifier. Linux targets embed this value unchanged.\n *\n * @defaultValue The sanitized package name, or `\"muon-app\"` when unavailable.\n */\n appId?: string;\n\n /**\n * Parent directory that receives dist-muon/linux-amd64/ style outputs.\n *\n * @defaultValue The Vite project root.\n */\n outputRoot?: string;\n\n /**\n * Muon config path to embed.\n *\n * @defaultValue Auto-detects `muon.json5`, `muon.jsonc`, then `muon.json`;\n * uses an empty config when none exists.\n */\n configPath?: string;\n\n /**\n * Static application icon PNG file path.\n *\n * @remarks The icon is used for Windows PE/NSIS resources, Linux desktop\n * entries, and the generated initial title bar icon asset. Target-specific\n * icon paths in `windowsResource` or `linuxDesktop` override this value for\n * that target.\n * @defaultValue Uses top-level `muon.json` `iconPath`, `project.json`, then\n * the packaged `muon-256.png` icon.\n */\n iconPath?: string;\n\n /**\n * Windows PE and NSIS resource metadata.\n *\n * @defaultValue Uses CLI options, `muon.json` `windows.resource`,\n * `project.json`, `package.json`, then Muon defaults.\n */\n windowsResource?: MuonWindowsResourceOptions;\n\n /**\n * Linux desktop entry metadata.\n *\n * @defaultValue Uses CLI options, `muon.json` `linux.desktop`, package\n * metadata, then Muon defaults.\n */\n linuxDesktop?: MuonLinuxDesktopOptions;\n\n /**\n * Directory containing package runtime/ and native/ folders.\n *\n * @defaultValue The installed muon package dist directory.\n */\n packageDirectory?: string;\n\n /**\n * Asset salt override for deterministic tests.\n *\n * @remarks Production builds should omit this option.\n * @defaultValue A random 16-byte salt.\n */\n assetSalt?: Uint8Array;\n}\n\n/**\n * Import-side capability rule for Muon plugin virtual modules.\n */\nexport interface MuonVitePluginAccessImportOptions extends MuonPluginAccessImportOptions {}\n\n/**\n * Plugin entry and capability import configuration for Muon virtual modules.\n */\nexport interface MuonVitePluginAccessEntryOptions extends MuonPluginAccessEntryOptions {}\n\n/**\n * Plugin access configuration for Muon plugin virtual modules.\n */\nexport interface MuonVitePluginAccessOptions extends MuonPluginAccessOptions {\n /**\n * Runtime plugin entries and validate-mode import rules.\n */\n plugins?: readonly MuonVitePluginAccessEntryOptions[];\n}\n\n/**\n * Options for the Muon Vite development plugin.\n */\nexport interface MuonVitePluginOptions {\n /**\n * Directory containing muon-core runtime files such as muon-core and plugins.\n *\n * @remarks Relative paths are resolved from the Vite project root. When omitted,\n * the packaged runtime at dist/runtime/<public-target> is used.\n * @defaultValue The packaged runtime at `dist/runtime/<public-target>`.\n */\n muonPath?: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n *\n * @remarks Relative paths are resolved from the Vite project root. When omitted,\n * muon-builder downloads and caches the tested CEF artifact from muonPath.\n * @defaultValue The tested CEF artifact downloaded and cached by muon-builder.\n */\n cefPath?: string;\n\n /**\n * Runtime staging directory used for development startup.\n *\n * @remarks Relative paths are resolved from the Vite project root.\n * @defaultValue `.muon/<public-target>`.\n */\n stagePath?: string;\n\n /**\n * Launch Muon automatically during Vite dev startup.\n *\n * @remarks This is independent from Vite's server.open browser startup\n * option. Vite build ignores this option.\n * @defaultValue `true`\n */\n open?: boolean;\n\n /**\n * Enable the Muon debugger defaults during Vite dev startup.\n *\n * @remarks When enabled, the generated development config enables CDP and\n * binds DevTools to F12. Vite build ignores this option.\n * @defaultValue `true`\n */\n enableDebugger?: boolean;\n\n /**\n * Plugin access mode and virtual module capability imports.\n *\n * @remarks Omit this option to use the `plugin` section from `muon.json`.\n * Pass plugin entries with import rules to override `muon.json` and allow\n * virtual modules such as `muon:executor`. Pass `false` to use simple\n * window-global exposure.\n * @defaultValue `muon.json` plugin config, or validate mode with no\n * capability imports.\n */\n pluginAccess?: false | MuonVitePluginAccessOptions;\n\n /**\n * Build app distributions from Vite output.\n *\n * @remarks Set false to disable the build hook while keeping the development\n * bridge enabled.\n * @defaultValue `true` during Vite build.\n */\n build?: boolean | MuonViteBuildOptions;\n}\n\n/**\n * Creates a Vite plugin that launches Muon during Vite dev startup.\n *\n * @param options Muon plugin options used for development startup and build.\n * @returns Vite plugin instance.\n * @defaultValue `options` defaults to `{}`.\n */\nconst muon = (options: MuonVitePluginOptions = {}): Plugin => {\n let resolvedConfig: ResolvedConfig | undefined = undefined;\n let capabilityResolver: MuonCapabilityModuleResolver | undefined = undefined;\n let resolvedPluginAccess: MuonResolvedPluginAccessOptions | undefined =\n undefined;\n\n const plugin: Plugin = {\n name: \"muon\",\n config: (config): Omit<UserConfig, \"plugins\"> | null => {\n if (config.server?.watch === null) {\n return null;\n }\n\n return {\n server: {\n watch: createMuonWatchOptions(config.server?.watch),\n },\n };\n },\n configResolved: async (config): Promise<void> => {\n resolvedConfig = config;\n resolvedPluginAccess = await resolveMuonPluginAccessOptions({\n root: config.root,\n configPath: resolveMuonConfigPathForViteCommand(config, options),\n pluginAccess: options.pluginAccess,\n ...(config.command === \"serve\"\n ? {\n onConfigReadError: (error: unknown): void => {\n config.logger.warn(\n `Muon project config will be ignored because it could not be read or parsed: ${getErrorMessage(error)}`,\n );\n },\n }\n : {}),\n });\n capabilityResolver =\n resolvedPluginAccess.mode === \"validate\"\n ? createMuonCapabilityModuleResolver(\n config.root,\n resolvedPluginAccess.capabilityOptions,\n )\n : undefined;\n },\n resolveId: (source, importer) =>\n capabilityResolver?.resolveId(source, importer)?.id,\n load: (id) => capabilityResolver?.load(id),\n configureServer: async (server) => {\n await startMuonViteBrowserBridge({\n server,\n pluginOptions: options,\n getRuntimePluginConfig: () =>\n resolveMuonRuntimePluginConfig(\n capabilityResolver,\n resolvedPluginAccess,\n ),\n platform: process.platform,\n architecture: process.arch,\n environment: process.env,\n });\n },\n closeBundle: async () => {\n if (resolvedConfig === undefined || resolvedConfig.command !== \"build\") {\n return;\n }\n if (\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] === \"1\"\n ) {\n return;\n }\n if (options.build === false) {\n return;\n }\n\n const buildOptions =\n typeof options.build === \"object\" ? options.build : {};\n await buildMuonApp(\n createMuonBuildOptions(\n resolvedConfig,\n buildOptions,\n resolveMuonRuntimePluginConfig(\n capabilityResolver,\n resolvedPluginAccess,\n ),\n ),\n );\n },\n };\n\n return attachMuonVitePluginOptions(plugin, options);\n};\n\nconst isMuonStagingWatchPath = (path: string): boolean => {\n const normalized = path.replaceAll(\"\\\\\", \"/\");\n return (\n normalized === \".muon\" ||\n normalized.startsWith(\".muon/\") ||\n normalized.endsWith(\"/.muon\") ||\n normalized.includes(\"/.muon/\")\n );\n};\n\nconst mergeMuonWatchIgnored = (\n ignored: WatchOptions[\"ignored\"] | undefined,\n): MuonWatchIgnored => {\n const muonIgnored = (path: string): boolean => isMuonStagingWatchPath(path);\n if (ignored === undefined) {\n return muonIgnored;\n }\n return Array.isArray(ignored)\n ? [...ignored, muonIgnored]\n : [ignored, muonIgnored];\n};\n\nconst createMuonWatchOptions = (\n watch: WatchOptions | undefined,\n): WatchOptions => ({\n ...(watch ?? {}),\n ignored: mergeMuonWatchIgnored(watch?.ignored),\n});\n\nconst createMuonBuildOptions = (\n config: ResolvedConfig,\n buildOptions: MuonViteBuildOptions,\n runtimePluginConfig: MuonRuntimePluginConfig,\n): MuonBuildOptions => {\n const outDir = isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir);\n const options: MuonBuildOptions = {\n root: config.root,\n assetSourcePath: outDir,\n assetPrefix: \"main\",\n };\n\n if (buildOptions.allTargets !== undefined) {\n options.allTargets = buildOptions.allTargets;\n }\n if (buildOptions.targets !== undefined) {\n options.targets = buildOptions.targets;\n }\n if (buildOptions.appName !== undefined) {\n options.appName = buildOptions.appName;\n }\n if (buildOptions.appId !== undefined) {\n options.appId = buildOptions.appId;\n }\n if (buildOptions.outputRoot !== undefined) {\n options.outputRoot = buildOptions.outputRoot;\n }\n if (buildOptions.configPath !== undefined) {\n options.configPath = buildOptions.configPath;\n }\n if (buildOptions.iconPath !== undefined) {\n options.iconPath = buildOptions.iconPath;\n }\n if (buildOptions.windowsResource !== undefined) {\n options.windowsResource = buildOptions.windowsResource;\n }\n if (buildOptions.linuxDesktop !== undefined) {\n options.linuxDesktop = buildOptions.linuxDesktop;\n }\n if (buildOptions.packageDirectory !== undefined) {\n options.packageDirectory = buildOptions.packageDirectory;\n }\n if (buildOptions.assetSalt !== undefined) {\n options.assetSalt = buildOptions.assetSalt;\n }\n options.runtimePluginConfig = runtimePluginConfig;\n\n return options;\n};\n\nconst resolveMuonConfigPathForViteCommand = (\n config: ResolvedConfig,\n options: MuonVitePluginOptions,\n): string | undefined => {\n if (config.command !== \"build\" || typeof options.build !== \"object\") {\n return undefined;\n }\n return options.build.configPath;\n};\n\nconst resolveMuonRuntimePluginConfig = (\n capabilityResolver: MuonCapabilityModuleResolver | undefined,\n pluginAccess: MuonResolvedPluginAccessOptions | undefined,\n): MuonRuntimePluginConfig =>\n pluginAccess?.mode === \"simple\"\n ? { mode: \"simple\", ...pluginAccess.runtimeOverlay }\n : {\n ...(capabilityResolver?.getRuntimePluginConfig() ?? {\n mode: \"validate\",\n capabilities: [],\n }),\n ...(pluginAccess?.runtimeOverlay ?? {}),\n };\n\nexport default muon;\n"],"mappings":";;;;;;;;;;;;;;;AAkLA,IAAM,sBAAsB;AAC5B,IAAM,oBACJ;AACF,IAAM,sBAAsB;AAE5B,IAAM,iBAAiB,UACpB,KAAK,MAAM,GAAG,EAAE,MAAM,IAAI,WAAW,MAAM,GAAG;AAEjD,IAAM,sBACJ,OACA,SAEA,QAAA,GAAA,YAAA,YAAkB,MAAM,EACrB,OACC,KAAK,UAAU;CACb;CACA,YAAY,KAAK;CACjB,SAAS,CAAC,GAAI,KAAK,WAAW,CAAC,CAAE;CACjC,UAAU,CAAC,GAAI,KAAK,YAAY,CAAC,CAAE;C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