vite 5.4.6 → 5.4.18

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.
@@ -1,4 +1,4 @@
1
- import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-DyBnyoVI.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-DbT5NFX0.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1327,54 +1327,63 @@ src$3.exports = (options = {}) => {
1327
1327
  });
1328
1328
 
1329
1329
  root.walkDecls(/^composes$/, (declaration) => {
1330
- const matches = declaration.value.match(matchImports$1);
1330
+ const multiple = declaration.value.split(",");
1331
+ const values = [];
1331
1332
 
1332
- if (!matches) {
1333
- return;
1334
- }
1333
+ multiple.forEach((value) => {
1334
+ const matches = value.trim().match(matchImports$1);
1335
1335
 
1336
- let tmpSymbols;
1337
- let [
1338
- ,
1339
- /*match*/ symbols,
1340
- doubleQuotePath,
1341
- singleQuotePath,
1342
- global,
1343
- ] = matches;
1344
-
1345
- if (global) {
1346
- // Composing globals simply means changing these classes to wrap them in global(name)
1347
- tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
1348
- } else {
1349
- const importPath = doubleQuotePath || singleQuotePath;
1336
+ if (!matches) {
1337
+ values.push(value);
1350
1338
 
1351
- let parent = declaration.parent;
1352
- let parentIndexes = "";
1353
-
1354
- while (parent.type !== "root") {
1355
- parentIndexes =
1356
- parent.parent.index(parent) + "_" + parentIndexes;
1357
- parent = parent.parent;
1339
+ return;
1358
1340
  }
1359
1341
 
1360
- const { selector } = declaration.parent;
1361
- const parentRule = `_${parentIndexes}${selector}`;
1362
-
1363
- addImportToGraph(importPath, parentRule, graph, visited);
1342
+ let tmpSymbols;
1343
+ let [
1344
+ ,
1345
+ /*match*/ symbols,
1346
+ doubleQuotePath,
1347
+ singleQuotePath,
1348
+ global,
1349
+ ] = matches;
1350
+
1351
+ if (global) {
1352
+ // Composing globals simply means changing these classes to wrap them in global(name)
1353
+ tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
1354
+ } else {
1355
+ const importPath = doubleQuotePath || singleQuotePath;
1364
1356
 
1365
- importDecls[importPath] = declaration;
1366
- imports[importPath] = imports[importPath] || {};
1357
+ let parent = declaration.parent;
1358
+ let parentIndexes = "";
1367
1359
 
1368
- tmpSymbols = symbols.split(/\s+/).map((s) => {
1369
- if (!imports[importPath][s]) {
1370
- imports[importPath][s] = createImportedName(s, importPath);
1360
+ while (parent.type !== "root") {
1361
+ parentIndexes =
1362
+ parent.parent.index(parent) + "_" + parentIndexes;
1363
+ parent = parent.parent;
1371
1364
  }
1372
1365
 
1373
- return imports[importPath][s];
1374
- });
1375
- }
1366
+ const { selector } = declaration.parent;
1367
+ const parentRule = `_${parentIndexes}${selector}`;
1368
+
1369
+ addImportToGraph(importPath, parentRule, graph, visited);
1370
+
1371
+ importDecls[importPath] = declaration;
1372
+ imports[importPath] = imports[importPath] || {};
1376
1373
 
1377
- declaration.value = tmpSymbols.join(" ");
1374
+ tmpSymbols = symbols.split(/\s+/).map((s) => {
1375
+ if (!imports[importPath][s]) {
1376
+ imports[importPath][s] = createImportedName(s, importPath);
1377
+ }
1378
+
1379
+ return imports[importPath][s];
1380
+ });
1381
+ }
1382
+
1383
+ values.push(tmpSymbols.join(" "));
1384
+ });
1385
+
1386
+ declaration.value = values.join(", ");
1378
1387
  });
1379
1388
 
1380
1389
  const importsOrder = topologicalSort(graph, failOnWrongOrder);
@@ -5767,9 +5776,19 @@ function localizeNode(rule, mode, localAliasMap) {
5767
5776
  hasLocals: false,
5768
5777
  explicit: context.explicit,
5769
5778
  };
5770
- newNodes = node.map((childNode) =>
5771
- transform(childNode, childContext)
5772
- );
5779
+ newNodes = node.map((childNode) => {
5780
+ const newContext = {
5781
+ ...childContext,
5782
+ enforceNoSpacing: false,
5783
+ };
5784
+
5785
+ const result = transform(childNode, newContext);
5786
+
5787
+ childContext.global = newContext.global;
5788
+ childContext.hasLocals = newContext.hasLocals;
5789
+
5790
+ return result;
5791
+ });
5773
5792
 
5774
5793
  node = node.clone();
5775
5794
  node.nodes = normalizeNodeArray(newNodes);
@@ -5838,6 +5857,11 @@ function localizeNode(rule, mode, localAliasMap) {
5838
5857
 
5839
5858
  break;
5840
5859
  }
5860
+ case "nesting": {
5861
+ if (node.value === "&") {
5862
+ context.hasLocals = true;
5863
+ }
5864
+ }
5841
5865
  }
5842
5866
 
5843
5867
  context.lastWasSpacing = false;
@@ -5910,19 +5934,34 @@ function localizeDeclNode(node, context) {
5910
5934
  return node;
5911
5935
  }
5912
5936
 
5913
- function isWordAFunctionArgument(wordNode, functionNode) {
5914
- return functionNode
5915
- ? functionNode.nodes.some(
5916
- (functionNodeChild) =>
5917
- functionNodeChild.sourceIndex === wordNode.sourceIndex
5918
- )
5919
- : false;
5920
- }
5937
+ // `none` is special value, other is global values
5938
+ const specialKeywords = [
5939
+ "none",
5940
+ "inherit",
5941
+ "initial",
5942
+ "revert",
5943
+ "revert-layer",
5944
+ "unset",
5945
+ ];
5921
5946
 
5922
5947
  function localizeDeclarationValues(localize, declaration, context) {
5923
5948
  const valueNodes = valueParser(declaration.value);
5924
5949
 
5925
5950
  valueNodes.walk((node, index, nodes) => {
5951
+ if (
5952
+ node.type === "function" &&
5953
+ (node.value.toLowerCase() === "var" || node.value.toLowerCase() === "env")
5954
+ ) {
5955
+ return false;
5956
+ }
5957
+
5958
+ if (
5959
+ node.type === "word" &&
5960
+ specialKeywords.includes(node.value.toLowerCase())
5961
+ ) {
5962
+ return;
5963
+ }
5964
+
5926
5965
  const subContext = {
5927
5966
  options: context.options,
5928
5967
  global: context.global,
@@ -5939,57 +5978,80 @@ function localizeDeclaration(declaration, context) {
5939
5978
  const isAnimation = /animation$/i.test(declaration.prop);
5940
5979
 
5941
5980
  if (isAnimation) {
5942
- const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
5981
+ // letter
5982
+ // An uppercase letter or a lowercase letter.
5983
+ //
5984
+ // ident-start code point
5985
+ // A letter, a non-ASCII code point, or U+005F LOW LINE (_).
5986
+ //
5987
+ // ident code point
5988
+ // An ident-start code point, a digit, or U+002D HYPHEN-MINUS (-).
5989
+
5990
+ // We don't validate `hex digits`, because we don't need it, it is work of linters.
5991
+ const validIdent =
5992
+ /^-?([a-z\u0080-\uFFFF_]|(\\[^\r\n\f])|-(?![0-9]))((\\[^\r\n\f])|[a-z\u0080-\uFFFF_0-9-])*$/i;
5943
5993
 
5944
5994
  /*
5945
5995
  The spec defines some keywords that you can use to describe properties such as the timing
5946
5996
  function. These are still valid animation names, so as long as there is a property that accepts
5947
5997
  a keyword, it is given priority. Only when all the properties that can take a keyword are
5948
5998
  exhausted can the animation name be set to the keyword. I.e.
5949
-
5999
+
5950
6000
  animation: infinite infinite;
5951
-
6001
+
5952
6002
  The animation will repeat an infinite number of times from the first argument, and will have an
5953
6003
  animation name of infinite from the second.
5954
6004
  */
5955
6005
  const animationKeywords = {
6006
+ // animation-direction
6007
+ $normal: 1,
6008
+ $reverse: 1,
5956
6009
  $alternate: 1,
5957
6010
  "$alternate-reverse": 1,
6011
+ // animation-fill-mode
6012
+ $forwards: 1,
5958
6013
  $backwards: 1,
5959
6014
  $both: 1,
6015
+ // animation-iteration-count
6016
+ $infinite: 1,
6017
+ // animation-play-state
6018
+ $paused: 1,
6019
+ $running: 1,
6020
+ // animation-timing-function
5960
6021
  $ease: 1,
5961
6022
  "$ease-in": 1,
5962
- "$ease-in-out": 1,
5963
6023
  "$ease-out": 1,
5964
- $forwards: 1,
5965
- $infinite: 1,
6024
+ "$ease-in-out": 1,
5966
6025
  $linear: 1,
5967
- $none: Infinity, // No matter how many times you write none, it will never be an animation name
5968
- $normal: 1,
5969
- $paused: 1,
5970
- $reverse: 1,
5971
- $running: 1,
5972
6026
  "$step-end": 1,
5973
6027
  "$step-start": 1,
6028
+ // Special
6029
+ $none: Infinity, // No matter how many times you write none, it will never be an animation name
6030
+ // Global values
5974
6031
  $initial: Infinity,
5975
6032
  $inherit: Infinity,
5976
6033
  $unset: Infinity,
6034
+ $revert: Infinity,
6035
+ "$revert-layer": Infinity,
5977
6036
  };
5978
6037
  let parsedAnimationKeywords = {};
5979
- let stepsFunctionNode = null;
5980
6038
  const valueNodes = valueParser(declaration.value).walk((node) => {
5981
- /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
6039
+ // If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh.
5982
6040
  if (node.type === "div") {
5983
6041
  parsedAnimationKeywords = {};
6042
+
6043
+ return;
6044
+ }
6045
+ // Do not handle nested functions
6046
+ else if (node.type === "function") {
6047
+ return false;
5984
6048
  }
5985
- if (node.type === "function" && node.value.toLowerCase() === "steps") {
5986
- stepsFunctionNode = node;
6049
+ // Ignore all except word
6050
+ else if (node.type !== "word") {
6051
+ return;
5987
6052
  }
5988
- const value =
5989
- node.type === "word" &&
5990
- !isWordAFunctionArgument(node, stepsFunctionNode)
5991
- ? node.value.toLowerCase()
5992
- : null;
6053
+
6054
+ const value = node.type === "word" ? node.value.toLowerCase() : null;
5993
6055
 
5994
6056
  let shouldParseAnimationName = false;
5995
6057
 
@@ -6014,6 +6076,7 @@ function localizeDeclaration(declaration, context) {
6014
6076
  localizeNextItem: shouldParseAnimationName && !context.global,
6015
6077
  localAliasMap: context.localAliasMap,
6016
6078
  };
6079
+
6017
6080
  return localizeDeclNode(node, subContext);
6018
6081
  });
6019
6082
 
@@ -6088,10 +6151,12 @@ src$2.exports = (options = {}) => {
6088
6151
  } else if (localMatch) {
6089
6152
  atRule.params = localMatch[0];
6090
6153
  globalKeyframes = false;
6091
- } else if (!globalMode) {
6092
- if (atRule.params && !localAliasMap.has(atRule.params)) {
6093
- atRule.params = ":local(" + atRule.params + ")";
6094
- }
6154
+ } else if (
6155
+ atRule.params &&
6156
+ !globalMode &&
6157
+ !localAliasMap.has(atRule.params)
6158
+ ) {
6159
+ atRule.params = ":local(" + atRule.params + ")";
6095
6160
  }
6096
6161
 
6097
6162
  atRule.walkDecls((declaration) => {
@@ -6101,6 +6166,44 @@ src$2.exports = (options = {}) => {
6101
6166
  global: globalKeyframes,
6102
6167
  });
6103
6168
  });
6169
+ } else if (/scope$/i.test(atRule.name)) {
6170
+ if (atRule.params) {
6171
+ atRule.params = atRule.params
6172
+ .split("to")
6173
+ .map((item) => {
6174
+ const selector = item.trim().slice(1, -1).trim();
6175
+ const context = localizeNode(
6176
+ selector,
6177
+ options.mode,
6178
+ localAliasMap
6179
+ );
6180
+
6181
+ context.options = options;
6182
+ context.localAliasMap = localAliasMap;
6183
+
6184
+ if (pureMode && context.hasPureGlobals) {
6185
+ throw atRule.error(
6186
+ 'Selector in at-rule"' +
6187
+ selector +
6188
+ '" is not pure ' +
6189
+ "(pure selectors must contain at least one local class or id)"
6190
+ );
6191
+ }
6192
+
6193
+ return `(${context.selector})`;
6194
+ })
6195
+ .join(" to ");
6196
+ }
6197
+
6198
+ atRule.nodes.forEach((declaration) => {
6199
+ if (declaration.type === "decl") {
6200
+ localizeDeclaration(declaration, {
6201
+ localAliasMap,
6202
+ options: options,
6203
+ global: globalMode,
6204
+ });
6205
+ }
6206
+ });
6104
6207
  } else if (atRule.nodes) {
6105
6208
  atRule.nodes.forEach((declaration) => {
6106
6209
  if (declaration.type === "decl") {
@@ -6160,7 +6263,23 @@ const selectorParser = distExports;
6160
6263
 
6161
6264
  const hasOwnProperty = Object.prototype.hasOwnProperty;
6162
6265
 
6163
- function getSingleLocalNamesForComposes(root) {
6266
+ function isNestedRule(rule) {
6267
+ if (!rule.parent || rule.parent.type === "root") {
6268
+ return false;
6269
+ }
6270
+
6271
+ if (rule.parent.type === "rule") {
6272
+ return true;
6273
+ }
6274
+
6275
+ return isNestedRule(rule.parent);
6276
+ }
6277
+
6278
+ function getSingleLocalNamesForComposes(root, rule) {
6279
+ if (isNestedRule(rule)) {
6280
+ throw new Error(`composition is not allowed in nested rule \n\n${rule}`);
6281
+ }
6282
+
6164
6283
  return root.nodes.map((node) => {
6165
6284
  if (node.type !== "selector" || node.nodes.length !== 1) {
6166
6285
  throw new Error(
@@ -6247,17 +6366,19 @@ const plugin = (options = {}) => {
6247
6366
  Once(root, { rule }) {
6248
6367
  const exports = Object.create(null);
6249
6368
 
6250
- function exportScopedName(name, rawName) {
6369
+ function exportScopedName(name, rawName, node) {
6251
6370
  const scopedName = generateScopedName(
6252
6371
  rawName ? rawName : name,
6253
6372
  root.source.input.from,
6254
- root.source.input.css
6373
+ root.source.input.css,
6374
+ node
6255
6375
  );
6256
6376
  const exportEntry = generateExportEntry(
6257
6377
  rawName ? rawName : name,
6258
6378
  scopedName,
6259
6379
  root.source.input.from,
6260
- root.source.input.css
6380
+ root.source.input.css,
6381
+ node
6261
6382
  );
6262
6383
  const { key, value } = exportEntry;
6263
6384
 
@@ -6273,23 +6394,35 @@ const plugin = (options = {}) => {
6273
6394
  function localizeNode(node) {
6274
6395
  switch (node.type) {
6275
6396
  case "selector":
6276
- node.nodes = node.map(localizeNode);
6397
+ node.nodes = node.map((item) => localizeNode(item));
6277
6398
  return node;
6278
6399
  case "class":
6279
6400
  return selectorParser.className({
6280
6401
  value: exportScopedName(
6281
6402
  node.value,
6282
- node.raws && node.raws.value ? node.raws.value : null
6403
+ node.raws && node.raws.value ? node.raws.value : null,
6404
+ node
6283
6405
  ),
6284
6406
  });
6285
6407
  case "id": {
6286
6408
  return selectorParser.id({
6287
6409
  value: exportScopedName(
6288
6410
  node.value,
6289
- node.raws && node.raws.value ? node.raws.value : null
6411
+ node.raws && node.raws.value ? node.raws.value : null,
6412
+ node
6290
6413
  ),
6291
6414
  });
6292
6415
  }
6416
+ case "attribute": {
6417
+ if (node.attribute === "class" && node.operator === "=") {
6418
+ return selectorParser.attribute({
6419
+ attribute: node.attribute,
6420
+ operator: node.operator,
6421
+ quoteMark: "'",
6422
+ value: exportScopedName(node.value, null, null),
6423
+ });
6424
+ }
6425
+ }
6293
6426
  }
6294
6427
 
6295
6428
  throw new Error(
@@ -6306,7 +6439,7 @@ const plugin = (options = {}) => {
6306
6439
  }
6307
6440
 
6308
6441
  const selector = localizeNode(node.first);
6309
- // move the spaces that were around the psuedo selector to the first
6442
+ // move the spaces that were around the pseudo selector to the first
6310
6443
  // non-container node
6311
6444
  selector.first.spaces = node.spaces;
6312
6445
 
@@ -6328,7 +6461,7 @@ const plugin = (options = {}) => {
6328
6461
  /* falls through */
6329
6462
  case "root":
6330
6463
  case "selector": {
6331
- node.each(traverseNode);
6464
+ node.each((item) => traverseNode(item));
6332
6465
  break;
6333
6466
  }
6334
6467
  case "id":
@@ -6356,32 +6489,39 @@ const plugin = (options = {}) => {
6356
6489
 
6357
6490
  rule.selector = traverseNode(parsedSelector.clone()).toString();
6358
6491
 
6359
- rule.walkDecls(/composes|compose-with/i, (decl) => {
6360
- const localNames = getSingleLocalNamesForComposes(parsedSelector);
6361
- const classes = decl.value.split(/\s+/);
6492
+ rule.walkDecls(/^(composes|compose-with)$/i, (decl) => {
6493
+ const localNames = getSingleLocalNamesForComposes(
6494
+ parsedSelector,
6495
+ decl.parent
6496
+ );
6497
+ const multiple = decl.value.split(",");
6362
6498
 
6363
- classes.forEach((className) => {
6364
- const global = /^global\(([^)]+)\)$/.exec(className);
6499
+ multiple.forEach((value) => {
6500
+ const classes = value.trim().split(/\s+/);
6365
6501
 
6366
- if (global) {
6367
- localNames.forEach((exportedName) => {
6368
- exports[exportedName].push(global[1]);
6369
- });
6370
- } else if (hasOwnProperty.call(importedNames, className)) {
6371
- localNames.forEach((exportedName) => {
6372
- exports[exportedName].push(className);
6373
- });
6374
- } else if (hasOwnProperty.call(exports, className)) {
6375
- localNames.forEach((exportedName) => {
6376
- exports[className].forEach((item) => {
6377
- exports[exportedName].push(item);
6502
+ classes.forEach((className) => {
6503
+ const global = /^global\(([^)]+)\)$/.exec(className);
6504
+
6505
+ if (global) {
6506
+ localNames.forEach((exportedName) => {
6507
+ exports[exportedName].push(global[1]);
6378
6508
  });
6379
- });
6380
- } else {
6381
- throw decl.error(
6382
- `referenced class name "${className}" in ${decl.prop} not found`
6383
- );
6384
- }
6509
+ } else if (hasOwnProperty.call(importedNames, className)) {
6510
+ localNames.forEach((exportedName) => {
6511
+ exports[exportedName].push(className);
6512
+ });
6513
+ } else if (hasOwnProperty.call(exports, className)) {
6514
+ localNames.forEach((exportedName) => {
6515
+ exports[className].forEach((item) => {
6516
+ exports[exportedName].push(item);
6517
+ });
6518
+ });
6519
+ } else {
6520
+ throw decl.error(
6521
+ `referenced class name "${className}" in ${decl.prop} not found`
6522
+ );
6523
+ }
6524
+ });
6385
6525
  });
6386
6526
 
6387
6527
  decl.remove();
@@ -6433,6 +6573,27 @@ const plugin = (options = {}) => {
6433
6573
  atRule.params = exportScopedName(localMatch[1]);
6434
6574
  });
6435
6575
 
6576
+ root.walkAtRules(/scope$/i, (atRule) => {
6577
+ if (atRule.params) {
6578
+ atRule.params = atRule.params
6579
+ .split("to")
6580
+ .map((item) => {
6581
+ const selector = item.trim().slice(1, -1).trim();
6582
+
6583
+ const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(selector);
6584
+
6585
+ if (!localMatch) {
6586
+ return `(${selector})`;
6587
+ }
6588
+
6589
+ let parsedSelector = selectorParser().astSync(selector);
6590
+
6591
+ return `(${traverseNode(parsedSelector).toString()})`;
6592
+ })
6593
+ .join(" to ");
6594
+ }
6595
+ });
6596
+
6436
6597
  // If we found any :locals, insert an :export rule
6437
6598
  const exportedNames = Object.keys(exports);
6438
6599
 
package/dist/node/cli.js CHANGED
@@ -2,12 +2,13 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-DyBnyoVI.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-DbT5NFX0.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
9
9
  import 'node:util';
10
10
  import 'node:module';
11
+ import 'node:crypto';
11
12
  import 'tty';
12
13
  import 'path';
13
14
  import 'esbuild';
@@ -26,7 +27,6 @@ import 'stream';
26
27
  import 'os';
27
28
  import 'child_process';
28
29
  import 'node:os';
29
- import 'node:crypto';
30
30
  import 'node:dns';
31
31
  import 'crypto';
32
32
  import 'module';
@@ -41,6 +41,7 @@ import 'zlib';
41
41
  import 'buffer';
42
42
  import 'https';
43
43
  import 'tls';
44
+ import 'node:net';
44
45
  import 'assert';
45
46
  import 'node:zlib';
46
47
 
@@ -730,7 +731,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
730
731
  `[boolean] force the optimizer to ignore the cache and re-bundle`
731
732
  ).action(async (root, options) => {
732
733
  filterDuplicateOptions(options);
733
- const { createServer } = await import('./chunks/dep-DyBnyoVI.js').then(function (n) { return n.E; });
734
+ const { createServer } = await import('./chunks/dep-DbT5NFX0.js').then(function (n) { return n.E; });
734
735
  try {
735
736
  const server = await createServer({
736
737
  root,
@@ -822,7 +823,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
822
823
  `[boolean] force empty outDir when it's outside of root`
823
824
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
824
825
  filterDuplicateOptions(options);
825
- const { build } = await import('./chunks/dep-DyBnyoVI.js').then(function (n) { return n.F; });
826
+ const { build } = await import('./chunks/dep-DbT5NFX0.js').then(function (n) { return n.F; });
826
827
  const buildOptions = cleanOptions(options);
827
828
  try {
828
829
  await build({
@@ -851,7 +852,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
851
852
  ).action(
852
853
  async (root, options) => {
853
854
  filterDuplicateOptions(options);
854
- const { optimizeDeps } = await import('./chunks/dep-DyBnyoVI.js').then(function (n) { return n.D; });
855
+ const { optimizeDeps } = await import('./chunks/dep-DbT5NFX0.js').then(function (n) { return n.D; });
855
856
  try {
856
857
  const config = await resolveConfig(
857
858
  {
@@ -877,7 +878,7 @@ ${e.stack}`),
877
878
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
878
879
  async (root, options) => {
879
880
  filterDuplicateOptions(options);
880
- const { preview } = await import('./chunks/dep-DyBnyoVI.js').then(function (n) { return n.G; });
881
+ const { preview } = await import('./chunks/dep-DbT5NFX0.js').then(function (n) { return n.G; });
881
882
  try {
882
883
  const server = await preview({
883
884
  root,
@@ -107,6 +107,7 @@ const wildcardHosts = /* @__PURE__ */ new Set([
107
107
  const DEFAULT_DEV_PORT = 5173;
108
108
  const DEFAULT_PREVIEW_PORT = 4173;
109
109
  const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
110
+ const defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
110
111
  const METADATA_FILENAME = "_metadata.json";
111
112
 
112
- export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, 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, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
113
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, 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, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, defaultAllowedOrigins, loopbackHosts, wildcardHosts };