Socket
Socket
Sign inDemoInstall

case-sensitive-paths-webpack-plugin

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.1.2

39

CHANGELOG.md

@@ -1,21 +0,26 @@

# Changelog
### Changelog
All notable changes to this project will be documented in this file.
## 2017-5-30:
### 2.1.1
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
* Properly support older versions of node. Tested in:
* 4.8.3
* 5.11.1
* 6.10.3
### [v2.1.2](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/compare/1.1.4...v2.1.2)
> 6 March 2018
- Add support for webpack 4 [`#31`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/31)
- Add license scan report and status [`#27`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/27)
- Use compiler filesystem [`#14`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/14)
- Add `files` to `package.json`. [`#15`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/15)
- Update README.md [`#13`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/13)
- Merge FOSSA's badge [`be74649`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/be74649d64c70f8b79efe25c320e737c2ebef07a)
- Testing improvements. [`2abbfce`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/2abbfce8f963b48ad596f6f46065575216abd6a5)
- Fix badges. [`face6dc`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/face6dc4b5b6a0f9820d89e79cab308e2dede4b8)
### 2.1.0
#### 1.1.4
> 6 September 2016
- Don't crash on folder deletion with tests [`#10`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/10)
- Normalize filenames to default Unicode Normalization Form (NFC) so th… [`#6`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/6)
- Working E2E Tests in a Demo Project [`#4`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/4)
- check for windows-style root paths [`#2`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/pull/2)
- Handle situations where user has CDed into incorrectly cased directory [`d02babf`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/d02babf89f0bf4251efbd7ca5d64a79211487a74)
- Release 1.1.3 [`21390e1`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/21390e1d25ff9ed46229fb0541329e753a1f3410)
- Reduce waittime [`d0fd084`](https://github.com/Urthen/case-sensitive-paths-webpack-plugin/commit/d0fd084236b231283191a4099c97584b2bba1676)
* No longer will intercept what should be a standard Webpack "File not found" error.
* This also resolves the issue where the plugin wouldn't recognize when a file was added.
* Hardened tests.
* Cleaned up code and added an 'engines' config to package.json
## 2017-3-31:
### 2.0.0
* Use the compiler filesystem, which helps when other plugins change the 'fs' object being used by the compiler.

@@ -1,2 +0,5 @@

"use strict";
/* eslint-disable strict */
'use strict';
/* This plugin based on https://gist.github.com/Morhaus/333579c2a5b4db644bd5

@@ -71,3 +74,3 @@

CaseSensitivePathsPlugin.prototype.fileExistsWithCase = function (filepath, callback) {
// Split filepath into current filename (or directory name) and parent directory tree.
// Split filepath into current filename (or directory name) and parent directory tree.
const that = this;

@@ -78,3 +81,3 @@ const dir = path.dirname(filepath);

// If we are at the root, or have found a path we already know is good, return.
// If we are at the root, or have found a path we already know is good, return.
if (parsedPath.dir === parsedPath.root || dir === '.' || Object.prototype.hasOwnProperty.call(that.pathCache, filepath)) {

@@ -85,8 +88,8 @@ callback();

// Check all filenames in the current dir against current filename to ensure one of them matches.
// Read from the cache if available, from FS if not.
// Check all filenames in the current dir against current filename to ensure one of them matches.
// Read from the cache if available, from FS if not.
that.getFilenamesInDir(dir, (filenames) => {
// If the exact match does not exist, attempt to find the correct filename.
// If the exact match does not exist, attempt to find the correct filename.
if (filenames.indexOf(filename) === -1) {
// Fallback value which triggers us to abort.
// Fallback value which triggers us to abort.
let correctFilename = '!nonexistent';

@@ -104,6 +107,6 @@

// If exact match exists, recurse through directory tree until root.
// If exact match exists, recurse through directory tree until root.
that.fileExistsWithCase(dir, (recurse) => {
// If found an error elsewhere, return that correct filename
// Don't bother caching - we're about to error out anyway.
// If found an error elsewhere, return that correct filename
// Don't bother caching - we're about to error out anyway.
if (!recurse) {

@@ -125,4 +128,4 @@ that.pathCache[dir] = filenames;

const that = this;
// Prime the cache with the current directory. We have to assume the current casing is correct,
// as in certain circumstances people can switch into an incorrectly-cased directory.
// Prime the cache with the current directory. We have to assume the current casing is correct,
// as in certain circumstances people can switch into an incorrectly-cased directory.
const currentPath = path.resolve();

@@ -137,37 +140,46 @@ that.getFilenamesInDir(currentPath, (files) => {

CaseSensitivePathsPlugin.prototype.apply = function (compiler) {
const that = this;
this.compiler = compiler;
compiler.plugin('done', () => {
if (that.options.debug) {
console.log('[CaseSensitivePathsPlugin] Total filesystem reads:', that.fsOperations);
const onDone = () => {
if (this.options.debug) {
console.log('[CaseSensitivePathsPlugin] Total filesystem reads:', this.fsOperations);
}
that.reset();
});
compiler.plugin('normal-module-factory', (nmf) => {
nmf.plugin('after-resolve', (data, done) => {
that.primeCache(() => {
// Trim ? off, since some loaders add that to the resource they're attemping to load
let pathName = data.resource.split('?')[0];
pathName = pathName.normalize ? pathName.normalize('NFC') : pathName;
this.reset();
};
that.fileExistsWithCase(pathName, (realName) => {
if (realName) {
if (realName === '!nonexistent') {
// If file does not exist, let Webpack show a more appropriate error.
done(null, data);
} else {
done(new Error(`[CaseSensitivePathsPlugin] \`${pathName}\` does not match the corresponding path on disk ${realName}`));
}
const onAfterResolve = (data, done) => {
this.primeCache(() => {
// Trim ? off, since some loaders add that to the resource they're attemping to load
let pathName = data.resource.split('?')[0];
pathName = pathName.normalize ? pathName.normalize('NFC') : pathName;
this.fileExistsWithCase(pathName, (realName) => {
if (realName) {
if (realName === '!nonexistent') {
// If file does not exist, let Webpack show a more appropriate error.
done(null, data);
} else {
done(null, data);
done(new Error(`[CaseSensitivePathsPlugin] \`${pathName}\` does not match the corresponding path on disk ${realName}`));
}
});
} else {
done(null, data);
}
});
});
});
};
if (compiler.hooks) {
compiler.hooks.done.tap('CaseSensitivePathsPlugin', onDone);
compiler.hooks.normalModuleFactory.tap('CaseSensitivePathsPlugin', (nmf) => {
nmf.hooks.afterResolve.tapAsync('CaseSensitivePathsPlugin', onAfterResolve);
});
} else {
compiler.plugin('done', onDone);
compiler.plugin('normal-module-factory', (nmf) => {
nmf.plugin('after-resolve', onAfterResolve);
});
}
};
module.exports = CaseSensitivePathsPlugin;
{
"name": "case-sensitive-paths-webpack-plugin",
"version": "2.1.1",
"version": "2.1.2",
"description": "Enforces module path case sensitivity in Webpack",
"engines": { "node": ">4.0" },
"engines": {
"node": ">=4"
},
"main": "index.js",

@@ -38,4 +40,4 @@ "scripts": {

"mocha": "^3.0.1",
"webpack": "^1.13.1"
"webpack": "^4.0.1"
}
}
Case Sensitive Paths - Webpack Plugin
==========
[![Build Status](https://travis-ci.org/Urthen/case-sensitive-paths-webpack-plugin.svg?branch=master)](https://travis-ci.org/Urthen/case-sensitive-paths-webpack-plugin)
[![Known Vulnerabilities](https://snyk.io/test/github/urthen/case-sensitive-paths-webpack-plugin/badge.svg?targetFile=package.json)](https://snyk.io/test/github/urthen/case-sensitive-paths-webpack-plugin?targetFile=package.json)
[![npm version](https://badge.fury.io/js/case-sensitive-paths-webpack-plugin.svg)](https://badge.fury.io/js/case-sensitive-paths-webpack-plugin)
[![npm downloads](https://img.shields.io/npm/dw/case-sensitive-paths-webpack-plugin.svg)](https://www.npmjs.com/package/case-sensitive-paths-webpack-plugin)
![bananas: ripe](https://img.shields.io/badge/bananas-ripe-yellow.svg)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FUrthen%2Fcase-sensitive-paths-webpack-plugin.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FUrthen%2Fcase-sensitive-paths-webpack-plugin?ref=badge_shield)
This Webpack plugin enforces the entire path of all required modules match the exact case of the actual path on disk.

@@ -57,1 +64,5 @@ Using this plugin helps alleviate cases where developers working on OSX, which does not follow strict path case sensitivity,

* [Cesare Soldini](https://github.com/caesarsol) who added a test
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FUrthen%2Fcase-sensitive-paths-webpack-plugin.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FUrthen%2Fcase-sensitive-paths-webpack-plugin?ref=badge_large)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc