wallaby-webpack
Advanced tools
Comparing version 0.0.9 to 0.0.10
26
index.js
@@ -137,4 +137,5 @@ 'use strict'; | ||
var trackedFile = m.resource && affectedFiles[m.resource]; | ||
var isEntryFile = trackedFile && self._entryPatterns && self._entryFiles[trackedFile.fullPath]; | ||
var source = self._getSource(m); | ||
var isEntryFile = trackedFile && self._entryFiles[trackedFile.fullPath]; | ||
var isTestFile = trackedFile && trackedFile.test; | ||
var source = self._getSource(m, trackedFile); | ||
var code = source.code; | ||
@@ -149,3 +150,3 @@ var sourceMap = trackedFile && source.map(); | ||
// var a = require('./a'); var b = require('imports?window=mocked!./a'); | ||
? (trackedFile.path + (m.id ? ('.' + m.id) : '') + '.wbp.js') | ||
? (trackedFile.path + ((_.isNumber(m.id) && !isTestFile) ? ('.' + m.id) : '') + '.wbp.js') | ||
: path.join('__modules', m.id + '.js'), | ||
@@ -155,3 +156,3 @@ original: trackedFile, | ||
sourceMap: sourceMap, | ||
order: isEntryFile ? trackedFile.order : undefined | ||
order: (isEntryFile && self._entryPatterns) ? trackedFile.order : undefined | ||
})); | ||
@@ -164,7 +165,6 @@ | ||
// entry modules (tests) have id = 0, | ||
// caching them by file path so that we can load them from __moduleBundler.loadTests | ||
var moduleId = m.id || m.resource; | ||
// caching test entry modules by file path so that we can load them from __moduleBundler.loadTests | ||
var moduleId = WebpackPostprocessor._getModuleId(m, trackedFile); | ||
if (!self._moduleIds[moduleId]) { | ||
self._moduleIds[moduleId] = m.id || true; | ||
self._moduleIds[moduleId] = m.id; | ||
// modules unknown so far force test loader script reload | ||
@@ -265,3 +265,3 @@ self._loaderEmitRequired = true; | ||
_getSource(m) { | ||
_getSource(m, file) { | ||
var self = this; | ||
@@ -274,3 +274,3 @@ // to avoid wrapping module into a function, we do it a bit differently in _wrapSourceFile | ||
return { | ||
code: WebpackPostprocessor._wrapSourceFile(m.id || m.resource, node.source()), | ||
code: WebpackPostprocessor._wrapSourceFile(WebpackPostprocessor._getModuleId(m, file), node.source()), | ||
map: () => node.map() | ||
@@ -280,2 +280,8 @@ }; | ||
static _getModuleId(m, file) { | ||
var testFile = file && file.test; | ||
if (testFile || !_.isNumber(m.id)) return m.resource; | ||
return m.id; | ||
} | ||
static _wrapSourceFile(id, content) { | ||
@@ -282,0 +288,0 @@ return 'window.__moduleBundler.cache[' + JSON.stringify(id) + '] = [function(__webpack_require__, module, exports) {' |
{ | ||
"name": "wallaby-webpack", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Webpack postprocessor for wallaby.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14745
290