Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webdiscus/pug-loader

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webdiscus/pug-loader - npm Package Compare versions

Comparing version 2.10.1 to 2.10.2

3

CHANGELOG.md
# Change log
## 2.10.2 (2023-01-15)
- fix(for pug-plugin): resolving of inline JS source file
## 2.10.1 (2023-01-15)

@@ -4,0 +7,0 @@ - feat(for pug-plugin): add supports for inline JS

2

package.json
{
"name": "@webdiscus/pug-loader",
"version": "2.10.1",
"version": "2.10.2",
"description": "Pug loader renders Pug files into HTML or compiles them into a template function.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -77,2 +77,4 @@ const fs = require('fs');

let lastTag = '';
/**

@@ -87,3 +89,6 @@ * Resolve filenames in Pug node.

if (isRequired(node.val)) {
node.val = Loader.resolveResource(node.val, node.filename);
node.val =
lastTag === 'script'
? Loader.resolveScript(node.val, node.filename)
: Loader.resolveResource(node.val, node.filename);
}

@@ -102,2 +107,5 @@ break;

break;
case 'Tag':
lastTag = node.name;
// fallthrough
default:

@@ -104,0 +112,0 @@ resolveNodeAttributes(node, 'attrs');

@@ -25,7 +25,7 @@ const { merge } = require('webpack-merge');

/**
* @param {string} filename The pug template file.
* @param {string} filename The template file.
* @param {string} resourceQuery The URL query of template.
* @param {{}} options The loader options.
* @param {{}} customData The custom data.
* @param {boolean} isPlugin Whether the pug-loader work under pug-plugin.
* @param {boolean} isPlugin Whether the loader work under the plugin.
*/

@@ -35,4 +35,3 @@ static init({ filename: templateFile, resourceQuery, options, customData, isPlugin }) {

// the rule: a method defined in the resource query has the highest priority over a method defined in the loaderName options
// because a method from loaderName options is global but a query method override a global method
// the rule: a query method override a global method defined in the loader options
const queryData = getQueryData(resourceQuery);

@@ -50,3 +49,3 @@

// remove pug method from query data to pass in pug only clean data
// remove method from query data to pass in the template only clean data
const query = this.compiler.query;

@@ -53,0 +52,0 @@ if (queryData.hasOwnProperty(query)) {

@@ -116,3 +116,3 @@ const VMScript = require('../VMScript');

* which will be called when this template is compiled in the VM.
* The filename from the script tag will be stored for usage in pug-plugin.
* The filename from the script tag will be stored for usage in the plugin.
*

@@ -119,0 +119,0 @@ * @param {string} file The required file.

/**
* The share point between pug-plugin and pug-loader instances.
* The share point between plugin and loader instances.
*/

@@ -10,9 +10,9 @@ class Plugin {

/**
* Set use state of pug-plugin.
* Set use state of the plugin.
*
* If pug-plugin is used, then this method will be called by pug-plugin initialisation
* to disable some features of pug-plugin, because never used with pug-plugin,
* If the plugin is used, then this method will be called by the plugin initialisation
* to disable some features of the plugin, because never used with the plugin,
* but require additional compilation time.
*
* @param {{}} options The options of Pug plugin.
* @param {{}} options The options of the plugin.
*/

@@ -30,7 +30,7 @@ static init(options) {

static getStyleRestrictions() {
return this.options ? [this.options.extractCss.test] : [];
return this.options ? [this.options.extractCss?.test] : [];
}
/**
* Whether is pug-plugin used.
* Whether is the plugin used.
* @return {boolean}

@@ -37,0 +37,0 @@ */

@@ -225,3 +225,3 @@ const fs = require('fs');

* Resolve script request w/o extension.
* The extension must be resolved to generate correct unique JS filename in pug-plugin.
* The extension must be resolved to generate correct unique JS filename in the plugin.
* For example: `vendor.min?key=val` resolve to `vendor.min.js?key=val`.

@@ -228,0 +228,0 @@ *

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc