-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconsts.ts
252 lines (243 loc) · 7.85 KB
/
consts.ts
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
/** Contains constants used throughout the API server.
*
* @module
*/
/** A symbol used to indicate the root of something. */
export const ROOT_SYMBOL = "$$root$$";
/** These constants represent the Google Datastore kinds that are used across
* the API server. */
export const kinds = {
/** An object which contains information about the usage of built-in APIs. */
API_STATS_KIND: "api_stats",
/** A single entity which holds configuration, specifically related to API
* token authentication. */
CONFIG_KIND: "config",
/** An error that was generated when doing the dependency analysis of a
* module. */
DEP_ERROR_KIND: "dependency_error",
/** A cache of information about each dependency source. */
DEP_METRICS_KIND: "dependency_metrics",
/** Cached version of the meta data for an info page of a module. */
INFO_PAGE_KIND: "info_page",
/** Daily and version related usage for a module. */
METRIC_USAGE_KIND: "metric_usage",
/** A dependency of a module. */
MODULE_DEP_KIND: "module_dependency",
/** A file or directory that is associated with a specific module version, along
* with other meta data associated with that entry. */
MODULE_ENTRY_KIND: "module_entry",
/** The meta data associated with a module. */
MODULE_KIND: "module",
/** Metrics for modules. */
MODULE_METRICS_KIND: "module_metrics",
/** Meta data related to a specific version of a module. */
MODULE_VERSION_KIND: "module_version",
/** A cached version of an index of paths used for generating completions. */
PATH_COMPLETIONS_KIND: "path_completions",
/** Represents dependency metric information by source type. */
SOURCE_METRIC_KIND: "dependency_metrics",
/** Metrics for a submodule. */
SUBMODULE_METRICS_KIND: "submodule_metrics",
BUILD_KIND: "build",
LEGACY_MODULES: "legacy_modules",
LEGACY_OWNER_QUOTAS: "legacy_owner_quotas",
LEGACY_BUILDS: "legacy_builds",
} as const;
/** These constants represent the different algolia index which are generated
* from data contained within datastore. */
export const indexes = {
/** The index which contains all the modules (and some submodules). */
MODULE_INDEX: "modules",
};
/** A set of URL patterns that are used to parse specifiers to determine their
* source. */
export const patterns = {
/** Modules that or external to the current module, but hosted on
* `deno.land/x`. */
"deno.land/x": [
new URLPattern({
protocol: "https",
hostname: "deno.land",
pathname: "/x/:pkg{@:ver}?/:mod*",
search: "*",
hash: "*",
}),
],
/** Modules that are being read directly off the deno.land CDN. */
"cdn.deno.land": [
// https://cdn.deno.land/mimetypes/versions/v1.0.0/raw/mod.ts
new URLPattern("https://cdn.deno.land/:pkg/versions/:ver/raw/:mod+"),
],
/** Dependency that originates from the Deno `std` library. */
"std": [
new URLPattern({
protocol: "https",
hostname: "deno.land",
pathname: "/std{@:ver}?/:mod*",
search: "*",
hash: "*",
}),
],
/** Modules/packages hosted on nest.land. */
"nest.land": [new URLPattern("https://x.nest.land/:pkg@:ver/:mod*")],
/** Modules hosted on crux.land. */
"crux.land": [new URLPattern("https://crux.land/:pkg@:ver")],
/** Content hosted on GitHub. */
"github.com": [
new URLPattern({
protocol: "https",
hostname: "raw.githubusercontent.com",
pathname: "/:org/:pkg/:ver/:mod*",
search: "*",
}),
// https://github.com/denoland/deno_std/raw/main/http/mod.ts
new URLPattern(
"https://github.com/:org/:pkg/raw/:ver/:mod*",
),
],
/** Content that is hosted in a GitHub gist. */
"gist.github.com": [
new URLPattern(
"https://gist.githubusercontent.com/:org/:pkg/raw/:ver/:mod*",
),
],
/** Packages that are hosted on esm.sh. */
"esm.sh": [
new URLPattern({
protocol: "http{s}?",
hostname: "{cdn.}?esm.sh",
pathname: "/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
}),
// https://esm.sh/v92/[email protected]/src/index.d.ts
new URLPattern({
protocol: "http{s}?",
hostname: "{cdn.}?esm.sh",
pathname: "/:regver(stable|v[0-9]+)/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
}),
],
"denopkg.com": [
new URLPattern({
protocol: "https",
hostname: "denopkg.com",
pathname: "/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
hash: "*",
}),
],
"denolib.com": [
new URLPattern({
protocol: "https",
hostname: "denolib.com",
pathname: "/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
hash: "*",
}),
],
"lib.deno.dev": [
new URLPattern({
protocol: "https",
hostname: "lib.deno.dev",
pathname: "/x/:pkg{@:ver}?/:mod*",
search: "*",
hash: "*",
}),
],
/** a github proxy */
"pax.deno.dev": [
// https://pax.deno.dev/windchime-yk/[email protected]/file.ts
new URLPattern("https://pax.deno.dev/:org/:pkg{@:ver}?/:mod*"),
],
/** a github proxy */
"ghuc.cc": [
// https://ghuc.cc/qwtel/kv-storage-interface/index.d.ts
new URLPattern("https://ghuc.cc/:org/:pkg{@:ver}?/:mod*"),
],
"ghc.deno.dev": [
// https://ghc.deno.dev/tbjgolden/deno-htmlparser2@1f76cdf/htmlparser2/Parser.ts
new URLPattern("https://ghc.deno.dev/:org/:pkg{@:ver}?/:mod*"),
],
/** jspm.dev and jspm.io packages */
"jspm.dev": [
// https://jspm.dev/@angular/[email protected]
new URLPattern(
"https://jspm.dev/:org((?:npm:)?@[^/]+)?/:pkg{@:ver([^!/]+)}?{(![^/]+)}?/:mod*",
),
// https://dev.jspm.io/[email protected]
new URLPattern(
"https://dev.jspm.io/:org((?:npm:)?@[^/]+)?/:pkg{@:ver([^!/]+)}?{(![^/]+)}?/:mod*",
),
],
/** Packages that are hosted on skypack.dev */
"skypack.dev": [
new URLPattern({
protocol: "https",
hostname: "cdn.skypack.dev",
pathname: "/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
}),
// https://cdn.shopstic.com/pin/[email protected]/dist=es2020,mode=types/dist/index.d.ts
// this cdn simply redirects to skypack.dev
new URLPattern({
protocol: "https",
hostname: "cdn.shopstic.com",
pathname: "/pin/:org(@[^/]+)?/:pkg{@:ver([^-/]+)}:hash/:mod*",
search: "*",
}),
// https://cdn.skypack.dev/-/@firebase/[email protected]/dist=es2019,mode=types/dist/index.d.ts
new URLPattern(
"https://cdn.skypack.dev/-/:org(@[^/]+)?/:pkg@:ver([^-]+):hash/:mod*",
),
// https://cdn.pika.dev/class-transformer@^0.2.3
new URLPattern({
protocol: "https",
hostname: "cdn.pika.dev",
pathname: "/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
search: "*",
}),
],
/** Packages that are hosted on jsdeliver.net */
"jsdeliver.net": [
new URLPattern(
"https://cdn.jsdelivr.net/npm/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
),
new URLPattern(
"https://cdn.jsdelivr.net/gh/:org/:pkg{@:ver}?/:mod*",
),
],
/** Packages that are hosted on unpkg.com */
"unpkg.com": [
new URLPattern(
"https://unpkg.com/:org(@[^/]+)?/:pkg{@:ver}?/:mod*",
),
],
/** Not really a package/module host, but performs codegen for aws APIs. */
"aws-api": [
// https://aws-api.deno.dev/latest/services/sqs.ts
new URLPattern({
protocol: "https",
hostname: "aws-api.deno.dev",
pathname: "/:ver/services/:pkg{(\\.ts)}",
search: "*",
}),
],
/** Not really a package/module host, but performs codegen for google cloud
* APIs. */
"googleapis": [
new URLPattern({
protocol: "https",
hostname: "googleapis.deno.dev",
pathname: "/v1/:pkg([^:]+){(:)}:ver{(\\.ts)}",
search: "*",
}),
],
};
// From https://api.github.com/meta
export const GITHUB_HOOKS_CIDRS = [
"192.30.252.0/22",
"185.199.108.0/22",
"140.82.112.0/20",
"143.55.64.0/20",
];