modwire-extraction 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. modwire_extraction/__init__.py +3 -0
  2. modwire_extraction/_version.py +6 -0
  3. modwire_extraction/code/__init__.py +20 -0
  4. modwire_extraction/code/code_map.py +30 -0
  5. modwire_extraction/code/query.py +223 -0
  6. modwire_extraction/dependency/__init__.py +6 -0
  7. modwire_extraction/dependency/graph.py +126 -0
  8. modwire_extraction/extraction.py +35 -0
  9. modwire_extraction/extractors/__init__.py +2 -0
  10. modwire_extraction/extractors/languages/__init__.py +7 -0
  11. modwire_extraction/extractors/languages/base.py +219 -0
  12. modwire_extraction/extractors/languages/loader.py +28 -0
  13. modwire_extraction/extractors/languages/php/build.php +50 -0
  14. modwire_extraction/extractors/languages/php/composer.json +14 -0
  15. modwire_extraction/extractors/languages/php/composer.lock +77 -0
  16. modwire_extraction/extractors/languages/php/script.php +0 -0
  17. modwire_extraction/extractors/languages/php/script.src.php +785 -0
  18. modwire_extraction/extractors/languages/php/source.py +26 -0
  19. modwire_extraction/extractors/languages/python/script.py +1000 -0
  20. modwire_extraction/extractors/languages/python/source.py +21 -0
  21. modwire_extraction/extractors/languages/typescript/build.mjs +29 -0
  22. modwire_extraction/extractors/languages/typescript/package-lock.json +351 -0
  23. modwire_extraction/extractors/languages/typescript/package.json +16 -0
  24. modwire_extraction/extractors/languages/typescript/script.js +234645 -0
  25. modwire_extraction/extractors/languages/typescript/script.ts +1110 -0
  26. modwire_extraction/extractors/languages/typescript/source.py +26 -0
  27. modwire_extraction/extractors/languages/typescript/tsconfig.json +14 -0
  28. modwire_extraction/extractors/source.py +200 -0
  29. modwire_extraction-1.0.0.dist-info/METADATA +98 -0
  30. modwire_extraction-1.0.0.dist-info/RECORD +33 -0
  31. modwire_extraction-1.0.0.dist-info/WHEEL +5 -0
  32. modwire_extraction-1.0.0.dist-info/licenses/LICENSE +21 -0
  33. modwire_extraction-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,28 @@
1
+ from .base import SourceExtractor
2
+
3
+ from .php.source import PhpExtractor
4
+ from .python.source import PythonExtractor
5
+ from .typescript.source import TypeScriptExtractor
6
+
7
+
8
+ _map: dict[str, type[SourceExtractor]] = {
9
+ "python": PythonExtractor,
10
+ "typescript": TypeScriptExtractor,
11
+ "php": PhpExtractor,
12
+ }
13
+
14
+ _instances: dict[str, SourceExtractor] = {}
15
+
16
+
17
+ def get_supported_languages() -> tuple[str, ...]:
18
+ return tuple(_map)
19
+
20
+
21
+ def load_extractor(language: str) -> SourceExtractor:
22
+ if language not in _map:
23
+ raise ValueError(f"Unsupported language: {language}")
24
+
25
+ if language not in _instances:
26
+ _instances[language] = _map[language]()
27
+
28
+ return _instances[language]
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env php
2
+ <?php
3
+
4
+ declare(strict_types=1);
5
+
6
+ $root = __DIR__;
7
+ $output = $root . '/script.php';
8
+ $pharPath = $root . '/script.phar';
9
+
10
+ if (file_exists($output)) {
11
+ unlink($output);
12
+ }
13
+ if (file_exists($pharPath)) {
14
+ unlink($pharPath);
15
+ }
16
+
17
+ $phar = new Phar($pharPath);
18
+ $phar->startBuffering();
19
+ $phar->setSignatureAlgorithm(Phar::SHA256);
20
+ $phar->addFile($root . '/script.src.php', 'script.src.php');
21
+
22
+ $vendorRoot = $root . '/vendor';
23
+ if (!is_dir($vendorRoot)) {
24
+ fwrite(STDERR, "Composer vendor directory is missing. Run composer install first.\n");
25
+ exit(1);
26
+ }
27
+
28
+ $iterator = new RecursiveIteratorIterator(
29
+ new RecursiveDirectoryIterator($vendorRoot, FilesystemIterator::SKIP_DOTS)
30
+ );
31
+
32
+ foreach ($iterator as $file) {
33
+ if (!$file->isFile()) {
34
+ continue;
35
+ }
36
+ $path = $file->getPathname();
37
+ $relativePath = str_replace($root . '/', '', $path);
38
+ $phar->addFile($path, $relativePath);
39
+ }
40
+
41
+ $phar->setStub(<<<'PHP'
42
+ #!/usr/bin/env php
43
+ <?php
44
+ Phar::mapPhar('script.php');
45
+ require 'phar://script.php/script.src.php';
46
+ __HALT_COMPILER();
47
+ PHP);
48
+ $phar->stopBuffering();
49
+ rename($pharPath, $output);
50
+ chmod($output, 0755);
@@ -0,0 +1,14 @@
1
+ {
2
+ "private": true,
3
+ "type": "project",
4
+ "require": {
5
+ "nikic/php-parser": "^5.6"
6
+ },
7
+ "scripts": {
8
+ "build": "php -d phar.readonly=0 build.php",
9
+ "check": "php -l script.src.php && php -l build.php"
10
+ },
11
+ "config": {
12
+ "sort-packages": true
13
+ }
14
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "de5407c352f84127306c3094e846386a",
8
+ "packages": [
9
+ {
10
+ "name": "nikic/php-parser",
11
+ "version": "v5.7.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/nikic/PHP-Parser.git",
15
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
20
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "ext-ctype": "*",
25
+ "ext-json": "*",
26
+ "ext-tokenizer": "*",
27
+ "php": ">=7.4"
28
+ },
29
+ "require-dev": {
30
+ "ircmaxell/php-yacc": "^0.0.7",
31
+ "phpunit/phpunit": "^9.0"
32
+ },
33
+ "bin": [
34
+ "bin/php-parse"
35
+ ],
36
+ "type": "library",
37
+ "extra": {
38
+ "branch-alias": {
39
+ "dev-master": "5.x-dev"
40
+ }
41
+ },
42
+ "autoload": {
43
+ "psr-4": {
44
+ "PhpParser\\": "lib/PhpParser"
45
+ }
46
+ },
47
+ "notification-url": "https://packagist.org/downloads/",
48
+ "license": [
49
+ "BSD-3-Clause"
50
+ ],
51
+ "authors": [
52
+ {
53
+ "name": "Nikita Popov"
54
+ }
55
+ ],
56
+ "description": "A PHP parser written in PHP",
57
+ "keywords": [
58
+ "parser",
59
+ "php"
60
+ ],
61
+ "support": {
62
+ "issues": "https://github.com/nikic/PHP-Parser/issues",
63
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
64
+ },
65
+ "time": "2025-12-06T11:56:16+00:00"
66
+ }
67
+ ],
68
+ "packages-dev": [],
69
+ "aliases": [],
70
+ "minimum-stability": "stable",
71
+ "stability-flags": {},
72
+ "prefer-stable": false,
73
+ "prefer-lowest": false,
74
+ "platform": {},
75
+ "platform-dev": {},
76
+ "plugin-api-version": "2.6.0"
77
+ }