fis3-hook-node_modules
Advanced tools
Comparing version 2.2.6 to 2.2.7
@@ -119,2 +119,6 @@ var path = require('path'); | ||
var prefix = RegExp.$1; | ||
if (prefix[0] === '@') { | ||
prefix = id.split('/').slice(0, 2).join('/'); | ||
} | ||
var key = file.subpath + id; | ||
@@ -190,3 +194,6 @@ if (!notified[key]) { | ||
ignoreDevDependencies: false, | ||
shimBuffer: true | ||
shimBuffer: true, | ||
shimProcess: true, | ||
shimGlobal: true, | ||
shutup: false | ||
}; |
@@ -5,13 +5,3 @@ var rComment = /"(?:[^\\"\r\n\f]|\\[\s\S])*"|'(?:[^\\'\n\r\f]|\\[\s\S])*'|(\/\/[^\r\n\f]+|\/\*[\s\S]+?(?:\*\/|$))/; | ||
var vars = { | ||
process : function () { | ||
return 'var process = require(\'process/browser\');'; | ||
}, | ||
global : function () { | ||
return 'var global = typeof global !== "undefined" ? global : ' | ||
+ 'typeof self !== "undefined" ? self : ' | ||
+ 'typeof window !== "undefined" ? window : {};' | ||
; | ||
} | ||
}; | ||
var vars = {}; | ||
@@ -75,2 +65,17 @@ var replaceVars = { | ||
if (opts.shimProcess) { | ||
vars['process'] = function () { | ||
return 'var process = require(\'process/browser\');'; | ||
}; | ||
} | ||
if (opts.shimGlobal) { | ||
vars['global'] = function () { | ||
return 'var global = typeof global !== "undefined" ? global : ' | ||
+ 'typeof self !== "undefined" ? self : ' | ||
+ 'typeof window !== "undefined" ? window : {};' | ||
; | ||
} | ||
} | ||
if (opts.shimBuffer) { | ||
@@ -77,0 +82,0 @@ |
{ | ||
"name": "fis3-hook-node_modules", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "fis3 npm support", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -144,4 +144,7 @@ # fis3-hook-node_modules | ||
* `ignoreDevDependencies` 默认为 `false` 标记是否忽略 devDependencies。 | ||
* `shimProcess` 默认为 `true` 自动检测 js 内容,存在 process 的调用,自动添加 `var process = require('process/browser')` 的 shim 模块。(有些插件并不适用) | ||
* `shimGlobal` 默认为 `true` 自动检测 js 内容,存在 global 的调用,自动添加 global 的 shim 代码。(有些插件并不适用) | ||
* `shimBuffer` 默认为 `true` 自动检测 js 内容,存在 buffer 的调用,自动添加 buffer 的 shim 模块。(有些插件并不适用) | ||
* `env` 默认在代码压缩的情况下为 `production` 否则为 `development`。 支持配置或者回调函数。 | ||
* `env` 默认在代码压缩的情况下为 `production` 否则为 `development`。 支持配置或者回调函数。 | ||
* `shutup` 默认为 `false` 可以设置不提示模块没找到。 | ||
@@ -157,3 +160,3 @@ [npm-url]: https://www.npmjs.com/package/fis3-hook-node_modules | ||
* `skipBrowserify` 默认模块化的 js 都会进行 browserify 处理,如果文件的这个属性设置成了 true, 则会跳过。 如: | ||
```js | ||
@@ -164,3 +167,3 @@ fis.match('/modules/**.js', { | ||
``` | ||
一般自己写的代码都不需要这个处理。 |
21450
427
167