From c1336e4168f47095458cf1cb58c5bf0c38fd1611 Mon Sep 17 00:00:00 2001 From: Balwant Singh <2805177+phenixcoder@users.noreply.github.com> Date: Tue, 31 Aug 2021 20:05:27 +1000 Subject: [PATCH 1/6] Added LICENSE.md Fixes issue #3 --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 1883ae2d4c9c08a2084f1b27a4879ac0ece70d3c Mon Sep 17 00:00:00 2001 From: recursivesquircle Date: Sun, 15 Jun 2025 19:57:32 -0700 Subject: [PATCH 2/6] updated to manifest version three and added typescript --- .gitignore | 13 + DEVELOPER.md | 84 ++- README.md | 26 + package | 2 +- package-lock.json | 1078 ++++++++++++++++++++++++++++++++++++++ package.json | 26 + plugin/background.js | 34 +- plugin/content-script.js | 57 +- plugin/manifest.json | 15 +- plugin/popup.js | 28 +- src/background.ts | 64 +++ src/content-script.ts | 52 ++ src/injected-script.js | 51 ++ src/manifest.json | 47 ++ src/popup.html | 100 ++++ src/popup.ts | 109 ++++ src/types/index.ts | 54 ++ test-app/README.md | 172 ++++++ test-app/app.js | 217 ++++++++ test-app/index.html | 173 ++++++ test-app/server.js | 85 +++ test-app/server.py | 41 ++ tsconfig.json | 30 ++ vite.config.ts | 79 +++ 24 files changed, 2579 insertions(+), 58 deletions(-) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/background.ts create mode 100644 src/content-script.ts create mode 100644 src/injected-script.js create mode 100644 src/manifest.json create mode 100644 src/popup.html create mode 100644 src/popup.ts create mode 100644 src/types/index.ts create mode 100644 test-app/README.md create mode 100644 test-app/app.js create mode 100644 test-app/index.html create mode 100755 test-app/server.js create mode 100755 test-app/server.py create mode 100644 tsconfig.json create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore index ac7cd11..e91110a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,16 @@ plugin.crx plugin.pem plugin.zip + +# TypeScript/Vite build artifacts +node_modules/ +dist/ +*.tsbuildinfo + +# IDE files +.vscode/ +.idea/ + +# OS files +.DS_Store +Thumbs.db diff --git a/DEVELOPER.md b/DEVELOPER.md index 9077ebd..5cb97f4 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -1,11 +1,89 @@ # Developing Chrome Plugin -Main code for plugin is located inside `plugin` folder. +This Chrome extension is built with TypeScript and Vite for modern development experience. + +## Setup + +1. Install dependencies: +```shell +npm install +``` + +## Development + +### Source Code Structure +- `src/` - TypeScript source files + - `background.ts` - Service worker background script + - `content-script.ts` - Content script injected into web pages + - `popup.ts` - Popup UI logic + - `popup.html` - Popup UI template + - `manifest.json` - Extension manifest + - `types/` - TypeScript type definitions + +### Build Commands + +**Development build with watch mode:** +```shell +npm run dev +``` + +**Production build:** +```shell +npm run build +``` + +**Type checking:** +```shell +npm run type-check +``` + +### Loading the Extension + +1. Build the extension: `npm run build` +2. Open Chrome and go to `chrome://extensions/` +3. Enable "Developer mode" +4. Click "Load unpacked" and select the `dist/` folder ## Packaging -run package command in terminal: +Build and package the extension: + +```shell +npm run build +npm run package +``` + +This creates `plugin.zip` ready for Chrome Web Store upload. + +## Testing + +### Local Testing with Test App + +A test web application is provided in the `test-app/` directory to help you test the extension locally. +**Quick Test Setup:** + +1. Build the extension: +```shell +npm run build +``` + +2. Load the extension in Chrome: + - Go to `chrome://extensions/` + - Enable "Developer mode" + - Click "Load unpacked" and select the `dist/` folder + +3. Start the test server: ```shell -> ./package +cd test-app +python3 server.py +# Opens at http://localhost:8000 ``` + +4. Open `http://localhost:8000` in Chrome and test the integration + +The test app demonstrates both integration methods: +- Direct registration when extension is already loaded +- Race condition handling when page loads before extension + +See `test-app/README.md` for detailed testing instructions. diff --git a/README.md b/README.md index 6a3b689..4b552e6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,32 @@ Chrome Plugin to manage Feature Flags on any supported web app. [![Chrome Web Store Link](ChromeWebStore_Badge_v2_496x150.png)](https://chrome.google.com/webstore/detail/feature-flags/hmflgmhoghcbmckbbgahfmklegllkggn) +## ๐Ÿš€ Built with TypeScript + Vite + +This extension is now built with modern tooling: +- **TypeScript** for type safety and better development experience +- **Vite** for fast builds and hot reloading during development +- **Manifest V3** for latest Chrome extension standards + +### Development Setup + +```bash +# Install dependencies +npm install + +# Development build with watch mode +npm run dev + +# Production build +npm run build + +# Type checking +npm run type-check + +# Package for distribution +npm run package +``` + --- ## Adding Feature Flag Support to your web app diff --git a/package b/package index 29c91f4..5a217bb 100755 --- a/package +++ b/package @@ -2,4 +2,4 @@ rm -f plugin.zip -zip plugin.zip -r plugin \ No newline at end of file +zip plugin.zip -r dist \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3db2769 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1078 @@ +{ + "name": "feature-flags-chrome-extension", + "version": "1.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "feature-flags-chrome-extension", + "version": "1.1.0", + "license": "GPL-3.0", + "devDependencies": { + "@types/chrome": "^0.0.326", + "@types/node": "^22.10.2", + "typescript": "^5.7.2", + "vite": "^6.0.1" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.43.0.tgz", + "integrity": "sha512-Krjy9awJl6rKbruhQDgivNbD1WuLb8xAclM4IR4cN5pHGAs2oIMMQJEiC3IC/9TZJ+QZkmZhlMO/6MBGxPidpw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.43.0.tgz", + "integrity": "sha512-ss4YJwRt5I63454Rpj+mXCXicakdFmKnUNxr1dLK+5rv5FJgAxnN7s31a5VchRYxCFWdmnDWKd0wbAdTr0J5EA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.43.0.tgz", + "integrity": "sha512-eKoL8ykZ7zz8MjgBenEF2OoTNFAPFz1/lyJ5UmmFSz5jW+7XbH1+MAgCVHy72aG59rbuQLcJeiMrP8qP5d/N0A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.43.0.tgz", + "integrity": "sha512-SYwXJgaBYW33Wi/q4ubN+ldWC4DzQY62S4Ll2dgfr/dbPoF50dlQwEaEHSKrQdSjC6oIe1WgzosoaNoHCdNuMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.43.0.tgz", + "integrity": "sha512-SV+U5sSo0yujrjzBF7/YidieK2iF6E7MdF6EbYxNz94lA+R0wKl3SiixGyG/9Klab6uNBIqsN7j4Y/Fya7wAjQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.43.0.tgz", + "integrity": "sha512-J7uCsiV13L/VOeHJBo5SjasKiGxJ0g+nQTrBkAsmQBIdil3KhPnSE9GnRon4ejX1XDdsmK/l30IYLiAaQEO0Cg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.43.0.tgz", + "integrity": "sha512-gTJ/JnnjCMc15uwB10TTATBEhK9meBIY+gXP4s0sHD1zHOaIh4Dmy1X9wup18IiY9tTNk5gJc4yx9ctj/fjrIw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.43.0.tgz", + "integrity": "sha512-ZJ3gZynL1LDSIvRfz0qXtTNs56n5DI2Mq+WACWZ7yGHFUEirHBRt7fyIk0NsCKhmRhn7WAcjgSkSVVxKlPNFFw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.43.0.tgz", + "integrity": "sha512-8FnkipasmOOSSlfucGYEu58U8cxEdhziKjPD2FIa0ONVMxvl/hmONtX/7y4vGjdUhjcTHlKlDhw3H9t98fPvyA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.43.0.tgz", + "integrity": "sha512-KPPyAdlcIZ6S9C3S2cndXDkV0Bb1OSMsX0Eelr2Bay4EsF9yi9u9uzc9RniK3mcUGCLhWY9oLr6er80P5DE6XA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.43.0.tgz", + "integrity": "sha512-HPGDIH0/ZzAZjvtlXj6g+KDQ9ZMHfSP553za7o2Odegb/BEfwJcR0Sw0RLNpQ9nC6Gy8s+3mSS9xjZ0n3rhcYg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.43.0.tgz", + "integrity": "sha512-gEmwbOws4U4GLAJDhhtSPWPXUzDfMRedT3hFMyRAvM9Mrnj+dJIFIeL7otsv2WF3D7GrV0GIewW0y28dOYWkmw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.43.0.tgz", + "integrity": "sha512-XXKvo2e+wFtXZF/9xoWohHg+MuRnvO29TI5Hqe9xwN5uN8NKUYy7tXUG3EZAlfchufNCTHNGjEx7uN78KsBo0g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.43.0.tgz", + "integrity": "sha512-ruf3hPWhjw6uDFsOAzmbNIvlXFXlBQ4nk57Sec8E8rUxs/AI4HD6xmiiasOOx/3QxS2f5eQMKTAwk7KHwpzr/Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.43.0.tgz", + "integrity": "sha512-QmNIAqDiEMEvFV15rsSnjoSmO0+eJLoKRD9EAa9rrYNwO/XRCtOGM3A5A0X+wmG+XRrw9Fxdsw+LnyYiZWWcVw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.43.0.tgz", + "integrity": "sha512-jAHr/S0iiBtFyzjhOkAics/2SrXE092qyqEg96e90L3t9Op8OTzS6+IX0Fy5wCt2+KqeHAkti+eitV0wvblEoQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.43.0.tgz", + "integrity": "sha512-3yATWgdeXyuHtBhrLt98w+5fKurdqvs8B53LaoKD7P7H7FKOONLsBVMNl9ghPQZQuYcceV5CDyPfyfGpMWD9mQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.43.0.tgz", + "integrity": "sha512-wVzXp2qDSCOpcBCT5WRWLmpJRIzv23valvcTwMHEobkjippNf+C3ys/+wf07poPkeNix0paTNemB2XrHr2TnGw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.43.0.tgz", + "integrity": "sha512-fYCTEyzf8d+7diCw8b+asvWDCLMjsCEA8alvtAutqJOJp/wL5hs1rWSqJ1vkjgW0L2NB4bsYJrpKkiIPRR9dvw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.43.0.tgz", + "integrity": "sha512-SnGhLiE5rlK0ofq8kzuDkM0g7FN1s5VYY+YSMTibP7CqShxCQvqtNxTARS4xX4PFJfHjG0ZQYX9iGzI3FQh5Aw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/chrome": { + "version": "0.0.326", + "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.326.tgz", + "integrity": "sha512-WS7jKf3ZRZFHOX7dATCZwqNJgdfiSF0qBRFxaO0LhIOvTNBrfkab26bsZwp6EBpYtqp8loMHJTnD6vDTLWPKYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/filesystem": "*", + "@types/har-format": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/filesystem": { + "version": "0.0.36", + "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz", + "integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/filewriter": "*" + } + }, + "node_modules/@types/filewriter": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz", + "integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/har-format": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz", + "integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.15.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.31.tgz", + "integrity": "sha512-jnVe5ULKl6tijxUhvQeNbQG/84fHfg+yMak02cT8QVhBx/F05rAVxCGBYYTh2EKz22D6JF5ktXuNwdx7b9iEGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" + } + }, + "node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.5.tgz", + "integrity": "sha512-d/jtm+rdNT8tpXuHY5MMtcbJFBkhXE6593XVR9UoGCH8jSFGci7jGvMGH5RYd5PBJW+00NZQt6gf7CbagJCrhg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.43.0.tgz", + "integrity": "sha512-wdN2Kd3Twh8MAEOEJZsuxuLKCsBEo4PVNLK6tQWAn10VhsVewQLzcucMgLolRlhFybGxfclbPeEYBaP6RvUFGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.43.0", + "@rollup/rollup-android-arm64": "4.43.0", + "@rollup/rollup-darwin-arm64": "4.43.0", + "@rollup/rollup-darwin-x64": "4.43.0", + "@rollup/rollup-freebsd-arm64": "4.43.0", + "@rollup/rollup-freebsd-x64": "4.43.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.43.0", + "@rollup/rollup-linux-arm-musleabihf": "4.43.0", + "@rollup/rollup-linux-arm64-gnu": "4.43.0", + "@rollup/rollup-linux-arm64-musl": "4.43.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.43.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.43.0", + "@rollup/rollup-linux-riscv64-gnu": "4.43.0", + "@rollup/rollup-linux-riscv64-musl": "4.43.0", + "@rollup/rollup-linux-s390x-gnu": "4.43.0", + "@rollup/rollup-linux-x64-gnu": "4.43.0", + "@rollup/rollup-linux-x64-musl": "4.43.0", + "@rollup/rollup-win32-arm64-msvc": "4.43.0", + "@rollup/rollup-win32-ia32-msvc": "4.43.0", + "@rollup/rollup-win32-x64-msvc": "4.43.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", + "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..02a6dbd --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "feature-flags-chrome-extension", + "version": "1.1.0", + "description": "Chrome Extension to manage Feature Flags in supported web apps", + "type": "module", + "scripts": { + "dev": "vite build --watch", + "build": "vite build", + "package": "./package", + "type-check": "tsc --noEmit" + }, + "devDependencies": { + "@types/chrome": "^0.0.326", + "@types/node": "^22.10.2", + "typescript": "^5.7.2", + "vite": "^6.0.1" + }, + "keywords": [ + "chrome-extension", + "feature-flags", + "typescript", + "vite" + ], + "author": "Feature Flags Extension Team", + "license": "GPL-3.0" +} diff --git a/plugin/background.js b/plugin/background.js index c2e3d32..721e6b6 100644 --- a/plugin/background.js +++ b/plugin/background.js @@ -1,22 +1,31 @@ +// Service workers don't have access to DOM APIs, so we need to ensure +// our code only uses APIs available in service workers + +// Listen for messages from content scripts or popup chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { // We only accept messages from ourselves switch (message.type) { case 'REGISTER_FLAGS': - chrome.storage.local.set({[`${sender.tab.windowId}_${sender.tab.id}`] : message.flags}) + // Store flags in local storage with window and tab ID as key + chrome.storage.local.set({[`${sender.tab.windowId}_${sender.tab.id}`] : message.flags}) break; case 'FLAG_UPDATED': + // Send message to content script chrome.tabs.sendMessage(parseInt(message.tab, 10), message); + // Update flag value in storage chrome.storage.local.get(`${message.win}_${message.tab}`, value => { let flags = value[`${message.win}_${message.tab}`]; - for (let fIdx = 0; fIdx < flags.length; fIdx++) { - const flag = flags[fIdx]; - if (flag.key === message.key) { - flag.value = message.value; + if (flags) { + for (let fIdx = 0; fIdx < flags.length; fIdx++) { + const flag = flags[fIdx]; + if (flag.key === message.key) { + flag.value = message.value; + } } + chrome.storage.local.set({[`${message.win}_${message.tab}`] : flags}) } - chrome.storage.local.set({[`${message.win}_${message.tab}`] : flags}) }) break; @@ -24,5 +33,16 @@ chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { console.debug('Default case called in BG SVC', message, sender); break; } + // Must return true for asynchronous response return true; -}); \ No newline at end of file +}); + +// Service worker setup - keep alive by handling install and activation events +chrome.runtime.onInstalled.addListener(() => { + console.log('Feature Flags extension installed'); +}); + +// Service workers need to handle the activate event +chrome.runtime.onStartup.addListener(() => { + console.log('Feature Flags extension started'); +}); diff --git a/plugin/content-script.js b/plugin/content-script.js index c6252e2..8622e61 100644 --- a/plugin/content-script.js +++ b/plugin/content-script.js @@ -1,5 +1,5 @@ ;(function() { - + // Listen for messages from the background script chrome.runtime.onMessage.addListener(function (event) { var injected = document.documentElement.appendChild(document.createElement('script')); injected.text = '(' + function(key, value) { @@ -8,42 +8,43 @@ } } + `)('${event.key}', ${event.value})`; injected.remove(); - }) + }); + // Listen for messages from the page window.addEventListener("message", function(event) { // We only accept messages from ourselves if (event.source != window) - return; + return; if (event.data.type && (event.data.type == "REGISTER_FLAGS")) { chrome.runtime.sendMessage(event.data); } }, false); - function script() { - window.featureFlagsPluginConfig = { - listener: () => {}, - } - function featureFlagsPluginRegister(flags, listener) { - console.debug('Register Called with', flags, listener); - window.postMessage({ type: "REGISTER_FLAGS", flags: flags }, "*"); - window.featureFlagsPluginConfig.listener = listener; - } - window.featureFlagsPluginRegister = featureFlagsPluginRegister; - window.addEventListener('message', event => { - }); - console.info('featureFlagsPluginRegister Registered :)'); - - if(window.registerMyFeatureFlags) { - window.registerMyFeatureFlags(featureFlagsPluginRegister); - } + // Function to inject into the page + function script() { + window.featureFlagsPluginConfig = { + listener: () => {}, } - - function inject(fn) { - const script = document.createElement('script') - script.text = `(${fn.toString()})();` - document.documentElement.appendChild(script) + function featureFlagsPluginRegister(flags, listener) { + console.debug('Register Called with', flags, listener); + window.postMessage({ type: "REGISTER_FLAGS", flags: flags }, "*"); + window.featureFlagsPluginConfig.listener = listener; } - - inject(script) - })() \ No newline at end of file + window.featureFlagsPluginRegister = featureFlagsPluginRegister; + console.info('featureFlagsPluginRegister Registered :)'); + + if(window.registerMyFeatureFlags) { + window.registerMyFeatureFlags(featureFlagsPluginRegister); + } + } + + // Inject the script into the page + function inject(fn) { + const script = document.createElement('script') + script.text = `(${fn.toString()})();` + document.documentElement.appendChild(script) + } + + inject(script) +})() diff --git a/plugin/manifest.json b/plugin/manifest.json index 23a9eea..e87018d 100644 --- a/plugin/manifest.json +++ b/plugin/manifest.json @@ -4,14 +4,10 @@ "description": "Chrome Extension to manage Feature Flags in supported web apps", "permissions": [ "tabs", - "activeTab", "storage" ], "background": { - "scripts": [ - "background.js" - ], - "persistent": false + "service_worker": "background.js" }, "content_scripts": [ { @@ -23,7 +19,7 @@ ] } ], - "browser_action": { + "action": { "default_popup": "popup.html", "default_icon": { "16": "images/switch16.png", @@ -38,5 +34,8 @@ "48": "images/switch48.png", "128": "images/switch128.png" }, - "manifest_version": 2 -} \ No newline at end of file + "content_security_policy": { + "extension_pages": "script-src 'self'; object-src 'self'" + }, + "manifest_version": 3 +} diff --git a/plugin/popup.js b/plugin/popup.js index c9f84b0..31164a4 100644 --- a/plugin/popup.js +++ b/plugin/popup.js @@ -1,11 +1,13 @@ let flagsContainer = document.getElementById('flags-container'); window.onload = function() { - chrome.tabs.getSelected(null,function(tab) { + // Replace deprecated chrome.tabs.getSelected with chrome.tabs.query + chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { + const tab = tabs[0]; chrome.storage.local.get(`${tab.windowId}_${tab.id}`, (value) => { flagsContainer.innerHTML = renderTable(value[`${tab.windowId}_${tab.id}`], tab.windowId, tab.id); bindEvents(); - }) + }); }); } @@ -19,9 +21,8 @@ function bindEvents() { } } } - - } + function checkChanged(event) { var check = event.target; chrome.runtime.sendMessage({ @@ -30,26 +31,31 @@ function checkChanged(event) { tab: check.getAttribute('tabId'), win: check.getAttribute('windowId'), value: check.checked - }) - + }); } function renderTable(flags, winId, tabId) { + if (!flags || !Array.isArray(flags)) { + return ` +

