diff --git a/frontend/.eslintignore b/frontend/.eslintignore index 79eec47c798..46e0782dc29 100644 --- a/frontend/.eslintignore +++ b/frontend/.eslintignore @@ -2,10 +2,10 @@ __coverage__ **/node_modules **/dist -gui_test_screenshots +**/generated *.min.js +gui_test_screenshots public/lib Godeps @types dynamic-demo-plugin -packages/console-dynamic-plugin-sdk/schema diff --git a/frontend/dynamic-demo-plugin/package.json b/frontend/dynamic-demo-plugin/package.json index 3c8018d310f..d5ff5ca3692 100644 --- a/frontend/dynamic-demo-plugin/package.json +++ b/frontend/dynamic-demo-plugin/package.json @@ -10,10 +10,9 @@ "i18n": "i18next \"src/**/*.{js,jsx,ts,tsx}\" [-oc] -c i18next-parser.config.js", "ts-node": "ts-node -O '{\"module\":\"commonjs\"}' -I '/node_modules/(?!(@openshift-console)/)/'" }, - "dependencies": { - "@openshift-console/dynamic-plugin-sdk": "file:../packages/console-dynamic-plugin-sdk/dist" - }, "devDependencies": { + "@openshift-console/dynamic-plugin-sdk": "file:../packages/console-dynamic-plugin-sdk/dist/core", + "@openshift-console/dynamic-plugin-sdk-webpack": "file:../packages/console-dynamic-plugin-sdk/dist/webpack", "@types/react": "16.8.13", "copy-webpack-plugin": "^6.4.1", "http-server": "0.12.x", diff --git a/frontend/dynamic-demo-plugin/webpack.config.ts b/frontend/dynamic-demo-plugin/webpack.config.ts index 5c336382070..9bcb3091393 100644 --- a/frontend/dynamic-demo-plugin/webpack.config.ts +++ b/frontend/dynamic-demo-plugin/webpack.config.ts @@ -2,7 +2,7 @@ import * as webpack from 'webpack'; import * as path from 'path'; -import { ConsoleRemotePlugin } from '@openshift-console/dynamic-plugin-sdk/lib/index-webpack'; +import { ConsoleRemotePlugin } from '@openshift-console/dynamic-plugin-sdk-webpack'; const CopyWebpackPlugin = require('copy-webpack-plugin'); diff --git a/frontend/dynamic-demo-plugin/yarn.lock b/frontend/dynamic-demo-plugin/yarn.lock index 73cea948c45..31de698ae33 100644 --- a/frontend/dynamic-demo-plugin/yarn.lock +++ b/frontend/dynamic-demo-plugin/yarn.lock @@ -2,6 +2,34 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb" + integrity sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw== + dependencies: + "@babel/highlight" "^7.14.5" + +"@babel/helper-validator-identifier@^7.14.5": + version "7.15.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" + integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== + +"@babel/highlight@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" + integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== + dependencies: + "@babel/helper-validator-identifier" "^7.14.5" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.14.5": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a" + integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/runtime@^7.12.0": version "7.15.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.3.tgz#2e1c2880ca118e5b2f9988322bd8a7656a32502b" @@ -56,8 +84,26 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@openshift-console/dynamic-plugin-sdk@file:../packages/console-dynamic-plugin-sdk/dist": +"@openshift-console/dynamic-plugin-sdk-webpack@file:../packages/console-dynamic-plugin-sdk/dist/webpack": + version "0.0.0-fixed" + dependencies: + ajv "^6.12.3" + chalk "2.4.x" + comment-json "4.x" + find-up "4.x" + lodash "^4.17.21" + read-pkg "5.x" + semver "6.x" + webpack "5.0.0-beta.16" + +"@openshift-console/dynamic-plugin-sdk@file:../packages/console-dynamic-plugin-sdk/dist/core": version "0.0.0-fixed" + dependencies: + react "^17.0.1" + react-helmet "^6.1.0" + react-i18next "^11.7.3" + react-router "5.2.0" + react-router-dom "5.2.0" "@types/json-schema@^7.0.4": version "7.0.5" @@ -74,6 +120,11 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== +"@types/normalize-package-data@^2.4.0": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" + integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== + "@types/prop-types@*": version "15.7.3" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" @@ -292,7 +343,7 @@ ajv@^6.12.2: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^6.12.5: +ajv@^6.12.3, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -331,6 +382,11 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-timsort@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-timsort/-/array-timsort-1.0.3.tgz#3c9e4199e54fb2b9c3fe5976396a21614ef0d926" + integrity sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -486,7 +542,7 @@ call-bind@^1.0.0: function-bind "^1.1.1" get-intrinsic "^1.0.2" -chalk@^2.3.0: +chalk@2.4.x, chalk@^2.0.0, chalk@^2.3.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -611,6 +667,17 @@ commander@~7.2.0: resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== +comment-json@4.x: + version "4.1.1" + resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.1.1.tgz#49df4948704bebb1cc0ffa6910e25669b668b7c5" + integrity sha512-v8gmtPvxhBlhdRBLwdHSjGy9BgA23t9H1FctdQKyUrErPjSrJcdDMqBq9B4Irtm7w3TNYLQJNH6ARKnpyag1sA== + dependencies: + array-timsort "^1.0.3" + core-util-is "^1.0.2" + esprima "^4.0.1" + has-own-prop "^2.0.0" + repeat-string "^1.6.1" + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -667,6 +734,11 @@ copy-webpack-plugin@^6.4.1: serialize-javascript "^5.0.1" webpack-sources "^1.4.3" +core-util-is@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -858,6 +930,13 @@ errno@^0.1.3: dependencies: prr "~1.0.1" +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -871,6 +950,11 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" +esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" @@ -967,7 +1051,7 @@ find-cache-dir@^3.3.1: make-dir "^3.0.2" pkg-dir "^4.1.0" -find-up@^4.0.0: +find-up@4.x, find-up@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -1177,6 +1261,11 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-own-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" + integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== + has-symbols@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" @@ -1209,6 +1298,37 @@ heimdalljs@^0.2.6: dependencies: rsvp "~3.2.1" +history@^4.9.0: + version "4.10.1" + resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" + integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== + dependencies: + "@babel/runtime" "^7.1.2" + loose-envify "^1.2.0" + resolve-pathname "^3.0.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + value-equal "^1.0.1" + +hoist-non-react-statics@^3.1.0: + version "3.3.2" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" + integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== + dependencies: + react-is "^16.7.0" + +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + +html-parse-stringify@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz#dfc1017347ce9f77c8141a507f233040c59c55d2" + integrity sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg== + dependencies: + void-elements "3.1.0" + htmlparser2@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" @@ -1337,6 +1457,11 @@ is-absolute@^1.0.0: is-relative "^1.0.0" is-windows "^1.0.1" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -1419,6 +1544,11 @@ is-windows@^1.0.1: resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -1442,6 +1572,11 @@ jest-worker@^25.4.0: merge-stream "^2.0.0" supports-color "^7.0.0" +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -1454,6 +1589,11 @@ json-parse-better-errors@^1.0.2: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -1513,6 +1653,11 @@ lead@^1.0.0: dependencies: flush-write-stream "^1.0.2" +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + loader-runner@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-3.1.0.tgz#e9440e5875f2ad2f968489cd2c7b59a4f2847fcb" @@ -1548,6 +1693,18 @@ lodash@^4.17.14: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -1638,6 +1795,14 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mini-create-react-context@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e" + integrity sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ== + dependencies: + "@babel/runtime" "^7.12.1" + tiny-warning "^1.0.3" + minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -1730,6 +1895,16 @@ neo-async@^2.6.1: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -1763,7 +1938,7 @@ nth-check@^2.0.0: dependencies: boolbase "^1.0.0" -object-assign@^4.1.0: +object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -1849,6 +2024,16 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +parse-json@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + parse5-htmlparser2-tree-adapter@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" @@ -1891,6 +2076,13 @@ path-posix@^1.0.0: resolved "https://registry.yarnpkg.com/path-posix/-/path-posix-1.0.0.tgz#06b26113f56beab042545a23bfa88003ccac260f" integrity sha1-BrJhE/Vr6rBCVFojv6iAA8ysJg8= +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -1937,6 +2129,15 @@ promise-map-series@^0.3.0: resolved "https://registry.yarnpkg.com/promise-map-series/-/promise-map-series-0.3.0.tgz#41873ca3652bb7a042b387d538552da9b576f8a1" integrity sha512-3npG2NGhTc8BWBolLLf8l/92OxMGaRLbqvIh9wjCHhDXNvk4zsxaTaCpiCunW09qWPrN2zeNSNwRLVBrQQtutA== +prop-types@^15.6.2, prop-types@^15.7.2: + version "15.7.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" + integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.8.1" + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -1990,6 +2191,86 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +react-fast-compare@^3.1.1: + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" + integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== + +react-helmet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726" + integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw== + dependencies: + object-assign "^4.1.1" + prop-types "^15.7.2" + react-fast-compare "^3.1.1" + react-side-effect "^2.1.0" + +react-i18next@^11.7.3: + version "11.12.0" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.12.0.tgz#2a053321b9b7a876d5baa7af55a12d986117bffc" + integrity sha512-M9BT+hqVG03ywrl+L7CK74ugK+4jIo7AeKJ17+g9BoqJz2+/aVbs8SIVXT4KMQ1rjIdcw+GcSRDy1CXjcz6tLQ== + dependencies: + "@babel/runtime" "^7.14.5" + html-parse-stringify "^3.0.1" + +react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +react-router-dom@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662" + integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA== + dependencies: + "@babel/runtime" "^7.1.2" + history "^4.9.0" + loose-envify "^1.3.1" + prop-types "^15.6.2" + react-router "5.2.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + +react-router@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293" + integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw== + dependencies: + "@babel/runtime" "^7.1.2" + history "^4.9.0" + hoist-non-react-statics "^3.1.0" + loose-envify "^1.3.1" + mini-create-react-context "^0.4.0" + path-to-regexp "^1.7.0" + prop-types "^15.6.2" + react-is "^16.6.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + +react-side-effect@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.1.tgz#66c5701c3e7560ab4822a4ee2742dee215d72eb3" + integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ== + +react@^17.0.1: + version "17.0.2" + resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" + integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + +read-pkg@5.x: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.5, readable-stream@^2.1.5, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" @@ -2046,6 +2327,11 @@ remove-trailing-separator@^1.0.1: resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + replace-ext@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.1.tgz#2d6d996d04a15855d967443631dd5f77825b016a" @@ -2075,7 +2361,12 @@ resolve-options@^1.1.0: dependencies: value-or-function "^3.0.0" -resolve@^1.9.0: +resolve-pathname@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" + integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== + +resolve@^1.10.0, resolve@^1.9.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -2159,7 +2450,12 @@ secure-compare@3.0.1: resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" integrity sha1-8aAymzCLIh+uN7mXTz1XjQypmeM= -semver@^6.0.0: +"semver@2 || 3 || 4 || 5": + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@6.x, semver@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -2232,6 +2528,32 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.10" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz#0d9becccde7003d6c658d487dd48a32f0bf3014b" + integrity sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA== + sprintf-js@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673" @@ -2369,6 +2691,16 @@ through2@~4.0.2: dependencies: readable-stream "3" +tiny-invariant@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875" + integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw== + +tiny-warning@^1.0.0, tiny-warning@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + to-absolute-glob@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1865f43d9e74b0822db9f145b78cff7d0f7c849b" @@ -2426,6 +2758,11 @@ tslib@^2.2.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e" integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg== +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -2515,6 +2852,19 @@ v8-compile-cache@^2.2.0: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +value-equal@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" + integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== + value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" @@ -2568,6 +2918,11 @@ vinyl@^2.0.0, vinyl@~2.2.1: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" +void-elements@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09" + integrity sha1-YU9/v42AHwu18GYfWy9XhXUOTwk= + vue-template-compiler@^2.6.11: version "2.6.14" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.14.tgz#a2f0e7d985670d42c9c9ee0d044fed7690f4f763" diff --git a/frontend/packages/console-dynamic-plugin-sdk/.gitignore b/frontend/packages/console-dynamic-plugin-sdk/.gitignore index c4d83b97fd4..e324eac91fc 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/.gitignore +++ b/frontend/packages/console-dynamic-plugin-sdk/.gitignore @@ -1 +1 @@ -/schema +/generated diff --git a/frontend/packages/console-dynamic-plugin-sdk/README.md b/frontend/packages/console-dynamic-plugin-sdk/README.md index c317793509e..a107cb2e590 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/README.md +++ b/frontend/packages/console-dynamic-plugin-sdk/README.md @@ -24,13 +24,21 @@ dynamic-demo-plugin/ └── webpack.config.ts ``` +## SDK packages + +| Package Name | Description | +| --- | --- | +| `@openshift-console/dynamic-plugin-sdk` | Provides the plugin API, types and utilities used by dynamic plugins at runtime. | +| `@openshift-console/dynamic-plugin-sdk-webpack` | Provides webpack plugin `ConsoleRemotePlugin` used to build all dynamic plugin assets. | +| `@openshift-console/dynamic-plugin-sdk-internal` | Internal package exposing additional code. | + ## `package.json` Plugin metadata is declared via the `consolePlugin` object. ```jsonc { - "name": "@console/dynamic-demo-plugin", + "name": "dynamic-demo-plugin", "version": "0.0.0", "private": true, // scripts, dependencies, devDependencies, ... @@ -59,8 +67,7 @@ Dynamic plugins can expose modules representing additional code to be referenced at runtime. A separate [webpack chunk](https://webpack.js.org/guides/code-splitting/) is generated for each exposed module. Exposed modules are resolved relative to plugin's webpack `context` option. -See [`ConsolePluginMetadata` type](/frontend/packages/console-dynamic-plugin-sdk/src/schema/plugin-package.ts) -for details on the `consolePlugin` object and its schema. +See `ConsolePluginMetadata` type for details on the `consolePlugin` object and its schema. ## `console-extensions.json` @@ -105,10 +112,9 @@ support for module federation. All dynamic plugin assets are managed via webpack plugin `ConsoleRemotePlugin`. ```ts -import * as webpack from 'webpack'; -import { ConsoleRemotePlugin } from '@console/dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin'; +const { ConsoleRemotePlugin } = require('@openshift-console/dynamic-plugin-sdk-webpack'); -const config: webpack.Configuration = { +const config = { // 'entry' is optional, but unrelated to plugin assets plugins: [new ConsoleRemotePlugin()], // ... rest of webpack configuration @@ -180,3 +186,17 @@ list of plugin names (disable specific plugins) or an empty string (disable all be enabled or disabled separately. - Failure to resolve a code reference (unable to load module, missing module export etc.) will disable the plugin. + +## Publishing SDK packages + +To see the latest published version: + +```sh +yarn info @openshift-console/dynamic-plugin-sdk dist-tags +``` + +To build and publish all distributable [SDK packages](#sdk-packages) to [npm registry](https://www.npmjs.com/): + +```sh +PKG_VERSION='' ./publish.sh +``` diff --git a/frontend/packages/console-dynamic-plugin-sdk/package.json b/frontend/packages/console-dynamic-plugin-sdk/package.json index e4bc89816f1..f3406e1476f 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/package.json +++ b/frontend/packages/console-dynamic-plugin-sdk/package.json @@ -5,15 +5,15 @@ "private": true, "main": "src/index.ts", "scripts": { - "clean": "rm -rf ./dist", - "build": "yarn clean && yarn validate && yarn generate && yarn tsc", + "clean": "rm -rf dist generated", + "build": "yarn clean && yarn validate && yarn compile && yarn generate", + "compile": "for ext in '' '-internal' '-webpack' ; do yarn tsc -p tsconfig${ext}.json ; done", "generate": "yarn generate-schema && yarn generate-doc && yarn generate-pkg-assets", - "generate-schema": "yarn ts-node ./scripts/generate-schema.ts", - "generate-doc": "yarn ts-node ./scripts/generate-doc.ts", - "generate-pkg-assets": "yarn ts-node ./scripts/generate-pkg-assets.ts", - "validate": "yarn ts-node ./scripts/validate-extensions.ts", - "ts-node": "ts-node -O '{\"module\":\"commonjs\"}'", - "publish": "yarn build && yarn publish dist --no-git-tag-version" + "generate-schema": "yarn ts-node scripts/generate-schema.ts", + "generate-doc": "yarn ts-node scripts/generate-doc.ts", + "generate-pkg-assets": "yarn ts-node scripts/generate-pkg-assets.ts", + "validate": "yarn ts-node scripts/validate-extensions.ts", + "ts-node": "ts-node -O '{\"module\":\"commonjs\"}'" }, "devDependencies": { "@types/ejs": "3.x", diff --git a/frontend/packages/console-dynamic-plugin-sdk/publish.sh b/frontend/packages/console-dynamic-plugin-sdk/publish.sh new file mode 100755 index 00000000000..e5a080c81b7 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/publish.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -exuo pipefail + +yarn build + +for pkgDir in 'dist/core' 'dist/internal' 'dist/webpack' +do + yarn publish "$pkgDir" --no-git-tag-version --new-version "$PKG_VERSION" +done diff --git a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-doc.ts b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-doc.ts index e5e5f0075f2..510e593a733 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-doc.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-doc.ts @@ -17,7 +17,7 @@ const renderTemplate = (srcFile: string, data: {}) => { root: resolvePath('.'), }); - const outPath = resolvePath(`dist/doc/${path.parse(srcFile).name}`); + const outPath = resolvePath(`generated/doc/${path.parse(srcFile).name}`); fs.mkdirSync(path.dirname(outPath), { recursive: true }); fs.writeFileSync(outPath, content); diff --git a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-pkg-assets.ts b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-pkg-assets.ts index 79339622106..195335a6bfe 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-pkg-assets.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-pkg-assets.ts @@ -2,32 +2,42 @@ import chalk from 'chalk'; import * as fs from 'fs-extra'; import * as _ from 'lodash'; import * as readPkg from 'read-pkg'; +import { getCorePackage, getInternalPackage, getWebpackPackage } from './package-definitions'; import { resolvePath, relativePath } from './utils/path'; -const createPackageJson = (packagePath: string) => { - const packageJson = readPkg.sync({ normalize: false }); - packageJson.name = '@openshift-console/dynamic-plugin-sdk'; - delete packageJson.private; - packageJson.license = 'Apache-2.0'; - packageJson.main = 'lib/index-lib.js'; - packageJson.readme = 'README.md'; - packageJson.peerDependencies = _.pick(packageJson.devDependencies, 'webpack'); - delete packageJson.dependencies; - delete packageJson.devDependencies; - delete packageJson.scripts; - fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2)); +const writePackageManifest = (manifest: readPkg.PackageJson, outDir: string) => { + const outPath = resolvePath(`${outDir}/package.json`); + fs.writeFileSync(outPath, JSON.stringify(manifest, null, 2)); + console.log(chalk.green(relativePath(outPath))); }; -const preparePkgAssets = () => { - fs.mkdirSync(resolvePath('dist'), { recursive: true }); - const pkgOutPath = resolvePath('dist/package.json'); - console.log('Generating Console plugin package.json'); - createPackageJson(pkgOutPath); - console.log(chalk.green(relativePath(pkgOutPath))); - console.log('Copying schema, license, and readme files'); - fs.copySync(resolvePath('../../../LICENSE'), resolvePath('dist/LICENSE')); - fs.copySync(resolvePath('README.md'), resolvePath('dist/README.md')); - fs.copySync(resolvePath('schema'), resolvePath('dist/schema'), { recursive: true }); +const copyFiles = (files: Record) => { + Object.entries(files).forEach(([src, dest]) => { + fs.copySync(resolvePath(src), resolvePath(dest), { recursive: true }); + console.log(chalk.green(relativePath(dest))); + }); }; -preparePkgAssets(); +const sdkPackage = readPkg.sync({ normalize: false }); +const rootPackage = readPkg.sync({ cwd: resolvePath('../..'), normalize: false }); + +const missingDepNames = new Set(); +const missingDepCallback = (name: string) => missingDepNames.add(name); + +const outPackages = [ + getCorePackage(sdkPackage, rootPackage, missingDepCallback), + getInternalPackage(sdkPackage, rootPackage, missingDepCallback), + getWebpackPackage(sdkPackage, rootPackage, missingDepCallback), +]; + +if (missingDepNames.size > 0) { + console.error(`Failed to parse package dependencies: ${Array.from(missingDepNames).join(', ')}`); + process.exit(1); +} + +outPackages.forEach((pkg) => { + console.log(`Generating assets for package ${chalk.bold(pkg.manifest.name)}`); + + writePackageManifest(pkg.manifest, pkg.outDir); + copyFiles(_.mapValues(pkg.filesToCopy, (dest) => `${pkg.outDir}/${dest}`)); +}); diff --git a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-schema.ts b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-schema.ts index 0043058f122..d3c1aada103 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-schema.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/scripts/generate-schema.ts @@ -68,7 +68,7 @@ console.log('Generating Console plugin JSON schemas'); typeConfigs.forEach((tc) => { const schema = generateSchema(tc); const schemaString = JSON.stringify(schema, null, 2); - const outPath = resolvePath(`schema/${path.parse(tc.srcFile).name}`); + const outPath = resolvePath(`generated/schema/${path.parse(tc.srcFile).name}`); fs.mkdirSync(path.dirname(outPath), { recursive: true }); fs.writeFileSync(`${outPath}.json`, schemaString); diff --git a/frontend/packages/console-dynamic-plugin-sdk/scripts/package-definitions.ts b/frontend/packages/console-dynamic-plugin-sdk/scripts/package-definitions.ts new file mode 100644 index 00000000000..b5f26c7ff46 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/scripts/package-definitions.ts @@ -0,0 +1,114 @@ +import * as _ from 'lodash'; +import * as readPkg from 'read-pkg'; +import { getSharedPluginModules } from '../src/shared-modules'; + +type GeneratedPackage = { + /** Package output directory. */ + outDir: string; + /** Package manifest. Note: `version` is updated via the publish script. */ + manifest: readPkg.PackageJson; + /** Additional files to copy to the package output directory. */ + filesToCopy: Record; +}; + +type MissingDependencyCallback = (name: string) => void; + +type GetPackageDefinition = ( + sdkPackage: readPkg.PackageJson, + rootPackage: readPkg.PackageJson, + missingDepCallback: MissingDependencyCallback, +) => GeneratedPackage; + +const commonManifestFields: Partial = { + license: 'Apache-2.0', + homepage: + 'https://github.com/openshift/console/tree/master/frontend/packages/console-dynamic-plugin-sdk', +}; + +const commonFiles: GeneratedPackage['filesToCopy'] = { + '../../../LICENSE': 'LICENSE', +}; + +const parseDeps = ( + pkg: readPkg.PackageJson, + depNames: string[], + missingDepCallback: MissingDependencyCallback, +) => { + const srcDeps = { ...pkg.devDependencies, ...pkg.dependencies }; + depNames.filter((name) => !srcDeps[name]).forEach(missingDepCallback); + return _.pick(srcDeps, depNames); +}; + +const parseDepsAs = ( + pkg: readPkg.PackageJson, + deps: { [depName: string]: string }, + missingDepCallback: MissingDependencyCallback, +) => _.mapKeys(parseDeps(pkg, Object.keys(deps), missingDepCallback), (value, key) => deps[key]); + +export const getCorePackage: GetPackageDefinition = ( + sdkPackage, + rootPackage, + missingDepCallback, +) => ({ + outDir: 'dist/core', + manifest: { + name: '@openshift-console/dynamic-plugin-sdk', + version: sdkPackage.version, + type: 'module', + main: 'lib/lib-core.js', + ...commonManifestFields, + dependencies: parseDeps(rootPackage, getSharedPluginModules(false), missingDepCallback), + }, + filesToCopy: { + ...commonFiles, + 'README.md': 'README.md', + 'generated/doc': 'doc', + }, +}); + +export const getInternalPackage: GetPackageDefinition = ( + sdkPackage, + rootPackage, + missingDepCallback, +) => ({ + outDir: 'dist/internal', + manifest: { + name: '@openshift-console/dynamic-plugin-sdk-internal', + version: sdkPackage.version, + type: 'module', + main: 'lib/lib-internal.js', + ...commonManifestFields, + dependencies: getCorePackage(sdkPackage, rootPackage, missingDepCallback).manifest.dependencies, + }, + filesToCopy: { + ...commonFiles, + }, +}); + +export const getWebpackPackage: GetPackageDefinition = ( + sdkPackage, + rootPackage, + missingDepCallback, +) => ({ + outDir: 'dist/webpack', + manifest: { + name: '@openshift-console/dynamic-plugin-sdk-webpack', + version: sdkPackage.version, + type: 'commonjs', + main: 'lib/lib-webpack.js', + ...commonManifestFields, + dependencies: { + ...parseDeps(sdkPackage, ['webpack'], missingDepCallback), + ...parseDeps( + rootPackage, + ['ajv', 'chalk', 'comment-json', 'find-up', 'read-pkg', 'semver'], + missingDepCallback, + ), + ...parseDepsAs(rootPackage, { 'lodash-es': 'lodash' }, missingDepCallback), + }, + }, + filesToCopy: { + ...commonFiles, + 'generated/schema': 'schema', + }, +}); diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/index-lib.ts b/frontend/packages/console-dynamic-plugin-sdk/src/lib-core.ts similarity index 100% rename from frontend/packages/console-dynamic-plugin-sdk/src/index-lib.ts rename to frontend/packages/console-dynamic-plugin-sdk/src/lib-core.ts diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/lib-internal.ts b/frontend/packages/console-dynamic-plugin-sdk/src/lib-internal.ts new file mode 100644 index 00000000000..e96718e3f83 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/src/lib-internal.ts @@ -0,0 +1 @@ +export * from './api/internal-api'; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/index-webpack.ts b/frontend/packages/console-dynamic-plugin-sdk/src/lib-webpack.ts similarity index 100% rename from frontend/packages/console-dynamic-plugin-sdk/src/index-webpack.ts rename to frontend/packages/console-dynamic-plugin-sdk/src/lib-webpack.ts diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-loader.ts b/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-loader.ts index 092d1034cad..85f9593f301 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-loader.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-loader.ts @@ -5,7 +5,7 @@ import { PluginStore } from '@console/plugin-sdk/src/store'; import { resolveEncodedCodeRefs } from '../coderefs/coderef-resolver'; import { remoteEntryFile } from '../constants'; import { ConsolePluginManifestJSON } from '../schema/plugin-manifest'; -import { overrideSharedModules } from '../shared-modules'; +import { overrideSharedModules } from '../shared-modules-override'; import { RemoteEntryModule } from '../types'; import { resolveURL } from '../utils/url'; import { fetchPluginManifest } from './plugin-manifest'; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-manifest.ts b/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-manifest.ts index 99e0b057a98..ee4858b4958 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-manifest.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/runtime/plugin-manifest.ts @@ -8,7 +8,7 @@ export const validatePluginManifestSchema = async ( manifest: ConsolePluginManifestJSON, manifestURL: string, ) => { - const schema = (await import('../../schema/plugin-manifest')).default; + const schema = (await import('../../generated/schema/plugin-manifest')).default; // Use dynamic import to avoid pulling ajv dependency tree into main vendors chunk const SchemaValidator = await import( diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules-override.ts b/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules-override.ts new file mode 100644 index 00000000000..77566ff65e3 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules-override.ts @@ -0,0 +1,24 @@ +/* eslint-disable global-require */ +/* eslint-disable @typescript-eslint/no-require-imports */ + +import { RemoteEntryModule } from './types'; + +/** + * At runtime, Console will override (i.e. enforce Console-bundled implementation of) shared + * modules for each dynamic plugin, before loading any of the modules exposed by that plugin. + * + * This way, a single version of React etc. is used by Console application and its plugins. + */ +export const overrideSharedModules = (entryModule: RemoteEntryModule) => { + entryModule.override({ + '@openshift-console/dynamic-plugin-sdk': async () => () => + require('@console/dynamic-plugin-sdk/src/lib-core'), + '@openshift-console/dynamic-plugin-sdk-internal': async () => () => + require('@console/dynamic-plugin-sdk/src/lib-internal'), + react: async () => () => require('react'), + 'react-helmet': async () => () => require('react-helmet'), + 'react-i18next': async () => () => require('react-i18next'), + 'react-router': async () => () => require('react-router'), + 'react-router-dom': async () => () => require('react-router-dom'), + }); +}; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules.ts b/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules.ts index fa8f5703c42..652900a61ad 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/shared-modules.ts @@ -1,36 +1,15 @@ -/* eslint-disable global-require */ -/* eslint-disable @typescript-eslint/no-require-imports */ -import { RemoteEntryModule } from './types'; - /** - * Vendor modules shared between Console application and its dynamic plugins. + * Dynamic plugin SDK modules provided by Console application at runtime. */ -export const sharedVendorModules = [ +const pluginSDKModules = [ '@openshift-console/dynamic-plugin-sdk', - '@openshift-console/dynamic-plugin-sdk/lib/api/internal-api', - 'react', - 'react-helmet', - 'react-i18next', - 'react-router', - 'react-router-dom', + '@openshift-console/dynamic-plugin-sdk-internal', ]; /** - * At runtime, Console will override (i.e. enforce Console-bundled implementation of) shared - * modules for each dynamic plugin, before loading any of the modules exposed by that plugin. - * - * This way, a single version of React etc. is used by the Console application. + * Get modules shared between Console application and its dynamic plugins. */ -export const overrideSharedModules = (entryModule: RemoteEntryModule) => { - entryModule.override({ - '@openshift-console/dynamic-plugin-sdk': async () => () => - require('@console/dynamic-plugin-sdk/src/index-lib'), - '@openshift-console/dynamic-plugin-sdk/lib/api/internal-api': async () => () => - require('@console/dynamic-plugin-sdk/src/api/internal-api'), - react: async () => () => require('react'), - 'react-helmet': async () => () => require('react-helmet'), - 'react-i18next': async () => () => require('react-i18next'), - 'react-router': async () => () => require('react-router'), - 'react-router-dom': async () => () => require('react-router-dom'), - }); -}; +export const getSharedPluginModules = (includePluginSDK = true) => + ['react', 'react-helmet', 'react-i18next', 'react-router-dom', 'react-router'].concat( + includePluginSDK ? pluginSDKModules : [], + ); diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleAssetPlugin.ts b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleAssetPlugin.ts index de95bfb7b82..ca1ab480eda 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleAssetPlugin.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleAssetPlugin.ts @@ -1,4 +1,6 @@ +import * as fs from 'fs'; import * as path from 'path'; +import * as findUp from 'find-up'; import * as webpack from 'webpack'; import { extensionsFile, pluginManifestFile } from '../constants'; import { ConsoleExtensionsJSON } from '../schema/console-extensions'; @@ -8,11 +10,22 @@ import { parseJSONC } from '../utils/jsonc'; import { ExtensionValidator } from '../validation/ExtensionValidator'; import { SchemaValidator } from '../validation/SchemaValidator'; +export const loadSchema = (relativePath: string) => { + const pkgDir = path.dirname(findUp.sync('package.json', { cwd: __dirname })); + + const schemaPath = [ + path.resolve(pkgDir, 'schema'), + path.resolve(pkgDir, 'generated/schema'), + ].find((p) => fs.existsSync(p) && fs.statSync(p).isDirectory()); + + return require(path.resolve(schemaPath, relativePath)).default; +}; + export const validateExtensionsFileSchema = ( ext: ConsoleExtensionsJSON, description = extensionsFile, ) => { - const schema = require('../../schema/console-extensions').default; + const schema = loadSchema('console-extensions'); return new SchemaValidator(description).validate(schema, ext); }; diff --git a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts index 458f01ce197..aa8d7d2e97d 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts +++ b/frontend/packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts @@ -4,15 +4,15 @@ import * as webpack from 'webpack'; import { ReplaceSource } from 'webpack-sources'; import { remoteEntryFile } from '../constants'; import { ConsolePackageJSON } from '../schema/plugin-package'; -import { sharedVendorModules } from '../shared-modules'; +import { getSharedPluginModules } from '../shared-modules'; import { SchemaValidator } from '../validation/SchemaValidator'; -import { ConsoleAssetPlugin } from './ConsoleAssetPlugin'; +import { loadSchema, ConsoleAssetPlugin } from './ConsoleAssetPlugin'; export const validatePackageFileSchema = ( pkg: ConsolePackageJSON, description = 'package.json', ) => { - const schema = require('../../schema/plugin-package').default; + const schema = loadSchema('plugin-package'); const validator = new SchemaValidator(description); if (pkg.consolePlugin) { @@ -59,14 +59,14 @@ export class ConsoleRemotePlugin { library: { type: remoteEntryLibraryType, name: remoteEntryCallback }, filename: remoteEntryFile, exposes: this.pkg.consolePlugin.exposedModules || {}, - overridables: sharedVendorModules, + overridables: getSharedPluginModules(false), }).apply(compiler); new ConsoleAssetPlugin(this.pkg).apply(compiler); // Ignore require calls for modules that reside in Console monorepo packages new webpack.IgnorePlugin({ resourceRegExp: /^@console\//, - contextRegExp: /node_modules\/@openshift-console\/dynamic-plugin-sdk\//, + contextRegExp: /node_modules\/@openshift-console\/dynamic-plugin-sdk/, }).apply(compiler); }); diff --git a/frontend/packages/console-dynamic-plugin-sdk/tsconfig-base.json b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-base.json new file mode 100644 index 00000000000..3991babcc1a --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-base.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "es2016", + "moduleResolution": "node", + "noEmitOnError": true, + "declaration": true, + "experimentalDecorators": true, + "sourceMap": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "lib": ["es2016", "es2020.promise", "dom"] + } +} diff --git a/frontend/packages/console-dynamic-plugin-sdk/tsconfig-internal.json b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-internal.json new file mode 100644 index 00000000000..fce9cff9b1e --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-internal.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/internal/lib" + }, + "files": ["src/lib-internal.ts"] +} diff --git a/frontend/packages/console-dynamic-plugin-sdk/tsconfig-webpack.json b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-webpack.json new file mode 100644 index 00000000000..525ec0a6277 --- /dev/null +++ b/frontend/packages/console-dynamic-plugin-sdk/tsconfig-webpack.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist/webpack/lib" + }, + "files": ["src/lib-webpack.ts"] +} diff --git a/frontend/packages/console-dynamic-plugin-sdk/tsconfig.json b/frontend/packages/console-dynamic-plugin-sdk/tsconfig.json index 07622bc86b8..9eba17af903 100644 --- a/frontend/packages/console-dynamic-plugin-sdk/tsconfig.json +++ b/frontend/packages/console-dynamic-plugin-sdk/tsconfig.json @@ -1,15 +1,8 @@ { + "extends": "./tsconfig-base.json", "compilerOptions": { "module": "esnext", - "moduleResolution": "node", - "target": "es2016", - "declaration": true, - "outDir": "dist/lib", - "experimentalDecorators": true, - "sourceMap": true, - "noUnusedLocals": true, - "skipLibCheck": true, - "lib": ["es2016", "es2020.promise", "dom"] + "outDir": "dist/core/lib" }, - "files": ["src/index-webpack.ts", "src/index-lib.ts", "src/api/internal-api.ts"] + "files": ["src/lib-core.ts"] } diff --git a/frontend/webpack.config.ts b/frontend/webpack.config.ts index 585f4d9cf2a..63276d45566 100644 --- a/frontend/webpack.config.ts +++ b/frontend/webpack.config.ts @@ -8,7 +8,7 @@ import * as VirtualModulesPlugin from 'webpack-virtual-modules'; import * as ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server'; -import { sharedVendorModules } from '@console/dynamic-plugin-sdk/src/shared-modules'; +import { getSharedPluginModules } from '@console/dynamic-plugin-sdk/src/shared-modules'; import { resolvePluginPackages } from '@console/plugin-sdk/src/codegen/plugin-resolver'; import { ConsoleActivePluginsModule } from '@console/plugin-sdk/src/webpack/ConsoleActivePluginsModule'; import { CircularDependencyPreset } from './webpack.circular-deps'; @@ -33,7 +33,7 @@ const WDS_PORT = 8080; const extractCSS = new MiniCssExtractPlugin({ filename: 'app-bundle.[contenthash].css' }); const virtualModules = new VirtualModulesPlugin(); const overpassTest = /overpass-.*\.(woff2?|ttf|eot|otf)(\?.*$|$)/; -const sharedVendorTest = new RegExp(`node_modules\\/(${sharedVendorModules.join('|')})\\/`); +const sharedPluginTest = new RegExp(`node_modules\\/(${getSharedPluginModules().join('|')})\\/`); const config: Configuration = { entry: [ @@ -70,7 +70,7 @@ const config: Configuration = { rules: [ { // Disable tree shaking on modules shared with Console dynamic plugins - test: sharedVendorTest, + test: sharedPluginTest, sideEffects: true, }, { test: /\.glsl$/, loader: 'raw!glslify' },