New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

collect-require

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collect-require - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

README.md

4

package.json
{
"name": "collect-require",
"version": "1.2.0",
"version": "1.3.0",
"description": "collect require-js based codebase into a singel js file ",
"main": "src/collect-require.js",
"scripts": {
"test": "test"
"test": "mocha test/e2e/module-test.js"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -6,2 +6,3 @@ require("./require-template");

apiNamePlaceHolder = "SCRIPT_COLLECTOR_API_NAME",
globalHookPlaceHolder = "GLOBAL_HOOK",
scriptMappingsPlaceholder = "/*!<SCRIPT-MAPPINGS>!*/";

@@ -20,8 +21,14 @@

save: function(options){
return fs.writeFileSync(
options.path,
wrapperScript.replace(scriptMappingsPlaceholder, scriptMapping)
.replace("/*!<SCRIPT-MAIN>!*/" , options.main.replace(".js", ""))
.replace(apiNamePlaceHolder , options.apiName)
);
var script = wrapperScript.replace(scriptMappingsPlaceholder, scriptMapping)
.replace("/*!<SCRIPT-MAIN>!*/", options.main.replace(".js", ""))
.replace(apiNamePlaceHolder, options.apiName);
if(options.buildNashorn){
fs.writeFileSync(options.buildNashorn, script.replace(globalHookPlaceHolder, "GLOBAL"));
}
if(options.buildBrowser){
fs.writeFileSync(options.buildBrowser, script.replace(globalHookPlaceHolder, "window"));
}
}

@@ -28,0 +35,0 @@ };

@@ -22,3 +22,3 @@ var

};
var global = GLOBAL || Window
global.SCRIPT_COLLECTOR_API_NAME = standalone[main]();
GLOBAL_HOOK.SCRIPT_COLLECTOR_API_NAME = standalone[main]();

@@ -26,4 +26,17 @@ var expect = require('chai').expect,

standalone.save({
path : path,
main : "three/three.five/script-three.five" ,
buildNashorn : path,
main : "three/three.five/script-three.five" ,
apiName : "Jeyson",
});
helper.evalScript(path);
});
it('should create standalone Nashorn script', function () {
var path = helper.aWritableFilePath(),
standalone = collector.collect(helper.codebasePath);
standalone.save({
buildNashorn : path,
main : "index.js" ,
apiName : "Jeyson",

@@ -33,5 +46,7 @@ });

helper.evalScript(path);
expect(Jeyson.get()).to.equal("from script three");
});
it('should create standalone script file', function () {
it('should create standalone Browser script', function () {
var path = helper.aWritableFilePath(),

@@ -41,3 +56,3 @@ standalone = collector.collect(helper.codebasePath);

standalone.save({
path : path,
buildBrowser : path,
main : "index.js" ,

@@ -47,2 +62,4 @@ apiName : "Jeyson",

GLOBAL.window = GLOBAL;
helper.evalScript(path);

@@ -59,3 +76,3 @@

standalone.save({
path : path,
buildNashorn : path,
main : "two/script-two.js",

@@ -62,0 +79,0 @@ apiName : "ScriptTwo",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc