0.0.88 • Published 8 months ago

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

Weekly downloads
68
License
MIT
Repository
github
Last release
8 months 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.88

8 months ago

0.0.87

8 months ago

0.0.86

9 months ago

0.0.84

10 months ago

0.0.85

10 months ago

0.0.80

12 months ago

0.0.81

12 months ago

0.0.82

11 months ago

0.0.83

10 months ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.77

1 year ago

0.0.76

1 year ago

0.0.75

1 year ago

0.0.74

1 year ago

0.0.73

1 year ago

0.0.72

1 year ago

0.0.71

1 year ago

0.0.70

1 year ago

0.0.69

1 year ago

0.0.68

1 year ago

0.0.67

1 year ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.51

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.47

2 years ago

0.0.47-alpha.14

2 years ago

0.0.47-alpha.13

2 years ago

0.0.47-alpha.16

2 years ago

0.0.47-alpha.15

2 years ago

0.0.47-alpha.17

2 years ago

0.0.47-alpha.1

2 years ago

0.0.47-alpha.0

2 years ago

0.0.47-alpha.3

2 years ago

0.0.47-alpha.2

2 years ago

0.0.47-alpha.5

2 years ago

0.0.47-alpha.4

2 years ago

0.0.47-alpha.7

2 years ago

0.0.47-alpha.6

2 years ago

0.0.47-alpha.9

2 years ago

0.0.47-alpha.8

2 years ago

0.0.47-alpha.10

2 years ago

0.0.47-alpha.12

2 years ago

0.0.47-alpha.11

2 years ago

0.0.46

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.4-3.beta.0

2 years ago

0.0.4-3.beta.1

2 years ago

0.0.4-3.beta.2

2 years ago

0.0.44-alpha.0

2 years ago

0.0.44-beta.0

2 years ago

0.0.44-alpha.5

2 years ago

0.0.44-alpha.3

2 years ago

0.0.44-alpha.4

2 years ago

0.0.44-alpha.1

2 years ago

0.0.44-alpha.2

2 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.37

3 years ago

0.0.36

3 years ago

0.0.37-alpha.0

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago