From 37d207cc0c1b1016cf548025a4026c46edc3ba76 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 5 Feb 2019 20:46:35 -0800 Subject: [PATCH] assert: refactor internal assert.js Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: https://github.com/nodejs/node/pull/25956 Reviewed-By: Ruben Bridgewater Reviewed-By: Minwoo Jung --- lib/assert.js | 2 +- lib/internal/{assert.js => assert/assertion_error.js} | 4 +--- node.gyp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename lib/internal/{assert.js => assert/assertion_error.js} (99%) diff --git a/lib/assert.js b/lib/assert.js index 6963ef41307397..a37329caf2d736 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -27,7 +27,7 @@ const { codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE } } = require('internal/errors'); -const { AssertionError } = require('internal/assert'); +const AssertionError = require('internal/assert/assertion_error'); const { openSync, closeSync, readSync } = require('fs'); const { inspect, types: { isPromise, isRegExp } } = require('util'); const { EOL } = require('internal/constants'); diff --git a/lib/internal/assert.js b/lib/internal/assert/assertion_error.js similarity index 99% rename from lib/internal/assert.js rename to lib/internal/assert/assertion_error.js index 4e059db6b9d478..a13a610da1a7ba 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert/assertion_error.js @@ -405,6 +405,4 @@ class AssertionError extends Error { } } -module.exports = { - AssertionError -}; +module.exports = AssertionError; diff --git a/node.gyp b/node.gyp index 74b130a23e2b37..1490f7910ec290 100644 --- a/node.gyp +++ b/node.gyp @@ -84,7 +84,7 @@ 'lib/vm.js', 'lib/worker_threads.js', 'lib/zlib.js', - 'lib/internal/assert.js', + 'lib/internal/assert/assertion_error.js', 'lib/internal/async_hooks.js', 'lib/internal/bash_completion.js', 'lib/internal/buffer.js',