Skip to content

Commit 55239a4

Browse files
cjihrigruyadorno
authored andcommittedJan 5, 2025
doc,lib,src,test: unflag sqlite module
This commit allows the node:sqlite module to be used without starting Node with a CLI flag. The module is still experimental. Fixes: #55854 PR-URL: #55890 Reviewed-By: Jake Yuesong Li <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent ccc9b10 commit 55239a4

12 files changed

+23
-25
lines changed
 

‎doc/api/cli.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -1061,14 +1061,6 @@ added:
10611061

10621062
Use this flag to enable [ShadowRealm][] support.
10631063

1064-
### `--experimental-sqlite`
1065-
1066-
<!-- YAML
1067-
added: v22.5.0
1068-
-->
1069-
1070-
Enable the experimental [`node:sqlite`][] module.
1071-
10721064
### `--experimental-strip-types`
10731065

10741066
<!-- YAML
@@ -1688,6 +1680,18 @@ Disable support for loading a synchronous ES module graph in `require()`.
16881680

16891681
See [Loading ECMAScript modules using `require()`][].
16901682

1683+
### `--no-experimental-sqlite`
1684+
1685+
<!-- YAML
1686+
added: v22.5.0
1687+
changes:
1688+
- version: REPLACEME
1689+
pr-url: https://github.com/nodejs/node/pull/55890
1690+
description: SQLite is unflagged but still experimental.
1691+
-->
1692+
1693+
Disable the experimental [`node:sqlite`][] module.
1694+
16911695
### `--no-experimental-websocket`
16921696

16931697
<!-- YAML
@@ -3073,7 +3077,6 @@ one is included in the list below.
30733077
* `--experimental-require-module`
30743078
* `--experimental-shadow-realm`
30753079
* `--experimental-specifier-resolution`
3076-
* `--experimental-sqlite`
30773080
* `--experimental-strip-types`
30783081
* `--experimental-top-level-await`
30793082
* `--experimental-transform-types`
@@ -3112,6 +3115,7 @@ one is included in the list below.
31123115
* `--no-experimental-global-navigator`
31133116
* `--no-experimental-global-webcrypto`
31143117
* `--no-experimental-repl-await`
3118+
* `--no-experimental-sqlite`
31153119
* `--no-experimental-websocket`
31163120
* `--no-extra-info-on-fatal-exception`
31173121
* `--no-force-async-hooks-checks`

‎doc/api/sqlite.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
added: v22.5.0
77
-->
88

9-
> Stability: 1.1 - Active development. Enable this API with the
10-
> [`--experimental-sqlite`][] CLI flag.
9+
> Stability: 1.1 - Active development.
1110
1211
<!-- source_link=lib/sqlite.js -->
1312

@@ -432,7 +431,6 @@ The following constants are meant for use with [`database.applyChangeset()`](#da
432431

433432
[Changesets and Patchsets]: https://www.sqlite.org/sessionintro.html#changesets_and_patchsets
434433
[SQL injection]: https://en.wikipedia.org/wiki/SQL_injection
435-
[`--experimental-sqlite`]: cli.md#--experimental-sqlite
436434
[`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html
437435
[`PRAGMA foreign_keys`]: https://www.sqlite.org/pragma.html#pragma_foreign_keys
438436
[`sqlite3_changes64()`]: https://www.sqlite.org/c3ref/changes.html

‎doc/node.1

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ Enable the experimental permission model.
182182
.It Fl -experimental-shadow-realm
183183
Use this flag to enable ShadowRealm support.
184184
.
185-
.It Fl -experimental-sqlite
186-
Enable the experimental node:sqlite module.
187-
.
188185
.It Fl -experimental-test-coverage
189186
Enable code coverage in the test runner.
190187
.
@@ -224,6 +221,9 @@ Disable exposition of the Web Crypto API on the global scope.
224221
.It Fl -no-experimental-repl-await
225222
Disable top-level await keyword support in REPL.
226223
.
224+
.It Fl -no-experimental-sqlite
225+
Disable the experimental node:sqlite module.
226+
.
227227
.It Fl -experimental-vm-modules
228228
Enable experimental ES module support in VM module.
229229
.

‎lib/internal/process/pre_execution.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ function setupWebCrypto() {
382382
}
383383

384384
function setupSQLite() {
385-
if (!getOptionValue('--experimental-sqlite')) {
385+
if (getOptionValue('--no-experimental-sqlite')) {
386386
return;
387387
}
388388

‎src/node_options.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
430430
AddOption("--experimental-sqlite",
431431
"experimental node:sqlite module",
432432
&EnvironmentOptions::experimental_sqlite,
433-
kAllowedInEnvvar);
433+
kAllowedInEnvvar,
434+
true);
434435
AddOption("--experimental-webstorage",
435436
"experimental Web Storage API",
436437
&EnvironmentOptions::experimental_webstorage,

‎src/node_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class EnvironmentOptions : public Options {
123123
bool experimental_eventsource = false;
124124
bool experimental_fetch = true;
125125
bool experimental_websocket = true;
126-
bool experimental_sqlite = false;
126+
bool experimental_sqlite = true;
127127
bool experimental_webstorage = false;
128128
std::string localstorage_file;
129129
bool experimental_global_customevent = true;

‎test/parallel/test-sqlite-data-types.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
require('../common');
43
const tmpdir = require('../common/tmpdir');

‎test/parallel/test-sqlite-database-sync.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
require('../common');
43
const tmpdir = require('../common/tmpdir');

‎test/parallel/test-sqlite-named-parameters.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
require('../common');
43
const tmpdir = require('../common/tmpdir');

‎test/parallel/test-sqlite-statement-sync.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
require('../common');
43
const tmpdir = require('../common/tmpdir');

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
require('../common');
43
const tmpdir = require('../common/tmpdir');

‎test/parallel/test-sqlite.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Flags: --experimental-sqlite
21
'use strict';
32
const { spawnPromisified } = require('../common');
43
const tmpdir = require('../common/tmpdir');
@@ -23,13 +22,14 @@ suite('accessing the node:sqlite module', () => {
2322
});
2423
});
2524

26-
test('cannot be accessed without --experimental-sqlite flag', async (t) => {
25+
test('can be disabled with --no-experimental-sqlite flag', async (t) => {
2726
const {
2827
stdout,
2928
stderr,
3029
code,
3130
signal,
3231
} = await spawnPromisified(process.execPath, [
32+
'--no-experimental-sqlite',
3333
'-e',
3434
'require("node:sqlite")',
3535
]);

0 commit comments

Comments
 (0)
Please sign in to comment.