@procore/storybook-addon 4.7.2 → 5.0.0

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.
@@ -23,241 +23,15 @@ var require_getCacheIdentifier = __commonJS({
23
23
  });
24
24
 
25
25
  // src/configurations/babel.ts
26
+ var import_getCacheIdentifier = __toESM(require_getCacheIdentifier(), 1);
26
27
  import { version as babelRuntimeVersion } from "@babel/runtime/package.json";
27
28
  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);
251
29
  var targets = "defaults";
252
30
  var transformRuntimeOptions = {
253
31
  // By default, babel assumes babel/runtime version 7.0.0-beta.0,
254
32
  // explicitly resolving to match the provided helper functions.
255
33
  // https://github.com/babel/babel/issues/10261
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"))
34
+ version: babelRuntimeVersion
261
35
  };
262
36
  function createConfigForReact() {
263
37
  const env = process.env.NODE_ENV || "development";
@@ -374,47 +148,66 @@ function requireIfExists(moduleName) {
374
148
  }
375
149
 
376
150
  // src/preset.ts
377
- var findBabelConfig = __require("find-babel-config");
378
151
  var addons = () => {
379
152
  const sassImplementation = requireIfExists("sass");
380
153
  return [
381
154
  {
382
- name: "@storybook/addon-styling",
155
+ name: "@storybook/addon-styling-webpack",
383
156
  options: {
384
- ...sassImplementation ? {
385
- sass: {
386
- implementation: sassImplementation
157
+ rules: [
158
+ {
159
+ test: /\.scss$/,
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
+ ]
387
191
  }
388
- } : {},
389
- cssModules: { localIdentName: "[name]__[local]--[hash:base64:5]" }
192
+ ]
390
193
  }
391
194
  },
392
- "@storybook/addon-essentials",
393
- "@storybook/addon-storysource",
195
+ "@storybook/addon-docs",
394
196
  "@storybook/addon-a11y"
395
197
  ];
396
198
  };
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
- );
199
+ function babelDefault() {
406
200
  return createConfigForReact();
407
201
  }
408
202
  var typescript = {
409
- checkOptions: {
410
- check: true,
411
- exclude: /node_modules/
412
- },
203
+ checkOptions: { check: true, exclude: /node_modules/ },
413
204
  reactDocgen: false
414
205
  };
206
+ var preset_default = { addons, babelDefault, typescript, previewHead: previewHead_default };
415
207
  export {
416
208
  addons,
417
209
  babelDefault,
210
+ preset_default as default,
418
211
  previewHead_default as previewHead,
419
212
  typescript
420
213
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/storybook-addon",
3
- "version": "4.7.2",
3
+ "version": "5.0.0",
4
4
  "description": "Procore Storybook Configuration",
5
5
  "author": "Procore Technologies",
6
6
  "homepage": "https://github.com/procore/frontend-tooling#readme",
@@ -31,14 +31,8 @@
31
31
  }
32
32
  },
33
33
  "./preset": {
34
- "import": {
35
- "types": "./dist/modern/preset.d.ts",
36
- "default": "./dist/modern/preset.js"
37
- },
38
- "require": {
39
- "types": "./dist/modern/preset.d.cts",
40
- "default": "./dist/modern/preset.cjs"
41
- }
34
+ "types": "./dist/modern/preset.d.cts",
35
+ "default": "./dist/modern/preset.cjs"
42
36
  },
43
37
  "./package.json": "./package.json"
44
38
  },
@@ -46,7 +40,8 @@
46
40
  "module": "dist/legacy/index.js",
47
41
  "types": "dist/legacy/index.d.ts",
48
42
  "files": [
49
- "dist"
43
+ "dist",
44
+ "preset.js"
50
45
  ],
51
46
  "scripts": {
52
47
  "build": "hammer lib:build",
@@ -70,16 +65,16 @@
70
65
  "@babel/preset-react": "^7.23.3",
71
66
  "@babel/preset-typescript": "^7.23.3",
72
67
  "@babel/runtime": "^7.26.10",
73
- "@storybook/addon-a11y": "^7.6.20",
74
- "@storybook/addon-essentials": "^7.6.20",
75
- "@storybook/addon-storysource": "^7.6.20",
76
- "@storybook/addon-styling": "^1.3.7",
77
- "@storybook/theming": "^7.6.20",
68
+ "@storybook/addon-a11y": "^10.1.5",
69
+ "@storybook/addon-docs": "^10.1.5",
70
+ "@storybook/addon-styling-webpack": "^3.0.0",
78
71
  "@svgr/webpack": "^6.5.1",
79
72
  "babel-plugin-named-asset-import": "^0.3.8",
80
73
  "babel-plugin-styled-components": "^2.1.4",
81
74
  "core-js": "^3.35.1",
82
- "find-babel-config": "^2.0.0"
75
+ "css-loader": "^7.1.2",
76
+ "sass-loader": "^16.0.5",
77
+ "style-loader": "^4.0.0"
83
78
  },
84
79
  "devDependencies": {
85
80
  "@babel/core": "^7.23.3",
package/preset.js ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/modern/preset.cjs';