Skip to content
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
2 changes: 1 addition & 1 deletion packages/uniwind/src/core/config/config.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class UniwindConfigBuilder {
// noop
}

// oxlint-disable-next-line typescript/no-redundant-type-constituents
// oxlint-disable-next-line typescript/no-unused-vars
updateInsets(insets: Insets) {
// noop
}
Expand Down
25 changes: 12 additions & 13 deletions packages/uniwind/src/metro/resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CustomResolutionContext, CustomResolver } from 'metro-resolver'
import { basename, dirname, join, sep } from 'node:path'
import { basename, dirname, sep } from 'node:path'

type ResolverConfig = {
platform: string | null
Expand Down Expand Up @@ -45,12 +45,11 @@ export const nativeResolver = ({
const resolution = resolver(context, moduleName, platform)

if (cachedInternalBasePath === null) {
const componentsResolution = resolver(context, 'uniwind/components', platform)

cachedInternalBasePath = componentsResolution.type === 'sourceFile'
// Go from src/components to root
? join(dirname(componentsResolution.filePath), '../..')
: ''
try {
cachedInternalBasePath = dirname(require.resolve('uniwind/package.json'))
} catch {
cachedInternalBasePath = ''
}
}

const isInternal = cachedInternalBasePath !== '' && context.originModulePath.startsWith(cachedInternalBasePath)
Expand Down Expand Up @@ -94,13 +93,13 @@ export const webResolver = ({
const resolution = resolver(context, moduleName, platform)

if (cachedInternalBasePath === null) {
const componentsResolution = resolver(context, 'uniwind/components', platform)

cachedInternalBasePath = componentsResolution.type === 'sourceFile'
// Go from dist/module/components/web to root
? join(dirname(componentsResolution.filePath), '../../../..')
: ''
try {
cachedInternalBasePath = dirname(require.resolve('uniwind/package.json'))
} catch {
cachedInternalBasePath = ''
}
}

if (
(cachedInternalBasePath !== '' && context.originModulePath.startsWith(cachedInternalBasePath))
|| resolution.type !== 'sourceFile'
Expand Down