Skip to content

Commit 1611823

Browse files
cli: remove --no-experimental-sqlite flag
node:sqlite is stable, so it no longer needs an opt-out. --experimental-sqlite stays as an undocumented no-op, like --experimental-websocket. Builds without SQLite now expose the module, which throws ERR_NO_SQLITE when loaded. Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com> PR-URL: #67698 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent a04590e commit 1611823

10 files changed

Lines changed: 33 additions & 45 deletions

File tree

‎doc/api/cli.md‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,20 +2384,6 @@ changes:
23842384
23852385
Legacy alias for [`--no-require-module`][].
23862386

2387-
### `--no-experimental-sqlite`
2388-
2389-
<!-- YAML
2390-
added: v22.5.0
2391-
changes:
2392-
- version:
2393-
- v23.4.0
2394-
- v22.13.0
2395-
pr-url: https://github.com/nodejs/node/pull/55890
2396-
description: SQLite is unflagged but still experimental.
2397-
-->
2398-
2399-
Disable the [`node:sqlite`][] module.
2400-
24012387
### `--no-experimental-vfs`
24022388

24032389
<!-- YAML
@@ -4403,6 +4389,7 @@ one is included in the list below.
44034389
* `--experimental-repl-await`
44044390
* `--experimental-require-module`
44054391
* `--experimental-specifier-resolution`
4392+
* `--experimental-sqlite`
44064393
* `--experimental-stream-iter`
44074394
* `--experimental-strip-private-modules`
44084395
* `--experimental-test-isolation`
@@ -4440,7 +4427,6 @@ one is included in the list below.
44404427
* `--no-experimental-ffi`
44414428
* `--no-experimental-global-navigator`
44424429
* `--no-experimental-import-text`
4443-
* `--no-experimental-sqlite`
44444430
* `--no-experimental-strip-types`
44454431
* `--no-experimental-vfs`
44464432
* `--no-experimental-web-worker`
@@ -5088,7 +5074,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
50885074
[`module.setSourceMapsSupport()`]: module.md#modulesetsourcemapssupportenabled-options
50895075
[`net.getDefaultAutoSelectFamilyAttemptTimeout()`]: net.md#netgetdefaultautoselectfamilyattempttimeout
50905076
[`node:ffi`]: ffi.md
5091-
[`node:sqlite`]: sqlite.md
50925077
[`node:stream/iter`]: stream_iter.md
50935078
[`node:vfs`]: vfs.md
50945079
[`permission.drop()`]: permissions.md#permissiondropscope-reference

‎doc/api/sqlite.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<!-- YAML
66
added: v22.5.0
77
changes:
8+
- version: REPLACEME
9+
pr-url: https://github.com/nodejs/node/pull/67698
10+
description: No longer disableable with the `--no-experimental-sqlite` CLI flag.
811
- version: v27.0.0-alpha.0.2.0
912
pr-url: https://github.com/nodejs/node/pull/67654
1013
description: SQLite is now stable.
@@ -39,6 +42,9 @@ This module is only available under the `node:` scheme. SQL trace events can
3942
be observed via the [`diagnostics_channel`][] module. See
4043
[`'sqlite.db.query'`][] for details.
4144

45+
When Node.js is built without SQLite support, loading this module throws
46+
[`ERR_NO_SQLITE`][].
47+
4248
The following example shows the basic usage of the `node:sqlite` module to open
4349
an in-memory database, write data to the database, and then read the data back.
4450

