Skip to content

Commit

Permalink
Add ts-pattern as @webpack/common
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Aug 30, 2024
1 parent 07e629d commit eb0d91f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"stylelint": "^16.8.1",
"stylelint-config-standard": "^36.0.1",
"ts-patch": "^3.2.1",
"ts-pattern": "^5.3.1",
"tsx": "^4.16.5",
"type-fest": "^4.23.0",
"typescript": "^5.5.4",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/webpack/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYea

export const hljs: typeof import("highlight.js") = findByPropsLazy("highlight", "registerLanguage");

export const { match, P }: Pick<typeof import("ts-pattern"), "match" | "P"> = mapMangledModuleLazy("@ts-pattern/matcher", {
match: filters.byCode("return new"),
P: filters.byProps("when")
});

export const lodash: typeof import("lodash") = findByPropsLazy("debounce", "cloneDeep");

export const i18n: t.i18n = findLazy(m => m.Messages?.["en-US"]);
Expand Down

0 comments on commit eb0d91f

Please sign in to comment.