pug-plugin
Advanced tools
Comparing version 4.9.8 to 4.9.9
# Change log | ||
## 4.9.9 (2023-08-12) | ||
- fix: resolve filename containing a URI fragment, e.g.: | ||
```pug | ||
use(href=require("./icons.svg#home")) | ||
``` | ||
- chore: update npm packages | ||
## 4.9.8 (2023-07-06) | ||
@@ -4,0 +11,0 @@ - fix: missing slash in output filename when publicPath is an url |
{ | ||
"name": "pug-plugin", | ||
"version": "4.9.8", | ||
"version": "4.9.9", | ||
"description": "Pug plugin for webpack compiles Pug files to HTML, extracts CSS and JS from their sources specified in Pug.", | ||
"keywords": [ | ||
"pug", | ||
"loader", | ||
"plugin", | ||
"loader", | ||
"webpack", | ||
@@ -16,5 +16,2 @@ "html", | ||
"script", | ||
"svg", | ||
"responsive", | ||
"image", | ||
"markdown" | ||
@@ -66,31 +63,31 @@ ], | ||
"dependencies": { | ||
"@webdiscus/pug-loader": "2.10.4", | ||
"@webdiscus/pug-loader": "2.10.5", | ||
"ansis": "1.5.5", | ||
"json5": "^2.2.3", | ||
"js-beautify": "^1.14.7" | ||
"js-beautify": "^1.14.9" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.12", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/core": "^7.22.10", | ||
"@babel/preset-env": "^7.22.10", | ||
"@test-fixtures/lorem": "0.0.2", | ||
"@test-fixtures/js": "0.0.2", | ||
"@test-fixtures/scss": "0.0.7", | ||
"@types/jest": "^29.4.0", | ||
"css-loader": "^6.7.3", | ||
"@types/jest": "^29.5.3", | ||
"css-loader": "^6.8.1", | ||
"html-loader": "^4.2.0", | ||
"jest": "^29.4.3", | ||
"mini-css-extract-plugin": "^2.7.2", | ||
"cssnano": "^5.1.15", | ||
"jest": "^29.6.2", | ||
"mini-css-extract-plugin": "^2.7.6", | ||
"cssnano": "^6.0.1", | ||
"normalize.css": "^8.0.1", | ||
"postcss-loader": "^7.0.2", | ||
"prettier": "^2.8.4", | ||
"postcss-loader": "^7.3.3", | ||
"prettier": "^3.0.1", | ||
"responsive-loader": "^3.1.2", | ||
"sass": "^1.58.3", | ||
"sass-loader": "^13.2.0", | ||
"sharp": "^0.31.3", | ||
"sass": "^1.65.1", | ||
"sass-loader": "^13.3.2", | ||
"sharp": "^0.32.4", | ||
"svgo-loader": "^4.0.0", | ||
"tsconfig-paths-webpack-plugin": "^4.0.0", | ||
"webpack": "^5.75.0", | ||
"webpack-merge": "^5.8.0" | ||
"tsconfig-paths-webpack-plugin": "^4.1.0", | ||
"webpack": "^5.88.2", | ||
"webpack-merge": "^5.9.0" | ||
} | ||
} |
@@ -88,3 +88,3 @@ const path = require('path'); | ||
// if public path is relative, then a resource using not in the template file must be auto resolved | ||
// if the public path is relative, then a resource using not in the template file must be auto resolved | ||
if (this.isAutoPublicPath || isAutoRelative) { | ||
@@ -107,31 +107,5 @@ if (!issuer) return assetFile; | ||
return path.posix.join(this.publicPath, assetFile); | ||
//return this.publicPath + '' + assetFile; | ||
} | ||
/** | ||
* Get the output asset file regards the publicPath. | ||
* | ||
* @param {string} assetFile The output asset filename relative by output path. | ||
* @param {string} issuer The output issuer filename relative by output path. | ||
* @return {string} | ||
*/ | ||
// static getAssetOutputFile(assetFile, issuer) { | ||
// const isAutoRelative = issuer && this.isRelativePublicPath && !this.AssetEntry.isEntrypoint(issuer); | ||
// | ||
// // if the public path is relative, then a resource using not in the template file must be auto resolved | ||
// if (this.autoPublicPath || isAutoRelative) { | ||
// if (!issuer) return assetFile; | ||
// | ||
// const issuerFullFilename = path.resolve(this.webpackOutputPath, issuer); | ||
// const context = path.dirname(issuerFullFilename); | ||
// const file = path.posix.join(this.webpackOutputPath, assetFile); | ||
// const outputFilename = path.relative(context, file); | ||
// | ||
// return isWin ? pathToPosix(outputFilename) : outputFilename; | ||
// } | ||
// | ||
// return this.webpackPublicPath + '' + assetFile; | ||
// } | ||
/** | ||
* Add resolved module asset. | ||
@@ -138,0 +112,0 @@ * This asset can be as issuer for other resource assets. |
@@ -22,3 +22,17 @@ const AssetTrash = require('./AssetTrash'); | ||
const { buildInfo, resource } = module; | ||
const assetFile = buildInfo.filename; | ||
let assetFile = buildInfo.filename; | ||
// resolve SVG filename with fragment, like './icons.svg#home' | ||
if (resource.indexOf('.svg#') > 0) { | ||
if (assetFile.indexOf('.svg#') > 0) { | ||
// fix save file name when filename in Webpack config is like '[name][ext][fragment]' | ||
const [file] = assetFile.split('#'); | ||
buildInfo.filename = file; | ||
} else { | ||
// fix output asset filename used in HTML | ||
const [, fragment] = resource.split('#'); | ||
assetFile += `#${fragment}`; | ||
} | ||
} | ||
// try to get asset file processed via responsive-loader | ||
@@ -33,3 +47,3 @@ const asset = ResponsiveLoader.getAsset(module, issuer); | ||
// remove original asset filename generated by Webpack, because responsive-loader generates own filename | ||
// remove an original asset filename generated by Webpack, because responsive-loader generates own filename | ||
AssetTrash.add(assetFile); | ||
@@ -36,0 +50,0 @@ return; |
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
178093
2992
+ Added@babel/parser@7.26.5(transitive)
+ Added@babel/types@7.26.5(transitive)
+ Added@webdiscus/pug-loader@2.10.5(transitive)
+ Addedcaniuse-lite@1.0.30001692(transitive)
+ Addedelectron-to-chromium@1.5.80(transitive)
- Removed@babel/parser@7.26.3(transitive)
- Removed@babel/types@7.26.3(transitive)
- Removed@webdiscus/pug-loader@2.10.4(transitive)
- Removedcaniuse-lite@1.0.30001690(transitive)
- Removedelectron-to-chromium@1.5.79(transitive)
Updated@webdiscus/pug-loader@2.10.5
Updatedjs-beautify@^1.14.9