storybook 10.0.0-beta.3 → 10.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_node-chunks/{builder-manager-DXAEQZJB.js → builder-manager-IKHPPPFE.js} +13 -13
- package/dist/_node-chunks/{camelcase-CMMT6PHY.js → camelcase-O2O7JODG.js} +7 -7
- package/dist/_node-chunks/{chunk-ICETGZAR.js → chunk-3J7DQ6TI.js} +7 -7
- package/dist/_node-chunks/{chunk-RUCPXDO3.js → chunk-4FMOVB65.js} +8 -8
- package/dist/_node-chunks/{chunk-EVY6P65U.js → chunk-4VGW2SQA.js} +7 -7
- package/dist/_node-chunks/{chunk-ICFGNVW7.js → chunk-5OILJTZE.js} +7 -7
- package/dist/_node-chunks/{chunk-4TGAX5W7.js → chunk-6COBULLV.js} +7 -7
- package/dist/_node-chunks/{chunk-EI44VA3U.js → chunk-7IIAUEWB.js} +8 -8
- package/dist/_node-chunks/{chunk-DNOOZ2LS.js → chunk-AC3BNULF.js} +552 -717
- package/dist/_node-chunks/{chunk-6Z44ODDR.js → chunk-AXFNB3AN.js} +7 -7
- package/dist/_node-chunks/chunk-CHJLO2LV.js +62 -0
- package/dist/_node-chunks/{chunk-PK6SVDYW.js → chunk-DCHFG5TX.js} +7 -7
- package/dist/_node-chunks/{chunk-R6TLLF24.js → chunk-FWFQ2GU7.js} +6 -6
- package/dist/_node-chunks/{chunk-3SUJKLRV.js → chunk-HAVE6SGK.js} +7 -7
- package/dist/_node-chunks/{chunk-CNKVQCQJ.js → chunk-IB5AEYPX.js} +7 -7
- package/dist/_node-chunks/{chunk-PAZJQ2GH.js → chunk-JECCFKKM.js} +7 -7
- package/dist/_node-chunks/{chunk-SHXAIHPO.js → chunk-JP4LEAXM.js} +7 -7
- package/dist/_node-chunks/chunk-JSSBBVU5.js +79 -0
- package/dist/_node-chunks/chunk-MNG223PY.js +18 -0
- package/dist/_node-chunks/{chunk-XRAB2RZN.js → chunk-MOO2Y4GI.js} +6 -6
- package/dist/_node-chunks/{chunk-7EGB7ALG.js → chunk-N3GFXZDP.js} +7 -7
- package/dist/_node-chunks/{chunk-AKW5OJ2T.js → chunk-NF3GXIEK.js} +9 -9
- package/dist/_node-chunks/{chunk-BV4J7FF6.js → chunk-NOSGJ5PL.js} +7 -7
- package/dist/_node-chunks/{chunk-WRSYICUI.js → chunk-OL2HWCBH.js} +7 -7
- package/dist/_node-chunks/{chunk-KQXC7XVZ.js → chunk-SF2IETZ2.js} +29 -81
- package/dist/_node-chunks/{chunk-LRQFELIZ.js → chunk-TBAIXCHN.js} +8 -8
- package/dist/_node-chunks/{chunk-QI3AVWUV.js → chunk-TTQRDWDJ.js} +12 -12
- package/dist/_node-chunks/{chunk-MVPVYHBT.js → chunk-TYGVOW7L.js} +7 -7
- package/dist/_node-chunks/{chunk-IA7M33LK.js → chunk-USDZSU5L.js} +7 -7
- package/dist/_node-chunks/chunk-XA4TAMUS.js +4966 -0
- package/dist/_node-chunks/{chunk-PA26PSV2.js → chunk-XT6O5CVI.js} +7 -7
- package/dist/_node-chunks/{chunk-TL5RNPZW.js → chunk-YJHXEN7U.js} +10 -10
- package/dist/_node-chunks/{chunk-5XVEWBRA.js → chunk-YRPXGWKW.js} +8 -8
- package/dist/_node-chunks/{default-browser-id-2X5XLPPS.js → default-browser-id-J4OIAAJ5.js} +7 -7
- package/dist/_node-chunks/{dist-JSBOOVQK.js → dist-BMKSKYDI.js} +9 -9
- package/dist/_node-chunks/{globby-YYTLHNUO.js → globby-DASPUXWI.js} +9 -9
- package/dist/_node-chunks/{lib-DJHADRPZ.js → lib-L6BIH4EV.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-WT6XCDU6.js → mdx-N42X6CFJ-2COTUDSL.js} +8 -8
- package/dist/_node-chunks/{p-limit-HTXI4SGX.js → p-limit-HVR3I7TJ.js} +76 -10
- package/dist/_node-chunks/{plugin-NNRMQ2YK.js → plugin-2XPSFYWZ.js} +10 -10
- package/dist/_node-chunks/{plugin-W22F3FQV.js → plugin-FZOHPRK7.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-VFNVWMAM.js → webpack-inject-mocker-runtime-plugin-FGQM2EPC.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-Q4ED2M25.js → webpack-mock-plugin-4HOAIYSX.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +29 -30
- package/dist/common/index.d.ts +3 -1
- package/dist/common/index.js +23 -22
- package/dist/core-server/index.js +38 -39
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +22 -22
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.js +13 -14
- package/dist/preview-api/index.d.ts +67 -68
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -25
- package/package.json +2 -6
- package/dist/_node-chunks/chunk-ALWVSNSK.js +0 -62
- package/dist/_node-chunks/chunk-MHNUEOON.js +0 -87
- package/dist/_node-chunks/chunk-VDFQYNPZ.js +0 -266
- package/dist/_node-chunks/chunk-WELIADWR.js +0 -2377
- package/dist/_node-chunks/chunk-YRXKNGPR.js +0 -18
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bdftjtsviyb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bdftjtsviyb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bdftjtsviyb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bdftjtsviyb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bdftjtsviyb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bdftjtsviyb.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-
|
|
14
|
+
} from "./chunk-JECCFKKM.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveModulePath
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5OILJTZE.js";
|
|
18
18
|
import {
|
|
19
19
|
versions_default
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CHJLO2LV.js";
|
|
21
21
|
import {
|
|
22
22
|
BUN_LOCKFILE,
|
|
23
23
|
BUN_LOCKFILE_BINARY,
|
|
@@ -26,45 +26,45 @@ import {
|
|
|
26
26
|
YARN_LOCKFILE,
|
|
27
27
|
execa,
|
|
28
28
|
execaCommandSync,
|
|
29
|
+
findFilesUp,
|
|
29
30
|
getProjectRoot,
|
|
30
31
|
normalizeStoryPath,
|
|
31
32
|
require_cross_spawn
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XA4TAMUS.js";
|
|
33
34
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} from "./chunk-VDFQYNPZ.js";
|
|
35
|
+
any,
|
|
36
|
+
from,
|
|
37
|
+
up2 as up
|
|
38
|
+
} from "./chunk-JSSBBVU5.js";
|
|
39
39
|
import {
|
|
40
40
|
invariant
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-USDZSU5L.js";
|
|
42
42
|
import {
|
|
43
43
|
importModule,
|
|
44
44
|
resolvePackageDir,
|
|
45
45
|
safeResolveModule
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TBAIXCHN.js";
|
|
47
47
|
import {
|
|
48
48
|
join,
|
|
49
49
|
parse,
|
|
50
50
|
resolve
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-4VGW2SQA.js";
|
|
52
52
|
import {
|
|
53
53
|
require_prompts
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-3J7DQ6TI.js";
|
|
55
55
|
import {
|
|
56
56
|
glob,
|
|
57
57
|
globSync
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-TYGVOW7L.js";
|
|
59
59
|
import {
|
|
60
60
|
slash
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-OL2HWCBH.js";
|
|
62
62
|
import {
|
|
63
63
|
require_dist
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-NOSGJ5PL.js";
|
|
65
65
|
import {
|
|
66
66
|
require_picocolors
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-N3GFXZDP.js";
|
|
68
68
|
import {
|
|
69
69
|
__commonJS,
|
|
70
70
|
__esm,
|
|
@@ -73,84 +73,7 @@ import {
|
|
|
73
73
|
__require,
|
|
74
74
|
__toCommonJS,
|
|
75
75
|
__toESM
|
|
76
|
-
} from "./chunk-
|
|
77
|
-
|
|
78
|
-
// ../node_modules/common-path-prefix/index.js
|
|
79
|
-
var require_common_path_prefix = __commonJS({
|
|
80
|
-
"../node_modules/common-path-prefix/index.js"(exports, module) {
|
|
81
|
-
"use strict";
|
|
82
|
-
var { sep: DEFAULT_SEPARATOR } = __require("path");
|
|
83
|
-
var determineSeparator = /* @__PURE__ */ __name((paths) => {
|
|
84
|
-
for (const path4 of paths) {
|
|
85
|
-
const match = /(\/|\\)/.exec(path4);
|
|
86
|
-
if (match !== null) return match[0];
|
|
87
|
-
}
|
|
88
|
-
return DEFAULT_SEPARATOR;
|
|
89
|
-
}, "determineSeparator");
|
|
90
|
-
module.exports = /* @__PURE__ */ __name(function commonPathPrefix2(paths, sep3 = determineSeparator(paths)) {
|
|
91
|
-
const [first = "", ...remaining] = paths;
|
|
92
|
-
if (first === "" || remaining.length === 0) return "";
|
|
93
|
-
const parts = first.split(sep3);
|
|
94
|
-
let endOfPrefix = parts.length;
|
|
95
|
-
for (const path4 of remaining) {
|
|
96
|
-
const compare = path4.split(sep3);
|
|
97
|
-
for (let i = 0; i < endOfPrefix; i++) {
|
|
98
|
-
if (compare[i] !== parts[i]) {
|
|
99
|
-
endOfPrefix = i;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (endOfPrefix === 0) return "";
|
|
103
|
-
}
|
|
104
|
-
const prefix = parts.slice(0, endOfPrefix).join(sep3);
|
|
105
|
-
return prefix.endsWith(sep3) ? prefix : prefix + sep3;
|
|
106
|
-
}, "commonPathPrefix");
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// ../node_modules/resolve-from/index.js
|
|
111
|
-
var require_resolve_from = __commonJS({
|
|
112
|
-
"../node_modules/resolve-from/index.js"(exports, module) {
|
|
113
|
-
"use strict";
|
|
114
|
-
var path4 = __require("path");
|
|
115
|
-
var Module = __require("module");
|
|
116
|
-
var fs2 = __require("fs");
|
|
117
|
-
var resolveFrom2 = /* @__PURE__ */ __name((fromDirectory, moduleId, silent) => {
|
|
118
|
-
if (typeof fromDirectory !== "string") {
|
|
119
|
-
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
|
|
120
|
-
}
|
|
121
|
-
if (typeof moduleId !== "string") {
|
|
122
|
-
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
fromDirectory = fs2.realpathSync(fromDirectory);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
if (error.code === "ENOENT") {
|
|
128
|
-
fromDirectory = path4.resolve(fromDirectory);
|
|
129
|
-
} else if (silent) {
|
|
130
|
-
return;
|
|
131
|
-
} else {
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const fromFile = path4.join(fromDirectory, "noop.js");
|
|
136
|
-
const resolveFileName = /* @__PURE__ */ __name(() => Module._resolveFilename(moduleId, {
|
|
137
|
-
id: fromFile,
|
|
138
|
-
filename: fromFile,
|
|
139
|
-
paths: Module._nodeModulePaths(fromDirectory)
|
|
140
|
-
}), "resolveFileName");
|
|
141
|
-
if (silent) {
|
|
142
|
-
try {
|
|
143
|
-
return resolveFileName();
|
|
144
|
-
} catch (error) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return resolveFileName();
|
|
149
|
-
}, "resolveFrom");
|
|
150
|
-
module.exports = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId);
|
|
151
|
-
module.exports.silent = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId, true);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
76
|
+
} from "./chunk-MOO2Y4GI.js";
|
|
154
77
|
|
|
155
78
|
// ../node_modules/@yarnpkg/fslib/node_modules/tslib/tslib.es6.js
|
|
156
79
|
var tslib_es6_exports = {};
|
|
@@ -819,23 +742,23 @@ var require_path = __commonJS({
|
|
|
819
742
|
return path_1.default.posix.resolve(exports.ppath.cwd(), ...segments);
|
|
820
743
|
}
|
|
821
744
|
};
|
|
822
|
-
var contains = /* @__PURE__ */ __name(function(pathUtils,
|
|
823
|
-
|
|
745
|
+
var contains = /* @__PURE__ */ __name(function(pathUtils, from2, to) {
|
|
746
|
+
from2 = pathUtils.normalize(from2);
|
|
824
747
|
to = pathUtils.normalize(to);
|
|
825
|
-
if (
|
|
748
|
+
if (from2 === to)
|
|
826
749
|
return `.`;
|
|
827
|
-
if (!
|
|
828
|
-
|
|
829
|
-
if (to.startsWith(
|
|
830
|
-
return to.slice(
|
|
750
|
+
if (!from2.endsWith(pathUtils.sep))
|
|
751
|
+
from2 = from2 + pathUtils.sep;
|
|
752
|
+
if (to.startsWith(from2)) {
|
|
753
|
+
return to.slice(from2.length);
|
|
831
754
|
} else {
|
|
832
755
|
return null;
|
|
833
756
|
}
|
|
834
757
|
}, "contains");
|
|
835
758
|
exports.npath.fromPortablePath = fromPortablePath;
|
|
836
759
|
exports.npath.toPortablePath = toPortablePath;
|
|
837
|
-
exports.npath.contains = (
|
|
838
|
-
exports.ppath.contains = (
|
|
760
|
+
exports.npath.contains = (from2, to) => contains(exports.npath, from2, to);
|
|
761
|
+
exports.ppath.contains = (from2, to) => contains(exports.ppath, from2, to);
|
|
839
762
|
var WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
|
|
840
763
|
var UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
|
|
841
764
|
var PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
|
|
@@ -888,9 +811,9 @@ var require_copyPromise = __commonJS({
|
|
|
888
811
|
exports.copyPromise = exports.LinkStrategy = void 0;
|
|
889
812
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
890
813
|
var fs_1 = tslib_1.__importDefault(__require("fs"));
|
|
891
|
-
var
|
|
814
|
+
var constants2 = tslib_1.__importStar(require_constants());
|
|
892
815
|
var path_1 = require_path();
|
|
893
|
-
var defaultTime = new Date(
|
|
816
|
+
var defaultTime = new Date(constants2.SAFE_TIME * 1e3);
|
|
894
817
|
var LinkStrategy;
|
|
895
818
|
(function(LinkStrategy2) {
|
|
896
819
|
LinkStrategy2["Allow"] = "allow";
|
|
@@ -1167,8 +1090,8 @@ var require_opendir = __commonJS({
|
|
|
1167
1090
|
static {
|
|
1168
1091
|
__name(this, "CustomDir");
|
|
1169
1092
|
}
|
|
1170
|
-
constructor(
|
|
1171
|
-
this.path =
|
|
1093
|
+
constructor(path, nextDirent, opts = {}) {
|
|
1094
|
+
this.path = path;
|
|
1172
1095
|
this.nextDirent = nextDirent;
|
|
1173
1096
|
this.opts = opts;
|
|
1174
1097
|
this.closed = false;
|
|
@@ -1212,16 +1135,16 @@ var require_opendir = __commonJS({
|
|
|
1212
1135
|
}
|
|
1213
1136
|
};
|
|
1214
1137
|
exports.CustomDir = CustomDir;
|
|
1215
|
-
function opendir(fakeFs,
|
|
1138
|
+
function opendir(fakeFs, path, entries, opts) {
|
|
1216
1139
|
const nextDirent = /* @__PURE__ */ __name(() => {
|
|
1217
1140
|
const filename = entries.shift();
|
|
1218
1141
|
if (typeof filename === `undefined`)
|
|
1219
1142
|
return null;
|
|
1220
|
-
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(
|
|
1143
|
+
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(path, filename)), {
|
|
1221
1144
|
name: filename
|
|
1222
1145
|
});
|
|
1223
1146
|
}, "nextDirent");
|
|
1224
|
-
return new CustomDir(
|
|
1147
|
+
return new CustomDir(path, nextDirent, opts);
|
|
1225
1148
|
}
|
|
1226
1149
|
__name(opendir, "opendir");
|
|
1227
1150
|
exports.opendir = opendir;
|
|
@@ -1726,8 +1649,8 @@ var require_NodeFS = __commonJS({
|
|
|
1726
1649
|
async realpathPromise(p) {
|
|
1727
1650
|
return await new Promise((resolve8, reject) => {
|
|
1728
1651
|
this.realFs.realpath(path_1.npath.fromPortablePath(p), {}, this.makeCallback(resolve8, reject));
|
|
1729
|
-
}).then((
|
|
1730
|
-
return path_1.npath.toPortablePath(
|
|
1652
|
+
}).then((path) => {
|
|
1653
|
+
return path_1.npath.toPortablePath(path);
|
|
1731
1654
|
});
|
|
1732
1655
|
}
|
|
1733
1656
|
realpathSync(p) {
|
|
@@ -1976,8 +1899,8 @@ var require_NodeFS = __commonJS({
|
|
|
1976
1899
|
async readlinkPromise(p) {
|
|
1977
1900
|
return await new Promise((resolve8, reject) => {
|
|
1978
1901
|
this.realFs.readlink(path_1.npath.fromPortablePath(p), this.makeCallback(resolve8, reject));
|
|
1979
|
-
}).then((
|
|
1980
|
-
return path_1.npath.toPortablePath(
|
|
1902
|
+
}).then((path) => {
|
|
1903
|
+
return path_1.npath.toPortablePath(path);
|
|
1981
1904
|
});
|
|
1982
1905
|
}
|
|
1983
1906
|
readlinkSync(p) {
|
|
@@ -2063,18 +1986,18 @@ var require_CustomStatWatcher = __commonJS({
|
|
|
2063
1986
|
static {
|
|
2064
1987
|
__name(this, "CustomStatWatcher");
|
|
2065
1988
|
}
|
|
2066
|
-
static create(fakeFs,
|
|
2067
|
-
const statWatcher = new _CustomStatWatcher(fakeFs,
|
|
1989
|
+
static create(fakeFs, path, opts) {
|
|
1990
|
+
const statWatcher = new _CustomStatWatcher(fakeFs, path, opts);
|
|
2068
1991
|
statWatcher.start();
|
|
2069
1992
|
return statWatcher;
|
|
2070
1993
|
}
|
|
2071
|
-
constructor(fakeFs,
|
|
1994
|
+
constructor(fakeFs, path, { bigint = false } = {}) {
|
|
2072
1995
|
super();
|
|
2073
1996
|
this.status = Status.Ready;
|
|
2074
1997
|
this.changeListeners = /* @__PURE__ */ new Map();
|
|
2075
1998
|
this.startTimeout = null;
|
|
2076
1999
|
this.fakeFs = fakeFs;
|
|
2077
|
-
this.path =
|
|
2000
|
+
this.path = path;
|
|
2078
2001
|
this.bigint = bigint;
|
|
2079
2002
|
this.lastStats = this.stat();
|
|
2080
2003
|
}
|
|
@@ -2178,7 +2101,7 @@ var require_watchFile = __commonJS({
|
|
|
2178
2101
|
exports.unwatchAllFiles = exports.unwatchFile = exports.watchFile = void 0;
|
|
2179
2102
|
var CustomStatWatcher_1 = require_CustomStatWatcher();
|
|
2180
2103
|
var statWatchersByFakeFS = /* @__PURE__ */ new WeakMap();
|
|
2181
|
-
function watchFile(fakeFs,
|
|
2104
|
+
function watchFile(fakeFs, path, a, b) {
|
|
2182
2105
|
let bigint;
|
|
2183
2106
|
let persistent;
|
|
2184
2107
|
let interval;
|
|
@@ -2206,21 +2129,21 @@ var require_watchFile = __commonJS({
|
|
|
2206
2129
|
let statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2207
2130
|
if (typeof statWatchers === `undefined`)
|
|
2208
2131
|
statWatchersByFakeFS.set(fakeFs, statWatchers = /* @__PURE__ */ new Map());
|
|
2209
|
-
let statWatcher = statWatchers.get(
|
|
2132
|
+
let statWatcher = statWatchers.get(path);
|
|
2210
2133
|
if (typeof statWatcher === `undefined`) {
|
|
2211
|
-
statWatcher = CustomStatWatcher_1.CustomStatWatcher.create(fakeFs,
|
|
2212
|
-
statWatchers.set(
|
|
2134
|
+
statWatcher = CustomStatWatcher_1.CustomStatWatcher.create(fakeFs, path, { bigint });
|
|
2135
|
+
statWatchers.set(path, statWatcher);
|
|
2213
2136
|
}
|
|
2214
2137
|
statWatcher.registerChangeListener(listener, { persistent, interval });
|
|
2215
2138
|
return statWatcher;
|
|
2216
2139
|
}
|
|
2217
2140
|
__name(watchFile, "watchFile");
|
|
2218
2141
|
exports.watchFile = watchFile;
|
|
2219
|
-
function unwatchFile(fakeFs,
|
|
2142
|
+
function unwatchFile(fakeFs, path, cb) {
|
|
2220
2143
|
const statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2221
2144
|
if (typeof statWatchers === `undefined`)
|
|
2222
2145
|
return;
|
|
2223
|
-
const statWatcher = statWatchers.get(
|
|
2146
|
+
const statWatcher = statWatchers.get(path);
|
|
2224
2147
|
if (typeof statWatcher === `undefined`)
|
|
2225
2148
|
return;
|
|
2226
2149
|
if (typeof cb === `undefined`)
|
|
@@ -2229,7 +2152,7 @@ var require_watchFile = __commonJS({
|
|
|
2229
2152
|
statWatcher.unregisterChangeListener(cb);
|
|
2230
2153
|
if (!statWatcher.hasChangeListeners()) {
|
|
2231
2154
|
statWatcher.stop();
|
|
2232
|
-
statWatchers.delete(
|
|
2155
|
+
statWatchers.delete(path);
|
|
2233
2156
|
}
|
|
2234
2157
|
}
|
|
2235
2158
|
__name(unwatchFile, "unwatchFile");
|
|
@@ -2238,8 +2161,8 @@ var require_watchFile = __commonJS({
|
|
|
2238
2161
|
const statWatchers = statWatchersByFakeFS.get(fakeFs);
|
|
2239
2162
|
if (typeof statWatchers === `undefined`)
|
|
2240
2163
|
return;
|
|
2241
|
-
for (const
|
|
2242
|
-
unwatchFile(fakeFs,
|
|
2164
|
+
for (const path of statWatchers.keys()) {
|
|
2165
|
+
unwatchFile(fakeFs, path);
|
|
2243
2166
|
}
|
|
2244
2167
|
}
|
|
2245
2168
|
__name(unwatchAllFiles, "unwatchAllFiles");
|
|
@@ -3079,10 +3002,10 @@ var require_ZipFS = __commonJS({
|
|
|
3079
3002
|
}
|
|
3080
3003
|
fdToPath(fd, reason) {
|
|
3081
3004
|
var _a;
|
|
3082
|
-
const
|
|
3083
|
-
if (typeof
|
|
3005
|
+
const path = (_a = this.fds.get(fd)) === null || _a === void 0 ? void 0 : _a.p;
|
|
3006
|
+
if (typeof path === `undefined`)
|
|
3084
3007
|
throw errors.EBADF(reason);
|
|
3085
|
-
return
|
|
3008
|
+
return path;
|
|
3086
3009
|
}
|
|
3087
3010
|
async writeFilePromise(p, content, opts) {
|
|
3088
3011
|
const { encoding, mode, index, resolvedP } = this.prepareWriteFile(p, opts);
|
|
@@ -3397,8 +3320,8 @@ var require_ProxiedFS = __commonJS({
|
|
|
3397
3320
|
getExtractHint(hints) {
|
|
3398
3321
|
return this.baseFs.getExtractHint(hints);
|
|
3399
3322
|
}
|
|
3400
|
-
resolve(
|
|
3401
|
-
return this.mapFromBase(this.baseFs.resolve(this.mapToBase(
|
|
3323
|
+
resolve(path) {
|
|
3324
|
+
return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));
|
|
3402
3325
|
}
|
|
3403
3326
|
getRealPath() {
|
|
3404
3327
|
return this.mapFromBase(this.baseFs.getRealPath());
|
|
@@ -3707,14 +3630,14 @@ var require_CwdFS = __commonJS({
|
|
|
3707
3630
|
return this.baseFs.resolve(path_1.ppath.join(this.target, p));
|
|
3708
3631
|
}
|
|
3709
3632
|
}
|
|
3710
|
-
mapFromBase(
|
|
3711
|
-
return
|
|
3633
|
+
mapFromBase(path) {
|
|
3634
|
+
return path;
|
|
3712
3635
|
}
|
|
3713
|
-
mapToBase(
|
|
3714
|
-
if (this.pathUtils.isAbsolute(
|
|
3715
|
-
return
|
|
3636
|
+
mapToBase(path) {
|
|
3637
|
+
if (this.pathUtils.isAbsolute(path)) {
|
|
3638
|
+
return path;
|
|
3716
3639
|
} else {
|
|
3717
|
-
return this.pathUtils.join(this.target,
|
|
3640
|
+
return this.pathUtils.join(this.target, path);
|
|
3718
3641
|
}
|
|
3719
3642
|
}
|
|
3720
3643
|
};
|
|
@@ -4043,11 +3966,11 @@ var require_PosixFS = __commonJS({
|
|
|
4043
3966
|
super(path_1.npath);
|
|
4044
3967
|
this.baseFs = baseFs;
|
|
4045
3968
|
}
|
|
4046
|
-
mapFromBase(
|
|
4047
|
-
return path_1.npath.fromPortablePath(
|
|
3969
|
+
mapFromBase(path) {
|
|
3970
|
+
return path_1.npath.fromPortablePath(path);
|
|
4048
3971
|
}
|
|
4049
|
-
mapToBase(
|
|
4050
|
-
return path_1.npath.toPortablePath(
|
|
3972
|
+
mapToBase(path) {
|
|
3973
|
+
return path_1.npath.toPortablePath(path);
|
|
4051
3974
|
}
|
|
4052
3975
|
};
|
|
4053
3976
|
exports.PosixFS = PosixFS2;
|
|
@@ -4160,22 +4083,22 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4160
4083
|
var path_1 = require_path();
|
|
4161
4084
|
var ZIP_MASK = 4278190080;
|
|
4162
4085
|
var ZIP_MAGIC = 704643072;
|
|
4163
|
-
var getArchivePart = /* @__PURE__ */ __name((
|
|
4164
|
-
let idx =
|
|
4086
|
+
var getArchivePart = /* @__PURE__ */ __name((path, extension) => {
|
|
4087
|
+
let idx = path.indexOf(extension);
|
|
4165
4088
|
if (idx <= 0)
|
|
4166
4089
|
return null;
|
|
4167
4090
|
let nextCharIdx = idx;
|
|
4168
4091
|
while (idx >= 0) {
|
|
4169
4092
|
nextCharIdx = idx + extension.length;
|
|
4170
|
-
if (
|
|
4093
|
+
if (path[nextCharIdx] === path_1.ppath.sep)
|
|
4171
4094
|
break;
|
|
4172
|
-
if (
|
|
4095
|
+
if (path[idx - 1] === path_1.ppath.sep)
|
|
4173
4096
|
return null;
|
|
4174
|
-
idx =
|
|
4097
|
+
idx = path.indexOf(extension, nextCharIdx);
|
|
4175
4098
|
}
|
|
4176
|
-
if (
|
|
4099
|
+
if (path.length > nextCharIdx && path[nextCharIdx] !== path_1.ppath.sep)
|
|
4177
4100
|
return null;
|
|
4178
|
-
return
|
|
4101
|
+
return path.slice(0, nextCharIdx);
|
|
4179
4102
|
}, "getArchivePart");
|
|
4180
4103
|
exports.getArchivePart = getArchivePart;
|
|
4181
4104
|
var ZipOpenFS2 = class _ZipOpenFS extends FakeFS_1.BasePortableFakeFS {
|
|
@@ -4221,18 +4144,18 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4221
4144
|
saveAndClose() {
|
|
4222
4145
|
(0, watchFile_1.unwatchAllFiles)(this);
|
|
4223
4146
|
if (this.zipInstances) {
|
|
4224
|
-
for (const [
|
|
4147
|
+
for (const [path, { zipFs }] of this.zipInstances.entries()) {
|
|
4225
4148
|
zipFs.saveAndClose();
|
|
4226
|
-
this.zipInstances.delete(
|
|
4149
|
+
this.zipInstances.delete(path);
|
|
4227
4150
|
}
|
|
4228
4151
|
}
|
|
4229
4152
|
}
|
|
4230
4153
|
discardAndClose() {
|
|
4231
4154
|
(0, watchFile_1.unwatchAllFiles)(this);
|
|
4232
4155
|
if (this.zipInstances) {
|
|
4233
|
-
for (const [
|
|
4156
|
+
for (const [path, { zipFs }] of this.zipInstances.entries()) {
|
|
4234
4157
|
zipFs.discardAndClose();
|
|
4235
|
-
this.zipInstances.delete(
|
|
4158
|
+
this.zipInstances.delete(path);
|
|
4236
4159
|
}
|
|
4237
4160
|
}
|
|
4238
4161
|
}
|
|
@@ -4937,12 +4860,12 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4937
4860
|
const now = Date.now();
|
|
4938
4861
|
let nextExpiresAt = now + this.maxAge;
|
|
4939
4862
|
let closeCount = max === null ? 0 : this.zipInstances.size - max;
|
|
4940
|
-
for (const [
|
|
4863
|
+
for (const [path, { zipFs, expiresAt, refCount }] of this.zipInstances.entries()) {
|
|
4941
4864
|
if (refCount !== 0 || zipFs.hasOpenFileHandles()) {
|
|
4942
4865
|
continue;
|
|
4943
4866
|
} else if (now >= expiresAt) {
|
|
4944
4867
|
zipFs.saveAndClose();
|
|
4945
|
-
this.zipInstances.delete(
|
|
4868
|
+
this.zipInstances.delete(path);
|
|
4946
4869
|
closeCount -= 1;
|
|
4947
4870
|
continue;
|
|
4948
4871
|
} else if (max === null || closeCount <= 0) {
|
|
@@ -4950,7 +4873,7 @@ var require_ZipOpenFS = __commonJS({
|
|
|
4950
4873
|
break;
|
|
4951
4874
|
}
|
|
4952
4875
|
zipFs.saveAndClose();
|
|
4953
|
-
this.zipInstances.delete(
|
|
4876
|
+
this.zipInstances.delete(path);
|
|
4954
4877
|
closeCount -= 1;
|
|
4955
4878
|
}
|
|
4956
4879
|
if (this.limitOpenFilesTimeout === null && (max === null && this.zipInstances.size > 0 || max !== null)) {
|
|
@@ -5052,21 +4975,21 @@ var require_NodePathFS = __commonJS({
|
|
|
5052
4975
|
super(path_1.npath);
|
|
5053
4976
|
this.baseFs = baseFs;
|
|
5054
4977
|
}
|
|
5055
|
-
mapFromBase(
|
|
5056
|
-
return
|
|
5057
|
-
}
|
|
5058
|
-
mapToBase(
|
|
5059
|
-
if (typeof
|
|
5060
|
-
return
|
|
5061
|
-
if (
|
|
5062
|
-
return (0, url_1.fileURLToPath)(
|
|
5063
|
-
if (Buffer.isBuffer(
|
|
5064
|
-
const str =
|
|
5065
|
-
if (Buffer.byteLength(str) !==
|
|
4978
|
+
mapFromBase(path) {
|
|
4979
|
+
return path;
|
|
4980
|
+
}
|
|
4981
|
+
mapToBase(path) {
|
|
4982
|
+
if (typeof path === `string`)
|
|
4983
|
+
return path;
|
|
4984
|
+
if (path instanceof url_1.URL)
|
|
4985
|
+
return (0, url_1.fileURLToPath)(path);
|
|
4986
|
+
if (Buffer.isBuffer(path)) {
|
|
4987
|
+
const str = path.toString();
|
|
4988
|
+
if (Buffer.byteLength(str) !== path.byteLength)
|
|
5066
4989
|
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`);
|
|
5067
4990
|
return str;
|
|
5068
4991
|
}
|
|
5069
|
-
throw new Error(`Unsupported path type: ${(0, util_1.inspect)(
|
|
4992
|
+
throw new Error(`Unsupported path type: ${(0, util_1.inspect)(path)}`);
|
|
5070
4993
|
}
|
|
5071
4994
|
};
|
|
5072
4995
|
exports.NodePathFS = NodePathFS;
|
|
@@ -5689,8 +5612,8 @@ var require_lib = __commonJS({
|
|
|
5689
5612
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5690
5613
|
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;
|
|
5691
5614
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
5692
|
-
var
|
|
5693
|
-
exports.constants =
|
|
5615
|
+
var constants2 = tslib_1.__importStar(require_constants());
|
|
5616
|
+
exports.constants = constants2;
|
|
5694
5617
|
var statUtils = tslib_1.__importStar(require_statUtils());
|
|
5695
5618
|
exports.statUtils = statUtils;
|
|
5696
5619
|
var copyPromise_1 = require_copyPromise();
|
|
@@ -6186,11 +6109,11 @@ var require_libzipSync = __commonJS({
|
|
|
6186
6109
|
var ENVIRONMENT_IS_WORKER = false;
|
|
6187
6110
|
var ENVIRONMENT_IS_NODE = true;
|
|
6188
6111
|
var scriptDirectory = "";
|
|
6189
|
-
function locateFile(
|
|
6112
|
+
function locateFile(path) {
|
|
6190
6113
|
if (Module["locateFile"]) {
|
|
6191
|
-
return Module["locateFile"](
|
|
6114
|
+
return Module["locateFile"](path, scriptDirectory);
|
|
6192
6115
|
}
|
|
6193
|
-
return scriptDirectory +
|
|
6116
|
+
return scriptDirectory + path;
|
|
6194
6117
|
}
|
|
6195
6118
|
__name(locateFile, "locateFile");
|
|
6196
6119
|
var read_, readBinary;
|
|
@@ -6704,44 +6627,44 @@ var require_libzipSync = __commonJS({
|
|
|
6704
6627
|
return splitPathRe.exec(filename).slice(1);
|
|
6705
6628
|
}, "splitPath"),
|
|
6706
6629
|
normalizeArray: /* @__PURE__ */ __name(function(parts, allowAboveRoot) {
|
|
6707
|
-
var
|
|
6630
|
+
var up3 = 0;
|
|
6708
6631
|
for (var i = parts.length - 1; i >= 0; i--) {
|
|
6709
6632
|
var last = parts[i];
|
|
6710
6633
|
if (last === ".") {
|
|
6711
6634
|
parts.splice(i, 1);
|
|
6712
6635
|
} else if (last === "..") {
|
|
6713
6636
|
parts.splice(i, 1);
|
|
6714
|
-
|
|
6715
|
-
} else if (
|
|
6637
|
+
up3++;
|
|
6638
|
+
} else if (up3) {
|
|
6716
6639
|
parts.splice(i, 1);
|
|
6717
|
-
|
|
6640
|
+
up3--;
|
|
6718
6641
|
}
|
|
6719
6642
|
}
|
|
6720
6643
|
if (allowAboveRoot) {
|
|
6721
|
-
for (;
|
|
6644
|
+
for (; up3; up3--) {
|
|
6722
6645
|
parts.unshift("..");
|
|
6723
6646
|
}
|
|
6724
6647
|
}
|
|
6725
6648
|
return parts;
|
|
6726
6649
|
}, "normalizeArray"),
|
|
6727
|
-
normalize: /* @__PURE__ */ __name(function(
|
|
6728
|
-
var isAbsolute2 =
|
|
6729
|
-
|
|
6730
|
-
|
|
6650
|
+
normalize: /* @__PURE__ */ __name(function(path) {
|
|
6651
|
+
var isAbsolute2 = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/";
|
|
6652
|
+
path = PATH.normalizeArray(
|
|
6653
|
+
path.split("/").filter(function(p) {
|
|
6731
6654
|
return !!p;
|
|
6732
6655
|
}),
|
|
6733
6656
|
!isAbsolute2
|
|
6734
6657
|
).join("/");
|
|
6735
|
-
if (!
|
|
6736
|
-
|
|
6658
|
+
if (!path && !isAbsolute2) {
|
|
6659
|
+
path = ".";
|
|
6737
6660
|
}
|
|
6738
|
-
if (
|
|
6739
|
-
|
|
6661
|
+
if (path && trailingSlash) {
|
|
6662
|
+
path += "/";
|
|
6740
6663
|
}
|
|
6741
|
-
return (isAbsolute2 ? "/" : "") +
|
|
6664
|
+
return (isAbsolute2 ? "/" : "") + path;
|
|
6742
6665
|
}, "normalize"),
|
|
6743
|
-
dirname: /* @__PURE__ */ __name(function(
|
|
6744
|
-
var result = PATH.splitPath(
|
|
6666
|
+
dirname: /* @__PURE__ */ __name(function(path) {
|
|
6667
|
+
var result = PATH.splitPath(path), root = result[0], dir = result[1];
|
|
6745
6668
|
if (!root && !dir) {
|
|
6746
6669
|
return ".";
|
|
6747
6670
|
}
|
|
@@ -6750,16 +6673,16 @@ var require_libzipSync = __commonJS({
|
|
|
6750
6673
|
}
|
|
6751
6674
|
return root + dir;
|
|
6752
6675
|
}, "dirname"),
|
|
6753
|
-
basename: /* @__PURE__ */ __name(function(
|
|
6754
|
-
if (
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
var lastSlash =
|
|
6758
|
-
if (lastSlash === -1) return
|
|
6759
|
-
return
|
|
6676
|
+
basename: /* @__PURE__ */ __name(function(path) {
|
|
6677
|
+
if (path === "/") return "/";
|
|
6678
|
+
path = PATH.normalize(path);
|
|
6679
|
+
path = path.replace(/\/$/, "");
|
|
6680
|
+
var lastSlash = path.lastIndexOf("/");
|
|
6681
|
+
if (lastSlash === -1) return path;
|
|
6682
|
+
return path.substr(lastSlash + 1);
|
|
6760
6683
|
}, "basename"),
|
|
6761
|
-
extname: /* @__PURE__ */ __name(function(
|
|
6762
|
-
return PATH.splitPath(
|
|
6684
|
+
extname: /* @__PURE__ */ __name(function(path) {
|
|
6685
|
+
return PATH.splitPath(path)[3];
|
|
6763
6686
|
}, "extname"),
|
|
6764
6687
|
join: /* @__PURE__ */ __name(function() {
|
|
6765
6688
|
var paths = Array.prototype.slice.call(arguments, 0);
|
|
@@ -6794,14 +6717,14 @@ var require_libzipSync = __commonJS({
|
|
|
6794
6717
|
resolve: /* @__PURE__ */ __name(function() {
|
|
6795
6718
|
var resolvedPath = "", resolvedAbsolute = false;
|
|
6796
6719
|
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
6797
|
-
var
|
|
6798
|
-
if (typeof
|
|
6720
|
+
var path = i >= 0 ? arguments[i] : FS.cwd();
|
|
6721
|
+
if (typeof path !== "string") {
|
|
6799
6722
|
throw new TypeError("Arguments to path.resolve must be strings");
|
|
6800
|
-
} else if (!
|
|
6723
|
+
} else if (!path) {
|
|
6801
6724
|
return "";
|
|
6802
6725
|
}
|
|
6803
|
-
resolvedPath =
|
|
6804
|
-
resolvedAbsolute =
|
|
6726
|
+
resolvedPath = path + "/" + resolvedPath;
|
|
6727
|
+
resolvedAbsolute = path.charAt(0) === "/";
|
|
6805
6728
|
}
|
|
6806
6729
|
resolvedPath = PATH.normalizeArray(
|
|
6807
6730
|
resolvedPath.split("/").filter(function(p) {
|
|
@@ -6811,8 +6734,8 @@ var require_libzipSync = __commonJS({
|
|
|
6811
6734
|
).join("/");
|
|
6812
6735
|
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
|
|
6813
6736
|
}, "resolve"),
|
|
6814
|
-
relative: /* @__PURE__ */ __name(function(
|
|
6815
|
-
|
|
6737
|
+
relative: /* @__PURE__ */ __name(function(from2, to) {
|
|
6738
|
+
from2 = PATH_FS.resolve(from2).substr(1);
|
|
6816
6739
|
to = PATH_FS.resolve(to).substr(1);
|
|
6817
6740
|
function trim(arr) {
|
|
6818
6741
|
var start = 0;
|
|
@@ -6827,7 +6750,7 @@ var require_libzipSync = __commonJS({
|
|
|
6827
6750
|
return arr.slice(start, end - start + 1);
|
|
6828
6751
|
}
|
|
6829
6752
|
__name(trim, "trim");
|
|
6830
|
-
var fromParts = trim(
|
|
6753
|
+
var fromParts = trim(from2.split("/"));
|
|
6831
6754
|
var toParts = trim(to.split("/"));
|
|
6832
6755
|
var length = Math.min(fromParts.length, toParts.length);
|
|
6833
6756
|
var samePartsLength = length;
|
|
@@ -7458,7 +7381,7 @@ var require_libzipSync = __commonJS({
|
|
|
7458
7381
|
isWindows: false,
|
|
7459
7382
|
staticInit: /* @__PURE__ */ __name(function() {
|
|
7460
7383
|
NODEFS.isWindows = !!process.platform.match(/^win/);
|
|
7461
|
-
var flags = { fs:
|
|
7384
|
+
var flags = { fs: fs.constants };
|
|
7462
7385
|
if (flags["fs"]) {
|
|
7463
7386
|
flags = flags["fs"];
|
|
7464
7387
|
}
|
|
@@ -7493,10 +7416,10 @@ var require_libzipSync = __commonJS({
|
|
|
7493
7416
|
node.stream_ops = NODEFS.stream_ops;
|
|
7494
7417
|
return node;
|
|
7495
7418
|
}, "createNode"),
|
|
7496
|
-
getMode: /* @__PURE__ */ __name(function(
|
|
7419
|
+
getMode: /* @__PURE__ */ __name(function(path) {
|
|
7497
7420
|
var stat;
|
|
7498
7421
|
try {
|
|
7499
|
-
stat =
|
|
7422
|
+
stat = fs.lstatSync(path);
|
|
7500
7423
|
if (NODEFS.isWindows) {
|
|
7501
7424
|
stat.mode = stat.mode | (stat.mode & 292) >> 2;
|
|
7502
7425
|
}
|
|
@@ -7536,10 +7459,10 @@ var require_libzipSync = __commonJS({
|
|
|
7536
7459
|
}, "flagsForNode"),
|
|
7537
7460
|
node_ops: {
|
|
7538
7461
|
getattr: /* @__PURE__ */ __name(function(node) {
|
|
7539
|
-
var
|
|
7462
|
+
var path = NODEFS.realPath(node);
|
|
7540
7463
|
var stat;
|
|
7541
7464
|
try {
|
|
7542
|
-
stat =
|
|
7465
|
+
stat = fs.lstatSync(path);
|
|
7543
7466
|
} catch (e) {
|
|
7544
7467
|
if (!e.code) throw e;
|
|
7545
7468
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7567,18 +7490,18 @@ var require_libzipSync = __commonJS({
|
|
|
7567
7490
|
};
|
|
7568
7491
|
}, "getattr"),
|
|
7569
7492
|
setattr: /* @__PURE__ */ __name(function(node, attr) {
|
|
7570
|
-
var
|
|
7493
|
+
var path = NODEFS.realPath(node);
|
|
7571
7494
|
try {
|
|
7572
7495
|
if (attr.mode !== void 0) {
|
|
7573
|
-
|
|
7496
|
+
fs.chmodSync(path, attr.mode);
|
|
7574
7497
|
node.mode = attr.mode;
|
|
7575
7498
|
}
|
|
7576
7499
|
if (attr.timestamp !== void 0) {
|
|
7577
7500
|
var date = new Date(attr.timestamp);
|
|
7578
|
-
|
|
7501
|
+
fs.utimesSync(path, date, date);
|
|
7579
7502
|
}
|
|
7580
7503
|
if (attr.size !== void 0) {
|
|
7581
|
-
|
|
7504
|
+
fs.truncateSync(path, attr.size);
|
|
7582
7505
|
}
|
|
7583
7506
|
} catch (e) {
|
|
7584
7507
|
if (!e.code) throw e;
|
|
@@ -7586,18 +7509,18 @@ var require_libzipSync = __commonJS({
|
|
|
7586
7509
|
}
|
|
7587
7510
|
}, "setattr"),
|
|
7588
7511
|
lookup: /* @__PURE__ */ __name(function(parent, name) {
|
|
7589
|
-
var
|
|
7590
|
-
var mode = NODEFS.getMode(
|
|
7512
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7513
|
+
var mode = NODEFS.getMode(path);
|
|
7591
7514
|
return NODEFS.createNode(parent, name, mode);
|
|
7592
7515
|
}, "lookup"),
|
|
7593
7516
|
mknod: /* @__PURE__ */ __name(function(parent, name, mode, dev) {
|
|
7594
7517
|
var node = NODEFS.createNode(parent, name, mode, dev);
|
|
7595
|
-
var
|
|
7518
|
+
var path = NODEFS.realPath(node);
|
|
7596
7519
|
try {
|
|
7597
7520
|
if (FS.isDir(node.mode)) {
|
|
7598
|
-
|
|
7521
|
+
fs.mkdirSync(path, node.mode);
|
|
7599
7522
|
} else {
|
|
7600
|
-
|
|
7523
|
+
fs.writeFileSync(path, "", { mode: node.mode });
|
|
7601
7524
|
}
|
|
7602
7525
|
} catch (e) {
|
|
7603
7526
|
if (!e.code) throw e;
|
|
@@ -7609,7 +7532,7 @@ var require_libzipSync = __commonJS({
|
|
|
7609
7532
|
var oldPath = NODEFS.realPath(oldNode);
|
|
7610
7533
|
var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
|
|
7611
7534
|
try {
|
|
7612
|
-
|
|
7535
|
+
fs.renameSync(oldPath, newPath);
|
|
7613
7536
|
} catch (e) {
|
|
7614
7537
|
if (!e.code) throw e;
|
|
7615
7538
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7617,27 +7540,27 @@ var require_libzipSync = __commonJS({
|
|
|
7617
7540
|
oldNode.name = newName;
|
|
7618
7541
|
}, "rename"),
|
|
7619
7542
|
unlink: /* @__PURE__ */ __name(function(parent, name) {
|
|
7620
|
-
var
|
|
7543
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7621
7544
|
try {
|
|
7622
|
-
|
|
7545
|
+
fs.unlinkSync(path);
|
|
7623
7546
|
} catch (e) {
|
|
7624
7547
|
if (!e.code) throw e;
|
|
7625
7548
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7626
7549
|
}
|
|
7627
7550
|
}, "unlink"),
|
|
7628
7551
|
rmdir: /* @__PURE__ */ __name(function(parent, name) {
|
|
7629
|
-
var
|
|
7552
|
+
var path = PATH.join2(NODEFS.realPath(parent), name);
|
|
7630
7553
|
try {
|
|
7631
|
-
|
|
7554
|
+
fs.rmdirSync(path);
|
|
7632
7555
|
} catch (e) {
|
|
7633
7556
|
if (!e.code) throw e;
|
|
7634
7557
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7635
7558
|
}
|
|
7636
7559
|
}, "rmdir"),
|
|
7637
7560
|
readdir: /* @__PURE__ */ __name(function(node) {
|
|
7638
|
-
var
|
|
7561
|
+
var path = NODEFS.realPath(node);
|
|
7639
7562
|
try {
|
|
7640
|
-
return
|
|
7563
|
+
return fs.readdirSync(path);
|
|
7641
7564
|
} catch (e) {
|
|
7642
7565
|
if (!e.code) throw e;
|
|
7643
7566
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7646,21 +7569,21 @@ var require_libzipSync = __commonJS({
|
|
|
7646
7569
|
symlink: /* @__PURE__ */ __name(function(parent, newName, oldPath) {
|
|
7647
7570
|
var newPath = PATH.join2(NODEFS.realPath(parent), newName);
|
|
7648
7571
|
try {
|
|
7649
|
-
|
|
7572
|
+
fs.symlinkSync(oldPath, newPath);
|
|
7650
7573
|
} catch (e) {
|
|
7651
7574
|
if (!e.code) throw e;
|
|
7652
7575
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
7653
7576
|
}
|
|
7654
7577
|
}, "symlink"),
|
|
7655
7578
|
readlink: /* @__PURE__ */ __name(function(node) {
|
|
7656
|
-
var
|
|
7579
|
+
var path = NODEFS.realPath(node);
|
|
7657
7580
|
try {
|
|
7658
|
-
|
|
7659
|
-
|
|
7581
|
+
path = fs.readlinkSync(path);
|
|
7582
|
+
path = NODEJS_PATH.relative(
|
|
7660
7583
|
NODEJS_PATH.resolve(node.mount.opts.root),
|
|
7661
|
-
|
|
7584
|
+
path
|
|
7662
7585
|
);
|
|
7663
|
-
return
|
|
7586
|
+
return path;
|
|
7664
7587
|
} catch (e) {
|
|
7665
7588
|
if (!e.code) throw e;
|
|
7666
7589
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7669,10 +7592,10 @@ var require_libzipSync = __commonJS({
|
|
|
7669
7592
|
},
|
|
7670
7593
|
stream_ops: {
|
|
7671
7594
|
open: /* @__PURE__ */ __name(function(stream) {
|
|
7672
|
-
var
|
|
7595
|
+
var path = NODEFS.realPath(stream.node);
|
|
7673
7596
|
try {
|
|
7674
7597
|
if (FS.isFile(stream.node.mode)) {
|
|
7675
|
-
stream.nfd =
|
|
7598
|
+
stream.nfd = fs.openSync(path, NODEFS.flagsForNode(stream.flags));
|
|
7676
7599
|
}
|
|
7677
7600
|
} catch (e) {
|
|
7678
7601
|
if (!e.code) throw e;
|
|
@@ -7682,7 +7605,7 @@ var require_libzipSync = __commonJS({
|
|
|
7682
7605
|
close: /* @__PURE__ */ __name(function(stream) {
|
|
7683
7606
|
try {
|
|
7684
7607
|
if (FS.isFile(stream.node.mode) && stream.nfd) {
|
|
7685
|
-
|
|
7608
|
+
fs.closeSync(stream.nfd);
|
|
7686
7609
|
}
|
|
7687
7610
|
} catch (e) {
|
|
7688
7611
|
if (!e.code) throw e;
|
|
@@ -7692,7 +7615,7 @@ var require_libzipSync = __commonJS({
|
|
|
7692
7615
|
read: /* @__PURE__ */ __name(function(stream, buffer2, offset, length, position) {
|
|
7693
7616
|
if (length === 0) return 0;
|
|
7694
7617
|
try {
|
|
7695
|
-
return
|
|
7618
|
+
return fs.readSync(
|
|
7696
7619
|
stream.nfd,
|
|
7697
7620
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7698
7621
|
offset,
|
|
@@ -7705,7 +7628,7 @@ var require_libzipSync = __commonJS({
|
|
|
7705
7628
|
}, "read"),
|
|
7706
7629
|
write: /* @__PURE__ */ __name(function(stream, buffer2, offset, length, position) {
|
|
7707
7630
|
try {
|
|
7708
|
-
return
|
|
7631
|
+
return fs.writeSync(
|
|
7709
7632
|
stream.nfd,
|
|
7710
7633
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7711
7634
|
offset,
|
|
@@ -7723,7 +7646,7 @@ var require_libzipSync = __commonJS({
|
|
|
7723
7646
|
} else if (whence === 2) {
|
|
7724
7647
|
if (FS.isFile(stream.node.mode)) {
|
|
7725
7648
|
try {
|
|
7726
|
-
var stat =
|
|
7649
|
+
var stat = fs.fstatSync(stream.nfd);
|
|
7727
7650
|
position += stat.size;
|
|
7728
7651
|
} catch (e) {
|
|
7729
7652
|
throw new FS.ErrnoError(NODEFS.convertNodeCode(e));
|
|
@@ -7766,8 +7689,8 @@ var require_libzipSync = __commonJS({
|
|
|
7766
7689
|
}
|
|
7767
7690
|
};
|
|
7768
7691
|
var NODERAWFS = {
|
|
7769
|
-
lookupPath: /* @__PURE__ */ __name(function(
|
|
7770
|
-
return { path
|
|
7692
|
+
lookupPath: /* @__PURE__ */ __name(function(path) {
|
|
7693
|
+
return { path, node: { mode: NODEFS.getMode(path) } };
|
|
7771
7694
|
}, "lookupPath"),
|
|
7772
7695
|
createStandardStreams: /* @__PURE__ */ __name(function() {
|
|
7773
7696
|
FS.streams[0] = {
|
|
@@ -7797,75 +7720,75 @@ var require_libzipSync = __commonJS({
|
|
|
7797
7720
|
chdir: /* @__PURE__ */ __name(function() {
|
|
7798
7721
|
process.chdir.apply(void 0, arguments);
|
|
7799
7722
|
}, "chdir"),
|
|
7800
|
-
mknod: /* @__PURE__ */ __name(function(
|
|
7801
|
-
if (FS.isDir(
|
|
7802
|
-
|
|
7723
|
+
mknod: /* @__PURE__ */ __name(function(path, mode) {
|
|
7724
|
+
if (FS.isDir(path)) {
|
|
7725
|
+
fs.mkdirSync(path, mode);
|
|
7803
7726
|
} else {
|
|
7804
|
-
|
|
7727
|
+
fs.writeFileSync(path, "", { mode });
|
|
7805
7728
|
}
|
|
7806
7729
|
}, "mknod"),
|
|
7807
7730
|
mkdir: /* @__PURE__ */ __name(function() {
|
|
7808
|
-
|
|
7731
|
+
fs.mkdirSync.apply(void 0, arguments);
|
|
7809
7732
|
}, "mkdir"),
|
|
7810
7733
|
symlink: /* @__PURE__ */ __name(function() {
|
|
7811
|
-
|
|
7734
|
+
fs.symlinkSync.apply(void 0, arguments);
|
|
7812
7735
|
}, "symlink"),
|
|
7813
7736
|
rename: /* @__PURE__ */ __name(function() {
|
|
7814
|
-
|
|
7737
|
+
fs.renameSync.apply(void 0, arguments);
|
|
7815
7738
|
}, "rename"),
|
|
7816
7739
|
rmdir: /* @__PURE__ */ __name(function() {
|
|
7817
|
-
|
|
7740
|
+
fs.rmdirSync.apply(void 0, arguments);
|
|
7818
7741
|
}, "rmdir"),
|
|
7819
7742
|
readdir: /* @__PURE__ */ __name(function() {
|
|
7820
|
-
|
|
7743
|
+
fs.readdirSync.apply(void 0, arguments);
|
|
7821
7744
|
}, "readdir"),
|
|
7822
7745
|
unlink: /* @__PURE__ */ __name(function() {
|
|
7823
|
-
|
|
7746
|
+
fs.unlinkSync.apply(void 0, arguments);
|
|
7824
7747
|
}, "unlink"),
|
|
7825
7748
|
readlink: /* @__PURE__ */ __name(function() {
|
|
7826
|
-
return
|
|
7749
|
+
return fs.readlinkSync.apply(void 0, arguments);
|
|
7827
7750
|
}, "readlink"),
|
|
7828
7751
|
stat: /* @__PURE__ */ __name(function() {
|
|
7829
|
-
return
|
|
7752
|
+
return fs.statSync.apply(void 0, arguments);
|
|
7830
7753
|
}, "stat"),
|
|
7831
7754
|
lstat: /* @__PURE__ */ __name(function() {
|
|
7832
|
-
return
|
|
7755
|
+
return fs.lstatSync.apply(void 0, arguments);
|
|
7833
7756
|
}, "lstat"),
|
|
7834
7757
|
chmod: /* @__PURE__ */ __name(function() {
|
|
7835
|
-
|
|
7758
|
+
fs.chmodSync.apply(void 0, arguments);
|
|
7836
7759
|
}, "chmod"),
|
|
7837
7760
|
fchmod: /* @__PURE__ */ __name(function() {
|
|
7838
|
-
|
|
7761
|
+
fs.fchmodSync.apply(void 0, arguments);
|
|
7839
7762
|
}, "fchmod"),
|
|
7840
7763
|
chown: /* @__PURE__ */ __name(function() {
|
|
7841
|
-
|
|
7764
|
+
fs.chownSync.apply(void 0, arguments);
|
|
7842
7765
|
}, "chown"),
|
|
7843
7766
|
fchown: /* @__PURE__ */ __name(function() {
|
|
7844
|
-
|
|
7767
|
+
fs.fchownSync.apply(void 0, arguments);
|
|
7845
7768
|
}, "fchown"),
|
|
7846
7769
|
truncate: /* @__PURE__ */ __name(function() {
|
|
7847
|
-
|
|
7770
|
+
fs.truncateSync.apply(void 0, arguments);
|
|
7848
7771
|
}, "truncate"),
|
|
7849
7772
|
ftruncate: /* @__PURE__ */ __name(function(fd, len) {
|
|
7850
7773
|
if (len < 0) {
|
|
7851
7774
|
throw new FS.ErrnoError(28);
|
|
7852
7775
|
}
|
|
7853
|
-
|
|
7776
|
+
fs.ftruncateSync.apply(void 0, arguments);
|
|
7854
7777
|
}, "ftruncate"),
|
|
7855
7778
|
utime: /* @__PURE__ */ __name(function() {
|
|
7856
|
-
|
|
7779
|
+
fs.utimesSync.apply(void 0, arguments);
|
|
7857
7780
|
}, "utime"),
|
|
7858
|
-
open: /* @__PURE__ */ __name(function(
|
|
7781
|
+
open: /* @__PURE__ */ __name(function(path, flags, mode, suggestFD) {
|
|
7859
7782
|
if (typeof flags === "string") {
|
|
7860
7783
|
flags = VFS.modeStringToFlags(flags);
|
|
7861
7784
|
}
|
|
7862
|
-
var nfd =
|
|
7785
|
+
var nfd = fs.openSync(path, NODEFS.flagsForNode(flags), mode);
|
|
7863
7786
|
var fd = suggestFD != null ? suggestFD : FS.nextfd(nfd);
|
|
7864
7787
|
var stream = {
|
|
7865
7788
|
fd,
|
|
7866
7789
|
nfd,
|
|
7867
7790
|
position: 0,
|
|
7868
|
-
path
|
|
7791
|
+
path,
|
|
7869
7792
|
flags,
|
|
7870
7793
|
seekable: true
|
|
7871
7794
|
};
|
|
@@ -7874,7 +7797,7 @@ var require_libzipSync = __commonJS({
|
|
|
7874
7797
|
}, "open"),
|
|
7875
7798
|
close: /* @__PURE__ */ __name(function(stream) {
|
|
7876
7799
|
if (!stream.stream_ops) {
|
|
7877
|
-
|
|
7800
|
+
fs.closeSync(stream.nfd);
|
|
7878
7801
|
}
|
|
7879
7802
|
FS.closeStream(stream.fd);
|
|
7880
7803
|
}, "close"),
|
|
@@ -7886,7 +7809,7 @@ var require_libzipSync = __commonJS({
|
|
|
7886
7809
|
if (whence === 1) {
|
|
7887
7810
|
position += stream.position;
|
|
7888
7811
|
} else if (whence === 2) {
|
|
7889
|
-
position +=
|
|
7812
|
+
position += fs.fstatSync(stream.nfd).size;
|
|
7890
7813
|
} else if (whence !== 0) {
|
|
7891
7814
|
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
|
|
7892
7815
|
}
|
|
@@ -7902,7 +7825,7 @@ var require_libzipSync = __commonJS({
|
|
|
7902
7825
|
}
|
|
7903
7826
|
var seeking = typeof position !== "undefined";
|
|
7904
7827
|
if (!seeking && stream.seekable) position = stream.position;
|
|
7905
|
-
var bytesRead =
|
|
7828
|
+
var bytesRead = fs.readSync(
|
|
7906
7829
|
stream.nfd,
|
|
7907
7830
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7908
7831
|
offset,
|
|
@@ -7921,7 +7844,7 @@ var require_libzipSync = __commonJS({
|
|
|
7921
7844
|
}
|
|
7922
7845
|
var seeking = typeof position !== "undefined";
|
|
7923
7846
|
if (!seeking && stream.seekable) position = stream.position;
|
|
7924
|
-
var bytesWritten =
|
|
7847
|
+
var bytesWritten = fs.writeSync(
|
|
7925
7848
|
stream.nfd,
|
|
7926
7849
|
NODEFS.bufferFrom(buffer2.buffer),
|
|
7927
7850
|
offset,
|
|
@@ -7978,10 +7901,10 @@ var require_libzipSync = __commonJS({
|
|
|
7978
7901
|
genericErrors: {},
|
|
7979
7902
|
filesystems: null,
|
|
7980
7903
|
syncFSRequests: 0,
|
|
7981
|
-
lookupPath: /* @__PURE__ */ __name(function(
|
|
7982
|
-
|
|
7904
|
+
lookupPath: /* @__PURE__ */ __name(function(path, opts) {
|
|
7905
|
+
path = PATH_FS.resolve(FS.cwd(), path);
|
|
7983
7906
|
opts = opts || {};
|
|
7984
|
-
if (!
|
|
7907
|
+
if (!path) return { path: "", node: null };
|
|
7985
7908
|
var defaults = { follow_mount: true, recurse_count: 0 };
|
|
7986
7909
|
for (var key2 in defaults) {
|
|
7987
7910
|
if (opts[key2] === void 0) {
|
|
@@ -7992,7 +7915,7 @@ var require_libzipSync = __commonJS({
|
|
|
7992
7915
|
throw new FS.ErrnoError(32);
|
|
7993
7916
|
}
|
|
7994
7917
|
var parts = PATH.normalizeArray(
|
|
7995
|
-
|
|
7918
|
+
path.split("/").filter(function(p) {
|
|
7996
7919
|
return !!p;
|
|
7997
7920
|
}),
|
|
7998
7921
|
false
|
|
@@ -8029,14 +7952,14 @@ var require_libzipSync = __commonJS({
|
|
|
8029
7952
|
return { path: current_path, node: current };
|
|
8030
7953
|
}, "lookupPath"),
|
|
8031
7954
|
getPath: /* @__PURE__ */ __name(function(node) {
|
|
8032
|
-
var
|
|
7955
|
+
var path;
|
|
8033
7956
|
while (true) {
|
|
8034
7957
|
if (FS.isRoot(node)) {
|
|
8035
7958
|
var mount = node.mount.mountpoint;
|
|
8036
|
-
if (!
|
|
8037
|
-
return mount[mount.length - 1] !== "/" ? mount + "/" +
|
|
7959
|
+
if (!path) return mount;
|
|
7960
|
+
return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
|
|
8038
7961
|
}
|
|
8039
|
-
|
|
7962
|
+
path = path ? node.name + "/" + path : node.name;
|
|
8040
7963
|
node = node.parent;
|
|
8041
7964
|
}
|
|
8042
7965
|
}, "getPath"),
|
|
@@ -8389,10 +8312,10 @@ var require_libzipSync = __commonJS({
|
|
|
8389
8312
|
lookup: /* @__PURE__ */ __name(function(parent, name) {
|
|
8390
8313
|
return parent.node_ops.lookup(parent, name);
|
|
8391
8314
|
}, "lookup"),
|
|
8392
|
-
mknod: /* @__PURE__ */ __name(function(
|
|
8393
|
-
var lookup = FS.lookupPath(
|
|
8315
|
+
mknod: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
8316
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8394
8317
|
var parent = lookup.node;
|
|
8395
|
-
var name = PATH.basename(
|
|
8318
|
+
var name = PATH.basename(path);
|
|
8396
8319
|
if (!name || name === "." || name === "..") {
|
|
8397
8320
|
throw new FS.ErrnoError(28);
|
|
8398
8321
|
}
|
|
@@ -8405,20 +8328,20 @@ var require_libzipSync = __commonJS({
|
|
|
8405
8328
|
}
|
|
8406
8329
|
return parent.node_ops.mknod(parent, name, mode, dev);
|
|
8407
8330
|
}, "mknod"),
|
|
8408
|
-
create: /* @__PURE__ */ __name(function(
|
|
8331
|
+
create: /* @__PURE__ */ __name(function(path, mode) {
|
|
8409
8332
|
mode = mode !== void 0 ? mode : 438;
|
|
8410
8333
|
mode &= 4095;
|
|
8411
8334
|
mode |= 32768;
|
|
8412
|
-
return FS.mknod(
|
|
8335
|
+
return FS.mknod(path, mode, 0);
|
|
8413
8336
|
}, "create"),
|
|
8414
|
-
mkdir: /* @__PURE__ */ __name(function(
|
|
8337
|
+
mkdir: /* @__PURE__ */ __name(function(path, mode) {
|
|
8415
8338
|
mode = mode !== void 0 ? mode : 511;
|
|
8416
8339
|
mode &= 511 | 512;
|
|
8417
8340
|
mode |= 16384;
|
|
8418
|
-
return FS.mknod(
|
|
8341
|
+
return FS.mknod(path, mode, 0);
|
|
8419
8342
|
}, "mkdir"),
|
|
8420
|
-
mkdirTree: /* @__PURE__ */ __name(function(
|
|
8421
|
-
var dirs =
|
|
8343
|
+
mkdirTree: /* @__PURE__ */ __name(function(path, mode) {
|
|
8344
|
+
var dirs = path.split("/");
|
|
8422
8345
|
var d = "";
|
|
8423
8346
|
for (var i = 0; i < dirs.length; ++i) {
|
|
8424
8347
|
if (!dirs[i]) continue;
|
|
@@ -8430,13 +8353,13 @@ var require_libzipSync = __commonJS({
|
|
|
8430
8353
|
}
|
|
8431
8354
|
}
|
|
8432
8355
|
}, "mkdirTree"),
|
|
8433
|
-
mkdev: /* @__PURE__ */ __name(function(
|
|
8356
|
+
mkdev: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
8434
8357
|
if (typeof dev === "undefined") {
|
|
8435
8358
|
dev = mode;
|
|
8436
8359
|
mode = 438;
|
|
8437
8360
|
}
|
|
8438
8361
|
mode |= 8192;
|
|
8439
|
-
return FS.mknod(
|
|
8362
|
+
return FS.mknod(path, mode, dev);
|
|
8440
8363
|
}, "mkdev"),
|
|
8441
8364
|
symlink: /* @__PURE__ */ __name(function(oldpath, newpath) {
|
|
8442
8365
|
if (!PATH_FS.resolve(oldpath)) {
|
|
@@ -8535,10 +8458,10 @@ var require_libzipSync = __commonJS({
|
|
|
8535
8458
|
);
|
|
8536
8459
|
}
|
|
8537
8460
|
}, "rename"),
|
|
8538
|
-
rmdir: /* @__PURE__ */ __name(function(
|
|
8539
|
-
var lookup = FS.lookupPath(
|
|
8461
|
+
rmdir: /* @__PURE__ */ __name(function(path) {
|
|
8462
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8540
8463
|
var parent = lookup.node;
|
|
8541
|
-
var name = PATH.basename(
|
|
8464
|
+
var name = PATH.basename(path);
|
|
8542
8465
|
var node = FS.lookupNode(parent, name);
|
|
8543
8466
|
var errCode = FS.mayDelete(parent, name, true);
|
|
8544
8467
|
if (errCode) {
|
|
@@ -8552,36 +8475,36 @@ var require_libzipSync = __commonJS({
|
|
|
8552
8475
|
}
|
|
8553
8476
|
try {
|
|
8554
8477
|
if (FS.trackingDelegate["willDeletePath"]) {
|
|
8555
|
-
FS.trackingDelegate["willDeletePath"](
|
|
8478
|
+
FS.trackingDelegate["willDeletePath"](path);
|
|
8556
8479
|
}
|
|
8557
8480
|
} catch (e) {
|
|
8558
8481
|
err(
|
|
8559
|
-
"FS.trackingDelegate['willDeletePath']('" +
|
|
8482
|
+
"FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8560
8483
|
);
|
|
8561
8484
|
}
|
|
8562
8485
|
parent.node_ops.rmdir(parent, name);
|
|
8563
8486
|
FS.destroyNode(node);
|
|
8564
8487
|
try {
|
|
8565
8488
|
if (FS.trackingDelegate["onDeletePath"])
|
|
8566
|
-
FS.trackingDelegate["onDeletePath"](
|
|
8489
|
+
FS.trackingDelegate["onDeletePath"](path);
|
|
8567
8490
|
} catch (e) {
|
|
8568
8491
|
err(
|
|
8569
|
-
"FS.trackingDelegate['onDeletePath']('" +
|
|
8492
|
+
"FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8570
8493
|
);
|
|
8571
8494
|
}
|
|
8572
8495
|
}, "rmdir"),
|
|
8573
|
-
readdir: /* @__PURE__ */ __name(function(
|
|
8574
|
-
var lookup = FS.lookupPath(
|
|
8496
|
+
readdir: /* @__PURE__ */ __name(function(path) {
|
|
8497
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8575
8498
|
var node = lookup.node;
|
|
8576
8499
|
if (!node.node_ops.readdir) {
|
|
8577
8500
|
throw new FS.ErrnoError(54);
|
|
8578
8501
|
}
|
|
8579
8502
|
return node.node_ops.readdir(node);
|
|
8580
8503
|
}, "readdir"),
|
|
8581
|
-
unlink: /* @__PURE__ */ __name(function(
|
|
8582
|
-
var lookup = FS.lookupPath(
|
|
8504
|
+
unlink: /* @__PURE__ */ __name(function(path) {
|
|
8505
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
8583
8506
|
var parent = lookup.node;
|
|
8584
|
-
var name = PATH.basename(
|
|
8507
|
+
var name = PATH.basename(path);
|
|
8585
8508
|
var node = FS.lookupNode(parent, name);
|
|
8586
8509
|
var errCode = FS.mayDelete(parent, name, false);
|
|
8587
8510
|
if (errCode) {
|
|
@@ -8595,26 +8518,26 @@ var require_libzipSync = __commonJS({
|
|
|
8595
8518
|
}
|
|
8596
8519
|
try {
|
|
8597
8520
|
if (FS.trackingDelegate["willDeletePath"]) {
|
|
8598
|
-
FS.trackingDelegate["willDeletePath"](
|
|
8521
|
+
FS.trackingDelegate["willDeletePath"](path);
|
|
8599
8522
|
}
|
|
8600
8523
|
} catch (e) {
|
|
8601
8524
|
err(
|
|
8602
|
-
"FS.trackingDelegate['willDeletePath']('" +
|
|
8525
|
+
"FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8603
8526
|
);
|
|
8604
8527
|
}
|
|
8605
8528
|
parent.node_ops.unlink(parent, name);
|
|
8606
8529
|
FS.destroyNode(node);
|
|
8607
8530
|
try {
|
|
8608
8531
|
if (FS.trackingDelegate["onDeletePath"])
|
|
8609
|
-
FS.trackingDelegate["onDeletePath"](
|
|
8532
|
+
FS.trackingDelegate["onDeletePath"](path);
|
|
8610
8533
|
} catch (e) {
|
|
8611
8534
|
err(
|
|
8612
|
-
"FS.trackingDelegate['onDeletePath']('" +
|
|
8535
|
+
"FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message
|
|
8613
8536
|
);
|
|
8614
8537
|
}
|
|
8615
8538
|
}, "unlink"),
|
|
8616
|
-
readlink: /* @__PURE__ */ __name(function(
|
|
8617
|
-
var lookup = FS.lookupPath(
|
|
8539
|
+
readlink: /* @__PURE__ */ __name(function(path) {
|
|
8540
|
+
var lookup = FS.lookupPath(path);
|
|
8618
8541
|
var link = lookup.node;
|
|
8619
8542
|
if (!link) {
|
|
8620
8543
|
throw new FS.ErrnoError(44);
|
|
@@ -8627,8 +8550,8 @@ var require_libzipSync = __commonJS({
|
|
|
8627
8550
|
link.node_ops.readlink(link)
|
|
8628
8551
|
);
|
|
8629
8552
|
}, "readlink"),
|
|
8630
|
-
stat: /* @__PURE__ */ __name(function(
|
|
8631
|
-
var lookup = FS.lookupPath(
|
|
8553
|
+
stat: /* @__PURE__ */ __name(function(path, dontFollow) {
|
|
8554
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8632
8555
|
var node = lookup.node;
|
|
8633
8556
|
if (!node) {
|
|
8634
8557
|
throw new FS.ErrnoError(44);
|
|
@@ -8638,16 +8561,16 @@ var require_libzipSync = __commonJS({
|
|
|
8638
8561
|
}
|
|
8639
8562
|
return node.node_ops.getattr(node);
|
|
8640
8563
|
}, "stat"),
|
|
8641
|
-
lstat: /* @__PURE__ */ __name(function(
|
|
8642
|
-
return FS.stat(
|
|
8564
|
+
lstat: /* @__PURE__ */ __name(function(path) {
|
|
8565
|
+
return FS.stat(path, true);
|
|
8643
8566
|
}, "lstat"),
|
|
8644
|
-
chmod: /* @__PURE__ */ __name(function(
|
|
8567
|
+
chmod: /* @__PURE__ */ __name(function(path, mode, dontFollow) {
|
|
8645
8568
|
var node;
|
|
8646
|
-
if (typeof
|
|
8647
|
-
var lookup = FS.lookupPath(
|
|
8569
|
+
if (typeof path === "string") {
|
|
8570
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8648
8571
|
node = lookup.node;
|
|
8649
8572
|
} else {
|
|
8650
|
-
node =
|
|
8573
|
+
node = path;
|
|
8651
8574
|
}
|
|
8652
8575
|
if (!node.node_ops.setattr) {
|
|
8653
8576
|
throw new FS.ErrnoError(63);
|
|
@@ -8657,8 +8580,8 @@ var require_libzipSync = __commonJS({
|
|
|
8657
8580
|
timestamp: Date.now()
|
|
8658
8581
|
});
|
|
8659
8582
|
}, "chmod"),
|
|
8660
|
-
lchmod: /* @__PURE__ */ __name(function(
|
|
8661
|
-
FS.chmod(
|
|
8583
|
+
lchmod: /* @__PURE__ */ __name(function(path, mode) {
|
|
8584
|
+
FS.chmod(path, mode, true);
|
|
8662
8585
|
}, "lchmod"),
|
|
8663
8586
|
fchmod: /* @__PURE__ */ __name(function(fd, mode) {
|
|
8664
8587
|
var stream = FS.getStream(fd);
|
|
@@ -8667,21 +8590,21 @@ var require_libzipSync = __commonJS({
|
|
|
8667
8590
|
}
|
|
8668
8591
|
FS.chmod(stream.node, mode);
|
|
8669
8592
|
}, "fchmod"),
|
|
8670
|
-
chown: /* @__PURE__ */ __name(function(
|
|
8593
|
+
chown: /* @__PURE__ */ __name(function(path, uid, gid, dontFollow) {
|
|
8671
8594
|
var node;
|
|
8672
|
-
if (typeof
|
|
8673
|
-
var lookup = FS.lookupPath(
|
|
8595
|
+
if (typeof path === "string") {
|
|
8596
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
8674
8597
|
node = lookup.node;
|
|
8675
8598
|
} else {
|
|
8676
|
-
node =
|
|
8599
|
+
node = path;
|
|
8677
8600
|
}
|
|
8678
8601
|
if (!node.node_ops.setattr) {
|
|
8679
8602
|
throw new FS.ErrnoError(63);
|
|
8680
8603
|
}
|
|
8681
8604
|
node.node_ops.setattr(node, { timestamp: Date.now() });
|
|
8682
8605
|
}, "chown"),
|
|
8683
|
-
lchown: /* @__PURE__ */ __name(function(
|
|
8684
|
-
FS.chown(
|
|
8606
|
+
lchown: /* @__PURE__ */ __name(function(path, uid, gid) {
|
|
8607
|
+
FS.chown(path, uid, gid, true);
|
|
8685
8608
|
}, "lchown"),
|
|
8686
8609
|
fchown: /* @__PURE__ */ __name(function(fd, uid, gid) {
|
|
8687
8610
|
var stream = FS.getStream(fd);
|
|
@@ -8690,16 +8613,16 @@ var require_libzipSync = __commonJS({
|
|
|
8690
8613
|
}
|
|
8691
8614
|
FS.chown(stream.node, uid, gid);
|
|
8692
8615
|
}, "fchown"),
|
|
8693
|
-
truncate: /* @__PURE__ */ __name(function(
|
|
8616
|
+
truncate: /* @__PURE__ */ __name(function(path, len) {
|
|
8694
8617
|
if (len < 0) {
|
|
8695
8618
|
throw new FS.ErrnoError(28);
|
|
8696
8619
|
}
|
|
8697
8620
|
var node;
|
|
8698
|
-
if (typeof
|
|
8699
|
-
var lookup = FS.lookupPath(
|
|
8621
|
+
if (typeof path === "string") {
|
|
8622
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8700
8623
|
node = lookup.node;
|
|
8701
8624
|
} else {
|
|
8702
|
-
node =
|
|
8625
|
+
node = path;
|
|
8703
8626
|
}
|
|
8704
8627
|
if (!node.node_ops.setattr) {
|
|
8705
8628
|
throw new FS.ErrnoError(63);
|
|
@@ -8726,13 +8649,13 @@ var require_libzipSync = __commonJS({
|
|
|
8726
8649
|
}
|
|
8727
8650
|
FS.truncate(stream.node, len);
|
|
8728
8651
|
}, "ftruncate"),
|
|
8729
|
-
utime: /* @__PURE__ */ __name(function(
|
|
8730
|
-
var lookup = FS.lookupPath(
|
|
8652
|
+
utime: /* @__PURE__ */ __name(function(path, atime, mtime) {
|
|
8653
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
8731
8654
|
var node = lookup.node;
|
|
8732
8655
|
node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) });
|
|
8733
8656
|
}, "utime"),
|
|
8734
|
-
open: /* @__PURE__ */ __name(function(
|
|
8735
|
-
if (
|
|
8657
|
+
open: /* @__PURE__ */ __name(function(path, flags, mode, fd_start, fd_end) {
|
|
8658
|
+
if (path === "") {
|
|
8736
8659
|
throw new FS.ErrnoError(44);
|
|
8737
8660
|
}
|
|
8738
8661
|
flags = typeof flags === "string" ? FS.modeStringToFlags(flags) : flags;
|
|
@@ -8743,12 +8666,12 @@ var require_libzipSync = __commonJS({
|
|
|
8743
8666
|
mode = 0;
|
|
8744
8667
|
}
|
|
8745
8668
|
var node;
|
|
8746
|
-
if (typeof
|
|
8747
|
-
node =
|
|
8669
|
+
if (typeof path === "object") {
|
|
8670
|
+
node = path;
|
|
8748
8671
|
} else {
|
|
8749
|
-
|
|
8672
|
+
path = PATH.normalize(path);
|
|
8750
8673
|
try {
|
|
8751
|
-
var lookup = FS.lookupPath(
|
|
8674
|
+
var lookup = FS.lookupPath(path, { follow: !(flags & 131072) });
|
|
8752
8675
|
node = lookup.node;
|
|
8753
8676
|
} catch (e) {
|
|
8754
8677
|
}
|
|
@@ -8760,7 +8683,7 @@ var require_libzipSync = __commonJS({
|
|
|
8760
8683
|
throw new FS.ErrnoError(20);
|
|
8761
8684
|
}
|
|
8762
8685
|
} else {
|
|
8763
|
-
node = FS.mknod(
|
|
8686
|
+
node = FS.mknod(path, mode, 0);
|
|
8764
8687
|
created = true;
|
|
8765
8688
|
}
|
|
8766
8689
|
}
|
|
@@ -8802,9 +8725,9 @@ var require_libzipSync = __commonJS({
|
|
|
8802
8725
|
}
|
|
8803
8726
|
if (Module["logReadFiles"] && !(flags & 1)) {
|
|
8804
8727
|
if (!FS.readFiles) FS.readFiles = {};
|
|
8805
|
-
if (!(
|
|
8806
|
-
FS.readFiles[
|
|
8807
|
-
err("FS.trackingDelegate error on read file: " +
|
|
8728
|
+
if (!(path in FS.readFiles)) {
|
|
8729
|
+
FS.readFiles[path] = 1;
|
|
8730
|
+
err("FS.trackingDelegate error on read file: " + path);
|
|
8808
8731
|
}
|
|
8809
8732
|
}
|
|
8810
8733
|
try {
|
|
@@ -8816,11 +8739,11 @@ var require_libzipSync = __commonJS({
|
|
|
8816
8739
|
if ((flags & 2097155) !== 0) {
|
|
8817
8740
|
trackingFlags |= FS.tracking.openFlags.WRITE;
|
|
8818
8741
|
}
|
|
8819
|
-
FS.trackingDelegate["onOpenFile"](
|
|
8742
|
+
FS.trackingDelegate["onOpenFile"](path, trackingFlags);
|
|
8820
8743
|
}
|
|
8821
8744
|
} catch (e) {
|
|
8822
8745
|
err(
|
|
8823
|
-
"FS.trackingDelegate['onOpenFile']('" +
|
|
8746
|
+
"FS.trackingDelegate['onOpenFile']('" + path + "', flags) threw an exception: " + e.message
|
|
8824
8747
|
);
|
|
8825
8748
|
}
|
|
8826
8749
|
return stream;
|
|
@@ -8992,7 +8915,7 @@ var require_libzipSync = __commonJS({
|
|
|
8992
8915
|
}
|
|
8993
8916
|
return stream.stream_ops.ioctl(stream, cmd, arg);
|
|
8994
8917
|
}, "ioctl"),
|
|
8995
|
-
readFile: /* @__PURE__ */ __name(function(
|
|
8918
|
+
readFile: /* @__PURE__ */ __name(function(path, opts) {
|
|
8996
8919
|
opts = opts || {};
|
|
8997
8920
|
opts.flags = opts.flags || 0;
|
|
8998
8921
|
opts.encoding = opts.encoding || "binary";
|
|
@@ -9000,8 +8923,8 @@ var require_libzipSync = __commonJS({
|
|
|
9000
8923
|
throw new Error('Invalid encoding type "' + opts.encoding + '"');
|
|
9001
8924
|
}
|
|
9002
8925
|
var ret;
|
|
9003
|
-
var stream = FS.open(
|
|
9004
|
-
var stat = FS.stat(
|
|
8926
|
+
var stream = FS.open(path, opts.flags);
|
|
8927
|
+
var stat = FS.stat(path);
|
|
9005
8928
|
var length = stat.size;
|
|
9006
8929
|
var buf = new Uint8Array(length);
|
|
9007
8930
|
FS.read(stream, buf, 0, length, 0);
|
|
@@ -9013,10 +8936,10 @@ var require_libzipSync = __commonJS({
|
|
|
9013
8936
|
FS.close(stream);
|
|
9014
8937
|
return ret;
|
|
9015
8938
|
}, "readFile"),
|
|
9016
|
-
writeFile: /* @__PURE__ */ __name(function(
|
|
8939
|
+
writeFile: /* @__PURE__ */ __name(function(path, data, opts) {
|
|
9017
8940
|
opts = opts || {};
|
|
9018
8941
|
opts.flags = opts.flags || 577;
|
|
9019
|
-
var stream = FS.open(
|
|
8942
|
+
var stream = FS.open(path, opts.flags, opts.mode);
|
|
9020
8943
|
if (typeof data === "string") {
|
|
9021
8944
|
var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
|
|
9022
8945
|
var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
|
|
@@ -9031,8 +8954,8 @@ var require_libzipSync = __commonJS({
|
|
|
9031
8954
|
cwd: /* @__PURE__ */ __name(function() {
|
|
9032
8955
|
return FS.currentPath;
|
|
9033
8956
|
}, "cwd"),
|
|
9034
|
-
chdir: /* @__PURE__ */ __name(function(
|
|
9035
|
-
var lookup = FS.lookupPath(
|
|
8957
|
+
chdir: /* @__PURE__ */ __name(function(path) {
|
|
8958
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
9036
8959
|
if (lookup.node === null) {
|
|
9037
8960
|
throw new FS.ErrnoError(44);
|
|
9038
8961
|
}
|
|
@@ -9176,18 +9099,18 @@ var require_libzipSync = __commonJS({
|
|
|
9176
9099
|
if (canWrite) mode |= 146;
|
|
9177
9100
|
return mode;
|
|
9178
9101
|
}, "getMode"),
|
|
9179
|
-
findObject: /* @__PURE__ */ __name(function(
|
|
9180
|
-
var ret = FS.analyzePath(
|
|
9102
|
+
findObject: /* @__PURE__ */ __name(function(path, dontResolveLastLink) {
|
|
9103
|
+
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
9181
9104
|
if (ret.exists) {
|
|
9182
9105
|
return ret.object;
|
|
9183
9106
|
} else {
|
|
9184
9107
|
return null;
|
|
9185
9108
|
}
|
|
9186
9109
|
}, "findObject"),
|
|
9187
|
-
analyzePath: /* @__PURE__ */ __name(function(
|
|
9110
|
+
analyzePath: /* @__PURE__ */ __name(function(path, dontResolveLastLink) {
|
|
9188
9111
|
try {
|
|
9189
|
-
var lookup = FS.lookupPath(
|
|
9190
|
-
|
|
9112
|
+
var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
9113
|
+
path = lookup.path;
|
|
9191
9114
|
} catch (e) {
|
|
9192
9115
|
}
|
|
9193
9116
|
var ret = {
|
|
@@ -9202,12 +9125,12 @@ var require_libzipSync = __commonJS({
|
|
|
9202
9125
|
parentObject: null
|
|
9203
9126
|
};
|
|
9204
9127
|
try {
|
|
9205
|
-
var lookup = FS.lookupPath(
|
|
9128
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
9206
9129
|
ret.parentExists = true;
|
|
9207
9130
|
ret.parentPath = lookup.path;
|
|
9208
9131
|
ret.parentObject = lookup.node;
|
|
9209
|
-
ret.name = PATH.basename(
|
|
9210
|
-
lookup = FS.lookupPath(
|
|
9132
|
+
ret.name = PATH.basename(path);
|
|
9133
|
+
lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
9211
9134
|
ret.exists = true;
|
|
9212
9135
|
ret.path = lookup.path;
|
|
9213
9136
|
ret.object = lookup.node;
|
|
@@ -9218,9 +9141,9 @@ var require_libzipSync = __commonJS({
|
|
|
9218
9141
|
}
|
|
9219
9142
|
return ret;
|
|
9220
9143
|
}, "analyzePath"),
|
|
9221
|
-
createPath: /* @__PURE__ */ __name(function(parent,
|
|
9144
|
+
createPath: /* @__PURE__ */ __name(function(parent, path, canRead, canWrite) {
|
|
9222
9145
|
parent = typeof parent === "string" ? parent : FS.getPath(parent);
|
|
9223
|
-
var parts =
|
|
9146
|
+
var parts = path.split("/").reverse();
|
|
9224
9147
|
while (parts.length) {
|
|
9225
9148
|
var part = parts.pop();
|
|
9226
9149
|
if (!part) continue;
|
|
@@ -9234,20 +9157,20 @@ var require_libzipSync = __commonJS({
|
|
|
9234
9157
|
return current;
|
|
9235
9158
|
}, "createPath"),
|
|
9236
9159
|
createFile: /* @__PURE__ */ __name(function(parent, name, properties, canRead, canWrite) {
|
|
9237
|
-
var
|
|
9160
|
+
var path = PATH.join2(
|
|
9238
9161
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9239
9162
|
name
|
|
9240
9163
|
);
|
|
9241
9164
|
var mode = FS.getMode(canRead, canWrite);
|
|
9242
|
-
return FS.create(
|
|
9165
|
+
return FS.create(path, mode);
|
|
9243
9166
|
}, "createFile"),
|
|
9244
9167
|
createDataFile: /* @__PURE__ */ __name(function(parent, name, data, canRead, canWrite, canOwn) {
|
|
9245
|
-
var
|
|
9168
|
+
var path = name ? PATH.join2(
|
|
9246
9169
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9247
9170
|
name
|
|
9248
9171
|
) : parent;
|
|
9249
9172
|
var mode = FS.getMode(canRead, canWrite);
|
|
9250
|
-
var node = FS.create(
|
|
9173
|
+
var node = FS.create(path, mode);
|
|
9251
9174
|
if (data) {
|
|
9252
9175
|
if (typeof data === "string") {
|
|
9253
9176
|
var arr = new Array(data.length);
|
|
@@ -9264,7 +9187,7 @@ var require_libzipSync = __commonJS({
|
|
|
9264
9187
|
return node;
|
|
9265
9188
|
}, "createDataFile"),
|
|
9266
9189
|
createDevice: /* @__PURE__ */ __name(function(parent, name, input, output) {
|
|
9267
|
-
var
|
|
9190
|
+
var path = PATH.join2(
|
|
9268
9191
|
typeof parent === "string" ? parent : FS.getPath(parent),
|
|
9269
9192
|
name
|
|
9270
9193
|
);
|
|
@@ -9315,7 +9238,7 @@ var require_libzipSync = __commonJS({
|
|
|
9315
9238
|
return i;
|
|
9316
9239
|
}, "write")
|
|
9317
9240
|
});
|
|
9318
|
-
return FS.mkdev(
|
|
9241
|
+
return FS.mkdev(path, mode, dev);
|
|
9319
9242
|
}, "createDevice"),
|
|
9320
9243
|
forceLoadFile: /* @__PURE__ */ __name(function(obj) {
|
|
9321
9244
|
if (obj.isDevice || obj.isFolder || obj.link || obj.contents)
|
|
@@ -9364,10 +9287,10 @@ var require_libzipSync = __commonJS({
|
|
|
9364
9287
|
var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
|
|
9365
9288
|
var chunkSize = 1024 * 1024;
|
|
9366
9289
|
if (!hasByteServing) chunkSize = datalength;
|
|
9367
|
-
var doXHR = /* @__PURE__ */ __name(function(
|
|
9368
|
-
if (
|
|
9290
|
+
var doXHR = /* @__PURE__ */ __name(function(from2, to) {
|
|
9291
|
+
if (from2 > to)
|
|
9369
9292
|
throw new Error(
|
|
9370
|
-
"invalid range (" +
|
|
9293
|
+
"invalid range (" + from2 + ", " + to + ") or no bytes requested!"
|
|
9371
9294
|
);
|
|
9372
9295
|
if (to > datalength - 1)
|
|
9373
9296
|
throw new Error(
|
|
@@ -9376,7 +9299,7 @@ var require_libzipSync = __commonJS({
|
|
|
9376
9299
|
var xhr2 = new XMLHttpRequest();
|
|
9377
9300
|
xhr2.open("GET", url, false);
|
|
9378
9301
|
if (datalength !== chunkSize)
|
|
9379
|
-
xhr2.setRequestHeader("Range", "bytes=" +
|
|
9302
|
+
xhr2.setRequestHeader("Range", "bytes=" + from2 + "-" + to);
|
|
9380
9303
|
if (typeof Uint8Array != "undefined")
|
|
9381
9304
|
xhr2.responseType = "arraybuffer";
|
|
9382
9305
|
if (xhr2.overrideMimeType) {
|
|
@@ -9561,24 +9484,24 @@ var require_libzipSync = __commonJS({
|
|
|
9561
9484
|
var db = openRequest.result;
|
|
9562
9485
|
var transaction = db.transaction([FS.DB_STORE_NAME], "readwrite");
|
|
9563
9486
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
9564
|
-
var
|
|
9487
|
+
var ok2 = 0, fail = 0, total = paths.length;
|
|
9565
9488
|
function finish() {
|
|
9566
9489
|
if (fail == 0) onload();
|
|
9567
9490
|
else onerror();
|
|
9568
9491
|
}
|
|
9569
9492
|
__name(finish, "finish");
|
|
9570
|
-
paths.forEach(function(
|
|
9493
|
+
paths.forEach(function(path) {
|
|
9571
9494
|
var putRequest = files.put(
|
|
9572
|
-
FS.analyzePath(
|
|
9573
|
-
|
|
9495
|
+
FS.analyzePath(path).object.contents,
|
|
9496
|
+
path
|
|
9574
9497
|
);
|
|
9575
9498
|
putRequest.onsuccess = /* @__PURE__ */ __name(function putRequest_onsuccess() {
|
|
9576
|
-
|
|
9577
|
-
if (
|
|
9499
|
+
ok2++;
|
|
9500
|
+
if (ok2 + fail == total) finish();
|
|
9578
9501
|
}, "putRequest_onsuccess");
|
|
9579
9502
|
putRequest.onerror = /* @__PURE__ */ __name(function putRequest_onerror() {
|
|
9580
9503
|
fail++;
|
|
9581
|
-
if (
|
|
9504
|
+
if (ok2 + fail == total) finish();
|
|
9582
9505
|
}, "putRequest_onerror");
|
|
9583
9506
|
});
|
|
9584
9507
|
transaction.onerror = onerror;
|
|
@@ -9606,32 +9529,32 @@ var require_libzipSync = __commonJS({
|
|
|
9606
9529
|
return;
|
|
9607
9530
|
}
|
|
9608
9531
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
9609
|
-
var
|
|
9532
|
+
var ok2 = 0, fail = 0, total = paths.length;
|
|
9610
9533
|
function finish() {
|
|
9611
9534
|
if (fail == 0) onload();
|
|
9612
9535
|
else onerror();
|
|
9613
9536
|
}
|
|
9614
9537
|
__name(finish, "finish");
|
|
9615
|
-
paths.forEach(function(
|
|
9616
|
-
var getRequest = files.get(
|
|
9538
|
+
paths.forEach(function(path) {
|
|
9539
|
+
var getRequest = files.get(path);
|
|
9617
9540
|
getRequest.onsuccess = /* @__PURE__ */ __name(function getRequest_onsuccess() {
|
|
9618
|
-
if (FS.analyzePath(
|
|
9619
|
-
FS.unlink(
|
|
9541
|
+
if (FS.analyzePath(path).exists) {
|
|
9542
|
+
FS.unlink(path);
|
|
9620
9543
|
}
|
|
9621
9544
|
FS.createDataFile(
|
|
9622
|
-
PATH.dirname(
|
|
9623
|
-
PATH.basename(
|
|
9545
|
+
PATH.dirname(path),
|
|
9546
|
+
PATH.basename(path),
|
|
9624
9547
|
getRequest.result,
|
|
9625
9548
|
true,
|
|
9626
9549
|
true,
|
|
9627
9550
|
true
|
|
9628
9551
|
);
|
|
9629
|
-
|
|
9630
|
-
if (
|
|
9552
|
+
ok2++;
|
|
9553
|
+
if (ok2 + fail == total) finish();
|
|
9631
9554
|
}, "getRequest_onsuccess");
|
|
9632
9555
|
getRequest.onerror = /* @__PURE__ */ __name(function getRequest_onerror() {
|
|
9633
9556
|
fail++;
|
|
9634
|
-
if (
|
|
9557
|
+
if (ok2 + fail == total) finish();
|
|
9635
9558
|
}, "getRequest_onerror");
|
|
9636
9559
|
});
|
|
9637
9560
|
transaction.onerror = onerror;
|
|
@@ -9643,9 +9566,9 @@ var require_libzipSync = __commonJS({
|
|
|
9643
9566
|
mappings: {},
|
|
9644
9567
|
DEFAULT_POLLMASK: 5,
|
|
9645
9568
|
umask: 511,
|
|
9646
|
-
calculateAt: /* @__PURE__ */ __name(function(dirfd,
|
|
9647
|
-
if (
|
|
9648
|
-
return
|
|
9569
|
+
calculateAt: /* @__PURE__ */ __name(function(dirfd, path, allowEmpty) {
|
|
9570
|
+
if (path[0] === "/") {
|
|
9571
|
+
return path;
|
|
9649
9572
|
}
|
|
9650
9573
|
var dir;
|
|
9651
9574
|
if (dirfd === -100) {
|
|
@@ -9655,19 +9578,19 @@ var require_libzipSync = __commonJS({
|
|
|
9655
9578
|
if (!dirstream) throw new FS.ErrnoError(8);
|
|
9656
9579
|
dir = dirstream.path;
|
|
9657
9580
|
}
|
|
9658
|
-
if (
|
|
9581
|
+
if (path.length == 0) {
|
|
9659
9582
|
if (!allowEmpty) {
|
|
9660
9583
|
throw new FS.ErrnoError(44);
|
|
9661
9584
|
}
|
|
9662
9585
|
return dir;
|
|
9663
9586
|
}
|
|
9664
|
-
return PATH.join2(dir,
|
|
9587
|
+
return PATH.join2(dir, path);
|
|
9665
9588
|
}, "calculateAt"),
|
|
9666
|
-
doStat: /* @__PURE__ */ __name(function(func,
|
|
9589
|
+
doStat: /* @__PURE__ */ __name(function(func, path, buf) {
|
|
9667
9590
|
try {
|
|
9668
|
-
var stat = func(
|
|
9591
|
+
var stat = func(path);
|
|
9669
9592
|
} catch (e) {
|
|
9670
|
-
if (e && e.node && PATH.normalize(
|
|
9593
|
+
if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
|
|
9671
9594
|
return -54;
|
|
9672
9595
|
}
|
|
9673
9596
|
throw e;
|
|
@@ -9707,14 +9630,14 @@ var require_libzipSync = __commonJS({
|
|
|
9707
9630
|
var buffer2 = HEAPU8.slice(addr, addr + len);
|
|
9708
9631
|
FS.msync(stream, buffer2, offset, len, flags);
|
|
9709
9632
|
}, "doMsync"),
|
|
9710
|
-
doMkdir: /* @__PURE__ */ __name(function(
|
|
9711
|
-
|
|
9712
|
-
if (
|
|
9713
|
-
|
|
9714
|
-
FS.mkdir(
|
|
9633
|
+
doMkdir: /* @__PURE__ */ __name(function(path, mode) {
|
|
9634
|
+
path = PATH.normalize(path);
|
|
9635
|
+
if (path[path.length - 1] === "/")
|
|
9636
|
+
path = path.substr(0, path.length - 1);
|
|
9637
|
+
FS.mkdir(path, mode, 0);
|
|
9715
9638
|
return 0;
|
|
9716
9639
|
}, "doMkdir"),
|
|
9717
|
-
doMknod: /* @__PURE__ */ __name(function(
|
|
9640
|
+
doMknod: /* @__PURE__ */ __name(function(path, mode, dev) {
|
|
9718
9641
|
switch (mode & 61440) {
|
|
9719
9642
|
case 32768:
|
|
9720
9643
|
case 8192:
|
|
@@ -9725,24 +9648,24 @@ var require_libzipSync = __commonJS({
|
|
|
9725
9648
|
default:
|
|
9726
9649
|
return -28;
|
|
9727
9650
|
}
|
|
9728
|
-
FS.mknod(
|
|
9651
|
+
FS.mknod(path, mode, dev);
|
|
9729
9652
|
return 0;
|
|
9730
9653
|
}, "doMknod"),
|
|
9731
|
-
doReadlink: /* @__PURE__ */ __name(function(
|
|
9654
|
+
doReadlink: /* @__PURE__ */ __name(function(path, buf, bufsize) {
|
|
9732
9655
|
if (bufsize <= 0) return -28;
|
|
9733
|
-
var ret = FS.readlink(
|
|
9656
|
+
var ret = FS.readlink(path);
|
|
9734
9657
|
var len = Math.min(bufsize, lengthBytesUTF8(ret));
|
|
9735
9658
|
var endChar = HEAP8[buf + len];
|
|
9736
9659
|
stringToUTF8(ret, buf, bufsize + 1);
|
|
9737
9660
|
HEAP8[buf + len] = endChar;
|
|
9738
9661
|
return len;
|
|
9739
9662
|
}, "doReadlink"),
|
|
9740
|
-
doAccess: /* @__PURE__ */ __name(function(
|
|
9663
|
+
doAccess: /* @__PURE__ */ __name(function(path, amode) {
|
|
9741
9664
|
if (amode & ~7) {
|
|
9742
9665
|
return -28;
|
|
9743
9666
|
}
|
|
9744
9667
|
var node;
|
|
9745
|
-
var lookup = FS.lookupPath(
|
|
9668
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
9746
9669
|
node = lookup.node;
|
|
9747
9670
|
if (!node) {
|
|
9748
9671
|
return -44;
|
|
@@ -9756,10 +9679,10 @@ var require_libzipSync = __commonJS({
|
|
|
9756
9679
|
}
|
|
9757
9680
|
return 0;
|
|
9758
9681
|
}, "doAccess"),
|
|
9759
|
-
doDup: /* @__PURE__ */ __name(function(
|
|
9682
|
+
doDup: /* @__PURE__ */ __name(function(path, flags, suggestFD) {
|
|
9760
9683
|
var suggest = FS.getStream(suggestFD);
|
|
9761
9684
|
if (suggest) FS.close(suggest);
|
|
9762
|
-
return FS.open(
|
|
9685
|
+
return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
|
|
9763
9686
|
}, "doDup"),
|
|
9764
9687
|
doReadv: /* @__PURE__ */ __name(function(stream, iov, iovcnt, offset) {
|
|
9765
9688
|
var ret = 0;
|
|
@@ -9803,10 +9726,10 @@ var require_libzipSync = __commonJS({
|
|
|
9803
9726
|
return low;
|
|
9804
9727
|
}, "get64")
|
|
9805
9728
|
};
|
|
9806
|
-
function ___sys_chmod(
|
|
9729
|
+
function ___sys_chmod(path, mode) {
|
|
9807
9730
|
try {
|
|
9808
|
-
|
|
9809
|
-
FS.chmod(
|
|
9731
|
+
path = SYSCALLS.getStr(path);
|
|
9732
|
+
FS.chmod(path, mode);
|
|
9810
9733
|
return 0;
|
|
9811
9734
|
} catch (e) {
|
|
9812
9735
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -9932,10 +9855,10 @@ var require_libzipSync = __commonJS({
|
|
|
9932
9855
|
}
|
|
9933
9856
|
}
|
|
9934
9857
|
__name(___sys_ioctl, "___sys_ioctl");
|
|
9935
|
-
function ___sys_open(
|
|
9858
|
+
function ___sys_open(path, flags, varargs) {
|
|
9936
9859
|
SYSCALLS.varargs = varargs;
|
|
9937
9860
|
try {
|
|
9938
|
-
var pathname = SYSCALLS.getStr(
|
|
9861
|
+
var pathname = SYSCALLS.getStr(path);
|
|
9939
9862
|
var mode = varargs ? SYSCALLS.get() : 0;
|
|
9940
9863
|
var stream = FS.open(pathname, flags, mode);
|
|
9941
9864
|
return stream.fd;
|
|
@@ -9959,10 +9882,10 @@ var require_libzipSync = __commonJS({
|
|
|
9959
9882
|
}
|
|
9960
9883
|
}
|
|
9961
9884
|
__name(___sys_rename, "___sys_rename");
|
|
9962
|
-
function ___sys_rmdir(
|
|
9885
|
+
function ___sys_rmdir(path) {
|
|
9963
9886
|
try {
|
|
9964
|
-
|
|
9965
|
-
FS.rmdir(
|
|
9887
|
+
path = SYSCALLS.getStr(path);
|
|
9888
|
+
FS.rmdir(path);
|
|
9966
9889
|
return 0;
|
|
9967
9890
|
} catch (e) {
|
|
9968
9891
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -9971,10 +9894,10 @@ var require_libzipSync = __commonJS({
|
|
|
9971
9894
|
}
|
|
9972
9895
|
}
|
|
9973
9896
|
__name(___sys_rmdir, "___sys_rmdir");
|
|
9974
|
-
function ___sys_stat64(
|
|
9897
|
+
function ___sys_stat64(path, buf) {
|
|
9975
9898
|
try {
|
|
9976
|
-
|
|
9977
|
-
return SYSCALLS.doStat(FS.stat,
|
|
9899
|
+
path = SYSCALLS.getStr(path);
|
|
9900
|
+
return SYSCALLS.doStat(FS.stat, path, buf);
|
|
9978
9901
|
} catch (e) {
|
|
9979
9902
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
9980
9903
|
abort(e);
|
|
@@ -9982,10 +9905,10 @@ var require_libzipSync = __commonJS({
|
|
|
9982
9905
|
}
|
|
9983
9906
|
}
|
|
9984
9907
|
__name(___sys_stat64, "___sys_stat64");
|
|
9985
|
-
function ___sys_unlink(
|
|
9908
|
+
function ___sys_unlink(path) {
|
|
9986
9909
|
try {
|
|
9987
|
-
|
|
9988
|
-
FS.unlink(
|
|
9910
|
+
path = SYSCALLS.getStr(path);
|
|
9911
|
+
FS.unlink(path);
|
|
9989
9912
|
return 0;
|
|
9990
9913
|
} catch (e) {
|
|
9991
9914
|
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError))
|
|
@@ -10216,7 +10139,7 @@ var require_libzipSync = __commonJS({
|
|
|
10216
10139
|
FS.FSNode = FSNode;
|
|
10217
10140
|
FS.staticInit();
|
|
10218
10141
|
if (ENVIRONMENT_IS_NODE) {
|
|
10219
|
-
var
|
|
10142
|
+
var fs = frozenFs;
|
|
10220
10143
|
var NODEJS_PATH = __require("path");
|
|
10221
10144
|
NODEFS.staticInit();
|
|
10222
10145
|
}
|
|
@@ -10678,10 +10601,10 @@ import { resolve as resolve2 } from "node:path";
|
|
|
10678
10601
|
import { once } from "storybook/internal/node-logger";
|
|
10679
10602
|
import { MainFileMissingError } from "storybook/internal/server-errors";
|
|
10680
10603
|
var import_ts_dedent = __toESM(require_dist(), 1);
|
|
10681
|
-
async function validateConfigurationFiles(configDir,
|
|
10604
|
+
async function validateConfigurationFiles(configDir, cwd) {
|
|
10682
10605
|
const extensionsPattern = `{${Array.from(supportedExtensions).join(",")}}`;
|
|
10683
10606
|
const mainConfigMatches = await glob(slash(resolve2(configDir, `main${extensionsPattern}`)), {
|
|
10684
|
-
cwd:
|
|
10607
|
+
cwd: cwd ?? process.cwd()
|
|
10685
10608
|
});
|
|
10686
10609
|
const [mainConfigPath] = mainConfigMatches;
|
|
10687
10610
|
if (mainConfigMatches.length > 1) {
|
|
@@ -11032,136 +10955,76 @@ function createFileSystemCache(options) {
|
|
|
11032
10955
|
__name(createFileSystemCache, "createFileSystemCache");
|
|
11033
10956
|
|
|
11034
10957
|
// src/common/utils/resolve-path-in-sb-cache.ts
|
|
11035
|
-
import { join as
|
|
11036
|
-
|
|
11037
|
-
// node_modules/find-cache-dir/index.js
|
|
11038
|
-
var import_common_path_prefix = __toESM(require_common_path_prefix(), 1);
|
|
11039
|
-
import process2 from "node:process";
|
|
11040
|
-
import path3 from "node:path";
|
|
11041
|
-
import fs from "node:fs";
|
|
11042
|
-
|
|
11043
|
-
// ../node_modules/pkg-dir/index.js
|
|
11044
|
-
import path2 from "node:path";
|
|
10958
|
+
import { join as join4 } from "node:path";
|
|
11045
10959
|
|
|
11046
|
-
// ../node_modules/
|
|
11047
|
-
import
|
|
11048
|
-
import {
|
|
11049
|
-
|
|
11050
|
-
var findUpStop = Symbol("findUpStop");
|
|
11051
|
-
function findUpMultipleSync2(name, options = {}) {
|
|
11052
|
-
let directory = path.resolve(toPath(options.cwd) || "");
|
|
11053
|
-
const { root } = path.parse(directory);
|
|
11054
|
-
const stopAt = options.stopAt || root;
|
|
11055
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
11056
|
-
const paths = [name].flat();
|
|
11057
|
-
const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
|
|
11058
|
-
if (typeof name !== "function") {
|
|
11059
|
-
return locatePathSync(paths, locateOptions);
|
|
11060
|
-
}
|
|
11061
|
-
const foundPath = name(locateOptions.cwd);
|
|
11062
|
-
if (typeof foundPath === "string") {
|
|
11063
|
-
return locatePathSync([foundPath], locateOptions);
|
|
11064
|
-
}
|
|
11065
|
-
return foundPath;
|
|
11066
|
-
}, "runMatcher");
|
|
11067
|
-
const matches = [];
|
|
11068
|
-
while (true) {
|
|
11069
|
-
const foundPath = runMatcher({ ...options, cwd: directory });
|
|
11070
|
-
if (foundPath === findUpStop) {
|
|
11071
|
-
break;
|
|
11072
|
-
}
|
|
11073
|
-
if (foundPath) {
|
|
11074
|
-
matches.push(path.resolve(directory, foundPath));
|
|
11075
|
-
}
|
|
11076
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
11077
|
-
break;
|
|
11078
|
-
}
|
|
11079
|
-
directory = path.dirname(directory);
|
|
11080
|
-
}
|
|
11081
|
-
return matches;
|
|
11082
|
-
}
|
|
11083
|
-
__name(findUpMultipleSync2, "findUpMultipleSync");
|
|
11084
|
-
function findUpSync2(name, options = {}) {
|
|
11085
|
-
const matches = findUpMultipleSync2(name, { ...options, limit: 1 });
|
|
11086
|
-
return matches[0];
|
|
11087
|
-
}
|
|
11088
|
-
__name(findUpSync2, "findUpSync");
|
|
11089
|
-
|
|
11090
|
-
// ../node_modules/pkg-dir/index.js
|
|
11091
|
-
function packageDirectorySync({ cwd: cwd2 } = {}) {
|
|
11092
|
-
const filePath = findUpSync2("package.json", { cwd: cwd2 });
|
|
11093
|
-
return filePath && path2.dirname(filePath);
|
|
11094
|
-
}
|
|
11095
|
-
__name(packageDirectorySync, "packageDirectorySync");
|
|
10960
|
+
// ../node_modules/empathic/package.mjs
|
|
10961
|
+
import { env } from "node:process";
|
|
10962
|
+
import { dirname, join as join3 } from "node:path";
|
|
10963
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
11096
10964
|
|
|
11097
|
-
// node_modules/
|
|
11098
|
-
|
|
11099
|
-
|
|
10965
|
+
// ../node_modules/empathic/access.mjs
|
|
10966
|
+
import { accessSync, constants } from "node:fs";
|
|
10967
|
+
function ok(path, mode) {
|
|
11100
10968
|
try {
|
|
11101
|
-
|
|
10969
|
+
accessSync(path, mode);
|
|
11102
10970
|
return true;
|
|
11103
10971
|
} catch {
|
|
11104
10972
|
return false;
|
|
11105
10973
|
}
|
|
11106
|
-
}, "isWritable");
|
|
11107
|
-
function useDirectory(directory, options) {
|
|
11108
|
-
if (options.create) {
|
|
11109
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
11110
|
-
}
|
|
11111
|
-
return directory;
|
|
11112
10974
|
}
|
|
11113
|
-
__name(
|
|
11114
|
-
function
|
|
11115
|
-
|
|
11116
|
-
if (!isWritable(nodeModules) && (fs.existsSync(nodeModules) || !isWritable(path3.join(directory)))) {
|
|
11117
|
-
return;
|
|
11118
|
-
}
|
|
11119
|
-
return nodeModules;
|
|
10975
|
+
__name(ok, "ok");
|
|
10976
|
+
function writable(path) {
|
|
10977
|
+
return ok(path, constants.W_OK);
|
|
11120
10978
|
}
|
|
11121
|
-
__name(
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
10979
|
+
__name(writable, "writable");
|
|
10980
|
+
|
|
10981
|
+
// ../node_modules/empathic/package.mjs
|
|
10982
|
+
function up2(options) {
|
|
10983
|
+
return up("package.json", options);
|
|
10984
|
+
}
|
|
10985
|
+
__name(up2, "up");
|
|
10986
|
+
function cache(name, options) {
|
|
10987
|
+
options = options || {};
|
|
10988
|
+
let dir = env.CACHE_DIR;
|
|
10989
|
+
if (!dir || /^(1|0|true|false)$/.test(dir)) {
|
|
10990
|
+
let pkg = up2(options);
|
|
10991
|
+
if (dir = pkg && dirname(pkg)) {
|
|
10992
|
+
let mods = join3(dir, "node_modules");
|
|
10993
|
+
let exists = existsSync2(mods);
|
|
10994
|
+
if (!writable(exists ? mods : dir)) return;
|
|
10995
|
+
dir = join3(mods, ".cache");
|
|
10996
|
+
}
|
|
10997
|
+
}
|
|
10998
|
+
if (dir) {
|
|
10999
|
+
dir = join3(dir, name);
|
|
11000
|
+
if (options.create && !existsSync2(dir)) {
|
|
11001
|
+
mkdirSync2(dir, { recursive: true });
|
|
11002
|
+
}
|
|
11003
|
+
return dir;
|
|
11140
11004
|
}
|
|
11141
|
-
return useDirectory(path3.join(directory, "node_modules", ".cache", options.name), options);
|
|
11142
11005
|
}
|
|
11143
|
-
__name(
|
|
11006
|
+
__name(cache, "cache");
|
|
11144
11007
|
|
|
11145
11008
|
// src/common/utils/resolve-path-in-sb-cache.ts
|
|
11146
11009
|
function resolvePathInStorybookCache(fileOrDirectoryName, sub = "default") {
|
|
11147
|
-
let cacheDirectory =
|
|
11148
|
-
cacheDirectory ||=
|
|
11149
|
-
return
|
|
11010
|
+
let cacheDirectory = cache("storybook");
|
|
11011
|
+
cacheDirectory ||= join4(process.cwd(), "node_modules", ".cache", "storybook");
|
|
11012
|
+
return join4(cacheDirectory, sub, fileOrDirectoryName);
|
|
11150
11013
|
}
|
|
11151
11014
|
__name(resolvePathInStorybookCache, "resolvePathInStorybookCache");
|
|
11152
11015
|
|
|
11153
11016
|
// src/common/utils/cache.ts
|
|
11154
|
-
var
|
|
11017
|
+
var cache2 = createFileSystemCache({
|
|
11155
11018
|
basePath: resolvePathInStorybookCache("dev-server"),
|
|
11156
11019
|
ns: "storybook"
|
|
11157
11020
|
// Optional. A grouping namespace for items.
|
|
11158
11021
|
});
|
|
11159
11022
|
|
|
11160
11023
|
// src/common/utils/cli.ts
|
|
11161
|
-
import { createWriteStream, mkdirSync as
|
|
11024
|
+
import { createWriteStream, mkdirSync as mkdirSync3 } from "node:fs";
|
|
11162
11025
|
import { copyFile, readFile as readFile2, realpath, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
|
|
11163
11026
|
import os from "node:os";
|
|
11164
|
-
import { join as
|
|
11027
|
+
import { join as join7 } from "node:path";
|
|
11165
11028
|
|
|
11166
11029
|
// ../node_modules/crypto-random-string/index.js
|
|
11167
11030
|
import { promisify } from "util";
|
|
@@ -11303,12 +11166,12 @@ var satellite_addons_default = [
|
|
|
11303
11166
|
];
|
|
11304
11167
|
|
|
11305
11168
|
// src/common/utils/get-storybook-info.ts
|
|
11306
|
-
import { existsSync as
|
|
11307
|
-
import { dirname as
|
|
11169
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
11170
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
11308
11171
|
|
|
11309
11172
|
// src/common/js-package-manager/JsPackageManager.ts
|
|
11310
11173
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11311
|
-
import { dirname, isAbsolute, join as
|
|
11174
|
+
import { dirname as dirname2, isAbsolute, join as join5, resolve as resolve3 } from "node:path";
|
|
11312
11175
|
import { logger as logger2, prompt } from "storybook/internal/node-logger";
|
|
11313
11176
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
11314
11177
|
import { gt, satisfies } from "semver";
|
|
@@ -11357,7 +11220,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11357
11220
|
}
|
|
11358
11221
|
constructor(options) {
|
|
11359
11222
|
this.cwd = options?.cwd || process.cwd();
|
|
11360
|
-
this.instanceDir = options?.configDir ? isAbsolute(options?.configDir) ?
|
|
11223
|
+
this.instanceDir = options?.configDir ? isAbsolute(options?.configDir) ? dirname2(options?.configDir) : dirname2(join5(this.cwd, options?.configDir)) : this.cwd;
|
|
11361
11224
|
this.packageJsonPaths = _JsPackageManager.listAllPackageJsonPaths(
|
|
11362
11225
|
this.instanceDir,
|
|
11363
11226
|
options?.storiesPaths
|
|
@@ -11365,13 +11228,13 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11365
11228
|
this.primaryPackageJson = this.#getPrimaryPackageJson();
|
|
11366
11229
|
}
|
|
11367
11230
|
isStorybookInMonorepo() {
|
|
11368
|
-
const turboJsonPath =
|
|
11369
|
-
const rushJsonPath =
|
|
11370
|
-
const nxJsonPath =
|
|
11231
|
+
const turboJsonPath = up(`turbo.json`, { last: getProjectRoot() });
|
|
11232
|
+
const rushJsonPath = up(`rush.json`, { last: getProjectRoot() });
|
|
11233
|
+
const nxJsonPath = up(`nx.json`, { last: getProjectRoot() });
|
|
11371
11234
|
if (turboJsonPath || rushJsonPath || nxJsonPath) {
|
|
11372
11235
|
return true;
|
|
11373
11236
|
}
|
|
11374
|
-
const packageJsonPaths =
|
|
11237
|
+
const packageJsonPaths = findFilesUp(["package.json"]);
|
|
11375
11238
|
if (packageJsonPaths.length === 0) {
|
|
11376
11239
|
return false;
|
|
11377
11240
|
}
|
|
@@ -11521,7 +11384,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11521
11384
|
}
|
|
11522
11385
|
});
|
|
11523
11386
|
if (modified) {
|
|
11524
|
-
this.writePackageJson(packageJson,
|
|
11387
|
+
this.writePackageJson(packageJson, dirname2(pjPath));
|
|
11525
11388
|
break;
|
|
11526
11389
|
}
|
|
11527
11390
|
} catch (e) {
|
|
@@ -11712,14 +11575,14 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11712
11575
|
command,
|
|
11713
11576
|
args = [],
|
|
11714
11577
|
stdio,
|
|
11715
|
-
cwd
|
|
11578
|
+
cwd,
|
|
11716
11579
|
ignoreError = false,
|
|
11717
11580
|
env: env2,
|
|
11718
11581
|
...execaOptions
|
|
11719
11582
|
}) {
|
|
11720
11583
|
try {
|
|
11721
11584
|
const commandResult = execaCommandSync([command, ...args].join(" "), {
|
|
11722
|
-
cwd:
|
|
11585
|
+
cwd: cwd ?? this.cwd,
|
|
11723
11586
|
stdio: stdio ?? "pipe",
|
|
11724
11587
|
shell: true,
|
|
11725
11588
|
cleanup: true,
|
|
@@ -11749,13 +11612,13 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11749
11612
|
command,
|
|
11750
11613
|
args = [],
|
|
11751
11614
|
stdio,
|
|
11752
|
-
cwd
|
|
11615
|
+
cwd,
|
|
11753
11616
|
ignoreError = false,
|
|
11754
11617
|
env: env2,
|
|
11755
11618
|
...execaOptions
|
|
11756
11619
|
}) {
|
|
11757
11620
|
const execaProcess = execa([command, ...args].join(" "), {
|
|
11758
|
-
cwd:
|
|
11621
|
+
cwd: cwd ?? this.cwd,
|
|
11759
11622
|
stdio: stdio ?? "pipe",
|
|
11760
11623
|
encoding: "utf8",
|
|
11761
11624
|
shell: true,
|
|
@@ -11804,8 +11667,8 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11804
11667
|
* the dependency.
|
|
11805
11668
|
*/
|
|
11806
11669
|
getDependencyVersion(dependency) {
|
|
11807
|
-
const dependencyVersion = this.packageJsonPaths.map((
|
|
11808
|
-
const packageJson = _JsPackageManager.getPackageJson(
|
|
11670
|
+
const dependencyVersion = this.packageJsonPaths.map((path) => {
|
|
11671
|
+
const packageJson = _JsPackageManager.getPackageJson(path);
|
|
11809
11672
|
return packageJson.dependencies?.[dependency] ?? packageJson.devDependencies?.[dependency];
|
|
11810
11673
|
}).filter(Boolean);
|
|
11811
11674
|
return dependencyVersion[0] ?? null;
|
|
@@ -11850,10 +11713,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11850
11713
|
}
|
|
11851
11714
|
/** List all package.json files starting from the given directory and stopping at the project root. */
|
|
11852
11715
|
static listAllPackageJsonPaths(instanceDir, storiesPaths) {
|
|
11853
|
-
const packageJsonPaths =
|
|
11854
|
-
cwd: instanceDir,
|
|
11855
|
-
stopAt: getProjectRoot()
|
|
11856
|
-
});
|
|
11716
|
+
const packageJsonPaths = findFilesUp(["package.json"], instanceDir);
|
|
11857
11717
|
if (!storiesPaths) {
|
|
11858
11718
|
return packageJsonPaths;
|
|
11859
11719
|
}
|
|
@@ -11864,7 +11724,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11864
11724
|
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
11865
11725
|
});
|
|
11866
11726
|
const relevantPackageJsons = allPackageJsonFiles.filter((packageJsonPath) => {
|
|
11867
|
-
const packageDir =
|
|
11727
|
+
const packageDir = dirname2(packageJsonPath);
|
|
11868
11728
|
return storiesPaths.some((storyPath) => storyPath.startsWith(packageDir));
|
|
11869
11729
|
});
|
|
11870
11730
|
return Array.from(/* @__PURE__ */ new Set([...packageJsonPaths, ...relevantPackageJsons]));
|
|
@@ -11879,7 +11739,7 @@ var JsPackageManager = class _JsPackageManager {
|
|
|
11879
11739
|
return _JsPackageManager.getPackageJsonInfo(finalTargetPackageJsonPath);
|
|
11880
11740
|
}
|
|
11881
11741
|
static getPackageJsonInfo(packageJsonPath) {
|
|
11882
|
-
const operationDir =
|
|
11742
|
+
const operationDir = dirname2(packageJsonPath);
|
|
11883
11743
|
return {
|
|
11884
11744
|
packageJsonPath,
|
|
11885
11745
|
operationDir,
|
|
@@ -11953,7 +11813,7 @@ var findDependency = /* @__PURE__ */ __name(({ dependencies, devDependencies, pe
|
|
|
11953
11813
|
Object.entries(peerDependencies || {}).find(predicate)
|
|
11954
11814
|
], "findDependency");
|
|
11955
11815
|
var getRendererInfo = /* @__PURE__ */ __name((configDir) => {
|
|
11956
|
-
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(
|
|
11816
|
+
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(dirname3(configDir));
|
|
11957
11817
|
for (const packageJsonPath of packageJsonPaths) {
|
|
11958
11818
|
const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
11959
11819
|
const [dep, devDep, peerDep] = findDependency(packageJson, ([key]) => rendererPackages[key]);
|
|
@@ -11972,13 +11832,13 @@ var getRendererInfo = /* @__PURE__ */ __name((configDir) => {
|
|
|
11972
11832
|
}, "getRendererInfo");
|
|
11973
11833
|
var validConfigExtensions = ["ts", "js", "tsx", "jsx", "mjs", "cjs"];
|
|
11974
11834
|
var findConfigFile = /* @__PURE__ */ __name((prefix, configDir) => {
|
|
11975
|
-
const filePrefix =
|
|
11976
|
-
const extension = validConfigExtensions.find((ext) =>
|
|
11835
|
+
const filePrefix = join6(configDir, prefix);
|
|
11836
|
+
const extension = validConfigExtensions.find((ext) => existsSync3(`${filePrefix}.${ext}`));
|
|
11977
11837
|
return extension ? `${filePrefix}.${extension}` : null;
|
|
11978
11838
|
}, "findConfigFile");
|
|
11979
11839
|
var getConfigInfo = /* @__PURE__ */ __name((configDir) => {
|
|
11980
11840
|
let storybookConfigDir = configDir ?? ".storybook";
|
|
11981
|
-
if (!
|
|
11841
|
+
if (!existsSync3(storybookConfigDir)) {
|
|
11982
11842
|
const packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(storybookConfigDir);
|
|
11983
11843
|
for (const packageJsonPath of packageJsonPaths) {
|
|
11984
11844
|
const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
@@ -12010,10 +11870,10 @@ var getStorybookInfo = /* @__PURE__ */ __name((configDir = ".storybook") => {
|
|
|
12010
11870
|
|
|
12011
11871
|
// src/common/utils/cli.ts
|
|
12012
11872
|
var tempDir = /* @__PURE__ */ __name(() => realpath(os.tmpdir()), "tempDir");
|
|
12013
|
-
var getPath = /* @__PURE__ */ __name(async (prefix = "") =>
|
|
11873
|
+
var getPath = /* @__PURE__ */ __name(async (prefix = "") => join7(await tempDir(), prefix + uniqueString()), "getPath");
|
|
12014
11874
|
async function temporaryDirectory({ prefix = "" } = {}) {
|
|
12015
11875
|
const directory = await getPath(prefix);
|
|
12016
|
-
|
|
11876
|
+
mkdirSync3(directory);
|
|
12017
11877
|
return directory;
|
|
12018
11878
|
}
|
|
12019
11879
|
__name(temporaryDirectory, "temporaryDirectory");
|
|
@@ -12022,7 +11882,7 @@ async function temporaryFile({ name, extension } = {}) {
|
|
|
12022
11882
|
if (extension !== void 0 && extension !== null) {
|
|
12023
11883
|
throw new Error("The `name` and `extension` options are mutually exclusive");
|
|
12024
11884
|
}
|
|
12025
|
-
return
|
|
11885
|
+
return join7(await temporaryDirectory(), name);
|
|
12026
11886
|
}
|
|
12027
11887
|
return await getPath() + (extension === void 0 || extension === null ? "" : "." + extension.replace(/^\./, ""));
|
|
12028
11888
|
}
|
|
@@ -12052,7 +11912,7 @@ function getEnvConfig(program, configEnv) {
|
|
|
12052
11912
|
}
|
|
12053
11913
|
__name(getEnvConfig, "getEnvConfig");
|
|
12054
11914
|
var createLogStream = /* @__PURE__ */ __name(async (logFileName = "storybook.log") => {
|
|
12055
|
-
const finalLogPath =
|
|
11915
|
+
const finalLogPath = join7(process.cwd(), logFileName);
|
|
12056
11916
|
const temporaryLogPath = await temporaryFile({ name: logFileName });
|
|
12057
11917
|
const logStream = createWriteStream(temporaryLogPath, { encoding: "utf8" });
|
|
12058
11918
|
return new Promise((resolve8, reject) => {
|
|
@@ -12208,24 +12068,20 @@ __name(extractProperRendererNameFromFramework, "extractProperRendererNameFromFra
|
|
|
12208
12068
|
|
|
12209
12069
|
// src/common/utils/get-storybook-refs.ts
|
|
12210
12070
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
12211
|
-
import { dirname as
|
|
12071
|
+
import { dirname as dirname4, join as join8 } from "node:path";
|
|
12212
12072
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
12213
|
-
var import_resolve_from = __toESM(require_resolve_from(), 1);
|
|
12214
12073
|
var getAutoRefs = /* @__PURE__ */ __name(async (options) => {
|
|
12215
|
-
const location =
|
|
12216
|
-
cwd: options.configDir,
|
|
12217
|
-
stopAt: getProjectRoot()
|
|
12218
|
-
});
|
|
12074
|
+
const location = up2({ cwd: options.configDir, last: getProjectRoot() });
|
|
12219
12075
|
if (!location) {
|
|
12220
12076
|
return {};
|
|
12221
12077
|
}
|
|
12222
|
-
const directory =
|
|
12078
|
+
const directory = dirname4(location);
|
|
12223
12079
|
const { dependencies = [], devDependencies = [] } = JSON.parse(await readFile3(location, { encoding: "utf8" })) || {};
|
|
12224
12080
|
const deps = Object.keys({ ...dependencies, ...devDependencies });
|
|
12225
12081
|
const list = await Promise.all(
|
|
12226
12082
|
deps.map(async (d) => {
|
|
12227
12083
|
try {
|
|
12228
|
-
const l = (
|
|
12084
|
+
const l = from(directory, join8(d, "package.json"));
|
|
12229
12085
|
const { storybook, name, version } = JSON.parse(await readFile3(l, { encoding: "utf8" })) || {};
|
|
12230
12086
|
if (storybook?.url) {
|
|
12231
12087
|
return { id: name, ...storybook, version };
|
|
@@ -12254,8 +12110,8 @@ var getAutoRefs = /* @__PURE__ */ __name(async (options) => {
|
|
|
12254
12110
|
);
|
|
12255
12111
|
}, "getAutoRefs");
|
|
12256
12112
|
var checkRef = /* @__PURE__ */ __name((url) => fetch(`${url}/iframe.html`).then(
|
|
12257
|
-
async ({ ok, status }) => {
|
|
12258
|
-
if (
|
|
12113
|
+
async ({ ok: ok2, status }) => {
|
|
12114
|
+
if (ok2) {
|
|
12259
12115
|
if (status !== 200) {
|
|
12260
12116
|
return false;
|
|
12261
12117
|
}
|
|
@@ -12266,7 +12122,7 @@ var checkRef = /* @__PURE__ */ __name((url) => fetch(`${url}/iframe.html`).then(
|
|
|
12266
12122
|
return false;
|
|
12267
12123
|
}
|
|
12268
12124
|
}
|
|
12269
|
-
return
|
|
12125
|
+
return ok2;
|
|
12270
12126
|
},
|
|
12271
12127
|
() => false
|
|
12272
12128
|
), "checkRef");
|
|
@@ -12294,8 +12150,8 @@ async function getRefs(options) {
|
|
|
12294
12150
|
});
|
|
12295
12151
|
await Promise.all(
|
|
12296
12152
|
Object.entries(refs).map(async ([k, value]) => {
|
|
12297
|
-
const
|
|
12298
|
-
refs[k] = { ...value, type:
|
|
12153
|
+
const ok2 = await checkRef(value.url);
|
|
12154
|
+
refs[k] = { ...value, type: ok2 ? "server-checked" : "unknown" };
|
|
12299
12155
|
})
|
|
12300
12156
|
);
|
|
12301
12157
|
return refs;
|
|
@@ -12356,9 +12212,9 @@ import { relative, resolve as resolve4 } from "node:path";
|
|
|
12356
12212
|
import { MainFileEvaluationError } from "storybook/internal/server-errors";
|
|
12357
12213
|
async function loadMainConfig({
|
|
12358
12214
|
configDir = ".storybook",
|
|
12359
|
-
cwd
|
|
12215
|
+
cwd
|
|
12360
12216
|
}) {
|
|
12361
|
-
await validateConfigurationFiles(configDir,
|
|
12217
|
+
await validateConfigurationFiles(configDir, cwd);
|
|
12362
12218
|
const mainPath = getInterpretedFile(resolve4(configDir, "main"));
|
|
12363
12219
|
try {
|
|
12364
12220
|
const out = await importModule(mainPath);
|
|
@@ -12476,7 +12332,7 @@ __name(logConfig, "logConfig");
|
|
|
12476
12332
|
// src/common/utils/normalize-stories.ts
|
|
12477
12333
|
var pico2 = __toESM(require_picomatch(), 1);
|
|
12478
12334
|
import { lstatSync } from "node:fs";
|
|
12479
|
-
import { basename, dirname as
|
|
12335
|
+
import { basename, dirname as dirname5, relative as relative2, resolve as resolve7 } from "node:path";
|
|
12480
12336
|
import { InvalidStoriesEntryError } from "storybook/internal/server-errors";
|
|
12481
12337
|
var DEFAULT_TITLE_PREFIX = "";
|
|
12482
12338
|
var DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|jsx|mjs|ts|tsx))";
|
|
@@ -12517,7 +12373,7 @@ var normalizeStoriesEntry = /* @__PURE__ */ __name((entry, { configDir, workingD
|
|
|
12517
12373
|
} else {
|
|
12518
12374
|
specifierWithoutMatcher = {
|
|
12519
12375
|
titlePrefix: DEFAULT_TITLE_PREFIX,
|
|
12520
|
-
directory:
|
|
12376
|
+
directory: dirname5(entry),
|
|
12521
12377
|
files: basename(entry)
|
|
12522
12378
|
};
|
|
12523
12379
|
}
|
|
@@ -12603,7 +12459,7 @@ function isPreservingSymlinks() {
|
|
|
12603
12459
|
__name(isPreservingSymlinks, "isPreservingSymlinks");
|
|
12604
12460
|
|
|
12605
12461
|
// src/common/utils/template.ts
|
|
12606
|
-
import { existsSync as
|
|
12462
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
12607
12463
|
var interpolate2 = /* @__PURE__ */ __name((string, data = {}) => Object.entries(data).reduce((acc, [k, v]) => acc.replace(new RegExp(`%${k}%`, "g"), v), string), "interpolate");
|
|
12608
12464
|
function getPreviewBodyTemplate(configDirPath, interpolations) {
|
|
12609
12465
|
const base = readFileSync4(
|
|
@@ -12612,7 +12468,7 @@ function getPreviewBodyTemplate(configDirPath, interpolations) {
|
|
|
12612
12468
|
);
|
|
12613
12469
|
const bodyHtmlPath = resolve(configDirPath, "preview-body.html");
|
|
12614
12470
|
let result = base;
|
|
12615
|
-
if (
|
|
12471
|
+
if (existsSync4(bodyHtmlPath)) {
|
|
12616
12472
|
result = readFileSync4(bodyHtmlPath, "utf8") + result;
|
|
12617
12473
|
}
|
|
12618
12474
|
return interpolate2(result, interpolations);
|
|
@@ -12625,7 +12481,7 @@ function getPreviewHeadTemplate(configDirPath, interpolations) {
|
|
|
12625
12481
|
);
|
|
12626
12482
|
const headHtmlPath = resolve(configDirPath, "preview-head.html");
|
|
12627
12483
|
let result = base;
|
|
12628
|
-
if (
|
|
12484
|
+
if (existsSync4(headHtmlPath)) {
|
|
12629
12485
|
result += readFileSync4(headHtmlPath, "utf8");
|
|
12630
12486
|
}
|
|
12631
12487
|
return interpolate2(result, interpolations);
|
|
@@ -12633,7 +12489,7 @@ function getPreviewHeadTemplate(configDirPath, interpolations) {
|
|
|
12633
12489
|
__name(getPreviewHeadTemplate, "getPreviewHeadTemplate");
|
|
12634
12490
|
|
|
12635
12491
|
// src/common/utils/validate-config.ts
|
|
12636
|
-
import { join as
|
|
12492
|
+
import { join as join9 } from "node:path";
|
|
12637
12493
|
import {
|
|
12638
12494
|
CouldNotEvaluateFrameworkError,
|
|
12639
12495
|
InvalidFrameworkNameError,
|
|
@@ -12652,7 +12508,7 @@ function validateFrameworkName(frameworkName) {
|
|
|
12652
12508
|
return;
|
|
12653
12509
|
}
|
|
12654
12510
|
try {
|
|
12655
|
-
resolveModulePath(
|
|
12511
|
+
resolveModulePath(join9(frameworkName, "preset"), {
|
|
12656
12512
|
extensions: [".mjs", ".js", ".cjs"],
|
|
12657
12513
|
conditions: ["node", "import", "require"]
|
|
12658
12514
|
});
|
|
@@ -12915,9 +12771,9 @@ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
|
12915
12771
|
import { basename as basename2, parse as parse2, relative as relative4 } from "node:path";
|
|
12916
12772
|
|
|
12917
12773
|
// src/common/js-package-manager/BUNProxy.ts
|
|
12918
|
-
import {
|
|
12774
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
12919
12775
|
import { platform } from "node:os";
|
|
12920
|
-
import { join as
|
|
12776
|
+
import { join as join10 } from "node:path";
|
|
12921
12777
|
import { logger as logger9 } from "storybook/internal/node-logger";
|
|
12922
12778
|
import { FindPackageVersionsError } from "storybook/internal/server-errors";
|
|
12923
12779
|
import sort from "semver/functions/sort.js";
|
|
@@ -12976,13 +12832,8 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
12976
12832
|
return `bunx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
12977
12833
|
}
|
|
12978
12834
|
async getModulePackageJSON(packageName) {
|
|
12979
|
-
const
|
|
12980
|
-
|
|
12981
|
-
const possiblePath = join9(dir, "node_modules", packageName, "package.json");
|
|
12982
|
-
return existsSync4(possiblePath) ? possiblePath : void 0;
|
|
12983
|
-
},
|
|
12984
|
-
{ cwd: this.cwd, stopAt: getProjectRoot() }
|
|
12985
|
-
);
|
|
12835
|
+
const wantedPath = join10("node_modules", packageName, "package.json");
|
|
12836
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
12986
12837
|
if (!packageJsonPath) {
|
|
12987
12838
|
return null;
|
|
12988
12839
|
}
|
|
@@ -12995,24 +12846,24 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
12995
12846
|
}
|
|
12996
12847
|
return this.installArgs;
|
|
12997
12848
|
}
|
|
12998
|
-
runPackageCommandSync(command, args,
|
|
12849
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
12999
12850
|
return this.executeCommandSync({
|
|
13000
12851
|
command: "bun",
|
|
13001
12852
|
args: ["run", command, ...args],
|
|
13002
|
-
cwd
|
|
12853
|
+
cwd,
|
|
13003
12854
|
stdio
|
|
13004
12855
|
});
|
|
13005
12856
|
}
|
|
13006
|
-
runPackageCommand(command, args,
|
|
12857
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13007
12858
|
return this.executeCommand({
|
|
13008
12859
|
command: "bun",
|
|
13009
12860
|
args: ["run", command, ...args],
|
|
13010
|
-
cwd
|
|
12861
|
+
cwd,
|
|
13011
12862
|
stdio
|
|
13012
12863
|
});
|
|
13013
12864
|
}
|
|
13014
|
-
runInternalCommand(command, args,
|
|
13015
|
-
return this.executeCommand({ command: "bun", args: [command, ...args], cwd
|
|
12865
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
12866
|
+
return this.executeCommand({ command: "bun", args: [command, ...args], cwd, stdio });
|
|
13016
12867
|
}
|
|
13017
12868
|
async findInstallations(pattern, { depth = 99 } = {}) {
|
|
13018
12869
|
const exec = /* @__PURE__ */ __name(async ({ packageDepth }) => {
|
|
@@ -13026,15 +12877,15 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13026
12877
|
});
|
|
13027
12878
|
}, "exec");
|
|
13028
12879
|
try {
|
|
13029
|
-
const
|
|
13030
|
-
const result = await
|
|
12880
|
+
const process3 = await exec({ packageDepth: depth });
|
|
12881
|
+
const result = await process3;
|
|
13031
12882
|
const commandResult = result.stdout ?? "";
|
|
13032
12883
|
const parsedOutput = JSON.parse(commandResult);
|
|
13033
12884
|
return this.mapDependencies(parsedOutput, pattern);
|
|
13034
12885
|
} catch (e) {
|
|
13035
12886
|
try {
|
|
13036
|
-
const
|
|
13037
|
-
const result = await
|
|
12887
|
+
const process3 = await exec({ packageDepth: 0 });
|
|
12888
|
+
const result = await process3;
|
|
13038
12889
|
const commandResult = result.stdout ?? "";
|
|
13039
12890
|
const parsedOutput = JSON.parse(commandResult);
|
|
13040
12891
|
return this.mapDependencies(parsedOutput, pattern);
|
|
@@ -13061,13 +12912,13 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13061
12912
|
});
|
|
13062
12913
|
}
|
|
13063
12914
|
async getRegistryURL() {
|
|
13064
|
-
const
|
|
12915
|
+
const process3 = this.executeCommand({
|
|
13065
12916
|
command: "npm",
|
|
13066
12917
|
// "npm config" commands are not allowed in workspaces per default
|
|
13067
12918
|
// https://github.com/npm/cli/issues/6099#issuecomment-1847584792
|
|
13068
12919
|
args: ["config", "get", "registry", "-ws=false", "-iwr"]
|
|
13069
12920
|
});
|
|
13070
|
-
const result = await
|
|
12921
|
+
const result = await process3;
|
|
13071
12922
|
const url = (result.stdout ?? "").trim();
|
|
13072
12923
|
return url === "undefined" ? void 0 : url;
|
|
13073
12924
|
}
|
|
@@ -13086,11 +12937,11 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13086
12937
|
async runGetVersions(packageName, fetchAllVersions) {
|
|
13087
12938
|
const args = fetchAllVersions ? ["versions", "--json"] : ["version"];
|
|
13088
12939
|
try {
|
|
13089
|
-
const
|
|
12940
|
+
const process3 = this.executeCommand({
|
|
13090
12941
|
command: "npm",
|
|
13091
12942
|
args: ["info", packageName, ...args]
|
|
13092
12943
|
});
|
|
13093
|
-
const result = await
|
|
12944
|
+
const result = await process3;
|
|
13094
12945
|
const commandResult = result.stdout ?? "";
|
|
13095
12946
|
const parsedOutput = fetchAllVersions ? JSON.parse(commandResult) : commandResult.trim();
|
|
13096
12947
|
if (parsedOutput.error?.summary) {
|
|
@@ -13162,9 +13013,9 @@ var BUNProxy = class extends JsPackageManager {
|
|
|
13162
13013
|
};
|
|
13163
13014
|
|
|
13164
13015
|
// src/common/js-package-manager/NPMProxy.ts
|
|
13165
|
-
import {
|
|
13016
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
13166
13017
|
import { platform as platform2 } from "node:os";
|
|
13167
|
-
import { join as
|
|
13018
|
+
import { join as join11 } from "node:path";
|
|
13168
13019
|
import { logger as logger10, prompt as prompt2 } from "storybook/internal/node-logger";
|
|
13169
13020
|
import { FindPackageVersionsError as FindPackageVersionsError2 } from "storybook/internal/server-errors";
|
|
13170
13021
|
import sort2 from "semver/functions/sort.js";
|
|
@@ -13217,13 +13068,8 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13217
13068
|
return `npx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13218
13069
|
}
|
|
13219
13070
|
async getModulePackageJSON(packageName) {
|
|
13220
|
-
const
|
|
13221
|
-
|
|
13222
|
-
const possiblePath = join10(dir, "node_modules", packageName, "package.json");
|
|
13223
|
-
return existsSync5(possiblePath) ? possiblePath : void 0;
|
|
13224
|
-
},
|
|
13225
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13226
|
-
);
|
|
13071
|
+
const wantedPath = join11("node_modules", packageName, "package.json");
|
|
13072
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13227
13073
|
if (!packageJsonPath) {
|
|
13228
13074
|
return null;
|
|
13229
13075
|
}
|
|
@@ -13236,27 +13082,27 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13236
13082
|
}
|
|
13237
13083
|
return this.installArgs;
|
|
13238
13084
|
}
|
|
13239
|
-
runPackageCommandSync(command, args,
|
|
13085
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13240
13086
|
return this.executeCommandSync({
|
|
13241
13087
|
command: "npm",
|
|
13242
13088
|
args: ["exec", "--", command, ...args],
|
|
13243
|
-
cwd
|
|
13089
|
+
cwd,
|
|
13244
13090
|
stdio
|
|
13245
13091
|
});
|
|
13246
13092
|
}
|
|
13247
|
-
runPackageCommand(command, args,
|
|
13093
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13248
13094
|
return this.executeCommand({
|
|
13249
13095
|
command: "npm",
|
|
13250
13096
|
args: ["exec", "--", command, ...args],
|
|
13251
|
-
cwd
|
|
13097
|
+
cwd,
|
|
13252
13098
|
stdio
|
|
13253
13099
|
});
|
|
13254
13100
|
}
|
|
13255
|
-
runInternalCommand(command, args,
|
|
13101
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13256
13102
|
return this.executeCommand({
|
|
13257
13103
|
command: "npm",
|
|
13258
13104
|
args: [command, ...args],
|
|
13259
|
-
cwd
|
|
13105
|
+
cwd,
|
|
13260
13106
|
stdio
|
|
13261
13107
|
});
|
|
13262
13108
|
}
|
|
@@ -13306,13 +13152,13 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13306
13152
|
});
|
|
13307
13153
|
}
|
|
13308
13154
|
async getRegistryURL() {
|
|
13309
|
-
const
|
|
13155
|
+
const process3 = this.executeCommand({
|
|
13310
13156
|
command: "npm",
|
|
13311
13157
|
// "npm config" commands are not allowed in workspaces per default
|
|
13312
13158
|
// https://github.com/npm/cli/issues/6099#issuecomment-1847584792
|
|
13313
13159
|
args: ["config", "get", "registry", "-ws=false", "-iwr"]
|
|
13314
13160
|
});
|
|
13315
|
-
const result = await
|
|
13161
|
+
const result = await process3;
|
|
13316
13162
|
const url = (result.stdout ?? "").trim();
|
|
13317
13163
|
return url === "undefined" ? void 0 : url;
|
|
13318
13164
|
}
|
|
@@ -13331,11 +13177,11 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13331
13177
|
async runGetVersions(packageName, fetchAllVersions) {
|
|
13332
13178
|
const args = fetchAllVersions ? ["versions", "--json"] : ["version"];
|
|
13333
13179
|
try {
|
|
13334
|
-
const
|
|
13180
|
+
const process3 = this.executeCommand({
|
|
13335
13181
|
command: "npm",
|
|
13336
13182
|
args: ["info", packageName, ...args]
|
|
13337
13183
|
});
|
|
13338
|
-
const result = await
|
|
13184
|
+
const result = await process3;
|
|
13339
13185
|
const commandResult = result.stdout ?? "";
|
|
13340
13186
|
const parsedOutput = fetchAllVersions ? JSON.parse(commandResult) : commandResult.trim();
|
|
13341
13187
|
if (parsedOutput.error?.summary) {
|
|
@@ -13408,7 +13254,7 @@ var NPMProxy = class extends JsPackageManager {
|
|
|
13408
13254
|
|
|
13409
13255
|
// src/common/js-package-manager/PNPMProxy.ts
|
|
13410
13256
|
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
13411
|
-
import { join as
|
|
13257
|
+
import { join as join12 } from "node:path";
|
|
13412
13258
|
import { pathToFileURL } from "node:url";
|
|
13413
13259
|
import { prompt as prompt3 } from "storybook/internal/node-logger";
|
|
13414
13260
|
import { FindPackageVersionsError as FindPackageVersionsError3 } from "storybook/internal/server-errors";
|
|
@@ -13448,27 +13294,27 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13448
13294
|
}
|
|
13449
13295
|
return this.installArgs;
|
|
13450
13296
|
}
|
|
13451
|
-
runPackageCommandSync(command, args,
|
|
13297
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13452
13298
|
return this.executeCommandSync({
|
|
13453
13299
|
command: "pnpm",
|
|
13454
13300
|
args: ["exec", command, ...args],
|
|
13455
|
-
cwd
|
|
13301
|
+
cwd,
|
|
13456
13302
|
stdio
|
|
13457
13303
|
});
|
|
13458
13304
|
}
|
|
13459
|
-
runPackageCommand(command, args,
|
|
13305
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13460
13306
|
return this.executeCommand({
|
|
13461
13307
|
command: "pnpm",
|
|
13462
13308
|
args: ["exec", command, ...args],
|
|
13463
|
-
cwd
|
|
13309
|
+
cwd,
|
|
13464
13310
|
stdio
|
|
13465
13311
|
});
|
|
13466
13312
|
}
|
|
13467
|
-
runInternalCommand(command, args,
|
|
13313
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13468
13314
|
return this.executeCommand({
|
|
13469
13315
|
command: "pnpm",
|
|
13470
13316
|
args: [command, ...args],
|
|
13471
|
-
cwd
|
|
13317
|
+
cwd,
|
|
13472
13318
|
stdio
|
|
13473
13319
|
});
|
|
13474
13320
|
}
|
|
@@ -13498,9 +13344,9 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13498
13344
|
}
|
|
13499
13345
|
}
|
|
13500
13346
|
async getModulePackageJSON(packageName) {
|
|
13501
|
-
const pnpapiPath =
|
|
13347
|
+
const pnpapiPath = any([".pnp.js", ".pnp.cjs"], {
|
|
13502
13348
|
cwd: this.primaryPackageJson.operationDir,
|
|
13503
|
-
|
|
13349
|
+
last: getProjectRoot()
|
|
13504
13350
|
});
|
|
13505
13351
|
if (pnpapiPath) {
|
|
13506
13352
|
try {
|
|
@@ -13511,7 +13357,7 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13511
13357
|
const pkgLocator = pnpApi.findPackageLocator(resolvedPath);
|
|
13512
13358
|
const pkg = pnpApi.getPackageInformation(pkgLocator);
|
|
13513
13359
|
const packageJSON = JSON.parse(
|
|
13514
|
-
readFileSync7(
|
|
13360
|
+
readFileSync7(join12(pkg.packageLocation, "package.json"), "utf-8")
|
|
13515
13361
|
);
|
|
13516
13362
|
return packageJSON;
|
|
13517
13363
|
} catch (error) {
|
|
@@ -13521,13 +13367,8 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13521
13367
|
return null;
|
|
13522
13368
|
}
|
|
13523
13369
|
}
|
|
13524
|
-
const
|
|
13525
|
-
|
|
13526
|
-
const possiblePath = join11(dir, "node_modules", packageName, "package.json");
|
|
13527
|
-
return existsSync6(possiblePath) ? possiblePath : void 0;
|
|
13528
|
-
},
|
|
13529
|
-
{ cwd: this.cwd, stopAt: getProjectRoot() }
|
|
13530
|
-
);
|
|
13370
|
+
const wantedPath = join12("node_modules", packageName, "package.json");
|
|
13371
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13531
13372
|
if (!packageJsonPath) {
|
|
13532
13373
|
return null;
|
|
13533
13374
|
}
|
|
@@ -13565,11 +13406,11 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13565
13406
|
async runGetVersions(packageName, fetchAllVersions) {
|
|
13566
13407
|
const args = fetchAllVersions ? ["versions", "--json"] : ["version"];
|
|
13567
13408
|
try {
|
|
13568
|
-
const
|
|
13409
|
+
const process3 = this.executeCommand({
|
|
13569
13410
|
command: "pnpm",
|
|
13570
13411
|
args: ["info", packageName, ...args]
|
|
13571
13412
|
});
|
|
13572
|
-
const result = await
|
|
13413
|
+
const result = await process3;
|
|
13573
13414
|
const commandResult = result.stdout ?? "";
|
|
13574
13415
|
const parsedOutput = fetchAllVersions ? JSON.parse(commandResult) : commandResult.trim();
|
|
13575
13416
|
if (parsedOutput.error?.summary) {
|
|
@@ -13638,9 +13479,9 @@ var PNPMProxy = class extends JsPackageManager {
|
|
|
13638
13479
|
};
|
|
13639
13480
|
|
|
13640
13481
|
// src/common/js-package-manager/Yarn1Proxy.ts
|
|
13641
|
-
import {
|
|
13642
|
-
import { join as
|
|
13643
|
-
import
|
|
13482
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
13483
|
+
import { join as join13 } from "node:path";
|
|
13484
|
+
import process2 from "node:process";
|
|
13644
13485
|
import { prompt as prompt4 } from "storybook/internal/node-logger";
|
|
13645
13486
|
import { FindPackageVersionsError as FindPackageVersionsError4 } from "storybook/internal/server-errors";
|
|
13646
13487
|
|
|
@@ -13665,7 +13506,7 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13665
13506
|
}
|
|
13666
13507
|
getInstallArgs() {
|
|
13667
13508
|
if (!this.installArgs) {
|
|
13668
|
-
this.installArgs =
|
|
13509
|
+
this.installArgs = process2.env.CI ? [] : ["--ignore-workspace-root-check"];
|
|
13669
13510
|
}
|
|
13670
13511
|
return this.installArgs;
|
|
13671
13512
|
}
|
|
@@ -13675,28 +13516,23 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13675
13516
|
getRemoteRunCommand(pkg, args, specifier) {
|
|
13676
13517
|
return `npx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13677
13518
|
}
|
|
13678
|
-
runPackageCommandSync(command, args,
|
|
13519
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13679
13520
|
return this.executeCommandSync({
|
|
13680
13521
|
command: `yarn`,
|
|
13681
13522
|
args: ["exec", command, ...args],
|
|
13682
|
-
cwd
|
|
13523
|
+
cwd,
|
|
13683
13524
|
stdio
|
|
13684
13525
|
});
|
|
13685
13526
|
}
|
|
13686
|
-
runPackageCommand(command, args,
|
|
13687
|
-
return this.executeCommand({ command: `yarn`, args: ["exec", command, ...args], cwd
|
|
13527
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13528
|
+
return this.executeCommand({ command: `yarn`, args: ["exec", command, ...args], cwd, stdio });
|
|
13688
13529
|
}
|
|
13689
|
-
runInternalCommand(command, args,
|
|
13690
|
-
return this.executeCommand({ command: `yarn`, args: [command, ...args], cwd
|
|
13530
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13531
|
+
return this.executeCommand({ command: `yarn`, args: [command, ...args], cwd, stdio });
|
|
13691
13532
|
}
|
|
13692
13533
|
async getModulePackageJSON(packageName) {
|
|
13693
|
-
const
|
|
13694
|
-
|
|
13695
|
-
const possiblePath = join12(dir, "node_modules", packageName, "package.json");
|
|
13696
|
-
return existsSync7(possiblePath) ? possiblePath : void 0;
|
|
13697
|
-
},
|
|
13698
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13699
|
-
);
|
|
13534
|
+
const wantedPath = join13("node_modules", packageName, "package.json");
|
|
13535
|
+
const packageJsonPath = up(wantedPath, { cwd: this.cwd, last: getProjectRoot() });
|
|
13700
13536
|
if (!packageJsonPath) {
|
|
13701
13537
|
return null;
|
|
13702
13538
|
}
|
|
@@ -13716,7 +13552,7 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13716
13552
|
yarnArgs.push("--recursive");
|
|
13717
13553
|
}
|
|
13718
13554
|
try {
|
|
13719
|
-
const
|
|
13555
|
+
const process3 = this.executeCommand({
|
|
13720
13556
|
command: "yarn",
|
|
13721
13557
|
args: yarnArgs.concat(pattern),
|
|
13722
13558
|
env: {
|
|
@@ -13724,7 +13560,7 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13724
13560
|
},
|
|
13725
13561
|
cwd: this.instanceDir
|
|
13726
13562
|
});
|
|
13727
|
-
const result = await
|
|
13563
|
+
const result = await process3;
|
|
13728
13564
|
const commandResult = result.stdout ?? "";
|
|
13729
13565
|
const parsedOutput = JSON.parse(commandResult);
|
|
13730
13566
|
return this.mapDependencies(parsedOutput, pattern);
|
|
@@ -13763,11 +13599,11 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13763
13599
|
async runGetVersions(packageName, fetchAllVersions) {
|
|
13764
13600
|
const args = [fetchAllVersions ? "versions" : "version", "--json"];
|
|
13765
13601
|
try {
|
|
13766
|
-
const
|
|
13602
|
+
const process3 = this.executeCommand({
|
|
13767
13603
|
command: "yarn",
|
|
13768
13604
|
args: ["info", packageName, ...args]
|
|
13769
13605
|
});
|
|
13770
|
-
const result = await
|
|
13606
|
+
const result = await process3;
|
|
13771
13607
|
const commandResult = result.stdout ?? "";
|
|
13772
13608
|
const parsedOutput = JSON.parse(commandResult);
|
|
13773
13609
|
if (parsedOutput.type === "inspect") {
|
|
@@ -13833,8 +13669,8 @@ var Yarn1Proxy = class extends JsPackageManager {
|
|
|
13833
13669
|
// src/common/js-package-manager/Yarn2Proxy.ts
|
|
13834
13670
|
var import_fslib = __toESM(require_lib(), 1);
|
|
13835
13671
|
var import_libzip = __toESM(require_sync(), 1);
|
|
13836
|
-
import {
|
|
13837
|
-
import { join as
|
|
13672
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
13673
|
+
import { join as join14 } from "node:path";
|
|
13838
13674
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
13839
13675
|
import { prompt as prompt5 } from "storybook/internal/node-logger";
|
|
13840
13676
|
import { FindPackageVersionsError as FindPackageVersionsError5 } from "storybook/internal/server-errors";
|
|
@@ -13913,19 +13749,19 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13913
13749
|
getRemoteRunCommand(pkg, args, specifier) {
|
|
13914
13750
|
return `yarn dlx ${pkg}${specifier ? `@${specifier}` : ""} ${args.join(" ")}`;
|
|
13915
13751
|
}
|
|
13916
|
-
runPackageCommandSync(command, args,
|
|
13752
|
+
runPackageCommandSync(command, args, cwd, stdio) {
|
|
13917
13753
|
return this.executeCommandSync({
|
|
13918
13754
|
command: "yarn",
|
|
13919
13755
|
args: ["exec", command, ...args],
|
|
13920
|
-
cwd
|
|
13756
|
+
cwd,
|
|
13921
13757
|
stdio
|
|
13922
13758
|
});
|
|
13923
13759
|
}
|
|
13924
|
-
runPackageCommand(command, args,
|
|
13925
|
-
return this.executeCommand({ command: "yarn", args: ["exec", command, ...args], cwd
|
|
13760
|
+
runPackageCommand(command, args, cwd, stdio) {
|
|
13761
|
+
return this.executeCommand({ command: "yarn", args: ["exec", command, ...args], cwd, stdio });
|
|
13926
13762
|
}
|
|
13927
|
-
runInternalCommand(command, args,
|
|
13928
|
-
return this.executeCommand({ command: "yarn", args: [command, ...args], cwd
|
|
13763
|
+
runInternalCommand(command, args, cwd, stdio) {
|
|
13764
|
+
return this.executeCommand({ command: "yarn", args: [command, ...args], cwd, stdio });
|
|
13929
13765
|
}
|
|
13930
13766
|
async findInstallations(pattern, { depth = 99 } = {}) {
|
|
13931
13767
|
const yarnArgs = ["info", "--name-only"];
|
|
@@ -13948,9 +13784,9 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13948
13784
|
}
|
|
13949
13785
|
}
|
|
13950
13786
|
async getModulePackageJSON(packageName) {
|
|
13951
|
-
const pnpapiPath =
|
|
13787
|
+
const pnpapiPath = any([".pnp.js", ".pnp.cjs"], {
|
|
13952
13788
|
cwd: this.cwd,
|
|
13953
|
-
|
|
13789
|
+
last: getProjectRoot()
|
|
13954
13790
|
});
|
|
13955
13791
|
if (pnpapiPath) {
|
|
13956
13792
|
try {
|
|
@@ -13969,7 +13805,7 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13969
13805
|
});
|
|
13970
13806
|
const virtualFs = new import_fslib.VirtualFS({ baseFs: zipOpenFs });
|
|
13971
13807
|
const crossFs = new import_fslib.PosixFS(virtualFs);
|
|
13972
|
-
const virtualPath =
|
|
13808
|
+
const virtualPath = join14(pkg.packageLocation, "package.json");
|
|
13973
13809
|
return crossFs.readJsonSync(virtualPath);
|
|
13974
13810
|
} catch (error) {
|
|
13975
13811
|
if (error.code !== "ERR_MODULE_NOT_FOUND") {
|
|
@@ -13978,13 +13814,11 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
13978
13814
|
return null;
|
|
13979
13815
|
}
|
|
13980
13816
|
}
|
|
13981
|
-
const
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
{ cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() }
|
|
13987
|
-
);
|
|
13817
|
+
const wantedPath = join14("node_modules", packageName, "package.json");
|
|
13818
|
+
const packageJsonPath = up(wantedPath, {
|
|
13819
|
+
cwd: this.primaryPackageJson.operationDir,
|
|
13820
|
+
last: getProjectRoot()
|
|
13821
|
+
});
|
|
13988
13822
|
if (!packageJsonPath) {
|
|
13989
13823
|
return null;
|
|
13990
13824
|
}
|
|
@@ -14019,11 +13853,11 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
14019
13853
|
});
|
|
14020
13854
|
}
|
|
14021
13855
|
async getRegistryURL() {
|
|
14022
|
-
const
|
|
13856
|
+
const process3 = this.executeCommand({
|
|
14023
13857
|
command: "yarn",
|
|
14024
13858
|
args: ["config", "get", "npmRegistryServer"]
|
|
14025
13859
|
});
|
|
14026
|
-
const result = await
|
|
13860
|
+
const result = await process3;
|
|
14027
13861
|
const url = (result.stdout ?? "").trim();
|
|
14028
13862
|
return url === "undefined" ? void 0 : url;
|
|
14029
13863
|
}
|
|
@@ -14031,11 +13865,11 @@ var Yarn2Proxy = class extends JsPackageManager {
|
|
|
14031
13865
|
const field = fetchAllVersions ? "versions" : "version";
|
|
14032
13866
|
const args = ["--fields", field, "--json"];
|
|
14033
13867
|
try {
|
|
14034
|
-
const
|
|
13868
|
+
const process3 = this.executeCommand({
|
|
14035
13869
|
command: "yarn",
|
|
14036
13870
|
args: ["npm", "info", packageName, ...args]
|
|
14037
13871
|
});
|
|
14038
|
-
const result = await
|
|
13872
|
+
const result = await process3;
|
|
14039
13873
|
const commandResult = result.stdout ?? "";
|
|
14040
13874
|
const parsedOutput = JSON.parse(commandResult);
|
|
14041
13875
|
return parsedOutput[field];
|
|
@@ -14110,8 +13944,8 @@ var JsPackageManagerFactory = class {
|
|
|
14110
13944
|
this.cache = /* @__PURE__ */ new Map();
|
|
14111
13945
|
}
|
|
14112
13946
|
/** Generate a cache key based on the parameters */
|
|
14113
|
-
static getCacheKey(force, configDir = ".storybook",
|
|
14114
|
-
return JSON.stringify({ force: force || null, configDir, cwd
|
|
13947
|
+
static getCacheKey(force, configDir = ".storybook", cwd = process.cwd(), storiesPaths) {
|
|
13948
|
+
return JSON.stringify({ force: force || null, configDir, cwd, storiesPaths });
|
|
14115
13949
|
}
|
|
14116
13950
|
/** Clear the package manager cache */
|
|
14117
13951
|
static clearCache() {
|
|
@@ -14124,14 +13958,14 @@ var JsPackageManagerFactory = class {
|
|
|
14124
13958
|
* @returns Package manager type as string: 'npm', 'pnpm', 'bun', 'yarn1', or 'yarn2'
|
|
14125
13959
|
* @throws Error if no usable package manager is found
|
|
14126
13960
|
*/
|
|
14127
|
-
static getPackageManagerType(
|
|
13961
|
+
static getPackageManagerType(cwd = process.cwd()) {
|
|
14128
13962
|
const root = getProjectRoot();
|
|
14129
13963
|
const lockFiles = [
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
13964
|
+
up(YARN_LOCKFILE, { cwd, last: root }),
|
|
13965
|
+
up(PNPM_LOCKFILE, { cwd, last: root }),
|
|
13966
|
+
up(NPM_LOCKFILE, { cwd, last: root }),
|
|
13967
|
+
up(BUN_LOCKFILE, { cwd, last: root }),
|
|
13968
|
+
up(BUN_LOCKFILE_BINARY, { cwd, last: root })
|
|
14135
13969
|
].filter(Boolean).sort((a, b) => {
|
|
14136
13970
|
const dirA = parse2(a).dir;
|
|
14137
13971
|
const dirB = parse2(b).dir;
|
|
@@ -14146,18 +13980,18 @@ var JsPackageManagerFactory = class {
|
|
|
14146
13980
|
});
|
|
14147
13981
|
const closestLockfilePath = lockFiles[0];
|
|
14148
13982
|
const closestLockfile = closestLockfilePath && basename2(closestLockfilePath);
|
|
14149
|
-
const yarnVersion = getYarnVersion(
|
|
13983
|
+
const yarnVersion = getYarnVersion(cwd);
|
|
14150
13984
|
if (yarnVersion && closestLockfile === YARN_LOCKFILE) {
|
|
14151
13985
|
return yarnVersion === 1 ? "yarn1" : "yarn2";
|
|
14152
13986
|
}
|
|
14153
|
-
if (hasPNPM(
|
|
13987
|
+
if (hasPNPM(cwd) && closestLockfile === PNPM_LOCKFILE) {
|
|
14154
13988
|
return "pnpm";
|
|
14155
13989
|
}
|
|
14156
|
-
const isNPMCommandOk = hasNPM(
|
|
13990
|
+
const isNPMCommandOk = hasNPM(cwd);
|
|
14157
13991
|
if (isNPMCommandOk && closestLockfile === NPM_LOCKFILE) {
|
|
14158
13992
|
return "npm";
|
|
14159
13993
|
}
|
|
14160
|
-
if (hasBun(
|
|
13994
|
+
if (hasBun(cwd) && (closestLockfile === BUN_LOCKFILE || closestLockfile === BUN_LOCKFILE_BINARY)) {
|
|
14161
13995
|
return "bun";
|
|
14162
13996
|
}
|
|
14163
13997
|
const inferredPackageManager = this.inferPackageManagerFromUserAgent();
|
|
@@ -14174,19 +14008,19 @@ var JsPackageManagerFactory = class {
|
|
|
14174
14008
|
configDir = ".storybook",
|
|
14175
14009
|
storiesPaths,
|
|
14176
14010
|
ignoreCache = false
|
|
14177
|
-
} = {},
|
|
14178
|
-
const cacheKey = this.getCacheKey(force, configDir,
|
|
14011
|
+
} = {}, cwd = process.cwd()) {
|
|
14012
|
+
const cacheKey = this.getCacheKey(force, configDir, cwd, storiesPaths);
|
|
14179
14013
|
const cached = this.cache.get(cacheKey);
|
|
14180
14014
|
if (cached && !ignoreCache) {
|
|
14181
14015
|
return cached;
|
|
14182
14016
|
}
|
|
14183
14017
|
if (force && force in this.PROXY_MAP) {
|
|
14184
|
-
const packageManager2 = new this.PROXY_MAP[force]({ cwd
|
|
14018
|
+
const packageManager2 = new this.PROXY_MAP[force]({ cwd, configDir, storiesPaths });
|
|
14185
14019
|
this.cache.set(cacheKey, packageManager2);
|
|
14186
14020
|
return packageManager2;
|
|
14187
14021
|
}
|
|
14188
|
-
const packageManagerType = this.getPackageManagerType(
|
|
14189
|
-
const packageManager = new this.PROXY_MAP[packageManagerType]({ cwd
|
|
14022
|
+
const packageManagerType = this.getPackageManagerType(cwd);
|
|
14023
|
+
const packageManager = new this.PROXY_MAP[packageManagerType]({ cwd, configDir, storiesPaths });
|
|
14190
14024
|
this.cache.set(cacheKey, packageManager);
|
|
14191
14025
|
return packageManager;
|
|
14192
14026
|
}
|
|
@@ -14223,9 +14057,9 @@ var JsPackageManagerFactory = class {
|
|
|
14223
14057
|
return void 0;
|
|
14224
14058
|
}
|
|
14225
14059
|
};
|
|
14226
|
-
function hasNPM(
|
|
14060
|
+
function hasNPM(cwd) {
|
|
14227
14061
|
const npmVersionCommand = (0, import_cross_spawn.sync)("npm --version", {
|
|
14228
|
-
cwd
|
|
14062
|
+
cwd,
|
|
14229
14063
|
shell: true,
|
|
14230
14064
|
env: {
|
|
14231
14065
|
...process.env,
|
|
@@ -14235,9 +14069,9 @@ function hasNPM(cwd2) {
|
|
|
14235
14069
|
return npmVersionCommand.status === 0;
|
|
14236
14070
|
}
|
|
14237
14071
|
__name(hasNPM, "hasNPM");
|
|
14238
|
-
function hasBun(
|
|
14072
|
+
function hasBun(cwd) {
|
|
14239
14073
|
const pnpmVersionCommand = (0, import_cross_spawn.sync)("bun --version", {
|
|
14240
|
-
cwd
|
|
14074
|
+
cwd,
|
|
14241
14075
|
shell: true,
|
|
14242
14076
|
env: {
|
|
14243
14077
|
...process.env,
|
|
@@ -14247,9 +14081,9 @@ function hasBun(cwd2) {
|
|
|
14247
14081
|
return pnpmVersionCommand.status === 0;
|
|
14248
14082
|
}
|
|
14249
14083
|
__name(hasBun, "hasBun");
|
|
14250
|
-
function hasPNPM(
|
|
14084
|
+
function hasPNPM(cwd) {
|
|
14251
14085
|
const pnpmVersionCommand = (0, import_cross_spawn.sync)("pnpm --version", {
|
|
14252
|
-
cwd
|
|
14086
|
+
cwd,
|
|
14253
14087
|
shell: true,
|
|
14254
14088
|
env: {
|
|
14255
14089
|
...process.env,
|
|
@@ -14259,9 +14093,9 @@ function hasPNPM(cwd2) {
|
|
|
14259
14093
|
return pnpmVersionCommand.status === 0;
|
|
14260
14094
|
}
|
|
14261
14095
|
__name(hasPNPM, "hasPNPM");
|
|
14262
|
-
function getYarnVersion(
|
|
14096
|
+
function getYarnVersion(cwd) {
|
|
14263
14097
|
const yarnVersionCommand = (0, import_cross_spawn.sync)("yarn --version", {
|
|
14264
|
-
cwd
|
|
14098
|
+
cwd,
|
|
14265
14099
|
shell: true,
|
|
14266
14100
|
env: {
|
|
14267
14101
|
...process.env,
|
|
@@ -14293,7 +14127,7 @@ async function scanAndTransformFiles({
|
|
|
14293
14127
|
initial: defaultGlob
|
|
14294
14128
|
});
|
|
14295
14129
|
console.log("Scanning for affected files...");
|
|
14296
|
-
const globby = (await import("./globby-
|
|
14130
|
+
const globby = (await import("./globby-DASPUXWI.js")).globby;
|
|
14297
14131
|
const sourceFiles = await globby([glob2], {
|
|
14298
14132
|
...commonGlobOptions(""),
|
|
14299
14133
|
ignore: ["**/node_modules/**"],
|
|
@@ -14311,8 +14145,8 @@ import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises
|
|
|
14311
14145
|
function transformImports(source, renamedImports) {
|
|
14312
14146
|
let hasChanges = false;
|
|
14313
14147
|
let transformed = source;
|
|
14314
|
-
for (const [
|
|
14315
|
-
const regex = new RegExp(`(['"])${
|
|
14148
|
+
for (const [from2, to] of Object.entries(renamedImports)) {
|
|
14149
|
+
const regex = new RegExp(`(['"])${from2}(/.*)?\\1`, "g");
|
|
14316
14150
|
if (regex.test(transformed)) {
|
|
14317
14151
|
transformed = transformed.replace(regex, `$1${to}$2$1`);
|
|
14318
14152
|
hasChanges = true;
|
|
@@ -14323,7 +14157,7 @@ function transformImports(source, renamedImports) {
|
|
|
14323
14157
|
__name(transformImports, "transformImports");
|
|
14324
14158
|
var transformImportFiles = /* @__PURE__ */ __name(async (files, renamedImports, dryRun) => {
|
|
14325
14159
|
const errors = [];
|
|
14326
|
-
const { default: pLimit } = await import("./p-limit-
|
|
14160
|
+
const { default: pLimit } = await import("./p-limit-HVR3I7TJ.js");
|
|
14327
14161
|
const limit = pLimit(10);
|
|
14328
14162
|
await Promise.all(
|
|
14329
14163
|
files.map(
|
|
@@ -14345,6 +14179,7 @@ var transformImportFiles = /* @__PURE__ */ __name(async (files, renamedImports,
|
|
|
14345
14179
|
|
|
14346
14180
|
export {
|
|
14347
14181
|
userOrAutoTitleFromSpecifier,
|
|
14182
|
+
up2 as up,
|
|
14348
14183
|
supportedExtensions,
|
|
14349
14184
|
getInterpretedFile,
|
|
14350
14185
|
validateConfigurationFiles,
|
|
@@ -14356,7 +14191,7 @@ export {
|
|
|
14356
14191
|
FileSystemCache,
|
|
14357
14192
|
createFileSystemCache,
|
|
14358
14193
|
resolvePathInStorybookCache,
|
|
14359
|
-
cache,
|
|
14194
|
+
cache2 as cache,
|
|
14360
14195
|
HandledError,
|
|
14361
14196
|
COMMON_ENV_VARS,
|
|
14362
14197
|
getPackageDetails,
|