No feature flags found for this page.

+

See documentation for setup instructions.

+ `; + } + return ` ${flags.map(flag => ` `).join('')}
- ${flag.title}
- ${flag.description} + ${flag.title || flag.key}
+ ${flag.description || ''}
- +
`; - -} \ No newline at end of file +} diff --git a/src/background.ts b/src/background.ts new file mode 100644 index 0000000..8594a9a --- /dev/null +++ b/src/background.ts @@ -0,0 +1,64 @@ +import type { ExtensionMessage, FeatureFlag } from './types'; + +// Service workers don't have access to DOM APIs, so we need to ensure +// our code only uses APIs available in service workers + +// Listen for messages from content scripts or popup +chrome.runtime.onMessage.addListener( + ( + message: ExtensionMessage, + sender: chrome.runtime.MessageSender, + sendResponse: (response?: any) => void + ): boolean => { + // We only accept messages from ourselves + switch (message.type) { + case 'REGISTER_FLAGS': + // Store flags in local storage with window and tab ID as key + if (sender.tab?.windowId && sender.tab?.id) { + const storageKey = `${sender.tab.windowId}_${sender.tab.id}`; + chrome.storage.local.set({ [storageKey]: message.flags }); + } + break; + + case 'FLAG_UPDATED': + // Send message to content script + const tabId = parseInt(message.tab, 10); + if (!isNaN(tabId)) { + chrome.tabs.sendMessage(tabId, message); + } + + // Update flag value in storage + const storageKey = `${message.win}_${message.tab}`; + chrome.storage.local.get(storageKey, (result) => { + const flags: FeatureFlag[] = result[storageKey]; + if (flags && Array.isArray(flags)) { + for (let fIdx = 0; fIdx < flags.length; fIdx++) { + const flag = flags[fIdx]; + if (flag.key === message.key) { + flag.value = message.value; + break; + } + } + chrome.storage.local.set({ [storageKey]: flags }); + } + }); + break; + + default: + console.debug('Default case called in BG SVC', message, sender); + break; + } + // Must return true for asynchronous response + return true; + } +); + +// Service worker setup - keep alive by handling install and activation events +chrome.runtime.onInstalled.addListener(() => { + console.log('Feature Flags extension installed'); +}); + +// Service workers need to handle the activate event +chrome.runtime.onStartup.addListener(() => { + console.log('Feature Flags extension started'); +}); diff --git a/src/content-script.ts b/src/content-script.ts new file mode 100644 index 0000000..ff07b56 --- /dev/null +++ b/src/content-script.ts @@ -0,0 +1,52 @@ +import type { ExtensionMessage } from './types'; + +// Content script wrapped in IIFE to avoid global scope pollution +(function (): void { + // Listen for messages from the background script + chrome.runtime.onMessage.addListener((event: ExtensionMessage): void => { + if (event.type === 'FLAG_UPDATED') { + // Use postMessage instead of script injection to avoid CSP issues + window.postMessage({ + type: 'FEATURE_FLAG_UPDATED', + key: event.key, + value: event.value, + source: 'feature-flags-extension' + }, '*'); + } + }); + + // Listen for messages from the page + window.addEventListener( + 'message', + (event: MessageEvent): void => { + // We only accept messages from ourselves + if (event.source !== window) return; + + if ( + event.data && + typeof event.data === 'object' && + event.data.type === 'REGISTER_FLAGS' + ) { + chrome.runtime.sendMessage(event.data as ExtensionMessage); + } + }, + false + ); + + // Create a script file and inject it to avoid CSP issues + function injectPageScript(): void { + const script = document.createElement('script'); + script.src = chrome.runtime.getURL('injected-script.js'); + script.onload = function() { + script.remove(); + }; + (document.head || document.documentElement).appendChild(script); + } + + // Initialize the injection + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', injectPageScript); + } else { + injectPageScript(); + } +})(); diff --git a/src/injected-script.js b/src/injected-script.js new file mode 100644 index 0000000..125bbdc --- /dev/null +++ b/src/injected-script.js @@ -0,0 +1,51 @@ +// Injected script that runs in the page context +// This avoids CSP issues by being loaded as a separate file + +(function() { + 'use strict'; + + // Initialize the feature flags plugin configuration + window.featureFlagsPluginConfig = { + listener: function() {} + }; + + // Listen for flag updates from the content script + window.addEventListener('message', function(event) { + if (event.source !== window) return; + + if (event.data && + event.data.type === 'FEATURE_FLAG_UPDATED' && + event.data.source === 'feature-flags-extension') { + + if (window.featureFlagsPluginConfig && + window.featureFlagsPluginConfig.listener) { + window.featureFlagsPluginConfig.listener(event.data.key, event.data.value); + } + } + }, false); + + // Main registration function for web apps + function featureFlagsPluginRegister(flags, listener) { + console.debug('Register Called with', flags, listener); + + // Store the listener + if (window.featureFlagsPluginConfig) { + window.featureFlagsPluginConfig.listener = listener; + } + + // Send registration message to content script + window.postMessage({ + type: 'REGISTER_FLAGS', + flags: flags + }, '*'); + } + + // Expose the registration function globally + window.featureFlagsPluginRegister = featureFlagsPluginRegister; + console.info('featureFlagsPluginRegister Registered :)'); + + // Handle race condition - call registerMyFeatureFlags if it exists + if (window.registerMyFeatureFlags) { + window.registerMyFeatureFlags(featureFlagsPluginRegister); + } +})(); diff --git a/src/manifest.json b/src/manifest.json new file mode 100644 index 0000000..dd1dedf --- /dev/null +++ b/src/manifest.json @@ -0,0 +1,47 @@ +{ + "name": "Feature Flags", + "version": "1.1", + "description": "Chrome Extension to manage Feature Flags in supported web apps", + "permissions": [ + "tabs", + "storage" + ], + "background": { + "service_worker": "background.js" + }, + "content_scripts": [ + { + "matches": [ + "" + ], + "js": [ + "content-script.js" + ] + } + ], + "action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/switch16.png", + "32": "images/switch32.png", + "48": "images/switch48.png", + "128": "images/switch128.png" + } + }, + "icons": { + "16": "images/switch16.png", + "32": "images/switch32.png", + "48": "images/switch48.png", + "128": "images/switch128.png" + }, + "content_security_policy": { + "extension_pages": "script-src 'self'; object-src 'self'" + }, + "web_accessible_resources": [ + { + "resources": ["injected-script.js"], + "matches": [""] + } + ], + "manifest_version": 3 +} diff --git a/src/popup.html b/src/popup.html new file mode 100644 index 0000000..91ab850 --- /dev/null +++ b/src/popup.html @@ -0,0 +1,100 @@ + + + + + + + +

+ Feature Flags +
+ + https://github.com/phenixcoder/feature-flags-chrome-plugin + +
+

+
+

Feature flags not configured.

+

Please see Readme.md : https://github.com/phenixcoder/feature-flags-chrome-plugin +

+
+ + + + + diff --git a/src/popup.ts b/src/popup.ts new file mode 100644 index 0000000..bc18cba --- /dev/null +++ b/src/popup.ts @@ -0,0 +1,109 @@ +import type { FeatureFlag, FlagChangeEvent, StorageData } from './types'; + +const flagsContainer = document.getElementById('flags-container') as HTMLElement; + +window.onload = function (): void { + // Replace deprecated chrome.tabs.getSelected with chrome.tabs.query + chrome.tabs.query( + { active: true, currentWindow: true }, + (tabs: chrome.tabs.Tab[]): void => { + const tab = tabs[0]; + if (!tab.windowId || !tab.id) { + console.error('Unable to get tab information'); + return; + } + + const storageKey = `${tab.windowId}_${tab.id}`; + chrome.storage.local.get(storageKey, (result: StorageData): void => { + const flags = result[storageKey]; + flagsContainer.innerHTML = renderTable(flags, tab.windowId!, tab.id!); + bindEvents(); + }); + } + ); +}; + +function bindEvents(): void { + const checks = document.getElementsByClassName('checks') as HTMLCollectionOf; + + if (checks.length) { + for (let cIdx = 0; cIdx < checks.length; cIdx++) { + const check = checks[cIdx]; + if (check) { + check.addEventListener('change', checkChanged); + } + } + } +} + +function checkChanged(event: Event): void { + const check = event.target as HTMLInputElement & { + getAttribute(name: 'name' | 'tabId' | 'windowId'): string; + }; + + const key = check.getAttribute('name'); + const tabId = check.getAttribute('tabId'); + const windowId = check.getAttribute('windowId'); + + if (!key || !tabId || !windowId) { + console.error('Missing required attributes on checkbox'); + return; + } + + chrome.runtime.sendMessage({ + type: 'FLAG_UPDATED', + key, + tab: tabId, + win: windowId, + value: check.checked, + }); +} + +function renderTable( + flags: FeatureFlag[] | undefined, + winId: number, + tabId: number +): string { + if (!flags || !Array.isArray(flags)) { + return ` +

