-
Notifications
You must be signed in to change notification settings - Fork 176
/
build.test.ts.snap
318 lines (296 loc) · 7.6 KB
/
build.test.ts.snap
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// Vitest Snapshot v1
exports[`build fs output > _00 manifest.json 1`] = `
Object {
"action": Object {
"default_popup": "index.html",
},
"content_scripts": Array [
Object {
"all_frames": true,
"js": Array [
"assets/content.ts-loader.hash0.js",
],
"matches": Array [
"<all_urls>",
],
"run_at": "document_start",
},
],
"manifest_version": 3,
"name": "CRXJS Vanilla JS Example",
"version": "1.0.0",
"web_accessible_resources": Array [
Object {
"matches": Array [
"<all_urls>",
],
"resources": Array [
"assets/content.ts.hash1.js",
"assets/module.hash2.js",
],
"use_dynamic_url": true,
},
],
}
`;
exports[`build fs output > _01 output files 1`] = `
Array [
"assets/content.ts-loader.hash0.js",
"assets/content.ts.hash1.js",
"assets/index.hash3.css",
"assets/index.html.hash4.js",
"assets/module.hash2.js",
"assets/typescript.hash5.svg",
"index.html",
"manifest.json",
"vite.svg",
]
`;
exports[`build fs output > assets/content.ts.hash1.js 1`] = `
"const scriptRel = \\"modulepreload\\";
const assetsURL = function(dep) {
return \\"/\\" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
if (!deps || deps.length === 0) {
return baseModule();
}
return Promise.all(deps.map((dep) => {
dep = assetsURL(dep);
if (dep in seen)
return;
seen[dep] = true;
const isCss = dep.endsWith(\\".css\\");
const cssSelector = isCss ? '[rel=\\"stylesheet\\"]' : \\"\\";
if (document.querySelector(\`link[href=\\"\${dep}\\"]\${cssSelector}\`)) {
return;
}
const link = document.createElement(\\"link\\");
link.rel = isCss ? \\"stylesheet\\" : scriptRel;
if (!isCss) {
link.as = \\"script\\";
link.crossOrigin = \\"\\";
}
link.href = dep;
document.head.appendChild(link);
if (isCss) {
return new Promise((res, rej) => {
link.addEventListener(\\"load\\", res);
link.addEventListener(\\"error\\", () => rej(new Error(\`Unable to preload CSS for \${dep}\`)));
});
}
})).then(() => baseModule());
};
const sharedUtil = () => {
console.log(\\"util\\");
};
sharedUtil();
__vitePreload(() => import(\\"./module.hash2.js\\"), true ? [] : void 0);
export {
sharedUtil as s
};
// # sourceMappingURL=data:application/json;base64,<base64>
"
`;
exports[`build fs output > assets/content.ts-loader.hash0.js 1`] = `
"(function () {
'use strict';
const injectTime = performance.now();
(async () => {
const { onExecute } = await import(
/* @vite-ignore */
chrome.runtime.getURL(\\"assets/content.ts.hash1.js\\")
);
onExecute?.({ perf: { injectTime, loadTime: performance.now() - injectTime } });
})().catch(console.error);
})();
"
`;
exports[`build fs output > assets/index.hash3.css 1`] = `
":root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vanilla:hover {
filter: drop-shadow(0 0 2em #3178c6aa);
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}
"
`;
exports[`build fs output > assets/index.html.hash4.js 1`] = `
"(function polyfill() {
const relList = document.createElement(\\"link\\").relList;
if (relList && relList.supports && relList.supports(\\"modulepreload\\")) {
return;
}
for (const link of document.querySelectorAll('link[rel=\\"modulepreload\\"]')) {
processPreload(link);
}
new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type !== \\"childList\\") {
continue;
}
for (const node of mutation.addedNodes) {
if (node.tagName === \\"LINK\\" && node.rel === \\"modulepreload\\")
processPreload(node);
}
}
}).observe(document, { childList: true, subtree: true });
function getFetchOpts(script) {
const fetchOpts = {};
if (script.integrity)
fetchOpts.integrity = script.integrity;
if (script.referrerpolicy)
fetchOpts.referrerPolicy = script.referrerpolicy;
if (script.crossorigin === \\"use-credentials\\")
fetchOpts.credentials = \\"include\\";
else if (script.crossorigin === \\"anonymous\\")
fetchOpts.credentials = \\"omit\\";
else
fetchOpts.credentials = \\"same-origin\\";
return fetchOpts;
}
function processPreload(link) {
if (link.ep)
return;
link.ep = true;
const fetchOpts = getFetchOpts(link);
fetch(link.href, fetchOpts);
}
})();
const style = \\"\\";
const typescriptLogo = \\"/assets/typescript.hash5.svg\\";
const viteLogo = \\"/vite.svg\\";
function setupCounter(element) {
let counter = 0;
const setCounter = (count) => {
counter = count;
element.innerHTML = \`count is \${counter}\`;
};
element.addEventListener(\\"click\\", () => setCounter(counter + 1));
setCounter(0);
}
document.querySelector(\\"#app\\").innerHTML = \`
<div>
<a href=\\"https://vitejs.dev\\" target=\\"_blank\\">
<img src=\\"\${viteLogo}\\" class=\\"logo\\" alt=\\"Vite logo\\" />
</a>
<a href=\\"https://www.typescriptlang.org/\\" target=\\"_blank\\">
<img src=\\"\${typescriptLogo}\\" class=\\"logo vanilla\\" alt=\\"TypeScript logo\\" />
</a>
<h1>Vite + TypeScript</h1>
<div class=\\"card\\">
<button id=\\"counter\\" type=\\"button\\"></button>
</div>
<p class=\\"read-the-docs\\">
Click on the Vite and TypeScript logos to learn more
</p>
</div>
\`;
setupCounter(document.querySelector(\\"#counter\\"));
// # sourceMappingURL=data:application/json;charset=utf-8;base64,<base64>
"
`;
exports[`build fs output > assets/module.hash2.js 1`] = `
"import { s as sharedUtil } from \\"./content.ts.hash1.js\\";
sharedUtil();
// # sourceMappingURL=data:application/json;charset=utf-8;base64,<base64>
"
`;
exports[`build fs output > index.html 1`] = `
"<!DOCTYPE html>
<html lang=\\"en\\">
<head>
<meta charset=\\"UTF-8\\" />
<link rel=\\"icon\\" type=\\"image/svg+xml\\" href=\\"/vite.svg\\" />
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
<title>Vite + TS</title>
<script type=\\"module\\" crossorigin src=\\"/assets/index.html.hash4.js\\"></script>
<link rel=\\"stylesheet\\" href=\\"/assets/index.hash3.css\\">
</head>
<body>
<div id=\\"app\\"></div>
</body>
</html>
"
`;