wexample-wex-addon-dev-javascript 8.9.0__py3-none-any.whl → 8.11.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.
@@ -112,7 +112,11 @@ class NodePackageJsonFile(AppDependenciesConfigFileMixin, JsonFile):
112
112
  continue
113
113
  try:
114
114
  with urllib.request.urlopen(
115
- registry + urllib.parse.quote(name, safe="@"), timeout=15
115
+ urllib.request.Request(
116
+ registry + urllib.parse.quote(name, safe="@"),
117
+ headers=self._forge_headers(registry),
118
+ ),
119
+ timeout=15,
116
120
  ) as answer:
117
121
  latest = json.load(answer).get("dist-tags", {}).get("latest")
118
122
  except urllib.error.HTTPError as error:
@@ -122,3 +126,18 @@ class NodePackageJsonFile(AppDependenciesConfigFileMixin, JsonFile):
122
126
  if latest:
123
127
  versions[name] = latest
124
128
  return versions
129
+
130
+ def _forge_headers(self, url: str) -> dict[str, str]:
131
+ """The app's GitLab token, for a registry of its own forge (git.gitlab_url):
132
+ a private group answers nobody else, and another forge would refuse a
133
+ token that is not its own."""
134
+ try:
135
+ forge = (
136
+ self.get_parent_item().get_config().search("git.gitlab_url").get_str_or_none()
137
+ )
138
+ token = self.get_env_parameter("GITLAB_API_TOKEN", default=None)
139
+ except Exception:
140
+ return {}
141
+ if forge and token and url.startswith(forge.rstrip("/") + "/"):
142
+ return {"Authorization": f"Bearer {token}"}
143
+ return {}
@@ -398,7 +398,13 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
398
398
  version = self.get_setup_version()
399
399
  group_url = self.get_gitlab_registry_url()
400
400
 
401
- gateway = NpmRegistryGateway(base_url=group_url, io=self.io, timeout=10)
401
+ # With the suite's token: a private group answers nobody else.
402
+ gateway = NpmRegistryGateway(
403
+ base_url=group_url,
404
+ token=self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN"),
405
+ io=self.io,
406
+ timeout=10,
407
+ )
402
408
  if gateway.has_version(package, version) and not force:
403
409
  self.log(f"{package}@{version} is already on the GitLab registry.")
404
410
  return
@@ -482,9 +488,41 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
482
488
  f"available on this machine. A stale lockfile would break "
483
489
  f"the strict CI install."
484
490
  )
485
- self._shell_run_node_command(command)
491
+ self._shell_run_node_command(command, extra_env=self._suite_registry_environment())
486
492
  return
487
493
 
494
+ def _suite_registry_environment(self) -> dict[str, str]:
495
+ """npm sent to the suite's GitLab registry for every scope of a sibling
496
+ this package depends on, with the suite's token: a sibling published a
497
+ minute ago is there, not yet on npmjs, and a private group answers
498
+ nobody else."""
499
+ from urllib.parse import urlparse
500
+
501
+ group_url = self.get_gitlab_registry_url()
502
+ if not group_url:
503
+ return {}
504
+ suite = self.get_suite_workdir()
505
+ siblings = (
506
+ {package.get_package_name() for package in suite.get_packages()} if suite else set()
507
+ )
508
+ dependencies = {
509
+ **self.get_app_config_file().get_dependencies_versions(),
510
+ **self.get_app_config_file().get_dev_dependencies_versions(),
511
+ }
512
+ scopes = {
513
+ name.split("/", 1)[0]
514
+ for name in dependencies
515
+ if name.startswith("@") and name in siblings
516
+ }
517
+ if not scopes:
518
+ return {}
519
+ environment = {f"npm_config_{scope}:registry": group_url for scope in scopes}
520
+ token = self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN")
521
+ if token:
522
+ parsed = urlparse(group_url)
523
+ environment[f"npm_config_//{parsed.netloc}{parsed.path}:_authToken"] = token
524
+ return environment
525
+
488
526
  def _wait_for_registry(self) -> None:
