@storybook/react-dom-shim
Advanced tools
Comparing version 0.0.0-pr-23611-sha-3be4580c to 0.0.0-pr-23611-sha-82d2a4fa
@@ -19,36 +19,3 @@ import { FileSystemCache } from 'file-system-cache'; | ||
/** | ||
Matches a JSON object. | ||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. | ||
@category JSON | ||
*/ | ||
type JsonObject = {[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined}; | ||
/** | ||
Matches a JSON array. | ||
@category JSON | ||
*/ | ||
type JsonArray = JsonValue[] | readonly JsonValue[]; | ||
/** | ||
Matches any valid JSON primitive value. | ||
@category JSON | ||
*/ | ||
type JsonPrimitive = string | number | boolean | null; | ||
/** | ||
Matches any valid JSON value. | ||
@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`. | ||
@category JSON | ||
*/ | ||
type JsonValue = JsonPrimitive | JsonObject | JsonArray; | ||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. | ||
interface SymbolConstructor { | ||
@@ -119,4 +86,4 @@ readonly observable: symbol; | ||
export type DirectoryLocations = { | ||
[directoryType: string]: JsonValue | undefined; | ||
export interface DirectoryLocations { | ||
[directoryType: string]: unknown; | ||
@@ -152,3 +119,3 @@ /** | ||
test?: string; | ||
}; | ||
} | ||
@@ -303,8 +270,19 @@ export type Scripts = { | ||
/** | ||
A mapping of conditions and the paths to which they resolve. | ||
Conditions which provide a way to resolve a package entry point based on the environment. | ||
*/ | ||
type ExportConditions = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style | ||
[condition: string]: Exports; | ||
}; | ||
export type ExportCondition = LiteralUnion< | ||
| 'import' | ||
| 'require' | ||
| 'node' | ||
| 'node-addons' | ||
| 'deno' | ||
| 'browser' | ||
| 'electron' | ||
| 'react-native' | ||
| 'default', | ||
string | ||
>; | ||
type ExportConditions = {[condition in ExportCondition]: Exports}; | ||
/** | ||
@@ -317,12 +295,12 @@ Entry points of a module, optionally with conditions and subpath exports. | ||
| Array<string | ExportConditions> | ||
| ExportConditions; | ||
| ExportConditions | ||
| {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style | ||
/** | ||
Import map entries of a module, optionally with conditions and subpath imports. | ||
Import map entries of a module, optionally with conditions. | ||
*/ | ||
export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style | ||
[key: `#${string}`]: Exports; | ||
[key: string]: string | {[key in ExportCondition]: Exports}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
export interface NonStandardEntryPoints { | ||
@@ -360,3 +338,3 @@ /** | ||
export type TypeScriptConfiguration = { | ||
export interface TypeScriptConfiguration { | ||
/** | ||
@@ -376,8 +354,8 @@ Location of the bundled TypeScript declaration file. | ||
typings?: string; | ||
}; | ||
} | ||
/** | ||
An alternative configuration for workspaces. | ||
An alternative configuration for Yarn workspaces. | ||
*/ | ||
export type WorkspaceConfig = { | ||
export interface WorkspaceConfig { | ||
/** | ||
@@ -391,7 +369,6 @@ An array of workspace pattern strings which contain the workspace packages. | ||
[Supported](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) by Yarn. | ||
[Not supported](https://github.com/npm/rfcs/issues/287) by npm. | ||
[Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) | ||
*/ | ||
nohoist?: WorkspacePattern[]; | ||
}; | ||
} | ||
@@ -409,4 +386,13 @@ /** | ||
export type YarnConfiguration = { | ||
export interface YarnConfiguration { | ||
/** | ||
Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/). | ||
Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass. | ||
Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces. | ||
*/ | ||
workspaces?: WorkspacePattern[] | WorkspaceConfig; | ||
/** | ||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`. | ||
@@ -422,5 +408,5 @@ | ||
resolutions?: Dependency; | ||
}; | ||
} | ||
export type JSPMConfiguration = { | ||
export interface JSPMConfiguration { | ||
/** | ||
@@ -430,3 +416,3 @@ JSPM configuration. | ||
jspm?: PackageJson$1; | ||
}; | ||
} | ||
@@ -436,3 +422,2 @@ /** | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
export interface PackageJsonStandard { | ||
@@ -567,3 +552,3 @@ /** | ||
*/ | ||
config?: JsonObject; | ||
config?: Record<string, unknown>; | ||
@@ -609,3 +594,3 @@ /** | ||
engines?: { | ||
[EngineName in 'npm' | 'node' | string]?: string; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents | ||
[EngineName in 'npm' | 'node' | string]?: string; | ||
}; | ||
@@ -709,37 +694,9 @@ | ||
}; | ||
/** | ||
Used to configure [npm workspaces](https://docs.npmjs.com/cli/using-npm/workspaces) / [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/). | ||
Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run your install command once in order to install all of them in a single pass. | ||
Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces. | ||
*/ | ||
workspaces?: WorkspacePattern[] | WorkspaceConfig; | ||
} | ||
/** | ||
Type for [`package.json` file used by the Node.js runtime](https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions). | ||
*/ | ||
export type NodeJsStandard = { | ||
export interface PublishConfig { | ||
/** | ||
Defines which package manager is expected to be used when working on the current project. It can set to any of the [supported package managers](https://nodejs.org/api/corepack.html#supported-package-managers), and will ensure that your teams use the exact same package manager versions without having to install anything else than Node.js. | ||
__This field is currently experimental and needs to be opted-in; check the [Corepack](https://nodejs.org/api/corepack.html) page for details about the procedure.__ | ||
@example | ||
```json | ||
{ | ||
"packageManager": "<package manager name>@<version>" | ||
} | ||
``` | ||
*/ | ||
packageManager?: string; | ||
}; | ||
export type PublishConfig = { | ||
/** | ||
Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig). | ||
*/ | ||
[additionalProperties: string]: JsonValue | undefined; | ||
[additionalProperties: string]: unknown; | ||
@@ -764,3 +721,3 @@ /** | ||
tag?: string; | ||
}; | ||
} | ||
} | ||
@@ -774,4 +731,2 @@ | ||
type PackageJson$1 = | ||
JsonObject & | ||
PackageJson$1.NodeJsStandard & | ||
PackageJson$1.PackageJsonStandard & | ||
@@ -782,2 +737,6 @@ PackageJson$1.NonStandardEntryPoints & | ||
PackageJson$1.JSPMConfiguration; | ||
type StoryId = string; | ||
type ComponentTitle = string; | ||
type StoryName = string; | ||
type Tag = string; | ||
@@ -788,2 +747,4 @@ interface Parameters { | ||
type ExportName = string; | ||
type MetaId = string; | ||
interface StoriesSpecifier { | ||
@@ -817,2 +778,3 @@ /** | ||
meta: { | ||
id?: string; | ||
title?: string; | ||
@@ -823,6 +785,79 @@ tags?: Tag[]; | ||
} | ||
interface StoryIndexer { | ||
/** | ||
* FIXME: This is a temporary type to allow us to deprecate the old indexer API. | ||
* We should remove this type and the deprecated indexer API in 8.0. | ||
*/ | ||
type BaseIndexer = { | ||
/** | ||
* A regular expression that should match all files to be handled by this indexer | ||
*/ | ||
test: RegExp; | ||
}; | ||
/** | ||
* An indexer describes which filenames it handles, and how to index each individual file - turning it into an entry in the index. | ||
*/ | ||
type Indexer = BaseIndexer & { | ||
/** | ||
* Indexes a file containing stories or docs. | ||
* @param fileName The name of the file to index. | ||
* @param options {@link IndexerOptions} for indexing the file. | ||
* @returns A promise that resolves to an array of {@link IndexInput} objects. | ||
*/ | ||
index: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>; | ||
/** | ||
* @soonDeprecated Use {@link index} instead | ||
*/ | ||
indexer?: never; | ||
}; | ||
type DeprecatedIndexer = BaseIndexer & { | ||
indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>; | ||
} | ||
index?: never; | ||
}; | ||
/** | ||
* @soonDeprecated Use {@link Indexer} instead | ||
*/ | ||
type StoryIndexer = Indexer | DeprecatedIndexer; | ||
/** | ||
* The base input for indexing a story or docs entry. | ||
*/ | ||
type BaseIndexInput = { | ||
/** The file to import from e.g. the story file. */ | ||
importPath: Path; | ||
/** The name of the export to import. */ | ||
exportName: ExportName; | ||
/** The name of the entry, auto-generated from {@link exportName} if unspecified. */ | ||
name?: StoryName; | ||
/** The location in the sidebar, auto-generated from {@link importPath} if unspecified. */ | ||
title?: ComponentTitle; | ||
/** | ||
* The custom id optionally set at `meta.id` if it needs to differ from the id generated via {@link title}. | ||
* If unspecified, the meta id will be auto-generated from {@link title}. | ||
* If specified, the meta in the CSF file _must_ have a matching id set at `meta.id`, to be correctly matched. | ||
*/ | ||
metaId?: MetaId; | ||
/** Tags for filtering entries in Storybook and its tools. */ | ||
tags?: Tag[]; | ||
/** | ||
* The id of the entry, auto-generated from {@link title}/{@link metaId} and {@link exportName} if unspecified. | ||
* If specified, the story in the CSF file _must_ have a matching id set at `parameters.__id`, to be correctly matched. | ||
* Only use this if you need to override the auto-generated id. | ||
*/ | ||
__id?: StoryId; | ||
}; | ||
/** | ||
* The input for indexing a story entry. | ||
*/ | ||
type StoryIndexInput = BaseIndexInput & { | ||
type: 'story'; | ||
}; | ||
/** | ||
* The input for indexing a docs entry. | ||
*/ | ||
type DocsIndexInput = BaseIndexInput & { | ||
type: 'docs'; | ||
/** Paths to story files that must be pre-loaded for this docs entry. */ | ||
storiesImports?: Path[]; | ||
}; | ||
type IndexInput = StoryIndexInput | DocsIndexInput; | ||
type Path = string; | ||
@@ -993,2 +1028,3 @@ interface Options$1 { | ||
disable: boolean; | ||
expanded?: boolean; | ||
}>; | ||
@@ -1103,5 +1139,10 @@ type DocsOptions = { | ||
* Process CSF files for the story index. | ||
* @soonDeprecated use {@link experimental_indexers} instead | ||
*/ | ||
storyIndexers?: PresetValue<StoryIndexer[]>; | ||
/** | ||
* Process CSF files for the story index. | ||
*/ | ||
experimental_indexers?: PresetValue<Indexer[]>; | ||
/** | ||
* Docs related features in index generation | ||
@@ -1108,0 +1149,0 @@ */ |
{ | ||
"name": "@storybook/react-dom-shim", | ||
"version": "0.0.0-pr-23611-sha-3be4580c", | ||
"version": "0.0.0-pr-23611-sha-82d2a4fa", | ||
"description": "", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@storybook/types": "0.0.0-pr-23611-sha-3be4580c", | ||
"@storybook/types": "0.0.0-pr-23611-sha-82d2a4fa", | ||
"typescript": "~4.9.3" | ||
@@ -59,0 +59,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39251
1058