@pure-ds/storybook 0.3.12 → 0.3.14

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.
Files changed (2) hide show
  1. package/.storybook/main.js +21 -2
  2. package/package.json +1 -1
@@ -20,9 +20,10 @@ const config = {
20
20
  ? normalizePath(resolve(process.env.PDS_STORIES_PATH, '**/*.stories.@(js|jsx|mjs|ts|tsx)'))
21
21
  : '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
22
22
  // Include user stories from the project root, but only if we are NOT running in the package itself
23
- ...(process.cwd() === resolve(__dirname, '..') ? [] : [
23
+ ...(process.cwd() === resolve(currentDirname, '..') ? [] : [
24
24
  normalizePath(resolve(process.cwd(), 'stories/**/*.stories.@(js|jsx|mjs|ts|tsx)')),
25
- normalizePath(resolve(process.cwd(), 'src/**/*.stories.@(js|jsx|mjs|ts|tsx)'))
25
+ normalizePath(resolve(process.cwd(), 'src/**/*.stories.@(js|jsx|mjs|ts|tsx)')),
26
+ normalizePath(resolve(process.cwd(), 'public/**/*.stories.@(js|jsx|mjs|ts|tsx)'))
26
27
  ])
27
28
  ],
28
29
  addons: [
@@ -158,6 +159,24 @@ const config = {
158
159
  config.resolve.alias['@user/pds-config'] = resolve(currentDirname, '../default-pds.config.js');
159
160
  }
160
161
 
162
+ // Support absolute path imports from user's public folder
163
+ // This allows stories to use imports like: import { html } from '/assets/js/lit.js';
164
+ const userPublicPath = resolve(process.cwd(), 'public');
165
+ if (process.cwd() !== resolve(currentDirname, '..') && fs.existsSync(userPublicPath)) {
166
+ const userAssetsPath = resolve(userPublicPath, 'assets');
167
+ if (fs.existsSync(userAssetsPath)) {
168
+ config.resolve.alias['/assets'] = userAssetsPath;
169
+ }
170
+
171
+ // Allow Vite to serve files from user's public folder
172
+ config.server = config.server || {};
173
+ config.server.fs = config.server.fs || {};
174
+ config.server.fs.allow = [
175
+ ...(config.server.fs.allow || []),
176
+ userPublicPath
177
+ ];
178
+ }
179
+
161
180
  // Set base path for production builds
162
181
  if (config.mode === 'production') {
163
182
  config.base = '/storybook/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pure-ds/storybook",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Storybook showcase for Pure Design System with live configuration",
5
5
  "type": "module",
6
6
  "private": false,