rearrage_stuff

This commit is contained in:
Kim Ravn Hansen
2025-09-16 11:26:40 +02:00
parent 40e8c5e0ab
commit 3f11ebe6dc
4937 changed files with 1146031 additions and 134 deletions

21
node_modules/vite-plugin-devtools-json/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Google, LLC.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

96
node_modules/vite-plugin-devtools-json/README.md generated vendored Normal file
View File

@@ -0,0 +1,96 @@
# Vite Plugin for DevTools Project Settings (devtools.json)
Vite plugin for generating the Chrome DevTools project settings file on-the-fly
in the devserver.
This enables seamless integration with the new Chrome DevTools features
1. [DevTools Project Settings (devtools.json)](https://goo.gle/devtools-json-design), and
1. [Automatic Workspace folders](http://goo.gle/devtools-automatic-workspace-folders).
## Installation
```bash
npm install -D vite-plugin-devtools-json
```
## Usage
Add it to your Vite config
```js
import {defineConfig} from 'vite';
import devtoolsJson from 'vite-plugin-devtools-json';
export default defineConfig({
plugins: [
devtoolsJson(),
// ...
]
});
```
While the plugin can generate a UUID and save it in vite cache, you can also
specify it in the options like in the following:
```
plugins: [
devtoolsJson({ uuid: "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b" }),
// ...
]
```
### Options
| Name | Type | Default | Description |
|------|------|---------|-------------|
| `projectRoot` | `string` | `config.root` | Absolute path that will be reported to DevTools. Useful for monorepos or when the Vite root is not the desired folder. |
| `normalizeForWindowsContainer` | `boolean` | `true` | Convert Linux paths to UNC form so Chrome on Windows (WSL / Docker Desktop) can mount them (e.g. via WSL or Docker Desktop). Pass `false` to disable. <br/>_Alias:_ `normalizeForChrome` (deprecated)_ |
| `uuid` | `string` | auto-generated | Fixed UUID if you prefer to control it yourself. |
Example with all options:
```js
import { defineConfig } from 'vite';
import devtoolsJson from 'vite-plugin-devtools-json';
export default defineConfig({
plugins: [
devtoolsJson({
projectRoot: '/absolute/path/to/project',
normalizeForWindowsContainer: true,
uuid: '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
})
]
});
```
The `/.well-known/appspecific/com.chrome.devtools.json` endpoint will serve the
project settings as JSON with the following structure
```json
{
"workspace": {
"root": "/path/to/project/root",
"uuid": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"
}
}
```
where `root` is the absolute path to your `{projectRoot}` folder, and `uuid` is
a random v4 UUID, generated the first time that you start the Vite devserver
with the plugin installed (it is henceforth cached in the Vite cache folder).
Checkout [bmeurer/automatic-workspace-folders-vanilla] for a trivial example
project illustrating how to use the plugin in practice.
## Publishing
**Googlers:** We use [go/wombat-dressing-room](http://go/wombat-dressing-room)
for publishing.
## License
The code is under [MIT License](LICENSE).
[bmeurer/automatic-workspace-folders-vanilla]: https://github.com/bmeurer/automatic-workspace-folders-vanilla

95
node_modules/vite-plugin-devtools-json/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,95 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var fs = require('fs');
var path = require('path');
var uuid = require('uuid');
const ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json";
const plugin = (options = {}) => ({
name: "devtools-json",
enforce: "post",
configureServer(server) {
const { config } = server;
const { logger } = config;
if (!config.env.DEV) {
return;
}
const getOrCreateUUID = () => {
if (options.uuid) {
return options.uuid;
}
let { cacheDir } = config;
if (!path.isAbsolute(cacheDir)) {
let { root } = config;
if (!path.isAbsolute(root)) {
root = path.resolve(process.cwd(), root);
}
cacheDir = path.resolve(root, cacheDir);
}
const uuidPath = path.resolve(cacheDir, "uuid.json");
if (fs.existsSync(uuidPath)) {
const uuid2 = fs.readFileSync(uuidPath, { encoding: "utf-8" });
if (uuid.validate(uuid2)) {
return uuid2;
}
}
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir, { recursive: true });
}
const uuid$1 = uuid.v4();
fs.writeFileSync(uuidPath, uuid$1, { encoding: "utf-8" });
return uuid$1;
};
const normalizePaths = options.normalizeForWindowsContainer ?? (options.normalizeForChrome ?? true);
if (Object.prototype.hasOwnProperty.call(options, "normalizeForChrome") && options.normalizeForWindowsContainer === void 0) {
logger.warn(
'[vite-plugin-devtools-json] "normalizeForChrome" is deprecated \u2013 please rename to "normalizeForWindowsContainer".'
);
}
server.middlewares.use(ENDPOINT, async (_req, res) => {
const resolveProjectRoot = () => {
if (options.projectRoot) {
return path.resolve(options.projectRoot);
}
let { root: root2 } = config;
if (!path.isAbsolute(root2)) {
root2 = path.resolve(process.cwd(), root2);
}
return root2;
};
const maybeNormalizePath = (absRoot) => {
if (!normalizePaths) return absRoot;
if (process.env.WSL_DISTRO_NAME) {
const distro = process.env.WSL_DISTRO_NAME;
const withoutLeadingSlash = absRoot.replace(/^\//, "");
return path.join("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
}
if (process.env.DOCKER_DESKTOP && !absRoot.startsWith("\\\\")) {
const withoutLeadingSlash = absRoot.replace(/^\//, "");
return path.join("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
}
return absRoot;
};
let root = maybeNormalizePath(resolveProjectRoot());
const uuid = getOrCreateUUID();
const devtoolsJson = {
workspace: {
root,
uuid
}
};
res.setHeader("Content-Type", "application/json");
res.end(JSON.stringify(devtoolsJson, null, 2));
});
},
configurePreviewServer(server) {
server.middlewares.use(ENDPOINT, async (req, res) => {
res.writeHead(404);
res.end();
});
}
});
exports.default = plugin;

26
node_modules/vite-plugin-devtools-json/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { Plugin } from 'vite';
interface DevToolsJsonOptions {
/**
* Optional fixed UUID. If omitted the plugin will generate
* (and cache) one automatically, which is the previous default behaviour.
*/
uuid?: string;
/**
* Absolute (or relative) path that should be reported as the project root
* in DevTools. When omitted, we fall back to Vites `config.root` logic.
*/
projectRoot?: string;
/**
* @deprecated Use `normalizeForWindowsContainer` instead. Will be removed in a future major version.
*/
normalizeForChrome?: boolean;
/**
* Whether to rewrite Linux paths to UNC form so Chrome running on Windows
* (WSL or Docker Desktop) can mount them as a workspace. Enabled by default.
*/
normalizeForWindowsContainer?: boolean;
}
declare const plugin: (options?: DevToolsJsonOptions) => Plugin;
export { plugin as default };

91
node_modules/vite-plugin-devtools-json/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,91 @@
import fs from 'fs';
import path from 'path';
import { validate, v4 } from 'uuid';
const ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json";
const plugin = (options = {}) => ({
name: "devtools-json",
enforce: "post",
configureServer(server) {
const { config } = server;
const { logger } = config;
if (!config.env.DEV) {
return;
}
const getOrCreateUUID = () => {
if (options.uuid) {
return options.uuid;
}
let { cacheDir } = config;
if (!path.isAbsolute(cacheDir)) {
let { root } = config;
if (!path.isAbsolute(root)) {
root = path.resolve(process.cwd(), root);
}
cacheDir = path.resolve(root, cacheDir);
}
const uuidPath = path.resolve(cacheDir, "uuid.json");
if (fs.existsSync(uuidPath)) {
const uuid2 = fs.readFileSync(uuidPath, { encoding: "utf-8" });
if (validate(uuid2)) {
return uuid2;
}
}
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir, { recursive: true });
}
const uuid = v4();
fs.writeFileSync(uuidPath, uuid, { encoding: "utf-8" });
return uuid;
};
const normalizePaths = options.normalizeForWindowsContainer ?? (options.normalizeForChrome ?? true);
if (Object.prototype.hasOwnProperty.call(options, "normalizeForChrome") && options.normalizeForWindowsContainer === void 0) {
logger.warn(
'[vite-plugin-devtools-json] "normalizeForChrome" is deprecated \u2013 please rename to "normalizeForWindowsContainer".'
);
}
server.middlewares.use(ENDPOINT, async (_req, res) => {
const resolveProjectRoot = () => {
if (options.projectRoot) {
return path.resolve(options.projectRoot);
}
let { root: root2 } = config;
if (!path.isAbsolute(root2)) {
root2 = path.resolve(process.cwd(), root2);
}
return root2;
};
const maybeNormalizePath = (absRoot) => {
if (!normalizePaths) return absRoot;
if (process.env.WSL_DISTRO_NAME) {
const distro = process.env.WSL_DISTRO_NAME;
const withoutLeadingSlash = absRoot.replace(/^\//, "");
return path.join("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
}
if (process.env.DOCKER_DESKTOP && !absRoot.startsWith("\\\\")) {
const withoutLeadingSlash = absRoot.replace(/^\//, "");
return path.join("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
}
return absRoot;
};
let root = maybeNormalizePath(resolveProjectRoot());
const uuid = getOrCreateUUID();
const devtoolsJson = {
workspace: {
root,
uuid
}
};
res.setHeader("Content-Type", "application/json");
res.end(JSON.stringify(devtoolsJson, null, 2));
});
},
configurePreviewServer(server) {
server.middlewares.use(ENDPOINT, async (req, res) => {
res.writeHead(404);
res.end();
});
}
});
export { plugin as default };

67
node_modules/vite-plugin-devtools-json/package.json generated vendored Normal file
View File

@@ -0,0 +1,67 @@
{
"name": "vite-plugin-devtools-json",
"version": "1.0.0",
"description": "Vite plugin for generating `com.chrome.devtools.json` on the fly in the devserver.",
"type": "module",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./*": "./dist/*"
},
"files": [
"/dist"
],
"scripts": {
"build": "rollup -c rollup.config.ts --configPlugin typescript",
"clean": "rm -rf dist",
"dev": "rollup -c rollup.config.ts --configPlugin typescript",
"prepare": "npm run clean && npm run build",
"test": "vitest --no-watch",
"test:watch": "vitest --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ChromeDevTools/vite-plugin-devtools-json.git"
},
"keywords": [
"vite",
"vite-plugin",
"chrome-devtools",
"devtools",
"chrome"
],
"author": "Benedikt Meurer <bmeurer@google.com>",
"bugs": {
"url": "https://github.com/ChromeDevTools/vite-plugin-devtools-json/issues"
},
"homepage": "https://github.com/ChromeDevTools/vite-plugin-devtools-json#readme",
"license": "MIT",
"peerDependencies": {
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
},
"dependencies": {
"uuid": "^11.1.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.2",
"@types/node": "^22.13.5",
"@types/supertest": "^6.0.2",
"rollup": "^4.34.8",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.2.1",
"supertest": "^7.0.0",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"vite": "^6.2.0",
"vitest": "^3.0.8"
},
"publishConfig": {
"registry": "https://wombat-dressing-room.appspot.com"
}
}