vite 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0__default from 'fs';
|
|
2
2
|
import require$$0 from 'postcss';
|
|
3
|
-
import { E as commonjsGlobal } from './dep-
|
|
3
|
+
import { E as commonjsGlobal } from './dep-7efa13d7.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
|
@@ -12214,7 +12214,7 @@ function windowsMappedRealpathSync(path) {
|
|
|
12214
12214
|
}
|
|
12215
12215
|
return realPath;
|
|
12216
12216
|
}
|
|
12217
|
-
const parseNetUseRE = /^(\w+) +(\w:) +([^ ]+)\s/;
|
|
12217
|
+
const parseNetUseRE = /^(\w+)? +(\w:) +([^ ]+)\s/;
|
|
12218
12218
|
let firstSafeRealPathSyncRun = false;
|
|
12219
12219
|
function windowsSafeRealPathSync(path) {
|
|
12220
12220
|
if (!firstSafeRealPathSyncRun) {
|
|
@@ -12224,6 +12224,12 @@ function windowsSafeRealPathSync(path) {
|
|
|
12224
12224
|
return fs$l.realpathSync(path);
|
|
12225
12225
|
}
|
|
12226
12226
|
function optimizeSafeRealPathSync() {
|
|
12227
|
+
// Skip if using Node <16.18 due to MAX_PATH issue: https://github.com/vitejs/vite/issues/12931
|
|
12228
|
+
const nodeVersion = process.versions.node.split('.').map(Number);
|
|
12229
|
+
if (nodeVersion[0] < 16 || (nodeVersion[0] === 16 && nodeVersion[1] < 18)) {
|
|
12230
|
+
safeRealpathSync = fs$l.realpathSync;
|
|
12231
|
+
return;
|
|
12232
|
+
}
|
|
12227
12233
|
exec('net use', (error, stdout) => {
|
|
12228
12234
|
if (error)
|
|
12229
12235
|
return;
|
|
@@ -13012,7 +13018,7 @@ function buildReporterPlugin(config) {
|
|
|
13012
13018
|
},
|
|
13013
13019
|
closeBundle() {
|
|
13014
13020
|
if (shouldLogInfo && !config.build.watch) {
|
|
13015
|
-
config.logger.info(`${picocolorsExports.green(
|
|
13021
|
+
config.logger.info(`${picocolorsExports.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
|
13016
13022
|
}
|
|
13017
13023
|
},
|
|
13018
13024
|
};
|
|
@@ -23368,34 +23374,28 @@ function packageEntryFailure(id, details) {
|
|
|
23368
23374
|
`The package may have incorrect main/module/exports specified in its package.json` +
|
|
23369
23375
|
(details ? ': ' + details : '.'));
|
|
23370
23376
|
}
|
|
23371
|
-
const conditionalConditions = new Set(['production', 'development', 'module']);
|
|
23372
23377
|
function resolveExportsOrImports(pkg, key, options, targetWeb, type) {
|
|
23373
|
-
const
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23379
|
-
|
|
23380
|
-
|
|
23381
|
-
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
conditions.push(...options.overrideConditions.filter((condition) => conditionalConditions.has(condition)));
|
|
23391
|
-
}
|
|
23392
|
-
else if (options.conditions.length > 0) {
|
|
23393
|
-
conditions.push(...options.conditions);
|
|
23394
|
-
}
|
|
23378
|
+
const additionalConditions = new Set(options.overrideConditions || [
|
|
23379
|
+
'production',
|
|
23380
|
+
'development',
|
|
23381
|
+
'module',
|
|
23382
|
+
...options.conditions,
|
|
23383
|
+
]);
|
|
23384
|
+
const conditions = [...additionalConditions].filter((condition) => {
|
|
23385
|
+
switch (condition) {
|
|
23386
|
+
case 'production':
|
|
23387
|
+
return options.isProduction;
|
|
23388
|
+
case 'development':
|
|
23389
|
+
return !options.isProduction;
|
|
23390
|
+
case 'module':
|
|
23391
|
+
return !options.isRequire;
|
|
23392
|
+
}
|
|
23393
|
+
return true;
|
|
23394
|
+
});
|
|
23395
23395
|
const fn = type === 'imports' ? f : o;
|
|
23396
23396
|
const result = fn(pkg, key, {
|
|
23397
|
-
browser: targetWeb && !
|
|
23398
|
-
require: options.isRequire && !
|
|
23397
|
+
browser: targetWeb && !additionalConditions.has('node'),
|
|
23398
|
+
require: options.isRequire && !additionalConditions.has('import'),
|
|
23399
23399
|
conditions,
|
|
23400
23400
|
});
|
|
23401
23401
|
return result ? result[0] : undefined;
|
|
@@ -37085,7 +37085,7 @@ function traverseNodes(node, visitor) {
|
|
|
37085
37085
|
}
|
|
37086
37086
|
async function traverseHtml(html, filePath, visitor) {
|
|
37087
37087
|
// lazy load compiler
|
|
37088
|
-
const { parse } = await import('./dep-
|
|
37088
|
+
const { parse } = await import('./dep-f0c7dae0.js');
|
|
37089
37089
|
const ast = parse(html, {
|
|
37090
37090
|
scriptingEnabled: false,
|
|
37091
37091
|
sourceCodeLocationInfo: true,
|
|
@@ -38564,7 +38564,7 @@ function createCachedImport(imp) {
|
|
|
38564
38564
|
};
|
|
38565
38565
|
}
|
|
38566
38566
|
const importPostcssImport = createCachedImport(() => import('./dep-e3f470e2.js').then(function (n) { return n.i; }));
|
|
38567
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38567
|
+
const importPostcssModules = createCachedImport(() => import('./dep-11cf3f0f.js').then(function (n) { return n.i; }));
|
|
38568
38568
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38569
38569
|
/**
|
|
38570
38570
|
* @experimental
|
|
@@ -41271,8 +41271,6 @@ function webWorkerPlugin(config) {
|
|
|
41271
41271
|
return '';
|
|
41272
41272
|
}
|
|
41273
41273
|
},
|
|
41274
|
-
// @ts-expect-error return void to fallback to other plugins, even though
|
|
41275
|
-
// the types doesn't allow it. https://github.com/rollup/rollup/pull/4932
|
|
41276
41274
|
shouldTransformCachedModule({ id }) {
|
|
41277
41275
|
if (isBuild && isWorkerQueryId(id) && config.build.watch) {
|
|
41278
41276
|
return true;
|
|
@@ -53272,10 +53270,6 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53272
53270
|
const file = cleanUrl(id);
|
|
53273
53271
|
let code = null;
|
|
53274
53272
|
let map = null;
|
|
53275
|
-
// Ensure that the module is in the graph before it is loaded and the file is checked.
|
|
53276
|
-
// This prevents errors from occurring during the load process and interrupting the watching process at its inception.
|
|
53277
|
-
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53278
|
-
ensureWatchedFile(watcher, mod.file, root);
|
|
53279
53273
|
// load
|
|
53280
53274
|
const loadStart = debugLoad ? performance$1.now() : 0;
|
|
53281
53275
|
const loadResult = await pluginContainer.load(id, { ssr });
|
|
@@ -53340,6 +53334,9 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53340
53334
|
err.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL;
|
|
53341
53335
|
throw err;
|
|
53342
53336
|
}
|
|
53337
|
+
// ensure module in graph after successful load
|
|
53338
|
+
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53339
|
+
ensureWatchedFile(watcher, mod.file, root);
|
|
53343
53340
|
// transform
|
|
53344
53341
|
const transformStart = debugTransform ? performance$1.now() : 0;
|
|
53345
53342
|
const transformResult = await pluginContainer.transform(code, id, {
|
|
@@ -53703,6 +53700,7 @@ const ssrImportKey = `__vite_ssr_import__`;
|
|
|
53703
53700
|
const ssrDynamicImportKey = `__vite_ssr_dynamic_import__`;
|
|
53704
53701
|
const ssrExportAllKey = `__vite_ssr_exportAll__`;
|
|
53705
53702
|
const ssrImportMetaKey = `__vite_ssr_import_meta__`;
|
|
53703
|
+
const hashbangRE = /^#!.*\n/;
|
|
53706
53704
|
async function ssrTransform(code, inMap, url, originalCode, options) {
|
|
53707
53705
|
if (options?.json?.stringify && isJSONRequest(url)) {
|
|
53708
53706
|
return ssrTransformJSON(code, inMap);
|
|
@@ -53739,12 +53737,14 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
53739
53737
|
const dynamicDeps = new Set();
|
|
53740
53738
|
const idToImportMap = new Map();
|
|
53741
53739
|
const declaredConst = new Set();
|
|
53740
|
+
// hoist at the start of the file, after the hashbang
|
|
53741
|
+
const hoistIndex = code.match(hashbangRE)?.[0].length ?? 0;
|
|
53742
53742
|
function defineImport(source) {
|
|
53743
53743
|
deps.add(source);
|
|
53744
53744
|
const importId = `__vite_ssr_import_${uid++}__`;
|
|
53745
53745
|
// There will be an error if the module is called before it is imported,
|
|
53746
53746
|
// so the module import statement is hoisted to the top
|
|
53747
|
-
s.appendLeft(
|
|
53747
|
+
s.appendLeft(hoistIndex, `const ${importId} = await ${ssrImportKey}(${JSON.stringify(source)});\n`);
|
|
53748
53748
|
return importId;
|
|
53749
53749
|
}
|
|
53750
53750
|
function defineExport(position, name, local = name) {
|
|
@@ -53801,7 +53801,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
53801
53801
|
const importId = defineImport(node.source.value);
|
|
53802
53802
|
// hoist re-exports near the defined import so they are immediately exported
|
|
53803
53803
|
for (const spec of node.specifiers) {
|
|
53804
|
-
defineExport(
|
|
53804
|
+
defineExport(hoistIndex, spec.exported.name, `${importId}.${spec.local.name}`);
|
|
53805
53805
|
}
|
|
53806
53806
|
}
|
|
53807
53807
|
else {
|
|
@@ -53839,10 +53839,10 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
53839
53839
|
const importId = defineImport(node.source.value);
|
|
53840
53840
|
// hoist re-exports near the defined import so they are immediately exported
|
|
53841
53841
|
if (node.exported) {
|
|
53842
|
-
defineExport(
|
|
53842
|
+
defineExport(hoistIndex, node.exported.name, `${importId}`);
|
|
53843
53843
|
}
|
|
53844
53844
|
else {
|
|
53845
|
-
s.appendLeft(
|
|
53845
|
+
s.appendLeft(hoistIndex, `${ssrExportAllKey}(${importId});\n`);
|
|
53846
53846
|
}
|
|
53847
53847
|
}
|
|
53848
53848
|
}
|
|
@@ -353,12 +353,6 @@ function getTokenAttr(token, attrName) {
|
|
|
353
353
|
return null;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
var token = {
|
|
357
|
-
__proto__: null,
|
|
358
|
-
get TokenType () { return TokenType; },
|
|
359
|
-
getTokenAttr: getTokenAttr
|
|
360
|
-
};
|
|
361
|
-
|
|
362
356
|
// Generated using scripts/write-decode-map.ts
|
|
363
357
|
var htmlDecodeTree = new Uint16Array(
|
|
364
358
|
// prettier-ignore
|
|
@@ -935,31 +929,6 @@ const SPECIAL_ELEMENTS = {
|
|
|
935
929
|
function isNumberedHeader(tn) {
|
|
936
930
|
return tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6;
|
|
937
931
|
}
|
|
938
|
-
const UNESCAPED_TEXT = new Set([
|
|
939
|
-
TAG_NAMES.STYLE,
|
|
940
|
-
TAG_NAMES.SCRIPT,
|
|
941
|
-
TAG_NAMES.XMP,
|
|
942
|
-
TAG_NAMES.IFRAME,
|
|
943
|
-
TAG_NAMES.NOEMBED,
|
|
944
|
-
TAG_NAMES.NOFRAMES,
|
|
945
|
-
TAG_NAMES.PLAINTEXT,
|
|
946
|
-
]);
|
|
947
|
-
function hasUnescapedText(tn, scriptingEnabled) {
|
|
948
|
-
return UNESCAPED_TEXT.has(tn) || (scriptingEnabled && tn === TAG_NAMES.NOSCRIPT);
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
var html = {
|
|
952
|
-
__proto__: null,
|
|
953
|
-
get ATTRS () { return ATTRS; },
|
|
954
|
-
get DOCUMENT_MODE () { return DOCUMENT_MODE; },
|
|
955
|
-
get NS () { return NS; },
|
|
956
|
-
SPECIAL_ELEMENTS: SPECIAL_ELEMENTS,
|
|
957
|
-
get TAG_ID () { return TAG_ID; },
|
|
958
|
-
get TAG_NAMES () { return TAG_NAMES; },
|
|
959
|
-
getTagID: getTagID,
|
|
960
|
-
hasUnescapedText: hasUnescapedText,
|
|
961
|
-
isNumberedHeader: isNumberedHeader
|
|
962
|
-
};
|
|
963
932
|
|
|
964
933
|
//C1 Unicode control character reference replacements
|
|
965
934
|
const C1_CONTROLS_REFERENCE_REPLACEMENTS = new Map([
|
|
@@ -4794,17 +4763,6 @@ function isIntegrationPoint(tn, ns, attrs, foreignNS) {
|
|
|
4794
4763
|
((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)));
|
|
4795
4764
|
}
|
|
4796
4765
|
|
|
4797
|
-
var foreignContent = {
|
|
4798
|
-
__proto__: null,
|
|
4799
|
-
SVG_TAG_NAMES_ADJUSTMENT_MAP: SVG_TAG_NAMES_ADJUSTMENT_MAP,
|
|
4800
|
-
adjustTokenMathMLAttrs: adjustTokenMathMLAttrs,
|
|
4801
|
-
adjustTokenSVGAttrs: adjustTokenSVGAttrs,
|
|
4802
|
-
adjustTokenSVGTagName: adjustTokenSVGTagName,
|
|
4803
|
-
adjustTokenXMLAttrs: adjustTokenXMLAttrs,
|
|
4804
|
-
causesExit: causesExit,
|
|
4805
|
-
isIntegrationPoint: isIntegrationPoint
|
|
4806
|
-
};
|
|
4807
|
-
|
|
4808
4766
|
//Misc constants
|
|
4809
4767
|
const HIDDEN_INPUT_TYPE = 'hidden';
|
|
4810
4768
|
//Adoption agency loops iteration count
|
|
@@ -7947,212 +7905,6 @@ function endTagInForeignContent(p, token) {
|
|
|
7947
7905
|
}
|
|
7948
7906
|
}
|
|
7949
7907
|
|
|
7950
|
-
function getEscaper(regex, map) {
|
|
7951
|
-
return function escape(data) {
|
|
7952
|
-
let match;
|
|
7953
|
-
let lastIdx = 0;
|
|
7954
|
-
let result = "";
|
|
7955
|
-
while ((match = regex.exec(data))) {
|
|
7956
|
-
if (lastIdx !== match.index) {
|
|
7957
|
-
result += data.substring(lastIdx, match.index);
|
|
7958
|
-
}
|
|
7959
|
-
// We know that this chararcter will be in the map.
|
|
7960
|
-
result += map.get(match[0].charCodeAt(0));
|
|
7961
|
-
// Every match will be of length 1
|
|
7962
|
-
lastIdx = match.index + 1;
|
|
7963
|
-
}
|
|
7964
|
-
return result + data.substring(lastIdx);
|
|
7965
|
-
};
|
|
7966
|
-
}
|
|
7967
|
-
/**
|
|
7968
|
-
* Encodes all characters that have to be escaped in HTML attributes,
|
|
7969
|
-
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
|
|
7970
|
-
*
|
|
7971
|
-
* @param data String to escape.
|
|
7972
|
-
*/
|
|
7973
|
-
const escapeAttribute = getEscaper(/["&\u00A0]/g, new Map([
|
|
7974
|
-
[34, """],
|
|
7975
|
-
[38, "&"],
|
|
7976
|
-
[160, " "],
|
|
7977
|
-
]));
|
|
7978
|
-
/**
|
|
7979
|
-
* Encodes all characters that have to be escaped in HTML text,
|
|
7980
|
-
* following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.
|
|
7981
|
-
*
|
|
7982
|
-
* @param data String to escape.
|
|
7983
|
-
*/
|
|
7984
|
-
const escapeText = getEscaper(/[&<>\u00A0]/g, new Map([
|
|
7985
|
-
[38, "&"],
|
|
7986
|
-
[60, "<"],
|
|
7987
|
-
[62, ">"],
|
|
7988
|
-
[160, " "],
|
|
7989
|
-
]));
|
|
7990
|
-
|
|
7991
|
-
// Sets
|
|
7992
|
-
const VOID_ELEMENTS = new Set([
|
|
7993
|
-
TAG_NAMES.AREA,
|
|
7994
|
-
TAG_NAMES.BASE,
|
|
7995
|
-
TAG_NAMES.BASEFONT,
|
|
7996
|
-
TAG_NAMES.BGSOUND,
|
|
7997
|
-
TAG_NAMES.BR,
|
|
7998
|
-
TAG_NAMES.COL,
|
|
7999
|
-
TAG_NAMES.EMBED,
|
|
8000
|
-
TAG_NAMES.FRAME,
|
|
8001
|
-
TAG_NAMES.HR,
|
|
8002
|
-
TAG_NAMES.IMG,
|
|
8003
|
-
TAG_NAMES.INPUT,
|
|
8004
|
-
TAG_NAMES.KEYGEN,
|
|
8005
|
-
TAG_NAMES.LINK,
|
|
8006
|
-
TAG_NAMES.META,
|
|
8007
|
-
TAG_NAMES.PARAM,
|
|
8008
|
-
TAG_NAMES.SOURCE,
|
|
8009
|
-
TAG_NAMES.TRACK,
|
|
8010
|
-
TAG_NAMES.WBR,
|
|
8011
|
-
]);
|
|
8012
|
-
function isVoidElement(node, options) {
|
|
8013
|
-
return (options.treeAdapter.isElementNode(node) &&
|
|
8014
|
-
options.treeAdapter.getNamespaceURI(node) === NS.HTML &&
|
|
8015
|
-
VOID_ELEMENTS.has(options.treeAdapter.getTagName(node)));
|
|
8016
|
-
}
|
|
8017
|
-
const defaultOpts = { treeAdapter: defaultTreeAdapter, scriptingEnabled: true };
|
|
8018
|
-
/**
|
|
8019
|
-
* Serializes an AST node to an HTML string.
|
|
8020
|
-
*
|
|
8021
|
-
* @example
|
|
8022
|
-
*
|
|
8023
|
-
* ```js
|
|
8024
|
-
* const parse5 = require('parse5');
|
|
8025
|
-
*
|
|
8026
|
-
* const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>');
|
|
8027
|
-
*
|
|
8028
|
-
* // Serializes a document.
|
|
8029
|
-
* const html = parse5.serialize(document);
|
|
8030
|
-
*
|
|
8031
|
-
* // Serializes the <html> element content.
|
|
8032
|
-
* const str = parse5.serialize(document.childNodes[1]);
|
|
8033
|
-
*
|
|
8034
|
-
* console.log(str); //> '<head></head><body>Hi there!</body>'
|
|
8035
|
-
* ```
|
|
8036
|
-
*
|
|
8037
|
-
* @param node Node to serialize.
|
|
8038
|
-
* @param options Serialization options.
|
|
8039
|
-
*/
|
|
8040
|
-
function serialize(node, options) {
|
|
8041
|
-
const opts = { ...defaultOpts, ...options };
|
|
8042
|
-
if (isVoidElement(node, opts)) {
|
|
8043
|
-
return '';
|
|
8044
|
-
}
|
|
8045
|
-
return serializeChildNodes(node, opts);
|
|
8046
|
-
}
|
|
8047
|
-
/**
|
|
8048
|
-
* Serializes an AST element node to an HTML string, including the element node.
|
|
8049
|
-
*
|
|
8050
|
-
* @example
|
|
8051
|
-
*
|
|
8052
|
-
* ```js
|
|
8053
|
-
* const parse5 = require('parse5');
|
|
8054
|
-
*
|
|
8055
|
-
* const document = parse5.parseFragment('<div>Hello, <b>world</b>!</div>');
|
|
8056
|
-
*
|
|
8057
|
-
* // Serializes the <div> element.
|
|
8058
|
-
* const html = parse5.serializeOuter(document.childNodes[0]);
|
|
8059
|
-
*
|
|
8060
|
-
* console.log(str); //> '<div>Hello, <b>world</b>!</div>'
|
|
8061
|
-
* ```
|
|
8062
|
-
*
|
|
8063
|
-
* @param node Node to serialize.
|
|
8064
|
-
* @param options Serialization options.
|
|
8065
|
-
*/
|
|
8066
|
-
function serializeOuter(node, options) {
|
|
8067
|
-
const opts = { ...defaultOpts, ...options };
|
|
8068
|
-
return serializeNode(node, opts);
|
|
8069
|
-
}
|
|
8070
|
-
function serializeChildNodes(parentNode, options) {
|
|
8071
|
-
let html = '';
|
|
8072
|
-
// Get container of the child nodes
|
|
8073
|
-
const container = options.treeAdapter.isElementNode(parentNode) &&
|
|
8074
|
-
options.treeAdapter.getTagName(parentNode) === TAG_NAMES.TEMPLATE &&
|
|
8075
|
-
options.treeAdapter.getNamespaceURI(parentNode) === NS.HTML
|
|
8076
|
-
? options.treeAdapter.getTemplateContent(parentNode)
|
|
8077
|
-
: parentNode;
|
|
8078
|
-
const childNodes = options.treeAdapter.getChildNodes(container);
|
|
8079
|
-
if (childNodes) {
|
|
8080
|
-
for (const currentNode of childNodes) {
|
|
8081
|
-
html += serializeNode(currentNode, options);
|
|
8082
|
-
}
|
|
8083
|
-
}
|
|
8084
|
-
return html;
|
|
8085
|
-
}
|
|
8086
|
-
function serializeNode(node, options) {
|
|
8087
|
-
if (options.treeAdapter.isElementNode(node)) {
|
|
8088
|
-
return serializeElement(node, options);
|
|
8089
|
-
}
|
|
8090
|
-
if (options.treeAdapter.isTextNode(node)) {
|
|
8091
|
-
return serializeTextNode(node, options);
|
|
8092
|
-
}
|
|
8093
|
-
if (options.treeAdapter.isCommentNode(node)) {
|
|
8094
|
-
return serializeCommentNode(node, options);
|
|
8095
|
-
}
|
|
8096
|
-
if (options.treeAdapter.isDocumentTypeNode(node)) {
|
|
8097
|
-
return serializeDocumentTypeNode(node, options);
|
|
8098
|
-
}
|
|
8099
|
-
// Return an empty string for unknown nodes
|
|
8100
|
-
return '';
|
|
8101
|
-
}
|
|
8102
|
-
function serializeElement(node, options) {
|
|
8103
|
-
const tn = options.treeAdapter.getTagName(node);
|
|
8104
|
-
return `<${tn}${serializeAttributes(node, options)}>${isVoidElement(node, options) ? '' : `${serializeChildNodes(node, options)}</${tn}>`}`;
|
|
8105
|
-
}
|
|
8106
|
-
function serializeAttributes(node, { treeAdapter }) {
|
|
8107
|
-
let html = '';
|
|
8108
|
-
for (const attr of treeAdapter.getAttrList(node)) {
|
|
8109
|
-
html += ' ';
|
|
8110
|
-
if (!attr.namespace) {
|
|
8111
|
-
html += attr.name;
|
|
8112
|
-
}
|
|
8113
|
-
else
|
|
8114
|
-
switch (attr.namespace) {
|
|
8115
|
-
case NS.XML: {
|
|
8116
|
-
html += `xml:${attr.name}`;
|
|
8117
|
-
break;
|
|
8118
|
-
}
|
|
8119
|
-
case NS.XMLNS: {
|
|
8120
|
-
if (attr.name !== 'xmlns') {
|
|
8121
|
-
html += 'xmlns:';
|
|
8122
|
-
}
|
|
8123
|
-
html += attr.name;
|
|
8124
|
-
break;
|
|
8125
|
-
}
|
|
8126
|
-
case NS.XLINK: {
|
|
8127
|
-
html += `xlink:${attr.name}`;
|
|
8128
|
-
break;
|
|
8129
|
-
}
|
|
8130
|
-
default: {
|
|
8131
|
-
html += `${attr.prefix}:${attr.name}`;
|
|
8132
|
-
}
|
|
8133
|
-
}
|
|
8134
|
-
html += `="${escapeAttribute(attr.value)}"`;
|
|
8135
|
-
}
|
|
8136
|
-
return html;
|
|
8137
|
-
}
|
|
8138
|
-
function serializeTextNode(node, options) {
|
|
8139
|
-
const { treeAdapter } = options;
|
|
8140
|
-
const content = treeAdapter.getTextNodeContent(node);
|
|
8141
|
-
const parent = treeAdapter.getParentNode(node);
|
|
8142
|
-
const parentTn = parent && treeAdapter.isElementNode(parent) && treeAdapter.getTagName(parent);
|
|
8143
|
-
return parentTn &&
|
|
8144
|
-
treeAdapter.getNamespaceURI(parent) === NS.HTML &&
|
|
8145
|
-
hasUnescapedText(parentTn, options.scriptingEnabled)
|
|
8146
|
-
? content
|
|
8147
|
-
: escapeText(content);
|
|
8148
|
-
}
|
|
8149
|
-
function serializeCommentNode(node, { treeAdapter }) {
|
|
8150
|
-
return `<!--${treeAdapter.getCommentNodeContent(node)}-->`;
|
|
8151
|
-
}
|
|
8152
|
-
function serializeDocumentTypeNode(node, { treeAdapter }) {
|
|
8153
|
-
return `<!DOCTYPE ${treeAdapter.getDocumentTypeNodeName(node)}>`;
|
|
8154
|
-
}
|
|
8155
|
-
|
|
8156
7908
|
// Shorthands
|
|
8157
7909
|
/**
|
|
8158
7910
|
* Parses an HTML string.
|
|
@@ -8174,15 +7926,5 @@ function serializeDocumentTypeNode(node, { treeAdapter }) {
|
|
|
8174
7926
|
function parse(html, options) {
|
|
8175
7927
|
return Parser.parse(html, options);
|
|
8176
7928
|
}
|
|
8177
|
-
function parseFragment(fragmentContext, html, options) {
|
|
8178
|
-
if (typeof fragmentContext === 'string') {
|
|
8179
|
-
options = html;
|
|
8180
|
-
html = fragmentContext;
|
|
8181
|
-
fragmentContext = null;
|
|
8182
|
-
}
|
|
8183
|
-
const parser = Parser.getFragmentParser(fragmentContext, options);
|
|
8184
|
-
parser.tokenizer.write(html, true);
|
|
8185
|
-
return parser.getFragment();
|
|
8186
|
-
}
|
|
8187
7929
|
|
|
8188
|
-
export { ERR as ErrorCodes, Parser,
|
|
7930
|
+
export { ERR as ErrorCodes, Parser, Tokenizer, TokenizerMode, defaultTreeAdapter, parse };
|
package/dist/node/cli.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import { C as picocolorsExports, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { C as picocolorsExports, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-7efa13d7.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -728,7 +728,7 @@ cli
|
|
|
728
728
|
filterDuplicateOptions(options);
|
|
729
729
|
// output structure is preserved even after bundling so require()
|
|
730
730
|
// is ok here
|
|
731
|
-
const { createServer } = await import('./chunks/dep-
|
|
731
|
+
const { createServer } = await import('./chunks/dep-7efa13d7.js').then(function (n) { return n.H; });
|
|
732
732
|
try {
|
|
733
733
|
const server = await createServer({
|
|
734
734
|
root,
|
|
@@ -806,7 +806,7 @@ cli
|
|
|
806
806
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
807
807
|
.action(async (root, options) => {
|
|
808
808
|
filterDuplicateOptions(options);
|
|
809
|
-
const { build } = await import('./chunks/dep-
|
|
809
|
+
const { build } = await import('./chunks/dep-7efa13d7.js').then(function (n) { return n.G; });
|
|
810
810
|
const buildOptions = cleanOptions(options);
|
|
811
811
|
try {
|
|
812
812
|
await build({
|
|
@@ -834,7 +834,7 @@ cli
|
|
|
834
834
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
835
835
|
.action(async (root, options) => {
|
|
836
836
|
filterDuplicateOptions(options);
|
|
837
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
837
|
+
const { optimizeDeps } = await import('./chunks/dep-7efa13d7.js').then(function (n) { return n.F; });
|
|
838
838
|
try {
|
|
839
839
|
const config = await resolveConfig({
|
|
840
840
|
root,
|
|
@@ -860,7 +860,7 @@ cli
|
|
|
860
860
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
861
861
|
.action(async (root, options) => {
|
|
862
862
|
filterDuplicateOptions(options);
|
|
863
|
-
const { preview } = await import('./chunks/dep-
|
|
863
|
+
const { preview } = await import('./chunks/dep-7efa13d7.js').then(function (n) { return n.I; });
|
|
864
864
|
try {
|
|
865
865
|
const server = await preview({
|
|
866
866
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isInNodeModules } from './chunks/dep-
|
|
2
|
-
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-
|
|
1
|
+
import { i as isInNodeModules } from './chunks/dep-7efa13d7.js';
|
|
2
|
+
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-7efa13d7.js';
|
|
3
3
|
export { VERSION as version } from './constants.js';
|
|
4
4
|
export { version as esbuildVersion } from 'esbuild';
|
|
5
5
|
export { VERSION as rollupVersion } from 'rollup';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"esbuild": "^0.17.5",
|
|
70
70
|
"postcss": "^8.4.21",
|
|
71
|
-
"rollup": "^3.
|
|
71
|
+
"rollup": "^3.21.0"
|
|
72
72
|
},
|
|
73
73
|
"optionalDependencies": {
|
|
74
74
|
"fsevents": "~2.3.2"
|