Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
97f3072
stream: add signal support to pipeline generators
ronag Jun 17, 2021
22a78a7
build: preserves symbols during LTO with macOS linker
jesec Aug 21, 2021
fb226ff
crypto: add rsa-pss keygen parameters
panva Aug 29, 2021
381293f
meta: update AUTHORS
nodejs-github-bot Aug 31, 2021
bef78a2
src: register external references of dtrace for snapshot
joyeecheung Aug 31, 2021
6fdf025
src: register external references of node-report for snapshot
joyeecheung Aug 31, 2021
a2c1c3e
src: register external references of BaseObject for snapshot
joyeecheung Aug 31, 2021
b4e074c
src: register missing stream wrap external references
joyeecheung Aug 31, 2021
db75711
src: register missing process methods external references
joyeecheung Aug 31, 2021
6095fb0
src: register external references of SignalWrap for snapshot
joyeecheung Aug 31, 2021
00cca48
src: register external references of TCPWrap for snapshot
joyeecheung Aug 31, 2021
7a17cbf
src: register external references of TTYWrap for snapshot
joyeecheung Aug 31, 2021
826eee3
src: register external references of PipeWrap for snapshot
joyeecheung Aug 31, 2021
b6dd2ea
doc: fix missing history version in `fs.md`
aduh95 Sep 1, 2021
29104f5
meta: consolidate AUTHORS entries for mithunsasidharan
Trott Sep 5, 2021
640353a
lib,repl: ignore non-canBeRequiredByUsers built-in
XadillaX Aug 30, 2021
73aa4e3
src: fix C4805 MSVC warning
targos Sep 5, 2021
67bbfeb
test: make tests pass on Windows with Unix EOL
targos Sep 5, 2021
0b30867
build: run AUTHORS update weekly
Trott Sep 5, 2021
99af212
tools,build: update YAML files in preparation for linting
Trott Sep 5, 2021
5a20f90
build: add YAML linting
Trott Sep 5, 2021
7bddaec
build: add YAML linting to GitHub Actions
Trott Sep 5, 2021
105c9e6
crypto: check webcrypto asymmetric key types during importKey
panva Aug 31, 2021
846e7e8
doc: fix list indentation in corepack.md
alexeyten Sep 7, 2021
fe920b6
src: make napi_create_reference accept symbol
JckXia Aug 29, 2021
98f56d1
deps: update Acorn to v8.5.0
targos Sep 6, 2021
842f936
src: use Isolate::TryGetCurrent where appropriate
addaleax Aug 31, 2021
570bef1
Revert "src: skip test_fatal/test_threads for Debug builds"
addaleax Aug 31, 2021
d426ee9
doc: fix property name 'detail' of performanceEntry
ChristianBoehlke Sep 6, 2021
edcfffe
lib: use standard property names
null8626 Sep 3, 2021
d6124d8
repl: fix top level await with surrogate characters
Mesteery Aug 29, 2021
f03bae7
tools: update remark-html to v13.0.2
targos Sep 8, 2021
6775958
deps: patch for v8 on windows
gengjiawen Sep 6, 2021
a71579b
meta: add more mailmap entries for bajtos
Trott Sep 7, 2021
fc45cbe
crypto: fix default MGF1 hash for OpenSSL 3
tniessen Sep 7, 2021
d657ae6
crypto: fix RSA-PSS default saltLength
tniessen Sep 5, 2021
9f3a015
src: add option to disable loading native addons
d3lm Sep 2, 2021
6d399e1
doc: fix CCM cipher example in MJS
tniessen Aug 30, 2021
cfcd571
src: fix -Wunreachable-code-return error
codebytere Sep 8, 2021
9655329
doc: add Ayase-252 to collaborators
Ayase-252 Sep 11, 2021
2a41530
meta: consolidate AUTHORS entry for mikemaccana
Trott Sep 9, 2021
5b5e272
test: fix internet/test-dns
Trott Sep 11, 2021
5983568
worker: avoid potential deadlock on NearHeapLimit
santigimeno Apr 25, 2021
b3843bf
deps: patch v8 for vs2019 in std17
gengjiawen Sep 10, 2021
d55804c
tools: update all dependencies of markdown linter
targos Sep 8, 2021
4367a61
test: mark test-crypto-timing-safe-equal-benchmarks flaky
richardlau Sep 10, 2021
92f182b
module: fix $ pattern replacements
guybedford Sep 8, 2021
4aa2610
test: update OpenSSL3 error messages for 3.0.0+quic
danbev Sep 13, 2021
c804d07
build: add daily/on-demand internet test workflow
Trott Sep 12, 2021
7ee3fbd
meta: update AUTHORS
nodejs-github-bot Sep 12, 2021
01b1946
build: only lint version numbers for pull requests
targos Sep 7, 2021
7376edc
module: deprecate trailing slash pattern mappings
guybedford Sep 8, 2021
ec6de11
tools: update ansi-regex in lint-md rollup
Trott Sep 14, 2021
1eca9bc
module: support pattern trailers for imports field
guybedford Sep 8, 2021
f666f5a
events: fix duplicate require which cause performance penalty
wwwzbwcom Sep 15, 2021
8aad81d
doc: add full list of subsystems
iam-frankqiu Sep 3, 2021
0df47d5
deps: upgrade npm to 7.23.0
npm-robot Sep 9, 2021
81cb14b
doc: clarify that ObjectWrap requires manual cleanup on shutdown
Flarna Sep 10, 2021
31994fb
src: register zlib external references for snapshot
joyeecheung Sep 6, 2021
bc9c2ca
http: remove CRLF variable
shfshanyue Sep 14, 2021
588257c
meta: add .mailmap entry for arcanis
Trott Sep 14, 2021
9c76c69
deps: patch V8 to 9.3.345.19
targos Sep 14, 2021
886921d
build: add paths-ignore for build-tarball workflow
Trott Sep 14, 2021
9793e7f
build: add .mailmap/AUTHORS to path-ignore for test-asan
Trott Sep 14, 2021
8d5787a
build: add .mailmap/AUTHORS to paths-ignore for test-macos
Trott Sep 14, 2021
95528b2
src: remove unnecessary comment and add a CHECK in crypto_tls.cc
RaisinTen Sep 4, 2021
effdfa9
meta: update GeoffreyBooth email address
GeoffreyBooth Sep 14, 2021
7fdb127
doc: add timeout.close
galkin Sep 8, 2021
5c67085
dns: cleanup validation
VoltrexKeyva Sep 10, 2021
b7dc651
build: run modified internet tests on GitHub Actions
Trott Sep 14, 2021
59fff92
fs: make `open` and `close` stream override optional when unused
aduh95 Sep 6, 2021
d80082f
crypto: use `validateObject`
VoltrexKeyva Aug 24, 2021
06f6e01
deps: add riscv64 into openssl Makefile and gen openssl-riscv64
luyahan Sep 10, 2021
1ced732
doc: fix CJS-ESM selector in Safari
bmeck Sep 17, 2021
51f9ad4
src: add option to disable global search paths
zcbenz Aug 13, 2021
9a67296
src: add --no-global-search-paths cli option
zcbenz Aug 16, 2021
6085280
lib: avoid creating a throw away object in `validateObject`
aduh95 Aug 19, 2021
dd50b91
lib: remove useless statement
Sep 3, 2021
8b80dcb
doc: correct parameters in fs and stream documentation
Sep 4, 2021
2488bc0
doc: clean up weird notes about reentrancy
addaleax Sep 14, 2021
98d42fa
meta: add mailmap entry for LPardue
Trott Sep 16, 2021
a8c99d9
tools: update doc generator dependencies
targos Sep 8, 2021
ec94bec
test: do not run `test-corepack-yarn-install` with no internet
aduh95 Sep 12, 2021
4993318
meta: update GeoffreyBooth email addresses in AUTHORS and .mailmap
Trott Sep 17, 2021
a07d844
doc: fix comma splice
Trott Sep 17, 2021
590ace4
tools,doc: fix misrendering of consecutive JS blocks
Trott Sep 18, 2021
a63a4bc
http: limit requests per connection
fatal10110 Sep 11, 2021
f0dec58
crypto: fix webcrypto ed(25519|448) spki/pkcs8 import
panva Sep 16, 2021
b6939a3
doc: prepare README.md for stricter linting
Trott Sep 17, 2021
6be405b
test: fix test-dgram-udp6-link-local-address on Windows
targos Sep 5, 2021
0254b4b
doc: fix markdown indentation in lists
targos Sep 18, 2021
85206b7
deps: upgrade npm to 7.24.0
npm-robot Sep 20, 2021
e4825dc
doc: changes default values for fs.read fns
rbrishabh Jul 14, 2021
4444b5c
meta: update AUTHORS
nodejs-github-bot Sep 19, 2021
aff2a0a
2021-09-22, Version 16.10.0 (Current)
BethGriggs Sep 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: add option to disable loading native addons
PR-URL: #39977
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
d3lm authored and BethGriggs committed Sep 21, 2021
commit 9f3a015b6072b193ad127fef502e790f6c2d0052
10 changes: 10 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,15 @@ added: v7.10.0

