Figured out how to export ToC via mdx-loader
This commit is contained in:
		
				
					committed by
					
						
						fabioberger
					
				
			
			
				
	
			
			
			
						parent
						
							8bd2411a89
						
					
				
				
					commit
					1ded7cd4f1
				
			@@ -1,7 +1,3 @@
 | 
				
			|||||||
export const meta = {
 | 
					 | 
				
			||||||
    title: 'Sol-compiler Usage',
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sol-coverage uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with `ProviderEngine`, please read the [Web3 Provider explained](https://0x.org/wiki#Web3-Provider-Explained) wiki article.
 | 
					Sol-coverage uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with `ProviderEngine`, please read the [Web3 Provider explained](https://0x.org/wiki#Web3-Provider-Explained) wiki article.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot.
 | 
					The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -135,8 +135,10 @@
 | 
				
			|||||||
        "css-loader": "0.23.x",
 | 
					        "css-loader": "0.23.x",
 | 
				
			||||||
        "less-loader": "^4.1.0",
 | 
					        "less-loader": "^4.1.0",
 | 
				
			||||||
        "make-promises-safe": "^1.1.0",
 | 
					        "make-promises-safe": "^1.1.0",
 | 
				
			||||||
 | 
					        "mdx-table-of-contents": "^0.1.0",
 | 
				
			||||||
        "raw-loader": "^0.5.1",
 | 
					        "raw-loader": "^0.5.1",
 | 
				
			||||||
        "react-svg-loader": "^2.1.0",
 | 
					        "react-svg-loader": "^2.1.0",
 | 
				
			||||||
 | 
					        "remark-slug": "^5.1.2",
 | 
				
			||||||
        "rollbar-sourcemap-webpack-plugin": "^2.4.0",
 | 
					        "rollbar-sourcemap-webpack-plugin": "^2.4.0",
 | 
				
			||||||
        "shx": "^0.2.2",
 | 
					        "shx": "^0.2.2",
 | 
				
			||||||
        "source-map-loader": "^0.2.4",
 | 
					        "source-map-loader": "^0.2.4",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,10 @@ export const DocsView: React.FC<IDocsViewProps> = props => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const loadPageAsync = async (fileName: string) => {
 | 
					    const loadPageAsync = async (fileName: string) => {
 | 
				
			||||||
        const component = await import(`../../../md/new-docs/${fileName}.mdx`);
 | 
					        const component = await import(`../../../md/new-docs/${fileName}.mdx`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (component) {
 | 
					        if (component) {
 | 
				
			||||||
 | 
					            console.log('component', component);
 | 
				
			||||||
 | 
					            console.log('component.tableOfContents()', component.tableOfContents());
 | 
				
			||||||
            setState({
 | 
					            setState({
 | 
				
			||||||
                // title: component.meta.title,
 | 
					                // title: component.meta.title,
 | 
				
			||||||
                Component: component.default,
 | 
					                Component: component.default,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,12 @@
 | 
				
			|||||||
 | 
					const fs = require('fs');
 | 
				
			||||||
const path = require('path');
 | 
					const path = require('path');
 | 
				
			||||||
const webpack = require('webpack');
 | 
					const webpack = require('webpack');
 | 
				
			||||||
const TerserPlugin = require('terser-webpack-plugin');
 | 
					const TerserPlugin = require('terser-webpack-plugin');
 | 
				
			||||||
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
 | 
					const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
 | 
				
			||||||
const childProcess = require('child_process');
 | 
					const childProcess = require('child_process');
 | 
				
			||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
 | 
					const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
 | 
				
			||||||
const fs = require('fs');
 | 
					const mdxTableOfContents = require('mdx-table-of-contents');
 | 
				
			||||||
const homeDir = require('os').homedir();
 | 
					const remarkSlug = require('remark-slug');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const GIT_SHA = childProcess
 | 
					const GIT_SHA = childProcess
 | 
				
			||||||
    .execSync('git rev-parse HEAD')
 | 
					    .execSync('git rev-parse HEAD')
 | 
				
			||||||
@@ -76,7 +77,13 @@ const config = {
 | 
				
			|||||||
                            presets: ['env', 'react'],
 | 
					                            presets: ['env', 'react'],
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    '@mdx-js/loader',
 | 
					                    {
 | 
				
			||||||
 | 
					                        loader: '@mdx-js/loader',
 | 
				
			||||||
 | 
					                        options: {
 | 
				
			||||||
 | 
					                            remarkPlugins: [remarkSlug],
 | 
				
			||||||
 | 
					                            compilers: [mdxTableOfContents],
 | 
				
			||||||
 | 
					                        },
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
                ],
 | 
					                ],
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user