@storybook/react-native 8.4.3-alpha.2 → 8.4.4-alpha.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.
@@ -68,7 +68,7 @@ var require_common = __commonJS({
68
68
  function getPreviewExists({ configPath }) {
69
69
  return !!getFilePathExtension({ configPath }, "preview");
70
70
  }
71
- function resolveAddonFile(addon, file, extensions = ["js", "mjs", "ts"]) {
71
+ function resolveAddonFile(addon, file, extensions = ["js", "mjs", "ts"], configPath) {
72
72
  try {
73
73
  const basePath = `${addon}/${file}`;
74
74
  require.resolve(basePath);
@@ -83,6 +83,15 @@ var require_common = __commonJS({
83
83
  } catch (error) {
84
84
  }
85
85
  }
86
+ if (addon.startsWith("./") || addon.startsWith("../")) {
87
+ try {
88
+ const extension = getFilePathExtension({ configPath }, `${addon}/${file}`);
89
+ if (extension) {
90
+ return `${addon}/${file}`;
91
+ }
92
+ } catch (error) {
93
+ }
94
+ }
86
95
  return null;
87
96
  }
88
97
  module2.exports = {
@@ -139,7 +148,12 @@ var require_generate = __commonJS({
139
148
  });
140
149
  let registerAddons = "";
141
150
  for (const addon of main.addons) {
142
- const registerPath = resolveAddonFile(addon, "register", ["js", "mjs", "jsx", "ts", "tsx"]);
151
+ const registerPath = resolveAddonFile(
152
+ addon,
153
+ "register",
154
+ ["js", "mjs", "jsx", "ts", "tsx"],
155
+ configPath
156
+ );
143
157
  if (registerPath) {
144
158
  registerAddons += `import "${registerPath}";
145
159
  `;
@@ -148,7 +162,12 @@ var require_generate = __commonJS({
148
162
  const docTools = 'require("@storybook/react-native/preview")';
149
163
  const enhancers = [docTools];
150
164
  for (const addon of main.addons) {
151
- const previewPath = resolveAddonFile(addon, "preview", ["js", "mjs", "jsx", "ts", "tsx"]);
165
+ const previewPath = resolveAddonFile(
166
+ addon,
167
+ "preview",
168
+ ["js", "mjs", "jsx", "ts", "tsx"],
169
+ configPath
170
+ );
152
171
  if (previewPath) {
153
172
  enhancers.push(`require('${previewPath}')`);
154
173
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "8.4.3-alpha.2",
3
+ "version": "8.4.4-alpha.0",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -49,8 +49,8 @@
49
49
  "@storybook/csf": "^0.1.1",
50
50
  "@storybook/global": "^5.0.0",
51
51
  "@storybook/react": "^8.4.2",
52
- "@storybook/react-native-theming": "^8.4.3-alpha.2",
53
- "@storybook/react-native-ui": "^8.4.3-alpha.2",
52
+ "@storybook/react-native-theming": "^8.4.4-alpha.0",
53
+ "@storybook/react-native-ui": "^8.4.4-alpha.0",
54
54
  "chokidar": "^3.5.1",
55
55
  "commander": "^8.2.0",
56
56
  "dedent": "^1.5.1",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "78da05071501569d90a08aa6dee9382bf79f7cd8"
94
+ "gitHead": "a6661021cbcb55cc59455ce5a5cd18d8ac06498d"
95
95
  }
package/scripts/common.js CHANGED
@@ -58,7 +58,7 @@ function getPreviewExists({ configPath }) {
58
58
  return !!getFilePathExtension({ configPath }, 'preview');
59
59
  }
60
60
 
61
- function resolveAddonFile(addon, file, extensions = ['js', 'mjs', 'ts']) {
61
+ function resolveAddonFile(addon, file, extensions = ['js', 'mjs', 'ts'], configPath) {
62
62
  try {
63
63
  const basePath = `${addon}/${file}`;
64
64
 
@@ -77,6 +77,17 @@ function resolveAddonFile(addon, file, extensions = ['js', 'mjs', 'ts']) {
77
77
  } catch (error) {}
78
78
  }
79
79
 
80
+ // attempt to resolve as a relative path for local addons
81
+ if (addon.startsWith('./') || addon.startsWith('../')) {
82
+ try {
83
+ const extension = getFilePathExtension({ configPath }, `${addon}/${file}`);
84
+
85
+ if (extension) {
86
+ return `${addon}/${file}`;
87
+ }
88
+ } catch (error) {}
89
+ }
90
+
80
91
  return null;
81
92
  }
82
93
 
@@ -50,7 +50,12 @@ function generate({ configPath, absolute = false, useJs = false }) {
50
50
  let registerAddons = '';
51
51
 
52
52
  for (const addon of main.addons) {
53
- const registerPath = resolveAddonFile(addon, 'register', ['js', 'mjs', 'jsx', 'ts', 'tsx']);
53
+ const registerPath = resolveAddonFile(
54
+ addon,
55
+ 'register',
56
+ ['js', 'mjs', 'jsx', 'ts', 'tsx'],
57
+ configPath
58
+ );
54
59
 
55
60
  if (registerPath) {
56
61
  registerAddons += `import "${registerPath}";\n`;
@@ -62,7 +67,12 @@ function generate({ configPath, absolute = false, useJs = false }) {
62
67
  const enhancers = [docTools];
63
68
 
64
69
  for (const addon of main.addons) {
65
- const previewPath = resolveAddonFile(addon, 'preview', ['js', 'mjs', 'jsx', 'ts', 'tsx']);
70
+ const previewPath = resolveAddonFile(
71
+ addon,
72
+ 'preview',
73
+ ['js', 'mjs', 'jsx', 'ts', 'tsx'],
74
+ configPath
75
+ );
66
76
 
67
77
  if (previewPath) {
68
78
  enhancers.push(`require('${previewPath}')`);