@procore/storybook-addon 4.7.1 → 4.7.2
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/CHANGELOG.md +10 -0
- package/README.md +9 -11
- package/dist/legacy/index.cjs +7 -5247
- package/dist/legacy/index.d.cts +1 -1
- package/dist/legacy/index.d.ts +1 -1
- package/dist/legacy/index.js +3 -5234
- package/dist/legacy/preset.cjs +249 -42
- package/dist/legacy/preset.d.cts +8 -88
- package/dist/legacy/preset.d.ts +8 -88
- package/dist/legacy/preset.js +250 -43
- package/dist/modern/index.cjs +7 -5247
- package/dist/modern/index.d.cts +1 -1
- package/dist/modern/index.d.ts +1 -1
- package/dist/modern/index.js +3 -5234
- package/dist/modern/preset.cjs +249 -42
- package/dist/modern/preset.d.cts +8 -88
- package/dist/modern/preset.d.ts +8 -88
- package/dist/modern/preset.js +250 -43
- package/package.json +16 -11
- package/preset.js +0 -1
package/dist/legacy/preset.js
CHANGED
|
@@ -23,15 +23,241 @@ var require_getCacheIdentifier = __commonJS({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// src/configurations/babel.ts
|
|
26
|
-
var import_getCacheIdentifier = __toESM(require_getCacheIdentifier(), 1);
|
|
27
26
|
import { version as babelRuntimeVersion } from "@babel/runtime/package.json";
|
|
28
27
|
import { version as corejsVersion } from "core-js/package.json";
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
30
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
31
|
+
function normalizeWindowsPath(input = "") {
|
|
32
|
+
if (!input) {
|
|
33
|
+
return input;
|
|
34
|
+
}
|
|
35
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
36
|
+
}
|
|
37
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
38
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
39
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
40
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
41
|
+
var sep = "/";
|
|
42
|
+
var delimiter = ":";
|
|
43
|
+
var normalize = function(path2) {
|
|
44
|
+
if (path2.length === 0) {
|
|
45
|
+
return ".";
|
|
46
|
+
}
|
|
47
|
+
path2 = normalizeWindowsPath(path2);
|
|
48
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
49
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
50
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
51
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
52
|
+
if (path2.length === 0) {
|
|
53
|
+
if (isPathAbsolute) {
|
|
54
|
+
return "/";
|
|
55
|
+
}
|
|
56
|
+
return trailingSeparator ? "./" : ".";
|
|
57
|
+
}
|
|
58
|
+
if (trailingSeparator) {
|
|
59
|
+
path2 += "/";
|
|
60
|
+
}
|
|
61
|
+
if (_DRIVE_LETTER_RE.test(path2)) {
|
|
62
|
+
path2 += "/";
|
|
63
|
+
}
|
|
64
|
+
if (isUNCPath) {
|
|
65
|
+
if (!isPathAbsolute) {
|
|
66
|
+
return `//./${path2}`;
|
|
67
|
+
}
|
|
68
|
+
return `//${path2}`;
|
|
69
|
+
}
|
|
70
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
71
|
+
};
|
|
72
|
+
var join = function(...arguments_) {
|
|
73
|
+
if (arguments_.length === 0) {
|
|
74
|
+
return ".";
|
|
75
|
+
}
|
|
76
|
+
let joined;
|
|
77
|
+
for (const argument of arguments_) {
|
|
78
|
+
if (argument && argument.length > 0) {
|
|
79
|
+
if (joined === void 0) {
|
|
80
|
+
joined = argument;
|
|
81
|
+
} else {
|
|
82
|
+
joined += `/${argument}`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (joined === void 0) {
|
|
87
|
+
return ".";
|
|
88
|
+
}
|
|
89
|
+
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
90
|
+
};
|
|
91
|
+
function cwd() {
|
|
92
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
93
|
+
return process.cwd().replace(/\\/g, "/");
|
|
94
|
+
}
|
|
95
|
+
return "/";
|
|
96
|
+
}
|
|
97
|
+
var resolve = function(...arguments_) {
|
|
98
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
99
|
+
let resolvedPath = "";
|
|
100
|
+
let resolvedAbsolute = false;
|
|
101
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
102
|
+
const path2 = index >= 0 ? arguments_[index] : cwd();
|
|
103
|
+
if (!path2 || path2.length === 0) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
resolvedPath = `${path2}/${resolvedPath}`;
|
|
107
|
+
resolvedAbsolute = isAbsolute(path2);
|
|
108
|
+
}
|
|
109
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
110
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
111
|
+
return `/${resolvedPath}`;
|
|
112
|
+
}
|
|
113
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
114
|
+
};
|
|
115
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
116
|
+
let res = "";
|
|
117
|
+
let lastSegmentLength = 0;
|
|
118
|
+
let lastSlash = -1;
|
|
119
|
+
let dots = 0;
|
|
120
|
+
let char = null;
|
|
121
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
122
|
+
if (index < path2.length) {
|
|
123
|
+
char = path2[index];
|
|
124
|
+
} else if (char === "/") {
|
|
125
|
+
break;
|
|
126
|
+
} else {
|
|
127
|
+
char = "/";
|
|
128
|
+
}
|
|
129
|
+
if (char === "/") {
|
|
130
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
131
|
+
else if (dots === 2) {
|
|
132
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
133
|
+
if (res.length > 2) {
|
|
134
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
135
|
+
if (lastSlashIndex === -1) {
|
|
136
|
+
res = "";
|
|
137
|
+
lastSegmentLength = 0;
|
|
138
|
+
} else {
|
|
139
|
+
res = res.slice(0, lastSlashIndex);
|
|
140
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
141
|
+
}
|
|
142
|
+
lastSlash = index;
|
|
143
|
+
dots = 0;
|
|
144
|
+
continue;
|
|
145
|
+
} else if (res.length > 0) {
|
|
146
|
+
res = "";
|
|
147
|
+
lastSegmentLength = 0;
|
|
148
|
+
lastSlash = index;
|
|
149
|
+
dots = 0;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (allowAboveRoot) {
|
|
154
|
+
res += res.length > 0 ? "/.." : "..";
|
|
155
|
+
lastSegmentLength = 2;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
if (res.length > 0) {
|
|
159
|
+
res += `/${path2.slice(lastSlash + 1, index)}`;
|
|
160
|
+
} else {
|
|
161
|
+
res = path2.slice(lastSlash + 1, index);
|
|
162
|
+
}
|
|
163
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
164
|
+
}
|
|
165
|
+
lastSlash = index;
|
|
166
|
+
dots = 0;
|
|
167
|
+
} else if (char === "." && dots !== -1) {
|
|
168
|
+
++dots;
|
|
169
|
+
} else {
|
|
170
|
+
dots = -1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return res;
|
|
174
|
+
}
|
|
175
|
+
var isAbsolute = function(p) {
|
|
176
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
177
|
+
};
|
|
178
|
+
var toNamespacedPath = function(p) {
|
|
179
|
+
return normalizeWindowsPath(p);
|
|
180
|
+
};
|
|
181
|
+
var _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
182
|
+
var extname = function(p) {
|
|
183
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
184
|
+
return match && match[1] || "";
|
|
185
|
+
};
|
|
186
|
+
var relative = function(from, to) {
|
|
187
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
188
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
189
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
190
|
+
return _to.join("/");
|
|
191
|
+
}
|
|
192
|
+
const _fromCopy = [..._from];
|
|
193
|
+
for (const segment of _fromCopy) {
|
|
194
|
+
if (_to[0] !== segment) {
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
_from.shift();
|
|
198
|
+
_to.shift();
|
|
199
|
+
}
|
|
200
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
201
|
+
};
|
|
202
|
+
var dirname = function(p) {
|
|
203
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
204
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
|
|
205
|
+
segments[0] += "/";
|
|
206
|
+
}
|
|
207
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
208
|
+
};
|
|
209
|
+
var format = function(p) {
|
|
210
|
+
const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
|
|
211
|
+
return normalizeWindowsPath(
|
|
212
|
+
p.root ? resolve(...segments) : segments.join("/")
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
var basename = function(p, extension) {
|
|
216
|
+
const lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
217
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
218
|
+
};
|
|
219
|
+
var parse = function(p) {
|
|
220
|
+
const root = normalizeWindowsPath(p).split("/").shift() || "/";
|
|
221
|
+
const base = basename(p);
|
|
222
|
+
const extension = extname(base);
|
|
223
|
+
return {
|
|
224
|
+
root,
|
|
225
|
+
dir: dirname(p),
|
|
226
|
+
base,
|
|
227
|
+
ext: extension,
|
|
228
|
+
name: base.slice(0, base.length - extension.length)
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
var path = {
|
|
232
|
+
__proto__: null,
|
|
233
|
+
basename,
|
|
234
|
+
delimiter,
|
|
235
|
+
dirname,
|
|
236
|
+
extname,
|
|
237
|
+
format,
|
|
238
|
+
isAbsolute,
|
|
239
|
+
join,
|
|
240
|
+
normalize,
|
|
241
|
+
normalizeString,
|
|
242
|
+
parse,
|
|
243
|
+
relative,
|
|
244
|
+
resolve,
|
|
245
|
+
sep,
|
|
246
|
+
toNamespacedPath
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/configurations/babel.ts
|
|
250
|
+
var import_getCacheIdentifier = __toESM(require_getCacheIdentifier(), 1);
|
|
29
251
|
var targets = "defaults";
|
|
30
252
|
var transformRuntimeOptions = {
|
|
31
253
|
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
32
254
|
// explicitly resolving to match the provided helper functions.
|
|
33
255
|
// https://github.com/babel/babel/issues/10261
|
|
34
|
-
version: babelRuntimeVersion
|
|
256
|
+
version: babelRuntimeVersion,
|
|
257
|
+
// Undocumented option that lets us encapsulate our runtime, ensuring
|
|
258
|
+
// the correct version is used
|
|
259
|
+
// https://github.com/babel/babel/blob/090c364a90fe73d36a30707fc612ce037bdbbb24/packages/babel-plugin-transform-runtime/src/index.js#L35-L42
|
|
260
|
+
absoluteRuntime: path.dirname(__require.resolve("@babel/runtime/package.json"))
|
|
35
261
|
};
|
|
36
262
|
function createConfigForReact() {
|
|
37
263
|
const env = process.env.NODE_ENV || "development";
|
|
@@ -148,66 +374,47 @@ function requireIfExists(moduleName) {
|
|
|
148
374
|
}
|
|
149
375
|
|
|
150
376
|
// src/preset.ts
|
|
377
|
+
var findBabelConfig = __require("find-babel-config");
|
|
151
378
|
var addons = () => {
|
|
152
379
|
const sassImplementation = requireIfExists("sass");
|
|
153
380
|
return [
|
|
154
381
|
{
|
|
155
|
-
name: "@storybook/addon-styling
|
|
382
|
+
name: "@storybook/addon-styling",
|
|
156
383
|
options: {
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
use: [
|
|
161
|
-
"style-loader",
|
|
162
|
-
{
|
|
163
|
-
loader: "css-loader",
|
|
164
|
-
options: {
|
|
165
|
-
modules: {
|
|
166
|
-
localIdentName: "[name]__[local]--[hash:base64:5]"
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
loader: "sass-loader",
|
|
172
|
-
options: {
|
|
173
|
-
...sassImplementation ? { implementation: sassImplementation } : {}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
test: /\.css$/,
|
|
180
|
-
use: [
|
|
181
|
-
"style-loader",
|
|
182
|
-
{
|
|
183
|
-
loader: "css-loader",
|
|
184
|
-
options: {
|
|
185
|
-
modules: {
|
|
186
|
-
localIdentName: "[name]__[local]--[hash:base64:5]"
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
]
|
|
384
|
+
...sassImplementation ? {
|
|
385
|
+
sass: {
|
|
386
|
+
implementation: sassImplementation
|
|
191
387
|
}
|
|
192
|
-
|
|
388
|
+
} : {},
|
|
389
|
+
cssModules: { localIdentName: "[name]__[local]--[hash:base64:5]" }
|
|
193
390
|
}
|
|
194
391
|
},
|
|
195
|
-
"@storybook/addon-
|
|
392
|
+
"@storybook/addon-essentials",
|
|
393
|
+
"@storybook/addon-storysource",
|
|
196
394
|
"@storybook/addon-a11y"
|
|
197
395
|
];
|
|
198
396
|
};
|
|
199
|
-
function babelDefault() {
|
|
397
|
+
function babelDefault(config) {
|
|
398
|
+
const cwd2 = process.cwd();
|
|
399
|
+
const { file } = findBabelConfig.sync(cwd2, 1);
|
|
400
|
+
if (file) {
|
|
401
|
+
return config;
|
|
402
|
+
}
|
|
403
|
+
console.log(
|
|
404
|
+
"Could not find babel config file, using babel config from @procore/storybook-addon"
|
|
405
|
+
);
|
|
200
406
|
return createConfigForReact();
|
|
201
407
|
}
|
|
202
408
|
var typescript = {
|
|
203
|
-
checkOptions: {
|
|
409
|
+
checkOptions: {
|
|
410
|
+
check: true,
|
|
411
|
+
exclude: /node_modules/
|
|
412
|
+
},
|
|
204
413
|
reactDocgen: false
|
|
205
414
|
};
|
|
206
|
-
var preset_default = { addons, babelDefault, typescript, previewHead: previewHead_default };
|
|
207
415
|
export {
|
|
208
416
|
addons,
|
|
209
417
|
babelDefault,
|
|
210
|
-
preset_default as default,
|
|
211
418
|
previewHead_default as previewHead,
|
|
212
419
|
typescript
|
|
213
420
|
};
|