@warp-drive-mirror/build-config 0.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +9 -0
  3. package/NCC-1701-a-blue.svg +4 -0
  4. package/NCC-1701-a.svg +4 -0
  5. package/README.md +101 -0
  6. package/dist/addon-shim.cjs +30 -0
  7. package/dist/addon-shim.cjs.map +1 -0
  8. package/dist/babel-macros.js +46 -0
  9. package/dist/babel-macros.js.map +1 -0
  10. package/dist/babel-plugin-transform-asserts.cjs +99 -0
  11. package/dist/babel-plugin-transform-asserts.cjs.map +1 -0
  12. package/dist/babel-plugin-transform-deprecations.cjs +59 -0
  13. package/dist/babel-plugin-transform-deprecations.cjs.map +1 -0
  14. package/dist/babel-plugin-transform-features.cjs +69 -0
  15. package/dist/babel-plugin-transform-features.cjs.map +1 -0
  16. package/dist/babel-plugin-transform-logging.cjs +60 -0
  17. package/dist/babel-plugin-transform-logging.cjs.map +1 -0
  18. package/dist/canary-features-BzGSGY5j.js +97 -0
  19. package/dist/canary-features-BzGSGY5j.js.map +1 -0
  20. package/dist/canary-features.js +2 -0
  21. package/dist/canary-features.js.map +1 -0
  22. package/dist/debugging-BzogyWJo.js +121 -0
  23. package/dist/debugging-BzogyWJo.js.map +1 -0
  24. package/dist/debugging.js +2 -0
  25. package/dist/debugging.js.map +1 -0
  26. package/dist/deprecations-BXAnWRDO.js +28 -0
  27. package/dist/deprecations-BXAnWRDO.js.map +1 -0
  28. package/dist/deprecations.js +2 -0
  29. package/dist/deprecations.js.map +1 -0
  30. package/dist/env.js +6 -0
  31. package/dist/env.js.map +1 -0
  32. package/dist/index.js +578 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/macros.js +8 -0
  35. package/dist/macros.js.map +1 -0
  36. package/package.json +66 -0
  37. package/unstable-preview-types/-private/utils/deprecations.d.ts +10 -0
  38. package/unstable-preview-types/-private/utils/deprecations.d.ts.map +1 -0
  39. package/unstable-preview-types/-private/utils/features.d.ts +9 -0
  40. package/unstable-preview-types/-private/utils/features.d.ts.map +1 -0
  41. package/unstable-preview-types/-private/utils/get-env.d.ts +8 -0
  42. package/unstable-preview-types/-private/utils/get-env.d.ts.map +1 -0
  43. package/unstable-preview-types/babel-macros.d.ts +24 -0
  44. package/unstable-preview-types/babel-macros.d.ts.map +1 -0
  45. package/unstable-preview-types/canary-features.d.ts +92 -0
  46. package/unstable-preview-types/canary-features.d.ts.map +1 -0
  47. package/unstable-preview-types/debugging.d.ts +108 -0
  48. package/unstable-preview-types/debugging.d.ts.map +1 -0
  49. package/unstable-preview-types/deprecation-versions.d.ts +400 -0
  50. package/unstable-preview-types/deprecation-versions.d.ts.map +1 -0
  51. package/unstable-preview-types/deprecations.d.ts +13 -0
  52. package/unstable-preview-types/deprecations.d.ts.map +1 -0
  53. package/unstable-preview-types/env.d.ts +6 -0
  54. package/unstable-preview-types/env.d.ts.map +1 -0
  55. package/unstable-preview-types/index.d.ts +43 -0
  56. package/unstable-preview-types/index.d.ts.map +1 -0
  57. package/unstable-preview-types/macros.d.ts +5 -0
  58. package/unstable-preview-types/macros.d.ts.map +1 -0
  59. package/unstable-preview-types/validate-exports.type-test.d.ts +4 -0
  60. package/unstable-preview-types/validate-exports.type-test.d.ts.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ # @warp-drive-mirror/build-config Changelog
