@vue/compiler-core 3.1.4 → 3.1.5

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.
@@ -357,7 +357,7 @@ function isCoreComponent(tag) {
357
357
  const nonIdentifierRE = /^\d|[^\$\w]/;
358
358
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
359
359
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
360
- const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/;
360
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
361
361
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
362
362
  /**
363
363
  * Simple lexer to check if an expression is a member expression. This is
@@ -369,26 +369,32 @@ const isMemberExpression = (path) => {
369
369
  // remove whitespaces around . or [ first
370
370
  path = path.trim().replace(whitespaceRE, s => s.trim());
371
371
  let state = 0 /* inMemberExp */;
372
- let prevState = 0 /* inMemberExp */;
372
+ let stateStack = [];
373
373
  let currentOpenBracketCount = 0;
374
+ let currentOpenParensCount = 0;
374
375
  let currentStringType = null;
375
376
  for (let i = 0; i < path.length; i++) {
376
377
  const char = path.charAt(i);
377
378
  switch (state) {
378
379
  case 0 /* inMemberExp */:
379
380
  if (char === '[') {
380
- prevState = state;
381
+ stateStack.push(state);
381
382
  state = 1 /* inBrackets */;
382
383
  currentOpenBracketCount++;
383
384
  }
385
+ else if (char === '(') {
386
+ stateStack.push(state);
387
+ state = 2 /* inParens */;
388
+ currentOpenParensCount++;
389
+ }
384
390
  else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
385
391
  return false;
386
392
  }
387
393
  break;
388
394
  case 1 /* inBrackets */:
389
395
  if (char === `'` || char === `"` || char === '`') {
390
- prevState = state;
391
- state = 2 /* inString */;
396
+ stateStack.push(state);
397
+ state = 3 /* inString */;
392
398
  currentStringType = char;
393
399
  }
394
400
  else if (char === `[`) {
@@ -396,19 +402,38 @@ const isMemberExpression = (path) => {
396
402
  }
397
403
  else if (char === `]`) {
398
404
  if (!--currentOpenBracketCount) {
399
- state = prevState;
405
+ state = stateStack.pop();
406
+ }
407
+ }
408
+ break;
409
+ case 2 /* inParens */:
410
+ if (char === `'` || char === `"` || char === '`') {
411
+ stateStack.push(state);
412
+ state = 3 /* inString */;
413
+ currentStringType = char;
414
+ }
415
+ else if (char === `(`) {
416
+ currentOpenParensCount++;
417
+ }
418
+ else if (char === `)`) {
419
+ // if the exp ends as a call then it should not be considered valid
420
+ if (i === path.length - 1) {
421
+ return false;
422
+ }
423
+ if (!--currentOpenParensCount) {
424
+ state = stateStack.pop();
400
425
  }
401
426
  }
402
427
  break;
403
- case 2 /* inString */:
428
+ case 3 /* inString */:
404
429
  if (char === currentStringType) {
405
- state = prevState;
430
+ state = stateStack.pop();
406
431
  currentStringType = null;
407
432
  }
408
433
  break;
409
434
  }
410
435
  }
411
- return !currentOpenBracketCount;
436
+ return !currentOpenBracketCount && !currentOpenParensCount;
412
437
  };
413
438
  function getInnerRange(loc, offset, length) {
414
439
  const source = loc.source.substr(offset, length);
@@ -3870,7 +3895,8 @@ function hasForwardedSlots(children) {
3870
3895
  switch (child.type) {
3871
3896
  case 1 /* ELEMENT */:
3872
3897
  if (child.tagType === 2 /* SLOT */ ||
3873
- (child.tagType === 0 /* ELEMENT */ &&
3898
+ ((child.tagType === 0 /* ELEMENT */ ||
3899
+ child.tagType === 3 /* TEMPLATE */) &&
3874
3900
  hasForwardedSlots(child.children))) {
3875
3901
  return true;
3876
3902
  }
@@ -356,7 +356,7 @@ function isCoreComponent(tag) {
356
356
  const nonIdentifierRE = /^\d|[^\$\w]/;
357
357
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
358
358
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
359
- const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/;
359
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
360
360
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
361
361
  /**
362
362
  * Simple lexer to check if an expression is a member expression. This is
@@ -368,26 +368,32 @@ const isMemberExpression = (path) => {
368
368
  // remove whitespaces around . or [ first
369
369
  path = path.trim().replace(whitespaceRE, s => s.trim());
370
370
  let state = 0 /* inMemberExp */;
371
- let prevState = 0 /* inMemberExp */;
371
+ let stateStack = [];
372
372
  let currentOpenBracketCount = 0;
373
+ let currentOpenParensCount = 0;
373
374
  let currentStringType = null;
374
375
  for (let i = 0; i < path.length; i++) {
375
376
  const char = path.charAt(i);
376
377
  switch (state) {
377
378
  case 0 /* inMemberExp */:
378
379
  if (char === '[') {
379
- prevState = state;
380
+ stateStack.push(state);
380
381
  state = 1 /* inBrackets */;
381
382
  currentOpenBracketCount++;
382
383
  }
384
+ else if (char === '(') {
385
+ stateStack.push(state);
386
+ state = 2 /* inParens */;
387
+ currentOpenParensCount++;
388
+ }
383
389
  else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
384
390
  return false;
385
391
  }
386
392
  break;
387
393
  case 1 /* inBrackets */:
388
394
  if (char === `'` || char === `"` || char === '`') {
389
- prevState = state;
390
- state = 2 /* inString */;
395
+ stateStack.push(state);
396
+ state = 3 /* inString */;
391
397
  currentStringType = char;
392
398
  }
393
399
  else if (char === `[`) {
@@ -395,19 +401,38 @@ const isMemberExpression = (path) => {
395
401
  }
396
402
  else if (char === `]`) {
397
403
  if (!--currentOpenBracketCount) {
398
- state = prevState;
404
+ state = stateStack.pop();
405
+ }
406
+ }
407
+ break;
408
+ case 2 /* inParens */:
409
+ if (char === `'` || char === `"` || char === '`') {
410
+ stateStack.push(state);
411
+ state = 3 /* inString */;
412
+ currentStringType = char;
413
+ }
414
+ else if (char === `(`) {
415
+ currentOpenParensCount++;
416
+ }
417
+ else if (char === `)`) {
418
+ // if the exp ends as a call then it should not be considered valid
419
+ if (i === path.length - 1) {
420
+ return false;
421
+ }
422
+ if (!--currentOpenParensCount) {
423
+ state = stateStack.pop();
399
424
  }
400
425
  }
401
426
  break;
402
- case 2 /* inString */:
427
+ case 3 /* inString */:
403
428
  if (char === currentStringType) {
404
- state = prevState;
429
+ state = stateStack.pop();
405
430
  currentStringType = null;
406
431
  }
407
432
  break;
408
433
  }
409
434
  }
410
- return !currentOpenBracketCount;
435
+ return !currentOpenBracketCount && !currentOpenParensCount;
411
436
  };
412
437
  function getInnerRange(loc, offset, length) {
413
438
  const source = loc.source.substr(offset, length);
@@ -3794,7 +3819,8 @@ function hasForwardedSlots(children) {
3794
3819
  switch (child.type) {
3795
3820
  case 1 /* ELEMENT */:
3796
3821
  if (child.tagType === 2 /* SLOT */ ||
3797
- (child.tagType === 0 /* ELEMENT */ &&
3822
+ ((child.tagType === 0 /* ELEMENT */ ||
3823
+ child.tagType === 3 /* TEMPLATE */) &&
3798
3824
  hasForwardedSlots(child.children))) {
3799
3825
  return true;
3800
3826
  }
@@ -352,7 +352,7 @@ function isCoreComponent(tag) {
352
352
  const nonIdentifierRE = /^\d|[^\$\w]/;
353
353
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
354
354
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
355
- const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/;
355
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
356
356
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
357
357
  /**
358
358
  * Simple lexer to check if an expression is a member expression. This is
@@ -364,26 +364,32 @@ const isMemberExpression = (path) => {
364
364
  // remove whitespaces around . or [ first
365
365
  path = path.trim().replace(whitespaceRE, s => s.trim());
366
366
  let state = 0 /* inMemberExp */;
367
- let prevState = 0 /* inMemberExp */;
367
+ let stateStack = [];
368
368
  let currentOpenBracketCount = 0;
369
+ let currentOpenParensCount = 0;
369
370
  let currentStringType = null;
370
371
  for (let i = 0; i < path.length; i++) {
371
372
  const char = path.charAt(i);
372
373
  switch (state) {
373
374
  case 0 /* inMemberExp */:
374
375
  if (char === '[') {
375
- prevState = state;
376
+ stateStack.push(state);
376
377
  state = 1 /* inBrackets */;
377
378
  currentOpenBracketCount++;
378
379
  }
380
+ else if (char === '(') {
381
+ stateStack.push(state);
382
+ state = 2 /* inParens */;
383
+ currentOpenParensCount++;
384
+ }
379
385
  else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
380
386
  return false;
381
387
  }
382
388
  break;
383
389
  case 1 /* inBrackets */:
384
390
  if (char === `'` || char === `"` || char === '`') {
385
- prevState = state;
386
- state = 2 /* inString */;
391
+ stateStack.push(state);
392
+ state = 3 /* inString */;
387
393
  currentStringType = char;
388
394
  }
389
395
  else if (char === `[`) {
@@ -391,19 +397,38 @@ const isMemberExpression = (path) => {
391
397
  }
392
398
  else if (char === `]`) {
393
399
  if (!--currentOpenBracketCount) {
394
- state = prevState;
400
+ state = stateStack.pop();
401
+ }
402
+ }
403
+ break;
404
+ case 2 /* inParens */:
405
+ if (char === `'` || char === `"` || char === '`') {
406
+ stateStack.push(state);
407
+ state = 3 /* inString */;
408
+ currentStringType = char;
409
+ }
410
+ else if (char === `(`) {
411
+ currentOpenParensCount++;
412
+ }
413
+ else if (char === `)`) {
414
+ // if the exp ends as a call then it should not be considered valid
415
+ if (i === path.length - 1) {
416
+ return false;
417
+ }
418
+ if (!--currentOpenParensCount) {
419
+ state = stateStack.pop();
395
420
  }
396
421
  }
397
422
  break;
398
- case 2 /* inString */:
423
+ case 3 /* inString */:
399
424
  if (char === currentStringType) {
400
- state = prevState;
425
+ state = stateStack.pop();
401
426
  currentStringType = null;
402
427
  }
403
428
  break;
404
429
  }
405
430
  }
406
- return !currentOpenBracketCount;
431
+ return !currentOpenBracketCount && !currentOpenParensCount;
407
432
  };
408
433
  function getInnerRange(loc, offset, length) {
409
434
  const source = loc.source.substr(offset, length);
@@ -3319,7 +3344,8 @@ function hasForwardedSlots(children) {
3319
3344
  switch (child.type) {
3320
3345
  case 1 /* ELEMENT */:
3321
3346
  if (child.tagType === 2 /* SLOT */ ||
3322
- (child.tagType === 0 /* ELEMENT */ &&
3347
+ ((child.tagType === 0 /* ELEMENT */ ||
3348
+ child.tagType === 3 /* TEMPLATE */) &&
3323
3349
  hasForwardedSlots(child.children))) {
3324
3350
  return true;
3325
3351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.1.4",
35
+ "@vue/shared": "3.1.5",
36
36
  "@babel/parser": "^7.12.0",
37
37
  "@babel/types": "^7.12.0",
38
38
  "estree-walker": "^2.0.1",