@storybook/core
Advanced tools
Comparing version 0.0.0-pr-29643-sha-9cd7e771 to 0.0.0-pr-29643-sha-aa40afae
@@ -813,3 +813,3 @@ import * as _storybook_core_types from '@storybook/core/types'; | ||
*/ | ||
declare function extractProperRendererNameFromFramework(frameworkName: string): Promise<"vue" | _storybook_core_types.SupportedRenderers | null>; | ||
declare function extractProperRendererNameFromFramework(frameworkName: string): Promise<_storybook_core_types.SupportedRenderers | "vue" | null>; | ||
@@ -816,0 +816,0 @@ declare function getStorybookConfiguration(storybookScript: string, shortName: string, longName: string): string | null; |
import { loadAllPresets } from '@storybook/core/common'; | ||
export { getPreviewBodyTemplate, getPreviewHeadTemplate } from '@storybook/core/common'; | ||
import { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core/types'; | ||
import { CLIOptions, LoadOptions, BuilderOptions, IndexInputStats, NormalizedStoriesSpecifier, Path, Tag, IndexEntry, DocsIndexEntry, StoryIndex, Indexer, DocsOptions, StorybookConfigRaw, StoryIndexEntry } from '@storybook/core/types'; | ||
import { EventType } from '@storybook/core/telemetry'; | ||
@@ -37,2 +37,115 @@ | ||
export { type BuildStaticStandaloneOptions, build, buildDevStandalone, buildStaticStandalone, getErrorLevel, sendTelemetryError, withTelemetry }; | ||
/** | ||
* A function that json from a file | ||
*/ | ||
interface ReadJsonSync { | ||
(packageJsonPath: string): any | undefined; | ||
} | ||
/** | ||
* Function that can match a path | ||
*/ | ||
interface MatchPath { | ||
(requestedModule: string, readJson?: ReadJsonSync, fileExists?: (name: string) => boolean, extensions?: ReadonlyArray<string>): string | undefined; | ||
} | ||
declare class IndexingError extends Error { | ||
importPaths: string[]; | ||
constructor(message: string, importPaths: string[], stack?: string); | ||
pathsString(): string; | ||
toString(): string; | ||
} | ||
type IndexStatsSummary = Record<keyof IndexInputStats, number>; | ||
type StoryIndexEntryWithExtra = StoryIndexEntry & { | ||
extra: { | ||
metaId?: string; | ||
stats: IndexInputStats; | ||
}; | ||
}; | ||
/** A .mdx file will produce a docs entry */ | ||
type DocsCacheEntry = DocsIndexEntry; | ||
/** A `_.stories._` file will produce a list of stories and possibly a docs entry */ | ||
type StoriesCacheEntry = { | ||
entries: (StoryIndexEntryWithExtra | DocsIndexEntry)[]; | ||
dependents: Path[]; | ||
type: 'stories'; | ||
}; | ||
type ErrorEntry = { | ||
type: 'error'; | ||
err: IndexingError; | ||
}; | ||
type CacheEntry = false | StoriesCacheEntry | DocsCacheEntry | ErrorEntry; | ||
type StoryIndexGeneratorOptions = { | ||
workingDir: Path; | ||
configDir: Path; | ||
indexers: Indexer[]; | ||
docs: DocsOptions; | ||
build?: StorybookConfigRaw['build']; | ||
}; | ||
/** | ||
* The StoryIndexGenerator extracts stories and docs entries for each file matching (one or more) | ||
* stories "specifiers", as defined in main.js. | ||
* | ||
* The output is a set of entries (see above for the types). | ||
* | ||
* Each file is treated as a stories or a (modern) docs file. | ||
* | ||
* A stories file is indexed by an indexer (passed in), which produces a list of stories. | ||
* | ||
* - If the stories have the `parameters.docsOnly` setting, they are disregarded. | ||
* - If the stories have `autodocs` enabled, a docs entry is added pointing to the story file. | ||
* | ||
* A (modern) docs (.mdx) file is indexed, a docs entry is added. | ||
* | ||
* In the preview, a docs entry with the `autodocs` tag will be rendered as a CSF file that exports | ||
* an MDX template on the `docs.page` parameter, whereas other docs entries are rendered as MDX | ||
* files directly. | ||
* | ||
* The entries are "uniq"-ed and sorted. Stories entries are preferred to docs entries and MDX docs | ||
* entries are preferred to CSF templates (with warnings). | ||
*/ | ||
declare class StoryIndexGenerator { | ||
readonly specifiers: NormalizedStoriesSpecifier[]; | ||
readonly options: StoryIndexGeneratorOptions; | ||
private specifierToCache; | ||
private lastIndex?; | ||
private lastStats?; | ||
private lastError?; | ||
constructor(specifiers: NormalizedStoriesSpecifier[], options: StoryIndexGeneratorOptions); | ||
initialize(): Promise<void>; | ||
/** Run the updater function over all the empty cache entries */ | ||
updateExtracted(updater: (specifier: NormalizedStoriesSpecifier, absolutePath: Path, existingEntry: CacheEntry) => Promise<CacheEntry>, overwrite?: boolean): Promise<void>; | ||
isDocsMdx(absolutePath: Path): boolean; | ||
ensureExtracted({ projectTags, }: { | ||
projectTags?: Tag[]; | ||
}): Promise<{ | ||
entries: (IndexEntry | ErrorEntry)[]; | ||
stats: IndexStatsSummary; | ||
}>; | ||
findDependencies(absoluteImports: Path[]): StoriesCacheEntry[]; | ||
/** | ||
* Try to find the component path from a raw import string and return it in the same format as | ||
* `importPath`. Respect tsconfig paths if available. | ||
* | ||
* If no such file exists, assume that the import is from a package and return the raw | ||
*/ | ||
resolveComponentPath(rawComponentPath: Path, absolutePath: Path, matchPath: MatchPath | undefined): string; | ||
extractStories(specifier: NormalizedStoriesSpecifier, absolutePath: Path, projectTags?: Tag[]): Promise<StoriesCacheEntry | DocsCacheEntry>; | ||
extractDocs(specifier: NormalizedStoriesSpecifier, absolutePath: Path, projectTags?: Tag[]): Promise<false | DocsIndexEntry>; | ||
chooseDuplicate(firstEntry: IndexEntry, secondEntry: IndexEntry, projectTags: Tag[]): IndexEntry; | ||
sortStories(entries: StoryIndex['entries'], storySortParameter: any): Promise<Record<string, IndexEntry>>; | ||
getIndex(): Promise<StoryIndex>; | ||
getIndexAndStats(): Promise<{ | ||
storyIndex: StoryIndex; | ||
stats: IndexStatsSummary; | ||
}>; | ||
invalidateAll(): void; | ||
invalidate(specifier: NormalizedStoriesSpecifier, importPath: Path, removed: boolean): void; | ||
getPreviewCode(): Promise<string | undefined>; | ||
getProjectTags(previewCode?: string): string[]; | ||
storyFileNames(): string[]; | ||
} | ||
export { type BuildStaticStandaloneOptions, StoryIndexGenerator, build, buildDevStandalone, buildStaticStandalone, getErrorLevel, sendTelemetryError, withTelemetry }; |
{ | ||
"name": "@storybook/core", | ||
"version": "0.0.0-pr-29643-sha-9cd7e771", | ||
"version": "0.0.0-pr-29643-sha-aa40afae", | ||
"description": "Storybook framework-agnostic API", | ||
@@ -170,2 +170,8 @@ "keywords": [ | ||
}, | ||
"./preview/runtime": { | ||
"import": "./dist/preview/runtime.js" | ||
}, | ||
"./manager/globals-runtime": { | ||
"import": "./dist/manager/globals-runtime.js" | ||
}, | ||
"./package.json": "./package.json" | ||
@@ -196,11 +202,2 @@ }, | ||
], | ||
"core-server/presets/common-preset": [ | ||
"./dist/core-server/presets/common-preset.d.ts" | ||
], | ||
"core-server/presets/common-manager": [ | ||
"./dist/core-server/presets/common-manager.d.ts" | ||
], | ||
"core-server/presets/common-override-preset": [ | ||
"./dist/core-server/presets/common-override-preset.d.ts" | ||
], | ||
"core-events": [ | ||
@@ -282,3 +279,3 @@ "./dist/core-events/index.d.ts" | ||
"dependencies": { | ||
"@storybook/csf": "0.1.12--canary.110.c6e6023.0", | ||
"@storybook/csf": "0.1.12", | ||
"better-opn": "^3.0.2", | ||
@@ -285,0 +282,0 @@ "browser-assert": "^1.2.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
19062189
502283
+ Added@storybook/csf@0.1.12(transitive)
- Removed@storybook/csf@0.1.12--canary.110.c6e6023.0(transitive)
Updated@storybook/csf@0.1.12