@vue/compiler-sfc 3.2.8 → 3.2.9

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.
@@ -1492,7 +1492,10 @@ function compileScript(sfc, options) {
1492
1492
  return isQualifiedType(node.declaration);
1493
1493
  }
1494
1494
  };
1495
- for (const node of scriptSetupAst.body) {
1495
+ const body = scriptAst
1496
+ ? [...scriptSetupAst.body, ...scriptAst.body]
1497
+ : scriptSetupAst.body;
1498
+ for (const node of body) {
1496
1499
  const qualified = isQualifiedType(node);
1497
1500
  if (qualified) {
1498
1501
  return qualified;
@@ -1535,7 +1538,7 @@ function compileScript(sfc, options) {
1535
1538
  /**
1536
1539
  * check defaults. If the default object is an object literal with only
1537
1540
  * static properties, we can directly generate more optimzied default
1538
- * decalrations. Otherwise we will have to fallback to runtime merging.
1541
+ * declarations. Otherwise we will have to fallback to runtime merging.
1539
1542
  */
1540
1543
  function checkStaticDefaults() {
1541
1544
  return (propsRuntimeDefaults &&
@@ -1597,7 +1600,8 @@ function compileScript(sfc, options) {
1597
1600
  ', ';
1598
1601
  }
1599
1602
  else {
1600
- res += scriptSetupSource.slice(m.start, m.end) + `, `;
1603
+ res +=
1604
+ scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
1601
1605
  }
1602
1606
  }
1603
1607
  }
@@ -1802,7 +1806,7 @@ function compileScript(sfc, options) {
1802
1806
  }
1803
1807
  }
1804
1808
  }
1805
- // walk decalrations to record declared bindings
1809
+ // walk declarations to record declared bindings
1806
1810
  if ((node.type === 'VariableDeclaration' ||
1807
1811
  node.type === 'FunctionDeclaration' ||
1808
1812
  node.type === 'ClassDeclaration') &&
@@ -2279,6 +2283,7 @@ function inferRuntimeType(node, declaredTypes) {
2279
2283
  case 'Map':
2280
2284
  case 'WeakSet':
2281
2285
  case 'WeakMap':
2286
+ case 'Date':
2282
2287
  return [node.typeName.name];
2283
2288
  case 'Record':
2284
2289
  case 'Partial':
@@ -11697,232 +11697,6 @@ var toFastProperties = function toFastproperties(o) {
11697
11697
  return FastObject(o);
11698
11698
  };
11699
11699
 
11700
- var global = (typeof global !== "undefined" ? global :
11701
- typeof self !== "undefined" ? self :
11702
- typeof window !== "undefined" ? window : {});
11703
-
11704
- // shim for using process in browser
11705
- // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
11706
-
11707
- function defaultSetTimout() {
11708
- throw new Error('setTimeout has not been defined');
11709
- }
11710
- function defaultClearTimeout () {
11711
- throw new Error('clearTimeout has not been defined');
11712
- }
11713
- var cachedSetTimeout = defaultSetTimout;
11714
- var cachedClearTimeout = defaultClearTimeout;
11715
- if (typeof global.setTimeout === 'function') {
11716
- cachedSetTimeout = setTimeout;
11717
- }
11718
- if (typeof global.clearTimeout === 'function') {
11719
- cachedClearTimeout = clearTimeout;
11720
- }
11721
-
11722
- function runTimeout(fun) {
11723
- if (cachedSetTimeout === setTimeout) {
11724
- //normal enviroments in sane situations
11725
- return setTimeout(fun, 0);
11726
- }
11727
- // if setTimeout wasn't available but was latter defined
11728
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
11729
- cachedSetTimeout = setTimeout;
11730
- return setTimeout(fun, 0);
11731
- }
11732
- try {
11733
- // when when somebody has screwed with setTimeout but no I.E. maddness
11734
- return cachedSetTimeout(fun, 0);
11735
- } catch(e){
11736
- try {
11737
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
11738
- return cachedSetTimeout.call(null, fun, 0);
11739
- } catch(e){
11740
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
11741
- return cachedSetTimeout.call(this, fun, 0);
11742
- }
11743
- }
11744
-
11745
-
11746
- }
11747
- function runClearTimeout(marker) {
11748
- if (cachedClearTimeout === clearTimeout) {
11749
- //normal enviroments in sane situations
11750
- return clearTimeout(marker);
11751
- }
11752
- // if clearTimeout wasn't available but was latter defined
11753
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
11754
- cachedClearTimeout = clearTimeout;
11755
- return clearTimeout(marker);
11756
- }
11757
- try {
11758
- // when when somebody has screwed with setTimeout but no I.E. maddness
11759
- return cachedClearTimeout(marker);
11760
- } catch (e){
11761
- try {
11762
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
11763
- return cachedClearTimeout.call(null, marker);
11764
- } catch (e){
11765
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
11766
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
11767
- return cachedClearTimeout.call(this, marker);
11768
- }
11769
- }
11770
-
11771
-
11772
-
11773
- }
11774
- var queue = [];
11775
- var draining = false;
11776
- var currentQueue;
11777
- var queueIndex = -1;
11778
-
11779
- function cleanUpNextTick() {
11780
- if (!draining || !currentQueue) {
11781
- return;
11782
- }
11783
- draining = false;
11784
- if (currentQueue.length) {
11785
- queue = currentQueue.concat(queue);
11786
- } else {
11787
- queueIndex = -1;
11788
- }
11789
- if (queue.length) {
11790
- drainQueue();
11791
- }
11792
- }
11793
-
11794
- function drainQueue() {
11795
- if (draining) {
11796
- return;
11797
- }
11798
- var timeout = runTimeout(cleanUpNextTick);
11799
- draining = true;
11800
-
11801
- var len = queue.length;
11802
- while(len) {
11803
- currentQueue = queue;
11804
- queue = [];
11805
- while (++queueIndex < len) {
11806
- if (currentQueue) {
11807
- currentQueue[queueIndex].run();
11808
- }
11809
- }
11810
- queueIndex = -1;
11811
- len = queue.length;
11812
- }
11813
- currentQueue = null;
11814
- draining = false;
11815
- runClearTimeout(timeout);
11816
- }
11817
- function nextTick(fun) {
11818
- var args = new Array(arguments.length - 1);
11819
- if (arguments.length > 1) {
11820
- for (var i = 1; i < arguments.length; i++) {
11821
- args[i - 1] = arguments[i];
11822
- }
11823
- }
11824
- queue.push(new Item(fun, args));
11825
- if (queue.length === 1 && !draining) {
11826
- runTimeout(drainQueue);
11827
- }
11828
- }
11829
- // v8 likes predictible objects
11830
- function Item(fun, array) {
11831
- this.fun = fun;
11832
- this.array = array;
11833
- }
11834
- Item.prototype.run = function () {
11835
- this.fun.apply(null, this.array);
11836
- };
11837
- var title = 'browser';
11838
- var platform = 'browser';
11839
- var browser = true;
11840
- var env = {};
11841
- var argv = [];
11842
- var version = ''; // empty string to avoid regexp issues
11843
- var versions = {};
11844
- var release = {};
11845
- var config = {};
11846
-
11847
- function noop() {}
11848
-
11849
- var on = noop;
11850
- var addListener = noop;
11851
- var once = noop;
11852
- var off = noop;
11853
- var removeListener = noop;
11854
- var removeAllListeners = noop;
11855
- var emit = noop;
11856
-
11857
- function binding(name) {
11858
- throw new Error('process.binding is not supported');
11859
- }
11860
-
11861
- function cwd () { return '/' }
11862
- function chdir (dir) {
11863
- throw new Error('process.chdir is not supported');
11864
- }function umask() { return 0; }
11865
-
11866
- // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
11867
- var performance = global.performance || {};
11868
- var performanceNow =
11869
- performance.now ||
11870
- performance.mozNow ||
11871
- performance.msNow ||
11872
- performance.oNow ||
11873
- performance.webkitNow ||
11874
- function(){ return (new Date()).getTime() };
11875
-
11876
- // generate timestamp or delta
11877
- // see http://nodejs.org/api/process.html#process_process_hrtime
11878
- function hrtime(previousTimestamp){
11879
- var clocktime = performanceNow.call(performance)*1e-3;
11880
- var seconds = Math.floor(clocktime);
11881
- var nanoseconds = Math.floor((clocktime%1)*1e9);
11882
- if (previousTimestamp) {
11883
- seconds = seconds - previousTimestamp[0];
11884
- nanoseconds = nanoseconds - previousTimestamp[1];
11885
- if (nanoseconds<0) {
11886
- seconds--;
11887
- nanoseconds += 1e9;
11888
- }
11889
- }
11890
- return [seconds,nanoseconds]
11891
- }
11892
-
11893
- var startTime = new Date();
11894
- function uptime() {
11895
- var currentTime = new Date();
11896
- var dif = currentTime - startTime;
11897
- return dif / 1000;
11898
- }
11899
-
11900
- var browser$1 = {
11901
- nextTick: nextTick,
11902
- title: title,
11903
- browser: browser,
11904
- env: env,
11905
- argv: argv,
11906
- version: version,
11907
- versions: versions,
11908
- on: on,
11909
- addListener: addListener,
11910
- once: once,
11911
- off: off,
11912
- removeListener: removeListener,
11913
- removeAllListeners: removeAllListeners,
11914
- emit: emit,
11915
- binding: binding,
11916
- cwd: cwd,
11917
- chdir: chdir,
11918
- umask: umask,
11919
- hrtime: hrtime,
11920
- platform: platform,
11921
- release: release,
11922
- config: config,
11923
- uptime: uptime
11924
- };
11925
-
11926
11700
  var _default$4 = isType;
11927
11701
 
11928
11702
 
@@ -34727,7 +34501,7 @@ function processExpression(node, context,
34727
34501
  // function params
34728
34502
  asParams = false,
34729
34503
  // v-on handler values may contain multiple statements
34730
- asRawStatements = false) {
34504
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
34731
34505
  if (!context.prefixIdentifiers || !node.content.trim()) {
34732
34506
  return node;
34733
34507
  }
@@ -34741,7 +34515,7 @@ asRawStatements = false) {
34741
34515
  const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
34742
34516
  // ({ x } = y)
34743
34517
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
34744
- if (type === "setup-const" /* SETUP_CONST */) {
34518
+ if (type === "setup-const" /* SETUP_CONST */ || localVars[raw]) {
34745
34519
  return raw;
34746
34520
  }
34747
34521
  else if (type === "setup-ref" /* SETUP_REF */) {
@@ -34765,7 +34539,7 @@ asRawStatements = false) {
34765
34539
  // x = y --> isRef(x) ? x.value = y : x = y
34766
34540
  const { right: rVal, operator } = parent;
34767
34541
  const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
34768
- const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
34542
+ const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context, false, false, knownIds));
34769
34543
  return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
34770
34544
  }
34771
34545
  else if (isUpdateArg) {
@@ -40937,6 +40711,10 @@ function toASCII(input) {
40937
40711
  });
40938
40712
  }
40939
40713
 
40714
+ var global = (typeof global !== "undefined" ? global :
40715
+ typeof self !== "undefined" ? self :
40716
+ typeof window !== "undefined" ? window : {});
40717
+
40940
40718
  var lookup = [];
40941
40719
  var revLookup = [];
40942
40720
  var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
@@ -45742,7 +45520,7 @@ var CompilerSSR = /*#__PURE__*/Object.freeze({
45742
45520
 
45743
45521
  const hasWarned = {};
45744
45522
  function warnOnce(msg) {
45745
- const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
45523
+ const isNodeProd = typeof process !== 'undefined' && ({}).NODE_ENV === 'production';
45746
45524
  if (!isNodeProd && !false && !hasWarned[msg]) {
45747
45525
  hasWarned[msg] = true;
45748
45526
  warn(msg);
@@ -45779,7 +45557,8 @@ function compileTemplate(options) {
45779
45557
  const preprocessor = preprocessLang
45780
45558
  ? preprocessCustomRequire
45781
45559
  ? preprocessCustomRequire(preprocessLang)
45782
- : require('consolidate')[preprocessLang]
45560
+ : undefined
45561
+
45783
45562
  : false;
45784
45563
  if (preprocessor) {
45785
45564
  try {
@@ -45920,21 +45699,18 @@ function patchErrors(errors, source, inMap) {
45920
45699
  });
45921
45700
  }
45922
45701
 
45923
- const env$1 = process.env;
45702
+ const env = ({});
45924
45703
 
45925
- const isDisabled = "NO_COLOR" in env$1;
45926
- const isForced = "FORCE_COLOR" in env$1;
45927
- const isWindows = process.platform === "win32";
45704
+ const isDisabled = "NO_COLOR" in env;
45705
+ const isForced = "FORCE_COLOR" in env;
45706
+ const isWindows = "" === "win32";
45928
45707
 
45929
45708
  const isCompatibleTerminal =
45930
- process.stdout != null &&
45931
- process.stdout.isTTY &&
45932
- env$1.TERM &&
45933
- env$1.TERM !== "dumb";
45709
+ null != null ;
45934
45710
 
45935
45711
  const isCI =
45936
- "CI" in env$1 &&
45937
- ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
45712
+ "CI" in env &&
45713
+ ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
45938
45714
 
45939
45715
  let enabled =
45940
45716
  !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
@@ -52877,7 +52653,7 @@ class LazyResult$2 {
52877
52653
  error.plugin = plugin.postcssPlugin;
52878
52654
  error.setMessage();
52879
52655
  } else if (plugin.postcssVersion) {
52880
- if (browser$1.env.NODE_ENV !== 'production') {
52656
+ if (({}).NODE_ENV !== 'production') {
52881
52657
  let pluginName = plugin.postcssPlugin;
52882
52658
  let pluginVer = plugin.postcssVersion;
52883
52659
  let runtimeVer = this.result.processor.version;
@@ -59136,7 +58912,7 @@ function transformAST(ast, s, offset = 0, knownRootVars) {
59136
58912
  }
59137
58913
  }
59138
58914
  function checkRefId(scope, id, parent, parentStack) {
59139
- if (id.name in scope) {
58915
+ if (hasOwn(scope, id.name)) {
59140
58916
  if (scope[id.name]) {
59141
58917
  if (isStaticProperty(parent) && parent.shorthand) {
59142
58918
  // let binding used in a property shorthand
@@ -59251,7 +59027,7 @@ function warnExperimental() {
59251
59027
  `You can follow the proposal's status at ${RFC_LINK}.`);
59252
59028
  }
59253
59029
  function warnOnce$2(msg) {
59254
- const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
59030
+ const isNodeProd = typeof process !== 'undefined' && ({}).NODE_ENV === 'production';
59255
59031
  if (!isNodeProd && !false && !hasWarned$1[msg]) {
59256
59032
  hasWarned$1[msg] = true;
59257
59033
  warn$1(msg);
@@ -59516,7 +59292,10 @@ function compileScript(sfc, options) {
59516
59292
  return isQualifiedType(node.declaration);
59517
59293
  }
59518
59294
  };
59519
- for (const node of scriptSetupAst.body) {
59295
+ const body = scriptAst
59296
+ ? [...scriptSetupAst.body, ...scriptAst.body]
59297
+ : scriptSetupAst.body;
59298
+ for (const node of body) {
59520
59299
  const qualified = isQualifiedType(node);
59521
59300
  if (qualified) {
59522
59301
  return qualified;
@@ -59559,7 +59338,7 @@ function compileScript(sfc, options) {
59559
59338
  /**
59560
59339
  * check defaults. If the default object is an object literal with only
59561
59340
  * static properties, we can directly generate more optimzied default
59562
- * decalrations. Otherwise we will have to fallback to runtime merging.
59341
+ * declarations. Otherwise we will have to fallback to runtime merging.
59563
59342
  */
59564
59343
  function checkStaticDefaults() {
59565
59344
  return (propsRuntimeDefaults &&
@@ -59621,7 +59400,8 @@ function compileScript(sfc, options) {
59621
59400
  ', ';
59622
59401
  }
59623
59402
  else {
59624
- res += scriptSetupSource.slice(m.start, m.end) + `, `;
59403
+ res +=
59404
+ scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
59625
59405
  }
59626
59406
  }
59627
59407
  }
@@ -59826,7 +59606,7 @@ function compileScript(sfc, options) {
59826
59606
  }
59827
59607
  }
59828
59608
  }
59829
- // walk decalrations to record declared bindings
59609
+ // walk declarations to record declared bindings
59830
59610
  if ((node.type === 'VariableDeclaration' ||
59831
59611
  node.type === 'FunctionDeclaration' ||
59832
59612
  node.type === 'ClassDeclaration') &&
@@ -60303,6 +60083,7 @@ function inferRuntimeType(node, declaredTypes) {
60303
60083
  case 'Map':
60304
60084
  case 'WeakSet':
60305
60085
  case 'WeakMap':
60086
+ case 'Date':
60306
60087
  return [node.typeName.name];
60307
60088
  case 'Record':
60308
60089
  case 'Partial':
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
+ "module": "dist/compiler-sfc.esm-browser.js",
6
7
  "types": "dist/compiler-sfc.d.ts",
7
8
  "files": [
8
9
  "dist"
@@ -34,11 +35,11 @@
34
35
  "@babel/parser": "^7.15.0",
35
36
  "@babel/types": "^7.15.0",
36
37
  "@types/estree": "^0.0.48",
37
- "@vue/compiler-core": "3.2.8",
38
- "@vue/compiler-dom": "3.2.8",
39
- "@vue/compiler-ssr": "3.2.8",
40
- "@vue/ref-transform": "3.2.8",
41
- "@vue/shared": "3.2.8",
38
+ "@vue/compiler-core": "3.2.9",
39
+ "@vue/compiler-dom": "3.2.9",
40
+ "@vue/compiler-ssr": "3.2.9",
41
+ "@vue/ref-transform": "3.2.9",
42
+ "@vue/shared": "3.2.9",
42
43
  "consolidate": "^0.16.0",
43
44
  "estree-walker": "^2.0.2",
44
45
  "hash-sum": "^2.0.0",