-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move dev-aliases into @repo/dev-aliases
- Loading branch information
Showing
6 changed files
with
65 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable tsdoc/syntax */ | ||
|
||
// NOTE: THIS FILE NEEDS TO REMAIN COMMONJS | ||
// It can be converted to ESM/TS when we either not use jest anymore, or node/jest runner natively supports ESM (including with import.meta etc). | ||
|
||
/** | ||
* The path mappings/aliases used by various tools in the monorepo to map imported modules to | ||
* source files in order to speed up rebuilding and avoid having a separate watcher process to build | ||
* from `src` to `lib`. | ||
* | ||
* This file is currently read by: | ||
* - Vite when running the dev server (only when running in this monorepo) | ||
* - jest when running test suite | ||
* | ||
* @type Record<string, string> | ||
*/ | ||
const devAliases = { | ||
// NOTE: do not use regex in the module expressions, | ||
// because they will be escaped by the jest config | ||
'@sanity/block-tools': '@sanity/block-tools/src', | ||
'@sanity/diff': '@sanity/diff/src', | ||
'@sanity/cli': '@sanity/cli/src', | ||
'@sanity/mutator': '@sanity/mutator/src', | ||
'@sanity/schema': '@sanity/schema/src/_exports', | ||
'@sanity/migrate': '@sanity/migrate/src/_exports', | ||
'@sanity/types': '@sanity/types/src', | ||
'@sanity/util': '@sanity/util/src/_exports', | ||
'@sanity/vision': '@sanity/vision/src', | ||
'sanity': 'sanity/src/_exports', | ||
'groq': 'groq/src/_exports.mts', | ||
} | ||
|
||
module.exports = devAliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "@repo/dev-aliases", | ||
"version": "3.57.4", | ||
"private": true, | ||
"description": "Dev aliases for the sanity monorepo", | ||
"type": "module", | ||
"exports": { | ||
".": "./dev-aliases.cjs" | ||
}, | ||
"main": "./dev-aliases.cjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import devAliases from './dev-aliases.cjs' | ||
|
||
import {dirname, resolve} from 'node:path' | ||
|
||
const PACKAGES_PATH = resolve(getDirname(import.meta.url), '..', '..') | ||
|
||
function getDirname(importMetaUrl) { | ||
return dirname(importMetaUrl.replace('file://', '')) | ||
} | ||
|
||
export function getViteAliases() { | ||
return Object.fromEntries( | ||
Object.entries(devAliases).map(([packageName, aliasPath]) => [ | ||
packageName, | ||
resolve(PACKAGES_PATH, aliasPath), | ||
]), | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters