Skip to content

Commit df3ba4d

Browse files
committed
Merge branch 'master' of https://github.com/Igorbek/typescript-plugin-styled-components into simplify-transformer-ts4
2 parents 9f8f026 + 13b6a71 commit df3ba4d

File tree

16 files changed

+570
-74
lines changed

16 files changed

+570
-74
lines changed

.github/dependabot.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "13:00"
8+
open-pull-requests-limit: 10
9+
ignore:
10+
- dependency-name: "@types/node"
11+
versions:
12+
- 14.14.22
13+
- 14.14.25
14+
- 14.14.27
15+
- 14.14.28
16+
- 14.14.30
17+
- 14.14.31
18+
- 14.14.32
19+
- 14.14.33
20+
- 14.14.34
21+
- 14.14.35
22+
- 14.14.36
23+
- 14.14.37
24+
- 14.14.39
25+
- 14.14.41
26+
- 15.0.0
27+
- dependency-name: "@types/react"
28+
versions:
29+
- 17.0.0
30+
- 17.0.1
31+
- 17.0.2
32+
- 17.0.3
33+
- dependency-name: "@types/jest"
34+
versions:
35+
- 26.0.20
36+
- 26.0.21
37+
- 26.0.22
38+
- dependency-name: typescript
39+
versions:
40+
- 4.1.3
41+
- 4.1.4
42+
- 4.1.5
43+
- 4.2.2
44+
- 4.2.3
45+
- dependency-name: y18n
46+
versions:
47+
- 4.0.1
48+
- 4.0.2
49+
- dependency-name: "@types/styled-components"
50+
versions:
51+
- 5.1.7
52+
- 5.1.8
53+
- dependency-name: lodash
54+
versions:
55+
- 4.17.20
56+
- dependency-name: handlebars
57+
versions:
58+
- 4.7.6

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55

