diff options
author | Oisin Canty <o.canty@f5.com> | 2021-05-24 09:01:42 +0000 |
---|---|---|
committer | Oisin Canty <o.canty@f5.com> | 2021-05-24 09:01:42 +0000 |
commit | c160ea11e4ece4db52731ac8b83dd09ca2d1ef11 (patch) | |
tree | ebfd605f6e93a05b65bae5c327b47a1a764a8d63 | |
parent | d6439002371d0bc73183c9d3d28df4f62ce0b972 (diff) | |
download | unit-c160ea11e4ece4db52731ac8b83dd09ca2d1ef11.tar.gz unit-c160ea11e4ece4db52731ac8b83dd09ca2d1ef11.tar.bz2 |
Node.js: renamed "require_shim" to "loader".
-rw-r--r-- | docs/changes.xml | 2 | ||||
-rw-r--r-- | src/nodejs/unit-http/loader.js (renamed from src/nodejs/unit-http/require_shim.js) | 4 | ||||
-rw-r--r-- | src/nodejs/unit-http/loader.mjs (renamed from src/nodejs/unit-http/require_shim.mjs) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_http/app.mjs (renamed from test/node/require_shim/es_modules_http/app.mjs) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_http_indirect/app.js (renamed from test/node/require_shim/es_modules_http_indirect/app.js) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_http_indirect/module.mjs (renamed from test/node/require_shim/es_modules_http_indirect/module.mjs) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_websocket/app.mjs (renamed from test/node/require_shim/es_modules_websocket/app.mjs) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_websocket_indirect/app.js (renamed from test/node/require_shim/es_modules_websocket_indirect/app.js) | 0 | ||||
-rw-r--r-- | test/node/loader/es_modules_websocket_indirect/module.mjs (renamed from test/node/require_shim/es_modules_websocket_indirect/module.mjs) | 0 | ||||
-rw-r--r-- | test/node/loader/transitive_dependency/app.js (renamed from test/node/require_shim/transitive_dependency/app.js) | 0 | ||||
-rw-r--r-- | test/node/loader/transitive_dependency/transitive_http.js (renamed from test/node/require_shim/transitive_dependency/transitive_http.js) | 0 | ||||
-rw-r--r-- | test/node/loader/unit_http/app.js (renamed from test/node/require_shim/unit_http/app.js) | 0 | ||||
-rw-r--r-- | test/test_node_application.py | 8 | ||||
-rw-r--r-- | test/test_node_es_modules.py | 12 | ||||
-rw-r--r-- | test/unit/applications/lang/node.py | 6 |
15 files changed, 16 insertions, 16 deletions
diff --git a/docs/changes.xml b/docs/changes.xml index 528ab483..58181173 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -39,7 +39,7 @@ multiple "targets" in Python applications. <change type="feature"> <para> -a shim for automatic overriding "http" and "websocket" modules in Node.js. +a loader for automatic overriding "http" and "websocket" modules in Node.js. </para> </change> diff --git a/src/nodejs/unit-http/require_shim.js b/src/nodejs/unit-http/loader.js index 2b307629..e5aa3558 100644 --- a/src/nodejs/unit-http/require_shim.js +++ b/src/nodejs/unit-http/loader.js @@ -2,7 +2,7 @@ if (module.parent && module.parent.id === "internal/preload") { const { Module } = require("module") - if (!Module.prototype.require.__unit_shim) { + if (!Module.prototype.require.__unit_loader) { const http = require("./http") const websocket = require("./websocket") @@ -22,6 +22,6 @@ if (module.parent && module.parent.id === "internal/preload") { return original.apply(this, arguments); } - Module.prototype.require.__unit_shim = true; + Module.prototype.require.__unit_loader = true; } } diff --git a/src/nodejs/unit-http/require_shim.mjs b/src/nodejs/unit-http/loader.mjs index 067d63d4..067d63d4 100644 --- a/src/nodejs/unit-http/require_shim.mjs +++ b/src/nodejs/unit-http/loader.mjs diff --git a/test/node/require_shim/es_modules_http/app.mjs b/test/node/loader/es_modules_http/app.mjs index c7bcfe49..c7bcfe49 100644 --- a/test/node/require_shim/es_modules_http/app.mjs +++ b/test/node/loader/es_modules_http/app.mjs diff --git a/test/node/require_shim/es_modules_http_indirect/app.js b/test/node/loader/es_modules_http_indirect/app.js index 535befba..535befba 100644 --- a/test/node/require_shim/es_modules_http_indirect/app.js +++ b/test/node/loader/es_modules_http_indirect/app.js diff --git a/test/node/require_shim/es_modules_http_indirect/module.mjs b/test/node/loader/es_modules_http_indirect/module.mjs index c7bcfe49..c7bcfe49 100644 --- a/test/node/require_shim/es_modules_http_indirect/module.mjs +++ b/test/node/loader/es_modules_http_indirect/module.mjs diff --git a/test/node/require_shim/es_modules_websocket/app.mjs b/test/node/loader/es_modules_websocket/app.mjs index a71ffa9d..a71ffa9d 100644 --- a/test/node/require_shim/es_modules_websocket/app.mjs +++ b/test/node/loader/es_modules_websocket/app.mjs diff --git a/test/node/require_shim/es_modules_websocket_indirect/app.js b/test/node/loader/es_modules_websocket_indirect/app.js index 535befba..535befba 100644 --- a/test/node/require_shim/es_modules_websocket_indirect/app.js +++ b/test/node/loader/es_modules_websocket_indirect/app.js diff --git a/test/node/require_shim/es_modules_websocket_indirect/module.mjs b/test/node/loader/es_modules_websocket_indirect/module.mjs index a71ffa9d..a71ffa9d 100644 --- a/test/node/require_shim/es_modules_websocket_indirect/module.mjs +++ b/test/node/loader/es_modules_websocket_indirect/module.mjs diff --git a/test/node/require_shim/transitive_dependency/app.js b/test/node/loader/transitive_dependency/app.js index aaca5216..aaca5216 100644 --- a/test/node/require_shim/transitive_dependency/app.js +++ b/test/node/loader/transitive_dependency/app.js diff --git a/test/node/require_shim/transitive_dependency/transitive_http.js b/test/node/loader/transitive_dependency/transitive_http.js index f1eb98e5..f1eb98e5 100644 --- a/test/node/require_shim/transitive_dependency/transitive_http.js +++ b/test/node/loader/transitive_dependency/transitive_http.js diff --git a/test/node/require_shim/unit_http/app.js b/test/node/loader/unit_http/app.js index 9172e44f..9172e44f 100644 --- a/test/node/require_shim/unit_http/app.js +++ b/test/node/loader/unit_http/app.js diff --git a/test/test_node_application.py b/test/test_node_application.py index 59601ff0..48ed8d3d 100644 --- a/test/test_node_application.py +++ b/test/test_node_application.py @@ -19,13 +19,13 @@ class TestNodeApplication(TestApplicationNode): self.assert_basic_application() - def test_node_application_require_shim_unit_http(self): - self.load('require_shim/unit_http') + def test_node_application_loader_unit_http(self): + self.load('loader/unit_http') self.assert_basic_application() - def test_node_application_require_shim_transitive_dependency(self): - self.load('require_shim/transitive_dependency') + def test_node_application_loader_transitive_dependency(self): + self.load('loader/transitive_dependency') self.assert_basic_application() diff --git a/test/test_node_es_modules.py b/test/test_node_es_modules.py index ce27e474..0945a967 100644 --- a/test/test_node_es_modules.py +++ b/test/test_node_es_modules.py @@ -20,18 +20,18 @@ class TestNodeESModules(TestApplicationNode): assert resp['headers']['Content-Type'] == 'text/plain', 'basic header' assert resp['body'] == 'Hello World\n', 'basic body' - def test_node_es_modules_require_shim_http(self): - self.load('require_shim/es_modules_http', name="app.mjs") + def test_node_es_modules_loader_http(self): + self.load('loader/es_modules_http', name="app.mjs") self.assert_basic_application() - def test_node_es_modules_require_shim_http_indirect(self): - self.load('require_shim/es_modules_http_indirect', name="app.js") + def test_node_es_modules_loader_http_indirect(self): + self.load('loader/es_modules_http_indirect', name="app.js") self.assert_basic_application() - def test_node_es_modules_require_shim_websockets(self): - self.load('require_shim/es_modules_websocket', name="app.mjs") + def test_node_es_modules_loader_websockets(self): + self.load('loader/es_modules_websocket', name="app.mjs") message = 'blah' diff --git a/test/unit/applications/lang/node.py b/test/unit/applications/lang/node.py index 3254f3d4..5d05c70c 100644 --- a/test/unit/applications/lang/node.py +++ b/test/unit/applications/lang/node.py @@ -31,14 +31,14 @@ class TestApplicationNode(TestApplicationProto): arguments = [ "node", "--loader", - "unit-http/require_shim.mjs", + "unit-http/loader.mjs", "--require", - "unit-http/require_shim", + "unit-http/loader", name, ] else: - arguments = ["node", "--require", "unit-http/require_shim", name] + arguments = ["node", "--require", "unit-http/loader", name] self._load_conf( { |