@fabriziosalmi/slopless 1.12.1 → 1.12.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriziosalmi/slopless",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,8 +10,12 @@ match:
10
10
  # settles it first: `mailto:${addr}` and `/blog/${slug}` cannot become
11
11
  # `javascript:` whatever the value is, and that is how a template builds
12
12
  # every ordinary link.
13
+ #
14
+ # import.meta.env.X is replaced by the bundler before the page ever runs, so
15
+ # it is a literal by the time a request exists. Vite and Astro spell every
16
+ # base path that way.
13
17
  regex: >-
14
- href\s*=\s*\{[^}]*\+|href\s*=\s*[`'"]\s*\$\{|href\s*=\s*\{\s*[`'"]\s*\$\{
18
+ href\s*=\s*\{[^}]*\+|href\s*=\s*[`'"]\s*\$\{(?!\s*import\.meta\.env\.)|href\s*=\s*\{\s*[`'"]\s*\$\{(?!\s*import\.meta\.env\.)
15
19
  scan: all
16
20
  file_types:
17
21
  - js
@@ -32,4 +36,7 @@ tests:
32
36
  - '<a href={`mailto:${contact.email}`}>write to us</a>'
33
37
  - '<a href={`/blog/${slug}`}>read on</a>'
34
38
  - '<a href={`https://example.org/u/${user}`}>profile</a>'
39
+ # Replaced by the bundler before a request exists.
40
+ - '<link href={`${import.meta.env.BASE_URL}favicon.svg`} />'
41
+ - '<a href={`${import.meta.env.BASE_URL}docs/${slug}`}>docs</a>'
35
42
  - <a href="/static/page">page</a>