Skip to content
Merged
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
28 changes: 0 additions & 28 deletions benchmark/fixtures/transform-types-benchmark.js

This file was deleted.

30 changes: 0 additions & 30 deletions benchmark/fixtures/transform-types-benchmark.ts

This file was deleted.

26 changes: 0 additions & 26 deletions benchmark/ts/transform-typescript.js

This file was deleted.

12 changes: 0 additions & 12 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1315,17 +1315,6 @@ Enable module mocking in the test runner.

This feature requires `--allow-worker` if used with the [Permission Model][].

### `--experimental-transform-types`

<!-- YAML
added: v22.7.0
-->

> Stability: 1.2 - Release candidate

Enables the transformation of TypeScript-only syntax into JavaScript code.
Implies `--enable-source-maps`.

### `--experimental-vm-modules`

<!-- YAML
Expand Down Expand Up @@ -3621,7 +3610,6 @@ one is included in the list below.
* `--experimental-specifier-resolution`
* `--experimental-test-isolation`
* `--experimental-top-level-await`
* `--experimental-transform-types`
* `--experimental-vm-modules`
* `--experimental-wasi-unstable-preview1`
* `--force-context-aware`
Expand Down
46 changes: 4 additions & 42 deletions doc/api/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@
added:
- v23.2.0
- v22.13.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/61803

Check warning on line 250 in doc/api/module.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
description: Removed `transform` and `sourceMap` options.
-->

> Stability: 1.2 - Release candidate
Expand All @@ -253,9 +257,6 @@
* `options` {Object}
* `mode` {string} **Default:** `'strip'`. Possible values are:
* `'strip'` Only strip type annotations without performing the transformation of TypeScript features.
* `'transform'` Strip type annotations and transform TypeScript features to JavaScript.
* `sourceMap` {boolean} **Default:** `false`. Only when `mode` is `'transform'`, if `true`, a source map
will be generated for the transformed code.
* `sourceUrl` {string} Specifies the source url used in the source map.
* Returns: {string} The code with type annotations stripped.
`module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It
Expand All @@ -264,10 +265,6 @@
By default, it will throw an error if the code contains TypeScript features
that require transformation such as `Enums`,
see [type-stripping][] for more information.
When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
see [transform TypeScript features][] for more information.
When mode is `'strip'`, source maps are not generated, because locations are preserved.
If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.

_WARNING_: The output of this function should not be considered stable across Node.js versions,
due to changes in the TypeScript parser.
Expand Down Expand Up @@ -306,40 +303,6 @@
// Prints: const a = 1\n\n//# sourceURL=source.ts;
```

When `mode` is `'transform'`, the code is transformed to JavaScript:

```mjs
import { stripTypeScriptTypes } from 'node:module';
const code = `
namespace MathUtil {
export const add = (a: number, b: number) => a + b;
}`;
const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
console.log(strippedCode);
// Prints:
// var MathUtil;
// (function(MathUtil) {
// MathUtil.add = (a, b)=>a + b;
// })(MathUtil || (MathUtil = {}));
// # sourceMappingURL=data:application/json;base64, ...
```

```cjs
const { stripTypeScriptTypes } = require('node:module');
const code = `
namespace MathUtil {
export const add = (a: number, b: number) => a + b;
}`;
const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
console.log(strippedCode);
// Prints:
// var MathUtil;
// (function(MathUtil) {
// MathUtil.add = (a, b)=>a + b;
// })(MathUtil || (MathUtil = {}));
// # sourceMappingURL=data:application/json;base64, ...
```

### `module.syncBuiltinESMExports()`

<!-- YAML
Expand Down Expand Up @@ -2041,5 +2004,4 @@
[synchronous hook functions]: #hook-functions-accepted-by-moduleregisterhooks
[the documentation of `Worker`]: worker_threads.md#new-workerfilename-options
[transferable objects]: worker_threads.md#portpostmessagevalue-transferlist
[transform TypeScript features]: typescript.md#typescript-features
[type-stripping]: typescript.md#type-stripping
6 changes: 4 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2002,6 +2002,9 @@
- v23.0.0
- v22.10.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/61803

Check warning on line 2006 in doc/api/process.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
description: Removed `transform` value.
- version:
- v25.2.0
- v24.12.0
Expand All @@ -2013,8 +2016,7 @@

* Type: {boolean|string}

A value that is `"strip"` by default,
`"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
A value that is `"strip"` by default, and `false` if
Node.js is run with `--no-strip-types`.

## `process.features.uv`
Expand Down
49 changes: 49 additions & 0 deletions doc/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ changes:
language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
The defensive flag can also be set using `enableDefensive()`.
**Default:** `true`.
* `limits` {Object} Configuration for various SQLite limits. These limits
can be used to prevent excessive resource consumption when handling
potentially malicious input. See [Run-Time Limits][] and [Limit Constants][]
in the SQLite documentation for details. Default values are determined by
SQLite's compile-time defaults and may vary depending on how SQLite was
built. The following properties are supported:
* `length` {number} Maximum length of a string or BLOB.
* `sqlLength` {number} Maximum length of an SQL statement.
* `column` {number} Maximum number of columns.
* `exprDepth` {number} Maximum depth of an expression tree.
* `compoundSelect` {number} Maximum number of terms in a compound SELECT.
* `vdbeOp` {number} Maximum number of VDBE instructions.
* `functionArg` {number} Maximum number of function arguments.
* `attach` {number} Maximum number of attached databases.
* `likePatternLength` {number} Maximum length of a LIKE pattern.
* `variableNumber` {number} Maximum number of SQL variables.
* `triggerDepth` {number} Maximum trigger recursion depth.

Constructs a new `DatabaseSync` instance.

Expand Down Expand Up @@ -451,6 +468,36 @@ added:
* Type: {boolean} Whether the database is currently within a transaction. This method
is a wrapper around [`sqlite3_get_autocommit()`][].

### `database.limits`

<!-- YAML
added: REPLACEME
-->

* Type: {Object}

An object for getting and setting SQLite database limits at runtime.
Each property corresponds to an SQLite limit and can be read or written.

```js
const db = new DatabaseSync(':memory:');

