teloce-npm 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- teloce_npm-0.1.0/LICENSE +80 -0
- teloce_npm-0.1.0/PKG-INFO +154 -0
- teloce_npm-0.1.0/README.md +109 -0
- teloce_npm-0.1.0/pyproject.toml +138 -0
- teloce_npm-0.1.0/setup.cfg +4 -0
- teloce_npm-0.1.0/src/teloce_npm/__init__.py +135 -0
- teloce_npm-0.1.0/src/teloce_npm/__main__.py +272 -0
- teloce_npm-0.1.0/src/teloce_npm/adapters/__init__.py +14 -0
- teloce_npm-0.1.0/src/teloce_npm/adapters/adapter.py +233 -0
- teloce_npm-0.1.0/src/teloce_npm/bundler/__init__.py +14 -0
- teloce_npm-0.1.0/src/teloce_npm/bundler/asset_pipeline.py +138 -0
- teloce_npm-0.1.0/src/teloce_npm/bundler/minifyjs_bundler.py +272 -0
- teloce_npm-0.1.0/src/teloce_npm/cache/__init__.py +14 -0
- teloce_npm-0.1.0/src/teloce_npm/cache/manager.py +179 -0
- teloce_npm-0.1.0/src/teloce_npm/cache/storage.py +143 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/__init__.py +106 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/add.py +32 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/clean.py +37 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/doctor.py +65 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/info.py +43 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/install.py +733 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/list.py +36 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/remove.py +59 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/search.py +40 -0
- teloce_npm-0.1.0/src/teloce_npm/commands/update.py +80 -0
- teloce_npm-0.1.0/src/teloce_npm/config/__init__.py +13 -0
- teloce_npm-0.1.0/src/teloce_npm/config/defaults.py +69 -0
- teloce_npm-0.1.0/src/teloce_npm/config/loader.py +132 -0
- teloce_npm-0.1.0/src/teloce_npm/config/schema.py +189 -0
- teloce_npm-0.1.0/src/teloce_npm/downloader/__init__.py +11 -0
- teloce_npm-0.1.0/src/teloce_npm/downloader/extractor.py +131 -0
- teloce_npm-0.1.0/src/teloce_npm/downloader/tarball.py +176 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/__init__.py +61 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/loader_js.py +66 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/manifest.py +94 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/templates/loader.js.tmpl +261 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/templates/manifest.json.tmpl +7 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/templates/use.js.tmpl +119 -0
- teloce_npm-0.1.0/src/teloce_npm/generator/use_js.py +54 -0
- teloce_npm-0.1.0/src/teloce_npm/injector/__init__.py +55 -0
- teloce_npm-0.1.0/src/teloce_npm/injector/html_scanner.py +37 -0
- teloce_npm-0.1.0/src/teloce_npm/injector/injector.py +73 -0
- teloce_npm-0.1.0/src/teloce_npm/injector/tag_generator.py +25 -0
- teloce_npm-0.1.0/src/teloce_npm/lockfile/__init__.py +26 -0
- teloce_npm-0.1.0/src/teloce_npm/lockfile/manager.py +174 -0
- teloce_npm-0.1.0/src/teloce_npm/lockfile/schema.py +136 -0
- teloce_npm-0.1.0/src/teloce_npm/lockfile/verifier.py +157 -0
- teloce_npm-0.1.0/src/teloce_npm/registry/__init__.py +13 -0
- teloce_npm-0.1.0/src/teloce_npm/registry/client.py +86 -0
- teloce_npm-0.1.0/src/teloce_npm/registry/metadata.py +52 -0
- teloce_npm-0.1.0/src/teloce_npm/registry/version_resolver.py +199 -0
- teloce_npm-0.1.0/src/teloce_npm/scanner/__init__.py +12 -0
- teloce_npm-0.1.0/src/teloce_npm/scanner/file_walker.py +62 -0
- teloce_npm-0.1.0/src/teloce_npm/scanner/use_scanner.py +78 -0
- teloce_npm-0.1.0/src/teloce_npm/security/__init__.py +21 -0
- teloce_npm-0.1.0/src/teloce_npm/security/install_policy.py +76 -0
- teloce_npm-0.1.0/src/teloce_npm/security/integrity.py +53 -0
- teloce_npm-0.1.0/src/teloce_npm/security/malware_scanner.py +332 -0
- teloce_npm-0.1.0/src/teloce_npm/security/policy.py +143 -0
- teloce_npm-0.1.0/src/teloce_npm/security/validation.py +89 -0
- teloce_npm-0.1.0/src/teloce_npm/security/vulnerability.py +167 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/__init__.py +46 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/errors.py +42 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/file_io.py +50 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/hashing.py +84 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/logging.py +62 -0
- teloce_npm-0.1.0/src/teloce_npm/utils/retry.py +25 -0
- teloce_npm-0.1.0/src/teloce_npm/version.py +15 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/__init__.py +101 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/ast_parser.py +184 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/base.py +45 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/cjs.py +67 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/esm.py +147 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/life.py +37 -0
- teloce_npm-0.1.0/src/teloce_npm/wrapper/umd.py +42 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/PKG-INFO +154 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/SOURCES.txt +88 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/dependency_links.txt +1 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/entry_points.txt +2 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/requires.txt +16 -0
- teloce_npm-0.1.0/src/teloce_npm.egg-info/top_level.txt +1 -0
- teloce_npm-0.1.0/tests/test_cjs_require_detection.py +20 -0
- teloce_npm-0.1.0/tests/test_config.py +44 -0
- teloce_npm-0.1.0/tests/test_esm_exports.py +48 -0
- teloce_npm-0.1.0/tests/test_loader.py +75 -0
- teloce_npm-0.1.0/tests/test_manifest.py +86 -0
- teloce_npm-0.1.0/tests/test_public_api.py +31 -0
- teloce_npm-0.1.0/tests/test_runtime_ready.py +100 -0
- teloce_npm-0.1.0/tests/test_use_function.py +125 -0
- teloce_npm-0.1.0/tests/test_version.py +54 -0
teloce_npm-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
To apply the Apache License to your work, attach the following
|
|
60
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
61
|
+
replaced with your own identifying information. (Don't include
|
|
62
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
63
|
+
comment syntax for the file format. We also recommend that a file
|
|
64
|
+
or class name and description of purpose be included on the same
|
|
65
|
+
"printed page" as the copyright notice for easier identification
|
|
66
|
+
within third-party archives.
|
|
67
|
+
|
|
68
|
+
Copyright 2026 Aldane Hutchinson
|
|
69
|
+
|
|
70
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
71
|
+
you may not use this file except in compliance with the License.
|
|
72
|
+
You may obtain a copy of the License at
|
|
73
|
+
|
|
74
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
75
|
+
|
|
76
|
+
Unless required by applicable law or agreed to in writing, software
|
|
77
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
78
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
79
|
+
See the License for the specific language governing permissions and
|
|
80
|
+
limitations under the License.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: teloce-npm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Use npm packages in .vel files or plain html without Node.js or node_modules.
|
|
5
|
+
Author-email: Aldane Hutchinson <aldanehutchinson5@gmail.com>
|
|
6
|
+
Maintainer-email: Aldane Hutchinson <aldanehutchinson5@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/aldanedev-create/teloce-npm
|
|
9
|
+
Project-URL: Documentation, https://teloce-npm.readthedocs.io
|
|
10
|
+
Project-URL: Repository, https://github.com/aldanedev-create/teloce-npm
|
|
11
|
+
Project-URL: Issues, https://github.com/aldanedev-create/teloce-npm/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/aldanedev-create/teloce-npm/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: teloce,npm,javascript,vel,python,browser,flask,Fastapi,Django
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
26
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
27
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: requests<3.0,>=2.34.0
|
|
32
|
+
Requires-Dist: semver<4.0,>=3.0.4
|
|
33
|
+
Requires-Dist: tqdm<5.0,>=4.70.0
|
|
34
|
+
Requires-Dist: tree-sitter<0.27.0,>=0.26.0
|
|
35
|
+
Requires-Dist: tree-sitter-javascript<0.26.0,>=0.25.0
|
|
36
|
+
Requires-Dist: minifyjs<0.2.0,>=0.1.3
|
|
37
|
+
Requires-Dist: tomli<3.0,>=2.5.0; python_version < "3.11"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest<10.0,>=9.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov<8.0,>=7.0; extra == "dev"
|
|
41
|
+
Requires-Dist: black<27.0,>=26.0; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff<0.18.0,>=0.17.0; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy<3.0,>=2.4.0; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# Teloce-NPM
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
<a href="https://teloce-npm-docs.vercel.app/" target="_blank" rel="noopener noreferrer">Teloce NPM Docs</a>
|
|
50
|
+
<img src="https://raw.githubusercontent.com/aldanedev-create/teloce-npm/main/docs/public/logo.svg" alt="teloce-npm logo" width="200">
|
|
51
|
+
</a>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Documentation site
|
|
57
|
+
[Teloce-doc-site](https://teloce-npm-docs.vercel.app/)
|
|
58
|
+
|
|
59
|
+
Use npm packages in **plain HTML, CSS and JavaScript** or in [Teloce](https://pypi.org/project/teloce-py/) components, **without Node.js and without `node_modules`**.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<!-- index.html -->
|
|
64
|
+
<head>
|
|
65
|
+
<!--
|
|
66
|
+
Use dayjs from teloce-npm
|
|
67
|
+
-->
|
|
68
|
+
</head>
|
|
69
|
+
<body>
|
|
70
|
+
<p id="today"></p>
|
|
71
|
+
<script type="module">
|
|
72
|
+
await use.ready;
|
|
73
|
+
document.getElementById("today").textContent = use("dayjs")().format("dddd, MMMM D");
|
|
74
|
+
</script>
|
|
75
|
+
</body>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install teloce-npm
|
|
80
|
+
teloce-npm install # finds the Use line, downloads dayjs, wraps it, wires up your HTML
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
That is the whole workflow: declare what you need, run one command, call `use('name')`. The same works in Teloce components (`.vel` and `.html`), in [Flaxon](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/flaxon.md) apps and with [server-side rendering](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/ssr.md).
|
|
84
|
+
|
|
85
|
+
## How it works
|
|
86
|
+
|
|
87
|
+
1. **Scan.** `teloce-npm install` reads your `.html` and `.vel` files for `Use <package> from teloce-npm` lines.
|
|
88
|
+
2. **Download.** Each package is fetched from the npm registry and verified against its SHA-512 integrity hash.
|
|
89
|
+
3. **Check.** The package is scanned for dangerous code and looked up in the OSV vulnerability database.
|
|
90
|
+
4. **Wrap or bundle.** Plain scripts are wrapped so they expose a browser global. Packages that need it (ES modules with imports, CSS, fonts, workers, npm dependencies) are bundled with [MinifyJS](https://pypi.org/project/minifyjs/), an esbuild-based bundler for Python.
|
|
91
|
+
5. **Generate.** `loader.js`, `use.js` and `manifest.json` are written next to your static files, and two `<script>` tags are added to your page.
|
|
92
|
+
6. **Run.** In the browser the loader loads every package. `await use.ready` waits for it, and `use('name')` returns the package.
|
|
93
|
+
|
|
94
|
+
Everything is plain Python plus a bundled esbuild. Nothing needs Node.js at build time or at runtime.
|
|
95
|
+
|
|
96
|
+
## Quick start
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install teloce-npm
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- **Plain HTML, CSS and JavaScript:** follow [the guide](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/plain-html.md). Three files and any static server.
|
|
103
|
+
- **Teloce project:** follow [the walkthrough](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/getting-started.md) (also `pip install teloce-py`).
|
|
104
|
+
- **Flaxon:** [Using Teloce-NPM with Flaxon](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/flaxon.md).
|
|
105
|
+
|
|
106
|
+
Add or remove packages at any time:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
teloce-npm install lodash@4.17.21 # install and record in teloce-npm.json
|
|
110
|
+
teloce-npm remove lodash
|
|
111
|
+
teloce-npm list
|
|
112
|
+
teloce-npm doctor
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## What you get
|
|
116
|
+
|
|
117
|
+
- **No Node.js.** Pure Python. Works in a plain Python container or CI job.
|
|
118
|
+
- **Plain HTML or Teloce.** No framework required.
|
|
119
|
+
- **Reproducible.** `teloce-npm.lock` pins every version and integrity hash. `install --frozen-lockfile` is built for CI.
|
|
120
|
+
- **Secure by default.** Integrity checks, a code scanner, vulnerability lookups, download and extraction limits, and a registry host allowlist. See [Security](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/security.md).
|
|
121
|
+
- **Works with real libraries.** Tested with Monaco, Chart.js, D3, Three.js, Lodash, Day.js, marked + DOMPurify, PapaParse, Fuse.js, canvas-confetti, SortableJS, highlight.js and Supabase. See [`examples/`](https://github.com/aldanedev-create/teloce-npm/tree/main/examples).
|
|
122
|
+
- **Small runtime.** The browser side is two small generated files.
|
|
123
|
+
|
|
124
|
+
## Commands
|
|
125
|
+
|
|
126
|
+
| Command | What it does |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `teloce-npm install [pkg ...]` | Install everything declared in your files, or specific packages |
|
|
129
|
+
| `teloce-npm add <pkg>` | Alias for `install <pkg>` |
|
|
130
|
+
| `teloce-npm remove <pkg>` | Remove a package and its generated files |
|
|
131
|
+
| `teloce-npm update [pkg]` | Move to newer versions within your configured ranges |
|
|
132
|
+
| `teloce-npm list` | Show installed packages |
|
|
133
|
+
| `teloce-npm info <pkg>` | Show registry information about a package |
|
|
134
|
+
| `teloce-npm search <term>` | Search the registry |
|
|
135
|
+
| `teloce-npm doctor` | Check your setup |
|
|
136
|
+
| `teloce-npm clean` | Remove the cache, generated files and lockfile |
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## Documentation
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## Status
|
|
145
|
+
|
|
146
|
+
Version 0.1.0. The command line and the file formats may still change before 1.0.
|
|
147
|
+
|
|
148
|
+
## Contributing
|
|
149
|
+
|
|
150
|
+
See [CONTRIBUTING.md](https://github.com/aldanedev-create/teloce-npm/blob/main/CONTRIBUTING.md). Security issues: see the section there.
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
MIT. See [LICENSE](https://github.com/aldanedev-create/teloce-npm/blob/main/LICENSE).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Teloce-NPM
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://teloce-npm-docs.vercel.app/" target="_blank" rel="noopener noreferrer">Teloce NPM Docs</a>
|
|
5
|
+
<img src="https://raw.githubusercontent.com/aldanedev-create/teloce-npm/main/docs/public/logo.svg" alt="teloce-npm logo" width="200">
|
|
6
|
+
</a>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Documentation site
|
|
12
|
+
[Teloce-doc-site](https://teloce-npm-docs.vercel.app/)
|
|
13
|
+
|
|
14
|
+
Use npm packages in **plain HTML, CSS and JavaScript** or in [Teloce](https://pypi.org/project/teloce-py/) components, **without Node.js and without `node_modules`**.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<!-- index.html -->
|
|
19
|
+
<head>
|
|
20
|
+
<!--
|
|
21
|
+
Use dayjs from teloce-npm
|
|
22
|
+
-->
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<p id="today"></p>
|
|
26
|
+
<script type="module">
|
|
27
|
+
await use.ready;
|
|
28
|
+
document.getElementById("today").textContent = use("dayjs")().format("dddd, MMMM D");
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install teloce-npm
|
|
35
|
+
teloce-npm install # finds the Use line, downloads dayjs, wraps it, wires up your HTML
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
That is the whole workflow: declare what you need, run one command, call `use('name')`. The same works in Teloce components (`.vel` and `.html`), in [Flaxon](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/flaxon.md) apps and with [server-side rendering](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/ssr.md).
|
|
39
|
+
|
|
40
|
+
## How it works
|
|
41
|
+
|
|
42
|
+
1. **Scan.** `teloce-npm install` reads your `.html` and `.vel` files for `Use <package> from teloce-npm` lines.
|
|
43
|
+
2. **Download.** Each package is fetched from the npm registry and verified against its SHA-512 integrity hash.
|
|
44
|
+
3. **Check.** The package is scanned for dangerous code and looked up in the OSV vulnerability database.
|
|
45
|
+
4. **Wrap or bundle.** Plain scripts are wrapped so they expose a browser global. Packages that need it (ES modules with imports, CSS, fonts, workers, npm dependencies) are bundled with [MinifyJS](https://pypi.org/project/minifyjs/), an esbuild-based bundler for Python.
|
|
46
|
+
5. **Generate.** `loader.js`, `use.js` and `manifest.json` are written next to your static files, and two `<script>` tags are added to your page.
|
|
47
|
+
6. **Run.** In the browser the loader loads every package. `await use.ready` waits for it, and `use('name')` returns the package.
|
|
48
|
+
|
|
49
|
+
Everything is plain Python plus a bundled esbuild. Nothing needs Node.js at build time or at runtime.
|
|
50
|
+
|
|
51
|
+
## Quick start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install teloce-npm
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- **Plain HTML, CSS and JavaScript:** follow [the guide](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/plain-html.md). Three files and any static server.
|
|
58
|
+
- **Teloce project:** follow [the walkthrough](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/getting-started.md) (also `pip install teloce-py`).
|
|
59
|
+
- **Flaxon:** [Using Teloce-NPM with Flaxon](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/teloce/flaxon.md).
|
|
60
|
+
|
|
61
|
+
Add or remove packages at any time:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
teloce-npm install lodash@4.17.21 # install and record in teloce-npm.json
|
|
65
|
+
teloce-npm remove lodash
|
|
66
|
+
teloce-npm list
|
|
67
|
+
teloce-npm doctor
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## What you get
|
|
71
|
+
|
|
72
|
+
- **No Node.js.** Pure Python. Works in a plain Python container or CI job.
|
|
73
|
+
- **Plain HTML or Teloce.** No framework required.
|
|
74
|
+
- **Reproducible.** `teloce-npm.lock` pins every version and integrity hash. `install --frozen-lockfile` is built for CI.
|
|
75
|
+
- **Secure by default.** Integrity checks, a code scanner, vulnerability lookups, download and extraction limits, and a registry host allowlist. See [Security](https://github.com/aldanedev-create/teloce-npm/blob/main/docs/guide/security.md).
|
|
76
|
+
- **Works with real libraries.** Tested with Monaco, Chart.js, D3, Three.js, Lodash, Day.js, marked + DOMPurify, PapaParse, Fuse.js, canvas-confetti, SortableJS, highlight.js and Supabase. See [`examples/`](https://github.com/aldanedev-create/teloce-npm/tree/main/examples).
|
|
77
|
+
- **Small runtime.** The browser side is two small generated files.
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
| Command | What it does |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `teloce-npm install [pkg ...]` | Install everything declared in your files, or specific packages |
|
|
84
|
+
| `teloce-npm add <pkg>` | Alias for `install <pkg>` |
|
|
85
|
+
| `teloce-npm remove <pkg>` | Remove a package and its generated files |
|
|
86
|
+
| `teloce-npm update [pkg]` | Move to newer versions within your configured ranges |
|
|
87
|
+
| `teloce-npm list` | Show installed packages |
|
|
88
|
+
| `teloce-npm info <pkg>` | Show registry information about a package |
|
|
89
|
+
| `teloce-npm search <term>` | Search the registry |
|
|
90
|
+
| `teloce-npm doctor` | Check your setup |
|
|
91
|
+
| `teloce-npm clean` | Remove the cache, generated files and lockfile |
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Status
|
|
100
|
+
|
|
101
|
+
Version 0.1.0. The command line and the file formats may still change before 1.0.
|
|
102
|
+
|
|
103
|
+
## Contributing
|
|
104
|
+
|
|
105
|
+
See [CONTRIBUTING.md](https://github.com/aldanedev-create/teloce-npm/blob/main/CONTRIBUTING.md). Security issues: see the section there.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT. See [LICENSE](https://github.com/aldanedev-create/teloce-npm/blob/main/LICENSE).
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70.0,<80.0", "wheel>=0.45.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "teloce-npm"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
description = "Use npm packages in .vel files or plain html without Node.js or node_modules."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Aldane Hutchinson", email = "aldanehutchinson5@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "Aldane Hutchinson", email = "aldanehutchinson5@gmail.com" }
|
|
17
|
+
]
|
|
18
|
+
keywords = ["teloce", "npm", "javascript", "vel", "python", "browser", "flask", "Fastapi", "Django"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
30
|
+
|
|
31
|
+
"Topic :: Software Development :: Build Tools",
|
|
32
|
+
"Topic :: Software Development :: Code Generators",
|
|
33
|
+
"Topic :: Software Development :: Compilers",
|
|
34
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
35
|
+
]
|
|
36
|
+
requires-python = ">=3.9"
|
|
37
|
+
|
|
38
|
+
dependencies = [
|
|
39
|
+
"requests>=2.34.0,<3.0",
|
|
40
|
+
"semver>=3.0.4,<4.0",
|
|
41
|
+
"tqdm>=4.70.0,<5.0",
|
|
42
|
+
"tree-sitter>=0.26.0,<0.27.0",
|
|
43
|
+
"tree-sitter-javascript>=0.25.0,<0.26.0",
|
|
44
|
+
"minifyjs>=0.1.3,<0.2.0",
|
|
45
|
+
"tomli>=2.5.0,<3.0; python_version < '3.11'",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
# Development toolchain
|
|
50
|
+
dev = [
|
|
51
|
+
"pytest>=9.0,<10.0",
|
|
52
|
+
"pytest-cov>=7.0,<8.0",
|
|
53
|
+
"black>=26.0,<27.0",
|
|
54
|
+
"ruff>=0.17.0,<0.18.0",
|
|
55
|
+
"mypy>=2.4.0,<3.0",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[project.scripts]
|
|
59
|
+
teloce-npm = "teloce_npm.__main__:main"
|
|
60
|
+
|
|
61
|
+
[project.urls]
|
|
62
|
+
Homepage = "https://github.com/aldanedev-create/teloce-npm"
|
|
63
|
+
Documentation = "https://teloce-npm.readthedocs.io"
|
|
64
|
+
Repository = "https://github.com/aldanedev-create/teloce-npm"
|
|
65
|
+
Issues = "https://github.com/aldanedev-create/teloce-npm/issues"
|
|
66
|
+
Changelog = "https://github.com/aldanedev-create/teloce-npm/blob/main/CHANGELOG.md"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
[tool.setuptools.packages.find]
|
|
70
|
+
where = ["src"]
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.package-data]
|
|
73
|
+
teloce_npm = ["generator/templates/*.tmpl"]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
testpaths = ["tests"]
|
|
78
|
+
python_files = "test_*.py"
|
|
79
|
+
addopts = "-ra --strict-markers"
|
|
80
|
+
|
|
81
|
+
[tool.coverage.run]
|
|
82
|
+
source = ["src/teloce_npm"]
|
|
83
|
+
omit = [
|
|
84
|
+
"*/tests/*",
|
|
85
|
+
"*/__main__.py",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[tool.coverage.report]
|
|
89
|
+
exclude_lines = [
|
|
90
|
+
"pragma: no cover",
|
|
91
|
+
"if TYPE_CHECKING:",
|
|
92
|
+
"raise NotImplementedError",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
[tool.black]
|
|
97
|
+
line-length = 100
|
|
98
|
+
target-version = ["py39", "py310", "py311", "py312", "py313"]
|
|
99
|
+
|
|
100
|
+
[tool.ruff]
|
|
101
|
+
line-length = 100
|
|
102
|
+
target-version = "py39"
|
|
103
|
+
|
|
104
|
+
[tool.ruff.lint]
|
|
105
|
+
select = [
|
|
106
|
+
"E", # pycodestyle errors
|
|
107
|
+
"F", # pyflakes
|
|
108
|
+
"W", # pycodestyle warnings
|
|
109
|
+
"I", # isort
|
|
110
|
+
"N", # pep8-naming
|
|
111
|
+
"UP", # pyupgrade
|
|
112
|
+
"B", # flake8-bugbear
|
|
113
|
+
"C4", # flake8-comprehensions
|
|
114
|
+
"SIM", # flake8-simplify
|
|
115
|
+
"RUF", # ruff-specific rules
|
|
116
|
+
]
|
|
117
|
+
ignore = [
|
|
118
|
+
"E501", # line too long (handled by black)
|
|
119
|
+
"B008", # function call in default argument (needed for typer/argparse)
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[tool.ruff.lint.per-file-ignores]
|
|
123
|
+
"tests/**" = ["B011"] # allow assert False in tests
|
|
124
|
+
|
|
125
|
+
[tool.mypy]
|
|
126
|
+
|
|
127
|
+
python_version = "3.10"
|
|
128
|
+
warn_return_any = true
|
|
129
|
+
warn_unused_configs = true
|
|
130
|
+
warn_redundant_casts = true
|
|
131
|
+
warn_unused_ignores = true
|
|
132
|
+
no_implicit_optional = true
|
|
133
|
+
strict_equality = true
|
|
134
|
+
ignore_missing_imports = true
|
|
135
|
+
|
|
136
|
+
[[tool.mypy.overrides]]
|
|
137
|
+
module = ["tree_sitter", "tree_sitter_javascript", "minifyjs", "semver"]
|
|
138
|
+
ignore_missing_imports = true
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Teloce-NPM: Use npm packages in .vel files without Node.js or node_modules.
|
|
3
|
+
|
|
4
|
+
Teloce-NPM is a Python library that bridges the npm ecosystem and Python developers.
|
|
5
|
+
It downloads, verifies, wraps, and injects npm packages into your Teloce-Py project.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
>>> from teloce_npm import install
|
|
9
|
+
>>> install()
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Optional
|
|
14
|
+
|
|
15
|
+
from .version import __author__, __email__, __license__, __url__, __version__
|
|
16
|
+
|
|
17
|
+
# Public API exports
|
|
18
|
+
__all__ = [
|
|
19
|
+
"__author__",
|
|
20
|
+
"__email__",
|
|
21
|
+
"__license__",
|
|
22
|
+
"__url__",
|
|
23
|
+
"__version__",
|
|
24
|
+
"add",
|
|
25
|
+
"clean",
|
|
26
|
+
"doctor",
|
|
27
|
+
"install",
|
|
28
|
+
"remove",
|
|
29
|
+
"update",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def install(project_root: Optional[Path] = None, **kwargs):
|
|
34
|
+
"""
|
|
35
|
+
Install all packages declared in Use declarations.
|
|
36
|
+
|
|
37
|
+
This is the primary build command. It scans .vel and .html files for
|
|
38
|
+
Use <package> from teloce-npm declarations, downloads missing packages,
|
|
39
|
+
verifies their security, wraps them for the browser, and injects the
|
|
40
|
+
necessary <script> tags into the configured entry_html file.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
project_root: The project directory (default: the current directory).
|
|
44
|
+
**kwargs: Additional options passed to the InstallCommand.
|
|
45
|
+
See teloce_npm.commands.install.InstallCommand for details.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
49
|
+
"""
|
|
50
|
+
from .commands.install import InstallCommand
|
|
51
|
+
|
|
52
|
+
return InstallCommand(project_root=project_root).execute(**kwargs)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def add(package: str, project_root: Optional[Path] = None, **kwargs):
|
|
56
|
+
"""
|
|
57
|
+
Add a single package to the project.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
package: Package name (e.g., "lodash", "lodash@4.17.21", "lodash@^4.0.0").
|
|
61
|
+
project_root: The project directory (default: the current directory).
|
|
62
|
+
**kwargs: Additional options passed to the AddCommand.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
66
|
+
"""
|
|
67
|
+
from .commands.add import AddCommand
|
|
68
|
+
|
|
69
|
+
return AddCommand(project_root=project_root).execute(package, **kwargs)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def remove(package: str, project_root: Optional[Path] = None, **kwargs):
|
|
73
|
+
"""
|
|
74
|
+
Remove a package from the project.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
package: Package name to remove.
|
|
78
|
+
project_root: The project directory (default: the current directory).
|
|
79
|
+
**kwargs: Additional options passed to the RemoveCommand.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
83
|
+
"""
|
|
84
|
+
from .commands.remove import RemoveCommand
|
|
85
|
+
|
|
86
|
+
return RemoveCommand(project_root=project_root).execute(package, **kwargs)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def update(package: Optional[str] = None, project_root: Optional[Path] = None, **kwargs):
|
|
90
|
+
"""
|
|
91
|
+
Update packages to their latest allowed versions.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
package: Optional package name to update. If None, updates all packages.
|
|
95
|
+
project_root: The project directory (default: the current directory).
|
|
96
|
+
**kwargs: Additional options passed to the UpdateCommand.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
100
|
+
"""
|
|
101
|
+
from .commands.update import UpdateCommand
|
|
102
|
+
|
|
103
|
+
return UpdateCommand(project_root=project_root).execute(package, **kwargs)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def clean(project_root: Optional[Path] = None, **kwargs):
|
|
107
|
+
"""
|
|
108
|
+
Clear the cache and remove all generated files.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
project_root: The project directory (default: the current directory).
|
|
112
|
+
**kwargs: Additional options passed to the CleanCommand.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
116
|
+
"""
|
|
117
|
+
from .commands.clean import CleanCommand
|
|
118
|
+
|
|
119
|
+
return CleanCommand(project_root=project_root).execute(**kwargs)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def doctor(project_root: Optional[Path] = None, **kwargs):
|
|
123
|
+
"""
|
|
124
|
+
Diagnose configuration and security issues.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
project_root: The project directory (default: the current directory).
|
|
128
|
+
**kwargs: Additional options passed to the DoctorCommand.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
int: The exit code (0 on success, non-zero on failure).
|
|
132
|
+
"""
|
|
133
|
+
from .commands.doctor import DoctorCommand
|
|
134
|
+
|
|
135
|
+
return DoctorCommand(project_root=project_root).execute(**kwargs)
|