astro-accelerator 7.1.12 → 7.1.14

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.
@@ -0,0 +1,118 @@
1
+ :root,
2
+ body.mode-light {
3
+ --fore: #233;
4
+ --aft: #DFF;
5
+ --aft-image: #DFF;
6
+
7
+ --fore-link: #355;
8
+ --fore-link-alt: #699;
9
+ --aft-link-alt: #e6e6eC;
10
+
11
+ --fore-input: var(--fore);
12
+ --aft-input: var(--aft);
13
+
14
+ --fore-block: #333;
15
+ --aft-block: #BEE;
16
+ --icon-block: #FF0;
17
+ --icon-block-alpha: rgba(from var(--icon-block) r g b / 0.4);
18
+
19
+ --fore-table-head: #DFF;
20
+ --aft-table-head: #233;
21
+ --fore-table-row-odd: #333;
22
+ --aft-table-row-odd: #DFF;
23
+ --fore-table-row-even: #333;
24
+ --aft-table-row-even: #CFF;
25
+ }
26
+
27
+ body.mode-dark {
28
+ --fore: #DFF;
29
+ --aft: #233;
30
+ --aft-image: #DDD;
31
+
32
+ --fore-link: #AFF;
33
+ --fore-link-alt: #FF0;
34
+ --aft-link-alt: #232323;
35
+
36
+ --fore-input: var(--fore);
37
+ --aft-input: var(--aft);
38
+
39
+ --fore-block: #DFF;
40
+ --aft-block: #011;
41
+ --icon-block: #FF0;
42
+ --icon-block-alpha: rgba(from var(--icon-block) r g b / 0.4);
43
+
44
+ --fore-table-head: #DFF;
45
+ --aft-table-head: #244;
46
+ --fore-table-row-odd: #DFF;
47
+ --aft-table-row-odd: #355;
48
+ --fore-table-row-even: #DFF;
49
+ --aft-table-row-even: #466;
50
+ }
51
+
52
+
53
+ @font-face {
54
+ font-family: "hyper-reg";
55
+ font-weight: normal;
56
+ font-style: normal;
57
+ src: url("AtkinsonHyperlegibleNext-Regular.otf");
58
+ font-display: block;
59
+ }
60
+
61
+ @font-face {
62
+ font-family: "hyper-bold";
63
+ font-weight: bold;
64
+ font-style: normal;
65
+ src: url("AtkinsonHyperlegibleNext-Bold.otf");
66
+ font-display: block;
67
+ }
68
+
69
+ @font-face {
70
+ font-family: "hyper-mono";
71
+ font-weight: bold;
72
+ font-style: normal;
73
+ src: url("AtkinsonHyperlegibleMono-Regular.otf");
74
+ font-display: block;
75
+ }
76
+
77
+ :root {
78
+ --heading-font: 'hyper-bold', sans-serif;
79
+ --content-font: 'hyper-reg', Verdana, Geneva, sans-serif;
80
+ --code-font: 'hyper-mono', Consolas, 'Courier New', Courier, monospace;
81
+ --unicode-font: font-family: "Segoe UI Symbol", "Arial Unicode MS", "DejaVu Sans", "Meiryo UI", "MS UI Gothic", "Everson Mono Unicode", Meiryo, "MS Gothic", "MS Mincho", "MS PGothic", "MS PMincho", "Meslo LG L", "Meslo LG L DZ", "Meslo M L", "Meslo M L DZ", "Meslo S L", "Meslo S L DZ", "Symbola", "DejaVu Sans Condensed", "DejaVu Sans Mono", Code2000, "Everson Mono", Quivira, sans-serif;
82
+
83
+ --font-size-meta: 0.9rem;
84
+ --font-size-h1: 3rem;
85
+ --font-size-h2: 2.3rem;
86
+ --font-size-h3: 2rem;
87
+ --font-size-h4: 1.7rem;
88
+ --font-size-h5: 1.7rem;
89
+ --font-size-h6: 1.7rem;
90
+
91
+ --paragraph-margin: 1.2rem;
92
+ --block-gap: 2rem;
93
+ --block-gap-l: 3rem;
94
+ --block-radius: 0.3rem;
95
+ --block-radius-round: 20px;
96
+
97
+ --marker-size: 1.2rem;
98
+
99
+ --box-shadow: 0 12px 24px -12px rgb(0 0 0 / 50%);
100
+ --box-shadow-slight: 0 6px 12px -6px rgb(0 0 0 / 40%);
101
+ --box-glow: 0 0 12px 0 var(--icon-block-alpha);
102
+
103
+ --box-shadow-unselected: rgb(0 0 0 / 6%) 0px 2px 4px, rgb(0 0 0 / 5%) 0px 0.5px 1px;
104
+ --transform-selected: translate3d(0px, -1px, 0px);
105
+
106
+ --content-width: 50rem;
107
+ --navigation-width: 300px;
108
+ --grid-gap: 1rem;
109
+ --grid-gap-s: 0.4rem;
110
+
111
+ /* Calculate the mobile width by removing l/r columns */
112
+ --content-width-mobile: calc(100vw - 1rem);
113
+
114
+ /* Search variables */
115
+ --search-height: 2rem;
116
+ --search-dropdown-height: 65vh;
117
+ --search-dropdown-duration: 0.2s;
118
+ }
@@ -0,0 +1,118 @@
1
+ :root,
2
+ body.mode-light {
3
+ --fore: #233;
4
+ --aft: #DFF;
5
+ --aft-image: #DFF;
6
+
7
+ --fore-link: #355;
8
+ --fore-link-alt: #699;
9
+ --aft-link-alt: #e6e6eC;
10
+
11
+ --fore-input: var(--fore);
12
+ --aft-input: var(--aft);
13
+
14
+ --fore-block: #333;
15
+ --aft-block: #BEE;
16
+ --icon-block: #FF0;
17
+ --icon-block-alpha: rgba(from var(--icon-block) r g b / 0.4);
18
+
19
+ --fore-table-head: #DFF;
20
+ --aft-table-head: #233;
21
+ --fore-table-row-odd: #333;
22
+ --aft-table-row-odd: #DFF;
23
+ --fore-table-row-even: #333;
24
+ --aft-table-row-even: #CFF;
25
+ }
26
+
27
+ body.mode-dark {
28
+ --fore: #DFF;
29
+ --aft: #233;
30
+ --aft-image: #DDD;
31
+
32
+ --fore-link: #AFF;
33
+ --fore-link-alt: #FF0;
34
+ --aft-link-alt: #232323;
35
+
36
+ --fore-input: var(--fore);
37
+ --aft-input: var(--aft);
38
+
39
+ --fore-block: #DFF;
40
+ --aft-block: #011;
41
+ --icon-block: #FF0;
42
+ --icon-block-alpha: rgba(from var(--icon-block) r g b / 0.4);
43
+
44
+ --fore-table-head: #DFF;
45
+ --aft-table-head: #244;
46
+ --fore-table-row-odd: #DFF;
47
+ --aft-table-row-odd: #355;
48
+ --fore-table-row-even: #DFF;
49
+ --aft-table-row-even: #466;
50
+ }
51
+
52
+
53
+ @font-face {
54
+ font-family: "hyper-reg";
55
+ font-weight: normal;
56
+ font-style: normal;
57
+ src: url("AtkinsonHyperlegibleNext-Regular.otf");
58
+ font-display: block;
59
+ }
60
+
61
+ @font-face {
62
+ font-family: "hyper-bold";
63
+ font-weight: bold;
64
+ font-style: normal;
65
+ src: url("AtkinsonHyperlegibleNext-Bold.otf");
66
+ font-display: block;
67
+ }
68
+
69
+ @font-face {
70
+ font-family: "hyper-mono";
71
+ font-weight: bold;
72
+ font-style: normal;
73
+ src: url("AtkinsonHyperlegibleMono-Regular.otf");
74
+ font-display: block;
75
+ }
76
+
77
+ :root {
78
+ --heading-font: 'hyper-bold', sans-serif;
79
+ --content-font: 'hyper-reg', Verdana, Geneva, sans-serif;
80
+ --code-font: 'hyper-mono', Consolas, 'Courier New', Courier, monospace;
81
+ --unicode-font: font-family: "Segoe UI Symbol", "Arial Unicode MS", "DejaVu Sans", "Meiryo UI", "MS UI Gothic", "Everson Mono Unicode", Meiryo, "MS Gothic", "MS Mincho", "MS PGothic", "MS PMincho", "Meslo LG L", "Meslo LG L DZ", "Meslo M L", "Meslo M L DZ", "Meslo S L", "Meslo S L DZ", "Symbola", "DejaVu Sans Condensed", "DejaVu Sans Mono", Code2000, "Everson Mono", Quivira, sans-serif;
82
+
83
+ --font-size-meta: 0.9rem;
84
+ --font-size-h1: 3rem;
85
+ --font-size-h2: 2.3rem;
86
+ --font-size-h3: 2rem;
87
+ --font-size-h4: 1.7rem;
88
+ --font-size-h5: 1.7rem;
89
+ --font-size-h6: 1.7rem;
90
+
91
+ --paragraph-margin: 1.2rem;
92
+ --block-gap: 2rem;
93
+ --block-gap-l: 3rem;
94
+ --block-radius: 0.3rem;
95
+ --block-radius-round: 20px;
96
+
97
+ --marker-size: 1.2rem;
98
+
99
+ --box-shadow: 0 12px 24px -12px rgb(0 0 0 / 50%);
100
+ --box-shadow-slight: 0 6px 12px -6px rgb(0 0 0 / 40%);
101
+ --box-glow: 0 0 12px 0 var(--icon-block-alpha);
102
+
103
+ --box-shadow-unselected: rgb(0 0 0 / 6%) 0px 2px 4px, rgb(0 0 0 / 5%) 0px 0.5px 1px;
104
+ --transform-selected: translate3d(0px, -1px, 0px);
105
+
106
+ --content-width: 50rem;
107
+ --navigation-width: 300px;
108
+ --grid-gap: 1rem;
109
+ --grid-gap-s: 0.4rem;
110
+
111
+ /* Calculate the mobile width by removing l/r columns */
112
+ --content-width-mobile: calc(100vw - 1rem);
113
+
114
+ /* Search variables */
115
+ --search-height: 2rem;
116
+ --search-dropdown-height: 65vh;
117
+ --search-dropdown-duration: 0.2s;
118
+ }
@@ -4,3 +4,6 @@ export const imagePaths = {
4
4
  src: 'img',
5
5
  dest: 'i',
6
6
  };
