@vue/compiler-sfc 3.4.0-alpha.1 → 3.4.0-alpha.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.
@@ -2,20 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var compilerCore = require('@vue/compiler-core');
5
6
  var CompilerDOM = require('@vue/compiler-dom');
6
7
  var sourceMapJs = require('source-map-js');
7
8
  var path$3 = require('path');
8
9
  var parser$2 = require('@babel/parser');
9
10
  var shared = require('@vue/shared');
10
- var compilerCore = require('@vue/compiler-core');
11
11
  var url = require('url');
12
12
  var CompilerSSR = require('@vue/compiler-ssr');
13
13
  var require$$2 = require('util');
14
14
  var require$$0 = require('fs');
15
15
  var require$$0$1 = require('postcss');
16
16
  var estreeWalker = require('estree-walker');
17
- var reactivityTransform = require('@vue/reactivity-transform');
18
17
  var MagicString = require('magic-string');
18
+ var process$1 = require('process');
19
19
 
20
20
  function _interopNamespaceDefault(e) {
21
21
  var n = Object.create(null);
@@ -30,6 +30,7 @@ function _interopNamespaceDefault(e) {
30
30
 
31
31
  var CompilerDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerDOM);
32
32
  var CompilerSSR__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerSSR);
33
+ var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process$1);
33
34
 
34
35
  const UNKNOWN_TYPE = "Unknown";
