pax_global_header00006660000000000000000000000064145346030630014516gustar00rootroot0000000000000052 comment=057ac1beb118f9c42d21e876a17320ad73ea6be2 ts-node-10.9.2/000077500000000000000000000000001453460306300131605ustar00rootroot00000000000000ts-node-10.9.2/.editorconfig000066400000000000000000000005631453460306300156410ustar00rootroot00000000000000# EditorConfig is awesome: http://EditorConfig.org root = true [*] # This also tells github.com how wide to render tabs indent_size = 2 indent_style = space end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml,dist-raw/**}] # In case we switch to tabs above, these must still be spaces indent_style = space ts-node-10.9.2/.git-blame-ignore-revs000066400000000000000000000001001453460306300172470ustar00rootroot00000000000000# Prettier formatting 9d05cb684fc3a6e492832100a125ea07d1cc98c5 ts-node-10.9.2/.gitattributes000066400000000000000000000000301453460306300160440ustar00rootroot00000000000000raw/* linguist-vendored ts-node-10.9.2/.github/000077500000000000000000000000001453460306300145205ustar00rootroot00000000000000ts-node-10.9.2/.github/FUNDING.yml000066400000000000000000000000411453460306300163300ustar00rootroot00000000000000github: [blakeembrey, cspotcode] ts-node-10.9.2/.github/ISSUE_TEMPLATE/000077500000000000000000000000001453460306300167035ustar00rootroot00000000000000ts-node-10.9.2/.github/ISSUE_TEMPLATE/bug-report.md000066400000000000000000000017021453460306300213130ustar00rootroot00000000000000--- name: 'Bug report' about: 'Create a report to help us improve' --- ### Search Terms ### Expected Behavior ### Actual Behavior ### Steps to reproduce the problem ### Minimal reproduction ### Specifications * ts-node version: * node version: * TypeScript version: * tsconfig.json, if you're using one: ``` {} ``` * package.json: ``` {} ``` * Operating system and version: * If Windows, are you using WSL or WSL2?: ts-node-10.9.2/.github/ISSUE_TEMPLATE/config.yml000066400000000000000000000013371453460306300206770ustar00rootroot00000000000000--- contact_links: - name: Question about: "Please ask and answer usage questions in our Discussion forum." url: "https://github.com/TypeStrong/ts-node/discussions" - name: Chat about: "Alternatively, ask on the TypeScript Community Discord." url: "https://discord.gg/3rBctmf3dP" - name: "Help! My Types Are Missing!" about: "This is likely a configuration problem. Check our README" url: "https://typestrong.org/ts-node/docs/troubleshooting#missing-types" - name: "TSError or SyntaxError" about: "These errors come from TypeScript and node, respectively. Use Discussions or Discord for usage and configuration help." url: "https://typestrong.org/ts-node/docs/troubleshooting" ts-node-10.9.2/.github/ISSUE_TEMPLATE/feature-request.md000066400000000000000000000004371453460306300223520ustar00rootroot00000000000000--- name: 'Feature request' about: 'Suggest an idea for this project' --- ### Desired Behavior ### Is this request related to a problem? ### Alternatives you've considered ### Additional context ts-node-10.9.2/.github/workflows/000077500000000000000000000000001453460306300165555ustar00rootroot00000000000000ts-node-10.9.2/.github/workflows/continuous-integration.yml000066400000000000000000000156641453460306300240430ustar00rootroot00000000000000name: Continuous Integration on: # branches pushed by collaborators push: branches: - main # pull request from non-collaborators pull_request: {} # nightly schedule: - cron: '0 0 * * *' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: lint-build: name: "Lint & Build" runs-on: ubuntu-latest steps: # checkout code - uses: actions/checkout@v2 # install node - name: Use Node.js 16 uses: actions/setup-node@v1 with: node-version: 16 - run: | npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache" - name: Cache dependencies uses: actions/cache@v2 with: path: temp/npm-cache key: npm-cache-packaging-${{ hashFiles('package-lock.json') }} restore-keys: npm-cache-packaging- # lint, build, test - run: npm ci - run: npm run lint - run: npm run build-pack - name: Upload package artifact uses: actions/upload-artifact@v1 with: name: ts-node-packed.tgz path: tests/ts-node-packed.tgz test: needs: lint-build name: "Test: ${{ matrix.os }}, node ${{ matrix.node }}, TS ${{ matrix.typescript }}" runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: [ubuntu, windows] # Don't forget to add all new flavors to this list! flavor: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] include: # Node 12.15 - flavor: 1 node: 12.15 nodeFlag: 12_15 typescript: latest typescriptFlag: latest # Node 12.16 # Earliest version that supports getFormat, etc hooks: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#12.16.0 - flavor: 2 node: 12.16 nodeFlag: 12_16 typescript: latest typescriptFlag: latest # Node 12 - flavor: 3 node: 12 nodeFlag: 12 typescript: latest typescriptFlag: latest # Node 14.13.0 # To test ESM builtin module resolution immediately before a node behavioral change: https://github.com/TypeStrong/ts-node/issues/1130 - flavor: 4 node: 14.13.0 nodeFlag: 14_13_0 typescript: latest typescriptFlag: latest # Node 14 - flavor: 5 node: 14 nodeFlag: 14 typescript: latest typescriptFlag: latest - flavor: 6 node: 14 nodeFlag: 14 typescript: 2.7 typescriptFlag: 2_7 - flavor: 7 node: 14 nodeFlag: 14 typescript: next typescriptFlag: next # Node 16 # Node 16.11.1 # Earliest version that supports old ESM Loader Hooks API: https://github.com/TypeStrong/ts-node/pull/1522 - flavor: 8 node: 16.11.1 nodeFlag: 16_11_1 typescript: latest typescriptFlag: latest - flavor: 9 node: 16 nodeFlag: 16 typescript: latest typescriptFlag: latest downgradeNpm: true - flavor: 10 node: 16 nodeFlag: 16 typescript: 2.7 typescriptFlag: 2_7 downgradeNpm: true - flavor: 11 node: 16 nodeFlag: 16 typescript: next typescriptFlag: next downgradeNpm: true # Node 18 - flavor: 12 node: 18 nodeFlag: 18 typescript: latest typescriptFlag: latest downgradeNpm: true - flavor: 13 node: 18 nodeFlag: 18 typescript: next typescriptFlag: next downgradeNpm: true # Node nightly - flavor: 14 node: nightly nodeFlag: nightly typescript: latest typescriptFlag: latest downgradeNpm: true steps: # checkout code - uses: actions/checkout@v2 # install node - name: Use Node.js ${{ matrix.node }} if: matrix.node != 'nightly' uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - name: Use Node.js 16, will be subsequently overridden by download of nightly if: matrix.node == 'nightly' uses: actions/setup-node@v1 with: node-version: 16 - name: Download Node.js nightly if: matrix.node == 'nightly' && matrix.os == 'ubuntu' run: | export N_PREFIX=$(pwd)/n npm install -g n n nightly sudo cp "${N_PREFIX}/bin/node" "$(which node)" node --version - name: Download Node.js nightly if: matrix.node == 'nightly' && matrix.os == 'windows' run: | $version = (Invoke-WebRequest https://nodejs.org/download/nightly/index.json | ConvertFrom-json)[0].version $url = "https://nodejs.org/download/nightly/$version/win-x64/node.exe" $targetPath = (Get-Command node.exe).Source Invoke-WebRequest -Uri $url -OutFile $targetPath -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome) node --version # lint, build, test # Downgrade from npm 7 to 6 because 7 still seems buggy to me - if: ${{ matrix.downgradeNpm }} run: npm install -g npm@6 - run: | npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache" - name: Cache dependencies if: ${{ matrix.os != 'windows' }} uses: actions/cache@v2 with: path: temp/npm-cache key: npm-cache-${{ matrix.os }}-${{ hashFiles('package-lock.json') }} restore-keys: npm-cache-${{matrix.os }}- - run: npm ci --ignore-scripts - name: Upload npm logs if: ${{ failure() }} uses: actions/upload-artifact@v1 with: name: npm-logs path: temp/npm-cache/_logs - run: npm run build-tsc - name: Download package artifact uses: actions/download-artifact@v1 with: name: ts-node-packed.tgz path: tests/ - run: npm install typescript@${{ matrix.typescript }} --force - run: npm run test-cov - name: Upload npm logs if: ${{ failure() }} uses: actions/upload-artifact@v1 with: name: npm-logs-${{ matrix.os }}-node-${{ matrix.nodeFlag }}-typescript-${{ matrix.typescriptFlag }} path: temp/npm-cache/_logs - run: npm run coverage-report if: ${{ always() }} - name: Codecov if: ${{ always() }} uses: codecov/codecov-action@v1 with: flags: ${{ matrix.os }},node_${{ matrix.nodeFlag }},typescript_${{ matrix.typescriptFlag }} ts-node-10.9.2/.github/workflows/website.yml000066400000000000000000000014461453460306300207470ustar00rootroot00000000000000name: Publish website on: # branches pushed by collaborators push: branches: - docs jobs: build: name: Build & Deploy runs-on: ubuntu-20.04 steps: # checkout code - uses: actions/checkout@v2 # install node - name: Use Node.js 14 uses: actions/setup-node@v1 with: node-version: 14 # Render typedoc - run: npm install && npx typedoc # Render docusaurus and deploy website - run: | set -euo pipefail git config --global user.name "GitHub Action" git config --global user.email "github-action@users.noreply.github.com" cd website yarn yarn deploy env: GIT_USER: ${{ github.actor }} GIT_PASS: ${{ secrets.GITHUB_TOKEN }} ts-node-10.9.2/.gitignore000066400000000000000000000003551453460306300151530ustar00rootroot00000000000000/node_modules/ /tests/node_modules/ /.nyc_output/ /coverage/ .DS_Store npm-debug.log /dist/ /tsconfig.schema.json /tsconfig.schemastore-schema.json /.idea/ /.vscode/* !/.vscode/launch.json /website/static/api /tsconfig.tsbuildinfo /temp ts-node-10.9.2/.vscode/000077500000000000000000000000001453460306300145215ustar00rootroot00000000000000ts-node-10.9.2/.vscode/launch.json000066400000000000000000000021661453460306300166730ustar00rootroot00000000000000{ "configurations": [ { "name": "Debug AVA test file", "type": "node", "request": "launch", "preLaunchTask": "npm: pre-debug", "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava", "program": "${file}", "outputCapture": "std", "skipFiles": [ "/**/*.js" ] }, { "name": "Debug resolver test", "type": "pwa-node", "request": "launch", "cwd": "${workspaceFolder}/tests/tmp/resolver-0029-preferSrc-typeModule-allowJs-skipIgnore-experimentalSpecifierResolutionNode", "runtimeArgs": [ "--loader", "../../../esm.mjs" ], "program": "./src/entrypoint-0000-src-to-src.cjs" }, { "name": "Debug Example: running a test fixture against local ts-node/esm loader", "type": "pwa-node", "request": "launch", "cwd": "${workspaceFolder}/tests/esm", "runtimeArgs": [ "--loader", "../../ts-node/esm" ], "program": "throw error.ts", "outputCapture": "std", "skipFiles": [ "/**/*.js" ] } ] }ts-node-10.9.2/.vscode/tasks.json000066400000000000000000000003401453460306300165360ustar00rootroot00000000000000{ "tasks": [ { "type": "npm", "script": "pre-debug", "problemMatcher": [ "$tsc" ], "label": "npm: pre-debug", "detail": "npm run build-tsc && npm run build-pack" } ] } ts-node-10.9.2/CONTRIBUTING.md000066400000000000000000000137521453460306300154210ustar00rootroot00000000000000*This guide is best-effort and will be improved as necessary.* ## Features, bugfixes, and other code We use npm scripts for building, testing, and linting. Read the scripts to become familiar with our build process. The big ones are: ``` npm install npm run build npm run test-local npm run lint-fix ``` `npm prepare` is maintained so that anyone can install `ts-node` from git, which is useful for testing experimental branches and unreleased features. Source lives in `src` and is compiled to `dist`. Some shim files live outside of `src` so that they can be imported at certain paths. For example, to allow users to import `ts-node/register`, we have `register/index.js` which is a shim to compiled code in `dist`. `dist-raw` is for larger chunks of code which are not compiled nor linted because they have been copy-pasted from `node`'s source code. ## Tests Test cases are declared in `src/test/*.spec.ts`, and test fixtures live in `./tests`. They can be run with `npm run test-local`. To run a subset of tests: ``` # Use ava's --match flag to match the name of a test or suite # https://github.com/avajs/ava/blob/main/docs/05-command-line.md # Don't forget the * wildcards npm run test-local -- --match '*esm loader*' ``` Tests are run with AVA, but using a custom wrapper API to enable some TS-friendly features and grouped test suites. The tests `npm pack` ts-node into a tarball and `npm install` it into `./tests/node_modules`. This makes `./tests` a better testing environment because it more closely matches the end-user's environment. Complex `require()` / `import` / `--require` / `--loader` invocations behave the way they would in a users's project. Historically, it has been difficult to test ts-node in-process because it mutates the node environment: installing require hooks, stack trace formatters, etc. `nyc`, `ava`, and `ts-node` all mutate the node environment, so it is tricky to setup and teardown individual tests in isolation, because ts-node's hooks need to be reset without disturbing `nyc` or `ava` hooks. For this reason, many tests are integration style, spawning ts-node's CLI in an external process, asking it to execute one of the fixture projects in `./tests`. Over time, I've gradually added setup and teardown logic so that more components can be tested in-process. We have a debug configuration for VSCode. 1. Open a `*.spec.ts` so it is the active/focused file. 2. (optional) set breakpoints. 3. Invoke debugger with F5. Note that some tests might misbehave in the debugger. REPL tests in particular. I'm not sure why, but I think it is related to how `console` does not write to stdout when in a debug session. ### Test Context Ava has the concept of test "context", an object which can store reusable fields common across many tests. By convention, any functions that setup reusable context start with `ctx`, making them easier to tab-complete and auto-import while writing tests. See `ctxTsNode` for an example. Context setup functions are re-executed for each test case. If you don't want this, wrap the context function in lodash `once()`. Each test will still get a unique context object, but the values placed onto each context will be identical. Every `ctx*` function has a namespace with `Ctx` and `T` types. These make it easier/cleaner to write tests. ### Test Macros Ava has the concept of test "macros", reusable functions which can declare a type of test many times with different inputs. Macro functions are created with `test.macro()`. By convention, if a macro function is meant to be imported and reused in multiple files, its name should start with `macro`. Macros can also be declared to require a certain "context," thanks to the namespace types described in "Test Context" above. See examples in `helpers.ts`. ## Documentation Documentation is written in markdown in `website/docs` and rendered into a website by Docusaurus. The README is also generated from these markdown files. To edit documentation, modify the markdown files in `./website/docs` and the sidebar declaration in `./website/sidebars.js` Docs for the latest stable release live in a `docs` branch. The "Edit this page" links on the website link to the `docs` branch so that the website can be improved in parallel with new feature work. Docs changes for unreleased features are merged to `main` in the same PR which implements the feature, adds tests, etc. When we release a new version, we merge `main` with `docs`, unifying the two. ```shell cd ./website yarn yarn start # Will host live website locally yarn build-readme # will rebuild the README.md ``` This site was used to generate the favicon from a high-res PNG export of the SVG. https://realfavicongenerator.net/ ## Release checklist We publish using `np`: https://npm.im/np 1. Merge `docs` into `main` using a pull request, ensuring a consistent squash-merge 2. Rebuild the README (see instructions above, necessary because npmjs.com renders the readme) 3. (optional) Update the api-extractor report; check for unexpected changes. See below 4. Publish with `np` - `np --branch main --no-tests` - `--no-tests` because we must rely on CI to test ts-node. Even if you *did* run the tests locally, you would only be testing a single operating system, node version, and TypeScript version, so locally-run tests are insufficient. 5. Add changelog to the Github Release; match formatting from previous releases 6. Move `docs` branch to head of `main` - this rebuilds the website - `git push --force origin main:docs` - avoids merge messiness due to earlier squash-merge from `docs` to `main` 7. If tsconfig schema has changed, send a pull request to schemastore. [Example](https://github.com/SchemaStore/schemastore/pull/1208) ## APIExtractor `npm run api-extractor` will update an API report generated by [`api-extractor`](https://api-extractor.com/pages/overview/intro/) which may be useful when generating release notes to detect (breaking) changes in our API surface. I configured it for my own convenience; it is not a necessary part of our development process. ts-node-10.9.2/LICENSE000066400000000000000000000021171453460306300141660ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ts-node-10.9.2/README.md000066400000000000000000001372361453460306300144530ustar00rootroot00000000000000 # [![TypeScript Node](logo.svg?sanitize=true)](https://typestrong.org/ts-node) [![NPM version](https://img.shields.io/npm/v/ts-node.svg?style=flat)](https://npmjs.org/package/ts-node) [![NPM downloads](https://img.shields.io/npm/dm/ts-node.svg?style=flat)](https://npmjs.org/package/ts-node) [![Build status](https://img.shields.io/github/workflow/status/TypeStrong/ts-node/Continuous%20Integration)](https://github.com/TypeStrong/ts-node/actions?query=workflow%3A%22Continuous+Integration%22) [![Test coverage](https://codecov.io/gh/TypeStrong/ts-node/branch/main/graph/badge.svg)](https://codecov.io/gh/TypeStrong/ts-node) > TypeScript execution and REPL for node.js, with source map and native ESM support. The latest documentation can also be found on our website: # Table of Contents * [Overview](#overview) * [Features](#features) * [Installation](#installation) * [Usage](#usage) * [Command Line](#command-line) * [Shebang](#shebang) * [node flags and other tools](#node-flags-and-other-tools) * [Programmatic](#programmatic) * [Configuration](#configuration) * [CLI flags](#cli-flags) * [Via tsconfig.json (recommended)](#via-tsconfigjson-recommended) * [@tsconfig/bases](#tsconfigbases) * [Default config](#default-config) * [`node` flags](#node-flags) * [Options](#options) * [CLI Options](#cli-options) * [help](#help) * [version](#version) * [eval](#eval) * [print](#print) * [interactive](#interactive) * [esm](#esm) * [TSConfig Options](#tsconfig-options) * [project](#project) * [skipProject](#skipproject) * [cwdMode](#cwdmode) * [compilerOptions](#compileroptions) * [showConfig](#showconfig) * [Typechecking](#typechecking) * [transpileOnly](#transpileonly) * [typeCheck](#typecheck) * [compilerHost](#compilerhost) * [files](#files) * [ignoreDiagnostics](#ignorediagnostics) * [Transpilation Options](#transpilation-options) * [ignore](#ignore) * [skipIgnore](#skipignore) * [compiler](#compiler) * [swc](#swc) * [transpiler](#transpiler) * [preferTsExts](#prefertsexts) * [Diagnostic Options](#diagnostic-options) * [logError](#logerror) * [pretty](#pretty) * [TS_NODE_DEBUG](#ts_node_debug) * [Advanced Options](#advanced-options) * [require](#require) * [cwd](#cwd) * [emit](#emit) * [scope](#scope) * [scopeDir](#scopedir) * [moduleTypes](#moduletypes) * [TS_NODE_HISTORY](#ts_node_history) * [noExperimentalReplAwait](#noexperimentalreplawait) * [experimentalResolver](#experimentalresolver) * [experimentalSpecifierResolution](#experimentalspecifierresolution) * [API Options](#api-options) * [SWC](#swc-1) * [CommonJS vs native ECMAScript modules](#commonjs-vs-native-ecmascript-modules) * [CommonJS](#commonjs) * [Native ECMAScript modules](#native-ecmascript-modules) * [Troubleshooting](#troubleshooting) * [Configuration](#configuration-1) * [Common errors](#common-errors) * [`TSError`](#tserror) * [`SyntaxError`](#syntaxerror) * [Unsupported JavaScript syntax](#unsupported-javascript-syntax) * [`ERR_REQUIRE_ESM`](#err_require_esm) * [`ERR_UNKNOWN_FILE_EXTENSION`](#err_unknown_file_extension) * [Missing Types](#missing-types) * [npx, yarn dlx, and node_modules](#npx-yarn-dlx-and-node_modules) * [Performance](#performance) * [Skip typechecking](#skip-typechecking) * [With typechecking](#with-typechecking) * [Advanced](#advanced) * [How it works](#how-it-works) * [Ignored files](#ignored-files) * [File extensions](#file-extensions) * [Skipping `node_modules`](#skipping-node_modules) * [Skipping pre-compiled TypeScript](#skipping-pre-compiled-typescript) * [Scope by directory](#scope-by-directory) * [Ignore by regexp](#ignore-by-regexp) * [paths and baseUrl ](#paths-and-baseurl) * [Why is this not built-in to ts-node?](#why-is-this-not-built-in-to-ts-node) * [Third-party compilers](#third-party-compilers) * [Transpilers](#transpilers) * [Third-party plugins](#third-party-plugins) * [Write your own plugin](#write-your-own-plugin) * [Module type overrides](#module-type-overrides) * [Caveats](#caveats) * [API](#api) * [Recipes](#recipes) * [Watching and restarting](#watching-and-restarting) * [AVA](#ava) * [CommonJS](#commonjs-1) * [Native ECMAScript modules](#native-ecmascript-modules-1) * [Gulp](#gulp) * [IntelliJ and Webstorm](#intellij-and-webstorm) * [Mocha](#mocha) * [Mocha 7 and newer](#mocha-7-and-newer) * [Mocha <=6](#mocha-6) * [Tape](#tape) * [Visual Studio Code](#visual-studio-code) * [Other](#other) * [License](#license) # Overview ts-node is a TypeScript execution engine and REPL for Node.js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute TypeScript on Node.js without precompiling. This is accomplished by hooking node's module loading APIs, enabling it to be used seamlessly alongside other Node.js tools and libraries. ## Features * Automatic sourcemaps in stack traces * Automatic `tsconfig.json` parsing * Automatic defaults to match your node version * Typechecking (optional) * REPL * Write standalone scripts * Native ESM loader * Use third-party transpilers * Use custom transformers * Integrate with test runners, debuggers, and CLI tools * Compatible with pre-compilation for production ![TypeScript REPL](website/static/img/screenshot.png) # Installation ```shell # Locally in your project. npm install -D typescript npm install -D ts-node # Or globally with TypeScript. npm install -g typescript npm install -g ts-node # Depending on configuration, you may also need these npm install -D tslib @types/node ``` **Tip:** Installing modules locally allows you to control and share the versions through `package.json`. ts-node will always resolve the compiler from `cwd` before checking relative to its own installation. # Usage ## Command Line ```shell # Execute a script as `node` + `tsc`. ts-node script.ts # Starts a TypeScript REPL. ts-node # Execute code with TypeScript. ts-node -e 'console.log("Hello, world!")' # Execute, and print, code with TypeScript. ts-node -p -e '"Hello, world!"' # Pipe scripts to execute with TypeScript. echo 'console.log("Hello, world!")' | ts-node # Equivalent to ts-node --transpileOnly ts-node-transpile-only script.ts # Equivalent to ts-node --cwdMode ts-node-cwd script.ts # Equivalent to ts-node --esm ts-node-esm script.ts ``` ## Shebang To write scripts with maximum portability, [specify options in your `tsconfig.json`](#via-tsconfigjson-recommended) and omit them from the shebang. ```typescript twoslash #!/usr/bin/env ts-node // ts-node options are read from tsconfig.json console.log("Hello, world!") ``` Including options within the shebang requires the [`env -S` flag](https://manpages.debian.org/bullseye/coreutils/env.1.en.html#S), which is available on recent versions of `env`. ([compatibility](https://github.com/TypeStrong/ts-node/pull/1448#issuecomment-913895766)) ```typescript twoslash #!/usr/bin/env -S ts-node --files // This shebang works on Mac and Linux with newer versions of env // Technically, Mac allows omitting `-S`, but Linux requires it ``` To test your version of `env` for compatibility with `-S`: ```shell # Note that these unusual quotes are necessary /usr/bin/env --debug '-S echo foo bar' ``` ## node flags and other tools You can register ts-node without using our CLI: `node -r ts-node/register` and `node --loader ts-node/esm` In many cases, setting [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) will enable `ts-node` within other node tools, child processes, and worker threads. This can be combined with other node flags. ```shell NODE_OPTIONS="-r ts-node/register --no-warnings" node ./index.ts ``` Or, if you require native ESM support: ```shell NODE_OPTIONS="--loader ts-node/esm" ``` This tells any node processes which receive this environment variable to install `ts-node`'s hooks before executing other code. If you are invoking node directly, you can avoid the environment variable and pass those flags to node. ```shell node --loader ts-node/esm --inspect ./index.ts ``` ## Programmatic You can require ts-node and register the loader for future requires by using `require('ts-node').register({ /* options */ })`. Check out our [API](#api) for more features. # Configuration ts-node supports a variety of options which can be specified via `tsconfig.json`, as CLI flags, as environment variables, or programmatically. For a complete list, see [Options](#options). ## CLI flags ts-node CLI flags must come *before* the entrypoint script. For example: ```shell $ ts-node --project tsconfig-dev.json say-hello.ts Ronald Hello, Ronald! ``` ## Via tsconfig.json (recommended) ts-node automatically finds and loads `tsconfig.json`. Most ts-node options can be specified in a `"ts-node"` object using their programmatic, camelCase names. We recommend this because it works even when you cannot pass CLI flags, such as `node --require ts-node/register` and when using shebangs. Use `--skipProject` to skip loading the `tsconfig.json`. Use `--project` to explicitly specify the path to a `tsconfig.json`. When searching, it is resolved using [the same search behavior as `tsc`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html). By default, this search is performed relative to the entrypoint script. In `--cwdMode` or if no entrypoint is specified -- for example when using the REPL -- the search is performed relative to `--cwd` / `process.cwd()`. You can use this sample configuration as a starting point: ```jsonc title="tsconfig.json" { // This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases "extends": "ts-node/node16/tsconfig.json", // Most ts-node options can be specified here using their programmatic names. "ts-node": { // It is faster to skip typechecking. // Remove if you want ts-node to do typechecking. "transpileOnly": true, "files": true, "compilerOptions": { // compilerOptions specified here will override those declared below, // but *only* in ts-node. Useful if you want ts-node and tsc to use // different options with a single tsconfig.json. } }, "compilerOptions": { // typescript options here } } ``` Our bundled [JSON schema](https://unpkg.com/browse/ts-node@latest/tsconfig.schema.json) lists all compatible options. ### @tsconfig/bases [@tsconfig/bases](https://github.com/tsconfig/bases) maintains recommended configurations for several node versions. As a convenience, these are bundled with ts-node. ```jsonc title="tsconfig.json" { "extends": "ts-node/node16/tsconfig.json", // Or install directly with `npm i -D @tsconfig/node16` "extends": "@tsconfig/node16/tsconfig.json", } ``` ### Default config If no `tsconfig.json` is loaded from disk, ts-node will use the newest recommended defaults from [@tsconfig/bases](https://github.com/tsconfig/bases/) compatible with your `node` and `typescript` versions. With the latest `node` and `typescript`, this is [`@tsconfig/node16`](https://github.com/tsconfig/bases/blob/master/bases/node16.json). Older versions of `typescript` are incompatible with `@tsconfig/node16`. In those cases we will use an older default configuration. When in doubt, `ts-node --showConfig` will log the configuration being used, and `ts-node -vv` will log `node` and `typescript` versions. ## `node` flags [`node` flags](https://nodejs.org/api/cli.html) must be passed directly to `node`; they cannot be passed to the ts-node binary nor can they be specified in `tsconfig.json` We recommend using the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) environment variable to pass options to `node`. ```shell NODE_OPTIONS='--trace-deprecation --abort-on-uncaught-exception' ts-node ./index.ts ``` Alternatively, you can invoke `node` directly and install ts-node via `--require`/`-r` ```shell node --trace-deprecation --abort-on-uncaught-exception -r ts-node/register ./index.ts ``` # Options All command-line flags support both `--camelCase` and `--hyphen-case`. Most options can be declared in your tsconfig.json: [Configuration via tsconfig.json](#via-tsconfigjson-recommended) `ts-node` supports `--print` (`-p`), `--eval` (`-e`), `--require` (`-r`) and `--interactive` (`-i`) similar to the [node.js CLI](https://nodejs.org/api/cli.html). `ts-node` supports `--project` and `--showConfig` similar to the [tsc CLI](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options). *Environment variables, where available, are in `ALL_CAPS`* ## CLI Options ### help ```shell ts-node --help ``` Prints the help text ### version ```shell ts-node -v ts-node -vvv ``` Prints the version. `-vv` includes node and typescript compiler versions. `-vvv` includes absolute paths to ts-node and typescript installations. ### eval ```shell ts-node -e # Example ts-node -e 'console.log("Hello world!")' ``` Evaluate code ### print ```shell ts-node -p -e # Example ts-node -p -e '"Hello world!"' ``` Print result of `--eval` ### interactive ```shell ts-node -i ``` Opens the REPL even if stdin does not appear to be a terminal ### esm ```shell ts-node --esm ts-node-esm ``` Bootstrap with the ESM loader, enabling full ESM support ## TSConfig Options ### project ```shell ts-node -P ts-node --project ``` Path to tsconfig file. *Note the uppercase `-P`. This is different from `tsc`'s `-p/--project` option.* *Environment:* `TS_NODE_PROJECT` ### skipProject ```shell ts-node --skipProject ``` Skip project config resolution and loading *Default:* `false`
*Environment:* `TS_NODE_SKIP_PROJECT` ### cwdMode ```shell ts-node -c ts-node --cwdMode ts-node-cwd ``` Resolve config relative to the current directory instead of the directory of the entrypoint script ### compilerOptions ```shell ts-node -O ts-node --compilerOptions ``` JSON object to merge with compiler options *Environment:* `TS_NODE_COMPILER_OPTIONS` ### showConfig ```shell ts-node --showConfig ``` Print resolved `tsconfig.json`, including `ts-node` options, and exit ## Typechecking ### transpileOnly ```shell ts-node -T ts-node --transpileOnly ``` Use TypeScript's faster `transpileModule` *Default:* `false`
*Environment:* `TS_NODE_TRANSPILE_ONLY` ### typeCheck ```shell ts-node --typeCheck ``` Opposite of `--transpileOnly` *Default:* `true`
*Environment:* `TS_NODE_TYPE_CHECK` ### compilerHost ```shell ts-node -H ts-node --compilerHost ``` Use TypeScript's compiler host API *Default:* `false`
*Environment:* `TS_NODE_COMPILER_HOST` ### files ```shell ts-node --files ``` Load `files`, `include` and `exclude` from `tsconfig.json` on startup. This may avoid certain typechecking failures. See [Missing types](#missing-types) for details. *Default:* `false`
*Environment:* `TS_NODE_FILES` ### ignoreDiagnostics ```shell ts-node -D ts-node --ignoreDiagnostics ``` Ignore TypeScript warnings by diagnostic code *Environment:* `TS_NODE_IGNORE_DIAGNOSTICS` ## Transpilation Options ### ignore ```shell ts-node -I ts-node --ignore ``` Override the path patterns to skip compilation *Default:* `/node_modules/`
*Environment:* `TS_NODE_IGNORE` ### skipIgnore ```shell ts-node --skipIgnore ``` Skip ignore checks *Default:* `false`
*Environment:* `TS_NODE_SKIP_IGNORE` ### compiler ```shell ts-node -C ts-node --compiler ``` Specify a custom TypeScript compiler *Default:* `typescript`
*Environment:* `TS_NODE_COMPILER` ### swc ```shell ts-node --swc ``` Transpile with [swc](#swc). Implies `--transpileOnly` *Default:* `false` ### transpiler ```shell ts-node --transpiler # Example ts-node --transpiler ts-node/transpilers/swc ``` Use a third-party, non-typechecking transpiler ### preferTsExts ```shell ts-node --preferTsExts ``` Re-order file extensions so that TypeScript imports are preferred *Default:* `false`
*Environment:* `TS_NODE_PREFER_TS_EXTS` ## Diagnostic Options ### logError ```shell ts-node --logError ``` Logs TypeScript errors to stderr instead of throwing exceptions *Default:* `false`
*Environment:* `TS_NODE_LOG_ERROR` ### pretty ```shell ts-node --pretty ``` Use pretty diagnostic formatter *Default:* `false`
*Environment:* `TS_NODE_PRETTY` ### TS_NODE_DEBUG ```shell TS_NODE_DEBUG=true ts-node ``` Enable debug logging ## Advanced Options ### require ```shell ts-node -r ts-node --require ``` Require a node module before execution ### cwd ```shell ts-node --cwd ``` Behave as if invoked in this working directory *Default:* `process.cwd()`
*Environment:* `TS_NODE_CWD` ### emit ```shell ts-node --emit ``` Emit output files into `.ts-node` directory. Requires `--compilerHost` *Default:* `false`
*Environment:* `TS_NODE_EMIT` ### scope ```shell ts-node --scope ``` Scope compiler to files within `scopeDir`. Anything outside this directory is ignored. *Default:* `false`
*Environment:* `TS_NODE_SCOPE` ### scopeDir ```shell ts-node --scopeDir ``` Directory within which compiler is limited when `scope` is enabled. *Default:* First of: `tsconfig.json` "rootDir" if specified, directory containing `tsconfig.json`, or cwd if no `tsconfig.json` is loaded.
*Environment:* `TS_NODE_SCOPE_DIR` ### moduleTypes Override the module type of certain files, ignoring the `package.json` `"type"` field. See [Module type overrides](#module-type-overrides) for details. *Default:* obeys `package.json` `"type"` and `tsconfig.json` `"module"`
*Can only be specified via `tsconfig.json` or API.* ### TS_NODE_HISTORY ```shell TS_NODE_HISTORY= ts-node ``` Path to history file for REPL *Default:* `~/.ts_node_repl_history` ### noExperimentalReplAwait ```shell ts-node --noExperimentalReplAwait ``` Disable top-level await in REPL. Equivalent to node's [`--no-experimental-repl-await`](https://nodejs.org/api/cli.html#cli_no_experimental_repl_await) *Default:* Enabled if TypeScript version is 3.8 or higher and target is ES2018 or higher.
*Environment:* `TS_NODE_EXPERIMENTAL_REPL_AWAIT` set `false` to disable ### experimentalResolver Enable experimental hooks that re-map imports and require calls to support: * 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 In the future, this hook will also support: * `baseUrl`, `paths` * `rootDirs` * `outDir` to `rootDir` mappings for composite projects and monorepos For details, see [#1514](https://github.com/TypeStrong/ts-node/issues/1514). *Default:* `false`, but will likely be enabled by default in a future version
*Can only be specified via `tsconfig.json` or API.* ### experimentalSpecifierResolution ```shell ts-node --experimentalSpecifierResolution node ``` 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`](#esm) to be enabled. *Default:* `explicit`
## API Options The API includes [additional options](https://typestrong.org/ts-node/api/interfaces/RegisterOptions.html) not shown here. # SWC SWC support is built-in via the `--swc` flag or `"swc": true` tsconfig option. [SWC](https://swc.rs) is a TypeScript-compatible transpiler implemented in Rust. This makes it an order of magnitude faster than vanilla `transpileOnly`. To use it, first install `@swc/core` or `@swc/wasm`. If using `importHelpers`, also install `@swc/helpers`. If `target` is less than "es2015" and using `async`/`await` or generator functions, also install `regenerator-runtime`. ```shell npm i -D @swc/core @swc/helpers regenerator-runtime ``` Then add the following to your `tsconfig.json`. ```jsonc title="tsconfig.json" { "ts-node": { "swc": true } } ``` > SWC uses `@swc/helpers` instead of `tslib`. If you have enabled `importHelpers`, you must also install `@swc/helpers`. # CommonJS vs native ECMAScript modules TypeScript is almost always written using modern `import` syntax, but it is also transformed before being executed by the underlying runtime. You can choose to either transform to CommonJS or to preserve the native `import` syntax, using node's native ESM support. Configuration is different for each. Here is a brief comparison of the two. | CommonJS | Native ECMAScript modules | |---|---| | Write native `import` syntax | Write native `import` syntax | | Transforms `import` into `require()` | Does not transform `import` | | Node executes scripts using the classic [CommonJS loader](https://nodejs.org/dist/latest-v16.x/docs/api/modules.html) | Node executes scripts using the new [ESM loader](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) | | Use any of:
`ts-node`
`node -r ts-node/register`
`NODE_OPTIONS="ts-node/register" node`
`require('ts-node').register({/* options */})` | Use any of:
`ts-node --esm`
`ts-node-esm`
Set `"esm": true` in `tsconfig.json`
`node --loader ts-node/esm`
`NODE_OPTIONS="--loader ts-node/esm" node` | ## CommonJS Transforming to CommonJS is typically simpler and more widely supported because it is older. You must remove [`"type": "module"`](https://nodejs.org/api/packages.html#packages_type) from `package.json` and set [`"module": "CommonJS"`](https://www.typescriptlang.org/tsconfig/#module) in `tsconfig.json`. ```jsonc title="package.json" { // This can be omitted; commonjs is the default "type": "commonjs" } ``` ```jsonc title="tsconfig.json" { "compilerOptions": { "module": "CommonJS" } } ``` If you must keep `"module": "ESNext"` for `tsc`, webpack, or another build tool, you can set an override for ts-node. ```jsonc title="tsconfig.json" { "compilerOptions": { "module": "ESNext" }, "ts-node": { "compilerOptions": { "module": "CommonJS" } } } ``` ## Native ECMAScript modules [Node's ESM loader hooks](https://nodejs.org/api/esm.html#esm_experimental_loaders) are [**experimental**](https://nodejs.org/api/documentation.html#documentation_stability_index) and subject to change. ts-node's ESM support is as stable as possible, but it relies on APIs which node can *and will* break in new versions of node. Thus it is not recommended for production. For complete usage, limitations, and to provide feedback, see [#1007](https://github.com/TypeStrong/ts-node/issues/1007). You must set [`"type": "module"`](https://nodejs.org/api/packages.html#packages_type) in `package.json` and [`"module": "ESNext"`](https://www.typescriptlang.org/tsconfig/#module) in `tsconfig.json`. ```jsonc title="package.json" { "type": "module" } ``` ```jsonc title="tsconfig.json" { "compilerOptions": { "module": "ESNext" // or ES2015, ES2020 }, "ts-node": { // Tell ts-node CLI to install the --loader automatically, explained below "esm": true } } ``` You must also ensure node is passed `--loader`. The ts-node CLI will do this automatically with our `esm` option. > Note: `--esm` must spawn a child process to pass it `--loader`. This may change if node adds the ability to install loader hooks > into the current process. ```shell # pass the flag ts-node --esm # Use the convenience binary ts-node-esm # or add `"esm": true` to your tsconfig.json to make it automatic ts-node ``` If you are not using our CLI, pass the loader flag to node. ```shell node --loader ts-node/esm ./index.ts # Or via environment variable NODE_OPTIONS="--loader ts-node/esm" node ./index.ts ``` # Troubleshooting ## Configuration ts-node uses sensible default configurations to reduce boilerplate while still respecting `tsconfig.json` if you have one. If you are unsure which configuration is used, you can log it with `ts-node --showConfig`. This is similar to `tsc --showConfig` but includes `"ts-node"` options as well. ts-node also respects your locally-installed `typescript` version, but global installations fallback to the globally-installed `typescript`. If you are unsure which versions are used, `ts-node -vv` will log them. ```shell $ ts-node -vv ts-node v10.0.0 node v16.1.0 compiler v4.2.2 $ ts-node --showConfig { "compilerOptions": { "target": "es6", "lib": [ "es6", "dom" ], "rootDir": "./src", "outDir": "./.ts-node", "module": "commonjs", "moduleResolution": "node", "strict": true, "declaration": false, "sourceMap": true, "inlineSources": true, "types": [ "node" ], "stripInternal": true, "incremental": true, "skipLibCheck": true, "importsNotUsedAsValues": "error", "inlineSourceMap": false, "noEmit": false }, "ts-node": { "cwd": "/d/project", "projectSearchDir": "/d/project", "require": [], "project": "/d/project/tsconfig.json" } } ``` ## Common errors It is important to differentiate between errors from ts-node, errors from the TypeScript compiler, and errors from `node`. It is also important to understand when errors are caused by a type error in your code, a bug in your code, or a flaw in your configuration. ### `TSError` Type errors from the compiler are thrown as a `TSError`. These are the same as errors you get from `tsc`. ### `SyntaxError` Any error that is not a `TSError` is from node.js (e.g. `SyntaxError`), and cannot be fixed by TypeScript or ts-node. These are bugs in your code or configuration. #### Unsupported JavaScript syntax Your version of `node` may not support all JavaScript syntax supported by TypeScript. The compiler must transform this syntax via "downleveling," which is controlled by the [tsconfig `"target"` option](https://www.typescriptlang.org/tsconfig#target). Otherwise your code will compile fine, but node will throw a `SyntaxError`. For example, `node` 12 does not understand the `?.` optional chaining operator. If you use `"target": "esnext"`, then the following TypeScript syntax: ```typescript twoslash const bar: string | undefined = foo?.bar; ``` will compile into this JavaScript: ```javascript const a = foo?.bar; ``` When you try to run this code, node 12 will throw a `SyntaxError`. To fix this, you must switch to `"target": "es2019"` or lower so TypeScript transforms `?.` into something `node` can understand. ### `ERR_REQUIRE_ESM` This error is thrown by node when a module is `require()`d, but node believes it should execute as native ESM. This can happen for a few reasons: * You have installed an ESM dependency but your own code compiles to CommonJS. * Solution: configure your project to compile and execute as native ESM. [Docs](#native-ecmascript-modules) * Solution: downgrade the dependency to an older, CommonJS version. * You have moved your project to ESM but still have a config file, such as `webpack.config.ts`, which must be executed as CommonJS * Solution: if supported by the relevant tool, rename your config file to `.cts` * Solution: Configure a module type override. [Docs](#module-type-overrides) * You have a mix of CommonJS and native ESM in your project * Solution: double-check all package.json "type" and tsconfig.json "module" configuration [Docs](#commonjs-vs-native-ecmascript-modules) * Solution: consider simplifying by making your project entirely CommonJS or entirely native ESM ### `ERR_UNKNOWN_FILE_EXTENSION` This error is thrown by node when a module has an unrecognized file extension, or no extension at all, and is being executed as native ESM. This can happen for a few reasons: * You are using a tool which has an extensionless binary, such as `mocha`. * CommonJS supports extensionless files but native ESM does not. * Solution: upgrade to ts-node >=[v10.6.0](https://github.com/TypeStrong/ts-node/releases/tag/v10.6.0), which implements a workaround. * Our ESM loader is not installed. * Solution: Use `ts-node-esm`, `ts-node --esm`, or add `"ts-node": {"esm": true}` to your tsconfig.json. [Docs](#native-ecmascript-modules) * You have moved your project to ESM but still have a config file, such as `webpack.config.ts`, which must be executed as CommonJS * Solution: if supported by the relevant tool, rename your config file to `.cts` * Solution: Configure a module type override. [Docs](#module-type-overrides) ## Missing Types ts-node does *not* eagerly load `files`, `include` or `exclude` by default. This is because a large majority of projects do not use all of the files in a project directory (e.g. `Gulpfile.ts`, runtime vs tests) and parsing every file for types slows startup time. Instead, ts-node starts with the script file (e.g. `ts-node index.ts`) and TypeScript resolves dependencies based on imports and references. Occasionally, this optimization leads to missing types. Fortunately, there are other ways to include them in typechecking. For global definitions, you can use the `typeRoots` compiler option. This requires that your type definitions be structured as type packages (not loose TypeScript definition files). More details on how this works can be found in the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types). Example `tsconfig.json`: ```jsonc { "compilerOptions": { "typeRoots" : ["./node_modules/@types", "./typings"] } } ``` Example project structure: ```text / -- tsconfig.json -- typings/ -- / -- index.d.ts ``` Example module declaration file: ```typescript twoslash declare module '' { // module definitions go here } ``` For module definitions, you can use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping): ```jsonc title="tsconfig.json" { "compilerOptions": { "baseUrl": ".", "paths": { "custom-module-type": ["types/custom-module-type"] } } } ``` Another option is [triple-slash directives](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). This may be helpful if you prefer not to change your `compilerOptions` or structure your type definitions for `typeRoots`. Below is an example of a triple-slash directive as a relative path within your project: ```typescript twoslash /// import {Greeter} from "lib_greeter" const g = new Greeter(); g.sayHello(); ``` If none of the above work, and you *must* use `files`, `include`, or `exclude`, enable our [`files`](#files) option. ## npx, yarn dlx, and node_modules When executing TypeScript with `npx` or `yarn dlx`, the code resides within a temporary `node_modules` directory. The contents of `node_modules` are ignored by default. If execution fails, enable [`skipIgnore`](#skipignore). # Performance These tricks will make ts-node faster. ## Skip typechecking It is often better to typecheck as part of your tests or linting. You can run `tsc --noEmit` to do this. In these cases, ts-node can skip typechecking, making it much faster. To skip typechecking in ts-node, do one of the following: * Enable [swc](#swc) * This is by far the fastest option * Enable [`transpileOnly`](#transpileonly) to skip typechecking without swc ## With typechecking If you absolutely must typecheck in ts-node: * Avoid dynamic `require()` which may trigger repeated typechecking; prefer `import` * Try with and without `--files`; one may be faster depending on your project * Check `tsc --showConfig`; make sure all executed files are included * Enable [`skipLibCheck`](https://www.typescriptlang.org/tsconfig#skipLibCheck) * Set a [`types`](https://www.typescriptlang.org/tsconfig#types) array to avoid loading unnecessary `@types` # Advanced ## How it works ts-node works by registering hooks for `.ts`, `.tsx`, `.js`, and/or `.jsx` extensions. Vanilla `node` loads `.js` by reading code from disk and executing it. Our hook runs in the middle, transforming code from TypeScript to JavaScript and passing the result to `node` for execution. This transformation will respect your `tsconfig.json` as if you had compiled via `tsc`. We also register a few other hooks to apply sourcemaps to stack traces and remap from `.js` imports to `.ts`. ## Ignored files ts-node transforms certain files and ignores others. We refer to this mechanism as "scoping." There are various options to configure scoping, so that ts-node transforms only the files in your project. > **Warning:** > > An ignored file can still be executed by node.js. Ignoring a file means we do not transform it from TypeScript into JavaScript, but it does not prevent execution. > > If a file requires transformation but is ignored, node may either fail to resolve it or attempt to execute it as vanilla JavaScript. This may cause syntax errors or other failures, because node does not understand TypeScript type syntax nor bleeding-edge ECMAScript features. ### File extensions `.js` and `.jsx` are only transformed when [`allowJs`](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options) is enabled. `.tsx` and `.jsx` are only transformed when [`jsx`](https://www.typescriptlang.org/docs/handbook/jsx.html) is enabled. > **Warning:** > > When ts-node is used with `allowJs`, *all* non-ignored JavaScript files are transformed by ts-node. ### Skipping `node_modules` By default, ts-node avoids compiling files in `/node_modules/` for three reasons: 1. Modules should always be published in a format node.js can consume 2. Transpiling the entire dependency tree will make your project slower 3. Differing behaviours between TypeScript and node.js (e.g. ES2015 modules) can result in a project that works until you decide to support a feature natively from node.js If you need to import uncompiled TypeScript in `node_modules`, use [`--skipIgnore`](#skipignore) or [`TS_NODE_SKIP_IGNORE`](#skipignore) to bypass this restriction. ### Skipping pre-compiled TypeScript If a compiled JavaScript file with the same name as a TypeScript file already exists, the TypeScript file will be ignored. ts-node will import the pre-compiled JavaScript. To force ts-node to import the TypeScript source, not the precompiled JavaScript, use [`--preferTsExts`](#prefertsexts). ### Scope by directory Our [`scope`](#scope) and [`scopeDir`](#scopedir) options will limit transformation to files within a directory. ### Ignore by regexp Our [`ignore`](#ignore) option will ignore files matching one or more regular expressions. ## paths and baseUrl You can use ts-node together with [tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths) to load modules according to the `paths` section in `tsconfig.json`. ```jsonc title="tsconfig.json" { "ts-node": { // Do not forget to `npm i -D tsconfig-paths` "require": ["tsconfig-paths/register"] } } ``` ### Why is this not built-in to ts-node? The official TypeScript Handbook explains the intended purpose for `"paths"` in ["Additional module resolution flags"](https://www.typescriptlang.org/docs/handbook/module-resolution.html#additional-module-resolution-flags). > The TypeScript compiler has a set of additional flags to *inform* the compiler of transformations that are expected to happen to the sources to generate the final output. > > It is important to note that the compiler will not perform any of these transformations; it just uses these pieces of information to guide the process of resolving a module import to its definition file. This means `"paths"` are intended to describe mappings that the build tool or runtime *already* performs, not to tell the build tool or runtime how to resolve modules. In other words, they intend us to write our imports in a way `node` already understands. For this reason, ts-node does not modify `node`'s module resolution behavior to implement `"paths"` mappings. ## Third-party compilers Some projects require a patched typescript compiler which adds additional features. For example, [`ttypescript`](https://github.com/cevek/ttypescript/tree/master/packages/ttypescript) and [`ts-patch`](https://github.com/nonara/ts-patch#readme) add the ability to configure custom transformers. These are drop-in replacements for the vanilla `typescript` module and implement the same API. For example, to use `ttypescript` and `ts-transformer-keys`, add this to your `tsconfig.json`: ```jsonc title="tsconfig.json" { "ts-node": { // This can be omitted when using ts-patch "compiler": "ttypescript" }, "compilerOptions": { // plugin configuration is the same for both ts-patch and ttypescript "plugins": [ { "transform": "ts-transformer-keys/transformer" } ] } } ``` ## Transpilers ts-node supports third-party transpilers as plugins. Transpilers such as swc can transform TypeScript into JavaScript much faster than the TypeScript compiler. You will still benefit from ts-node's automatic `tsconfig.json` discovery, sourcemap support, and global ts-node CLI. Plugins automatically derive an appropriate configuration from your existing `tsconfig.json` which simplifies project boilerplate. > **What is the difference between a compiler and a transpiler?** > > For our purposes, a compiler implements TypeScript's API and can perform typechecking. > A third-party transpiler does not. Both transform TypeScript into JavaScript. ### Third-party plugins The `transpiler` option allows using third-party transpiler plugins with ts-node. `transpiler` must be given the name of a module which can be `require()`d. The built-in `swc` plugin is exposed as `ts-node/transpilers/swc`. For example, to use a hypothetical "@cspotcode/fast-ts-compiler", first install it into your project: `npm install @cspotcode/fast-ts-compiler` Then add the following to your tsconfig: ```jsonc title="tsconfig.json" { "ts-node": { "transpileOnly": true, "transpiler": "@cspotcode/fast-ts-compiler" } } ``` ### Write your own plugin To write your own transpiler plugin, check our [API docs](https://typestrong.org/ts-node/api/interfaces/TranspilerModule.html). Plugins are `require()`d by ts-node, so they can be a local script or a node module published to npm. The module must export a `create` function described by our [`TranspilerModule`](https://typestrong.org/ts-node/api/interfaces/TranspilerModule.html) interface. `create` is invoked by ts-node at startup to create one or more transpiler instances. The instances are used to transform TypeScript into JavaScript. For a working example, check out out our bundled swc plugin: https://github.com/TypeStrong/ts-node/blob/main/src/transpilers/swc.ts ## Module type overrides > Wherever possible, it is recommended to use TypeScript's [`NodeNext` or `Node16` mode](https://www.typescriptlang.org/docs/handbook/esm-node.html) instead of the options described > in this section. Setting `"module": "NodeNext"` and using the `.cts` file extension should work well for most projects. When deciding how a file should be compiled and executed -- as either CommonJS or native ECMAScript module -- ts-node matches `node` and `tsc` behavior. This means TypeScript files are transformed according to your `tsconfig.json` `"module"` option and executed according to node's rules for the `package.json` `"type"` field. Set `"module": "NodeNext"` and everything should work. In rare cases, you may need to override this behavior for some files. For example, some tools read a `name-of-tool.config.ts` and require that file to execute as CommonJS. If you have `package.json` configured with `"type": "module"` and `tsconfig.json` with `"module": "esnext"`, the config is native ECMAScript by default and will raise an error. You will need to force the config and any supporting scripts to execute as CommonJS. In these situations, our `moduleTypes` option can override certain files to be CommonJS or ESM. Similar overriding is possible by using `.mts`, `.cts`, `.cjs` and `.mjs` file extensions. `moduleTypes` achieves the same effect for `.ts` and `.js` files, and *also* overrides your `tsconfig.json` `"module"` config appropriately. The following example tells ts-node to execute a webpack config as CommonJS: ```jsonc title="tsconfig.json" { "ts-node": { "transpileOnly": true, "moduleTypes": { "webpack.config.ts": "cjs", // Globs are also supported with the same behavior as tsconfig "include" "webpack-config-scripts/**/*": "cjs" } }, "compilerOptions": { "module": "es2020", "target": "es2020" } } ``` Each key is a glob pattern with the same syntax as tsconfig's `"include"` array. When multiple patterns match the same file, the last pattern takes precedence. * `cjs` overrides matches files to compile and execute as CommonJS. * `esm` overrides matches files to compile and execute as native ECMAScript modules. * `package` resets either of the above to default behavior, which obeys `package.json` `"type"` and `tsconfig.json` `"module"` options. ### Caveats Files with an overridden module type are transformed with the same limitations as [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules). This will only affect rare cases such as using `const enum`s with [`preserveConstEnums`](https://www.typescriptlang.org/tsconfig#preserveConstEnums) disabled. This feature is meant to facilitate scenarios where normal `compilerOptions` and `package.json` configuration is not possible. For example, a `webpack.config.ts` cannot be given its own `package.json` to override `"type"`. Wherever possible you should favor using traditional `package.json` and `tsconfig.json` configurations. ## API ts-node's complete API is documented here: [API Docs](https://typestrong.org/ts-node/api/) Here are a few highlights of what you can accomplish: * [`create()`](https://typestrong.org/ts-node/api/index.html#create) creates ts-node's compiler service without registering any hooks. * [`createRepl()`](https://typestrong.org/ts-node/api/index.html#createRepl) creates an instance of our REPL service, so you can create your own TypeScript-powered REPLs. * [`createEsmHooks()`](https://typestrong.org/ts-node/api/index.html#createEsmHooks) creates our ESM loader hooks, suitable for composing with other loaders or augmenting with additional features. # Recipes ## Watching and restarting ts-node focuses on adding first-class TypeScript support to node. Watching files and code reloads are out of scope for the project. If you want to restart the `ts-node` process on file change, existing node.js tools such as [nodemon](https://github.com/remy/nodemon), [onchange](https://github.com/Qard/onchange) and [node-dev](https://github.com/fgnass/node-dev) work. There's also [`ts-node-dev`](https://github.com/whitecolor/ts-node-dev), a modified version of [`node-dev`](https://github.com/fgnass/node-dev) using `ts-node` for compilation that will restart the process on file change. Note that `ts-node-dev` is incompatible with our native ESM loader. ## AVA Assuming you are configuring AVA via your `package.json`, add one of the following configurations. ### CommonJS Use this configuration if your `package.json` does not have `"type": "module"`. ```jsonc title="package.json" { "ava": { "extensions": [ "ts" ], "require": [ "ts-node/register" ] } } ``` ### Native ECMAScript modules This configuration is necessary if your `package.json` has `"type": "module"`. ```jsonc title="package.json" { "ava": { "extensions": { "ts": "module" }, "nonSemVerExperiments": { "configurableModuleFormat": true }, "nodeArguments": [ "--loader=ts-node/esm" ] } } ``` ## Gulp ts-node support is built-in to gulp. ```sh # Create a `gulpfile.ts` and run `gulp`. gulp ``` See also: https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles#transpilation ## IntelliJ and Webstorm Create a new Node.js configuration and add `-r ts-node/register` to "Node parameters." **Note:** If you are using the `--project ` command line argument as per the [Configuration Options](#configuration), and want to apply this same behavior when launching in IntelliJ, specify under "Environment Variables": `TS_NODE_PROJECT=`. ## Mocha ### Mocha 7 and newer ```shell mocha --require ts-node/register --extensions ts,tsx --watch --watch-files src 'tests/**/*.{ts,tsx}' [...args] ``` Or specify options via your mocha config file. ```jsonc title=".mocharc.json" { // Specify "require" for CommonJS "require": "ts-node/register", // Specify "loader" for native ESM "loader": "ts-node/esm", "extensions": ["ts", "tsx"], "spec": [ "tests/**/*.spec.*" ], "watch-files": [ "src" ] } ``` See also: https://mochajs.org/#configuring-mocha-nodejs ### Mocha <=6 ```shell mocha --require ts-node/register --watch-extensions ts,tsx "test/**/*.{ts,tsx}" [...args] ``` **Note:** `--watch-extensions` is only used in `--watch` mode. ## Tape ```shell ts-node node_modules/tape/bin/tape [...args] ``` ## Visual Studio Code Create a new Node.js debug configuration, add `-r ts-node/register` to node args and move the `program` to the `args` list (so VS Code doesn't look for `outFiles`). ```jsonc title=".vscode/launch.json" { "configurations": [{ "type": "node", "request": "launch", "name": "Launch Program", "runtimeArgs": [ "-r", "ts-node/register" ], "args": [ "${workspaceFolder}/src/index.ts" ] }], } ``` **Note:** If you are using the `--project ` command line argument as per the [Configuration Options](#configuration), and want to apply this same behavior when launching in VS Code, add an "env" key into the launch configuration: `"env": { "TS_NODE_PROJECT": "" }`. ## Other In many cases, setting [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) will enable `ts-node` within other node tools, child processes, and worker threads. ```shell NODE_OPTIONS="-r ts-node/register" ``` Or, if you require native ESM support: ```shell NODE_OPTIONS="--loader ts-node/esm" ``` This tells any node processes which receive this environment variable to install `ts-node`'s hooks before executing other code. # License ts-node is licensed under the MIT license. [MIT](https://github.com/TypeStrong/ts-node/blob/main/LICENSE) ts-node includes source code from Node.js which is licensed under the MIT license. [Node.js license information](https://raw.githubusercontent.com/nodejs/node/master/LICENSE) ts-node includes source code from the TypeScript compiler which is licensed under the Apache License 2.0. [TypeScript license information](https://github.com/microsoft/TypeScript/blob/master/LICENSE.txt) ts-node-10.9.2/SECURITY.md000066400000000000000000000001501453460306300147450ustar00rootroot00000000000000# Security Policy ## Reporting a Vulnerability Please report security issues to `cspotcode@gmail.com` ts-node-10.9.2/api-extractor.json000066400000000000000000000337361453460306300166510ustar00rootroot00000000000000/** * Config file for API Extractor. For more info, please visit: https://api-extractor.com */ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", /** * Optionally specifies another JSON config file that this file extends from. This provides a way for * standard settings to be shared across multiple projects. * * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be * resolved using NodeJS require(). * * SUPPORTED TOKENS: none * DEFAULT VALUE: "" */ // "extends": "./shared/api-extractor-base.json" // "extends": "my-package/include/api-extractor-base.json" /** * Determines the "" token that can be used with other config file settings. The project folder * typically contains the tsconfig.json and package.json config files, but the path is user-defined. * * The path is resolved relative to the folder of the config file that contains the setting. * * The default value for "projectFolder" is the token "", which means the folder is determined by traversing * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error * will be reported. * * SUPPORTED TOKENS: * DEFAULT VALUE: "" */ // "projectFolder": "..", /** * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor * analyzes the symbols exported by this module. * * The file extension must be ".d.ts" and not ".ts". * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , */ "mainEntryPointFilePath": "/dist/index.d.ts", /** * A list of NPM package names whose exports should be treated as part of this package. * * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly * imports library2. To avoid this, we can specify: * * "bundledPackages": [ "library2" ], * * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been * local files for library1. */ "bundledPackages": [], /** * Determines how the TypeScript compiler engine will be invoked by API Extractor. */ "compiler": { /** * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * Note: This setting will be ignored if "overrideTsconfig" is used. * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "/tsconfig.json" */ // "tsconfigFilePath": "/tsconfig.json", /** * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. * The object must conform to the TypeScript tsconfig schema: * * http://json.schemastore.org/tsconfig * * If omitted, then the tsconfig.json file will be read from the "projectFolder". * * DEFAULT VALUE: no overrideTsconfig section */ // "overrideTsconfig": { // . . . // } /** * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. * * DEFAULT VALUE: false */ // "skipLibCheck": true, }, /** * Configures how the API report file (*.api.md) will be generated. */ "apiReport": { /** * (REQUIRED) Whether to generate an API report. */ "enabled": true, /** * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce * a full file path. * * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". * * SUPPORTED TOKENS: , * DEFAULT VALUE: ".api.md" */ "reportFileName": ".api.md", /** * Specifies the folder where the API report file is written. The file name portion is determined by * the "reportFileName" setting. * * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, * e.g. for an API review. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "/etc/" */ "reportFolder": "/api-extractor/" /** * Specifies the folder where the temporary report file is written. The file name portion is determined by * the "reportFileName" setting. * * After the temporary file is written to disk, it is compared with the file in the "reportFolder". * If they are different, a production build will fail. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "/temp/" */ // "reportTempFolder": "/temp/" }, /** * Configures how the doc model file (*.api.json) will be generated. */ "docModel": { /** * (REQUIRED) Whether to generate a doc model file. */ "enabled": false /** * The output path for the doc model file. The file extension should be ".api.json". * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "/temp/.api.json" */ // "apiJsonFilePath": "/temp/.api.json" }, /** * Configures how the .d.ts rollup file will be generated. */ "dtsRollup": { /** * (REQUIRED) Whether to generate the .d.ts rollup file. */ "enabled": false /** * Specifies the output path for a .d.ts rollup file to be generated without any trimming. * This file will include all declarations that are exported by the main entry point. * * If the path is an empty string, then this file will not be written. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "/dist/.d.ts" */ // "untrimmedFilePath": "/dist/.d.ts", /** * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. * This file will include only declarations that are marked as "@public" or "@beta". * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "" */ // "betaTrimmedFilePath": "/dist/-beta.d.ts", /** * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. * This file will include only declarations that are marked as "@public". * * If the path is an empty string, then this file will not be written. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "" */ // "publicTrimmedFilePath": "/dist/-public.d.ts", /** * When a declaration is trimmed, by default it will be replaced by a code comment such as * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the * declaration completely. * * DEFAULT VALUE: false */ // "omitTrimmingComments": true }, /** * Configures how the tsdoc-metadata.json file will be generated. */ "tsdocMetadata": { /** * Whether to generate the tsdoc-metadata.json file. * * DEFAULT VALUE: true */ "enabled": false /** * Specifies where the TSDoc metadata file should be written. * * The path is resolved relative to the folder of the config file that contains the setting; to change this, * prepend a folder token such as "". * * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup * falls back to "tsdoc-metadata.json" in the package folder. * * SUPPORTED TOKENS: , , * DEFAULT VALUE: "" */ // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" }, /** * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. * To use the OS's default newline kind, specify "os". * * DEFAULT VALUE: "crlf" */ "newlineKind": "lf", /** * Configures how API Extractor reports error and warning messages produced during analysis. * * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. */ "messages": { /** * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing * the input .d.ts files. * * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" * * DEFAULT VALUE: A single "default" entry with logLevel=warning. */ "compilerMessageReporting": { /** * Configures the default routing for messages that don't match an explicit rule in this table. */ "default": { /** * Specifies whether the message should be written to the the tool's output log. Note that * the "addToApiReportFile" property may supersede this option. * * Possible values: "error", "warning", "none" * * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes * the "--local" option), the warning is displayed but the build will not fail. * * DEFAULT VALUE: "warning" */ "logLevel": "warning", /** * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), * then the message will be written inside that file; otherwise, the message is instead logged according to * the "logLevel" option. * * DEFAULT VALUE: false */ "addToApiReportFile": true }, // "TS2551": { // "logLevel": "warning", // "addToApiReportFile": true // }, // // . . . }, /** * Configures handling of messages reported by API Extractor during its analysis. * * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" * * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings */ "extractorMessageReporting": { "default": { "logLevel": "warning", "addToApiReportFile": true }, "ae-missing-release-tag": { "logLevel": "none" } // "ae-extra-release-tag": { // "logLevel": "warning", // "addToApiReportFile": true // }, // // . . . }, /** * Configures handling of messages reported by the TSDoc parser when analyzing code comments. * * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" * * DEFAULT VALUE: A single "default" entry with logLevel=warning. */ "tsdocMessageReporting": { "default": { "logLevel": "warning" // "addToApiReportFile": false } // "tsdoc-link-tag-unescaped-text": { // "logLevel": "warning", // "addToApiReportFile": true // }, // // . . . } } } ts-node-10.9.2/api-extractor/000077500000000000000000000000001453460306300157425ustar00rootroot00000000000000ts-node-10.9.2/api-extractor/ts-node.api.md000066400000000000000000000264271453460306300204200ustar00rootroot00000000000000## API Report File for "ts-node" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts /// import { BaseError } from 'make-error'; import type * as _ts from 'typescript'; // @public export function create(rawOptions?: CreateOptions): Service; // Warning: (ae-forgotten-export) The symbol "createEsmHooks" needs to be exported by the entry point index.d.ts // // @public export const createEsmHooks: typeof createEsmHooks_2; // @public export interface CreateOptions { compiler?: string; compilerHost?: boolean; compilerOptions?: object; cwd?: string; // @deprecated dir?: string; emit?: boolean; esm?: boolean; experimentalReplAwait?: boolean; experimentalSpecifierResolution?: 'node' | 'explicit'; experimentalTsImportSpecifiers?: boolean; // (undocumented) fileExists?: (path: string) => boolean; files?: boolean; ignore?: string[]; ignoreDiagnostics?: Array; logError?: boolean; moduleTypes?: ModuleTypes; preferTsExts?: boolean; pretty?: boolean; project?: string; projectSearchDir?: string; // (undocumented) readFile?: (path: string) => string | undefined; require?: Array; scope?: boolean; // (undocumented) scopeDir?: string; skipIgnore?: boolean; skipProject?: boolean; swc?: boolean; // (undocumented) transformers?: _ts.CustomTransformers | ((p: _ts.Program) => _ts.CustomTransformers); transpileOnly?: boolean; transpiler?: string | [string, object]; tsTrace?: (str: string) => void; typeCheck?: boolean; } // @public export function createRepl(options?: CreateReplOptions): ReplService; // @public export interface CreateReplOptions { // (undocumented) service?: Service; // Warning: (ae-forgotten-export) The symbol "EvalState" needs to be exported by the entry point index.d.ts // // (undocumented) state?: EvalState; // (undocumented) stderr?: NodeJS.WritableStream; // (undocumented) stdin?: NodeJS.ReadableStream; // (undocumented) stdout?: NodeJS.WritableStream; } // @public export interface CreateTranspilerOptions { // (undocumented) service: Pick>; } // @public export type EvalAwarePartialHost = Pick; // @public (undocumented) export type ExperimentalSpecifierResolution = 'node' | 'explicit'; // @public (undocumented) export type ModuleTypeOverride = 'cjs' | 'esm' | 'package'; // @public (undocumented) export type ModuleTypes = Record; // @public (undocumented) export interface NodeLoaderHooksAPI1 { // (undocumented) getFormat: NodeLoaderHooksAPI1.GetFormatHook; // (undocumented) resolve: NodeLoaderHooksAPI1.ResolveHook; // (undocumented) transformSource: NodeLoaderHooksAPI1.TransformSourceHook; } // @public (undocumented) export namespace NodeLoaderHooksAPI1 { // (undocumented) export type GetFormatHook = (url: string, context: {}, defaultGetFormat: GetFormatHook) => Promise<{ format: NodeLoaderHooksFormat; }>; // (undocumented) export type ResolveHook = NodeLoaderHooksAPI2.ResolveHook; // (undocumented) export type TransformSourceHook = (source: string | Buffer, context: { url: string; format: NodeLoaderHooksFormat; }, defaultTransformSource: NodeLoaderHooksAPI1.TransformSourceHook) => Promise<{ source: string | Buffer; }>; } // @public (undocumented) export interface NodeLoaderHooksAPI2 { // (undocumented) load: NodeLoaderHooksAPI2.LoadHook; // (undocumented) resolve: NodeLoaderHooksAPI2.ResolveHook; } // @public (undocumented) export namespace NodeLoaderHooksAPI2 { // (undocumented) export type LoadHook = (url: string, context: { format: NodeLoaderHooksFormat | null | undefined; importAssertions?: NodeImportAssertions; }, defaultLoad: NodeLoaderHooksAPI2['load']) => Promise<{ format: NodeLoaderHooksFormat; source: string | Buffer | undefined; shortCircuit?: boolean; }>; // (undocumented) export interface NodeImportAssertions { // (undocumented) type?: 'json'; } // (undocumented) export type NodeImportConditions = unknown; // (undocumented) export type ResolveHook = (specifier: string, context: { conditions?: NodeImportConditions; importAssertions?: NodeImportAssertions; parentURL: string; }, defaultResolve: ResolveHook) => Promise<{ url: string; format?: NodeLoaderHooksFormat; shortCircuit?: boolean; }>; } // @public (undocumented) export type NodeLoaderHooksFormat = 'builtin' | 'commonjs' | 'dynamic' | 'json' | 'module' | 'wasm'; // @public export type NodeModuleEmitKind = 'nodeesm' | 'nodecjs'; // @public @deprecated export type Register = Service; // @public export function register(opts?: RegisterOptions): Service; // @public export function register(service: Service): Service; // @public export const REGISTER_INSTANCE: unique symbol; // @public export interface RegisterOptions extends CreateOptions { experimentalResolver?: boolean; } // @public (undocumented) export interface ReplService { // (undocumented) evalAwarePartialHost: EvalAwarePartialHost; evalCode(code: string): any; nodeEval(code: string, context: any, _filename: string, callback: (err: Error | null, result?: any) => any): void; setService(service: Service): void; start(): void; // @deprecated start(code: string): void; // (undocumented) readonly state: EvalState; } // @public export interface Service { // (undocumented) compile(code: string, fileName: string, lineOffset?: number): string; // (undocumented) config: _ts.ParsedCommandLine; // (undocumented) enabled(enabled?: boolean): boolean; // (undocumented) getTypeInfo(code: string, fileName: string, position: number): TypeInfo; // (undocumented) ignored(fileName: string): boolean; // (undocumented) options: RegisterOptions; // (undocumented) ts: TSCommon; } // @public export interface TranspileOptions { // (undocumented) fileName: string; } // @public export interface TranspileOutput { // (undocumented) diagnostics?: _ts.Diagnostic[]; // (undocumented) outputText: string; // (undocumented) sourceMapText?: string; } // @public export interface Transpiler { // (undocumented) transpile(input: string, options: TranspileOptions): TranspileOutput; } // @public export type TranspilerFactory = (options: CreateTranspilerOptions) => Transpiler; // @public export interface TranspilerModule { // (undocumented) create: TranspilerFactory; } // @public export interface TSCommon { // (undocumented) createDocumentRegistry: typeof _ts.createDocumentRegistry; // (undocumented) createEmitAndSemanticDiagnosticsBuilderProgram: typeof _ts.createEmitAndSemanticDiagnosticsBuilderProgram; // (undocumented) createIncrementalCompilerHost: typeof _ts.createIncrementalCompilerHost; // (undocumented) createIncrementalProgram: typeof _ts.createIncrementalProgram; // (undocumented) createLanguageService: typeof _ts.createLanguageService; // (undocumented) createModuleResolutionCache: typeof _ts.createModuleResolutionCache; // (undocumented) createSourceFile: typeof _ts.createSourceFile; // (undocumented) displayPartsToString: typeof _ts.displayPartsToString; // (undocumented) Extension: typeof _ts.Extension; // (undocumented) findConfigFile: typeof _ts.findConfigFile; // (undocumented) flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText; // (undocumented) formatDiagnostics: typeof _ts.formatDiagnostics; // (undocumented) formatDiagnosticsWithColorAndContext: typeof _ts.formatDiagnosticsWithColorAndContext; // (undocumented) getDefaultLibFileName: typeof _ts.getDefaultLibFileName; // (undocumented) getDefaultLibFilePath: typeof _ts.getDefaultLibFilePath; // (undocumented) getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics; // (undocumented) JsxEmit: typeof _ts.JsxEmit; // (undocumented) ModuleKind: TSCommon.ModuleKindEnum; // (undocumented) ModuleResolutionKind: typeof _ts.ModuleResolutionKind; // (undocumented) parseJsonConfigFileContent: typeof _ts.parseJsonConfigFileContent; // (undocumented) readConfigFile: typeof _ts.readConfigFile; // (undocumented) resolveModuleName: typeof _ts.resolveModuleName; // (undocumented) resolveModuleNameFromCache: typeof _ts.resolveModuleNameFromCache; // (undocumented) resolveTypeReferenceDirective: typeof _ts.resolveTypeReferenceDirective; // (undocumented) ScriptSnapshot: typeof _ts.ScriptSnapshot; // (undocumented) ScriptTarget: typeof _ts.ScriptTarget; // (undocumented) sys: typeof _ts.sys; // (undocumented) transpileModule: typeof _ts.transpileModule; // (undocumented) version: typeof _ts.version; } // @public (undocumented) export namespace TSCommon { // (undocumented) export type CompilerOptions = _ts.CompilerOptions; // (undocumented) export type FileReference = _ts.FileReference; // (undocumented) export interface LanguageServiceHost extends _ts.LanguageServiceHost { } // (undocumented) export namespace ModuleKind { // (undocumented) export type CommonJS = _ts.ModuleKind.CommonJS; // (undocumented) export type ESNext = _ts.ModuleKind.ESNext; } // (undocumented) export type ModuleKindEnum = typeof _ts.ModuleKind & { Node16: typeof _ts.ModuleKind extends { Node16: any; } ? typeof _ts.ModuleKind['Node16'] : 100; }; // (undocumented) export type ModuleResolutionHost = _ts.ModuleResolutionHost; // (undocumented) export type ParsedCommandLine = _ts.ParsedCommandLine; // (undocumented) export type ResolvedModule = _ts.ResolvedModule; // (undocumented) export type ResolvedModuleWithFailedLookupLocations = _ts.ResolvedModuleWithFailedLookupLocations; // (undocumented) export type ResolvedProjectReference = _ts.ResolvedProjectReference; // (undocumented) export type ResolvedTypeReferenceDirective = _ts.ResolvedTypeReferenceDirective; // (undocumented) export type SourceFile = _ts.SourceFile; } // @public export interface TsConfigOptions extends Omit { } // @public export class TSError extends BaseError { constructor(diagnosticText: string, diagnosticCodes: number[], diagnostics?: ReadonlyArray<_ts.Diagnostic>); // (undocumented) diagnosticCodes: number[]; // (undocumented) diagnostics: ReadonlyArray<_ts.Diagnostic>; // (undocumented) diagnosticText: string; // (undocumented) name: string; } // @public export interface TypeInfo { // (undocumented) comment: string; // (undocumented) name: string; } // @public export const VERSION: any; // (No @packageDocumentation comment for this package) ``` ts-node-10.9.2/ava.config.cjs000066400000000000000000000046671453460306300157110ustar00rootroot00000000000000const expect = require('expect'); const semver = require('semver'); const { createRequire } = require('module'); module.exports = { files: ['dist/test/**/*.spec.js'], failWithoutAssertions: false, environmentVariables: { ts_node_install_lock: `id-${Math.floor(Math.random() * 10e9)}`, // Force jest expect() errors to generate colorized strings, makes output more readable. // Delete the env var within ava processes via `require` option below. // This avoids passing it to spawned processes under test, which would negatively affect // their behavior. FORCE_COLOR: '3', NODE_PATH: '' }, require: ['./src/test/remove-env-var-force-color.js'], nodeArguments: semver.gte(process.version, '14.0.0') ? ['--loader', './src/test/test-loader.mjs', '--no-warnings'] : [], timeout: '300s', concurrency: 1, }; { /* * Tests *must* install and use our most recent ts-node tarball. * We must prevent them from accidentally require-ing a different version of * ts-node, from either node_modules or tests/node_modules. * * Another possibility of interference is NODE_PATH environment variable being set, * and ts-node being installed in any of the paths listed on NODE_PATH, to fix this, * the NODE_PATH variable must be removed from the environment *BEFORE* running ava. * An error will be thrown when trying to run tests with NODE_PATH set to paths with ts-node installed. */ const { existsSync, rmSync } = require('fs'); const rimraf = require('rimraf'); const { resolve } = require('path'); remove(resolve(__dirname, 'node_modules/ts-node')); remove(resolve(__dirname, 'tests/node_modules/ts-node')); // Prove that we did it correctly (() => { let resolved; try { resolved = createRequire(resolve(__dirname, 'tests/foo.js')).resolve('ts-node'); } catch(err) {return} // require.resolve() found ts-node; this should not happen. let errorMessage = `require.resolve('ts-node') unexpectedly resolved to ${resolved}\n`; // Check for NODE_PATH interference. See comments above. if(process.env.NODE_PATH) { errorMessage += `NODE_PATH environment variable is set. This test suite does not support running with NODE_PATH. Unset it before running the tests.`; } throw new Error(errorMessage); })(); function remove(p) { // Avoid node deprecation warning triggered by rimraf if(existsSync(p)) (rmSync || rimraf.sync)(p, {recursive: true}) } } ts-node-10.9.2/child-loader.mjs000066400000000000000000000005741453460306300162300ustar00rootroot00000000000000import { fileURLToPath } from 'url'; import { createRequire } from 'module'; const require = createRequire(fileURLToPath(import.meta.url)); // TODO why use require() here? I think we can just `import` /** @type {import('./dist/child-loader')} */ const childLoader = require('./dist/child/child-loader'); export const { resolve, load, getFormat, transformSource } = childLoader; ts-node-10.9.2/codecov.yml000066400000000000000000000010151453460306300153220ustar00rootroot00000000000000fixes: # Remap from npm-installed ts-node to root of project # This can take the place of ./scripts/rewrite-coverage-paths.js - "tests/node_modules/ts-node/::" coverage: status: patch: default: # Do not fail when `patch` coverage is low. When this fails, it is misleading and not necessarily bad. # For example if a patch changes 2 lines, and only one is covered, then patch coverage is 50%. target: 0% project: default: threshold: 1% comment: layout: "files" ts-node-10.9.2/development-docs/000077500000000000000000000000001453460306300164305ustar00rootroot00000000000000ts-node-10.9.2/development-docs/README.md000066400000000000000000000004461453460306300177130ustar00rootroot00000000000000This directory contains a variety of documents: - notes - old to-do lists - design ideas from when I implemented various features - templates for drafting release notes - etc It is useful to me to keep these notes. If you find their presence confusing, you can safely ignore this directory. ts-node-10.9.2/development-docs/isExternalLibraryImport.md000066400000000000000000000056131453460306300236150ustar00rootroot00000000000000## How we override isExternalLibraryImport `isExternalLibraryImport` is a boolean returned by node's module resolver that is `true` if the target module is inside a `node_modules` directory. This has 2x effects inside the compiler: a) compiler refuses to emit JS for external modules b) increments node_module depth +1, which affects `maxNodeModulesJsDepth` If someone `require()`s a file inside `node_modules`, we need to override this flag to overcome (a). ### ts-node's behavior - If TS's normal resolution deems a file is external, we might override this flag. - Is file's containing module directory marked as "must be internal"? - if yes, override as "internal" - if no, track this flag, and leave it as "external" When you try to `require()` a file that's previously been deemed "external", we mark the entire module's directory as "must be internal" and add the file to `rootFiles` to trigger a re-resolve. When you try to `require()` a file that's totally unknown to the compiler, we have to add it to `rootFiles` to trigger a recompile. This is a separate issue. ### Implementation notes In `updateMemoryCache`: - If file is not in rootFiles and is not known internal (either was never resolved or was resolved external) - mark module directory as "must be internal" - add file to rootFiles to either pull file into compilation or trigger re-resolve (will do both) TODO: WHAT IF WE MUST MARK FILEA INTERNAL; WILL FILEB AUTOMATICALLY GET THE SAME TREATMENT? TODO if `noResolve`, force adding to `rootFileNames`? TODO if `noResolve` are the resolvers called anyway? TODO eagerly classify .ts as internal, only use the "bucket" behavior for .js? - b/c externalModule and maxNodeModulesJsDepth only seems to affect typechecking of .js, not .ts ### Tests require() .ts file where TS didn't know about it before require() .js file where TS didn't know about it before, w/allowJs import {} ./node_modules/*/.ts import {} ./node_modules/*/.js w/allowJs (initially external; will be switched to internal) import {} ./node_modules/*/.ts from another file within node_modules import {} ./node_modules/*/.js from another file within node_modules require() from ./node_modules when it is ignored; ensure is not forced internal and maxNodeModulesJsDepth is respected (type info does not change) ### Keywords for searching TypeScript's source code These may jog my memory the next time I need to read TypeScript's source and remember how this works. currentNodeModulesDepth sourceFilesFoundSearchingNodeModules isExternalLibraryImport is used to increment currentNodeModulesDepth currentNodeModulesDepth is used to put things into sourceFilesFoundSearchingNodeModules https://github.com/microsoft/TypeScript/blob/ec338146166935069124572135119b57a3d2cd22/src/compiler/program.ts#L2384-L2398 getSourceFilesToEmit / sourceFileMayBeEmitted obeys internal "external" state, is responsible for preventing emit of external modules ts-node-10.9.2/development-docs/nodenextNode16.md000066400000000000000000000027231453460306300215570ustar00rootroot00000000000000# Adding support for NodeNext, Node16, `.cts`, `.mts`, `.cjs`, `.mjs` *This feature has already been implemented. Here are my notes from when I was doing the work* ## TODOs Implement node module type classifier: - if NodeNext or Node12: ask classifier for CJS or ESM determination Add `ForceNodeNextCJSEmit` Does our code check for .d.ts extensions anywhere? - if so, teach it about .d.cts and .d.mts For nodenext and node12, support supplemental "flavor" information: - Think about splitting out index.ts further: - register.ts - hooking stuff - types.ts - env.ts - env vars and global registration types (process.symbol) - service.ts # TESTS Matrix: - package.json type absent, commonjs, and module - import and require - from cjs and esm - .cts, .cjs - .mts, .mjs - typechecking, transpileOnly, and swc - dynamic import - import = require - static import - allowJs on and off Notes about specific matrix entries: - require mjs, mts from cjs throws error Rethink: `getOutput`: null in transpile-only mode. Also may return emitskipped `getOutputTranspileOnly`: configured module option `getOutputForceCommonJS`: `commonjs` module option `getOutputForceNodeCommonJS`: `nodenext` cjs module option `getOutputForceESM`: `esnext` module option Add second layer of classification to classifier: if classifier returns `auto` (no `moduleType` override) - if `getOutput` emits, done - else call `nodeModuleTypeClassifier` - delegate to appropriate `getOutput` based on its response ts-node-10.9.2/development-docs/release-template.md000066400000000000000000000033041453460306300222030ustar00rootroot00000000000000## Template to be copy-pasted as a template for new release notes. --- Questions about this release? Ask in the official discussion thread: #TODO *Breaking changes are prefixed with **[BREAKING]*** **Added** - Adds description of thing added (#Issue, #PR, #etc) @contributor-name - Optionally add details ([docs](link to docs)) - Or multiple docs links ([CLI docs](link to docusaurus page), [API docs](link to typedoc page)) **Changed** - **[BREAKING]** Make yadda yadda... **Deprecated** **Removed** **Fixed** - Fix #TODO: Description of fix (#Issue, #PR, #etc) **Docs** - In the past I've documented major improvements to docs, new docsite, new docs sections about confusing bits - In general should avoid changelog entries that do not affect ts-node consumers **Misc** - In the past I've documented improvements to testing, codecov, etc. - In general should avoid changelog entries that do not affect ts-node consumers https://github.com/TypeStrong/ts-node/compare/vTODO...vTODO https://github.com/TypeStrong/ts-node/milestone/TODO --- ## Discussion thread template --- Discussion thread for the vTODO release. [Release notes](https://github.com/TypeStrong/ts-node/releases/tag/vTODO) ts-node-10.9.2/development-docs/repl-api.md000066400000000000000000000013541453460306300204660ustar00rootroot00000000000000## How to create your own ts-node powered REPL - Create ts-node REPL service which includes EvalState - Create ts-node compiler service using EvalState-aware `readFile` and `fileExists` implementations from REPL - Bind REPL service to compiler service (chicken-and-egg problem necessitates late binding) - Either: - call REPL method start() to start a REPL - create your own node repl but pass it REPL service's nodeEval() function ``` import * as tsnode from 'ts-node'; const repl = tsnode.createRepl(); const service = tsnode.register({ ... options, ...repl.evalAwarePartialHost }); repl.setService(service); // Start it repl.start(); // or const nodeRepl = require('repl').start({ ...options, eval: repl.nodeEval }); ``` ts-node-10.9.2/development-docs/rootDirOutDirMapping.md000066400000000000000000000014261453460306300230420ustar00rootroot00000000000000## Musings about resolving between rootDir and outDir When /dist and /src are understood to be overlaid because of src -> dist compiling /dist/ /src/ Loop over require.extensions /src/foo.js /src/foo.mjs /src/foo.cjs /src/foo.ts /src/foo.mts /src/foo.cts /src/foo/index.js /src/foo/index.mjs /src/foo/index.ts // Where do we check package.json main?? /dist/foo.js /dist/foo.ts _resolveLookupPaths _findPath _resolveFilename _findPath calls resolveExports calls packageExportsResolve, which is in the ESM loader Is anything within packageExportsResolve hooked/modified by us? File extension swapping? When resolver calls statSync('./dist/foo.js') and we intercept and discover './src/foo.ts' How to redirect? We need to rewrite whatever local variable is storing `./dist/foo.js` ts-node-10.9.2/development-docs/yarnPnpInterop.md000066400000000000000000000033571453460306300217520ustar00rootroot00000000000000## Yarn PnP interop Asked about it here: https://discord.com/channels/226791405589233664/654372321225605128/957301175609344070 PnP API checks if import specifiers are for dependencies: non-relative, non-absolute libfoo @scope/libfoo When they are, it does `resolveToUnqualified` to map to an unqualified path. This path points to the module's location on disk (in a zip, perhaps) but does not handle file extension resolution or stuff like that. To interop with PnP, we need PnP to *only* `resolveToUnqualified`. We do everything else. ```typescript import { Module } from 'module'; import fs from 'fs'; const pathRegExp = /^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:@[^/]+\/)?[^/]+)\/*(.*|)$/; const originalModuleResolveFilename = Module._resolveFilename; Module._resolveFilename = function ( request: string, parent: typeof Module | null | undefined, isMain: boolean, options?: { [key: string]: any } ) { const dependencyNameMatch = request.match(pathRegExp); if (dependencyNameMatch !== null) { const [, dependencyName, subPath] = dependencyNameMatch; const unqualified = pnpapi.resolveToUnqualified(....); // Do your modified resolution on the unqualified path here } else { // Do your modified resolution here; no need for PnP } }; ``` PnP can be installed at runtime. To conditionally check if PnP is available at the start of *every* resolution: ```typescript // Get the pnpapi of either the issuer or the specifier. // The latter is required when the specifier is an absolute path to a // zip file and the issuer doesn't belong to a pnpapi const {findPnPApi} = Module; const pnpapi = findPnPApi ? (findPnpApi(issuer) ?? (url ? findPnpApi(specifier) : null)) : null; if (pnpapi) {...} ``` ts-node-10.9.2/dist-raw/000077500000000000000000000000001453460306300147125ustar00rootroot00000000000000ts-node-10.9.2/dist-raw/NODE-LICENSE.md000066400000000000000000000022201453460306300170350ustar00rootroot00000000000000This directory contains portions of Node.js source code which is licensed as follows: --- Copyright Joyent, Inc. and other Node contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ts-node-10.9.2/dist-raw/README.md000066400000000000000000000035551453460306300162010ustar00rootroot00000000000000The `dist-raw` directory contains JS sources that are distributed verbatim, not compiled nor typechecked via TS. To implement ESM support, we unfortunately must duplicate some of node's built-in functionality that is not exposed via an API. We have copy-pasted the necessary code from https://github.com/nodejs/node/tree/master/lib then modified it to suite our needs. Formatting may be intentionally bad to keep the diff as small as possible, to make it easier to merge upstream changes and understand our modifications. For example, when we need to wrap node's source code in a factory function, we will not indent the function body, to avoid whitespace changes in the diff. One obvious problem with this approach: the code has been pulled from one version of node, whereas users of ts-node run multiple versions of node. Users running node 12 may see that ts-node behaves like node 14, for example. ## `raw` directory Within the `raw` directory, we keep unmodified copies of the node source files. This allows us to use diffing tools to compare files in `raw` to those in `dist-raw`, which will highlight all of the changes we have made. Hopefully, these changes are as minimal as possible. ## Naming convention Not used consistently, but the idea is: `node-(...-)-.js` `node-internal-errors.js` -> `github.com/nodejs/node/blob/TAG/lib/internal/errors.js` So, take the path within node's `lib/` directory, and replace slashes with hyphens. In the `raw` directory, files are suffixed with the version number or revision from which they were downloaded. If they have a `stripped` suffix, this means they have large chunks of code deleted, but no other modifications. This is useful when diffing. Sometimes our `dist-raw` files only have a small part of a much larger node source file. It is easier to diff `raw/*-stripped.js` against `dist-raw/*.js`. ts-node-10.9.2/dist-raw/node-internal-constants.js000066400000000000000000000002141453460306300220160ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/master/lib/internal/constants.js module.exports = { CHAR_FORWARD_SLASH: 47, /* / */ }; ts-node-10.9.2/dist-raw/node-internal-errors.js000066400000000000000000000074441453460306300213320ustar00rootroot00000000000000'use strict'; const path = require('path'); exports.codes = { ERR_INPUT_TYPE_NOT_ALLOWED: createErrorCtor(joinArgs('ERR_INPUT_TYPE_NOT_ALLOWED')), ERR_INVALID_ARG_VALUE: createErrorCtor(joinArgs('ERR_INVALID_ARG_VALUE')), ERR_INVALID_MODULE_SPECIFIER: createErrorCtor(joinArgs('ERR_INVALID_MODULE_SPECIFIER')), ERR_INVALID_PACKAGE_CONFIG: createErrorCtor(joinArgs('ERR_INVALID_PACKAGE_CONFIG')), ERR_INVALID_PACKAGE_TARGET: createErrorCtor(joinArgs('ERR_INVALID_PACKAGE_TARGET')), ERR_MANIFEST_DEPENDENCY_MISSING: createErrorCtor(joinArgs('ERR_MANIFEST_DEPENDENCY_MISSING')), ERR_MODULE_NOT_FOUND: createErrorCtor((path, base, type = 'package') => { return `Cannot find ${type} '${path}' imported from ${base}` }), ERR_PACKAGE_IMPORT_NOT_DEFINED: createErrorCtor(joinArgs('ERR_PACKAGE_IMPORT_NOT_DEFINED')), ERR_PACKAGE_PATH_NOT_EXPORTED: createErrorCtor(joinArgs('ERR_PACKAGE_PATH_NOT_EXPORTED')), ERR_UNSUPPORTED_DIR_IMPORT: createErrorCtor(joinArgs('ERR_UNSUPPORTED_DIR_IMPORT')), ERR_UNSUPPORTED_ESM_URL_SCHEME: createErrorCtor(joinArgs('ERR_UNSUPPORTED_ESM_URL_SCHEME')), ERR_UNKNOWN_FILE_EXTENSION: createErrorCtor(joinArgs('ERR_UNKNOWN_FILE_EXTENSION')), } function joinArgs(name) { return (...args) => { return [name, ...args].join(' ') } } function createErrorCtor(errorMessageCreator) { return class CustomError extends Error { constructor(...args) { super(errorMessageCreator(...args)) } } } exports.createErrRequireEsm = createErrRequireEsm; // Native ERR_REQUIRE_ESM Error is declared here: // https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/errors.js#L1294-L1313 // Error class factory is implemented here: // function E: https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/errors.js#L323-L341 // function makeNodeErrorWithCode: https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/errors.js#L251-L278 // The code below should create an error that matches the native error as closely as possible. // Third-party libraries which attempt to catch the native ERR_REQUIRE_ESM should recognize our imitation error. function createErrRequireEsm(filename, parentPath, packageJsonPath) { const code = 'ERR_REQUIRE_ESM' const err = new Error(getErrRequireEsmMessage(filename, parentPath, packageJsonPath)) // Set `name` to be used in stack trace, generate stack trace with that name baked in, then re-declare the `name` field. // This trick is copied from node's source. err.name = `Error [${ code }]` err.stack Object.defineProperty(err, 'name', { value: 'Error', enumerable: false, writable: true, configurable: true }) err.code = code return err } // Copy-pasted from https://github.com/nodejs/node/blob/b533fb3508009e5f567cc776daba8fbf665386a6/lib/internal/errors.js#L1293-L1311 // so that our error message is identical to the native message. function getErrRequireEsmMessage(filename, parentPath = null, packageJsonPath = null) { const ext = path.extname(filename) let msg = `Must use import to load ES Module: ${filename}`; if (parentPath && packageJsonPath) { const path = require('path'); const basename = path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + `is an ES module file as it is a ${ext} file whose nearest parent ` + `package.json contains "type": "module" which defines all ${ext} ` + 'files in that package scope as ES modules.\nInstead ' + 'change the requiring code to use ' + 'import(), or remove "type": "module" from ' + `${packageJsonPath}.\n`; return msg; } return msg; } ts-node-10.9.2/dist-raw/node-internal-modules-cjs-helpers.js000066400000000000000000000052631453460306300237000ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.1/lib/internal/modules/cjs/helpers.js 'use strict'; const { ArrayPrototypeForEach, ObjectDefineProperty, ObjectPrototypeHasOwnProperty, SafeSet, StringPrototypeIncludes, StringPrototypeStartsWith, } = require('./node-primordials'); const { getOptionValue } = require('./node-options'); const userConditions = getOptionValue('--conditions'); const noAddons = getOptionValue('--no-addons'); const addonConditions = noAddons ? [] : ['node-addons']; // TODO: Use this set when resolving pkg#exports conditions in loader.js. const cjsConditions = new SafeSet([ 'require', 'node', ...addonConditions, ...userConditions, ]); /** * @param {any} object * @param {string} [dummyModuleName] * @return {void} */ function addBuiltinLibsToObject(object, dummyModuleName) { // Make built-in modules available directly (loaded lazily). const Module = require('module').Module; const { builtinModules } = Module; // To require built-in modules in user-land and ignore modules whose // `canBeRequiredByUsers` is false. So we create a dummy module object and not // use `require()` directly. const dummyModule = new Module(dummyModuleName); ArrayPrototypeForEach(builtinModules, (name) => { // Neither add underscored modules, nor ones that contain slashes (e.g., // 'fs/promises') or ones that are already defined. if (StringPrototypeStartsWith(name, '_') || StringPrototypeIncludes(name, '/') || ObjectPrototypeHasOwnProperty(object, name)) { return; } // Goals of this mechanism are: // - Lazy loading of built-in modules // - Having all built-in modules available as non-enumerable properties // - Allowing the user to re-assign these variables as if there were no // pre-existing globals with the same name. const setReal = (val) => { // Deleting the property before re-assigning it disables the // getter/setter mechanism. delete object[name]; object[name] = val; }; ObjectDefineProperty(object, name, { get: () => { // Node 12 hack; remove when we drop node12 support const lib = (dummyModule.require || require)(name); // Disable the current getter/setter and set up a new // non-enumerable property. delete object[name]; ObjectDefineProperty(object, name, { get: () => lib, set: setReal, configurable: true, enumerable: false }); return lib; }, set: setReal, configurable: true, enumerable: false }); }); } exports.addBuiltinLibsToObject = addBuiltinLibsToObject; exports.cjsConditions = cjsConditions; ts-node-10.9.2/dist-raw/node-internal-modules-cjs-loader.js000066400000000000000000000454241453460306300235070ustar00rootroot00000000000000// Copied from several files in node's source code. // https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/modules/cjs/loader.js // Each function and variable below must have a comment linking to the source in node's github repo. 'use strict'; const { ArrayIsArray, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypePush, JSONParse, ObjectKeys, RegExpPrototypeTest, SafeMap, SafeWeakMap, StringPrototypeCharCodeAt, StringPrototypeEndsWith, StringPrototypeLastIndexOf, StringPrototypeIndexOf, StringPrototypeMatch, StringPrototypeSlice, StringPrototypeStartsWith, } = require('./node-primordials'); const { NativeModule } = require('./node-nativemodule'); const { pathToFileURL, fileURLToPath } = require('url'); const fs = require('fs'); const path = require('path'); const { sep } = path; const { internalModuleStat } = require('./node-internalBinding-fs'); const packageJsonReader = require('./node-internal-modules-package_json_reader'); const { cjsConditions, } = require('./node-internal-modules-cjs-helpers'); const { getOptionValue } = require('./node-options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const {normalizeSlashes} = require('../dist/util'); const {createErrRequireEsm} = require('./node-internal-errors'); const { codes: { ERR_INVALID_MODULE_SPECIFIER, }, } = require('./node-internal-errors'); const { CHAR_FORWARD_SLASH, } = require('./node-internal-constants'); const Module = require('module'); const isWindows = process.platform === 'win32'; let statCache = null; function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } const result = internalModuleStat(filename); if (statCache !== null && result >= 0) { // Only set cache when `internalModuleStat(filename)` succeeds. statCache.set(filename, result); } return result; } // Note: // we cannot get access to node's internal cache, which is populated from // within node's Module constructor. So the cache here will always be empty. // It's possible we could approximate our own cache by building it up with // hacky workarounds, but it's not worth the complexity and flakiness. const moduleParentCache = new SafeWeakMap(); // Given a module name, and a list of paths to test, returns the first // matching file in the following precedence. // // require("a.") // -> a. // // require("a") // -> a // -> a. // -> a/index. const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const result = packageJsonReader.read(jsonPath); const json = result.containsKeys === false ? '{}' : result.string; if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, imports: parsed.imports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep); let separatorIndex; do { separatorIndex = StringPrototypeLastIndexOf(checkPath, sep); checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex); if (StringPrototypeEndsWith(checkPath, sep + 'node_modules')) return false; const pjson = readPackage(checkPath + sep); if (pjson) return { data: pjson, path: checkPath, }; } while (separatorIndex > rootSeparatorIndex); return false; } /** * @param {{ * nodeEsmResolver: ReturnType, * extensions: import('../src/file-extensions').Extensions, * preferTsExts * }} opts */ function createCjsLoader(opts) { const {nodeEsmResolver, preferTsExts} = opts; const {replacementsForCjs, replacementsForJs, replacementsForMjs, replacementsForJsx} = opts.extensions; const { encodedSepRegEx, packageExportsResolve, packageImportsResolve } = nodeEsmResolver; function tryPackage(requestPath, exts, isMain, originalPath) { // const pkg = readPackage(requestPath)?.main; const tmp = readPackage(requestPath) const pkg = tmp != null ? tmp.main : undefined; if (!pkg) { return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); } const filename = path.resolve(requestPath, pkg); let actual = tryReplacementExtensions(filename, isMain) || tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, 'index'), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); if (!actual) { // eslint-disable-next-line no-restricted-syntax const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); err.code = 'MODULE_NOT_FOUND'; err.path = path.resolve(requestPath, 'package.json'); err.requestPath = originalPath; // TODO(BridgeAR): Add the requireStack as well. throw err; } else { const jsonPath = path.resolve(requestPath, 'package.json'); process.emitWarning( `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + 'Please either fix that or report it to the module author', 'DeprecationWarning', 'DEP0128' ); } } return actual; } // In order to minimize unnecessary lstat() calls, // this cache is a list of known-real paths. // Set to an empty Map to reset. const realpathCache = new SafeMap(); // Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); if (rc !== 0) return; if (preserveSymlinks && !isMain) { return path.resolve(requestPath); } return toRealPath(requestPath); } function toRealPath(requestPath) { return fs.realpathSync(requestPath, { // [internalFS.realpathCacheKey]: realpathCache }); } function statReplacementExtensions(p) { const lastDotIndex = p.lastIndexOf('.'); if(lastDotIndex >= 0) { const ext = p.slice(lastDotIndex); if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') { const pathnameWithoutExtension = p.slice(0, lastDotIndex); const replacementExts = ext === '.js' ? replacementsForJs : ext === '.jsx' ? replacementsForJsx : ext === '.mjs' ? replacementsForMjs : replacementsForCjs; for (let i = 0; i < replacementExts.length; i++) { const filename = pathnameWithoutExtension + replacementExts[i]; const rc = stat(filename); if (rc === 0) { return [rc, filename]; } } } } return [stat(p), p]; } function tryReplacementExtensions(p, isMain) { const lastDotIndex = p.lastIndexOf('.'); if(lastDotIndex >= 0) { const ext = p.slice(lastDotIndex); if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') { const pathnameWithoutExtension = p.slice(0, lastDotIndex); const replacementExts = ext === '.js' ? replacementsForJs : ext === '.jsx' ? replacementsForJsx : ext === '.mjs' ? replacementsForMjs : replacementsForCjs; for (let i = 0; i < replacementExts.length; i++) { const filename = tryFile(pathnameWithoutExtension + replacementExts[i], isMain); if (filename) { return filename; } } } } return false; } // Given a path, check if the file exists with any of the set extensions function tryExtensions(p, exts, isMain) { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; } function trySelfParentPath(parent) { if (!parent) return false; if (parent.filename) { return parent.filename; } else if (parent.id === '' || parent.id === 'internal/preload') { try { return process.cwd() + path.sep; } catch { return false; } } } function trySelf(parentPath, request) { if (!parentPath) return false; const { data: pkg, path: pkgPath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; let expansion; if (request === pkg.name) { expansion = '.'; } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) { expansion = '.' + StringPrototypeSlice(request, pkg.name.length); } else { return false; } try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), expansion, pkg, pathToFileURL(parentPath), cjsConditions).resolved, parentPath, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. const { 1: name, 2: expansion = '' } = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) return; const pkgPath = path.resolve(nmPath, name); const pkg = readPackage(pkgPath); // if (pkg?.exports != null) { if (pkg != null && pkg.exports != null) { try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), '.' + expansion, pkg, null, cjsConditions).resolved, null, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } } // Backwards compat for old node versions const hasModulePathCache = !!require('module')._pathCache; const Module_pathCache = Object.create(null); const Module_pathCache_get = hasModulePathCache ? (cacheKey) => Module._pathCache[cacheKey] : (cacheKey) => Module_pathCache[cacheKey]; const Module_pathCache_set = hasModulePathCache ? (cacheKey, value) => (Module._pathCache[cacheKey] = value) : (cacheKey) => (Module_pathCache[cacheKey] = value); const trailingSlashRegex = /(?:^|\/)\.?\.$/; const Module_findPath = function _findPath(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = ['']; } else if (!paths || paths.length === 0) { return false; } const cacheKey = request + '\x00' + ArrayPrototypeJoin(paths, '\x00'); const entry = Module_pathCache_get(cacheKey); if (entry) return entry; let exts; let trailingSlash = request.length > 0 && StringPrototypeCharCodeAt(request, request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path for (let i = 0; i < paths.length; i++) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; if (!absoluteRequest) { const exportsResolved = resolveExports(curPath, request); if (exportsResolved) return exportsResolved; } const _basePath = path.resolve(curPath, request); let filename; const [rc, basePath] = statReplacementExtensions(_basePath); if (!trailingSlash) { if (rc === 0) { // File. if (!isMain) { if (preserveSymlinks) { filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } else if (preserveSymlinksMain) { // For the main module, we use the preserveSymlinksMain flag instead // mainly for backward compatibility, as the preserveSymlinks flag // historically has not applied to the main module. Most likely this // was intended to keep .bin/ binaries working, as following those // symlinks is usually required for the imports in the corresponding // files to resolve; that said, in some use cases following symlinks // causes bigger problems which is why the preserveSymlinksMain option // is needed. filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } if (!filename) { // Try it with each of the extensions if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); } if (filename) { Module_pathCache_set(cacheKey, filename); return filename; } } return false; }; const Module_resolveFilename = function _resolveFilename(request, parent, isMain, options) { if (StringPrototypeStartsWith(request, 'node:') || NativeModule.canBeRequiredByUsers(request)) { return request; } let paths; if (typeof options === 'object' && options !== null) { if (ArrayIsArray(options.paths)) { const isRelative = StringPrototypeStartsWith(request, './') || StringPrototypeStartsWith(request, '../') || ((isWindows && StringPrototypeStartsWith(request, '.\\')) || StringPrototypeStartsWith(request, '..\\')); if (isRelative) { paths = options.paths; } else { const fakeParent = new Module('', null); paths = []; for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent); for (let j = 0; j < lookupPaths.length; j++) { if (!ArrayPrototypeIncludes(paths, lookupPaths[j])) ArrayPrototypePush(paths, lookupPaths[j]); } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent); } else { throw new ERR_INVALID_ARG_VALUE('options.paths', options.paths); } } else { paths = Module._resolveLookupPaths(request, parent); } // if (parent?.filename) { // node 12 hack if (parent != null && parent.filename) { if (request[0] === '#') { const pkg = readPackageScope(parent.filename) || {}; // if (pkg.data?.imports != null) { // node 12 hack if (pkg.data != null && pkg.data.imports != null) { try { return finalizeEsmResolution( packageImportsResolve(request, pathToFileURL(parent.filename), cjsConditions), parent.filename, pkg.path); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request); throw e; } } } } // Try module self resolution first const parentPath = trySelfParentPath(parent); const selfResolved = trySelf(parentPath, request); if (selfResolved) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : ArrayPrototypeJoin(paths, '\x00')); Module._pathCache[cacheKey] = selfResolved; return selfResolved; } // Look up the filename first, since that's the cache key. const filename = Module._findPath(request, paths, isMain, false); if (filename) return filename; const requireStack = []; for (let cursor = parent; cursor; cursor = moduleParentCache.get(cursor)) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + '\nRequire stack:\n- ' + ArrayPrototypeJoin(requireStack, '\n- '); } // eslint-disable-next-line no-restricted-syntax const err = new Error(message); err.code = 'MODULE_NOT_FOUND'; err.requireStack = requireStack; throw err; }; function finalizeEsmResolution(resolved, parentPath, pkgPath) { if (RegExpPrototypeTest(encodedSepRegEx, resolved)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved, 'must not include encoded "/" or "\\" characters', parentPath); const filename = fileURLToPath(resolved); const actual = tryReplacementExtensions(filename) || tryFile(filename); if (actual) return actual; const err = createEsmNotFoundErr(filename, path.resolve(pkgPath, 'package.json')); throw err; } function createEsmNotFoundErr(request, path) { // eslint-disable-next-line no-restricted-syntax const err = new Error(`Cannot find module '${request}'`); err.code = 'MODULE_NOT_FOUND'; if (path) err.path = path; // TODO(BridgeAR): Add the requireStack as well. return err; } return { Module_findPath, Module_resolveFilename } } /** * copied from Module._extensions['.js'] * https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/cjs/loader.js#L1113-L1120 * @param {import('../src/index').Service} service * @param {NodeJS.Module} module * @param {string} filename */ function assertScriptCanLoadAsCJSImpl(service, module, filename) { const pkg = readPackageScope(filename); // ts-node modification: allow our configuration to override const tsNodeClassification = service.moduleTypeClassifier.classifyModuleByModuleTypeOverrides(normalizeSlashes(filename)); if(tsNodeClassification.moduleType === 'cjs') return; // ignore package.json when file extension is ESM-only or CJS-only // [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] const lastDotIndex = filename.lastIndexOf('.'); const ext = lastDotIndex >= 0 ? filename.slice(lastDotIndex) : ''; if((ext === '.cts' || ext === '.cjs') && tsNodeClassification.moduleType === 'auto') return; // Function require shouldn't be used in ES modules. if (ext === '.mts' || ext === '.mjs' || tsNodeClassification.moduleType === 'esm' || (pkg && pkg.data && pkg.data.type === 'module')) { const parentPath = module.parent && module.parent.filename; const packageJsonPath = pkg ? path.resolve(pkg.path, 'package.json') : null; throw createErrRequireEsm(filename, parentPath, packageJsonPath); } } module.exports = { createCjsLoader, assertScriptCanLoadAsCJSImpl, readPackageScope }; ts-node-10.9.2/dist-raw/node-internal-modules-esm-get_format.js000066400000000000000000000066641453460306300244000ustar00rootroot00000000000000// Copied from https://raw.githubusercontent.com/nodejs/node/v15.3.0/lib/internal/modules/esm/get_format.js 'use strict'; const { RegExpPrototypeExec, StringPrototypeStartsWith, } = require('./node-primordials'); const { extname } = require('path'); const { getOptionValue } = require('./node-options'); const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(s => parseInt(s, 10)); const experimentalJsonModules = nodeMajor > 17 || (nodeMajor === 17 && nodeMinor >= 5) || (nodeMajor === 16 && nodeMinor >= 15) || getOptionValue('--experimental-json-modules'); const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); const { URL, fileURLToPath } = require('url'); const { ERR_UNKNOWN_FILE_EXTENSION } = require('./node-internal-errors').codes; const extensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'module', '.mjs': 'module' }; const legacyExtensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'commonjs', '.json': 'commonjs', '.mjs': 'module', '.node': 'commonjs' }; if (experimentalWasmModules) extensionFormatMap['.wasm'] = legacyExtensionFormatMap['.wasm'] = 'wasm'; if (experimentalJsonModules) extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; /** * * @param {'node' | 'explicit'} [tsNodeExperimentalSpecifierResolution] * @param {ReturnType< * typeof import('../dist-raw/node-internal-modules-esm-resolve').createResolve * >} nodeEsmResolver */ function createGetFormat(tsNodeExperimentalSpecifierResolution, nodeEsmResolver) { // const experimentalSpeciferResolution = tsNodeExperimentalSpecifierResolution ?? getOptionValue('--experimental-specifier-resolution'); let experimentalSpeciferResolution = tsNodeExperimentalSpecifierResolution != null ? tsNodeExperimentalSpecifierResolution : getOptionValue('--experimental-specifier-resolution'); const { getPackageType } = nodeEsmResolver; /** * @param {string} url * @param {{}} context * @param {any} defaultGetFormatUnused * @returns {ReturnType} */ function defaultGetFormat(url, context, defaultGetFormatUnused) { if (StringPrototypeStartsWith(url, 'node:')) { return { format: 'builtin' }; } const parsed = new URL(url); if (parsed.protocol === 'data:') { const [ , mime ] = RegExpPrototypeExec( /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/, parsed.pathname, ) || [ null, null, null ]; const format = ({ '__proto__': null, 'text/javascript': 'module', 'application/json': experimentalJsonModules ? 'json' : null, 'application/wasm': experimentalWasmModules ? 'wasm' : null })[mime] || null; return { format }; } else if (parsed.protocol === 'file:') { const ext = extname(parsed.pathname); let format; if (ext === '.js') { format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs'; } else { format = extensionFormatMap[ext]; } if (!format) { if (experimentalSpeciferResolution === 'node') { process.emitWarning( 'The Node.js specifier resolution in ESM is experimental.', 'ExperimentalWarning'); format = legacyExtensionFormatMap[ext]; } else { throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url)); } } return { format: format || null }; } return { format: null }; } return {defaultGetFormat}; } module.exports = { createGetFormat }; ts-node-10.9.2/dist-raw/node-internal-modules-esm-resolve.js000066400000000000000000001004171453460306300237170ustar00rootroot00000000000000// Copied from https://raw.githubusercontent.com/nodejs/node/v15.3.0/lib/internal/modules/esm/resolve.js 'use strict'; const {versionGteLt} = require('../dist/util'); // Test for node >14.13.1 || (>=12.20.0 && <13) const builtinModuleProtocol = versionGteLt(process.versions.node, '14.13.1') || versionGteLt(process.versions.node, '12.20.0', '13.0.0') ? 'node:' : 'nodejs:'; const { ArrayIsArray, ArrayPrototypeJoin, ArrayPrototypeShift, JSONParse, JSONStringify, ObjectFreeze, ObjectGetOwnPropertyNames, ObjectPrototypeHasOwnProperty, RegExpPrototypeTest, SafeMap, SafeSet, StringPrototypeEndsWith, StringPrototypeIndexOf, StringPrototypeLastIndexOf, StringPrototypeReplace, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, StringPrototypeSubstr, } = require('./node-primordials'); // const internalFS = require('internal/fs/utils'); const Module = require('module'); const { NativeModule } = require('./node-nativemodule'); const { realpathSync, statSync, Stats, } = require('fs'); // const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('./node-options'); // // Do not eagerly grab .manifest, it may be in TDZ // const policy = getOptionValue('--experimental-policy') ? // require('internal/process/policy') : // null; // disabled for now. I am not sure if/how we should support this const policy = null; const { sep, relative } = require('path'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const typeFlag = getOptionValue('--input-type'); // const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); const { URL, pathToFileURL, fileURLToPath } = require('url'); const { ERR_INPUT_TYPE_NOT_ALLOWED, ERR_INVALID_ARG_VALUE, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MANIFEST_DEPENDENCY_MISSING, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_ESM_URL_SCHEME, // } = require('internal/errors').codes; } = require('./node-internal-errors').codes; // const { Module: CJSModule } = require('internal/modules/cjs/loader'); const CJSModule = Module; // const packageJsonReader = require('internal/modules/package_json_reader'); const packageJsonReader = require('./node-internal-modules-package_json_reader'); const userConditions = getOptionValue('--conditions'); const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import', ...userConditions]); const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS); const pendingDeprecation = getOptionValue('--pending-deprecation'); /** * @param {{ * extensions: import('../src/file-extensions').Extensions, * preferTsExts: boolean | undefined; * tsNodeExperimentalSpecifierResolution: import('../src/index').ExperimentalSpecifierResolution | undefined; * }} opts */ function createResolve(opts) { // TODO receive cached fs implementations here const {preferTsExts, tsNodeExperimentalSpecifierResolution, extensions} = opts; const esrnExtensions = extensions.experimentalSpecifierResolutionAddsIfOmitted; const {legacyMainResolveAddsIfOmitted, replacementsForCjs, replacementsForJs, replacementsForMjs, replacementsForJsx} = extensions; // const experimentalSpecifierResolution = tsNodeExperimentalSpecifierResolution ?? getOptionValue('--experimental-specifier-resolution'); const experimentalSpecifierResolution = tsNodeExperimentalSpecifierResolution != null ? tsNodeExperimentalSpecifierResolution : getOptionValue('--experimental-specifier-resolution'); const emittedPackageWarnings = new SafeSet(); function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { const pjsonPath = fileURLToPath(pjsonUrl); if (!pendingDeprecation) { const nodeModulesIndex = StringPrototypeLastIndexOf(pjsonPath, '/node_modules/'); if (nodeModulesIndex !== -1) { const afterNodeModulesPath = StringPrototypeSlice(pjsonPath, nodeModulesIndex + 14, -13); try { const { packageSubpath } = parsePackageName(afterNodeModulesPath); if (packageSubpath === '.') return; } catch {} } } if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; emittedPackageWarnings.add(pjsonPath + '|' + match); process.emitWarning( `Use of deprecated folder mapping "${match}" in the ${isExports ? '"exports"' : '"imports"'} field module resolution of the package at ${ pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.\n` + `Update this package.json to use a subpath pattern like "${match}*".`, 'DeprecationWarning', 'DEP0148' ); } function getConditionsSet(conditions) { if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) { if (!ArrayIsArray(conditions)) { throw new ERR_INVALID_ARG_VALUE('conditions', conditions, 'expected an array'); } return new SafeSet(conditions); } return DEFAULT_CONDITIONS_SET; } const realpathCache = new SafeMap(); const packageJSONCache = new SafeMap(); /* string -> PackageConfig */ const statSupportsThrowIfNoEntry = versionGteLt(process.versions.node, '15.3.0') || versionGteLt(process.versions.node, '14.17.0', '15.0.0'); const tryStatSync = statSupportsThrowIfNoEntry ? tryStatSyncWithoutErrors : tryStatSyncWithErrors; const statsIfNotFound = new Stats(); function tryStatSyncWithoutErrors(path) { const stats = statSync(path, { throwIfNoEntry: false }); if(stats != null) return stats; return statsIfNotFound; } function tryStatSyncWithErrors(path) { try { return statSync(path); } catch { return statsIfNotFound; } } function getPackageConfig(path, specifier, base) { const existing = packageJSONCache.get(path); if (existing !== undefined) { return existing; } const source = packageJsonReader.read(path).string; if (source === undefined) { const packageConfig = { pjsonPath: path, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(path, packageConfig); return packageConfig; } let packageJSON; try { packageJSON = JSONParse(source); } catch (error) { throw new ERR_INVALID_PACKAGE_CONFIG( path, (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), error.message ); } let { imports, main, name, type } = packageJSON; const { exports } = packageJSON; if (typeof imports !== 'object' || imports === null) imports = undefined; if (typeof main !== 'string') main = undefined; if (typeof name !== 'string') name = undefined; // Ignore unknown types for forwards compatibility if (type !== 'module' && type !== 'commonjs') type = 'none'; const packageConfig = { pjsonPath: path, exists: true, main, name, type, exports, imports, }; packageJSONCache.set(path, packageConfig); return packageConfig; } function getPackageScopeConfig(resolved) { let packageJSONUrl = new URL('./package.json', resolved); while (true) { const packageJSONPath = packageJSONUrl.pathname; if (StringPrototypeEndsWith(packageJSONPath, 'node_modules/package.json')) break; const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), resolved); if (packageConfig.exists) return packageConfig; const lastPackageJSONUrl = packageJSONUrl; packageJSONUrl = new URL('../package.json', packageJSONUrl); // Terminates at root where ../package.json equals ../../package.json // (can't just check "/package.json" for Windows support). if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break; } const packageJSONPath = fileURLToPath(packageJSONUrl); const packageConfig = { pjsonPath: packageJSONPath, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(packageJSONPath, packageConfig); return packageConfig; } /* * Legacy CommonJS main resolution: * 1. let M = pkg_url + (json main field) * 2. TRY(M, M.js, M.json, M.node) * 3. TRY(M/index.js, M/index.json, M/index.node) * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) * 5. NOT_FOUND */ function fileExists(url) { return tryStatSync(fileURLToPath(url)).isFile(); } function legacyMainResolve(packageJSONUrl, packageConfig, base) { let guess; if (packageConfig.main !== undefined) { // Note: fs check redundances will be handled by Descriptor cache here. if(guess = resolveReplacementExtensions(new URL(`./${packageConfig.main}`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) { return guess; } for(const extension of legacyMainResolveAddsIfOmitted) { if (fileExists(guess = new URL(`./${packageConfig.main}${extension}`, packageJSONUrl))) { return guess; } } for(const extension of legacyMainResolveAddsIfOmitted) { if (fileExists(guess = new URL(`./${packageConfig.main}/index${extension}`, packageJSONUrl))) { return guess; } } // Fallthrough. } for(const extension of legacyMainResolveAddsIfOmitted) { if (fileExists(guess = new URL(`./index${extension}`, packageJSONUrl))) { return guess; } } // Not found. throw new ERR_MODULE_NOT_FOUND( fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } /** attempts replacement extensions, then tries exact name, then attempts appending extensions */ function resolveExtensionsWithTryExactName(search) { const resolvedReplacementExtension = resolveReplacementExtensions(search); if(resolvedReplacementExtension) return resolvedReplacementExtension; if (fileExists(search)) return search; return resolveExtensions(search); } // This appends missing extensions function resolveExtensions(search) { for (let i = 0; i < esrnExtensions.length; i++) { const extension = esrnExtensions[i]; const guess = new URL(`${search.pathname}${extension}`, search); if (fileExists(guess)) return guess; } return undefined; } /** This replaces JS with TS extensions */ function resolveReplacementExtensions(search) { const lastDotIndex = search.pathname.lastIndexOf('.'); if(lastDotIndex >= 0) { const ext = search.pathname.slice(lastDotIndex); if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') { const pathnameWithoutExtension = search.pathname.slice(0, lastDotIndex); const replacementExts = ext === '.js' ? replacementsForJs : ext === '.jsx' ? replacementsForJsx : ext === '.mjs' ? replacementsForMjs : replacementsForCjs; const guess = new URL(search.toString()); for (let i = 0; i < replacementExts.length; i++) { const extension = replacementExts[i]; guess.pathname = `${pathnameWithoutExtension}${extension}`; if (fileExists(guess)) return guess; } } } return undefined; } function resolveIndex(search) { return resolveExtensions(new URL('index', search)); } const encodedSepRegEx = /%2F|%2C/i; function finalizeResolution(resolved, base) { if (RegExpPrototypeTest(encodedSepRegEx, resolved.pathname)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved.pathname, 'must not include encoded "/" or "\\" characters', fileURLToPath(base)); if (experimentalSpecifierResolution === 'node') { const path = fileURLToPath(resolved); let file = resolveExtensionsWithTryExactName(resolved); if (file !== undefined) return file; if (!StringPrototypeEndsWith(path, '/')) { file = resolveIndex(new URL(`${resolved}/`)); if (file !== undefined) return file; } else { return resolveIndex(resolved) || resolved; } throw new ERR_MODULE_NOT_FOUND( resolved.pathname, fileURLToPath(base), 'module'); } const file = resolveReplacementExtensions(resolved) || resolved; const path = fileURLToPath(file); const stats = tryStatSync(StringPrototypeEndsWith(path, '/') ? StringPrototypeSlice(path, -1) : path); if (stats.isDirectory()) { const err = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base)); err.url = String(resolved); throw err; } else if (!stats.isFile()) { throw new ERR_MODULE_NOT_FOUND( path || resolved.pathname, fileURLToPath(base), 'module'); } return file; } function throwImportNotDefined(specifier, packageJSONUrl, base) { throw new ERR_PACKAGE_IMPORT_NOT_DEFINED( specifier, packageJSONUrl && fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function throwExportsNotFound(subpath, packageJSONUrl, base) { throw new ERR_PACKAGE_PATH_NOT_EXPORTED( fileURLToPath(new URL('.', packageJSONUrl)), subpath, base && fileURLToPath(base)); } function throwInvalidSubpath(subpath, packageJSONUrl, internal, base) { const reason = `request is not a valid subpath for the "${internal ? 'imports' : 'exports'}" resolution of ${fileURLToPath(packageJSONUrl)}`; throw new ERR_INVALID_MODULE_SPECIFIER(subpath, reason, base && fileURLToPath(base)); } function throwInvalidPackageTarget( subpath, target, packageJSONUrl, internal, base) { if (typeof target === 'object' && target !== null) { target = JSONStringify(target, null, ''); } else { target = `${target}`; } throw new ERR_INVALID_PACKAGE_TARGET( fileURLToPath(new URL('.', packageJSONUrl)), subpath, target, internal, base && fileURLToPath(base)); } const invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; const patternRegEx = /\*/g; function resolvePackageTargetString( target, subpath, match, packageJSONUrl, base, pattern, internal, conditions) { if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (!StringPrototypeStartsWith(target, './')) { if (internal && !StringPrototypeStartsWith(target, '../') && !StringPrototypeStartsWith(target, '/')) { let isURL = false; try { new URL(target); isURL = true; } catch {} if (!isURL) { const exportTarget = pattern ? StringPrototypeReplace(target, patternRegEx, subpath) : target + subpath; return packageResolve(exportTarget, packageJSONUrl, conditions); } } throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); } if (RegExpPrototypeTest(invalidSegmentRegEx, StringPrototypeSlice(target, 2))) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); const resolved = new URL(target, packageJSONUrl); const resolvedPath = resolved.pathname; const packagePath = new URL('.', packageJSONUrl).pathname; if (!StringPrototypeStartsWith(resolvedPath, packagePath)) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (subpath === '') return resolved; if (RegExpPrototypeTest(invalidSegmentRegEx, subpath)) throwInvalidSubpath(match + subpath, packageJSONUrl, internal, base); if (pattern) return new URL(StringPrototypeReplace(resolved.href, patternRegEx, subpath)); return new URL(subpath, resolved); } /** * @param {string} key * @returns {boolean} */ function isArrayIndex(key) { const keyNum = +key; if (`${keyNum}` !== key) return false; return keyNum >= 0 && keyNum < 0xFFFF_FFFF; } function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, base, pattern, internal, conditions) { if (typeof target === 'string') { return resolvePackageTargetString( target, subpath, packageSubpath, packageJSONUrl, base, pattern, internal, conditions); } else if (ArrayIsArray(target)) { if (target.length === 0) return null; let lastException; for (let i = 0; i < target.length; i++) { const targetItem = target[i]; let resolved; try { resolved = resolvePackageTarget( packageJSONUrl, targetItem, subpath, packageSubpath, base, pattern, internal, conditions); } catch (e) { lastException = e; if (e.code === 'ERR_INVALID_PACKAGE_TARGET') continue; throw e; } if (resolved === undefined) continue; if (resolved === null) { lastException = null; continue; } return resolved; } if (lastException === undefined || lastException === null) return lastException; throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectGetOwnPropertyNames(target); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (isArrayIndex(key)) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain numeric property keys.'); } } for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key === 'default' || conditions.has(key)) { const conditionalTarget = target[key]; const resolved = resolvePackageTarget( packageJSONUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, conditions); if (resolved === undefined) continue; return resolved; } } return undefined; } else if (target === null) { return null; } throwInvalidPackageTarget(packageSubpath, target, packageJSONUrl, internal, base); } function isConditionalExportsMainSugar(exports, packageJSONUrl, base) { if (typeof exports === 'string' || ArrayIsArray(exports)) return true; if (typeof exports !== 'object' || exports === null) return false; const keys = ObjectGetOwnPropertyNames(exports); let isConditionalSugar = false; let i = 0; for (let j = 0; j < keys.length; j++) { const key = keys[j]; const curIsConditionalSugar = key === '' || key[0] !== '.'; if (i++ === 0) { isConditionalSugar = curIsConditionalSugar; } else if (isConditionalSugar !== curIsConditionalSugar) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); } } return isConditionalSugar; } /** * @param {URL} packageJSONUrl * @param {string} packageSubpath * @param {object} packageConfig * @param {string} base * @param {Set} conditions * @returns {{resolved: URL, exact: boolean}} */ function packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions) { let exports = packageConfig.exports; if (isConditionalExportsMainSugar(exports, packageJSONUrl, base)) exports = { '.': exports }; if (ObjectPrototypeHasOwnProperty(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolvePackageTarget( packageJSONUrl, target, '', packageSubpath, base, false, false, conditions ); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); return { resolved, exact: true }; } let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(exports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(packageSubpath, StringPrototypeSlice(key, 0, -1)) && packageSubpath.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(packageSubpath, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = exports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget(packageJSONUrl, target, subpath, bestMatch, base, pattern, false, conditions); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, true, base); return { resolved, exact: pattern }; } throwExportsNotFound(packageSubpath, packageJSONUrl, base); } function packageImportsResolve(name, base, conditions) { if (name === '#' || StringPrototypeStartsWith(name, '#/')) { const reason = 'is not a valid internal imports specifier name'; throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)); } let packageJSONUrl; const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); const imports = packageConfig.imports; if (imports) { if (ObjectPrototypeHasOwnProperty(imports, name)) { const resolved = resolvePackageTarget( packageJSONUrl, imports[name], '', name, base, false, true, conditions ); if (resolved !== null) return { resolved, exact: true }; } else { let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(imports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(name, StringPrototypeSlice(key, 0, -1)) && name.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(name, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = imports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(name, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget( packageJSONUrl, target, subpath, bestMatch, base, pattern, true, conditions); if (resolved !== null) { if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, false, base); return { resolved, exact: pattern }; } } } } } throwImportNotDefined(name, packageJSONUrl, base); } function getPackageType(url) { const packageConfig = getPackageScopeConfig(url); return packageConfig.type; } function parsePackageName(specifier, base) { let separatorIndex = StringPrototypeIndexOf(specifier, '/'); let validPackageName = true; let isScoped = false; if (specifier[0] === '@') { isScoped = true; if (separatorIndex === -1 || specifier.length === 0) { validPackageName = false; } else { separatorIndex = StringPrototypeIndexOf( specifier, '/', separatorIndex + 1); } } const packageName = separatorIndex === -1 ? specifier : StringPrototypeSlice(specifier, 0, separatorIndex); // Package name cannot have leading . and cannot have percent-encoding or // separators. for (let i = 0; i < packageName.length; i++) { if (packageName[i] === '%' || packageName[i] === '\\') { validPackageName = false; break; } } if (!validPackageName) { throw new ERR_INVALID_MODULE_SPECIFIER( specifier, 'is not a valid package name', fileURLToPath(base)); } const packageSubpath = '.' + (separatorIndex === -1 ? '' : StringPrototypeSlice(specifier, separatorIndex)); return { packageName, packageSubpath, isScoped }; } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function packageResolve(specifier, base, conditions) { const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); // ResolveSelf const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { const packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); if (packageConfig.name === packageName && packageConfig.exports !== undefined && packageConfig.exports !== null) { return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; } } let packageJSONUrl = new URL('./node_modules/' + packageName + '/package.json', base); let packageJSONPath = fileURLToPath(packageJSONUrl); let lastPath; do { const stat = tryStatSync(StringPrototypeSlice(packageJSONPath, 0, packageJSONPath.length - 13)); if (!stat.isDirectory()) { lastPath = packageJSONPath; packageJSONUrl = new URL((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJSONUrl); packageJSONPath = fileURLToPath(packageJSONUrl); continue; } // Package match. const packageConfig = getPackageConfig(packageJSONPath, specifier, base); if (packageConfig.exports !== undefined && packageConfig.exports !== null) return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; if (packageSubpath === '.') return legacyMainResolve(packageJSONUrl, packageConfig, base); return new URL(packageSubpath, packageJSONUrl); // Cross-platform root check. } while (packageJSONPath.length !== lastPath.length); // eslint can't handle the above code. // eslint-disable-next-line no-unreachable throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base)); } function isBareSpecifier(specifier) { return specifier[0] && specifier[0] !== '/' && specifier[0] !== '.'; } function isRelativeSpecifier(specifier) { if (specifier[0] === '.') { if (specifier.length === 1 || specifier[1] === '/') return true; if (specifier[1] === '.') { if (specifier.length === 2 || specifier[2] === '/') return true; } } return false; } function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { if (specifier === '') return false; if (specifier[0] === '/') return true; return isRelativeSpecifier(specifier); } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function moduleResolve(specifier, base, conditions) { // Order swapped from spec for minor perf gain. // Ok since relative URLs cannot parse as URLs. let resolved; if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { resolved = new URL(specifier, base); } else if (specifier[0] === '#') { ({ resolved } = packageImportsResolve(specifier, base, conditions)); } else { try { resolved = new URL(specifier); } catch { resolved = packageResolve(specifier, base, conditions); } } return finalizeResolution(resolved, base); } /** * Try to resolve an import as a CommonJS module * @param {string} specifier * @param {string} parentURL * @returns {boolean|string} */ function resolveAsCommonJS(specifier, parentURL) { try { const parent = fileURLToPath(parentURL); const tmpModule = new CJSModule(parent, null); tmpModule.paths = CJSModule._nodeModulePaths(parent); let found = CJSModule._resolveFilename(specifier, tmpModule, false); // If it is a relative specifier return the relative path // to the parent if (isRelativeSpecifier(specifier)) { found = relative(parent, found); // Add '.separator if the path does not start with '..separator' // This should be a safe assumption because when loading // esm modules there should be always a file specified so // there should not be a specifier like '..' or '.' if (!StringPrototypeStartsWith(found, `..${sep}`)) { found = `.${sep}${found}`; } } else if (isBareSpecifier(specifier)) { // If it is a bare specifier return the relative path within the // module const pkg = StringPrototypeSplit(specifier, '/')[0]; const index = StringPrototypeIndexOf(found, pkg); if (index !== -1) { found = StringPrototypeSlice(found, index); } } // Normalize the path separator to give a valid suggestion // on Windows if (process.platform === 'win32') { found = StringPrototypeReplace(found, new RegExp(`\\${sep}`, 'g'), '/'); } return found; } catch { return false; } } function defaultResolve(specifier, context = {}, defaultResolveUnused) { let { parentURL, conditions } = context; if (parentURL && policy != null && policy.manifest) { const redirects = policy.manifest.getDependencyMapper(parentURL); if (redirects) { const { resolve, reaction } = redirects; const destination = resolve(specifier, new SafeSet(conditions)); let missing = true; if (destination === true) { missing = false; } else if (destination) { const href = destination.href; return { url: href }; } if (missing) { reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( parentURL, specifier, ArrayPrototypeJoin([...conditions], ', ')) ); } } } let parsed; try { parsed = new URL(specifier); if (parsed.protocol === 'data:') { return { url: specifier }; } } catch {} if (parsed && parsed.protocol === builtinModuleProtocol) return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); if (NativeModule.canBeRequiredByUsers(specifier)) { return { url: builtinModuleProtocol + specifier }; } if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { // This is gonna blow up, we want the error new URL(specifier, parentURL); } const isMain = parentURL === undefined; if (isMain) { parentURL = pathToFileURL(`${process.cwd()}/`).href; // This is the initial entry point to the program, and --input-type has // been passed as an option; but --input-type can only be used with // --eval, --print or STDIN string input. It is not allowed with file // input, to avoid user confusion over how expansive the effect of the // flag should be (i.e. entry point only, package scope surrounding the // entry point, etc.). if (typeFlag) throw new ERR_INPUT_TYPE_NOT_ALLOWED(); } conditions = getConditionsSet(conditions); let url; try { url = moduleResolve(specifier, parentURL, conditions); } catch (error) { // Try to give the user a hint of what would have been the // resolved CommonJS module if (error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ERR_UNSUPPORTED_DIR_IMPORT') { if (StringPrototypeStartsWith(specifier, 'file://')) { specifier = fileURLToPath(specifier); } const found = resolveAsCommonJS(specifier, parentURL); if (found) { // Modify the stack and message string to include the hint const lines = StringPrototypeSplit(error.stack, '\n'); const hint = `Did you mean to import ${found}?`; error.stack = ArrayPrototypeShift(lines) + '\n' + hint + '\n' + ArrayPrototypeJoin(lines, '\n'); error.message += `\n${hint}`; } } throw error; } if (isMain ? !preserveSymlinksMain : !preserveSymlinks) { const urlPath = fileURLToPath(url); const real = realpathSync(urlPath, { // [internalFS.realpathCacheKey]: realpathCache }); const old = url; url = pathToFileURL( real + (StringPrototypeEndsWith(urlPath, sep) ? '/' : '')); url.search = old.search; url.hash = old.hash; } return { url: `${url}` }; } return { DEFAULT_CONDITIONS, defaultResolve, encodedSepRegEx, getPackageType, packageExportsResolve, packageImportsResolve }; } module.exports = { createResolve }; ts-node-10.9.2/dist-raw/node-internal-modules-package_json_reader.js000066400000000000000000000023601453460306300254220ustar00rootroot00000000000000// copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/package_json_reader.js 'use strict'; const { SafeMap } = require('./node-primordials'); const { internalModuleReadJSON } = require('./node-internalBinding-fs'); const { pathToFileURL } = require('url'); const { toNamespacedPath } = require('path'); // const { getOptionValue } = require('./node-options'); const cache = new SafeMap(); let manifest; /** * @param {string} jsonPath * @return {{string: string, containsKeys: boolean}} */ function read(jsonPath) { if (cache.has(jsonPath)) { return cache.get(jsonPath); } const [string, containsKeys] = internalModuleReadJSON( toNamespacedPath(jsonPath) ); const result = { string, containsKeys }; if (string !== undefined) { if (manifest === undefined) { // manifest = getOptionValue('--experimental-policy') ? // require('internal/process/policy').manifest : // null; // disabled for now. I am not sure if/how we should support this manifest = null; } if (manifest !== null) { const jsonURL = pathToFileURL(jsonPath); manifest.assertIntegrity(jsonURL, string); } } cache.set(jsonPath, result); return result; } module.exports = { read }; ts-node-10.9.2/dist-raw/node-internal-repl-await.js000066400000000000000000000175421453460306300220630ustar00rootroot00000000000000// copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/lib/internal/repl/await.js 'use strict'; const { ArrayFrom, ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypePop, ArrayPrototypePush, FunctionPrototype, ObjectKeys, RegExpPrototypeSymbolReplace, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeIndexOf, StringPrototypeRepeat, StringPrototypeSplit, StringPrototypeStartsWith, SyntaxError, } = require('./node-primordials'); const parser = require('acorn').Parser; const walk = require('acorn-walk'); const { Recoverable } = require('repl'); function isTopLevelDeclaration(state) { return state.ancestors[state.ancestors.length - 2] === state.body; } const noop = FunctionPrototype; const visitorsWithoutAncestors = { ClassDeclaration(node, state, c) { if (isTopLevelDeclaration(state)) { state.prepend(node, `${node.id.name}=`); ArrayPrototypePush( state.hoistedDeclarationStatements, `let ${node.id.name}; ` ); } walk.base.ClassDeclaration(node, state, c); }, ForOfStatement(node, state, c) { if (node.await === true) { state.containsAwait = true; } walk.base.ForOfStatement(node, state, c); }, FunctionDeclaration(node, state, c) { state.prepend(node, `${node.id.name}=`); ArrayPrototypePush( state.hoistedDeclarationStatements, `var ${node.id.name}; ` ); }, FunctionExpression: noop, ArrowFunctionExpression: noop, MethodDefinition: noop, AwaitExpression(node, state, c) { state.containsAwait = true; walk.base.AwaitExpression(node, state, c); }, ReturnStatement(node, state, c) { state.containsReturn = true; walk.base.ReturnStatement(node, state, c); }, VariableDeclaration(node, state, c) { const variableKind = node.kind; const isIterableForDeclaration = ArrayPrototypeIncludes( ['ForOfStatement', 'ForInStatement'], state.ancestors[state.ancestors.length - 2].type ); if (variableKind === 'var' || isTopLevelDeclaration(state)) { state.replace( node.start, node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0), variableKind === 'var' && isIterableForDeclaration ? '' : 'void' + (node.declarations.length === 1 ? '' : ' (') ); if (!isIterableForDeclaration) { ArrayPrototypeForEach(node.declarations, (decl) => { state.prepend(decl, '('); state.append(decl, decl.init ? ')' : '=undefined)'); }); if (node.declarations.length !== 1) { state.append(node.declarations[node.declarations.length - 1], ')'); } } const variableIdentifiersToHoist = [ ['var', []], ['let', []], ]; function registerVariableDeclarationIdentifiers(node) { switch (node.type) { case 'Identifier': ArrayPrototypePush( variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1], node.name ); break; case 'ObjectPattern': ArrayPrototypeForEach(node.properties, (property) => { registerVariableDeclarationIdentifiers(property.value); }); break; case 'ArrayPattern': ArrayPrototypeForEach(node.elements, (element) => { registerVariableDeclarationIdentifiers(element); }); break; } } ArrayPrototypeForEach(node.declarations, (decl) => { registerVariableDeclarationIdentifiers(decl.id); }); ArrayPrototypeForEach( variableIdentifiersToHoist, ({ 0: kind, 1: identifiers }) => { if (identifiers.length > 0) { ArrayPrototypePush( state.hoistedDeclarationStatements, `${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; ` ); } } ); } walk.base.VariableDeclaration(node, state, c); } }; const visitors = {}; for (const nodeType of ObjectKeys(walk.base)) { const callback = visitorsWithoutAncestors[nodeType] || walk.base[nodeType]; visitors[nodeType] = (node, state, c) => { const isNew = node !== state.ancestors[state.ancestors.length - 1]; if (isNew) { ArrayPrototypePush(state.ancestors, node); } callback(node, state, c); if (isNew) { ArrayPrototypePop(state.ancestors); } }; } function processTopLevelAwait(src) { const wrapPrefix = '(async () => { '; const wrapped = `${wrapPrefix}${src} })()`; const wrappedArray = ArrayFrom(wrapped); let root; try { root = parser.parse(wrapped, { ecmaVersion: 'latest' }); } catch (e) { if (StringPrototypeStartsWith(e.message, 'Unterminated ')) throw new Recoverable(e); // If the parse error is before the first "await", then use the execution // error. Otherwise we must emit this parse error, making it look like a // proper syntax error. const awaitPos = StringPrototypeIndexOf(src, 'await'); const errPos = e.pos - wrapPrefix.length; if (awaitPos > errPos) return null; // Convert keyword parse errors on await into their original errors when // possible. if (errPos === awaitPos + 6 && StringPrototypeIncludes(e.message, 'Expecting Unicode escape sequence')) return null; if (errPos === awaitPos + 7 && StringPrototypeIncludes(e.message, 'Unexpected token')) return null; const line = e.loc.line; const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column; let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' + StringPrototypeRepeat(' ', column) + '^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, ''); // V8 unexpected token errors include the token string. if (StringPrototypeEndsWith(message, 'Unexpected token')) message += " '" + // Wrapper end may cause acorn to report error position after the source ((src.length - 1) >= (e.pos - wrapPrefix.length) ? src[e.pos - wrapPrefix.length] : src[src.length - 1]) + "'"; // eslint-disable-next-line no-restricted-syntax throw new SyntaxError(message); } const body = root.body[0].expression.callee.body; const state = { body, ancestors: [], hoistedDeclarationStatements: [], replace(from, to, str) { for (let i = from; i < to; i++) { wrappedArray[i] = ''; } if (from === to) str += wrappedArray[from]; wrappedArray[from] = str; }, prepend(node, str) { wrappedArray[node.start] = str + wrappedArray[node.start]; }, append(node, str) { wrappedArray[node.end - 1] += str; }, containsAwait: false, containsReturn: false }; walk.recursive(body, state, visitors); // Do not transform if // 1. False alarm: there isn't actually an await expression. // 2. There is a top-level return, which is not allowed. if (!state.containsAwait || state.containsReturn) { return null; } const last = body.body[body.body.length - 1]; if (last.type === 'ExpressionStatement') { // For an expression statement of the form // ( expr ) ; // ^^^^^^^^^^ // last // ^^^^ // last.expression // // We do not want the left parenthesis before the `return` keyword; // therefore we prepend the `return (` to `last`. // // On the other hand, we do not want the right parenthesis after the // semicolon. Since there can only be more right parentheses between // last.expression.end and the semicolon, appending one more to // last.expression should be fine. state.prepend(last, 'return ('); state.append(last.expression, ')'); } return ( ArrayPrototypeJoin(state.hoistedDeclarationStatements, '') + ArrayPrototypeJoin(wrappedArray, '') ); } module.exports = { processTopLevelAwait }; ts-node-10.9.2/dist-raw/node-internalBinding-fs.js000066400000000000000000000033411453460306300217110ustar00rootroot00000000000000const fs = require('fs'); const {versionGteLt} = require('../dist/util'); // In node's core, this is implemented in C // https://github.com/nodejs/node/blob/v15.3.0/src/node_file.cc#L891-L985 /** * @param {string} path * @returns {[] | [string, boolean]} */ function internalModuleReadJSON(path) { let string try { string = fs.readFileSync(path, 'utf8') } catch (e) { if (e.code === 'ENOENT') return [] throw e } // Node's implementation checks for the presence of relevant keys: main, name, type, exports, imports // Node does this for performance to skip unnecessary parsing. // This would slow us down and, based on our usage, we can skip it. const containsKeys = true return [string, containsKeys] } // In node's core, this is implemented in C // https://github.com/nodejs/node/blob/63e7dc1e5c71b70c80ed9eda230991edb00811e2/src/node_file.cc#L987-L1005 /** * @param {string} path * @returns {number} 0 = file, 1 = dir, negative = error */ function internalModuleStat(path) { const stat = fs.statSync(path, { throwIfNoEntry: false }); if(!stat) return -1; if(stat.isFile()) return 0; if(stat.isDirectory()) return 1; } /** * @param {string} path * @returns {number} 0 = file, 1 = dir, negative = error */ function internalModuleStatInefficient(path) { try { const stat = fs.statSync(path); if(stat.isFile()) return 0; if(stat.isDirectory()) return 1; } catch(e) { return -e.errno || -1; } } const statSupportsThrowIfNoEntry = versionGteLt(process.versions.node, '15.3.0') || versionGteLt(process.versions.node, '14.17.0', '15.0.0'); module.exports = { internalModuleReadJSON, internalModuleStat: statSupportsThrowIfNoEntry ? internalModuleStat : internalModuleStatInefficient }; ts-node-10.9.2/dist-raw/node-nativemodule.js000066400000000000000000000003661453460306300206740ustar00rootroot00000000000000 // Node imports this from 'internal/bootstrap/loaders' const Module = require('module'); const NativeModule = { canBeRequiredByUsers(specifier) { return Module.builtinModules.includes(specifier) } }; exports.NativeModule = NativeModule; ts-node-10.9.2/dist-raw/node-options.js000066400000000000000000000056541453460306300177000ustar00rootroot00000000000000// Replacement for node's internal 'internal/options' module exports.getOptionValue = getOptionValue; function getOptionValue(opt) { parseOptions(); return options[opt]; } let options; function parseOptions() { if (!options) { options = { '--preserve-symlinks': false, '--preserve-symlinks-main': false, '--input-type': undefined, '--experimental-specifier-resolution': 'explicit', '--experimental-policy': undefined, '--conditions': [], '--pending-deprecation': false, ...parseArgv(getNodeOptionsEnvArgv()), ...parseArgv(process.execArgv), ...getOptionValuesFromOtherEnvVars() } } } function parseArgv(argv) { return require('arg')({ '--preserve-symlinks': Boolean, '--preserve-symlinks-main': Boolean, '--input-type': String, '--experimental-specifier-resolution': String, // Legacy alias for node versions prior to 12.16 '--es-module-specifier-resolution': '--experimental-specifier-resolution', '--experimental-policy': String, '--conditions': [String], '--pending-deprecation': Boolean, '--experimental-json-modules': Boolean, '--experimental-wasm-modules': Boolean, }, { argv, permissive: true }); } function getNodeOptionsEnvArgv() { const errors = []; const envArgv = ParseNodeOptionsEnvVar(process.env.NODE_OPTIONS || '', errors); if (errors.length !== 0) { // TODO: handle errors somehow } return envArgv; } // Direct JS port of C implementation: https://github.com/nodejs/node/blob/67ba825037b4082d5d16f922fb9ce54516b4a869/src/node_options.cc#L1024-L1063 function ParseNodeOptionsEnvVar(node_options, errors) { const env_argv = []; let is_in_string = false; let will_start_new_arg = true; for (let index = 0; index < node_options.length; ++index) { let c = node_options[index]; // Backslashes escape the following character if (c === '\\' && is_in_string) { if (index + 1 === node_options.length) { errors.push("invalid value for NODE_OPTIONS " + "(invalid escape)\n"); return env_argv; } else { c = node_options[++index]; } } else if (c === ' ' && !is_in_string) { will_start_new_arg = true; continue; } else if (c === '"') { is_in_string = !is_in_string; continue; } if (will_start_new_arg) { env_argv.push(c); will_start_new_arg = false; } else { env_argv[env_argv.length - 1] += c; } } if (is_in_string) { errors.push("invalid value for NODE_OPTIONS " + "(unterminated string)\n"); } return env_argv; } // Get option values that can be specified via env vars besides NODE_OPTIONS function getOptionValuesFromOtherEnvVars() { const options = {}; if(process.env.NODE_PENDING_DEPRECATION === '1') { options['--pending-deprecation'] = true; } return options; } ts-node-10.9.2/dist-raw/node-primordials.js000066400000000000000000000044021453460306300205200ustar00rootroot00000000000000module.exports = { ArrayFrom: Array.from, ArrayIsArray: Array.isArray, ArrayPrototypeShift: (obj) => Array.prototype.shift.call(obj), ArrayPrototypeForEach: (arr, ...rest) => Array.prototype.forEach.apply(arr, rest), ArrayPrototypeIncludes: (arr, ...rest) => Array.prototype.includes.apply(arr, rest), ArrayPrototypeJoin: (arr, ...rest) => Array.prototype.join.apply(arr, rest), ArrayPrototypePop: (arr, ...rest) => Array.prototype.pop.apply(arr, rest), ArrayPrototypePush: (arr, ...rest) => Array.prototype.push.apply(arr, rest), FunctionPrototype: Function.prototype, JSONParse: JSON.parse, JSONStringify: JSON.stringify, ObjectFreeze: Object.freeze, ObjectKeys: Object.keys, ObjectGetOwnPropertyNames: Object.getOwnPropertyNames, ObjectDefineProperty: Object.defineProperty, ObjectPrototypeHasOwnProperty: (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop), RegExpPrototypeExec: (obj, string) => RegExp.prototype.exec.call(obj, string), RegExpPrototypeTest: (obj, string) => RegExp.prototype.test.call(obj, string), RegExpPrototypeSymbolReplace: (obj, ...rest) => RegExp.prototype[Symbol.replace].apply(obj, rest), SafeMap: Map, SafeSet: Set, SafeWeakMap: WeakMap, StringPrototypeEndsWith: (str, ...rest) => String.prototype.endsWith.apply(str, rest), StringPrototypeIncludes: (str, ...rest) => String.prototype.includes.apply(str, rest), StringPrototypeLastIndexOf: (str, ...rest) => String.prototype.lastIndexOf.apply(str, rest), StringPrototypeIndexOf: (str, ...rest) => String.prototype.indexOf.apply(str, rest), StringPrototypeRepeat: (str, ...rest) => String.prototype.repeat.apply(str, rest), StringPrototypeReplace: (str, ...rest) => String.prototype.replace.apply(str, rest), StringPrototypeSlice: (str, ...rest) => String.prototype.slice.apply(str, rest), StringPrototypeSplit: (str, ...rest) => String.prototype.split.apply(str, rest), StringPrototypeStartsWith: (str, ...rest) => String.prototype.startsWith.apply(str, rest), StringPrototypeSubstr: (str, ...rest) => String.prototype.substr.apply(str, rest), StringPrototypeCharCodeAt: (str, ...rest) => String.prototype.charCodeAt.apply(str, rest), StringPrototypeMatch: (str, ...rest) => String.prototype.match.apply(str, rest), SyntaxError: SyntaxError }; ts-node-10.9.2/dist-raw/runmain-hack.js000066400000000000000000000007231453460306300176270ustar00rootroot00000000000000const {pathToFileURL} = require('url'); // Hack to avoid Module.runMain on node 18.6.0 // Keeping it simple for now, isolated in this file. // Could theoretically probe `getFormat` impl to determine if `import()` or `Module._load()` is best // Note that I attempted a try-catch around `Module._load`, but it poisons some sort of cache such that subsequent `import()` is impossible. exports.run = function(entryPointPath) { import(pathToFileURL(entryPointPath)); } ts-node-10.9.2/dprint.json000066400000000000000000000016521453460306300153570ustar00rootroot00000000000000{ "incremental": true, "lineWidth": 80, "prettier": { "associations": [ "**/*.{ts,tsx,js,mjs,cjs,jsx,json,md}" ], "singleQuote": true }, // Run `dprint output-file-paths` to see which files are being matched "includes": [ "/*.{js,mjs}", "/esm/**", "/register/**", "/scripts/**", "/src/**", "/tests/**", "/website/**" ], "excludes": [ "/website/.docusaurus", "/website/build", "/website/docs", "/website/readme-sources", "/website/static", "tests/main-realpath/symlink/tsconfig.json", "tests/throw error.ts", "tests/throw error react tsx.tsx", "tests/esm/throw error.ts", "tests/legacy-source-map-support-interop/index.ts", "tests/main-realpath/symlink/symlink.tsx", "tests/tmp" ], "plugins": [ "https://plugins.dprint.dev/prettier-0.6.2.exe-plugin@36dd4f8b9710ab323c471017ecd00a20cf1dca2728c12242c7dabb8dfacad0e2" ] } ts-node-10.9.2/esm-usage-example/000077500000000000000000000000001453460306300164775ustar00rootroot00000000000000ts-node-10.9.2/esm-usage-example/README.md000066400000000000000000000004141453460306300177550ustar00rootroot00000000000000To run the experiment: ``` cd ./esm-usage-example # Must be in this directory node -v # Must be using node v13 # Install the github branch via npm npm install node --loader ts-node/esm ./index.js # Or if you're hacking locally node --loader ../esm.mjs ./index ``` ts-node-10.9.2/esm-usage-example/bar.ts000066400000000000000000000000301453460306300176040ustar00rootroot00000000000000export const bar = 123; ts-node-10.9.2/esm-usage-example/foo.ts000066400000000000000000000000641453460306300176320ustar00rootroot00000000000000export const foo = 123; export {bar} from './bar'; ts-node-10.9.2/esm-usage-example/index.js000066400000000000000000000001571453460306300201470ustar00rootroot00000000000000async function main() { const fooModule = await import('./foo.ts'); console.dir({foo: fooModule}) } main() ts-node-10.9.2/esm-usage-example/package.json000066400000000000000000000001741453460306300207670ustar00rootroot00000000000000{ "type": "module", "dependencies": { "ts-node": "github:TypeStrong/ts-node#main", "typescript": "^3.8.3" } } ts-node-10.9.2/esm-usage-example/tsconfig.json000066400000000000000000000000661453460306300212100ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext" } } ts-node-10.9.2/esm.mjs000066400000000000000000000004641453460306300144630ustar00rootroot00000000000000import { fileURLToPath } from 'url'; import { createRequire } from 'module'; const require = createRequire(fileURLToPath(import.meta.url)); /** @type {import('./dist/esm')} */ const esm = require('./dist/esm'); export const { resolve, load, getFormat, transformSource } = esm.registerAndCreateEsmHooks(); ts-node-10.9.2/esm/000077500000000000000000000000001453460306300137445ustar00rootroot00000000000000ts-node-10.9.2/esm/transpile-only.mjs000066400000000000000000000005151453460306300174400ustar00rootroot00000000000000import { fileURLToPath } from 'url'; import { createRequire } from 'module'; const require = createRequire(fileURLToPath(import.meta.url)); /** @type {import('../dist/esm')} */ const esm = require('../dist/esm'); export const { resolve, load, getFormat, transformSource } = esm.registerAndCreateEsmHooks({ transpileOnly: true }); ts-node-10.9.2/justfile000066400000000000000000000043751453460306300147410ustar00rootroot00000000000000# I like using `just` instead of `npm run` or `yarn`. # If you're like me, this justfile is for you. # If you are not, you can safely ignore this file. set positional-arguments export PATH := justfile_directory() + "/node_modules/.bin:" + env_var('PATH') default: test-local regenerate: #!/usr/bin/env sh node -e ' const fs = require("fs"); let acc = fs.readFileSync("justfile", "utf8").replace(/(# CUT\n)[\s\S]+/, "$1\n"); for(const [key, value] of Object.entries(require("./package.json").scripts)) { acc += `${key} *ARGS:\n ${value.replace(/npm run /g, "just ").replace(/ --$/, "")} "$@"\n`; } fs.writeFileSync("justfile", acc); ' install: npm install # EVERYTHING BELOW THIS LINE IS AUTO-GENERATED FROM PACKAGE.JSON # DO NOT MODIFY BY HAND # CUT lint *ARGS: dprint check "$@" lint-fix *ARGS: dprint fmt "$@" clean *ARGS: rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/tmp "$@" rebuild *ARGS: just clean && just build "$@" build *ARGS: just build-nopack && just build-pack "$@" build-nopack *ARGS: just build-tsc && just build-configSchema "$@" build-tsc *ARGS: tsc -b ./tsconfig.build-dist.json "$@" build-configSchema *ARGS: typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema "$@" build-pack *ARGS: node ./scripts/build-pack.js "$@" test-spec *ARGS: ava "$@" test-cov *ARGS: nyc ava "$@" test *ARGS: just build && just lint && just test-cov "$@" test-local *ARGS: just lint-fix && just build-tsc && just build-pack && just test-spec "$@" pre-debug *ARGS: just build-tsc && just build-pack "$@" coverage-report *ARGS: nyc report --reporter=lcov "$@" prepare *ARGS: just clean && just build-nopack "$@" api-extractor *ARGS: api-extractor run --local --verbose "$@" esm-usage-example *ARGS: just build-tsc && cd esm-usage-example && node --experimental-specifier-resolution node --loader ../esm.mjs ./index "$@" esm-usage-example2 *ARGS: just build-tsc && cd tests && TS_NODE_PROJECT=./module-types/override-to-cjs/tsconfig.json node --loader ../esm.mjs ./module-types/override-to-cjs/test.cjs "$@" ts-node-10.9.2/logo-icon.svg000066400000000000000000000263251453460306300155770ustar00rootroot00000000000000 image/svg+xml ts-node-10.9.2/logo.svg000066400000000000000000000263101453460306300146430ustar00rootroot00000000000000 image/svg+xml ts-node-10.9.2/node10/000077500000000000000000000000001453460306300142465ustar00rootroot00000000000000ts-node-10.9.2/node10/tsconfig.json000066400000000000000000000000621453460306300167530ustar00rootroot00000000000000{ "extends": "@tsconfig/node10/tsconfig.json" } ts-node-10.9.2/node12/000077500000000000000000000000001453460306300142505ustar00rootroot00000000000000ts-node-10.9.2/node12/tsconfig.json000066400000000000000000000000631453460306300167560ustar00rootroot00000000000000{ "extends": "@tsconfig/node12/tsconfig.json", } ts-node-10.9.2/node14/000077500000000000000000000000001453460306300142525ustar00rootroot00000000000000ts-node-10.9.2/node14/tsconfig.json000066400000000000000000000000621453460306300167570ustar00rootroot00000000000000{ "extends": "@tsconfig/node14/tsconfig.json" } ts-node-10.9.2/node16/000077500000000000000000000000001453460306300142545ustar00rootroot00000000000000ts-node-10.9.2/node16/tsconfig.json000066400000000000000000000000621453460306300167610ustar00rootroot00000000000000{ "extends": "@tsconfig/node16/tsconfig.json" } ts-node-10.9.2/nyc.config.js000066400000000000000000000005571453460306300155620ustar00rootroot00000000000000module.exports = { all: true, include: ['tests/node_modules/ts-node/**'], exclude: ['**/*.d.ts', 'tests/node_modules/ts-node/node_modules/**'], // Very important that nyc does not add additional `require.extensions` hooks. // It affects module resolution behavior under test extension: ['.js'], excludeNodeModules: false, excludeAfterRemap: false, }; ts-node-10.9.2/package-lock.json000066400000000000000000007221071453460306300164050ustar00rootroot00000000000000{ "name": "ts-node", "version": "10.9.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ts-node", "version": "10.9.2", "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "bin": { "ts-node": "dist/bin.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, "devDependencies": { "@microsoft/api-extractor": "^7.19.4", "@swc/core": "^1.3.100", "@swc/wasm": "^1.3.100", "@types/diff": "^4.0.2", "@types/lodash": "^4.14.151", "@types/node": "13.13.5", "@types/proper-lockfile": "^4.1.2", "@types/proxyquire": "^1.3.28", "@types/react": "^16.14.19", "@types/rimraf": "^3.0.0", "@types/semver": "^7.1.0", "@yarnpkg/fslib": "^2.4.0", "ava": "^3.15.0", "axios": "^0.21.1", "dprint": "^0.25.0", "expect": "^27.0.2", "get-stream": "^6.0.0", "lodash": "^4.17.15", "ntypescript": "^1.201507091536.1", "nyc": "^15.0.1", "outdent": "^0.8.0", "proper-lockfile": "^4.1.2", "proxyquire": "^2.0.0", "react": "^16.14.0", "rimraf": "^3.0.0", "semver": "^7.1.3", "throat": "^6.0.1", "typedoc": "^0.22.10", "typescript": "4.7.4", "typescript-json-schema": "^0.53.0", "util.promisify": "^1.0.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "peerDependenciesMeta": { "@swc/core": { "optional": true }, "@swc/wasm": { "optional": true } } }, "node_modules/@babel/code-frame": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", "dev": true, "dependencies": { "@babel/highlight": "^7.12.13" } }, "node_modules/@babel/core": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.6.tgz", "integrity": "sha512-nD3deLvbsApbHAHttzIssYqgb883yU/d9roe4RZymBCDaZryMJDbptVpEpeQuRh4BJ+SYI8le9YGxKvFEvl1Wg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.8.3", "@babel/generator": "^7.9.6", "@babel/helper-module-transforms": "^7.9.0", "@babel/helpers": "^7.9.6", "@babel/parser": "^7.9.6", "@babel/template": "^7.8.6", "@babel/traverse": "^7.9.6", "@babel/types": "^7.9.6", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", "json5": "^2.1.2", "lodash": "^4.17.13", "resolve": "^1.3.2", "semver": "^5.4.1", "source-map": "^0.5.0" }, "engines": { "node": ">=6.9.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/babel" } }, "node_modules/@babel/core/node_modules/debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/@babel/core/node_modules/resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "dependencies": { "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@babel/core/node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, "bin": { "semver": "bin/semver" } }, "node_modules/@babel/core/node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/@babel/generator": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.6.tgz", "integrity": "sha512-+htwWKJbH2bL72HRluF8zumBxzuX0ZZUFl3JLNyoUjM/Ho8wnVpPXM6aUz8cfKDqQ/h7zHqKt4xzJteUosckqQ==", "dev": true, "dependencies": { "@babel/types": "^7.9.6", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" } }, "node_modules/@babel/generator/node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/@babel/helper-function-name": { "version": "7.9.5", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz", "integrity": "sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==", "dev": true, "dependencies": { "@babel/helper-get-function-arity": "^7.8.3", "@babel/template": "^7.8.3", "@babel/types": "^7.9.5" } }, "node_modules/@babel/helper-get-function-arity": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", "dev": true, "dependencies": { "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-member-expression-to-functions": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz", "integrity": "sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA==", "dev": true, "dependencies": { "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-module-imports": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz", "integrity": "sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg==", "dev": true, "dependencies": { "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-module-transforms": { "version": "7.9.0", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.9.0.tgz", "integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.8.3", "@babel/helper-replace-supers": "^7.8.6", "@babel/helper-simple-access": "^7.8.3", "@babel/helper-split-export-declaration": "^7.8.3", "@babel/template": "^7.8.6", "@babel/types": "^7.9.0", "lodash": "^4.17.13" } }, "node_modules/@babel/helper-optimise-call-expression": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz", "integrity": "sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ==", "dev": true, "dependencies": { "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-replace-supers": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.9.6.tgz", "integrity": "sha512-qX+chbxkbArLyCImk3bWV+jB5gTNU/rsze+JlcF6Nf8tVTigPJSI1o1oBow/9Resa1yehUO9lIipsmu9oG4RzA==", "dev": true, "dependencies": { "@babel/helper-member-expression-to-functions": "^7.8.3", "@babel/helper-optimise-call-expression": "^7.8.3", "@babel/traverse": "^7.9.6", "@babel/types": "^7.9.6" } }, "node_modules/@babel/helper-simple-access": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz", "integrity": "sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw==", "dev": true, "dependencies": { "@babel/template": "^7.8.3", "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", "dev": true, "dependencies": { "@babel/types": "^7.8.3" } }, "node_modules/@babel/helper-validator-identifier": { "version": "7.14.0", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==", "dev": true }, "node_modules/@babel/helpers": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.9.6.tgz", "integrity": "sha512-tI4bUbldloLcHWoRUMAj4g1bF313M/o6fBKhIsb3QnGVPwRm9JsNf/gqMkQ7zjqReABiffPV6RWj7hEglID5Iw==", "dev": true, "dependencies": { "@babel/template": "^7.8.3", "@babel/traverse": "^7.9.6", "@babel/types": "^7.9.6" } }, "node_modules/@babel/highlight": { "version": "7.14.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.14.0", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/@babel/highlight/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "dependencies": { "has-flag": "^3.0.0" }, "engines": { "node": ">=4" } }, "node_modules/@babel/parser": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.6.tgz", "integrity": "sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q==", "dev": true, "bin": { "parser": "bin/babel-parser.js" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/template": { "version": "7.8.6", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.8.3", "@babel/parser": "^7.8.6", "@babel/types": "^7.8.6" } }, "node_modules/@babel/traverse": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.6.tgz", "integrity": "sha512-b3rAHSjbxy6VEAvlxM8OV/0X4XrG72zoxme6q1MOoe2vd0bEc+TwayhuC1+Dfgqh1QEG+pj7atQqvUprHIccsg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.8.3", "@babel/generator": "^7.9.6", "@babel/helper-function-name": "^7.9.5", "@babel/helper-split-export-declaration": "^7.8.3", "@babel/parser": "^7.9.6", "@babel/types": "^7.9.6", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" } }, "node_modules/@babel/traverse/node_modules/debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/@babel/types": { "version": "7.9.6", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.6.tgz", "integrity": "sha512-qxXzvBO//jO9ZnoasKF1uJzHd2+M6Q2ZPIVfnFps8JJvXy0ZBbwbNOmE6SGIY5XOY6d1Bo5lb9d9RJ8nv3WSeA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.9.5", "lodash": "^4.17.13", "to-fast-properties": "^2.0.0" } }, "node_modules/@concordance/react": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@concordance/react/-/react-2.0.0.tgz", "integrity": "sha512-huLSkUuM2/P+U0uy2WwlKuixMsTODD8p4JVQBI4VKeopkiN0C7M3N9XYVawb4M+4spN5RrO/eLhk7KoQX6nsfA==", "dev": true, "dependencies": { "arrify": "^1.0.1" }, "engines": { "node": ">=6.12.3 <7 || >=8.9.4 <9 || >=10.0.0" } }, "node_modules/@concordance/react/node_modules/arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/@cspotcode/source-map-consumer": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", "dev": true, "engines": { "node": ">= 12" } }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.0.tgz", "integrity": "sha512-pOQRG+w/T1KogjiuO4uqqa+dw/IIb8kDY0ctYfiJstWv7TOTmtuAkx8ZB4YgauDNn2huHR33oruOgi45VcatOg==", "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, "engines": { "node": ">=12" } }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", "dev": true, "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", "js-yaml": "^3.13.1", "resolve-from": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { "p-locate": "^4.1.0" }, "engines": { "node": ">=8" } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { "p-limit": "^2.2.0" }, "engines": { "node": ">=8" } }, "node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/@istanbuljs/schema": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/@jest/types": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.0.2.tgz", "integrity": "sha512-XpjCtJ/99HB4PmyJ2vgmN7vT+JLP7RW1FBT9RgnMFS4Dt7cvIyBee8O3/j98aUZ34ZpenPZFqmaaObWSeL65dg==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", "@types/yargs": "^16.0.0", "chalk": "^4.0.0" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/@jridgewell/resolve-uri": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.11", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "node_modules/@microsoft/api-extractor": { "version": "7.19.4", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.19.4.tgz", "integrity": "sha512-iehC6YA3DGJvxTUaK7HUtQmP6hAQU07+Q/OR8TG4dVR6KpqCi9UPEVk8AgCvQkiK+6FbVEFQTx0qLuYk4EeuHg==", "dev": true, "dependencies": { "@microsoft/api-extractor-model": "7.15.3", "@microsoft/tsdoc": "0.13.2", "@microsoft/tsdoc-config": "~0.15.2", "@rushstack/node-core-library": "3.45.0", "@rushstack/rig-package": "0.3.7", "@rushstack/ts-command-line": "4.10.6", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", "typescript": "~4.5.2" }, "bin": { "api-extractor": "bin/api-extractor" } }, "node_modules/@microsoft/api-extractor-model": { "version": "7.15.3", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz", "integrity": "sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.13.2", "@microsoft/tsdoc-config": "~0.15.2", "@rushstack/node-core-library": "3.45.0" } }, "node_modules/@microsoft/api-extractor/node_modules/resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "dependencies": { "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@microsoft/api-extractor/node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/@microsoft/api-extractor/node_modules/typescript": { "version": "4.5.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/@microsoft/tsdoc": { "version": "0.13.2", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz", "integrity": "sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==", "dev": true }, "node_modules/@microsoft/tsdoc-config": { "version": "0.15.2", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz", "integrity": "sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==", "dev": true, "dependencies": { "@microsoft/tsdoc": "0.13.2", "ajv": "~6.12.6", "jju": "~1.4.0", "resolve": "~1.19.0" } }, "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "dev": true, "dependencies": { "is-core-module": "^2.1.0", "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", "dev": true, "dependencies": { "@nodelib/fs.stat": "2.0.4", "run-parallel": "^1.1.9" }, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.stat": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", "dev": true, "engines": { "node": ">= 8" } }, "node_modules/@nodelib/fs.walk": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", "dev": true, "dependencies": { "@nodelib/fs.scandir": "2.1.4", "fastq": "^1.6.0" }, "engines": { "node": ">= 8" } }, "node_modules/@rushstack/node-core-library": { "version": "3.45.0", "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz", "integrity": "sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw==", "dev": true, "dependencies": { "@types/node": "12.20.24", "colors": "~1.2.1", "fs-extra": "~7.0.1", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.17.0", "semver": "~7.3.0", "timsort": "~0.3.0", "z-schema": "~5.0.2" } }, "node_modules/@rushstack/node-core-library/node_modules/@types/node": { "version": "12.20.24", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.24.tgz", "integrity": "sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==", "dev": true }, "node_modules/@rushstack/node-core-library/node_modules/import-lazy": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/@rushstack/node-core-library/node_modules/resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "dependencies": { "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@rushstack/node-core-library/node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/@rushstack/rig-package": { "version": "0.3.7", "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.7.tgz", "integrity": "sha512-pzMsTSeTC8IiZ6EJLr53gGMvhT4oLWH+hxD7907cHyWuIUlEXFtu/2pK25vUQT13nKp5DJCWxXyYoGRk/h6rtA==", "dev": true, "dependencies": { "resolve": "~1.17.0", "strip-json-comments": "~3.1.1" } }, "node_modules/@rushstack/rig-package/node_modules/resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "dependencies": { "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/@rushstack/rig-package/node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@rushstack/ts-command-line": { "version": "4.10.6", "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.10.6.tgz", "integrity": "sha512-Y3GkUag39sTIlukDg9mUp8MCHrrlJ27POrBNRQGc/uF+VVgX8M7zMzHch5zP6O1QVquWgD7Engdpn2piPYaS/g==", "dev": true, "dependencies": { "@types/argparse": "1.0.38", "argparse": "~1.0.9", "colors": "~1.2.1", "string-argv": "~0.3.1" } }, "node_modules/@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/@swc/core": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.100.tgz", "integrity": "sha512-7dKgTyxJjlrMwFZYb1auj3Xq0D8ZBe+5oeIgfMlRU05doXZypYJe0LAk0yjj3WdbwYzpF+T1PLxwTWizI0pckw==", "dev": true, "hasInstallScript": true, "dependencies": { "@swc/counter": "^0.1.1", "@swc/types": "^0.1.5" }, "engines": { "node": ">=10" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/swc" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.3.100", "@swc/core-darwin-x64": "1.3.100", "@swc/core-linux-arm64-gnu": "1.3.100", "@swc/core-linux-arm64-musl": "1.3.100", "@swc/core-linux-x64-gnu": "1.3.100", "@swc/core-linux-x64-musl": "1.3.100", "@swc/core-win32-arm64-msvc": "1.3.100", "@swc/core-win32-ia32-msvc": "1.3.100", "@swc/core-win32-x64-msvc": "1.3.100" }, "peerDependencies": { "@swc/helpers": "^0.5.0" }, "peerDependenciesMeta": { "@swc/helpers": { "optional": true } } }, "node_modules/@swc/core-darwin-arm64": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.100.tgz", "integrity": "sha512-XVWFsKe6ei+SsDbwmsuRkYck1SXRpO60Hioa4hoLwR8fxbA9eVp6enZtMxzVVMBi8ej5seZ4HZQeAWepbukiBw==", "cpu": [ "arm64" ], "dev": true, "optional": true, "os": [ "darwin" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-darwin-x64": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.100.tgz", "integrity": "sha512-KF/MXrnH1nakm1wbt4XV8FS7kvqD9TGmVxeJ0U4bbvxXMvzeYUurzg3AJUTXYmXDhH/VXOYJE5N5RkwZZPs5iA==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "darwin" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-linux-arm64-gnu": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.100.tgz", "integrity": "sha512-p8hikNnAEJrw5vHCtKiFT4hdlQxk1V7vqPmvUDgL/qe2menQDK/i12tbz7/3BEQ4UqUPnvwpmVn2d19RdEMNxw==", "cpu": [ "arm64" ], "dev": true, "optional": true, "os": [ "linux" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-linux-arm64-musl": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.100.tgz", "integrity": "sha512-BWx/0EeY89WC4q3AaIaBSGfQxkYxIlS3mX19dwy2FWJs/O+fMvF9oLk/CyJPOZzbp+1DjGeeoGFuDYpiNO91JA==", "cpu": [ "arm64" ], "dev": true, "optional": true, "os": [ "linux" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-linux-x64-gnu": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.100.tgz", "integrity": "sha512-XUdGu3dxAkjsahLYnm8WijPfKebo+jHgHphDxaW0ovI6sTdmEGFDew7QzKZRlbYL2jRkUuuKuDGvD6lO5frmhA==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "linux" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-linux-x64-musl": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.100.tgz", "integrity": "sha512-PhoXKf+f0OaNW/GCuXjJ0/KfK9EJX7z2gko+7nVnEA0p3aaPtbP6cq1Ubbl6CMoPL+Ci3gZ7nYumDqXNc3CtLQ==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "linux" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-win32-arm64-msvc": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.100.tgz", "integrity": "sha512-PwLADZN6F9cXn4Jw52FeP/MCLVHm8vwouZZSOoOScDtihjY495SSjdPnlosMaRSR4wJQssGwiD/4MbpgQPqbAw==", "cpu": [ "arm64" ], "dev": true, "optional": true, "os": [ "win32" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-win32-ia32-msvc": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.100.tgz", "integrity": "sha512-0f6nicKSLlDKlyPRl2JEmkpBV4aeDfRQg6n8mPqgL7bliZIcDahG0ej+HxgNjZfS3e0yjDxsNRa6sAqWU2Z60A==", "cpu": [ "ia32" ], "dev": true, "optional": true, "os": [ "win32" ], "engines": { "node": ">=10" } }, "node_modules/@swc/core-win32-x64-msvc": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.100.tgz", "integrity": "sha512-b7J0rPoMkRTa3XyUGt8PwCaIBuYWsL2DqbirrQKRESzgCvif5iNpqaM6kjIjI/5y5q1Ycv564CB51YDpiS8EtQ==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ "win32" ], "engines": { "node": ">=10" } }, "node_modules/@swc/counter": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", "dev": true }, "node_modules/@swc/types": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==", "dev": true }, "node_modules/@swc/wasm": { "version": "1.3.100", "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.3.100.tgz", "integrity": "sha512-rCi5+dUBta1jgrT5xGeAIY8yeJ/o/8PSFmcpsTVe2I2aSXkcHX2c1G1/tS86O65rMlwEiBmGvm1txEMG89me6Q==", "dev": true }, "node_modules/@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", "dev": true, "dependencies": { "defer-to-connect": "^1.0.1" }, "engines": { "node": ">=6" } }, "node_modules/@tsconfig/node10": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.7.tgz", "integrity": "sha512-aBvUmXLQbayM4w3A8TrjwrXs4DZ8iduJnuJLLRGdkWlyakCf1q6uHZJBzXoRA/huAEknG5tcUyQxN3A+In5euQ==" }, "node_modules/@tsconfig/node12": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.7.tgz", "integrity": "sha512-dgasobK/Y0wVMswcipr3k0HpevxFJLijN03A8mYfEPvWvOs14v0ZlYTR4kIgMx8g4+fTyTFv8/jLCIfRqLDJ4A==" }, "node_modules/@tsconfig/node14": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.0.tgz", "integrity": "sha512-RKkL8eTdPv6t5EHgFKIVQgsDapugbuOptNd9OOunN/HAkzmmTnZELx1kNCK0rSdUYGmiFMM3rRQMAWiyp023LQ==" }, "node_modules/@tsconfig/node16": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" }, "node_modules/@types/argparse": { "version": "1.0.38", "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", "dev": true }, "node_modules/@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, "node_modules/@types/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/diff/-/diff-4.0.2.tgz", "integrity": "sha1-Lpu4n5rMOrAQjw89xNvc8v/4qZw=", "dev": true }, "node_modules/@types/emscripten": { "version": "1.39.4", "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.4.tgz", "integrity": "sha512-k3LLVMFrdNA9UCvMDPWMbFrGPNb+GcPyw29ktJTo1RCN7RmxFG5XzPZcPKRlnLuLT/FRm8wp4ohvDwNY7GlROQ==", "dev": true }, "node_modules/@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", "dev": true }, "node_modules/@types/glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", "dev": true, "dependencies": { "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", "dev": true }, "node_modules/@types/istanbul-lib-report": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "*" } }, "node_modules/@types/istanbul-reports": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", "dev": true, "dependencies": { "@types/istanbul-lib-report": "*" } }, "node_modules/@types/json-schema": { "version": "7.0.9", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, "node_modules/@types/lodash": { "version": "4.14.151", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.151.tgz", "integrity": "sha512-Zst90IcBX5wnwSu7CAS0vvJkTjTELY4ssKbHiTnGcJgi170uiS8yQDdc3v6S77bRqYQIN1App5a1Pc2lceE5/g==", "dev": true }, "node_modules/@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, "node_modules/@types/node": { "version": "13.13.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz", "integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==", "dev": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", "dev": true }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==", "dev": true }, "node_modules/@types/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/@types/proper-lockfile/-/proper-lockfile-4.1.2.tgz", "integrity": "sha512-kd4LMvcnpYkspDcp7rmXKedn8iJSCoa331zRRamUp5oanKt/CefbEGPQP7G89enz7sKD4bvsr8mHSsC8j5WOvA==", "dev": true, "dependencies": { "@types/retry": "*" } }, "node_modules/@types/proxyquire": { "version": "1.3.28", "resolved": "https://registry.npmjs.org/@types/proxyquire/-/proxyquire-1.3.28.tgz", "integrity": "sha1-BaZHuw2P5I/I7cwZPkPMeTEPqn0=", "dev": true }, "node_modules/@types/react": { "version": "16.14.26", "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.26.tgz", "integrity": "sha512-c/5CYyciOO4XdFcNhZW1O2woVx86k4T+DO2RorHZL7EhitkNQgSD/SgpdZJAUJa/qjVgOmTM44gHkAdZSXeQuQ==", "dev": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", "csstype": "^3.0.2" } }, "node_modules/@types/retry": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.1.tgz", "integrity": "sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==", "dev": true }, "node_modules/@types/rimraf": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.0.tgz", "integrity": "sha512-7WhJ0MdpFgYQPXlF4Dx+DhgvlPCfz/x5mHaeDQAKhcenvQP1KCpLQ18JklAqeGMYSAT2PxLpzd0g2/HE7fj7hQ==", "dev": true, "dependencies": { "@types/glob": "*", "@types/node": "*" } }, "node_modules/@types/scheduler": { "version": "0.16.2", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz", "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "dev": true }, "node_modules/@types/semver": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.1.0.tgz", "integrity": "sha1-yMYw1MGM0ya+/3dASIdZb5ZAhAg=", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/stack-utils": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.0.tgz", "integrity": "sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==", "dev": true }, "node_modules/@types/yargs": { "version": "16.0.3", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.3.tgz", "integrity": "sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { "version": "20.2.0", "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.0.tgz", "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, "node_modules/@yarnpkg/fslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@yarnpkg/fslib/-/fslib-2.4.0.tgz", "integrity": "sha512-CwffYY9owtl3uImNOn1K4jl5iIb/L16a9UZ9Q3lkBARk6tlUsPrNFX00eoUlFcLn49TTfd3zdN6higloGCyncw==", "dev": true, "dependencies": { "@yarnpkg/libzip": "^2.2.1", "tslib": "^1.13.0" }, "engines": { "node": ">=10.19.0" } }, "node_modules/@yarnpkg/libzip": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@yarnpkg/libzip/-/libzip-2.2.1.tgz", "integrity": "sha512-AYDJXrkzayoDd3ZlVgFJ+LyDX+Zj/cki3vxIpcYxejtgkl3aquVWOxlC0DD9WboBWsJFIP1MjrUbchLyh++/7A==", "dev": true, "dependencies": { "@types/emscripten": "^1.38.0", "tslib": "^1.13.0" }, "engines": { "node": ">=10.19.0" } }, "node_modules/acorn": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz", "integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==", "bin": { "acorn": "bin/acorn" }, "engines": { "node": ">=0.4.0" } }, "node_modules/acorn-walk": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.1.1.tgz", "integrity": "sha512-FbJdceMlPHEAWJOILDk1fXD8lnTlEIWFkqtfk+MvmL5q/qlHfN7GEHcsFZWt/Tea9jRNPWUZG4G976nqAAmU9w==", "engines": { "node": ">=0.4.0" } }, "node_modules/aggregate-error": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", "dev": true, "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/epoberezkin" } }, "node_modules/ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", "dev": true, "dependencies": { "string-width": "^3.0.0" } }, "node_modules/ansi-align/node_modules/ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/ansi-align/node_modules/string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" }, "engines": { "node": ">=6" } }, "node_modules/ansi-align/node_modules/strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "dependencies": { "ansi-regex": "^4.1.0" }, "engines": { "node": ">=6" } }, "node_modules/ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=", "dev": true, "dependencies": { "color-convert": "^1.9.0" }, "engines": { "node": ">=4" } }, "node_modules/anymatch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" }, "engines": { "node": ">= 8" } }, "node_modules/append-transform": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", "dev": true, "dependencies": { "default-require-extensions": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, "node_modules/arg": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==" }, "node_modules/argparse": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } }, "node_modules/array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/arrgv": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/arrgv/-/arrgv-1.0.2.tgz", "integrity": "sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==", "dev": true, "engines": { "node": ">=8.0.0" } }, "node_modules/arrify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ava": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/ava/-/ava-3.15.0.tgz", "integrity": "sha512-HGAnk1SHPk4Sx6plFAUkzV/XC1j9+iQhOzt4vBly18/yo0AV8Oytx7mtJd/CR8igCJ5p160N/Oo/cNJi2uSeWA==", "dev": true, "dependencies": { "@concordance/react": "^2.0.0", "acorn": "^8.0.4", "acorn-walk": "^8.0.0", "ansi-styles": "^5.0.0", "arrgv": "^1.0.2", "arrify": "^2.0.1", "callsites": "^3.1.0", "chalk": "^4.1.0", "chokidar": "^3.4.3", "chunkd": "^2.0.1", "ci-info": "^2.0.0", "ci-parallel-vars": "^1.0.1", "clean-yaml-object": "^0.1.0", "cli-cursor": "^3.1.0", "cli-truncate": "^2.1.0", "code-excerpt": "^3.0.0", "common-path-prefix": "^3.0.0", "concordance": "^5.0.1", "convert-source-map": "^1.7.0", "currently-unhandled": "^0.4.1", "debug": "^4.3.1", "del": "^6.0.0", "emittery": "^0.8.0", "equal-length": "^1.0.0", "figures": "^3.2.0", "globby": "^11.0.1", "ignore-by-default": "^2.0.0", "import-local": "^3.0.2", "indent-string": "^4.0.0", "is-error": "^2.2.2", "is-plain-object": "^5.0.0", "is-promise": "^4.0.0", "lodash": "^4.17.20", "matcher": "^3.0.0", "md5-hex": "^3.0.1", "mem": "^8.0.0", "ms": "^2.1.3", "ora": "^5.2.0", "p-event": "^4.2.0", "p-map": "^4.0.0", "picomatch": "^2.2.2", "pkg-conf": "^3.1.0", "plur": "^4.0.0", "pretty-ms": "^7.0.1", "read-pkg": "^5.2.0", "resolve-cwd": "^3.0.0", "slash": "^3.0.0", "source-map-support": "^0.5.19", "stack-utils": "^2.0.3", "strip-ansi": "^6.0.0", "supertap": "^2.0.0", "temp-dir": "^2.0.0", "trim-off-newlines": "^1.0.1", "update-notifier": "^5.0.1", "write-file-atomic": "^3.0.3", "yargs": "^16.2.0" }, "bin": { "ava": "cli.js" }, "engines": { "node": ">=10.18.0 <11 || >=12.14.0 <12.17.0 || >=12.17.0 <13 || >=14.0.0 <15 || >=15" } }, "node_modules/ava/node_modules/ansi-styles": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.1.0.tgz", "integrity": "sha512-osxifZo3ar56+e8tdYreU6p8FZGciBHo5O0JoDAxMUqZuyNUb+yHEwYtJZ+Z32R459jEgtwVf1u8D7qYwU0l6w==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/ava/node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "node_modules/ava/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/ava/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/ava/node_modules/debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" }, "peerDependenciesMeta": { "supports-color": { "optional": true } } }, "node_modules/ava/node_modules/debug/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, "node_modules/ava/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/ava/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ava/node_modules/lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "dev": true }, "node_modules/ava/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/ava/node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, "dependencies": { "aggregate-error": "^3.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ava/node_modules/string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/ava/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/ava/node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/ava/node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/ava/node_modules/y18n": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/ava/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" }, "engines": { "node": ">=10" } }, "node_modules/ava/node_modules/yargs-parser": { "version": "20.2.5", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.5.tgz", "integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/axios": { "version": "0.21.1", "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "dev": true, "dependencies": { "follow-redirects": "^1.10.0" } }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "node_modules/bl/node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "node_modules/blueimp-md5": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.18.0.tgz", "integrity": "sha512-vE52okJvzsVWhcgUHOv+69OG3Mdg151xyn41aVQN/5W5S+S43qZhxECtYLAEHMSFWX6Mv5IZrzj3T5+JqXfj5Q==", "dev": true }, "node_modules/boxen": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.0.0.tgz", "integrity": "sha512-5bvsqw+hhgUi3oYGK0Vf4WpIkyemp60WBInn7+WNfoISzAqk/HX4L7WNROq38E6UR/y3YADpv6pEm4BfkeEAdA==", "dev": true, "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", "string-width": "^4.2.0", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/boxen/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/boxen/node_modules/camelcase": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/boxen/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/boxen/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/boxen/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/boxen/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/boxen/node_modules/string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/boxen/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/boxen/node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/boxen/node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, "dependencies": { "fill-range": "^7.0.1" }, "engines": { "node": ">=8" } }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=", "dev": true }, "node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", "dev": true, "dependencies": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", "http-cache-semantics": "^4.0.0", "keyv": "^3.0.0", "lowercase-keys": "^2.0.0", "normalize-url": "^4.1.0", "responselike": "^1.0.2" }, "engines": { "node": ">=8" } }, "node_modules/cacheable-request/node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "dependencies": { "pump": "^3.0.0" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cacheable-request/node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", "dev": true, "dependencies": { "hasha": "^5.0.0", "make-dir": "^3.0.0", "package-hash": "^4.0.0", "write-file-atomic": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA=", "dev": true, "engines": { "node": ">=6" } }, "node_modules/chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/chalk/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/chalk/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/chalk/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/chokidar": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "dev": true, "dependencies": { "anymatch": "~3.1.1", "braces": "~3.0.2", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.5.0" }, "engines": { "node": ">= 8.10.0" }, "optionalDependencies": { "fsevents": "~2.3.1" } }, "node_modules/chunkd": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/chunkd/-/chunkd-2.0.1.tgz", "integrity": "sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==", "dev": true }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, "node_modules/ci-parallel-vars": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ci-parallel-vars/-/ci-parallel-vars-1.0.1.tgz", "integrity": "sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==", "dev": true }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/clean-yaml-object": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz", "integrity": "sha1-Y/sRDcLOGoTcIfbZM0h20BCui2g=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/cli-boxes": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, "dependencies": { "restore-cursor": "^3.1.0" }, "engines": { "node": ">=8" } }, "node_modules/cli-spinners": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.5.0.tgz", "integrity": "sha512-PC+AmIuK04E6aeSs/pUccSujsTzBhu4HzC2dL+CfJB/Jcc2qTRbEwZQDfIUpt2Xl8BodYBEq8w4fc0kU2I9DjQ==", "dev": true, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cli-truncate": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", "dev": true, "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cli-truncate/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/cli-truncate/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/cli-truncate/node_modules/string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/cli-truncate/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "node_modules/clone": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true, "engines": { "node": ">=0.8" } }, "node_modules/clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", "dev": true, "dependencies": { "mimic-response": "^1.0.0" } }, "node_modules/code-excerpt": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-3.0.0.tgz", "integrity": "sha512-VHNTVhd7KsLGOqfX3SyeO8RyYPMp1GJOg194VITk04WMYCv4plV68YWe6TJZxd9MhobjtpMRnVky01gqZsalaw==", "dev": true, "dependencies": { "convert-to-spaces": "^1.0.1" }, "engines": { "node": ">=10" } }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=", "dev": true, "dependencies": { "color-name": "1.1.3" } }, "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "node_modules/colors": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", "dev": true, "engines": { "node": ">=0.1.90" } }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, "optional": true }, "node_modules/common-path-prefix": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", "dev": true }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "node_modules/concordance": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.2.tgz", "integrity": "sha512-hC63FKdGM9tBcd4VQIa+LQjmrgorrnxESb8B3J21Qe/FzL0blBv0pb8iNyymt+bmsvGSUqO0uhPi2ZSLgLtLdg==", "dev": true, "dependencies": { "date-time": "^3.1.0", "esutils": "^2.0.3", "fast-diff": "^1.2.0", "js-string-escape": "^1.0.1", "lodash": "^4.17.15", "md5-hex": "^3.0.1", "semver": "^7.3.2", "well-known-symbols": "^2.0.0" }, "engines": { "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" } }, "node_modules/concordance/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { "yallist": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/concordance/node_modules/semver": { "version": "7.3.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/concordance/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "node_modules/configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", "dev": true, "dependencies": { "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", "make-dir": "^3.0.0", "unique-string": "^2.0.0", "write-file-atomic": "^3.0.0", "xdg-basedir": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", "dev": true, "dependencies": { "safe-buffer": "~5.1.1" } }, "node_modules/convert-to-spaces": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-1.0.2.tgz", "integrity": "sha1-fj5Iu+bZl7FBfdyihoIEtNPYVxU=", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/create-require": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.0.tgz", "integrity": "sha512-yEFVS7dQjDXp5iOEtWisN4uFmL+pUTyIaEizKda9Eb77XX58p6pgFOLAPaBCP+IR6ZPZ1jgJLAuf+ABk0zXYBQ==" }, "node_modules/cross-spawn": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" }, "engines": { "node": ">= 8" } }, "node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" }, "engines": { "node": ">= 8" } }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/csstype": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz", "integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==", "dev": true }, "node_modules/currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", "dev": true, "dependencies": { "array-find-index": "^1.0.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/date-time": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", "dev": true, "dependencies": { "time-zone": "^1.0.0" }, "engines": { "node": ">=6" } }, "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", "dev": true, "dependencies": { "mimic-response": "^1.0.0" }, "engines": { "node": ">=4" } }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true, "engines": { "node": ">=4.0.0" } }, "node_modules/default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", "dev": true, "dependencies": { "strip-bom": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "dependencies": { "clone": "^1.0.2" } }, "node_modules/defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", "dev": true }, "node_modules/define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=", "dev": true, "dependencies": { "object-keys": "^1.0.12" }, "engines": { "node": ">= 0.4" } }, "node_modules/del": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/del/-/del-6.0.0.tgz", "integrity": "sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==", "dev": true, "dependencies": { "globby": "^11.0.1", "graceful-fs": "^4.2.4", "is-glob": "^4.0.1", "is-path-cwd": "^2.2.0", "is-path-inside": "^3.0.2", "p-map": "^4.0.0", "rimraf": "^3.0.2", "slash": "^3.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/del/node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, "dependencies": { "aggregate-error": "^3.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/del/node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/diff": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "engines": { "node": ">=0.3.1" } }, "node_modules/diff-sequences": { "version": "27.0.1", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.0.1.tgz", "integrity": "sha512-XPLijkfJUh/PIBnfkcSHgvD6tlYixmcMAn3osTk6jt+H0v/mgURto1XUiD9DKuGX5NDoVS6dSlA23gd9FUaCFg==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "dependencies": { "path-type": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "dev": true, "dependencies": { "is-obj": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/dprint": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.25.0.tgz", "integrity": "sha512-ISJu3EOYz9W24jMkBTotxdsSg4bvYhndaF+fvI9FzXjoT24WARCchcWf95IwCHMcHZVDd6gNoPfgGqzCpuT8Zg==", "dev": true, "hasInstallScript": true, "bin": { "dprint": "bin.js" } }, "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, "node_modules/emittery": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz", "integrity": "sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sindresorhus/emittery?sponsor=1" } }, "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY=", "dev": true }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, "dependencies": { "once": "^1.4.0" } }, "node_modules/equal-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/equal-length/-/equal-length-1.0.1.tgz", "integrity": "sha1-IcoRLUirJLTh5//A5TOdMf38J0w=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } }, "node_modules/es-abstract": { "version": "1.17.4", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", "dev": true, "dependencies": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", "is-callable": "^1.1.5", "is-regex": "^1.0.5", "object-inspect": "^1.7.0", "object-keys": "^1.1.1", "object.assign": "^4.1.0", "string.prototype.trimleft": "^2.1.1", "string.prototype.trimright": "^2.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha1-5VzUyc3BiLzvsDs2bHNjI/xciYo=", "dev": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", "is-symbol": "^1.0.2" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true, "engines": { "node": ">=0.8.0" } }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" }, "engines": { "node": ">=4" } }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/expect": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/expect/-/expect-27.0.2.tgz", "integrity": "sha512-YJFNJe2+P2DqH+ZrXy+ydRQYO87oxRUonZImpDodR1G7qo3NYd3pL+NQ9Keqpez3cehczYwZDBC3A7xk3n7M/w==", "dev": true, "dependencies": { "@jest/types": "^27.0.2", "ansi-styles": "^5.0.0", "jest-get-type": "^27.0.1", "jest-matcher-utils": "^27.0.2", "jest-message-util": "^27.0.2", "jest-regex-util": "^27.0.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/expect/node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "node_modules/fast-diff": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, "node_modules/fast-glob": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.0", "merge2": "^1.3.0", "micromatch": "^4.0.2", "picomatch": "^2.2.1" }, "engines": { "node": ">=8" } }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, "node_modules/fastq": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.10.1.tgz", "integrity": "sha512-AWuv6Ery3pM+dY7LYS8YIaCiQvUaos9OB1RyNgaOWnaX+Tik7Onvcsf8x8c+YtDeT0maYLniBip2hox5KtEXXA==", "dev": true, "dependencies": { "reusify": "^1.0.4" } }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, "dependencies": { "escape-string-regexp": "^1.0.5" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/fill-keys": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", "dev": true, "dependencies": { "is-object": "~1.0.1", "merge-descriptors": "~1.0.0" }, "engines": { "node": ">=0.10.0" } }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/find-cache-dir": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", "dev": true, "dependencies": { "commondir": "^1.0.1", "make-dir": "^3.0.2", "pkg-dir": "^4.1.0" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/avajs/find-cache-dir?sponsor=1" } }, "node_modules/find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=", "dev": true, "dependencies": { "locate-path": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/follow-redirects": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==", "dev": true, "funding": [ { "type": "individual", "url": "https://github.com/sponsors/RubenVerborgh" } ], "engines": { "node": ">=4.0" }, "peerDependenciesMeta": { "debug": { "optional": true } } }, "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", "dev": true, "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^3.0.2" }, "engines": { "node": ">=8.0.0" } }, "node_modules/fromentries": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.2.0.tgz", "integrity": "sha512-33X7H/wdfO99GdRLLgkjUrD4geAFdq/Uv0kl3HD4da6HDixd2GUg8Mw7dahLCV9r/EARkmtYBB6Tch4EEokFTQ==", "dev": true }, "node_modules/fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" }, "engines": { "node": ">=6 <7 || >=8" } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, "optional": true, "os": [ "darwin" ], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=", "dev": true }, "node_modules/gensync": { "version": "1.0.0-beta.1", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34=", "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } }, "node_modules/get-stream": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz", "integrity": "sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" } }, "node_modules/glob-parent": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dev": true, "dependencies": { "is-glob": "^4.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/global-dirs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", "dev": true, "dependencies": { "ini": "2.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/globby": { "version": "11.0.2", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", "dev": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.1.1", "ignore": "^5.1.4", "merge2": "^1.3.0", "slash": "^3.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", "dev": true, "dependencies": { "@sindresorhus/is": "^0.14.0", "@szmarczak/http-timer": "^1.1.2", "cacheable-request": "^6.0.0", "decompress-response": "^3.3.0", "duplexer3": "^0.1.4", "get-stream": "^4.1.0", "lowercase-keys": "^1.0.1", "mimic-response": "^1.0.1", "p-cancelable": "^1.0.0", "to-readable-stream": "^1.0.0", "url-parse-lax": "^3.0.0" }, "engines": { "node": ">=8.6" } }, "node_modules/got/node_modules/get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "dependencies": { "pump": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=", "dev": true, "dependencies": { "function-bind": "^1.1.1" }, "engines": { "node": ">= 0.4.0" } }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "integrity": "sha1-n1IUdYpEGWxAbZvXbOv4HsLdMeg=", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/hasha": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz", "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==", "dev": true, "dependencies": { "is-stream": "^2.0.0", "type-fest": "^0.8.0" }, "engines": { "node": ">=8" } }, "node_modules/hasha/node_modules/is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/hosted-git-info": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, "node_modules/http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "dev": true }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/ignore": { "version": "5.1.8", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/ignore-by-default": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-2.0.0.tgz", "integrity": "sha512-+mQSgMRiFD3L3AOxLYOCxjIq4OnAmo5CIuC+lj5ehCJcPtV++QacEV7FdpzvYxH6DaOySWzQU6RR0lPLy37ckA==", "dev": true, "engines": { "node": ">=10 <11 || >=12 <13 || >=14" } }, "node_modules/import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/import-local": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", "dev": true, "dependencies": { "pkg-dir": "^4.2.0", "resolve-cwd": "^3.0.0" }, "bin": { "import-local-fixture": "fixtures/cli.js" }, "engines": { "node": ">=8" } }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true, "engines": { "node": ">=0.8.19" } }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "node_modules/inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "node_modules/ini": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/irregular-plurals": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.2.0.tgz", "integrity": "sha512-YqTdPLfwP7YFN0SsD3QUVCkm9ZG2VzOXv3DOrw5G5mkMbVwptTwVcFv7/C0vOpBmgTxAeTG19XpUs1E522LW9Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/is-callable": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", "integrity": "sha1-9+RrWWiQRW23Tn9ul2yzJz0G+qs=", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", "dev": true, "dependencies": { "ci-info": "^2.0.0" }, "bin": { "is-ci": "bin.js" } }, "node_modules/is-core-module": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", "dev": true, "dependencies": { "has": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-date-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", "integrity": "sha1-vac28s2P0G0yhE53Q7+nSUw7/X4=", "dev": true, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-error": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-error/-/is-error-2.2.2.tgz", "integrity": "sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==", "dev": true }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, "engines": { "node": ">=0.10.0" } }, "node_modules/is-installed-globally": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", "dev": true, "dependencies": { "global-dirs": "^3.0.0", "is-path-inside": "^3.0.2" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-interactive": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-npm": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, "engines": { "node": ">=0.12.0" } }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", "dev": true }, "node_modules/is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/is-path-inside": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-promise": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "dev": true }, "node_modules/is-regex": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", "integrity": "sha1-OdWJo1i/GJZ/cmlnEguPwa7XTq4=", "dev": true, "dependencies": { "has": "^1.0.3" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", "integrity": "sha1-OOEBS55jKb4N6dJKQU/XRB7GGTc=", "dev": true, "dependencies": { "has-symbols": "^1.0.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", "dev": true }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "node_modules/istanbul-lib-coverage": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-hook": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", "dev": true, "dependencies": { "append-transform": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-instrument": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", "dev": true, "dependencies": { "@babel/core": "^7.7.5", "@istanbuljs/schema": "^0.1.2", "istanbul-lib-coverage": "^3.0.0", "semver": "^6.3.0" }, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/istanbul-lib-processinfo": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", "dev": true, "dependencies": { "archy": "^1.0.0", "cross-spawn": "^7.0.0", "istanbul-lib-coverage": "^3.0.0-alpha.1", "make-dir": "^3.0.0", "p-map": "^3.0.0", "rimraf": "^3.0.0", "uuid": "^3.3.3" }, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-report": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", "make-dir": "^3.0.0", "supports-color": "^7.1.0" }, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", "dev": true, "dependencies": { "debug": "^4.1.1", "istanbul-lib-coverage": "^3.0.0", "source-map": "^0.6.1" }, "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-source-maps/node_modules/debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)", "dev": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/istanbul-reports": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/jest-diff": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.0.2.tgz", "integrity": "sha512-BFIdRb0LqfV1hBt8crQmw6gGQHVDhM87SpMIZ45FPYKReZYG5er1+5pIn2zKqvrJp6WNox0ylR8571Iwk2Dmgw==", "dev": true, "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^27.0.1", "jest-get-type": "^27.0.1", "pretty-format": "^27.0.2" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-get-type": { "version": "27.0.1", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.0.1.tgz", "integrity": "sha512-9Tggo9zZbu0sHKebiAijyt1NM77Z0uO4tuWOxUCujAiSeXv30Vb5D4xVF4UR4YWNapcftj+PbByU54lKD7/xMg==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-matcher-utils": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.0.2.tgz", "integrity": "sha512-Qczi5xnTNjkhcIB0Yy75Txt+Ez51xdhOxsukN7awzq2auZQGPHcQrJ623PZj0ECDEMOk2soxWx05EXdXGd1CbA==", "dev": true, "dependencies": { "chalk": "^4.0.0", "jest-diff": "^27.0.2", "jest-get-type": "^27.0.1", "pretty-format": "^27.0.2" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-message-util": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.0.2.tgz", "integrity": "sha512-rTqWUX42ec2LdMkoUPOzrEd1Tcm+R1KfLOmFK+OVNo4MnLsEaxO5zPDb2BbdSmthdM/IfXxOZU60P/WbWF8BTw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", "@jest/types": "^27.0.2", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.4", "micromatch": "^4.0.4", "pretty-format": "^27.0.2", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jest-regex-util": { "version": "27.0.1", "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.0.1.tgz", "integrity": "sha512-6nY6QVcpTgEKQy1L41P4pr3aOddneK17kn3HJw6SdwGiKfgCGTvH02hVXL0GU8GEKtPH83eD2DIDgxHXOxVohQ==", "dev": true, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/jju": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", "dev": true }, "node_modules/js-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", "dev": true, "engines": { "node": ">= 0.8" } }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true, "bin": { "jsesc": "bin/jsesc" }, "engines": { "node": ">=4" } }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", "dev": true }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "node_modules/json5": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", "dev": true, "dependencies": { "minimist": "^1.2.5" }, "bin": { "json5": "lib/cli.js" }, "engines": { "node": ">=6" } }, "node_modules/jsonc-parser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", "dev": true }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", "dev": true, "dependencies": { "json-buffer": "3.0.0" } }, "node_modules/latest-version": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", "dev": true, "dependencies": { "package-json": "^6.3.0" }, "engines": { "node": ">=8" } }, "node_modules/lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, "node_modules/load-json-file": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "dependencies": { "graceful-fs": "^4.1.15", "parse-json": "^4.0.0", "pify": "^4.0.1", "strip-bom": "^3.0.0", "type-fest": "^0.3.0" }, "engines": { "node": ">=6" } }, "node_modules/load-json-file/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/load-json-file/node_modules/type-fest": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=", "dev": true, "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" }, "engines": { "node": ">=6" } }, "node_modules/lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "node_modules/lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", "dev": true }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "node_modules/lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { "yallist": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "dependencies": { "semver": "^6.0.0" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/make-dir/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/make-error": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz", "integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=" }, "node_modules/map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", "dev": true, "dependencies": { "p-defer": "^1.0.0" }, "engines": { "node": ">=6" } }, "node_modules/marked": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", "dev": true, "bin": { "marked": "bin/marked" }, "engines": { "node": ">= 12" } }, "node_modules/matcher": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", "dev": true, "dependencies": { "escape-string-regexp": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/matcher/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/md5-hex": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", "dev": true, "dependencies": { "blueimp-md5": "^2.10.0" }, "engines": { "node": ">=8" } }, "node_modules/mem": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/mem/-/mem-8.0.0.tgz", "integrity": "sha512-qrcJOe6uD+EW8Wrci1Vdiua/15Xw3n/QnaNXE7varnB6InxSk7nu3/i5jfy3S6kWxr8WYJ6R1o0afMUtvorTsA==", "dev": true, "dependencies": { "map-age-cleaner": "^0.1.3", "mimic-fn": "^3.1.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sindresorhus/mem?sponsor=1" } }, "node_modules/mem/node_modules/mimic-fn": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", "dev": true }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, "engines": { "node": ">= 8" } }, "node_modules/micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", "dev": true, "dependencies": { "braces": "^3.0.1", "picomatch": "^2.2.3" }, "engines": { "node": ">=8.6" } }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", "dev": true, "engines": { "node": ">=4" } }, "node_modules/minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, "engines": { "node": "*" } }, "node_modules/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "node_modules/module-not-found-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", "dev": true }, "node_modules/ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", "dev": true, "dependencies": { "process-on-spawn": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "node_modules/normalize-package-data/node_modules/resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", "dev": true, "dependencies": { "is-core-module": "^2.2.0", "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/normalize-package-data/node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, "bin": { "semver": "bin/semver" } }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/normalize-url": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/ntypescript": { "version": "1.201706190042.1", "resolved": "https://registry.npmjs.org/ntypescript/-/ntypescript-1.201706190042.1.tgz", "integrity": "sha1-hmrpzDZoixQWBhVu0LzDXN9TYnE=", "dev": true, "bin": { "ntsc": "bin/tsc" } }, "node_modules/nyc": { "version": "15.0.1", "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.0.1.tgz", "integrity": "sha512-n0MBXYBYRqa67IVt62qW1r/d9UH/Qtr7SF1w/nQLJ9KxvWF6b2xCHImRAixHN9tnMMYHC2P14uo6KddNGwMgGg==", "dev": true, "dependencies": { "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.2", "caching-transform": "^4.0.0", "convert-source-map": "^1.7.0", "decamelize": "^1.2.0", "find-cache-dir": "^3.2.0", "find-up": "^4.1.0", "foreground-child": "^2.0.0", "glob": "^7.1.6", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-hook": "^3.0.0", "istanbul-lib-instrument": "^4.0.0", "istanbul-lib-processinfo": "^2.0.2", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.0.2", "make-dir": "^3.0.0", "node-preload": "^0.2.1", "p-map": "^3.0.0", "process-on-spawn": "^1.0.0", "resolve-from": "^5.0.0", "rimraf": "^3.0.0", "signal-exit": "^3.0.2", "spawn-wrap": "^2.0.0", "test-exclude": "^6.0.0", "yargs": "^15.0.2" }, "bin": { "nyc": "bin/nyc.js" }, "engines": { "node": ">=8.9" } }, "node_modules/nyc/node_modules/ansi-styles": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "dev": true, "dependencies": { "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/nyc/node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "node_modules/nyc/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/nyc/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/nyc/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/nyc/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/nyc/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { "p-locate": "^4.1.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { "p-limit": "^2.2.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/yargs": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", "dev": true, "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.1" }, "engines": { "node": ">=8" } }, "node_modules/nyc/node_modules/yargs-parser": { "version": "18.1.3", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", "dev": true, "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" }, "engines": { "node": ">=6" } }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/object-inspect": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", "integrity": "sha1-9Pa9GBrXfwBrXs5gvQtvOY/3Smc=", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha1-HEfyct8nfzsdrwYWd9nILiMixg4=", "dev": true, "engines": { "node": ">= 0.4" } }, "node_modules/object.assign": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", "integrity": "sha1-lovxEA15Vrs8oIbwBvhGs7xACNo=", "dev": true, "dependencies": { "define-properties": "^1.1.2", "function-bind": "^1.1.1", "has-symbols": "^1.0.0", "object-keys": "^1.0.11" }, "engines": { "node": ">= 0.4" } }, "node_modules/object.getownpropertydescriptors": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", "integrity": "sha1-Npvx+VktiridcS3O1cuBx8U1Jkk=", "dev": true, "dependencies": { "define-properties": "^1.1.3", "es-abstract": "^1.17.0-next.1" }, "engines": { "node": ">= 0.8" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "dependencies": { "wrappy": "1" } }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ora": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ora/-/ora-5.3.0.tgz", "integrity": "sha512-zAKMgGXUim0Jyd6CXK9lraBnD3H5yPGBPPOkC23a2BG6hsm4Zu6OQSjQuEtV0BHDf4aKHcUFvJiGRrFuW3MG8g==", "dev": true, "dependencies": { "bl": "^4.0.3", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "log-symbols": "^4.0.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ora/node_modules/log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", "dev": true, "dependencies": { "chalk": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/ora/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/outdent": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/outdent/-/outdent-0.8.0.tgz", "integrity": "sha512-KiOAIsdpUTcAXuykya5fnVVT+/5uS0Q1mrkRHcF89tpieSmY33O/tmc54CqwA+bfhbtEfZUNLHaPUiB9X3jt1A==", "dev": true }, "node_modules/p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/p-event": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.2.0.tgz", "integrity": "sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==", "dev": true, "dependencies": { "p-timeout": "^3.1.0" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/p-limit": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", "dev": true, "dependencies": { "p-try": "^2.0.0" }, "engines": { "node": ">=6" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=", "dev": true, "dependencies": { "p-limit": "^2.0.0" }, "engines": { "node": ">=6" } }, "node_modules/p-map": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", "dev": true, "dependencies": { "aggregate-error": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/p-timeout": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", "dev": true, "dependencies": { "p-finally": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", "dev": true, "engines": { "node": ">=6" } }, "node_modules/package-hash": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", "dev": true, "dependencies": { "graceful-fs": "^4.1.15", "hasha": "^5.0.0", "lodash.flattendeep": "^4.4.0", "release-zalgo": "^1.0.0" }, "engines": { "node": ">=8" } }, "node_modules/package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "dev": true, "dependencies": { "got": "^9.6.0", "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", "semver": "^6.2.0" }, "engines": { "node": ">=8" } }, "node_modules/package-json/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "dependencies": { "error-ex": "^1.3.1", "json-parse-better-errors": "^1.0.1" }, "engines": { "node": ">=4" } }, "node_modules/parse-ms": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha1-1i27VnlAXXLEc37FhgDp3c8G0kw=", "dev": true }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", "dev": true, "engines": { "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/pkg-conf": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", "dev": true, "dependencies": { "find-up": "^3.0.0", "load-json-file": "^5.2.0" }, "engines": { "node": ">=6" } }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "dependencies": { "find-up": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/pkg-dir/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/pkg-dir/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "dependencies": { "p-locate": "^4.1.0" }, "engines": { "node": ">=8" } }, "node_modules/pkg-dir/node_modules/p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "dependencies": { "p-limit": "^2.2.0" }, "engines": { "node": ">=8" } }, "node_modules/pkg-dir/node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/plur": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", "dev": true, "dependencies": { "irregular-plurals": "^3.2.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/pretty-format": { "version": "27.0.2", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.0.2.tgz", "integrity": "sha512-mXKbbBPnYTG7Yra9qFBtqj+IXcsvxsvOBco3QHxtxTl+hHKq6QdzMZ+q0CtL4ORHZgwGImRr2XZUX2EWzORxig==", "dev": true, "dependencies": { "@jest/types": "^27.0.2", "ansi-regex": "^5.0.0", "ansi-styles": "^5.0.0", "react-is": "^17.0.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, "node_modules/pretty-format/node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/pretty-format/node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, "node_modules/pretty-ms": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", "dev": true, "dependencies": { "parse-ms": "^2.1.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/process-on-spawn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", "dev": true, "dependencies": { "fromentries": "^1.2.0" }, "engines": { "node": ">=8" } }, "node_modules/prop-types": { "version": "15.7.2", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.8.1" } }, "node_modules/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", "retry": "^0.12.0", "signal-exit": "^3.0.2" } }, "node_modules/proxyquire": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.0.0.tgz", "integrity": "sha512-TO9TAIz0mpa+SKddXsgCFatoe/KmHvoNVj2jDMC1kXE6kKn7/4CRpxvQ+0wAK9sbMT2FVO89qItlvnZMcFbJ2Q==", "dev": true, "dependencies": { "fill-keys": "^1.0.2", "module-not-found-error": "^1.0.0", "resolve": "~1.1.7" } }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/pupa": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", "dev": true, "dependencies": { "escape-goat": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/queue-microtask": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "cli.js" } }, "node_modules/rc/node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "node_modules/react": { "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", "dev": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2" }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", "parse-json": "^5.0.0", "type-fest": "^0.6.0" }, "engines": { "node": ">=8" } }, "node_modules/read-pkg/node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/read-pkg/node_modules/type-fest": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" }, "engines": { "node": ">= 6" } }, "node_modules/readdirp": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "dependencies": { "picomatch": "^2.2.1" }, "engines": { "node": ">=8.10.0" } }, "node_modules/registry-auth-token": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", "dev": true, "dependencies": { "rc": "^1.2.8" }, "engines": { "node": ">=6.0.0" } }, "node_modules/registry-url": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", "dev": true, "dependencies": { "rc": "^1.2.8" }, "engines": { "node": ">=8" } }, "node_modules/release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", "dev": true, "dependencies": { "es6-error": "^4.0.1" }, "engines": { "node": ">=4" } }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha1-0LMp7MfMD2Fkn2IhW+aa9UqomJs=", "dev": true }, "node_modules/resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", "dev": true }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, "dependencies": { "resolve-from": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", "dev": true, "dependencies": { "lowercase-keys": "^1.0.0" } }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" }, "engines": { "node": ">=8" } }, "node_modules/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, "node_modules/rimraf": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.0.tgz", "integrity": "sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg==", "dev": true, "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" } }, "node_modules/rimraf/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" } }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "dependencies": { "queue-microtask": "^1.2.2" } }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, "node_modules/safe-stable-stringify": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", "integrity": "sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/semver": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz", "integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==", "dev": true, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/semver-diff": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", "dev": true, "dependencies": { "semver": "^6.3.0" }, "engines": { "node": ">=8" } }, "node_modules/semver-diff/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true, "bin": { "semver": "bin/semver.js" } }, "node_modules/serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", "dev": true, "dependencies": { "type-fest": "^0.13.1" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/serialize-error/node_modules/type-fest": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", "dev": true, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/shiki": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", "dev": true, "dependencies": { "jsonc-parser": "^3.0.0", "vscode-oniguruma": "^1.6.1", "vscode-textmate": "5.2.0" } }, "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/slice-ansi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" }, "engines": { "node": ">=8" } }, "node_modules/slice-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/slice-ansi/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/slice-ansi/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/source-map-support": { "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "node_modules/spawn-wrap": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", "dev": true, "dependencies": { "foreground-child": "^2.0.0", "is-windows": "^1.0.2", "make-dir": "^3.0.0", "rimraf": "^3.0.0", "signal-exit": "^3.0.2", "which": "^2.0.1" }, "engines": { "node": ">=8" } }, "node_modules/spawn-wrap/node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "bin/node-which" }, "engines": { "node": ">= 8" } }, "node_modules/spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "node_modules/spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", "dev": true }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "node_modules/spdx-license-ids": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", "dev": true }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, "node_modules/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.3.tgz", "integrity": "sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw==", "dev": true, "dependencies": { "escape-string-regexp": "^2.0.0" }, "engines": { "node": ">=10" } }, "node_modules/stack-utils/node_modules/escape-string-regexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } }, "node_modules/string_decoder/node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/string-argv": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", "dev": true, "engines": { "node": ">=0.6.19" } }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/string-width/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/string-width/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/string.prototype.trimleft": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", "dev": true, "dependencies": { "define-properties": "^1.1.3", "function-bind": "^1.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimright": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", "dev": true, "dependencies": { "define-properties": "^1.1.3", "function-bind": "^1.1.1" }, "engines": { "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/supertap": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supertap/-/supertap-2.0.0.tgz", "integrity": "sha512-jRzcXlCeDYvKoZGA5oRhYyR3jUIYu0enkSxtmAgHRlD7HwrovTpH4bDSi0py9FtuA8si9cW/fKommJHuaoDHJA==", "dev": true, "dependencies": { "arrify": "^2.0.1", "indent-string": "^4.0.0", "js-yaml": "^3.14.0", "serialize-error": "^7.0.1", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=10" } }, "node_modules/supertap/node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "node_modules/supertap/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "dependencies": { "has-flag": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/temp-dir": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", "minimatch": "^3.0.4" }, "engines": { "node": ">=8" } }, "node_modules/test-exclude/node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/throat": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/throat/-/throat-6.0.1.tgz", "integrity": "sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==", "dev": true }, "node_modules/time-zone": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", "integrity": "sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/timsort": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "dev": true }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true, "engines": { "node": ">=4" } }, "node_modules/to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "dependencies": { "is-number": "^7.0.0" }, "engines": { "node": ">=8.0" } }, "node_modules/trim-off-newlines": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz", "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", "integrity": "sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.0", "yn": "3.1.1" }, "bin": { "ts-node": "dist/bin.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "peerDependenciesMeta": { "@swc/core": { "optional": true }, "@swc/wasm": { "optional": true } } }, "node_modules/ts-node/node_modules/@cspotcode/source-map-support": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", "dev": true, "dependencies": { "@cspotcode/source-map-consumer": "0.8.0" }, "engines": { "node": ">=12" } }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "node_modules/type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "dev": true, "dependencies": { "is-typedarray": "^1.0.0" } }, "node_modules/typedoc": { "version": "0.22.10", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.10.tgz", "integrity": "sha512-hQYZ4WtoMZ61wDC6w10kxA42+jclWngdmztNZsDvIz7BMJg7F2xnT+uYsUa7OluyKossdFj9E9Ye4QOZKTy8SA==", "dev": true, "dependencies": { "glob": "^7.2.0", "lunr": "^2.3.9", "marked": "^3.0.8", "minimatch": "^3.0.4", "shiki": "^0.9.12" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { "node": ">= 12.10.0" }, "peerDependencies": { "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x" } }, "node_modules/typedoc/node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/typescript-json-schema": { "version": "0.53.0", "resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.53.0.tgz", "integrity": "sha512-BcFxC9nipQQOXxrBGI/jOWU31BwzVh6vqJR008G8VHKJtQ8YrZX6veriXfTK1l+L0/ff0yKl3mZigMLA6ZqkHg==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/node": "^16.9.2", "glob": "^7.1.7", "safe-stable-stringify": "^2.2.0", "ts-node": "^10.2.1", "typescript": "~4.5.0", "yargs": "^17.1.1" }, "bin": { "typescript-json-schema": "bin/typescript-json-schema" } }, "node_modules/typescript-json-schema/node_modules/@types/node": { "version": "16.11.25", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz", "integrity": "sha512-NrTwfD7L1RTc2qrHQD4RTTy4p0CO2LatKBEKEds3CaVuhoM/+DJzmWZl5f+ikR8cm8F5mfJxK+9rQq07gRiSjQ==", "dev": true }, "node_modules/typescript-json-schema/node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/typescript-json-schema/node_modules/typescript": { "version": "4.5.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { "node": ">=4.2.0" } }, "node_modules/unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", "dev": true, "dependencies": { "crypto-random-string": "^2.0.0" }, "engines": { "node": ">=8" } }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true, "engines": { "node": ">= 4.0.0" } }, "node_modules/update-notifier": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", "dev": true, "dependencies": { "boxen": "^5.0.0", "chalk": "^4.1.0", "configstore": "^5.0.1", "has-yarn": "^2.1.0", "import-lazy": "^2.1.0", "is-ci": "^2.0.0", "is-installed-globally": "^0.4.0", "is-npm": "^5.0.0", "is-yarn-global": "^0.3.0", "latest-version": "^5.1.0", "pupa": "^2.1.1", "semver": "^7.3.4", "semver-diff": "^3.1.1", "xdg-basedir": "^4.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/yeoman/update-notifier?sponsor=1" } }, "node_modules/update-notifier/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "dependencies": { "yallist": "^4.0.0" }, "engines": { "node": ">=10" } }, "node_modules/update-notifier/node_modules/semver": { "version": "7.3.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" }, "engines": { "node": ">=10" } }, "node_modules/update-notifier/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "dependencies": { "punycode": "^2.1.0" } }, "node_modules/url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", "dev": true, "dependencies": { "prepend-http": "^2.0.0" }, "engines": { "node": ">=4" } }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, "node_modules/util.promisify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", "dev": true, "dependencies": { "define-properties": "^1.1.3", "es-abstract": "^1.17.2", "has-symbols": "^1.0.1", "object.getownpropertydescriptors": "^2.1.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, "bin": { "uuid": "bin/uuid" } }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "node_modules/validator": { "version": "13.7.0", "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==", "dev": true, "engines": { "node": ">= 0.10" } }, "node_modules/vscode-oniguruma": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz", "integrity": "sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==", "dev": true }, "node_modules/vscode-textmate": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", "dev": true }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", "dev": true, "dependencies": { "defaults": "^1.0.3" } }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", "dev": true, "engines": { "node": ">=6" } }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "node_modules/widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", "dev": true, "dependencies": { "string-width": "^4.0.0" }, "engines": { "node": ">=8" } }, "node_modules/widest-line/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "node_modules/widest-line/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/widest-line/node_modules/string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=8" } }, "node_modules/widest-line/node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, "engines": { "node": ">=8" } }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, "engines": { "node": ">=10" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "dependencies": { "color-convert": "^2.0.1" }, "engines": { "node": ">=8" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/wrap-ansi/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "dependencies": { "color-name": "~1.1.4" }, "engines": { "node": ">=7.0.0" } }, "node_modules/wrap-ansi/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "node_modules/write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", "typedarray-to-buffer": "^3.1.5" } }, "node_modules/xdg-basedir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true, "engines": { "node": ">=8" } }, "node_modules/y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "integrity": "sha1-le+U+F7MgdAHwmThkKEg8KPIVms=", "dev": true }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "node_modules/yargs": { "version": "17.3.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz", "integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==", "dev": true, "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.0.0" }, "engines": { "node": ">=12" } }, "node_modules/yargs-parser": { "version": "21.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz", "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==", "dev": true, "engines": { "node": ">=12" } }, "node_modules/yargs/node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha1-HodAGgnXZ8HV6rJqbkwYUYLS61A=", "engines": { "node": ">=6" } }, "node_modules/z-schema": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.2.tgz", "integrity": "sha512-40TH47ukMHq5HrzkeVE40Ad7eIDKaRV2b+Qpi2prLc9X9eFJFzV7tMe5aH12e6avaSS/u5l653EQOv+J9PirPw==", "dev": true, "dependencies": { "lodash.get": "^4.4.2", "lodash.isequal": "^4.5.0", "validator": "^13.7.0" }, "bin": { "z-schema": "bin/z-schema" }, "engines": { "node": ">=8.0.0" }, "optionalDependencies": { "commander": "^2.7.1" } } } } ts-node-10.9.2/package.json000066400000000000000000000136751453460306300154620ustar00rootroot00000000000000{ "name": "ts-node", "version": "10.9.2", "description": "TypeScript execution environment and REPL for node.js, with source map support", "main": "dist/index.js", "exports": { ".": "./dist/index.js", "./package": "./package.json", "./package.json": "./package.json", "./dist/bin": "./dist/bin.js", "./dist/bin.js": "./dist/bin.js", "./dist/bin-transpile": "./dist/bin-transpile.js", "./dist/bin-transpile.js": "./dist/bin-transpile.js", "./dist/bin-script": "./dist/bin-script.js", "./dist/bin-script.js": "./dist/bin-script.js", "./dist/bin-cwd": "./dist/bin-cwd.js", "./dist/bin-cwd.js": "./dist/bin-cwd.js", "./dist/bin-esm": "./dist/bin-esm.js", "./dist/bin-esm.js": "./dist/bin-esm.js", "./register": "./register/index.js", "./register/files": "./register/files.js", "./register/transpile-only": "./register/transpile-only.js", "./register/type-check": "./register/type-check.js", "./esm": "./esm.mjs", "./esm.mjs": "./esm.mjs", "./esm/transpile-only": "./esm/transpile-only.mjs", "./esm/transpile-only.mjs": "./esm/transpile-only.mjs", "./child-loader.mjs": "./child-loader.mjs", "./transpilers/swc": "./transpilers/swc.js", "./transpilers/swc-experimental": "./transpilers/swc-experimental.js", "./node10/tsconfig.json": "./node10/tsconfig.json", "./node12/tsconfig.json": "./node12/tsconfig.json", "./node14/tsconfig.json": "./node14/tsconfig.json", "./node16/tsconfig.json": "./node16/tsconfig.json" }, "types": "dist/index.d.ts", "bin": { "ts-node": "dist/bin.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, "files": [ "/transpilers/", "/dist/", "!/dist/test", "/dist-raw/NODE-LICENSE.md", "/dist-raw/**.js", "/register/", "/esm/", "/esm.mjs", "/child-loader.mjs", "/LICENSE", "/tsconfig.schema.json", "/tsconfig.schemastore-schema.json", "/node10/", "/node12/", "/node14/", "/node16/" ], "scripts": { "lint": "dprint check", "lint-fix": "dprint fmt", "clean": "rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp", "rebuild": "npm run clean && npm run build", "build": "npm run build-nopack && npm run build-pack", "build-nopack": "npm run build-tsc && npm run build-configSchema", "build-tsc": "tsc -b ./tsconfig.build-dist.json", "build-configSchema": "typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema", "build-pack": "node ./scripts/build-pack.js", "test-spec": "ava", "test-cov": "nyc ava", "test": "npm run build && npm run lint && npm run test-cov --", "test-local": "npm run lint-fix && npm run build-tsc && npm run build-pack && npm run test-spec --", "pre-debug": "npm run build-tsc && npm run build-pack", "coverage-report": "nyc report --reporter=lcov", "prepare": "npm run clean && npm run build-nopack", "api-extractor": "api-extractor run --local --verbose", "esm-usage-example": "npm run build-tsc && cd esm-usage-example && node --experimental-specifier-resolution node --loader ../esm.mjs ./index", "esm-usage-example2": "npm run build-tsc && cd tests && TS_NODE_PROJECT=./module-types/override-to-cjs/tsconfig.json node --loader ../esm.mjs ./module-types/override-to-cjs/test.cjs" }, "repository": { "type": "git", "url": "git://github.com/TypeStrong/ts-node.git" }, "keywords": [ "typescript", "node", "runtime", "environment", "ts", "compiler" ], "author": { "name": "Blake Embrey", "email": "hello@blakeembrey.com", "url": "http://blakeembrey.me" }, "contributors": [ { "name": "Andrew Bradley", "email": "cspotcode@gmail.com", "url": "https://github.com/cspotcode" } ], "license": "MIT", "bugs": { "url": "https://github.com/TypeStrong/ts-node/issues" }, "homepage": "https://typestrong.org/ts-node", "devDependencies": { "@microsoft/api-extractor": "^7.19.4", "@swc/core": "^1.3.100", "@swc/wasm": "^1.3.100", "@types/diff": "^4.0.2", "@types/lodash": "^4.14.151", "@types/node": "13.13.5", "@types/proper-lockfile": "^4.1.2", "@types/proxyquire": "^1.3.28", "@types/react": "^16.14.19", "@types/rimraf": "^3.0.0", "@types/semver": "^7.1.0", "@yarnpkg/fslib": "^2.4.0", "ava": "^3.15.0", "axios": "^0.21.1", "dprint": "^0.25.0", "expect": "^27.0.2", "get-stream": "^6.0.0", "lodash": "^4.17.15", "ntypescript": "^1.201507091536.1", "nyc": "^15.0.1", "outdent": "^0.8.0", "proper-lockfile": "^4.1.2", "proxyquire": "^2.0.0", "react": "^16.14.0", "rimraf": "^3.0.0", "semver": "^7.1.3", "throat": "^6.0.1", "typedoc": "^0.22.10", "typescript": "4.7.4", "typescript-json-schema": "^0.53.0", "util.promisify": "^1.0.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "peerDependenciesMeta": { "@swc/core": { "optional": true }, "@swc/wasm": { "optional": true } }, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "prettier": { "singleQuote": true }, "volta": { "node": "18.1.0", "npm": "6.14.15" } } ts-node-10.9.2/raw/000077500000000000000000000000001453460306300137515ustar00rootroot00000000000000ts-node-10.9.2/raw/README.md000066400000000000000000000000401453460306300152220ustar00rootroot00000000000000See the README.md in `dist-raw` ts-node-10.9.2/raw/download-and-compare.sh000077500000000000000000000046351453460306300203130ustar00rootroot00000000000000#!/usr/bin/env bash set -euo pipefail shopt -s inherit_errexit __dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$__dirname" # This script serves as helpful documentation for where these files came from. # TODO augment this script to update esm-resolver-diff branch # https://github.com/TypeStrong/ts-node/compare/esm-resolver-diff..main function download() { echo "// Copied from https://github.com/nodejs/node/blob/$version/$path$ext"$'\n' > "$local-$version$ext" curl "https://raw.githubusercontent.com/nodejs/node/$version/$path$ext" >> "$local-$version$ext" } compare() { diff "$local-$version$ext" "../dist-raw/$local$ext" || true } assertStrippedIsOnlyDeletions() { [ "$( diff "$1.js" "$1-stripped.js" | grep -E '^>' )" = '' ] } ext=.js #### path=lib/internal/modules/cjs/loader local=node-internal-modules-cjs-loader version=v17.0.1 download # compare version=v15.3.0 download # compare version=2d5d77306f6dff9110c1f77fefab25f973415770 download # compare #### path=lib/internal/modules/cjs/helpers local=node-internal-modules-cjs-helpers version=v17.0.1 download # compare #### path=lib/internal/modules/esm/resolve local=node-internal-modules-esm-resolve version=v13.12.0 download # compare version=v15.3.0 download # compare #### path=lib/internal/modules/esm/get_format local=node-internal-modules-esm-get_format version=v15.3.0 download # compare #### path=lib/internal/repl/await local=node-internal-repl-await version=v17.0.0 download # compare version=88799930794045795e8abac874730f9eba7e2300 download # compare #### path=lib/internal/modules/package_json_reader local=node-internal-modules-package_json_reader version=v15.3.0 download # compare #### path=lib/internal/errors local=node-internal-errors version=2d5d77306f6dff9110c1f77fefab25f973415770 download # compare version=b533fb3508009e5f567cc776daba8fbf665386a6 download # compare #### # Verify that -stripped.js files have only deletions, no other changes set -x assertStrippedIsOnlyDeletions node-internal-modules-cjs-loader-v15.3.0 assertStrippedIsOnlyDeletions node-internal-modules-cjs-loader-v17.0.1 assertStrippedIsOnlyDeletions node-internal-modules-cjs-helpers-v17.0.1 assertStrippedIsOnlyDeletions node-internal-modules-esm-resolve-v15.3.0 assertStrippedIsOnlyDeletions node-internal-errors-2d5d77306f6dff9110c1f77fefab25f973415770 assertStrippedIsOnlyDeletions node-internal-errors-b533fb3508009e5f567cc776daba8fbf665386a6 ts-node-10.9.2/raw/node-internal-errors-2d5d77306f6dff9110c1f77fefab25f973415770-stripped.js000066400000000000000000000056151453460306300276150ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/errors.js 'use strict'; const codes = {}; function makeNodeErrorWithCode(Base, key) { return class NodeError extends Base { constructor(...args) { if (excludedStackFn === undefined) { super(); } else { const limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. Error.stackTraceLimit = limit; } const message = getMessage(key, args, this); ObjectDefineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }); addCodeToName(this, super.name, key); this.code = key; } toString() { return `${this.name} [${key}]: ${this.message}`; } }; } // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val, def, ...otherClasses) { // Special case for SystemError that formats the error message differently // The SystemErrors only have SystemError as their base classes. messages.set(sym, val); if (def === SystemError) { def = makeSystemErrorWithCode(sym); } else { def = makeNodeErrorWithCode(def, sym); } if (otherClasses.length !== 0) { otherClasses.forEach((clazz) => { def[clazz.name] = makeNodeErrorWithCode(clazz, sym); }); } codes[sym] = def; } module.exports = { addCodeToName, // Exported for NghttpError codes, dnsException, errnoException, exceptionWithHostPort, getMessage, hideStackFrames, isStackOverflowError, connResetException, uvErrmapGet, uvException, uvExceptionWithHostPort, SystemError, // This is exported only to facilitate testing. E, kNoOverride, prepareStackTrace, maybeOverridePrepareStackTrace, overrideStackTrace, kEnhanceStackBeforeInspector, fatalExceptionStackEnhancers }; E('ERR_REQUIRE_ESM', (filename, parentPath = null, packageJsonPath = null) => { let msg = `Must use import to load ES Module: ${filename}`; if (parentPath && packageJsonPath) { const path = require('path'); const basename = path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + `${basename} to end in .cjs, change the requiring code to use ` + 'import(), or remove "type": "module" from ' + `${packageJsonPath}.\n`; return msg; } return msg; }, Error); ts-node-10.9.2/raw/node-internal-errors-2d5d77306f6dff9110c1f77fefab25f973415770.js000066400000000000000000001467201453460306300257700ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/errors.js /* eslint node-core/documented-errors: "error" */ /* eslint node-core/alphabetize-errors: "error" */ /* eslint node-core/prefer-util-format-errors: "error" */ 'use strict'; // The whole point behind this internal module is to allow Node.js to no // longer be forced to treat every error message change as a semver-major // change. The NodeError classes here all expose a `code` property whose // value statically and permanently identifies the error. While the error // message may change, the code should not. const { ArrayIsArray, Error, JSONStringify, Map, MathAbs, NumberIsInteger, ObjectDefineProperty, ObjectKeys, StringPrototypeSlice, StringPrototypeStartsWith, Symbol, SymbolFor, WeakMap, } = primordials; const sep = process.platform === 'win32' ? '\\' : '/'; const messages = new Map(); const codes = {}; const classRegExp = /^([A-Z][a-z0-9]*)+$/; // Sorted by a rough estimate on most frequently used entries. const kTypes = [ 'string', 'function', 'number', 'object', // Accept 'Function' and 'Object' as alternative to the lower cased version. 'Function', 'Object', 'boolean', 'bigint', 'symbol' ]; const { kMaxLength } = internalBinding('buffer'); const MainContextError = Error; const ErrorToString = Error.prototype.toString; const overrideStackTrace = new WeakMap(); const kNoOverride = Symbol('kNoOverride'); const prepareStackTrace = (globalThis, error, trace) => { // API for node internals to override error stack formatting // without interfering with userland code. if (overrideStackTrace.has(error)) { const f = overrideStackTrace.get(error); overrideStackTrace.delete(error); return f(error, trace); } const globalOverride = maybeOverridePrepareStackTrace(globalThis, error, trace); if (globalOverride !== kNoOverride) return globalOverride; // Normal error formatting: // // Error: Message // at function (file) // at file const errorString = ErrorToString.call(error); if (trace.length === 0) { return errorString; } return `${errorString}\n at ${trace.join('\n at ')}`; }; const maybeOverridePrepareStackTrace = (globalThis, error, trace) => { // Polyfill of V8's Error.prepareStackTrace API. // https://crbug.com/v8/7848 // `globalThis` is the global that contains the constructor which // created `error`. if (typeof globalThis.Error.prepareStackTrace === 'function') { return globalThis.Error.prepareStackTrace(error, trace); } // We still have legacy usage that depends on the main context's `Error` // being used, even when the error is from a different context. // TODO(devsnek): evaluate if this can be eventually deprecated/removed. if (typeof MainContextError.prepareStackTrace === 'function') { return MainContextError.prepareStackTrace(error, trace); } return kNoOverride; }; let excludedStackFn; // Lazily loaded let util; let assert; let internalUtil = null; function lazyInternalUtil() { if (!internalUtil) { internalUtil = require('internal/util'); } return internalUtil; } let internalUtilInspect = null; function lazyInternalUtilInspect() { if (!internalUtilInspect) { internalUtilInspect = require('internal/util/inspect'); } return internalUtilInspect; } let buffer; function lazyBuffer() { if (buffer === undefined) buffer = require('buffer').Buffer; return buffer; } // A specialized Error that includes an additional info property with // additional information about the error condition. // It has the properties present in a UVException but with a custom error // message followed by the uv error code and uv error message. // It also has its own error code with the original uv error context put into // `err.info`. // The context passed into this error must have .code, .syscall and .message, // and may have .path and .dest. class SystemError extends Error { constructor(key, context) { if (excludedStackFn === undefined) { super(); } else { const limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. Error.stackTraceLimit = limit; } const prefix = getMessage(key, [], this); let message = `${prefix}: ${context.syscall} returned ` + `${context.code} (${context.message})`; if (context.path !== undefined) message += ` ${context.path}`; if (context.dest !== undefined) message += ` => ${context.dest}`; ObjectDefineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }); addCodeToName(this, 'SystemError', key); this.code = key; ObjectDefineProperty(this, 'info', { value: context, enumerable: true, configurable: true, writable: false }); ObjectDefineProperty(this, 'errno', { get() { return context.errno; }, set: (value) => { context.errno = value; }, enumerable: true, configurable: true }); ObjectDefineProperty(this, 'syscall', { get() { return context.syscall; }, set: (value) => { context.syscall = value; }, enumerable: true, configurable: true }); if (context.path !== undefined) { // TODO(BridgeAR): Investigate why and when the `.toString()` was // introduced. The `path` and `dest` properties in the context seem to // always be of type string. We should probably just remove the // `.toString()` and `Buffer.from()` operations and set the value on the // context as the user did. ObjectDefineProperty(this, 'path', { get() { return context.path != null ? context.path.toString() : context.path; }, set: (value) => { context.path = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } if (context.dest !== undefined) { ObjectDefineProperty(this, 'dest', { get() { return context.dest != null ? context.dest.toString() : context.dest; }, set: (value) => { context.dest = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } } toString() { return `${this.name} [${this.code}]: ${this.message}`; } [SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) { return lazyInternalUtilInspect().inspect(this, { ...ctx, getters: true, customInspect: false }); } } function makeSystemErrorWithCode(key) { return class NodeError extends SystemError { constructor(ctx) { super(key, ctx); } }; } function makeNodeErrorWithCode(Base, key) { return class NodeError extends Base { constructor(...args) { if (excludedStackFn === undefined) { super(); } else { const limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. Error.stackTraceLimit = limit; } const message = getMessage(key, args, this); ObjectDefineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }); addCodeToName(this, super.name, key); this.code = key; } toString() { return `${this.name} [${key}]: ${this.message}`; } }; } // This function removes unnecessary frames from Node.js core errors. function hideStackFrames(fn) { return function hidden(...args) { // Make sure the most outer `hideStackFrames()` function is used. let setStackFn = false; if (excludedStackFn === undefined) { excludedStackFn = hidden; setStackFn = true; } try { return fn(...args); } finally { if (setStackFn === true) { excludedStackFn = undefined; } } }; } function addCodeToName(err, name, code) { // Set the stack if (excludedStackFn !== undefined) { // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(err, excludedStackFn); } // Add the error code to the name to include it in the stack trace. err.name = `${name} [${code}]`; // Access the stack to generate the error message including the error code // from the name. err.stack; // Reset the name to the actual name. if (name === 'SystemError') { ObjectDefineProperty(err, 'name', { value: name, enumerable: false, writable: true, configurable: true }); } else { delete err.name; } } // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val, def, ...otherClasses) { // Special case for SystemError that formats the error message differently // The SystemErrors only have SystemError as their base classes. messages.set(sym, val); if (def === SystemError) { def = makeSystemErrorWithCode(sym); } else { def = makeNodeErrorWithCode(def, sym); } if (otherClasses.length !== 0) { otherClasses.forEach((clazz) => { def[clazz.name] = makeNodeErrorWithCode(clazz, sym); }); } codes[sym] = def; } function getMessage(key, args, self) { const msg = messages.get(key); if (assert === undefined) assert = require('internal/assert'); if (typeof msg === 'function') { assert( msg.length <= args.length, // Default options do not count. `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${msg.length}).` ); return msg.apply(self, args); } const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length; assert( expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${expectedLength}).` ); if (args.length === 0) return msg; args.unshift(msg); return lazyInternalUtilInspect().format.apply(null, args); } let uvBinding; function lazyUv() { if (!uvBinding) { uvBinding = internalBinding('uv'); } return uvBinding; } const uvUnmappedError = ['UNKNOWN', 'unknown error']; function uvErrmapGet(name) { uvBinding = lazyUv(); if (!uvBinding.errmap) { uvBinding.errmap = uvBinding.getErrorMap(); } return uvBinding.errmap.get(name); } /** * This creates an error compatible with errors produced in the C++ * function UVException using a context object with data assembled in C++. * The goal is to migrate them to ERR_* errors later when compatibility is * not a concern. * * @param {Object} ctx * @returns {Error} */ function uvException(ctx) { const [ code, uvmsg ] = uvErrmapGet(ctx.errno) || uvUnmappedError; let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`; let path; let dest; if (ctx.path) { path = ctx.path.toString(); message += ` '${path}'`; } if (ctx.dest) { dest = ctx.dest.toString(); message += ` -> '${dest}'`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // Pass the message to the constructor instead of setting it on the object // to make sure it is the same as the one created in C++ // eslint-disable-next-line no-restricted-syntax const err = new Error(message); Error.stackTraceLimit = tmpLimit; for (const prop of ObjectKeys(ctx)) { if (prop === 'message' || prop === 'path' || prop === 'dest') { continue; } err[prop] = ctx[prop]; } err.code = code; if (path) { err.path = path; } if (dest) { err.dest = dest; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(err, excludedStackFn || uvException); return err; } /** * This creates an error compatible with errors produced in the C++ * This function should replace the deprecated * `exceptionWithHostPort()` function. * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @returns {Error} */ function uvExceptionWithHostPort(err, syscall, address, port) { const [ code, uvmsg ] = uvErrmapGet(err) || uvUnmappedError; const message = `${syscall} ${code}: ${uvmsg}`; let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${message}${details}`); Error.stackTraceLimit = tmpLimit; ex.code = code; ex.errno = err; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || uvExceptionWithHostPort); return ex; } /** * This used to be util._errnoException(). * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} [original] * @returns {Error} */ function errnoException(err, syscall, original) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. if (util === undefined) util = require('util'); const code = util.getSystemErrorName(err); const message = original ? `${syscall} ${code} ${original}` : `${syscall} ${code}`; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); ex.errno = err; ex.code = code; ex.syscall = syscall; // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || errnoException); return ex; } /** * Deprecated, new function is `uvExceptionWithHostPort()` * New function added the error description directly * from C++. this method for backwards compatibility * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @param {string} [additional] * @returns {Error} */ function exceptionWithHostPort(err, syscall, address, port, additional) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. if (util === undefined) util = require('util'); const code = util.getSystemErrorName(err); let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } if (additional) { details += ` - Local (${additional})`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${syscall} ${code}${details}`); Error.stackTraceLimit = tmpLimit; ex.errno = err; ex.code = code; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || exceptionWithHostPort); return ex; } /** * @param {number|string} code - A libuv error number or a c-ares error code * @param {string} syscall * @param {string} [hostname] * @returns {Error} */ function dnsException(code, syscall, hostname) { let errno; // If `code` is of type number, it is a libuv error number, else it is a // c-ares error code. // TODO(joyeecheung): translate c-ares error codes into numeric ones and // make them available in a property that's not error.errno (since they // can be in conflict with libuv error codes). Also make sure // util.getSystemErrorName() can understand them when an being informed that // the number is a c-ares error code. if (typeof code === 'number') { errno = code; // ENOTFOUND is not a proper POSIX error, but this error has been in place // long enough that it's not practical to remove it. if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) { code = 'ENOTFOUND'; // Fabricated error name. } else { code = lazyInternalUtil().getSystemErrorName(code); } } const message = `${syscall} ${code}${hostname ? ` ${hostname}` : ''}`; // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); Error.stackTraceLimit = tmpLimit; ex.errno = errno; ex.code = code; ex.syscall = syscall; if (hostname) { ex.hostname = hostname; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || dnsException); return ex; } function connResetException(msg) { // eslint-disable-next-line no-restricted-syntax const ex = new Error(msg); ex.code = 'ECONNRESET'; return ex; } let maxStack_ErrorName; let maxStack_ErrorMessage; /** * Returns true if `err.name` and `err.message` are equal to engine-specific * values indicating max call stack size has been exceeded. * "Maximum call stack size exceeded" in V8. * * @param {Error} err * @returns {boolean} */ function isStackOverflowError(err) { if (maxStack_ErrorMessage === undefined) { try { function overflowStack() { overflowStack(); } overflowStack(); } catch (err) { maxStack_ErrorMessage = err.message; maxStack_ErrorName = err.name; } } return err && err.name === maxStack_ErrorName && err.message === maxStack_ErrorMessage; } // Only use this for integers! Decimal numbers do not work with this function. function addNumericalSeparator(val) { let res = ''; let i = val.length; const start = val[0] === '-' ? 1 : 0; for (; i >= start + 4; i -= 3) { res = `_${val.slice(i - 3, i)}${res}`; } return `${val.slice(0, i)}${res}`; } // Used to enhance the stack that will be picked up by the inspector const kEnhanceStackBeforeInspector = Symbol('kEnhanceStackBeforeInspector'); // These are supposed to be called only on fatal exceptions before // the process exits. const fatalExceptionStackEnhancers = { beforeInspector(error) { if (typeof error[kEnhanceStackBeforeInspector] !== 'function') { return error.stack; } try { // Set the error.stack here so it gets picked up by the // inspector. error.stack = error[kEnhanceStackBeforeInspector](); } catch { // We are just enhancing the error. If it fails, ignore it. } return error.stack; }, afterInspector(error) { const originalStack = error.stack; const { inspect, inspectDefaultOptions: { colors: defaultColors } } = lazyInternalUtilInspect(); const colors = (internalBinding('util').guessHandleType(2) === 'TTY' && require('internal/tty').hasColors()) || defaultColors; try { return inspect(error, { colors }); } catch { return originalStack; } } }; module.exports = { addCodeToName, // Exported for NghttpError codes, dnsException, errnoException, exceptionWithHostPort, getMessage, hideStackFrames, isStackOverflowError, connResetException, uvErrmapGet, uvException, uvExceptionWithHostPort, SystemError, // This is exported only to facilitate testing. E, kNoOverride, prepareStackTrace, maybeOverridePrepareStackTrace, overrideStackTrace, kEnhanceStackBeforeInspector, fatalExceptionStackEnhancers }; // To declare an error message, use the E(sym, val, def) function above. The sym // must be an upper case string. The val can be either a function or a string. // The def must be an error class. // The return value of the function must be a string. // Examples: // E('EXAMPLE_KEY1', 'This is the error value', Error); // E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`, RangeError); // // Once an error code has been assigned, the code itself MUST NOT change and // any given error code must never be reused to identify a different error. // // Any error code added here should also be added to the documentation // // Note: Please try to keep these in alphabetical order // // Note: Node.js specific errors must begin with the prefix ERR_ E('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); E('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError); E('ERR_ASSERTION', '%s', Error); E('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError); E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s', TypeError); E('ERR_BROTLI_INVALID_PARAM', '%s is not a valid Brotli parameter', RangeError); E('ERR_BUFFER_OUT_OF_BOUNDS', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name = undefined) => { if (name) { return `"${name}" is outside of buffer bounds`; } return 'Attempt to access memory outside buffer bounds'; }, RangeError); E('ERR_BUFFER_TOO_LARGE', `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`, RangeError); E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals', Error); E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received', Error); E('ERR_CHILD_PROCESS_IPC_REQUIRED', "Forked processes must have an IPC channel, missing value 'ipc' in %s", Error); E('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded', RangeError); E('ERR_CONSOLE_WRITABLE_STREAM', 'Console expects a writable stream instance for %s', TypeError); E('ERR_CONTEXT_NOT_INITIALIZED', 'context used is not initialized', Error); E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s', Error); E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', 'Custom engines not supported by this OpenSSL', Error); E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s', TypeError); E('ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY', 'Public key is not valid for specified curve', Error); E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found', Error); E('ERR_CRYPTO_FIPS_FORCED', 'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error); E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.', Error); E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error); E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY', 'Incompatible %s: %s', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS', 'The selected key encoding %s %s.', Error); E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError); E('ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE', 'Invalid key object type %s, expected %s.', TypeError); E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error); E('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 error', Error); E('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error); E('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error); // Switch to TypeError. The current implementation does not seem right. E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error); E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH', 'Input buffers must have the same byte length', RangeError); E('ERR_DIR_CLOSED', 'Directory handle was closed', Error); E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]', Error); E('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE', 'A callback was registered through ' + 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' + 'exclusive with using the `domain` module', Error); E('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE', 'The `domain` module is in use, which is mutually exclusive with calling ' + 'process.setUncaughtExceptionCaptureCallback()', Error); E('ERR_ENCODING_INVALID_ENCODED_DATA', function(encoding, ret) { this.errno = ret; return `The encoded data was not valid for encoding ${encoding}`; }, TypeError); E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported', RangeError); E('ERR_EVAL_ESM_CANNOT_PRINT', '--print cannot be used with ESM input', Error); E('ERR_FALSY_VALUE_REJECTION', function(reason) { this.reason = reason; return 'Promise was rejected with falsy value'; }, Error); E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', 'The feature %s is unavailable on the current platform' + ', which is being used to run Node.js', TypeError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', 'Symlink type must be one of "dir", "file", or "junction". Received "%s"', Error); // Switch to TypeError. The current implementation does not seem right E('ERR_HTTP2_ALTSVC_INVALID_ORIGIN', 'HTTP/2 ALTSVC frames require a valid origin', TypeError); E('ERR_HTTP2_ALTSVC_LENGTH', 'HTTP/2 ALTSVC frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_CONNECT_AUTHORITY', ':authority header is required for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_PATH', 'The :path header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_SCHEME', 'The :scheme header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_GOAWAY_SESSION', 'New streams cannot be created after receiving a GOAWAY', Error); E('ERR_HTTP2_HEADERS_AFTER_RESPOND', 'Cannot specify additional headers after response initiated', Error); E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error); E('ERR_HTTP2_HEADER_SINGLE_VALUE', 'Header field "%s" must only have a single value', TypeError); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', 'Informational status codes cannot be used', RangeError); E('ERR_HTTP2_INVALID_CONNECTION_HEADERS', 'HTTP/1 Connection specific headers are forbidden: "%s"', TypeError); E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP2_INVALID_INFO_STATUS', 'Invalid informational status code: %s', RangeError); E('ERR_HTTP2_INVALID_ORIGIN', 'HTTP/2 ORIGIN frames require a valid origin', TypeError); E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', 'Packed settings length must be a multiple of six', RangeError); E('ERR_HTTP2_INVALID_PSEUDOHEADER', '"%s" is an invalid pseudoheader or is used incorrectly', TypeError); E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error); E('ERR_HTTP2_INVALID_SETTING_VALUE', // Using default arguments here is important so the arguments are not counted // towards `Function#length`. function(name, actual, min = undefined, max = undefined) { this.actual = actual; if (min !== undefined) { this.min = min; this.max = max; } return `Invalid value for setting "${name}": ${actual}`; }, TypeError, RangeError); E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error); E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', 'Maximum number of pending settings acknowledgements', Error); E('ERR_HTTP2_NESTED_PUSH', 'A push stream cannot initiate another push stream.', Error); E('ERR_HTTP2_NO_SOCKET_MANIPULATION', 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)', Error); E('ERR_HTTP2_ORIGIN_LENGTH', 'HTTP/2 ORIGIN frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_OUT_OF_STREAMS', 'No stream ID is available because maximum stream ID has been reached', Error); E('ERR_HTTP2_PAYLOAD_FORBIDDEN', 'Responses with %s status must not have a payload', Error); E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error); E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError); E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', 'Cannot set HTTP/2 pseudo-headers', TypeError); E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error); E('ERR_HTTP2_SEND_FILE', 'Directories cannot be sent', Error); E('ERR_HTTP2_SEND_FILE_NOSEEK', 'Offset or length can only be specified for regular files', Error); E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error); E('ERR_HTTP2_SETTINGS_CANCEL', 'HTTP2 session settings canceled', Error); E('ERR_HTTP2_SOCKET_BOUND', 'The socket is already bound to an Http2Session', Error); E('ERR_HTTP2_SOCKET_UNBOUND', 'The socket has been disconnected from the Http2Session', Error); E('ERR_HTTP2_STATUS_101', 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2', Error); E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s', RangeError); E('ERR_HTTP2_STREAM_CANCEL', function(error) { let msg = 'The pending stream has been canceled'; if (error) { this.cause = error; if (typeof error.message === 'string') msg += ` (caused by: ${error.message})`; } return msg; }, Error); E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s', Error); E('ERR_HTTP2_STREAM_SELF_DEPENDENCY', 'A stream cannot depend on itself', Error); E('ERR_HTTP2_TRAILERS_ALREADY_SENT', 'Trailing headers have already been sent', Error); E('ERR_HTTP2_TRAILERS_NOT_READY', 'Trailing headers cannot be sent until after the wantTrailers event is ' + 'emitted', Error); E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.', Error); E('ERR_HTTP_HEADERS_SENT', 'Cannot %s headers after they are sent to the client', Error); E('ERR_HTTP_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s', RangeError); E('ERR_HTTP_TRAILER_INVALID', 'Trailers are invalid with this transfer encoding', Error); E('ERR_INCOMPATIBLE_OPTION_PAIR', 'Option "%s" cannot be used in combination with option "%s"', TypeError); E('ERR_INPUT_TYPE_NOT_ALLOWED', '--input-type can only be used with string ' + 'input via --eval, --print, or STDIN', Error); E('ERR_INSPECTOR_ALREADY_CONNECTED', '%s is already connected', Error); E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error); E('ERR_INSPECTOR_COMMAND', 'Inspector error %d: %s', Error); E('ERR_INSPECTOR_NOT_ACTIVE', 'Inspector is not active', Error); E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error); E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error); E('ERR_INSPECTOR_NOT_WORKER', 'Current thread is not a worker', Error); E('ERR_INTERNAL_ASSERTION', (message) => { const suffix = 'This is caused by either a bug in Node.js ' + 'or incorrect usage of Node.js internals.\n' + 'Please open an issue with this stack trace at ' + 'https://github.com/nodejs/node/issues\n'; return message === undefined ? suffix : `${message}\n${suffix}`; }, Error); E('ERR_INVALID_ADDRESS_FAMILY', function(addressType, host, port) { this.host = host; this.port = port; return `Invalid address family: ${addressType} ${host}:${port}`; }, RangeError); E('ERR_INVALID_ARG_TYPE', (name, expected, actual) => { assert(typeof name === 'string', "'name' must be a string"); if (!ArrayIsArray(expected)) { expected = [expected]; } let msg = 'The '; if (name.endsWith(' argument')) { // For cases like 'first argument' msg += `${name} `; } else { const type = name.includes('.') ? 'property' : 'argument'; msg += `"${name}" ${type} `; } msg += 'must be '; const types = []; const instances = []; const other = []; for (const value of expected) { assert(typeof value === 'string', 'All expected entries have to be of type string'); if (kTypes.includes(value)) { types.push(value.toLowerCase()); } else if (classRegExp.test(value)) { instances.push(value); } else { assert(value !== 'object', 'The value "object" should be written as "Object"'); other.push(value); } } // Special handle `object` in case other instances are allowed to outline // the differences between each other. if (instances.length > 0) { const pos = types.indexOf('object'); if (pos !== -1) { types.splice(pos, 1); instances.push('Object'); } } if (types.length > 0) { if (types.length > 2) { const last = types.pop(); msg += `one of type ${types.join(', ')}, or ${last}`; } else if (types.length === 2) { msg += `one of type ${types[0]} or ${types[1]}`; } else { msg += `of type ${types[0]}`; } if (instances.length > 0 || other.length > 0) msg += ' or '; } if (instances.length > 0) { if (instances.length > 2) { const last = instances.pop(); msg += `an instance of ${instances.join(', ')}, or ${last}`; } else { msg += `an instance of ${instances[0]}`; if (instances.length === 2) { msg += ` or ${instances[1]}`; } } if (other.length > 0) msg += ' or '; } if (other.length > 0) { if (other.length > 2) { const last = other.pop(); msg += `one of ${other.join(', ')}, or ${last}`; } else if (other.length === 2) { msg += `one of ${other[0]} or ${other[1]}`; } else { if (other[0].toLowerCase() !== other[0]) msg += 'an '; msg += `${other[0]}`; } } if (actual == null) { msg += `. Received ${actual}`; } else if (typeof actual === 'function' && actual.name) { msg += `. Received function ${actual.name}`; } else if (typeof actual === 'object') { if (actual.constructor && actual.constructor.name) { msg += `. Received an instance of ${actual.constructor.name}`; } else { const inspected = lazyInternalUtilInspect() .inspect(actual, { depth: -1 }); msg += `. Received ${inspected}`; } } else { let inspected = lazyInternalUtilInspect() .inspect(actual, { colors: false }); if (inspected.length > 25) inspected = `${inspected.slice(0, 25)}...`; msg += `. Received type ${typeof actual} (${inspected})`; } return msg; }, TypeError); E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { let inspected = lazyInternalUtilInspect().inspect(value); if (inspected.length > 128) { inspected = `${inspected.slice(0, 128)}...`; } return `The argument '${name}' ${reason}. Received ${inspected}`; }, TypeError, RangeError); E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError); E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s', RangeError); E('ERR_INVALID_CALLBACK', 'Callback must be a function. Received %O', TypeError); E('ERR_INVALID_CHAR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name, field = undefined) => { let msg = `Invalid character in ${name}`; if (field !== undefined) { msg += ` ["${field}"]`; } return msg; }, TypeError); E('ERR_INVALID_CURSOR_POS', 'Cannot set cursor row without setting its column', TypeError); E('ERR_INVALID_FD', '"fd" must be a positive integer: %s', RangeError); E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError); E('ERR_INVALID_FILE_URL_HOST', 'File URL host must be "localhost" or empty on %s', TypeError); E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError); E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError); E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]', TypeError); E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError); E('ERR_INVALID_MODULE_SPECIFIER', (pkgPath, subpath, base = undefined) => { if (subpath === undefined) { return `Invalid package name '${pkgPath}' imported from ${base}`; } else if (base === undefined) { assert(subpath !== '.'); return `Package subpath '${subpath}' is not a valid module request for ` + `the "exports" resolution of ${pkgPath}${sep}package.json`; } else { return `Package subpath '${subpath}' is not a valid module request for ` + `the "exports" resolution of ${pkgPath} imported from ${base}`; } }, TypeError); E('ERR_INVALID_OPT_VALUE', (name, value) => `The value "${String(value)}" is invalid for option "${name}"`, TypeError, RangeError); E('ERR_INVALID_OPT_VALUE_ENCODING', 'The value "%s" is invalid for option "encoding"', TypeError); E('ERR_INVALID_PACKAGE_CONFIG', (path, message, hasMessage = true) => { if (hasMessage) return `Invalid package config ${path}${sep}package.json, ${message}`; else return `Invalid JSON in ${path} imported from ${message}`; }, Error); E('ERR_INVALID_PACKAGE_TARGET', (pkgPath, key, subpath, target, base = undefined) => { const relError = typeof target === 'string' && target.length && !StringPrototypeStartsWith(target, './'); if (key === null) { if (subpath !== '') { return `Invalid "exports" target ${JSONStringify(target)} defined ` + `for '${subpath}' in the package config ${pkgPath} imported from ` + `${base}.${relError ? '; targets must start with "./"' : ''}`; } else { return `Invalid "exports" main target ${target} defined in the ` + `package config ${pkgPath} imported from ${base}${relError ? '; targets must start with "./"' : ''}`; } } else if (key === '.') { return `Invalid "exports" main target ${JSONStringify(target)} defined ` + `in the package config ${pkgPath}${sep}package.json${relError ? '; targets must start with "./"' : ''}`; } else if (relError) { return `Invalid "exports" target ${JSONStringify(target)} defined for '${ StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` + `package config ${pkgPath}${sep}package.json; ` + 'targets must start with "./"'; } else { return `Invalid "exports" target ${JSONStringify(target)} defined for '${ StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` + `package config ${pkgPath}${sep}package.json`; } }, Error); E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set', Error); E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', TypeError); E('ERR_INVALID_REPL_EVAL_CONFIG', 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError); E('ERR_INVALID_REPL_INPUT', '%s', TypeError); E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => { return `Expected a valid ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${value}.`; }, TypeError); E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => { let type; if (value && value.constructor && value.constructor.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${type}.`; }, TypeError); E('ERR_INVALID_RETURN_VALUE', (input, name, value) => { let type; if (value && value.constructor && value.constructor.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.`; }, TypeError); E('ERR_INVALID_SYNC_FORK_INPUT', 'Asynchronous forks do not support ' + 'Buffer, TypedArray, DataView or string input: %s', TypeError); E('ERR_INVALID_THIS', 'Value of "this" must be of type %s', TypeError); E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple', TypeError); E('ERR_INVALID_URI', 'URI malformed', URIError); E('ERR_INVALID_URL', function(input) { this.input = input; return `Invalid URL: ${input}`; }, TypeError); E('ERR_INVALID_URL_SCHEME', (expected) => { if (typeof expected === 'string') expected = [expected]; assert(expected.length <= 2); const res = expected.length === 2 ? `one of scheme ${expected[0]} or ${expected[1]}` : `of scheme ${expected[0]}`; return `The URL must be ${res}`; }, TypeError); E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error); E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error); E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error); E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error); E('ERR_MANIFEST_ASSERT_INTEGRITY', (moduleURL, realIntegrities) => { let msg = `The content of "${ moduleURL }" does not match the expected integrity.`; if (realIntegrities.size) { const sri = [...realIntegrities.entries()].map(([alg, dgs]) => { return `${alg}-${dgs}`; }).join(' '); msg += ` Integrities found are: ${sri}`; } else { msg += ' The resource was not found in the policy.'; } return msg; }, Error); E('ERR_MANIFEST_DEPENDENCY_MISSING', 'Manifest resource %s does not list %s as a dependency specifier', Error); E('ERR_MANIFEST_INTEGRITY_MISMATCH', 'Manifest resource %s has multiple entries but integrity lists do not match', SyntaxError); E('ERR_MANIFEST_INVALID_RESOURCE_FIELD', 'Manifest resource %s has invalid property value for %s', TypeError); E('ERR_MANIFEST_TDZ', 'Manifest initialization has not yet run', Error); E('ERR_MANIFEST_UNKNOWN_ONERROR', 'Manifest specified unknown error behavior "%s".', SyntaxError); E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error); E('ERR_MISSING_ARGS', (...args) => { assert(args.length > 0, 'At least one arg needs to be specified'); let msg = 'The '; const len = args.length; args = args.map((a) => `"${a}"`); switch (len) { case 1: msg += `${args[0]} argument`; break; case 2: msg += `${args[0]} and ${args[1]} arguments`; break; default: msg += args.slice(0, len - 1).join(', '); msg += `, and ${args[len - 1]} arguments`; break; } return `${msg} must be specified`; }, TypeError); E('ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK', 'The ES Module loader may not return a format of \'dynamic\' when no ' + 'dynamicInstantiate function was provided', Error); E('ERR_MISSING_OPTION', '%s is required', TypeError); E('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { return `Cannot find ${type} '${path}' imported from ${base}`; }, Error); E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error); E('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function', TypeError); E('ERR_NAPI_INVALID_DATAVIEW_ARGS', 'byte_offset + byte_length should be less than or equal to the size in ' + 'bytes of the array passed in', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT', 'start offset of %s should be a multiple of %s', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH', 'Invalid typed array length', RangeError); E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support', Error); E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); let msg = replaceDefaultBoolean ? str : `The value of "${str}" is out of range.`; let received; if (NumberIsInteger(input) && MathAbs(input) > 2 ** 32) { received = addNumericalSeparator(String(input)); } else if (typeof input === 'bigint') { received = String(input); if (input > 2n ** 32n || input < -(2n ** 32n)) { received = addNumericalSeparator(received); } received += 'n'; } else { received = lazyInternalUtilInspect().inspect(input); } msg += ` It must be ${range}. Received ${received}`; return msg; }, RangeError); E('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => { if (subpath === '.') { return `No "exports" main resolved in ${pkgPath}${sep}package.json`; } else if (base === undefined) { return `Package subpath '${subpath}' is not defined by "exports" in ${ pkgPath}${sep}package.json`; } else { return `Package subpath '${subpath}' is not defined by "exports" in ${ pkgPath} imported from ${base}`; } }, Error); E('ERR_REQUIRE_ESM', (filename, parentPath = null, packageJsonPath = null) => { let msg = `Must use import to load ES Module: ${filename}`; if (parentPath && packageJsonPath) { const path = require('path'); const basename = path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + `${basename} to end in .cjs, change the requiring code to use ` + 'import(), or remove "type": "module" from ' + `${packageJsonPath}.\n`; return msg; } return msg; }, Error); E('ERR_SCRIPT_EXECUTION_INTERRUPTED', 'Script execution was interrupted by `SIGINT`', Error); E('ERR_SERVER_ALREADY_LISTEN', 'Listen method has been called more than once without closing.', Error); E('ERR_SERVER_NOT_RUNNING', 'Server is not running.', Error); E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error); E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer', TypeError); E('ERR_SOCKET_BAD_PORT', (name, port, allowZero = true) => { assert(typeof allowZero === 'boolean', "The 'allowZero' argument must be of type boolean."); const operator = allowZero ? '>=' : '>'; return `${name} should be ${operator} 0 and < 65536. Received ${port}.`; }, RangeError); E('ERR_SOCKET_BAD_TYPE', 'Bad socket type specified. Valid types are: udp4, udp6', TypeError); E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size', SystemError); E('ERR_SOCKET_CLOSED', 'Socket is closed', Error); E('ERR_SOCKET_DGRAM_IS_CONNECTED', 'Already connected', Error); E('ERR_SOCKET_DGRAM_NOT_CONNECTED', 'Not connected', Error); E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error); E('ERR_SRI_PARSE', 'Subresource Integrity string %j had an unexpected %j at position %d', SyntaxError); E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error); E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error); E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error); E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error); E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error); E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error); E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error); E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error); E('ERR_SYNTHETIC', 'JavaScript Callstack', Error); E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError); E('ERR_TLS_CERT_ALTNAME_INVALID', function(reason, host, cert) { this.reason = reason; this.host = host; this.cert = cert; return `Hostname/IP does not match certificate's altnames: ${reason}`; }, Error); E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError), E('ERR_TLS_INVALID_STATE', 'TLS socket connection must be securely established', Error), E('ERR_TLS_INVALID_PROTOCOL_VERSION', '%j is not a valid %s TLS protocol version', TypeError); E('ERR_TLS_PROTOCOL_VERSION_CONFLICT', 'TLS protocol version %j conflicts with secureProtocol %j', TypeError); E('ERR_TLS_RENEGOTIATION_DISABLED', 'TLS session renegotiation disabled for this socket', Error); // This should probably be a `TypeError`. E('ERR_TLS_REQUIRED_SERVER_NAME', '"servername" is required parameter for Server.addContext', Error); E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error); E('ERR_TLS_SNI_FROM_SERVER', 'Cannot issue SNI from a TLS server-side socket', Error); E('ERR_TRACE_EVENTS_CATEGORY_REQUIRED', 'At least one category is required', TypeError); E('ERR_TRACE_EVENTS_UNAVAILABLE', 'Trace events are unavailable', Error); // This should probably be a `RangeError`. E('ERR_TTY_INIT_FAILED', 'TTY initialization failed', SystemError); E('ERR_UNAVAILABLE_DURING_EXIT', 'Cannot call function in process exit ' + 'handler', Error); E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', '`process.setupUncaughtExceptionCapture()` was called while a capture ' + 'callback was already active', Error); E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters', TypeError); E('ERR_UNHANDLED_ERROR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (err = undefined) => { const msg = 'Unhandled error.'; if (err === undefined) return msg; return `${msg} (${err})`; }, Error); E('ERR_UNKNOWN_BUILTIN_MODULE', 'No such built-in module: %s', Error); E('ERR_UNKNOWN_CREDENTIAL', '%s identifier does not exist: %s', Error); E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError); E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension "%s" for %s', TypeError); E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError); E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError); E('ERR_UNSUPPORTED_ESM_URL_SCHEME', 'Only file and data URLs are supported ' + 'by the default ESM loader', Error); E('ERR_V8BREAKITERATOR', 'Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl', Error); // This should probably be a `TypeError`. E('ERR_VALID_PERFORMANCE_ENTRY_TYPE', 'At least one valid performance entry type is required', Error); E('ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING', 'A dynamic import callback was not specified.', TypeError); E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error); E('ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA', 'Cached data cannot be created for a module which has been evaluated', Error); E('ERR_VM_MODULE_DIFFERENT_CONTEXT', 'Linked modules must use the same context', Error); E('ERR_VM_MODULE_LINKING_ERRORED', 'Linking has already failed for the provided module', Error); E('ERR_VM_MODULE_NOT_MODULE', 'Provided module is not an instance of Module', Error); E('ERR_VM_MODULE_STATUS', 'Module status %s', Error); E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error); E('ERR_WORKER_INIT_FAILED', 'Worker initialization failure: %s', Error); E('ERR_WORKER_INVALID_EXEC_ARGV', (errors, msg = 'invalid execArgv flags') => `Initiated Worker with ${msg}: ${errors.join(', ')}`, Error); E('ERR_WORKER_NOT_RUNNING', 'Worker instance not running', Error); E('ERR_WORKER_OUT_OF_MEMORY', 'Worker terminated due to reaching memory limit: %s', Error); E('ERR_WORKER_PATH', (filename) => 'The worker script or module filename must be an absolute path or a ' + 'relative path starting with \'./\' or \'../\'.' + (filename.startsWith('file://') ? ' Wrap file:// URLs with `new URL`.' : '' ) + ` Received "${filename}"`, TypeError); E('ERR_WORKER_UNSERIALIZABLE_ERROR', 'Serializing an uncaught exception failed', Error); E('ERR_WORKER_UNSUPPORTED_EXTENSION', 'The worker script extension must be ".js", ".mjs", or ".cjs". Received "%s"', TypeError); E('ERR_WORKER_UNSUPPORTED_OPERATION', '%s is not supported in workers', TypeError); E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error); ts-node-10.9.2/raw/node-internal-errors-b533fb3508009e5f567cc776daba8fbf665386a6-stripped.js000066400000000000000000000032241453460306300276670ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/b533fb3508009e5f567cc776daba8fbf665386a6/lib/internal/errors.js 'use strict'; // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val, def, ...otherClasses) { // Special case for SystemError that formats the error message differently // The SystemErrors only have SystemError as their base classes. messages.set(sym, val); if (def === SystemError) { def = makeSystemErrorWithCode(sym); } else { def = makeNodeErrorWithCode(def, sym); } if (otherClasses.length !== 0) { otherClasses.forEach((clazz) => { def[clazz.name] = makeNodeErrorWithCode(clazz, sym); }); } codes[sym] = def; } E('ERR_REQUIRE_ESM', (filename, parentPath = null, packageJsonPath = null) => { let msg = `Must use import to load ES Module: ${filename}`; if (parentPath && packageJsonPath) { const path = require('path'); const basename = path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + `${basename} to end in .cjs, change the requiring code to use ` + 'import(), or remove "type": "module" from ' + `${packageJsonPath}.\n`; return msg; } return msg; }, Error); ts-node-10.9.2/raw/node-internal-errors-b533fb3508009e5f567cc776daba8fbf665386a6.js000066400000000000000000001472161453460306300260510ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/b533fb3508009e5f567cc776daba8fbf665386a6/lib/internal/errors.js /* eslint node-core/documented-errors: "error" */ /* eslint node-core/alphabetize-errors: "error" */ /* eslint node-core/prefer-util-format-errors: "error" */ 'use strict'; // The whole point behind this internal module is to allow Node.js to no // longer be forced to treat every error message change as a semver-major // change. The NodeError classes here all expose a `code` property whose // value statically and permanently identifies the error. While the error // message may change, the code should not. const { ArrayIsArray, Error, JSONStringify, Map, MathAbs, NumberIsInteger, ObjectDefineProperty, ObjectKeys, StringPrototypeSlice, StringPrototypeStartsWith, Symbol, SymbolFor, WeakMap, } = primordials; const sep = process.platform === 'win32' ? '\\' : '/'; const messages = new Map(); const codes = {}; const classRegExp = /^([A-Z][a-z0-9]*)+$/; // Sorted by a rough estimate on most frequently used entries. const kTypes = [ 'string', 'function', 'number', 'object', // Accept 'Function' and 'Object' as alternative to the lower cased version. 'Function', 'Object', 'boolean', 'bigint', 'symbol' ]; const { kMaxLength } = internalBinding('buffer'); const MainContextError = Error; const ErrorToString = Error.prototype.toString; const overrideStackTrace = new WeakMap(); const kNoOverride = Symbol('kNoOverride'); const prepareStackTrace = (globalThis, error, trace) => { // API for node internals to override error stack formatting // without interfering with userland code. if (overrideStackTrace.has(error)) { const f = overrideStackTrace.get(error); overrideStackTrace.delete(error); return f(error, trace); } const globalOverride = maybeOverridePrepareStackTrace(globalThis, error, trace); if (globalOverride !== kNoOverride) return globalOverride; // Normal error formatting: // // Error: Message // at function (file) // at file const errorString = ErrorToString.call(error); if (trace.length === 0) { return errorString; } return `${errorString}\n at ${trace.join('\n at ')}`; }; const maybeOverridePrepareStackTrace = (globalThis, error, trace) => { // Polyfill of V8's Error.prepareStackTrace API. // https://crbug.com/v8/7848 // `globalThis` is the global that contains the constructor which // created `error`. if (typeof globalThis.Error.prepareStackTrace === 'function') { return globalThis.Error.prepareStackTrace(error, trace); } // We still have legacy usage that depends on the main context's `Error` // being used, even when the error is from a different context. // TODO(devsnek): evaluate if this can be eventually deprecated/removed. if (typeof MainContextError.prepareStackTrace === 'function') { return MainContextError.prepareStackTrace(error, trace); } return kNoOverride; }; let excludedStackFn; // Lazily loaded let util; let assert; let internalUtil = null; function lazyInternalUtil() { if (!internalUtil) { internalUtil = require('internal/util'); } return internalUtil; } let internalUtilInspect = null; function lazyInternalUtilInspect() { if (!internalUtilInspect) { internalUtilInspect = require('internal/util/inspect'); } return internalUtilInspect; } let buffer; function lazyBuffer() { if (buffer === undefined) buffer = require('buffer').Buffer; return buffer; } // A specialized Error that includes an additional info property with // additional information about the error condition. // It has the properties present in a UVException but with a custom error // message followed by the uv error code and uv error message. // It also has its own error code with the original uv error context put into // `err.info`. // The context passed into this error must have .code, .syscall and .message, // and may have .path and .dest. class SystemError extends Error { constructor(key, context) { if (excludedStackFn === undefined) { super(); } else { const limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. Error.stackTraceLimit = limit; } const prefix = getMessage(key, [], this); let message = `${prefix}: ${context.syscall} returned ` + `${context.code} (${context.message})`; if (context.path !== undefined) message += ` ${context.path}`; if (context.dest !== undefined) message += ` => ${context.dest}`; ObjectDefineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }); addCodeToName(this, 'SystemError', key); this.code = key; ObjectDefineProperty(this, 'info', { value: context, enumerable: true, configurable: true, writable: false }); ObjectDefineProperty(this, 'errno', { get() { return context.errno; }, set: (value) => { context.errno = value; }, enumerable: true, configurable: true }); ObjectDefineProperty(this, 'syscall', { get() { return context.syscall; }, set: (value) => { context.syscall = value; }, enumerable: true, configurable: true }); if (context.path !== undefined) { // TODO(BridgeAR): Investigate why and when the `.toString()` was // introduced. The `path` and `dest` properties in the context seem to // always be of type string. We should probably just remove the // `.toString()` and `Buffer.from()` operations and set the value on the // context as the user did. ObjectDefineProperty(this, 'path', { get() { return context.path != null ? context.path.toString() : context.path; }, set: (value) => { context.path = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } if (context.dest !== undefined) { ObjectDefineProperty(this, 'dest', { get() { return context.dest != null ? context.dest.toString() : context.dest; }, set: (value) => { context.dest = value ? lazyBuffer().from(value.toString()) : undefined; }, enumerable: true, configurable: true }); } } toString() { return `${this.name} [${this.code}]: ${this.message}`; } [SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) { return lazyInternalUtilInspect().inspect(this, { ...ctx, getters: true, customInspect: false }); } } function makeSystemErrorWithCode(key) { return class NodeError extends SystemError { constructor(ctx) { super(key, ctx); } }; } function makeNodeErrorWithCode(Base, key) { return class NodeError extends Base { constructor(...args) { if (excludedStackFn === undefined) { super(); } else { const limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; super(); // Reset the limit and setting the name property. Error.stackTraceLimit = limit; } const message = getMessage(key, args, this); ObjectDefineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }); addCodeToName(this, super.name, key); this.code = key; } toString() { return `${this.name} [${key}]: ${this.message}`; } }; } // This function removes unnecessary frames from Node.js core errors. function hideStackFrames(fn) { return function hidden(...args) { // Make sure the most outer `hideStackFrames()` function is used. let setStackFn = false; if (excludedStackFn === undefined) { excludedStackFn = hidden; setStackFn = true; } try { return fn(...args); } finally { if (setStackFn === true) { excludedStackFn = undefined; } } }; } function addCodeToName(err, name, code) { // Set the stack if (excludedStackFn !== undefined) { // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(err, excludedStackFn); } // Add the error code to the name to include it in the stack trace. err.name = `${name} [${code}]`; // Access the stack to generate the error message including the error code // from the name. err.stack; // Reset the name to the actual name. if (name === 'SystemError') { ObjectDefineProperty(err, 'name', { value: name, enumerable: false, writable: true, configurable: true }); } else { delete err.name; } } // Utility function for registering the error codes. Only used here. Exported // *only* to allow for testing. function E(sym, val, def, ...otherClasses) { // Special case for SystemError that formats the error message differently // The SystemErrors only have SystemError as their base classes. messages.set(sym, val); if (def === SystemError) { def = makeSystemErrorWithCode(sym); } else { def = makeNodeErrorWithCode(def, sym); } if (otherClasses.length !== 0) { otherClasses.forEach((clazz) => { def[clazz.name] = makeNodeErrorWithCode(clazz, sym); }); } codes[sym] = def; } function getMessage(key, args, self) { const msg = messages.get(key); if (assert === undefined) assert = require('internal/assert'); if (typeof msg === 'function') { assert( msg.length <= args.length, // Default options do not count. `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${msg.length}).` ); return msg.apply(self, args); } const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length; assert( expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${expectedLength}).` ); if (args.length === 0) return msg; args.unshift(msg); return lazyInternalUtilInspect().format.apply(null, args); } let uvBinding; function lazyUv() { if (!uvBinding) { uvBinding = internalBinding('uv'); } return uvBinding; } const uvUnmappedError = ['UNKNOWN', 'unknown error']; function uvErrmapGet(name) { uvBinding = lazyUv(); if (!uvBinding.errmap) { uvBinding.errmap = uvBinding.getErrorMap(); } return uvBinding.errmap.get(name); } /** * This creates an error compatible with errors produced in the C++ * function UVException using a context object with data assembled in C++. * The goal is to migrate them to ERR_* errors later when compatibility is * not a concern. * * @param {Object} ctx * @returns {Error} */ function uvException(ctx) { const [ code, uvmsg ] = uvErrmapGet(ctx.errno) || uvUnmappedError; let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`; let path; let dest; if (ctx.path) { path = ctx.path.toString(); message += ` '${path}'`; } if (ctx.dest) { dest = ctx.dest.toString(); message += ` -> '${dest}'`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // Pass the message to the constructor instead of setting it on the object // to make sure it is the same as the one created in C++ // eslint-disable-next-line no-restricted-syntax const err = new Error(message); Error.stackTraceLimit = tmpLimit; for (const prop of ObjectKeys(ctx)) { if (prop === 'message' || prop === 'path' || prop === 'dest') { continue; } err[prop] = ctx[prop]; } err.code = code; if (path) { err.path = path; } if (dest) { err.dest = dest; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(err, excludedStackFn || uvException); return err; } /** * This creates an error compatible with errors produced in the C++ * This function should replace the deprecated * `exceptionWithHostPort()` function. * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @returns {Error} */ function uvExceptionWithHostPort(err, syscall, address, port) { const [ code, uvmsg ] = uvErrmapGet(err) || uvUnmappedError; const message = `${syscall} ${code}: ${uvmsg}`; let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${message}${details}`); Error.stackTraceLimit = tmpLimit; ex.code = code; ex.errno = err; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || uvExceptionWithHostPort); return ex; } /** * This used to be util._errnoException(). * * @param {number} err - A libuv error number * @param {string} syscall * @param {string} [original] * @returns {Error} */ function errnoException(err, syscall, original) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. if (util === undefined) util = require('util'); const code = util.getSystemErrorName(err); const message = original ? `${syscall} ${code} ${original}` : `${syscall} ${code}`; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); ex.errno = err; ex.code = code; ex.syscall = syscall; // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || errnoException); return ex; } /** * Deprecated, new function is `uvExceptionWithHostPort()` * New function added the error description directly * from C++. this method for backwards compatibility * @param {number} err - A libuv error number * @param {string} syscall * @param {string} address * @param {number} [port] * @param {string} [additional] * @returns {Error} */ function exceptionWithHostPort(err, syscall, address, port, additional) { // TODO(joyeecheung): We have to use the type-checked // getSystemErrorName(err) to guard against invalid arguments from users. // This can be replaced with [ code ] = errmap.get(err) when this method // is no longer exposed to user land. if (util === undefined) util = require('util'); const code = util.getSystemErrorName(err); let details = ''; if (port && port > 0) { details = ` ${address}:${port}`; } else if (address) { details = ` ${address}`; } if (additional) { details += ` - Local (${additional})`; } // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(`${syscall} ${code}${details}`); Error.stackTraceLimit = tmpLimit; ex.errno = err; ex.code = code; ex.syscall = syscall; ex.address = address; if (port) { ex.port = port; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || exceptionWithHostPort); return ex; } /** * @param {number|string} code - A libuv error number or a c-ares error code * @param {string} syscall * @param {string} [hostname] * @returns {Error} */ function dnsException(code, syscall, hostname) { let errno; // If `code` is of type number, it is a libuv error number, else it is a // c-ares error code. // TODO(joyeecheung): translate c-ares error codes into numeric ones and // make them available in a property that's not error.errno (since they // can be in conflict with libuv error codes). Also make sure // util.getSystemErrorName() can understand them when an being informed that // the number is a c-ares error code. if (typeof code === 'number') { errno = code; // ENOTFOUND is not a proper POSIX error, but this error has been in place // long enough that it's not practical to remove it. if (code === lazyUv().UV_EAI_NODATA || code === lazyUv().UV_EAI_NONAME) { code = 'ENOTFOUND'; // Fabricated error name. } else { code = lazyInternalUtil().getSystemErrorName(code); } } const message = `${syscall} ${code}${hostname ? ` ${hostname}` : ''}`; // Reducing the limit improves the performance significantly. We do not loose // the stack frames due to the `captureStackTrace()` function that is called // later. const tmpLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; // eslint-disable-next-line no-restricted-syntax const ex = new Error(message); Error.stackTraceLimit = tmpLimit; ex.errno = errno; ex.code = code; ex.syscall = syscall; if (hostname) { ex.hostname = hostname; } // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(ex, excludedStackFn || dnsException); return ex; } function connResetException(msg) { // eslint-disable-next-line no-restricted-syntax const ex = new Error(msg); ex.code = 'ECONNRESET'; return ex; } let maxStack_ErrorName; let maxStack_ErrorMessage; /** * Returns true if `err.name` and `err.message` are equal to engine-specific * values indicating max call stack size has been exceeded. * "Maximum call stack size exceeded" in V8. * * @param {Error} err * @returns {boolean} */ function isStackOverflowError(err) { if (maxStack_ErrorMessage === undefined) { try { function overflowStack() { overflowStack(); } overflowStack(); } catch (err) { maxStack_ErrorMessage = err.message; maxStack_ErrorName = err.name; } } return err && err.name === maxStack_ErrorName && err.message === maxStack_ErrorMessage; } // Only use this for integers! Decimal numbers do not work with this function. function addNumericalSeparator(val) { let res = ''; let i = val.length; const start = val[0] === '-' ? 1 : 0; for (; i >= start + 4; i -= 3) { res = `_${val.slice(i - 3, i)}${res}`; } return `${val.slice(0, i)}${res}`; } // Used to enhance the stack that will be picked up by the inspector const kEnhanceStackBeforeInspector = Symbol('kEnhanceStackBeforeInspector'); // These are supposed to be called only on fatal exceptions before // the process exits. const fatalExceptionStackEnhancers = { beforeInspector(error) { if (typeof error[kEnhanceStackBeforeInspector] !== 'function') { return error.stack; } try { // Set the error.stack here so it gets picked up by the // inspector. error.stack = error[kEnhanceStackBeforeInspector](); } catch { // We are just enhancing the error. If it fails, ignore it. } return error.stack; }, afterInspector(error) { const originalStack = error.stack; const { inspect, inspectDefaultOptions: { colors: defaultColors } } = lazyInternalUtilInspect(); const colors = (internalBinding('util').guessHandleType(2) === 'TTY' && require('internal/tty').hasColors()) || defaultColors; try { return inspect(error, { colors }); } catch { return originalStack; } } }; module.exports = { addCodeToName, // Exported for NghttpError codes, dnsException, errnoException, exceptionWithHostPort, getMessage, hideStackFrames, isStackOverflowError, connResetException, uvErrmapGet, uvException, uvExceptionWithHostPort, SystemError, // This is exported only to facilitate testing. E, kNoOverride, prepareStackTrace, maybeOverridePrepareStackTrace, overrideStackTrace, kEnhanceStackBeforeInspector, fatalExceptionStackEnhancers }; // To declare an error message, use the E(sym, val, def) function above. The sym // must be an upper case string. The val can be either a function or a string. // The def must be an error class. // The return value of the function must be a string. // Examples: // E('EXAMPLE_KEY1', 'This is the error value', Error); // E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`, RangeError); // // Once an error code has been assigned, the code itself MUST NOT change and // any given error code must never be reused to identify a different error. // // Any error code added here should also be added to the documentation // // Note: Please try to keep these in alphabetical order // // Note: Node.js specific errors must begin with the prefix ERR_ E('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); E('ERR_ARG_NOT_ITERABLE', '%s must be iterable', TypeError); E('ERR_ASSERTION', '%s', Error); E('ERR_ASYNC_CALLBACK', '%s must be a function', TypeError); E('ERR_ASYNC_TYPE', 'Invalid name for async "type": %s', TypeError); E('ERR_BROTLI_INVALID_PARAM', '%s is not a valid Brotli parameter', RangeError); E('ERR_BUFFER_OUT_OF_BOUNDS', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name = undefined) => { if (name) { return `"${name}" is outside of buffer bounds`; } return 'Attempt to access memory outside buffer bounds'; }, RangeError); E('ERR_BUFFER_TOO_LARGE', `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`, RangeError); E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals', Error); E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received', Error); E('ERR_CHILD_PROCESS_IPC_REQUIRED', "Forked processes must have an IPC channel, missing value 'ipc' in %s", Error); E('ERR_CHILD_PROCESS_STDIO_MAXBUFFER', '%s maxBuffer length exceeded', RangeError); E('ERR_CONSOLE_WRITABLE_STREAM', 'Console expects a writable stream instance for %s', TypeError); E('ERR_CONTEXT_NOT_INITIALIZED', 'context used is not initialized', Error); E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s', Error); E('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', 'Custom engines not supported by this OpenSSL', Error); E('ERR_CRYPTO_ECDH_INVALID_FORMAT', 'Invalid ECDH format: %s', TypeError); E('ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY', 'Public key is not valid for specified curve', Error); E('ERR_CRYPTO_ENGINE_UNKNOWN', 'Engine "%s" was not found', Error); E('ERR_CRYPTO_FIPS_FORCED', 'Cannot set FIPS mode, it was forced with --force-fips at startup.', Error); E('ERR_CRYPTO_FIPS_UNAVAILABLE', 'Cannot set FIPS mode in a non-FIPS build.', Error); E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error); E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY', 'Incompatible %s: %s', Error); E('ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS', 'The selected key encoding %s %s.', Error); E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError); E('ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE', 'Invalid key object type %s, expected %s.', TypeError); E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error); E('ERR_CRYPTO_PBKDF2_ERROR', 'PBKDF2 error', Error); E('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error); E('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error); // Switch to TypeError. The current implementation does not seem right. E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error); E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH', 'Input buffers must have the same byte length', RangeError); E('ERR_DIR_CLOSED', 'Directory handle was closed', Error); E('ERR_DIR_CONCURRENT_OPERATION', 'Cannot do synchronous work on directory handle with concurrent ' + 'asynchronous operations', Error); E('ERR_DNS_SET_SERVERS_FAILED', 'c-ares failed to set servers: "%s" [%s]', Error); E('ERR_DOMAIN_CALLBACK_NOT_AVAILABLE', 'A callback was registered through ' + 'process.setUncaughtExceptionCaptureCallback(), which is mutually ' + 'exclusive with using the `domain` module', Error); E('ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE', 'The `domain` module is in use, which is mutually exclusive with calling ' + 'process.setUncaughtExceptionCaptureCallback()', Error); E('ERR_ENCODING_INVALID_ENCODED_DATA', function(encoding, ret) { this.errno = ret; return `The encoded data was not valid for encoding ${encoding}`; }, TypeError); E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported', RangeError); E('ERR_EVAL_ESM_CANNOT_PRINT', '--print cannot be used with ESM input', Error); E('ERR_FALSY_VALUE_REJECTION', function(reason) { this.reason = reason; return 'Promise was rejected with falsy value'; }, Error); E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', 'The feature %s is unavailable on the current platform' + ', which is being used to run Node.js', TypeError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', 'Symlink type must be one of "dir", "file", or "junction". Received "%s"', Error); // Switch to TypeError. The current implementation does not seem right E('ERR_HTTP2_ALTSVC_INVALID_ORIGIN', 'HTTP/2 ALTSVC frames require a valid origin', TypeError); E('ERR_HTTP2_ALTSVC_LENGTH', 'HTTP/2 ALTSVC frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_CONNECT_AUTHORITY', ':authority header is required for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_PATH', 'The :path header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_CONNECT_SCHEME', 'The :scheme header is forbidden for CONNECT requests', Error); E('ERR_HTTP2_GOAWAY_SESSION', 'New streams cannot be created after receiving a GOAWAY', Error); E('ERR_HTTP2_HEADERS_AFTER_RESPOND', 'Cannot specify additional headers after response initiated', Error); E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error); E('ERR_HTTP2_HEADER_SINGLE_VALUE', 'Header field "%s" must only have a single value', TypeError); E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', 'Informational status codes cannot be used', RangeError); E('ERR_HTTP2_INVALID_CONNECTION_HEADERS', 'HTTP/1 Connection specific headers are forbidden: "%s"', TypeError); E('ERR_HTTP2_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP2_INVALID_INFO_STATUS', 'Invalid informational status code: %s', RangeError); E('ERR_HTTP2_INVALID_ORIGIN', 'HTTP/2 ORIGIN frames require a valid origin', TypeError); E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', 'Packed settings length must be a multiple of six', RangeError); E('ERR_HTTP2_INVALID_PSEUDOHEADER', '"%s" is an invalid pseudoheader or is used incorrectly', TypeError); E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error); E('ERR_HTTP2_INVALID_SETTING_VALUE', // Using default arguments here is important so the arguments are not counted // towards `Function#length`. function(name, actual, min = undefined, max = undefined) { this.actual = actual; if (min !== undefined) { this.min = min; this.max = max; } return `Invalid value for setting "${name}": ${actual}`; }, TypeError, RangeError); E('ERR_HTTP2_INVALID_STREAM', 'The stream has been destroyed', Error); E('ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', 'Maximum number of pending settings acknowledgements', Error); E('ERR_HTTP2_NESTED_PUSH', 'A push stream cannot initiate another push stream.', Error); E('ERR_HTTP2_NO_SOCKET_MANIPULATION', 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)', Error); E('ERR_HTTP2_ORIGIN_LENGTH', 'HTTP/2 ORIGIN frames are limited to 16382 bytes', TypeError); E('ERR_HTTP2_OUT_OF_STREAMS', 'No stream ID is available because maximum stream ID has been reached', Error); E('ERR_HTTP2_PAYLOAD_FORBIDDEN', 'Responses with %s status must not have a payload', Error); E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error); E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError); E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', 'Cannot set HTTP/2 pseudo-headers', TypeError); E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error); E('ERR_HTTP2_SEND_FILE', 'Directories cannot be sent', Error); E('ERR_HTTP2_SEND_FILE_NOSEEK', 'Offset or length can only be specified for regular files', Error); E('ERR_HTTP2_SESSION_ERROR', 'Session closed with error code %s', Error); E('ERR_HTTP2_SETTINGS_CANCEL', 'HTTP2 session settings canceled', Error); E('ERR_HTTP2_SOCKET_BOUND', 'The socket is already bound to an Http2Session', Error); E('ERR_HTTP2_SOCKET_UNBOUND', 'The socket has been disconnected from the Http2Session', Error); E('ERR_HTTP2_STATUS_101', 'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2', Error); E('ERR_HTTP2_STATUS_INVALID', 'Invalid status code: %s', RangeError); E('ERR_HTTP2_STREAM_CANCEL', function(error) { let msg = 'The pending stream has been canceled'; if (error) { this.cause = error; if (typeof error.message === 'string') msg += ` (caused by: ${error.message})`; } return msg; }, Error); E('ERR_HTTP2_STREAM_ERROR', 'Stream closed with error code %s', Error); E('ERR_HTTP2_STREAM_SELF_DEPENDENCY', 'A stream cannot depend on itself', Error); E('ERR_HTTP2_TRAILERS_ALREADY_SENT', 'Trailing headers have already been sent', Error); E('ERR_HTTP2_TRAILERS_NOT_READY', 'Trailing headers cannot be sent until after the wantTrailers event is ' + 'emitted', Error); E('ERR_HTTP2_UNSUPPORTED_PROTOCOL', 'protocol "%s" is unsupported.', Error); E('ERR_HTTP_HEADERS_SENT', 'Cannot %s headers after they are sent to the client', Error); E('ERR_HTTP_INVALID_HEADER_VALUE', 'Invalid value "%s" for header "%s"', TypeError); E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s', RangeError); E('ERR_HTTP_TRAILER_INVALID', 'Trailers are invalid with this transfer encoding', Error); E('ERR_INCOMPATIBLE_OPTION_PAIR', 'Option "%s" cannot be used in combination with option "%s"', TypeError); E('ERR_INPUT_TYPE_NOT_ALLOWED', '--input-type can only be used with string ' + 'input via --eval, --print, or STDIN', Error); E('ERR_INSPECTOR_ALREADY_CONNECTED', '%s is already connected', Error); E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error); E('ERR_INSPECTOR_COMMAND', 'Inspector error %d: %s', Error); E('ERR_INSPECTOR_NOT_ACTIVE', 'Inspector is not active', Error); E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error); E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error); E('ERR_INSPECTOR_NOT_WORKER', 'Current thread is not a worker', Error); E('ERR_INTERNAL_ASSERTION', (message) => { const suffix = 'This is caused by either a bug in Node.js ' + 'or incorrect usage of Node.js internals.\n' + 'Please open an issue with this stack trace at ' + 'https://github.com/nodejs/node/issues\n'; return message === undefined ? suffix : `${message}\n${suffix}`; }, Error); E('ERR_INVALID_ADDRESS_FAMILY', function(addressType, host, port) { this.host = host; this.port = port; return `Invalid address family: ${addressType} ${host}:${port}`; }, RangeError); E('ERR_INVALID_ARG_TYPE', (name, expected, actual) => { assert(typeof name === 'string', "'name' must be a string"); if (!ArrayIsArray(expected)) { expected = [expected]; } let msg = 'The '; if (name.endsWith(' argument')) { // For cases like 'first argument' msg += `${name} `; } else { const type = name.includes('.') ? 'property' : 'argument'; msg += `"${name}" ${type} `; } msg += 'must be '; const types = []; const instances = []; const other = []; for (const value of expected) { assert(typeof value === 'string', 'All expected entries have to be of type string'); if (kTypes.includes(value)) { types.push(value.toLowerCase()); } else if (classRegExp.test(value)) { instances.push(value); } else { assert(value !== 'object', 'The value "object" should be written as "Object"'); other.push(value); } } // Special handle `object` in case other instances are allowed to outline // the differences between each other. if (instances.length > 0) { const pos = types.indexOf('object'); if (pos !== -1) { types.splice(pos, 1); instances.push('Object'); } } if (types.length > 0) { if (types.length > 2) { const last = types.pop(); msg += `one of type ${types.join(', ')}, or ${last}`; } else if (types.length === 2) { msg += `one of type ${types[0]} or ${types[1]}`; } else { msg += `of type ${types[0]}`; } if (instances.length > 0 || other.length > 0) msg += ' or '; } if (instances.length > 0) { if (instances.length > 2) { const last = instances.pop(); msg += `an instance of ${instances.join(', ')}, or ${last}`; } else { msg += `an instance of ${instances[0]}`; if (instances.length === 2) { msg += ` or ${instances[1]}`; } } if (other.length > 0) msg += ' or '; } if (other.length > 0) { if (other.length > 2) { const last = other.pop(); msg += `one of ${other.join(', ')}, or ${last}`; } else if (other.length === 2) { msg += `one of ${other[0]} or ${other[1]}`; } else { if (other[0].toLowerCase() !== other[0]) msg += 'an '; msg += `${other[0]}`; } } if (actual == null) { msg += `. Received ${actual}`; } else if (typeof actual === 'function' && actual.name) { msg += `. Received function ${actual.name}`; } else if (typeof actual === 'object') { if (actual.constructor && actual.constructor.name) { msg += `. Received an instance of ${actual.constructor.name}`; } else { const inspected = lazyInternalUtilInspect() .inspect(actual, { depth: -1 }); msg += `. Received ${inspected}`; } } else { let inspected = lazyInternalUtilInspect() .inspect(actual, { colors: false }); if (inspected.length > 25) inspected = `${inspected.slice(0, 25)}...`; msg += `. Received type ${typeof actual} (${inspected})`; } return msg; }, TypeError); E('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { let inspected = lazyInternalUtilInspect().inspect(value); if (inspected.length > 128) { inspected = `${inspected.slice(0, 128)}...`; } return `The argument '${name}' ${reason}. Received ${inspected}`; }, TypeError, RangeError); E('ERR_INVALID_ASYNC_ID', 'Invalid %s value: %s', RangeError); E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s', RangeError); E('ERR_INVALID_CALLBACK', 'Callback must be a function. Received %O', TypeError); E('ERR_INVALID_CHAR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (name, field = undefined) => { let msg = `Invalid character in ${name}`; if (field !== undefined) { msg += ` ["${field}"]`; } return msg; }, TypeError); E('ERR_INVALID_CURSOR_POS', 'Cannot set cursor row without setting its column', TypeError); E('ERR_INVALID_FD', '"fd" must be a positive integer: %s', RangeError); E('ERR_INVALID_FD_TYPE', 'Unsupported fd type: %s', TypeError); E('ERR_INVALID_FILE_URL_HOST', 'File URL host must be "localhost" or empty on %s', TypeError); E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError); E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError); E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]', TypeError); E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError); E('ERR_INVALID_MODULE_SPECIFIER', (pkgPath, subpath, base = undefined) => { if (subpath === undefined) { return `Invalid package name '${pkgPath}' imported from ${base}`; } else if (base === undefined) { assert(subpath !== '.'); return `Package subpath '${subpath}' is not a valid module request for ` + `the "exports" resolution of ${pkgPath}${sep}package.json`; } return `Package subpath '${subpath}' is not a valid module request for ` + `the "exports" resolution of ${pkgPath} imported from ${base}`; }, TypeError); E('ERR_INVALID_OPT_VALUE', (name, value) => `The value "${String(value)}" is invalid for option "${name}"`, TypeError, RangeError); E('ERR_INVALID_OPT_VALUE_ENCODING', 'The value "%s" is invalid for option "encoding"', TypeError); E('ERR_INVALID_PACKAGE_CONFIG', (path, message, hasMessage = true) => { if (hasMessage) return `Invalid package config ${path}${sep}package.json, ${message}`; return `Invalid JSON in ${path} imported from ${message}`; }, Error); E('ERR_INVALID_PACKAGE_TARGET', (pkgPath, key, subpath, target, base = undefined) => { const relError = typeof target === 'string' && target.length && !StringPrototypeStartsWith(target, './'); if (key === null) { if (subpath !== '') { return `Invalid "exports" target ${JSONStringify(target)} defined ` + `for '${subpath}' in the package config ${pkgPath} imported from ` + `${base}.${relError ? '; targets must start with "./"' : ''}`; } return `Invalid "exports" main target ${target} defined in the ` + `package config ${pkgPath} imported from ${base}${relError ? '; targets must start with "./"' : ''}`; } else if (key === '.') { return `Invalid "exports" main target ${JSONStringify(target)} defined ` + `in the package config ${pkgPath}${sep}package.json${relError ? '; targets must start with "./"' : ''}`; } else if (relError) { return `Invalid "exports" target ${JSONStringify(target)} defined for '${ StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` + `package config ${pkgPath}${sep}package.json; ` + 'targets must start with "./"'; } return `Invalid "exports" target ${JSONStringify(target)} defined for '${ StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` + `package config ${pkgPath}${sep}package.json`; }, Error); E('ERR_INVALID_PERFORMANCE_MARK', 'The "%s" performance mark has not been set', Error); E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', TypeError); E('ERR_INVALID_REPL_EVAL_CONFIG', 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError); E('ERR_INVALID_REPL_INPUT', '%s', TypeError); E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => { return `Expected a valid ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${value}.`; }, TypeError); E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => { let type; if (value && value.constructor && value.constructor.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned for the "${prop}" from the` + ` "${name}" function but got ${type}.`; }, TypeError); E('ERR_INVALID_RETURN_VALUE', (input, name, value) => { let type; if (value && value.constructor && value.constructor.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`; } return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.`; }, TypeError); E('ERR_INVALID_SYNC_FORK_INPUT', 'Asynchronous forks do not support ' + 'Buffer, TypedArray, DataView or string input: %s', TypeError); E('ERR_INVALID_THIS', 'Value of "this" must be of type %s', TypeError); E('ERR_INVALID_TUPLE', '%s must be an iterable %s tuple', TypeError); E('ERR_INVALID_URI', 'URI malformed', URIError); E('ERR_INVALID_URL', function(input) { this.input = input; return `Invalid URL: ${input}`; }, TypeError); E('ERR_INVALID_URL_SCHEME', (expected) => { if (typeof expected === 'string') expected = [expected]; assert(expected.length <= 2); const res = expected.length === 2 ? `one of scheme ${expected[0]} or ${expected[1]}` : `of scheme ${expected[0]}`; return `The URL must be ${res}`; }, TypeError); E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed', Error); E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected', Error); E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe', Error); E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks', Error); E('ERR_MANIFEST_ASSERT_INTEGRITY', (moduleURL, realIntegrities) => { let msg = `The content of "${ moduleURL }" does not match the expected integrity.`; if (realIntegrities.size) { const sri = [...realIntegrities.entries()].map(([alg, dgs]) => { return `${alg}-${dgs}`; }).join(' '); msg += ` Integrities found are: ${sri}`; } else { msg += ' The resource was not found in the policy.'; } return msg; }, Error); E('ERR_MANIFEST_DEPENDENCY_MISSING', 'Manifest resource %s does not list %s as a dependency specifier', Error); E('ERR_MANIFEST_INTEGRITY_MISMATCH', 'Manifest resource %s has multiple entries but integrity lists do not match', SyntaxError); E('ERR_MANIFEST_INVALID_RESOURCE_FIELD', 'Manifest resource %s has invalid property value for %s', TypeError); E('ERR_MANIFEST_TDZ', 'Manifest initialization has not yet run', Error); E('ERR_MANIFEST_UNKNOWN_ONERROR', 'Manifest specified unknown error behavior "%s".', SyntaxError); E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error); E('ERR_MISSING_ARGS', (...args) => { assert(args.length > 0, 'At least one arg needs to be specified'); let msg = 'The '; const len = args.length; args = args.map((a) => `"${a}"`); switch (len) { case 1: msg += `${args[0]} argument`; break; case 2: msg += `${args[0]} and ${args[1]} arguments`; break; default: msg += args.slice(0, len - 1).join(', '); msg += `, and ${args[len - 1]} arguments`; break; } return `${msg} must be specified`; }, TypeError); E('ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK', 'The ES Module loader may not return a format of \'dynamic\' when no ' + 'dynamicInstantiate function was provided', Error); E('ERR_MISSING_OPTION', '%s is required', TypeError); E('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { return `Cannot find ${type} '${path}' imported from ${base}`; }, Error); E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error); E('ERR_NAPI_CONS_FUNCTION', 'Constructor must be a function', TypeError); E('ERR_NAPI_INVALID_DATAVIEW_ARGS', 'byte_offset + byte_length should be less than or equal to the size in ' + 'bytes of the array passed in', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT', 'start offset of %s should be a multiple of %s', RangeError); E('ERR_NAPI_INVALID_TYPEDARRAY_LENGTH', 'Invalid typed array length', RangeError); E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support', Error); E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); let msg = replaceDefaultBoolean ? str : `The value of "${str}" is out of range.`; let received; if (NumberIsInteger(input) && MathAbs(input) > 2 ** 32) { received = addNumericalSeparator(String(input)); } else if (typeof input === 'bigint') { received = String(input); if (input > 2n ** 32n || input < -(2n ** 32n)) { received = addNumericalSeparator(received); } received += 'n'; } else { received = lazyInternalUtilInspect().inspect(input); } msg += ` It must be ${range}. Received ${received}`; return msg; }, RangeError); E('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => { if (subpath === '.') { return `No "exports" main resolved in ${pkgPath}${sep}package.json`; } else if (base === undefined) { return `Package subpath '${subpath}' is not defined by "exports" in ${ pkgPath}${sep}package.json`; } return `Package subpath '${subpath}' is not defined by "exports" in ${ pkgPath} imported from ${base}`; }, Error); E('ERR_REQUIRE_ESM', (filename, parentPath = null, packageJsonPath = null) => { let msg = `Must use import to load ES Module: ${filename}`; if (parentPath && packageJsonPath) { const path = require('path'); const basename = path.basename(filename) === path.basename(parentPath) ? filename : path.basename(filename); msg += '\nrequire() of ES modules is not supported.\nrequire() of ' + `${filename} ${parentPath ? `from ${parentPath} ` : ''}` + 'is an ES module file as it is a .js file whose nearest parent ' + 'package.json contains "type": "module" which defines all .js ' + 'files in that package scope as ES modules.\nInstead rename ' + `${basename} to end in .cjs, change the requiring code to use ` + 'import(), or remove "type": "module" from ' + `${packageJsonPath}.\n`; return msg; } return msg; }, Error); E('ERR_SCRIPT_EXECUTION_INTERRUPTED', 'Script execution was interrupted by `SIGINT`', Error); E('ERR_SERVER_ALREADY_LISTEN', 'Listen method has been called more than once without closing.', Error); E('ERR_SERVER_NOT_RUNNING', 'Server is not running.', Error); E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound', Error); E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer', TypeError); E('ERR_SOCKET_BAD_PORT', (name, port, allowZero = true) => { assert(typeof allowZero === 'boolean', "The 'allowZero' argument must be of type boolean."); const operator = allowZero ? '>=' : '>'; return `${name} should be ${operator} 0 and < 65536. Received ${port}.`; }, RangeError); E('ERR_SOCKET_BAD_TYPE', 'Bad socket type specified. Valid types are: udp4, udp6', TypeError); E('ERR_SOCKET_BUFFER_SIZE', 'Could not get or set buffer size', SystemError); E('ERR_SOCKET_CLOSED', 'Socket is closed', Error); E('ERR_SOCKET_DGRAM_IS_CONNECTED', 'Already connected', Error); E('ERR_SOCKET_DGRAM_NOT_CONNECTED', 'Not connected', Error); E('ERR_SOCKET_DGRAM_NOT_RUNNING', 'Not running', Error); E('ERR_SRI_PARSE', 'Subresource Integrity string %j had an unexpected %j at position %d', SyntaxError); E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error); E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error); E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error); E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error); E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error); E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error); E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error); E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error); E('ERR_SYNTHETIC', 'JavaScript Callstack', Error); E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError); E('ERR_TLS_CERT_ALTNAME_INVALID', function(reason, host, cert) { this.reason = reason; this.host = host; this.cert = cert; return `Hostname/IP does not match certificate's altnames: ${reason}`; }, Error); E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error); E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error); E('ERR_TLS_INVALID_CONTEXT', '%s must be a SecureContext', TypeError), E('ERR_TLS_INVALID_STATE', 'TLS socket connection must be securely established', Error), E('ERR_TLS_INVALID_PROTOCOL_VERSION', '%j is not a valid %s TLS protocol version', TypeError); E('ERR_TLS_PROTOCOL_VERSION_CONFLICT', 'TLS protocol version %j conflicts with secureProtocol %j', TypeError); E('ERR_TLS_RENEGOTIATION_DISABLED', 'TLS session renegotiation disabled for this socket', Error); // This should probably be a `TypeError`. E('ERR_TLS_REQUIRED_SERVER_NAME', '"servername" is required parameter for Server.addContext', Error); E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error); E('ERR_TLS_SNI_FROM_SERVER', 'Cannot issue SNI from a TLS server-side socket', Error); E('ERR_TRACE_EVENTS_CATEGORY_REQUIRED', 'At least one category is required', TypeError); E('ERR_TRACE_EVENTS_UNAVAILABLE', 'Trace events are unavailable', Error); // This should probably be a `RangeError`. E('ERR_TTY_INIT_FAILED', 'TTY initialization failed', SystemError); E('ERR_UNAVAILABLE_DURING_EXIT', 'Cannot call function in process exit ' + 'handler', Error); E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', '`process.setupUncaughtExceptionCapture()` was called while a capture ' + 'callback was already active', Error); E('ERR_UNESCAPED_CHARACTERS', '%s contains unescaped characters', TypeError); E('ERR_UNHANDLED_ERROR', // Using a default argument here is important so the argument is not counted // towards `Function#length`. (err = undefined) => { const msg = 'Unhandled error.'; if (err === undefined) return msg; return `${msg} (${err})`; }, Error); E('ERR_UNKNOWN_BUILTIN_MODULE', 'No such built-in module: %s', Error); E('ERR_UNKNOWN_CREDENTIAL', '%s identifier does not exist: %s', Error); E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError); E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension "%s" for %s', TypeError); E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError); E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError); E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules, imported from %s', Error); E('ERR_UNSUPPORTED_ESM_URL_SCHEME', 'Only file and data URLs are supported ' + 'by the default ESM loader', Error); E('ERR_V8BREAKITERATOR', 'Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl', Error); // This should probably be a `TypeError`. E('ERR_VALID_PERFORMANCE_ENTRY_TYPE', 'At least one valid performance entry type is required', Error); E('ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING', 'A dynamic import callback was not specified.', TypeError); E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error); E('ERR_VM_MODULE_CANNOT_CREATE_CACHED_DATA', 'Cached data cannot be created for a module which has been evaluated', Error); E('ERR_VM_MODULE_DIFFERENT_CONTEXT', 'Linked modules must use the same context', Error); E('ERR_VM_MODULE_LINKING_ERRORED', 'Linking has already failed for the provided module', Error); E('ERR_VM_MODULE_NOT_MODULE', 'Provided module is not an instance of Module', Error); E('ERR_VM_MODULE_STATUS', 'Module status %s', Error); E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error); E('ERR_WORKER_INIT_FAILED', 'Worker initialization failure: %s', Error); E('ERR_WORKER_INVALID_EXEC_ARGV', (errors, msg = 'invalid execArgv flags') => `Initiated Worker with ${msg}: ${errors.join(', ')}`, Error); E('ERR_WORKER_NOT_RUNNING', 'Worker instance not running', Error); E('ERR_WORKER_OUT_OF_MEMORY', 'Worker terminated due to reaching memory limit: %s', Error); E('ERR_WORKER_PATH', (filename) => 'The worker script or module filename must be an absolute path or a ' + 'relative path starting with \'./\' or \'../\'.' + (filename.startsWith('file://') ? ' Wrap file:// URLs with `new URL`.' : '' ) + ` Received "${filename}"`, TypeError); E('ERR_WORKER_UNSERIALIZABLE_ERROR', 'Serializing an uncaught exception failed', Error); E('ERR_WORKER_UNSUPPORTED_EXTENSION', 'The worker script extension must be ".js", ".mjs", or ".cjs". Received "%s"', TypeError); E('ERR_WORKER_UNSUPPORTED_OPERATION', '%s is not supported in workers', TypeError); E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error); ts-node-10.9.2/raw/node-internal-modules-cjs-helpers-v17.0.1-stripped.js000066400000000000000000000047201453460306300254740ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.1/lib/internal/modules/cjs/helpers.js 'use strict'; const { ArrayPrototypeForEach, ObjectDefineProperty, ObjectPrototypeHasOwnProperty, SafeSet, StringPrototypeIncludes, StringPrototypeSlice, StringPrototypeStartsWith, } = primordials; const { getOptionValue } = require('internal/options'); const userConditions = getOptionValue('--conditions'); const noAddons = getOptionValue('--no-addons'); const addonConditions = noAddons ? [] : ['node-addons']; // TODO: Use this set when resolving pkg#exports conditions in loader.js. const cjsConditions = new SafeSet([ 'require', 'node', ...addonConditions, ...userConditions, ]); function addBuiltinLibsToObject(object, dummyModuleName) { // Make built-in modules available directly (loaded lazily). const Module = require('internal/modules/cjs/loader').Module; const { builtinModules } = Module; // To require built-in modules in user-land and ignore modules whose // `canBeRequiredByUsers` is false. So we create a dummy module object and not // use `require()` directly. const dummyModule = new Module(dummyModuleName); ArrayPrototypeForEach(builtinModules, (name) => { // Neither add underscored modules, nor ones that contain slashes (e.g., // 'fs/promises') or ones that are already defined. if (StringPrototypeStartsWith(name, '_') || StringPrototypeIncludes(name, '/') || ObjectPrototypeHasOwnProperty(object, name)) { return; } // Goals of this mechanism are: // - Lazy loading of built-in modules // - Having all built-in modules available as non-enumerable properties // - Allowing the user to re-assign these variables as if there were no // pre-existing globals with the same name. const setReal = (val) => { // Deleting the property before re-assigning it disables the // getter/setter mechanism. delete object[name]; object[name] = val; }; ObjectDefineProperty(object, name, { get: () => { const lib = dummyModule.require(name); // Disable the current getter/setter and set up a new // non-enumerable property. delete object[name]; ObjectDefineProperty(object, name, { get: () => lib, set: setReal, configurable: true, enumerable: false }); return lib; }, set: setReal, configurable: true, enumerable: false }); }); } ts-node-10.9.2/raw/node-internal-modules-cjs-helpers-v17.0.1.js000066400000000000000000000152721453460306300236500ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.1/lib/internal/modules/cjs/helpers.js 'use strict'; const { ArrayPrototypeForEach, ArrayPrototypeJoin, ArrayPrototypeSome, ObjectDefineProperty, ObjectPrototypeHasOwnProperty, SafeMap, SafeSet, StringPrototypeCharCodeAt, StringPrototypeIncludes, StringPrototypeSlice, StringPrototypeStartsWith, } = primordials; const { ERR_MANIFEST_DEPENDENCY_MISSING, ERR_UNKNOWN_BUILTIN_MODULE } = require('internal/errors').codes; const { NativeModule } = require('internal/bootstrap/loaders'); const { validateString } = require('internal/validators'); const path = require('path'); const { pathToFileURL, fileURLToPath, URL } = require('internal/url'); const { getOptionValue } = require('internal/options'); const userConditions = getOptionValue('--conditions'); let debug = require('internal/util/debuglog').debuglog('module', (fn) => { debug = fn; }); const noAddons = getOptionValue('--no-addons'); const addonConditions = noAddons ? [] : ['node-addons']; // TODO: Use this set when resolving pkg#exports conditions in loader.js. const cjsConditions = new SafeSet([ 'require', 'node', ...addonConditions, ...userConditions, ]); function loadNativeModule(filename, request) { const mod = NativeModule.map.get(filename); if (mod?.canBeRequiredByUsers) { debug('load native module %s', request); // compileForPublicLoader() throws if mod.canBeRequiredByUsers is false: mod.compileForPublicLoader(); return mod; } } // Invoke with makeRequireFunction(module) where |module| is the Module object // to use as the context for the require() function. // Use redirects to set up a mapping from a policy and restrict dependencies const urlToFileCache = new SafeMap(); function makeRequireFunction(mod, redirects) { const Module = mod.constructor; let require; if (redirects) { const id = mod.filename || mod.id; const conditions = cjsConditions; const { resolve, reaction } = redirects; require = function require(specifier) { let missing = true; const destination = resolve(specifier, conditions); if (destination === true) { missing = false; } else if (destination) { const href = destination.href; if (destination.protocol === 'node:') { const specifier = destination.pathname; const mod = loadNativeModule(specifier, href); if (mod && mod.canBeRequiredByUsers) { return mod.exports; } throw new ERR_UNKNOWN_BUILTIN_MODULE(specifier); } else if (destination.protocol === 'file:') { let filepath; if (urlToFileCache.has(href)) { filepath = urlToFileCache.get(href); } else { filepath = fileURLToPath(destination); urlToFileCache.set(href, filepath); } return mod.require(filepath); } } if (missing) { reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( id, specifier, ArrayPrototypeJoin([...conditions], ', ') )); } return mod.require(specifier); }; } else { require = function require(path) { return mod.require(path); }; } function resolve(request, options) { validateString(request, 'request'); return Module._resolveFilename(request, mod, false, options); } require.resolve = resolve; function paths(request) { validateString(request, 'request'); return Module._resolveLookupPaths(request, mod); } resolve.paths = paths; require.main = process.mainModule; // Enable support to add extra extension types. require.extensions = Module._extensions; require.cache = Module._cache; return require; } /** * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) * because the buffer-to-string conversion in `fs.readFileSync()` * translates it to FEFF, the UTF-16 BOM. */ function stripBOM(content) { if (StringPrototypeCharCodeAt(content) === 0xFEFF) { content = StringPrototypeSlice(content, 1); } return content; } function addBuiltinLibsToObject(object, dummyModuleName) { // Make built-in modules available directly (loaded lazily). const Module = require('internal/modules/cjs/loader').Module; const { builtinModules } = Module; // To require built-in modules in user-land and ignore modules whose // `canBeRequiredByUsers` is false. So we create a dummy module object and not // use `require()` directly. const dummyModule = new Module(dummyModuleName); ArrayPrototypeForEach(builtinModules, (name) => { // Neither add underscored modules, nor ones that contain slashes (e.g., // 'fs/promises') or ones that are already defined. if (StringPrototypeStartsWith(name, '_') || StringPrototypeIncludes(name, '/') || ObjectPrototypeHasOwnProperty(object, name)) { return; } // Goals of this mechanism are: // - Lazy loading of built-in modules // - Having all built-in modules available as non-enumerable properties // - Allowing the user to re-assign these variables as if there were no // pre-existing globals with the same name. const setReal = (val) => { // Deleting the property before re-assigning it disables the // getter/setter mechanism. delete object[name]; object[name] = val; }; ObjectDefineProperty(object, name, { get: () => { const lib = dummyModule.require(name); // Disable the current getter/setter and set up a new // non-enumerable property. delete object[name]; ObjectDefineProperty(object, name, { get: () => lib, set: setReal, configurable: true, enumerable: false }); return lib; }, set: setReal, configurable: true, enumerable: false }); }); } function normalizeReferrerURL(referrer) { if (typeof referrer === 'string' && path.isAbsolute(referrer)) { return pathToFileURL(referrer).href; } return new URL(referrer).href; } // For error messages only - used to check if ESM syntax is in use. function hasEsmSyntax(code) { debug('Checking for ESM syntax'); const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser; let root; try { root = parser.parse(code, { sourceType: 'module', ecmaVersion: 'latest' }); } catch { return false; } return ArrayPrototypeSome(root.body, (stmt) => stmt.type === 'ExportDefaultDeclaration' || stmt.type === 'ExportNamedDeclaration' || stmt.type === 'ImportDeclaration' || stmt.type === 'ExportAllDeclaration'); } module.exports = { addBuiltinLibsToObject, cjsConditions, hasEsmSyntax, loadNativeModule, makeRequireFunction, normalizeReferrerURL, stripBOM, }; ts-node-10.9.2/raw/node-internal-modules-cjs-loader-2d5d77306f6dff9110c1f77fefab25f973415770.js000066400000000000000000001235361453460306300301450ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/modules/cjs/loader.js // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; const { ArrayIsArray, Error, JSONParse, Map, Number, ObjectCreate, ObjectDefineProperty, ObjectFreeze, ObjectGetOwnPropertyDescriptor, ObjectGetPrototypeOf, ObjectIs, ObjectKeys, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, ReflectSet, RegExpPrototypeTest, SafeMap, String, StringPrototypeIndexOf, StringPrototypeMatch, StringPrototypeSlice, StringPrototypeStartsWith, } = primordials; const { NativeModule } = require('internal/bootstrap/loaders'); const { maybeCacheSourceMap, rekeySourceMap } = require('internal/source_map/source_map_cache'); const { pathToFileURL, fileURLToPath, URL } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); const assert = require('internal/assert'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { emitWarningSync } = require('internal/process/warning'); const { internalModuleReadJSON, internalModuleStat } = internalBinding('fs'); const { safeGetenv } = internalBinding('credentials'); const { makeRequireFunction, normalizeReferrerURL, stripBOM, loadNativeModule } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); const enableSourceMaps = getOptionValue('--enable-source-maps'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const manifest = getOptionValue('--experimental-policy') ? require('internal/process/policy').manifest : null; const { compileFunction } = internalBinding('contextify'); // Whether any user-provided CJS modules had been loaded (executed). // Used for internal assertions. let hasLoadedAnyUserCJSModule = false; const { ERR_INVALID_ARG_VALUE, ERR_INVALID_OPT_VALUE, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_INVALID_MODULE_SPECIFIER, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_REQUIRE_ESM } = require('internal/errors').codes; const { validateString } = require('internal/validators'); const pendingDeprecation = getOptionValue('--pending-deprecation'); module.exports = { wrapSafe, Module, toRealPath, readPackageScope, get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; } }; let asyncESM, ModuleJob, ModuleWrap, kInstantiated; const { CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_COLON } = require('internal/constants'); const { isProxy } = require('internal/util/types'); const isWindows = process.platform === 'win32'; const relativeResolveCache = ObjectCreate(null); let requireDepth = 0; let statCache = null; function enrichCJSError(err) { const stack = err.stack.split('\n'); const lineWithErr = stack[1]; /* The regular expression below targets the most common import statement usage. However, some cases are not matching, cases like import statement after a comment block and/or after a variable definition. */ if (err.message.startsWith('Unexpected token \'export\'') || (RegExpPrototypeTest(/^\s*import(?=[ {'"*])\s*(?![ (])/, lineWithErr))) { // Emit the warning synchronously because we are in the middle of handling // a SyntaxError that will throw and likely terminate the process before an // asynchronous warning would be emitted. emitWarningSync( 'To load an ES module, set "type": "module" in the package.json or use ' + 'the .mjs extension.' ); } } function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } const result = internalModuleStat(filename); if (statCache !== null) statCache.set(filename, result); return result; } function updateChildren(parent, child, scan) { const children = parent && parent.children; if (children && !(scan && children.includes(child))) children.push(child); } function Module(id = '', parent) { this.id = id; this.path = path.dirname(id); this.exports = {}; this.parent = parent; updateChildren(parent, this, false); this.filename = null; this.loaded = false; this.children = []; } const builtinModules = []; for (const [id, mod] of NativeModule.map) { if (mod.canBeRequiredByUsers) { builtinModules.push(id); } } ObjectFreeze(builtinModules); Module.builtinModules = builtinModules; Module._cache = ObjectCreate(null); Module._pathCache = ObjectCreate(null); Module._extensions = ObjectCreate(null); let modulePaths = []; Module.globalPaths = []; let patched = false; // eslint-disable-next-line func-style let wrap = function(script) { return Module.wrapper[0] + script + Module.wrapper[1]; }; const wrapper = [ '(function (exports, require, module, __filename, __dirname) { ', '\n});' ]; let wrapperProxy = new Proxy(wrapper, { set(target, property, value, receiver) { patched = true; return ReflectSet(target, property, value, receiver); }, defineProperty(target, property, descriptor) { patched = true; return ObjectDefineProperty(target, property, descriptor); } }); ObjectDefineProperty(Module, 'wrap', { get() { return wrap; }, set(value) { patched = true; wrap = value; } }); ObjectDefineProperty(Module, 'wrapper', { get() { return wrapperProxy; }, set(value) { patched = true; wrapperProxy = value; } }); const debug = require('internal/util/debuglog').debuglog('module'); Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077'); // Given a module name, and a list of paths to test, returns the first // matching file in the following precedence. // // require("a.") // -> a. // // require("a") // -> a // -> a. // -> a/index. const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const json = internalModuleReadJSON(path.toNamespacedPath(jsonPath)); if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } if (manifest) { const jsonURL = pathToFileURL(jsonPath); manifest.assertIntegrity(jsonURL, json); } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = checkPath.indexOf(path.sep); let separatorIndex; while ( (separatorIndex = checkPath.lastIndexOf(path.sep)) > rootSeparatorIndex ) { checkPath = checkPath.slice(0, separatorIndex); if (checkPath.endsWith(path.sep + 'node_modules')) return false; const pjson = readPackage(checkPath); if (pjson) return { path: checkPath, data: pjson }; } return false; } function readPackageMain(requestPath) { const pkg = readPackage(requestPath); return pkg ? pkg.main : undefined; } function readPackageExports(requestPath) { const pkg = readPackage(requestPath); return pkg ? pkg.exports : undefined; } function tryPackage(requestPath, exts, isMain, originalPath) { const pkg = readPackageMain(requestPath); if (!pkg) { return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); } const filename = path.resolve(requestPath, pkg); let actual = tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, 'index'), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); if (!actual) { // eslint-disable-next-line no-restricted-syntax const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); err.code = 'MODULE_NOT_FOUND'; err.path = path.resolve(requestPath, 'package.json'); err.requestPath = originalPath; // TODO(BridgeAR): Add the requireStack as well. throw err; } else if (pendingDeprecation) { const jsonPath = path.resolve(requestPath, 'package.json'); process.emitWarning( `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + 'Please either fix that or report it to the module author', 'DeprecationWarning', 'DEP0128' ); } } return actual; } // In order to minimize unnecessary lstat() calls, // this cache is a list of known-real paths. // Set to an empty Map to reset. const realpathCache = new Map(); // Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); if (rc !== 0) return; if (preserveSymlinks && !isMain) { return path.resolve(requestPath); } return toRealPath(requestPath); } function toRealPath(requestPath) { return fs.realpathSync(requestPath, { [internalFS.realpathCacheKey]: realpathCache }); } // Given a path, check if the file exists with any of the set extensions function tryExtensions(p, exts, isMain) { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; } // Find the longest (possibly multi-dot) extension registered in // Module._extensions function findLongestRegisteredExtension(filename) { const name = path.basename(filename); let currentExtension; let index; let startIndex = 0; while ((index = name.indexOf('.', startIndex)) !== -1) { startIndex = index + 1; if (index === 0) continue; // Skip dotfiles like .gitignore currentExtension = name.slice(index); if (Module._extensions[currentExtension]) return currentExtension; } return '.js'; } function trySelf(parentPath, request) { const { data: pkg, path: basePath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; let expansion; if (request === pkg.name) { expansion = ''; } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) { expansion = StringPrototypeSlice(request, pkg.name.length); } else { return false; } const fromExports = applyExports(basePath, expansion); if (fromExports) { return tryFile(fromExports, false); } assert(fromExports !== false); } function isConditionalDotExportSugar(exports, basePath) { if (typeof exports === 'string') return true; if (ArrayIsArray(exports)) return true; if (typeof exports !== 'object') return false; let isConditional = false; let firstCheck = true; for (const key of ObjectKeys(exports)) { const curIsConditional = key[0] !== '.'; if (firstCheck) { firstCheck = false; isConditional = curIsConditional; } else if (isConditional !== curIsConditional) { throw new ERR_INVALID_PACKAGE_CONFIG(basePath, '"exports" cannot ' + 'contain some keys starting with \'.\' and some not. The exports ' + 'object must either be an object of package subpath keys or an ' + 'object of main entry condition name keys only.'); } } return isConditional; } function applyExports(basePath, expansion) { const mappingKey = `.${expansion}`; let pkgExports = readPackageExports(basePath); if (pkgExports === undefined || pkgExports === null) return false; if (isConditionalDotExportSugar(pkgExports, basePath)) pkgExports = { '.': pkgExports }; if (typeof pkgExports === 'object') { if (ObjectPrototypeHasOwnProperty(pkgExports, mappingKey)) { const mapping = pkgExports[mappingKey]; return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, '', mappingKey); } let dirMatch = ''; for (const candidateKey of ObjectKeys(pkgExports)) { if (candidateKey[candidateKey.length - 1] !== '/') continue; if (candidateKey.length > dirMatch.length && StringPrototypeStartsWith(mappingKey, candidateKey)) { dirMatch = candidateKey; } } if (dirMatch !== '') { const mapping = pkgExports[dirMatch]; const subpath = StringPrototypeSlice(mappingKey, dirMatch.length); const resolved = resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, subpath, mappingKey); // Extension searching for folder exports only const rc = stat(resolved); if (rc === 0) return resolved; if (!(RegExpPrototypeTest(trailingSlashRegex, resolved))) { const exts = ObjectKeys(Module._extensions); const filename = tryExtensions(resolved, exts, false); if (filename) return filename; } if (rc === 1) { const exts = ObjectKeys(Module._extensions); const filename = tryPackage(resolved, exts, false, basePath + expansion); if (filename) return filename; } // Undefined means not found return; } } throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey); } // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. const [, name, expansion = ''] = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) { return false; } const basePath = path.resolve(nmPath, name); const fromExports = applyExports(basePath, expansion); if (fromExports) { return tryFile(fromExports, false); } return fromExports; } function isArrayIndex(p) { assert(typeof p === 'string'); const n = Number(p); if (String(n) !== p) return false; if (ObjectIs(n, +0)) return true; if (!Number.isInteger(n)) return false; return n >= 0 && n < (2 ** 32) - 1; } function resolveExportsTarget(baseUrl, target, subpath, mappingKey) { if (typeof target === 'string') { let resolvedTarget, resolvedTargetPath; const pkgPathPath = baseUrl.pathname; if (StringPrototypeStartsWith(target, './')) { resolvedTarget = new URL(target, baseUrl); resolvedTargetPath = resolvedTarget.pathname; if (!StringPrototypeStartsWith(resolvedTargetPath, pkgPathPath) || StringPrototypeIndexOf(resolvedTargetPath, '/node_modules/', pkgPathPath.length - 1) !== -1) resolvedTarget = undefined; } if (subpath.length > 0 && target[target.length - 1] !== '/') resolvedTarget = undefined; if (resolvedTarget === undefined) throw new ERR_INVALID_PACKAGE_TARGET(StringPrototypeSlice(baseUrl.pathname , 0, -1), mappingKey, subpath, target); const resolved = new URL(subpath, resolvedTarget); const resolvedPath = resolved.pathname; if (StringPrototypeStartsWith(resolvedPath, resolvedTargetPath) && StringPrototypeIndexOf(resolvedPath, '/node_modules/', pkgPathPath.length - 1) === -1) { return fileURLToPath(resolved); } throw new ERR_INVALID_MODULE_SPECIFIER(StringPrototypeSlice(baseUrl.pathname , 0, -1), mappingKey); } else if (ArrayIsArray(target)) { if (target.length === 0) throw new ERR_PACKAGE_PATH_NOT_EXPORTED( StringPrototypeSlice(baseUrl.pathname, 0, -1), mappingKey + subpath); let lastException; for (const targetValue of target) { try { return resolveExportsTarget(baseUrl, targetValue, subpath, mappingKey); } catch (e) { lastException = e; if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED' && e.code !== 'ERR_INVALID_PACKAGE_TARGET') throw e; } } // Throw last fallback error assert(lastException !== undefined); throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectKeys(target); if (keys.some(isArrayIndex)) { throw new ERR_INVALID_PACKAGE_CONFIG(baseUrl, '"exports" cannot ' + 'contain numeric property keys.'); } for (const p of keys) { switch (p) { case 'node': case 'require': try { return resolveExportsTarget(baseUrl, target[p], subpath, mappingKey); } catch (e) { if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e; } break; case 'default': try { return resolveExportsTarget(baseUrl, target.default, subpath, mappingKey); } catch (e) { if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e; } } } throw new ERR_PACKAGE_PATH_NOT_EXPORTED( StringPrototypeSlice(baseUrl.pathname, 0, -1), mappingKey + subpath); } else if (target === null) { throw new ERR_PACKAGE_PATH_NOT_EXPORTED( StringPrototypeSlice(baseUrl.pathname, 0, -1), mappingKey + subpath); } throw new ERR_INVALID_PACKAGE_TARGET( StringPrototypeSlice(baseUrl.pathname, 0, -1), mappingKey, subpath, target); } const trailingSlashRegex = /(?:^|\/)\.?\.$/; Module._findPath = function(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = ['']; } else if (!paths || paths.length === 0) { return false; } const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : paths.join('\x00')); const entry = Module._pathCache[cacheKey]; if (entry) return entry; let exts; let trailingSlash = request.length > 0 && request.charCodeAt(request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path for (let i = 0; i < paths.length; i++) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; if (!absoluteRequest) { const exportsResolved = resolveExports(curPath, request); // Undefined means not found, false means no exports if (exportsResolved === undefined) break; if (exportsResolved) { return exportsResolved; } } const basePath = path.resolve(curPath, request); let filename; const rc = stat(basePath); if (!trailingSlash) { if (rc === 0) { // File. if (!isMain) { if (preserveSymlinks) { filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } else if (preserveSymlinksMain) { // For the main module, we use the preserveSymlinksMain flag instead // mainly for backward compatibility, as the preserveSymlinks flag // historically has not applied to the main module. Most likely this // was intended to keep .bin/ binaries working, as following those // symlinks is usually required for the imports in the corresponding // files to resolve; that said, in some use cases following symlinks // causes bigger problems which is why the preserveSymlinksMain option // is needed. filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } if (!filename) { // Try it with each of the extensions if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); } if (filename) { Module._pathCache[cacheKey] = filename; return filename; } } return false; }; // 'node_modules' character codes reversed const nmChars = [ 115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110 ]; const nmLen = nmChars.length; if (isWindows) { // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. // return root node_modules when path is 'D:\\'. // path.resolve will make sure from.length >=3 in Windows. if (from.charCodeAt(from.length - 1) === CHAR_BACKWARD_SLASH && from.charCodeAt(from.length - 2) === CHAR_COLON) return [from + 'node_modules']; const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = from.charCodeAt(i); // The path segment separator check ('\' and '/') was used to get // node_modules path for every path segment. // Use colon as an extra condition since we can get node_modules // path for drive root like 'C:\node_modules' and don't need to // parse drive name. if (code === CHAR_BACKWARD_SLASH || code === CHAR_FORWARD_SLASH || code === CHAR_COLON) { if (p !== nmLen) paths.push(from.slice(0, last) + '\\node_modules'); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } return paths; }; } else { // posix // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // Return early not only to avoid unnecessary work, but to *avoid* returning // an array of two items for a root: [ '//node_modules', '/node_modules' ] if (from === '/') return ['/node_modules']; // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = from.charCodeAt(i); if (code === CHAR_FORWARD_SLASH) { if (p !== nmLen) paths.push(from.slice(0, last) + '/node_modules'); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } // Append /node_modules to handle root paths. paths.push('/node_modules'); return paths; }; } Module._resolveLookupPaths = function(request, parent) { if (NativeModule.canBeRequiredByUsers(request)) { debug('looking for %j in []', request); return null; } // Check for node modules paths. if (request.charAt(0) !== '.' || (request.length > 1 && request.charAt(1) !== '.' && request.charAt(1) !== '/' && (!isWindows || request.charAt(1) !== '\\'))) { let paths = modulePaths; if (parent != null && parent.paths && parent.paths.length) { paths = parent.paths.concat(paths); } debug('looking for %j in %j', request, paths); return paths.length > 0 ? paths : null; } // In REPL, parent.filename is null. if (!parent || !parent.id || !parent.filename) { // Make require('./path/to/foo') work - normally the path is taken // from realpath(__filename) but in REPL there is no filename const mainPaths = ['.']; debug('looking for %j in %j', request, mainPaths); return mainPaths; } debug('RELATIVE: requested: %s from parent.id %s', request, parent.id); const parentDir = [path.dirname(parent.filename)]; debug('looking for %j', parentDir); return parentDir; }; function emitCircularRequireWarning(prop) { process.emitWarning( `Accessing non-existent property '${String(prop)}' of module exports ` + 'inside circular dependency' ); } // A Proxy that can be used as the prototype of a module.exports object and // warns when non-existent properties are accessed. const CircularRequirePrototypeWarningProxy = new Proxy({}, { get(target, prop) { // Allow __esModule access in any case because it is used in the output // of transpiled code to determine whether something comes from an // ES module, and is not used as a regular key of `module.exports`. if (prop in target || prop === '__esModule') return target[prop]; emitCircularRequireWarning(prop); return undefined; }, getOwnPropertyDescriptor(target, prop) { if (ObjectPrototypeHasOwnProperty(target, prop) || prop === '__esModule') return ObjectGetOwnPropertyDescriptor(target, prop); emitCircularRequireWarning(prop); return undefined; } }); // Object.prototype and ObjectPrototype refer to our 'primordials' versions // and are not identical to the versions on the global object. const PublicObjectPrototype = global.Object.prototype; function getExportsForCircularRequire(module) { if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === PublicObjectPrototype && // Exclude transpiled ES6 modules / TypeScript code because those may // employ unusual patterns for accessing 'module.exports'. That should // be okay because ES6 modules have a different approach to circular // dependencies anyway. !module.exports.__esModule) { // This is later unset once the module is done loading. ObjectSetPrototypeOf( module.exports, CircularRequirePrototypeWarningProxy); } return module.exports; } // Check the cache for the requested file. // 1. If a module already exists in the cache: return its exports object. // 2. If the module is native: call // `NativeModule.prototype.compileForPublicLoader()` and return the exports. // 3. Otherwise, create a new module for the file and save it to the cache. // Then have it load the file contents before returning its exports // object. Module._load = function(request, parent, isMain) { let relResolveCacheIdentifier; if (parent) { debug('Module._load REQUEST %s parent: %s', request, parent.id); // Fast path for (lazy loaded) modules in the same directory. The indirect // caching is required to allow cache invalidation without changing the old // cache key names. relResolveCacheIdentifier = `${parent.path}\x00${request}`; const filename = relativeResolveCache[relResolveCacheIdentifier]; if (filename !== undefined) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) return getExportsForCircularRequire(cachedModule); return cachedModule.exports; } delete relativeResolveCache[relResolveCacheIdentifier]; } } const filename = Module._resolveFilename(request, parent, isMain); const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) return getExportsForCircularRequire(cachedModule); return cachedModule.exports; } const mod = loadNativeModule(filename, request); if (mod && mod.canBeRequiredByUsers) return mod.exports; // Don't call updateChildren(), Module constructor already does. const module = new Module(filename, parent); if (isMain) { process.mainModule = module; module.id = '.'; } Module._cache[filename] = module; if (parent !== undefined) { relativeResolveCache[relResolveCacheIdentifier] = filename; } let threw = true; try { // Intercept exceptions that occur during the first tick and rekey them // on error instance rather than module instance (which will immediately be // garbage collected). if (enableSourceMaps) { try { module.load(filename); } catch (err) { rekeySourceMap(Module._cache[filename], err); throw err; /* node-do-not-add-exception-line */ } } else { module.load(filename); } threw = false; } finally { if (threw) { delete Module._cache[filename]; if (parent !== undefined) { delete relativeResolveCache[relResolveCacheIdentifier]; const children = parent && parent.children; if (ArrayIsArray(children)) { const index = children.indexOf(module); if (index !== -1) { children.splice(index, 1); } } } } else if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === CircularRequirePrototypeWarningProxy) { ObjectSetPrototypeOf(module.exports, PublicObjectPrototype); } } return module.exports; }; Module._resolveFilename = function(request, parent, isMain, options) { if (NativeModule.canBeRequiredByUsers(request)) { return request; } let paths; if (typeof options === 'object' && options !== null) { if (ArrayIsArray(options.paths)) { const isRelative = request.startsWith('./') || request.startsWith('../') || ((isWindows && request.startsWith('.\\')) || request.startsWith('..\\')); if (isRelative) { paths = options.paths; } else { const fakeParent = new Module('', null); paths = []; for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent); for (let j = 0; j < lookupPaths.length; j++) { if (!paths.includes(lookupPaths[j])) paths.push(lookupPaths[j]); } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent); } else { throw new ERR_INVALID_OPT_VALUE('options.paths', options.paths); } } else { paths = Module._resolveLookupPaths(request, parent); } if (parent && parent.filename) { const filename = trySelf(parent.filename, request); if (filename) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : paths.join('\x00')); Module._pathCache[cacheKey] = filename; return filename; } } // Look up the filename first, since that's the cache key. const filename = Module._findPath(request, paths, isMain, false); if (filename) return filename; const requireStack = []; for (let cursor = parent; cursor; cursor = cursor.parent) { requireStack.push(cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + '\nRequire stack:\n- ' + requireStack.join('\n- '); } // eslint-disable-next-line no-restricted-syntax const err = new Error(message); err.code = 'MODULE_NOT_FOUND'; err.requireStack = requireStack; throw err; }; // Given a file name, pass it to the proper extension handler. Module.prototype.load = function(filename) { debug('load %j for module %j', filename, this.id); assert(!this.loaded); this.filename = filename; this.paths = Module._nodeModulePaths(path.dirname(filename)); const extension = findLongestRegisteredExtension(filename); // allow .mjs to be overridden if (filename.endsWith('.mjs') && !Module._extensions['.mjs']) { throw new ERR_REQUIRE_ESM(filename); } Module._extensions[extension](this, filename); this.loaded = true; const ESMLoader = asyncESM.ESMLoader; const url = `${pathToFileURL(filename)}`; const module = ESMLoader.moduleMap.get(url); // Create module entry at load time to snapshot exports correctly const exports = this.exports; // Called from cjs translator if (module !== undefined && module.module !== undefined) { if (module.module.getStatus() >= kInstantiated) module.module.setExport('default', exports); } else { // Preemptively cache // We use a function to defer promise creation for async hooks. ESMLoader.moduleMap.set( url, // Module job creation will start promises. // We make it a function to lazily trigger those promises // for async hooks compatibility. () => new ModuleJob(ESMLoader, url, () => new ModuleWrap(url, undefined, ['default'], function() { this.setExport('default', exports); }) , false /* isMain */, false /* inspectBrk */) ); } }; // Loads a module at the given file path. Returns that module's // `exports` property. Module.prototype.require = function(id) { validateString(id, 'id'); if (id === '') { throw new ERR_INVALID_ARG_VALUE('id', id, 'must be a non-empty string'); } requireDepth++; try { return Module._load(id, this, /* isMain */ false); } finally { requireDepth--; } }; // Resolved path to process.argv[1] will be lazily placed here // (needed for setting breakpoint when called with --inspect-brk) let resolvedArgv; let hasPausedEntry = false; function wrapSafe(filename, content, cjsModuleInstance) { if (patched) { const wrapper = Module.wrap(content); return vm.runInThisContext(wrapper, { filename, lineOffset: 0, displayErrors: true, importModuleDynamically: async (specifier) => { const loader = asyncESM.ESMLoader; return loader.import(specifier, normalizeReferrerURL(filename)); }, }); } let compiled; try { compiled = compileFunction( content, filename, 0, 0, undefined, false, undefined, [], [ 'exports', 'require', 'module', '__filename', '__dirname', ] ); } catch (err) { if (process.mainModule === cjsModuleInstance) enrichCJSError(err); throw err; } const { callbackMap } = internalBinding('module_wrap'); callbackMap.set(compiled.cacheKey, { importModuleDynamically: async (specifier) => { const loader = asyncESM.ESMLoader; return loader.import(specifier, normalizeReferrerURL(filename)); } }); return compiled.function; } // Run the file contents in the correct scope or sandbox. Expose // the correct helper variables (require, module, exports) to // the file. // Returns exception, if any. Module.prototype._compile = function(content, filename) { let moduleURL; let redirects; if (manifest) { moduleURL = pathToFileURL(filename); redirects = manifest.getRedirector(moduleURL); manifest.assertIntegrity(moduleURL, content); } maybeCacheSourceMap(filename, content, this); const compiledWrapper = wrapSafe(filename, content, this); let inspectorWrapper = null; if (getOptionValue('--inspect-brk') && process._eval == null) { if (!resolvedArgv) { // We enter the repl if we're not given a filename argument. if (process.argv[1]) { try { resolvedArgv = Module._resolveFilename(process.argv[1], null, false); } catch { // We only expect this codepath to be reached in the case of a // preloaded module (it will fail earlier with the main entry) assert(ArrayIsArray(getOptionValue('--require'))); } } else { resolvedArgv = 'repl'; } } // Set breakpoint on module start if (resolvedArgv && !hasPausedEntry && filename === resolvedArgv) { hasPausedEntry = true; inspectorWrapper = internalBinding('inspector').callAndPauseOnStart; } } const dirname = path.dirname(filename); const require = makeRequireFunction(this, redirects); let result; const exports = this.exports; const thisValue = exports; const module = this; if (requireDepth === 0) statCache = new Map(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, require, module, filename, dirname); } else { result = compiledWrapper.call(thisValue, exports, require, module, filename, dirname); } hasLoadedAnyUserCJSModule = true; if (requireDepth === 0) statCache = null; return result; }; // Native extension for .js Module._extensions['.js'] = function(module, filename) { if (filename.endsWith('.js')) { const pkg = readPackageScope(filename); // Function require shouldn't be used in ES modules. if (pkg && pkg.data && pkg.data.type === 'module') { const parentPath = module.parent && module.parent.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); } } const content = fs.readFileSync(filename, 'utf8'); module._compile(content, filename); }; // Native extension for .json Module._extensions['.json'] = function(module, filename) { const content = fs.readFileSync(filename, 'utf8'); if (manifest) { const moduleURL = pathToFileURL(filename); manifest.assertIntegrity(moduleURL, content); } try { module.exports = JSONParse(stripBOM(content)); } catch (err) { err.message = filename + ': ' + err.message; throw err; } }; // Native extension for .node Module._extensions['.node'] = function(module, filename) { if (manifest) { const content = fs.readFileSync(filename); const moduleURL = pathToFileURL(filename); manifest.assertIntegrity(moduleURL, content); } // Be aware this doesn't use `content` return process.dlopen(module, path.toNamespacedPath(filename)); }; function createRequireFromPath(filename) { // Allow a directory to be passed as the filename const trailingSlash = filename.endsWith('/') || (isWindows && filename.endsWith('\\')); const proxyPath = trailingSlash ? path.join(filename, 'noop.js') : filename; const m = new Module(proxyPath); m.filename = proxyPath; m.paths = Module._nodeModulePaths(m.path); return makeRequireFunction(m, null); } Module.createRequireFromPath = deprecate( createRequireFromPath, 'Module.createRequireFromPath() is deprecated. ' + 'Use Module.createRequire() instead.', 'DEP0130' ); const createRequireError = 'must be a file URL object, file URL string, or ' + 'absolute path string'; function createRequire(filename) { let filepath; if (filename instanceof URL || (typeof filename === 'string' && !path.isAbsolute(filename))) { try { filepath = fileURLToPath(filename); } catch { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } } else if (typeof filename !== 'string') { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } else { filepath = filename; } return createRequireFromPath(filepath); } Module.createRequire = createRequire; Module._initPaths = function() { const homeDir = isWindows ? process.env.USERPROFILE : safeGetenv('HOME'); const nodePath = isWindows ? process.env.NODE_PATH : safeGetenv('NODE_PATH'); // process.execPath is $PREFIX/bin/node except on Windows where it is // $PREFIX\node.exe where $PREFIX is the root of the Node.js installation. const prefixDir = isWindows ? path.resolve(process.execPath, '..') : path.resolve(process.execPath, '..', '..'); let paths = [path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { paths.unshift(path.resolve(homeDir, '.node_libraries')); paths.unshift(path.resolve(homeDir, '.node_modules')); } if (nodePath) { paths = nodePath.split(path.delimiter).filter(function pathsFilterCB(path) { return !!path; }).concat(paths); } modulePaths = paths; // Clone as a shallow copy, for introspection. Module.globalPaths = modulePaths.slice(0); }; Module._preloadModules = function(requests) { if (!ArrayIsArray(requests)) return; // Preloaded modules have a dummy parent module which is deemed to exist // in the current working directory. This seeds the search path for // preloaded modules. const parent = new Module('internal/preload', null); try { parent.paths = Module._nodeModulePaths(process.cwd()); } catch (e) { if (e.code !== 'ENOENT') { throw e; } } for (let n = 0; n < requests.length; n++) parent.require(requests[n]); }; Module.syncBuiltinESMExports = function syncBuiltinESMExports() { for (const mod of NativeModule.map.values()) { if (mod.canBeRequiredByUsers) { mod.syncExports(); } } }; // Backwards compatibility Module.Module = Module; // We have to load the esm things after module.exports! asyncESM = require('internal/process/esm_loader'); ModuleJob = require('internal/modules/esm/module_job'); ({ ModuleWrap, kInstantiated } = internalBinding('module_wrap')); ts-node-10.9.2/raw/node-internal-modules-cjs-loader-v15.3.0-stripped.js000066400000000000000000000052161453460306300253010ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/cjs/loader.js 'use strict'; const { JSONParse, SafeMap, StringPrototypeEndsWith, StringPrototypeLastIndexOf, StringPrototypeIndexOf, StringPrototypeSlice, } = primordials; const path = require('path'); const packageJsonReader = require('internal/modules/package_json_reader'); const { ERR_REQUIRE_ESM } = require('internal/errors').codes; const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const result = packageJsonReader.read(jsonPath); const json = result.containsKeys === false ? '{}' : result.string; if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, imports: parsed.imports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep); let separatorIndex; do { separatorIndex = StringPrototypeLastIndexOf(checkPath, sep); checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex); if (StringPrototypeEndsWith(checkPath, sep + 'node_modules')) return false; const pjson = readPackage(checkPath + sep); if (pjson) return { data: pjson, path: checkPath, }; } while (separatorIndex > rootSeparatorIndex); return false; } // Native extension for .js Module._extensions['.js'] = function(module, filename) { if (StringPrototypeEndsWith(filename, '.js')) { const pkg = readPackageScope(filename); // Function require shouldn't be used in ES modules. if (pkg && pkg.data && pkg.data.type === 'module') { const parent = moduleParentCache.get(module); const parentPath = parent && parent.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); } } // If already analyzed the source, then it will be cached. const cached = cjsParseCache.get(module); let content; if (cached && cached.source) { content = cached.source; cached.source = undefined; } else { content = fs.readFileSync(filename, 'utf8'); } module._compile(content, filename); }; ts-node-10.9.2/raw/node-internal-modules-cjs-loader-v15.3.0.js000066400000000000000000001150541453460306300234530ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/cjs/loader.js // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; const { ArrayIsArray, ArrayPrototypeConcat, ArrayPrototypeFilter, ArrayPrototypeIncludes, ArrayPrototypeIndexOf, ArrayPrototypeJoin, ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, Boolean, Error, JSONParse, ObjectCreate, ObjectDefineProperty, ObjectFreeze, ObjectGetOwnPropertyDescriptor, ObjectGetPrototypeOf, ObjectKeys, ObjectPrototype, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, ReflectApply, ReflectSet, RegExpPrototypeTest, SafeMap, SafeWeakMap, String, StringPrototypeCharAt, StringPrototypeCharCodeAt, StringPrototypeEndsWith, StringPrototypeLastIndexOf, StringPrototypeIndexOf, StringPrototypeMatch, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, } = primordials; // Map used to store CJS parsing data. const cjsParseCache = new SafeWeakMap(); // Set first due to cycle with ESM loader functions. module.exports = { wrapSafe, Module, toRealPath, readPackageScope, cjsParseCache, get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; } }; const { NativeModule } = require('internal/bootstrap/loaders'); const { getSourceMapsEnabled, maybeCacheSourceMap, rekeySourceMap } = require('internal/source_map/source_map_cache'); const { pathToFileURL, fileURLToPath, isURLInstance } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); const assert = require('internal/assert'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; const { internalModuleStat } = internalBinding('fs'); const packageJsonReader = require('internal/modules/package_json_reader'); const { safeGetenv } = internalBinding('credentials'); const { makeRequireFunction, normalizeReferrerURL, stripBOM, cjsConditions, loadNativeModule } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? require('internal/process/policy') : null; const { compileFunction } = internalBinding('contextify'); // Whether any user-provided CJS modules had been loaded (executed). // Used for internal assertions. let hasLoadedAnyUserCJSModule = false; const { ERR_INVALID_ARG_VALUE, ERR_INVALID_MODULE_SPECIFIER, ERR_REQUIRE_ESM } = require('internal/errors').codes; const { validateString } = require('internal/validators'); const pendingDeprecation = getOptionValue('--pending-deprecation'); const { CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_COLON } = require('internal/constants'); const { isProxy } = require('internal/util/types'); const asyncESM = require('internal/process/esm_loader'); const { enrichCJSError } = require('internal/modules/esm/translators'); const { kEvaluated } = internalBinding('module_wrap'); const { encodedSepRegEx, packageExportsResolve, packageImportsResolve } = require('internal/modules/esm/resolve'); const isWindows = process.platform === 'win32'; const relativeResolveCache = ObjectCreate(null); let requireDepth = 0; let statCache = null; function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } const result = internalModuleStat(filename); if (statCache !== null) statCache.set(filename, result); return result; } function updateChildren(parent, child, scan) { const children = parent && parent.children; if (children && !(scan && ArrayPrototypeIncludes(children, child))) ArrayPrototypePush(children, child); } const moduleParentCache = new SafeWeakMap(); function Module(id = '', parent) { this.id = id; this.path = path.dirname(id); this.exports = {}; moduleParentCache.set(this, parent); updateChildren(parent, this, false); this.filename = null; this.loaded = false; this.children = []; } const builtinModules = []; for (const [id, mod] of NativeModule.map) { if (mod.canBeRequiredByUsers) { ArrayPrototypePush(builtinModules, id); } } ObjectFreeze(builtinModules); Module.builtinModules = builtinModules; Module._cache = ObjectCreate(null); Module._pathCache = ObjectCreate(null); Module._extensions = ObjectCreate(null); let modulePaths = []; Module.globalPaths = []; let patched = false; // eslint-disable-next-line func-style let wrap = function(script) { return Module.wrapper[0] + script + Module.wrapper[1]; }; const wrapper = [ '(function (exports, require, module, __filename, __dirname) { ', '\n});' ]; let wrapperProxy = new Proxy(wrapper, { set(target, property, value, receiver) { patched = true; return ReflectSet(target, property, value, receiver); }, defineProperty(target, property, descriptor) { patched = true; return ObjectDefineProperty(target, property, descriptor); } }); ObjectDefineProperty(Module, 'wrap', { get() { return wrap; }, set(value) { patched = true; wrap = value; } }); ObjectDefineProperty(Module, 'wrapper', { get() { return wrapperProxy; }, set(value) { patched = true; wrapperProxy = value; } }); function getModuleParent() { return moduleParentCache.get(this); } function setModuleParent(value) { moduleParentCache.set(this, value); } ObjectDefineProperty(Module.prototype, 'parent', { get: pendingDeprecation ? deprecate( getModuleParent, 'module.parent is deprecated due to accuracy issues. Please use ' + 'require.main to find program entry point instead.', 'DEP0144' ) : getModuleParent, set: pendingDeprecation ? deprecate( setModuleParent, 'module.parent is deprecated due to accuracy issues. Please use ' + 'require.main to find program entry point instead.', 'DEP0144' ) : setModuleParent, }); let debug = require('internal/util/debuglog').debuglog('module', (fn) => { debug = fn; }); Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077'); // Given a module name, and a list of paths to test, returns the first // matching file in the following precedence. // // require("a.") // -> a. // // require("a") // -> a // -> a. // -> a/index. const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const result = packageJsonReader.read(jsonPath); const json = result.containsKeys === false ? '{}' : result.string; if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, imports: parsed.imports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep); let separatorIndex; do { separatorIndex = StringPrototypeLastIndexOf(checkPath, sep); checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex); if (StringPrototypeEndsWith(checkPath, sep + 'node_modules')) return false; const pjson = readPackage(checkPath + sep); if (pjson) return { data: pjson, path: checkPath, }; } while (separatorIndex > rootSeparatorIndex); return false; } function tryPackage(requestPath, exts, isMain, originalPath) { const pkg = readPackage(requestPath)?.main; if (!pkg) { return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); } const filename = path.resolve(requestPath, pkg); let actual = tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, 'index'), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); if (!actual) { // eslint-disable-next-line no-restricted-syntax const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); err.code = 'MODULE_NOT_FOUND'; err.path = path.resolve(requestPath, 'package.json'); err.requestPath = originalPath; // TODO(BridgeAR): Add the requireStack as well. throw err; } else if (pendingDeprecation) { const jsonPath = path.resolve(requestPath, 'package.json'); process.emitWarning( `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + 'Please either fix that or report it to the module author', 'DeprecationWarning', 'DEP0128' ); } } return actual; } // In order to minimize unnecessary lstat() calls, // this cache is a list of known-real paths. // Set to an empty Map to reset. const realpathCache = new SafeMap(); // Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); if (rc !== 0) return; if (preserveSymlinks && !isMain) { return path.resolve(requestPath); } return toRealPath(requestPath); } function toRealPath(requestPath) { return fs.realpathSync(requestPath, { [internalFS.realpathCacheKey]: realpathCache }); } // Given a path, check if the file exists with any of the set extensions function tryExtensions(p, exts, isMain) { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; } // Find the longest (possibly multi-dot) extension registered in // Module._extensions function findLongestRegisteredExtension(filename) { const name = path.basename(filename); let currentExtension; let index; let startIndex = 0; while ((index = StringPrototypeIndexOf(name, '.', startIndex)) !== -1) { startIndex = index + 1; if (index === 0) continue; // Skip dotfiles like .gitignore currentExtension = StringPrototypeSlice(name, index); if (Module._extensions[currentExtension]) return currentExtension; } return '.js'; } function trySelfParentPath(parent) { if (!parent) return false; if (parent.filename) { return parent.filename; } else if (parent.id === '' || parent.id === 'internal/preload') { try { return process.cwd() + path.sep; } catch { return false; } } } function trySelf(parentPath, request) { if (!parentPath) return false; const { data: pkg, path: pkgPath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; let expansion; if (request === pkg.name) { expansion = '.'; } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) { expansion = '.' + StringPrototypeSlice(request, pkg.name.length); } else { return false; } try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), expansion, pkg, pathToFileURL(parentPath), cjsConditions), request, parentPath, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. const [, name, expansion = ''] = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) return; const pkgPath = path.resolve(nmPath, name); const pkg = readPackage(pkgPath); if (pkg && pkg.exports !== null && pkg.exports !== undefined) { try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), '.' + expansion, pkg, null, cjsConditions), request, null, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } } const trailingSlashRegex = /(?:^|\/)\.?\.$/; Module._findPath = function(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = ['']; } else if (!paths || paths.length === 0) { return false; } const cacheKey = request + '\x00' + ArrayPrototypeJoin(paths, '\x00'); const entry = Module._pathCache[cacheKey]; if (entry) return entry; let exts; let trailingSlash = request.length > 0 && StringPrototypeCharCodeAt(request, request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path for (let i = 0; i < paths.length; i++) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; if (!absoluteRequest) { const exportsResolved = resolveExports(curPath, request); if (exportsResolved) return exportsResolved; } const basePath = path.resolve(curPath, request); let filename; const rc = stat(basePath); if (!trailingSlash) { if (rc === 0) { // File. if (!isMain) { if (preserveSymlinks) { filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } else if (preserveSymlinksMain) { // For the main module, we use the preserveSymlinksMain flag instead // mainly for backward compatibility, as the preserveSymlinks flag // historically has not applied to the main module. Most likely this // was intended to keep .bin/ binaries working, as following those // symlinks is usually required for the imports in the corresponding // files to resolve; that said, in some use cases following symlinks // causes bigger problems which is why the preserveSymlinksMain option // is needed. filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } if (!filename) { // Try it with each of the extensions if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); } if (filename) { Module._pathCache[cacheKey] = filename; return filename; } } return false; }; // 'node_modules' character codes reversed const nmChars = [ 115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110 ]; const nmLen = nmChars.length; if (isWindows) { // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. // return root node_modules when path is 'D:\\'. // path.resolve will make sure from.length >=3 in Windows. if (StringPrototypeCharCodeAt(from, from.length - 1) === CHAR_BACKWARD_SLASH && StringPrototypeCharCodeAt(from, from.length - 2) === CHAR_COLON) return [from + 'node_modules']; const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = StringPrototypeCharCodeAt(from, i); // The path segment separator check ('\' and '/') was used to get // node_modules path for every path segment. // Use colon as an extra condition since we can get node_modules // path for drive root like 'C:\node_modules' and don't need to // parse drive name. if (code === CHAR_BACKWARD_SLASH || code === CHAR_FORWARD_SLASH || code === CHAR_COLON) { if (p !== nmLen) ArrayPrototypePush( paths, StringPrototypeSlice(from, 0, last) + '\\node_modules' ); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } return paths; }; } else { // posix // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // Return early not only to avoid unnecessary work, but to *avoid* returning // an array of two items for a root: [ '//node_modules', '/node_modules' ] if (from === '/') return ['/node_modules']; // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = StringPrototypeCharCodeAt(from, i); if (code === CHAR_FORWARD_SLASH) { if (p !== nmLen) ArrayPrototypePush( paths, StringPrototypeSlice(from, 0, last) + '/node_modules' ); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } // Append /node_modules to handle root paths. ArrayPrototypePush(paths, '/node_modules'); return paths; }; } Module._resolveLookupPaths = function(request, parent) { if (NativeModule.canBeRequiredByUsers(request)) { debug('looking for %j in []', request); return null; } // Check for node modules paths. if (StringPrototypeCharAt(request, 0) !== '.' || (request.length > 1 && StringPrototypeCharAt(request, 1) !== '.' && StringPrototypeCharAt(request, 1) !== '/' && (!isWindows || StringPrototypeCharAt(request, 1) !== '\\'))) { let paths = modulePaths; if (parent != null && parent.paths && parent.paths.length) { paths = ArrayPrototypeConcat(parent.paths, paths); } debug('looking for %j in %j', request, paths); return paths.length > 0 ? paths : null; } // In REPL, parent.filename is null. if (!parent || !parent.id || !parent.filename) { // Make require('./path/to/foo') work - normally the path is taken // from realpath(__filename) but in REPL there is no filename const mainPaths = ['.']; debug('looking for %j in %j', request, mainPaths); return mainPaths; } debug('RELATIVE: requested: %s from parent.id %s', request, parent.id); const parentDir = [path.dirname(parent.filename)]; debug('looking for %j', parentDir); return parentDir; }; function emitCircularRequireWarning(prop) { process.emitWarning( `Accessing non-existent property '${String(prop)}' of module exports ` + 'inside circular dependency' ); } // A Proxy that can be used as the prototype of a module.exports object and // warns when non-existent properties are accessed. const CircularRequirePrototypeWarningProxy = new Proxy({}, { get(target, prop) { // Allow __esModule access in any case because it is used in the output // of transpiled code to determine whether something comes from an // ES module, and is not used as a regular key of `module.exports`. if (prop in target || prop === '__esModule') return target[prop]; emitCircularRequireWarning(prop); return undefined; }, getOwnPropertyDescriptor(target, prop) { if (ObjectPrototypeHasOwnProperty(target, prop) || prop === '__esModule') return ObjectGetOwnPropertyDescriptor(target, prop); emitCircularRequireWarning(prop); return undefined; } }); function getExportsForCircularRequire(module) { if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === ObjectPrototype && // Exclude transpiled ES6 modules / TypeScript code because those may // employ unusual patterns for accessing 'module.exports'. That should // be okay because ES6 modules have a different approach to circular // dependencies anyway. !module.exports.__esModule) { // This is later unset once the module is done loading. ObjectSetPrototypeOf( module.exports, CircularRequirePrototypeWarningProxy); } return module.exports; } // Check the cache for the requested file. // 1. If a module already exists in the cache: return its exports object. // 2. If the module is native: call // `NativeModule.prototype.compileForPublicLoader()` and return the exports. // 3. Otherwise, create a new module for the file and save it to the cache. // Then have it load the file contents before returning its exports // object. Module._load = function(request, parent, isMain) { let relResolveCacheIdentifier; if (parent) { debug('Module._load REQUEST %s parent: %s', request, parent.id); // Fast path for (lazy loaded) modules in the same directory. The indirect // caching is required to allow cache invalidation without changing the old // cache key names. relResolveCacheIdentifier = `${parent.path}\x00${request}`; const filename = relativeResolveCache[relResolveCacheIdentifier]; if (filename !== undefined) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) return getExportsForCircularRequire(cachedModule); return cachedModule.exports; } delete relativeResolveCache[relResolveCacheIdentifier]; } } const filename = Module._resolveFilename(request, parent, isMain); const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) { const parseCachedModule = cjsParseCache.get(cachedModule); if (!parseCachedModule || parseCachedModule.loaded) return getExportsForCircularRequire(cachedModule); parseCachedModule.loaded = true; } else { return cachedModule.exports; } } const mod = loadNativeModule(filename, request); if (mod && mod.canBeRequiredByUsers) return mod.exports; // Don't call updateChildren(), Module constructor already does. const module = cachedModule || new Module(filename, parent); if (isMain) { process.mainModule = module; module.id = '.'; } Module._cache[filename] = module; if (parent !== undefined) { relativeResolveCache[relResolveCacheIdentifier] = filename; } let threw = true; try { // Intercept exceptions that occur during the first tick and rekey them // on error instance rather than module instance (which will immediately be // garbage collected). if (getSourceMapsEnabled()) { try { module.load(filename); } catch (err) { rekeySourceMap(Module._cache[filename], err); throw err; /* node-do-not-add-exception-line */ } } else { module.load(filename); } threw = false; } finally { if (threw) { delete Module._cache[filename]; if (parent !== undefined) { delete relativeResolveCache[relResolveCacheIdentifier]; const children = parent && parent.children; if (ArrayIsArray(children)) { const index = ArrayPrototypeIndexOf(children, module); if (index !== -1) { ArrayPrototypeSplice(children, index, 1); } } } } else if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === CircularRequirePrototypeWarningProxy) { ObjectSetPrototypeOf(module.exports, ObjectPrototype); } } return module.exports; }; Module._resolveFilename = function(request, parent, isMain, options) { if (NativeModule.canBeRequiredByUsers(request)) { return request; } let paths; if (typeof options === 'object' && options !== null) { if (ArrayIsArray(options.paths)) { const isRelative = StringPrototypeStartsWith(request, './') || StringPrototypeStartsWith(request, '../') || ((isWindows && StringPrototypeStartsWith(request, '.\\')) || StringPrototypeStartsWith(request, '..\\')); if (isRelative) { paths = options.paths; } else { const fakeParent = new Module('', null); paths = []; for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent); for (let j = 0; j < lookupPaths.length; j++) { if (!ArrayPrototypeIncludes(paths, lookupPaths[j])) ArrayPrototypePush(paths, lookupPaths[j]); } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent); } else { throw new ERR_INVALID_ARG_VALUE('options.paths', options.paths); } } else { paths = Module._resolveLookupPaths(request, parent); } if (parent && parent.filename) { if (request[0] === '#') { const pkg = readPackageScope(parent.filename) || {}; if (pkg.data && pkg.data.imports !== null && pkg.data.imports !== undefined) { try { return finalizeEsmResolution( packageImportsResolve(request, pathToFileURL(parent.filename), cjsConditions), request, parent.filename, pkg.path); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request); throw e; } } } } // Try module self resoultion first const parentPath = trySelfParentPath(parent); const selfResolved = trySelf(parentPath, request); if (selfResolved) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : ArrayPrototypeJoin(paths, '\x00')); Module._pathCache[cacheKey] = selfResolved; return selfResolved; } // Look up the filename first, since that's the cache key. const filename = Module._findPath(request, paths, isMain, false); if (filename) return filename; const requireStack = []; for (let cursor = parent; cursor; cursor = moduleParentCache.get(cursor)) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + '\nRequire stack:\n- ' + ArrayPrototypeJoin(requireStack, '\n- '); } // eslint-disable-next-line no-restricted-syntax const err = new Error(message); err.code = 'MODULE_NOT_FOUND'; err.requireStack = requireStack; throw err; }; function finalizeEsmResolution(match, request, parentPath, pkgPath) { const { resolved, exact } = match; if (RegExpPrototypeTest(encodedSepRegEx, resolved)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved, 'must not include encoded "/" or "\\" characters', parentPath); const filename = fileURLToPath(resolved); let actual = tryFile(filename); if (!exact && !actual) { const exts = ObjectKeys(Module._extensions); actual = tryExtensions(filename, exts, false) || tryPackage(filename, exts, false, request); } if (actual) return actual; const err = createEsmNotFoundErr(filename, path.resolve(pkgPath, 'package.json')); throw err; } function createEsmNotFoundErr(request, path) { // eslint-disable-next-line no-restricted-syntax const err = new Error(`Cannot find module '${request}'`); err.code = 'MODULE_NOT_FOUND'; if (path) err.path = path; // TODO(BridgeAR): Add the requireStack as well. return err; } // Given a file name, pass it to the proper extension handler. Module.prototype.load = function(filename) { debug('load %j for module %j', filename, this.id); assert(!this.loaded); this.filename = filename; this.paths = Module._nodeModulePaths(path.dirname(filename)); const extension = findLongestRegisteredExtension(filename); // allow .mjs to be overridden if (StringPrototypeEndsWith(filename, '.mjs') && !Module._extensions['.mjs']) throw new ERR_REQUIRE_ESM(filename); Module._extensions[extension](this, filename); this.loaded = true; const ESMLoader = asyncESM.ESMLoader; // Create module entry at load time to snapshot exports correctly const exports = this.exports; // Preemptively cache if ((module?.module === undefined || module.module.getStatus() < kEvaluated) && !ESMLoader.cjsCache.has(this)) ESMLoader.cjsCache.set(this, exports); }; // Loads a module at the given file path. Returns that module's // `exports` property. Module.prototype.require = function(id) { validateString(id, 'id'); if (id === '') { throw new ERR_INVALID_ARG_VALUE('id', id, 'must be a non-empty string'); } requireDepth++; try { return Module._load(id, this, /* isMain */ false); } finally { requireDepth--; } }; // Resolved path to process.argv[1] will be lazily placed here // (needed for setting breakpoint when called with --inspect-brk) let resolvedArgv; let hasPausedEntry = false; function wrapSafe(filename, content, cjsModuleInstance) { if (patched) { const wrapper = Module.wrap(content); return vm.runInThisContext(wrapper, { filename, lineOffset: 0, displayErrors: true, importModuleDynamically: async (specifier) => { const loader = asyncESM.ESMLoader; return loader.import(specifier, normalizeReferrerURL(filename)); }, }); } let compiled; try { compiled = compileFunction( content, filename, 0, 0, undefined, false, undefined, [], [ 'exports', 'require', 'module', '__filename', '__dirname', ] ); } catch (err) { if (process.mainModule === cjsModuleInstance) enrichCJSError(err); throw err; } const { callbackMap } = internalBinding('module_wrap'); callbackMap.set(compiled.cacheKey, { importModuleDynamically: async (specifier) => { const loader = asyncESM.ESMLoader; return loader.import(specifier, normalizeReferrerURL(filename)); } }); return compiled.function; } // Run the file contents in the correct scope or sandbox. Expose // the correct helper variables (require, module, exports) to // the file. // Returns exception, if any. Module.prototype._compile = function(content, filename) { let moduleURL; let redirects; if (policy?.manifest) { moduleURL = pathToFileURL(filename); redirects = policy.manifest.getDependencyMapper(moduleURL); policy.manifest.assertIntegrity(moduleURL, content); } maybeCacheSourceMap(filename, content, this); const compiledWrapper = wrapSafe(filename, content, this); let inspectorWrapper = null; if (getOptionValue('--inspect-brk') && process._eval == null) { if (!resolvedArgv) { // We enter the repl if we're not given a filename argument. if (process.argv[1]) { try { resolvedArgv = Module._resolveFilename(process.argv[1], null, false); } catch { // We only expect this codepath to be reached in the case of a // preloaded module (it will fail earlier with the main entry) assert(ArrayIsArray(getOptionValue('--require'))); } } else { resolvedArgv = 'repl'; } } // Set breakpoint on module start if (resolvedArgv && !hasPausedEntry && filename === resolvedArgv) { hasPausedEntry = true; inspectorWrapper = internalBinding('inspector').callAndPauseOnStart; } } const dirname = path.dirname(filename); const require = makeRequireFunction(this, redirects); let result; const exports = this.exports; const thisValue = exports; const module = this; if (requireDepth === 0) statCache = new SafeMap(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, require, module, filename, dirname); } else { result = ReflectApply(compiledWrapper, thisValue, [exports, require, module, filename, dirname]); } hasLoadedAnyUserCJSModule = true; if (requireDepth === 0) statCache = null; return result; }; // Native extension for .js Module._extensions['.js'] = function(module, filename) { if (StringPrototypeEndsWith(filename, '.js')) { const pkg = readPackageScope(filename); // Function require shouldn't be used in ES modules. if (pkg && pkg.data && pkg.data.type === 'module') { const parent = moduleParentCache.get(module); const parentPath = parent && parent.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); } } // If already analyzed the source, then it will be cached. const cached = cjsParseCache.get(module); let content; if (cached && cached.source) { content = cached.source; cached.source = undefined; } else { content = fs.readFileSync(filename, 'utf8'); } module._compile(content, filename); }; // Native extension for .json Module._extensions['.json'] = function(module, filename) { const content = fs.readFileSync(filename, 'utf8'); if (policy?.manifest) { const moduleURL = pathToFileURL(filename); policy.manifest.assertIntegrity(moduleURL, content); } try { module.exports = JSONParse(stripBOM(content)); } catch (err) { err.message = filename + ': ' + err.message; throw err; } }; // Native extension for .node Module._extensions['.node'] = function(module, filename) { if (policy?.manifest) { const content = fs.readFileSync(filename); const moduleURL = pathToFileURL(filename); policy.manifest.assertIntegrity(moduleURL, content); } // Be aware this doesn't use `content` return process.dlopen(module, path.toNamespacedPath(filename)); }; function createRequireFromPath(filename) { // Allow a directory to be passed as the filename const trailingSlash = StringPrototypeEndsWith(filename, '/') || (isWindows && StringPrototypeEndsWith(filename, '\\')); const proxyPath = trailingSlash ? path.join(filename, 'noop.js') : filename; const m = new Module(proxyPath); m.filename = proxyPath; m.paths = Module._nodeModulePaths(m.path); return makeRequireFunction(m, null); } Module.createRequireFromPath = deprecate( createRequireFromPath, 'Module.createRequireFromPath() is deprecated. ' + 'Use Module.createRequire() instead.', 'DEP0130' ); const createRequireError = 'must be a file URL object, file URL string, or ' + 'absolute path string'; function createRequire(filename) { let filepath; if (isURLInstance(filename) || (typeof filename === 'string' && !path.isAbsolute(filename))) { try { filepath = fileURLToPath(filename); } catch { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } } else if (typeof filename !== 'string') { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } else { filepath = filename; } return createRequireFromPath(filepath); } Module.createRequire = createRequire; Module._initPaths = function() { const homeDir = isWindows ? process.env.USERPROFILE : safeGetenv('HOME'); const nodePath = isWindows ? process.env.NODE_PATH : safeGetenv('NODE_PATH'); // process.execPath is $PREFIX/bin/node except on Windows where it is // $PREFIX\node.exe where $PREFIX is the root of the Node.js installation. const prefixDir = isWindows ? path.resolve(process.execPath, '..') : path.resolve(process.execPath, '..', '..'); let paths = [path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { paths.unshift(path.resolve(homeDir, '.node_libraries')); paths.unshift(path.resolve(homeDir, '.node_modules')); } if (nodePath) { paths = ArrayPrototypeConcat(ArrayPrototypeFilter( StringPrototypeSplit(nodePath, path.delimiter), Boolean ), paths); } modulePaths = paths; // Clone as a shallow copy, for introspection. Module.globalPaths = ArrayPrototypeSlice(modulePaths); }; Module._preloadModules = function(requests) { if (!ArrayIsArray(requests)) return; // Preloaded modules have a dummy parent module which is deemed to exist // in the current working directory. This seeds the search path for // preloaded modules. const parent = new Module('internal/preload', null); try { parent.paths = Module._nodeModulePaths(process.cwd()); } catch (e) { if (e.code !== 'ENOENT') { throw e; } } for (let n = 0; n < requests.length; n++) parent.require(requests[n]); }; Module.syncBuiltinESMExports = function syncBuiltinESMExports() { for (const mod of NativeModule.map.values()) { if (mod.canBeRequiredByUsers) { mod.syncExports(); } } }; // Backwards compatibility Module.Module = Module; ts-node-10.9.2/raw/node-internal-modules-cjs-loader-v17.0.1-stripped.js000066400000000000000000000410041453460306300252740ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.1/lib/internal/modules/cjs/loader.js 'use strict'; const { ArrayIsArray, ArrayPrototypeConcat, ArrayPrototypeFilter, ArrayPrototypeIncludes, ArrayPrototypeIndexOf, ArrayPrototypeJoin, ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, ArrayPrototypeUnshift, ArrayPrototypeUnshiftApply, Boolean, Error, JSONParse, ObjectCreate, ObjectDefineProperty, ObjectFreeze, ObjectGetOwnPropertyDescriptor, ObjectGetPrototypeOf, ObjectKeys, ObjectPrototype, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, Proxy, ReflectApply, ReflectSet, RegExpPrototypeExec, RegExpPrototypeTest, SafeMap, SafeWeakMap, String, StringPrototypeCharAt, StringPrototypeCharCodeAt, StringPrototypeEndsWith, StringPrototypeLastIndexOf, StringPrototypeIndexOf, StringPrototypeMatch, StringPrototypeRepeat, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, } = primordials; const { NativeModule } = require('internal/bootstrap/loaders'); const { pathToFileURL, fileURLToPath, isURLInstance } = require('internal/url'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; const { internalModuleStat } = internalBinding('fs'); const packageJsonReader = require('internal/modules/package_json_reader'); const { cjsConditions, hasEsmSyntax, } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? require('internal/process/policy') : null; const { codes: { ERR_INVALID_MODULE_SPECIFIER, ERR_REQUIRE_ESM, }, } = require('internal/errors'); const { CHAR_FORWARD_SLASH, } = require('internal/constants'); const { encodedSepRegEx, packageExportsResolve, packageImportsResolve } = require('internal/modules/esm/resolve'); const isWindows = process.platform === 'win32'; const relativeResolveCache = ObjectCreate(null); let requireDepth = 0; let statCache = null; let isPreloading = false; function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } const result = internalModuleStat(filename); if (statCache !== null && result >= 0) { // Only set cache when `internalModuleStat(filename)` succeeds. statCache.set(filename, result); } return result; } const moduleParentCache = new SafeWeakMap(); // Given a module name, and a list of paths to test, returns the first // matching file in the following precedence. // // require("a.") // -> a. // // require("a") // -> a // -> a. // -> a/index. const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const result = packageJsonReader.read(jsonPath); const json = result.containsKeys === false ? '{}' : result.string; if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, imports: parsed.imports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep); let separatorIndex; do { separatorIndex = StringPrototypeLastIndexOf(checkPath, sep); checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex); if (StringPrototypeEndsWith(checkPath, sep + 'node_modules')) return false; const pjson = readPackage(checkPath + sep); if (pjson) return { data: pjson, path: checkPath, }; } while (separatorIndex > rootSeparatorIndex); return false; } function tryPackage(requestPath, exts, isMain, originalPath) { const pkg = readPackage(requestPath)?.main; if (!pkg) { return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); } const filename = path.resolve(requestPath, pkg); let actual = tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, 'index'), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); if (!actual) { // eslint-disable-next-line no-restricted-syntax const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); err.code = 'MODULE_NOT_FOUND'; err.path = path.resolve(requestPath, 'package.json'); err.requestPath = originalPath; // TODO(BridgeAR): Add the requireStack as well. throw err; } else { const jsonPath = path.resolve(requestPath, 'package.json'); process.emitWarning( `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + 'Please either fix that or report it to the module author', 'DeprecationWarning', 'DEP0128' ); } } return actual; } // In order to minimize unnecessary lstat() calls, // this cache is a list of known-real paths. // Set to an empty Map to reset. const realpathCache = new SafeMap(); // Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); if (rc !== 0) return; if (preserveSymlinks && !isMain) { return path.resolve(requestPath); } return toRealPath(requestPath); } function toRealPath(requestPath) { return fs.realpathSync(requestPath, { [internalFS.realpathCacheKey]: realpathCache }); } // Given a path, check if the file exists with any of the set extensions function tryExtensions(p, exts, isMain) { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; } function trySelfParentPath(parent) { if (!parent) return false; if (parent.filename) { return parent.filename; } else if (parent.id === '' || parent.id === 'internal/preload') { try { return process.cwd() + path.sep; } catch { return false; } } } function trySelf(parentPath, request) { if (!parentPath) return false; const { data: pkg, path: pkgPath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; let expansion; if (request === pkg.name) { expansion = '.'; } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) { expansion = '.' + StringPrototypeSlice(request, pkg.name.length); } else { return false; } try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), expansion, pkg, pathToFileURL(parentPath), cjsConditions), parentPath, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. const { 1: name, 2: expansion = '' } = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) return; const pkgPath = path.resolve(nmPath, name); const pkg = readPackage(pkgPath); if (pkg?.exports != null) { try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), '.' + expansion, pkg, null, cjsConditions), null, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } } const trailingSlashRegex = /(?:^|\/)\.?\.$/; Module._findPath = function(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = ['']; } else if (!paths || paths.length === 0) { return false; } const cacheKey = request + '\x00' + ArrayPrototypeJoin(paths, '\x00'); const entry = Module._pathCache[cacheKey]; if (entry) return entry; let exts; let trailingSlash = request.length > 0 && StringPrototypeCharCodeAt(request, request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path for (let i = 0; i < paths.length; i++) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; if (!absoluteRequest) { const exportsResolved = resolveExports(curPath, request); if (exportsResolved) return exportsResolved; } const basePath = path.resolve(curPath, request); let filename; const rc = stat(basePath); if (!trailingSlash) { if (rc === 0) { // File. if (!isMain) { if (preserveSymlinks) { filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } else if (preserveSymlinksMain) { // For the main module, we use the preserveSymlinksMain flag instead // mainly for backward compatibility, as the preserveSymlinks flag // historically has not applied to the main module. Most likely this // was intended to keep .bin/ binaries working, as following those // symlinks is usually required for the imports in the corresponding // files to resolve; that said, in some use cases following symlinks // causes bigger problems which is why the preserveSymlinksMain option // is needed. filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } if (!filename) { // Try it with each of the extensions if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); } if (filename) { Module._pathCache[cacheKey] = filename; return filename; } } return false; }; Module._resolveFilename = function(request, parent, isMain, options) { if (StringPrototypeStartsWith(request, 'node:') || NativeModule.canBeRequiredByUsers(request)) { return request; } let paths; if (typeof options === 'object' && options !== null) { if (ArrayIsArray(options.paths)) { const isRelative = StringPrototypeStartsWith(request, './') || StringPrototypeStartsWith(request, '../') || ((isWindows && StringPrototypeStartsWith(request, '.\\')) || StringPrototypeStartsWith(request, '..\\')); if (isRelative) { paths = options.paths; } else { const fakeParent = new Module('', null); paths = []; for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent); for (let j = 0; j < lookupPaths.length; j++) { if (!ArrayPrototypeIncludes(paths, lookupPaths[j])) ArrayPrototypePush(paths, lookupPaths[j]); } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent); } else { throw new ERR_INVALID_ARG_VALUE('options.paths', options.paths); } } else { paths = Module._resolveLookupPaths(request, parent); } if (parent?.filename) { if (request[0] === '#') { const pkg = readPackageScope(parent.filename) || {}; if (pkg.data?.imports != null) { try { return finalizeEsmResolution( packageImportsResolve(request, pathToFileURL(parent.filename), cjsConditions), parent.filename, pkg.path); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request); throw e; } } } } // Try module self resolution first const parentPath = trySelfParentPath(parent); const selfResolved = trySelf(parentPath, request); if (selfResolved) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : ArrayPrototypeJoin(paths, '\x00')); Module._pathCache[cacheKey] = selfResolved; return selfResolved; } // Look up the filename first, since that's the cache key. const filename = Module._findPath(request, paths, isMain, false); if (filename) return filename; const requireStack = []; for (let cursor = parent; cursor; cursor = moduleParentCache.get(cursor)) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + '\nRequire stack:\n- ' + ArrayPrototypeJoin(requireStack, '\n- '); } // eslint-disable-next-line no-restricted-syntax const err = new Error(message); err.code = 'MODULE_NOT_FOUND'; err.requireStack = requireStack; throw err; }; function finalizeEsmResolution(resolved, parentPath, pkgPath) { if (RegExpPrototypeTest(encodedSepRegEx, resolved)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved, 'must not include encoded "/" or "\\" characters', parentPath); const filename = fileURLToPath(resolved); const actual = tryFile(filename); if (actual) return actual; const err = createEsmNotFoundErr(filename, path.resolve(pkgPath, 'package.json')); throw err; } function createEsmNotFoundErr(request, path) { // eslint-disable-next-line no-restricted-syntax const err = new Error(`Cannot find module '${request}'`); err.code = 'MODULE_NOT_FOUND'; if (path) err.path = path; // TODO(BridgeAR): Add the requireStack as well. return err; } // Native extension for .js Module._extensions['.js'] = function(module, filename) { // If already analyzed the source, then it will be cached. const cached = cjsParseCache.get(module); let content; if (cached?.source) { content = cached.source; cached.source = undefined; } else { content = fs.readFileSync(filename, 'utf8'); } if (StringPrototypeEndsWith(filename, '.js')) { const pkg = readPackageScope(filename); // Function require shouldn't be used in ES modules. if (pkg?.data?.type === 'module') { const parent = moduleParentCache.get(module); const parentPath = parent?.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); const usesEsm = hasEsmSyntax(content); const err = new ERR_REQUIRE_ESM(filename, usesEsm, parentPath, packageJsonPath); // Attempt to reconstruct the parent require frame. if (Module._cache[parentPath]) { let parentSource; try { parentSource = fs.readFileSync(parentPath, 'utf8'); } catch {} if (parentSource) { const errLine = StringPrototypeSplit( StringPrototypeSlice(err.stack, StringPrototypeIndexOf( err.stack, ' at ')), '\n', 1)[0]; const { 1: line, 2: col } = RegExpPrototypeExec(/(\d+):(\d+)\)/, errLine) || []; if (line && col) { const srcLine = StringPrototypeSplit(parentSource, '\n')[line - 1]; const frame = `${parentPath}:${line}\n${srcLine}\n${ StringPrototypeRepeat(' ', col - 1)}^\n`; setArrowMessage(err, frame); } } } throw err; } } module._compile(content, filename); }; ts-node-10.9.2/raw/node-internal-modules-cjs-loader-v17.0.1.js000066400000000000000000001161321453460306300234510ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.1/lib/internal/modules/cjs/loader.js // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; const { ArrayIsArray, ArrayPrototypeConcat, ArrayPrototypeFilter, ArrayPrototypeIncludes, ArrayPrototypeIndexOf, ArrayPrototypeJoin, ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, ArrayPrototypeUnshift, ArrayPrototypeUnshiftApply, Boolean, Error, JSONParse, ObjectCreate, ObjectDefineProperty, ObjectFreeze, ObjectGetOwnPropertyDescriptor, ObjectGetPrototypeOf, ObjectKeys, ObjectPrototype, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, Proxy, ReflectApply, ReflectSet, RegExpPrototypeExec, RegExpPrototypeTest, SafeMap, SafeWeakMap, String, StringPrototypeCharAt, StringPrototypeCharCodeAt, StringPrototypeEndsWith, StringPrototypeLastIndexOf, StringPrototypeIndexOf, StringPrototypeMatch, StringPrototypeRepeat, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, } = primordials; // Map used to store CJS parsing data. const cjsParseCache = new SafeWeakMap(); // Set first due to cycle with ESM loader functions. module.exports = { wrapSafe, Module, toRealPath, readPackageScope, cjsParseCache, get hasLoadedAnyUserCJSModule() { return hasLoadedAnyUserCJSModule; } }; const { NativeModule } = require('internal/bootstrap/loaders'); const { maybeCacheSourceMap, } = require('internal/source_map/source_map_cache'); const { pathToFileURL, fileURLToPath, isURLInstance } = require('internal/url'); const { deprecate } = require('internal/util'); const vm = require('vm'); const assert = require('internal/assert'); const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; const { internalModuleStat } = internalBinding('fs'); const packageJsonReader = require('internal/modules/package_json_reader'); const { safeGetenv } = internalBinding('credentials'); const { cjsConditions, hasEsmSyntax, loadNativeModule, makeRequireFunction, normalizeReferrerURL, stripBOM, } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? require('internal/process/policy') : null; // Whether any user-provided CJS modules had been loaded (executed). // Used for internal assertions. let hasLoadedAnyUserCJSModule = false; const { codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_MODULE_SPECIFIER, ERR_REQUIRE_ESM, ERR_UNKNOWN_BUILTIN_MODULE, }, setArrowMessage, } = require('internal/errors'); const { validateString } = require('internal/validators'); const pendingDeprecation = getOptionValue('--pending-deprecation'); const { CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_COLON } = require('internal/constants'); const { isProxy } = require('internal/util/types'); const asyncESM = require('internal/process/esm_loader'); const { enrichCJSError } = require('internal/modules/esm/translators'); const { kEvaluated } = internalBinding('module_wrap'); const { encodedSepRegEx, packageExportsResolve, packageImportsResolve } = require('internal/modules/esm/resolve'); const isWindows = process.platform === 'win32'; const relativeResolveCache = ObjectCreate(null); let requireDepth = 0; let statCache = null; let isPreloading = false; function stat(filename) { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } const result = internalModuleStat(filename); if (statCache !== null && result >= 0) { // Only set cache when `internalModuleStat(filename)` succeeds. statCache.set(filename, result); } return result; } function updateChildren(parent, child, scan) { const children = parent?.children; if (children && !(scan && ArrayPrototypeIncludes(children, child))) ArrayPrototypePush(children, child); } const moduleParentCache = new SafeWeakMap(); function Module(id = '', parent) { this.id = id; this.path = path.dirname(id); this.exports = {}; moduleParentCache.set(this, parent); updateChildren(parent, this, false); this.filename = null; this.loaded = false; this.children = []; } const builtinModules = []; for (const { 0: id, 1: mod } of NativeModule.map) { if (mod.canBeRequiredByUsers) { ArrayPrototypePush(builtinModules, id); } } ObjectFreeze(builtinModules); Module.builtinModules = builtinModules; Module._cache = ObjectCreate(null); Module._pathCache = ObjectCreate(null); Module._extensions = ObjectCreate(null); let modulePaths = []; Module.globalPaths = []; let patched = false; // eslint-disable-next-line func-style let wrap = function(script) { return Module.wrapper[0] + script + Module.wrapper[1]; }; const wrapper = [ '(function (exports, require, module, __filename, __dirname) { ', '\n});', ]; let wrapperProxy = new Proxy(wrapper, { set(target, property, value, receiver) { patched = true; return ReflectSet(target, property, value, receiver); }, defineProperty(target, property, descriptor) { patched = true; return ObjectDefineProperty(target, property, descriptor); } }); ObjectDefineProperty(Module, 'wrap', { get() { return wrap; }, set(value) { patched = true; wrap = value; } }); ObjectDefineProperty(Module, 'wrapper', { get() { return wrapperProxy; }, set(value) { patched = true; wrapperProxy = value; } }); const isPreloadingDesc = { get() { return isPreloading; } }; ObjectDefineProperty(Module.prototype, 'isPreloading', isPreloadingDesc); ObjectDefineProperty(NativeModule.prototype, 'isPreloading', isPreloadingDesc); function getModuleParent() { return moduleParentCache.get(this); } function setModuleParent(value) { moduleParentCache.set(this, value); } ObjectDefineProperty(Module.prototype, 'parent', { get: pendingDeprecation ? deprecate( getModuleParent, 'module.parent is deprecated due to accuracy issues. Please use ' + 'require.main to find program entry point instead.', 'DEP0144' ) : getModuleParent, set: pendingDeprecation ? deprecate( setModuleParent, 'module.parent is deprecated due to accuracy issues. Please use ' + 'require.main to find program entry point instead.', 'DEP0144' ) : setModuleParent, }); let debug = require('internal/util/debuglog').debuglog('module', (fn) => { debug = fn; }); Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077'); // Given a module name, and a list of paths to test, returns the first // matching file in the following precedence. // // require("a.") // -> a. // // require("a") // -> a // -> a. // -> a/index. const packageJsonCache = new SafeMap(); function readPackage(requestPath) { const jsonPath = path.resolve(requestPath, 'package.json'); const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) return existing; const result = packageJsonReader.read(jsonPath); const json = result.containsKeys === false ? '{}' : result.string; if (json === undefined) { packageJsonCache.set(jsonPath, false); return false; } try { const parsed = JSONParse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, imports: parsed.imports, type: parsed.type }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { e.path = jsonPath; e.message = 'Error parsing ' + jsonPath + ': ' + e.message; throw e; } } function readPackageScope(checkPath) { const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep); let separatorIndex; do { separatorIndex = StringPrototypeLastIndexOf(checkPath, sep); checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex); if (StringPrototypeEndsWith(checkPath, sep + 'node_modules')) return false; const pjson = readPackage(checkPath + sep); if (pjson) return { data: pjson, path: checkPath, }; } while (separatorIndex > rootSeparatorIndex); return false; } function tryPackage(requestPath, exts, isMain, originalPath) { const pkg = readPackage(requestPath)?.main; if (!pkg) { return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); } const filename = path.resolve(requestPath, pkg); let actual = tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, 'index'), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain); if (!actual) { // eslint-disable-next-line no-restricted-syntax const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry' ); err.code = 'MODULE_NOT_FOUND'; err.path = path.resolve(requestPath, 'package.json'); err.requestPath = originalPath; // TODO(BridgeAR): Add the requireStack as well. throw err; } else { const jsonPath = path.resolve(requestPath, 'package.json'); process.emitWarning( `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + 'Please either fix that or report it to the module author', 'DeprecationWarning', 'DEP0128' ); } } return actual; } // In order to minimize unnecessary lstat() calls, // this cache is a list of known-real paths. // Set to an empty Map to reset. const realpathCache = new SafeMap(); // Check if the file exists and is not a directory // if using --preserve-symlinks and isMain is false, // keep symlinks intact, otherwise resolve to the // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); if (rc !== 0) return; if (preserveSymlinks && !isMain) { return path.resolve(requestPath); } return toRealPath(requestPath); } function toRealPath(requestPath) { return fs.realpathSync(requestPath, { [internalFS.realpathCacheKey]: realpathCache }); } // Given a path, check if the file exists with any of the set extensions function tryExtensions(p, exts, isMain) { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain); if (filename) { return filename; } } return false; } // Find the longest (possibly multi-dot) extension registered in // Module._extensions function findLongestRegisteredExtension(filename) { const name = path.basename(filename); let currentExtension; let index; let startIndex = 0; while ((index = StringPrototypeIndexOf(name, '.', startIndex)) !== -1) { startIndex = index + 1; if (index === 0) continue; // Skip dotfiles like .gitignore currentExtension = StringPrototypeSlice(name, index); if (Module._extensions[currentExtension]) return currentExtension; } return '.js'; } function trySelfParentPath(parent) { if (!parent) return false; if (parent.filename) { return parent.filename; } else if (parent.id === '' || parent.id === 'internal/preload') { try { return process.cwd() + path.sep; } catch { return false; } } } function trySelf(parentPath, request) { if (!parentPath) return false; const { data: pkg, path: pkgPath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; let expansion; if (request === pkg.name) { expansion = '.'; } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) { expansion = '.' + StringPrototypeSlice(request, pkg.name.length); } else { return false; } try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), expansion, pkg, pathToFileURL(parentPath), cjsConditions), parentPath, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. const { 1: name, 2: expansion = '' } = StringPrototypeMatch(request, EXPORTS_PATTERN) || []; if (!name) return; const pkgPath = path.resolve(nmPath, name); const pkg = readPackage(pkgPath); if (pkg?.exports != null) { try { return finalizeEsmResolution(packageExportsResolve( pathToFileURL(pkgPath + '/package.json'), '.' + expansion, pkg, null, cjsConditions), null, pkgPath); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request, pkgPath + '/package.json'); throw e; } } } const trailingSlashRegex = /(?:^|\/)\.?\.$/; Module._findPath = function(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = ['']; } else if (!paths || paths.length === 0) { return false; } const cacheKey = request + '\x00' + ArrayPrototypeJoin(paths, '\x00'); const entry = Module._pathCache[cacheKey]; if (entry) return entry; let exts; let trailingSlash = request.length > 0 && StringPrototypeCharCodeAt(request, request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path for (let i = 0; i < paths.length; i++) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; if (!absoluteRequest) { const exportsResolved = resolveExports(curPath, request); if (exportsResolved) return exportsResolved; } const basePath = path.resolve(curPath, request); let filename; const rc = stat(basePath); if (!trailingSlash) { if (rc === 0) { // File. if (!isMain) { if (preserveSymlinks) { filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } else if (preserveSymlinksMain) { // For the main module, we use the preserveSymlinksMain flag instead // mainly for backward compatibility, as the preserveSymlinks flag // historically has not applied to the main module. Most likely this // was intended to keep .bin/ binaries working, as following those // symlinks is usually required for the imports in the corresponding // files to resolve; that said, in some use cases following symlinks // causes bigger problems which is why the preserveSymlinksMain option // is needed. filename = path.resolve(basePath); } else { filename = toRealPath(basePath); } } if (!filename) { // Try it with each of the extensions if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) exts = ObjectKeys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); } if (filename) { Module._pathCache[cacheKey] = filename; return filename; } } return false; }; // 'node_modules' character codes reversed const nmChars = [ 115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110 ]; const nmLen = nmChars.length; if (isWindows) { // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. // return root node_modules when path is 'D:\\'. // path.resolve will make sure from.length >=3 in Windows. if (StringPrototypeCharCodeAt(from, from.length - 1) === CHAR_BACKWARD_SLASH && StringPrototypeCharCodeAt(from, from.length - 2) === CHAR_COLON) return [from + 'node_modules']; const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = StringPrototypeCharCodeAt(from, i); // The path segment separator check ('\' and '/') was used to get // node_modules path for every path segment. // Use colon as an extra condition since we can get node_modules // path for drive root like 'C:\node_modules' and don't need to // parse drive name. if (code === CHAR_BACKWARD_SLASH || code === CHAR_FORWARD_SLASH || code === CHAR_COLON) { if (p !== nmLen) ArrayPrototypePush( paths, StringPrototypeSlice(from, 0, last) + '\\node_modules' ); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } return paths; }; } else { // posix // 'from' is the __dirname of the module. Module._nodeModulePaths = function(from) { // Guarantee that 'from' is absolute. from = path.resolve(from); // Return early not only to avoid unnecessary work, but to *avoid* returning // an array of two items for a root: [ '//node_modules', '/node_modules' ] if (from === '/') return ['/node_modules']; // note: this approach *only* works when the path is guaranteed // to be absolute. Doing a fully-edge-case-correct path.split // that works on both Windows and Posix is non-trivial. const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = StringPrototypeCharCodeAt(from, i); if (code === CHAR_FORWARD_SLASH) { if (p !== nmLen) ArrayPrototypePush( paths, StringPrototypeSlice(from, 0, last) + '/node_modules' ); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } } // Append /node_modules to handle root paths. ArrayPrototypePush(paths, '/node_modules'); return paths; }; } Module._resolveLookupPaths = function(request, parent) { if (NativeModule.canBeRequiredByUsers(request)) { debug('looking for %j in []', request); return null; } // Check for node modules paths. if (StringPrototypeCharAt(request, 0) !== '.' || (request.length > 1 && StringPrototypeCharAt(request, 1) !== '.' && StringPrototypeCharAt(request, 1) !== '/' && (!isWindows || StringPrototypeCharAt(request, 1) !== '\\'))) { let paths = modulePaths; if (parent?.paths?.length) { paths = ArrayPrototypeConcat(parent.paths, paths); } debug('looking for %j in %j', request, paths); return paths.length > 0 ? paths : null; } // In REPL, parent.filename is null. if (!parent || !parent.id || !parent.filename) { // Make require('./path/to/foo') work - normally the path is taken // from realpath(__filename) but in REPL there is no filename const mainPaths = ['.']; debug('looking for %j in %j', request, mainPaths); return mainPaths; } debug('RELATIVE: requested: %s from parent.id %s', request, parent.id); const parentDir = [path.dirname(parent.filename)]; debug('looking for %j', parentDir); return parentDir; }; function emitCircularRequireWarning(prop) { process.emitWarning( `Accessing non-existent property '${String(prop)}' of module exports ` + 'inside circular dependency' ); } // A Proxy that can be used as the prototype of a module.exports object and // warns when non-existent properties are accessed. const CircularRequirePrototypeWarningProxy = new Proxy({}, { get(target, prop) { // Allow __esModule access in any case because it is used in the output // of transpiled code to determine whether something comes from an // ES module, and is not used as a regular key of `module.exports`. if (prop in target || prop === '__esModule') return target[prop]; emitCircularRequireWarning(prop); return undefined; }, getOwnPropertyDescriptor(target, prop) { if (ObjectPrototypeHasOwnProperty(target, prop) || prop === '__esModule') return ObjectGetOwnPropertyDescriptor(target, prop); emitCircularRequireWarning(prop); return undefined; } }); function getExportsForCircularRequire(module) { if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === ObjectPrototype && // Exclude transpiled ES6 modules / TypeScript code because those may // employ unusual patterns for accessing 'module.exports'. That should // be okay because ES6 modules have a different approach to circular // dependencies anyway. !module.exports.__esModule) { // This is later unset once the module is done loading. ObjectSetPrototypeOf( module.exports, CircularRequirePrototypeWarningProxy); } return module.exports; } // Check the cache for the requested file. // 1. If a module already exists in the cache: return its exports object. // 2. If the module is native: call // `NativeModule.prototype.compileForPublicLoader()` and return the exports. // 3. Otherwise, create a new module for the file and save it to the cache. // Then have it load the file contents before returning its exports // object. Module._load = function(request, parent, isMain) { let relResolveCacheIdentifier; if (parent) { debug('Module._load REQUEST %s parent: %s', request, parent.id); // Fast path for (lazy loaded) modules in the same directory. The indirect // caching is required to allow cache invalidation without changing the old // cache key names. relResolveCacheIdentifier = `${parent.path}\x00${request}`; const filename = relativeResolveCache[relResolveCacheIdentifier]; if (filename !== undefined) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) return getExportsForCircularRequire(cachedModule); return cachedModule.exports; } delete relativeResolveCache[relResolveCacheIdentifier]; } } const filename = Module._resolveFilename(request, parent, isMain); if (StringPrototypeStartsWith(filename, 'node:')) { // Slice 'node:' prefix const id = StringPrototypeSlice(filename, 5); const module = loadNativeModule(id, request); if (!module?.canBeRequiredByUsers) { throw new ERR_UNKNOWN_BUILTIN_MODULE(filename); } return module.exports; } const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) { const parseCachedModule = cjsParseCache.get(cachedModule); if (!parseCachedModule || parseCachedModule.loaded) return getExportsForCircularRequire(cachedModule); parseCachedModule.loaded = true; } else { return cachedModule.exports; } } const mod = loadNativeModule(filename, request); if (mod?.canBeRequiredByUsers) return mod.exports; // Don't call updateChildren(), Module constructor already does. const module = cachedModule || new Module(filename, parent); if (isMain) { process.mainModule = module; module.id = '.'; } Module._cache[filename] = module; if (parent !== undefined) { relativeResolveCache[relResolveCacheIdentifier] = filename; } let threw = true; try { module.load(filename); threw = false; } finally { if (threw) { delete Module._cache[filename]; if (parent !== undefined) { delete relativeResolveCache[relResolveCacheIdentifier]; const children = parent?.children; if (ArrayIsArray(children)) { const index = ArrayPrototypeIndexOf(children, module); if (index !== -1) { ArrayPrototypeSplice(children, index, 1); } } } } else if (module.exports && !isProxy(module.exports) && ObjectGetPrototypeOf(module.exports) === CircularRequirePrototypeWarningProxy) { ObjectSetPrototypeOf(module.exports, ObjectPrototype); } } return module.exports; }; Module._resolveFilename = function(request, parent, isMain, options) { if (StringPrototypeStartsWith(request, 'node:') || NativeModule.canBeRequiredByUsers(request)) { return request; } let paths; if (typeof options === 'object' && options !== null) { if (ArrayIsArray(options.paths)) { const isRelative = StringPrototypeStartsWith(request, './') || StringPrototypeStartsWith(request, '../') || ((isWindows && StringPrototypeStartsWith(request, '.\\')) || StringPrototypeStartsWith(request, '..\\')); if (isRelative) { paths = options.paths; } else { const fakeParent = new Module('', null); paths = []; for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent); for (let j = 0; j < lookupPaths.length; j++) { if (!ArrayPrototypeIncludes(paths, lookupPaths[j])) ArrayPrototypePush(paths, lookupPaths[j]); } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent); } else { throw new ERR_INVALID_ARG_VALUE('options.paths', options.paths); } } else { paths = Module._resolveLookupPaths(request, parent); } if (parent?.filename) { if (request[0] === '#') { const pkg = readPackageScope(parent.filename) || {}; if (pkg.data?.imports != null) { try { return finalizeEsmResolution( packageImportsResolve(request, pathToFileURL(parent.filename), cjsConditions), parent.filename, pkg.path); } catch (e) { if (e.code === 'ERR_MODULE_NOT_FOUND') throw createEsmNotFoundErr(request); throw e; } } } } // Try module self resolution first const parentPath = trySelfParentPath(parent); const selfResolved = trySelf(parentPath, request); if (selfResolved) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : ArrayPrototypeJoin(paths, '\x00')); Module._pathCache[cacheKey] = selfResolved; return selfResolved; } // Look up the filename first, since that's the cache key. const filename = Module._findPath(request, paths, isMain, false); if (filename) return filename; const requireStack = []; for (let cursor = parent; cursor; cursor = moduleParentCache.get(cursor)) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + '\nRequire stack:\n- ' + ArrayPrototypeJoin(requireStack, '\n- '); } // eslint-disable-next-line no-restricted-syntax const err = new Error(message); err.code = 'MODULE_NOT_FOUND'; err.requireStack = requireStack; throw err; }; function finalizeEsmResolution(resolved, parentPath, pkgPath) { if (RegExpPrototypeTest(encodedSepRegEx, resolved)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved, 'must not include encoded "/" or "\\" characters', parentPath); const filename = fileURLToPath(resolved); const actual = tryFile(filename); if (actual) return actual; const err = createEsmNotFoundErr(filename, path.resolve(pkgPath, 'package.json')); throw err; } function createEsmNotFoundErr(request, path) { // eslint-disable-next-line no-restricted-syntax const err = new Error(`Cannot find module '${request}'`); err.code = 'MODULE_NOT_FOUND'; if (path) err.path = path; // TODO(BridgeAR): Add the requireStack as well. return err; } // Given a file name, pass it to the proper extension handler. Module.prototype.load = function(filename) { debug('load %j for module %j', filename, this.id); assert(!this.loaded); this.filename = filename; this.paths = Module._nodeModulePaths(path.dirname(filename)); const extension = findLongestRegisteredExtension(filename); // allow .mjs to be overridden if (StringPrototypeEndsWith(filename, '.mjs') && !Module._extensions['.mjs']) throw new ERR_REQUIRE_ESM(filename, true); Module._extensions[extension](this, filename); this.loaded = true; const esmLoader = asyncESM.esmLoader; // Create module entry at load time to snapshot exports correctly const exports = this.exports; // Preemptively cache if ((module?.module === undefined || module.module.getStatus() < kEvaluated) && !esmLoader.cjsCache.has(this)) esmLoader.cjsCache.set(this, exports); }; // Loads a module at the given file path. Returns that module's // `exports` property. Module.prototype.require = function(id) { validateString(id, 'id'); if (id === '') { throw new ERR_INVALID_ARG_VALUE('id', id, 'must be a non-empty string'); } requireDepth++; try { return Module._load(id, this, /* isMain */ false); } finally { requireDepth--; } }; // Resolved path to process.argv[1] will be lazily placed here // (needed for setting breakpoint when called with --inspect-brk) let resolvedArgv; let hasPausedEntry = false; function wrapSafe(filename, content, cjsModuleInstance) { if (patched) { const wrapper = Module.wrap(content); return vm.runInThisContext(wrapper, { filename, lineOffset: 0, displayErrors: true, importModuleDynamically: async (specifier) => { const loader = asyncESM.esmLoader; return loader.import(specifier, normalizeReferrerURL(filename)); }, }); } try { return vm.compileFunction(content, [ 'exports', 'require', 'module', '__filename', '__dirname', ], { filename, importModuleDynamically(specifier) { const loader = asyncESM.esmLoader; return loader.import(specifier, normalizeReferrerURL(filename)); }, }); } catch (err) { if (process.mainModule === cjsModuleInstance) enrichCJSError(err, content); throw err; } } // Run the file contents in the correct scope or sandbox. Expose // the correct helper variables (require, module, exports) to // the file. // Returns exception, if any. Module.prototype._compile = function(content, filename) { let moduleURL; let redirects; if (policy?.manifest) { moduleURL = pathToFileURL(filename); redirects = policy.manifest.getDependencyMapper(moduleURL); policy.manifest.assertIntegrity(moduleURL, content); } maybeCacheSourceMap(filename, content, this); const compiledWrapper = wrapSafe(filename, content, this); let inspectorWrapper = null; if (getOptionValue('--inspect-brk') && process._eval == null) { if (!resolvedArgv) { // We enter the repl if we're not given a filename argument. if (process.argv[1]) { try { resolvedArgv = Module._resolveFilename(process.argv[1], null, false); } catch { // We only expect this codepath to be reached in the case of a // preloaded module (it will fail earlier with the main entry) assert(ArrayIsArray(getOptionValue('--require'))); } } else { resolvedArgv = 'repl'; } } // Set breakpoint on module start if (resolvedArgv && !hasPausedEntry && filename === resolvedArgv) { hasPausedEntry = true; inspectorWrapper = internalBinding('inspector').callAndPauseOnStart; } } const dirname = path.dirname(filename); const require = makeRequireFunction(this, redirects); let result; const exports = this.exports; const thisValue = exports; const module = this; if (requireDepth === 0) statCache = new SafeMap(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, require, module, filename, dirname); } else { result = ReflectApply(compiledWrapper, thisValue, [exports, require, module, filename, dirname]); } hasLoadedAnyUserCJSModule = true; if (requireDepth === 0) statCache = null; return result; }; // Native extension for .js Module._extensions['.js'] = function(module, filename) { // If already analyzed the source, then it will be cached. const cached = cjsParseCache.get(module); let content; if (cached?.source) { content = cached.source; cached.source = undefined; } else { content = fs.readFileSync(filename, 'utf8'); } if (StringPrototypeEndsWith(filename, '.js')) { const pkg = readPackageScope(filename); // Function require shouldn't be used in ES modules. if (pkg?.data?.type === 'module') { const parent = moduleParentCache.get(module); const parentPath = parent?.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); const usesEsm = hasEsmSyntax(content); const err = new ERR_REQUIRE_ESM(filename, usesEsm, parentPath, packageJsonPath); // Attempt to reconstruct the parent require frame. if (Module._cache[parentPath]) { let parentSource; try { parentSource = fs.readFileSync(parentPath, 'utf8'); } catch {} if (parentSource) { const errLine = StringPrototypeSplit( StringPrototypeSlice(err.stack, StringPrototypeIndexOf( err.stack, ' at ')), '\n', 1)[0]; const { 1: line, 2: col } = RegExpPrototypeExec(/(\d+):(\d+)\)/, errLine) || []; if (line && col) { const srcLine = StringPrototypeSplit(parentSource, '\n')[line - 1]; const frame = `${parentPath}:${line}\n${srcLine}\n${ StringPrototypeRepeat(' ', col - 1)}^\n`; setArrowMessage(err, frame); } } } throw err; } } module._compile(content, filename); }; // Native extension for .json Module._extensions['.json'] = function(module, filename) { const content = fs.readFileSync(filename, 'utf8'); if (policy?.manifest) { const moduleURL = pathToFileURL(filename); policy.manifest.assertIntegrity(moduleURL, content); } try { module.exports = JSONParse(stripBOM(content)); } catch (err) { err.message = filename + ': ' + err.message; throw err; } }; // Native extension for .node Module._extensions['.node'] = function(module, filename) { if (policy?.manifest) { const content = fs.readFileSync(filename); const moduleURL = pathToFileURL(filename); policy.manifest.assertIntegrity(moduleURL, content); } // Be aware this doesn't use `content` return process.dlopen(module, path.toNamespacedPath(filename)); }; function createRequireFromPath(filename) { // Allow a directory to be passed as the filename const trailingSlash = StringPrototypeEndsWith(filename, '/') || (isWindows && StringPrototypeEndsWith(filename, '\\')); const proxyPath = trailingSlash ? path.join(filename, 'noop.js') : filename; const m = new Module(proxyPath); m.filename = proxyPath; m.paths = Module._nodeModulePaths(m.path); return makeRequireFunction(m, null); } const createRequireError = 'must be a file URL object, file URL string, or ' + 'absolute path string'; function createRequire(filename) { let filepath; if (isURLInstance(filename) || (typeof filename === 'string' && !path.isAbsolute(filename))) { try { filepath = fileURLToPath(filename); } catch { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } } else if (typeof filename !== 'string') { throw new ERR_INVALID_ARG_VALUE('filename', filename, createRequireError); } else { filepath = filename; } return createRequireFromPath(filepath); } Module.createRequire = createRequire; Module._initPaths = function() { const homeDir = isWindows ? process.env.USERPROFILE : safeGetenv('HOME'); const nodePath = isWindows ? process.env.NODE_PATH : safeGetenv('NODE_PATH'); // process.execPath is $PREFIX/bin/node except on Windows where it is // $PREFIX\node.exe where $PREFIX is the root of the Node.js installation. const prefixDir = isWindows ? path.resolve(process.execPath, '..') : path.resolve(process.execPath, '..', '..'); const paths = [path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries')); ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_modules')); } if (nodePath) { ArrayPrototypeUnshiftApply(paths, ArrayPrototypeFilter( StringPrototypeSplit(nodePath, path.delimiter), Boolean )); } modulePaths = paths; // Clone as a shallow copy, for introspection. Module.globalPaths = ArrayPrototypeSlice(modulePaths); }; Module._preloadModules = function(requests) { if (!ArrayIsArray(requests)) return; isPreloading = true; // Preloaded modules have a dummy parent module which is deemed to exist // in the current working directory. This seeds the search path for // preloaded modules. const parent = new Module('internal/preload', null); try { parent.paths = Module._nodeModulePaths(process.cwd()); } catch (e) { if (e.code !== 'ENOENT') { isPreloading = false; throw e; } } for (let n = 0; n < requests.length; n++) parent.require(requests[n]); isPreloading = false; }; Module.syncBuiltinESMExports = function syncBuiltinESMExports() { for (const mod of NativeModule.map.values()) { if (mod.canBeRequiredByUsers) { mod.syncExports(); } } }; // Backwards compatibility Module.Module = Module; ts-node-10.9.2/raw/node-internal-modules-esm-get_format-v15.3.0.js000066400000000000000000000050431453460306300243350ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/esm/get_format.js 'use strict'; const { RegExpPrototypeExec, StringPrototypeStartsWith, } = primordials; const { extname } = require('path'); const { getOptionValue } = require('internal/options'); const experimentalJsonModules = getOptionValue('--experimental-json-modules'); const experimentalSpeciferResolution = getOptionValue('--experimental-specifier-resolution'); const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); const { getPackageType } = require('internal/modules/esm/resolve'); const { URL, fileURLToPath } = require('internal/url'); const { ERR_UNKNOWN_FILE_EXTENSION } = require('internal/errors').codes; const extensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'module', '.mjs': 'module' }; const legacyExtensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'commonjs', '.json': 'commonjs', '.mjs': 'module', '.node': 'commonjs' }; if (experimentalWasmModules) extensionFormatMap['.wasm'] = legacyExtensionFormatMap['.wasm'] = 'wasm'; if (experimentalJsonModules) extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; function defaultGetFormat(url, context, defaultGetFormatUnused) { if (StringPrototypeStartsWith(url, 'node:')) { return { format: 'builtin' }; } const parsed = new URL(url); if (parsed.protocol === 'data:') { const [ , mime ] = RegExpPrototypeExec( /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/, parsed.pathname, ) || [ null, null, null ]; const format = ({ '__proto__': null, 'text/javascript': 'module', 'application/json': experimentalJsonModules ? 'json' : null, 'application/wasm': experimentalWasmModules ? 'wasm' : null })[mime] || null; return { format }; } else if (parsed.protocol === 'file:') { const ext = extname(parsed.pathname); let format; if (ext === '.js') { format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs'; } else { format = extensionFormatMap[ext]; } if (!format) { if (experimentalSpeciferResolution === 'node') { process.emitWarning( 'The Node.js specifier resolution in ESM is experimental.', 'ExperimentalWarning'); format = legacyExtensionFormatMap[ext]; } else { throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url)); } } return { format: format || null }; } return { format: null }; } exports.defaultGetFormat = defaultGetFormat; ts-node-10.9.2/raw/node-internal-modules-esm-resolve-v13.12.0.js000066400000000000000000000510031453460306300237400ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v13.12.0/lib/internal/modules/esm/resolve.js 'use strict'; const { ArrayIsArray, JSONParse, JSONStringify, ObjectGetOwnPropertyNames, ObjectPrototypeHasOwnProperty, SafeMap, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeIndexOf, StringPrototypeSlice, StringPrototypeStartsWith, StringPrototypeSubstr, } = primordials; const internalFS = require('internal/fs/utils'); const { NativeModule } = require('internal/bootstrap/loaders'); const { closeSync, fstatSync, openSync, readFileSync, realpathSync, statSync, Stats, } = require('fs'); const { getOptionValue } = require('internal/options'); const { sep } = require('path'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const typeFlag = getOptionValue('--input-type'); const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); const { ERR_INPUT_TYPE_NOT_ALLOWED, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_ESM_URL_SCHEME, } = require('internal/errors').codes; const realpathCache = new SafeMap(); const packageJSONCache = new SafeMap(); /* string -> PackageConfig */ function tryStatSync(path) { try { return statSync(path); } catch { return new Stats(); } } function readIfFile(path) { let fd; try { fd = openSync(path, 'r'); } catch { return undefined; } try { if (!fstatSync(fd).isFile()) return undefined; return readFileSync(fd, 'utf8'); } finally { closeSync(fd); } } function getPackageConfig(path, base) { const existing = packageJSONCache.get(path); if (existing !== undefined) { if (!existing.isValid) { throw new ERR_INVALID_PACKAGE_CONFIG(path, fileURLToPath(base), false); } return existing; } const source = readIfFile(path); if (source === undefined) { const packageConfig = { exists: false, main: undefined, name: undefined, isValid: true, type: 'none', exports: undefined }; packageJSONCache.set(path, packageConfig); return packageConfig; } let packageJSON; try { packageJSON = JSONParse(source); } catch { const packageConfig = { exists: true, main: undefined, name: undefined, isValid: false, type: 'none', exports: undefined }; packageJSONCache.set(path, packageConfig); return packageConfig; } let { main, name, type } = packageJSON; const { exports } = packageJSON; if (typeof main !== 'string') main = undefined; if (typeof name !== 'string') name = undefined; // Ignore unknown types for forwards compatibility if (type !== 'module' && type !== 'commonjs') type = 'none'; const packageConfig = { exists: true, main, name, isValid: true, type, exports }; packageJSONCache.set(path, packageConfig); return packageConfig; } function getPackageScopeConfig(resolved, base) { let packageJSONUrl = new URL('./package.json', resolved); while (true) { const packageJSONPath = packageJSONUrl.pathname; if (StringPrototypeEndsWith(packageJSONPath, 'node_modules/package.json')) break; const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), base); if (packageConfig.exists) return packageConfig; const lastPackageJSONUrl = packageJSONUrl; packageJSONUrl = new URL('../package.json', packageJSONUrl); // Terminates at root where ../package.json equals ../../package.json // (can't just check "/package.json" for Windows support). if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break; } const packageConfig = { exists: false, main: undefined, name: undefined, isValid: true, type: 'none', exports: undefined }; packageJSONCache.set(fileURLToPath(packageJSONUrl), packageConfig); return packageConfig; } /* * Legacy CommonJS main resolution: * 1. let M = pkg_url + (json main field) * 2. TRY(M, M.js, M.json, M.node) * 3. TRY(M/index.js, M/index.json, M/index.node) * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) * 5. NOT_FOUND */ function fileExists(url) { return tryStatSync(fileURLToPath(url)).isFile(); } function legacyMainResolve(packageJSONUrl, packageConfig) { let guess; if (packageConfig.main !== undefined) { // Note: fs check redundances will be handled by Descriptor cache here. if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl))) { return guess; } // Fallthrough. } if (fileExists(guess = new URL('./index.js', packageJSONUrl))) { return guess; } // So fs. if (fileExists(guess = new URL('./index.json', packageJSONUrl))) { return guess; } if (fileExists(guess = new URL('./index.node', packageJSONUrl))) { return guess; } // Not found. return undefined; } function resolveExtensionsWithTryExactName(search) { if (fileExists(search)) return search; return resolveExtensions(search); } const extensions = ['.js', '.json', '.node', '.mjs']; function resolveExtensions(search) { for (let i = 0; i < extensions.length; i++) { const extension = extensions[i]; const guess = new URL(`${search.pathname}${extension}`, search); if (fileExists(guess)) return guess; } return undefined; } function resolveIndex(search) { return resolveExtensions(new URL('index', search)); } function finalizeResolution(resolved, base) { if (getOptionValue('--experimental-specifier-resolution') === 'node') { let file = resolveExtensionsWithTryExactName(resolved); if (file !== undefined) return file; if (!StringPrototypeEndsWith(resolved.pathname, '/')) { file = resolveIndex(new URL(`${resolved.pathname}/`, base)); } else { file = resolveIndex(resolved); } if (file !== undefined) return file; throw new ERR_MODULE_NOT_FOUND( resolved.pathname, fileURLToPath(base), 'module'); } if (StringPrototypeEndsWith(resolved.pathname, '/')) return resolved; const path = fileURLToPath(resolved); if (!tryStatSync(path).isFile()) { throw new ERR_MODULE_NOT_FOUND( path || resolved.pathname, fileURLToPath(base), 'module'); } return resolved; } function throwExportsNotFound(subpath, packageJSONUrl, base) { throw new ERR_PACKAGE_PATH_NOT_EXPORTED( fileURLToPath(packageJSONUrl), subpath, fileURLToPath(base)); } function throwSubpathInvalid(subpath, packageJSONUrl, base) { throw new ERR_INVALID_MODULE_SPECIFIER( fileURLToPath(packageJSONUrl), subpath, fileURLToPath(base)); } function throwExportsInvalid( subpath, target, packageJSONUrl, base) { if (typeof target === 'object' && target !== null) { target = JSONStringify(target, null, ''); } else if (ArrayIsArray(target)) { target = `[${target}]`; } else { target = `${target}`; } throw new ERR_INVALID_PACKAGE_TARGET( fileURLToPath(packageJSONUrl), null, subpath, target, fileURLToPath(base)); } function resolveExportsTargetString( target, subpath, match, packageJSONUrl, base) { if (target[0] !== '.' || target[1] !== '/' || (subpath !== '' && target[target.length - 1] !== '/')) { throwExportsInvalid(match, target, packageJSONUrl, base); } const resolved = new URL(target, packageJSONUrl); const resolvedPath = resolved.pathname; const packagePath = new URL('.', packageJSONUrl).pathname; if (!StringPrototypeStartsWith(resolvedPath, packagePath) || StringPrototypeIncludes( resolvedPath, '/node_modules/', packagePath.length - 1)) { throwExportsInvalid(match, target, packageJSONUrl, base); } if (subpath === '') return resolved; const subpathResolved = new URL(subpath, resolved); const subpathResolvedPath = subpathResolved.pathname; if (!StringPrototypeStartsWith(subpathResolvedPath, resolvedPath) || StringPrototypeIncludes(subpathResolvedPath, '/node_modules/', packagePath.length - 1)) { throwSubpathInvalid(match + subpath, packageJSONUrl, base); } return subpathResolved; } function isArrayIndex(key /* string */) { /* -> boolean */ const keyNum = +key; if (`${keyNum}` !== key) return false; return keyNum >= 0 && keyNum < 0xFFFF_FFFF; } function resolveExportsTarget( packageJSONUrl, target, subpath, packageSubpath, base) { if (typeof target === 'string') { const resolved = resolveExportsTargetString( target, subpath, packageSubpath, packageJSONUrl, base); return finalizeResolution(resolved, base); } else if (ArrayIsArray(target)) { if (target.length === 0) throwExportsInvalid(packageSubpath, target, packageJSONUrl, base); let lastException; for (let i = 0; i < target.length; i++) { const targetItem = target[i]; let resolved; try { resolved = resolveExportsTarget( packageJSONUrl, targetItem, subpath, packageSubpath, base); } catch (e) { lastException = e; if (e.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED' || e.code === 'ERR_INVALID_PACKAGE_TARGET') { continue; } throw e; } return finalizeResolution(resolved, base); } throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectGetOwnPropertyNames(target); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (isArrayIndex(key)) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), '"exports" cannot contain numeric property keys'); } } for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key === 'node' || key === 'import' || key === 'default') { const conditionalTarget = target[key]; try { return resolveExportsTarget( packageJSONUrl, conditionalTarget, subpath, packageSubpath, base); } catch (e) { if (e.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') continue; throw e; } } } throwExportsNotFound(packageSubpath, packageJSONUrl, base); } throwExportsInvalid(packageSubpath, target, packageJSONUrl, base); } function isConditionalExportsMainSugar(exports, packageJSONUrl, base) { if (typeof exports === 'string' || ArrayIsArray(exports)) return true; if (typeof exports !== 'object' || exports === null) return false; const keys = ObjectGetOwnPropertyNames(exports); let isConditionalSugar = false; let i = 0; for (let j = 0; j < keys.length; j++) { const key = keys[j]; const curIsConditionalSugar = key === '' || key[0] !== '.'; if (i++ === 0) { isConditionalSugar = curIsConditionalSugar; } else if (isConditionalSugar !== curIsConditionalSugar) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); } } return isConditionalSugar; } function packageMainResolve(packageJSONUrl, packageConfig, base) { if (packageConfig.exists) { const exports = packageConfig.exports; if (exports !== undefined) { if (isConditionalExportsMainSugar(exports, packageJSONUrl, base)) { return resolveExportsTarget(packageJSONUrl, exports, '', '', base); } else if (typeof exports === 'object' && exports !== null) { const target = exports['.']; if (target !== undefined) return resolveExportsTarget(packageJSONUrl, target, '', '', base); } throw new ERR_PACKAGE_PATH_NOT_EXPORTED(packageJSONUrl, '.'); } if (packageConfig.main !== undefined) { const resolved = new URL(packageConfig.main, packageJSONUrl); const path = fileURLToPath(resolved); if (tryStatSync(path).isFile()) return resolved; } if (getOptionValue('--experimental-specifier-resolution') === 'node') { if (packageConfig.main !== undefined) { return finalizeResolution( new URL(packageConfig.main, packageJSONUrl), base); } else { return finalizeResolution( new URL('index', packageJSONUrl), base); } } if (packageConfig.type !== 'module') { return legacyMainResolve(packageJSONUrl, packageConfig); } } throw new ERR_MODULE_NOT_FOUND( fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base) /* -> URL */ { const exports = packageConfig.exports; if (exports === undefined || isConditionalExportsMainSugar(exports, packageJSONUrl, base)) { throwExportsNotFound(packageSubpath, packageJSONUrl, base); } if (ObjectPrototypeHasOwnProperty(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolveExportsTarget( packageJSONUrl, target, '', packageSubpath, base); return finalizeResolution(resolved, base); } let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(exports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] !== '/') continue; if (StringPrototypeStartsWith(packageSubpath, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = exports[bestMatch]; const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length); const resolved = resolveExportsTarget( packageJSONUrl, target, subpath, packageSubpath, base); return finalizeResolution(resolved, base); } throwExportsNotFound(packageSubpath, packageJSONUrl, base); } function getPackageType(url) { const packageConfig = getPackageScopeConfig(url, url); return packageConfig.type; } function packageResolve(specifier /* string */, base /* URL */) { /* -> URL */ let separatorIndex = StringPrototypeIndexOf(specifier, '/'); let validPackageName = true; let isScoped = false; if (specifier[0] === '@') { isScoped = true; if (separatorIndex === -1 || specifier.length === 0) { validPackageName = false; } else { separatorIndex = StringPrototypeIndexOf( specifier, '/', separatorIndex + 1); } } const packageName = separatorIndex === -1 ? specifier : StringPrototypeSlice(specifier, 0, separatorIndex); // Package name cannot have leading . and cannot have percent-encoding or // separators. for (let i = 0; i < packageName.length; i++) { if (packageName[i] === '%' || packageName[i] === '\\') { validPackageName = false; break; } } if (!validPackageName) { throw new ERR_INVALID_MODULE_SPECIFIER( specifier, undefined, fileURLToPath(base)); } const packageSubpath = separatorIndex === -1 ? '' : '.' + StringPrototypeSlice(specifier, separatorIndex); // ResolveSelf const packageConfig = getPackageScopeConfig(base, base); if (packageConfig.exists) { // TODO(jkrems): Find a way to forward the pair/iterator already generated // while executing GetPackageScopeConfig let packageJSONUrl; for (const [ filename, packageConfigCandidate ] of packageJSONCache) { if (packageConfig === packageConfigCandidate) { packageJSONUrl = pathToFileURL(filename); break; } } if (packageJSONUrl !== undefined && packageConfig.name === packageName && packageConfig.exports !== undefined) { if (packageSubpath === './') { return new URL('./', packageJSONUrl); } else if (packageSubpath === '') { return packageMainResolve(packageJSONUrl, packageConfig, base); } else { return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base); } } } let packageJSONUrl = new URL('./node_modules/' + packageName + '/package.json', base); let packageJSONPath = fileURLToPath(packageJSONUrl); let lastPath; do { const stat = tryStatSync( StringPrototypeSlice(packageJSONPath, 0, packageJSONPath.length - 13)); if (!stat.isDirectory()) { lastPath = packageJSONPath; packageJSONUrl = new URL((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJSONUrl); packageJSONPath = fileURLToPath(packageJSONUrl); continue; } // Package match. const packageConfig = getPackageConfig(packageJSONPath, base); if (packageSubpath === './') { return new URL('./', packageJSONUrl); } else if (packageSubpath === '') { return packageMainResolve(packageJSONUrl, packageConfig, base); } else if (packageConfig.exports !== undefined) { return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base); } else { return finalizeResolution( new URL(packageSubpath, packageJSONUrl), base); } // Cross-platform root check. } while (packageJSONPath.length !== lastPath.length); // eslint can't handle the above code. // eslint-disable-next-line no-unreachable throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base)); } function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { if (specifier === '') return false; if (specifier[0] === '/') return true; if (specifier[0] === '.') { if (specifier.length === 1 || specifier[1] === '/') return true; if (specifier[1] === '.') { if (specifier.length === 2 || specifier[2] === '/') return true; } } return false; } function moduleResolve(specifier /* string */, base /* URL */) { /* -> URL */ // Order swapped from spec for minor perf gain. // Ok since relative URLs cannot parse as URLs. let resolved; if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { resolved = new URL(specifier, base); } else { try { resolved = new URL(specifier); } catch { return packageResolve(specifier, base); } } return finalizeResolution(resolved, base); } function defaultResolve(specifier, { parentURL } = {}, defaultResolveUnused) { let parsed; try { parsed = new URL(specifier); if (parsed.protocol === 'data:') { return { url: specifier }; } } catch {} if (parsed && parsed.protocol === 'nodejs:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(); if (NativeModule.canBeRequiredByUsers(specifier)) { return { url: 'nodejs:' + specifier }; } if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { // This is gonna blow up, we want the error new URL(specifier, parentURL); } const isMain = parentURL === undefined; if (isMain) { parentURL = pathToFileURL(`${process.cwd()}/`).href; // This is the initial entry point to the program, and --input-type has // been passed as an option; but --input-type can only be used with // --eval, --print or STDIN string input. It is not allowed with file // input, to avoid user confusion over how expansive the effect of the // flag should be (i.e. entry point only, package scope surrounding the // entry point, etc.). if (typeFlag) throw new ERR_INPUT_TYPE_NOT_ALLOWED(); } let url = moduleResolve(specifier, new URL(parentURL)); if (isMain ? !preserveSymlinksMain : !preserveSymlinks) { const urlPath = fileURLToPath(url); const real = realpathSync(urlPath, { [internalFS.realpathCacheKey]: realpathCache }); const old = url; url = pathToFileURL(real + (urlPath.endsWith(sep) ? '/' : '')); url.search = old.search; url.hash = old.hash; } return { url: `${url}` }; } module.exports = { defaultResolve, getPackageType }; ts-node-10.9.2/raw/node-internal-modules-esm-resolve-v15.3.0-stripped.js000066400000000000000000000725571453460306300255330ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/esm/resolve.js 'use strict'; const { ArrayIsArray, ArrayPrototypeJoin, ArrayPrototypeShift, JSONParse, JSONStringify, ObjectFreeze, ObjectGetOwnPropertyNames, ObjectPrototypeHasOwnProperty, RegExpPrototypeTest, SafeMap, SafeSet, StringPrototypeEndsWith, StringPrototypeIndexOf, StringPrototypeLastIndexOf, StringPrototypeReplace, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, StringPrototypeSubstr, } = primordials; const internalFS = require('internal/fs/utils'); const { NativeModule } = require('internal/bootstrap/loaders'); const { realpathSync, statSync, Stats, } = require('fs'); const { getOptionValue } = require('internal/options'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? require('internal/process/policy') : null; const { sep, relative } = require('path'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const typeFlag = getOptionValue('--input-type'); const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); const { ERR_INPUT_TYPE_NOT_ALLOWED, ERR_INVALID_ARG_VALUE, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MANIFEST_DEPENDENCY_MISSING, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_ESM_URL_SCHEME, } = require('internal/errors').codes; const { Module: CJSModule } = require('internal/modules/cjs/loader'); const packageJsonReader = require('internal/modules/package_json_reader'); const userConditions = getOptionValue('--conditions'); const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import', ...userConditions]); const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS); const pendingDeprecation = getOptionValue('--pending-deprecation'); const emittedPackageWarnings = new SafeSet(); function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { const pjsonPath = fileURLToPath(pjsonUrl); if (!pendingDeprecation) { const nodeModulesIndex = StringPrototypeLastIndexOf(pjsonPath, '/node_modules/'); if (nodeModulesIndex !== -1) { const afterNodeModulesPath = StringPrototypeSlice(pjsonPath, nodeModulesIndex + 14, -13); try { const { packageSubpath } = parsePackageName(afterNodeModulesPath); if (packageSubpath === '.') return; } catch {} } } if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; emittedPackageWarnings.add(pjsonPath + '|' + match); process.emitWarning( `Use of deprecated folder mapping "${match}" in the ${isExports ? '"exports"' : '"imports"'} field module resolution of the package at ${ pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.\n` + `Update this package.json to use a subpath pattern like "${match}*".`, 'DeprecationWarning', 'DEP0148' ); } function getConditionsSet(conditions) { if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) { if (!ArrayIsArray(conditions)) { throw new ERR_INVALID_ARG_VALUE('conditions', conditions, 'expected an array'); } return new SafeSet(conditions); } return DEFAULT_CONDITIONS_SET; } const realpathCache = new SafeMap(); const packageJSONCache = new SafeMap(); /* string -> PackageConfig */ function tryStatSync(path) { try { return statSync(path); } catch { return new Stats(); } } function getPackageConfig(path, specifier, base) { const existing = packageJSONCache.get(path); if (existing !== undefined) { return existing; } const source = packageJsonReader.read(path).string; if (source === undefined) { const packageConfig = { pjsonPath: path, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(path, packageConfig); return packageConfig; } let packageJSON; try { packageJSON = JSONParse(source); } catch (error) { throw new ERR_INVALID_PACKAGE_CONFIG( path, (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), error.message ); } let { imports, main, name, type } = packageJSON; const { exports } = packageJSON; if (typeof imports !== 'object' || imports === null) imports = undefined; if (typeof main !== 'string') main = undefined; if (typeof name !== 'string') name = undefined; // Ignore unknown types for forwards compatibility if (type !== 'module' && type !== 'commonjs') type = 'none'; const packageConfig = { pjsonPath: path, exists: true, main, name, type, exports, imports, }; packageJSONCache.set(path, packageConfig); return packageConfig; } function getPackageScopeConfig(resolved) { let packageJSONUrl = new URL('./package.json', resolved); while (true) { const packageJSONPath = packageJSONUrl.pathname; if (StringPrototypeEndsWith(packageJSONPath, 'node_modules/package.json')) break; const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), resolved); if (packageConfig.exists) return packageConfig; const lastPackageJSONUrl = packageJSONUrl; packageJSONUrl = new URL('../package.json', packageJSONUrl); // Terminates at root where ../package.json equals ../../package.json // (can't just check "/package.json" for Windows support). if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break; } const packageJSONPath = fileURLToPath(packageJSONUrl); const packageConfig = { pjsonPath: packageJSONPath, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(packageJSONPath, packageConfig); return packageConfig; } /* * Legacy CommonJS main resolution: * 1. let M = pkg_url + (json main field) * 2. TRY(M, M.js, M.json, M.node) * 3. TRY(M/index.js, M/index.json, M/index.node) * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) * 5. NOT_FOUND */ function fileExists(url) { return tryStatSync(fileURLToPath(url)).isFile(); } function legacyMainResolve(packageJSONUrl, packageConfig, base) { let guess; if (packageConfig.main !== undefined) { // Note: fs check redundances will be handled by Descriptor cache here. if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl))) { return guess; } // Fallthrough. } if (fileExists(guess = new URL('./index.js', packageJSONUrl))) { return guess; } // So fs. if (fileExists(guess = new URL('./index.json', packageJSONUrl))) { return guess; } if (fileExists(guess = new URL('./index.node', packageJSONUrl))) { return guess; } // Not found. throw new ERR_MODULE_NOT_FOUND( fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function resolveExtensionsWithTryExactName(search) { if (fileExists(search)) return search; return resolveExtensions(search); } const extensions = ['.js', '.json', '.node', '.mjs']; function resolveExtensions(search) { for (let i = 0; i < extensions.length; i++) { const extension = extensions[i]; const guess = new URL(`${search.pathname}${extension}`, search); if (fileExists(guess)) return guess; } return undefined; } function resolveIndex(search) { return resolveExtensions(new URL('index', search)); } const encodedSepRegEx = /%2F|%2C/i; function finalizeResolution(resolved, base) { if (RegExpPrototypeTest(encodedSepRegEx, resolved.pathname)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved.pathname, 'must not include encoded "/" or "\\" characters', fileURLToPath(base)); const path = fileURLToPath(resolved); if (getOptionValue('--experimental-specifier-resolution') === 'node') { let file = resolveExtensionsWithTryExactName(resolved); if (file !== undefined) return file; if (!StringPrototypeEndsWith(path, '/')) { file = resolveIndex(new URL(`${resolved}/`)); if (file !== undefined) return file; } else { return resolveIndex(resolved) || resolved; } throw new ERR_MODULE_NOT_FOUND( resolved.pathname, fileURLToPath(base), 'module'); } const stats = tryStatSync(StringPrototypeEndsWith(path, '/') ? StringPrototypeSlice(path, -1) : path); if (stats.isDirectory()) { const err = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base)); err.url = String(resolved); throw err; } else if (!stats.isFile()) { throw new ERR_MODULE_NOT_FOUND( path || resolved.pathname, base && fileURLToPath(base), 'module'); } return resolved; } function throwImportNotDefined(specifier, packageJSONUrl, base) { throw new ERR_PACKAGE_IMPORT_NOT_DEFINED( specifier, packageJSONUrl && fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function throwExportsNotFound(subpath, packageJSONUrl, base) { throw new ERR_PACKAGE_PATH_NOT_EXPORTED( fileURLToPath(new URL('.', packageJSONUrl)), subpath, base && fileURLToPath(base)); } function throwInvalidSubpath(subpath, packageJSONUrl, internal, base) { const reason = `request is not a valid subpath for the "${internal ? 'imports' : 'exports'}" resolution of ${fileURLToPath(packageJSONUrl)}`; throw new ERR_INVALID_MODULE_SPECIFIER(subpath, reason, base && fileURLToPath(base)); } function throwInvalidPackageTarget( subpath, target, packageJSONUrl, internal, base) { if (typeof target === 'object' && target !== null) { target = JSONStringify(target, null, ''); } else { target = `${target}`; } throw new ERR_INVALID_PACKAGE_TARGET( fileURLToPath(new URL('.', packageJSONUrl)), subpath, target, internal, base && fileURLToPath(base)); } const invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; const patternRegEx = /\*/g; function resolvePackageTargetString( target, subpath, match, packageJSONUrl, base, pattern, internal, conditions) { if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (!StringPrototypeStartsWith(target, './')) { if (internal && !StringPrototypeStartsWith(target, '../') && !StringPrototypeStartsWith(target, '/')) { let isURL = false; try { new URL(target); isURL = true; } catch {} if (!isURL) { const exportTarget = pattern ? StringPrototypeReplace(target, patternRegEx, subpath) : target + subpath; return packageResolve(exportTarget, packageJSONUrl, conditions); } } throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); } if (RegExpPrototypeTest(invalidSegmentRegEx, StringPrototypeSlice(target, 2))) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); const resolved = new URL(target, packageJSONUrl); const resolvedPath = resolved.pathname; const packagePath = new URL('.', packageJSONUrl).pathname; if (!StringPrototypeStartsWith(resolvedPath, packagePath)) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (subpath === '') return resolved; if (RegExpPrototypeTest(invalidSegmentRegEx, subpath)) throwInvalidSubpath(match + subpath, packageJSONUrl, internal, base); if (pattern) return new URL(StringPrototypeReplace(resolved.href, patternRegEx, subpath)); return new URL(subpath, resolved); } /** * @param {string} key * @returns {boolean} */ function isArrayIndex(key) { const keyNum = +key; if (`${keyNum}` !== key) return false; return keyNum >= 0 && keyNum < 0xFFFF_FFFF; } function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, base, pattern, internal, conditions) { if (typeof target === 'string') { return resolvePackageTargetString( target, subpath, packageSubpath, packageJSONUrl, base, pattern, internal, conditions); } else if (ArrayIsArray(target)) { if (target.length === 0) return null; let lastException; for (let i = 0; i < target.length; i++) { const targetItem = target[i]; let resolved; try { resolved = resolvePackageTarget( packageJSONUrl, targetItem, subpath, packageSubpath, base, pattern, internal, conditions); } catch (e) { lastException = e; if (e.code === 'ERR_INVALID_PACKAGE_TARGET') continue; throw e; } if (resolved === undefined) continue; if (resolved === null) { lastException = null; continue; } return resolved; } if (lastException === undefined || lastException === null) return lastException; throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectGetOwnPropertyNames(target); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (isArrayIndex(key)) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain numeric property keys.'); } } for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key === 'default' || conditions.has(key)) { const conditionalTarget = target[key]; const resolved = resolvePackageTarget( packageJSONUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, conditions); if (resolved === undefined) continue; return resolved; } } return undefined; } else if (target === null) { return null; } throwInvalidPackageTarget(packageSubpath, target, packageJSONUrl, internal, base); } function isConditionalExportsMainSugar(exports, packageJSONUrl, base) { if (typeof exports === 'string' || ArrayIsArray(exports)) return true; if (typeof exports !== 'object' || exports === null) return false; const keys = ObjectGetOwnPropertyNames(exports); let isConditionalSugar = false; let i = 0; for (let j = 0; j < keys.length; j++) { const key = keys[j]; const curIsConditionalSugar = key === '' || key[0] !== '.'; if (i++ === 0) { isConditionalSugar = curIsConditionalSugar; } else if (isConditionalSugar !== curIsConditionalSugar) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); } } return isConditionalSugar; } /** * @param {URL} packageJSONUrl * @param {string} packageSubpath * @param {object} packageConfig * @param {string} base * @param {Set} conditions * @returns {URL} */ function packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions) { let exports = packageConfig.exports; if (isConditionalExportsMainSugar(exports, packageJSONUrl, base)) exports = { '.': exports }; if (ObjectPrototypeHasOwnProperty(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolvePackageTarget( packageJSONUrl, target, '', packageSubpath, base, false, false, conditions ); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); return { resolved, exact: true }; } let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(exports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(packageSubpath, StringPrototypeSlice(key, 0, -1)) && packageSubpath.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(packageSubpath, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = exports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget(packageJSONUrl, target, subpath, bestMatch, base, pattern, false, conditions); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, true, base); return { resolved, exact: pattern }; } throwExportsNotFound(packageSubpath, packageJSONUrl, base); } function packageImportsResolve(name, base, conditions) { if (name === '#' || StringPrototypeStartsWith(name, '#/')) { const reason = 'is not a valid internal imports specifier name'; throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)); } let packageJSONUrl; const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); const imports = packageConfig.imports; if (imports) { if (ObjectPrototypeHasOwnProperty(imports, name)) { const resolved = resolvePackageTarget( packageJSONUrl, imports[name], '', name, base, false, true, conditions ); if (resolved !== null) return { resolved, exact: true }; } else { let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(imports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(name, StringPrototypeSlice(key, 0, -1)) && name.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(name, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = imports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(name, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget( packageJSONUrl, target, subpath, bestMatch, base, pattern, true, conditions); if (resolved !== null) { if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, false, base); return { resolved, exact: pattern }; } } } } } throwImportNotDefined(name, packageJSONUrl, base); } function getPackageType(url) { const packageConfig = getPackageScopeConfig(url); return packageConfig.type; } function parsePackageName(specifier, base) { let separatorIndex = StringPrototypeIndexOf(specifier, '/'); let validPackageName = true; let isScoped = false; if (specifier[0] === '@') { isScoped = true; if (separatorIndex === -1 || specifier.length === 0) { validPackageName = false; } else { separatorIndex = StringPrototypeIndexOf( specifier, '/', separatorIndex + 1); } } const packageName = separatorIndex === -1 ? specifier : StringPrototypeSlice(specifier, 0, separatorIndex); // Package name cannot have leading . and cannot have percent-encoding or // separators. for (let i = 0; i < packageName.length; i++) { if (packageName[i] === '%' || packageName[i] === '\\') { validPackageName = false; break; } } if (!validPackageName) { throw new ERR_INVALID_MODULE_SPECIFIER( specifier, 'is not a valid package name', fileURLToPath(base)); } const packageSubpath = '.' + (separatorIndex === -1 ? '' : StringPrototypeSlice(specifier, separatorIndex)); return { packageName, packageSubpath, isScoped }; } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function packageResolve(specifier, base, conditions) { const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); // ResolveSelf const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { const packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); if (packageConfig.name === packageName && packageConfig.exports !== undefined && packageConfig.exports !== null) { return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; } } let packageJSONUrl = new URL('./node_modules/' + packageName + '/package.json', base); let packageJSONPath = fileURLToPath(packageJSONUrl); let lastPath; do { const stat = tryStatSync(StringPrototypeSlice(packageJSONPath, 0, packageJSONPath.length - 13)); if (!stat.isDirectory()) { lastPath = packageJSONPath; packageJSONUrl = new URL((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJSONUrl); packageJSONPath = fileURLToPath(packageJSONUrl); continue; } // Package match. const packageConfig = getPackageConfig(packageJSONPath, specifier, base); if (packageConfig.exports !== undefined && packageConfig.exports !== null) return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; if (packageSubpath === '.') return legacyMainResolve(packageJSONUrl, packageConfig, base); return new URL(packageSubpath, packageJSONUrl); // Cross-platform root check. } while (packageJSONPath.length !== lastPath.length); // eslint can't handle the above code. // eslint-disable-next-line no-unreachable throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base)); } function isBareSpecifier(specifier) { return specifier[0] && specifier[0] !== '/' && specifier[0] !== '.'; } function isRelativeSpecifier(specifier) { if (specifier[0] === '.') { if (specifier.length === 1 || specifier[1] === '/') return true; if (specifier[1] === '.') { if (specifier.length === 2 || specifier[2] === '/') return true; } } return false; } function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { if (specifier === '') return false; if (specifier[0] === '/') return true; return isRelativeSpecifier(specifier); } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function moduleResolve(specifier, base, conditions) { // Order swapped from spec for minor perf gain. // Ok since relative URLs cannot parse as URLs. let resolved; if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { resolved = new URL(specifier, base); } else if (specifier[0] === '#') { ({ resolved } = packageImportsResolve(specifier, base, conditions)); } else { try { resolved = new URL(specifier); } catch { resolved = packageResolve(specifier, base, conditions); } } return finalizeResolution(resolved, base); } /** * Try to resolve an import as a CommonJS module * @param {string} specifier * @param {string} parentURL * @returns {boolean|string} */ function resolveAsCommonJS(specifier, parentURL) { try { const parent = fileURLToPath(parentURL); const tmpModule = new CJSModule(parent, null); tmpModule.paths = CJSModule._nodeModulePaths(parent); let found = CJSModule._resolveFilename(specifier, tmpModule, false); // If it is a relative specifier return the relative path // to the parent if (isRelativeSpecifier(specifier)) { found = relative(parent, found); // Add '.separator if the path does not start with '..separator' // This should be a safe assumption because when loading // esm modules there should be always a file specified so // there should not be a specifier like '..' or '.' if (!StringPrototypeStartsWith(found, `..${sep}`)) { found = `.${sep}${found}`; } } else if (isBareSpecifier(specifier)) { // If it is a bare specifier return the relative path within the // module const pkg = StringPrototypeSplit(specifier, '/')[0]; const index = StringPrototypeIndexOf(found, pkg); if (index !== -1) { found = StringPrototypeSlice(found, index); } } // Normalize the path separator to give a valid suggestion // on Windows if (process.platform === 'win32') { found = StringPrototypeReplace(found, new RegExp(`\\${sep}`, 'g'), '/'); } return found; } catch { return false; } } function defaultResolve(specifier, context = {}, defaultResolveUnused) { let { parentURL, conditions } = context; if (parentURL && policy?.manifest) { const redirects = policy.manifest.getDependencyMapper(parentURL); if (redirects) { const { resolve, reaction } = redirects; const destination = resolve(specifier, new SafeSet(conditions)); let missing = true; if (destination === true) { missing = false; } else if (destination) { const href = destination.href; return { url: href }; } if (missing) { reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( parentURL, specifier, ArrayPrototypeJoin([...conditions], ', ')) ); } } } let parsed; try { parsed = new URL(specifier); if (parsed.protocol === 'data:') { return { url: specifier }; } } catch {} if (parsed && parsed.protocol === 'node:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); if (NativeModule.canBeRequiredByUsers(specifier)) { return { url: 'node:' + specifier }; } if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { // This is gonna blow up, we want the error new URL(specifier, parentURL); } const isMain = parentURL === undefined; if (isMain) { parentURL = pathToFileURL(`${process.cwd()}/`).href; // This is the initial entry point to the program, and --input-type has // been passed as an option; but --input-type can only be used with // --eval, --print or STDIN string input. It is not allowed with file // input, to avoid user confusion over how expansive the effect of the // flag should be (i.e. entry point only, package scope surrounding the // entry point, etc.). if (typeFlag) throw new ERR_INPUT_TYPE_NOT_ALLOWED(); } conditions = getConditionsSet(conditions); let url; try { url = moduleResolve(specifier, parentURL, conditions); } catch (error) { // Try to give the user a hint of what would have been the // resolved CommonJS module if (error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ERR_UNSUPPORTED_DIR_IMPORT') { if (StringPrototypeStartsWith(specifier, 'file://')) { specifier = fileURLToPath(specifier); } const found = resolveAsCommonJS(specifier, parentURL); if (found) { // Modify the stack and message string to include the hint const lines = StringPrototypeSplit(error.stack, '\n'); const hint = `Did you mean to import ${found}?`; error.stack = ArrayPrototypeShift(lines) + '\n' + hint + '\n' + ArrayPrototypeJoin(lines, '\n'); error.message += `\n${hint}`; } } throw error; } if (isMain ? !preserveSymlinksMain : !preserveSymlinks) { const urlPath = fileURLToPath(url); const real = realpathSync(urlPath, { [internalFS.realpathCacheKey]: realpathCache }); const old = url; url = pathToFileURL( real + (StringPrototypeEndsWith(urlPath, sep) ? '/' : '')); url.search = old.search; url.hash = old.hash; } return { url: `${url}` }; } module.exports = { DEFAULT_CONDITIONS, defaultResolve, encodedSepRegEx, getPackageType, packageExportsResolve, packageImportsResolve }; ts-node-10.9.2/raw/node-internal-modules-esm-resolve-v15.3.0.js000066400000000000000000000726031453460306300236730ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/esm/resolve.js 'use strict'; const { ArrayIsArray, ArrayPrototypeJoin, ArrayPrototypeShift, JSONParse, JSONStringify, ObjectFreeze, ObjectGetOwnPropertyNames, ObjectPrototypeHasOwnProperty, RegExp, RegExpPrototypeTest, SafeMap, SafeSet, String, StringPrototypeEndsWith, StringPrototypeIndexOf, StringPrototypeLastIndexOf, StringPrototypeReplace, StringPrototypeSlice, StringPrototypeSplit, StringPrototypeStartsWith, StringPrototypeSubstr, } = primordials; const internalFS = require('internal/fs/utils'); const { NativeModule } = require('internal/bootstrap/loaders'); const { realpathSync, statSync, Stats, } = require('fs'); const { getOptionValue } = require('internal/options'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? require('internal/process/policy') : null; const { sep, relative } = require('path'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const typeFlag = getOptionValue('--input-type'); const { URL, pathToFileURL, fileURLToPath } = require('internal/url'); const { ERR_INPUT_TYPE_NOT_ALLOWED, ERR_INVALID_ARG_VALUE, ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MANIFEST_DEPENDENCY_MISSING, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_ESM_URL_SCHEME, } = require('internal/errors').codes; const { Module: CJSModule } = require('internal/modules/cjs/loader'); const packageJsonReader = require('internal/modules/package_json_reader'); const userConditions = getOptionValue('--conditions'); const DEFAULT_CONDITIONS = ObjectFreeze(['node', 'import', ...userConditions]); const DEFAULT_CONDITIONS_SET = new SafeSet(DEFAULT_CONDITIONS); const pendingDeprecation = getOptionValue('--pending-deprecation'); const emittedPackageWarnings = new SafeSet(); function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { const pjsonPath = fileURLToPath(pjsonUrl); if (!pendingDeprecation) { const nodeModulesIndex = StringPrototypeLastIndexOf(pjsonPath, '/node_modules/'); if (nodeModulesIndex !== -1) { const afterNodeModulesPath = StringPrototypeSlice(pjsonPath, nodeModulesIndex + 14, -13); try { const { packageSubpath } = parsePackageName(afterNodeModulesPath); if (packageSubpath === '.') return; } catch {} } } if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return; emittedPackageWarnings.add(pjsonPath + '|' + match); process.emitWarning( `Use of deprecated folder mapping "${match}" in the ${isExports ? '"exports"' : '"imports"'} field module resolution of the package at ${ pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.\n` + `Update this package.json to use a subpath pattern like "${match}*".`, 'DeprecationWarning', 'DEP0148' ); } function getConditionsSet(conditions) { if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) { if (!ArrayIsArray(conditions)) { throw new ERR_INVALID_ARG_VALUE('conditions', conditions, 'expected an array'); } return new SafeSet(conditions); } return DEFAULT_CONDITIONS_SET; } const realpathCache = new SafeMap(); const packageJSONCache = new SafeMap(); /* string -> PackageConfig */ function tryStatSync(path) { try { return statSync(path); } catch { return new Stats(); } } function getPackageConfig(path, specifier, base) { const existing = packageJSONCache.get(path); if (existing !== undefined) { return existing; } const source = packageJsonReader.read(path).string; if (source === undefined) { const packageConfig = { pjsonPath: path, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(path, packageConfig); return packageConfig; } let packageJSON; try { packageJSON = JSONParse(source); } catch (error) { throw new ERR_INVALID_PACKAGE_CONFIG( path, (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), error.message ); } let { imports, main, name, type } = packageJSON; const { exports } = packageJSON; if (typeof imports !== 'object' || imports === null) imports = undefined; if (typeof main !== 'string') main = undefined; if (typeof name !== 'string') name = undefined; // Ignore unknown types for forwards compatibility if (type !== 'module' && type !== 'commonjs') type = 'none'; const packageConfig = { pjsonPath: path, exists: true, main, name, type, exports, imports, }; packageJSONCache.set(path, packageConfig); return packageConfig; } function getPackageScopeConfig(resolved) { let packageJSONUrl = new URL('./package.json', resolved); while (true) { const packageJSONPath = packageJSONUrl.pathname; if (StringPrototypeEndsWith(packageJSONPath, 'node_modules/package.json')) break; const packageConfig = getPackageConfig(fileURLToPath(packageJSONUrl), resolved); if (packageConfig.exists) return packageConfig; const lastPackageJSONUrl = packageJSONUrl; packageJSONUrl = new URL('../package.json', packageJSONUrl); // Terminates at root where ../package.json equals ../../package.json // (can't just check "/package.json" for Windows support). if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break; } const packageJSONPath = fileURLToPath(packageJSONUrl); const packageConfig = { pjsonPath: packageJSONPath, exists: false, main: undefined, name: undefined, type: 'none', exports: undefined, imports: undefined, }; packageJSONCache.set(packageJSONPath, packageConfig); return packageConfig; } /* * Legacy CommonJS main resolution: * 1. let M = pkg_url + (json main field) * 2. TRY(M, M.js, M.json, M.node) * 3. TRY(M/index.js, M/index.json, M/index.node) * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) * 5. NOT_FOUND */ function fileExists(url) { return tryStatSync(fileURLToPath(url)).isFile(); } function legacyMainResolve(packageJSONUrl, packageConfig, base) { let guess; if (packageConfig.main !== undefined) { // Note: fs check redundances will be handled by Descriptor cache here. if (fileExists(guess = new URL(`./${packageConfig.main}`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl))) { return guess; } if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl))) { return guess; } // Fallthrough. } if (fileExists(guess = new URL('./index.js', packageJSONUrl))) { return guess; } // So fs. if (fileExists(guess = new URL('./index.json', packageJSONUrl))) { return guess; } if (fileExists(guess = new URL('./index.node', packageJSONUrl))) { return guess; } // Not found. throw new ERR_MODULE_NOT_FOUND( fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function resolveExtensionsWithTryExactName(search) { if (fileExists(search)) return search; return resolveExtensions(search); } const extensions = ['.js', '.json', '.node', '.mjs']; function resolveExtensions(search) { for (let i = 0; i < extensions.length; i++) { const extension = extensions[i]; const guess = new URL(`${search.pathname}${extension}`, search); if (fileExists(guess)) return guess; } return undefined; } function resolveIndex(search) { return resolveExtensions(new URL('index', search)); } const encodedSepRegEx = /%2F|%2C/i; function finalizeResolution(resolved, base) { if (RegExpPrototypeTest(encodedSepRegEx, resolved.pathname)) throw new ERR_INVALID_MODULE_SPECIFIER( resolved.pathname, 'must not include encoded "/" or "\\" characters', fileURLToPath(base)); const path = fileURLToPath(resolved); if (getOptionValue('--experimental-specifier-resolution') === 'node') { let file = resolveExtensionsWithTryExactName(resolved); if (file !== undefined) return file; if (!StringPrototypeEndsWith(path, '/')) { file = resolveIndex(new URL(`${resolved}/`)); if (file !== undefined) return file; } else { return resolveIndex(resolved) || resolved; } throw new ERR_MODULE_NOT_FOUND( resolved.pathname, fileURLToPath(base), 'module'); } const stats = tryStatSync(StringPrototypeEndsWith(path, '/') ? StringPrototypeSlice(path, -1) : path); if (stats.isDirectory()) { const err = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base)); err.url = String(resolved); throw err; } else if (!stats.isFile()) { throw new ERR_MODULE_NOT_FOUND( path || resolved.pathname, base && fileURLToPath(base), 'module'); } return resolved; } function throwImportNotDefined(specifier, packageJSONUrl, base) { throw new ERR_PACKAGE_IMPORT_NOT_DEFINED( specifier, packageJSONUrl && fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base)); } function throwExportsNotFound(subpath, packageJSONUrl, base) { throw new ERR_PACKAGE_PATH_NOT_EXPORTED( fileURLToPath(new URL('.', packageJSONUrl)), subpath, base && fileURLToPath(base)); } function throwInvalidSubpath(subpath, packageJSONUrl, internal, base) { const reason = `request is not a valid subpath for the "${internal ? 'imports' : 'exports'}" resolution of ${fileURLToPath(packageJSONUrl)}`; throw new ERR_INVALID_MODULE_SPECIFIER(subpath, reason, base && fileURLToPath(base)); } function throwInvalidPackageTarget( subpath, target, packageJSONUrl, internal, base) { if (typeof target === 'object' && target !== null) { target = JSONStringify(target, null, ''); } else { target = `${target}`; } throw new ERR_INVALID_PACKAGE_TARGET( fileURLToPath(new URL('.', packageJSONUrl)), subpath, target, internal, base && fileURLToPath(base)); } const invalidSegmentRegEx = /(^|\\|\/)(\.\.?|node_modules)(\\|\/|$)/; const patternRegEx = /\*/g; function resolvePackageTargetString( target, subpath, match, packageJSONUrl, base, pattern, internal, conditions) { if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (!StringPrototypeStartsWith(target, './')) { if (internal && !StringPrototypeStartsWith(target, '../') && !StringPrototypeStartsWith(target, '/')) { let isURL = false; try { new URL(target); isURL = true; } catch {} if (!isURL) { const exportTarget = pattern ? StringPrototypeReplace(target, patternRegEx, subpath) : target + subpath; return packageResolve(exportTarget, packageJSONUrl, conditions); } } throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); } if (RegExpPrototypeTest(invalidSegmentRegEx, StringPrototypeSlice(target, 2))) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); const resolved = new URL(target, packageJSONUrl); const resolvedPath = resolved.pathname; const packagePath = new URL('.', packageJSONUrl).pathname; if (!StringPrototypeStartsWith(resolvedPath, packagePath)) throwInvalidPackageTarget(match, target, packageJSONUrl, internal, base); if (subpath === '') return resolved; if (RegExpPrototypeTest(invalidSegmentRegEx, subpath)) throwInvalidSubpath(match + subpath, packageJSONUrl, internal, base); if (pattern) return new URL(StringPrototypeReplace(resolved.href, patternRegEx, subpath)); return new URL(subpath, resolved); } /** * @param {string} key * @returns {boolean} */ function isArrayIndex(key) { const keyNum = +key; if (`${keyNum}` !== key) return false; return keyNum >= 0 && keyNum < 0xFFFF_FFFF; } function resolvePackageTarget(packageJSONUrl, target, subpath, packageSubpath, base, pattern, internal, conditions) { if (typeof target === 'string') { return resolvePackageTargetString( target, subpath, packageSubpath, packageJSONUrl, base, pattern, internal, conditions); } else if (ArrayIsArray(target)) { if (target.length === 0) return null; let lastException; for (let i = 0; i < target.length; i++) { const targetItem = target[i]; let resolved; try { resolved = resolvePackageTarget( packageJSONUrl, targetItem, subpath, packageSubpath, base, pattern, internal, conditions); } catch (e) { lastException = e; if (e.code === 'ERR_INVALID_PACKAGE_TARGET') continue; throw e; } if (resolved === undefined) continue; if (resolved === null) { lastException = null; continue; } return resolved; } if (lastException === undefined || lastException === null) return lastException; throw lastException; } else if (typeof target === 'object' && target !== null) { const keys = ObjectGetOwnPropertyNames(target); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (isArrayIndex(key)) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain numeric property keys.'); } } for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key === 'default' || conditions.has(key)) { const conditionalTarget = target[key]; const resolved = resolvePackageTarget( packageJSONUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, conditions); if (resolved === undefined) continue; return resolved; } } return undefined; } else if (target === null) { return null; } throwInvalidPackageTarget(packageSubpath, target, packageJSONUrl, internal, base); } function isConditionalExportsMainSugar(exports, packageJSONUrl, base) { if (typeof exports === 'string' || ArrayIsArray(exports)) return true; if (typeof exports !== 'object' || exports === null) return false; const keys = ObjectGetOwnPropertyNames(exports); let isConditionalSugar = false; let i = 0; for (let j = 0; j < keys.length; j++) { const key = keys[j]; const curIsConditionalSugar = key === '' || key[0] !== '.'; if (i++ === 0) { isConditionalSugar = curIsConditionalSugar; } else if (isConditionalSugar !== curIsConditionalSugar) { throw new ERR_INVALID_PACKAGE_CONFIG( fileURLToPath(packageJSONUrl), base, '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); } } return isConditionalSugar; } /** * @param {URL} packageJSONUrl * @param {string} packageSubpath * @param {object} packageConfig * @param {string} base * @param {Set} conditions * @returns {URL} */ function packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions) { let exports = packageConfig.exports; if (isConditionalExportsMainSugar(exports, packageJSONUrl, base)) exports = { '.': exports }; if (ObjectPrototypeHasOwnProperty(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolvePackageTarget( packageJSONUrl, target, '', packageSubpath, base, false, false, conditions ); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); return { resolved, exact: true }; } let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(exports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(packageSubpath, StringPrototypeSlice(key, 0, -1)) && packageSubpath.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(packageSubpath, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = exports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(packageSubpath, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget(packageJSONUrl, target, subpath, bestMatch, base, pattern, false, conditions); if (resolved === null || resolved === undefined) throwExportsNotFound(packageSubpath, packageJSONUrl, base); if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, true, base); return { resolved, exact: pattern }; } throwExportsNotFound(packageSubpath, packageJSONUrl, base); } function packageImportsResolve(name, base, conditions) { if (name === '#' || StringPrototypeStartsWith(name, '#/')) { const reason = 'is not a valid internal imports specifier name'; throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)); } let packageJSONUrl; const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); const imports = packageConfig.imports; if (imports) { if (ObjectPrototypeHasOwnProperty(imports, name)) { const resolved = resolvePackageTarget( packageJSONUrl, imports[name], '', name, base, false, true, conditions ); if (resolved !== null) return { resolved, exact: true }; } else { let bestMatch = ''; const keys = ObjectGetOwnPropertyNames(imports); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key[key.length - 1] === '*' && StringPrototypeStartsWith(name, StringPrototypeSlice(key, 0, -1)) && name.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && StringPrototypeStartsWith(name, key) && key.length > bestMatch.length) { bestMatch = key; } } if (bestMatch) { const target = imports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = StringPrototypeSubstr(name, bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget( packageJSONUrl, target, subpath, bestMatch, base, pattern, true, conditions); if (resolved !== null) { if (!pattern) emitFolderMapDeprecation(bestMatch, packageJSONUrl, false, base); return { resolved, exact: pattern }; } } } } } throwImportNotDefined(name, packageJSONUrl, base); } function getPackageType(url) { const packageConfig = getPackageScopeConfig(url); return packageConfig.type; } function parsePackageName(specifier, base) { let separatorIndex = StringPrototypeIndexOf(specifier, '/'); let validPackageName = true; let isScoped = false; if (specifier[0] === '@') { isScoped = true; if (separatorIndex === -1 || specifier.length === 0) { validPackageName = false; } else { separatorIndex = StringPrototypeIndexOf( specifier, '/', separatorIndex + 1); } } const packageName = separatorIndex === -1 ? specifier : StringPrototypeSlice(specifier, 0, separatorIndex); // Package name cannot have leading . and cannot have percent-encoding or // separators. for (let i = 0; i < packageName.length; i++) { if (packageName[i] === '%' || packageName[i] === '\\') { validPackageName = false; break; } } if (!validPackageName) { throw new ERR_INVALID_MODULE_SPECIFIER( specifier, 'is not a valid package name', fileURLToPath(base)); } const packageSubpath = '.' + (separatorIndex === -1 ? '' : StringPrototypeSlice(specifier, separatorIndex)); return { packageName, packageSubpath, isScoped }; } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function packageResolve(specifier, base, conditions) { const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); // ResolveSelf const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { const packageJSONUrl = pathToFileURL(packageConfig.pjsonPath); if (packageConfig.name === packageName && packageConfig.exports !== undefined && packageConfig.exports !== null) { return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; } } let packageJSONUrl = new URL('./node_modules/' + packageName + '/package.json', base); let packageJSONPath = fileURLToPath(packageJSONUrl); let lastPath; do { const stat = tryStatSync(StringPrototypeSlice(packageJSONPath, 0, packageJSONPath.length - 13)); if (!stat.isDirectory()) { lastPath = packageJSONPath; packageJSONUrl = new URL((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJSONUrl); packageJSONPath = fileURLToPath(packageJSONUrl); continue; } // Package match. const packageConfig = getPackageConfig(packageJSONPath, specifier, base); if (packageConfig.exports !== undefined && packageConfig.exports !== null) return packageExportsResolve( packageJSONUrl, packageSubpath, packageConfig, base, conditions ).resolved; if (packageSubpath === '.') return legacyMainResolve(packageJSONUrl, packageConfig, base); return new URL(packageSubpath, packageJSONUrl); // Cross-platform root check. } while (packageJSONPath.length !== lastPath.length); // eslint can't handle the above code. // eslint-disable-next-line no-unreachable throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base)); } function isBareSpecifier(specifier) { return specifier[0] && specifier[0] !== '/' && specifier[0] !== '.'; } function isRelativeSpecifier(specifier) { if (specifier[0] === '.') { if (specifier.length === 1 || specifier[1] === '/') return true; if (specifier[1] === '.') { if (specifier.length === 2 || specifier[2] === '/') return true; } } return false; } function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { if (specifier === '') return false; if (specifier[0] === '/') return true; return isRelativeSpecifier(specifier); } /** * @param {string} specifier * @param {URL} base * @param {Set} conditions * @returns {URL} */ function moduleResolve(specifier, base, conditions) { // Order swapped from spec for minor perf gain. // Ok since relative URLs cannot parse as URLs. let resolved; if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { resolved = new URL(specifier, base); } else if (specifier[0] === '#') { ({ resolved } = packageImportsResolve(specifier, base, conditions)); } else { try { resolved = new URL(specifier); } catch { resolved = packageResolve(specifier, base, conditions); } } return finalizeResolution(resolved, base); } /** * Try to resolve an import as a CommonJS module * @param {string} specifier * @param {string} parentURL * @returns {boolean|string} */ function resolveAsCommonJS(specifier, parentURL) { try { const parent = fileURLToPath(parentURL); const tmpModule = new CJSModule(parent, null); tmpModule.paths = CJSModule._nodeModulePaths(parent); let found = CJSModule._resolveFilename(specifier, tmpModule, false); // If it is a relative specifier return the relative path // to the parent if (isRelativeSpecifier(specifier)) { found = relative(parent, found); // Add '.separator if the path does not start with '..separator' // This should be a safe assumption because when loading // esm modules there should be always a file specified so // there should not be a specifier like '..' or '.' if (!StringPrototypeStartsWith(found, `..${sep}`)) { found = `.${sep}${found}`; } } else if (isBareSpecifier(specifier)) { // If it is a bare specifier return the relative path within the // module const pkg = StringPrototypeSplit(specifier, '/')[0]; const index = StringPrototypeIndexOf(found, pkg); if (index !== -1) { found = StringPrototypeSlice(found, index); } } // Normalize the path separator to give a valid suggestion // on Windows if (process.platform === 'win32') { found = StringPrototypeReplace(found, new RegExp(`\\${sep}`, 'g'), '/'); } return found; } catch { return false; } } function defaultResolve(specifier, context = {}, defaultResolveUnused) { let { parentURL, conditions } = context; if (parentURL && policy?.manifest) { const redirects = policy.manifest.getDependencyMapper(parentURL); if (redirects) { const { resolve, reaction } = redirects; const destination = resolve(specifier, new SafeSet(conditions)); let missing = true; if (destination === true) { missing = false; } else if (destination) { const href = destination.href; return { url: href }; } if (missing) { reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( parentURL, specifier, ArrayPrototypeJoin([...conditions], ', ')) ); } } } let parsed; try { parsed = new URL(specifier); if (parsed.protocol === 'data:') { return { url: specifier }; } } catch {} if (parsed && parsed.protocol === 'node:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); if (NativeModule.canBeRequiredByUsers(specifier)) { return { url: 'node:' + specifier }; } if (parentURL && StringPrototypeStartsWith(parentURL, 'data:')) { // This is gonna blow up, we want the error new URL(specifier, parentURL); } const isMain = parentURL === undefined; if (isMain) { parentURL = pathToFileURL(`${process.cwd()}/`).href; // This is the initial entry point to the program, and --input-type has // been passed as an option; but --input-type can only be used with // --eval, --print or STDIN string input. It is not allowed with file // input, to avoid user confusion over how expansive the effect of the // flag should be (i.e. entry point only, package scope surrounding the // entry point, etc.). if (typeFlag) throw new ERR_INPUT_TYPE_NOT_ALLOWED(); } conditions = getConditionsSet(conditions); let url; try { url = moduleResolve(specifier, parentURL, conditions); } catch (error) { // Try to give the user a hint of what would have been the // resolved CommonJS module if (error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ERR_UNSUPPORTED_DIR_IMPORT') { if (StringPrototypeStartsWith(specifier, 'file://')) { specifier = fileURLToPath(specifier); } const found = resolveAsCommonJS(specifier, parentURL); if (found) { // Modify the stack and message string to include the hint const lines = StringPrototypeSplit(error.stack, '\n'); const hint = `Did you mean to import ${found}?`; error.stack = ArrayPrototypeShift(lines) + '\n' + hint + '\n' + ArrayPrototypeJoin(lines, '\n'); error.message += `\n${hint}`; } } throw error; } if (isMain ? !preserveSymlinksMain : !preserveSymlinks) { const urlPath = fileURLToPath(url); const real = realpathSync(urlPath, { [internalFS.realpathCacheKey]: realpathCache }); const old = url; url = pathToFileURL( real + (StringPrototypeEndsWith(urlPath, sep) ? '/' : '')); url.search = old.search; url.hash = old.hash; } return { url: `${url}` }; } module.exports = { DEFAULT_CONDITIONS, defaultResolve, encodedSepRegEx, getPackageType, packageExportsResolve, packageImportsResolve }; ts-node-10.9.2/raw/node-internal-modules-package_json_reader-v15.3.0.js000066400000000000000000000020671453460306300253750ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/package_json_reader.js 'use strict'; const { SafeMap } = primordials; const { internalModuleReadJSON } = internalBinding('fs'); const { pathToFileURL } = require('url'); const { toNamespacedPath } = require('path'); const cache = new SafeMap(); let manifest; /** * * @param {string} jsonPath */ function read(jsonPath) { if (cache.has(jsonPath)) { return cache.get(jsonPath); } const [string, containsKeys] = internalModuleReadJSON( toNamespacedPath(jsonPath) ); const result = { string, containsKeys }; const { getOptionValue } = require('internal/options'); if (string !== undefined) { if (manifest === undefined) { manifest = getOptionValue('--experimental-policy') ? require('internal/process/policy').manifest : null; } if (manifest !== null) { const jsonURL = pathToFileURL(jsonPath); manifest.assertIntegrity(jsonURL, string); } } cache.set(jsonPath, result); return result; } module.exports = { read }; ts-node-10.9.2/raw/node-internal-repl-await-88799930794045795e8abac874730f9eba7e2300.js000066400000000000000000000175221453460306300262350ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/lib/internal/repl/await.js 'use strict'; const { ArrayFrom, ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypePop, ArrayPrototypePush, FunctionPrototype, ObjectKeys, RegExpPrototypeSymbolReplace, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeIndexOf, StringPrototypeRepeat, StringPrototypeSplit, StringPrototypeStartsWith, SyntaxError, } = primordials; const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser; const walk = require('internal/deps/acorn/acorn-walk/dist/walk'); const { Recoverable } = require('internal/repl'); function isTopLevelDeclaration(state) { return state.ancestors[state.ancestors.length - 2] === state.body; } const noop = FunctionPrototype; const visitorsWithoutAncestors = { ClassDeclaration(node, state, c) { if (isTopLevelDeclaration(state)) { state.prepend(node, `${node.id.name}=`); ArrayPrototypePush( state.hoistedDeclarationStatements, `let ${node.id.name}; ` ); } walk.base.ClassDeclaration(node, state, c); }, ForOfStatement(node, state, c) { if (node.await === true) { state.containsAwait = true; } walk.base.ForOfStatement(node, state, c); }, FunctionDeclaration(node, state, c) { state.prepend(node, `${node.id.name}=`); ArrayPrototypePush( state.hoistedDeclarationStatements, `var ${node.id.name}; ` ); }, FunctionExpression: noop, ArrowFunctionExpression: noop, MethodDefinition: noop, AwaitExpression(node, state, c) { state.containsAwait = true; walk.base.AwaitExpression(node, state, c); }, ReturnStatement(node, state, c) { state.containsReturn = true; walk.base.ReturnStatement(node, state, c); }, VariableDeclaration(node, state, c) { const variableKind = node.kind; const isIterableForDeclaration = ArrayPrototypeIncludes( ['ForOfStatement', 'ForInStatement'], state.ancestors[state.ancestors.length - 2].type ); if (variableKind === 'var' || isTopLevelDeclaration(state)) { state.replace( node.start, node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0), variableKind === 'var' && isIterableForDeclaration ? '' : 'void' + (node.declarations.length === 1 ? '' : ' (') ); if (!isIterableForDeclaration) { ArrayPrototypeForEach(node.declarations, (decl) => { state.prepend(decl, '('); state.append(decl, decl.init ? ')' : '=undefined)'); }); if (node.declarations.length !== 1) { state.append(node.declarations[node.declarations.length - 1], ')'); } } const variableIdentifiersToHoist = [ ['var', []], ['let', []], ]; function registerVariableDeclarationIdentifiers(node) { switch (node.type) { case 'Identifier': ArrayPrototypePush( variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1], node.name ); break; case 'ObjectPattern': ArrayPrototypeForEach(node.properties, (property) => { registerVariableDeclarationIdentifiers(property.value); }); break; case 'ArrayPattern': ArrayPrototypeForEach(node.elements, (element) => { registerVariableDeclarationIdentifiers(element); }); break; } } ArrayPrototypeForEach(node.declarations, (decl) => { registerVariableDeclarationIdentifiers(decl.id); }); ArrayPrototypeForEach( variableIdentifiersToHoist, ({ 0: kind, 1: identifiers }) => { if (identifiers.length > 0) { ArrayPrototypePush( state.hoistedDeclarationStatements, `${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; ` ); } } ); } walk.base.VariableDeclaration(node, state, c); } }; const visitors = {}; for (const nodeType of ObjectKeys(walk.base)) { const callback = visitorsWithoutAncestors[nodeType] || walk.base[nodeType]; visitors[nodeType] = (node, state, c) => { const isNew = node !== state.ancestors[state.ancestors.length - 1]; if (isNew) { ArrayPrototypePush(state.ancestors, node); } callback(node, state, c); if (isNew) { ArrayPrototypePop(state.ancestors); } }; } function processTopLevelAwait(src) { const wrapPrefix = '(async () => { '; const wrapped = `${wrapPrefix}${src} })()`; const wrappedArray = ArrayFrom(wrapped); let root; try { root = parser.parse(wrapped, { ecmaVersion: 'latest' }); } catch (e) { if (StringPrototypeStartsWith(e.message, 'Unterminated ')) throw new Recoverable(e); // If the parse error is before the first "await", then use the execution // error. Otherwise we must emit this parse error, making it look like a // proper syntax error. const awaitPos = StringPrototypeIndexOf(src, 'await'); const errPos = e.pos - wrapPrefix.length; if (awaitPos > errPos) return null; // Convert keyword parse errors on await into their original errors when // possible. if (errPos === awaitPos + 6 && StringPrototypeIncludes(e.message, 'Expecting Unicode escape sequence')) return null; if (errPos === awaitPos + 7 && StringPrototypeIncludes(e.message, 'Unexpected token')) return null; const line = e.loc.line; const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column; let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' + StringPrototypeRepeat(' ', column) + '^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, ''); // V8 unexpected token errors include the token string. if (StringPrototypeEndsWith(message, 'Unexpected token')) message += " '" + // Wrapper end may cause acorn to report error position after the source (src[e.pos - wrapPrefix.length] ?? src[src.length - 1]) + "'"; // eslint-disable-next-line no-restricted-syntax throw new SyntaxError(message); } const body = root.body[0].expression.callee.body; const state = { body, ancestors: [], hoistedDeclarationStatements: [], replace(from, to, str) { for (let i = from; i < to; i++) { wrappedArray[i] = ''; } if (from === to) str += wrappedArray[from]; wrappedArray[from] = str; }, prepend(node, str) { wrappedArray[node.start] = str + wrappedArray[node.start]; }, append(node, str) { wrappedArray[node.end - 1] += str; }, containsAwait: false, containsReturn: false }; walk.recursive(body, state, visitors); // Do not transform if // 1. False alarm: there isn't actually an await expression. // 2. There is a top-level return, which is not allowed. if (!state.containsAwait || state.containsReturn) { return null; } const last = body.body[body.body.length - 1]; if (last.type === 'ExpressionStatement') { // For an expression statement of the form // ( expr ) ; // ^^^^^^^^^^ // last // ^^^^ // last.expression // // We do not want the left parenthesis before the `return` keyword; // therefore we prepend the `return (` to `last`. // // On the other hand, we do not want the right parenthesis after the // semicolon. Since there can only be more right parentheses between // last.expression.end and the semicolon, appending one more to // last.expression should be fine. state.prepend(last, 'return ('); state.append(last.expression, ')'); } return ( ArrayPrototypeJoin(state.hoistedDeclarationStatements, '') + ArrayPrototypeJoin(wrappedArray, '') ); } module.exports = { processTopLevelAwait }; ts-node-10.9.2/raw/node-internal-repl-await-v17.0.0.js000066400000000000000000000177171453460306300220350ustar00rootroot00000000000000// Copied from https://github.com/nodejs/node/blob/v17.0.0/lib/internal/repl/await.js 'use strict'; const { ArrayPrototypeForEach, ArrayPrototypeIncludes, ArrayPrototypeJoin, ArrayPrototypePop, ArrayPrototypePush, FunctionPrototype, ObjectKeys, RegExpPrototypeSymbolReplace, StringPrototypeEndsWith, StringPrototypeIncludes, StringPrototypeIndexOf, StringPrototypeRepeat, StringPrototypeSplit, StringPrototypeStartsWith, SyntaxError, } = primordials; const parser = require('internal/deps/acorn/acorn/dist/acorn').Parser; const walk = require('internal/deps/acorn/acorn-walk/dist/walk'); const { Recoverable } = require('internal/repl'); function isTopLevelDeclaration(state) { return state.ancestors[state.ancestors.length - 2] === state.body; } const noop = FunctionPrototype; const visitorsWithoutAncestors = { ClassDeclaration(node, state, c) { if (isTopLevelDeclaration(state)) { state.prepend(node, `${node.id.name}=`); ArrayPrototypePush( state.hoistedDeclarationStatements, `let ${node.id.name}; ` ); } walk.base.ClassDeclaration(node, state, c); }, ForOfStatement(node, state, c) { if (node.await === true) { state.containsAwait = true; } walk.base.ForOfStatement(node, state, c); }, FunctionDeclaration(node, state, c) { state.prepend(node, `this.${node.id.name} = ${node.id.name}; `); ArrayPrototypePush( state.hoistedDeclarationStatements, `var ${node.id.name}; ` ); }, FunctionExpression: noop, ArrowFunctionExpression: noop, MethodDefinition: noop, AwaitExpression(node, state, c) { state.containsAwait = true; walk.base.AwaitExpression(node, state, c); }, ReturnStatement(node, state, c) { state.containsReturn = true; walk.base.ReturnStatement(node, state, c); }, VariableDeclaration(node, state, c) { const variableKind = node.kind; const isIterableForDeclaration = ArrayPrototypeIncludes( ['ForOfStatement', 'ForInStatement'], state.ancestors[state.ancestors.length - 2].type ); if (variableKind === 'var' || isTopLevelDeclaration(state)) { state.replace( node.start, node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0), variableKind === 'var' && isIterableForDeclaration ? '' : 'void' + (node.declarations.length === 1 ? '' : ' (') ); if (!isIterableForDeclaration) { ArrayPrototypeForEach(node.declarations, (decl) => { state.prepend(decl, '('); state.append(decl, decl.init ? ')' : '=undefined)'); }); if (node.declarations.length !== 1) { state.append(node.declarations[node.declarations.length - 1], ')'); } } const variableIdentifiersToHoist = [ ['var', []], ['let', []], ]; function registerVariableDeclarationIdentifiers(node) { switch (node.type) { case 'Identifier': ArrayPrototypePush( variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1], node.name ); break; case 'ObjectPattern': ArrayPrototypeForEach(node.properties, (property) => { registerVariableDeclarationIdentifiers(property.value); }); break; case 'ArrayPattern': ArrayPrototypeForEach(node.elements, (element) => { registerVariableDeclarationIdentifiers(element); }); break; } } ArrayPrototypeForEach(node.declarations, (decl) => { registerVariableDeclarationIdentifiers(decl.id); }); ArrayPrototypeForEach( variableIdentifiersToHoist, ({ 0: kind, 1: identifiers }) => { if (identifiers.length > 0) { ArrayPrototypePush( state.hoistedDeclarationStatements, `${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; ` ); } } ); } walk.base.VariableDeclaration(node, state, c); } }; const visitors = {}; for (const nodeType of ObjectKeys(walk.base)) { const callback = visitorsWithoutAncestors[nodeType] || walk.base[nodeType]; visitors[nodeType] = (node, state, c) => { const isNew = node !== state.ancestors[state.ancestors.length - 1]; if (isNew) { ArrayPrototypePush(state.ancestors, node); } callback(node, state, c); if (isNew) { ArrayPrototypePop(state.ancestors); } }; } function processTopLevelAwait(src) { const wrapPrefix = '(async () => { '; const wrapped = `${wrapPrefix}${src} })()`; const wrappedArray = StringPrototypeSplit(wrapped, ''); let root; try { root = parser.parse(wrapped, { ecmaVersion: 'latest' }); } catch (e) { if (StringPrototypeStartsWith(e.message, 'Unterminated ')) throw new Recoverable(e); // If the parse error is before the first "await", then use the execution // error. Otherwise we must emit this parse error, making it look like a // proper syntax error. const awaitPos = StringPrototypeIndexOf(src, 'await'); const errPos = e.pos - wrapPrefix.length; if (awaitPos > errPos) return null; // Convert keyword parse errors on await into their original errors when // possible. if (errPos === awaitPos + 6 && StringPrototypeIncludes(e.message, 'Expecting Unicode escape sequence')) return null; if (errPos === awaitPos + 7 && StringPrototypeIncludes(e.message, 'Unexpected token')) return null; const line = e.loc.line; const column = line === 1 ? e.loc.column - wrapPrefix.length : e.loc.column; let message = '\n' + StringPrototypeSplit(src, '\n')[line - 1] + '\n' + StringPrototypeRepeat(' ', column) + '^\n\n' + RegExpPrototypeSymbolReplace(/ \([^)]+\)/, e.message, ''); // V8 unexpected token errors include the token string. if (StringPrototypeEndsWith(message, 'Unexpected token')) message += " '" + // Wrapper end may cause acorn to report error position after the source (src[e.pos - wrapPrefix.length] ?? src[src.length - 1]) + "'"; // eslint-disable-next-line no-restricted-syntax throw new SyntaxError(message); } const body = root.body[0].expression.callee.body; const state = { body, ancestors: [], hoistedDeclarationStatements: [], replace(from, to, str) { for (let i = from; i < to; i++) { wrappedArray[i] = ''; } if (from === to) str += wrappedArray[from]; wrappedArray[from] = str; }, prepend(node, str) { wrappedArray[node.start] = str + wrappedArray[node.start]; }, append(node, str) { wrappedArray[node.end - 1] += str; }, containsAwait: false, containsReturn: false }; walk.recursive(body, state, visitors); // Do not transform if // 1. False alarm: there isn't actually an await expression. // 2. There is a top-level return, which is not allowed. if (!state.containsAwait || state.containsReturn) { return null; } for (let i = body.body.length - 1; i >= 0; i--) { const node = body.body[i]; if (node.type === 'EmptyStatement') continue; if (node.type === 'ExpressionStatement') { // For an expression statement of the form // ( expr ) ; // ^^^^^^^^^^ // node // ^^^^ // node.expression // // We do not want the left parenthesis before the `return` keyword; // therefore we prepend the `return (` to `node`. // // On the other hand, we do not want the right parenthesis after the // semicolon. Since there can only be more right parentheses between // node.expression.end and the semicolon, appending one more to // node.expression should be fine. state.prepend(node, 'return ('); state.append(node.expression, ')'); } break; } return ( ArrayPrototypeJoin(state.hoistedDeclarationStatements, '') + ArrayPrototypeJoin(wrappedArray, '') ); } module.exports = { processTopLevelAwait }; ts-node-10.9.2/register/000077500000000000000000000000001453460306300150045ustar00rootroot00000000000000ts-node-10.9.2/register/files.js000066400000000000000000000000611453460306300164410ustar00rootroot00000000000000require('../dist').register({ files: true, }); ts-node-10.9.2/register/index.js000066400000000000000000000000331453460306300164450ustar00rootroot00000000000000require('../').register(); ts-node-10.9.2/register/transpile-only.js000066400000000000000000000000651453460306300203230ustar00rootroot00000000000000require('../').register({ transpileOnly: true, }); ts-node-10.9.2/register/type-check.js000066400000000000000000000000611453460306300173730ustar00rootroot00000000000000require('../').register({ typeCheck: true, }); ts-node-10.9.2/screenshot.png000066400000000000000000002640731453460306300160570ustar00rootroot00000000000000‰PNG  IHDRxÈèG sRGB®ÎégAMA± üa pHYsÂÂ(J€ÿ¥IDATx^ìÝXWÖàÔ¢÷fcƒm°q¯qâØée³é=ùÓ{o›^'Ùô²é}“lênªÇNÜ{‰{ÇôÞA $ýsïŒ@€Fø{óLtgFF…™£sÏõs:~ """"""""Ÿå¯Ý‘b€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãºTƒ§¨ ß¡5‰ˆˆˆˆˆˆˆ¨EÇÆísBN§<îAwÞÿëÿú ­_¢"m)uELL F…Ñ£FãŠK/Ö–v>ØÓ©+¸séWaÅÊ•rõŒI'âƒwß–íÎy:¼ƒîüúÛ\Lžzƒ;DDDDDDDD½@Ä`D,fÎÜy*•ÓnØÀ¿üŠ»î¾G[BDDDDDDDD½iÖ3O㤎o7“Çk€ÇštÈ¡¨­«“ˈˆˆˆˆˆˆˆ¨wšÍX±t±l{ ò´ÛEKÔÜap‡ˆˆˆˆˆˆˆèÀ±™K¯¼Z›ó¬Ýkîx+V¬ÐZžy ðˆîYß|ÿ_mŽˆˆˆˆˆˆˆˆ4«ñVpÙkÏ¢Ejß."""""""":ðV®Z¥µÚòàYÕ΃ˆˆˆˆˆˆˆˆ¨w­ZµZkµå5ÀST\¬µˆˆˆˆˆˆˆˆè@ËÎÎÖZmµ[d™ˆˆˆˆˆˆˆˆú>xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""×/Xi+«”½SŽXòÿõ6Øÿ]eõ²ëÖ :6®MÂN¿ðœ[c£½^£A¯­i©ÁÖˆÆF K*ð|A1¾(*ÕÖô¬ó7à–¿i‚Áà¯ìŸçÄ©›¶F ŠëñÏÿ5àË…6mMÏÒi†ÿˆ¿rìt^ŽŸ]9~e²UÂñµöùuÚ"""""""ê ý6ÀóÁÐdŒ FBT„¶¤sr‹K±¦¢ —mÏÔ–ôŒ÷o2clЉ±Ú’ÎÉ)°bÍ..¥gƒ(†;C¡€À¸0mIçÔæ—Ã¾Ý Û³Ú"""""""êiÞ<>]ƒçë´Á˜‘»ÏÁA†‡Bµ%DDDDDDDt øl€çÓaƒ1>.ó¾O\‚͘…÷†&kKºÏ'·bÂ03,ž»;uFÅ€‰if¼{c÷y ÷†!`x ]?~F‹YÝÆ?B´%DDDDDDDt ød€GÔÜɱìWpÇÅhÆøÐ`œ®-Ù¢æNÆ@ý~w\‚”mŒKÕãœÃö[.¢æŽn°i¿‚;.KtCÍðŸ±ÿÛ"""""""¢®ñ¹-KTîJ·,oĶþ6ňº@Œ–% *w¥[–7I±fÜ~Š ~ݱƒÊþ‰‚Ê]é–åM`|tg™Ñ-ˆˆˆˆˆˆˆö™ÏxîIŒCld÷×}‰ŽÃ}I±Ú\׉¡Ðã¢ÔáÙ»Sl¤÷žiÔæºN …ÝýÇOŒÀ%¶MDDDDDDD½Ïç<ÓC‚ ×´¹îc0èä¶÷×´zôÝXÅþ®l{ù2À_ÙVwó×ëá?ºû_"""""""ê˜OxD÷¬0?Œ†î«Gãb4®Ó‰L]&ºg…ú)ÛêþÃ*¶nñƒòô»N<9±8~:£²Í åò¹!‘ïó©Ëñ´€øéº?ûÄÅáï4s×»W¥%øÃÏ¿ç Ñ8à‡aÊ¿ÑU~I:øû÷ÜñóSÞNâß """"""¢ÞåSžaf‚Lû_‡Æ›ÐÒöcd®¡ þì¹GXi‰ûàÑYz®•>Ø¿ ðõ6v¨!"""""""òq>àÙZWêúm®ûUXë•êÍí»m¹TÕÚµ¹îW^mÇÖ‡6·ïœÙvØklÚ\÷k¬j€3«çž?yæSžmV+œöž ø;ØRW¯Íí;àq:œÚ\÷ó‡s¿<GÏ?'”çÏQ¯ó©O£(·;Ð`kÔ–tŸ› ev;º>QöÏ®ì_­SÙÖþlÅ3±Í²'ö+~$b/Ê6ì=püì Ê6«•ë¹øyás5xþ¬¬Fcc÷(lÊ6ÿ¨¬ÑæºnÁ¦FØz$ÀcÇŸ÷ÿy;ÖÛàèC9~bÛDDDDDDDÔû|.Àódv> Kʵ¹îS\Z!·½¿žúª%]ïæåMQižúzÿëÙÿ]kQ¥6×}¬Å•rÛDDDDDDDÔû|.À#rcž/(Fnq©º ˆm=“W¤ÍíÑ…êŸÿk@NA׋5·–SP‡g¿ë¦ ‘²ޝ­¨Íï¾ ™Ø–ýË:mŽˆˆˆˆˆˆˆz›Ïx„/ŠJ±¦¢ 5µûT¨®©Å*e[_—iKöß— mX³Ë†êÚýï²TUcêøjq÷u«²Ï¯ƒ}»¶šýB5T+ÛÚZÇŸÝÐ"""""""¢}ã“á²í™XUP¼_Ažêš:¬,,ÁʶºÛå¯(ÛÞjEum×3"¸³BÙÆ•¯uvŒíÙ X7—ïWGwê7UÀö|÷wù"""""""¢ÎóÙpÖÖݘ—WØ¥îZâ1óò q޲žrγu˜·¶Nv±ÚWâ1óÖZqÞs=×õÉöh¬«ÊºÔ]K<¦~U9lWhKˆˆˆˆˆˆˆè@ñs:~Z»IQA¾#cÌ8m®ï;'*ÿˆ‹FLD(ô=Œƒ¶¦%1z£­Ee²æNwvËjÏ9‡éqû)&ÄDš”}ó—“'b(t1•ÖËš;ÝÙ-«=þ3 ;ËŒ€èøëõÐõÚš–ÄPèb´,YPùKvË"""""""êm×­Atl\›ÀB¿ðâIÜ—‹é!A×éàð÷Gh€I®«°ÖÃßá@™Ý.‡BïŽÑ²ö•Ÿ²ƒ÷žiÄá#ô·øÁ¡ìqXN®+¯¶ÃN”Õ8åPèÝ1ZÖ>SöOw¾þ£ @Ÿ2ë}°Q®j¬jPöÎT+ÿ_oãhYDDDDDDDH¿ð¸a“4³I™äüÖ:+¶ÔÕ˸úò2 KðGZ¢úzlÍqÈIŒÀÕ'(»å—¤ƒß5å̲ËIŒÀEDDDDDDDÎAà!"""""""ê¼xÚ, """"""""ß‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡¨ NŽˆ‘SìµÕÚ’f#®y1SŽFéÆåØó¿0ò†ÇaT.èÝ5Z­ØþÙ (Xø“¶¤™¸hŸðл0X‚Q¼v6¼|¶¦¥¸éGú¥wËööO_@ÎÜod»»ŒºùDŽ=T›ëXÞŸ?`ëž 0GŒ™ŠôËî…1$\[ÒÖίßBÖksÝ«;^WÁß ŸGÌ䣴%-‰@ͦ·Cõž-Ú’¶¢&Ì@šòº‰××½ÞŠÍï=)ixü&¤žw#?~:¶´™µ8›Þy•ÛÖiKˆˆˆˆˆˆè@óàÑ=òÈ#m<µ5Õ¿þæ¿´9ß:2 ƒ3BnDúÄHL;9‘‰¨­°¡¼¸w³, ƒ3é(øùùÁ…„é—Y4ËG]A–Ìhјa ’¥ëÕlw"˜ ²ut¦ÄL>ú@ –ÍE¡²Ze±IЛeˆÈx©Ëß«=RÕX[­,Ë’A¢À¸°ÕT£j×&m­Ê—Œ‘7< ½…+æa×—¯kkº1,Jf„Tgn,!28U¸â÷¦å®©bû:TïÝ®=º™Ø×qw½¤‡ ¦ÇŠcQò×2ÔæíüýeÆSõÞm(Û¸B{T÷êŽ×Õ©L£o{VyÝ“ó"ó(÷Ïe Ï^_sìÈ™9E«ÿDcu…¼Ÿ»ÐôquóSЛÌ2 S°t6ŠV̇µ¤ ƒ=þpå55(ï‹ Òä/úY{d3?eýØ;þ)³ü”cW“»ù F±²Ï"k̬¼¿D Mì‡È(²U”h$"""""¢é†ë®…%(h¦6Û¤ßdðˆKç”Ña˜tt,F S@sFB~f –ÏÎÃêy…¨­ê¸ëËþrez¸lýè9äÍÿ^›ƒráq÷¾&/¢íÖZ,¼ådÙ=Ê+ƒG°+ëÖ?w›ì6ãbŠŠÇ„ûßA«rA¾ìžóàl´ik›‰,“¤cφCÙÆª'¯CMæ6¹\\àð-‚Ú¬šyìu5r]OJ»ü>ÄO;Q–üãLmidž\p+’Ž9{#V?z•Çn\‰ƒ W÷©îÖ¯kœòÜÓ•c ˆ.v›ß}¢Ew,ñoŒ¸v¦ º”nZ)_ww"@4ùñe°Iükžº¡Å±Ç`ÜݯÁ"ç½eð¤œs=žp¾lgþð1v}û¶ø2ó‚)"cï~æèxTíÙŠU^©­!"""""¢É[O?*²ì‡]ë+ðÅ ÛðøEKðåË[±{c¹\—lÁ)W ÁýLÁùw¤!eT¨\ÞJ6,oD­•¬9_ʶ. PÖ>iOîïß´î¢ÎÊ®oߑ퀈DŽñÜ jç—¯£r÷føŒyíLYÃFH=÷FÜŸMo>Ò+ÁýaI,oEÆ‹·=µ9{z,¸ÓZW_×Ä#Ï·¶š*lûø¹6µvŠVÎGÁÒ9²1b¢Ì\r–6Vw„½?ÿ»Í±Ç ó‡´9Ï ÁáH_°|®Öj©P y5a:t£lïýñ´IáÓ”¬_"»€ áÃ[îõ-ý2Àã®$ߊٟdâ©+Wà­Öcõü4X•ˆ“.KÅ-/NÐîÙ3DOlnxujV'"€#jÓx"ŠøÖ•ä˶%)UÞzb-ÎÖ÷Ÿ–í¸©ÇaÄujW½ÂUó‘3÷kÙîë*¶o·¢>¨a#‚T:-©3,:Œ™ÕéÉ¿ƒOFW^W÷ר*s«Öj«Ê-H4`ˆÖRjYAõu°xÞ‘IT_^¬Íµ:d”¼ï­ Q—É_§ì¬¾iòsM~~2“GŒ o‰ˆˆˆˆˆ¨oê÷ž&N`ǺrÌÿ* kþhZÜÏß[þB÷uRyµùYr¸ìŒëíÖ€K{*Ëä­@˜:ÞTµÇ®µ€F­ËV_ãh¨Gé†å²1bɶ;§Ÿ’Ž>S¶¶”üµT¶]Š×4¿Î G6¿þîŽn?+Kl£^{RϾþZ7?oD™_'j<ÑÓo÷uS¦õM~ÊÅf›«ë¢‚|GƘqÚœ¯—¤=;äygEOiª­ÓPU.ƒ]yŒ¨W7@.Å£7¾þ¬ÍÓºãu’O½ƒO½L¶E°GlGOJjîZ%ºb­yæ&8<Ï6„EaÂýo" RÍ€Â9‚X@DŒ_¼gD×¾ò-k±vÖMò~­ Röc¶B]QêK à¯7›(ë?¹,¹ë\""""""¢kãº5ˆŽk“°Óo2xúJp§»9ìvüõâÝ(ݸ¦pqw*wn’A€ÖÁ?½Av»Á1bÒ¦·õÜr~ûJÖ.–í!g_ /u]º‹x•Ö¿x'2øµù{e€CÔ“Ñ›Ìr]Æ<É[ü+jrw˶18LÖ©‰1±)¸S¹{3Ö>wkwºSæ÷ïaË{OÊ ŒŸŸ‚EØÐQ2¸#2ªræ}‡µÏÞâ1¸#ؔlj€]馕rÞ-ß"¸#Þëž½ÕY;åºöìQöcý?ÿÊ]›å¼x_‰íˆ "ܯ8®;¾x n¢‰ˆˆˆˆˆ¨ïéG<ý‹+ƒ§®8ËîR»Y&B`Â`¨ÉÙZeòu¢{–NÔxÑFr6Úd­o !a°$14þ:lÕ•¨ÎÙå“Ù%â¹'§ÉbÙþ:*JQµkc‹áÔ;"º¸ H…Ÿ^Ú¼½¨Ù»][³oDVPÐÀ¡0ŠÀŽÃ.ƒO5Ù»Út#"""""¢Ë[<}”§Ü‚.ZDDDDDDDD'xˆˆˆˆˆˆˆˆ|Žž>ÊZZ€êìÝr¤)"""""""¢ö°È2‘`‘e"""""""¢~Š""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|œŸÓéôÓÚMŠ òcÆisDÝ/=%[vUhst é”i)©0h1ßEÕ(·Ûe»#&??LÃø  Dèô¨qرÓjÅo•e(°Ù´{Qwظn ¢cãÚ$ì0ÀC½êÐñ1¸ù’ˆ7ḋÕ–Ro ôóÇQÑH7bˆÉŒó4»uÏl±ÖisÞ 4šð`â@ 0hKšÕ;ìx³ ?W”iKˆˆˆˆˆˆhy ð°‹õªf Àð¡áÚ(azΊŒÁÈÀ 6ÁÎ ñ×ᱤAMÁEUx« _—¡ÚÞ“²þæ¸DLµËõDDDDDDÔsà!:HÕ9ìX[SÏ‹ ñPÖnü·´D[Ó9DÅ Öh”mØy,g/¾)+ÁÛEù¸eÏNT56ÂÏÏ7Ä%@/ïEDDDDDD=…¢ƒP~ƒ gnÝ„{²vãƒâ,¯©F£Q[Û1³ŸŽíÖ:|SZ,Û.9¶ü»¤H¶£ FÌ “m""""""êý¦OÚøpÔT5"{{•¶¤ïˆ 3bÚä8ŒŽð#lvdæÔ`ѪlÚ^®ÝË»´ÔP9%‰q0èýQR^ë‹°pEíNí^m ¢<Æ‚’2+Öo-ƒNç‡Ê~L­ì“ ¥eõ˜·4ËÖµ¼8÷Äß_ÔÏ‰ÅøŒHÄÇB¯÷CU Yy5Xµ¾XÙ~©r¯6o%ŒN Gdxs}– NIÅä±Ñ(«¨ÇÌ—ÖhK›åÖv{ñecH‚S3d»&g7¬…Ù²íIРt˜Â£e»lÓJ8ê;®CÓ_\ƒó£be»£<¢ÛÕÃÉö¿ rñmYÛìŸ0ÿ2\fñüYY's÷jkˆˆˆˆˆˆ¨«ú}‘å“.Œ§@ήj¬˜‡Uó Q_Û¹Q€zŠ^ç‡/ÉÀù'F€És'•õ[JqÕ½ a­o»¯æ̼uŽŸž¤-iiOvî}v¥× Ñ=×Qþí¬Ý\‚Û[ŠšŠÑéjÖ…»oÙƒG^nlq˜`Áó÷OÁ°Á¡Ú’¶–¬.Àµ,Öæš½òðTLŸ§Íu¬£}é ?ãî}!)Ãa-)ÀЇ/ƒ½¶m 00q0&<ø6tF WÌæ7ÒÖö%ÀsuLΈPa7ìÞŽõVýüðJò¼\ƒuµrÝÛƒ‡Ê=¥6\°c‹\FDDDDDD]×ï‹,Ûmj&KbJN»v(üp ξ5 ƒ†‡Èå½Md˼öØ¡¸ì¬¡2¸SZ^ïfgâÕ6á_ŸmÆï‹sQgm”—“§"·NqwvgUá½/·á5åñ,˃ÓéÄ ¤`¼ýä4$'ÉûxeÆwNÂðÔPÌY˜-·3{A¶Ì$N?aŽ;ÿa·l» 5aú”X|?»ã.8*ÏéTå¹×öú0éQã¦cäMOÈööO_@ÎÜod[vñ?pÄ©pذúÉëQ¹U[Ó=ôF\|ßmnß,ú![Wv૵}Éàù× ¡2˜# )Ÿ½c³\vQd .ŒŽÅ«×îÙ.—]S#¢dÛ•éCDDDDDD]w “î‡]ë+ðÅ ÛðøEKðåË[±{£Úu).Ù‚S®‚û?˜‚óïHCÊ(ï]ºCh°œ:D¶·ì*Ç}Ï®lÜŠËêqûãËQ^©f@¸;÷ïj`¦²º¿º¶M­9 sñÓü,Ù>dl uÅóî—ÛZw„u[Ê0oižl‘]·ÚÖóIØœõóžk׈z: îhÅkþDöœ¯d;åœ`IR_£¨ 3dpGØùåëÝÜtÊ'-}BD—¦ð¨æl™¾Â,Š2)jÍïëhƒšÅ«Ý V‡CkÚcˆˆˆˆˆˆ¨ûõË+®z«+çà{Ö㙫–ã·/2QVXƒQ‡qGÄâÚ'Çà®7'bƉ ëþœgLŽG`€ºÝ÷¿ÚÖn!dUË$* 14\¶ç/ÍCu­ç¬£æªaêø­åÙì?=g¶ìT šõ»YUÕ6g H°h-ßµóË×P¹{3t#2®{ ƒvéÝr]áªùÈ™ûµlw7ñXþk^—¦‚lµžM_bòWß³nom‹ˆb)ÌÊ­¨Ç#48›ïÀ.ZDDDDDD=¦ß_q•ä[1û“LÊÖ¦ÍëÒyÏJjlt +_­}ÓZUµMk‰¢Îmƒ]ë67gý̺{2N?>Yv-óU²Ï£±¶ñɘðÐ;0X‚QW”‹­ï=­Ý«û‰Q_½º½KÓî Ý;ªXwp¸‚’n±ÉFGÛ@¦ûŒÝ-ØCDDDDDDÝëàùI]¹¶Ü±®ó¿Êš?šƒ.~Z&BwŠŠ0ËÛªêT´ª­Ób(u—âRï5KĶEc!Ôí1­‰bέ³„\Ü/¹E=ŸÖD·®O¿ß!ÛbÈõGn¹Ÿþ ?¾wž»o.85aíüÛ}‘µ8[ÞWƒ9¢¨²¨»³ñ‡a¯ó£¶\]¯LZ¦ŽPjWƒ…uvGSæŽÁ-kÇêlî®EDDDDDDÝë ðXB 8ôäÜüÂ8ÜþêDL9>^.¯,­Ç’se»;¹FŪoèÚ­ÑÐ\ ºÁÖþ6lZ£±ç^ÊYÿú ·=¶ËÖ6”’â,8vZî¾f ¾ë6¡ý.b}³±¹Û›<‚ö.¾íÄ&vi2u7ÂýU¥sBtÍû–Y¯Ö’*°55ÃôÍïåj{Û:TDDDDDDÔ=úm€Ç_燌)‘rä"Q\ù´«‡ iH°ê{ËŠR|øøF4Q¶û4×΄!(Ö’¬yú4Ö×Á›„ôKïÑîDÙÝÐüM P»$æØðJ~>/)”óBª)@Þf×7€ù;DDDDDD=§ßxÒ'†ã¶W'àÖÇã°Sj„½Ñ K‹ñîÌ 2°3çß™¨(n;$yw[½¡DkGOKÐZ·#³²©+ÔøŒHyëÉ„‘QZ ØÜN1æžb·;ñêGeV”ßq0ËÖ¨>/‹YÍìèmCι!©#dæÎ¦·CåÎØñé r]Ìä#‘pÔé²ÝÝêëxñæU]šÖ/Ú÷BÝ=muš½%L ÖZÀå¥(Õº» 0#L¯¾Î«k«ä-õŒ~àI†ød5Û¥8¿?¼O^¾ =± [W–¶¬&Üí,@A±šÅsùÙiˆR³< 2Àhhù2Ô×Û±hµš1u\ R6_@»ˆÚ¶çŸœ"Û 6;(ÿfO0èÛ^vljÊ"ªt‘Ë›’25óCdüÄE«™½%jÜt${¶lïù߇¨Ü¾N¶óþŒ‚esd;õÜ”œ&ÛÝJyÿåî®éÒT[ÕÃõº`{]-²ëÕ×òèÐ0„êÚv%<=¼98ùGeï ‰ˆˆˆˆˆ&ý&À#†¡^¿ o?¸³®ZŽy_f¡ª¬ã€COh´;ñÜÛÉvh°ï>3SÆ4gÛ:Ž>4Ÿ½t$Ímkõ¼ÿŸmp:ÊýüñÏû&cPR¶F-âüÐMc1*=BÎûëž.ÖÕ·_9 Oß5‡ŽiìšGn¯Í —çk-ïV¹e7=|ó8 L°È`UO ˆŽGú÷ÊvùÖµÈü߇²í²õÃçP[˜#ëñŒ¸n&tfï]ãú‹qÊs<<(¤iJ26?ÆÒr]¢r\ZP^´ÏŠÕÌ¢ $ D„äÿ?72 G…†ËùÕ•Øjõ>í??§ÓÙæòº¨ ß‘1fœ6ç+DŠN/D öÁçÃMP®…Õý**©Cv^ ’-R/šgœ÷#Ê=h®½0×]8\¶E°gëî ÔYí6(–@µëËæe¸âž…¨©m›åqÏucd–®}Ú9?jK[:ûoƒñÀceûÄË~E®V?ÈåÇ(÷Q3…Äpë;3«P©l/"Ü„!Cd}#á£o¶ãùw6ÈvûœxÖá?²¹ppc£ Ê$|?g/ž~Cͬé.~:=ÆÝ÷:B‡­º+¹ ¥Íub\‚•õãî} þz WÍǦ×ÔÖôO¯ ÒT?§#oäáë²bm®Ù]ñIM›Ã܆„ëõQ&¡ØÖ€›öìDYORFDDDDDtظn ¢cãÚ$ìô› ž¾ÜÞýb®¹Öm)•óÑ‘fŒ…‘iá2¸SVnÅÛŸoAUçL£7?Ý‚‡_X%C"H”ž†q#"epGtËúòÇ]¸ê^ÏÁî²he!Vo,–AQ4Zìû¡b很àN^a-{eM'ƒ;‚®h±|Þ{²«dàJl'PÙ¶˜ZuWë©çÝ$ƒ;ÂÖ÷ŸñܪvoÆîoÞ–í˜ G ñسd›¼{.7 Ön‡ÁßÉ2¸#^×eU•¸™Á"""""¢^Ñ2xú¶¨pÒ‡„!<ĈÆF'²ó«±iG…,TÜ‘4\ylR\ zŠË¬økK)j­½7.‘9ÀiƒÃc†Ù¨“£ieæTaÛžJåb^»Sˆç&º¨ie|РQƒˆ|‹Iy!‡"Bo@­ÃŽõV5˜.’DDDDDDý™· xˆˆˆˆˆˆˆˆ|ÄAÐE‹ˆˆˆˆˆˆˆèàÄ‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8x&É)Xi÷¶ƒ£›öA´;cɤÞßlÑ–ô#NgÓñLJˆˆˆˆˆˆÈWø9N?­Ý¤¨ ß‘1fœ6G=aœÙ‚§’Sdû®Ì]X_W#Û=m¬òïÞ—€$S€¶DUÚhÃ;¶hsÞ=7p0FÉöÉ[6À§l÷"Ìöcú(Ùþ¤¨Ÿ”Ê6Q_±qÝDÇÆµIØaÏAd€Ñ„™’epÇét"·¡;­urʬ·j÷êHs<ЯMhˆˆˆˆˆˆˆx"'‡EÂ䯃ÍáÀÍ™;qù®m¸aÏ9Ý›µG»WûŠm2Û§ ¡vgÿÉÞ!""""""òe ðDÒÍj·¬ u5Øn­“í}õLn–ìÊuÉ®­°kˈˆˆˆˆˆˆèÀb€ç ¤ÓËÛ²ÆFyKDDDDDDDýC¿*²,ŠäŽÓ ïm¨Ga£M¶[#Fábeýå~îDd’%X¶Eáã‡1zŽ C’É?å¿]V+æT–¡ÒÞq‹ø·¦XB¥l£Òш555XZU‰1/²lñ÷Ç!A!HD¨N‡§CÙ‡:,ªª@i;û0%(þn½¨n‰KB˜AõÊ>|[Z¤-UÙœN¬¬­ÖæZûè×6¸´ºÎNâq=>³ÁŠ\›M¶TŽç³f¥okÀÜÊrdµz-¼`–¯QœÁ½rlŠ•m®ª®ÂÚNªN2š0#8‰F#l'¶Õ×a^E9ê•ãÊ"ËDDDDDDÔ—y+²Ü¯»w‘Iã:Ã=Ï©A!2¸#|¥Ü·upGõw~Ôºª¯ ZÆ- oê®öºòš¸w„yU2“‡ˆˆˆˆˆˆÈ1ÀÓŽ5U¨ó¡’Y_z-[&ÆÐ²K‘ȬÉЂ+jªÛf„ze›‹«*´¹¶Dà!Z ãçòR”{)¤,2v6j™?ÞêÒô%¢[Ùf]¼DÐKtcDÍ£ÖDW9AÔéù²¤Uv›Ú1]ÚD!fwã´ãS¢ìƺ–W.ó*Ê´‘oa€§Ùõ^FuòóC­C üˆ:8îM²žŒà Zx²£uææàÄ&k­ìæ>‰rËbY*b*!É`’·}Yv;£dÕjA,³¿x†-Ðf¢k•È\òv,D­$—D“Qk©™Ôã³Óê}vhõ•ˆˆˆˆˆˆˆ| <íp%öÄ©ü§jÙH cîRjóÞ «½.Zî#LÍL1t·ûôƒ6ý/}$N SkùëÛFúšö§ÊÓ2\¯Ž 6Ìli÷X|<$]ÞOòW#ˆ#ã…LŒæMGÝæˆˆˆˆˆˆˆú*xº™Þ­ÞŽ Þ6]¿\LZPc·ËZ>MíO|™ÈÌqeD‰Ëžž»§Éáv|E·9—®¾&DDDDDDD}ÙAàéÉ'mÕºn ­»o¹ hg]­ÛhX×ìÞ†³¶oîpº`Çíý‹ ΦzGs+Ê=>wO“ûj"ø%†QÜ‚g­µ÷šõeýêŠÖî–áï–µáÎ_¹‹ÅC—î" »Äè[Öq׺8³»<·mͳÁávX=áîWР£÷cÖ.å½P¬uÍŠm§VQ{¯ Q_Ö¯Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž"êV:“Á)Þ1 #§ÈÉ£­%"""""¢žàçt:ý´v“¢‚|GƘqÚQ÷KO Å–]Úh"9zªl,þކzÙÞþFRÏ»ñÓN‚¿Þ -Umýè9äÍÿ^›ëû¢ÆM‡!459{P¹}¶”ˆˆˆˆˆèÀÛ¸n ¢cãÚ$ì0ƒ‡zÕ¡ãcðùKGàåGÑ–P_”0iÿCNú‹¶tß ½è$qš îØjªP½U{·Ë©±Ú·‚yNº@‹Ø©ÇhKˆˆˆˆˆˆú6x¨W0c† ׿¨¿0‡#nêñ²]°ô7,¾õ¬|èR¬zär9­œ/×QÏ`€‡ˆö[ðàtøù«_'¹ó¾…ÓÞ(ÛDDDDDDÔ;à!¢ýf°„h- ¾¢TkQoé7E–ÓÆ‡£¦ªÙÛ«´%}Gd˜Ó&ÇaÄp„‡Ñ`³#3§‹V`Óörí^Þ¥¥†âÈ)ñHŒ „Aï’òz¬X_„…+ Ðhwj÷jkØ å1””Y±~kt:?ÌPöcÒ˜heŸL(-«Ç¼¥¹X¶®X{„w"9ãÐñ±Ÿ‰ø˜@èõ~¨ª±!+¯«Ö+ÛõmÞJŽÈðm¸à”TL²ŠzÌ|i¶´Y^am·_6Ç'#0n l—oZ {}l{1f*üüõh¨(AÕ®MÚÒþMŒt5úöçd{ñ­§¢¡²ý M@L,‰ƒµ9 <}<’Ž=K¶EAå†VAžê¬¨/ÎÓæÚò7™5nB†Œ‚1(vkjó3Q¼úOÔæh÷jŸ(5þp%¥B[MªölQ¶±5•Ú½:gÜo"4%9ó¿Ãöž×–xÞŠ,÷›ÏI—ÆŒÓ gW5VÌÎêy…¨¯µkk ½Î7^’óOŒ“^[ÚÒú-¥¸êÞ…°Ö·ÝWs€?fÞ:ÇOOÒ–´´'» ÷>»ÒkèžëÆ(ÿv Ön.Áí-Å‹MÅèômm³oÙƒG^nlq˜`Áó÷OÁ°Á¡Ú’¶–¬.Àµ,Öæš½òðTLŸ§Íu¬£}銰áã1öΗd{ëÏ"ïÏÿʶ'Áƒ‡cƒoÉöŽÏ_Eöì/d»¿Û×ÏÀ¿]ˆ”³®Õæ:ÖÞ(Z" –vé=0…¶}o:ívdÏý;¿xM™qhKÛxÒÅH>åè FmI3QðyÇ¿_–£ƒuï/‘-óúc‡âä£B¯÷Giy=~ý3¿-ÊŚŨ¬²!.ÚŒ¤8 >ùn‡‡¯=zŽ˜/çvgUáÛ_3±xUê¬HN Bx¨ 'LOÂÜ%¹¨¨l÷s7mRF¥©NJƘôpü®Ü÷¥ù(*­Ã€‹²Ÿþ>$ »öVbçÞ¶ÙOFƒ?>|~R†ÀápbÉêBü8? ó•mlÞQ.÷[<šºF|ýËíQÍ¢#PVYí{*ädÐ#4؈:åþ³f7-wM«6•`ËÎîÍà©+ÎCìÔãe7"Cpòü ­i+ùï#dðp8mØòî“p4Xµ5ý›9&I9FÇÉvÖ/Ÿw˜å¤ ‚Óé”#e‰IÜ? "F®+Z³U{¶6­Sùæ•°zÈàÁ·Q·Ì‚Ál‘ǼpÅï(\ö»|L@x4ô–`„¦fÀ’umˆÂÀ“/AÊWÁ_§CCeòý‚âÕ a--€96In;jÜá¨+ÈBMÎ.íQ틟þwåß‘@¥ë–hK‰ˆˆˆˆˆ¼®»–  ™Úl“~“Á#")£Ã0éèXŒ<4¦¶ÈϬÁòÙyX=¯µU½Süõ¦K†ãÊsÓeû×?³ñÈK«Q[×2ˆnÂ}7ŒÁ£/¯Ey«ÍiÇÄÌÛ&ÈöÏó³ðÀó«ZtÇ:vZfÝ3þþ~Xº¶×Ü·H[ÓÌ•Á#ÔÔÚp•rŸÛÊä¼ >ï>s8 –¬)ĵ÷·ÝÆ1‡%Èìá©××âóv˶;hš>%ßÏÞ«-ñîQå9ª<·‚âZwñ¯ÚÒž7ð¤ÿCÊ™×Èö²ûþuù™²íÎOoÀ¡ÿü† ®œ‡M¯?¤­Ùz£?.¾o„6·oý‹­+{¶®Îd†)JÍ´ªÍS^GǾe¿Åv"Ò¯¸O¶—Ýs^çºUùùcòSŸ!0&V+Ö=wK‹.q¢Û–È* :Zί~êFTn_'Û.±0ù±åÐì5¹»±vÖͰU6g´™ãbÜ=¯Á[u–Þ}.ìu5ÚZï¢â•?@fÿØÊ;îÂHDDDDDÔ[¼eðô£"Ë~ص¾_¼° _´_¾¼»7ªzqÉœrÕÜÿÁœGRFyïjÔBƒ ¸àÔ!²½eW9î{ve›àŽP\VÛ_ŽòʶFçþ] ÌTV7àñW×¶©µ3ga.~šŸ%Û‡ŒÁ ¤ ÙöæÝ/·µîë¶”aÞR5«bŒìºÕ¶žOêÀæâ¹?ÿ‘­µZõt:Ü9òü‡6²SÜ´¿ÉÛÖ¢ÆN“ÁAÜ¿;é”OZú„ˆ.MáQ&m+=GdàÔæì–Ó¾wº*bôܲ~þ´M½#‡²O[Þ{N‡Ú5+é¨Óå­»„'ËàŽ°õ£ç[w„ºü½Øõõ›²m EÌ”cd»#"ÛH wˆˆˆˆˆÈWô£O³z«+çà{Ö㙫–ã·/2QVXƒQ‡qGÄâÚ'Çà®7'bƉ ó\g̘Àu»ïµ­ÝBȪ–IT"@4b¨ÚµjþÒ*·µÌîq)\þ;6õ}ìiDDDDDDýA¿ ð¸+É·bö'™xêÊxëõX=¿ ÖFD%â¤ËRqË‹j7¨î4z¸œ–¬.ÒZ7Ô­˜ñ¦ÞGÙÚ´³y]Ú ïYIdå{î–RUmÓZ¢¨sÛ`׺ÍÍY?³îžŒÓO–]Ë|QÞÿ“·¦°(„R»¹‚Õej° áO¢ï¢lw»Í‰¯^ÝÞ¥i÷†î­IÔW P³ÜlÕ•°yaKÔóDŽ1žhCÀ7”«]ôˆˆˆˆˆˆú›~àIŸŽÛ^€[_ÃNIDP¨öF6,-Æ»37ÈÀΜg¢¢¸íäÝmõ†æz GOKÐZ·#³²©+ÔøŒHyëÉ„‘QZ ØÜN1æžb·;ñêGeV”ßq0ËÖ¨>/‹¹¹«MoËÿS-¶œ< Aƒ‡#fÊÑr¾`ÉìݺS}½/Þ¼ªKÓúEû^¨ÛTíU #ëŒ&„ N—mOBÓÆÈÛÚÂØkÕ¬1A„„ª÷n—í” øiõxZ3FÄÀ­~«ö¨÷'"""""êoúM€'utâ“Õl—âü:üüñnj¦n}gf*•íE„›0d`ˆ¬o$|ôÍv<ÿÎÙnŸïÏ:ãG6nlt A™„ïçìÅÓo¬“íždŽˆ)O~ªÍ[?zyó¿×æh_Åv"Ò¯¸O¶—Ýsê sd»#¢þθ{_C@d¬œo¨,G]~¦áÌ’0H.E±·¼÷ ÿ"ç[ ϘŒ‘7?6B–èÊÕPVsL"LáêûÌV]‰µ³nFMöN9ODDDDDä«6®[ƒèظ6 ;ý&ƒ§¯w„w¿Ø†kî_„u[Jå|t¤ãFFadZ¸ [ñöç[PUã9ÓèÍO·àáVÉÀ¥§„a܈HÜݲ¾üq®º×sp§»,ZYˆÕ‹eFû~è„X¹/"¸“WX‹Ç^YÓÉàŽà‡ëZ,Ÿ÷žì*¸Û T¶-¦€VÝÕzJ]þ^™µ#Øm (Z1O¶©wÕ—`õ“סpå<È1†„!tؘ¦àNMîüõÒÝ^ƒ;BÙÆåX7ëTíÞ"çE—®°´±2¸#Þ_%–+ÿÆõ îQ¿Ö2xú¶¨pÒ‡„!<ĈÆF'²ó«±iG…,TÜ‘4\ylR\ zŠË¬økK)j­=;4º;s€?Ò‡!6Æ ³Q'GÓÊ̩¶=•ÊE´v§.ÏMtQÓÊø A96¢QÓéqèóßÈú;…+æaÓi+è@Y;Á)#`TnÅpæµù™¨ÍÝ£­í‘µ˜˜"kòØj*PµglÍ݉ˆˆˆˆˆ|· xè 3匸æaÙ^ÿÏ tÃ2Ù&""""""êË‚.ZD#†ÓN>ùbÙõZJ´B¿DDDDDDD¾Š:(DÅ#bäÄzÆüㅦѳ2øH¤±É6‘¯b€‡ 1‡‹Ñ·?‡áWÞ/ ð …Ëæ¢`áO²MDDDDDDäËࡃ‚­²ÕÙ»Q•µ%ë–`Ë»Obã¿ÑÖù6Y&"""""""ò,²LDDDDDDDÔO1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1Às€„øë010HNÁJ»·% Ø´¢ÝƒL&õþf‹¶¤q:›Ž‡8>DDDDDDD¾ÂÏétúií&EùŽŒ1ã´9ê ãÌ<•œ"ÛweîÂúºÙîic•÷Ƹ$™´%ªÒF.رE›ó120H¶OÞ²68e»?a¶ÓGÉö'Eø¤¤P¶‰ˆˆˆˆˆˆúŠëÖ :6®MÂ3x"Œ&Ì,ƒ;N§¹ õØi­“Sf½U»WGšã~mBƒDDDDDDDt 0Às99,&lnÎ܉Ëwmà {vÈéÞ¬=Ú½ÚWÔh“Ù> °;ûOö‘/c€ç ’nV»em¨«Ávklï«gr³dW®Kvm…][FDDDDDDD<‘ ^Þ–56Ê["""""""êúU‘eQ$wœVxoC= m²Ýš1Ê+ë÷(÷s'B “,Á²- ×8ˆÑpTH’LFø)ÿí²Z1§² •öŽsXÄ¿5Å‚(e•ŽF¬©©ÁÒªJŒ ì|‘e‹¿? Az@ Bu:Ô8Ê>ÔaQUJÛÙ‡)AÁðwëEuK\ z¬WöáÛÒ"m©Êætbemµ6×’Ø×@¿¶±À¥Õ•pv¢ëñ™ VäÚl²}¤r<‡˜Í0+í|[æV–#«ÕkáͰ³|â è•cS¬lsUuÖv²Pu’Ñ„Á¡H4as8±­¾ó*ÊQ¯WY&"""""¢¾Ì[‘å~à Ñéðåвýf~.¾+/‘íÖ>’޽³ËËðÏülm©Ê}÷íÝhƒ7Æ&ÀàßòØ•7ÚpÖìôRœØìç‡{’19X ¹[WSïËJðPR²œo/Àsjx.ŠŠmʾqWçpà½Â<ü¯¼T[ÒÒ‡eÀØj¿½io­7 Å €–£n §lÝ€†NÔáq=þ‹âB,®®ÄÃÊóÇß]£Ó—ós0»¢\[ÒV¬òZÜ—„±5ˆ×ÚÆÚ<™³%vïJ—*ÇòìÈhèZ¦ ê13;¯§ “ó ðQ_ÄQ´ºàˆ0Ü—ˆB› ß•ã{eÚcU:azîŒx p(ËLjîˆQª>+.À§Ê´£®c,A¸":N®kϕѱ¸.6QwÊmø¡¬ïåá»’bÙ`ö÷Ç Êþý=,B{DKó+Ëñ{EYÓ$BB^CC‹åbZXY)×y²²¦T”ËIduÕ`“YwôðÃ/e¥øª¤kkÔ¬!½Ÿò\bÝ*ðã’`0à…äÔ¦àŽxܧEø°(Ë«ªä¨`ÌJN‘Á5OÎŒÆyQ12¸S¢¼¦"‹I<^d"ÅM¸?Q ¸ùfð´“Á#Ì­Pî“—ÝTPXt»7a¦…„Éù;öìÄFk­l»Š{ʶø7^ÈËjêʤpÜ—ˆ“Â#å¼à)ƒg²%,Û«kªðxö^Ô:Õ`T¶w¿òoL AÝËwnA™£ý.c¦¤!Öh”YÊsêŠó#¢qIŒœÚ× aw½÷ìÝ… ·®eg„GáêØxÙþ 0Ÿ·ê>&f/%AZ` 쉜½XªwcÍ<6`Ì´úº¤oåkkT¢›Ý;)ÃdF“RÝ©ìƒè~çrdp(îNT_3i«ÖuKhÝ}Ë]@;ëjÝFúf÷6œµ}s‡Ó;¶hè_lp6Õ;š[Qîñ¹{šÜGPÁ/1Œºà/…n®‰ˆˆˆˆˆˆ|E¿Ëàq#Í„ëõ(olÄfk-jz¸k–'¢ÛÒˆ€@D ¨´7bcm-jû¾¢Ô0s Âuzè•v…ÝŽÌz+ {!XÕže_D€D¹‘j”ýªkÕ•¬' 4šdm"‘ySï´£ÀfÃåxˆ@P‡”û¤™ÍˆW¶as8±ÝZwÀ#QgxËàé·"""""""¢þæ é¢EDDDDDDDt°a€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1ÀCDDDDDDDäãà!"""¢>)!!“&MÂGc=:N[CD¾lÔèÑ9r$RRR`6›µ¥D´¿üœN§ŸÖnRTïÈ3N›£în€ø ˜tðÓŽüêŨ³:Ôê”ñ##a6éPTbŶ=•ÚRêNÁ)Ãa ­¦U»7kK;Ï©L‘#§Èv]a¶2åÈvG’ Dhh8 òQ_ -%_¡3øaȨ0ÙÎß[‹ŠâzÙ&êOIù;^YÚ€¼=5ÚRߤP[Sƒ;vhKŒ±cÇà–[oAbb¢¶Duêɧ*çLVmŽˆ|Õ7ß~   ÙV®G±iÓ&¼õæ[ؼe‹\FDíÛ¸n ¢cãÚ$ì0ÀÓKbñÈ­ã0eLŒ¶¤Ù©WÏÁžìjmîàžŠ-»*´¹}㯼×üpºl¯ÛRŠ‹oÿC¶©{½÷5„ ò-k±vÖMÚÒ}à¯ÃïÌ—ÍÝß¿Ìïß“íöDEEáÝ÷ÞÉdÂu×\‡Ý{öhkÈW„Fqÿ‡Èö7¯mÇÒ_òd›¨?¹ë­IˆŠ7cퟅøìÙþs1"<ïð>ŒFn¸þFìÚµK[ӻįùŸ~ö‰¼øs8øký_ÈÍÍEƒÍ†½ù/466j÷<8èt~”„™UÚ"ßwß}÷"8$qqqMÜêª*\tÑ%¨©é?s¢žâ-ÀÃ.Z½À ÷ÛÚÜ)(®Å–]åMSƒíàÉÞ9t| >é¼üˆzØ~®Ô'E›è$ù´«¯¾JžØÿöÛ\wˆˆzYii)¾ûî{٠ꆮזö¾‰'6ý²ÿÊ˯àÎ;ï /¼ˆ×^}í  î\xj*~~ÿ8\qÎ0m Qÿðä“OáÞ{îÃe—^Ž_xI. Æa‡&ÛDÔ5 ðô‚#‰Grb°l?ýæ:wñ¯8÷ÆyMSnA­\w08aÆ ®ÍuÃáDv~ ŠË¬È/¬Ó–’¯KMMÅŒ#fÈ4Ý/>ÿB[JDD½éÛo¾F}}=F…ÉS&kK{×€´°hÑ"­upú¿Ó† 6*P›#êŸ~ýõWØl6ÙNN(o‰¨kàé#ÓÔ€FƒÍŽÏÿw`Òûåú']>G_ø3î|z¹¶”|ÝÙçœ%³³Ö­]‡¬¬,m)õ¦òò ,^´X¶/¸ðyÛÛÌÍW+*Xg¨¿³Ûí¨ªVËU¸²÷ˆ¨kàé¡AFy[^Ù ƒDÔRHh(¦M›&ÛsŸ+o‰ˆèÀÝd…Ç#-½÷»éD±=Èê$Ƛ²®¤¯Æ$‡ÖýR§×Ë["êš~Sd9m|8jª‘½ýÀ “Žˆ°m¸à”TL²ŠzÌ|i¶´Ù²µ…¨µÚµ9ÕàÁHˆ1£±Ñe늵¥-ÅF›1d Úõkå†Ô×·ÜÆ°A!HŒ³ ¤ÌŠõ[Ëd‘¾“ã0iL4"ÃL(-«Ç¼¥¹^·ß–ãGFaŠò\â¢hÒ£¸ÜŠ Ê¶ÿX–‡êÚ¶ýâG§…#2¼óÇ"¯PÔ'j[|YÔ1š61N›kVQÝ€ÕÊsßâ¸55^Ÿ @#Ê«ê±qG9æ-ÎEE•šêItDF ‡ÝáÀŸËÕÑF¥…áèÃ’«rüWm(ÆÏó³ÑhïùRKR*ÂÒÆ"0>† PåcêËKQ±m-Ê6­„³Ñûsq1‡!fòÑ8 ~ÊÔÚü½(X2õÅy.²lŽKV¶qãÀÑЀª=[¿t¶Ò®ït‘åsÎ9W^u¥ìpî9ç¡¶¶ãn‹Æ§fÈvMÎnX ³eÛ“ Aé0…G˶86Žúö»ö˜ˆœÜÔ[{g¨ÔÑ¡0ë‘¿·%yV˜Ì:Œ›ƒÄ¡A0™t(-°bõüBfy?6ƒ†‡ÈÇU•7 w—ç…ñƒ,‰0¢¡ÁÝš?k–P¥‡ ¾®;þªÀ!ÇÇcðÈPÔT4`ѹrŸB£L8ô¤„ǘP ìÇ¢ÿåÀZÓò{ÇS‘åÁ¡95ÁáFÔT6bûÚRl^Q g'Êù+ß[CÇ…#uT¨²mìÊw¢Ø— KŠP°·ã.šÃÆ…Á`Ô!oOµr Õ×RŒ€4|R$¢MÊþØŸYƒõ ‹Ú<—M|‹D& ¡¾¬ÕÊg«=1I°$–íò­k`¯õ^¼ß_¹ªH8PùûP†ÊŠ®¼ßWÁÊûnàÐ`ùºeE™\6 -£¦F#LyoÙêص¡kþ,‚ÃËwhÌ€@„+¯›xìXïy¿Åû4n Ú¥e—ò·)ïuñÚ[‚ ÈÚQ%?+Sÿ–€À`=vþUŽs”ïuåŸ3#éÊ9…Cù“¶æÏBìXW®=ºYë"Ë‘ñdŒ\&žÇ^å\dò<êë:÷žJRŽKúÄDÄš”‹9úܶե^Ÿ£»„Ô „+Ϲ¢´¡é(2.c•ï±_ŽF'Šrkñ×¢â¦Ï@GÄûã³Ï?CDx8þ÷¿dœÞ$ê±uöY²}ܱÇËÛÞ§œ# O ƒMy-\©þ­¶èñ÷£bHr”ïcÑM|ɪB¬Ý\*×{“¡œ3>1V9 TÎcü‘_lU—ßîy×ôɱ-\ÝûìDEGcöì9xîÙç´¥DäM¿Eë¤ËcÆé³«+fçaÕ¼BÔט“õ×›ŠÃ&´ Fxãi­{®ƒóONAUu¦ó£¶´¥³ÿ6Ü8V¶O¼ì×6µ|\ÛX»¹·?¶/>4£Ó#´µÍ¾ýey¹m°ÅÔÜÓX¤§¨' ­ÕZñÔkëðß¹{µ%ªWžŠéS:,¼íKXˆ|~’6×lý–R\´£h]yî0\}¾r±¯\ðµV©ëYÿZÿÍõÜ=èØi xî¾)ò×Ä©gþw]=gœ ^L¹Û´½ Wß·°Í‰Nw T.àFÝü4ÌÑ Ú’¶êŠr±õƒgP¾Y9™ñ"j ¤]z7 5Hèb¯·bó{O"阳: ð >ã* <ñBøéZOkq>þzù^Lzô}9ßQ€çõ7_ÇÔT¬Y³wßu·¶´}~:=ÆÝû:BR†ÃZR€_¦\ж ðŠã5áÁ·¡3šP¸b6½ñ¶Æ³Aƒ’ñ̬YCqq1þqÇrô–žvû«—lÁï_îÅÆåŸôþ ‡›´µ*qQûõkÛ°ò·BmIK®mlXZŒžØ¤-mé‚;Ó1vzŒ =}esÇ!cÂpõã£aUÞ·"Ø1ùøxmòù®²áÝ™á’ûG"$\ÍHÄ÷í+·­†r½ÞÄ=ÀóÝ›Û1`X0&Õö; {{%>|rs»Ã¨Š3nЍ„¶õ'Äçpùœ||÷Æå¸x¨ÞóÎdå¢9?¸ ÿ›‹ #µµÍ*Këñø%Ë´¹¾cìݯÈ@®µ´Kîo‰¶´¥CNˆ—ïá)å=^¦¼×]®{f Å2åõ vL>í¿˜6)³îžK A»G³G•󕯕ó–ÖÚ9UA—»žZî1¨²ä›“Ðù †ûž]‰çµ/½¿ŸþwfÝ3 GLiû¹-*©Ã1ý¢Í©ºó<´«F˜ŒKޏK¶XõþØô_Ùní¼Ãn„”h´Ûðê/÷#§´çK*ôv€ç¸1çâØÑgËö¬ïoFQ¥÷s›#FœŠ“&\$Û/üxr{áx0ÀC´oúý(Zv›zÒ›˜„Ó®Š?œ"OzÄ/Ú½mùÚbåíÞ¦)+Oý%½®®±År×T­œ¨ö¤¸(3ž¸s†§†bÎÂl¼÷å6ùK‹¨ $œ~ w¸÷`Á´‰±xç™Ã›‚;«7áÝ/¶âå7âßßïÄ®½•òddݶ'¨+Öµx®‹µ[=ÿ&öõ—?²›&Q`y_]}^nº$CwÊÊ­øü‡]xEyßÍÉ”ª #SNêNœ‘¤=Â3Q'æžkÇÊàŽ8ïýg›Ü†kŸF Wþ²ÝŒ!‘2¸ãT®ª+vl@öo_c××o#ó‡Q¸üwØ­µrý¨[ŸEÈ0õרÖBÓÇaĵÈàŽèä-üIn#oÁO²áðËïC@dû¹'_‚ä¿_,ƒ;õåÅÈšý%v}ûŠ×.B@T2®T»gûÄ/Ä"¸#lÙ²UÞv†¸xÝô¯‡a«©Rö5é—ߣ­iæo4aÄ53ep§¶0G½:rÖÙgËàŽ †m?ãÌ3d»·$ ’‘¹²ü×<Ìÿ& ;Ö©ÙâòtåûMdžô”‹òY>$¿}‘‰•sÕ_ìƒ ¸æñÑp(ˆ¿~²«æ©¿j‹ï[‘]ãÍ´“ep§(§ó¾ÊÂìÏ2e¦„44W?> £ç?CS"qùÌQ2¸Ó¨|þ×þQˆ_>Þ-`Ù;ªäçPλ=]{Dû,¡FœsÛ0Ü©W.âÅ1]· HÞŠysPßL Ï[ ø"b1b’l{bDD†ZWdáy îG̘!ƒ;‚ÉdÂ¥—^*Û½E¼v§^=D¾~»7”Ë÷ÆŠßòQY¦1Ä{ã„‹[Yº›úoWÈ÷s±–• Þ¯G=PmD@°BËŠ˜~º÷¿ "óF¬µXüc.~ùh·|¯Š`¬Ð^úàHÄ%{.+²kn|vLSpGd Íù÷¹O[D†›òevo¬T¾ëËeÛnwÈ cñ\²wV¡8ÇsV´SeðFtÃI†%?åâ݇7`ùì|ÙeEÛÅ?äÊîbbÿúšº‚,$yº Rúëô(Z¥v{l-ñÈÓ1JýÅ^2mUm»¹ >SQï+ÔÔÖâûï¾×æzNìÀ@™5#$¦É.|ßýk§ llZV‚5ó qH¤ (Æ$bòlÝUKtc8,Ê÷óü¯W9;ªðÖýë•}Α™Gkÿ,RŽe¶ü¬–*Ÿ§šŠÎMD îÄOíÝ»wcëÖm²ÝN=í$&&¢¼¢_ýç+miïHO Uþ–«Á†1Õ¿“§rî³/¼»¿þ™#'1`Ʋ5Eò‚ÅKüûâÜf¨h|ùã.\ÿÐb|óK¦<—YÏâxˆNWþÕò°;ÎC»ÃŽü HK‹ð ( ‰‰•;æ)¯«ú9ˆ ŽÇeGÞ ½Î€õ™KðÃêåòÞ0xD†Ž Gµò7}ÉOŸŸì/«­ƒ¢Ó‡ˆàX,¯¶ç©"vÌè3e{î_ÊyY/tWŽ;þ8ù£Ÿ º†Qûn¸îZX‚‚fj³MúMr*‚]ÊEÆ/lÃã-Á—/oUN’Ô“!qpÊUCpÿSpþiH*—LÞýr6nS³\Öm)ü¥ê”12e¶í—üÿ6T9 P³DÍœ¥Ê 'â„çõOš/¬ûš3OƒAý¥ì±W×¢´¼eº{fv5^úp£l‹ç{âÍC´z²xUþ£œ4¹'PŸjýãE (5¹g²Ç*wnÄîoÞ†­ÜsŸõú’|äÎWSE÷%CHËnu¢»‡%A `ìýùߨÎjù‡»6g2øH›ó,î°¡3¨¿Ömûä…6µ> —Α™<1hps0¥+£g¯ùÙsÔ €”sn€%IýuNtAK8âTÙÞùåë¨Îì\vÐ?þÐ4T§è¾òËÏ-ƒ[½á›W¶É Ž»?•‹]Q[GHNïÙÌÄ=››Oôsw©¯­8yß«\´ºˆ”rAt1ñFdÞ|ýê¶6]¨~ûÏÏÓý´´õˆ‘Í¿ªgkÅ‘}Q°Å ‹K …%í[\ª^оéíQi[â.Qª‡$}&ýçw²qòIÿ‡xå¢/fò‘ˆ™¨N¢–‹ŸÛp«‚!Hýµ°¡¢ý ¯ëýuЪ' Þ‡¨oo;Ñ÷^¿»~-î kq¶¼¯sD½QwgãÃ^ç[ïÝö†Uv½¿DmŒžäþ½àÊÜép_*öE½UÞ^‰Q„¼qÔCšOêÅPÚ.bdħ¿Ÿ®Nß.§§¾Õ¦oÇùÿ®ÝS¹0h'“H(ÉõÍàŽKÞŸjfŽèv˜ØÜ­QŒ&3ù(Ù.Z1ŽúÎwÁ9¼¼ÏÝ¿C{óï³ëŸuÿ÷ݚо¦Úp·&²„D×F!(¤åûSÔ¯ i÷=~ÿû͵’-í_üŠl"sû¡Aùô­FJìNk׬ÅÇ}‚Ï?û\E×Xqa÷‹ÿD|\çGáì Y¹ûЈ WÏ›2†E`õÿN“Ó*mZù_uZñý©˜ý¡ZÛHµô\ÖJwÊÊíúßÒ®ž‡öQD9»x z£ü[º>s)iAŸž"Yx­'ƒIý\‰çíi½Ém”¿îä ܈c0NËÖqq›]ÖvæmíÞ"Fx¼ã·còdu@Ñ]~ÓæÍøó?±zuÏŒ²FÔK¨‡žœ€›_‡Û_ˆ)Úð¿bXÜ%?öüðǾʬýáÄp¡¾ÊäöËkccûÏÃUX¹/÷‰O:þ< ½ðVèÍÙEjïÏŸaóÛ㯗îÁú—î’Ó®oÞÖî-´w´ÊjÍ®ýMq‹Ì×ê¢N•§÷³§É,ò¦½àpW«™FÖºž ®]»ü1Þ{ÿ}ÙmðÖ[n“v±±±¸ìòË´{5µ˜‰ó×I¢»wUuC§&QÄÙÔøøw¨‹âÚ]¿\(œníž"º¤þç•­m¦¿«?8W”Ô{\ÿÃ;=“U$†GßU Ö·šäÖM+ØŠ´DõB1â–—˜\Y:'ªYK"Ø{ÑE—àÖ›oÅã?o¿ýV.'¢ŽõÝ«Øý$ÒœÅ0»ß7BW>íê!rd q‚$†ýðñxò²e˜ûÅMÿÝÞ~Qì.Õn'6b_UëvRÒQú¯Ù¤®ݵú"“ƒN½B¶ÅˆUËï»»þó –üŠ’u‹Pºn‰œj²½i)†EtÆöÓýu&ÏÅsÅE¦ëWnÑMÌ›Ö]ü)-iÎ 鏯„7bd¯ô+î“m§Ý.Q×?ÿ€W ©/òëÅoýöº’¹~¹Ü/LÝG<£,=|Þ’NMîµ[ú#‘™S´L9áVÄN=^ü‘“mW÷¬Ú¼LTîøK¶víe•u·v»K*G®÷¹ÏEÔü£Ç «/ôø~ö4-üoïþ e0`6«ßñ%%ËÈì;wîÄúõëe{ä(ß©»!~ ²Ö«¯ós³0íœ;5‰QPÑ}ì`tÒøÿCrô0åz@ý Žt(¦S¾S{PÖ¶j¬˜]ÐfÊÞ®v¬«nô¸^Œ€×S–mW»ó&E A\è@Ù—2]ÖàÇfåNÏ#6ö¤qãÆÉ[QëÙYÏ)燽÷½CÔŸô»OBjN½*|8—<‘S£ä/*eEVÌù,O]±ï=º—•(_`Úƒú ‡¶s®î+ž„õlZonA­ ˆ CzhD¨®ruéL7(1|¼+È“ÛþÅ~Bœº¾°¤ovs6úõ„{÷÷ïÁî¥;F@TóÈD­‘µT­)` RÞ`Þ^‘žSãÅæDæ`Žl;’‹)²¹xr{²³Ý†êWëì3åyd\;† XK °æéd Ê›„ôKïÑîÔyƒ%ãøÇ€êI¯p Ëß^š»·b±=!,Ú{0Âm]eqsW.1Œ³KOÙõEy Ôb˦ÐDŽ:DŽç=oî¶óÄP´¢påè1žGQ髜Ú߯öÞãæ^üA¢½‚çá1ÍïñŠâ–“¥Zý¨°X-"²ùûXÔÆèM®¿ aa¾Q€ØEœ7 qœkô´F·ìIo]{ú²/ÊHšŒé#N–íŸÖ|Ú4¢ÔÉ.AB„Z[ð`ñ×Þ¥¨«W™4DÍâ™ªŽžµ5w*뺷žWgDDDÊÛM›7É®šDÔ5ý&À“>1·½:·¾8‡’ˆ P£bÃÒb¼;sƒ ìˆap+Ü.$ú²ê5{Æ S&Ï/Óð!={â#²XD¡@áðIq-º:u•Më"e1ïß ¸+»("¬3€~تW•!‹zmF’VTÚ}4¬¾Ä uÅê˽ÿ²9æ­¥<{cË“8Wñc!ƒ›k˜¸³$¦È.`ÞTkÛœ?­ËWkaCGk­ömÝÖ\ä5-=Mkí›!ç\Ô2sgÓ[É¡äw|ú‚\'j%uºlwƤ‰ñÆ›oàŽÛoÇ›o¾Ž‘£Fikú¾m$  Pϯ‰ÈÞ‰ìýuínƒGxÏÈJÖŠÌŠl°\·aª«ËQ˜­Öz>Y=Ùë+ââbqûí·á‘GÁ!‡4Æz‹x_WkÙyq‡ÿ ±‡/?Ç¢«dþ¢_äòΈˆˆÀ›o½) W>÷Ü,œ{žï¯´jE˜EæŒÑË߯ÄÔÞ+Z“d†9Ès <9­ùýï^T\ؽQÅ&9=Äëã´´´æïãmÛ:W4¿»Ø´Ú?ú¾yl¼YµAœ`lzBº)ÐèÝ3pΛjêš3°#½œ' Òþ`ýM¸%çz½loÍ]‹?6þß­xåY²ÍEÓo‡Iß¹ÌãþÀfoÀêÝ e{Üàé5 ájÑçå;:W¬¿»ôjÆcuµïÖý$ê úM€'utâ“Õ —âü:üüñn:ò4­ÕRÂÑíDŠWÿ)oõ&3bõÚì¯CüŒSµ™öíÚ¹ êÅÎðôößcžD›Ž¤cÏ–í=ÿû•ÛÕaÛóþŒ‚eêPí©çÞˆ äÎD推$ˆ. Çw¬lû‚b­pBŠÅãEãèiQ°tP@¼;%¤·¸Èuû&öE#e‰ Ž»e¿äË[qñ;fºz¿öˆ:k½áþûïÇ 'ž€C§NÅ#3ÆàAÍÅŽ{‹+‹'rôT$jŸßâµ a«*“íΘ6í°™ûÛIZ«ï£¡ âocʨ¶¨á±H›ÐrHòžä¯óÇ!'xÎvœr‚šá(Fîܲºå¯áKUßãb¤°/îø}Ô[ïqwéZÀ½±±ëÿêÝb«¾ê«Ÿ÷È[³Y›/!Ûí íø¼©´\ý^O(¾K;w2›éVyò˜¶ß¡¢{Ö™ÇÖæú?Ñíèÿ¿fS*ëÊñÅÂWÄo°Ùëåðè¶ÆzDÇáì©×i88,ß®ž#›CqÎÔd»ª® ›²WÊ6ù¦~à}Ú×/(ÂۮǬ«–cÞ—YÝ>šDoZ¾®¨©ÎÉWÆ ·a4Åš/>tHÓúžôíìLlѲ_.=sîºfT›_¥DæËý7ŒÁçv|½jCsÖÉÃ7ÃÀ‹r¢®-Øs¨éÛ"Mÿ‰;'"mpL&Ì2R3Z›ïçd¢D;IúÇÕ£pø$÷à˜gŸŒ‹O*ç¶î®À¢U}sXøÊí`oP³ÐRμ -/ "”‹¾‘×?»µyä€È­¥ª/ÎCáòy²7õ8$svÓÑ·ñGœŠ„‚3…+~‡µX½@rîuµËßhBÚ¥w!(©s'â}¼tÉRÙ9*CÞvV@t<Ò¯¸W¶Ë·®Eæÿ>”m—­>‡ÚÂYgÄu3¡k'+É¥¶¦å¨)uµ}³»ž'ÛÖ«ùzƒçß‘“ÛPýiãÃqÆõC›jô–óþ‘ŽØÍÁ\ܹðîár„aþ7ÙòÖÝÒŸóŸ©^ œ{[:¦Ÿž$G!qg ÔaÜ1¸ö©ÑøÛ¥½s¡’˜”¨µÄw?¦1]›ë=‹g+ïà¯7È.ˆBÞûV\¹¶¶å{¼¶nßF :v¬/oúÛwÊUCí6txT¢—ܯ\T÷üŸÆŽ9?‡4g›‰ O¼d0RG©A´¥¿ä¡¡®eŸðÜ¢&‡úzȉ 8û–akù·U •>l\˜ü,ß0«÷»Ò©f/nøkƒò½È_Ô;cËÎ |û«ä9ûo)˜yÛø6?~‰,â©ãbð”rîòÑó‡¸Î›&á¶+Fv*(TPT‡=Ùêa眔‚Sšƒâî‰;& )þà©O÷÷ñc`ôùÝñÅ¢WPU¯þ¨$ä•ïÅ«>’mQç°4µ®ÙÁ ·<YÅ;d;6l€¼]±c>½PxšˆzN¿ ðüòñn|2k3¶¯Áˆ.D ú˜Â+~ø]--þ¨óÆÑrúß;Çâ¿o‹øh3^|£\ß“DÑÀÛ_†ÝYê‰Â…§Á¼Ïþ†/^9ï=3 ß¿uŒîSœ@tfèæek ±zƒZ¿åÐ ±Êó9+¿?K¾9YN÷\×¹“Øí™Uøì;õÒèô|ùÚÑXþí)XþÝ©rJOiÙ}­²Ú†ž[%G ÐãÕ™‡â‡wÃû³¦aÎÇ'âá[ÆË`QEUxveS-“¾¦±¦{¾W¶ÍQq˜4óL˜ù>FßñOL™õŒ¾utæ@l|ýAÔ—ªA*KRÛ~åÛ?YÖª†^p3}þŒ½ûL}îk¤]ü9äxùvµÈ¥'ކzlyÿ)9¹èÊ5Nyì¤Ç?ÂØ{_“÷‹aÛ WÎC£6BVG~úI¢4::#Gv®¨¦zĵ3åí¶êJlzû1å®åI‰ÃZ‹Íÿš)»°Æ$"íòŽëñ|þÅ—((PMNn.þóÕW²í 6,.FqŽz±ž>1|tn}y¼¬IvÅÌQ(̮ÊßÔçÖVýžˆØ9zá­/ÃõÏŽÁýïOư±j†ÅŠ9ùؼ¼m?[ƒ>±Åyu²†Úß/OÁß‚›ž+:ÿx}fþûPåÂ7)#•ÏzW¢Ä]0~Ë¢“QQm³+{šø(^ý‡6§ÖÃ*Ý´B›ëœ?þøSM-ˆ`Ï»o¿#Û¾ ²¤«ç©ïá¨x3îxu‚òþš€»þ5w½9IÖmúñÃÝr}oؼ¼D ¿äþ Üõö$\÷ôhÜÿá!8ò,õbIt?œý™š ÛÚwoíÀ–UêÅû¤câäãÄs¹æÉÑòóòèç‡âÊGGcܱ2S¨7%$$4u™û»Z§¤7Ùûr‘Ä<ýæz,\©ïN;6Yžc|ýúÑx÷éÃå¹ÓÂÿüo>qþväè;ñº~ñÃn”–«?ìˆÚæÿûoÊyÎ)MçMÇOo<»{ï+µ[\â凧â§÷Ž“û1÷ÓqÂŒ$<ñªšíÚßx¦ WGücÓ±-¯íó^¼íWlÈZ.ÛŸp1’"Se»§‰€õïíŸ߶ý¡£·¸Š-»¬ÜÕûÅ•›hË]µÖˆ¨kúM€§?uZ{âµµ˜§uÅ–S“Cd°gË®r\zçŸøkkï@Eÿï¶ùxÿ«í²6¸àJO ÄQÑ”,Y±®?üîù$¶%?\ÿÐb¼ýùùë’x¬Øžºˆ)`†'æ­õx὿PPܹ_Ÿ¯.ÄÕ÷.Ħíj–Àx ÆŒFL¤YîÇâU¸øŽ?°mOs7¨¾(ëçcûg/£±¶~:‚ ADÆ$ð©Ú³kž¼eW(}jŠmxúx8[]ÛÊ‹±æé›îc FXÚXDÄ rç&¬{öVTgµ?²GùæÕX÷Ï ®@=1±$ –uwD–Lþâ_°åÝ'Q_¢žävdóæÍص[½(;ú˜£ämGRÏ»©©†ÐÖ÷ŸAƒÐj­j÷fìÖ†™p=K¶½ÉÍÉÁ¥—\†‹.ºW\vŠŠzn‹î&2ß{tcSö‹èþ‘08ÁáF9ë»ÿ…2·"Æ=mÉyøôÙͨ­²ÉîZƒÒCaT>ç"‹è·/2ñÕ«Þëz”äYñÊíkðçwÙ°Ö6ÊÇ ":1,2 [SÙ€•só•§wºT¾üÒ+¸ãŽ;ñãjAãÆÆ“%š¿°¹ÞŽ>ÝOËhé,1õ]wÝ /ø?œ{îyX¹r•¶Æ7|ûÆY_O¸d ¢‘³«¯ß½Y[{ï;|Ïæ ¼ýÀzù™‹Š3cpF‚ÃŒòoʺ……ʺ¿Údï¸Øêx_ù¼~÷¯ír ñžÏEdþˆÏ‹K|V¶¬,ÁOï{±'sÌÑò¶²²óç7{K]]ó÷THHßä¡#Vå5»é‘%xêµÈ+¬•¯ëA!˜8:Jž;˜ôr´­…+òñ»w}+*µâÿnŸ‡ïçìE‘6„ɨk:oò$ú~ö^¼ñéfå{J}ÿ%ÆYä~T*ßÇÿxr9þ;w¯rœ[vío",1MÝ®D¦ÊÏk>“mO¾\ü:ÊkŠ•ãiÀÿM¿]9íùzubt-ÜY9·÷~ximÍž…h´«ïƒ½E;PTÙ»ÕÝY,jo…ººÎý8HDž)ç…Î6‘‘¢‚|GÆu¨::ðD—¬ôÔP9rÔÞœlÙÕœZÚÛD¿íCBmQNRt¨¨®ÇÆmå(.ëZñjw4로ÿH NÔw¡ Ih°AîK‰²?ídሺ="`dÑˬMÛ»þcBR3dpÆn­CMîÔåw&ÈÖR@L‚¤ÂO¯GmÞ^ÔìÝ®­éq”E % &N[#ª2·v:°ãîoûn½íTUUá‚ó/ä ûCù<% FD¼Y¹¸´#gw5Ê ÜñÔý‘’¡|Þ” ßš v+ÅÞ.z=]^’†#,Ú$‹ëŠ€OQn öÖözwášk¯Æ™gž‰×^ßû½¶´÷${†ž“l/ð"Ôæ¨]B6¢KVbªE&îçÔ!w÷ìFäÄÀa!ˆŒ@C½C\QÒrä¬ŽÄ Dt‚Z´¹¡Á޲B+òw×ÊŒ¶Þ$º¾ÿÁûˆÃ§Ÿ~Š?P»¯ô¦GL—5¯„YÏÌÂo¿õ~QwIŒä„ Ù5ʪ¼®¹5ض§ªKç:‚^9ç;®ßmê¬övÏw"”ïݱÃ#e&O^Q-Öo.m÷þtpIŒÛþþ¬l»ìm™Ít 6 ¯½öŠl¿ùÆ¿ðÍ7ßÈ6y·qÝDÇÆµ‰ò3ÀCD}‚(lüîûï"!>¯½ú*¾ÿ^-&KÔ—Z,øè£`Qn/¾è’^Ïð—eSžøñɨصk¿V]AÔMŽ9æÜu÷2Ø.Þã5 þNPP>ýìS˜Í2ãlÙ²eÈÍÍ“YsŸ|ü©,üLDûïÌC®Á!C•…¦ûújÔ5ôÞç]d ˜'Ûb„GáŠ+®BÖ^µLyç-ÀÓùþ0DD=Èn·ã·ÔZ çž{.L¦Ž Iõ&S€ =ü ì2òý÷ßî{qS—Á!÷÷ïä-QwÙ;þß²ýñÇŸàŽP]]§ž| eeår4ÃiÓ¦áœsÎÆ\ƒ NÔWEÅbbʲ½vÏ¢^ î×ßp=n¾å&ùÙÁqøÞ{ï1¸C´Ÿ˜ÁCD}ʵ×]ƒ¸¸8|ÿݱfÍm)Ñ5~üxÜpãõ0`–,YŠGg>*OF{CxÆ$ø)¹!ÉéH:þ|èäèpËïÿ?@«@ÔD7‰ /<UUÕxáŸ/Àq€‹ŠÌΡC‡ )) – ôz¾ûö»^ûìõ7¢€t)‘Á±˜>üTDGË<ÿüáŽ^¯¿såUWÊ£µ5uÈÍÍQÎùÖ¢´´wê‹õì¢EDDÔE_rÎ8ã üû³Ïðå—_É"º½eÆÛóeAu—ƺ¬{þvTíÚ¤-!""êØÕÇ<„¡ñ£µ9È¿eß-ç€ÕÞ!¢®c€‡ˆˆ¨‹Dí¡ötY™ðÈ{ðó×Ã^_+GÊËžý¬E½3rõgr-’£ÒÐh¯GqU>–lŸƒ]µµDäKà!"""""""òq,²LDDDDDDDÔO1ÀCDDDDDDDäãà!"""""""òq ðù8xˆˆˆˆˆˆˆˆ|Ž""""""""Ç‘c€‡ˆˆˆˆˆˆˆÈÇ1Às€„øë010HNÁJ»·% Ø´¢ÝƒL&õþf‹¶¤q:›Ž‡8>DDDDDDD¾ÂÏétúií&EùŽŒ1ã´9ê ãÌ<•œ"ÛweîÂúºÙîic•÷Ƹ$™´%ªÒF.رE›ó120H¶OÞ²68e»?a¶ÓGÉö'Eø¤¤P¶‰ˆˆˆˆˆˆúŠëÖ :6®MÂ3x"Œ&Ì,ƒ;N§¹ õØi­“Sf½U»WGšã~mBƒDDDDDDDt 0Às99,&lnÎ܉Ëwmà {vÈéÞ¬=Ú½ÚWÔh“Ù> °;ûOö‘/c€ç ’nV»em¨«Ávklï«gr³dW®Kvm…][FDDDDDDD<‘ ^Þ–56Ê["""""""êúU‘eQ$wœVxoC= m²Ýš1Ê+ë÷(÷s'B “,Á²- ×8ˆÑpTH’LFø)ÿí²Z1§² •öŽsXÄ¿5Å‚(e•ŽF¬©©ÁÒªJŒ ì|‘e‹¿? Az@ Bu:Ô8Ê>ÔaQUJÛÙ‡)AÁðwëEuK\ z¬WöáÛÒ"m©Êætbemµ6×’Ø×@¿¶±À¥Õ•pv¢ëñ™ VäÚl²}¤r<‡˜Í0+í|[æV–#«ÕkáͰ³|â è•cS¬lsUuÖv²Pu’Ñ„Á¡H4as8±­¾ó*ÊQ¯WY&"""""¢¾Ì[‘å~à Ñéðåвýf~.¾+/‘íÖ>’޽ÿÏÞ]€Gq}m?qw÷IÅ©·”–ºR/u¾´¥¥J)uêB[êú¯—ºãî‚&âî.ß=wf’ÙÍîf’„÷×g»wg7ËîÌìÈ™sÏý«¸ˆ^ÊNW§*ôïñÐáT pp ;‚BÉÁÖpÞ××ÑÃGÑA3ʼn]llhnhñP‚EzÛ+ÊiIQ=%[ ðœïãK×ø5gßèU56Ò¹Yôsq¡:ÅÐOÉÑès›ci­·£P´³á¨[ì¼½»¨ÖŠ:<Úß•ŸKkÊKéqñ½yþëÕ75ÒkÙôWI±:¥µ ±,f‡Óp7%ˆg,©²‚žÎ8L æ3”®óòR¿²3 LåÔÖÐéiôVÌ@ùè‰0ŠVœìéMw‡Qn]ýX˜OKÄíPµÐñ¶w ûC"ˆL8Ä´GÃ[‚;~ò13•Á3ÆÍæGô“í-e´ ý0U6)æ(ÞïañoŒõ𤪆Fšqp5Zî2öqL9:Ê€Îóâ;uÄtߺ.P Nµ7ƒ‡¥ÖTÓƒ‡S¨D×µì"º%(D¶?Êͦÿuã€Ù«Qý)ÎÕUŽöTÆaZ'æ‰Þp7z2"ZfZ}WG‹ó²ÕgÜÍ2£‰ƒT÷‹ÏÀÝï4§xxÑaÊ2cÈà€ž<PZ_OodgŒÅíOós”B¼‹«Új1ÕKɨ)o¨§·s2 êÔpûÝܬ6 _ë$ïù3<ŸyÄ ¸Ã8°òJV:Õ66’‹-áí£>Ó³½&>³>¸Ã8“F› &æçxwOÜaߊ×w×ßùUíª6EÌ 2Œ[žáåÓÜ]í-±LôÁ¶´¬DfòôFðX°±¢ŒªLd¨¤ÕÔPš-è`Ø¥ˆ3kÕ`ÄÆŠòVV#ÞsMY‰ú¨5.Ü_ tü^\HÅf )sÆN’šùc®.MOÂÝÊ’Mtñâ wcc\óÈw•c\§çë£ì•ê<å.m\ˆYo„: ÄgØUe˜q¥YZR¤¶zx,H¯13ª“ U6*®ƒ£áè$ëÉ0-haÊ Ï%º´'vWWÊnaú—[æg©ðT,ÜÁIÞ÷déFɪTƒX.¶ü RfܵŠ3—ÌÍ ®•¤ srT[Šh'eþ¬6ÿ¨õ•zx,Њ›Ò$þSvâaÌ5…uæ»aYꢥaê‰ðhâ¡»õ·_ÔÛÏñƒiª·RËÇþu`¤§±àaÛ*Êå=¸t Ù¨™0|±?åí+‹õv¥ ódw1;z(,Rt4þööô¨˜ÖVÑû¹Ù²vŒ«½CãÝ<š¿‹&@¼ïEâ;-ŽHã,Œ:Ӯʊ摨®¦Ñ®îä"¾'2æ›:ÛÁšjú³H òp€nvp8ùq8—h¤ø,sBÂéå¨Xe¢ÎвbÊQƒS·†Ð±~hœÄç¾[¼g´³³: w±ijjjÕ_%/'»1qØõQïîèD‹¢û7PŠëê©°¡NÖWᡲ¿-È¥‘nãìBÑKÙéòuO;;úzÀ Ù~;;Ó X¯Þýãåpæ¦ÞƒM÷  ë•l“ú¦F:XU-Û±.ÎrT¨J ét/_9mNZ í¨ªm½1nî47,ª¹XsI}eÔÖÊq ìí)H|WÍ‹™éôwi‘úÈ´câÄß8Ò%Eô|VëÏl­Iîž2peªÎ‘©yövô»¸‘½=××Sru%Utq×,S¸ÛÒ gWòsp Ò†zJª¬¤Ê¦öî5ÐÅ•|ììÉ^´K(­¦šr»!Xe‰³ø, wR…ø\UF]ɺB¤£“¬MÄ™75M ”SWG‡Äüà@P›Äkâ\\(D¼G]cí¯®:æóÀæ2xúl€ ¯9nºhoàèåàèåàèåàèåàèåàèåàèåàèåàèåàèåàèåàéÅœÃÉwðXy먎¼‡ŸŸ 6ŒbccÕ)ÐQ‘‘r^†«SÚž^,dÒY4töByë¨ö¾‡ ÍŸÿ-\ø< 4H &çåóâæäì¤Nhx ]Î>çl0pedfÒo¿ý¦N…ŽZ»v-%íÞMAAAtÅ—«SÚ°š““]}õU²ýÍWßPCCƒlÃÑùê˯äýE]L>ÞÞ² Ðð€ÕN=õTY§ªªŠþýï_u*­õë×S^^¹¸8Ó]¤N°<`µiÓΑ÷«V­¦šêÙ†£×ÔÔDÿý·T¶§M;›eÀZ}&À7Ò‡Âx¨zGŸ š0•b¯¸ƒn}ŒnyœúO¿‹‚ÆO!{w/õU–ÙØ;PÀ˜ÓhÀ5÷Ò [çQÌe3É#&A}Ö:ñqñeíöï?ÖgïxÅ ¿“ÉwØxjR§™bçä"_Ç7÷~íûlÝÁ%$ªùóñgm _~­GŒu…¨ÿýçyïááAã'Œ“mkÙ455Ù¨ífy9Ù‰ÃF¨z‡sfô£“.Œ Œ”rÚøWm^šK5•ǦFL“ zèmòŒ5rßP]I)ß½Kÿ~§NiÍ54šÿßr ‰R§´8òçÿ¨±®†¢¦]'/›1YÞëŒ÷`·ß~]xÑ…T[[KçŸwÕõwüGœHƒï|J¶|õ¥ÿù¥l‹¿é ž0E|žZÚòôL*OÛ«>Ó3x'Œ¤á÷¿*Û{?z²Vü$Û¦xôK Q¾+Ûþ÷¥ÿ¥ÔØiË_~Nþþþ´bÅ Zð¤2Ïô’¶o¥€ àV ;}&ƒ§¡NÉ ‹q§ n@~<–.½'Ž¢<åôîdccÛÜ©È?œf¿1Š&J®öê«»XSå¬û›6>vm|äÚûѳ”¶äJûéCÙ^ÿЕT”¼Y¾4úüdïÖ:Õï›ÈÑËO¶÷|ø,í|í:üóÇtð«7iƒxÏÒÔdr ŽÏ›ÓïÁÜÝÝ)22R¶÷&ï‘÷íqðë·ä¿ekï@ƒn}œl]ÕgˆœÃiàÕ³d;wÓRÊø÷{Ùîi8Ü’½òÙöŠM$—àÖQŒ»ÃŽ9M¶ó·­¢º²bÙ¶†àq÷ð È¨¶— €¦Y¶¡”%ôÕËûhÁ5kéë×öRj’rråFçÝÜŸþh,M¿7Žb†XWÿ¦Ãš)ùÝùT‘~@`¨±¶†ýü±lÛ9:‘O‚’£±ut¦ÀñgÊ6gŽd¯üU¶5 U´÷“…ê#Ó:ã=4ÑÑÑj‹èð‘#jËzM õ´ûíÇ©¾²œ\Ã(þº9rº=%Þ6Of3qvÌÞŸ“Ó{ªì•¿Q£ø.,x’é,ÿá“ÈÁ] ØñëÛãpZ˼í×/Fm´­xZÔT7Ò¦¿shу;è¹›7Ð?_¥QQn98Úш“ƒè¶§‡Ñœ·GÓI…‘»w7eõ©ÌHU[DN~ÁjKá;˜ìÕB¾¹ëM4®HÛG•Yiê£Ö:ã=4ÁÁAj‹¨¬¬LmµOu^íùàYÙ{Ÿ8b.½<¢ãdÝÝoÏ“A§ž¬¶´ v¬•íà gÙ´þùO8KÞWæRÁ®õ²m­ÒÒRµE ¶ÚÖ'µÕZg¼‡ÆÍÝMm‰×—v,ÀÃò·,§ô”¢Ò®šEág\&Û¾y‹Êµ¿ë×±µügyïäíO>CÆÊ¶ÆÁÃGL#ÛÙ«~ã æ²m­R]ðÌÕ­g=[Ÿð4çÚ¶Ó²oÐÖåyêDNÂèšb¶<êÒØg¾”EŽc.º™BNœFcN¥Àѧ(·Q'«¯lý=½ÕQmq¾Új­¶¤PmµÖµ±S[Duuuj«c~õ•¥î!;GYH8wó2ÊTƒ>½AáÎõ2;‡…¨Å”5A¦­=555QöêöuÏbu55j‹ÈÁ¾ež´å¸ð¸y9ЄsCé®—GÐì7FÓØ)!rzia ­ý5S¶;wzÏ ²ÞLCMµ9kÏGÏÓÎ×¢¯Î‘·¯ÍU_M­FLâB½š¦ó•F Á–ÎxMuuµÚR . ÎiilÔÂÕШ6z‰¦F™Ãü‡O${÷–zNÁ•îYE»7É.iíåáÕò^UU-ó -}6ÀckgC‰cýèÚ‡ÉâÊÜÒŸÂû{PccíÙXH/H¢§oXOÿ~uXý‹Î{émdëàHµ¥Å´ññäÈYÙ+~¦‚­+©pûZy+Þ»U}ukÒØ©utL±stV[­uÆ{h ‹ Ô‘§çÑ ;Ïó†G¡jR‡Z符Г/íÞ"kå¯ÔÔØ(—qÐØÓå4÷¨8r•m~¾#<=Z‚g-ó -}.ÀëNçßK|<–®{$‘÷'{{[*Ê«¦¿¿H£gnÜ@ÌßEIë Hœ£w:['gòì?D¶3—ýHÕ¹é²mÌÅ_É"RfðÔæ¨-"'_ÃÌzÎþæŸëŒ÷ФÉP[D¾~>j«ýüFL¦ˆ3/—íƒß¾CY+”aÇc§ßInQe»7¨)ȦÂÝ›d[MK+®\W^Bù[VÈv{ùú*CÚ³ŒLÓë €)}&À?Ú‡f½1Šîye$MŸl]åóÖ8gÚ9´`Á“4sæLruµþï: gd1¨äÞ/AŽ ÆrÖþEMõ«S§¹¸†ÏþýeÀ}&À;Ô›B¢”Ñžò³«è÷OSééëé“§vÓÞM…Jñ—nPWY&OЙ{dyoÌÁÛ"Ô¤˜½‹a]›ŠÃû©J­á<ùl²±k=”{à §’£§ùlšÎx½íÛ·Ëû„„yßüo'Þö9¸yPMI!íY¼@æ,5ÖVÓî·Ÿ †ÚY¯(þ†•?hà cÆÐÝwßEcÆŽ¡ .<ŸfÏž¥>Ó}ò¶®¢šÒ"ÙN¸qnó|ÌT?/ï÷íÛG•={ÈxèYúL€§¡®‰v¬Ì£Åî çoÞ@K¿>BeEˤ8Õ•T–’,ÛÜ}‡»%鹆FÓÐ{_’£\5ˆ×2Gß@y¯wä/å½ |ÜôÙêjåp°W·ÔèŒ÷Ь^µFÞûúúRhh¨l[+ö²ÿ#ϘøÚóÞª+S#¬"ý üúMÙ<á ;íbÙ¶$<,Lm)&NšH-E¥»EC=å¬þ]6ÝB•!éK&QeFªl·—«›õ‹QÞgݺõòÀZ}&Àóǧ©ôÙóÉ´[±xÔ5CŸ[‹õudkï@Cî|šÆ<û?Ôõćt“ŸGä:´äC™ÂÜÃcä½^æ²%T°S9Ñ{MxùG>÷Mñ÷ŸÒȇޒ…“s7ü'Ÿ7§3ÞC³råJ*/+“í“Oiâ½-þ£N¢ð3.‘m8%m”m½Ìÿ~ób¥lÇ^6“Ü£•LsÖoØ@••JpŒÙÙÙ‘¯¯ú¨ûSÎV>q≓ÉÞ^ɲúïŸå=€µúL€çXuôJöï /Ï¡Ê\¥81gÐø&ž@ý©¶(’ß{Š-ù€Š’”B½NÞþä%ÛÍš)éÍG(céÔØPOö.nä=`(¹…ESx¯=Hy›–©/6£3ÞCUSSCÿü£ƒN;íTyßg®»£v»*MM¦”ï˶){?x–ª se=¢ÄÛŸ ;WóñgfdÐŒëgÐü'ž¤ÒÒR9­ÞŠáÞ;[Uöa™µÃêj)oãRÙîˆÓOWjølܸ‰²²³eÀZ6MMM­"#y9Ù‰ÃF¨ ÃllÉ#:Ž\‚©©±ªó³e CÌtõÖ±w÷"ÏØAdïâ!3@"ñ~íÑïI‹¿C¶¶¶t÷wSòž=ê3Çwkúá‡ï¨¬¬Œ.¹øRuj7²³§ /~/ëïän\J»=¦>Ñ>¡!!ôáÇ’ ͹ÿÚ¶m›ú €¡¤í[) (¸UÂNÊàéš©,5™r×ýMyþ£²”Ýíî°úò*ܾV¼Ï_T²wk»3¬3ÞãÈáÃôßJÏÅ—*Ý®Ž¥ .8_EV­Rººu·ÀÑ'7WÎ6ê®ÕÓ¯œ.¿Ç¶­ÛÜ€A€Úå£?¦ªªjš4i"ÅÄ´®Ô]ÆKW]u¥¬Åóùg_¨S» uîµ²Í]ñ ’6Èv{qöÎi§ŸFôî»æ»°X‚´Knn.-Z´ˆÖ­[GÆ S§všù3é±Ç£úúzbÞ|ÊËËSŸíZ\SÈwðX šp »ïåæÑ³Ò~ù¤C™Ylð!´aÃúàýèÀêT€öA èU\]]é‹/?—Á×^{ƒ§¥©Ït½Èi×RÌE7«¹ëÿ¥ÝïÌSt-s5xà^'00Pfu·Ï£°Ó/¡¦¦ª-Ì£¼MK)kõï=hü6èëàèå0Š@…@/‡@/‡@/‡@/‡@/‡@/‡@/gÓÔÔd£¶›ååd7&¡>ê½N?ý4²µµS)ÊÊÊhíÚµê#°–§—0z”ú¨Å‘ô Ú·w¯úºRÒö­Ü*a§Ox~ùõgrttT)¥¢[n¹U}Ô·yÄ "WõQ‹ºÊR*KIVY'!>ž^}ýUõQ‹%K~¢7ßxS}t|JLDvötðÀª¨¨P§_œœœ(N¬#b{B»vî”÷ °sr!×°h²wq'åx¼<3•j seàh8zú’KP8Ù::‹õK9µ+Þ¿kªeº‡­£y *ãå)T[”§>ÐùŽëσiO²ÐÈÏ/ />ÿB¶ûº¼M^1‰ê£ÅûwжgþO}dàà ºìòËÔGDS¦L!‡cà±ÎÏPÊ)IW§'N Çç=N999t㌛¨¶¶V}¦ý&¸{’½l¬©¢=ÕU²Ý•¼íìèOoJpv%o{j¤&*¨¯£•´¼´˜ªÚ¨yóÍ7hÀÀôÆëoÐO?ý¬N°žs`8ù j)h­ü-Ë©N¬·zMâ@×oè8òM+~ÃÈ^œdÕWWRUN:•¦&SQÒ&ª++R_Ýš«;ùK^ý‡Êƒg{qðV/~|àV°m5•Ü¥¾Ò4ñ›öˆŽ#~ƒÈ-4нüÈ^¼gCU¥Õïa–xï‰góQ>,ܱŽj sdÛXЄ©âÀÓð‚‡)%â„ 2ãú¨çóŒLn±²Ý(¶¿9k~—mèýœB©¶´Hœ vý¾°+ñ _ìwPȤsÈVìgõö~²²–-Qu-Þ–Ù»zPM~–:ކGL¹Gûƒ2ÊÛðŸ:µm.Á‘䯜ciËÞVƒ;C¶ ¶¬ë}¡l[ÃÉ?„âox€|Zï;×?t5Ue§©z¦@ñ½íÄ÷/;´—Êí‘Ó¼FŠýmÕåRávë{]8úŠýýxÙÎYó‡Ø'ÔÈvwòËaøý¯ÈvÚ¯ŸQêwïÈ6[;r ‰èUÇ&Ýå¸ð|ûÍ·ôթÇ~—Ü.¯þCÈÑûCcßÿð¹»»“ϤøsèäAçÑÁœ$úrõkêÔîÇ®÷?x_¿^\ø"ýùç_ê3í—èâJ #cš¯º|[GïåeËvW9ÓË›n #;Ó¥¸ŠëêiaÖÚTY®N±lôèQôô3OSyY]ý *--UŸ°Nà¸3iÐ-ªÚoó‚[©,e·úˆÈ-,†n}œÜÃcÔ)­556RêïÓá_>Q§´ˆ¿éa 8áT²s0)ܽ‰’ß{ŠêŠóÕ)†FÏÿØâ¿ÏÚzs"§]K1ݬ>"Úñê³Ã^ûC±ýoËþÏ_¦Œ¿Wõ|#~›¼b[.d¬›sUã¶Wã@oÿËÿü†M  ]IU¹ê3½SÜQÈÄ©²]WQ&OZy»Ãx»“·i™lwÎ船l&O<‹|ùe¯øE}ŽF¿‹o£¨s®¢Ê¬4ÚððÕêÔ¶‹u!^¬lÙŒÉòÞE‹}ö²½UŸ—ˆãtkð„žü„\ƒ•cýšÂ\ª-/‘m¶ë‡{|@oìóß‹0¥.ùÒ–| §Åßü(?Sîw,œ%§YÃwðX:{¡l¯¹çüvÊ:‹wÂh~ÿ˲öëç”úÝÛ² vú¥yÖT´wíYü¤:4æ<¦Ïì OHýv%½þPó­¯D>'ÇO#/7?õѱsδsdp'77—þùç_ujûqÎÎÝÁaÍÁî0ÑÝ“f‡ËàN}S#ý^\H¯geÐ[9´¼¤Xv±òv°§Ç£¨¿“‹úW–mÚ´™öïÛOît¹.Û ÀZu5TSRhò¦uûkl¨7ù<ßø9sP àµæàJÙ‘”ñß”òÝbJûí yàØPWK6¶¶ää _c,xÂYÍÁ>ˆÏ^û¥ÿû=l[C Õ•rºï q0wßËdkæwbk§ÔãÏW°se,ý‘ÒÿùŽò·®¢z5xª¼ÇKòDÌZüý¢¦]«>²^CMu«ù¦¿5ô¢l òŒ¤>RøPN˜ ÷ò0„üGL’¿ÍÞŽ×ÑàñSd;gÝ?â¤ó<ÚôØõ´yÞ yëêàsðô¡ðS/”ًзðïD îìÿüZ{ßÅÍëß­Õý8£«¶¤@îOùŽNø™—‰c´@õX €°ž_|‘lÿþûÔÐÐ Û1Ý/"œiW…u™2áÆÀ`Pâ“æ¹‡Ñ«Ùô«ØýTTHÏd¡³”®oŽâ{^`ý†õ×_“÷ÓÎ=—<þ\óÁ³ÿ`r Ž”E<‰Ìop¹¨šïqäEMâ_K××s ¥ÀN•}v¹»€ßð‰ä3Xê«.È!RO ¬<ñlrö¦êÂÊ^¥dZtÔåW\.ëíÝ»—6nبNí a#)È+‚=ÃämpäXrrp¦Êšrªª­lž®Ýjë«©¦Î|7/W?{2éêw%FŽ¡(ÿäîäEeUÅT×ÐvQ¶Ûn¿•ÂÂÂ())‰¾ýö;uj;‰õˆ»@…8:ћٙ”__Og{ûʧvWUÒ+kß´ÿ{Ú¿³¡¼Œ6™ÉåêNáNNdgcC?P­uuuKQQQäçïG?·³Ø2gFE‹¿mÿVMM÷Çã"”£O¡“Ï—¿7ŸÁcdjhMAn›]W¸{ïÐñò÷\S”§\©µµ£€N¡P± ïÇÛ;7ªämƒ‰ùéäDÞñ#É% ”ªr•,*þLü÷!⤞ëÁ¸Gô—Y)\ÇÁYXxðX 9é< ž|6ù˜LÑeZK§q‹ØüYkÕº0\ð4ô´‹dpÁØñ=#Ås&·[]!òì«ÉÖÁ‘jK‹eÐįØÁÍ—#¿I•™–»§šë©e ™Ã©ØAãÏ™Böb^ùãí¾BßTWKAãΔïÁëKúŸJs¸ËÇ;Ÿ‘™+;_}P®o¾ƒ•`VÎú¿ÕýNkSÅþÐÉ™ÊíiWÑJKœ(22Š*Åöª¡¾ãYŒÁ¿·×Ü+ö…ö”±üg*غ’ÂϸTfK”§§˜ ªi:ã÷Êø·Æ¦°Ó.–Û ÏCdÐøßð8\þvjJÄï¨Q7ììeÒ%0\Lnëšéß‘Wür Ž뾓A1poòïä@UÙ*¶YS.'ïè27ƒê+JeÁÑÈs®¥ÐÉÓÈ54ZÌ—r}3K|&Ÿ!cå÷çío¸…ÇP]E‰ø· ‹—ëq@• ¼rsmýã´á§_*ŽÎ!¿!ãeañ þ6µ>fáú#<ŸxY𿞱J×;þ'ŸÀæçøÆ«ó3åó]¥£ÛP®ä%–Aówé?ÄâwámyC'oCeaxñÙµÃ]Gú‹eɪžÌF?ê?ߪÅ:¤_?= #w±pñi³’«Gó¿ÇïQ_Q¦>#Ž¡£ãe– ÆÝUx½ =å±=üGNÇÊáòXVëòÚç€ šx–8.Ÿ&·›^q#äo´:/³9ØÞ]|¿·¡2¸’ÑŽì÷Èò»³CK>”÷ ?ýÙæãssÅò=cå<Õ–à"æ ¯G¼Ò¦k7ÁÉÒ>ÉM|–ГÄñŸãˆã ýÉÖÞ‘ªÄü4õ[5åhß#üŒËÈA¬³œZ²WÍÄu’8Ö‰•æO9ͼ= ¦lóþ¸»ºkÛ@ãùÏû#KÛNSx»-×q±Ýæý¯+¼/â®–5☫+ Gó9'\ÀÛk9ú—Ø'úŸL¡§^(ÏC½Äv3f­©s×Ñm¨ï0±_í×<ĺÀÇ.¼]©ÛJýüå/ck·}ÑÿÝ~¹¹»?¡>l†"ËfXªJÏŠ÷ï¤Ý‹k>ùÑø‹ƒÃÁ·Ï—ím/ÜCÅÉ›eÛ>‰Œ»ö>ÙÞ8oUÞ/ÛÌ5¬ ¹ëYy¢goøö~ôœø7¬ ^ Ÿóº8yÞëŠ,/˜þ9Ù[_›âËU¯Ñ–Ôê#C§ ¹„Îz ÙÙ*£Ukh¬§wÿy’Rr’Ô)­q×£o¾ýZ#>úèãÊvŽ—/ÝF»*+è¾´ƒ4ÀÅ•^î/ŸëÊ"Ë^vvôÕå€ó¯â"z)Ûô á‹‘1”è*œÄAÓEûvS£•%‚¦NJ³fß#Û7ß|3¥:,Ûmq'‹ ¾@qqq2¸óì3ÏÒêÕÝ—À'hý.¼IîØŒÕ‹HÊ7‹(ó?óÞfŒþkÙæb¿u¥E4tö‹ÍýãõøD<ùe;¡§_ä®A+o=|Ä hâ­Ëà1ÎüÈZñ“ú¨Ÿ` žù„ÝÔ‚](ùÝù2{Åœ¸QȤ©T°s=í|ù>Š:ïŠ>ïúV51ø rÓ3º¥¾×¤7~—˦<=•6=f¹öŒÿÈ“hð d{ØFveQQ}‘ßåb™Y<6cüÂïd ±,mm~âFuªiƒnGcO£´_>¡ÔïSø”éÔÿò™ò9kŠ,g,û‘öò¢:µã¢££è¹çŸ'oÊÏϧû23»ö¤[Ïoø$±|F¶7=q“L‹óìÿÈ50Œr7,¥Ýo?&Ÿ3§3~¯žÞb={FœÄV§´ÈY÷7e.ÿ‰F<ðº|ÌÝñôõ0ìݽhÒkÊz¹ÿ‹×̦òy 9‰}EÖªßiïO«S[ yÖWUPÞÆ¥ò„WSW^J;^¹ßù¬ü[M™8ÆØ<ÿfÃ@“ŠG~áã)Î_ÔÊZù íÿô%“'‹£O¦Ä™OÊ×­œy&õŸ~— +KÝCÛ^œÕ* ¡_‡­Á¬ ^¡>ê|G³ <û*йä6õQÛºb-Œ~¬}Ǽkî½È`8çè n”Û|¶þ¡«¨*Ûü~ÿ4çh¶¡“ýÕ®za¼Žå®ëø 7½Š,·ohG=¼¨9¸S”¼EFÙ¹VC8xæƒ.8üÁ7ZÖ,ܾFp± ±§Ë{s‚ÄNUd¦w˜£§Ÿ îpê>ÿÐ¸Žƒ,ú˧âàõ?­äç‡Üóy¦þUß´=u5mIYÑ|«©¯–Ó Ês ¦k·‚2ÓW>FÇžBg ¿BwJ+ iõž?è—ÍŸÒo[¿  ûÿ•ïÇÏ9Ù+Ý—Ì9j„ î°}{÷ÊûöâáÐo ¢±.-Ê'E6VFO:AICT‡`îêFN&þm?ñùbÔu{eY‰ÕÁÆY]šQ£F«­¶|ÒI2¸Ãœœœèú땃Ëîséí²f‹¼jÁÝÓ–þ(~oïPúßßPua®ÜÙ ¼z6…žr¡ú–9‹“Çás^“'‹5âÄ‘‹òòIgéÁÝò*£½«å.$\Ø×+n8 ¹ã)ÜáȼÍË嚘ƒ»‡¼×ãξ޼SåmWêˆíÆÇ2xÀü¡a÷¿"¯â¶ÅÑÓG^¹éwÁ >Ë“ŸŸ¿înÀ™„vN®ê«{ÎRÔðÐÄœ™Ð%xèÎ % À™  îp B+ X˜´IÞ›Ã?>Yâ+Þ¼/è{g7ã“2>±û)¯ö­¿äÒKep‡ùûûÓEjM²îÂWÿ^ËÒ”mN¡8hd¾CÆÈÑe¬Õ¡ß«XöCî~¾9¸Sš’L‡~úHœÄ~$)<ä±vÒÛ•xûÀ™6üïf­Vê'9¸{Òðû_“Á>nÉV¯€{DhDž©‡ÎzAw¸–Nù^9Þà¡‹9[Œ6 â¤Ë~Ý€+gÉ×òÕx.fžÅÙj×$®GsÑ-²­W‘uH0×nZm+–·u¥Ás|ËßbúNg8ÚmhyFŠÁgmë»TåQŸí<õ%ÿFžn~•L2xN»qñu½¬•¿6w倄%ÁΖ÷å‡÷wô8‹hðÌr}ågy?Ë öÎ(xÐltžÏÃf¿Ha'_ ƒ;|Ì|ø÷/èàwïÊÀ'_€áìt~ gŸöe|ÑX¿Ü8ØÉ8H¦Ÿ®ÝêMdr.âà;ŸiÌðñ"x[‘¿mµ<Çá^<Ô7énJg¼G_Âǹëÿm¾ñ÷o¯ IgSÌ…7ÉàNMq¾Ðáà×o)ëùŠ_äE}~Îι닥ó1IÂ-Š}Æ@Y'—mîÆ¥rÿÀø‚'4˜r´ÛÐ<1ÿ Öa5 ‹¿¿~ºvãì=h ‘‰+^ŽÞþ4þÅïåïè¸ð§§aò¡éÿý`rè\'¿`ñ9ß&Gq`Ζ[´>h2Ö[3xŒÍ½`ùzÈ`N{†IŸ}îKâIù¥YôêoPuQJŸXøqaÃeð'«ØüÕªÛo¿.¼èB¹¿ø¢K¨¼¼ýéÕ„FÐ$±\R˜O‹r•«ºÄF»;2xXœø·žŽèGnâ`i}Y©ø bÃYW'Ÿ‹ur¦;ƒÂ(ÞÕ•òÅÆ|VZ å‰ß‚µ8øõÃ?È:<+V¬ O>¥>cÙ´iÓè®»ïTedfÒ ×Ý >ê:œ:Tœ¨±Â¤´ëÍG¨Q—îiãàHƒoRœDMQë¸Ì «„FŸÀA>i<ÀWæ—/1èϯã÷Êü§u×>ý•=~NkçÁÆWk8š»êäoY®NQè‡ã5îš?Aÿ+3/“ùÎÔÐàLÛ†Õ–Ëmwqâa¼ Òrmle7¨ÒCÉ=.ƒ‡?ÛØg¿l΀ä´}ÿž8ÐØÔ©éÍú«v|‚}è‡÷eÛ¾âi#þ³urÛðä'-\,™—÷–§n—]kLá¿=áÉOå•N^G¹ 5ko)¼-ËÛ¼ŒþïM³]Œ=üðCtÒÉ-5ƒ~ÿízùeehخƩß8³ÅÓGfÊð•@æ7l" ¹ûYÙÞþâ½T”¤|L9Úß+Ý:àÊ»dûð_Êñæƒ)±þÅß8WvÙÒtUK~ïiÊY£wôWø·>wgó¶cÔ’GDy*~ >³àSùÛâ,ˆí/ÝÛ*[C?ÿŽ× B£ºOÆW¯³R=}iÄÜ7e‰/N­ºû\‹ÁPývpýƒWtë0éµ ÕËï¢Ñ¯ëíÉh2ûEy"Æ]×Þw‰˜­»ÛpƒÑ¾+ÛÆó‹i<Œ3S9CŸÂŸ/¨ò±,_LáyÄ% ôxˆ÷ȳ¦Ë6S~Xløõ ¢á¼.»*q@róü›Ôgºïƒùd¶Q;U«]ª­Á]è¸k%«ÌH•÷vQ³«ó²Ä~Ê0àf޶¯æáÑy-k‹×Ç‹¿cÌM~_£éÎSø÷<è¶'dÆ®¹ šÎx É]mù¸ª®TéÎä(æo“ä¨VtÒð1““ØG²Ê,±3‘­ØNZ¼L#Û“Á3zþÇrÔO¾X´I¬ÃÆ]Äyç.Oüi« rGi<Œ“¶‰åVžš,3>7åߟÿòñòŽg«Ï´èìm¨–áÅÁ “Þ2x¬Ä}é9¸ÃŽüñE«àãzæÒe›ûHG µT1¾Š¦ÕF0ÆWMùĉånø[Þë•L’é÷¦‚;¬¦ ›2—)Ý3øóòN,±¡ Ï0ÙÚ“±µup‡‰Å±7s›Åà‹î×OÞw(¸3ÞÍCwŠëêé“|ëN¦:ÛÞê*Ù-l{E9õð¤bãéÛ ôÃÀDz³ßêïâL«ÄŽöñšöwXcc#ed*±1ê¼²ÆÊU+eWÍ’;7mÝœ~(ƒÜ>yñ|ƒàã‘=>+NùJcÈdåj¥%|åjÿ¯Šß袌VLwŒ9ûÓŽ—ï7™ŠËÈÆÁ.,4F9æ+&ÆÚ¼µá“Ð*õjGØÉçËQK8 À}ž·¿|_ë>×â`?{õïÝÜi7ñÙö~ô|óÕ&>±åÿ‰¯ÿFÃʼnf¿‹n!ÏþCäsÅ’œùÅxÝáѶÚ2áÅhò¢¿hâ+?Ë“¢ˆ3/—Y|¥Ž» ™ î0Î|àƒîê w:‚S¼«Ä Deö‘ælSÞqí©Q½G.!QrZ[~ùõYs‹q—Ê?~ï¾Ñ·¸F w˜–µÃŠ÷l‘fl­Žü^ÃNU²ùø÷”òí;-Á&Ö?ÚtW]€Ò-'Ìåj60g_”ê²G*ÒSä=õ"ĉ3ŸH1N¹7Õ‡»rv ;År¦§Þw9ânGþV vή²VaOÔÛÐÞ,{…RCƒ¾ƒÇȶ1-»§¡¶Fœ€µ>–ÕËüïûV]ø÷ÅYÌÙ7P^ØÔã wŸfœ–òý»­£…9tàJWHè8òˆQº w5Hp€¦=ÁÆ]ùï´àãý€6ÍÚàNGi¿áºŠ2Ú÷éBƒÀ ã¡û9pÎ|&—àÖû„ÎxMuÎù½µàãî‚<­=ÁÆõX´ùx¬‚;Á-ÜÔ}oÁŽu&ëÿñö§p×ú. î;üÛgÁÆç¦ù[WÉ6wM7ü%bÚ“`®ѺUñAðá_?—mSxãÅøÀÈ#:^¶5¼Rs194ö yoLKkäô]ŽÖwDoÀTN¾JÄÌij.¼ìïqtó*(X=«¬Ôüɘ9.b#>3XÉ*ø@ì¸*ÚQ$»³ˆu|£Ø9¨'iî|ÉVÙ$dÕÖÒÖÊ *ï`ѲR¥Èb@` ¼·FIq ÝzËm2ãçŽ;î¢P‚¨]‰:<Ô”îÌåâ„Uw€¡ÇrÚ)gðµ¥*?[Öß8¹ÿk׎Ü;n„,BÌrÖþ!ï[<œ>Ì8—‡÷n ŸÜ5¥ï÷ˆç -%˜q×7ïC)jÚ54ò¡·ä3k–§)q7ÌUºÑŠ“=>g±¦‘%|u\9¨7ŸYÄWÉÃN½H/öþª:µ}¸N ×…[yÛ2 mÃCWÒÊ;¦Ò–gïÝ6˜£§·ìFaÍ×öm;èæo¦§ž~šnºéfJÞc¹ÎBgânmŒç}‘.ÀÃ÷%û• w[²V{¯\4Y«ÕÃ]¹LHði|åº;p¦F+èÉ]_ôõr´õSóÖÑºŠ—¤$Q‘™ÏËå¹›” "q¶Ôå1Ol·L)×ý}•}hOÓUÛÐÞ*OœÈqHfª›g©Ç²ÜmŽ×yK8ÓÃ>žÖ $w!ôu¢Ün³Ã¿~fHÕ)ر¶¹›™O‚õ]Ã7|Î]%Yþ¶UfÈYÛRØØ7Ñp~vÆ{€!ZÖ«¸X}OÀå@LÑ‚ý¬×Ȱ í9à1Â#`0¾ ÆW칟½<˜7ޙɛ½ƒµB£¥U6kjlþaðÈ<’†×øñì,§ÂPœ–0úêwñ­7c. ºm> š©ÜÂÔ4:ÆW“Á²CyJ†øð‘té¸Û)Ê?Žl;9vwS Þ–•Y>˜1eF@ˆ_²Ø!rãc%ÚщވêO7†8dú*?—žÉH£ç3ŽÐÏ…äoïHw‡ÑKQ±`¢l[´à×Òqp°þïyžr·®ŽÖ6j/¯-ÅQKîP~ïf~óZ?_¾Úß–¢]ë[]el/»=Ü"bÕ–˜‡ZN¦ŒiõJ˜[„Ò%Ð’ÂëÕVïS–²[-æìTq@]Ëêaœ=ìÞ—dß÷öˆ:ñ¨Š,í§äNÖàtgþ,TI^¼@¦8óÁÍÀkï¥a³_’©û­ˆõ1îºûÅzhGGþüÚb±SKöö’ zéOúy墤۞»SÖ›anaÑä?ÚºáÚ3³²hùÒ唓ݽ™ˆþÕ«üGö·*¢Y”¤¬¯œ `m=Žöþ^Ý#¨-±Ž6¿­ª8Ò=WZõËT[¿ë »@i™M<º†UÜ5†•ìkcû§^IçÑLœÕî%¦Te›®)Ù€šî¨!Ñ]µ íµÄz•½Z)|ì7b’<±×ã,9-`ÈE¸-áN¹™ œÑ¢Só(>z< ã¿/Ûsýúi°ŽÚØ4w/u i](úù«_é/ŒðÈzñÐZéþòÞoèxŠ»þA9š•\ß%Ó×tm›zÝÈ»ÆçžØ†öðqTGœàÌÉï-Sn‹—ÊÛIÚíÝÿh–”mã&ËVS9ÂÉ5>ôtYB|UÕNKðÒ”8s>Es5…¨Cµs*=߼ㆫ¯ä ®X”mùiÓGTV¥\Å3à4ºcêS4ÿòOiæ”tÞè¨u]6´Ëuu†)©mIµçøøÊ!ÀßÈNµ‹^wã,¢ÑèèH…⠦ؘŸCËËJ鿲bz37“î;|j)F|æÇÃ"ùR¹ú×Ö©©m9¹°71âEOÁõ'4CïzÎâo>ô¤óäëÜ<ä½%Qg¡J,‡öÐ_™ç>ÚæðÐæËÅž¹æPšØ›q ‡»¼n}úvZuçٲ뛖]ÁÛNn›kAX#øÄs©ßùJm(®‹rHõÃ<šªðÕMôö<Ù†ë£ÅÝð€úÊ<ô5Çå ‡ùXÚ¹¸æÅA]>Àì©xtíŠ_ÁÎò^»iÔLŸ¶´÷÷ªÿ­ñè[æÔ•›ÎìlœÉ¤iÒê¤e‡65*¯±µk9Vpôn ÔpKÛ¿A·´ŒJf|¢¯g¶[šn¢uOïiºbÚÛq±eÆY4Z- á̸Ð/g®[RËdº@¤±Zµ·q0'eÍîÉoüf°~¯£¼ˆ&½ñ ŸûñÈ„Í6îÎÚ6·•nÒoÌÎ=± í9Ðá«TÚÐt|ŒSœ­¹i©¥zÜoQíFë¨ £xŠvmlN§6>å eT7™ÂÏ#ð߯>( iò‹Sµè™L=I~Y½øó,Z•ü+•+Ã:98Q¿ÀxšœpÝzæãtõäÙä`gy­jqÒË<Ü[]mÉÍ!d+lW••R‰8Ðñ··7¸y«ëã®RÚt‡N^¶'zz‘¿šBùi^šXŠû…ʸ¿‹+ U³–¬åå©l°ùÄ£º¦óŠÚv6;]v×#1õûnu³¢»’–j{4ªÚ÷Z;ÓªLÑ?§¿šoJCM÷ÔéNܪpç:Yô‘GIc<ïôqÍáѧ⮹W¶y¤%KÄZ+oÿ”»QIWï¯4Ù‰íôyJ0éðŸ_É .>©¿Ù»¶ŒbæàæÝ<½½8ƒC[7Ü,ÔK8ִѳ_©ç¡Šõ·@±ÕFÿña]7­öþ^mì[‚Ö¦öÿšÆúö]è\ëAÃŽ5Ì5¹½3q;V'ºZWlC{;ÎäÚ7,dbK¦#ׯñU‹yg¯ü­Í£ãÂÉÆšÔߊֽC£eÀóoÚÔºhêfœ½-ltë+‡¶D[fÆË¤3ÞZãZD¹Z½µ@ÉFãºÿFÙ.Ù·6yÁäöÎÔ3Ñú"lCMã!š×]Ñ dM˜"/ˆr€SëÆe‰¶3G 6[9`êò³L®‹¦n»ßjÉ6CúuÜÖÙü2á½¢Hh¨2\Ç;ã=À4Îz:ðåk´îþKhÝÜ+)ùƒgä0åÚ…îÅ¥^ô鉰 í9à1R¯t‹pò;úƒBm4-Žhò•YÆ£g1ן‹“™ÂE 9jËR—|`ðƒÑãa]5Öj©Û6¨X.qFϦƒKéÓ/Ò‹¿ÜKeÕJ÷­Ñý•Úæd¤+éüÞÞ^Íݵz]S¯¦í›R« Ìx´ó{úú(]32Ú×õÁ×LJ¦L9“†¦NéZ•º>Æ;^™Ó©Ã­Ëzo*{ç£ tˆ8YãŒ!V§ëcoIttM™:…""Û®KÕxhqY—@à¡dó¶®4y+Þ»U¾†Y›ÅÓú.].Ááj«5ç@¥ ¾)Mºà  Mûjm„«® ï°Þ¾ýë Ø†š–·y™-‰«£HOT2y»Z ]14Üuƒ/^šãì¯sk”h´ÚwN\+J—å £ï6ãìo~ûąе@yM±á:ÞïÑ×5ŸoÙv<@Ï=9«~“Ë_O5ê± QßSaÚsàLßHñ¾íòÞ3vÙe?^>Ô Wj}—ÕîZù[Vš™ÆA×¹ÆBÿV¿aãԖ؈8¶â¦]uP‡—=–úEGS`PÇ‚h ÊÉ“Cç]eÎ-I§”ÂØÎ^äho¾›ÖÞ½Já0gggq‚c}õ÷9i)tÝÁ=fo§· 7ý»XîÚô¤6º >”{üQš;÷AŠŒj»kE…®KA¨.EßX˜n*kG¦¾‚Õ‘Æöí3_d͘¯¯/½ýîÛtï}÷ÒÂ…ÏÓåW\¦>Óu¸[Š–Áa<¦'éŠmh“º?°ïÆ}A_€‘Ìå?Ë{Π‰¹äÙ¶DŒ1%{½’Åã3hùŠ(±#c¹êÎÒ”ºÊ–á·Ý#MW÷ã>ƒZ†“´wnû*_…Ø@0ŽœòõX™÷ÄãôÎâwèÓO?¦Ë.³ÜÊ-Ó&È;Bɵ‚XÕùf vXؘÔÖ™¿:¿m›Ò%$‘o KžSWgöV¨«×PÑÐØ<]ŸIcÌÓË‹æÏ’&MšD§œz =ûìÓdgîj°j¯.ò\o%Ó¦ñoNQ ޳½•ÖŸÐÆÇ·Ì“mÛ”ƒ3kLš4‘¼½[~OgŸ}ŽÚê:\@¸`ûÙ;õBrjcô ¾¢n¡Àè±ÄÝ9µá’CO>_/ŒñÁF :¬mYêª-Ì•í¾†—QØébÛÒÆß§5÷/U‡ ×ゾÃï{Y^}æa¤·¿to»‚;æ’ÛÔG|Å~…Ú23w´m ”7åÌ3d»+iÙ8áÌs«+©ô€²<å°­|`È'¼y[”yÄÏØDÙÖóqbóPê&564Râ“0BÞ =µë»ƒjÇ<^â;Õ 4¥­u©3è Wk„îÐW·¡²Ø­Zรó3K]O=½)~Æ\Ùæl›üí«eÛ¡bkJÈI¨-åâ§^þÖ•Í™ ±—Þ*¶U–k$r–P[ÛÜ㙬A§n;}Å9„«‰!ª¹NWøiË6GôìŒ÷èë8 Ãä`8Öôšà×´ñ:Gõâávwö¤9¼F' :|ÜŒ ÚÐÈ~'Òˆ~JñÎ=™[x’Y)))rx`6xHË0ÛÇB€¿?¹¸´DòýÅã!m\I_.Ö¿R5˜t¢—7M÷ G]?w±~̉ A®Jw´êjÚQ©\°†v%¿ªªš¶o·>ÀSYi˜©TÙÎ"Ãuð›E²Ë$×Ëùàëä7|’A!RÆu<¸ðù˜g¾ ÿ.Èè ‡F=¼¨9‹ˆO¢ê+ZüeÈ]ÏQâOËx}fþŽ|áa„ø ZQQòV*NVF³¤²Âð÷YÕŽ pGð>ÊGÌV~x¿ fYR°s­¼ç ¿¡-Ù®%»O‹mÞ ¾óY1oO•ó“oãΤøç6×1§XÉGíŒ¾àÆ–íŽXçL§ÐÉçd_t…Ìe?Ryzªl'Üô°üwO¢¹ë§á¼&×å®V*úµ˜èóo ÏÃäqWWë«ÛPþ^¥<ĸ4ît¹,-ÕÇ0¥"ý€X.ɲíÚOÞó(‚íÉä}§¬¢;‘ {ELQ²uùä°ôà.ÙÖ4‰õ?å«7e›kj »ÿÕVCnó±«[ä¹nŽ_ø]s6˜vø·Ïeœ³!g>i°äíWÜu÷“g¬R ŽGQ㡱Îx¾L;ßâ‹ú¯»œü‚›ÏµL=xô8>¾äí/¿V÷ Aã§Èß.+ܱ¶Í¢æÇJWlCKö+ç®a+~ãÝq‘¡/°?ÐVëI^Nvcâ0ÓW”z“_~ý™éÛo¾¥wßÕ8eoœÿïIò¢rõþŠÌ4¹âKxC¦„«ÊϦõs,g¡ ™µP¼WKwú?ßÑ/^Q™1uºX‘gÊ6ˆÊ3SåU-— rñ–Wcv¾2‡âoxPœ|RÎú¿)ùùòõ– ¼ö>U5eýCWSU¶’®Ý–ïøŽÜÝÝiÉ’ŸèÍ7”¯5¸¶ w¿Ñ4ˆïvÞ¹çS]ùjëÆ<\|hÖ9 Žn¨ÆúZjÿ±oÖ¼EÛÓ”¬ ‡³7=vé{ê#±,Ë¥Âò\9ªU€W¨|OÆÃ¨¿ùÇCTP®T°7çŠé—ÓŒ3¨ªªŠ.»ìrª©>úzœ]èõhåÀåÛ‚ûüS ŸáñY^P§¶³žzj 1\{<¹€6mÚ¬>Ûµ|‡;¢'È^=èå+\ãƒûQ;û’³øÍiö¼ÿ4e¯¶F8cüóÊŽmï' )kÙÙnà‰SʼnáC²Ýžßc3q4ôžçÉ7QÉî㓤òôƒdkk'€û7wÁá`…¥ âf–8ቚG˜á‹?5%ùä"ðy]çÑ3y¤"κà“é½<-_Ǹè÷ðû_–íå·ž&—' û÷8±Ÿçaõ×Þ§\Ag<¡.ëç6±žê¹ˆç!³_”ÐŒ·☃×E¾ÚêÙü?ãà&Ÿä±Mß@å&ºøñwûôg²mnª×(jÚuê#å8¬Aͬåîï›Å¿Ó%:iª1ئ?xE»‡äï,|Qr¨8Õ¯«¸#Ù^?÷Jªk£–NȉçQÜõ÷«¬ÛG ºuž,QÀu6¸v 39#§*+M^8ѲÚyÛ¼åéÿ3û~ÑçÏÁ>MU^–XÇsä<.AaÃ3›ú­õUÍûj£ß{[¢Äüì§ÎOÔðo–×u÷ð˜æý#w·ÙúÜ2#Ò”Îx¾ŠÒ#zK®ïÆ8ðÏÅÀõŒYxý®ë0×ðáí¯´ä}Ä–§nm®MÕÙú_5‹ÂO»ÈägÔhûfò·ÖÉÛPo:aÞ‡2{P#aÔàòÞŸ¥¼ J‰ãQÒö­Üê ¤õQ ȃš¯<@û?YUÇ;D÷ð~ä?\^AààgØìXK)_¿¥þ•yÆÝ±rÅÁf[Žüþ%íÿâ5ù#ã¹GDùcáà÷QÞúôL*JÚH…ê@î›lœu`ÊÞO_¤”ïIëNI»vÑîdå*ûiÉOí î°²ª"zã¹´ñÀ2*­TR÷ÄNÞÉÞYÞìl[_é«®«’5vøo™¯G õL1Á‰2¸Ã£hí<¼Ž^ÿ}n›ÁöçïÊÏíââBãÇW§v¿úúzºç®{èÑG¥;vÊiujßhK6‹õêîCh‹Z8ÑA¬ãQÎÎîä,ƒ;õM´¼¤˜þO¼¦=Á®ÄÁöËOJJ·µx~Ιó]uåÕtùåWt[p‡ñIñæù7SÞæå2xÊWS¼ú–5´àN¥80ç.KÙwÇ~_{Pœ.wª\·€»^ðÉ=ïT9puàoОNÞ»'«' üyû¨0æN¾¢¤xò #§o^pk«àŽâ译íÙ"»òè398ˆ¨îð>æÀWoѶfµ;¸c­Â¤ 5†¸[´à?—ö˧b^ÜlUp‡efdÐõ×Ý@×\s-ÝxÃ]Üaú̹Â]ëÕ–y‒Oz˜ïàqâh§}™¢ÖÈ[ÿ¯ ê%o–bgÜän^&æåmb^*©ê¬ÉÄv”Of“Þz¬9¥`y_Ï'‡~þˆ~ûvówèJtØòä-t䯯d ”·|bÂÝÛÜB£å1ƬտSÆÒÔ¿êZ©ß¿G{Ä;×1äyÊŸ;ò÷ÓÎì“vé£ÛP>^ÜöÂÝò¸U«Â¥´yjÍhm(Õj¯”¦$·ëD£ø}ðq5ï?¹†w]Ñ‚;¼Œ9`éý-ù€v¼tŸüwÿ-¿g‰pp‡ œatà«7­*ú|¼ã Ä=<-ÏxÙ{DÃqóþ‘oK”ë‹¥ÀLg¼G_Å™,\¯/sùOÍ¿7Kxô¸¬•¿5çõÛ'a¤Üsp‡÷/||ºyÁ-]Üé4¼ åÀó–§n‘´sWy £m»Lœó2x¬Â]¤8sÆAó$Žªòå9ŠŠ9œMÄýû|dQF®£Óžª%\§BŸŠ-û9Z™nÛÑ Æ™#G ŠòJÚµË0·#lmìÔ¢Èʪ\[_MM濇Ÿ{z…É®]MT^]Bé…)TYÓ2,¸5¸¨1×½Ù¸q=üÐÃêÔcç­·Þ þÐm·ÜF)©Jʽ5|ĉOòÞqT$6Îû«ª¨R =îŸs?qÆé´kç.š=û^ujïÂ}ø=cä>Ñâ`AeF*Õ´QÕ“ðoÛ£ß ±íð—Á þüÜõ¡=)õ}Ï×Ð~²ö˜8¡á€gC–¥í§†Êöýæ;Н‘ó>Ä5(\½ÒlCõâß®Ì>,oGJjÎÐp“)ζvvâÀ³R,fPYúA™UGAlGÜ<äöB›—S¯”)å|ò¹‚³lÌßy?ï5`¨8÷•ë&×{jл•øÑqr>0çu¤2ç°<ö8Vëÿ«| Ojwn>ÙéìBç¦ôåm(7}Wy1Qm›ÃÝ N˜÷lïûì%Êü¯í`Ÿ–Á£ÏvçìHÞ&sP Bì[yÿÚ|Eß]|GìˆeÁ'}|L~¼uê |aØ#JüÞBÄOßAž”ñö§¿¯Îx>ÍÆVìs=Åñ¤ò{ãý¥l9®Ýç%ö'ÞâÅrà΄êëw—lCÅq¹ìE#Ö;ÆA$*¯Ìeðˆýußð¬X¾‚~ýU©>^-N\“÷ˆ• ÚÅÕÕ•âââÔG\(yž¬ýÒ‘O_N‹ß{—x¨tª¤j«» <˜^zùEJ?r„f̸IÚ½B‚ƒéýß—ÝÆfϾvíT2ŠŽG ·<.ë&p×·^£Nè^w¿,Ïìkf_hU€ÜT€:ÇqÝEëÄ“N¤çžVÞfÍž¥N…öˆŠŒlž‡|Óö=^¥§§ÓÏ?ÿ"¯B]}í±;x ¡ç> Ûï½§\];®¼ú*ÜY½z5‚;ÐçYËÑ7Plg<@oÆYÁÎ’íÜõÿv[ö#´_Ÿð¬[»ŽÖ¬YcpÛ¶µeˆk°^iYY«yÉ·”ƒ)ê+ŽOô1­X±‚lmmÈ××Ìã]èü ΓE–¹îÍ| —ɱàâì,ƒ~ÜY´ÈrñS€¾ ñÖy4äîç)Hœør÷™:îâF~Ã&Òˆû_•5N¸Þ@Æ?ߪÐ{¸GÇ“ïqvÚErô*.Î5x¸ô\}º‹@_÷â‹ É? €½õ­[×váQèÆ#d««(£¯Ï¥Ò}Ê0¯½ÉÐû^&ßA£ÕGJí|ÄšÚ;tÑè:Çe €¾Î×ÏŠ‹Š¨±±ý‘ ã¼FQà˜Sɳ_2´í…YTœ¼I}Ô;9„Rmi‘8°®R§t[;r ‰ ÊŒCê8Zag\"·çî^êEîúi÷;óÔG] ˵S9ú’ßÐñ²³æj¬­‘íãAà¸3iÐ-Êöú‡®¦ªì4Ùî Žçå =›¹ºhõ66-q8}¬SSZHy[W6ߊ÷ïPŸéÝœÃiðÏÐØg¾$'/_u*@ç;ýRÿü×yö5ê8ZÁ“¦Ò€éwËàNC]-Ud¢²Ãûå­*?[}U×Ârí|î¡ý(îÚûäÍÞÙM ½–+ô6ðôµ%…T#nµ%TWYªNkUˆ“§¤×j¾¥~ÿžúLïæ=`ù˜D6¶ø)Cç ?ó2rò TAg?sº¼¯Èz mž7CÞR¿{[>×Õ°\ú&œöÿ~OkgOkf]@e)ÉêTè-ìœ\È=¼Ÿlç¬û›êJ‹e 3 ÀÐ ìÜ<ÔÉšY©OY¶sq#ïø‘ä=œýBÈÖÞ‘êÊ‹©2ç0n_KU¹ê+-³ur¡€‘'Š÷‰'G®oÒÔDµeâ}²Ò¨0i#U禫¯4 ôùœLîa1dïêAM õTS”GåGPá® Gor •Ås•ÜÙî+¿îý(`ÔÉä,>O}u9•ìÛAy›—SS]-y&æ‘Ud¦R]Iú ï„‘dçìF•)r¾Ù:»Rи3Ä<‰#;GªÎϤìµQ•˜'ÙÙ“WÿÁòæ.–‘+5TUPUA6‰yY–²[}ak¦Š,{&—“—ÕŠyÈïQ°}XFòumñŠA#xM¶;TdY|ŸÄÈ'n89ùPc}½œ?ù[–wiÑR—À0rë’†G ?ãÙæyÃ]ùôª«,~·&òK#—3¦†Fª)ÌórXÏv©¯êœÍà=h´líÞ(G^ñNMþÃ'£§¯<.LÚ@;ÖR[U§xñë«þVm¨®¬ˆÊí¥‚ë¬%—§­£³Ũ:/KNãߨtöïW*žK¡ÜMÿQCe¹|Þÿf½Å:á%k¬4Ö×RMq¡ø½mßq5Õש¯4ÄÿŽƒ»'•¥&Ëß[Ø©’½›ïÝJY+å 5Œ=ü†ŒïÑ@9ëÿisu!¿áÉ·=â=yÛÅ#ðl[e¶P¨ï°ñdck¯>"Š»nŽXÞT¼gùûkuj‹²C{¨VlÏ,ámnþ<¶ööbýʓ۾âäÍê+ÌëŒeÒYÜ"ˆus’ò=ìÄúY(æËV¹~‘Ø®›b'¶ù¼>h=|(îúûe;ýßïå:¡'÷ bžv¶£]®<Ò—gÿ!²Íû®š|eY˜ã›Hâ7ÜÔX/÷¹'ÿrè/×?(€GH <áTò8Tl\Åþ$K,Ë¥²K­5ì\ÝÉØDòÿž£ø½ÕWWP¹øÛüMËåòéNúBþkî9ߪÿ¨÷¯b?ä›0J6+ÄkjÄþÔ¯ø⥎rýªÿ–ÆEl§\ƒ#åo«º0GìK.%× ñ^‡(ãŸoå>Ú#f¬ÅÛ"±¾g­üEnôZYÎËÇ'‰ã°áâïÜ©º Gîyûf£Y®¼½àíãß—xÀÖŽFŸD^±ƒÅºì#æC.•ŠcŽü­«ˆäkÍéÈrèÇÍ(Zý§ßE¡§\ ¦456Ê”ý_¼*ƒæðqü sÅA°:¥µƒß½KG~ýT}ÔZä¹×Qôy׋c‹–k½FqR°}á,*Ù»Mb¨ÿU³(ü´‹ÔG-v¼tŸ8AZ¯>jƒ- ¼f6…ž|¾:¡Eùá}´ý•d±Mž_{Þš²Wÿ®>«=ÿÙ¥ í—O)ÛJrç3âÚO}VÁßcßÇÏSö*ÿÕðÁ߀«î!ÝÕkc|"›üÞÓ&Põž}Ÿ½Dž|À9á,ùX¯,uí|óa«†Q?š·8 æ‚‹.Aáê”<Œ½\¿>}Ió:[ø”éÔÿò™ê£¶UŠ“† ^¡>2$ 4Ï|‚Ü#ªS ˆ“ðäwçwÙò.ÁQ4öéÏd{˳wPØÉˆ“›Óåc½’}Ûi×›ˆ“ùÖAMPzèmqB9HÒZCu%¥ˆßjƿߩSLûü7äâL)ß¾MéâäfÐmOˆú‰ê³-jŠóiíì ÕG ×°~4ä®gÉÅD@VS•—I{?zN¬k[Ô)-†Ï}“¼ ¥Ì?Ë^{—–bž‡ÿøR¿¢Ï¿A¢Hzë1Ê'ÃÆl(öŠ;(tò¹d£¿­WŸM»ß[@¥b¾›´è/²wrQµm÷»ORÔG†ød>þ†ÈG=5V¼'í^ôÕŠùiÎÑ,“Îbëä,÷cNU§ªÌ>,烩À ŸzäõQÛºj­£]®|±cÂ+Kä{ä¬ÿ›’ß™¯>Óm&¼ô£ Xæo[M»^{P}†(Dì‡xÛÉť׋íÒ»Ÿ#Èê³-2þûö}þr«@‚^ØiS¿ o"{WwuJ‹zqRŸòÍ"ÊïÓ]:8Úý«½»MzíÙÞÿÅk”ñÏ7²mlüËKdþ,ñ{?xZJÔ(jÚuò‚ÆÝÃcÕgøBÒn:´ä|÷³Ç0˜< –ž>À³õ¹»Ä>êÿdÊXöš?iï‡ÏZÜ7íråíÓ°Í n¥ºÒ"±\^$×à9M¯­u™!À=•¹Ý¼yóZx*+ÊëmëJ{’Ès¯•'Y\Œ¸`ÇzÊߺ‚ vná6¶vääã/<<¢Šؿտ2Ä'ž#æ¼*0ê««)wã”»á?ñ>ë©2ë8Úµï $œ9bJФ³ià•wËâ·|ò‘½úy2ÆWÀøê'¿7_™ÊÛ¼ŒªrLg9zùPc-²’*GÒNsøŠž•YHý§ß)˜” ŸØqð3"kjä•eïÃÈÙ/H>Ÿ¿u¥¼:«zÊ…2ÈÕPUIáS®z¹ëþQ®ŒÕ×ÊÏÄßÑ'q 刃7¾âg,pÌ)â iŒ<8+JÞLù[Ä2Ù±†ÊÓR½x_q@Æïã?òD¹Lk«Õ¿TpFVÄ”ËeÛ%0\ž0òòÌ\þ‹ü6â?gqÈË–¯ìsÆCSƒå«rÎâß ™4U¶ù “¯”ZÃoÄdqþ´œ'â$%wãR±nü+†í•õ+*N^ÍÛ´Lý«Î#»xˆ“žw|kó”³²Æ+Ús|ã+ñ¦ÖQOoyâÉWkYQòÜ+=°C^Iwòö#×À0òË-{Õoâ,ų́öpp÷n`òoÒwÐhYx6kùÏb¹n–Á ^7ý‚ź:BœœˆÏatÂÇ¿i-#‚ÿ¶`ëjyRəչ™äèá-³ü†Ž£†ÚñývÊך~Æeä ~—<ß‚'L¥€Q'ÊßÉþí2xÈöb¹sæÑá_>QÿJáÞŸ"θTK&‰u|¥ø=­–W‰k‹ ä÷਀1§Qñ¾íTS£þ¥"xò9ò5¼î%m¢ìµ’“xìàæIýÈkà0ÊëZŽ8éæu‹@ξAò÷¬Ç'×Ãï}Ifëñï’³òøÄ0_üæk seP’×Ý@ñ98óÄ8c‡<µõÇ90T98ÅÛ mºvãu‹¯†ãL³‘½Õ|ÂÈë1\(~ÿœ½ÁŸÃE|?þ=)¿WÓ'|G³L:¯mCg½ÐTâìÍÌ¿ÊÌ2þí¹ˆß¯cã¿ïÍ^ ñu…LTð¿^DUb[­álXÿaÄ~ÄNì3F“GD*Ûp^GKÅ÷æß¯óžbçu¼h×õ/ Å\z;Å\t3Ù:8Šu XlÃÿ"¼¯ä ¼Lx_ÀÏñ6°;ð| ¦lùãrýhËÑî_9[%rꕲ](ŽOÌeÂFœ5ì]Ä1˱\©N%±/IÞ‡Ëß+âÀApþ÷xÿȼOæÌžÎÿo£Ü#b)Ýhùsæ"gì0ÎÒu‘ÙaüÛ.MI–ß‘39{‹÷Õ¼}4¥3–+gJó¶˜ñ~dÐÍ*߯´ˆJ’·ÊyÀ™­¼®Õˆm³¹µ¦#Ë ;üßí·‘›»ûêÃf}.ƒ'æ²™ò 9w0Õ]§ßE·PÔ4ehØí¯Ì¡"qpk¬ÿ•÷PøéË+g[æßÜ*èÁ\âåA>ý\oôüåAo6Í¿©ÕŸ8ø +ƒ?›-^†Òˆ¹oʶµ<Ü¥`ôcïÉ6>‘ØñÊý2@|â¹ýõYÌàaåé)´ý…» 2)ø ”¯Ö±”ïÓá_[Ÿd…œxž¼ÏYÿ—Á¿¯á+dCÄIÿ~ø÷/ä:=}ãø¤718)Œ:ïêwÁ Ù6÷9ô:’ÁãèíOc|*ƒs,ÛþÒ½'/,rÚµò•íxí*ܶF¶»JðÄ©ãC²ÍWÄ­ üʼn¿ Ëöþ²,â­áu³ÿwRÄ™—ÉÇ)ß‹ùÙ'Ïú Æ]“ÞžgÐÝ¥ßÅ·RÔ9WË6goµºrkcK 7?B‡ûBvã1ÆÙ,œ%ÀAAð¬½÷"ª¯0= –-ÂÁC¢d,ý‘Šu±±ºR}…x?gWŠë|Ú’Ô) î’â'N\ÓÅç«3‘‘âäL£y[œTøÉž- nQŸQh<œqµ~ît™¹ Ïþ('&Û_¸K¶ýGžDƒïX ·O+gN18Ñâí_¤8™cœòÃbƒ,'ß þÀëâÄ1D7‹m“%Ú<án"{?©NµŒÿµQ¼Kž1 â$µNüV¥‚í«•'UœÇ2ùótð+eÛfìh–Igà®)ñ3”ßWŽ8ñN~ÿ)ƒõ3`ôÉ2«ˆ·±¨Ø±p–úŒiúì‚==GÙ+ tÝ¥#Ë•×ñ‘+£|i]eMr÷óâ·0^ ø÷&VTõ™– ͯޢô?¿Ti¿×çeàƒ¥›æÍhµäìÚ¡â5Œ3O8»O¿>Ø88ÒàÛŸ$¿ád0pý—Éîš]ƒŒNbž²Ê,±_h£ë;Úýkgeð°µ÷_*3h9H<ñÕŸe€³y`jð¿5ñ•Ÿäºn¼ÏÔgð°”ïÞŸµeÛÎï9øÎgÈoÈXùxë3ÿ'»‹êuÖrÕÿÆx»ÁÇixÞ,_b¸-Óù½2ÿ±œÙÙ‘å ÐÌeðô¹"Ë)_¿E…\ÁL-–C?$ÓÃ_ 2Å-L9à⫵¦‚;Œë¬˜ îp·í*mÁŽu&³Z8ªÆAk‚;Åu<ø`Œ”÷|ø\«àJöŠŸ©Øè ËN7î&s䯯䕩v¼hIDAT1æ%NLÉZñ“¼™ î0ž\£„ù ïÍᬙ½¿ÐêŠ?/W>˜c!'N“÷M^uUÒÆ¹«qp‡¥ýò‰Ììba§(Ù)=½›'9M¶9³BÜa¼n¿#¾ºÏ¸{ŸM×n*ĺ±ïÓ…­j™¤þðUå+ÝöBO¾@Þ¿sîFf*¸Ã8[äÐÏ˶8y4×]H ÜUfÿ§/œ`0~l*ÀY;©ß/6Üa|┹ì'ÙæÀgP™Âð•sMÉ–îTÚwå«ýÎ>²Í¸¶wo`ÐMùþ]ƒVS˜Cþ÷ºlËLÆó]Û:ŠëÔðwdGþø¢Up‡qýÌ¥?ÊvÈäiòÐ’Ž,“Πý†ë*ÊL®Ÿœ¥Ç£a1Î@ã e_Åëfyzªl‡L<[ÞãÚYœ­É8kÕÒÉ0õÁÆ¿WqWWÞw…œx®úL‹~(AɺòJ^<¿ÕúÀÏ=>+÷óöÎÎbý2ýY;A*3Rå­#A€Žî_;g÷iÝ£¹Ng{1Þi+œV«nßœ”€‡)eâ˜)MÜaüžûÄoWˬ ¿yc]±\y»ÁÝñ3—ýØz[˜ŸÕfp‡írèn}.ÀÓ>Hà®ÌÅWéšd¬¾J)ÖÉWÛ9-¹½ø@¢^=8q “÷ÇgưÒCÉâ;›îfª†‡)ÕâðñwÕNDüMÏOk”«…‰Ûzâ}ÛZu+aü9´.QœÀõe:[ÐX%(R’’$SèMáàHî¦å²í=pqÌž†»;q <ËY+NÂL²|BÍœ|É-4Z¶» wÝ3Y8\|ŽüÍÊråŒ8£úÖæ*Τi Ÿ\rp¤³q7“¯éÏ¡?Áã“¢z58Ì’5\T\ÃWÕ5þ£N$;u¹òÕóV©™*î’Ã5Æ…©;[ÐX¥ŽgþõsÙ6Eû½rД»îXÒUËÄ„zôS>Wþ¶U&õ,gíŸjKls;~ö$Y+~–÷\óÊÕÄ6!pü”æºOÆÝq¡pSªsŽPyš$÷¬ËÕp»W3î¢kn°ÎìÐ2D8[¬§ëêýk[x =m;¤ßî0mÛÃÝËÍáî즶=P)Q»ÿNºj¹òÅÌåJ`àxÑg<Ü'<ìôKiÀ5÷R­Ѡ™ó›oÚÕs;gWyo¬d¿2z÷÷æn~Ã&Ê4Ýö(ݯÔúà,¡¸ëăù’»œÖøäD«ÍR~H9X6¥üˆuDZvŒ)Úè5mÍ#o >qq!ìø›¡A··,Ÿx¥K`[…@ËÒLgj0î[¯á:‰G3ÓŠ_òdrYò8âf£ÝìˆG‚avNÎ=…›nÞ”YX7ÊÒöª-þ›þj«kh't¦,×ð–Äô8kŽø¹‹\ÜõÈn3Úº5àÚ{ÕWño¾íßq•8Á¬V³—Ú‹ òŒ>Ev-‹›1W|Ž–u\«…ÅÌýVx46½Æ:eÔ­¦Ú–Ñ·št¯ÑuÌK刯’Ë)Ýúi°ŽŠyÅ™<Ì5¤uáÑ£å9@m‰¯þ×ÕšýðzPõŽf™tïC4úß‚±2ݺË5Fú2fi°Ü=ÔX°Z{‡3È8Pc‰¥yªýæ¹þ wÛÒx ûQUÉÁ6¶ÃêúÂY=]gì_FcÑv§VYÆ\HOÛöØØ·lwŒYMˈæ†úàtW-×¢]ë[eîôu}.ÀÃýª‡Ýÿ*0ÿ#på]vÊ4ö ']Ú7ÌÆÖô5%.šË¸ñ»Ÿ¥IoüN£žøPž´Ž=]hX²ÿ«7d!@râ94òáEâ=þ ásß’Ž®¾ª¨?xâá¦Í1N 7ÇbaAíÊL7>@xí}4aáw/N¾y(Öà S(ð„–eb!b¡;–"n ×|ÐpAÇÎäèݨá''¿·L¹-^*o'i·wÿ£A·<¦¾R ´õ4úyÃ5 ÌáâÀ®ý5&²²4\0]ÓñPÃcŸù’†ßÿЬÄ]ôxÄ£æßü¨“ÕWšÿÍëUåXWÇÈwâуgΗuƒB&- ŒkŸC?\6w?1Éèd¤IíjÚD-]NµiŒ‹Lk¸À7ã ŠÉoüf°~¯£®jR.HÚÙä0õʵô;áí† ëZÒÑer4=Z~'uºß‚1îºÂµ†˜½{Ïû½w&®_•¿y…ló6\ž„«Ü£âš°Y+“÷–Ô›¨¶T™ßü;ѯ£\M3ô®ç,®_¡')µß,ÞØSÍþµ34ÙA´íN£ÑöHÝÙØulm°-×퇺j¹Z[“ /éº#†cÀNŽxàu¥@£8(*ؾ–öùª,Ö·ãÕ9Í7Y†ñUS¸kÄ–gfÊeêÕ(>iâ?ø¤mЭÓÈGß•YæðÕË \MéCÕêˆ9ÜoÜ{Ààà“Q¾ºß‘.`Ö°µo9ð¶4¢T[£MuΦàaÚù`ëÓp±È¤·7X&œÖÝÌÌra–†Wmjh¹Úhëhþ cGpý x¬¯,·êfé»+Z7¦˜š¢ÎÖÂÛÎ`ñsè–¹þj>ã̸¡÷¼ GüânGY+~¥==O;_¨yÝÚùÚ\õÕ¼8Ú^\X´½¸ꀫIkŠòd±ðäÅ hç«6.VÝ¢³Ö‹–÷Ѷ%\sËÔºhêf|…þhqà[R™ëe™ú7MÝÚÚud™-}–‚–Ieï3˜>£ª¯ÊZ©tÓâŒFß!J½¦eôp·Bkºþ6YX÷ô™lúm/T¨áÇÔºÔêf¦ötœ¥í¨~{mLû0ý>¥«–«ÖUàxÒ§<S.“Ãxrpg׋“«9”ñ÷·”¿y¹,ˆ¬Ýôf56È›çÍ 5÷œO»^˜2–ý(‹m2ö$Üò˜1ƾ²{àË×hÝý—к¹WRòÏP®8ðÕNføê>þÔxøq 3nŽ¥ç:g*iC sÁÈMón”#ämøÏ`™XÊ$ÑãnOæèƒeúïß´ºLlß'/Ъ;¦Zu+ï¦!zÛCµØRÚ?w7Òð°²]ÉR×<ýÁ¿ñ‰~쥷5©»ññhïGÏÊâá<°¶nïݪ¾ºkØŠÏ}þ²]²o;mxè*9wgáÃÚç¨HO‘¯é*|Òêò³L®‹¦n»ßjÉ6ë ¼måÑÊXÎÚ¿Lþ›¦næFÿ9–ô¿[góÛÞhÛž†ª®ýô\˜G{cÁ“”B·Ü}&P­Q–³þoj¬mûäÛâ¶Ç̶¼A·ÞðÈ5&×%ãÛÚYç«qü²&°ÝYx{hŽá¶¼¥¦–+@çéSßAÊÕD>Éâ~}óÈ< ¯5øª¼¦É\÷Ú¢|™ÑÀ\ƒÍv±…Ô|•eÂux”!sœ´e"X8µT$×E÷\mQžÚ2Ͱ›KÛëAu~Kýg+ õödœa¢qñ×Íw#úçôÓœüÌå"Ïšš¢–@yªugx”s…Ä ¿cçŸèp1mÎÎc©K>0ÛÝ‚‡ëÕtÅù–V›Â‰kE©Y4Ç‚ö[±´L{}ÐÙÙßüvÒÙ7Hf'²šâ®ýô¼êf«”ý‡M”ݹNÖõÙšîYÌRÑ`­~ï7ê*Je›Uêê0õöípghÒꤷnņ»¹)£?vKÛru™ññ Wi°\:OŸ ðhÅ“kuµXŒyÅnî»­ïªb-.x˜ö˧ê#q0ÓIeæ!q€¬;yúdJ˜S¯»Úåd¢I+MT–ªdð¨Iæjqw¶®¤ôsÚ5k _­õŸQck¡¾‘·®£1ÏþÊsœÁU~Ä|¡G¦Ïáá¥Û£zð°ùÌo¸å¡Ü»Sƒ®›ƒ­™¢áÆôEa½U[­ÉQÀTeêÐï]ÅÒçh^®â¤@¿\ܼšO¬õõ‚Œù ¯¶Ä<ê‚.4úº@5>‡ß°qjKœsurBV¬ž9ËÍ'¾s~×Z7{+×-¦}ÏØ!²ÛloU™‘ÒÜuÐÛÂúé¥ûX*Þ“td¹êñþ‹»âð¶:hüÍ*xˆìòÔdÙn‹Wÿ–ùfÌKýÍW¤”Ù´.pÏÛwæ7¬çl‡Î¬Ô懹ý˜[XŒÅ}jgÓ‚î¦h˵2ë°ÁñÀñ°\ûEGS`Pïz@ïЧ<õj÷)AI9T0Ä5wú]t“úHœ™¹ªÅéæ–8x¶Hiÿ¦.†ØFADGõ=ø ¥–ic  l>Ù°2(“½N¾—Zg^&ÛzŽ>8î õQר¯T®¾r ‹GÑ2%â¬éW-]mt(NÕG-øD2ð„Se»tÿ³Ã¬jxT­«œ•¯3—+µ'8s+`ŒÒÁS;[®€¶»nÔK8MþVÖF2qðÏ' \¨˜q °¶0W¶»ŠWL"¹›*›çaਓd»(y5êsu•eÍ'G/â¿8£eÝ·wéü+Ùuê:ÎÌ}¯øä3¨eÈg{çÎÿù[W6gÆ^z+×+2Æ])lÚxiÁr×°~»£êi¿ÎjйäÙ¶¤;~'Á' …»6ȶ¯Xv¦†ç}JøiË6×*عN¶{ºŽ,W=ξ(ؾF¶ÃO½˜|‡Œ•mîi­Ig™¼¸á;d9û+Yy[VÊ{M]IAó¿vê…äÔÆ(pœ½Ò ÝwšÆªR³_|Z.’è…žÚ½]™‚Æi²›o]ÕÑòò¶,“÷š¾¾\ç=ñ8½³øúôÓé²Ë.U§t>à)ܽYÞs·©˜‹Ä‰…n„>tócòdž³I˜“·¿ÉƒÛá¾A1—Í$·¨­ž÷ˆDý.PêmðÉT©‰+œµ2æ™/(|ÊôV]Šø„ hüqtº|\¸c­UFšÄÉCþöղͣxñË|bÄ'hò$ÍDP*{õÍ¥û]x3Eœsr2%æ‹ç€a4löKD]\d¹H]&,þ† F÷âÏ1õJŠ>ÿ†æe´ô|s¸ö‘kXËÉ/ÛÄÛŸh ¥ýñ…¼·¤±¦ºùdŒ¯@‡ž|ül–æ'w*OWægÂMËåk|Í5Åîð^£˜KoW§vÒÔ=ÍBž¼\Û Pr¡ê#}-Ûœ6è¶yÁNü ¾û²S¯î[3?;Câ­“KpK—G^WyD*ísùýKy¯á`OYŠ’-Àµ@üFL–m Ÿ½÷%rôônÎØrlcÝêˆÒý»šëÎÄ\|[«@€ïÐñ4x惬1g¿Îÿ¼HùêMÙæ@(&hÎZù«¬»Ötd¹ËZ¡tÓr —…µù7½ö/9Í¼î ºUl{tuàx}»~Žls½;S£ƒß,¢úš*YÐ|䃯“ßðI­Lpò ’…Ïy?¬Õ€ë«Šwo’÷*tò¹2øØ]x{ËÛm}†‰ 3’mÞf,]"Ûz}u¹4ˆ&LP²’¸Òu×_GvæºÓtqðÚ*¾—“ݘ8ÌôÕ žŒOÐG?þ¾,´Ì8S™qˆlÈ=j ì’U”¼™r7.¥¸káâÇ\GoÌSŸ5×ÖáL‡ª¬4j¨¯“µ´+Pœý‘ôÖc²61>™™ðJËLU^Uçg×zq Žl>©â°[žºµ¹vF[xÔ®Q.&Cñæm]II¯+Pz|²9ü×›»JéqŠýþÏ_iž{Þš²Wÿ.ÛšÑó?!÷ð~fߟñA:جÊϦõsZ_rÏóä§v“ḠîúPS#æù»p­‹Ýï̧¼&_³÷£ÄÉÃO²Í8à0áÅïe;{Í2@Æ*Žì'µò}´âË\ÿaï‡ÏÈv[ødmÔ£ïÈJc¹ëÿŸižú¨…‹8!2ûEybÄ8¸ÂA4.*ÊY/¼|µnCY«~§½<-Û]‰³Ò¢¦]§>ëfc#5Ô)ÎüÚü¸‰BÞâà¨X.¾â$›ñ÷(O?H¶¶väÙ¿y$$>‰ÛûÑs²ÝÙxþ}ú3ÙÎߺŠüGˆzÙ ë€ÌV“ËU  ¥ÿ÷øì%ÙÖó0”†ÝÿJs.þÊ¿'βãŒ&> >´äCrË+xü™r][;ûBùZccŸÿ†\üƒÍ.{K"¦N'Ê3e›· åbàì*— ùžü[ÛùÊŠ¿áAYSˆ Ñ&‹u^3|î›ä-¾KÚ¯ŸSêwo«S‰Æ¿¼„œ¼|iXÙê 5 Ozç_ÙÞöÂ,*NVNð4ÑçÏÁ> oj sä¨5.AaïsÕˆm“9œuw¼åI›†³µÚ{?|VL7ÆÁÄÿ{’ü†(ÝÒx¹Vd¦Éˆ½««\öÚ²5·Ý`G³L:K”˜ŸýÔùÉÁ^?ù÷ÂC‚kÛîö¸õ¹; 2ÌLqò¡ñÏ+ÁUý2ín]®lliÜ ß4ä­YF!'Ÿß¼¿Ñ~ó<*aEú™Í£ýfy>ó{™û ¾ÃÆËѵâìr?“.þ®‘œ}›3€˜©ýZOÑûWþ-ðÄÍÝOù¸¢¦$_Ö¤ã‹<¢gXñ¼5Þ'iûŽ’”$Úºà6uj˿ɻ=‹ŸT§xäm™m™öËÇ”úý{êT’5Ýò¨ló¿2ijó>ÅN¹E Ë•%¿÷4å¬1½<:c¹êc{?YHYËZ“ºÓÐaÃháÂçÕGâw&öç{>Õµ12@[’¶o¥€ àV ;}*ƒ‡O¶='ïÙ&s· N[–ý¾Å Ÿ<íx龿´{æk¢{NÖš?›3_80Â5|n&Ó¶…÷˜ î0š“ µ%J=—€Yë†kápp‡Oó6/§Í n±:¸Ãøµ<|{ÁÎõò„Ñ\ïgÓ¼”-¾W<—L¢í gËQ4|€ß8–¹ü'ù™ùÀy~ðÉQîæe´yÞT²wkKªù ó]¦2ĉ>ø×W”Ê,^¶Üá«Ç‡~þ¨]Áˆªì4ÚúôL*LÚhõüä€É–'o‘#‚qÖÿÛ|å”—­[h´ îðAi–8ðÌXúƒúW]‹´÷ˆ²Òƒ»å•Zþ <Ÿùfv¤8¼ö üMð8îzæÑ/^wø;øßò$´;äoYA{ĉ(öˆËU|ðgKùá=ÚÿùËê+ •ìßA;^žÓ<ªÞ8hÅ£Üq¡íä÷ž¢CK> ¢$%ÂY{.VFoÎ.ÚÿÅkr$+ÎöàŸ?'Êí•ëY‘XÏ Õ«í\#ÇøêtgáïËÛ¹R5»‰·?ÞqÃe¦ wø÷ÏÛ°_½IµmŒ^W'žßòÔ-ò¤M+:Ìrmý²±5-Æϯ< —[uAŽ\'ùDÖ;~¸üÝÊe+~³;ÖRÊ×o©Õ3¥‰ùÉë&>Iõˆ@Þ†ÈíÿÞ2–þHÛ^¸»ÍàNOÒÑåj@œtóHiš¬µJ—`kñú—þ÷7dë`/·ãü›áùËÝyLK&•nóü›å~”·Ýr?-Þƒƒ¤Z€· Üàí{_Æû1ÞÇò6›qÐNÎK±ç}âÁoߦš.îb«áß4ïƒÓ~ýLþæy;οw^®|<´kÑcfƒ;¬/.פ]»hwrK]ªŸ–ü„àt©>•Á£Ç}¸åA޽ƒ<°(=˜$O:Úƒ‹6»…õ'G/_qÒkGuå¥Tž‘bñŠ·1κq "7oy@̵ øjïѦòóÁ›ìR¤f‹ð‰F[ïÉÝ3ø¯¡ªBvÓa1 4ê‘we{ûÂYT¤ž€vžŸžýÉÞÍCÌË*'¾ú‘4Úƒ³¸0gKÕ‰Ûbq¢ß¨°:‚×N)ožŸâ@•ƒHÙŠùè8™ÙÅη2ç0Udâ–ú¢îÅÿ*Ÿ ‘šÎÁĶæ w3óè7ˆœ|üe¦EMA¶ìú%ްÕWt }v5–¯â{õ*–«\®À17*•[¹,¸»g!TçówHîöåÀ™+\#ÊÉ'@@åuOÀŽÎÔp@ŽØó…Oæy¸öoÄvGfÞ¨Á)Àq°°-œIÈÙL®î2»Œ3ùs˜+¼Þq@Î#JüÞBÄOŸ÷+b[ž’dÝúÙÓup¹¾ó™…ÃûØ5÷^Üæ6CŸÁ£eñ:êOvÎ.bÛ“C%vÉ}¥µ¸Þ‹§Øñ¾€÷‹µbÝ®ÌH•Û±ã o{8£‘W8{³rxPˆc…»ýyÆ–]l9È[zP,×vìSúÒrupp ‘£FPEy%íÚ%æ@'0—ÁÓg<`“Γu$Øê{Îm³81@g1à€Þ롌}î2ãϸk¡9¦<Ð~ÇE-hÍâÐÙ¶vr%ÆWMÜkDŸwƒ îp–`Öòc[çðôqá§^H£ŸÂϼœÜÂcewîÞÄ]³†Îz^Ö;ᚇ~|_ý C<Òžïà±0údŠ»a.…œxŽœÎùË{ð8ˆÓÿŠ;è„ùщoÿ#Gàáº;¾‰cdpçÀ—¯wiíèÝÜÃbhèì…r¸øÉgËi\cŠ÷Ð3 ÀÓÇåmY%Gœ(Ù·]ŸÊ.ÈÌC®ò*›æßDÿ|£¾ û45ÔRyzª¼ÕU”©S 'âQ•ßkŠ©2åûÅ´ùÉ[Ú.F¯S'^«ýæë1’@gC‘e€^E–ú(xz9xz9xz9xz9xz9xz9xz9xz9›¦¦&µÝ,/'»1qØõtW'Šð‹•íÃù¨ª¶\¶»‹¿{0y¹ù‘½ƒ|\ßPGs’dÛ’`ïòrõ£:ñú+^ß«4Å… —Í‚ÒlÊ/Ï–m€ž"iûV  n•°ƒÏ12 xÝrÆã²½è¯Ç»-XÒ?h]4ö& ð S§(J«ŠéÉooR™7óÌ'©_P‚lÏý|:Õ7ÖÉv_`kcKÏ]ýµlÿµýkú{‡Òè)ÌxÐEë8èN3N}Pwššš(¿4‹2 É[NñaõUmЇ[…àX@€ç82aàYä`ï$»c½öûƒôÜ’;é•_ï“·wÿ™¯¾Ê²âŠ|™íSX–G êT8–à9ŽDú÷—÷©¹É”^pP¶Ûë‹U¯Ê®\Ïüx;565ªSàXB€ç8ââä.ï˪Kä=ô }ªÈ²­ "Û¹%TT‘'ÛÆbƒåèQ%…”]bX{ÆÎÖžâCGÊ6*U]WA>n4¢ßd ð %Ê*J£M—QEM©|%üo%„"/?ª¬-£ýY;(éÈ&êœhu‘eg7$Þ#Ò ¹;{ŠÏTI™…©´óðz*«.V_Õÿ»¶d§>"ºxÜ­äáâE³“heò¯êTE}c-íÍܦ>2<˜œí]ÕG-’Ò7Šÿ7),ÐþžëüðÈTNö.r~†ûň¶3”çЖԕb™¥«aY¸_JI¾îbyÙQ±XŽûÄg?³S}…eža4í%?¤U{ ƒšG/y<]¼iãeôõÚ7Ô© ý{,þçIòvó§ ÇÜLövörš¦¼ª„ÿ»€2‹RÕ)†íéêɳ)!\ éq€…?Ûu'Ï‘-x&ÆM¥)ï G7uJ‹šújúmó§´fߟêCOOÿ‚ìÕG–YEëÞi/S°O„ú¨ÅÜ/¦Ëz>mÑþþ¿ßSRúºþäÈÃÅG}VÑÐXOß­{‡6\ªNiÍÇ-.p»Ì”ÔÜ=ôÙŠ—Äw)T§´vÖðétJâdkÛøbEåyôÑÒgiÖ¹/ÊÇð@O„Q´:`xôd™õRT‘+3^Víù²‹ŽÈçÜ]¼húÄ»L'°ˆi×|sp‡³mþÙñ-ý½ãÊ(H¡ØàD:{äÕò9KÎy ]0æFÜ)«*¡µ{ÿ¤ß·~N«ÄgábÇœýráØ›iüÀ)ê_Úvh•ÌLÑnb2cF7o;ÓÖÉçLÙ“¹…¶¥®–·Ì¢4ujû…øD‹ùò ÙÚØÓ†ýÿÒ²¤%´?[ɺáÌ© ÇÜ$j¦ø»ÓSŸjîÈÚEoÿšþØö?JNß"GëO·O™/ƒk¦œ6äq»XwJ+ Å2ýEþ}Rú&òq «OºW}%@ï‚  fÜÅìÚï“ݰjêjè¹fRYåÚ:s/XD¾2 óåê×Ô©ísÚà‹é¬Óe»½<,«ø0½ó×<ƒîm'&œK玾N¶ßúý·ë{Ùn&fÝSŸ¥È€þâß«§O—/¤Ý›Ô'ýƒ†Ð§=,3­–ïþ‰~Ùü‰úŒ‚»ÙÝÞ«2£‰ƒT‹þ|Lv¿ÓŒˆžLWN¾[}„ è™ÁÓÕeôúw F‹jlj'ÿÿSEÄ©­ã(Á›ªÚ Z²ñ}ÑÒ§ù4ÑÏ›>j³Ðñ”aWÈ{þ _®zÕ ¸Ã8°òÍš·¨®¾–œœhtÿSÔgz¶ï־ݪvÑŠä_šçG´‰ù™q‚ î°å»lÜa\g­ÚUmLÿÓÈÞÖA¶5£cOiî®öã†÷ ‚;lë¡•2“ 7B€ÇîšTÓP£>j‘SœNuõÊtoWÃ.EœY¨)ödˆ¿7 ̰º†ZÚux½ú¨5.æ#ÛëüCåÕ¦‹9sÆÎ¡¼=²Ý_-.Ý“q·²´ü}ê#½&Ùy™è¢5V]DháaÌÍq°o âÓ^øó,zì«ëÚ¼=ùíMê_ô-Ñêñè_¦¾»©›~5^&Z†¹!Ô™¥eГõ©OCcƒÚRºå˜b#¾²³Ú]§+”Tä«-"o·µÕÛmŽVW‡ù˜(:|,5êFãyÙ Ëså½·{ç… W.MKóÝÒs=YŸ ðÔÖW5gj¸;{É{c!Þݨ:[AYUՔ˶¾X²±èÀxµÕZjNró÷H-ï{ŠÚ:¥237;[Jn²¼òo®¥Ó^ê(]áþ±­†P×ô³°Lz²>àáº+ZöKÿàÁòÞØ¸¸)j«‹Øí:²I6û ¦£ÑœgŠ ¥>j­¬º˜vgl–í ñg‘¿Gˆl›Ã™4.º¢Â])»$]mÅ'ª­®µnÿ?òÞÉÁ‰¦Ž¸J¶-ѺÖì:¼AÞs·¹‘1'ʶg|p¦ú wéSv k‡¼ç—Îv¹h)õvxHí“GcûŸ&‹õv¥•É?QccÙÚÚÑÕ'Î6èúãåêGמx/ÙÛ™Î"Ñü¶å39ꔳƒ Íœ2ŸÃOS ky»ùÓ‰ çÒœ ^SŸïzœ]¤DÅÁ–¸Ðá²® ¾uE·­ÌÂÚ°ÿ_Ù?ðLºlüÿ‘‡³2²–† 1 FÓ'ÝMwœõ”:µÅö´ÕTT® £~î¨ë(&¨%8å`çH—Œ»‚}"Ô)½‹MSSS«ŠÃy9Ù‰ÃF¨z—Ï0š=mas¥¬ª„ʪ‹d…»÷,KZBC‡S¨Om<°Œ¾^û†|†³?æ]öl/Ùø¡A±^½G/y<]¼M¾;mðÅtÖˆé²Í£3e’í0¿hŒØtpŽ=YN[ô×ã”’“$Ûz a#éªg7k®¨.¥¼²,jjj$oWòqo }µúMÚ”²T}dÚÜ ‘¯G€,Vüåê×Ô©í7$rœ \™ªsdjžÝ;íe<Ùud}¼ìyuª¡«&Í¢áý&RaY=óãíêÔvNtíI÷R¼˜'Œ³µr‹3¨¢¦T,WW™)¥I6÷±Áƒé¦Sn^7rŠPem9{GÊucGÚZŠ )3…þÚþ5ý½ãkù:€ž"iûV  nuBÞç2xòJ3èÓå/Ê`ópñ¢PŸh²³±§v|K¿nùŒJ+”‚»]éß]ßÑëË!»9 Ð_Þêè—ÍŸŠÛ'ê+ÍKÎØB¯ýö í<¼N‰Üœ=): Žú&4wò˲eÐj_Övù¸;ðçùhé³”Y¤­ºC]C }ðß³ôã†÷d&—8hÄÝÄB}ûÉà¶µ'}‹XƦçíÁì]´øß”_š%yGÈyéìà*n_­yC¼·RР7és<Îøˆ'ïî.^T^]Biyû †ï.œ-íOž®>2[äPîñ9Z [‹»Aq·3îšdgk'¾Så–¡¢ ¥ÛѱâhïDÎndc£¬FÕ5åTÓÐ2T|W ô §P™yÃÁŸ¢Š\Ê*:,Úµê+,hRºðùyQ}C=e¦óù` s<}6ÀÐ×7]´Ž7ðôrðôrðôrðôrðôrðôrðôrðôrðôrðôrðôrðôrðô"Á®äêb§>P ÀÓ D†ºÑ+£ŸÞ;“ü½Õ© xzƒüè”q!dkk£Nh@/‡@/gÓÔÔÔªßO^Nvcâ°ê£Þ!n¤U”ÕSúþ2uJïâF±Qžê#¢±Ãhúù±²½àm”_X-ÛšÊêzZ¿-O}¤‘èGÞŽT[×@«7çªSMótw Qƒýeû`Z)Ϊm6qT 9:ØÑž”ÊÊ­¤~tÎ)áì&ÿÝÉ…ô×Ê ÑnPÿ²°`:il ßÏÍÕ Kjiëî|Z¶.›jj¬{öòðv È8e~f® ‚,Ãù§Öß¼ýœd{ÿŽ"ª­j”m€ž iûV  n•°Óg<çÌèG']A)å´ñ¯,Ú¼4—j*»&`ÐÕ®»¨?;iˆú¨m‡3ËéÜ›þV)f^O·^™ ÛçÝò7¥¥—˶)×_ÒŸfÍPþ½Ëïüö,‘möïçSÉßÇ™^û8‰*«êéþ›‡áz”•SA÷=»ví-V§´æäd'þv0]4%ºÕß3~‡^ÜL[v¨S:½ Í|n8E ô ¢¼jzå®-TU^¯>Û"(Ê•îzq9ˆÏº}U.}þÜõ€ž¡Ïxκ&šN½,R}DT[]OÛWÐÆ?³èPr©:µw˜tB}r¸úˆ³^Ühx‚Ÿl/]›)3gô8£ç¥÷“ÔGŠ@Wúíƒ3eaæ÷¿ÚK¯}¼[}¦µï&3†ö,¦Ëï\ªNUhžý‡J¨¿xMqI ý¾"ƒ Šª)®Ÿ761DlJÊj銻–RfN¥ú—-léݧ&Ò5K(åp)­Ø˜M¥åuêAgL%Wg{ª®©§ëî[a`ê,¾ANt÷+#ÉÅÝv­Í§Ož6œ޶tçK#(8Êò³«èÕ»·ôÚ!ô]}>ÀCÔD1C½é„Ó‚hð„rr¶S§e§UІ¿²hËÒ\ª,k¹ÑÓz$ÍŸ=J¶Ï½ñ/ƒ.T–,zrMD¹U4åº?¨ÑDo£Ä>ôÅ+'Ëö3‹¶Ñÿ~N•màaœ)tý}Ë© ¸V>f“O¢W'ƒ<­L§ûŸÙ¨>Óbö‰tÝÅe›ƒM¯²›ššäC)8À…>xn² d%ï/¢+î^¦>Ó¹ÇùÑu'Êöïì§5¿dÉ6»èÿúÓ¸³B©¾®Þœ³2˜Ïx8VÌxZ÷•éµl(eG }õò>ZpÍZúúµ½”š¤t⬌ónîO4–¦ßG1C¼äô¾îû?Éû@?š02H¶wº’õÄÙ3¿-M—ms.ÞaÜa+7æÐ+”¿;mB(ùy;ʶ†_q®R?hË®<ÙÕKÜaÙyUô»;e;a€ ó‘íΖ´®€Vÿ”!ÛçÜC!Ñn²=d‚¿ î°_?HApz>àiQSÝH›þΡEî çnÞ@ÿ|•FE¹UäàhG#N¢ÛžFsÞM']FîÞöê_õ=K×fQaqlk={:ëÄ0ÙþoM–ì2eNiy­ æ˜ò§àá,ž†ȶæÔ aä$æ;{ï«}âÿ­Ƥ•³©Jíz6Æè=:Ó/¦Ð‘}¥r]¸êx Œp¥Kî ŸÛ¹&Vë²zz‹>àÑ+È®¦¿>K£gnÚHï>²ƒ¶,Ë‘õyüÃ\éœbéîW”®O}Q}CýôošlŸ<.„¼<d[ÃÓ¼=•£~øKÉö1gj‰É.^lOJK£Q†ÙQÃùÊû††FÚ¹·ˆììlÈ^wã ߸Vgò°èpwyßê›èóç“©ª¢ŽÃÝèî—GȺ<ÙUôõ«€è}ú|€§YÑíÅ´ìÛ#´uyËâ6¶¦3JúŠïÿT<œE3õ¤–ÂÍìÜÓ”¬ž#Y´a»á0ëÆò •L S töûxvÑ ðSê÷pvÏʯ§Ñ–Ÿ/ ÍºÛ¦Ÿ”ÛÆ%çË!Ø™§»á{t¶Âœúöµý²Í#fqÝÏžKFQe赎‹›—M87”îzyÍ~c4"§—ÖÐÚ_3e»¯âáѹö ;ÿŒ(yϸ6ÎÄQJ]žeöŽå@W]½ùàg 5©…ux8t=g'¥ \cc••×Zu«­ëú@KC}K:ô&ñz«>à±µ³¡Ä±~tíCƒdqå néOáý=d aÏÆBúxA=}Ãzú÷«Ãê_ô]ßý¡dñ àC¢”,™sN‰${{[Ùuê§Úž.ÎækqPÇÆF UTŽRV^¡eNÏ® I—ýjÕí¾§[ÄÕ™¼è²{âd»Q|®Çsõƒ ääbœè-ú\€'4Öο9–ùx,]÷H" ï/EyÕô÷iôÌèƒù»(i}Ùš2}Íß«3e‘dvþ™JϹjÑå5›s)· ¥‹•9¡®j«5æ\“gô^éêî¾Î²æÎ±Æ¿«ç$«‡ƒ\'=°jªÈ?Ô•.½SÊ ·é3žøÑ>4ëQtÏ+#iâyaäîå(»áìZ—Oï?±Kvþþ2JòÍ×’éJîîî4`Àrtl}™]÷(×öúUSÓ@¿ªC sæÎ8oØO)†¬ ¥Þ–Ñžäfæß‘ RfÉ•¡é5›“ ä=gÖu£cYkÚŒ~ç)3w¾\¸‡Òö–Ñ’w”zBeEuê³ÇÖ•W^A®®J§Ð:{Ú9²m­¤ýÅTU­Ô¶¹íª‘è'‡o½©¥”´¯P¶c"• Ñ’¿Ó¨¡Å…g^“@'ŽQ 33îr5çÖ¡44^Éàùòçƒ2[H¯¦¶‘^zo—lÇÇzÓâg&Q|ŒáPê$Š‹õ¢Y7&ÒŸŸE~>ÊÈ[É7ˆëî(]°RwÓ¿_)u‰4ß¿¹_¹ÏU$“+êñ@ïaÓÔÔÔ*R—“ݘ8l„ú¨·à@ű¯ñbÊÂ…/ÐÐaCÕGD_|ñ}ôáÇê#ëÜqmÝ|E¼úH•ªºV ¦ð0ç—ýß²mÉÅgEÓcwµ,×óoù›¥—«Lû÷ó©äïãL›väS\Œ'y¸;ÒáÌr94zt„ùx9É×qðhÆ«¨Ú(À£¹ýêxºíÊõQFvåäW’ƒ½E„º‘·§ò>lê RfN¥úèèÙÙÛÐÌç†QÄ@Oª,«£—ïÚb²«^Ä@wºý¹á²fÓÎ5yôé3Éê3=CÒö­Ü*a§ÏdðôÔàûᇨ¾^ÉÀ)--¥¿þøK¶ÛãO’éñW·ÐÎ=…rq[[ru¶—7—6º=i~_~„êÔ!Èwí-j3¸£—‘SI·=ºZw"CÝiÄ`Üá@ÓïËŽÐm¬1Üa‹>ÛC3Åßó¿Ë‚Ýhäàï+ƒ;<Ì:‰^\¼SvëLÓnŒ•ÁöÍkûÌÖa:²¯œþüT©I4dBM”ÁÓ³…‡‡Stt4íÚµ“Š‹KÔ©Õ$;vê¨T MTYe>¸¢ánP_¿~ªl?óÖ6úß/J]K´ ž%¦Ç^ÞL<ú°_9ªVUuíÚWDyí ÈðˆZüY|<e1þû}‡J©¤Té L3—ÁƒÏqä±»†ÓÅgõ£êšz:ãš?¨´¼íEÆ8vŽƒ.Z`ID°+{Z¤lÿ±<êàôðôaƒxÓ¤ÑAtŹýèÝg&“£ƒ¬Áóá·ûÔW@_€Ov÷ ‰ôæü 4÷öáä* /\¼³]Å• çC€§ËÌ® ‡Ji÷þ"9ÒÕ®²ª°²Þ¡#åò=r :oØrè\(² ÐK È2@…@/‡@/‡@/‡@/‡@/‡@/‡@/‡@/‡@/gÓÔÔd£¶›ååd7&¡>‚¾$"Ø• Jj¨²ªAåmgGñήägï çÖ×ÑÆŠ2Ù¶F?G':ÍË›"]ÈÑÖ†rëêh]y)­++¥ÆV¿J¢¤í[) (¸UÂ<ljÈP7š}Ó:iL0óßt8«B}Úc¬»âáMñ.®ìè¨NUl*/¥GÒÓÔG–]çHWø’MëHNRe-È8LE õê…¹ºh'F ò£SÆ…­-RCŽÆI^t²—w«àN{\ìãOÓýƒdp§ ®–¾ÌÏ¡÷r³h[E¹|>ÑÕ "{ù mð´C“¸eÖÖÐ?%…ôzvÝ‘z@yÂJ¾vvtm@ lgˆ÷™yè}œŸKßæÓƒGRé§Âù\‚‹+Mõö•m€¶ ÀÐ/g¥ÓŒ”}´0+ƒ~-.¤Ôš*õëLóñ#'[;Ù~?7›J k!½Ÿ—EEõJ׬ }ýå=@[út g';?"Fö#gâr'YyU´yg>­ÛšKõ œaž«‹<6„† ò#OGª¬ª§CéåôßšL‹5l|ið@jhl¤rä´!qÞtÚÄp öw¦êšÚ¼+Ÿ~_–Þæg` ý½iÒè YGÇÅÙN|ŽFÊΫ {‹hãö<ª©mT_Ù"2Äb£<ÕGDc‡Ðôóce{ÁÛ(¿°Z¶5•Õõ´~[žú¨óxÅ {Wwjj¬§‚íkÉ\1;'ò4Z¶kŠó©<5Y¶Í±µµ¥¨ÈH*(*¢Ò’uj÷ãPͯñCdÛš:\[#ÛÇ]‘åóO¤»nH”S²r+éžùëhOŠéàÀ‰c‚èñ»Gšüû††Fúòçzñ½ÔØ:¶BgL ¥…%1oiüÅ?Ñœ[†ÒEgõSŸm±{ÝòÐ**«0]L—TOÝ7ŠNŸ¦Ni­¼¢ŽN½úwª©1 \wQYTÙZ‡3ËéÜ›þVuÿ'Òà;Ÿ’í_½Eé~)ÛÆâoz„‚'L¡ÆºZÚòôL*OÛ«>Óš“³-\øÅÅʼnï]CÏ>ó,­^½F}¶{µ'ÀãjcKßÇ%Ê6–5O}íT/çîIg(Oòð¤¹aQ²ý:g •Ê6ÀqUdùö«ãiþìQ28SSÛ@ÿ®É ·¿H¦7?ÙM?þFùEÕèJ¡nê_3ÌŸ^~dœüûººú}Ùzýã$úìÇ”“_Ivv¶tõýéáÿ®þ…i\D÷ÁÛ†ËàΖ]yôÁ7ûšÿ}6h€ÝyÝ Ù6å‘;†5wö¦–Ð_‹wҢϒéÏéTZ^Kîndg"-æà‘2úuéáæÛ¶d¥¶ [º6Óà9¾ñ´®¿u¥ÿýlÇ\|3¹÷Km½  gÉà;øõ›ƒ;ìä“N’ÁæääD×_½l÷tN-…™Óª[2¨Îñö¥±ž¨·žVÓ’±®ûsú\ϸôö‚‰2¸ràP)Ý=-¥gWªÏ*œmiÆeiïÁúom–:UakKôÓâ3)"Īªêe† w…Òp·­7çO ‘‰J}”ëï_A[“Z‚'LËàÑp—¨o~KUùû8ч/œH‘¡î²Û×ÉÓmÕÍÊÇˉþû|ªõê¯tÿ³ÔgZ8:ØÒùgDÑOÿ¤™ì¦¥ÇMôbçÞøW·“ncgO#z‹<û%Penmš7ƒ«•eâN'Ì{Ÿìœ])wÓRÚýÖcrº%Ó¦M£»î¾S}D”‘™I7\wƒú¨{µ'ƒg²‡=)ÛoådÐOE…òï—Ä%’½-=%þv¥xO[;úz ø[SVBó3Ë6Àq“Áó× ’ÁÎÜ5M«àã`È¢ÏöÐÒu†ÁƵn8¸Ã>üv¿Ap‡UV5мW¶Pc£R;çŠi1òÞœ5›s ‚;,¿¨†>ÿQ}ÉÕÅÞ Vަ_„{óæ¬H—÷Æjëå{·Ü9Öšêi÷ÛS}e9¹†Qüusätü$Þ6Ow8ð³÷Ãçäô¶¬\µ’òóóÕGDK~\¢¶z6ÝõÕjß>ÜaAêÐë•-Ýí\8âІ>uöÈÝ®†Æ+CKÿºìed[á¨ÉD}ã #‚ÔÑ/KMgc¤epc¥. g Yòçª µe(ù@±ÚŸ;ÀUmµ¨¨¨S[D¡­Ÿïmªó²hÏÏÊvàØÓ(øÄisémä'ëîì~{5TY—UTR\B·Þr-xò)ºãŽ»èÇ~TŸéÙœÕ@«U„nºiêèZ\‘‰ë71gxÀ }êìqh‚Ú"Z»%WmµÏ€~^ò¾¤¬Öb€h÷~%@ãíéDAþ¦ 9³´#åjËP©®°2wû2v(£œŠJ”Z,·MO [§ÇSt¸»|Ü[åoYNéÿ|'Û®šEág\&Û¾y‹Êí‘mk•••ÑŠ+hß^Ëõzz}l[u<±Zù#MM2 5˜ŠBéSžÝˆWé¬1ãí©t“É+0FܘV(™y{˜/„[Umz„,-CƒÙª'ózÜíêé·¶É"Ï..ö4óšZòî´ì‹©ôÖ“ãe!é~ê«{ƒ_½Ae©{ÈÎÁQ1r7/£L5èÓ×Õè†\sP»kÖµdj•©]³œtY;ZW.KúT€‡‡×TÕn-GGe–ÔÕ[þû:]Ýío:Û_+3éÊ»—ɳÊÊ•\ogš8*˜n»2¾{ëTºñ²rzoÁa­F]j8~% -Á>o{e]­lj¤‚:eÙæÔ*÷žvöòž•Gó:®OxÊ+[²!<ÝZN’Û£R͸qq¶ü÷úç+ª:L²Æ¾C¥4çÙtòôß芻–ÒKïí¤-IJa®ý®ëeaèÞ"öÒÛÈ+6‘š”y8æT =ùÙîë²Ô P‡Dg;ª*eW¬$µQ€}˺•QÛ2d:€9}*À“¡1+6Z©¥Ó^yùJ׫à2ÑsªYhPKáã¼ËÅœ;C}C“,Ìüñ÷è†ûWÒœg74äuÞéÊÐÛ=߈Éqæå²}ðÛw(kÅ/²;ýNr‹j_&’¯M™r& 6LÒóeÕÕR•š‘ëܲþ|š—C/g¥S¡ôŠuv‘÷ìP宂¬Oxvì)¤õúŒ ¡ò¾½’*Å“ìið@oÙ6eä`?y$«‚Êt“»ËŸ+2h×>e÷ðà¶GÙªÑu9sqíXvÓÑpò¡øse»`×:òç—´ÿ‹W©"3UÖãI¼}>Ùê‚–øúúÒÛï¾M÷Þw/-\ø<]~…R¬¹§ã%°£R)º=ÀÙ™¼í”nZ™uµôOi˨j£Ý”ÚJœÕ³U}=€%}*ÀSRVGÿ®Î’íI'ÓäÌw]âì/'õQ‹×dª-¢«Îﯶ ñûF†*#Zý·Æô0èGËÁÞBúJûü¥å-]ÓÌ),jéê30ÚSmu;{J¼í rpó š’BÚ³xCª±¶šv¿ý5ÔÖk`Åßð òm˜4i"y{·ßÎ>ûµÕó-S9ö6¶t¿lëE::Ñ(weÝÚ\^Nå(² VèSöúÇIT¡ÖâyaîºhJÙÛKúлOM¢ÑC”,½=Khí–ÙžzrÝtù@²ÓýýðA¾ôĬ‘²]UUO_ýš"ÛíÔ ¡ôáó“hÚ©äþÿíÝ tUÕ½Çñ_æHBBBÂ}Ï©ÎT¥ŽÕçÐZk­âŒÕV«}ê³Õ§¶µ­³UA™çA !„„y^ö>ç’2$7~?kÝžÿÙçž›ÜpíZ÷·öÞÿÃfÜ„‡让ÉêÞ5ž¹,Ó[²qkÞ¡Ž^Ó~2X)É[" }/¹Eû ¶ÃR_®ÊBgæ‘Qœ¾]Ûßù£­»œtš’θØÖ-))©_Šg””6Ìû1¡ÕïnÕM÷/hU¸c¼ðÆ&ýæ÷«´>5Wuóºá¡öæÕbþX 5ûî¸Ë® vnÒŽw_±uS6¿ö„Êr÷ËßîÇó[„;Ë”šRYY©{ï½O?¹âJ]zéeßY¸s¬ì¨(×iÛ´ÉyÔ9(HÝCBm¸s°ªJÏfì!Ü•v9ƒÇ›YÎ4t`´:GÕ}ð³¯Öo9¨’V¶67³vÌýÑuGsÏÎôBíH+t¯æwî×£ƒº'F*",P•5ÊÈ.Ѧíù*/oÝ{hZ­ v<ËϪkj[ý7Á±Ó-8D=ëA~uŸÍªJ¥š–éî5×Ü žvð´ß«%Zß'<>Ž€ÀÇðø8GÀàãx|€#àðq<>Ž€ÀÇðø8GÀãCº'„+<,À=pðø€‰zîÁñúðÕ³êŽ8x|@ÊÎ:m|Wùûû¹#õx|€ó«­­m´î';+³&yDŠ{掊Vqa•Ò·º#¾«G×õíÙÑ=“ƈÓåSúÚzú k”“[fk’²*-]“íž9R’;+ªC°**«õÕÊýîhÓ:FiôÐX[oß] ´Œb[“FwQpP€Rwä+c‰zwï óNë¦n öç®Û”«™ öÖÕÕî-KJÓ)㺪Ýû‹Rn~…V£yK2U^Þº×8Z]º‡+.1ÌÖÛÖTyY­›3è¤høû«ð`…Ò¶øþç Ð~l\»Zqñ &ì´›€ç¼ë{ë”ÿ讽;Š´|f†VÎݯò’ão×\ÔOwýt˜{vdiûŠtÁOg¹gŽ›¯¤›®lë oœ¥ÝéE¶nʵÿÙOw^ïü¼Ko›£Ôíù¶6f¿u®b£Cõ‡×7ª¤´J÷Ü0L ?GYźû‰eÚ°9Ïi,$$ îÞ¡ºèœ^î7ÌkÜÿÌJ­ÚpÀ9vú亂aë¾°EË>Ï´uSºˆÔmÏŒ²õG¯nׂöÚ€¶ ¹€§Ý,Ѫ®¬µÇ¤>‘úñ´þúõëãô_?¨^ƒëgÂøŠí{ õÉÜ´C5›êC¹‹÷5¸ffìpïÍLSMó7™rF{lÎ…gô´ÇÔíy ÂoçžÒM÷Ý4\…zûÃízþõš9¯ª«kÔ5>B/>6ÜÙ‘V ¿ük‹ >˜•fg™×x©î9ƒúvrï:v¶¯ËSNF©­O:3Á›3úŒx{¬ªªÑªy-Ï| ­h73x¤Zõ¥“ê¾ §Ðw\ÊÜ]¬e33´jî~•V¹£¾cÊ™=ôð]£m}ÁÔ™ –PµÄ&GÇkÿRsÍgªibeRò€h½ýÜ©¶~ü¥5úÛG;míá™Ác˜™B×Þý¥äUØsãä“âõûÇÛàfæ‚tÝóør÷J½»¦&ëš‹Øúÿ¾YÏ¿ñµjìÉJˆ ÓkOž¬¤„mÚzP—Ý1Ͻrìœö_ÝtîÕ}lýôÏ–+;Ý |¼ùéׯWx‡ ­û*[o>±É½@ÛÐîgðH~Ú±._v‹¦_µXïüa³vnt– %ôŒÐ…7ôÓ¯þ2N—ÿ÷@õvìg‰´Eï~¾Ë»tÓÄQÎÌ”Ã]x¦3»§¬¼Jÿž›nëæÌxe]ƒpÇX°ííkkÜÙ9u’Ç™ývê—çyºgm]›§Ü¬æÃ,Ú¢vðøøÙ/ñWß?Än®üãû©[¿6hH]ž«×§oÔc×-Õì¿§¹w´_ÿúÌ™Å3¤´ú÷tfÉœwZúÛ¥S~qä¿AXhó{™PÇÏÏ ˆŠKv)+*v6eNÏ,ÖäK>iÕãîÇwâ:V–ÍÊ´ŸÀ ¥œâìõ“Ô/R]{9Ë–Ïr–qàKÚ]À“Ø7RSnè«^§kHÖÐ ±6È8˜]¦YoïÖãS—鵇7hãÒÍî)ÓÞÌújŸÝ$Ù˜r¶3‹çwÓåE+÷kÿú%VÍIìîV™6çÙ‡½VºÛÒ=.&Ôî¹s¢åí/×Ö5ÎÊcÎtºi9Í™½S\P¡ ‹Ø_ÒnžAc¢uç £õóçFiÒ…IŠìlÛboX’£ÿýíìÌúënå眘å7‘‘‘êß¿¿‚ƒ~™r¯åQaáGßõ«¼¼ZŸ¸-ÐÍÌa£4 ·³²§•ú‘ôïÕQÍüì”ÁõoÚî´¦÷X¹Ñ LÌ  ±#Ž}w¬obÙLg¤¾Ô­pgò¬ž—­êJvWøžvðô¥®=#l“YªOÿo§»~©Þxôkm6í±Oà÷öaÇëÍ·þO|ñ½üêËŠŽŠr¯´NîÁúPj@¯ŽnutÞûl§=ÆD…èá;Îa9¹eúrYë6 ÐÅçôrϼÕêâs{Ûª¨¸RËÖåØÚcÞâ ÈsfõÜq]r£=z àãû±Ü¸ä€ óœM—þ|€ ¥3YžðMí&à13/Ö-ÈÖ+¿^§§nX¦¹ïìQáÁJ÷ê‰uÅ—)<ÜYâ”Øµ«~tþy¶n­[óTZæìm3í'ƒ•’ÜÙ¶?›whã–\[÷éá„DÌÚ­êêÖ'_7_5X?ë,g2Ì’«{o®áƒœ<ýh»-ä­¼¢F¿{uƒ­õÒ+OÖ > [©›h`ßNºsj²>ý‡êítÞ:^jêÞóÊ9ÎfËñ=œPpwj²v—Ø_ãW[[Û()ÈÎʬI‘âžù Tœø=^š2cÆÓ>b¸{&½ýöÛúËŸ_wÏZçÖ«ë†Ë¹gNWª² 'L1mÎ/¹eŽ­[rñ{éÁÛëÿ]§Ü8K»Ò‹Ü³¦Í~ë\ÅF‡jź ìÓQ"ƒ•¶¯È¶FïÕ½ƒ¢;…Øç™ðèúûªì°€ÇãgWÒ´+»gÒÞÌbeå”((0@Ý#ÕÑyãÜë>×¾¬ã¶Ä&…éÞ?äžIïþq«–|Æ @Û¶qíjÅÅ'4š°Ónfð´ÕpÇxï½÷TUåÌÀ)((ÐÌÏfÚúh¼ðÆ&ýæ÷«´>5×¶÷÷÷Sxh }„aٓǧ_îQ¥Û‚|ÃæƒG w¼íÍ*Ñ´_eÉ‘JkÃ4}:o¦=°¨ÙpÇxéÍTÝ\w¿ù¹FRB„F Ó°A16Ü1mÖMHôÌ+ëíÒ±ã-go©µcTVTkíB§•<¾¨ÍàiÛºuë¦^½ziÆõÊËËwG¿©Zì¸]©ªkjURÚ|¸âa–A½óüé¶~üÅ5úÛÇξ<-ñÌàù`Vš|v¥L7ôƒclW­Ò²jmØrPÙGȘŽZæw‰îl—ˆ™û·ì*P~³/ÎwÁ´Ñ7ÖÌþ;kî×[O¦ºWh»¾3xÚ¶ôôt-\¸ð„;†ŸJʪUX\e­ wŒKÏs6C.+¯Ò¿ç9]µŽVm­´æë\{ÿÜ%Gî枅˳ôÑì=öu–¯ËùNÃcø¤ØC›+¯˜åìÇ€¯"àùžèž® ÎèaëϾܫ‚¢¶±õ‰è§3.uþ9¥Ú¼ÚY6€¯"àidžôÒä1ñºì‚Þzùñ“`÷àùó?·¸Ïøþˆ‰ÑÀQÑ}ZÝøÈ°Cݳæü#ÍÙŸFÀÓŽÝq]²þøðDýòg#•n72žñÊú£Ú\¹½yJMýí0]z× õeÇÖÌßÏò,@»@ÀÓŽíË,Ö¶]úzëAÛéjê/¶jceo»öÙרàø¶-?ÞŠò+•¹»Xûv)uy®Þyn³Þ~z“{ßF-A-€vŠ€ÀÇðø8GÀàãx|€#àðq<>Ž€h#º$©Ó Å g¦ 5üjkkýÜúì¬Ìšä|¹lº'„ë@~¹JJ«Ý­°„Šr׌yØ£h¸âÇŸe뫨¢ ×Ö­5x´\u—Âë^×[y~®ß9Å=k›üCÂ?ál[ç¬ùJ•y9¶î2þl„†©`ç&ïÞbÇßÞÆµ«ŸÐhÂ3x¾'z$Fè¹ÇëÃWÏVlT¨;Šo¢Sßd ¼únûðé}h,,¾›;zda]{jØOÚp§¶¶V¥Yé*LÛjÅ{w¸Ïj»‚:DzßáñÝÝQ©ïÞdÇ:'žï‰”!uÚø®ò÷o4a 'PÒé) 8D5•ZùÈZúË˵ò¡ëícÝŒ;ÝgÐ2àêØg°=æm]§¢]©¶àhð'P`DG{¬,8h|íz“åÐMHé¢QC;+6:T~uï4#»T+×çhÉêýªª®uŸÙ´ð°:®«F é¬èŽÁ*)­Ò®ô"ÍY´OiÅ‹ ÕÐѪ®©ÑüeYvlØÀ(1©›bCUV^­•rôé¼ô#þÆà~Qš<&Þî£P÷{Ô(3»Xë6ÔòµÙ*¯¨qŸY¯G×õíé„Ƹqº|J_[OarrËlíQRV¥¥k²Ý³cü³Ø‘“ë>e~*?˜}Ä*¡]º)"©·­ó6¯VuI‘­›âïﯞ=zèÀÁƒ*ÈÏwG¿ “ÎÕ ©÷ÛzÞõ'Û£é€5Ùzõã·(ë:[.fäĺ?G€{& ¼æ^wŒR^êí™õŽ;ꨭ¬PîYÓ"zô·ãи®ò²›;祮ÖõK¤ê*÷YÍ«­û·éœ±\§^þo]vû\ýîÕõZµÑ™uaÚµß~m²Ýº­33s²—αuü„sê>yNçYžeZ}l[ok4¯Úk†“hóKÍü0ÿ`çzuiÃYQÞ¯æVù‡Ô¿~u3« -kWÏ^¯ŽY}{Õ/C9Ù9ÎÒ«„¸05±rêÄøú³ÿ/¿UÕµvcæ×ßݦëîY {ŸXv¨“×…gö°Ç¶.c³ÙrH§u6^A£3Ìi'Ÿ±à{l­˜èhsÎÙ>b„;òýཤ*46Ñ­ ‰·mÒò¼l{ô(?XÛÕ­ó¾æ} íiWϺÔ\UW;K§ÎšØü—ß–lÚîlž¨¡œ¥CM5´³=îÉ(V¡×†Éß•ÏçïÕ†-N ÷n Gî²Uîµä,,ü›Ínú¶ ¶oTQú['œü#Å?Gþv)PæWÍtsjBLLŒþôòŸôßwÿ·fÌxJ—^v‰{¥ý+Ù»ãÐÒ©¨Ãí±)Ô_E^.Þ0wjá5¢¼^£0­ù͘'^» xò +5û« [O>)A'ŸÔüÒ%3;'ºSˆ{Voö¢}n%ýdJÓƒÌëöHt:ZÍYÔtôo+(°…éC.Ïï_PÔü>*¹Ž\Æ€^'nÃ\Ï,žÎÃ'(é´ÛÚ´û®,tª֘ s‚?³kõ“·©¦¬‰, PÃþ”b’O²§æÞ¢ôíò÷PD~véœa:›mþË“¶œx×®V\|B£ ;ín±xõ~Ûqjæü½ª¬¬¶aÈðA1•kòò*}<'M«7pïh(3»T×Üý¥f-L·!HLTˆR†Æ wv¦趇7î+Ûvhî’ •”VÕ}éöSÿ^4aT¼†Õ½ó~LhõÆ»[uÓý Zî/¼±I¿ùý*­OÍUEÝßżnxh }„yµ˜?Þ2Öï·cÚ§M¸cTVVêÞ{ïÓO®¸R—^z™Ï†;߯î^SêkÙM—ýüüÔ¡GEõfó,kïÜ÷µæé;šwŒê*­ÿÃ/´û“·l¸ªN}“Õ¡÷ î˜%\Ûþö‚R wÀ'´Ë<ÞÌr¦¡£Õ9*Ô.µ2¯Öo9¨’V¶67³vÌýÑuGsÏÎôBíH+t¯æwî×£ƒº'F*"¬î‹we2²K´i{¾ÊË¿M{öZìx–ŸU×Ô¶úoòm%u‰ú_~›­—ýú*•ìÝek=³ßN‡ž×UþAªÈÏUᎠZ¡‰pˆ:ô¢èXÕÖÔ¨ü@¦ v¦J5ßÍçÐzÍÍài÷Ú3WgÜ£o*¼kOåïØ¨ÕÓ§9À}¯–h¡íJ˜pŽ wŒ}sÞ·GðíðซN>I1#'ª×”ëÕÿª»íXÉþ½ÊZú…­À·Ã-w§¼2϶ôö¨*-ÖÚgîRᎯÝÐ,Ñ S´w‡ŠÒw*ûF¥Ï~W+ºžp€cˆ<>‚<í€#àðq<>Ž€ÀÇðø8GÀàãx|€#àðq<>Ž€ÀÇðø8GÀàãx|€#àðq<>Ž€ÀÇðø8GÀàãx|€#àðq<>Ž€ÀÇðø8GÀàãx|€#àðq<>Ž€ÀÇðø8×lÀëV8ÑZÊjš x†êV8ÑZÊjZx’Ý 'ZKYMóO23xÚŠ–²š&ž¸øÿÉÇkð AîN”Èd5&³q‡ð«­­õsë²³2kÌq䘱ª¬¬´cøniÍŠe¶n.àiv‰–ç†ý€=ÀwÏ“Í4îÍ^0ÌM¹PO?õ¤"ÂÃÝQo;vÔóø½L6ÓR¸c4»DË›g¹Ö ?»Y‹-¶c8>&Nœ W^zÑÖG wŒV<†'ä1>ÿb¶/^¢ÅK–(==ÝÀ7‘””¤ ãÇk„ñúáYgº£­ wŒV<Þ¼Ã;­ u¼}£€mÇQ'BhK¤ÿ™õ÷€ì’_IEND®B`‚ts-node-10.9.2/scripts/000077500000000000000000000000001453460306300146475ustar00rootroot00000000000000ts-node-10.9.2/scripts/build-pack.js000066400000000000000000000015541453460306300172250ustar00rootroot00000000000000// Written in JS to support Windows // Would otherwise be written as inline bash in package.json script const { exec } = require('child_process'); const { mkdtempSync, writeFileSync, readFileSync, unlinkSync, rmdirSync, readdirSync, } = require('fs'); const { join } = require('path'); const testDir = join(__dirname, '../tests'); const tarballPath = join(testDir, 'ts-node-packed.tgz'); const tempDir = mkdtempSync(join(testDir, 'tmp')); exec( `npm pack --ignore-scripts "${join(__dirname, '..')}"`, { cwd: tempDir }, (err, stdout) => { if (err) { console.error(err); process.exit(1); } const tempTarballPath = join( tempDir, readdirSync(tempDir).find((name) => name.endsWith('.tgz')) ); writeFileSync(tarballPath, readFileSync(tempTarballPath)); unlinkSync(tempTarballPath); rmdirSync(tempDir); } ); ts-node-10.9.2/scripts/create-merged-schema.ts000077500000000000000000000060061453460306300211660ustar00rootroot00000000000000#!/usr/bin/env ts-node /* * Create a complete JSON schema for tsconfig.json * by merging the schemastore schema with our ts-node additions. * This merged schema can be submitted in a pull request to * SchemaStore. */ import axios from 'axios'; import { resolve } from 'path'; import { writeFileSync } from 'fs'; async function main() { /** schemastore definition */ const schemastoreSchema = await getSchemastoreSchema(); /** ts-node schema auto-generated from ts-node source code */ const originalTsNodeSchema = require('../tsconfig.schema.json'); // Apply this prefix to the names of all ts-node-generated definitions const tsnodeDefinitionPrefix = 'tsNode'; let tsNodeSchema: any = JSON.parse( JSON.stringify(originalTsNodeSchema).replace( /#\/definitions\//g, `#/definitions/${tsnodeDefinitionPrefix}` ) ); tsNodeSchema.definitions = Object.fromEntries( Object.entries(tsNodeSchema.definitions).map(([key, value]) => [ `${tsnodeDefinitionPrefix}${key}`, value, ]) ); // console.dir(tsNodeSchema, { // depth: Infinity // }); /** Patch ts-node stuff into the schemastore definition. */ const mergedSchema = { ...schemastoreSchema, definitions: { ...Object.fromEntries( Object.entries(schemastoreSchema.definitions).filter( ([key]) => !key.startsWith(tsnodeDefinitionPrefix) ) ), ...tsNodeSchema.definitions, tsNodeTsConfigOptions: undefined, tsNodeTsConfigSchema: undefined, tsNodeDefinition: { properties: { 'ts-node': { ...tsNodeSchema.definitions.tsNodeTsConfigOptions, description: tsNodeSchema.definitions.tsNodeTsConfigSchema.properties[ 'ts-node' ].description, properties: { ...tsNodeSchema.definitions.tsNodeTsConfigOptions.properties, compilerOptions: { ...tsNodeSchema.definitions.tsNodeTsConfigOptions.properties .compilerOptions, allOf: [ { $ref: '#/definitions/compilerOptionsDefinition/properties/compilerOptions', }, ], }, }, }, }, }, }, }; // Splice into the allOf array at a spot that looks good. Does not affect // behavior of the schema, but looks nicer if we want to submit as a PR to schemastore. mergedSchema.allOf = mergedSchema.allOf.filter( (item: any) => !item.$ref?.includes('tsNode') ); mergedSchema.allOf.splice(mergedSchema.allOf.length - 1, 0, { $ref: '#/definitions/tsNodeDefinition', }); writeFileSync( resolve(__dirname, '../tsconfig.schemastore-schema.json'), JSON.stringify(mergedSchema, null, 2) ); } export async function getSchemastoreSchema() { const { data: schemastoreSchema } = await axios.get( 'https://schemastore.azurewebsites.net/schemas/json/tsconfig.json', { responseType: 'json' } ); return schemastoreSchema; } main(); ts-node-10.9.2/scripts/update-schemastore-schema-with-compiler-options.ts000066400000000000000000000042731453460306300265320ustar00rootroot00000000000000/* * NOTE this script is meant to be run very rarely, * to help patch missing compilerOptions into the tsconfig schema. * The TS team updates it manually and sometimes forget to * add new options to the schema. * For example, here is the first PR I sent after running this script: * https://github.com/SchemaStore/schemastore/pull/1168 * * This script adds some options that should *not* be in the schema, * so the output requires manual review. * There is no good, programmatic way to query the TypeScript API * for a list of all tsconfig options. * * TypeScript-Website has a database of rules; maybe we can use them in the future: * https://github.com/microsoft/TypeScript-Website/blob/v2/packages/tsconfig-reference/scripts/tsconfigRules.ts * * Dependencies of this script have deliberately not * been added to package.json. You can install them locally * only when needed to run this script. * * This script is not strictly related to ts-node, so * theoretically it should be extracted to somewhere else * in the TypeStrong org. */ import {} from 'ts-expose-internals'; import * as ts from 'typescript'; import { getSchemastoreSchema } from './create-merged-schema'; // Sometimes schemastore becomes out of date with the latest tsconfig options. // This script async function main() { const schemastoreSchema = await getSchemastoreSchema(); const compilerOptions = schemastoreSchema.definitions.compilerOptionsDefinition.properties .compilerOptions.properties; // These options are only available via CLI flags, not in a tsconfig file. const excludedOptions = [ 'help', 'all', 'version', 'init', 'project', 'build', 'showConfig', 'generateCpuProfile', // <- technically gets parsed, but doesn't seem to do anything? 'locale', 'out', // <-- deprecated ]; ts.optionDeclarations.forEach((v) => { if (excludedOptions.includes(v.name)) return; if (!compilerOptions[v.name]) { compilerOptions[v.name] = { description: v.description?.message, type: v.type, }; } }); // Don't write to a file; this is not part of our build process console.log(JSON.stringify(schemastoreSchema, null, 2)); } main(); ts-node-10.9.2/src/000077500000000000000000000000001453460306300137475ustar00rootroot00000000000000ts-node-10.9.2/src/bin-cwd.ts000066400000000000000000000001341453460306300156400ustar00rootroot00000000000000#!/usr/bin/env node import { main } from './bin'; main(undefined, { '--cwdMode': true }); ts-node-10.9.2/src/bin-esm.ts000066400000000000000000000001301453460306300156430ustar00rootroot00000000000000#!/usr/bin/env node import { main } from './bin'; main(undefined, { '--esm': true }); ts-node-10.9.2/src/bin-script-deprecated.ts000066400000000000000000000003511453460306300204660ustar00rootroot00000000000000#!/usr/bin/env node import { main } from './bin'; console.warn( 'ts-script has been deprecated and will be removed in the next major release.', 'Please use ts-node-script instead' ); main(undefined, { '--scriptMode': true }); ts-node-10.9.2/src/bin-script.ts000066400000000000000000000001371453460306300163720ustar00rootroot00000000000000#!/usr/bin/env node import { main } from './bin'; main(undefined, { '--scriptMode': true }); ts-node-10.9.2/src/bin-transpile.ts000066400000000000000000000001421453460306300170630ustar00rootroot00000000000000#!/usr/bin/env node import { main } from './bin'; main(undefined, { '--transpileOnly': true }); ts-node-10.9.2/src/bin.ts000066400000000000000000000624571453460306300151050ustar00rootroot00000000000000#!/usr/bin/env node import { join, resolve, dirname, parse as parsePath, relative } from 'path'; import { inspect } from 'util'; import Module = require('module'); let arg: typeof import('arg'); import { parse, createRequire, hasOwnProperty, versionGteLt } from './util'; import { EVAL_FILENAME, EvalState, createRepl, ReplService, setupContext, STDIN_FILENAME, EvalAwarePartialHost, EVAL_NAME, STDIN_NAME, REPL_FILENAME, } from './repl'; import { VERSION, TSError, register, createEsmHooks, createFromPreloadedConfig, DEFAULTS, ExperimentalSpecifierResolution, } from './index'; import type { TSInternal } from './ts-compiler-types'; import { addBuiltinLibsToObject } from '../dist-raw/node-internal-modules-cjs-helpers'; import { callInChild } from './child/spawn-child'; import { findAndReadConfig } from './configuration'; /** * Main `bin` functionality. * * This file is split into a chain of functions (phases), each one adding to a shared state object. * This is done so that the next function can either be invoked in-process or, if necessary, invoked in a child process. * * The functions are intentionally given uncreative names and left in the same order as the original code, to make a * smaller git diff. */ export function main( argv: string[] = process.argv.slice(2), entrypointArgs: Record = {} ) { const args = parseArgv(argv, entrypointArgs); const state: BootstrapState = { shouldUseChildProcess: false, isInChildProcess: false, isCli: true, tsNodeScript: __filename, parseArgvResult: args, }; return bootstrap(state); } /** * @internal * Describes state of CLI bootstrapping. * Can be marshalled when necessary to resume bootstrapping in a child process. */ export interface BootstrapState { isInChildProcess: boolean; shouldUseChildProcess: boolean; /** * True if bootstrapping the ts-node CLI process or the direct child necessitated by `--esm`. * false if bootstrapping a subsequently `fork()`ed child. */ isCli: boolean; tsNodeScript: string; parseArgvResult: ReturnType; phase2Result?: ReturnType; phase3Result?: ReturnType; } /** @internal */ export function bootstrap(state: BootstrapState) { if (!state.phase2Result) { state.phase2Result = phase2(state); if (state.shouldUseChildProcess && !state.isInChildProcess) { // Note: When transitioning into the child-process after `phase2`, // the updated working directory needs to be preserved. return callInChild(state); } } if (!state.phase3Result) { state.phase3Result = phase3(state); if (state.shouldUseChildProcess && !state.isInChildProcess) { // Note: When transitioning into the child-process after `phase2`, // the updated working directory needs to be preserved. return callInChild(state); } } return phase4(state); } function parseArgv(argv: string[], entrypointArgs: Record) { arg ??= require('arg'); // HACK: technically, this function is not marked @internal so it's possible // that libraries in the wild are doing `require('ts-node/dist/bin').main({'--transpile-only': true})` // We can mark this function @internal in next major release. // For now, rewrite args to avoid a breaking change. entrypointArgs = { ...entrypointArgs }; for (const key of Object.keys(entrypointArgs)) { entrypointArgs[ key.replace( /([a-z])-([a-z])/g, (_$0, $1, $2: string) => `${$1}${$2.toUpperCase()}` ) ] = entrypointArgs[key]; } const args = { ...entrypointArgs, ...arg( { // Node.js-like options. '--eval': String, '--interactive': Boolean, '--print': Boolean, '--require': [String], // CLI options. '--help': Boolean, '--cwdMode': Boolean, '--scriptMode': Boolean, '--version': arg.COUNT, '--showConfig': Boolean, '--esm': Boolean, // Project options. '--cwd': String, '--files': Boolean, '--compiler': String, '--compilerOptions': parse, '--project': String, '--ignoreDiagnostics': [String], '--ignore': [String], '--transpileOnly': Boolean, '--transpiler': String, '--swc': Boolean, '--typeCheck': Boolean, '--compilerHost': Boolean, '--pretty': Boolean, '--skipProject': Boolean, '--skipIgnore': Boolean, '--preferTsExts': Boolean, '--logError': Boolean, '--emit': Boolean, '--scope': Boolean, '--scopeDir': String, '--noExperimentalReplAwait': Boolean, '--experimentalSpecifierResolution': String, // Aliases. '-e': '--eval', '-i': '--interactive', '-p': '--print', '-r': '--require', '-h': '--help', '-s': '--script-mode', '-v': '--version', '-T': '--transpileOnly', '-H': '--compilerHost', '-I': '--ignore', '-P': '--project', '-C': '--compiler', '-D': '--ignoreDiagnostics', '-O': '--compilerOptions', '--dir': '--cwd', // Support both tsc-style camelCase and node-style hypen-case for *all* flags '--cwd-mode': '--cwdMode', '--script-mode': '--scriptMode', '--show-config': '--showConfig', '--compiler-options': '--compilerOptions', '--ignore-diagnostics': '--ignoreDiagnostics', '--transpile-only': '--transpileOnly', '--type-check': '--typeCheck', '--compiler-host': '--compilerHost', '--skip-project': '--skipProject', '--skip-ignore': '--skipIgnore', '--prefer-ts-exts': '--preferTsExts', '--log-error': '--logError', '--scope-dir': '--scopeDir', '--no-experimental-repl-await': '--noExperimentalReplAwait', '--experimental-specifier-resolution': '--experimentalSpecifierResolution', }, { argv, stopAtPositional: true, } ), }; // Only setting defaults for CLI-specific flags // Anything passed to `register()` can be `undefined`; `create()` will apply // defaults. const { '--cwd': cwdArg, '--help': help = false, '--scriptMode': scriptMode, '--cwdMode': cwdMode, '--version': version = 0, '--showConfig': showConfig, '--require': argsRequire = [], '--eval': code = undefined, '--print': print = false, '--interactive': interactive = false, '--files': files, '--compiler': compiler, '--compilerOptions': compilerOptions, '--project': project, '--ignoreDiagnostics': ignoreDiagnostics, '--ignore': ignore, '--transpileOnly': transpileOnly, '--typeCheck': typeCheck, '--transpiler': transpiler, '--swc': swc, '--compilerHost': compilerHost, '--pretty': pretty, '--skipProject': skipProject, '--skipIgnore': skipIgnore, '--preferTsExts': preferTsExts, '--logError': logError, '--emit': emit, '--scope': scope = undefined, '--scopeDir': scopeDir = undefined, '--noExperimentalReplAwait': noExperimentalReplAwait, '--experimentalSpecifierResolution': experimentalSpecifierResolution, '--esm': esm, _: restArgs, } = args; return { // Note: argv and restArgs may be overwritten by child process argv: process.argv, restArgs, cwdArg, help, scriptMode, cwdMode, version, showConfig, argsRequire, code, print, interactive, files, compiler, compilerOptions, project, ignoreDiagnostics, ignore, transpileOnly, typeCheck, transpiler, swc, compilerHost, pretty, skipProject, skipIgnore, preferTsExts, logError, emit, scope, scopeDir, noExperimentalReplAwait, experimentalSpecifierResolution, esm, }; } function phase2(payload: BootstrapState) { const { help, version, cwdArg, esm } = payload.parseArgvResult; if (help) { console.log(` Usage: ts-node [options] [ -e script | script.ts ] [arguments] Options: -e, --eval [code] Evaluate code -p, --print Print result of \`--eval\` -r, --require [path] Require a node module before execution -i, --interactive Opens the REPL even if stdin does not appear to be a terminal --esm Bootstrap with the ESM loader, enabling full ESM support --swc Use the faster swc transpiler -h, --help Print CLI usage -v, --version Print module version information. -vvv to print additional information --showConfig Print resolved configuration and exit -T, --transpileOnly Use TypeScript's faster \`transpileModule\` or a third-party transpiler -H, --compilerHost Use TypeScript's compiler host API -I, --ignore [pattern] Override the path patterns to skip compilation -P, --project [path] Path to TypeScript JSON project file -C, --compiler [name] Specify a custom TypeScript compiler --transpiler [name] Specify a third-party, non-typechecking transpiler -D, --ignoreDiagnostics [code] Ignore TypeScript warnings by diagnostic code -O, --compilerOptions [opts] JSON object to merge with compiler options --cwd Behave as if invoked within this working directory. --files Load \`files\`, \`include\` and \`exclude\` from \`tsconfig.json\` on startup --pretty Use pretty diagnostic formatter (usually enabled by default) --cwdMode Use current directory instead of for config resolution --skipProject Skip reading \`tsconfig.json\` --skipIgnore Skip \`--ignore\` checks --emit Emit output files into \`.ts-node\` directory --scope Scope compiler to files within \`scopeDir\`. Anything outside this directory is ignored. --scopeDir Directory for \`--scope\` --preferTsExts Prefer importing TypeScript files over JavaScript files --logError Logs TypeScript errors to stderr instead of throwing exceptions --noExperimentalReplAwait Disable top-level await in REPL. Equivalent to node's --no-experimental-repl-await --experimentalSpecifierResolution [node|explicit] Equivalent to node's --experimental-specifier-resolution `); process.exit(0); } // Output project information. if (version === 1) { console.log(`v${VERSION}`); process.exit(0); } const cwd = cwdArg ? resolve(cwdArg) : process.cwd(); // If ESM is explicitly enabled through the flag, stage3 should be run in a child process // with the ESM loaders configured. if (esm) payload.shouldUseChildProcess = true; return { cwd, }; } function phase3(payload: BootstrapState) { const { emit, files, pretty, transpileOnly, transpiler, noExperimentalReplAwait, typeCheck, swc, compilerHost, ignore, preferTsExts, logError, scriptMode, cwdMode, project, skipProject, skipIgnore, compiler, ignoreDiagnostics, compilerOptions, argsRequire, scope, scopeDir, esm, experimentalSpecifierResolution, } = payload.parseArgvResult; const { cwd } = payload.phase2Result!; // NOTE: When we transition to a child process for ESM, the entry-point script determined // here might not be the one used later in `phase4`. This can happen when we execute the // original entry-point but then the process forks itself using e.g. `child_process.fork`. // We will always use the original TS project in forked processes anyway, so it is // expected and acceptable to retrieve the entry-point information here in `phase2`. // See: https://github.com/TypeStrong/ts-node/issues/1812. const { entryPointPath } = getEntryPointInfo(payload); const preloadedConfig = findAndReadConfig({ cwd, emit, files, pretty, transpileOnly: transpileOnly ?? transpiler != null ? true : undefined, experimentalReplAwait: noExperimentalReplAwait ? false : undefined, typeCheck, transpiler, swc, compilerHost, ignore, logError, projectSearchDir: getProjectSearchDir( cwd, scriptMode, cwdMode, entryPointPath ), project, skipProject, skipIgnore, compiler, ignoreDiagnostics, compilerOptions, require: argsRequire, scope, scopeDir, preferTsExts, esm, experimentalSpecifierResolution: experimentalSpecifierResolution as ExperimentalSpecifierResolution, }); // If ESM is enabled through the parsed tsconfig, stage4 should be run in a child // process with the ESM loaders configured. if (preloadedConfig.options.esm) payload.shouldUseChildProcess = true; return { preloadedConfig }; } /** * Determines the entry-point information from the argv and phase2 result. This * method will be invoked in two places: * * 1. In phase 3 to be able to find a project from the potential entry-point script. * 2. In phase 4 to determine the actual entry-point script. * * Note that we need to explicitly re-resolve the entry-point information in the final * stage because the previous stage information could be modified when the bootstrap * invocation transitioned into a child process for ESM. * * Stages before (phase 4) can and will be cached by the child process through the Brotli * configuration and entry-point information is only reliable in the final phase. More * details can be found in here: https://github.com/TypeStrong/ts-node/issues/1812. */ function getEntryPointInfo(state: BootstrapState) { const { code, interactive, restArgs } = state.parseArgvResult!; const { cwd } = state.phase2Result!; const { isCli } = state; // Figure out which we are executing: piped stdin, --eval, REPL, and/or entrypoint // This is complicated because node's behavior is complicated // `node -e code -i ./script.js` ignores -e const executeEval = code != null && !(interactive && restArgs.length); const executeEntrypoint = !executeEval && restArgs.length > 0; const executeRepl = !executeEntrypoint && (interactive || (process.stdin.isTTY && !executeEval)); const executeStdin = !executeEval && !executeRepl && !executeEntrypoint; /** * Unresolved. May point to a symlink, not realpath. May be missing file extension * NOTE: resolution relative to cwd option (not `process.cwd()`) is legacy backwards-compat; should be changed in next major: https://github.com/TypeStrong/ts-node/issues/1834 */ const entryPointPath = executeEntrypoint ? isCli ? resolve(cwd, restArgs[0]) : resolve(restArgs[0]) : undefined; return { executeEval, executeEntrypoint, executeRepl, executeStdin, entryPointPath, }; } function phase4(payload: BootstrapState) { const { isInChildProcess, tsNodeScript } = payload; const { version, showConfig, restArgs, code, print, argv } = payload.parseArgvResult; const { cwd } = payload.phase2Result!; const { preloadedConfig } = payload.phase3Result!; const { entryPointPath, executeEntrypoint, executeEval, executeRepl, executeStdin, } = getEntryPointInfo(payload); /** * , [stdin], and [eval] are all essentially virtual files that do not exist on disc and are backed by a REPL * service to handle eval-ing of code. */ interface VirtualFileState { state: EvalState; repl: ReplService; module?: Module; } let evalStuff: VirtualFileState | undefined; let replStuff: VirtualFileState | undefined; let stdinStuff: VirtualFileState | undefined; let evalAwarePartialHost: EvalAwarePartialHost | undefined = undefined; if (executeEval) { const state = new EvalState(join(cwd, EVAL_FILENAME)); evalStuff = { state, repl: createRepl({ state, composeWithEvalAwarePartialHost: evalAwarePartialHost, ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl: false, }), }; ({ evalAwarePartialHost } = evalStuff.repl); // Create a local module instance based on `cwd`. const module = (evalStuff.module = new Module(EVAL_NAME)); module.filename = evalStuff.state.path; module.paths = (Module as any)._nodeModulePaths(cwd); } if (executeStdin) { const state = new EvalState(join(cwd, STDIN_FILENAME)); stdinStuff = { state, repl: createRepl({ state, composeWithEvalAwarePartialHost: evalAwarePartialHost, ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl: false, }), }; ({ evalAwarePartialHost } = stdinStuff.repl); // Create a local module instance based on `cwd`. const module = (stdinStuff.module = new Module(STDIN_NAME)); module.filename = stdinStuff.state.path; module.paths = (Module as any)._nodeModulePaths(cwd); } if (executeRepl) { const state = new EvalState(join(cwd, REPL_FILENAME)); replStuff = { state, repl: createRepl({ state, composeWithEvalAwarePartialHost: evalAwarePartialHost, }), }; ({ evalAwarePartialHost } = replStuff.repl); } // Register the TypeScript compiler instance. const service = createFromPreloadedConfig({ // Since this struct may have been marshalled across thread or process boundaries, we must restore // un-marshall-able values. ...preloadedConfig, options: { ...preloadedConfig.options, readFile: evalAwarePartialHost?.readFile ?? undefined, fileExists: evalAwarePartialHost?.fileExists ?? undefined, tsTrace: DEFAULTS.tsTrace, }, }); register(service); if (isInChildProcess) ( require('./child/child-loader') as typeof import('./child/child-loader') ).lateBindHooks(createEsmHooks(service)); // Bind REPL service to ts-node compiler service (chicken-and-egg problem) replStuff?.repl.setService(service); evalStuff?.repl.setService(service); stdinStuff?.repl.setService(service); // Output project information. if (version === 2) { console.log(`ts-node v${VERSION}`); console.log(`node ${process.version}`); console.log(`compiler v${service.ts.version}`); process.exit(0); } if (version >= 3) { console.log(`ts-node v${VERSION} ${dirname(__dirname)}`); console.log(`node ${process.version}`); console.log( `compiler v${service.ts.version} ${service.compilerPath ?? ''}` ); process.exit(0); } if (showConfig) { const ts = service.ts as any as TSInternal; if (typeof ts.convertToTSConfig !== 'function') { console.error( 'Error: --showConfig requires a typescript versions >=3.2 that support --showConfig' ); process.exit(1); } let moduleTypes = undefined; if (service.options.moduleTypes) { // Assumption: this codepath requires CLI invocation, so moduleTypes must have come from a tsconfig, not API. const showRelativeTo = dirname(service.configFilePath!); moduleTypes = {} as Record; for (const [key, value] of Object.entries(service.options.moduleTypes)) { moduleTypes[ relative( showRelativeTo, resolve(service.options.optionBasePaths?.moduleTypes!, key) ) ] = value; } } const json = { ['ts-node']: { ...service.options, require: service.options.require?.length ? service.options.require : undefined, moduleTypes, optionBasePaths: undefined, compilerOptions: undefined, project: service.configFilePath ?? service.options.project, }, ...ts.convertToTSConfig( service.config, service.configFilePath ?? join(cwd, 'ts-node-implicit-tsconfig.json'), service.ts.sys ), }; console.log( // Assumes that all configuration options which can possibly be specified via the CLI are JSON-compatible. // If, in the future, we must log functions, for example readFile and fileExists, then we can implement a JSON // replacer function. JSON.stringify(json, null, 2) ); process.exit(0); } // Prepend `ts-node` arguments to CLI for child processes. process.execArgv.push( tsNodeScript, ...argv.slice(2, argv.length - restArgs.length) ); // TODO this comes from BootstrapState process.argv = [process.argv[1]] .concat(executeEntrypoint ? ([entryPointPath] as string[]) : []) .concat(restArgs.slice(executeEntrypoint ? 1 : 0)); // Execute the main contents (either eval, script or piped). if (executeEntrypoint) { if ( payload.isInChildProcess && versionGteLt(process.versions.node, '18.6.0') ) { // HACK workaround node regression require('../dist-raw/runmain-hack.js').run(entryPointPath); } else { Module.runMain(); } } else { // Note: eval and repl may both run, but never with stdin. // If stdin runs, eval and repl will not. if (executeEval) { addBuiltinLibsToObject(global); evalAndExitOnTsError( evalStuff!.repl, evalStuff!.module!, code!, print, 'eval' ); } if (executeRepl) { replStuff!.repl.start(); } if (executeStdin) { let buffer = code || ''; process.stdin.on('data', (chunk: Buffer) => (buffer += chunk)); process.stdin.on('end', () => { evalAndExitOnTsError( stdinStuff!.repl, stdinStuff!.module!, buffer, // `echo 123 | node -p` still prints 123 print, 'stdin' ); }); } } } /** * Get project search path from args. */ function getProjectSearchDir( cwd?: string, scriptMode?: boolean, cwdMode?: boolean, scriptPath?: string ) { // Validate `--script-mode` / `--cwd-mode` / `--cwd` usage is correct. if (scriptMode && cwdMode) { throw new TypeError('--cwd-mode cannot be combined with --script-mode'); } if (scriptMode && !scriptPath) { throw new TypeError( '--script-mode must be used with a script name, e.g. `ts-node --script-mode `' ); } const doScriptMode = scriptMode === true ? true : cwdMode === true ? false : !!scriptPath; if (doScriptMode) { // Use node's own resolution behavior to ensure we follow symlinks. // scriptPath may omit file extension or point to a directory with or without package.json. // This happens before we are registered, so we tell node's resolver to consider ts, tsx, and jsx files. // In extremely rare cases, is is technically possible to resolve the wrong directory, // because we do not yet know preferTsExts, jsx, nor allowJs. // See also, justification why this will not happen in real-world situations: // https://github.com/TypeStrong/ts-node/pull/1009#issuecomment-613017081 const exts = ['.js', '.jsx', '.ts', '.tsx']; const extsTemporarilyInstalled: string[] = []; for (const ext of exts) { if (!hasOwnProperty(require.extensions, ext)) { extsTemporarilyInstalled.push(ext); require.extensions[ext] = function () {}; } } try { return dirname(requireResolveNonCached(scriptPath!)); } finally { for (const ext of extsTemporarilyInstalled) { delete require.extensions[ext]; } } } return cwd; } const guaranteedNonexistentDirectoryPrefix = resolve(__dirname, 'doesnotexist'); let guaranteedNonexistentDirectorySuffix = 0; /** * require.resolve an absolute path, tricking node into *not* caching the results. * Necessary so that we do not pollute require.resolve cache prior to installing require.extensions * * Is a terrible hack, because node does not expose the necessary cache invalidation APIs * https://stackoverflow.com/questions/59865584/how-to-invalidate-cached-require-resolve-results */ function requireResolveNonCached(absoluteModuleSpecifier: string) { // node <= 12.1.x fallback: The trick below triggers a node bug on old versions. // On these old versions, pollute the require cache instead. This is a deliberate // ts-node limitation that will *rarely* manifest, and will not matter once node 12 // is end-of-life'd on 2022-04-30 const isSupportedNodeVersion = versionGteLt(process.versions.node, '12.2.0'); if (!isSupportedNodeVersion) return require.resolve(absoluteModuleSpecifier); const { dir, base } = parsePath(absoluteModuleSpecifier); const relativeModuleSpecifier = `./${base}`; const req = createRequire( join(dir, 'imaginaryUncacheableRequireResolveScript') ); return req.resolve(relativeModuleSpecifier, { paths: [ `${guaranteedNonexistentDirectoryPrefix}${guaranteedNonexistentDirectorySuffix++}`, ...(req.resolve.paths(relativeModuleSpecifier) || []), ], }); } /** * Evaluate an [eval] or [stdin] script */ function evalAndExitOnTsError( replService: ReplService, module: Module, code: string, isPrinted: boolean, filenameAndDirname: 'eval' | 'stdin' ) { let result: any; setupContext(global, module, filenameAndDirname); try { result = replService.evalCode(code); } catch (error) { if (error instanceof TSError) { console.error(error); process.exit(1); } throw error; } if (isPrinted) { console.log( typeof result === 'string' ? result : inspect(result, { colors: process.stdout.isTTY }) ); } } if (require.main === module) { main(); } ts-node-10.9.2/src/child/000077500000000000000000000000001453460306300150325ustar00rootroot00000000000000ts-node-10.9.2/src/child/argv-payload.ts000066400000000000000000000010161453460306300177660ustar00rootroot00000000000000import { brotliCompressSync, brotliDecompressSync, constants } from 'zlib'; /** @internal */ export const argPrefix = '--brotli-base64-config='; /** @internal */ export function compress(object: any) { return brotliCompressSync(Buffer.from(JSON.stringify(object), 'utf8'), { [constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MIN_QUALITY, }).toString('base64'); } /** @internal */ export function decompress(str: string) { return JSON.parse( brotliDecompressSync(Buffer.from(str, 'base64')).toString() ); } ts-node-10.9.2/src/child/child-entrypoint.ts000066400000000000000000000016101453460306300206740ustar00rootroot00000000000000import { BootstrapState, bootstrap } from '../bin'; import { argPrefix, compress, decompress } from './argv-payload'; const base64ConfigArg = process.argv[2]; if (!base64ConfigArg.startsWith(argPrefix)) throw new Error('unexpected argv'); const base64Payload = base64ConfigArg.slice(argPrefix.length); const state = decompress(base64Payload) as BootstrapState; state.isInChildProcess = true; state.tsNodeScript = __filename; state.parseArgvResult.argv = process.argv; state.parseArgvResult.restArgs = process.argv.slice(3); // Modify and re-compress the payload delivered to subsequent child processes. // This logic may be refactored into bin.ts by https://github.com/TypeStrong/ts-node/issues/1831 if (state.isCli) { const stateForChildren: BootstrapState = { ...state, isCli: false, }; state.parseArgvResult.argv[2] = `${argPrefix}${compress(stateForChildren)}`; } bootstrap(state); ts-node-10.9.2/src/child/child-loader.ts000066400000000000000000000020451453460306300177320ustar00rootroot00000000000000import type { NodeLoaderHooksAPI1, NodeLoaderHooksAPI2 } from '..'; import { filterHooksByAPIVersion } from '../esm'; let hooks: NodeLoaderHooksAPI1 & NodeLoaderHooksAPI2; /** @internal */ export function lateBindHooks( _hooks: NodeLoaderHooksAPI1 | NodeLoaderHooksAPI2 ) { hooks = _hooks as NodeLoaderHooksAPI1 & NodeLoaderHooksAPI2; } const proxy: NodeLoaderHooksAPI1 & NodeLoaderHooksAPI2 = { resolve(...args: Parameters) { return (hooks?.resolve ?? args[2])(...args); }, load(...args: Parameters) { return (hooks?.load ?? args[2])(...args); }, getFormat(...args: Parameters) { return (hooks?.getFormat ?? args[2])(...args); }, transformSource(...args: Parameters) { return (hooks?.transformSource ?? args[2])(...args); }, }; /** @internal */ export const { resolve, load, getFormat, transformSource } = filterHooksByAPIVersion(proxy) as NodeLoaderHooksAPI1 & NodeLoaderHooksAPI2; ts-node-10.9.2/src/child/child-require.ts000066400000000000000000000017331453460306300201430ustar00rootroot00000000000000interface EventEmitterInternals { _events: Record>; } const _process = process as any as EventEmitterInternals; // Not shown here: Additional logic to correctly interact with process's events, either using this direct manipulation, or via the API let originalOnWarning: Function | undefined; if (Array.isArray(_process._events.warning)) { originalOnWarning = _process._events.warning[0]; _process._events.warning[0] = onWarning; } else { originalOnWarning = _process._events.warning; _process._events.warning = onWarning; } const messageMatch = /(?:--(?:experimental-)?loader\b|\bCustom ESM Loaders\b)/; function onWarning(this: any, warning: Error, ...rest: any[]) { // Suppress warning about how `--loader` is experimental if ( warning?.name === 'ExperimentalWarning' && messageMatch.test(warning?.message) ) return; // Will be undefined if `--no-warnings` return originalOnWarning?.call(this, warning, ...rest); } ts-node-10.9.2/src/child/spawn-child.ts000066400000000000000000000032061453460306300176140ustar00rootroot00000000000000import type { BootstrapState } from '../bin'; import { spawn } from 'child_process'; import { pathToFileURL } from 'url'; import { versionGteLt } from '../util'; import { argPrefix, compress } from './argv-payload'; /** * @internal * @param state Bootstrap state to be transferred into the child process. * @param targetCwd Working directory to be preserved when transitioning to * the child process. */ export function callInChild(state: BootstrapState) { if (!versionGteLt(process.versions.node, '12.17.0')) { throw new Error( '`ts-node-esm` and `ts-node --esm` require node version 12.17.0 or newer.' ); } const child = spawn( process.execPath, [ '--require', require.resolve('./child-require.js'), '--loader', // Node on Windows doesn't like `c:\` absolute paths here; must be `file:///c:/` pathToFileURL(require.resolve('../../child-loader.mjs')).toString(), require.resolve('./child-entrypoint.js'), `${argPrefix}${compress(state)}`, ...state.parseArgvResult.restArgs, ], { stdio: 'inherit', argv0: process.argv0, } ); child.on('error', (error) => { console.error(error); process.exit(1); }); child.on('exit', (code) => { child.removeAllListeners(); process.off('SIGINT', sendSignalToChild); process.off('SIGTERM', sendSignalToChild); process.exitCode = code === null ? 1 : code; }); // Ignore sigint and sigterm in parent; pass them to child process.on('SIGINT', sendSignalToChild); process.on('SIGTERM', sendSignalToChild); function sendSignalToChild(signal: string) { process.kill(child.pid, signal); } } ts-node-10.9.2/src/cjs-resolve-hooks.ts000066400000000000000000000034421453460306300176770ustar00rootroot00000000000000import type Module = require('module'); import type { Service } from '.'; /** @internal */ export type ModuleConstructorWithInternals = typeof Module & { _resolveFilename( request: string, parent?: Module, isMain?: boolean, options?: ModuleResolveFilenameOptions, ...rest: any[] ): string; _preloadModules(requests?: string[]): void; _findPath(request: string, paths: string[], isMain: boolean): string; }; interface ModuleResolveFilenameOptions { paths?: Array; } /** * @internal */ export function installCommonjsResolveHooksIfNecessary(tsNodeService: Service) { const Module = require('module') as ModuleConstructorWithInternals; const originalResolveFilename = Module._resolveFilename; const originalFindPath = Module._findPath; const shouldInstallHook = tsNodeService.options.experimentalResolver; if (shouldInstallHook) { const { Module_findPath, Module_resolveFilename } = tsNodeService.getNodeCjsLoader(); Module._resolveFilename = _resolveFilename; Module._findPath = _findPath; function _resolveFilename( this: any, request: string, parent?: Module, isMain?: boolean, options?: ModuleResolveFilenameOptions, ...rest: [] ): string { if (!tsNodeService.enabled()) return originalResolveFilename.call( this, request, parent, isMain, options, ...rest ); return Module_resolveFilename.call( this, request, parent, isMain, options, ...rest ); } function _findPath(this: any): string { if (!tsNodeService.enabled()) return originalFindPath.apply(this, arguments as any); return Module_findPath.apply(this, arguments as any); } } } ts-node-10.9.2/src/configuration.ts000066400000000000000000000326551453460306300172010ustar00rootroot00000000000000import { resolve, dirname, join } from 'path'; import type * as _ts from 'typescript'; import { CreateOptions, DEFAULTS, OptionBasePaths, RegisterOptions, TSCommon, TsConfigOptions, } from './index'; import type { TSInternal } from './ts-compiler-types'; import { createTsInternals } from './ts-internals'; import { getDefaultTsconfigJsonForNodeVersion } from './tsconfigs'; import { assign, attemptRequireWithV8CompileCache, createProjectLocalResolveHelper, getBasePathForProjectLocalDependencyResolution, } from './util'; /** * TypeScript compiler option values required by `ts-node` which cannot be overridden. */ const TS_NODE_COMPILER_OPTIONS = { sourceMap: true, inlineSourceMap: false, inlineSources: true, declaration: false, noEmit: false, outDir: '.ts-node', }; /* * Do post-processing on config options to support `ts-node`. */ function fixConfig(ts: TSCommon, config: _ts.ParsedCommandLine) { // Delete options that *should not* be passed through. delete config.options.out; delete config.options.outFile; delete config.options.composite; delete config.options.declarationDir; delete config.options.declarationMap; delete config.options.emitDeclarationOnly; // Target ES5 output by default (instead of ES3). if (config.options.target === undefined) { config.options.target = ts.ScriptTarget.ES5; } // Target CommonJS modules by default (instead of magically switching to ES6 when the target is ES6). if (config.options.module === undefined) { config.options.module = ts.ModuleKind.CommonJS; } return config; } /** @internal */ export function findAndReadConfig(rawOptions: CreateOptions) { const cwd = resolve( rawOptions.cwd ?? rawOptions.dir ?? DEFAULTS.cwd ?? process.cwd() ); const compilerName = rawOptions.compiler ?? DEFAULTS.compiler; // Compute minimum options to read the config file. let projectLocalResolveDir = getBasePathForProjectLocalDependencyResolution( undefined, rawOptions.projectSearchDir, rawOptions.project, cwd ); let { compiler, ts } = resolveAndLoadCompiler( compilerName, projectLocalResolveDir ); // Read config file and merge new options between env and CLI options. const { configFilePath, config, tsNodeOptionsFromTsconfig, optionBasePaths } = readConfig(cwd, ts, rawOptions); const options = assign( {}, DEFAULTS, tsNodeOptionsFromTsconfig || {}, { optionBasePaths }, rawOptions ); options.require = [ ...(tsNodeOptionsFromTsconfig.require || []), ...(rawOptions.require || []), ]; // Re-resolve the compiler in case it has changed. // Compiler is loaded relative to tsconfig.json, so tsconfig discovery may cause us to load a // different compiler than we did above, even if the name has not changed. if (configFilePath) { projectLocalResolveDir = getBasePathForProjectLocalDependencyResolution( configFilePath, rawOptions.projectSearchDir, rawOptions.project, cwd ); ({ compiler } = resolveCompiler( options.compiler, optionBasePaths.compiler ?? projectLocalResolveDir )); } return { options, config, projectLocalResolveDir, optionBasePaths, configFilePath, cwd, compiler, }; } /** * Load TypeScript configuration. Returns the parsed TypeScript config and * any `ts-node` options specified in the config file. * * Even when a tsconfig.json is not loaded, this function still handles merging * compilerOptions from various sources: API, environment variables, etc. * * @internal */ export function readConfig( cwd: string, ts: TSCommon, rawApiOptions: CreateOptions ): { /** * Path of tsconfig file if one was loaded */ configFilePath: string | undefined; /** * Parsed TypeScript configuration with compilerOptions merged from all other sources (env vars, etc) */ config: _ts.ParsedCommandLine; /** * ts-node options pulled from `tsconfig.json`, NOT merged with any other sources. Merging must happen outside * this function. */ tsNodeOptionsFromTsconfig: TsConfigOptions; optionBasePaths: OptionBasePaths; } { // Ordered [a, b, c] where config a extends b extends c const configChain: Array<{ config: any; basePath: string; configPath: string; }> = []; let config: any = { compilerOptions: {} }; let basePath = cwd; let configFilePath: string | undefined = undefined; const projectSearchDir = resolve(cwd, rawApiOptions.projectSearchDir ?? cwd); const { fileExists = ts.sys.fileExists, readFile = ts.sys.readFile, skipProject = DEFAULTS.skipProject, project = DEFAULTS.project, tsTrace = DEFAULTS.tsTrace, } = rawApiOptions; // Read project configuration when available. if (!skipProject) { if (project) { const resolved = resolve(cwd, project); const nested = join(resolved, 'tsconfig.json'); configFilePath = fileExists(nested) ? nested : resolved; } else { configFilePath = ts.findConfigFile(projectSearchDir, fileExists); } if (configFilePath) { let pathToNextConfigInChain = configFilePath; const tsInternals = createTsInternals(ts); const errors: Array<_ts.Diagnostic> = []; // Follow chain of "extends" while (true) { const result = ts.readConfigFile(pathToNextConfigInChain, readFile); // Return diagnostics. if (result.error) { return { configFilePath, config: { errors: [result.error], fileNames: [], options: {} }, tsNodeOptionsFromTsconfig: {}, optionBasePaths: {}, }; } const c = result.config; const bp = dirname(pathToNextConfigInChain); configChain.push({ config: c, basePath: bp, configPath: pathToNextConfigInChain, }); if (c.extends == null) break; const resolvedExtendedConfigPath = tsInternals.getExtendsConfigPath( c.extends, { fileExists, readDirectory: ts.sys.readDirectory, readFile, useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames, trace: tsTrace, }, bp, errors, (ts as unknown as TSInternal).createCompilerDiagnostic ); if (errors.length) { return { configFilePath, config: { errors, fileNames: [], options: {} }, tsNodeOptionsFromTsconfig: {}, optionBasePaths: {}, }; } if (resolvedExtendedConfigPath == null) break; pathToNextConfigInChain = resolvedExtendedConfigPath; } ({ config, basePath } = configChain[0]); } } // Merge and fix ts-node options that come from tsconfig.json(s) const tsNodeOptionsFromTsconfig: TsConfigOptions = {}; const optionBasePaths: OptionBasePaths = {}; for (let i = configChain.length - 1; i >= 0; i--) { const { config, basePath, configPath } = configChain[i]; const options = filterRecognizedTsConfigTsNodeOptions( config['ts-node'] ).recognized; // Some options are relative to the config file, so must be converted to absolute paths here if (options.require) { // Modules are found relative to the tsconfig file, not the `dir` option const tsconfigRelativeResolver = createProjectLocalResolveHelper( dirname(configPath) ); options.require = options.require.map((path: string) => tsconfigRelativeResolver(path, false) ); } if (options.scopeDir) { options.scopeDir = resolve(basePath, options.scopeDir!); } // Downstream code uses the basePath; we do not do that here. if (options.moduleTypes) { optionBasePaths.moduleTypes = basePath; } if (options.transpiler != null) { optionBasePaths.transpiler = basePath; } if (options.compiler != null) { optionBasePaths.compiler = basePath; } if (options.swc != null) { optionBasePaths.swc = basePath; } assign(tsNodeOptionsFromTsconfig, options); } // Remove resolution of "files". const files = rawApiOptions.files ?? tsNodeOptionsFromTsconfig.files ?? DEFAULTS.files; // Only if a config file is *not* loaded, load an implicit configuration from @tsconfig/bases const skipDefaultCompilerOptions = configFilePath != null; const defaultCompilerOptionsForNodeVersion = skipDefaultCompilerOptions ? undefined : { ...getDefaultTsconfigJsonForNodeVersion(ts).compilerOptions, types: ['node'], }; // Merge compilerOptions from all sources config.compilerOptions = Object.assign( {}, // automatically-applied options from @tsconfig/bases defaultCompilerOptionsForNodeVersion, // tsconfig.json "compilerOptions" config.compilerOptions, // from env var DEFAULTS.compilerOptions, // tsconfig.json "ts-node": "compilerOptions" tsNodeOptionsFromTsconfig.compilerOptions, // passed programmatically rawApiOptions.compilerOptions, // overrides required by ts-node, cannot be changed TS_NODE_COMPILER_OPTIONS ); const fixedConfig = fixConfig( ts, ts.parseJsonConfigFileContent( config, { fileExists, readFile, // Only used for globbing "files", "include", "exclude" // When `files` option disabled, we want to avoid the fs calls readDirectory: files ? ts.sys.readDirectory : () => [], useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames, }, basePath, undefined, configFilePath ) ); return { configFilePath, config: fixedConfig, tsNodeOptionsFromTsconfig, optionBasePaths, }; } /** * Load the typescript compiler. It is required to load the tsconfig but might * be changed by the tsconfig, so we have to do this twice. * @internal */ export function resolveAndLoadCompiler( name: string | undefined, relativeToPath: string ) { const { compiler } = resolveCompiler(name, relativeToPath); const ts = loadCompiler(compiler); return { compiler, ts }; } function resolveCompiler(name: string | undefined, relativeToPath: string) { const projectLocalResolveHelper = createProjectLocalResolveHelper(relativeToPath); const compiler = projectLocalResolveHelper(name || 'typescript', true); return { compiler }; } /** @internal */ export function loadCompiler(compiler: string): TSCommon { return attemptRequireWithV8CompileCache(require, compiler); } /** * Given the raw "ts-node" sub-object from a tsconfig, return an object with only the properties * recognized by "ts-node" */ function filterRecognizedTsConfigTsNodeOptions(jsonObject: any): { recognized: TsConfigOptions; unrecognized: any; } { if (jsonObject == null) return { recognized: {}, unrecognized: {} }; const { compiler, compilerHost, compilerOptions, emit, files, ignore, ignoreDiagnostics, logError, preferTsExts, pretty, require, skipIgnore, transpileOnly, typeCheck, transpiler, scope, scopeDir, moduleTypes, experimentalReplAwait, swc, experimentalResolver, esm, experimentalSpecifierResolution, experimentalTsImportSpecifiers, ...unrecognized } = jsonObject as TsConfigOptions; const filteredTsConfigOptions = { compiler, compilerHost, compilerOptions, emit, experimentalReplAwait, files, ignore, ignoreDiagnostics, logError, preferTsExts, pretty, require, skipIgnore, transpileOnly, typeCheck, transpiler, scope, scopeDir, moduleTypes, swc, experimentalResolver, esm, experimentalSpecifierResolution, experimentalTsImportSpecifiers, }; // Use the typechecker to make sure this implementation has the correct set of properties const catchExtraneousProps: keyof TsConfigOptions = null as any as keyof typeof filteredTsConfigOptions; const catchMissingProps: keyof typeof filteredTsConfigOptions = null as any as keyof TsConfigOptions; return { recognized: filteredTsConfigOptions, unrecognized }; } /** @internal */ export const ComputeAsCommonRootOfFiles = Symbol(); /** * Some TS compiler options have defaults which are not provided by TS's config parsing functions. * This function centralizes the logic for computing those defaults. * @internal */ export function getTsConfigDefaults( config: _ts.ParsedCommandLine, basePath: string, _files: string[] | undefined, _include: string[] | undefined, _exclude: string[] | undefined ) { const { composite = false } = config.options; let rootDir: string | typeof ComputeAsCommonRootOfFiles = config.options.rootDir!; if (rootDir == null) { if (composite) rootDir = basePath; // Return this symbol to avoid computing from `files`, which would require fs calls else rootDir = ComputeAsCommonRootOfFiles; } const { outDir = rootDir } = config.options; // Docs are wrong: https://www.typescriptlang.org/tsconfig#include // Docs say **, but it's actually **/*; compiler throws error for ** const include = _files ? [] : ['**/*']; const files = _files ?? []; // Docs are misleading: https://www.typescriptlang.org/tsconfig#exclude // Docs say it excludes node_modules, bower_components, jspm_packages, but actually those are excluded via behavior of "include" const exclude = _exclude ?? [outDir]; // TODO technically, outDir is absolute path, but exclude should be relative glob pattern? // TODO compute baseUrl return { rootDir, outDir, include, files, exclude, composite }; } ts-node-10.9.2/src/esm.ts000066400000000000000000000325251453460306300151120ustar00rootroot00000000000000import { register, RegisterOptions, Service } from './index'; import { parse as parseUrl, format as formatUrl, UrlWithStringQuery, fileURLToPath, pathToFileURL, } from 'url'; import { extname } from 'path'; import * as assert from 'assert'; import { normalizeSlashes, versionGteLt } from './util'; import { createRequire } from 'module'; // Note: On Windows, URLs look like this: file:///D:/dev/@TypeStrong/ts-node-examples/foo.ts // NOTE ABOUT MULTIPLE EXPERIMENTAL LOADER APIS // // At the time of writing, this file implements 2x different loader APIs. // Node made a breaking change to the loader API in https://github.com/nodejs/node/pull/37468 // // We check the node version number and export either the *old* or the *new* API. // // Today, we are implementing the *new* API on top of our implementation of the *old* API, // which relies on copy-pasted code from the *old* hooks implementation in node. // // In the future, we will likely invert this: we will copy-paste the *new* API implementation // from node, build our implementation of the *new* API on top of it, and implement the *old* // hooks API as a shim to the *new* API. export interface NodeLoaderHooksAPI1 { resolve: NodeLoaderHooksAPI1.ResolveHook; getFormat: NodeLoaderHooksAPI1.GetFormatHook; transformSource: NodeLoaderHooksAPI1.TransformSourceHook; } export namespace NodeLoaderHooksAPI1 { export type ResolveHook = NodeLoaderHooksAPI2.ResolveHook; export type GetFormatHook = ( url: string, context: {}, defaultGetFormat: GetFormatHook ) => Promise<{ format: NodeLoaderHooksFormat }>; export type TransformSourceHook = ( source: string | Buffer, context: { url: string; format: NodeLoaderHooksFormat }, defaultTransformSource: NodeLoaderHooksAPI1.TransformSourceHook ) => Promise<{ source: string | Buffer }>; } export interface NodeLoaderHooksAPI2 { resolve: NodeLoaderHooksAPI2.ResolveHook; load: NodeLoaderHooksAPI2.LoadHook; } export namespace NodeLoaderHooksAPI2 { export type ResolveHook = ( specifier: string, context: { conditions?: NodeImportConditions; importAssertions?: NodeImportAssertions; parentURL: string; }, defaultResolve: ResolveHook ) => Promise<{ url: string; format?: NodeLoaderHooksFormat; shortCircuit?: boolean; }>; export type LoadHook = ( url: string, context: { format: NodeLoaderHooksFormat | null | undefined; importAssertions?: NodeImportAssertions; }, defaultLoad: NodeLoaderHooksAPI2['load'] ) => Promise<{ format: NodeLoaderHooksFormat; source: string | Buffer | undefined; shortCircuit?: boolean; }>; export type NodeImportConditions = unknown; export interface NodeImportAssertions { type?: 'json'; } } export type NodeLoaderHooksFormat = | 'builtin' | 'commonjs' | 'dynamic' | 'json' | 'module' | 'wasm'; export type NodeImportConditions = unknown; export interface NodeImportAssertions { type?: 'json'; } // The hooks API changed in node version X so we need to check for backwards compatibility. const newHooksAPI = versionGteLt(process.versions.node, '16.12.0'); /** @internal */ export function filterHooksByAPIVersion( hooks: NodeLoaderHooksAPI1 & NodeLoaderHooksAPI2 ): NodeLoaderHooksAPI1 | NodeLoaderHooksAPI2 { const { getFormat, load, resolve, transformSource } = hooks; // Explicit return type to avoid TS's non-ideal inferred type const hooksAPI: NodeLoaderHooksAPI1 | NodeLoaderHooksAPI2 = newHooksAPI ? { resolve, load, getFormat: undefined, transformSource: undefined } : { resolve, getFormat, transformSource, load: undefined }; return hooksAPI; } /** @internal */ export function registerAndCreateEsmHooks(opts?: RegisterOptions) { // Automatically performs registration just like `-r ts-node/register` const tsNodeInstance = register(opts); return createEsmHooks(tsNodeInstance); } export function createEsmHooks(tsNodeService: Service) { tsNodeService.enableExperimentalEsmLoaderInterop(); // Custom implementation that considers additional file extensions and automatically adds file extensions const nodeResolveImplementation = tsNodeService.getNodeEsmResolver(); const nodeGetFormatImplementation = tsNodeService.getNodeEsmGetFormat(); const extensions = tsNodeService.extensions; const hooksAPI = filterHooksByAPIVersion({ resolve, load, getFormat, transformSource, }); function isFileUrlOrNodeStyleSpecifier(parsed: UrlWithStringQuery) { // We only understand file:// URLs, but in node, the specifier can be a node-style `./foo` or `foo` const { protocol } = parsed; return protocol === null || protocol === 'file:'; } /** * Named "probably" as a reminder that this is a guess. * node does not explicitly tell us if we're resolving the entrypoint or not. */ function isProbablyEntrypoint(specifier: string, parentURL: string) { return parentURL === undefined && specifier.startsWith('file://'); } // Side-channel between `resolve()` and `load()` hooks const rememberIsProbablyEntrypoint = new Set(); const rememberResolvedViaCommonjsFallback = new Set(); async function resolve( specifier: string, context: { parentURL: string }, defaultResolve: typeof resolve ): Promise<{ url: string; format?: NodeLoaderHooksFormat }> { const defer = async () => { const r = await defaultResolve(specifier, context, defaultResolve); return r; }; // See: https://github.com/nodejs/node/discussions/41711 // nodejs will likely implement a similar fallback. Till then, we can do our users a favor and fallback today. async function entrypointFallback( cb: () => ReturnType | Awaited> ): ReturnType { try { const resolution = await cb(); if ( resolution?.url && isProbablyEntrypoint(specifier, context.parentURL) ) rememberIsProbablyEntrypoint.add(resolution.url); return resolution; } catch (esmResolverError) { if (!isProbablyEntrypoint(specifier, context.parentURL)) throw esmResolverError; try { let cjsSpecifier = specifier; // Attempt to convert from ESM file:// to CommonJS path try { if (specifier.startsWith('file://')) cjsSpecifier = fileURLToPath(specifier); } catch {} const resolution = pathToFileURL( createRequire(process.cwd()).resolve(cjsSpecifier) ).toString(); rememberIsProbablyEntrypoint.add(resolution); rememberResolvedViaCommonjsFallback.add(resolution); return { url: resolution, format: 'commonjs' }; } catch (commonjsResolverError) { throw esmResolverError; } } } return addShortCircuitFlag(async () => { const parsed = parseUrl(specifier); const { pathname, protocol, hostname } = parsed; if (!isFileUrlOrNodeStyleSpecifier(parsed)) { return entrypointFallback(defer); } if (protocol !== null && protocol !== 'file:') { return entrypointFallback(defer); } // Malformed file:// URL? We should always see `null` or `''` if (hostname) { // TODO file://./foo sets `hostname` to `'.'`. Perhaps we should special-case this. return entrypointFallback(defer); } // pathname is the path to be resolved return entrypointFallback(() => nodeResolveImplementation.defaultResolve( specifier, context, defaultResolve ) ); }); } // `load` from new loader hook API (See description at the top of this file) async function load( url: string, context: { format: NodeLoaderHooksFormat | null | undefined; importAssertions?: NodeLoaderHooksAPI2.NodeImportAssertions; }, defaultLoad: typeof load ): Promise<{ format: NodeLoaderHooksFormat; source: string | Buffer | undefined; }> { return addShortCircuitFlag(async () => { // If we get a format hint from resolve() on the context then use it // otherwise call the old getFormat() hook using node's old built-in defaultGetFormat() that ships with ts-node const format = context.format ?? ( await getFormat( url, context, nodeGetFormatImplementation.defaultGetFormat ) ).format; let source = undefined; if (format !== 'builtin' && format !== 'commonjs') { // Call the new defaultLoad() to get the source const { source: rawSource } = await defaultLoad( url, { ...context, format, }, defaultLoad ); if (rawSource === undefined || rawSource === null) { throw new Error( `Failed to load raw source: Format was '${format}' and url was '${url}''.` ); } // Emulate node's built-in old defaultTransformSource() so we can re-use the old transformSource() hook const defaultTransformSource: typeof transformSource = async ( source, _context, _defaultTransformSource ) => ({ source }); // Call the old hook const { source: transformedSource } = await transformSource( rawSource, { url, format }, defaultTransformSource ); source = transformedSource; } return { format, source }; }); } async function getFormat( url: string, context: {}, defaultGetFormat: typeof getFormat ): Promise<{ format: NodeLoaderHooksFormat }> { const defer = (overrideUrl: string = url) => defaultGetFormat(overrideUrl, context, defaultGetFormat); // See: https://github.com/nodejs/node/discussions/41711 // nodejs will likely implement a similar fallback. Till then, we can do our users a favor and fallback today. async function entrypointFallback( cb: () => ReturnType ): ReturnType { try { return await cb(); } catch (getFormatError) { if (!rememberIsProbablyEntrypoint.has(url)) throw getFormatError; return { format: 'commonjs' }; } } const parsed = parseUrl(url); if (!isFileUrlOrNodeStyleSpecifier(parsed)) { return entrypointFallback(defer); } const { pathname } = parsed; assert( pathname !== null, 'ESM getFormat() hook: URL should never have null pathname' ); const nativePath = fileURLToPath(url); let nodeSays: { format: NodeLoaderHooksFormat }; // If file has extension not understood by node, then ask node how it would treat the emitted extension. // E.g. .mts compiles to .mjs, so ask node how to classify an .mjs file. const ext = extname(nativePath); const tsNodeIgnored = tsNodeService.ignored(nativePath); const nodeEquivalentExt = extensions.nodeEquivalents.get(ext); if (nodeEquivalentExt && !tsNodeIgnored) { nodeSays = await entrypointFallback(() => defer(formatUrl(pathToFileURL(nativePath + nodeEquivalentExt))) ); } else { try { nodeSays = await entrypointFallback(defer); } catch (e) { if ( e instanceof Error && tsNodeIgnored && extensions.nodeDoesNotUnderstand.includes(ext) ) { e.message += `\n\n` + `Hint:\n` + `ts-node is configured to ignore this file.\n` + `If you want ts-node to handle this file, consider enabling the "skipIgnore" option or adjusting your "ignore" patterns.\n` + `https://typestrong.org/ts-node/docs/scope\n`; } throw e; } } // For files compiled by ts-node that node believes are either CJS or ESM, check if we should override that classification if ( !tsNodeService.ignored(nativePath) && (nodeSays.format === 'commonjs' || nodeSays.format === 'module') ) { const { moduleType } = tsNodeService.moduleTypeClassifier.classifyModuleByModuleTypeOverrides( normalizeSlashes(nativePath) ); if (moduleType === 'cjs') { return { format: 'commonjs' }; } else if (moduleType === 'esm') { return { format: 'module' }; } } return nodeSays; } async function transformSource( source: string | Buffer, context: { url: string; format: NodeLoaderHooksFormat }, defaultTransformSource: typeof transformSource ): Promise<{ source: string | Buffer }> { if (source === null || source === undefined) { throw new Error('No source'); } const defer = () => defaultTransformSource(source, context, defaultTransformSource); const sourceAsString = typeof source === 'string' ? source : source.toString('utf8'); const { url } = context; const parsed = parseUrl(url); if (!isFileUrlOrNodeStyleSpecifier(parsed)) { return defer(); } const nativePath = fileURLToPath(url); if (tsNodeService.ignored(nativePath)) { return defer(); } const emittedJs = tsNodeService.compile(sourceAsString, nativePath); return { source: emittedJs }; } return hooksAPI; } async function addShortCircuitFlag(fn: () => Promise) { const ret = await fn(); // Not sure if this is necessary; being lazy. Can revisit in the future. if (ret == null) return ret; return { ...ret, shortCircuit: true, }; } ts-node-10.9.2/src/externs.d.ts000066400000000000000000000001521453460306300162270ustar00rootroot00000000000000declare module 'util.promisify' { const _export: typeof import('util').promisify; export = _export; } ts-node-10.9.2/src/file-extensions.ts000066400000000000000000000132221453460306300174330ustar00rootroot00000000000000import type * as _ts from 'typescript'; import type { RegisterOptions } from '.'; import { versionGteLt } from './util'; /** * Centralized specification of how we deal with file extensions based on * project options: * which ones we do/don't support, in what situations, etc. These rules drive * logic elsewhere. * @internal * */ export type Extensions = ReturnType; const nodeEquivalents = new Map([ ['.ts', '.js'], ['.tsx', '.js'], ['.jsx', '.js'], ['.mts', '.mjs'], ['.cts', '.cjs'], ]); const tsResolverEquivalents = new Map([ ['.ts', ['.js']], ['.tsx', ['.js', '.jsx']], ['.mts', ['.mjs']], ['.cts', ['.cjs']], ]); // All extensions understood by vanilla node const vanillaNodeExtensions: readonly string[] = [ '.js', '.json', '.node', '.mjs', '.cjs', ]; // Extensions added by vanilla node's require() if you omit them: // js, json, node // Extensions added by vanilla node if you omit them with --experimental-specifier-resolution=node // js, json, node, mjs // Extensions added by ESM codepath's legacy package.json "main" resolver // js, json, node (not mjs!) const nodeDoesNotUnderstand: readonly string[] = [ '.ts', '.tsx', '.jsx', '.cts', '.mts', ]; /** * [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] * @internal */ export function getExtensions( config: _ts.ParsedCommandLine, options: RegisterOptions, tsVersion: string ) { // TS 4.5 is first version to understand .cts, .mts, .cjs, and .mjs extensions const tsSupportsMtsCtsExts = versionGteLt(tsVersion, '4.5.0'); const requiresHigherTypescriptVersion: string[] = []; if (!tsSupportsMtsCtsExts) requiresHigherTypescriptVersion.push('.cts', '.cjs', '.mts', '.mjs'); const allPossibleExtensionsSortedByPreference = Array.from( new Set([ ...(options.preferTsExts ? nodeDoesNotUnderstand : []), ...vanillaNodeExtensions, ...nodeDoesNotUnderstand, ]) ); const compiledJsUnsorted: string[] = ['.ts']; const compiledJsxUnsorted: string[] = []; if (config.options.jsx) compiledJsxUnsorted.push('.tsx'); if (tsSupportsMtsCtsExts) compiledJsUnsorted.push('.mts', '.cts'); if (config.options.allowJs) { compiledJsUnsorted.push('.js'); if (config.options.jsx) compiledJsxUnsorted.push('.jsx'); if (tsSupportsMtsCtsExts) compiledJsUnsorted.push('.mjs', '.cjs'); } const compiledUnsorted = [...compiledJsUnsorted, ...compiledJsxUnsorted]; const compiled = allPossibleExtensionsSortedByPreference.filter((ext) => compiledUnsorted.includes(ext) ); const compiledNodeDoesNotUnderstand = nodeDoesNotUnderstand.filter((ext) => compiled.includes(ext) ); /** * TS's resolver can resolve foo.js to foo.ts, by replacing .js extension with several source extensions. * IMPORTANT: Must preserve ordering according to preferTsExts! * Must include the .js/.mjs/.cjs extension in the array! * This affects resolution behavior! * [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] */ const r = allPossibleExtensionsSortedByPreference.filter((ext) => [...compiledUnsorted, '.js', '.mjs', '.cjs', '.mts', '.cts'].includes(ext) ); const replacementsForJs = r.filter((ext) => ['.js', '.jsx', '.ts', '.tsx'].includes(ext) ); const replacementsForJsx = r.filter((ext) => ['.jsx', '.tsx'].includes(ext)); const replacementsForMjs = r.filter((ext) => ['.mjs', '.mts'].includes(ext)); const replacementsForCjs = r.filter((ext) => ['.cjs', '.cts'].includes(ext)); const replacementsForJsOrMjs = r.filter((ext) => ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.mts'].includes(ext) ); // Node allows omitting .js or .mjs extension in certain situations (CJS, ESM w/experimental flag) // So anything that compiles to .js or .mjs can also be omitted. const experimentalSpecifierResolutionAddsIfOmitted = Array.from( new Set([...replacementsForJsOrMjs, '.json', '.node']) ); // Same as above, except node curiuosly doesn't do .mjs here const legacyMainResolveAddsIfOmitted = Array.from( new Set([...replacementsForJs, '.json', '.node']) ); return { /** All file extensions we transform, ordered by resolution preference according to preferTsExts */ compiled, /** Resolved extensions that vanilla node will not understand; we should handle them */ nodeDoesNotUnderstand, /** Like the above, but only the ones we're compiling */ compiledNodeDoesNotUnderstand, /** * Mapping from extensions understood by tsc to the equivalent for node, * as far as getFormat is concerned. */ nodeEquivalents, /** * Mapping from extensions rejected by TSC in import specifiers, to the * possible alternatives that TS's resolver will accept. * * When we allow users to opt-in to .ts extensions in import specifiers, TS's * resolver requires us to replace the .ts extensions with .js alternatives. * Otherwise, resolution fails. * * Note TS's resolver is only used by, and only required for, typechecking. * This is separate from node's resolver, which we hook separately and which * does not require this mapping. */ tsResolverEquivalents, /** * Extensions that we can support if the user upgrades their typescript version. * Used when raising hints. */ requiresHigherTypescriptVersion, /** * --experimental-specifier-resolution=node will add these extensions. */ experimentalSpecifierResolutionAddsIfOmitted, /** * ESM loader will add these extensions to package.json "main" field */ legacyMainResolveAddsIfOmitted, replacementsForMjs, replacementsForCjs, replacementsForJsx, replacementsForJs, }; } ts-node-10.9.2/src/index.ts000066400000000000000000001567431453460306300154460ustar00rootroot00000000000000import { relative, basename, extname, dirname, join } from 'path'; import { Module } from 'module'; import * as util from 'util'; import { fileURLToPath } from 'url'; import type * as _sourceMapSupport from '@cspotcode/source-map-support'; import { BaseError } from 'make-error'; import type * as _ts from 'typescript'; import type { Transpiler, TranspilerFactory } from './transpilers/types'; import { cachedLookup, createProjectLocalResolveHelper, hasOwnProperty, normalizeSlashes, once, parse, ProjectLocalResolveHelper, split, versionGteLt, yn, } from './util'; import { findAndReadConfig, loadCompiler } from './configuration'; import type { TSCommon, TSInternal } from './ts-compiler-types'; import { createModuleTypeClassifier, ModuleTypeClassifier, } from './module-type-classifier'; import { createResolverFunctions } from './resolver-functions'; import type { createEsmHooks as createEsmHooksFn } from './esm'; import { installCommonjsResolveHooksIfNecessary, ModuleConstructorWithInternals, } from './cjs-resolve-hooks'; import { classifyModule } from './node-module-type-classifier'; import type * as _nodeInternalModulesEsmResolve from '../dist-raw/node-internal-modules-esm-resolve'; import type * as _nodeInternalModulesEsmGetFormat from '../dist-raw/node-internal-modules-esm-get_format'; import type * as _nodeInternalModulesCjsLoader from '../dist-raw/node-internal-modules-cjs-loader'; import { Extensions, getExtensions } from './file-extensions'; import { createTsTranspileModule } from './ts-transpile-module'; export { TSCommon }; export { createRepl, CreateReplOptions, ReplService, EvalAwarePartialHost, } from './repl'; export type { TranspilerModule, TranspilerFactory, CreateTranspilerOptions, TranspileOutput, TranspileOptions, Transpiler, } from './transpilers/types'; export type { NodeLoaderHooksAPI1, NodeLoaderHooksAPI2, NodeLoaderHooksFormat, } from './esm'; /** * Does this version of node obey the package.json "type" field * and throw ERR_REQUIRE_ESM when attempting to require() an ESM modules. */ const engineSupportsPackageTypeField = parseInt(process.versions.node.split('.')[0], 10) >= 12; /** * Assert that script can be loaded as CommonJS when we attempt to require it. * If it should be loaded as ESM, throw ERR_REQUIRE_ESM like node does. * * Loaded conditionally so we don't need to support older node versions */ let assertScriptCanLoadAsCJS: ( service: Service, module: NodeJS.Module, filename: string ) => void = engineSupportsPackageTypeField ? ( require('../dist-raw/node-internal-modules-cjs-loader') as typeof _nodeInternalModulesCjsLoader ).assertScriptCanLoadAsCJSImpl : () => { /* noop */ }; /** * Registered `ts-node` instance information. */ export const REGISTER_INSTANCE = Symbol.for('ts-node.register.instance'); /** * Expose `REGISTER_INSTANCE` information on node.js `process`. */ declare global { namespace NodeJS { interface Process { [REGISTER_INSTANCE]?: Service; } } } /** @internal */ export const env = process.env as ProcessEnv; /** * Declare all env vars, to aid discoverability. * If an env var affects ts-node's behavior, it should not be buried somewhere in our codebase. * @internal */ export interface ProcessEnv { TS_NODE_DEBUG?: string; TS_NODE_CWD?: string; /** @deprecated */ TS_NODE_DIR?: string; TS_NODE_EMIT?: string; TS_NODE_SCOPE?: string; TS_NODE_SCOPE_DIR?: string; TS_NODE_FILES?: string; TS_NODE_PRETTY?: string; TS_NODE_COMPILER?: string; TS_NODE_COMPILER_OPTIONS?: string; TS_NODE_IGNORE?: string; TS_NODE_PROJECT?: string; TS_NODE_SKIP_PROJECT?: string; TS_NODE_SKIP_IGNORE?: string; TS_NODE_PREFER_TS_EXTS?: string; TS_NODE_IGNORE_DIAGNOSTICS?: string; TS_NODE_TRANSPILE_ONLY?: string; TS_NODE_TYPE_CHECK?: string; TS_NODE_COMPILER_HOST?: string; TS_NODE_LOG_ERROR?: string; TS_NODE_HISTORY?: string; TS_NODE_EXPERIMENTAL_REPL_AWAIT?: string; NODE_NO_READLINE?: string; } /** * @internal */ export const INSPECT_CUSTOM = util.inspect.custom || 'inspect'; /** * Debugging `ts-node`. */ const shouldDebug = yn(env.TS_NODE_DEBUG); /** @internal */ export const debug = shouldDebug ? (...args: any) => console.log(`[ts-node ${new Date().toISOString()}]`, ...args) : () => undefined; const debugFn = shouldDebug ? (key: string, fn: (arg: T) => U) => { let i = 0; return (x: T) => { debug(key, x, ++i); return fn(x); }; } : (_: string, fn: (arg: T) => U) => fn; /** * Export the current version. */ export const VERSION = require('../package.json').version; /** * Options for creating a new TypeScript compiler instance. * @category Basic */ export interface CreateOptions { /** * Behave as if invoked within this working directory. Roughly equivalent to `cd $dir && ts-node ...` * * @default process.cwd() */ cwd?: string; /** * Legacy alias for `cwd` * * @deprecated use `projectSearchDir` or `cwd` */ dir?: string; /** * Emit output files into `.ts-node` directory. * * @default false */ emit?: boolean; /** * Scope compiler to files within `scopeDir`. * * @default false */ scope?: boolean; /** * @default First of: `tsconfig.json` "rootDir" if specified, directory containing `tsconfig.json`, or cwd if no `tsconfig.json` is loaded. */ scopeDir?: string; /** * Use pretty diagnostic formatter. * * @default false */ pretty?: boolean; /** * Use TypeScript's faster `transpileModule`. * * @default false */ transpileOnly?: boolean; /** * **DEPRECATED** Specify type-check is enabled (e.g. `transpileOnly == false`). * * @default true */ typeCheck?: boolean; /** * Use TypeScript's compiler host API instead of the language service API. * * @default false */ compilerHost?: boolean; /** * Logs TypeScript errors to stderr instead of throwing exceptions. * * @default false */ logError?: boolean; /** * Load "files" and "include" from `tsconfig.json` on startup. * * Default is to override `tsconfig.json` "files" and "include" to only include the entrypoint script. * * @default false */ files?: boolean; /** * Specify a custom TypeScript compiler. * * @default "typescript" */ compiler?: string; /** * Specify a custom transpiler for use with transpileOnly */ transpiler?: string | [string, object]; /** * Transpile with swc instead of the TypeScript compiler, and skip typechecking. * * Equivalent to setting both `transpileOnly: true` and `transpiler: 'ts-node/transpilers/swc'` * * For complete instructions: https://typestrong.org/ts-node/docs/transpilers */ swc?: boolean; /** * Paths which should not be compiled. * * Each string in the array is converted to a regular expression via `new RegExp()` and tested against source paths prior to compilation. * * Source paths are normalized to posix-style separators, relative to the directory containing `tsconfig.json` or to cwd if no `tsconfig.json` is loaded. * * Default is to ignore all node_modules subdirectories. * * @default ["(?:^|/)node_modules/"] */ ignore?: string[]; /** * Path to TypeScript config file or directory containing a `tsconfig.json`. * Similar to the `tsc --project` flag: https://www.typescriptlang.org/docs/handbook/compiler-options.html */ project?: string; /** * Search for TypeScript config file (`tsconfig.json`) in this or parent directories. */ projectSearchDir?: string; /** * Skip project config resolution and loading. * * @default false */ skipProject?: boolean; /** * Skip ignore check, so that compilation will be attempted for all files with matching extensions. * * @default false */ skipIgnore?: boolean; /** * JSON object to merge with TypeScript `compilerOptions`. * * @allOf [{"$ref": "https://schemastore.azurewebsites.net/schemas/json/tsconfig.json#definitions/compilerOptionsDefinition/properties/compilerOptions"}] */ compilerOptions?: object; /** * Ignore TypeScript warnings by diagnostic code. */ ignoreDiagnostics?: Array; /** * Modules to require, like node's `--require` flag. * * If specified in `tsconfig.json`, the modules will be resolved relative to the `tsconfig.json` file. * * If specified programmatically, each input string should be pre-resolved to an absolute path for * best results. */ require?: Array; readFile?: (path: string) => string | undefined; fileExists?: (path: string) => boolean; transformers?: | _ts.CustomTransformers | ((p: _ts.Program) => _ts.CustomTransformers); /** * Allows the usage of top level await in REPL. * * Uses node's implementation which accomplishes this with an AST syntax transformation. * * Enabled by default when tsconfig target is es2018 or above. Set to false to disable. * * **Note**: setting to `true` when tsconfig target is too low will throw an Error. Leave as `undefined` * to get default, automatic behavior. */ experimentalReplAwait?: boolean; /** * Override certain paths to be compiled and executed as CommonJS or ECMAScript modules. * When overridden, the tsconfig "module" and package.json "type" fields are overridden, and * the file extension is ignored. * This is useful if you cannot use .mts, .cts, .mjs, or .cjs file extensions; * it achieves the same effect. * * Each key is a glob pattern following the same rules as tsconfig's "include" array. * When multiple patterns match the same file, the last pattern takes precedence. * * `cjs` overrides matches files to compile and execute as CommonJS. * `esm` overrides matches files to compile and execute as native ECMAScript modules. * `package` overrides either of the above to default behavior, which obeys package.json "type" and * tsconfig.json "module" options. */ moduleTypes?: ModuleTypes; /** * @internal * Set by our configuration loader whenever a config file contains options that * are relative to the config file they came from, *and* when other logic needs * to know this. Some options can be eagerly resolved to absolute paths by * the configuration loader, so it is *not* necessary for their source to be set here. */ optionBasePaths?: OptionBasePaths; /** * A function to collect trace messages from the TypeScript compiler, for example when `traceResolution` is enabled. * * @default console.log */ tsTrace?: (str: string) => void; /** * Enable native ESM support. * * For details, see https://typestrong.org/ts-node/docs/imports#native-ecmascript-modules */ esm?: boolean; /** * Re-order file extensions so that TypeScript imports are preferred. * * For example, when both `index.js` and `index.ts` exist, enabling this option causes `require('./index')` to resolve to `index.ts` instead of `index.js` * * @default false */ preferTsExts?: boolean; /** * Like node's `--experimental-specifier-resolution`, , but can also be set in your `tsconfig.json` for convenience. * * For details, see https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#customizing-esm-specifier-resolution-algorithm */ experimentalSpecifierResolution?: 'node' | 'explicit'; /** * Allow using voluntary `.ts` file extension in import specifiers. * * Typically, in ESM projects, import specifiers must have an emit extension, `.js`, `.cjs`, or `.mjs`, * and we automatically map to the corresponding `.ts`, `.cts`, or `.mts` source file. This is the * recommended approach. * * However, if you really want to use `.ts` in import specifiers, and are aware that this may * break tooling, you can enable this flag. */ experimentalTsImportSpecifiers?: boolean; } export type ModuleTypes = Record; export type ModuleTypeOverride = 'cjs' | 'esm' | 'package'; /** @internal */ export interface OptionBasePaths { moduleTypes?: string; transpiler?: string; compiler?: string; swc?: string; } /** * Options for registering a TypeScript compiler instance globally. * @category Basic */ export interface RegisterOptions extends CreateOptions { /** * Enable experimental features that re-map imports and require calls to support: * `baseUrl`, `paths`, `rootDirs`, `.js` to `.ts` file extension mappings, * `outDir` to `rootDir` mappings for composite projects and monorepos. * * For details, see https://github.com/TypeStrong/ts-node/issues/1514 */ experimentalResolver?: boolean; } export type ExperimentalSpecifierResolution = 'node' | 'explicit'; /** * Must be an interface to support `typescript-json-schema`. */ export interface TsConfigOptions extends Omit< RegisterOptions, | 'transformers' | 'readFile' | 'fileExists' | 'skipProject' | 'project' | 'dir' | 'cwd' | 'projectSearchDir' | 'optionBasePaths' | 'tsTrace' > {} /** * Information retrieved from type info check. */ export interface TypeInfo { name: string; comment: string; } /** * Default register options, including values specified via environment * variables. * @internal */ export const DEFAULTS: RegisterOptions = { cwd: env.TS_NODE_CWD ?? env.TS_NODE_DIR, emit: yn(env.TS_NODE_EMIT), scope: yn(env.TS_NODE_SCOPE), scopeDir: env.TS_NODE_SCOPE_DIR, files: yn(env.TS_NODE_FILES), pretty: yn(env.TS_NODE_PRETTY), compiler: env.TS_NODE_COMPILER, compilerOptions: parse(env.TS_NODE_COMPILER_OPTIONS), ignore: split(env.TS_NODE_IGNORE), project: env.TS_NODE_PROJECT, skipProject: yn(env.TS_NODE_SKIP_PROJECT), skipIgnore: yn(env.TS_NODE_SKIP_IGNORE), preferTsExts: yn(env.TS_NODE_PREFER_TS_EXTS), ignoreDiagnostics: split(env.TS_NODE_IGNORE_DIAGNOSTICS), transpileOnly: yn(env.TS_NODE_TRANSPILE_ONLY), typeCheck: yn(env.TS_NODE_TYPE_CHECK), compilerHost: yn(env.TS_NODE_COMPILER_HOST), logError: yn(env.TS_NODE_LOG_ERROR), experimentalReplAwait: yn(env.TS_NODE_EXPERIMENTAL_REPL_AWAIT) ?? undefined, tsTrace: console.log.bind(console), }; /** * TypeScript diagnostics error. */ export class TSError extends BaseError { name = 'TSError'; diagnosticText!: string; diagnostics!: ReadonlyArray<_ts.Diagnostic>; constructor( diagnosticText: string, public diagnosticCodes: number[], diagnostics: ReadonlyArray<_ts.Diagnostic> = [] ) { super(`⨯ Unable to compile TypeScript:\n${diagnosticText}`); Object.defineProperty(this, 'diagnosticText', { configurable: true, writable: true, value: diagnosticText, }); Object.defineProperty(this, 'diagnostics', { configurable: true, writable: true, value: diagnostics, }); } /** * @internal */ [INSPECT_CUSTOM]() { return this.diagnosticText; } } const TS_NODE_SERVICE_BRAND = Symbol('TS_NODE_SERVICE_BRAND'); /** * Primary ts-node service, which wraps the TypeScript API and can compile TypeScript to JavaScript */ export interface Service { /** @internal */ [TS_NODE_SERVICE_BRAND]: true; ts: TSCommon; /** @internal */ compilerPath: string; config: _ts.ParsedCommandLine; options: RegisterOptions; enabled(enabled?: boolean): boolean; ignored(fileName: string): boolean; compile(code: string, fileName: string, lineOffset?: number): string; getTypeInfo(code: string, fileName: string, position: number): TypeInfo; /** @internal */ configFilePath: string | undefined; /** @internal */ moduleTypeClassifier: ModuleTypeClassifier; /** @internal */ readonly shouldReplAwait: boolean; /** @internal */ addDiagnosticFilter(filter: DiagnosticFilter): void; /** @internal */ installSourceMapSupport(): void; /** @internal */ enableExperimentalEsmLoaderInterop(): void; /** @internal */ transpileOnly: boolean; /** @internal */ projectLocalResolveHelper: ProjectLocalResolveHelper; /** @internal */ getNodeEsmResolver: () => ReturnType< typeof import('../dist-raw/node-internal-modules-esm-resolve').createResolve >; /** @internal */ getNodeEsmGetFormat: () => ReturnType< typeof import('../dist-raw/node-internal-modules-esm-get_format').createGetFormat >; /** @internal */ getNodeCjsLoader: () => ReturnType< typeof import('../dist-raw/node-internal-modules-cjs-loader').createCjsLoader >; /** @internal */ extensions: Extensions; } /** * Re-export of `Service` interface for backwards-compatibility * @deprecated use `Service` instead * @see {Service} */ export type Register = Service; /** @internal */ export interface DiagnosticFilter { /** if true, filter applies to all files */ appliesToAllFiles: boolean; /** Filter applies onto to these filenames. Only used if appliesToAllFiles is false */ filenamesAbsolute: string[]; /** these diagnostic codes are ignored */ diagnosticsIgnored: number[]; } /** * Create a new TypeScript compiler instance and register it onto node.js * * @category Basic */ export function register(opts?: RegisterOptions): Service; /** * Register TypeScript compiler instance onto node.js * @category Basic */ export function register(service: Service): Service; export function register( serviceOrOpts: Service | RegisterOptions | undefined ): Service { // Is this a Service or a RegisterOptions? let service = serviceOrOpts as Service; if (!(serviceOrOpts as Service)?.[TS_NODE_SERVICE_BRAND]) { // Not a service; is options service = create((serviceOrOpts ?? {}) as RegisterOptions); } const originalJsHandler = require.extensions['.js']; // Expose registered instance globally. process[REGISTER_INSTANCE] = service; // Register the extensions. registerExtensions( service.options.preferTsExts, service.extensions.compiled, service, originalJsHandler ); installCommonjsResolveHooksIfNecessary(service); // Require specified modules before start-up. (Module as ModuleConstructorWithInternals)._preloadModules( service.options.require ); return service; } /** * Create TypeScript compiler instance. * * @category Basic */ export function create(rawOptions: CreateOptions = {}): Service { const foundConfigResult = findAndReadConfig(rawOptions); return createFromPreloadedConfig(foundConfigResult); } /** @internal */ export function createFromPreloadedConfig( foundConfigResult: ReturnType ): Service { const { configFilePath, cwd, options, config, compiler, projectLocalResolveDir, optionBasePaths, } = foundConfigResult; const projectLocalResolveHelper = createProjectLocalResolveHelper( projectLocalResolveDir ); const ts = loadCompiler(compiler); // Experimental REPL await is not compatible targets lower than ES2018 const targetSupportsTla = config.options.target! >= ts.ScriptTarget.ES2018; if (options.experimentalReplAwait === true && !targetSupportsTla) { throw new Error( 'Experimental REPL await is not compatible with targets lower than ES2018' ); } // Top-level await was added in TS 3.8 const tsVersionSupportsTla = versionGteLt(ts.version, '3.8.0'); if (options.experimentalReplAwait === true && !tsVersionSupportsTla) { throw new Error( 'Experimental REPL await is not compatible with TypeScript versions older than 3.8' ); } const shouldReplAwait = options.experimentalReplAwait !== false && tsVersionSupportsTla && targetSupportsTla; // swc implies two other options // typeCheck option was implemented specifically to allow overriding tsconfig transpileOnly from the command-line // So we should allow using typeCheck to override swc if (options.swc && !options.typeCheck) { if (options.transpileOnly === false) { throw new Error( "Cannot enable 'swc' option with 'transpileOnly: false'. 'swc' implies 'transpileOnly'." ); } if (options.transpiler) { throw new Error( "Cannot specify both 'swc' and 'transpiler' options. 'swc' uses the built-in swc transpiler." ); } } const readFile = options.readFile || ts.sys.readFile; const fileExists = options.fileExists || ts.sys.fileExists; // typeCheck can override transpileOnly, useful for CLI flag to override config file const transpileOnly = (options.transpileOnly === true || options.swc === true) && options.typeCheck !== true; let transpiler: RegisterOptions['transpiler'] | undefined = undefined; let transpilerBasePath: string | undefined = undefined; if (options.transpiler) { transpiler = options.transpiler; transpilerBasePath = optionBasePaths.transpiler; } else if (options.swc) { transpiler = require.resolve('./transpilers/swc.js'); transpilerBasePath = optionBasePaths.swc; } const transformers = options.transformers || undefined; const diagnosticFilters: Array = [ { appliesToAllFiles: true, filenamesAbsolute: [], diagnosticsIgnored: [ 6059, // "'rootDir' is expected to contain all source files." 18002, // "The 'files' list in config file is empty." 18003, // "No inputs were found in config file." ...(options.experimentalTsImportSpecifiers ? [ 2691, // "An import path cannot end with a '.ts' extension. Consider importing '' instead." ] : []), ...(options.ignoreDiagnostics || []), ].map(Number), }, ]; const configDiagnosticList = filterDiagnostics( config.errors, diagnosticFilters ); const outputCache = new Map< string, { content: string; } >(); const configFileDirname = configFilePath ? dirname(configFilePath) : null; const scopeDir = options.scopeDir ?? config.options.rootDir ?? configFileDirname ?? cwd; const ignoreBaseDir = configFileDirname ?? cwd; const isScoped = options.scope ? (fileName: string) => relative(scopeDir, fileName).charAt(0) !== '.' : () => true; const shouldIgnore = createIgnore( ignoreBaseDir, options.skipIgnore ? [] : (options.ignore || ['(?:^|/)node_modules/']).map( (str) => new RegExp(str) ) ); const diagnosticHost: _ts.FormatDiagnosticsHost = { getNewLine: () => ts.sys.newLine, getCurrentDirectory: () => cwd, // TODO switch to getCanonicalFileName we already create later in scope getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? (x) => x : (x) => x.toLowerCase(), }; if (options.transpileOnly && typeof transformers === 'function') { throw new TypeError( 'Transformers function is unavailable in "--transpile-only"' ); } let createTranspiler = initializeTranspilerFactory(); function initializeTranspilerFactory() { if (transpiler) { if (!transpileOnly) throw new Error( 'Custom transpiler can only be used when transpileOnly is enabled.' ); const transpilerName = typeof transpiler === 'string' ? transpiler : transpiler[0]; const transpilerOptions = typeof transpiler === 'string' ? {} : transpiler[1] ?? {}; const transpilerConfigLocalResolveHelper = transpilerBasePath ? createProjectLocalResolveHelper(transpilerBasePath) : projectLocalResolveHelper; const transpilerPath = transpilerConfigLocalResolveHelper( transpilerName, true ); const transpilerFactory = require(transpilerPath) .create as TranspilerFactory; return createTranspiler; function createTranspiler( compilerOptions: TSCommon.CompilerOptions, nodeModuleEmitKind?: NodeModuleEmitKind ) { return transpilerFactory?.({ service: { options, config: { ...config, options: compilerOptions, }, projectLocalResolveHelper, }, transpilerConfigLocalResolveHelper, nodeModuleEmitKind, ...transpilerOptions, }); } } } /** * True if require() hooks should interop with experimental ESM loader. * Enabled explicitly via a flag since it is a breaking change. */ let experimentalEsmLoader = false; function enableExperimentalEsmLoaderInterop() { experimentalEsmLoader = true; } // Install source map support and read from memory cache. installSourceMapSupport(); function installSourceMapSupport() { const sourceMapSupport = require('@cspotcode/source-map-support') as typeof _sourceMapSupport; sourceMapSupport.install({ environment: 'node', retrieveFile(pathOrUrl: string) { let path = pathOrUrl; // If it's a file URL, convert to local path // Note: fileURLToPath does not exist on early node v10 // I could not find a way to handle non-URLs except to swallow an error if (experimentalEsmLoader && path.startsWith('file://')) { try { path = fileURLToPath(path); } catch (e) { /* swallow error */ } } path = normalizeSlashes(path); return outputCache.get(path)?.content || ''; }, redirectConflictingLibrary: true, onConflictingLibraryRedirect( request, parent, isMain, options, redirectedRequest ) { debug( `Redirected an attempt to require source-map-support to instead receive @cspotcode/source-map-support. "${ (parent as NodeJS.Module).filename }" attempted to require or resolve "${request}" and was redirected to "${redirectedRequest}".` ); }, }); } const shouldHavePrettyErrors = options.pretty === undefined ? process.stdout.isTTY : options.pretty; const formatDiagnostics = shouldHavePrettyErrors ? ts.formatDiagnosticsWithColorAndContext || ts.formatDiagnostics : ts.formatDiagnostics; function createTSError(diagnostics: ReadonlyArray<_ts.Diagnostic>) { const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost); const diagnosticCodes = diagnostics.map((x) => x.code); return new TSError(diagnosticText, diagnosticCodes, diagnostics); } function reportTSError(configDiagnosticList: _ts.Diagnostic[]) { const error = createTSError(configDiagnosticList); if (options.logError) { // Print error in red color and continue execution. console.error('\x1b[31m%s\x1b[0m', error); } else { // Throw error and exit the script. throw error; } } // Render the configuration errors. if (configDiagnosticList.length) reportTSError(configDiagnosticList); const jsxEmitPreserve = config.options.jsx === ts.JsxEmit.Preserve; /** * Get the extension for a transpiled file. * [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] */ function getEmitExtension(path: string) { const lastDotIndex = path.lastIndexOf('.'); if (lastDotIndex >= 0) { const ext = path.slice(lastDotIndex); switch (ext) { case '.js': case '.ts': return '.js'; case '.jsx': case '.tsx': return jsxEmitPreserve ? '.jsx' : '.js'; case '.mjs': case '.mts': return '.mjs'; case '.cjs': case '.cts': return '.cjs'; } } return '.js'; } type GetOutputFunction = (code: string, fileName: string) => SourceOutput; /** * Get output from TS compiler w/typechecking. `undefined` in `transpileOnly` * mode. */ let getOutput: GetOutputFunction | undefined; let getTypeInfo: ( _code: string, _fileName: string, _position: number ) => TypeInfo; const getCanonicalFileName = ( ts as unknown as TSInternal ).createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames); const moduleTypeClassifier = createModuleTypeClassifier({ basePath: options.optionBasePaths?.moduleTypes, patterns: options.moduleTypes, }); const extensions = getExtensions(config, options, ts.version); // Use full language services when the fast option is disabled. if (!transpileOnly) { const fileContents = new Map(); const rootFileNames = new Set(config.fileNames); const cachedReadFile = cachedLookup(debugFn('readFile', readFile)); // Use language services by default if (!options.compilerHost) { let projectVersion = 1; const fileVersions = new Map( Array.from(rootFileNames).map((fileName) => [fileName, 0]) ); const getCustomTransformers = () => { if (typeof transformers === 'function') { const program = service.getProgram(); return program ? transformers(program) : undefined; } return transformers; }; // Create the compiler host for type checking. const serviceHost: _ts.LanguageServiceHost & Required> = { getProjectVersion: () => String(projectVersion), getScriptFileNames: () => Array.from(rootFileNames), getScriptVersion: (fileName: string) => { const version = fileVersions.get(fileName); return version ? version.toString() : ''; }, getScriptSnapshot(fileName: string) { // TODO ordering of this with getScriptVersion? Should they sync up? let contents = fileContents.get(fileName); // Read contents into TypeScript memory cache. if (contents === undefined) { contents = cachedReadFile(fileName); if (contents === undefined) return; fileVersions.set(fileName, 1); fileContents.set(fileName, contents); projectVersion++; } return ts.ScriptSnapshot.fromString(contents); }, readFile: cachedReadFile, readDirectory: ts.sys.readDirectory, getDirectories: cachedLookup( debugFn('getDirectories', ts.sys.getDirectories) ), fileExists: cachedLookup(debugFn('fileExists', fileExists)), directoryExists: cachedLookup( debugFn('directoryExists', ts.sys.directoryExists) ), realpath: ts.sys.realpath ? cachedLookup(debugFn('realpath', ts.sys.realpath)) : undefined, getNewLine: () => ts.sys.newLine, useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, getCurrentDirectory: () => cwd, getCompilationSettings: () => config.options, getDefaultLibFileName: () => ts.getDefaultLibFilePath(config.options), getCustomTransformers: getCustomTransformers, trace: options.tsTrace, }; const { resolveModuleNames, getResolvedModuleWithFailedLookupLocationsFromCache, resolveTypeReferenceDirectives, isFileKnownToBeInternal, markBucketOfFilenameInternal, } = createResolverFunctions({ host: serviceHost, getCanonicalFileName, ts, cwd, config, projectLocalResolveHelper, options, extensions, }); serviceHost.resolveModuleNames = resolveModuleNames; serviceHost.getResolvedModuleWithFailedLookupLocationsFromCache = getResolvedModuleWithFailedLookupLocationsFromCache; serviceHost.resolveTypeReferenceDirectives = resolveTypeReferenceDirectives; const registry = ts.createDocumentRegistry( ts.sys.useCaseSensitiveFileNames, cwd ); const service = ts.createLanguageService(serviceHost, registry); const updateMemoryCache = (contents: string, fileName: string) => { // Add to `rootFiles` as necessary, either to make TS include a file it has not seen, // or to trigger a re-classification of files from external to internal. if ( !rootFileNames.has(fileName) && !isFileKnownToBeInternal(fileName) ) { markBucketOfFilenameInternal(fileName); rootFileNames.add(fileName); // Increment project version for every change to rootFileNames. projectVersion++; } const previousVersion = fileVersions.get(fileName) || 0; const previousContents = fileContents.get(fileName); // Avoid incrementing cache when nothing has changed. if (contents !== previousContents) { fileVersions.set(fileName, previousVersion + 1); fileContents.set(fileName, contents); // Increment project version for every file change. projectVersion++; } }; let previousProgram: _ts.Program | undefined = undefined; getOutput = (code: string, fileName: string) => { updateMemoryCache(code, fileName); const programBefore = service.getProgram(); if (programBefore !== previousProgram) { debug( `compiler rebuilt Program instance when getting output for ${fileName}` ); } const output = service.getEmitOutput(fileName); // Get the relevant diagnostics - this is 3x faster than `getPreEmitDiagnostics`. const diagnostics = service .getSemanticDiagnostics(fileName) .concat(service.getSyntacticDiagnostics(fileName)); const programAfter = service.getProgram(); debug( 'invariant: Is service.getProject() identical before and after getting emit output and diagnostics? (should always be true) ', programBefore === programAfter ); previousProgram = programAfter; const diagnosticList = filterDiagnostics( diagnostics, diagnosticFilters ); if (diagnosticList.length) reportTSError(diagnosticList); if (output.emitSkipped) { return [undefined, undefined, true]; } // Throw an error when requiring `.d.ts` files. if (output.outputFiles.length === 0) { throw new TypeError( `Unable to require file: ${relative(cwd, fileName)}\n` + 'This is usually the result of a faulty configuration or import. ' + 'Make sure there is a `.js`, `.json` or other executable extension with ' + 'loader attached before `ts-node` available.' ); } return [output.outputFiles[1].text, output.outputFiles[0].text, false]; }; getTypeInfo = (code: string, fileName: string, position: number) => { const normalizedFileName = normalizeSlashes(fileName); updateMemoryCache(code, normalizedFileName); const info = service.getQuickInfoAtPosition( normalizedFileName, position ); const name = ts.displayPartsToString(info ? info.displayParts : []); const comment = ts.displayPartsToString(info ? info.documentation : []); return { name, comment }; }; } else { const sys: _ts.System & _ts.FormatDiagnosticsHost = { ...ts.sys, ...diagnosticHost, readFile: (fileName: string) => { const cacheContents = fileContents.get(fileName); if (cacheContents !== undefined) return cacheContents; const contents = cachedReadFile(fileName); if (contents) fileContents.set(fileName, contents); return contents; }, readDirectory: ts.sys.readDirectory, getDirectories: cachedLookup( debugFn('getDirectories', ts.sys.getDirectories) ), fileExists: cachedLookup(debugFn('fileExists', fileExists)), directoryExists: cachedLookup( debugFn('directoryExists', ts.sys.directoryExists) ), resolvePath: cachedLookup(debugFn('resolvePath', ts.sys.resolvePath)), realpath: ts.sys.realpath ? cachedLookup(debugFn('realpath', ts.sys.realpath)) : undefined, }; const host: _ts.CompilerHost = ts.createIncrementalCompilerHost ? ts.createIncrementalCompilerHost(config.options, sys) : { ...sys, getSourceFile: (fileName, languageVersion) => { const contents = sys.readFile(fileName); if (contents === undefined) return; return ts.createSourceFile(fileName, contents, languageVersion); }, getDefaultLibLocation: () => normalizeSlashes(dirname(compiler)), getDefaultLibFileName: () => normalizeSlashes( join( dirname(compiler), ts.getDefaultLibFileName(config.options) ) ), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, }; host.trace = options.tsTrace; const { resolveModuleNames, resolveTypeReferenceDirectives, isFileKnownToBeInternal, markBucketOfFilenameInternal, } = createResolverFunctions({ host, cwd, config, ts, getCanonicalFileName, projectLocalResolveHelper, options, extensions, }); host.resolveModuleNames = resolveModuleNames; host.resolveTypeReferenceDirectives = resolveTypeReferenceDirectives; // Fallback for older TypeScript releases without incremental API. let builderProgram = ts.createIncrementalProgram ? ts.createIncrementalProgram({ rootNames: Array.from(rootFileNames), options: config.options, host, configFileParsingDiagnostics: config.errors, projectReferences: config.projectReferences, }) : ts.createEmitAndSemanticDiagnosticsBuilderProgram( Array.from(rootFileNames), config.options, host, undefined, config.errors, config.projectReferences ); // Read and cache custom transformers. const customTransformers = typeof transformers === 'function' ? transformers(builderProgram.getProgram()) : transformers; // Set the file contents into cache manually. const updateMemoryCache = (contents: string, fileName: string) => { const previousContents = fileContents.get(fileName); const contentsChanged = previousContents !== contents; if (contentsChanged) { fileContents.set(fileName, contents); } // Add to `rootFiles` when discovered by compiler for the first time. let addedToRootFileNames = false; if ( !rootFileNames.has(fileName) && !isFileKnownToBeInternal(fileName) ) { markBucketOfFilenameInternal(fileName); rootFileNames.add(fileName); addedToRootFileNames = true; } // Update program when file changes. if (addedToRootFileNames || contentsChanged) { builderProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram( Array.from(rootFileNames), config.options, host, builderProgram, config.errors, config.projectReferences ); } }; getOutput = (code: string, fileName: string) => { let outText = ''; let outMap = ''; updateMemoryCache(code, fileName); const sourceFile = builderProgram.getSourceFile(fileName); if (!sourceFile) throw new TypeError(`Unable to read file: ${fileName}`); const program = builderProgram.getProgram(); const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile); const diagnosticList = filterDiagnostics( diagnostics, diagnosticFilters ); if (diagnosticList.length) reportTSError(diagnosticList); const result = builderProgram.emit( sourceFile, (path, file, writeByteOrderMark) => { if (path.endsWith('.map')) { outMap = file; } else { outText = file; } if (options.emit) sys.writeFile(path, file, writeByteOrderMark); }, undefined, undefined, customTransformers ); if (result.emitSkipped) { return [undefined, undefined, true]; } // Throw an error when requiring files that cannot be compiled. if (outText === '') { if (program.isSourceFileFromExternalLibrary(sourceFile)) { throw new TypeError( `Unable to compile file from external library: ${relative( cwd, fileName )}` ); } throw new TypeError( `Unable to require file: ${relative(cwd, fileName)}\n` + 'This is usually the result of a faulty configuration or import. ' + 'Make sure there is a `.js`, `.json` or other executable extension with ' + 'loader attached before `ts-node` available.' ); } return [outText, outMap, false]; }; getTypeInfo = (code: string, fileName: string, position: number) => { const normalizedFileName = normalizeSlashes(fileName); updateMemoryCache(code, normalizedFileName); const sourceFile = builderProgram.getSourceFile(normalizedFileName); if (!sourceFile) throw new TypeError(`Unable to read file: ${fileName}`); const node = getTokenAtPosition(ts, sourceFile, position); const checker = builderProgram.getProgram().getTypeChecker(); const symbol = checker.getSymbolAtLocation(node); if (!symbol) return { name: '', comment: '' }; const type = checker.getTypeOfSymbolAtLocation(symbol, node); const signatures = [ ...type.getConstructSignatures(), ...type.getCallSignatures(), ]; return { name: signatures.length ? signatures.map((x) => checker.signatureToString(x)).join('\n') : checker.typeToString(type), comment: ts.displayPartsToString( symbol ? symbol.getDocumentationComment(checker) : [] ), }; }; // Write `.tsbuildinfo` when `--build` is enabled. if (options.emit && config.options.incremental) { process.on('exit', () => { // Emits `.tsbuildinfo` to filesystem. (builderProgram.getProgram() as any).emitBuildInfo(); }); } } } else { getTypeInfo = () => { throw new TypeError( 'Type information is unavailable in "--transpile-only"' ); }; } function createTranspileOnlyGetOutputFunction( overrideModuleType?: _ts.ModuleKind, nodeModuleEmitKind?: NodeModuleEmitKind ): GetOutputFunction { const compilerOptions = { ...config.options }; if (overrideModuleType !== undefined) compilerOptions.module = overrideModuleType; let customTranspiler = createTranspiler?.( compilerOptions, nodeModuleEmitKind ); let tsTranspileModule = versionGteLt(ts.version, '4.7.0') ? createTsTranspileModule(ts, { compilerOptions, reportDiagnostics: true, transformers: transformers as _ts.CustomTransformers | undefined, }) : undefined; return (code: string, fileName: string): SourceOutput => { let result: _ts.TranspileOutput; if (customTranspiler) { result = customTranspiler.transpile(code, { fileName, }); } else if (tsTranspileModule) { result = tsTranspileModule( code, { fileName, }, nodeModuleEmitKind === 'nodeesm' ? 'module' : 'commonjs' ); } else { result = ts.transpileModule(code, { fileName, compilerOptions, reportDiagnostics: true, transformers: transformers as _ts.CustomTransformers | undefined, }); } const diagnosticList = filterDiagnostics( result.diagnostics || [], diagnosticFilters ); if (diagnosticList.length) reportTSError(diagnosticList); return [result.outputText, result.sourceMapText as string, false]; }; } // When true, these mean that a `moduleType` override will cause a different emit // than the TypeScript compiler, so we *must* overwrite the emit. const shouldOverwriteEmitWhenForcingCommonJS = config.options.module !== ts.ModuleKind.CommonJS; // [MUST_UPDATE_FOR_NEW_MODULEKIND] const shouldOverwriteEmitWhenForcingEsm = !( config.options.module === ts.ModuleKind.ES2015 || (ts.ModuleKind.ES2020 && config.options.module === ts.ModuleKind.ES2020) || (ts.ModuleKind.ES2022 && config.options.module === ts.ModuleKind.ES2022) || config.options.module === ts.ModuleKind.ESNext ); /** * node16 or nodenext * [MUST_UPDATE_FOR_NEW_MODULEKIND] */ const isNodeModuleType = (ts.ModuleKind.Node16 && config.options.module === ts.ModuleKind.Node16) || (ts.ModuleKind.NodeNext && config.options.module === ts.ModuleKind.NodeNext); const getOutputForceCommonJS = createTranspileOnlyGetOutputFunction( ts.ModuleKind.CommonJS ); const getOutputForceNodeCommonJS = createTranspileOnlyGetOutputFunction( ts.ModuleKind.NodeNext, 'nodecjs' ); const getOutputForceNodeESM = createTranspileOnlyGetOutputFunction( ts.ModuleKind.NodeNext, 'nodeesm' ); // [MUST_UPDATE_FOR_NEW_MODULEKIND] const getOutputForceESM = createTranspileOnlyGetOutputFunction( ts.ModuleKind.ES2022 || ts.ModuleKind.ES2020 || ts.ModuleKind.ES2015 ); const getOutputTranspileOnly = createTranspileOnlyGetOutputFunction(); // Create a simple TypeScript compiler proxy. function compile(code: string, fileName: string, lineOffset = 0) { const normalizedFileName = normalizeSlashes(fileName); const classification = moduleTypeClassifier.classifyModuleByModuleTypeOverrides( normalizedFileName ); let value: string | undefined = ''; let sourceMap: string | undefined = ''; let emitSkipped = true; if (getOutput) { // Must always call normal getOutput to throw typechecking errors [value, sourceMap, emitSkipped] = getOutput(code, normalizedFileName); } // If module classification contradicts the above, call the relevant transpiler if ( classification.moduleType === 'cjs' && (shouldOverwriteEmitWhenForcingCommonJS || emitSkipped) ) { [value, sourceMap] = getOutputForceCommonJS(code, normalizedFileName); } else if ( classification.moduleType === 'esm' && (shouldOverwriteEmitWhenForcingEsm || emitSkipped) ) { [value, sourceMap] = getOutputForceESM(code, normalizedFileName); } else if (emitSkipped) { // Happens when ts compiler skips emit or in transpileOnly mode const classification = classifyModule(fileName, isNodeModuleType); [value, sourceMap] = classification === 'nodecjs' ? getOutputForceNodeCommonJS(code, normalizedFileName) : classification === 'nodeesm' ? getOutputForceNodeESM(code, normalizedFileName) : classification === 'cjs' ? getOutputForceCommonJS(code, normalizedFileName) : classification === 'esm' ? getOutputForceESM(code, normalizedFileName) : getOutputTranspileOnly(code, normalizedFileName); } const output = updateOutput( value!, normalizedFileName, sourceMap!, getEmitExtension ); outputCache.set(normalizedFileName, { content: output }); return output; } let active = true; const enabled = (enabled?: boolean) => enabled === undefined ? active : (active = !!enabled); const ignored = (fileName: string) => { if (!active) return true; const ext = extname(fileName); if (extensions.compiled.includes(ext)) { return !isScoped(fileName) || shouldIgnore(fileName); } return true; }; function addDiagnosticFilter(filter: DiagnosticFilter) { diagnosticFilters.push({ ...filter, filenamesAbsolute: filter.filenamesAbsolute.map((f) => normalizeSlashes(f) ), }); } const getNodeEsmResolver = once(() => ( require('../dist-raw/node-internal-modules-esm-resolve') as typeof _nodeInternalModulesEsmResolve ).createResolve({ extensions, preferTsExts: options.preferTsExts, tsNodeExperimentalSpecifierResolution: options.experimentalSpecifierResolution, }) ); const getNodeEsmGetFormat = once(() => ( require('../dist-raw/node-internal-modules-esm-get_format') as typeof _nodeInternalModulesEsmGetFormat ).createGetFormat( options.experimentalSpecifierResolution, getNodeEsmResolver() ) ); const getNodeCjsLoader = once(() => ( require('../dist-raw/node-internal-modules-cjs-loader') as typeof _nodeInternalModulesCjsLoader ).createCjsLoader({ extensions, preferTsExts: options.preferTsExts, nodeEsmResolver: getNodeEsmResolver(), }) ); return { [TS_NODE_SERVICE_BRAND]: true, ts, compilerPath: compiler, config, compile, getTypeInfo, ignored, enabled, options, configFilePath, moduleTypeClassifier, shouldReplAwait, addDiagnosticFilter, installSourceMapSupport, enableExperimentalEsmLoaderInterop, transpileOnly, projectLocalResolveHelper, getNodeEsmResolver, getNodeEsmGetFormat, getNodeCjsLoader, extensions, }; } /** * Check if the filename should be ignored. */ function createIgnore(ignoreBaseDir: string, ignore: RegExp[]) { return (fileName: string) => { const relname = relative(ignoreBaseDir, fileName); const path = normalizeSlashes(relname); return ignore.some((x) => x.test(path)); }; } /** * Register the extensions to support when importing files. */ function registerExtensions( preferTsExts: boolean | null | undefined, extensions: string[], service: Service, originalJsHandler: (m: NodeModule, filename: string) => any ) { const exts = new Set(extensions); // Can't add these extensions cuz would allow omitting file extension; node requires ext for .cjs and .mjs // Unless they're already registered by something else (nyc does this): // then we *must* hook them or else our transformer will not be called. for (const cannotAdd of ['.mts', '.cts', '.mjs', '.cjs']) { if (exts.has(cannotAdd) && !hasOwnProperty(require.extensions, cannotAdd)) { // Unrecognized file exts can be transformed via the `.js` handler. exts.add('.js'); exts.delete(cannotAdd); } } // Register new extensions. for (const ext of exts) { registerExtension(ext, service, originalJsHandler); } if (preferTsExts) { const preferredExtensions = new Set([ ...exts, ...Object.keys(require.extensions), ]); // Re-sort iteration order of Object.keys() for (const ext of preferredExtensions) { const old = Object.getOwnPropertyDescriptor(require.extensions, ext); delete require.extensions[ext]; Object.defineProperty(require.extensions, ext, old!); } } } /** * Register the extension for node. */ function registerExtension( ext: string, service: Service, originalHandler: (m: NodeModule, filename: string) => any ) { const old = require.extensions[ext] || originalHandler; require.extensions[ext] = function (m: any, filename) { if (service.ignored(filename)) return old(m, filename); assertScriptCanLoadAsCJS(service, m, filename); const _compile = m._compile; m._compile = function (code: string, fileName: string) { debug('module._compile', fileName); const result = service.compile(code, fileName); return _compile.call(this, result, fileName); }; return old(m, filename); }; } /** * Internal source output. */ type SourceOutput = [string, string, false] | [undefined, undefined, true]; /** * Update the output remapping the source map. */ function updateOutput( outputText: string, fileName: string, sourceMap: string, getEmitExtension: (fileName: string) => string ) { const base64Map = Buffer.from( updateSourceMap(sourceMap, fileName), 'utf8' ).toString('base64'); const sourceMapContent = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${base64Map}`; // Expected form: `//# sourceMappingURL=foo bar.js.map` or `//# sourceMappingURL=foo%20bar.js.map` for input file "foo bar.tsx" // Percent-encoding behavior added in TS 4.1.1: https://github.com/microsoft/TypeScript/issues/40951 const prefix = '//# sourceMappingURL='; const prefixLength = prefix.length; const baseName = /*foo.tsx*/ basename(fileName); const extName = /*.tsx*/ extname(fileName); const extension = /*.js*/ getEmitExtension(fileName); const sourcemapFilename = baseName.slice(0, -extName.length) + extension + '.map'; const sourceMapLengthWithoutPercentEncoding = prefixLength + sourcemapFilename.length; /* * Only rewrite if existing directive exists at the location we expect, to support: * a) compilers that do not append a sourcemap directive * b) situations where we did the math wrong * Not ideal, but appending our sourcemap *after* a pre-existing sourcemap still overrides, so the end-user is happy. */ if ( outputText.substr(-sourceMapLengthWithoutPercentEncoding, prefixLength) === prefix ) { return ( outputText.slice(0, -sourceMapLengthWithoutPercentEncoding) + sourceMapContent ); } // If anyone asks why we're not using URL, the URL equivalent is: `u = new URL('http://d'); u.pathname = "/" + sourcemapFilename; return u.pathname.slice(1); const sourceMapLengthWithPercentEncoding = prefixLength + encodeURI(sourcemapFilename).length; if ( outputText.substr(-sourceMapLengthWithPercentEncoding, prefixLength) === prefix ) { return ( outputText.slice(0, -sourceMapLengthWithPercentEncoding) + sourceMapContent ); } return `${outputText}\n${sourceMapContent}`; } /** * Update the source map contents for improved output. */ function updateSourceMap(sourceMapText: string, fileName: string) { const sourceMap = JSON.parse(sourceMapText); sourceMap.file = fileName; sourceMap.sources = [fileName]; delete sourceMap.sourceRoot; return JSON.stringify(sourceMap); } /** * Filter diagnostics. */ function filterDiagnostics( diagnostics: readonly _ts.Diagnostic[], filters: DiagnosticFilter[] ) { return diagnostics.filter((d) => filters.every( (f) => (!f.appliesToAllFiles && f.filenamesAbsolute.indexOf(d.file?.fileName!) === -1) || f.diagnosticsIgnored.indexOf(d.code) === -1 ) ); } /** * Get token at file position. * * Reference: https://github.com/microsoft/TypeScript/blob/fcd9334f57d85b73dd66ad2d21c02e84822f4841/src/services/utilities.ts#L705-L731 */ function getTokenAtPosition( ts: TSCommon, sourceFile: _ts.SourceFile, position: number ): _ts.Node { let current: _ts.Node = sourceFile; outer: while (true) { for (const child of current.getChildren(sourceFile)) { const start = child.getFullStart(); if (start > position) break; const end = child.getEnd(); if (position <= end) { current = child; continue outer; } } return current; } } /** * Create an implementation of node's ESM loader hooks. * * This may be useful if you * want to wrap or compose the loader hooks to add additional functionality or * combine with another loader. * * Node changed the hooks API, so there are two possible APIs. This function * detects your node version and returns the appropriate API. * * @category ESM Loader */ export const createEsmHooks: typeof createEsmHooksFn = ( tsNodeService: Service ) => (require('./esm') as typeof import('./esm')).createEsmHooks(tsNodeService); /** * When using `module: nodenext` or `module: node12`, there are two possible styles of emit depending in file extension or package.json "type": * * - CommonJS with dynamic imports preserved (not transformed into `require()` calls) * - ECMAScript modules with `import foo = require()` transformed into `require = createRequire(); const foo = require()` */ export type NodeModuleEmitKind = 'nodeesm' | 'nodecjs'; ts-node-10.9.2/src/module-type-classifier.ts000066400000000000000000000054641453460306300207160ustar00rootroot00000000000000import type { ModuleTypeOverride, ModuleTypes } from '.'; import { getPatternFromSpec } from './ts-internals'; import { cachedLookup, normalizeSlashes } from './util'; // Logic to support our `moduleTypes` option, which allows overriding node's default ESM / CJS // classification of `.js` files based on package.json `type` field. /** * Seperate internal type because `auto` is clearer than `package`, but changing * the public API is a breaking change. * @internal */ export type InternalModuleTypeOverride = 'cjs' | 'esm' | 'auto'; /** @internal */ export interface ModuleTypeClassification { moduleType: InternalModuleTypeOverride; } /** @internal */ export interface ModuleTypeClassifierOptions { basePath?: string; patterns?: ModuleTypes; } /** @internal */ export type ModuleTypeClassifier = ReturnType< typeof createModuleTypeClassifier >; /** * @internal * May receive non-normalized options -- basePath and patterns -- and will normalize them * internally. * However, calls to `classifyModule` must pass pre-normalized paths! */ export function createModuleTypeClassifier( options: ModuleTypeClassifierOptions ) { const { patterns, basePath: _basePath } = options; const basePath = _basePath !== undefined ? normalizeSlashes(_basePath).replace(/\/$/, '') : undefined; const patternTypePairs = Object.entries(patterns ?? []).map( ([_pattern, type]) => { const pattern = normalizeSlashes(_pattern); return { pattern: parsePattern(basePath!, pattern), type }; } ); const classifications: Record = { package: { moduleType: 'auto', }, cjs: { moduleType: 'cjs', }, esm: { moduleType: 'esm', }, }; const auto = classifications.package; // Passed path must be normalized! function classifyModuleNonCached(path: string): ModuleTypeClassification { const matched = matchPatterns(patternTypePairs, (_) => _.pattern, path); if (matched) return classifications[matched.type]; return auto; } const classifyModule = cachedLookup(classifyModuleNonCached); function classifyModuleAuto(path: String) { return auto; } return { classifyModuleByModuleTypeOverrides: patternTypePairs.length ? classifyModule : classifyModuleAuto, }; } function parsePattern(basePath: string, patternString: string): RegExp { const pattern = getPatternFromSpec(patternString, basePath); return pattern !== undefined ? new RegExp(pattern) : /(?:)/; } function matchPatterns( objects: T[], getPattern: (t: T) => RegExp, candidate: string ): T | undefined { for (let i = objects.length - 1; i >= 0; i--) { const object = objects[i]; const pattern = getPattern(object); if (pattern?.test(candidate)) { return object; } } } ts-node-10.9.2/src/node-module-type-classifier.ts000066400000000000000000000023601453460306300216310ustar00rootroot00000000000000import { readPackageScope } from '../dist-raw/node-internal-modules-cjs-loader'; /** * Determine how to emit a module based on tsconfig "module" and package.json "type" * * Supports module=nodenext/node16 with transpileOnly, where we cannot ask the * TS typechecker to tell us if a file is CJS or ESM. * * Return values indicate: * - cjs * - esm * - nodecjs == node-flavored cjs where dynamic imports are *not* transformed into `require()` * - undefined == emit according to tsconfig `module` config, whatever that is * @internal */ export function classifyModule( nativeFilename: string, isNodeModuleType: boolean ): 'nodecjs' | 'cjs' | 'esm' | 'nodeesm' | undefined { // [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] const lastDotIndex = nativeFilename.lastIndexOf('.'); const ext = lastDotIndex >= 0 ? nativeFilename.slice(lastDotIndex) : ''; switch (ext) { case '.cjs': case '.cts': return isNodeModuleType ? 'nodecjs' : 'cjs'; case '.mjs': case '.mts': return isNodeModuleType ? 'nodeesm' : 'esm'; } if (isNodeModuleType) { const packageScope = readPackageScope(nativeFilename); if (packageScope && packageScope.data.type === 'module') return 'nodeesm'; return 'nodecjs'; } return undefined; } ts-node-10.9.2/src/node-resolver-functions.ts.disabled000066400000000000000000000250021453460306300226560ustar00rootroot00000000000000import { cachedLookup, normalizeSlashes } from './util'; import type * as _ts from 'typescript'; import { dirname, resolve } from 'path'; import { getPatternFromSpec } from './ts-internals'; import type { TSInternal } from './ts-compiler-types'; import { getDefaultTsconfigJsonForNodeVersion } from './tsconfigs'; import { getTsConfigDefaults, ComputeAsCommonRootOfFiles, } from './configuration'; interface SrcOutPair { preferSrc: boolean; root: string; out: string; } // interface RootDirsSet { // rootDirs: string[]; // } function contains(parentDirWithTrailingSlash: string, childDir: string) { return childDir.startsWith(parentDirWithTrailingSlash); } class SolutionResolver {} class ProjectResolver { files: string[]; includeRe: RegExp; excludeRe: Regexp; constuctor( ts: TSInternal, tsconfig: _ts.ParsedCommandLine, configFilePathOrCwd: string, basePath: string, files: string[] | undefined, include: string[] | undefined, exclude: string[] | undefined ) { // const configBaseDir = normalizeSlashes(dirname(configFilePathOrCwd)); const { rootDir, include: includeSpecs, files: filesArray, exclude: excludeSpecs, } = getTsConfigDefaults(tsconfig, basePath, files, include, exclude); if (rootDir === ComputeAsCommonRootOfFiles) { throw new Error( 'Cannot determine rootDir if composite is not set. Either enable composite or set explicit rootDir' ); } this.files = filesArray.map((f) => normalizeSlashes(resolve(basePath, f))); const reString = ts.getRegularExpressionForWildcard( includeSpecs, basePath, 'files' ); this.includeRe = new RegExp(reString ?? '$^'); const reString2 = ts.getRegularExpressionForWildcard( excludeSpecs as string[], basePath, 'exclude' ); this.excludeRe = new RegExp(reString2 ?? '$^'); } } function createNodeResolverFunctions(opts: { allowJs: boolean; jsx: boolean; cjsMjs: boolean; }) { const { allowJs, cjsMjs, jsx } = opts; const rootOutPairs: SrcOutPair[] = []; // const rootDirsSets: RootDirsSet[] = []; /** * Must be passed normalized slashes! * Assumes root and out are different! */ function addRootOutPair(root: string, out: string, preferSrc = true) { root = ensureTrailingSlash(root); out = ensureTrailingSlash(out); rootOutPairs.push({ root, out, preferSrc }); } function ensureTrailingSlash(str: string) { if (str.includes('\\')) throw new Error('String must have normalized slashes'); if (!str.endsWith('/')) str += '/'; return str; } // function mapFromOutToRoot(directory: string) { // directory = ensureTrailingSlash(directory); // for(const {out, root} of rootOutPairs) { // if(directory.startsWith(out)) { // return root + directory.slice(out.length); // } // } // return directory; // } function mapFromRootToOut(directory: string) { directory = ensureTrailingSlash(directory); for (const { out, root } of rootOutPairs) { if (directory.startsWith(root)) { // TODO how to exclude node_modules from this mapping?? // Check regexp patterns to see if this file is included? return out + directory.slice(root.length); } } return directory; } // /** Must be passed normalized slashes! */ // function addRootDirs(rootDirs: string[]) { // rootDirsSets.push({ // rootDirs: rootDirs.map(rootDir => rootDir.endsWith('/') ? rootDir : rootDir + '/') // }); // } const getAlternativeDirectoriesCached = cachedLookup( getAlternativeDirectories ); /** Get array of alternative directories to check because they're overlaid over each other */ function* getAlternativeDirectories(directory: string) { directory = ensureTrailingSlash(directory); for (const { out, preferSrc, root } of rootOutPairs) { if (contains(root, directory)) { if (preferSrc) { yield directory; // directory is in src; preferred yield out + directory.slice(root.length); } else { yield out + directory.slice(root.length); yield directory; } } else if (contains(out, directory)) { if (preferSrc) { yield root + directory.slice(out.length); yield directory; // directory is in out } else { yield directory; yield root + directory.slice(out.length); } } else { yield directory; } } // for(const rootDirsSet of rootDirsSets) { // const alternatives2: string[] = []; // for(const alternative of alternatives!) { // ForRootDirsInSingleSet: // for(const rootDir of rootDirsSet.rootDirs) { // if(contains(rootDir, alternative)) { // // alternative matches; replace it with each rootDir in the set // for(const rootDir2 of rootDirsSet.rootDirs) { // alternatives2.push(rootDir2 + alternative.slice(rootDir.length)); // } // break ForRootDirsInSingleSet; // } // } // // alternative does not match; passthrough // alternatives2.push(alternative); // } // alternatives = alternatives2; // } } // If extension is omitted and we are expected to add one, try these const extensionlessExtensions = [ 'js', 'cjs', 'mjs', jsx && 'jsx', 'ts', 'cts', 'mts', jsx && 'tsx', ]; // If extension already specified, and is recognized, attempt these replacements const jsExtensions = ['js', jsx && 'jsx', 'ts', jsx && 'tsx'].filter( (v) => v ) as string[]; const cjsExtensions = ['cjs', 'cts']; const mjsExtensions = ['mjs', 'mts']; /** * Get alternative filenames to check because they're equivalent. * * Alternatives should only be attempted in: * -- rootDir, if was able to map root<==>out * -- otherwise attempt in dir, whatever it is. */ function* getAlternativeFilenames( filename: string, allowOmitFileExtension: boolean ) { // TODO be sure to avoid .d.ts, .d.mts, and .d.cts const lastDotIndex = filename.lastIndexOf('.'); let emittedReplacements = false; if (lastDotIndex > 0) { const endsInDts = filename.endsWith('.d.ts') || filename.endsWith('.d.cts') || filename.endsWith('.d.mts'); if (!endsInDts) { const name = filename.slice(0, lastDotIndex); const extension = filename.slice(lastDotIndex + 1); const replacements = extension === 'js' ? jsExtensions : extension === 'cjs' ? cjsExtensions : extension === 'mjs' ? mjsExtensions : undefined; if (replacements) { emittedReplacements = true; for (const replacement of replacements) { yield name + '.' + replacement; } } } } if (!emittedReplacements) yield filename; if (allowOmitFileExtension) { for (const replacement of extensionlessExtensions) { yield filename + '.' + replacement; } } } return { addRootOutPair, getAlternativeDirectories, getAlternativeDirectoriesCached, getAlternativeFilenames, }; } /* . dist If rootDir matches any rootDirs entry: - generate list of alternative rootDir - map each to outDir foo bar baz For path foo/hello: foo/hello bar/hello baz/hello dist/foo/hello dist/bar/hello dist/baz/hello For path node_modules/lodash node_modules/lodash dist/node_modules/lodash If directory is outside of common root of all mappings, skip If parent mappings were computed, how can they be augmented? For each directory, a given mapping is either APPLIED, IRRELEVANT, or NOTYET - src <-> out - if any rootDirs are child of src or dist */ /* src/foo dist/foo src/foo src/bar src/baz dist/foo dist/bar dist/baz foo/src/lib dist foo/src/lib bar/src/lib baz/src/lib dist/lib outDir mapping: src/foo->dist rootDirs mappings: ./foo, ./bar, ./baz src/foo src/bar src/baz dist outDir mapping: src->dist rootDirs mappings: ./foo, ./bar, ./baz src/foo src/bar src/baz dist/foo dist/bar dist/baz expand src by rootDirs then expand each by root->out mappings */ /* For now, think about *only* rootDir<->outDir mappings Sort all rootDir by length descending Sort all outDir by length descending Attempt mapping for each. As soon as mapping succeeds for *any single entry*, stop attempting others. */ /* rootDirs src/foo src/bar src/baz preprocess to include rootDir<->outDir src/foo src/bar src/baz dist/foo dist/bar dist/baz */ /* First must map importer from src to dist if possible. Then attempt import relative to the dist location, checking dist<-src whenever possible. */ // const ts: typeof _ts; // ts.createLanguageServiceSourceFile // ts.createSourceFile // ts.createUnparsedSourceFile // ts.create /* To use experimentalResolver: - must set explicit rootDir, imply it with composite, or imply it with references When resolving an import ##Step one: convert importer path to outDir if appropriate If importer is within rootDir & matched by include/files/exclude, map it to outDir - Abandon mapping if `outDir` and `rootDir` identical - Abandon mapping if import already within outDir - sort by rootDir specificity so that workspaces are matched prior to ancestors - mapping logic can be cached per __dirname&tsconfig pair, but must still consider if filename matches regexps - allows supporting multiple tsconfigs with same rootDir - allows respecting `path` mappings when we know which tsconfig governs the importer, because we have a single tsconfig to use for mappings ##Step two: convert (many) target paths to rootDir if appropriate While resolving, we check many directories. If resolution target is within `outDir`, attempt mapping to `rootDir` - Abandon mapping if `outDir` and `rootDir` identical - Abandon mapping if target already within `rootDir` - Abandon mapping if is not matched by include/files/exclude - HOW TO CHECK THIS BEFORE WE HAVE A FILE EXTENSION? For each include/files/exclude, generate a version that ignores file extensions? Test the directory with it? - `TsconfigFilesMatcher.directoryChildMightMatch(dirname)` - `TsconfigFilesMatcher.directoryAncestorMightMatch(dirname)` - OPTIMIZATION - If none of the include / files patterns contain `node_modules`, and if target directory after basedir contains `node_modules`, then we *know* the entire directory tree is excluded - This optimization should apply to almost all projects - OPTIMIZATION detect when all file extensions are treated identically?? */ ts-node-10.9.2/src/repl.ts000066400000000000000000000574721453460306300153000ustar00rootroot00000000000000import type * as _diff from 'diff'; import { homedir } from 'os'; import { join } from 'path'; import { Recoverable, ReplOptions, REPLServer, start as nodeReplStart, } from 'repl'; import { Context, createContext, Script } from 'vm'; import { Service, CreateOptions, TSError, env } from './index'; import { readFileSync, statSync } from 'fs'; import { Console } from 'console'; import * as assert from 'assert'; import type * as tty from 'tty'; import type * as Module from 'module'; import { builtinModules } from 'module'; // Lazy-loaded. let _processTopLevelAwait: (src: string) => string | null; function getProcessTopLevelAwait() { if (_processTopLevelAwait === undefined) { ({ processTopLevelAwait: _processTopLevelAwait, } = require('../dist-raw/node-internal-repl-await')); } return _processTopLevelAwait; } let diff: typeof _diff; function getDiffLines() { if (diff === undefined) { diff = require('diff'); } return diff.diffLines; } /** @internal */ export const EVAL_FILENAME = `[eval].ts`; /** @internal */ export const EVAL_NAME = `[eval]`; /** @internal */ export const STDIN_FILENAME = `[stdin].ts`; /** @internal */ export const STDIN_NAME = `[stdin]`; /** @internal */ export const REPL_FILENAME = '.ts'; /** @internal */ export const REPL_NAME = ''; export interface ReplService { readonly state: EvalState; /** * Bind this REPL to a ts-node compiler service. A compiler service must be bound before `eval`-ing code or starting the REPL */ setService(service: Service): void; /** * Append code to the virtual source file, compile it to JavaScript, throw semantic errors if the typechecker is enabled, * and execute it. * * Note: typically, you will want to call `start()` instead of using this method. * * @param code string of TypeScript. */ evalCode(code: string): any; /** @internal */ evalCodeInternal(opts: { code: string; enableTopLevelAwait?: boolean; context?: Context; }): | { containsTopLevelAwait: true; valuePromise: Promise; } | { containsTopLevelAwait: false; value: any; }; /** * `eval` implementation compatible with node's REPL API * * Can be used in advanced scenarios if you want to manually create your own * node REPL instance and delegate eval to this `ReplService`. * * Example: * * import {start} from 'repl'; * const replService: tsNode.ReplService = ...; // assuming you have already created a ts-node ReplService * const nodeRepl = start({eval: replService.eval}); */ nodeEval( code: string, // TODO change to `Context` in a future release? Technically a breaking change context: any, _filename: string, callback: (err: Error | null, result?: any) => any ): void; evalAwarePartialHost: EvalAwarePartialHost; /** Start a node REPL */ start(): void; /** * Start a node REPL, evaling a string of TypeScript before it starts. * @deprecated */ start(code: string): void; /** @internal */ startInternal(opts?: ReplOptions): REPLServer; /** @internal */ readonly stdin: NodeJS.ReadableStream; /** @internal */ readonly stdout: NodeJS.WritableStream; /** @internal */ readonly stderr: NodeJS.WritableStream; /** @internal */ readonly console: Console; } /** @category REPL */ export interface CreateReplOptions { service?: Service; state?: EvalState; stdin?: NodeJS.ReadableStream; stdout?: NodeJS.WritableStream; stderr?: NodeJS.WritableStream; /** @internal */ composeWithEvalAwarePartialHost?: EvalAwarePartialHost; /** * @internal * Ignore diagnostics that are annoying when interactively entering input line-by-line. */ ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl?: boolean; } /** * Create a ts-node REPL instance. * * Pay close attention to the example below. Today, the API requires a few lines * of boilerplate to correctly bind the `ReplService` to the ts-node `Service` and * vice-versa. * * Usage example: * * const repl = tsNode.createRepl(); * const service = tsNode.create({...repl.evalAwarePartialHost}); * repl.setService(service); * repl.start(); * * @category REPL */ export function createRepl(options: CreateReplOptions = {}) { const { ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl = true } = options; let service = options.service; let nodeReplServer: REPLServer; // If `useGlobal` is not true, then REPL creates a context when started. // This stores a reference to it or to `global`, whichever is used, after REPL has started. let context: Context | undefined; const state = options.state ?? new EvalState(join(process.cwd(), REPL_FILENAME)); const evalAwarePartialHost = createEvalAwarePartialHost( state, options.composeWithEvalAwarePartialHost ); const stdin = options.stdin ?? process.stdin; const stdout = options.stdout ?? process.stdout; const stderr = options.stderr ?? process.stderr; const _console = stdout === process.stdout && stderr === process.stderr ? console : new Console(stdout, stderr); const replService: ReplService = { state: options.state ?? new EvalState(join(process.cwd(), EVAL_FILENAME)), setService, evalCode, evalCodeInternal, nodeEval, evalAwarePartialHost, start, startInternal, stdin, stdout, stderr, console: _console, }; return replService; function setService(_service: Service) { service = _service; if (ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl) { service.addDiagnosticFilter({ appliesToAllFiles: false, filenamesAbsolute: [state.path], diagnosticsIgnored: [ 2393, // Duplicate function implementation: https://github.com/TypeStrong/ts-node/issues/729 6133, // is declared but its value is never read. https://github.com/TypeStrong/ts-node/issues/850 7027, // Unreachable code detected. https://github.com/TypeStrong/ts-node/issues/469 ...(service.shouldReplAwait ? topLevelAwaitDiagnosticCodes : []), ], }); } } function evalCode(code: string) { const result = appendCompileAndEvalInput({ service: service!, state, input: code, context, overrideIsCompletion: false, }); assert(result.containsTopLevelAwait === false); return result.value; } function evalCodeInternal(options: { code: string; enableTopLevelAwait?: boolean; context: Context; }) { const { code, enableTopLevelAwait, context } = options; return appendCompileAndEvalInput({ service: service!, state, input: code, enableTopLevelAwait, context, }); } function nodeEval( code: string, context: any, _filename: string, callback: (err: Error | null, result?: any) => any ) { // TODO: Figure out how to handle completion here. if (code === '.scope') { callback(null); return; } try { const evalResult = evalCodeInternal({ code, enableTopLevelAwait: true, context, }); if (evalResult.containsTopLevelAwait) { (async () => { try { callback(null, await evalResult.valuePromise); } catch (promiseError) { handleError(promiseError); } })(); } else { callback(null, evalResult.value); } } catch (error) { handleError(error); } // Log TSErrors, check if they're recoverable, log helpful hints for certain // well-known errors, and invoke `callback()` // TODO should evalCode API get the same error-handling benefits? function handleError(error: unknown) { // Don't show TLA hint if the user explicitly disabled repl top level await const canLogTopLevelAwaitHint = service!.options.experimentalReplAwait !== false && !service!.shouldReplAwait; if (error instanceof TSError) { // Support recoverable compilations using >= node 6. if (Recoverable && isRecoverable(error)) { callback(new Recoverable(error)); return; } else { _console.error(error); if ( canLogTopLevelAwaitHint && error.diagnosticCodes.some((dC) => topLevelAwaitDiagnosticCodes.includes(dC) ) ) { _console.error(getTopLevelAwaitHint()); } callback(null); } } else { let _error = error as Error | undefined; if ( canLogTopLevelAwaitHint && _error instanceof SyntaxError && _error.message?.includes('await is only valid') ) { try { // Only way I know to make our hint appear after the error _error.message += `\n\n${getTopLevelAwaitHint()}`; _error.stack = _error.stack?.replace( /(SyntaxError:.*)/, (_, $1) => `${$1}\n\n${getTopLevelAwaitHint()}` ); } catch {} } callback(_error as Error); } } function getTopLevelAwaitHint() { return `Hint: REPL top-level await requires TypeScript version 3.8 or higher and target ES2018 or higher. You are using TypeScript ${ service!.ts.version } and target ${ service!.ts.ScriptTarget[service!.config.options.target!] }.`; } } // Note: `code` argument is deprecated function start(code?: string) { startInternal({ code }); } // Note: `code` argument is deprecated function startInternal( options?: ReplOptions & { code?: string; forceToBeModule?: boolean } ) { const { code, forceToBeModule = true, ...optionsOverride } = options ?? {}; // TODO assert that `service` is set; remove all `service!` non-null assertions // Eval incoming code before the REPL starts. // Note: deprecated if (code) { try { evalCode(`${code}\n`); } catch (err) { _console.error(err); // Note: should not be killing the process here, but this codepath is deprecated anyway process.exit(1); } } // In case the typescript compiler hasn't compiled anything yet, // make it run though compilation at least one time before // the REPL starts for a snappier user experience on startup. service?.compile('', state.path); const repl = nodeReplStart({ prompt: '> ', input: replService.stdin, output: replService.stdout, // Mimicking node's REPL implementation: https://github.com/nodejs/node/blob/168b22ba073ee1cbf8d0bcb4ded7ff3099335d04/lib/internal/repl.js#L28-L30 terminal: (stdout as tty.WriteStream).isTTY && !parseInt(env.NODE_NO_READLINE!, 10), eval: nodeEval, useGlobal: true, ...optionsOverride, }); nodeReplServer = repl; context = repl.context; // Bookmark the point where we should reset the REPL state. const resetEval = appendToEvalState(state, ''); function reset() { resetEval(); // Hard fix for TypeScript forcing `Object.defineProperty(exports, ...)`. runInContext('exports = module.exports', state.path, context); if (forceToBeModule) { state.input += 'export {};void 0;\n'; } // Declare node builtins. // Skip the same builtins as `addBuiltinLibsToObject`: // those starting with _ // those containing / // those that already exist as globals // Intentionally suppress type errors in case @types/node does not declare any of them, and because // `declare import` is technically invalid syntax. // Avoid this when in transpileOnly, because third-party transpilers may not handle `declare import`. if (!service?.transpileOnly) { state.input += `// @ts-ignore\n${builtinModules .filter( (name) => !name.startsWith('_') && !name.includes('/') && !['console', 'module', 'process'].includes(name) ) .map((name) => `declare import ${name} = require('${name}')`) .join(';')}\n`; } } reset(); repl.on('reset', reset); repl.defineCommand('type', { help: 'Check the type of a TypeScript identifier', action: function (identifier: string) { if (!identifier) { repl.displayPrompt(); return; } const undo = appendToEvalState(state, identifier); const { name, comment } = service!.getTypeInfo( state.input, state.path, state.input.length ); undo(); if (name) repl.outputStream.write(`${name}\n`); if (comment) repl.outputStream.write(`${comment}\n`); repl.displayPrompt(); }, }); // Set up REPL history when available natively via node.js >= 11. if (repl.setupHistory) { const historyPath = env.TS_NODE_HISTORY || join(homedir(), '.ts_node_repl_history'); repl.setupHistory(historyPath, (err) => { if (!err) return; _console.error(err); process.exit(1); }); } return repl; } } /** * Eval state management. Stores virtual `[eval].ts` file */ export class EvalState { /** @internal */ input = ''; /** @internal */ output = ''; /** @internal */ version = 0; /** @internal */ lines = 0; __tsNodeEvalStateBrand: unknown; constructor(public path: string) {} } /** * Filesystem host functions which are aware of the "virtual" `[eval].ts`, ``, or `[stdin].ts` file used to compile REPL inputs. * Must be passed to `create()` to create a ts-node compiler service which can compile REPL inputs. */ export type EvalAwarePartialHost = Pick< CreateOptions, 'readFile' | 'fileExists' >; export function createEvalAwarePartialHost( state: EvalState, composeWith?: EvalAwarePartialHost ): EvalAwarePartialHost { function readFile(path: string) { if (path === state.path) return state.input; if (composeWith?.readFile) return composeWith.readFile(path); try { return readFileSync(path, 'utf8'); } catch (err) { /* Ignore. */ } } function fileExists(path: string) { if (path === state.path) return true; if (composeWith?.fileExists) return composeWith.fileExists(path); try { const stats = statSync(path); return stats.isFile() || stats.isFIFO(); } catch (err) { return false; } } return { readFile, fileExists }; } const sourcemapCommentRe = /\/\/# ?sourceMappingURL=\S+[\s\r\n]*$/; type AppendCompileAndEvalInputResult = | { containsTopLevelAwait: true; valuePromise: Promise } | { containsTopLevelAwait: false; value: any }; /** * Evaluate the code snippet. * * Append it to virtual .ts file, compile, handle compiler errors, compute a diff of the JS, and eval any code that * appears as "added" in the diff. */ function appendCompileAndEvalInput(options: { service: Service; state: EvalState; input: string; wrappedErr?: unknown; /** Enable top-level await but only if the TSNode service allows it. */ enableTopLevelAwait?: boolean; context: Context | undefined; /** * Added so that `evalCode` can be guaranteed *not* to trigger the `isCompletion` * codepath. However, the `isCompletion` logic is ancient and maybe should be removed entirely. * Nobody's looked at it in a long time. */ overrideIsCompletion?: boolean; }): AppendCompileAndEvalInputResult { const { service, state, wrappedErr, enableTopLevelAwait = false, context, overrideIsCompletion, } = options; let { input } = options; // It's confusing for `{ a: 1 }` to be interpreted as a block statement // rather than an object literal. So, we first try to wrap it in // parentheses, so that it will be interpreted as an expression. // Based on https://github.com/nodejs/node/blob/c2e6822153bad023ab7ebd30a6117dcc049e475c/lib/repl.js#L413-L422 let wrappedCmd = false; if (!wrappedErr && /^\s*{/.test(input) && !/;\s*$/.test(input)) { input = `(${input.trim()})\n`; wrappedCmd = true; } const lines = state.lines; const isCompletion = overrideIsCompletion ?? !/\n$/.test(input); const undo = appendToEvalState(state, input); let output: string; // Based on https://github.com/nodejs/node/blob/92573721c7cff104ccb82b6ed3e8aa69c4b27510/lib/repl.js#L457-L461 function adjustUseStrict(code: string) { // "void 0" keeps the repl from returning "use strict" as the result // value for statements and declarations that don't return a value. return code.replace(/^"use strict";/, '"use strict"; void 0;'); } try { output = service.compile(state.input, state.path, -lines); } catch (err) { undo(); if (wrappedCmd) { if (err instanceof TSError && err.diagnosticCodes[0] === 2339) { // Ensure consistent and more sane behavior between { a: 1 }['b'] and ({ a: 1 }['b']) throw err; } // Unwrap and try again return appendCompileAndEvalInput({ ...options, wrappedErr: err, }); } if (wrappedErr) throw wrappedErr; throw err; } output = adjustUseStrict(output); // Note: REPL does not respect sourcemaps! // To properly do that, we'd need to prefix the code we eval -- which comes // from `diffLines` -- with newlines so that it's at the proper line numbers. // Then we'd need to ensure each bit of eval-ed code, if there are multiples, // has the sourcemap appended to it. // We might also need to integrate with our sourcemap hooks' cache; I'm not sure. const outputWithoutSourcemapComment = output.replace(sourcemapCommentRe, ''); const oldOutputWithoutSourcemapComment = state.output.replace( sourcemapCommentRe, '' ); // Use `diff` to check for new JavaScript to execute. const changes = getDiffLines()( oldOutputWithoutSourcemapComment, outputWithoutSourcemapComment ); if (isCompletion) { undo(); } else { state.output = output; // Insert a semicolon to make sure that the code doesn't interact with the next line, // for example to prevent `2\n+ 2` from producing 4. // This is safe since the output will not change since we can only get here with successful inputs, // and adding a semicolon to the end of a successful input won't ever change the output. state.input = state.input.replace( /([^\n\s])([\n\s]*)$/, (all, lastChar, whitespace) => { if (lastChar !== ';') return `${lastChar};${whitespace}`; return all; } ); } let commands: Array<{ mustAwait?: true; execCommand: () => any }> = []; let containsTopLevelAwait = false; // Build a list of "commands": bits of JS code in the diff that must be executed. for (const change of changes) { if (change.added) { if ( enableTopLevelAwait && service.shouldReplAwait && change.value.indexOf('await') > -1 ) { const processTopLevelAwait = getProcessTopLevelAwait(); // Newline prevents comments to mess with wrapper const wrappedResult = processTopLevelAwait(change.value + '\n'); if (wrappedResult !== null) { containsTopLevelAwait = true; commands.push({ mustAwait: true, execCommand: () => runInContext(wrappedResult, state.path, context), }); continue; } } commands.push({ execCommand: () => runInContext(change.value, state.path, context), }); } } // Execute all commands asynchronously if necessary, returning the result or a // promise of the result. if (containsTopLevelAwait) { return { containsTopLevelAwait, valuePromise: (async () => { let value; for (const command of commands) { const r = command.execCommand(); value = command.mustAwait ? await r : r; } return value; })(), }; } else { return { containsTopLevelAwait: false, value: commands.reduce((_, c) => c.execCommand(), undefined), }; } } /** * Low-level execution of JS code in context */ function runInContext(code: string, filename: string, context?: Context) { const script = new Script(code, { filename }); if (context === undefined || context === global) { return script.runInThisContext(); } else { return script.runInContext(context); } } /** * Append to the eval instance and return an undo function. */ function appendToEvalState(state: EvalState, input: string) { const undoInput = state.input; const undoVersion = state.version; const undoOutput = state.output; const undoLines = state.lines; state.input += input; state.lines += lineCount(input); state.version++; return function () { state.input = undoInput; state.output = undoOutput; state.version = undoVersion; state.lines = undoLines; }; } /** * Count the number of lines. */ function lineCount(value: string) { let count = 0; for (const char of value) { if (char === '\n') { count++; } } return count; } /** * TS diagnostic codes which are recoverable, meaning that the user likely entered an incomplete line of code * and should be prompted for the next. For example, starting a multi-line for() loop and not finishing it. * null value means code is always recoverable. `Set` means code is only recoverable when occurring alongside at least one * of the other codes. */ const RECOVERY_CODES: Map | null> = new Map([ [1003, null], // "Identifier expected." [1005, null], // "')' expected.", "'}' expected." [1109, null], // "Expression expected." [1126, null], // "Unexpected end of text." [ 1136, // "Property assignment expected." new Set([1005]), // happens when typing out an object literal or block scope across multiple lines: '{ foo: 123,' ], [1160, null], // "Unterminated template literal." [1161, null], // "Unterminated regular expression literal." [2355, null], // "A function whose declared type is neither 'void' nor 'any' must return a value." [2391, null], // "Function implementation is missing or not immediately following the declaration." [ 7010, // "Function, which lacks return-type annotation, implicitly has an 'any' return type." new Set([1005]), // happens when fn signature spread across multiple lines: 'function a(\nb: any\n) {' ], ]); /** * Diagnostic codes raised when using top-level await. * These are suppressed when top-level await is enabled. * When it is *not* enabled, these trigger a helpful hint about enabling top-level await. */ const topLevelAwaitDiagnosticCodes = [ 1375, // 'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module. 1378, // Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. 1431, // 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module. 1432, // Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. ]; /** * Check if a function can recover gracefully. */ function isRecoverable(error: TSError) { return error.diagnosticCodes.every((code) => { const deps = RECOVERY_CODES.get(code); return ( deps === null || (deps && error.diagnosticCodes.some((code) => deps.has(code))) ); }); } /** * @internal * Set properties on `context` before eval-ing [stdin] or [eval] input. */ export function setupContext( context: any, module: Module, filenameAndDirname: 'eval' | 'stdin' | null ) { if (filenameAndDirname) { context.__dirname = '.'; context.__filename = `[${filenameAndDirname}]`; } context.module = module; context.exports = module.exports; context.require = module.require.bind(module); } ts-node-10.9.2/src/resolver-functions.ts000066400000000000000000000211351453460306300201700ustar00rootroot00000000000000import { resolve } from 'path'; import type { CreateOptions } from '.'; import type { Extensions } from './file-extensions'; import type { TSCommon, TSInternal } from './ts-compiler-types'; import type { ProjectLocalResolveHelper } from './util'; /** * @internal * In a factory because these are shared across both CompilerHost and LanguageService codepaths */ export function createResolverFunctions(kwargs: { ts: TSCommon; host: TSCommon.ModuleResolutionHost; cwd: string; getCanonicalFileName: (filename: string) => string; config: TSCommon.ParsedCommandLine; projectLocalResolveHelper: ProjectLocalResolveHelper; options: CreateOptions; extensions: Extensions; }) { const { host, ts, config, cwd, getCanonicalFileName, projectLocalResolveHelper, options, extensions, } = kwargs; const moduleResolutionCache = ts.createModuleResolutionCache( cwd, getCanonicalFileName, config.options ); const knownInternalFilenames = new Set(); /** "Buckets" (module directories) whose contents should be marked "internal" */ const internalBuckets = new Set(); // Get bucket for a source filename. Bucket is the containing `./node_modules/*/` directory // For '/project/node_modules/foo/node_modules/bar/lib/index.js' bucket is '/project/node_modules/foo/node_modules/bar/' // For '/project/node_modules/foo/node_modules/@scope/bar/lib/index.js' bucket is '/project/node_modules/foo/node_modules/@scope/bar/' const moduleBucketRe = /.*\/node_modules\/(?:@[^\/]+\/)?[^\/]+\//; function getModuleBucket(filename: string) { const find = moduleBucketRe.exec(filename); if (find) return find[0]; return ''; } // Mark that this file and all siblings in its bucket should be "internal" function markBucketOfFilenameInternal(filename: string) { internalBuckets.add(getModuleBucket(filename)); } function isFileInInternalBucket(filename: string) { return internalBuckets.has(getModuleBucket(filename)); } function isFileKnownToBeInternal(filename: string) { return knownInternalFilenames.has(filename); } /** * If we need to emit JS for a file, force TS to consider it non-external */ const fixupResolvedModule = ( resolvedModule: | TSCommon.ResolvedModule | TSCommon.ResolvedTypeReferenceDirective ) => { const { resolvedFileName } = resolvedModule; if (resolvedFileName === undefined) return; // [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS] // .ts,.mts,.cts is always switched to internal // .js is switched on-demand if ( resolvedModule.isExternalLibraryImport && ((resolvedFileName.endsWith('.ts') && !resolvedFileName.endsWith('.d.ts')) || (resolvedFileName.endsWith('.cts') && !resolvedFileName.endsWith('.d.cts')) || (resolvedFileName.endsWith('.mts') && !resolvedFileName.endsWith('.d.mts')) || isFileKnownToBeInternal(resolvedFileName) || isFileInInternalBucket(resolvedFileName)) ) { resolvedModule.isExternalLibraryImport = false; } if (!resolvedModule.isExternalLibraryImport) { knownInternalFilenames.add(resolvedFileName); } }; /* * NOTE: * Older ts versions do not pass `redirectedReference` nor `options`. * We must pass `redirectedReference` to newer ts versions, but cannot rely on `options`, hence the weird argument name */ const resolveModuleNames: TSCommon.LanguageServiceHost['resolveModuleNames'] = ( moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: TSCommon.ResolvedProjectReference | undefined, optionsOnlyWithNewerTsVersions: TSCommon.CompilerOptions, containingSourceFile?: TSCommon.SourceFile ): (TSCommon.ResolvedModule | undefined)[] => { return moduleNames.map((moduleName, i) => { const mode = containingSourceFile ? (ts as any as TSInternal).getModeForResolutionAtIndex?.( containingSourceFile, i ) : undefined; let { resolvedModule } = ts.resolveModuleName( moduleName, containingFile, config.options, host, moduleResolutionCache, redirectedReference, mode ); if (!resolvedModule && options.experimentalTsImportSpecifiers) { const lastDotIndex = moduleName.lastIndexOf('.'); const ext = lastDotIndex >= 0 ? moduleName.slice(lastDotIndex) : ''; if (ext) { const replacements = extensions.tsResolverEquivalents.get(ext); for (const replacementExt of replacements ?? []) { ({ resolvedModule } = ts.resolveModuleName( moduleName.slice(0, -ext.length) + replacementExt, containingFile, config.options, host, moduleResolutionCache, redirectedReference, mode )); if (resolvedModule) break; } } } if (resolvedModule) { fixupResolvedModule(resolvedModule); } return resolvedModule; }); }; // language service never calls this, but TS docs recommend that we implement it const getResolvedModuleWithFailedLookupLocationsFromCache: TSCommon.LanguageServiceHost['getResolvedModuleWithFailedLookupLocationsFromCache'] = ( moduleName, containingFile, resolutionMode?: TSCommon.ModuleKind.CommonJS | TSCommon.ModuleKind.ESNext ): TSCommon.ResolvedModuleWithFailedLookupLocations | undefined => { const ret = ts.resolveModuleNameFromCache( moduleName, containingFile, moduleResolutionCache, resolutionMode ); if (ret && ret.resolvedModule) { fixupResolvedModule(ret.resolvedModule); } return ret; }; const resolveTypeReferenceDirectives: TSCommon.LanguageServiceHost['resolveTypeReferenceDirectives'] = ( typeDirectiveNames: string[] | readonly TSCommon.FileReference[], containingFile: string, redirectedReference: TSCommon.ResolvedProjectReference | undefined, options: TSCommon.CompilerOptions, containingFileMode?: TSCommon.SourceFile['impliedNodeFormat'] | undefined // new impliedNodeFormat is accepted by compilerHost ): (TSCommon.ResolvedTypeReferenceDirective | undefined)[] => { // Note: seems to be called with empty typeDirectiveNames array for all files. // TODO consider using `ts.loadWithTypeDirectiveCache` return typeDirectiveNames.map((typeDirectiveName) => { // Copy-pasted from TS source: const nameIsString = typeof typeDirectiveName === 'string'; const mode = nameIsString ? undefined : (ts as any as TSInternal).getModeForFileReference!( typeDirectiveName, containingFileMode ); const strName = nameIsString ? typeDirectiveName : typeDirectiveName.fileName.toLowerCase(); let { resolvedTypeReferenceDirective } = ts.resolveTypeReferenceDirective( strName, containingFile, config.options, host, redirectedReference, undefined, mode ); if (typeDirectiveName === 'node' && !resolvedTypeReferenceDirective) { // Resolve @types/node relative to project first, then __dirname (copy logic from elsewhere / refactor into reusable function) let typesNodePackageJsonPath: string | undefined; try { typesNodePackageJsonPath = projectLocalResolveHelper( '@types/node/package.json', true ); } catch {} // gracefully do nothing when @types/node is not installed for any reason if (typesNodePackageJsonPath) { const typeRoots = [resolve(typesNodePackageJsonPath, '../..')]; ({ resolvedTypeReferenceDirective } = ts.resolveTypeReferenceDirective( typeDirectiveName, containingFile, { ...config.options, typeRoots, }, host, redirectedReference )); } } if (resolvedTypeReferenceDirective) { fixupResolvedModule(resolvedTypeReferenceDirective); } return resolvedTypeReferenceDirective; }); }; return { resolveModuleNames, getResolvedModuleWithFailedLookupLocationsFromCache, resolveTypeReferenceDirectives, isFileKnownToBeInternal, markBucketOfFilenameInternal, }; } ts-node-10.9.2/src/test/000077500000000000000000000000001453460306300147265ustar00rootroot00000000000000ts-node-10.9.2/src/test/diagnostics.spec.ts000066400000000000000000000041201453460306300205330ustar00rootroot00000000000000import type { TSError } from '..'; import { ctxTsNode, ts } from './helpers'; import { context, expect } from './testlib'; import * as semver from 'semver'; import { once } from 'lodash'; const test = context(ctxTsNode); test.suite('TSError diagnostics', ({ context }) => { const test = context( once(async (t) => { const service = t.context.tsNodeUnderTest.create({ compilerOptions: { target: 'es5' }, skipProject: true, }); try { service.compile('new Error(123)', 'test.ts'); } catch (err) { return { service, err }; } return { service, err: undefined }; }) ); const diagnosticCode = 2345; const diagnosticMessage = semver.satisfies(ts.version, '2.7') ? "Argument of type '123' " + "is not assignable to parameter of type 'string | undefined'." : "Argument of type 'number' " + "is not assignable to parameter of type 'string'."; const diagnosticErrorMessage = `TS${diagnosticCode}: ${diagnosticMessage}`; const cwdBefore = process.cwd(); test('should throw errors', ({ log, context: { err, service } }) => { log({ version: ts.version, serviceVersion: service.ts.version, cwdBefore, cwd: process.cwd(), configFilePath: service.configFilePath, config: service.config.options, }); expect(err).toBeDefined(); expect((err as Error).message).toMatch(diagnosticErrorMessage); }); test('should throw errors with diagnostic text', ({ context: { err } }) => { expect((err as TSError).diagnosticText).toMatch(diagnosticErrorMessage); }); test('should throw errors with diagnostic codes', ({ context: { err } }) => { expect((err as TSError).diagnosticCodes).toEqual([2345]); }); test('should throw errors with complete diagnostic information', ({ context: { err }, }) => { const diagnostics = (err as TSError).diagnostics; expect(diagnostics).toHaveLength(1); expect(diagnostics[0]).toMatchObject({ code: 2345, start: 10, length: 3, messageText: expect.stringMatching(diagnosticMessage), }); }); }); ts-node-10.9.2/src/test/esm-loader.spec.ts000066400000000000000000000461141453460306300202650ustar00rootroot00000000000000// ESM loader hook tests // TODO: at the time of writing, other ESM loader hook tests have not been moved into this file. // Should consolidate them here. import { context } from './testlib'; import semver = require('semver'); import { BIN_ESM_PATH, BIN_PATH, BIN_PATH_JS, CMD_ESM_LOADER_WITHOUT_PROJECT, CMD_TS_NODE_WITHOUT_PROJECT_FLAG, ctxTsNode, delay, EXPERIMENTAL_MODULES_FLAG, nodeSupportsEsmHooks, nodeSupportsImportAssertions, nodeSupportsUnflaggedJsonImports, nodeSupportsSpawningChildProcess, nodeUsesNewHooksApi, resetNodeEnvironment, TEST_DIR, tsSupportsImportAssertions, tsSupportsResolveJsonModule, tsSupportsStableNodeNextNode16, } from './helpers'; import { createExec, createSpawn, ExecReturn } from './exec-helpers'; import { join, resolve } from 'path'; import * as expect from 'expect'; import type { NodeLoaderHooksAPI2 } from '../'; import { pathToFileURL } from 'url'; const test = context(ctxTsNode); const exec = createExec({ cwd: TEST_DIR, }); const spawn = createSpawn({ cwd: TEST_DIR, }); test.suite('esm', (test) => { test.suite('when node supports loader hooks', (test) => { test.runIf(nodeSupportsEsmHooks); test('should compile and execute as ESM', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} index.ts`, { cwd: join(TEST_DIR, './esm'), } ); expect(err).toBe(null); expect(stdout).toBe('foo bar baz biff libfoo\n'); }); test('should use source maps', async (t) => { const { err, stdout, stderr } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} "throw error.ts"`, { cwd: join(TEST_DIR, './esm'), } ); expect(err).not.toBe(null); const expectedModuleUrl = pathToFileURL( join(TEST_DIR, './esm/throw error.ts') ).toString(); expect(err!.message).toMatch( [ `${expectedModuleUrl}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', 'Error: this is a demo', ` at Foo.bar (${expectedModuleUrl}:100:17)`, ].join('\n') ); }); test.suite('supports experimental-specifier-resolution=node', (test) => { test('via --experimental-specifier-resolution', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} --experimental-specifier-resolution=node index.ts`, { cwd: join(TEST_DIR, './esm-node-resolver') } ); expect(err).toBe(null); expect(stdout).toBe('foo bar baz biff libfoo\n'); }); test('via --es-module-specifier-resolution alias', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ${EXPERIMENTAL_MODULES_FLAG} --es-module-specifier-resolution=node index.ts`, { cwd: join(TEST_DIR, './esm-node-resolver') } ); expect(err).toBe(null); expect(stdout).toBe('foo bar baz biff libfoo\n'); }); test('via NODE_OPTIONS', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} index.ts`, { cwd: join(TEST_DIR, './esm-node-resolver'), env: { ...process.env, NODE_OPTIONS: `${EXPERIMENTAL_MODULES_FLAG} --experimental-specifier-resolution=node`, }, } ); expect(err).toBe(null); expect(stdout).toBe('foo bar baz biff libfoo\n'); }); }); test('throws ERR_REQUIRE_ESM when attempting to require() an ESM script when ESM loader is enabled', async () => { const { err, stderr } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./index.js`, { cwd: join(TEST_DIR, './esm-err-require-esm'), } ); expect(err).not.toBe(null); expect(stderr).toMatch( 'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:' ); }); test('defers to fallback loaders when URL should not be handled by ts-node', async () => { const { err, stdout, stderr } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} index.mjs`, { cwd: join(TEST_DIR, './esm-import-http-url'), } ); expect(err).not.toBe(null); // expect error from node's default resolver expect(stderr).toMatch( /Error \[ERR_UNSUPPORTED_ESM_URL_SCHEME\]:.*(?:\n.*){0,2}\n *at defaultResolve/ ); }); test('should bypass import cache when changing search params', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} index.ts`, { cwd: join(TEST_DIR, './esm-import-cache'), } ); expect(err).toBe(null); expect(stdout).toBe('log1\nlog2\nlog2\n'); }); test('should support transpile only mode via dedicated loader entrypoint', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT}/transpile-only index.ts`, { cwd: join(TEST_DIR, './esm-transpile-only'), } ); expect(err).toBe(null); expect(stdout).toBe(''); }); test('should throw type errors without transpile-only enabled', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} index.ts`, { cwd: join(TEST_DIR, './esm-transpile-only'), } ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch('Unable to compile TypeScript'); expect(err.message).toMatch( new RegExp( "TS2345: Argument of type '(?:number|1101)' is not assignable to parameter of type 'string'\\." ) ); expect(err.message).toMatch( new RegExp( "TS2322: Type '(?:\"hello world\"|string)' is not assignable to type 'number'\\." ) ); expect(stdout).toBe(''); }); test.suite('moduleTypes', (test) => { suite('with vanilla ts transpilation', 'tsconfig.json'); suite('with third-party-transpiler', 'tsconfig-swc.json'); function suite(name: string, tsconfig: string) { test.suite(name, (test) => { test('supports CJS webpack.config.ts in an otherwise ESM project', async (t) => { // A notable case where you can use ts-node's CommonJS loader, not the ESM loader, in an ESM project: // when loading a webpack.config.ts or similar config const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --project ./module-types/override-to-cjs/${tsconfig} ./module-types/override-to-cjs/test-webpack-config.cjs` ); expect(err).toBe(null); expect(stdout).toBe(``); }); test('should allow importing CJS in an otherwise ESM project', async (t) => { await run('override-to-cjs', tsconfig, 'cjs'); if (semver.gte(process.version, '14.13.1')) await run('override-to-cjs', tsconfig, 'mjs'); }); test('should allow importing ESM in an otherwise CJS project', async (t) => { await run('override-to-esm', tsconfig, 'cjs'); // Node 14.13.0 has a bug(?) where it checks for ESM-only syntax *before* we transform the code. if (semver.gte(process.version, '14.13.1')) await run('override-to-esm', tsconfig, 'mjs'); }); }); } async function run(project: string, config: string, ext: string) { const { err, stderr, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./module-types/${project}/test.${ext}`, { env: { ...process.env, TS_NODE_PROJECT: `./module-types/${project}/${config}`, }, } ); expect(err).toBe(null); expect(stdout).toBe(`Failures: 0\n`); } }); test.suite('createEsmHooks()', (test) => { test('should create proper hooks with provided instance', async () => { const { err } = await exec( `node ${EXPERIMENTAL_MODULES_FLAG} --loader ./loader.mjs index.ts`, { cwd: join(TEST_DIR, './esm-custom-loader'), } ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch(/TS6133:\s+'unusedVar'/); }); }); test.suite('unit test hooks', ({ context }) => { const test = context(async (t) => { const service = t.context.tsNodeUnderTest.create({ cwd: TEST_DIR, }); t.teardown(() => { resetNodeEnvironment(); }); return { service, hooks: t.context.tsNodeUnderTest.createEsmHooks(service), }; }); test.suite('data URIs', (test) => { test.runIf(nodeUsesNewHooksApi); test('Correctly determines format of data URIs', async (t) => { const { hooks } = t.context; const url = 'data:text/javascript,console.log("hello world");'; const result = await (hooks as NodeLoaderHooksAPI2).load( url, { format: undefined }, async (url, context, _ignored) => { return { format: context.format!, source: '' }; } ); expect(result.format).toBe('module'); }); }); }); test.suite('supports import assertions', (test) => { test.runIf( nodeSupportsImportAssertions && tsSupportsImportAssertions && tsSupportsResolveJsonModule ); const macro = test.macro((flags: string) => async (t) => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ${flags} ./importJson.ts`, { cwd: resolve(TEST_DIR, 'esm-import-assertions'), } ); expect(err).toBe(null); expect(stdout.trim()).toBe( 'A fuchsia car has 2 seats and the doors are open.\nDone!' ); }); test.suite( 'when node does not require --experimental-json-modules', (test) => { test.runIf(nodeSupportsUnflaggedJsonImports); test('Can import JSON modules with appropriate assertion', macro, ''); } ); test.suite('when node requires --experimental-json-modules', (test) => { test.runIf(!nodeSupportsUnflaggedJsonImports); test( 'Can import JSON using the appropriate flag and assertion', macro, '--experimental-json-modules' ); }); }); test.suite( 'Entrypoint resolution falls back to CommonJS resolver and format', (test) => { test('extensionless entrypoint', async (t) => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./esm-loader-entrypoint-cjs-fallback/extensionless-entrypoint` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Hello world!'); }); test('relies upon CommonJS resolution', async (t) => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./esm-loader-entrypoint-cjs-fallback/relies-upon-cjs-resolution` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Hello world!'); }); test('fails as expected when entrypoint does not exist at all', async (t) => { const { err, stderr } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./esm-loader-entrypoint-cjs-fallback/does-not-exist` ); expect(err).toBeDefined(); expect(stderr).toContain(`Cannot find module `); }); } ); test.suite('spawns child process', async (test) => { test.runIf(nodeSupportsSpawningChildProcess); basic('ts-node-esm executable', () => exec(`${BIN_ESM_PATH} ./esm-child-process/via-flag/index.ts foo bar`) ); basic('ts-node --esm flag', () => exec(`${BIN_PATH} --esm ./esm-child-process/via-flag/index.ts foo bar`) ); basic('ts-node w/tsconfig esm:true', () => exec( `${BIN_PATH} --esm ./esm-child-process/via-tsconfig/index.ts foo bar` ) ); function basic(title: string, cb: () => ExecReturn) { test(title, async (t) => { const { err, stdout, stderr } = await cb(); expect(err).toBe(null); expect(stdout.trim()).toBe('CLI args: foo bar'); expect(stderr).toBe(''); }); } test.suite('esm child process working directory', (test) => { test('should have the correct working directory in the user entry-point', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --esm --cwd ./esm/ index.ts`, { cwd: resolve(TEST_DIR, 'working-dir'), } ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing'); expect(stderr).toBe(''); }); }); test.suite('esm child process and forking', (test) => { test('should be able to fork vanilla NodeJS script', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --esm --cwd ./esm-child-process/ ./process-forking-js/index.ts` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing: from main'); expect(stderr).toBe(''); }); test('should be able to fork TypeScript script', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --esm --cwd ./esm-child-process/ ./process-forking-ts/index.ts` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing: from main'); expect(stderr).toBe(''); }); test('should be able to fork TypeScript script by absolute path', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --esm --cwd ./esm-child-process/ ./process-forking-ts-abs/index.ts` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing: from main'); expect(stderr).toBe(''); }); }); test.suite('parent passes signals to child', (test) => { test.runSerially(); signalTest('SIGINT'); signalTest('SIGTERM'); function signalTest(signal: string) { test(signal, async (t) => { const childP = spawn([ // exec lets us run the shims on windows; spawn does not process.execPath, BIN_PATH_JS, `./esm-child-process/via-tsconfig/sleep.ts`, ]); let code: number | null | undefined = undefined; childP.child.on('exit', (_code) => (code = _code)); await delay(6e3); const codeAfter6Seconds = code; process.kill(childP.child.pid, signal); await delay(2e3); const codeAfter8Seconds = code; const { stdoutP, stderrP } = await childP; const stdout = await stdoutP; const stderr = await stderrP; t.log({ stdout, stderr, codeAfter6Seconds, codeAfter8Seconds, code, }); expect(codeAfter6Seconds).toBeUndefined(); if (process.platform === 'win32') { // Windows doesn't have signals, and node attempts an imperfect facsimile. // In Windows, SIGINT and SIGTERM kill the process immediately with exit // code 1, and the process can't catch or prevent this. expect(codeAfter8Seconds).toBe(1); expect(code).toBe(1); } else { expect(codeAfter8Seconds).toBe(undefined); expect(code).toBe(123); expect(stdout.trim()).toBe( `child registered signal handlers\nchild received signal: ${signal}\nchild exiting` ); } expect(stderr).toBe(''); }); } }); }); }); test.suite('node >= 12.x.x', (test) => { test.runIf(semver.gte(process.version, '12.0.0')); test('throws ERR_REQUIRE_ESM when attempting to require() an ESM script when ESM loader is *not* enabled and node version is >= 12', async () => { // Node versions >= 12 support package.json "type" field and so will throw an error when attempting to load ESM as CJS const { err, stderr } = await exec(`${BIN_PATH} ./index.js`, { cwd: join(TEST_DIR, './esm-err-require-esm'), }); expect(err).not.toBe(null); expect(stderr).toMatch( 'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:' ); }); }); test.suite('node < 12.x.x', (test) => { test.runIf(semver.lt(process.version, '12.0.0')); test('Loads as CommonJS when attempting to require() an ESM script when ESM loader is *not* enabled and node version is < 12', async () => { // Node versions less than 12 do not support package.json "type" field and so will load ESM as CommonJS const { err, stdout } = await exec(`${BIN_PATH} ./index.js`, { cwd: join(TEST_DIR, './esm-err-require-esm'), }); expect(err).toBe(null); expect(stdout).toMatch('CommonJS'); }); }); }); test.suite("Catch unexpected changes to node's loader context", (test) => { // loader context includes import assertions, therefore this test requires support for import assertions test.runIf(nodeSupportsImportAssertions); /* * This does not test ts-node. * Rather, it is meant to alert us to potentially breaking changes in node's * loader API. If node starts returning more or less properties on `context` * objects, we want to know, because it may indicate that our loader code * should be updated to accomodate the new properties, either by proxying them, * modifying them, or suppressing them. */ test('Ensure context passed to loader by node has only expected properties', async (t) => { const { stdout, stderr } = await exec( `node --loader ./esm-loader-context/loader.mjs --experimental-json-modules ./esm-loader-context/index.mjs` ); const rows = stdout.split('\n').filter((v) => v[0] === '{'); expect(rows.length).toBe(14); rows.forEach((row) => { const json = JSON.parse(row) as { resolveContextKeys?: string[]; loadContextKeys?: string; }; if (json.resolveContextKeys) { expect(json.resolveContextKeys).toEqual([ 'conditions', 'importAssertions', 'parentURL', ]); } else if (json.loadContextKeys) { try { expect(json.loadContextKeys).toEqual(['format', 'importAssertions']); } catch (e) { // HACK for https://github.com/TypeStrong/ts-node/issues/1641 if (process.version.includes('nightly')) { expect(json.loadContextKeys).toEqual([ 'format', 'importAssertions', 'parentURL', ]); } else { throw e; } } } else { throw new Error('Unexpected stdout in test.'); } }); }); }); ts-node-10.9.2/src/test/exec-helpers.ts000066400000000000000000000076631453460306300176760ustar00rootroot00000000000000import type { ChildProcess, ExecException, ExecOptions, SpawnOptions, } from 'child_process'; import { exec as childProcessExec, spawn as childProcessSpawn, } from 'child_process'; import { getStream } from './helpers'; import { expect } from './testlib'; export type ExecReturn = Promise & { child: ChildProcess }; export interface ExecResult { stdout: string; stderr: string; err: null | ExecException; child: ChildProcess; } export function createExec>( preBoundOptions?: T ) { /** * Helper to exec a child process. * Returns a Promise and a reference to the child process to suite multiple situations. * Promise resolves with the process's stdout, stderr, and error. */ return function exec( cmd: string, opts?: Pick> & Partial> ): ExecReturn { let child!: ChildProcess; return Object.assign( new Promise((resolve, reject) => { child = childProcessExec( cmd, { ...preBoundOptions, ...opts, }, (err, stdout, stderr) => { resolve({ err, stdout, stderr, child }); } ); }), { child, } ); }; } export type SpawnReturn = Promise & { child: ChildProcess }; export interface SpawnResult { stdoutP: Promise; stderrP: Promise; code: number | null; child: ChildProcess; } export function createSpawn>( preBoundOptions?: T ) { /** * Helper to spawn a child process. * Returns a Promise and a reference to the child process to suite multiple situations. * * Should almost always avoid this helper, and instead use `createExec` / `exec`. `spawn` * may be necessary if you need to avoid `exec`'s intermediate shell. */ return function spawn( cmd: string[], opts?: Pick> & Partial> ) { let child!: ChildProcess; return Object.assign( new Promise((resolve, reject) => { child = childProcessSpawn(cmd[0], cmd.slice(1), { ...preBoundOptions, ...opts, }); const stdoutP = getStream(child.stdout!); const stderrP = getStream(child.stderr!); child.on('exit', (code) => { resolve({ stdoutP, stderrP, code, child }); }); child.on('error', (error) => { reject(error); }); }), { child, } ); }; } const defaultExec = createExec(); export { defaultExec as exec }; export interface ExecTesterOptions { cmd: string; flags?: string; env?: Record; stdin?: string; expectError?: boolean; exec?: typeof defaultExec; } /** * Create a function that launches a CLI command, optionally pipes stdin, optionally sets env vars, * optionally runs a couple baked-in assertions, and returns the results for additional assertions. */ export function createExecTester>( preBoundOptions: T ) { return async function ( options: Pick< ExecTesterOptions, Exclude > & Partial> ) { const { cmd, flags = '', stdin, expectError = false, env, exec = defaultExec, } = { ...preBoundOptions, ...options, }; const execPromise = exec(`${cmd} ${flags}`, { env: { ...process.env, ...env }, }); if (stdin !== undefined) { execPromise.child.stdin!.end(stdin); } const { err, stdout, stderr } = await execPromise; if (expectError) { expect(err).toBeDefined(); } else { expect(err).toBeNull(); } return { stdout, stderr, err }; }; } ts-node-10.9.2/src/test/fs-helpers.ts000066400000000000000000000050361453460306300173520ustar00rootroot00000000000000import { TEST_DIR } from './helpers'; import * as fs from 'fs'; import * as Path from 'path'; // Helpers to describe a bunch of files in a project programmatically, // then write them to disk in a temp directory. export interface File { path: string; content: string; } export interface JsonFile extends File { obj: T; } export interface DirectoryApi { add(file: File): File; addFile(...args: Parameters): File; addJsonFile(...args: Parameters): JsonFile; dir(dirPath: string, cb?: (dir: DirectoryApi) => void): DirectoryApi; } export type ProjectAPI = ReturnType; export function file(path: string, content = '') { return { path, content }; } export function jsonFile(path: string, obj: T) { const file: JsonFile = { path, obj, get content() { return JSON.stringify(obj, null, 2); }, }; return file; } export function tempdirProject(name = '') { const rootTmpDir = `${TEST_DIR}/tmp/`; fs.mkdirSync(rootTmpDir, { recursive: true }); const tmpdir = fs.mkdtempSync(`${TEST_DIR}/tmp/${name}`); return projectInternal(tmpdir); } export type Project = ReturnType; export function project(name: string) { return projectInternal(`${TEST_DIR}/tmp/${name}`); } function projectInternal(cwd: string) { const files: File[] = []; function write() { for (const file of files) { fs.mkdirSync(Path.dirname(file.path), { recursive: true }); fs.writeFileSync(file.path, file.content); } } function rm() { try { fs.rmdirSync(cwd, { recursive: true }); } catch (err) { if (fs.existsSync(cwd)) throw err; } } const { add, addFile, addJsonFile, dir } = createDirectory(cwd); function createDirectory( dirPath: string, cb?: (dir: DirectoryApi) => void ): DirectoryApi { function add(file: File) { file.path = Path.join(dirPath, file.path); files.push(file); return file; } function addFile(...args: Parameters) { return add(file(...args)); } function addJsonFile(...args: Parameters) { return add(jsonFile(...args)) as JsonFile; } function dir(path: string, cb?: (dir: DirectoryApi) => void) { return createDirectory(Path.join(dirPath, path), cb); } const _dir: DirectoryApi = { add, addFile, addJsonFile, dir, }; cb?.(_dir); return _dir; } return { cwd, files: [], dir, add, addFile, addJsonFile, write, rm, }; } ts-node-10.9.2/src/test/helpers.ts000066400000000000000000000301151453460306300167400ustar00rootroot00000000000000import { NodeFS } from '@yarnpkg/fslib'; import { exec as childProcessExec } from 'child_process'; import * as promisify from 'util.promisify'; import { sync as rimrafSync } from 'rimraf'; import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'fs'; import { join, resolve } from 'path'; import * as fs from 'fs'; import { lock } from 'proper-lockfile'; import type { Readable } from 'stream'; /** * types from ts-node under test */ import type * as tsNodeTypes from '../index'; import type _createRequire from 'create-require'; import { has, mapValues, once, sortBy } from 'lodash'; import semver = require('semver'); import type { ExecutionContext } from './testlib'; const createRequire: typeof _createRequire = require('create-require'); export { tsNodeTypes }; //#region Paths export const ROOT_DIR = resolve(__dirname, '../..'); export const DIST_DIR = resolve(__dirname, '..'); export const TEST_DIR = join(__dirname, '../../tests'); export const PROJECT = join(TEST_DIR, 'tsconfig.json'); export const PROJECT_TRANSPILE_ONLY = join( TEST_DIR, 'tsconfig-transpile-only.json' ); export const BIN_PATH = join(TEST_DIR, 'node_modules/.bin/ts-node'); export const BIN_PATH_JS = join(TEST_DIR, 'node_modules/ts-node/dist/bin.js'); export const BIN_SCRIPT_PATH = join( TEST_DIR, 'node_modules/.bin/ts-node-script' ); export const BIN_CWD_PATH = join(TEST_DIR, 'node_modules/.bin/ts-node-cwd'); export const BIN_ESM_PATH = join(TEST_DIR, 'node_modules/.bin/ts-node-esm'); process.chdir(TEST_DIR); //#endregion //#region command lines /** Default `ts-node --project` invocation */ export const CMD_TS_NODE_WITH_PROJECT_FLAG = `"${BIN_PATH}" --project "${PROJECT}"`; /** Default `ts-node --project` invocation with transpile-only */ export const CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG = `"${BIN_PATH}" --project "${PROJECT_TRANSPILE_ONLY}"`; /** Default `ts-node` invocation without `--project` */ export const CMD_TS_NODE_WITHOUT_PROJECT_FLAG = `"${BIN_PATH}"`; export const EXPERIMENTAL_MODULES_FLAG = semver.gte(process.version, '12.17.0') ? '' : '--experimental-modules'; export const CMD_ESM_LOADER_WITHOUT_PROJECT = `node ${EXPERIMENTAL_MODULES_FLAG} --loader ts-node/esm`; //#endregion // `createRequire` does not exist on older node versions export const testsDirRequire = createRequire(join(TEST_DIR, 'index.js')); export const ts = testsDirRequire('typescript'); //#region version checks export const nodeSupportsEsmHooks = semver.gte(process.version, '12.16.0'); export const nodeSupportsSpawningChildProcess = semver.gte( process.version, '12.17.0' ); export const nodeUsesNewHooksApi = semver.gte(process.version, '16.12.0'); // 16.14.0: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md#notable-changes-4 // 17.1.0: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V17.md#2021-11-09-version-1710-current-targos export const nodeSupportsImportAssertions = (semver.gte(process.version, '16.14.0') && semver.lt(process.version, '17.0.0')) || semver.gte(process.version, '17.1.0'); // These versions do not require `--experimental-json-modules` // 16.15.0: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md#2022-04-26-version-16150-gallium-lts-danielleadams // 17.5.0: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V17.md#2022-02-10-version-1750-current-ruyadorno export const nodeSupportsUnflaggedJsonImports = (semver.gte(process.version, '16.15.0') && semver.lt(process.version, '17.0.0')) || semver.gte(process.version, '17.5.0'); // Node 14.13.0 has a bug where it tries to lex CJS files to discover named exports *before* // we transform the code. // In other words, it tries to parse raw TS as CJS and balks at `export const foo =`, expecting to see `exports.foo =` // This lexing only happens when CJS TS is imported from the ESM loader. export const nodeSupportsImportingTransformedCjsFromEsm = semver.gte( process.version, '14.13.1' ); export const tsSupportsResolveJsonModule = semver.gte(ts.version, '2.9.0'); /** Supports tsconfig "extends" >= v3.2.0 */ export const tsSupportsTsconfigInheritanceViaNodePackages = semver.gte( ts.version, '3.2.0' ); /** Supports --showConfig: >= v3.2.0 */ export const tsSupportsShowConfig = semver.gte(ts.version, '3.2.0'); /** Supports module:nodenext and module:node16 as *stable* features */ export const tsSupportsStableNodeNextNode16 = ts.version.startsWith('4.7.') || semver.gte(ts.version, '4.7.0'); // TS 4.5 is first version to understand .cts, .mts, .cjs, and .mjs extensions export const tsSupportsMtsCtsExtensions = semver.gte(ts.version, '4.5.0'); export const tsSupportsImportAssertions = semver.gte(ts.version, '4.5.0'); // TS 4.1 added jsx=react-jsx and react-jsxdev: https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#react-17-jsx-factories export const tsSupportsReact17JsxFactories = semver.gte(ts.version, '4.1.0'); //#endregion export const xfs = new NodeFS(fs); /** Pass to `test.context()` to get access to the ts-node API under test */ export const ctxTsNode = once(async () => { await installTsNode(); const tsNodeUnderTest: typeof tsNodeTypes = testsDirRequire('ts-node'); return { tsNodeUnderTest, }; }); export namespace ctxTsNode { export type Ctx = Awaited>; export type T = ExecutionContext; } //#region install ts-node tarball const ts_node_install_lock = process.env.ts_node_install_lock as string; const lockPath = join(__dirname, ts_node_install_lock); interface InstallationResult { error: string | null; } /** * Pack and install ts-node locally, necessary to test package "exports" * FS locking b/c tests run in separate processes */ export async function installTsNode() { await lockedMemoizedOperation(lockPath, async () => { const totalTries = process.platform === 'win32' ? 5 : 1; let tries = 0; while (true) { try { rimrafSync(join(TEST_DIR, 'node_modules')); await promisify(childProcessExec)(`npm install`, { cwd: TEST_DIR }); const packageLockPath = join(TEST_DIR, 'package-lock.json'); existsSync(packageLockPath) && unlinkSync(packageLockPath); break; } catch (e) { tries++; if (tries >= totalTries) throw e; } } }); } /** * Attempt an operation once across multiple processes, using filesystem locking. * If it was executed already by another process, and it errored, throw the same error message. */ async function lockedMemoizedOperation( lockPath: string, operation: () => Promise ) { const releaseLock = await lock(lockPath, { realpath: false, stale: 120e3, retries: { retries: 120, maxTimeout: 1000, }, }); try { const operationHappened = existsSync(lockPath); if (operationHappened) { const result: InstallationResult = JSON.parse( readFileSync(lockPath, 'utf8') ); if (result.error) throw result.error; } else { const result: InstallationResult = { error: null }; try { await operation(); } catch (e) { result.error = `${e}`; throw e; } finally { writeFileSync(lockPath, JSON.stringify(result)); } } } finally { releaseLock(); } } //#endregion /** * Get a stream into a string. * Will resolve early if */ export function getStream(stream: Readable, waitForPattern?: string | RegExp) { let resolve: (value: string) => void; const promise = new Promise((res) => { resolve = res; }); const received: Buffer[] = []; let combinedBuffer: Buffer = Buffer.concat([]); let combinedString: string = ''; stream.on('data', (data) => { received.push(data); combine(); if ( (typeof waitForPattern === 'string' && combinedString.indexOf(waitForPattern) >= 0) || (waitForPattern instanceof RegExp && combinedString.match(waitForPattern)) ) resolve(combinedString); combinedBuffer = Buffer.concat(received); }); stream.on('end', () => { resolve(combinedString); }); return promise; function combine() { combinedBuffer = Buffer.concat(received); combinedString = combinedBuffer.toString('utf8'); } } //#region Reset node environment const defaultRequireExtensions = captureObjectState(require.extensions); // Avoid node deprecation warning for accessing _channel const defaultProcess = captureObjectState(process, ['_channel']); const defaultModule = captureObjectState(require('module')); const defaultError = captureObjectState(Error); const defaultGlobal = captureObjectState(global); /** * Undo all of ts-node & co's installed hooks, resetting the node environment to default * so we can run multiple test cases which `.register()` ts-node. * * Must also play nice with `nyc`'s environmental mutations. */ export function resetNodeEnvironment() { const sms = require('@cspotcode/source-map-support') as typeof import('@cspotcode/source-map-support'); // We must uninstall so that it resets its internal state; otherwise it won't know it needs to reinstall in the next test. sms.uninstall(); // Must remove handlers to avoid a memory leak sms.resetRetrieveHandlers(); // Modified by ts-node hooks resetObject( require.extensions, defaultRequireExtensions, undefined, undefined, undefined, true ); // ts-node attaches a property when it registers an instance // source-map-support monkey-patches the emit function // Avoid node deprecation warnings for setting process.config or accessing _channel resetObject(process, defaultProcess, undefined, ['_channel'], ['config']); // source-map-support swaps out the prepareStackTrace function resetObject(Error, defaultError); // _resolveFilename et.al. are modified by ts-node, tsconfig-paths, source-map-support, yarn, maybe other things? resetObject(require('module'), defaultModule, undefined, ['wrap', 'wrapper']); // May be modified by REPL tests, since the REPL sets globals. // Avoid deleting nyc's coverage data. resetObject(global, defaultGlobal, ['__coverage__']); // Reset our ESM hooks process.__test_setloader__?.(undefined); } function captureObjectState(object: any, avoidGetters: string[] = []) { const descriptors = Object.getOwnPropertyDescriptors(object); const values = mapValues(descriptors, (_d, key) => { if (avoidGetters.includes(key)) return descriptors[key].value; return object[key]; }); return { descriptors, values, }; } // Redefine all property descriptors and delete any new properties function resetObject( object: any, state: ReturnType, doNotDeleteTheseKeys: string[] = [], doNotSetTheseKeys: true | string[] = [], avoidSetterIfUnchanged: string[] = [], reorderProperties = false ) { const currentDescriptors = Object.getOwnPropertyDescriptors(object); for (const key of Object.keys(currentDescriptors)) { if (doNotDeleteTheseKeys.includes(key)) continue; if (has(state.descriptors, key)) continue; delete object[key]; } // Trigger nyc's setter functions for (const [key, value] of Object.entries(state.values)) { try { if (doNotSetTheseKeys === true || doNotSetTheseKeys.includes(key)) continue; if (avoidSetterIfUnchanged.includes(key) && object[key] === value) continue; state.descriptors[key].set?.call(object, value); } catch {} } // Reset descriptors Object.defineProperties(object, state.descriptors); if (reorderProperties) { // Delete and re-define each property so that they are in original order const originalOrder = Object.keys(state.descriptors); const properties = Object.getOwnPropertyDescriptors(object); const sortedKeys = sortBy(Object.keys(properties), (name) => originalOrder.includes(name) ? originalOrder.indexOf(name) : 999 ); for (const key of sortedKeys) { delete object[key]; Object.defineProperty(object, key, properties[key]); } } } //#endregion export const delay = promisify(setTimeout); /** Essentially Array:includes, but with tweaked types for checks on enums */ export function isOneOf(value: V, arrayOfPossibilities: ReadonlyArray) { return arrayOfPossibilities.includes(value as any); } ts-node-10.9.2/src/test/index.spec.ts000066400000000000000000001223271453460306300173450ustar00rootroot00000000000000import { context, ExecutionContext } from './testlib'; import * as expect from 'expect'; import { join, resolve, sep as pathSep } from 'path'; import { tmpdir } from 'os'; import semver = require('semver'); import { BIN_PATH_JS, CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG, nodeSupportsEsmHooks, nodeSupportsSpawningChildProcess, ts, tsSupportsMtsCtsExtensions, tsSupportsShowConfig, tsSupportsStableNodeNextNode16, tsSupportsTsconfigInheritanceViaNodePackages, } from './helpers'; import { lstatSync, mkdtempSync } from 'fs'; import { npath } from '@yarnpkg/fslib'; import type _createRequire from 'create-require'; import { createExec } from './exec-helpers'; import { BIN_CWD_PATH, BIN_PATH, BIN_SCRIPT_PATH, DIST_DIR, ROOT_DIR, TEST_DIR, testsDirRequire, tsNodeTypes, xfs, ctxTsNode, CMD_TS_NODE_WITH_PROJECT_FLAG, CMD_TS_NODE_WITHOUT_PROJECT_FLAG, CMD_ESM_LOADER_WITHOUT_PROJECT, } from './helpers'; import type { CreateOptions } from '..'; const exec = createExec({ cwd: TEST_DIR, }); const test = context(ctxTsNode); test.suite('ts-node', (test) => { test('should export the correct version', (t) => { expect(t.context.tsNodeUnderTest.VERSION).toBe( require('../../package.json').version ); }); test('should export all CJS entrypoints', () => { // Ensure our package.json "exports" declaration allows `require()`ing all our entrypoints // https://github.com/TypeStrong/ts-node/pull/1026 testsDirRequire.resolve('ts-node'); // only reliably way to ask node for the root path of a dependency is Path.resolve(require.resolve('ts-node/package'), '..') testsDirRequire.resolve('ts-node/package'); testsDirRequire.resolve('ts-node/package.json'); // All bin entrypoints for people who need to augment our CLI: `node -r otherstuff ./node_modules/ts-node/dist/bin` testsDirRequire.resolve('ts-node/dist/bin'); testsDirRequire.resolve('ts-node/dist/bin.js'); testsDirRequire.resolve('ts-node/dist/bin-transpile'); testsDirRequire.resolve('ts-node/dist/bin-transpile.js'); testsDirRequire.resolve('ts-node/dist/bin-script'); testsDirRequire.resolve('ts-node/dist/bin-script.js'); testsDirRequire.resolve('ts-node/dist/bin-cwd'); testsDirRequire.resolve('ts-node/dist/bin-cwd.js'); // Must be `require()`able obviously testsDirRequire.resolve('ts-node/register'); testsDirRequire.resolve('ts-node/register/files'); testsDirRequire.resolve('ts-node/register/transpile-only'); testsDirRequire.resolve('ts-node/register/type-check'); if (semver.gte(process.version, '12.17.0')) { // `node --loader ts-node/esm` testsDirRequire.resolve('ts-node/esm'); testsDirRequire.resolve('ts-node/esm.mjs'); testsDirRequire.resolve('ts-node/esm/transpile-only'); testsDirRequire.resolve('ts-node/esm/transpile-only.mjs'); } testsDirRequire.resolve('ts-node/transpilers/swc'); testsDirRequire.resolve('ts-node/transpilers/swc-experimental'); testsDirRequire.resolve('ts-node/node10/tsconfig.json'); testsDirRequire.resolve('ts-node/node12/tsconfig.json'); testsDirRequire.resolve('ts-node/node14/tsconfig.json'); testsDirRequire.resolve('ts-node/node16/tsconfig.json'); }); test('should not load typescript outside of loadConfig', async () => { const { err, stdout } = await exec( `node -e "require('ts-node'); console.dir(Object.keys(require.cache).filter(k => k.includes('node_modules/typescript')).length)"` ); expect(err).toBe(null); expect(stdout).toBe('0\n'); }); test.suite('cli', (test) => { test('should execute cli', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} hello-world` ); expect(err).toBe(null); expect(stdout).toBe('Hello, world!\n'); }); test('shows usage via --help', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --help` ); expect(err).toBe(null); expect(stdout).toMatch(/Usage: ts-node /); }); test('shows version via -v', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} -v` ); expect(err).toBe(null); expect(stdout.trim()).toBe( 'v' + testsDirRequire('ts-node/package').version ); }); test('shows version of compiler via -vv', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} -vv` ); expect(err).toBe(null); expect(stdout.trim()).toBe( `ts-node v${testsDirRequire('ts-node/package').version}\n` + `node ${process.version}\n` + `compiler v${testsDirRequire('typescript/package').version}` ); }); test('should register via cli', async () => { const { err, stdout } = await exec( `node -r ts-node/register hello-world.ts`, { cwd: TEST_DIR, } ); expect(err).toBe(null); expect(stdout).toBe('Hello, world!\n'); }); test('should execute cli with absolute path', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} "${join( TEST_DIR, 'hello-world' )}"` ); expect(err).toBe(null); expect(stdout).toBe('Hello, world!\n'); }); test('should print scripts', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} -pe "import { example } from './complex/index';example()"` ); expect(err).toBe(null); expect(stdout).toBe('example\n'); }); test("should expose ts-node Service as a symbol property on Node's `process` object", async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} env` ); expect(err).toBe(null); expect(stdout).toBe('object\n'); }); test('should allow js', async () => { const { err, stdout } = await exec( [ CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG, '-O "{\\"allowJs\\":true}"', '-pe "import { main } from \'./allow-js/run\';main()"', ].join(' ') ); expect(err).toBe(null); expect(stdout).toBe('hello world\n'); }); test('should include jsx when `allow-js` true', async () => { const { err, stdout } = await exec( [ CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG, '-O "{\\"allowJs\\":true}"', '-pe "import { Foo2 } from \'./allow-js/with-jsx\'; Foo2.sayHi()"', ].join(' ') ); expect(err).toBe(null); expect(stdout).toBe('hello world\n'); }); test.suite('should support cts when module = CommonJS', (test) => { test.runIf(tsSupportsMtsCtsExtensions); test('test', async (t) => { const { err, stdout } = await exec( [ CMD_TS_NODE_WITHOUT_PROJECT_FLAG, '-pe "import { main } from \'./index.cjs\';main()"', ].join(' '), { cwd: join(TEST_DIR, 'ts45-ext/ext-cts'), } ); expect(err).toBe(null); expect(stdout).toBe('hello world\n'); }); }); test.suite('should support mts when module = ESNext', (test) => { test.runIf( nodeSupportsSpawningChildProcess && tsSupportsMtsCtsExtensions ); test('test', async () => { const { err, stdout } = await exec( [CMD_TS_NODE_WITHOUT_PROJECT_FLAG, './entrypoint.mjs'].join(' '), { cwd: join(TEST_DIR, 'ts45-ext/ext-mts'), } ); expect(err).toBe(null); expect(stdout).toBe('hello world\n'); }); }); test('should eval code', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} -e "import * as m from './module';console.log(m.example('test'))"` ); expect(err).toBe(null); expect(stdout).toBe('TEST\n'); }); test('should import empty files', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} -e "import './empty'"` ); expect(err).toBe(null); expect(stdout).toBe(''); }); test('should throw typechecking errors', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} -e "import * as m from './module';console.log(m.example(123))"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch( new RegExp( "TS2345: Argument of type '(?:number|123)' " + "is not assignable to parameter of type 'string'\\." ) ); }); test('should be able to ignore diagnostic', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --ignore-diagnostics 2345 -e "import * as m from './module';console.log(m.example(123))"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch( /TypeError: (?:(?:undefined|foo\.toUpperCase) is not a function|.*has no method \'toUpperCase\')/ ); }); test('should work with source maps', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} "throw error"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch( [ `${join(TEST_DIR, 'throw error.ts')}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', 'Error: this is a demo', ].join('\n') ); }); test('should work with source maps in --transpile-only mode', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --transpile-only "throw error"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch( [ `${join(TEST_DIR, 'throw error.ts')}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', 'Error: this is a demo', ].join('\n') ); }); test('eval should work with source maps', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} -pe "import './throw error'"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch( [ `${join(TEST_DIR, 'throw error.ts')}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', ].join('\n') ); }); test('should support transpile only mode', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --transpile-only -pe "x"` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch('ReferenceError: x is not defined'); }); test('should throw error even in transpileOnly mode', async () => { const { err } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --transpile-only -pe "console."` ); if (err === null) { throw new Error('Command was expected to fail, but it succeeded.'); } expect(err.message).toMatch('error TS1003: Identifier expected'); }); for (const flavor of [ '--transpiler ts-node/transpilers/swc transpile-only-swc', '--transpiler ts-node/transpilers/swc-experimental transpile-only-swc', '--swc transpile-only-swc', 'transpile-only-swc-via-tsconfig', 'transpile-only-swc-shorthand-via-tsconfig', ]) { test(`should support swc and third-party transpilers: ${flavor}`, async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} ${flavor}`, { env: { ...process.env, NODE_OPTIONS: `${ process.env.NODE_OPTIONS || '' } --require ${require.resolve('../../tests/spy-swc-transpiler')}`, }, } ); expect(err).toBe(null); expect(stdout).toMatch( 'Hello World! swc transpiler invocation count: 1\n' ); }); } test.suite('should support `traceResolution` compiler option', (test) => { test('prints traces before running code when enabled', async () => { const { err, stdout } = await exec( `${BIN_PATH} --compiler-options="{ \\"traceResolution\\": true }" -e "console.log('ok')"` ); expect(err).toBeNull(); expect(stdout).toContain('======== Resolving module'); expect(stdout.endsWith('ok\n')).toBe(true); }); test('does NOT print traces when not enabled', async () => { const { err, stdout } = await exec( `${BIN_PATH} -e "console.log('ok')"` ); expect(err).toBeNull(); expect(stdout).not.toContain('======== Resolving module'); expect(stdout.endsWith('ok\n')).toBe(true); }); }); if (nodeSupportsEsmHooks) { test('swc transpiler supports native ESM emit', async () => { const { err, stdout } = await exec( `${CMD_ESM_LOADER_WITHOUT_PROJECT} ./index.ts`, { cwd: resolve(TEST_DIR, 'transpile-only-swc-native-esm'), } ); expect(err).toBe(null); expect(stdout).toMatch('Hello file://'); }); } test('should pipe into `ts-node` and evaluate', async () => { const execPromise = exec(CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG); execPromise.child.stdin!.end("console.log('hello')"); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe('hello\n'); }); test('should pipe into `ts-node`', async () => { const execPromise = exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} -p` ); execPromise.child.stdin!.end('true'); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe('true\n'); }); test('should pipe into an eval script', async () => { const execPromise = exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --transpile-only -pe "process.stdin.isTTY"` ); execPromise.child.stdin!.end('true'); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe('undefined\n'); }); test('should support require flags', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} -r ./hello-world -pe "console.log('success')"` ); expect(err).toBe(null); expect(stdout).toBe('Hello, world!\nsuccess\nundefined\n'); }); test('should support require from node modules', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} -r typescript -e "console.log('success')"` ); expect(err).toBe(null); expect(stdout).toBe('success\n'); }); test('should use source maps with react tsx', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} "throw error react tsx.tsx"` ); expect(err).not.toBe(null); expect(err!.message).toMatch( [ `${join(TEST_DIR, './throw error react tsx.tsx')}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', 'Error: this is a demo', ].join('\n') ); }); test('should use source maps with react tsx in --transpile-only mode', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --transpile-only "throw error react tsx.tsx"` ); expect(err).not.toBe(null); expect(err!.message).toMatch( [ `${join(TEST_DIR, './throw error react tsx.tsx')}:100`, " bar() { throw new Error('this is a demo'); }", ' ^', 'Error: this is a demo', ].join('\n') ); }); test('should allow custom typings', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} custom-types` ); // This error comes from *node*, meaning TypeScript respected the custom types (good) but *node* could not find the non-existent module (expected) expect(err?.message).toMatch( /Error: Cannot find module 'does-not-exist'/ ); }); test('should import js before ts by default', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} import-order/compiled` ); expect(err).toBe(null); expect(stdout).toBe('Hello, JavaScript!\n'); }); test('should import ts before js when --prefer-ts-exts flag is present', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} --prefer-ts-exts import-order/compiled` ); expect(err).toBe(null); expect(stdout).toBe('Hello, TypeScript!\n'); }); test('should import ts before js when TS_NODE_PREFER_TS_EXTS env is present', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} import-order/compiled`, { env: { ...process.env, TS_NODE_PREFER_TS_EXTS: 'true' }, } ); expect(err).toBe(null); expect(stdout).toBe('Hello, TypeScript!\n'); }); test('should ignore .d.ts files', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG} import-order/importer` ); expect(err).toBe(null); expect(stdout).toBe('Hello, World!\n'); }); test.suite('issue #884', (test) => { // TODO disabled because it consistently fails on Windows on TS 2.7 test.skipIf( process.platform === 'win32' && semver.satisfies(ts.version, '2.7') ); test('should compile', async (t) => { const { err, stdout } = await exec( `"${BIN_PATH}" --project issue-884/tsconfig.json issue-884` ); expect(err).toBe(null); expect(stdout).toBe(''); }); }); test.suite('issue #986', (test) => { test('should not compile', async () => { const { err, stdout, stderr } = await exec( `"${BIN_PATH}" --project issue-986/tsconfig.json issue-986` ); expect(err).not.toBe(null); expect(stderr).toMatch("Cannot find name 'TEST'"); // TypeScript error. expect(stdout).toBe(''); }); test('should compile with `--files`', async () => { const { err, stdout, stderr } = await exec( `"${BIN_PATH}" --files --project issue-986/tsconfig.json issue-986` ); expect(err).not.toBe(null); expect(stderr).toMatch('ReferenceError: TEST is not defined'); // Runtime error. expect(stdout).toBe(''); }); }); test('should locate tsconfig relative to entry-point by default', async () => { const { err, stdout } = await exec(`${BIN_PATH} ../a/index`, { cwd: join(TEST_DIR, 'cwd-and-script-mode/b'), }); expect(err).toBe(null); expect(stdout).toMatch(/plugin-a/); }); test('should locate tsconfig relative to entry-point via ts-node-script', async () => { const { err, stdout } = await exec(`${BIN_SCRIPT_PATH} ../a/index`, { cwd: join(TEST_DIR, 'cwd-and-script-mode/b'), }); expect(err).toBe(null); expect(stdout).toMatch(/plugin-a/); }); test('should locate tsconfig relative to entry-point with --script-mode', async () => { const { err, stdout } = await exec( `${BIN_PATH} --script-mode ../a/index`, { cwd: join(TEST_DIR, 'cwd-and-script-mode/b'), } ); expect(err).toBe(null); expect(stdout).toMatch(/plugin-a/); }); test('should locate tsconfig relative to cwd via ts-node-cwd', async () => { const { err, stdout } = await exec(`${BIN_CWD_PATH} ../a/index`, { cwd: join(TEST_DIR, 'cwd-and-script-mode/b'), }); expect(err).toBe(null); expect(stdout).toMatch(/plugin-b/); }); test('should locate tsconfig relative to cwd in --cwd-mode', async () => { const { err, stdout } = await exec(`${BIN_PATH} --cwd-mode ../a/index`, { cwd: join(TEST_DIR, 'cwd-and-script-mode/b'), }); expect(err).toBe(null); expect(stdout).toMatch(/plugin-b/); }); test('should locate tsconfig relative to realpath, not symlink, when entrypoint is a symlink', async (t) => { if ( lstatSync( join(TEST_DIR, 'main-realpath/symlink/symlink.tsx') ).isSymbolicLink() ) { const { err, stdout } = await exec( `${BIN_PATH} main-realpath/symlink/symlink.tsx` ); expect(err).toBe(null); expect(stdout).toBe(''); } else { t.log('Skipping'); return; } }); test('should have the correct working directory in the user entry-point', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --cwd ./cjs index.ts`, { cwd: resolve(TEST_DIR, 'working-dir'), } ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing'); expect(stderr).toBe(''); }); // Disabled due to bug: // --cwd is passed to forked children when not using --esm, erroneously affects their entrypoint resolution. // tracked/fixed by either https://github.com/TypeStrong/ts-node/issues/1834 // or https://github.com/TypeStrong/ts-node/issues/1831 test.skip('should be able to fork into a nested TypeScript script with a modified working directory', async () => { const { err, stdout, stderr } = await exec( `${BIN_PATH} --cwd ./working-dir/forking/ index.ts` ); expect(err).toBe(null); expect(stdout.trim()).toBe('Passing: from main'); expect(stderr).toBe(''); }); test.suite('should read ts-node options from tsconfig.json', (test) => { const BIN_EXEC = `"${BIN_PATH}" --project tsconfig-options/tsconfig.json`; test('should override compiler options from env', async () => { const { err, stdout } = await exec( `${BIN_EXEC} tsconfig-options/log-options1.js`, { env: { ...process.env, TS_NODE_COMPILER_OPTIONS: '{"typeRoots": ["env-typeroots"]}', }, } ); expect(err).toBe(null); const { config } = JSON.parse(stdout); expect(config.options.typeRoots).toEqual([ join(TEST_DIR, './tsconfig-options/env-typeroots').replace( /\\/g, '/' ), ]); }); test('should use options from `tsconfig.json`', async () => { const { err, stdout } = await exec( `${BIN_EXEC} tsconfig-options/log-options1.js` ); expect(err).toBe(null); const { options, config } = JSON.parse(stdout); expect(config.options.typeRoots).toEqual([ join(TEST_DIR, './tsconfig-options/tsconfig-typeroots').replace( /\\/g, '/' ), ]); expect(config.options.types).toEqual(['tsconfig-tsnode-types']); expect(options.pretty).toBe(undefined); expect(options.skipIgnore).toBe(false); expect(options.transpileOnly).toBe(true); expect(options.require).toEqual([ join(TEST_DIR, './tsconfig-options/required1.js'), ]); }); test('should ignore empty strings in the array options', async () => { const { err, stdout } = await exec( `${BIN_EXEC} tsconfig-options/log-options1.js`, { env: { ...process.env, TS_NODE_IGNORE: '', }, } ); expect(err).toBe(null); const { options } = JSON.parse(stdout); expect(options.ignore).toEqual([]); }); test('should have flags override / merge with `tsconfig.json`', async () => { const { err, stdout } = await exec( `${BIN_EXEC} --skip-ignore --compiler-options "{\\"types\\":[\\"flags-types\\"]}" --require ./tsconfig-options/required2.js tsconfig-options/log-options2.js` ); expect(err).toBe(null); const { options, config } = JSON.parse(stdout); expect(config.options.typeRoots).toEqual([ join(TEST_DIR, './tsconfig-options/tsconfig-typeroots').replace( /\\/g, '/' ), ]); expect(config.options.types).toEqual(['flags-types']); expect(options.pretty).toBe(undefined); expect(options.skipIgnore).toBe(true); expect(options.transpileOnly).toBe(true); expect(options.require).toEqual([ join(TEST_DIR, './tsconfig-options/required1.js'), './tsconfig-options/required2.js', ]); }); test('should have `tsconfig.json` override environment', async () => { const { err, stdout } = await exec( `${BIN_EXEC} tsconfig-options/log-options1.js`, { env: { ...process.env, TS_NODE_PRETTY: 'true', TS_NODE_SKIP_IGNORE: 'true', }, } ); expect(err).toBe(null); const { options, config } = JSON.parse(stdout); expect(config.options.typeRoots).toEqual([ join(TEST_DIR, './tsconfig-options/tsconfig-typeroots').replace( /\\/g, '/' ), ]); expect(config.options.types).toEqual(['tsconfig-tsnode-types']); expect(options.pretty).toBe(true); expect(options.skipIgnore).toBe(false); expect(options.transpileOnly).toBe(true); expect(options.require).toEqual([ join(TEST_DIR, './tsconfig-options/required1.js'), ]); }); if (tsSupportsTsconfigInheritanceViaNodePackages) { test('should pull ts-node options from extended `tsconfig.json`', async () => { const { err, stdout } = await exec( `${BIN_PATH} --show-config --project ./tsconfig-extends/tsconfig.json` ); expect(err).toBe(null); const config = JSON.parse(stdout); expect(config['ts-node'].require).toEqual([ resolve(TEST_DIR, 'tsconfig-extends/other/require-hook.js'), ]); expect(config['ts-node'].scopeDir).toBe( resolve(TEST_DIR, 'tsconfig-extends/other/scopedir') ); expect(config['ts-node'].preferTsExts).toBe(true); }); } }); test.suite( 'should use implicit @tsconfig/bases config when one is not loaded from disk', ({ context }) => { const test = context(async (t) => ({ tempDir: mkdtempSync(join(tmpdir(), 'ts-node-spec')), })); if ( semver.gte(ts.version, '3.5.0') && semver.gte(process.versions.node, '14.0.0') ) { const libAndTarget = semver.gte(process.versions.node, '16.0.0') ? 'es2021' : 'es2020'; test('implicitly uses @tsconfig/node14 or @tsconfig/node16 compilerOptions when both TS and node versions support it', async (t) => { // node14 and node16 configs are identical, hence the "or" const { context: { tempDir }, } = t; const { err: err1, stdout: stdout1, stderr: stderr1, } = await exec(`${BIN_PATH} --showConfig`, { cwd: tempDir }); expect(err1).toBe(null); t.like(JSON.parse(stdout1), { compilerOptions: { target: libAndTarget, lib: [libAndTarget], }, }); const { err: err2, stdout: stdout2, stderr: stderr2, } = await exec(`${BIN_PATH} -pe 10n`, { cwd: tempDir }); expect(err2).toBe(null); expect(stdout2).toBe('10n\n'); }); } else { test('implicitly uses @tsconfig/* lower than node14 (node12) when either TS or node versions do not support @tsconfig/node14', async ({ context: { tempDir }, }) => { const { err, stdout, stderr } = await exec(`${BIN_PATH} -pe 10n`, { cwd: tempDir, }); expect(err).not.toBe(null); expect(stderr).toMatch( /BigInt literals are not available when targeting lower than|error TS2304: Cannot find name 'n'/ ); }); } test('implicitly loads @types/node even when not installed within local directory', async ({ context: { tempDir }, }) => { const { err, stdout, stderr } = await exec( `${BIN_PATH} -pe process.env.foo`, { cwd: tempDir, env: { ...process.env, foo: 'hello world' }, } ); expect(err).toBe(null); expect(stdout).toBe('hello world\n'); }); test('implicitly loads local @types/node', async ({ context: { tempDir }, }) => { await xfs.copyPromise( npath.toPortablePath(tempDir), npath.toPortablePath(join(TEST_DIR, 'local-types-node')) ); const { err, stdout, stderr } = await exec( `${BIN_PATH} -pe process.env.foo`, { cwd: tempDir, env: { ...process.env, foo: 'hello world' }, } ); expect(err).not.toBe(null); expect(stderr).toMatch( "Property 'env' does not exist on type 'LocalNodeTypes_Process'" ); }); } ); test.suite( 'should bundle @tsconfig/bases to be used in your own tsconfigs', (test) => { test.runIf(tsSupportsTsconfigInheritanceViaNodePackages); const macro = test.macro((nodeVersion: string) => async (t) => { const config = require(`@tsconfig/${nodeVersion}/tsconfig.json`); const { err, stdout, stderr } = await exec( `${BIN_PATH} --showConfig -e 10n`, { cwd: join(TEST_DIR, 'tsconfig-bases', nodeVersion), } ); expect(err).toBe(null); t.like(JSON.parse(stdout), { compilerOptions: { target: config.compilerOptions.target, lib: config.compilerOptions.lib, }, }); }); test(`ts-node/node10/tsconfig.json`, macro, 'node10'); test(`ts-node/node12/tsconfig.json`, macro, 'node12'); test(`ts-node/node14/tsconfig.json`, macro, 'node14'); test(`ts-node/node16/tsconfig.json`, macro, 'node16'); } ); test.suite('compiler host', (test) => { test('should execute cli', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --compiler-host hello-world` ); expect(err).toBe(null); expect(stdout).toBe('Hello, world!\n'); }); }); test('should transpile files inside a node_modules directory when not ignored', async () => { const { err, stdout, stderr } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} from-node-modules/from-node-modules` ); if (err) throw new Error( `Unexpected error: ${err}\nstdout:\n${stdout}\nstderr:\n${stderr}` ); expect(JSON.parse(stdout)).toEqual({ external: { tsmri: { name: 'typescript-module-required-internally' }, jsmri: { name: 'javascript-module-required-internally' }, tsmii: { name: 'typescript-module-imported-internally' }, jsmii: { name: 'javascript-module-imported-internally' }, }, tsmie: { name: 'typescript-module-imported-externally' }, jsmie: { name: 'javascript-module-imported-externally' }, tsmre: { name: 'typescript-module-required-externally' }, jsmre: { name: 'javascript-module-required-externally' }, }); }); test.suite('should respect maxNodeModulesJsDepth', (test) => { test('for unscoped modules', async () => { const { err, stdout, stderr } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} maxnodemodulesjsdepth` ); expect(err).not.toBe(null); expect(stderr.replace(/\r\n/g, '\n')).toMatch( 'TSError: ⨯ Unable to compile TypeScript:\n' + "maxnodemodulesjsdepth/other.ts(4,7): error TS2322: Type 'string' is not assignable to type 'boolean'.\n" + '\n' ); }); test('for @scoped modules', async () => { const { err, stdout, stderr } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} maxnodemodulesjsdepth-scoped` ); expect(err).not.toBe(null); expect(stderr.replace(/\r\n/g, '\n')).toMatch( 'TSError: ⨯ Unable to compile TypeScript:\n' + "maxnodemodulesjsdepth-scoped/other.ts(7,7): error TS2322: Type 'string' is not assignable to type 'boolean'.\n" + '\n' ); }); }); if (tsSupportsShowConfig) { test('--showConfig should log resolved configuration', async (t) => { function native(path: string) { return path.replace(/\/|\\/g, pathSep); } function posix(path: string) { return path.replace(/\/|\\/g, '/'); } const { err, stdout } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --showConfig` ); expect(err).toBe(null); t.is( stdout, JSON.stringify( { 'ts-node': { cwd: native(`${ROOT_DIR}/tests`), projectSearchDir: native(`${ROOT_DIR}/tests`), project: native(`${ROOT_DIR}/tests/tsconfig.json`), }, compilerOptions: { target: 'es6', jsx: 'react', noEmit: false, strict: true, typeRoots: [ posix(`${ROOT_DIR}/tests/typings`), posix(`${ROOT_DIR}/node_modules/@types`), ], sourceMap: true, inlineSourceMap: false, inlineSources: true, declaration: false, outDir: './.ts-node', module: 'commonjs', }, }, null, 2 ) + '\n' ); }); } else { test('--show-config should log error message when used with old typescript versions', async (t) => { const { err, stderr } = await exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --showConfig` ); expect(err).not.toBe(null); expect(stderr).toMatch('Error: --showConfig requires'); }); } test('should support compiler scope specified via tsconfig.json', async (t) => { const { err, stderr, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --project ./scope/c/config/tsconfig.json ./scope/c/index.js` ); expect(err).toBe(null); expect(stdout).toBe(`value\nFailures: 0\n`); }); }); test.suite('create', ({ context }) => { const test = context(async (t) => { return { service: t.context.tsNodeUnderTest.create({ compilerOptions: { target: 'es5' }, skipProject: true, }), }; }); test('should create generic compiler instances', ({ context: { service }, }) => { const output = service.compile('const x = 10', 'test.ts'); expect(output).toMatch('var x = 10;'); }); test.suite('should get type information', (test) => { test('given position of identifier', ({ context: { service } }) => { expect( service.getTypeInfo('/**jsdoc here*/const x = 10', 'test.ts', 21) ).toEqual({ comment: 'jsdoc here', name: 'const x: 10', }); }); test('given position that does not point to an identifier', ({ context: { service }, }) => { expect( service.getTypeInfo('/**jsdoc here*/const x = 10', 'test.ts', 0) ).toEqual({ comment: '', name: '', }); }); }); }); test.suite('issue #1098', (test) => { function testAllowedExtensions( t: ExecutionContext, compilerOptions: CreateOptions['compilerOptions'], allowed: string[] ) { const disallowed = allExtensions.filter((ext) => !allowed.includes(ext)); const { ignored } = t.context.tsNodeUnderTest.create({ compilerOptions, skipProject: true, }); for (const ext of allowed) { t.log(`Testing that ${ext} files are allowed`); expect(ignored(join(DIST_DIR, `index${ext}`))).toBe(false); } for (const ext of disallowed) { t.log(`Testing that ${ext} files are ignored`); expect(ignored(join(DIST_DIR, `index${ext}`))).toBe(true); } } const allExtensions = [ '.ts', '.js', '.d.ts', '.mts', '.cts', '.d.mts', '.d.cts', '.mjs', '.cjs', '.tsx', '.jsx', '.xyz', '', ]; const mtsCts = tsSupportsMtsCtsExtensions ? ['.mts', '.cts', '.d.mts', '.d.cts'] : []; const mjsCjs = tsSupportsMtsCtsExtensions ? ['.mjs', '.cjs'] : []; test('correctly filters file extensions from the compiler when allowJs=false and jsx=false', (t) => { testAllowedExtensions(t, {}, ['.ts', '.d.ts', ...mtsCts]); }); test('correctly filters file extensions from the compiler when allowJs=true and jsx=false', (t) => { testAllowedExtensions(t, { allowJs: true }, [ '.ts', '.js', '.d.ts', ...mtsCts, ...mjsCjs, ]); }); test('correctly filters file extensions from the compiler when allowJs=false and jsx=true', (t) => { testAllowedExtensions(t, { allowJs: false, jsx: 'preserve' }, [ '.ts', '.tsx', '.d.ts', ...mtsCts, ]); }); test('correctly filters file extensions from the compiler when allowJs=true and jsx=true', (t) => { testAllowedExtensions(t, { allowJs: true, jsx: 'preserve' }, [ '.ts', '.tsx', '.js', '.jsx', '.d.ts', ...mtsCts, ...mjsCjs, ]); }); }); }); test('Falls back to transpileOnly when ts compiler returns emitSkipped', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --project tsconfig.json ./outside-rootDir/foo.js`, { cwd: join(TEST_DIR, 'emit-skipped-fallback'), } ); expect(err).toBe(null); expect(stdout).toBe('foo\n'); }); test.suite('node environment', (test) => { test.suite('Sets argv and execArgv correctly in forked processes', (test) => { forkTest(`node --no-warnings ${BIN_PATH_JS}`, BIN_PATH_JS, '--no-warnings'); forkTest( `${BIN_PATH}`, process.platform === 'win32' ? BIN_PATH_JS : BIN_PATH ); function forkTest( command: string, expectParentArgv0: string, nodeFlag?: string ) { test(command, async (t) => { const { err, stderr, stdout } = await exec( `${command} --skipIgnore ./recursive-fork/index.ts argv2` ); expect(err).toBeNull(); expect(stderr).toBe(''); const generations = stdout.split('\n'); const expectation = { execArgv: [nodeFlag, BIN_PATH_JS, '--skipIgnore'].filter((v) => v), argv: [ // Note: argv[0] is *always* BIN_PATH_JS in child & grandchild expectParentArgv0, resolve(TEST_DIR, 'recursive-fork/index.ts'), 'argv2', ], }; expect(JSON.parse(generations[0])).toMatchObject(expectation); expectation.argv[0] = BIN_PATH_JS; expect(JSON.parse(generations[1])).toMatchObject(expectation); expect(JSON.parse(generations[2])).toMatchObject(expectation); }); } }); }); test('Detect when typescript adds new ModuleKind values; flag as a failure so we can update our code flagged [MUST_UPDATE_FOR_NEW_MODULEKIND]', async () => { // We have marked a few places in our code with MUST_UPDATE_FOR_NEW_MODULEKIND to make it easier to update them when TS adds new ModuleKinds const foundKeys: string[] = []; function check(value: number, name: string, required: boolean) { if (required) expect(ts.ModuleKind[name]).toBe(value); if (ts.ModuleKind[value] === undefined) { expect(ts.ModuleKind[name]).toBeUndefined(); } else { expect(ts.ModuleKind[value]).toBe(name); foundKeys.push(name, `${value}`); } } check(0, 'None', true); check(1, 'CommonJS', true); check(2, 'AMD', true); check(3, 'UMD', true); check(4, 'System', true); check(5, 'ES2015', true); try { check(6, 'ES2020', false); check(99, 'ESNext', true); } catch { // the value changed: is `99` now, but was `6` in TS 2.7 check(6, 'ESNext', true); expect(ts.ModuleKind[99]).toBeUndefined(); } check(7, 'ES2022', false); if (tsSupportsStableNodeNextNode16) { check(100, 'Node16', true); } else { check(100, 'Node12', false); } check(199, 'NodeNext', false); const actualKeys = Object.keys(ts.ModuleKind); actualKeys.sort(); foundKeys.sort(); expect(actualKeys).toEqual(foundKeys); }); ts-node-10.9.2/src/test/module-node/000077500000000000000000000000001453460306300171365ustar00rootroot00000000000000ts-node-10.9.2/src/test/module-node/1778.spec.ts000066400000000000000000000017301453460306300210460ustar00rootroot00000000000000import { createExec } from '../exec-helpers'; import { ctxTsNode, nodeSupportsEsmHooks, TEST_DIR, tsSupportsStableNodeNextNode16, CMD_TS_NODE_WITHOUT_PROJECT_FLAG, nodeSupportsSpawningChildProcess, } from '../helpers'; import { context, expect } from '../testlib'; import { join } from 'path'; const exec = createExec({ cwd: TEST_DIR, }); const test = context(ctxTsNode); test.suite( 'Issue #1778: typechecker resolver should take importer\'s module type -- cjs or esm -- into account when resolving package.json "exports"', (test) => { test.runIf( nodeSupportsEsmHooks && nodeSupportsSpawningChildProcess && tsSupportsStableNodeNextNode16 ); test('test', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} ./index.ts`, { cwd: join(TEST_DIR, '1778'), } ); expect(err).toBe(null); expect(stdout).toBe('{ esm: true }\n'); }); } ); ts-node-10.9.2/src/test/module-node/module-node.spec.ts000066400000000000000000000257531453460306300226630ustar00rootroot00000000000000import { expect, context } from '../testlib'; import { CMD_TS_NODE_WITHOUT_PROJECT_FLAG, isOneOf, nodeSupportsImportingTransformedCjsFromEsm, resetNodeEnvironment, tsSupportsStableNodeNextNode16, } from '../helpers'; import * as Path from 'path'; import { ctxTsNode } from '../helpers'; import { exec } from '../exec-helpers'; import { file, project, ProjectAPI as ProjectAPI } from '../fs-helpers'; const test = context(ctxTsNode); test.beforeEach(async () => { resetNodeEnvironment(); }); type Test = typeof test; // Declare one test case for each permutations of project configuration test.suite('TypeScript module=NodeNext and Node16', (test) => { test.runIf( tsSupportsStableNodeNextNode16 && nodeSupportsImportingTransformedCjsFromEsm ); for (const allowJs of [true, false]) { for (const typecheckMode of [ 'typecheck', 'transpileOnly', 'swc', ] as const) { for (const packageJsonType of [ undefined, 'commonjs', 'module', ] as const) { for (const tsModuleMode of ['NodeNext', 'Node16'] as const) { declareTest(test, { allowJs, packageJsonType, typecheckMode, tsModuleMode, }); } } } } }); function declareTest(test: Test, testParams: TestParams) { const name = `package-json-type=${testParams.packageJsonType} allowJs=${testParams.allowJs} ${testParams.typecheckMode} tsconfig-module=${testParams.tsModuleMode}`; test(name, async (t) => { const proj = writeFixturesToFilesystem(name, testParams); t.log( `Running this command: ( cd ${proj.cwd} ; ${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --esm ./index.mjs )` ); // All assertions happen within the fixture scripts // Zero exit code indicates a passing test const { stdout, stderr, err } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --esm ./index.mjs`, { cwd: proj.cwd } ); t.log(stdout); t.log(stderr); expect(err).toBe(null); expect(stdout).toMatch(/done\n$/); }); } type PackageJsonType = typeof packageJsonTypes[number]; const packageJsonTypes = [undefined, 'commonjs', 'module'] as const; const typecheckModes = ['typecheck', 'transpileOnly', 'swc'] as const; const importStyles = [ 'static import', 'require', 'dynamic import', 'import = require', ] as const; const importExtension = ['js', 'ts', 'omitted'] as const; interface Extension { ext: string; jsEquivalentExt?: string; forcesCjs?: boolean; forcesEsm?: boolean; isJs?: boolean; supportsJsx?: boolean; isJsxExt?: boolean; cjsAllowsOmittingExt?: boolean; } const extensions: Extension[] = [ { ext: 'cts', jsEquivalentExt: 'cjs', forcesCjs: true, }, { ext: 'cjs', forcesCjs: true, isJs: true, }, { ext: 'mts', jsEquivalentExt: 'mjs', forcesEsm: true, }, { ext: 'mjs', forcesEsm: true, isJs: true, }, { ext: 'ts', jsEquivalentExt: 'js', cjsAllowsOmittingExt: true, }, { ext: 'tsx', jsEquivalentExt: 'js', supportsJsx: true, isJsxExt: true, cjsAllowsOmittingExt: true, }, { ext: 'jsx', jsEquivalentExt: 'js', isJs: true, supportsJsx: true, isJsxExt: true, cjsAllowsOmittingExt: true, }, { ext: 'js', isJs: true, cjsAllowsOmittingExt: true, }, ]; /** * Describe how a given project config handles files with this extension. * For example, projects with allowJs:false do not like .jsx */ function getExtensionTreatment(ext: Extension, testParams: TestParams) { // JSX and any TS extensions get compiled. Everything is compiled in allowJs mode const isCompiled = testParams.allowJs || !ext.isJs || ext.isJsxExt; const isExecutedAsEsm = ext.forcesEsm || (!ext.forcesCjs && testParams.packageJsonType === 'module'); const isExecutedAsCjs = !isExecutedAsEsm; // if allowJs:false, then .jsx files are not allowed const isAllowed = !ext.isJsxExt || !ext.isJs || testParams.allowJs; const canHaveJsxSyntax = ext.isJsxExt || (ext.supportsJsx && isCompiled); return { isCompiled, isExecutedAsCjs, isExecutedAsEsm, isAllowed, canHaveJsxSyntax, }; } interface TestParams { packageJsonType: PackageJsonType; typecheckMode: typeof typecheckModes[number]; allowJs: boolean; tsModuleMode: 'NodeNext' | 'Node16'; } interface ImporterParams { importStyle: typeof importStyles[number]; importerExtension: typeof extensions[number]; } interface ImporteeParams { importeeExtension: typeof extensions[number]; } function writeFixturesToFilesystem(name: string, testParams: TestParams) { const { packageJsonType, allowJs, typecheckMode, tsModuleMode } = testParams; const proj = project(name.replace(/ /g, '_')); proj.addJsonFile('package.json', { type: packageJsonType, }); proj.addJsonFile('tsconfig.json', { compilerOptions: { allowJs, target: 'esnext', module: tsModuleMode, jsx: 'react', }, 'ts-node': { transpileOnly: typecheckMode === 'transpileOnly' || undefined, swc: typecheckMode === 'swc', experimentalResolver: true, }, }); const indexFile = file('index.mjs', ``); proj.add(indexFile); for (const importStyle of importStyles) { for (const importerExtension of extensions) { const importer = createImporter(proj, testParams, { importStyle, importerExtension, }); if (!importer) continue; let importSpecifier = `./${Path.relative(proj.cwd, importer.path)}`; importSpecifier = replaceExtension( importSpecifier, importerExtension.jsEquivalentExt ?? importerExtension.ext ); indexFile.content += `await import('${importSpecifier}');\n`; } } indexFile.content += `console.log('done');\n`; proj.rm(); proj.write(); return proj; } function createImporter( proj: ProjectAPI, testParams: TestParams, importerParams: ImporterParams ) { const { importStyle, importerExtension } = importerParams; const name = `${importStyle} from ${importerExtension.ext}`; const importerTreatment = getExtensionTreatment( importerExtension, testParams ); if (!importerTreatment.isAllowed) return; // import = require only allowed in non-js files if (importStyle === 'import = require' && importerExtension.isJs) return; // const = require not allowed in ESM if (importStyle === 'require' && importerTreatment.isExecutedAsEsm) return; // swc bug: import = require will not work in ESM, because swc does not emit necessary `__require = createRequire()` if ( testParams.typecheckMode === 'swc' && importStyle === 'import = require' && importerTreatment.isExecutedAsEsm ) return; const importer = { path: `${name.replace(/ /g, '_')}.${importerExtension.ext}`, imports: '', assertions: '', get content() { return ` ${this.imports} async function main() { ${this.assertions} } main(); `; }, }; proj.add(importer); if (!importerExtension.isJs) importer.imports += `export {};\n`; for (const importeeExtension of extensions) { const ci = createImportee(testParams, { importeeExtension }); if (!ci) continue; const { importee, treatment: importeeTreatment } = ci; proj.add(importee); // dynamic import is the only way to import ESM from CJS if ( importeeTreatment.isExecutedAsEsm && importerTreatment.isExecutedAsCjs && importStyle !== 'dynamic import' ) continue; // Cannot import = require an ESM file if (importeeTreatment.isExecutedAsEsm && importStyle === 'import = require') continue; // Cannot use static imports in non-compiled non-ESM if ( importStyle === 'static import' && !importerTreatment.isCompiled && importerTreatment.isExecutedAsCjs ) continue; let importSpecifier = `./${importeeExtension.ext}`; if ( !importeeExtension.cjsAllowsOmittingExt || isOneOf(importStyle, ['dynamic import', 'static import']) ) importSpecifier += '.' + (importeeExtension.jsEquivalentExt ?? importeeExtension.ext); switch (importStyle) { case 'dynamic import': importer.assertions += `const ${importeeExtension.ext} = await import('${importSpecifier}');\n`; break; case 'import = require': importer.imports += `import ${importeeExtension.ext} = require('${importSpecifier}');\n`; break; case 'require': importer.imports += `const ${importeeExtension.ext} = require('${importSpecifier}');\n`; break; case 'static import': importer.imports += `import * as ${importeeExtension.ext} from '${importSpecifier}';\n`; break; } // Check both namespace.ext and namespace.default.ext, because node can't detect named exports from files we transform const namespaceAsAny = importerExtension.isJs ? importeeExtension.ext : `(${importeeExtension.ext} as any)`; importer.assertions += `if((${importeeExtension.ext}.ext ?? ${namespaceAsAny}.default.ext) !== '${importeeExtension.ext}')\n`; importer.assertions += ` throw new Error('Wrong export from importee: expected ${importeeExtension.ext} but got ' + ${importeeExtension.ext}.ext + '(importee has these keys: ' + Object.keys(${importeeExtension.ext}) + ')');\n`; } return importer; } function createImportee( testParams: TestParams, importeeParams: ImporteeParams ) { const { importeeExtension } = importeeParams; const importee = file(`${importeeExtension.ext}.${importeeExtension.ext}`); const treatment = getExtensionTreatment(importeeExtension, testParams); if (!treatment.isAllowed) return; if (treatment.isCompiled || treatment.isExecutedAsEsm) { importee.content += `export const ext = '${importeeExtension.ext}';\n`; } else { importee.content += `exports.ext = '${importeeExtension.ext}';\n`; } if (!importeeExtension.isJs) { importee.content += `const testTsTypeSyntax: string = 'a string';\n`; } if (treatment.isExecutedAsCjs) { importee.content += `if(typeof __filename !== 'string') throw new Error('expected file to be CJS but __filename is not declared');\n`; } else { importee.content += `if(typeof __filename !== 'undefined') throw new Error('expected file to be ESM but __filename is declared');\n`; importee.content += `if(typeof import.meta.url !== 'string') throw new Error('expected file to be ESM but import.meta.url is not declared');\n`; } if (treatment.canHaveJsxSyntax) { importee.content += ` const React = { createElement(tag, dunno, content) { return {props: {children: [content]}}; } }; const jsxTest = Hello World; if(jsxTest?.props?.children[0] !== 'Hello World') throw new Error('Expected ${importeeExtension.ext} to support JSX but it did not.'); `; } return { importee, treatment }; } function replaceExtension(path: string, ext: string) { return Path.posix.format({ ...Path.parse(path), ext: '.' + ext, base: undefined, }); } ts-node-10.9.2/src/test/pluggable-dep-resolution.spec.ts000066400000000000000000000075021453460306300231440ustar00rootroot00000000000000import { context } from './testlib'; import { ctxTsNode, resetNodeEnvironment, TEST_DIR, tsSupportsTsconfigInheritanceViaNodePackages, } from './helpers'; import * as expect from 'expect'; import { resolve } from 'path'; const test = context(ctxTsNode); test.suite( 'Pluggable dependency (compiler, transpiler, swc backend) is require()d relative to the tsconfig file that declares it', (test) => { test.runSerially(); // The use-case we want to support: // // User shares their tsconfig across multiple projects as an npm module named "shared-config", similar to @tsconfig/bases // In their npm module // They have tsconfig.json with `swc: true` or `compiler: "ts-patch"` or something like that // The module declares a dependency on a known working version of @swc/core, or ts-patch, or something like that. // They use this reusable config via `npm install shared-config` and `"extends": "shared-config/tsconfig.json"` // // ts-node should resolve ts-patch or @swc/core relative to the extended tsconfig // to ensure we use the known working versions. const macro = test.macro((config: string, expected: string) => [ `${config} uses ${expected}`, async (t) => { t.teardown(resetNodeEnvironment); // A bit hacky: we've monkey-patched the various dependencies to either: // a) return transpiled output we expect // b) throw an error that we expect // Either way, we've proven that the correct dependency is used, which // is our goal. let output: string; try { output = t.context.tsNodeUnderTest .create({ project: resolve(TEST_DIR, 'pluggable-dep-resolution', config), }) .compile('', 'index.ts'); } catch (e) { expect(e).toBe(`emit from ${expected}`); return; } expect(output).toContain(`emit from ${expected}\n`); }, ]); test(macro, 'tsconfig-custom-compiler.json', 'root custom compiler'); test(macro, 'tsconfig-custom-transpiler.json', 'root custom transpiler'); test(macro, 'tsconfig-swc-custom-backend.json', 'root custom swc backend'); test(macro, 'tsconfig-swc-core.json', 'root @swc/core'); test(macro, 'tsconfig-swc-wasm.json', 'root @swc/wasm'); test(macro, 'tsconfig-swc.json', 'root @swc/core'); test( macro, 'node_modules/shared-config/tsconfig-custom-compiler.json', 'shared-config custom compiler' ); test( macro, 'node_modules/shared-config/tsconfig-custom-transpiler.json', 'shared-config custom transpiler' ); test( macro, 'node_modules/shared-config/tsconfig-swc-custom-backend.json', 'shared-config custom swc backend' ); test( macro, 'node_modules/shared-config/tsconfig-swc-core.json', 'shared-config @swc/core' ); test( macro, 'node_modules/shared-config/tsconfig-swc-wasm.json', 'shared-config @swc/wasm' ); test( macro, 'node_modules/shared-config/tsconfig-swc.json', 'shared-config @swc/core' ); test.suite('"extends"', (test) => { test.runIf(tsSupportsTsconfigInheritanceViaNodePackages); test( macro, 'tsconfig-extend-custom-compiler.json', 'shared-config custom compiler' ); test( macro, 'tsconfig-extend-custom-transpiler.json', 'shared-config custom transpiler' ); test( macro, 'tsconfig-extend-swc-custom-backend.json', 'shared-config custom swc backend' ); test(macro, 'tsconfig-extend-swc-core.json', 'shared-config @swc/core'); test(macro, 'tsconfig-extend-swc-wasm.json', 'shared-config @swc/wasm'); test(macro, 'tsconfig-extend-swc.json', 'shared-config @swc/core'); }); } ); ts-node-10.9.2/src/test/register.spec.ts000066400000000000000000000131071453460306300200550ustar00rootroot00000000000000import { once } from 'lodash'; import { ctxTsNode, PROJECT_TRANSPILE_ONLY, resetNodeEnvironment, TEST_DIR, tsNodeTypes, } from './helpers'; import { context, expect } from './testlib'; import * as exp from 'expect'; import { join, resolve } from 'path'; import proxyquire = require('proxyquire'); const SOURCE_MAP_REGEXP = /\/\/# sourceMappingURL=data:application\/json;charset=utf\-8;base64,[\w\+]+=*$/; const createOptions: tsNodeTypes.CreateOptions = { project: PROJECT_TRANSPILE_ONLY, compilerOptions: { jsx: 'preserve', }, }; const test = context(ctxTsNode).context( once(async (t) => { return { moduleTestPath: resolve(__dirname, '../../tests/module.ts'), service: t.context.tsNodeUnderTest.create(createOptions), }; }) ); test.beforeEach(async (t) => { // Un-install all hook and remove our test module from cache resetNodeEnvironment(); delete require.cache[t.context.moduleTestPath]; // Paranoid check that we are truly uninstalled exp(() => require(t.context.moduleTestPath)).toThrow( "Unexpected token 'export'" ); }); test.runSerially(); test('create() does not register()', async (t) => { // nyc sets its own `require.extensions` hooks; to truly detect if we're // installed we must attempt to load a TS file t.context.tsNodeUnderTest.create(createOptions); // This error indicates node attempted to run the code as .js exp(() => require(t.context.moduleTestPath)).toThrow( "Unexpected token 'export'" ); }); test('register(options) is shorthand for register(create(options))', (t) => { t.context.tsNodeUnderTest.register(createOptions); require(t.context.moduleTestPath); }); test('register(service) registers a previously-created service', (t) => { t.context.tsNodeUnderTest.register(t.context.service); require(t.context.moduleTestPath); }); test.suite('register(create(options))', (test) => { test.beforeEach(async (t) => { // Re-enable project for every test. t.context.service.enabled(true); t.context.tsNodeUnderTest.register(t.context.service); t.context.service.installSourceMapSupport(); }); test('should be able to require typescript', ({ context: { moduleTestPath }, }) => { const m = require(moduleTestPath); expect(m.example('foo')).toBe('FOO'); }); test('should support dynamically disabling', ({ context: { service, moduleTestPath }, }) => { delete require.cache[moduleTestPath]; expect(service.enabled(false)).toBe(false); expect(() => require(moduleTestPath)).toThrow(/Unexpected token/); delete require.cache[moduleTestPath]; expect(service.enabled()).toBe(false); expect(() => require(moduleTestPath)).toThrow(/Unexpected token/); delete require.cache[moduleTestPath]; expect(service.enabled(true)).toBe(true); expect(() => require(moduleTestPath)).not.toThrow(); delete require.cache[moduleTestPath]; expect(service.enabled()).toBe(true); expect(() => require(moduleTestPath)).not.toThrow(); }); test('should compile through js and ts', () => { const m = require('../../tests/complex'); expect(m.example()).toBe('example'); }); test('should work with proxyquire', () => { const m = proxyquire('../../tests/complex', { './example': 'hello', }); expect(m.example()).toBe('hello'); }); test('should work with `require.cache`', () => { const { example1, example2 } = require('../../tests/require-cache'); expect(example1).not.toBe(example2); }); test('should use source maps', async () => { try { require('../../tests/throw error'); } catch (error: any) { exp(error.stack).toMatch( [ 'Error: this is a demo', ` at Foo.bar (${join(TEST_DIR, './throw error.ts')}:100:17)`, ].join('\n') ); } }); test.suite('JSX preserve', (test) => { let compiled: string; test.beforeAll(async () => { const old = require.extensions['.tsx']!; require.extensions['.tsx'] = (m: any, fileName) => { const _compile = m._compile; m._compile = function (code: string, fileName: string) { compiled = code; return _compile.call(this, code, fileName); }; return old(m, fileName); }; }); test('should use source maps', async (t) => { try { require('../../tests/with-jsx.tsx'); } catch (error: any) { expect(error.stack).toMatch('SyntaxError: Unexpected token'); } expect(compiled).toMatch(SOURCE_MAP_REGEXP); }); }); }); test('should support compiler scopes w/multiple registered compiler services at once', (t) => { const { moduleTestPath, tsNodeUnderTest } = t.context; const calls: string[] = []; const compilers = [ tsNodeUnderTest.register({ projectSearchDir: join(TEST_DIR, 'scope/a'), scopeDir: join(TEST_DIR, 'scope/a'), scope: true, }), tsNodeUnderTest.register({ projectSearchDir: join(TEST_DIR, 'scope/a'), scopeDir: join(TEST_DIR, 'scope/b'), scope: true, }), ]; compilers.forEach((c) => { const old = c.compile; c.compile = (code, fileName, lineOffset) => { calls.push(fileName); return old(code, fileName, lineOffset); }; }); try { expect(require('../../tests/scope/a').ext).toBe('.ts'); expect(require('../../tests/scope/b').ext).toBe('.ts'); } finally { compilers.forEach((c) => c.enabled(false)); } expect(calls).toEqual([ join(TEST_DIR, 'scope/a/index.ts'), join(TEST_DIR, 'scope/b/index.ts'), ]); delete require.cache[moduleTestPath]; expect(() => require(moduleTestPath)).toThrow(); }); ts-node-10.9.2/src/test/regression.spec.ts000066400000000000000000000030741453460306300204130ustar00rootroot00000000000000// Misc regression tests go here if they do not have a better home import * as exp from 'expect'; import { join } from 'path'; import { createExec, createExecTester } from './exec-helpers'; import { CMD_TS_NODE_WITHOUT_PROJECT_FLAG, ctxTsNode, TEST_DIR, } from './helpers'; import { context } from './testlib'; const test = context(ctxTsNode); const exec = createExecTester({ exec: createExec({ cwd: TEST_DIR, }), }); test('#2076 regression test', async () => { const r = await exec({ exec: createExec({ cwd: join(TEST_DIR, '2076'), }), cmd: `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} --showConfig`, }); exp(r.err).toBeNull(); }); test('#1488 regression test', async () => { // Scenario that caused the bug: // `allowJs` turned on // `skipIgnore` turned on so that ts-node tries to compile itself (not ideal but theoretically we should be ok with this) // Attempt to `require()` a `.js` file // `assertScriptCanLoadAsCJS` is triggered within `require()` // `./package.json` needs to be fetched into cache via `assertScriptCanLoadAsCJS` which caused a recursive `require()` call // Circular dependency warning is emitted by node const { stdout, stderr } = await exec({ exec: createExec({ cwd: join(TEST_DIR, '1488'), }), cmd: `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} ./index.js`, }); // Assert that we do *not* get `Warning: Accessing non-existent property 'getOptionValue' of module exports inside circular dependency` exp(stdout).toBe('foo\n'); // prove that it ran exp(stderr).toBe(''); // prove that no warnings }); ts-node-10.9.2/src/test/remove-env-var-force-color.js000066400000000000000000000000401453460306300223370ustar00rootroot00000000000000delete process.env.FORCE_COLOR; ts-node-10.9.2/src/test/repl/000077500000000000000000000000001453460306300156705ustar00rootroot00000000000000ts-node-10.9.2/src/test/repl/helpers.ts000066400000000000000000000075761453460306300177210ustar00rootroot00000000000000import { PassThrough } from 'stream'; import { delay, getStream, TEST_DIR, tsNodeTypes, ctxTsNode } from '../helpers'; import type { ExecutionContext } from 'ava'; import { test, expect } from '../testlib'; export interface CreateReplViaApiOptions { registerHooks: boolean; createReplOpts?: Partial; createServiceOpts?: Partial; } export interface ExecuteInReplOptions extends CreateReplViaApiOptions { waitMs?: number; waitPattern?: string | RegExp; /** When specified, calls `startInternal` instead of `start` and passes options */ startInternalOptions?: Parameters< tsNodeTypes.ReplService['startInternal'] >[0]; } export namespace ctxRepl { export type Ctx = ctxTsNode.Ctx & Awaited>; export type T = ExecutionContext; } /** * pass to test.context() to get REPL testing helper functions */ export async function ctxRepl(t: ctxTsNode.T) { const { tsNodeUnderTest } = t.context; return { createReplViaApi, executeInRepl }; function createReplViaApi({ registerHooks, createReplOpts, createServiceOpts, }: CreateReplViaApiOptions) { const stdin = new PassThrough(); const stdout = new PassThrough(); const stderr = new PassThrough(); const replService = tsNodeUnderTest.createRepl({ stdin, stdout, stderr, ...createReplOpts, }); const service = ( registerHooks ? tsNodeUnderTest.register : tsNodeUnderTest.create )({ ...replService.evalAwarePartialHost, project: `${TEST_DIR}/tsconfig.json`, ...createServiceOpts, tsTrace: replService.console.log.bind(replService.console), }); replService.setService(service); t.teardown(async () => { service.enabled(false); }); return { stdin, stdout, stderr, replService, service }; } async function executeInRepl(input: string, options: ExecuteInReplOptions) { const { waitPattern, // Wait longer if there's a signal to end it early waitMs = waitPattern != null ? 20e3 : 1e3, startInternalOptions, ...rest } = options; const { stdin, stdout, stderr, replService } = createReplViaApi(rest); if (startInternalOptions) { replService.startInternal(startInternalOptions); } else { replService.start(); } stdin.write(input); stdin.end(); const stdoutPromise = getStream(stdout, waitPattern); const stderrPromise = getStream(stderr, waitPattern); // Wait for expected output pattern or timeout, whichever comes first await Promise.race([delay(waitMs), stdoutPromise, stderrPromise]); stdout.end(); stderr.end(); return { stdin, stdout: await stdoutPromise, stderr: await stderrPromise, }; } } export const macroReplNoErrorsAndStdoutContains = test.macro( (script: string, contains: string, options?: Partial) => async (t: ctxRepl.T) => { macroReplInternal(t, script, contains, undefined, contains, options); } ); export const macroReplStderrContains = test.macro( ( script: string, errorContains: string, options?: Partial ) => async (t: ctxRepl.T) => { macroReplInternal( t, script, undefined, errorContains, errorContains, options ); } ); async function macroReplInternal( t: ctxRepl.T, script: string, stdoutContains: string | undefined, stderrContains: string | undefined, waitPattern: string, options?: Partial ) { const { stdout, stderr } = await t.context.executeInRepl(script, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern, ...options, }); if (stderrContains) expect(stderr).toContain(stderrContains); else expect(stderr).toBe(''); if (stdoutContains) expect(stdout).toContain(stdoutContains); } ts-node-10.9.2/src/test/repl/node-repl-tla.ts000066400000000000000000000223631453460306300207110ustar00rootroot00000000000000import { expect } from '../testlib'; import type { Key } from 'readline'; import { Stream } from 'stream'; import semver = require('semver'); import { ts } from '../helpers'; import type { ctxTsNode } from '../helpers'; import { nodeSupportsEsmHooks } from '../helpers'; interface SharedObjects extends ctxTsNode.Ctx { TEST_DIR: string; } // Based on https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/test/parallel/test-repl-top-level-await.js export async function upstreamTopLevelAwaitTests({ TEST_DIR, tsNodeUnderTest, }: SharedObjects) { const PROMPT = 'await repl > '; const putIn = new REPLStream(); const replService = tsNodeUnderTest.createRepl({ // @ts-ignore stdin: putIn, // @ts-ignore stdout: putIn, // @ts-ignore stderr: putIn, }); const service = tsNodeUnderTest.create({ ...replService.evalAwarePartialHost, project: `${TEST_DIR}/tsconfig.json`, experimentalReplAwait: true, transpileOnly: true, compilerOptions: { target: semver.gte(ts.version, '3.0.1') ? 'es2018' : // TS 2.7 is using polyfill for async interator even though they // were added in es2018 'esnext', }, }); replService.setService(service); ( replService.stdout as NodeJS.WritableStream & { isTTY: boolean; } ).isTTY = true; const replServer = replService.startInternal({ prompt: PROMPT, terminal: true, useColors: true, useGlobal: false, }); function runAndWait(cmds: Array) { const promise = putIn.wait(); for (const cmd of cmds) { if (typeof cmd === 'string') { putIn.run([cmd]); } else { replServer.write('', cmd); } } return promise; } await runAndWait([ 'function foo(x) { return x; }', 'function koo() { return Promise.resolve(4); }', ]); const testCases = [ ['await Promise.resolve(0)', '0'], // issue: { a: await Promise.resolve(1) } is being interpreted as a block // remove surrounding parenthesis once issue is fixed ['({ a: await Promise.resolve(1) })', '{ a: 1 }'], ['_', '{ a: 1 }'], ['let { aa, bb } = await Promise.resolve({ aa: 1, bb: 2 }), f = 5;'], ['aa', '1'], ['bb', '2'], ['f', '5'], ['let cc = await Promise.resolve(2)'], ['cc', '2'], ['let dd;'], ['dd'], ['let [ii, { abc: { kk } }] = [0, { abc: { kk: 1 } }];'], ['ii', '0'], ['kk', '1'], ['var ll = await Promise.resolve(2);'], ['ll', '2'], ['foo(await koo())', '4'], ['_', '4'], ['const m = foo(await koo());'], ['m', '4'], // issue: REPL doesn't recognize end of input // compile is returning TS1005 after second line even though // it's valid syntax // [ // 'const n = foo(await\nkoo());', // ['const n = foo(await\r', '... koo());\r', 'undefined'], // ], [ '`status: ${(await Promise.resolve({ status: 200 })).status}`', "'status: 200'", ], ['for (let i = 0; i < 2; ++i) await i'], ['for (let i = 0; i < 2; ++i) { await i }'], ['await 0', '0'], ['await 0; function foo() {}'], ['foo', '[Function: foo]'], ['class Foo {}; await 1;', '1'], [ 'Foo', // Adjusted since ts-node supports older versions of node semver.gte(process.version, '12.18.0') ? '[class Foo]' : '[Function: Foo]', ], ['if (await true) { function fooz() {}; }'], ['fooz', '[Function: fooz]'], ['if (await true) { class Bar {}; }'], [ 'Bar', // Adjusted since ts-node supports older versions of node nodeSupportsEsmHooks ? 'Uncaught ReferenceError: Bar is not defined' : 'ReferenceError: Bar is not defined', // Line increased due to TS added lines { line: nodeSupportsEsmHooks ? 4 : 5, }, ], ['await 0; function* gen(){}'], ['for (var i = 0; i < 10; ++i) { await i; }'], ['i', '10'], ['for (let j = 0; j < 5; ++j) { await j; }'], [ 'j', // Adjusted since ts-node supports older versions of node nodeSupportsEsmHooks ? 'Uncaught ReferenceError: j is not defined' : 'ReferenceError: j is not defined', // Line increased due to TS added lines { line: nodeSupportsEsmHooks ? 4 : 5, }, ], ['gen', '[GeneratorFunction: gen]'], [ 'return 42; await 5;', // Adjusted since ts-node supports older versions of node nodeSupportsEsmHooks ? 'Uncaught SyntaxError: Illegal return statement' : 'SyntaxError: Illegal return statement', // Line increased due to TS added lines { line: nodeSupportsEsmHooks ? 4 : 5, }, ], ['let o = await 1, p'], ['p'], ['let q = 1, s = await 2'], ['s', '2'], [ 'for await (let i of [1,2,3]) console.log(i)', [ 'for await (let i of [1,2,3]) console.log(i)\r', '1', '2', '3', 'undefined', ], ], // issue: REPL is expecting more input to finish execution // compiler is returning TS1003 error // [ // 'await Promise..resolve()', // [ // 'await Promise..resolve()\r', // 'Uncaught SyntaxError: ', // 'await Promise..resolve()', // ' ^', // '', // "Unexpected token '.'", // ], // ], [ 'for (const x of [1,2,3]) {\nawait x\n}', ['for (const x of [1,2,3]) {\r', '... await x\r', '... }\r', 'undefined'], ], [ 'for (const x of [1,2,3]) {\nawait x;\n}', [ 'for (const x of [1,2,3]) {\r', '... await x;\r', '... }\r', 'undefined', ], ], [ 'for await (const x of [1,2,3]) {\nconsole.log(x)\n}', [ 'for await (const x of [1,2,3]) {\r', '... console.log(x)\r', '... }\r', '1', '2', '3', 'undefined', ], ], [ 'for await (const x of [1,2,3]) {\nconsole.log(x);\n}', [ 'for await (const x of [1,2,3]) {\r', '... console.log(x);\r', '... }\r', '1', '2', '3', 'undefined', ], ], ] as const; for (const [ input, expected = [`${input}\r`], options = {} as { line?: number }, ] of testCases) { const toBeRun = input.split('\n'); const lines = await runAndWait(toBeRun); if (Array.isArray(expected)) { if (expected.length === 1) expected.push('undefined'); if (lines[0] === input) lines.shift(); expect(lines).toEqual([...expected, PROMPT]); } else if ('line' in options) { expect(lines[toBeRun.length + options.line!]).toEqual(expected); } else { const echoed = toBeRun.map((a, i) => `${i > 0 ? '... ' : ''}${a}\r`); expect(lines).toEqual([...echoed, expected, PROMPT]); } } } // copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/lib/internal/util/inspect.js#L220-L227 // Regex used for ansi escape code splitting // Adopted from https://github.com/chalk/ansi-regex/blob/HEAD/index.js // License: MIT, authors: @sindresorhus, Qix-, arjunmehta and LitoMore // Matches all ansi escape code sequences in a string const ansiPattern = '[\\u001B\\u009B][[\\]()#;?]*' + '(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)' + '|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'; const ansi = new RegExp(ansiPattern, 'g'); // copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/lib/internal/util/inspect.js#L2112-L2117 /** * Remove all VT control characters. Use to estimate displayed string width. */ function stripVTControlCharacters(str: string) { return str.replace(ansi, ''); } // copied from https://github.com/nodejs/node/blob/88799930794045795e8abac874730f9eba7e2300/test/parallel/test-repl-top-level-await.js class ArrayStream extends Stream { readable = true; writable = true; run(data: string[]) { data.forEach((line) => { this.emit('data', `${line}\n`); }); } pause() {} resume() {} write(_chunk: Buffer | string, _encoding: string, _callback: () => {}) {} } export class REPLStream extends ArrayStream { waitingForResponse = false; lines = ['']; constructor() { super(); } write(chunk: Buffer | string, encoding: string, callback: () => void) { if (Buffer.isBuffer(chunk)) { chunk = chunk.toString(encoding); } const chunkLines = stripVTControlCharacters(chunk).split('\n'); this.lines[this.lines.length - 1] += chunkLines[0]; if (chunkLines.length > 1) { this.lines.push(...chunkLines.slice(1)); } this.emit('line'); if (callback) callback(); return true; } wait(): Promise { if (this.waitingForResponse) { throw new Error('Currently waiting for response to another command'); } this.lines = ['']; return new Promise((resolve, reject) => { const onError = (err: any) => { this.removeListener('line', onLine); reject(err); }; const onLine = () => { if (this.lines[this.lines.length - 1].includes('> ')) { this.removeListener('error', onError); this.removeListener('line', onLine); resolve(this.lines); } }; this.once('error', onError); this.on('line', onLine); }); } } ts-node-10.9.2/src/test/repl/repl-environment.spec.ts000066400000000000000000000405661453460306300225100ustar00rootroot00000000000000/* * Tests that the REPL environment is setup correctly: * globals, __filename, builtin module accessors. */ import { context, expect } from '../testlib'; import * as getStream from 'get-stream'; import { CMD_TS_NODE_WITH_PROJECT_FLAG, ctxTsNode, delay, TEST_DIR, } from '../helpers'; import { dirname, join } from 'path'; import { createExec, createExecTester } from '../exec-helpers'; import { homedir } from 'os'; import { ctxRepl } from './helpers'; const test = context(ctxTsNode).context(ctxRepl); const exec = createExec({ cwd: TEST_DIR, }); const execTester = createExecTester({ cmd: CMD_TS_NODE_WITH_PROJECT_FLAG, exec, }); test.suite( '[eval], , and [stdin] execute with correct globals', (test) => { interface GlobalInRepl extends NodeJS.Global { testReport: any; replReport: any; stdinReport: any; evalReport: any; module: any; exports: any; fs: any; __filename: any; __dirname: any; } const globalInRepl = global as GlobalInRepl; const programmaticTest = test.macro( ( { evalCodeBefore, stdinCode, waitFor, }: { evalCodeBefore: string | null; stdinCode: string; waitFor?: () => boolean; }, assertions: (stdout: string) => Promise | void ) => async (t) => { delete globalInRepl.testReport; delete globalInRepl.replReport; delete globalInRepl.stdinReport; delete globalInRepl.evalReport; delete globalInRepl.module; delete globalInRepl.exports; delete globalInRepl.fs; delete globalInRepl.__filename; delete globalInRepl.__dirname; const { stdin, stderr, stdout, replService } = t.context.createReplViaApi({ registerHooks: true }); if (typeof evalCodeBefore === 'string') { replService.evalCode(evalCodeBefore); } replService.start(); stdin.write(stdinCode); stdin.end(); let done = false; await Promise.race([ delay(20e3), (async () => { while (!done && !waitFor?.()) { await delay(1e3); } })(), ]); done = true; stdout.end(); stderr.end(); expect(await getStream(stderr)).toBe(''); await assertions(await getStream(stdout)); } ); const declareGlobals = `declare var replReport: any, stdinReport: any, evalReport: any, restReport: any, global: any, __filename: any, __dirname: any, module: any, exports: any;`; function setReportGlobal(type: 'repl' | 'stdin' | 'eval') { return ` ${declareGlobals} global.${type}Report = { __filename: typeof __filename !== 'undefined' && __filename, __dirname: typeof __dirname !== 'undefined' && __dirname, moduleId: typeof module !== 'undefined' && module.id, modulePath: typeof module !== 'undefined' && module.path, moduleFilename: typeof module !== 'undefined' && module.filename, modulePaths: typeof module !== 'undefined' && [...module.paths], exportsTest: typeof exports !== 'undefined' ? module.exports === exports : null, stackTest: new Error().stack!.split('\\n')[1], moduleAccessorsTest: eval('typeof fs') === 'undefined' ? null : eval('fs') === require('fs'), argv: [...process.argv] }; `.replace(/\n/g, ''); } const reportsObject = ` { stdinReport: typeof stdinReport !== 'undefined' && stdinReport, evalReport: typeof evalReport !== 'undefined' && evalReport, replReport: typeof replReport !== 'undefined' && replReport } `; const printReports = ` ${declareGlobals} console.log(JSON.stringify(${reportsObject})); `.replace(/\n/g, ''); const saveReportsAsGlobal = ` ${declareGlobals} global.testReport = ${reportsObject}; `.replace(/\n/g, ''); function parseStdoutStripReplPrompt(stdout: string) { // Strip node's welcome header, only uncomment if running these tests manually against vanilla node // stdout = stdout.replace(/^Welcome to.*\nType "\.help" .*\n/, ''); expect(stdout.slice(0, 2)).toBe('> '); expect(stdout.slice(-12)).toBe('undefined\n> '); return parseStdout(stdout.slice(2, -12)); } function parseStdout(stdout: string) { return JSON.parse(stdout); } /** Every possible ./node_modules directory ascending upwards starting with ./tests/node_modules */ const modulePaths = createModulePaths(TEST_DIR); function createModulePaths(dir: string) { const modulePaths: string[] = []; for (let path = dir; ; path = dirname(path)) { modulePaths.push(join(path, 'node_modules')); if (dirname(path) === path) break; } return modulePaths; } // Executable is `ts-node` on Posix, `bin.js` on Windows due to Windows shimming limitations (this is determined by package manager) const tsNodeExe = expect.stringMatching(/\b(ts-node|bin.js)$/); test('stdin', async (t) => { const { stdout } = await execTester({ stdin: `${setReportGlobal('stdin')};${printReports}`, flags: '', }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: { __filename: '[stdin]', __dirname: '.', moduleId: '[stdin]', modulePath: '.', // Note: vanilla node does does not have file extension moduleFilename: join(TEST_DIR, `[stdin].ts`), modulePaths, exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, `[stdin].ts`)}:1:` ), moduleAccessorsTest: null, argv: [tsNodeExe], }, evalReport: false, replReport: false, }); }); test('repl', async (t) => { const { stdout } = await execTester({ stdin: `${setReportGlobal('repl')};${printReports}`, flags: '-i', }); const report = parseStdoutStripReplPrompt(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: false, replReport: { __filename: false, __dirname: false, moduleId: '', modulePath: '.', moduleFilename: null, modulePaths: expect.objectContaining({ ...[join(TEST_DIR, `repl/node_modules`), ...modulePaths], }), // Note: vanilla node REPL does not set exports exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, '.ts')}:4:` ), moduleAccessorsTest: true, argv: [tsNodeExe], }, }); // Prior to these, nyc adds another entry on Windows; we need to ignore it expect(report.replReport.modulePaths.slice(-3)).toMatchObject([ join(homedir(), `.node_modules`), join(homedir(), `.node_libraries`), // additional entry goes to node's install path expect.any(String), ]); }); // Should ignore -i and run the entrypoint test('-i w/entrypoint ignores -i', async (t) => { const { stdout } = await execTester({ stdin: `${setReportGlobal('repl')};${printReports}`, flags: '-i ./repl/script.js', }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: false, replReport: false, }); }); // Should not execute stdin // Should not interpret positional arg as an entrypoint script test('-e', async (t) => { const { stdout } = await execTester({ stdin: `throw new Error()`, flags: `-e "${setReportGlobal('eval')};${printReports}"`, }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: { __filename: '[eval]', __dirname: '.', moduleId: '[eval]', modulePath: '.', // Note: vanilla node does does not have file extension moduleFilename: join(TEST_DIR, `[eval].ts`), modulePaths: [...modulePaths], exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, `[eval].ts`)}:1:` ), moduleAccessorsTest: true, argv: [tsNodeExe], }, replReport: false, }); }); test('-e w/entrypoint arg does not execute entrypoint', async (t) => { const { stdout } = await execTester({ stdin: `throw new Error()`, flags: `-e "${setReportGlobal( 'eval' )};${printReports}" ./repl/script.js`, }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: { __filename: '[eval]', __dirname: '.', moduleId: '[eval]', modulePath: '.', // Note: vanilla node does does not have file extension moduleFilename: join(TEST_DIR, `[eval].ts`), modulePaths, exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, `[eval].ts`)}:1:` ), moduleAccessorsTest: true, argv: [tsNodeExe, './repl/script.js'], }, replReport: false, }); }); test('-e w/non-path arg', async (t) => { const { stdout } = await execTester({ stdin: `throw new Error()`, flags: `-e "${setReportGlobal( 'eval' )};${printReports}" ./does-not-exist.js`, }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: { __filename: '[eval]', __dirname: '.', moduleId: '[eval]', modulePath: '.', // Note: vanilla node does does not have file extension moduleFilename: join(TEST_DIR, `[eval].ts`), modulePaths, exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, `[eval].ts`)}:1:` ), moduleAccessorsTest: true, argv: [tsNodeExe, './does-not-exist.js'], }, replReport: false, }); }); test('-e -i', async (t) => { const { stdout } = await execTester({ stdin: `${setReportGlobal('repl')};${printReports}`, flags: `-e "${setReportGlobal('eval')}" -i`, }); const report = parseStdoutStripReplPrompt(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: { __filename: '[eval]', __dirname: '.', moduleId: '[eval]', modulePath: '.', // Note: vanilla node does does not have file extension moduleFilename: join(TEST_DIR, `[eval].ts`), modulePaths, exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, `[eval].ts`)}:1:` ), moduleAccessorsTest: true, argv: [tsNodeExe], }, replReport: { __filename: '[eval]', __dirname: '.', moduleId: '', modulePath: '.', moduleFilename: null, modulePaths: expect.objectContaining({ ...[join(TEST_DIR, `repl/node_modules`), ...modulePaths], }), // Note: vanilla node REPL does not set exports, so this would be false exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, '.ts')}:4:` ), moduleAccessorsTest: true, argv: [tsNodeExe], }, }); // Prior to these, nyc adds another entry on Windows; we need to ignore it expect(report.replReport.modulePaths.slice(-3)).toMatchObject([ join(homedir(), `.node_modules`), join(homedir(), `.node_libraries`), // additional entry goes to node's install path expect.any(String), ]); }); test('-e -i w/entrypoint ignores -e and -i, runs entrypoint', async (t) => { const { stdout } = await execTester({ stdin: `throw new Error()`, flags: '-e "throw new Error()" -i ./repl/script.js', }); const report = parseStdout(stdout); expect(report).toMatchObject({ stdinReport: false, evalReport: false, replReport: false, }); }); test('-e -i when -e throws error, -i does not run', async (t) => { const { stdout, stderr, err } = await execTester({ stdin: `console.log('hello')`, flags: `-e "throw new Error('error from -e')" -i`, expectError: true, }); expect(err).toBeDefined(); expect(stdout).toBe(''); expect(stderr).toContain('error from -e'); }); // Serial because it's timing-sensitive test.serial( 'programmatically, eval-ing before starting REPL', programmaticTest, { evalCodeBefore: `${setReportGlobal('repl')};${saveReportsAsGlobal}`, stdinCode: '', waitFor: () => !!globalInRepl.testReport, }, (stdout) => { expect(globalInRepl.testReport).toMatchObject({ stdinReport: false, evalReport: false, replReport: { __filename: false, __dirname: false, // Due to limitations in node's REPL API, we can't really expose // the `module` prior to calling repl.start() which also sends // output to stdout. // For now, leaving this as unsupported / undefined behavior. // moduleId: '', // modulePath: '.', // moduleFilename: null, // modulePaths: [ // join(ROOT_DIR, `repl/node_modules`), // ...rootModulePaths, // join(homedir(), `.node_modules`), // join(homedir(), `.node_libraries`), // // additional entry goes to node's install path // exp.any(String), // ], // // Note: vanilla node REPL does not set exports // exportsTest: true, // moduleAccessorsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, '.ts')}:1:` ), }, }); } ); test.serial( 'programmatically, passing code to stdin after starting REPL', programmaticTest, { evalCodeBefore: null, stdinCode: `${setReportGlobal('repl')};${saveReportsAsGlobal}`, waitFor: () => !!globalInRepl.testReport, }, (stdout) => { expect(globalInRepl.testReport).toMatchObject({ stdinReport: false, evalReport: false, replReport: { __filename: false, __dirname: false, moduleId: '', modulePath: '.', moduleFilename: null, modulePaths: expect.objectContaining({ ...[join(TEST_DIR, `repl/node_modules`), ...modulePaths], }), // Note: vanilla node REPL does not set exports exportsTest: true, // Note: vanilla node uses different name. See #1360 stackTest: expect.stringContaining( ` at ${join(TEST_DIR, '.ts')}:1:` ), moduleAccessorsTest: true, }, }); // Prior to these, nyc adds another entry on Windows; we need to ignore it expect( globalInRepl.testReport.replReport.modulePaths.slice(-3) ).toMatchObject([ join(homedir(), `.node_modules`), join(homedir(), `.node_libraries`), // additional entry goes to node's install path expect.any(String), ]); } ); } ); ts-node-10.9.2/src/test/repl/repl.spec.ts000066400000000000000000000467641453460306300201540ustar00rootroot00000000000000import { context, expect } from '../testlib'; import { delay, resetNodeEnvironment, ts } from '../helpers'; import semver = require('semver'); import { CMD_TS_NODE_WITH_PROJECT_FLAG, ctxTsNode, getStream, TEST_DIR, } from '../helpers'; import { createExec, createExecTester } from '../exec-helpers'; import { upstreamTopLevelAwaitTests } from './node-repl-tla'; import { ctxRepl, macroReplNoErrorsAndStdoutContains, macroReplStderrContains, } from './helpers'; const test = context(ctxTsNode).context(ctxRepl); test.runSerially(); test.beforeEach(async (t) => { t.teardown(() => { resetNodeEnvironment(); // Useful for debugging memory leaks. Leaving in case I need it again. // global.gc(); // Requires adding nodeArguments: ['--expose-gc'] to ava config // console.dir(process.memoryUsage().heapUsed / 1000 / 1000); }); }); const exec = createExec({ cwd: TEST_DIR, }); const execTester = createExecTester({ cmd: CMD_TS_NODE_WITH_PROJECT_FLAG, exec, }); test('should run REPL when --interactive passed and stdin is not a TTY', async () => { const execPromise = exec(`${CMD_TS_NODE_WITH_PROJECT_FLAG} --interactive`); execPromise.child.stdin!.end('console.log("123")\n'); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe('> 123\n' + 'undefined\n' + '> '); }); test('should echo a value when using the swc transpiler', async () => { const execPromise = exec( `${CMD_TS_NODE_WITH_PROJECT_FLAG} --interactive --transpiler ts-node/transpilers/swc-experimental` ); execPromise.child.stdin!.end('400\n401\n'); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe('> 400\n> 401\n> '); }); test('REPL has command to get type information', async () => { const execPromise = exec(`${CMD_TS_NODE_WITH_PROJECT_FLAG} --interactive`); execPromise.child.stdin!.end('\nconst a = 123\n.type a'); const { err, stdout } = await execPromise; expect(err).toBe(null); expect(stdout).toBe( '> undefined\n' + '> undefined\n' + '> const a: 123\n' + '> ' ); }); // Serial because it's timing-sensitive test.serial('REPL can be configured on `start`', async (t) => { const prompt = '#> '; const { stdout, stderr } = await t.context.executeInRepl( `const x = 3\n'done'`, { waitPattern: "'done'", registerHooks: true, startInternalOptions: { prompt, ignoreUndefined: true, }, } ); expect(stderr).toBe(''); expect(stdout).toBe(`${prompt}${prompt}'done'\n`); }); // Serial because it's timing-sensitive test.serial( 'REPL uses a different context when `useGlobal` is false', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( // No error when re-declaring x 'const x = 3\n' + // console.log ouput will end up in the stream and not in test output 'console.log(1)\n', { registerHooks: true, waitPattern: `> undefined\n> 1\nundefined\n> `, startInternalOptions: { useGlobal: false, }, } ); expect(stderr).toBe(''); expect(stdout).toBe(`> undefined\n> 1\nundefined\n> `); } ); // Serial because it's timing-sensitive test.serial('REPL can be created via API', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `\nconst a = 123\n.type a\n`, { registerHooks: true, waitPattern: '123\n> ', } ); expect(stderr).toBe(''); expect(stdout).toBe( '> undefined\n' + '> undefined\n' + '> const a: 123\n' + '> ' ); }); test.suite('top level await', ({ context }) => { const compilerOptions = { target: 'es2018', }; const test = context(async (t) => { return { executeInTlaRepl }; function executeInTlaRepl(input: string, waitPattern?: string | RegExp) { return t.context.executeInRepl( input .split('\n') .map((line) => line.trim()) // Restore newline once https://github.com/nodejs/node/pull/39392 is merged .join(''), { registerHooks: true, waitPattern, createServiceOpts: { experimentalReplAwait: true, compilerOptions, }, startInternalOptions: { useGlobal: false }, } ); } }); if (semver.gte(ts.version, '3.8.0')) { // Serial because it's timing-sensitive test.serial('should allow evaluating top level await', async (t) => { const script = ` const x: number = await new Promise((r) => r(1)); for await (const x of [1,2,3]) { console.log(x) }; for (const x of ['a', 'b']) { await x; console.log(x) }; class Foo {}; await 1; function Bar() {}; await 2; const {y} = await ({y: 2}); const [z] = await [3]; x + y + z; `; const { stdout, stderr } = await t.context.executeInTlaRepl( script, '6\n> ' ); expect(stderr).toBe(''); expect(stdout).toBe('> 1\n2\n3\na\nb\n6\n> '); }); // Serial because it's timing-sensitive test.serial( 'should wait until promise is settled when awaiting at top level', async (t) => { const awaitMs = 500; const script = ` const startTime = new Date().getTime(); await new Promise((r) => setTimeout(() => r(1), ${awaitMs})); const endTime = new Date().getTime(); endTime - startTime; `; const { stdout, stderr } = await t.context.executeInTlaRepl( script, /\d+\n/ ); expect(stderr).toBe(''); const elapsedTimeString = stdout .split('\n')[0] .replace('> ', '') .trim(); expect(elapsedTimeString).toMatch(/^\d+$/); const elapsedTime = Number(elapsedTimeString); expect(elapsedTime).toBeGreaterThanOrEqual(awaitMs - 50); // When CI is taxed, the time may be *much* greater than expected. // I can't think of a case where the time being *too high* is a bug // that this test can catch. So I've made this check very loose. expect(elapsedTime).toBeLessThanOrEqual(awaitMs + 10e3); } ); // Serial because it's timing-sensitive test.serial( 'should not wait until promise is settled when not using await at top level', async (t) => { const script = ` const startTime = new Date().getTime(); (async () => await new Promise((r) => setTimeout(() => r(1), ${5000})))(); const endTime = new Date().getTime(); endTime - startTime; `; const { stdout, stderr } = await t.context.executeInTlaRepl( script, /\d+\n/ ); expect(stderr).toBe(''); const ellapsedTime = Number( stdout.split('\n')[0].replace('> ', '').trim() ); expect(ellapsedTime).toBeGreaterThanOrEqual(0); // Should ideally be instantaneous; leave wiggle-room for slow CI expect(ellapsedTime).toBeLessThanOrEqual(100); } ); // Serial because it's timing-sensitive test.serial( 'should error with typing information when awaited result has type mismatch', async (t) => { const { stdout, stderr } = await t.context.executeInTlaRepl( 'const x: string = await 1', 'error' ); expect(stdout).toBe('> > '); expect(stderr.replace(/\r\n/g, '\n')).toBe( '.ts(4,7): error TS2322: ' + (semver.gte(ts.version, '4.0.0') ? `Type 'number' is not assignable to type 'string'.\n` : `Type '1' is not assignable to type 'string'.\n`) + '\n' ); } ); // Serial because it's timing-sensitive test.serial( 'should error with typing information when importing a file with type errors', async (t) => { const { stdout, stderr } = await t.context.executeInTlaRepl( `const {foo} = await import('./repl/tla-import');`, 'error' ); expect(stdout).toBe('> > '); expect(stderr.replace(/\r\n/g, '\n')).toBe( 'repl/tla-import.ts(1,14): error TS2322: ' + (semver.gte(ts.version, '4.0.0') ? `Type 'number' is not assignable to type 'string'.\n` : `Type '1' is not assignable to type 'string'.\n`) + '\n' ); } ); test('should pass upstream test cases', async (t) => { const { tsNodeUnderTest } = t.context; await upstreamTopLevelAwaitTests({ TEST_DIR, tsNodeUnderTest }); }); } else { test('should throw error when attempting to use top level await on TS < 3.8', async (t) => { expect(t.context.executeInTlaRepl('')).rejects.toThrow( 'Experimental REPL await is not compatible with TypeScript versions older than 3.8' ); }); } }); test.suite( 'REPL ignores diagnostics that are annoying in interactive sessions', (test) => { const code = `function foo() {};\nfunction foo() {return 123};\nconsole.log(foo());\n`; const diagnosticMessage = `Duplicate function implementation`; test('interactive repl should ignore them', async (t) => { const { stdout, stderr } = await execTester({ flags: '-i', stdin: code, }); expect(stdout).not.toContain(diagnosticMessage); }); test('interactive repl should not ignore them if they occur in other files', async (t) => { const { stdout, stderr } = await execTester({ flags: '-i', stdin: `import './repl-ignored-diagnostics/index.ts';\n`, }); expect(stderr).toContain(diagnosticMessage); }); test('[stdin] should not ignore them', async (t) => { const { stdout, stderr } = await execTester({ stdin: code, expectError: true, }); expect(stderr).toContain(diagnosticMessage); }); test('[eval] should not ignore them', async (t) => { const { stdout, stderr } = await execTester({ flags: `-e "${code.replace(/\n/g, '')}"`, expectError: true, }); expect(stderr).toContain(diagnosticMessage); }); } ); test.suite( 'REPL inputs are syntactically independent of each other', (test) => { // Serial because they're timing-sensitive test.runSerially(); test('arithmetic operators are independent of previous values', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `9 + 3 7 - 3 3 * 7\n.break 100 / 2\n.break 5 ** 2\n.break console.log('done!') `, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: 'done!\nundefined\n>', } ); expect(stdout).not.toContain('12'); expect(stdout).not.toContain('4'); expect(stdout).not.toContain('21'); expect(stdout).not.toContain('50'); expect(stdout).not.toContain('25'); expect(stdout).toContain('3'); expect(stdout).toContain('-3'); }); test('automatically inserted semicolons do not appear in error messages at the end', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `( a console.log('done!')`, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: 'done!\nundefined\n>', } ); expect(stderr).toContain("error TS1005: ')' expected."); expect(stderr).not.toContain(';'); }); test('automatically inserted semicolons do not appear in error messages at the start', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `) console.log('done!')`, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: 'done!\nundefined\n>', } ); expect(stderr).toContain( 'error TS1128: Declaration or statement expected.' ); expect(stderr).toContain(')'); expect(stderr).not.toContain(';'); }); test('automatically inserted semicolons do not break function calls', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `function foo(a: number) { return a + 1; } foo( 1 )`, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: '2\n>', } ); expect(stderr).toBe(''); expect(stdout).toContain('2'); }); test('automatically inserted semicolons do not affect subsequent line numbers', async (t) => { // If first line of input ends in a semicolon, should not add a second semicolon. // That will cause an extra blank line in the compiled output which will // offset the stack line number. const { stdout, stderr } = await t.context.executeInRepl( `1; new Error().stack!.split('\\n')[1] console.log('done!')`, { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: 'done!', } ); expect(stderr).toBe(''); expect(stdout).toContain(":1:1'\n"); }); } ); test.suite('Multiline inputs and RECOVERY_CODES', (test) => { test.runSerially(); test( 'multiline function args declaration', macroReplNoErrorsAndStdoutContains, ` function myFn( a: string, b: string ) { return a + ' ' + b } myFn('test', '!') `, 'test !' ); test( 'Conditional recovery codes: this one-liner *should* raise an error; should not be recoverable', macroReplStderrContains, ` (a: any) => a = null; `, 'error TS', { createServiceOpts: { compilerOptions: { strictNullChecks: false } }, } ); }); test.suite('REPL works with traceResolution', (test) => { test.serial( 'startup traces should print before the prompt appears when traceResolution is enabled', async (t) => { const repl = t.context.createReplViaApi({ registerHooks: false, createServiceOpts: { compilerOptions: { traceResolution: true, }, }, }); repl.replService.start(); repl.stdin.end(); await delay(3e3); repl.stdout.end(); const stdout = await getStream(repl.stdout); expect(stdout).toContain('======== Resolving module'); expect(stdout.endsWith('> ')).toBe(true); } ); test.serial( 'traces should NOT appear when traceResolution is not enabled', async (t) => { const { stdout, stderr } = await t.context.executeInRepl('1', { registerHooks: true, startInternalOptions: { useGlobal: false }, waitPattern: '1\n>', }); expect(stderr).toBe(''); expect(stdout).not.toContain('======== Resolving module'); } ); }); test.suite('REPL declares types for node built-ins within REPL', (test) => { test.runSerially(); test('enabled when typechecking', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `util.promisify(setTimeout)("should not be a string" as string) type Duplex = stream.Duplex const s = stream 'done'`, { registerHooks: true, waitPattern: `done`, startInternalOptions: { useGlobal: false, }, } ); // Assert that we receive a typechecking error about improperly using // `util.promisify` but *not* an error about the absence of `util` expect(stderr).not.toMatch("Cannot find name 'util'"); expect(stderr).toMatch( "Argument of type 'string' is not assignable to parameter of type 'number'" ); // Assert that both types and values can be used without error expect(stderr).not.toMatch("Cannot find namespace 'stream'"); expect(stderr).not.toMatch("Cannot find name 'stream'"); expect(stdout).toMatch(`done`); }); test('disabled in transpile-only mode, to avoid breaking third-party SWC transpiler which rejects `declare import` syntax', async (t) => { const { stdout, stderr } = await t.context.executeInRepl( `type Duplex = stream.Duplex const s = stream 'done'`, { createServiceOpts: { swc: true, }, registerHooks: true, waitPattern: `done`, startInternalOptions: { useGlobal: false, }, } ); // Assert that we do not get errors about `declare import` syntax from swc expect(stdout).toBe("> undefined\n> undefined\n> 'done'\n"); expect(stderr).toBe(''); }); }); test.suite('REPL treats object literals and block scopes correctly', (test) => { test( 'repl should treat { key: 123 } as object literal', macroReplNoErrorsAndStdoutContains, '{ key: 123 }', '{ key: 123 }' ); test( 'repl should treat ({ key: 123 }) as object literal', macroReplNoErrorsAndStdoutContains, '({ key: 123 })', '{ key: 123 }' ); test( 'repl should treat ({ let v = 0; v; }) as object literal and error', macroReplStderrContains, '({ let v = 0; v; })', semver.satisfies(ts.version, '2.7') ? 'error TS2304' : 'No value exists in scope for the shorthand property' ); test( 'repl should treat { let v = 0; v; } as block scope', macroReplNoErrorsAndStdoutContains, '{ let v = 0; v; }', '0' ); test.suite('extra', (test) => { test.skipIf(semver.satisfies(ts.version, '2.7')); test( 'repl should treat { key: 123 }; as block scope', macroReplNoErrorsAndStdoutContains, '{ key: 123 };', '123' ); test( 'repl should treat {\\nkey: 123\\n}; as block scope', macroReplNoErrorsAndStdoutContains, '{\nkey: 123\n};', '123' ); test( 'repl should treat { key: 123 }[] as block scope (edge case)', macroReplNoErrorsAndStdoutContains, '{ key: 123 }[]', '[]' ); }); test.suite('multiline', (test) => { test( 'repl should treat {\\nkey: 123\\n} as object literal', macroReplNoErrorsAndStdoutContains, '{\nkey: 123\n}', '{ key: 123 }' ); test( 'repl should treat ({\\nkey: 123\\n}) as object literal', macroReplNoErrorsAndStdoutContains, '({\nkey: 123\n})', '{ key: 123 }' ); test( 'repl should treat ({\\nlet v = 0;\\nv;\\n}) as object literal and error', macroReplStderrContains, '({\nlet v = 0;\nv;\n})', semver.satisfies(ts.version, '2.7') ? 'error TS2304' : 'No value exists in scope for the shorthand property' ); test( 'repl should treat {\\nlet v = 0;\\nv;\\n} as block scope', macroReplNoErrorsAndStdoutContains, '{\nlet v = 0;\nv;\n}', '0' ); }); test.suite('property access', (test) => { test( 'repl should treat { key: 123 }.key as object literal property access', macroReplNoErrorsAndStdoutContains, '{ key: 123 }.key', '123' ); test( 'repl should treat { key: 123 }["key"] as object literal indexed access', macroReplNoErrorsAndStdoutContains, '{ key: 123 }["key"]', '123' ); test( 'repl should treat { key: 123 }.foo as object literal non-existent property access', macroReplStderrContains, '{ key: 123 }.foo', "Property 'foo' does not exist on type" ); test( 'repl should treat { key: 123 }["foo"] as object literal non-existent indexed access', macroReplStderrContains, '{ key: 123 }["foo"]', semver.satisfies(ts.version, '2.7') ? 'error TS7017' : "Property 'foo' does not exist on type" ); }); }); ts-node-10.9.2/src/test/resolver.spec.ts000077500000000000000000000673141453460306300201060ustar00rootroot00000000000000import { context, ExecutionContext, expect, TestInterface } from './testlib'; import { ctxTsNode, isOneOf, resetNodeEnvironment, ts, tsSupportsStableNodeNextNode16, } from './helpers'; import { project as fsProject, Project as FsProject } from './fs-helpers'; import { join } from 'path'; import * as semver from 'semver'; import { padStart } from 'lodash'; import _ = require('lodash'); import { pathToFileURL } from 'url'; import type { RegisterOptions } from '..'; import * as fs from 'fs'; import * as Path from 'path'; /* * Each test case is a separate TS project, with a different permutation of * project options. The project is written to disc, then ts-node is installed, * then several entrypoint-* files are imported to test our resolver. * * High-level structure of these tests: * package.json, tsconfig.json, src/, and out/ * entrypoint-* files are the entrypoints * they import a bunch of target files / directories / node_modules * * The heart of this test is every time an entrypoint imports a target. * We are testing if the resolver figures out the correct target file to import. * * To better understand the emitted projects, run the tests, then look in `tests/tmp/resolver-*` * * Whenever a test fails, the error will log a command you can paste into your terminal to re-run * that project *outside* of this test suite. This may be helpful in understanding and debugging * these tests. */ // Test a bunch of permutations of: // import permutations: // - [x] Relative import of file // - [x] Relative import of index // - [x] rootless library import of main // - [x] rootless library import of index // - [x] rootless library import of exports sub-path // - [x] rootless self-import of main // - [x] rootless self-import of index // - [x] rootless self-import of exports sub-path // - [x] Require with extension // - [x] Require without extension // - Require from dist to dist // - Require from dist to src // - Require from src to dist // - [x] Require from src to src // lib permutations: // - [x] module exists in both src and dist (precompilation ran) // - [x] module exists in only dist (came from elsewhere) // - [x] module exists only in src (did not precompile) // - .ts / .js extension // - .tsx / .js extension // - .cts / .cjs extension // - .mts / .mjs extension // - .js / .js extension // - .jsx / .js extension // - .cjs / .cjs extension // - .mjs / .mjs extension // Side-step compiler transformation of import() into require() const dynamicImport = new Function('specifier', 'return import(specifier)'); // For some reason `new Function` was triggering what *might* be a node bug, // where `context.parentURL` passed into loader `resolve()` was wrong. // eval works for unknown reasons. This may change in future node releases. const declareDynamicImportFunction = `const dynamicImport = eval('(specifier) => import(specifier)');`; const test = context(ctxTsNode); type Test = TestInterface; type T = ExecutionContext; const projectSeq = seqGenerator(); const entrypointSeq = seqGenerator(); const targetSeq = seqGenerator(); interface Project { identifier: string; allowJs: boolean; preferSrc: boolean; typeModule: boolean; /** Use TS's new module: `nodenext` option */ useTsNodeNext: boolean; experimentalSpecifierResolutionNode: boolean; skipIgnore: boolean; } interface EntrypointPermutation { entrypointExt: 'cjs' | 'mjs'; withExt: boolean; entrypointLocation: 'src' | 'out'; entrypointTargetting: 'src' | 'out'; } type Entrypoint = string; interface GenerateTargetOptions { inSrc: boolean; inOut: boolean; srcExt: string; /** If true, is an index.* file within a directory */ isIndex: boolean; targetPackageStyle: TargetPackageStyle; packageTypeModule: boolean; } interface Target { targetIdentifier: string; outName: string; srcName: string; srcExt: string; outExt: string; inSrc: boolean; inOut: boolean; /** If true, is neither an index.* nor a package */ isNamedFile: boolean; /** If true, is an index.* file within a directory */ isIndex: boolean; /** If true, should be imported as an npm package, not relative import */ isPackage: boolean; packageStyle: TargetPackageStyle; typeModule: boolean; } /** When target is actually a mini node_modules package */ type TargetPackageStyle = typeof targetPackageStyles[number]; const targetPackageStyles = [ false, // test that the package contains /index.* 'empty-manifest', // "main": "src/target." 'main-src-with-extension', // "main": "src/target." 'main-src-with-out-extension', // "main": "out/target." 'main-out-with-extension', // "main": "src/target" 'main-src-extensionless', // "main": "out/target" 'main-out-extensionless', // "exports": {".": "src/target."} 'exports-src-with-extension', // "exports": {".": "src/target."} 'exports-src-with-out-extension', // "exports": {".": "out/target."} 'exports-out-with-extension', ] as const; test.suite('Resolver hooks', (test) => { test.runSerially(); test.runIf( semver.gte(process.version, '14.0.0') && !semver.satisfies(ts.version, '2.7.x') ); // // Generate all permutations of projects // for (const preferSrc of [false, true]) { for (const typeModule of [false, true]) { for (const allowJs of [false, true]) { for (const useTsNodeNext of [false, true]) { // TODO test against skipIgnore: false, where imports of third-party deps in `node_modules` should not get our mapping behaviors for (const skipIgnore of [/*false, */ true]) { for (const experimentalSpecifierResolutionNode of [false, true]) { let identifier = `resolver-${projectSeq()}`; identifier += preferSrc ? '-preferSrc' : '-preferOut'; identifier += typeModule ? '-typeModule' : '-typeCjs---'; identifier += allowJs ? '-allowJs' : '--------'; identifier += useTsNodeNext ? '-useTsNodenext' : '--------------'; identifier += skipIgnore ? '-skipIgnore' : '-----------'; identifier += experimentalSpecifierResolutionNode ? '-experimentalSpecifierResolutionNode' : ''; const project: Project = { identifier, allowJs, preferSrc, typeModule, useTsNodeNext, experimentalSpecifierResolutionNode, skipIgnore, }; declareProject(test, project); } } } } } } }); function declareProject(_test: Test, project: Project) { const test = project.useTsNodeNext && !tsSupportsStableNodeNextNode16 ? _test.skip : _test; test(`${project.identifier}`, async (t) => { t.teardown(() => { resetNodeEnvironment(); }); const p = fsProject(project.identifier); p.rm(); p.addJsonFile('package.json', { type: project.typeModule ? 'module' : undefined, }); p.addJsonFile('tsconfig.json', { 'ts-node': { experimentalResolver: true, preferTsExts: project.preferSrc, transpileOnly: true, experimentalSpecifierResolution: project.experimentalSpecifierResolutionNode ? 'node' : undefined, skipIgnore: project.skipIgnore, } as RegisterOptions, compilerOptions: { allowJs: project.allowJs, skipLibCheck: true, // TODO add nodenext permutation module: project.useTsNodeNext ? 'NodeNext' : project.typeModule ? 'esnext' : 'commonjs', jsx: 'react', target: 'esnext', }, }); const targets = generateTargets(project, p); const entrypoints = generateEntrypoints(project, p, targets); p.write(); await execute(t, p, entrypoints); }); } // // Generate all target-* files // function generateTargets(project: Project, p: FsProject) { /** Array of metadata about target files to be imported */ const targets: Array = []; // TODO does allowJs matter? for (const inOut of [false, true]) { for (const inSrc of [false, true]) { for (const srcExt of [ 'ts', 'tsx', 'cts', 'mts', 'jsx', 'js', 'cjs', 'mjs', ]) { for (const targetPackageStyle of targetPackageStyles) { const packageTypeModulePermutations = targetPackageStyle ? [true, false] : [project.typeModule]; for (const packageTypeModule of packageTypeModulePermutations) { const isIndexPermutations = targetPackageStyle ? [false] : [true, false]; // TODO test main pointing to a directory containing an `index.` file? for (const isIndex of isIndexPermutations) { //#region SKIPPING if (!inSrc && !inOut) continue; // Don't bother with jsx if we don't have allowJs enabled // TODO Get rid of this? "Just work" in this case? if (srcExt === 'jsx' && !project.allowJs) continue; // Don't bother with src-only extensions when only emitting to `out` if (!inSrc && ['ts', 'tsx', 'cts', 'mts', 'jsx'].includes(srcExt)) continue; // TODO re-enable with src <-> out mapping if ( !inOut && isOneOf(targetPackageStyle, [ 'main-out-with-extension', 'main-out-extensionless', 'exports-out-with-extension', ]) ) continue; if ( !inSrc && isOneOf(targetPackageStyle, [ 'main-src-with-extension', 'main-src-extensionless', 'exports-src-with-extension', ]) ) continue; if ( isOneOf(targetPackageStyle, [ 'main-out-with-extension', 'main-out-extensionless', 'exports-out-with-extension', ]) ) continue; //#endregion targets.push( generateTarget(project, p, { inSrc, inOut, srcExt, targetPackageStyle, packageTypeModule, isIndex, }) ); } } } } } } return targets; } function generateTarget( project: Project, p: FsProject, options: GenerateTargetOptions ) { const { inSrc, inOut, srcExt, targetPackageStyle, packageTypeModule, isIndex, } = options; const outExt = srcExt.replace('ts', 'js').replace('x', ''); let targetIdentifier = `target-${targetSeq()}-${ inOut && inSrc ? 'inboth' : inOut ? 'onlyout' : 'onlysrc' }-${srcExt}`; if (targetPackageStyle) targetIdentifier = `${targetIdentifier}-${targetPackageStyle}-${ packageTypeModule ? 'module' : 'commonjs' }`; let prefix = targetPackageStyle ? `node_modules/${targetIdentifier}/` : ''; let suffix = targetPackageStyle === 'empty-manifest' ? 'index' : targetPackageStyle ? 'target' : targetIdentifier; if (isIndex) suffix += '-dir/index'; const srcDirInfix = targetPackageStyle === 'empty-manifest' ? '' : 'src/'; const outDirInfix = targetPackageStyle === 'empty-manifest' ? '' : 'out/'; const srcName = `${prefix}${srcDirInfix}${suffix}.${srcExt}`; const srcDirOutExtName = `${prefix}${srcDirInfix}${suffix}.${outExt}`; const outName = `${prefix}${outDirInfix}${suffix}.${outExt}`; const selfImporterCjsName = `${prefix}self-import-cjs.cjs`; const selfImporterMjsName = `${prefix}self-import-mjs.mjs`; const target: Target = { targetIdentifier, srcName, outName, srcExt, outExt, inSrc, inOut, isNamedFile: !isIndex && !targetPackageStyle, isIndex, isPackage: !!targetPackageStyle, packageStyle: targetPackageStyle, typeModule: packageTypeModule, }; const { isMjs: targetIsMjs } = fileInfo( '.' + srcExt, packageTypeModule, project.allowJs ); function targetContent(loc: string) { let content = ''; if (targetIsMjs) { content += String.raw` const {fileURLToPath} = await import('url'); const filenameNative = fileURLToPath(import.meta.url); export const directory = filenameNative.replace(/.*[\\\/](.*?)[\\\/]/, '$1'); export const filename = filenameNative.replace(/.*[\\\/]/, ''); export const targetIdentifier = '${targetIdentifier}'; export const ext = filenameNative.replace(/.*\./, ''); export const loc = '${loc}'; `; } else { content += String.raw` const filenameNative = __filename; exports.filename = filenameNative.replace(/.*[\\\/]/, ''); exports.directory = filenameNative.replace(/.*[\\\/](.*?)[\\\/].*/, '$1'); exports.targetIdentifier = '${targetIdentifier}'; exports.ext = filenameNative.replace(/.*\./, ''); exports.loc = '${loc}'; `; } return content; } if (inOut) { p.addFile(outName, targetContent('out')); // TODO so we can test multiple file extensions in a single directory, preferTsExt p.addFile(srcDirOutExtName, targetContent('out')); } if (inSrc) { p.addFile(srcName, targetContent('src')); } if (targetPackageStyle) { const selfImporterIsCompiled = project.allowJs; const cjsSelfImporterMustUseDynamicImportHack = !project.useTsNodeNext && selfImporterIsCompiled && targetIsMjs; p.addFile( selfImporterCjsName, targetIsMjs ? cjsSelfImporterMustUseDynamicImportHack ? `${declareDynamicImportFunction}\nmodule.exports = dynamicImport('${targetIdentifier}');` : `module.exports = import("${targetIdentifier}");` : `module.exports = require("${targetIdentifier}");` ); p.addFile( selfImporterMjsName, ` export * from "${targetIdentifier}"; ` ); function writePackageJson(obj: any) { p.addJsonFile(`${prefix}/package.json`, { name: targetIdentifier, type: packageTypeModule ? 'module' : undefined, ...obj, }); } switch (targetPackageStyle) { case 'empty-manifest': writePackageJson({}); break; case 'exports-src-with-extension': writePackageJson({ exports: { '.': `./src/${suffix}.${srcExt}`, }, }); break; case 'exports-src-with-out-extension': writePackageJson({ exports: { '.': `./src/${suffix}.${outExt}`, }, }); break; case 'exports-out-with-extension': writePackageJson({ exports: { '.': `./out/${suffix}.${outExt}`, }, }); break; case 'main-src-extensionless': writePackageJson({ main: `src/${suffix}`, }); break; case 'main-out-extensionless': writePackageJson({ main: `out/${suffix}`, }); break; case 'main-src-with-extension': writePackageJson({ main: `src/${suffix}.${srcExt}`, }); break; case 'main-src-with-out-extension': writePackageJson({ main: `src/${suffix}.${outExt}`, }); break; case 'main-out-with-extension': writePackageJson({ main: `src/${suffix}.${outExt}`, }); break; default: const _assert: never = targetPackageStyle; } } return target; } /** * Generate all entrypoint-* files */ function generateEntrypoints( project: Project, p: FsProject, targets: Target[] ) { /** Array of entrypoint files to be imported during the test */ let entrypoints: string[] = []; for (const entrypointExt of ['cjs', 'mjs'] as const) { // TODO consider removing this logic; deferring to conditionals in the generateEntrypoint which emit meaningful comments const withExtPermutations = entrypointExt == 'mjs' && project.experimentalSpecifierResolutionNode === false ? [true] : [false, true]; for (const withExt of withExtPermutations) { // Location of the entrypoint for (const entrypointLocation of ['src', 'out'] as const) { // Target of the entrypoint's import statements for (const entrypointTargetting of ['src', 'out'] as const) { // TODO re-enable when we have out <-> src mapping if (entrypointLocation !== 'src') continue; if (entrypointTargetting !== 'src') continue; entrypoints.push( generateEntrypoint(project, p, targets, { entrypointExt, withExt, entrypointLocation, entrypointTargetting, }) ); } } } } return entrypoints; } function generateEntrypoint( project: Project, p: FsProject, targets: Target[], opts: EntrypointPermutation ) { const { entrypointExt, withExt, entrypointLocation, entrypointTargetting } = opts; const entrypointFilename = `entrypoint-${entrypointSeq()}-${entrypointLocation}-to-${entrypointTargetting}${ withExt ? '-withext' : '' }.${entrypointExt}`; const { isMjs: entrypointIsMjs, isCompiled: entrypointIsCompiled } = fileInfo( entrypointFilename, project.typeModule, project.allowJs ); let entrypointContent = 'let mod;\n'; entrypointContent += 'let testsRun = 0;\n'; if (entrypointIsMjs) { entrypointContent += `import assert from 'assert';\n`; } else { entrypointContent += `const assert = require('assert');\n`; entrypointContent += `${declareDynamicImportFunction}\n`; } entrypointContent += `async function main() {\n`; for (const target of targets) { // TODO re-enable these when we have outDir <-> rootDir mapping if (target.srcName.includes('onlyout') && entrypointTargetting === 'src') continue; if (target.srcName.includes('onlysrc') && entrypointTargetting === 'out') continue; const { ext: targetSrcExt, isMjs: targetIsMjs, isCompiled: targetIsCompiled, } = fileInfo(target.srcName, target.typeModule, project.allowJs); let targetExtPermutations = ['']; if (!target.isPackage) { if (entrypointTargetting === 'out' && target.outExt !== target.srcExt) { // TODO re-enable when we have out <-> src mapping targetExtPermutations = [target.outExt]; } else if (target.srcExt !== target.outExt) { targetExtPermutations = [target.srcExt, target.outExt]; } else { targetExtPermutations = [target.srcExt]; } } const externalPackageSelfImportPermutations = target.isPackage ? [false, true] : [false]; for (const targetExt of targetExtPermutations) { for (const externalPackageSelfImport of externalPackageSelfImportPermutations) { entrypointContent += `\n// ${target.targetIdentifier}`; if (target.isPackage) { entrypointContent += ` node_modules package`; if (externalPackageSelfImport) { entrypointContent += ` self-import`; } } else { entrypointContent += `.${targetExt}`; } entrypointContent += '\n'; // should specifier be relative or absolute? let specifier: string; if (externalPackageSelfImport) { specifier = `../node_modules/${target.targetIdentifier}/self-import-${entrypointExt}.${entrypointExt}`; } else if (target.isPackage) { specifier = target.targetIdentifier; } else { if (entrypointTargetting === entrypointLocation) specifier = './'; else specifier = `../${entrypointTargetting}/`; specifier += target.targetIdentifier; if (target.isIndex) specifier += '-dir'; if (!target.isIndex && withExt) specifier += '.' + targetExt; } //#region SKIPPING if (target.isNamedFile && !withExt) { // Do not try to import cjs/cts without extension; node always requires these extensions if (target.outExt === 'cjs') { entrypointContent += `// skipping ${specifier} because we cannot omit extension from cjs / cts files; node always requires them\n`; continue; } // Do not try to import mjs/mts unless experimental-specifier-resolution is turned on if ( target.outExt === 'mjs' && !project.experimentalSpecifierResolutionNode ) { entrypointContent += `// skipping ${specifier} because we cannot omit extension from mjs/mts unless experimental-specifier-resolution=node\n`; continue; } // Do not try to import anything extensionless via ESM loader unless experimental-specifier-resolution is turned on if ( (targetIsMjs || entrypointIsMjs) && !project.experimentalSpecifierResolutionNode ) { entrypointContent += `// skipping ${specifier} because we cannot omit extension via esm loader unless experimental-specifier-resolution=node\n`; continue; } } if ( target.isPackage && isOneOf(target.packageStyle, [ 'empty-manifest', 'main-out-extensionless', 'main-src-extensionless', ]) && isOneOf(target.outExt, ['cjs', 'mjs']) ) { entrypointContent += `// skipping ${specifier} because it points to a node_modules package that tries to omit file extension, and node does not allow omitting cjs/mjs extension\n`; continue; } // Do not try to import a transpiled file if compiler options disagree with node's extension-based classification if (!project.useTsNodeNext && targetIsCompiled) { if (targetIsMjs && !project.typeModule) { entrypointContent += `// skipping ${specifier} because it is compiled and compiler options disagree with node's module classification: extension=${targetSrcExt}, tsconfig module=commonjs\n`; continue; } if (!targetIsMjs && project.typeModule) { entrypointContent += `// skipping ${specifier} because it is compiled and compiler options disagree with node's module classification: extension=${targetSrcExt}, tsconfig module=esnext\n`; continue; } } // Do not try to import index from a directory if is forbidden by node's ESM resolver if (target.isIndex) { if ( (targetIsMjs || entrypointIsMjs) && !project.experimentalSpecifierResolutionNode ) { entrypointContent += `// skipping ${specifier} because esm loader does not allow directory ./index imports unless experimental-specifier-resolution=node\n`; continue; } if (target.outExt === 'cjs') { entrypointContent += `// skipping ${specifier} because it relies on node automatically resolving a directory to index.cjs/cts , but node does not support those extensions for index.* files, only .js (and equivalents), .node, .json\n`; continue; } } //#endregion // NOTE: if you try to explicitly import foo.ts, we will load foo.ts, EVEN IF you have `preferTsExts` off const assertIsSrcOrOut = !target.inSrc ? 'out' : !target.inOut ? 'src' : project.preferSrc || (!target.isIndex && targetExt === target.srcExt && withExt) || target.srcExt === target.outExt || // <-- TODO re-enable when we have src <-> out mapping (target.isPackage && isOneOf(target.packageStyle, [ 'main-src-with-extension', 'exports-src-with-extension', ])) ? 'src' : 'out'; const assertHasExt = assertIsSrcOrOut === 'src' ? target.srcExt : target.outExt; // If entrypoint is compiled as CJS, and *not* with TS's nodenext, then TS transforms `import` into `require`, // so we must hack around the compiler to get a true `import`. const entrypointMustUseDynamicImportHack = !project.useTsNodeNext && entrypointIsCompiled && !entrypointIsMjs && !externalPackageSelfImport; entrypointContent += entrypointExt === 'cjs' && (externalPackageSelfImport || !targetIsMjs) ? ` mod = await require('${specifier}');\n` : entrypointMustUseDynamicImportHack ? ` mod = await dynamicImport('${specifier}');\n` : ` mod = await import('${specifier}');\n`; entrypointContent += ` assert.equal(mod.loc, '${assertIsSrcOrOut}');\n`; entrypointContent += ` assert.equal(mod.targetIdentifier, '${target.targetIdentifier}');\n`; entrypointContent += ` assert.equal(mod.ext, '${assertHasExt}');\n`; entrypointContent += ` testsRun++;\n`; } } } entrypointContent += `}\n`; entrypointContent += `const result = main().then(() => {return testsRun});\n`; entrypointContent += `result.mark = 'marked';\n`; if (entrypointIsMjs) { entrypointContent += `export {result};\n`; } else { entrypointContent += `exports.result = result;\n`; } p.dir(entrypointLocation).addFile(entrypointFilename, entrypointContent); return entrypointLocation + '/' + entrypointFilename; } /** * Assertions happen here */ async function execute(t: T, p: FsProject, entrypoints: Entrypoint[]) { // // Install ts-node and try to import all the index-* files // const service = t.context.tsNodeUnderTest.register({ projectSearchDir: p.cwd, }); process.__test_setloader__(t.context.tsNodeUnderTest.createEsmHooks(service)); for (const entrypoint of entrypoints) { t.log(`Importing ${join(p.cwd, entrypoint)}`); try { const { result } = await dynamicImport( pathToFileURL(join(p.cwd, entrypoint)) ); expect(result).toBeInstanceOf(Promise); expect(result.mark).toBe('marked'); const testsRun = await result; t.log(`Entrypoint ran ${testsRun} tests.`); } catch (e) { try { const launchJsonPath = Path.resolve( __dirname, '../../.vscode/launch.json' ); const launchJson = JSON.parse(fs.readFileSync(launchJsonPath, 'utf8')); const config = launchJson.configurations.find( (c: any) => c.name === 'Debug resolver test' ); config.cwd = Path.join( '${workspaceFolder}', Path.relative(Path.resolve(__dirname, '../..'), p.cwd) ); config.program = `./${entrypoint}`; fs.writeFileSync(launchJsonPath, JSON.stringify(launchJson, null, 2)); } catch {} throw new Error( [ (e as Error).message, (e as Error).stack, '', 'This is an error in a resolver test. It might be easier to investigate by running outside of the test suite.', 'To do that, try pasting this into your bash shell (windows invocation will be similar but maybe not identical):', ` ( cd ${p.cwd} ; node --loader ../../../esm.mjs ./${entrypoint} )`, ].join('\n') ); } } } function fileInfo(filename: string, typeModule: boolean, allowJs: boolean) { const ext = filename.match(/\.(.*)$/)?.[1] ?? filename; // ['ts', 'tsx', 'cts', 'mts', 'js', 'jsx', 'cjs', 'mjs'] return { ext, isMjs: ['mts', 'mjs'].includes(ext) ? true : ['cts', 'cjs'].includes(ext) ? false : typeModule, isCompiled: allowJs || ['ts', 'tsx', 'jsx', 'mts', 'cts'].includes(ext), }; } function seqGenerator() { let next = 0; return function () { return padStart('' + next++, 4, '0'); }; } ts-node-10.9.2/src/test/sourcemaps.spec.ts000066400000000000000000000014721453460306300204140ustar00rootroot00000000000000import * as expect from 'expect'; import { createExec, createExecTester } from './exec-helpers'; import { CMD_TS_NODE_WITH_PROJECT_FLAG, ctxTsNode, TEST_DIR } from './helpers'; import { context } from './testlib'; const test = context(ctxTsNode); const exec = createExecTester({ cmd: CMD_TS_NODE_WITH_PROJECT_FLAG, exec: createExec({ cwd: TEST_DIR, }), }); test('Redirects source-map-support to @cspotcode/source-map-support so that third-party libraries get correct source-mapped locations', async () => { const { stdout } = await exec({ flags: `./legacy-source-map-support-interop/index.ts`, }); expect(stdout.split('\n')).toMatchObject([ expect.stringContaining('.ts:2 '), 'true', 'true', expect.stringContaining('.ts:100:'), expect.stringContaining('.ts:101 '), '', ]); }); ts-node-10.9.2/src/test/test-loader.d.ts000066400000000000000000000002011453460306300177340ustar00rootroot00000000000000export {}; declare global { namespace NodeJS { interface Process { __test_setloader__(hooks: any): void; } } } ts-node-10.9.2/src/test/test-loader.mjs000066400000000000000000000012621453460306300176650ustar00rootroot00000000000000// Grant ourselves the ability to install ESM loader behaviors in-process during tests import semver from 'semver'; const newHooksAPI = semver.gte(process.versions.node, '16.12.0'); let hooks = undefined; process.__test_setloader__ = function (_hooks) { hooks = _hooks; }; function createHook(name) { return function (a, b, c) { const target = (hooks && hooks[name]) || c; return target(...arguments); }; } export const resolve = createHook('resolve'); export const load = newHooksAPI ? createHook('load') : null; export const getFormat = !newHooksAPI ? createHook('getFormat') : null; export const transformSource = !newHooksAPI ? createHook('transformSource') : null; ts-node-10.9.2/src/test/testlib.ts000066400000000000000000000250061453460306300167470ustar00rootroot00000000000000/* * Extensions to ava, for declaring and running test cases and suites * Utilities specific to testing ts-node, for example handling streams and exec-ing processes, * should go in a separate module. */ import avaTest, { ExecutionContext, Implementation, OneOrMoreMacros, } from 'ava'; import * as assert from 'assert'; import throat from 'throat'; import * as expect from 'expect'; export { ExecutionContext, expect }; // HACK ensure ts-node-specific bootstrapping is executed import './helpers'; // NOTE: this limits concurrency within a single process, but AVA launches // each .spec file in its own process, so actual concurrency is higher. const concurrencyLimiter = throat(16); function errorPostprocessor(fn: T): T { return async function (this: any) { try { return await fn.call(this, arguments); } catch (error: any) { delete error?.matcherResult; // delete error?.matcherResult?.message; if (error?.message) error.message = `\n${error.message}\n`; throw error; } } as any; } function once(func: T): T { let run = false; let ret: any = undefined; return function (...args: any[]) { if (run) return ret; run = true; ret = func(...args); return ret; } as any as T; } export const test = createTestInterface({ beforeEachFunctions: [], mustDoSerial: false, automaticallyDoSerial: false, automaticallySkip: false, // The little right chevron used by ava separator: ' \u203a ', titlePrefix: undefined, }); // In case someone wants to `const test = context()` export const context = test.context; export interface TestInterface< Context > /*extends Omit, 'before' | 'beforeEach' | 'after' | 'afterEach' | 'failing' | 'serial'>*/ { //#region copy-pasted from ava's .d.ts /** Declare a concurrent test. */ (title: string, implementation: Implementation): void; /** Declare a concurrent test that uses one or more macros. Additional arguments are passed to the macro. */ ( title: string, macros: OneOrMoreMacros, ...rest: T ): void; /** Declare a concurrent test that uses one or more macros. The macro is responsible for generating a unique test title. */ (macros: OneOrMoreMacros, ...rest: T): void; //#endregion serial(title: string, implementation: Implementation): void; /** Declare a concurrent test that uses one or more macros. Additional arguments are passed to the macro. */ serial( title: string, macros: OneOrMoreMacros, ...rest: T ): void; /** Declare a concurrent test that uses one or more macros. The macro is responsible for generating a unique test title. */ serial( macros: OneOrMoreMacros, ...rest: T ): void; skip(title: string, implementation: Implementation): void; /** Declare a concurrent test that uses one or more macros. Additional arguments are passed to the macro. */ skip( title: string, macros: OneOrMoreMacros, ...rest: T ): void; /** Declare a concurrent test that uses one or more macros. The macro is responsible for generating a unique test title. */ skip(macros: OneOrMoreMacros, ...rest: T): void; macro( cb: ( ...args: Args ) => | [ ((title: string | undefined) => string | undefined) | string, (t: ExecutionContext) => Promise ] | ((t: ExecutionContext) => Promise) ): AvaMacro; beforeAll(cb: (t: ExecutionContext) => Promise): void; beforeEach(cb: (t: ExecutionContext) => Promise): void; context( cb: (t: ExecutionContext) => Promise ): TestInterface; suite(title: string, cb: (test: TestInterface) => void): void; runSerially(): void; /** Skip tests unless this condition is met */ skipUnless(conditional: boolean): void; /** If conditional is true, run tests, otherwise skip them */ runIf(conditional: boolean): void; /** If conditional is false, skip tests */ skipIf(conditional: boolean): void; // TODO add teardownEach } export interface AvaMacro { (test: ExecutionContext, ...args: Args): Promise; title?(givenTitle: string | undefined, ...args: Args): string; } function createTestInterface(opts: { titlePrefix: string | undefined; separator: string | undefined; mustDoSerial: boolean; automaticallyDoSerial: boolean; automaticallySkip: boolean; beforeEachFunctions: Function[]; }): TestInterface { const { titlePrefix, separator = ' > ' } = opts; const beforeEachFunctions = [...(opts.beforeEachFunctions ?? [])]; let { mustDoSerial, automaticallyDoSerial, automaticallySkip } = opts; let hookDeclared = false; let suiteOrTestDeclared = false; function computeTitle( title: string | undefined, macros?: AvaMacro[], ...args: Args ) { for (const macro of macros ?? []) { if (macro.title) { title = macro.title(title, ...args); } } assert(title); // return `${ titlePrefix }${ separator }${ title }`; if (titlePrefix != null && title != null) { return `${titlePrefix}${separator}${title}`; } if (titlePrefix == null && title != null) { return title; } } function parseArgs(args: any[]) { const title = typeof args[0] === 'string' ? (args.shift() as string) : undefined; const macros = typeof args[0] === 'function' ? [args.shift() as AvaMacro] : Array.isArray(args[0]) ? (args.shift() as AvaMacro[]) : []; return { title, macros, args }; } function assertOrderingForDeclaringTest() { suiteOrTestDeclared = true; } function assertOrderingForDeclaringHook() { if (suiteOrTestDeclared) { throw new Error( 'Hooks must be declared before declaring sub-suites or tests' ); } hookDeclared = true; } function assertOrderingForDeclaringSkipUnless() { if (suiteOrTestDeclared) { throw new Error( 'skipUnless or runIf must be declared before declaring sub-suites or tests' ); } } /** * @param avaDeclareFunction either test or test.serial */ function declareTest( title: string | undefined, macros: AvaMacro[], avaDeclareFunction: Function & { skip: Function }, args: any[], skip = false ) { const wrappedMacros = macros.map((macro) => { return async function (t: ExecutionContext, ...args: any[]) { return concurrencyLimiter( errorPostprocessor(async () => { let i = 0; for (const func of beforeEachFunctions) { await func(t); i++; } return macro(t, ...args); }) ); }; }); const computedTitle = computeTitle(title, macros, ...args); (automaticallySkip || skip ? avaDeclareFunction.skip : avaDeclareFunction)( computedTitle, wrappedMacros, ...args ); } function test(...inputArgs: any[]) { assertOrderingForDeclaringTest(); // TODO is this safe to disable? // X parallel tests will each invoke the beforeAll hook, but once()ification means each invocation will return the same promise, and tests cannot // start till it finishes. // HOWEVER if it returns a single shared state, can tests concurrently use this shared state? // if(!automaticallyDoSerial && mustDoSerial) throw new Error('Cannot declare non-serial tests because you have declared a beforeAll() hook for this test suite.'); const { args, macros, title } = parseArgs(inputArgs); return declareTest( title, macros, automaticallyDoSerial ? avaTest.serial : avaTest, args ); } test.serial = function (...inputArgs: any[]) { assertOrderingForDeclaringTest(); const { args, macros, title } = parseArgs(inputArgs); return declareTest(title, macros, avaTest.serial, args); }; test.skip = function (...inputArgs: any[]) { assertOrderingForDeclaringTest(); const { args, macros, title } = parseArgs(inputArgs); return declareTest(title, macros, avaTest, args, true); }; test.beforeEach = function ( cb: (test: ExecutionContext) => Promise ) { assertOrderingForDeclaringHook(); beforeEachFunctions.push(cb); }; test.context = function ( cb: (test: ExecutionContext) => Promise ) { assertOrderingForDeclaringHook(); beforeEachFunctions.push(async (t: ExecutionContext) => { const addedContextFields = await cb(t); Object.assign(t.context, addedContextFields); }); return test; }; test.beforeAll = function ( cb: (test: ExecutionContext) => Promise ) { assertOrderingForDeclaringHook(); mustDoSerial = true; beforeEachFunctions.push(once(cb)); }; test.macro = function ( cb: ( ...args: Args ) => | [ ((title: string | undefined) => string | undefined) | string, (t: ExecutionContext) => Promise ] | ((t: ExecutionContext) => Promise) ) { function macro(testInterface: ExecutionContext, ...args: Args) { const ret = cb(...args); const macroFunction = Array.isArray(ret) ? ret[1] : ret; return macroFunction(testInterface); } macro.title = function (givenTitle: string | undefined, ...args: Args) { const ret = cb(...args); return Array.isArray(ret) ? typeof ret[0] === 'string' ? ret[0] : ret[0](givenTitle) : givenTitle; }; return macro; }; test.suite = function ( title: string, cb: (test: TestInterface) => void ) { suiteOrTestDeclared = true; const newApi = createTestInterface({ mustDoSerial, automaticallyDoSerial, automaticallySkip, separator, titlePrefix: computeTitle(title), beforeEachFunctions, }); cb(newApi); }; test.runSerially = function () { automaticallyDoSerial = true; }; test.skipUnless = test.runIf = function (runIfTrue: boolean) { assertOrderingForDeclaringSkipUnless(); automaticallySkip = automaticallySkip || !runIfTrue; }; test.skipIf = function (skipIfTrue: boolean) { test.runIf(!skipIfTrue); }; return test as any; } ts-node-10.9.2/src/test/transpilers.spec.ts000066400000000000000000000123201453460306300205730ustar00rootroot00000000000000// third-party transpiler and swc transpiler tests // TODO: at the time of writing, other transpiler tests have not been moved into this file. // Should consolidate them here. import { context } from './testlib'; import { ctxTsNode, testsDirRequire, tsSupportsImportAssertions, tsSupportsReact17JsxFactories, } from './helpers'; import { createSwcOptions } from '../transpilers/swc'; import * as expect from 'expect'; import { outdent } from 'outdent'; const test = context(ctxTsNode); test.suite('swc', (test) => { test('verify that TS->SWC target mappings suppport all possible values from both TS and SWC', async (t) => { const swcTranspiler = testsDirRequire( 'ts-node/transpilers/swc-experimental' ) as typeof import('../transpilers/swc'); // Detect when mapping is missing any ts.ScriptTargets const ts = testsDirRequire('typescript') as typeof import('typescript'); for (const key of Object.keys(ts.ScriptTarget)) { if (/^\d+$/.test(key)) continue; if (key === 'JSON') continue; expect( swcTranspiler.targetMapping.has(ts.ScriptTarget[key as any] as any) ).toBe(true); } // Detect when mapping is missing any swc targets // Assuming that tests/package.json declares @swc/core: latest const swc = testsDirRequire('@swc/core'); let msg: string | undefined = undefined; try { swc.transformSync('', { jsc: { target: 'invalid' } }); } catch (e) { msg = (e as Error).message; } expect(msg).toBeDefined(); // Error looks like: // unknown variant `invalid`, expected one of `es3`, `es5`, `es2015`, `es2016`, `es2017`, `es2018`, `es2019`, `es2020`, `es2021` at line 1 column 28 const match = msg!.match(/unknown variant.*, expected one of (.*) at line/); expect(match).toBeDefined(); const targets = match![1].split(', ').map((v: string) => v.slice(1, -1)); for (const target of targets) { expect([...swcTranspiler.targetMapping.values()]).toContain(target); } }); test.suite('converts TS config to swc config', (test) => { test.suite('jsx', (test) => { const macro = test.macro( (jsx: string, runtime?: string, development?: boolean) => [ () => `jsx=${jsx}`, async (t) => { const tsNode = t.context.tsNodeUnderTest.create({ compilerOptions: { jsx, }, }); const swcOptions = createSwcOptions( tsNode.config.options, undefined, require('@swc/core'), '@swc/core' ); expect(swcOptions.tsxOptions.jsc?.transform?.react).toBeDefined(); expect( swcOptions.tsxOptions.jsc?.transform?.react?.development ).toBe(development); expect(swcOptions.tsxOptions.jsc?.transform?.react?.runtime).toBe( runtime ); }, ] ); test(macro, 'react', undefined, undefined); test.suite('react 17 jsx factories', (test) => { test.runIf(tsSupportsReact17JsxFactories); test(macro, 'react-jsx', 'automatic', undefined); test(macro, 'react-jsxdev', 'automatic', true); }); }); }); const compileMacro = test.macro( (compilerOptions: object, input: string, expectedOutput: string) => [ (title?: string) => title ?? `${JSON.stringify(compilerOptions)}`, async (t) => { const code = t.context.tsNodeUnderTest .create({ swc: true, skipProject: true, compilerOptions: { module: 'esnext', ...compilerOptions, }, }) .compile(input, 'input.tsx'); expect(code.replace(/\/\/# sourceMappingURL.*/, '').trim()).toBe( expectedOutput ); }, ] ); test.suite('transforms various forms of jsx', (test) => { const input = outdent` const div =
; `; test( compileMacro, { jsx: 'react' }, input, `const div = /*#__PURE__*/ React.createElement("div", null);` ); test.suite('react 17 jsx factories', (test) => { test.runIf(tsSupportsReact17JsxFactories); test( compileMacro, { jsx: 'react-jsx' }, input, outdent` import { jsx as _jsx } from "react/jsx-runtime"; const div = /*#__PURE__*/ _jsx("div", {}); ` ); test( compileMacro, { jsx: 'react-jsxdev' }, input, outdent` import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; const div = /*#__PURE__*/ _jsxDEV("div", {}, void 0, false, { fileName: "input.tsx", lineNumber: 1, columnNumber: 13 }, this); ` ); }); }); test.suite('preserves import assertions for json imports', (test) => { test.runIf(tsSupportsImportAssertions); test( 'basic json import', compileMacro, { module: 'esnext' }, outdent` import document from './document.json' assert {type: 'json'}; document; `, outdent` import document from './document.json' assert { type: 'json' }; document; ` ); }); }); ts-node-10.9.2/src/test/ts-import-specifiers.spec.ts000066400000000000000000000011521453460306300223160ustar00rootroot00000000000000import { context } from './testlib'; import * as expect from 'expect'; import { createExec } from './exec-helpers'; import { TEST_DIR, ctxTsNode, CMD_TS_NODE_WITHOUT_PROJECT_FLAG, } from './helpers'; const exec = createExec({ cwd: TEST_DIR, }); const test = context(ctxTsNode); test('Supports .ts extensions in import specifiers with typechecking, even though vanilla TS checker does not', async () => { const { err, stdout } = await exec( `${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} ts-import-specifiers/index.ts` ); expect(err).toBe(null); expect(stdout.trim()).toBe('{ foo: true, bar: true }'); }); ts-node-10.9.2/src/transpilers/000077500000000000000000000000001453460306300163155ustar00rootroot00000000000000ts-node-10.9.2/src/transpilers/swc.ts000066400000000000000000000217361453460306300174720ustar00rootroot00000000000000import type * as ts from 'typescript'; import type * as swcWasm from '@swc/wasm'; import type * as swcTypes from '@swc/core'; import type { CreateTranspilerOptions, Transpiler } from './types'; import type { NodeModuleEmitKind } from '..'; import { getUseDefineForClassFields } from '../ts-internals'; type SwcInstance = typeof swcTypes; export interface SwcTranspilerOptions extends CreateTranspilerOptions { /** * swc compiler to use for compilation * Set to '@swc/wasm' to use swc's WASM compiler * Default: '@swc/core', falling back to '@swc/wasm' */ swc?: string | typeof swcWasm; } export function create(createOptions: SwcTranspilerOptions): Transpiler { const { swc, service: { config, projectLocalResolveHelper }, transpilerConfigLocalResolveHelper, nodeModuleEmitKind, } = createOptions; // Load swc compiler let swcInstance: SwcInstance; // Used later in diagnostics; merely needs to be human-readable. let swcDepName: string = 'swc'; if (typeof swc === 'string') { swcDepName = swc; swcInstance = require(transpilerConfigLocalResolveHelper(swc, true)) as SwcInstance; } else if (swc == null) { let swcResolved; try { swcDepName = '@swc/core'; swcResolved = transpilerConfigLocalResolveHelper(swcDepName, true); } catch (e) { try { swcDepName = '@swc/wasm'; swcResolved = transpilerConfigLocalResolveHelper(swcDepName, true); } catch (e) { throw new Error( 'swc compiler requires either @swc/core or @swc/wasm to be installed as a dependency. See https://typestrong.org/ts-node/docs/transpilers' ); } } swcInstance = require(swcResolved) as SwcInstance; } else { swcInstance = swc as any as SwcInstance; } // Prepare SWC options derived from typescript compiler options const { nonTsxOptions, tsxOptions } = createSwcOptions(config.options, nodeModuleEmitKind, swcInstance, swcDepName); const transpile: Transpiler['transpile'] = (input, transpileOptions) => { const { fileName } = transpileOptions; const swcOptions = fileName.endsWith('.tsx') || fileName.endsWith('.jsx') ? tsxOptions : nonTsxOptions; const { code, map } = swcInstance.transformSync(input, { ...swcOptions, filename: fileName, }); return { outputText: code, sourceMapText: map }; }; return { transpile, }; } /** @internal */ export const targetMapping = new Map(); targetMapping.set(/* ts.ScriptTarget.ES3 */ 0, 'es3'); targetMapping.set(/* ts.ScriptTarget.ES5 */ 1, 'es5'); targetMapping.set(/* ts.ScriptTarget.ES2015 */ 2, 'es2015'); targetMapping.set(/* ts.ScriptTarget.ES2016 */ 3, 'es2016'); targetMapping.set(/* ts.ScriptTarget.ES2017 */ 4, 'es2017'); targetMapping.set(/* ts.ScriptTarget.ES2018 */ 5, 'es2018'); targetMapping.set(/* ts.ScriptTarget.ES2019 */ 6, 'es2019'); targetMapping.set(/* ts.ScriptTarget.ES2020 */ 7, 'es2020'); targetMapping.set(/* ts.ScriptTarget.ES2021 */ 8, 'es2021'); targetMapping.set(/* ts.ScriptTarget.ES2022 */ 9, 'es2022'); targetMapping.set(/* ts.ScriptTarget.ESNext */ 99, 'esnext'); type SwcTarget = typeof swcTargets[number]; /** * @internal * We use this list to downgrade to a prior target when we probe swc to detect if it supports a particular target */ const swcTargets = [ 'es3', 'es5', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', ] as const; const ModuleKind = { None: 0, CommonJS: 1, AMD: 2, UMD: 3, System: 4, ES2015: 5, ES2020: 6, ESNext: 99, Node16: 100, NodeNext: 199, } as const; const JsxEmit = { ReactJSX: /* ts.JsxEmit.ReactJSX */ 4, ReactJSXDev: /* ts.JsxEmit.ReactJSXDev */ 5, } as const; /** * Prepare SWC options derived from typescript compiler options. * @internal exported for testing */ export function createSwcOptions( compilerOptions: ts.CompilerOptions, nodeModuleEmitKind: NodeModuleEmitKind | undefined, swcInstance: SwcInstance, swcDepName: string ) { const { esModuleInterop, sourceMap, importHelpers, experimentalDecorators, emitDecoratorMetadata, target, module, jsx, jsxFactory, jsxFragmentFactory, strict, alwaysStrict, noImplicitUseStrict, jsxImportSource, } = compilerOptions; let swcTarget = targetMapping.get(target!) ?? 'es3'; // Downgrade to lower target if swc does not support the selected target. // Perhaps project has an older version of swc. // TODO cache the results of this; slightly faster let swcTargetIndex = swcTargets.indexOf(swcTarget); for (; swcTargetIndex >= 0; swcTargetIndex--) { try { swcInstance.transformSync('', { jsc: { target: swcTargets[swcTargetIndex] as swcWasm.JscTarget }, }); break; } catch (e) {} } swcTarget = swcTargets[swcTargetIndex]; const keepClassNames = target! >= /* ts.ScriptTarget.ES2016 */ 3; const isNodeModuleKind = module === ModuleKind.Node16 || module === ModuleKind.NodeNext; // swc only supports these 4x module options [MUST_UPDATE_FOR_NEW_MODULEKIND] const moduleType = module === ModuleKind.CommonJS ? 'commonjs' : module === ModuleKind.AMD ? 'amd' : module === ModuleKind.UMD ? 'umd' : isNodeModuleKind && nodeModuleEmitKind === 'nodecjs' ? 'commonjs' : isNodeModuleKind && nodeModuleEmitKind === 'nodeesm' ? 'es6' : 'es6'; // In swc: // strictMode means `"use strict"` is *always* emitted for non-ES module, *never* for ES module where it is assumed it can be omitted. // (this assumption is invalid, but that's the way swc behaves) // tsc is a bit more complex: // alwaysStrict will force emitting it always unless `import`/`export` syntax is emitted which implies it per the JS spec. // if not alwaysStrict, will emit implicitly whenever module target is non-ES *and* transformed module syntax is emitted. // For node, best option is to assume that all scripts are modules (commonjs or esm) and thus should get tsc's implicit strict behavior. // Always set strictMode, *unless* alwaysStrict is disabled and noImplicitUseStrict is enabled const strictMode = // if `alwaysStrict` is disabled, remembering that `strict` defaults `alwaysStrict` to true (alwaysStrict === false || (alwaysStrict !== true && strict !== true)) && // if noImplicitUseStrict is enabled noImplicitUseStrict === true ? false : true; const jsxRuntime: swcTypes.ReactConfig['runtime'] = jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev ? 'automatic' : undefined; const jsxDevelopment: swcTypes.ReactConfig['development'] = jsx === JsxEmit.ReactJSXDev ? true : undefined; const useDefineForClassFields = getUseDefineForClassFields(compilerOptions); const nonTsxOptions = createVariant(false); const tsxOptions = createVariant(true); return { nonTsxOptions, tsxOptions }; function createVariant(isTsx: boolean): swcTypes.Options { const swcOptions: swcTypes.Options = { sourceMaps: sourceMap, // isModule: true, module: moduleType ? { type: moduleType, ...(moduleType === 'amd' || moduleType === 'commonjs' || moduleType === 'umd' ? { noInterop: !esModuleInterop, strictMode, // For NodeNext and Node12, emit as CJS but do not transform dynamic imports ignoreDynamic: nodeModuleEmitKind === 'nodecjs', } : {}), } : undefined, swcrc: false, jsc: { externalHelpers: importHelpers, parser: { syntax: 'typescript', tsx: isTsx, decorators: experimentalDecorators, dynamicImport: true, importAssertions: true, } as swcWasm.TsParserConfig, target: swcTarget as swcWasm.JscTarget, transform: { decoratorMetadata: emitDecoratorMetadata, legacyDecorator: true, react: { throwIfNamespace: false, development: jsxDevelopment, useBuiltins: false, pragma: jsxFactory!, pragmaFrag: jsxFragmentFactory!, runtime: jsxRuntime, importSource: jsxImportSource, }, useDefineForClassFields, }, keepClassNames, experimental: { keepImportAttributes: true, emitAssertForImportAttributes: true, } as swcTypes.JscConfig['experimental'], }, }; // Throw a helpful error if swc version is old, for example, if it rejects `ignoreDynamic` try { swcInstance.transformSync('', swcOptions); } catch (e) { throw new Error( `${swcDepName} threw an error when attempting to validate swc compiler options.\n` + 'You may be using an old version of swc which does not support the options used by ts-node.\n' + 'Try upgrading to the latest version of swc.\n' + 'Error message from swc:\n' + (e as Error)?.message ); } return swcOptions; } } ts-node-10.9.2/src/transpilers/types.ts000066400000000000000000000036621453460306300200400ustar00rootroot00000000000000import type * as ts from 'typescript'; import type { NodeModuleEmitKind, Service } from '../index'; import type { ProjectLocalResolveHelper } from '../util'; /** * Third-party transpilers are implemented as a CommonJS module with a * named export "create" * * @category Transpiler */ export interface TranspilerModule { create: TranspilerFactory; } /** * Called by ts-node to create a custom transpiler. * * @category Transpiler */ export type TranspilerFactory = ( options: CreateTranspilerOptions ) => Transpiler; /** @category Transpiler */ export interface CreateTranspilerOptions { // TODO this is confusing because its only a partial Service. Rename? // Careful: must avoid stripInternal breakage by guarding with Extract<> service: Pick< Service, Extract<'config' | 'options' | 'projectLocalResolveHelper', keyof Service> >; /** * If `"transpiler"` option is declared in an "extends" tsconfig, this path might be different than * the `projectLocalResolveHelper` * * @internal */ transpilerConfigLocalResolveHelper: ProjectLocalResolveHelper; /** * When using `module: nodenext` or `module: node12`, there are two possible styles of emit: * - CommonJS with dynamic imports preserved (not transformed into `require()` calls) * - ECMAScript modules with `import foo = require()` transformed into `require = createRequire(); const foo = require()` * @internal */ nodeModuleEmitKind?: NodeModuleEmitKind; } /** @category Transpiler */ export interface Transpiler { // TODOs // Create spec for returning diagnostics? Currently transpilers are allowed to // throw an error but that's it. transpile(input: string, options: TranspileOptions): TranspileOutput; } /** @category Transpiler */ export interface TranspileOptions { fileName: string; } /** @category Transpiler */ export interface TranspileOutput { outputText: string; diagnostics?: ts.Diagnostic[]; sourceMapText?: string; } ts-node-10.9.2/src/ts-compiler-types.ts000066400000000000000000000140151453460306300177200ustar00rootroot00000000000000import type * as _ts from 'typescript'; /** * Common TypeScript interfaces between versions. We endeavour to write ts-node's own code against these types instead * of against `import "typescript"`, though we are not yet doing this consistently. * * Sometimes typescript@next adds an API we need to use. But we build ts-node against typescript@latest. * In these cases, we must declare that API explicitly here. Our declarations include the newer typescript@next APIs. * Importantly, these re-declarations are *not* TypeScript internals. They are public APIs that only exist in * pre-release versions of typescript. */ export interface TSCommon { version: typeof _ts.version; sys: typeof _ts.sys; ScriptSnapshot: typeof _ts.ScriptSnapshot; displayPartsToString: typeof _ts.displayPartsToString; createLanguageService: typeof _ts.createLanguageService; getDefaultLibFilePath: typeof _ts.getDefaultLibFilePath; getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics; flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText; transpileModule: typeof _ts.transpileModule; ModuleKind: TSCommon.ModuleKindEnum; ScriptTarget: typeof _ts.ScriptTarget; findConfigFile: typeof _ts.findConfigFile; readConfigFile: typeof _ts.readConfigFile; parseJsonConfigFileContent: typeof _ts.parseJsonConfigFileContent; formatDiagnostics: typeof _ts.formatDiagnostics; formatDiagnosticsWithColorAndContext: typeof _ts.formatDiagnosticsWithColorAndContext; createDocumentRegistry: typeof _ts.createDocumentRegistry; JsxEmit: typeof _ts.JsxEmit; createModuleResolutionCache: typeof _ts.createModuleResolutionCache; resolveModuleName: typeof _ts.resolveModuleName; resolveModuleNameFromCache: typeof _ts.resolveModuleNameFromCache; resolveTypeReferenceDirective: typeof _ts.resolveTypeReferenceDirective; createIncrementalCompilerHost: typeof _ts.createIncrementalCompilerHost; createSourceFile: typeof _ts.createSourceFile; getDefaultLibFileName: typeof _ts.getDefaultLibFileName; createIncrementalProgram: typeof _ts.createIncrementalProgram; createEmitAndSemanticDiagnosticsBuilderProgram: typeof _ts.createEmitAndSemanticDiagnosticsBuilderProgram; Extension: typeof _ts.Extension; ModuleResolutionKind: typeof _ts.ModuleResolutionKind; } export namespace TSCommon { export interface LanguageServiceHost extends _ts.LanguageServiceHost {} export type ModuleResolutionHost = _ts.ModuleResolutionHost; export type ParsedCommandLine = _ts.ParsedCommandLine; export type ResolvedModule = _ts.ResolvedModule; export type ResolvedTypeReferenceDirective = _ts.ResolvedTypeReferenceDirective; export type CompilerOptions = _ts.CompilerOptions; export type ResolvedProjectReference = _ts.ResolvedProjectReference; export type ResolvedModuleWithFailedLookupLocations = _ts.ResolvedModuleWithFailedLookupLocations; export type FileReference = _ts.FileReference; export type SourceFile = _ts.SourceFile; // Hack until we start building against TS >= 4.7.0 export type ModuleKindEnum = typeof _ts.ModuleKind & { Node16: typeof _ts.ModuleKind extends { Node16: any } ? typeof _ts.ModuleKind['Node16'] : 100; }; // Can't figure out how to re-export an enum // `export import ... =` complains that _ts is type-only import export namespace ModuleKind { export type CommonJS = _ts.ModuleKind.CommonJS; export type ESNext = _ts.ModuleKind.ESNext; } } /** * Compiler APIs we use that are marked internal and not included in TypeScript's public API declarations * @internal */ export interface TSInternal { // https://github.com/microsoft/TypeScript/blob/4a34294908bed6701dcba2456ca7ac5eafe0ddff/src/compiler/core.ts#L1906-L1909 createGetCanonicalFileName( useCaseSensitiveFileNames: boolean ): TSInternal.GetCanonicalFileName; // https://github.com/microsoft/TypeScript/blob/c117c266e09c80e8a06b24a6e94b9d018f5fae6b/src/compiler/commandLineParser.ts#L2054 convertToTSConfig( configParseResult: _ts.ParsedCommandLine, configFileName: string, host: TSInternal.ConvertToTSConfigHost ): any; libs?: string[]; Diagnostics: { File_0_not_found: _ts.DiagnosticMessage; }; createCompilerDiagnostic( message: _ts.DiagnosticMessage, ...args: (string | number | undefined)[] ): _ts.Diagnostic; nodeModuleNameResolver( moduleName: string, containingFile: string, compilerOptions: _ts.CompilerOptions, host: _ts.ModuleResolutionHost, cache?: _ts.ModuleResolutionCache, redirectedReference?: _ts.ResolvedProjectReference, conditionsOrIsConfigLookup?: string[] | boolean, // `conditions` parameter added in TS 5.3 isConfigLookup?: boolean ): _ts.ResolvedModuleWithFailedLookupLocations; // Added in TS 4.7 getModeForFileReference?: ( ref: _ts.FileReference | string, containingFileMode: _ts.SourceFile['impliedNodeFormat'] ) => _ts.SourceFile['impliedNodeFormat']; // TODO do we need these? Which TS version adds them? getPatternFromSpec( spec: string, basePath: string, usage: 'files' | 'directories' | 'exclude' ): string | undefined; getRegularExpressionForWildcard( specs: readonly string[] | undefined, basePath: string, usage: 'files' | 'directories' | 'exclude' ): string | undefined; // Added in TS 4.7 getModeForResolutionAtIndex?( file: TSInternal.SourceFileImportsList, index: number ): _ts.SourceFile['impliedNodeFormat']; } /** @internal */ export namespace TSInternal { // https://github.com/microsoft/TypeScript/blob/4a34294908bed6701dcba2456ca7ac5eafe0ddff/src/compiler/core.ts#L1906 export type GetCanonicalFileName = (fileName: string) => string; // https://github.com/microsoft/TypeScript/blob/c117c266e09c80e8a06b24a6e94b9d018f5fae6b/src/compiler/commandLineParser.ts#L2041 export interface ConvertToTSConfigHost { getCurrentDirectory(): string; useCaseSensitiveFileNames: boolean; } // Note: is only a partial declaration, TS sources declare other fields export interface SourceFileImportsList { impliedNodeFormat?: TSCommon.SourceFile['impliedNodeFormat']; } } ts-node-10.9.2/src/ts-internals.ts000066400000000000000000000332161453460306300167470ustar00rootroot00000000000000import { isAbsolute, resolve } from 'path'; import { cachedLookup, normalizeSlashes, versionGteLt } from './util'; import type * as _ts from 'typescript'; import type { TSCommon, TSInternal } from './ts-compiler-types'; /** @internal */ export const createTsInternals = cachedLookup(createTsInternalsUncached); /** * Given a reference to the TS compiler, return some TS internal functions that we * could not or did not want to grab off the `ts` object. * These have been copy-pasted from TS's source and tweaked as necessary. * * NOTE: This factory returns *only* functions which need a reference to the TS * compiler. Other functions do not need a reference to the TS compiler so are * exported directly from this file. */ function createTsInternalsUncached(_ts: TSCommon) { const ts = _ts as TSCommon & TSInternal; /** * Copied from: * https://github.com/microsoft/TypeScript/blob/v4.3.2/src/compiler/commandLineParser.ts#L2821-L2846 */ function getExtendsConfigPath( extendedConfig: string, host: _ts.ParseConfigHost, basePath: string, errors: _ts.Push<_ts.Diagnostic>, createDiagnostic: ( message: _ts.DiagnosticMessage, arg1?: string ) => _ts.Diagnostic ) { extendedConfig = normalizeSlashes(extendedConfig); if ( isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, './') || startsWith(extendedConfig, '../') ) { let extendedConfigPath = getNormalizedAbsolutePath( extendedConfig, basePath ); if ( !host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ts.Extension.Json) ) { extendedConfigPath = `${extendedConfigPath}.json`; if (!host.fileExists(extendedConfigPath)) { errors.push( createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig) ); return undefined; } } return extendedConfigPath; } // If the path isn't a rooted or relative path, resolve like a module const tsGte5_3_0 = versionGteLt(ts.version, '5.3.0'); const resolved = ts.nodeModuleNameResolver( extendedConfig, combinePaths(basePath, 'tsconfig.json'), { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, /*cache*/ undefined, /*projectRefs*/ undefined, /*conditionsOrIsConfigLookup*/ tsGte5_3_0 ? undefined : true, /*isConfigLookup*/ tsGte5_3_0 ? true : undefined ); if (resolved.resolvedModule) { return resolved.resolvedModule.resolvedFileName; } errors.push( createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig) ); return undefined; } return { getExtendsConfigPath }; } // These functions have alternative implementation to avoid copying too much from TS function isRootedDiskPath(path: string) { return isAbsolute(path); } function combinePaths(path: string, ...paths: (string | undefined)[]): string { return normalizeSlashes( resolve(path, ...(paths.filter((path) => path) as string[])) ); } function getNormalizedAbsolutePath( fileName: string, currentDirectory: string | undefined ) { return normalizeSlashes( currentDirectory != null ? resolve(currentDirectory!, fileName) : resolve(fileName) ); } function startsWith(str: string, prefix: string): boolean { return str.lastIndexOf(prefix, 0) === 0; } function endsWith(str: string, suffix: string): boolean { const expectedPos = str.length - suffix.length; return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; } // Reserved characters, forces escaping of any non-word (or digit), non-whitespace character. // It may be inefficient (we could just match (/[-[\]{}()*+?.,\\^$|#\s]/g), but this is future // proof. const reservedCharacterPattern = /[^\w\s\/]/g; /** * @internal * See also: getRegularExpressionForWildcard, which seems to do almost the same thing */ export function getPatternFromSpec(spec: string, basePath: string) { const pattern = spec && getSubPatternFromSpec(spec, basePath, excludeMatcher); return pattern && `^(${pattern})${'($|/)'}`; } function getSubPatternFromSpec( spec: string, basePath: string, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter, }: WildcardMatcher ): string { let subpattern = ''; let hasWrittenComponent = false; const components = getNormalizedPathComponents(spec, basePath); const lastComponent = last(components); // getNormalizedPathComponents includes the separator for the root component. // We need to remove to create our regex correctly. components[0] = removeTrailingDirectorySeparator(components[0]); if (isImplicitGlob(lastComponent)) { components.push('**', '*'); } let optionalCount = 0; for (let component of components) { if (component === '**') { subpattern += doubleAsteriskRegexFragment; } else { if (hasWrittenComponent) { subpattern += directorySeparator; } subpattern += component.replace( reservedCharacterPattern, replaceWildcardCharacter ); } hasWrittenComponent = true; } while (optionalCount > 0) { subpattern += ')?'; optionalCount--; } return subpattern; } interface WildcardMatcher { singleAsteriskRegexFragment: string; doubleAsteriskRegexFragment: string; replaceWildcardCharacter: (match: string) => string; } const directoriesMatcher: WildcardMatcher = { singleAsteriskRegexFragment: '[^/]*', /** * Regex for the ** wildcard. Matches any num of subdirectories. When used for including * files or directories, does not match subdirectories that start with a . character */ doubleAsteriskRegexFragment: `(/[^/.][^/]*)*?`, replaceWildcardCharacter: (match) => replaceWildcardCharacter( match, directoriesMatcher.singleAsteriskRegexFragment ), }; const excludeMatcher: WildcardMatcher = { singleAsteriskRegexFragment: '[^/]*', doubleAsteriskRegexFragment: '(/.+?)?', replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment), }; function getNormalizedPathComponents( path: string, currentDirectory: string | undefined ) { return reducePathComponents(getPathComponents(path, currentDirectory)); } function getPathComponents(path: string, currentDirectory = '') { path = combinePaths(currentDirectory, path); return pathComponents(path, getRootLength(path)); } function reducePathComponents(components: readonly string[]) { if (!some(components)) return []; const reduced = [components[0]]; for (let i = 1; i < components.length; i++) { const component = components[i]; if (!component) continue; if (component === '.') continue; if (component === '..') { if (reduced.length > 1) { if (reduced[reduced.length - 1] !== '..') { reduced.pop(); continue; } } else if (reduced[0]) continue; } reduced.push(component); } return reduced; } function getRootLength(path: string) { const rootLength = getEncodedRootLength(path); return rootLength < 0 ? ~rootLength : rootLength; } function getEncodedRootLength(path: string): number { if (!path) return 0; const ch0 = path.charCodeAt(0); // POSIX or UNC if (ch0 === CharacterCodes.slash || ch0 === CharacterCodes.backslash) { if (path.charCodeAt(1) !== ch0) return 1; // POSIX: "/" (or non-normalized "\") const p1 = path.indexOf( ch0 === CharacterCodes.slash ? directorySeparator : altDirectorySeparator, 2 ); if (p1 < 0) return path.length; // UNC: "//server" or "\\server" return p1 + 1; // UNC: "//server/" or "\\server\" } // DOS if (isVolumeCharacter(ch0) && path.charCodeAt(1) === CharacterCodes.colon) { const ch2 = path.charCodeAt(2); if (ch2 === CharacterCodes.slash || ch2 === CharacterCodes.backslash) return 3; // DOS: "c:/" or "c:\" if (path.length === 2) return 2; // DOS: "c:" (but not "c:d") } // URL const schemeEnd = path.indexOf(urlSchemeSeparator); if (schemeEnd !== -1) { const authorityStart = schemeEnd + urlSchemeSeparator.length; const authorityEnd = path.indexOf(directorySeparator, authorityStart); if (authorityEnd !== -1) { // URL: "file:///", "file://server/", "file://server/path" // For local "file" URLs, include the leading DOS volume (if present). // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a // special case interpreted as "the machine from which the URL is being interpreted". const scheme = path.slice(0, schemeEnd); const authority = path.slice(authorityStart, authorityEnd); if ( scheme === 'file' && (authority === '' || authority === 'localhost') && isVolumeCharacter(path.charCodeAt(authorityEnd + 1)) ) { const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd( path, authorityEnd + 2 ); if (volumeSeparatorEnd !== -1) { if (path.charCodeAt(volumeSeparatorEnd) === CharacterCodes.slash) { // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/" return ~(volumeSeparatorEnd + 1); } if (volumeSeparatorEnd === path.length) { // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a" // but not "file:///c:d" or "file:///c%3ad" return ~volumeSeparatorEnd; } } } return ~(authorityEnd + 1); // URL: "file://server/", "http://server/" } return ~path.length; // URL: "file://server", "http://server" } // relative return 0; } function ensureTrailingDirectorySeparator(path: string) { if (!hasTrailingDirectorySeparator(path)) { return path + directorySeparator; } return path; } function hasTrailingDirectorySeparator(path: string) { return ( path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1)) ); } function isAnyDirectorySeparator(charCode: number): boolean { return ( charCode === CharacterCodes.slash || charCode === CharacterCodes.backslash ); } function removeTrailingDirectorySeparator(path: string) { if (hasTrailingDirectorySeparator(path)) { return path.substr(0, path.length - 1); } return path; } const directorySeparator = '/'; const altDirectorySeparator = '\\'; const urlSchemeSeparator = '://'; function isVolumeCharacter(charCode: number) { return ( (charCode >= CharacterCodes.a && charCode <= CharacterCodes.z) || (charCode >= CharacterCodes.A && charCode <= CharacterCodes.Z) ); } function getFileUrlVolumeSeparatorEnd(url: string, start: number) { const ch0 = url.charCodeAt(start); if (ch0 === CharacterCodes.colon) return start + 1; if ( ch0 === CharacterCodes.percent && url.charCodeAt(start + 1) === CharacterCodes._3 ) { const ch2 = url.charCodeAt(start + 2); if (ch2 === CharacterCodes.a || ch2 === CharacterCodes.A) return start + 3; } return -1; } function some(array: readonly T[] | undefined): array is readonly T[]; function some( array: readonly T[] | undefined, predicate: (value: T) => boolean ): boolean; function some( array: readonly T[] | undefined, predicate?: (value: T) => boolean ): boolean { if (array) { if (predicate) { for (const v of array) { if (predicate(v)) { return true; } } } else { return array.length > 0; } } return false; } /* @internal */ const enum CharacterCodes { _3 = 0x33, a = 0x61, z = 0x7a, A = 0x41, Z = 0x5a, asterisk = 0x2a, // * backslash = 0x5c, // \ colon = 0x3a, // : percent = 0x25, // % question = 0x3f, // ? slash = 0x2f, // / } function pathComponents(path: string, rootLength: number) { const root = path.substring(0, rootLength); const rest = path.substring(rootLength).split(directorySeparator); if (rest.length && !lastOrUndefined(rest)) rest.pop(); return [root, ...rest]; } function lastOrUndefined(array: readonly T[]): T | undefined { return array.length === 0 ? undefined : array[array.length - 1]; } function last(array: readonly T[]): T { // Debug.assert(array.length !== 0); return array[array.length - 1]; } function replaceWildcardCharacter( match: string, singleAsteriskRegexFragment: string ) { return match === '*' ? singleAsteriskRegexFragment : match === '?' ? '[^/]' : '\\' + match; } /** * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, * and does not contain any glob characters itself. */ function isImplicitGlob(lastPathComponent: string): boolean { return !/[.*?]/.test(lastPathComponent); } const ts_ScriptTarget_ES5 = 1; const ts_ScriptTarget_ES2022 = 9; const ts_ScriptTarget_ESNext = 99; const ts_ModuleKind_Node16 = 100; const ts_ModuleKind_NodeNext = 199; // https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8761 export function getUseDefineForClassFields(compilerOptions: _ts.CompilerOptions): boolean { return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= ts_ScriptTarget_ES2022 : compilerOptions.useDefineForClassFields; } // https://github.com/microsoft/TypeScript/blob/fc418a2e611c88cf9afa0115ff73490b2397d311/src/compiler/utilities.ts#L8556 export function getEmitScriptTarget(compilerOptions: { module?: _ts.CompilerOptions['module']; target?: _ts.CompilerOptions['target']; }): _ts.ScriptTarget { return ( compilerOptions.target ?? ((compilerOptions.module === ts_ModuleKind_Node16 && ts_ScriptTarget_ES2022) || (compilerOptions.module === ts_ModuleKind_NodeNext && ts_ScriptTarget_ESNext) || ts_ScriptTarget_ES5) ); } ts-node-10.9.2/src/ts-transpile-module.ts000066400000000000000000000121771453460306300202370ustar00rootroot00000000000000import type { CompilerHost, CompilerOptions, Diagnostic, SourceFile, TranspileOptions, TranspileOutput, } from 'typescript'; import type { TSCommon } from './ts-compiler-types'; /** @internal */ export function createTsTranspileModule( ts: TSCommon, transpileOptions: Pick< TranspileOptions, 'compilerOptions' | 'reportDiagnostics' | 'transformers' > ) { const { createProgram, createSourceFile, getDefaultCompilerOptions, getImpliedNodeFormatForFile, fixupCompilerOptions, transpileOptionValueCompilerOptions, getNewLineCharacter, fileExtensionIs, normalizePath, Debug, toPath, getSetExternalModuleIndicator, getEntries, addRange, hasProperty, getEmitScriptTarget, getDirectoryPath, } = ts as any; const compilerOptionsDiagnostics: Diagnostic[] = []; const options: CompilerOptions = transpileOptions.compilerOptions ? fixupCompilerOptions( transpileOptions.compilerOptions, compilerOptionsDiagnostics ) : {}; // mix in default options const defaultOptions = getDefaultCompilerOptions(); for (const key in defaultOptions) { if (hasProperty(defaultOptions, key) && options[key] === undefined) { options[key] = defaultOptions[key]; } } for (const option of transpileOptionValueCompilerOptions) { options[option.name] = option.transpileOptionValue; } // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. options.suppressOutputPathCheck = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; const newLine = getNewLineCharacter(options); // Create a compilerHost object to allow the compiler to read and write files const compilerHost: CompilerHost = { getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : undefined, writeFile: (name, text) => { if (fileExtensionIs(name, '.map')) { Debug.assertEqual( sourceMapText, undefined, 'Unexpected multiple source map outputs, file:', name ); sourceMapText = text; } else { Debug.assertEqual( outputText, undefined, 'Unexpected multiple outputs, file:', name ); outputText = text; } }, getDefaultLibFileName: () => 'lib.d.ts', useCaseSensitiveFileNames: () => true, getCanonicalFileName: (fileName) => fileName, getCurrentDirectory: () => '', getNewLine: () => newLine, fileExists: (fileName): boolean => fileName === inputFileName || fileName === packageJsonFileName, readFile: (fileName) => fileName === packageJsonFileName ? `{"type": "${_packageJsonType}"}` : '', directoryExists: () => true, getDirectories: () => [], }; let inputFileName: string; let packageJsonFileName: string; let _packageJsonType: 'module' | 'commonjs'; let sourceFile: SourceFile; let outputText: string | undefined; let sourceMapText: string | undefined; return transpileModule; function transpileModule( input: string, transpileOptions2: Pick< TranspileOptions, 'fileName' | 'moduleName' | 'renamedDependencies' >, packageJsonType: 'module' | 'commonjs' = 'commonjs' ): TranspileOutput { // if jsx is specified then treat file as .tsx inputFileName = transpileOptions2.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? 'module.tsx' : 'module.ts'); packageJsonFileName = getDirectoryPath(inputFileName) + '/package.json'; _packageJsonType = packageJsonType; sourceFile = createSourceFile(inputFileName, input, { languageVersion: getEmitScriptTarget(options), impliedNodeFormat: getImpliedNodeFormatForFile( toPath(inputFileName, '', compilerHost.getCanonicalFileName), /*cache*/ undefined, compilerHost, options ), setExternalModuleIndicator: getSetExternalModuleIndicator(options), }); if (transpileOptions2.moduleName) { sourceFile.moduleName = transpileOptions2.moduleName; } if (transpileOptions2.renamedDependencies) { (sourceFile as any).renamedDependencies = new Map( getEntries(transpileOptions2.renamedDependencies) ); } // Output outputText = undefined; sourceMapText = undefined; const program = createProgram([inputFileName], options, compilerHost); const diagnostics = compilerOptionsDiagnostics.slice(); if (transpileOptions.reportDiagnostics) { addRange( /*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile) ); addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics()); } // Emit program.emit( /*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ undefined, transpileOptions.transformers ); if (outputText === undefined) return Debug.fail('Output generation failed'); return { outputText, diagnostics, sourceMapText }; } } ts-node-10.9.2/src/tsconfig-schema.ts000066400000000000000000000013131453460306300173670ustar00rootroot00000000000000import type { TsConfigOptions } from './index'; /* * This interface exists solely for generating a JSON schema for tsconfig.json. * We do *not* extend the compiler's tsconfig interface. Instead we handle that * on a schema level, via "allOf", so we pull in the same schema that VSCode * already uses. */ /** * tsconfig schema which includes "ts-node" options. * @allOf [{"$ref": "https://schemastore.azurewebsites.net/schemas/json/tsconfig.json"}] */ export interface TsConfigSchema { /** * ts-node options. See also: https://typestrong.org/ts-node/docs/configuration * * ts-node offers TypeScript execution and REPL for node.js, with source map support. */ 'ts-node': TsConfigOptions; } ts-node-10.9.2/src/tsconfigs.ts000066400000000000000000000024371453460306300163240ustar00rootroot00000000000000import type { TSCommon, TSInternal } from './ts-compiler-types'; const nodeMajor = parseInt(process.versions.node.split('.')[0], 10); /** * return parsed JSON of the bundled @tsconfig/bases config appropriate for the * running version of nodejs * @internal */ export function getDefaultTsconfigJsonForNodeVersion(ts: TSCommon): any { const tsInternal = ts as any as TSInternal; if (nodeMajor >= 16) { const config = require('@tsconfig/node16/tsconfig.json'); if (configCompatible(config)) return config; } if (nodeMajor >= 14) { const config = require('@tsconfig/node14/tsconfig.json'); if (configCompatible(config)) return config; } if (nodeMajor >= 12) { const config = require('@tsconfig/node12/tsconfig.json'); if (configCompatible(config)) return config; } return require('@tsconfig/node10/tsconfig.json'); // Verify that tsconfig target and lib options are compatible with TypeScript compiler function configCompatible(config: { compilerOptions: { lib: string[]; target: string; }; }) { return ( typeof (ts.ScriptTarget as any)[ config.compilerOptions.target.toUpperCase() ] === 'number' && tsInternal.libs && config.compilerOptions.lib.every((lib) => tsInternal.libs!.includes(lib)) ); } } ts-node-10.9.2/src/util.ts000066400000000000000000000125041453460306300152760ustar00rootroot00000000000000import { createRequire as nodeCreateRequire, createRequireFromPath as nodeCreateRequireFromPath, } from 'module'; import type _createRequire from 'create-require'; import * as ynModule from 'yn'; import { dirname } from 'path'; /** @internal */ export const createRequire = nodeCreateRequire ?? nodeCreateRequireFromPath ?? (require('create-require') as typeof _createRequire); /** * Wrapper around yn module that returns `undefined` instead of `null`. * This is implemented by yn v4, but we're staying on v3 to avoid v4's node 10 requirement. * @internal */ export function yn(value: string | undefined) { return ynModule(value) ?? undefined; } /** * Like `Object.assign`, but ignores `undefined` properties. * * @internal */ export function assign( initialValue: T, ...sources: Array ): T { for (const source of sources) { for (const key of Object.keys(source)) { const value = (source as any)[key]; if (value !== undefined) (initialValue as any)[key] = value; } } return initialValue; } /** * Split a string array of values * and remove empty strings from the resulting array. * @internal */ export function split(value: string | undefined) { return typeof value === 'string' ? value.split(/ *, */g).filter((v) => v !== '') : undefined; } /** * Parse a string as JSON. * @internal */ export function parse(value: string | undefined): object | undefined { return typeof value === 'string' ? JSON.parse(value) : undefined; } const directorySeparator = '/'; const backslashRegExp = /\\/g; /** * Replace backslashes with forward slashes. * @internal */ export function normalizeSlashes(value: string): string { return value.replace(backslashRegExp, directorySeparator); } /** * Safe `hasOwnProperty` * @internal */ export function hasOwnProperty(object: any, property: string): boolean { return Object.prototype.hasOwnProperty.call(object, property); } /** * Cached fs operation wrapper. */ export function cachedLookup(fn: (arg: T) => R): (arg: T) => R { const cache = new Map(); return (arg: T): R => { if (!cache.has(arg)) { const v = fn(arg); cache.set(arg, v); return v; } return cache.get(arg)!; }; } /** * @internal * Require something with v8-compile-cache, which should make subsequent requires faster. * Do lots of error-handling so that, worst case, we require without the cache, and users are not blocked. */ export function attemptRequireWithV8CompileCache( requireFn: typeof require, specifier: string ) { try { const v8CC = ( require('v8-compile-cache-lib') as typeof import('v8-compile-cache-lib') ).install(); try { return requireFn(specifier); } finally { v8CC?.uninstall(); } } catch (e) { return requireFn(specifier); } } /** * Helper to discover dependencies relative to a user's project, optionally * falling back to relative to ts-node. This supports global installations of * ts-node, for example where someone does `#!/usr/bin/env -S ts-node --swc` and * we need to fallback to a global install of @swc/core * @internal */ export function createProjectLocalResolveHelper(localDirectory: string) { return function projectLocalResolveHelper( specifier: string, fallbackToTsNodeRelative: boolean ) { return require.resolve(specifier, { paths: fallbackToTsNodeRelative ? [localDirectory, __dirname] : [localDirectory], }); }; } /** @internal */ export type ProjectLocalResolveHelper = ReturnType< typeof createProjectLocalResolveHelper >; /** * Used as a reminder of all the factors we must consider when finding project-local dependencies and when a config file * on disk may or may not exist. * @internal */ export function getBasePathForProjectLocalDependencyResolution( configFilePath: string | undefined, projectSearchDirOption: string | undefined, projectOption: string | undefined, cwdOption: string ) { if (configFilePath != null) return dirname(configFilePath); return projectSearchDirOption ?? projectOption ?? cwdOption; // TODO technically breaks if projectOption is path to a file, not a directory, // and we attempt to resolve relative specifiers. By the time we resolve relative specifiers, // should have configFilePath, so not reach this codepath. } /** @internal */ export function once any>(fn: Fn) { let value: ReturnType; let ran = false; function onceFn(...args: Parameters): ReturnType { if (ran) return value; value = fn(...args); ran = true; return value; } return onceFn; } /** @internal */ export function versionGteLt( version: string, gteRequirement: string, ltRequirement?: string ) { const [major, minor, patch, extra] = parse(version); const [gteMajor, gteMinor, gtePatch] = parse(gteRequirement); const isGte = major > gteMajor || (major === gteMajor && (minor > gteMinor || (minor === gteMinor && patch >= gtePatch))); let isLt = true; if (ltRequirement) { const [ltMajor, ltMinor, ltPatch] = parse(ltRequirement); isLt = major < ltMajor || (major === ltMajor && (minor < ltMinor || (minor === ltMinor && patch < ltPatch))); } return isGte && isLt; function parse(requirement: string) { return requirement.split(/[\.-]/).map((s) => parseInt(s, 10)); } } ts-node-10.9.2/tests/000077500000000000000000000000001453460306300143225ustar00rootroot00000000000000ts-node-10.9.2/tests/.gitignore000066400000000000000000000001131453460306300163050ustar00rootroot00000000000000!from-node-modules/node_modules/ package-lock.json ts-node-packed.tgz /tmp ts-node-10.9.2/tests/1488/000077500000000000000000000000001453460306300147265ustar00rootroot00000000000000ts-node-10.9.2/tests/1488/index.js000066400000000000000000000000241453460306300163670ustar00rootroot00000000000000console.log('foo'); ts-node-10.9.2/tests/1488/package.json000066400000000000000000000000031453460306300172050ustar00rootroot00000000000000{} ts-node-10.9.2/tests/1488/tsconfig.json000066400000000000000000000001361453460306300174350ustar00rootroot00000000000000{ "compilerOptions": { "allowJs": true }, "ts-node": { "skipIgnore": true } } ts-node-10.9.2/tests/1778/000077500000000000000000000000001453460306300147305ustar00rootroot00000000000000ts-node-10.9.2/tests/1778/index.ts000066400000000000000000000003531453460306300164100ustar00rootroot00000000000000import foo from 'foo'; // This file is ESM, so if typechecker's resolver is working correctly, will // resolve to the foo's package.json "exports" mapping for "default", not "require" const bar: { esm: true } = foo; console.log(bar); ts-node-10.9.2/tests/1778/node_modules/000077500000000000000000000000001453460306300174055ustar00rootroot00000000000000ts-node-10.9.2/tests/1778/node_modules/foo/000077500000000000000000000000001453460306300201705ustar00rootroot00000000000000ts-node-10.9.2/tests/1778/node_modules/foo/cjs/000077500000000000000000000000001453460306300207475ustar00rootroot00000000000000ts-node-10.9.2/tests/1778/node_modules/foo/cjs/index.d.ts000066400000000000000000000000621453460306300226460ustar00rootroot00000000000000declare const foo: {cjs: true} export default foo ts-node-10.9.2/tests/1778/node_modules/foo/cjs/index.js000066400000000000000000000000351453460306300224120ustar00rootroot00000000000000module.exports = {cjs: true} ts-node-10.9.2/tests/1778/node_modules/foo/cjs/package.json000066400000000000000000000000311453460306300232270ustar00rootroot00000000000000{ "type": "commonjs" } ts-node-10.9.2/tests/1778/node_modules/foo/esm/000077500000000000000000000000001453460306300207545ustar00rootroot00000000000000ts-node-10.9.2/tests/1778/node_modules/foo/esm/index.d.ts000066400000000000000000000000621453460306300226530ustar00rootroot00000000000000declare const foo: {esm: true} export default foo ts-node-10.9.2/tests/1778/node_modules/foo/esm/index.js000066400000000000000000000000331453460306300224150ustar00rootroot00000000000000export default {esm: true} ts-node-10.9.2/tests/1778/node_modules/foo/package.json000066400000000000000000000002011453460306300224470ustar00rootroot00000000000000{ "type": "module", "exports": { ".": { "require": "./cjs/index.js", "default": "./esm/index.js" } } } ts-node-10.9.2/tests/1778/package.json000066400000000000000000000000271453460306300172150ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/1778/tsconfig.json000066400000000000000000000001601453460306300174340ustar00rootroot00000000000000{ "ts-node": { "esm": true }, "compilerOptions": { "module": "NodeNext", "noEmit": true } } ts-node-10.9.2/tests/2076/000077500000000000000000000000001453460306300147205ustar00rootroot00000000000000ts-node-10.9.2/tests/2076/node_modules/000077500000000000000000000000001453460306300173755ustar00rootroot00000000000000ts-node-10.9.2/tests/2076/node_modules/custom-tsconfig/000077500000000000000000000000001453460306300225215ustar00rootroot00000000000000ts-node-10.9.2/tests/2076/node_modules/custom-tsconfig/tsconfig.json000066400000000000000000000000241453460306300252240ustar00rootroot00000000000000{ "ts-node": {} } ts-node-10.9.2/tests/2076/tsconfig.json000066400000000000000000000000611453460306300174240ustar00rootroot00000000000000{ "extends": "custom-tsconfig/tsconfig.json" } ts-node-10.9.2/tests/allow-js/000077500000000000000000000000001453460306300160525ustar00rootroot00000000000000ts-node-10.9.2/tests/allow-js/run.js000066400000000000000000000000631453460306300172130ustar00rootroot00000000000000export function main() { return 'hello world'; } ts-node-10.9.2/tests/allow-js/with-jsx.jsx000066400000000000000000000001551453460306300203560ustar00rootroot00000000000000export class Foo2 { static sayHi() { return 'hello world'; } render() { return
; } } ts-node-10.9.2/tests/child-process.ts000066400000000000000000000001551453460306300174320ustar00rootroot00000000000000import { join } from 'path'; import { fork } from 'child_process'; fork(join(__dirname, 'hello-world.ts')); ts-node-10.9.2/tests/compiler-error.ts000066400000000000000000000001101453460306300176230ustar00rootroot00000000000000function upper(str: string) { return str.toUpperCase(); } upper(10); ts-node-10.9.2/tests/complex/000077500000000000000000000000001453460306300157715ustar00rootroot00000000000000ts-node-10.9.2/tests/complex/example.js000066400000000000000000000000501453460306300177550ustar00rootroot00000000000000module.exports = require('./foo').text; ts-node-10.9.2/tests/complex/foo.ts000066400000000000000000000000371453460306300171240ustar00rootroot00000000000000export const text = 'example'; ts-node-10.9.2/tests/complex/index.ts000066400000000000000000000001551453460306300174510ustar00rootroot00000000000000declare function require(module: string): any; export function example() { return require('./example'); } ts-node-10.9.2/tests/custom-types.ts000066400000000000000000000000771453460306300173520ustar00rootroot00000000000000import { foobar } from 'does-not-exist'; console.log(foobar); ts-node-10.9.2/tests/cwd-and-script-mode/000077500000000000000000000000001453460306300200635ustar00rootroot00000000000000ts-node-10.9.2/tests/cwd-and-script-mode/a/000077500000000000000000000000001453460306300203035ustar00rootroot00000000000000ts-node-10.9.2/tests/cwd-and-script-mode/a/index.ts000066400000000000000000000003361453460306300217640ustar00rootroot00000000000000export {}; // Type assertion to please TS 2.7 const register = process[(Symbol as any).for('ts-node.register.instance')]; console.log( JSON.stringify({ options: register.options, config: register.config, }) ); ts-node-10.9.2/tests/cwd-and-script-mode/a/tsconfig.json000066400000000000000000000002171453460306300230120ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true }, "compilerOptions": { "plugins": [ { "name": "plugin-a" } ] } } ts-node-10.9.2/tests/cwd-and-script-mode/b/000077500000000000000000000000001453460306300203045ustar00rootroot00000000000000ts-node-10.9.2/tests/cwd-and-script-mode/b/index.ts000066400000000000000000000003361453460306300217650ustar00rootroot00000000000000export {}; // Type assertion to please TS 2.7 const register = process[(Symbol as any).for('ts-node.register.instance')]; console.log( JSON.stringify({ options: register.options, config: register.config, }) ); ts-node-10.9.2/tests/cwd-and-script-mode/b/tsconfig.json000066400000000000000000000002171453460306300230130ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true }, "compilerOptions": { "plugins": [ { "name": "plugin-b" } ] } } ts-node-10.9.2/tests/emit-compiled.ts000066400000000000000000000005311453460306300174210ustar00rootroot00000000000000const extensions = ['.tsx']; extensions.forEach((ext) => { const old = require.extensions[ext]; require.extensions[ext] = (m, path) => { const _compile = (m as any)._compile; (m as any)._compile = (code, path) => { console.error(code); return _compile.call(this, code, path); }; return old(m, path); }; }); ts-node-10.9.2/tests/emit-skipped-fallback/000077500000000000000000000000001453460306300204525ustar00rootroot00000000000000ts-node-10.9.2/tests/emit-skipped-fallback/outside-rootDir/000077500000000000000000000000001453460306300235465ustar00rootroot00000000000000ts-node-10.9.2/tests/emit-skipped-fallback/outside-rootDir/foo.js000066400000000000000000000006501453460306300246700ustar00rootroot00000000000000// This file causes TS to return emitSkipped because it's outside of rootDir and // it's .js. I assume this happens because the emit path is the same as the // input path, and perhaps also because the file is classified "external" const decorator = () => {}; class Foo { // Using a decorator to prove this .js file is getting compiled @decorator method() { return 'foo'; } } console.log(new Foo().method()); ts-node-10.9.2/tests/emit-skipped-fallback/tsconfig.json000066400000000000000000000001611453460306300231570ustar00rootroot00000000000000{ "compilerOptions": { "allowJs": true, "experimentalDecorators": true, "rootDir": "rootDir" } } ts-node-10.9.2/tests/empty.ts000066400000000000000000000000001453460306300160160ustar00rootroot00000000000000ts-node-10.9.2/tests/env.ts000066400000000000000000000001171453460306300154610ustar00rootroot00000000000000console.log(typeof (process as any)[Symbol.for('ts-node.register.instance')]); ts-node-10.9.2/tests/esm-child-process/000077500000000000000000000000001453460306300176435ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-js/000077500000000000000000000000001453460306300233705ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-js/index.ts000066400000000000000000000013551453460306300250530ustar00rootroot00000000000000import { fork } from 'child_process'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; process.chdir(dirname(fileURLToPath(import.meta.url))); const workerProcess = fork('./worker.js', [], { stdio: 'pipe', }); let stdout = ''; workerProcess.stdout.on('data', (chunk) => (stdout += chunk.toString('utf8'))); workerProcess.on('error', () => (process.exitCode = 1)); workerProcess.on('close', (status, signal) => { if (status === 0 && signal === null && stdout.trim() === 'Works') { console.log('Passing: from main'); process.exitCode = 0; } }); ts-node-10.9.2/tests/esm-child-process/process-forking-js/package.json000066400000000000000000000000271453460306300256550ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-child-process/process-forking-js/tsconfig.json000066400000000000000000000001321453460306300260730ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext" }, "ts-node": { "swc": true } } ts-node-10.9.2/tests/esm-child-process/process-forking-js/worker.js000066400000000000000000000000261453460306300252350ustar00rootroot00000000000000console.log('Works'); ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/000077500000000000000000000000001453460306300241455ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/index.ts000066400000000000000000000013751453460306300256320ustar00rootroot00000000000000import { fork } from 'child_process'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; const workerProcess = fork( join(dirname(fileURLToPath(import.meta.url)), 'subfolder/worker.ts'), [], { stdio: 'pipe', } ); let stdout = ''; workerProcess.stdout.on('data', (chunk) => (stdout += chunk.toString('utf8'))); workerProcess.on('error', () => (process.exitCode = 1)); workerProcess.on('close', (status, signal) => { if (status === 0 && signal === null && stdout.trim() === 'Works') { console.log('Passing: from main'); process.exitCode = 0; } }); ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/package.json000066400000000000000000000000271453460306300264320ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/subfolder/000077500000000000000000000000001453460306300261325ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/subfolder/worker.ts000066400000000000000000000000701453460306300300100ustar00rootroot00000000000000const message: string = 'Works'; console.log(message); ts-node-10.9.2/tests/esm-child-process/process-forking-ts-abs/tsconfig.json000066400000000000000000000001321453460306300266500ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext" }, "ts-node": { "swc": true } } ts-node-10.9.2/tests/esm-child-process/process-forking-ts/000077500000000000000000000000001453460306300234025ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-ts/index.ts000066400000000000000000000014061453460306300250620ustar00rootroot00000000000000import { fork } from 'child_process'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; process.chdir(join(dirname(fileURLToPath(import.meta.url)), 'subfolder')); const workerProcess = fork('./worker.ts', [], { stdio: 'pipe', }); let stdout = ''; workerProcess.stdout.on('data', (chunk) => (stdout += chunk.toString('utf8'))); workerProcess.on('error', () => (process.exitCode = 1)); workerProcess.on('close', (status, signal) => { if (status === 0 && signal === null && stdout.trim() === 'Works') { console.log('Passing: from main'); process.exitCode = 0; } }); ts-node-10.9.2/tests/esm-child-process/process-forking-ts/package.json000066400000000000000000000000271453460306300256670ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-child-process/process-forking-ts/subfolder/000077500000000000000000000000001453460306300253675ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/process-forking-ts/subfolder/worker.ts000066400000000000000000000000701453460306300272450ustar00rootroot00000000000000const message: string = 'Works'; console.log(message); ts-node-10.9.2/tests/esm-child-process/process-forking-ts/tsconfig.json000066400000000000000000000001321453460306300261050ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext" }, "ts-node": { "swc": true } } ts-node-10.9.2/tests/esm-child-process/via-flag/000077500000000000000000000000001453460306300213315ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/via-flag/index.ts000066400000000000000000000002341453460306300230070ustar00rootroot00000000000000import { strictEqual } from 'assert'; strictEqual(import.meta.url.includes('index.ts'), true); console.log(`CLI args: ${process.argv.slice(2).join(' ')}`); ts-node-10.9.2/tests/esm-child-process/via-flag/package.json000066400000000000000000000000271453460306300236160ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-child-process/via-flag/tsconfig.json000066400000000000000000000001671453460306300240440ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "esModuleInterop": true }, "ts-node": { "swc": true } } ts-node-10.9.2/tests/esm-child-process/via-tsconfig/000077500000000000000000000000001453460306300222345ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-child-process/via-tsconfig/index.ts000066400000000000000000000002341453460306300237120ustar00rootroot00000000000000import { strictEqual } from 'assert'; strictEqual(import.meta.url.includes('index.ts'), true); console.log(`CLI args: ${process.argv.slice(2).join(' ')}`); ts-node-10.9.2/tests/esm-child-process/via-tsconfig/package.json000066400000000000000000000000271453460306300245210ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-child-process/via-tsconfig/sleep.ts000066400000000000000000000005521453460306300237160ustar00rootroot00000000000000setTimeout(function () { console.log('Slept 30 seconds'); }, 30e3); process.on('SIGTERM', onSignal); process.on('SIGINT', onSignal); console.log('child registered signal handlers'); function onSignal(signal: string) { console.log(`child received signal: ${signal}`); setTimeout(() => { console.log(`child exiting`); process.exit(123); }, 5e3); } ts-node-10.9.2/tests/esm-child-process/via-tsconfig/tsconfig.json000066400000000000000000000002101453460306300247340ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "esModuleInterop": true }, "ts-node": { "esm": true, "swc": true } } ts-node-10.9.2/tests/esm-custom-loader/000077500000000000000000000000001453460306300176625ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-custom-loader/index.ts000077500000000000000000000001021453460306300213350ustar00rootroot00000000000000export function abc() { let unusedVar: string; return true; } ts-node-10.9.2/tests/esm-custom-loader/loader.mjs000077500000000000000000000006461453460306300216540ustar00rootroot00000000000000import { fileURLToPath } from 'url'; import { createRequire } from 'module'; const require = createRequire(fileURLToPath(import.meta.url)); /** @type {import('../../dist')} **/ const { createEsmHooks, register } = require('ts-node'); const tsNodeInstance = register({ compilerOptions: { noUnusedLocals: true, }, }); export const { resolve, getFormat, transformSource, load } = createEsmHooks(tsNodeInstance); ts-node-10.9.2/tests/esm-custom-loader/package.json000077500000000000000000000000271453460306300221520ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-custom-loader/tsconfig.json000077500000000000000000000001631453460306300223740ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "moduleResolution": "node", "noUnusedLocals": false } } ts-node-10.9.2/tests/esm-err-require-esm/000077500000000000000000000000001453460306300201305ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-err-require-esm/esm-package/000077500000000000000000000000001453460306300223055ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-err-require-esm/esm-package/loaded-as.ts000066400000000000000000000002061453460306300245040ustar00rootroot00000000000000// Log if this file is loaded as ESM or CommonJS if (typeof module !== 'undefined') console.log('CommonJS'); else console.log('ESM'); ts-node-10.9.2/tests/esm-err-require-esm/esm-package/package.json000066400000000000000000000000271453460306300245720ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-err-require-esm/index.js000066400000000000000000000000441453460306300215730ustar00rootroot00000000000000require('./esm-package/loaded-as'); ts-node-10.9.2/tests/esm-import-assertions/000077500000000000000000000000001453460306300206065ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-import-assertions/car.json000066400000000000000000000000721453460306300222450ustar00rootroot00000000000000{ "color": "fuchsia", "doors": "open", "seats": 2 } ts-node-10.9.2/tests/esm-import-assertions/importJson.ts000066400000000000000000000013721453460306300233250ustar00rootroot00000000000000import carData from './car.json' assert { type: 'json' }; if (carData.color !== 'fuchsia') throw new Error('failed to import json'); const { default: dynamicCarData } = await import('./car.json', { assert: { type: 'json' }, }); if (dynamicCarData.doors !== 'open') throw new Error('failed to dynamically import json'); console.log( `A ${carData.color} car has ${carData.seats} seats and the doors are ${dynamicCarData.doors}.` ); // Test that omitting the assertion causes node to throw an error await import('./car.json').then( () => { throw new Error('should have thrown'); }, (error: any) => { if (error.code !== 'ERR_IMPORT_ASSERTION_TYPE_MISSING') { throw error; } /* error is expected */ } ); console.log('Done!'); ts-node-10.9.2/tests/esm-import-assertions/package.json000066400000000000000000000000271453460306300230730ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-import-assertions/tsconfig.json000066400000000000000000000003721453460306300233170ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true }, "compilerOptions": { "module": "ESNext", "target": "ESNext", "resolveJsonModule": true, "allowJs": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true } } ts-node-10.9.2/tests/esm-import-cache/000077500000000000000000000000001453460306300174575ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-import-cache/index.ts000066400000000000000000000001251453460306300211340ustar00rootroot00000000000000import './log1.js'; import './log1.js'; import './log2.js'; import './log2.js?bust'; ts-node-10.9.2/tests/esm-import-cache/log1.ts000066400000000000000000000000251453460306300206660ustar00rootroot00000000000000console.log('log1'); ts-node-10.9.2/tests/esm-import-cache/log2.ts000066400000000000000000000000251453460306300206670ustar00rootroot00000000000000console.log('log2'); ts-node-10.9.2/tests/esm-import-cache/package.json000066400000000000000000000000271453460306300217440ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-import-cache/tsconfig.json000066400000000000000000000001531453460306300221650ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "allowJs": true, "moduleResolution": "node" } } ts-node-10.9.2/tests/esm-import-http-url/000077500000000000000000000000001453460306300201735ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-import-http-url/index.mjs000066400000000000000000000001151453460306300220120ustar00rootroot00000000000000import 'http://example.com/this-url-should-be-ignored-by-our-esm-loader.js'; ts-node-10.9.2/tests/esm-loader-context/000077500000000000000000000000001453460306300200345ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-context/index.mjs000066400000000000000000000005051453460306300216560ustar00rootroot00000000000000import * as moduleA from './moduleA.mjs'; import * as moduleB from './moduleB.mjs' assert { foo: 'bar' }; import * as jsonModule from './jsonModuleA.json' assert { type: 'json' }; await import('./moduleC.mjs'); await import('./moduleD.mjs', { foo: 'bar' }); await import('./jsonModuleB.json', { assert: { type: 'json' } }); ts-node-10.9.2/tests/esm-loader-context/jsonModuleA.json000066400000000000000000000000031453460306300231400ustar00rootroot00000000000000{} ts-node-10.9.2/tests/esm-loader-context/jsonModuleB.json000066400000000000000000000000031453460306300231410ustar00rootroot00000000000000{} ts-node-10.9.2/tests/esm-loader-context/loader.mjs000066400000000000000000000005341453460306300220170ustar00rootroot00000000000000export function resolve(specifier, context, defaultResolve) { console.log(JSON.stringify({ resolveContextKeys: Object.keys(context) })); return defaultResolve(specifier, context); } export function load(url, context, defaultLoad) { console.log(JSON.stringify({ loadContextKeys: Object.keys(context) })); return defaultLoad(url, context); } ts-node-10.9.2/tests/esm-loader-context/moduleA.mjs000066400000000000000000000000001453460306300221230ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-context/moduleB.mjs000066400000000000000000000000001453460306300221240ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-context/moduleC.mjs000066400000000000000000000000001453460306300221250ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-context/moduleD.mjs000066400000000000000000000000001453460306300221260ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-entrypoint-cjs-fallback/000077500000000000000000000000001453460306300230755ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-entrypoint-cjs-fallback/extensionless-entrypoint000066400000000000000000000000351453460306300301320ustar00rootroot00000000000000console.log('Hello world!'); ts-node-10.9.2/tests/esm-loader-entrypoint-cjs-fallback/relies-upon-cjs-resolution/000077500000000000000000000000001453460306300303155ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-loader-entrypoint-cjs-fallback/relies-upon-cjs-resolution/index.js000066400000000000000000000000351453460306300317600ustar00rootroot00000000000000console.log('Hello world!'); ts-node-10.9.2/tests/esm-node-resolver/000077500000000000000000000000001453460306300176705ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-node-resolver/bar/000077500000000000000000000000001453460306300204345ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-node-resolver/bar/index.ts000066400000000000000000000001731453460306300221140ustar00rootroot00000000000000export const bar: string = 'bar'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm-node-resolver/baz.js000066400000000000000000000001631453460306300210020ustar00rootroot00000000000000export const baz = 'baz'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm-node-resolver/biff.jsx000066400000000000000000000002701453460306300213230ustar00rootroot00000000000000export const biff = 'biff'; const React = { createElement() {}, }; const div =
; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm-node-resolver/foo.ts000066400000000000000000000001731453460306300210240ustar00rootroot00000000000000export const foo: string = 'foo'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm-node-resolver/index.ts000066400000000000000000000007111453460306300213460ustar00rootroot00000000000000import { foo } from './foo'; import { bar } from './bar'; import { baz } from './baz'; import { biff } from './biff'; import { libfoo } from 'libfoo'; // Test import builtin modules import { readFileSync } from 'fs'; if (typeof readFileSync !== 'function') throw new Error('failed to import builtin module'); if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); console.log(`${foo} ${bar} ${baz} ${biff} ${libfoo}`); ts-node-10.9.2/tests/esm-node-resolver/node_modules/000077500000000000000000000000001453460306300223455ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-node-resolver/node_modules/libfoo/000077500000000000000000000000001453460306300236175ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-node-resolver/node_modules/libfoo/entrypoint.js000066400000000000000000000000371453460306300263700ustar00rootroot00000000000000export const libfoo = 'libfoo' ts-node-10.9.2/tests/esm-node-resolver/node_modules/libfoo/index.d.ts000066400000000000000000000001261453460306300255170ustar00rootroot00000000000000// TypeScript does not yet support package.json "exports" export const libfoo: string ts-node-10.9.2/tests/esm-node-resolver/node_modules/libfoo/package.json000066400000000000000000000001131453460306300261000ustar00rootroot00000000000000{ "type": "module", "exports": { "import": "./entrypoint.js" } } ts-node-10.9.2/tests/esm-node-resolver/package.json000066400000000000000000000000271453460306300221550ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-node-resolver/tsconfig.json000066400000000000000000000001771453460306300224040ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "allowJs": true, "jsx": "react", "moduleResolution": "node" } } ts-node-10.9.2/tests/esm-transpile-only/000077500000000000000000000000001453460306300200645ustar00rootroot00000000000000ts-node-10.9.2/tests/esm-transpile-only/index.ts000066400000000000000000000003371453460306300215460ustar00rootroot00000000000000if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); // intentional type errors to check transpile-only ESM loader skips type checking parseInt(1101, 2); const x: number = 'hello world'; ts-node-10.9.2/tests/esm-transpile-only/package.json000066400000000000000000000000271453460306300223510ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm-transpile-only/tsconfig.json000066400000000000000000000001371453460306300225740ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "allowJs": true, "jsx": "react" } } ts-node-10.9.2/tests/esm/000077500000000000000000000000001453460306300151065ustar00rootroot00000000000000ts-node-10.9.2/tests/esm/bar.ts000066400000000000000000000001731453460306300162230ustar00rootroot00000000000000export const bar: string = 'bar'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm/baz.js000066400000000000000000000001631453460306300162200ustar00rootroot00000000000000export const baz = 'baz'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm/biff.jsx000066400000000000000000000002701453460306300165410ustar00rootroot00000000000000export const biff = 'biff'; const React = { createElement() {}, }; const div =
; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm/foo.ts000066400000000000000000000001731453460306300162420ustar00rootroot00000000000000export const foo: string = 'foo'; if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); ts-node-10.9.2/tests/esm/index.ts000066400000000000000000000007251453460306300165710ustar00rootroot00000000000000import { foo } from './foo.js'; import { bar } from './bar.js'; import { baz } from './baz.js'; import { biff } from './biff.js'; import { libfoo } from 'libfoo'; // Test import builtin modules import { readFileSync } from 'fs'; if (typeof readFileSync !== 'function') throw new Error('failed to import builtin module'); if (typeof module !== 'undefined') throw new Error('module should not exist in ESM'); console.log(`${foo} ${bar} ${baz} ${biff} ${libfoo}`); ts-node-10.9.2/tests/esm/node_modules/000077500000000000000000000000001453460306300175635ustar00rootroot00000000000000ts-node-10.9.2/tests/esm/node_modules/libfoo/000077500000000000000000000000001453460306300210355ustar00rootroot00000000000000ts-node-10.9.2/tests/esm/node_modules/libfoo/entrypoint.js000066400000000000000000000000371453460306300236060ustar00rootroot00000000000000export const libfoo = 'libfoo' ts-node-10.9.2/tests/esm/node_modules/libfoo/index.d.ts000066400000000000000000000001261453460306300227350ustar00rootroot00000000000000// TypeScript does not yet support package.json "exports" export const libfoo: string ts-node-10.9.2/tests/esm/node_modules/libfoo/package.json000066400000000000000000000001131453460306300233160ustar00rootroot00000000000000{ "type": "module", "exports": { "import": "./entrypoint.js" } } ts-node-10.9.2/tests/esm/package.json000066400000000000000000000000271453460306300173730ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/esm/throw error.ts000066400000000000000000000007511453460306300177360ustar00rootroot00000000000000// intentional whitespace to prove that sourcemaps are working. Throw should happen on line 100. // 100 lines is meant to be far more space than the helper functions would take. // Space in filename is intentional to ensure we handle this correctly when providing sourcemaps class Foo { constructor() { this.bar(); } bar() { throw new Error('this is a demo'); } } new Foo(); export {}; ts-node-10.9.2/tests/esm/tsconfig.json000066400000000000000000000001771453460306300176220ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext", "allowJs": true, "jsx": "react", "moduleResolution": "node" } } ts-node-10.9.2/tests/from-node-modules/000077500000000000000000000000001453460306300176565ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/from-node-modules.ts000066400000000000000000000010061453460306300235570ustar00rootroot00000000000000// These files are resolved by the typechecker import * as tsmie from 'external/typescript-module-imported-externally'; import * as jsmie from 'external/javascript-module-imported-externally'; // These files are unknown to the compiler until required. const tsmre = require('external/typescript-module-required-externally'); const jsmre = require('external/javascript-module-required-externally'); import * as external from 'external'; console.log(JSON.stringify({ external, tsmie, jsmie, tsmre, jsmre }, null, 2)); ts-node-10.9.2/tests/from-node-modules/node_modules/000077500000000000000000000000001453460306300223335ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/000077500000000000000000000000001453460306300241555ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/index.ts000066400000000000000000000006321453460306300256350ustar00rootroot00000000000000// These files are resolved by the typechecker import * as tsmii from './typescript-module-imported-internally' export {tsmii} import * as jsmii from './javascript-module-imported-internally' export {jsmii} // These files are unknown to the compiler until required. export const tsmri = require('./typescript-module-required-internally') export const jsmri = require('./javascript-module-required-internally') ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-imported-externally/000077500000000000000000000000001453460306300336145ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352110ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-imported-externallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-imported-internally/000077500000000000000000000000001453460306300336065ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352030ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-imported-internallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-required-externally/000077500000000000000000000000001453460306300336115ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352060ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-required-externallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-required-internally/000077500000000000000000000000001453460306300336035ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352000ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/javascript-module-required-internallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-imported-externally/000077500000000000000000000000001453460306300336545ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352510ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-imported-externallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-imported-internally/000077500000000000000000000000001453460306300336465ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352430ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-imported-internallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-required-externally/000077500000000000000000000000001453460306300336515ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352460ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-required-externallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-required-internally/000077500000000000000000000000001453460306300336435ustar00rootroot00000000000000index.ts000066400000000000000000000001061453460306300352400ustar00rootroot00000000000000ts-node-10.9.2/tests/from-node-modules/node_modules/external/typescript-module-required-internallyimport {basename} from 'path' export const name = basename(__dirname) ts-node-10.9.2/tests/from-node-modules/tsconfig.json000066400000000000000000000001301453460306300223570ustar00rootroot00000000000000{ "ts-node": { "ignore": [] }, "compilerOptions": { "allowJs": true } } ts-node-10.9.2/tests/hello-world.ts000066400000000000000000000000361453460306300171210ustar00rootroot00000000000000console.log('Hello, world!'); ts-node-10.9.2/tests/import-order/000077500000000000000000000000001453460306300167455ustar00rootroot00000000000000ts-node-10.9.2/tests/import-order/compiled.js000066400000000000000000000000431453460306300210740ustar00rootroot00000000000000console.log('Hello, JavaScript!'); ts-node-10.9.2/tests/import-order/compiled.ts000066400000000000000000000000431453460306300211060ustar00rootroot00000000000000console.log('Hello, TypeScript!'); ts-node-10.9.2/tests/import-order/defined.d.ts000066400000000000000000000000661453460306300211370ustar00rootroot00000000000000declare const v = 'Hello, World!'; export default v; ts-node-10.9.2/tests/import-order/defined.js000066400000000000000000000000421453460306300206750ustar00rootroot00000000000000module.exports = 'Hello, World!'; ts-node-10.9.2/tests/import-order/importer.ts000066400000000000000000000000611453460306300211530ustar00rootroot00000000000000const v = require('./defined'); console.log(v); ts-node-10.9.2/tests/issue-884/000077500000000000000000000000001453460306300157735ustar00rootroot00000000000000ts-node-10.9.2/tests/issue-884/index-2.ts000066400000000000000000000001401453460306300176040ustar00rootroot00000000000000export {}; const timeout = setTimeout(() => {}, 0); if (timeout.unref) { timeout.unref(); } ts-node-10.9.2/tests/issue-884/index.ts000066400000000000000000000002421453460306300174500ustar00rootroot00000000000000// 2x index files required so that memory cache is populated with all build-in lib and @types // declarations *before* this require() call. require('./index-2'); ts-node-10.9.2/tests/issue-884/tsconfig.json000066400000000000000000000007071453460306300205060ustar00rootroot00000000000000{ "compilerOptions": { "module": "umd", "target": "esnext", "sourceMap": true, "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, "noImplicitAny": true, "skipLibCheck": true, "moduleResolution": "node", "allowSyntheticDefaultImports": false, "declaration": true, "strict": true, "noUnusedParameters": true, "noUnusedLocals": true, "lib": ["es2015", "es2017.object", "dom"] } } ts-node-10.9.2/tests/issue-986/000077500000000000000000000000001453460306300157765ustar00rootroot00000000000000ts-node-10.9.2/tests/issue-986/index.ts000066400000000000000000000000231453460306300174500ustar00rootroot00000000000000console.log(TEST); ts-node-10.9.2/tests/issue-986/tsconfig.json000066400000000000000000000000701453460306300205020ustar00rootroot00000000000000{ "compilerOptions": { "module": "CommonJS" } } ts-node-10.9.2/tests/issue-986/types.ts000066400000000000000000000000341453460306300175070ustar00rootroot00000000000000declare const TEST: string; ts-node-10.9.2/tests/jsx-react.tsx000066400000000000000000000001601453460306300167570ustar00rootroot00000000000000import * as React from 'react'; const Component = (props) => { return
; }; export default Component; ts-node-10.9.2/tests/legacy-source-map-support-interop/000077500000000000000000000000001453460306300230275ustar00rootroot00000000000000ts-node-10.9.2/tests/legacy-source-map-support-interop/index.ts000066400000000000000000000012171453460306300245070ustar00rootroot00000000000000import { Logger } from 'tslog'; new Logger().info('hi'); console.log(require.resolve('source-map-support') === require.resolve('@cspotcode/source-map-support')); console.log(require.resolve('source-map-support/register') === require.resolve('@cspotcode/source-map-support/register')); /* tslog uses `require('source-map-support').wrapCallSite` directly. Without redirection to @cspotcode/source-map-support it does not have access to the sourcemap information we provide. */ interface Foo { } console.log(new Error().stack!.split('\n')[1]); new Logger().info('hi'); ts-node-10.9.2/tests/local-types-node/000077500000000000000000000000001453460306300175015ustar00rootroot00000000000000ts-node-10.9.2/tests/local-types-node/node_modules/000077500000000000000000000000001453460306300221565ustar00rootroot00000000000000ts-node-10.9.2/tests/local-types-node/node_modules/@types/000077500000000000000000000000001453460306300234225ustar00rootroot00000000000000ts-node-10.9.2/tests/local-types-node/node_modules/@types/node/000077500000000000000000000000001453460306300243475ustar00rootroot00000000000000ts-node-10.9.2/tests/local-types-node/node_modules/@types/node/index.d.ts000066400000000000000000000001521453460306300262460ustar00rootroot00000000000000declare const process: LocalNodeTypes_Process; declare interface LocalNodeTypes_Process { /* empty */ } ts-node-10.9.2/tests/local-types-node/node_modules/@types/node/package.json000066400000000000000000000000341453460306300266320ustar00rootroot00000000000000{ "name": "@types/node" } ts-node-10.9.2/tests/main-realpath/000077500000000000000000000000001453460306300170445ustar00rootroot00000000000000ts-node-10.9.2/tests/main-realpath/symlink/000077500000000000000000000000001453460306300205325ustar00rootroot00000000000000ts-node-10.9.2/tests/main-realpath/symlink/symlink.tsx000077700000000000000000000000001453460306300265022../target/target.tsxustar00rootroot00000000000000ts-node-10.9.2/tests/main-realpath/symlink/tsconfig.json000066400000000000000000000001371453460306300232420ustar00rootroot00000000000000this tsconfig is intentionally invalid, to confirm that ts-node does *not* attempt to parse it ts-node-10.9.2/tests/main-realpath/target/000077500000000000000000000000001453460306300203325ustar00rootroot00000000000000ts-node-10.9.2/tests/main-realpath/target/target.tsx000066400000000000000000000001651453460306300223620ustar00rootroot00000000000000// Will throw a compiler error unless ./tsconfig.json is parsed, which enables JSX function foo() {
; } ts-node-10.9.2/tests/main-realpath/target/tsconfig.json000066400000000000000000000001401453460306300230340ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true }, "compilerOptions": { "jsx": "react" } } ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/000077500000000000000000000000001453460306300222035ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/index.ts000066400000000000000000000007501453460306300236640ustar00rootroot00000000000000// Import as values, forcing internal classification. All files are typechecked import { foo as a_foo, bar as a_bar } from '@scoped/a'; // Values are not used, so classification remains external. Obeys maxNodeModulesJsDepth import { foo as b_foo, bar as b_bar } from '@scoped/b'; // We must have two .ts files, one without type errors. // Otherwise, type errors would prevent imports from executing, so external modules would not be reclassified as internal. a_foo; import './other'; ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/000077500000000000000000000000001453460306300246605ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/000077500000000000000000000000001453460306300262355ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/a/000077500000000000000000000000001453460306300264555ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/a/has-semantic-error.js000066400000000000000000000002201453460306300325100ustar00rootroot00000000000000// Due to allowJs and skipIgnore, this file is typechecked because it is reclassified as internal /** @type {string} */ export const bar = 123 ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/a/index.js000066400000000000000000000001311453460306300301150ustar00rootroot00000000000000export {bar} from './has-semantic-error' /** @type {string} */ export const foo = 'foo' ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/b/000077500000000000000000000000001453460306300264565ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/b/has-semantic-error.js000066400000000000000000000001601453460306300325140ustar00rootroot00000000000000// Due to maxNodeModuleJsDepth of 1, this file is not typechecked /** @type {string} */ export const bar = 123 ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/node_modules/@scoped/b/index.js000066400000000000000000000001311453460306300301160ustar00rootroot00000000000000export {bar} from './has-semantic-error' /** @type {string} */ export const foo = 'foo' ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/other.ts000066400000000000000000000010121453460306300236660ustar00rootroot00000000000000// Import as values, forcing internal classification. All files are typechecked import { foo as a_foo, bar as a_bar } from '@scoped/a'; // Values are not used, so classification remains external. Obeys maxNodeModulesJsDepth import { foo as b_foo, bar as b_bar } from '@scoped/b'; // `a_bar` has type information because it has been reclassified as internal const shouldBeBoolean2: boolean = a_bar; // `b_bar` is missing type information, so this is not an error const shouldBeBoolean4: boolean = null as typeof b_bar; ts-node-10.9.2/tests/maxnodemodulesjsdepth-scoped/tsconfig.json000066400000000000000000000003101453460306300247040ustar00rootroot00000000000000{ "ts-node": { // Force transpilation of node_modules "skipIgnore": true }, "compilerOptions": { "allowJs": true, "maxNodeModuleJsDepth": 1, "moduleResolution": "node" } } ts-node-10.9.2/tests/maxnodemodulesjsdepth/000077500000000000000000000000001453460306300207305ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth/index.ts000066400000000000000000000000671453460306300224120ustar00rootroot00000000000000import { foo, bar } from 'external'; import './other'; ts-node-10.9.2/tests/maxnodemodulesjsdepth/node_modules/000077500000000000000000000000001453460306300234055ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth/node_modules/external/000077500000000000000000000000001453460306300252275ustar00rootroot00000000000000ts-node-10.9.2/tests/maxnodemodulesjsdepth/node_modules/external/has-semantic-error.js000066400000000000000000000001531453460306300312670ustar00rootroot00000000000000// Due to maxNodeModuleJsDepth of 1, this file is not typechecked /** @type {string} */ exports.bar = 123 ts-node-10.9.2/tests/maxnodemodulesjsdepth/node_modules/external/index.js000066400000000000000000000002111453460306300266660ustar00rootroot00000000000000const hasSemanticError = require('./has-semantic-error'); exports.bar = hasSemanticError.bar; /** @type {string} */ exports.foo = 'foo' ts-node-10.9.2/tests/maxnodemodulesjsdepth/other.ts000066400000000000000000000003441453460306300224220ustar00rootroot00000000000000import { foo, bar } from 'external'; // `foo` has type information so this is an error const shouldBeBoolean: boolean = foo; // `bar` is missing type information, so this is not an error const shouldBeBoolean2: boolean = bar; ts-node-10.9.2/tests/maxnodemodulesjsdepth/tsconfig.json000066400000000000000000000001621453460306300234360ustar00rootroot00000000000000{ "compilerOptions": { "allowJs": true, "maxNodeModuleJsDepth": 1, "moduleResolution": "node" } } ts-node-10.9.2/tests/module-types/000077500000000000000000000000001453460306300167515ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-cjs/000077500000000000000000000000001453460306300217655ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-cjs/package.json000066400000000000000000000000271453460306300242520ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/module-types/override-to-cjs/src/000077500000000000000000000000001453460306300225545ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-cjs/src/cjs-subdir/000077500000000000000000000000001453460306300246215ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-cjs/src/cjs-subdir/esm-exception.ts000066400000000000000000000001071453460306300277470ustar00rootroot00000000000000declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-cjs/src/cjs-subdir/index.ts000066400000000000000000000001071453460306300262760ustar00rootroot00000000000000declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-cjs/src/should-be-esm.ts000066400000000000000000000001451453460306300255700ustar00rootroot00000000000000export const a: string = 'b'; declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-cjs/test-webpack-config.cjs000066400000000000000000000001321453460306300263160ustar00rootroot00000000000000const assert = require('assert'); assert(require('./webpack.config').hello === 'world'); ts-node-10.9.2/tests/module-types/override-to-cjs/test.cjs000066400000000000000000000006711453460306300234510ustar00rootroot00000000000000const assert = require('assert'); const wpc = require('./webpack.config.ts'); assert(wpc.hello === 'world'); let failures = 0; try { require('./src/should-be-esm.ts'); failures++; } catch (e) { // good } const cjsSubdir = require('./src/cjs-subdir'); assert(cjsSubdir.requireType === 'function'); try { require('./src/cjs-subdir/esm-exception.ts'); failures++; } catch (e) { // good } console.log(`Failures: ${failures}`); ts-node-10.9.2/tests/module-types/override-to-cjs/test.mjs000066400000000000000000000007161453460306300234630ustar00rootroot00000000000000import assert from 'assert'; import webpackConfig from './webpack.config.ts'; import * as shouldBeEsm from './src/should-be-esm.ts'; import subdirCjs from './src/cjs-subdir/index.ts'; import * as subdirEsm from './src/cjs-subdir/esm-exception.ts'; assert(webpackConfig.hello === 'world'); assert(shouldBeEsm.requireType === 'undefined'); assert(subdirCjs.requireType === 'function'); assert(subdirEsm.requireType === 'undefined'); console.log(`Failures: 0`); ts-node-10.9.2/tests/module-types/override-to-cjs/tsconfig-swc.json000066400000000000000000000001071453460306300252640ustar00rootroot00000000000000{ "extends": "./tsconfig.json", "ts-node": { "swc": true } } ts-node-10.9.2/tests/module-types/override-to-cjs/tsconfig.json000066400000000000000000000004661453460306300245020ustar00rootroot00000000000000{ "ts-node": { "moduleTypes": { "webpack.config.ts": "cjs", // Test that subsequent patterns override earlier ones "src/cjs-subdir/**/*": "esm", "src/cjs-subdir": "cjs", "src/cjs-subdir/esm-exception.ts": "esm" } }, "compilerOptions": { "module": "ES2015" } } ts-node-10.9.2/tests/module-types/override-to-cjs/webpack.config.ts000066400000000000000000000000461453460306300252150ustar00rootroot00000000000000export const hello: string = 'world'; ts-node-10.9.2/tests/module-types/override-to-esm/000077500000000000000000000000001453460306300217725ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-esm/package.json000066400000000000000000000000031453460306300242510ustar00rootroot00000000000000{} ts-node-10.9.2/tests/module-types/override-to-esm/src/000077500000000000000000000000001453460306300225615ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-esm/src/esm-subdir/000077500000000000000000000000001453460306300246335ustar00rootroot00000000000000ts-node-10.9.2/tests/module-types/override-to-esm/src/esm-subdir/cjs-exception.ts000066400000000000000000000001071453460306300277540ustar00rootroot00000000000000declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-esm/src/esm-subdir/index.ts000066400000000000000000000001071453460306300263100ustar00rootroot00000000000000declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-esm/src/should-be-cjs.ts000066400000000000000000000001451453460306300255700ustar00rootroot00000000000000export const a: string = 'b'; declare const require: any; export const requireType = typeof require; ts-node-10.9.2/tests/module-types/override-to-esm/test.cjs000066400000000000000000000006071453460306300234550ustar00rootroot00000000000000const assert = require('assert'); let failures = 0; const shouldBeCjs = require('./src/should-be-cjs.ts'); assert(shouldBeCjs.requireType === 'function'); try { require('./src/esm-subdir'); failures++; } catch (e) { // good } const cjsException = require('./src/esm-subdir/cjs-exception.ts'); assert(cjsException.requireType === 'function'); console.log(`Failures: ${failures}`); ts-node-10.9.2/tests/module-types/override-to-esm/test.mjs000066400000000000000000000005561453460306300234720ustar00rootroot00000000000000import assert from 'assert'; import shouldBeCjs from './src/should-be-cjs.ts'; import * as subdirEsm from './src/esm-subdir/index.ts'; import subdirCjs from './src/esm-subdir/cjs-exception.ts'; assert(shouldBeCjs.requireType === 'function'); assert(subdirEsm.requireType === 'undefined'); assert(subdirCjs.requireType === 'function'); console.log(`Failures: 0`); ts-node-10.9.2/tests/module-types/override-to-esm/tsconfig-swc.json000066400000000000000000000001071453460306300252710ustar00rootroot00000000000000{ "extends": "./tsconfig.json", "ts-node": { "swc": true } } ts-node-10.9.2/tests/module-types/override-to-esm/tsconfig.json000066400000000000000000000004261453460306300245030ustar00rootroot00000000000000{ "ts-node": { "moduleTypes": { // Test that subsequent patterns override earlier ones "src/esm-subdir/**/*": "cjs", "src/esm-subdir": "esm", "src/esm-subdir/cjs-exception.ts": "cjs" } }, "compilerOptions": { "module": "CommonJS" } } ts-node-10.9.2/tests/module.ts000066400000000000000000000001051453460306300161530ustar00rootroot00000000000000export function example(foo: string) { return foo.toUpperCase(); } ts-node-10.9.2/tests/package.json000066400000000000000000000002511453460306300166060ustar00rootroot00000000000000{ "dependencies": { "@swc/core": "latest", "ts-node": "file:ts-node-packed.tgz", "tslog": "3.2.2" }, "volta": { "extends": "../package.json" } } ts-node-10.9.2/tests/pluggable-dep-resolution/000077500000000000000000000000001453460306300212335ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/000077500000000000000000000000001453460306300237105ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/@swc/000077500000000000000000000000001453460306300246045ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/@swc/core/000077500000000000000000000000001453460306300255345ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/@swc/core/index.js000066400000000000000000000001631453460306300272010ustar00rootroot00000000000000module.exports = { transformSync() { return { code: 'emit from root @swc/core', map: '{}' }; }, }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/@swc/wasm/000077500000000000000000000000001453460306300255535ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/@swc/wasm/index.js000066400000000000000000000001631453460306300272200ustar00rootroot00000000000000module.exports = { transformSync() { return { code: 'emit from root @swc/wasm', map: '{}' }; }, }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-compiler/000077500000000000000000000000001453460306300270325ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-compiler/index.js000066400000000000000000000004121453460306300304740ustar00rootroot00000000000000module.exports = { ...require('typescript'), transpileModule() { return { outputText: 'emit from root custom compiler', sourceMapText: '{}', }; }, createProgram() { throw 'emit from root custom compiler'; } }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-swc/000077500000000000000000000000001453460306300260145ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-swc/index.js000066400000000000000000000001741453460306300274630ustar00rootroot00000000000000module.exports = { transformSync() { return { code: 'emit from root custom swc backend', map: '{}' }; }, }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-transpiler/000077500000000000000000000000001453460306300274035ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/custom-transpiler/index.js000066400000000000000000000003211453460306300310440ustar00rootroot00000000000000module.exports.create = function () { return { transpile() { return { outputText: 'emit from root custom transpiler', sourceMapText: '{}', }; }, }; }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/000077500000000000000000000000001453460306300264215ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/000077500000000000000000000000001453460306300310765ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/@swc/000077500000000000000000000000001453460306300317725ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/@swc/core/000077500000000000000000000000001453460306300327225ustar00rootroot00000000000000index.js000066400000000000000000000001741453460306300343120ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/@swc/coremodule.exports = { transformSync() { return { code: 'emit from shared-config @swc/core', map: '{}' }; }, }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/@swc/wasm/000077500000000000000000000000001453460306300327415ustar00rootroot00000000000000index.js000066400000000000000000000001741453460306300343310ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/@swc/wasmmodule.exports = { transformSync() { return { code: 'emit from shared-config @swc/wasm', map: '{}' }; }, }; custom-compiler/000077500000000000000000000000001453460306300341415ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modulesindex.js000066400000000000000000000004341453460306300356070ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/custom-compilermodule.exports = { ...require('typescript'), transpileModule() { return { outputText: 'emit from shared-config custom compiler', sourceMapText: '{}', }; }, createProgram() { throw 'emit from shared-config custom compiler'; } }; ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/custom-swc/000077500000000000000000000000001453460306300332025ustar00rootroot00000000000000index.js000066400000000000000000000002051453460306300345650ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/custom-swcmodule.exports = { transformSync() { return { code: 'emit from shared-config custom swc backend', map: '{}' }; }, }; custom-transpiler/000077500000000000000000000000001453460306300345125ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modulesindex.js000066400000000000000000000003321453460306300361550ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/node_modules/custom-transpilermodule.exports.create = function () { return { transpile() { return { outputText: 'emit from shared-config custom transpiler', sourceMapText: '{}', }; }, }; }; tsconfig-custom-compiler.json000066400000000000000000000001001453460306300341600ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config{"ts-node":{"transpileOnly":true,"compiler":"custom-compiler"}} tsconfig-custom-transpiler.json000066400000000000000000000001041453460306300345350ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config{"ts-node":{"transpileOnly":true,"transpiler":"custom-transpiler"}} ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/tsconfig-swc-core.json000066400000000000000000000001401453460306300326430ustar00rootroot00000000000000{"ts-node":{"transpileOnly":true,"transpiler":["ts-node/transpilers/swc",{"swc":"@swc/core"}]}} tsconfig-swc-custom-backend.json000066400000000000000000000001411453460306300345340ustar00rootroot00000000000000ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config{"ts-node":{"transpileOnly":true,"transpiler":["ts-node/transpilers/swc",{"swc":"custom-swc"}]}} ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/tsconfig-swc-wasm.json000066400000000000000000000001401453460306300326620ustar00rootroot00000000000000{"ts-node":{"transpileOnly":true,"transpiler":["ts-node/transpilers/swc",{"swc":"@swc/wasm"}]}} ts-node-10.9.2/tests/pluggable-dep-resolution/node_modules/shared-config/tsconfig-swc.json000066400000000000000000000000311453460306300317140ustar00rootroot00000000000000{"ts-node":{"swc":true}} ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-custom-compiler.json000066400000000000000000000001101453460306300270520ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "compiler": "custom-compiler" } } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-custom-transpiler.json000066400000000000000000000001141453460306300274270ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": "custom-transpiler" } } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-custom-compiler.json000066400000000000000000000000751453460306300303510ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-custom-compiler.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-custom-transpiler.json000066400000000000000000000000771453460306300307240ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-custom-transpiler.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-swc-core.json000066400000000000000000000000661453460306300267510ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-swc-core.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-swc-custom-backend.json000066400000000000000000000001001453460306300307050ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-swc-custom-backend.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-swc-wasm.json000066400000000000000000000000661453460306300267700ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-swc-wasm.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-extend-swc.json000066400000000000000000000000611453460306300260160ustar00rootroot00000000000000{ "extends": "shared-config/tsconfig-swc.json" } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-swc-core.json000066400000000000000000000001701453460306300254600ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": ["ts-node/transpilers/swc", { "swc": "@swc/core" }] } } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-swc-custom-backend.json000066400000000000000000000001711453460306300274300ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": ["ts-node/transpilers/swc", { "swc": "custom-swc" }] } } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-swc-wasm.json000066400000000000000000000001701453460306300254770ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": ["ts-node/transpilers/swc", { "swc": "@swc/wasm" }] } } ts-node-10.9.2/tests/pluggable-dep-resolution/tsconfig-swc.json000066400000000000000000000000371453460306300245340ustar00rootroot00000000000000{ "ts-node": { "swc": true } } ts-node-10.9.2/tests/recursive-fork/000077500000000000000000000000001453460306300172705ustar00rootroot00000000000000ts-node-10.9.2/tests/recursive-fork/index.ts000066400000000000000000000007701453460306300207530ustar00rootroot00000000000000import { fork } from 'child_process'; // Type syntax to prove its compiled, though the import above should also // prove the same const a = null as any; console.log(JSON.stringify({ execArgv: process.execArgv, argv: process.argv })); if (process.env.generation !== 'grandchild') { const nextGeneration = process.env.generation === 'child' ? 'grandchild' : 'child'; fork(__filename, process.argv.slice(2), { env: { ...process.env, generation: nextGeneration }, stdio: 'inherit', }); } ts-node-10.9.2/tests/recursive-fork/package.json000066400000000000000000000000031453460306300215470ustar00rootroot00000000000000{} ts-node-10.9.2/tests/recursive-fork/tsconfig.json000066400000000000000000000000761453460306300220020ustar00rootroot00000000000000{ "compilerOptions": { "moduleResolution": "node" } } ts-node-10.9.2/tests/repl-ignored-diagnostics/000077500000000000000000000000001453460306300212165ustar00rootroot00000000000000ts-node-10.9.2/tests/repl-ignored-diagnostics/index.ts000066400000000000000000000003651453460306300227010ustar00rootroot00000000000000// This script triggers a diagnostic that is ignored in the virtual file but // *not* in files such as this one. // When this file is required by the REPL, the diagnostic *should* be logged. export {}; function foo() {} function foo() {} ts-node-10.9.2/tests/repl/000077500000000000000000000000001453460306300152645ustar00rootroot00000000000000ts-node-10.9.2/tests/repl/script.js000066400000000000000000000003561453460306300171320ustar00rootroot00000000000000console.log( JSON.stringify({ stdinReport: typeof stdinReport !== 'undefined' && stdinReport, evalReport: typeof evalReport !== 'undefined' && evalReport, replReport: typeof replReport !== 'undefined' && replReport, }) ); ts-node-10.9.2/tests/repl/tla-import.ts000066400000000000000000000000361453460306300177230ustar00rootroot00000000000000export const foo: string = 1; ts-node-10.9.2/tests/require-cache.ts000066400000000000000000000003311453460306300174040ustar00rootroot00000000000000const moduleName = require.resolve('./module'); const { example: example1 } = require(moduleName); delete require.cache[moduleName]; const { example: example2 } = require(moduleName); export { example1, example2 }; ts-node-10.9.2/tests/resolver/000077500000000000000000000000001453460306300161635ustar00rootroot00000000000000ts-node-10.9.2/tests/resolver/README.md000066400000000000000000000020361453460306300174430ustar00rootroot00000000000000TODO must require explicit rootDir; do not allow to be inferred. TODO resolve JSON if resolveJsonModules?? Test a bunch of permutations of: config permutations: - allowJs - not allowJs - preferSrc - not preferSrc import permutations: - Relative import of file - Relative import of index - rootless library import of main - rootless library import of index - rootless library import of exports sub-path - rootless self-import of main - rootless self-import of index - rootless self-import of exports sub-path - Require with extension - Require without extension - Require from dist to dist - Require from dist to src - Require from src to dist - Require from src to src lib permutations: - module exists in both src and dist (precompilation ran) - module exists in only dist (came from elsewhere) - module exists only in src (did not precompile) - .ts / .js extension - .tsx / .js extension - .cts / .cjs extension - .mts / .mjs extension - .js / .js extension - .jsx / .js extension - .cjs / .cjs extension - .mjs / .mjs extension ts-node-10.9.2/tests/resolver/package.json000066400000000000000000000000031453460306300204420ustar00rootroot00000000000000{} ts-node-10.9.2/tests/resolver/test.sh000066400000000000000000000001071453460306300174740ustar00rootroot00000000000000#!/usr/bin/env bash set -euo pipefail cd project-preferSrc-typeModule ts-node-10.9.2/tests/scope/000077500000000000000000000000001453460306300154335ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/a/000077500000000000000000000000001453460306300156535ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/a/index.ts000066400000000000000000000001071453460306300173300ustar00rootroot00000000000000import path from 'path'; export const ext = path.extname(__filename); ts-node-10.9.2/tests/scope/a/log.ts000066400000000000000000000000621453460306300170020ustar00rootroot00000000000000import { ext } from './index'; console.log(ext); ts-node-10.9.2/tests/scope/a/tsconfig.json000066400000000000000000000000731453460306300203620ustar00rootroot00000000000000{ "compilerOptions": { "esModuleInterop": true } } ts-node-10.9.2/tests/scope/b/000077500000000000000000000000001453460306300156545ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/b/index.ts000066400000000000000000000001071453460306300173310ustar00rootroot00000000000000import path from 'path'; export const ext = path.extname(__filename); ts-node-10.9.2/tests/scope/b/tsconfig.json000066400000000000000000000000731453460306300203630ustar00rootroot00000000000000{ "compilerOptions": { "esModuleInterop": true } } ts-node-10.9.2/tests/scope/c/000077500000000000000000000000001453460306300156555ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/c/config/000077500000000000000000000000001453460306300171225ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/c/config/index.ts000066400000000000000000000000421453460306300205750ustar00rootroot00000000000000export const a: string = 'value'; ts-node-10.9.2/tests/scope/c/config/scopedir/000077500000000000000000000000001453460306300207325ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/c/config/scopedir/index.ts000066400000000000000000000000421453460306300224050ustar00rootroot00000000000000export const a: string = 'value'; ts-node-10.9.2/tests/scope/c/config/tsconfig.json000066400000000000000000000001071453460306300216270ustar00rootroot00000000000000{ "ts-node": { "scope": true, "scopeDir": "./scopedir" } } ts-node-10.9.2/tests/scope/c/index.js000066400000000000000000000007241453460306300173250ustar00rootroot00000000000000let failures = 0; try { // This should fail with an error because it is outside scopedir require('./scopedir/index'); failures++; } catch (e) { // good } try { // This should fail with an error because it is outside scopedir require('./config/index'); failures++; } catch (e) { // good } try { // this should succeed console.log(require('./config/scopedir/index').a); } catch (e) { // bad failures++; } console.log(`Failures: ${failures}`); ts-node-10.9.2/tests/scope/c/scopedir/000077500000000000000000000000001453460306300174655ustar00rootroot00000000000000ts-node-10.9.2/tests/scope/c/scopedir/index.ts000066400000000000000000000000421453460306300211400ustar00rootroot00000000000000export const a: string = 'value'; ts-node-10.9.2/tests/signals.ts000066400000000000000000000004721453460306300163350ustar00rootroot00000000000000process.on('SIGINT', () => { process.stdout.write('exited'); setTimeout(() => { process.stdout.write(' fine'); // Needed to make sure what we wrote has time // to be written process.nextTick(() => process.exit()); }, 500); }); setInterval(() => console.log('should not be reached'), 3000); ts-node-10.9.2/tests/spy-swc-transpiler.js000066400000000000000000000010361453460306300204460ustar00rootroot00000000000000// Spy on the swc transpiler so that tests can prove it was used rather than // TypeScript's `transpileModule`. const swcTranspiler = require('ts-node/transpilers/swc'); global.swcTranspilerCalls = 0; const wrappedCreate = swcTranspiler.create; swcTranspiler.create = function (...args) { const transpiler = wrappedCreate(...args); const wrappedTranspile = transpiler.transpile; transpiler.transpile = function (...args) { global.swcTranspilerCalls++; return wrappedTranspile.call(this, ...args); }; return transpiler; }; ts-node-10.9.2/tests/throw error react tsx.tsx000066400000000000000000000011111453460306300212070ustar00rootroot00000000000000// intentional whitespace to prove that sourcemaps are working. Throw should happen on line 100. // 100 lines is meant to be far more space than the helper functions would take. // Space in filename is intentional to ensure we handle this correctly when providing sourcemaps const React = { createElement: (...args: any[]) => null }; class Foo { constructor() { this.bar(); } bar() { throw new Error('this is a demo'); } someJsx() { return
; } } new Foo(); export {}; ts-node-10.9.2/tests/throw error.ts000066400000000000000000000007511453460306300171520ustar00rootroot00000000000000// intentional whitespace to prove that sourcemaps are working. Throw should happen on line 100. // 100 lines is meant to be far more space than the helper functions would take. // Space in filename is intentional to ensure we handle this correctly when providing sourcemaps class Foo { constructor() { this.bar(); } bar() { throw new Error('this is a demo'); } } new Foo(); export {}; ts-node-10.9.2/tests/transpile-only-swc-native-esm/000077500000000000000000000000001453460306300221425ustar00rootroot00000000000000ts-node-10.9.2/tests/transpile-only-swc-native-esm/index.ts000066400000000000000000000001131453460306300236140ustar00rootroot00000000000000const x: number = `Hello ${import.meta.url.slice(0, 7)}!`; console.log(x); ts-node-10.9.2/tests/transpile-only-swc-native-esm/package.json000066400000000000000000000000271453460306300244270ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/transpile-only-swc-native-esm/tsconfig.json000066400000000000000000000004031453460306300246460ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": "ts-node/transpilers/swc-experimental" }, "compilerOptions": { "target": "ES2018", "module": "ESNext", "allowJs": true, "jsx": "react", "experimentalDecorators": true } } ts-node-10.9.2/tests/transpile-only-swc-shorthand-via-tsconfig/000077500000000000000000000000001453460306300244535ustar00rootroot00000000000000ts-node-10.9.2/tests/transpile-only-swc-shorthand-via-tsconfig/index.ts000066400000000000000000000005671453460306300261420ustar00rootroot00000000000000// Test for #1343 const Decorator = function () {}; @Decorator class World {} // intentional type errors to check transpile-only ESM loader skips type checking parseInt(1101, 2); const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`; console.log(x); // test module type emit import { readFileSync } from 'fs'; readFileSync; ts-node-10.9.2/tests/transpile-only-swc-shorthand-via-tsconfig/tsconfig.json000066400000000000000000000003011453460306300271540ustar00rootroot00000000000000{ "ts-node": { "swc": true }, "compilerOptions": { "target": "ES2018", "module": "CommonJS", "allowJs": true, "jsx": "react", "experimentalDecorators": true } } ts-node-10.9.2/tests/transpile-only-swc-via-tsconfig/000077500000000000000000000000001453460306300224635ustar00rootroot00000000000000ts-node-10.9.2/tests/transpile-only-swc-via-tsconfig/index.ts000066400000000000000000000005671453460306300241520ustar00rootroot00000000000000// Test for #1343 const Decorator = function () {}; @Decorator class World {} // intentional type errors to check transpile-only ESM loader skips type checking parseInt(1101, 2); const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`; console.log(x); // test module type emit import { readFileSync } from 'fs'; readFileSync; ts-node-10.9.2/tests/transpile-only-swc-via-tsconfig/tsconfig.json000066400000000000000000000003701453460306300251720ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true, "transpiler": "ts-node/transpilers/swc" }, "compilerOptions": { "target": "ES2018", "module": "CommonJS", "allowJs": true, "jsx": "react", "experimentalDecorators": true } } ts-node-10.9.2/tests/transpile-only-swc/000077500000000000000000000000001453460306300200745ustar00rootroot00000000000000ts-node-10.9.2/tests/transpile-only-swc/index.ts000066400000000000000000000005671453460306300215630ustar00rootroot00000000000000// Test for #1343 const Decorator = function () {}; @Decorator class World {} // intentional type errors to check transpile-only ESM loader skips type checking parseInt(1101, 2); const x: number = `Hello ${World.name}! swc transpiler invocation count: ${global.swcTranspilerCalls}`; console.log(x); // test module type emit import { readFileSync } from 'fs'; readFileSync; ts-node-10.9.2/tests/transpile-only-swc/tsconfig.json000066400000000000000000000002351453460306300226030ustar00rootroot00000000000000{ "compilerOptions": { "target": "ES2018", "module": "CommonJS", "allowJs": true, "jsx": "react", "experimentalDecorators": true } } ts-node-10.9.2/tests/ts-import-specifiers/000077500000000000000000000000001453460306300204125ustar00rootroot00000000000000ts-node-10.9.2/tests/ts-import-specifiers/bar.tsx000066400000000000000000000000311453460306300217100ustar00rootroot00000000000000export const bar = true; ts-node-10.9.2/tests/ts-import-specifiers/foo.ts000066400000000000000000000000311453460306300215370ustar00rootroot00000000000000export const foo = true; ts-node-10.9.2/tests/ts-import-specifiers/index.ts000066400000000000000000000001341453460306300220670ustar00rootroot00000000000000import { foo } from './foo.ts'; import { bar } from './bar.jsx'; console.log({ foo, bar }); ts-node-10.9.2/tests/ts-import-specifiers/tsconfig.json000066400000000000000000000004001453460306300231130ustar00rootroot00000000000000{ "ts-node": { // Can eventually make this a stable feature. For now, `experimental` flag allows me to iterate quickly "experimentalTsImportSpecifiers": true, "experimentalResolver": true }, "compilerOptions": { "jsx": "react" } } ts-node-10.9.2/tests/ts45-ext/000077500000000000000000000000001453460306300157175ustar00rootroot00000000000000ts-node-10.9.2/tests/ts45-ext/ext-cts/000077500000000000000000000000001453460306300173065ustar00rootroot00000000000000ts-node-10.9.2/tests/ts45-ext/ext-cts/index.cts000066400000000000000000000000631453460306300211270ustar00rootroot00000000000000export function main() { return 'hello world'; } ts-node-10.9.2/tests/ts45-ext/ext-cts/tsconfig.json000066400000000000000000000001551453460306300220160ustar00rootroot00000000000000{ "ts-node": { "experimentalResolver": true }, "compilerOptions": { "module": "CommonJS" } } ts-node-10.9.2/tests/ts45-ext/ext-mts/000077500000000000000000000000001453460306300173205ustar00rootroot00000000000000ts-node-10.9.2/tests/ts45-ext/ext-mts/entrypoint.mjs000066400000000000000000000000711453460306300222440ustar00rootroot00000000000000import { main } from './index.mjs'; console.log(main()); ts-node-10.9.2/tests/ts45-ext/ext-mts/index.mts000066400000000000000000000000631453460306300211530ustar00rootroot00000000000000export function main() { return 'hello world'; } ts-node-10.9.2/tests/ts45-ext/ext-mts/tsconfig.json000066400000000000000000000001741453460306300220310ustar00rootroot00000000000000{ "ts-node": { "esm": true, "experimentalResolver": true }, "compilerOptions": { "module": "ESNext" } } ts-node-10.9.2/tests/tsconfig-bases/000077500000000000000000000000001453460306300172315ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-bases/node10/000077500000000000000000000000001453460306300203175ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-bases/node10/tsconfig.json000066400000000000000000000000601453460306300230220ustar00rootroot00000000000000{ "extends": "ts-node/node10/tsconfig.json" } ts-node-10.9.2/tests/tsconfig-bases/node12/000077500000000000000000000000001453460306300203215ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-bases/node12/tsconfig.json000066400000000000000000000000601453460306300230240ustar00rootroot00000000000000{ "extends": "ts-node/node12/tsconfig.json" } ts-node-10.9.2/tests/tsconfig-bases/node14/000077500000000000000000000000001453460306300203235ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-bases/node14/tsconfig.json000066400000000000000000000000601453460306300230260ustar00rootroot00000000000000{ "extends": "ts-node/node14/tsconfig.json" } ts-node-10.9.2/tests/tsconfig-bases/node16/000077500000000000000000000000001453460306300203255ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-bases/node16/tsconfig.json000066400000000000000000000000601453460306300230300ustar00rootroot00000000000000{ "extends": "ts-node/node16/tsconfig.json" } ts-node-10.9.2/tests/tsconfig-extends/000077500000000000000000000000001453460306300176065ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-extends/other/000077500000000000000000000000001453460306300207275ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-extends/other/require-hook.js000066400000000000000000000000001453460306300236650ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-extends/other/tsconfig.json000066400000000000000000000001271453460306300234360ustar00rootroot00000000000000{ "ts-node": { "require": ["./require-hook"], "scopeDir": "./scopedir" } } ts-node-10.9.2/tests/tsconfig-extends/tsconfig.json000066400000000000000000000001261453460306300223140ustar00rootroot00000000000000{ "extends": "./other/tsconfig.json", "ts-node": { "preferTsExts": true } } ts-node-10.9.2/tests/tsconfig-options/000077500000000000000000000000001453460306300176275ustar00rootroot00000000000000ts-node-10.9.2/tests/tsconfig-options/log-options1.js000066400000000000000000000003441453460306300225210ustar00rootroot00000000000000const assert = require('assert'); assert(process.required1); const register = process[Symbol.for('ts-node.register.instance')]; console.log( JSON.stringify({ options: register.options, config: register.config, }) ); ts-node-10.9.2/tests/tsconfig-options/log-options2.js000066400000000000000000000001301453460306300225130ustar00rootroot00000000000000const assert = require('assert'); require('./log-options1'); assert(process.required2); ts-node-10.9.2/tests/tsconfig-options/required1.js000066400000000000000000000000321453460306300220610ustar00rootroot00000000000000process.required1 = true; ts-node-10.9.2/tests/tsconfig-options/required2.js000066400000000000000000000001001453460306300220560ustar00rootroot00000000000000require('assert')(process.required1); process.required2 = true; ts-node-10.9.2/tests/tsconfig-options/tsconfig.json000066400000000000000000000004711453460306300223400ustar00rootroot00000000000000{ "extends": "../tsconfig.json", "ts-node": { "compilerOptions": { "types": ["tsconfig-tsnode-types"] }, "transpileOnly": true, "require": ["./required1"], "skipIgnore": false }, "compilerOptions": { "typeRoots": ["tsconfig-typeroots"], "types": ["tsconfig-types"] } } ts-node-10.9.2/tests/tsconfig-transpile-only.json000066400000000000000000000003721453460306300220110ustar00rootroot00000000000000{ "ts-node": { "transpileOnly": true }, "compilerOptions": { "target": "es2015", "jsx": "react", "noEmit": true, "strict": true, // Global type definitions. "typeRoots": ["./typings", "../node_modules/@types"] } } ts-node-10.9.2/tests/tsconfig.json000066400000000000000000000003141453460306300170270ustar00rootroot00000000000000{ "compilerOptions": { "target": "es2015", "jsx": "react", "noEmit": true, "strict": true, // Global type definitions. "typeRoots": ["./typings", "../node_modules/@types"] } } ts-node-10.9.2/tests/typings/000077500000000000000000000000001453460306300160175ustar00rootroot00000000000000ts-node-10.9.2/tests/typings/does-not-exist/000077500000000000000000000000001453460306300207015ustar00rootroot00000000000000ts-node-10.9.2/tests/typings/does-not-exist/index.d.ts000066400000000000000000000001041453460306300225750ustar00rootroot00000000000000declare module 'does-not-exist' { export const foobar = 'test'; } ts-node-10.9.2/tests/with-jsx.tsx000066400000000000000000000000701453460306300166340ustar00rootroot00000000000000class Foo2 { render() { return
; } } ts-node-10.9.2/tests/working-dir/000077500000000000000000000000001453460306300165565ustar00rootroot00000000000000ts-node-10.9.2/tests/working-dir/cjs/000077500000000000000000000000001453460306300173355ustar00rootroot00000000000000ts-node-10.9.2/tests/working-dir/cjs/index.ts000066400000000000000000000003551453460306300210170ustar00rootroot00000000000000import { strictEqual } from 'assert'; import { normalize, dirname } from 'path'; // Expect the working directory to be the parent directory. strictEqual(normalize(process.cwd()), normalize(dirname(__dirname))); console.log('Passing'); ts-node-10.9.2/tests/working-dir/esm/000077500000000000000000000000001453460306300173425ustar00rootroot00000000000000ts-node-10.9.2/tests/working-dir/esm/index.ts000066400000000000000000000004661453460306300210270ustar00rootroot00000000000000import { strictEqual } from 'assert'; import { normalize, dirname } from 'path'; import { fileURLToPath } from 'url'; // Expect the working directory to be the parent directory. strictEqual( normalize(process.cwd()), normalize(dirname(dirname(fileURLToPath(import.meta.url)))) ); console.log('Passing'); ts-node-10.9.2/tests/working-dir/esm/package.json000066400000000000000000000000271453460306300216270ustar00rootroot00000000000000{ "type": "module" } ts-node-10.9.2/tests/working-dir/esm/tsconfig.json000066400000000000000000000001321453460306300220450ustar00rootroot00000000000000{ "compilerOptions": { "module": "ESNext" }, "ts-node": { "swc": true } } ts-node-10.9.2/tests/working-dir/forking/000077500000000000000000000000001453460306300202155ustar00rootroot00000000000000ts-node-10.9.2/tests/working-dir/forking/index.ts000066400000000000000000000012621453460306300216750ustar00rootroot00000000000000import { fork } from 'child_process'; import { join } from 'path'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; const workerProcess = fork('./worker.ts', [], { stdio: 'pipe', cwd: join(__dirname, 'subfolder'), }); let stdout = ''; workerProcess.stdout!.on('data', (chunk) => (stdout += chunk.toString('utf8'))); workerProcess.on('error', () => (process.exitCode = 1)); workerProcess.on('close', (status, signal) => { if (status === 0 && signal === null && stdout.trim() === 'Works') { console.log('Passing: from main'); process.exitCode = 0; } }); ts-node-10.9.2/tests/working-dir/forking/subfolder/000077500000000000000000000000001453460306300222025ustar00rootroot00000000000000ts-node-10.9.2/tests/working-dir/forking/subfolder/worker.ts000066400000000000000000000000701453460306300240600ustar00rootroot00000000000000const message: string = 'Works'; console.log(message); ts-node-10.9.2/tests/working-dir/tsconfig.json000066400000000000000000000001221453460306300212600ustar00rootroot00000000000000{ "extends": "../tsconfig.json", "ts-node": { "transpileOnly": true } } ts-node-10.9.2/transpilers/000077500000000000000000000000001453460306300155265ustar00rootroot00000000000000ts-node-10.9.2/transpilers/swc-experimental.js000066400000000000000000000000641453460306300213530ustar00rootroot00000000000000module.exports = require('../dist/transpilers/swc') ts-node-10.9.2/transpilers/swc.js000066400000000000000000000000641453460306300166600ustar00rootroot00000000000000module.exports = require('../dist/transpilers/swc') ts-node-10.9.2/tsconfig.build-dist-raw.json000066400000000000000000000006531453460306300205210ustar00rootroot00000000000000// This tsconfig.json is referenced by tsconfig.build-dist.json, a little trick to keep tsc happy. { "extends": "./tsconfig.json", "compilerOptions": { "composite": true, "allowJs": true, "checkJs": false, "noResolve": true, "declaration": true, "noEmit": false, "emitDeclarationOnly": true, "rootDir": "dist-raw", "outDir": "temp/dist-raw" }, "include": [ "dist-raw/**/*" ] } ts-node-10.9.2/tsconfig.build-dist.json000066400000000000000000000007301453460306300177260ustar00rootroot00000000000000// This tsconfig.json drives compiling the src/ directory into the dist/ directory { "extends": "./tsconfig.json", "references": [{ "path": "./tsconfig.build-dist-raw.json" }], "compilerOptions": { "noEmit": false, "rootDir": "src", "outDir": "dist", "tsBuildInfoFile": "temp/tsconfig.build-dist.tsbuildinfo", "allowJs": false, "rootDirs": ["temp", "."] }, "include": [ "src/**/*" ], "exclude": [ "src/test/**/*", ] } ts-node-10.9.2/tsconfig.build-schema.json000066400000000000000000000004471453460306300202300ustar00rootroot00000000000000// This tsconfig.json is used when we generate the tsconfig JSON schema { "extends": "./tsconfig.json", "compilerOptions": { "incremental": false, "tsBuildInfoFile": null, "noEmit": false, "allowJs": true, "checkJs": false, }, "exclude": [ "src/test/**/*", ] } ts-node-10.9.2/tsconfig.json000066400000000000000000000024071453460306300156720ustar00rootroot00000000000000// This tsconfig.json drives Intellisense { "$schema": "./tsconfig.schemastore-schema.json", "compilerOptions": { // `target` and `lib` match @tsconfig/bases for node12, since that's the oldest node LTS, so it's the oldest node we support "target": "es2019", "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string", "dom"], "rootDir": ".", "outDir": "temp", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", "noEmit": true, "module": "commonjs", "moduleResolution": "node", "strict": true, "declaration": true, "sourceMap": true, "inlineSources": true, "types": ["node"], "stripInternal": true, "incremental": true, "skipLibCheck": true, "importsNotUsedAsValues": "error", "allowJs": true, // Enable to assist in sanity-checking your changes to JS files, but note you will see many unrelated type errors! // "checkJs": true, // "noImplicitAny": false }, "include": [ "src/**/*" ], "typedocOptions": { "entryPoints": ["./src/index.ts"], "readme": "none", "out": "website/static/api", "excludeTags": ["allof"], "categorizeByGroup": false, "categoryOrder": ["Basic", "REPL", "Transpiler", "ESM Loader", "Other"], "defaultCategory": "Other" } } ts-node-10.9.2/tsdoc.json000066400000000000000000000013001453460306300151610ustar00rootroot00000000000000{ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", "supportForTags": { // Indicate that the custom tag is supported by your tooling. (Without this, warnings may // be reported saying that the tag is unsupported.) "@default": true, "@allOf": true, "@see": true, "@deprecated": true, "@category": true }, "tagDefinitions": [ { "tagName": "@default", "syntaxKind": "block", "allowMultiple": false }, { "tagName": "@allOf", "syntaxKind": "block", "allowMultiple": false }, { "tagName": "@category", "syntaxKind": "inline", "allowMultiple": false } ] } ts-node-10.9.2/website/000077500000000000000000000000001453460306300146225ustar00rootroot00000000000000ts-node-10.9.2/website/.gitignore000066400000000000000000000003511453460306300166110ustar00rootroot00000000000000# Dependencies /node_modules # Production /build # Generated files .docusaurus .cache-loader # Misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* ts-node-10.9.2/website/README.md000066400000000000000000000013511453460306300161010ustar00rootroot00000000000000# Website This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. ## Installation ```console yarn install ``` ## Local Development ```console yarn start ``` This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. ## Build ```console yarn build ``` This command generates static content into the `build` directory and can be served using any static contents hosting service. ## Deployment ```console GIT_USER= USE_SSH=true yarn deploy ``` If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. ts-node-10.9.2/website/babel.config.js000066400000000000000000000001311453460306300174640ustar00rootroot00000000000000module.exports = { presets: [require.resolve('@docusaurus/core/lib/babel/preset')], }; ts-node-10.9.2/website/docs/000077500000000000000000000000001453460306300155525ustar00rootroot00000000000000ts-node-10.9.2/website/docs/api.md000066400000000000000000000012361453460306300166470ustar00rootroot00000000000000--- title: API --- ts-node's complete API is documented here: [API Docs](https://typestrong.org/ts-node/api/) Here are a few highlights of what you can accomplish: - [`create()`](https://typestrong.org/ts-node/api/index.html#create) creates ts-node's compiler service without registering any hooks. - [`createRepl()`](https://typestrong.org/ts-node/api/index.html#createRepl) creates an instance of our REPL service, so you can create your own TypeScript-powered REPLs. - [`createEsmHooks()`](https://typestrong.org/ts-node/api/index.html#createEsmHooks) creates our ESM loader hooks, suitable for composing with other loaders or augmenting with additional features. ts-node-10.9.2/website/docs/commonjs-vs-native-ecmascript-modules.md000066400000000000000000000070221453460306300254320ustar00rootroot00000000000000--- title: "CommonJS vs native ECMAScript modules" slug: imports --- TypeScript is almost always written using modern `import` syntax, but it is also transformed before being executed by the underlying runtime. You can choose to either transform to CommonJS or to preserve the native `import` syntax, using node's native ESM support. Configuration is different for each. Here is a brief comparison of the two. | CommonJS | Native ECMAScript modules | |---|---| | Write native `import` syntax | Write native `import` syntax | | Transforms `import` into `require()` | Does not transform `import` | | Node executes scripts using the classic [CommonJS loader](https://nodejs.org/dist/latest-v16.x/docs/api/modules.html) | Node executes scripts using the new [ESM loader](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html) | | Use any of:
`ts-node`
`node -r ts-node/register`
`NODE_OPTIONS="ts-node/register" node`
`require('ts-node').register({/* options */})` | Use any of:
`ts-node --esm`
`ts-node-esm`
Set `"esm": true` in `tsconfig.json`
`node --loader ts-node/esm`
`NODE_OPTIONS="--loader ts-node/esm" node` | ## CommonJS Transforming to CommonJS is typically simpler and more widely supported because it is older. You must remove [`"type": "module"`](https://nodejs.org/api/packages.html#packages_type) from `package.json` and set [`"module": "CommonJS"`](https://www.typescriptlang.org/tsconfig/#module) in `tsconfig.json`. ```json title="package.json" { // This can be omitted; commonjs is the default "type": "commonjs" } ``` ```json title="tsconfig.json" { "compilerOptions": { "module": "CommonJS" } } ``` If you must keep `"module": "ESNext"` for `tsc`, webpack, or another build tool, you can set an override for ts-node. ```json title="tsconfig.json" { "compilerOptions": { "module": "ESNext" }, "ts-node": { "compilerOptions": { "module": "CommonJS" } } } ``` ## Native ECMAScript modules [Node's ESM loader hooks](https://nodejs.org/api/esm.html#esm_experimental_loaders) are [**experimental**](https://nodejs.org/api/documentation.html#documentation_stability_index) and subject to change. ts-node's ESM support is as stable as possible, but it relies on APIs which node can *and will* break in new versions of node. Thus it is not recommended for production. For complete usage, limitations, and to provide feedback, see [#1007](https://github.com/TypeStrong/ts-node/issues/1007). You must set [`"type": "module"`](https://nodejs.org/api/packages.html#packages_type) in `package.json` and [`"module": "ESNext"`](https://www.typescriptlang.org/tsconfig/#module) in `tsconfig.json`. ```json title="package.json" { "type": "module" } ``` ```json title="tsconfig.json" { "compilerOptions": { "module": "ESNext" // or ES2015, ES2020 }, "ts-node": { // Tell ts-node CLI to install the --loader automatically, explained below "esm": true } } ``` You must also ensure node is passed `--loader`. The ts-node CLI will do this automatically with our `esm` option. > Note: `--esm` must spawn a child process to pass it `--loader`. This may change if node adds the ability to install loader hooks into the current process. ```shell # pass the flag ts-node --esm # Use the convenience binary ts-node-esm # or add `"esm": true` to your tsconfig.json to make it automatic ts-node ``` If you are not using our CLI, pass the loader flag to node. ```shell node --loader ts-node/esm ./index.ts # Or via environment variable NODE_OPTIONS="--loader ts-node/esm" node ./index.ts ``` ts-node-10.9.2/website/docs/compilers.md000066400000000000000000000015121453460306300200700ustar00rootroot00000000000000--- title: Third-party compilers --- Some projects require a patched typescript compiler which adds additional features. For example, [`ttypescript`](https://github.com/cevek/ttypescript/tree/master/packages/ttypescript) and [`ts-patch`](https://github.com/nonara/ts-patch#readme) add the ability to configure custom transformers. These are drop-in replacements for the vanilla `typescript` module and implement the same API. For example, to use `ttypescript` and `ts-transformer-keys`, add this to your `tsconfig.json`: ```json title="tsconfig.json" { "ts-node": { // This can be omitted when using ts-patch "compiler": "ttypescript" }, "compilerOptions": { // plugin configuration is the same for both ts-patch and ttypescript "plugins": [ { "transform": "ts-transformer-keys/transformer" } ] } } ``` ts-node-10.9.2/website/docs/configuration.md000066400000000000000000000072401453460306300207460ustar00rootroot00000000000000--- title: Configuration --- ts-node supports a variety of options which can be specified via `tsconfig.json`, as CLI flags, as environment variables, or programmatically. For a complete list, see [Options](./options.md). ## CLI flags ts-node CLI flags must come *before* the entrypoint script. For example: ```shell $ ts-node --project tsconfig-dev.json say-hello.ts Ronald Hello, Ronald! ``` ## Via tsconfig.json (recommended) ts-node automatically finds and loads `tsconfig.json`. Most ts-node options can be specified in a `"ts-node"` object using their programmatic, camelCase names. We recommend this because it works even when you cannot pass CLI flags, such as `node --require ts-node/register` and when using shebangs. Use `--skipProject` to skip loading the `tsconfig.json`. Use `--project` to explicitly specify the path to a `tsconfig.json`. When searching, it is resolved using [the same search behavior as `tsc`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html). By default, this search is performed relative to the entrypoint script. In `--cwdMode` or if no entrypoint is specified -- for example when using the REPL -- the search is performed relative to `--cwd` / `process.cwd()`. You can use this sample configuration as a starting point: ```json title="tsconfig.json" { // This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases "extends": "ts-node/node16/tsconfig.json", // Most ts-node options can be specified here using their programmatic names. "ts-node": { // It is faster to skip typechecking. // Remove if you want ts-node to do typechecking. "transpileOnly": true, "files": true, "compilerOptions": { // compilerOptions specified here will override those declared below, // but *only* in ts-node. Useful if you want ts-node and tsc to use // different options with a single tsconfig.json. } }, "compilerOptions": { // typescript options here } } ``` Our bundled [JSON schema](https://unpkg.com/browse/ts-node@latest/tsconfig.schema.json) lists all compatible options. ### @tsconfig/bases [@tsconfig/bases](https://github.com/tsconfig/bases) maintains recommended configurations for several node versions. As a convenience, these are bundled with ts-node. ```json title="tsconfig.json" { "extends": "ts-node/node16/tsconfig.json", // Or install directly with `npm i -D @tsconfig/node16` "extends": "@tsconfig/node16/tsconfig.json", } ``` ### Default config If no `tsconfig.json` is loaded from disk, ts-node will use the newest recommended defaults from [@tsconfig/bases](https://github.com/tsconfig/bases/) compatible with your `node` and `typescript` versions. With the latest `node` and `typescript`, this is [`@tsconfig/node16`](https://github.com/tsconfig/bases/blob/master/bases/node16.json). Older versions of `typescript` are incompatible with `@tsconfig/node16`. In those cases we will use an older default configuration. When in doubt, `ts-node --showConfig` will log the configuration being used, and `ts-node -vv` will log `node` and `typescript` versions. ## `node` flags [`node` flags](https://nodejs.org/api/cli.html) must be passed directly to `node`; they cannot be passed to the ts-node binary nor can they be specified in `tsconfig.json` We recommend using the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) environment variable to pass options to `node`. ```shell NODE_OPTIONS='--trace-deprecation --abort-on-uncaught-exception' ts-node ./index.ts ``` Alternatively, you can invoke `node` directly and install ts-node via `--require`/`-r` ```shell node --trace-deprecation --abort-on-uncaught-exception -r ts-node/register ./index.ts ``` ts-node-10.9.2/website/docs/how-it-works.md000066400000000000000000000010021453460306300204370ustar00rootroot00000000000000--- title: How it works --- ts-node works by registering hooks for `.ts`, `.tsx`, `.js`, and/or `.jsx` extensions. Vanilla `node` loads `.js` by reading code from disk and executing it. Our hook runs in the middle, transforming code from TypeScript to JavaScript and passing the result to `node` for execution. This transformation will respect your `tsconfig.json` as if you had compiled via `tsc`. We also register a few other hooks to apply sourcemaps to stack traces and remap from `.js` imports to `.ts`. ts-node-10.9.2/website/docs/installation.md000066400000000000000000000007571453460306300206060ustar00rootroot00000000000000--- title: Installation --- ```shell # Locally in your project. npm install -D typescript npm install -D ts-node # Or globally with TypeScript. npm install -g typescript npm install -g ts-node # Depending on configuration, you may also need these npm install -D tslib @types/node ``` **Tip:** Installing modules locally allows you to control and share the versions through `package.json`. ts-node will always resolve the compiler from `cwd` before checking relative to its own installation. ts-node-10.9.2/website/docs/module-type-overrides.md000066400000000000000000000057251453460306300223510ustar00rootroot00000000000000--- title: Module type overrides --- > Wherever possible, it is recommended to use TypeScript's [`NodeNext` or `Node16` mode](https://www.typescriptlang.org/docs/handbook/esm-node.html) instead of the options described in this section. Setting `"module": "NodeNext"` and using the `.cts` file extension should work well for most projects. When deciding how a file should be compiled and executed -- as either CommonJS or native ECMAScript module -- ts-node matches `node` and `tsc` behavior. This means TypeScript files are transformed according to your `tsconfig.json` `"module"` option and executed according to node's rules for the `package.json` `"type"` field. Set `"module": "NodeNext"` and everything should work. In rare cases, you may need to override this behavior for some files. For example, some tools read a `name-of-tool.config.ts` and require that file to execute as CommonJS. If you have `package.json` configured with `"type": "module"` and `tsconfig.json` with `"module": "esnext"`, the config is native ECMAScript by default and will raise an error. You will need to force the config and any supporting scripts to execute as CommonJS. In these situations, our `moduleTypes` option can override certain files to be CommonJS or ESM. Similar overriding is possible by using `.mts`, `.cts`, `.cjs` and `.mjs` file extensions. `moduleTypes` achieves the same effect for `.ts` and `.js` files, and *also* overrides your `tsconfig.json` `"module"` config appropriately. The following example tells ts-node to execute a webpack config as CommonJS: ```json title="tsconfig.json" { "ts-node": { "transpileOnly": true, "moduleTypes": { "webpack.config.ts": "cjs", // Globs are also supported with the same behavior as tsconfig "include" "webpack-config-scripts/**/*": "cjs" } }, "compilerOptions": { "module": "es2020", "target": "es2020" } } ``` Each key is a glob pattern with the same syntax as tsconfig's `"include"` array. When multiple patterns match the same file, the last pattern takes precedence. * `cjs` overrides matches files to compile and execute as CommonJS. * `esm` overrides matches files to compile and execute as native ECMAScript modules. * `package` resets either of the above to default behavior, which obeys `package.json` `"type"` and `tsconfig.json` `"module"` options. ## Caveats Files with an overridden module type are transformed with the same limitations as [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules). This will only affect rare cases such as using `const enum`s with [`preserveConstEnums`](https://www.typescriptlang.org/tsconfig#preserveConstEnums) disabled. This feature is meant to facilitate scenarios where normal `compilerOptions` and `package.json` configuration is not possible. For example, a `webpack.config.ts` cannot be given its own `package.json` to override `"type"`. Wherever possible you should favor using traditional `package.json` and `tsconfig.json` configurations. ts-node-10.9.2/website/docs/options-table.md000066400000000000000000000522701453460306300206620ustar00rootroot00000000000000--- title: Options --- `ts-node` supports `--print` (`-p`), `--eval` (`-e`), `--require` (`-r`) and `--interactive` (`-i`) similar to the [node.js CLI options](https://nodejs.org/api/cli.html). The API includes [additional options](https://typestrong.org/ts-node/api/interfaces/RegisterOptions.html) not shown below. _Environment variables, where available, are in `ALL_CAPS`_
CLITSConfigDescription
Shell
-h, --help Prints the help text
-v, --version Prints the version. -vv prints node and typescript compiler versions, too
-e, --eval Evaluate code
-p, --print Print result of --eval
-i, --interactive Opens the REPL even if stdin does not appear to be a terminal
TSConfig
-P, --project [path] Path to TypeScript JSON project file
Env: TS_NODE_PROJECT
--skip-project Skip project config resolution and loading
Default: false
Env: TS_NODE_SKIP_PROJECT
-c, --cwd-mode Resolve config relative to the current directory instead of the directory of the entrypoint script
-O, --compiler-options [opts] compilerOptions JSON object to merge with compiler options
Env: TS_NODE_COMPILER_OPTIONS
--show-config Print resolved tsconfig.json, including ts-node options, and exit
Typechecking
-T, --transpile-only transpileOnly Use TypeScript's faster transpileModule
Default: false
Env: TS_NODE_TRANSPILE_ONLY
--type-check Opposite of --transpile-only
Default: true
Env: TS_NODE_TYPE_CHECK
-H, --compiler-host compilerHost Use TypeScript's compiler host API
Default: false
Env: TS_NODE_COMPILER_HOST
--files files Load files, include and exclude from tsconfig.json on startup
Default: false
Env: TS_NODE_FILES
-D, --ignore-diagnostics [code] ignoreDiagnostics Ignore TypeScript warnings by diagnostic code
Env: TS_NODE_IGNORE_DIAGNOSTICS
Transpilation
-I, --ignore [pattern] ignore Override the path patterns to skip compilation
Default: /node_modules/
Env: TS_NODE_IGNORE
--skip-ignore skipIgnore Skip ignore checks
Default: false
Env: TS_NODE_SKIP_IGNORE
-C, --compiler [name] compiler Specify a custom TypeScript compiler
Default: typescript
Env: TS_NODE_COMPILER
--transpiler [name] transpiler Specify a third-party, non-typechecking transpiler
--prefer-ts-exts preferTsExts Re-order file extensions so that TypeScript imports are preferred
Default: false
Env: TS_NODE_PREFER_TS_EXTS
Diagnostics
--log-error logError Logs TypeScript errors to stderr instead of throwing exceptions
Default: false
Env: TS_NODE_LOG_ERROR
--pretty pretty Use pretty diagnostic formatter
Default: false
Env: TS_NODE_PRETTY
Enable debug logging
Env: TS_NODE_DEBUG
Advanced
-r, --require [path] require Require a node module before execution
--cwd Behave as if invoked in this working directory
Default: process.cwd()
Env: TS_NODE_CWD
--emit emit Emit output files into .ts-node directory
Default: false
Env: TS_NODE_EMIT
Path to history file for REPL
Default: ~/.ts_node_repl_history
Env: TS_NODE_HISTORY
ts-node-10.9.2/website/docs/options.md000066400000000000000000000172621453460306300175770ustar00rootroot00000000000000--- title: Options --- All command-line flags support both `--camelCase` and `--hyphen-case`. Most options can be declared in your tsconfig.json: [Configuration via tsconfig.json](./configuration.md#via-tsconfigjson-recommended) `ts-node` supports `--print` (`-p`), `--eval` (`-e`), `--require` (`-r`) and `--interactive` (`-i`) similar to the [node.js CLI](https://nodejs.org/api/cli.html). `ts-node` supports `--project` and `--showConfig` similar to the [tsc CLI](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options). _Environment variables, where available, are in `ALL_CAPS`_ ## CLI Options ### help ```shell ts-node --help ``` Prints the help text ### version ```shell ts-node -v ts-node -vvv ``` Prints the version. `-vv` includes node and typescript compiler versions. `-vvv` includes absolute paths to ts-node and typescript installations. ### eval ```shell ts-node -e # Example ts-node -e 'console.log("Hello world!")' ``` Evaluate code ### print ```shell ts-node -p -e # Example ts-node -p -e '"Hello world!"' ``` Print result of `--eval` ### interactive ```shell ts-node -i ``` Opens the REPL even if stdin does not appear to be a terminal ### esm ```shell ts-node --esm ts-node-esm ``` Bootstrap with the ESM loader, enabling full ESM support ## TSConfig Options ### project ```shell ts-node -P ts-node --project ``` Path to tsconfig file. *Note the uppercase `-P`. This is different from `tsc`'s `-p/--project` option.* *Environment:* `TS_NODE_PROJECT` ### skipProject ```shell ts-node --skipProject ``` Skip project config resolution and loading *Default:* `false`
*Environment:* `TS_NODE_SKIP_PROJECT` ### cwdMode ```shell ts-node -c ts-node --cwdMode ts-node-cwd ``` Resolve config relative to the current directory instead of the directory of the entrypoint script ### compilerOptions ```shell ts-node -O ts-node --compilerOptions ``` JSON object to merge with compiler options *Environment:* `TS_NODE_COMPILER_OPTIONS` ### showConfig ```shell ts-node --showConfig ``` Print resolved `tsconfig.json`, including `ts-node` options, and exit ## Typechecking ### transpileOnly ```shell ts-node -T ts-node --transpileOnly ``` Use TypeScript's faster `transpileModule` *Default:* `false`
*Environment:* `TS_NODE_TRANSPILE_ONLY` ### typeCheck ```shell ts-node --typeCheck ``` Opposite of `--transpileOnly` *Default:* `true`
*Environment:* `TS_NODE_TYPE_CHECK` ### compilerHost ```shell ts-node -H ts-node --compilerHost ``` Use TypeScript's compiler host API *Default:* `false`
*Environment:* `TS_NODE_COMPILER_HOST` ### files ```shell ts-node --files ``` Load `files`, `include` and `exclude` from `tsconfig.json` on startup. This may avoid certain typechecking failures. See [Missing types](./troubleshooting.md#missing-types) for details. *Default:* `false`
*Environment:* `TS_NODE_FILES` ### ignoreDiagnostics ```shell ts-node -D ts-node --ignoreDiagnostics ``` Ignore TypeScript warnings by diagnostic code *Environment:* `TS_NODE_IGNORE_DIAGNOSTICS` ## Transpilation Options ### ignore ```shell ts-node -I ts-node --ignore ``` Override the path patterns to skip compilation *Default:* `/node_modules/`
*Environment:* `TS_NODE_IGNORE` ### skipIgnore ```shell ts-node --skipIgnore ``` Skip ignore checks *Default:* `false`
*Environment:* `TS_NODE_SKIP_IGNORE` ### compiler ```shell ts-node -C ts-node --compiler ``` Specify a custom TypeScript compiler *Default:* `typescript`
*Environment:* `TS_NODE_COMPILER` ### swc ```shell ts-node --swc ``` Transpile with [swc](./swc.md). Implies `--transpileOnly` *Default:* `false` ### transpiler ```shell ts-node --transpiler # Example ts-node --transpiler ts-node/transpilers/swc ``` Use a third-party, non-typechecking transpiler ### preferTsExts ```shell ts-node --preferTsExts ``` Re-order file extensions so that TypeScript imports are preferred *Default:* `false`
*Environment:* `TS_NODE_PREFER_TS_EXTS` ## Diagnostic Options ### logError ```shell ts-node --logError ``` Logs TypeScript errors to stderr instead of throwing exceptions *Default:* `false`
*Environment:* `TS_NODE_LOG_ERROR` ### pretty ```shell ts-node --pretty ``` Use pretty diagnostic formatter *Default:* `false`
*Environment:* `TS_NODE_PRETTY` ### TS_NODE_DEBUG ```shell TS_NODE_DEBUG=true ts-node ``` Enable debug logging ## Advanced Options ### require ```shell ts-node -r ts-node --require ``` Require a node module before execution ### cwd ```shell ts-node --cwd ``` Behave as if invoked in this working directory *Default:* `process.cwd()`
*Environment:* `TS_NODE_CWD` ### emit ```shell ts-node --emit ``` Emit output files into `.ts-node` directory. Requires `--compilerHost` *Default:* `false`
*Environment:* `TS_NODE_EMIT` ### scope ```shell ts-node --scope ``` Scope compiler to files within `scopeDir`. Anything outside this directory is ignored. *Default:* `false`
*Environment:* `TS_NODE_SCOPE` ### scopeDir ```shell ts-node --scopeDir ``` Directory within which compiler is limited when `scope` is enabled. *Default:* First of: `tsconfig.json` "rootDir" if specified, directory containing `tsconfig.json`, or cwd if no `tsconfig.json` is loaded.
*Environment:* `TS_NODE_SCOPE_DIR` ### moduleTypes Override the module type of certain files, ignoring the `package.json` `"type"` field. See [Module type overrides](./module-type-overrides.md) for details. *Default:* obeys `package.json` `"type"` and `tsconfig.json` `"module"`
*Can only be specified via `tsconfig.json` or API.* ### TS_NODE_HISTORY ```shell TS_NODE_HISTORY= ts-node ``` Path to history file for REPL *Default:* `~/.ts_node_repl_history` ### noExperimentalReplAwait ```shell ts-node --noExperimentalReplAwait ``` Disable top-level await in REPL. Equivalent to node's [`--no-experimental-repl-await`](https://nodejs.org/api/cli.html#cli_no_experimental_repl_await) *Default:* Enabled if TypeScript version is 3.8 or higher and target is ES2018 or higher.
*Environment:* `TS_NODE_EXPERIMENTAL_REPL_AWAIT` set `false` to disable ### experimentalResolver Enable experimental hooks that re-map imports and require calls to support: * 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 In the future, this hook will also support: * `baseUrl`, `paths` * `rootDirs` * `outDir` to `rootDir` mappings for composite projects and monorepos For details, see [#1514](https://github.com/TypeStrong/ts-node/issues/1514). *Default:* `false`, but will likely be enabled by default in a future version
*Can only be specified via `tsconfig.json` or API.* ### experimentalSpecifierResolution ```shell ts-node --experimentalSpecifierResolution node ``` 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`](#esm) to be enabled. *Default:* `explicit`
## API Options The API includes [additional options](https://typestrong.org/ts-node/api/interfaces/RegisterOptions.html) not shown here. ts-node-10.9.2/website/docs/overview.md000066400000000000000000000014121453460306300177400ustar00rootroot00000000000000--- title: Overview slug: / --- ts-node is a TypeScript execution engine and REPL for Node.js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute TypeScript on Node.js without precompiling. This is accomplished by hooking node's module loading APIs, enabling it to be used seamlessly alongside other Node.js tools and libraries. ## Features * Automatic sourcemaps in stack traces * Automatic `tsconfig.json` parsing * Automatic defaults to match your node version * Typechecking (optional) * REPL * Write standalone scripts * Native ESM loader * Use third-party transpilers * Use custom transformers * Integrate with test runners, debuggers, and CLI tools * Compatible with pre-compilation for production ![TypeScript REPL](/img/screenshot.png) ts-node-10.9.2/website/docs/paths.md000066400000000000000000000025351453460306300172200ustar00rootroot00000000000000--- title: | paths and baseUrl --- You can use ts-node together with [tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths) to load modules according to the `paths` section in `tsconfig.json`. ```json title="tsconfig.json" { "ts-node": { // Do not forget to `npm i -D tsconfig-paths` "require": ["tsconfig-paths/register"] } } ``` ## Why is this not built-in to ts-node? The official TypeScript Handbook explains the intended purpose for `"paths"` in ["Additional module resolution flags"](https://www.typescriptlang.org/docs/handbook/module-resolution.html#additional-module-resolution-flags). > The TypeScript compiler has a set of additional flags to *inform* the compiler of transformations that are expected to happen to the sources to generate the final output. > > It is important to note that the compiler will not perform any of these transformations; it just uses these pieces of information to guide the process of resolving a module import to its definition file. This means `"paths"` are intended to describe mappings that the build tool or runtime *already* performs, not to tell the build tool or runtime how to resolve modules. In other words, they intend us to write our imports in a way `node` already understands. For this reason, ts-node does not modify `node`'s module resolution behavior to implement `"paths"` mappings. ts-node-10.9.2/website/docs/performance.md000066400000000000000000000017111453460306300203750ustar00rootroot00000000000000--- title: Performance --- These tricks will make ts-node faster. ## Skip typechecking It is often better to typecheck as part of your tests or linting. You can run `tsc --noEmit` to do this. In these cases, ts-node can skip typechecking, making it much faster. To skip typechecking in ts-node, do one of the following: * Enable [swc](./swc.md) * This is by far the fastest option * Enable [`transpileOnly`](./options.md#transpileonly) to skip typechecking without swc ## With typechecking If you absolutely must typecheck in ts-node: * Avoid dynamic `require()` which may trigger repeated typechecking; prefer `import` * Try with and without `--files`; one may be faster depending on your project * Check `tsc --showConfig`; make sure all executed files are included * Enable [`skipLibCheck`](https://www.typescriptlang.org/tsconfig#skipLibCheck) * Set a [`types`](https://www.typescriptlang.org/tsconfig#types) array to avoid loading unnecessary `@types` ts-node-10.9.2/website/docs/recipes/000077500000000000000000000000001453460306300172045ustar00rootroot00000000000000ts-node-10.9.2/website/docs/recipes/ava.md000066400000000000000000000012711453460306300202760ustar00rootroot00000000000000--- title: AVA --- Assuming you are configuring AVA via your `package.json`, add one of the following configurations. ## CommonJS Use this configuration if your `package.json` does not have `"type": "module"`. ```json title="package.json" { "ava": { "extensions": [ "ts" ], "require": [ "ts-node/register" ] } } ``` ## Native ECMAScript modules This configuration is necessary if your `package.json` has `"type": "module"`. ```json title="package.json" { "ava": { "extensions": { "ts": "module" }, "nonSemVerExperiments": { "configurableModuleFormat": true }, "nodeArguments": [ "--loader=ts-node/esm" ] } } ``` ts-node-10.9.2/website/docs/recipes/gulp.md000066400000000000000000000003201453460306300204700ustar00rootroot00000000000000--- title: Gulp --- ts-node support is built-in to gulp. ```sh # Create a `gulpfile.ts` and run `gulp`. gulp ``` See also: https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles#transpilation ts-node-10.9.2/website/docs/recipes/intellij.md000066400000000000000000000006251453460306300213430ustar00rootroot00000000000000--- title: "IntelliJ and Webstorm" --- Create a new Node.js configuration and add `-r ts-node/register` to "Node parameters." **Note:** If you are using the `--project ` command line argument as per the [Configuration Options](../configuration.md), and want to apply this same behavior when launching in IntelliJ, specify under "Environment Variables": `TS_NODE_PROJECT=`. ts-node-10.9.2/website/docs/recipes/mocha.md000066400000000000000000000013341453460306300206160ustar00rootroot00000000000000--- title: Mocha --- ## Mocha 7 and newer ```shell mocha --require ts-node/register --extensions ts,tsx --watch --watch-files src 'tests/**/*.{ts,tsx}' [...args] ``` Or specify options via your mocha config file. ```json title=".mocharc.json" { // Specify "require" for CommonJS "require": "ts-node/register", // Specify "loader" for native ESM "loader": "ts-node/esm", "extensions": ["ts", "tsx"], "spec": [ "tests/**/*.spec.*" ], "watch-files": [ "src" ] } ``` See also: https://mochajs.org/#configuring-mocha-nodejs ## Mocha <=6 ```shell mocha --require ts-node/register --watch-extensions ts,tsx "test/**/*.{ts,tsx}" [...args] ``` **Note:** `--watch-extensions` is only used in `--watch` mode. ts-node-10.9.2/website/docs/recipes/npx-and-yarn-dlx.md000066400000000000000000000025241453460306300226320ustar00rootroot00000000000000--- title: npx and yarn dlx --- Using [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) or [`yarn dlx`](https://yarnpkg.com/cli/dlx) is a great ways to publish reusable TypeScript tools to GitHub without precompiling or packaging. Check out our working example: [TypeStrong/ts-node-npx-example](https://github.com/TypeStrong/ts-node-npx-example) ```shell npx typestrong/ts-node-npx-example --help npx typestrong/ts-node-npx-example --first Arthur --last Dent ``` TODO publish demo and link to it TODO test demo: - uninstall global ts-node - try running demo - does ts-node need to be installed globally? This boilerplate is a good starting point: ```json title="package.json" { "bin": "./cli.ts", "dependencies": { "ts-node": "latest", "@swc/core": "latest", "@swc/helpers": "latest", "@tsconfig/node16": "latest" } } ``` ```json title="tsconfig.json" { "extends": "@tsconfig/node16/tsconfig.json", "ts-node": { "swc": true } } ``` ```typescript twoslash title="cli.ts" #!/usr/bin/env ts-node console.log("Hello world!") ``` If you require native ESM support, use `ts-node-esm` in your shebang and follow the configuration instructions for ESM: [Native ECMAScript modules](../commonjs-vs-native-ecmascript-modules.md#native-ecmascript-modules) ```typescript twoslash title="cli.ts" #!/usr/bin/env ts-node-esm ``` ts-node-10.9.2/website/docs/recipes/other.md000066400000000000000000000007301453460306300206470ustar00rootroot00000000000000--- title: Other --- In many cases, setting [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) will enable `ts-node` within other node tools, child processes, and worker threads. ```shell NODE_OPTIONS="-r ts-node/register" ``` Or, if you require native ESM support: ```shell NODE_OPTIONS="--loader ts-node/esm" ``` This tells any node processes which receive this environment variable to install `ts-node`'s hooks before executing other code. ts-node-10.9.2/website/docs/recipes/tape.md000066400000000000000000000001171453460306300204560ustar00rootroot00000000000000--- title: Tape --- ```shell ts-node node_modules/tape/bin/tape [...args] ``` ts-node-10.9.2/website/docs/recipes/visual-studio-code.md000066400000000000000000000014721453460306300232520ustar00rootroot00000000000000--- title: Visual Studio Code --- Create a new Node.js debug configuration, add `-r ts-node/register` to node args and move the `program` to the `args` list (so VS Code doesn't look for `outFiles`). ```json title=".vscode/launch.json" { "configurations": [{ "type": "node", "request": "launch", "name": "Launch Program", "runtimeArgs": [ "-r", "ts-node/register" ], "args": [ "${workspaceFolder}/src/index.ts" ] }], } ``` **Note:** If you are using the `--project ` command line argument as per the [Configuration Options](../configuration.md), and want to apply this same behavior when launching in VS Code, add an "env" key into the launch configuration: `"env": { "TS_NODE_PROJECT": "" }`. ts-node-10.9.2/website/docs/recipes/watching-and-restarting.md000066400000000000000000000012771453460306300242610ustar00rootroot00000000000000--- title: Watching and restarting --- ts-node focuses on adding first-class TypeScript support to node. Watching files and code reloads are out of scope for the project. If you want to restart the `ts-node` process on file change, existing node.js tools such as [nodemon](https://github.com/remy/nodemon), [onchange](https://github.com/Qard/onchange) and [node-dev](https://github.com/fgnass/node-dev) work. There's also [`ts-node-dev`](https://github.com/whitecolor/ts-node-dev), a modified version of [`node-dev`](https://github.com/fgnass/node-dev) using `ts-node` for compilation that will restart the process on file change. Note that `ts-node-dev` is incompatible with our native ESM loader. ts-node-10.9.2/website/docs/scope.md000066400000000000000000000044551453460306300172150ustar00rootroot00000000000000--- title: Ignored files --- ts-node transforms certain files and ignores others. We refer to this mechanism as "scoping." There are various options to configure scoping, so that ts-node transforms only the files in your project. > **Warning:** > > An ignored file can still be executed by node.js. Ignoring a file means we do not transform it from TypeScript into JavaScript, but it does not prevent execution. > > If a file requires transformation but is ignored, node may either fail to resolve it or attempt to execute it as vanilla JavaScript. This may cause syntax errors or other failures, because node does not understand TypeScript type syntax nor bleeding-edge ECMAScript features. ## File extensions `.js` and `.jsx` are only transformed when [`allowJs`](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options) is enabled. `.tsx` and `.jsx` are only transformed when [`jsx`](https://www.typescriptlang.org/docs/handbook/jsx.html) is enabled. > **Warning:** > > When ts-node is used with `allowJs`, _all_ non-ignored JavaScript files are transformed by ts-node. ## Skipping `node_modules` By default, ts-node avoids compiling files in `/node_modules/` for three reasons: 1. Modules should always be published in a format node.js can consume 2. Transpiling the entire dependency tree will make your project slower 3. Differing behaviours between TypeScript and node.js (e.g. ES2015 modules) can result in a project that works until you decide to support a feature natively from node.js If you need to import uncompiled TypeScript in `node_modules`, use [`--skipIgnore`](./options#skipignore) or [`TS_NODE_SKIP_IGNORE`](./options#skipignore) to bypass this restriction. ## Skipping pre-compiled TypeScript If a compiled JavaScript file with the same name as a TypeScript file already exists, the TypeScript file will be ignored. ts-node will import the pre-compiled JavaScript. To force ts-node to import the TypeScript source, not the precompiled JavaScript, use [`--preferTsExts`](./options#prefertsexts). ## Scope by directory Our [`scope`](./options.md#scope) and [`scopeDir`](./options.md#scopedir) options will limit transformation to files within a directory. ## Ignore by regexp Our [`ignore`](./options.md#ignore) option will ignore files matching one or more regular expressions. ts-node-10.9.2/website/docs/swc.md000066400000000000000000000014361453460306300166740ustar00rootroot00000000000000--- title: SWC --- SWC support is built-in via the `--swc` flag or `"swc": true` tsconfig option. [SWC](https://swc.rs) is a TypeScript-compatible transpiler implemented in Rust. This makes it an order of magnitude faster than vanilla `transpileOnly`. To use it, first install `@swc/core` or `@swc/wasm`. If using `importHelpers`, also install `@swc/helpers`. If `target` is less than "es2015" and using `async`/`await` or generator functions, also install `regenerator-runtime`. ```shell npm i -D @swc/core @swc/helpers regenerator-runtime ``` Then add the following to your `tsconfig.json`. ```json title="tsconfig.json" { "ts-node": { "swc": true } } ``` > SWC uses `@swc/helpers` instead of `tslib`. If you have enabled `importHelpers`, you must also install `@swc/helpers`. ts-node-10.9.2/website/docs/transpilers.md000066400000000000000000000036421453460306300204470ustar00rootroot00000000000000--- title: Transpilers --- ts-node supports third-party transpilers as plugins. Transpilers such as swc can transform TypeScript into JavaScript much faster than the TypeScript compiler. You will still benefit from ts-node's automatic `tsconfig.json` discovery, sourcemap support, and global ts-node CLI. Plugins automatically derive an appropriate configuration from your existing `tsconfig.json` which simplifies project boilerplate. > **What is the difference between a compiler and a transpiler?** > > For our purposes, a compiler implements TypeScript's API and can perform typechecking. > A third-party transpiler does not. Both transform TypeScript into JavaScript. ## Third-party plugins The `transpiler` option allows using third-party transpiler plugins with ts-node. `transpiler` must be given the name of a module which can be `require()`d. The built-in `swc` plugin is exposed as `ts-node/transpilers/swc`. For example, to use a hypothetical "@cspotcode/fast-ts-compiler", first install it into your project: `npm install @cspotcode/fast-ts-compiler` Then add the following to your tsconfig: ```json title="tsconfig.json" { "ts-node": { "transpileOnly": true, "transpiler": "@cspotcode/fast-ts-compiler" } } ``` ## Write your own plugin To write your own transpiler plugin, check our [API docs](https://typestrong.org/ts-node/api/interfaces/TranspilerModule.html). Plugins are `require()`d by ts-node, so they can be a local script or a node module published to npm. The module must export a `create` function described by our [`TranspilerModule`](https://typestrong.org/ts-node/api/interfaces/TranspilerModule.html) interface. `create` is invoked by ts-node at startup to create one or more transpiler instances. The instances are used to transform TypeScript into JavaScript. For a working example, check out out our bundled swc plugin: https://github.com/TypeStrong/ts-node/blob/main/src/transpilers/swc.ts ts-node-10.9.2/website/docs/troubleshooting.md000066400000000000000000000164741453460306300213370ustar00rootroot00000000000000--- title: Troubleshooting --- ## Configuration ts-node uses sensible default configurations to reduce boilerplate while still respecting `tsconfig.json` if you have one. If you are unsure which configuration is used, you can log it with `ts-node --showConfig`. This is similar to `tsc --showConfig` but includes `"ts-node"` options as well. ts-node also respects your locally-installed `typescript` version, but global installations fallback to the globally-installed `typescript`. If you are unsure which versions are used, `ts-node -vv` will log them. ```shell $ ts-node -vv ts-node v10.0.0 node v16.1.0 compiler v4.2.2 $ ts-node --showConfig { "compilerOptions": { "target": "es6", "lib": [ "es6", "dom" ], "rootDir": "./src", "outDir": "./.ts-node", "module": "commonjs", "moduleResolution": "node", "strict": true, "declaration": false, "sourceMap": true, "inlineSources": true, "types": [ "node" ], "stripInternal": true, "incremental": true, "skipLibCheck": true, "importsNotUsedAsValues": "error", "inlineSourceMap": false, "noEmit": false }, "ts-node": { "cwd": "/d/project", "projectSearchDir": "/d/project", "require": [], "project": "/d/project/tsconfig.json" } } ``` ## Common errors It is important to differentiate between errors from ts-node, errors from the TypeScript compiler, and errors from `node`. It is also important to understand when errors are caused by a type error in your code, a bug in your code, or a flaw in your configuration. ### `TSError` Type errors from the compiler are thrown as a `TSError`. These are the same as errors you get from `tsc`. ### `SyntaxError` Any error that is not a `TSError` is from node.js (e.g. `SyntaxError`), and cannot be fixed by TypeScript or ts-node. These are bugs in your code or configuration. #### Unsupported JavaScript syntax Your version of `node` may not support all JavaScript syntax supported by TypeScript. The compiler must transform this syntax via "downleveling," which is controlled by the [tsconfig `"target"` option](https://www.typescriptlang.org/tsconfig#target). Otherwise your code will compile fine, but node will throw a `SyntaxError`. For example, `node` 12 does not understand the `?.` optional chaining operator. If you use `"target": "esnext"`, then the following TypeScript syntax: ```typescript twoslash export {}; var foo: {bar: string} | undefined; // ---cut--- const bar: string | undefined = foo?.bar; ``` will compile into this JavaScript: ```javascript const a = foo?.bar; ``` When you try to run this code, node 12 will throw a `SyntaxError`. To fix this, you must switch to `"target": "es2019"` or lower so TypeScript transforms `?.` into something `node` can understand. ### `ERR_REQUIRE_ESM` This error is thrown by node when a module is `require()`d, but node believes it should execute as native ESM. This can happen for a few reasons: - You have installed an ESM dependency but your own code compiles to CommonJS. - Solution: configure your project to compile and execute as native ESM. [Docs](./commonjs-vs-native-ecmascript-modules.md#native-ecmascript-modules) - Solution: downgrade the dependency to an older, CommonJS version. - You have moved your project to ESM but still have a config file, such as `webpack.config.ts`, which must be executed as CommonJS - Solution: if supported by the relevant tool, rename your config file to `.cts` - Solution: Configure a module type override. [Docs](./module-type-overrides.md) - You have a mix of CommonJS and native ESM in your project - Solution: double-check all package.json "type" and tsconfig.json "module" configuration [Docs](./commonjs-vs-native-ecmascript-modules.md) - Solution: consider simplifying by making your project entirely CommonJS or entirely native ESM ### `ERR_UNKNOWN_FILE_EXTENSION` This error is thrown by node when a module has an unrecognized file extension, or no extension at all, and is being executed as native ESM. This can happen for a few reasons: - You are using a tool which has an extensionless binary, such as `mocha`. - CommonJS supports extensionless files but native ESM does not. - Solution: upgrade to ts-node >=[v10.6.0](https://github.com/TypeStrong/ts-node/releases/tag/v10.6.0), which implements a workaround. - Our ESM loader is not installed. - Solution: Use `ts-node-esm`, `ts-node --esm`, or add `"ts-node": {"esm": true}` to your tsconfig.json. [Docs](./commonjs-vs-native-ecmascript-modules.md#native-ecmascript-modules) - You have moved your project to ESM but still have a config file, such as `webpack.config.ts`, which must be executed as CommonJS - Solution: if supported by the relevant tool, rename your config file to `.cts` - Solution: Configure a module type override. [Docs](./module-type-overrides.md) ## Missing Types ts-node does _not_ eagerly load `files`, `include` or `exclude` by default. This is because a large majority of projects do not use all of the files in a project directory (e.g. `Gulpfile.ts`, runtime vs tests) and parsing every file for types slows startup time. Instead, ts-node starts with the script file (e.g. `ts-node index.ts`) and TypeScript resolves dependencies based on imports and references. Occasionally, this optimization leads to missing types. Fortunately, there are other ways to include them in typechecking. For global definitions, you can use the `typeRoots` compiler option. This requires that your type definitions be structured as type packages (not loose TypeScript definition files). More details on how this works can be found in the [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types). Example `tsconfig.json`: ```json { "compilerOptions": { "typeRoots" : ["./node_modules/@types", "./typings"] } } ``` Example project structure: ```text / -- tsconfig.json -- typings/ -- / -- index.d.ts ``` Example module declaration file: ```typescript twoslash declare module '' { // module definitions go here } ``` For module definitions, you can use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping): ```json title="tsconfig.json" { "compilerOptions": { "baseUrl": ".", "paths": { "custom-module-type": ["types/custom-module-type"] } } } ``` Another option is [triple-slash directives](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html). This may be helpful if you prefer not to change your `compilerOptions` or structure your type definitions for `typeRoots`. Below is an example of a triple-slash directive as a relative path within your project: ```typescript twoslash /// import {Greeter} from "lib_greeter" const g = new Greeter(); g.sayHello(); ``` If none of the above work, and you _must_ use `files`, `include`, or `exclude`, enable our [`files`](./options.md#files) option. ## npx, yarn dlx, and node_modules When executing TypeScript with `npx` or `yarn dlx`, the code resides within a temporary `node_modules` directory. The contents of `node_modules` are ignored by default. If execution fails, enable [`skipIgnore`](./options.md#skipignore). ts-node-10.9.2/website/docs/types.md000066400000000000000000000000001453460306300172260ustar00rootroot00000000000000ts-node-10.9.2/website/docs/usage.md000066400000000000000000000047341453460306300172100ustar00rootroot00000000000000--- title: Usage --- ## Command Line ```shell # Execute a script as `node` + `tsc`. ts-node script.ts # Starts a TypeScript REPL. ts-node # Execute code with TypeScript. ts-node -e 'console.log("Hello, world!")' # Execute, and print, code with TypeScript. ts-node -p -e '"Hello, world!"' # Pipe scripts to execute with TypeScript. echo 'console.log("Hello, world!")' | ts-node # Equivalent to ts-node --transpileOnly ts-node-transpile-only script.ts # Equivalent to ts-node --cwdMode ts-node-cwd script.ts # Equivalent to ts-node --esm ts-node-esm script.ts ``` ## Shebang To write scripts with maximum portability, [specify options in your `tsconfig.json`](./configuration#via-tsconfigjson-recommended) and omit them from the shebang. ```typescript twoslash #!/usr/bin/env ts-node // ts-node options are read from tsconfig.json console.log("Hello, world!") ``` Including options within the shebang requires the [`env -S` flag](https://manpages.debian.org/bullseye/coreutils/env.1.en.html#S), which is available on recent versions of `env`. ([compatibility](https://github.com/TypeStrong/ts-node/pull/1448#issuecomment-913895766)) ```typescript twoslash #!/usr/bin/env -S ts-node --files // This shebang works on Mac and Linux with newer versions of env // Technically, Mac allows omitting `-S`, but Linux requires it ``` To test your version of `env` for compatibility with `-S`: ```shell # Note that these unusual quotes are necessary /usr/bin/env --debug '-S echo foo bar' ``` ## node flags and other tools You can register ts-node without using our CLI: `node -r ts-node/register` and `node --loader ts-node/esm` In many cases, setting [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#cli_node_options_options) will enable `ts-node` within other node tools, child processes, and worker threads. This can be combined with other node flags. ```shell NODE_OPTIONS="-r ts-node/register --no-warnings" node ./index.ts ``` Or, if you require native ESM support: ```shell NODE_OPTIONS="--loader ts-node/esm" ``` This tells any node processes which receive this environment variable to install `ts-node`'s hooks before executing other code. If you are invoking node directly, you can avoid the environment variable and pass those flags to node. ```shell node --loader ts-node/esm --inspect ./index.ts ``` ## Programmatic You can require ts-node and register the loader for future requires by using `require('ts-node').register({ /* options */ })`. Check out our [API](./api.md) for more features. ts-node-10.9.2/website/docusaurus.config.js000066400000000000000000000127151453460306300206270ustar00rootroot00000000000000module.exports = { title: 'ts-node', tagline: 'TypeScript execution and REPL for node.js', url: 'https://typestrong.org', baseUrl: '/ts-node/', onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon/favicon.ico', organizationName: 'TypeStrong', // Usually your GitHub org/user name. projectName: 'ts-node', // Usually your repo name. themeConfig: { image: 'img/opengraph.png', // announcementBar: { // id: 'website_wip', // Any value that will identify this message. // content: // 'This website is still under construction. It describes the latest, unreleased changes from our main branch. Until it is ready, official documentation lives in our README', // //backgroundColor: '#fafbfc', // Defaults to `#fff`. // //textColor: '#091E42', // Defaults to `#000`. // //isCloseable: false, // Defaults to `true`. // }, colorMode: { respectPrefersColorScheme: true, }, navbar: { title: 'ts-node', logo: { alt: 'ts-node logo', src: 'img/logo-icon.svg', }, items: [ { to: 'docs/', activeBasePath: 'docs', label: 'Docs', position: 'right', }, { href: 'https://typestrong.org/ts-node/api/', label: 'API', position: 'right', }, { href: 'https://github.com/TypeStrong/ts-node/releases', label: 'Release Notes', position: 'right', }, { href: 'https://github.com/TypeStrong/ts-node/discussions', label: 'Discuss', position: 'right', }, { href: 'https://discord.gg/3rBctmf3dP', label: 'Chat', position: 'right', }, { href: 'https://github.com/TypeStrong/ts-node', label: 'GitHub', position: 'right', }, ], }, metadata: [ { name: 'msapplication-TileColor', content: '#2b5797', }, { name: 'msapplication-config', content: '/ts-node/img/favicon/browserconfig.xml', }, { name: 'theme-color', content: '#ffffff', }, ], // footer: { // style: 'dark', // links: [ // // { // // title: 'Docs', // // items: [ // // { // // label: 'Docs', // // to: 'docs/', // // } // // ], // // }, // // { // // title: 'Community', // // items: [ // // { // // label: 'Discord', // // href: 'https://discord.gg/typescript' // // }, // // { // // label: 'Github Discussions', // // href: 'https://github.com/TypeStrong/ts-node/discussions' // // }, // // ], // // }, // // { // // title: 'More', // // items: [ // // { // // label: 'GitHub', // // href: 'https://github.com/TypeStrong/ts-node', // // }, // // ], // // }, // ], // // copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, // }, prism: { // Note: these themes are ignored due to using shiki-twoslash theme: require('prism-react-renderer/themes/vsLight'), darkTheme: require('prism-react-renderer/themes/vsDark'), }, algolia: { appId: 'BYGNLKSCOV', apiKey: '74ac2b781b0cf603c2f1b5e4f44e1c69', indexName: 'ts-node', }, }, presets: [ [ '@docusaurus/preset-classic', { docs: { sidebarPath: require.resolve('./sidebars.js'), editUrl: 'https://github.com/TypeStrong/ts-node/edit/docs/website/', }, blog: false, theme: { customCss: require.resolve('./src/css/custom.css'), }, }, ], [ 'docusaurus-preset-shiki-twoslash', { // https://github.com/shikijs/twoslash/blob/main/packages/shiki-twoslash/README.md#user-settings // langs: ["shell", "typescript", "javascript", "ts", "js", "tsx", "jsx", "json", "jsonc"], includeJSDocInHover: true, themes: ['github-light', 'nord'], // VSCode default // themes: ["light-plus", "dark-plus"], // Other options // themes: ["min-light", "nord"], // themes: ["min-light", "min-dark"], // themes: ["github-light", "github-dark"], // themes: ["solarized-light", "solarized-dark"], }, ], ], // Misleading API that probably will be refactored in Docusaurus, but this is // simply a list of tags stylesheets: [ { rel: 'apple-touch-icon', sizes: '180x180', href: '/ts-node/img/favicon/apple-touch-icon.png', }, { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/ts-node/img/favicon/favicon-32x32.png', }, { rel: 'icon', type: 'image/png', sizes: '16x16', href: '/ts-node/img/favicon/favicon-16x16.png', }, { rel: 'manifest', href: '/ts-node/img/favicon/site.webmanifest', }, { rel: 'mask-icon', href: '/ts-node/img/favicon/safari-pinned-tab.svg', color: '#5bbad5', }, { rel: 'shortcut icon', href: '/ts-node/img/favicon/favicon.ico', }, ], }; ts-node-10.9.2/website/package.json000066400000000000000000000024371453460306300171160ustar00rootroot00000000000000{ "name": "@ts-node/website", "version": "0.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "serve": "docusaurus serve", "clear": "docusaurus clear", "build-readme": "./scripts/build-readme.mjs" }, "dependencies": { "@docusaurus/core": "2.0.0-beta.17", "@docusaurus/preset-classic": "2.0.0-beta.17", "@mdx-js/react": "^1.6.22", "@types/js-yaml": "^4.0.0", "clsx": "^1.1.1", "docusaurus-preset-shiki-twoslash": "^1.1.36", "js-yaml": "^4.0.0", "react": "^17.0.2", "react-dom": "^17.0.2", "remark": "^13.0.0", "remark-behead": "^2.3.3", "remark-frontmatter": "^3.0.0", "remark-preset-lint-recommended": "^5.0.0", "remark-toc": "^7.2.0", "remark-validate-links": "^10.0.4", "vfile": "^4.2.1", "vfile-reporter": "^6.0.2" }, "browserslist": { "production": [ ">0.5%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "packageManager": "yarn@1.22.17", "volta": { "extends": "../package.json", "yarn": "1.22.17" } } ts-node-10.9.2/website/readme-sources/000077500000000000000000000000001453460306300175405ustar00rootroot00000000000000ts-node-10.9.2/website/readme-sources/license.md000066400000000000000000000010021453460306300214750ustar00rootroot00000000000000--- title: License --- ts-node is licensed under the MIT license. [MIT](https://github.com/TypeStrong/ts-node/blob/main/LICENSE) ts-node includes source code from Node.js which is licensed under the MIT license. [Node.js license information](https://raw.githubusercontent.com/nodejs/node/master/LICENSE) ts-node includes source code from the TypeScript compiler which is licensed under the Apache License 2.0. [TypeScript license information](https://github.com/microsoft/TypeScript/blob/master/LICENSE.txt) ts-node-10.9.2/website/readme-sources/prefix.md000066400000000000000000000023521453460306300213610ustar00rootroot00000000000000--- omitHeaderOnMerge: true --- # [![TypeScript Node](logo.svg?sanitize=true)](https://typestrong.org/ts-node) [![NPM version](https://img.shields.io/npm/v/ts-node.svg?style=flat)](https://npmjs.org/package/ts-node) [![NPM downloads](https://img.shields.io/npm/dm/ts-node.svg?style=flat)](https://npmjs.org/package/ts-node) [![Build status](https://img.shields.io/github/workflow/status/TypeStrong/ts-node/Continuous%20Integration)](https://github.com/TypeStrong/ts-node/actions?query=workflow%3A%22Continuous+Integration%22) [![Test coverage](https://codecov.io/gh/TypeStrong/ts-node/branch/main/graph/badge.svg)](https://codecov.io/gh/TypeStrong/ts-node) > TypeScript execution and REPL for node.js, with source map and native ESM support. The latest documentation can also be found on our website: [https://typestrong.org/ts-node](https://typestrong.org/ts-node) # Table of Contents ts-node-10.9.2/website/scripts/000077500000000000000000000000001453460306300163115ustar00rootroot00000000000000ts-node-10.9.2/website/scripts/build-readme.mjs000077500000000000000000000116351453460306300213670ustar00rootroot00000000000000#!/usr/bin/env node /* * Render README by merging website's `.md` pages. */ import fs from 'fs'; import { fileURLToPath } from 'url'; import Path from 'path'; import _ from 'lodash'; import remark from 'remark'; import remarkFrontmatter from 'remark-frontmatter'; import remarkRecommended from 'remark-preset-lint-recommended'; import remarkToc from 'remark-toc'; import remarkBehead from 'remark-behead'; import remarkValidateLinks from 'remark-validate-links'; import visit from 'unist-util-visit'; import vfile from 'vfile'; import vfileReporter from 'vfile-reporter'; import jsYaml from 'js-yaml'; const __websiteRoot = Path.resolve(fileURLToPath(import.meta.url), '../..'); const __root = Path.resolve(__websiteRoot, '..'); const readmePath = Path.resolve(__root, 'README.md'); const generateReadmeHeadersForCategories = { General: false, Advanced: true, Recipes: true, }; import sidebars from '../sidebars.js'; async function main() { const readmeNodes = []; await appendMarkdownFileToReadmeAst({ path: 'readme-sources/prefix.md', headerLevel: 1, }); const sidebar = sidebars.primarySidebar; for (const category of sidebar) { const generateReadmeHeader = generateReadmeHeadersForCategories[category.label]; if (generateReadmeHeader) { readmeNodes.push(headerNode(1, category.label)); } else if (generateReadmeHeader == null) { throw new Error( `Update ${import.meta.url} to include all sidebar categories` ); } for (const page of category.items) { await appendMarkdownFileToReadmeAst({ path: `docs/${page}.md`, headerLevel: 1 + !!generateReadmeHeader, }); } } appendMarkdownFileToReadmeAst({ path: 'readme-sources/license.md', headerLevel: 1, }); async function appendMarkdownFileToReadmeAst({ path, headerLevel }) { const absPath = Path.resolve(__websiteRoot, path); console.log(`Appending ${path} at header level ${headerLevel}`); const markdownSource = fs.readFileSync(absPath, 'utf8'); await remark() .use(remarkFrontmatter, ['yaml']) .use(parseFrontmatter) .use(remarkBehead, { after: '', depth: headerLevel - 1 }) .use(() => (ast) => { const { frontmatter } = ast; if (frontmatter && !frontmatter.omitHeaderOnMerge) { readmeNodes.push( headerNode( headerLevel, (frontmatter && frontmatter.title) || Path.basename(absPath) ) ); } readmeNodes.push(...ast.children); }) .process(markdownSource); } const renderedReadme = await remark() .use(() => (ast) => { ast.children.push(...readmeNodes); }) .use(codeLanguageJsonToJsonc) .use(rewritePageLinksToAnchorLinks) .use(rewriteImgTargets) .use(trimCutFromTwoslashCode) .use(remarkToc, { tight: true }) .process( vfile({ path: readmePath, contents: '', }) ); fs.writeFileSync(readmePath, renderedReadme.contents); console.error(vfileReporter(renderedReadme)); if (renderedReadme.messages.length) throw new Error('Aborting on diagnostics.'); const lintResults = await remark() .use(remarkValidateLinks) .use(remarkRecommended) .process(renderedReadme); console.error(vfileReporter(lintResults)); if (lintResults.messages.length) throw new Error('Aborting on diagnostics.'); } function parseFrontmatter() { return (ast) => { if (ast.children[0].type === 'yaml') { ast.frontmatter = jsYaml.load(ast.children[0].value); ast.children.splice(0, 1); } }; } function codeLanguageJsonToJsonc() { return (ast) => { visit(ast, 'code', (node) => { if (node.lang === 'json') node.lang = 'jsonc'; }); }; } function rewritePageLinksToAnchorLinks() { return (ast) => { visit(ast, 'link', (node) => { if (node.url?.match?.(/^https?\:\/\//)) return; // TODO take page title into account node.url = node.url.replace( /^[\.\/]*(?:recipes\/)?(?:([^#]+)|.*#(.*))$/, '#$1$2' ); node.url = node.url.replace(/\.md$/, ''); }); }; } function rewriteImgTargets() { return (ast) => { visit(ast, 'image', (node) => { node.url = node.url.replace(/^\//, 'website/static/'); }); }; } function trimCutFromTwoslashCode() { return (ast) => { // Strip everything above // ---cut--- in twoslash code blocks const lookingFor = '\n// ---cut---\n'; visit(ast, 'code', (node) => { if (node.meta?.includes('twoslash') && node.value.includes(lookingFor)) { node.value = node.value.slice( node.value.lastIndexOf(lookingFor) + lookingFor.length ); } }); }; } function headerNode(depth, value) { return { type: 'heading', depth, children: [ { type: 'text', value, children: [], }, ], }; } try { await main(); } catch (e) { console.error(e.message); process.exitCode = 1; } ts-node-10.9.2/website/sidebars.js000066400000000000000000000022071453460306300167550ustar00rootroot00000000000000module.exports = { primarySidebar: [ { type: 'category', label: 'General', collapsed: false, items: [ 'overview', 'installation', 'usage', 'configuration', 'options', 'swc', 'commonjs-vs-native-ecmascript-modules', 'troubleshooting', 'performance', ], }, { type: 'category', label: 'Advanced', collapsed: false, items: [ 'how-it-works', 'scope', 'paths', 'compilers', 'transpilers', 'module-type-overrides', 'api', ], }, { type: 'category', label: 'Recipes', collapsed: false, items: [ 'recipes/watching-and-restarting', // 'recipes/npx-and-yarn-dlx', 'recipes/ava', 'recipes/gulp', 'recipes/intellij', 'recipes/mocha', 'recipes/tape', 'recipes/visual-studio-code', 'recipes/other', ], }, ], hiddenSidebar: [ { type: 'category', label: 'Hidden pages', collapsed: false, items: ['options-table'], }, ], }; ts-node-10.9.2/website/src/000077500000000000000000000000001453460306300154115ustar00rootroot00000000000000ts-node-10.9.2/website/src/css/000077500000000000000000000000001453460306300162015ustar00rootroot00000000000000ts-node-10.9.2/website/src/css/custom.css000066400000000000000000000044201453460306300202250ustar00rootroot00000000000000/* stylelint-disable docusaurus/copyright-header */ /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to * work well for content-centric websites. */ /* You can override the default Infima variables here. */ :root { /* Generating by pasting #3178C6, the shade of blue from typescriptlang.org's navbar, into the palette generator at https://docusaurus.io/docs/styling-layout/ */ --ifm-color-primary: #3178c6; --ifm-color-primary-dark: #2c6cb2; --ifm-color-primary-darker: #2a66a8; --ifm-color-primary-darkest: #22548b; --ifm-color-primary-light: #4084d0; --ifm-color-primary-lighter: #4a8bd2; --ifm-color-primary-lightest: #689eda; /* Docusaurus defaults */ /* --ifm-color-primary: #25c2a0; --ifm-color-primary-dark: rgb(33, 175, 144); --ifm-color-primary-darker: rgb(31, 165, 136); --ifm-color-primary-darkest: rgb(26, 136, 112); --ifm-color-primary-light: rgb(70, 203, 174); --ifm-color-primary-lighter: rgb(102, 212, 189); --ifm-color-primary-lightest: rgb(146, 224, 208); --ifm-code-font-size: 95%; */ } [data-theme='dark'] { /* Generating by pasting #4084d0, into the palette generator at https://docusaurus.io/docs/styling-layout/ */ --ifm-color-primary: #4084d0; --ifm-color-primary-dark: #3076c4; --ifm-color-primary-darker: #2e70ba; --ifm-color-primary-darkest: #265c99; --ifm-color-primary-light: #5692d5; --ifm-color-primary-lighter: #6199d8; --ifm-color-primary-lightest: #81aee0; --ifm-color-primary-lighter: #4a8bd2; } .docusaurus-highlight-code-line { background-color: rgb(72, 77, 91); display: block; margin: 0 calc(-1 * var(--ifm-pre-padding)); padding: 0 var(--ifm-pre-padding); } /* Hide the external link icon */ .navbar__item svg { display: none; } /* * Shiki-twoslash * See: https://github.com/shikijs/twoslash/tree/main/packages/docusaurus-preset-shiki-twoslash */ [data-theme='light'] .shiki.nord, [data-theme='light'] .shiki.min-dark, [data-theme='light'] .shiki.github-dark, [data-theme='light'] .shiki.dark-plus, [data-theme='light'] .shiki.solarized-dark, [data-theme='dark'] .shiki.min-light, [data-theme='dark'] .shiki.github-light, [data-theme='dark'] .shiki.light-plus, [data-theme='dark'] .shiki.solarized-light { display: none; } ts-node-10.9.2/website/src/pages/000077500000000000000000000000001453460306300165105ustar00rootroot00000000000000ts-node-10.9.2/website/src/pages/index.js000066400000000000000000000041541453460306300201610ustar00rootroot00000000000000import React from 'react'; import clsx from 'clsx'; import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; import styles from './styles.module.css'; function Feature({ imageUrl, title, description }) { const imgUrl = useBaseUrl(imageUrl); return (
{imgUrl && (
{title}
)}
); } function Home() { const context = useDocusaurusContext(); const { siteConfig = {} } = context; return (

{siteConfig.title}

{siteConfig.tagline}

Get Started