Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "package", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "package", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -20,11 +20,20 @@ /* | ||
var specialPaths = { | ||
'package/util': module.id.replace(/[^\/]+$/, '') + 'util' | ||
}; | ||
var pluginPath = module.id.replace(/[^\/]+$/, ''); | ||
// Expose util as a special named dependency for reuse | ||
define('package/util', util); | ||
return { | ||
load: function (name, req, onLoad, requirejsConfig) { | ||
var isolatedContextName = 'package-' + Math.random(); | ||
// Path is normalized relative to this plugin file, prefix with path too | ||
if (/^\.\.?\//.test(name)) { | ||
name = pluginPath + name; | ||
} | ||
require({ | ||
'baseUrl': requirejsConfig.baseUrl, | ||
//'context': 'other' | ||
// Use an isolated context to load package manifest file, plugin path prefix needs path mappings | ||
'paths': requirejsConfig.paths, | ||
'context': isolatedContextName | ||
}, [name], function (packageConfig) { | ||
@@ -35,3 +44,3 @@ var baseID, | ||
// Process relative path mappings relative to package file | ||
baseID = (name || '').replace(/(^|\/)[^\/]*$/, '$1') || ''; | ||
baseID = (req.toUrl(name) || '').replace(/(^|\/)[^\/]*$/, '$1') || ''; | ||
@@ -44,8 +53,6 @@ util.each(paths, function (path, index, paths) { | ||
util.extend(paths, specialPaths); | ||
require({ | ||
'baseUrl': requirejsConfig.baseUrl, | ||
// Use another isolated context to set the path mappings configured in package manifest | ||
'paths': paths, | ||
'context': 'other' | ||
'context': isolatedContextName | ||
}, [ | ||
@@ -52,0 +59,0 @@ packageConfig.main |
{ | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"name": "amdpackage", | ||
@@ -4,0 +4,0 @@ "publishConfig": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7802
137