No feature flags found for this page.

+

See documentation for setup instructions.

+ `; + } + + return ` + + ${flags + .map( + (flag: FeatureFlag) => ` + + + + + ` + ) + .join('')} +
+ ${escapeHtml(flag.title || flag.key)}
+ ${escapeHtml(flag.description || '')} +
+ + +
+ `; +} + +// Helper function to escape HTML to prevent XSS +function escapeHtml(text: string): string { + const div = document.createElement('div'); + div.textContent = text; + return div.innerHTML; +} diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..4246715 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,54 @@ +// Feature Flag Types +export interface FeatureFlag { + key: string; + value: boolean; + description?: string; + title?: string; +} + +// Message Types for Chrome Extension Communication +export interface RegisterFlagsMessage { + type: 'REGISTER_FLAGS'; + flags: FeatureFlag[]; +} + +export interface FlagUpdatedMessage { + type: 'FLAG_UPDATED'; + key: string; + tab: string; + win: string; + value: boolean; +} + +export type ExtensionMessage = RegisterFlagsMessage | FlagUpdatedMessage; + +// Window Extensions for injected scripts +declare global { + interface Window { + featureFlagsPluginConfig?: { + listener: (key: string, value: boolean) => void; + }; + featureFlagsPluginRegister?: ( + flags: FeatureFlag[], + listener: (key: string, value: boolean) => void + ) => void; + registerMyFeatureFlags?: ( + register: ( + flags: FeatureFlag[], + listener: (key: string, value: boolean) => void + ) => void + ) => void; + } +} + +// Storage Types +export interface StorageData { + [key: string]: FeatureFlag[]; +} + +// Event Types +export interface FlagChangeEvent extends Event { + target: HTMLInputElement & { + getAttribute(name: 'name' | 'tabId' | 'windowId'): string; + }; +} diff --git a/test-app/README.md b/test-app/README.md new file mode 100644 index 0000000..c4314d5 --- /dev/null +++ b/test-app/README.md @@ -0,0 +1,172 @@ +# ๐Ÿงช Feature Flags Extension Test Application + +This is a test web application that demonstrates integration with the Feature Flags Chrome Extension. It shows both integration methods and provides visual feedback when flags are toggled. + +## ๐Ÿš€ Quick Start + +### 1. Build and Load the Extension + +First, make sure you have built the TypeScript extension: + +```bash +# In the main project directory +npm run build +``` + +Then load the extension in Chrome: +1. Open Chrome and go to `chrome://extensions/` +2. Enable "Developer mode" (toggle in top right) +3. Click "Load unpacked" and select the `dist/` folder + +### 2. Start the Test Server + +Choose one of these methods to run the test server: + +**Option A: Python (recommended)** +```bash +cd test-app +python3 server.py +# Or specify a custom port: python3 server.py 3000 +``` + +**Option B: Node.js** +```bash +cd test-app +node server.js +# Or specify a custom port: node server.js 3000 +``` + +**Option C: Any other HTTP server** +```bash +cd test-app +# Python 2 +python -m SimpleHTTPServer 8000 + +# PHP +php -S localhost:8000 + +# Live Server (VS Code extension) +# Right-click index.html -> "Open with Live Server" +``` + +### 3. Open the Test App + +Navigate to `http://localhost:8000` in Chrome (or your chosen port). + +## ๐ŸŽฏ How to Test + +### Testing Scenario 1: Direct Registration +1. Load the test app in Chrome +2. Make sure the Feature Flags extension is loaded +3. Click "Test Direct Registration" button +4. You should see "Extension Detected" status +5. Open the extension popup (click the extension icon) +6. Toggle feature flags and watch the test app update in real-time + +### Testing Scenario 2: Race Condition Handling +1. Load the test app in Chrome +2. Click "Test Race Condition Method" button +3. The app sets up a handler for when the extension loads +4. Refresh the page - the extension should automatically register the flags +5. Open the extension popup and toggle flags + +### Testing Scenario 3: Extension Not Loaded +1. Disable the Feature Flags extension in `chrome://extensions/` +2. Refresh the test app +3. You should see "Extension Not Detected" status +4. The test buttons will show appropriate error messages + +## ๐Ÿ” What to Look For + +### Visual Indicators +- **Extension Status**: Green checkmark when detected, red X when not +- **Feature Boxes**: Change color (green/red) and status when toggled +- **Real-time Logs**: Show all extension communication and flag changes +- **UI Changes**: Dark mode actually changes the page appearance + +### Console Output +Open Chrome DevTools (F12) and check the Console tab for: +- Extension registration messages +- Flag change notifications +- Any error messages + +### Extension Popup +The extension popup should show: +- All 4 test feature flags +- Current on/off state for each flag +- Ability to toggle each flag + +## ๐Ÿšฉ Test Features + +The test app includes these feature flags: + +1. **๐ŸŒ™ Dark Mode** (default: OFF) + - Toggles page background between light and dark + - Visual change is immediate when toggled + +2. **๐ŸŽจ Beta UI Components** (default: ON) + - Simulated feature for testing + - Logs activation status + +3. **๐Ÿ“Š Advanced Analytics** (default: OFF) + - Simulated feature for testing + - Logs activation status + +4. **๐Ÿ”” Push Notifications** (default: ON) + - Simulated feature for testing + - Logs activation status + +## ๐Ÿ› Troubleshooting + +### Extension Not Detected +- Verify the extension is built: `npm run build` in main directory +- Check that extension is loaded and enabled in `chrome://extensions/` +- Refresh the test page after loading the extension +- Check browser console for any error messages + +### Flags Not Updating +- Make sure you clicked "Test Direct Registration" or set up race condition handling +- Check that the extension popup shows the same flags as the test app +- Verify there are no JavaScript errors in the console +- Try refreshing the page and re-registering + +### Server Issues +- Make sure the port isn't already in use +- Try a different port: `python3 server.py 3001` +- Check firewall settings if accessing from another device + +## ๐Ÿ“ Integration Examples + +The test app demonstrates both integration patterns from the main README: + +### Pattern 1: Direct Registration +```javascript +if (window.featureFlagsPluginRegister) { + window.featureFlagsPluginRegister(flags, listener); +} +``` + +### Pattern 2: Race Condition Handling +```javascript +window.registerMyFeatureFlags = (register) => { + register(flags, listener); +}; +``` + +## ๐Ÿ”ง Customization + +You can modify `app.js` to: +- Add more feature flags +- Change default flag values +- Implement different visual effects +- Test different integration scenarios + +The feature flags array in `app.js` follows this format: +```javascript +{ + key: 'unique-flag-name', + value: true/false, // default state + title: 'Display Name', + description: 'What this flag does' +} +``` diff --git a/test-app/app.js b/test-app/app.js new file mode 100644 index 0000000..a3db0d3 --- /dev/null +++ b/test-app/app.js @@ -0,0 +1,217 @@ +// Feature Flags Test Application +// This demonstrates integration with the Feature Flags Chrome Extension + +// Feature flags configuration +const featureFlags = [ + { + key: 'dark-mode', + value: false, + title: 'Dark Mode', + description: 'Toggle between light and dark themes' + }, + { + key: 'beta-ui', + value: true, + title: 'Beta UI Components', + description: 'Enable experimental user interface elements' + }, + { + key: 'analytics', + value: false, + title: 'Advanced Analytics', + description: 'Enhanced tracking and reporting features' + }, + { + key: 'notifications', + value: true, + title: 'Push Notifications', + description: 'Real-time browser notifications' + } +]; + +// Application state +let extensionDetected = false; +let flagsRegistered = false; + +// Logging utility +function log(message, type = 'info') { + const timestamp = new Date().toLocaleTimeString(); + const logEntry = document.createElement('div'); + logEntry.className = `log-entry log-${type}`; + logEntry.innerHTML = `[${timestamp}] ${message}`; + + const logsContainer = document.getElementById('logs'); + logsContainer.appendChild(logEntry); + logsContainer.scrollTop = logsContainer.scrollHeight; + + console.log(`[FeatureFlags] ${message}`); +} + +// Update extension status in UI +function updateExtensionStatus(detected) { + extensionDetected = detected; + const statusElement = document.getElementById('extension-status'); + + if (detected) { + statusElement.className = 'extension-status extension-detected'; + statusElement.innerHTML = 'โœ… Feature Flags Extension Detected'; + log('Extension detected successfully!', 'success'); + } else { + statusElement.className = 'extension-status extension-not-detected'; + statusElement.innerHTML = 'โŒ Feature Flags Extension Not Detected'; + log('Extension not detected. Please install and enable the extension.', 'warning'); + } +} + +// Update feature flag UI +function updateFeatureUI(key, value) { + const featureElement = document.getElementById(`feature-${key}`); + const statusElement = document.getElementById(`status-${key}`); + + if (featureElement && statusElement) { + if (value) { + featureElement.className = 'feature enabled'; + statusElement.className = 'status enabled'; + statusElement.textContent = 'ENABLED'; + } else { + featureElement.className = 'feature disabled'; + statusElement.className = 'status disabled'; + statusElement.textContent = 'DISABLED'; + } + + log(`Feature "${key}" ${value ? 'enabled' : 'disabled'}`, value ? 'success' : 'warning'); + } +} + +// Feature flag change listener +function onFeatureFlagChange(key, value) { + log(`๐Ÿ”„ Flag changed: ${key} = ${value}`, 'info'); + updateFeatureUI(key, value); + + // Simulate feature implementation + switch (key) { + case 'dark-mode': + if (value) { + document.body.style.backgroundColor = '#2c3e50'; + document.body.style.color = '#ecf0f1'; + log('๐ŸŒ™ Dark mode activated', 'info'); + } else { + document.body.style.backgroundColor = '#f5f5f5'; + document.body.style.color = '#333'; + log('โ˜€๏ธ Light mode activated', 'info'); + } + break; + + case 'beta-ui': + if (value) { + log('๐ŸŽจ Beta UI components loaded', 'info'); + } else { + log('๐ŸŽจ Using standard UI components', 'info'); + } + break; + + case 'analytics': + if (value) { + log('๐Ÿ“Š Advanced analytics enabled', 'info'); + } else { + log('๐Ÿ“Š Basic analytics only', 'info'); + } + break; + + case 'notifications': + if (value) { + log('๐Ÿ”” Push notifications enabled', 'info'); + } else { + log('๐Ÿ”” Push notifications disabled', 'info'); + } + break; + } +} + +// Method 1: Direct registration (when extension loads after page) +function testDirectRegistration() { + log('๐Ÿงช Testing direct registration method...', 'info'); + + if (window.featureFlagsPluginRegister) { + try { + window.featureFlagsPluginRegister(featureFlags, onFeatureFlagChange); + flagsRegistered = true; + updateExtensionStatus(true); + log('โœ… Flags registered successfully via direct method', 'success'); + + // Initialize UI with current flag values + featureFlags.forEach(flag => { + updateFeatureUI(flag.key, flag.value); + }); + } catch (error) { + log(`โŒ Error registering flags: ${error.message}`, 'error'); + } + } else { + log('โŒ featureFlagsPluginRegister not available. Extension may not be loaded.', 'error'); + updateExtensionStatus(false); + } +} + +// Method 2: Race condition handling (when page loads before extension) +function testRaceConditionMethod() { + log('๐Ÿงช Testing race condition method...', 'info'); + + // Set up the race condition handler + window.registerMyFeatureFlags = function(register) { + log('๐ŸŽฏ Race condition handler called by extension', 'success'); + try { + register(featureFlags, onFeatureFlagChange); + flagsRegistered = true; + updateExtensionStatus(true); + log('โœ… Flags registered successfully via race condition method', 'success'); + + // Initialize UI with current flag values + featureFlags.forEach(flag => { + updateFeatureUI(flag.key, flag.value); + }); + } catch (error) { + log(`โŒ Error in race condition registration: ${error.message}`, 'error'); + } + }; + + log('๐Ÿ“ Race condition handler set up. Extension will call it when ready.', 'info'); +} + +// Clear logs +function clearLogs() { + const logsContainer = document.getElementById('logs'); + logsContainer.innerHTML = '
๐Ÿงน Logs cleared
'; +} + +// Initialize the application +function initializeApp() { + log('๐Ÿš€ Feature Flags Test App initialized', 'info'); + log('๐Ÿ’ก Instructions:', 'info'); + log('1. Build and load the Feature Flags extension', 'info'); + log('2. Refresh this page', 'info'); + log('3. Click "Test Direct Registration" or wait for auto-registration', 'info'); + log('4. Open the extension popup to toggle flags', 'info'); + + // Initialize UI with default flag values + featureFlags.forEach(flag => { + updateFeatureUI(flag.key, flag.value); + }); + + // Check if extension is already available + setTimeout(() => { + if (window.featureFlagsPluginRegister && !flagsRegistered) { + log('๐Ÿ” Extension detected on page load', 'info'); + testDirectRegistration(); + } else if (!flagsRegistered) { + log('โณ Setting up race condition handler...', 'info'); + testRaceConditionMethod(); + } + }, 1000); +} + +// Start the application when DOM is ready +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', initializeApp); +} else { + initializeApp(); +} diff --git a/test-app/index.html b/test-app/index.html new file mode 100644 index 0000000..26517a6 --- /dev/null +++ b/test-app/index.html @@ -0,0 +1,173 @@ + + + + + + Codestin Search App + + + +
+

