Skip to content

Commit

Permalink
docs: add note about line discrepancies and returning source maps in …
Browse files Browse the repository at this point in the history
…code transformers (#12566)
  • Loading branch information
mhnaeem committed Apr 4, 2022
1 parent eb2146f commit b82fd89
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/CodeTransformation.md
Expand Up @@ -123,6 +123,12 @@ Instead of having your custom transformer implement the `Transformer` interface

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down
6 changes: 6 additions & 0 deletions website/versioned_docs/version-27.0/CodeTransformation.md
Expand Up @@ -128,6 +128,12 @@ As can be seen, only `process` or `processAsync` is mandatory to implement, alth

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down
6 changes: 6 additions & 0 deletions website/versioned_docs/version-27.1/CodeTransformation.md
Expand Up @@ -128,6 +128,12 @@ As can be seen, only `process` or `processAsync` is mandatory to implement, alth

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down
6 changes: 6 additions & 0 deletions website/versioned_docs/version-27.2/CodeTransformation.md
Expand Up @@ -128,6 +128,12 @@ As can be seen, only `process` or `processAsync` is mandatory to implement, alth

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down
6 changes: 6 additions & 0 deletions website/versioned_docs/version-27.4/CodeTransformation.md
Expand Up @@ -128,6 +128,12 @@ As can be seen, only `process` or `processAsync` is mandatory to implement, alth

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down
6 changes: 6 additions & 0 deletions website/versioned_docs/version-27.5/CodeTransformation.md
Expand Up @@ -128,6 +128,12 @@ As can be seen, only `process` or `processAsync` is mandatory to implement, alth

Note that [ECMAScript module](ECMAScriptModules.md) support is indicated by the passed in `supports*` options. Specifically `supportsDynamicImport: true` means the transformer can return `import()` expressions, which is supported by both ESM and CJS. If `supportsStaticESM: true` it means top level `import` statements are supported and the code will be interpreted as ESM and not CJS. See [Node's docs](https://nodejs.org/api/esm.html#esm_differences_between_es_modules_and_commonjs) for details on the differences.

:::tip

Make sure `TransformedSource` contains a source map, so it is possible to report line information accurately in code coverage and test errors. Inline source maps also work but are slower.

:::

### Examples

### TypeScript with type checking
Expand Down

0 comments on commit b82fd89

Please sign in to comment.