mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	feat(deps): benchpressjs@2.2.1 (#8887)
Better warnings, faster template compiles
This commit is contained in:
		| @@ -240,7 +240,7 @@ async function compileTemplate() { | |||||||
| 	const source = await fs.promises.readFile(sourceFile, 'utf8'); | 	const source = await fs.promises.readFile(sourceFile, 'utf8'); | ||||||
|  |  | ||||||
| 	const [compiled] = await Promise.all([ | 	const [compiled] = await Promise.all([ | ||||||
| 		Benchpress.precompile(source), | 		Benchpress.precompile(source, { filename: 'install/index.tpl' }), | ||||||
| 		mkdirp(path.dirname(destJs)), | 		mkdirp(path.dirname(destJs)), | ||||||
| 	]); | 	]); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -81,9 +81,7 @@ const buildCustomTemplates = async (config) => { | |||||||
|  |  | ||||||
| 		await Promise.all(templatesToBuild.map(async (template) => { | 		await Promise.all(templatesToBuild.map(async (template) => { | ||||||
| 			const source = await meta.templates.processImports(paths, template.path, template.text); | 			const source = await meta.templates.processImports(paths, template.path, template.text); | ||||||
| 			const compiled = await Benchpress.precompile(source, { | 			const compiled = await Benchpress.precompile(source, { filename: template.path }); | ||||||
| 				minify: global.env !== 'development', |  | ||||||
| 			}); |  | ||||||
| 			await fs.promises.writeFile(template.fullpath.replace(/\.tpl$/, '.js'), compiled); | 			await fs.promises.writeFile(template.fullpath.replace(/\.tpl$/, '.js'), compiled); | ||||||
| 		})); | 		})); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -111,9 +111,7 @@ async function compileTemplate(filename, source) { | |||||||
| 	})); | 	})); | ||||||
|  |  | ||||||
| 	source = await processImports(paths, filename, source); | 	source = await processImports(paths, filename, source); | ||||||
| 	const compiled = await Benchpress.precompile(source, { | 	const compiled = await Benchpress.precompile(source, { filename }); | ||||||
| 		minify: process.env.NODE_ENV !== 'development', |  | ||||||
| 	}); |  | ||||||
| 	return await fs.promises.writeFile(path.join(viewsPath, filename.replace(/\.tpl$/, '.js')), compiled); | 	return await fs.promises.writeFile(path.join(viewsPath, filename.replace(/\.tpl$/, '.js')), compiled); | ||||||
| } | } | ||||||
| Templates.compileTemplate = compileTemplate; | Templates.compileTemplate = compileTemplate; | ||||||
| @@ -136,7 +134,7 @@ async function compile() { | |||||||
| 		await mkdirp(path.join(viewsPath, path.dirname(name))); | 		await mkdirp(path.join(viewsPath, path.dirname(name))); | ||||||
|  |  | ||||||
| 		await fs.promises.writeFile(path.join(viewsPath, name), imported); | 		await fs.promises.writeFile(path.join(viewsPath, name), imported); | ||||||
| 		const compiled = await Benchpress.precompile(imported, { minify: process.env.NODE_ENV !== 'development' }); | 		const compiled = await Benchpress.precompile(imported, { filename: name }); | ||||||
| 		await fs.promises.writeFile(path.join(viewsPath, name.replace(/\.tpl$/, '.js')), compiled); | 		await fs.promises.writeFile(path.join(viewsPath, name.replace(/\.tpl$/, '.js')), compiled); | ||||||
| 	})); | 	})); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user