// Read current limit
console.log(db.limits.length);

// Set a new limit
db.limits.sqlLength = 100000;

// Reset a limit to its compile-time maximum
db.limits.sqlLength = Infinity;
```

Available properties: `length`, `sqlLength`, `column`, `exprDepth`,
`compoundSelect`, `vdbeOp`, `functionArg`, `attach`, `likePatternLength`,
`variableNumber`, `triggerDepth`.

Setting a property to `Infinity` resets the limit to its compile-time maximum value.

### `database.open()`

<!-- YAML
Expand Down Expand Up @@ -1478,6 +1525,8 @@ callback function to indicate what type of operation is being authorized.
[Changesets and Patchsets]: https://www.sqlite.org/sessionintro.html#changesets_and_patchsets
[Constants Passed To The Conflict Handler]: https://www.sqlite.org/session/c_changeset_conflict.html
[Constants Returned From The Conflict Handler]: https://www.sqlite.org/session/c_changeset_abort.html
[Limit Constants]: https://www.sqlite.org/c3ref/c_limit_attached.html
[Run-Time Limits]: https://www.sqlite.org/c3ref/limit.html
[SQL injection]: https://en.wikipedia.org/wiki/SQL_injection
[Type conversion between JavaScript and SQLite]: #type-conversion-between-javascript-and-sqlite
[`ATTACH DATABASE`]: https://www.sqlite.org/lang_attach.html
Expand Down
11 changes: 4 additions & 7 deletions doc/api/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/61803

Check warning on line 6 in doc/api/typescript.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
description: Removed `--experimental-transform-types` flag.
- version:
- v25.2.0
- v24.12.0
Expand Down Expand Up @@ -77,8 +80,6 @@
erasable TypeScript syntax.
Node.js will replace TypeScript syntax with whitespace,
and no type checking is performed.
To enable the transformation of non erasable TypeScript syntax, which requires JavaScript code generation,
such as `enum` declarations, parameter properties use the flag [`--experimental-transform-types`][].
To disable this feature, use the flag [`--no-strip-types`][].

Node.js ignores `tsconfig.json` files and therefore
Expand Down Expand Up @@ -139,8 +140,7 @@
### TypeScript features

Since Node.js is only removing inline types, any TypeScript features that
involve _replacing_ TypeScript syntax with new JavaScript syntax will error,
unless the flag [`--experimental-transform-types`][] is passed.
involve _replacing_ TypeScript syntax with new JavaScript syntax will error.

The most prominent features that require transformation are:

Expand Down Expand Up @@ -210,8 +210,6 @@

Since inline types are replaced by whitespace, source maps are unnecessary for
correct line numbers in stack traces; and Node.js does not generate them.
When [`--experimental-transform-types`][] is enabled, source-maps
are enabled by default.

### Type stripping in dependencies

Expand All @@ -228,7 +226,6 @@
[CommonJS]: modules.md
[ES Modules]: esm.md
[Full TypeScript support]: #full-typescript-support
[`--experimental-transform-types`]: cli.md#--experimental-transform-types
[`--no-strip-types`]: cli.md#--no-strip-types
[`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`]: errors.md#err_unsupported_typescript_syntax
[`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths
Expand Down
3 changes: 1 addition & 2 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,7 @@ anotherFunction();

It is possible to reconstruct the original locations by setting the option `sourceMap` to `true`.
If the source map is not available, the original location will be the same as the current location.
When the `--enable-source-maps` flag is enabled, for example when using `--experimental-transform-types`,
`sourceMap` will be true by default.
When the `--enable-source-maps` flag is enabled,`sourceMap` will be true by default.

```ts
import { getCallSites } from 'node:util';
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 @@ -213,10 +213,6 @@
"type": "boolean",
"description": "experimental node:sqlite module"
},
"experimental-transform-types": {
"type": "boolean",
"description": "enable transformation of TypeScript-onlysyntax into JavaScript code"
},
"experimental-vm-modules": {
"type": "boolean",
"description": "experimental ES Module support in vm module"
Expand Down
6 changes: 0 additions & 6 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,6 @@ collecting code coverage from tests for more details.
Enable module mocking in the test runner.
This feature requires \fB--allow-worker\fR if used with the Permission Model.
.
.It Fl -experimental-transform-types
Enables the transformation of TypeScript-only syntax into JavaScript code.
Implies \fB--enable-source-maps\fR.
.
.It Fl -experimental-vm-modules
Enable experimental ES Module support in the \fBnode:vm\fR module.
.
Expand Down Expand Up @@ -1883,8 +1879,6 @@ one is included in the list below.
.It
\fB--experimental-top-level-await\fR
.It
\fB--experimental-transform-types\fR
.It
\fB--experimental-vm-modules\fR
.It
\fB--experimental-wasi-unstable-preview1\fR
Expand Down
Loading
Loading