storybook 10.2.0-alpha.1 → 10.2.0-alpha.10
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/_browser-chunks/{Color-TNPFN3FC.js → Color-XESOIGZP.js} +9 -568
- package/dist/_browser-chunks/{WithTooltip-IO6J4KBT.js → WithTooltip-65CFNBJE.js} +70 -70
- package/dist/_browser-chunks/{chunk-45UGUKRX.js → chunk-242VQQM5.js} +1 -1
- package/dist/_browser-chunks/{chunk-JP7NCOJX.js → chunk-3LY4VQVK.js} +1 -1
- package/dist/_browser-chunks/{chunk-VYJQ7RU5.js → chunk-G4M6MXF4.js} +31 -27
- package/dist/_browser-chunks/{chunk-BRX2HXH7.js → chunk-IH6QJILI.js} +1 -1
- package/dist/_browser-chunks/{chunk-AS2HQEYC.js → chunk-IWQGIXJS.js} +1 -1
- package/dist/_browser-chunks/{chunk-3IAH5M2U.js → chunk-IYCKG66Y.js} +5 -5
- package/dist/_browser-chunks/{chunk-UD6FQLAF.js → chunk-JK6U3MQW.js} +3 -3
- package/dist/_browser-chunks/{chunk-FQ7SLVLR.js → chunk-JVRDBUUP.js} +20 -1
- package/dist/_browser-chunks/{chunk-GFLS4VP3.js → chunk-LCHBOIHN.js} +6 -6
- package/dist/_browser-chunks/{chunk-CHUV5WSW.js → chunk-LE2LTDW3.js} +1 -1
- package/dist/_browser-chunks/{chunk-IPA5A322.js → chunk-MEXTPDJG.js} +1 -1
- package/dist/_browser-chunks/{chunk-XJNX76GA.js → chunk-NQJGOFZV.js} +4 -4
- package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
- package/dist/_browser-chunks/{chunk-2XZMBGTA.js → chunk-POMIZRJL.js} +3 -3
- package/dist/_browser-chunks/{chunk-RP5RXKFU.js → chunk-Q5RYDXT3.js} +38 -30
- package/dist/_browser-chunks/{chunk-SS2NHR7W.js → chunk-RBABWY22.js} +18 -18
- package/dist/_browser-chunks/{chunk-AXG2BOBL.js → chunk-S6TK43XQ.js} +10 -10
- package/dist/_browser-chunks/{chunk-AIOS4NGK.js → chunk-SWJP5COI.js} +11 -11
- package/dist/_browser-chunks/{chunk-H6XK3RSC.js → chunk-UAYGIC3L.js} +6 -6
- package/dist/_browser-chunks/{chunk-YKE5S47A.js → chunk-V2VKKSMQ.js} +18 -18
- package/dist/_browser-chunks/{chunk-GFY5R5EY.js → chunk-V5NV5R37.js} +1 -1
- package/dist/_browser-chunks/chunk-VIJ7SQRO.js +568 -0
- package/dist/_browser-chunks/{chunk-3OXGAGBE.js → chunk-XLJZ7AOP.js} +14 -14
- package/dist/_browser-chunks/{chunk-P4F4UVXX.js → chunk-YKABRMAI.js} +15 -15
- package/dist/_browser-chunks/{chunk-WJYERY3R.js → chunk-ZCFV7BZB.js} +2 -2
- package/dist/_browser-chunks/{formatter-QJ4M4OGQ.js → formatter-EIJCOSYU.js} +2 -2
- package/dist/_browser-chunks/{syntaxhighlighter-IQDEPFLK.js → syntaxhighlighter-ED5Y7EFY.js} +119 -119
- package/dist/_node-chunks/{builder-manager-LXL5N6M5.js → builder-manager-IL56SHZF.js} +23 -22
- package/dist/_node-chunks/camelcase-P3NIWBZX.js +62 -0
- package/dist/_node-chunks/{chunk-SR5ZYD7K.js → chunk-BP66TAYC.js} +8 -8
- package/dist/_node-chunks/{chunk-R3WYNAT5.js → chunk-D3YJHXPC.js} +6 -6
- package/dist/_node-chunks/{chunk-5GNBLJKS.js → chunk-E2KSZELU.js} +8 -8
- package/dist/_node-chunks/{chunk-KXDU466E.js → chunk-EKU7ASGO.js} +31 -31
- package/dist/_node-chunks/chunk-GLYH3TSV.js +61 -0
- package/dist/_node-chunks/{chunk-GOOBGRAV.js → chunk-JXL37VS7.js} +34 -24
- package/dist/_node-chunks/{chunk-4BQMSZKI.js → chunk-KH2A547Y.js} +165 -191
- package/dist/_node-chunks/{chunk-77APSTTM.js → chunk-KP3IIE5P.js} +8 -9
- package/dist/_node-chunks/{chunk-5NWCBUGD.js → chunk-LZ5NNY6S.js} +6 -6
- package/dist/_node-chunks/{chunk-AJUO2ZU3.js → chunk-MLCI5FPI.js} +9 -9
- package/dist/_node-chunks/{chunk-CLNMK7MP.js → chunk-OVKHHS4W.js} +5434 -1625
- package/dist/_node-chunks/{chunk-ET4VMMZG.js → chunk-OZHIDIRL.js} +77 -16
- package/dist/_node-chunks/{chunk-TX77W2KY.js → chunk-POAHHCVK.js} +597 -593
- package/dist/_node-chunks/chunk-Q6PDB4Y6.js +126 -0
- package/dist/_node-chunks/{chunk-VFTNRF5X.js → chunk-QF3YWFYM.js} +17 -17
- package/dist/_node-chunks/{chunk-KMTK5W6O.js → chunk-RGJIQDLW.js} +48 -26
- package/dist/_node-chunks/{chunk-FTR6MHOX.js → chunk-SME7252C.js} +59 -147
- package/dist/_node-chunks/{chunk-LEDV47V2.js → chunk-TAETXAN6.js} +15 -15
- package/dist/_node-chunks/chunk-TPSZ4QDT.js +20 -0
- package/dist/_node-chunks/{chunk-PGFQADZC.js → chunk-WULYWBBT.js} +7 -7
- package/dist/_node-chunks/{chunk-JYMZJCZ7.js → chunk-XBDIQU4P.js} +62 -124
- package/dist/_node-chunks/chunk-XXOA6ULE.js +18 -0
- package/dist/_node-chunks/{chunk-ZI2RAI3I.js → chunk-YCQRVBE4.js} +26 -7
- package/dist/_node-chunks/{chunk-TP6ICLTL.js → chunk-YELE6V4D.js} +6 -6
- package/dist/_node-chunks/{chunk-GYZQMMTN.js → chunk-Z2CJCEHN.js} +9 -9
- package/dist/_node-chunks/{chunk-F7377GT2.js → chunk-Z2ETF7EI.js} +111 -38
- package/dist/_node-chunks/chunk-ZHSAQXJF.js +23 -0
- package/dist/_node-chunks/{dist-HGQ5R6JU.js → dist-5MXCD6KF.js} +10 -10
- package/dist/_node-chunks/{globby-5XJTXKUJ.js → globby-322GM5CY.js} +155 -164
- package/dist/_node-chunks/{lib-XNLTS2RI.js → lib-IXZT5UQX.js} +16 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-7WF3QWVO.js → mdx-N42X6CFJ-DBPHTSPN.js} +11 -11
- package/dist/_node-chunks/{p-limit-RBKYTJKF.js → p-limit-TLN4WCPA.js} +19 -15
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +40 -34
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +14 -11
- package/dist/channels/index.js +3 -3
- package/dist/cli/index.d.ts +1330 -250
- package/dist/cli/index.js +18 -18
- package/dist/common/index.d.ts +1344 -289
- package/dist/common/index.js +22 -22
- package/dist/components/index.d.ts +9 -2
- package/dist/components/index.js +339 -317
- package/dist/core-events/index.d.ts +4 -2
- package/dist/core-events/index.js +4 -2
- package/dist/core-server/index.d.ts +71 -2
- package/dist/core-server/index.js +3381 -3529
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +93 -65
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +86 -118
- package/dist/csf/index.d.ts +41 -11
- package/dist/csf/index.js +46 -39
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +5 -5
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +9402 -7204
- package/dist/manager/runtime.js +186 -143
- package/dist/manager-api/index.js +34 -26
- package/dist/manager-errors.d.ts +24 -0
- package/dist/manager-errors.js +2 -2
- package/dist/mocking-utils/index.js +14 -14
- package/dist/node-logger/index.d.ts +1456 -111
- package/dist/node-logger/index.js +9 -9
- package/dist/preview/runtime.js +4608 -2436
- package/dist/preview-api/index.js +12 -12
- package/dist/preview-errors.d.ts +24 -0
- package/dist/preview-errors.js +3 -3
- package/dist/router/index.js +11 -11
- package/dist/server-errors.d.ts +59 -3
- package/dist/server-errors.js +22 -11
- package/dist/telemetry/index.d.ts +10 -3
- package/dist/telemetry/index.js +27 -25
- package/dist/test/index.js +3237 -1653
- package/dist/theming/create.js +3 -3
- package/dist/theming/index.d.ts +5 -5
- package/dist/theming/index.js +38 -38
- package/dist/types/index.d.ts +12 -6
- package/dist/viewport/index.d.ts +3 -3
- package/package.json +27 -33
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +0 -18
- package/dist/_browser-chunks/chunk-QKODTO7K.js +0 -7
- package/dist/_node-chunks/camelcase-64II7H4U.js +0 -37
- package/dist/_node-chunks/chunk-4EZYJUAC.js +0 -70
- package/dist/_node-chunks/chunk-COQ27OZ3.js +0 -61
- package/dist/_node-chunks/chunk-MC2R4DSD.js +0 -20
- package/dist/_node-chunks/chunk-NEENMS4J.js +0 -18
- package/dist/_node-chunks/chunk-VR5LMO3F.js +0 -72
- package/dist/_node-chunks/chunk-XEPVDCRL.js +0 -23
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1qalasm8z9n from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1qalasm8z9n from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1qalasm8z9n from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1qalasm8z9n.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1qalasm8z9n.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1qalasm8z9n.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
version
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XXOA6ULE.js";
|
|
15
15
|
import {
|
|
16
16
|
createFileSystemCache,
|
|
17
17
|
execa,
|
|
@@ -19,29 +19,24 @@ import {
|
|
|
19
19
|
getProjectRoot,
|
|
20
20
|
resolvePathInStorybookCache,
|
|
21
21
|
up
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
getSessionId,
|
|
25
|
-
nanoid,
|
|
26
|
-
set
|
|
27
|
-
} from "./chunk-VR5LMO3F.js";
|
|
22
|
+
} from "./chunk-OVKHHS4W.js";
|
|
28
23
|
import {
|
|
29
24
|
globalSettings
|
|
30
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-QF3YWFYM.js";
|
|
31
26
|
import {
|
|
32
27
|
resolvePackageDir
|
|
33
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BP66TAYC.js";
|
|
34
29
|
import {
|
|
35
30
|
slash
|
|
36
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-TPSZ4QDT.js";
|
|
37
32
|
import {
|
|
38
33
|
__commonJS,
|
|
39
34
|
__toESM
|
|
40
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-LZ5NNY6S.js";
|
|
41
36
|
|
|
42
|
-
//
|
|
37
|
+
// ../../node_modules/fetch-retry/index.js
|
|
43
38
|
var require_fetch_retry = __commonJS({
|
|
44
|
-
"
|
|
39
|
+
"../../node_modules/fetch-retry/index.js"(exports, module) {
|
|
45
40
|
"use strict";
|
|
46
41
|
module.exports = function(fetch2, defaults) {
|
|
47
42
|
if (defaults = defaults || {}, typeof fetch2 != "function")
|
|
@@ -76,22 +71,22 @@ var require_fetch_retry = __commonJS({
|
|
|
76
71
|
retryOn = init.retryOn;
|
|
77
72
|
else
|
|
78
73
|
throw new ArgumentError("retryOn property expects an array or function");
|
|
79
|
-
return new Promise(function(
|
|
74
|
+
return new Promise(function(resolve2, reject) {
|
|
80
75
|
var wrappedFetch = function(attempt) {
|
|
81
76
|
var _input = typeof Request < "u" && input instanceof Request ? input.clone() : input;
|
|
82
77
|
fetch2(_input, init).then(function(response) {
|
|
83
78
|
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1)
|
|
84
|
-
|
|
79
|
+
resolve2(response);
|
|
85
80
|
else if (typeof retryOn == "function")
|
|
86
81
|
try {
|
|
87
82
|
return Promise.resolve(retryOn(attempt, null, response)).then(function(retryOnResponse) {
|
|
88
|
-
retryOnResponse ? retry2(attempt, null, response) :
|
|
83
|
+
retryOnResponse ? retry2(attempt, null, response) : resolve2(response);
|
|
89
84
|
}).catch(reject);
|
|
90
85
|
} catch (error) {
|
|
91
86
|
reject(error);
|
|
92
87
|
}
|
|
93
88
|
else
|
|
94
|
-
attempt < retries ? retry2(attempt, null, response) :
|
|
89
|
+
attempt < retries ? retry2(attempt, null, response) : resolve2(response);
|
|
95
90
|
}).catch(function(error) {
|
|
96
91
|
if (typeof retryOn == "function")
|
|
97
92
|
try {
|
|
@@ -174,8 +169,10 @@ function sanitizeError(error, pathSeparator = path.sep) {
|
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
// src/telemetry/storybook-metadata.ts
|
|
172
|
+
import { createHash } from "node:crypto";
|
|
173
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
177
174
|
import { readFile } from "node:fs/promises";
|
|
178
|
-
import { dirname } from "node:path";
|
|
175
|
+
import { dirname, resolve } from "node:path";
|
|
179
176
|
import {
|
|
180
177
|
getStorybookConfiguration,
|
|
181
178
|
getStorybookInfo as getStorybookInfo2,
|
|
@@ -183,6 +180,7 @@ import {
|
|
|
183
180
|
loadMainConfig,
|
|
184
181
|
versions
|
|
185
182
|
} from "storybook/internal/common";
|
|
183
|
+
import { getInterpretedFile } from "storybook/internal/common";
|
|
186
184
|
import { readConfig } from "storybook/internal/csf-tools";
|
|
187
185
|
|
|
188
186
|
// src/telemetry/get-application-file-count.ts
|
|
@@ -305,7 +303,7 @@ var monorepoConfigs = {
|
|
|
305
303
|
return "Workspaces";
|
|
306
304
|
};
|
|
307
305
|
|
|
308
|
-
//
|
|
306
|
+
// ../../node_modules/package-manager-detector/dist/commands.mjs
|
|
309
307
|
function dashDashArg(agent, agentCommand) {
|
|
310
308
|
return (args) => args.length > 1 ? [agent, agentCommand, args[0], "--", ...args.slice(1)] : [agent, agentCommand, args[0]];
|
|
311
309
|
}
|
|
@@ -407,7 +405,7 @@ var npm = {
|
|
|
407
405
|
deno
|
|
408
406
|
};
|
|
409
407
|
|
|
410
|
-
//
|
|
408
|
+
// ../../node_modules/package-manager-detector/dist/constants.mjs
|
|
411
409
|
var AGENTS = [
|
|
412
410
|
"npm",
|
|
413
411
|
"yarn",
|
|
@@ -441,7 +439,7 @@ var AGENTS = [
|
|
|
441
439
|
"bun.lockb": "bun"
|
|
442
440
|
};
|
|
443
441
|
|
|
444
|
-
//
|
|
442
|
+
// ../../node_modules/package-manager-detector/dist/detect.mjs
|
|
445
443
|
import fs from "node:fs/promises";
|
|
446
444
|
import path2 from "node:path";
|
|
447
445
|
import process2 from "node:process";
|
|
@@ -753,21 +751,34 @@ async function getPackageJsonDetails() {
|
|
|
753
751
|
packageJson: {}
|
|
754
752
|
};
|
|
755
753
|
}
|
|
756
|
-
var
|
|
757
|
-
|
|
758
|
-
|
|
754
|
+
var metadataCache = /* @__PURE__ */ new Map();
|
|
755
|
+
async function hashMainConfig(configDir) {
|
|
756
|
+
try {
|
|
757
|
+
let mainPath = getInterpretedFile(resolve(configDir, "main"));
|
|
758
|
+
if (!mainPath || !existsSync2(mainPath))
|
|
759
|
+
return "missing";
|
|
760
|
+
let content = await readFile(mainPath);
|
|
761
|
+
return createHash("sha256").update(new Uint8Array(content)).digest("hex");
|
|
762
|
+
} catch {
|
|
763
|
+
return "unknown";
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
var getStorybookMetadata = async (_configDir) => {
|
|
759
767
|
let { packageJson, packageJsonPath } = await getPackageJsonDetails(), configDir = (_configDir || getStorybookConfiguration(
|
|
760
768
|
String(packageJson?.scripts?.storybook || ""),
|
|
761
769
|
"-c",
|
|
762
770
|
"--config-dir"
|
|
763
|
-
)) ?? ".storybook",
|
|
764
|
-
|
|
765
|
-
|
|
771
|
+
)) ?? ".storybook", contentHash = await hashMainConfig(configDir), cacheKey = `${configDir}::${contentHash}`, cached = metadataCache.get(cacheKey);
|
|
772
|
+
if (cached)
|
|
773
|
+
return cached;
|
|
774
|
+
let mainConfig = await loadMainConfig({ configDir }).catch(() => {
|
|
775
|
+
}), computed = await computeStorybookMetadata({
|
|
766
776
|
mainConfig,
|
|
767
777
|
packageJson,
|
|
768
778
|
packageJsonPath,
|
|
769
779
|
configDir
|
|
770
|
-
})
|
|
780
|
+
});
|
|
781
|
+
return metadataCache.set(cacheKey, computed), computed;
|
|
771
782
|
};
|
|
772
783
|
|
|
773
784
|
// src/telemetry/telemetry.ts
|
|
@@ -777,15 +788,33 @@ import * as os from "node:os";
|
|
|
777
788
|
import { join as join2 } from "node:path";
|
|
778
789
|
import { isCI as isCI2 } from "storybook/internal/common";
|
|
779
790
|
|
|
791
|
+
// ../../node_modules/nanoid/index.js
|
|
792
|
+
import { randomFillSync } from "crypto";
|
|
793
|
+
|
|
794
|
+
// ../../node_modules/nanoid/url-alphabet/index.js
|
|
795
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
796
|
+
|
|
797
|
+
// ../../node_modules/nanoid/index.js
|
|
798
|
+
var POOL_SIZE_MULTIPLIER = 128, pool, poolOffset, fillPool = (bytes) => {
|
|
799
|
+
!pool || pool.length < bytes ? (pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER), randomFillSync(pool), poolOffset = 0) : poolOffset + bytes > pool.length && (randomFillSync(pool), poolOffset = 0), poolOffset += bytes;
|
|
800
|
+
};
|
|
801
|
+
var nanoid = (size = 21) => {
|
|
802
|
+
fillPool(size -= 0);
|
|
803
|
+
let id = "";
|
|
804
|
+
for (let i = poolOffset - size; i < poolOffset; i++)
|
|
805
|
+
id += urlAlphabet[pool[i] & 63];
|
|
806
|
+
return id;
|
|
807
|
+
};
|
|
808
|
+
|
|
780
809
|
// src/telemetry/anonymous-id.ts
|
|
781
810
|
import { relative } from "node:path";
|
|
782
811
|
import { getProjectRoot as getProjectRoot3 } from "storybook/internal/common";
|
|
783
812
|
import { execSync } from "child_process";
|
|
784
813
|
|
|
785
814
|
// src/telemetry/one-way-hash.ts
|
|
786
|
-
import { createHash } from "crypto";
|
|
815
|
+
import { createHash as createHash2 } from "crypto";
|
|
787
816
|
var oneWayHash = (payload) => {
|
|
788
|
-
let hash =
|
|
817
|
+
let hash = createHash2("sha256");
|
|
789
818
|
return hash.update("storybook-telemetry-salt"), hash.update(payload), hash.digest("hex");
|
|
790
819
|
};
|
|
791
820
|
|
|
@@ -811,9 +840,50 @@ var anonymousProjectId, getAnonymousProjectId = () => {
|
|
|
811
840
|
return anonymousProjectId;
|
|
812
841
|
};
|
|
813
842
|
|
|
843
|
+
// src/telemetry/event-cache.ts
|
|
844
|
+
import { cache as cache3 } from "storybook/internal/common";
|
|
845
|
+
var processingPromise = Promise.resolve(), setHelper = async (eventType, body) => {
|
|
846
|
+
let lastEvents = await cache3.get("lastEvents") || {};
|
|
847
|
+
lastEvents[eventType] = { body, timestamp: Date.now() }, await cache3.set("lastEvents", lastEvents);
|
|
848
|
+
}, set = (eventType, body) => {
|
|
849
|
+
let run = processingPromise.then(async () => {
|
|
850
|
+
await setHelper(eventType, body);
|
|
851
|
+
});
|
|
852
|
+
return processingPromise = run.catch(() => {
|
|
853
|
+
}), run;
|
|
854
|
+
};
|
|
855
|
+
var getLastEvents = async () => (await processingPromise, await cache3.get("lastEvents") || {}), upgradeFields = (event) => {
|
|
856
|
+
let { body, timestamp } = event;
|
|
857
|
+
return {
|
|
858
|
+
timestamp,
|
|
859
|
+
eventType: body?.eventType,
|
|
860
|
+
eventId: body?.eventId,
|
|
861
|
+
sessionId: body?.sessionId
|
|
862
|
+
};
|
|
863
|
+
}, UPGRADE_EVENTS = ["init", "upgrade"], RUN_EVENTS = ["build", "dev", "error"], lastEvent = (lastEvents, eventTypes) => {
|
|
864
|
+
let descendingEvents = eventTypes.map((eventType) => lastEvents?.[eventType]).filter((event) => !!event).sort((a, b) => b.timestamp - a.timestamp);
|
|
865
|
+
return descendingEvents.length > 0 ? descendingEvents[0] : void 0;
|
|
866
|
+
}, getPrecedingUpgrade = async (events = void 0) => {
|
|
867
|
+
let lastEvents = events || await cache3.get("lastEvents") || {}, lastUpgradeEvent = lastEvent(lastEvents, UPGRADE_EVENTS), lastRunEvent = lastEvent(lastEvents, RUN_EVENTS);
|
|
868
|
+
if (lastUpgradeEvent)
|
|
869
|
+
return !lastRunEvent?.timestamp || lastUpgradeEvent.timestamp > lastRunEvent.timestamp ? upgradeFields(lastUpgradeEvent) : void 0;
|
|
870
|
+
};
|
|
871
|
+
|
|
814
872
|
// src/telemetry/fetch.ts
|
|
815
873
|
var fetch = global.fetch;
|
|
816
874
|
|
|
875
|
+
// src/telemetry/session-id.ts
|
|
876
|
+
import { cache as cache4 } from "storybook/internal/common";
|
|
877
|
+
var SESSION_TIMEOUT = 1e3 * 60 * 60 * 2, sessionId;
|
|
878
|
+
var getSessionId = async () => {
|
|
879
|
+
let now = Date.now();
|
|
880
|
+
if (!sessionId) {
|
|
881
|
+
let session = await cache4.get("session");
|
|
882
|
+
session && session.lastUsed >= now - SESSION_TIMEOUT ? sessionId = session.id : sessionId = nanoid();
|
|
883
|
+
}
|
|
884
|
+
return await cache4.set("session", { id: sessionId, lastUsed: now }), sessionId;
|
|
885
|
+
};
|
|
886
|
+
|
|
817
887
|
// src/telemetry/telemetry.ts
|
|
818
888
|
var retryingFetch = (0, import_fetch_retry.default)(fetch), URL = process.env.STORYBOOK_TELEMETRY_URL || "https://storybook.js.org/event-log", tasks = [], addToGlobalContext = (key, value) => {
|
|
819
889
|
globalContext[key] = value;
|
|
@@ -831,7 +901,7 @@ var retryingFetch = (0, import_fetch_retry.default)(fetch), URL = process.env.ST
|
|
|
831
901
|
nodeVersion: process.versions.node,
|
|
832
902
|
storybookVersion: getVersionNumber()
|
|
833
903
|
}, prepareRequest = async (data, context, options) => {
|
|
834
|
-
let { eventType, payload, metadata, ...rest } = data,
|
|
904
|
+
let { eventType, payload, metadata, ...rest } = data, sessionId2 = await getSessionId(), eventId = nanoid(), body = { ...rest, eventType, eventId, sessionId: sessionId2, metadata, payload, context };
|
|
835
905
|
return retryingFetch(URL, {
|
|
836
906
|
method: "post",
|
|
837
907
|
body: JSON.stringify(body),
|
|
@@ -855,7 +925,7 @@ async function sendTelemetry(data, options = { retryDelay: 1e3, immediate: !1 })
|
|
|
855
925
|
}, request;
|
|
856
926
|
try {
|
|
857
927
|
request = prepareRequest(data, context, options), tasks.push(request);
|
|
858
|
-
let
|
|
928
|
+
let sessionId2 = await getSessionId(), eventId = nanoid(), body = { ...rest, eventType, eventId, sessionId: sessionId2, metadata, payload, context }, waitFor = options.immediate ? tasks : [request];
|
|
859
929
|
await Promise.all([...waitFor, set(eventType, body)]);
|
|
860
930
|
} catch {
|
|
861
931
|
} finally {
|
|
@@ -905,6 +975,9 @@ export {
|
|
|
905
975
|
computeStorybookMetadata,
|
|
906
976
|
getStorybookMetadata,
|
|
907
977
|
oneWayHash,
|
|
978
|
+
getLastEvents,
|
|
979
|
+
getPrecedingUpgrade,
|
|
980
|
+
getSessionId,
|
|
908
981
|
addToGlobalContext,
|
|
909
982
|
ErrorCollector,
|
|
910
983
|
isExampleStoryId,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1qalasm8z9n from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1qalasm8z9n from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1qalasm8z9n from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1qalasm8z9n.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1qalasm8z9n.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1qalasm8z9n.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
any
|
|
14
|
+
} from "./chunk-Q6PDB4Y6.js";
|
|
15
|
+
|
|
16
|
+
// src/cli/detect.ts
|
|
17
|
+
async function detectPnp() {
|
|
18
|
+
return !!any([".pnp.js", ".pnp.cjs"]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
detectPnp
|
|
23
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_1qalasm8z9n from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_1qalasm8z9n from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_1qalasm8z9n from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_1qalasm8z9n.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_1qalasm8z9n.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_1qalasm8z9n.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
toEstree
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-E2KSZELU.js";
|
|
15
|
+
import "./chunk-LZ5NNY6S.js";
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// ../../node_modules/@storybook/docs-mdx/dist/index.js
|
|
18
18
|
var getAttr = (elt, what) => elt.attributes.find((n) => n.type === "JSXAttribute" && n.name.name === what), getAttrValue = (elt, what) => getAttr(elt, what)?.value, getAttrLiteral = (elt, what) => {
|
|
19
19
|
let attrValue = getAttrValue(elt, what);
|
|
20
20
|
if (attrValue) {
|
|
@@ -107,7 +107,7 @@ var getAttr = (elt, what) => elt.attributes.find((n) => n.type === "JSXAttribute
|
|
|
107
107
|
isTemplate: !1,
|
|
108
108
|
metaTags: void 0,
|
|
109
109
|
imports: void 0
|
|
110
|
-
}, { compile } = await import("./mdx-N42X6CFJ-
|
|
110
|
+
}, { compile } = await import("./mdx-N42X6CFJ-DBPHTSPN.js");
|
|
111
111
|
await compile(code, {
|
|
112
112
|
rehypePlugins: [[plugin, store]]
|
|
113
113
|
});
|