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

webpack-isomorphic-tools

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-isomorphic-tools - npm Package Compare versions

Comparing version 0.8.8 to 0.9.0

12

babel-transpiled-modules/common.js

@@ -57,7 +57,15 @@ 'use strict';

if (description.extension) {
// sanity check
if (Array.isArray(description.extension)) {
throw new Error('Use "extensions" key instead of "extension" for specifying an array of file extensions for assets of type "' + asset_type + '"');
}
// normalize
description.extensions = [description.extension];
}
// // set asset type name (if required), for readability
// description.name = description.name || description.extensions.join(', ')
// sanity check
if (!description.extensions) {
throw new Error('You must specify file extensions for assets of type "' + asset_type + '"');
}
}

@@ -64,0 +72,0 @@ } catch (err) {

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

// (should work, not tested)
this.options.exceptions = this.options.exceptions || [];
this.options.exclude = this.options.exclude || [];

@@ -324,3 +324,3 @@ // used to keep track of cached assets and flush their caches on .refresh() call

// then fallback to the normal require() behaviour
if (_this2.options.exceptions.indexOf(asset_path) >= 0) {
if (_this2.excludes(asset_path)) {
_this2.log.debug('skipping require call for ' + asset_path);

@@ -341,2 +341,47 @@ return fallback();

}, {
key: 'excludes',
// Checks if the required path should be excluded from the custom require() hook
value: function excludes(path) {
// for each exclusion case
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = _getIterator(this.options.exclude), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var exclude = _step4.value;
// supports regular expressions
if (exclude instanceof RegExp) {
if (exclude.test(path)) {
return true;
}
}
// otherwise check for a simple textual match
else {
if (exclude == path) {
return true;
}
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4['return']) {
_iterator4['return']();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
// so that it isn't undefined (for testing purpose)
return false;
}
}, {
key: 'ready',

@@ -343,0 +388,0 @@

2

babel-transpiled-modules/tools/node-hook.js

@@ -67,3 +67,3 @@ // read this article for more info on what's going on here

var result = transform(filename, function fallback() {
originalLoaders[extension](module, filename);
(originalLoaders[extension] || Module._extensions['.js'])(module, filename);
});

@@ -70,0 +70,0 @@

@@ -0,1 +1,7 @@

0.9.0 / 26.09.2015
===================
* "exceptions" is now called "exclude"
* "exclude" supports regular expressions
0.8.0 / 16.08.2015

@@ -2,0 +8,0 @@ ===================

{
"name": "webpack-isomorphic-tools",
"version": "0.8.8",
"version": "0.9.0",
"description": "Transforms CSS-alike text into a React style JSON object",

@@ -5,0 +5,0 @@ "main": "babel-transpiled-modules/index.js",

@@ -352,3 +352,4 @@ # webpack-isomorphic-tools

// (relative to the project base folder, e.g. ./sources/server/kitten.jpg.js)
exceptions: [],
// (also supports regular expressions, e.g. /^\.\/node_modules\/*/)
exclude: [],

@@ -355,0 +356,0 @@ // here you can define all your asset types

@@ -37,8 +37,18 @@ import path from 'path'

{
// sanity check
if (Array.isArray(description.extension))
{
throw new Error(`Use "extensions" key instead of "extension" for specifying an array of file extensions for assets of type "${asset_type}"`)
}
// normalize
description.extensions = [description.extension]
}
// // set asset type name (if required), for readability
// description.name = description.name || description.extensions.join(', ')
// sanity check
if (!description.extensions)
{
throw new Error(`You must specify file extensions for assets of type "${asset_type}"`)
}
}
}

@@ -23,3 +23,3 @@ import path from 'path'

// (should work, not tested)
this.options.exceptions = this.options.exceptions || []
this.options.exclude = this.options.exclude || []

@@ -236,3 +236,3 @@ // used to keep track of cached assets and flush their caches on .refresh() call

// then fallback to the normal require() behaviour
if (this.options.exceptions.indexOf(asset_path) >= 0)
if (this.excludes(asset_path))
{

@@ -255,2 +255,30 @@ this.log.debug(`skipping require call for ${asset_path}`)

// Checks if the required path should be excluded from the custom require() hook
excludes(path)
{
// for each exclusion case
for (let exclude of this.options.exclude)
{
// supports regular expressions
if (exclude instanceof RegExp)
{
if (exclude.test(path))
{
return true
}
}
// otherwise check for a simple textual match
else
{
if (exclude == path)
{
return true
}
}
}
// so that it isn't undefined (for testing purpose)
return false
}
// Waits for webpack-assets.json to be created after Webpack build process finishes

@@ -257,0 +285,0 @@ //

@@ -77,3 +77,3 @@ // read this article for more info on what's going on here

{
originalLoaders[extension](module, filename)
(originalLoaders[extension] || Module._extensions['.js'])(module, filename)
})

@@ -80,0 +80,0 @@

@@ -27,4 +27,6 @@ import path from 'path'

const plugin = new isomorpher_plugin
({
const isomorpher_settings =
{
exclude: ['kitten.jpg', /^\.\/node_modules\/*/],
assets:

@@ -55,8 +57,9 @@ {

}
})
}
// regular_expressions.javascript.toString().should.equal('/\\.js$/')
// regular_expressions.styles.toString().should.equal('/\\.scss$/')
// regular_expressions.images_and_fonts.toString().should.equal('/\\.(png|jpg|ico|woff|woff2|eot|ttf|svg)$/')
const plugin = new isomorpher_plugin(isomorpher_settings)
const server_side = new isomorpher(isomorpher_settings)
// check resulting regular expressions
const regular_expressions =

@@ -73,3 +76,9 @@ {

}
// check require() hooks exclusion
server_side.excludes('kitten.jpg.backup').should.be.false
server_side.excludes('kitten.jpg').should.be.true
server_side.excludes('./node_modules/fonts/style.css').should.be.true
server_side.excludes('source/node_modules/fonts/style.css').should.be.false
})
})

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