MCPcopy Create free account
hub / github.com/Effect-TS/effect / createResolveLocalPackageImports

Function createResolveLocalPackageImports

packages/tools/bundle/src/Plugins.ts:106–124  ·  view source on GitHub ↗
(pathService: Path.Path)

Source from the content-addressed store, hash-verified

104 * @since 4.0.0
105 */
106export const createResolveLocalPackageImports = (pathService: Path.Path): Plugin => ({
107 name: "rollup-plugin-resolve-imports",
108 async resolveId(source, importer) {
109 const match = source.match(EFFECT_PACKAGE_REGEX)
110 if (Predicate.isNotNull(match)) {
111 const packageName = match[1]
112 const packageJson = await this.resolve(`${packageName}/package.json`, importer, { skipSelf: true })
113 if (packageJson === null) return null
114 const resolved = await this.resolve(source, importer, { skipSelf: true })
115 if (resolved === null) return null
116 return {
117 ...resolved,
118 id: toLocalDistPath(pathService, pathService.dirname(packageJson.id), resolved.id),
119 external: false
120 }
121 }
122 return null
123 }
124})
125
126/**
127 * Creates the full Rollup plugin pipeline for bundling.

Callers 2

Plugins.test.tsFile · 0.90
createPluginsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected