storybook-framework-cedarjs 1.0.0-canary.12749 → 1.0.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.
- package/README.md +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5
- package/dist/plugins/docgen-handlers/actualNameHandler.d.ts +5 -6
- package/dist/plugins/docgen-handlers/actualNameHandler.d.ts.map +1 -1
- package/dist/plugins/docgen-handlers/actualNameHandler.js +0 -1
- package/dist/plugins/react-docgen.d.ts +1 -3
- package/dist/plugins/react-docgen.d.ts.map +1 -1
- package/dist/plugins/react-docgen.js +12 -58
- package/dist/preset.d.ts +1 -1
- package/dist/preset.d.ts.map +1 -1
- package/dist/preset.js +11 -12
- package/dist/preview.d.ts +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/plugins/docgen-resolver.d.ts +0 -7
- package/dist/plugins/docgen-resolver.d.ts.map +0 -1
- package/dist/plugins/docgen-resolver.js +0 -59
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Storybook for CedarJS
|
|
2
2
|
|
|
3
3
|
Storybook Framework package for CedarJS. Uses the `@storybook/builder-vite`
|
|
4
|
-
builder and `@storybook/react
|
|
4
|
+
builder and `@storybook/react` renderer.
|
|
5
5
|
|
|
6
6
|
Intended to be used alongside the
|
|
7
7
|
[CLI package](../cli-packages/storybook-vite/README.md), which handles the
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This is heavily based on the react-docgen `displayNameHandler`
|
|
3
3
|
* (https://github.com/reactjs/react-docgen/blob/26c90c0dd105bf83499a83826f2a6ff7a724620d/src/handlers/displayNameHandler.ts)
|
|
4
|
-
* but instead defines an `actualName` property on the generated docs that is taken first from the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* but instead defines an `actualName` property on the generated docs that is taken first from the component's actual name.
|
|
5
|
+
* This addresses an issue where the name that the generated docs are stored under is incorrectly named with the `displayName`
|
|
6
|
+
* and not the component's actual name.
|
|
7
7
|
*
|
|
8
|
-
* This is inspired by `actualNameHandler` from
|
|
9
|
-
*
|
|
10
|
-
* displayNameHandler, using the same approach as babel-plugin-react-docgen.
|
|
8
|
+
* This is inspired by `actualNameHandler` from https://github.com/storybookjs/babel-plugin-react-docgen, but is modified
|
|
9
|
+
* directly from displayNameHandler, using the same approach as babel-plugin-react-docgen.
|
|
11
10
|
*/
|
|
12
11
|
import type { Handler } from 'react-docgen';
|
|
13
12
|
declare const actualNameHandler: Handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actualNameHandler.d.ts","sourceRoot":"","sources":["../../../src/plugins/docgen-handlers/actualNameHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actualNameHandler.d.ts","sourceRoot":"","sources":["../../../src/plugins/docgen-handlers/actualNameHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAA6B,MAAM,cAAc,CAAA;AAKtE,QAAA,MAAM,iBAAiB,EAAE,OA0CxB,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { utils } from "react-docgen";
|
|
2
2
|
const { getNameOrValue, isReactForwardRefCall } = utils;
|
|
3
3
|
const actualNameHandler = function actualNameHandler2(documentation, componentDefinition) {
|
|
4
|
-
documentation.set("definedInFile", componentDefinition.hub.file.opts.filename);
|
|
5
4
|
if ((componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has("id")) {
|
|
6
5
|
documentation.set(
|
|
7
6
|
"actualName",
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as TsconfigPaths from 'tsconfig-paths';
|
|
2
1
|
import type { PluginOption } from 'vite';
|
|
3
2
|
type Options = {
|
|
4
3
|
include?: string | RegExp | (string | RegExp)[];
|
|
5
4
|
exclude?: string | RegExp | (string | RegExp)[];
|
|
6
5
|
};
|
|
7
|
-
export declare function reactDocgen({ include, exclude, }?: Options):
|
|
8
|
-
export declare function getReactDocgenImporter(matchPath: TsconfigPaths.MatchPath | undefined): import("react-docgen").Importer;
|
|
6
|
+
export declare function reactDocgen({ include, exclude, }?: Options): PluginOption;
|
|
9
7
|
export {};
|
|
10
8
|
//# sourceMappingURL=react-docgen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-docgen.d.ts","sourceRoot":"","sources":["../../src/plugins/react-docgen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-docgen.d.ts","sourceRoot":"","sources":["../../src/plugins/react-docgen.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAYxC,KAAK,OAAO,GAAG;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC/C,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAChD,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAA0B,EAC1B,OAA8B,GAC/B,GAAE,OAAY,GAAG,YAAY,CA2C7B"}
|
|
@@ -1,67 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { relative, sep } from "node:path";
|
|
1
|
+
import path from "path";
|
|
3
2
|
import { createFilter } from "@rollup/pluginutils";
|
|
4
|
-
import * as find from "empathic/find";
|
|
5
3
|
import MagicString from "magic-string";
|
|
6
4
|
import {
|
|
7
5
|
ERROR_CODES,
|
|
6
|
+
parse,
|
|
8
7
|
builtinHandlers as docgenHandlers,
|
|
9
8
|
builtinResolvers as docgenResolver,
|
|
10
|
-
|
|
11
|
-
parse
|
|
9
|
+
builtinImporters as docgenImporters
|
|
12
10
|
} from "react-docgen";
|
|
13
|
-
import { getProjectRoot } from "storybook/internal/common";
|
|
14
|
-
import * as TsconfigPaths from "tsconfig-paths";
|
|
15
11
|
import actualNameHandler from "./docgen-handlers/actualNameHandler.js";
|
|
16
|
-
import {
|
|
17
|
-
RESOLVE_EXTENSIONS,
|
|
18
|
-
ReactDocgenResolveError,
|
|
19
|
-
defaultLookupModule
|
|
20
|
-
} from "./docgen-resolver.js";
|
|
21
12
|
const defaultHandlers = Object.values(docgenHandlers).map((handler) => handler);
|
|
22
13
|
const defaultResolver = new docgenResolver.FindExportedDefinitionsResolver();
|
|
14
|
+
const defaultImporter = docgenImporters.fsImporter;
|
|
23
15
|
const handlers = [...defaultHandlers, actualNameHandler];
|
|
24
|
-
|
|
25
|
-
include = /\.(
|
|
16
|
+
function reactDocgen({
|
|
17
|
+
include = /\.(tsx?|jsx?)$/,
|
|
26
18
|
exclude = [/node_modules\/.*/]
|
|
27
19
|
} = {}) {
|
|
28
20
|
const cwd = process.cwd();
|
|
29
21
|
const filter = createFilter(include, exclude);
|
|
30
|
-
const tsconfigPath = find.up("tsconfig.json", { cwd, last: getProjectRoot() });
|
|
31
|
-
const tsconfig = TsconfigPaths.loadConfig(tsconfigPath);
|
|
32
|
-
let matchPath;
|
|
33
|
-
if (tsconfig.resultType === "success") {
|
|
34
|
-
matchPath = TsconfigPaths.createMatchPath(
|
|
35
|
-
tsconfig.absoluteBaseUrl,
|
|
36
|
-
tsconfig.paths,
|
|
37
|
-
["browser", "module", "main"]
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
22
|
return {
|
|
41
23
|
name: "storybook:react-docgen-plugin",
|
|
42
24
|
enforce: "pre",
|
|
43
25
|
async transform(src, id) {
|
|
44
|
-
|
|
26
|
+
const relPath = path.relative(cwd, id);
|
|
27
|
+
if (!filter(relPath)) {
|
|
45
28
|
return;
|
|
46
29
|
}
|
|
47
30
|
try {
|
|
48
31
|
const docgenResults = parse(src, {
|
|
49
32
|
resolver: defaultResolver,
|
|
50
33
|
handlers,
|
|
51
|
-
importer:
|
|
34
|
+
importer: defaultImporter,
|
|
52
35
|
filename: id
|
|
53
36
|
});
|
|
54
37
|
const s = new MagicString(src);
|
|
55
38
|
docgenResults.forEach((info) => {
|
|
56
|
-
const { actualName,
|
|
57
|
-
if (actualName
|
|
39
|
+
const { actualName, ...docgenInfo } = info;
|
|
40
|
+
if (actualName) {
|
|
58
41
|
const docNode = JSON.stringify(docgenInfo);
|
|
59
42
|
s.append(`;${actualName}.__docgenInfo=${docNode}`);
|
|
60
43
|
}
|
|
61
44
|
});
|
|
62
45
|
return {
|
|
63
46
|
code: s.toString(),
|
|
64
|
-
map: s.generateMap(
|
|
47
|
+
map: s.generateMap()
|
|
65
48
|
};
|
|
66
49
|
} catch (e) {
|
|
67
50
|
if (e.code === ERROR_CODES.MISSING_DEFINITION) {
|
|
@@ -72,35 +55,6 @@ async function reactDocgen({
|
|
|
72
55
|
}
|
|
73
56
|
};
|
|
74
57
|
}
|
|
75
|
-
function getReactDocgenImporter(matchPath) {
|
|
76
|
-
return makeFsImporter((filename, basedir) => {
|
|
77
|
-
const mappedFilenameByPaths = (() => {
|
|
78
|
-
if (matchPath) {
|
|
79
|
-
const match = matchPath(filename);
|
|
80
|
-
return match || filename;
|
|
81
|
-
} else {
|
|
82
|
-
return filename;
|
|
83
|
-
}
|
|
84
|
-
})();
|
|
85
|
-
const result = defaultLookupModule(mappedFilenameByPaths, basedir);
|
|
86
|
-
if (result.includes(`${sep}react-native${sep}index.js`)) {
|
|
87
|
-
const replaced = result.replace(
|
|
88
|
-
`${sep}react-native${sep}index.js`,
|
|
89
|
-
`${sep}react-native-web${sep}dist${sep}index.js`
|
|
90
|
-
);
|
|
91
|
-
if (existsSync(replaced)) {
|
|
92
|
-
if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
|
|
93
|
-
return replaced;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
|
-
throw new ReactDocgenResolveError(filename);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
58
|
export {
|
|
104
|
-
getReactDocgenImporter,
|
|
105
59
|
reactDocgen
|
|
106
60
|
};
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PresetProperty } from 'storybook/
|
|
1
|
+
import type { PresetProperty } from '@storybook/types';
|
|
2
2
|
import type { StorybookConfig } from './types.js';
|
|
3
3
|
export declare const core: PresetProperty<'core'>;
|
|
4
4
|
export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
|
package/dist/preset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAUtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAWjD,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAGvC,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,oBAAoB,CAKpE,CAAA;AAID,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,WAAW,CA6BlD,CAAA"}
|
package/dist/preset.js
CHANGED
|
@@ -19,9 +19,9 @@ const core = {
|
|
|
19
19
|
builder: getAbsolutePath("@storybook/builder-vite"),
|
|
20
20
|
renderer: getAbsolutePath("@storybook/react")
|
|
21
21
|
};
|
|
22
|
-
const previewAnnotations = (
|
|
22
|
+
const previewAnnotations = (entry) => {
|
|
23
23
|
const createdRequire = createRequire(import.meta.url);
|
|
24
|
-
return [...
|
|
24
|
+
return [...entry, createdRequire.resolve("./preview.js")];
|
|
25
25
|
};
|
|
26
26
|
const cedarProjectPaths = getPaths();
|
|
27
27
|
const viteFinal = async (config) => {
|
|
@@ -39,16 +39,15 @@ const viteFinal = async (config) => {
|
|
|
39
39
|
"~__REDWOOD__USER_WEB_SRC": cedarProjectPaths.web.src
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
preTransformRequests: false
|
|
42
|
+
optimizeDeps: {
|
|
43
|
+
// Without this, on first run, Vite throws: `The file does not exist at
|
|
44
|
+
// "{project path}/web/node_modules/.cache/sb-vite/deps/DocsRenderer-NNNQARDV-DEXCJJZJ.js?v=c640a8fa"
|
|
45
|
+
// which is in the optimize deps directory.`
|
|
46
|
+
// This refers to @storybook/addon-docs, which is included as part of @storybook/addon-essentials.
|
|
47
|
+
// the docs addon then includes itself here: https://github.com/storybookjs/storybook/blob/a496ec48c708eed753a5251d55fa07947a869e62/code/addons/docs/src/preset.ts#L198C3-L198C27
|
|
48
|
+
// which I believe gets included by the builder here: https://github.com/storybookjs/storybook/blob/a496ec48c708eed753a5251d55fa07947a869e62/code/builders/builder-vite/src/optimizeDeps.ts#L117
|
|
49
|
+
// TODO: Figure out why this error is being thrown so that this can be removed.
|
|
50
|
+
exclude: ["@storybook/addon-docs"]
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
};
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Addon_DecoratorFunction, Addon_Loader } from 'storybook/
|
|
1
|
+
import type { Addon_DecoratorFunction, Addon_Loader } from '@storybook/types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
decorators: Addon_DecoratorFunction<any>[];
|
|
4
4
|
loaders: Addon_Loader<any>[];
|
package/dist/preview.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;;;;;AAY7E,wBAGC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { default as docgenTypescript } from '@joshwooding/vite-plugin-react-docgen-typescript';
|
|
2
2
|
import type { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite';
|
|
3
|
-
import type { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsBase } from 'storybook/
|
|
3
|
+
import type { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsBase } from '@storybook/types';
|
|
4
4
|
type FrameworkName = 'storybook-framework-cedarjs';
|
|
5
5
|
type BuilderName = '@storybook/builder-vite';
|
|
6
6
|
export type FrameworkOptions = {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AACnG,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,iBAAiB,IAAI,qBAAqB,EAC3C,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AACnG,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,iBAAiB,IAAI,qBAAqB,EAC3C,MAAM,kBAAkB,CAAA;AAEzB,KAAK,aAAa,GAAG,6BAA6B,CAAA;AAClD,KAAK,WAAW,GAAG,yBAAyB,CAAA;AAE5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,SAAS,EACL,aAAa,GACb;QACE,IAAI,EAAE,aAAa,CAAA;QACnB,OAAO,EAAE,gBAAgB,CAAA;KAC1B,CAAA;IACL,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG;QACnC,OAAO,CAAC,EACJ,WAAW,GACX;YACE,IAAI,EAAE,WAAW,CAAA;YACjB,OAAO,EAAE,cAAc,CAAA;SACxB,CAAA;KACN,CAAA;CACF,CAAA;AAED,KAAK,iBAAiB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAA;AAE7D,KAAK,iBAAiB,GAAG,qBAAqB,GAAG;IAC/C;;;;OAIG;IACH,WAAW,EAAE,yBAAyB,GAAG,cAAc,GAAG,KAAK,CAAA;IAC/D;;OAEG;IACH,4BAA4B,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;CAC/D,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,mBAAmB,EACnB,MAAM,mBAAmB,GAAG,MAAM,wBAAwB,GAAG,YAAY,CAC1E,GACC,mBAAmB,GACnB,wBAAwB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACxC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-framework-cedarjs",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Storybook for CedarJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Storybook",
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"test:watch": "vitest watch"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@cedarjs/testing": "1.0.0
|
|
55
|
+
"@cedarjs/testing": "1.0.0",
|
|
56
56
|
"@joshwooding/vite-plugin-react-docgen-typescript": "0.6.2",
|
|
57
57
|
"@rollup/pluginutils": "5.1.4",
|
|
58
|
-
"@storybook/addon-
|
|
59
|
-
"@storybook/builder-vite": "
|
|
60
|
-
"@storybook/react
|
|
61
|
-
"empathic": "2.0.0",
|
|
58
|
+
"@storybook/addon-essentials": "7.6.20",
|
|
59
|
+
"@storybook/builder-vite": "7.6.20",
|
|
60
|
+
"@storybook/react": "7.6.20",
|
|
62
61
|
"magic-string": "0.30.18",
|
|
63
62
|
"react-docgen": "7.0.3",
|
|
64
63
|
"unplugin-auto-import": "19.3.0",
|
|
65
64
|
"vite-plugin-node-polyfills": "0.23.0"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
67
|
+
"@storybook/types": "7.6.20",
|
|
68
68
|
"@types/node": "20.19.17",
|
|
69
69
|
"tsx": "4.20.5",
|
|
70
70
|
"typescript": "5.9.2",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"vitest": "3.2.4"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@cedarjs/project-config": "1.0.0
|
|
76
|
-
"@cedarjs/router": "1.0.0
|
|
77
|
-
"react": "
|
|
78
|
-
"react-dom": "
|
|
79
|
-
"storybook": "
|
|
75
|
+
"@cedarjs/project-config": "1.0.0",
|
|
76
|
+
"@cedarjs/router": "1.0.0",
|
|
77
|
+
"react": "18.3.1",
|
|
78
|
+
"react-dom": "18.3.1",
|
|
79
|
+
"storybook": "7.6.20"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": "=20.x"
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
],
|
|
92
92
|
"platform": "node"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "218be19197bf0f883896bc229b973afe9448a3ce"
|
|
95
95
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare class ReactDocgenResolveError extends Error {
|
|
2
|
-
readonly code = "MODULE_NOT_FOUND";
|
|
3
|
-
constructor(filename: string);
|
|
4
|
-
}
|
|
5
|
-
export declare const RESOLVE_EXTENSIONS: string[];
|
|
6
|
-
export declare function defaultLookupModule(filename: string, basedir: string): string;
|
|
7
|
-
//# sourceMappingURL=docgen-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docgen-resolver.d.ts","sourceRoot":"","sources":["../../src/plugins/docgen-resolver.ts"],"names":[],"mappings":"AAQA,qBAAa,uBAAwB,SAAQ,KAAK;IAEhD,QAAQ,CAAC,IAAI,sBAAqB;gBAEtB,QAAQ,EAAE,MAAM;CAG7B;AASD,eAAO,MAAM,kBAAkB,UAa9B,CAAA;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAsC7E"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { extname } from "node:path";
|
|
2
|
-
import resolve from "resolve";
|
|
3
|
-
class ReactDocgenResolveError extends Error {
|
|
4
|
-
// the magic string that react-docgen uses to check if a module is ignored
|
|
5
|
-
code = "MODULE_NOT_FOUND";
|
|
6
|
-
constructor(filename) {
|
|
7
|
-
super(`'${filename}' was ignored by react-docgen.`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
const RESOLVE_EXTENSIONS = [
|
|
11
|
-
".js",
|
|
12
|
-
".cts",
|
|
13
|
-
".mts",
|
|
14
|
-
".ctsx",
|
|
15
|
-
".mtsx",
|
|
16
|
-
".ts",
|
|
17
|
-
".tsx",
|
|
18
|
-
".mjs",
|
|
19
|
-
".cjs",
|
|
20
|
-
".mts",
|
|
21
|
-
".cts",
|
|
22
|
-
".jsx"
|
|
23
|
-
];
|
|
24
|
-
function defaultLookupModule(filename, basedir) {
|
|
25
|
-
const resolveOptions = {
|
|
26
|
-
basedir,
|
|
27
|
-
extensions: RESOLVE_EXTENSIONS,
|
|
28
|
-
// we do not need to check core modules as we cannot import them anyway
|
|
29
|
-
includeCoreModules: false
|
|
30
|
-
};
|
|
31
|
-
try {
|
|
32
|
-
return resolve.sync(filename, resolveOptions);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
const ext = extname(filename);
|
|
35
|
-
let newFilename;
|
|
36
|
-
switch (ext) {
|
|
37
|
-
case ".js":
|
|
38
|
-
case ".mjs":
|
|
39
|
-
case ".cjs":
|
|
40
|
-
newFilename = `${filename.slice(0, -2)}ts`;
|
|
41
|
-
break;
|
|
42
|
-
case ".jsx":
|
|
43
|
-
newFilename = `${filename.slice(0, -3)}tsx`;
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
return resolve.sync(newFilename, {
|
|
49
|
-
...resolveOptions,
|
|
50
|
-
// we already know that there is an extension at this point, so no need to check other extensions
|
|
51
|
-
extensions: []
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
RESOLVE_EXTENSIONS,
|
|
57
|
-
ReactDocgenResolveError,
|
|
58
|
-
defaultLookupModule
|
|
59
|
-
};
|