2
+
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2023 EmberData and WarpDrive contributors
4
+
5
+ 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:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ 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.
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill="#0969da" d="m1096.3 402.82c-53.148-53.008-117.12-79.516-191.93-79.516-67.488 0-126.55 21.938-177.16 65.805-50.617 43.871-80.988 98.285-91.113 163.25l53.57 4.2188c14.625 0.28125 25.449 6.75 32.48 19.406h18.984c11.809 0 17.715 5.7617 17.715 17.293s-5.9062 17.293-17.715 17.293h-17.297c-6.75 14.344-18.137 21.797-34.168 22.359l-53.57 4.6406c10.125 64.68 40.496 118.95 91.113 162.82 50.617 43.871 109.68 65.805 177.16 65.805 74.805 0 138.78-26.574 191.93-79.723 53.152-53.148 79.727-116.98 79.727-191.51 0-75.086-26.574-139.13-79.727-192.14zm-79.422 185.27c0 2.9531 2.3906 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477 0-2.9492-2.3945-5.3438-5.3477-5.3438-2.9531 0-5.3438 2.3945-5.3438 5.3438zm-104.54-111.07c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm117.01 123.55c0 2.9492 2.3906 5.3438 5.3438 5.3438 2.9531 0 5.3477-2.3945 5.3477-5.3438 0-2.9531-2.3945-5.3477-5.3477-5.3477-2.9531 0-5.3438 2.3945-5.3438 5.3477zm-104.54 111.66c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm-848-318.48c14.062-2.5312 30.934-4.5 50.621-5.9062l-46.402-0.84375zm499.86 169.15c-8.7188-2.25-18.141-8.7188-28.266-19.402l-101.23-103.35h-111.36l173.79 126.12v4.2188c21.652 6.1836 44.008 3.6562 67.07-7.5938zm47.664-148.48c-0.84375 3.3711-2.8125 6.6055-5.9062 9.6992h-5.0625l-6.3242-5.0625h-79.305v-4.6367zm-5.9062-16.031c3.0938 3.0938 5.0625 6.4688 5.9062 10.125h-96.598v-4.6406h79.305l6.3242-5.4844zm-541.62 397.78 4.2188 6.7461 46.402-0.84375c-22.5-2.2461-39.371-4.2148-50.621-5.9023zm499.86-169.15c-23.062-11.531-45.418-14.062-67.07-7.5938v4.2188l-173.79 126.12h111.36l101.23-103.77c10.406-10.684 19.828-17.012 28.266-18.98zm47.664 148.48h-96.598v-4.6406h79.305l6.3242-5.4805h5.0625c3.0938 3.6523 5.0625 7.0273 5.9062 10.121zm-5.9062 15.609h-5.0625l-6.3242-5.0625h-79.305v-4.6406h96.598c-0.84375 3.0938-2.8125 6.3281-5.9062 9.7031zm-102.5 9.6992c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c24.746 0 37.121-8.4336 37.121-25.309 0-8.4375-4.6406-14.691-13.922-18.77-9.2773-4.0781-17.012-6.1172-23.199-6.1172h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875h-333.66c-5.0625 0-28.543 1.6172-70.445 4.8516-41.902 3.2344-62.852 7.3828-62.852 12.441v11.812c0 4.5 20.949 8.5078 62.852 12.023 41.902 3.5156 65.383 5.2695 70.445 5.2695zm125.28-207.54h-42.602c-3.375 1.125-3.375 2.25 0 3.375h42.602zm-43.445 8.4375h-5.4844v-13.5h5.4844c17.152-6.1875 33.605-9.9844 49.352-11.391l4.6406-25.309 4.6406 0.42188c0.5625-4.2188 1.6875-10.262 3.375-18.137-28.684-0.5625-64.398 1.6875-107.14 6.75 3.6562 4.2148 7.4531 7.8711 11.391 10.965 4.7812 3.375 9.4219 5.625 13.918 6.75l12.656 2.9531-11.812 5.9062c-13.496 6.75-30.23 10.121-50.195 10.121-5.0625 0-8.5781-0.14062-10.547-0.42188-4.2188-0.5625-7.5898-1.1211-10.121-1.6836l-3.375-1.2656v-5.4844l-24.043-17.297c-41.34 5.625-69.32 8.5781-83.945 8.8594-31.496 0.28125-47.242 11.953-47.242 35.012 0 22.215 15.746 33.887 47.242 35.012 18.844 0.28125 46.824 3.2344 83.945 8.8594l24.043-17.297v-5.4844l3.375-1.2656c2.5312-0.84375 5.9023-1.4062 10.121-1.6875 1.9688-0.28125 5.4844-0.42187 10.547-0.42187 19.965 0 36.699 3.375 50.195 10.125l11.812 5.4844-12.656 3.375c-4.4961 0.84375-9.1367 3.0938-13.918 6.75-3.6562 2.2461-7.4531 5.7617-11.391 10.543 40.777 5.0625 76.492 7.4531 107.14 7.1719-1.6875-7.3125-2.8125-13.359-3.375-18.137h-4.6406l-4.6406-24.891c-17.434-2.25-33.887-6.043-49.352-11.387zm48.508-20.25c-12.652 1.6875-23.762 3.9375-33.324 6.75h29.105l3.7969-4.2188zm-4.2188 20.25h-29.105c9.5625 2.5312 20.672 4.7812 33.324 6.7461l-0.42188-2.5273zm136.67-8.4375c0-8.4375-4.2188-12.656-12.652-12.656h-21.516c-6.4688-12.652-16.59-18.98-30.371-18.98l-58.211-5.0625-5.9062 29.527-4.2188 5.0625v7.5938l4.2188 5.0625 5.9062 29.105 58.211-5.0625c15.469 0 26.012-7.3125 31.637-21.934h20.25c8.4336 0 12.652-4.2188 12.652-12.656zm-46.82 1.6875c0-11.531-5.9062-17.297-17.719-17.297-11.527 0-17.293 5.7656-17.293 17.297 0 11.812 5.7656 17.715 17.293 17.715 11.812 0 17.719-5.9023 17.719-17.715zm4.6406 0c0 14.902-7.4531 22.355-22.359 22.355-14.902 0-22.355-7.4531-22.355-22.355 0-14.906 7.4531-22.355 22.355-22.355 14.906 0 22.359 7.4492 22.359 22.355zm-13.922 0c0-5.625-2.8125-8.4375-8.4375-8.4375-5.3438 0-8.0156 2.8125-8.0156 8.4375s2.6719 8.4375 8.0156 8.4375c5.625 0 8.4375-2.8125 8.4375-8.4375zm4.6406 0c0 8.7188-4.3594 13.078-13.078 13.078-8.4375 0-12.652-4.3594-12.652-13.078s4.2148-13.078 12.652-13.078c8.7188 0 13.078 4.3594 13.078 13.078zm-43.871-2.1094v4.2188h-35.012v-4.2188zm258.58 2.1094c-0.5625-8.4375-4.7812-12.656-12.656-12.656-8.4336 0-12.652 4.2188-12.652 12.656s4.2188 12.656 12.652 12.656c8.4375 0 12.656-4.2188 12.656-12.656zm4.6406 0c0 11.531-5.7656 17.293-17.297 17.293-11.527 0-17.293-5.7617-17.293-17.293s5.7656-17.297 17.293-17.297c11.531 0 17.297 5.7656 17.297 17.297zm32.48 0c0-13.781-4.9219-25.59-14.766-35.434-9.5586-9.5625-21.23-14.344-35.012-14.344-15.184 0-31.777 5.7656-49.773 17.297-18.559 11.531-27.84 22.355-27.84 32.48 0 9.8438 9.2812 20.668 27.84 32.48 17.996 11.531 34.59 17.293 49.773 17.293 13.781 0 25.453-4.918 35.012-14.762 9.8438-9.5625 14.766-21.234 14.766-35.012zm5.0625 0c0 14.902-5.3438 27.699-16.031 38.387-10.684 10.684-23.621 16.027-38.809 16.027-15.746 0-33.18-6.0469-52.305-18.137-20.246-12.656-30.371-24.746-30.371-36.277s10.125-23.762 30.371-36.699c19.125-12.094 36.559-18.137 52.305-18.137 14.625 0 27.562 5.3398 38.809 16.027 10.688 10.969 16.031 23.902 16.031 38.809zm-54.418-29.105c-3.9336 0-10.262 1.6875-18.98 5.0625-7.875 3.9375-11.812 6.4648-11.812 7.5898v32.48c0 3.0938 3.9375 5.625 11.812 7.5938 7.875 3.375 14.203 5.0625 18.98 5.0625 19.406 0 29.391-9.2812 29.953-27.84 0-19.688-9.9844-29.668-29.953-29.949zm34.59 29.105v0.84375c0 21.371-11.527 32.34-34.59 32.902-4.4961 0-11.527-1.8281-21.09-5.4844-7.0312-3.9375-10.969-6.3281-11.809-7.1719-1.6875-1.4062-2.5312-3.0938-2.5312-5.0625v-32.48c0-1.4062 0.70312-2.9492 2.1094-4.6367 3.0898-2.8125 7.168-5.2031 12.23-7.1719 9-3.6562 16.031-5.4844 21.09-5.4844 22.5 0.28125 34.027 11.531 34.59 33.746zm-448.4-206.27h-333.66c-5.0625 0-28.543 1.6875-70.445 5.0625-41.902 3.375-62.852 7.5938-62.852 12.656v11.387c0 4.7812 20.949 8.8594 62.852 12.234 41.902 3.375 65.383 5.0625 70.445 5.0625h333.66c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c5.3438 0 12.867-2.25 22.566-6.75 9.7031-4.5 14.555-10.547 14.555-18.137 0.28125-16.875-12.094-25.312-37.121-25.312h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875z" fill-rule="evenodd"/>
4
+ </svg>
package/NCC-1701-a.svg ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill="#FFFFFF" d="m1096.3 402.82c-53.148-53.008-117.12-79.516-191.93-79.516-67.488 0-126.55 21.938-177.16 65.805-50.617 43.871-80.988 98.285-91.113 163.25l53.57 4.2188c14.625 0.28125 25.449 6.75 32.48 19.406h18.984c11.809 0 17.715 5.7617 17.715 17.293s-5.9062 17.293-17.715 17.293h-17.297c-6.75 14.344-18.137 21.797-34.168 22.359l-53.57 4.6406c10.125 64.68 40.496 118.95 91.113 162.82 50.617 43.871 109.68 65.805 177.16 65.805 74.805 0 138.78-26.574 191.93-79.723 53.152-53.148 79.727-116.98 79.727-191.51 0-75.086-26.574-139.13-79.727-192.14zm-79.422 185.27c0 2.9531 2.3906 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477 0-2.9492-2.3945-5.3438-5.3477-5.3438-2.9531 0-5.3438 2.3945-5.3438 5.3438zm-104.54-111.07c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm117.01 123.55c0 2.9492 2.3906 5.3438 5.3438 5.3438 2.9531 0 5.3477-2.3945 5.3477-5.3438 0-2.9531-2.3945-5.3477-5.3477-5.3477-2.9531 0-5.3438 2.3945-5.3438 5.3477zm-104.54 111.66c0 2.9531 2.3945 5.3477 5.3438 5.3477 2.9531 0 5.3477-2.3945 5.3477-5.3477s-2.3945-5.3438-5.3477-5.3438c-2.9492 0-5.3438 2.3906-5.3438 5.3438zm-12.473 0c0 2.9531 2.3906 5.3477 5.3438 5.3477s5.3477-2.3945 5.3477-5.3477-2.3945-5.3438-5.3477-5.3438-5.3438 2.3906-5.3438 5.3438zm-848-318.48c14.062-2.5312 30.934-4.5 50.621-5.9062l-46.402-0.84375zm499.86 169.15c-8.7188-2.25-18.141-8.7188-28.266-19.402l-101.23-103.35h-111.36l173.79 126.12v4.2188c21.652 6.1836 44.008 3.6562 67.07-7.5938zm47.664-148.48c-0.84375 3.3711-2.8125 6.6055-5.9062 9.6992h-5.0625l-6.3242-5.0625h-79.305v-4.6367zm-5.9062-16.031c3.0938 3.0938 5.0625 6.4688 5.9062 10.125h-96.598v-4.6406h79.305l6.3242-5.4844zm-541.62 397.78 4.2188 6.7461 46.402-0.84375c-22.5-2.2461-39.371-4.2148-50.621-5.9023zm499.86-169.15c-23.062-11.531-45.418-14.062-67.07-7.5938v4.2188l-173.79 126.12h111.36l101.23-103.77c10.406-10.684 19.828-17.012 28.266-18.98zm47.664 148.48h-96.598v-4.6406h79.305l6.3242-5.4805h5.0625c3.0938 3.6523 5.0625 7.0273 5.9062 10.121zm-5.9062 15.609h-5.0625l-6.3242-5.0625h-79.305v-4.6406h96.598c-0.84375 3.0938-2.8125 6.3281-5.9062 9.7031zm-102.5 9.6992c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c24.746 0 37.121-8.4336 37.121-25.309 0-8.4375-4.6406-14.691-13.922-18.77-9.2773-4.0781-17.012-6.1172-23.199-6.1172h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875h-333.66c-5.0625 0-28.543 1.6172-70.445 4.8516-41.902 3.2344-62.852 7.3828-62.852 12.441v11.812c0 4.5 20.949 8.5078 62.852 12.023 41.902 3.5156 65.383 5.2695 70.445 5.2695zm125.28-207.54h-42.602c-3.375 1.125-3.375 2.25 0 3.375h42.602zm-43.445 8.4375h-5.4844v-13.5h5.4844c17.152-6.1875 33.605-9.9844 49.352-11.391l4.6406-25.309 4.6406 0.42188c0.5625-4.2188 1.6875-10.262 3.375-18.137-28.684-0.5625-64.398 1.6875-107.14 6.75 3.6562 4.2148 7.4531 7.8711 11.391 10.965 4.7812 3.375 9.4219 5.625 13.918 6.75l12.656 2.9531-11.812 5.9062c-13.496 6.75-30.23 10.121-50.195 10.121-5.0625 0-8.5781-0.14062-10.547-0.42188-4.2188-0.5625-7.5898-1.1211-10.121-1.6836l-3.375-1.2656v-5.4844l-24.043-17.297c-41.34 5.625-69.32 8.5781-83.945 8.8594-31.496 0.28125-47.242 11.953-47.242 35.012 0 22.215 15.746 33.887 47.242 35.012 18.844 0.28125 46.824 3.2344 83.945 8.8594l24.043-17.297v-5.4844l3.375-1.2656c2.5312-0.84375 5.9023-1.4062 10.121-1.6875 1.9688-0.28125 5.4844-0.42187 10.547-0.42187 19.965 0 36.699 3.375 50.195 10.125l11.812 5.4844-12.656 3.375c-4.4961 0.84375-9.1367 3.0938-13.918 6.75-3.6562 2.2461-7.4531 5.7617-11.391 10.543 40.777 5.0625 76.492 7.4531 107.14 7.1719-1.6875-7.3125-2.8125-13.359-3.375-18.137h-4.6406l-4.6406-24.891c-17.434-2.25-33.887-6.043-49.352-11.387zm48.508-20.25c-12.652 1.6875-23.762 3.9375-33.324 6.75h29.105l3.7969-4.2188zm-4.2188 20.25h-29.105c9.5625 2.5312 20.672 4.7812 33.324 6.7461l-0.42188-2.5273zm136.67-8.4375c0-8.4375-4.2188-12.656-12.652-12.656h-21.516c-6.4688-12.652-16.59-18.98-30.371-18.98l-58.211-5.0625-5.9062 29.527-4.2188 5.0625v7.5938l4.2188 5.0625 5.9062 29.105 58.211-5.0625c15.469 0 26.012-7.3125 31.637-21.934h20.25c8.4336 0 12.652-4.2188 12.652-12.656zm-46.82 1.6875c0-11.531-5.9062-17.297-17.719-17.297-11.527 0-17.293 5.7656-17.293 17.297 0 11.812 5.7656 17.715 17.293 17.715 11.812 0 17.719-5.9023 17.719-17.715zm4.6406 0c0 14.902-7.4531 22.355-22.359 22.355-14.902 0-22.355-7.4531-22.355-22.355 0-14.906 7.4531-22.355 22.355-22.355 14.906 0 22.359 7.4492 22.359 22.355zm-13.922 0c0-5.625-2.8125-8.4375-8.4375-8.4375-5.3438 0-8.0156 2.8125-8.0156 8.4375s2.6719 8.4375 8.0156 8.4375c5.625 0 8.4375-2.8125 8.4375-8.4375zm4.6406 0c0 8.7188-4.3594 13.078-13.078 13.078-8.4375 0-12.652-4.3594-12.652-13.078s4.2148-13.078 12.652-13.078c8.7188 0 13.078 4.3594 13.078 13.078zm-43.871-2.1094v4.2188h-35.012v-4.2188zm258.58 2.1094c-0.5625-8.4375-4.7812-12.656-12.656-12.656-8.4336 0-12.652 4.2188-12.652 12.656s4.2188 12.656 12.652 12.656c8.4375 0 12.656-4.2188 12.656-12.656zm4.6406 0c0 11.531-5.7656 17.293-17.297 17.293-11.527 0-17.293-5.7617-17.293-17.293s5.7656-17.297 17.293-17.297c11.531 0 17.297 5.7656 17.297 17.297zm32.48 0c0-13.781-4.9219-25.59-14.766-35.434-9.5586-9.5625-21.23-14.344-35.012-14.344-15.184 0-31.777 5.7656-49.773 17.297-18.559 11.531-27.84 22.355-27.84 32.48 0 9.8438 9.2812 20.668 27.84 32.48 17.996 11.531 34.59 17.293 49.773 17.293 13.781 0 25.453-4.918 35.012-14.762 9.8438-9.5625 14.766-21.234 14.766-35.012zm5.0625 0c0 14.902-5.3438 27.699-16.031 38.387-10.684 10.684-23.621 16.027-38.809 16.027-15.746 0-33.18-6.0469-52.305-18.137-20.246-12.656-30.371-24.746-30.371-36.277s10.125-23.762 30.371-36.699c19.125-12.094 36.559-18.137 52.305-18.137 14.625 0 27.562 5.3398 38.809 16.027 10.688 10.969 16.031 23.902 16.031 38.809zm-54.418-29.105c-3.9336 0-10.262 1.6875-18.98 5.0625-7.875 3.9375-11.812 6.4648-11.812 7.5898v32.48c0 3.0938 3.9375 5.625 11.812 7.5938 7.875 3.375 14.203 5.0625 18.98 5.0625 19.406 0 29.391-9.2812 29.953-27.84 0-19.688-9.9844-29.668-29.953-29.949zm34.59 29.105v0.84375c0 21.371-11.527 32.34-34.59 32.902-4.4961 0-11.527-1.8281-21.09-5.4844-7.0312-3.9375-10.969-6.3281-11.809-7.1719-1.6875-1.4062-2.5312-3.0938-2.5312-5.0625v-32.48c0-1.4062 0.70312-2.9492 2.1094-4.6367 3.0898-2.8125 7.168-5.2031 12.23-7.1719 9-3.6562 16.031-5.4844 21.09-5.4844 22.5 0.28125 34.027 11.531 34.59 33.746zm-448.4-206.27h-333.66c-5.0625 0-28.543 1.6875-70.445 5.0625-41.902 3.375-62.852 7.5938-62.852 12.656v11.387c0 4.7812 20.949 8.8594 62.852 12.234 41.902 3.375 65.383 5.0625 70.445 5.0625h333.66c3.6562 1.4062 7.4531 2.1094 11.391 2.1094h64.961c5.3438 0 12.867-2.25 22.566-6.75 9.7031-4.5 14.555-10.547 14.555-18.137 0.28125-16.875-12.094-25.312-37.121-25.312h-64.961c-4.7812 0-8.5781 0.5625-11.391 1.6875z" fill-rule="evenodd"/>
4
+ </svg>
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ <p align="center">
2
+ <img
3
+ class="project-logo"
4
+ src="./NCC-1701-a-blue.svg#gh-light-mode-only"
5
+ alt="WarpDrive"
6
+ width="120px"
7
+ title="WarpDrive" />
8
+ <img
9
+ class="project-logo"
10
+ src="./NCC-1701-a.svg#gh-dark-mode-only"
11
+ alt="WarpDrive"
12
+ width="120px"
13
+ title="WarpDrive" />
14
+ </p>
15
+
16
+ <h3 align="center">🛠️ @warp-drive-mirror/build-config</h3>
17
+ <p align="center">Enables providing a build config to optimize application assets</p>
18
+
19
+ ## Installation
20
+
21
+ ```cli
22
+ pnpm install @warp-drive-mirror/build-config
23
+ ```
24
+
25
+ **Tagged Releases**
26
+
27
+ - ![NPM Canary Version](https://img.shields.io/npm/v/%40warp-drive/build-config/canary?label=%40canary&color=FFBF00)
28
+ - ![NPM Beta Version](https://img.shields.io/npm/v/%40warp-drive/build-config/beta?label=%40beta&color=ff00ff)
29
+ - ![NPM Stable Version](https://img.shields.io/npm/v/%40warp-drive/build-config/latest?label=%40latest&color=90EE90)
30
+ - ![NPM LTS Version](https://img.shields.io/npm/v/%40warp-drive/build-config/lts?label=%40lts&color=0096FF)
31
+ - ![NPM LTS 4.12 Version](https://img.shields.io/npm/v/%40warp-drive/build-config/lts-4-12?label=%40lts-4-12&color=bbbbbb)
32
+
33
+ ## Usage
34
+
35
+ ```ts
36
+ import { setBuildConfig } from '@warp-drive-mirror/build-config';
37
+
38
+ setBuildConfig({
39
+ // ... options
40
+ });
41
+ ```
42
+
43
+ ### ♥️ Credits
44
+
45
+ <details>
46
+ <summary>Brought to you with ♥️ love by <a href="https://emberjs.com" title="EmberJS">🐹 Ember</a></summary>
47
+
48
+ <style type="text/css">
49
+ img.project-logo {
50
+ padding: 0 5em 1em 5em;
51
+ width: 100px;
52
+ border-bottom: 2px solid #0969da;
53
+ margin: 0 auto;
54
+ display: block;
55
+ }
56
+ details > summary {
57
+ font-size: 1.1rem;
58
+ line-height: 1rem;
59
+ margin-bottom: 1rem;
60
+ }
61
+ details {
62
+ font-size: 1rem;
63
+ }
64
+ details > summary strong {
65
+ display: inline-block;
66
+ padding: .2rem 0;
67
+ color: #000;
68
+ border-bottom: 3px solid #0969da;
69
+ }
70
+
71
+ details > details {
72
+ margin-left: 2rem;
73
+ }
74
+ details > details > summary {
75
+ font-size: 1rem;
76
+ line-height: 1rem;
77
+ margin-bottom: 1rem;
78
+ }
79
+ details > details > summary strong {
80
+ display: inline-block;
81
+ padding: .2rem 0;
82
+ color: #555;
83
+ border-bottom: 2px solid #555;
84
+ }
85
+ details > details {
86
+ font-size: .85rem;
87
+ }
88
+
89
+ @media (prefers-color-scheme: dark) {
90
+ details > summary strong {
91
+ color: #fff;
92
+ }
93
+ }
94
+ @media (prefers-color-scheme: dark) {
95
+ details > details > summary strong {
96
+ color: #afaba0;
97
+ border-bottom: 2px solid #afaba0;
98
+ }
99
+ }
100
+ </style>
101
+ </details>
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ function addonShim(dirName, options) {
6
+ const path = require('path');
7
+ const pkg = require(path.join(dirName, './package.json'));
8
+ const isV2Addon = pkg['ember-addon']?.version === 2;
9
+ if (isV2Addon) {
10
+ const {
11
+ addonV1Shim
12
+ } = require('@embroider/addon-shim');
13
+ return addonV1Shim(dirName, options);
14
+ }
15
+ const Funnel = require('broccoli-funnel');
16
+ return {
17
+ name: pkg.name,
18
+ treeForVendor() {},
19
+ treeForPublic() {},
20
+ treeForStyles() {},
21
+ treeForAddonStyles() {},
22
+ treeForApp() {},
23
+ treeForAddon() {
24
+ return this._super.treeForAddon.call(this, new Funnel(path.join(dirName, 'dist')));
25
+ }
26
+ };
27
+ }
28
+
29
+ exports.addonShim = addonShim;
30
+ //# sourceMappingURL=addon-shim.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addon-shim.cjs","sources":["../cjs-src/addon-shim.js"],"sourcesContent":["'use strict';\n\nexport function addonShim(dirName, options) {\n const path = require('path');\n const pkg = require(path.join(dirName, './package.json'));\n\n const isV2Addon = pkg['ember-addon']?.version === 2;\n if (isV2Addon) {\n const { addonV1Shim } = require('@embroider/addon-shim');\n return addonV1Shim(dirName, options);\n }\n\n const Funnel = require('broccoli-funnel');\n return {\n name: pkg.name,\n\n treeForVendor() {},\n treeForPublic() {},\n treeForStyles() {},\n treeForAddonStyles() {},\n treeForApp() {},\n treeForAddon() {\n return this._super.treeForAddon.call(this, new Funnel(path.join(dirName, 'dist')));\n },\n };\n}\n"],"names":["addonShim","dirName","options","path","require","pkg","join","isV2Addon","version","addonV1Shim","Funnel","name","treeForVendor","treeForPublic","treeForStyles","treeForAddonStyles","treeForApp","treeForAddon","_super","call"],"mappings":";;;;AAEO,SAASA,SAASA,CAACC,OAAO,EAAEC,OAAO,EAAE;AAC1C,EAAA,MAAMC,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,EAAA,MAAMC,GAAG,GAAGD,OAAO,CAACD,IAAI,CAACG,IAAI,CAACL,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;EAEzD,MAAMM,SAAS,GAAGF,GAAG,CAAC,aAAa,CAAC,EAAEG,OAAO,KAAK,CAAC,CAAA;AACnD,EAAA,IAAID,SAAS,EAAE;IACb,MAAM;AAAEE,MAAAA,WAAAA;AAAY,KAAC,GAAGL,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACxD,IAAA,OAAOK,WAAW,CAACR,OAAO,EAAEC,OAAO,CAAC,CAAA;AACtC,GAAA;AAEA,EAAA,MAAMQ,MAAM,GAAGN,OAAO,CAAC,iBAAiB,CAAC,CAAA;EACzC,OAAO;IACLO,IAAI,EAAEN,GAAG,CAACM,IAAI;IAEdC,aAAaA,GAAG,EAAE;IAClBC,aAAaA,GAAG,EAAE;IAClBC,aAAaA,GAAG,EAAE;IAClBC,kBAAkBA,GAAG,EAAE;IACvBC,UAAUA,GAAG,EAAE;AACfC,IAAAA,YAAYA,GAAG;MACb,OAAO,IAAI,CAACC,MAAM,CAACD,YAAY,CAACE,IAAI,CAAC,IAAI,EAAE,IAAIT,MAAM,CAACP,IAAI,CAACG,IAAI,CAACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;AACpF,KAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,46 @@
1
+ import { L as LOGGING } from './debugging-BzogyWJo.js';
2
+ import { C as CURRENT_FEATURES } from './canary-features-BzGSGY5j.js';
3
+ import { C as CURRENT_DEPRECATIONS } from './deprecations-BXAnWRDO.js';
4
+
5
+ const features = Object.keys(CURRENT_FEATURES);
6
+ const FEATURES = Object.assign({}, CURRENT_FEATURES);
7
+ features.forEach(feature => {
8
+ let featureValue = FEATURES[feature];
9
+ if (featureValue === null) {
10
+ FEATURES[feature] = false;
11
+ }
12
+ });
13
+ const config = {
14
+ features: FEATURES,
15
+ deprecations: Object.assign({}, CURRENT_DEPRECATIONS),
16
+ debug: Object.assign({}, LOGGING)
17
+ };
18
+ function macros() {
19
+ const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);
20
+ const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);
21
+ const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);
22
+ const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);
23
+ let plugins = [[TransformAsserts, {}, '@warp-drive-mirror/build-config/asserts-stripping'], [TransformFeatures, {
24
+ source: '@warp-drive-mirror/build-config/canary-features',
25
+ flags: config.features
26
+ }, '@warp-drive-mirror/build-config/canary-features-stripping'], [TransformDeprecations, {
27
+ source: '@warp-drive-mirror/build-config/deprecations',
28
+ flags: config.deprecations
29
+ }, '@warp-drive-mirror/build-config/deprecation-stripping'], [TransformDebugLogging, {
30
+ source: '@warp-drive-mirror/build-config/debugging',
31
+ configKey: 'debug',
32
+ flags: config.debug
33
+ }, '@warp-drive-mirror/build-config/debugging-stripping'], [TransformDebugLogging, {
34
+ source: '@warp-drive-mirror/build-config/env',
35
+ configKey: 'env',
36
+ flags: {
37
+ TESTING: true,
38
+ PRODUCTION: true,
39
+ DEBUG: true
40
+ }
41
+ }, '@warp-drive-mirror/build-config/env']];
42
+ return plugins;
43
+ }
44
+
45
+ export { macros };
46
+ //# sourceMappingURL=babel-macros.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-macros.js","sources":["../src/babel-macros.ts"],"sourcesContent":["import * as LOGGING from './debugging.ts';\nimport * as CURRENT_FEATURES from './canary-features.ts';\nimport * as CURRENT_DEPRECATIONS from './deprecations.ts';\n\ntype FEATURE = keyof typeof CURRENT_FEATURES;\nconst features = Object.keys(CURRENT_FEATURES) as FEATURE[];\nconst FEATURES = Object.assign({}, CURRENT_FEATURES) as Record<FEATURE, boolean>;\nfeatures.forEach((feature) => {\n let featureValue = FEATURES[feature];\n if (featureValue === null) {\n FEATURES[feature] = false;\n }\n});\n\nconst config = {\n features: FEATURES,\n deprecations: Object.assign({}, CURRENT_DEPRECATIONS),\n debug: Object.assign({}, LOGGING),\n};\n\nexport function macros() {\n const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);\n const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);\n const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);\n const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);\n\n let plugins = [\n [TransformAsserts, {}, '@warp-drive-mirror/build-config/asserts-stripping'],\n [\n TransformFeatures,\n {\n source: '@warp-drive-mirror/build-config/canary-features',\n flags: config.features,\n },\n '@warp-drive-mirror/build-config/canary-features-stripping',\n ],\n [\n TransformDeprecations,\n {\n source: '@warp-drive-mirror/build-config/deprecations',\n flags: config.deprecations,\n },\n '@warp-drive-mirror/build-config/deprecation-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/debugging',\n configKey: 'debug',\n flags: config.debug,\n },\n '@warp-drive-mirror/build-config/debugging-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/env',\n configKey: 'env',\n flags: {\n TESTING: true,\n PRODUCTION: true,\n DEBUG: true,\n },\n },\n '@warp-drive-mirror/build-config/env',\n ],\n ];\n\n return plugins;\n}\n"],"names":["features","Object","keys","CURRENT_FEATURES","FEATURES","assign","forEach","feature","featureValue","config","deprecations","CURRENT_DEPRECATIONS","debug","LOGGING","macros","TransformAsserts","import","meta","resolve","slice","TransformDeprecations","TransformDebugLogging","TransformFeatures","plugins","source","flags","configKey","TESTING","PRODUCTION","DEBUG"],"mappings":";;;;AAKA,MAAMA,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACC,gBAAgB,CAAc,CAAA;AAC3D,MAAMC,QAAQ,GAAGH,MAAM,CAACI,MAAM,CAAC,EAAE,EAAEF,gBAAgB,CAA6B,CAAA;AAChFH,QAAQ,CAACM,OAAO,CAAEC,OAAO,IAAK;AAC5B,EAAA,IAAIC,YAAY,GAAGJ,QAAQ,CAACG,OAAO,CAAC,CAAA;EACpC,IAAIC,YAAY,KAAK,IAAI,EAAE;AACzBJ,IAAAA,QAAQ,CAACG,OAAO,CAAC,GAAG,KAAK,CAAA;AAC3B,GAAA;AACF,CAAC,CA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AAC,EACD,8CAA8C,CAC/C,EACD,CACES,qBAAqB,EACrB;AACEG,IAAAA,MAAM,EAAE,8BAA8B;AACtCE,IAAAA,SAAS,EAAE,KAAK;AAChBD,IAAAA,KAAK,EAAE;AACLE,MAAAA,OAAO,EAAE,IAAI;AACbC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,KAAK,EAAE,IAAA;AACT,KAAA;GACD,EACD,8BAA8B,CAC/B,CACF,CAAA;AAED,EAAA,OAAON,OAAO,CAAA;AAChB;;;;"}
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ ImportUtil
5
+ } = require('babel-import-util');
6
+ const Utils = new Set(['assert']);
7
+
8
+ /*
9
+ // Before
10
+ import { assert } from '@warp-drive-mirror/build-config/macros';
11
+
12
+ assert('foo', true);
13
+
14
+ // After
15
+ (macroCondition(isDevelopingApp()) ? function assert(test) { if (!test) { throw new Error('foo'); } }(true) : {});
16
+ */
17
+
18
+ // => _macros.getGlobalConfig().WarpDrive.env.DEBUG
19
+ function buildMacroConstDEBUG(types, binding, state) {
20
+ return types.memberExpression(types.memberExpression(types.memberExpression(types.callExpression(state.importer.import(binding, '@embroider/macros', 'getGlobalConfig'), []), types.identifier('WarpDrive')), types.identifier('env')), types.identifier('DEBUG'));
21
+ }
22
+
23
+ // => _macros.macroCondition(_macros.getGlobalConfig().WarpDrive.env.DEBUG)
24
+ function buildMacroConditionDEBUG(types, binding, state) {
25
+ return types.callExpression(state.importer.import(binding, '@embroider/macros', 'macroCondition'), [buildMacroConstDEBUG(types, binding, state)]);
26
+ }
27
+
28
+ // (test) => { if (!test) { throw new Error(someMessage); } }(someCond)
29
+ function buildAssert(types, originalCallExpression) {
30
+ const desc = originalCallExpression.arguments[0];
31
+ const test = originalCallExpression.arguments[1] ?? types.booleanLiteral(false);
32
+ // prettier-ignore
33
+ return types.callExpression(types.arrowFunctionExpression([types.identifier('test')],
34
+ // (test) =>
35
+ types.blockStatement([
36
+ // {
37
+ types.ifStatement(
38
+ // if
39
+ types.unaryExpression('!', types.identifier('test')),
40
+ // (!test)
41
+ types.blockStatement([
42
+ // {
43
+ types.throwStatement(
44
+ // throw
45
+ types.newExpression(types.identifier('Error'), [desc]) // new Error(desc)
46
+ )]) // }
47
+ )]) // }
48
+ ), [test] // (someCond)
49
+ );
50
+ }
51
+
52
+ // => ( <debug-macro> ? <assert-exp> : {});
53
+ function buildAssertTernary(types, binding, state, originalCallExpression) {
54
+ return types.expressionStatement(types.conditionalExpression(buildMacroConditionDEBUG(types, binding, state), buildAssert(types, originalCallExpression), types.objectExpression([])));
55
+ }
56
+ function babelPluginTransformAsserts (babel) {
57
+ const {
58
+ types: t
59
+ } = babel;
60
+ return {
61
+ name: 'ast-transform',
62
+ // not required
63
+ visitor: {
64
+ ImportDeclaration(path, state) {
65
+ const importPath = path.node.source.value;
66
+ if (importPath === '@warp-drive-mirror/build-config/macros') {
67
+ const specifiers = path.get('specifiers');
68
+ specifiers.forEach(specifier => {
69
+ const name = specifier.node.imported.name;
70
+ if (!Utils.has(name)) {
71
+ throw new Error(`Unexpected import '${name}' imported from '@warp-drive-mirror/build-config/macros'`);
72
+ }
73
+ const localBindingName = specifier.node.local.name;
74
+ const binding = specifier.scope.getBinding(localBindingName);
75
+ binding.referencePaths.forEach(p => {
76
+ const originalCallExpression = p.parentPath.node;
77
+ if (!t.isCallExpression(originalCallExpression)) {
78
+ throw new Error('Expected a call expression');
79
+ }
80
+ const assertTernary = buildAssertTernary(t, binding, state, originalCallExpression);
81
+ p.parentPath.replaceWith(assertTernary);
82
+ });
83
+ specifier.scope.removeOwnBinding(localBindingName);
84
+ specifier.remove();
85
+ });
86
+ if (path.get('specifiers').length === 0) {
87
+ path.remove();
88
+ }
89
+ }
90
+ },
91
+ Program(path, state) {
92
+ state.importer = new ImportUtil(t, path);
93
+ }
94
+ }
95
+ };
96
+ }
97
+
98
+ module.exports = babelPluginTransformAsserts;
99
+ //# sourceMappingURL=babel-plugin-transform-asserts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-transform-asserts.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-asserts.js"],"sourcesContent":["const { ImportUtil } = require('babel-import-util');\n\nconst Utils = new Set(['assert']);\n\n/*\n// Before\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nassert('foo', true);\n\n// After\n(macroCondition(isDevelopingApp()) ? function assert(test) { if (!test) { throw new Error('foo'); } }(true) : {});\n*/\n\n// => _macros.getGlobalConfig().WarpDrive.env.DEBUG\nfunction buildMacroConstDEBUG(types, binding, state) {\n return types.memberExpression(\n types.memberExpression(\n types.memberExpression(\n types.callExpression(state.importer.import(binding, '@embroider/macros', 'getGlobalConfig'), []),\n types.identifier('WarpDrive')\n ),\n types.identifier('env')\n ),\n types.identifier('DEBUG')\n );\n}\n\n// => _macros.macroCondition(_macros.getGlobalConfig().WarpDrive.env.DEBUG)\nfunction buildMacroConditionDEBUG(types, binding, state) {\n return types.callExpression(state.importer.import(binding, '@embroider/macros', 'macroCondition'), [\n buildMacroConstDEBUG(types, binding, state),\n ]);\n}\n\n// (test) => { if (!test) { throw new Error(someMessage); } }(someCond)\nfunction buildAssert(types, originalCallExpression) {\n const desc = originalCallExpression.arguments[0];\n const test = originalCallExpression.arguments[1] ?? types.booleanLiteral(false);\n // prettier-ignore\n return types.callExpression(\n types.arrowFunctionExpression([types.identifier('test')], // (test) =>\n types.blockStatement([ // {\n types.ifStatement( // if\n types.unaryExpression('!', types.identifier('test')), // (!test)\n types.blockStatement([ // {\n types.throwStatement( // throw\n types.newExpression(types.identifier('Error'), [desc]) // new Error(desc)\n )]) // }\n )]) // }\n ),\n [test] // (someCond)\n );\n}\n\n// => ( <debug-macro> ? <assert-exp> : {});\nfunction buildAssertTernary(types, binding, state, originalCallExpression) {\n return types.expressionStatement(\n types.conditionalExpression(\n buildMacroConditionDEBUG(types, binding, state),\n buildAssert(types, originalCallExpression),\n types.objectExpression([])\n )\n );\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === '@warp-drive-mirror/build-config/macros') {\n const specifiers = path.get('specifiers');\n\n specifiers.forEach((specifier) => {\n const name = specifier.node.imported.name;\n if (!Utils.has(name)) {\n throw new Error(`Unexpected import '${name}' imported from '@warp-drive-mirror/build-config/macros'`);\n }\n\n const localBindingName = specifier.node.local.name;\n const binding = specifier.scope.getBinding(localBindingName);\n\n binding.referencePaths.forEach((p) => {\n const originalCallExpression = p.parentPath.node;\n\n if (!t.isCallExpression(originalCallExpression)) {\n throw new Error('Expected a call expression');\n }\n\n const assertTernary = buildAssertTernary(t, binding, state, originalCallExpression);\n p.parentPath.replaceWith(assertTernary);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["ImportUtil","require","Utils","Set","buildMacroConstDEBUG","types","binding","state","memberExpression","callExpression","importer","import","identifier","buildMacroConditionDEBUG","buildAssert","originalCallExpression","desc","arguments","test","booleanLiteral","arrowFunctionExpression","blockStatement","ifStatement","unaryExpression","throwStatement","newExpression","buildAssertTernary","expressionStatement","conditionalExpression","objectExpression","babel","t","name","visitor","ImportDeclaration","path","importPath","node","source","value","specifiers","get","forEach","specifier","imported","has","Error","localBindingName","local","scope","getBinding","referencePaths","p","parentPath","isCallExpression","assertTernary","replaceWith","removeOwnBinding","remove","length","Program"],"mappings":";;AAAA,MAAM;AAAEA,EAAAA,UAAAA;AAAW,CAAC,GAAGC,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAEnD,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASC,oBAAo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AAU,CAAC+B,CAAC,EAAEI,IAAI,CAAC,CAAA;AAC1C,OAAA;AACF,KAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ const babelImportUtil = require('babel-import-util');
4
+
5
+ function parentIsUnary(node) {
6
+ if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {
7
+ return true;
8
+ }
9
+ return false;
10
+ }
11
+ function babelPluginTransformDeprecations (babel) {
12
+ const {
13
+ types: t
14
+ } = babel;
15
+ return {
16
+ name: 'deprecation-flags',
17
+ visitor: {
18
+ ImportDeclaration(path, state) {
19
+ const importPath = path.node.source.value;
20
+ if (importPath === state.opts.source) {
21
+ const specifiers = path.get('specifiers');
22
+ specifiers.forEach(specifier => {
23
+ let name = specifier.node.imported.name;
24
+ if (!(name in state.opts.flags)) {
25
+ throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);
26
+ }
27
+ let localBindingName = specifier.node.local.name;
28
+ let binding = specifier.scope.getBinding(localBindingName);
29
+ binding.referencePaths.forEach((p, other) => {
30
+ let negateStatement = false;
31
+ let node = p;
32
+ if (parentIsUnary(p)) {
33
+ negateStatement = true;
34
+ node = p.parentPath;
35
+ }
36
+ let getConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDrive')), t.identifier('deprecations')), t.identifier(name));
37
+ node.replaceWith(
38
+ // if (DEPRECATE_FOO)
39
+ // =>
40
+ // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))
41
+ t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [negateStatement ? t.unaryExpression('!', getConfig) : getConfig]));
42
+ });
43
+ specifier.scope.removeOwnBinding(localBindingName);
44
+ specifier.remove();
45
+ });
46
+ }
47
+ if (path.get('specifiers').length === 0) {
48
+ path.remove();
49
+ }
50
+ },
51
+ Program(path, state) {
52
+ state.importer = new babelImportUtil.ImportUtil(t, path);
53
+ }
54
+ }
55
+ };
56
+ }
57
+
58
+ module.exports = babelPluginTransformDeprecations;
59
+ //# sourceMappingURL=babel-plugin-transform-deprecations.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-transform-deprecations.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-deprecations.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'deprecation-flags',\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p, other) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDrive')\n ),\n t.identifier('deprecations')\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (DEPRECATE_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n }\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","other","negateStatement","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","replaceWith","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACA,EAAA,OAAO,KAAK,CAAA;AACd,CAAA;AAEe,yCAAA,EAAUC,KAAK,EAAE;EAC9B,MAAM;AAAEC,IAAAA,KAAK,EAAEC,CAAAA;AAAE,GAAC,GAAGF,KAAK,CAAA;EAE1B,OAAO;AACLG,IAAAA,IAAI,EAAE,mBAAmB;AACzBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAAMC,UAAU,GAAGF,IAAI,CAACV,IAAI,CAACa,MAAM,CAACC,KAAK,CAAA;AAEzC,QAAA,IAAIF,UAAU,KAAKD,KAAK,CAACI,IAAI,CAACF,MAAM,EAAE;AACpC,UAAA,MAAMG,UAAU,GAAGN,IAAI,CAACO,GAAG,CAAC,YAAY,CAAC,CAAA;AACzCD,UAAAA,UAAU,CAACE,OAAO,CAAEC,SAAS,IAAK;YAChC,IAAIZ,IAAI,GAAGY,SAAS,CAACnB,IAAI,CAACoB,QAAQ,CAACb,IAAI,CAAA;YACvC,IAAI,EAAEA,IAAI,IAAII,KAAK,CAACI,IAAI,CAACM,KAAK,CAAC,EAAE;AAC/B,cAAA,MAAM,IAAIC,KAAK,CAAE,CAAA,gBAAA,EAAkBf,IAAK,CAAA,eAAA,EAAiBI,KAAK,CAACI,IAAI,CAACF,MAAO,CAAA,CAAC,CAAC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ACO,KAAK,CAACe,gBAAgB,CAAClB,gBAAgB,CAAC,CAAA;YAClDJ,SAAS,CAACuB,MAAM,EAAE,CAAA;AACpB,WAAC,CAAC,CAAA;AACJ,SAAA;QACA,IAAIhC,IAAI,CAACO,GAAG,CAAC,YAAY,CAAC,CAAC0B,MAAM,KAAK,CAAC,EAAE;UACvCjC,IAAI,CAACgC,MAAM,EAAE,CAAA;AACf,SAAA;OACD;AAEDE,MAAAA,OAAOA,CAAClC,IAAI,EAAEC,KAAK,EAAE;QACnBA,KAAK,CAACyB,QAAQ,GAAG,IAAIS,0BAAU,CAACvC,CAAC,EAAEI,IAAI,CAAC,CAAA;AAC1C,OAAA;AACF,KAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ const babelImportUtil = require('babel-import-util');
4
+ const fs = require('fs');
5
+
6
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
+ const pkg = JSON.parse(fs.readFileSync(new URL("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('babel-plugin-transform-features.cjs', document.baseURI).href))), 'utf-8'));
8
+ const version = pkg.version;
9
+ const isCanary = version.includes('alpha');
10
+ function parentIsUnary(node) {
11
+ if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {
12
+ return true;
13
+ }
14
+ return false;
15
+ }
16
+ function babelPluginTransformFeatures (babel) {
17
+ const {
18
+ types: t
19
+ } = babel;
20
+ return {
21
+ name: 'ast-transform',
22
+ // not required
23
+ visitor: {
24
+ ImportDeclaration(path, state) {
25
+ const importPath = path.node.source.value;
26
+ if (importPath === state.opts.source) {
27
+ const specifiers = path.get('specifiers');
28
+ specifiers.forEach(specifier => {
29
+ let name = specifier.node.imported.name;
30
+ if (!(name in state.opts.flags)) {
31
+ throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);
32
+ }
33
+ let localBindingName = specifier.node.local.name;
34
+ let binding = specifier.scope.getBinding(localBindingName);
35
+ binding.referencePaths.forEach(p => {
36
+ let negateStatement = false;
37
+ let node = p;
38
+ if (!isCanary) {
39
+ p.replaceWith(t.boolean(state.opts.flags[name]));
40
+ return;
41
+ }
42
+ if (parentIsUnary(p)) {
43
+ negateStatement = true;
44
+ node = p.parentPath;
45
+ }
46
+ let getConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDrive')), t.identifier('features')), t.identifier(name));
47
+ node.replaceWith(
48
+ // if (LOG_FOO)
49
+ // =>
50
+ // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))
51
+ t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [negateStatement ? t.unaryExpression('!', getConfig) : getConfig]));
52
+ });
53
+ specifier.scope.removeOwnBinding(localBindingName);
54
+ specifier.remove();
55
+ });
56
+ }
57
+ if (path.get('specifiers').length === 0) {
58
+ path.remove();
59
+ }
60
+ },
61
+ Program(path, state) {
62
+ state.importer = new babelImportUtil.ImportUtil(t, path);
63
+ }
64
+ }
65
+ };
66
+ }
67
+
68
+ module.exports = babelPluginTransformFeatures;
69
+ //# sourceMappingURL=babel-plugin-transform-features.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-transform-features.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-features.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\nimport fs from 'fs';\n\nconst pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));\nconst version = pkg.version;\n\nconst isCanary = version.includes('alpha');\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (!isCanary) {\n p.replaceWith(t.boolean(state.opts.flags[name]));\n return;\n }\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDrive')\n ),\n t.identifier('features')\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n }\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["pkg","JSON","parse","fs","readFileSync","version","isCanary","includes","parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","replaceWith","boolean","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;;;AAGA,MAAMA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,EAAE,CAACC,YAAY,CAAC,IAAA,GAAA,CAAA,iBAAA,EAAA,wNAAA,CAA2C,EAAE,OAAO,CAAC,CAAC,CAAA;AAC7F,MAAM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,GAAG,EAAEN,SAAS,CAAC,GAAGA,SAAS,CAChE,CACH,CAAC,CAAA;AACH,aAAC,CAAC,CAAA;AACFf,YAAAA,SAAS,CAACO,KAAK,CAACe,gBAAgB,CAAClB,gBAAgB,CAAC,CAAA;YAClDJ,SAAS,CAACuB,MAAM,EAAE,CAAA;AACpB,WAAC,CAAC,CAAA;AACJ,SAAA;QACA,IAAIhC,IAAI,CAACO,GAAG,CAAC,YAAY,CAAC,CAAC0B,MAAM,KAAK,CAAC,EAAE;UACvCjC,IAAI,CAACgC,MAAM,EAAE,CAAA;AACf,SAAA;OACD;AAEDE,MAAAA,OAAOA,CAAClC,IAAI,EAAEC,KAAK,EAAE;QACnBA,KAAK,CAAC0B,QAAQ,GAAG,IAAIQ,0BAAU,CAACvC,CAAC,EAAEI,IAAI,CAAC,CAAA;AAC1C,OAAA;AACF,KAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ const babelImportUtil = require('babel-import-util');
4
+
5
+ function parentIsUnary(node) {
6
+ if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {
7
+ return true;
8
+ }
9
+ return false;
10
+ }
11
+ function babelPluginTransformLogging (babel) {
12
+ const {
13
+ types: t
14
+ } = babel;
15
+ return {
16
+ name: 'ast-transform',
17
+ // not required
18
+ visitor: {
19
+ ImportDeclaration(path, state) {
20
+ const importPath = path.node.source.value;
21
+ if (importPath === state.opts.source) {
22
+ const specifiers = path.get('specifiers');
23
+ specifiers.forEach(specifier => {
24
+ let name = specifier.node.imported.name;
25
+ if (!(name in state.opts.flags)) {
26
+ throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);
27
+ }
28
+ let localBindingName = specifier.node.local.name;
29
+ let binding = specifier.scope.getBinding(localBindingName);
30
+ binding.referencePaths.forEach(p => {
31
+ let negateStatement = false;
32
+ let node = p;
33
+ if (parentIsUnary(p)) {
34
+ negateStatement = true;
35
+ node = p.parentPath;
36
+ }
37
+ let getConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDrive')), t.identifier(state.opts.configKey)), t.identifier(name));
38
+ node.replaceWith(
39
+ // if (LOG_FOO)
40
+ // =>
41
+ // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))
42
+ t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [negateStatement ? t.unaryExpression('!', getConfig) : getConfig]));
43
+ });
44
+ specifier.scope.removeOwnBinding(localBindingName);
45
+ specifier.remove();
46
+ });
47
+ }
48
+ if (path.get('specifiers').length === 0) {
49
+ path.remove();
50
+ }
51
+ },
52
+ Program(path, state) {
53
+ state.importer = new babelImportUtil.ImportUtil(t, path);
54
+ }
55
+ }
56
+ };
57
+ }
58
+
59
+ module.exports = babelPluginTransformLogging;
60
+ //# sourceMappingURL=babel-plugin-transform-logging.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-plugin-transform-logging.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-logging.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDrive')\n ),\n t.identifier(state.opts.configKey)\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n }\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","configKey","replaceWith","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACA,EAAA,OAAO,KAAK,CAAA;AACd,CAAA;AAEe,oCAAA,EAAUC,KAAK,EAAE;EAC9B,MAAM;AAAEC,IAAAA,KAAK,EAAEC,CAAAA;AAAE,GAAC,GAAGF,KAAK,CAAA;EAE1B,OAAO;AACLG,IAAAA,IAAI,EAAE,eAAe;AAAE;AACvBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAAMC,UAAU,GAAGF,IAAI,CAACV,IAAI,CAACa,MAAM,CAACC,KAAK,CAAA;AAEzC,QAAA,IA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