storybook 10.0.0-beta.0 → 10.0.0-beta.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/assets/server/openBrowser.applescript +94 -0
- package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
- package/dist/_browser-chunks/{WithTooltip-2E62HIBN.js → WithTooltip-SK46ZJ2J.js} +1 -1
- package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
- package/dist/_browser-chunks/{chunk-FWKO3E35.js → chunk-BOOOPFZF.js} +10 -3
- package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
- package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
- package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
- package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
- package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
- package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
- package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
- package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
- package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
- package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
- package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
- package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
- package/dist/_node-chunks/{builder-manager-OW6YGKXV.js → builder-manager-SJGIDEN6.js} +45 -155
- package/dist/_node-chunks/camelcase-VZHWABQV.js +18 -0
- package/dist/_node-chunks/{chunk-6JSVPEAU.js → chunk-6CZW7AGN.js} +7 -7
- package/dist/_node-chunks/{chunk-CD3IP6HA.js → chunk-6XT5OLNL.js} +12 -12
- package/dist/_node-chunks/{chunk-2H7LZ2SD.js → chunk-AHRH5RPR.js} +7 -7
- package/dist/_node-chunks/{chunk-5HLANIBM.js → chunk-AOH6ABSV.js} +7 -7
- package/dist/_node-chunks/chunk-C5V22GP7.js +79 -0
- package/dist/_node-chunks/{chunk-IBXERYDG.js → chunk-FIROF4DV.js} +7 -7
- package/dist/_node-chunks/{chunk-I3YCPGZJ.js → chunk-GUJVZUYI.js} +7 -7
- package/dist/_node-chunks/chunk-IHPLRRAR.js +4741 -0
- package/dist/_node-chunks/{chunk-7TISOZS6.js → chunk-JMXKCRWR.js} +30 -21
- package/dist/_node-chunks/{chunk-YWGNEBRO.js → chunk-JUMUXWEV.js} +162 -103
- package/dist/_node-chunks/{chunk-UIREEOC7.js → chunk-KGX33KXX.js} +7 -7
- package/dist/_node-chunks/{chunk-3QB3ZG6H.js → chunk-KLVABNEU.js} +7 -7
- package/dist/_node-chunks/{chunk-H5LTFJHQ.js → chunk-OL6DY6BT.js} +631 -752
- package/dist/_node-chunks/{chunk-X5GAZ3EW.js → chunk-ONJV3K2L.js} +399 -116
- package/dist/_node-chunks/{chunk-LKB7KRSV.js → chunk-PTHTD4RO.js} +223 -243
- package/dist/_node-chunks/{chunk-UHHZPSP7.js → chunk-QQ3Z5KGJ.js} +6 -6
- package/dist/_node-chunks/{chunk-MUD3GH3L.js → chunk-QRTDDTZJ.js} +9 -9
- package/dist/_node-chunks/chunk-R54K4KSM.js +1540 -0
- package/dist/_node-chunks/{chunk-IQAUGVYR.js → chunk-S2LZC6JK.js} +8 -8
- package/dist/_node-chunks/chunk-SFJFSPRT.js +62 -0
- package/dist/_node-chunks/{chunk-LH3BEEIR.js → chunk-SSN5PKIY.js} +6 -6
- package/dist/_node-chunks/{chunk-NOQITS3C.js → chunk-SXR2DITB.js} +7 -7
- package/dist/_node-chunks/{chunk-FWUE7SRE.js → chunk-TH5QVQRL.js} +7 -7
- package/dist/_node-chunks/chunk-U34NWAU2.js +18 -0
- package/dist/_node-chunks/{chunk-FBMMEEO4.js → chunk-UV3CZ3KS.js} +7 -7
- package/dist/_node-chunks/{chunk-NZGJJABJ.js → chunk-UVUGJDAI.js} +60 -102
- package/dist/_node-chunks/{chunk-GZUNYRFU.js → chunk-VOUNSD2E.js} +7 -7
- package/dist/_node-chunks/chunk-WFCPBKQJ.js +64656 -0
- package/dist/_node-chunks/{chunk-BFXER3XW.js → chunk-XHF3WWNP.js} +623 -750
- package/dist/_node-chunks/{chunk-ANEKBWDX.js → chunk-XU45KXNQ.js} +16 -25
- package/dist/_node-chunks/{camelcase-2K3EMR6G.js → chunk-YHO6XR7U.js} +9 -8
- package/dist/_node-chunks/{dist-465RSKRC.js → dist-IIC5PBL7.js} +9 -9
- package/dist/_node-chunks/{globby-LJ3MVB6M.js → globby-CJACC3HJ.js} +17 -13
- package/dist/_node-chunks/{lib-OW3DENXB.js → lib-ZY4TKSOR.js} +40 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-PYX2IFUO.js → mdx-N42X6CFJ-3XNW3DFO.js} +8 -8
- package/dist/_node-chunks/{p-limit-X4OG45RB.js → p-limit-R2OFT5HE.js} +76 -10
- package/dist/_node-chunks/{plugin-ALTIQMDE.js → plugin-5XD5R2KD.js} +10 -10
- package/dist/_node-chunks/{plugin-GE36R32R.js → plugin-WAWVQMVR.js} +10 -12
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-NLCAF7S6.js → webpack-inject-mocker-runtime-plugin-SCRGJLIS.js} +1307 -847
- package/dist/_node-chunks/{webpack-mock-plugin-BRYODMCC.js → webpack-mock-plugin-3VAXEGG2.js} +9 -11
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/index.js +11 -12
- package/dist/bin/core.js +638 -187
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.d.ts +62 -75
- package/dist/cli/index.js +66 -56
- package/dist/common/index.d.ts +3 -1
- package/dist/common/index.js +22 -22
- package/dist/components/index.d.ts +234 -2
- package/dist/components/index.js +74 -5741
- package/dist/core-events/index.d.ts +18 -2
- package/dist/core-events/index.js +7 -1
- package/dist/core-server/index.d.ts +540 -39
- package/dist/core-server/index.js +4647 -4182
- package/dist/core-server/presets/common-manager.js +1570 -1272
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +691 -38
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -11
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -12
- package/dist/csf/index.d.ts +9 -4
- package/dist/csf/index.js +50 -15
- package/dist/csf-tools/index.d.ts +47 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +4 -4
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +9233 -18113
- package/dist/manager/globals.d.ts +0 -4
- package/dist/manager/globals.js +1 -6
- package/dist/manager/runtime.js +13396 -11518
- package/dist/manager-api/index.d.ts +540 -32
- package/dist/manager-api/index.js +364 -90
- package/dist/manager-errors.d.ts +527 -0
- package/dist/node-logger/index.d.ts +1 -1
- package/dist/node-logger/index.js +1136 -662
- package/dist/preview/globals.js +1 -1
- package/dist/preview/runtime.js +12103 -21579
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +10 -10
- package/dist/preview-errors.d.ts +527 -0
- package/dist/router/index.d.ts +668 -10
- package/dist/router/index.js +2 -2
- package/dist/server-errors.d.ts +527 -0
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +23 -25
- package/dist/test/index.js +1874 -4024
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js +6 -6
- package/dist/types/index.d.ts +553 -16
- package/dist/viewport/index.d.ts +36 -4
- package/dist/viewport/index.js +1 -1
- package/package.json +9 -46
- package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
- package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
- package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
- package/dist/_node-chunks/chunk-27W2Z6VL.js +0 -28502
- package/dist/_node-chunks/chunk-G46DWX7Z.js +0 -266
- package/dist/_node-chunks/chunk-GZZDIJIB.js +0 -80
- package/dist/_node-chunks/chunk-JDKH3XYB.js +0 -9845
- package/dist/_node-chunks/chunk-R7RKO2DC.js +0 -35783
- package/dist/_node-chunks/chunk-T23YQHYB.js +0 -62
- package/dist/_node-chunks/chunk-VKKLKNFC.js +0 -2377
- package/dist/_node-chunks/chunk-W6GKFQ7F.js +0 -87
- package/dist/_node-chunks/chunk-YUYBO6S7.js +0 -18
- package/dist/_node-chunks/default-browser-id-Z6WQ7DZA.js +0 -1719
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_kzg6jc8bd2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_kzg6jc8bd2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_kzg6jc8bd2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_kzg6jc8bd2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_kzg6jc8bd2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_kzg6jc8bd2.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
|
require_picomatch
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
parseNodeModulePath,
|
|
17
|
-
resolvePathSync
|
|
18
|
-
} from "./chunk-JDKH3XYB.js";
|
|
14
|
+
} from "./chunk-TH5QVQRL.js";
|
|
19
15
|
import {
|
|
20
16
|
versions_default
|
|
21
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SFJFSPRT.js";
|
|
22
18
|
import {
|
|
23
19
|
BUN_LOCKFILE,
|
|
24
20
|
BUN_LOCKFILE_BINARY,
|
|
@@ -27,45 +23,46 @@ import {
|
|
|
27
23
|
YARN_LOCKFILE,
|
|
28
24
|
execa,
|
|
29
25
|
execaCommandSync,
|
|
26
|
+
findFilesUp,
|
|
30
27
|
getProjectRoot,
|
|
31
28
|
normalizeStoryPath,
|
|
32
29
|
require_cross_spawn
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IHPLRRAR.js";
|
|
34
31
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} from "./chunk-G46DWX7Z.js";
|
|
32
|
+
any,
|
|
33
|
+
from,
|
|
34
|
+
up2 as up
|
|
35
|
+
} from "./chunk-C5V22GP7.js";
|
|
40
36
|
import {
|
|
41
37
|
invariant
|
|
42
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-KGX33KXX.js";
|
|
43
39
|
import {
|
|
44
40
|
importModule,
|
|
41
|
+
resolveModulePath,
|
|
45
42
|
resolvePackageDir,
|
|
46
43
|
safeResolveModule
|
|
47
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-R54K4KSM.js";
|
|
48
45
|
import {
|
|
49
46
|
join,
|
|
50
47
|
parse,
|
|
51
48
|
resolve
|
|
52
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-AOH6ABSV.js";
|
|
53
50
|
import {
|
|
54
51
|
require_prompts
|
|
55
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-UV3CZ3KS.js";
|
|
56
53
|
import {
|
|
57
54
|
glob,
|
|
58
55
|
globSync
|
|
59
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-S2LZC6JK.js";
|
|
60
57
|
import {
|
|
61
58
|
slash
|
|
62
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-KLVABNEU.js";
|
|
63
60
|
import {
|
|
64
61
|
require_dist
|
|
65
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-GUJVZUYI.js";
|
|
66
63
|
import {
|
|
67
64
|
require_picocolors
|
|
68
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-FIROF4DV.js";
|
|
69
66
|
import {
|
|
70
67
|
__commonJS,
|
|
71
68
|
__esm,
|
|
@@ -74,84 +71,7 @@ import {
|
|
|
74
71
|
__require,
|
|
75
72
|
__toCommonJS,
|
|
76
73
|
__toESM
|
|
77
|
-
} from "./chunk-
|
|
78
|
-
|
|
79
|
-
// ../node_modules/common-path-prefix/index.js
|
|
80
|
-
var require_common_path_prefix = __commonJS({
|
|
81
|
-
"../node_modules/common-path-prefix/index.js"(exports, module) {
|
|
82
|
-
"use strict";
|
|
83
|
-
var { sep: DEFAULT_SEPARATOR } = __require("path");
|
|
84
|
-
var determineSeparator = /* @__PURE__ */ __name((paths) => {
|
|
85
|
-
for (const path4 of paths) {
|
|
86
|
-
const match = /(\/|\\)/.exec(path4);
|
|
87
|
-
if (match !== null) return match[0];
|
|
88
|
-
}
|
|
89
|
-
return DEFAULT_SEPARATOR;
|
|
90
|
-
}, "determineSeparator");
|
|
91
|
-
module.exports = /* @__PURE__ */ __name(function commonPathPrefix2(paths, sep2 = determineSeparator(paths)) {
|
|
92
|
-
const [first = "", ...remaining] = paths;
|
|
93
|
-
if (first === "" || remaining.length === 0) return "";
|
|
94
|
-
const parts = first.split(sep2);
|
|
95
|
-
let endOfPrefix = parts.length;
|
|
96
|
-
for (const path4 of remaining) {
|
|
97
|
-
const compare = path4.split(sep2);
|
|
98
|
-
for (let i = 0; i < endOfPrefix; i++) {
|
|
99
|
-
if (compare[i] !== parts[i]) {
|
|
100
|
-
endOfPrefix = i;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (endOfPrefix === 0) return "";
|
|
104
|
-
}
|
|
105
|
-
const prefix = parts.slice(0, endOfPrefix).join(sep2);
|
|
106
|
-
return prefix.endsWith(sep2) ? prefix : prefix + sep2;
|
|
107
|
-
}, "commonPathPrefix");
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// ../node_modules/resolve-from/index.js
|
|
112
|
-
var require_resolve_from = __commonJS({
|
|
113
|
-
"../node_modules/resolve-from/index.js"(exports, module) {
|
|
114
|
-
"use strict";
|
|
115
|
-
var path4 = __require("path");
|
|
116
|
-
var Module = __require("module");
|
|
117
|
-
var fs2 = __require("fs");
|
|
118
|
-
var resolveFrom2 = /* @__PURE__ */ __name((fromDirectory, moduleId, silent) => {
|
|
119
|
-
if (typeof fromDirectory !== "string") {
|
|
120
|
-
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
|
|
121
|
-
}
|
|
122
|
-
if (typeof moduleId !== "string") {
|
|
123
|
-
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
fromDirectory = fs2.realpathSync(fromDirectory);
|
|
127
|
-
} catch (error) {
|
|
128
|
-
if (error.code === "ENOENT") {
|
|
129
|
-
fromDirectory = path4.resolve(fromDirectory);
|
|
130
|
-
} else if (silent) {
|
|
131
|
-
return;
|
|
132
|
-
} else {
|
|
133
|
-
throw error;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const fromFile = path4.join(fromDirectory, "noop.js");
|
|
137
|
-
const resolveFileName = /* @__PURE__ */ __name(() => Module._resolveFilename(moduleId, {
|
|
138
|
-
id: fromFile,
|
|
139
|
-
filename: fromFile,
|
|
140
|
-
paths: Module._nodeModulePaths(fromDirectory)
|
|
141
|
-
}), "resolveFileName");
|
|
142
|
-
if (silent) {
|
|
143
|
-
try {
|
|
144
|
-
return resolveFileName();
|
|
145
|
-
} catch (error) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return resolveFileName();
|
|
150
|
-
}, "resolveFrom");
|
|
151
|
-
module.exports = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId);
|
|
152
|
-
module.exports.silent = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId, true);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
74
|
+
} from "./chunk-SSN5PKIY.js";
|
|
155
75
|
|
|
156
76
|
// ../node_modules/@yarnpkg/fslib/node_modules/tslib/tslib.es6.js
|
|
157
77
|
var tslib_es6_exports = {};
|
|
@@ -820,23 +740,23 @@ var require_path = __commonJS({
|
|
|
820
740
|
return path_1.default.posix.resolve(exports.ppath.cwd(), ...segments);
|
|
821
741
|
}
|
|
822
742
|
};
|
|
823
|
-
var contains = /* @__PURE__ */ __name(function(pathUtils,
|
|
824
|
-
|
|
743
|
+
var contains = /* @__PURE__ */ __name(function(pathUtils, from2, to) {
|
|
744
|
+
from2 = pathUtils.normalize(from2);
|
|
825
745
|
to = pathUtils.normalize(to);
|
|
826
|
-
if (
|
|
746
|
+
if (from2 === to)
|
|
827
747
|
return `.`;
|
|
828
|
-
if (!
|
|
829
|
-
|
|
830
|
-
if (to.startsWith(
|
|
831
|
-
return to.slice(
|
|
748
|
+
if (!from2.endsWith(pathUtils.sep))
|
|
749
|
+
from2 = from2 + pathUtils.sep;
|
|
750
|
+
if (to.startsWith(from2)) {
|
|
751
|
+
return to.slice(from2.length);
|
|
832
752
|
} else {
|
|
833
753
|
return null;
|
|
834
754
|
}
|
|
835
755
|
}, "contains");
|
|
836
756
|
exports.npath.fromPortablePath = fromPortablePath;
|
|
837
757
|
exports.npath.toPortablePath = toPortablePath;
|
|
838
|
-
exports.npath.contains = (
|
|
839
|
-
exports.ppath.contains = (
|
|
758
|
+
exports.npath.contains = (from2, to) => contains(exports.npath, from2, to);
|
|
759
|
+
exports.ppath.contains = (from2, to) => contains(exports.ppath, from2, to);
|
|
840
760
|
var WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
|
|
841
761
|
var UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
|
|
842
762
|
var PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
|
|
@@ -889,9 +809,9 @@ var require_copyPromise = __commonJS({
|
|
|
889
809
|
exports.copyPromise = exports.LinkStrategy = void 0;
|
|
890
810
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
891
811
|
var fs_1 = tslib_1.__importDefault(__require("fs"));
|
|
892
|
-
var
|
|
812
|
+
var constants2 = tslib_1.__importStar(require_constants());
|
|
893
813
|
var path_1 = require_path();
|
|
894
|
-
var defaultTime = new Date(
|
|
814
|
+
var defaultTime = new Date(constants2.SAFE_TIME * 1e3);
|
|
895
815
|
var LinkStrategy;
|
|
896
816
|
(function(LinkStrategy2) {
|
|
897
817
|
LinkStrategy2["Allow"] = "allow";
|
|
@@ -1168,8 +1088,8 @@ var require_opendir = __commonJS({
|
|
|
1168
1088
|
static {
|
|
1169
1089
|
__name(this, "CustomDir");
|
|
1170
1090
|
}
|
|
1171
|
-
constructor(
|
|
1172
|
-
this.path =
|
|
1091
|
+
constructor(path, nextDirent, opts = {}) {
|
|
1092
|
+
this.path = path;
|
|
1173
1093
|
this.nextDirent = nextDirent;
|
|
1174
1094
|
this.opts = opts;
|
|
1175
1095
|
this.closed = false;
|
|
@@ -1213,16 +1133,16 @@ var require_opendir = __commonJS({
|
|
|
1213
1133
|
}
|
|
1214
1134
|
};
|
|
1215
1135
|
exports.CustomDir = CustomDir;
|
|
1216
|
-
function opendir(fakeFs,
|
|
1136
|
+
function opendir(fakeFs, path, entries, opts) {
|
|
1217
1137
|
const nextDirent = /* @__PURE__ */ __name(() => {
|
|
1218
1138
|
const filename = entries.shift();
|
|
1219
1139
|
if (typeof filename === `undefined`)
|
|
1220
1140
|
return null;
|
|
1221
|
-
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(
|
|
1141
|
+
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(path, filename)), {
|
|
1222
1142
|
name: filename
|
|
1223
1143
|
});
|
|
1224
1144
|
}, "nextDirent");
|
|
1225
|
-
return new CustomDir(
|
|
1145
|
+
return new CustomDir(path, nextDirent, opts);
|
|
1226
1146
|
}
|
|
1227
1147
|
__name(opendir, "opendir");
|
|
1228
1148
|
exports.opendir = opendir;
|
|
@@ -1727,8 +1647,8 @@ var require_NodeFS = __commonJS({
|
|
|
1727
1647
|
async realpathPromise(p) {
|
|
1728
1648
|
return await new Promise((resolve8, reject) => {
|
|
1729
1649
|
this.realFs.realpath(path_1.npath.fromPortablePath(p), {}, this.makeCallback(resolve8, reject));
|
|
1730
|
-
}).then((
|
|
1731
|
-
return path_1.npath.toPortablePath(
|
|
1650
|
+
}).then((path) => {
|
|
1651
|
+
return path_1.npath.toPortablePath(path);
|
|
1732
1652
|
});
|
|
1733
1653
|
}
|
|
1734
1654
|
realpathSync(p) {
|
|
@@ -1977,8 +1897,8 @@ var require_NodeFS = __commonJS({
|
|
|
1977
1897
|
async readlinkPromise(p) {
|
|
1978
1898
|
return await new Promise((resolve8, reject) => {
|
|
1979
1899
|
this.realFs.readlink(path_1.npath.fromPortablePath(p), this.makeCallback(resolve8, reject));
|
|
1980
|
-
}).then((
|
|
1981
|
-
return path_1.npath.toPortablePath(
|
|
1900
|
+
}).then((path) => {
|
|
1901
|
+
return path_1.npath.toPortablePath(path);
|
|
1982
1902
|
});
|
|
1983
1903
|
}
|
|
1984
1904
|
readlinkSync(p) {
|
|
@@ -2064,18 +1984,18 @@ var require_CustomStatWatcher = __commonJS({
|
|
|
2064
1984
|
static {
|
|
2065
1985
|
__name(this, "CustomStatWatcher");
|
|
2066
1986
|
}
|
|
2067
|
-
static create(fakeFs,
|
|
2068
|
-
const statWatcher = new _CustomStatWatcher(fakeFs,
|
|
1987
|
+
static create(fakeFs, path, opts) {
|
|
1988
|
+
const statWatcher = new _CustomStatWatcher(fakeFs, path, opts);
|
|
2069
1989
|
statWatcher.start();
|
|
2070
1990
|
return statWatcher;
|
|
2071
1991
|
}
|
|
2072
|
-
constructor(fakeFs,
|
|
1992
|
+
constructor(fakeFs, path, { bigint = false } = {}) {
|
|
2073
1993
|
super();
|
|
2074
1994
|
this.status = Status.Ready;
|
|
2075
1995
|
this.changeListeners = /* @__PURE__ */ new Map();
|
|
2076
1996
|
this.startTimeout = null;
|
|
2077
1997
|
this.fakeFs = fakeFs;
|
|
2078
|
-
this.path =
|
|
1998
|
+
this.path = path;
|
|
2079
1999
|
this.bigint = bigint;
|
|
2080
2000
|
this.lastStats = this.stat();
|
|
2081
2001
|
}
|
|
@@ -2179,7 +2099,7 @@ var require_watchFile = __commonJS({
|
|
|
2179
2099
|
exports.unwatchAllFiles = exports.unwatchFile = exports.watchFile = void 0;
|
|
2180
2100
|
var CustomStatWatcher_1 = require_CustomStatWatcher();
|
|
2181
2101
|
var statWatchersByFakeFS = /* @__PURE__ */ new WeakMap();
|
|
2182
|
-
function watchFile(fakeFs,
|
|
2102
|
+
function watchFile(fakeFs, path, a, b) {
|
|
2183
2103
|
let bigint;
|
|
2184
2104
|
let persistent;
|
|
2185
2105
|
let interval;
|
|
@@ -2207,21 +2127,21 @@ var require_watchFile = __commonJS({
|
|
|
2207
2127
|
let statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2208
2128
|
if (typeof statWatchers === `undefined`)
|
|
2209
2129
|
statWatchersByFakeFS.set(fakeFs, statWatchers = /* @__PURE__ */ new Map());
|
|
2210
|
-
let statWatcher = statWatchers.get(
|
|
2130
|
+
let statWatcher = statWatchers.get(path);
|
|
2211
2131
|
if (typeof statWatcher === `undefined`) {
|
|
2212
|
-
statWatcher = CustomStatWatcher_1.CustomStatWatcher.create(fakeFs,
|
|
2213
|
-
statWatchers.set(
|
|
2132
|
+
statWatcher = CustomStatWatcher_1.CustomStatWatcher.create(fakeFs, path, { bigint });
|
|
2133
|
+
statWatchers.set(path, statWatcher);
|
|
2214
2134
|
}
|
|
2215
2135
|
statWatcher.registerChangeListener(listener, { persistent, interval });
|
|
2216
2136
|
return statWatcher;
|
|
2217
2137
|
}
|
|
2218
2138
|
__name(watchFile, "watchFile");
|
|
2219
2139
|
exports.watchFile = watchFile;
|
|
2220
|
-
function unwatchFile(fakeFs,
|
|
2140
|
+
function unwatchFile(fakeFs, path, cb) {
|
|
2221
2141
|
const statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2222
2142
|
if (typeof statWatchers === `undefined`)
|
|
2223
2143
|
return;
|
|
2224
|
-
const statWatcher = statWatchers.get(
|
|
2144
|
+
const statWatcher = statWatchers.get(path);
|
|
2225
2145
|
if (typeof statWatcher === `undefined`)
|
|
2226
2146
|
return;
|
|
2227
2147
|
if (typeof cb === `undefined`)
|
|
@@ -2230,7 +2150,7 @@ var require_watchFile = __commonJS({
|
|
|
2230
2150
|
statWatcher.unregisterChangeListener(cb);
|
|
2231
2151
|
if (!statWatcher.hasChangeListeners()) {
|
|
2232
2152
|
statWatcher.stop();
|
|
2233
|
-
statWatchers.delete(
|
|
2153
|
+
statWatchers.delete(path);
|
|
2234
2154
|
}
|
|
2235
2155
|
}
|
|
2236
2156
|
__name(unwatchFile, "unwatchFile");
|
|
@@ -2239,8 +2159,8 @@ var require_watchFile = __commonJS({
|
|
|
2239
2159
|
const statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2240
2160
|
if (typeof statWatchers === `undefined`)
|
|
2241
2161
|
return;
|
|
2242
|
-
for (const
|
|
2243
|
-
unwatchFile(fakeFs,
|
|
2162
|
+
for (const path of statWatchers.keys()) {
|
|
2163
|
+
unwatchFile(fakeFs, path);
|
|
2244
2164
|
}
|
|
2245
2165
|
}
|
|
2246
2166
|
__name(unwatchAllFiles, "unwatchAllFiles");
|
|
@@ -3080,10 +3000,10 @@ var require_ZipFS = __commonJS({
|
|
|
3080
3000
|
}
|
|
3081
3001
|
fdToPath(fd, reason) {
|
|
3082
3002
|
var _a;
|
|
3083
|
-
const
|
|
3084
|
-
if (typeof
|
|
3003
|
+
const path = (_a = this.fds.get(fd)) === null || _a === void 0 ? void 0 : _a.p;
|
|
3004
|
+
if (typeof path === `undefined`)
|
|
3085
3005
|
throw errors.EBADF(reason);
|
|
3086
|
-
return
|
|
3006
|
+
return path;
|
|
3087
3007
|
}
|
|
3088
3008
|
async writeFilePromise(p, content, opts) {
|
|
3089
3009
|
const { encoding, mode, index, resolvedP } = this.prepareWriteFile(p, opts);
|
|
@@ -3398,8 +3318,8 @@ var require_ProxiedFS = __commonJS({
|
|
|
3398
3318
|
getExtractHint(hints) {
|
|
3399
3319
|
return this.baseFs.getExtractHint(hints);
|
|
3400
3320
|
}
|
|
3401
|
-
resolve(
|
|
3402
|
-
return this.mapFromBase(this.baseFs.resolve(this.mapToBase(
|
|
3321
|
+
resolve(path) {
|
|
3322
|
+
return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));
|
|
3403
3323
|
}
|
|
3404
3324
|
getRealPath() {
|
|
3405
3325
|
return this.mapFromBase(this.baseFs.getRealPath());
|
|
@@ -3708,14 +3628,14 @@ var require_CwdFS = __commonJS({
|
|
|
3708
3628
|
return this.baseFs.resolve(path_1.ppath.join(this.target, p));
|
|
3709
3629
|
}
|
|
3710
3630
|
}
|
|
3711
|
-
mapFromBase(
|
|
3712
|
-
return
|
|
3631
|
+
mapFromBase(path) {
|
|
3632
|
+
return path;
|
|
3713
3633
|
}
|
|
3714
|
-
mapToBase(
|
|
3715
|
-
if (this.pathUtils.isAbsolute(
|
|
3716
|
-
return
|
|
3634
|
+
mapToBase(path) {
|
|
3635
|
+
if (this.pathUtils.isAbsolute(path)) {
|
|
3636
|
+
return path;
|
|
3717
3637
|
} else {
|
|
3718
|
-
return this.pathUtils.join(this.target,
|
|
3638
|
+
return this.pathUtils.join(this.target, path);
|
|
3719
3639
|
}
|
|
3720
3640
|
}
|
|
3721
3641
|
};
|
|
@@ -4044,11 +3964,11 @@ var require_PosixFS = __commonJS({
|
|
|
4044
3964
|
super(path_1.npath);
|
|
4045
3965
|
this.baseFs = baseFs;
|
|
4046
3966
|
}
|
|
4047
|
-
mapFromBase(
|
|
4048
|
-
return path_1.npath.fromPortablePath(
|
|
3967
|
+
mapFromBase(path) {
|
|
3968
|
+
return path_1.npath.fromPortablePath(path);
|
|
4049
3969
|
}
|
|
4050
|
-
mapToBase(
|
|
4051
|
-
return path_1.npath.toPortablePath(
|
|
3970
|
+
mapToBase(path) {
|
|
3971
|
+
return path_1.npath.toPortablePath(path);
|
|
4052
3972
|
}
|
|
4053
3973
|
};
|
|
4054
3974
|
exports.PosixFS = PosixFS2;
|
|
@@ -4161,22 +4081,22 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4161
4081
|
var path_1 = require_path();
|
|
4162
4082
|
var ZIP_MASK = 4278190080;
|
|
4163
4083
|
var ZIP_MAGIC = 704643072;
|
|
4164
|
-
var getArchivePart = /* @__PURE__ */ __name((
|
|
4165
|
-
let idx =
|
|
4084
|
+
var getArchivePart = /* @__PURE__ */ __name((path, extension) => {
|
|
4085
|
+
let idx = path.indexOf(extension);
|
|
4166
4086
|
if (idx <= 0)
|
|
4167
4087
|
return null;
|
|
4168
4088
|
let nextCharIdx = idx;
|
|
4169
4089
|
while (idx >= 0) {
|
|
4170
4090
|
nextCharIdx = idx + extension.length;
|
|
4171
|
-
if (
|
|
4091
|
+
if (path[nextCharIdx] === path_1.ppath.sep)
|
|
4172
4092
|
break;
|
|
4173
|
-
if (
|
|
4093
|
+
if (path[idx - 1] === path_1.ppath.sep)
|
|
4174
4094
|
return null;
|
|
4175
|
-
idx =
|
|
4095
|
+
idx = path.indexOf(extension, nextCharIdx);
|
|
4176
4096
|
}
|
|
4177
|
-
if (
|
|
4097
|
+
if (path.length > nextCharIdx && path[nextCharIdx] !== path_1.ppath.sep)
|
|
4178
4098
|
return null;
|
|
4179
|
-
return
|
|
4099
|
+
return path.slice(0, nextCharIdx);
|
|
4180
4100
|
}, "getArchivePart");
|
|
4181
4101
|
exports.getArchivePart = getArchivePart;
|
|
4182
4102
|
var ZipOpenFS2 = class _ZipOpenFS extends FakeFS_1.BasePortableFakeFS {
|
|
@@ -4222,18 +4142,18 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4222
4142
|
saveAndClose() {
|
|
4223
4143
|
(0, watchFile_1.unwatchAllFiles)(this);
|
|
4224
4144
|
if (this.zipInstances) {
|
|
4225
|
-
for (const [
|
|
4145
|
+
for (const [path, { zipFs }] of this.zipInstances.entries()) {
|
|
4226
4146
|
zipFs.saveAndClose();
|
|
4227
|
-
this.zipInstances.delete(
|
|
4147
|
+
this.zipInstances.delete(path);
|
|
4228
4148
|
}
|
|
4229
4149
|
}
|
|
4230
4150
|
}
|
|
4231
4151
|
discardAndClose() {
|
|
4232
4152
|
(0, watchFile_1.unwatchAllFiles)(this);
|
|
4233
4153
|
if (this.zipInstances) {
|
|
4234
|
-
for (const [
|
|
4154
|
+
for (const [path, { zipFs }] of this.zipInstances.entries()) {
|
|
4235
4155
|
zipFs.discardAndClose();
|
|
4236
|
-
this.zipInstances.delete(
|
|
4156
|
+
this.zipInstances.delete(path);
|
|
4237
4157
|
}
|
|
4238
4158
|
}
|
|
4239
4159
|
}
|
|
@@ -4938,12 +4858,12 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4938
4858
|
const now = Date.now();
|
|
4939
4859
|
let nextExpiresAt = now + this.maxAge;
|
|
4940
4860
|
let closeCount = max === null ? 0 : this.zipInstances.size - max;
|
|
4941
|
-
for (const [
|
|
4861
|
+
for (const [path, { zipFs, expiresAt, refCount }] of this.zipInstances.entries()) {
|
|
4942
4862
|
if (refCount !== 0 || zipFs.hasOpenFileHandles()) {
|
|
4943
4863
|
continue;
|
|
4944
4864
|
} else if (now >= expiresAt) {
|
|
4945
4865
|
zipFs.saveAndClose();
|
|
4946
|
-
this.zipInstances.delete(
|
|
4866
|
+
this.zipInstances.delete(path);
|
|
4947
4867
|
closeCount -= 1;
|
|
4948
4868
|
continue;
|
|
4949
4869
|
} else if (max === null || closeCount <= 0) {
|
|
@@ -4951,7 +4871,7 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4951
4871
|
break;
|
|
4952
4872
|
}
|
|
4953
4873
|
zipFs.saveAndClose();
|
|
4954
|
-
this.zipInstances.delete(
|
|
4874
|
+
this.zipInstances.delete(path);
|
|
4955
4875
|
closeCount -= 1;
|
|
4956
4876
|
}
|
|
4957
4877
|
if (this.limitOpenFilesTimeout === null && (max === null && this.zipInstances.size > 0 || max !== null)) {
|
|
@@ -5053,21 +4973,21 @@ var require_NodePathFS = __commonJS({
|
|
|
5053
4973
|
super(path_1.npath);
|
|
5054
4974
|
this.baseFs = baseFs;
|
|
5055
4975
|
}
|
|
5056
|
-
mapFromBase(
|
|
5057
|
-
return
|
|
5058
|
-
}
|
|
5059
|
-
mapToBase(
|
|
5060
|
-
if (typeof
|
|
5061
|
-
return
|
|
5062
|
-
if (
|
|
5063
|
-
return (0, url_1.fileURLToPath)(
|
|
5064
|
-
if (Buffer.isBuffer(
|
|
5065
|
-
const str =
|
|
5066
|
-
if (Buffer.byteLength(str) !==
|
|
4976
|
+
mapFromBase(path) {
|
|
4977
|
+
return path;
|
|
4978
|
+
}
|
|
4979
|
+
mapToBase(path) {
|
|
4980
|
+
if (typeof path === `string`)
|
|
4981
|
+
return path;
|
|
4982
|
+
if (path instanceof url_1.URL)
|
|
4983
|
+
return (0, url_1.fileURLToPath)(path);
|
|
4984
|
+
if (Buffer.isBuffer(path)) {
|
|
4985
|
+
const str = path.toString();
|
|
4986
|
+
if (Buffer.byteLength(str) !== path.byteLength)
|
|
5067
4987
|
throw new Error(`Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942`);
|
|
5068
4988
|
return str;
|
|
5069
4989
|
}
|
|
5070
|
-
throw new Error(`Unsupported path type: ${(0, util_1.inspect)(
|
|
4990
|
+
throw new Error(`Unsupported path type: ${(0, util_1.inspect)(path)}`);
|
|
5071
4991
|
}
|
|
5072
4992
|
};
|
|
5073
4993
|
exports.NodePathFS = NodePathFS;
|
|
@@ -5690,8 +5610,8 @@ var require_lib = __commonJS({
|
|
|
5690
5610
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5691
5611
|
exports.xfs = exports.extendFs = exports.patchFs = exports.ZipOpenFS = exports.ZipFS = exports.VirtualFS = exports.ProxiedFS = exports.PosixFS = exports.NodeFS = exports.NoFS = exports.LazyFS = exports.JailFS = exports.CwdFS = exports.FakeFS = exports.AliasFS = exports.toFilename = exports.ppath = exports.npath = exports.Filename = exports.PortablePath = exports.DEFAULT_COMPRESSION_LEVEL = exports.normalizeLineEndings = exports.statUtils = exports.CustomDir = exports.opendir = exports.LinkStrategy = exports.constants = void 0;
|
|
5692
5612
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
5693
|
-
var
|
|
5694
|
-
exports.constants =
|
|
5613
|
+
var constants2 = tslib_1.__importStar(require_constants());
|
|
5614
|
+
exports.constants = constants2;
|
|
5695
5615
|
var statUtils = tslib_1.__importStar(require_statUtils());
|
|
5696
5616
|
exports.statUtils = statUtils;
|
|
5697
5617
|
var copyPromise_1 = require_copyPromise();
|
|
@@ -6187,11 +6107,11 @@ var require_libzipSync = __commonJS({
|
|
|
6187
6107
|
var ENVIRONMENT_IS_WORKER = false;
|
|
6188
6108
|
var ENVIRONMENT_IS_NODE = true;
|
|
6189
6109
|
var scriptDirectory = "";
|
|
6190
|
-
function locateFile(
|
|
6110
|
+
function locateFile(path) {
|
|
6191
6111
|
if (Module["locateFile"]) {
|
|
6192
|
-
return Module["locateFile"](
|
|
6112
|
+
return Module["locateFile"](path, scriptDirectory);
|
|
6193
6113
|
}
|
|
6194
|
-
return scriptDirectory +
|
|
6114
|
+
return scriptDirectory + path;
|
|
6195
6115
|
}
|
|
6196
6116
|
__name(locateFile, "locateFile");
|
|
6197
6117
|
var read_, readBinary;
|
|
@@ -6705,44 +6625,44 @@ var require_libzipSync = __commonJS({
|
|
|
6705
6625
|
return splitPathRe.exec(filename).slice(1);
|
|
6706
6626
|
}, "splitPath"),
|
|
6707
6627
|
normalizeArray: /* @__PURE__ */ __name(function(parts, allowAboveRoot) {
|
|
6708
|
-
var
|
|
6628
|
+
var up3 = 0;
|
|
6709
6629
|
for (var i = parts.length - 1; i >= 0; i--) {
|
|
6710
6630
|
var last = parts[i];
|
|
6711
6631
|
if (last === ".") {
|
|
6712
6632
|
parts.splice(i, 1);
|
|
6713
6633
|
} else if (last === "..") {
|
|
6714
6634
|
parts.splice(i, 1);
|
|
6715
|
-
|
|
6716
|
-
} else if (
|
|
6635
|
+
up3++;
|
|
6636
|
+
} else if (up3) {
|
|
6717
6637
|
parts.splice(i, 1);
|
|
6718
|
-
|
|
6638
|
+
up3--;
|
|
6719
6639
|
}
|
|
6720
6640
|
}
|
|
6721
6641
|
if (allowAboveRoot) {
|
|
6722
|
-
for (;
|
|
6642
|
+
for (; up3; up3--) {
|
|
6723
6643
|
parts.unshift("..");
|
|
6724
6644
|
}
|
|
6725
6645
|
}
|
|
6726
6646
|
return parts;
|
|
6727
6647
|
}, "normalizeArray"),
|
|
6728
|
-
normalize: /* @__PURE__ */ __name(function(
|
|
6729
|
-
var isAbsolute2 =
|
|
6730
|
-
|
|
6731
|
-
|
|
6648
|
+
normalize: /* @__PURE__ */ __name(function(path) {
|
|
6649
|
+
var isAbsolute2 = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/";
|
|
6650
|
+
path = PATH.normalizeArray(
|
|
6651
|
+
path.split("/").filter(function(p) {
|
|
6732
6652
|
return !!p;
|
|
6733
6653
|
}),
|
|
6734
6654
|
!isAbsolute2
|
|
6735
6655
|
).join("/");
|
|
6736
|
-
if (!
|
|
6737
|
-
|
|
6656
|
+
if (!path && !isAbsolute2) {
|
|
6657
|
+
path = ".";
|
|
6738
6658
|
}
|
|
6739
|
-
if (
|
|
6740
|
-
|
|
6659
|
+
if (path && trailingSlash) {
|
|
6660
|
+
path += "/";
|
|
6741
6661
|
}
|
|
6742
|
-
return (isAbsolute2 ? "/" : "") +
|
|
6662
|
+
return (isAbsolute2 ? "/" : "") + path;
|
|
6743
6663
|
}, "normalize"),
|
|
6744
|
-
dirname: /* @__PURE__ */ __name(function(
|
|
6745
|
-
var result = PATH.splitPath(
|
|
6664
|
+
dirname: /* @__PURE__ */ __name(function(path) {
|
|
6665
|
+
var result = PATH.splitPath(path), root = result[0], dir = result[1];
|
|
6746
6666
|
if (!root && !dir) {
|
|
6747
6667
|
return ".";
|
|
6748
6668
|
}
|
|
@@ -6751,16 +6671,16 @@ var require_libzipSync = __commonJS({
|
|
|
6751
6671
|
}
|
|
6752
6672
|
return root + dir;
|
|
6753
6673
|
}, "dirname"),
|
|
6754
|
-
basename: /* @__PURE__ */ __name(function(
|
|
6755
|
-
if (
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
var lastSlash =
|
|
6759
|
-
if (lastSlash === -1) return
|
|
6760
|
-
return
|
|
6674
|
+
basename: /* @__PURE__ */ __name(function(path) {
|
|
6675
|
+
if (path === "/") return "/";
|
|
6676
|
+
path = PATH.normalize(path);
|
|
6677
|
+
path = path.replace(/\/$/, "");
|
|
6678
|
+
var lastSlash = path.lastIndexOf("/");
|
|
6679
|
+
if (lastSlash === -1) return path;
|
|
6680
|
+
return path.substr(lastSlash + 1);
|
|
6761
6681
|
}, "basename"),
|
|
6762
|
-
extname: /* @__PURE__ */ __name(function(
|
|
6763
|
-
return PATH.splitPath(
|
|
6682
|
+
extname: /* @__PURE__ */ __name(function(path) {
|
|
6683
|
+
return PATH.splitPath(path)[3];
|
|
6764
6684
|
}, "extname"),
|
|
6765
6685
|
join: /* @__PURE__ */ __name(function() {
|
|
6766
6686
|
var paths = Array.prototype.slice.call(arguments, 0);
|
|
@@ -6795,14 +6715,14 @@ var require_libzipSync = __commonJS({
|
|
|
6795
6715
|
resolve: /* @__PURE__ */ __name(function() {
|
|
6796
6716
|
var resolvedPath = "", resolvedAbsolute = false;
|
|
6797
6717
|
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
6798
|
-
var
|
|
6799
|
-
if (typeof
|
|
6718
|
+
var path = i >= 0 ? arguments[i] : FS.cwd();
|
|
6719
|
+
if (typeof path !== "string") {
|
|
6800
6720
|
throw new TypeError("Arguments to path.resolve must be strings");
|
|
6801
|
-
} else if (!
|
|
6721
|
+
} else if (!path) {
|
|
6802
6722
|
return "";
|
|
6803
6723
|
}
|
|
6804
|
-
resolvedPath =
|
|
6805
|
-
resolvedAbsolute =
|
|
6724
|
+
resolvedPath = path + "/" + resolvedPath;
|
|
6725
|
+
resolvedAbsolute = path.charAt(0) === "/";
|
|
6806
6726
|
}
|
|
6807
6727
|
resolvedPath = PATH.normalizeArray(
|
|
6808
6728
|
resolvedPath.split("/").filter(function(p) {
|
|
@@ -6812,8 +6732,8 @@ var require_libzipSync = __commonJS({
|
|
|
6812
6732
|
).join("/");
|
|
6813
6733
|
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
|
|
6814
6734
|
}, "resolve"),
|
|
6815
|
-
relative: /* @__PURE__ */ __name(function(
|
|
6816
|
-
|
|
6735
|
+
relative: /* @__PURE__ */ __name(function(from2, to) {
|
|
6736
|
+
from2 = PATH_FS.resolve(from2).substr(1);
|
|
6817
6737
|
to = PATH_FS.resolve(to).substr(1);
|
|
6818
6738
|
function trim(arr) {
|
|
6819
6739
|
var start = 0;
|
|
@@ -6828,7 +6748,7 @@ var require_libzipSync = __commonJS({
|
|
|
6828
6748
|
return arr.slice(start, end - start + 1);
|
|
6829
6749
|
}
|
|
6830
6750
|
__name(trim, "trim");
|
|
6831
|
-
var fromParts = trim(
|
|
6751
|
+
var fromParts = trim(from2.split("/"));
|
|
6832
6752
|
var toParts = trim(to.split("/"));
|
|
6833
6753
|
var length = Math.min(fromParts.length, toParts.length);
|
|
6834
6754
|
var samePartsLength = length;
|
|
@@ -7459,7 +7379,7 @@ var require_libzipSync = __commonJS({
|
|
|
7459
7379
|
isWindows: false,
|
|
7460
7380
|
staticInit: /* @__PURE__ */ __name(function() {
|
|
7461
7381
|
NODEFS.isWindows = !!process.platform.match(/^win/);
|
|
7462
|
-
var flags = { fs:
|
|
7382
|
+
var flags = { fs: fs.constants };
|
|
7463
7383
|
if (flags["fs"]) {
|
|
7464
7384
|
flags = flags["fs"];
|
|
7465
7385
|
}
|
|
@@ -7494,10 +7414,10 @@ var require_libzipSync = __commonJS({
|
|
|
7494
7414
|
node.stream_ops = NODEFS.stream_ops;
|
|
7495
7415
|
return node;
|
|
7496
7416
|
}, "createNode"),
|
|
7497
|
-
getMode: /* @__PURE__ */ __name(function(
|
|
7417
|
+
getMode: /* @__PURE__ */ __name(function(path) {
|
|
7498
7418
|
var stat;
|
|
7499
7419
|
try {
|
|
7500
|
-
stat =
|
|
7420
|
+
stat = fs.lstatSync(path);
|
|
7501
7421
|
if (NODEFS.isWindows) {
|
|
7502
7422
|
stat.mode = stat.mode | (stat.mode & 292) >> 2;
|
|
7503
7423
|
}
|
|
@@ -7537,10 +7457,10 @@ var require_libzipSync = __commonJS({
|
|
|
7537
7457
|
}, "flagsForNode"),
|
|
7538
7458
|
node_ops: {
|
|
7539
7459
|
getattr: /* @__PURE__ */ __name(function(node) {
|
|
7540
|
-
var
|
|
7460
|
+
var path = NODEFS.realPath(node);
|
|
7541
7461
|
var stat;
|
|
7542
7462
|
try {
|
|
7543
|
-
stat =
|
|
7463
|
+
stat = fs.lstatSync(path);
|
|
7544
7464
|
} catch (e) {
|
|
7545
7465
|
if (!e.code) throw e;
|
|
7546
7466
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7568,18 +7488,18 @@ var require_libzipSync = __commonJS({
|
|
|
7568
7488
|
};
|
|
7569
7489
|
}, "getattr"),
|
|
7570
7490
|
setattr: /* @__PURE__ */ __name(function(node, attr) {
|
|
7571
|
-
var
|
|
7491
|
+
var path = NODEFS.realPath(node);
|
|
7572
7492
|
try {
|
|
7573
7493
|
if (attr.mode !== void 0) {
|
|
7574
|
-
|
|
7494
|
+
fs.chmodSync(path, attr.mode);
|
|
7575
7495
|
node.mode = attr.mode;
|
|
7576
7496
|
}
|
|
7577
7497
|
if (attr.timestamp !== void 0) {
|
|
7578
7498
|
var date = new Date(attr.timestamp);
|
|
7579
|
-
|
|
7499
|
+
fs.utimesSync(path, date, date);
|
|
7580
7500
|
}
|
|
7581
7501
|
if (attr.size !== void 0) {
|
|
7582
|
-
|
|
7502
|
+
fs.truncateSync(path, attr.size);
|
|
7583
7503
|
}
|
|
7584
7504
|
} catch (e) {
|
|
7585
7505
|
if (!e.code) throw e;
|
|
@@ -7587,18 +7507,18 @@ var require_libzipSync = __commonJS({
|
|
|
7587
7507
|
}
|
|
7588
7508
|
}, "setattr"),
|
|
7589
7509
|
lookup: /* @__PURE__ */ __name(function(parent, name) {
|
|
7590
|
-
var
|
|
7591
|
-
var mode = NODEFS.getMode(
|
|
7510
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7511
|
+
var mode = NODEFS.getMode(path);
|
|
7592
7512
|
return NODEFS.createNode(parent, name, mode);
|
|
7593
7513
|
}, "lookup"),
|
|
7594
7514
|
mknod: /* @__PURE__ */ __name(function(parent, name, mode, dev) {
|
|
7595
7515
|
var node = NODEFS.createNode(parent, name, mode, dev);
|
|
7596
|
-
var
|
|
7516
|
+
var path = NODEFS.realPath(node);
|
|
7597
7517
|
try {
|
|
7598
7518
|
if (FS.isDir(node.mode)) {
|
|
7599
|
-
|
|
7519
|
+
fs.mkdirSync(path, node.mode);
|
|
7600
7520
|
} else {
|
|
7601
|
-
|
|
7521
|
+
fs.writeFileSync(path, "", { mode: node.mode });
|
|
7602
7522
|
}
|
|
7603
7523
|
} catch (e) {
|
|
7604
7524
|
if (!e.code) throw e;
|
|
@@ -7610,7 +7530,7 @@ var require_libzipSync = __commonJS({
|
|
|
7610
7530
|
var oldPath = NODEFS.realPath(oldNode);
|
|
7611
7531
|
var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
|
|
7612
7532
|
try {
|
|
7613
|
-
|
|
7533
|
+
fs.renameSync(oldPath, newPath);
|
|
7614
7534
|
} catch (e) {
|
|
7615
7535
|
if (!e.code) throw e;
|
|
7616
7536
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7618,27 +7538,27 @@ var require_libzipSync = __commonJS({
|
|
|
7618
7538
|
oldNode.name = newName;
|
|
7619
7539
|
}, "rename"),
|
|
7620
7540
|
unlink: /* @__PURE__ */ __name(function(parent, name) {
|
|
7621
|
-
var
|
|
7541
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7622
7542
|
try {
|
|
7623
|
-
|
|
7543
|
+
fs.unlinkSync(path);
|
|
7624
7544
|
} catch (e) {
|
|
7625
7545
|
if (!e.code) throw e;
|
|
7626
7546
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7627
7547
|
}
|
|
7628
7548
|
}, "unlink"),
|
|
7629
7549
|
rmdir: /* @__PURE__ */ __name(function(parent, name) {
|
|
7630
|
-
var
|
|
7550
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7631
7551
|
try {
|
|
7632
|
-
|
|
7552
|
+
fs.rmdirSync(path);
|
|
7633
7553
|
} catch (e) {
|
|
7634
7554
|
if (!e.code) throw e;
|
|
7635
7555
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7636
7556
|
}
|
|
7637
7557
|
}, "rmdir"),
|
|
7638
7558
|
readdir: /* @__PURE__ */ __name(function(node) {
|
|
7639
|
-
var
|
|
7559
|
+
var path = NODEFS.realPath(node);
|
|
7640
7560
|
try {
|
|
7641
|
-
return
|
|
7561
|
+
return fs.readdirSync(path);
|
|
7642
7562
|
} catch (e) {
|
|
7643
7563
|
if (!e.code) throw e;
|
|
7644
7564
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7647,21 +7567,21 @@ var require_libzipSync = __commonJS({
|
|
|
7647
7567
|
symlink: /* @__PURE__ */ __name(function(parent, newName, oldPath) {
|
|
7648
7568
|
var newPath = PATH.join2(NODEFS.realPath(parent), newName);
|
|
7649
7569
|
try {
|
|
7650
|
-
|
|
7570
|
+
fs.symlinkSync(oldPath, newPath);
|
|
7651
7571
|
} catch (e) {
|
|
7652
7572
|
if (!e.code) throw e;
|
|
7653
7573
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7654
7574
|
}
|
|
7655
7575
|
}, "symlink"),
|
|
7656
7576
|
readlink: /* @__PURE__ */ __name(function(node) {
|
|
7657
|
-
var
|
|
7577
|
+
var path = NODEFS.realPath(node);
|
|
7658
7578
|
try {
|
|
7659
|
-
|
|
7660
|
-
|
|
7579
|
+
path = fs.readlinkSync(path);
|
|
7580
|
+
path = NODEJS_PATH.relative(
|
|
7661
7581
|
NODEJS_PATH.resolve(node.mount.opts.root),
|
|
7662
|
-
|
|
7582
|
+
path
|
|
7663
7583
|
);
|
|
7664
|
-
return
|
|
7584
|
+
return path;
|
|
7665
7585
|
} catch (e) {
|
|
7666
7586
|
if (!e.code) throw e;
|
|
7667
7587
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7670,10 +7590,10 @@ var require_libzipSync = __commonJS({
|
|
|
7670
7590
|
},
|
|
7671
7591
|
stream_ops: {
|
|
7672
7592
|
open: /* @__PURE__ */ __name(function(stream) {
|
|
7673
|
-
var
|
|
7593
|
+
var path = NODEFS.realPath(stream.node);
|
|
7674
7594
|
try {
|
|
7675
7595
|
if (FS.isFile(stream.node.mode)) {
|
|
7676
|
-
stream.nfd =
|
|
7596
|
+
stream.nfd = fs.openSync(path, NODEFS.flagsForNode(stream.flags));
|
|
7677
7597
|
}
|
|
7678
7598
|
} catch (e) {
|
|
7679
7599
|
if (!e.code) throw e;
|
|
@@ -7683,7 +7603,7 @@ var require_libzipSync = __commonJS({
|
|
|
7683
7603
|
close: /* @__PURE__ */ __name(function(stream) {
|
|
7684
7604
|
try {
|
|
7685
7605
|
if (FS.isFile(stream.node.mode) && stream.nfd) {
|
|
7686
|
-
|
|
7606
|
+
fs.closeSync(stream.nfd);
|
|
7687
7607
|
}
|
|
7688
7608
|
} catch (e) {
|
|
7689
7609
|
if (!e.code) throw e;
|
|
@@ -7693,7 +7613,7 @@ var require_libzipSync = __commonJS({
|
|
|
7693
7613
|
read: /* @__PURE__ */ __name(function(stream, buffer2, offset, length, position) {
|
|
7694
7614
|
if (length === 0) return 0;
|
|
7695
7615
|
try {
|
|
7696
|
-
return
|
|
7616
|
+
return fs.readSync(
|
|
7697
7617
|
stream.nfd,
|
|
7698
7618
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7699
7619
|
offset,
|
|
@@ -7706,7 +7626,7 @@ var require_libzipSync = __commonJS({
|
|
|
7706
7626
|
}, "read"),
|
|
7707
7627
|
write: /* @__PURE__ */ __name(function(stream, buffer2, offset, length, position) {
|
|
7708
7628
|
try {
|
|
7709
|
-
return
|
|
7629
|
+
return fs.writeSync(
|
|
7710
7630
|
stream.nfd,
|
|
7711
7631
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7712
7632
|
offset,
|
|
@@ -7724,7 +7644,7 @@ var require_libzipSync = __commonJS({
|
|
|
7724
7644
|
} else if (whence === 2) {
|
|
7725
7645
|
if (FS.isFile(stream.node.mode)) {
|
|
7726
7646
|
try {
|
|
7727
|
-
var stat =
|
|
7647
|
+
var stat = fs.fstatSync(stream.nfd);
|
|
7728
7648
|
position += stat.size;
|
|
7729
7649
|
} catch (e) {
|
|
7730
7650
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7767,8 +7687,8 @@ var require_libzipSync = __commonJS({
|
|
|
7767
7687
|
}
|
|
7768
7688
|
};
|
|
7769
7689
|
var NODERAWFS = {
|
|
7770
|
-
lookupPath: /* @__PURE__ */ __name(function(
|
|
7771
|
-
return { path
|
|
7690
|
+
lookupPath: /* @__PURE__ */ __name(function(path) {
|
|
7691
|
+
return { path, node: { mode: NODEFS.getMode(path) } };
|
|
7772
7692
|
}, "lookupPath"),
|
|
7773
7693
|
createStandardStreams: /* @__PURE__ */ __name(function() {
|
|
7774
7694
|
FS.streams[0] = {
|
|
@@ -7798,75 +7718,75 @@ var require_libzipSync = __commonJS({
|
|
|
7798
7718
|
chdir: /* @__PURE__ */ __name(function() {
|
|
7799
7719
|
process.chdir.apply(void 0, arguments);
|
|
7800
7720
|
}, "chdir"),
|
|
7801
|
-
mknod: /* @__PURE__ */ __name(function(
|
|
7802
|
-
if (FS.isDir(
|
|
7803
|
-
|
|
7721
|
+
mknod: /* @__PURE__ */ __name(function(path, mode) {
|
|
7722
|
+
if (FS.isDir(path)) {
|
|
7723
|
+
fs.mkdirSync(path, mode);
|
|
7804
7724
|
} else {
|
|
7805
|
-
|
|
7725
|
+
fs.writeFileSync(path, "", { mode });
|
|
7806
7726
|
}
|
|
7807
7727
|
}, "mknod"),
|
|
7808
7728
|
mkdir: /* @__PURE__ */ __name(function() {
|
|
7809
|
-
|
|
7729
|
+
fs.mkdirSync.apply(void 0, arguments);
|
|
7810
7730
|
}, "mkdir"),
|
|
7811
7731
|
symlink: /* @__PURE__ */ __name(function() {
|
|
7812
|
-
|
|
7732
|
+
fs.symlinkSync.apply(void 0, arguments);
|
|
7813
7733
|
}, "symlink"),
|
|
7814
7734
|
rename: /* @__PURE__ */ __name(function() {
|
|
7815
|
-
|
|
7735
|
+
fs.renameSync.apply(void 0, arguments);
|
|
7816
7736
|
}, "rename"),
|
|
7817
7737
|
rmdir: /* @__PURE__ */ __name(function() {
|
|
7818
|
-
|
|
7738
|
+
fs.rmdirSync.apply(void 0, arguments);
|
|
7819
7739
|
}, "rmdir"),
|
|
7820
7740
|
readdir: /* @__PURE__ */ __name(function() {
|
|
7821
|
-
|
|
7741
|
+
fs.readdirSync.apply(void 0, arguments);
|
|
7822
7742
|
}, "readdir"),
|
|
7823
7743
|
unlink: /* @__PURE__ */ __name(function() {
|
|
7824
|
-
|
|
7744
|
+
fs.unlinkSync.apply(void 0, arguments);
|
|
7825
7745
|
}, "unlink"),
|
|
7826
7746
|
readlink: /* @__PURE__ */ __name(function() {
|
|
7827
|
-
return
|
|
7747
|
+
return fs.readlinkSync.apply(void 0, arguments);
|
|
7828
7748
|
}, "readlink"),
|
|
7829
7749
|
stat: /* @__PURE__ */ __name(function() {
|
|
7830
|
-
return
|
|
7750
|
+
return fs.statSync.apply(void 0, arguments);
|
|
7831
7751
|
}, "stat"),
|
|
7832
7752
|
lstat: /* @__PURE__ */ __name(function() {
|
|
7833
|
-
return
|
|
7753
|
+
return fs.lstatSync.apply(void 0, arguments);
|
|
7834
7754
|
}, "lstat"),
|
|
7835
7755
|
chmod: /* @__PURE__ */ __name(function() {
|
|
7836
|
-
|
|
7756
|
+
fs.chmodSync.apply(void 0, arguments);
|
|
7837
7757
|
}, "chmod"),
|
|
7838
7758
|
fchmod: /* @__PURE__ */ __name(function() {
|
|
7839
|
-
|
|
7759
|
+
fs.fchmodSync.apply(void 0, arguments);
|
|
7840
7760
|
}, "fchmod"),
|
|
7841
7761
|
chown: /* @__PURE__ */ __name(function() {
|
|
7842
|
-
|
|
7762
|
+
fs.chownSync.apply(void 0, arguments);
|
|
7843
7763
|
}, "chown"),
|
|
7844
7764
|
fchown: /* @__PURE__ */ __name(function() {
|
|
7845
|
-
|
|
7765
|
+
fs.fchownSync.apply(void 0, arguments);
|
|
7846
7766
|
}, "fchown"),
|
|
7847
7767
|
truncate: /* @__PURE__ */ __name(function() {
|
|
7848
|
-
|
|
7768
|
+
fs.truncateSync.apply(void 0, arguments);
|
|
7849
7769
|
}, "truncate"),
|
|
7850
7770
|
ftruncate: /* @__PURE__ */ __name(function(fd, len) {
|
|
7851
7771
|
if (len < 0) {
|
|
7852
7772
|
throw new FS.ErrnoError(28);
|
|
7853
7773
|
}
|
|
7854
|
-
|
|
7774
|
+
fs.ftruncateSync.apply(void 0, arguments);
|
|
7855
7775
|
}, "ftruncate"),
|
|
7856
7776
|
utime: /* @__PURE__ */ __name(function() {
|
|
7857
|
-
|
|
7777
|
+
fs.utimesSync.apply(void 0, arguments);
|
|
7858
7778
|
}, "utime"),
|
|
7859
|
-
open: /* @__PURE__ */ __name(function(
|
|
7779
|
+
open: /* @__PURE__ */ __name(function(path, flags, mode, suggestFD) {
|
|
7860
7780
|
if (typeof flags === "string") {
|
|
7861
7781
|
flags = VFS.modeStringToFlags(flags);
|
|
7862
7782
|
}
|
|
7863
|
-
var nfd =
|
|
7783
|
+
var nfd = fs.openSync(path, NODEFS.flagsForNode(flags), mode);
|
|
7864
7784
|
var fd = suggestFD != null ? suggestFD : FS.nextfd(nfd);
|
|
7865
7785
|
var stream = {
|
|
7866
7786
|
fd,
|
|
7867
7787
|
nfd,
|
|
7868
7788
|
position: 0,
|
|
7869
|
-
path
|
|
7789
|
+
path,
|
|
7870
7790
|
flags,
|
|
7871
7791
|
seekable: true
|
|
7872
7792
|
};
|
|
@@ -7875,7 +7795,7 @@ var require_libzipSync = __commonJS({
|
|
|
7875
7795
|
}, "open"),
|
|
7876
7796
|
close: /* @__PURE__ */ __name(function(stream) {
|
|
7877
7797
|
if (!stream.stream_ops) {
|
|
7878
|
-
|
|
7798
|
+
fs.closeSync(stream.nfd);
|
|
7879
7799
|
}
|
|
7880
7800
|
FS.closeStream(stream.fd);
|
|
7881
7801
|
}, "close"),
|
|
@@ -7887,7 +7807,7 @@ var require_libzipSync = __commonJS({
|
|
|
7887
7807
|
if (whence === 1) {
|
|
7888
7808
|
position += stream.position;
|
|
7889
7809
|
} else if (whence === 2) {
|
|
7890
|
-
position +=
|
|
7810
|
+
position += fs.fstatSync(stream.nfd).size;
|
|
7891
7811
|
} else if (whence !== 0) {
|
|
7892
7812
|
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
|
|
7893
7813
|
}
|
|
@@ -7903,7 +7823,7 @@ var require_libzipSync = __commonJS({
|
|
|
7903
7823
|
}
|
|
7904
7824
|
var seeking = typeof position !== "undefined";
|
|
7905
7825
|
if (!seeking && stream.seekable) position = stream.position;
|
|
7906
|
-
var bytesRead =
|
|
7826
|
+
var bytesRead = fs.readSync(
|
|
7907
7827
|
stream.nfd,
|
|
7908
7828
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7909
7829
|
offset,
|
|
@@ -7922,7 +7842,7 @@ var require_libzipSync = __commonJS({
|
|
|
7922
7842
|
}
|
|
7923
7843
|
var seeking = typeof position !== "undefined";
|
|
7924
7844
|
if (!seeking && stream.seekable) position = stream.position;
|
|
7925
|
-
var bytesWritten =
|
|
7845
|
+
var bytesWritten = fs.writeSync(
|
|
7926
7846
|
stream.nfd,
|
|
7927
7847
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7928
7848
|
offset,
|
|
@@ -7979,10 +7899,10 @@ var require_libzipSync = __commonJS({
|
|
|
7979
7899
|
genericErrors: {},
|
|
7980
7900
|
filesystems: null,
|
|
7981
7901
|
syncFSRequests: 0,
|
|
7982
|
-
lookupPath: /* @__PURE__ */ __name(function(
|
|
7983
|
-
|
|
7902
|
+
lookupPath: /* @__PURE__ */ __name(function(path, opts) {
|
|
7903
|
+
path = PATH_FS.resolve(FS.cwd(), path);
|
|
7984
7904
|
opts = opts || {};
|
|
7985
|
-
if (!
|
|
7905
|
+
if (!path) return { path: "", node: null };
|
|
7986
7906
|
var defaults = { follow_mount: true, recurse_count: 0 };
|
|
7987
7907
|
for (var key2 in defaults) {
|
|
7988
7908
|
if (opts[key2] === void 0) {
|
|
@@ -7993,7 +7913,7 @@ var require_libzipSync = __commonJS({
|
|
|
7993
7913
|
throw new FS.ErrnoError(32);
|
|
7994
7914
|
}
|
|
7995
7915
|
var parts = PATH.normalizeArray(
|
|
7996
|
-
|
|
7916
|
+
path.split("/").filter(function(p) {
|
|
7997
7917
|
return !!p;
|
|
7998
7918
|
}),
|
|
7999
7919
|
false
|
|
@@ -8030,14 +7950,14 @@ var require_libzipSync = __commonJS({
|
|
|
8030
7950
|
return { path: current_path, node: current };
|
|
8031
7951
|
}, "lookupPath"),
|
|
8032
7952
|
getPath: /* @__PURE__ */ __name(function(node) {
|
|
8033
|
-
var
|
|
7953
|
+
var path;
|
|
8034
7954
|
while (true) {
|
|
8035
7955
|
if (FS.isRoot(node)) {
|
|
8036
7956
|
var mount = node.mount.mountpoint;
|
|
8037
|
-
if (!
|
|
8038
|
-
return mount[mount.length - 1] !== "/" ? mount + "/" +
|
|
7957
|
+
if (!path) return mount;
|
|
7958
|
+
return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
|
|
8039
7959
|
}
|
|
8040
|
-
|
|
7960
|
+
path = path ? node.name + "/" + path : node.name;
|
|
8041
7961
|
node = node.parent;
|
|
8042
7962
|
}
|
|
8043
7963
|
}, "getPath"),
|
|
@@ -8390,10 +8310,10 @@ var require_libzipSync = __commonJS({
|
|
|
8390
8310
|
lookup: /* @__PURE__ */ __name(function(parent, name) {
|
|
8391
8311
|
return parent.node_ops.lookup(parent, name);
|
|
8392
8312
|
}, "lookup"),
|
|
8393
|
-
mknod: /* @__PURE__ */ __name(function(
|
|
8394
|
-
var lookup = FS.lookupPath(
|
|
8313
|
+
mknod: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
8314
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8395
8315
|
var parent = lookup.node;
|
|
8396
|
-
var name = PATH.basename(
|
|
8316
|
+
var name = PATH.basename(path);
|
|
8397
8317
|
if (!name || name === "." || name === "..") {
|
|
8398
8318
|
throw new FS.ErrnoError(28);
|
|
8399
8319
|
}
|
|
@@ -8406,20 +8326,20 @@ var require_libzipSync = __commonJS({
|
|
|
8406
8326
|
}
|
|
8407
8327
|
return parent.node_ops.mknod(parent, name, mode, dev);
|
|
8408
8328
|
}, "mknod"),
|
|
8409
|
-
create: /* @__PURE__ */ __name(function(
|
|
8329
|
+
create: /* @__PURE__ */ __name(function(path, mode) {
|
|
8410
8330
|
mode = mode !== void 0 ? mode : 438;
|
|
8411
8331
|
mode &= 4095;
|
|
8412
8332
|
mode |= 32768;
|
|
8413
|
-
return FS.mknod(
|
|
8333
|
+
return FS.mknod(path, mode, 0);
|
|
8414
8334
|
}, "create"),
|
|
8415
|
-
mkdir: /* @__PURE__ */ __name(function(
|
|
8335
|
+
mkdir: /* @__PURE__ */ __name(function(path, mode) {
|
|
8416
8336
|
mode = mode !== void 0 ? mode : 511;
|
|
8417
8337
|
mode &= 511 | 512;
|
|
8418
8338
|
mode |= 16384;
|
|
8419
|
-
return FS.mknod(
|
|
8339
|
+
return FS.mknod(path, mode, 0);
|
|
8420
8340
|
}, "mkdir"),
|
|
8421
|
-
mkdirTree: /* @__PURE__ */ __name(function(
|
|
8422
|
-
var dirs =
|
|
8341
|
+
mkdirTree: /* @__PURE__ */ __name(function(path, mode) {
|
|
8342
|
+
var dirs = path.split("/");
|
|
8423
8343
|
var d = "";
|
|
8424
8344
|
for (var i = 0; i < dirs.length; ++i) {
|
|
8425
8345
|
if (!dirs[i]) continue;
|
|
@@ -8431,13 +8351,13 @@ var require_libzipSync = __commonJS({
|
|
|
8431
8351
|
}
|
|
8432
8352
|
}
|
|
8433
8353
|
}, "mkdirTree"),
|
|
8434
|
-
mkdev: /* @__PURE__ */ __name(function(
|
|
8354
|
+
mkdev: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
8435
8355
|
if (typeof dev === "undefined") {
|
|
8436
8356
|
dev = mode;
|
|
8437
8357
|
mode = 438;
|
|
8438
8358
|
}
|
|
8439
8359
|
mode |= 8192;
|
|
8440
|
-
return FS.mknod(
|
|
8360
|
+
return FS.mknod(path, mode, dev);
|
|
8441
8361
|
}, "mkdev"),
|
|
8442
8362
|
symlink: /* @__PURE__ */ __name(function(oldpath, newpath) {
|
|
8443
8363
|
if (!PATH_FS.resolve(oldpath)) {
|
|
@@ -8536,10 +8456,10 @@ var require_libzipSync = __commonJS({
|
|
|
8536
8456
|
);
|
|
8537
8457
|
}
|
|
8538
8458
|
}, "rename"),
|
|
8539
|
-
rmdir: /* @__PURE__ */ __name(function(
|
|
8540
|
-
var lookup = FS.lookupPath(
|
|
8459
|
+
rmdir: /* @__PURE__ */ __name(function(path) {
|
|
8460
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8541
8461
|
var parent = lookup.node;
|
|
8542
|
-
var name = PATH.basename(
|
|
8462
|
+
var name = PATH.basename(path);
|
|
8543
8463
|
var node = FS.lookupNode(parent, name);
|
|
8544
8464
|
var errCode = FS.mayDelete(parent, name, true);
|
|
8545
8465
|
if (errCode) {
|
|
@@ -8553,36 +8473,36 @@ var require_libzipSync = __commonJS({
|
|
|
8553
8473
|
}
|
|
8554
8474
|
try {
|
|
8555
8475
|
if (FS.trackingDelegate["willDeletePath"]) {
|
|
8556
|
-
FS.trackingDelegate["willDeletePath"](
|
|
8476
|
+
FS.trackingDelegate["willDeletePath"](path);
|
|
8557
8477
|
}
|
|
8558
8478
|
} catch (e) {
|
|
8559
8479
|
err(
|
|
8560
|
-
"FS.trackingDelegate['willDeletePath']('" +
|
|
8480
|
+
"FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8561
8481
|
);
|
|
8562
8482
|
}
|
|
8563
8483
|
parent.node_ops.rmdir(parent, name);
|
|
8564
8484
|
FS.destroyNode(node);
|
|
8565
8485
|
try {
|
|
8566
8486
|
if (FS.trackingDelegate["onDeletePath"])
|
|
8567
|
-
FS.trackingDelegate["onDeletePath"](
|
|
8487
|
+
FS.trackingDelegate["onDeletePath"](path);
|
|
8568
8488
|
} catch (e) {
|
|
8569
8489
|
err(
|
|
8570
|
-
"FS.trackingDelegate['onDeletePath']('" +
|
|
8490
|
+
"FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8571
8491
|
);
|
|
8572
8492
|
}
|
|
8573
8493
|
}, "rmdir"),
|
|
8574
|
-
readdir: /* @__PURE__ */ __name(function(
|
|
8575
|
-
var lookup = FS.lookupPath(
|
|
8494
|
+
readdir: /* @__PURE__ */ __name(function(path) {
|
|
8495
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8576
8496
|
var node = lookup.node;
|
|
8577
8497
|
if (!node.node_ops.readdir) {
|
|
8578
8498
|
throw new FS.ErrnoError(54);
|
|
8579
8499
|
}
|
|
8580
8500
|
return node.node_ops.readdir(node);
|
|
8581
8501
|
}, "readdir"),
|
|
8582
|
-
unlink: /* @__PURE__ */ __name(function(
|
|
8583
|
-
var lookup = FS.lookupPath(
|
|
8502
|
+
unlink: /* @__PURE__ */ __name(function(path) {
|
|
8503
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8584
8504
|
var parent = lookup.node;
|
|
8585
|
-
var name = PATH.basename(
|
|
8505
|
+
var name = PATH.basename(path);
|
|
8586
8506
|
var node = FS.lookupNode(parent, name);
|
|
8587
8507
|
var errCode = FS.mayDelete(parent, name, false);
|
|
8588
8508
|
if (errCode) {
|
|
@@ -8596,26 +8516,26 @@ var require_libzipSync = __commonJS({
|
|
|
8596
8516
|
}
|
|
8597
8517
|
try {
|
|
8598
8518
|
if (FS.trackingDelegate["willDeletePath"]) {
|
|
8599
|
-
FS.trackingDelegate["willDeletePath"](
|
|
8519
|
+
FS.trackingDelegate["willDeletePath"](path);
|
|
8600
8520
|
}
|
|
8601
8521
|
} catch (e) {
|
|
8602
8522
|
err(
|
|
8603
|
-
"FS.trackingDelegate['willDeletePath']('" +
|
|
8523
|
+
"FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8604
8524
|
);
|
|
8605
8525
|
}
|
|
8606
8526
|
parent.node_ops.unlink(parent, name);
|
|
8607
8527
|
FS.destroyNode(node);
|
|
8608
8528
|
try {
|
|
8609
8529
|
if (FS.trackingDelegate["onDeletePath"])
|
|
8610
|
-
FS.trackingDelegate["onDeletePath"](
|
|
8530
|
+
FS.trackingDelegate["onDeletePath"](path);
|
|
8611
8531
|
} catch (e) {
|
|
8612
8532
|
err(
|
|
8613
|
-
"FS.trackingDelegate['onDeletePath']('" +
|
|
8533
|
+
"FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8614
8534
|
);
|
|
8615
8535
|
}
|
|
8616
8536
|
}, "unlink"),
|
|
8617
|
-
readlink: /* @__PURE__ */ __name(function(
|
|
8618
|
-
var lookup = FS.lookupPath(
|
|
8537
|
+
readlink: /* @__PURE__ */ __name(function(path) {
|
|
8538
|
+
var lookup = FS.lookupPath(path);
|
|
8619
8539
|
var link = lookup.node;
|
|
8620
8540
|
if (!link) {
|
|
8621
8541
|
throw new FS.ErrnoError(44);
|
|
@@ -8628,8 +8548,8 @@ var require_libzipSync = __commonJS({
|
|
|
8628
8548
|
link.node_ops.readlink(link)
|
|
8629
8549
|
);
|
|
8630
8550
|
}, "readlink"),
|
|
8631
|
-
stat: /* @__PURE__ */ __name(function(
|
|
8632
|
-
var lookup = FS.lookupPath(
|
|
8551
|
+
stat: /* @__PURE__ */ __name(function(path, dontFollow) {
|
|
8552
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8633
8553
|
var node = lookup.node;
|
|
8634
8554
|
if (!node) {
|
|
8635
8555
|
throw new FS.ErrnoError(44);
|
|
@@ -8639,16 +8559,16 @@ var require_libzipSync = __commonJS({
|
|
|
8639
8559
|
}
|
|
8640
8560
|
return node.node_ops.getattr(node);
|
|
8641
8561
|
}, "stat"),
|
|
8642
|
-
lstat: /* @__PURE__ */ __name(function(
|
|
8643
|
-
return FS.stat(
|
|
8562
|
+
lstat: /* @__PURE__ */ __name(function(path) {
|
|
8563
|
+
return FS.stat(path, true);
|
|
8644
8564
|
}, "lstat"),
|
|
8645
|
-
chmod: /* @__PURE__ */ __name(function(
|
|
8565
|
+
chmod: /* @__PURE__ */ __name(function(path, mode, dontFollow) {
|
|
8646
8566
|
var node;
|
|
8647
|
-
if (typeof
|
|
8648
|
-
var lookup = FS.lookupPath(
|
|
8567
|
+
if (typeof path === "string") {
|
|
8568
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8649
8569
|
node = lookup.node;
|
|
8650
8570
|
} else {
|
|
8651
|
-
node =
|
|
8571
|
+
node = path;
|
|
8652
8572
|
}
|
|
8653
8573
|
if (!node.node_ops.setattr) {
|
|
8654
8574
|
throw new FS.ErrnoError(63);
|
|
@@ -8658,8 +8578,8 @@ var require_libzipSync = __commonJS({
|
|
|
8658
8578
|
timestamp: Date.now()
|
|
8659
8579
|
});
|
|
8660
8580
|
}, "chmod"),
|
|
8661
|
-
lchmod: /* @__PURE__ */ __name(function(
|
|
8662
|
-
FS.chmod(
|
|
8581
|
+
lchmod: /* @__PURE__ */ __name(function(path, mode) {
|
|
8582
|
+
FS.chmod(path, mode, true);
|
|
8663
8583
|
}, "lchmod"),
|
|
8664
8584
|
fchmod: /* @__PURE__ */ __name(function(fd, mode) {
|
|
8665
8585
|
var stream = FS.getStream(fd);
|
|
@@ -8668,21 +8588,21 @@ var require_libzipSync = __commonJS({
|
|
|
8668
8588
|
}
|
|
8669
8589
|
FS.chmod(stream.node, mode);
|
|
8670
8590
|
}, "fchmod"),
|
|
8671
|
-
chown: /* @__PURE__ */ __name(function(
|
|
8591
|
+
chown: /* @__PURE__ */ __name(function(path, uid, gid, dontFollow) {
|
|
8672
8592
|
var node;
|
|
8673
|
-
if (typeof
|
|
8674
|
-
var lookup = FS.lookupPath(
|
|
8593
|
+
if (typeof path === "string") {
|
|
8594
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8675
8595
|
node = lookup.node;
|
|
8676
8596
|
} else {
|
|
8677
|
-
node =
|
|
8597
|
+
node = path;
|
|
8678
8598
|
}
|
|
8679
8599
|
if (!node.node_ops.setattr) {
|
|
8680
8600
|
throw new FS.ErrnoError(63);
|
|
8681
8601
|
}
|
|
8682
8602
|
node.node_ops.setattr(node, { timestamp: Date.now() });
|
|
8683
8603
|
}, "chown"),
|
|
8684
|
-
lchown: /* @__PURE__ */ __name(function(
|
|
8685
|
-
FS.chown(
|
|
8604
|
+
lchown: /* @__PURE__ */ __name(function(path, uid, gid) {
|
|
8605
|
+
FS.chown(path, uid, gid, true);
|
|
8686
8606
|
}, "lchown"),
|
|
8687
8607
|
fchown: /* @__PURE__ */ __name(function(fd, uid, gid) {
|
|
8688
8608
|
var stream = FS.getStream(fd);
|
|
@@ -8691,16 +8611,16 @@ var require_libzipSync = __commonJS({
|
|
|
8691
8611
|
}
|
|
8692
8612
|
FS.chown(stream.node, uid, gid);
|
|
8693
8613
|
}, "fchown"),
|
|
8694
|
-
truncate: /* @__PURE__ */ __name(function(
|
|
8614
|
+
truncate: /* @__PURE__ */ __name(function(path, len) {
|
|
8695
8615
|
if (len < 0) {
|
|
8696
8616
|
throw new FS.ErrnoError(28);
|
|
8697
8617
|
}
|
|
8698
8618
|
var node;
|
|
8699
|
-
if (typeof
|
|
8700
|
-
var lookup = FS.lookupPath(
|
|
8619
|
+
if (typeof path === "string") {
|
|
8620
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8701
8621
|
node = lookup.node;
|
|
8702
8622
|
} else {
|
|
8703
|
-
node =
|
|
8623
|
+
node = path;
|
|
8704
8624
|
}
|
|
8705
8625
|
if (!node.node_ops.setattr) {
|
|
8706
8626
|
throw new FS.ErrnoError(63);
|
|
@@ -8727,13 +8647,13 @@ var require_libzipSync = __commonJS({
|
|
|
8727
8647
|
}
|
|
8728
8648
|
FS.truncate(stream.node, len);
|
|
8729
8649
|
}, "ftruncate"),
|
|
8730
|
-
utime: /* @__PURE__ */ __name(function(
|
|
8731
|
-
var lookup = FS.lookupPath(
|
|
8650
|
+
utime: /* @__PURE__ */ __name(function(path, atime, mtime) {
|
|
8651
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8732
8652
|
var node = lookup.node;
|
|
8733
8653
|
node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) });
|
|
8734
8654
|
}, "utime"),
|
|
8735
|
-
open: /* @__PURE__ */ __name(function(
|
|
8736
|
-
if (
|
|
8655
|
+
open: /* @__PURE__ */ __name(function(path, flags, mode, fd_start, fd_end) {
|
|
8656
|
+
if (path === "") {
|
|
8737
8657
|
throw new FS.ErrnoError(44);
|
|
8738
8658
|
}
|
|
8739
8659
|
flags = typeof flags === "string" ? FS.modeStringToFlags(flags) : flags;
|
|
@@ -8744,12 +8664,12 @@ var require_libzipSync = __commonJS({
|
|
|
8744
8664
|
mode = 0;
|
|
8745
8665
|
}
|
|
8746
8666
|
var node;
|
|
8747
|
-
if (typeof
|
|
8748
|
-
node =
|
|
8667
|
+
if (typeof path === "object") {
|
|
8668
|
+
node = path;
|
|
8749
8669
|
} else {
|
|
8750
|
-
|
|
8670
|
+
path = PATH.normalize(path);
|
|
8751
8671
|
try {
|
|
8752
|
-
var lookup = FS.lookupPath(
|
|
8672
|
+
var lookup = FS.lookupPath(path, { follow: !(flags & 131072) });
|
|
8753
8673
|
node = lookup.node;
|
|
8754
8674
|
} catch (e) {
|
|
8755
8675
|
}
|
|
@@ -8761,7 +8681,7 @@ var require_libzipSync = __commonJS({
|
|
|
8761
8681
|
throw new FS.ErrnoError(20);
|
|
8762
8682
|
}
|
|
8763
8683
|
} else {
|
|
8764
|
-
node = FS.mknod(
|
|
8684
|
+
node = FS.mknod(path, mode, 0);
|
|
8765
8685
|
created = true;
|
|
8766
8686
|
}
|
|
8767
8687
|
}
|
|
@@ -8803,9 +8723,9 @@ var require_libzipSync = __commonJS({
|
|
|
8803
8723
|
}
|
|
8804
8724
|
if (Module["logReadFiles"] && !(flags & 1)) {
|
|
8805
8725
|
if (!FS.readFiles) FS.readFiles = {};
|
|
8806
|
-
if (!(
|
|
8807
|
-
FS.readFiles[
|
|
8808
|
-
err("FS.trackingDelegate error on read file: " +
|
|
8726
|
+
if (!(path in FS.readFiles)) {
|
|
8727
|
+
FS.readFiles[path] = 1;
|
|
8728
|
+
err("FS.trackingDelegate error on read file: " + path);
|
|
8809
8729
|
}
|
|
8810
8730
|
}
|
|
8811
8731
|
try {
|
|
@@ -8817,11 +8737,11 @@ var require_libzipSync = __commonJS({
|
|
|
8817
8737
|
if ((flags & 2097155) !== 0) {
|
|
8818
8738
|
trackingFlags |= FS.tracking.openFlags.WRITE;
|
|
8819
8739
|
}
|
|
8820
|
-
FS.trackingDelegate["onOpenFile"](
|
|
8740
|
+
FS.trackingDelegate["onOpenFile"](path, trackingFlags);
|
|
8821
8741
|
}
|
|
8822
8742
|
} catch (e) {
|
|
8823
8743
|
err(
|
|
8824
|
-
"FS.trackingDelegate['onOpenFile']('" +
|
|
8744
|
+
"FS.trackingDelegate['onOpenFile']('" + path + "', flags) threw an exception: " + e.message
|
|
8825
8745
|
);
|
|
8826
8746
|
}
|
|
8827
8747
|
return stream;
|
|
@@ -8993,7 +8913,7 @@ var require_libzipSync = __commonJS({
|
|
|
8993
8913
|
}
|
|
8994
8914
|
return stream.stream_ops.ioctl(stream, cmd, arg);
|
|
8995
8915
|
}, "ioctl"),
|
|
8996
|
-
readFile: /* @__PURE__ */ __name(function(
|
|
8916
|
+
readFile: /* @__PURE__ */ __name(function(path, opts) {
|
|
8997
8917
|
opts = opts || {};
|
|
8998
8918
|
opts.flags = opts.flags || 0;
|
|
8999
8919
|
opts.encoding = opts.encoding || "binary";
|
|
@@ -9001,8 +8921,8 @@ var require_libzipSync = __commonJS({
|
|
|
9001
8921
|
throw new Error('Invalid encoding type "' + opts.encoding + '"');
|
|
9002
8922
|
}
|
|
9003
8923
|
var ret;
|
|
9004
|
-
var stream = FS.open(
|
|
9005
|
-
var stat = FS.stat(
|
|
8924
|
+
var stream = FS.open(path, opts.flags);
|
|
8925
|
+
var stat = FS.stat(path);
|
|
9006
8926
|
var length = stat.size;
|
|
9007
8927
|
var buf = new Uint8Array(length);
|
|
9008
8928
|
FS.read(stream, buf, 0, length, 0);
|
|
@@ -9014,10 +8934,10 @@ var require_libzipSync = __commonJS({
|
|
|
9014
8934
|
FS.close(stream);
|
|
9015
8935
|
return ret;
|
|
9016
8936
|
}, "readFile"),
|
|
9017
|
-
writeFile: /* @__PURE__ */ __name(function(
|
|
8937
|
+
writeFile: /* @__PURE__ */ __name(function(path, data, opts) {
|
|
9018
8938
|
opts = opts || {};
|
|
9019
8939
|
opts.flags = opts.flags || 577;
|
|
9020
|
-
var stream = FS.open(
|
|
8940
|
+
var stream = FS.open(path, opts.flags, opts.mode);
|
|
9021
8941
|
if (typeof data === "string") {
|
|
9022
8942
|
var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
|
|
9023
8943
|
var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
|
|
@@ -9032,8 +8952,8 @@ var require_libzipSync = __commonJS({
|
|
|
9032
8952
|
cwd: /* @__PURE__ */ __name(function() {
|
|
9033
8953
|
return FS.currentPath;
|
|
9034
8954
|
}, "cwd"),
|
|
9035
|
-
chdir: /* @__PURE__ */ __name(function(
|
|
9036
|
-
var lookup = FS.lookupPath(
|
|
8955
|
+
chdir: /* @__PURE__ */ __name(function(path) {
|
|
8956
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
9037
8957
|
if (lookup.node === null) {
|
|
9038
8958
|
throw new FS.ErrnoError(44);
|
|
9039
8959
|
}
|
|
@@ -9177,18 +9097,18 @@ var require_libzipSync = __commonJS({
|
|
|
9177
9097
|
if (canWrite) mode |= 146;
|
|
9178
9098
|
return mode;
|
|
9179
9099
|
}, "getMode"),
|
|
9180
|
-
findObject: /* @__PURE__ */ __name(function(
|
|
9181
|
-
var ret = FS.analyzePath(
|
|
9100
|
+
findObject: /* @__PURE__ */ __name(function(path, dontResolveLastLink) {
|
|
9101
|
+
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
9182
9102
|
if (ret.exists) {
|
|
9183
9103
|
return ret.object;
|
|
9184
9104
|
} else {
|
|
9185
9105
|
return null;
|
|
9186
9106
|
}
|
|
9187
9107
|
}, "findObject"),
|
|
9188
|
-
analyzePath: /* @__PURE__ */ __name(function(
|
|
9108
|
+
analyzePath: /* @__PURE__ */ __name(function(path, dontResolveLastLink) {
|
|
9189
9109
|
try {
|
|
9190
|
-
var lookup = FS.lookupPath(
|
|
9191
|
-
|
|
9110
|
+
var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
9111
|
+
path = lookup.path;
|
|
9192
9112
|
} catch (e) {
|
|
9193
9113
|
}
|
|
9194
9114
|
var ret = {
|
|
@@ -9203,12 +9123,12 @@ var require_libzipSync = __commonJS({
|
|
|
9203
9123
|
parentObject: null
|
|
9204
9124
|
};
|
|
9205
9125
|
try {
|
|
9206
|
-
var lookup = FS.lookupPath(
|
|
9126
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
9207
9127
|
ret.parentExists = true;
|
|
9208
9128
|
ret.parentPath = lookup.path;
|
|
9209
9129
|
ret.parentObject = lookup.node;
|
|
9210
|
-
ret.name = PATH.basename(
|
|
9211
|
-
lookup = FS.lookupPath(
|
|
9130
|
+
ret.name = PATH.basename(path);
|
|
9131
|
+
lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
9212
9132
|
ret.exists = true;
|
|
9213
9133
|
ret.path = lookup.path;
|
|
9214
9134
|
ret.object = lookup.node;
|
|
@@ -9219,9 +9139,9 @@ var require_libzipSync = __commonJS({
|
|
|
9219
9139
|
}
|
|
9220
9140
|
return ret;
|
|
9221
9141
|
}, "analyzePath"),
|
|
9222
|
-
createPath: /* @__PURE__ */ __name(function(parent,
|
|
9142
|
+
createPath: /* @__PURE__ */ __name(function(parent, path, canRead, canWrite) {
|
|
9223
9143
|
parent = typeof parent === "string" ? parent : FS.getPath(parent);
|
|
9224
|
-
var parts =
|
|
9144
|
+
var parts = path.split("/").reverse();
|
|
9225
9145
|
while (parts.length) {
|
|
9226
9146
|
var part = parts.pop();
|
|
9227
9147
|
if (!part) continue;
|
|
@@ -9235,20 +9155,20 @@ var require_libzipSync = __commonJS({
|
|
|
9235
9155
|
return current;
|
|
9236
9156
|
}, "createPath"),
|
|
9237
9157
|
createFile: /* @__PURE__ */ __name(function(parent, name, properties, canRead, canWrite) {
|
|
9238
|
-
var
|
|
9158
|
+
var path = PATH.join2(
|
|
9239
9159
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9240
9160
|
name
|
|
9241
9161
|
);
|
|
9242
9162
|
var mode = FS.getMode(canRead, canWrite);
|
|
9243
|
-
return FS.create(
|
|
9163
|
+
return FS.create(path, mode);
|
|
9244
9164
|
}, "createFile"),
|
|
9245
9165
|
createDataFile: /* @__PURE__ */ __name(function(parent, name, data, canRead, canWrite, canOwn) {
|
|
9246
|
-
var
|
|
9166
|
+
var path = name ? PATH.join2(
|
|
9247
9167
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9248
9168
|
name
|
|
9249
9169
|
) : parent;
|
|
9250
9170
|
var mode = FS.getMode(canRead, canWrite);
|
|
9251
|
-
var node = FS.create(
|
|
9171
|
+
var node = FS.create(path, mode);
|
|
9252
9172
|
if (data) {
|
|
9253
9173
|
if (typeof data === "string") {
|
|
9254
9174
|
var arr = new Array(data.length);
|
|
@@ -9265,7 +9185,7 @@ var require_libzipSync = __commonJS({
|
|
|
9265
9185
|
return node;
|
|
9266
9186
|
}, "createDataFile"),
|
|
9267
9187
|
createDevice: /* @__PURE__ */ __name(function(parent, name, input, output) {
|
|
9268
|
-
var
|
|
9188
|
+
var path = PATH.join2(
|
|
9269
9189
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9270
9190
|
name
|
|
9271
9191
|
);
|
|
@@ -9316,7 +9236,7 @@ var require_libzipSync = __commonJS({
|
|
|
9316
9236
|
return i;
|
|
9317
9237
|
}, "write")
|
|
9318
9238
|
});
|
|
9319
|
-
return FS.mkdev(
|
|
9239
|
+
return FS.mkdev(path, mode, dev);
|
|
9320
9240
|
}, "createDevice"),
|
|
9321
9241
|
forceLoadFile: /* @__PURE__ */ __name(function(obj) {
|
|
9322
9242
|
if (obj.isDevice || obj.isFolder || obj.link || obj.contents)
|
|
@@ -9365,10 +9285,10 @@ var require_libzipSync = __commonJS({
|
|
|
9365
9285
|
var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
|
|
9366
9286
|
var chunkSize = 1024 * 1024;
|
|
9367
9287
|
if (!hasByteServing) chunkSize = datalength;
|
|
9368
|
-
var doXHR = /* @__PURE__ */ __name(function(
|
|
9369
|
-
if (
|
|
9288
|
+
var doXHR = /* @__PURE__ */ __name(function(from2, to) {
|
|
9289
|
+
if (from2 > to)
|
|
9370
9290
|
throw new Error(
|
|
9371
|
-
"invalid range (" +
|
|
9291
|
+
"invalid range (" + from2 + ", " + to + ") or no bytes requested!"
|
|
9372
9292
|
);
|
|
9373
9293
|
if (to > datalength - 1)
|
|
9374
9294
|
throw new Error(
|
|
@@ -9377,7 +9297,7 @@ var require_libzipSync = __commonJS({
|
|
|
9377
9297
|
var xhr2 = new XMLHttpRequest();
|
|
9378
9298
|
xhr2.open("GET", url, false);
|
|
9379
9299
|
if (datalength !== chunkSize)
|
|
9380
|
-
xhr2.setRequestHeader("Range", "bytes=" +
|
|
9300
|
+
xhr2.setRequestHeader("Range", "bytes=" + from2 + "-" + to);
|
|
9381
9301
|
if (typeof Uint8Array != "undefined")
|
|
9382
9302
|
xhr2.responseType = "arraybuffer";
|
|
9383
9303
|
if (xhr2.overrideMimeType) {
|
|
@@ -9562,24 +9482,24 @@ var require_libzipSync = __commonJS({
|
|
|
9562
9482
|
var db = openRequest.result;
|
|
9563
9483
|
var transaction = db.transaction([FS.DB_STORE_NAME], "readwrite");
|
|
9564
9484
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
9565
|
-
var
|
|
9485
|
+
var ok2 = 0, fail = 0, total = paths.length;
|
|
9566
9486
|
function finish() {
|
|
9567
9487
|
if (fail == 0) onload();
|
|
9568
9488
|
else onerror();
|
|
9569
9489
|
}
|
|
9570
9490
|
__name(finish, "finish");
|
|
9571
|
-
paths.forEach(function(
|
|
9491
|
+
paths.forEach(function(path) {
|
|
9572
9492
|
var putRequest = files.put(
|
|
9573
|
-
FS.analyzePath(
|
|
9574
|
-
|
|
9493
|
+
FS.analyzePath(path).object.contents,
|
|
9494
|
+
path
|
|
9575
9495
|
);
|
|
9576
9496
|
putRequest.onsuccess = /* @__PURE__ */ __name(function putRequest_onsuccess() {
|
|
9577
|
-
|
|
9578
|
-
if (
|
|
9497
|
+
ok2++;
|
|
9498
|
+
if (ok2 + fail == total) finish();
|
|
9579
9499
|
}, "putRequest_onsuccess");
|
|
9580
9500
|
putRequest.onerror = /* @__PURE__ */ __name(function putRequest_onerror() {
|
|
9581
9501
|
fail++;
|
|
9582
|
-
if (
|
|
9502
|
+
if (ok2 + fail == total) finish();
|
|
9583
9503
|
}, "putRequest_onerror");
|
|
9584
9504
|
});
|
|
9585
9505
|
transaction.onerror = onerror;
|
|
@@ -9607,32 +9527,32 @@ var require_libzipSync = __commonJS({
|
|
|
9607
9527
|
return;
|
|
9608
9528
|
}
|
|
9609
9529
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
9610
|
-
var
|
|
9530
|
+
var ok2 = 0, fail = 0, total = paths.length;
|
|
9611
9531
|
function finish() {
|
|
9612
9532
|
if (fail == 0) onload();
|
|
9613
9533
|
else onerror();
|
|
9614
9534
|
}
|
|
9615
9535
|
__name(finish, "finish");
|
|
9616
|
-
paths.forEach(function(
|
|
9617
|
-
var getRequest = files.get(
|
|
9536
|
+
paths.forEach(function(path) {
|
|
9537
|
+
var getRequest = files.get(path);
|
|
9618
9538
|
getRequest.onsuccess = /* @__PURE__ */ __name(function getRequest_onsuccess() {
|
|
9619
|
-
if (FS.analyzePath(
|
|
9620
|
-
FS.unlink(
|
|
9539
|
+
if (FS.analyzePath(path).exists) {
|
|
9540
|
+
FS.unlink(path);
|
|
9621
9541
|
}
|
|
9622
9542
|
FS.createDataFile(
|
|
9623
|
-
PATH.dirname(
|
|
9624
|
-
PATH.basename(
|
|
9543
|
+
PATH.dirname(path),
|
|
9544
|
+
PATH.basename(path),
|
|
9625
9545
|
getRequest.result,
|
|
9626
9546
|
true,
|
|
9627
9547
|
true,
|
|
9628
9548
|
true
|
|
9629
9549
|
);
|
|
9630
|
-
|
|
9631
|
-
if (
|
|
9550
|
+
ok2++;
|
|
9551
|
+
if (ok2 + fail == total) finish();
|
|
9632
9552
|
}, "getRequest_onsuccess");
|
|
9633
9553
|
getRequest.onerror = /* @__PURE__ */ __name(function getRequest_onerror() {
|
|
9634
9554
|
fail++;
|
|
9635
|
-
if (
|
|
9555
|
+
if (ok2 + fail == total) finish();
|
|
9636
9556
|
}, "getRequest_onerror");
|
|
9637
9557
|
});
|
|
9638
9558
|
transaction.onerror = onerror;
|
|
@@ -9644,9 +9564,9 @@ var require_libzipSync = __commonJS({
|
|
|
9644
9564
|
mappings: {},
|
|
9645
9565
|
DEFAULT_POLLMASK: 5,
|
|
9646
9566
|
umask: 511,
|
|
9647
|
-
calculateAt: /* @__PURE__ */ __name(function(dirfd,
|
|
9648
|
-
if (
|
|
9649
|
-
return
|
|
9567
|
+
calculateAt: /* @__PURE__ */ __name(function(dirfd, path, allowEmpty) {
|
|
9568
|
+
if (path[0] === "/") {
|
|
9569
|
+
return path;
|
|
9650
9570
|
}
|
|
9651
9571
|
var dir;
|
|
9652
9572
|
if (dirfd === -100) {
|
|
@@ -9656,19 +9576,19 @@ var require_libzipSync = __commonJS({
|
|
|
9656
9576
|
if (!dirstream) throw new FS.ErrnoError(8);
|
|
9657
9577
|
dir = dirstream.path;
|
|
9658
9578
|
}
|
|
9659
|
-
if (
|
|
9579
|
+
if (path.length == 0) {
|
|
9660
9580
|
if (!allowEmpty) {
|
|
9661
9581
|
throw new FS.ErrnoError(44);
|
|
9662
9582
|
}
|
|
9663
9583
|
return dir;
|
|
9664
9584
|
}
|
|
9665
|
-
return PATH.join2(dir,
|
|
9585
|
+
return PATH.join2(dir, path);
|
|
9666
9586
|
}, "calculateAt"),
|
|
9667
|
-
doStat: /* @__PURE__ */ __name(function(func,
|
|
9587
|
+
doStat: /* @__PURE__ */ __name(function(func, path, buf) {
|
|
9668
9588
|
try {
|
|
9669
|
-
var stat = func(
|
|
9589
|
+
var stat = func(path);
|
|
9670
9590
|
} catch (e) {
|
|
9671
|
-
if (e && e.node && PATH.normalize(
|
|
9591
|
+
if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
|
|
9672
9592
|
return -54;
|
|
9673
9593
|
}
|
|
9674
9594
|
throw e;
|
|
@@ -9708,14 +9628,14 @@ var require_libzipSync = __commonJS({
|
|
|
9708
9628
|
var buffer2 = HEAPU8.slice(addr, addr + len);
|
|
9709
9629
|
FS.msync(stream, buffer2, offset, len, flags);
|
|
9710
9630
|
}, "doMsync"),
|
|
9711
|
-
doMkdir: /* @__PURE__ */ __name(function(
|
|
9712
|
-
|
|
9713
|
-
if (
|
|
9714
|
-
|
|
9715
|
-
FS.mkdir(
|
|
9631
|
+
doMkdir: /* @__PURE__ */ __name(function(path, mode) {
|
|
9632
|
+
path = PATH.normalize(path);
|
|
9633
|
+
if (path[path.length - 1] === "/")
|
|
9634
|
+
path = path.substr(0, path.length - 1);
|
|
9635
|
+
FS.mkdir(path, mode, 0);
|
|
9716
9636
|
return 0;
|
|
9717
9637
|
}, "doMkdir"),
|
|
9718
|
-
doMknod: /* @__PURE__ */ __name(function(
|
|
9638
|
+
doMknod: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
9719
9639
|
switch (mode & 61440) {
|
|
9720
9640
|
case 32768:
|
|
9721
9641
|
case 8192:
|
|
@@ -9726,24 +9646,24 @@ var require_libzipSync = __commonJS({
|
|
|
9726
9646
|
default:
|
|
9727
9647
|
return -28;
|
|
9728
9648
|
}
|
|
9729
|
-
FS.mknod(
|
|
9649
|
+
FS.mknod(path, mode, dev);
|
|
9730
9650
|
return 0;
|
|
9731
9651
|
}, "doMknod"),
|
|
9732
|
-
doReadlink: /* @__PURE__ */ __name(function(
|
|
9652
|
+
doReadlink: /* @__PURE__ */ __name(function(path, buf, bufsize) {
|
|
9733
9653
|
if (bufsize <= 0) return -28;
|
|
9734
|
-
var ret = FS.readlink(
|
|
9654
|
+
var ret = FS.readlink(path);
|
|
9735
9655
|
var len = Math.min(bufsize, lengthBytesUTF8(ret));
|
|
9736
9656
|
var endChar = HEAP8[buf + len];
|
|
9737
9657
|
stringToUTF8(ret, buf, bufsize + 1);
|
|
9738
9658
|
HEAP8[buf + len] = endChar;
|
|
9739
9659
|
return len;
|
|
9740
9660
|
}, "doReadlink"),
|
|
9741
|
-
doAccess: /* @__PURE__ */ __name(function(
|
|
9661
|
+
doAccess: /* @__PURE__ */ __name(function(path, amode) {
|
|
9742
9662
|
if (amode & ~7) {
|
|
9743
9663
|
return -28;
|
|
9744
9664
|
}
|
|
9745
9665
|
var node;
|
|
9746
|
-
var lookup = FS.lookupPath(
|
|
9666
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
9747
9667
|
node = lookup.node;
|
|
9748
9668
|
if (!node) {
|
|
9749
9669
|
return -44;
|
|
@@ -9757,10 +9677,10 @@ var require_libzipSync = __commonJS({
|
|
|
9757
9677
|
}
|
|
9758
9678
|
return 0;
|
|
9759
9679
|
}, "doAccess"),
|
|
9760
|
-
doDup: /* @__PURE__ */ __name(function(
|
|
9680
|
+
doDup: /* @__PURE__ */ __name(function(path, flags, suggestFD) {
|
|
9761
9681
|
var suggest = FS.getStream(suggestFD);
|
|
9762
9682
|
if (suggest) FS.close(suggest);
|
|
9763
|
-
return FS.open(
|
|
9683
|
+
return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
|
|
9764
9684
|
}, "doDup"),
|
|
9765
9685
|
doReadv: /* @__PURE__ */ __name(function(stream, iov, iovcnt, offset) {
|
|
9766
9686
|
var ret = 0;
|
|
@@ -9804,10 +9724,10 @@ var require_libzipSync = __commonJS({
|
|
|
9804
9724
|
return low;
|
|
9805
9725
|
}, "get64")
|
|
9806
9726
|
};
|
|
9807
|
-
function ___sys_chmod(
|
|
9727
|
+
function ___sys_chmod(path, mode) {
|
|
9808
9728
|
try {
|
|
9809
|
-
|
|
9810
|
-
FS.chmod(
|
|
9729
|
+
path = SYSCALLS.getStr(path);
|
|
9730
|
+
FS.chmod(path, mode);
|
|
9811
9731
|
return 0;
|
|
9812
9732
|
} catch (e) {
|
|
9813
9733
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -9933,10 +9853,10 @@ var require_libzipSync = __commonJS({
|
|
|
9933
9853
|
}
|
|
9934
9854
|
}
|
|
9935
9855
|
__name(___sys_ioctl, "___sys_ioctl");
|
|
9936
|
-
function ___sys_open(
|
|
9856
|
+
function ___sys_open(path, flags, varargs) {
|
|
9937
9857
|
SYSCALLS.varargs = varargs;
|
|
9938
9858
|
try {
|
|
9939
|
-
var pathname = SYSCALLS.getStr(
|
|
9859
|
+
var pathname = SYSCALLS.getStr(path);
|
|
9940
9860
|
var mode = varargs ? SYSCALLS.get() : 0;
|
|
9941
9861
|
var stream = FS.open(pathname, flags, mode);
|
|
9942
9862
|
return stream.fd;
|
|
@@ -9960,10 +9880,10 @@ var require_libzipSync = __commonJS({
|
|
|
9960
9880
|
}
|
|
9961
9881
|
}
|
|
9962
9882
|
__name(___sys_rename, "___sys_rename");
|
|
9963
|
-
function ___sys_rmdir(
|
|
9883
|
+
function ___sys_rmdir(path) {
|
|
9964
9884
|
try {
|
|
9965
|
-
|
|
9966
|
-
FS.rmdir(
|
|
9885
|
+
path = SYSCALLS.getStr(path);
|
|
9886
|
+
FS.rmdir(path);
|
|
9967
9887
|
return 0;
|
|
9968
9888
|
} catch (e) {
|
|
9969
9889
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -9972,10 +9892,10 @@ var require_libzipSync = __commonJS({
|
|
|
9972
9892
|
}
|
|
9973
9893
|
}
|
|
9974
9894
|
__name(___sys_rmdir, "___sys_rmdir");
|
|
9975
|
-
function ___sys_stat64(
|
|
9895
|
+
function ___sys_stat64(path, buf) {
|
|
9976
9896
|
try {
|
|
9977
|
-
|
|
9978
|
-
return SYSCALLS.doStat(FS.stat,
|
|
9897
|
+
path = SYSCALLS.getStr(path);
|
|
9898
|
+
return SYSCALLS.doStat(FS.stat, path, buf);
|
|
9979
9899
|
} catch (e) {
|
|
9980
9900
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
9981
9901
|
abort(e);
|
|
@@ -9983,10 +9903,10 @@ var require_libzipSync = __commonJS({
|
|
|
9983
9903
|
}
|
|
9984
9904
|
}
|
|
9985
9905
|
__name(___sys_stat64, "___sys_stat64");
|
|
9986
|
-
function ___sys_unlink(
|
|
9906
|
+
function ___sys_unlink(path) {
|
|
9987
9907
|
try {
|
|
9988
|
-
|
|
9989
|
-
FS.unlink(
|
|
9908
|
+
path = SYSCALLS.getStr(path);
|
|
9909
|
+
FS.unlink(path);
|
|
9990
9910
|
return 0;
|
|
9991
9911
|
} catch (e) {
|
|
9992
9912
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -10217,7 +10137,7 @@ var require_libzipSync = __commonJS({
|
|
|
10217
10137
|
FS.FSNode = FSNode;
|
|
10218
10138
|
FS.staticInit();
|
|
10219
10139
|
if (ENVIRONMENT_IS_NODE) {
|
|
10220
|
-
var
|
|
10140
|
+
var fs = frozenFs;
|
|
10221
10141
|
var NODEJS_PATH = __require("path");
|
|
10222
10142
|
NODEFS.staticInit();
|
|
10223
10143
|
}
|
|
@@ -10662,15 +10582,27 @@ function getInterpretedFile(pathToFile) {
|
|
|
10662
10582
|
}
|
|
10663
10583
|
__name(getInterpretedFile, "getInterpretedFile");
|
|
10664
10584
|
|
|
10585
|
+
// src/common/utils/strip-abs-node-modules-path.ts
|
|
10586
|
+
import { posix, sep } from "node:path";
|
|
10587
|
+
function normalizePath(id) {
|
|
10588
|
+
return posix.normalize(slash(id));
|
|
10589
|
+
}
|
|
10590
|
+
__name(normalizePath, "normalizePath");
|
|
10591
|
+
function stripAbsNodeModulesPath(absPath) {
|
|
10592
|
+
const splits = absPath.split(`node_modules${sep}`);
|
|
10593
|
+
return normalizePath(splits[splits.length - 1]);
|
|
10594
|
+
}
|
|
10595
|
+
__name(stripAbsNodeModulesPath, "stripAbsNodeModulesPath");
|
|
10596
|
+
|
|
10665
10597
|
// src/common/utils/validate-configuration-files.ts
|
|
10666
10598
|
import { resolve as resolve2 } from "node:path";
|
|
10667
10599
|
import { once } from "storybook/internal/node-logger";
|
|
10668
10600
|
import { MainFileMissingError } from "storybook/internal/server-errors";
|
|
10669
10601
|
var import_ts_dedent = __toESM(require_dist(), 1);
|
|
10670
|
-
async function validateConfigurationFiles(configDir,
|
|
10602
|
+
async function validateConfigurationFiles(configDir, cwd) {
|
|
10671
10603
|
const extensionsPattern = `{${Array.from(supportedExtensions).join(",")}}`;
|
|
10672
10604
|
const mainConfigMatches = await glob(slash(resolve2(configDir, `main${extensionsPattern}`)), {
|
|
10673
|
-
cwd:
|
|
10605
|
+
cwd: cwd ?? process.cwd()
|
|
10674
10606
|
});
|
|
10675
10607
|
const [mainConfigPath] = mainConfigMatches;
|
|
10676
10608
|
if (mainConfigMatches.length > 1) {
|
|
@@ -10719,10 +10651,10 @@ var resolveAddonName = /* @__PURE__ */ __name((configDir, name, options) => {
|
|
|
10719
10651
|
if (managerFile || previewFile || presetFile) {
|
|
10720
10652
|
const previewAnnotations = [];
|
|
10721
10653
|
if (previewFile) {
|
|
10722
|
-
const parsedPreviewFile =
|
|
10723
|
-
if (parsedPreviewFile
|
|
10654
|
+
const parsedPreviewFile = stripAbsNodeModulesPath(previewFile);
|
|
10655
|
+
if (parsedPreviewFile !== previewFile) {
|
|
10724
10656
|
previewAnnotations.push({
|
|
10725
|
-
bare:
|
|
10657
|
+
bare: parsedPreviewFile,
|
|
10726
10658
|
absolute: previewFile
|
|
10727
10659
|
});
|
|
10728
10660
|
} else {
|
|
@@ -11021,136 +10953,76 @@ function createFileSystemCache(options) {
|
|
|
11021
10953
|
__name(createFileSystemCache, "createFileSystemCache");
|
|
11022
10954
|
|
|
11023
10955
|
// src/common/utils/resolve-path-in-sb-cache.ts
|
|
11024
|
-
import { join as
|
|
10956
|
+
import { join as join4 } from "node:path";
|
|
11025
10957
|
|
|
11026
|
-
// node_modules/
|
|
11027
|
-
|
|
11028
|
-
import
|
|
11029
|
-
import
|
|
11030
|
-
import fs from "node:fs";
|
|
11031
|
-
|
|
11032
|
-
// ../node_modules/pkg-dir/index.js
|
|
11033
|
-
import path2 from "node:path";
|
|
11034
|
-
|
|
11035
|
-
// ../node_modules/pkg-dir/node_modules/find-up/index.js
|
|
11036
|
-
import path from "node:path";
|
|
11037
|
-
import { fileURLToPath } from "node:url";
|
|
11038
|
-
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
11039
|
-
var findUpStop = Symbol("findUpStop");
|
|
11040
|
-
function findUpMultipleSync2(name, options = {}) {
|
|
11041
|
-
let directory = path.resolve(toPath(options.cwd) || "");
|
|
11042
|
-
const { root } = path.parse(directory);
|
|
11043
|
-
const stopAt = options.stopAt || root;
|
|
11044
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
11045
|
-
const paths = [name].flat();
|
|
11046
|
-
const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
|
|
11047
|
-
if (typeof name !== "function") {
|
|
11048
|
-
return locatePathSync(paths, locateOptions);
|
|
11049
|
-
}
|
|
11050
|
-
const foundPath = name(locateOptions.cwd);
|
|
11051
|
-
if (typeof foundPath === "string") {
|
|
11052
|
-
return locatePathSync([foundPath], locateOptions);
|
|
11053
|
-
}
|
|
11054
|
-
return foundPath;
|
|
11055
|
-
}, "runMatcher");
|
|
11056
|
-
const matches = [];
|
|
11057
|
-
while (true) {
|
|
11058
|
-
const foundPath = runMatcher({ ...options, cwd: directory });
|
|
11059
|
-
if (foundPath === findUpStop) {
|
|
11060
|
-
break;
|
|
11061
|
-
}
|
|
11062
|
-
if (foundPath) {
|
|
11063
|
-
matches.push(path.resolve(directory, foundPath));
|
|
11064
|
-
}
|
|
11065
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
11066
|
-
break;
|
|
11067
|
-
}
|
|
11068
|
-
directory = path.dirname(directory);
|
|
11069
|
-
}
|
|
11070
|
-
return matches;
|
|
11071
|
-
}
|
|
11072
|
-
__name(findUpMultipleSync2, "findUpMultipleSync");
|
|
11073
|
-
function findUpSync2(name, options = {}) {
|
|
11074
|
-
const matches = findUpMultipleSync2(name, { ...options, limit: 1 });
|
|
11075
|
-
return matches[0];
|
|
11076
|
-
}
|
|
11077
|
-
__name(findUpSync2, "findUpSync");
|
|
11078
|
-
|
|
11079
|
-
// ../node_modules/pkg-dir/index.js
|
|
11080
|
-
function packageDirectorySync({ cwd: cwd2 } = {}) {
|
|
11081
|
-
const filePath = findUpSync2("package.json", { cwd: cwd2 });
|
|
11082
|
-
return filePath && path2.dirname(filePath);
|
|
11083
|
-
}
|
|
11084
|
-
__name(packageDirectorySync, "packageDirectorySync");
|
|
10958
|
+
// ../node_modules/empathic/package.mjs
|
|
10959
|
+
import { env } from "node:process";
|
|
10960
|
+
import { dirname, join as join3 } from "node:path";
|
|
10961
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
11085
10962
|
|
|
11086
|
-
// node_modules/
|
|
11087
|
-
|
|
11088
|
-
|
|
10963
|
+
// ../node_modules/empathic/access.mjs
|
|
10964
|
+
import { accessSync, constants } from "node:fs";
|
|
10965
|
+
function ok(path, mode) {
|
|
11089
10966
|
try {
|
|
11090
|
-
|
|
10967
|
+
accessSync(path, mode);
|
|
11091
10968
|
return true;
|
|
11092
10969
|
} catch {
|
|
11093
10970
|
return false;
|
|
11094
10971
|
}
|
|
11095
|
-
}, "isWritable");
|
|
11096
|
-
function useDirectory(directory, options) {
|
|
11097
|
-
if (options.create) {
|
|
11098
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
11099
|
-
}
|
|
11100
|
-
return directory;
|
|
11101
10972
|
}
|
|
11102
|
-
__name(
|
|
11103
|
-
function
|
|
11104
|
-
|
|
11105
|
-
if (!isWritable(nodeModules) && (fs.existsSync(nodeModules) || !isWritable(path3.join(directory)))) {
|
|
11106
|
-
return;
|
|
11107
|
-
}
|
|
11108
|
-
return nodeModules;
|
|
10973
|
+
__name(ok, "ok");
|
|
10974
|
+
function writable(path) {
|
|
10975
|
+
return ok(path, constants.W_OK);
|
|
11109
10976
|
}
|
|
11110
|
-
__name(
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
10977
|
+
__name(writable, "writable");
|
|
10978
|
+
|
|
10979
|
+
// ../node_modules/empathic/package.mjs
|
|
10980
|
+
function up2(options) {
|
|
10981
|
+
return up("package.json", options);
|
|
10982
|
+
}
|
|
10983
|
+
__name(up2, "up");
|
|
10984
|
+
function cache(name, options) {
|
|
10985
|
+
options = options || {};
|
|
10986
|
+
let dir = env.CACHE_DIR;
|
|
10987
|
+
if (!dir || /^(1|0|true|false)$/.test(dir)) {
|
|
10988
|
+
let pkg = up2(options);
|
|
10989
|
+
if (dir = pkg && dirname(pkg)) {
|
|
10990
|
+
let mods = join3(dir, "node_modules");
|
|
10991
|
+
let exists = existsSync2(mods);
|
|
10992
|
+
if (!writable(exists ? mods : dir)) return;
|
|
10993
|
+
dir = join3(mods, ".cache");
|
|
10994
|
+
}
|
|
10995
|
+
}
|
|
10996
|
+
if (dir) {
|
|
10997
|
+
dir = join3(dir, name);
|
|
10998
|
+
if (options.create && !existsSync2(dir)) {
|
|
10999
|
+
mkdirSync2(dir, { recursive: true });
|
|
11000
|
+
}
|
|
11001
|
+
return dir;
|
|
11129
11002
|
}
|
|
11130
|
-
return useDirectory(path3.join(directory, "node_modules", ".cache", options.name), options);
|
|
11131
11003
|
}
|
|
11132
|
-
__name(
|
|
11004
|
+
__name(cache, "cache");
|
|
11133
11005
|
|
|
11134
11006
|
// src/common/utils/resolve-path-in-sb-cache.ts
|
|
11135
11007
|
function resolvePathInStorybookCache(fileOrDirectoryName, sub = "default") {
|
|
11136
|
-
let cacheDirectory =
|
|
11137
|
-
cacheDirectory ||=
|
|
11138
|
-
return
|
|
11008
|
+
let cacheDirectory = cache("storybook");
|
|
11009
|
+
cacheDirectory ||= join4(process.cwd(), "node_modules", ".cache", "storybook");
|
|
11010
|
+
return join4(cacheDirectory, sub, fileOrDirectoryName);
|
|
11139
11011
|
}
|
|
11140
11012
|
__name(resolvePathInStorybookCache, "resolvePathInStorybookCache");
|
|
11141
11013
|
|
|
11142
11014
|
// src/common/utils/cache.ts
|
|
11143
|
-
var
|
|
11015
|
+
var cache2 = createFileSystemCache({
|
|
11144
11016
|
basePath: resolvePathInStorybookCache("dev-server"),
|
|
11145
11017
|
ns: "storybook"
|
|
11146
11018
|
// Optional. A grouping namespace for items.
|
|
11147
11019
|
});
|
|
11148
11020
|
|
|
11149
11021
|
// src/common/utils/cli.ts
|
|
11150
|
-
import { createWriteStream, mkdirSync as
|
|
11022
|
+
import { createWriteStream, mkdirSync as mkdirSync3 } from "node:fs";
|
|
11151
11023
|
import { copyFile, readFile as readFile2, realpath, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
11152
11024
|
import os from "node:os";
|
|
11153
|
-
import { join as
|
|
11025
|
+
import { join as join7 } from "node:path";
|
|
11154
11026
|
|
|
11155
11027
|
// ../node_modules/crypto-random-string/index.js
|
|
11156
11028
|
import { promisify } from "util";
|
|
@@ -11292,12 +11164,12 @@ var satellite_addons_default = [
|
|
|
11292
11164
|
];
|
|
11293
11165
|
|
|
11294
11166
|
// src/common/utils/get-storybook-info.ts
|
|
11295
|
-
import { existsSync as
|
|
11296
|
-
import { dirname as
|
|
11167
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
11168
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
11297
11169
|
|
|
11298
11170
|
// src/common/js-package-manager/JsPackageManager.ts
|
|
11299
11171
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11300
|
-
import { dirname, isAbsolute, join as
|
|
11172
|
+
import { dirname as dirname2, isAbsolute, join as join5, resolve as resolve3 } from "node:path";
|
|
11301
11173
|
import { logger as logger2, prompt } from "storybook/internal/node-logger";
|
|
11302
11174
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
11303
11175
|
import { gt, satisfies } from "semver";
|
|
@@ -11346,7 +11218,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11346
11218
|
}
|
|
11347
11219
|
constructor(options) {
|
|
11348
11220
|
this.cwd = options?.cwd || process.cwd();
|
|
11349
|
-
this.instanceDir = options?.configDir ? isAbsolute(options?.configDir) ?
|
|
11221
|
+
this.instanceDir = options?.configDir ? isAbsolute(options?.configDir) ? dirname2(options?.configDir) : dirname2(join5(this.cwd, options?.configDir)) : this.cwd;
|
|
11350
11222
|
this.packageJsonPaths = _JsPackageManager.listAllPackageJsonPaths(
|
|
11351
11223
|
this.instanceDir,
|
|
11352
11224
|
options?.storiesPaths
|
|
@@ -11354,13 +11226,13 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11354
11226
|
this.primaryPackageJson = this.#getPrimaryPackageJson();
|
|
11355
11227
|
}
|
|
11356
11228
|
isStorybookInMonorepo() {
|
|
11357
|
-
const turboJsonPath =
|
|
11358
|
-
const rushJsonPath =
|
|
11359
|
-
const nxJsonPath =
|
|
11229
|
+
const turboJsonPath = up(`turbo.json`, { last: getProjectRoot() });
|
|
11230
|
+
const rushJsonPath = up(`rush.json`, { last: getProjectRoot() });
|
|
11231
|
+
const nxJsonPath = up(`nx.json`, { last: getProjectRoot() });
|
|
11360
11232
|
if (turboJsonPath || rushJsonPath || nxJsonPath) {
|
|
11361
11233
|
return true;
|
|
11362
11234
|
}
|
|
11363
|
-
const packageJsonPaths =
|
|
11235
|
+
const packageJsonPaths = findFilesUp(["package.json"]);
|
|
11364
11236
|
if (packageJsonPaths.length === 0) {
|
|
11365
11237
|
return false;
|
|
11366
11238
|
}
|
|
@@ -11510,7 +11382,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11510
11382
|
}
|
|
11511
11383
|
});
|
|
11512
11384
|
if (modified) {
|
|
11513
|
-
this.writePackageJson(packageJson,
|
|
11385
|
+
this.writePackageJson(packageJson, dirname2(pjPath));
|
|
11514
11386
|
break;
|
|
11515
11387
|
}
|
|
11516
11388
|
} catch (e) {
|
|
@@ -11701,14 +11573,14 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11701
11573
|
command,
|
|
11702
11574
|
args = [],
|
|
11703
11575
|
stdio,
|
|
11704
|
-
cwd
|
|
11576
|
+
cwd,
|
|
11705
11577
|
ignoreError = false,
|
|
11706
11578
|
env: env2,
|
|
11707
11579
|
...execaOptions
|
|
11708
11580
|
}) {
|
|
11709
11581
|
try {
|
|
11710
11582
|
const commandResult = execaCommandSync([command, ...args].join(" "), {
|
|
11711
|
-
cwd:
|
|
11583
|
+
cwd: cwd ?? this.cwd,
|
|
11712
11584
|
stdio: stdio ?? "pipe",
|
|
11713
11585
|
shell: true,
|
|
11714
11586
|
cleanup: true,
|
|
@@ -11738,13 +11610,13 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11738
11610
|
command,
|
|
11739
11611
|
args = [],
|
|
11740
11612
|
stdio,
|
|
11741
|
-
cwd
|
|
11613
|
+
cwd,
|
|
11742
11614
|
ignoreError = false,
|
|
11743
11615
|
env: env2,
|
|
11744
11616
|
...execaOptions
|
|
11745
11617
|
}) {
|
|
11746
11618
|
const execaProcess = execa([command, ...args].join(" "), {
|
|
11747
|
-
cwd:
|
|
11619
|
+
cwd: cwd ?? this.cwd,
|
|
11748
11620
|
stdio: stdio ?? "pipe",
|
|
11749
11621
|
encoding: "utf8",
|
|
11750
11622
|
shell: true,
|
|
@@ -11793,8 +11665,8 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11793
11665
|
* the dependency.
|
|
11794
11666
|
*/
|
|
11795
11667
|
getDependencyVersion(dependency) {
|
|
11796
|
-
const dependencyVersion = this.packageJsonPaths.map((
|
|
11797
|
-
const packageJson = _JsPackageManager.getPackageJson(
|
|
11668
|
+
const dependencyVersion = this.packageJsonPaths.map((path) => {
|
|
11669
|
+
const packageJson = _JsPackageManager.getPackageJson(path);
|
|
11798
11670
|
return packageJson.dependencies?.[dependency] ?? packageJson.devDependencies?.[dependency];
|
|
11799
11671
|
}).filter(Boolean);
|
|
11800
11672
|
return dependencyVersion[0] ?? null;
|
|
@@ -11839,10 +11711,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11839
11711
|
}
|
|
11840
11712
|
/** List all package.json files starting from the given directory and stopping at the project root. */
|
|
11841
11713
|
static listAllPackageJsonPaths(instanceDir, storiesPaths) {
|
|
11842
|
-
const packageJsonPaths =
|
|
11843
|
-
cwd: instanceDir,
|
|
11844
|
-
stopAt: getProjectRoot()
|
|
11845
|
-
});
|
|
11714
|
+
const packageJsonPaths = findFilesUp(["package.json"], instanceDir);
|
|
11846
11715
|
if (!storiesPaths) {
|
|
11847
11716
|
return packageJsonPaths;
|
|
11848
11717
|
}
|
|
@@ -11853,7 +11722,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11853
11722
|
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
11854
11723
|
});
|
|
11855
11724
|
const relevantPackageJsons = allPackageJsonFiles.filter((packageJsonPath) => {
|
|
11856
|
-
const packageDir =
|
|
11725
|
+
const packageDir = dirname2(packageJsonPath);
|
|
11857
11726
|
return storiesPaths.some((storyPath) => storyPath.startsWith(packageDir));
|
|
11858
11727
|
});
|
|
11859
11728
|
return Array.from(/* @__PURE__ */ new Set([...packageJsonPaths, ...relevantPackageJsons]));
|
|
@@ -11868,7 +11737,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11868
11737
|
return _JsPackageManager.getPackageJsonInfo(finalTargetPackageJsonPath);
|
|
11869
11738
|
}
|
|
11870
11739
|
static getPackageJsonInfo(packageJsonPath) {
|
|
11871
|
-
const operationDir =
|
|
11740
|
+
const operationDir = dirname2(packageJsonPath);
|
|
11872
11741
|
return {
|
|
11873
11742
|
packageJsonPath,
|
|
11874
11743
|
operationDir,
|
|
@@ -11942,7 +11811,7 @@ var findDependency = /* @__PURE__ */ __name(({ dependencies, devDependencies, pe
|
|
|
11942
11811
|
Object.entries(peerDependencies || {}).find(predicate)
|
|
11943
11812
|
], "findDependency");
|
|
11944
11813
|
var getRendererInfo = /* @__PURE__ */ __name((configDir) => {
|
|
11945
|
-
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(
|
|
11814
|
+
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(dirname3(configDir));
|
|
11946
11815
|
for (const packageJsonPath of packageJsonPaths) {
|
|
11947
11816
|
const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
11948
11817
|
const [dep, devDep, peerDep] = findDependency(packageJson, ([key]) => rendererPackages[key]);
|
|
@@ -11961,13 +11830,13 @@ var getRendererInfo = /* @__PURE__ */ __name((configDir) => {
|
|
|
11961
11830
|
}, "getRendererInfo");
|
|
11962
11831
|
var validConfigExtensions = ["ts", "js", "tsx", "jsx", "mjs", "cjs"];
|
|
11963
11832
|
var findConfigFile = /* @__PURE__ */ __name((prefix, configDir) => {
|
|
11964
|
-
const filePrefix =
|
|
11965
|
-
const extension = validConfigExtensions.find((ext) =>
|
|
11833
|
+
const filePrefix = join6(configDir, prefix);
|
|
11834
|
+
const extension = validConfigExtensions.find((ext) => existsSync3(`${filePrefix}.${ext}`));
|
|
11966
11835
|
return extension ? `${filePrefix}.${extension}` : null;
|
|
11967
11836
|
}, "findConfigFile");
|
|
11968
11837
|
var getConfigInfo = /* @__PURE__ */ __name((configDir) => {
|
|
11969
11838
|
let storybookConfigDir = configDir ?? ".storybook";
|
|
11970
|
-
if (!
|
|
11839
|
+
if (!existsSync3(storybookConfigDir)) {
|
|
11971
11840
|
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(storybookConfigDir);
|
|
11972
11841
|
for (const packageJsonPath of packageJsonPaths) {
|
|
11973
11842
|
const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
@@ -11999,10 +11868,10 @@ var getStorybookInfo = /* @__PURE__ */ __name((configDir = ".storybook") => {
|
|
|
11999
11868
|
|
|
12000
11869
|
// src/common/utils/cli.ts
|
|
12001
11870
|
var tempDir = /* @__PURE__ */ __name(() => realpath(os.tmpdir()), "tempDir");
|
|
12002
|
-
var getPath = /* @__PURE__ */ __name(async (prefix = "") =>
|
|
11871
|
+
var getPath = /* @__PURE__ */ __name(async (prefix = "") => join7(await tempDir(), prefix + uniqueString()), "getPath");
|
|
12003
11872
|
async function temporaryDirectory({ prefix = "" } = {}) {
|
|
12004
11873
|
const directory = await getPath(prefix);
|
|
12005
|
-
|
|
11874
|
+
mkdirSync3(directory);
|
|
12006
11875
|
return directory;
|
|
12007
11876
|
}
|
|
12008
11877
|
__name(temporaryDirectory, "temporaryDirectory");
|
|
@@ -12011,7 +11880,7 @@ async function temporaryFile({ name, extension } = {}) {
|
|
|
12011
11880
|
if (extension !== void 0 && extension !== null) {
|
|
12012
11881
|
throw new Error("The `name` and `extension` options are mutually exclusive");
|
|
12013
11882
|
}
|
|
12014
|
-
return
|
|
11883
|
+
return join7(await temporaryDirectory(), name);
|
|
12015
11884
|
}
|
|
12016
11885
|
return await getPath() + (extension === void 0 || extension === null ? "" : "." + extension.replace(/^\./, ""));
|
|
12017
11886
|
}
|
|
@@ -12041,7 +11910,7 @@ function getEnvConfig(program, configEnv) {
|
|
|
12041
11910
|
}
|
|
12042
11911
|
__name(getEnvConfig, "getEnvConfig");
|
|
12043
11912
|
var createLogStream = /* @__PURE__ */ __name(async (logFileName = "storybook.log") => {
|
|
12044
|
-
const finalLogPath =
|
|
11913
|
+
const finalLogPath = join7(process.cwd(), logFileName);
|
|
12045
11914
|
const temporaryLogPath = await temporaryFile({ name: logFileName });
|
|
12046
11915
|
const logStream = createWriteStream(temporaryLogPath, { encoding: "utf8" });
|
|
12047
11916
|
return new Promise((resolve8, reject) => {
|
|
@@ -12151,11 +12020,11 @@ __name(getBuilderOptions, "getBuilderOptions");
|
|
|
12151
12020
|
var import_ts_dedent3 = __toESM(require_dist(), 1);
|
|
12152
12021
|
|
|
12153
12022
|
// src/common/utils/normalize-path.ts
|
|
12154
|
-
import { posix } from "node:path";
|
|
12155
|
-
function
|
|
12156
|
-
return
|
|
12023
|
+
import { posix as posix2 } from "node:path";
|
|
12024
|
+
function normalizePath2(p) {
|
|
12025
|
+
return posix2.normalize(p.replace(/\\/g, "/"));
|
|
12157
12026
|
}
|
|
12158
|
-
__name(
|
|
12027
|
+
__name(normalizePath2, "normalizePath");
|
|
12159
12028
|
|
|
12160
12029
|
// src/common/utils/get-framework-name.ts
|
|
12161
12030
|
async function getFrameworkName(options) {
|
|
@@ -12171,7 +12040,7 @@ async function getFrameworkName(options) {
|
|
|
12171
12040
|
}
|
|
12172
12041
|
__name(getFrameworkName, "getFrameworkName");
|
|
12173
12042
|
var extractProperFrameworkName = /* @__PURE__ */ __name((framework) => {
|
|
12174
|
-
const normalizedPath =
|
|
12043
|
+
const normalizedPath = normalizePath2(framework);
|
|
12175
12044
|
const frameworkName = Object.keys(frameworkPackages).find((pkg) => normalizedPath.endsWith(pkg));
|
|
12176
12045
|
return frameworkName ?? framework;
|
|
12177
12046
|
}, "extractProperFrameworkName");
|
|
@@ -12197,24 +12066,20 @@ __name(extractProperRendererNameFromFramework, "extractProperRendererNameFromFra
|
|
|
12197
12066
|
|
|
12198
12067
|
// src/common/utils/get-storybook-refs.ts
|
|
12199
12068
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
12200
|
-
import { dirname as
|
|
12069
|
+
import { dirname as dirname4, join as join8 } from "node:path";
|
|
12201
12070
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
12202
|
-
var import_resolve_from = __toESM(require_resolve_from(), 1);
|
|
12203
12071
|
var getAutoRefs = /* @__PURE__ */ __name(async (options) => {
|
|
12204
|
-
const location =
|
|
12205
|
-
cwd: options.configDir,
|
|
12206
|
-
stopAt: getProjectRoot()
|
|
12207
|
-
});
|
|
12072
|
+
const location = up2({ cwd: options.configDir, last: getProjectRoot() });
|
|
12208
12073
|
if (!location) {
|
|
12209
12074
|
return {};
|
|
12210
12075
|
}
|
|
12211
|
-
const directory =
|
|
12076
|
+
const directory = dirname4(location);
|
|
12212
12077
|
const { dependencies = [], devDependencies = [] } = JSON.parse(await readFile3(location, { encoding: "utf8" })) || {};
|
|
12213
12078
|
const deps = Object.keys({ ...dependencies, ...devDependencies });
|
|
12214
12079
|
const list = await Promise.all(
|
|
12215
12080
|
deps.map(async (d) => {
|
|
12216
12081
|
try {
|
|
12217
|
-
const l = (
|
|
12082
|
+
const l = from(directory, join8(d, "package.json"));
|
|
12218
12083
|
const { storybook, name, version } = JSON.parse(await readFile3(l, { encoding: "utf8" })) || {};
|
|
12219
12084
|
if (storybook?.url) {
|
|
12220
12085
|
return { id: name, ...storybook, version };
|
|
@@ -12243,8 +12108,8 @@ var getAutoRefs = /* @__PURE__ */ __name(async (options) => {
|
|
|
12243
12108
|
);
|
|
12244
12109
|
}, "getAutoRefs");
|
|
12245
12110
|
var checkRef = /* @__PURE__ */ __name((url) => fetch(`${url}/iframe.html`).then(
|
|
12246
|
-
async ({ ok, status }) => {
|
|
12247
|
-
if (
|
|
12111
|
+
async ({ ok: ok2, status }) => {
|
|
12112
|
+
if (ok2) {
|
|
12248
12113
|
if (status !== 200) {
|
|
12249
12114
|
return false;
|
|
12250
12115
|
}
|
|
@@ -12255,7 +12120,7 @@ var checkRef = /* @__PURE__ */ __name((url) => fetch(`${url}/iframe.html`).then(
|
|
|
12255
12120
|
return false;
|
|
12256
12121
|
}
|
|
12257
12122
|
}
|
|
12258
|
-
return
|
|
12123
|
+
return ok2;
|
|
12259
12124
|
},
|
|
12260
12125
|
() => false
|
|
12261
12126
|
), "checkRef");
|
|
@@ -12283,8 +12148,8 @@ async function getRefs(options) {
|
|
|
12283
12148
|
});
|
|
12284
12149
|
await Promise.all(
|
|
12285
12150
|
Object.entries(refs).map(async ([k, value]) => {
|
|
12286
|
-
const
|
|
12287
|
-
refs[k] = { ...value, type:
|
|
12151
|
+
const ok2 = await checkRef(value.url);
|
|
12152
|
+
refs[k] = { ...value, type: ok2 ? "server-checked" : "unknown" };
|
|
12288
12153
|
})
|
|
12289
12154
|
);
|
|
12290
12155
|
return refs;
|
|
@@ -12341,13 +12206,16 @@ function serverRequire(filePath) {
|
|
|
12341
12206
|
__name(serverRequire, "serverRequire");
|
|
12342
12207
|
|
|
12343
12208
|
// src/common/utils/load-main-config.ts
|
|
12344
|
-
|
|
12209
|
+
var import_ts_dedent4 = __toESM(require_dist(), 1);
|
|
12210
|
+
import { readFile as readFile4, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
|
|
12211
|
+
import { join as join9, parse as parse2, relative, resolve as resolve4 } from "node:path";
|
|
12212
|
+
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
12345
12213
|
import { MainFileEvaluationError } from "storybook/internal/server-errors";
|
|
12346
12214
|
async function loadMainConfig({
|
|
12347
12215
|
configDir = ".storybook",
|
|
12348
|
-
cwd
|
|
12216
|
+
cwd
|
|
12349
12217
|
}) {
|
|
12350
|
-
await validateConfigurationFiles(configDir,
|
|
12218
|
+
await validateConfigurationFiles(configDir, cwd);
|
|
12351
12219
|
const mainPath = getInterpretedFile(resolve4(configDir, "main"));
|
|
12352
12220
|
try {
|
|
12353
12221
|
const out = await importModule(mainPath);
|
|
@@ -12356,6 +12224,34 @@ async function loadMainConfig({
|
|
|
12356
12224
|
if (!(e instanceof Error)) {
|
|
12357
12225
|
throw e;
|
|
12358
12226
|
}
|
|
12227
|
+
if (e.message.includes("require is not defined")) {
|
|
12228
|
+
logger5.info(
|
|
12229
|
+
"Loading main config failed, trying a temporary fix, Please ensure the main config is valid ESM"
|
|
12230
|
+
);
|
|
12231
|
+
const comment = "// end of Storybook 10 migration assistant header, you can delete the above code";
|
|
12232
|
+
const content = await readFile4(mainPath, "utf-8");
|
|
12233
|
+
if (!content.includes(comment)) {
|
|
12234
|
+
const header = import_ts_dedent4.dedent`
|
|
12235
|
+
import { createRequire } from "node:module";
|
|
12236
|
+
import { dirname } from "node:path";
|
|
12237
|
+
import { fileURLToPath } from "node:url";
|
|
12238
|
+
|
|
12239
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12240
|
+
const __dirname = dirname(__filename);
|
|
12241
|
+
const require = createRequire(import.meta.url);
|
|
12242
|
+
`;
|
|
12243
|
+
const { ext, name, dir } = parse2(mainPath);
|
|
12244
|
+
const modifiedMainPath = join9(dir, `${name}.tmp.${ext}`);
|
|
12245
|
+
await writeFile3(modifiedMainPath, [header, comment, content].join("\n\n"));
|
|
12246
|
+
let out;
|
|
12247
|
+
try {
|
|
12248
|
+
out = await importModule(modifiedMainPath);
|
|
12249
|
+
} finally {
|
|
12250
|
+
await rm3(modifiedMainPath);
|
|
12251
|
+
}
|
|
12252
|
+
return out;
|
|
12253
|
+
}
|
|
12254
|
+
}
|
|
12359
12255
|
throw new MainFileEvaluationError({
|
|
12360
12256
|
location: relative(process.cwd(), mainPath),
|
|
12361
12257
|
error: e
|
|
@@ -12365,17 +12261,17 @@ async function loadMainConfig({
|
|
|
12365
12261
|
__name(loadMainConfig, "loadMainConfig");
|
|
12366
12262
|
|
|
12367
12263
|
// src/common/utils/load-manager-or-addons-file.ts
|
|
12368
|
-
var
|
|
12264
|
+
var import_ts_dedent5 = __toESM(require_dist(), 1);
|
|
12369
12265
|
import { resolve as resolve5 } from "node:path";
|
|
12370
|
-
import { logger as
|
|
12266
|
+
import { logger as logger6 } from "storybook/internal/node-logger";
|
|
12371
12267
|
function loadManagerOrAddonsFile({ configDir }) {
|
|
12372
12268
|
const storybookCustomAddonsPath = getInterpretedFile(resolve5(configDir, "addons"));
|
|
12373
12269
|
const storybookCustomManagerPath = getInterpretedFile(resolve5(configDir, "manager"));
|
|
12374
12270
|
if (storybookCustomAddonsPath || storybookCustomManagerPath) {
|
|
12375
|
-
|
|
12271
|
+
logger6.info("=> Loading custom manager config");
|
|
12376
12272
|
}
|
|
12377
12273
|
if (storybookCustomAddonsPath && storybookCustomManagerPath) {
|
|
12378
|
-
throw new Error(
|
|
12274
|
+
throw new Error(import_ts_dedent5.dedent`
|
|
12379
12275
|
You have both a "addons.js" and a "manager.js", remove the "addons.js" file from your configDir (${resolve5(
|
|
12380
12276
|
configDir,
|
|
12381
12277
|
"addons"
|
|
@@ -12386,13 +12282,13 @@ function loadManagerOrAddonsFile({ configDir }) {
|
|
|
12386
12282
|
__name(loadManagerOrAddonsFile, "loadManagerOrAddonsFile");
|
|
12387
12283
|
|
|
12388
12284
|
// src/common/utils/load-preview-or-config-file.ts
|
|
12389
|
-
var
|
|
12285
|
+
var import_ts_dedent6 = __toESM(require_dist(), 1);
|
|
12390
12286
|
import { resolve as resolve6 } from "node:path";
|
|
12391
12287
|
function loadPreviewOrConfigFile({ configDir }) {
|
|
12392
12288
|
const storybookConfigPath = getInterpretedFile(resolve6(configDir, "config"));
|
|
12393
12289
|
const storybookPreviewPath = getInterpretedFile(resolve6(configDir, "preview"));
|
|
12394
12290
|
if (storybookConfigPath && storybookPreviewPath) {
|
|
12395
|
-
throw new Error(
|
|
12291
|
+
throw new Error(import_ts_dedent6.dedent`
|
|
12396
12292
|
You have both a "config.js" and a "preview.js", remove the "config.js" file from your configDir (${resolve6(
|
|
12397
12293
|
configDir,
|
|
12398
12294
|
"config"
|
|
@@ -12404,20 +12300,20 @@ __name(loadPreviewOrConfigFile, "loadPreviewOrConfigFile");
|
|
|
12404
12300
|
|
|
12405
12301
|
// src/common/utils/log.ts
|
|
12406
12302
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
12407
|
-
import { logger as
|
|
12303
|
+
import { logger as logger7 } from "storybook/internal/node-logger";
|
|
12408
12304
|
var commandLog = /* @__PURE__ */ __name((message) => {
|
|
12409
12305
|
process.stdout.write(import_picocolors2.default.cyan(" \u2022 ") + message);
|
|
12410
12306
|
return (errorMessage, errorInfo) => {
|
|
12411
12307
|
if (errorMessage) {
|
|
12412
12308
|
process.stdout.write(`. ${import_picocolors2.default.red("\u2716")}
|
|
12413
12309
|
`);
|
|
12414
|
-
|
|
12310
|
+
logger7.error(`
|
|
12415
12311
|
${import_picocolors2.default.red(errorMessage)}`);
|
|
12416
12312
|
if (!errorInfo) {
|
|
12417
12313
|
return;
|
|
12418
12314
|
}
|
|
12419
12315
|
const newErrorInfo = errorInfo.split("\n").map((line) => ` ${import_picocolors2.default.dim(line)}`).join("\n");
|
|
12420
|
-
|
|
12316
|
+
logger7.error(`${newErrorInfo}
|
|
12421
12317
|
`);
|
|
12422
12318
|
return;
|
|
12423
12319
|
}
|
|
@@ -12427,7 +12323,7 @@ var commandLog = /* @__PURE__ */ __name((message) => {
|
|
|
12427
12323
|
}, "commandLog");
|
|
12428
12324
|
function paddedLog(message) {
|
|
12429
12325
|
const newMessage = message.split("\n").map((line) => ` ${line}`).join("\n");
|
|
12430
|
-
|
|
12326
|
+
logger7.log(newMessage);
|
|
12431
12327
|
}
|
|
12432
12328
|
__name(paddedLog, "paddedLog");
|
|
12433
12329
|
function getChars(char, amount) {
|
|
@@ -12450,7 +12346,7 @@ function codeLog(codeLines, leftPadAmount) {
|
|
|
12450
12346
|
newLine = getChars(" ", leftPadAmount || 2) + import_picocolors2.default.inverse(` ${newLine} `);
|
|
12451
12347
|
return newLine;
|
|
12452
12348
|
}).join("\n");
|
|
12453
|
-
|
|
12349
|
+
logger7.log(finalResult);
|
|
12454
12350
|
}
|
|
12455
12351
|
__name(codeLog, "codeLog");
|
|
12456
12352
|
|
|
@@ -12465,7 +12361,7 @@ __name(logConfig, "logConfig");
|
|
|
12465
12361
|
// src/common/utils/normalize-stories.ts
|
|
12466
12362
|
var pico2 = __toESM(require_picomatch(), 1);
|
|
12467
12363
|
import { lstatSync } from "node:fs";
|
|
12468
|
-
import { basename, dirname as
|
|
12364
|
+
import { basename, dirname as dirname5, relative as relative2, resolve as resolve7 } from "node:path";
|
|
12469
12365
|
import { InvalidStoriesEntryError } from "storybook/internal/server-errors";
|
|
12470
12366
|
var DEFAULT_TITLE_PREFIX = "";
|
|
12471
12367
|
var DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|jsx|mjs|ts|tsx))";
|
|
@@ -12506,7 +12402,7 @@ var normalizeStoriesEntry = /* @__PURE__ */ __name((entry, { configDir, workingD
|
|
|
12506
12402
|
} else {
|
|
12507
12403
|
specifierWithoutMatcher = {
|
|
12508
12404
|
titlePrefix: DEFAULT_TITLE_PREFIX,
|
|
12509
|
-
directory:
|
|
12405
|
+
directory: dirname5(entry),
|
|
12510
12406
|
files: basename(entry)
|
|
12511
12407
|
};
|
|
12512
12408
|
}
|
|
@@ -12541,44 +12437,44 @@ var normalizeStories = /* @__PURE__ */ __name((entries, options) => {
|
|
|
12541
12437
|
}, "normalizeStories");
|
|
12542
12438
|
|
|
12543
12439
|
// src/common/utils/readTemplate.ts
|
|
12544
|
-
import { readFile as
|
|
12440
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
12545
12441
|
async function readTemplate(filename) {
|
|
12546
|
-
return
|
|
12442
|
+
return readFile5(filename, {
|
|
12547
12443
|
encoding: "utf8"
|
|
12548
12444
|
});
|
|
12549
12445
|
}
|
|
12550
12446
|
__name(readTemplate, "readTemplate");
|
|
12551
12447
|
|
|
12552
12448
|
// src/common/utils/remove.ts
|
|
12553
|
-
var
|
|
12449
|
+
var import_ts_dedent7 = __toESM(require_dist(), 1);
|
|
12554
12450
|
import { readConfig, writeConfig } from "storybook/internal/csf-tools";
|
|
12555
|
-
import { logger as
|
|
12451
|
+
import { logger as logger8 } from "storybook/internal/node-logger";
|
|
12556
12452
|
async function removeAddon(addon, options) {
|
|
12557
12453
|
const { packageManager, skipInstall } = options;
|
|
12558
12454
|
const { mainConfigPath, configDir } = getConfigInfo(options.configDir);
|
|
12559
12455
|
if (typeof configDir === "undefined") {
|
|
12560
|
-
throw new Error(
|
|
12456
|
+
throw new Error(import_ts_dedent7.dedent`
|
|
12561
12457
|
Unable to find storybook config directory
|
|
12562
12458
|
`);
|
|
12563
12459
|
}
|
|
12564
12460
|
if (!mainConfigPath) {
|
|
12565
|
-
|
|
12461
|
+
logger8.error("Unable to find storybook main.js config");
|
|
12566
12462
|
return;
|
|
12567
12463
|
}
|
|
12568
12464
|
const main = await readConfig(mainConfigPath);
|
|
12569
|
-
|
|
12465
|
+
logger8.debug(`Uninstalling ${addon}`);
|
|
12570
12466
|
await packageManager.removeDependencies([addon]);
|
|
12571
12467
|
if (!skipInstall) {
|
|
12572
12468
|
await packageManager.installDependencies();
|
|
12573
12469
|
}
|
|
12574
12470
|
const currentAddons = main.getNamesFromPath(["addons"]) ?? [];
|
|
12575
12471
|
if (currentAddons.includes(addon)) {
|
|
12576
|
-
|
|
12472
|
+
logger8.debug(`Removing '${addon}' from main.js addons field.`);
|
|
12577
12473
|
try {
|
|
12578
12474
|
main.removeEntryFromArray(["addons"], addon);
|
|
12579
12475
|
await writeConfig(main);
|
|
12580
12476
|
} catch (err) {
|
|
12581
|
-
|
|
12477
|
+
logger8.warn(`Failed to remove '${addon}' from main.js addons field. ${String(err)}`);
|
|
12582
12478
|
}
|
|
12583
12479
|
}
|
|
12584
12480
|
}
|
|
@@ -12592,7 +12488,7 @@ function isPreservingSymlinks() {
|
|
|
12592
12488
|
__name(isPreservingSymlinks, "isPreservingSymlinks");
|
|
12593
12489
|
|
|
12594
12490
|
// src/common/utils/template.ts
|
|
12595
|
-
import { existsSync as
|
|
12491
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
12596
12492
|
var interpolate2 = /* @__PURE__ */ __name((string, data = {}) => Object.entries(data).reduce((acc, [k, v]) => acc.replace(new RegExp(`%${k}%`, "g"), v), string), "interpolate");
|
|
12597
12493
|
function getPreviewBodyTemplate(configDirPath, interpolations) {
|
|
12598
12494
|
const base = readFileSync4(
|
|
@@ -12601,7 +12497,7 @@ function getPreviewBodyTemplate(configDirPath, interpolations) {
|
|
|
12601
12497
|
);
|
|
12602
12498
|
const bodyHtmlPath = resolve(configDirPath, "preview-body.html");
|
|
12603
12499
|
let result = base;
|
|
12604
|
-
if (
|
|
12500
|
+
if (existsSync4(bodyHtmlPath)) {
|
|
12605
12501
|
result = readFileSync4(bodyHtmlPath, "utf8") + result;
|
|
12606
12502
|
}
|
|
12607
12503
|
return interpolate2(result, interpolations);
|
|
@@ -12614,7 +12510,7 @@ function getPreviewHeadTemplate(configDirPath, interpolations) {
|
|
|
12614
12510
|
);
|
|
12615
12511
|
const headHtmlPath = resolve(configDirPath, "preview-head.html");
|
|
12616
12512
|
let result = base;
|
|
12617
|
-
if (
|
|
12513
|
+
if (existsSync4(headHtmlPath)) {
|
|
12618
12514
|
result += readFileSync4(headHtmlPath, "utf8");
|
|
12619
12515
|
}
|
|
12620
12516
|
return interpolate2(result, interpolations);
|
|
@@ -12622,7 +12518,7 @@ function getPreviewHeadTemplate(configDirPath, interpolations) {
|
|
|
12622
12518
|
__name(getPreviewHeadTemplate, "getPreviewHeadTemplate");
|
|
12623
12519
|
|
|
12624
12520
|
// src/common/utils/validate-config.ts
|
|
12625
|
-
import { join as
|
|
12521
|
+
import { join as join10 } from "node:path";
|
|
12626
12522
|
import {
|
|
12627
12523
|
CouldNotEvaluateFrameworkError,
|
|
12628
12524
|
InvalidFrameworkNameError,
|
|
@@ -12641,7 +12537,7 @@ function validateFrameworkName(frameworkName) {
|
|
|
12641
12537
|
return;
|
|
12642
12538
|
}
|
|
12643
12539
|
try {
|
|
12644
|
-
|
|
12540
|
+
resolveModulePath(join10(frameworkName, "preset"), {
|
|
12645
12541
|
extensions: [".mjs", ".js", ".cjs"],
|
|
12646
12542
|
conditions: ["node", "import", "require"]
|
|
12647
12543
|
});
|
|
@@ -12696,14 +12592,14 @@ async function formatWithEditorConfig(filePath, content) {
|
|
|
12696
12592
|
__name(formatWithEditorConfig, "formatWithEditorConfig");
|
|
12697
12593
|
|
|
12698
12594
|
// src/common/utils/get-story-id.ts
|
|
12699
|
-
var
|
|
12595
|
+
var import_ts_dedent9 = __toESM(require_dist(), 1);
|
|
12700
12596
|
import { relative as relative3 } from "node:path";
|
|
12701
12597
|
import { normalizeStories as normalizeStories2, normalizeStoryPath as normalizeStoryPath2 } from "storybook/internal/common";
|
|
12702
12598
|
import { sanitize as sanitize2, storyNameFromExport, toId } from "storybook/internal/csf";
|
|
12703
12599
|
|
|
12704
12600
|
// src/preview-api/modules/store/autoTitle.ts
|
|
12705
12601
|
import { once as once2 } from "storybook/internal/client-logger";
|
|
12706
|
-
var
|
|
12602
|
+
var import_ts_dedent8 = __toESM(require_dist(), 1);
|
|
12707
12603
|
var sanitize = /* @__PURE__ */ __name((parts) => {
|
|
12708
12604
|
if (parts.length === 0) {
|
|
12709
12605
|
return parts;
|
|
@@ -12726,7 +12622,7 @@ __name(pathJoin, "pathJoin");
|
|
|
12726
12622
|
var userOrAutoTitleFromSpecifier = /* @__PURE__ */ __name((fileName, entry, userTitle) => {
|
|
12727
12623
|
const { directory, importPathMatcher, titlePrefix = "" } = entry || {};
|
|
12728
12624
|
if (typeof fileName === "number") {
|
|
12729
|
-
once2.warn(
|
|
12625
|
+
once2.warn(import_ts_dedent8.dedent`
|
|
12730
12626
|
CSF Auto-title received a numeric fileName. This typically happens when
|
|
12731
12627
|
webpack is mis-configured in production mode. To force webpack to produce
|
|
12732
12628
|
filenames, set optimization.moduleIds = "named" in your webpack config.
|
|
@@ -12749,8 +12645,8 @@ var userOrAutoTitleFromSpecifier = /* @__PURE__ */ __name((fileName, entry, user
|
|
|
12749
12645
|
}, "userOrAutoTitleFromSpecifier");
|
|
12750
12646
|
|
|
12751
12647
|
// src/common/utils/posix.ts
|
|
12752
|
-
import { posix as posixPath, sep } from "node:path";
|
|
12753
|
-
var
|
|
12648
|
+
import { posix as posixPath, sep as sep2 } from "node:path";
|
|
12649
|
+
var posix3 = /* @__PURE__ */ __name((localPath, seperator = sep2) => localPath.split(seperator).filter(Boolean).join(posixPath.sep), "posix");
|
|
12754
12650
|
|
|
12755
12651
|
// src/common/utils/get-story-id.ts
|
|
12756
12652
|
async function getStoryId(data, options) {
|
|
@@ -12761,7 +12657,7 @@ async function getStoryId(data, options) {
|
|
|
12761
12657
|
configDir: options.configDir
|
|
12762
12658
|
});
|
|
12763
12659
|
if (autoTitle === void 0) {
|
|
12764
|
-
throw new Error(
|
|
12660
|
+
throw new Error(import_ts_dedent9.dedent`
|
|
12765
12661
|
The new story file was successfully generated, but we are unable to index it. Please ensure that the new Story file is matched by the 'stories' glob pattern in your Storybook configuration.
|
|
12766
12662
|
`);
|
|
12767
12663
|
}
|
|
@@ -12783,7 +12679,7 @@ function getStoryTitle({
|
|
|
12783
12679
|
workingDir
|
|
12784
12680
|
});
|
|
12785
12681
|
const relativePath = relative3(workingDir, storyFilePath);
|
|
12786
|
-
const importPath =
|
|
12682
|
+
const importPath = posix3(normalizeStoryPath2(relativePath));
|
|
12787
12683
|
return normalizedStories.map((normalizeStory) => userOrAutoTitleFromSpecifier(importPath, normalizeStory, userTitle)).filter(Boolean)[0];
|
|
12788
12684
|
}
|
|
12789
12685
|
__name(getStoryTitle, "getStoryTitle");
|
|
@@ -12801,7 +12697,7 @@ var getAddonNames = /* @__PURE__ */ __name((mainConfig) => {
|
|
|
12801
12697
|
if (name.startsWith(".")) {
|
|
12802
12698
|
return void 0;
|
|
12803
12699
|
}
|
|
12804
|
-
name =
|
|
12700
|
+
name = normalizePath2(name);
|
|
12805
12701
|
name = name.replace(/.*node_modules\//, "");
|
|
12806
12702
|
return name.replace(/\/dist\/.*$/, "").replace(/\.[mc]?[tj]?sx?$/, "").replace(/\/register$/, "").replace(/\/manager$/, "").replace(/\/preset$/, "");
|
|
12807
12703
|
});
|
|
@@ -12816,7 +12712,7 @@ import {
|
|
|
12816
12712
|
readConfig as readConfig2,
|
|
12817
12713
|
writeConfig as writeConfig2
|
|
12818
12714
|
} from "storybook/internal/csf-tools";
|
|
12819
|
-
import { logger as
|
|
12715
|
+
import { logger as logger9 } from "storybook/internal/node-logger";
|
|
12820
12716
|
|
|
12821
12717
|
// src/common/utils/get-addon-annotations.ts
|
|
12822
12718
|
function getAnnotationsName(addonName) {
|
|
@@ -12857,12 +12753,15 @@ async function getSyncedStorybookAddons(mainConfig, previewConfig, configDir) {
|
|
|
12857
12753
|
if (!isCsfFactory) {
|
|
12858
12754
|
return previewConfig;
|
|
12859
12755
|
}
|
|
12756
|
+
const existingAddons = previewConfig.getFieldNode(["addons"]);
|
|
12757
|
+
if (!existingAddons) {
|
|
12758
|
+
previewConfig.setFieldNode(["addons"], t.arrayExpression([]));
|
|
12759
|
+
}
|
|
12860
12760
|
const addons = getAddonNames(mainConfig);
|
|
12861
12761
|
if (!addons) {
|
|
12862
12762
|
return previewConfig;
|
|
12863
12763
|
}
|
|
12864
12764
|
const syncedAddons = [];
|
|
12865
|
-
const existingAddons = previewConfig.getFieldNode(["addons"]);
|
|
12866
12765
|
for (const addon of addons) {
|
|
12867
12766
|
const annotations = await getAddonAnnotations(addon, configDir);
|
|
12868
12767
|
if (annotations) {
|
|
@@ -12890,7 +12789,7 @@ async function getSyncedStorybookAddons(mainConfig, previewConfig, configDir) {
|
|
|
12890
12789
|
}
|
|
12891
12790
|
}
|
|
12892
12791
|
if (syncedAddons.length > 0) {
|
|
12893
|
-
|
|
12792
|
+
logger9.log(
|
|
12894
12793
|
`Synchronizing addons from main config in ${import_picocolors4.default.cyan(previewConfig.fileName)}:
|
|
12895
12794
|
${syncedAddons.map(import_picocolors4.default.magenta).join(", ")}`
|
|
12896
12795
|
);
|
|
@@ -12901,13 +12800,13 @@ __name(getSyncedStorybookAddons, "getSyncedStorybookAddons");
|
|
|
12901
12800
|
|
|
12902
12801
|
// src/common/js-package-manager/JsPackageManagerFactory.ts
|
|
12903
12802
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
12904
|
-
import { basename as basename2, parse as
|
|
12803
|
+
import { basename as basename2, parse as parse3, relative as relative4 } from "node:path";
|
|
12905
12804
|
|
|
12906
12805
|
// src/common/js-package-manager/BUNProxy.ts
|
|
12907
|
-
import {
|
|
12806
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
12908
12807
|
import { platform } from "node:os";
|
|
12909
|
-
import { join as
|
|
12910
|
-
import { logger as
|
|
12808
|
+
import { join as join11 } from "node:path";
|
|
12809
|
+
import { logger as logger10 } from "storybook/internal/node-logger";
|
|
12911
12810
|
import { FindPackageVersionsError } from "storybook/internal/server-errors";
|
|
12912
12811
|
import sort from "semver/functions/sort.js";
|
|
12913
12812
|
var NPM_ERROR_REGEX = /npm ERR! code (\w+)/;
|
|
@@ -12965,13 +12864,8 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
12965
12864
|
return `bunx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
12966
12865
|
}
|
|
12967
12866
|
async getModulePackageJSON(packageName) {
|
|
12968
|
-
const
|
|
12969
|
-
|
|
12970
|
-
const possiblePath = join9(dir, "node_modules", packageName, "package.json");
|
|
12971
|
-
return existsSync4(possiblePath) ? possiblePath : void 0;
|
|
12972
|
-
},
|
|
12973
|
-
{ cwd: this.cwd, stopAt: getProjectRoot() }
|
|
12974
|
-
);
|
|
12867
|
+
const wantedPath = join11("node_modules", packageName, "package.json");
|
|
12868
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
12975
12869
|
if (!packageJsonPath) {
|
|
12976
12870
|
return null;
|
|
12977
12871
|
}
|
|
@@ -12984,24 +12878,24 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
12984
12878
|
}
|
|
12985
12879
|
return this.installArgs;
|
|
12986
12880
|
}
|
|
12987
|
-
runPackageCommandSync(command, args,
|
|
12881
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
12988
12882
|
return this.executeCommandSync({
|
|
12989
12883
|
command: "bun",
|
|
12990
12884
|
args: ["run", command, ...args],
|
|
12991
|
-
cwd
|
|
12885
|
+
cwd,
|
|
12992
12886
|
stdio
|
|
12993
12887
|
});
|
|
12994
12888
|
}
|
|
12995
|
-
runPackageCommand(command, args,
|
|
12889
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
12996
12890
|
return this.executeCommand({
|
|
12997
12891
|
command: "bun",
|
|
12998
12892
|
args: ["run", command, ...args],
|
|
12999
|
-
cwd
|
|
12893
|
+
cwd,
|
|
13000
12894
|
stdio
|
|
13001
12895
|
});
|
|
13002
12896
|
}
|
|
13003
|
-
runInternalCommand(command, args,
|
|
13004
|
-
return this.executeCommand({ command: "bun", args: [command, ...args], cwd
|
|
12897
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
12898
|
+
return this.executeCommand({ command: "bun", args: [command, ...args], cwd, stdio });
|
|
13005
12899
|
}
|
|
13006
12900
|
async findInstallations(pattern, { depth = 99 } = {}) {
|
|
13007
12901
|
const exec = /* @__PURE__ */ __name(async ({ packageDepth }) => {
|
|
@@ -13028,7 +12922,7 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13028
12922
|
const parsedOutput = JSON.parse(commandResult);
|
|
13029
12923
|
return this.mapDependencies(parsedOutput, pattern);
|
|
13030
12924
|
} catch (err) {
|
|
13031
|
-
|
|
12925
|
+
logger10.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
|
|
13032
12926
|
return void 0;
|
|
13033
12927
|
}
|
|
13034
12928
|
}
|
|
@@ -13151,10 +13045,10 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13151
13045
|
};
|
|
13152
13046
|
|
|
13153
13047
|
// src/common/js-package-manager/NPMProxy.ts
|
|
13154
|
-
import {
|
|
13048
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
13155
13049
|
import { platform as platform2 } from "node:os";
|
|
13156
|
-
import { join as
|
|
13157
|
-
import { logger as
|
|
13050
|
+
import { join as join12 } from "node:path";
|
|
13051
|
+
import { logger as logger11, prompt as prompt2 } from "storybook/internal/node-logger";
|
|
13158
13052
|
import { FindPackageVersionsError as FindPackageVersionsError2 } from "storybook/internal/server-errors";
|
|
13159
13053
|
import sort2 from "semver/functions/sort.js";
|
|
13160
13054
|
var NPM_ERROR_REGEX2 = /npm (ERR!|error) (code|errno) (\w+)/i;
|
|
@@ -13206,13 +13100,8 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13206
13100
|
return `npx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13207
13101
|
}
|
|
13208
13102
|
async getModulePackageJSON(packageName) {
|
|
13209
|
-
const
|
|
13210
|
-
|
|
13211
|
-
const possiblePath = join10(dir, "node_modules", packageName, "package.json");
|
|
13212
|
-
return existsSync5(possiblePath) ? possiblePath : void 0;
|
|
13213
|
-
},
|
|
13214
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13215
|
-
);
|
|
13103
|
+
const wantedPath = join12("node_modules", packageName, "package.json");
|
|
13104
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13216
13105
|
if (!packageJsonPath) {
|
|
13217
13106
|
return null;
|
|
13218
13107
|
}
|
|
@@ -13225,27 +13114,27 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13225
13114
|
}
|
|
13226
13115
|
return this.installArgs;
|
|
13227
13116
|
}
|
|
13228
|
-
runPackageCommandSync(command, args,
|
|
13117
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13229
13118
|
return this.executeCommandSync({
|
|
13230
13119
|
command: "npm",
|
|
13231
13120
|
args: ["exec", "--", command, ...args],
|
|
13232
|
-
cwd
|
|
13121
|
+
cwd,
|
|
13233
13122
|
stdio
|
|
13234
13123
|
});
|
|
13235
13124
|
}
|
|
13236
|
-
runPackageCommand(command, args,
|
|
13125
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13237
13126
|
return this.executeCommand({
|
|
13238
13127
|
command: "npm",
|
|
13239
13128
|
args: ["exec", "--", command, ...args],
|
|
13240
|
-
cwd
|
|
13129
|
+
cwd,
|
|
13241
13130
|
stdio
|
|
13242
13131
|
});
|
|
13243
13132
|
}
|
|
13244
|
-
runInternalCommand(command, args,
|
|
13133
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13245
13134
|
return this.executeCommand({
|
|
13246
13135
|
command: "npm",
|
|
13247
13136
|
args: [command, ...args],
|
|
13248
|
-
cwd
|
|
13137
|
+
cwd,
|
|
13249
13138
|
stdio
|
|
13250
13139
|
});
|
|
13251
13140
|
}
|
|
@@ -13273,7 +13162,7 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13273
13162
|
const parsedOutput = JSON.parse(commandResult);
|
|
13274
13163
|
return this.mapDependencies(parsedOutput, pattern);
|
|
13275
13164
|
} catch (err) {
|
|
13276
|
-
|
|
13165
|
+
logger11.debug(`An issue occurred while trying to find dependencies metadata using npm.`);
|
|
13277
13166
|
return void 0;
|
|
13278
13167
|
}
|
|
13279
13168
|
}
|
|
@@ -13397,7 +13286,7 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13397
13286
|
|
|
13398
13287
|
// src/common/js-package-manager/PNPMProxy.ts
|
|
13399
13288
|
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
13400
|
-
import { join as
|
|
13289
|
+
import { join as join13 } from "node:path";
|
|
13401
13290
|
import { pathToFileURL } from "node:url";
|
|
13402
13291
|
import { prompt as prompt3 } from "storybook/internal/node-logger";
|
|
13403
13292
|
import { FindPackageVersionsError as FindPackageVersionsError3 } from "storybook/internal/server-errors";
|
|
@@ -13437,27 +13326,27 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13437
13326
|
}
|
|
13438
13327
|
return this.installArgs;
|
|
13439
13328
|
}
|
|
13440
|
-
runPackageCommandSync(command, args,
|
|
13329
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13441
13330
|
return this.executeCommandSync({
|
|
13442
13331
|
command: "pnpm",
|
|
13443
13332
|
args: ["exec", command, ...args],
|
|
13444
|
-
cwd
|
|
13333
|
+
cwd,
|
|
13445
13334
|
stdio
|
|
13446
13335
|
});
|
|
13447
13336
|
}
|
|
13448
|
-
runPackageCommand(command, args,
|
|
13337
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13449
13338
|
return this.executeCommand({
|
|
13450
13339
|
command: "pnpm",
|
|
13451
13340
|
args: ["exec", command, ...args],
|
|
13452
|
-
cwd
|
|
13341
|
+
cwd,
|
|
13453
13342
|
stdio
|
|
13454
13343
|
});
|
|
13455
13344
|
}
|
|
13456
|
-
runInternalCommand(command, args,
|
|
13345
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13457
13346
|
return this.executeCommand({
|
|
13458
13347
|
command: "pnpm",
|
|
13459
13348
|
args: [command, ...args],
|
|
13460
|
-
cwd
|
|
13349
|
+
cwd,
|
|
13461
13350
|
stdio
|
|
13462
13351
|
});
|
|
13463
13352
|
}
|
|
@@ -13487,9 +13376,9 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13487
13376
|
}
|
|
13488
13377
|
}
|
|
13489
13378
|
async getModulePackageJSON(packageName) {
|
|
13490
|
-
const pnpapiPath =
|
|
13379
|
+
const pnpapiPath = any([".pnp.js", ".pnp.cjs"], {
|
|
13491
13380
|
cwd: this.primaryPackageJson.operationDir,
|
|
13492
|
-
|
|
13381
|
+
last: getProjectRoot()
|
|
13493
13382
|
});
|
|
13494
13383
|
if (pnpapiPath) {
|
|
13495
13384
|
try {
|
|
@@ -13500,7 +13389,7 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13500
13389
|
const pkgLocator = pnpApi.findPackageLocator(resolvedPath);
|
|
13501
13390
|
const pkg = pnpApi.getPackageInformation(pkgLocator);
|
|
13502
13391
|
const packageJSON = JSON.parse(
|
|
13503
|
-
readFileSync7(
|
|
13392
|
+
readFileSync7(join13(pkg.packageLocation, "package.json"), "utf-8")
|
|
13504
13393
|
);
|
|
13505
13394
|
return packageJSON;
|
|
13506
13395
|
} catch (error) {
|
|
@@ -13510,13 +13399,8 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13510
13399
|
return null;
|
|
13511
13400
|
}
|
|
13512
13401
|
}
|
|
13513
|
-
const
|
|
13514
|
-
|
|
13515
|
-
const possiblePath = join11(dir, "node_modules", packageName, "package.json");
|
|
13516
|
-
return existsSync6(possiblePath) ? possiblePath : void 0;
|
|
13517
|
-
},
|
|
13518
|
-
{ cwd: this.cwd, stopAt: getProjectRoot() }
|
|
13519
|
-
);
|
|
13402
|
+
const wantedPath = join13("node_modules", packageName, "package.json");
|
|
13403
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13520
13404
|
if (!packageJsonPath) {
|
|
13521
13405
|
return null;
|
|
13522
13406
|
}
|
|
@@ -13627,8 +13511,9 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13627
13511
|
};
|
|
13628
13512
|
|
|
13629
13513
|
// src/common/js-package-manager/Yarn1Proxy.ts
|
|
13630
|
-
import {
|
|
13631
|
-
import { join as
|
|
13514
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
13515
|
+
import { join as join14 } from "node:path";
|
|
13516
|
+
import process2 from "node:process";
|
|
13632
13517
|
import { prompt as prompt4 } from "storybook/internal/node-logger";
|
|
13633
13518
|
import { FindPackageVersionsError as FindPackageVersionsError4 } from "storybook/internal/server-errors";
|
|
13634
13519
|
|
|
@@ -13653,7 +13538,7 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13653
13538
|
}
|
|
13654
13539
|
getInstallArgs() {
|
|
13655
13540
|
if (!this.installArgs) {
|
|
13656
|
-
this.installArgs = ["--ignore-workspace-root-check"];
|
|
13541
|
+
this.installArgs = process2.env.CI ? [] : ["--ignore-workspace-root-check"];
|
|
13657
13542
|
}
|
|
13658
13543
|
return this.installArgs;
|
|
13659
13544
|
}
|
|
@@ -13663,28 +13548,23 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13663
13548
|
getRemoteRunCommand(pkg, args, specifier) {
|
|
13664
13549
|
return `npx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13665
13550
|
}
|
|
13666
|
-
runPackageCommandSync(command, args,
|
|
13551
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13667
13552
|
return this.executeCommandSync({
|
|
13668
13553
|
command: `yarn`,
|
|
13669
13554
|
args: ["exec", command, ...args],
|
|
13670
|
-
cwd
|
|
13555
|
+
cwd,
|
|
13671
13556
|
stdio
|
|
13672
13557
|
});
|
|
13673
13558
|
}
|
|
13674
|
-
runPackageCommand(command, args,
|
|
13675
|
-
return this.executeCommand({ command: `yarn`, args: ["exec", command, ...args], cwd
|
|
13559
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13560
|
+
return this.executeCommand({ command: `yarn`, args: ["exec", command, ...args], cwd, stdio });
|
|
13676
13561
|
}
|
|
13677
|
-
runInternalCommand(command, args,
|
|
13678
|
-
return this.executeCommand({ command: `yarn`, args: [command, ...args], cwd
|
|
13562
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13563
|
+
return this.executeCommand({ command: `yarn`, args: [command, ...args], cwd, stdio });
|
|
13679
13564
|
}
|
|
13680
13565
|
async getModulePackageJSON(packageName) {
|
|
13681
|
-
const
|
|
13682
|
-
|
|
13683
|
-
const possiblePath = join12(dir, "node_modules", packageName, "package.json");
|
|
13684
|
-
return existsSync7(possiblePath) ? possiblePath : void 0;
|
|
13685
|
-
},
|
|
13686
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13687
|
-
);
|
|
13566
|
+
const wantedPath = join14("node_modules", packageName, "package.json");
|
|
13567
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13688
13568
|
if (!packageJsonPath) {
|
|
13689
13569
|
return null;
|
|
13690
13570
|
}
|
|
@@ -13821,8 +13701,8 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13821
13701
|
// src/common/js-package-manager/Yarn2Proxy.ts
|
|
13822
13702
|
var import_fslib = __toESM(require_lib(), 1);
|
|
13823
13703
|
var import_libzip = __toESM(require_sync(), 1);
|
|
13824
|
-
import {
|
|
13825
|
-
import { join as
|
|
13704
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
13705
|
+
import { join as join15 } from "node:path";
|
|
13826
13706
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
13827
13707
|
import { prompt as prompt5 } from "storybook/internal/node-logger";
|
|
13828
13708
|
import { FindPackageVersionsError as FindPackageVersionsError5 } from "storybook/internal/server-errors";
|
|
@@ -13901,19 +13781,19 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13901
13781
|
getRemoteRunCommand(pkg, args, specifier) {
|
|
13902
13782
|
return `yarn dlx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13903
13783
|
}
|
|
13904
|
-
runPackageCommandSync(command, args,
|
|
13784
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13905
13785
|
return this.executeCommandSync({
|
|
13906
13786
|
command: "yarn",
|
|
13907
13787
|
args: ["exec", command, ...args],
|
|
13908
|
-
cwd
|
|
13788
|
+
cwd,
|
|
13909
13789
|
stdio
|
|
13910
13790
|
});
|
|
13911
13791
|
}
|
|
13912
|
-
runPackageCommand(command, args,
|
|
13913
|
-
return this.executeCommand({ command: "yarn", args: ["exec", command, ...args], cwd
|
|
13792
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13793
|
+
return this.executeCommand({ command: "yarn", args: ["exec", command, ...args], cwd, stdio });
|
|
13914
13794
|
}
|
|
13915
|
-
runInternalCommand(command, args,
|
|
13916
|
-
return this.executeCommand({ command: "yarn", args: [command, ...args], cwd
|
|
13795
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13796
|
+
return this.executeCommand({ command: "yarn", args: [command, ...args], cwd, stdio });
|
|
13917
13797
|
}
|
|
13918
13798
|
async findInstallations(pattern, { depth = 99 } = {}) {
|
|
13919
13799
|
const yarnArgs = ["info", "--name-only"];
|
|
@@ -13936,9 +13816,9 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13936
13816
|
}
|
|
13937
13817
|
}
|
|
13938
13818
|
async getModulePackageJSON(packageName) {
|
|
13939
|
-
const pnpapiPath =
|
|
13819
|
+
const pnpapiPath = any([".pnp.js", ".pnp.cjs"], {
|
|
13940
13820
|
cwd: this.cwd,
|
|
13941
|
-
|
|
13821
|
+
last: getProjectRoot()
|
|
13942
13822
|
});
|
|
13943
13823
|
if (pnpapiPath) {
|
|
13944
13824
|
try {
|
|
@@ -13957,7 +13837,7 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13957
13837
|
});
|
|
13958
13838
|
const virtualFs = new import_fslib.VirtualFS({ baseFs: zipOpenFs });
|
|
13959
13839
|
const crossFs = new import_fslib.PosixFS(virtualFs);
|
|
13960
|
-
const virtualPath =
|
|
13840
|
+
const virtualPath = join15(pkg.packageLocation, "package.json");
|
|
13961
13841
|
return crossFs.readJsonSync(virtualPath);
|
|
13962
13842
|
} catch (error) {
|
|
13963
13843
|
if (error.code !== "ERR_MODULE_NOT_FOUND") {
|
|
@@ -13966,13 +13846,11 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13966
13846
|
return null;
|
|
13967
13847
|
}
|
|
13968
13848
|
}
|
|
13969
|
-
const
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13975
|
-
);
|
|
13849
|
+
const wantedPath = join15("node_modules", packageName, "package.json");
|
|
13850
|
+
const packageJsonPath = up(wantedPath, {
|
|
13851
|
+
cwd: this.primaryPackageJson.operationDir,
|
|
13852
|
+
last: getProjectRoot()
|
|
13853
|
+
});
|
|
13976
13854
|
if (!packageJsonPath) {
|
|
13977
13855
|
return null;
|
|
13978
13856
|
}
|
|
@@ -14098,8 +13976,8 @@ var JsPackageManagerFactory = class {
|
|
|
14098
13976
|
this.cache = /* @__PURE__ */ new Map();
|
|
14099
13977
|
}
|
|
14100
13978
|
/** Generate a cache key based on the parameters */
|
|
14101
|
-
static getCacheKey(force, configDir = ".storybook",
|
|
14102
|
-
return JSON.stringify({ force: force || null, configDir, cwd
|
|
13979
|
+
static getCacheKey(force, configDir = ".storybook", cwd = process.cwd(), storiesPaths) {
|
|
13980
|
+
return JSON.stringify({ force: force || null, configDir, cwd, storiesPaths });
|
|
14103
13981
|
}
|
|
14104
13982
|
/** Clear the package manager cache */
|
|
14105
13983
|
static clearCache() {
|
|
@@ -14112,17 +13990,17 @@ var JsPackageManagerFactory = class {
|
|
|
14112
13990
|
* @returns Package manager type as string: 'npm', 'pnpm', 'bun', 'yarn1', or 'yarn2'
|
|
14113
13991
|
* @throws Error if no usable package manager is found
|
|
14114
13992
|
*/
|
|
14115
|
-
static getPackageManagerType(
|
|
13993
|
+
static getPackageManagerType(cwd = process.cwd()) {
|
|
14116
13994
|
const root = getProjectRoot();
|
|
14117
13995
|
const lockFiles = [
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
13996
|
+
up(YARN_LOCKFILE, { cwd, last: root }),
|
|
13997
|
+
up(PNPM_LOCKFILE, { cwd, last: root }),
|
|
13998
|
+
up(NPM_LOCKFILE, { cwd, last: root }),
|
|
13999
|
+
up(BUN_LOCKFILE, { cwd, last: root }),
|
|
14000
|
+
up(BUN_LOCKFILE_BINARY, { cwd, last: root })
|
|
14123
14001
|
].filter(Boolean).sort((a, b) => {
|
|
14124
|
-
const dirA =
|
|
14125
|
-
const dirB =
|
|
14002
|
+
const dirA = parse3(a).dir;
|
|
14003
|
+
const dirB = parse3(b).dir;
|
|
14126
14004
|
const compare = relative4(dirA, dirB);
|
|
14127
14005
|
if (dirA === dirB) {
|
|
14128
14006
|
return 0;
|
|
@@ -14134,18 +14012,18 @@ var JsPackageManagerFactory = class {
|
|
|
14134
14012
|
});
|
|
14135
14013
|
const closestLockfilePath = lockFiles[0];
|
|
14136
14014
|
const closestLockfile = closestLockfilePath && basename2(closestLockfilePath);
|
|
14137
|
-
const yarnVersion = getYarnVersion(
|
|
14015
|
+
const yarnVersion = getYarnVersion(cwd);
|
|
14138
14016
|
if (yarnVersion && closestLockfile === YARN_LOCKFILE) {
|
|
14139
14017
|
return yarnVersion === 1 ? "yarn1" : "yarn2";
|
|
14140
14018
|
}
|
|
14141
|
-
if (hasPNPM(
|
|
14019
|
+
if (hasPNPM(cwd) && closestLockfile === PNPM_LOCKFILE) {
|
|
14142
14020
|
return "pnpm";
|
|
14143
14021
|
}
|
|
14144
|
-
const isNPMCommandOk = hasNPM(
|
|
14022
|
+
const isNPMCommandOk = hasNPM(cwd);
|
|
14145
14023
|
if (isNPMCommandOk && closestLockfile === NPM_LOCKFILE) {
|
|
14146
14024
|
return "npm";
|
|
14147
14025
|
}
|
|
14148
|
-
if (hasBun(
|
|
14026
|
+
if (hasBun(cwd) && (closestLockfile === BUN_LOCKFILE || closestLockfile === BUN_LOCKFILE_BINARY)) {
|
|
14149
14027
|
return "bun";
|
|
14150
14028
|
}
|
|
14151
14029
|
const inferredPackageManager = this.inferPackageManagerFromUserAgent();
|
|
@@ -14162,19 +14040,19 @@ var JsPackageManagerFactory = class {
|
|
|
14162
14040
|
configDir = ".storybook",
|
|
14163
14041
|
storiesPaths,
|
|
14164
14042
|
ignoreCache = false
|
|
14165
|
-
} = {},
|
|
14166
|
-
const cacheKey = this.getCacheKey(force, configDir,
|
|
14043
|
+
} = {}, cwd = process.cwd()) {
|
|
14044
|
+
const cacheKey = this.getCacheKey(force, configDir, cwd, storiesPaths);
|
|
14167
14045
|
const cached = this.cache.get(cacheKey);
|
|
14168
14046
|
if (cached && !ignoreCache) {
|
|
14169
14047
|
return cached;
|
|
14170
14048
|
}
|
|
14171
14049
|
if (force && force in this.PROXY_MAP) {
|
|
14172
|
-
const packageManager2 = new this.PROXY_MAP[force]({ cwd
|
|
14050
|
+
const packageManager2 = new this.PROXY_MAP[force]({ cwd, configDir, storiesPaths });
|
|
14173
14051
|
this.cache.set(cacheKey, packageManager2);
|
|
14174
14052
|
return packageManager2;
|
|
14175
14053
|
}
|
|
14176
|
-
const packageManagerType = this.getPackageManagerType(
|
|
14177
|
-
const packageManager = new this.PROXY_MAP[packageManagerType]({ cwd
|
|
14054
|
+
const packageManagerType = this.getPackageManagerType(cwd);
|
|
14055
|
+
const packageManager = new this.PROXY_MAP[packageManagerType]({ cwd, configDir, storiesPaths });
|
|
14178
14056
|
this.cache.set(cacheKey, packageManager);
|
|
14179
14057
|
return packageManager;
|
|
14180
14058
|
}
|
|
@@ -14211,9 +14089,9 @@ var JsPackageManagerFactory = class {
|
|
|
14211
14089
|
return void 0;
|
|
14212
14090
|
}
|
|
14213
14091
|
};
|
|
14214
|
-
function hasNPM(
|
|
14215
|
-
const npmVersionCommand = (0, import_cross_spawn.sync)("npm
|
|
14216
|
-
cwd
|
|
14092
|
+
function hasNPM(cwd) {
|
|
14093
|
+
const npmVersionCommand = (0, import_cross_spawn.sync)("npm --version", {
|
|
14094
|
+
cwd,
|
|
14217
14095
|
shell: true,
|
|
14218
14096
|
env: {
|
|
14219
14097
|
...process.env,
|
|
@@ -14223,9 +14101,9 @@ function hasNPM(cwd2) {
|
|
|
14223
14101
|
return npmVersionCommand.status === 0;
|
|
14224
14102
|
}
|
|
14225
14103
|
__name(hasNPM, "hasNPM");
|
|
14226
|
-
function hasBun(
|
|
14227
|
-
const pnpmVersionCommand = (0, import_cross_spawn.sync)("bun
|
|
14228
|
-
cwd
|
|
14104
|
+
function hasBun(cwd) {
|
|
14105
|
+
const pnpmVersionCommand = (0, import_cross_spawn.sync)("bun --version", {
|
|
14106
|
+
cwd,
|
|
14229
14107
|
shell: true,
|
|
14230
14108
|
env: {
|
|
14231
14109
|
...process.env,
|
|
@@ -14235,9 +14113,9 @@ function hasBun(cwd2) {
|
|
|
14235
14113
|
return pnpmVersionCommand.status === 0;
|
|
14236
14114
|
}
|
|
14237
14115
|
__name(hasBun, "hasBun");
|
|
14238
|
-
function hasPNPM(
|
|
14239
|
-
const pnpmVersionCommand = (0, import_cross_spawn.sync)("pnpm
|
|
14240
|
-
cwd
|
|
14116
|
+
function hasPNPM(cwd) {
|
|
14117
|
+
const pnpmVersionCommand = (0, import_cross_spawn.sync)("pnpm --version", {
|
|
14118
|
+
cwd,
|
|
14241
14119
|
shell: true,
|
|
14242
14120
|
env: {
|
|
14243
14121
|
...process.env,
|
|
@@ -14247,9 +14125,9 @@ function hasPNPM(cwd2) {
|
|
|
14247
14125
|
return pnpmVersionCommand.status === 0;
|
|
14248
14126
|
}
|
|
14249
14127
|
__name(hasPNPM, "hasPNPM");
|
|
14250
|
-
function getYarnVersion(
|
|
14251
|
-
const yarnVersionCommand = (0, import_cross_spawn.sync)("yarn
|
|
14252
|
-
cwd
|
|
14128
|
+
function getYarnVersion(cwd) {
|
|
14129
|
+
const yarnVersionCommand = (0, import_cross_spawn.sync)("yarn --version", {
|
|
14130
|
+
cwd,
|
|
14253
14131
|
shell: true,
|
|
14254
14132
|
env: {
|
|
14255
14133
|
...process.env,
|
|
@@ -14281,7 +14159,7 @@ async function scanAndTransformFiles({
|
|
|
14281
14159
|
initial: defaultGlob
|
|
14282
14160
|
});
|
|
14283
14161
|
console.log("Scanning for affected files...");
|
|
14284
|
-
const globby = (await import("./globby-
|
|
14162
|
+
const globby = (await import("./globby-CJACC3HJ.js")).globby;
|
|
14285
14163
|
const sourceFiles = await globby([glob2], {
|
|
14286
14164
|
...commonGlobOptions(""),
|
|
14287
14165
|
ignore: ["**/node_modules/**"],
|
|
@@ -14295,12 +14173,12 @@ async function scanAndTransformFiles({
|
|
|
14295
14173
|
__name(scanAndTransformFiles, "scanAndTransformFiles");
|
|
14296
14174
|
|
|
14297
14175
|
// src/common/utils/transform-imports.ts
|
|
14298
|
-
import { readFile as
|
|
14176
|
+
import { readFile as readFile6, writeFile as writeFile4 } from "node:fs/promises";
|
|
14299
14177
|
function transformImports(source, renamedImports) {
|
|
14300
14178
|
let hasChanges = false;
|
|
14301
14179
|
let transformed = source;
|
|
14302
|
-
for (const [
|
|
14303
|
-
const regex = new RegExp(`(['"])${
|
|
14180
|
+
for (const [from2, to] of Object.entries(renamedImports)) {
|
|
14181
|
+
const regex = new RegExp(`(['"])${from2}(/.*)?\\1`, "g");
|
|
14304
14182
|
if (regex.test(transformed)) {
|
|
14305
14183
|
transformed = transformed.replace(regex, `$1${to}$2$1`);
|
|
14306
14184
|
hasChanges = true;
|
|
@@ -14311,16 +14189,16 @@ function transformImports(source, renamedImports) {
|
|
|
14311
14189
|
__name(transformImports, "transformImports");
|
|
14312
14190
|
var transformImportFiles = /* @__PURE__ */ __name(async (files, renamedImports, dryRun) => {
|
|
14313
14191
|
const errors = [];
|
|
14314
|
-
const { default: pLimit } = await import("./p-limit-
|
|
14192
|
+
const { default: pLimit } = await import("./p-limit-R2OFT5HE.js");
|
|
14315
14193
|
const limit = pLimit(10);
|
|
14316
14194
|
await Promise.all(
|
|
14317
14195
|
files.map(
|
|
14318
14196
|
(file) => limit(async () => {
|
|
14319
14197
|
try {
|
|
14320
|
-
const contents = await
|
|
14198
|
+
const contents = await readFile6(file, "utf-8");
|
|
14321
14199
|
const transformed = transformImports(contents, renamedImports);
|
|
14322
14200
|
if (!dryRun && transformed) {
|
|
14323
|
-
await
|
|
14201
|
+
await writeFile4(file, transformed);
|
|
14324
14202
|
}
|
|
14325
14203
|
} catch (error) {
|
|
14326
14204
|
errors.push({ file, error });
|
|
@@ -14333,6 +14211,7 @@ var transformImportFiles = /* @__PURE__ */ __name(async (files, renamedImports,
|
|
|
14333
14211
|
|
|
14334
14212
|
export {
|
|
14335
14213
|
userOrAutoTitleFromSpecifier,
|
|
14214
|
+
up2 as up,
|
|
14336
14215
|
supportedExtensions,
|
|
14337
14216
|
getInterpretedFile,
|
|
14338
14217
|
validateConfigurationFiles,
|
|
@@ -14344,7 +14223,7 @@ export {
|
|
|
14344
14223
|
FileSystemCache,
|
|
14345
14224
|
createFileSystemCache,
|
|
14346
14225
|
resolvePathInStorybookCache,
|
|
14347
|
-
cache,
|
|
14226
|
+
cache2 as cache,
|
|
14348
14227
|
HandledError,
|
|
14349
14228
|
COMMON_ENV_VARS,
|
|
14350
14229
|
getPackageDetails,
|
|
@@ -14397,7 +14276,7 @@ export {
|
|
|
14397
14276
|
validateFrameworkName,
|
|
14398
14277
|
satisfies2 as satisfies,
|
|
14399
14278
|
formatFileContent,
|
|
14400
|
-
|
|
14279
|
+
posix3 as posix,
|
|
14401
14280
|
getStoryId,
|
|
14402
14281
|
getStoryTitle,
|
|
14403
14282
|
getAddonNames,
|