tutuca 0.9.104 → 0.9.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tutuca-cli.js +25 -8
- package/package.json +1 -1
package/dist/tutuca-cli.js
CHANGED
|
@@ -16170,22 +16170,35 @@ function tutucaSource(base) {
|
|
|
16170
16170
|
return "node_modules";
|
|
16171
16171
|
return "local dist";
|
|
16172
16172
|
}
|
|
16173
|
+
function findInstalledPackage(startDir, pkg, probe) {
|
|
16174
|
+
let dir = resolve5(startDir);
|
|
16175
|
+
for (;; ) {
|
|
16176
|
+
const candidate = resolve5(dir, "node_modules", pkg);
|
|
16177
|
+
if (existsSync4(resolve5(candidate, probe)))
|
|
16178
|
+
return candidate;
|
|
16179
|
+
const parent = dirname4(dir);
|
|
16180
|
+
if (parent === dir)
|
|
16181
|
+
return null;
|
|
16182
|
+
dir = parent;
|
|
16183
|
+
}
|
|
16184
|
+
}
|
|
16173
16185
|
function resolveMargaui(projectDir, { forCdn, override }) {
|
|
16174
16186
|
if (override) {
|
|
16175
16187
|
const jsUrl = override.startsWith("http") ? override : `/${relative2(projectDir, resolve5(projectDir, override)).split(sep).join("/")}`;
|
|
16176
|
-
return { jsUrl, themeUrl: MARGAUI_THEME, source: "override" };
|
|
16188
|
+
return { jsUrl, themeUrl: MARGAUI_THEME, source: "override", serveDir: null };
|
|
16177
16189
|
}
|
|
16178
16190
|
if (!forCdn) {
|
|
16179
|
-
const
|
|
16180
|
-
if (
|
|
16191
|
+
const pkgDir = findInstalledPackage(projectDir, "margaui", "dist/margaui.min.js");
|
|
16192
|
+
if (pkgDir) {
|
|
16181
16193
|
return {
|
|
16182
|
-
jsUrl:
|
|
16183
|
-
themeUrl:
|
|
16184
|
-
source: "node_modules"
|
|
16194
|
+
jsUrl: `${MARGAUI_PREFIX}margaui.min.js`,
|
|
16195
|
+
themeUrl: `${MARGAUI_PREFIX}themes/theme.css`,
|
|
16196
|
+
source: "node_modules",
|
|
16197
|
+
serveDir: resolve5(pkgDir, "dist")
|
|
16185
16198
|
};
|
|
16186
16199
|
}
|
|
16187
16200
|
}
|
|
16188
|
-
return { jsUrl: MARGAUI_CDN, themeUrl: MARGAUI_THEME, source: "CDN" };
|
|
16201
|
+
return { jsUrl: MARGAUI_CDN, themeUrl: MARGAUI_THEME, source: "CDN", serveDir: null };
|
|
16189
16202
|
}
|
|
16190
16203
|
function buildImports(base, { margauiEnabled, margauiJsUrl }) {
|
|
16191
16204
|
const dev = `${base}/tutuca-dev.js`;
|
|
@@ -16566,6 +16579,10 @@ async function run4(argv, opts = {}) {
|
|
|
16566
16579
|
serveFile(res, safeJoin(serveDist, `/${path.slice(DIST_PREFIX.length)}`));
|
|
16567
16580
|
return;
|
|
16568
16581
|
}
|
|
16582
|
+
if (mg.serveDir && path.startsWith(MARGAUI_PREFIX)) {
|
|
16583
|
+
serveFile(res, safeJoin(mg.serveDir, `/${path.slice(MARGAUI_PREFIX.length)}`));
|
|
16584
|
+
return;
|
|
16585
|
+
}
|
|
16569
16586
|
serveFile(res, safeJoin(projectDir, path));
|
|
16570
16587
|
});
|
|
16571
16588
|
const preferred = Number.parseInt(parsed.values.port ?? "4321", 10);
|
|
@@ -16585,7 +16602,7 @@ async function run4(argv, opts = {}) {
|
|
|
16585
16602
|
});
|
|
16586
16603
|
server.listen(preferred);
|
|
16587
16604
|
}
|
|
16588
|
-
var describe4 = "Serve a storybook for the project's co-located *.dev.js modules (auto-discovered).", BOOTSTRAP_URL = "/__tutuca_storybook__.js", DIST_PREFIX = "/__tutuca__/", MIME, MARGAUI_CDN = "https://cdn.jsdelivr.net/npm/margaui/+esm", MARGAUI_THEME = "https://marianoguerra.github.io/margaui/themes/theme.css";
|
|
16605
|
+
var describe4 = "Serve a storybook for the project's co-located *.dev.js modules (auto-discovered).", BOOTSTRAP_URL = "/__tutuca_storybook__.js", DIST_PREFIX = "/__tutuca__/", MARGAUI_PREFIX = "/__margaui__/", MIME, MARGAUI_CDN = "https://cdn.jsdelivr.net/npm/margaui/+esm", MARGAUI_THEME = "https://marianoguerra.github.io/margaui/themes/theme.css";
|
|
16589
16606
|
var init_storybook = __esm(() => {
|
|
16590
16607
|
init_chai2();
|
|
16591
16608
|
init_test();
|