7
+
8
+ /** Image formats that can be resized and served via srcset */
9
+ export const supportedImageExtensions = ['.jpg', '.jpeg', '.png', '.webp'];
@@ -54,12 +54,12 @@ stats.stop();
54
54
  <meta name="description" content={frontmatter.description} />
55
55
  <link
56
56
  rel="stylesheet"
57
- href={SITE.subfolder + `/css/vars.7.1.12.css`}
57
+ href={SITE.subfolder + `/css/vars.7.1.14.css`}
58
58
  data-versioned
59
59
  />
60
60
  <link
61
61
  rel="stylesheet"
62
- href={SITE.subfolder + `/css/main.7.1.12.css`}
62
+ href={SITE.subfolder + `/css/main.7.1.14.css`}
63
63
  data-versioned
64
64
  />
65
65
  {
@@ -34,10 +34,16 @@ if (!version) {
34
34
  process.exit(1);
35
35
  }
36
36
 
37
- const cssDir = path.join(workingDirectory, 'public', 'css');
37
+ const configSource = await fs.promises.readFile(
38
+ path.join(workingDirectory, 'src', 'config.ts'),
39
+ 'utf8'
40
+ );
41
+ const subfolder = configSource.match(/subfolder:\s*'([^']*)'/)?.[1] ?? '';
42
+
43
+ const cssDir = path.join(workingDirectory, 'public', subfolder, 'css');
38
44
  const previousVersionLimit = 5;
