Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 1 addition & 16 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -2352,20 +2352,6 @@ changes:

Legacy alias for [`--no-require-module`][].

### `--no-experimental-sqlite`

<!-- YAML
added: v22.5.0
changes:
- version:
- v23.4.0
- v22.13.0
pr-url: https://github.com/nodejs/node/pull/55890
description: SQLite is unflagged but still experimental.
-->

Disable the [`node:sqlite`][] module.

### `--no-experimental-vfs`

<!-- YAML
Expand Down Expand Up @@ -4321,6 +4307,7 @@ one is included in the list below.
* `--experimental-require-module`
* `--experimental-shadow-realm`
* `--experimental-specifier-resolution`
* `--experimental-sqlite`
* `--experimental-stream-iter`
* `--experimental-strip-private-modules`
* `--experimental-test-isolation`
Expand Down Expand Up @@ -4356,7 +4343,6 @@ one is included in the list below.
* `--no-deprecation`
* `--no-experimental-ffi`
* `--no-experimental-global-navigator`
* `--no-experimental-sqlite`
* `--no-experimental-strip-types`
* `--no-experimental-vfs`
* `--no-experimental-web-worker`
Expand Down Expand Up @@ -4999,7 +4985,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
[`inspector.open()`]: inspector.md#inspectoropenport-host-wait
[`net.getDefaultAutoSelectFamilyAttemptTimeout()`]: net.md#netgetdefaultautoselectfamilyattempttimeout
[`node:ffi`]: ffi.md
[`node:sqlite`]: sqlite.md
[`node:stream/iter`]: stream_iter.md
[`node:vfs`]: vfs.md
[`permission.drop()`]: permissions.md#permissiondropscope-reference
Expand Down
3 changes: 3 additions & 0 deletions doc/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<!-- YAML
added: v22.5.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/67698
description: No longer disableable with the `--no-experimental-sqlite` CLI flag.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/67654
description: SQLite is now stable.
Expand Down
4 changes: 0 additions & 4 deletions doc/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@
"type": "boolean",
"description": ""
},
"experimental-sqlite": {
"type": "boolean",
"description": "experimental node:sqlite module"
},
"experimental-stream-iter": {
"type": "boolean",
"description": "experimental iterable streams API (node:stream/iter)"
Expand Down
7 changes: 2 additions & 5 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -1250,9 +1250,6 @@ Disable exposition of Navigator API on the global scope.
.It Fl -no-experimental-require-module
Legacy alias for \fB--no-require-module\fR.
.
.It Fl -no-experimental-sqlite
Disable the \fBnode:sqlite\fR module.
.
.It Fl -no-experimental-vfs
Disable the experimental \fBnode:vfs\fR module and \fB--vfs-load\fR.
.
Expand Down Expand Up @@ -2301,6 +2298,8 @@ one is included in the list below.
.It
\fB--experimental-specifier-resolution\fR
.It
\fB--experimental-sqlite\fR
.It
\fB--experimental-stream-iter\fR
.It
\fB--experimental-strip-private-modules\fR
Expand Down Expand Up @@ -2371,8 +2370,6 @@ one is included in the list below.
.It
\fB--no-experimental-global-navigator\fR
.It
\fB--no-experimental-sqlite\fR
.It
\fB--no-experimental-strip-types\fR
.It
\fB--no-experimental-vfs\fR
Expand Down
5 changes: 4 additions & 1 deletion lib/internal/bootstrap/realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ const {
const { ModuleWrap } = internalBinding('module_wrap');
ObjectSetPrototypeOf(ModuleWrap.prototype, null);

const { hasSQLite } = internalBinding('config');

const getOwn = (target, property, receiver) => {
return ObjectPrototypeHasOwnProperty(target, property) ?
ReflectGet(target, property, receiver) :
Expand All @@ -202,7 +204,8 @@ const builtinModulePolicies = [
['dtls', true, '--experimental-dtls'],
['ffi', true, '--experimental-ffi'],
['sea', true, null],
['sqlite', true, '--experimental-sqlite'],
// The option is a no-op, so builds without SQLite never expose node:sqlite.
['sqlite', true, hasSQLite ? null : '--experimental-sqlite'],
Comment on lines +207 to +208

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's confusing, IIUC that implies that when node was built without SQLite support, --experimental-sqlite is no longer no-op?

['quic', true, '--experimental-quic'],
['stream/iter', false, '--experimental-stream-iter'],
['test', true, null],
Expand Down
6 changes: 6 additions & 0 deletions src/node_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ static void InitConfig(Local<Object> target,
READONLY_FALSE_PROPERTY(target, "hasInspector");
#endif

#if HAVE_SQLITE
READONLY_TRUE_PROPERTY(target, "hasSQLite");
#else
READONLY_FALSE_PROPERTY(target, "hasSQLite");
#endif

Comment on lines +90 to +95

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really needed when there's process.config.variables.node_use_sqlite already?

// configure --no-browser-globals
#ifdef NODE_NO_BROWSER_GLOBALS
READONLY_TRUE_PROPERTY(target, "noBrowserGlobals");
Expand Down
6 changes: 1 addition & 5 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
true);
AddOption("--experimental-websocket", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-global-customevent", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-sqlite",
"experimental node:sqlite module",
BOOL_FIELD(experimental_sqlite),
kAllowedInEnvvar,
HAVE_SQLITE);
AddOption("--experimental-sqlite", "", NoOp{}, kAllowedInEnvvar);
AddOption("--experimental-stream-iter",
"experimental iterable streams API (node:stream/iter)",
BOOL_FIELD(experimental_stream_iter),
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class EnvironmentOptions : public Options {
DEFINE_BOOL_FIELD(experimental_ffi) = HAVE_FFI;
DEFINE_BOOL_FIELD(experimental_web_worker) = true;
DEFINE_BOOL_FIELD(experimental_websocket) = true;
DEFINE_BOOL_FIELD(experimental_sqlite) = HAVE_SQLITE;
DEFINE_BOOL_FIELD(experimental_stream_iter) = EXPERIMENTALS_DEFAULT_VALUE;
DEFINE_BOOL_FIELD(experimental_vfs) = true;
DEFINE_BOOL_FIELD(vfs_load) = false;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-sqlite-session.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-sqlite
// Flags: --expose-gc
'use strict';
const { skipIfSQLiteMissing } = require('../common');
skipIfSQLiteMissing();
Expand Down
31 changes: 20 additions & 11 deletions test/parallel/test-sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,31 @@ suite('accessing the node:sqlite module', () => {
});
});

test('can be disabled with --no-experimental-sqlite flag', async (t) => {
const {
stdout,
stderr,
code,
signal,
} = await spawnPromisified(process.execPath, [
test('can be accessed with the no-op --experimental-sqlite flag', async (t) => {
const result = await spawnPromisified(process.execPath, [
'--experimental-sqlite',
'-p',
'typeof require("node:sqlite").Database',
]);

t.assert.deepStrictEqual(result, {
code: 0,
signal: null,
stderr: '',
stdout: 'function\n',
});
});

test('cannot be disabled with --no-experimental-sqlite', async (t) => {
const { code, signal, stderr } = await spawnPromisified(process.execPath, [
'--no-experimental-sqlite',
'-e',
'require("node:sqlite")',
'',
]);

t.assert.strictEqual(stdout, '');
t.assert.match(stderr, /No such built-in module: node:sqlite/);
t.assert.notStrictEqual(code, 0);
t.assert.strictEqual(code, 9);
t.assert.strictEqual(signal, null);
t.assert.match(stderr, /--no-experimental-sqlite is an invalid negation/);
});
});

Expand Down
Loading