Skip to content

Commit e571290

Browse files
authored
fix: Removed usage of loader-utils (#1288)
1 parent 5e08d5d commit e571290

File tree

5 files changed

+13
-39
lines changed

5 files changed

+13
-39
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v9.0.2
4+
5+
* [Remove usage of loader-utils](https://github.com/TypeStrong/ts-loader/pull/1287) - thanks @jonwallsten
6+
37
## v9.0.1
48

59
* [Use correct hook for emitting additional assets during compilation](https://github.com/TypeStrong/ts-loader/pull/1286) - thanks @jonwallsten

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-loader",
3-
"version": "9.0.1",
3+
"version": "9.0.2",
44
"description": "TypeScript loader for webpack",
55
"main": "index.js",
66
"types": "dist",
@@ -56,7 +56,6 @@
5656
"dependencies": {
5757
"chalk": "^4.1.0",
5858
"enhanced-resolve": "^5.0.0",
59-
"loader-utils": "^2.0.0",
6059
"micromatch": "^4.0.0",
6160
"semver": "^7.3.4"
6261
},

src/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as crypto from 'crypto';
2-
import * as loaderUtils from 'loader-utils';
32
import * as path from 'path';
43
import type * as typescript from 'typescript';
54

@@ -174,9 +173,7 @@ function getOptionsHash(loaderOptions: LoaderOptions) {
174173
* or creates them, adds them to the cache and returns
175174
*/
176175
function getLoaderOptions(loaderContext: WebpackLoaderContext) {
177-
const loaderOptions =
178-
loaderUtils.getOptions<LoaderOptions>(loaderContext) ||
179-
({} as LoaderOptions);
176+
const loaderOptions = loaderContext.getOptions(undefined);
180177

181178
// If no instance name is given in the options, use the hash of the loader options
182179
// In this way, if different options are given the instances will be different
@@ -646,7 +643,7 @@ function makeSourceMap(
646643
return {
647644
output: outputText.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, ''),
648645
sourceMap: Object.assign(JSON.parse(sourceMapText), {
649-
sources: [loaderUtils.getRemainingRequest(loaderContext)],
646+
sources: [loaderContext.remainingRequest],
650647
file: filePath,
651648
sourcesContent: [contents],
652649
}),

src/typings/loaderUtils/loaderUtils.d.ts

-5
This file was deleted.

yarn.lock

+6-27
Original file line numberDiff line numberDiff line change
@@ -1829,14 +1829,9 @@ emoji-regex@^8.0.0:
18291829
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
18301830
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
18311831

1832-
emojis-list@^2.0.0:
1833-
version "2.1.0"
1834-
resolved "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
1835-
integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k=
1836-
18371832
emojis-list@^3.0.0:
18381833
version "3.0.0"
1839-
resolved "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"
1834+
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"
18401835
integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==
18411836

18421837
encodeurl@~1.0.2:
@@ -3171,13 +3166,6 @@ json5@^1.0.1:
31713166
dependencies:
31723167
minimist "^1.2.0"
31733168

3174-
json5@^2.1.2:
3175-
version "2.1.3"
3176-
resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43"
3177-
integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==
3178-
dependencies:
3179-
minimist "^1.2.5"
3180-
31813169
jsonfile@^4.0.0:
31823170
version "4.0.0"
31833171
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
@@ -3399,22 +3387,13 @@ loader-runner@^4.2.0:
33993387
integrity sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==
34003388

34013389
loader-utils@^1.0.2:
3402-
version "1.2.3"
3403-
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7"
3404-
integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==
3405-
dependencies:
3406-
big.js "^5.2.2"
3407-
emojis-list "^2.0.0"
3408-
json5 "^1.0.1"
3409-
3410-
loader-utils@^2.0.0:
3411-
version "2.0.0"
3412-
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
3413-
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
3390+
version "1.4.0"
3391+
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
3392+
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
34143393
dependencies:
34153394
big.js "^5.2.2"
34163395
emojis-list "^3.0.0"
3417-
json5 "^2.1.2"
3396+
json5 "^1.0.1"
34183397

34193398
locate-path@^2.0.0:
34203399
version "2.0.0"
@@ -3680,7 +3659,7 @@ [email protected]:
36803659
resolved "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
36813660
integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
36823661

3683-
minimist@^1.2.0, minimist@^1.2.5:
3662+
minimist@^1.2.0:
36843663
version "1.2.5"
36853664
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
36863665
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

0 commit comments

Comments
 (0)