@vue/compiler-sfc 3.5.0-beta.3 → 3.5.0

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,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.0-beta.3
2
+ * @vue/compiler-sfc v3.5.0
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,8 +10,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
  var compilerCore = require('@vue/compiler-core');
11
11
  var CompilerDOM = require('@vue/compiler-dom');
12
12
  var sourceMapJs = require('source-map-js');
13
- var path$3 = require('path');
14
13
  var shared = require('@vue/shared');
14
+ var path$3 = require('path');
15
15
  var url = require('url');
16
16
  var CompilerSSR = require('@vue/compiler-ssr');
17
17
  var require$$2 = require('util');
@@ -23,79 +23,20 @@ var parser$1 = require('@babel/parser');
23
23
  var process$1 = require('process');
24
24
 
25
25
  function _interopNamespaceDefault(e) {
26
- var n = Object.create(null);
27
- if (e) {
28
- for (var k in e) {
29
- n[k] = e[k];
30
- }
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
26
+ var n = Object.create(null);
27
+ if (e) {
28
+ for (var k in e) {
29
+ n[k] = e[k];
30
+ }
31
+ }
32
+ n.default = e;
33
+ return Object.freeze(n);
34
34
  }
35
35
 
36
36
  var CompilerDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerDOM);
37
37
  var CompilerSSR__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerSSR);
38
38
  var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process$1);
39
39
 
40
- const UNKNOWN_TYPE = "Unknown";
41
- function resolveObjectKey(node, computed) {
42
- switch (node.type) {
43
- case "StringLiteral":
44
- case "NumericLiteral":
45
- return String(node.value);
46
- case "Identifier":
47
- if (!computed) return node.name;
48
- }
49
- return void 0;
50
- }
51
- function concatStrings(strs) {
52
- return strs.filter((s) => !!s).join(", ");
53
- }
54
- function isLiteralNode(node) {
55
- return node.type.endsWith("Literal");
56
- }
57
- function isCallOf(node, test) {
58
- return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
59
- }
60
- function toRuntimeTypeString(types) {
61
- return types.length > 1 ? `[${types.join(", ")}]` : types[0];
62
- }
63
- function getImportedName(specifier) {
64
- if (specifier.type === "ImportSpecifier")
65
- return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
66
- else if (specifier.type === "ImportNamespaceSpecifier") return "*";
67
- return "default";
68
- }
69
- function getId(node) {
70
- return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
71
- }
72
- const identity = (str) => str;
73
- const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
74
- const toLowerCase = (str) => str.toLowerCase();
75
- function toFileNameLowerCase(x) {
76
- return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
77
- }
78
- function createGetCanonicalFileName(useCaseSensitiveFileNames) {
79
- return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
80
- }
81
- const normalize = (path$3.posix || path$3).normalize;
82
- const windowsSlashRE = /\\/g;
83
- function normalizePath(p) {
84
- return normalize(p.replace(windowsSlashRE, "/"));
85
- }
86
- const joinPaths = (path$3.posix || path$3).join;
87
- const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
88
- function getEscapedPropName(key) {
89
- return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
90
- }
91
- const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
92
- function getEscapedCssVarName(key, doubleEscape) {
93
- return key.replace(
94
- cssVarNameEscapeSymbolsRE,
95
- (s) => doubleEscape ? `\\\\${s}` : `\\${s}`
96
- );
97
- }
98
-
99
40
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
100
41
 
101
42
  function getDefaultExportFromCjs (x) {
@@ -184,7 +125,7 @@ function genVarName(id, raw, isProd, isSSR = false) {
184
125
  if (isProd) {
185
126
  return hash$1(id + raw);
186
127
  } else {
187
- return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
128
+ return `${id}-${shared.getEscapedCssVarName(raw, isSSR)}`;
188
129
  }
189
130
  }
190
131
  function normalizeExpression(exp) {
@@ -1781,7 +1722,7 @@ function resolveTemplateUsedIdentifiers(sfc) {
1781
1722
  } else if (prop.exp) {
1782
1723
  extractIdentifiers(ids, prop.exp);
1783
1724
  } else if (prop.name === "bind" && !prop.exp) {
1784
- ids.add(prop.arg.content);
1725
+ ids.add(shared.camelize(prop.arg.content));
1785
1726
  }
1786
1727
  }
1787
1728
  if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
@@ -1917,7 +1858,7 @@ function parse$2(source, options = {}) {
1917
1858
  if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) {
1918
1859
  errors.push(
1919
1860
  new SyntaxError(
1920
- `At least one <template> or <script> is required in a single file component.`
1861
+ `At least one <template> or <script> is required in a single file component. ${descriptor.filename}`
1921
1862
  )
1922
1863
  );
1923
1864
  }
@@ -15553,6 +15494,58 @@ function preprocess(options, preprocessor) {
15553
15494
  );
15554
15495
  }
