@vizejs/vite-plugin-musea 0.443.0 → 0.454.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 +4 -0
- package/dist/a11y/index.d.mts +1 -1
- package/dist/cli/index.d.mts +3 -2
- package/dist/cli/index.d.mts.map +1 -1
- package/dist/cli/index.mjs +341 -61
- package/dist/cli/index.mjs.map +1 -1
- package/dist/gallery/assets/{MonacoEditor-CmjDtbrI.js → MonacoEditor-CwTBvTDB.js} +2 -2
- package/dist/gallery/assets/{cssMode-B16oWKdO.js → cssMode-CelCYNbn.js} +1 -1
- package/dist/gallery/assets/{editor.api-CfYscGcC.js → editor.api-a6jnMk-M.js} +1 -1
- package/dist/gallery/assets/{freemarker2-Bsla50n3.js → freemarker2-DPAvE--z.js} +1 -1
- package/dist/gallery/assets/{handlebars-CS_Y5cXs.js → handlebars-BM0wnfAw.js} +1 -1
- package/dist/gallery/assets/{html-DagAGhpS.js → html-BVxuhUk3.js} +1 -1
- package/dist/gallery/assets/{htmlMode-CiuL2Y-P.js → htmlMode-BMPJCjfA.js} +1 -1
- package/dist/gallery/assets/index-B0odPzN2.css +1 -0
- package/dist/gallery/assets/index-Dc3b2Q04.js +73 -0
- package/dist/gallery/assets/{javascript-BQYQMq9R.js → javascript-DNIAc6FS.js} +1 -1
- package/dist/gallery/assets/{jsonMode-C5lyVqru.js → jsonMode-DoEfywTC.js} +1 -1
- package/dist/gallery/assets/{liquid-qbEuwx0o.js → liquid-Bda2NkY3.js} +1 -1
- package/dist/gallery/assets/{lspLanguageFeatures-Dqts9s1L.js → lspLanguageFeatures-Bss0uLYW.js} +1 -1
- package/dist/gallery/assets/{mdx-DN6uw21R.js → mdx-Cz_EcYUc.js} +1 -1
- package/dist/gallery/assets/{python-Cbp5CGeG.js → python-DumZpK8Y.js} +1 -1
- package/dist/gallery/assets/{razor-BXu36P7p.js → razor-B35B929n.js} +1 -1
- package/dist/gallery/assets/{register-vvpXemvQ.js → register-CQcuOoyc.js} +2 -2
- package/dist/gallery/assets/{toggleHighContrast-9EQLxoB9.js → toggleHighContrast-MeFDOtI7.js} +1 -1
- package/dist/gallery/assets/{tsMode-DakVvyMV.js → tsMode-DJXGbiLp.js} +1 -1
- package/dist/gallery/assets/{typescript-DEY4mnQU.js → typescript-CkqSzVk4.js} +1 -1
- package/dist/gallery/assets/{vs-Cd8KAJDG.js → vs-BnuldxuJ.js} +3 -3
- package/dist/gallery/assets/{workers-GvANOwSC.js → workers-tF2102zJ.js} +1 -1
- package/dist/gallery/assets/{xml-cZMAcMEr.js → xml-ntbvGSvU.js} +1 -1
- package/dist/gallery/assets/{yaml-CReFeuuC.js → yaml-s2GvmKpO.js} +1 -1
- package/dist/gallery/index.html +2 -2
- package/dist/{index-BU4-FGUC.d.mts → index-DENP7L3t.d.mts} +2 -2
- package/dist/{index-BU4-FGUC.d.mts.map → index-DENP7L3t.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +54 -101
- package/dist/index.mjs.map +1 -1
- package/dist/{options-DnKPMMPV.mjs → options-DNFbTB_5.mjs} +103 -21
- package/dist/options-DNFbTB_5.mjs.map +1 -0
- package/dist/{vrt-PuxpRuHa.mjs → vrt-dFU3k2J6.mjs} +49 -6
- package/dist/vrt-dFU3k2J6.mjs.map +1 -0
- package/dist/{vrt-DtcnqPhF.d.mts → vrt-nAWyjDmd.d.mts} +8 -5
- package/dist/vrt-nAWyjDmd.d.mts.map +1 -0
- package/dist/vrt.d.mts +1 -1
- package/dist/vrt.mjs +1 -1
- package/package.json +5 -5
- package/dist/gallery/assets/index-BaRljRmN.css +0 -1
- package/dist/gallery/assets/index-Bma1gCA8.js +0 -73
- package/dist/options-DnKPMMPV.mjs.map +0 -1
- package/dist/vrt-DtcnqPhF.d.mts.map +0 -1
- package/dist/vrt-PuxpRuHa.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { C as resolveUrlPathInside, E as loadNative, S as resolveTrustedSourcePath, _ as assertVueSourcePath, a as scanArtFiles, b as resolveInside, c as buildThemeConfig, d as createDevSessionToken, f as parseJsonBody, h as assertArtVueSourcePath, i as resolveScanRoots, m as validateDevApiRequest, n as generateStorybookFiles, o as shouldProcess, p as serializeScriptValue, r as matchGlob, t as escapeHtml, u as collectRequestBody, v as decodeUrlComponent, w as HttpError } from "./utils-BloA9YP9.mjs";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as scanTokenUsage, C as handleTokensUsage, D as processStyleDictionary, E as generateTokensMarkdown, F as expandSelfTag, I as resolveArtComponent, L as variantComponentNames, M as generateArtModule, N as parseScriptSetupForArt, O as buildTokenMap, P as rewriteRelativeImportStatement, S as handleTokensUpdate, T as generateTokensHtml, _ as handleArtSource, a as attachArtReportOwner, b as handleTokensDelete, c as rewriteDevGalleryAsset, d as createStaticGalleryPayload, f as joinUrlPath, g as handleArtDocs, h as handleArtAnalysis, i as assertArtReportOwnership, j as parseTokens, k as resolveReferences, l as rewriteGalleryBase, m as sortedArts, o as resolveArtReportTarget, p as staticPreviewId, r as processMuseaArtFile, s as publicBasePathFromViteBase, t as attachMuseaOptions, u as rewriteGalleryTextAssetBase, v as handleArtPalette, w as resolveTokenPreview, x as handleTokensGet, y as handleTokensCreate } from "./options-DNFbTB_5.mjs";
|
|
3
3
|
import { a as generateGalleryGlobalsScript, i as generateDevGlobalsScript, n as generateGalleryScript, r as generateGalleryModule, t as generateGalleryBody } from "./template-CpNUvZPp.mjs";
|
|
4
|
-
import { i as MuseaVrtRunner, n as generateVrtJsonReport, r as generateVrtReport
|
|
4
|
+
import { i as MuseaVrtRunner, n as generateVrtJsonReport, r as generateVrtReport } from "./vrt-dFU3k2J6.mjs";
|
|
5
5
|
import { t as MuseaA11yRunner } from "./a11y-DuFu75hl.mjs";
|
|
6
6
|
import { n as writeArtFile, t as generateArtFile } from "./autogen-B-N0cJbZ.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
|
-
import fs from "node:fs";
|
|
8
|
+
import fs, { existsSync } from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import { createHash } from "node:crypto";
|
|
11
10
|
import { fileURLToPath } from "node:url";
|
|
12
|
-
import {
|
|
13
|
-
import { VIZE_CONFIG_FILE_ENV, loadConfig } from "@vizejs/vite-plugin";
|
|
11
|
+
import { VIZE_CONFIG_FILE_ENV, loadConfig, resolveViteConfigExport } from "@vizejs/vite-plugin";
|
|
14
12
|
import { getResolvedVizeConfigRegistration } from "@vizejs/vite-plugin/internal/config-bridge";
|
|
15
13
|
import * as vite from "vite";
|
|
14
|
+
import { normalizePath } from "vite";
|
|
16
15
|
//#region src/toolbar.ts
|
|
17
16
|
function normalizeToolbar(toolbar = []) {
|
|
18
17
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -841,7 +840,7 @@ function sendArtModuleFallback(response, generate) {
|
|
|
841
840
|
}
|
|
842
841
|
//#endregion
|
|
843
842
|
//#region src/server-middleware.ts
|
|
844
|
-
const moduleDir$
|
|
843
|
+
const moduleDir$2 = path.dirname(fileURLToPath(import.meta.url));
|
|
845
844
|
const galleryAssetMimeTypes = {
|
|
846
845
|
".js": "application/javascript",
|
|
847
846
|
".css": "text/css",
|
|
@@ -852,10 +851,10 @@ const galleryAssetMimeTypes = {
|
|
|
852
851
|
".woff": "font/woff"
|
|
853
852
|
};
|
|
854
853
|
function resolveGalleryDistDir$1() {
|
|
855
|
-
return path.resolve(moduleDir$
|
|
854
|
+
return path.resolve(moduleDir$2, "gallery");
|
|
856
855
|
}
|
|
857
856
|
function resolveGallerySourceDir() {
|
|
858
|
-
return path.resolve(moduleDir$
|
|
857
|
+
return path.resolve(moduleDir$2, "../gallery");
|
|
859
858
|
}
|
|
860
859
|
function toViteFsPath(filePath) {
|
|
861
860
|
return encodeURI(`/@fs${filePath.split(path.sep).join("/")}`);
|
|
@@ -878,7 +877,7 @@ async function generateFallbackGalleryHtml(basePath, devSessionToken, themeConfi
|
|
|
878
877
|
const { generateGalleryHtml } = await import("./gallery-LgVvVp28.mjs");
|
|
879
878
|
return generateGalleryHtml(basePath, devSessionToken, themeConfig, tokenPreviewConfig, toolbar);
|
|
880
879
|
}
|
|
881
|
-
async function serveGalleryAsset(galleryDistDir, requestUrl, res) {
|
|
880
|
+
async function serveGalleryAsset(galleryDistDir, requestUrl, res, basePath = "/__musea__") {
|
|
882
881
|
try {
|
|
883
882
|
const filePath = resolveUrlPathInside(galleryDistDir, requestUrl, "asset path");
|
|
884
883
|
if (!(await fs.promises.stat(filePath)).isFile()) return false;
|
|
@@ -886,7 +885,7 @@ async function serveGalleryAsset(galleryDistDir, requestUrl, res) {
|
|
|
886
885
|
const ext = path.extname(filePath);
|
|
887
886
|
res.setHeader("Content-Type", galleryAssetMimeTypes[ext] || "application/octet-stream");
|
|
888
887
|
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
|
889
|
-
res.end(content);
|
|
888
|
+
res.end(rewriteDevGalleryAsset(content, filePath, basePath));
|
|
890
889
|
return true;
|
|
891
890
|
} catch (error) {
|
|
892
891
|
if (error instanceof HttpError) {
|
|
@@ -906,7 +905,7 @@ function registerMiddleware(devServer, ctx) {
|
|
|
906
905
|
const indexHtmlPath = path.join(galleryDistDir, "index.html");
|
|
907
906
|
try {
|
|
908
907
|
await fs.promises.access(indexHtmlPath);
|
|
909
|
-
let html = await fs.promises.readFile(indexHtmlPath, "utf-8");
|
|
908
|
+
let html = rewriteGalleryBase(await fs.promises.readFile(indexHtmlPath, "utf-8"), basePath);
|
|
910
909
|
html = html.replace("</head>", `<script>${generateDevGlobalsScript(basePath, devSessionToken, themeConfig, tokenPreviewConfig, toolbar)}<\/script></head>`);
|
|
911
910
|
res.setHeader("Content-Type", "text/html");
|
|
912
911
|
res.end(html);
|
|
@@ -925,7 +924,7 @@ function registerMiddleware(devServer, ctx) {
|
|
|
925
924
|
}
|
|
926
925
|
}
|
|
927
926
|
if (url.startsWith("/assets/")) {
|
|
928
|
-
if (await serveGalleryAsset(resolveGalleryDistDir$1(), url, res)) return;
|
|
927
|
+
if (await serveGalleryAsset(resolveGalleryDistDir$1(), url, res, basePath)) return;
|
|
929
928
|
}
|
|
930
929
|
next();
|
|
931
930
|
});
|
|
@@ -1046,83 +1045,6 @@ function registerMiddleware(devServer, ctx) {
|
|
|
1046
1045
|
});
|
|
1047
1046
|
}
|
|
1048
1047
|
//#endregion
|
|
1049
|
-
//#region src/vrt/report-identity.ts
|
|
1050
|
-
/** Reserve one qualified namespace and compare legacy names on case-insensitive filesystems. */
|
|
1051
|
-
function legacyName(identity) {
|
|
1052
|
-
const basename = path.posix.basename(identity, ".art.vue");
|
|
1053
|
-
return /^[a-z0-9._-]{1,200}$/i.test(basename) && !/^art-[0-9a-f]{64}$/i.test(basename) ? `vrt-${basename}` : void 0;
|
|
1054
|
-
}
|
|
1055
|
-
/** The complete discovered Art set decides collisions, even for a single-Art request. */
|
|
1056
|
-
function resolveArtReportTarget(artPath, artPaths, projectRoot, reportDir) {
|
|
1057
|
-
const identities = Array.from(artPaths, (item) => resolveSnapshotIdentity(item, projectRoot));
|
|
1058
|
-
const identity = resolveSnapshotIdentity(artPath, projectRoot);
|
|
1059
|
-
if (!identities.includes(identity)) throw new Error(`Report Art not found: ${artPath}`);
|
|
1060
|
-
const candidates = identities.map(legacyName);
|
|
1061
|
-
const counts = /* @__PURE__ */ new Map();
|
|
1062
|
-
for (const name of candidates) if (name) counts.set(name.toLowerCase(), (counts.get(name.toLowerCase()) ?? 0) + 1);
|
|
1063
|
-
const names = identities.map((item, index) => {
|
|
1064
|
-
const candidate = candidates[index];
|
|
1065
|
-
const colliding = candidate && counts.get(candidate.toLowerCase()) > 1;
|
|
1066
|
-
return candidate && !colliding ? candidate : `vrt-art-${createHash("sha256").update(JSON.stringify([1, item])).digest("hex")}`;
|
|
1067
|
-
});
|
|
1068
|
-
if (new Set(names.map((name) => name.toLowerCase())).size !== names.length) throw new Error("Ambiguous VRT report identities");
|
|
1069
|
-
const base = names[identities.indexOf(identity)];
|
|
1070
|
-
return {
|
|
1071
|
-
identity,
|
|
1072
|
-
jsonReportPath: path.join(reportDir, `${base}-report.json`),
|
|
1073
|
-
htmlReportPath: path.join(reportDir, `${base}-report.html`)
|
|
1074
|
-
};
|
|
1075
|
-
}
|
|
1076
|
-
async function existsRegularFile(file) {
|
|
1077
|
-
try {
|
|
1078
|
-
if (!(await lstat(file)).isFile()) throw new Error(`VRT report is not a regular file: ${file}`);
|
|
1079
|
-
return true;
|
|
1080
|
-
} catch (error) {
|
|
1081
|
-
if (error.code === "ENOENT") return false;
|
|
1082
|
-
throw error;
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
/** Fail before capture or writes; legacy adoption requires every recorded result to have this owner. */
|
|
1086
|
-
async function assertArtReportOwnership(target, projectRoot) {
|
|
1087
|
-
const refusal = `Ambiguous VRT report ownership: ${target.jsonReportPath}. Archive or move the existing reports before retrying.`;
|
|
1088
|
-
const names = [path.basename(target.jsonReportPath), path.basename(target.htmlReportPath)];
|
|
1089
|
-
let existingNames;
|
|
1090
|
-
try {
|
|
1091
|
-
existingNames = await readdir(path.dirname(target.jsonReportPath));
|
|
1092
|
-
} catch (error) {
|
|
1093
|
-
if (error.code === "ENOENT") return;
|
|
1094
|
-
throw error;
|
|
1095
|
-
}
|
|
1096
|
-
if (existingNames.some((item) => names.some((name) => item !== name && item.toLowerCase() === name.toLowerCase()))) throw new Error(refusal);
|
|
1097
|
-
const jsonExists = await existsRegularFile(target.jsonReportPath);
|
|
1098
|
-
const htmlExists = await existsRegularFile(target.htmlReportPath);
|
|
1099
|
-
if (!jsonExists && !htmlExists) return;
|
|
1100
|
-
if (!jsonExists) throw new Error(refusal);
|
|
1101
|
-
try {
|
|
1102
|
-
const report = JSON.parse(await readFile(target.jsonReportPath, "utf8"));
|
|
1103
|
-
if (!report || typeof report !== "object" || Array.isArray(report)) throw new Error(refusal);
|
|
1104
|
-
if (Object.hasOwn(report, "reportOwner")) {
|
|
1105
|
-
const owner = report.reportOwner;
|
|
1106
|
-
if (!owner || typeof owner !== "object" || owner.version !== 1 || owner.artIdentity !== target.identity) throw new Error(refusal);
|
|
1107
|
-
} else {
|
|
1108
|
-
const results = report.results;
|
|
1109
|
-
if (!Array.isArray(results) || !results.length || results.some((item) => !item || typeof item !== "object" || typeof item.artPath !== "string" || resolveSnapshotIdentity(item.artPath, projectRoot) !== target.identity)) throw new Error(refusal);
|
|
1110
|
-
}
|
|
1111
|
-
} catch {
|
|
1112
|
-
throw new Error(refusal);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
/** Keep ownership portable when a report directory moves to another machine. */
|
|
1116
|
-
function attachArtReportOwner(json, target) {
|
|
1117
|
-
return JSON.stringify({
|
|
1118
|
-
...JSON.parse(json),
|
|
1119
|
-
reportOwner: {
|
|
1120
|
-
version: 1,
|
|
1121
|
-
artIdentity: target.identity
|
|
1122
|
-
}
|
|
1123
|
-
}, null, 2);
|
|
1124
|
-
}
|
|
1125
|
-
//#endregion
|
|
1126
1048
|
//#region src/api-routes/post-handlers.ts
|
|
1127
1049
|
/** POST /api/preview-with-props */
|
|
1128
1050
|
function handlePreviewWithProps(ctx, body, res, sendJson, sendError) {
|
|
@@ -1748,7 +1670,7 @@ function relativePath(root, filePath) {
|
|
|
1748
1670
|
}
|
|
1749
1671
|
//#endregion
|
|
1750
1672
|
//#region src/static-gallery-shell.ts
|
|
1751
|
-
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
1673
|
+
const moduleDir$1 = path.dirname(fileURLToPath(import.meta.url));
|
|
1752
1674
|
function joinFileName(...parts) {
|
|
1753
1675
|
return parts.filter(Boolean).join("/");
|
|
1754
1676
|
}
|
|
@@ -1805,7 +1727,7 @@ function generateStaticFallbackGalleryHtml(basePath) {
|
|
|
1805
1727
|
</html>`;
|
|
1806
1728
|
}
|
|
1807
1729
|
function resolveGalleryDistDir() {
|
|
1808
|
-
return [path.join(moduleDir, "gallery"), path.resolve(moduleDir, "../dist/gallery")].find((candidate) => fs.existsSync(path.join(candidate, "index.html"))) ?? null;
|
|
1730
|
+
return [path.join(moduleDir$1, "gallery"), path.resolve(moduleDir$1, "../dist/gallery")].find((candidate) => fs.existsSync(path.join(candidate, "index.html"))) ?? null;
|
|
1809
1731
|
}
|
|
1810
1732
|
async function collectFiles(dir) {
|
|
1811
1733
|
const entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
@@ -1978,7 +1900,7 @@ function relativeUrl(fromDir, toFile) {
|
|
|
1978
1900
|
}
|
|
1979
1901
|
//#endregion
|
|
1980
1902
|
//#region src/plugin/config.ts
|
|
1981
|
-
async function resolveMuseaSharedConfig(resolvedConfig, loadConfigFile = loadConfig) {
|
|
1903
|
+
async function resolveMuseaSharedConfig(resolvedConfig, loadConfigFile = loadConfig, projectViteConfig = resolveViteConfigExport) {
|
|
1982
1904
|
let registration = getResolvedVizeConfigRegistration(resolvedConfig);
|
|
1983
1905
|
if (!registration.registered) {
|
|
1984
1906
|
await Promise.resolve();
|
|
@@ -1986,18 +1908,19 @@ async function resolveMuseaSharedConfig(resolvedConfig, loadConfigFile = loadCon
|
|
|
1986
1908
|
}
|
|
1987
1909
|
if (registration.registered) return await registration.config;
|
|
1988
1910
|
const configFile = process.env[VIZE_CONFIG_FILE_ENV];
|
|
1989
|
-
if (!configFile) return null;
|
|
1990
1911
|
try {
|
|
1912
|
+
const env = {
|
|
1913
|
+
mode: resolvedConfig.mode,
|
|
1914
|
+
command: resolvedConfig.command === "build" ? "build" : "serve",
|
|
1915
|
+
isSsrBuild: !!resolvedConfig.build?.ssr
|
|
1916
|
+
};
|
|
1991
1917
|
return await loadConfigFile(resolvedConfig.root, {
|
|
1992
1918
|
configFile,
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
isSsrBuild: !!resolvedConfig.build?.ssr
|
|
1997
|
-
}
|
|
1998
|
-
});
|
|
1919
|
+
viteConfig: false,
|
|
1920
|
+
env
|
|
1921
|
+
}) ?? await projectViteConfig(resolvedConfig, env);
|
|
1999
1922
|
} catch (error) {
|
|
2000
|
-
throw new Error(`[musea] Failed to load Vize config from ${configFile}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1923
|
+
throw new Error(`[musea] Failed to load Vize config from ${configFile ?? resolvedConfig.root}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
2001
1924
|
}
|
|
2002
1925
|
}
|
|
2003
1926
|
//#endregion
|
|
@@ -2047,6 +1970,34 @@ function hasLegacyVueSfcCompilerPlugin(plugins) {
|
|
|
2047
1970
|
});
|
|
2048
1971
|
}
|
|
2049
1972
|
//#endregion
|
|
1973
|
+
//#region src/gallery-dependencies.ts
|
|
1974
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
1975
|
+
const globPath = (entry) => normalizePath(entry).replace(/([*?{}[\]()!])/g, "\\$1");
|
|
1976
|
+
async function registerSourceGalleryDependencies(config) {
|
|
1977
|
+
const client = config.environments.client;
|
|
1978
|
+
const optimizer = client.optimizeDeps;
|
|
1979
|
+
const gallery = path.join(moduleDir, "../gallery/index.html");
|
|
1980
|
+
if (config.command !== "serve" || optimizer.disabled === true || optimizer.disabled === "dev" || optimizer.noDiscovery || existsSync(path.join(moduleDir, "gallery/index.html")) || !existsSync(gallery)) return;
|
|
1981
|
+
let entries = optimizer.entries;
|
|
1982
|
+
if (!entries) {
|
|
1983
|
+
const input = client.build.rollupOptions.input;
|
|
1984
|
+
if (input) {
|
|
1985
|
+
const inputs = typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input);
|
|
1986
|
+
const resolve = config.createResolver();
|
|
1987
|
+
entries = await Promise.all(inputs.map(async (entry) => {
|
|
1988
|
+
const resolved = await resolve(entry, path.join(process.cwd(), "*"));
|
|
1989
|
+
if (!resolved) throw new Error(`Failed to resolve gallery dependency scan input: ${entry}`);
|
|
1990
|
+
return globPath(resolved);
|
|
1991
|
+
}));
|
|
1992
|
+
} else entries = [
|
|
1993
|
+
"**/*.html",
|
|
1994
|
+
"!**/__tests__/**",
|
|
1995
|
+
"!**/coverage/**"
|
|
1996
|
+
];
|
|
1997
|
+
}
|
|
1998
|
+
optimizer.entries = [...new Set([...typeof entries === "string" ? [entries] : entries, globPath(gallery)])];
|
|
1999
|
+
}
|
|
2000
|
+
//#endregion
|
|
2050
2001
|
//#region src/plugin/index.ts
|
|
2051
2002
|
function musea(options = {}) {
|
|
2052
2003
|
let include = options.include ?? ["**/*.art.vue"];
|
|
@@ -2108,6 +2059,7 @@ function musea(options = {}) {
|
|
|
2108
2059
|
options: applyMuseaStaticBuildInput,
|
|
2109
2060
|
async configResolved(resolvedConfig) {
|
|
2110
2061
|
config = resolvedConfig;
|
|
2062
|
+
await registerSourceGalleryDependencies(resolvedConfig);
|
|
2111
2063
|
const vizeConfig = await resolveMuseaSharedConfig(resolvedConfig);
|
|
2112
2064
|
if (vizeConfig?.musea) {
|
|
2113
2065
|
const mc = vizeConfig.musea;
|
|
@@ -2118,6 +2070,7 @@ function musea(options = {}) {
|
|
|
2118
2070
|
if (options.inlineArt === void 0 && mc.inlineArt !== void 0) inlineArt = mc.inlineArt;
|
|
2119
2071
|
if (options.tokenPreviews === void 0 && mc.tokenPreviews !== void 0) tokenPreviewConfig = mc.tokenPreviews;
|
|
2120
2072
|
}
|
|
2073
|
+
if (basePath !== "/") basePath = basePath.replace(/\/+$/, "");
|
|
2121
2074
|
vueVersion = resolveStaticPreviewVueVersion(vueVersion, resolvedConfig.plugins);
|
|
2122
2075
|
if (toolbar.length > 0 && vueVersion !== 3 && vueVersion !== "2.7") throw new Error("[musea] Global toolbar controls require Vue 3 or Vue 2.7");
|
|
2123
2076
|
staticBuildEnabled = shouldEmitMuseaStaticGallery(resolvedConfig.command, storybookCompat);
|