-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba561f9
commit 7e1ab56
Showing
45 changed files
with
1,408 additions
and
232 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { WindowWithMswDevtools } from '@msw-devtools/core' | ||
|
||
declare global { | ||
interface Window extends WindowWithMswDevtools {} | ||
} | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './resolver' | ||
export * from './constants' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/**/*.ts"] | ||
"include": ["./src/**/*", "./global.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@msw-devtools/core", | ||
"version": "0.1", | ||
"type": "module", | ||
"license": "MIT", | ||
"types": "./dist/index.d.ts", | ||
"source": "./src/index.ts", | ||
"main": "./dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "microbundle --no-pkg-main -f modern", | ||
"dev": "microbundle watch --no-pkg-main -f modern" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import type { JsonConfig } from '@msw-devtools/json-config' | ||
import type { ResponseResolver } from 'msw' | ||
|
||
export enum MessageType { | ||
Content = 'msw-devtools-extension-content', | ||
HandledRequest = 'msw-devtools-extension_handled', | ||
SetJsonConfig = 'msw-devtools-extension_setJsonConfig', | ||
UnhandledRequest = 'msw-devtools-extension_unhandled', | ||
Status = 'msw-devtools-extension_status', | ||
Injected = 'msw-devtools-extension-injected' | ||
} | ||
|
||
export type MswDevtoolsExtensionTransporter = { | ||
resolve: (...args: Parameters<ResponseResolver>) => Promise<any> | ||
} | ||
|
||
export interface WindowWithMswDevtools { | ||
__MSW_DEVTOOLS_EXTENSION?: MswDevtoolsExtensionTransporter | ||
} | ||
|
||
export type ChromeExtensionLocalStorage = { | ||
jsonConfig: JsonConfig | ||
} | ||
|
||
export type BackgroundReceiveMessage = | ||
| { | ||
type: MessageType.Content | ||
request: { | ||
url: string | ||
method: string | ||
} | ||
} | ||
| { | ||
type: MessageType.SetJsonConfig | ||
payload: JsonConfig | ||
} | ||
| { | ||
type: MessageType.Status | ||
} | ||
|
||
export type BackgroundResponseMessage = | ||
| { | ||
type: MessageType.HandledRequest | ||
response: JsonConfig[string] | ||
} | ||
| { | ||
type: MessageType.UnhandledRequest | ||
} | ||
| { | ||
type: MessageType.SetJsonConfig | ||
status: 'success' | ||
} | ||
| ({ | ||
type: MessageType.Status | ||
} & ( | ||
| { status: 'error' } | ||
| { | ||
status: 'success' | ||
payload: { | ||
host: string | ||
hasHandle: boolean | ||
hasConfig: boolean | ||
configIsValid: boolean | ||
} | ||
} | ||
)) | ||
|
||
export type { JsonConfig } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["./src/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.css' { | ||
const content: Record<string, string> | ||
export default content | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { WindowWithMswDevtools } from '@msw-devtools/core' | ||
|
||
declare global { | ||
interface Window extends WindowWithMswDevtools {} | ||
} | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Upload JSON</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
</style> | ||
<title>MSW devtools extension</title> | ||
</head> | ||
<body> | ||
<input type="file" id="fileInput" accept=".json" /> | ||
<button id="uploadButton">Upload</button> | ||
<p id="status"></p> | ||
<div id="root"></div> | ||
<script type="module" src="popup.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.