test
This commit is contained in:
parent
9fbd7ced9c
commit
d22f4d7578
2
frontend/.gitignore
vendored
2
frontend/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
@ -5,7 +5,6 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
|
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
|
||||||
<title>Solid App</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "generateur",
|
"name": "vite-template-solid",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -10,14 +10,24 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^10.4.12",
|
"sass": "^1.54.3",
|
||||||
"postcss": "^8.4.18",
|
"typescript": "^4.7.4",
|
||||||
"tailwindcss": "^3.1.8",
|
"vite": "^3.0.0",
|
||||||
"typescript": "^4.8.2",
|
|
||||||
"vite": "^3.0.9",
|
|
||||||
"vite-plugin-solid": "^2.3.0"
|
"vite-plugin-solid": "^2.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"solid-js": "^1.5.1"
|
"@solidjs/meta": "^0.28.0",
|
||||||
|
"@solidjs/router": "^0.4.2",
|
||||||
|
"axios": "^0.27.2",
|
||||||
|
"chroma-js": "^2.4.2",
|
||||||
|
"emotion-solid": "^1.1.1",
|
||||||
|
"jwt-decode": "^3.1.2",
|
||||||
|
"solid-forms": "^0.4.5",
|
||||||
|
"solid-icons": "^1.0.1",
|
||||||
|
"solid-js": "^1.4.7",
|
||||||
|
"solid-styled-components": "^0.28.4",
|
||||||
|
"solid-styled-jsx": "^0.27.1",
|
||||||
|
"solid-toast": "^0.3.4",
|
||||||
|
"styled-jsx": "^3.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
827
frontend/pnpm-lock.yaml
generated
827
frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,27 +1,65 @@
|
|||||||
import type { Component } from 'solid-js';
|
import { Component, createEffect, createSignal } from "solid-js";
|
||||||
|
|
||||||
import logo from './logo.svg';
|
|
||||||
import styles from './App.module.css';
|
|
||||||
|
|
||||||
|
import logo from "./logo.svg";
|
||||||
|
import styles from "./App.module.css";
|
||||||
|
import { MetaProvider } from "@solidjs/meta";
|
||||||
|
import Layout from "./components/Layout";
|
||||||
|
import { Route, Routes } from "@solidjs/router";
|
||||||
|
import Test from "./components/test";
|
||||||
|
import Home from "./components/Home";
|
||||||
|
import Routing from "./components/Routing";
|
||||||
|
import { AuthProvider } from "./context/auth.context.jsx";
|
||||||
|
import { LoginPopUpProvider } from "./context/loginPopUp.context.jsx";
|
||||||
|
import LoginPopup from "./components/LoginPopup";
|
||||||
|
import { Toaster } from "solid-toast";
|
||||||
|
import { NotificationProvider } from "./context/notification.context.jsx";
|
||||||
|
import { NavigateProvider } from "./context/navigate.context.jsx";
|
||||||
const App: Component = () => {
|
const App: Component = () => {
|
||||||
|
const [count, setCount] = createSignal(0);
|
||||||
|
createEffect(() => {
|
||||||
|
setInterval(() => setCount((c) => c + 1), 1000);
|
||||||
|
});
|
||||||
|
const [popup, setPopup] = createSignal({ active: false, next: () => {} });
|
||||||
return (
|
return (
|
||||||
<div class={styles.App}>
|
<MetaProvider>
|
||||||
<header class={styles.header}>
|
<NotificationProvider>
|
||||||
<img src={logo} class={styles.logo} alt="logo" />
|
<NavigateProvider>
|
||||||
<p>
|
<LoginPopUpProvider
|
||||||
Edit <code>src/App.tsx</code> and save to reload.
|
popup={(next: () => void) => {
|
||||||
</p>
|
setPopup({ active: true, next: next });
|
||||||
<a
|
}}
|
||||||
class={styles.link}
|
active={popup().active}
|
||||||
href="https://github.com/solidjs/solid"
|
next={() => {
|
||||||
target="_blank"
|
popup().next();
|
||||||
rel="noopener noreferrer"
|
setPopup({ active: false, next: () => {} });
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Learn Solid
|
<AuthProvider>
|
||||||
</a>
|
<Routing />
|
||||||
</header>
|
|
||||||
</div>
|
<LoginPopup
|
||||||
|
active={popup().active}
|
||||||
|
close={() => {
|
||||||
|
setPopup({ active: false, next: () => {} });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Toaster />
|
||||||
|
</AuthProvider>
|
||||||
|
</LoginPopUpProvider>{" "}
|
||||||
|
</NavigateProvider>
|
||||||
|
</NotificationProvider>
|
||||||
|
</MetaProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type countModel = {
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Counter: Component<countModel> = (props: countModel) => {
|
||||||
|
var c = props.count;
|
||||||
|
return <p>{props.count}</p>;
|
||||||
|
};
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
@ -1,7 +1,72 @@
|
|||||||
/* @refresh reload */
|
/* @refresh reload */
|
||||||
import { render } from 'solid-js/web';
|
import { render } from "solid-js/web";
|
||||||
|
|
||||||
import './index.css';
|
import "./index.css";
|
||||||
import App from './App';
|
import "./styles/index.scss";
|
||||||
|
import App from "./App";
|
||||||
|
import { Router } from "@solidjs/router";
|
||||||
|
import { exoInstance } from "./apis/exoInstance.instance.js";
|
||||||
|
import { refresh_request } from "./requests/auth.requests.js";
|
||||||
|
import jwtDecode from "jwt-decode";
|
||||||
|
const jwt_expire_check = (token) => {
|
||||||
|
var { exp } = jwtDecode<any>(token);
|
||||||
|
return Date.now() >= exp * 1000;
|
||||||
|
}; /*
|
||||||
|
exoInstance.interceptors.request.use(
|
||||||
|
(config) => {
|
||||||
|
|
||||||
render(() => <App />, document.getElementById('root') as HTMLElement);
|
if ("Authorization" in config.headers) {
|
||||||
|
var token = localStorage.getItem("token");
|
||||||
|
var refresh = localStorage.getItem("refresh_token");
|
||||||
|
var originalRequest = config;
|
||||||
|
if (token != null && refresh != null) {
|
||||||
|
if (jwt_expire_check(token)) {
|
||||||
|
refresh_request(refresh).then((r) => {
|
||||||
|
localStorage.setItem("token", r.access_token);
|
||||||
|
|
||||||
|
originalRequest.headers.Authorization = "Bearer " + r.access_token;
|
||||||
|
return Promise.resolve(originalRequest);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
); */
|
||||||
|
exoInstance.interceptors.response.use(
|
||||||
|
(response) => response,
|
||||||
|
(error) => {
|
||||||
|
console.log(error, "errrrrrrrrrrrrrrr")
|
||||||
|
const status = error.response ? error.response.status : null;
|
||||||
|
console.log(status)
|
||||||
|
if (error.response.data.detail === "Signature has expired") {
|
||||||
|
var token = localStorage.getItem("token");
|
||||||
|
var refresh = localStorage.getItem("refresh_token");
|
||||||
|
console.log("testtetetet", token, refresh );
|
||||||
|
if (token != null && refresh != null) {
|
||||||
|
console.log('tets')
|
||||||
|
refresh_request(refresh).then((r) => {
|
||||||
|
error.config.headers["Authorization"] = "Bearer " + r.access_token;
|
||||||
|
localStorage.setItem('token', r.access_token)
|
||||||
|
error.config.baseURL = undefined;
|
||||||
|
|
||||||
|
return exoInstance.request(error.config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
render(
|
||||||
|
() => (
|
||||||
|
<Router>
|
||||||
|
<App />
|
||||||
|
</Router>
|
||||||
|
),
|
||||||
|
document.getElementById("root") as HTMLElement
|
||||||
|
);
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
content: [],
|
|
||||||
theme: {
|
|
||||||
extend: {},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
}
|
|
@ -10,6 +10,8 @@
|
|||||||
"jsxImportSource": "solid-js",
|
"jsxImportSource": "solid-js",
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"isolatedModules": true
|
"isolatedModules": true,
|
||||||
|
"plugins": [{ "name": "typescript-plugin-css-modules" }],
|
||||||
|
"noImplicitAny": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
## Usage
|
|
||||||
|
|
||||||
Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`.
|
|
||||||
|
|
||||||
This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely be removed once you clone a template.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm install # or pnpm install or yarn install
|
|
||||||
```
|
|
||||||
|
|
||||||
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs)
|
|
||||||
|
|
||||||
## Available Scripts
|
|
||||||
|
|
||||||
In the project directory, you can run:
|
|
||||||
|
|
||||||
### `npm dev` or `npm start`
|
|
||||||
|
|
||||||
Runs the app in the development mode.<br>
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
||||||
|
|
||||||
The page will reload if you make edits.<br>
|
|
||||||
|
|
||||||
### `npm run build`
|
|
||||||
|
|
||||||
Builds the app for production to the `dist` folder.<br>
|
|
||||||
It correctly bundles Solid in production mode and optimizes the build for the best performance.
|
|
||||||
|
|
||||||
The build is minified and the filenames include the hashes.<br>
|
|
||||||
Your app is ready to be deployed!
|
|
||||||
|
|
||||||
## Deployment
|
|
||||||
|
|
||||||
You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.)
|
|
@ -1,15 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
|
|
||||||
<script src="/src/index.tsx" type="module"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
17
frontend_old/node_modules/.bin/sass
generated
vendored
17
frontend_old/node_modules/.bin/sass
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$NODE_PATH" ]; then
|
|
||||||
export NODE_PATH="/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
else
|
|
||||||
export NODE_PATH="$NODE_PATH:/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
fi
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../sass/sass.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../sass/sass.js" "$@"
|
|
||||||
fi
|
|
17
frontend_old/node_modules/.bin/tsc
generated
vendored
17
frontend_old/node_modules/.bin/tsc
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$NODE_PATH" ]; then
|
|
||||||
export NODE_PATH="/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
else
|
|
||||||
export NODE_PATH="$NODE_PATH:/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
fi
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
||||||
fi
|
|
17
frontend_old/node_modules/.bin/tsserver
generated
vendored
17
frontend_old/node_modules/.bin/tsserver
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$NODE_PATH" ]; then
|
|
||||||
export NODE_PATH="/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
else
|
|
||||||
export NODE_PATH="$NODE_PATH:/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
fi
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
||||||
fi
|
|
17
frontend_old/node_modules/.bin/vite
generated
vendored
17
frontend_old/node_modules/.bin/vite
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$NODE_PATH" ]; then
|
|
||||||
export NODE_PATH="/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
else
|
|
||||||
export NODE_PATH="$NODE_PATH:/home/lilian/Dev/project/fastapi_gen/frontend/node_modules/.pnpm/node_modules"
|
|
||||||
fi
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
|
||||||
else
|
|
||||||
exec node "$basedir/../vite/bin/vite.js" "$@"
|
|
||||||
fi
|
|
333
frontend_old/node_modules/.modules.yaml
generated
vendored
333
frontend_old/node_modules/.modules.yaml
generated
vendored
@ -1,333 +0,0 @@
|
|||||||
hoistPattern:
|
|
||||||
- '*'
|
|
||||||
hoistedDependencies:
|
|
||||||
/@ampproject/remapping/2.2.0:
|
|
||||||
'@ampproject/remapping': private
|
|
||||||
/@babel/code-frame/7.18.6:
|
|
||||||
'@babel/code-frame': private
|
|
||||||
/@babel/compat-data/7.18.8:
|
|
||||||
'@babel/compat-data': private
|
|
||||||
/@babel/core/7.18.6:
|
|
||||||
'@babel/core': private
|
|
||||||
/@babel/generator/7.18.7:
|
|
||||||
'@babel/generator': private
|
|
||||||
/@babel/helper-annotate-as-pure/7.18.6:
|
|
||||||
'@babel/helper-annotate-as-pure': private
|
|
||||||
/@babel/helper-compilation-targets/7.18.6_@babel+core@7.18.6:
|
|
||||||
'@babel/helper-compilation-targets': private
|
|
||||||
/@babel/helper-create-class-features-plugin/7.18.6_@babel+core@7.18.6:
|
|
||||||
'@babel/helper-create-class-features-plugin': private
|
|
||||||
/@babel/helper-environment-visitor/7.18.6:
|
|
||||||
'@babel/helper-environment-visitor': private
|
|
||||||
/@babel/helper-function-name/7.18.6:
|
|
||||||
'@babel/helper-function-name': private
|
|
||||||
/@babel/helper-hoist-variables/7.18.6:
|
|
||||||
'@babel/helper-hoist-variables': private
|
|
||||||
/@babel/helper-member-expression-to-functions/7.18.6:
|
|
||||||
'@babel/helper-member-expression-to-functions': private
|
|
||||||
/@babel/helper-module-imports/7.18.6:
|
|
||||||
'@babel/helper-module-imports': private
|
|
||||||
/@babel/helper-module-transforms/7.18.8:
|
|
||||||
'@babel/helper-module-transforms': private
|
|
||||||
/@babel/helper-optimise-call-expression/7.18.6:
|
|
||||||
'@babel/helper-optimise-call-expression': private
|
|
||||||
/@babel/helper-plugin-utils/7.18.6:
|
|
||||||
'@babel/helper-plugin-utils': private
|
|
||||||
/@babel/helper-replace-supers/7.18.6:
|
|
||||||
'@babel/helper-replace-supers': private
|
|
||||||
/@babel/helper-simple-access/7.18.6:
|
|
||||||
'@babel/helper-simple-access': private
|
|
||||||
/@babel/helper-split-export-declaration/7.18.6:
|
|
||||||
'@babel/helper-split-export-declaration': private
|
|
||||||
/@babel/helper-validator-identifier/7.18.6:
|
|
||||||
'@babel/helper-validator-identifier': private
|
|
||||||
/@babel/helper-validator-option/7.18.6:
|
|
||||||
'@babel/helper-validator-option': private
|
|
||||||
/@babel/helpers/7.18.6:
|
|
||||||
'@babel/helpers': private
|
|
||||||
/@babel/highlight/7.18.6:
|
|
||||||
'@babel/highlight': private
|
|
||||||
/@babel/parser/7.18.8:
|
|
||||||
'@babel/parser': private
|
|
||||||
/@babel/plugin-syntax-jsx/7.18.6_@babel+core@7.18.6:
|
|
||||||
'@babel/plugin-syntax-jsx': private
|
|
||||||
/@babel/plugin-syntax-typescript/7.18.6_@babel+core@7.18.6:
|
|
||||||
'@babel/plugin-syntax-typescript': private
|
|
||||||
/@babel/plugin-transform-typescript/7.18.8_@babel+core@7.18.6:
|
|
||||||
'@babel/plugin-transform-typescript': private
|
|
||||||
/@babel/preset-typescript/7.18.6_@babel+core@7.18.6:
|
|
||||||
'@babel/preset-typescript': private
|
|
||||||
/@babel/template/7.18.6:
|
|
||||||
'@babel/template': private
|
|
||||||
/@babel/traverse/7.18.8:
|
|
||||||
'@babel/traverse': private
|
|
||||||
/@babel/types/7.8.3:
|
|
||||||
'@babel/types': private
|
|
||||||
/@emotion/cache/11.10.3:
|
|
||||||
'@emotion/cache': private
|
|
||||||
/@emotion/hash/0.9.0:
|
|
||||||
'@emotion/hash': private
|
|
||||||
/@emotion/is-prop-valid/1.2.0:
|
|
||||||
'@emotion/is-prop-valid': private
|
|
||||||
/@emotion/memoize/0.8.0:
|
|
||||||
'@emotion/memoize': private
|
|
||||||
/@emotion/serialize/1.1.0:
|
|
||||||
'@emotion/serialize': private
|
|
||||||
/@emotion/sheet/1.2.0:
|
|
||||||
'@emotion/sheet': private
|
|
||||||
/@emotion/unitless/0.8.0:
|
|
||||||
'@emotion/unitless': private
|
|
||||||
/@emotion/utils/1.2.0:
|
|
||||||
'@emotion/utils': private
|
|
||||||
/@emotion/weak-memoize/0.3.0:
|
|
||||||
'@emotion/weak-memoize': private
|
|
||||||
/@jridgewell/gen-mapping/0.1.1:
|
|
||||||
'@jridgewell/gen-mapping': private
|
|
||||||
/@jridgewell/resolve-uri/3.1.0:
|
|
||||||
'@jridgewell/resolve-uri': private
|
|
||||||
/@jridgewell/set-array/1.1.2:
|
|
||||||
'@jridgewell/set-array': private
|
|
||||||
/@jridgewell/sourcemap-codec/1.4.14:
|
|
||||||
'@jridgewell/sourcemap-codec': private
|
|
||||||
/@jridgewell/trace-mapping/0.3.14:
|
|
||||||
'@jridgewell/trace-mapping': private
|
|
||||||
/ansi-styles/3.2.1:
|
|
||||||
ansi-styles: private
|
|
||||||
/anymatch/3.1.2:
|
|
||||||
anymatch: private
|
|
||||||
/asynckit/0.4.0:
|
|
||||||
asynckit: private
|
|
||||||
/babel-plugin-jsx-dom-expressions/0.33.12_@babel+core@7.18.6:
|
|
||||||
babel-plugin-jsx-dom-expressions: private
|
|
||||||
/babel-plugin-syntax-jsx/6.18.0:
|
|
||||||
babel-plugin-syntax-jsx: private
|
|
||||||
/babel-plugin-transform-rename-import/2.3.0:
|
|
||||||
babel-plugin-transform-rename-import: private
|
|
||||||
/babel-preset-solid/1.4.6_@babel+core@7.18.6:
|
|
||||||
babel-preset-solid: private
|
|
||||||
/big.js/5.2.2:
|
|
||||||
big.js: private
|
|
||||||
/binary-extensions/2.2.0:
|
|
||||||
binary-extensions: private
|
|
||||||
/braces/3.0.2:
|
|
||||||
braces: private
|
|
||||||
/browserslist/4.21.2:
|
|
||||||
browserslist: private
|
|
||||||
/caniuse-lite/1.0.30001366:
|
|
||||||
caniuse-lite: private
|
|
||||||
/chalk/2.4.2:
|
|
||||||
chalk: private
|
|
||||||
/chokidar/3.5.3:
|
|
||||||
chokidar: private
|
|
||||||
/color-convert/1.9.3:
|
|
||||||
color-convert: private
|
|
||||||
/color-name/1.1.3:
|
|
||||||
color-name: private
|
|
||||||
/combined-stream/1.0.8:
|
|
||||||
combined-stream: private
|
|
||||||
/convert-source-map/1.7.0:
|
|
||||||
convert-source-map: private
|
|
||||||
/csstype/3.1.0:
|
|
||||||
csstype: private
|
|
||||||
/debug/4.3.4:
|
|
||||||
debug: private
|
|
||||||
/delayed-stream/1.0.0:
|
|
||||||
delayed-stream: private
|
|
||||||
/electron-to-chromium/1.4.189:
|
|
||||||
electron-to-chromium: private
|
|
||||||
/emojis-list/2.1.0:
|
|
||||||
emojis-list: private
|
|
||||||
/esbuild-android-64/0.14.49:
|
|
||||||
esbuild-android-64: private
|
|
||||||
/esbuild-android-arm64/0.14.49:
|
|
||||||
esbuild-android-arm64: private
|
|
||||||
/esbuild-darwin-64/0.14.49:
|
|
||||||
esbuild-darwin-64: private
|
|
||||||
/esbuild-darwin-arm64/0.14.49:
|
|
||||||
esbuild-darwin-arm64: private
|
|
||||||
/esbuild-freebsd-64/0.14.49:
|
|
||||||
esbuild-freebsd-64: private
|
|
||||||
/esbuild-freebsd-arm64/0.14.49:
|
|
||||||
esbuild-freebsd-arm64: private
|
|
||||||
/esbuild-linux-32/0.14.49:
|
|
||||||
esbuild-linux-32: private
|
|
||||||
/esbuild-linux-64/0.14.49:
|
|
||||||
esbuild-linux-64: private
|
|
||||||
/esbuild-linux-arm/0.14.49:
|
|
||||||
esbuild-linux-arm: private
|
|
||||||
/esbuild-linux-arm64/0.14.49:
|
|
||||||
esbuild-linux-arm64: private
|
|
||||||
/esbuild-linux-mips64le/0.14.49:
|
|
||||||
esbuild-linux-mips64le: private
|
|
||||||
/esbuild-linux-ppc64le/0.14.49:
|
|
||||||
esbuild-linux-ppc64le: private
|
|
||||||
/esbuild-linux-riscv64/0.14.49:
|
|
||||||
esbuild-linux-riscv64: private
|
|
||||||
/esbuild-linux-s390x/0.14.49:
|
|
||||||
esbuild-linux-s390x: private
|
|
||||||
/esbuild-netbsd-64/0.14.49:
|
|
||||||
esbuild-netbsd-64: private
|
|
||||||
/esbuild-openbsd-64/0.14.49:
|
|
||||||
esbuild-openbsd-64: private
|
|
||||||
/esbuild-sunos-64/0.14.49:
|
|
||||||
esbuild-sunos-64: private
|
|
||||||
/esbuild-windows-32/0.14.49:
|
|
||||||
esbuild-windows-32: private
|
|
||||||
/esbuild-windows-64/0.14.49:
|
|
||||||
esbuild-windows-64: private
|
|
||||||
/esbuild-windows-arm64/0.14.49:
|
|
||||||
esbuild-windows-arm64: private
|
|
||||||
/esbuild/0.14.49:
|
|
||||||
esbuild: private
|
|
||||||
/escalade/3.1.1:
|
|
||||||
escalade: private
|
|
||||||
/escape-string-regexp/1.0.5:
|
|
||||||
escape-string-regexp: private
|
|
||||||
/esutils/2.0.3:
|
|
||||||
esutils: private
|
|
||||||
/fast-deep-equal/3.1.3:
|
|
||||||
fast-deep-equal: private
|
|
||||||
/fill-range/7.0.1:
|
|
||||||
fill-range: private
|
|
||||||
/follow-redirects/1.15.1:
|
|
||||||
follow-redirects: private
|
|
||||||
/form-data/4.0.0:
|
|
||||||
form-data: private
|
|
||||||
/fsevents/2.3.2:
|
|
||||||
fsevents: private
|
|
||||||
/function-bind/1.1.1:
|
|
||||||
function-bind: private
|
|
||||||
/gensync/1.0.0-beta.2:
|
|
||||||
gensync: private
|
|
||||||
/glob-parent/5.1.2:
|
|
||||||
glob-parent: private
|
|
||||||
/globals/11.12.0:
|
|
||||||
globals: private
|
|
||||||
/goober/2.1.11_csstype@3.1.0:
|
|
||||||
goober: private
|
|
||||||
/has-flag/3.0.0:
|
|
||||||
has-flag: private
|
|
||||||
/has/1.0.3:
|
|
||||||
has: private
|
|
||||||
/html-entities/2.3.2:
|
|
||||||
html-entities: private
|
|
||||||
/immutable/4.1.0:
|
|
||||||
immutable: private
|
|
||||||
/is-binary-path/2.1.0:
|
|
||||||
is-binary-path: private
|
|
||||||
/is-core-module/2.9.0:
|
|
||||||
is-core-module: private
|
|
||||||
/is-extglob/2.1.1:
|
|
||||||
is-extglob: private
|
|
||||||
/is-glob/4.0.3:
|
|
||||||
is-glob: private
|
|
||||||
/is-number/7.0.0:
|
|
||||||
is-number: private
|
|
||||||
/is-what/4.1.7:
|
|
||||||
is-what: private
|
|
||||||
/js-tokens/4.0.0:
|
|
||||||
js-tokens: private
|
|
||||||
/jsesc/2.5.2:
|
|
||||||
jsesc: private
|
|
||||||
/json5/2.2.1:
|
|
||||||
json5: private
|
|
||||||
/loader-utils/1.2.3:
|
|
||||||
loader-utils: private
|
|
||||||
/lodash/4.17.21:
|
|
||||||
lodash: private
|
|
||||||
/merge-anything/5.0.2:
|
|
||||||
merge-anything: private
|
|
||||||
/mime-db/1.52.0:
|
|
||||||
mime-db: private
|
|
||||||
/mime-types/2.1.35:
|
|
||||||
mime-types: private
|
|
||||||
/minimist/1.2.6:
|
|
||||||
minimist: private
|
|
||||||
/ms/2.1.2:
|
|
||||||
ms: private
|
|
||||||
/nanoid/3.3.4:
|
|
||||||
nanoid: private
|
|
||||||
/node-releases/2.0.6:
|
|
||||||
node-releases: private
|
|
||||||
/normalize-path/3.0.0:
|
|
||||||
normalize-path: private
|
|
||||||
/path-parse/1.0.7:
|
|
||||||
path-parse: private
|
|
||||||
/picocolors/1.0.0:
|
|
||||||
picocolors: private
|
|
||||||
/picomatch/2.3.1:
|
|
||||||
picomatch: private
|
|
||||||
/postcss/8.4.14:
|
|
||||||
postcss: private
|
|
||||||
/readdirp/3.6.0:
|
|
||||||
readdirp: private
|
|
||||||
/resolve/1.22.1:
|
|
||||||
resolve: private
|
|
||||||
/rollup/2.76.0:
|
|
||||||
rollup: private
|
|
||||||
/safe-buffer/5.1.2:
|
|
||||||
safe-buffer: private
|
|
||||||
/semver/6.3.0:
|
|
||||||
semver: private
|
|
||||||
/solid-refresh/0.4.1_solid-js@1.4.7:
|
|
||||||
solid-refresh: private
|
|
||||||
/source-map-js/1.0.2:
|
|
||||||
source-map-js: private
|
|
||||||
/source-map/0.7.3:
|
|
||||||
source-map: private
|
|
||||||
/string-hash/1.1.3:
|
|
||||||
string-hash: private
|
|
||||||
/stylis-rule-sheet/0.0.10_stylis@3.5.4:
|
|
||||||
stylis-rule-sheet: private
|
|
||||||
/stylis/3.5.4:
|
|
||||||
stylis: private
|
|
||||||
/supports-color/5.5.0:
|
|
||||||
supports-color: private
|
|
||||||
/supports-preserve-symlinks-flag/1.0.0:
|
|
||||||
supports-preserve-symlinks-flag: private
|
|
||||||
/to-fast-properties/2.0.0:
|
|
||||||
to-fast-properties: private
|
|
||||||
/to-regex-range/5.0.1:
|
|
||||||
to-regex-range: private
|
|
||||||
/ts-toolbelt/9.6.0:
|
|
||||||
ts-toolbelt: private
|
|
||||||
/update-browserslist-db/1.0.4_browserslist@4.21.2:
|
|
||||||
update-browserslist-db: private
|
|
||||||
included:
|
|
||||||
dependencies: true
|
|
||||||
devDependencies: true
|
|
||||||
optionalDependencies: true
|
|
||||||
injectedDeps: {}
|
|
||||||
layoutVersion: 5
|
|
||||||
nodeLinker: isolated
|
|
||||||
packageManager: pnpm@7.9.5
|
|
||||||
pendingBuilds: []
|
|
||||||
prunedAt: Wed, 31 Aug 2022 09:00:44 GMT
|
|
||||||
publicHoistPattern:
|
|
||||||
- '*eslint*'
|
|
||||||
- '*prettier*'
|
|
||||||
registries:
|
|
||||||
default: https://registry.npmjs.org/
|
|
||||||
skipped:
|
|
||||||
- /esbuild-android-64/0.14.49
|
|
||||||
- /esbuild-android-arm64/0.14.49
|
|
||||||
- /esbuild-darwin-64/0.14.49
|
|
||||||
- /esbuild-darwin-arm64/0.14.49
|
|
||||||
- /esbuild-freebsd-64/0.14.49
|
|
||||||
- /esbuild-freebsd-arm64/0.14.49
|
|
||||||
- /esbuild-linux-32/0.14.49
|
|
||||||
- /esbuild-linux-arm/0.14.49
|
|
||||||
- /esbuild-linux-arm64/0.14.49
|
|
||||||
- /esbuild-linux-mips64le/0.14.49
|
|
||||||
- /esbuild-linux-ppc64le/0.14.49
|
|
||||||
- /esbuild-linux-riscv64/0.14.49
|
|
||||||
- /esbuild-linux-s390x/0.14.49
|
|
||||||
- /esbuild-netbsd-64/0.14.49
|
|
||||||
- /esbuild-openbsd-64/0.14.49
|
|
||||||
- /esbuild-sunos-64/0.14.49
|
|
||||||
- /esbuild-windows-32/0.14.49
|
|
||||||
- /esbuild-windows-64/0.14.49
|
|
||||||
- /esbuild-windows-arm64/0.14.49
|
|
||||||
- /fsevents/2.3.2
|
|
||||||
storeDir: /home/lilian/.local/share/pnpm/store/v3
|
|
||||||
virtualStoreDir: .pnpm
|
|
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright 2019 Google LLC
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
@ -1,218 +0,0 @@
|
|||||||
# @ampproject/remapping
|
|
||||||
|
|
||||||
> Remap sequential sourcemaps through transformations to point at the original source code
|
|
||||||
|
|
||||||
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
|
|
||||||
them to the original source locations. Think "my minified code, transformed with babel and bundled
|
|
||||||
with webpack", all pointing to the correct location in your original source code.
|
|
||||||
|
|
||||||
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
|
|
||||||
they only need to generate an output sourcemap. This greatly simplifies building custom
|
|
||||||
transformations (think a find-and-replace).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install @ampproject/remapping
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
function remapping(
|
|
||||||
map: SourceMap | SourceMap[],
|
|
||||||
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
|
|
||||||
options?: { excludeContent: boolean, decodedMappings: boolean }
|
|
||||||
): SourceMap;
|
|
||||||
|
|
||||||
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
|
|
||||||
// "source" location (where child sources are resolved relative to, or the location of original
|
|
||||||
// source), and the ability to override the "content" of an original source for inclusion in the
|
|
||||||
// output sourcemap.
|
|
||||||
type LoaderContext = {
|
|
||||||
readonly importer: string;
|
|
||||||
readonly depth: number;
|
|
||||||
source: string;
|
|
||||||
content: string | null | undefined;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
|
|
||||||
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
|
|
||||||
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
|
|
||||||
sourcemap. If not, the path will be treated as an original, untransformed source code.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Babel transformed "helloworld.js" into "transformed.js"
|
|
||||||
const transformedMap = JSON.stringify({
|
|
||||||
file: 'transformed.js',
|
|
||||||
// 1st column of 2nd line of output file translates into the 1st source
|
|
||||||
// file, line 3, column 2
|
|
||||||
mappings: ';CAEE',
|
|
||||||
sources: ['helloworld.js'],
|
|
||||||
version: 3,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Uglify minified "transformed.js" into "transformed.min.js"
|
|
||||||
const minifiedTransformedMap = JSON.stringify({
|
|
||||||
file: 'transformed.min.js',
|
|
||||||
// 0th column of 1st line of output file translates into the 1st source
|
|
||||||
// file, line 2, column 1.
|
|
||||||
mappings: 'AACC',
|
|
||||||
names: [],
|
|
||||||
sources: ['transformed.js'],
|
|
||||||
version: 3,
|
|
||||||
});
|
|
||||||
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
// The "transformed.js" file is an transformed file.
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// The root importer is empty.
|
|
||||||
console.assert(ctx.importer === '');
|
|
||||||
// The depth in the sourcemap tree we're currently loading.
|
|
||||||
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
|
|
||||||
console.assert(ctx.depth === 1);
|
|
||||||
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loader will be called to load transformedMap's source file pointers as well.
|
|
||||||
console.assert(file === 'helloworld.js');
|
|
||||||
// `transformed.js`'s sourcemap points into `helloworld.js`.
|
|
||||||
console.assert(ctx.importer === 'transformed.js');
|
|
||||||
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
|
|
||||||
console.assert(ctx.depth === 2);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// file: 'transpiled.min.js',
|
|
||||||
// mappings: 'AAEE',
|
|
||||||
// sources: ['helloworld.js'],
|
|
||||||
// version: 3,
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example, `loader` will be called twice:
|
|
||||||
|
|
||||||
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
|
|
||||||
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
|
|
||||||
be traced through it into the source files it represents.
|
|
||||||
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
|
|
||||||
we return `null`.
|
|
||||||
|
|
||||||
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
|
|
||||||
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
|
|
||||||
column of the 2nd line of the file `helloworld.js`".
|
|
||||||
|
|
||||||
### Multiple transformations of a file
|
|
||||||
|
|
||||||
As a convenience, if you have multiple single-source transformations of a file, you may pass an
|
|
||||||
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
|
|
||||||
changes the `importer` and `depth` of each call to our loader. So our above example could have been
|
|
||||||
written as:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
[minifiedTransformedMap, transformedMap],
|
|
||||||
() => null
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// file: 'transpiled.min.js',
|
|
||||||
// mappings: 'AAEE',
|
|
||||||
// sources: ['helloworld.js'],
|
|
||||||
// version: 3,
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
### Advanced control of the loading graph
|
|
||||||
|
|
||||||
#### `source`
|
|
||||||
|
|
||||||
The `source` property can overridden to any value to change the location of the current load. Eg,
|
|
||||||
for an original source file, it allows us to change the location to the original source regardless
|
|
||||||
of what the sourcemap source entry says. And for transformed files, it allows us to change the
|
|
||||||
relative resolving location for child sources of the loaded sourcemap.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
|
|
||||||
// source files are loaded, they will now be relative to `src/`.
|
|
||||||
ctx.source = 'src/transformed.js';
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.assert(file === 'src/helloworld.js');
|
|
||||||
// We could futher change the source of this original file, eg, to be inside a nested directory
|
|
||||||
// itself. This will be reflected in the remapped sourcemap.
|
|
||||||
ctx.source = 'src/nested/transformed.js';
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// …,
|
|
||||||
// sources: ['src/nested/helloworld.js'],
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### `content`
|
|
||||||
|
|
||||||
The `content` property can be overridden when we encounter an original source file. Eg, this allows
|
|
||||||
you to manually provide the source content of the original file regardless of whether the
|
|
||||||
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
|
|
||||||
the source content.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
|
|
||||||
// would not include any `sourcesContent` values.
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.assert(file === 'helloworld.js');
|
|
||||||
// We can read the file to provide the source content.
|
|
||||||
ctx.content = fs.readFileSync(file, 'utf8');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// …,
|
|
||||||
// sourcesContent: [
|
|
||||||
// 'console.log("Hello world!")',
|
|
||||||
// ],
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
### Options
|
|
||||||
|
|
||||||
#### excludeContent
|
|
||||||
|
|
||||||
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
|
|
||||||
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
|
|
||||||
the size out the sourcemap.
|
|
||||||
|
|
||||||
#### decodedMappings
|
|
||||||
|
|
||||||
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
|
|
||||||
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
|
|
||||||
encoding into a VLQ string.
|
|
@ -1,204 +0,0 @@
|
|||||||
import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping';
|
|
||||||
import { GenMapping, addSegment, setSourceContent, decodedMap, encodedMap } from '@jridgewell/gen-mapping';
|
|
||||||
|
|
||||||
const SOURCELESS_MAPPING = {
|
|
||||||
source: null,
|
|
||||||
column: null,
|
|
||||||
line: null,
|
|
||||||
name: null,
|
|
||||||
content: null,
|
|
||||||
};
|
|
||||||
const EMPTY_SOURCES = [];
|
|
||||||
function Source(map, sources, source, content) {
|
|
||||||
return {
|
|
||||||
map,
|
|
||||||
sources,
|
|
||||||
source,
|
|
||||||
content,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
function MapSource(map, sources) {
|
|
||||||
return Source(map, sources, '', null);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
function OriginalSource(source, content) {
|
|
||||||
return Source(null, EMPTY_SOURCES, source, content);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
function traceMappings(tree) {
|
|
||||||
const gen = new GenMapping({ file: tree.map.file });
|
|
||||||
const { sources: rootSources, map } = tree;
|
|
||||||
const rootNames = map.names;
|
|
||||||
const rootMappings = decodedMappings(map);
|
|
||||||
for (let i = 0; i < rootMappings.length; i++) {
|
|
||||||
const segments = rootMappings[i];
|
|
||||||
let lastSource = null;
|
|
||||||
let lastSourceLine = null;
|
|
||||||
let lastSourceColumn = null;
|
|
||||||
for (let j = 0; j < segments.length; j++) {
|
|
||||||
const segment = segments[j];
|
|
||||||
const genCol = segment[0];
|
|
||||||
let traced = SOURCELESS_MAPPING;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length !== 1) {
|
|
||||||
const source = rootSources[segment[1]];
|
|
||||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
|
||||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
|
||||||
// respective segment into an original source.
|
|
||||||
if (traced == null)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// So we traced a segment down into its original source file. Now push a
|
|
||||||
// new segment pointing to this location.
|
|
||||||
const { column, line, name, content, source } = traced;
|
|
||||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lastSourceLine = line;
|
|
||||||
lastSourceColumn = column;
|
|
||||||
lastSource = source;
|
|
||||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
|
||||||
addSegment(gen, i, genCol, source, line, column, name);
|
|
||||||
if (content != null)
|
|
||||||
setSourceContent(gen, source, content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gen;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
function originalPositionFor(source, line, column, name) {
|
|
||||||
if (!source.map) {
|
|
||||||
return { column, line, name, source: source.source, content: source.content };
|
|
||||||
}
|
|
||||||
const segment = traceSegment(source.map, line, column);
|
|
||||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
|
||||||
if (segment == null)
|
|
||||||
return null;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length === 1)
|
|
||||||
return SOURCELESS_MAPPING;
|
|
||||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asArray(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value;
|
|
||||||
return [value];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
function buildSourceMapTree(input, loader) {
|
|
||||||
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
|
||||||
const map = maps.pop();
|
|
||||||
for (let i = 0; i < maps.length; i++) {
|
|
||||||
if (maps[i].sources.length > 1) {
|
|
||||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
|
||||||
'Did you specify these with the most recent transformation maps first?');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let tree = build(map, loader, '', 0);
|
|
||||||
for (let i = maps.length - 1; i >= 0; i--) {
|
|
||||||
tree = MapSource(maps[i], [tree]);
|
|
||||||
}
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
function build(map, loader, importer, importerDepth) {
|
|
||||||
const { resolvedSources, sourcesContent } = map;
|
|
||||||
const depth = importerDepth + 1;
|
|
||||||
const children = resolvedSources.map((sourceFile, i) => {
|
|
||||||
// The loading context gives the loader more information about why this file is being loaded
|
|
||||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
||||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
|
||||||
// an unmodified source file.
|
|
||||||
const ctx = {
|
|
||||||
importer,
|
|
||||||
depth,
|
|
||||||
source: sourceFile || '',
|
|
||||||
content: undefined,
|
|
||||||
};
|
|
||||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
|
||||||
// TODO: We should eventually support async loading of sourcemap files.
|
|
||||||
const sourceMap = loader(ctx.source, ctx);
|
|
||||||
const { source, content } = ctx;
|
|
||||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
|
||||||
if (sourceMap)
|
|
||||||
return build(new TraceMap(sourceMap, source), loader, source, depth);
|
|
||||||
// Else, it's an an unmodified source file.
|
|
||||||
// The contents of this unmodified source file can be overridden via the loader context,
|
|
||||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
|
||||||
// the importing sourcemap's `sourcesContent` field.
|
|
||||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
|
||||||
return OriginalSource(source, sourceContent);
|
|
||||||
});
|
|
||||||
return MapSource(map, children);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
class SourceMap {
|
|
||||||
constructor(map, options) {
|
|
||||||
const out = options.decodedMappings ? decodedMap(map) : encodedMap(map);
|
|
||||||
this.version = out.version; // SourceMap spec says this should be first.
|
|
||||||
this.file = out.file;
|
|
||||||
this.mappings = out.mappings;
|
|
||||||
this.names = out.names;
|
|
||||||
this.sourceRoot = out.sourceRoot;
|
|
||||||
this.sources = out.sources;
|
|
||||||
if (!options.excludeContent) {
|
|
||||||
this.sourcesContent = out.sourcesContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
return JSON.stringify(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
function remapping(input, loader, options) {
|
|
||||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
||||||
const tree = buildSourceMapTree(input, loader);
|
|
||||||
return new SourceMap(traceMappings(tree), opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { remapping as default };
|
|
||||||
//# sourceMappingURL=remapping.mjs.map
|
|
File diff suppressed because one or more lines are too long
@ -1,209 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) :
|
|
||||||
typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) :
|
|
||||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping));
|
|
||||||
})(this, (function (traceMapping, genMapping) { 'use strict';
|
|
||||||
|
|
||||||
const SOURCELESS_MAPPING = {
|
|
||||||
source: null,
|
|
||||||
column: null,
|
|
||||||
line: null,
|
|
||||||
name: null,
|
|
||||||
content: null,
|
|
||||||
};
|
|
||||||
const EMPTY_SOURCES = [];
|
|
||||||
function Source(map, sources, source, content) {
|
|
||||||
return {
|
|
||||||
map,
|
|
||||||
sources,
|
|
||||||
source,
|
|
||||||
content,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
function MapSource(map, sources) {
|
|
||||||
return Source(map, sources, '', null);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
function OriginalSource(source, content) {
|
|
||||||
return Source(null, EMPTY_SOURCES, source, content);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
function traceMappings(tree) {
|
|
||||||
const gen = new genMapping.GenMapping({ file: tree.map.file });
|
|
||||||
const { sources: rootSources, map } = tree;
|
|
||||||
const rootNames = map.names;
|
|
||||||
const rootMappings = traceMapping.decodedMappings(map);
|
|
||||||
for (let i = 0; i < rootMappings.length; i++) {
|
|
||||||
const segments = rootMappings[i];
|
|
||||||
let lastSource = null;
|
|
||||||
let lastSourceLine = null;
|
|
||||||
let lastSourceColumn = null;
|
|
||||||
for (let j = 0; j < segments.length; j++) {
|
|
||||||
const segment = segments[j];
|
|
||||||
const genCol = segment[0];
|
|
||||||
let traced = SOURCELESS_MAPPING;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length !== 1) {
|
|
||||||
const source = rootSources[segment[1]];
|
|
||||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
|
||||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
|
||||||
// respective segment into an original source.
|
|
||||||
if (traced == null)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// So we traced a segment down into its original source file. Now push a
|
|
||||||
// new segment pointing to this location.
|
|
||||||
const { column, line, name, content, source } = traced;
|
|
||||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lastSourceLine = line;
|
|
||||||
lastSourceColumn = column;
|
|
||||||
lastSource = source;
|
|
||||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
|
||||||
genMapping.addSegment(gen, i, genCol, source, line, column, name);
|
|
||||||
if (content != null)
|
|
||||||
genMapping.setSourceContent(gen, source, content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gen;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
function originalPositionFor(source, line, column, name) {
|
|
||||||
if (!source.map) {
|
|
||||||
return { column, line, name, source: source.source, content: source.content };
|
|
||||||
}
|
|
||||||
const segment = traceMapping.traceSegment(source.map, line, column);
|
|
||||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
|
||||||
if (segment == null)
|
|
||||||
return null;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length === 1)
|
|
||||||
return SOURCELESS_MAPPING;
|
|
||||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asArray(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value;
|
|
||||||
return [value];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
function buildSourceMapTree(input, loader) {
|
|
||||||
const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, ''));
|
|
||||||
const map = maps.pop();
|
|
||||||
for (let i = 0; i < maps.length; i++) {
|
|
||||||
if (maps[i].sources.length > 1) {
|
|
||||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
|
||||||
'Did you specify these with the most recent transformation maps first?');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let tree = build(map, loader, '', 0);
|
|
||||||
for (let i = maps.length - 1; i >= 0; i--) {
|
|
||||||
tree = MapSource(maps[i], [tree]);
|
|
||||||
}
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
function build(map, loader, importer, importerDepth) {
|
|
||||||
const { resolvedSources, sourcesContent } = map;
|
|
||||||
const depth = importerDepth + 1;
|
|
||||||
const children = resolvedSources.map((sourceFile, i) => {
|
|
||||||
// The loading context gives the loader more information about why this file is being loaded
|
|
||||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
||||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
|
||||||
// an unmodified source file.
|
|
||||||
const ctx = {
|
|
||||||
importer,
|
|
||||||
depth,
|
|
||||||
source: sourceFile || '',
|
|
||||||
content: undefined,
|
|
||||||
};
|
|
||||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
|
||||||
// TODO: We should eventually support async loading of sourcemap files.
|
|
||||||
const sourceMap = loader(ctx.source, ctx);
|
|
||||||
const { source, content } = ctx;
|
|
||||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
|
||||||
if (sourceMap)
|
|
||||||
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
|
|
||||||
// Else, it's an an unmodified source file.
|
|
||||||
// The contents of this unmodified source file can be overridden via the loader context,
|
|
||||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
|
||||||
// the importing sourcemap's `sourcesContent` field.
|
|
||||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
|
||||||
return OriginalSource(source, sourceContent);
|
|
||||||
});
|
|
||||||
return MapSource(map, children);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
class SourceMap {
|
|
||||||
constructor(map, options) {
|
|
||||||
const out = options.decodedMappings ? genMapping.decodedMap(map) : genMapping.encodedMap(map);
|
|
||||||
this.version = out.version; // SourceMap spec says this should be first.
|
|
||||||
this.file = out.file;
|
|
||||||
this.mappings = out.mappings;
|
|
||||||
this.names = out.names;
|
|
||||||
this.sourceRoot = out.sourceRoot;
|
|
||||||
this.sources = out.sources;
|
|
||||||
if (!options.excludeContent) {
|
|
||||||
this.sourcesContent = out.sourcesContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
return JSON.stringify(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
function remapping(input, loader, options) {
|
|
||||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
||||||
const tree = buildSourceMapTree(input, loader);
|
|
||||||
return new SourceMap(traceMappings(tree), opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
return remapping;
|
|
||||||
|
|
||||||
}));
|
|
||||||
//# sourceMappingURL=remapping.umd.js.map
|
|
File diff suppressed because one or more lines are too long
@ -1,14 +0,0 @@
|
|||||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
|
||||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
|
@ -1,19 +0,0 @@
|
|||||||
import SourceMap from './source-map';
|
|
||||||
import type { SourceMapInput, SourceMapLoader, Options } from './types';
|
|
||||||
export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types';
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap;
|
|
@ -1,48 +0,0 @@
|
|||||||
import { GenMapping } from '@jridgewell/gen-mapping';
|
|
||||||
import type { TraceMap } from '@jridgewell/trace-mapping';
|
|
||||||
export declare type SourceMapSegmentObject = {
|
|
||||||
column: number;
|
|
||||||
line: number;
|
|
||||||
name: string;
|
|
||||||
source: string;
|
|
||||||
content: string | null;
|
|
||||||
} | {
|
|
||||||
column: null;
|
|
||||||
line: null;
|
|
||||||
name: null;
|
|
||||||
source: null;
|
|
||||||
content: null;
|
|
||||||
};
|
|
||||||
export declare type OriginalSource = {
|
|
||||||
map: TraceMap;
|
|
||||||
sources: Sources[];
|
|
||||||
source: string;
|
|
||||||
content: string | null;
|
|
||||||
};
|
|
||||||
export declare type MapSource = {
|
|
||||||
map: TraceMap;
|
|
||||||
sources: Sources[];
|
|
||||||
source: string;
|
|
||||||
content: string | null;
|
|
||||||
};
|
|
||||||
export declare type Sources = OriginalSource | MapSource;
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
export declare function OriginalSource(source: string, content: string | null): OriginalSource;
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
export declare function traceMappings(tree: MapSource): GenMapping;
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;
|
|
@ -1,17 +0,0 @@
|
|||||||
import type { GenMapping } from '@jridgewell/gen-mapping';
|
|
||||||
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
export default class SourceMap {
|
|
||||||
file?: string | null;
|
|
||||||
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
|
|
||||||
sourceRoot?: string;
|
|
||||||
names: string[];
|
|
||||||
sources: (string | null)[];
|
|
||||||
sourcesContent?: (string | null)[];
|
|
||||||
version: 3;
|
|
||||||
constructor(map: GenMapping, options: Options);
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import type { SourceMapInput } from '@jridgewell/trace-mapping';
|
|
||||||
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
|
|
||||||
export type { SourceMapInput };
|
|
||||||
export declare type LoaderContext = {
|
|
||||||
readonly importer: string;
|
|
||||||
readonly depth: number;
|
|
||||||
source: string;
|
|
||||||
content: string | null | undefined;
|
|
||||||
};
|
|
||||||
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
|
|
||||||
export declare type Options = {
|
|
||||||
excludeContent?: boolean;
|
|
||||||
decodedMappings?: boolean;
|
|
||||||
};
|
|
@ -1,63 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@ampproject/remapping",
|
|
||||||
"version": "2.2.0",
|
|
||||||
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
|
|
||||||
"keywords": [
|
|
||||||
"source",
|
|
||||||
"map",
|
|
||||||
"remap"
|
|
||||||
],
|
|
||||||
"main": "dist/remapping.umd.js",
|
|
||||||
"module": "dist/remapping.mjs",
|
|
||||||
"typings": "dist/types/remapping.d.ts",
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"author": "Justin Ridgewell <jridgewell@google.com>",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/ampproject/remapping.git"
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "run-s -n build:*",
|
|
||||||
"build:rollup": "rollup -c rollup.config.js",
|
|
||||||
"build:ts": "tsc --project tsconfig.build.json",
|
|
||||||
"lint": "run-s -n lint:*",
|
|
||||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
|
||||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
|
||||||
"prebuild": "rm -rf dist",
|
|
||||||
"prepublishOnly": "npm run preversion",
|
|
||||||
"preversion": "run-s test build",
|
|
||||||
"test": "run-s -n test:lint test:only",
|
|
||||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
||||||
"test:lint": "run-s -n test:lint:*",
|
|
||||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
|
||||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
|
||||||
"test:only": "jest --coverage",
|
|
||||||
"test:watch": "jest --coverage --watch"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@rollup/plugin-typescript": "8.3.2",
|
|
||||||
"@types/jest": "27.4.1",
|
|
||||||
"@typescript-eslint/eslint-plugin": "5.20.0",
|
|
||||||
"@typescript-eslint/parser": "5.20.0",
|
|
||||||
"eslint": "8.14.0",
|
|
||||||
"eslint-config-prettier": "8.5.0",
|
|
||||||
"jest": "27.5.1",
|
|
||||||
"jest-config": "27.5.1",
|
|
||||||
"npm-run-all": "4.1.5",
|
|
||||||
"prettier": "2.6.2",
|
|
||||||
"rollup": "2.70.2",
|
|
||||||
"ts-jest": "27.1.4",
|
|
||||||
"tslib": "2.4.0",
|
|
||||||
"typescript": "4.6.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@jridgewell/gen-mapping": "^0.1.0",
|
|
||||||
"@jridgewell/trace-mapping": "^0.3.9"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
../../../@jridgewell+gen-mapping@0.1.1/node_modules/@jridgewell/gen-mapping
|
|
@ -1 +0,0 @@
|
|||||||
../../../@jridgewell+trace-mapping@0.3.14/node_modules/@jridgewell/trace-mapping
|
|
@ -1,22 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
||||||
|
|
||||||
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.
|
|
@ -1,19 +0,0 @@
|
|||||||
# @babel/code-frame
|
|
||||||
|
|
||||||
> Generate errors that contain a code frame that point to source locations.
|
|
||||||
|
|
||||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save-dev @babel/code-frame
|
|
||||||
```
|
|
||||||
|
|
||||||
or using yarn:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @babel/code-frame --dev
|
|
||||||
```
|
|
@ -1,163 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.codeFrameColumns = codeFrameColumns;
|
|
||||||
exports.default = _default;
|
|
||||||
|
|
||||||
var _highlight = require("@babel/highlight");
|
|
||||||
|
|
||||||
let deprecationWarningShown = false;
|
|
||||||
|
|
||||||
function getDefs(chalk) {
|
|
||||||
return {
|
|
||||||
gutter: chalk.grey,
|
|
||||||
marker: chalk.red.bold,
|
|
||||||
message: chalk.red.bold
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
||||||
|
|
||||||
function getMarkerLines(loc, source, opts) {
|
|
||||||
const startLoc = Object.assign({
|
|
||||||
column: 0,
|
|
||||||
line: -1
|
|
||||||
}, loc.start);
|
|
||||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
||||||
const {
|
|
||||||
linesAbove = 2,
|
|
||||||
linesBelow = 3
|
|
||||||
} = opts || {};
|
|
||||||
const startLine = startLoc.line;
|
|
||||||
const startColumn = startLoc.column;
|
|
||||||
const endLine = endLoc.line;
|
|
||||||
const endColumn = endLoc.column;
|
|
||||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
||||||
let end = Math.min(source.length, endLine + linesBelow);
|
|
||||||
|
|
||||||
if (startLine === -1) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endLine === -1) {
|
|
||||||
end = source.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lineDiff = endLine - startLine;
|
|
||||||
const markerLines = {};
|
|
||||||
|
|
||||||
if (lineDiff) {
|
|
||||||
for (let i = 0; i <= lineDiff; i++) {
|
|
||||||
const lineNumber = i + startLine;
|
|
||||||
|
|
||||||
if (!startColumn) {
|
|
||||||
markerLines[lineNumber] = true;
|
|
||||||
} else if (i === 0) {
|
|
||||||
const sourceLength = source[lineNumber - 1].length;
|
|
||||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
|
||||||
} else if (i === lineDiff) {
|
|
||||||
markerLines[lineNumber] = [0, endColumn];
|
|
||||||
} else {
|
|
||||||
const sourceLength = source[lineNumber - i].length;
|
|
||||||
markerLines[lineNumber] = [0, sourceLength];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (startColumn === endColumn) {
|
|
||||||
if (startColumn) {
|
|
||||||
markerLines[startLine] = [startColumn, 0];
|
|
||||||
} else {
|
|
||||||
markerLines[startLine] = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
markerLines
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
||||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
|
||||||
const chalk = (0, _highlight.getChalk)(opts);
|
|
||||||
const defs = getDefs(chalk);
|
|
||||||
|
|
||||||
const maybeHighlight = (chalkFn, string) => {
|
|
||||||
return highlighted ? chalkFn(string) : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const lines = rawLines.split(NEWLINE);
|
|
||||||
const {
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
markerLines
|
|
||||||
} = getMarkerLines(loc, lines, opts);
|
|
||||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
||||||
const numberMaxWidth = String(end).length;
|
|
||||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
|
||||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
|
||||||
const number = start + 1 + index;
|
|
||||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
|
||||||
const gutter = ` ${paddedNumber} |`;
|
|
||||||
const hasMarker = markerLines[number];
|
|
||||||
const lastMarkerLine = !markerLines[number + 1];
|
|
||||||
|
|
||||||
if (hasMarker) {
|
|
||||||
let markerLine = "";
|
|
||||||
|
|
||||||
if (Array.isArray(hasMarker)) {
|
|
||||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
||||||
const numberOfMarkers = hasMarker[1] || 1;
|
|
||||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
|
||||||
|
|
||||||
if (lastMarkerLine && opts.message) {
|
|
||||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
|
||||||
} else {
|
|
||||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
|
||||||
}
|
|
||||||
}).join("\n");
|
|
||||||
|
|
||||||
if (opts.message && !hasColumns) {
|
|
||||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (highlighted) {
|
|
||||||
return chalk.reset(frame);
|
|
||||||
} else {
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
|
||||||
if (!deprecationWarningShown) {
|
|
||||||
deprecationWarningShown = true;
|
|
||||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
|
||||||
|
|
||||||
if (process.emitWarning) {
|
|
||||||
process.emitWarning(message, "DeprecationWarning");
|
|
||||||
} else {
|
|
||||||
const deprecationError = new Error(message);
|
|
||||||
deprecationError.name = "DeprecationWarning";
|
|
||||||
console.warn(new Error(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
colNumber = Math.max(colNumber, 0);
|
|
||||||
const location = {
|
|
||||||
start: {
|
|
||||||
column: colNumber,
|
|
||||||
line: lineNumber
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return codeFrameColumns(rawLines, location, opts);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@babel/code-frame",
|
|
||||||
"version": "7.18.6",
|
|
||||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
|
||||||
"author": "The Babel Team (https://babel.dev/team)",
|
|
||||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
|
||||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
|
||||||
"license": "MIT",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/babel/babel.git",
|
|
||||||
"directory": "packages/babel-code-frame"
|
|
||||||
},
|
|
||||||
"main": "./lib/index.js",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/highlight": "^7.18.6"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/chalk": "^2.0.0",
|
|
||||||
"chalk": "^2.0.0",
|
|
||||||
"strip-ansi": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.9.0"
|
|
||||||
},
|
|
||||||
"type": "commonjs"
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
../../../@babel+highlight@7.18.6/node_modules/@babel/highlight
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user