@webdiscus/pug-loader
Advanced tools
Comparing version 1.7.2 to 1.7.3
# Change log | ||
## 1.7.3 (2022-02-19) | ||
- fix collision with local variables passed in template function for compile method | ||
## 1.7.2 (2022-02-19) | ||
@@ -4,0 +7,0 @@ - fix path error in Windows when watching dependencies |
{ | ||
"name": "@webdiscus/pug-loader", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "The pug loader resolves paths and webpack aliases in a pug template and compiles it to HTML or into a template function.", | ||
@@ -82,3 +82,3 @@ "keywords": [ | ||
"prettier": "^2.5.1", | ||
"pug-plugin": "^1.4.0", | ||
"pug-plugin": "^1.4.1", | ||
"rimraf": "^3.0.2", | ||
@@ -85,0 +85,0 @@ "tsconfig-paths-webpack-plugin": "^3.5.2", |
@@ -144,8 +144,7 @@ // add polyfill for node.js >= 12.0.0 && < 15.0.0 | ||
// custom options from HtmlWebpackPlugin can be used in pug | ||
let htmlWebpackPluginOptions = getHtmlWebpackPluginOptions(loaderContext); | ||
const htmlWebpackPluginOptions = getHtmlWebpackPluginOptions(loaderContext); | ||
const locals = merge(loaderOptions.data || {}, htmlWebpackPluginOptions, resourceParams); | ||
const funcBody = Object.keys(locals).length ? injectExternalVariables(pugResult.body, locals) : pugResult.body; | ||
const result = loaderMethod.export(loaderContext.resourcePath, funcBody, locals, esModule); | ||
const locals = merge(loaderOptions.data || {}, htmlWebpackPluginOptions, resourceParams), | ||
funcBody = Object.keys(locals).length ? injectExternalVariables(pugResult.body, locals) : pugResult.body, | ||
result = loaderMethod.export(loaderContext.resourcePath, funcBody, locals, esModule); | ||
callback(null, result); | ||
@@ -152,0 +151,0 @@ }; |
@@ -49,3 +49,3 @@ const path = require('path'); | ||
if (str[0] !== '?') return {}; | ||
const query = str.substr(1); | ||
const query = str.substring(1); | ||
@@ -80,3 +80,6 @@ return parseResourceData(query); | ||
`;\n` + | ||
funcBody.replace(/(?<=locals_for_with = )(?:\(locals \|\| {}\))(?=;)/, 'Object.assign(__external_locals__, locals)'); | ||
funcBody.replace( | ||
/(?<=locals_for_with = )(?:\(locals \|\| {}\))(?=;)/, | ||
'Object.assign({}, __external_locals__, locals || {})' | ||
); | ||
@@ -83,0 +86,0 @@ module.exports = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63061
681