Skip to content

Commit 078cadb

Browse files
committed
feat(core2): added tapable and first PoC usage
1 parent 9fbaf38 commit 078cadb

File tree

4 files changed

+131
-9
lines changed

4 files changed

+131
-9
lines changed

packages/core2/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@
3232
},
3333
"scripts": {
3434
"build": "tsc --pretty",
35-
"dev": "npm run build -- --watch",
35+
"dev": "ts-node src/index.ts",
3636
"test": "echo \"Error: run tests from root\" && exit 1"
3737
},
3838
"bugs": {
3939
"url": "https://github.com/pattern-lab/patternlab-node/issues"
4040
},
4141
"devDependencies": {
42+
"@types/cosmiconfig": "^6.0.0",
43+
"ts-node": "^8.8.2",
4244
"typescript": "^3.7.5"
45+
},
46+
"dependencies": {
47+
"cosmiconfig": "^6.0.0",
48+
"tapable": "2.0.0-beta.10"
4349
}
4450
}

packages/core2/src/core2.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/core2/src/index.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
import { SyncHook, Hook } from 'tapable';
4+
5+
interface PatternLabHooks {
6+
configure: SyncHook<unknown, void>;
7+
}
8+
9+
interface PatternLab {
10+
hooks: PatternLabHooks;
11+
}
12+
13+
class PatternLab implements PatternLab {
14+
constructor() {
15+
this.hooks = {
16+
configure: new SyncHook(),
17+
};
18+
}
19+
20+
configure() {
21+
console.log('configure entry');
22+
this.hooks.configure.call([]);
23+
console.log('configure exit');
24+
}
25+
}
26+
27+
module.exports = PatternLab;
28+
29+
// test
30+
const pl = new PatternLab();
31+
32+
// test logger tap hellow world
33+
pl.hooks.configure.tap('LoggerPlugin', () =>
34+
console.log('hello from logger plugin within configure')
35+
);
36+
37+
pl.configure();

yarn.lock

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,13 @@
797797
dependencies:
798798
regenerator-runtime "^0.13.2"
799799

800+
"@babel/runtime@^7.8.7":
801+
version "7.9.2"
802+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.2.tgz#d90df0583a3a252f09aaa619665367bae518db06"
803+
integrity sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==
804+
dependencies:
805+
regenerator-runtime "^0.13.4"
806+
800807
"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0":
801808
version "7.6.0"
802809
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6"
@@ -1858,6 +1865,13 @@
18581865
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
18591866
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
18601867

1868+
"@types/cosmiconfig@^6.0.0":
1869+
version "6.0.0"
1870+
resolved "https://registry.yarnpkg.com/@types/cosmiconfig/-/cosmiconfig-6.0.0.tgz#ffb5494a91feab3088985caeb089a9ff851795a2"
1871+
integrity sha512-KxKYXK5K1W+SVj1wjBBlwUs43K2D4iteye+r2ObPPQ7+NVASxSPfTb5H8iPW0bLswapMvaA4YMnxdKx7M4k29A==
1872+
dependencies:
1873+
cosmiconfig "*"
1874+
18611875
"@types/events@*":
18621876
version "3.0.0"
18631877
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
@@ -1882,6 +1896,11 @@
18821896
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.12.tgz#7c6c571cc2f3f3ac4a59a5f2bd48f5bdbc8653cc"
18831897
integrity sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==
18841898

1899+
"@types/parse-json@^4.0.0":
1900+
version "4.0.0"
1901+
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
1902+
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
1903+
18851904
"@types/prop-types@*":
18861905
version "15.7.3"
18871906
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
@@ -4853,6 +4872,17 @@ [email protected]:
48534872
object-assign "^4"
48544873
vary "^1"
48554874

4875+
cosmiconfig@*, cosmiconfig@^6.0.0:
4876+
version "6.0.0"
4877+
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
4878+
integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==
4879+
dependencies:
4880+
"@types/parse-json" "^4.0.0"
4881+
import-fresh "^3.1.0"
4882+
parse-json "^5.0.0"
4883+
path-type "^4.0.0"
4884+
yaml "^1.7.2"
4885+
48564886
[email protected], cosmiconfig@^5.0.0, cosmiconfig@^5.0.6, cosmiconfig@^5.1.0, cosmiconfig@^5.2.1:
48574887
version "5.2.1"
48584888
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a"
@@ -8369,6 +8399,14 @@ import-fresh@^3.0.0:
83698399
parent-module "^1.0.0"
83708400
resolve-from "^4.0.0"
83718401