@@ -2172,6 +2178,7 @@ callback function to indicate what type of operation is being authorized.
21722178
[`'sqlite.db.query'`]: diagnostics_channel.md#event-sqlitedbquery
21732179
[`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html
21742180
[`ERR_INVALID_STATE`]: errors.md#err_invalid_state
2181+
[`ERR_NO_SQLITE`]: errors.md#err_no_sqlite
21752182
[`PRAGMA foreign_keys`]: https://www.sqlite.org/pragma.html#pragma_foreign_keys
21762183
[`SQLITE_DBCONFIG_DEFENSIVE`]: https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive
21772184
[`SQLITE_DETERMINISTIC`]: https://www.sqlite.org/c3ref/c_deterministic.html

‎doc/node-config-schema.json‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,6 @@
379379
"type": "boolean",
380380
"description": "Legacy alias for --require-module"
381381
},
382-
"experimental-sqlite": {
383-
"type": "boolean",
384-
"description": "experimental node:sqlite module"
385-
},
386382
"experimental-stream-iter": {
387383
"type": "boolean",
388384
"description": "experimental iterable streams API (node:stream/iter)"

‎doc/node.1‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,9 +1275,6 @@ Disable importing modules with \fBwith { type: 'text' }\fR.
12751275
.It Fl -no-experimental-require-module
12761276
Legacy alias for \fB--no-require-module\fR.
12771277
.
1278-
.It Fl -no-experimental-sqlite
1279-
Disable the \fBnode:sqlite\fR module.
1280-
.
12811278
.It Fl -no-experimental-vfs
12821279
Disable the experimental \fBnode:vfs\fR module and \fB--vfs-load\fR.
12831280
.
@@ -2357,6 +2354,8 @@ one is included in the list below.
23572354
.It
23582355
\fB--experimental-specifier-resolution\fR
23592356
.It
2357+
\fB--experimental-sqlite\fR
2358+
.It
23602359
\fB--experimental-stream-iter\fR
23612360
.It
23622361
\fB--experimental-strip-private-modules\fR
@@ -2431,8 +2430,6 @@ one is included in the list below.
24312430
.It
24322431
\fB--no-experimental-import-text\fR
24332432
.It
2434-
\fB--no-experimental-sqlite\fR
2435-
.It
24362433
\fB--no-experimental-strip-types\fR
24372434
.It
24382435
\fB--no-experimental-vfs\fR

‎lib/internal/bootstrap/realm.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const builtinModulePolicies = [
202202
['dtls', true, '--experimental-dtls'],
203203
['ffi', true, '--experimental-ffi'],
204204
['sea', true, null],
205-
['sqlite', true, '--experimental-sqlite'],
205+
['sqlite', true, null],
206206
['quic', true, '--experimental-quic'],
207207
['stream/iter', false, '--experimental-stream-iter'],
208208
['test', true, null],

‎src/node_options.cc‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
800800
true);
801801
AddOption("--experimental-websocket", "", NoOp{}, kAllowedInEnvvar);
802802
AddOption("--experimental-global-customevent", "", NoOp{}, kAllowedInEnvvar);
803-
AddOption("--experimental-sqlite",
804-
"experimental node:sqlite module",
805-
BOOL_FIELD(experimental_sqlite),
806-
kAllowedInEnvvar,
807-
HAVE_SQLITE);
803+
AddOption("--experimental-sqlite", "", NoOp{}, kAllowedInEnvvar);
808804
AddOption("--experimental-stream-iter",
809805
"experimental iterable streams API (node:stream/iter)",
810806
BOOL_FIELD(experimental_stream_iter),

‎src/node_options.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ class EnvironmentOptions : public Options {
217217
DEFINE_BOOL_FIELD(experimental_ffi) = HAVE_FFI;
218218
DEFINE_BOOL_FIELD(experimental_web_worker) = true;
219219
DEFINE_BOOL_FIELD(experimental_websocket) = true;
220-
DEFINE_BOOL_FIELD(experimental_sqlite) = HAVE_SQLITE;
221220
DEFINE_BOOL_FIELD(experimental_stream_iter) = EXPERIMENTALS_DEFAULT_VALUE;
222221
DEFINE_BOOL_FIELD(experimental_vfs) = true;
223222
DEFINE_BOOL_FIELD(vfs_load) = false;

‎test/parallel/test-sqlite-session.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --expose-gc --experimental-sqlite
1+
// Flags: --expose-gc
22
'use strict';
33
const { skipIfSQLiteMissing } = require('../common');
44
skipIfSQLiteMissing();

‎test/parallel/test-sqlite-without-sqlite.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32

43
const { hasSQLite } = require('../common');

‎test/parallel/test-sqlite.js‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,31 @@ suite('accessing the node:sqlite module', () => {
1616
});
1717
});
1818

19-
test('can be disabled with --no-experimental-sqlite flag', async (t) => {
20-
const {
21-
stdout,
22-
stderr,
23-
code,
24-
signal,
25-
} = await spawnPromisified(process.execPath, [
19+
test('can be accessed with the no-op --experimental-sqlite flag', async (t) => {
20+
const result = await spawnPromisified(process.execPath, [
21+
'--experimental-sqlite',
22+
'-p',
23+
'typeof require("node:sqlite").Database',
24+
]);
25+
26+
t.assert.deepStrictEqual(result, {
27+
code: 0,
28+
signal: null,
29+
stderr: '',
30+
stdout: 'function\n',
31+
});
32+
});
33+
34+
test('cannot be disabled with --no-experimental-sqlite', async (t) => {
35+
const { code, signal, stderr } = await spawnPromisified(process.execPath, [
2636
'--no-experimental-sqlite',
2737
'-e',
28-
'require("node:sqlite")',
38+
'',
2939
]);
3040

31-
t.assert.strictEqual(stdout, '');
32-
t.assert.match(stderr, /No such built-in module: node:sqlite/);
33-
t.assert.notStrictEqual(code, 0);
41+
t.assert.strictEqual(code, 9);
3442
t.assert.strictEqual(signal, null);
43+
t.assert.match(stderr, /--no-experimental-sqlite is an invalid negation/);
3544
});
3645
});
3746

0 commit comments

Comments
 (0)