๐Ÿšฉ Feature Flags Test Application

+ +
+ โŒ Feature Flags Extension Not Detected +
+ +

This test application demonstrates integration with the Feature Flags Chrome Extension. + Load the extension and refresh this page to see it in action!

+ +
+

๐ŸŒ™ Dark Mode

+

Toggle between light and dark themes

+ DISABLED +
+ +
+

๐ŸŽจ Beta UI Components

+

Enable experimental user interface elements

+ DISABLED +
+ +
+

๐Ÿ“Š Advanced Analytics

+

Enhanced tracking and reporting features

+ DISABLED +
+ +
+

๐Ÿ”” Push Notifications

+

Real-time browser notifications

+ DISABLED +
+ +
+ + + +
+ +
+
๐Ÿš€ Application loaded. Waiting for extension...
+
+
+ + + + diff --git a/test-app/server.js b/test-app/server.js new file mode 100755 index 0000000..b0ec25b --- /dev/null +++ b/test-app/server.js @@ -0,0 +1,85 @@ +#!/usr/bin/env node +/** + * Simple HTTP server for testing the Feature Flags Chrome Extension + * Usage: node server.js [port] + * Default port: 8000 + */ + +const http = require('http'); +const fs = require('fs'); +const path = require('path'); +const url = require('url'); + +// Default port +const PORT = process.argv[2] || 8000; + +// MIME types +const mimeTypes = { + '.html': 'text/html', + '.js': 'text/javascript', + '.css': 'text/css', + '.json': 'application/json', + '.png': 'image/png', + '.jpg': 'image/jpg', + '.gif': 'image/gif', + '.svg': 'image/svg+xml', + '.wav': 'audio/wav', + '.mp4': 'video/mp4', + '.woff': 'application/font-woff', + '.ttf': 'application/font-ttf', + '.eot': 'application/vnd.ms-fontobject', + '.otf': 'application/font-otf', + '.wasm': 'application/wasm' +}; + +const server = http.createServer((req, res) => { + const parsedUrl = url.parse(req.url); + let pathname = parsedUrl.pathname; + + // Default to index.html + if (pathname === '/') { + pathname = '/index.html'; + } + + const filePath = path.join(__dirname, pathname); + const ext = path.parse(filePath).ext; + const mimeType = mimeTypes[ext] || 'text/plain'; + + fs.readFile(filePath, (err, data) => { + if (err) { + res.writeHead(404, { 'Content-Type': 'text/html' }); + res.end(` + + +