8402+
import-fresh@^3.1.0:
8403+
version "3.2.1"
8404+
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
8405+
integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==
8406+
dependencies:
8407+
parent-module "^1.0.0"
8408+
resolve-from "^4.0.0"
8409+
83728410
import-from@^2.1.0:
83738411
version "2.1.0"
83748412
resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1"
@@ -9639,6 +9677,11 @@ limiter@^1.0.5:
96399677
resolved "https://registry.yarnpkg.com/limiter/-/limiter-1.1.4.tgz#87c9c3972d389fdb0ba67a45aadbc5d2f8413bc1"
96409678
integrity sha512-XCpr5bElgDI65vVgstP8TWjv6/QKWm9GU5UG0Pr5sLQ3QLo8NVKsioe+Jed5/3vFOe3IQuqE7DKwTvKQkjTHvg==
96419679

9680+
lines-and-columns@^1.1.6:
9681+
version "1.1.6"
9682+
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
9683+
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=
9684+
96429685
linkify-it@^2.0.0:
96439686
version "2.2.0"
96449687
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
@@ -11851,6 +11894,16 @@ parse-json@^4.0.0:
1185111894
error-ex "^1.3.1"
1185211895
json-parse-better-errors "^1.0.1"
1185311896

11897+
parse-json@^5.0.0:
11898+
version "5.0.0"
11899+
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f"
11900+
integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==
11901+
dependencies:
11902+
"@babel/code-frame" "^7.0.0"
11903+
error-ex "^1.3.1"
11904+
json-parse-better-errors "^1.0.1"
11905+
lines-and-columns "^1.1.6"
11906+
1185411907
parse-node-version@^1.0.0:
1185511908
version "1.0.1"
1185611909
resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b"
@@ -12005,6 +12058,11 @@ path-type@^3.0.0:
1200512058
dependencies:
1200612059
pify "^3.0.0"
1200712060

12061+
path-type@^4.0.0:
12062+
version "4.0.0"
12063+
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
12064+
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
12065+
1200812066
1200912067
version "0.0.11"
1201012068
resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445"
@@ -13353,6 +13411,11 @@ regenerator-runtime@^0.13.2:
1335313411
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
1335413412
integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==
1335513413

13414+
regenerator-runtime@^0.13.4:
13415+
version "0.13.5"
13416+
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"
13417+
integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==
13418+
1335613419
regenerator-transform@^0.14.0:
1335713420
version "0.14.1"
1335813421
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb"
@@ -15059,6 +15122,11 @@ [email protected]:
1505915122
yaml "^1.6.0"
1506015123
yapool "^1.0.0"
1506115124

15125+
15126+
version "2.0.0-beta.10"
15127+
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.0.0-beta.10.tgz#54a95a1f6be6c65d2d8aa4eda2562325ff6c2a1e"
15128+
integrity sha512-yLpWrQT5qTw0SWvaJSrFpog+fvrbpfEfHApCKV+hrkE1937WifJf6UP1xonVXqre30pxmANsqm7B3XYQKtvlcw==
15129+
1506215130
tapable@^1.0.0, tapable@^1.0.0-beta.5, tapable@^1.1.3:
1506315131
version "1.1.3"
1506415132
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
@@ -15519,6 +15587,17 @@ ts-node@^8.3.0:
1551915587
source-map-support "^0.5.6"
1552015588
yn "^3.0.0"
1552115589

15590+
ts-node@^8.8.2:
15591+
version "8.8.2"
15592+
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.8.2.tgz#0b39e690bee39ea5111513a9d2bcdc0bc121755f"
15593+
integrity sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==
15594+
dependencies:
15595+
arg "^4.1.0"
15596+
diff "^4.0.1"
15597+
make-error "^1.1.1"
15598+
source-map-support "^0.5.6"
15599+
yn "3.1.1"
15600+
1552215601
tslib@^1.9.0:
1552315602
version "1.10.0"
1552415603
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
@@ -16665,6 +16744,13 @@ yaml@^1.5.0, yaml@^1.6.0:
1666516744
dependencies:
1666616745
"@babel/runtime" "^7.5.5"
1666716746

16747+
yaml@^1.7.2:
16748+
version "1.8.3"
16749+
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.8.3.tgz#2f420fca58b68ce3a332d0ca64be1d191dd3f87a"
16750+
integrity sha512-X/v7VDnK+sxbQ2Imq4Jt2PRUsRsP7UcpSl3Llg6+NRRqWLIvxkMFYtH1FmvwNGYRKKPa+EPA4qDBlI9WVG1UKw==
16751+
dependencies:
16752+
"@babel/runtime" "^7.8.7"
16753+
1666816754
yapool@^1.0.0:
1666916755
version "1.0.0"
1667016756
resolved "https://registry.yarnpkg.com/yapool/-/yapool-1.0.0.tgz#f693f29a315b50d9a9da2646a7a6645c96985b6a"
@@ -16892,7 +16978,7 @@ [email protected]:
1689216978
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
1689316979
integrity sha1-AI4G2AlDIMNy28L47XagymyKxBk=
1689416980

16895-
yn@^3.0.0:
16981+
yn@3.1.1, yn@^3.0.0:
1689616982
version "3.1.1"
1689716983
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
1689816984
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==

0 commit comments

Comments
 (0)