tutuca 0.9.99 → 0.9.100

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.
@@ -9776,7 +9776,7 @@ class Renderer {
9776
9776
  return comp ? this._rValComp(stack, stack.it, comp, node, key, viewName) : null;
9777
9777
  }
9778
9778
  _rValComp(stack, val, comp, node, key, viewName) {
9779
- const cacheKey = `${viewName ?? stack.viewsId ?? ""}-${key}`;
9779
+ const cacheKey = `${viewName ?? ""}\x1F${stack.viewsId ?? ""}\x1F${key}`;
9780
9780
  const cachePath = [node, val];
9781
9781
  stack._pushDynBindValuesToArray(cachePath, comp);
9782
9782
  const cachedNode = this.cache.get(cachePath, cacheKey);
@@ -9821,7 +9821,7 @@ class Renderer {
9821
9821
  const renderOne = (key, value, attrName) => {
9822
9822
  const cachePath = enricher ? [view, it, value] : [view, value];
9823
9823
  const binds = { key, value };
9824
- const cacheKey = `${nid}-${key}`;
9824
+ const cacheKey = `${stack.viewsId ?? ""}\x1F${nid}\x1F${key}`;
9825
9825
  if (enricher)
9826
9826
  enricher.call(it, binds, key, value, iterData);
9827
9827
  const cachedNode = this.cache.get(cachePath, cacheKey);
@@ -16138,7 +16138,7 @@ ${JSON.stringify({ imports }, null, 6)}
16138
16138
  </html>
16139
16139
  `;
16140
16140
  }
16141
- function renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3 }) {
16141
+ function renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3, noCache }) {
16142
16142
  const lines = ['import { mountStorybook } from "tutuca/storybook";'];
16143
16143
  if (margaui) {
16144
16144
  lines.push('import { compileClassesToStyleText } from "tutuca/extra";');
@@ -16158,6 +16158,8 @@ function renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3 }) {
16158
16158
  optParts.push("compileCss: (app) => compileClassesToStyleText(app, compile)");
16159
16159
  if (inspect3)
16160
16160
  optParts.push("dev: { shadowCheckComponent, runTests, expect }");
16161
+ if (noCache)
16162
+ optParts.push("noCache: true");
16161
16163
  const opts = optParts.length ? `{ ${optParts.join(", ")} }` : "{}";
16162
16164
  lines.push("");
16163
16165
  lines.push(`const app = await mountStorybook("#app", [${modules}], ${opts});`);
@@ -16274,6 +16276,7 @@ async function run4(argv, opts = {}) {
16274
16276
  "no-check": { type: "boolean", default: false },
16275
16277
  "no-inspect": { type: "boolean", default: false },
16276
16278
  "no-tests": { type: "boolean", default: false },
16279
+ "no-cache": { type: "boolean", default: false },
16277
16280
  "dry-run": { type: "boolean", default: false },
16278
16281
  help: { type: "boolean", short: "h", default: false }
16279
16282
  },
@@ -16282,6 +16285,7 @@ async function run4(argv, opts = {}) {
16282
16285
  if (parsed.values.help) {
16283
16286
  process.stdout.write(`tutuca storybook [dir] [--port <n>] [--out <dir>] [--dry-run]
16284
16287
  [--no-margaui] [--no-check] [--no-inspect] [--no-tests]
16288
+ [--no-cache]
16285
16289
 
16286
16290
  Auto-discovers co-located *.dev.js modules (recursively, skipping
16287
16291
  node_modules/dotdirs) and serves a live storybook that mounts them via
@@ -16298,6 +16302,7 @@ async function run4(argv, opts = {}) {
16298
16302
  --no-check skip the in-browser check(app) dev validation
16299
16303
  --no-inspect skip the per-example Component/Instance/Data/Lint/Test tabs
16300
16304
  --no-tests skip running the modules' getTests() before serving
16305
+ --no-cache disable the render cache (NullDomCache); see every re-render
16301
16306
  `);
16302
16307
  return;
16303
16308
  }
@@ -16320,6 +16325,7 @@ async function run4(argv, opts = {}) {
16320
16325
  const margaui = !parsed.values["no-margaui"];
16321
16326
  const check = !parsed.values["no-check"];
16322
16327
  const inspect3 = !parsed.values["no-inspect"];
16328
+ const noCache = parsed.values["no-cache"];
16323
16329
  const self = findSelf();
16324
16330
  if (parsed.values.out) {
16325
16331
  const outDir = resolve5(parsed.values.out);
@@ -16328,7 +16334,7 @@ async function run4(argv, opts = {}) {
16328
16334
  const imports2 = buildImports(base2, { margaui });
16329
16335
  const bootstrapName = "tutuca-storybook.bootstrap.js";
16330
16336
  writeFileSync(resolve5(outDir, "index.html"), renderIndexHtml(imports2, { margaui, bootstrapUrl: `./${bootstrapName}` }));
16331
- writeFileSync(resolve5(outDir, bootstrapName), renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3 }));
16337
+ writeFileSync(resolve5(outDir, bootstrapName), renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3, noCache }));
16332
16338
  process.stdout.write(`wrote static storybook → ${relative2(process.cwd(), outDir) || "."}/
16333
16339
  index.html + ${bootstrapName} (${devModuleUrls.length} dev modules, CDN import map)
16334
16340
  Host it from the project root so /*.dev.js paths resolve.
@@ -16344,7 +16350,7 @@ async function run4(argv, opts = {}) {
16344
16350
  const result = {
16345
16351
  projectDir,
16346
16352
  tutuca: { source, base: base2, version: self.version },
16347
- options: { margaui, check, runTests: !parsed.values["no-tests"] },
16353
+ options: { margaui, check, noCache, runTests: !parsed.values["no-tests"] },
16348
16354
  imports: imports2,
16349
16355
  modules,
16350
16356
  tests
@@ -16357,7 +16363,7 @@ async function run4(argv, opts = {}) {
16357
16363
  process.stdout.write(`tutuca storybook dry run (no server started)
16358
16364
  project: ${projectDir}
16359
16365
  tutuca runtime: ${source} (${base2}, version ${self.version})
16360
- margaui: ${margaui ? "on" : "off"}, in-browser check: ${check ? "on" : "off"}
16366
+ margaui: ${margaui ? "on" : "off"}, in-browser check: ${check ? "on" : "off"}, cache: ${noCache ? "off" : "on"}
16361
16367
  ${modules.length} dev module(s):
16362
16368
  `);
16363
16369
  for (const m of modules) {
@@ -16413,7 +16419,7 @@ async function run4(argv, opts = {}) {
16413
16419
  const { base, serveDist } = resolveTutucaBase(projectDir, self, false);
16414
16420
  const imports = buildImports(base, { margaui });
16415
16421
  const indexHtml = renderIndexHtml(imports, { margaui, bootstrapUrl: BOOTSTRAP_URL });
16416
- const bootstrapJs = renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3 });
16422
+ const bootstrapJs = renderBootstrap(devModuleUrls, { margaui, check, inspect: inspect3, noCache });
16417
16423
  const server = createServer((req, res) => {
16418
16424
  const path = req.url.split("?")[0];
16419
16425
  if (path === "/" || path === "/index.html") {
@@ -1818,7 +1818,7 @@ class Renderer {
1818
1818
  return comp ? this._rValComp(stack, stack.it, comp, node, key, viewName) : null;
1819
1819
  }
1820
1820
  _rValComp(stack, val, comp, node, key, viewName) {
1821
- const cacheKey = `${viewName ?? stack.viewsId ?? ""}-${key}`;
1821
+ const cacheKey = `${viewName ?? ""}\x1F${stack.viewsId ?? ""}\x1F${key}`;
1822
1822
  const cachePath = [node, val];
1823
1823
  stack._pushDynBindValuesToArray(cachePath, comp);
1824
1824
  const cachedNode = this.cache.get(cachePath, cacheKey);
@@ -1863,7 +1863,7 @@ class Renderer {
1863
1863
  const renderOne = (key, value, attrName) => {
1864
1864
  const cachePath = enricher ? [view, it, value] : [view, value];
1865
1865
  const binds = { key, value };
1866
- const cacheKey = `${nid}-${key}`;
1866
+ const cacheKey = `${stack.viewsId ?? ""}\x1F${nid}\x1F${key}`;
1867
1867
  if (enricher)
1868
1868
  enricher.call(it, binds, key, value, iterData);
1869
1869
  const cachedNode = this.cache.get(cachePath, cacheKey);
@@ -9469,7 +9469,7 @@ class Renderer {
9469
9469
  return comp ? this._rValComp(stack, stack.it, comp, node, key, viewName) : null;
9470
9470
  }
9471
9471
  _rValComp(stack, val, comp, node, key, viewName) {
9472
- const cacheKey = `${viewName ?? stack.viewsId ?? ""}-${key}`;
9472
+ const cacheKey = `${viewName ?? ""}\x1F${stack.viewsId ?? ""}\x1F${key}`;
9473
9473
  const cachePath = [node, val];
9474
9474
  stack._pushDynBindValuesToArray(cachePath, comp);
9475
9475
  const cachedNode = this.cache.get(cachePath, cacheKey);
@@ -9514,7 +9514,7 @@ class Renderer {
9514
9514
  const renderOne = (key, value, attrName) => {
9515
9515
  const cachePath = enricher ? [view, it, value] : [view, value];
9516
9516
  const binds = { key, value };
9517
- const cacheKey = `${nid}-${key}`;
9517
+ const cacheKey = `${stack.viewsId ?? ""}\x1F${nid}\x1F${key}`;
9518
9518
  if (enricher)
9519
9519
  enricher.call(it, binds, key, value, iterData);
9520
9520
  const cachedNode = this.cache.get(cachePath, cacheKey);