-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtsup.config.ts
More file actions
107 lines (103 loc) · 1.87 KB
/
tsup.config.ts
File metadata and controls
107 lines (103 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { existsSync } from "node:fs";
import { defineConfig } from "tsup";
/**
* Countries shipped through v0.4.0. We filter to those whose `index.ts` exists,
* so partial drafts during development still build green.
*/
const ALL_COUNTRIES = [
// v0.1.0
"sv",
"mx",
"co",
"br",
"pe",
"ar",
"cl",
"do",
"gt",
"hn",
"cr",
"es",
"us",
// v0.4.0
"bo",
"ec",
"py",
"ni",
"pa",
"uy",
"ca",
"pt",
"ve",
// v0.6.0
"gb",
"fr",
"de",
"it",
"nl",
"be",
"ch",
"pl",
"se",
"no",
"dk",
"fi",
// v1.2.0 — Asia phase 1
"in",
// v2.1.0 — Asia phase 2: Japan
"jp",
// v2.2.0 — Asia phase 3: Singapore
"sg",
// v1.7.0 — EU-VAT complete (16 EU + 1 EEA)
"ie",
"at",
"lu",
"gr",
"cz",
"hu",
"ro",
"bg",
"hr",
"sk",
"si",
"lt",
"lv",
"ee",
"mt",
"cy",
"is",
] as const;
const COUNTRIES = ALL_COUNTRIES.filter((cc) => existsSync(`src/countries/${cc}/index.ts`));
/** Locales shipping in v0.3.0 i18n. */
const I18N_LOCALES = ["es", "en", "pt"] as const;
export default defineConfig({
entry: {
index: "src/index.ts",
"algorithms/index": "src/algorithms/index.ts",
...Object.fromEntries(
COUNTRIES.map((cc) => [`countries/${cc}/index`, `src/countries/${cc}/index.ts`]),
),
// v0.3.0 — DX subpaths
"extract/index": "src/extract/index.ts",
"pii/index": "src/pii/index.ts",
"i18n/index": "src/i18n/index.ts",
...Object.fromEntries(
I18N_LOCALES.map((loc) => [`i18n/locales/${loc}`, `src/i18n/locales/${loc}.ts`]),
),
"catalog/index": "src/catalog/index.ts",
},
format: ["esm", "cjs"],
dts: { resolve: true },
splitting: false,
sourcemap: false,
clean: true,
treeshake: true,
minify: false,
target: "es2022",
outDir: "dist",
outExtension({ format }) {
return {
js: format === "cjs" ? ".cjs" : ".js",
};
},
});