├── .codeclimate.yml
├── .commitlintrc.js
├── .czrc
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── documentation_improvement.md
│ └── feature_request.md
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
└── settings.yml
├── .gitignore
├── .huskyrc
├── .lintstagedrc.yml
├── .mdlrc
├── .npmignore
├── .npmrc
├── .nvmrc
├── .releaserc
├── .travis.yml
├── CHANGELOG.md
├── CODEOWNERS
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── codecov.yml
├── docs
├── assets
│ └── banner.png
└── content
│ └── .gitkeep
├── jest.config.js
├── package.json
├── prettier.config.js
├── src
├── Errors
│ └── TypeScriptCompileError.ts
├── __fixtures__
│ ├── error.ts
│ └── success.ts
├── index.spec.ts
└── index.ts
├── tsconfig.json
├── tsconfig.test.json
├── tslint.json
└── yarn.lock
/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | version: "2"
2 |
3 | plugins:
4 | markdownlint:
5 | enabled: true
6 |
7 | exclude_patterns:
8 | - ".github/" # Exclude GitHub issue templates
9 | - "scripts/" # Exclude project build scripts
10 | - "CHANGELOG.md" # Exclude automatically generated CHANGELOG.md
11 | - "**/dist/"
12 | - "**/node_modules/"
13 | - "**/tests/"
14 | - "**/__fixtures__/"
15 | - "**/vendor/"
16 | - "**/*.d.ts"
17 | - "**/*.spec.ts"
18 | - "**/*.integ.ts"
19 |
--------------------------------------------------------------------------------
/.commitlintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@commitlint/config-conventional']
3 | };
4 |
--------------------------------------------------------------------------------
/.czrc:
--------------------------------------------------------------------------------
1 | {
2 | "path": "@endemolshinegroup/cz-github"
3 | }
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain
2 | # consistent coding styles between different editors and IDEs.
3 |
4 | root = true
5 |
6 | [*]
7 | charset = utf-8
8 | indent_style = space
9 | indent_size = 2
10 | end_of_line = lf
11 | insert_final_newline = true
12 | trim_trailing_whitespace = true
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create an issue for a bug or any other unexpected behaviour
4 |
5 | ---
6 |
7 |
14 |
15 | ## Description
16 |
17 | ### What went wrong?
18 |
19 | ### What did you expect should have happened?
20 |
21 | ### What was the config you used?
22 |
23 | ### What stacktrace or error messages did you see?
24 |
25 |
26 | Stack Trace:
27 |
28 |
31 |
32 | ```sh
33 | $
34 | ```
35 |
36 |
37 |
38 | ### Similar or dependent issues:
39 |
40 | - #12345
41 |
42 | ## Additional Data
43 |
44 | ***Version of `cosmiconfig-typescript-loader` you're using***:
45 |
46 | ***Node Version***:
47 |
48 | ***Operating System***:
49 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/documentation_improvement.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Documentation improvement
3 | about: Create an issue for improving the documentation
4 |
5 | ---
6 |
7 |
14 |
15 | ## Description
16 |
17 |
20 |
21 | ### Similar or dependent issues:
22 |
23 | - #12345
24 |
25 | ## Additional Data
26 |
27 | ***Version of `cosmiconfig-typescript-loader` you're using***:
28 |
29 | ***Node Version***:
30 |
31 | ***Operating System***:
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 |
5 | ---
6 |
7 |
14 |
15 | ## Description
16 |
17 | ### What is the use case that should be solved?
18 |
19 |
22 |
23 | ### If there is additional config how would it look?
24 |
25 | ### Similar or dependent issues:
26 |
27 | - #12345
28 |
29 | ## Additional Data
30 |
31 | ***Version of `cosmiconfig-typescript-loader` you're using***:
32 |
33 | ***Node Version***:
34 |
35 | ***Operating System***:
36 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | ## What did you implement:
8 |
9 |
12 |
13 | ## How did you implement it:
14 |
15 |
18 |
19 | ## How can we verify it:
20 |
21 |
28 |
29 | ## Tasks:
30 |
31 | - [ ] Write tests
32 | - [ ] Write documentation
33 | - [ ] Fix linting errors
34 | - [ ] Make sure code coverage hasn't dropped
35 | - [ ] Provide verification config / commands / resources
36 | - [X] Enable "Allow edits from maintainers" for this PR
37 | - [ ] Update the messages below
38 |
39 |
40 | ***Is this ready for review?:*** NO
41 | ***Is it a breaking change?:*** NO
42 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "npm" # See documentation for possible values
4 | directory: "/" # Location of package manifests
5 | schedule:
6 | interval: "monthly"
7 | open-pull-requests-limit: 10
8 |
--------------------------------------------------------------------------------
/.github/settings.yml:
--------------------------------------------------------------------------------
1 | # These settings are synced to GitHub by https://probot.github.io/apps/settings/
2 |
3 | repository:
4 |
5 | # Either `true` to make the repository private, or `false` to make it public.
6 | private: false
7 |
8 | # Either `true` to enable issues for this repository, `false` to disable them.
9 | has_issues: true
10 |
11 | # Either `true` to enable projects for this repository, or `false` to disable them.
12 | # If projects are disabled for the organization, passing `true` will cause an API error.
13 | has_projects: false
14 |
15 | # Either `true` to enable the wiki for this repository, `false` to disable it.
16 | has_wiki: false
17 |
18 | # Either `true` to enable downloads for this repository, `false` to disable them.
19 | has_downloads: true
20 |
21 | # Updates the default branch for this repository.
22 | default_branch: develop
23 |
24 | # Either `true` to allow squash-merging pull requests, or `false` to prevent
25 | # squash-merging.
26 | allow_squash_merge: false
27 |
28 | # Either `true` to allow merging pull requests with a merge commit, or `false`
29 | # to prevent merging pull requests with merge commits.
30 | allow_merge_commit: false
31 |
32 | # Either `true` to allow rebase-merging pull requests, or `false` to prevent
33 | # rebase-merging.
34 | allow_rebase_merge: true
35 |
36 | branches:
37 | # https://developer.github.com/v3/repos/branches/#update-branch-protection
38 | - name: master
39 | protection:
40 | required_pull_request_reviews:
41 | required_approving_review_count: 1
42 | dismiss_stale_reviews: true
43 | require_code_owner_reviews: true
44 | dismissal_restrictions:
45 | users: [ esg-bot ]
46 | teams: [ open-source ]
47 | required_status_checks:
48 | strict: true
49 | contexts: [
50 | codeclimate/diff-coverage,
51 | codecov/project,
52 | Travis CI - Branch,
53 | ]
54 | enforce_admins: false
55 | restrictions:
56 | users: [ esg-bot ]
57 | teams: [ open-source ]
58 | # https://developer.github.com/v3/repos/branches/#update-branch-protection
59 | - name: develop
60 | protection:
61 | required_pull_request_reviews:
62 | required_approving_review_count: 1
63 | dismiss_stale_reviews: true
64 | require_code_owner_reviews: true
65 | dismissal_restrictions:
66 | users: [ esg-bot ]
67 | teams: [ open-source ]
68 | required_status_checks:
69 | strict: true
70 | contexts: [
71 | codeclimate/diff-coverage,
72 | codecov/project,
73 | Travis CI - Branch,
74 | ]
75 | enforce_admins: false
76 | restrictions:
77 | users: [ esg-bot ]
78 | teams: [ open-source ]
79 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS files
2 | .DS_Store
3 | Thumbs.db
4 |
5 | # Logs
6 | logs
7 | !services/logs
8 | *.log
9 | npm-debug.log*
10 | yarn-debug.log*
11 | yarn-error.log*
12 |
13 | # Runtime data
14 | pids
15 | *.pid
16 | *.seed
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 |
24 | # nyc test coverage
25 | .nyc_output
26 |
27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
28 | .grunt
29 |
30 | # node-waf configuration
31 | .lock-wscript
32 |
33 | # Compiled binary addons (http://nodejs.org/api/addons.html)
34 | build/Release
35 | compiled
36 |
37 | # Outputs
38 | dist
39 | **/docs/api
40 |
41 | # Dependency directories
42 | node_modules
43 | jspm_packages
44 |
45 | # Optional cache directories
46 | .npm
47 | .awcache
48 | .rpt2_cache
49 |
50 | # Optional REPL history
51 | .node_repl_history
52 |
53 | # JetBrains IDEs
54 | .idea
55 | .vscode
56 |
--------------------------------------------------------------------------------
/.huskyrc:
--------------------------------------------------------------------------------
1 | {
2 | "hooks": {
3 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
4 | "pre-commit": "lint-staged"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/.lintstagedrc.yml:
--------------------------------------------------------------------------------
1 | "src/**/*.ts":
2 | - "tslint --fix" # Run TSLint
3 | - "prettier --write" # Run Prettier
4 | - "jest --bail --findRelatedTests" # Run tests
5 |
--------------------------------------------------------------------------------
/.mdlrc:
--------------------------------------------------------------------------------
1 | rules "~MD002"
2 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | coverage/
2 | src/
3 | !dist/*
4 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | access=public
--------------------------------------------------------------------------------
/.nvmrc:
--------------------------------------------------------------------------------
1 | lts/*
2 |
--------------------------------------------------------------------------------
/.releaserc:
--------------------------------------------------------------------------------
1 | {
2 | "verifyConditions": [
3 | {
4 | "path": "@semantic-release/changelog",
5 | "changelogFile": "CHANGELOG.md"
6 | },
7 | "@semantic-release/npm",
8 | "@semantic-release/git"
9 | ],
10 | "prepare": [
11 | {
12 | "path": "@semantic-release/changelog",
13 | "changelogFile": "CHANGELOG.md"
14 | },
15 | "@semantic-release/npm",
16 | "@semantic-release/git"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | cache: yarn
4 |
5 | node_js:
6 | - 10
7 | - 12
8 |
9 | before_install:
10 | - npm i -g yarn
11 |
12 | script:
13 | - yarn lint
14 | - yarn build
15 | - yarn test
16 |
17 | # Environment variables marked with `secure` should be securely encrypted as described at:
18 | # https://docs.travis-ci.com/user/environment-variables/#encrypting-environment-variables
19 |
20 | notifications:
21 | slack:
22 | rooms:
23 | - secure: dEEtfAC+48fdC9f6PCk/FOoTiWx1TC2Rk/+yfzx5/NHwZ/eAL5d5/RnM7xLeTAf8vzMQsWCN1YKymTMhamd6SEwVyez+ffB0QXWvFZNq52PxaHi6a00eV2Edg3OB0kj3H25aH1CfDKM8DK0VmXf7ABkS02XzDkar0OPB0SPKL3p2kUY6yIOrfROfOpSwCnqsQ5iDK+27BTOm6zgtmE2zyOg7bVZgoXXCfx0/pfp2hRS7hnfXe86CZka9pna2C3Uz2UZpoTVsGidWtkIjFk9xW6EFYBi7qt+mHpNmb8U4W4mIyjS/cYMhHyTsTuB1C3wNSl+qIC69gTIJnLKCwna/AXC781KhdYrGpMA5PHXnDqNyLW6Rd1q7srgtcA93QQRKPV4aQUmZErDzB9VBcHTSe3MKQOCOSR3Ze0jmVoy2X4ciyted1Uj0N20FU8jUQA8fqjOrPEkKvHCEHOdQN6QXL6CL1SRR/cDtWDHCluvsttQEAhaoVsC7oRIoB6a7TKDHff1AZg11Xy0V69Me6OU8v4Xq1vIGFTnzTj7cuFHer1KlK8V7FwrE7NMU1W0Mcia5ZKyp4tKZtGT9iQxiH1Rz8c4BM3oDgCerJmrrNvc10U1uCWSms8WLa8EcS97933gcygPcorm9066UBCkO6HzMCFKem8opFnot7NF4nyOnJko=
24 | on_success: change
25 | on_failure: always
26 |
27 | env:
28 | global:
29 | - secure: Iry1GBrPTnCR6hBOJShrgejohBucbhUNehdU3BqQurHJZfQxcrupGxxM2Wd14BYkN2iH+7+GcLk7XOzM/iLnHbfMFxd+0sYZECPtKIVljBJ4Ey+H28n8z8jZf7aoijantxOiASGs1+js0r0ciYO0VPmCMHLmPzlBqphcwFjNoo+hypAQdkxowdo2KQ4drxMP3Edc1Djn+zimCtj4+7j1qQZ06sxel9L9U9WxXFRv4bXh+pi5wqkelfctI9b0kjeNwQXcaH551DfT1KnfzryfvbBDoIDnKU5yBPlRd4A/3XTXMHPipAZ1v8XqZvM9W4LUA4aDidNPeXjxvY80IN4Wgv3ItFn/Qsx9kcMh4W87J37vTT0KrHsilqZ4yhgM0utlKAX1tfY68MvNtMRTW5CQlDj9s2CJAjidtLPZvhZUVZCgbal7METSnzExaWHr45xSnWw8NT36V4GvDUg7aOgFTyETNpP+Ew4Y6GYDy2rt9dsWlbiPbdnG5E3BOAMi+Vz3bnGDC8KvcQFyAGrLc0TG2TkdPjIhjchqDWlPXh8p0RRakE/G5Mm/WnbhT9qX3twzdr2JIIX3ra61j1iDxKSajO1sTG86g8z0ijxrtG3ycumaNEAzsIxLVKYk9s8kaFd6wAIJE6fUV1Dlj87HN2Vc7dETkWldk8eqTtp3NiMMjS8=
30 | - secure: LkB3bpghRZ6GzdmjCUIAKMFYGWpLWjOEDbpEc3TGgfz83NBcQHlRk6wl7u7PckTgDlv4XhOuARzcFmBRgqHmIepHTEN3JeTP8U+xbK6ELPaLcGtXN3RMxZLBpTZt1oXQTFmbvNrm8OV7/YbYEDuhKDKD4or0/IGDAzZYuF371myTKgrKS0hBbjgGITcbE0L1LibO1G3g8/n+8XdwHpilGAJKYiJ+mSbq+1qNRU36e6ZpcH1geYdWOdPA3mumOzpNE0rZj6oNs8NxxNaGh718jwU9mx4pGv/XN9FuVQ3vNw7WI5Z+77si4NtFYWU+dibvjsEcB6oay5mLdFaR0WvJHMux0Y1lGRS5etPucoU+YzOQlxB4NgRy7TLRKWbgm8z8AA/mT/Gk1qgMKCX0+/w/Wg9jvADWXirl+dyZfz9HXmnUFkMG1FjpUYXA2azQF+HfnNV/jfEooPr+ylxCTu17nO0I6+hw04hxtlO3wt6rmrCwTkiaCBvvlmMfBDc5FAOuF115nU87PfJoj6t+1pPnULEoOLe/1vF8zrs3XYGKvYmh9PgYC7K2Kj1dXVPhVfgFH0yAwXHfMQ85osGGRer3DsXQ5onbp0kSZfAYmm4igHKC6q0X2GViHaMyX5basQQA8xLqB6jrK9DQ/Yqs2wwWK1eqpkWEtE+Lb2iKKKIR5kg=
31 | - secure: abYRJGJ4aDMhyWLDyO8gTWXxdOeNXhOzurPP6PVHTiI0X9WIUpd8lUEJDPkhMrSV5kW5WS0jmfo1mgQRoNUPzxsT+Z6k8/m/ju+I90cImk8aSkZDiyBZZcRLXvUNYzBR6xoQT3AChLEyI9sxAQ8uLuN7AhCoGYdB8PRVhNlYXm9mYKN7jiBhyncuVSEbTUd85Oc4/FU/eX0n4zWz1HOdQGIAJFo74R1b56FADS7dMwFPrNTtJY9yrg0HvaQ6H19XIb3el5T73HsOWJJvfRfDX23dm4m8gdY8QQOrCBZytmg3fQ8CSYqWKsVzCjSb3q0iumz7l1lubKbABr6du/zuKc/HaM55GDoK8OveflBjUUL2babSzKn5viQh8pCyZqWpPGsgKcLHNlJc8X/sgsDM+J/XHigareUhCfqPQ6XnbA/d/lW6wSTsbH+ovAwWJfkDsPzTj0dQPHZhkA3VRllCLYPkzq/z5ILt0MmpN4NfAIliZEBKTqHNEuRVxF2a2Bg9kt7ZzCZi0WZGtt4lab2vOV1Ob+Gjih9pcRnyyZKkXTeh9izfnWE8owTXyVBvvMEcJAap4ntVPXE69tSfRzlPQeovdgIAHijjdmwVkR7fZpSON2bRu/oXY3DcaGIWJqlvAjqekni8PckxEL/EBODurGm1bRxzohBC7h85J4aG+pQ=
32 | - export GIT_AUTHOR_NAME="esg-bot"
33 | - export GIT_AUTHOR_EMAIL="tech@endemolshine.com"
34 | - export GIT_COMMITTER_NAME="esg-bot"
35 | - export GIT_COMMITTER_EMAIL="tech@endemolshine.com"
36 |
37 | jobs:
38 | include:
39 | - stage: coverage
40 | if: type != pull_request
41 | before_script:
42 | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
43 | - chmod +x ./cc-test-reporter
44 | - ./cc-test-reporter before-build
45 | after_script:
46 | - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
47 | after_success:
48 | - yarn global add codecov
49 | - codecov
50 | - stage: release
51 | if: branch = master AND type != pull_request
52 | after_success:
53 | - yarn semantic-release
54 | - git clone https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG
55 | - cd $TRAVIS_REPO_SLUG
56 | - git fetch --all
57 | - git merge origin/master
58 | - git push
59 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [3.0.2](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v3.0.1...v3.0.2) (2020-09-05)
2 |
3 |
4 | ### Bug Fixes
5 |
6 | * remove `yarn` from `engines` declarations ([26e9aec](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/26e9aec31b0465ab65568c1b192376c84be4fd41)), closes [#77](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/77)
7 | * use valid version of Yarn in `engines` ([09983de](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/09983de925080107f4a90e822b3dca6a79fc9b56)), closes [#77](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/77)
8 |
9 | ## [3.0.1](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v3.0.0...v3.0.1) (2020-09-04)
10 |
11 |
12 | ### Bug Fixes
13 |
14 | * publish only necessary files to npm ([edc924e](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/edc924ecb5fff5541129b8646a5668a61e776293))
15 |
16 | # [3.0.0](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v2.0.0...v3.0.0) (2020-06-20)
17 |
18 |
19 | ### Build System
20 |
21 | * change minimum supported Node version ([c450d41](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/c450d41))
22 |
23 |
24 | ### BREAKING CHANGES
25 |
26 | * change minimum supported version of Node to v10
27 |
28 | # [2.0.0](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v1.0.2...v2.0.0) (2020-06-20)
29 |
30 |
31 | ### Features
32 |
33 | * **deps:** update `cosmiconfig` ([dc9a903](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/dc9a903))
34 |
35 |
36 | ### BREAKING CHANGES
37 |
38 | * **deps:** `cosmiconfig` API has changed in latest version
39 |
40 | ## [1.0.2](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v1.0.1...v1.0.2) (2020-06-20)
41 |
42 |
43 | ### Bug Fixes
44 |
45 | * **dependencies:** limit cosmiconfig peer dependency with upper boundary ([ec0c4f2](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/ec0c4f2))
46 |
47 | ## [1.0.1](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/compare/v1.0.0...v1.0.1) (2019-07-13)
48 |
49 |
50 | ### Bug Fixes
51 |
52 | * **package:** add missing dependency "make-error" ([d8c8948](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/d8c8948))
53 | * **security:** upgrade dependencies to fix CVE-2018-16469 ([10dc113](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/10dc113))
54 |
55 | # 1.0.0 (2018-10-13)
56 |
57 |
58 | ### Bug Fixes
59 |
60 | * **sourcemaps:** use inline sourcemaps for tests ([db5f6d4](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/commit/db5f6d4))
61 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # These users are the default owners for everything in
2 | # the repo. Unless a later match takes precedence,
3 | # these users will be requested for review when someone
4 | # opens a pull request.
5 | * @EndemolShineGroup/open-source
6 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | ## Guidelines
4 |
5 | - **Coding Standard:** Linting errors are checked by [TSLint][link-tslint] and
6 | stylistic issues are handled by [Prettier][link-prettier]. Keeping a
7 | consistent style throughout the codebase keeps the cognitive load low for all
8 | contributors and keeps the code style homogeneous.
9 |
10 | - **Node 8 LTS:** `cosmiconfig-typescript-loader` has a minimum Node version
11 | requirement of 8.0.0. Pull requests must not require a Node version greater
12 | than that unless the feature is enabled/backported via
13 | [TypeScript][link-typescript].
14 |
15 | - **Add tests:** All pull requests should include unit tests to ensure the
16 | change works as expected and to prevent regressions.
17 |
18 | - **Document any change in behaviour:** Make sure any documentation is kept
19 | up-to-date.
20 |
21 | - **Consider our release cycle:** We try to follow [SemVer v2][link-semver].
22 | Randomly breaking public APIs is not an option.
23 |
24 | - **Use Git Flow:** Don't ask us to pull from your `master` branch. Set up
25 | [Git Flow][link-git-flow] and create a new feature branch from `develop`.
26 |
27 | - **One pull request per feature:** If you want to do more than one thing, send
28 | multiple pull requests.
29 |
30 | - **Send coherent history:** Make sure each individual commit in your pull
31 | request is meaningful. If you had to make multiple intermediate commits while
32 | developing, please [rebase or squash them][link-git-rewrite] before
33 | submitting.
34 |
35 | - **Useful commit messages:** Commit messages should be short and descriptive,
36 | and follow [Conventional Changelog Standard][link-conventional-changelog].
37 | The best way to do this is to use `yarn commit` instead of interacting with
38 | Git directly.
39 |
40 | ## Running tests
41 |
42 | In order to contribute, you'll need to checkout the source from GitHub and
43 | install dependencies using Yarn:
44 |
45 | ``` bash
46 | git clone https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader.git
47 | cd cosmiconfig-typescript-loader
48 | yarn
49 | yarn test
50 | ```
51 |
52 | ## Releasing a new version
53 |
54 | To release a new version, simply merge `develop` into `master` and let the CI
55 | take care of everything. This includes Git tags, changelog generation and NPM
56 | releases.
57 |
58 | ## Reporting a security vulnerability
59 |
60 | We want to ensure that `cosmiconfig-typescript-loader` is secure for everyone. If
61 | you've discovered a security vulnerability, we appreciate your help in
62 | disclosing it to us in a [responsible manner][link-responsible-disclosure].
63 |
64 | Publicly disclosing a vulnerability can put the entire community at risk. If
65 | you've discovered a security concern, please email us at tech@endemolshine.com
66 | with [SECURITY] in the subject line. We'll work with you to make sure that we
67 | understand the scope of the issue, and that we fully address your concern. We
68 | consider correspondence sent to this email address our highest priority, and
69 | work to address any issues that arise as quickly as possible.
70 |
71 | After a security vulnerability has been corrected, a security hotfix release
72 | will be deployed as soon as possible.
73 |
74 | **Happy coding**!
75 |
76 | [link-tslint]: https://palantir.github.io/tslint/
77 | [link-prettier]: https://prettier.io/
78 | [link-typescript]: https://www.typescriptlang.org/
79 | [link-semver]: http://semver.org/
80 | [link-git-flow]: http://nvie.com/posts/a-successful-git-branching-model/
81 | [link-git-rewrite]: http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages
82 | [link-conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog
83 | [link-responsible-disclosure]: http://en.wikipedia.org/wiki/Responsible_disclosure
84 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2018 Endemol Shine Group
2 |
3 | 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:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | 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.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ![Banner][icon-banner]
2 |
3 | [![MIT Licensed][icon-license]][link-license]
4 | [![NPM Version][icon-npm]][link-npm]
5 | [![Build Status][icon-ci]][link-ci]
6 | [![Dependabot Status][icon-dependabot]][link-dependabot]
7 |
8 | [![Code Issues][icon-issues]][link-issues]
9 | [![Codebase Maintainability][icon-maintainability]][link-maintainability]
10 | [![Test Coverage][icon-coverage]][link-coverage]
11 | [![Jest][icon-jest]][link-jest]
12 |
13 | [![Commitizen][icon-commitizen]][link-commitizen]
14 | [![Semantic Release][icon-semantic-release]][link-semantic-release]
15 | [![Prettier][icon-prettier]][link-prettier]
16 |
17 | A TypeScript loader for Cosmiconfig
18 |
19 | ## Status
20 |
21 | This package is no longer maintained: Please use [this fork from @Codex-](https://github.com//cosmiconfig-typescript-loader/) instead.
22 |
23 | ## Installation
24 |
25 | ```bash
26 | yarn add @endemolshinegroup/cosmiconfig-typescript-loader
27 | ```
28 |
29 | ## Usage
30 |
31 | ```typescript
32 | import cosmiconfig from 'cosmiconfig';
33 | import TypeScriptLoader from '@endemolshinegroup/cosmiconfig-typescript-loader';
34 |
35 | const moduleName = 'myModuleName';
36 | const explorer = cosmiconfig(moduleName, {
37 | searchPlaces: [
38 | 'package.json',
39 | `.${moduleName}rc`,
40 | `.${moduleName}rc.json`,
41 | `.${moduleName}rc.yaml`,
42 | `.${moduleName}rc.yml`,
43 | `.${moduleName}rc.ts`,
44 | `.${moduleName}rc.js`,
45 | `${moduleName}.config.ts`,
46 | `${moduleName}.config.js`,
47 | ],
48 | loaders: {
49 | '.ts': TypeScriptLoader,
50 | },
51 | });
52 | ```
53 |
54 | [icon-banner]: docs/assets/banner.png
55 |
56 | [icon-license]: https://img.shields.io/github/license/EndemolShineGroup/cosmiconfig-typescript-loader.svg?longCache=true&style=flat-square
57 | [link-license]: LICENSE
58 | [icon-npm]: https://img.shields.io/npm/v/@endemolshinegroup/cosmiconfig-typescript-loader.svg?longCache=true&style=flat-square
59 | [link-npm]: https://www.npmjs.com/package/@endemolshinegroup/cosmiconfig-typescript-loader
60 | [icon-ci]: https://img.shields.io/travis/com/EndemolShineGroup/cosmiconfig-typescript-loader.svg?longCache=true&style=flat-square
61 | [link-ci]: https://travis-ci.com/EndemolShineGroup/cosmiconfig-typescript-loader
62 | [icon-dependabot]: https://flat.badgen.net/dependabot/EndemolShineGroup/cosmiconfig-typescript-loader?icon=dependabot
63 | [link-dependabot]: https://dependabot.com/
64 |
65 | [icon-issues]: https://img.shields.io/codeclimate/issues/EndemolShineGroup/cosmiconfig-typescript-loader.svg?longCache=true&style=flat-square
66 | [link-issues]: https://codeclimate.com/github/EndemolShineGroup/cosmiconfig-typescript-loader/issues
67 | [icon-maintainability]: https://img.shields.io/codeclimate/maintainability/EndemolShineGroup/cosmiconfig-typescript-loader.svg?longCache=true&style=flat-square
68 | [link-maintainability]: https://codeclimate.com/github/EndemolShineGroup/cosmiconfig-typescript-loader
69 | [icon-coverage]: https://img.shields.io/codecov/c/github/EndemolShineGroup/cosmiconfig-typescript-loader/develop.svg?longCache=true&style=flat-square
70 | [link-coverage]: https://codecov.io/gh/EndemolShineGroup/cosmiconfig-typescript-loader
71 |
72 | [icon-jest]: https://img.shields.io/badge/tested_with-jest-99424f.svg?longCache=true&style=flat-square
73 | [link-jest]: https://jestjs.io/
74 |
75 | [icon-commitizen]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?longCache=true&style=flat-square
76 | [link-commitizen]: http://commitizen.github.io/cz-cli/
77 | [icon-semantic-release]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?longCache=true&style=flat-square
78 | [link-semantic-release]: https://semantic-release.gitbooks.io/semantic-release/
79 | [icon-prettier]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?longCache=true&style=flat-square
80 | [link-prettier]: https://prettier.io/
81 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | status:
3 | patch: false
4 |
--------------------------------------------------------------------------------
/docs/assets/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndemolShineGroup/cosmiconfig-typescript-loader/d1271eb05eca811521d2bb55a6f7341501f6a854/docs/assets/banner.png
--------------------------------------------------------------------------------
/docs/content/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndemolShineGroup/cosmiconfig-typescript-loader/d1271eb05eca811521d2bb55a6f7341501f6a854/docs/content/.gitkeep
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'ts-jest',
3 | testEnvironment: 'node',
4 | coveragePathIgnorePatterns: [
5 | '/node_modules/',
6 | '/tests/',
7 | '/__fixtures__/',
8 | ],
9 | globals: {
10 | 'ts-jest': {
11 | tsConfig: "tsconfig.test.json",
12 | },
13 | },
14 | moduleDirectories: [
15 | 'src',
16 | 'node_modules',
17 | ],
18 | };
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@endemolshinegroup/cosmiconfig-typescript-loader",
3 | "description": "A TypeScript loader for Cosmiconfig",
4 | "version": "3.0.2",
5 | "license": "MIT",
6 | "main": "dist/index.js",
7 | "types": "dist/index.d.ts",
8 | "keywords": [
9 | "cosmiconfig",
10 | "cosmiconfig-loader",
11 | "typescript"
12 | ],
13 | "author": {
14 | "name": "Endemol Shine Group Technology",
15 | "url": "https://github.com/EndemolShineGroup"
16 | },
17 | "files": [
18 | "dist"
19 | ],
20 | "homepage": "https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader",
21 | "repository": {
22 | "type": "git",
23 | "url": "https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader.git"
24 | },
25 | "engines": {
26 | "node": ">=10.0.0"
27 | },
28 | "scripts": {
29 | "pretest": "rimraf coverage/",
30 | "test": "jest --no-cache --coverage",
31 | "prebuild": "rimraf dist/",
32 | "build": "tsc",
33 | "build:docs": "rimraf docs/api && typedoc --out docs/api --target es6 --theme minimal --mode file src",
34 | "semantic-release": "semantic-release",
35 | "commit": "git-cz",
36 | "lint": "tslint -p tsconfig.json -t codeFrame 'src/**/*.ts' -e 'src/**/*.spec.ts'"
37 | },
38 | "peerDependencies": {
39 | "cosmiconfig": ">=6"
40 | },
41 | "dependencies": {
42 | "lodash.get": "^4",
43 | "make-error": "^1",
44 | "ts-node": "^9",
45 | "tslib": "^2"
46 | },
47 | "devDependencies": {
48 | "@commitlint/cli": "^11",
49 | "@commitlint/config-conventional": "^11",
50 | "@endemolshinegroup/cz-github": "^2",
51 | "@endemolshinegroup/prettier-config": "^1",
52 | "@endemolshinegroup/tslint-config": "^1",
53 | "@semantic-release/changelog": "^5",
54 | "@semantic-release/git": "^9",
55 | "@types/jest": "^26",
56 | "@types/lodash.get": "^4",
57 | "@types/node": "10.*",
58 | "commitizen": "^4",
59 | "cosmiconfig": "^7",
60 | "husky": "^4",
61 | "jest": "^26",
62 | "lint-staged": "^10",
63 | "prettier": "^2",
64 | "rimraf": "^3",
65 | "semantic-release": "^17",
66 | "ts-jest": "^26",
67 | "tslint": "^5",
68 | "tslint-config-prettier": "^1",
69 | "tslint-eslint-rules": "^5",
70 | "typedoc": "^0.19.1",
71 | "typescript": "^3"
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/prettier.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('@endemolshinegroup/prettier-config');
2 |
--------------------------------------------------------------------------------
/src/Errors/TypeScriptCompileError.ts:
--------------------------------------------------------------------------------
1 | import { BaseError } from 'make-error';
2 |
3 | export interface TypeScriptCompileErrorProps {
4 | message: string;
5 | }
6 |
7 | const TS_ERROR_MESSAGE =
8 | 'TypeScript compiler encountered syntax errors while transpiling. Errors: ';
9 |
10 | export default class TypeScriptCompileError extends BaseError {
11 | name = 'TypeScriptCompileError';
12 | options: {};
13 |
14 | static fromError = (error: TypeScriptCompileErrorProps) => {
15 | const message = [
16 | 'Failed to compile TypeScript: ',
17 | error.message.replace(TS_ERROR_MESSAGE, ''),
18 | ].join('');
19 |
20 | return new TypeScriptCompileError(message, error);
21 | };
22 |
23 | constructor(message: string, options: {}) {
24 | super(message);
25 |
26 | this.options = options;
27 | Object.defineProperty(this, 'options', {
28 | enumerable: false,
29 | });
30 | }
31 |
32 | toObject() {
33 | return {
34 | message: this.message,
35 | name: this.name,
36 | stack: this.stack,
37 | };
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/__fixtures__/error.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | foo:,
3 | };
4 |
--------------------------------------------------------------------------------
/src/__fixtures__/success.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | foo: 'bar',
3 | };
4 |
--------------------------------------------------------------------------------
/src/index.spec.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 |
3 | import loader from '.';
4 | import TypeScriptCompileError from './Errors/TypeScriptCompileError';
5 |
6 | const FIXTURES_PATH = path.resolve(__dirname, '__fixtures__');
7 |
8 | describe('TypeScriptLoader', () => {
9 | it('compiles a valid TypeScript file', async () => {
10 | const result = await loader(path.resolve(FIXTURES_PATH, 'success'), '');
11 | expect(result).toEqual({ foo: 'bar' });
12 | });
13 |
14 | it('fails to compile an invalid TypeScript file', async () => {
15 | try {
16 | await loader(path.resolve(FIXTURES_PATH, 'error'), '');
17 | } catch (error) {
18 | expect(error).toBeInstanceOf(TypeScriptCompileError);
19 | expect(error.toObject().message).toMatch('Failed to compile TypeScript');
20 | }
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Loader } from 'cosmiconfig';
2 | import get from 'lodash.get';
3 |
4 | import TypeScriptCompileError from './Errors/TypeScriptCompileError';
5 |
6 | const loader: Loader = (filePath: string) => {
7 | try {
8 | require('ts-node/register');
9 | const result = require(filePath);
10 |
11 | return get(result, 'default', result);
12 | } catch (error) {
13 | // Replace with logger class OR throw a more specific error
14 | throw TypeScriptCompileError.fromError(error);
15 | }
16 | };
17 |
18 | export default loader;
19 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowSyntheticDefaultImports": true,
4 | "declaration": true,
5 | "esModuleInterop": true,
6 | "importHelpers": true,
7 | "lib": [
8 | "es2015"
9 | ],
10 | "module": "commonjs",
11 | "outDir": "./dist",
12 | "resolveJsonModule": true,
13 | "rootDir": "./src",
14 | "sourceMap": true,
15 | "strict": true,
16 | "target":"es2015"
17 | },
18 | "include": [
19 | "src/**/*.ts"
20 | ],
21 | "exclude": [
22 | "node_modules",
23 | "**/*.spec.ts",
24 | "**/*.integ.ts",
25 | "**/__fixtures__/*.*"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/tsconfig.test.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "declaration": false,
5 | "inlineSourceMap": true,
6 | "inlineSources": true,
7 | "sourceMap": false
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultSeverity": "warning",
3 | "extends": [
4 | "@endemolshinegroup/tslint-config"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------