This option is a no-op. It is kept for compatibility.

### `--no-addons`
<!-- YAML
added: REPLACEME
-->

Disable the `node-addons` exports condition as well as disable loading
native addons. When `--no-addons` is specified, calling `process.dlopen` or
requiring a native C++ addon will fail and throw an exception.

### `--no-deprecation`
<!-- YAML
added: v0.8.0
Expand Down Expand Up @@ -1418,6 +1427,7 @@ Node.js options that are allowed are:
* `--inspect`
* `--max-http-header-size`
* `--napi-modules`
* `--no-addons`
* `--no-deprecation`
* `--no-experimental-repl-await`
* `--no-force-async-hooks-checks`
Expand Down
9 changes: 9 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,14 @@ added: v16.4.0

The [debugger][] timed out waiting for the required host/port to be free.

<a id="ERR_DLOPEN_DISABLED"></a>
### `ERR_DLOPEN_DISABLED`
<!-- YAML
added: REPLACEME
-->

Loading native addons has been disabled using [`--no-addons`][].

<a id="ERR_DLOPEN_FAILED"></a>
### `ERR_DLOPEN_FAILED`
<!-- YAML
Expand Down Expand Up @@ -2871,6 +2879,7 @@ The native call from `process.cpuUsage` could not be processed.
[`'uncaughtException'`]: process.md#process_event_uncaughtexception
[`--disable-proto=throw`]: cli.md#cli_disable_proto_mode
[`--force-fips`]: cli.md#cli_force_fips
[`--no-addons`]: cli.md#cli_no_addons
[`Class: assert.AssertionError`]: assert.md#assert_class_assert_assertionerror
[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE
[`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: #ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST
Expand Down
20 changes: 16 additions & 4 deletions doc/api/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ Node.js implements the following conditions:
* `"node"` - matches for any Node.js environment. Can be a CommonJS or ES
module file. _This condition should always come after `"import"` or
`"require"`._
* `"node-addons"` - similar to `"node"` and matches for any Node.js environment.
This condition can be used to provide an entry point which uses native C++
addons as opposed to an entry point which is more universal and doesn't rely
on native addons. This condition can be disabled via the
[`--no-addons` flag][].
* `"default"` - the generic fallback that always matches. Can be a CommonJS
or ES module file. _This condition should always come last._

Expand Down Expand Up @@ -615,17 +620,23 @@ node --conditions=development main.js
```

which would then resolve the `"development"` condition in package imports and
exports, while resolving the existing `"node"`, `"default"`, `"import"`, and
`"require"` conditions as appropriate.
exports, while resolving the existing `"node"`, `"node-addons"`, `"default"`,
`"import"`, and `"require"` conditions as appropriate.

Any number of custom conditions can be set with repeat flags.

### Conditions Definitions

The `"import"`, `"require"`, `"node"` and `"default"` conditions are defined
and implemented in Node.js core,
The `"import"` , `"require"` , `"node"` , `"node-addons"` and `"default"`
conditions are defined and implemented in Node.js core,
[as specified above](#packages_conditional_exports).

The `"node-addons"` condition can be used to provide an entry point which
uses native C++ addons. However, this condition can be disabled via the
[`--no-addons` flag][]. When using `"node-addons"`, it's recommended to treat
`"default"` as an enhancement that provides a more universal entry point, e.g.
using WebAssembly instead of a native addon.

Other condition strings are unknown to Node.js and thus ignored by default.
Runtimes or tools other than Node.js can use them at their discretion.

Expand Down Expand Up @@ -1249,6 +1260,7 @@ This field defines [subpath imports][] for the current package.
[`"name"`]: #packages_name
[`"packageManager"`]: #packages_packagemanager
[`"type"`]: #packages_type
[`--no-addons` flag]: cli.md#cli_no_addons
[`ERR_PACKAGE_PATH_NOT_EXPORTED`]: errors.md#errors_err_package_path_not_exported
[`esm`]: https://github.com/standard-things/esm#readme
[`package.json`]: #packages_node_js_package_json_field_definitions
Expand Down
5 changes: 5 additions & 0 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ Silence deprecation warnings.
Disable runtime checks for `async_hooks`.
These will still be enabled dynamically when `async_hooks` is enabled.
.
.It Fl -no-addons
Disable the `node-addons` exports condition as well as disable loading native
addons. When `--no-addons` is specified, calling `process.dlopen` or requiring
a native C++ addon will fail and throw an exception.
.
.It Fl -no-warnings
Silence all process warnings (including deprecations).
.
Expand Down
10 changes: 9 additions & 1 deletion lib/internal/modules/cjs/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ let debug = require('internal/util/debuglog').debuglog('module', (fn) => {
debug = fn;
});

const noAddons = getOptionValue('--no-addons');
const addonConditions = noAddons ? [] : ['node-addons'];

// TODO: Use this set when resolving pkg#exports conditions in loader.js.
const cjsConditions = new SafeSet(['require', 'node', ...userConditions]);
const cjsConditions = new SafeSet([
'require',
'node',
...addonConditions,
...userConditions,
]);

function loadNativeModule(filename, request) {
const mod = NativeModule.map.get(filename);
Expand Down
11 changes: 10 additions & 1 deletion lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ const { Module: CJSModule } = require('internal/modules/cjs/loader');

const packageJsonReader = require('internal/modules/package_json_reader');
const userConditions = getOptionValue('--conditions');
const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import', ...userConditions]);
const noAddons = getOptionValue('--no-addons');
const addonConditions = noAddons ? [] : ['node-addons'];

const DEFAULT_CONDITIONS = ObjectFreeze([
'node',
'import',
...addonConditions,
...userConditions,
]);

const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS);

/**
Expand Down
5 changes: 5 additions & 0 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ inline bool Environment::is_main_thread() const {
return worker_context() == nullptr;
}

inline bool Environment::no_native_addons() const {
return (flags_ & EnvironmentFlags::kNoNativeAddons) ||
!options_->allow_native_addons;
}

inline bool Environment::should_not_register_esm_loader() const {
return flags_ & EnvironmentFlags::kNoRegisterESMLoader;
}
Expand Down
1 change: 1 addition & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ class Environment : public MemoryRetainer {
inline void set_has_serialized_options(bool has_serialized_options);

inline bool is_main_thread() const;
inline bool no_native_addons() const;
inline bool should_not_register_esm_loader() const;
inline bool owns_process_state() const;
inline bool owns_inspector() const;
Expand Down
8 changes: 7 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,13 @@ enum Flags : uint64_t {
// Set this flag to force hiding console windows when spawning child
// processes. This is usually used when embedding Node.js in GUI programs on
// Windows.
kHideConsoleWindows = 1 << 5
kHideConsoleWindows = 1 << 5,
// Set this flag to disable loading native addons via `process.dlopen`.
// This environment flag is especially important for worker threads
// so that a worker thread can't load a native addon even if `execArgv`
// is overwritten and `--no-addons` is not specified but was specified
// for this Environment instance.
kNoNativeAddons = 1 << 6
};
} // namespace EnvironmentFlags

Expand Down
6 changes: 6 additions & 0 deletions src/node_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,12 @@ inline napi_addon_register_func GetNapiInitializerCallback(DLib* dlib) {
// cache that's a plain C list or hash table that's shared across contexts?
void DLOpen(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

if (env->no_native_addons()) {
return THROW_ERR_DLOPEN_DISABLED(
env, "Cannot load native addon because loading addons is disabled.");
}

auto context = env->context();

CHECK_NULL(thread_local_modpending);
Expand Down
1 change: 1 addition & 0 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void OnFatalError(const char* location, const char* message);
V(ERR_CRYPTO_UNKNOWN_DH_GROUP, Error) \
V(ERR_CRYPTO_UNSUPPORTED_OPERATION, Error) \
V(ERR_CRYPTO_JOB_INIT_FAILED, Error) \
V(ERR_DLOPEN_DISABLED, Error) \
V(ERR_DLOPEN_FAILED, Error) \
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, Error) \
V(ERR_INVALID_ADDRESS, Error) \
Expand Down
5 changes: 5 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
&EnvironmentOptions::force_async_hooks_checks,
kAllowedInEnvironment,
true);
AddOption("--addons",
"disable loading native addons",
&EnvironmentOptions::allow_native_addons,
kAllowedInEnvironment,
true);
AddOption("--warnings",
"silence all process warnings",
&EnvironmentOptions::warnings,
Expand Down
1 change: 1 addition & 0 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class EnvironmentOptions : public Options {
uint64_t max_http_header_size = 16 * 1024;
bool deprecation = true;
bool force_async_hooks_checks = true;
bool allow_native_addons = true;
bool warnings = true;
bool force_context_aware = false;
bool pending_deprecation = false;
Expand Down
2 changes: 2 additions & 0 deletions src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
worker->environment_flags_ |= EnvironmentFlags::kTrackUnmanagedFds;
if (env->hide_console_windows())
worker->environment_flags_ |= EnvironmentFlags::kHideConsoleWindows;
if (env->no_native_addons())
worker->environment_flags_ |= EnvironmentFlags::kNoNativeAddons;
}

void Worker::StartThread(const FunctionCallbackInfo<Value>& args) {
Expand Down
9 changes: 9 additions & 0 deletions test/addons/no-addons/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ '../hello-world/binding.cc' ],
'includes': ['../common.gypi'],
}
]
}
59 changes: 59 additions & 0 deletions test/addons/no-addons/test-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Flags: --no-addons

'use strict';

const common = require('../../common');
const assert = require('assert');
const path = require('path');
const { Worker } = require('worker_threads');

const binding = path.resolve(__dirname, `./build/${common.buildType}/binding`);

const assertError = (error) => {
assert.strictEqual(error.code, 'ERR_DLOPEN_DISABLED');
assert.strictEqual(
error.message,
'Cannot load native addon because loading addons is disabled.'
);
};

{
// Flags should be inherited
const worker = new Worker(`require(${JSON.stringify(binding)})`, {
eval: true,
});

worker.on('error', common.mustCall(assertError));
}

{
// Should throw when using `process.dlopen` directly
const worker = new Worker(
`process.dlopen({ exports: {} }, ${JSON.stringify(binding)});`,
{
eval: true,
}
);

worker.on('error', common.mustCall(assertError));
}

{
// Explicitly pass `--no-addons`
const worker = new Worker(`require(${JSON.stringify(binding)})`, {
eval: true,
execArgv: ['--no-addons'],
});

worker.on('error', common.mustCall(assertError));
}

{
// If `execArgv` is overwritten it should still fail to load addons
const worker = new Worker(`require(${JSON.stringify(binding)})`, {
eval: true,
execArgv: [],
});

worker.on('error', common.mustCall(assertError));
}
43 changes: 43 additions & 0 deletions test/addons/no-addons/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Flags: --no-addons

'use strict';

const common = require('../../common');
const assert = require('assert');

const bindingPath = require.resolve(`./build/${common.buildType}/binding`);

const assertError = (error) => {
assert(error instanceof Error);
assert.strictEqual(error.code, 'ERR_DLOPEN_DISABLED');
assert.strictEqual(
error.message,
'Cannot load native addon because loading addons is disabled.'
);
};

{
let threw = false;

try {
require(bindingPath);
} catch (error) {
assertError(error);
threw = true;
}

assert(threw);
}

{
let threw = false;

try {
process.dlopen({ exports: {} }, bindingPath);
} catch (error) {
assertError(error);
threw = true;
}

assert(threw);
}
27 changes: 27 additions & 0 deletions test/es-module/test-esm-no-addons.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { mustCall } from '../common/index.mjs';
import { Worker, isMainThread } from 'worker_threads';
import assert from 'assert';
import { fileURLToPath } from 'url';
import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs';

if (isMainThread) {
const tests = [[], ['--no-addons']];

for (const execArgv of tests) {
new Worker(fileURLToPath(import.meta.url), { execArgv });
}
} else {
[requireFixture, importFixture].forEach((loadFixture) => {
loadFixture('pkgexports/no-addons').then(
mustCall((module) => {
const message = module.default;

if (process.execArgv.length === 0) {
assert.strictEqual(message, 'using native addons');
} else {
assert.strictEqual(message, 'not using native addons');
}
})
);
});
}
10 changes: 8 additions & 2 deletions test/fixtures/es-module-loaders/loader-with-custom-condition.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import {ok, deepStrictEqual} from 'assert';
import { ok, deepStrictEqual } from 'assert';

export async function resolve(specifier, context, defaultResolve) {
ok(Array.isArray(context.conditions), 'loader receives conditions array');
deepStrictEqual([...context.conditions].sort(), ['import', 'node']);

deepStrictEqual([...context.conditions].sort(), [
'import',
'node',
'node-addons',
]);

return defaultResolve(specifier, {
...context,
conditions: ['custom-condition', ...context.conditions],
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/node_modules/pkgexports/addons-entry.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/fixtures/node_modules/pkgexports/no-addons-entry.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading