🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
3396
node_modules/vite/LICENSE.md
generated
vendored
Normal file
3396
node_modules/vite/LICENSE.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
20
node_modules/vite/README.md
generated
vendored
Normal file
20
node_modules/vite/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# vite ⚡
|
||||
|
||||
> Next Generation Frontend Tooling
|
||||
|
||||
- 💡 Instant Server Start
|
||||
- ⚡️ Lightning Fast HMR
|
||||
- 🛠️ Rich Features
|
||||
- 📦 Optimized Build
|
||||
- 🔩 Universal Plugin Interface
|
||||
- 🔑 Fully Typed APIs
|
||||
|
||||
Vite (French word for "fast", pronounced `/vit/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts:
|
||||
|
||||
- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vitejs.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vitejs.dev/guide/features.html#hot-module-replacement).
|
||||
|
||||
- A [build command](https://vitejs.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.
|
||||
|
||||
In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/guide/api-plugin.html) and [JavaScript API](https://vitejs.dev/guide/api-javascript.html) with full typing support.
|
||||
|
||||
[Read the Docs to Learn More](https://vitejs.dev).
|
||||
95
node_modules/vite/bin/openChrome.applescript
generated
vendored
Normal file
95
node_modules/vite/bin/openChrome.applescript
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
(*
|
||||
Copyright (c) 2015-present, Facebook, Inc.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file at
|
||||
https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
|
||||
*)
|
||||
|
||||
property targetTab: null
|
||||
property targetTabIndex: -1
|
||||
property targetWindow: null
|
||||
property theProgram: "Google Chrome"
|
||||
|
||||
on run argv
|
||||
set theURL to item 1 of argv
|
||||
|
||||
-- Allow requested program to be optional,
|
||||
-- default to Google Chrome
|
||||
if (count of argv) > 1 then
|
||||
set theProgram to item 2 of argv
|
||||
end if
|
||||
|
||||
using terms from application "Google Chrome"
|
||||
tell application theProgram
|
||||
|
||||
if (count every window) = 0 then
|
||||
make new window
|
||||
end if
|
||||
|
||||
-- 1: Looking for tab running debugger
|
||||
-- then, Reload debugging tab if found
|
||||
-- then return
|
||||
set found to my lookupTabWithUrl(theURL)
|
||||
if found then
|
||||
set targetWindow's active tab index to targetTabIndex
|
||||
tell targetTab to reload
|
||||
tell targetWindow to activate
|
||||
set index of targetWindow to 1
|
||||
return
|
||||
end if
|
||||
|
||||
-- 2: Looking for Empty tab
|
||||
-- In case debugging tab was not found
|
||||
-- We try to find an empty tab instead
|
||||
set found to my lookupTabWithUrl("chrome://newtab/")
|
||||
if found then
|
||||
set targetWindow's active tab index to targetTabIndex
|
||||
set URL of targetTab to theURL
|
||||
tell targetWindow to activate
|
||||
return
|
||||
end if
|
||||
|
||||
-- 3: Create new tab
|
||||
-- both debugging and empty tab were not found
|
||||
-- make a new tab with url
|
||||
tell window 1
|
||||
activate
|
||||
make new tab with properties {URL:theURL}
|
||||
end tell
|
||||
end tell
|
||||
end using terms from
|
||||
end run
|
||||
|
||||
-- Function:
|
||||
-- Lookup tab with given url
|
||||
-- if found, store tab, index, and window in properties
|
||||
-- (properties were declared on top of file)
|
||||
on lookupTabWithUrl(lookupUrl)
|
||||
using terms from application "Google Chrome"
|
||||
tell application theProgram
|
||||
-- Find a tab with the given url
|
||||
set found to false
|
||||
set theTabIndex to -1
|
||||
repeat with theWindow in every window
|
||||
set theTabIndex to 0
|
||||
repeat with theTab in every tab of theWindow
|
||||
set theTabIndex to theTabIndex + 1
|
||||
if (theTab's URL as string) contains lookupUrl then
|
||||
-- assign tab, tab index, and window to properties
|
||||
set targetTab to theTab
|
||||
set targetTabIndex to theTabIndex
|
||||
set targetWindow to theWindow
|
||||
set found to true
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
if found then
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
end tell
|
||||
end using terms from
|
||||
return found
|
||||
end lookupTabWithUrl
|
||||
61
node_modules/vite/bin/vite.js
generated
vendored
Executable file
61
node_modules/vite/bin/vite.js
generated
vendored
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env node
|
||||
import { performance } from 'node:perf_hooks'
|
||||
|
||||
if (!import.meta.url.includes('node_modules')) {
|
||||
try {
|
||||
// only available as dev dependency
|
||||
await import('source-map-support').then((r) => r.default.install())
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
global.__vite_start_time = performance.now()
|
||||
|
||||
// check debug mode first before requiring the CLI.
|
||||
const debugIndex = process.argv.findIndex((arg) => /^(?:-d|--debug)$/.test(arg))
|
||||
const filterIndex = process.argv.findIndex((arg) =>
|
||||
/^(?:-f|--filter)$/.test(arg),
|
||||
)
|
||||
const profileIndex = process.argv.indexOf('--profile')
|
||||
|
||||
if (debugIndex > 0) {
|
||||
let value = process.argv[debugIndex + 1]
|
||||
if (!value || value.startsWith('-')) {
|
||||
value = 'vite:*'
|
||||
} else {
|
||||
// support debugging multiple flags with comma-separated list
|
||||
value = value
|
||||
.split(',')
|
||||
.map((v) => `vite:${v}`)
|
||||
.join(',')
|
||||
}
|
||||
process.env.DEBUG = `${
|
||||
process.env.DEBUG ? process.env.DEBUG + ',' : ''
|
||||
}${value}`
|
||||
|
||||
if (filterIndex > 0) {
|
||||
const filter = process.argv[filterIndex + 1]
|
||||
if (filter && !filter.startsWith('-')) {
|
||||
process.env.VITE_DEBUG_FILTER = filter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
return import('../dist/node/cli.js')
|
||||
}
|
||||
|
||||
if (profileIndex > 0) {
|
||||
process.argv.splice(profileIndex, 1)
|
||||
const next = process.argv[profileIndex]
|
||||
if (next && !next.startsWith('-')) {
|
||||
process.argv.splice(profileIndex, 1)
|
||||
}
|
||||
const inspector = await import('node:inspector').then((r) => r.default)
|
||||
const session = (global.__vite_profile_session = new inspector.Session())
|
||||
session.connect()
|
||||
session.post('Profiler.enable', () => {
|
||||
session.post('Profiler.start', start)
|
||||
})
|
||||
} else {
|
||||
start()
|
||||
}
|
||||
281
node_modules/vite/client.d.ts
generated
vendored
Normal file
281
node_modules/vite/client.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
/// <reference path="./types/importMeta.d.ts" />
|
||||
|
||||
// CSS modules
|
||||
type CSSModuleClasses = { readonly [key: string]: string }
|
||||
|
||||
declare module '*.module.css' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.scss' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.sass' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.less' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.styl' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.stylus' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.pcss' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
declare module '*.module.sss' {
|
||||
const classes: CSSModuleClasses
|
||||
export default classes
|
||||
}
|
||||
|
||||
// CSS
|
||||
declare module '*.css' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.css?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.scss' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.scss?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.sass' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.sass?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.less' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.less?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.styl' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.styl?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.stylus' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.stylus?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.pcss' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.pcss?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
declare module '*.sss' {
|
||||
/**
|
||||
* @deprecated Use `import style from './style.sss?inline'` instead.
|
||||
*/
|
||||
const css: string
|
||||
export default css
|
||||
}
|
||||
|
||||
// Built-in asset types
|
||||
// see `src/node/constants.ts`
|
||||
|
||||
// images
|
||||
declare module '*.apng' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.png' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.jpg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.jpeg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.jfif' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.pjpeg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.pjp' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.gif' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.svg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ico' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.webp' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.avif' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// media
|
||||
declare module '*.mp4' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.webm' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ogg' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.mp3' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.wav' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.flac' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.aac' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*.opus' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// fonts
|
||||
declare module '*.woff' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.woff2' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.eot' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.ttf' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.otf' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// other
|
||||
declare module '*.webmanifest' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.pdf' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
declare module '*.txt' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
// wasm?init
|
||||
declare module '*.wasm?init' {
|
||||
const initWasm: (
|
||||
options: WebAssembly.Imports,
|
||||
) => Promise<WebAssembly.Instance>
|
||||
export default initWasm
|
||||
}
|
||||
|
||||
// web worker
|
||||
declare module '*?worker' {
|
||||
const workerConstructor: {
|
||||
new (): Worker
|
||||
}
|
||||
export default workerConstructor
|
||||
}
|
||||
|
||||
declare module '*?worker&inline' {
|
||||
const workerConstructor: {
|
||||
new (): Worker
|
||||
}
|
||||
export default workerConstructor
|
||||
}
|
||||
|
||||
declare module '*?worker&url' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*?sharedworker' {
|
||||
const sharedWorkerConstructor: {
|
||||
new (): SharedWorker
|
||||
}
|
||||
export default sharedWorkerConstructor
|
||||
}
|
||||
|
||||
declare module '*?sharedworker&inline' {
|
||||
const sharedWorkerConstructor: {
|
||||
new (): SharedWorker
|
||||
}
|
||||
export default sharedWorkerConstructor
|
||||
}
|
||||
|
||||
declare module '*?sharedworker&url' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*?raw' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*?url' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module '*?inline' {
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
708
node_modules/vite/dist/client/client.mjs
generated
vendored
Normal file
708
node_modules/vite/dist/client/client.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,708 @@
|
|||
import '@vite/env';
|
||||
|
||||
const base$1 = __BASE__ || '/';
|
||||
// set :host styles to make playwright detect the element as visible
|
||||
const template = /*html*/ `
|
||||
<style>
|
||||
:host {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 99999;
|
||||
--monospace: 'SFMono-Regular', Consolas,
|
||||
'Liberation Mono', Menlo, Courier, monospace;
|
||||
--red: #ff5555;
|
||||
--yellow: #e2aa53;
|
||||
--purple: #cfa4ff;
|
||||
--cyan: #2dd9da;
|
||||
--dim: #c9c9c9;
|
||||
|
||||
--window-background: #181818;
|
||||
--window-color: #d8d8d8;
|
||||
}
|
||||
|
||||
.backdrop {
|
||||
position: fixed;
|
||||
z-index: 99999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
margin: 0;
|
||||
background: rgba(0, 0, 0, 0.66);
|
||||
}
|
||||
|
||||
.window {
|
||||
font-family: var(--monospace);
|
||||
line-height: 1.5;
|
||||
width: 800px;
|
||||
color: var(--window-color);
|
||||
margin: 30px auto;
|
||||
padding: 25px 40px;
|
||||
position: relative;
|
||||
background: var(--window-background);
|
||||
border-radius: 6px 6px 8px 8px;
|
||||
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
|
||||
overflow: hidden;
|
||||
border-top: 8px solid var(--red);
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: var(--monospace);
|
||||
font-size: 16px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1em;
|
||||
overflow-x: scroll;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
pre::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.message {
|
||||
line-height: 1.3;
|
||||
font-weight: 600;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.message-body {
|
||||
color: var(--red);
|
||||
}
|
||||
|
||||
.plugin {
|
||||
color: var(--purple);
|
||||
}
|
||||
|
||||
.file {
|
||||
color: var(--cyan);
|
||||
margin-bottom: 0;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.frame {
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
.stack {
|
||||
font-size: 13px;
|
||||
color: var(--dim);
|
||||
}
|
||||
|
||||
.tip {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
border-top: 1px dotted #999;
|
||||
padding-top: 13px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 13px;
|
||||
font-family: var(--monospace);
|
||||
color: var(--yellow);
|
||||
}
|
||||
|
||||
.file-link {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<div class="backdrop" part="backdrop">
|
||||
<div class="window" part="window">
|
||||
<pre class="message" part="message"><span class="plugin" part="plugin"></span><span class="message-body" part="message-body"></span></pre>
|
||||
<pre class="file" part="file"></pre>
|
||||
<pre class="frame" part="frame"></pre>
|
||||
<pre class="stack" part="stack"></pre>
|
||||
<div class="tip" part="tip">
|
||||
Click outside or fix the code to dismiss.<br>
|
||||
You can also disable this overlay by setting
|
||||
<code part="config-option-name">server.hmr.overlay</code> to <code part="config-option-value">false</code> in <code part="config-file-name">vite.config.js.</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
const fileRE = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
|
||||
const codeframeRE = /^(?:>?\s+\d+\s+\|.*|\s+\|\s*\^.*)\r?\n/gm;
|
||||
// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where
|
||||
// `HTMLElement` was not originally defined.
|
||||
const { HTMLElement = class {
|
||||
} } = globalThis;
|
||||
class ErrorOverlay extends HTMLElement {
|
||||
constructor(err, links = true) {
|
||||
var _a;
|
||||
super();
|
||||
this.root = this.attachShadow({ mode: 'open' });
|
||||
this.root.innerHTML = template;
|
||||
codeframeRE.lastIndex = 0;
|
||||
const hasFrame = err.frame && codeframeRE.test(err.frame);
|
||||
const message = hasFrame
|
||||
? err.message.replace(codeframeRE, '')
|
||||
: err.message;
|
||||
if (err.plugin) {
|
||||
this.text('.plugin', `[plugin:${err.plugin}] `);
|
||||
}
|
||||
this.text('.message-body', message.trim());
|
||||
const [file] = (((_a = err.loc) === null || _a === void 0 ? void 0 : _a.file) || err.id || 'unknown file').split(`?`);
|
||||
if (err.loc) {
|
||||
this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, links);
|
||||
}
|
||||
else if (err.id) {
|
||||
this.text('.file', file);
|
||||
}
|
||||
if (hasFrame) {
|
||||
this.text('.frame', err.frame.trim());
|
||||
}
|
||||
this.text('.stack', err.stack, links);
|
||||
this.root.querySelector('.window').addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
});
|
||||
this.addEventListener('click', () => {
|
||||
this.close();
|
||||
});
|
||||
this.closeOnEsc = (e) => {
|
||||
if (e.key === 'Escape' || e.code === 'Escape') {
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', this.closeOnEsc);
|
||||
}
|
||||
text(selector, text, linkFiles = false) {
|
||||
const el = this.root.querySelector(selector);
|
||||
if (!linkFiles) {
|
||||
el.textContent = text;
|
||||
}
|
||||
else {
|
||||
let curIndex = 0;
|
||||
let match;
|
||||
fileRE.lastIndex = 0;
|
||||
while ((match = fileRE.exec(text))) {
|
||||
const { 0: file, index } = match;
|
||||
if (index != null) {
|
||||
const frag = text.slice(curIndex, index);
|
||||
el.appendChild(document.createTextNode(frag));
|
||||
const link = document.createElement('a');
|
||||
link.textContent = file;
|
||||
link.className = 'file-link';
|
||||
link.onclick = () => {
|
||||
fetch(`${base$1}__open-in-editor?file=` + encodeURIComponent(file));
|
||||
};
|
||||
el.appendChild(link);
|
||||
curIndex += frag.length + file.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close() {
|
||||
var _a;
|
||||
(_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this);
|
||||
document.removeEventListener('keydown', this.closeOnEsc);
|
||||
}
|
||||
}
|
||||
const overlayId = 'vite-error-overlay';
|
||||
const { customElements } = globalThis; // Ensure `customElements` is defined before the next line.
|
||||
if (customElements && !customElements.get(overlayId)) {
|
||||
customElements.define(overlayId, ErrorOverlay);
|
||||
}
|
||||
|
||||
console.debug('[vite] connecting...');
|
||||
const importMetaUrl = new URL(import.meta.url);
|
||||
// use server configuration, then fallback to inference
|
||||
const serverHost = __SERVER_HOST__;
|
||||
const socketProtocol = __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws');
|
||||
const hmrPort = __HMR_PORT__;
|
||||
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}`;
|
||||
const directSocketHost = __HMR_DIRECT_TARGET__;
|
||||
const base = __BASE__ || '/';
|
||||
const messageBuffer = [];
|
||||
let socket;
|
||||
try {
|
||||
let fallback;
|
||||
// only use fallback when port is inferred to prevent confusion
|
||||
if (!hmrPort) {
|
||||
fallback = () => {
|
||||
// fallback to connecting directly to the hmr server
|
||||
// for servers which does not support proxying websocket
|
||||
socket = setupWebSocket(socketProtocol, directSocketHost, () => {
|
||||
const currentScriptHostURL = new URL(import.meta.url);
|
||||
const currentScriptHost = currentScriptHostURL.host +
|
||||
currentScriptHostURL.pathname.replace(/@vite\/client$/, '');
|
||||
console.error('[vite] failed to connect to websocket.\n' +
|
||||
'your current setup:\n' +
|
||||
` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\n` +
|
||||
` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\n` +
|
||||
'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .');
|
||||
});
|
||||
socket.addEventListener('open', () => {
|
||||
console.info('[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.');
|
||||
}, { once: true });
|
||||
};
|
||||
}
|
||||
socket = setupWebSocket(socketProtocol, socketHost, fallback);
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`[vite] failed to connect to websocket (${error}). `);
|
||||
}
|
||||
function setupWebSocket(protocol, hostAndPath, onCloseWithoutOpen) {
|
||||
const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr');
|
||||
let isOpened = false;
|
||||
socket.addEventListener('open', () => {
|
||||
isOpened = true;
|
||||
notifyListeners('vite:ws:connect', { webSocket: socket });
|
||||
}, { once: true });
|
||||
// Listen for messages
|
||||
socket.addEventListener('message', async ({ data }) => {
|
||||
handleMessage(JSON.parse(data));
|
||||
});
|
||||
// ping server
|
||||
socket.addEventListener('close', async ({ wasClean }) => {
|
||||
if (wasClean)
|
||||
return;
|
||||
if (!isOpened && onCloseWithoutOpen) {
|
||||
onCloseWithoutOpen();
|
||||
return;
|
||||
}
|
||||
notifyListeners('vite:ws:disconnect', { webSocket: socket });
|
||||
console.log(`[vite] server connection lost. polling for restart...`);
|
||||
await waitForSuccessfulPing(protocol, hostAndPath);
|
||||
location.reload();
|
||||
});
|
||||
return socket;
|
||||
}
|
||||
function warnFailedFetch(err, path) {
|
||||
if (!err.message.match('fetch')) {
|
||||
console.error(err);
|
||||
}
|
||||
console.error(`[hmr] Failed to reload ${path}. ` +
|
||||
`This could be due to syntax errors or importing non-existent ` +
|
||||
`modules. (see errors above)`);
|
||||
}
|
||||
function cleanUrl(pathname) {
|
||||
const url = new URL(pathname, location.toString());
|
||||
url.searchParams.delete('direct');
|
||||
return url.pathname + url.search;
|
||||
}
|
||||
let isFirstUpdate = true;
|
||||
const outdatedLinkTags = new WeakSet();
|
||||
const debounceReload = (time) => {
|
||||
let timer;
|
||||
return () => {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
location.reload();
|
||||
}, time);
|
||||
};
|
||||
};
|
||||
const pageReload = debounceReload(50);
|
||||
async function handleMessage(payload) {
|
||||
switch (payload.type) {
|
||||
case 'connected':
|
||||
console.debug(`[vite] connected.`);
|
||||
sendMessageBuffer();
|
||||
// proxy(nginx, docker) hmr ws maybe caused timeout,
|
||||
// so send ping package let ws keep alive.
|
||||
setInterval(() => {
|
||||
if (socket.readyState === socket.OPEN) {
|
||||
socket.send('{"type":"ping"}');
|
||||
}
|
||||
}, __HMR_TIMEOUT__);
|
||||
break;
|
||||
case 'update':
|
||||
notifyListeners('vite:beforeUpdate', payload);
|
||||
// if this is the first update and there's already an error overlay, it
|
||||
// means the page opened with existing server compile error and the whole
|
||||
// module script failed to load (since one of the nested imports is 500).
|
||||
// in this case a normal update won't work and a full reload is needed.
|
||||
if (isFirstUpdate && hasErrorOverlay()) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
clearErrorOverlay();
|
||||
isFirstUpdate = false;
|
||||
}
|
||||
await Promise.all(payload.updates.map(async (update) => {
|
||||
if (update.type === 'js-update') {
|
||||
return queueUpdate(fetchUpdate(update));
|
||||
}
|
||||
// css-update
|
||||
// this is only sent when a css file referenced with <link> is updated
|
||||
const { path, timestamp } = update;
|
||||
const searchUrl = cleanUrl(path);
|
||||
// can't use querySelector with `[href*=]` here since the link may be
|
||||
// using relative paths so we need to use link.href to grab the full
|
||||
// URL for the include check.
|
||||
const el = Array.from(document.querySelectorAll('link')).find((e) => !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl));
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
const newPath = `${base}${searchUrl.slice(1)}${searchUrl.includes('?') ? '&' : '?'}t=${timestamp}`;
|
||||
// rather than swapping the href on the existing tag, we will
|
||||
// create a new link tag. Once the new stylesheet has loaded we
|
||||
// will remove the existing link tag. This removes a Flash Of
|
||||
// Unstyled Content that can occur when swapping out the tag href
|
||||
// directly, as the new stylesheet has not yet been loaded.
|
||||
return new Promise((resolve) => {
|
||||
const newLinkTag = el.cloneNode();
|
||||
newLinkTag.href = new URL(newPath, el.href).href;
|
||||
const removeOldEl = () => {
|
||||
el.remove();
|
||||
console.debug(`[vite] css hot updated: ${searchUrl}`);
|
||||
resolve();
|
||||
};
|
||||
newLinkTag.addEventListener('load', removeOldEl);
|
||||
newLinkTag.addEventListener('error', removeOldEl);
|
||||
outdatedLinkTags.add(el);
|
||||
el.after(newLinkTag);
|
||||
});
|
||||
}));
|
||||
notifyListeners('vite:afterUpdate', payload);
|
||||
break;
|
||||
case 'custom': {
|
||||
notifyListeners(payload.event, payload.data);
|
||||
break;
|
||||
}
|
||||
case 'full-reload':
|
||||
notifyListeners('vite:beforeFullReload', payload);
|
||||
if (payload.path && payload.path.endsWith('.html')) {
|
||||
// if html file is edited, only reload the page if the browser is
|
||||
// currently on that page.
|
||||
const pagePath = decodeURI(location.pathname);
|
||||
const payloadPath = base + payload.path.slice(1);
|
||||
if (pagePath === payloadPath ||
|
||||
payload.path === '/index.html' ||
|
||||
(pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)) {
|
||||
pageReload();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
pageReload();
|
||||
}
|
||||
break;
|
||||
case 'prune':
|
||||
notifyListeners('vite:beforePrune', payload);
|
||||
// After an HMR update, some modules are no longer imported on the page
|
||||
// but they may have left behind side effects that need to be cleaned up
|
||||
// (.e.g style injections)
|
||||
// TODO Trigger their dispose callbacks.
|
||||
payload.paths.forEach((path) => {
|
||||
const fn = pruneMap.get(path);
|
||||
if (fn) {
|
||||
fn(dataMap.get(path));
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'error': {
|
||||
notifyListeners('vite:error', payload);
|
||||
const err = payload.err;
|
||||
if (enableOverlay) {
|
||||
createErrorOverlay(err);
|
||||
}
|
||||
else {
|
||||
console.error(`[vite] Internal Server Error\n${err.message}\n${err.stack}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const check = payload;
|
||||
return check;
|
||||
}
|
||||
}
|
||||
}
|
||||
function notifyListeners(event, data) {
|
||||
const cbs = customListenersMap.get(event);
|
||||
if (cbs) {
|
||||
cbs.forEach((cb) => cb(data));
|
||||
}
|
||||
}
|
||||
const enableOverlay = __HMR_ENABLE_OVERLAY__;
|
||||
function createErrorOverlay(err) {
|
||||
if (!enableOverlay)
|
||||
return;
|
||||
clearErrorOverlay();
|
||||
document.body.appendChild(new ErrorOverlay(err));
|
||||
}
|
||||
function clearErrorOverlay() {
|
||||
document
|
||||
.querySelectorAll(overlayId)
|
||||
.forEach((n) => n.close());
|
||||
}
|
||||
function hasErrorOverlay() {
|
||||
return document.querySelectorAll(overlayId).length;
|
||||
}
|
||||
let pending = false;
|
||||
let queued = [];
|
||||
/**
|
||||
* buffer multiple hot updates triggered by the same src change
|
||||
* so that they are invoked in the same order they were sent.
|
||||
* (otherwise the order may be inconsistent because of the http request round trip)
|
||||
*/
|
||||
async function queueUpdate(p) {
|
||||
queued.push(p);
|
||||
if (!pending) {
|
||||
pending = true;
|
||||
await Promise.resolve();
|
||||
pending = false;
|
||||
const loading = [...queued];
|
||||
queued = [];
|
||||
(await Promise.all(loading)).forEach((fn) => fn && fn());
|
||||
}
|
||||
}
|
||||
async function waitForSuccessfulPing(socketProtocol, hostAndPath, ms = 1000) {
|
||||
const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http';
|
||||
const ping = async () => {
|
||||
// A fetch on a websocket URL will return a successful promise with status 400,
|
||||
// but will reject a networking error.
|
||||
// When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors
|
||||
try {
|
||||
await fetch(`${pingHostProtocol}://${hostAndPath}`, {
|
||||
mode: 'no-cors',
|
||||
headers: {
|
||||
// Custom headers won't be included in a request with no-cors so (ab)use one of the
|
||||
// safelisted headers to identify the ping request
|
||||
Accept: 'text/x-vite-ping',
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
return false;
|
||||
};
|
||||
if (await ping()) {
|
||||
return;
|
||||
}
|
||||
await wait(ms);
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
if (document.visibilityState === 'visible') {
|
||||
if (await ping()) {
|
||||
break;
|
||||
}
|
||||
await wait(ms);
|
||||
}
|
||||
else {
|
||||
await waitForWindowShow();
|
||||
}
|
||||
}
|
||||
}
|
||||
function wait(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
function waitForWindowShow() {
|
||||
return new Promise((resolve) => {
|
||||
const onChange = async () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
resolve();
|
||||
document.removeEventListener('visibilitychange', onChange);
|
||||
}
|
||||
};
|
||||
document.addEventListener('visibilitychange', onChange);
|
||||
});
|
||||
}
|
||||
const sheetsMap = new Map();
|
||||
// collect existing style elements that may have been inserted during SSR
|
||||
// to avoid FOUC or duplicate styles
|
||||
if ('document' in globalThis) {
|
||||
document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {
|
||||
sheetsMap.set(el.getAttribute('data-vite-dev-id'), el);
|
||||
});
|
||||
}
|
||||
// all css imports should be inserted at the same position
|
||||
// because after build it will be a single css file
|
||||
let lastInsertedStyle;
|
||||
function updateStyle(id, content) {
|
||||
let style = sheetsMap.get(id);
|
||||
if (!style) {
|
||||
style = document.createElement('style');
|
||||
style.setAttribute('type', 'text/css');
|
||||
style.setAttribute('data-vite-dev-id', id);
|
||||
style.textContent = content;
|
||||
if (!lastInsertedStyle) {
|
||||
document.head.appendChild(style);
|
||||
// reset lastInsertedStyle after async
|
||||
// because dynamically imported css will be splitted into a different file
|
||||
setTimeout(() => {
|
||||
lastInsertedStyle = undefined;
|
||||
}, 0);
|
||||
}
|
||||
else {
|
||||
lastInsertedStyle.insertAdjacentElement('afterend', style);
|
||||
}
|
||||
lastInsertedStyle = style;
|
||||
}
|
||||
else {
|
||||
style.textContent = content;
|
||||
}
|
||||
sheetsMap.set(id, style);
|
||||
}
|
||||
function removeStyle(id) {
|
||||
const style = sheetsMap.get(id);
|
||||
if (style) {
|
||||
document.head.removeChild(style);
|
||||
sheetsMap.delete(id);
|
||||
}
|
||||
}
|
||||
async function fetchUpdate({ path, acceptedPath, timestamp, explicitImportRequired, }) {
|
||||
const mod = hotModulesMap.get(path);
|
||||
if (!mod) {
|
||||
// In a code-splitting project,
|
||||
// it is common that the hot-updating module is not loaded yet.
|
||||
// https://github.com/vitejs/vite/issues/721
|
||||
return;
|
||||
}
|
||||
let fetchedModule;
|
||||
const isSelfUpdate = path === acceptedPath;
|
||||
// determine the qualified callbacks before we re-import the modules
|
||||
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
|
||||
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
||||
const disposer = disposeMap.get(acceptedPath);
|
||||
if (disposer)
|
||||
await disposer(dataMap.get(acceptedPath));
|
||||
const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
|
||||
try {
|
||||
fetchedModule = await import(
|
||||
/* @vite-ignore */
|
||||
base +
|
||||
acceptedPathWithoutQuery.slice(1) +
|
||||
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${query ? `&${query}` : ''}`);
|
||||
}
|
||||
catch (e) {
|
||||
warnFailedFetch(e, acceptedPath);
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
for (const { deps, fn } of qualifiedCallbacks) {
|
||||
fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)));
|
||||
}
|
||||
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
||||
console.debug(`[vite] hot updated: ${loggedPath}`);
|
||||
};
|
||||
}
|
||||
function sendMessageBuffer() {
|
||||
if (socket.readyState === 1) {
|
||||
messageBuffer.forEach((msg) => socket.send(msg));
|
||||
messageBuffer.length = 0;
|
||||
}
|
||||
}
|
||||
const hotModulesMap = new Map();
|
||||
const disposeMap = new Map();
|
||||
const pruneMap = new Map();
|
||||
const dataMap = new Map();
|
||||
const customListenersMap = new Map();
|
||||
const ctxToListenersMap = new Map();
|
||||
function createHotContext(ownerPath) {
|
||||
if (!dataMap.has(ownerPath)) {
|
||||
dataMap.set(ownerPath, {});
|
||||
}
|
||||
// when a file is hot updated, a new context is created
|
||||
// clear its stale callbacks
|
||||
const mod = hotModulesMap.get(ownerPath);
|
||||
if (mod) {
|
||||
mod.callbacks = [];
|
||||
}
|
||||
// clear stale custom event listeners
|
||||
const staleListeners = ctxToListenersMap.get(ownerPath);
|
||||
if (staleListeners) {
|
||||
for (const [event, staleFns] of staleListeners) {
|
||||
const listeners = customListenersMap.get(event);
|
||||
if (listeners) {
|
||||
customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
|
||||
}
|
||||
}
|
||||
}
|
||||
const newListeners = new Map();
|
||||
ctxToListenersMap.set(ownerPath, newListeners);
|
||||
function acceptDeps(deps, callback = () => { }) {
|
||||
const mod = hotModulesMap.get(ownerPath) || {
|
||||
id: ownerPath,
|
||||
callbacks: [],
|
||||
};
|
||||
mod.callbacks.push({
|
||||
deps,
|
||||
fn: callback,
|
||||
});
|
||||
hotModulesMap.set(ownerPath, mod);
|
||||
}
|
||||
const hot = {
|
||||
get data() {
|
||||
return dataMap.get(ownerPath);
|
||||
},
|
||||
accept(deps, callback) {
|
||||
if (typeof deps === 'function' || !deps) {
|
||||
// self-accept: hot.accept(() => {})
|
||||
acceptDeps([ownerPath], ([mod]) => deps === null || deps === void 0 ? void 0 : deps(mod));
|
||||
}
|
||||
else if (typeof deps === 'string') {
|
||||
// explicit deps
|
||||
acceptDeps([deps], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
|
||||
}
|
||||
else if (Array.isArray(deps)) {
|
||||
acceptDeps(deps, callback);
|
||||
}
|
||||
else {
|
||||
throw new Error(`invalid hot.accept() usage.`);
|
||||
}
|
||||
},
|
||||
// export names (first arg) are irrelevant on the client side, they're
|
||||
// extracted in the server for propagation
|
||||
acceptExports(_, callback) {
|
||||
acceptDeps([ownerPath], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
|
||||
},
|
||||
dispose(cb) {
|
||||
disposeMap.set(ownerPath, cb);
|
||||
},
|
||||
prune(cb) {
|
||||
pruneMap.set(ownerPath, cb);
|
||||
},
|
||||
// Kept for backward compatibility (#11036)
|
||||
// @ts-expect-error untyped
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
decline() { },
|
||||
// tell the server to re-perform hmr propagation from this module as root
|
||||
invalidate(message) {
|
||||
notifyListeners('vite:invalidate', { path: ownerPath, message });
|
||||
this.send('vite:invalidate', { path: ownerPath, message });
|
||||
console.debug(`[vite] invalidate ${ownerPath}${message ? `: ${message}` : ''}`);
|
||||
},
|
||||
// custom events
|
||||
on(event, cb) {
|
||||
const addToMap = (map) => {
|
||||
const existing = map.get(event) || [];
|
||||
existing.push(cb);
|
||||
map.set(event, existing);
|
||||
};
|
||||
addToMap(customListenersMap);
|
||||
addToMap(newListeners);
|
||||
},
|
||||
send(event, data) {
|
||||
messageBuffer.push(JSON.stringify({ type: 'custom', event, data }));
|
||||
sendMessageBuffer();
|
||||
},
|
||||
};
|
||||
return hot;
|
||||
}
|
||||
/**
|
||||
* urls here are dynamic import() urls that couldn't be statically analyzed
|
||||
*/
|
||||
function injectQuery(url, queryToInject) {
|
||||
// skip urls that won't be handled by vite
|
||||
if (url[0] !== '.' && url[0] !== '/') {
|
||||
return url;
|
||||
}
|
||||
// can't use pathname from URL since it may be relative like ../
|
||||
const pathname = url.replace(/#.*$/, '').replace(/\?.*$/, '');
|
||||
const { search, hash } = new URL(url, 'http://vitejs.dev');
|
||||
return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${hash || ''}`;
|
||||
}
|
||||
|
||||
export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
|
||||
//# sourceMappingURL=client.mjs.map
|
||||
1
node_modules/vite/dist/client/client.mjs.map
generated
vendored
Normal file
1
node_modules/vite/dist/client/client.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
30
node_modules/vite/dist/client/env.mjs
generated
vendored
Normal file
30
node_modules/vite/dist/client/env.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const context = (() => {
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
return globalThis;
|
||||
}
|
||||
else if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
}
|
||||
else if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
else {
|
||||
return Function('return this')();
|
||||
}
|
||||
})();
|
||||
// assign defines
|
||||
const defines = __DEFINES__;
|
||||
Object.keys(defines).forEach((key) => {
|
||||
const segments = key.split('.');
|
||||
let target = context;
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
const segment = segments[i];
|
||||
if (i === segments.length - 1) {
|
||||
target[segment] = defines[key];
|
||||
}
|
||||
else {
|
||||
target = target[segment] || (target[segment] = {});
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=env.mjs.map
|
||||
1
node_modules/vite/dist/client/env.mjs.map
generated
vendored
Normal file
1
node_modules/vite/dist/client/env.mjs.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"env.mjs","sources":["env.ts"],"sourcesContent":["declare const __MODE__: string\ndeclare const __DEFINES__: Record<string, any>\n\nconst context = (() => {\n if (typeof globalThis !== 'undefined') {\n return globalThis\n } else if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else {\n return Function('return this')()\n }\n})()\n\n// assign defines\nconst defines = __DEFINES__\nObject.keys(defines).forEach((key) => {\n const segments = key.split('.')\n let target = context\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i]\n if (i === segments.length - 1) {\n target[segment] = defines[key]\n } else {\n target = target[segment] || (target[segment] = {})\n }\n }\n})\n"],"names":[],"mappings":"AAGA,MAAM,OAAO,GAAG,CAAC,MAAK;AACpB,IAAA,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;AACrC,QAAA,OAAO,UAAU,CAAA;AAClB,KAAA;AAAM,SAAA,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;AACtC,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAAM,SAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACxC,QAAA,OAAO,MAAM,CAAA;AACd,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAA;AACjC,KAAA;AACH,CAAC,GAAG,CAAA;AAEJ;AACA,MAAM,OAAO,GAAG,WAAW,CAAA;AAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;IACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,MAAM,GAAG,OAAO,CAAA;AACpB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACxC,QAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;AAC3B,QAAA,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;AAC/B,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;AACnD,SAAA;AACF,KAAA;AACH,CAAC,CAAC","x_google_ignoreList":[0]}
|
||||
4509
node_modules/vite/dist/node-cjs/publicUtils.cjs
generated
vendored
Normal file
4509
node_modules/vite/dist/node-cjs/publicUtils.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
7621
node_modules/vite/dist/node/chunks/dep-11aba5f5.js
generated
vendored
Normal file
7621
node_modules/vite/dist/node/chunks/dep-11aba5f5.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
914
node_modules/vite/dist/node/chunks/dep-220a20f7.js
generated
vendored
Normal file
914
node_modules/vite/dist/node/chunks/dep-220a20f7.js
generated
vendored
Normal file
|
|
@ -0,0 +1,914 @@
|
|||
import { E as getDefaultExportFromCjs } from './dep-abb4f102.js';
|
||||
import require$$0 from 'path';
|
||||
import require$$0__default from 'fs';
|
||||
import { l as lib } from './dep-c423598f.js';
|
||||
|
||||
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
||||
import { dirname as __cjs_dirname } from 'node:path';
|
||||
import { createRequire as __cjs_createRequire } from 'node:module';
|
||||
|
||||
const __filename = __cjs_fileURLToPath(import.meta.url);
|
||||
const __dirname = __cjs_dirname(__filename);
|
||||
const require = __cjs_createRequire(import.meta.url);
|
||||
const __require = require;
|
||||
function _mergeNamespaces(n, m) {
|
||||
for (var i = 0; i < m.length; i++) {
|
||||
var e = m[i];
|
||||
if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
|
||||
if (k !== 'default' && !(k in n)) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
} }
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i;
|
||||
|
||||
var joinMedia$1 = function (parentMedia, childMedia) {
|
||||
if (!parentMedia.length && childMedia.length) return childMedia
|
||||
if (parentMedia.length && !childMedia.length) return parentMedia
|
||||
if (!parentMedia.length && !childMedia.length) return []
|
||||
|
||||
const media = [];
|
||||
|
||||
parentMedia.forEach(parentItem => {
|
||||
const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem);
|
||||
|
||||
childMedia.forEach(childItem => {
|
||||
const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem);
|
||||
if (parentItem !== childItem) {
|
||||
if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) {
|
||||
media.push(`${childItem} and ${parentItem}`);
|
||||
} else {
|
||||
media.push(`${parentItem} and ${childItem}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return media
|
||||
};
|
||||
|
||||
var joinLayer$1 = function (parentLayer, childLayer) {
|
||||
if (!parentLayer.length && childLayer.length) return childLayer
|
||||
if (parentLayer.length && !childLayer.length) return parentLayer
|
||||
if (!parentLayer.length && !childLayer.length) return []
|
||||
|
||||
return parentLayer.concat(childLayer)
|
||||
};
|
||||
|
||||
var readCache$1 = {exports: {}};
|
||||
|
||||
var pify$2 = {exports: {}};
|
||||
|
||||
var processFn = function (fn, P, opts) {
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = new Array(arguments.length);
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
return new P(function (resolve, reject) {
|
||||
args.push(function (err, result) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else if (opts.multiArgs) {
|
||||
var results = new Array(arguments.length - 1);
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
results[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
resolve(results);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
fn.apply(that, args);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var pify$1 = pify$2.exports = function (obj, P, opts) {
|
||||
if (typeof P !== 'function') {
|
||||
opts = P;
|
||||
P = Promise;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
opts.exclude = opts.exclude || [/.+Sync$/];
|
||||
|
||||
var filter = function (key) {
|
||||
var match = function (pattern) {
|
||||
return typeof pattern === 'string' ? key === pattern : pattern.test(key);
|
||||
};
|
||||
|
||||
return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
|
||||
};
|
||||
|
||||
var ret = typeof obj === 'function' ? function () {
|
||||
if (opts.excludeMain) {
|
||||
return obj.apply(this, arguments);
|
||||
}
|
||||
|
||||
return processFn(obj, P, opts).apply(this, arguments);
|
||||
} : {};
|
||||
|
||||
return Object.keys(obj).reduce(function (ret, key) {
|
||||
var x = obj[key];
|
||||
|
||||
ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
|
||||
|
||||
return ret;
|
||||
}, ret);
|
||||
};
|
||||
|
||||
pify$1.all = pify$1;
|
||||
|
||||
var pifyExports = pify$2.exports;
|
||||
|
||||
var fs = require$$0__default;
|
||||
var path$2 = require$$0;
|
||||
var pify = pifyExports;
|
||||
|
||||
var stat = pify(fs.stat);
|
||||
var readFile = pify(fs.readFile);
|
||||
var resolve = path$2.resolve;
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
function convert(content, encoding) {
|
||||
if (Buffer.isEncoding(encoding)) {
|
||||
return content.toString(encoding);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
readCache$1.exports = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
return stat(path).then(function (stats) {
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
return readFile(path).then(function (data) {
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
});
|
||||
}).catch(function (err) {
|
||||
cache[path] = null;
|
||||
return Promise.reject(err);
|
||||
});
|
||||
};
|
||||
|
||||
readCache$1.exports.sync = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
|
||||
try {
|
||||
var stats = fs.statSync(path);
|
||||
var item = cache[path];
|
||||
|
||||
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
||||
return convert(item.content, encoding);
|
||||
}
|
||||
|
||||
var data = fs.readFileSync(path);
|
||||
|
||||
cache[path] = {
|
||||
mtime: stats.mtime,
|
||||
content: data
|
||||
};
|
||||
|
||||
return convert(data, encoding);
|
||||
} catch (err) {
|
||||
cache[path] = null;
|
||||
throw err;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
readCache$1.exports.get = function (path, encoding) {
|
||||
path = resolve(path);
|
||||
if (cache[path]) {
|
||||
return convert(cache[path].content, encoding);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
readCache$1.exports.clear = function () {
|
||||
cache = Object.create(null);
|
||||
};
|
||||
|
||||
var readCacheExports = readCache$1.exports;
|
||||
|
||||
const dataURLRegexp = /^data:text\/css;base64,/i;
|
||||
|
||||
function isValid(url) {
|
||||
return dataURLRegexp.test(url)
|
||||
}
|
||||
|
||||
function contents(url) {
|
||||
// "data:text/css;base64,".length === 21
|
||||
return Buffer.from(url.slice(21), "base64").toString()
|
||||
}
|
||||
|
||||
var dataUrl = {
|
||||
isValid,
|
||||
contents,
|
||||
};
|
||||
|
||||
const readCache = readCacheExports;
|
||||
const dataURL$1 = dataUrl;
|
||||
|
||||
var loadContent$1 = filename => {
|
||||
if (dataURL$1.isValid(filename)) {
|
||||
return dataURL$1.contents(filename)
|
||||
}
|
||||
|
||||
return readCache(filename, "utf-8")
|
||||
};
|
||||
|
||||
// builtin tooling
|
||||
const path$1 = require$$0;
|
||||
|
||||
// placeholder tooling
|
||||
let sugarss;
|
||||
|
||||
var processContent$1 = function processContent(
|
||||
result,
|
||||
content,
|
||||
filename,
|
||||
options,
|
||||
postcss
|
||||
) {
|
||||
const { plugins } = options;
|
||||
const ext = path$1.extname(filename);
|
||||
|
||||
const parserList = [];
|
||||
|
||||
// SugarSS support:
|
||||
if (ext === ".sss") {
|
||||
if (!sugarss) {
|
||||
try {
|
||||
sugarss = __require('sugarss');
|
||||
} catch {} // Ignore
|
||||
}
|
||||
if (sugarss)
|
||||
return runPostcss(postcss, content, filename, plugins, [sugarss])
|
||||
}
|
||||
|
||||
// Syntax support:
|
||||
if (result.opts.syntax?.parse) {
|
||||
parserList.push(result.opts.syntax.parse);
|
||||
}
|
||||
|
||||
// Parser support:
|
||||
if (result.opts.parser) parserList.push(result.opts.parser);
|
||||
// Try the default as a last resort:
|
||||
parserList.push(null);
|
||||
|
||||
return runPostcss(postcss, content, filename, plugins, parserList)
|
||||
};
|
||||
|
||||
function runPostcss(postcss, content, filename, plugins, parsers, index) {
|
||||
if (!index) index = 0;
|
||||
return postcss(plugins)
|
||||
.process(content, {
|
||||
from: filename,
|
||||
parser: parsers[index],
|
||||
})
|
||||
.catch(err => {
|
||||
// If there's an error, try the next parser
|
||||
index++;
|
||||
// If there are no parsers left, throw it
|
||||
if (index === parsers.length) throw err
|
||||
return runPostcss(postcss, content, filename, plugins, parsers, index)
|
||||
})
|
||||
}
|
||||
|
||||
// external tooling
|
||||
const valueParser = lib;
|
||||
|
||||
// extended tooling
|
||||
const { stringify } = valueParser;
|
||||
|
||||
function split(params, start) {
|
||||
const list = [];
|
||||
const last = params.reduce((item, node, index) => {
|
||||
if (index < start) return ""
|
||||
if (node.type === "div" && node.value === ",") {
|
||||
list.push(item);
|
||||
return ""
|
||||
}
|
||||
return item + stringify(node)
|
||||
}, "");
|
||||
list.push(last);
|
||||
return list
|
||||
}
|
||||
|
||||
var parseStatements$1 = function (result, styles) {
|
||||
const statements = [];
|
||||
let nodes = [];
|
||||
|
||||
styles.each(node => {
|
||||
let stmt;
|
||||
if (node.type === "atrule") {
|
||||
if (node.name === "import") stmt = parseImport(result, node);
|
||||
else if (node.name === "media") stmt = parseMedia(result, node);
|
||||
else if (node.name === "charset") stmt = parseCharset(result, node);
|
||||
}
|
||||
|
||||
if (stmt) {
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
media: [],
|
||||
layer: [],
|
||||
});
|
||||
nodes = [];
|
||||
}
|
||||
statements.push(stmt);
|
||||
} else nodes.push(node);
|
||||
});
|
||||
|
||||
if (nodes.length) {
|
||||
statements.push({
|
||||
type: "nodes",
|
||||
nodes,
|
||||
media: [],
|
||||
layer: [],
|
||||
});
|
||||
}
|
||||
|
||||
return statements
|
||||
};
|
||||
|
||||
function parseMedia(result, atRule) {
|
||||
const params = valueParser(atRule.params).nodes;
|
||||
return {
|
||||
type: "media",
|
||||
node: atRule,
|
||||
media: split(params, 0),
|
||||
layer: [],
|
||||
}
|
||||
}
|
||||
|
||||
function parseCharset(result, atRule) {
|
||||
if (atRule.prev()) {
|
||||
return result.warn("@charset must precede all other statements", {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
return {
|
||||
type: "charset",
|
||||
node: atRule,
|
||||
media: [],
|
||||
layer: [],
|
||||
}
|
||||
}
|
||||
|
||||
function parseImport(result, atRule) {
|
||||
let prev = atRule.prev();
|
||||
if (prev) {
|
||||
do {
|
||||
if (
|
||||
prev.type !== "comment" &&
|
||||
(prev.type !== "atrule" ||
|
||||
(prev.name !== "import" &&
|
||||
prev.name !== "charset" &&
|
||||
!(prev.name === "layer" && !prev.nodes)))
|
||||
) {
|
||||
return result.warn(
|
||||
"@import must precede all other statements (besides @charset or empty @layer)",
|
||||
{ node: atRule }
|
||||
)
|
||||
}
|
||||
prev = prev.prev();
|
||||
} while (prev)
|
||||
}
|
||||
|
||||
if (atRule.nodes) {
|
||||
return result.warn(
|
||||
"It looks like you didn't end your @import statement correctly. " +
|
||||
"Child nodes are attached to it.",
|
||||
{ node: atRule }
|
||||
)
|
||||
}
|
||||
|
||||
const params = valueParser(atRule.params).nodes;
|
||||
const stmt = {
|
||||
type: "import",
|
||||
node: atRule,
|
||||
media: [],
|
||||
layer: [],
|
||||
};
|
||||
|
||||
// prettier-ignore
|
||||
if (
|
||||
!params.length ||
|
||||
(
|
||||
params[0].type !== "string" ||
|
||||
!params[0].value
|
||||
) &&
|
||||
(
|
||||
params[0].type !== "function" ||
|
||||
params[0].value !== "url" ||
|
||||
!params[0].nodes.length ||
|
||||
!params[0].nodes[0].value
|
||||
)
|
||||
) {
|
||||
return result.warn(`Unable to find uri in '${ atRule.toString() }'`, {
|
||||
node: atRule,
|
||||
})
|
||||
}
|
||||
|
||||
if (params[0].type === "string") stmt.uri = params[0].value;
|
||||
else stmt.uri = params[0].nodes[0].value;
|
||||
stmt.fullUri = stringify(params[0]);
|
||||
|
||||
let remainder = params;
|
||||
if (remainder.length > 2) {
|
||||
if (
|
||||
(remainder[2].type === "word" || remainder[2].type === "function") &&
|
||||
remainder[2].value === "layer"
|
||||
) {
|
||||
if (remainder[1].type !== "space") {
|
||||
return result.warn("Invalid import layer statement", { node: atRule })
|
||||
}
|
||||
|
||||
if (remainder[2].nodes) {
|
||||
stmt.layer = [stringify(remainder[2].nodes)];
|
||||
} else {
|
||||
stmt.layer = [""];
|
||||
}
|
||||
remainder = remainder.slice(2);
|
||||
}
|
||||
}
|
||||
|
||||
if (remainder.length > 2) {
|
||||
if (remainder[1].type !== "space") {
|
||||
return result.warn("Invalid import media statement", { node: atRule })
|
||||
}
|
||||
|
||||
stmt.media = split(remainder, 2);
|
||||
}
|
||||
|
||||
return stmt
|
||||
}
|
||||
|
||||
var assignLayerNames$1 = function (layer, node, state, options) {
|
||||
layer.forEach((layerPart, i) => {
|
||||
if (layerPart.trim() === "") {
|
||||
if (options.nameLayer) {
|
||||
layer[i] = options
|
||||
.nameLayer(state.anonymousLayerCounter++, state.rootFilename)
|
||||
.toString();
|
||||
} else {
|
||||
throw node.error(
|
||||
`When using anonymous layers in @import you must also set the "nameLayer" plugin option`
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// builtin tooling
|
||||
const path = require$$0;
|
||||
|
||||
// internal tooling
|
||||
const joinMedia = joinMedia$1;
|
||||
const joinLayer = joinLayer$1;
|
||||
const resolveId = (id) => id;
|
||||
const loadContent = loadContent$1;
|
||||
const processContent = processContent$1;
|
||||
const parseStatements = parseStatements$1;
|
||||
const assignLayerNames = assignLayerNames$1;
|
||||
const dataURL = dataUrl;
|
||||
|
||||
function AtImport(options) {
|
||||
options = {
|
||||
root: process.cwd(),
|
||||
path: [],
|
||||
skipDuplicates: true,
|
||||
resolve: resolveId,
|
||||
load: loadContent,
|
||||
plugins: [],
|
||||
addModulesDirectories: [],
|
||||
nameLayer: null,
|
||||
...options,
|
||||
};
|
||||
|
||||
options.root = path.resolve(options.root);
|
||||
|
||||
// convert string to an array of a single element
|
||||
if (typeof options.path === "string") options.path = [options.path];
|
||||
|
||||
if (!Array.isArray(options.path)) options.path = [];
|
||||
|
||||
options.path = options.path.map(p => path.resolve(options.root, p));
|
||||
|
||||
return {
|
||||
postcssPlugin: "postcss-import",
|
||||
Once(styles, { result, atRule, postcss }) {
|
||||
const state = {
|
||||
importedFiles: {},
|
||||
hashFiles: {},
|
||||
rootFilename: null,
|
||||
anonymousLayerCounter: 0,
|
||||
};
|
||||
|
||||
if (styles.source?.input?.file) {
|
||||
state.rootFilename = styles.source.input.file;
|
||||
state.importedFiles[styles.source.input.file] = {};
|
||||
}
|
||||
|
||||
if (options.plugins && !Array.isArray(options.plugins)) {
|
||||
throw new Error("plugins option must be an array")
|
||||
}
|
||||
|
||||
if (options.nameLayer && typeof options.nameLayer !== "function") {
|
||||
throw new Error("nameLayer option must be a function")
|
||||
}
|
||||
|
||||
return parseStyles(result, styles, options, state, [], []).then(
|
||||
bundle => {
|
||||
applyRaws(bundle);
|
||||
applyMedia(bundle);
|
||||
applyStyles(bundle, styles);
|
||||
}
|
||||
)
|
||||
|
||||
function applyRaws(bundle) {
|
||||
bundle.forEach((stmt, index) => {
|
||||
if (index === 0) return
|
||||
|
||||
if (stmt.parent) {
|
||||
const { before } = stmt.parent.node.raws;
|
||||
if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
|
||||
else stmt.node.raws.before = before;
|
||||
} else if (stmt.type === "nodes") {
|
||||
stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyMedia(bundle) {
|
||||
bundle.forEach(stmt => {
|
||||
if (
|
||||
(!stmt.media.length && !stmt.layer.length) ||
|
||||
stmt.type === "charset"
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
if (stmt.layer.length > 1) {
|
||||
assignLayerNames(stmt.layer, stmt.node, state, options);
|
||||
}
|
||||
|
||||
if (stmt.type === "import") {
|
||||
const parts = [stmt.fullUri];
|
||||
|
||||
const media = stmt.media.join(", ");
|
||||
|
||||
if (stmt.layer.length) {
|
||||
const layerName = stmt.layer.join(".");
|
||||
|
||||
let layerParams = "layer";
|
||||
if (layerName) {
|
||||
layerParams = `layer(${layerName})`;
|
||||
}
|
||||
|
||||
parts.push(layerParams);
|
||||
}
|
||||
|
||||
if (media) {
|
||||
parts.push(media);
|
||||
}
|
||||
|
||||
stmt.node.params = parts.join(" ");
|
||||
} else if (stmt.type === "media") {
|
||||
if (stmt.layer.length) {
|
||||
const layerNode = atRule({
|
||||
name: "layer",
|
||||
params: stmt.layer.join("."),
|
||||
source: stmt.node.source,
|
||||
});
|
||||
|
||||
if (stmt.parentMedia?.length) {
|
||||
const mediaNode = atRule({
|
||||
name: "media",
|
||||
params: stmt.parentMedia.join(", "),
|
||||
source: stmt.node.source,
|
||||
});
|
||||
|
||||
mediaNode.append(layerNode);
|
||||
layerNode.append(stmt.node);
|
||||
stmt.node = mediaNode;
|
||||
} else {
|
||||
layerNode.append(stmt.node);
|
||||
stmt.node = layerNode;
|
||||
}
|
||||
} else {
|
||||
stmt.node.params = stmt.media.join(", ");
|
||||
}
|
||||
} else {
|
||||
const { nodes } = stmt;
|
||||
const { parent } = nodes[0];
|
||||
|
||||
let outerAtRule;
|
||||
let innerAtRule;
|
||||
if (stmt.media.length && stmt.layer.length) {
|
||||
const mediaNode = atRule({
|
||||
name: "media",
|
||||
params: stmt.media.join(", "),
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
const layerNode = atRule({
|
||||
name: "layer",
|
||||
params: stmt.layer.join("."),
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
mediaNode.append(layerNode);
|
||||
innerAtRule = layerNode;
|
||||
outerAtRule = mediaNode;
|
||||
} else if (stmt.media.length) {
|
||||
const mediaNode = atRule({
|
||||
name: "media",
|
||||
params: stmt.media.join(", "),
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
innerAtRule = mediaNode;
|
||||
outerAtRule = mediaNode;
|
||||
} else if (stmt.layer.length) {
|
||||
const layerNode = atRule({
|
||||
name: "layer",
|
||||
params: stmt.layer.join("."),
|
||||
source: parent.source,
|
||||
});
|
||||
|
||||
innerAtRule = layerNode;
|
||||
outerAtRule = layerNode;
|
||||
}
|
||||
|
||||
parent.insertBefore(nodes[0], outerAtRule);
|
||||
|
||||
// remove nodes
|
||||
nodes.forEach(node => {
|
||||
node.parent = undefined;
|
||||
});
|
||||
|
||||
// better output
|
||||
nodes[0].raws.before = nodes[0].raws.before || "\n";
|
||||
|
||||
// wrap new rules with media query and/or layer at rule
|
||||
innerAtRule.append(nodes);
|
||||
|
||||
stmt.type = "media";
|
||||
stmt.node = outerAtRule;
|
||||
delete stmt.nodes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyStyles(bundle, styles) {
|
||||
styles.nodes = [];
|
||||
|
||||
// Strip additional statements.
|
||||
bundle.forEach(stmt => {
|
||||
if (["charset", "import", "media"].includes(stmt.type)) {
|
||||
stmt.node.parent = undefined;
|
||||
styles.append(stmt.node);
|
||||
} else if (stmt.type === "nodes") {
|
||||
stmt.nodes.forEach(node => {
|
||||
node.parent = undefined;
|
||||
styles.append(node);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function parseStyles(result, styles, options, state, media, layer) {
|
||||
const statements = parseStatements(result, styles);
|
||||
|
||||
return Promise.resolve(statements)
|
||||
.then(stmts => {
|
||||
// process each statement in series
|
||||
return stmts.reduce((promise, stmt) => {
|
||||
return promise.then(() => {
|
||||
stmt.media = joinMedia(media, stmt.media || []);
|
||||
stmt.parentMedia = media;
|
||||
stmt.layer = joinLayer(layer, stmt.layer || []);
|
||||
|
||||
// skip protocol base uri (protocol://url) or protocol-relative
|
||||
if (
|
||||
stmt.type !== "import" ||
|
||||
/^(?:[a-z]+:)?\/\//i.test(stmt.uri)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
if (options.filter && !options.filter(stmt.uri)) {
|
||||
// rejected by filter
|
||||
return
|
||||
}
|
||||
|
||||
return resolveImportId(result, stmt, options, state)
|
||||
})
|
||||
}, Promise.resolve())
|
||||
})
|
||||
.then(() => {
|
||||
let charset;
|
||||
const imports = [];
|
||||
const bundle = [];
|
||||
|
||||
function handleCharset(stmt) {
|
||||
if (!charset) charset = stmt;
|
||||
// charsets aren't case-sensitive, so convert to lower case to compare
|
||||
else if (
|
||||
stmt.node.params.toLowerCase() !==
|
||||
charset.node.params.toLowerCase()
|
||||
) {
|
||||
throw new Error(
|
||||
`Incompatable @charset statements:
|
||||
${stmt.node.params} specified in ${stmt.node.source.input.file}
|
||||
${charset.node.params} specified in ${charset.node.source.input.file}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// squash statements and their children
|
||||
statements.forEach(stmt => {
|
||||
if (stmt.type === "charset") handleCharset(stmt);
|
||||
else if (stmt.type === "import") {
|
||||
if (stmt.children) {
|
||||
stmt.children.forEach((child, index) => {
|
||||
if (child.type === "import") imports.push(child);
|
||||
else if (child.type === "charset") handleCharset(child);
|
||||
else bundle.push(child);
|
||||
// For better output
|
||||
if (index === 0) child.parent = stmt;
|
||||
});
|
||||
} else imports.push(stmt);
|
||||
} else if (stmt.type === "media" || stmt.type === "nodes") {
|
||||
bundle.push(stmt);
|
||||
}
|
||||
});
|
||||
|
||||
return charset
|
||||
? [charset, ...imports.concat(bundle)]
|
||||
: imports.concat(bundle)
|
||||
})
|
||||
}
|
||||
|
||||
function resolveImportId(result, stmt, options, state) {
|
||||
if (dataURL.isValid(stmt.uri)) {
|
||||
return loadImportContent(result, stmt, stmt.uri, options, state).then(
|
||||
result => {
|
||||
stmt.children = result;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const atRule = stmt.node;
|
||||
let sourceFile;
|
||||
if (atRule.source?.input?.file) {
|
||||
sourceFile = atRule.source.input.file;
|
||||
}
|
||||
const base = sourceFile
|
||||
? path.dirname(atRule.source.input.file)
|
||||
: options.root;
|
||||
|
||||
return Promise.resolve(options.resolve(stmt.uri, base, options))
|
||||
.then(paths => {
|
||||
if (!Array.isArray(paths)) paths = [paths];
|
||||
// Ensure that each path is absolute:
|
||||
return Promise.all(
|
||||
paths.map(file => {
|
||||
return !path.isAbsolute(file)
|
||||
? resolveId(file)
|
||||
: file
|
||||
})
|
||||
)
|
||||
})
|
||||
.then(resolved => {
|
||||
// Add dependency messages:
|
||||
resolved.forEach(file => {
|
||||
result.messages.push({
|
||||
type: "dependency",
|
||||
plugin: "postcss-import",
|
||||
file,
|
||||
parent: sourceFile,
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all(
|
||||
resolved.map(file => {
|
||||
return loadImportContent(result, stmt, file, options, state)
|
||||
})
|
||||
)
|
||||
})
|
||||
.then(result => {
|
||||
// Merge loaded statements
|
||||
stmt.children = result.reduce((result, statements) => {
|
||||
return statements ? result.concat(statements) : result
|
||||
}, []);
|
||||
})
|
||||
}
|
||||
|
||||
function loadImportContent(result, stmt, filename, options, state) {
|
||||
const atRule = stmt.node;
|
||||
const { media, layer } = stmt;
|
||||
|
||||
assignLayerNames(layer, atRule, state, options);
|
||||
|
||||
if (options.skipDuplicates) {
|
||||
// skip files already imported at the same scope
|
||||
if (state.importedFiles[filename]?.[media]?.[layer]) {
|
||||
return
|
||||
}
|
||||
|
||||
// save imported files to skip them next time
|
||||
if (!state.importedFiles[filename]) {
|
||||
state.importedFiles[filename] = {};
|
||||
}
|
||||
if (!state.importedFiles[filename][media]) {
|
||||
state.importedFiles[filename][media] = {};
|
||||
}
|
||||
state.importedFiles[filename][media][layer] = true;
|
||||
}
|
||||
|
||||
return Promise.resolve(options.load(filename, options)).then(
|
||||
content => {
|
||||
if (content.trim() === "") {
|
||||
result.warn(`${filename} is empty`, { node: atRule });
|
||||
return
|
||||
}
|
||||
|
||||
// skip previous imported files not containing @import rules
|
||||
if (state.hashFiles[content]?.[media]?.[layer]) {
|
||||
return
|
||||
}
|
||||
|
||||
return processContent(
|
||||
result,
|
||||
content,
|
||||
filename,
|
||||
options,
|
||||
postcss
|
||||
).then(importedResult => {
|
||||
const styles = importedResult.root;
|
||||
result.messages = result.messages.concat(importedResult.messages);
|
||||
|
||||
if (options.skipDuplicates) {
|
||||
const hasImport = styles.some(child => {
|
||||
return child.type === "atrule" && child.name === "import"
|
||||
});
|
||||
if (!hasImport) {
|
||||
// save hash files to skip them next time
|
||||
if (!state.hashFiles[content]) {
|
||||
state.hashFiles[content] = {};
|
||||
}
|
||||
if (!state.hashFiles[content][media]) {
|
||||
state.hashFiles[content][media] = {};
|
||||
}
|
||||
state.hashFiles[content][media][layer] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// recursion: import @import from imported file
|
||||
return parseStyles(result, styles, options, state, media, layer)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
AtImport.postcss = true;
|
||||
|
||||
var postcssImport = AtImport;
|
||||
|
||||
var index = /*@__PURE__*/getDefaultExportFromCjs(postcssImport);
|
||||
|
||||
var index$1 = /*#__PURE__*/_mergeNamespaces({
|
||||
__proto__: null,
|
||||
default: index
|
||||
}, [postcssImport]);
|
||||
|
||||
export { index$1 as i };
|
||||
66184
node_modules/vite/dist/node/chunks/dep-abb4f102.js
generated
vendored
Normal file
66184
node_modules/vite/dist/node/chunks/dep-abb4f102.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
561
node_modules/vite/dist/node/chunks/dep-c423598f.js
generated
vendored
Normal file
561
node_modules/vite/dist/node/chunks/dep-c423598f.js
generated
vendored
Normal file
|
|
@ -0,0 +1,561 @@
|
|||
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
||||
import { dirname as __cjs_dirname } from 'node:path';
|
||||
import { createRequire as __cjs_createRequire } from 'node:module';
|
||||
|
||||
const __filename = __cjs_fileURLToPath(import.meta.url);
|
||||
const __dirname = __cjs_dirname(__filename);
|
||||
const require = __cjs_createRequire(import.meta.url);
|
||||
const __require = require;
|
||||
var openParentheses = "(".charCodeAt(0);
|
||||
var closeParentheses = ")".charCodeAt(0);
|
||||
var singleQuote = "'".charCodeAt(0);
|
||||
var doubleQuote = '"'.charCodeAt(0);
|
||||
var backslash = "\\".charCodeAt(0);
|
||||
var slash = "/".charCodeAt(0);
|
||||
var comma = ",".charCodeAt(0);
|
||||
var colon = ":".charCodeAt(0);
|
||||
var star = "*".charCodeAt(0);
|
||||
var uLower = "u".charCodeAt(0);
|
||||
var uUpper = "U".charCodeAt(0);
|
||||
var plus = "+".charCodeAt(0);
|
||||
var isUnicodeRange = /^[a-f0-9?-]+$/i;
|
||||
|
||||
var parse$1 = function(input) {
|
||||
var tokens = [];
|
||||
var value = input;
|
||||
|
||||
var next,
|
||||
quote,
|
||||
prev,
|
||||
token,
|
||||
escape,
|
||||
escapePos,
|
||||
whitespacePos,
|
||||
parenthesesOpenPos;
|
||||
var pos = 0;
|
||||
var code = value.charCodeAt(pos);
|
||||
var max = value.length;
|
||||
var stack = [{ nodes: tokens }];
|
||||
var balanced = 0;
|
||||
var parent;
|
||||
|
||||
var name = "";
|
||||
var before = "";
|
||||
var after = "";
|
||||
|
||||
while (pos < max) {
|
||||
// Whitespaces
|
||||
if (code <= 32) {
|
||||
next = pos;
|
||||
do {
|
||||
next += 1;
|
||||
code = value.charCodeAt(next);
|
||||
} while (code <= 32);
|
||||
token = value.slice(pos, next);
|
||||
|
||||
prev = tokens[tokens.length - 1];
|
||||
if (code === closeParentheses && balanced) {
|
||||
after = token;
|
||||
} else if (prev && prev.type === "div") {
|
||||
prev.after = token;
|
||||
prev.sourceEndIndex += token.length;
|
||||
} else if (
|
||||
code === comma ||
|
||||
code === colon ||
|
||||
(code === slash &&
|
||||
value.charCodeAt(next + 1) !== star &&
|
||||
(!parent ||
|
||||
(parent && parent.type === "function" && parent.value !== "calc")))
|
||||
) {
|
||||
before = token;
|
||||
} else {
|
||||
tokens.push({
|
||||
type: "space",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
}
|
||||
|
||||
pos = next;
|
||||
|
||||
// Quotes
|
||||
} else if (code === singleQuote || code === doubleQuote) {
|
||||
next = pos;
|
||||
quote = code === singleQuote ? "'" : '"';
|
||||
token = {
|
||||
type: "string",
|
||||
sourceIndex: pos,
|
||||
quote: quote
|
||||
};
|
||||
do {
|
||||
escape = false;
|
||||
next = value.indexOf(quote, next + 1);
|
||||
if (~next) {
|
||||
escapePos = next;
|
||||
while (value.charCodeAt(escapePos - 1) === backslash) {
|
||||
escapePos -= 1;
|
||||
escape = !escape;
|
||||
}
|
||||
} else {
|
||||
value += quote;
|
||||
next = value.length - 1;
|
||||
token.unclosed = true;
|
||||
}
|
||||
} while (escape);
|
||||
token.value = value.slice(pos + 1, next);
|
||||
token.sourceEndIndex = token.unclosed ? next : next + 1;
|
||||
tokens.push(token);
|
||||
pos = next + 1;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
// Comments
|
||||
} else if (code === slash && value.charCodeAt(pos + 1) === star) {
|
||||
next = value.indexOf("*/", pos);
|
||||
|
||||
token = {
|
||||
type: "comment",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next + 2
|
||||
};
|
||||
|
||||
if (next === -1) {
|
||||
token.unclosed = true;
|
||||
next = value.length;
|
||||
token.sourceEndIndex = next;
|
||||
}
|
||||
|
||||
token.value = value.slice(pos + 2, next);
|
||||
tokens.push(token);
|
||||
|
||||
pos = next + 2;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
// Operation within calc
|
||||
} else if (
|
||||
(code === slash || code === star) &&
|
||||
parent &&
|
||||
parent.type === "function" &&
|
||||
parent.value === "calc"
|
||||
) {
|
||||
token = value[pos];
|
||||
tokens.push({
|
||||
type: "word",
|
||||
sourceIndex: pos - before.length,
|
||||
sourceEndIndex: pos + token.length,
|
||||
value: token
|
||||
});
|
||||
pos += 1;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
// Dividers
|
||||
} else if (code === slash || code === comma || code === colon) {
|
||||
token = value[pos];
|
||||
|
||||
tokens.push({
|
||||
type: "div",
|
||||
sourceIndex: pos - before.length,
|
||||
sourceEndIndex: pos + token.length,
|
||||
value: token,
|
||||
before: before,
|
||||
after: ""
|
||||
});
|
||||
before = "";
|
||||
|
||||
pos += 1;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
// Open parentheses
|
||||
} else if (openParentheses === code) {
|
||||
// Whitespaces after open parentheses
|
||||
next = pos;
|
||||
do {
|
||||
next += 1;
|
||||
code = value.charCodeAt(next);
|
||||
} while (code <= 32);
|
||||
parenthesesOpenPos = pos;
|
||||
token = {
|
||||
type: "function",
|
||||
sourceIndex: pos - name.length,
|
||||
value: name,
|
||||
before: value.slice(parenthesesOpenPos + 1, next)
|
||||
};
|
||||
pos = next;
|
||||
|
||||
if (name === "url" && code !== singleQuote && code !== doubleQuote) {
|
||||
next -= 1;
|
||||
do {
|
||||
escape = false;
|
||||
next = value.indexOf(")", next + 1);
|
||||
if (~next) {
|
||||
escapePos = next;
|
||||
while (value.charCodeAt(escapePos - 1) === backslash) {
|
||||
escapePos -= 1;
|
||||
escape = !escape;
|
||||
}
|
||||
} else {
|
||||
value += ")";
|
||||
next = value.length - 1;
|
||||
token.unclosed = true;
|
||||
}
|
||||
} while (escape);
|
||||
// Whitespaces before closed
|
||||
whitespacePos = next;
|
||||
do {
|
||||
whitespacePos -= 1;
|
||||
code = value.charCodeAt(whitespacePos);
|
||||
} while (code <= 32);
|
||||
if (parenthesesOpenPos < whitespacePos) {
|
||||
if (pos !== whitespacePos + 1) {
|
||||
token.nodes = [
|
||||
{
|
||||
type: "word",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: whitespacePos + 1,
|
||||
value: value.slice(pos, whitespacePos + 1)
|
||||
}
|
||||
];
|
||||
} else {
|
||||
token.nodes = [];
|
||||
}
|
||||
if (token.unclosed && whitespacePos + 1 !== next) {
|
||||
token.after = "";
|
||||
token.nodes.push({
|
||||
type: "space",
|
||||
sourceIndex: whitespacePos + 1,
|
||||
sourceEndIndex: next,
|
||||
value: value.slice(whitespacePos + 1, next)
|
||||
});
|
||||
} else {
|
||||
token.after = value.slice(whitespacePos + 1, next);
|
||||
token.sourceEndIndex = next;
|
||||
}
|
||||
} else {
|
||||
token.after = "";
|
||||
token.nodes = [];
|
||||
}
|
||||
pos = next + 1;
|
||||
token.sourceEndIndex = token.unclosed ? next : pos;
|
||||
code = value.charCodeAt(pos);
|
||||
tokens.push(token);
|
||||
} else {
|
||||
balanced += 1;
|
||||
token.after = "";
|
||||
token.sourceEndIndex = pos + 1;
|
||||
tokens.push(token);
|
||||
stack.push(token);
|
||||
tokens = token.nodes = [];
|
||||
parent = token;
|
||||
}
|
||||
name = "";
|
||||
|
||||
// Close parentheses
|
||||
} else if (closeParentheses === code && balanced) {
|
||||
pos += 1;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
parent.after = after;
|
||||
parent.sourceEndIndex += after.length;
|
||||
after = "";
|
||||
balanced -= 1;
|
||||
stack[stack.length - 1].sourceEndIndex = pos;
|
||||
stack.pop();
|
||||
parent = stack[balanced];
|
||||
tokens = parent.nodes;
|
||||
|
||||
// Words
|
||||
} else {
|
||||
next = pos;
|
||||
do {
|
||||
if (code === backslash) {
|
||||
next += 1;
|
||||
}
|
||||
next += 1;
|
||||
code = value.charCodeAt(next);
|
||||
} while (
|
||||
next < max &&
|
||||
!(
|
||||
code <= 32 ||
|
||||
code === singleQuote ||
|
||||
code === doubleQuote ||
|
||||
code === comma ||
|
||||
code === colon ||
|
||||
code === slash ||
|
||||
code === openParentheses ||
|
||||
(code === star &&
|
||||
parent &&
|
||||
parent.type === "function" &&
|
||||
parent.value === "calc") ||
|
||||
(code === slash &&
|
||||
parent.type === "function" &&
|
||||
parent.value === "calc") ||
|
||||
(code === closeParentheses && balanced)
|
||||
)
|
||||
);
|
||||
token = value.slice(pos, next);
|
||||
|
||||
if (openParentheses === code) {
|
||||
name = token;
|
||||
} else if (
|
||||
(uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
|
||||
plus === token.charCodeAt(1) &&
|
||||
isUnicodeRange.test(token.slice(2))
|
||||
) {
|
||||
tokens.push({
|
||||
type: "unicode-range",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
} else {
|
||||
tokens.push({
|
||||
type: "word",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
}
|
||||
|
||||
pos = next;
|
||||
}
|
||||
}
|
||||
|
||||
for (pos = stack.length - 1; pos; pos -= 1) {
|
||||
stack[pos].unclosed = true;
|
||||
stack[pos].sourceEndIndex = value.length;
|
||||
}
|
||||
|
||||
return stack[0].nodes;
|
||||
};
|
||||
|
||||
var walk$1 = function walk(nodes, cb, bubble) {
|
||||
var i, max, node, result;
|
||||
|
||||
for (i = 0, max = nodes.length; i < max; i += 1) {
|
||||
node = nodes[i];
|
||||
if (!bubble) {
|
||||
result = cb(node, i, nodes);
|
||||
}
|
||||
|
||||
if (
|
||||
result !== false &&
|
||||
node.type === "function" &&
|
||||
Array.isArray(node.nodes)
|
||||
) {
|
||||
walk(node.nodes, cb, bubble);
|
||||
}
|
||||
|
||||
if (bubble) {
|
||||
cb(node, i, nodes);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function stringifyNode(node, custom) {
|
||||
var type = node.type;
|
||||
var value = node.value;
|
||||
var buf;
|
||||
var customResult;
|
||||
|
||||
if (custom && (customResult = custom(node)) !== undefined) {
|
||||
return customResult;
|
||||
} else if (type === "word" || type === "space") {
|
||||
return value;
|
||||
} else if (type === "string") {
|
||||
buf = node.quote || "";
|
||||
return buf + value + (node.unclosed ? "" : buf);
|
||||
} else if (type === "comment") {
|
||||
return "/*" + value + (node.unclosed ? "" : "*/");
|
||||
} else if (type === "div") {
|
||||
return (node.before || "") + value + (node.after || "");
|
||||
} else if (Array.isArray(node.nodes)) {
|
||||
buf = stringify$1(node.nodes, custom);
|
||||
if (type !== "function") {
|
||||
return buf;
|
||||
}
|
||||
return (
|
||||
value +
|
||||
"(" +
|
||||
(node.before || "") +
|
||||
buf +
|
||||
(node.after || "") +
|
||||
(node.unclosed ? "" : ")")
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function stringify$1(nodes, custom) {
|
||||
var result, i;
|
||||
|
||||
if (Array.isArray(nodes)) {
|
||||
result = "";
|
||||
for (i = nodes.length - 1; ~i; i -= 1) {
|
||||
result = stringifyNode(nodes[i], custom) + result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return stringifyNode(nodes, custom);
|
||||
}
|
||||
|
||||
var stringify_1 = stringify$1;
|
||||
|
||||
var unit;
|
||||
var hasRequiredUnit;
|
||||
|
||||
function requireUnit () {
|
||||
if (hasRequiredUnit) return unit;
|
||||
hasRequiredUnit = 1;
|
||||
var minus = "-".charCodeAt(0);
|
||||
var plus = "+".charCodeAt(0);
|
||||
var dot = ".".charCodeAt(0);
|
||||
var exp = "e".charCodeAt(0);
|
||||
var EXP = "E".charCodeAt(0);
|
||||
|
||||
// Check if three code points would start a number
|
||||
// https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
|
||||
function likeNumber(value) {
|
||||
var code = value.charCodeAt(0);
|
||||
var nextCode;
|
||||
|
||||
if (code === plus || code === minus) {
|
||||
nextCode = value.charCodeAt(1);
|
||||
|
||||
if (nextCode >= 48 && nextCode <= 57) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var nextNextCode = value.charCodeAt(2);
|
||||
|
||||
if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (code === dot) {
|
||||
nextCode = value.charCodeAt(1);
|
||||
|
||||
if (nextCode >= 48 && nextCode <= 57) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (code >= 48 && code <= 57) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consume a number
|
||||
// https://www.w3.org/TR/css-syntax-3/#consume-number
|
||||
unit = function(value) {
|
||||
var pos = 0;
|
||||
var length = value.length;
|
||||
var code;
|
||||
var nextCode;
|
||||
var nextNextCode;
|
||||
|
||||
if (length === 0 || !likeNumber(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
if (code === plus || code === minus) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
while (pos < length) {
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
if (code < 48 || code > 57) {
|
||||
break;
|
||||
}
|
||||
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
code = value.charCodeAt(pos);
|
||||
nextCode = value.charCodeAt(pos + 1);
|
||||
|
||||
if (code === dot && nextCode >= 48 && nextCode <= 57) {
|
||||
pos += 2;
|
||||
|
||||
while (pos < length) {
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
if (code < 48 || code > 57) {
|
||||
break;
|
||||
}
|
||||
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
|
||||
code = value.charCodeAt(pos);
|
||||
nextCode = value.charCodeAt(pos + 1);
|
||||
nextNextCode = value.charCodeAt(pos + 2);
|
||||
|
||||
if (
|
||||
(code === exp || code === EXP) &&
|
||||
((nextCode >= 48 && nextCode <= 57) ||
|
||||
((nextCode === plus || nextCode === minus) &&
|
||||
nextNextCode >= 48 &&
|
||||
nextNextCode <= 57))
|
||||
) {
|
||||
pos += nextCode === plus || nextCode === minus ? 3 : 2;
|
||||
|
||||
while (pos < length) {
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
if (code < 48 || code > 57) {
|
||||
break;
|
||||
}
|
||||
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
number: value.slice(0, pos),
|
||||
unit: value.slice(pos)
|
||||
};
|
||||
};
|
||||
return unit;
|
||||
}
|
||||
|
||||
var parse = parse$1;
|
||||
var walk = walk$1;
|
||||
var stringify = stringify_1;
|
||||
|
||||
function ValueParser(value) {
|
||||
if (this instanceof ValueParser) {
|
||||
this.nodes = parse(value);
|
||||
return this;
|
||||
}
|
||||
return new ValueParser(value);
|
||||
}
|
||||
|
||||
ValueParser.prototype.toString = function() {
|
||||
return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
|
||||
};
|
||||
|
||||
ValueParser.prototype.walk = function(cb, bubble) {
|
||||
walk(this.nodes, cb, bubble);
|
||||
return this;
|
||||
};
|
||||
|
||||
ValueParser.unit = requireUnit();
|
||||
|
||||
ValueParser.walk = walk;
|
||||
|
||||
ValueParser.stringify = stringify;
|
||||
|
||||
var lib = ValueParser;
|
||||
|
||||
export { lib as l };
|
||||
7930
node_modules/vite/dist/node/chunks/dep-f0c7dae0.js
generated
vendored
Normal file
7930
node_modules/vite/dist/node/chunks/dep-f0c7dae0.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
908
node_modules/vite/dist/node/cli.js
generated
vendored
Normal file
908
node_modules/vite/dist/node/cli.js
generated
vendored
Normal file
|
|
@ -0,0 +1,908 @@
|
|||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { EventEmitter } from 'events';
|
||||
import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-abb4f102.js';
|
||||
import { VERSION } from './constants.js';
|
||||
import 'node:fs/promises';
|
||||
import 'node:url';
|
||||
import 'node:util';
|
||||
import 'node:module';
|
||||
import 'tty';
|
||||
import 'esbuild';
|
||||
import 'path';
|
||||
import 'fs';
|
||||
import 'assert';
|
||||
import 'util';
|
||||
import 'net';
|
||||
import 'url';
|
||||
import 'http';
|
||||
import 'stream';
|
||||
import 'os';
|
||||
import 'child_process';
|
||||
import 'node:os';
|
||||
import 'node:child_process';
|
||||
import 'node:crypto';
|
||||
import 'node:dns';
|
||||
import 'crypto';
|
||||
import 'node:buffer';
|
||||
import 'module';
|
||||
import 'node:assert';
|
||||
import 'node:process';
|
||||
import 'node:v8';
|
||||
import 'rollup';
|
||||
import 'worker_threads';
|
||||
import 'zlib';
|
||||
import 'buffer';
|
||||
import 'https';
|
||||
import 'tls';
|
||||
import 'querystring';
|
||||
import 'node:readline';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:zlib';
|
||||
|
||||
function toArr(any) {
|
||||
return any == null ? [] : Array.isArray(any) ? any : [any];
|
||||
}
|
||||
|
||||
function toVal(out, key, val, opts) {
|
||||
var x, old=out[key], nxt=(
|
||||
!!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val))
|
||||
: typeof val === 'boolean' ? val
|
||||
: !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val))
|
||||
: (x = +val,x * 0 === 0) ? x : val
|
||||
);
|
||||
out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]);
|
||||
}
|
||||
|
||||
function mri2 (args, opts) {
|
||||
args = args || [];
|
||||
opts = opts || {};
|
||||
|
||||
var k, arr, arg, name, val, out={ _:[] };
|
||||
var i=0, j=0, idx=0, len=args.length;
|
||||
|
||||
const alibi = opts.alias !== void 0;
|
||||
const strict = opts.unknown !== void 0;
|
||||
const defaults = opts.default !== void 0;
|
||||
|
||||
opts.alias = opts.alias || {};
|
||||
opts.string = toArr(opts.string);
|
||||
opts.boolean = toArr(opts.boolean);
|
||||
|
||||
if (alibi) {
|
||||
for (k in opts.alias) {
|
||||
arr = opts.alias[k] = toArr(opts.alias[k]);
|
||||
for (i=0; i < arr.length; i++) {
|
||||
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=opts.boolean.length; i-- > 0;) {
|
||||
arr = opts.alias[opts.boolean[i]] || [];
|
||||
for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]);
|
||||
}
|
||||
|
||||
for (i=opts.string.length; i-- > 0;) {
|
||||
arr = opts.alias[opts.string[i]] || [];
|
||||
for (j=arr.length; j-- > 0;) opts.string.push(arr[j]);
|
||||
}
|
||||
|
||||
if (defaults) {
|
||||
for (k in opts.default) {
|
||||
name = typeof opts.default[k];
|
||||
arr = opts.alias[k] = opts.alias[k] || [];
|
||||
if (opts[name] !== void 0) {
|
||||
opts[name].push(k);
|
||||
for (i=0; i < arr.length; i++) {
|
||||
opts[name].push(arr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const keys = strict ? Object.keys(opts.alias) : [];
|
||||
|
||||
for (i=0; i < len; i++) {
|
||||
arg = args[i];
|
||||
|
||||
if (arg === '--') {
|
||||
out._ = out._.concat(args.slice(++i));
|
||||
break;
|
||||
}
|
||||
|
||||
for (j=0; j < arg.length; j++) {
|
||||
if (arg.charCodeAt(j) !== 45) break; // "-"
|
||||
}
|
||||
|
||||
if (j === 0) {
|
||||
out._.push(arg);
|
||||
} else if (arg.substring(j, j + 3) === 'no-') {
|
||||
name = arg.substring(j + 3);
|
||||
if (strict && !~keys.indexOf(name)) {
|
||||
return opts.unknown(arg);
|
||||
}
|
||||
out[name] = false;
|
||||
} else {
|
||||
for (idx=j+1; idx < arg.length; idx++) {
|
||||
if (arg.charCodeAt(idx) === 61) break; // "="
|
||||
}
|
||||
|
||||
name = arg.substring(j, idx);
|
||||
val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]);
|
||||
arr = (j === 2 ? [name] : name);
|
||||
|
||||
for (idx=0; idx < arr.length; idx++) {
|
||||
name = arr[idx];
|
||||
if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name);
|
||||
toVal(out, name, (idx + 1 < arr.length) || val, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defaults) {
|
||||
for (k in opts.default) {
|
||||
if (out[k] === void 0) {
|
||||
out[k] = opts.default[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alibi) {
|
||||
for (k in out) {
|
||||
arr = opts.alias[k] || [];
|
||||
while (arr.length > 0) {
|
||||
out[arr.shift()] = out[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
|
||||
const findAllBrackets = (v) => {
|
||||
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
||||
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
||||
const res = [];
|
||||
const parse = (match) => {
|
||||
let variadic = false;
|
||||
let value = match[1];
|
||||
if (value.startsWith("...")) {
|
||||
value = value.slice(3);
|
||||
variadic = true;
|
||||
}
|
||||
return {
|
||||
required: match[0].startsWith("<"),
|
||||
value,
|
||||
variadic
|
||||
};
|
||||
};
|
||||
let angledMatch;
|
||||
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
|
||||
res.push(parse(angledMatch));
|
||||
}
|
||||
let squareMatch;
|
||||
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
|
||||
res.push(parse(squareMatch));
|
||||
}
|
||||
return res;
|
||||
};
|
||||
const getMriOptions = (options) => {
|
||||
const result = {alias: {}, boolean: []};
|
||||
for (const [index, option] of options.entries()) {
|
||||
if (option.names.length > 1) {
|
||||
result.alias[option.names[0]] = option.names.slice(1);
|
||||
}
|
||||
if (option.isBoolean) {
|
||||
if (option.negated) {
|
||||
const hasStringTypeOption = options.some((o, i) => {
|
||||
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
||||
});
|
||||
if (!hasStringTypeOption) {
|
||||
result.boolean.push(option.names[0]);
|
||||
}
|
||||
} else {
|
||||
result.boolean.push(option.names[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const findLongest = (arr) => {
|
||||
return arr.sort((a, b) => {
|
||||
return a.length > b.length ? -1 : 1;
|
||||
})[0];
|
||||
};
|
||||
const padRight = (str, length) => {
|
||||
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
||||
};
|
||||
const camelcase = (input) => {
|
||||
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
||||
return p1 + p2.toUpperCase();
|
||||
});
|
||||
};
|
||||
const setDotProp = (obj, keys, val) => {
|
||||
let i = 0;
|
||||
let length = keys.length;
|
||||
let t = obj;
|
||||
let x;
|
||||
for (; i < length; ++i) {
|
||||
x = t[keys[i]];
|
||||
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
|
||||
}
|
||||
};
|
||||
const setByType = (obj, transforms) => {
|
||||
for (const key of Object.keys(transforms)) {
|
||||
const transform = transforms[key];
|
||||
if (transform.shouldTransform) {
|
||||
obj[key] = Array.prototype.concat.call([], obj[key]);
|
||||
if (typeof transform.transformFunction === "function") {
|
||||
obj[key] = obj[key].map(transform.transformFunction);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const getFileName = (input) => {
|
||||
const m = /([^\\\/]+)$/.exec(input);
|
||||
return m ? m[1] : "";
|
||||
};
|
||||
const camelcaseOptionName = (name) => {
|
||||
return name.split(".").map((v, i) => {
|
||||
return i === 0 ? camelcase(v) : v;
|
||||
}).join(".");
|
||||
};
|
||||
class CACError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
if (typeof Error.captureStackTrace === "function") {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
this.stack = new Error(message).stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Option {
|
||||
constructor(rawName, description, config) {
|
||||
this.rawName = rawName;
|
||||
this.description = description;
|
||||
this.config = Object.assign({}, config);
|
||||
rawName = rawName.replace(/\.\*/g, "");
|
||||
this.negated = false;
|
||||
this.names = removeBrackets(rawName).split(",").map((v) => {
|
||||
let name = v.trim().replace(/^-{1,2}/, "");
|
||||
if (name.startsWith("no-")) {
|
||||
this.negated = true;
|
||||
name = name.replace(/^no-/, "");
|
||||
}
|
||||
return camelcaseOptionName(name);
|
||||
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
||||
this.name = this.names[this.names.length - 1];
|
||||
if (this.negated && this.config.default == null) {
|
||||
this.config.default = true;
|
||||
}
|
||||
if (rawName.includes("<")) {
|
||||
this.required = true;
|
||||
} else if (rawName.includes("[")) {
|
||||
this.required = false;
|
||||
} else {
|
||||
this.isBoolean = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const processArgs = process.argv;
|
||||
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
||||
|
||||
class Command {
|
||||
constructor(rawName, description, config = {}, cli) {
|
||||
this.rawName = rawName;
|
||||
this.description = description;
|
||||
this.config = config;
|
||||
this.cli = cli;
|
||||
this.options = [];
|
||||
this.aliasNames = [];
|
||||
this.name = removeBrackets(rawName);
|
||||
this.args = findAllBrackets(rawName);
|
||||
this.examples = [];
|
||||
}
|
||||
usage(text) {
|
||||
this.usageText = text;
|
||||
return this;
|
||||
}
|
||||
allowUnknownOptions() {
|
||||
this.config.allowUnknownOptions = true;
|
||||
return this;
|
||||
}
|
||||
ignoreOptionDefaultValue() {
|
||||
this.config.ignoreOptionDefaultValue = true;
|
||||
return this;
|
||||
}
|
||||
version(version, customFlags = "-v, --version") {
|
||||
this.versionNumber = version;
|
||||
this.option(customFlags, "Display version number");
|
||||
return this;
|
||||
}
|
||||
example(example) {
|
||||
this.examples.push(example);
|
||||
return this;
|
||||
}
|
||||
option(rawName, description, config) {
|
||||
const option = new Option(rawName, description, config);
|
||||
this.options.push(option);
|
||||
return this;
|
||||
}
|
||||
alias(name) {
|
||||
this.aliasNames.push(name);
|
||||
return this;
|
||||
}
|
||||
action(callback) {
|
||||
this.commandAction = callback;
|
||||
return this;
|
||||
}
|
||||
isMatched(name) {
|
||||
return this.name === name || this.aliasNames.includes(name);
|
||||
}
|
||||
get isDefaultCommand() {
|
||||
return this.name === "" || this.aliasNames.includes("!");
|
||||
}
|
||||
get isGlobalCommand() {
|
||||
return this instanceof GlobalCommand;
|
||||
}
|
||||
hasOption(name) {
|
||||
name = name.split(".")[0];
|
||||
return this.options.find((option) => {
|
||||
return option.names.includes(name);
|
||||
});
|
||||
}
|
||||
outputHelp() {
|
||||
const {name, commands} = this.cli;
|
||||
const {
|
||||
versionNumber,
|
||||
options: globalOptions,
|
||||
helpCallback
|
||||
} = this.cli.globalCommand;
|
||||
let sections = [
|
||||
{
|
||||
body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
|
||||
}
|
||||
];
|
||||
sections.push({
|
||||
title: "Usage",
|
||||
body: ` $ ${name} ${this.usageText || this.rawName}`
|
||||
});
|
||||
const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
|
||||
if (showCommands) {
|
||||
const longestCommandName = findLongest(commands.map((command) => command.rawName));
|
||||
sections.push({
|
||||
title: "Commands",
|
||||
body: commands.map((command) => {
|
||||
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
||||
}).join("\n")
|
||||
});
|
||||
sections.push({
|
||||
title: `For more info, run any command with the \`--help\` flag`,
|
||||
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
||||
});
|
||||
}
|
||||
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
||||
if (!this.isGlobalCommand && !this.isDefaultCommand) {
|
||||
options = options.filter((option) => option.name !== "version");
|
||||
}
|
||||
if (options.length > 0) {
|
||||
const longestOptionName = findLongest(options.map((option) => option.rawName));
|
||||
sections.push({
|
||||
title: "Options",
|
||||
body: options.map((option) => {
|
||||
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
|
||||
}).join("\n")
|
||||
});
|
||||
}
|
||||
if (this.examples.length > 0) {
|
||||
sections.push({
|
||||
title: "Examples",
|
||||
body: this.examples.map((example) => {
|
||||
if (typeof example === "function") {
|
||||
return example(name);
|
||||
}
|
||||
return example;
|
||||
}).join("\n")
|
||||
});
|
||||
}
|
||||
if (helpCallback) {
|
||||
sections = helpCallback(sections) || sections;
|
||||
}
|
||||
console.log(sections.map((section) => {
|
||||
return section.title ? `${section.title}:
|
||||
${section.body}` : section.body;
|
||||
}).join("\n\n"));
|
||||
}
|
||||
outputVersion() {
|
||||
const {name} = this.cli;
|
||||
const {versionNumber} = this.cli.globalCommand;
|
||||
if (versionNumber) {
|
||||
console.log(`${name}/${versionNumber} ${platformInfo}`);
|
||||
}
|
||||
}
|
||||
checkRequiredArgs() {
|
||||
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
||||
if (this.cli.args.length < minimalArgsCount) {
|
||||
throw new CACError(`missing required args for command \`${this.rawName}\``);
|
||||
}
|
||||
}
|
||||
checkUnknownOptions() {
|
||||
const {options, globalCommand} = this.cli;
|
||||
if (!this.config.allowUnknownOptions) {
|
||||
for (const name of Object.keys(options)) {
|
||||
if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
|
||||
throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
checkOptionValue() {
|
||||
const {options: parsedOptions, globalCommand} = this.cli;
|
||||
const options = [...globalCommand.options, ...this.options];
|
||||
for (const option of options) {
|
||||
const value = parsedOptions[option.name.split(".")[0]];
|
||||
if (option.required) {
|
||||
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
||||
if (value === true || value === false && !hasNegated) {
|
||||
throw new CACError(`option \`${option.rawName}\` value is missing`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class GlobalCommand extends Command {
|
||||
constructor(cli) {
|
||||
super("@@global@@", "", {}, cli);
|
||||
}
|
||||
}
|
||||
|
||||
var __assign = Object.assign;
|
||||
class CAC extends EventEmitter {
|
||||
constructor(name = "") {
|
||||
super();
|
||||
this.name = name;
|
||||
this.commands = [];
|
||||
this.rawArgs = [];
|
||||
this.args = [];
|
||||
this.options = {};
|
||||
this.globalCommand = new GlobalCommand(this);
|
||||
this.globalCommand.usage("<command> [options]");
|
||||
}
|
||||
usage(text) {
|
||||
this.globalCommand.usage(text);
|
||||
return this;
|
||||
}
|
||||
command(rawName, description, config) {
|
||||
const command = new Command(rawName, description || "", config, this);
|
||||
command.globalCommand = this.globalCommand;
|
||||
this.commands.push(command);
|
||||
return command;
|
||||
}
|
||||
option(rawName, description, config) {
|
||||
this.globalCommand.option(rawName, description, config);
|
||||
return this;
|
||||
}
|
||||
help(callback) {
|
||||
this.globalCommand.option("-h, --help", "Display this message");
|
||||
this.globalCommand.helpCallback = callback;
|
||||
this.showHelpOnExit = true;
|
||||
return this;
|
||||
}
|
||||
version(version, customFlags = "-v, --version") {
|
||||
this.globalCommand.version(version, customFlags);
|
||||
this.showVersionOnExit = true;
|
||||
return this;
|
||||
}
|
||||
example(example) {
|
||||
this.globalCommand.example(example);
|
||||
return this;
|
||||
}
|
||||
outputHelp() {
|
||||
if (this.matchedCommand) {
|
||||
this.matchedCommand.outputHelp();
|
||||
} else {
|
||||
this.globalCommand.outputHelp();
|
||||
}
|
||||
}
|
||||
outputVersion() {
|
||||
this.globalCommand.outputVersion();
|
||||
}
|
||||
setParsedInfo({args, options}, matchedCommand, matchedCommandName) {
|
||||
this.args = args;
|
||||
this.options = options;
|
||||
if (matchedCommand) {
|
||||
this.matchedCommand = matchedCommand;
|
||||
}
|
||||
if (matchedCommandName) {
|
||||
this.matchedCommandName = matchedCommandName;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
unsetMatchedCommand() {
|
||||
this.matchedCommand = void 0;
|
||||
this.matchedCommandName = void 0;
|
||||
}
|
||||
parse(argv = processArgs, {
|
||||
run = true
|
||||
} = {}) {
|
||||
this.rawArgs = argv;
|
||||
if (!this.name) {
|
||||
this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
||||
}
|
||||
let shouldParse = true;
|
||||
for (const command of this.commands) {
|
||||
const parsed = this.mri(argv.slice(2), command);
|
||||
const commandName = parsed.args[0];
|
||||
if (command.isMatched(commandName)) {
|
||||
shouldParse = false;
|
||||
const parsedInfo = __assign(__assign({}, parsed), {
|
||||
args: parsed.args.slice(1)
|
||||
});
|
||||
this.setParsedInfo(parsedInfo, command, commandName);
|
||||
this.emit(`command:${commandName}`, command);
|
||||
}
|
||||
}
|
||||
if (shouldParse) {
|
||||
for (const command of this.commands) {
|
||||
if (command.name === "") {
|
||||
shouldParse = false;
|
||||
const parsed = this.mri(argv.slice(2), command);
|
||||
this.setParsedInfo(parsed, command);
|
||||
this.emit(`command:!`, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldParse) {
|
||||
const parsed = this.mri(argv.slice(2));
|
||||
this.setParsedInfo(parsed);
|
||||
}
|
||||
if (this.options.help && this.showHelpOnExit) {
|
||||
this.outputHelp();
|
||||
run = false;
|
||||
this.unsetMatchedCommand();
|
||||
}
|
||||
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
|
||||
this.outputVersion();
|
||||
run = false;
|
||||
this.unsetMatchedCommand();
|
||||
}
|
||||
const parsedArgv = {args: this.args, options: this.options};
|
||||
if (run) {
|
||||
this.runMatchedCommand();
|
||||
}
|
||||
if (!this.matchedCommand && this.args[0]) {
|
||||
this.emit("command:*");
|
||||
}
|
||||
return parsedArgv;
|
||||
}
|
||||
mri(argv, command) {
|
||||
const cliOptions = [
|
||||
...this.globalCommand.options,
|
||||
...command ? command.options : []
|
||||
];
|
||||
const mriOptions = getMriOptions(cliOptions);
|
||||
let argsAfterDoubleDashes = [];
|
||||
const doubleDashesIndex = argv.indexOf("--");
|
||||
if (doubleDashesIndex > -1) {
|
||||
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
||||
argv = argv.slice(0, doubleDashesIndex);
|
||||
}
|
||||
let parsed = mri2(argv, mriOptions);
|
||||
parsed = Object.keys(parsed).reduce((res, name) => {
|
||||
return __assign(__assign({}, res), {
|
||||
[camelcaseOptionName(name)]: parsed[name]
|
||||
});
|
||||
}, {_: []});
|
||||
const args = parsed._;
|
||||
const options = {
|
||||
"--": argsAfterDoubleDashes
|
||||
};
|
||||
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
||||
let transforms = Object.create(null);
|
||||
for (const cliOption of cliOptions) {
|
||||
if (!ignoreDefault && cliOption.config.default !== void 0) {
|
||||
for (const name of cliOption.names) {
|
||||
options[name] = cliOption.config.default;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(cliOption.config.type)) {
|
||||
if (transforms[cliOption.name] === void 0) {
|
||||
transforms[cliOption.name] = Object.create(null);
|
||||
transforms[cliOption.name]["shouldTransform"] = true;
|
||||
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const key of Object.keys(parsed)) {
|
||||
if (key !== "_") {
|
||||
const keys = key.split(".");
|
||||
setDotProp(options, keys, parsed[key]);
|
||||
setByType(options, transforms);
|
||||
}
|
||||
}
|
||||
return {
|
||||
args,
|
||||
options
|
||||
};
|
||||
}
|
||||
runMatchedCommand() {
|
||||
const {args, options, matchedCommand: command} = this;
|
||||
if (!command || !command.commandAction)
|
||||
return;
|
||||
command.checkUnknownOptions();
|
||||
command.checkOptionValue();
|
||||
command.checkRequiredArgs();
|
||||
const actionArgs = [];
|
||||
command.args.forEach((arg, index) => {
|
||||
if (arg.variadic) {
|
||||
actionArgs.push(args.slice(index));
|
||||
} else {
|
||||
actionArgs.push(args[index]);
|
||||
}
|
||||
});
|
||||
actionArgs.push(options);
|
||||
return command.commandAction.apply(this, actionArgs);
|
||||
}
|
||||
}
|
||||
|
||||
const cac = (name = "") => new CAC(name);
|
||||
|
||||
const cli = cac('vite');
|
||||
let profileSession = global.__vite_profile_session;
|
||||
let profileCount = 0;
|
||||
const stopProfiler = (log) => {
|
||||
if (!profileSession)
|
||||
return;
|
||||
return new Promise((res, rej) => {
|
||||
profileSession.post('Profiler.stop', (err, { profile }) => {
|
||||
// Write profile to disk, upload, etc.
|
||||
if (!err) {
|
||||
const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
|
||||
fs.writeFileSync(outPath, JSON.stringify(profile));
|
||||
log(colors.yellow(`CPU profile written to ${colors.white(colors.dim(outPath))}`));
|
||||
profileSession = undefined;
|
||||
res();
|
||||
}
|
||||
else {
|
||||
rej(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const filterDuplicateOptions = (options) => {
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
if (Array.isArray(value)) {
|
||||
options[key] = value[value.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* removing global flags before passing as command specific sub-configs
|
||||
*/
|
||||
function cleanOptions(options) {
|
||||
const ret = { ...options };
|
||||
delete ret['--'];
|
||||
delete ret.c;
|
||||
delete ret.config;
|
||||
delete ret.base;
|
||||
delete ret.l;
|
||||
delete ret.logLevel;
|
||||
delete ret.clearScreen;
|
||||
delete ret.d;
|
||||
delete ret.debug;
|
||||
delete ret.f;
|
||||
delete ret.filter;
|
||||
delete ret.m;
|
||||
delete ret.mode;
|
||||
// convert the sourcemap option to a boolean if necessary
|
||||
if ('sourcemap' in ret) {
|
||||
const sourcemap = ret.sourcemap;
|
||||
ret.sourcemap =
|
||||
sourcemap === 'true'
|
||||
? true
|
||||
: sourcemap === 'false'
|
||||
? false
|
||||
: ret.sourcemap;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
cli
|
||||
.option('-c, --config <file>', `[string] use specified config file`)
|
||||
.option('--base <path>', `[string] public base path (default: /)`)
|
||||
.option('-l, --logLevel <level>', `[string] info | warn | error | silent`)
|
||||
.option('--clearScreen', `[boolean] allow/disable clear screen when logging`)
|
||||
.option('-d, --debug [feat]', `[string | boolean] show debug logs`)
|
||||
.option('-f, --filter <filter>', `[string] filter debug logs`)
|
||||
.option('-m, --mode <mode>', `[string] set env mode`);
|
||||
// dev
|
||||
cli
|
||||
.command('[root]', 'start dev server') // default command
|
||||
.alias('serve') // the command is called 'serve' in Vite's API
|
||||
.alias('dev') // alias to align with the script name
|
||||
.option('--host [host]', `[string] specify hostname`)
|
||||
.option('--port <port>', `[number] specify port`)
|
||||
.option('--https', `[boolean] use TLS + HTTP/2`)
|
||||
.option('--open [path]', `[boolean | string] open browser on startup`)
|
||||
.option('--cors', `[boolean] enable CORS`)
|
||||
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
||||
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
// output structure is preserved even after bundling so require()
|
||||
// is ok here
|
||||
const { createServer } = await import('./chunks/dep-abb4f102.js').then(function (n) { return n.I; });
|
||||
try {
|
||||
const server = await createServer({
|
||||
root,
|
||||
base: options.base,
|
||||
mode: options.mode,
|
||||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
clearScreen: options.clearScreen,
|
||||
optimizeDeps: { force: options.force },
|
||||
server: cleanOptions(options),
|
||||
});
|
||||
if (!server.httpServer) {
|
||||
throw new Error('HTTP server not available');
|
||||
}
|
||||
await server.listen();
|
||||
const info = server.config.logger.info;
|
||||
const viteStartTime = global.__vite_start_time ?? false;
|
||||
const startupDurationString = viteStartTime
|
||||
? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
|
||||
: '';
|
||||
info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
|
||||
server.printUrls();
|
||||
bindShortcuts(server, {
|
||||
print: true,
|
||||
customShortcuts: [
|
||||
profileSession && {
|
||||
key: 'p',
|
||||
description: 'start/stop the profiler',
|
||||
async action(server) {
|
||||
if (profileSession) {
|
||||
await stopProfiler(server.config.logger.info);
|
||||
}
|
||||
else {
|
||||
const inspector = await import('node:inspector').then((r) => r.default);
|
||||
await new Promise((res) => {
|
||||
profileSession = new inspector.Session();
|
||||
profileSession.connect();
|
||||
profileSession.post('Profiler.enable', () => {
|
||||
profileSession.post('Profiler.start', () => {
|
||||
server.config.logger.info('Profiler started');
|
||||
res();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
const logger = createLogger(options.logLevel);
|
||||
logger.error(colors.red(`error when starting dev server:\n${e.stack}`), {
|
||||
error: e,
|
||||
});
|
||||
stopProfiler(logger.info);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
// build
|
||||
cli
|
||||
.command('build [root]', 'build for production')
|
||||
.option('--target <target>', `[string] transpile target (default: 'modules')`)
|
||||
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
||||
.option('--assetsDir <dir>', `[string] directory under outDir to place assets in (default: assets)`)
|
||||
.option('--assetsInlineLimit <number>', `[number] static asset base64 inline threshold in bytes (default: 4096)`)
|
||||
.option('--ssr [entry]', `[string] build specified entry for server-side rendering`)
|
||||
.option('--sourcemap [output]', `[boolean | "inline" | "hidden"] output source maps for build (default: false)`)
|
||||
.option('--minify [minifier]', `[boolean | "terser" | "esbuild"] enable/disable minification, ` +
|
||||
`or specify minifier to use (default: esbuild)`)
|
||||
.option('--manifest [name]', `[boolean | string] emit build manifest json`)
|
||||
.option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
|
||||
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle (experimental)`)
|
||||
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
||||
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { build } = await import('./chunks/dep-abb4f102.js').then(function (n) { return n.H; });
|
||||
const buildOptions = cleanOptions(options);
|
||||
try {
|
||||
await build({
|
||||
root,
|
||||
base: options.base,
|
||||
mode: options.mode,
|
||||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
clearScreen: options.clearScreen,
|
||||
optimizeDeps: { force: options.force },
|
||||
build: buildOptions,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
}
|
||||
finally {
|
||||
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
||||
}
|
||||
});
|
||||
// optimize
|
||||
cli
|
||||
.command('optimize [root]', 'pre-bundle dependencies')
|
||||
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { optimizeDeps } = await import('./chunks/dep-abb4f102.js').then(function (n) { return n.G; });
|
||||
try {
|
||||
const config = await resolveConfig({
|
||||
root,
|
||||
base: options.base,
|
||||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
mode: options.mode,
|
||||
}, 'serve');
|
||||
await optimizeDeps(config, options.force, true);
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
// preview
|
||||
cli
|
||||
.command('preview [root]', 'locally preview production build')
|
||||
.option('--host [host]', `[string] specify hostname`)
|
||||
.option('--port <port>', `[number] specify port`)
|
||||
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
||||
.option('--https', `[boolean] use TLS + HTTP/2`)
|
||||
.option('--open [path]', `[boolean | string] open browser on startup`)
|
||||
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
||||
.action(async (root, options) => {
|
||||
filterDuplicateOptions(options);
|
||||
const { preview } = await import('./chunks/dep-abb4f102.js').then(function (n) { return n.J; });
|
||||
try {
|
||||
const server = await preview({
|
||||
root,
|
||||
base: options.base,
|
||||
configFile: options.config,
|
||||
logLevel: options.logLevel,
|
||||
mode: options.mode,
|
||||
build: {
|
||||
outDir: options.outDir,
|
||||
},
|
||||
preview: {
|
||||
port: options.port,
|
||||
strictPort: options.strictPort,
|
||||
host: options.host,
|
||||
https: options.https,
|
||||
open: options.open,
|
||||
},
|
||||
});
|
||||
server.printUrls();
|
||||
bindShortcuts(server, { print: true });
|
||||
}
|
||||
catch (e) {
|
||||
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e });
|
||||
process.exit(1);
|
||||
}
|
||||
finally {
|
||||
stopProfiler((message) => createLogger(options.logLevel).info(message));
|
||||
}
|
||||
});
|
||||
cli.help();
|
||||
cli.version(VERSION);
|
||||
cli.parse();
|
||||
|
||||
export { stopProfiler };
|
||||
125
node_modules/vite/dist/node/constants.js
generated
vendored
Normal file
125
node_modules/vite/dist/node/constants.js
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
import path, { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
|
||||
const VERSION = version;
|
||||
const DEFAULT_MAIN_FIELDS = [
|
||||
'module',
|
||||
'jsnext:main',
|
||||
'jsnext',
|
||||
];
|
||||
// Baseline support browserslist
|
||||
// "defaults and supports es6-module and supports es6-module-dynamic-import"
|
||||
// Higher browser versions may be needed for extra features.
|
||||
const ESBUILD_MODULES_TARGET = [
|
||||
'es2020',
|
||||
'edge88',
|
||||
'firefox78',
|
||||
'chrome87',
|
||||
'safari14',
|
||||
];
|
||||
const DEFAULT_EXTENSIONS = [
|
||||
'.mjs',
|
||||
'.js',
|
||||
'.mts',
|
||||
'.ts',
|
||||
'.jsx',
|
||||
'.tsx',
|
||||
'.json',
|
||||
];
|
||||
const DEFAULT_CONFIG_FILES = [
|
||||
'vite.config.js',
|
||||
'vite.config.mjs',
|
||||
'vite.config.ts',
|
||||
'vite.config.cjs',
|
||||
'vite.config.mts',
|
||||
'vite.config.cts',
|
||||
];
|
||||
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
||||
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
||||
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
||||
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
||||
/**
|
||||
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
||||
*/
|
||||
const FS_PREFIX = `/@fs/`;
|
||||
/**
|
||||
* Prefix for resolved Ids that are not valid browser import specifiers
|
||||
*/
|
||||
const VALID_ID_PREFIX = `/@id/`;
|
||||
/**
|
||||
* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
|
||||
* module ID with `\0`, a convention from the rollup ecosystem.
|
||||
* This prevents other plugins from trying to process the id (like node resolution),
|
||||
* and core features like sourcemaps can use this info to differentiate between
|
||||
* virtual modules and regular files.
|
||||
* `\0` is not a permitted char in import URLs so we have to replace them during
|
||||
* import analysis. The id will be decoded back before entering the plugins pipeline.
|
||||
* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
|
||||
* modules in the browser end up encoded as `/@id/__x00__{id}`
|
||||
*/
|
||||
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
||||
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
||||
const ENV_PUBLIC_PATH = `/@vite/env`;
|
||||
const VITE_PACKAGE_DIR = resolve(
|
||||
// import.meta.url is `dist/node/constants.js` after bundle
|
||||
fileURLToPath(import.meta.url), '../../..');
|
||||
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
||||
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
||||
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
||||
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
||||
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
||||
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
||||
// add a mime type to the `registerCustomMime` in
|
||||
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
||||
// looked up by mrmime.
|
||||
const KNOWN_ASSET_TYPES = [
|
||||
// images
|
||||
'apng',
|
||||
'png',
|
||||
'jpe?g',
|
||||
'jfif',
|
||||
'pjpeg',
|
||||
'pjp',
|
||||
'gif',
|
||||
'svg',
|
||||
'ico',
|
||||
'webp',
|
||||
'avif',
|
||||
// media
|
||||
'mp4',
|
||||
'webm',
|
||||
'ogg',
|
||||
'mp3',
|
||||
'wav',
|
||||
'flac',
|
||||
'aac',
|
||||
'opus',
|
||||
// fonts
|
||||
'woff2?',
|
||||
'eot',
|
||||
'ttf',
|
||||
'otf',
|
||||
// other
|
||||
'webmanifest',
|
||||
'pdf',
|
||||
'txt',
|
||||
];
|
||||
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
||||
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
||||
const loopbackHosts = new Set([
|
||||
'localhost',
|
||||
'127.0.0.1',
|
||||
'::1',
|
||||
'0000:0000:0000:0000:0000:0000:0000:0001',
|
||||
]);
|
||||
const wildcardHosts = new Set([
|
||||
'0.0.0.0',
|
||||
'::',
|
||||
'0000:0000:0000:0000:0000:0000:0000:0000',
|
||||
]);
|
||||
const DEFAULT_DEV_PORT = 5173;
|
||||
const DEFAULT_PREVIEW_PORT = 4173;
|
||||
|
||||
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
||||
3470
node_modules/vite/dist/node/index.d.ts
generated
vendored
Normal file
3470
node_modules/vite/dist/node/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
155
node_modules/vite/dist/node/index.js
generated
vendored
Normal file
155
node_modules/vite/dist/node/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
import { i as isInNodeModules } from './chunks/dep-abb4f102.js';
|
||||
export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-abb4f102.js';
|
||||
export { VERSION as version } from './constants.js';
|
||||
export { version as esbuildVersion } from 'esbuild';
|
||||
export { VERSION as rollupVersion } from 'rollup';
|
||||
import 'node:fs';
|
||||
import 'node:fs/promises';
|
||||
import 'node:path';
|
||||
import 'node:url';
|
||||
import 'node:util';
|
||||
import 'node:perf_hooks';
|
||||
import 'node:module';
|
||||
import 'tty';
|
||||
import 'path';
|
||||
import 'fs';
|
||||
import 'events';
|
||||
import 'assert';
|
||||
import 'util';
|
||||
import 'net';
|
||||
import 'url';
|
||||
import 'http';
|
||||
import 'stream';
|
||||
import 'os';
|
||||
import 'child_process';
|
||||
import 'node:os';
|
||||
import 'node:child_process';
|
||||
import 'node:crypto';
|
||||
import 'node:dns';
|
||||
import 'crypto';
|
||||
import 'node:buffer';
|
||||
import 'module';
|
||||
import 'node:assert';
|
||||
import 'node:process';
|
||||
import 'node:v8';
|
||||
import 'worker_threads';
|
||||
import 'zlib';
|
||||
import 'buffer';
|
||||
import 'https';
|
||||
import 'tls';
|
||||
import 'querystring';
|
||||
import 'node:readline';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:zlib';
|
||||
|
||||
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
||||
// copy from constants.ts
|
||||
const CSS_LANGS_RE =
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group
|
||||
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
||||
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
||||
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
||||
// We don't recommend using this strategy as a general solution moving forward
|
||||
// splitVendorChunk is a simple index/vendor strategy that was used in Vite
|
||||
// until v2.8. It is exposed to let people continue to use it in case it was
|
||||
// working well for their setups.
|
||||
// The cache needs to be reset on buildStart for watch mode to work correctly
|
||||
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
||||
class SplitVendorChunkCache {
|
||||
constructor() {
|
||||
this.cache = new Map();
|
||||
}
|
||||
reset() {
|
||||
this.cache = new Map();
|
||||
}
|
||||
}
|
||||
function splitVendorChunk(options = {}) {
|
||||
const cache = options.cache ?? new SplitVendorChunkCache();
|
||||
return (id, { getModuleInfo }) => {
|
||||
if (isInNodeModules(id) &&
|
||||
!isCSSRequest(id) &&
|
||||
staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
||||
return 'vendor';
|
||||
}
|
||||
};
|
||||
}
|
||||
function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
||||
if (cache.has(id)) {
|
||||
return cache.get(id);
|
||||
}
|
||||
if (importStack.includes(id)) {
|
||||
// circular deps!
|
||||
cache.set(id, false);
|
||||
return false;
|
||||
}
|
||||
const mod = getModuleInfo(id);
|
||||
if (!mod) {
|
||||
cache.set(id, false);
|
||||
return false;
|
||||
}
|
||||
if (mod.isEntry) {
|
||||
cache.set(id, true);
|
||||
return true;
|
||||
}
|
||||
const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
|
||||
cache.set(id, someImporterIs);
|
||||
return someImporterIs;
|
||||
}
|
||||
function splitVendorChunkPlugin() {
|
||||
const caches = [];
|
||||
function createSplitVendorChunk(output, config) {
|
||||
const cache = new SplitVendorChunkCache();
|
||||
caches.push(cache);
|
||||
const build = config.build ?? {};
|
||||
const format = output?.format;
|
||||
if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
|
||||
return splitVendorChunk({ cache });
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: 'vite:split-vendor-chunk',
|
||||
config(config) {
|
||||
let outputs = config?.build?.rollupOptions?.output;
|
||||
if (outputs) {
|
||||
outputs = Array.isArray(outputs) ? outputs : [outputs];
|
||||
for (const output of outputs) {
|
||||
const viteManualChunks = createSplitVendorChunk(output, config);
|
||||
if (viteManualChunks) {
|
||||
if (output.manualChunks) {
|
||||
if (typeof output.manualChunks === 'function') {
|
||||
const userManualChunks = output.manualChunks;
|
||||
output.manualChunks = (id, api) => {
|
||||
return userManualChunks(id, api) ?? viteManualChunks(id, api);
|
||||
};
|
||||
}
|
||||
// else, leave the object form of manualChunks untouched, as
|
||||
// we can't safely replicate rollup handling.
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.manualChunks`. Consider using the function form instead.");
|
||||
}
|
||||
else {
|
||||
output.manualChunks = viteManualChunks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return {
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: createSplitVendorChunk({}, config),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
buildStart() {
|
||||
caches.forEach((cache) => cache.reset());
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export { isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };
|
||||
34
node_modules/vite/index.cjs
generated
vendored
Normal file
34
node_modules/vite/index.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
// type utils
|
||||
module.exports.defineConfig = (config) => config
|
||||
|
||||
// proxy cjs utils (sync functions)
|
||||
Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
|
||||
|
||||
// async functions, can be redirect from ESM build
|
||||
const asyncFunctions = [
|
||||
'build',
|
||||
'createServer',
|
||||
'preview',
|
||||
'transformWithEsbuild',
|
||||
'resolveConfig',
|
||||
'optimizeDeps',
|
||||
'formatPostcssSourceMap',
|
||||
'loadConfigFromFile',
|
||||
'preprocessCSS',
|
||||
]
|
||||
asyncFunctions.forEach((name) => {
|
||||
module.exports[name] = (...args) =>
|
||||
import('./dist/node/index.js').then((i) => i[name](...args))
|
||||
})
|
||||
|
||||
// some sync functions are marked not supported due to their complexity and uncommon usage
|
||||
const unsupportedCJS = ['resolvePackageEntry', 'resolvePackageData']
|
||||
unsupportedCJS.forEach((name) => {
|
||||
module.exports[name] = () => {
|
||||
throw new Error(
|
||||
`"${name}" is not supported in CJS build of Vite 4.\nPlease use ESM or dynamic imports \`const { ${name} } = await import('vite')\`.`,
|
||||
)
|
||||
}
|
||||
})
|
||||
1
node_modules/vite/node_modules/.bin/esbuild
generated
vendored
Symbolic link
1
node_modules/vite/node_modules/.bin/esbuild
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../esbuild/bin/esbuild
|
||||
1
node_modules/vite/node_modules/.bin/rollup
generated
vendored
Symbolic link
1
node_modules/vite/node_modules/.bin/rollup
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../../rollup/dist/bin/rollup
|
||||
3
node_modules/vite/node_modules/@esbuild/linux-x64/README.md
generated
vendored
Normal file
3
node_modules/vite/node_modules/@esbuild/linux-x64/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# esbuild
|
||||
|
||||
This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||
BIN
node_modules/vite/node_modules/@esbuild/linux-x64/bin/esbuild
generated
vendored
Executable file
BIN
node_modules/vite/node_modules/@esbuild/linux-x64/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
17
node_modules/vite/node_modules/@esbuild/linux-x64/package.json
generated
vendored
Normal file
17
node_modules/vite/node_modules/@esbuild/linux-x64/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "@esbuild/linux-x64",
|
||||
"version": "0.18.14",
|
||||
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
|
||||
"repository": "https://github.com/evanw/esbuild",
|
||||
"license": "MIT",
|
||||
"preferUnplugged": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
21
node_modules/vite/node_modules/esbuild/LICENSE.md
generated
vendored
Normal file
21
node_modules/vite/node_modules/esbuild/LICENSE.md
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 Evan Wallace
|
||||
|
||||
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.
|
||||
3
node_modules/vite/node_modules/esbuild/README.md
generated
vendored
Normal file
3
node_modules/vite/node_modules/esbuild/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# esbuild
|
||||
|
||||
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||
221
node_modules/vite/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
221
node_modules/vite/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
|
|
@ -0,0 +1,221 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
|
||||
// lib/npm/node-platform.ts
|
||||
var fs = require("fs");
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
||||
var packageDarwin_x64 = "@esbuild/darwin-x64";
|
||||
var knownWindowsPackages = {
|
||||
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||
"win32 x64 LE": "@esbuild/win32-x64"
|
||||
};
|
||||
var knownUnixlikePackages = {
|
||||
"android arm64 LE": "@esbuild/android-arm64",
|
||||
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||
"linux arm LE": "@esbuild/linux-arm",
|
||||
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||
"linux s390x BE": "@esbuild/linux-s390x",
|
||||
"linux x64 LE": "@esbuild/linux-x64",
|
||||
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||
};
|
||||
var knownWebAssemblyFallbackPackages = {
|
||||
"android arm LE": "@esbuild/android-arm",
|
||||
"android x64 LE": "@esbuild/android-x64"
|
||||
};
|
||||
function pkgAndSubpathForCurrentPlatform() {
|
||||
let pkg;
|
||||
let subpath;
|
||||
let isWASM2 = false;
|
||||
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||
if (platformKey in knownWindowsPackages) {
|
||||
pkg = knownWindowsPackages[platformKey];
|
||||
subpath = "esbuild.exe";
|
||||
} else if (platformKey in knownUnixlikePackages) {
|
||||
pkg = knownUnixlikePackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
isWASM2 = true;
|
||||
} else {
|
||||
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||
}
|
||||
return { pkg, subpath, isWASM: isWASM2 };
|
||||
}
|
||||
function pkgForSomeOtherPlatform() {
|
||||
const libMainJS = require.resolve("esbuild");
|
||||
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
||||
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
||||
for (const unixKey in knownUnixlikePackages) {
|
||||
try {
|
||||
const pkg = knownUnixlikePackages[unixKey];
|
||||
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
||||
return pkg;
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
for (const windowsKey in knownWindowsPackages) {
|
||||
try {
|
||||
const pkg = knownWindowsPackages[windowsKey];
|
||||
if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
|
||||
return pkg;
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function downloadedBinPath(pkg, subpath) {
|
||||
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||
}
|
||||
function generateBinPath() {
|
||||
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
|
||||
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||
} else {
|
||||
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
||||
}
|
||||
}
|
||||
const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
|
||||
let binPath2;
|
||||
try {
|
||||
binPath2 = require.resolve(`${pkg}/${subpath}`);
|
||||
} catch (e) {
|
||||
binPath2 = downloadedBinPath(pkg, subpath);
|
||||
if (!fs.existsSync(binPath2)) {
|
||||
try {
|
||||
require.resolve(pkg);
|
||||
} catch {
|
||||
const otherPkg = pkgForSomeOtherPlatform();
|
||||
if (otherPkg) {
|
||||
let suggestions = `
|
||||
Specifically the "${otherPkg}" package is present but this platform
|
||||
needs the "${pkg}" package instead. People often get into this
|
||||
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
||||
into a Docker image that runs Linux, or by copying "node_modules" between
|
||||
Windows and WSL environments.
|
||||
|
||||
If you are installing with npm, you can try not copying the "node_modules"
|
||||
directory when you copy the files over, and running "npm ci" or "npm install"
|
||||
on the destination platform after the copy. Or you could consider using yarn
|
||||
instead of npm which has built-in support for installing a package on multiple
|
||||
platforms simultaneously.
|
||||
|
||||
If you are installing with yarn, you can try listing both this platform and the
|
||||
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
||||
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||
Keep in mind that this means multiple copies of esbuild will be present.
|
||||
`;
|
||||
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
||||
suggestions = `
|
||||
Specifically the "${otherPkg}" package is present but this platform
|
||||
needs the "${pkg}" package instead. People often get into this
|
||||
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
||||
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
||||
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
||||
|
||||
If you are installing with npm, you can try ensuring that both npm and node are
|
||||
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
||||
changing how you installed npm and/or node. For example, installing node with
|
||||
the universal installer here should work: https://nodejs.org/en/download/. Or
|
||||
you could consider using yarn instead of npm which has built-in support for
|
||||
installing a package on multiple platforms simultaneously.
|
||||
|
||||
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
||||
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
||||
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||
Keep in mind that this means multiple copies of esbuild will be present.
|
||||
`;
|
||||
}
|
||||
throw new Error(`
|
||||
You installed esbuild for another platform than the one you're currently using.
|
||||
This won't work because esbuild is written with native code and needs to
|
||||
install a platform-specific binary executable.
|
||||
${suggestions}
|
||||
Another alternative is to use the "esbuild-wasm" package instead, which works
|
||||
the same way on all platforms. But it comes with a heavy performance cost and
|
||||
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
||||
want to do that.
|
||||
`);
|
||||
}
|
||||
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
||||
|
||||
If you are installing esbuild with npm, make sure that you don't specify the
|
||||
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
||||
of "package.json" is used by esbuild to install the correct binary executable
|
||||
for your current platform.`);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
if (/\.zip\//.test(binPath2)) {
|
||||
let pnpapi;
|
||||
try {
|
||||
pnpapi = require("pnpapi");
|
||||
} catch (e) {
|
||||
}
|
||||
if (pnpapi) {
|
||||
const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
||||
const binTargetPath = path.join(
|
||||
root,
|
||||
"node_modules",
|
||||
".cache",
|
||||
"esbuild",
|
||||
`pnpapi-${pkg.replace("/", "-")}-${"0.18.14"}-${path.basename(subpath)}`
|
||||
);
|
||||
if (!fs.existsSync(binTargetPath)) {
|
||||
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
||||
fs.copyFileSync(binPath2, binTargetPath);
|
||||
fs.chmodSync(binTargetPath, 493);
|
||||
}
|
||||
return { binPath: binTargetPath, isWASM: isWASM2 };
|
||||
}
|
||||
}
|
||||
return { binPath: binPath2, isWASM: isWASM2 };
|
||||
}
|
||||
|
||||
// lib/npm/node-shim.ts
|
||||
var { binPath, isWASM } = generateBinPath();
|
||||
if (isWASM) {
|
||||
require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
|
||||
} else {
|
||||
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
||||
}
|
||||
287
node_modules/vite/node_modules/esbuild/install.js
generated
vendored
Normal file
287
node_modules/vite/node_modules/esbuild/install.js
generated
vendored
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
|
||||
// lib/npm/node-platform.ts
|
||||
var fs = require("fs");
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||
var knownWindowsPackages = {
|
||||
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||
"win32 x64 LE": "@esbuild/win32-x64"
|
||||
};
|
||||
var knownUnixlikePackages = {
|
||||
"android arm64 LE": "@esbuild/android-arm64",
|
||||
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||
"linux arm LE": "@esbuild/linux-arm",
|
||||
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||
"linux s390x BE": "@esbuild/linux-s390x",
|
||||
"linux x64 LE": "@esbuild/linux-x64",
|
||||
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||
};
|
||||
var knownWebAssemblyFallbackPackages = {
|
||||
"android arm LE": "@esbuild/android-arm",
|
||||
"android x64 LE": "@esbuild/android-x64"
|
||||
};
|
||||
function pkgAndSubpathForCurrentPlatform() {
|
||||
let pkg;
|
||||
let subpath;
|
||||
let isWASM = false;
|
||||
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||
if (platformKey in knownWindowsPackages) {
|
||||
pkg = knownWindowsPackages[platformKey];
|
||||
subpath = "esbuild.exe";
|
||||
} else if (platformKey in knownUnixlikePackages) {
|
||||
pkg = knownUnixlikePackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
isWASM = true;
|
||||
} else {
|
||||
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||
}
|
||||
return { pkg, subpath, isWASM };
|
||||
}
|
||||
function downloadedBinPath(pkg, subpath) {
|
||||
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||
}
|
||||
|
||||
// lib/npm/node-install.ts
|
||||
var fs2 = require("fs");
|
||||
var os2 = require("os");
|
||||
var path2 = require("path");
|
||||
var zlib = require("zlib");
|
||||
var https = require("https");
|
||||
var child_process = require("child_process");
|
||||
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
||||
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||
var isToPathJS = true;
|
||||
function validateBinaryVersion(...command) {
|
||||
command.push("--version");
|
||||
let stdout;
|
||||
try {
|
||||
stdout = child_process.execFileSync(command.shift(), command, {
|
||||
// Without this, this install script strangely crashes with the error
|
||||
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
||||
// installed from the Snap Store. This is not a problem when you download
|
||||
// the official version of node. The problem appears to be that stderr
|
||||
// (i.e. file descriptor 2) isn't writable?
|
||||
//
|
||||
// More info:
|
||||
// - https://snapcraft.io/ (what the Snap Store is)
|
||||
// - https://nodejs.org/dist/ (download the official version of node)
|
||||
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
||||
//
|
||||
stdio: "pipe"
|
||||
}).toString().trim();
|
||||
} catch (err) {
|
||||
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
||||
let os3 = "this version of macOS";
|
||||
try {
|
||||
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
||||
} catch {
|
||||
}
|
||||
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
||||
|
||||
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
||||
which means the "esbuild" binary executable can't be run. You can either:
|
||||
|
||||
* Update your version of macOS to one that the Go compiler supports
|
||||
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
||||
* Build esbuild yourself using an older version of the Go compiler
|
||||
`);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
if (stdout !== versionFromPackageJSON) {
|
||||
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
||||
}
|
||||
}
|
||||
function isYarn() {
|
||||
const { npm_config_user_agent } = process.env;
|
||||
if (npm_config_user_agent) {
|
||||
return /\byarn\//.test(npm_config_user_agent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function fetch(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
https.get(url, (res) => {
|
||||
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||
return fetch(res.headers.location).then(resolve, reject);
|
||||
if (res.statusCode !== 200)
|
||||
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||
let chunks = [];
|
||||
res.on("data", (chunk) => chunks.push(chunk));
|
||||
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||
}).on("error", reject);
|
||||
});
|
||||
}
|
||||
function extractFileFromTarGzip(buffer, subpath) {
|
||||
try {
|
||||
buffer = zlib.unzipSync(buffer);
|
||||
} catch (err) {
|
||||
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||
}
|
||||
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||
let offset = 0;
|
||||
subpath = `package/${subpath}`;
|
||||
while (offset < buffer.length) {
|
||||
let name = str(offset, 100);
|
||||
let size = parseInt(str(offset + 124, 12), 8);
|
||||
offset += 512;
|
||||
if (!isNaN(size)) {
|
||||
if (name === subpath)
|
||||
return buffer.subarray(offset, offset + size);
|
||||
offset += size + 511 & ~511;
|
||||
}
|
||||
}
|
||||
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||
}
|
||||
function installUsingNPM(pkg, subpath, binPath) {
|
||||
const env = { ...process.env, npm_config_global: void 0 };
|
||||
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||
fs2.mkdirSync(installDir);
|
||||
try {
|
||||
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||
child_process.execSync(
|
||||
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
|
||||
{ cwd: installDir, stdio: "pipe", env }
|
||||
);
|
||||
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||
fs2.renameSync(installedBinPath, binPath);
|
||||
} finally {
|
||||
try {
|
||||
removeRecursive(installDir);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
function removeRecursive(dir) {
|
||||
for (const entry of fs2.readdirSync(dir)) {
|
||||
const entryPath = path2.join(dir, entry);
|
||||
let stats;
|
||||
try {
|
||||
stats = fs2.lstatSync(entryPath);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (stats.isDirectory())
|
||||
removeRecursive(entryPath);
|
||||
else
|
||||
fs2.unlinkSync(entryPath);
|
||||
}
|
||||
fs2.rmdirSync(dir);
|
||||
}
|
||||
function applyManualBinaryPathOverride(overridePath) {
|
||||
const pathString = JSON.stringify(overridePath);
|
||||
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||
`);
|
||||
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||
const code = fs2.readFileSync(libMain, "utf8");
|
||||
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||
${code}`);
|
||||
}
|
||||
function maybeOptimizePackage(binPath) {
|
||||
if (os2.platform() !== "win32" && !isYarn()) {
|
||||
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||
try {
|
||||
fs2.linkSync(binPath, tempPath);
|
||||
fs2.renameSync(tempPath, toPath);
|
||||
isToPathJS = false;
|
||||
fs2.unlinkSync(tempPath);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
|
||||
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||
try {
|
||||
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||
fs2.chmodSync(binPath, 493);
|
||||
} catch (e) {
|
||||
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async function checkAndPreparePackage() {
|
||||
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
||||
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||
} else {
|
||||
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||
let binPath;
|
||||
try {
|
||||
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||
} catch (e) {
|
||||
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||
|
||||
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||
package.json feature is used by esbuild to install the correct binary executable
|
||||
for your current platform. This install script will now attempt to work around
|
||||
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||
`);
|
||||
binPath = downloadedBinPath(pkg, subpath);
|
||||
try {
|
||||
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||
installUsingNPM(pkg, subpath, binPath);
|
||||
} catch (e2) {
|
||||
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||
try {
|
||||
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||
} catch (e3) {
|
||||
throw new Error(`Failed to install package "${pkg}"`);
|
||||
}
|
||||
}
|
||||
}
|
||||
maybeOptimizePackage(binPath);
|
||||
}
|
||||
checkAndPreparePackage().then(() => {
|
||||
if (isToPathJS) {
|
||||
validateBinaryVersion(process.execPath, toPath);
|
||||
} else {
|
||||
validateBinaryVersion(toPath);
|
||||
}
|
||||
});
|
||||
656
node_modules/vite/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
656
node_modules/vite/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,656 @@
|
|||
export type Platform = 'browser' | 'node' | 'neutral'
|
||||
export type Format = 'iife' | 'cjs' | 'esm'
|
||||
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
||||
export type Charset = 'ascii' | 'utf8'
|
||||
export type Drop = 'console' | 'debugger'
|
||||
|
||||
interface CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
||||
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
||||
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||
sourceRoot?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||
sourcesContent?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#format */
|
||||
format?: Format
|
||||
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||
globalName?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#target */
|
||||
target?: string | string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||
supported?: Record<string, boolean>
|
||||
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||
platform?: Platform
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleProps?: RegExp
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
reserveProps?: RegExp
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleQuoted?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleCache?: Record<string, string | false>
|
||||
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||
drop?: Drop[]
|
||||
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
||||
dropLabels?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minify?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyWhitespace?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyIdentifiers?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifySyntax?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
||||
lineLimit?: number
|
||||
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||
charset?: Charset
|
||||
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||
treeShaking?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||
ignoreAnnotations?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||
jsx?: 'transform' | 'preserve' | 'automatic'
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||
jsxFactory?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||
jsxFragment?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||
jsxImportSource?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||
jsxDev?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||
jsxSideEffects?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#define */
|
||||
define?: { [key: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||
pure?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||
keepNames?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#color */
|
||||
color?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||
logLevel?: LogLevel
|
||||
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||
logLimit?: number
|
||||
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||
logOverride?: Record<string, LogLevel>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||
tsconfigRaw?: string | {
|
||||
compilerOptions?: {
|
||||
alwaysStrict?: boolean
|
||||
baseUrl?: boolean
|
||||
experimentalDecorators?: boolean
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||
jsxFactory?: string
|
||||
jsxFragmentFactory?: string
|
||||
jsxImportSource?: string
|
||||
paths?: Record<string, string[]>
|
||||
preserveValueImports?: boolean
|
||||
strict?: boolean
|
||||
target?: string
|
||||
useDefineForClassFields?: boolean
|
||||
verbatimModuleSyntax?: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface BuildOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||
bundle?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||
splitting?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||
preserveSymlinks?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||
outfile?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
metafile?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||
outdir?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||
outbase?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#external */
|
||||
external?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#packages */
|
||||
packages?: 'external'
|
||||
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||
alias?: Record<string, string>
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: { [ext: string]: Loader }
|
||||
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||
resolveExtensions?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||
mainFields?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||
conditions?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#write */
|
||||
write?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||
allowOverwrite?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||
tsconfig?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||
outExtension?: { [ext: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||
publicPath?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||
entryNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||
chunkNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||
assetNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||
inject?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: { [type: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: { [type: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
||||
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||
stdin?: StdinOptions
|
||||
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||
plugins?: Plugin[]
|
||||
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||
absWorkingDir?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||
}
|
||||
|
||||
export interface StdinOptions {
|
||||
contents: string | Uint8Array
|
||||
resolveDir?: string
|
||||
sourcefile?: string
|
||||
loader?: Loader
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
id: string
|
||||
pluginName: string
|
||||
text: string
|
||||
location: Location | null
|
||||
notes: Note[]
|
||||
|
||||
/**
|
||||
* Optional user-specified data that is passed through unmodified. You can
|
||||
* use this to stash the original error, for example.
|
||||
*/
|
||||
detail: any
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
text: string
|
||||
location: Location | null
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
file: string
|
||||
namespace: string
|
||||
/** 1-based */
|
||||
line: number
|
||||
/** 0-based, in bytes */
|
||||
column: number
|
||||
/** in bytes */
|
||||
length: number
|
||||
lineText: string
|
||||
suggestion: string
|
||||
}
|
||||
|
||||
export interface OutputFile {
|
||||
path: string
|
||||
/** "text" as bytes */
|
||||
contents: Uint8Array
|
||||
/** "contents" as text (changes automatically with "contents") */
|
||||
readonly text: string
|
||||
}
|
||||
|
||||
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
/** Only when "write: false" */
|
||||
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||
/** Only when "metafile: true" */
|
||||
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
}
|
||||
|
||||
export interface BuildFailure extends Error {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||
export interface ServeOptions {
|
||||
port?: number
|
||||
host?: string
|
||||
servedir?: string
|
||||
keyfile?: string
|
||||
certfile?: string
|
||||
onRequest?: (args: ServeOnRequestArgs) => void
|
||||
}
|
||||
|
||||
export interface ServeOnRequestArgs {
|
||||
remoteAddress: string
|
||||
method: string
|
||||
path: string
|
||||
status: number
|
||||
/** The time to generate the response, not to send it */
|
||||
timeInMS: number
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||
export interface ServeResult {
|
||||
port: number
|
||||
host: string
|
||||
}
|
||||
|
||||
export interface TransformOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||
sourcefile?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: Loader
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: string
|
||||
}
|
||||
|
||||
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||
code: string
|
||||
map: string
|
||||
warnings: Message[]
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
/** Only when "legalComments" is "external" */
|
||||
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||
}
|
||||
|
||||
export interface TransformFailure extends Error {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string
|
||||
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||
}
|
||||
|
||||
export interface PluginBuild {
|
||||
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||
initialOptions: BuildOptions
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||
onStart(callback: () =>
|
||||
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||
onEnd(callback: (result: BuildResult) =>
|
||||
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||
onDispose(callback: () => void): void
|
||||
|
||||
// This is a full copy of the esbuild library in case you need it
|
||||
esbuild: {
|
||||
context: typeof context,
|
||||
build: typeof build,
|
||||
buildSync: typeof buildSync,
|
||||
transform: typeof transform,
|
||||
transformSync: typeof transformSync,
|
||||
formatMessages: typeof formatMessages,
|
||||
formatMessagesSync: typeof formatMessagesSync,
|
||||
analyzeMetafile: typeof analyzeMetafile,
|
||||
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||
initialize: typeof initialize,
|
||||
version: typeof version,
|
||||
}
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||
export interface ResolveOptions {
|
||||
pluginName?: string
|
||||
importer?: string
|
||||
namespace?: string
|
||||
resolveDir?: string
|
||||
kind?: ImportKind
|
||||
pluginData?: any
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||
export interface ResolveResult {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
|
||||
path: string
|
||||
external: boolean
|
||||
sideEffects: boolean
|
||||
namespace: string
|
||||
suffix: string
|
||||
pluginData: any
|
||||
}
|
||||
|
||||
export interface OnStartResult {
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
}
|
||||
|
||||
export interface OnEndResult {
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||
export interface OnResolveOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||
export interface OnResolveArgs {
|
||||
path: string
|
||||
importer: string
|
||||
namespace: string
|
||||
resolveDir: string
|
||||
kind: ImportKind
|
||||
pluginData: any
|
||||
}
|
||||
|
||||
export type ImportKind =
|
||||
| 'entry-point'
|
||||
|
||||
// JS
|
||||
| 'import-statement'
|
||||
| 'require-call'
|
||||
| 'dynamic-import'
|
||||
| 'require-resolve'
|
||||
|
||||
// CSS
|
||||
| 'import-rule'
|
||||
| 'url-token'
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||
export interface OnResolveResult {
|
||||
pluginName?: string
|
||||
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
|
||||
path?: string
|
||||
external?: boolean
|
||||
sideEffects?: boolean
|
||||
namespace?: string
|
||||
suffix?: string
|
||||
pluginData?: any
|
||||
|
||||
watchFiles?: string[]
|
||||
watchDirs?: string[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||
export interface OnLoadOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||
export interface OnLoadArgs {
|
||||
path: string
|
||||
namespace: string
|
||||
suffix: string
|
||||
pluginData: any
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||
export interface OnLoadResult {
|
||||
pluginName?: string
|
||||
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
|
||||
contents?: string | Uint8Array
|
||||
resolveDir?: string
|
||||
loader?: Loader
|
||||
pluginData?: any
|
||||
|
||||
watchFiles?: string[]
|
||||
watchDirs?: string[]
|
||||
}
|
||||
|
||||
export interface PartialMessage {
|
||||
id?: string
|
||||
pluginName?: string
|
||||
text?: string
|
||||
location?: Partial<Location> | null
|
||||
notes?: PartialNote[]
|
||||
detail?: any
|
||||
}
|
||||
|
||||
export interface PartialNote {
|
||||
text?: string
|
||||
location?: Partial<Location> | null
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
export interface Metafile {
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind
|
||||
external?: boolean
|
||||
original?: string
|
||||
}[]
|
||||
format?: 'cjs' | 'esm'
|
||||
}
|
||||
}
|
||||
outputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytesInOutput: number
|
||||
}
|
||||
}
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind | 'file-loader'
|
||||
external?: boolean
|
||||
}[]
|
||||
exports: string[]
|
||||
entryPoint?: string
|
||||
cssBundle?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface FormatMessagesOptions {
|
||||
kind: 'error' | 'warning'
|
||||
color?: boolean
|
||||
terminalWidth?: number
|
||||
}
|
||||
|
||||
export interface AnalyzeMetafileOptions {
|
||||
color?: boolean
|
||||
verbose?: boolean
|
||||
}
|
||||
|
||||
export interface WatchOptions {
|
||||
}
|
||||
|
||||
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||
watch(options?: WatchOptions): Promise<void>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||
serve(options?: ServeOptions): Promise<ServeResult>
|
||||
|
||||
cancel(): Promise<void>
|
||||
dispose(): Promise<void>
|
||||
}
|
||||
|
||||
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||
// that aren't in "Out" with "never". We use this to reject properties with
|
||||
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||
|
||||
/**
|
||||
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||
* "BuildFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||
|
||||
/**
|
||||
* This is the advanced long-running form of "build" that supports additional
|
||||
* features such as watch mode and a local development server.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||
|
||||
/**
|
||||
* This function transforms a single JavaScript file. It can be used to minify
|
||||
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||
* to older JavaScript. It returns a promise that is either resolved with a
|
||||
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform
|
||||
*/
|
||||
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||
|
||||
/**
|
||||
* Converts log messages to formatted message strings suitable for printing in
|
||||
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||
* log message formatter. This is a batch-oriented API for efficiency.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*/
|
||||
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
||||
|
||||
/**
|
||||
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||
* to customize it, you can just inspect the data in the metafile yourself.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
||||
|
||||
/**
|
||||
* A synchronous version of "build".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||
|
||||
/**
|
||||
* A synchronous version of "transform".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform
|
||||
*/
|
||||
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||
|
||||
/**
|
||||
* A synchronous version of "formatMessages".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*/
|
||||
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
||||
|
||||
/**
|
||||
* A synchronous version of "analyzeMetafile".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
||||
|
||||
/**
|
||||
* This configures the browser-based version of esbuild. It is necessary to
|
||||
* call this first and wait for the returned promise to be resolved before
|
||||
* making other API calls when using esbuild in the browser.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes ("options" is required)
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#browser
|
||||
*/
|
||||
export declare function initialize(options: InitializeOptions): Promise<void>
|
||||
|
||||
export interface InitializeOptions {
|
||||
/**
|
||||
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||
* esbuild in the browser.
|
||||
*/
|
||||
wasmURL?: string | URL
|
||||
|
||||
/**
|
||||
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||
* is a typed array or ArrayBuffer containing the binary code of the
|
||||
* "esbuild.wasm" file.
|
||||
*
|
||||
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||
* not possible to download the WebAssembly module.
|
||||
*/
|
||||
wasmModule?: WebAssembly.Module
|
||||
|
||||
/**
|
||||
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||
* to false.
|
||||
*/
|
||||
worker?: boolean
|
||||
}
|
||||
|
||||
export let version: string
|
||||
2389
node_modules/vite/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
2389
node_modules/vite/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
42
node_modules/vite/node_modules/esbuild/package.json
generated
vendored
Normal file
42
node_modules/vite/node_modules/esbuild/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "esbuild",
|
||||
"version": "0.18.14",
|
||||
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||
"repository": "https://github.com/evanw/esbuild",
|
||||
"scripts": {
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"main": "lib/main.js",
|
||||
"types": "lib/main.d.ts",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/android-arm": "0.18.14",
|
||||
"@esbuild/android-arm64": "0.18.14",
|
||||
"@esbuild/android-x64": "0.18.14",
|
||||
"@esbuild/darwin-arm64": "0.18.14",
|
||||
"@esbuild/darwin-x64": "0.18.14",
|
||||
"@esbuild/freebsd-arm64": "0.18.14",
|
||||
"@esbuild/freebsd-x64": "0.18.14",
|
||||
"@esbuild/linux-arm": "0.18.14",
|
||||
"@esbuild/linux-arm64": "0.18.14",
|
||||
"@esbuild/linux-ia32": "0.18.14",
|
||||
"@esbuild/linux-loong64": "0.18.14",
|
||||
"@esbuild/linux-mips64el": "0.18.14",
|
||||
"@esbuild/linux-ppc64": "0.18.14",
|
||||
"@esbuild/linux-riscv64": "0.18.14",
|
||||
"@esbuild/linux-s390x": "0.18.14",
|
||||
"@esbuild/linux-x64": "0.18.14",
|
||||
"@esbuild/netbsd-x64": "0.18.14",
|
||||
"@esbuild/openbsd-x64": "0.18.14",
|
||||
"@esbuild/sunos-x64": "0.18.14",
|
||||
"@esbuild/win32-arm64": "0.18.14",
|
||||
"@esbuild/win32-ia32": "0.18.14",
|
||||
"@esbuild/win32-x64": "0.18.14"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
170
node_modules/vite/package.json
generated
vendored
Normal file
170
node_modules/vite/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
{
|
||||
"name": "vite",
|
||||
"version": "4.4.4",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
"description": "Native-ESM powered web dev build tool",
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"keywords": [
|
||||
"frontend",
|
||||
"framework",
|
||||
"hmr",
|
||||
"dev-server",
|
||||
"build-tool",
|
||||
"vite"
|
||||
],
|
||||
"main": "./dist/node/index.js",
|
||||
"types": "./dist/node/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/node/index.d.ts",
|
||||
"import": "./dist/node/index.js",
|
||||
"require": "./index.cjs"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./client.d.ts"
|
||||
},
|
||||
"./dist/client/*": "./dist/client/*",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"dist",
|
||||
"client.d.ts",
|
||||
"index.cjs",
|
||||
"types"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^14.18.0 || >=16.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vitejs/vite.git",
|
||||
"directory": "packages/vite"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vitejs/vite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vitejs/vite/tree/main/#readme",
|
||||
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
||||
"scripts": {
|
||||
"dev": "rimraf dist && pnpm run build-bundle -w",
|
||||
"build": "rimraf dist && run-s build-bundle build-types",
|
||||
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
||||
"build-types": "run-s build-types-temp build-types-pre-patch build-types-roll build-types-post-patch build-types-check",
|
||||
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
|
||||
"build-types-pre-patch": "tsx scripts/prePatchTypes.ts",
|
||||
"build-types-roll": "tsx scripts/api-extractor.ts run && rimraf temp",
|
||||
"build-types-post-patch": "tsx scripts/postPatchTypes.ts",
|
||||
"build-types-check": "tsx scripts/checkBuiltTypes.ts && tsc --project tsconfig.check.json",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint --cache --ext .ts src/**",
|
||||
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.18.10",
|
||||
"postcss": "^8.4.25",
|
||||
"rollup": "^3.25.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ampproject/remapping": "^2.2.1",
|
||||
"@babel/parser": "^7.22.7",
|
||||
"@babel/types": "^7.22.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.18",
|
||||
"@rollup/plugin-alias": "^4.0.4",
|
||||
"@rollup/plugin-commonjs": "^25.0.2",
|
||||
"@rollup/plugin-dynamic-import-vars": "^2.0.4",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "15.1.0",
|
||||
"@rollup/plugin-typescript": "^11.1.2",
|
||||
"@rollup/pluginutils": "^5.0.2",
|
||||
"@types/pnpapi": "^0.0.2",
|
||||
"@types/escape-html": "^1.0.2",
|
||||
"acorn": "^8.10.0",
|
||||
"acorn-walk": "^8.2.0",
|
||||
"cac": "^6.7.14",
|
||||
"chokidar": "^3.5.3",
|
||||
"connect": "^3.7.0",
|
||||
"connect-history-api-fallback": "^2.0.0",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"debug": "^4.3.4",
|
||||
"dep-types": "link:./src/types",
|
||||
"dotenv": "^16.3.1",
|
||||
"dotenv-expand": "^9.0.0",
|
||||
"es-module-lexer": "^1.3.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"estree-walker": "^3.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fast-glob": "^3.3.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"json-stable-stringify": "^1.0.2",
|
||||
"launch-editor-middleware": "^2.6.0",
|
||||
"lightningcss": "^1.21.5",
|
||||
"magic-string": "^0.30.1",
|
||||
"micromatch": "^4.0.5",
|
||||
"mlly": "^1.4.0",
|
||||
"mrmime": "^1.0.1",
|
||||
"okie": "^1.0.1",
|
||||
"open": "^8.4.2",
|
||||
"parse5": "^7.1.2",
|
||||
"periscopic": "^3.1.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"picomatch": "^2.3.1",
|
||||
"postcss-import": "^15.1.0",
|
||||
"postcss-load-config": "^4.0.1",
|
||||
"postcss-modules": "^6.0.0",
|
||||
"resolve.exports": "^2.0.2",
|
||||
"rollup-plugin-license": "^3.0.1",
|
||||
"sirv": "^2.0.3",
|
||||
"source-map-support": "^0.5.21",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"strip-literal": "^1.0.1",
|
||||
"tsconfck": "^2.1.1",
|
||||
"tslib": "^2.6.0",
|
||||
"types": "link:./types",
|
||||
"ufo": "^1.1.2",
|
||||
"ws": "^8.13.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": ">= 14",
|
||||
"less": "*",
|
||||
"sass": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"terser": "^5.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"lightningcss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
35
node_modules/vite/types/customEvent.d.ts
generated
vendored
Normal file
35
node_modules/vite/types/customEvent.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import type {
|
||||
ErrorPayload,
|
||||
FullReloadPayload,
|
||||
PrunePayload,
|
||||
UpdatePayload,
|
||||
} from './hmrPayload'
|
||||
|
||||
export interface CustomEventMap {
|
||||
'vite:beforeUpdate': UpdatePayload
|
||||
'vite:afterUpdate': UpdatePayload
|
||||
'vite:beforePrune': PrunePayload
|
||||
'vite:beforeFullReload': FullReloadPayload
|
||||
'vite:error': ErrorPayload
|
||||
'vite:invalidate': InvalidatePayload
|
||||
'vite:ws:connect': WebSocketConnectionPayload
|
||||
'vite:ws:disconnect': WebSocketConnectionPayload
|
||||
}
|
||||
|
||||
export interface WebSocketConnectionPayload {
|
||||
/**
|
||||
* @experimental
|
||||
* We expose this instance experimentally to see potential usage.
|
||||
* This might be removed in the future if we didn't find reasonable use cases.
|
||||
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
||||
*/
|
||||
webSocket: WebSocket
|
||||
}
|
||||
|
||||
export interface InvalidatePayload {
|
||||
path: string
|
||||
message: string | undefined
|
||||
}
|
||||
|
||||
export type InferCustomEventPayload<T extends string> =
|
||||
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
||||
61
node_modules/vite/types/hmrPayload.d.ts
generated
vendored
Normal file
61
node_modules/vite/types/hmrPayload.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
export type HMRPayload =
|
||||
| ConnectedPayload
|
||||
| UpdatePayload
|
||||
| FullReloadPayload
|
||||
| CustomPayload
|
||||
| ErrorPayload
|
||||
| PrunePayload
|
||||
|
||||
export interface ConnectedPayload {
|
||||
type: 'connected'
|
||||
}
|
||||
|
||||
export interface UpdatePayload {
|
||||
type: 'update'
|
||||
updates: Update[]
|
||||
}
|
||||
|
||||
export interface Update {
|
||||
type: 'js-update' | 'css-update'
|
||||
path: string
|
||||
acceptedPath: string
|
||||
timestamp: number
|
||||
/**
|
||||
* @experimental internal
|
||||
*/
|
||||
explicitImportRequired?: boolean | undefined
|
||||
}
|
||||
|
||||
export interface PrunePayload {
|
||||
type: 'prune'
|
||||
paths: string[]
|
||||
}
|
||||
|
||||
export interface FullReloadPayload {
|
||||
type: 'full-reload'
|
||||
path?: string
|
||||
}
|
||||
|
||||
export interface CustomPayload {
|
||||
type: 'custom'
|
||||
event: string
|
||||
data?: any
|
||||
}
|
||||
|
||||
export interface ErrorPayload {
|
||||
type: 'error'
|
||||
err: {
|
||||
[name: string]: any
|
||||
message: string
|
||||
stack: string
|
||||
id?: string
|
||||
frame?: string
|
||||
plugin?: string
|
||||
pluginCode?: string
|
||||
loc?: {
|
||||
file?: string
|
||||
line: number
|
||||
column: number
|
||||
}
|
||||
}
|
||||
}
|
||||
32
node_modules/vite/types/hot.d.ts
generated
vendored
Normal file
32
node_modules/vite/types/hot.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import type { InferCustomEventPayload } from './customEvent'
|
||||
|
||||
export type ModuleNamespace = Record<string, any> & {
|
||||
[Symbol.toStringTag]: 'Module'
|
||||
}
|
||||
|
||||
export interface ViteHotContext {
|
||||
readonly data: any
|
||||
|
||||
accept(): void
|
||||
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
||||
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
||||
accept(
|
||||
deps: readonly string[],
|
||||
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
||||
): void
|
||||
|
||||
acceptExports(
|
||||
exportNames: string | readonly string[],
|
||||
cb?: (mod: ModuleNamespace | undefined) => void,
|
||||
): void
|
||||
|
||||
dispose(cb: (data: any) => void): void
|
||||
prune(cb: (data: any) => void): void
|
||||
invalidate(message?: string): void
|
||||
|
||||
on<T extends string>(
|
||||
event: T,
|
||||
cb: (payload: InferCustomEventPayload<T>) => void,
|
||||
): void
|
||||
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
||||
}
|
||||
97
node_modules/vite/types/importGlob.d.ts
generated
vendored
Normal file
97
node_modules/vite/types/importGlob.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
export interface ImportGlobOptions<
|
||||
Eager extends boolean,
|
||||
AsType extends string,
|
||||
> {
|
||||
/**
|
||||
* Import type for the import url.
|
||||
*/
|
||||
as?: AsType
|
||||
/**
|
||||
* Import as static or dynamic
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
eager?: Eager
|
||||
/**
|
||||
* Import only the specific named export. Set to `default` to import the default export.
|
||||
*/
|
||||
import?: string
|
||||
/**
|
||||
* Custom queries
|
||||
*/
|
||||
query?: string | Record<string, string | number | boolean>
|
||||
/**
|
||||
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
exhaustive?: boolean
|
||||
}
|
||||
|
||||
export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
|
||||
|
||||
export interface KnownAsTypeMap {
|
||||
raw: string
|
||||
url: string
|
||||
worker: Worker
|
||||
}
|
||||
|
||||
export interface ImportGlobFunction {
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 1: No generic provided, infer the type from `eager` and `as`
|
||||
*/
|
||||
<
|
||||
Eager extends boolean,
|
||||
As extends string,
|
||||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
|
||||
>(
|
||||
glob: string | string[],
|
||||
options?: ImportGlobOptions<Eager, As>,
|
||||
): (Eager extends true ? true : false) extends true
|
||||
? Record<string, T>
|
||||
: Record<string, () => Promise<T>>
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 2: Module generic provided, infer the type from `eager: false`
|
||||
*/
|
||||
<M>(
|
||||
glob: string | string[],
|
||||
options?: ImportGlobOptions<false, string>,
|
||||
): Record<string, () => Promise<M>>
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 3: Module generic provided, infer the type from `eager: true`
|
||||
*/
|
||||
<M>(
|
||||
glob: string | string[],
|
||||
options: ImportGlobOptions<true, string>,
|
||||
): Record<string, M>
|
||||
}
|
||||
|
||||
export interface ImportGlobEagerFunction {
|
||||
/**
|
||||
* Eagerly import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 1: No generic provided, infer the type from `as`
|
||||
*/
|
||||
<
|
||||
As extends string,
|
||||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
|
||||
>(
|
||||
glob: string | string[],
|
||||
options?: Omit<ImportGlobOptions<boolean, As>, 'eager'>,
|
||||
): Record<string, T>
|
||||
/**
|
||||
* Eagerly import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 2: Module generic provided
|
||||
*/
|
||||
<M>(
|
||||
glob: string | string[],
|
||||
options?: Omit<ImportGlobOptions<boolean, string>, 'eager'>,
|
||||
): Record<string, M>
|
||||
}
|
||||
28
node_modules/vite/types/importMeta.d.ts
generated
vendored
Normal file
28
node_modules/vite/types/importMeta.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// This file is an augmentation to the built-in ImportMeta interface
|
||||
// Thus cannot contain any top-level imports
|
||||
// <https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation>
|
||||
|
||||
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
||||
|
||||
interface ImportMetaEnv {
|
||||
[key: string]: any
|
||||
BASE_URL: string
|
||||
MODE: string
|
||||
DEV: boolean
|
||||
PROD: boolean
|
||||
SSR: boolean
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url: string
|
||||
|
||||
readonly hot?: import('./hot').ViteHotContext
|
||||
|
||||
readonly env: ImportMetaEnv
|
||||
|
||||
glob: import('./importGlob').ImportGlobFunction
|
||||
/**
|
||||
* @deprecated Use `import.meta.glob('*', { eager: true })` instead
|
||||
*/
|
||||
globEager: import('./importGlob').ImportGlobEagerFunction
|
||||
}
|
||||
10
node_modules/vite/types/metadata.d.ts
generated
vendored
Normal file
10
node_modules/vite/types/metadata.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export interface ChunkMetadata {
|
||||
importedAssets: Set<string>
|
||||
importedCss: Set<string>
|
||||
}
|
||||
|
||||
declare module 'rollup' {
|
||||
export interface RenderedChunk {
|
||||
viteMetadata?: ChunkMetadata
|
||||
}
|
||||
}
|
||||
4
node_modules/vite/types/package.json
generated
vendored
Normal file
4
node_modules/vite/types/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"//": "this file is here to make typescript happy when moduleResolution=node16+",
|
||||
"version": "0.0.0"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue