Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 #145

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
171 changes: 0 additions & 171 deletions .all-contributorsrc

This file was deleted.

2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ ij_typescript_ternary_operation_signs_on_next_line = false
ij_typescript_ternary_operation_wrap = off
ij_typescript_union_types_wrap = on_every_item
ij_typescript_use_chained_calls_group_indents = false
ij_typescript_use_double_quotes = false
ij_typescript_use_double_quotes = true
ij_typescript_use_explicit_js_extension = global
ij_typescript_use_path_mapping = always
ij_typescript_use_public_modifier = false
Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Node.js CI

on: [ push, pull_request ]
on:
pull_request:
branches: [ master ]
types: [ opened, synchronize, closed ]
push:
branches: [ master ]

jobs:
build:
Expand All @@ -14,25 +19,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Determine Yarn Cache Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Packages
run: yarn install --frozen-lockfile
- name: Install
run: yarn run clean:all && yarn install --frozen-lockfile

- name: Build
run: yarn build
Expand All @@ -41,3 +34,4 @@ jobs:
run: yarn test
env:
CI: true
TEST_TARGET: dist
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
run: yarn test
env:
CI: true
TEST_TARGET: dist

- name: Generate Release Body
run: npx extract-changelog-release > RELEASE_BODY.md
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Yarn
.yarn-cache
./test/yarn.lock

# Built
*.js.map
Expand Down
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
const require = createRequire(fileURLToPath(import.meta.url));

/** @type {import('./src/compatibility/node-register')} */
const { nodeRegister } = require('./dist/compatibility/node-register');

/** @type {import('ts-node')} */
import tsNode from 'ts-node';

const tsNodeInstance = nodeRegister();

export const { resolve, getFormat, transformSource } = tsNode.createEsmHooks(tsNodeInstance);
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const config: Config.InitialOptions = {
},
modulePaths: [ "<rootDir>" ],
roots: [ '<rootDir>' ],
setupFilesAfterEnv: [ "./test/src/setup.ts" ]
}

export default config;
35 changes: 22 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
"version": "3.3.1",
"description": "Transforms module resolution paths using TypeScript path mapping and/or custom paths",
"main": "dist/index.js",
"types": "types/index.d.ts",
"types": "dist/index.d.ts",
"scripts": {
"compile": "tsc",
"build": "yarn run clean && yarn run compile",
"build": "yarn run clean && yarn run compile && yarn run check:built-types",
"check:built-types": "tsc dist/index.d.ts --esModuleInterop",
"-------------- ": "",
"test": "jest",
"release": "standard-version",
"test:src": "cross-env TEST_TARGET=src jest",
"test:dist": "cross-env TEST_TARGET=dist jest",
"--------------": "",
"format": "prettier --write \"{src,test}/**/{*.js,!(*.d).ts}\"",
"clean": "rimraf dist **/*.tsbuildinfo",
"clean:all": "yarn run clean && rimraf node_modules test/node_modules test/.yarn-cache",
"reset": "yarn run clean:all && yarn install",
"clean": "npx rimraf dist **/*.tsbuildinfo",
"clean:all": "yarn run clean && npx rimraf node_modules **/node_modules test/.yarn-cache",
"reset": "yarn run clean:all && yarn install && yarn build",
"-------------- ": "",
"prebuild": "rimraf dist",
"install:tests": "cd test && yarn install && cd projects/extras && yarn install",
"prebuild": "npx rimraf dist",
"install:tests": "cd test && yarn install",
"prepare": "yarn run install:tests"
},
"keywords": [
Expand Down Expand Up @@ -54,20 +57,26 @@
"@types/jest": "^26.0.24",
"@types/minimatch": "^3.0.5",
"@types/node": "^16.4.10",
"@types/ts-expose-internals": "npm:[email protected]",
"cross-env": "^7.0.3",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"standard-version": "^9.3.1",
"ts-expose-internals": "^4.3.2",
"ts-jest": "^27.0.4",
"ts-node": "^10.1.0",
"ts-patch": "^1.4.2",
"typescript": "^4.3.5"
"ts-node": "^10.4.0",
"ts-patch": "^1.4.4",
"ts3": "npm:[email protected]",
"ts45": "npm:[email protected]",
"typescript": "latest"
},
"peerDependencies": {
"typescript": ">=3.6.5"
"typescript": ">=4.2.2"
},
"dependencies": {
"minimatch": "^3.0.4"
},
"prettier": {
"singleQuote": true
}
}
3 changes: 1 addition & 2 deletions register.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ try {
);
}

tsNode.register();
require('./').register();
require('./').nodeRegister();
Loading