wexample-filestate-javascript 6.3.4__tar.gz → 6.4.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.
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/PKG-INFO +4 -4
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/README.md +2 -2
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/pyproject.toml +2 -2
- wexample_filestate_javascript-6.4.0/src/wexample_filestate_javascript/option/javascript/biome_option.py +98 -0
- wexample_filestate_javascript-6.3.4/src/wexample_filestate_javascript/option/javascript/biome_option.py +0 -43
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/config_option/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/config_option/biome_config_option.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/config_value/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/config_value/javascript_config_value.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/const/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/const/javascript_file.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/file/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/file/javascript_file.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/operation/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/operation/npm_package_lock_operation.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/option/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/option/javascript/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/option/javascript/abstract_javascript_file_content_option.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/option/javascript/npm_package_lock_option.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/option/javascript_option.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/options_provider/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/options_provider/javascript_options_provider.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/py.typed +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/resources/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/resources/docker/Dockerfile.javascript-option +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/resources/docker/__init__.py +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/src/wexample_filestate_javascript/resources/docker/biome.json +0 -0
- {wexample_filestate_javascript-6.3.4 → wexample_filestate_javascript-6.4.0}/tests/.gitkeep +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-filestate-javascript
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.4.0
|
|
4
4
|
Author-Email: weeger <contact@wexample.com>
|
|
5
5
|
License: MIT
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -9,7 +9,7 @@ Classifier: Operating System :: OS Independent
|
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Requires-Dist: attrs>=23.1.0
|
|
11
11
|
Requires-Dist: cattrs>=23.1.0
|
|
12
|
-
Requires-Dist: wexample-filestate>=
|
|
12
|
+
Requires-Dist: wexample-filestate>=12.0.0
|
|
13
13
|
Provides-Extra: dev
|
|
14
14
|
Requires-Dist: pytest; extra == "dev"
|
|
15
15
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
|
|
18
18
|
# filestate_javascript
|
|
19
19
|
|
|
20
|
-
Version: 6.
|
|
20
|
+
Version: 6.4.0
|
|
21
21
|
|
|
22
22
|
## Table of Contents
|
|
23
23
|
|
|
@@ -97,7 +97,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
|
|
|
97
97
|
|
|
98
98
|
- attrs: >=23.1.0
|
|
99
99
|
- cattrs: >=23.1.0
|
|
100
|
-
- wexample-filestate: >=
|
|
100
|
+
- wexample-filestate: >=12.0.0
|
|
101
101
|
|
|
102
102
|
## Versioning & Compatibility Policy
|
|
103
103
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# filestate_javascript
|
|
2
2
|
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.4.0
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -80,7 +80,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
|
|
|
80
80
|
|
|
81
81
|
- attrs: >=23.1.0
|
|
82
82
|
- cattrs: >=23.1.0
|
|
83
|
-
- wexample-filestate: >=
|
|
83
|
+
- wexample-filestate: >=12.0.0
|
|
84
84
|
|
|
85
85
|
## Versioning & Compatibility Policy
|
|
86
86
|
|
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "wexample-filestate-javascript"
|
|
9
|
-
version = "6.
|
|
9
|
+
version = "6.4.0"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "weeger", email = "contact@wexample.com" },
|
|
12
12
|
]
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
dependencies = [
|
|
20
20
|
"attrs>=23.1.0",
|
|
21
21
|
"cattrs>=23.1.0",
|
|
22
|
-
"wexample-filestate>=
|
|
22
|
+
"wexample-filestate>=12.0.0",
|
|
23
23
|
]
|
|
24
24
|
|
|
25
25
|
[project.readme]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from wexample_helpers.decorator.base_class import base_class
|
|
6
|
+
|
|
7
|
+
from .abstract_javascript_file_content_option import AbstractJavascriptFileContentOption
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from wexample_filestate.const.types_state_items import TargetFileOrDirectoryType
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@base_class
|
|
16
|
+
class BiomeOption(AbstractJavascriptFileContentOption):
|
|
17
|
+
# Auto-generated files Biome should not touch. Formatting them is
|
|
18
|
+
# pointless (they get regenerated by their tool) and Biome's output is
|
|
19
|
+
# sometimes non-idempotent on huge codegen trees (TanStack
|
|
20
|
+
# `routeTree.gen.ts`, GraphQL codegen schemas, Relay artifacts…) — which
|
|
21
|
+
# would cause an infinite rectify loop.
|
|
22
|
+
#
|
|
23
|
+
# We DO NOT exclude bare `.d.ts` files (often hand-written in libraries),
|
|
24
|
+
# nor `dist`/`build`/`node_modules` (those are already out of the
|
|
25
|
+
# filestate scope via gitignore + tree config — no need to defend here).
|
|
26
|
+
_GENERATED_FILE_SUFFIXES: tuple[str, ...] = (
|
|
27
|
+
# `.gen.*` — TanStack Router, Drizzle, various codegen
|
|
28
|
+
".gen.ts",
|
|
29
|
+
".gen.tsx",
|
|
30
|
+
".gen.js",
|
|
31
|
+
".gen.jsx",
|
|
32
|
+
".gen.mjs",
|
|
33
|
+
".gen.cjs",
|
|
34
|
+
# `.generated.*` — GraphQL codegen, Prisma client wrappers, MSW
|
|
35
|
+
".generated.ts",
|
|
36
|
+
".generated.tsx",
|
|
37
|
+
".generated.js",
|
|
38
|
+
".generated.jsx",
|
|
39
|
+
".generated.mjs",
|
|
40
|
+
".generated.cjs",
|
|
41
|
+
)
|
|
42
|
+
# Specific framework-generated files that don't carry a `.gen` suffix.
|
|
43
|
+
_GENERATED_FILE_BASENAMES: frozenset[str] = frozenset(
|
|
44
|
+
{
|
|
45
|
+
"next-env.d.ts", # regenerated by every `next build`
|
|
46
|
+
"vite-env.d.ts", # scaffolded by Vite, often re-emitted
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
# Path fragments indicating a directory of generated artifacts.
|
|
50
|
+
_GENERATED_PATH_FRAGMENTS: tuple[str, ...] = (
|
|
51
|
+
"/__generated__/", # Relay, Apollo, generic codegen convention
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def get_description(self) -> str:
|
|
55
|
+
return "Format and lint JavaScript/TypeScript code using Biome."
|
|
56
|
+
|
|
57
|
+
def _apply_content_change(self, target: TargetFileOrDirectoryType) -> str:
|
|
58
|
+
cache = self._get_or_build_batch_cache(target)
|
|
59
|
+
path_key = str(target.get_path())
|
|
60
|
+
if path_key in cache:
|
|
61
|
+
return cache[path_key]
|
|
62
|
+
return target.read_text()
|
|
63
|
+
|
|
64
|
+
def _is_excluded_from_batch(self, item: TargetFileOrDirectoryType) -> bool:
|
|
65
|
+
path = item.get_path()
|
|
66
|
+
name = path.name
|
|
67
|
+
if name in self._GENERATED_FILE_BASENAMES:
|
|
68
|
+
return True
|
|
69
|
+
if any(name.endswith(suffix) for suffix in self._GENERATED_FILE_SUFFIXES):
|
|
70
|
+
return True
|
|
71
|
+
path_str = str(path)
|
|
72
|
+
if any(fragment in path_str for fragment in self._GENERATED_PATH_FRAGMENTS):
|
|
73
|
+
return True
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
# Biome is RAM-hungry on large generated files; chunking avoids OOM kills
|
|
77
|
+
# (SIGKILL exit 137) when rectifying suites with 100+ TypeScript files.
|
|
78
|
+
_BATCH_CHUNK_SIZE: int = 30
|
|
79
|
+
|
|
80
|
+
def _run_batch_on_paths(
|
|
81
|
+
self,
|
|
82
|
+
reference_target: TargetFileOrDirectoryType,
|
|
83
|
+
paths: list[Path],
|
|
84
|
+
) -> None:
|
|
85
|
+
self._ensure_docker_container(reference_target)
|
|
86
|
+
runner = self._get_or_create_runner(reference_target)
|
|
87
|
+
for i in range(0, len(paths), self._BATCH_CHUNK_SIZE):
|
|
88
|
+
chunk = paths[i : i + self._BATCH_CHUNK_SIZE]
|
|
89
|
+
container_paths = [runner.rebase_path(p) for p in chunk]
|
|
90
|
+
runner.execute(
|
|
91
|
+
cmd=[
|
|
92
|
+
"biome",
|
|
93
|
+
"format",
|
|
94
|
+
"--write",
|
|
95
|
+
"--config-path=/tmp/biome.json",
|
|
96
|
+
*container_paths,
|
|
97
|
+
]
|
|
98
|
+
)
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
4
|
-
|
|
5
|
-
from wexample_helpers.decorator.base_class import base_class
|
|
6
|
-
|
|
7
|
-
from .abstract_javascript_file_content_option import AbstractJavascriptFileContentOption
|
|
8
|
-
|
|
9
|
-
if TYPE_CHECKING:
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
from wexample_filestate.const.types_state_items import TargetFileOrDirectoryType
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@base_class
|
|
16
|
-
class BiomeOption(AbstractJavascriptFileContentOption):
|
|
17
|
-
def get_description(self) -> str:
|
|
18
|
-
return "Format and lint JavaScript/TypeScript code using Biome."
|
|
19
|
-
|
|
20
|
-
def _apply_content_change(self, target: TargetFileOrDirectoryType) -> str:
|
|
21
|
-
cache = self._get_or_build_batch_cache(target)
|
|
22
|
-
path_key = str(target.get_path())
|
|
23
|
-
if path_key in cache:
|
|
24
|
-
return cache[path_key]
|
|
25
|
-
return target.read_text()
|
|
26
|
-
|
|
27
|
-
def _run_batch_on_paths(
|
|
28
|
-
self,
|
|
29
|
-
reference_target: TargetFileOrDirectoryType,
|
|
30
|
-
paths: list[Path],
|
|
31
|
-
) -> None:
|
|
32
|
-
self._ensure_docker_container(reference_target)
|
|
33
|
-
runner = self._get_or_create_runner(reference_target)
|
|
34
|
-
container_paths = [runner.rebase_path(p) for p in paths]
|
|
35
|
-
return runner.execute(
|
|
36
|
-
cmd=[
|
|
37
|
-
"biome",
|
|
38
|
-
"format",
|
|
39
|
-
"--write",
|
|
40
|
-
"--config-path=/tmp/biome.json",
|
|
41
|
-
*container_paths,
|
|
42
|
-
]
|
|
43
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|