0.1.0-alpha.10 • Published 10 months ago

xiaoxitian v0.1.0-alpha.10

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Xiaoxitian

Xiaoxitian is a project that uses Xiaoxitian as the main library.

Installation

npm install xiaoxitian

Usage

import { xiaoxitian } from "./mod.ts";

await xiaoxitian({
  name: "test",
  launchOptions: {
    headless: false,
    devtools: true,
  },
  plugins: [
    async ({ addInitScript, mapLocal, mock, modifyJs, modifyJson, open }) => {
      await addInitScript("console.log('Hello, World!');");

      mapLocal("https://example.com/test", "./mod.ts");

      mock("https://example.com/test.js", {
        status: 200,
        contentType: "application/javascript",
        body: "console.log('Hello, World!');",
      });

      mock("https://example.com/test.json", {
        status: 200,
        contentType: "application/json",
        body: '{ "hello": "world" }',
      });

      modifyJs("https://example.com/test.js", (content) => {
        return content.replace(
          "console.log('Hello, World!');",
          "console.log('Hello, World! Modified');"
        );
      });

      modifyJson("https://example.com/test.json", (json) => {
        json.hello = "world modified";
        return json;
      });

      await open("https://example.com/test.json");
    },
  ],
});
0.1.0-alpha.10

10 months ago

0.1.0-alpha.9

10 months ago

0.1.0-alpha.8

10 months ago

0.1.0-alpha.7

10 months ago

0.1.0-alpha.5

10 months ago

0.1.0-alpha.4

10 months ago

0.1.0-alpha.2

10 months ago

0.1.0-alpha.1

10 months ago