Socket
Socket
Sign inDemoInstall

liferay-npm-bundler-loader-css-loader

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liferay-npm-bundler-loader-css-loader - npm Package Compare versions

Comparing version 2.13.0 to 2.13.1

19

lib/__tests__/index.test.js

@@ -27,3 +27,3 @@ 'use strict';

var savedProjectDir = _project2.default.dir;
var savedProjectPath = _project2.default.dir.asNative;

@@ -36,3 +36,3 @@ describe('standard projects', function () {

afterEach(function () {
_project2.default.loadFrom(savedProjectDir);
_project2.default.loadFrom(savedProjectPath);
});

@@ -105,3 +105,14 @@

it('dumps correct URL in windows', function () {});
it('strips source dirs from URL', function () {
var context = {
content: '',
filePath: 'src' + _path2.default.sep + 'file.css',
log: new _pluginLogger2.default(),
extraArtifacts: {}
};
(0, _index2.default)(context, {});
expect(context.extraArtifacts[context.filePath + '.js.wrap-modules-amd.template']).toMatch('.ThemeDisplay.getPathContext() + "/o/a-project/file.css"');
});
});

@@ -115,3 +126,3 @@

afterEach(function () {
_project2.default.loadFrom(savedProjectDir);
_project2.default.loadFrom(savedProjectPath);
});

@@ -118,0 +129,0 @@

@@ -29,2 +29,6 @@ 'use strict';

var _filePath = require('liferay-npm-build-tools-common/lib/file-path');
var _filePath2 = _interopRequireDefault(_filePath);
var _project = require('liferay-npm-build-tools-common/lib/project');

@@ -40,8 +44,2 @@

/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
function getHref(filePath, extension, pathModule) {

@@ -53,3 +51,3 @@ var webContextPath = void 0;

} else {
var bnd = _fs2.default.readFileSync(_path2.default.join(_project2.default.dir, 'bnd.bnd')).toString();
var bnd = _fs2.default.readFileSync(_project2.default.dir.join('bnd.bnd').asNative).toString();

@@ -65,5 +63,8 @@ var lines = bnd.split('\n');

_project2.default.sources.asPlatform.forEach(function (source) {
if (filePath.startsWith(source)) {
filePath = filePath.substring(source.length + 1);
_project2.default.sources.asNative.forEach(function (sourcePath) {
// Remove `./` from sourcePath so that it matches the filePath correctly
sourcePath = sourcePath.substring(2);
if (filePath.startsWith(sourcePath)) {
filePath = filePath.substring(sourcePath.length + 1);
}

@@ -82,5 +83,3 @@ });

if (_path2.default.sep !== '/') {
filePath = filePath.replace(new RegExp(_path2.default.sep, 'g'), '/');
}
filePath = new _filePath2.default(filePath).asPosix;

@@ -93,2 +92,7 @@ return '' + pathModule + webContextPath + '/' + filePath;

*/
/**
* © 2017 Liferay, Inc. <https://liferay.com>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
//# sourceMappingURL=index.js.map
{
"name": "liferay-npm-bundler-loader-css-loader",
"version": "2.13.0",
"version": "2.13.1",
"description": "A liferay-npm-bundler loader that turns CSS files into JavaScript modules that inject a <link> into the HTML when they are required.",

@@ -15,4 +15,4 @@ "main": "lib/index.js",

"dependencies": {
"liferay-npm-build-tools-common": "2.13.0"
"liferay-npm-build-tools-common": "2.13.1"
}
}

@@ -13,3 +13,3 @@ /**

const savedProjectDir = project.dir;
const savedProjectPath = project.dir.asNative;

@@ -22,3 +22,3 @@ describe('standard projects', () => {

afterEach(() => {
project.loadFrom(savedProjectDir);
project.loadFrom(savedProjectPath);
});

@@ -108,3 +108,18 @@

it('dumps correct URL in windows', () => {});
it('strips source dirs from URL', () => {
const context = {
content: '',
filePath: `src${path.sep}file.css`,
log: new PluginLogger(),
extraArtifacts: {},
};
loader(context, {});
expect(
context.extraArtifacts[
`${context.filePath}.js.wrap-modules-amd.template`
]
).toMatch('.ThemeDisplay.getPathContext() + "/o/a-project/file.css"');
});
});

@@ -118,3 +133,3 @@

afterEach(() => {
project.loadFrom(savedProjectDir);
project.loadFrom(savedProjectPath);
});

@@ -121,0 +136,0 @@

@@ -8,2 +8,3 @@ /**

import fs from 'fs';
import FilePath from 'liferay-npm-build-tools-common/lib/file-path';
import project from 'liferay-npm-build-tools-common/lib/project';

@@ -56,3 +57,3 @@ import path from 'path';

const bnd = fs
.readFileSync(path.join(project.dir, 'bnd.bnd'))
.readFileSync(project.dir.join('bnd.bnd').asNative)
.toString();

@@ -69,5 +70,8 @@

project.sources.asPlatform.forEach(source => {
if (filePath.startsWith(source)) {
filePath = filePath.substring(source.length + 1);
project.sources.asNative.forEach(sourcePath => {
// Remove `./` from sourcePath so that it matches the filePath correctly
sourcePath = sourcePath.substring(2);
if (filePath.startsWith(sourcePath)) {
filePath = filePath.substring(sourcePath.length + 1);
}

@@ -89,7 +93,5 @@ });

if (path.sep !== '/') {
filePath = filePath.replace(new RegExp(path.sep, 'g'), '/');
}
filePath = new FilePath(filePath).asPosix;
return `${pathModule}${webContextPath}/${filePath}`;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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