ts-node
Advanced tools
Comparing version 10.8.0 to 10.8.1
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Service } from './index'; | ||
@@ -3,0 +4,0 @@ export interface NodeLoaderHooksAPI1 { |
@@ -893,4 +893,7 @@ "use strict"; | ||
const sourceMap = JSON.parse(sourceMapText); | ||
sourceMap.file = fileName; | ||
sourceMap.sources = [fileName]; | ||
const outputFileName = (0, path_1.isAbsolute)(fileName) | ||
? (0, url_1.pathToFileURL)(fileName).href | ||
: fileName; | ||
sourceMap.file = outputFileName; | ||
sourceMap.sources = [outputFileName]; | ||
delete sourceMap.sourceRoot; | ||
@@ -897,0 +900,0 @@ return JSON.stringify(sourceMap); |
@@ -65,5 +65,9 @@ "use strict"; | ||
*/ | ||
const resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, optionsOnlyWithNewerTsVersions) => { | ||
return moduleNames.map((moduleName) => { | ||
const { resolvedModule } = ts.resolveModuleName(moduleName, containingFile, config.options, host, moduleResolutionCache, redirectedReference); | ||
const resolveModuleNames = (moduleNames, containingFile, reusedNames, redirectedReference, optionsOnlyWithNewerTsVersions, containingSourceFile) => { | ||
return moduleNames.map((moduleName, i) => { | ||
var _a, _b; | ||
const mode = containingSourceFile | ||
? (_b = (_a = ts).getModeForResolutionAtIndex) === null || _b === void 0 ? void 0 : _b.call(_a, containingSourceFile, i) | ||
: undefined; | ||
const { resolvedModule } = ts.resolveModuleName(moduleName, containingFile, config.options, host, moduleResolutionCache, redirectedReference, mode); | ||
if (resolvedModule) { | ||
@@ -76,4 +80,4 @@ fixupResolvedModule(resolvedModule); | ||
// language service never calls this, but TS docs recommend that we implement it | ||
const getResolvedModuleWithFailedLookupLocationsFromCache = (moduleName, containingFile) => { | ||
const ret = ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache); | ||
const getResolvedModuleWithFailedLookupLocationsFromCache = (moduleName, containingFile, resolutionMode) => { | ||
const ret = ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, resolutionMode); | ||
if (ret && ret.resolvedModule) { | ||
@@ -80,0 +84,0 @@ fixupResolvedModule(ret.resolvedModule); |
@@ -33,3 +33,3 @@ import type * as _ts from 'typescript'; | ||
resolveModuleNameFromCache: typeof _ts.resolveModuleNameFromCache; | ||
resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: _ts.CompilerOptions, host: _ts.ModuleResolutionHost, redirectedReference?: _ts.ResolvedProjectReference, cache?: _ts.TypeReferenceDirectiveResolutionCache, resolutionMode?: _ts.SourceFile['impliedNodeFormat']): _ts.ResolvedTypeReferenceDirectiveWithFailedLookupLocations; | ||
resolveTypeReferenceDirective: typeof _ts.resolveTypeReferenceDirective; | ||
createIncrementalCompilerHost: typeof _ts.createIncrementalCompilerHost; | ||
@@ -45,3 +45,2 @@ createSourceFile: typeof _ts.createSourceFile; | ||
interface LanguageServiceHost extends _ts.LanguageServiceHost { | ||
resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | _ts.FileReference[], containingFile: string, redirectedReference: _ts.ResolvedProjectReference | undefined, options: _ts.CompilerOptions, containingFileMode?: _ts.SourceFile['impliedNodeFormat'] | undefined): (_ts.ResolvedTypeReferenceDirective | undefined)[]; | ||
} | ||
@@ -62,2 +61,6 @@ type ModuleResolutionHost = _ts.ModuleResolutionHost; | ||
}; | ||
namespace ModuleKind { | ||
type CommonJS = _ts.ModuleKind.CommonJS; | ||
type ESNext = _ts.ModuleKind.ESNext; | ||
} | ||
} |
@@ -168,6 +168,6 @@ "use strict"; | ||
// POSIX or UNC | ||
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) { | ||
if (ch0 === 47 /* CharacterCodes.slash */ || ch0 === 92 /* CharacterCodes.backslash */) { | ||
if (path.charCodeAt(1) !== ch0) | ||
return 1; // POSIX: "/" (or non-normalized "\") | ||
const p1 = path.indexOf(ch0 === 47 /* slash */ ? directorySeparator : altDirectorySeparator, 2); | ||
const p1 = path.indexOf(ch0 === 47 /* CharacterCodes.slash */ ? directorySeparator : altDirectorySeparator, 2); | ||
if (p1 < 0) | ||
@@ -178,5 +178,5 @@ return path.length; // UNC: "//server" or "\\server" | ||
// DOS | ||
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) { | ||
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* CharacterCodes.colon */) { | ||
const ch2 = path.charCodeAt(2); | ||
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) | ||
if (ch2 === 47 /* CharacterCodes.slash */ || ch2 === 92 /* CharacterCodes.backslash */) | ||
return 3; // DOS: "c:/" or "c:\" | ||
@@ -203,3 +203,3 @@ if (path.length === 2) | ||
if (volumeSeparatorEnd !== -1) { | ||
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) { | ||
if (path.charCodeAt(volumeSeparatorEnd) === 47 /* CharacterCodes.slash */) { | ||
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/" | ||
@@ -232,3 +232,3 @@ return ~(volumeSeparatorEnd + 1); | ||
function isAnyDirectorySeparator(charCode) { | ||
return (charCode === 47 /* slash */ || charCode === 92 /* backslash */); | ||
return (charCode === 47 /* CharacterCodes.slash */ || charCode === 92 /* CharacterCodes.backslash */); | ||
} | ||
@@ -245,13 +245,13 @@ function removeTrailingDirectorySeparator(path) { | ||
function isVolumeCharacter(charCode) { | ||
return ((charCode >= 97 /* a */ && charCode <= 122 /* z */) || | ||
(charCode >= 65 /* A */ && charCode <= 90 /* Z */)); | ||
return ((charCode >= 97 /* CharacterCodes.a */ && charCode <= 122 /* CharacterCodes.z */) || | ||
(charCode >= 65 /* CharacterCodes.A */ && charCode <= 90 /* CharacterCodes.Z */)); | ||
} | ||
function getFileUrlVolumeSeparatorEnd(url, start) { | ||
const ch0 = url.charCodeAt(start); | ||
if (ch0 === 58 /* colon */) | ||
if (ch0 === 58 /* CharacterCodes.colon */) | ||
return start + 1; | ||
if (ch0 === 37 /* percent */ && | ||
url.charCodeAt(start + 1) === 51 /* _3 */) { | ||
if (ch0 === 37 /* CharacterCodes.percent */ && | ||
url.charCodeAt(start + 1) === 51 /* CharacterCodes._3 */) { | ||
const ch2 = url.charCodeAt(start + 2); | ||
if (ch2 === 97 /* a */ || ch2 === 65 /* A */) | ||
if (ch2 === 97 /* CharacterCodes.a */ || ch2 === 65 /* CharacterCodes.A */) | ||
return start + 3; | ||
@@ -258,0 +258,0 @@ } |
{ | ||
"name": "ts-node", | ||
"version": "10.8.0", | ||
"version": "10.8.1", | ||
"description": "TypeScript execution environment and REPL for node.js, with source map support", | ||
@@ -141,3 +141,3 @@ "main": "dist/index.js", | ||
"typedoc": "^0.22.10", | ||
"typescript": "4.6.4", | ||
"typescript": "4.7.2", | ||
"typescript-json-schema": "^0.53.0", | ||
@@ -144,0 +144,0 @@ "util.promisify": "^1.0.1" |
@@ -288,4 +288,4 @@ <!-- | ||
{ | ||
// This is an alias to @tsconfig/node12: https://github.com/tsconfig/bases | ||
"extends": "ts-node/node12/tsconfig.json", | ||
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases | ||
"extends": "ts-node/node16/tsconfig.json", | ||
@@ -679,3 +679,3 @@ // Most ts-node options can be specified here using their programmatic names. | ||
\*Default: `false` <br/> | ||
*Default:* `false` <br/> | ||
*Environment:* `TS_NODE_SCOPE` | ||
@@ -726,6 +726,8 @@ | ||
* resolves `.js` to `.ts`, so that `import "./foo.js"` will execute `foo.ts` | ||
* resolves `.cjs` to `.cts` | ||
* resolves `.mjs` to `.mts` | ||
* allows including file extensions in CommonJS, for consistency with ESM where this is often mandatory | ||
* remapping extensions, e.g. so that `import "./foo.js"` will execute `foo.ts`. Currently the following extensions will be mapped: | ||
* `.js` to `.ts`, `.tsx`, or `.jsx` | ||
* `.cjs` to `.cts` | ||
* `.mjs` to `.mts` | ||
* `.jsx` to `.tsx` | ||
* including file extensions in CommonJS, for consistency with ESM where this is often mandatory | ||
@@ -750,3 +752,3 @@ In the future, this hook will also support: | ||
Like node's [`--experimental-specifier-resolution`](https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#customizing-esm-specifier-resolution-algorithm), but can also be set in your `tsconfig.json` for convenience. | ||
Requires `esm` to be enabled. | ||
Requires [`esm`](#esm) to be enabled. | ||
@@ -1066,3 +1068,3 @@ *Default:* `explicit`<br/> | ||
* This is by far the fastest option | ||
* Enable [`transpileOnly`](#options) to skip typechecking without swc | ||
* Enable [`transpileOnly`](#transpileonly) to skip typechecking without swc | ||
@@ -1197,3 +1199,3 @@ ## With typechecking | ||
For example, to use a hypothetical "speedy-ts-compiler", first install it into your project: `npm install speedy-ts-compiler` | ||
For example, to use a hypothetical "@cspotcode/fast-ts-compiler", first install it into your project: `npm install @cspotcode/fast-ts-compiler` | ||
@@ -1206,3 +1208,3 @@ Then add the following to your tsconfig: | ||
"transpileOnly": true, | ||
"transpiler": "speedy-ts-compiler" | ||
"transpiler": "@cspotcode/fast-ts-compiler" | ||
} | ||
@@ -1209,0 +1211,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
724418
8059
1439