@storybook/csf-plugin 10.1.0-alpha.10 → 10.1.0-alpha.12

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,17 +1,14 @@
1
- import CJS_COMPAT_NODE_URL_98zt28i8ksi from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_98zt28i8ksi from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_98zt28i8ksi from "node:module";
1
+ import CJS_COMPAT_NODE_URL_v7zfndvcoxn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_v7zfndvcoxn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_v7zfndvcoxn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_98zt28i8ksi.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_98zt28i8ksi.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_98zt28i8ksi.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_v7zfndvcoxn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_v7zfndvcoxn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_v7zfndvcoxn.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-CZSVJKL5.js";
15
12
 
16
13
  // src/index.ts
17
14
  import { fileURLToPath } from "node:url";
@@ -28,68 +25,54 @@ function rollupBasedPlugin(options) {
28
25
  return {
29
26
  name: "plugin-csf",
30
27
  async transform(code, id) {
31
- if (!STORIES_REGEX.test(id)) {
28
+ if (!STORIES_REGEX.test(id))
32
29
  return;
33
- }
34
- const sourceCode = await readFile(id, "utf-8");
30
+ let sourceCode = await readFile(id, "utf-8");
35
31
  try {
36
- const makeTitle = /* @__PURE__ */ __name((userTitle) => userTitle || "default", "makeTitle");
37
- const csf = loadCsf(code, { makeTitle }).parse();
38
- const csfSource = loadCsf(sourceCode, {
32
+ let makeTitle = (userTitle) => userTitle || "default", csf = loadCsf(code, { makeTitle }).parse(), csfSource = loadCsf(sourceCode, {
39
33
  makeTitle
40
34
  }).parse();
41
35
  await enrichCsf(csf, csfSource, options);
42
- const inputSourceMap = this.getCombinedSourcemap();
43
- return formatCsf(csf, { sourceMaps: true, inputSourceMap }, code);
36
+ let inputSourceMap = this.getCombinedSourcemap();
37
+ return formatCsf(csf, { sourceMaps: !0, inputSourceMap }, code);
44
38
  } catch (err) {
45
- if (!err.message?.startsWith("CSF:")) {
46
- logger.warn(err.message);
47
- }
48
- return code;
39
+ return err.message?.startsWith("CSF:") || logger.warn(err.message), code;
49
40
  }
50
41
  }
51
42
  };
52
43
  }
53
- __name(rollupBasedPlugin, "rollupBasedPlugin");
54
44
 
55
45
  // src/index.ts
56
- var unpluginFactory = /* @__PURE__ */ __name((options) => {
57
- return {
58
- name: "unplugin-csf",
59
- rollup: {
60
- ...rollupBasedPlugin(options)
61
- },
62
- vite: {
63
- enforce: "pre",
64
- ...rollupBasedPlugin(options)
65
- },
66
- webpack(compiler) {
67
- compiler.options.module.rules.unshift({
68
- test: STORIES_REGEX,
69
- enforce: "post",
70
- use: {
71
- options,
72
- loader: fileURLToPath(import.meta.resolve("@storybook/csf-plugin/webpack-loader"))
73
- }
74
- });
75
- },
76
- rspack(compiler) {
77
- compiler.options.module.rules.unshift({
78
- test: STORIES_REGEX,
79
- enforce: "post",
80
- use: {
81
- options,
82
- loader: fileURLToPath(import.meta.resolve("@storybook/csf-plugin/webpack-loader"))
83
- }
84
- });
85
- }
86
- };
87
- }, "unpluginFactory");
88
- var unplugin = createUnplugin(unpluginFactory);
89
- var { esbuild } = unplugin;
90
- var { webpack } = unplugin;
91
- var { rollup } = unplugin;
92
- var { vite } = unplugin;
46
+ var unpluginFactory = (options) => ({
47
+ name: "unplugin-csf",
48
+ rollup: {
49
+ ...rollupBasedPlugin(options)
50
+ },
51
+ vite: {
52
+ enforce: "pre",
53
+ ...rollupBasedPlugin(options)
54
+ },
55
+ webpack(compiler) {
56
+ compiler.options.module.rules.unshift({
57
+ test: STORIES_REGEX,
58
+ enforce: "post",
59
+ use: {
60
+ options,
61
+ loader: fileURLToPath(import.meta.resolve("@storybook/csf-plugin/webpack-loader"))
62
+ }
63
+ });
64
+ },
65
+ rspack(compiler) {
66
+ compiler.options.module.rules.unshift({
67
+ test: STORIES_REGEX,
68
+ enforce: "post",
69
+ use: {
70
+ options,
71
+ loader: fileURLToPath(import.meta.resolve("@storybook/csf-plugin/webpack-loader"))
72
+ }
73
+ });
74
+ }
75
+ }), unplugin = createUnplugin(unpluginFactory), { esbuild } = unplugin, { webpack } = unplugin, { rollup } = unplugin, { vite } = unplugin;
93
76
  export {
94
77
  esbuild,
95
78
  rollup,
@@ -1,48 +1,35 @@
1
- import CJS_COMPAT_NODE_URL_98zt28i8ksi from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_98zt28i8ksi from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_98zt28i8ksi from "node:module";
1
+ import CJS_COMPAT_NODE_URL_v7zfndvcoxn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_v7zfndvcoxn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_v7zfndvcoxn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_98zt28i8ksi.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_98zt28i8ksi.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_98zt28i8ksi.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_v7zfndvcoxn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_v7zfndvcoxn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_v7zfndvcoxn.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-CZSVJKL5.js";
15
12
 
16
13
  // src/webpack-loader.ts
17
14
  import { readFile } from "node:fs/promises";
18
15
  import { enrichCsf, formatCsf, loadCsf } from "storybook/internal/csf-tools";
19
16
  async function loader(content, map) {
20
- const callback = this.async();
21
- const options = this.getOptions();
22
- const id = this.resourcePath;
23
- const sourceCode = await readFile(id, "utf-8");
17
+ let callback = this.async(), options = this.getOptions(), id = this.resourcePath, sourceCode = await readFile(id, "utf-8");
24
18
  try {
25
- const makeTitle = /* @__PURE__ */ __name((userTitle) => userTitle || "default", "makeTitle");
26
- const csf = loadCsf(content, { makeTitle }).parse();
27
- const csfSource = loadCsf(sourceCode, { makeTitle }).parse();
19
+ let makeTitle = (userTitle) => userTitle || "default", csf = loadCsf(content, { makeTitle }).parse(), csfSource = loadCsf(sourceCode, { makeTitle }).parse();
28
20
  await enrichCsf(csf, csfSource, options);
29
- const formattedCsf = formatCsf(
21
+ let formattedCsf = formatCsf(
30
22
  csf,
31
- { sourceMaps: true, inputSourceMap: map, sourceFileName: id },
23
+ { sourceMaps: !0, inputSourceMap: map, sourceFileName: id },
32
24
  content
33
25
  );
34
- if (typeof formattedCsf === "string") {
26
+ if (typeof formattedCsf == "string")
35
27
  return callback(null, formattedCsf, map);
36
- }
37
28
  callback(null, formattedCsf.code, formattedCsf.map);
38
29
  } catch (err) {
39
- if (!err.message?.startsWith("CSF:")) {
40
- console.warn(err.message);
41
- }
42
- callback(null, content, map);
30
+ err.message?.startsWith("CSF:") || console.warn(err.message), callback(null, content, map);
43
31
  }
44
32
  }
45
- __name(loader, "loader");
46
33
  var webpack_loader_default = loader;
47
34
  export {
48
35
  webpack_loader_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/csf-plugin",
3
- "version": "10.1.0-alpha.10",
3
+ "version": "10.1.0-alpha.12",
4
4
  "description": "Enrich CSF files via static analysis",
5
5
  "keywords": [
6
6
  "storybook"
@@ -49,7 +49,7 @@
49
49
  "peerDependencies": {
50
50
  "esbuild": "*",
51
51
  "rollup": "*",
52
- "storybook": "^10.1.0-alpha.10",
52
+ "storybook": "^10.1.0-alpha.12",
53
53
  "vite": "*",
54
54
  "webpack": "*"
55
55
  },
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae17"
73
+ "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
74
74
  }
@@ -1,17 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_98zt28i8ksi from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_98zt28i8ksi from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_98zt28i8ksi from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_98zt28i8ksi.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_98zt28i8ksi.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_98zt28i8ksi.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
- };