@storybook/preset-server-webpack 10.1.0-alpha.9 → 10.1.0-beta.1

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/dist/index.js CHANGED
@@ -1,22 +1,19 @@
1
- import CJS_COMPAT_NODE_URL_uv3bo8cymko from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_uv3bo8cymko from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_uv3bo8cymko from "node:module";
1
+ import CJS_COMPAT_NODE_URL_whgkm0yqnh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_whgkm0yqnh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_whgkm0yqnh from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_uv3bo8cymko.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_uv3bo8cymko.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_uv3bo8cymko.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_whgkm0yqnh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_whgkm0yqnh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_whgkm0yqnh.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "./_node-chunks/chunk-TQBRLZ72.js";
15
12
 
16
13
  // src/index.ts
17
14
  import { fileURLToPath } from "node:url";
18
- var webpack = /* @__PURE__ */ __name((config) => {
19
- const rules = [
15
+ var webpack = (config) => {
16
+ let rules = [
20
17
  ...config.module?.rules || [],
21
18
  {
22
19
  type: "javascript/auto",
@@ -30,15 +27,13 @@ var webpack = /* @__PURE__ */ __name((config) => {
30
27
  fileURLToPath(import.meta.resolve("@storybook/preset-server-webpack/loader")),
31
28
  {
32
29
  loader: fileURLToPath(import.meta.resolve("yaml-loader")),
33
- options: { asJSON: true }
30
+ options: { asJSON: !0 }
34
31
  }
35
32
  ]
36
33
  }
37
34
  ];
38
- config.module = config.module || {};
39
- config.module.rules = rules;
40
- return config;
41
- }, "webpack");
35
+ return config.module = config.module || {}, config.module.rules = rules, config;
36
+ };
42
37
  export {
43
38
  webpack
44
39
  };
package/dist/loader.js CHANGED
@@ -1,78 +1,53 @@
1
- import CJS_COMPAT_NODE_URL_uv3bo8cymko from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_uv3bo8cymko from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_uv3bo8cymko from "node:module";
1
+ import CJS_COMPAT_NODE_URL_whgkm0yqnh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_whgkm0yqnh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_whgkm0yqnh from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_uv3bo8cymko.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_uv3bo8cymko.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_uv3bo8cymko.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_whgkm0yqnh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_whgkm0yqnh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_whgkm0yqnh.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import {
13
- __name
14
- } from "./_node-chunks/chunk-TQBRLZ72.js";
15
12
 
16
13
  // src/lib/compiler/stringifier.ts
17
14
  import { identifier } from "safe-identifier";
18
15
  import { dedent } from "ts-dedent";
19
- function stringifyObject(object, level = 0, excludeOuterParams = false) {
20
- if (typeof object === "string") {
16
+ function stringifyObject(object, level = 0, excludeOuterParams = !1) {
17
+ if (typeof object == "string")
21
18
  return JSON.stringify(object);
22
- }
23
- const indent = " ".repeat(level);
19
+ let indent = " ".repeat(level);
24
20
  if (Array.isArray(object)) {
25
- const arrayStrings = object.map((item) => stringifyObject(item, level + 1));
26
- const arrayString = arrayStrings.join(`,
21
+ let arrayString = object.map((item) => stringifyObject(item, level + 1)).join(`,
27
22
  ${indent} `);
28
- if (excludeOuterParams) {
29
- return arrayString;
30
- }
31
- return `[
23
+ return excludeOuterParams ? arrayString : `[
32
24
  ${indent} ${arrayString}
33
25
  ${indent}]`;
34
26
  }
35
- if (typeof object === "object") {
27
+ if (typeof object == "object") {
36
28
  let objectString = "";
37
- if (Object.keys(object).length > 0) {
38
- const objectStrings = Object.keys(object).map((key) => {
39
- const value = stringifyObject(object[key], level + 1);
40
- return `
29
+ return Object.keys(object).length > 0 && (objectString = Object.keys(object).map((key) => {
30
+ let value = stringifyObject(object[key], level + 1);
31
+ return `
41
32
  ${indent} ${key}: ${value}`;
42
- });
43
- objectString = objectStrings.join(",");
44
- }
45
- if (excludeOuterParams) {
46
- return objectString;
47
- }
48
- if (objectString.length === 0) {
49
- return "{}";
50
- }
51
- return `{${objectString}
33
+ }).join(",")), excludeOuterParams ? objectString : objectString.length === 0 ? "{}" : `{${objectString}
52
34
  ${indent}}`;
53
35
  }
54
36
  return object;
55
37
  }
56
- __name(stringifyObject, "stringifyObject");
57
38
  function stringifyImports(imports) {
58
- if (Object.keys(imports).length === 0) {
59
- return "";
60
- }
61
- return Object.entries(imports).map(([module, names]) => `import { ${names.sort().join(", ")} } from '${module}';
39
+ return Object.keys(imports).length === 0 ? "" : Object.entries(imports).map(([module, names]) => `import { ${names.sort().join(", ")} } from '${module}';
62
40
  `).join("");
63
41
  }
64
- __name(stringifyImports, "stringifyImports");
65
42
  function stringifyDecorators(decorators) {
66
43
  return decorators && decorators.length > 0 ? `
67
44
  decorators: [
68
- ${decorators.join(",\n ")}
45
+ ${decorators.join(`,
46
+ `)}
69
47
  ],` : "";
70
48
  }
71
- __name(stringifyDecorators, "stringifyDecorators");
72
49
  function stringifyDefault(section) {
73
- const { title, imports, decorators, stories, ...options } = section;
74
- const decoratorsString = stringifyDecorators(decorators);
75
- const optionsString = stringifyObject(options, 0, true);
50
+ let { title, imports, decorators, stories, ...options } = section, decoratorsString = stringifyDecorators(decorators), optionsString = stringifyObject(options, 0, !0);
76
51
  return dedent`
77
52
  export default {
78
53
  title: ${JSON.stringify(title)},${decoratorsString}${optionsString}
@@ -80,24 +55,19 @@ function stringifyDefault(section) {
80
55
 
81
56
  `;
82
57
  }
83
- __name(stringifyDefault, "stringifyDefault");
84
58
  function stringifyStory(story) {
85
- const { name, ...options } = story;
86
- const storyId = identifier(name);
87
- const exportedStory = { name, ...options };
88
- const storyStrings = [`export const ${storyId} = ${stringifyObject(exportedStory)};`, ""];
89
- return storyStrings.join("\n");
59
+ let { name, ...options } = story, storyId = identifier(name), exportedStory = { name, ...options };
60
+ return [`export const ${storyId} = ${stringifyObject(exportedStory)};`, ""].join(`
61
+ `);
90
62
  }
91
- __name(stringifyStory, "stringifyStory");
92
63
  function stringifySection(section) {
93
- const sectionString = [
64
+ return [
94
65
  stringifyImports(section.imports),
95
66
  stringifyDefault(section),
96
67
  ...section.stories.map((story) => stringifyStory(story))
97
- ].join("\n");
98
- return sectionString;
68
+ ].join(`
69
+ `);
99
70
  }
100
- __name(stringifySection, "stringifySection");
101
71
 
102
72
  // src/lib/compiler/index.ts
103
73
  function createSection(args) {
@@ -107,22 +77,19 @@ function createSection(args) {
107
77
  ...args
108
78
  };
109
79
  }
110
- __name(createSection, "createSection");
111
80
  function compileCsfModule(args) {
112
81
  return stringifySection(createSection(args));
113
82
  }
114
- __name(compileCsfModule, "compileCsfModule");
115
83
 
116
84
  // src/loader.ts
117
- var loader_default = /* @__PURE__ */ __name((content) => {
85
+ var loader_default = (content) => {
118
86
  try {
119
- const after = compileCsfModule(JSON.parse(content));
120
- return after;
87
+ return compileCsfModule(JSON.parse(content));
121
88
  } catch (e) {
122
89
  console.log(content, e);
123
90
  }
124
91
  return content;
125
- }, "default");
92
+ };
126
93
  export {
127
94
  loader_default as default
128
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preset-server-webpack",
3
- "version": "10.1.0-alpha.9",
3
+ "version": "10.1.0-beta.1",
4
4
  "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -40,7 +40,7 @@
40
40
  "prep": "jiti ../../../scripts/build/build-package.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@storybook/core-webpack": "10.1.0-alpha.9",
43
+ "@storybook/core-webpack": "10.1.0-beta.1",
44
44
  "safe-identifier": "^0.4.2",
45
45
  "ts-dedent": "^2.0.0",
46
46
  "yaml-loader": "^0.8.1"
@@ -51,10 +51,10 @@
51
51
  "yaml": "^2.8.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "storybook": "^10.1.0-alpha.9"
54
+ "storybook": "^10.1.0-beta.1"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16"
59
+ "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
60
60
  }
@@ -1,17 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_uv3bo8cymko from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_uv3bo8cymko from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_uv3bo8cymko from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_uv3bo8cymko.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_uv3bo8cymko.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_uv3bo8cymko.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- var __defProp = Object.defineProperty;
13
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
14
-
15
- export {
16
- __name
17
- };