sass-embedded 0.0.0__py3-none-win_arm64.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.
- sass_embedded/__init__.py +7 -0
- sass_embedded/_const.py +7 -0
- sass_embedded/dart_sass/.gitignore +1 -0
- sass_embedded/dart_sass/__init__.py +122 -0
- sass_embedded/dart_sass/__main__.py +23 -0
- sass_embedded/dart_sass/_ext/1.87.0-windows-arm64/dart-sass/sass.bat +7 -0
- sass_embedded/dart_sass/_ext/1.87.0-windows-arm64/dart-sass/src/LICENSE +1693 -0
- sass_embedded/dart_sass/_ext/1.87.0-windows-arm64/dart-sass/src/dart.exe +0 -0
- sass_embedded/dart_sass/_ext/1.87.0-windows-arm64/dart-sass/src/sass.snapshot +0 -0
- sass_embedded/dart_sass/installer.py +51 -0
- sass_embedded/protocol/__init__.py +11 -0
- sass_embedded/protocol/compiler.py +119 -0
- sass_embedded/protocol/embedded_sass_pb2.py +129 -0
- sass_embedded/protocol/embedded_sass_pb2.pyi +504 -0
- sass_embedded/py.typed +0 -0
- sass_embedded/simple.py +253 -0
- sass_embedded-0.0.0.dist-info/METADATA +153 -0
- sass_embedded-0.0.0.dist-info/RECORD +19 -0
- sass_embedded-0.0.0.dist-info/WHEEL +4 -0
sass_embedded/_const.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
_ext
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Controller of Dart Sass.
|
|
2
|
+
|
|
3
|
+
This module works to
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import platform
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import TYPE_CHECKING, Literal
|
|
13
|
+
|
|
14
|
+
from .._const import DART_SASS_VERSION
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
OSName = Literal["android", "linux", "macos", "windows"]
|
|
20
|
+
ArchName = Literal["arm", "arm64", "ia32", "riscv64", "x64"]
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
here = Path(__file__).parent
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def resolve_os() -> OSName:
|
|
27
|
+
"""Retrieve os name as dart-sass specified."""
|
|
28
|
+
os_name = platform.system()
|
|
29
|
+
if os_name == "Darwin":
|
|
30
|
+
return "macos"
|
|
31
|
+
if os_name in ("Linux", "Windows", "Android"):
|
|
32
|
+
return os_name.lower() # type: ignore[return-value]
|
|
33
|
+
raise Exception(f"There is not dart-sass binary for {os_name}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def resolve_arch() -> ArchName:
|
|
37
|
+
"""Retrieve cpu architecture string as dart-sass specified."""
|
|
38
|
+
# NOTE: This logic is not all covered.
|
|
39
|
+
arch_name = platform.machine()
|
|
40
|
+
if arch_name in ("x86_64", "AMD64"):
|
|
41
|
+
arch_name = "x64"
|
|
42
|
+
if arch_name.startswith("arm") and arch_name != "arm64":
|
|
43
|
+
arch_name = "arm"
|
|
44
|
+
return arch_name # type: ignore[return-value]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass
|
|
48
|
+
class Release:
|
|
49
|
+
"""Release data of Dart Sass.
|
|
50
|
+
|
|
51
|
+
This class manages information about release pack Dart Sass.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
os: OSName
|
|
55
|
+
"""Identify of OS."""
|
|
56
|
+
arch: ArchName
|
|
57
|
+
"""Identify of CPU architecture."""
|
|
58
|
+
version: str = DART_SASS_VERSION
|
|
59
|
+
"""Versionstring of Dart Sass."""
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def fullname(self) -> str:
|
|
63
|
+
"""Full name of release's directory."""
|
|
64
|
+
return f"{self.version}-{self.os}-{self.arch}"
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def archive_url(self) -> str:
|
|
68
|
+
"""URL for archive of GitHub Releases."""
|
|
69
|
+
ext = "zip" if self.os == "windows" else "tar.gz"
|
|
70
|
+
return f"https://github.com/sass/dart-sass/releases/download/{self.version}/dart-sass-{self.version}-{self.os}-{self.arch}.{ext}"
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def archive_format(self) -> str:
|
|
74
|
+
"""String of ``shutil.unpack_archive``."""
|
|
75
|
+
return "zip" if self.os == "windows" else "gztar"
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def init(cls) -> Release:
|
|
79
|
+
"""Create object with current environment and registered version."""
|
|
80
|
+
os_name = resolve_os()
|
|
81
|
+
arch_name = resolve_arch()
|
|
82
|
+
return cls(os=os_name, arch=arch_name)
|
|
83
|
+
|
|
84
|
+
def resolve_dir(self, base_dir: Path):
|
|
85
|
+
"""Retrieve full path of release's directory."""
|
|
86
|
+
return base_dir / self.fullname
|
|
87
|
+
|
|
88
|
+
def get_executable(self, base_dir: Path | None = None) -> Executable:
|
|
89
|
+
"""Retrieve executable components object."""
|
|
90
|
+
base_dir = base_dir or resolve_bin_base_dir()
|
|
91
|
+
return Executable(base_dir=base_dir, release=self)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass
|
|
95
|
+
class Executable:
|
|
96
|
+
"""Data for local files data of Dart Sass.
|
|
97
|
+
|
|
98
|
+
This class manages filepath and more about unpacked Dart Sass.
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
base_dir: Path
|
|
102
|
+
"""Installed directory."""
|
|
103
|
+
release: Release
|
|
104
|
+
"""Release information of installed components."""
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def dart_vm_path(self) -> Path:
|
|
108
|
+
"""Full path of Dart runtime."""
|
|
109
|
+
dir_ = self.release.resolve_dir(self.base_dir)
|
|
110
|
+
ext_ = ".exe" if self.release.os == "windows" else ""
|
|
111
|
+
return (dir_ / "dart-sass" / "src" / f"dart{ext_}").resolve()
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def sass_snapshot_path(self) -> Path:
|
|
115
|
+
"""Full path of compiled module."""
|
|
116
|
+
dir_ = self.release.resolve_dir(self.base_dir)
|
|
117
|
+
return (dir_ / "dart-sass" / "src" / "sass.snapshot").resolve()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def resolve_bin_base_dir() -> Path:
|
|
121
|
+
"""Retrieve base directory to install Dart Sass binaries."""
|
|
122
|
+
return here / "_ext"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import logging
|
|
3
|
+
|
|
4
|
+
from . import installer
|
|
5
|
+
|
|
6
|
+
logger = logging.getLogger(__name__)
|
|
7
|
+
parser = argparse.ArgumentParser()
|
|
8
|
+
parser.add_argument("--clean", action="store_true", default=False)
|
|
9
|
+
parser.add_argument("--os", default=None, type=str)
|
|
10
|
+
parser.add_argument("--arch", default=None, type=str)
|
|
11
|
+
|
|
12
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
13
|
+
|
|
14
|
+
logger.debug("START: Install dart-sass by CLI")
|
|
15
|
+
|
|
16
|
+
args = parser.parse_args()
|
|
17
|
+
if args.clean:
|
|
18
|
+
installer.clean()
|
|
19
|
+
if args.os and args.arch:
|
|
20
|
+
installer.install(os_name=args.os, arch_name=args.arch)
|
|
21
|
+
else:
|
|
22
|
+
installer.install()
|
|
23
|
+
logger.debug("END: Install dart-sass by CLI")
|