15555
15496
 
15497
+ const UNKNOWN_TYPE = "Unknown";
15498
+ function resolveObjectKey(node, computed) {
15499
+ switch (node.type) {
15500
+ case "StringLiteral":
15501
+ case "NumericLiteral":
15502
+ return String(node.value);
15503
+ case "Identifier":
15504
+ if (!computed) return node.name;
15505
+ }
15506
+ return void 0;
15507
+ }
15508
+ function concatStrings(strs) {
15509
+ return strs.filter((s) => !!s).join(", ");
15510
+ }
15511
+ function isLiteralNode(node) {
15512
+ return node.type.endsWith("Literal");
15513
+ }
15514
+ function isCallOf(node, test) {
15515
+ return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
15516
+ }
15517
+ function toRuntimeTypeString(types) {
15518
+ return types.length > 1 ? `[${types.join(", ")}]` : types[0];
15519
+ }
15520
+ function getImportedName(specifier) {
15521
+ if (specifier.type === "ImportSpecifier")
15522
+ return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
15523
+ else if (specifier.type === "ImportNamespaceSpecifier") return "*";
15524
+ return "default";
15525
+ }
15526
+ function getId(node) {
15527
+ return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
15528
+ }
15529
+ const identity = (str) => str;
15530
+ const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
15531
+ const toLowerCase = (str) => str.toLowerCase();
15532
+ function toFileNameLowerCase(x) {
15533
+ return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
15534
+ }
15535
+ function createGetCanonicalFileName(useCaseSensitiveFileNames) {
15536
+ return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
15537
+ }
15538
+ const normalize = (path$3.posix || path$3).normalize;
15539
+ const windowsSlashRE = /\\/g;
15540
+ function normalizePath(p) {
15541
+ return normalize(p.replace(windowsSlashRE, "/"));
15542
+ }
15543
+ const joinPaths = (path$3.posix || path$3).join;
15544
+ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
15545
+ function getEscapedPropName(key) {
15546
+ return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
15547
+ }
15548
+
15556
15549
  function analyzeScriptBindings(ast) {
15557
15550
  for (const node of ast) {
15558
15551
  if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") {
@@ -18635,7 +18628,7 @@ function resolveWithTS(containingFile, source, ts2, fs) {
18635
18628
  return fs.realpath ? fs.realpath(filename) : filename;
18636
18629
  }
18637
18630
  }
18638
- function loadTSConfig(configPath, ts2, fs) {
18631
+ function loadTSConfig(configPath, ts2, fs, visited = /* @__PURE__ */ new Set()) {
18639
18632
  const parseConfigHost = ts2.sys;
18640
18633
  const config = ts2.parseJsonConfigFileContent(
18641
18634
  ts2.readConfigFile(configPath, fs.readFile).config,
@@ -18645,14 +18638,15 @@ function loadTSConfig(configPath, ts2, fs) {
18645
18638
  configPath
18646
18639
  );
18647
18640
  const res = [config];
18641
+ visited.add(configPath);
18648
18642
  if (config.projectReferences) {
18649
18643
  for (const ref of config.projectReferences) {
18650
18644
  const refPath = ts2.resolveProjectReferencePath(ref);
18651
- if (!fs.fileExists(refPath)) {
18645
+ if (visited.has(refPath) || !fs.fileExists(refPath)) {
18652
18646
  continue;
18653
18647
  }
18654
18648
  tsConfigRefMap.set(refPath, configPath);
18655
- res.unshift(...loadTSConfig(refPath, ts2, fs));
18649
+ res.unshift(...loadTSConfig(refPath, ts2, fs, visited));
18656
18650
  }
18657
18651
  }
18658
18652
  return res;
@@ -20862,7 +20856,7 @@ function isStaticNode(node) {
20862
20856
  return false;
20863
20857
  }
20864
20858
 
20865
- const version = "3.5.0-beta.3";
20859
+ const version = "3.5.0";
20866
20860
  const parseCache = parseCache$1;
20867
20861
  const errorMessages = {
20868
20862
  ...CompilerDOM.errorMessages,