doc,lib,src,test: unflag sqlite module
Some checks are pending
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run

This commit allows the node:sqlite module to be used without
starting Node with a CLI flag. The module is still experimental.

Fixes: https://github.com/nodejs/node/issues/55854
PR-URL: https://github.com/nodejs/node/pull/55890
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Colin Ihrig 2024-11-18 22:23:18 -05:00 committed by GitHub
parent d1830685b4
commit 1d01ad6773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 23 additions and 25 deletions

View File

@ -1065,14 +1065,6 @@ added:
Use this flag to enable [ShadowRealm][] support.
### `--experimental-sqlite`
<!-- YAML
added: v22.5.0
-->
Enable the experimental [`node:sqlite`][] module.
### `--experimental-strip-types`
<!-- YAML
@ -1693,6 +1685,18 @@ Disable support for loading a synchronous ES module graph in `require()`.
See [Loading ECMAScript modules using `require()`][].
### `--no-experimental-sqlite`
<!-- YAML
added: v22.5.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/55890
description: SQLite is unflagged but still experimental.
-->
Disable the experimental [`node:sqlite`][] module.
### `--no-experimental-websocket`
<!-- YAML
@ -3043,7 +3047,6 @@ one is included in the list below.
* `--experimental-require-module`
* `--experimental-shadow-realm`
* `--experimental-specifier-resolution`
* `--experimental-sqlite`
* `--experimental-strip-types`
* `--experimental-top-level-await`
* `--experimental-transform-types`
@ -3080,6 +3083,7 @@ one is included in the list below.
* `--no-deprecation`
* `--no-experimental-global-navigator`
* `--no-experimental-repl-await`
* `--no-experimental-sqlite`
* `--no-experimental-websocket`
* `--no-extra-info-on-fatal-exception`
* `--no-force-async-hooks-checks`

View File

@ -6,8 +6,7 @@
added: v22.5.0
-->
> Stability: 1.1 - Active development. Enable this API with the
> [`--experimental-sqlite`][] CLI flag.
> Stability: 1.1 - Active development.
<!-- source_link=lib/sqlite.js -->
@ -412,7 +411,6 @@ The following constants are meant for use with [`database.applyChangeset()`](#da
[Changesets and Patchsets]: https://www.sqlite.org/sessionintro.html#changesets_and_patchsets
[SQL injection]: https://en.wikipedia.org/wiki/SQL_injection
[`--experimental-sqlite`]: cli.md#--experimental-sqlite
[`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html
[`PRAGMA foreign_keys`]: https://www.sqlite.org/pragma.html#pragma_foreign_keys
[`sqlite3_changes64()`]: https://www.sqlite.org/c3ref/changes.html

View File

@ -182,9 +182,6 @@ Enable the experimental permission model.
.It Fl -experimental-shadow-realm
Use this flag to enable ShadowRealm support.
.
.It Fl -experimental-sqlite
Enable the experimental node:sqlite module.
.
.It Fl -experimental-test-coverage
Enable code coverage in the test runner.
.
@ -215,6 +212,9 @@ Enable experimental support for the Web Storage API.
.It Fl -no-experimental-repl-await
Disable top-level await keyword support in REPL.
.
.It Fl -no-experimental-sqlite
Disable the experimental node:sqlite module.
.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.

View File

@ -303,7 +303,7 @@ function setupNavigator() {
}
function setupSQLite() {
if (!getOptionValue('--experimental-sqlite')) {
if (getOptionValue('--no-experimental-sqlite')) {
return;
}

View File

@ -427,7 +427,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
AddOption("--experimental-sqlite",
"experimental node:sqlite module",
&EnvironmentOptions::experimental_sqlite,
kAllowedInEnvvar);
kAllowedInEnvvar,
true);
AddOption("--experimental-webstorage",
"experimental Web Storage API",
&EnvironmentOptions::experimental_webstorage,

View File

@ -123,7 +123,7 @@ class EnvironmentOptions : public Options {
bool experimental_eventsource = false;
bool experimental_fetch = true;
bool experimental_websocket = true;
bool experimental_sqlite = false;
bool experimental_sqlite = true;
bool experimental_webstorage = false;
std::string localstorage_file;
bool experimental_global_navigator = true;

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
require('../common');
const tmpdir = require('../common/tmpdir');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-sqlite
'use strict';
const { spawnPromisified } = require('../common');
const tmpdir = require('../common/tmpdir');
@ -23,13 +22,14 @@ suite('accessing the node:sqlite module', () => {
});
});
test('cannot be accessed without --experimental-sqlite flag', async (t) => {
test('can be disabled with --no-experimental-sqlite flag', async (t) => {
const {
stdout,
stderr,
code,
signal,
} = await spawnPromisified(process.execPath, [
'--no-experimental-sqlite',
'-e',
'require("node:sqlite")',
]);