![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@remix-project/remix-url-resolver
Advanced tools
@remix-project/remix-url-resolver
is a tool to handle import from different sources and resolve the content. It is used in Remix IDE to handle imports from GitHub
, Swarm
, IPFS
and other URLs.
@remix-project/remix-url-resolver
is an NPM package and can be installed using NPM as:
yarn add @remix-project/remix-url-resolver
@remix-project/remix-url-resolver
exports:
export declare class RemixURLResolver {
private previouslyHandled;
gistAccessToken: string;
constructor(gistToken?: string);
/**
* Handle an import statement based on github
* @param root The root of the github import statement
* @param filePath path of the file in github
*/
handleGithubCall(root: string, filePath: string): Promise<HandlerResponse>;
/**
* Handle an import statement based on http
* @param url The url of the import statement
* @param cleanUrl
*/
handleHttp(url: string, cleanUrl: string): Promise<HandlerResponse>;
/**
* Handle an import statement based on https
* @param url The url of the import statement
* @param cleanUrl
*/
handleHttps(url: string, cleanUrl: string): Promise<HandlerResponse>;
handleSwarm(url: string, cleanUrl: string): Promise<HandlerResponse>;
/**
* Handle an import statement based on IPFS
* @param url The url of the IPFS import statement
*/
handleIPFS(url: string): Promise<HandlerResponse>;
getHandlers(): Handler[];
resolve(filePath: string, customHandlers?: Handler[]): Promise<Imported>;
}
Usage
resolve(url, customHandlers)
function should be called from within handleImportCb
function of solc.compile(input, handleImportCb)
.
import { RemixURLResolver } from 'remix-url-resolver'
const urlResolver = new RemixURLResolver()
const fileName: string = '../greeter.sol'
urlResolver.resolve(fileName, urlHandler)
.then((sources: object) => {
console.log(sources)
})
.catch((e: Error) => {
throw e
})
Please feel free to open an issue or a pull request.
In case you want to add some code, do have a look at our contribution guidelines here. Reach us on Gitter in case of any queries.
MIT © 2018-21 Remix Team
FAQs
Solidity import url resolver engine
We found that @remix-project/remix-url-resolver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.