smart-preprocessor
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -192,18 +192,19 @@ /* | ||
{ | ||
var resolvedPath , outputPath , filename ; | ||
var resolvedPath , outputPath , outputFilename , sppId , preprocessedModule ; | ||
if ( ! options || typeof options !== 'object' ) { options = {} ; } | ||
resolvedPath = require.resolve( id ) ; | ||
sppId = resolvedPath = require.resolve( id ) ; | ||
if ( options.multi ) | ||
if ( options.multi ) { sppId += JSON.stringify( parameters ) ; } | ||
if ( smartPreprocessor.require.cache[ sppId ] ) | ||
{ | ||
filename = hash.fingerprint( resolvedPath + JSON.stringify( parameters ) ) ; | ||
//console.log( 'Cache hit!' ) ; | ||
return smartPreprocessor.require.cache[ sppId ] ; | ||
} | ||
else | ||
{ | ||
filename = hash.fingerprint( resolvedPath ) ; | ||
} | ||
outputPath = osTmpDir + '/' + filename + '.js' ; | ||
outputFilename = hash.fingerprint( sppId ) ; | ||
outputPath = osTmpDir + '/' + outputFilename + '.js' ; | ||
//console.log( "outputPath: " , outputPath ) ; | ||
@@ -213,3 +214,8 @@ | ||
return require( outputPath ) ; | ||
preprocessedModule = require( outputPath ) ; | ||
// Put the preprocecessed module in the cache | ||
smartPreprocessor.require.cache[ sppId ] = preprocessedModule ; | ||
return preprocessedModule ; | ||
} ; | ||
@@ -219,2 +225,7 @@ | ||
// The module cache, so same files are not preprocessed again and again | ||
smartPreprocessor.require.cache = {} ; | ||
// Build synchronously: preprocess a file and write the build. | ||
@@ -221,0 +232,0 @@ smartPreprocessor.buildSync = function buildSync( inputPath , outputPath , parameters ) |
{ | ||
"name": "smart-preprocessor", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "A smart preprocessor for Node.", | ||
@@ -5,0 +5,0 @@ "main": "lib/smartPreprocessor.js", |
@@ -538,2 +538,3 @@ /* | ||
it( "Test the cache of .require()" ) ; | ||
} ) ; | ||
@@ -543,1 +544,3 @@ | ||
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
52981
638