Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated stable dependency #19103

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/lib/addons/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export type IndexEntry = StoryIndexEntry | DocsIndexEntry;

// The `any` here is the story store's `StoreItem` record. Ideally we should probably only
// pass a defined subset of that full data, but we pass it all so far :shrug:
export type StorySortComparator = Comparator<[StoryId, any, Parameters, Parameters]>;
export type IndexEntryLegacy = [StoryId, any, Parameters, Parameters];
export type StorySortComparator = Comparator<IndexEntryLegacy>;
export type StorySortParameter = StorySortComparator | StorySortObjectParameter;
export type StorySortComparatorV7 = Comparator<IndexEntry>;
export type StorySortParameterV7 = StorySortComparatorV7 | StorySortObjectParameter;
Expand Down
1 change: 0 additions & 1 deletion code/lib/builder-vite/src/optimizeDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const INCLUDE_CANDIDATES = [
'refractor/lang/yaml.js',
'regenerator-runtime/runtime.js',
'slash',
'stable',
'store2',
'synchronous-promise',
'telejson',
Expand Down
1 change: 0 additions & 1 deletion code/lib/builder-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"html-webpack-plugin": "^5.5.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stable": "^0.1.8",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.1",
"ts-dedent": "^2.0.0",
Expand Down
1 change: 0 additions & 1 deletion code/lib/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"lodash": "^4.17.21",
"memoizerific": "^1.11.3",
"slash": "^3.0.0",
"stable": "^0.1.8",
"synchronous-promise": "^2.0.15",
"ts-dedent": "^2.0.0",
"util-deprecate": "^1.0.2"
Expand Down
15 changes: 9 additions & 6 deletions code/lib/store/src/sortStories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import stable from 'stable';
import { dedent } from 'ts-dedent';
import type { Comparator, StorySortParameter, StorySortParameterV7 } from '@storybook/addons';
import type {
Comparator,
IndexEntryLegacy,
StorySortParameter,
StorySortParameterV7,
} from '@storybook/addons';
import { storySort } from './storySort';
import type { Story, StoryIndexEntry, IndexEntry, Path, Parameters } from './types';

Expand All @@ -16,10 +20,9 @@ const sortStoriesCommon = (
} else {
sortFn = storySort(storySortParameter);
}
stable.inplace(stories, sortFn);
stories.sort(sortFn as (a: IndexEntry, b: IndexEntry) => number);
} else {
stable.inplace(
stories,
stories.sort(
(s1, s2) => fileNameOrder.indexOf(s1.importPath) - fileNameOrder.indexOf(s2.importPath)
);
}
Expand Down Expand Up @@ -57,7 +60,7 @@ export const sortStoriesV6 = (
fileNameOrder: Path[]
) => {
if (storySortParameter && typeof storySortParameter === 'function') {
stable.inplace(stories, storySortParameter);
stories.sort(storySortParameter as (a: IndexEntryLegacy, b: IndexEntryLegacy) => number);
return stories.map((s) => toIndexEntry(s[1]));
}

Expand Down
2 changes: 0 additions & 2 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7777,7 +7777,6 @@ __metadata:
html-webpack-plugin: ^5.5.0
path-browserify: ^1.0.1
process: ^0.11.10
stable: ^0.1.8
style-loader: ^3.3.1
terser-webpack-plugin: ^5.3.1
ts-dedent: ^2.0.0
Expand Down Expand Up @@ -9440,7 +9439,6 @@ __metadata:
lodash: ^4.17.21
memoizerific: ^1.11.3
slash: ^3.0.0
stable: ^0.1.8
synchronous-promise: ^2.0.15
ts-dedent: ^2.0.0
typescript: ~4.6.3
Expand Down