@pure-ds/storybook 0.5.46 → 0.5.47
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/.storybook/main.js +29 -0
- package/dist/pds-reference.json +1 -1
- package/package.json +2 -2
package/.storybook/main.js
CHANGED
|
@@ -67,6 +67,34 @@ const config = {
|
|
|
67
67
|
repoRoot,
|
|
68
68
|
process.cwd()
|
|
69
69
|
];
|
|
70
|
+
|
|
71
|
+
// Rewrite deep relative imports to the package src path when running in a consumer
|
|
72
|
+
// e.g. ../../../../src/js/common/ask.js -> <packageRoot>/src/js/common/ask.js
|
|
73
|
+
const srcRewritePlugin = {
|
|
74
|
+
name: 'pds-src-relative-rewrite',
|
|
75
|
+
enforce: 'pre',
|
|
76
|
+
resolveId(id, importer) {
|
|
77
|
+
if (!importer || typeof id !== 'string') return null;
|
|
78
|
+
|
|
79
|
+
const normalizedId = id.replace(/\\/g, '/');
|
|
80
|
+
const normalizedImporter = importer.replace(/\\/g, '/');
|
|
81
|
+
const isStoryImport = normalizedImporter.includes('/@pure-ds/storybook/stories/');
|
|
82
|
+
|
|
83
|
+
if (!isStoryImport) return null;
|
|
84
|
+
|
|
85
|
+
if (normalizedId.startsWith('../../../../src/')) {
|
|
86
|
+
const relativePath = normalizedId.replace('../../../../src/', '');
|
|
87
|
+
return resolve(pdsSrcPath, relativePath);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (normalizedId.startsWith('../../../src/')) {
|
|
91
|
+
const relativePath = normalizedId.replace('../../../src/', '');
|
|
92
|
+
return resolve(pdsSrcPath, relativePath);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
70
98
|
|
|
71
99
|
// Ensure Lit import alias is resolved to PDS bundle
|
|
72
100
|
const aliases = {
|
|
@@ -196,6 +224,7 @@ const config = {
|
|
|
196
224
|
config.publicDir = false;
|
|
197
225
|
|
|
198
226
|
config.plugins = config.plugins || [];
|
|
227
|
+
config.plugins.unshift(srcRewritePlugin);
|
|
199
228
|
// Insert at the beginning to run before other plugins
|
|
200
229
|
config.plugins.unshift({
|
|
201
230
|
name: 'pds-public-esm-loader',
|
package/dist/pds-reference.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/storybook",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.47",
|
|
4
4
|
"description": "Storybook showcase for Pure Design System with live configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"pds:build-icons": "pds-build-icons"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@pure-ds/core": "^0.5.
|
|
41
|
+
"@pure-ds/core": "^0.5.47"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|