flag-resizer 0.0.1 → 0.0.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/ATTRIBUTION.txt CHANGED
@@ -12,8 +12,8 @@ Copyright (c) 2013 Panayiotis Lipiridis
12
12
  Source: https://github.com/lipis/flag-icons
13
13
  License: MIT
14
14
 
15
- Canadian, Australian, German, and Spanish subdivision flag graphics
16
- (`ca-*`, `au-*`, `de-*`, `es-*`)
15
+ Canadian, Australian, German, Spanish, and Italian subdivision flag graphics
16
+ (`ca-*`, `au-*`, `de-*`, `es-*`, `it-*`)
17
17
  Copyright (c) 2021 AJ McKenna
18
18
  Source: https://github.com/amckenna41/iso3166-flags
19
19
  License: MIT
package/CHANGELOG.md CHANGED
@@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### 0.0.1
7
+ #### [v0.0.2](https://github.com/Celtian/flag-resizer/compare/v0.0.1...v0.0.2)
8
+
9
+ - Feat/flags [`#1`](https://github.com/Celtian/flag-resizer/pull/1)
10
+ - feat(flags): italian flags added [`52cde0d`](https://github.com/Celtian/flag-resizer/commit/52cde0d18947d6de57d590297f5a8e5349228d37)
11
+ - chore(readme): readme added [`f257d56`](https://github.com/Celtian/flag-resizer/commit/f257d56e4411c4c7a5dd6c06f3fdbc44eb79de8f)
12
+ - fix(types): wrong types of generated file [`f14e821`](https://github.com/Celtian/flag-resizer/commit/f14e821b8f190c14bf0fd678f3db6c1d38e4dc2d)
13
+
14
+ #### v0.0.1
15
+
16
+ > 30 July 2026
8
17
 
9
18
  - feat(cli): cli added [`9565d56`](https://github.com/Celtian/flag-resizer/commit/9565d56a1af0f66f7bc16697533143999d5dcd30)
10
19
  - feat(flags): more flags added [`0b138f0`](https://github.com/Celtian/flag-resizer/commit/0b138f0fded8e0d5846ca865c9e8d100d57f80c0)
package/LICENSE-GRAPHICS CHANGED
@@ -21,8 +21,8 @@ Flagpedia identifies its flag images as public domain and available for use
21
21
  without restriction:
22
22
  https://flagpedia.net/terms
23
23
 
24
- Canadian, Australian, German, and Spanish subdivision flag graphics
25
- (`ca-*.svg`, `au-*.svg`, `de-*.svg`, `es-*.svg`)
24
+ Canadian, Australian, German, Spanish, and Italian subdivision flag graphics
25
+ (`ca-*.svg`, `au-*.svg`, `de-*.svg`, `es-*.svg`, `it-*.svg`)
26
26
 
27
27
  Source:
28
28
  https://github.com/amckenna41/iso3166-flags
package/README.md CHANGED
@@ -20,7 +20,7 @@ a deterministic TypeScript manifest alongside the assets.
20
20
 
21
21
  | Feature | Details |
22
22
  | --------------------------------- | ---------------------------------------------------------------------------------------------- |
23
- | 🏳️ **Bundled flags** | Includes 369 regional and subdivision flags across Twemoji, FlagCDN, and ISO 3166-2 sources. |
23
+ | 🏳️ **Bundled flags** | Includes 389 regional and subdivision flags across Twemoji, FlagCDN, and ISO 3166-2 sources. |
24
24
  | 🖼️ **Optimized image sets** | Generates PNG, WebP, or both at every configured size and quality. |
25
25
  | 🧩 **Typed application paths** | Produces country, size, format, dimension, and public-path constants with a typed path helper. |
26
26
  | 🎯 **Reusable profiles** | Supports independent country filters, dimensions, formats, and output locations. |
@@ -87,7 +87,7 @@ patterns using `*` as a wildcard. For example, use `cz` for the Czech flag, `gb`
87
87
  flag, or `us-*` for all 50 U.S. subdivision flags. The `us-*` pattern does not include the national
88
88
  `us` flag; add `us` separately if needed. Likewise, `ca-*` selects Canadian subdivisions, `au-*`
89
89
  selects Australian subdivisions, `de-*` selects German states, `es-*` selects Spanish autonomous
90
- communities and cities, and `*` selects every bundled flag.
90
+ communities and cities, `it-*` selects Italian regions, and `*` selects every bundled flag.
91
91
 
92
92
  Subdivision codes can also be selected individually: `gb-eng`, `gb-nir`, `gb-sct`, and `gb-wls`
93
93
  for the United Kingdom; `us-ca` for California; `ca-on` for Ontario; or `au-nsw` for New South
@@ -102,10 +102,11 @@ The 50 U.S. state assets come from [FlagCDN](https://flagcdn.com/), whose flag a
102
102
  [Flagpedia's terms](https://flagpedia.net/terms). The source artwork is normalized to the same
103
103
  rounded 36×36 canvas as the bundled Twemoji flags.
104
104
 
105
- The 13 Canadian, 8 Australian, 16 German, and 19 Spanish subdivision assets come from the
106
- MIT-licensed [iso3166-flags](https://github.com/amckenna41/iso3166-flags) dataset and use current
107
- ISO 3166-2 codes. Spain's set covers its 17 autonomous communities and 2 autonomous cities, not its
108
- 50 provinces. Their source artwork is also normalized to the rounded 36×36 canvas.
105
+ The 13 Canadian, 8 Australian, 16 German, 19 Spanish, and 20 Italian subdivision assets come from
106
+ the MIT-licensed [iso3166-flags](https://github.com/amckenna41/iso3166-flags) dataset and use
107
+ current ISO 3166-2 codes. Spain's set covers its 17 autonomous communities and 2 autonomous cities,
108
+ not its 50 provinces; Italy's set covers its regions, not its provinces or metropolitan cities.
109
+ Their source artwork is also normalized to the rounded 36×36 canvas.
109
110
 
110
111
  All sizes in one profile must use the same aspect ratio. Output paths are resolved relative to the
111
112
  configuration file. A `publicPath` can be a root-relative path or an absolute CDN URL.
@@ -206,7 +207,13 @@ Each profile generates:
206
207
  - `getFlagPath(code, size, format)`.
207
208
 
208
209
  ```ts
209
- import { FLAG_DIMENSIONS, getFlagPath, type CountryCode, type FlagSize } from './generated/flags';
210
+ import {
211
+ FLAGS,
212
+ FLAG_DIMENSIONS,
213
+ getFlagPath,
214
+ type CountryCode,
215
+ type FlagSize,
216
+ } from './generated/flags';
210
217
 
211
218
  function flagImage(code: CountryCode, size: FlagSize) {
212
219
  return {
@@ -216,19 +223,31 @@ function flagImage(code: CountryCode, size: FlagSize) {
216
223
  }
217
224
  ```
218
225
 
219
- An Angular template can use the generated paths in a responsive picture:
226
+ An Angular component can precompute the generated paths for a responsive picture, keeping
227
+ function calls out of the template:
228
+
229
+ ```ts
230
+ function createFlagPicture(code: CountryCode) {
231
+ return {
232
+ webpSrcset: [
233
+ getFlagPath(code, '20x15', 'webp'),
234
+ `${getFlagPath(code, '40x30', 'webp')} 2x`,
235
+ `${getFlagPath(code, '60x45', 'webp')} 3x`,
236
+ ].join(', '),
237
+ pngSrc: getFlagPath(code, '20x15', 'png'),
238
+ alt: FLAGS[code],
239
+ };
240
+ }
241
+
242
+ export class FlagComponent {
243
+ protected readonly flag = createFlagPicture('cz');
244
+ }
245
+ ```
220
246
 
221
247
  ```html
222
248
  <picture>
223
- <source
224
- type="image/webp"
225
- [attr.srcset]="
226
- getFlagPath(code, '20x15', 'webp') + ', ' +
227
- getFlagPath(code, '40x30', 'webp') + ' 2x, ' +
228
- getFlagPath(code, '60x45', 'webp') + ' 3x'
229
- "
230
- />
231
- <img [src]="getFlagPath(code, '20x15', 'png')" [width]="20" [height]="15" [alt]="FLAGS[code]" />
249
+ <source type="image/webp" [attr.srcset]="flag.webpSrcset" />
250
+ <img [src]="flag.pngSrc" [width]="20" [height]="15" [alt]="flag.alt" />
232
251
  </picture>
233
252
  ```
234
253
 
@@ -334,7 +353,7 @@ Copyright &copy; 2026 [Dominik Hladík](https://github.com/Celtian).
334
353
  The package code is licensed under the [MIT License](LICENSE).
335
354
 
336
355
  The bundled graphics use source-specific terms: Twemoji is licensed under CC-BY-4.0; the Northern
337
- Ireland, Canadian, Australian, German, and Spanish subdivision assets are MIT-licensed; and the
338
- FlagCDN U.S. state artwork is public domain. Generated asset roots include attribution and license
339
- notices. Keep the required notices when redistributing the graphics. See
356
+ Ireland, Canadian, Australian, German, Spanish, and Italian subdivision assets are MIT-licensed;
357
+ and the FlagCDN U.S. state artwork is public domain. Generated asset roots include attribution and
358
+ license notices. Keep the required notices when redistributing the graphics. See
340
359
  [ATTRIBUTION.txt](ATTRIBUTION.txt) and [LICENSE-GRAPHICS](LICENSE-GRAPHICS).
package/dist/generator.js CHANGED
@@ -185,6 +185,26 @@ const FLAGS = {
185
185
  ir: "Iran",
186
186
  is: "Iceland",
187
187
  it: "Italy",
188
+ "it-21": "Piedmont",
189
+ "it-23": "Aosta Valley",
190
+ "it-25": "Lombardy",
191
+ "it-32": "Trentino-South Tyrol",
192
+ "it-34": "Veneto",
193
+ "it-36": "Friuli–Venezia Giulia",
194
+ "it-42": "Liguria",
195
+ "it-45": "Emilia-Romagna",
196
+ "it-52": "Tuscany",
197
+ "it-55": "Umbria",
198
+ "it-57": "Marche",
199
+ "it-62": "Lazio",
200
+ "it-65": "Abruzzo",
201
+ "it-67": "Molise",
202
+ "it-72": "Campania",
203
+ "it-75": "Apulia",
204
+ "it-77": "Basilicata",
205
+ "it-78": "Calabria",
206
+ "it-82": "Sicily",
207
+ "it-88": "Sardinia",
188
208
  je: "Jersey",
189
209
  jm: "Jamaica",
190
210
  jo: "Jordan",
@@ -599,7 +619,7 @@ export function getFlagPath(
599
619
  size: FlagSize,
600
620
  format: FlagFormat,
601
621
  ): string {
602
- const publicPath = FLAG_PUBLIC_PATHS[format];
622
+ const publicPath: string = FLAG_PUBLIC_PATHS[format];
603
623
  const basePath = publicPath === '/' ? '' : publicPath;
604
624
  return \`\${basePath}/\${size}/\${code}.\${format}\`;
605
625
  }
@@ -631,7 +651,7 @@ function assertSafeManagedFile(entry) {
631
651
  const relative = path.relative(entry.root, target);
632
652
  if (relative === "" || relative === ".." || relative.startsWith(`..${path.sep}`)) throw new FlagResizerError("The managed manifest contains a path outside its output root.");
633
653
  const portable = entry.relativePath.split(path.sep).join("/");
634
- if (!(entry.kind === "attribution" && portable === "ATTRIBUTION.txt" || entry.kind === "license" && portable === "LICENSE-GRAPHICS" || entry.kind === "typescript" && /^[^/]+\.ts$/u.test(portable) || entry.kind === "image" && /^[1-9]\d*x[1-9]\d*\/(?:[a-z]{2}|au-(?:act|nsw|nt|qld|sa|tas|vic|wa)|ca-(?:ab|bc|mb|nb|nl|ns|nt|nu|on|pe|qc|sk|yt)|de-(?:bb|be|bw|by|hb|he|hh|mv|ni|nw|rp|sh|sl|sn|st|th)|es-(?:an|ar|as|cb|ce|cl|cm|cn|ct|ex|ga|ib|mc|md|ml|nc|pv|ri|vc)|gb-(?:eng|nir|sct|wls)|us-(?:ak|al|ar|az|ca|co|ct|de|fl|ga|hi|ia|id|il|in|ks|ky|la|ma|md|me|mi|mn|mo|ms|mt|nc|nd|ne|nh|nj|nm|nv|ny|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|va|vt|wa|wi|wv|wy))\.(?:png|webp)$/u.test(portable))) throw new FlagResizerError(`The managed manifest contains an invalid ${entry.kind} path: ${entry.relativePath}.`);
654
+ if (!(entry.kind === "attribution" && portable === "ATTRIBUTION.txt" || entry.kind === "license" && portable === "LICENSE-GRAPHICS" || entry.kind === "typescript" && /^[^/]+\.ts$/u.test(portable) || entry.kind === "image" && /^[1-9]\d*x[1-9]\d*\/(?:[a-z]{2}|au-(?:act|nsw|nt|qld|sa|tas|vic|wa)|ca-(?:ab|bc|mb|nb|nl|ns|nt|nu|on|pe|qc|sk|yt)|de-(?:bb|be|bw|by|hb|he|hh|mv|ni|nw|rp|sh|sl|sn|st|th)|es-(?:an|ar|as|cb|ce|cl|cm|cn|ct|ex|ga|ib|mc|md|ml|nc|pv|ri|vc)|gb-(?:eng|nir|sct|wls)|it-(?:21|23|25|32|34|36|42|45|52|55|57|62|65|67|72|75|77|78|82|88)|us-(?:ak|al|ar|az|ca|co|ct|de|fl|ga|hi|ia|id|il|in|ks|ky|la|ma|md|me|mi|mn|mo|ms|mt|nc|nd|ne|nh|nj|nm|nv|ny|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|va|vt|wa|wi|wv|wy))\.(?:png|webp)$/u.test(portable))) throw new FlagResizerError(`The managed manifest contains an invalid ${entry.kind} path: ${entry.relativePath}.`);
635
655
  }
636
656
  function managedFile(target, root, kind) {
637
657
  const entry = {
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","names":[],"sources":["../src/data/flags.ts","../src/errors.ts","../src/config.ts","../src/generated-typescript.ts","../src/generator.ts"],"sourcesContent":["// Display names follow FlagCDN where available and the sourced ISO 3166-2\n// manifests for additional subdivisions.\nexport const FLAGS = {\n ac: 'Ascension Island',\n ad: 'Andorra',\n ae: 'United Arab Emirates',\n af: 'Afghanistan',\n ag: 'Antigua and Barbuda',\n ai: 'Anguilla',\n al: 'Albania',\n am: 'Armenia',\n ao: 'Angola',\n aq: 'Antarctica',\n ar: 'Argentina',\n as: 'American Samoa',\n at: 'Austria',\n au: 'Australia',\n 'au-act': 'Australian Capital Territory',\n 'au-nsw': 'New South Wales',\n 'au-nt': 'Northern Territory',\n 'au-qld': 'Queensland',\n 'au-sa': 'South Australia',\n 'au-tas': 'Tasmania',\n 'au-vic': 'Victoria',\n 'au-wa': 'Western Australia',\n aw: 'Aruba',\n ax: 'Åland Islands',\n az: 'Azerbaijan',\n ba: 'Bosnia and Herzegovina',\n bb: 'Barbados',\n bd: 'Bangladesh',\n be: 'Belgium',\n bf: 'Burkina Faso',\n bg: 'Bulgaria',\n bh: 'Bahrain',\n bi: 'Burundi',\n bj: 'Benin',\n bl: 'Saint Barthélemy',\n bm: 'Bermuda',\n bn: 'Brunei',\n bo: 'Bolivia',\n bq: 'Caribbean Netherlands',\n br: 'Brazil',\n bs: 'Bahamas',\n bt: 'Bhutan',\n bv: 'Bouvet Island',\n bw: 'Botswana',\n by: 'Belarus',\n bz: 'Belize',\n ca: 'Canada',\n 'ca-ab': 'Alberta',\n 'ca-bc': 'British Columbia',\n 'ca-mb': 'Manitoba',\n 'ca-nb': 'New Brunswick',\n 'ca-nl': 'Newfoundland and Labrador',\n 'ca-ns': 'Nova Scotia',\n 'ca-nt': 'Northwest Territories',\n 'ca-nu': 'Nunavut',\n 'ca-on': 'Ontario',\n 'ca-pe': 'Prince Edward Island',\n 'ca-qc': 'Quebec',\n 'ca-sk': 'Saskatchewan',\n 'ca-yt': 'Yukon',\n cc: 'Cocos (Keeling) Islands',\n cd: 'DR Congo',\n cf: 'Central African Republic',\n cg: 'Republic of the Congo',\n ch: 'Switzerland',\n ci: \"Côte d'Ivoire (Ivory Coast)\",\n ck: 'Cook Islands',\n cl: 'Chile',\n cm: 'Cameroon',\n cn: 'China',\n co: 'Colombia',\n cp: 'Clipperton Island',\n cq: 'Sark',\n cr: 'Costa Rica',\n cu: 'Cuba',\n cv: 'Cape Verde',\n cw: 'Curaçao',\n cx: 'Christmas Island',\n cy: 'Cyprus',\n cz: 'Czechia',\n de: 'Germany',\n 'de-bb': 'Brandenburg',\n 'de-be': 'Berlin',\n 'de-bw': 'Baden-Württemberg',\n 'de-by': 'Bavaria',\n 'de-hb': 'Bremen',\n 'de-he': 'Hesse',\n 'de-hh': 'Hamburg',\n 'de-mv': 'Mecklenburg-Western Pomerania',\n 'de-ni': 'Lower Saxony',\n 'de-nw': 'North Rhine-Westphalia',\n 'de-rp': 'Rhineland-Palatinate',\n 'de-sh': 'Schleswig-Holstein',\n 'de-sl': 'Saarland',\n 'de-sn': 'Saxony',\n 'de-st': 'Saxony-Anhalt',\n 'de-th': 'Thuringia',\n dg: 'Diego Garcia',\n dj: 'Djibouti',\n dk: 'Denmark',\n dm: 'Dominica',\n do: 'Dominican Republic',\n dz: 'Algeria',\n ea: 'Ceuta & Melilla',\n ec: 'Ecuador',\n ee: 'Estonia',\n eg: 'Egypt',\n eh: 'Western Sahara',\n er: 'Eritrea',\n es: 'Spain',\n 'es-an': 'Andalusia',\n 'es-ar': 'Aragon',\n 'es-as': 'Asturias',\n 'es-cb': 'Cantabria',\n 'es-ce': 'Ceuta',\n 'es-cl': 'Castile and León',\n 'es-cm': 'Castilla-La Mancha',\n 'es-cn': 'Canary Islands',\n 'es-ct': 'Catalonia',\n 'es-ex': 'Extremadura',\n 'es-ga': 'Galicia',\n 'es-ib': 'Balearic Islands',\n 'es-mc': 'Region of Murcia',\n 'es-md': 'Community of Madrid',\n 'es-ml': 'Melilla',\n 'es-nc': 'Navarre',\n 'es-pv': 'Basque Country',\n 'es-ri': 'La Rioja',\n 'es-vc': 'Valencian Community',\n et: 'Ethiopia',\n eu: 'European Union',\n fi: 'Finland',\n fj: 'Fiji',\n fk: 'Falkland Islands',\n fm: 'Micronesia',\n fo: 'Faroe Islands',\n fr: 'France',\n ga: 'Gabon',\n gb: 'United Kingdom',\n 'gb-eng': 'England',\n 'gb-nir': 'Northern Ireland',\n 'gb-sct': 'Scotland',\n 'gb-wls': 'Wales',\n gd: 'Grenada',\n ge: 'Georgia',\n gf: 'French Guiana',\n gg: 'Guernsey',\n gh: 'Ghana',\n gi: 'Gibraltar',\n gl: 'Greenland',\n gm: 'Gambia',\n gn: 'Guinea',\n gp: 'Guadeloupe',\n gq: 'Equatorial Guinea',\n gr: 'Greece',\n gs: 'South Georgia',\n gt: 'Guatemala',\n gu: 'Guam',\n gw: 'Guinea-Bissau',\n gy: 'Guyana',\n hk: 'Hong Kong',\n hm: 'Heard Island and McDonald Islands',\n hn: 'Honduras',\n hr: 'Croatia',\n ht: 'Haiti',\n hu: 'Hungary',\n ic: 'Canary Islands',\n id: 'Indonesia',\n ie: 'Ireland',\n il: 'Israel',\n im: 'Isle of Man',\n in: 'India',\n io: 'British Indian Ocean Territory',\n iq: 'Iraq',\n ir: 'Iran',\n is: 'Iceland',\n it: 'Italy',\n je: 'Jersey',\n jm: 'Jamaica',\n jo: 'Jordan',\n jp: 'Japan',\n ke: 'Kenya',\n kg: 'Kyrgyzstan',\n kh: 'Cambodia',\n ki: 'Kiribati',\n km: 'Comoros',\n kn: 'Saint Kitts and Nevis',\n kp: 'North Korea',\n kr: 'South Korea',\n kw: 'Kuwait',\n ky: 'Cayman Islands',\n kz: 'Kazakhstan',\n la: 'Laos',\n lb: 'Lebanon',\n lc: 'Saint Lucia',\n li: 'Liechtenstein',\n lk: 'Sri Lanka',\n lr: 'Liberia',\n ls: 'Lesotho',\n lt: 'Lithuania',\n lu: 'Luxembourg',\n lv: 'Latvia',\n ly: 'Libya',\n ma: 'Morocco',\n mc: 'Monaco',\n md: 'Moldova',\n me: 'Montenegro',\n mf: 'Saint Martin',\n mg: 'Madagascar',\n mh: 'Marshall Islands',\n mk: 'North Macedonia',\n ml: 'Mali',\n mm: 'Myanmar',\n mn: 'Mongolia',\n mo: 'Macau',\n mp: 'Northern Mariana Islands',\n mq: 'Martinique',\n mr: 'Mauritania',\n ms: 'Montserrat',\n mt: 'Malta',\n mu: 'Mauritius',\n mv: 'Maldives',\n mw: 'Malawi',\n mx: 'Mexico',\n my: 'Malaysia',\n mz: 'Mozambique',\n na: 'Namibia',\n nc: 'New Caledonia',\n ne: 'Niger',\n nf: 'Norfolk Island',\n ng: 'Nigeria',\n ni: 'Nicaragua',\n nl: 'Netherlands',\n no: 'Norway',\n np: 'Nepal',\n nr: 'Nauru',\n nu: 'Niue',\n nz: 'New Zealand',\n om: 'Oman',\n pa: 'Panama',\n pe: 'Peru',\n pf: 'French Polynesia',\n pg: 'Papua New Guinea',\n ph: 'Philippines',\n pk: 'Pakistan',\n pl: 'Poland',\n pm: 'Saint Pierre and Miquelon',\n pn: 'Pitcairn Islands',\n pr: 'Puerto Rico',\n ps: 'Palestine',\n pt: 'Portugal',\n pw: 'Palau',\n py: 'Paraguay',\n qa: 'Qatar',\n re: 'Réunion',\n ro: 'Romania',\n rs: 'Serbia',\n ru: 'Russia',\n rw: 'Rwanda',\n sa: 'Saudi Arabia',\n sb: 'Solomon Islands',\n sc: 'Seychelles',\n sd: 'Sudan',\n se: 'Sweden',\n sg: 'Singapore',\n sh: 'Saint Helena, Ascension and Tristan da Cunha',\n si: 'Slovenia',\n sj: 'Svalbard and Jan Mayen',\n sk: 'Slovakia',\n sl: 'Sierra Leone',\n sm: 'San Marino',\n sn: 'Senegal',\n so: 'Somalia',\n sr: 'Suriname',\n ss: 'South Sudan',\n st: 'São Tomé and Príncipe',\n sv: 'El Salvador',\n sx: 'Sint Maarten',\n sy: 'Syria',\n sz: 'Eswatini (Swaziland)',\n ta: 'Tristan da Cunha',\n tc: 'Turks and Caicos Islands',\n td: 'Chad',\n tf: 'French Southern and Antarctic Lands',\n tg: 'Togo',\n th: 'Thailand',\n tj: 'Tajikistan',\n tk: 'Tokelau',\n tl: 'Timor-Leste',\n tm: 'Turkmenistan',\n tn: 'Tunisia',\n to: 'Tonga',\n tr: 'Turkey',\n tt: 'Trinidad and Tobago',\n tv: 'Tuvalu',\n tw: 'Taiwan',\n tz: 'Tanzania',\n ua: 'Ukraine',\n ug: 'Uganda',\n um: 'United States Minor Outlying Islands',\n un: 'United Nations',\n us: 'United States',\n 'us-ak': 'Alaska',\n 'us-al': 'Alabama',\n 'us-ar': 'Arkansas',\n 'us-az': 'Arizona',\n 'us-ca': 'California',\n 'us-co': 'Colorado',\n 'us-ct': 'Connecticut',\n 'us-de': 'Delaware',\n 'us-fl': 'Florida',\n 'us-ga': 'Georgia',\n 'us-hi': 'Hawaii',\n 'us-ia': 'Iowa',\n 'us-id': 'Idaho',\n 'us-il': 'Illinois',\n 'us-in': 'Indiana',\n 'us-ks': 'Kansas',\n 'us-ky': 'Kentucky',\n 'us-la': 'Louisiana',\n 'us-ma': 'Massachusetts',\n 'us-md': 'Maryland',\n 'us-me': 'Maine',\n 'us-mi': 'Michigan',\n 'us-mn': 'Minnesota',\n 'us-mo': 'Missouri',\n 'us-ms': 'Mississippi',\n 'us-mt': 'Montana',\n 'us-nc': 'North Carolina',\n 'us-nd': 'North Dakota',\n 'us-ne': 'Nebraska',\n 'us-nh': 'New Hampshire',\n 'us-nj': 'New Jersey',\n 'us-nm': 'New Mexico',\n 'us-nv': 'Nevada',\n 'us-ny': 'New York',\n 'us-oh': 'Ohio',\n 'us-ok': 'Oklahoma',\n 'us-or': 'Oregon',\n 'us-pa': 'Pennsylvania',\n 'us-ri': 'Rhode Island',\n 'us-sc': 'South Carolina',\n 'us-sd': 'South Dakota',\n 'us-tn': 'Tennessee',\n 'us-tx': 'Texas',\n 'us-ut': 'Utah',\n 'us-va': 'Virginia',\n 'us-vt': 'Vermont',\n 'us-wa': 'Washington',\n 'us-wi': 'Wisconsin',\n 'us-wv': 'West Virginia',\n 'us-wy': 'Wyoming',\n uy: 'Uruguay',\n uz: 'Uzbekistan',\n va: 'Vatican City (Holy See)',\n vc: 'Saint Vincent and the Grenadines',\n ve: 'Venezuela',\n vg: 'British Virgin Islands',\n vi: 'United States Virgin Islands',\n vn: 'Vietnam',\n vu: 'Vanuatu',\n wf: 'Wallis and Futuna',\n ws: 'Samoa',\n xk: 'Kosovo',\n ye: 'Yemen',\n yt: 'Mayotte',\n za: 'South Africa',\n zm: 'Zambia',\n zw: 'Zimbabwe',\n} as const;\n\nexport type CountryCode = keyof typeof FLAGS;\n\nexport const COUNTRY_CODES = Object.keys(FLAGS) as CountryCode[];\n","export class FlagResizerError extends Error {\n public override readonly name = 'FlagResizerError';\n\n public constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n }\n}\n","import path from 'node:path';\n\nimport { loadConfig } from 'c12';\nimport { z } from 'zod';\n\nimport { COUNTRY_CODES, FLAGS, type CountryCode } from './data/flags.js';\nimport { FlagResizerError } from './errors.js';\nimport type {\n FlagFormat,\n FlagFilterValue,\n FlagResizerConfig,\n GenerateOptions,\n ProfileConfig,\n ResolvedConfiguration,\n ResolvedProfileConfig,\n} from './types.js';\n\nconst countryCodeSchema = z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]);\nconst filterPatternSchema = z\n .string()\n .regex(/^(?=.*\\*)[a-z*]+(?:-[a-z*]+)*$/u, 'must be a lowercase flag code or a pattern using \"*\"');\nconst filterValueSchema = z.union([countryCodeSchema, filterPatternSchema]);\nconst formatSchema = z.enum(['png', 'webp']);\nconst sizeSchema = z.tuple([\n z.number().int().positive('width must be a positive integer'),\n z.number().int().positive('height must be a positive integer'),\n]);\nconst formatOutputSchema = z\n .object({\n dir: z.string().trim().min(1),\n publicPath: z.string().trim().min(1),\n })\n .strict();\nconst profileSchema = z\n .object({\n filter: z\n .object({\n type: z.enum(['whitelist', 'blacklist']),\n values: z.array(filterValueSchema),\n })\n .strict(),\n sizes: z.array(sizeSchema).min(1),\n quality: z.number().int().min(1).max(100),\n formats: z.array(formatSchema).min(1),\n output: z\n .object({\n png: formatOutputSchema.optional(),\n webp: formatOutputSchema.optional(),\n ts: z.string().trim().min(1),\n })\n .strict(),\n })\n .strict();\nconst configSchema = z.record(z.string().trim().min(1), profileSchema);\n\ninterface LoadedConfig {\n raw: unknown;\n baseDir: string;\n configFile?: string;\n}\n\nexport function defineConfig<const T extends FlagResizerConfig>(config: T): T {\n return config;\n}\n\nfunction formatValidationError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const location = issue.path.length > 0 ? issue.path.join('.') : 'config';\n const received = issue.code === 'invalid_value' ? ` (${String(issue.input)})` : '';\n return `${location}: ${issue.message}${received}`;\n })\n .join('\\n');\n}\n\nfunction preflightFormatTypos(raw: unknown): void {\n if (typeof raw !== 'object' || raw === null) return;\n\n for (const [profileName, value] of Object.entries(raw)) {\n if (typeof value !== 'object' || value === null) continue;\n const formats: unknown = Reflect.get(value, 'formats');\n if (Array.isArray(formats) && formats.includes('wepb')) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" contains format \"wepb\". Did you mean \"webp\"?`,\n );\n }\n }\n}\n\nfunction normalizePublicPath(publicPath: string): string {\n const normalized = publicPath.replace(/\\/+$/u, '');\n return normalized === '' ? '/' : normalized;\n}\n\nfunction assertUniqueValues(profileName: string, profile: ProfileConfig): void {\n const formats = new Set(profile.formats);\n if (formats.size !== profile.formats.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate formats.`);\n }\n\n const sizes = new Set(profile.sizes.map(([width, height]) => `${width}x${height}`));\n if (sizes.size !== profile.sizes.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate sizes.`);\n }\n\n const countries = new Set(profile.filter.values);\n if (countries.size !== profile.filter.values.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate filter values.`);\n }\n}\n\nfunction assertConsistentRatio(profileName: string, profile: ProfileConfig): void {\n const first = profile.sizes[0];\n if (!first) return;\n\n const [baseWidth, baseHeight] = first;\n for (const [width, height] of profile.sizes.slice(1)) {\n if (width * baseHeight !== height * baseWidth) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" mixes aspect ratios: ${baseWidth}x${baseHeight} and ${width}x${height}.`,\n );\n }\n }\n}\n\nfunction matchesFilterValue(code: CountryCode, value: FlagFilterValue): boolean {\n if (!value.includes('*')) return code === value;\n return new RegExp(`^${value.split('*').join('.*')}$`, 'u').test(code);\n}\n\nfunction assertFilterValuesMatch(profileName: string, profile: ProfileConfig): void {\n for (const value of profile.filter.values) {\n if (!COUNTRY_CODES.some((code) => matchesFilterValue(code, value))) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" contains filter pattern \"${value}\" that matches no bundled flags.`,\n );\n }\n }\n}\n\nfunction selectCountries(profile: ProfileConfig): readonly CountryCode[] {\n return COUNTRY_CODES.filter((code) => {\n const matches = profile.filter.values.some((value) => matchesFilterValue(code, value));\n return profile.filter.type === 'whitelist' ? matches : !matches;\n });\n}\n\nfunction resolveProfile(\n name: string,\n profile: ProfileConfig,\n baseDir: string,\n): ResolvedProfileConfig {\n assertUniqueValues(name, profile);\n assertConsistentRatio(name, profile);\n assertFilterValuesMatch(name, profile);\n\n for (const format of profile.formats) {\n if (!profile.output[format]) {\n throw new FlagResizerError(\n `Profile \"${name}\" enables \"${format}\" but output.${format} is missing.`,\n );\n }\n }\n\n return {\n ...profile,\n name,\n countries: selectCountries(profile),\n output: {\n ...(profile.output.png\n ? {\n png: {\n dir: path.resolve(baseDir, profile.output.png.dir),\n publicPath: normalizePublicPath(profile.output.png.publicPath),\n },\n }\n : {}),\n ...(profile.output.webp\n ? {\n webp: {\n dir: path.resolve(baseDir, profile.output.webp.dir),\n publicPath: normalizePublicPath(profile.output.webp.publicPath),\n },\n }\n : {}),\n ts: path.resolve(baseDir, profile.output.ts),\n },\n };\n}\n\nfunction profileTargets(profile: ResolvedProfileConfig): Iterable<string> {\n const targets: string[] = [profile.output.ts];\n\n for (const format of profile.formats) {\n const output = profile.output[format];\n if (!output) continue;\n for (const [width, height] of profile.sizes) {\n for (const code of profile.countries) {\n targets.push(path.join(output.dir, `${width}x${height}`, `${code}.${format}`));\n }\n }\n }\n\n return targets;\n}\n\nfunction assertNoTargetCollisions(profiles: readonly ResolvedProfileConfig[]): void {\n const owners = new Map<string, string>();\n\n for (const profile of profiles) {\n for (const target of profileTargets(profile)) {\n const owner = owners.get(target);\n if (owner) {\n throw new FlagResizerError(\n `Profiles \"${owner}\" and \"${profile.name}\" both generate ${target}.`,\n );\n }\n owners.set(target, profile.name);\n }\n }\n}\n\nasync function loadRawConfiguration(options: GenerateOptions): Promise<LoadedConfig> {\n const cwd = path.resolve(options.cwd ?? process.cwd());\n if ('config' in options) {\n return { raw: options.config, baseDir: cwd };\n }\n\n const requestedFile = options.configFile ? path.resolve(cwd, options.configFile) : undefined;\n\n try {\n const result = await loadConfig({\n name: 'flag-resizer',\n cwd,\n ...(requestedFile ? { configFile: requestedFile } : {}),\n configFileRequired: true,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n dotenv: false,\n envName: false,\n extend: false,\n });\n const discoveredFile =\n typeof result.configFile === 'string' ? path.resolve(result.configFile) : requestedFile;\n\n return {\n raw: result.config,\n baseDir: discoveredFile ? path.dirname(discoveredFile) : cwd,\n ...(discoveredFile ? { configFile: discoveredFile } : {}),\n };\n } catch (error) {\n const target = requestedFile ?? path.join(cwd, 'flag-resizer.config.*');\n throw new FlagResizerError(`Unable to load flag-resizer configuration from ${target}.`, {\n cause: error,\n });\n }\n}\n\nexport async function resolveConfiguration(\n options: GenerateOptions,\n): Promise<ResolvedConfiguration> {\n const loaded = await loadRawConfiguration(options);\n preflightFormatTypos(loaded.raw);\n\n const parsed = configSchema.safeParse(loaded.raw);\n if (!parsed.success) {\n throw new FlagResizerError(\n `Invalid flag-resizer configuration:\\n${formatValidationError(parsed.error)}`,\n );\n }\n\n const entries = Object.entries(parsed.data);\n if (entries.length === 0) {\n throw new FlagResizerError('The configuration must contain at least one profile.');\n }\n\n const allProfiles = entries.map(([name, profile]) =>\n resolveProfile(name, profile as ProfileConfig, loaded.baseDir),\n );\n assertNoTargetCollisions(allProfiles);\n\n const requested = options.profiles;\n const selected =\n requested && requested.length > 0\n ? requested.map((name) => {\n const profile = allProfiles.find((candidate) => candidate.name === name);\n if (!profile) {\n throw new FlagResizerError(\n `Unknown profile \"${name}\". Available profiles: ${allProfiles\n .map((candidate) => candidate.name)\n .join(', ')}.`,\n );\n }\n return profile;\n })\n : allProfiles;\n\n if (new Set(selected.map((profile) => profile.name)).size !== selected.length) {\n throw new FlagResizerError('A profile was selected more than once.');\n }\n\n return {\n baseDir: loaded.baseDir,\n profiles: selected,\n ...(loaded.configFile ? { configFile: loaded.configFile } : {}),\n };\n}\n\nexport function getCountryName(code: CountryCode): string {\n return FLAGS[code];\n}\n\nexport function isFlagFormat(value: string): value is FlagFormat {\n return value === 'png' || value === 'webp';\n}\n","import { FLAGS } from './data/flags.js';\nimport type { FlagFormat, ResolvedProfileConfig } from './types.js';\n\nfunction quote(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction propertyKey(value: string): string {\n return /^[A-Za-z_$][\\w$]*$/u.test(value) ? value : quote(value);\n}\n\nexport function createTypeScriptManifest(profile: ResolvedProfileConfig): string {\n const flags = profile.countries\n .map((code) => ` ${propertyKey(code)}: ${quote(FLAGS[code])},`)\n .join('\\n');\n const sizes = profile.sizes.map(([width, height]) => `${width}x${height}`);\n const sizeValues = sizes.map((size) => ` ${quote(size)},`).join('\\n');\n const dimensions = profile.sizes\n .map(\n ([width, height]) =>\n ` ${quote(`${width}x${height}`)}: { width: ${width}, height: ${height} },`,\n )\n .join('\\n');\n const formats = profile.formats.map((format) => ` ${quote(format)},`).join('\\n');\n const publicPaths = profile.formats\n .map((format: FlagFormat) => {\n const output = profile.output[format];\n if (!output) throw new Error(`Missing resolved output for ${format}.`);\n return ` ${format}: ${quote(output.publicPath)},`;\n })\n .join('\\n');\n\n return `/**\n * Generated by script 🍺\n * Do not edit manually.\n */\n\nexport const FLAGS = {\n${flags}\n} as const;\n\nexport type CountryCode = keyof typeof FLAGS;\n\nexport const FLAG_SIZES = [\n${sizeValues}\n] as const;\n\nexport type FlagSize = (typeof FLAG_SIZES)[number];\n\nexport const FLAG_DIMENSIONS = {\n${dimensions}\n} as const satisfies Record<FlagSize, { width: number; height: number }>;\n\nexport const FLAG_FORMATS = [\n${formats}\n] as const;\n\nexport type FlagFormat = (typeof FLAG_FORMATS)[number];\n\nexport const FLAG_PUBLIC_PATHS = {\n${publicPaths}\n} as const satisfies Record<FlagFormat, string>;\n\nexport function getFlagPath(\n code: CountryCode,\n size: FlagSize,\n format: FlagFormat,\n): string {\n const publicPath = FLAG_PUBLIC_PATHS[format];\n const basePath = publicPath === '/' ? '' : publicPath;\n return \\`\\${basePath}/\\${size}/\\${code}.\\${format}\\`;\n}\n`;\n}\n","import {\n access,\n copyFile,\n mkdir,\n mkdtemp,\n readFile,\n rename,\n rm,\n rmdir,\n stat,\n unlink,\n writeFile,\n} from 'node:fs/promises';\nimport { availableParallelism } from 'node:os';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { randomUUID } from 'node:crypto';\n\nimport sharp from 'sharp';\n\nimport { resolveConfiguration } from './config.js';\nimport type { CountryCode } from './data/flags.js';\nimport { FlagResizerError } from './errors.js';\nimport { createTypeScriptManifest } from './generated-typescript.js';\nimport type {\n FlagFormat,\n GenerateOptions,\n GenerationResult,\n ProfileGenerationResult,\n ResolvedProfileConfig,\n} from './types.js';\n\nconst PACKAGE_ROOT = fileURLToPath(new URL('../', import.meta.url));\nconst FLAGS_DIRECTORY = path.join(PACKAGE_ROOT, 'flags');\nconst ATTRIBUTION_FILE = path.join(PACKAGE_ROOT, 'ATTRIBUTION.txt');\nconst GRAPHICS_LICENSE_FILE = path.join(PACKAGE_ROOT, 'LICENSE-GRAPHICS');\nconst MANIFEST_VERSION = 1;\n\ntype ManagedFileKind = 'attribution' | 'image' | 'license' | 'typescript';\ntype FileStatus = 'created' | 'updated' | 'unchanged';\n\ninterface ManagedFile {\n root: string;\n relativePath: string;\n kind: ManagedFileKind;\n}\n\ninterface ProfileManifest {\n files: ManagedFile[];\n}\n\ninterface ManagedManifest {\n version: typeof MANIFEST_VERSION;\n profiles: Record<string, ProfileManifest>;\n}\n\ninterface PlannedFile {\n entry: ManagedFile;\n target: string;\n image: boolean;\n createContent: () => Promise<Buffer>;\n}\n\ninterface GenerationPlan {\n tasks: PlannedFile[];\n filesByProfile: Map<string, ManagedFile[]>;\n imageCountByProfile: Map<string, number>;\n}\n\nfunction emptyManifest(): ManagedManifest {\n return { version: MANIFEST_VERSION, profiles: {} };\n}\n\nfunction entryTarget(entry: ManagedFile): string {\n return path.resolve(entry.root, entry.relativePath);\n}\n\nfunction entryKey(entry: ManagedFile): string {\n return entryTarget(entry);\n}\n\nfunction assertSafeManagedFile(entry: ManagedFile): void {\n if (!path.isAbsolute(entry.root)) {\n throw new FlagResizerError('The managed manifest contains a non-absolute output root.');\n }\n if (path.isAbsolute(entry.relativePath) || entry.relativePath.includes('\\0')) {\n throw new FlagResizerError('The managed manifest contains an unsafe file path.');\n }\n\n const target = entryTarget(entry);\n const relative = path.relative(entry.root, target);\n if (relative === '' || relative === '..' || relative.startsWith(`..${path.sep}`)) {\n throw new FlagResizerError('The managed manifest contains a path outside its output root.');\n }\n\n const portable = entry.relativePath.split(path.sep).join('/');\n const valid =\n (entry.kind === 'attribution' && portable === 'ATTRIBUTION.txt') ||\n (entry.kind === 'license' && portable === 'LICENSE-GRAPHICS') ||\n (entry.kind === 'typescript' && /^[^/]+\\.ts$/u.test(portable)) ||\n (entry.kind === 'image' &&\n /^[1-9]\\d*x[1-9]\\d*\\/(?:[a-z]{2}|au-(?:act|nsw|nt|qld|sa|tas|vic|wa)|ca-(?:ab|bc|mb|nb|nl|ns|nt|nu|on|pe|qc|sk|yt)|de-(?:bb|be|bw|by|hb|he|hh|mv|ni|nw|rp|sh|sl|sn|st|th)|es-(?:an|ar|as|cb|ce|cl|cm|cn|ct|ex|ga|ib|mc|md|ml|nc|pv|ri|vc)|gb-(?:eng|nir|sct|wls)|us-(?:ak|al|ar|az|ca|co|ct|de|fl|ga|hi|ia|id|il|in|ks|ky|la|ma|md|me|mi|mn|mo|ms|mt|nc|nd|ne|nh|nj|nm|nv|ny|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|va|vt|wa|wi|wv|wy))\\.(?:png|webp)$/u.test(\n portable,\n ));\n\n if (!valid) {\n throw new FlagResizerError(\n `The managed manifest contains an invalid ${entry.kind} path: ${entry.relativePath}.`,\n );\n }\n}\n\nfunction managedFile(target: string, root: string, kind: ManagedFileKind): ManagedFile {\n const entry = {\n root: path.resolve(root),\n relativePath: path.relative(path.resolve(root), path.resolve(target)),\n kind,\n };\n assertSafeManagedFile(entry);\n return entry;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction parseManifest(value: unknown): ManagedManifest {\n if (!isRecord(value) || value['version'] !== MANIFEST_VERSION || !isRecord(value['profiles'])) {\n throw new FlagResizerError('The managed manifest has an unsupported or invalid structure.');\n }\n\n const profiles: Record<string, ProfileManifest> = {};\n for (const [profileName, profileValue] of Object.entries(value['profiles'])) {\n if (!isRecord(profileValue) || !Array.isArray(profileValue['files'])) {\n throw new FlagResizerError(`The manifest entry for profile \"${profileName}\" is invalid.`);\n }\n\n const files = profileValue['files'].map((file): ManagedFile => {\n if (\n !isRecord(file) ||\n typeof file['root'] !== 'string' ||\n typeof file['relativePath'] !== 'string' ||\n !['attribution', 'image', 'license', 'typescript'].includes(String(file['kind']))\n ) {\n throw new FlagResizerError(\n `The manifest contains an invalid file owned by profile \"${profileName}\".`,\n );\n }\n const entry: ManagedFile = {\n root: file['root'],\n relativePath: file['relativePath'],\n kind: file['kind'] as ManagedFileKind,\n };\n assertSafeManagedFile(entry);\n return entry;\n });\n profiles[profileName] = { files };\n }\n\n return { version: MANIFEST_VERSION, profiles };\n}\n\nasync function pathExists(file: string): Promise<boolean> {\n try {\n await access(file);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function readManifest(file: string): Promise<ManagedManifest> {\n try {\n return parseManifest(JSON.parse(await readFile(file, 'utf8')) as unknown);\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') {\n return emptyManifest();\n }\n if (error instanceof FlagResizerError) throw error;\n throw new FlagResizerError(`Unable to read managed manifest ${file}.`, { cause: error });\n }\n}\n\nfunction resolveConcurrency(value: number | undefined): number {\n if (value !== undefined && (!Number.isInteger(value) || value < 1)) {\n throw new FlagResizerError('concurrency must be a positive integer.');\n }\n return value ?? Math.max(1, Math.min(8, availableParallelism()));\n}\n\nasync function runBounded<T>(\n items: readonly T[],\n concurrency: number,\n worker: (item: T, index: number) => Promise<void>,\n): Promise<void> {\n let nextIndex = 0;\n\n async function runWorker(): Promise<void> {\n while (nextIndex < items.length) {\n const index = nextIndex;\n nextIndex += 1;\n const item = items[index];\n if (item) await worker(item, index);\n }\n }\n\n await Promise.all(\n Array.from({ length: Math.min(concurrency, Math.max(1, items.length)) }, runWorker),\n );\n}\n\nfunction svgDensity(width: number, height: number): number {\n const scale = Math.max(width, height) / 36;\n return Math.max(72, Math.ceil(scale * 72));\n}\n\nasync function createImage(\n svg: Buffer,\n width: number,\n height: number,\n format: FlagFormat,\n quality: number,\n): Promise<Buffer> {\n const pipeline = sharp(svg, { density: svgDensity(width, height) })\n .resize(width, height, {\n fit: 'cover',\n position: 'centre',\n })\n .ensureAlpha();\n\n if (format === 'png') {\n return pipeline\n .png({\n quality,\n compressionLevel: 9,\n adaptiveFiltering: true,\n effort: 7,\n })\n .toBuffer();\n }\n\n return pipeline.webp({ quality, effort: 4 }).toBuffer();\n}\n\nfunction addProfileFile(\n filesByProfile: Map<string, ManagedFile[]>,\n profileName: string,\n entry: ManagedFile,\n): void {\n const entries = filesByProfile.get(profileName) ?? [];\n entries.push(entry);\n filesByProfile.set(profileName, entries);\n}\n\nfunction createGenerationPlan(profiles: readonly ResolvedProfileConfig[]): GenerationPlan {\n const taskByTarget = new Map<string, PlannedFile>();\n const filesByProfile = new Map<string, ManagedFile[]>();\n const imageCountByProfile = new Map<string, number>();\n const svgCache = new Map<CountryCode, Promise<Buffer>>();\n let attributionContent: Promise<Buffer> | undefined;\n let licenseContent: Promise<Buffer> | undefined;\n\n const readSvg = (code: CountryCode): Promise<Buffer> => {\n let content = svgCache.get(code);\n if (!content) {\n content = readFile(path.join(FLAGS_DIRECTORY, `${code}.svg`));\n svgCache.set(code, content);\n }\n return content;\n };\n\n const register = (\n profileName: string,\n entry: ManagedFile,\n image: boolean,\n createContent: () => Promise<Buffer>,\n ): void => {\n const target = entryTarget(entry);\n if (!taskByTarget.has(target)) {\n taskByTarget.set(target, { entry, target, image, createContent });\n }\n addProfileFile(filesByProfile, profileName, entry);\n };\n\n for (const profile of profiles) {\n const typeScriptEntry = managedFile(\n profile.output.ts,\n path.dirname(profile.output.ts),\n 'typescript',\n );\n register(profile.name, typeScriptEntry, false, () =>\n Promise.resolve(Buffer.from(createTypeScriptManifest(profile))),\n );\n\n let imageCount = 0;\n for (const format of profile.formats) {\n const output = profile.output[format];\n if (!output) {\n throw new FlagResizerError(\n `Profile \"${profile.name}\" has no resolved output for ${format}.`,\n );\n }\n\n const attributionEntry = managedFile(\n path.join(output.dir, 'ATTRIBUTION.txt'),\n output.dir,\n 'attribution',\n );\n register(profile.name, attributionEntry, false, () => {\n attributionContent ??= readFile(ATTRIBUTION_FILE);\n return attributionContent;\n });\n\n const licenseEntry = managedFile(\n path.join(output.dir, 'LICENSE-GRAPHICS'),\n output.dir,\n 'license',\n );\n register(profile.name, licenseEntry, false, () => {\n licenseContent ??= readFile(GRAPHICS_LICENSE_FILE);\n return licenseContent;\n });\n\n for (const [width, height] of profile.sizes) {\n for (const code of profile.countries) {\n const target = path.join(output.dir, `${width}x${height}`, `${code}.${format}`);\n const entry = managedFile(target, output.dir, 'image');\n register(profile.name, entry, true, async () =>\n createImage(await readSvg(code), width, height, format, profile.quality),\n );\n imageCount += 1;\n }\n }\n }\n imageCountByProfile.set(profile.name, imageCount);\n }\n\n return {\n tasks: [...taskByTarget.values()].sort((left, right) =>\n left.target.localeCompare(right.target),\n ),\n filesByProfile,\n imageCountByProfile,\n };\n}\n\nasync function buffersEqual(file: string, expected: Buffer): Promise<boolean> {\n try {\n const currentStat = await stat(file);\n if (currentStat.size !== expected.byteLength) return false;\n return (await readFile(file)).equals(expected);\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') return false;\n throw error;\n }\n}\n\nasync function writeStagedFile(target: string, staged: string): Promise<void> {\n await mkdir(path.dirname(target), { recursive: true });\n const temporaryTarget = path.join(\n path.dirname(target),\n `.${path.basename(target)}.${process.pid}.${randomUUID()}.tmp`,\n );\n\n try {\n await copyFile(staged, temporaryTarget);\n await rename(temporaryTarget, target);\n } finally {\n await rm(temporaryTarget, { force: true });\n }\n}\n\nasync function writeAtomic(target: string, content: string): Promise<void> {\n await mkdir(path.dirname(target), { recursive: true });\n const temporaryTarget = path.join(\n path.dirname(target),\n `.${path.basename(target)}.${process.pid}.${randomUUID()}.tmp`,\n );\n\n try {\n await writeFile(temporaryTarget, content);\n await rename(temporaryTarget, target);\n } finally {\n await rm(temporaryTarget, { force: true });\n }\n}\n\nasync function removeEmptyParents(start: string, root: string): Promise<void> {\n let directory = path.resolve(start);\n const resolvedRoot = path.resolve(root);\n\n while (directory !== resolvedRoot) {\n const relative = path.relative(resolvedRoot, directory);\n if (relative === '..' || relative.startsWith(`..${path.sep}`)) return;\n try {\n await rmdir(directory);\n } catch {\n return;\n }\n directory = path.dirname(directory);\n }\n}\n\nasync function pruneFile(entry: ManagedFile): Promise<boolean> {\n assertSafeManagedFile(entry);\n const target = entryTarget(entry);\n try {\n await unlink(target);\n await removeEmptyParents(path.dirname(target), entry.root);\n return true;\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') return false;\n throw new FlagResizerError(`Unable to remove stale generated file ${target}.`, {\n cause: error,\n });\n }\n}\n\nfunction sortedManifest(manifest: ManagedManifest): ManagedManifest {\n return {\n version: MANIFEST_VERSION,\n profiles: Object.fromEntries(\n Object.entries(manifest.profiles)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([profileName, profile]) => [\n profileName,\n {\n files: [...profile.files].sort((left, right) =>\n entryTarget(left).localeCompare(entryTarget(right)),\n ),\n },\n ]),\n ),\n };\n}\n\nfunction nextManifest(\n previous: ManagedManifest,\n plan: GenerationPlan,\n selectedProfiles: readonly ResolvedProfileConfig[],\n fullRun: boolean,\n): ManagedManifest {\n const profiles: Record<string, ProfileManifest> = fullRun ? {} : { ...previous.profiles };\n for (const profile of selectedProfiles) {\n profiles[profile.name] = { files: plan.filesByProfile.get(profile.name) ?? [] };\n }\n return sortedManifest({ version: MANIFEST_VERSION, profiles });\n}\n\nfunction staleEntries(previous: ManagedManifest, next: ManagedManifest): ManagedFile[] {\n const retainedTargets = new Set(\n Object.values(next.profiles).flatMap((profile) => profile.files.map(entryKey)),\n );\n const stale = new Map<string, ManagedFile>();\n\n for (const profile of Object.values(previous.profiles)) {\n for (const entry of profile.files) {\n const target = entryKey(entry);\n if (!retainedTargets.has(target)) stale.set(target, entry);\n }\n }\n return [...stale.values()];\n}\n\nfunction removedOwnershipCount(\n previous: ManagedManifest,\n next: ManagedManifest,\n profileName: string,\n): number {\n const nextFiles = new Set((next.profiles[profileName]?.files ?? []).map(entryKey));\n return (previous.profiles[profileName]?.files ?? []).filter(\n (entry) => !nextFiles.has(entryKey(entry)),\n ).length;\n}\n\nexport async function generate(options: GenerateOptions = {}): Promise<GenerationResult> {\n const started = performance.now();\n const concurrency = resolveConcurrency(options.concurrency);\n const resolved = await resolveConfiguration(options);\n const manifestFile = path.join(resolved.baseDir, '.flag-resizer', 'manifest.json');\n const previousManifest = await readManifest(manifestFile);\n const plan = createGenerationPlan(resolved.profiles);\n const fullRun = !options.profiles || options.profiles.length === 0;\n const manifest = nextManifest(previousManifest, plan, resolved.profiles, fullRun);\n const stale = staleEntries(previousManifest, manifest);\n const statuses = new Map<string, FileStatus>();\n const dryRun = options.dryRun ?? false;\n\n if (dryRun) {\n await runBounded(plan.tasks, concurrency, async (task) => {\n statuses.set(task.target, (await pathExists(task.target)) ? 'updated' : 'created');\n });\n } else {\n const stagingDirectory = await mkdtemp(path.join(os.tmpdir(), 'flag-resizer-'));\n const stagedFiles = new Map<string, string>();\n\n try {\n await runBounded(plan.tasks, concurrency, async (task, index) => {\n const content = await task.createContent();\n const exists = await pathExists(task.target);\n if (exists && (await buffersEqual(task.target, content))) {\n statuses.set(task.target, 'unchanged');\n return;\n }\n\n statuses.set(task.target, exists ? 'updated' : 'created');\n const staged = path.join(stagingDirectory, String(index));\n await writeFile(staged, content);\n stagedFiles.set(task.target, staged);\n });\n\n for (const task of plan.tasks) {\n const staged = stagedFiles.get(task.target);\n if (staged) await writeStagedFile(task.target, staged);\n }\n\n for (const entry of stale) await pruneFile(entry);\n await writeAtomic(manifestFile, `${JSON.stringify(manifest, null, 2)}\\n`);\n } catch (error) {\n throw new FlagResizerError('Flag generation failed before the manifest was committed.', {\n cause: error,\n });\n } finally {\n await rm(stagingDirectory, { recursive: true, force: true });\n }\n }\n\n const profiles: ProfileGenerationResult[] = resolved.profiles.map((profile) => {\n const entries = plan.filesByProfile.get(profile.name) ?? [];\n const counts = { created: 0, updated: 0, unchanged: 0 };\n for (const entry of entries) {\n const status = statuses.get(entryTarget(entry));\n if (status) counts[status] += 1;\n }\n\n return {\n name: profile.name,\n countries: profile.countries.length,\n images: plan.imageCountByProfile.get(profile.name) ?? 0,\n sizes: profile.sizes,\n formats: profile.formats,\n outputDirectories: Object.fromEntries(\n profile.formats.map((format) => [format, profile.output[format]?.dir]),\n ),\n ...counts,\n removed: removedOwnershipCount(previousManifest, manifest, profile.name),\n typeScriptFile: profile.output.ts,\n };\n });\n\n return {\n dryRun,\n durationMs: Math.round(performance.now() - started),\n ...(resolved.configFile ? { configFile: resolved.configFile } : {}),\n manifestFile,\n profiles,\n };\n}\n"],"mappings":";;;;;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AM,UAAU,KAAK;GAChD,MAAM,YAAY,cAAc,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE,GAAG;EAC1E,SAAS,OAAO;GACd,MAAM,IAAI,iBAAiB,6DAA6D,EACtF,OAAO,MACT,CAAC;EACH,UAAU;GACR,MAAM,GAAG,kBAAkB;IAAE,WAAW;IAAM,OAAO;GAAK,CAAC;EAC7D;CACF;CAEA,MAAM,WAAsC,SAAS,SAAS,KAAK,YAAY;EAC7E,MAAM,UAAU,KAAK,eAAe,IAAI,QAAQ,IAAI,KAAK,CAAC;EAC1D,MAAM,SAAS;GAAE,SAAS;GAAG,SAAS;GAAG,WAAW;EAAE;EACtD,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,SAAS,SAAS,IAAI,YAAY,KAAK,CAAC;GAC9C,IAAI,QAAQ,OAAO,WAAW;EAChC;EAEA,OAAO;GACL,MAAM,QAAQ;GACd,WAAW,QAAQ,UAAU;GAC7B,QAAQ,KAAK,oBAAoB,IAAI,QAAQ,IAAI,KAAK;GACtD,OAAO,QAAQ;GACf,SAAS,QAAQ;GACjB,mBAAmB,OAAO,YACxB,QAAQ,QAAQ,KAAK,WAAW,CAAC,QAAQ,QAAQ,OAAO,OAAO,EAAE,GAAG,CAAC,CACvE;GACA,GAAG;GACH,SAAS,sBAAsB,kBAAkB,UAAU,QAAQ,IAAI;GACvE,gBAAgB,QAAQ,OAAO;EACjC;CACF,CAAC;CAED,OAAO;EACL;EACA,YAAY,KAAK,MAAM,YAAY,IAAI,IAAI,OAAO;EAClD,GAAI,SAAS,aAAa,EAAE,YAAY,SAAS,WAAW,IAAI,CAAC;EACjE;EACA;CACF;AACF"}
1
+ {"version":3,"file":"generator.js","names":[],"sources":["../src/data/flags.ts","../src/errors.ts","../src/config.ts","../src/generated-typescript.ts","../src/generator.ts"],"sourcesContent":["// Display names follow FlagCDN where available and the sourced ISO 3166-2\n// manifests for additional subdivisions.\nexport const FLAGS = {\n ac: 'Ascension Island',\n ad: 'Andorra',\n ae: 'United Arab Emirates',\n af: 'Afghanistan',\n ag: 'Antigua and Barbuda',\n ai: 'Anguilla',\n al: 'Albania',\n am: 'Armenia',\n ao: 'Angola',\n aq: 'Antarctica',\n ar: 'Argentina',\n as: 'American Samoa',\n at: 'Austria',\n au: 'Australia',\n 'au-act': 'Australian Capital Territory',\n 'au-nsw': 'New South Wales',\n 'au-nt': 'Northern Territory',\n 'au-qld': 'Queensland',\n 'au-sa': 'South Australia',\n 'au-tas': 'Tasmania',\n 'au-vic': 'Victoria',\n 'au-wa': 'Western Australia',\n aw: 'Aruba',\n ax: 'Åland Islands',\n az: 'Azerbaijan',\n ba: 'Bosnia and Herzegovina',\n bb: 'Barbados',\n bd: 'Bangladesh',\n be: 'Belgium',\n bf: 'Burkina Faso',\n bg: 'Bulgaria',\n bh: 'Bahrain',\n bi: 'Burundi',\n bj: 'Benin',\n bl: 'Saint Barthélemy',\n bm: 'Bermuda',\n bn: 'Brunei',\n bo: 'Bolivia',\n bq: 'Caribbean Netherlands',\n br: 'Brazil',\n bs: 'Bahamas',\n bt: 'Bhutan',\n bv: 'Bouvet Island',\n bw: 'Botswana',\n by: 'Belarus',\n bz: 'Belize',\n ca: 'Canada',\n 'ca-ab': 'Alberta',\n 'ca-bc': 'British Columbia',\n 'ca-mb': 'Manitoba',\n 'ca-nb': 'New Brunswick',\n 'ca-nl': 'Newfoundland and Labrador',\n 'ca-ns': 'Nova Scotia',\n 'ca-nt': 'Northwest Territories',\n 'ca-nu': 'Nunavut',\n 'ca-on': 'Ontario',\n 'ca-pe': 'Prince Edward Island',\n 'ca-qc': 'Quebec',\n 'ca-sk': 'Saskatchewan',\n 'ca-yt': 'Yukon',\n cc: 'Cocos (Keeling) Islands',\n cd: 'DR Congo',\n cf: 'Central African Republic',\n cg: 'Republic of the Congo',\n ch: 'Switzerland',\n ci: \"Côte d'Ivoire (Ivory Coast)\",\n ck: 'Cook Islands',\n cl: 'Chile',\n cm: 'Cameroon',\n cn: 'China',\n co: 'Colombia',\n cp: 'Clipperton Island',\n cq: 'Sark',\n cr: 'Costa Rica',\n cu: 'Cuba',\n cv: 'Cape Verde',\n cw: 'Curaçao',\n cx: 'Christmas Island',\n cy: 'Cyprus',\n cz: 'Czechia',\n de: 'Germany',\n 'de-bb': 'Brandenburg',\n 'de-be': 'Berlin',\n 'de-bw': 'Baden-Württemberg',\n 'de-by': 'Bavaria',\n 'de-hb': 'Bremen',\n 'de-he': 'Hesse',\n 'de-hh': 'Hamburg',\n 'de-mv': 'Mecklenburg-Western Pomerania',\n 'de-ni': 'Lower Saxony',\n 'de-nw': 'North Rhine-Westphalia',\n 'de-rp': 'Rhineland-Palatinate',\n 'de-sh': 'Schleswig-Holstein',\n 'de-sl': 'Saarland',\n 'de-sn': 'Saxony',\n 'de-st': 'Saxony-Anhalt',\n 'de-th': 'Thuringia',\n dg: 'Diego Garcia',\n dj: 'Djibouti',\n dk: 'Denmark',\n dm: 'Dominica',\n do: 'Dominican Republic',\n dz: 'Algeria',\n ea: 'Ceuta & Melilla',\n ec: 'Ecuador',\n ee: 'Estonia',\n eg: 'Egypt',\n eh: 'Western Sahara',\n er: 'Eritrea',\n es: 'Spain',\n 'es-an': 'Andalusia',\n 'es-ar': 'Aragon',\n 'es-as': 'Asturias',\n 'es-cb': 'Cantabria',\n 'es-ce': 'Ceuta',\n 'es-cl': 'Castile and León',\n 'es-cm': 'Castilla-La Mancha',\n 'es-cn': 'Canary Islands',\n 'es-ct': 'Catalonia',\n 'es-ex': 'Extremadura',\n 'es-ga': 'Galicia',\n 'es-ib': 'Balearic Islands',\n 'es-mc': 'Region of Murcia',\n 'es-md': 'Community of Madrid',\n 'es-ml': 'Melilla',\n 'es-nc': 'Navarre',\n 'es-pv': 'Basque Country',\n 'es-ri': 'La Rioja',\n 'es-vc': 'Valencian Community',\n et: 'Ethiopia',\n eu: 'European Union',\n fi: 'Finland',\n fj: 'Fiji',\n fk: 'Falkland Islands',\n fm: 'Micronesia',\n fo: 'Faroe Islands',\n fr: 'France',\n ga: 'Gabon',\n gb: 'United Kingdom',\n 'gb-eng': 'England',\n 'gb-nir': 'Northern Ireland',\n 'gb-sct': 'Scotland',\n 'gb-wls': 'Wales',\n gd: 'Grenada',\n ge: 'Georgia',\n gf: 'French Guiana',\n gg: 'Guernsey',\n gh: 'Ghana',\n gi: 'Gibraltar',\n gl: 'Greenland',\n gm: 'Gambia',\n gn: 'Guinea',\n gp: 'Guadeloupe',\n gq: 'Equatorial Guinea',\n gr: 'Greece',\n gs: 'South Georgia',\n gt: 'Guatemala',\n gu: 'Guam',\n gw: 'Guinea-Bissau',\n gy: 'Guyana',\n hk: 'Hong Kong',\n hm: 'Heard Island and McDonald Islands',\n hn: 'Honduras',\n hr: 'Croatia',\n ht: 'Haiti',\n hu: 'Hungary',\n ic: 'Canary Islands',\n id: 'Indonesia',\n ie: 'Ireland',\n il: 'Israel',\n im: 'Isle of Man',\n in: 'India',\n io: 'British Indian Ocean Territory',\n iq: 'Iraq',\n ir: 'Iran',\n is: 'Iceland',\n it: 'Italy',\n 'it-21': 'Piedmont',\n 'it-23': 'Aosta Valley',\n 'it-25': 'Lombardy',\n 'it-32': 'Trentino-South Tyrol',\n 'it-34': 'Veneto',\n 'it-36': 'Friuli–Venezia Giulia',\n 'it-42': 'Liguria',\n 'it-45': 'Emilia-Romagna',\n 'it-52': 'Tuscany',\n 'it-55': 'Umbria',\n 'it-57': 'Marche',\n 'it-62': 'Lazio',\n 'it-65': 'Abruzzo',\n 'it-67': 'Molise',\n 'it-72': 'Campania',\n 'it-75': 'Apulia',\n 'it-77': 'Basilicata',\n 'it-78': 'Calabria',\n 'it-82': 'Sicily',\n 'it-88': 'Sardinia',\n je: 'Jersey',\n jm: 'Jamaica',\n jo: 'Jordan',\n jp: 'Japan',\n ke: 'Kenya',\n kg: 'Kyrgyzstan',\n kh: 'Cambodia',\n ki: 'Kiribati',\n km: 'Comoros',\n kn: 'Saint Kitts and Nevis',\n kp: 'North Korea',\n kr: 'South Korea',\n kw: 'Kuwait',\n ky: 'Cayman Islands',\n kz: 'Kazakhstan',\n la: 'Laos',\n lb: 'Lebanon',\n lc: 'Saint Lucia',\n li: 'Liechtenstein',\n lk: 'Sri Lanka',\n lr: 'Liberia',\n ls: 'Lesotho',\n lt: 'Lithuania',\n lu: 'Luxembourg',\n lv: 'Latvia',\n ly: 'Libya',\n ma: 'Morocco',\n mc: 'Monaco',\n md: 'Moldova',\n me: 'Montenegro',\n mf: 'Saint Martin',\n mg: 'Madagascar',\n mh: 'Marshall Islands',\n mk: 'North Macedonia',\n ml: 'Mali',\n mm: 'Myanmar',\n mn: 'Mongolia',\n mo: 'Macau',\n mp: 'Northern Mariana Islands',\n mq: 'Martinique',\n mr: 'Mauritania',\n ms: 'Montserrat',\n mt: 'Malta',\n mu: 'Mauritius',\n mv: 'Maldives',\n mw: 'Malawi',\n mx: 'Mexico',\n my: 'Malaysia',\n mz: 'Mozambique',\n na: 'Namibia',\n nc: 'New Caledonia',\n ne: 'Niger',\n nf: 'Norfolk Island',\n ng: 'Nigeria',\n ni: 'Nicaragua',\n nl: 'Netherlands',\n no: 'Norway',\n np: 'Nepal',\n nr: 'Nauru',\n nu: 'Niue',\n nz: 'New Zealand',\n om: 'Oman',\n pa: 'Panama',\n pe: 'Peru',\n pf: 'French Polynesia',\n pg: 'Papua New Guinea',\n ph: 'Philippines',\n pk: 'Pakistan',\n pl: 'Poland',\n pm: 'Saint Pierre and Miquelon',\n pn: 'Pitcairn Islands',\n pr: 'Puerto Rico',\n ps: 'Palestine',\n pt: 'Portugal',\n pw: 'Palau',\n py: 'Paraguay',\n qa: 'Qatar',\n re: 'Réunion',\n ro: 'Romania',\n rs: 'Serbia',\n ru: 'Russia',\n rw: 'Rwanda',\n sa: 'Saudi Arabia',\n sb: 'Solomon Islands',\n sc: 'Seychelles',\n sd: 'Sudan',\n se: 'Sweden',\n sg: 'Singapore',\n sh: 'Saint Helena, Ascension and Tristan da Cunha',\n si: 'Slovenia',\n sj: 'Svalbard and Jan Mayen',\n sk: 'Slovakia',\n sl: 'Sierra Leone',\n sm: 'San Marino',\n sn: 'Senegal',\n so: 'Somalia',\n sr: 'Suriname',\n ss: 'South Sudan',\n st: 'São Tomé and Príncipe',\n sv: 'El Salvador',\n sx: 'Sint Maarten',\n sy: 'Syria',\n sz: 'Eswatini (Swaziland)',\n ta: 'Tristan da Cunha',\n tc: 'Turks and Caicos Islands',\n td: 'Chad',\n tf: 'French Southern and Antarctic Lands',\n tg: 'Togo',\n th: 'Thailand',\n tj: 'Tajikistan',\n tk: 'Tokelau',\n tl: 'Timor-Leste',\n tm: 'Turkmenistan',\n tn: 'Tunisia',\n to: 'Tonga',\n tr: 'Turkey',\n tt: 'Trinidad and Tobago',\n tv: 'Tuvalu',\n tw: 'Taiwan',\n tz: 'Tanzania',\n ua: 'Ukraine',\n ug: 'Uganda',\n um: 'United States Minor Outlying Islands',\n un: 'United Nations',\n us: 'United States',\n 'us-ak': 'Alaska',\n 'us-al': 'Alabama',\n 'us-ar': 'Arkansas',\n 'us-az': 'Arizona',\n 'us-ca': 'California',\n 'us-co': 'Colorado',\n 'us-ct': 'Connecticut',\n 'us-de': 'Delaware',\n 'us-fl': 'Florida',\n 'us-ga': 'Georgia',\n 'us-hi': 'Hawaii',\n 'us-ia': 'Iowa',\n 'us-id': 'Idaho',\n 'us-il': 'Illinois',\n 'us-in': 'Indiana',\n 'us-ks': 'Kansas',\n 'us-ky': 'Kentucky',\n 'us-la': 'Louisiana',\n 'us-ma': 'Massachusetts',\n 'us-md': 'Maryland',\n 'us-me': 'Maine',\n 'us-mi': 'Michigan',\n 'us-mn': 'Minnesota',\n 'us-mo': 'Missouri',\n 'us-ms': 'Mississippi',\n 'us-mt': 'Montana',\n 'us-nc': 'North Carolina',\n 'us-nd': 'North Dakota',\n 'us-ne': 'Nebraska',\n 'us-nh': 'New Hampshire',\n 'us-nj': 'New Jersey',\n 'us-nm': 'New Mexico',\n 'us-nv': 'Nevada',\n 'us-ny': 'New York',\n 'us-oh': 'Ohio',\n 'us-ok': 'Oklahoma',\n 'us-or': 'Oregon',\n 'us-pa': 'Pennsylvania',\n 'us-ri': 'Rhode Island',\n 'us-sc': 'South Carolina',\n 'us-sd': 'South Dakota',\n 'us-tn': 'Tennessee',\n 'us-tx': 'Texas',\n 'us-ut': 'Utah',\n 'us-va': 'Virginia',\n 'us-vt': 'Vermont',\n 'us-wa': 'Washington',\n 'us-wi': 'Wisconsin',\n 'us-wv': 'West Virginia',\n 'us-wy': 'Wyoming',\n uy: 'Uruguay',\n uz: 'Uzbekistan',\n va: 'Vatican City (Holy See)',\n vc: 'Saint Vincent and the Grenadines',\n ve: 'Venezuela',\n vg: 'British Virgin Islands',\n vi: 'United States Virgin Islands',\n vn: 'Vietnam',\n vu: 'Vanuatu',\n wf: 'Wallis and Futuna',\n ws: 'Samoa',\n xk: 'Kosovo',\n ye: 'Yemen',\n yt: 'Mayotte',\n za: 'South Africa',\n zm: 'Zambia',\n zw: 'Zimbabwe',\n} as const;\n\nexport type CountryCode = keyof typeof FLAGS;\n\nexport const COUNTRY_CODES = Object.keys(FLAGS) as CountryCode[];\n","export class FlagResizerError extends Error {\n public override readonly name = 'FlagResizerError';\n\n public constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n }\n}\n","import path from 'node:path';\n\nimport { loadConfig } from 'c12';\nimport { z } from 'zod';\n\nimport { COUNTRY_CODES, FLAGS, type CountryCode } from './data/flags.js';\nimport { FlagResizerError } from './errors.js';\nimport type {\n FlagFormat,\n FlagFilterValue,\n FlagResizerConfig,\n GenerateOptions,\n ProfileConfig,\n ResolvedConfiguration,\n ResolvedProfileConfig,\n} from './types.js';\n\nconst countryCodeSchema = z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]);\nconst filterPatternSchema = z\n .string()\n .regex(/^(?=.*\\*)[a-z*]+(?:-[a-z*]+)*$/u, 'must be a lowercase flag code or a pattern using \"*\"');\nconst filterValueSchema = z.union([countryCodeSchema, filterPatternSchema]);\nconst formatSchema = z.enum(['png', 'webp']);\nconst sizeSchema = z.tuple([\n z.number().int().positive('width must be a positive integer'),\n z.number().int().positive('height must be a positive integer'),\n]);\nconst formatOutputSchema = z\n .object({\n dir: z.string().trim().min(1),\n publicPath: z.string().trim().min(1),\n })\n .strict();\nconst profileSchema = z\n .object({\n filter: z\n .object({\n type: z.enum(['whitelist', 'blacklist']),\n values: z.array(filterValueSchema),\n })\n .strict(),\n sizes: z.array(sizeSchema).min(1),\n quality: z.number().int().min(1).max(100),\n formats: z.array(formatSchema).min(1),\n output: z\n .object({\n png: formatOutputSchema.optional(),\n webp: formatOutputSchema.optional(),\n ts: z.string().trim().min(1),\n })\n .strict(),\n })\n .strict();\nconst configSchema = z.record(z.string().trim().min(1), profileSchema);\n\ninterface LoadedConfig {\n raw: unknown;\n baseDir: string;\n configFile?: string;\n}\n\nexport function defineConfig<const T extends FlagResizerConfig>(config: T): T {\n return config;\n}\n\nfunction formatValidationError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const location = issue.path.length > 0 ? issue.path.join('.') : 'config';\n const received = issue.code === 'invalid_value' ? ` (${String(issue.input)})` : '';\n return `${location}: ${issue.message}${received}`;\n })\n .join('\\n');\n}\n\nfunction preflightFormatTypos(raw: unknown): void {\n if (typeof raw !== 'object' || raw === null) return;\n\n for (const [profileName, value] of Object.entries(raw)) {\n if (typeof value !== 'object' || value === null) continue;\n const formats: unknown = Reflect.get(value, 'formats');\n if (Array.isArray(formats) && formats.includes('wepb')) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" contains format \"wepb\". Did you mean \"webp\"?`,\n );\n }\n }\n}\n\nfunction normalizePublicPath(publicPath: string): string {\n const normalized = publicPath.replace(/\\/+$/u, '');\n return normalized === '' ? '/' : normalized;\n}\n\nfunction assertUniqueValues(profileName: string, profile: ProfileConfig): void {\n const formats = new Set(profile.formats);\n if (formats.size !== profile.formats.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate formats.`);\n }\n\n const sizes = new Set(profile.sizes.map(([width, height]) => `${width}x${height}`));\n if (sizes.size !== profile.sizes.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate sizes.`);\n }\n\n const countries = new Set(profile.filter.values);\n if (countries.size !== profile.filter.values.length) {\n throw new FlagResizerError(`Profile \"${profileName}\" contains duplicate filter values.`);\n }\n}\n\nfunction assertConsistentRatio(profileName: string, profile: ProfileConfig): void {\n const first = profile.sizes[0];\n if (!first) return;\n\n const [baseWidth, baseHeight] = first;\n for (const [width, height] of profile.sizes.slice(1)) {\n if (width * baseHeight !== height * baseWidth) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" mixes aspect ratios: ${baseWidth}x${baseHeight} and ${width}x${height}.`,\n );\n }\n }\n}\n\nfunction matchesFilterValue(code: CountryCode, value: FlagFilterValue): boolean {\n if (!value.includes('*')) return code === value;\n return new RegExp(`^${value.split('*').join('.*')}$`, 'u').test(code);\n}\n\nfunction assertFilterValuesMatch(profileName: string, profile: ProfileConfig): void {\n for (const value of profile.filter.values) {\n if (!COUNTRY_CODES.some((code) => matchesFilterValue(code, value))) {\n throw new FlagResizerError(\n `Profile \"${profileName}\" contains filter pattern \"${value}\" that matches no bundled flags.`,\n );\n }\n }\n}\n\nfunction selectCountries(profile: ProfileConfig): readonly CountryCode[] {\n return COUNTRY_CODES.filter((code) => {\n const matches = profile.filter.values.some((value) => matchesFilterValue(code, value));\n return profile.filter.type === 'whitelist' ? matches : !matches;\n });\n}\n\nfunction resolveProfile(\n name: string,\n profile: ProfileConfig,\n baseDir: string,\n): ResolvedProfileConfig {\n assertUniqueValues(name, profile);\n assertConsistentRatio(name, profile);\n assertFilterValuesMatch(name, profile);\n\n for (const format of profile.formats) {\n if (!profile.output[format]) {\n throw new FlagResizerError(\n `Profile \"${name}\" enables \"${format}\" but output.${format} is missing.`,\n );\n }\n }\n\n return {\n ...profile,\n name,\n countries: selectCountries(profile),\n output: {\n ...(profile.output.png\n ? {\n png: {\n dir: path.resolve(baseDir, profile.output.png.dir),\n publicPath: normalizePublicPath(profile.output.png.publicPath),\n },\n }\n : {}),\n ...(profile.output.webp\n ? {\n webp: {\n dir: path.resolve(baseDir, profile.output.webp.dir),\n publicPath: normalizePublicPath(profile.output.webp.publicPath),\n },\n }\n : {}),\n ts: path.resolve(baseDir, profile.output.ts),\n },\n };\n}\n\nfunction profileTargets(profile: ResolvedProfileConfig): Iterable<string> {\n const targets: string[] = [profile.output.ts];\n\n for (const format of profile.formats) {\n const output = profile.output[format];\n if (!output) continue;\n for (const [width, height] of profile.sizes) {\n for (const code of profile.countries) {\n targets.push(path.join(output.dir, `${width}x${height}`, `${code}.${format}`));\n }\n }\n }\n\n return targets;\n}\n\nfunction assertNoTargetCollisions(profiles: readonly ResolvedProfileConfig[]): void {\n const owners = new Map<string, string>();\n\n for (const profile of profiles) {\n for (const target of profileTargets(profile)) {\n const owner = owners.get(target);\n if (owner) {\n throw new FlagResizerError(\n `Profiles \"${owner}\" and \"${profile.name}\" both generate ${target}.`,\n );\n }\n owners.set(target, profile.name);\n }\n }\n}\n\nasync function loadRawConfiguration(options: GenerateOptions): Promise<LoadedConfig> {\n const cwd = path.resolve(options.cwd ?? process.cwd());\n if ('config' in options) {\n return { raw: options.config, baseDir: cwd };\n }\n\n const requestedFile = options.configFile ? path.resolve(cwd, options.configFile) : undefined;\n\n try {\n const result = await loadConfig({\n name: 'flag-resizer',\n cwd,\n ...(requestedFile ? { configFile: requestedFile } : {}),\n configFileRequired: true,\n rcFile: false,\n globalRc: false,\n packageJson: false,\n dotenv: false,\n envName: false,\n extend: false,\n });\n const discoveredFile =\n typeof result.configFile === 'string' ? path.resolve(result.configFile) : requestedFile;\n\n return {\n raw: result.config,\n baseDir: discoveredFile ? path.dirname(discoveredFile) : cwd,\n ...(discoveredFile ? { configFile: discoveredFile } : {}),\n };\n } catch (error) {\n const target = requestedFile ?? path.join(cwd, 'flag-resizer.config.*');\n throw new FlagResizerError(`Unable to load flag-resizer configuration from ${target}.`, {\n cause: error,\n });\n }\n}\n\nexport async function resolveConfiguration(\n options: GenerateOptions,\n): Promise<ResolvedConfiguration> {\n const loaded = await loadRawConfiguration(options);\n preflightFormatTypos(loaded.raw);\n\n const parsed = configSchema.safeParse(loaded.raw);\n if (!parsed.success) {\n throw new FlagResizerError(\n `Invalid flag-resizer configuration:\\n${formatValidationError(parsed.error)}`,\n );\n }\n\n const entries = Object.entries(parsed.data);\n if (entries.length === 0) {\n throw new FlagResizerError('The configuration must contain at least one profile.');\n }\n\n const allProfiles = entries.map(([name, profile]) =>\n resolveProfile(name, profile as ProfileConfig, loaded.baseDir),\n );\n assertNoTargetCollisions(allProfiles);\n\n const requested = options.profiles;\n const selected =\n requested && requested.length > 0\n ? requested.map((name) => {\n const profile = allProfiles.find((candidate) => candidate.name === name);\n if (!profile) {\n throw new FlagResizerError(\n `Unknown profile \"${name}\". Available profiles: ${allProfiles\n .map((candidate) => candidate.name)\n .join(', ')}.`,\n );\n }\n return profile;\n })\n : allProfiles;\n\n if (new Set(selected.map((profile) => profile.name)).size !== selected.length) {\n throw new FlagResizerError('A profile was selected more than once.');\n }\n\n return {\n baseDir: loaded.baseDir,\n profiles: selected,\n ...(loaded.configFile ? { configFile: loaded.configFile } : {}),\n };\n}\n\nexport function getCountryName(code: CountryCode): string {\n return FLAGS[code];\n}\n\nexport function isFlagFormat(value: string): value is FlagFormat {\n return value === 'png' || value === 'webp';\n}\n","import { FLAGS } from './data/flags.js';\nimport type { FlagFormat, ResolvedProfileConfig } from './types.js';\n\nfunction quote(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction propertyKey(value: string): string {\n return /^[A-Za-z_$][\\w$]*$/u.test(value) ? value : quote(value);\n}\n\nexport function createTypeScriptManifest(profile: ResolvedProfileConfig): string {\n const flags = profile.countries\n .map((code) => ` ${propertyKey(code)}: ${quote(FLAGS[code])},`)\n .join('\\n');\n const sizes = profile.sizes.map(([width, height]) => `${width}x${height}`);\n const sizeValues = sizes.map((size) => ` ${quote(size)},`).join('\\n');\n const dimensions = profile.sizes\n .map(\n ([width, height]) =>\n ` ${quote(`${width}x${height}`)}: { width: ${width}, height: ${height} },`,\n )\n .join('\\n');\n const formats = profile.formats.map((format) => ` ${quote(format)},`).join('\\n');\n const publicPaths = profile.formats\n .map((format: FlagFormat) => {\n const output = profile.output[format];\n if (!output) throw new Error(`Missing resolved output for ${format}.`);\n return ` ${format}: ${quote(output.publicPath)},`;\n })\n .join('\\n');\n\n return `/**\n * Generated by script 🍺\n * Do not edit manually.\n */\n\nexport const FLAGS = {\n${flags}\n} as const;\n\nexport type CountryCode = keyof typeof FLAGS;\n\nexport const FLAG_SIZES = [\n${sizeValues}\n] as const;\n\nexport type FlagSize = (typeof FLAG_SIZES)[number];\n\nexport const FLAG_DIMENSIONS = {\n${dimensions}\n} as const satisfies Record<FlagSize, { width: number; height: number }>;\n\nexport const FLAG_FORMATS = [\n${formats}\n] as const;\n\nexport type FlagFormat = (typeof FLAG_FORMATS)[number];\n\nexport const FLAG_PUBLIC_PATHS = {\n${publicPaths}\n} as const satisfies Record<FlagFormat, string>;\n\nexport function getFlagPath(\n code: CountryCode,\n size: FlagSize,\n format: FlagFormat,\n): string {\n const publicPath: string = FLAG_PUBLIC_PATHS[format];\n const basePath = publicPath === '/' ? '' : publicPath;\n return \\`\\${basePath}/\\${size}/\\${code}.\\${format}\\`;\n}\n`;\n}\n","import {\n access,\n copyFile,\n mkdir,\n mkdtemp,\n readFile,\n rename,\n rm,\n rmdir,\n stat,\n unlink,\n writeFile,\n} from 'node:fs/promises';\nimport { availableParallelism } from 'node:os';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { randomUUID } from 'node:crypto';\n\nimport sharp from 'sharp';\n\nimport { resolveConfiguration } from './config.js';\nimport type { CountryCode } from './data/flags.js';\nimport { FlagResizerError } from './errors.js';\nimport { createTypeScriptManifest } from './generated-typescript.js';\nimport type {\n FlagFormat,\n GenerateOptions,\n GenerationResult,\n ProfileGenerationResult,\n ResolvedProfileConfig,\n} from './types.js';\n\nconst PACKAGE_ROOT = fileURLToPath(new URL('../', import.meta.url));\nconst FLAGS_DIRECTORY = path.join(PACKAGE_ROOT, 'flags');\nconst ATTRIBUTION_FILE = path.join(PACKAGE_ROOT, 'ATTRIBUTION.txt');\nconst GRAPHICS_LICENSE_FILE = path.join(PACKAGE_ROOT, 'LICENSE-GRAPHICS');\nconst MANIFEST_VERSION = 1;\n\ntype ManagedFileKind = 'attribution' | 'image' | 'license' | 'typescript';\ntype FileStatus = 'created' | 'updated' | 'unchanged';\n\ninterface ManagedFile {\n root: string;\n relativePath: string;\n kind: ManagedFileKind;\n}\n\ninterface ProfileManifest {\n files: ManagedFile[];\n}\n\ninterface ManagedManifest {\n version: typeof MANIFEST_VERSION;\n profiles: Record<string, ProfileManifest>;\n}\n\ninterface PlannedFile {\n entry: ManagedFile;\n target: string;\n image: boolean;\n createContent: () => Promise<Buffer>;\n}\n\ninterface GenerationPlan {\n tasks: PlannedFile[];\n filesByProfile: Map<string, ManagedFile[]>;\n imageCountByProfile: Map<string, number>;\n}\n\nfunction emptyManifest(): ManagedManifest {\n return { version: MANIFEST_VERSION, profiles: {} };\n}\n\nfunction entryTarget(entry: ManagedFile): string {\n return path.resolve(entry.root, entry.relativePath);\n}\n\nfunction entryKey(entry: ManagedFile): string {\n return entryTarget(entry);\n}\n\nfunction assertSafeManagedFile(entry: ManagedFile): void {\n if (!path.isAbsolute(entry.root)) {\n throw new FlagResizerError('The managed manifest contains a non-absolute output root.');\n }\n if (path.isAbsolute(entry.relativePath) || entry.relativePath.includes('\\0')) {\n throw new FlagResizerError('The managed manifest contains an unsafe file path.');\n }\n\n const target = entryTarget(entry);\n const relative = path.relative(entry.root, target);\n if (relative === '' || relative === '..' || relative.startsWith(`..${path.sep}`)) {\n throw new FlagResizerError('The managed manifest contains a path outside its output root.');\n }\n\n const portable = entry.relativePath.split(path.sep).join('/');\n const valid =\n (entry.kind === 'attribution' && portable === 'ATTRIBUTION.txt') ||\n (entry.kind === 'license' && portable === 'LICENSE-GRAPHICS') ||\n (entry.kind === 'typescript' && /^[^/]+\\.ts$/u.test(portable)) ||\n (entry.kind === 'image' &&\n /^[1-9]\\d*x[1-9]\\d*\\/(?:[a-z]{2}|au-(?:act|nsw|nt|qld|sa|tas|vic|wa)|ca-(?:ab|bc|mb|nb|nl|ns|nt|nu|on|pe|qc|sk|yt)|de-(?:bb|be|bw|by|hb|he|hh|mv|ni|nw|rp|sh|sl|sn|st|th)|es-(?:an|ar|as|cb|ce|cl|cm|cn|ct|ex|ga|ib|mc|md|ml|nc|pv|ri|vc)|gb-(?:eng|nir|sct|wls)|it-(?:21|23|25|32|34|36|42|45|52|55|57|62|65|67|72|75|77|78|82|88)|us-(?:ak|al|ar|az|ca|co|ct|de|fl|ga|hi|ia|id|il|in|ks|ky|la|ma|md|me|mi|mn|mo|ms|mt|nc|nd|ne|nh|nj|nm|nv|ny|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|va|vt|wa|wi|wv|wy))\\.(?:png|webp)$/u.test(\n portable,\n ));\n\n if (!valid) {\n throw new FlagResizerError(\n `The managed manifest contains an invalid ${entry.kind} path: ${entry.relativePath}.`,\n );\n }\n}\n\nfunction managedFile(target: string, root: string, kind: ManagedFileKind): ManagedFile {\n const entry = {\n root: path.resolve(root),\n relativePath: path.relative(path.resolve(root), path.resolve(target)),\n kind,\n };\n assertSafeManagedFile(entry);\n return entry;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction parseManifest(value: unknown): ManagedManifest {\n if (!isRecord(value) || value['version'] !== MANIFEST_VERSION || !isRecord(value['profiles'])) {\n throw new FlagResizerError('The managed manifest has an unsupported or invalid structure.');\n }\n\n const profiles: Record<string, ProfileManifest> = {};\n for (const [profileName, profileValue] of Object.entries(value['profiles'])) {\n if (!isRecord(profileValue) || !Array.isArray(profileValue['files'])) {\n throw new FlagResizerError(`The manifest entry for profile \"${profileName}\" is invalid.`);\n }\n\n const files = profileValue['files'].map((file): ManagedFile => {\n if (\n !isRecord(file) ||\n typeof file['root'] !== 'string' ||\n typeof file['relativePath'] !== 'string' ||\n !['attribution', 'image', 'license', 'typescript'].includes(String(file['kind']))\n ) {\n throw new FlagResizerError(\n `The manifest contains an invalid file owned by profile \"${profileName}\".`,\n );\n }\n const entry: ManagedFile = {\n root: file['root'],\n relativePath: file['relativePath'],\n kind: file['kind'] as ManagedFileKind,\n };\n assertSafeManagedFile(entry);\n return entry;\n });\n profiles[profileName] = { files };\n }\n\n return { version: MANIFEST_VERSION, profiles };\n}\n\nasync function pathExists(file: string): Promise<boolean> {\n try {\n await access(file);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function readManifest(file: string): Promise<ManagedManifest> {\n try {\n return parseManifest(JSON.parse(await readFile(file, 'utf8')) as unknown);\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') {\n return emptyManifest();\n }\n if (error instanceof FlagResizerError) throw error;\n throw new FlagResizerError(`Unable to read managed manifest ${file}.`, { cause: error });\n }\n}\n\nfunction resolveConcurrency(value: number | undefined): number {\n if (value !== undefined && (!Number.isInteger(value) || value < 1)) {\n throw new FlagResizerError('concurrency must be a positive integer.');\n }\n return value ?? Math.max(1, Math.min(8, availableParallelism()));\n}\n\nasync function runBounded<T>(\n items: readonly T[],\n concurrency: number,\n worker: (item: T, index: number) => Promise<void>,\n): Promise<void> {\n let nextIndex = 0;\n\n async function runWorker(): Promise<void> {\n while (nextIndex < items.length) {\n const index = nextIndex;\n nextIndex += 1;\n const item = items[index];\n if (item) await worker(item, index);\n }\n }\n\n await Promise.all(\n Array.from({ length: Math.min(concurrency, Math.max(1, items.length)) }, runWorker),\n );\n}\n\nfunction svgDensity(width: number, height: number): number {\n const scale = Math.max(width, height) / 36;\n return Math.max(72, Math.ceil(scale * 72));\n}\n\nasync function createImage(\n svg: Buffer,\n width: number,\n height: number,\n format: FlagFormat,\n quality: number,\n): Promise<Buffer> {\n const pipeline = sharp(svg, { density: svgDensity(width, height) })\n .resize(width, height, {\n fit: 'cover',\n position: 'centre',\n })\n .ensureAlpha();\n\n if (format === 'png') {\n return pipeline\n .png({\n quality,\n compressionLevel: 9,\n adaptiveFiltering: true,\n effort: 7,\n })\n .toBuffer();\n }\n\n return pipeline.webp({ quality, effort: 4 }).toBuffer();\n}\n\nfunction addProfileFile(\n filesByProfile: Map<string, ManagedFile[]>,\n profileName: string,\n entry: ManagedFile,\n): void {\n const entries = filesByProfile.get(profileName) ?? [];\n entries.push(entry);\n filesByProfile.set(profileName, entries);\n}\n\nfunction createGenerationPlan(profiles: readonly ResolvedProfileConfig[]): GenerationPlan {\n const taskByTarget = new Map<string, PlannedFile>();\n const filesByProfile = new Map<string, ManagedFile[]>();\n const imageCountByProfile = new Map<string, number>();\n const svgCache = new Map<CountryCode, Promise<Buffer>>();\n let attributionContent: Promise<Buffer> | undefined;\n let licenseContent: Promise<Buffer> | undefined;\n\n const readSvg = (code: CountryCode): Promise<Buffer> => {\n let content = svgCache.get(code);\n if (!content) {\n content = readFile(path.join(FLAGS_DIRECTORY, `${code}.svg`));\n svgCache.set(code, content);\n }\n return content;\n };\n\n const register = (\n profileName: string,\n entry: ManagedFile,\n image: boolean,\n createContent: () => Promise<Buffer>,\n ): void => {\n const target = entryTarget(entry);\n if (!taskByTarget.has(target)) {\n taskByTarget.set(target, { entry, target, image, createContent });\n }\n addProfileFile(filesByProfile, profileName, entry);\n };\n\n for (const profile of profiles) {\n const typeScriptEntry = managedFile(\n profile.output.ts,\n path.dirname(profile.output.ts),\n 'typescript',\n );\n register(profile.name, typeScriptEntry, false, () =>\n Promise.resolve(Buffer.from(createTypeScriptManifest(profile))),\n );\n\n let imageCount = 0;\n for (const format of profile.formats) {\n const output = profile.output[format];\n if (!output) {\n throw new FlagResizerError(\n `Profile \"${profile.name}\" has no resolved output for ${format}.`,\n );\n }\n\n const attributionEntry = managedFile(\n path.join(output.dir, 'ATTRIBUTION.txt'),\n output.dir,\n 'attribution',\n );\n register(profile.name, attributionEntry, false, () => {\n attributionContent ??= readFile(ATTRIBUTION_FILE);\n return attributionContent;\n });\n\n const licenseEntry = managedFile(\n path.join(output.dir, 'LICENSE-GRAPHICS'),\n output.dir,\n 'license',\n );\n register(profile.name, licenseEntry, false, () => {\n licenseContent ??= readFile(GRAPHICS_LICENSE_FILE);\n return licenseContent;\n });\n\n for (const [width, height] of profile.sizes) {\n for (const code of profile.countries) {\n const target = path.join(output.dir, `${width}x${height}`, `${code}.${format}`);\n const entry = managedFile(target, output.dir, 'image');\n register(profile.name, entry, true, async () =>\n createImage(await readSvg(code), width, height, format, profile.quality),\n );\n imageCount += 1;\n }\n }\n }\n imageCountByProfile.set(profile.name, imageCount);\n }\n\n return {\n tasks: [...taskByTarget.values()].sort((left, right) =>\n left.target.localeCompare(right.target),\n ),\n filesByProfile,\n imageCountByProfile,\n };\n}\n\nasync function buffersEqual(file: string, expected: Buffer): Promise<boolean> {\n try {\n const currentStat = await stat(file);\n if (currentStat.size !== expected.byteLength) return false;\n return (await readFile(file)).equals(expected);\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') return false;\n throw error;\n }\n}\n\nasync function writeStagedFile(target: string, staged: string): Promise<void> {\n await mkdir(path.dirname(target), { recursive: true });\n const temporaryTarget = path.join(\n path.dirname(target),\n `.${path.basename(target)}.${process.pid}.${randomUUID()}.tmp`,\n );\n\n try {\n await copyFile(staged, temporaryTarget);\n await rename(temporaryTarget, target);\n } finally {\n await rm(temporaryTarget, { force: true });\n }\n}\n\nasync function writeAtomic(target: string, content: string): Promise<void> {\n await mkdir(path.dirname(target), { recursive: true });\n const temporaryTarget = path.join(\n path.dirname(target),\n `.${path.basename(target)}.${process.pid}.${randomUUID()}.tmp`,\n );\n\n try {\n await writeFile(temporaryTarget, content);\n await rename(temporaryTarget, target);\n } finally {\n await rm(temporaryTarget, { force: true });\n }\n}\n\nasync function removeEmptyParents(start: string, root: string): Promise<void> {\n let directory = path.resolve(start);\n const resolvedRoot = path.resolve(root);\n\n while (directory !== resolvedRoot) {\n const relative = path.relative(resolvedRoot, directory);\n if (relative === '..' || relative.startsWith(`..${path.sep}`)) return;\n try {\n await rmdir(directory);\n } catch {\n return;\n }\n directory = path.dirname(directory);\n }\n}\n\nasync function pruneFile(entry: ManagedFile): Promise<boolean> {\n assertSafeManagedFile(entry);\n const target = entryTarget(entry);\n try {\n await unlink(target);\n await removeEmptyParents(path.dirname(target), entry.root);\n return true;\n } catch (error) {\n if (isRecord(error) && error['code'] === 'ENOENT') return false;\n throw new FlagResizerError(`Unable to remove stale generated file ${target}.`, {\n cause: error,\n });\n }\n}\n\nfunction sortedManifest(manifest: ManagedManifest): ManagedManifest {\n return {\n version: MANIFEST_VERSION,\n profiles: Object.fromEntries(\n Object.entries(manifest.profiles)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([profileName, profile]) => [\n profileName,\n {\n files: [...profile.files].sort((left, right) =>\n entryTarget(left).localeCompare(entryTarget(right)),\n ),\n },\n ]),\n ),\n };\n}\n\nfunction nextManifest(\n previous: ManagedManifest,\n plan: GenerationPlan,\n selectedProfiles: readonly ResolvedProfileConfig[],\n fullRun: boolean,\n): ManagedManifest {\n const profiles: Record<string, ProfileManifest> = fullRun ? {} : { ...previous.profiles };\n for (const profile of selectedProfiles) {\n profiles[profile.name] = { files: plan.filesByProfile.get(profile.name) ?? [] };\n }\n return sortedManifest({ version: MANIFEST_VERSION, profiles });\n}\n\nfunction staleEntries(previous: ManagedManifest, next: ManagedManifest): ManagedFile[] {\n const retainedTargets = new Set(\n Object.values(next.profiles).flatMap((profile) => profile.files.map(entryKey)),\n );\n const stale = new Map<string, ManagedFile>();\n\n for (const profile of Object.values(previous.profiles)) {\n for (const entry of profile.files) {\n const target = entryKey(entry);\n if (!retainedTargets.has(target)) stale.set(target, entry);\n }\n }\n return [...stale.values()];\n}\n\nfunction removedOwnershipCount(\n previous: ManagedManifest,\n next: ManagedManifest,\n profileName: string,\n): number {\n const nextFiles = new Set((next.profiles[profileName]?.files ?? []).map(entryKey));\n return (previous.profiles[profileName]?.files ?? []).filter(\n (entry) => !nextFiles.has(entryKey(entry)),\n ).length;\n}\n\nexport async function generate(options: GenerateOptions = {}): Promise<GenerationResult> {\n const started = performance.now();\n const concurrency = resolveConcurrency(options.concurrency);\n const resolved = await resolveConfiguration(options);\n const manifestFile = path.join(resolved.baseDir, '.flag-resizer', 'manifest.json');\n const previousManifest = await readManifest(manifestFile);\n const plan = createGenerationPlan(resolved.profiles);\n const fullRun = !options.profiles || options.profiles.length === 0;\n const manifest = nextManifest(previousManifest, plan, resolved.profiles, fullRun);\n const stale = staleEntries(previousManifest, manifest);\n const statuses = new Map<string, FileStatus>();\n const dryRun = options.dryRun ?? false;\n\n if (dryRun) {\n await runBounded(plan.tasks, concurrency, async (task) => {\n statuses.set(task.target, (await pathExists(task.target)) ? 'updated' : 'created');\n });\n } else {\n const stagingDirectory = await mkdtemp(path.join(os.tmpdir(), 'flag-resizer-'));\n const stagedFiles = new Map<string, string>();\n\n try {\n await runBounded(plan.tasks, concurrency, async (task, index) => {\n const content = await task.createContent();\n const exists = await pathExists(task.target);\n if (exists && (await buffersEqual(task.target, content))) {\n statuses.set(task.target, 'unchanged');\n return;\n }\n\n statuses.set(task.target, exists ? 'updated' : 'created');\n const staged = path.join(stagingDirectory, String(index));\n await writeFile(staged, content);\n stagedFiles.set(task.target, staged);\n });\n\n for (const task of plan.tasks) {\n const staged = stagedFiles.get(task.target);\n if (staged) await writeStagedFile(task.target, staged);\n }\n\n for (const entry of stale) await pruneFile(entry);\n await writeAtomic(manifestFile, `${JSON.stringify(manifest, null, 2)}\\n`);\n } catch (error) {\n throw new FlagResizerError('Flag generation failed before the manifest was committed.', {\n cause: error,\n });\n } finally {\n await rm(stagingDirectory, { recursive: true, force: true });\n }\n }\n\n const profiles: ProfileGenerationResult[] = resolved.profiles.map((profile) => {\n const entries = plan.filesByProfile.get(profile.name) ?? [];\n const counts = { created: 0, updated: 0, unchanged: 0 };\n for (const entry of entries) {\n const status = statuses.get(entryTarget(entry));\n if (status) counts[status] += 1;\n }\n\n return {\n name: profile.name,\n countries: profile.countries.length,\n images: plan.imageCountByProfile.get(profile.name) ?? 0,\n sizes: profile.sizes,\n formats: profile.formats,\n outputDirectories: Object.fromEntries(\n profile.formats.map((format) => [format, profile.output[format]?.dir]),\n ),\n ...counts,\n removed: removedOwnershipCount(previousManifest, manifest, profile.name),\n typeScriptFile: profile.output.ts,\n };\n });\n\n return {\n dryRun,\n durationMs: Math.round(performance.now() - started),\n ...(resolved.configFile ? { configFile: resolved.configFile } : {}),\n manifestFile,\n profiles,\n };\n}\n"],"mappings":";;;;;;;;;AAEA,MAAa,QAAQ;CACnB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CACT,UAAU;CACV,UAAU;CACV,SAAS;CACT,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ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B,QAAQ,KAAK,oBAAoB,IAAI,QAAQ,IAAI,KAAK;GACtD,OAAO,QAAQ;GACf,SAAS,QAAQ;GACjB,mBAAmB,OAAO,YACxB,QAAQ,QAAQ,KAAK,WAAW,CAAC,QAAQ,QAAQ,OAAO,OAAO,EAAE,GAAG,CAAC,CACvE;GACA,GAAG;GACH,SAAS,sBAAsB,kBAAkB,UAAU,QAAQ,IAAI;GACvE,gBAAgB,QAAQ,OAAO;EACjC;CACF,CAAC;CAED,OAAO;EACL;EACA,YAAY,KAAK,MAAM,YAAY,IAAI,IAAI,OAAO;EAClD,GAAI,SAAS,aAAa,EAAE,YAAY,SAAS,WAAW,IAAI,CAAC;EACjE;EACA;CACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -177,6 +177,26 @@ declare const FLAGS: {
177
177
  readonly ir: "Iran";
178
178
  readonly is: "Iceland";
179
179
  readonly it: "Italy";
180
+ readonly 'it-21': "Piedmont";
181
+ readonly 'it-23': "Aosta Valley";
182
+ readonly 'it-25': "Lombardy";
183
+ readonly 'it-32': "Trentino-South Tyrol";
184
+ readonly 'it-34': "Veneto";
185
+ readonly 'it-36': "Friuli–Venezia Giulia";
186
+ readonly 'it-42': "Liguria";
187
+ readonly 'it-45': "Emilia-Romagna";
188
+ readonly 'it-52': "Tuscany";
189
+ readonly 'it-55': "Umbria";
190
+ readonly 'it-57': "Marche";
191
+ readonly 'it-62': "Lazio";
192
+ readonly 'it-65': "Abruzzo";
193
+ readonly 'it-67': "Molise";
194
+ readonly 'it-72': "Campania";
195
+ readonly 'it-75': "Apulia";
196
+ readonly 'it-77': "Basilicata";
197
+ readonly 'it-78': "Calabria";
198
+ readonly 'it-82': "Sicily";
199
+ readonly 'it-88': "Sardinia";
180
200
  readonly je: "Jersey";
181
201
  readonly jm: "Jamaica";
182
202
  readonly jo: "Jordan";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/data/flags.ts","../src/types.ts","../src/config.ts","../src/errors.ts","../src/generator.ts"],"mappings":";cAEa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoXD,2BAA2B;cAE1B,eAAsC;;;KCtXvC;KACA,qBAAqB,eAAe;KACpC;KACA,kBAAkB,cAAc;UAE3B;EACf;EACA,iBAAiB;;UAGF;EACf;EACA;;UAGe;EACf,MAAM;EACN,OAAO;EACP;;UAGe;EACf,QAAQ;EACR,gBAAgB;EAChB;EACA,kBAAkB;EAClB,QAAQ;;KAGE,oBAAoB,SAAS,eAAe;UAE9C;EACR;EACA;EACA;EACA;;UAGe,8BAA8B;EAC7C,QAAQ;EACR;;UAGe,4BAA4B;EAC3C;EACA;;KAGU,kBAAkB,wBAAwB;UAErC;EACf;EACA;EACA;EACA,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB,QAAQ,OAAO;EAClC;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,UAAU;;;;iBCVI,mBAAmB,UAAU,mBAAmB,QAAQ,IAAI;;;cC7D/D,yBAAyB;WACX;EAEN,YAAA,iBAAiB,UAAU;;;;iBCyd1B,SAAS,UAAS,kBAAuB,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/data/flags.ts","../src/types.ts","../src/config.ts","../src/errors.ts","../src/generator.ts"],"mappings":";cAEa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwYD,2BAA2B;cAE1B,eAAsC;;;KC1YvC;KACA,qBAAqB,eAAe;KACpC;KACA,kBAAkB,cAAc;UAE3B;EACf;EACA,iBAAiB;;UAGF;EACf;EACA;;UAGe;EACf,MAAM;EACN,OAAO;EACP;;UAGe;EACf,QAAQ;EACR,gBAAgB;EAChB;EACA,kBAAkB;EAClB,QAAQ;;KAGE,oBAAoB,SAAS,eAAe;UAE9C;EACR;EACA;EACA;EACA;;UAGe,8BAA8B;EAC7C,QAAQ;EACR;;UAGe,4BAA4B;EAC3C;EACA;;KAGU,kBAAkB,wBAAwB;UAErC;EACf;EACA;EACA;EACA,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB,QAAQ,OAAO;EAClC;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,UAAU;;;;iBCVI,mBAAmB,UAAU,mBAAmB,QAAQ,IAAI;;;cC7D/D,yBAAyB;WACX;EAEN,YAAA,iBAAiB,UAAU;;;;iBCyd1B,SAAS,UAAS,kBAAuB,QAAQ"}