From 811a21da623ffb2fa4729aba2c77b29777d0b6d3 Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Fri, 7 Nov 2014 15:22:25 +0100 Subject: [PATCH 1/5] expose module.parent as in node --- prelude.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prelude.js b/prelude.js index 3cbac8e..9ee5b7f 100644 --- a/prelude.js +++ b/prelude.js @@ -11,7 +11,7 @@ // Save the require from previous bundle to this closure if any var previousRequire = typeof require == "function" && require; - function newRequire(name, jumped){ + function newRequire(name, jumped, parent){ if(!cache[name]) { if(!modules[name]) { // if we cannot find the the module within our internal map or @@ -29,10 +29,10 @@ err.code = 'MODULE_NOT_FOUND'; throw err; } - var m = cache[name] = {exports:{}}; + var m = cache[name] = {exports:{}, parent: parent}; modules[name][0].call(m.exports, function(x){ var id = modules[name][1][x]; - return newRequire(id ? id : x); + return newRequire(id ? id : x, null, m); },m,m.exports,outer,modules,cache,entry); } return cache[name].exports; From aadeabea66feac48193d27d233daf1c85209357e Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Mon, 25 May 2015 00:02:43 -0400 Subject: [PATCH 2/5] 5.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5c553a..3ad6184 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "browser-pack", - "version": "5.0.0", + "version": "5.0.1", "description": "pack node-style source files from a json stream into a browser bundle", "main": "index.js", "bin": { From cad67fd1e0104a3e38ce30d1704d53a3b618bd18 Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Wed, 5 Aug 2015 17:31:02 +0200 Subject: [PATCH 3/5] these changes to work with node --- index.js | 10 +++++++--- package.json | 4 ++-- prelude.js | 3 ++- readme.markdown | 8 ++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 8d2af21..b4da1b8 100644 --- a/index.js +++ b/index.js @@ -64,12 +64,12 @@ module.exports = function (opts) { { line: lineno } ); } - + var wrappedSource = [ (first ? '' : ','), JSON.stringify(row.id), ':[', - 'function(require,module,exports){\n', + 'function(require,module,exports,__dirname,__filename){\n', combineSourceMap.removeComments(row.source), '\n},', '{' + Object.keys(row.deps || {}).sort().map(function (key) { @@ -77,7 +77,11 @@ module.exports = function (opts) { + JSON.stringify(row.deps[key]) ; }).join(',') + '}', - ']' + ',\n', + JSON.stringify(row.id), + ',\n', + JSON.stringify(path.dirname(row.id)), + '\n]' ].join(''); stream.push(Buffer(wrappedSource)); diff --git a/package.json b/package.json index 9b1878c..3447f30 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "browser-pack", + "name": "nodepack", "version": "3.2.0", - "description": "pack node-style source files from a json stream into a browser bundle", + "description": "pack browserify bundles for node", "main": "index.js", "bin": { "browser-pack": "bin/cmd.js" diff --git a/prelude.js b/prelude.js index 9ee5b7f..f248240 100644 --- a/prelude.js +++ b/prelude.js @@ -33,7 +33,8 @@ modules[name][0].call(m.exports, function(x){ var id = modules[name][1][x]; return newRequire(id ? id : x, null, m); - },m,m.exports,outer,modules,cache,entry); +// },m,m.exports,outer,modules,cache,entry); + },m,m.exports, modules[name][2], modules[name][3]); } return cache[name].exports; } diff --git a/readme.markdown b/readme.markdown index be793ae..d40096f 100644 --- a/readme.markdown +++ b/readme.markdown @@ -1,10 +1,6 @@ -# browser-pack +# nodepack -pack node-style source files from a json stream into a browser bundle - -[![browser support](http://ci.testling.com/substack/browser-pack.png)](http://ci.testling.com/substack/browser-pack) - -[![build status](https://secure.travis-ci.org/substack/browser-pack.png)](http://travis-ci.org/substack/browser-pack) +a fork of browser-pack that packs for node. used by noderify # example From cb6bf39a5f68db6e9014121fec308f66b14c58d2 Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Thu, 6 Aug 2015 22:40:49 +0200 Subject: [PATCH 4/5] skip source map tests, since this will only be run in node - we may want to re-add this later though! --- test/source-maps.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/source-maps.js b/test/source-maps.js index e4d4076..9d1af38 100644 --- a/test/source-maps.js +++ b/test/source-maps.js @@ -1,3 +1,5 @@ +return console.error('skip sourcemap tests') + var test = require('tape'); var pack = require('../'); var path = require('path'); From 7610fe320e67ca5cd02ec8c1c2daddbd3e58477f Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Fri, 7 Aug 2015 03:00:27 +0200 Subject: [PATCH 5/5] 6.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3447f30..c6944a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodepack", - "version": "3.2.0", + "version": "6.0.0" "description": "pack browserify bundles for node", "main": "index.js", "bin": {