66
- **breaking change** upgrade to TypeScript 4+ and make use of Factory API (#379)
77

8+
## [1.6.0]
9+
10+
- namespace prefix to help multiple instances of the library not clash (fix #381 in #395)
11+
812
## [1.5.0]
913

1014
- transform anonymous default exports (fix #371 in #367)
@@ -66,7 +70,8 @@ All notable changes to this project will be documented in this file.
6670
- updated `typescript` dependency to support TS 3.0+ (#17, fixed #15)
6771
- remove `ts-is-kind` dependency (#17, fixed #16)
6872

69-
[Unreleased]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.5.0...HEAD
73+
[Unreleased]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.6.0...HEAD
74+
[1.6.0]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.5.0...1.6.0
7075
[1.5.0]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.4.4...1.5.0
7176
[1.4.4]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.4.3...1.4.4
7277
[1.4.3]: https://github.com/igorbek/typescript-plugin-styled-components/compare/1.4.2...1.4.3

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ interface Options {
225225
ssr: boolean;
226226
displayName: boolean;
227227
minify: boolean;
228+
componentIdPrefix: string;
228229
}
229230
```
230231

@@ -275,6 +276,12 @@ The minification is not exactly the same and may produce slightly different resu
275276

276277
Default value is `false` which means the minification is not being performed.
277278

279+
### `componentIdPrefix`
280+
281+
To avoid colisions when running more than one insance of typescript-plugin-styled-components at a time, you can add a componentIdPrefix by providing an arbitrary string to this option.
282+
283+
Default value is `''` which means that no namespacing will happen.
284+
278285
### `identifiers`
279286

280287
This option allows to customize identifiers used by `styled-components` API functions.

example/yarn.lock

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ acorn-dynamic-import@^3.0.0:
328328
acorn "^5.0.0"
329329

330330
acorn@^5.0.0, acorn@^5.6.2:
331-
version "5.7.3"
332-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
333-
integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==
331+
version "5.7.4"
332+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
333+
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
334334

335335
ajv-errors@^1.0.0:
336336
version "1.0.0"
@@ -516,10 +516,10 @@ bluebird@^3.5.1:
516516
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7"
517517
integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==
518518

519-
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
520-
version "4.11.8"
521-
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
522-
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
519+
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.9:
520+
version "4.12.0"
521+
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
522+
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
523523

524524
body-parser@1.18.3:
525525
version "1.18.3"
@@ -561,7 +561,7 @@ braces@^2.3.0, braces@^2.3.1:
561561
split-string "^3.0.2"
562562
to-regex "^3.0.1"
563563

564-
brorand@^1.0.1:
564+
brorand@^1.0.1, brorand@^1.1.0:
565565
version "1.1.0"
566566
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
567567
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
@@ -1093,17 +1093,17 @@ ee-first@1.1.1:
10931093
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
10941094

10951095
elliptic@^6.0.0:
1096-
version "6.4.1"
1097-
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a"
1098-
integrity sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==
1096+
version "6.5.4"
1097+
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
1098+
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
10991099
dependencies:
1100-
bn.js "^4.4.0"
1101-
brorand "^1.0.1"
1100+
bn.js "^4.11.9"
1101+
brorand "^1.1.0"
11021102
hash.js "^1.0.0"
1103-
hmac-drbg "^1.0.0"
1104-
inherits "^2.0.1"
1105-
minimalistic-assert "^1.0.0"
1106-
minimalistic-crypto-utils "^1.0.0"
1103+
hmac-drbg "^1.0.1"
1104+
inherits "^2.0.4"
1105+
minimalistic-assert "^1.0.1"
1106+
minimalistic-crypto-utils "^1.0.1"
11071107

11081108
emojis-list@^2.0.0:
11091109
version "2.1.0"
@@ -1339,9 +1339,9 @@ fbjs@^0.8.5:
13391339
ua-parser-js "^0.7.18"
13401340

13411341
figgy-pudding@^3.1.0, figgy-pudding@^3.5.1:
1342-
version "3.5.1"
1343-
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790"
1344-
integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==
1342+
version "3.5.2"
1343+
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
1344+
integrity sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==
13451345

13461346
fill-range@^4.0.0:
13471347
version "4.0.0"
@@ -1569,9 +1569,9 @@ hash-base@^3.0.0:
15691569
safe-buffer "^5.0.1"
15701570

15711571
hash.js@^1.0.0, hash.js@^1.0.3:
1572-
version "1.1.5"
1573-
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.5.tgz#e38ab4b85dfb1e0c40fe9265c0e9b54854c23812"
1574-
integrity sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==
1572+
version "1.1.7"
1573+
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
1574+
integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==
15751575
dependencies:
15761576
inherits "^2.0.3"
15771577
minimalistic-assert "^1.0.1"
@@ -1587,7 +1587,7 @@ history@^4.7.2:
15871587
value-equal "^0.4.0"
15881588
warning "^3.0.0"
15891589

1590-
hmac-drbg@^1.0.0:
1590+
hmac-drbg@^1.0.1:
15911591
version "1.0.1"
15921592
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
15931593
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
@@ -1673,20 +1673,25 @@ inflight@^1.0.4:
16731673
once "^1.3.0"
16741674
wrappy "1"
16751675

1676-
inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3:
1677-
version "2.0.3"
1678-
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
1679-
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
1676+
inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3:
1677+
version "2.0.4"
1678+
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
1679+
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
16801680

16811681
inherits@2.0.1:
16821682
version "2.0.1"
16831683
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
16841684
integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=
16851685

1686+
inherits@2.0.3:
1687+
version "2.0.3"
1688+
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
1689+
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
1690+
16861691
ini@~1.3.0:
1687-
version "1.3.5"
1688-
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
1689-
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
1692+
version "1.3.8"
1693+
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
1694+
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
16901695

16911696
interpret@^1.1.0:
16921697
version "1.1.0"
@@ -1949,9 +1954,9 @@ lodash.debounce@^4.0.8:
19491954
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
19501955

19511956
lodash@^4.17.10, lodash@^4.17.5:
1952-
version "4.17.11"
1953-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
1954-
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
1957+
version "4.17.21"
1958+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
1959+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
19551960

19561961
log-symbols@^2.1.0:
19571962
version "2.2.0"
@@ -2114,7 +2119,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
21142119
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
21152120
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==
21162121

2117-
minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
2122+
minimalistic-crypto-utils@^1.0.1:
21182123
version "1.0.1"
21192124
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
21202125
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
@@ -2168,9 +2173,9 @@ mississippi@^3.0.0:
21682173
through2 "^2.0.0"
21692174

21702175
mixin-deep@^1.2.0:
2171-
version "1.3.1"
2172-
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
2173-
integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==
2176+
version "1.3.2"
2177+
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
2178+
integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==
21742179
dependencies:
21752180
for-in "^1.0.2"
21762181
is-extendable "^1.0.1"
@@ -3113,9 +3118,9 @@ split-string@^3.0.1, split-string@^3.0.2:
31133118
extend-shallow "^3.0.0"
31143119

31153120
ssri@^6.0.0:
3116-
version "6.0.1"
3117-
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
3118-
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
3121+
version "6.0.2"
3122+
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
3123+
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
31193124
dependencies:
31203125
figgy-pudding "^3.5.1"
31213126

@@ -3370,9 +3375,9 @@ typescript@^3.1.5:
33703375
integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==
33713376

33723377
ua-parser-js@^0.7.18:
3373-
version "0.7.19"
3374-
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b"
3375-
integrity sha512-T3PVJ6uz8i0HzPxOF9SWzWAlfN/DavlpQqepn22xgve/5QecC+XMCAtmUNnY7C9StehaV6exjUCI801lOI7QlQ==
3378+
version "0.7.28"
3379+
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31"
3380+
integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==
33763381

33773382
union-value@^1.0.0:
33783383
version "1.0.0"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-plugin-styled-components",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "TypeScript transformer for improving the debugging experience of styled-components",
55
"main": "dist/index.js",
66
"homepage": "https://github.com/Igorbek/typescript-plugin-styled-components",
@@ -31,7 +31,7 @@
3131
"@types/styled-components": "^5.1.9",
3232
"jest": "^24.1.0",
3333
"jest-specific-snapshot": "^2.0.0",
34-
"ts-jest": "24.2.0",
34+
"ts-jest": "24.3.0",
3535
"ts-node": "^8.0.2",
3636
"typescript": "~4.2"
3737
},
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue33.ts 1`] = `
4+
5+
File: issue33.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
declare const $: any;
10+
declare const jQuery: any;
11+
declare const _: any;
12+
13+
declare const Button: any;
14+
15+
const Button1 = Button.extend\` color: red \`;
16+
17+
const Button2 = $.extend\` color: red \`;
18+
const Button3 = jQuery.extend\` color: red \`;
19+
const Button4 = _.extend\` color: red \`;
20+
21+
22+
TypeScript before transform:
23+
24+
declare const styled: any;
25+
declare const $: any;
26+
declare const jQuery: any;
27+
declare const _: any;
28+
declare const Button: any;
29+
const Button1 = Button.extend \` color: red \`;
30+
const Button2 = $.extend \` color: red \`;
31+
const Button3 = jQuery.extend \` color: red \`;
32+
const Button4 = _.extend \` color: red \`;
33+
34+
35+
TypeScript after transform:
36+
37+
declare const styled: any;
38+
declare const $: any;
39+
declare const jQuery: any;
40+
declare const _: any;
41+
declare const Button: any;
42+
const Button1 = Button.extend \` color: red \`;
43+
const Button2 = $.extend \` color: red \`;
44+
const Button3 = jQuery.extend \` color: red \`;
45+
const Button4 = _.extend \` color: red \`;
46+
47+
48+
49+
`;

0 commit comments

Comments
 (0)