489
527
  """Poll the configured npm registry until the current version is available (max 20 min).
490
528
 
@@ -502,7 +540,12 @@ class JavascriptPackageWorkdir(JavascriptWorkdir):
502
540
  group_url = self.get_gitlab_registry_url()
503
541
  if group_url:
504
542
  self._wait_for_version(
505
- NpmRegistryGateway(base_url=group_url, io=self.io, timeout=10),
543
+ NpmRegistryGateway(
544
+ base_url=group_url,
545
+ token=self.get_env_parameter_or_suite_fallback("GITLAB_API_TOKEN"),
546
+ io=self.io,
547
+ timeout=10,
548
+ ),
506
549
  delay_seconds=5,
507
550
  )
508
551
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-javascript
3
- Version: 8.9.0
3
+ Version: 8.11.0
4
4
  Summary: Extends wex with JavaScript support: enforces JS/TS project layout and symlinks local npm packages into node_modules
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -14,7 +14,7 @@ Requires-Dist: cattrs>=23.1.0
14
14
  Requires-Dist: wexample-api>=6.8.0
15
15
  Requires-Dist: wexample-filestate-javascript>=6.6.0
16
16
  Requires-Dist: wexample-wex-addon-ai>=19.1.0
17
- Requires-Dist: wexample-wex-addon-app>=34.8.0
17
+ Requires-Dist: wexample-wex-addon-app>=34.11.0
18
18
  Provides-Extra: dev
19
19
  Requires-Dist: pytest; extra == "dev"
20
20
  Requires-Dist: pytest-cov; extra == "dev"
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # wex_addon_dev_javascript
24
24
 
25
- Version: 8.9.0
25
+ Version: 8.11.0
26
26
 
27
27
  Extends wex with JavaScript support: enforces JS/TS project layout and symlinks local npm packages into node_modules
28
28
 
@@ -1,6 +1,6 @@
1
- wexample_wex_addon_dev_javascript-8.9.0.dist-info/METADATA,sha256=g9KGgGBchqF9i-oqM276CeXqm-e_jUf8xn8SmKeoBwI,3400
2
- wexample_wex_addon_dev_javascript-8.9.0.dist-info/WHEEL,sha256=IuIk3wbaEnFH1cx75iM2R1CmliRI3dFLXTbRakgvgFQ,90
3
- wexample_wex_addon_dev_javascript-8.9.0.dist-info/entry_points.txt,sha256=WwYdg3RL2Ey1fg4JNNkcQxZcQRgZSgPLLzSDi6lbYgI,143
1
+ wexample_wex_addon_dev_javascript-8.11.0.dist-info/METADATA,sha256=xP8Trim0FNG_Diof9SVPM3_grb0jIxYVG_1zJwXNqL0,3403
2
+ wexample_wex_addon_dev_javascript-8.11.0.dist-info/WHEEL,sha256=IuIk3wbaEnFH1cx75iM2R1CmliRI3dFLXTbRakgvgFQ,90
3
+ wexample_wex_addon_dev_javascript-8.11.0.dist-info/entry_points.txt,sha256=WwYdg3RL2Ey1fg4JNNkcQxZcQRgZSgPLLzSDi6lbYgI,143
4
4
  wexample_wex_addon_dev_javascript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  wexample_wex_addon_dev_javascript/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  wexample_wex_addon_dev_javascript/common/npm_registry_gateway.py,sha256=jcAIOZN1eiPeRSjradY095VI93ne86ijbVAZcXzCKpQ,2742
@@ -13,7 +13,7 @@ wexample_wex_addon_dev_javascript/file/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFB
13
13
  wexample_wex_addon_dev_javascript/file/javascript_package_json_file.py,sha256=yn1ltv3oBYNg1OvUytJ4PEzH8FSJS2KcIKK8y-cMrl4,2906
14
14
  wexample_wex_addon_dev_javascript/file/javascript_package_lock_json_file.py,sha256=PPlIbKksyw0IPjJuaNbxcwty1nsH875owgRCgeJIij4,1388
15
15
  wexample_wex_addon_dev_javascript/file/javascript_tsconfig_json_file.py,sha256=a2vfYgB7gbiIiGljU_QA6extFJPyNM6rlhhAS3YoeCs,1395
16
- wexample_wex_addon_dev_javascript/file/node_package_json_file.py,sha256=Nqbv3XwfMzNRrWVf9hylixbA9oNeSKW6gdlJ9rcKKJQ,4356
16
+ wexample_wex_addon_dev_javascript/file/node_package_json_file.py,sha256=RTj9CExKr04YSHkUmsSD78W-sx4ciRUqyH0LSHUjkNM,5186
17
17
  wexample_wex_addon_dev_javascript/formatter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  wexample_wex_addon_dev_javascript/formatter/javascript_code_formatter.py,sha256=6TLrynxXH-P0kHiW6FmgROA8fG2Ik03Pn4JV9dctDuE,1618
19
19
  wexample_wex_addon_dev_javascript/javascript_addon_manager.py,sha256=zateyPGxtR4eOdjstfLI6MfTagEOWAAeb2CZqF_qMVo,1387
@@ -47,7 +47,7 @@ wexample_wex_addon_dev_javascript/services/vite/docker/.wex.yml,sha256=JdIF6nGkF
47
47
  wexample_wex_addon_dev_javascript/services/vite/docker/docker-compose.yml,sha256=M7ejIcht0GxuEAEEcK3urBIrXA66JwYrr5EPUA9nMMM,595
48
48
  wexample_wex_addon_dev_javascript/services/vite/service.yml,sha256=8mFPv49QbKA3klHFbNK73QOB7ryy38zFeLiQB3gfDys,184
49
49
  wexample_wex_addon_dev_javascript/workdir/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py,sha256=kbdzmUjaOsNdzf74BUBokLwrxuVyuIW8nH5tyzU5Uy4,23248
50
+ wexample_wex_addon_dev_javascript/workdir/javascript_package_workdir.py,sha256=U0gf0Zgj0k34yfoARFLmbcm9f7hXxbo7RPSHNgSSUa8,25009
51
51
  wexample_wex_addon_dev_javascript/workdir/javascript_packages_suite_workdir.py,sha256=b0QoTWlNYOYfpqEb8vYzL4WRoY0WwBhYOFUoRc4oySI,928
52
52
  wexample_wex_addon_dev_javascript/workdir/javascript_workdir.py,sha256=EFY0-500y9PKeLtZIvI-q53n-EfNiHCpKnkmWm-q68w,9948
53
- wexample_wex_addon_dev_javascript-8.9.0.dist-info/RECORD,,
53
+ wexample_wex_addon_dev_javascript-8.11.0.dist-info/RECORD,,