Socket
Socket
Sign inDemoInstall

rewire

Package Overview
Dependencies
0
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

test/testModules/fake_node_modules/rewire/package.json

4

CHANGELOG.md
##Changelog
###v1.1.2
- Added deprecation warning for client-side bundlers
- Updated package.json for node v0.10
###v1.1.1

@@ -4,0 +8,0 @@ - Fixed bug with modules that had a comment on the last line

@@ -24,2 +24,4 @@ var setterSrc = require("../../__set__.js").toString(),

console.log("(DEPRECATED) rewire won't support browserify anymore. Please let me know if you're relying on this feature (https://github.com/jhnns/rewire/issues/13)");
/**

@@ -26,0 +28,0 @@ * Does actually the injecting of the special code. It is called by browserify for every

@@ -12,2 +12,4 @@ "use strict"; // run code in ES5 strict mode

function configureWebpack(options) {
console.log("(DEPRECATED) rewire itself doesn't support webpack anymore. Please use rewire-webpack (https://github.com/jhnns/rewire-webpack)");
options.resolve = options.resolve || {};

@@ -14,0 +16,0 @@ options.postLoaders = options.postLoaders || [];

6

package.json
{
"name" : "rewire",
"version" : "1.1.1",
"version" : "1.1.2",
"description" : "Dependency injection for node.js applications",

@@ -31,3 +31,3 @@ "keywords" : [

"engines" : {
"node" : "<0.10.x"
"node" : "<0.12.x"
},

@@ -37,4 +37,2 @@ "devDependencies": {

"expect.js": "0.x",
"browserify": "1.x",
"webpack": "0.8.x",
"coffee-script": "1.x"

@@ -41,0 +39,0 @@ },

@@ -15,2 +15,4 @@ rewire

If you want to use rewire also on the client-side take a look at [client-side bundlers](https://github.com/jhnns/rewire#client-side-bundlers)
[![Build Status](https://secure.travis-ci.org/jhnns/rewire.png?branch=master)](http://travis-ci.org/jhnns/rewire)

@@ -135,40 +137,8 @@ [![Dependency Status](http://david-dm.org/jhnns/rewire/status.png)](http://david-dm.org/jhnns/rewire)

rewire comes also with support for client-side bundlers. But since it relies heavily on node's require mechanism it can't be used on the client-side without adding special middleware to the bundling process. Currently supported bundlers are:
###webpack
See [rewire-webpack](https://github.com/jhnns/rewire-webpack)
- [browserify](https://github.com/substack/node-browserify) @1.x
- [webpack](https://github.com/webpack/webpack) @ 0.8.x
However, expect this feature to be extracted into own bundler-specific modules soon.
**Please note:** Unfortunately the line numbers in stack traces have an offset of +2 (browserify) / +1 (webpack).
This is caused by generated code that is added during the bundling process.
###browserify
rewire currently only supports browserify@1.x. I'm not planing to continue development, but if you're relying on this feature [please let me know](https://github.com/jhnns/rewire/issues/13).
```javascript
var b = browserify();
// Add rewire as browserify middleware
b.use(require("rewire").bundlers.browserify);
```
###webpack
rewire doesn't run with webpack@0.9.x because of various breaking api changes. I'm [working on that](https://github.com/jhnns/rewire/issues/10).
```javascript
var webpackOptions = {
output: "bundle.js"
};
// This function modifies the webpack options object.
// It adds a postLoader and postProcessor to the bundling process.
// @see https://github.com/webpack/webpack#programmatically-usage
require("rewire").bundlers.webpack(webpackOptions);
webpack("entry.js", webpackOptions, function () {});
```
<br />

@@ -178,2 +148,2 @@

MIT
MIT

@@ -5,3 +5,5 @@ // Don't run code in ES5 strict mode.

var expect = require("expect.js");
var expect = require("expect.js"),
fs = require("fs"),
path = require("path");

@@ -11,4 +13,9 @@ var rewire;

describe("rewire", function () {
before(require("./testHelpers/createFakePackageJSON.js"));
after(require("./testHelpers/removeFakePackageJSON.js"));
before(function () {
var fakeNodeModules = path.resolve(__dirname, "testModules/fake_node_modules");
if (fs.existsSync(fakeNodeModules)) {
fs.renameSync(fakeNodeModules, path.resolve(__dirname, "testModules/node_modules"));
}
});
it("should pass all shared test cases", function () {

@@ -20,3 +27,3 @@ require("./testModules/sharedTestCases.js");

rewire = require("rewire");
rewire = require("../");
coffeeModule = rewire("./testModules/module.coffee");

@@ -23,0 +30,0 @@ coffeeModule.__set__("fs", {

@@ -161,3 +161,3 @@ // Don't run code in ES5 strict mode.

});
it("should preserve the strict mode (not IE)", function () {
it("should preserve the strict mode", function () {
var strictModule = rewire("./strictModule.js");

@@ -169,2 +169,13 @@

});
it("should not modify line numbers in stack traces", function () {
var throwError = rewire("./throwError.js");
try {
throwError();
} catch (err) {
if (err.stack) {
expect(err.stack.split("\n")[1]).to.match(/:2:11/);
}
}
});
});

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc