mirror of https://github.com/webpack/webpack.git
				
				
				
			
		
			
	
	
		
			19 lines
		
	
	
		
			522 B
		
	
	
	
		
			JavaScript
		
	
	
	
		
		
			
		
	
	
			19 lines
		
	
	
		
			522 B
		
	
	
	
		
			JavaScript
		
	
	
	
|  | const stringifyRequest = require("loader-utils").stringifyRequest; | ||
|  | 
 | ||
|  | module.exports.pitch = function(remainingRequest) { | ||
|  | 	return `
 | ||
|  | 	import { getString as _getString, memory } from ${stringifyRequest( | ||
|  | 		this, | ||
|  | 		`${this.resourcePath}.wasm!=!wast-loader!${remainingRequest}` | ||
|  | 	)}; | ||
|  | 
 | ||
|  | 	export function getString() { | ||
|  | 		const strBuf = new Uint8Array(memory.buffer, _getString()); | ||
|  | 		const idx = strBuf.indexOf(0); | ||
|  | 		const strBuf2 = strBuf.slice(0, idx); | ||
|  | 		const str = Buffer.from(strBuf2).toString("utf-8"); | ||
|  | 		return str; | ||
|  | 	}; | ||
|  | 	`;
 | ||
|  | }; |