0.0.77 • Published 14 days ago

@remix-project/remix-url-resolver v0.0.77

Weekly downloads
68
License
MIT
Repository
github
Last release
14 days ago

Remix Url Resolver

npm version npm npm GitHub contributions welcome

@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.

Installation

@remix-project/remix-url-resolver is an NPM package and can be installed using NPM as:

yarn add @remix-project/remix-url-resolver

How to use

@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
	})

References

Contribute

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.

License

MIT © 2018-21 Remix Team

0.0.77

14 days ago

0.0.76

29 days ago

0.0.75

1 month ago

0.0.74

1 month ago

0.0.73

2 months ago

0.0.72

2 months ago

0.0.71

3 months ago

0.0.70

3 months ago

0.0.69

4 months ago

0.0.68

4 months ago

0.0.67

5 months ago

0.0.62

7 months ago

0.0.63

6 months ago

0.0.64

6 months ago

0.0.65

6 months ago

0.0.66

5 months ago

0.0.60

9 months ago

0.0.61

9 months ago

0.0.59

10 months ago

0.0.55

10 months ago

0.0.56

10 months ago

0.0.57

10 months ago

0.0.58

10 months ago

0.0.51

12 months ago

0.0.53

12 months ago

0.0.54

12 months ago

0.0.50

12 months ago

0.0.48

12 months ago

0.0.49

12 months ago

0.0.47

1 year ago

0.0.47-alpha.14

1 year ago

0.0.47-alpha.13

1 year ago

0.0.47-alpha.16

1 year ago

0.0.47-alpha.15

1 year ago

0.0.47-alpha.17

1 year ago

0.0.47-alpha.1

1 year ago

0.0.47-alpha.0

1 year ago

0.0.47-alpha.3

1 year ago

0.0.47-alpha.2

1 year ago

0.0.47-alpha.5

1 year ago

0.0.47-alpha.4

1 year ago

0.0.47-alpha.7

1 year ago

0.0.47-alpha.6

1 year ago

0.0.47-alpha.9

1 year ago

0.0.47-alpha.8

1 year ago

0.0.47-alpha.10

1 year ago

0.0.47-alpha.12

1 year ago

0.0.47-alpha.11

1 year ago

0.0.46

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.4-3.beta.0

1 year ago

0.0.4-3.beta.1

1 year ago

0.0.4-3.beta.2

1 year ago

0.0.44-alpha.0

1 year ago

0.0.44-beta.0

1 year ago

0.0.44-alpha.5

1 year ago

0.0.44-alpha.3

1 year ago

0.0.44-alpha.4

1 year ago

0.0.44-alpha.1

1 year ago

0.0.44-alpha.2

1 year ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.37

2 years ago

0.0.36

2 years ago

0.0.37-alpha.0

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

4 years ago

0.0.16

4 years ago