diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
| commit | afa87af01c79a9baa539f2992d32154d2a4739bd (patch) | |
| tree | 92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/@vitest/mocker/dist/browser.js | |
| parent | 3b927e84d200402281f68181cd4253bc77e5528d (diff) | |
| download | neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2 neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip | |
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/@vitest/mocker/dist/browser.js')
| -rw-r--r-- | vanilla/node_modules/@vitest/mocker/dist/browser.js | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/vanilla/node_modules/@vitest/mocker/dist/browser.js b/vanilla/node_modules/@vitest/mocker/dist/browser.js deleted file mode 100644 index 3e83247..0000000 --- a/vanilla/node_modules/@vitest/mocker/dist/browser.js +++ /dev/null @@ -1,91 +0,0 @@ -export { M as ModuleMocker, c as createCompilerHints } from './chunk-mocker.js'; -import { M as MockerRegistry } from './chunk-registry.js'; -import { c as createManualModuleSource, a as cleanUrl } from './chunk-utils.js'; -export { M as ModuleMockerServerInterceptor } from './chunk-interceptor-native.js'; -import './index.js'; -import './chunk-pathe.M-eThtNZ.js'; - -class ModuleMockerMSWInterceptor { - mocks = new MockerRegistry(); - startPromise; - worker; - constructor(options = {}) { - this.options = options; - if (!options.globalThisAccessor) { - options.globalThisAccessor = "\"__vitest_mocker__\""; - } - } - async register(module) { - await this.init(); - this.mocks.add(module); - } - async delete(url) { - await this.init(); - this.mocks.delete(url); - } - async invalidate() { - this.mocks.clear(); - } - async resolveManualMock(mock) { - const exports$1 = Object.keys(await mock.resolve()); - const text = createManualModuleSource(mock.url, exports$1, this.options.globalThisAccessor); - return new Response(text, { headers: { "Content-Type": "application/javascript" } }); - } - async init() { - if (this.worker) { - return this.worker; - } - if (this.startPromise) { - return this.startPromise; - } - const worker = this.options.mswWorker; - this.startPromise = Promise.all([worker ? { setupWorker(handler) { - worker.use(handler); - return worker; - } } : import('msw/browser'), import('msw/core/http')]).then(([{ setupWorker }, { http }]) => { - const worker = setupWorker(http.get(/.+/, async ({ request }) => { - const path = cleanQuery(request.url.slice(location.origin.length)); - if (!this.mocks.has(path)) { - return passthrough(); - } - const mock = this.mocks.get(path); - switch (mock.type) { - case "manual": return this.resolveManualMock(mock); - case "automock": - case "autospy": return Response.redirect(injectQuery(path, `mock=${mock.type}`)); - case "redirect": return Response.redirect(mock.redirect); - default: throw new Error(`Unknown mock type: ${mock.type}`); - } - })); - return worker.start(this.options.mswOptions).then(() => worker); - }).finally(() => { - this.worker = worker; - this.startPromise = undefined; - }); - return await this.startPromise; - } -} -const trailingSeparatorRE = /[?&]$/; -const timestampRE = /\bt=\d{13}&?\b/; -const versionRE = /\bv=\w{8}&?\b/; -function cleanQuery(url) { - return url.replace(timestampRE, "").replace(versionRE, "").replace(trailingSeparatorRE, ""); -} -function passthrough() { - return new Response(null, { - status: 302, - statusText: "Passthrough", - headers: { "x-msw-intention": "passthrough" } - }); -} -const replacePercentageRE = /%/g; -function injectQuery(url, queryToInject) { - // encode percents for consistent behavior with pathToFileURL - // see #2614 for details - const resolvedUrl = new URL(url.replace(replacePercentageRE, "%25"), location.href); - const { search, hash } = resolvedUrl; - const pathname = cleanUrl(url); - return `${pathname}?${queryToInject}${search ? `&${search.slice(1)}` : ""}${hash ?? ""}`; -} - -export { ModuleMockerMSWInterceptor }; |