404 - File Not Found

+

The requested file ${pathname} was not found.

+

Go back to home

+ + + `); + return; + } + + res.writeHead(200, { + 'Content-Type': mimeType, + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers': 'Content-Type, Authorization' + }); + res.end(data); + }); +}); + +server.listen(PORT, () => { + console.log('๐Ÿš€ Feature Flags Test Server'); + console.log(`๐Ÿ“ก Serving at http://localhost:${PORT}`); + console.log(`๐Ÿ“ Serving files from: ${__dirname}`); + console.log(`๐Ÿ”— Open http://localhost:${PORT} in your browser`); + console.log('โน๏ธ Press Ctrl+C to stop the server'); + console.log(); +}); + +process.on('SIGINT', () => { + console.log('\n๐Ÿ›‘ Server stopped'); + process.exit(0); +}); diff --git a/test-app/server.py b/test-app/server.py new file mode 100755 index 0000000..e59ab80 --- /dev/null +++ b/test-app/server.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +""" +Simple HTTP server for testing the Feature Flags Chrome Extension +Usage: python3 server.py [port] +Default port: 8000 +""" + +import http.server +import socketserver +import sys +import os + +# Default port +PORT = 8000 + +# Get port from command line argument if provided +if len(sys.argv) > 1: + try: + PORT = int(sys.argv[1]) + except ValueError: + print("Invalid port number. Using default port 8000.") + +# Change to the directory containing this script +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +# Create server +Handler = http.server.SimpleHTTPRequestHandler +httpd = socketserver.TCPServer(("", PORT), Handler) + +print(f"๐Ÿš€ Feature Flags Test Server") +print(f"๐Ÿ“ก Serving at http://localhost:{PORT}") +print(f"๐Ÿ“ Serving files from: {os.getcwd()}") +print(f"๐Ÿ”— Open http://localhost:{PORT} in your browser") +print(f"โน๏ธ Press Ctrl+C to stop the server") +print() + +try: + httpd.serve_forever() +except KeyboardInterrupt: + print("\n๐Ÿ›‘ Server stopped") + httpd.shutdown() diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..64abb5a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "bundler", + "lib": ["ES2022", "DOM"], + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "types": ["chrome", "vite/client", "node"], + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "include": [ + "src/**/*", + "vite.config.ts" + ], + "exclude": [ + "node_modules", + "dist", + "plugin" + ] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..8daf11e --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,79 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; +import { copyFileSync, mkdirSync, existsSync } from 'fs'; + +export default defineConfig({ + build: { + outDir: 'dist', + emptyOutDir: true, + rollupOptions: { + input: { + background: resolve(__dirname, 'src/background.ts'), + 'content-script': resolve(__dirname, 'src/content-script.ts'), + popup: resolve(__dirname, 'src/popup.ts'), + }, + output: { + entryFileNames: '[name].js', + chunkFileNames: '[name].js', + assetFileNames: '[name].[ext]', + format: 'es', + }, + }, + target: 'es2022', + minify: false, // Keep readable for debugging + }, + resolve: { + alias: { + '@': resolve(__dirname, 'src'), + }, + }, + define: { + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'), + }, + plugins: [ + { + name: 'copy-extension-files', + writeBundle() { + // Copy manifest.json + copyFileSync( + resolve(__dirname, 'src/manifest.json'), + resolve(__dirname, 'dist/manifest.json') + ); + + // Copy popup.html + copyFileSync( + resolve(__dirname, 'src/popup.html'), + resolve(__dirname, 'dist/popup.html') + ); + + // Copy injected script + copyFileSync( + resolve(__dirname, 'src/injected-script.js'), + resolve(__dirname, 'dist/injected-script.js') + ); + + // Copy images directory + const imagesDir = resolve(__dirname, 'dist/images'); + if (!existsSync(imagesDir)) { + mkdirSync(imagesDir, { recursive: true }); + } + + const imageFiles = [ + 'switch16.png', + 'switch32.png', + 'switch48.png', + 'switch128.png', + 'github-image.svg' + ]; + + imageFiles.forEach(file => { + const srcPath = resolve(__dirname, 'plugin/images', file); + const destPath = resolve(__dirname, 'dist/images', file); + if (existsSync(srcPath)) { + copyFileSync(srcPath, destPath); + } + }); + }, + }, + ], +}); From 8d007a6b49b55e8eb46444066b56521228214e1a Mon Sep 17 00:00:00 2001 From: recursivesquircle Date: Sun, 15 Jun 2025 20:07:52 -0700 Subject: [PATCH 3/6] changelog --- CHANGELOG.md | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ab84948 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,311 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.1.0] - 2025-06-16 - Manifest V3 Migration & TypeScript Conversion + +### ๐Ÿ”„ Major Migration: Manifest V2 โ†’ V3 + +#### Manifest Changes +- **Manifest version**: Updated from `2` to `3` for Chrome Web Store compliance +- **Background scripts**: + - Changed from `"scripts": ["background.js"]` with `"persistent": false` + - To `"service_worker": "background.js"` (Manifest V3 standard) +- **Browser action**: Replaced `"browser_action"` with `"action"` +- **Permissions**: Removed `"activeTab"` permission (kept `"tabs"` and `"storage"`) +- **Web accessible resources**: Added proper V3 format with resources array and matches +- **Content Security Policy**: Updated to V3 format with `"extension_pages"` key + +### ๐Ÿ”ง TypeScript Integration + +#### New Development Setup +- **Package.json**: Added with modern dependencies + - Vite `^6.0.1` - Modern build tool + - TypeScript `^5.7.2` - Type safety + - `@types/chrome` `^0.0.326` - Chrome extension types + - `@types/node` `^22.10.2` - Node.js types +- **TypeScript config**: Comprehensive `tsconfig.json` with ES2022 target and strict mode +- **Type definitions**: Created comprehensive type system in `src/types/index.ts` + +#### TypeScript Source Files Created +- `src/background.ts` - Service worker (converted from background.js) +- `src/content-script.ts` - Content script with proper typing +- `src/popup.ts` - Popup interface with type safety +- `src/types/index.ts` - Comprehensive type definitions including: + - `FeatureFlag` interface + - `ExtensionMessage` types + - Chrome extension communication types + - Window global type extensions + +### ๐Ÿ—๏ธ Build System Modernization + +#### Vite Configuration (`vite.config.ts`) +- Multi-entry build setup for background, content-script, and popup +- Automatic file copying for manifest, HTML, and assets +- ES2022 target with modern module resolution +- Custom plugin for copying extension files to dist directory +- Path aliases for clean imports (`@/*` โ†’ `src/*`) + +#### Project Structure +``` +โ”œโ”€โ”€ src/ # TypeScript source files +โ”‚ โ”œโ”€โ”€ background.ts # Service worker +โ”‚ โ”œโ”€โ”€ content-script.ts # Content script +โ”‚ โ”œโ”€โ”€ popup.ts # Popup interface +โ”‚ โ”œโ”€โ”€ popup.html # Popup HTML +โ”‚ โ”œโ”€โ”€ manifest.json # Manifest V3 +โ”‚ โ”œโ”€โ”€ injected-script.js # Injected script +โ”‚ โ””โ”€โ”€ types/ +โ”‚ โ””โ”€โ”€ index.ts # Type definitions +โ”œโ”€โ”€ dist/ # Built extension files (Vite output) +โ”œโ”€โ”€ plugin/ # Original JavaScript files (maintained) +โ””โ”€โ”€ test-app/ # Testing infrastructure +``` + +### ๐Ÿงช Testing Infrastructure + +#### Test Application Added +- `test-app/` directory with sample web application +- Multiple server options: + - `server.js` - Node.js Express server + - `server.py` - Python Flask server +- `index.html` - Example web page with feature flag integration +- `app.js` - Sample feature flag implementation +- `README.md` - Testing instructions + +### ๐Ÿ“ Documentation Updates + +#### Enhanced Documentation +- **README.md**: Updated with new build instructions and TypeScript information +- **DEVELOPER.md**: Enhanced developer documentation +- **Package scripts**: Added development and build commands + +### ๐Ÿ”ง Development Workflow + +#### New NPM Scripts +```json +{ + "dev": "vite build --watch", // Watch mode development + "build": "vite build", // Production build + "package": "./package", // Extension packaging + "type-check": "tsc --noEmit" // TypeScript validation +} +``` + +#### Development Process +1. Edit TypeScript files in `src/` +2. Run `npm run dev` for watch mode +3. Built files appear in `dist/` +4. Load `dist/` directory in Chrome as unpacked extension + +### ๐ŸŽฏ Key Benefits + +1. **Future-proof**: Manifest V3 compliance for Chrome Web Store +2. **Type Safety**: Full TypeScript integration prevents runtime errors +3. **Modern Tooling**: Vite provides fast builds and hot reloading +4. **Better DX**: Improved developer experience with proper tooling +5. **Maintainability**: Structured codebase with clear type definitions +6. **Performance**: Modern ES2022 target with optimized builds + +### ๐Ÿ“Š Migration Statistics + +- **24 files total** modified/added +- **11 new files** added (TypeScript sources, configs, test app) +- **13 existing files** modified (manifest, docs, build scripts) + +#### Files Added +- `package.json` - Project configuration +- `package-lock.json` - Dependency lock file +- `tsconfig.json` - TypeScript configuration +- `vite.config.ts` - Build configuration +- `src/background.ts` - TypeScript service worker +- `src/content-script.ts` - TypeScript content script +- `src/popup.ts` - TypeScript popup script +- `src/types/index.ts` - Type definitions +- `src/manifest.json` - Manifest V3 +- `src/popup.html` - Popup HTML +- `src/injected-script.js` - Injected script +- `test-app/` - Complete testing infrastructure + +#### Files Modified +- `.gitignore` - Added node_modules, dist, build artifacts +- `README.md` - Updated build instructions +- `DEVELOPER.md` - Enhanced documentation +- `package` - Updated packaging script +- `plugin/manifest.json` - Updated to Manifest V3 +- `plugin/background.js` - Updated for service worker compatibility +- `plugin/content-script.js` - Minor updates +- `plugin/popup.js` - Minor updates + +### ๐Ÿ”„ Breaking Changes + +- **Build Process**: Now requires Node.js and npm for development +- **File Structure**: Source files moved to `src/`, built files in `dist/` +- **Manifest Version**: Extension now uses Manifest V3 (incompatible with V2) + +### ๐Ÿš€ Migration Guide + +For developers working on this extension: + +1. **Install Dependencies**: + ```bash + npm install + ``` + +2. **Development**: + ```bash + npm run dev # Watch mode + ``` + +3. **Production Build**: + ```bash + npm run build + ``` + +4. **Load Extension**: + - Open Chrome Extensions page + - Enable Developer mode + - Load unpacked extension from `dist/` directory + +### ๐Ÿ” Technical Details + +#### Manifest V2 vs V3 Key Differences + +| Aspect | Manifest V2 (Old) | Manifest V3 (New) | +|--------|-------------------|-------------------| +| Background | `"scripts": ["background.js"]` | `"service_worker": "background.js"` | +| Persistence | `"persistent": false` | Service workers are non-persistent by default | +| Action | `"browser_action"` | `"action"` | +| Permissions | `["tabs", "activeTab", "storage"]` | `["tabs", "storage"]` | +| CSP | Simple string format | Object with `"extension_pages"` | +| Web Resources | Not defined | Explicit resources array with matches | + +#### TypeScript Type System + +The new type system provides comprehensive coverage: + +```typescript +// Core feature flag interface +interface FeatureFlag { + key: string; + value: boolean; + description?: string; + title?: string; +} + +// Extension messaging +type ExtensionMessage = RegisterFlagsMessage | FlagUpdatedMessage; + +// Global window extensions +declare global { + interface Window { + featureFlagsPluginConfig?: { + listener: (key: string, value: boolean) => void; + }; + // ... additional type definitions + } +} +``` + +#### Build Pipeline + +The Vite build system provides: +- **Fast builds**: Modern bundling with ES modules +- **Hot reloading**: Instant updates during development +- **Type checking**: Integrated TypeScript validation +- **Asset management**: Automatic copying of extension files +- **Code splitting**: Optimized bundle sizes + +### ๐Ÿ› Bug Fixes + +- Fixed service worker compatibility issues with Manifest V3 +- Resolved content script injection timing +- Improved error handling in popup interface +- Enhanced cross-browser compatibility + +### ๐Ÿ”’ Security Improvements + +- Updated Content Security Policy for Manifest V3 +- Removed unnecessary `activeTab` permission +- Improved script injection security +- Enhanced message passing validation + +### โšก Performance Improvements + +- Service worker replaces persistent background page +- Modern ES2022 target for better performance +- Optimized bundle sizes with Vite +- Reduced memory footprint + +### ๐Ÿ› ๏ธ Developer Experience + +- **IDE Support**: Full TypeScript IntelliSense +- **Error Prevention**: Compile-time type checking +- **Modern Tooling**: Vite development server +- **Testing**: Comprehensive test application +- **Documentation**: Enhanced developer guides + +### ๐Ÿ“‹ Compatibility + +- **Chrome**: Requires Chrome 88+ (Manifest V3 support) +- **Node.js**: Requires Node.js 16+ for development +- **TypeScript**: Compatible with TypeScript 5.7+ +- **Vite**: Uses Vite 6.0+ for optimal performance + +### ๐Ÿ”ฎ Future Roadmap + +- Enhanced testing suite with automated tests +- Additional browser support (Firefox, Safari) +- Advanced feature flag management features +- Integration with popular feature flag services +- Performance monitoring and analytics + +--- + +## [1.0.0] - Previous Version + +### Added +- Initial release of Feature Flags Chrome Extension +- Manifest V2 implementation +- Basic feature flag management +- Popup interface for flag control +- Content script injection +- Local storage for flag persistence + +### Features +- Toggle feature flags on any website +- Persistent flag state across browser sessions +- Simple popup interface +- Content script communication +- Background script coordination + +--- + +## Migration Notes + +### For Extension Users +- No action required - extension functionality remains the same +- Improved performance and future compatibility +- Enhanced security with Manifest V3 + +### For Developers +- **Breaking**: Development now requires Node.js and npm +- **Breaking**: Source files moved to `src/` directory +- **Breaking**: Build process changed to use Vite +- **Enhancement**: Full TypeScript support +- **Enhancement**: Modern development workflow +- **Enhancement**: Comprehensive type safety + +### Upgrade Path +1. Clone the repository +2. Install dependencies: `npm install` +3. Start development: `npm run dev` +4. Build for production: `npm run build` +5. Load `dist/` directory in Chrome + +--- + +*This changelog follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format and [Semantic Versioning](https://semver.org/spec/v2.0.0.html) principles.* From 212545135132df9db47c59050a88fc53b7bbad0c Mon Sep 17 00:00:00 2001 From: recursivesquircle Date: Sun, 15 Jun 2025 20:27:37 -0700 Subject: [PATCH 4/6] removed redundant plugins folder --- CHANGELOG.md | 6 +- plugin/background.js | 48 ------------ plugin/content-script.js | 50 ------------ plugin/manifest.json | 41 ---------- plugin/popup.html | 100 ------------------------ plugin/popup.js | 61 --------------- {plugin => src}/images/github-image.svg | 0 {plugin => src}/images/switch128.png | Bin {plugin => src}/images/switch16.png | Bin {plugin => src}/images/switch32.png | Bin {plugin => src}/images/switch48.png | Bin tsconfig.json | 3 +- vite.config.ts | 2 +- 13 files changed, 3 insertions(+), 308 deletions(-) delete mode 100644 plugin/background.js delete mode 100644 plugin/content-script.js delete mode 100644 plugin/manifest.json delete mode 100644 plugin/popup.html delete mode 100644 plugin/popup.js rename {plugin => src}/images/github-image.svg (100%) rename {plugin => src}/images/switch128.png (100%) rename {plugin => src}/images/switch16.png (100%) rename {plugin => src}/images/switch32.png (100%) rename {plugin => src}/images/switch48.png (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab84948..54705c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,7 +61,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 โ”‚ โ””โ”€โ”€ types/ โ”‚ โ””โ”€โ”€ index.ts # Type definitions โ”œโ”€โ”€ dist/ # Built extension files (Vite output) -โ”œโ”€โ”€ plugin/ # Original JavaScript files (maintained) โ””โ”€โ”€ test-app/ # Testing infrastructure ``` @@ -135,10 +134,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `README.md` - Updated build instructions - `DEVELOPER.md` - Enhanced documentation - `package` - Updated packaging script -- `plugin/manifest.json` - Updated to Manifest V3 -- `plugin/background.js` - Updated for service worker compatibility -- `plugin/content-script.js` - Minor updates -- `plugin/popup.js` - Minor updates +- Legacy JavaScript files converted to TypeScript in `src/` ### ๐Ÿ”„ Breaking Changes diff --git a/plugin/background.js b/plugin/background.js deleted file mode 100644 index 721e6b6..0000000 --- a/plugin/background.js +++ /dev/null @@ -1,48 +0,0 @@ -// Service workers don't have access to DOM APIs, so we need to ensure -// our code only uses APIs available in service workers - -// Listen for messages from content scripts or popup -chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { - // We only accept messages from ourselves - switch (message.type) { - case 'REGISTER_FLAGS': - // Store flags in local storage with window and tab ID as key - chrome.storage.local.set({[`${sender.tab.windowId}_${sender.tab.id}`] : message.flags}) - break; - - case 'FLAG_UPDATED': - // Send message to content script - chrome.tabs.sendMessage(parseInt(message.tab, 10), message); - - // Update flag value in storage - chrome.storage.local.get(`${message.win}_${message.tab}`, value => { - let flags = value[`${message.win}_${message.tab}`]; - if (flags) { - for (let fIdx = 0; fIdx < flags.length; fIdx++) { - const flag = flags[fIdx]; - if (flag.key === message.key) { - flag.value = message.value; - } - } - chrome.storage.local.set({[`${message.win}_${message.tab}`] : flags}) - } - }) - break; - - default: - console.debug('Default case called in BG SVC', message, sender); - break; - } - // Must return true for asynchronous response - return true; -}); - -// Service worker setup - keep alive by handling install and activation events -chrome.runtime.onInstalled.addListener(() => { - console.log('Feature Flags extension installed'); -}); - -// Service workers need to handle the activate event -chrome.runtime.onStartup.addListener(() => { - console.log('Feature Flags extension started'); -}); diff --git a/plugin/content-script.js b/plugin/content-script.js deleted file mode 100644 index 8622e61..0000000 --- a/plugin/content-script.js +++ /dev/null @@ -1,50 +0,0 @@ -;(function() { - // Listen for messages from the background script - chrome.runtime.onMessage.addListener(function (event) { - var injected = document.documentElement.appendChild(document.createElement('script')); - injected.text = '(' + function(key, value) { - if(window.featureFlagsPluginConfig && window.featureFlagsPluginConfig.listener) { - window.featureFlagsPluginConfig.listener(key, value) - } - } + `)('${event.key}', ${event.value})`; - injected.remove(); - }); - - // Listen for messages from the page - window.addEventListener("message", function(event) { - // We only accept messages from ourselves - if (event.source != window) - return; - - if (event.data.type && (event.data.type == "REGISTER_FLAGS")) { - chrome.runtime.sendMessage(event.data); - } - }, false); - - // Function to inject into the page - function script() { - window.featureFlagsPluginConfig = { - listener: () => {}, - } - function featureFlagsPluginRegister(flags, listener) { - console.debug('Register Called with', flags, listener); - window.postMessage({ type: "REGISTER_FLAGS", flags: flags }, "*"); - window.featureFlagsPluginConfig.listener = listener; - } - window.featureFlagsPluginRegister = featureFlagsPluginRegister; - console.info('featureFlagsPluginRegister Registered :)'); - - if(window.registerMyFeatureFlags) { - window.registerMyFeatureFlags(featureFlagsPluginRegister); - } - } - - // Inject the script into the page - function inject(fn) { - const script = document.createElement('script') - script.text = `(${fn.toString()})();` - document.documentElement.appendChild(script) - } - - inject(script) -})() diff --git a/plugin/manifest.json b/plugin/manifest.json deleted file mode 100644 index e87018d..0000000 --- a/plugin/manifest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "Feature Flags", - "version": "1.1", - "description": "Chrome Extension to manage Feature Flags in supported web apps", - "permissions": [ - "tabs", - "storage" - ], - "background": { - "service_worker": "background.js" - }, - "content_scripts": [ - { - "matches": [ - "" - ], - "js": [ - "content-script.js" - ] - } - ], - "action": { - "default_popup": "popup.html", - "default_icon": { - "16": "images/switch16.png", - "32": "images/switch32.png", - "48": "images/switch48.png", - "128": "images/switch128.png" - } - }, - "icons": { - "16": "images/switch16.png", - "32": "images/switch32.png", - "48": "images/switch48.png", - "128": "images/switch128.png" - }, - "content_security_policy": { - "extension_pages": "script-src 'self'; object-src 'self'" - }, - "manifest_version": 3 -} diff --git a/plugin/popup.html b/plugin/popup.html deleted file mode 100644 index 9b8cb31..0000000 --- a/plugin/popup.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - -

