From 3c87d52481dbef67562c72afe85aca7abd53433a Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 15 Jun 2020 11:03:35 -0400 Subject: [PATCH 1/3] link to browserify/static-module-bump-deps PR --- .gitignore | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b384677..068fc5a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ logs results npm-debug.log +package-lock.json node_modules/* diff --git a/package.json b/package.json index 135dd54..112a8e8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "dependencies": { "cwise-parser": "^1.0.0", "cwise-compiler": "^1.1.1", - "static-module": "^1.0.0", + "static-module": "git://github.com/browserify/static-module.git#3c18ee194fdb674ce590a65ace4e5e17c775733f", "uglify-js": "^2.6.0" }, "devDependencies": { From 335836e0533c10834d8b30882ddecf9cf97858cf Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 15 Jun 2020 11:05:12 -0400 Subject: [PATCH 2/3] revise fill test to work with new module bumps --- test/fill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fill.js b/test/fill.js index 10672b5..b1d90c8 100644 --- a/test/fill.js +++ b/test/fill.js @@ -10,7 +10,7 @@ test("fill", function(t) { var fill = cwise({ args: ["index", "array", "scalar"], body: function(idx, out, f) { - out = f.apply(undefined, idx) + out = f.apply(null, idx) } }) From 433f983cd7e5b423ce9028b0af720a6054247117 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 15 Jun 2020 12:19:08 -0400 Subject: [PATCH 3/3] pass options to static-module --- lib/cwise-transform.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cwise-transform.js b/lib/cwise-transform.js index 93cf7bb..6c1612b 100644 --- a/lib/cwise-transform.js +++ b/lib/cwise-transform.js @@ -17,6 +17,11 @@ function processFunc(func) { } function cwiseTransform(file, opts) { + if(!opts) opts = {} + if(opts.allowAccessToMethodsOnFunctions !== false) { + opts.allowAccessToMethodsOnFunctions = true + } + var sm = staticModule({ cwise: function(user_args) { for(var id in user_args) { @@ -42,6 +47,6 @@ function cwiseTransform(file, opts) { var codeStr = "require('cwise/lib/wrapper')(" + JSON.stringify(compileBlock) + ")" return codeStr } - }) + }, opts) return sm }