39
- const linkRegex = /<link\b[\s\S]*?\bdata-versioned\b[\s\S]*?\/>/g;
40
- const hrefCssRegex = /`(\/css\/[^`]+)`/;
45
+ const linkRegex = /<link\b[^>]*?\bdata-versioned\b[^>]*?\/>/g;
46
+ const hrefCssRegex = /(['"`])(\/css\/[^'"`]+)\1/;
41
47
 
42
48
  /**
43
49
  * Derive the unversioned base filename from a CSS path in an href.
@@ -115,7 +121,10 @@ async function copyVersionedCss(baseName) {
115
121
  }
116
122
 
117
123
  function rewriteLinkHref(linkTag, versionedName) {
118
- return linkTag.replace(hrefCssRegex, `\`/css/${versionedName}\``);
124
+ return linkTag.replace(
125
+ hrefCssRegex,
126
+ (_match, quote) => `${quote}/css/${versionedName}${quote}`
127
+ );
119
128
  }
120
129
 
121
130
  let content = await fs.promises.readFile(htmlHeadPath, 'utf8');
@@ -142,9 +151,9 @@ for (const match of links) {
142
151
  process.exit(1);
143
152
  }
144
153
 
145
- const baseName = getBaseCssName(hrefMatch[1]);
154
+ const baseName = getBaseCssName(hrefMatch[2]);
146
155
  if (!baseName) {
147
- console.error(`Could not derive base CSS name from ${hrefMatch[1]}`);
156
+ console.error(`Could not derive base CSS name from ${hrefMatch[2]}`);
148
157
  process.exit(1);
149
158
  }
150
159
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { SITE } from '/src/config';
9
9
  import { size } from '/src/data/image-size.mjs';
10
+ import { supportedImageExtensions } from '/src/data/images.mjs';
10
11
  import { h } from 'hastscript';
11
12
  import { visit } from 'unist-util-visit';
12
13
  import { fromSelector } from 'hast-util-from-selector';
@@ -48,9 +49,19 @@ export function getDestination(uri, s) {
48
49
 
49
50
  export function getImageInfo(src, className, sizes) {
50
51
  const info = {};
52
+ const ext = path.parse(src).ext.toLowerCase();
53
+ info.class = (className ?? '' + ' resp-img').trim();
54
+ info.metadata = null;
55
+
56
+ if (!supportedImageExtensions.includes(ext)) {
57
+ info.src = src;
58
+ info.srcset = null;
59
+ info.sizes = null;
60
+ return info;
61
+ }
51
62
 
52
63
  let uri = src;
53
- uri = uri.replace(/.jpg|.jpeg|.png/, '.webp');
64
+ uri = uri.replace(/.jpg|.jpeg|.png/i, '.webp');
54
65
 
55
66
  const imgFallback = getDestination(src, 'x');
56
67
 
@@ -59,7 +70,6 @@ export function getImageInfo(src, className, sizes) {
59
70
  const imgLarge = getDestination(uri, size.large);
60
71
 
61
72
  let nativeSize = size.large;
62
- info.metadata = null;
63
73
 
64
74
  try {
65
75
  let metaAddress = path.join(workingDirectory, 'public', src + '.json');
@@ -86,7 +96,6 @@ export function getImageInfo(src, className, sizes) {
86
96
 
87
97
  info.srcset = srcset;
88
98
  info.sizes = sizes;
89
- info.class = (className ?? '' + ' resp-img').trim();
90
99
 
91
100
  if ([imgSmall, imgMedium, imgLarge].includes(src)) {
92
101
  info.srcset = null;
@@ -19,6 +19,7 @@ const imageModule = await import(
19
19
  );
20
20
  const size = imageSize.size;
21
21
  const imagePaths = imageModule.imagePaths;
22
+ const supportedImageExtensions = imageModule.supportedImageExtensions;
22
23
 
23
24
  const imagePath = path.join('public', imagePaths.src);
24
25
  const outputPath = path.join('public', imagePaths.dest);
@@ -53,58 +54,52 @@ async function recurseFiles(directory) {
53
54
  const nextDirectory = path.join(directory, file.name);
54
55
  await recurseFiles(nextDirectory);
55
56
  } else {
56
- const ext = path.parse(file.name).ext;
57
-
58
- switch (ext) {
59
- case '.jpg':
60
- case '.jpeg':
61
- case '.png':
62
- case '.webp':
63
- const sourcePath = path.join(directory, file.name);
64
-
65
- const webP = sourcePath.replace(
66
- /.jpg$|.jpeg$|.png$/,
67
- '.webp'
68
- );
69
- const info = {
70
- path: sourcePath,
71
- webP: webP,
72
- };
73
-
74
- const fullDestination = path.join(
75
- workingDirectory,
76
- outputPath,
77
- 'x',
78
- info.path
79
- );
80
-
81
- // Only processes images where there is no json metadata file
82
- const metaPath = path.join(
83
- workingDirectory,
84
- imagePath,
85
- sourcePath + '.json'
57
+ const ext = path.parse(file.name).ext.toLowerCase();
58
+
59
+ if (supportedImageExtensions.includes(ext)) {
60
+ const sourcePath = path.join(directory, file.name);
61
+
62
+ const webP = sourcePath.replace(
63
+ /.jpg$|.jpeg$|.png$/i,
64
+ '.webp'
65
+ );
66
+ const info = {
67
+ path: sourcePath,
68
+ webP: webP,
69
+ };
70
+
71
+ const fullDestination = path.join(
72
+ workingDirectory,
73
+ outputPath,
74
+ 'x',
75
+ info.path
76
+ );
77
+
78
+ // Only processes images where there is no json metadata file
79
+ const metaPath = path.join(
80
+ workingDirectory,
81
+ imagePath,
82
+ sourcePath + '.json'
83
+ );
84
+
85
+ if (!fs.existsSync(metaPath)) {
86
+ console.log('Processing:', metaPath);
87
+ filesToProcess.push(info);
88
+ } else {
89
+ const data = fs.readFileSync(metaPath, 'utf8');
90
+ const jsonData = JSON.parse(data);
91
+ const date90DaysAgo = new Date(
92
+ Date.now() - 90 * 24 * 60 * 60 * 1000
86
93
  );
87
94
 
88
- if (!fs.existsSync(metaPath)) {
95
+ if (
96
+ !jsonData.updated ||
97
+ new Date(jsonData.updated) < date90DaysAgo
98
+ ) {
89
99
  console.log('Processing:', metaPath);
90
100
  filesToProcess.push(info);
91
- } else {
92
- const data = fs.readFileSync(metaPath, 'utf8');
93
- const jsonData = JSON.parse(data);
94
- const date90DaysAgo = new Date(
95
- Date.now() - 90 * 24 * 60 * 60 * 1000
96
- );
97
-
98
- if (
99
- !jsonData.updated ||
100
- new Date(jsonData.updated) < date90DaysAgo
101
- ) {
102
- console.log('Processing:', metaPath);
103
- filesToProcess.push(info);
104
- }
105
101
  }
106
-
107
- break;
102
+ }
108
103
  }
109
104
  }
110
105
  }