35
36
  function resolveObjectKey(node, computed) {
@@ -87,9 +88,13 @@ function normalizePath(p) {
87
88
  return normalize(p.replace(windowsSlashRE, "/"));
88
89
  }
89
90
  const joinPaths = (path$3.posix || path$3).join;
90
- const escapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
91
- function getEscapedKey(key) {
92
- return escapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
91
+ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
92
+ function getEscapedPropName(key) {
93
+ return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
94
+ }
95
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
96
+ function getEscapedCssVarName(key) {
97
+ return key.replace(cssVarNameEscapeSymbolsRE, (s) => `\\${s}`);
93
98
  }
94
99
 
95
100
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -180,7 +185,7 @@ function genVarName(id, raw, isProd) {
180
185
  if (isProd) {
181
186
  return hash$1(id + raw);
182
187
  } else {
183
- return `${id}-${raw.replace(escapeSymbolsRE, (s) => `\\${s}`)}`;
188
+ return `${id}-${getEscapedCssVarName(raw)}`;
184
189
  }
185
190
  }
186
191
  function normalizeExpression(exp) {
@@ -734,6 +739,9 @@ class LRUCache {
734
739
  if (ttls[index]) {
735
740
  const ttl = ttls[index];
736
741
  const start = starts[index];
742
+ /* c8 ignore next */
743
+ if (!ttl || !start)
744
+ return;
737
745
  status.ttl = ttl;
738
746
  status.start = start;
739
747
  status.now = cachedNow || getNow();
@@ -765,16 +773,16 @@ class LRUCache {
765
773
  }
766
774
  const ttl = ttls[index];
767
775
  const start = starts[index];
768
- if (ttl === 0 || start === 0) {
776
+ if (!ttl || !start) {
769
777
  return Infinity;
770
778
  }
771
779
  const age = (cachedNow || getNow()) - start;
772
780
  return ttl - age;
773
781
  };
774
782
  this.#isStale = index => {
775
- return (ttls[index] !== 0 &&
776
- starts[index] !== 0 &&
777
- (cachedNow || getNow()) - starts[index] > ttls[index]);
783
+ const s = starts[index];
784
+ const t = ttls[index];
785
+ return !!t && !!s && (cachedNow || getNow()) - s > t;
778
786
  };
779
787
  }
780
788
  // conditionally set private methods related to TTL
@@ -1298,12 +1306,13 @@ class LRUCache {
1298
1306
  peek(k, peekOptions = {}) {
1299
1307
  const { allowStale = this.allowStale } = peekOptions;
1300
1308
  const index = this.#keyMap.get(k);
1301
- if (index !== undefined &&
1302
- (allowStale || !this.#isStale(index))) {
1303
- const v = this.#valList[index];
1304
- // either stale and allowed, or forcing a refresh of non-stale value
1305
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
1309
+ if (index === undefined ||
1310
+ (!allowStale && this.#isStale(index))) {
1311
+ return;
1306
1312
  }
1313
+ const v = this.#valList[index];
1314
+ // either stale and allowed, or forcing a refresh of non-stale value
1315
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
1307
1316
  }
1308
1317
  #backgroundFetch(k, index, options, context) {
1309
1318
  const v = index === undefined ? undefined : this.#valList[index];
@@ -1639,8 +1648,10 @@ class LRUCache {
1639
1648
  this.#head = this.#next[index];
1640
1649
  }
1641
1650
  else {
1642
- this.#next[this.#prev[index]] = this.#next[index];
1643
- this.#prev[this.#next[index]] = this.#prev[index];
1651
+ const pi = this.#prev[index];
1652
+ this.#next[pi] = this.#next[index];
1653
+ const ni = this.#next[index];
1654
+ this.#prev[ni] = this.#prev[index];
1644
1655
  }
1645
1656
  this.#size--;
1646
1657
  this.#free.push(index);
@@ -1719,50 +1730,47 @@ function resolveTemplateUsageCheckString(sfc) {
1719
1730
  return cached;
1720
1731
  }
1721
1732
  let code = "";
1722
- CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
1723
- nodeTransforms: [
1724
- (node) => {
1725
- var _a;
1726
- if (node.type === 1) {
1727
- if (!CompilerDOM.parserOptions.isNativeTag(node.tag) && !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
1728
- code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
1729
- }
1730
- for (let i = 0; i < node.props.length; i++) {
1731
- const prop = node.props[i];
1732
- if (prop.type === 7) {
1733
- if (!shared.isBuiltInDirective(prop.name)) {
1734
- code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
1735
- }
1736
- if (prop.arg && !prop.arg.isStatic) {
1737
- code += `,${processExp(
1738
- prop.arg.content,
1739
- prop.name
1740
- )}`;
1741
- }
1742
- if (prop.exp) {
1743
- code += `,${processExp(
1744
- prop.exp.content,
1745
- prop.name
1746
- )}`;
1747
- }
1733
+ ast.children.forEach(walk);
1734
+ function walk(node) {
1735
+ var _a;
1736
+ switch (node.type) {
1737
+ case 1:
1738
+ if (!CompilerDOM.parserOptions.isNativeTag(node.tag) && !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
1739
+ code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
1740
+ }
1741
+ for (let i = 0; i < node.props.length; i++) {
1742
+ const prop = node.props[i];
1743
+ if (prop.type === 7) {
1744
+ if (!shared.isBuiltInDirective(prop.name)) {
1745
+ code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
1746
+ }
1747
+ if (prop.arg && !prop.arg.isStatic) {
1748
+ code += `,${stripStrings(
1749
+ prop.arg.content
1750
+ )}`;
1748
1751
  }
1749
- if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
1750
- code += `,${prop.value.content}`;
1752
+ if (prop.exp) {
1753
+ code += `,${processExp(
1754
+ prop.exp.content,
1755
+ prop.name
1756
+ )}`;
1751
1757
  }
1752
1758
  }
1753
- } else if (node.type === 5) {
1754
- code += `,${processExp(
1755
- node.content.content
1756
- )}`;
1759
+ if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
1760
+ code += `,${prop.value.content}`;
1761
+ }
1757
1762
  }
1758
- }
1759
- ]
1760
- });
1763
+ node.children.forEach(walk);
1764
+ break;
1765
+ case 5:
1766
+ code += `,${processExp(node.content.content)}`;
1767
+ break;
1768
+ }
1769
+ }
1761
1770
  code += ";";
1762
1771
  templateUsageCheckCache.set(content, code);
1763
1772
  return code;
1764
1773
  }
1765
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
1766
1774
  function processExp(exp, dir) {
1767
1775
  if (/ as\s+\w|<.*>|:/.test(exp)) {
1768
1776
  if (dir === "slot") {
@@ -1770,7 +1778,7 @@ function processExp(exp, dir) {
1770
1778
  } else if (dir === "on") {
1771
1779
  exp = `()=>{return ${exp}}`;
1772
1780
  } else if (dir === "for") {
1773
- const inMatch = exp.match(forAliasRE);
1781
+ const inMatch = exp.match(CompilerDOM.forAliasRE);
1774
1782
  if (inMatch) {
1775
1783
  let [, LHS, RHS] = inMatch;
1776
1784
  LHS = LHS.trim().replace(/^\(|\)$/g, "");
@@ -1798,7 +1806,7 @@ function stripTemplateString(str) {
1798
1806
  }
1799
1807
 
1800
1808
  const DEFAULT_FILENAME = "anonymous.vue";
1801
- const parseCache = createCache();
1809
+ const parseCache$1 = createCache();
1802
1810
  function parse$2(source, {
1803
1811
  sourceMap = true,
1804
1812
  filename = DEFAULT_FILENAME,
@@ -1808,7 +1816,7 @@ function parse$2(source, {
1808
1816
  compiler = CompilerDOM__namespace
1809
1817
  } = {}) {
1810
1818
  const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
1811
- const cache = parseCache.get(sourceKey);
1819
+ const cache = parseCache$1.get(sourceKey);
1812
1820
  if (cache) {
1813
1821
  return cache;
1814
1822
  }
@@ -1826,20 +1834,7 @@ function parse$2(source, {
1826
1834
  };
1827
1835
  const errors = [];
1828
1836
  const ast = compiler.parse(source, {
1829
- // there are no components at SFC parsing level
1830
- isNativeTag: () => true,
1831
- // preserve all whitespaces
1832
- isPreTag: () => true,
1833
- getTextMode: ({ tag, props }, parent) => {
1834
- if (!parent && tag !== "template" || // <template lang="xxx"> should also be treated as raw text
1835
- tag === "template" && props.some(
1836
- (p) => p.type === 6 && p.name === "lang" && p.value && p.value.content && p.value.content !== "html"
1837
- )) {
1838
- return 2;
1839
- } else {
1840
- return 0;
1841
- }
1842
- },
1837
+ parseMode: "sfc",
1843
1838
  onError: (e) => {
1844
1839
  errors.push(e);
1845
1840
  }
@@ -1859,12 +1854,16 @@ function parse$2(source, {
1859
1854
  source,
1860
1855
  false
1861
1856
  );
1862
- templateBlock.ast = node;
1857
+ if (!templateBlock.attrs.src) {
1858
+ templateBlock.ast = compilerCore.createRoot(node.children, source);
1859
+ }
1863
1860
  if (templateBlock.attrs.functional) {
1864
1861
  const err = new SyntaxError(
1865
1862
  `<template functional> is no longer supported in Vue 3, since functional components no longer have significant performance difference from stateful ones. Just use a normal <template> instead.`
1866
1863
  );
1867
- err.loc = node.props.find((p) => p.name === "functional").loc;
1864
+ err.loc = node.props.find(
1865
+ (p) => p.type === 6 && p.name === "functional"
1866
+ ).loc;
1868
1867
  errors.push(err);
1869
1868
  }
1870
1869
  } else {
@@ -1951,7 +1950,7 @@ function parse$2(source, {
1951
1950
  descriptor,
1952
1951
  errors
1953
1952
  };
1954
- parseCache.set(sourceKey, result);
1953
+ parseCache$1.set(sourceKey, result);
1955
1954
  return result;
1956
1955
  }
1957
1956
  function createDuplicateBlockError(node, isScriptSetup = false) {
@@ -1963,32 +1962,11 @@ function createDuplicateBlockError(node, isScriptSetup = false) {
1963
1962
  }
1964
1963
  function createBlock(node, source, pad) {
1965
1964
  const type = node.tag;
1966
- let { start, end } = node.loc;
1967
- let content = "";
1968
- if (node.children.length) {
1969
- start = node.children[0].loc.start;
1970
- end = node.children[node.children.length - 1].loc.end;
1971
- content = source.slice(start.offset, end.offset);
1972
- } else {
1973
- const offset = node.loc.source.indexOf(`</`);
1974
- if (offset > -1) {
1975
- start = {
1976
- line: start.line,
1977
- column: start.column + offset,
1978
- offset: start.offset + offset
1979
- };
1980
- }
1981
- end = { ...start };
1982
- }
1983
- const loc = {
1984
- source: content,
1985
- start,
1986
- end
1987
- };
1965
+ const loc = node.innerLoc;
1988
1966
  const attrs = {};
1989
1967
  const block = {
1990
1968
  type,
1991
- content,
1969
+ content: source.slice(loc.start.offset, loc.end.offset),
1992
1970
  loc,
1993
1971
  attrs
1994
1972
  };
@@ -1997,18 +1975,19 @@ function createBlock(node, source, pad) {
1997
1975
  }
1998
1976
  node.props.forEach((p) => {
1999
1977
  if (p.type === 6) {
2000
- attrs[p.name] = p.value ? p.value.content || true : true;
2001
- if (p.name === "lang") {
1978
+ const name = p.name;
1979
+ attrs[name] = p.value ? p.value.content || true : true;
1980
+ if (name === "lang") {
2002
1981
  block.lang = p.value && p.value.content;
2003
- } else if (p.name === "src") {
1982
+ } else if (name === "src") {
2004
1983
  block.src = p.value && p.value.content;
2005
1984
  } else if (type === "style") {
2006
- if (p.name === "scoped") {
1985
+ if (name === "scoped") {
2007
1986
  block.scoped = true;
2008
- } else if (p.name === "module") {
2009
- block.module = attrs[p.name];
1987
+ } else if (name === "module") {
1988
+ block.module = attrs[name];
2010
1989
  }
2011
- } else if (type === "script" && p.name === "setup") {
1990
+ } else if (type === "script" && name === "setup") {
2012
1991
  block.setup = attrs.setup;
2013
1992
  }
2014
1993
  }
@@ -2024,28 +2003,27 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset)
2024
2003
  sourceRoot: sourceRoot.replace(/\\/g, "/")
2025
2004
  });
2026
2005
  map.setSourceContent(filename, source);
2006
+ map._sources.add(filename);
2027
2007
  generated.split(splitRE).forEach((line, index) => {
2028
2008
  if (!emptyRE.test(line)) {
2029
2009
  const originalLine = index + 1 + lineOffset;
2030
2010
  const generatedLine = index + 1;
2031
2011
  for (let i = 0; i < line.length; i++) {
2032
2012
  if (!/\s/.test(line[i])) {
2033
- map.addMapping({
2013
+ map._mappings.add({
2014
+ originalLine,
2015
+ originalColumn: i,
2016
+ generatedLine,
2017
+ generatedColumn: i,
2034
2018
  source: filename,
2035
- original: {
2036
- line: originalLine,
2037
- column: i
2038
- },
2039
- generated: {
2040
- line: generatedLine,
2041
- column: i
2042
- }
2019
+ // @ts-ignore
2020
+ name: null
2043
2021
  });
2044
2022
  }
2045
2023
  }
2046
2024
  }
2047
2025
  });
2048
- return JSON.parse(map.toString());
2026
+ return map.toJSON();
2049
2027
  }
2050
2028
  function padContent(content, block, pad) {
2051
2029
  content = content.slice(0, block.loc.start.offset);
@@ -4185,7 +4163,9 @@ function compileTemplate(options) {
4185
4163
  try {
4186
4164
  return doCompileTemplate({
4187
4165
  ...options,
4188
- source: preprocess$1(options, preprocessor)
4166
+ source: preprocess$1(options, preprocessor),
4167
+ ast: void 0
4168
+ // invalidate AST if template goes through preprocessor
4189
4169
  });
4190
4170
  } catch (e) {
4191
4171
  return {
@@ -4217,10 +4197,11 @@ function doCompileTemplate({
4217
4197
  slotted,
4218
4198
  inMap,
4219
4199
  source,
4200
+ ast: inAST,
4220
4201
  ssr = false,
4221
4202
  ssrCssVars,
4222
4203
  isProd = false,
4223
- compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace,
4204
+ compiler,
4224
4205
  compilerOptions = {},
4225
4206
  transformAssetUrls
4226
4207
  }) {
@@ -4247,7 +4228,22 @@ function doCompileTemplate({
4247
4228
  }
4248
4229
  const shortId = id.replace(/^data-v-/, "");
4249
4230
  const longId = `data-v-${shortId}`;
4250
- let { code, ast, preamble, map } = compiler.compile(source, {
4231
+ const defaultCompiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace;
4232
+ compiler = compiler || defaultCompiler;
4233
+ if (compiler !== defaultCompiler) {
4234
+ inAST = void 0;
4235
+ }
4236
+ if (inAST == null ? void 0 : inAST.transformed) {
4237
+ const newAST = (ssr ? CompilerDOM__namespace : compiler).parse(inAST.source, {
4238
+ parseMode: "sfc",
4239
+ onError: (e) => errors.push(e)
4240
+ });
4241
+ const template = newAST.children.find(
4242
+ (node) => node.type === 1 && node.tag === "template"
4243
+ );
4244
+ inAST = compilerCore.createRoot(template.children, inAST.source);
4245
+ }
4246
+ let { code, ast, preamble, map } = compiler.compile(inAST || source, {
4251
4247
  mode: "module",
4252
4248
  prefixIdentifiers: true,
4253
4249
  hoistStatic: true,
@@ -4263,7 +4259,7 @@ function doCompileTemplate({
4263
4259
  onError: (e) => errors.push(e),
4264
4260
  onWarn: (w) => warnings.push(w)
4265
4261
  });
4266
- if (inMap) {
4262
+ if (inMap && !inAST) {
4267
4263
  if (map) {
4268
4264
  map = mapLines(inMap, map);
4269
4265
  }
@@ -4276,7 +4272,7 @@ function doCompileTemplate({
4276
4272
  if (w.loc) {
4277
4273
  msg += `
4278
4274
  ${shared.generateCodeFrame(
4279
- source,
4275
+ (inAST == null ? void 0 : inAST.source) || source,
4280
4276
  w.loc.start.offset,
4281
4277
  w.loc.end.offset
4282
4278
  )}`;
@@ -7902,6 +7898,10 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
7902
7898
  if (n.type !== "pseudo" && n.type !== "combinator") {
7903
7899
  node = n;
7904
7900
  }
7901
+ if (n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
7902
+ rewriteSelector(id, n.nodes[0], selectorRoot, slotted);
7903
+ shouldInject = false;
7904
+ }
7905
7905
  });
7906
7906
  if (node) {
7907
7907
  node.spaces.after = "";
@@ -11171,7 +11171,10 @@ const scss = (source, map, options, load = require) => {
11171
11171
  if (map) {
11172
11172
  return {
11173
11173
  code: result.css.toString(),
11174
- map: merge$1(map, JSON.parse(result.map.toString())),
11174
+ map: merge$1(
11175
+ map,
11176
+ result.map.toJSON ? result.map.toJSON() : JSON.parse(result.map.toString())
11177
+ ),
11175
11178
  errors: [],
11176
11179
  dependencies
11177
11180
  };
@@ -15532,30 +15535,8 @@ function processNormalScript(ctx, scopeId) {
15532
15535
  let map = script.map;
15533
15536
  const scriptAst = ctx.scriptAst;
15534
15537
  const bindings = analyzeScriptBindings(scriptAst.body);
15535
- const { source, filename, cssVars } = ctx.descriptor;
15536
- const { sourceMap, genDefaultAs, isProd } = ctx.options;
15537
- if (ctx.options.reactivityTransform && reactivityTransform.shouldTransform(content)) {
15538
- const s = new MagicString(source);
15539
- const startOffset = script.loc.start.offset;
15540
- const endOffset = script.loc.end.offset;
15541
- const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
15542
- if (importedHelpers.length) {
15543
- s.prepend(
15544
- `import { ${importedHelpers.map((h) => `${h} as _${h}`).join(", ")} } from 'vue'
15545
- `
15546
- );
15547
- }
15548
- s.remove(0, startOffset);
15549
- s.remove(endOffset, source.length);
15550
- content = s.toString();
15551
- if (sourceMap !== false) {
15552
- map = s.generateMap({
15553
- source: filename,
15554
- hires: true,
15555
- includeContent: true
15556
- });
15557
- }
15558
- }
15538
+ const { cssVars } = ctx.descriptor;
15539
+ const { genDefaultAs, isProd } = ctx.options;
15559
15540
  if (cssVars.length || genDefaultAs) {
15560
15541
  const defaultVar = genDefaultAs || normalScriptDefaultVar;
15561
15542
  const s = new MagicString(content);
@@ -15674,7 +15655,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
15674
15655
  }
15675
15656
  if (lang === "ts" || lang === "tsx") {
15676
15657
  plugins.push(["typescript", { dts }]);
15677
- if (!plugins.includes("decorators")) {
15658
+ if (!userPlugins || !userPlugins.includes("decorators")) {
15678
15659
  plugins.push("decorators-legacy");
15679
15660
  }
15680
15661
  }
@@ -17908,12 +17889,16 @@ function resolveInterfaceMembers(ctx, node, scope) {
17908
17889
  continue;
17909
17890
  }
17910
17891
  try {
17911
- const { props } = resolveTypeElements(ctx, ext, scope);
17892
+ const { props, calls } = resolveTypeElements(ctx, ext, scope);
17912
17893
  for (const key in props) {
17913
17894
  if (!shared.hasOwn(base.props, key)) {
17914
17895
  base.props[key] = props[key];
17915
17896
  }
17916
17897
  }
17898
+ if (calls) {
17899
+ ;
17900
+ (base.calls || (base.calls = [])).push(...calls);
17901
+ }
17917
17902
  } catch (e) {
17918
17903
  ctx.error(
17919
17904
  `Failed to resolve extends base type.
@@ -18245,7 +18230,11 @@ function importSourceToScope(ctx, node, scope, source) {
18245
18230
  }
18246
18231
  let resolved = scope.resolvedImportSources[source];
18247
18232
  if (!resolved) {
18248
- if (source.startsWith(".")) {
18233
+ if (source.startsWith("..")) {
18234
+ const osSpecificJoinFn = process__namespace.platform === "win32" ? path$3.join : joinPaths;
18235
+ const filename = osSpecificJoinFn(path$3.dirname(scope.filename), source);
18236
+ resolved = resolveExt(filename, fs);
18237
+ } else if (source.startsWith(".")) {
18249
18238
  const filename = joinPaths(path$3.dirname(scope.filename), source);
18250
18239
  resolved = resolveExt(filename, fs);
18251
18240
  } else {
@@ -18326,7 +18315,7 @@ function resolveWithTS(containingFile, source, ts2, fs) {
18326
18315
  }
18327
18316
  tsCompilerOptions = matchedConfig.config.options;
18328
18317
  tsResolveCache = matchedConfig.cache || (matchedConfig.cache = ts2.createModuleResolutionCache(
18329
- process.cwd(),
18318
+ process__namespace.cwd(),
18330
18319
  createGetCanonicalFileName(ts2.sys.useCaseSensitiveFileNames),
18331
18320
  tsCompilerOptions
18332
18321
  ));
@@ -18715,6 +18704,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
18715
18704
  case "WeakMap":
18716
18705
  case "Date":
18717
18706
  case "Promise":
18707
+ case "Error":
18718
18708
  return [node.typeName.name];
18719
18709
  case "Partial":
18720
18710
  case "Required":
@@ -19111,7 +19101,7 @@ function genRuntimeProps(ctx) {
19111
19101
  const defaults = [];
19112
19102
  for (const key in ctx.propsDestructuredBindings) {
19113
19103
  const d = genDestructuredDefaultValue(ctx, key);
19114
- const finalKey = getEscapedKey(key);
19104
+ const finalKey = getEscapedPropName(key);
19115
19105
  if (d)
19116
19106
  defaults.push(
19117
19107
  `${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
@@ -19203,7 +19193,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
19203
19193
  }
19204
19194
  }
19205
19195
  }
19206
- const finalKey = getEscapedKey(key);
19196
+ const finalKey = getEscapedPropName(key);
19207
19197
  if (!ctx.options.isProd) {
19208
19198
  return `${finalKey}: { ${concatStrings([
19209
19199
  `type: ${toRuntimeTypeString(type)}`,
@@ -19269,7 +19259,7 @@ function inferValueType(node) {
19269
19259
  }
19270
19260
 
19271
19261
  function processPropsDestructure(ctx, declId) {
19272
- if (!ctx.options.propsDestructure && !ctx.options.reactivityTransform) {
19262
+ if (!ctx.options.propsDestructure) {
19273
19263
  return;
19274
19264
  }
19275
19265
  warnOnce(
@@ -19317,7 +19307,7 @@ To stay updated, follow the RFC at https://github.com/vuejs/rfcs/discussions/502
19317
19307
  }
19318
19308
  }
19319
19309
  function transformDestructuredProps(ctx, vueImportAliases) {
19320
- if (!ctx.options.propsDestructure && !ctx.options.reactivityTransform) {
19310
+ if (!ctx.options.propsDestructure) {
19321
19311
  return;
19322
19312
  }
19323
19313
  const rootScope = {};
@@ -19668,8 +19658,6 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
19668
19658
  const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
19669
19659
  const scriptLang = script && script.lang;
19670
19660
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
19671
- const enableReactivityTransform = !!options.reactivityTransform;
19672
- let refBindings;
19673
19661
  if (!scriptSetup) {
19674
19662
  if (!script) {
19675
19663
  throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
@@ -19883,17 +19871,6 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
19883
19871
  );
19884
19872
  }
19885
19873
  }
19886
- if (enableReactivityTransform && reactivityTransform.shouldTransform(script.content)) {
19887
- const { rootRefs, importedHelpers } = reactivityTransform.transformAST(
19888
- scriptAst,
19889
- ctx.s,
19890
- scriptStartOffset
19891
- );
19892
- refBindings = rootRefs;
19893
- for (const h of importedHelpers) {
19894
- ctx.helperImports.add(h);
19895
- }
19896
- }
19897
19874
  if (scriptStartOffset > startOffset) {
19898
19875
  if (!/\n$/.test(script.content.trim())) {
19899
19876
  ctx.s.appendLeft(scriptEndOffset, `
@@ -20021,19 +19998,6 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
20021
19998
  if (ctx.propsDestructureDecl) {
20022
19999
  transformDestructuredProps(ctx, vueImportAliases);
20023
20000
  }
20024
- if (enableReactivityTransform && // normal <script> had ref bindings that maybe used in <script setup>
20025
- (refBindings || reactivityTransform.shouldTransform(scriptSetup.content))) {
20026
- const { rootRefs, importedHelpers } = reactivityTransform.transformAST(
20027
- scriptSetupAst,
20028
- ctx.s,
20029
- startOffset,
20030
- refBindings
20031
- );
20032
- refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
20033
- for (const h of importedHelpers) {
20034
- ctx.helperImports.add(h);
20035
- }
20036
- }
20037
20001
  checkInvalidScopeReference(ctx.propsRuntimeDecl, DEFINE_PROPS);
20038
20002
  checkInvalidScopeReference(ctx.propsRuntimeDefaults, DEFINE_PROPS);
20039
20003
  checkInvalidScopeReference(ctx.propsDestructureDecl, DEFINE_PROPS);
@@ -20069,11 +20033,6 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
20069
20033
  for (const key in setupBindings) {
20070
20034
  ctx.bindingMetadata[key] = setupBindings[key];
20071
20035
  }
20072
- if (refBindings) {
20073
- for (const key of refBindings) {
20074
- ctx.bindingMetadata[key] = "setup-ref";
20075
- }
20076
- }
20077
20036
  if (sfc.cssVars.length && // no need to do this when targeting SSR
20078
20037
  !((_a = options.templateOptions) == null ? void 0 : _a.ssr)) {
20079
20038
  ctx.helperImports.add(CSS_VARS_HELPER);
@@ -20289,7 +20248,6 @@ ${exposeCall}`
20289
20248
  `
20290
20249
  );
20291
20250
  }
20292
- ctx.s.trim();
20293
20251
  return {
20294
20252
  ...scriptSetup,
20295
20253
  bindings: ctx.bindingMetadata,
@@ -20461,18 +20419,17 @@ function isStaticNode(node) {
20461
20419
  return false;
20462
20420
  }
20463
20421
 
20464
- const version = "3.4.0-alpha.1";
20422
+ const version = "3.4.0-alpha.2";
20423
+ const parseCache = parseCache$1;
20465
20424
  const walk = estreeWalker.walk;
20425
+ const shouldTransformRef = () => false;
20466
20426
 
20467
- exports.babelParse = parser$2.parse;
20468
20427
  exports.extractIdentifiers = compilerCore.extractIdentifiers;
20469
20428
  exports.generateCodeFrame = compilerCore.generateCodeFrame;
20470
20429
  exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
20471
20430
  exports.isStaticProperty = compilerCore.isStaticProperty;
20472
20431
  exports.walkIdentifiers = compilerCore.walkIdentifiers;
20473
- exports.shouldTransformRef = reactivityTransform.shouldTransform;
20474
- exports.transformRef = reactivityTransform.transform;
20475
- exports.transformRefAST = reactivityTransform.transformAST;
20432
+ exports.babelParse = parser$2.parse;
20476
20433
  exports.MagicString = MagicString;
20477
20434
  exports.compileScript = compileScript;
20478
20435
  exports.compileStyle = compileStyle;
@@ -20488,5 +20445,6 @@ exports.registerTS = registerTS;
20488
20445
  exports.resolveTypeElements = resolveTypeElements;
20489
20446
  exports.rewriteDefault = rewriteDefault;
20490
20447
  exports.rewriteDefaultAST = rewriteDefaultAST;
20448
+ exports.shouldTransformRef = shouldTransformRef;
20491
20449
  exports.version = version;
20492
20450
  exports.walk = walk;