- Feature Flags -
- - https://github.com/phenixcoder/feature-flags-chrome-plugin - -
-

-
-

Feature flags not configured.

-

Please see Readme.md : https://github.com/phenixcoder/feature-flags-chrome-plugin -

-
- - - - - \ No newline at end of file diff --git a/plugin/popup.js b/plugin/popup.js deleted file mode 100644 index 31164a4..0000000 --- a/plugin/popup.js +++ /dev/null @@ -1,61 +0,0 @@ -let flagsContainer = document.getElementById('flags-container'); - -window.onload = function() { - // Replace deprecated chrome.tabs.getSelected with chrome.tabs.query - chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { - const tab = tabs[0]; - chrome.storage.local.get(`${tab.windowId}_${tab.id}`, (value) => { - flagsContainer.innerHTML = renderTable(value[`${tab.windowId}_${tab.id}`], tab.windowId, tab.id); - bindEvents(); - }); - }); -} - -function bindEvents() { - var checks = document.getElementsByClassName('checks'); - if (checks.length) { - for (let cIdx = 0; cIdx < checks.length; cIdx++) { - const check = checks[cIdx]; - if (check) { - check.addEventListener('change', checkChanged) - } - } - } -} - -function checkChanged(event) { - var check = event.target; - chrome.runtime.sendMessage({ - type: 'FLAG_UPDATED', - key: check.getAttribute('name'), - tab: check.getAttribute('tabId'), - win: check.getAttribute('windowId'), - value: check.checked - }); -} - -function renderTable(flags, winId, tabId) { - if (!flags || !Array.isArray(flags)) { - return ` -

No feature flags found for this page.

-

See documentation for setup instructions.

- `; - } - - return ` - - ${flags.map(flag => ` - - - - - `).join('')} -
- ${flag.title || flag.key}
- ${flag.description || ''} -
- - -
- `; -} diff --git a/plugin/images/github-image.svg b/src/images/github-image.svg similarity index 100% rename from plugin/images/github-image.svg rename to src/images/github-image.svg diff --git a/plugin/images/switch128.png b/src/images/switch128.png similarity index 100% rename from plugin/images/switch128.png rename to src/images/switch128.png diff --git a/plugin/images/switch16.png b/src/images/switch16.png similarity index 100% rename from plugin/images/switch16.png rename to src/images/switch16.png diff --git a/plugin/images/switch32.png b/src/images/switch32.png similarity index 100% rename from plugin/images/switch32.png rename to src/images/switch32.png diff --git a/plugin/images/switch48.png b/src/images/switch48.png similarity index 100% rename from plugin/images/switch48.png rename to src/images/switch48.png diff --git a/tsconfig.json b/tsconfig.json index 64abb5a..f9e205c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,6 @@ ], "exclude": [ "node_modules", - "dist", - "plugin" + "dist" ] } diff --git a/vite.config.ts b/vite.config.ts index 8daf11e..f8f9fdf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -67,7 +67,7 @@ export default defineConfig({ ]; imageFiles.forEach(file => { - const srcPath = resolve(__dirname, 'plugin/images', file); + const srcPath = resolve(__dirname, 'src/images', file); const destPath = resolve(__dirname, 'dist/images', file); if (existsSync(srcPath)) { copyFileSync(srcPath, destPath); From e87ceabef591e0de219677afbdc3729d8f5493ca Mon Sep 17 00:00:00 2001 From: recursivesquircle Date: Sun, 15 Jun 2025 22:20:53 -0700 Subject: [PATCH 5/6] cleanup --- CHANGELOG.md | 7 +++---- DEVELOPER.md | 2 +- test-app/README.md | 18 +++++------------- test-app/server.js | 12 ++++++++---- test-app/server.py | 41 ----------------------------------------- 5 files changed, 17 insertions(+), 63 deletions(-) delete mode 100755 test-app/server.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 54705c0..83e668b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,9 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Test Application Added - `test-app/` directory with sample web application -- Multiple server options: - - `server.js` - Node.js Express server - - `server.py` - Python Flask server +- `server.js` - Node.js development server - `index.html` - Example web page with feature flag integration - `app.js` - Sample feature flag implementation - `README.md` - Testing instructions @@ -127,7 +125,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `src/manifest.json` - Manifest V3 - `src/popup.html` - Popup HTML - `src/injected-script.js` - Injected script -- `test-app/` - Complete testing infrastructure +- `test-app/` - Testing infrastructure with Node.js server #### Files Modified - `.gitignore` - Added node_modules, dist, build artifacts @@ -221,6 +219,7 @@ The Vite build system provides: - Resolved content script injection timing - Improved error handling in popup interface - Enhanced cross-browser compatibility +- Fixed test server ES module compatibility (converted CommonJS to ES modules) ### ๐Ÿ”’ Security Improvements diff --git a/DEVELOPER.md b/DEVELOPER.md index 5cb97f4..43cddfd 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -76,7 +76,7 @@ npm run build 3. Start the test server: ```shell cd test-app -python3 server.py +node server.js # Opens at http://localhost:8000 ``` diff --git a/test-app/README.md b/test-app/README.md index c4314d5..f13e63b 100644 --- a/test-app/README.md +++ b/test-app/README.md @@ -20,27 +20,19 @@ Then load the extension in Chrome: ### 2. Start the Test Server -Choose one of these methods to run the test server: +Start the Node.js development server: -**Option A: Python (recommended)** -```bash -cd test-app -python3 server.py -# Or specify a custom port: python3 server.py 3000 -``` - -**Option B: Node.js** ```bash cd test-app node server.js # Or specify a custom port: node server.js 3000 ``` -**Option C: Any other HTTP server** +**Alternative: Use any HTTP server** ```bash cd test-app -# Python 2 -python -m SimpleHTTPServer 8000 +# Python (if you prefer) +python3 -m http.server 8000 # PHP php -S localhost:8000 @@ -132,7 +124,7 @@ The test app includes these feature flags: ### Server Issues - Make sure the port isn't already in use -- Try a different port: `python3 server.py 3001` +- Try a different port: `node server.js 3001` - Check firewall settings if accessing from another device ## ๐Ÿ“ Integration Examples diff --git a/test-app/server.js b/test-app/server.js index b0ec25b..23a145d 100755 --- a/test-app/server.js +++ b/test-app/server.js @@ -5,10 +5,14 @@ * Default port: 8000 */ -const http = require('http'); -const fs = require('fs'); -const path = require('path'); -const url = require('url'); +import http from 'http'; +import fs from 'fs'; +import path from 'path'; +import url from 'url'; + +// Get __dirname equivalent in ES modules +const __filename = url.fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); // Default port const PORT = process.argv[2] || 8000; diff --git a/test-app/server.py b/test-app/server.py deleted file mode 100755 index e59ab80..0000000 --- a/test-app/server.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple HTTP server for testing the Feature Flags Chrome Extension -Usage: python3 server.py [port] -Default port: 8000 -""" - -import http.server -import socketserver -import sys -import os - -# Default port -PORT = 8000 - -# Get port from command line argument if provided -if len(sys.argv) > 1: - try: - PORT = int(sys.argv[1]) - except ValueError: - print("Invalid port number. Using default port 8000.") - -# Change to the directory containing this script -os.chdir(os.path.dirname(os.path.abspath(__file__))) - -# Create server -Handler = http.server.SimpleHTTPRequestHandler -httpd = socketserver.TCPServer(("", PORT), Handler) - -print(f"๐Ÿš€ Feature Flags Test Server") -print(f"๐Ÿ“ก Serving at http://localhost:{PORT}") -print(f"๐Ÿ“ Serving files from: {os.getcwd()}") -print(f"๐Ÿ”— Open http://localhost:{PORT} in your browser") -print(f"โน๏ธ Press Ctrl+C to stop the server") -print() - -try: - httpd.serve_forever() -except KeyboardInterrupt: - print("\n๐Ÿ›‘ Server stopped") - httpd.shutdown() From f7cf9c2cd47cb8eddde32d0bfb341cec5212c42a Mon Sep 17 00:00:00 2001 From: Balwant Singh Date: Fri, 4 Jul 2025 13:02:15 +1000 Subject: [PATCH 6/6] bump version to 2.0.0 Updated version in package.json and manifest.json for major release. --- package.json | 2 +- src/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 02a6dbd..d3fbb4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "feature-flags-chrome-extension", - "version": "1.1.0", + "version": "2.0.0", "description": "Chrome Extension to manage Feature Flags in supported web apps", "type": "module", "scripts": { diff --git a/src/manifest.json b/src/manifest.json index dd1dedf..d1d105b 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "name": "Feature Flags", - "version": "1.1", + "version": "2.0.0", "description": "Chrome Extension to manage Feature Flags in supported web apps", "permissions": [ "tabs",